codowave 0.1.9 → 0.2.0

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/dist/index.js CHANGED
@@ -285,15 +285,41 @@ var GithubAppStep = ({ apiUrl, onComplete, onCancel }) => {
285
285
 
286
286
  // src/commands/init.tsx
287
287
  import { jsx as jsx2 } from "react/jsx-runtime";
288
- var initCommand = new Command("init").description("Initialize Codowave and connect your GitHub repositories").action(async () => {
288
+ var initCommand = new Command("init").description("Initialize Codowave and connect your GitHub repositories").option("--api-key <key>", "Codowave API key (non-interactive mode)").option("--api-url <url>", "Codowave API URL").option("--github-app-id <id>", "GitHub App ID").option("--github-app-private-key <key>", "GitHub App private key path").option("--repos <repos>", "Comma-separated list of repos (owner/repo)").action(async (opts) => {
289
289
  const existingConfig = readConfig();
290
290
  const defaultApiUrl = "https://api.codowave.com";
291
+ if (opts.apiKey) {
292
+ const config2 = {
293
+ apiKey: opts.apiKey,
294
+ apiUrl: opts.apiUrl || existingConfig?.apiUrl || defaultApiUrl,
295
+ githubAppId: opts.githubAppId || "",
296
+ githubAppPrivateKey: opts.githubAppPrivateKey || "",
297
+ repos: opts.repos ? opts.repos.split(",").map((r) => {
298
+ const [owner, name] = r.trim().split("/");
299
+ return { owner, name };
300
+ }) : [],
301
+ autopilot: existingConfig?.autopilot ?? true,
302
+ labels: existingConfig?.labels || {
303
+ approved: "status/approved",
304
+ inProgress: "status/in-progress",
305
+ merged: "status/merged"
306
+ }
307
+ };
308
+ writeConfig(config2);
309
+ console.log(pc2.green("\n\u2705 Codowave initialized successfully!\n"));
310
+ console.log(` API URL: ${pc2.cyan(config2.apiUrl)}`);
311
+ console.log(` Repos: ${pc2.cyan(config2.repos.map((r) => `${r.owner}/${r.name}`).join(", ") || "none")}`);
312
+ console.log(pc2.gray(`
313
+ Config: ${getConfigPath()}
314
+ `));
315
+ return;
316
+ }
291
317
  const apiUrl = existingConfig?.apiUrl || defaultApiUrl;
292
318
  if (existingConfig?.apiKey) {
293
319
  console.log(pc2.yellow("\n\u26A0 Codowave is already initialized.\n"));
294
320
  console.log(` API URL: ${pc2.cyan(existingConfig.apiUrl)}`);
295
321
  console.log(` Config: ${getConfigPath()}`);
296
- console.log(pc2.gray("\n Run this command again to reconfigure.\n"));
322
+ console.log(pc2.gray("\n Run with --api-key to reconfigure non-interactively.\n"));
297
323
  return;
298
324
  }
299
325
  let wizardComplete = false;
@@ -319,18 +345,21 @@ var initCommand = new Command("init").description("Initialize Codowave and conne
319
345
  if (!wizardComplete) {
320
346
  return;
321
347
  }
322
- writeConfig({
348
+ const config = {
323
349
  apiKey: capturedApiKey,
324
350
  apiUrl,
325
- repos: capturedRepos
326
- });
327
- console.log(pc2.green("\n\u2713 Initialization complete!"));
328
- console.log(`
329
- Config saved to: ${pc2.cyan(getConfigPath())}`);
330
- console.log(` API URL: ${pc2.cyan(apiUrl)}`);
331
- console.log(` Repositories: ${pc2.bold(capturedRepos.length)} configured
332
- `);
333
- console.log(pc2.gray(" Run ") + pc2.bold("codowave run") + pc2.gray(" to start coding!\n"));
351
+ repos: capturedRepos,
352
+ autopilot: true,
353
+ labels: {
354
+ approved: "status/approved",
355
+ inProgress: "status/in-progress",
356
+ merged: "status/merged"
357
+ }
358
+ };
359
+ writeConfig(config);
360
+ console.log(pc2.green("\n\u2705 Codowave initialized successfully!\n"));
361
+ console.log(pc2.gray(` Config: ${getConfigPath()}
362
+ `));
334
363
  });
335
364
 
336
365
  // src/commands/run.ts
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/commands/init.tsx","../src/components/init/GithubAppStep.tsx","../src/commands/run.ts","../src/commands/status.ts","../src/commands/logs.ts","../src/commands/config-cmd.ts","../src/commands/connect.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { readConfig } from './config'\nimport { initCommand } from './commands/init.js'\nimport { runCommand } from './commands/run.js'\nimport { statusCommand } from './commands/status.js'\nimport { logsCommand } from './commands/logs.js'\nimport { configCommand } from './commands/config-cmd.js'\nimport { connectCommand } from './commands/connect.js'\n\n// Read version from package.json\nimport { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\nconst { version } = require('../package.json')\n\nconst VERSION = version\n\nconst program = new Command()\n\nprogram\n .name('codowave')\n .description('Codowave OSS CLI — AI-powered coding agent for your GitHub repositories')\n .version(VERSION, '-v, --version', 'Output the current version')\n .option('--api-url <url>', 'Override the Codowave API URL')\n\nprogram.addCommand(initCommand)\nprogram.addCommand(runCommand)\nprogram.addCommand(statusCommand)\nprogram.addCommand(logsCommand)\nprogram.addCommand(configCommand)\nprogram.addCommand(connectCommand)\n\nconst args = process.argv.slice(2)\nconst isInitOrHelp = args[0] === 'init' || args.includes('--help') || args.includes('-h') || args.includes('--version') || args.includes('-v') || args.length === 0\n\nif (!isInitOrHelp) {\n const config = readConfig()\n if (!config?.apiUrl) {\n console.log('\\n❌ Codowave not initialized. Run: codowave init\\n')\n process.exit(1)\n }\n}\n\nprogram.parse()\n","import { readFileSync, writeFileSync, mkdirSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { z } from \"zod\";\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});\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 return null;\n }\n\n return parsed.data;\n } catch (err) {\n console.warn(`[config] Failed to parse ${CONFIG_FILE}:`, err);\n return null;\n }\n}\n\nexport function readConfigOrThrow(): CodowaveConfig {\n const config = readConfig();\n if (!config) {\n throw new Error(\n `No Codowave config found. Run \\`codowave init\\` to get started.`\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 };\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 { render } from \"ink\";\nimport React from \"react\";\nimport { writeConfig, readConfig, getConfigPath } from \"../config.js\";\nimport { GithubAppStep } from \"../components/init/GithubAppStep.js\";\n\ntype Repo = {\n\towner: string;\n\tname: string;\n\tid?: string;\n};\n\nexport const initCommand = new Command(\"init\")\n\t.description(\"Initialize Codowave and connect your GitHub repositories\")\n\t.action(async () => {\n\t\tconst existingConfig = readConfig();\n\t\tconst defaultApiUrl = \"https://api.codowave.com\";\n\t\tconst apiUrl = existingConfig?.apiUrl || defaultApiUrl;\n\n\t\t// If already initialized, ask if they want to reconfigure\n\t\tif (existingConfig?.apiKey) {\n\t\t\tconsole.log(pc.yellow(\"\\n⚠ Codowave is already initialized.\\n\"));\n\t\t\tconsole.log(` API URL: ${pc.cyan(existingConfig.apiUrl)}`);\n\t\t\tconsole.log(` Config: ${getConfigPath()}`);\n\t\t\tconsole.log(pc.gray(\"\\n Run this command again to reconfigure.\\n\"));\n\t\t\treturn;\n\t\t}\n\n\t\tlet wizardComplete = false;\n\t\tlet capturedApiKey = \"\";\n\t\tlet capturedRepos: Repo[] = [];\n\n\t\tconst { waitUntilExit } = render(\n\t\t\t<GithubAppStep\n\t\t\t\tapiUrl={apiUrl}\n\t\t\t\tonComplete={(apiKey, repos) => {\n\t\t\t\t\tcapturedApiKey = apiKey;\n\t\t\t\t\tcapturedRepos = repos;\n\t\t\t\t\twizardComplete = true;\n\t\t\t\t}}\n\t\t\t\tonCancel={() => {\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\n\t\tawait waitUntilExit();\n\n\t\tif (!wizardComplete) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Save the configuration\n\t\twriteConfig({\n\t\t\tapiKey: capturedApiKey,\n\t\t\tapiUrl: apiUrl,\n\t\t\trepos: capturedRepos,\n\t\t});\n\n\t\tconsole.log(pc.green(\"\\n✓ Initialization complete!\"));\n\t\tconsole.log(`\\n Config saved to: ${pc.cyan(getConfigPath())}`);\n\t\tconsole.log(` API URL: ${pc.cyan(apiUrl)}`);\n\t\tconsole.log(` Repositories: ${pc.bold(capturedRepos.length)} configured\\n`);\n\t\tconsole.log(pc.gray(\" Run \") + pc.bold(\"codowave run\") + pc.gray(\" to start coding!\\n\"));\n\t});\n","import React, { useState, useEffect, useRef } from \"react\";\nimport {\n Box,\n Text,\n useInput,\n} from \"ink\";\nimport Spinner from \"ink-spinner\";\nimport pc from \"picocolors\";\n\ntype Repo = {\n\towner: string;\n\tname: string;\n\tid?: string;\n};\n\ntype Props = {\n\tapiUrl: string;\n\tonComplete: (apiKey: string, repos: Repo[]) => void;\n\tonCancel: () => void;\n};\n\ntype Step = \"api-key\" | \"repos\";\n\nexport const GithubAppStep: React.FC<Props> = ({ apiUrl, onComplete, onCancel }) => {\n\tconst [step, setStep] = useState<Step>(\"api-key\");\n\tconst [apiKey, setApiKey] = useState(\"\");\n\tconst [repos, setRepos] = useState<Repo[]>([]);\n\tconst [selectedRepos, setSelectedRepos] = useState<Set<number>>(new Set());\n\tconst [currentSelection, setCurrentSelection] = useState(0);\n\tconst [loading, setLoading] = useState(false);\n\tconst [error, setError] = useState<string | null>(null);\n\n\t// Fetch repos when API key is validated\n\tuseEffect(() => {\n\t\tif (step === \"repos\" && apiKey && repos.length === 0 && !loading) {\n\t\t\tfetchRepos();\n\t\t}\n\t}, [step, apiKey]);\n\n\tasync function fetchRepos() {\n\t\tsetLoading(true);\n\t\tsetError(null);\n\n\t\ttry {\n\t\t\t// Call the API to get repositories\n\t\t\t// This endpoint should return the repos associated with the API key\n\t\t\tconst response = await fetch(`${apiUrl}/api/v1/repos`, {\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status === 401) {\n\t\t\t\t\tthrow new Error(\"Invalid API key. Please check and try again.\");\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Failed to fetch repositories: ${response.status}`);\n\t\t\t}\n\n\t\t\tconst data = await response.json() as { repos?: Repo[]; repositories?: Repo[] };\n\t\t\t// Expected response format: { repos: [{ owner, name, id? }] }\n\t\t\tconst fetchedRepos = data.repos || data.repositories || [];\n\t\t\tsetRepos(fetchedRepos);\n\t\t\t// Select all by default\n\t\t\tif (fetchedRepos.length > 0) {\n\t\t\t\tconst allIndices = new Set<number>();\n\t\t\t\tfor (let i = 0; i < fetchedRepos.length; i++) {\n\t\t\t\t\tallIndices.add(i);\n\t\t\t\t}\n\t\t\t\tsetSelectedRepos(allIndices);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tsetError(err instanceof Error ? err.message : \"Failed to fetch repositories\");\n\t\t} finally {\n\t\t\tsetLoading(false);\n\t\t}\n\t}\n\n\tfunction handleApiKeySubmit() {\n\t\tif (!apiKey.trim()) {\n\t\t\tsetError(\"API key cannot be empty\");\n\t\t\treturn;\n\t\t}\n\t\tsetError(null);\n\t\tsetStep(\"repos\");\n\t}\n\n\tfunction handleConfirm() {\n\t\tconst selected = Array.from(selectedRepos)\n\t\t\t.map((i) => repos[i])\n\t\t\t.filter((repo): repo is Repo => repo !== undefined);\n\t\tonComplete(apiKey, selected);\n\t}\n\n\tfunction handleGoBack() {\n\t\tsetStep(\"api-key\");\n\t\tsetError(null);\n\t}\n\n\t// Handle keyboard input\n\tuseInput((input, key) => {\n\t\tif (step === \"api-key\") {\n\t\t\t// Handle Enter key\n\t\t\tif (key.return) {\n\t\t\t\thandleApiKeySubmit();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Escape key\n\t\t\tif (key.escape) {\n\t\t\t\tonCancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle backspace\n\t\t\tif (key.backspace || input === \"\\b\") {\n\t\t\t\tsetApiKey((prev) => prev.slice(0, -1));\n\t\t\t\tsetError(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle regular character input\n\t\t\tif (input && !key.ctrl && !key.meta) {\n\t\t\t\tsetApiKey((prev) => prev + input);\n\t\t\t\tsetError(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (step === \"repos\") {\n\t\t\t// Handle Escape key - go back\n\t\t\tif (key.escape) {\n\t\t\t\thandleGoBack();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Enter key - confirm\n\t\t\tif (key.return) {\n\t\t\t\thandleConfirm();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Space - toggle selection\n\t\t\tif (input === \" \") {\n\t\t\t\ttoggleRepo(currentSelection);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Up arrow - move selection up\n\t\t\tif (key.upArrow) {\n\t\t\t\tsetCurrentSelection((prev) => Math.max(0, prev - 1));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Down arrow - move selection down\n\t\t\tif (key.downArrow) {\n\t\t\t\tsetCurrentSelection((prev) => Math.min(repos.length - 1, prev + 1));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle 'a' key - select all\n\t\t\tif (input === \"a\" || input === \"A\") {\n\t\t\t\tconst allIndices = new Set<number>();\n\t\t\t\tfor (let i = 0; i < repos.length; i++) {\n\t\t\t\t\tallIndices.add(i);\n\t\t\t\t}\n\t\t\t\tsetSelectedRepos(allIndices);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle 'n' key - select none\n\t\t\tif (input === \"n\" || input === \"N\") {\n\t\t\t\tsetSelectedRepos(new Set());\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t});\n\n\tfunction toggleRepo(index: number) {\n\t\tconst newSelected = new Set(selectedRepos);\n\t\tif (newSelected.has(index)) {\n\t\t\tnewSelected.delete(index);\n\t\t} else {\n\t\t\tnewSelected.add(index);\n\t\t}\n\t\tsetSelectedRepos(newSelected);\n\t}\n\n\t// Render API key input step\n\tif (step === \"api-key\") {\n\t\treturn (\n\t\t\t<Box flexDirection=\"column\" paddingY={1}>\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text bold color=\"cyan\">\n\t\t\t\t\t\t{\"═══ GitHub App Setup ═══\"}\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text>Enter your Codowave API key:</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t<Box>\n\t\t\t\t\t<Text color=\"gray\">{\"> \"}</Text>\n\t\t\t\t\t<Text>{apiKey}</Text>\n\t\t\t\t\t<Text color=\"cyan\">_</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t{error && (\n\t\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t\t<Text color=\"red\">{pc.red(\"✖ \" + error)}</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\tPress <Text bold>Enter</Text> to continue, <Text bold>Esc</Text> to cancel\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\t// Render repository selection step\n\tif (step === \"repos\") {\n\t\treturn (\n\t\t\t<Box flexDirection=\"column\" paddingY={1}>\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text bold color=\"cyan\">\n\t\t\t\t\t\t{\"═══ Select Repositories ═══\"}\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t{loading && (\n\t\t\t\t\t<Box>\n\t\t\t\t\t\t<Text color=\"yellow\">\n\t\t\t\t\t\t\t<Spinner type=\"dots\" /> Loading repositories...\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{error && (\n\t\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t\t<Text color=\"red\">{pc.red(\"✖ \" + error)}</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && !error && repos.length === 0 && (\n\t\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t\t<Text color=\"yellow\">No repositories found for this API key.</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && repos.length > 0 && (\n\t\t\t\t\t<Box flexDirection=\"column\" marginBottom={1}>\n\t\t\t\t\t\t{repos.map((repo, index) => (\n\t\t\t\t\t\t\t<Box key={index}>\n\t\t\t\t\t\t\t\t<Text>{index === currentSelection ? \" > \" : \" \"}</Text>\n\t\t\t\t\t\t\t\t<Text color={selectedRepos.has(index) ? \"green\" : \"gray\"}>\n\t\t\t\t\t\t\t\t\t[{selectedRepos.has(index) ? \"✓\" : \" \"}]\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t<Text> </Text>\n\t\t\t\t\t\t\t\t<Text bold={index === currentSelection}>\n\t\t\t\t\t\t\t\t\t<Text dimColor={!selectedRepos.has(index)}>\n\t\t\t\t\t\t\t\t\t\t{repo.owner}/{repo.name}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && repos.length > 0 && (\n\t\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\t\t<Text bold>↑/↓</Text> navigate | <Text bold>Space</Text> toggle | <Text bold>A</Text> all | <Text bold>N</Text> none\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\tSelected: <Text bold color=\"green\">{selectedRepos.size}</Text> / {repos.length} repos | <Text bold>Enter</Text> confirm | <Text bold>Esc</Text> back\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, type CodowaveConfig } from \"../config.js\";\nimport { getRun, type RunStatus, type RunStage } 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 Error(\n `Repository ${issue.owner}/${issue.repo} not configured. Run \\`codowave config add-repo ${issue.owner}/${issue.repo}\\``\n );\n }\n\n // Call the API to trigger a run\n const 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\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Failed to trigger run: ${response.status} ${error}`);\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(\"Invalid issue format. Use:\"));\n console.error(\" - Issue number: 123\");\n console.error(\" - Full URL: https://github.com/owner/repo/issues/123\");\n console.error(\" - Short form: 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 const owner = parts[0] || \"\";\n const repo = parts[1] || \"\";\n parsed.owner = owner;\n parsed.repo = repo;\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig } from \"../config.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 // Try to read config (for future API integration)\n let config;\n try {\n config = readConfig();\n } catch {\n // Config not required for demo mode\n }\n\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig } from \"../config.js\";\nimport { getRun, type RunStatus } from \"./status.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 // Try to read config (for future API integration)\n let config;\n try {\n config = readConfig();\n } catch {\n // Config not required for demo mode\n }\n\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, readConfigOrThrow, updateConfig, getConfigPath } from \"../config.js\";\n\nexport const configCommand = new Command(\"config\")\n .description(\"Get or set Codowave configuration values\");\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(\"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 // 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\"];\n if (!validKeys.includes(key)) {\n console.error(pc.red(`✖ Cannot set '${key}' directly.`));\n console.log(pc.gray(` For 'repos', use \\`codowave init\\` 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 const updates = { [key]: value };\n const newConfig = updateConfig(updates);\n \n console.log(pc.green(`✓ Updated ${key}`));\n \n // Show the new value\n console.log(pc.gray(` ${key} = ${newConfig[key as keyof typeof newConfig]}`));\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(\"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 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// Default action when just 'config' is run - show help\nconfigCommand.action(() => {\n configCommand.help();\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\";\nconst PRO_AUTH_URL = \"https://codowave.com/api/auth/device\";\nconst 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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CAAC;;;ARxDH,SAAS,qBAAqB;AAC9B,IAAMC,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,EAAE,QAAQ,IAAIA,SAAQ,iBAAiB;AAE7C,IAAM,UAAU;AAEhB,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QACG,KAAK,UAAU,EACf,YAAY,8EAAyE,EACrF,QAAQ,SAAS,iBAAiB,4BAA4B,EAC9D,OAAO,mBAAmB,+BAA+B;AAE5D,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,aAAa;AAChC,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,aAAa;AAChC,QAAQ,WAAW,cAAc;AAEjC,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAM,eAAe,KAAK,CAAC,MAAM,UAAU,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW;AAElK,IAAI,CAAC,cAAc;AACjB,QAAM,SAAS,WAAW;AAC1B,MAAI,CAAC,QAAQ,QAAQ;AACnB,YAAQ,IAAI,yDAAoD;AAChE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,QAAQ,MAAM;","names":["Command","pc","jsx","pc","Command","pc","pc","Command","Command","pc","demoRuns","pc","Command","Command","pc","Command","pc","Command","pc","Command","pc","Command","pc","Command","pc","require","Command"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/commands/init.tsx","../src/components/init/GithubAppStep.tsx","../src/commands/run.ts","../src/commands/status.ts","../src/commands/logs.ts","../src/commands/config-cmd.ts","../src/commands/connect.ts"],"sourcesContent":["import { Command } from 'commander'\nimport { readConfig } from './config'\nimport { initCommand } from './commands/init.js'\nimport { runCommand } from './commands/run.js'\nimport { statusCommand } from './commands/status.js'\nimport { logsCommand } from './commands/logs.js'\nimport { configCommand } from './commands/config-cmd.js'\nimport { connectCommand } from './commands/connect.js'\n\n// Read version from package.json\nimport { createRequire } from 'module'\nconst require = createRequire(import.meta.url)\nconst { version } = require('../package.json')\n\nconst VERSION = version\n\nconst program = new Command()\n\nprogram\n .name('codowave')\n .description('Codowave OSS CLI — AI-powered coding agent for your GitHub repositories')\n .version(VERSION, '-v, --version', 'Output the current version')\n .option('--api-url <url>', 'Override the Codowave API URL')\n\nprogram.addCommand(initCommand)\nprogram.addCommand(runCommand)\nprogram.addCommand(statusCommand)\nprogram.addCommand(logsCommand)\nprogram.addCommand(configCommand)\nprogram.addCommand(connectCommand)\n\nconst args = process.argv.slice(2)\nconst isInitOrHelp = args[0] === 'init' || args.includes('--help') || args.includes('-h') || args.includes('--version') || args.includes('-v') || args.length === 0\n\nif (!isInitOrHelp) {\n const config = readConfig()\n if (!config?.apiUrl) {\n console.log('\\n❌ Codowave not initialized. Run: codowave init\\n')\n process.exit(1)\n }\n}\n\nprogram.parse()\n","import { readFileSync, writeFileSync, mkdirSync, existsSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { z } from \"zod\";\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});\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 return null;\n }\n\n return parsed.data;\n } catch (err) {\n console.warn(`[config] Failed to parse ${CONFIG_FILE}:`, err);\n return null;\n }\n}\n\nexport function readConfigOrThrow(): CodowaveConfig {\n const config = readConfig();\n if (!config) {\n throw new Error(\n `No Codowave config found. Run \\`codowave init\\` to get started.`\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 };\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 { render } from \"ink\";\nimport React from \"react\";\nimport { writeConfig, readConfig, getConfigPath } from \"../config.js\";\nimport { GithubAppStep } from \"../components/init/GithubAppStep.js\";\n\ntype Repo = {\n\towner: string;\n\tname: string;\n\tid?: string;\n};\n\nexport const initCommand = new Command(\"init\")\n\t.description(\"Initialize Codowave and connect your GitHub repositories\")\n\t.option(\"--api-key <key>\", \"Codowave API key (non-interactive mode)\")\n\t.option(\"--api-url <url>\", \"Codowave API URL\")\n\t.option(\"--github-app-id <id>\", \"GitHub App ID\")\n\t.option(\"--github-app-private-key <key>\", \"GitHub App private key path\")\n\t.option(\"--repos <repos>\", \"Comma-separated list of repos (owner/repo)\")\n\t.action(async (opts) => {\n\t\tconst existingConfig = readConfig();\n\t\tconst defaultApiUrl = \"https://api.codowave.com\";\n\n\t\t// Non-interactive mode\n\t\tif (opts.apiKey) {\n\t\t\tconst config = {\n\t\t\t\tapiKey: opts.apiKey,\n\t\t\t\tapiUrl: opts.apiUrl || existingConfig?.apiUrl || defaultApiUrl,\n\t\t\t\tgithubAppId: opts.githubAppId || \"\",\n\t\t\t\tgithubAppPrivateKey: opts.githubAppPrivateKey || \"\",\n\t\t\t\trepos: opts.repos ? opts.repos.split(\",\").map((r: string) => {\n\t\t\t\t\tconst [owner, name] = r.trim().split(\"/\");\n\t\t\t\t\treturn { owner, name };\n\t\t\t\t}) : [],\n\t\t\t\tautopilot: existingConfig?.autopilot ?? true,\n\t\t\t\tlabels: existingConfig?.labels || {\n\t\t\t\t\tapproved: \"status/approved\",\n\t\t\t\t\tinProgress: \"status/in-progress\",\n\t\t\t\t\tmerged: \"status/merged\"\n\t\t\t\t}\n\t\t\t};\n\n\t\t\twriteConfig(config);\n\t\t\tconsole.log(pc.green(\"\\n✅ Codowave initialized successfully!\\n\"));\n\t\t\tconsole.log(` API URL: ${pc.cyan(config.apiUrl)}`);\n\t\t\tconsole.log(` Repos: ${pc.cyan(config.repos.map((r: any) => `${r.owner}/${r.name}`).join(\", \") || \"none\")}`);\n\t\t\tconsole.log(pc.gray(`\\n Config: ${getConfigPath()}\\n`));\n\t\t\treturn;\n\t\t}\n\n\t\t// Interactive TUI mode\n\t\tconst apiUrl = existingConfig?.apiUrl || defaultApiUrl;\n\n\t\t// If already initialized, ask if they want to reconfigure\n\t\tif (existingConfig?.apiKey) {\n\t\t\tconsole.log(pc.yellow(\"\\n⚠ Codowave is already initialized.\\n\"));\n\t\t\tconsole.log(` API URL: ${pc.cyan(existingConfig.apiUrl)}`);\n\t\t\tconsole.log(` Config: ${getConfigPath()}`);\n\t\t\tconsole.log(pc.gray(\"\\n Run with --api-key to reconfigure non-interactively.\\n\"));\n\t\t\treturn;\n\t\t}\n\n\t\tlet wizardComplete = false;\n\t\tlet capturedApiKey = \"\";\n\t\tlet capturedRepos: Repo[] = [];\n\n\t\tconst { waitUntilExit } = render(\n\t\t\t<GithubAppStep\n\t\t\t\tapiUrl={apiUrl}\n\t\t\t\tonComplete={(apiKey, repos) => {\n\t\t\t\t\tcapturedApiKey = apiKey;\n\t\t\t\t\tcapturedRepos = repos;\n\t\t\t\t\twizardComplete = true;\n\t\t\t\t}}\n\t\t\t\tonCancel={() => {\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\n\t\tawait waitUntilExit();\n\n\t\tif (!wizardComplete) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst config = {\n\t\t\tapiKey: capturedApiKey,\n\t\t\tapiUrl,\n\t\t\trepos: capturedRepos,\n\t\t\tautopilot: true,\n\t\t\tlabels: {\n\t\t\t\tapproved: \"status/approved\",\n\t\t\t\tinProgress: \"status/in-progress\",\n\t\t\t\tmerged: \"status/merged\"\n\t\t\t}\n\t\t};\n\n\t\twriteConfig(config);\n\n\t\tconsole.log(pc.green(\"\\n✅ Codowave initialized successfully!\\n\"));\n\t\tconsole.log(pc.gray(` Config: ${getConfigPath()}\\n`));\n\t});\n","import React, { useState, useEffect, useRef } from \"react\";\nimport {\n Box,\n Text,\n useInput,\n} from \"ink\";\nimport Spinner from \"ink-spinner\";\nimport pc from \"picocolors\";\n\ntype Repo = {\n\towner: string;\n\tname: string;\n\tid?: string;\n};\n\ntype Props = {\n\tapiUrl: string;\n\tonComplete: (apiKey: string, repos: Repo[]) => void;\n\tonCancel: () => void;\n};\n\ntype Step = \"api-key\" | \"repos\";\n\nexport const GithubAppStep: React.FC<Props> = ({ apiUrl, onComplete, onCancel }) => {\n\tconst [step, setStep] = useState<Step>(\"api-key\");\n\tconst [apiKey, setApiKey] = useState(\"\");\n\tconst [repos, setRepos] = useState<Repo[]>([]);\n\tconst [selectedRepos, setSelectedRepos] = useState<Set<number>>(new Set());\n\tconst [currentSelection, setCurrentSelection] = useState(0);\n\tconst [loading, setLoading] = useState(false);\n\tconst [error, setError] = useState<string | null>(null);\n\n\t// Fetch repos when API key is validated\n\tuseEffect(() => {\n\t\tif (step === \"repos\" && apiKey && repos.length === 0 && !loading) {\n\t\t\tfetchRepos();\n\t\t}\n\t}, [step, apiKey]);\n\n\tasync function fetchRepos() {\n\t\tsetLoading(true);\n\t\tsetError(null);\n\n\t\ttry {\n\t\t\t// Call the API to get repositories\n\t\t\t// This endpoint should return the repos associated with the API key\n\t\t\tconst response = await fetch(`${apiUrl}/api/v1/repos`, {\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (!response.ok) {\n\t\t\t\tif (response.status === 401) {\n\t\t\t\t\tthrow new Error(\"Invalid API key. Please check and try again.\");\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Failed to fetch repositories: ${response.status}`);\n\t\t\t}\n\n\t\t\tconst data = await response.json() as { repos?: Repo[]; repositories?: Repo[] };\n\t\t\t// Expected response format: { repos: [{ owner, name, id? }] }\n\t\t\tconst fetchedRepos = data.repos || data.repositories || [];\n\t\t\tsetRepos(fetchedRepos);\n\t\t\t// Select all by default\n\t\t\tif (fetchedRepos.length > 0) {\n\t\t\t\tconst allIndices = new Set<number>();\n\t\t\t\tfor (let i = 0; i < fetchedRepos.length; i++) {\n\t\t\t\t\tallIndices.add(i);\n\t\t\t\t}\n\t\t\t\tsetSelectedRepos(allIndices);\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tsetError(err instanceof Error ? err.message : \"Failed to fetch repositories\");\n\t\t} finally {\n\t\t\tsetLoading(false);\n\t\t}\n\t}\n\n\tfunction handleApiKeySubmit() {\n\t\tif (!apiKey.trim()) {\n\t\t\tsetError(\"API key cannot be empty\");\n\t\t\treturn;\n\t\t}\n\t\tsetError(null);\n\t\tsetStep(\"repos\");\n\t}\n\n\tfunction handleConfirm() {\n\t\tconst selected = Array.from(selectedRepos)\n\t\t\t.map((i) => repos[i])\n\t\t\t.filter((repo): repo is Repo => repo !== undefined);\n\t\tonComplete(apiKey, selected);\n\t}\n\n\tfunction handleGoBack() {\n\t\tsetStep(\"api-key\");\n\t\tsetError(null);\n\t}\n\n\t// Handle keyboard input\n\tuseInput((input, key) => {\n\t\tif (step === \"api-key\") {\n\t\t\t// Handle Enter key\n\t\t\tif (key.return) {\n\t\t\t\thandleApiKeySubmit();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Escape key\n\t\t\tif (key.escape) {\n\t\t\t\tonCancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle backspace\n\t\t\tif (key.backspace || input === \"\\b\") {\n\t\t\t\tsetApiKey((prev) => prev.slice(0, -1));\n\t\t\t\tsetError(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle regular character input\n\t\t\tif (input && !key.ctrl && !key.meta) {\n\t\t\t\tsetApiKey((prev) => prev + input);\n\t\t\t\tsetError(null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (step === \"repos\") {\n\t\t\t// Handle Escape key - go back\n\t\t\tif (key.escape) {\n\t\t\t\thandleGoBack();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Enter key - confirm\n\t\t\tif (key.return) {\n\t\t\t\thandleConfirm();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Space - toggle selection\n\t\t\tif (input === \" \") {\n\t\t\t\ttoggleRepo(currentSelection);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Up arrow - move selection up\n\t\t\tif (key.upArrow) {\n\t\t\t\tsetCurrentSelection((prev) => Math.max(0, prev - 1));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle Down arrow - move selection down\n\t\t\tif (key.downArrow) {\n\t\t\t\tsetCurrentSelection((prev) => Math.min(repos.length - 1, prev + 1));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle 'a' key - select all\n\t\t\tif (input === \"a\" || input === \"A\") {\n\t\t\t\tconst allIndices = new Set<number>();\n\t\t\t\tfor (let i = 0; i < repos.length; i++) {\n\t\t\t\t\tallIndices.add(i);\n\t\t\t\t}\n\t\t\t\tsetSelectedRepos(allIndices);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Handle 'n' key - select none\n\t\t\tif (input === \"n\" || input === \"N\") {\n\t\t\t\tsetSelectedRepos(new Set());\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t});\n\n\tfunction toggleRepo(index: number) {\n\t\tconst newSelected = new Set(selectedRepos);\n\t\tif (newSelected.has(index)) {\n\t\t\tnewSelected.delete(index);\n\t\t} else {\n\t\t\tnewSelected.add(index);\n\t\t}\n\t\tsetSelectedRepos(newSelected);\n\t}\n\n\t// Render API key input step\n\tif (step === \"api-key\") {\n\t\treturn (\n\t\t\t<Box flexDirection=\"column\" paddingY={1}>\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text bold color=\"cyan\">\n\t\t\t\t\t\t{\"═══ GitHub App Setup ═══\"}\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text>Enter your Codowave API key:</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t<Box>\n\t\t\t\t\t<Text color=\"gray\">{\"> \"}</Text>\n\t\t\t\t\t<Text>{apiKey}</Text>\n\t\t\t\t\t<Text color=\"cyan\">_</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t{error && (\n\t\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t\t<Text color=\"red\">{pc.red(\"✖ \" + error)}</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\tPress <Text bold>Enter</Text> to continue, <Text bold>Esc</Text> to cancel\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\t// Render repository selection step\n\tif (step === \"repos\") {\n\t\treturn (\n\t\t\t<Box flexDirection=\"column\" paddingY={1}>\n\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t<Text bold color=\"cyan\">\n\t\t\t\t\t\t{\"═══ Select Repositories ═══\"}\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\n\t\t\t\t{loading && (\n\t\t\t\t\t<Box>\n\t\t\t\t\t\t<Text color=\"yellow\">\n\t\t\t\t\t\t\t<Spinner type=\"dots\" /> Loading repositories...\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{error && (\n\t\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t\t<Text color=\"red\">{pc.red(\"✖ \" + error)}</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && !error && repos.length === 0 && (\n\t\t\t\t\t<Box marginBottom={1}>\n\t\t\t\t\t\t<Text color=\"yellow\">No repositories found for this API key.</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && repos.length > 0 && (\n\t\t\t\t\t<Box flexDirection=\"column\" marginBottom={1}>\n\t\t\t\t\t\t{repos.map((repo, index) => (\n\t\t\t\t\t\t\t<Box key={index}>\n\t\t\t\t\t\t\t\t<Text>{index === currentSelection ? \" > \" : \" \"}</Text>\n\t\t\t\t\t\t\t\t<Text color={selectedRepos.has(index) ? \"green\" : \"gray\"}>\n\t\t\t\t\t\t\t\t\t[{selectedRepos.has(index) ? \"✓\" : \" \"}]\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t<Text> </Text>\n\t\t\t\t\t\t\t\t<Text bold={index === currentSelection}>\n\t\t\t\t\t\t\t\t\t<Text dimColor={!selectedRepos.has(index)}>\n\t\t\t\t\t\t\t\t\t\t{repo.owner}/{repo.name}\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t{!loading && repos.length > 0 && (\n\t\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\t\t<Text bold>↑/↓</Text> navigate | <Text bold>Space</Text> toggle | <Text bold>A</Text> all | <Text bold>N</Text> none\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</Box>\n\t\t\t\t)}\n\n\t\t\t\t<Box marginTop={1}>\n\t\t\t\t\t<Text color=\"gray\">\n\t\t\t\t\t\tSelected: <Text bold color=\"green\">{selectedRepos.size}</Text> / {repos.length} repos | <Text bold>Enter</Text> confirm | <Text bold>Esc</Text> back\n\t\t\t\t\t</Text>\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t);\n\t}\n\n\treturn null;\n};\n","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, type CodowaveConfig } from \"../config.js\";\nimport { getRun, type RunStatus, type RunStage } 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 Error(\n `Repository ${issue.owner}/${issue.repo} not configured. Run \\`codowave config add-repo ${issue.owner}/${issue.repo}\\``\n );\n }\n\n // Call the API to trigger a run\n const 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\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`Failed to trigger run: ${response.status} ${error}`);\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(\"Invalid issue format. Use:\"));\n console.error(\" - Issue number: 123\");\n console.error(\" - Full URL: https://github.com/owner/repo/issues/123\");\n console.error(\" - Short form: 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 const owner = parts[0] || \"\";\n const repo = parts[1] || \"\";\n parsed.owner = owner;\n parsed.repo = repo;\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig } from \"../config.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 // Try to read config (for future API integration)\n let config;\n try {\n config = readConfig();\n } catch {\n // Config not required for demo mode\n }\n\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig } from \"../config.js\";\nimport { getRun, type RunStatus } from \"./status.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 // Try to read config (for future API integration)\n let config;\n try {\n config = readConfig();\n } catch {\n // Config not required for demo mode\n }\n\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 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","import { Command } from \"commander\";\nimport pc from \"picocolors\";\nimport { readConfig, readConfigOrThrow, updateConfig, getConfigPath } from \"../config.js\";\n\nexport const configCommand = new Command(\"config\")\n .description(\"Get or set Codowave configuration values\");\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(\"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 // 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\"];\n if (!validKeys.includes(key)) {\n console.error(pc.red(`✖ Cannot set '${key}' directly.`));\n console.log(pc.gray(` For 'repos', use \\`codowave init\\` 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 const updates = { [key]: value };\n const newConfig = updateConfig(updates);\n \n console.log(pc.green(`✓ Updated ${key}`));\n \n // Show the new value\n console.log(pc.gray(` ${key} = ${newConfig[key as keyof typeof newConfig]}`));\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(\"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 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// Default action when just 'config' is run - show help\nconfigCommand.action(() => {\n configCommand.help();\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\";\nconst PRO_AUTH_URL = \"https://codowave.com/api/auth/device\";\nconst 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"],"mappings":";AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,cAAc,eAAe,WAAW,kBAAkB;AACnE,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,SAAS;AAIX,IAAM,mBAAmB,EAAE,OAAO;AAAA,EACv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,SAAS,IAAI,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW;AAElK,IAAI,CAAC,cAAc;AACjB,QAAM,SAAS,WAAW;AAC1B,MAAI,CAAC,QAAQ,QAAQ;AACnB,YAAQ,IAAI,yDAAoD;AAChE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,QAAQ,MAAM;","names":["Command","pc","jsx","config","pc","Command","pc","pc","Command","Command","pc","demoRuns","pc","Command","Command","pc","Command","pc","Command","pc","Command","pc","Command","pc","Command","pc","require","Command"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codowave",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Codowave OSS CLI — AI-powered coding agent for your GitHub repos",
5
5
  "license": "MIT",
6
6
  "type": "module",