codowave 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +8558 -0
- package/package.json +3 -4
- package/dist/cli.js +0 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +0 -1335
- package/dist/index.mjs.map +0 -1
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/error.ts","../src/config.ts","../src/commands/init.tsx","../src/commands/run.ts","../src/commands/status.ts","../src/commands/logs.ts","../src/commands/config-cmd.ts","../src/commands/connect.ts","../src/commands/repo-cmd.ts","../src/commands/autopilot-cmd.ts","../src/commands/labels-cmd.ts","../src/commands/runs-cmd.ts","../src/index.ts","../src/utils/global-error.ts"],"sourcesContent":["import pc from \"picocolors\";\n\n/**\n * Base error class for Codowave-specific errors\n */\nexport class CodowaveError extends Error {\n constructor(\n message: string,\n public readonly code?: string,\n public readonly context?: Record<string, unknown>\n ) {\n super(message);\n this.name = \"CodowaveError\";\n }\n\n /**\n * Returns a formatted error message with optional context\n */\n getFormattedMessage(): string {\n let msg = this.message;\n if (this.context && Object.keys(this.context).length > 0) {\n msg += `\\n\\nContext: ${JSON.stringify(this.context, null, 2)}`;\n }\n return msg;\n }\n}\n\n/**\n * Error thrown when configuration is invalid or missing\n */\nexport class ConfigError extends CodowaveError {\n constructor(message: string, context?: Record<string, unknown>) {\n super(message, \"CONFIG_ERROR\", context);\n this.name = \"ConfigError\";\n }\n}\n\n/**\n * Error thrown when API operations fail\n */\nexport class APIError extends CodowaveError {\n constructor(\n message: string,\n public readonly statusCode?: number,\n context?: Record<string, unknown>\n ) {\n super(message, \"API_ERROR\", context);\n this.name = \"APIError\";\n }\n}\n\n/**\n * Error codes for common Codowave CLI errors\n */\nexport const ErrorCodes = {\n CONFIG_NOT_FOUND: \"CONFIG_NOT_FOUND\",\n INVALID_CONFIG: \"INVALID_CONFIG\",\n REPO_NOT_CONFIGURED: \"REPO_NOT_CONFIGURED\",\n API_ERROR: \"API_ERROR\",\n NETWORK_ERROR: \"NETWORK_ERROR\",\n AUTH_ERROR: \"AUTH_ERROR\",\n INVALID_ISSUE_FORMAT: \"INVALID_ISSUE_FORMAT\",\n RUN_FAILED: \"RUN_FAILED\",\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/**\n * Gets a user-friendly error message for common error codes\n */\nfunction getErrorMessage(err: unknown): string {\n if (err instanceof CodowaveError) {\n return err.getFormattedMessage();\n }\n\n if (err instanceof Error) {\n // Improve common error messages\n const message = err.message;\n\n if (message.includes(\"ECONNREFUSED\") || message.includes(\"ENOTFOUND\")) {\n return `Unable to connect to the Codowave API. Please check your internet connection and try again.`;\n }\n\n if (message.includes(\"401\") || message.includes(\"unauthorized\")) {\n return `Authentication failed. Please run 'codowave init' to re-authenticate.`;\n }\n\n if (message.includes(\"403\") || message.includes(\"forbidden\")) {\n return `Access denied. You don't have permission to perform this action.`;\n }\n\n if (message.includes(\"404\") || message.includes(\"not found\")) {\n return `The requested resource was not found. Please check the repository or issue number and try again.`;\n }\n\n if (message.includes(\"rate limit\")) {\n return `Rate limit exceeded. Please wait a moment and try again.`;\n }\n\n return message;\n }\n\n return String(err);\n}\n\nexport function handleError(err: unknown, context?: string): never {\n const message = getErrorMessage(err);\n const prefix = context ? `[${context}] ` : \"\";\n\n // Print formatted error\n console.error(`\\n${pc.red(\"✖\")} ${prefix}${message}\\n`);\n\n // If it's a CodowaveError with a code, print that too\n if (err instanceof CodowaveError && err.code) {\n console.error(pc.gray(`Error code: ${err.code}`));\n }\n\n // Show stack trace in development mode\n if (process.env['NODE_ENV'] === \"development\" && err instanceof Error && err.stack) {\n console.error(pc.gray(err.stack));\n }\n\n process.exit(1);\n}\n\nexport function formatError(err: unknown): string {\n return getErrorMessage(err);\n}\n\n/**\n * Wraps an async function with consistent error handling\n */\nexport async function withErrorHandling<T>(\n fn: () => Promise<T>,\n context?: string\n): Promise<T> {\n try {\n return await fn();\n } catch (err) {\n handleError(err, context);\n }\n}\n","import { readFileSync, writeFileSync, mkdirSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { z } from \"zod\";\nimport { ConfigError } from \"./utils/error.js\";\n\n// ── Schema ─────────────────────────────────────────────────────────────────\n\nexport const AIProviderSchema = z.object({\n provider: z.enum([\"openai\", \"anthropic\", \"minimax\", \"ollama\", \"custom\"]),\n apiKey: z.string().min(1),\n model: z.string().default(\"\"),\n baseUrl: z.string().url().optional(),\n});\n\nexport type AIProvider = z.infer<typeof AIProviderSchema>;\n\nexport const ConfigSchema = z.object({\n apiKey: z.string().min(1),\n apiUrl: z.string().url().default(\"https://api.codowave.com\"),\n repos: z\n .array(\n z.object({\n owner: z.string(),\n name: z.string(),\n id: z.string().optional(),\n })\n )\n .default([]),\n ai: AIProviderSchema.optional(),\n autopilot: z.boolean().default(false),\n labels: z\n .array(z.string())\n .default([\"codowave-agent\"]),\n});\n\nexport type CodowaveConfig = z.infer<typeof ConfigSchema>;\n\n// ── Paths ──────────────────────────────────────────────────────────────────\n\nconst CONFIG_DIR = join(homedir(), \".codowave\");\nconst CONFIG_FILE = join(CONFIG_DIR, \"config.json\");\n\n// ── Read ───────────────────────────────────────────────────────────────────\n\nexport function readConfig(): CodowaveConfig | null {\n if (!existsSync(CONFIG_FILE)) {\n return null;\n }\n\n try {\n const raw = readFileSync(CONFIG_FILE, \"utf-8\");\n const json = JSON.parse(raw);\n const parsed = ConfigSchema.safeParse(json);\n\n if (!parsed.success) {\n const issues = parsed.error.issues.map(i => ` - ${i.path.join('.')}: ${i.message}`).join('\\n');\n console.warn(`[config] Config validation failed:\\n${issues}`);\n return null;\n }\n\n return parsed.data;\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.warn(`[config] Failed to read ${CONFIG_FILE}: ${message}`);\n return null;\n }\n}\n\nexport function readConfigOrThrow(): CodowaveConfig {\n const config = readConfig();\n if (!config) {\n throw new ConfigError(\n \"No Codowave config found. Run `codowave init` to get started.\",\n { suggestion: \"Run 'codowave init' to configure your API key and repositories\" }\n );\n }\n return config;\n}\n\n// ── Write ──────────────────────────────────────────────────────────────────\n\nexport function writeConfig(config: CodowaveConfig): void {\n if (!existsSync(CONFIG_DIR)) {\n mkdirSync(CONFIG_DIR, { recursive: true });\n }\n\n writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + \"\\n\", \"utf-8\");\n}\n\nexport function updateConfig(\n updates: Partial<CodowaveConfig>\n): CodowaveConfig {\n const current = readConfig() ?? {\n apiKey: \"\",\n apiUrl: \"https://api.codowave.com\",\n repos: [],\n autopilot: false,\n labels: [\"codowave-agent\"],\n };\n\n const merged: CodowaveConfig = {\n ...current,\n ...updates,\n };\n\n writeConfig(merged);\n return merged;\n}\n\n// ── Config path getter (for display) ──────────────────────────────────────\n\nexport function getConfigPath(): string {\n return CONFIG_FILE;\n}\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { writeConfig, readConfig, getConfigPath } from \"../config.js\";\n\ntype Repo = {\n\towner: string;\n\tname: string;\n};\n\nexport const initCommand = new Command(\"init\")\n\t.description(\"Initialize Codowave and connect your GitHub repositories\")\n\t.requiredOption(\"--api-key <key>\", \"Codowave API key\")\n\t.option(\"--api-url <url>\", \"Codowave API URL\", \"https://api.codowave.com\")\n\t.option(\"--github-app-id <id>\", \"GitHub App ID\")\n\t.option(\"--github-app-private-key <path>\", \"GitHub App private key file path\")\n\t.option(\"--repos <repos>\", \"Comma-separated list of repos (owner/repo)\")\n\t.option(\"--no-autopilot\", \"Disable autopilot mode\")\n\t.option(\"--labels <labels>\", \"Comma-separated labels\", \"status/approved,status/in-progress,status/merged\")\n\t.action(async (opts) => {\n\t\t// Parse repos\n\t\tlet repos: Repo[] = [];\n\t\tif (opts.repos) {\n\t\t\trepos = opts.repos.split(\",\").map((r: string) => {\n\t\t\t\tconst [owner, name] = r.trim().split(\"/\");\n\t\t\t\tif (!owner || !name) {\n\t\t\t\t\tconsole.log(pc.red(`\\n❌ Invalid repo format: ${r}. Use owner/repo\\n`));\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\treturn { owner, name };\n\t\t\t});\n\t\t}\n\n\t\t// Parse labels as array\n\t\tconst labels = opts.labels.split(\",\").map((l: string) => l.trim()).filter(Boolean);\n\n\t\tconst config = {\n\t\t\tapiKey: opts.apiKey,\n\t\t\tapiUrl: opts.apiUrl,\n\t\t\tgithubAppId: opts.githubAppId || \"\",\n\t\t\tgithubAppPrivateKey: opts.githubAppPrivateKey || \"\",\n\t\t\trepos,\n\t\t\tautopilot: opts.autopilot !== false,\n\t\t\tlabels\n\t\t};\n\n\t\twriteConfig(config);\n\n\t\tconsole.log(pc.green(\"\\n✅ Codowave initialized successfully!\\n\"));\n\t\tconsole.log(` API URL: ${pc.cyan(config.apiUrl)}`);\n\t\tconsole.log(` Repos: ${pc.cyan(config.repos.map(r => `${r.owner}/${r.name}`).join(\", \") || \"none\")}`);\n\t\tconsole.log(` Autopilot: ${pc.cyan(config.autopilot ? \"enabled\" : \"disabled\")}`);\n\t\tconsole.log(pc.gray(`\\n Config: ${getConfigPath()}\\n`));\n\t});\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, type CodowaveConfig } from \"../config.js\";\nimport { handleError, CodowaveError, ErrorCodes, APIError, ConfigError } from \"../utils/error.js\";\nimport { type RunStatus } from \"./status.js\";\n\n// Demo runs store (in production, this would be from API)\nconst demoRuns: Map<string, RunStatus> = new Map();\n\nfunction parseIssue(input: string): { owner: string; repo: string; number: number } | null {\n // Match: https://github.com/owner/repo/issues/123\n const urlMatch = input.match(/github\\.com\\/([^/]+)\\/([^/]+)\\/issues\\/(\\d+)/);\n if (urlMatch && urlMatch[1] && urlMatch[2] && urlMatch[3]) {\n return { owner: urlMatch[1], repo: urlMatch[2], number: parseInt(urlMatch[3], 10) };\n }\n\n // Match: owner/repo#123\n const repoMatch = input.match(/([^/]+)\\/([^#]+)#(\\d+)/);\n if (repoMatch && repoMatch[1] && repoMatch[2] && repoMatch[3]) {\n return { owner: repoMatch[1], repo: repoMatch[2], number: parseInt(repoMatch[3], 10) };\n }\n\n // Match: just issue number (123)\n const numMatch = input.match(/^(\\d+)$/);\n if (numMatch && numMatch[1]) {\n return { owner: \"\", repo: \"\", number: parseInt(numMatch[1], 10) };\n }\n\n return null;\n}\n\nasync function triggerRun(\n config: CodowaveConfig,\n issue: { owner: string; repo: string; number: number }\n): Promise<string> {\n const apiUrl = config.apiUrl;\n const apiKey = config.apiKey;\n\n // Find repo in config\n const repoConfig = config.repos.find(\n (r) => r.owner === issue.owner && r.name === issue.repo\n );\n\n if (!repoConfig) {\n throw new ConfigError(\n `Repository ${issue.owner}/${issue.repo} is not configured.`,\n {\n suggestion: `Run 'codowave config add-repo ${issue.owner}/${issue.repo}' to add this repository`,\n configuredRepos: config.repos.map(r => `${r.owner}/${r.name}`),\n }\n );\n }\n\n // Call the API to trigger a run\n let response: Response;\n try {\n response = await fetch(`${apiUrl}/api/runs`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n repositoryId: repoConfig.id,\n issueNumber: issue.number,\n }),\n });\n } catch {\n throw new CodowaveError(\n `Failed to connect to Codowave API at ${apiUrl}`,\n ErrorCodes.NETWORK_ERROR,\n { suggestion: \"Check your internet connection and verify the API URL in your config.\" }\n );\n }\n\n if (!response.ok) {\n let errorMessage = `API returned status ${response.status}`;\n let errorBody: Record<string, unknown> = {};\n try {\n errorBody = await response.json() as Record<string, unknown>;\n errorMessage = (errorBody['error'] as string) || (errorBody['message'] as string) || errorMessage;\n } catch {\n // Response wasn't JSON, use status text\n errorMessage = response.statusText || errorMessage;\n }\n\n if (response.status === 401) {\n throw new CodowaveError(\n `Authentication failed: ${errorMessage}`,\n ErrorCodes.AUTH_ERROR,\n { suggestion: \"Run 'codowave init' to re-authenticate.\" }\n );\n }\n\n if (response.status === 403) {\n throw new CodowaveError(\n `Access denied: ${errorMessage}`,\n ErrorCodes.AUTH_ERROR,\n { suggestion: \"You don't have permission to trigger runs for this repository.\" }\n );\n }\n\n if (response.status === 404) {\n throw new CodowaveError(\n `Resource not found: ${errorMessage}`,\n ErrorCodes.API_ERROR,\n { suggestion: \"The repository or issue may no longer exist.\" }\n );\n }\n\n // For other errors, use APIError with status code\n const errorText = await response.text();\n throw new APIError(\n `Failed to trigger run: ${response.status} ${response.statusText}`,\n response.status,\n { response: errorText, issueNumber: issue.number, repo: `${issue.owner}/${issue.repo}` }\n );\n }\n\n const data = (await response.json()) as { runId: string };\n return data.runId;\n}\n\nfunction createDemoRun(issue: { owner: string; repo: string; number: number }): RunStatus {\n const runId = `run-${Date.now()}`;\n const run: RunStatus = {\n id: runId,\n repo: issue.owner && issue.repo ? `${issue.owner}/${issue.repo}` : \"CodowaveAI/Codowave\",\n status: \"in_progress\",\n issue: `#${issue.number}`,\n branchName: `agent/issue-${issue.number}`,\n startedAt: new Date().toISOString(),\n stages: [\n { name: \"context\", status: \"pending\" },\n { name: \"planning\", status: \"pending\" },\n { name: \"implementation\", status: \"pending\" },\n { name: \"testing\", status: \"pending\" },\n { name: \"pr-creation\", status: \"pending\" },\n ],\n };\n demoRuns.set(runId, run);\n return run;\n}\n\nfunction streamDemoRun(run: RunStatus) {\n // Simulate SSE streaming with demo data\n const stages = [\"context\", \"planning\", \"implementation\", \"testing\", \"pr-creation\"];\n let currentStage = 0;\n\n console.log(pc.bold(\"\\n=== Starting Run ===\\n\"));\n console.log(pc.bold(\"Run ID: \") + run.id);\n console.log(pc.bold(\"Repo: \") + run.repo);\n console.log(pc.bold(\"Issue: \") + run.issue);\n console.log(pc.bold(\"Branch: \") + run.branchName);\n console.log(\"\");\n\n const interval = setInterval(() => {\n if (currentStage >= stages.length) {\n clearInterval(interval);\n \n // Mark run as completed\n run.status = \"completed\";\n run.completedAt = new Date().toISOString();\n run.prNumber = 100 + Math.floor(Math.random() * 50);\n run.prTitle = `feat: Implement issue #${run.issue}`;\n \n console.log(pc.green(\"\\n✓ Run completed successfully!\"));\n console.log(pc.bold(\"\\n=== Result ===\\n\"));\n console.log(pc.bold(\"PR: \") + `#${run.prNumber} - ${run.prTitle}`);\n console.log(pc.bold(\"Branch: \") + run.branchName);\n console.log(\"\");\n process.exit(0);\n return;\n }\n\n const stageName = stages[currentStage];\n const stage = run.stages.find((s) => s.name === stageName);\n \n if (stage) {\n stage.status = \"running\";\n \n // Show stage progress\n console.log(pc.blue(`\\n--- ${stageName} ---`));\n \n // Simulate work and mark complete\n setTimeout(() => {\n stage.status = \"completed\";\n stage.logs = `${stageName} completed successfully`;\n \n // Move to next stage\n currentStage++;\n }, 1000 + Math.random() * 2000);\n } else {\n currentStage++;\n }\n }, 500);\n\n // Handle Ctrl+C\n process.on(\"SIGINT\", () => {\n clearInterval(interval);\n run.status = \"cancelled\";\n console.log(pc.yellow(\"\\n\\n⚠ Run cancelled\"));\n process.exit(1);\n });\n}\n\nexport const runCommand = new Command(\"run\")\n .description(\"Trigger Codowave to process a GitHub issue\")\n .argument(\"<issue>\", \"GitHub issue number, URL (https://github.com/owner/repo/issues/123), or owner/repo#123\")\n .option(\"-r, --repo <owner/repo>\", \"Target repository (e.g. owner/repo)\")\n .option(\"-s, --stream\", \"Stream run progress (SSE)\", false)\n .action(async (_issueArg: string, _options: { repo?: string; stream?: boolean }) => {\n try {\n // Parse the issue\n const parsed = parseIssue(_issueArg);\n\n if (!parsed) {\n console.error(pc.red(\"\\nInvalid issue format. Expected one of:\"));\n console.error(pc.gray(\" • Issue number: 123\"));\n console.error(pc.gray(\" • Full URL: https://github.com/owner/repo/issues/123\"));\n console.error(pc.gray(\" • Short form: owner/repo#123\"));\n console.error(pc.gray(\" • With repo flag: --repo owner/repo 123\"));\n process.exit(1);\n }\n\n // If repo is specified via option, override\n if (_options.repo) {\n const parts = _options.repo.split(\"/\");\n parsed.owner = parts[0] || \"\";\n parsed.repo = parts[1] || \"\";\n }\n\n // Try to read config\n let config: CodowaveConfig | null = null;\n try {\n config = readConfig();\n } catch {\n // Config not required for demo mode\n }\n\n // Check if we have a real config (API mode) or running in demo mode\n if (config && config.apiKey && config.repos.length > 0) {\n // Real API mode\n console.log(pc.blue(\"Connecting to Codowave API...\"));\n \n // Validate repo is configured\n if (!parsed.owner || !parsed.repo) {\n console.error(pc.red(\"Repository required. Use -r option or include in issue URL.\"));\n process.exit(1);\n }\n\n const runId = await triggerRun(config, parsed);\n console.log(pc.green(`✓ Run triggered: ${runId}`));\n \n if (_options.stream) {\n console.log(pc.blue(\"\\nStreaming run progress...\"));\n // In production, this would connect to SSE endpoint\n // const eventSource = new EventSource(`${config.apiUrl}/api/runs/${runId}/events`);\n } else {\n console.log(pc.gray(`\\nRun started. Use \\`codowave status ${runId}\\` to check progress.`));\n }\n } else {\n // Demo mode\n console.log(pc.yellow(\"⚠ No config found. Running in demo mode.\\n\"));\n \n const run = createDemoRun(parsed);\n \n if (_options.stream || !process.stdout.isTTY) {\n // Stream mode\n streamDemoRun(run);\n } else {\n // Non-stream mode - just show the run info\n console.log(pc.green(`✓ Run started: ${run.id}`));\n console.log(pc.gray(`\\nUse \\`codowave status ${run.id}\\` to check progress.`));\n console.log(pc.gray(`Use \\`codowave logs ${run.id} -f\\` to follow logs.`));\n }\n }\n } catch (err) {\n handleError(err, \"run\");\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { handleError } from \"../utils/error.js\";\n\n// In-memory run store for demo (would be API calls in production)\nexport interface RunStatus {\n id: string;\n repo: string;\n status: \"pending\" | \"in_progress\" | \"completed\" | \"failed\" | \"cancelled\";\n issue: string;\n prNumber?: number;\n prTitle?: string;\n branchName?: string;\n startedAt?: string;\n completedAt?: string;\n errorMessage?: string;\n stages: RunStage[];\n}\n\nexport interface RunStage {\n name: string;\n status: \"pending\" | \"running\" | \"completed\" | \"failed\" | \"skipped\";\n logs?: string;\n}\n\n// Demo data store (would be API in production)\nconst demoRuns: Map<string, RunStatus> = new Map();\n\n// Initialize with some demo data\nfunction initDemoData() {\n if (demoRuns.size === 0) {\n const demoRun: RunStatus = {\n id: \"latest\",\n repo: \"CodowaveAI/Codowave\",\n status: \"in_progress\",\n issue: \"#53: Implement CLI status and logs commands\",\n branchName: \"agent/issue-53\",\n startedAt: new Date(Date.now() - 5 * 60 * 1000).toISOString(),\n stages: [\n { name: \"context\", status: \"completed\", logs: \"Loaded 12 files, 3 PRs context\" },\n { name: \"planning\", status: \"completed\", logs: \"Generated implementation plan\" },\n { name: \"implementation\", status: \"running\", logs: \"Implementing status command...\" },\n { name: \"testing\", status: \"pending\" },\n { name: \"pr-creation\", status: \"pending\" },\n ],\n };\n demoRuns.set(demoRun.id, demoRun);\n \n // Also add a completed run\n const completedRun: RunStatus = {\n id: \"abc-123-def\",\n repo: \"CodowaveAI/Codowave\",\n status: \"completed\",\n issue: \"#52: Add authentication flow\",\n prNumber: 78,\n prTitle: \"feat: Add OAuth authentication flow\",\n branchName: \"feat/auth-flow\",\n startedAt: new Date(Date.now() - 60 * 60 * 1000).toISOString(),\n completedAt: new Date(Date.now() - 45 * 60 * 1000).toISOString(),\n stages: [\n { name: \"context\", status: \"completed\" },\n { name: \"planning\", status: \"completed\" },\n { name: \"implementation\", status: \"completed\" },\n { name: \"testing\", status: \"completed\" },\n { name: \"pr-creation\", status: \"completed\" },\n ],\n };\n demoRuns.set(completedRun.id, completedRun);\n }\n}\n\nexport function getRun(runId?: string): RunStatus | undefined {\n initDemoData();\n if (!runId) {\n // Return most recent run\n return Array.from(demoRuns.values()).sort((a, b) => \n new Date(b.startedAt || 0).getTime() - new Date(a.startedAt || 0).getTime()\n )[0];\n }\n return demoRuns.get(runId);\n}\n\nfunction formatStatus(status: RunStatus[\"status\"]): string {\n switch (status) {\n case \"pending\":\n return pc.gray(\"pending\");\n case \"in_progress\":\n return pc.blue(\"in_progress\");\n case \"completed\":\n return pc.green(\"completed\");\n case \"failed\":\n return pc.red(\"failed\");\n case \"cancelled\":\n return pc.gray(\"cancelled\");\n default:\n return pc.gray(status);\n }\n}\n\nfunction formatStageStatus(status: RunStage[\"status\"]): string {\n switch (status) {\n case \"pending\":\n return pc.gray(\"[ ]\");\n case \"running\":\n return pc.blue(\"[~]\");\n case \"completed\":\n return pc.green(\"[+]\");\n case \"failed\":\n return pc.red(\"[x]\");\n case \"skipped\":\n return pc.gray(\"[-]\");\n default:\n return pc.gray(\"[?]\");\n }\n}\n\nfunction formatDuration(startedAt?: string, completedAt?: string): string {\n if (!startedAt) return \"\";\n const start = new Date(startedAt).getTime();\n const end = completedAt ? new Date(completedAt).getTime() : Date.now();\n const seconds = Math.floor((end - start) / 1000);\n \n if (seconds < 60) return `${seconds}s`;\n const minutes = Math.floor(seconds / 60);\n const remainingSeconds = seconds % 60;\n if (minutes < 60) return `${minutes}m ${remainingSeconds}s`;\n const hours = Math.floor(minutes / 60);\n const remainingMinutes = minutes % 60;\n return `${hours}h ${remainingMinutes}m`;\n}\n\nexport const statusCommand = new Command(\"status\")\n .description(\"Show the status of a Codowave run\")\n .argument(\"[run-id]\", \"Run ID (defaults to latest)\")\n .option(\"-r, --repo <owner/repo>\", \"Filter by repository\")\n .action(async (_runId?: string, _options?: { repo?: string }) => {\n try {\n const run = getRun(_runId);\n \n if (!run) {\n console.log(pc.yellow(\"No runs found. Run `codowave run <issue>` to start a new run.\"));\n return;\n }\n\n // Filter by repo if specified\n if (_options?.repo && run.repo !== _options.repo) {\n console.log(pc.yellow(\"No run found for repository \" + _options.repo));\n return;\n }\n\n console.log(pc.bold(\"\\n=== Run Status ===\\n\"));\n console.log(pc.bold(\"ID: \") + run.id);\n console.log(pc.bold(\"Repo: \") + run.repo);\n console.log(pc.bold(\"Issue: \") + run.issue);\n console.log(pc.bold(\"Status: \") + formatStatus(run.status));\n console.log(pc.bold(\"Branch: \") + (run.branchName || pc.gray(\"(none)\")));\n \n if (run.prNumber) {\n console.log(pc.bold(\"PR: \") + \"#\" + run.prNumber + \" - \" + (run.prTitle || \"\"));\n }\n \n if (run.startedAt) {\n console.log(pc.bold(\"Started: \") + new Date(run.startedAt).toLocaleString());\n }\n \n if (run.completedAt) {\n console.log(pc.bold(\"Duration: \") + formatDuration(run.startedAt, run.completedAt));\n } else if (run.startedAt) {\n console.log(pc.bold(\"Duration: \") + pc.blue(\"running... \") + formatDuration(run.startedAt));\n }\n \n if (run.errorMessage) {\n console.log(pc.bold(\"Error: \") + pc.red(run.errorMessage));\n }\n\n console.log(pc.bold(\"\\n=== Stages ===\\n\"));\n for (const stage of run.stages) {\n const statusIcon = formatStageStatus(stage.status);\n const statusText = pc.bold(\"[\" + stage.status + \"]\");\n console.log(\" \" + statusIcon + \" \" + pc.bold(stage.name.padEnd(20)) + \" \" + statusText);\n }\n\n console.log(\"\");\n } catch (err) {\n handleError(err, \"status\");\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { getRun, type RunStatus } from \"./status.js\";\nimport { handleError } from \"../utils/error.js\";\n\nexport const logsCommand = new Command(\"logs\")\n .description(\"Stream logs for a Codowave run\")\n .argument(\"[run-id]\", \"Run ID (defaults to latest)\")\n .option(\"-f, --follow\", \"Follow log output (SSE stream)\")\n .option(\"-s, --stage <name>\", \"Show logs for a specific stage\")\n .option(\"--no-color\", \"Disable colored output\")\n .action(async (_runId?: string, _options?: { follow?: boolean; stage?: string; color?: boolean }) => {\n try {\n const run: RunStatus | undefined = getRun(_runId);\n \n if (!run) {\n console.log(pc.yellow(\"No runs found. Run `codowave run <issue>` to start a new run.\"));\n return;\n }\n\n // If --stage is specified, show only that stage's logs\n if (_options?.stage) {\n const stage = run.stages.find((s: { name: string }) => s.name === _options.stage);\n if (!stage) {\n console.log(pc.red(\"Stage \\\"\" + _options.stage + \"\\\" not found.\"));\n console.log(pc.gray(\"Available stages: \") + run.stages.map((s: { name: string }) => s.name).join(\", \"));\n return;\n }\n \n console.log(pc.bold(\"\\n=== Logs: \" + stage.name + \" ===\\n\"));\n console.log(pc.bold(\"Status: \") + stage.status);\n \n if (stage.logs) {\n console.log(pc.gray(\"\\n--- Output ---\\n\"));\n console.log(stage.logs);\n } else {\n console.log(pc.gray(\"\\n(no logs available yet)\"));\n }\n \n // If following and stage is still running, simulate live logs\n if (_options.follow && stage.status === \"running\") {\n console.log(pc.blue(\"\\n--- Following live logs (Ctrl+C to exit) ---\\n\"));\n // In production, this would connect to SSE endpoint\n // For demo, we'll show a message\n console.log(pc.gray(\"(Live streaming would connect to API SSE endpoint in production)\"));\n }\n console.log(\"\");\n return;\n }\n\n // Otherwise show all stage logs\n console.log(pc.bold(\"\\n=== Logs: \" + run.id + \" ===\\n\"));\n console.log(pc.bold(\"Issue: \") + run.issue);\n console.log(pc.bold(\"Status: \") + run.status);\n console.log(\"\");\n\n for (const stage of run.stages) {\n const statusIcon = stage.status === \"completed\" ? \"[+]\" : \n stage.status === \"failed\" ? \"[x]\" :\n stage.status === \"running\" ? \"[~]\" : \"[ ]\";\n \n console.log(pc.bold(\"\\n\" + statusIcon + \" \" + stage.name + \"\\n\"));\n \n if (stage.logs) {\n console.log(stage.logs);\n } else if (stage.status === \"pending\") {\n console.log(pc.gray(\"(pending)\"));\n } else if (stage.status === \"running\") {\n console.log(pc.blue(\"(running...)\"));\n } else if (stage.status === \"skipped\") {\n console.log(pc.gray(\"(skipped)\"));\n }\n }\n\n // If following and run is still in progress, simulate live output\n if (_options?.follow && run.status === \"in_progress\") {\n console.log(pc.blue(\"\\n--- Following live logs (Ctrl+C to exit) ---\\n\"));\n // In production, this would connect to SSE endpoint\n console.log(pc.gray(\"(Live streaming would connect to API SSE endpoint in production)\"));\n \n // Simulate periodic updates (for demo purposes)\n let dots = 0;\n const interval = setInterval(() => {\n dots = (dots + 1) % 4;\n process.stdout.write(pc.blue(\"\\r\" + \" \".repeat(dots) + \" waiting for updates...\"));\n }, 500);\n \n // Handle Ctrl+C\n process.on(\"SIGINT\", () => {\n clearInterval(interval);\n console.log(pc.gray(\"\\n\\n(Stopped following)\"));\n process.exit(0);\n });\n }\n\n console.log(\"\");\n } catch (err) {\n handleError(err, \"logs\");\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfigOrThrow, updateConfig, getConfigPath, readConfig } from \"../config.js\";\n\nexport const configCommand = new Command(\"config\")\n .description(\"Get or set Codowave configuration values\");\n\n// Default action when just 'config' is run - show config with option to reconfigure\nconfigCommand.action(() => {\n // Show config and prompt user to run init to reconfigure\n try {\n const config = readConfig();\n if (config) {\n // If config exists, show it and offer to reconfigure\n console.log(pc.bold(\"\\n⚙️ Current Configuration:\\n\"));\n console.log(` ${pc.cyan(\"apiKey\")}: ${config.apiKey ? pc.green(\"••••••••\") + pc.gray(\" (hidden)\") : pc.yellow(\"not set\")}`);\n console.log(` ${pc.cyan(\"apiUrl\")}: ${config.apiUrl}`);\n console.log(` ${pc.cyan(\"autopilot\")}: ${config.autopilot ? pc.green(\"enabled\") : pc.yellow(\"disabled\")}`);\n console.log(` ${pc.cyan(\"labels\")}: ${config.labels?.join(\", \") || pc.yellow(\"not set\")}`);\n console.log(` ${pc.cyan(\"repos\")}: ${config.repos.length} repository(s) configured`);\n console.log(pc.gray(\"\\n To reconfigure, run: \") + pc.bold(\"codowave init\") + pc.gray(\"\\n\"));\n } else {\n console.log(pc.yellow(\"\\n⚠ No configuration found.\\n\"));\n console.log(pc.gray(\" Run \") + pc.bold(\"codowave init\") + pc.gray(\" to get started.\\n\"));\n }\n } catch {\n console.log(pc.yellow(\"\\n⚠ No configuration found.\\n\"));\n console.log(pc.gray(\" Run \") + pc.bold(\"codowave init\") + pc.gray(\" to get started.\\n\"));\n }\n});\n\n// List all available config options\nconfigCommand\n .command(\"list\")\n .description(\"List all available config options\")\n .action(() => {\n console.log(pc.bold(\"\\n📋 Available Config Options:\\n\"));\n console.log(` ${pc.cyan(\"apiKey\")} ${pc.gray(\"— Your Codowave API key\")}`);\n console.log(` ${pc.cyan(\"apiUrl\")} ${pc.gray(\"— API endpoint URL (default: https://api.codowave.com)\")}`);\n console.log(` ${pc.cyan(\"repos\")} ${pc.gray(\"— List of configured repositories\")}`);\n console.log(` ${pc.cyan(\"autopilot\")} ${pc.gray(\"— Enable/disable autopilot mode (true/false)\")}`);\n console.log(` ${pc.cyan(\"labels\")} ${pc.gray(\"— GitHub labels for agent PRs (comma-separated)\")}`);\n console.log(` ${pc.cyan(\"configPath\")} ${pc.gray(\"— Path to the config file\")}`);\n console.log(\"\");\n });\n\n// Get a config value\nconfigCommand\n .command(\"get <key>\")\n .description(\"Get a config value\")\n .action((key: string) => {\n try {\n const config = readConfigOrThrow();\n \n // Special case for configPath\n if (key === \"configPath\") {\n console.log(pc.green(getConfigPath()));\n return;\n }\n \n // Special case for repos - show nicely formatted\n if (key === \"repos\") {\n if (config.repos.length === 0) {\n console.log(pc.yellow(\"No repos configured.\"));\n } else {\n console.log(pc.bold(\"\\n📦 Configured Repositories:\\n\"));\n config.repos.forEach((repo, index) => {\n console.log(` ${index + 1}. ${pc.cyan(`${repo.owner}/${repo.name}`)}`);\n if (repo.id) {\n console.log(` ${pc.gray(\"ID: \" + repo.id)}`);\n }\n });\n console.log(\"\");\n }\n return;\n }\n \n // Special case for labels - show nicely formatted\n if (key === \"labels\") {\n if (config.labels.length === 0) {\n console.log(pc.yellow(\"No labels configured.\"));\n } else {\n console.log(pc.bold(\"\\n🏷️ Configured Labels:\\n\"));\n config.labels.forEach((label, index) => {\n console.log(` ${index + 1}. ${pc.cyan(label)}`);\n });\n console.log(\"\");\n }\n return;\n }\n \n // Get a specific key\n const value = config[key as keyof typeof config];\n \n if (value === undefined) {\n console.error(pc.red(`✖ Unknown config key: ${key}`));\n console.log(pc.gray(` Run \\`codowave config list\\` to see available options.`));\n process.exit(1);\n }\n \n console.log(value);\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n\n// Set a config value\nconfigCommand\n .command(\"set <key> <value>\")\n .description(\"Set a config value\")\n .action((key: string, value: string) => {\n try {\n // Validate the key\n const validKeys = [\"apiKey\", \"apiUrl\", \"autopilot\", \"labels\"];\n if (!validKeys.includes(key)) {\n console.error(pc.red(`✖ Cannot set '${key}' directly.`));\n console.log(pc.gray(` For 'repos', use \\`codowave repo add\\` to manage repositories.`));\n console.log(pc.gray(` Run \\`codowave config list\\` to see available options.`));\n process.exit(1);\n }\n \n // Validate apiUrl if provided\n if (key === \"apiUrl\") {\n try {\n new URL(value);\n } catch {\n console.error(pc.red(`✖ Invalid URL: ${value}`));\n process.exit(1);\n }\n }\n \n // Validate autopilot if provided\n if (key === \"autopilot\") {\n if (value !== \"true\" && value !== \"false\") {\n console.error(pc.red(`✖ Invalid value for autopilot: must be 'true' or 'false'`));\n process.exit(1);\n }\n }\n \n // Handle labels - can be comma-separated\n if (key === \"labels\") {\n const labels = value.split(\",\").map(l => l.trim()).filter(l => l.length > 0);\n const updates = { labels };\n const newConfig = updateConfig(updates);\n console.log(pc.green(`✓ Updated labels`));\n console.log(pc.gray(` labels = ${newConfig.labels.join(\", \")}`));\n return;\n }\n \n // Convert value to appropriate type based on key\n let typedValue: string | boolean = value;\n if (key === \"autopilot\") {\n typedValue = value === \"true\";\n }\n \n const updates = { [key]: typedValue };\n const newConfig = updateConfig(updates);\n \n console.log(pc.green(`✓ Updated ${key}`));\n \n // Show the new value (hide apiKey)\n if (key === \"apiKey\") {\n console.log(pc.gray(` ${key} = ••••••••`));\n } else {\n console.log(pc.gray(` ${key} = ${newConfig[key as keyof typeof newConfig]}`));\n }\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n\n// Show all current config values (alias for showing full config)\nconfigCommand\n .command(\"show\")\n .description(\"Show all current config values\")\n .action(() => {\n try {\n const config = readConfigOrThrow();\n \n console.log(pc.bold(\"\\n⚙️ Current Configuration:\\n\"));\n console.log(` ${pc.cyan(\"apiKey\")}: ${config.apiKey ? pc.green(\"••••••••\") + pc.gray(\" (hidden)\") : pc.yellow(\"not set\")}`);\n console.log(` ${pc.cyan(\"apiUrl\")}: ${config.apiUrl}`);\n console.log(` ${pc.cyan(\"autopilot\")}: ${config.autopilot ? pc.green(\"enabled\") : pc.yellow(\"disabled\")}`);\n console.log(` ${pc.cyan(\"labels\")}: ${config.labels.join(\", \") || pc.yellow(\"not set\")}`);\n console.log(` ${pc.cyan(\"repos\")}: ${config.repos.length} repository(s) configured`);\n console.log(` ${pc.cyan(\"configPath\")}: ${pc.gray(getConfigPath())}`);\n \n if (config.repos.length > 0) {\n console.log(pc.bold(pc.gray(\"\\n Repositories:\")));\n config.repos.forEach((repo) => {\n console.log(` • ${repo.owner}/${repo.name}${repo.id ? pc.gray(` (${repo.id})`) : \"\"}`);\n });\n }\n \n if (config.labels.length > 0) {\n console.log(pc.bold(pc.gray(\"\\n Labels:\")));\n config.labels.forEach((label) => {\n console.log(` • ${label}`);\n });\n }\n \n console.log(\"\");\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, updateConfig, getConfigPath } from \"../config.js\";\n\nconst PRO_API_URL = \"https://api.codowave.com\";\n// TODO: Uncomment when implementing OAuth device flow\n// const PRO_AUTH_URL = \"https://codowave.com/api/auth/device\";\n// const PRO_TOKEN_URL = \"https://codowave.com/api/auth/token\";\n\nexport const connectCommand = new Command(\"connect\")\n .description(\"Connect to Codowave Pro (upgrade from OSS)\")\n .action(async () => {\n try {\n console.log(pc.bold(\"\\n🔗 Codowave Connect\\n\"));\n console.log(pc.gray(\"This command upgrades your OSS installation to Codowave Pro.\\n\"));\n\n // Check current config\n const config = readConfig();\n const isAlreadyPro = config?.apiUrl === PRO_API_URL;\n\n if (isAlreadyPro) {\n console.log(pc.green(\"✓ You are already connected to Codowave Pro!\"));\n console.log(pc.gray(` API URL: ${config?.apiUrl}`));\n console.log(\"\");\n return;\n }\n\n // Start OAuth device flow\n console.log(pc.blue(\"Starting OAuth device flow...\\n\"));\n\n // In a real implementation, this would:\n // 1. Call PRO_AUTH_URL to get device_code, user_code, verification_uri\n // 2. Display user_code and verification_uri for user to enter in browser\n // 3. Poll PRO_TOKEN_URL until user authorizes\n // 4. Get access_token and store in config\n\n // For now, simulate the flow\n console.log(pc.gray(\" 1. Requesting device code...\"));\n \n // Simulate API call (would be real fetch in production)\n const deviceCode = `CODOWAVE-${Date.now().toString(36).toUpperCase()}`;\n const verificationUri = \"https://codowave.com/activate\";\n \n console.log(pc.green(\"\\n ⚠️ Device Code: \") + pc.bold(deviceCode));\n console.log(pc.gray(\"\\n 2. Please visit: \") + pc.cyan(verificationUri));\n console.log(pc.gray(\" and enter the device code above.\\n\"));\n \n console.log(pc.yellow(\" ℹ️ This is a stub implementation.\"));\n console.log(pc.gray(\" In production, this would poll for OAuth completion.\\n\"));\n\n // For demo purposes, let's just show what would happen\n console.log(pc.blue(\" 3. Would save Pro token and switch API URL...\\n\"));\n \n // Actually, let's not modify config in demo mode - just show what would happen\n console.log(pc.bold(\"What would happen:\\n\"));\n console.log(` • Save Pro API token to ${getConfigPath()}`);\n console.log(` • Set apiUrl to ${PRO_API_URL}`);\n console.log(\"\");\n \n console.log(pc.gray(\"Run with \") + pc.cyan(\"CODOWAVE_CONNECT=1\") + pc.gray(\" to enable (not implemented yet)\"));\n console.log(\"\");\n\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n console.error(pc.red(`\\n✖ Error: ${message}\\n`));\n process.exit(1);\n }\n });\n\n/**\n * Actually perform the connection (used after OAuth success)\n * This would be called internally after OAuth polling succeeds\n */\nexport async function performConnect(accessToken: string): Promise<void> {\n const config = updateConfig({\n apiKey: accessToken,\n apiUrl: PRO_API_URL,\n });\n \n console.log(pc.green(\"✓ Connected to Codowave Pro!\"));\n console.log(pc.gray(` API URL: ${config.apiUrl}`));\n}\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfigOrThrow, updateConfig } from \"../config.js\";\n\ntype Repo = {\n owner: string;\n name: string;\n id?: string;\n};\n\nexport const repoCommand = new Command(\"repo\")\n .description(\"Manage GitHub repositories\");\n\n// List all repos\nrepoCommand\n .command(\"list\")\n .description(\"List all managed repositories\")\n .action(() => {\n try {\n const config = readConfigOrThrow();\n \n if (config.repos.length === 0) {\n console.log(pc.yellow(\"\\n⚠ No repositories configured.\\n\"));\n console.log(pc.gray(\" Run \") + pc.bold(\"codowave repo add <owner/repo>\") + pc.gray(\" to add a repository.\\n\"));\n return;\n }\n \n console.log(pc.bold(\"\\n📦 Managed Repositories:\\n\"));\n config.repos.forEach((repo, index) => {\n console.log(` ${index + 1}. ${pc.cyan(`${repo.owner}/${repo.name}`)}`);\n if (repo.id) {\n console.log(` ${pc.gray(\"ID: \" + repo.id)}`);\n }\n });\n console.log(\"\");\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n\n// Add a repo\nrepoCommand\n .command(\"add <owner/repo>\")\n .description(\"Add a repository (format: owner/repo)\")\n .action((repoArg: string) => {\n try {\n // Parse owner/repo\n const parts = repoArg.split(\"/\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n console.error(pc.red(`✖ Invalid repository format. Use: owner/repo`));\n console.log(pc.gray(\" Example: codowave repo add octocat/Hello-World\"));\n process.exit(1);\n }\n \n const owner = parts[0];\n const name = parts[1];\n \n const config = readConfigOrThrow();\n \n // Check if repo already exists\n const exists = config.repos.some(\n r => r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase()\n );\n \n if (exists) {\n console.error(pc.red(`✖ Repository ${repoArg} is already configured.`));\n process.exit(1);\n }\n \n const newRepo: Repo = { owner, name };\n const updatedRepos = [...config.repos, newRepo];\n \n updateConfig({ repos: updatedRepos });\n \n console.log(pc.green(`\\n✓ Added repository ${repoArg}\\n`));\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n\n// Remove a repo\nrepoCommand\n .command(\"remove <owner/repo>\")\n .description(\"Remove a repository (format: owner/repo)\")\n .action((repoArg: string) => {\n try {\n // Parse owner/repo\n const parts = repoArg.split(\"/\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n console.error(pc.red(`✖ Invalid repository format. Use: owner/repo`));\n console.log(pc.gray(\" Example: codowave repo remove octocat/Hello-World\"));\n process.exit(1);\n }\n \n const owner = parts[0];\n const name = parts[1];\n \n const config = readConfigOrThrow();\n \n // Check if repo exists\n const exists = config.repos.some(\n r => r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase()\n );\n \n if (!exists) {\n console.error(pc.red(`✖ Repository ${repoArg} is not configured.`));\n console.log(pc.gray(\" Run \") + pc.bold(\"codowave repo list\") + pc.gray(\" to see configured repositories.\\n\"));\n process.exit(1);\n }\n \n const updatedRepos = config.repos.filter(\n r => !(r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase())\n );\n \n updateConfig({ repos: updatedRepos });\n \n console.log(pc.green(`\\n✓ Removed repository ${repoArg}\\n`));\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfigOrThrow, updateConfig } from \"../config.js\";\n\nexport const autopilotCommand = new Command(\"autopilot\")\n .description(\"Toggle autopilot mode\");\n\n// Enable autopilot\nautopilotCommand\n .command(\"enable\")\n .description(\"Enable autopilot mode\")\n .action(() => {\n try {\n updateConfig({ autopilot: true });\n console.log(pc.green(\"\\n✓ Autopilot enabled\\n\"));\n console.log(pc.gray(\" Codowave will automatically process PRs and issues.\\n\"));\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n\n// Disable autopilot\nautopilotCommand\n .command(\"disable\")\n .description(\"Disable autopilot mode\")\n .action(() => {\n try {\n updateConfig({ autopilot: false });\n console.log(pc.green(\"\\n✓ Autopilot disabled\\n\"));\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfigOrThrow, updateConfig } from \"../config.js\";\n\nexport const labelsCommand = new Command(\"labels\")\n .description(\"Configure GitHub labels for agent activity\");\n\n// Set labels\nlabelsCommand\n .command(\"set <labels>\")\n .description(\"Set GitHub labels (comma-separated)\")\n .action((labelsArg: string) => {\n try {\n const labels = labelsArg\n .split(\",\")\n .map(l => l.trim())\n .filter(l => l.length > 0);\n \n if (labels.length === 0) {\n console.error(pc.red(\"✖ No labels provided.\"));\n console.log(pc.gray(\" Example: codowave labels set codowave-agent,needs-review\"));\n process.exit(1);\n }\n \n updateConfig({ labels });\n \n console.log(pc.green(\"\\n✓ Labels updated\\n\"));\n console.log(pc.gray(\" Labels: \") + pc.cyan(labels.join(\", \")) + \"\\n\");\n } catch (err) {\n console.error(pc.red(`✖ ${err instanceof Error ? err.message : String(err)}`));\n process.exit(1);\n }\n });\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { getRun, type RunStatus } from \"./status.js\";\nimport { handleError } from \"../utils/error.js\";\n\nexport const runsCommand = new Command(\"runs\")\n .description(\"Manage Codowave runs\");\n\n// List recent runs\nrunsCommand\n .command(\"list\")\n .alias(\"ls\")\n .description(\"List recent runs\")\n .option(\"-l, --limit <number>\", \"Number of runs to show\", \"10\")\n .option(\"-r, --repo <owner/repo>\", \"Filter by repository\")\n .option(\"--status <status>\", \"Filter by status (pending, in_progress, completed, failed)\")\n .action(async (options: { limit?: string; repo?: string; status?: string }) => {\n try {\n const limit = parseInt(options.limit || \"10\", 10);\n \n // Demo data (would be API calls in production)\n const demoRuns: RunStatus[] = [\n {\n id: \"latest\",\n repo: \"CodowaveAI/Codowave\",\n status: \"in_progress\",\n issue: \"#53: Implement CLI status and logs commands\",\n branchName: \"agent/issue-53\",\n startedAt: new Date(Date.now() - 5 * 60 * 1000).toISOString(),\n stages: [\n { name: \"context\", status: \"completed\" },\n { name: \"planning\", status: \"completed\" },\n { name: \"implementation\", status: \"running\" },\n { name: \"testing\", status: \"pending\" },\n { name: \"pr-creation\", status: \"pending\" },\n ],\n },\n {\n id: \"abc-123-def\",\n repo: \"CodowaveAI/Codowave\",\n status: \"completed\",\n issue: \"#52: Add authentication flow\",\n prNumber: 78,\n prTitle: \"feat: Add OAuth authentication flow\",\n branchName: \"feat/auth-flow\",\n startedAt: new Date(Date.now() - 60 * 60 * 1000).toISOString(),\n completedAt: new Date(Date.now() - 45 * 60 * 1000).toISOString(),\n stages: [\n { name: \"context\", status: \"completed\" },\n { name: \"planning\", status: \"completed\" },\n { name: \"implementation\", status: \"completed\" },\n { name: \"testing\", status: \"completed\" },\n { name: \"pr-creation\", status: \"completed\" },\n ],\n },\n {\n id: \"xyz-789-ghi\",\n repo: \"CodowaveAI/Codowave\",\n status: \"failed\",\n issue: \"#51: Fix memory leak\",\n branchName: \"fix/memory-leak\",\n startedAt: new Date(Date.now() - 120 * 60 * 1000).toISOString(),\n completedAt: new Date(Date.now() - 100 * 60 * 1000).toISOString(),\n errorMessage: \"Test suite failed: 3 tests failed\",\n stages: [\n { name: \"context\", status: \"completed\" },\n { name: \"planning\", status: \"completed\" },\n { name: \"implementation\", status: \"completed\" },\n { name: \"testing\", status: \"failed\" },\n { name: \"pr-creation\", status: \"skipped\" },\n ],\n },\n ];\n\n // Filter runs\n let filteredRuns = demoRuns;\n \n if (options.repo) {\n filteredRuns = filteredRuns.filter(r => r.repo === options.repo);\n }\n \n if (options.status) {\n filteredRuns = filteredRuns.filter(r => r.status === options.status);\n }\n \n // Limit results\n filteredRuns = filteredRuns.slice(0, limit);\n\n if (filteredRuns.length === 0) {\n console.log(pc.yellow(\"\\nNo runs found.\\n\"));\n return;\n }\n\n console.log(pc.bold(\"\\n📋 Recent Runs\\n\"));\n console.log(\n pc.gray(\" ID \") + \" \" +\n pc.gray(\"Status \") + \" \" +\n pc.gray(\"Issue\")\n );\n console.log(pc.gray(\" \").padEnd(60, \"─\"));\n\n for (const run of filteredRuns) {\n const statusColor = run.status === \"completed\" ? pc.green :\n run.status === \"failed\" ? pc.red :\n run.status === \"in_progress\" ? pc.blue : pc.gray;\n \n console.log(\n ` ${run.id.padEnd(13)} ` +\n `${statusColor(run.status.padEnd(11))} ` +\n `${run.issue.substring(0, 40)}`\n );\n }\n \n console.log(\"\");\n } catch (err) {\n handleError(err, \"runs list\");\n }\n });\n\n// Show logs for a run\nrunsCommand\n .command(\"logs <run-id>\")\n .description(\"View logs for a specific run\")\n .option(\"-f, --follow\", \"Follow log output (stream)\")\n .option(\"-s, --stage <name>\", \"Show logs for a specific stage\")\n .action(async (runId: string, options: { follow?: boolean; stage?: string }) => {\n try {\n const run = getRun(runId);\n \n if (!run) {\n console.log(pc.red(`Run \"${runId}\" not found.`));\n console.log(pc.gray(\" Run `codowave runs list` to see available runs.\\n\"));\n process.exit(1);\n }\n\n // If --stage is specified, show only that stage's logs\n if (options.stage) {\n const stage = run.stages.find(s => s.name === options.stage);\n if (!stage) {\n console.log(pc.red(`Stage \"${options.stage}\" not found.`));\n console.log(pc.gray(\"Available stages: \") + run.stages.map(s => s.name).join(\", \"));\n return;\n }\n \n console.log(pc.bold(\"\\n=== Logs: \" + stage.name + \" ===\\n\"));\n console.log(pc.bold(\"Status: \") + stage.status);\n \n if (stage.logs) {\n console.log(pc.gray(\"\\n--- Output ---\\n\"));\n console.log(stage.logs);\n } else {\n console.log(pc.gray(\"\\n(no logs available yet)\"));\n }\n \n if (options.follow && stage.status === \"running\") {\n console.log(pc.blue(\"\\n--- Following live logs (Ctrl+C to exit) ---\\n\"));\n console.log(pc.gray(\"(Live streaming would connect to API SSE endpoint in production)\"));\n }\n console.log(\"\");\n return;\n }\n\n // Show all stage logs\n console.log(pc.bold(\"\\n=== Logs: \" + run.id + \" ===\\n\"));\n console.log(pc.bold(\"Issue: \") + run.issue);\n console.log(pc.bold(\"Status: \") + run.status);\n console.log(\"\");\n\n for (const stage of run.stages) {\n const statusIcon = stage.status === \"completed\" ? \"[+]\" : \n stage.status === \"failed\" ? \"[x]\" :\n stage.status === \"running\" ? \"[~]\" : \"[ ]\";\n \n console.log(pc.bold(\"\\n\" + statusIcon + \" \" + stage.name + \"\\n\"));\n \n if (stage.logs) {\n console.log(stage.logs);\n } else if (stage.status === \"pending\") {\n console.log(pc.gray(\"(pending)\"));\n } else if (stage.status === \"running\") {\n console.log(pc.blue(\"(running...)\"));\n } else if (stage.status === \"skipped\") {\n console.log(pc.gray(\"(skipped)\"));\n }\n }\n\n if (options.follow && run.status === \"in_progress\") {\n console.log(pc.blue(\"\\n--- Following live logs (Ctrl+C to exit) ---\\n\"));\n console.log(pc.gray(\"(Live streaming would connect to API SSE endpoint in production)\"));\n }\n\n console.log(\"\");\n } catch (err) {\n handleError(err, \"runs logs\");\n }\n });\n\n// Default action when just 'runs' is run - show help\nrunsCommand.action(() => {\n runsCommand.help();\n});\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig } from \"./config.js\";\nimport { setupGlobalErrorHandlers } from \"./utils/global-error.js\";\n\n// Set up global error handlers for uncaught exceptions and unhandled promise rejections\nsetupGlobalErrorHandlers();\n\n// Dynamically imported to keep startup fast\nconst { initCommand } = await import(\"./commands/init.js\");\nconst { runCommand } = await import(\"./commands/run.js\");\nconst { statusCommand } = await import(\"./commands/status.js\");\nconst { logsCommand } = await import(\"./commands/logs.js\");\nconst { configCommand } = await import(\"./commands/config-cmd.js\");\nconst { connectCommand } = await import(\"./commands/connect.js\");\nconst { repoCommand } = await import(\"./commands/repo-cmd.js\");\nconst { autopilotCommand } = await import(\"./commands/autopilot-cmd.js\");\nconst { labelsCommand } = await import(\"./commands/labels-cmd.js\");\nconst { runsCommand } = await import(\"./commands/runs-cmd.js\");\n\nconst VERSION = \"0.1.0\";\n\nconst program = new Command();\n\nprogram\n .name(\"codowave\")\n .description(\n pc.bold(\"Codowave\") +\n \" — AI-powered coding agent for your GitHub repositories\"\n )\n .version(VERSION, \"-v, --version\", \"Output the current version\")\n .helpOption(\"-h, --help\", \"Display help\")\n .addHelpText(\n \"beforeAll\",\n `\\n${pc.cyan(\" ██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ █████╗ ██╗ ██╗███████╗\")}\\n${pc.cyan(\" ██╔════╝██╔═══██╗██╔══██╗██╔═══██╗██║ ██║██╔══██╗██║ ██║██╔════╝\")}\\n${pc.cyan(\" ██║ ██║ ██║██║ ██║██║ ██║██║ █╗ ██║███████║██║ ██║█████╗ \")}\\n${pc.cyan(\" ╚██████╗╚██████╔╝██████╔╝╚██████╔╝╚███╔███╔╝██║ ██║╚██████╔╝███████╗\")}\\n`\n )\n // Global option: override API URL (useful for self-hosted deployments)\n .option(\"--api-url <url>\", \"Override the Codowave API URL\");\n\n// ── Subcommands ────────────────────────────────────────────────────────────\n\nprogram.addCommand(initCommand);\nprogram.addCommand(runCommand);\nprogram.addCommand(statusCommand);\nprogram.addCommand(logsCommand);\nprogram.addCommand(configCommand);\nprogram.addCommand(connectCommand);\nprogram.addCommand(repoCommand);\nprogram.addCommand(autopilotCommand);\nprogram.addCommand(labelsCommand);\nprogram.addCommand(runsCommand);\n\n// ── Global error handler ───────────────────────────────────────────────────\n\nprogram.configureOutput({\n writeErr: (str) => process.stderr.write(pc.red(str)),\n});\n\n// Show warning if not initialized (except for init and help)\nconst args = process.argv.slice(2);\nconst isInitOrHelp =\n args[0] === \"init\" ||\n args.includes(\"--help\") ||\n args.includes(\"-h\") ||\n args.includes(\"--version\") ||\n args.includes(\"-v\") ||\n args.length === 0;\n\nif (!isInitOrHelp) {\n const config = readConfig();\n if (!config) {\n console.warn(\n pc.yellow(\n \"⚠ No config found. Run \" +\n pc.bold(\"codowave init\") +\n \" to get started.\\n\"\n )\n );\n }\n}\n\n// ── Parse ──────────────────────────────────────────────────────────────────\n\nprogram.parseAsync(process.argv).catch((err) => {\n console.error(pc.red(`\\n✖ Error: ${err instanceof Error ? err.message : String(err)}\\n`));\n process.exit(1);\n});\n","import process from \"process\";\nimport pc from \"picocolors\";\nimport { handleError } from \"./error.js\";\n\n/**\n * Sets up global error handlers for uncaught exceptions and unhandled promise rejections.\n * This ensures consistent error handling across the CLI.\n */\nexport function setupGlobalErrorHandlers(): void {\n // Handle uncaught exceptions\n process.on(\"uncaughtException\", (err: Error) => {\n console.error(pc.red(\"\\n💥 Unexpected Error\"));\n console.error(pc.gray(err.stack || \"\"));\n handleError(err, \"uncaughtException\");\n });\n\n // Handle unhandled promise rejections\n process.on(\"unhandledRejection\", (reason: unknown, _promise: Promise<unknown>) => {\n const message = reason instanceof Error ? reason.message : String(reason);\n const stack = reason instanceof Error ? reason.stack : undefined;\n \n console.error(pc.red(\"\\n💥 Unhandled Promise Rejection\"));\n if (stack) {\n console.error(pc.gray(stack));\n } else {\n console.error(pc.gray(`Reason: ${message}`));\n }\n \n // For now, we'll just log and exit with error code\n // In the future, we might want to handle this differently\n console.error(pc.yellow(\"\\nWarning: Unhandled promise rejections can cause instability.\"));\n console.error(pc.gray(\"Please report this issue: https://github.com/CodowaveAI/Codowave/issues\"));\n \n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,QAAQ;AAsEf,SAAS,gBAAgB,KAAsB;AAC7C,MAAI,eAAe,eAAe;AAChC,WAAO,IAAI,oBAAoB;AAAA,EACjC;AAEA,MAAI,eAAe,OAAO;AAExB,UAAM,UAAU,IAAI;AAEpB,QAAI,QAAQ,SAAS,cAAc,KAAK,QAAQ,SAAS,WAAW,GAAG;AACrE,aAAO;AAAA,IACT;AAEA,QAAI,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS,cAAc,GAAG;AAC/D,aAAO;AAAA,IACT;AAEA,QAAI,QAAQ,SAAS,KAAK,KAAK,QAAQ,SAAS,WAAW,GAAG;AAC5D,aAAO;AAAA,IAC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C1B,MAAI,CAAC,QAAQ;AACX,YAAQ;AAAA,MACNA,KAAG;AAAA,QACD,kCACEA,KAAG,KAAK,eAAe,IACvB;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;AAIA,QAAQ,WAAW,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAQ;AAC9C,UAAQ,MAAMA,KAAG,IAAI;AAAA,gBAAc,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI,CAAC;AACxF,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["pc","Command","pc","Command","pc","demoRuns","Command","pc","Command","pc","updates","newConfig","Command","pc","Command","pc","Command","pc","Command","pc","Command","pc","demoRuns","Command","pc","process","pc","initCommand","runCommand","statusCommand","logsCommand","configCommand","connectCommand","repoCommand","autopilotCommand","labelsCommand","runsCommand","Command","pc"]}
|