// src/components/docs/getting-started/CLIPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { CodeBlock, InstallCommand } from "@contractspec/lib.design-system";
import { jsx, jsxs } from "react/jsx-runtime";
function CLIPage() {
  const commands = [
    {
      name: "create",
      description: "Interactive wizard to create contract specifications",
      usage: "contractspec create [--type operation] [--ai]"
    },
    {
      name: "build",
      description: "Generate implementation code from contract specs using AI agents",
      usage: "contractspec build <spec-file> [--agent-mode claude-code]"
    },
    {
      name: "validate",
      description: "Validate contract specifications and implementations",
      usage: "contractspec validate <spec-file> [--check-implementation]"
    },
    {
      name: "list",
      description: "List all contract specifications in the project",
      usage: "contractspec list [--type operation] [--json]"
    },
    {
      name: "watch",
      description: "Watch specs and auto-regenerate on changes",
      usage: "contractspec watch [--build] [--validate]"
    },
    {
      name: "sync",
      description: "Sync contracts by building all discovered specs",
      usage: "contractspec sync [--dry-run]"
    },
    {
      name: "ci",
      description: "Run all validation checks for CI/CD pipelines",
      usage: "contractspec ci [--format sarif] [--output results.sarif]"
    },
    {
      name: "deps",
      description: "Analyze contract dependencies and relationships",
      usage: "contractspec deps [--circular] [--format dot]"
    },
    {
      name: "diff",
      description: "Compare contract specifications and show differences",
      usage: "contractspec diff <spec1> <spec2> [--breaking]"
    }
  ];
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-2",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "ContractSpec CLI"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground text-lg",
            children: "Command-line interface for creating, building, and validating contract specifications with AI-powered code generation."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-6",
        children: [
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Installation"
              }),
              /* @__PURE__ */ jsx(InstallCommand, {
                package: "contractspec",
                dev: true
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Quick Start"
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "bash",
                code: `# Initialize project
bunx contractspec init

# Create a spec
contractspec create --type operation

# Generate code
contractspec build src/contracts/mySpec.ts

# Validate
contractspec validate src/contracts/mySpec.ts`
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-4",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "Commands"
              }),
              /* @__PURE__ */ jsx("div", {
                className: "grid gap-4",
                children: commands.map((cmd) => /* @__PURE__ */ jsxs("div", {
                  className: "card-subtle space-y-2 p-4",
                  children: [
                    /* @__PURE__ */ jsx("h3", {
                      className: "font-mono font-bold text-violet-400",
                      children: cmd.name
                    }),
                    /* @__PURE__ */ jsx("p", {
                      className: "text-muted-foreground text-sm",
                      children: cmd.description
                    }),
                    /* @__PURE__ */ jsx(CodeBlock, {
                      language: "bash",
                      code: cmd.usage,
                      showCopyButton: false
                    })
                  ]
                }, cmd.name))
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "AI Agent Modes"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground",
                children: "The CLI supports multiple AI agent modes for different use cases:"
              }),
              /* @__PURE__ */ jsxs("div", {
                className: "grid gap-3 md:grid-cols-2",
                children: [
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle p-4",
                    children: [
                      /* @__PURE__ */ jsx("h4", {
                        className: "font-bold",
                        children: "simple"
                      }),
                      /* @__PURE__ */ jsx("p", {
                        className: "text-muted-foreground text-sm",
                        children: "Direct LLM API calls, fast and straightforward. Best for rapid prototyping."
                      })
                    ]
                  }),
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle p-4",
                    children: [
                      /* @__PURE__ */ jsx("h4", {
                        className: "font-bold",
                        children: "claude-code"
                      }),
                      /* @__PURE__ */ jsx("p", {
                        className: "text-muted-foreground text-sm",
                        children: "Extended thinking with Claude. Best for production-quality code."
                      })
                    ]
                  }),
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle p-4",
                    children: [
                      /* @__PURE__ */ jsx("h4", {
                        className: "font-bold",
                        children: "openai-codex"
                      }),
                      /* @__PURE__ */ jsx("p", {
                        className: "text-muted-foreground text-sm",
                        children: "GPT-4o/o1 models. Excellent for algorithms and optimization."
                      })
                    ]
                  }),
                  /* @__PURE__ */ jsxs("div", {
                    className: "card-subtle p-4",
                    children: [
                      /* @__PURE__ */ jsx("h4", {
                        className: "font-bold",
                        children: "cursor"
                      }),
                      /* @__PURE__ */ jsx("p", {
                        className: "text-muted-foreground text-sm",
                        children: "Leverages Cursor agentic capabilities. Requires Cursor environment."
                      })
                    ]
                  })
                ]
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "space-y-3",
            children: [
              /* @__PURE__ */ jsx("h2", {
                className: "text-2xl font-bold",
                children: "CI/CD Integration"
              }),
              /* @__PURE__ */ jsx("p", {
                className: "text-muted-foreground",
                children: "Run all validation checks in CI/CD with machine-readable output:"
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "yaml",
                filename: ".github/workflows/validate.yml",
                code: `- name: Validate Contracts
  run: contractspec ci --format sarif --output results.sarif

- name: Upload SARIF
  uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: results.sarif`
              })
            ]
          }),
          /* @__PURE__ */ jsxs("div", {
            className: "card-subtle space-y-4 p-6",
            children: [
              /* @__PURE__ */ jsx("h3", {
                className: "font-bold",
                children: "Configuration"
              }),
              /* @__PURE__ */ jsxs("p", {
                className: "text-muted-foreground text-sm",
                children: [
                  "Create a ",
                  /* @__PURE__ */ jsx("code", {
                    children: ".contractsrc.json"
                  }),
                  " file in your project root:"
                ]
              }),
              /* @__PURE__ */ jsx(CodeBlock, {
                language: "json",
                filename: ".contractsrc.json",
                code: `{
  "aiProvider": "claude",
  "agentMode": "claude-code",
  "outputDir": "./src",
  "conventions": {
    "operations": "interactions/commands|queries",
    "events": "events"
  }
}`
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/getting-started/tools/vscode",
            className: "btn-primary",
            children: [
              "Next: VS Code Extension ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          }),
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/getting-started/tools",
            className: "btn-ghost",
            children: "Back to Tools"
          })
        ]
      })
    ]
  });
}
export {
  CLIPage
};
