Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver ToolsFeatured on FazierFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowAI ToolzShinyLaunchMillion Dot HomepageSolver Tools

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
CLI Tools Development Guide

CLI Tools Development Guide

Build professional command-line tools with Google Antigravity

clicommand-linenodejstypescript
by antigravity-team
⭐0Stars
.antigravity
# CLI Tools Development Guide for Google Antigravity

Create powerful, user-friendly command-line tools using modern TypeScript patterns with Google Antigravity IDE.

## CLI Framework Setup

```typescript
// src/cli.ts
import { Command } from "commander";
import { input, select, confirm, password } from "@inquirer/prompts";
import chalk from "chalk";
import ora from "ora";
import { version } from "../package.json";

const program = new Command();

program
  .name("myctl")
  .description("A powerful CLI tool built with Google Antigravity")
  .version(version)
  .option("-v, --verbose", "Enable verbose output")
  .option("-c, --config <path>", "Path to config file");

// Init command with interactive prompts
program
  .command("init")
  .description("Initialize a new project")
  .option("-t, --template <name>", "Template to use")
  .action(async (options) => {
    const projectName = await input({
      message: "Project name:",
      default: "my-project",
      validate: (value) => /^[a-z0-9-]+$/.test(value) || "Use lowercase letters, numbers, and hyphens"
    });

    const template = options.template || await select({
      message: "Select a template:",
      choices: [
        { name: "Next.js App", value: "nextjs" },
        { name: "Express API", value: "express" },
        { name: "CLI Tool", value: "cli" }
      ]
    });

    const useTypescript = await confirm({
      message: "Use TypeScript?",
      default: true
    });

    const spinner = ora("Creating project...").start();
    
    try {
      await createProject({ projectName, template, useTypescript });
      spinner.succeed(chalk.green("Project created successfully!"));
      console.log(chalk.cyan(`\nNext steps:\n  cd ${projectName}\n  npm install\n  npm run dev`));
    } catch (error) {
      spinner.fail(chalk.red("Failed to create project"));
      console.error(error);
      process.exit(1);
    }
  });

// Deploy command with progress
program
  .command("deploy")
  .description("Deploy the project")
  .option("-e, --env <environment>", "Target environment", "production")
  .option("--dry-run", "Preview changes without deploying")
  .action(async (options) => {
    const spinner = ora("Preparing deployment...").start();
    
    const steps = ["Building", "Testing", "Uploading", "Activating"];
    
    for (const step of steps) {
      spinner.text = `${step}...`;
      await simulateStep();
    }
    
    spinner.succeed(chalk.green("Deployed successfully!"));
    console.log(chalk.cyan(`\nDeployment URL: https://app.example.com`));
  });

program.parse();
```

## Configuration Management

```typescript
// src/config.ts
import { cosmiconfig } from "cosmiconfig";
import { z } from "zod";
import os from "os";
import path from "path";
import fs from "fs-extra";

const configSchema = z.object({
  apiUrl: z.string().url().default("https://api.example.com"),
  apiKey: z.string().optional(),
  defaultEnvironment: z.enum(["development", "staging", "production"]).default("development"),
  plugins: z.array(z.string()).default([])
});

export type Config = z.infer<typeof configSchema>;

export class ConfigManager {
  private config: Config | null = null;
  private configPath: string;

  constructor() {
    this.configPath = path.join(os.homedir(), ".myctl", "config.json");
  }

  async load(): Promise<Config> {
    const explorer = cosmiconfig("myctl");
    const result = await explorer.search();
    
    if (result) {
      this.config = configSchema.parse(result.config);
      return this.config;
    }
    
    // Load from global config
    if (await fs.pathExists(this.configPath)) {
      const data = await fs.readJson(this.configPath);
      this.config = configSchema.parse(data);
      return this.config;
    }
    
    return configSchema.parse({});
  }

  async save(config: Partial<Config>): Promise<void> {
    await fs.ensureDir(path.dirname(this.configPath));
    const existing = await this.load();
    const merged = { ...existing, ...config };
    await fs.writeJson(this.configPath, merged, { spaces: 2 });
  }

  get<K extends keyof Config>(key: K): Config[K] | undefined {
    return this.config?.[key];
  }
}
```

## Output Formatting

```typescript
// src/output.ts
import Table from "cli-table3";
import chalk from "chalk";
import boxen from "boxen";

export const formatTable = (data: Record<string, unknown>[], columns: string[]) => {
  const table = new Table({
    head: columns.map(c => chalk.cyan(c)),
    style: { head: [], border: [] }
  });

  data.forEach(row => {
    table.push(columns.map(col => String(row[col] || "")));
  });

  return table.toString();
};

export const formatBox = (title: string, content: string) => {
  return boxen(content, {
    title,
    titleAlignment: "center",
    padding: 1,
    borderStyle: "round",
    borderColor: "cyan"
  });
};

export const formatSuccess = (message: string) => chalk.green("OK ") + message;
export const formatError = (message: string) => chalk.red("ERR ") + message;
export const formatWarning = (message: string) => chalk.yellow("WARN ") + message;
export const formatInfo = (message: string) => chalk.blue("INFO ") + message;
```

## Best Practices

1. **Provide helpful error messages** with suggestions
2. **Support both interactive and non-interactive** modes
3. **Use spinners and progress** indicators for long operations
4. **Implement proper exit codes** for scripting
5. **Add shell completion** support
6. **Document all commands** with examples
7. **Support configuration files** and environment variables

Google Antigravity assists in building robust CLI tools with intelligent command suggestions and error handling patterns.

When to Use This Prompt

This cli prompt is ideal for developers working on:

  • cli applications requiring modern best practices and optimal performance
  • Projects that need production-ready cli code with proper error handling
  • Teams looking to standardize their cli development workflow
  • Developers wanting to learn industry-standard cli patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their cli implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the cli code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this cli prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For cli projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...