codowave 0.1.1 → 0.1.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/README.md +229 -29
- package/dist/index.js +190 -343
- package/dist/index.js.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
#!/usr/bin/env node
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __esm = (fn, res) => function __init() {
|
|
@@ -10,97 +9,6 @@ var __export = (target, all) => {
|
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
// src/utils/error.ts
|
|
14
|
-
import pc from "picocolors";
|
|
15
|
-
function getErrorMessage(err) {
|
|
16
|
-
if (err instanceof CodowaveError) {
|
|
17
|
-
return err.getFormattedMessage();
|
|
18
|
-
}
|
|
19
|
-
if (err instanceof Error) {
|
|
20
|
-
const message = err.message;
|
|
21
|
-
if (message.includes("ECONNREFUSED") || message.includes("ENOTFOUND")) {
|
|
22
|
-
return `Unable to connect to the Codowave API. Please check your internet connection and try again.`;
|
|
23
|
-
}
|
|
24
|
-
if (message.includes("401") || message.includes("unauthorized")) {
|
|
25
|
-
return `Authentication failed. Please run 'codowave init' to re-authenticate.`;
|
|
26
|
-
}
|
|
27
|
-
if (message.includes("403") || message.includes("forbidden")) {
|
|
28
|
-
return `Access denied. You don't have permission to perform this action.`;
|
|
29
|
-
}
|
|
30
|
-
if (message.includes("404") || message.includes("not found")) {
|
|
31
|
-
return `The requested resource was not found. Please check the repository or issue number and try again.`;
|
|
32
|
-
}
|
|
33
|
-
if (message.includes("rate limit")) {
|
|
34
|
-
return `Rate limit exceeded. Please wait a moment and try again.`;
|
|
35
|
-
}
|
|
36
|
-
return message;
|
|
37
|
-
}
|
|
38
|
-
return String(err);
|
|
39
|
-
}
|
|
40
|
-
function handleError(err, context) {
|
|
41
|
-
const message = getErrorMessage(err);
|
|
42
|
-
const prefix = context ? `[${context}] ` : "";
|
|
43
|
-
console.error(`
|
|
44
|
-
${pc.red("\u2716")} ${prefix}${message}
|
|
45
|
-
`);
|
|
46
|
-
if (err instanceof CodowaveError && err.code) {
|
|
47
|
-
console.error(pc.gray(`Error code: ${err.code}`));
|
|
48
|
-
}
|
|
49
|
-
if (process.env.NODE_ENV === "development" && err instanceof Error && err.stack) {
|
|
50
|
-
console.error(pc.gray(err.stack));
|
|
51
|
-
}
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
var CodowaveError, ConfigError, APIError, ErrorCodes;
|
|
55
|
-
var init_error = __esm({
|
|
56
|
-
"src/utils/error.ts"() {
|
|
57
|
-
"use strict";
|
|
58
|
-
CodowaveError = class extends Error {
|
|
59
|
-
constructor(message, code, context) {
|
|
60
|
-
super(message);
|
|
61
|
-
this.code = code;
|
|
62
|
-
this.context = context;
|
|
63
|
-
this.name = "CodowaveError";
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Returns a formatted error message with optional context
|
|
67
|
-
*/
|
|
68
|
-
getFormattedMessage() {
|
|
69
|
-
let msg = this.message;
|
|
70
|
-
if (this.context && Object.keys(this.context).length > 0) {
|
|
71
|
-
msg += `
|
|
72
|
-
|
|
73
|
-
Context: ${JSON.stringify(this.context, null, 2)}`;
|
|
74
|
-
}
|
|
75
|
-
return msg;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
ConfigError = class extends CodowaveError {
|
|
79
|
-
constructor(message, context) {
|
|
80
|
-
super(message, "CONFIG_ERROR", context);
|
|
81
|
-
this.name = "ConfigError";
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
APIError = class extends CodowaveError {
|
|
85
|
-
constructor(message, statusCode, context) {
|
|
86
|
-
super(message, "API_ERROR", context);
|
|
87
|
-
this.statusCode = statusCode;
|
|
88
|
-
this.name = "APIError";
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
ErrorCodes = {
|
|
92
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
93
|
-
INVALID_CONFIG: "INVALID_CONFIG",
|
|
94
|
-
REPO_NOT_CONFIGURED: "REPO_NOT_CONFIGURED",
|
|
95
|
-
API_ERROR: "API_ERROR",
|
|
96
|
-
NETWORK_ERROR: "NETWORK_ERROR",
|
|
97
|
-
AUTH_ERROR: "AUTH_ERROR",
|
|
98
|
-
INVALID_ISSUE_FORMAT: "INVALID_ISSUE_FORMAT",
|
|
99
|
-
RUN_FAILED: "RUN_FAILED"
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
12
|
// src/config.ts
|
|
105
13
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
106
14
|
import { join } from "path";
|
|
@@ -115,24 +23,19 @@ function readConfig() {
|
|
|
115
23
|
const json = JSON.parse(raw);
|
|
116
24
|
const parsed = ConfigSchema.safeParse(json);
|
|
117
25
|
if (!parsed.success) {
|
|
118
|
-
const issues = parsed.error.issues.map((i) => ` - ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
119
|
-
console.warn(`[config] Config validation failed:
|
|
120
|
-
${issues}`);
|
|
121
26
|
return null;
|
|
122
27
|
}
|
|
123
28
|
return parsed.data;
|
|
124
29
|
} catch (err) {
|
|
125
|
-
|
|
126
|
-
console.warn(`[config] Failed to read ${CONFIG_FILE}: ${message}`);
|
|
30
|
+
console.warn(`[config] Failed to parse ${CONFIG_FILE}:`, err);
|
|
127
31
|
return null;
|
|
128
32
|
}
|
|
129
33
|
}
|
|
130
34
|
function readConfigOrThrow() {
|
|
131
35
|
const config = readConfig();
|
|
132
36
|
if (!config) {
|
|
133
|
-
throw new
|
|
134
|
-
|
|
135
|
-
{ suggestion: "Run 'codowave init' to configure your API key and repositories" }
|
|
37
|
+
throw new Error(
|
|
38
|
+
`No Codowave config found. Run \`codowave init\` to get started.`
|
|
136
39
|
);
|
|
137
40
|
}
|
|
138
41
|
return config;
|
|
@@ -163,7 +66,6 @@ var AIProviderSchema, ConfigSchema, CONFIG_DIR, CONFIG_FILE;
|
|
|
163
66
|
var init_config = __esm({
|
|
164
67
|
"src/config.ts"() {
|
|
165
68
|
"use strict";
|
|
166
|
-
init_error();
|
|
167
69
|
AIProviderSchema = z.object({
|
|
168
70
|
provider: z.enum(["openai", "anthropic", "minimax", "ollama", "custom"]),
|
|
169
71
|
apiKey: z.string().min(1),
|
|
@@ -195,7 +97,7 @@ import {
|
|
|
195
97
|
useInput
|
|
196
98
|
} from "ink";
|
|
197
99
|
import Spinner from "ink-spinner";
|
|
198
|
-
import
|
|
100
|
+
import pc from "picocolors";
|
|
199
101
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
200
102
|
var GithubAppStep;
|
|
201
103
|
var init_GithubAppStep = __esm({
|
|
@@ -335,7 +237,7 @@ var init_GithubAppStep = __esm({
|
|
|
335
237
|
/* @__PURE__ */ jsx(Text, { children: apiKey }),
|
|
336
238
|
/* @__PURE__ */ jsx(Text, { color: "cyan", children: "_" })
|
|
337
239
|
] }),
|
|
338
|
-
error && /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "red", children:
|
|
240
|
+
error && /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(Text, { color: "red", children: pc.red("\u2716 " + error) }) }),
|
|
339
241
|
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
|
|
340
242
|
"Press ",
|
|
341
243
|
/* @__PURE__ */ jsx(Text, { bold: true, children: "Enter" }),
|
|
@@ -352,7 +254,7 @@ var init_GithubAppStep = __esm({
|
|
|
352
254
|
/* @__PURE__ */ jsx(Spinner, { type: "dots" }),
|
|
353
255
|
" Loading repositories..."
|
|
354
256
|
] }) }),
|
|
355
|
-
error && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { color: "red", children:
|
|
257
|
+
error && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { color: "red", children: pc.red("\u2716 " + error) }) }),
|
|
356
258
|
!loading && !error && repos.length === 0 && /* @__PURE__ */ jsx(Box, { marginBottom: 1, children: /* @__PURE__ */ jsx(Text, { color: "yellow", children: "No repositories found for this API key." }) }),
|
|
357
259
|
!loading && repos.length > 0 && /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginBottom: 1, children: repos.map((repo, index) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
358
260
|
/* @__PURE__ */ jsx(Text, { children: index === currentSelection ? " > " : " " }),
|
|
@@ -402,7 +304,7 @@ __export(init_exports, {
|
|
|
402
304
|
initCommand: () => initCommand
|
|
403
305
|
});
|
|
404
306
|
import { Command } from "commander";
|
|
405
|
-
import
|
|
307
|
+
import pc2 from "picocolors";
|
|
406
308
|
import { render } from "ink";
|
|
407
309
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
408
310
|
var initCommand;
|
|
@@ -416,10 +318,10 @@ var init_init = __esm({
|
|
|
416
318
|
const defaultApiUrl = "https://api.codowave.com";
|
|
417
319
|
const apiUrl = existingConfig?.apiUrl || defaultApiUrl;
|
|
418
320
|
if (existingConfig?.apiKey) {
|
|
419
|
-
console.log(
|
|
420
|
-
console.log(` API URL: ${
|
|
321
|
+
console.log(pc2.yellow("\n\u26A0 Codowave is already initialized.\n"));
|
|
322
|
+
console.log(` API URL: ${pc2.cyan(existingConfig.apiUrl)}`);
|
|
421
323
|
console.log(` Config: ${getConfigPath()}`);
|
|
422
|
-
console.log(
|
|
324
|
+
console.log(pc2.gray("\n Run this command again to reconfigure.\n"));
|
|
423
325
|
return;
|
|
424
326
|
}
|
|
425
327
|
let wizardComplete = false;
|
|
@@ -450,13 +352,13 @@ var init_init = __esm({
|
|
|
450
352
|
apiUrl,
|
|
451
353
|
repos: capturedRepos
|
|
452
354
|
});
|
|
453
|
-
console.log(
|
|
355
|
+
console.log(pc2.green("\n\u2713 Initialization complete!"));
|
|
454
356
|
console.log(`
|
|
455
|
-
Config saved to: ${
|
|
456
|
-
console.log(` API URL: ${
|
|
457
|
-
console.log(` Repositories: ${
|
|
357
|
+
Config saved to: ${pc2.cyan(getConfigPath())}`);
|
|
358
|
+
console.log(` API URL: ${pc2.cyan(apiUrl)}`);
|
|
359
|
+
console.log(` Repositories: ${pc2.bold(capturedRepos.length)} configured
|
|
458
360
|
`);
|
|
459
|
-
console.log(
|
|
361
|
+
console.log(pc2.gray(" Run ") + pc2.bold("codowave run") + pc2.gray(" to start coding!\n"));
|
|
460
362
|
});
|
|
461
363
|
}
|
|
462
364
|
});
|
|
@@ -467,7 +369,7 @@ __export(run_exports, {
|
|
|
467
369
|
runCommand: () => runCommand
|
|
468
370
|
});
|
|
469
371
|
import { Command as Command2 } from "commander";
|
|
470
|
-
import
|
|
372
|
+
import pc3 from "picocolors";
|
|
471
373
|
function parseIssue(input) {
|
|
472
374
|
const urlMatch = input.match(/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/);
|
|
473
375
|
if (urlMatch && urlMatch[1] && urlMatch[2] && urlMatch[3]) {
|
|
@@ -490,70 +392,24 @@ async function triggerRun(config, issue) {
|
|
|
490
392
|
(r) => r.owner === issue.owner && r.name === issue.repo
|
|
491
393
|
);
|
|
492
394
|
if (!repoConfig) {
|
|
493
|
-
throw new
|
|
494
|
-
`Repository ${issue.owner}/${issue.repo}
|
|
495
|
-
{
|
|
496
|
-
suggestion: `Run 'codowave config add-repo ${issue.owner}/${issue.repo}' to add this repository`,
|
|
497
|
-
configuredRepos: config.repos.map((r) => `${r.owner}/${r.name}`)
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
let response;
|
|
502
|
-
try {
|
|
503
|
-
response = await fetch(`${apiUrl}/api/runs`, {
|
|
504
|
-
method: "POST",
|
|
505
|
-
headers: {
|
|
506
|
-
"Content-Type": "application/json",
|
|
507
|
-
Authorization: `Bearer ${apiKey}`
|
|
508
|
-
},
|
|
509
|
-
body: JSON.stringify({
|
|
510
|
-
repositoryId: repoConfig.id,
|
|
511
|
-
issueNumber: issue.number
|
|
512
|
-
})
|
|
513
|
-
});
|
|
514
|
-
} catch {
|
|
515
|
-
throw new CodowaveError(
|
|
516
|
-
`Failed to connect to Codowave API at ${apiUrl}`,
|
|
517
|
-
ErrorCodes.NETWORK_ERROR,
|
|
518
|
-
{ suggestion: "Check your internet connection and verify the API URL in your config." }
|
|
395
|
+
throw new Error(
|
|
396
|
+
`Repository ${issue.owner}/${issue.repo} not configured. Run \`codowave config add-repo ${issue.owner}/${issue.repo}\``
|
|
519
397
|
);
|
|
520
398
|
}
|
|
399
|
+
const response = await fetch(`${apiUrl}/api/runs`, {
|
|
400
|
+
method: "POST",
|
|
401
|
+
headers: {
|
|
402
|
+
"Content-Type": "application/json",
|
|
403
|
+
Authorization: `Bearer ${apiKey}`
|
|
404
|
+
},
|
|
405
|
+
body: JSON.stringify({
|
|
406
|
+
repositoryId: repoConfig.id,
|
|
407
|
+
issueNumber: issue.number
|
|
408
|
+
})
|
|
409
|
+
});
|
|
521
410
|
if (!response.ok) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
try {
|
|
525
|
-
errorBody = await response.json();
|
|
526
|
-
errorMessage = errorBody.error || errorBody.message || errorMessage;
|
|
527
|
-
} catch {
|
|
528
|
-
errorMessage = response.statusText || errorMessage;
|
|
529
|
-
}
|
|
530
|
-
if (response.status === 401) {
|
|
531
|
-
throw new CodowaveError(
|
|
532
|
-
`Authentication failed: ${errorMessage}`,
|
|
533
|
-
ErrorCodes.AUTH_ERROR,
|
|
534
|
-
{ suggestion: "Run 'codowave init' to re-authenticate." }
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
if (response.status === 403) {
|
|
538
|
-
throw new CodowaveError(
|
|
539
|
-
`Access denied: ${errorMessage}`,
|
|
540
|
-
ErrorCodes.AUTH_ERROR,
|
|
541
|
-
{ suggestion: "You don't have permission to trigger runs for this repository." }
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
if (response.status === 404) {
|
|
545
|
-
throw new CodowaveError(
|
|
546
|
-
`Resource not found: ${errorMessage}`,
|
|
547
|
-
ErrorCodes.API_ERROR,
|
|
548
|
-
{ suggestion: "The repository or issue may no longer exist." }
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
|
-
const errorText = await response.text();
|
|
552
|
-
throw new APIError(
|
|
553
|
-
`Failed to trigger run: ${response.status} ${response.statusText}`,
|
|
554
|
-
response.status,
|
|
555
|
-
{ response: errorText, issueNumber: issue.number, repo: `${issue.owner}/${issue.repo}` }
|
|
556
|
-
);
|
|
411
|
+
const error = await response.text();
|
|
412
|
+
throw new Error(`Failed to trigger run: ${response.status} ${error}`);
|
|
557
413
|
}
|
|
558
414
|
const data = await response.json();
|
|
559
415
|
return data.runId;
|
|
@@ -581,11 +437,11 @@ function createDemoRun(issue) {
|
|
|
581
437
|
function streamDemoRun(run) {
|
|
582
438
|
const stages = ["context", "planning", "implementation", "testing", "pr-creation"];
|
|
583
439
|
let currentStage = 0;
|
|
584
|
-
console.log(
|
|
585
|
-
console.log(
|
|
586
|
-
console.log(
|
|
587
|
-
console.log(
|
|
588
|
-
console.log(
|
|
440
|
+
console.log(pc3.bold("\n=== Starting Run ===\n"));
|
|
441
|
+
console.log(pc3.bold("Run ID: ") + run.id);
|
|
442
|
+
console.log(pc3.bold("Repo: ") + run.repo);
|
|
443
|
+
console.log(pc3.bold("Issue: ") + run.issue);
|
|
444
|
+
console.log(pc3.bold("Branch: ") + run.branchName);
|
|
589
445
|
console.log("");
|
|
590
446
|
const interval = setInterval(() => {
|
|
591
447
|
if (currentStage >= stages.length) {
|
|
@@ -594,10 +450,10 @@ function streamDemoRun(run) {
|
|
|
594
450
|
run.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
595
451
|
run.prNumber = 100 + Math.floor(Math.random() * 50);
|
|
596
452
|
run.prTitle = `feat: Implement issue #${run.issue}`;
|
|
597
|
-
console.log(
|
|
598
|
-
console.log(
|
|
599
|
-
console.log(
|
|
600
|
-
console.log(
|
|
453
|
+
console.log(pc3.green("\n\u2713 Run completed successfully!"));
|
|
454
|
+
console.log(pc3.bold("\n=== Result ===\n"));
|
|
455
|
+
console.log(pc3.bold("PR: ") + `#${run.prNumber} - ${run.prTitle}`);
|
|
456
|
+
console.log(pc3.bold("Branch: ") + run.branchName);
|
|
601
457
|
console.log("");
|
|
602
458
|
process.exit(0);
|
|
603
459
|
return;
|
|
@@ -606,7 +462,7 @@ function streamDemoRun(run) {
|
|
|
606
462
|
const stage = run.stages.find((s) => s.name === stageName);
|
|
607
463
|
if (stage) {
|
|
608
464
|
stage.status = "running";
|
|
609
|
-
console.log(
|
|
465
|
+
console.log(pc3.blue(`
|
|
610
466
|
--- ${stageName} ---`));
|
|
611
467
|
setTimeout(() => {
|
|
612
468
|
stage.status = "completed";
|
|
@@ -620,7 +476,7 @@ function streamDemoRun(run) {
|
|
|
620
476
|
process.on("SIGINT", () => {
|
|
621
477
|
clearInterval(interval);
|
|
622
478
|
run.status = "cancelled";
|
|
623
|
-
console.log(
|
|
479
|
+
console.log(pc3.yellow("\n\n\u26A0 Run cancelled"));
|
|
624
480
|
process.exit(1);
|
|
625
481
|
});
|
|
626
482
|
}
|
|
@@ -629,23 +485,23 @@ var init_run = __esm({
|
|
|
629
485
|
"src/commands/run.ts"() {
|
|
630
486
|
"use strict";
|
|
631
487
|
init_config();
|
|
632
|
-
init_error();
|
|
633
488
|
demoRuns = /* @__PURE__ */ new Map();
|
|
634
489
|
runCommand = new Command2("run").description("Trigger Codowave to process a GitHub issue").argument("<issue>", "GitHub issue number, URL (https://github.com/owner/repo/issues/123), or owner/repo#123").option("-r, --repo <owner/repo>", "Target repository (e.g. owner/repo)").option("-s, --stream", "Stream run progress (SSE)", false).action(async (_issueArg, _options) => {
|
|
635
490
|
try {
|
|
636
491
|
const parsed = parseIssue(_issueArg);
|
|
637
492
|
if (!parsed) {
|
|
638
|
-
console.error(
|
|
639
|
-
console.error(
|
|
640
|
-
console.error(
|
|
641
|
-
console.error(
|
|
642
|
-
console.error(pc5.gray(" \u2022 With repo flag: --repo owner/repo 123"));
|
|
493
|
+
console.error(pc3.red("Invalid issue format. Use:"));
|
|
494
|
+
console.error(" - Issue number: 123");
|
|
495
|
+
console.error(" - Full URL: https://github.com/owner/repo/issues/123");
|
|
496
|
+
console.error(" - Short form: owner/repo#123");
|
|
643
497
|
process.exit(1);
|
|
644
498
|
}
|
|
645
499
|
if (_options.repo) {
|
|
646
500
|
const parts = _options.repo.split("/");
|
|
647
|
-
|
|
648
|
-
|
|
501
|
+
const owner = parts[0] || "";
|
|
502
|
+
const repo = parts[1] || "";
|
|
503
|
+
parsed.owner = owner;
|
|
504
|
+
parsed.repo = repo;
|
|
649
505
|
}
|
|
650
506
|
let config = null;
|
|
651
507
|
try {
|
|
@@ -653,33 +509,37 @@ var init_run = __esm({
|
|
|
653
509
|
} catch {
|
|
654
510
|
}
|
|
655
511
|
if (config && config.apiKey && config.repos.length > 0) {
|
|
656
|
-
console.log(
|
|
512
|
+
console.log(pc3.blue("Connecting to Codowave API..."));
|
|
657
513
|
if (!parsed.owner || !parsed.repo) {
|
|
658
|
-
console.error(
|
|
514
|
+
console.error(pc3.red("Repository required. Use -r option or include in issue URL."));
|
|
659
515
|
process.exit(1);
|
|
660
516
|
}
|
|
661
517
|
const runId = await triggerRun(config, parsed);
|
|
662
|
-
console.log(
|
|
518
|
+
console.log(pc3.green(`\u2713 Run triggered: ${runId}`));
|
|
663
519
|
if (_options.stream) {
|
|
664
|
-
console.log(
|
|
520
|
+
console.log(pc3.blue("\nStreaming run progress..."));
|
|
665
521
|
} else {
|
|
666
|
-
console.log(
|
|
522
|
+
console.log(pc3.gray(`
|
|
667
523
|
Run started. Use \`codowave status ${runId}\` to check progress.`));
|
|
668
524
|
}
|
|
669
525
|
} else {
|
|
670
|
-
console.log(
|
|
526
|
+
console.log(pc3.yellow("\u26A0 No config found. Running in demo mode.\n"));
|
|
671
527
|
const run = createDemoRun(parsed);
|
|
672
528
|
if (_options.stream || !process.stdout.isTTY) {
|
|
673
529
|
streamDemoRun(run);
|
|
674
530
|
} else {
|
|
675
|
-
console.log(
|
|
676
|
-
console.log(
|
|
531
|
+
console.log(pc3.green(`\u2713 Run started: ${run.id}`));
|
|
532
|
+
console.log(pc3.gray(`
|
|
677
533
|
Use \`codowave status ${run.id}\` to check progress.`));
|
|
678
|
-
console.log(
|
|
534
|
+
console.log(pc3.gray(`Use \`codowave logs ${run.id} -f\` to follow logs.`));
|
|
679
535
|
}
|
|
680
536
|
}
|
|
681
537
|
} catch (err) {
|
|
682
|
-
|
|
538
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
539
|
+
console.error(pc3.red(`
|
|
540
|
+
\u2716 Error: ${message}
|
|
541
|
+
`));
|
|
542
|
+
process.exit(1);
|
|
683
543
|
}
|
|
684
544
|
});
|
|
685
545
|
}
|
|
@@ -692,7 +552,7 @@ __export(status_exports, {
|
|
|
692
552
|
statusCommand: () => statusCommand
|
|
693
553
|
});
|
|
694
554
|
import { Command as Command3 } from "commander";
|
|
695
|
-
import
|
|
555
|
+
import pc4 from "picocolors";
|
|
696
556
|
function initDemoData() {
|
|
697
557
|
if (demoRuns2.size === 0) {
|
|
698
558
|
const demoRun = {
|
|
@@ -744,33 +604,33 @@ function getRun(runId) {
|
|
|
744
604
|
function formatStatus(status) {
|
|
745
605
|
switch (status) {
|
|
746
606
|
case "pending":
|
|
747
|
-
return
|
|
607
|
+
return pc4.gray("pending");
|
|
748
608
|
case "in_progress":
|
|
749
|
-
return
|
|
609
|
+
return pc4.blue("in_progress");
|
|
750
610
|
case "completed":
|
|
751
|
-
return
|
|
611
|
+
return pc4.green("completed");
|
|
752
612
|
case "failed":
|
|
753
|
-
return
|
|
613
|
+
return pc4.red("failed");
|
|
754
614
|
case "cancelled":
|
|
755
|
-
return
|
|
615
|
+
return pc4.gray("cancelled");
|
|
756
616
|
default:
|
|
757
|
-
return
|
|
617
|
+
return pc4.gray(status);
|
|
758
618
|
}
|
|
759
619
|
}
|
|
760
620
|
function formatStageStatus(status) {
|
|
761
621
|
switch (status) {
|
|
762
622
|
case "pending":
|
|
763
|
-
return
|
|
623
|
+
return pc4.gray("[ ]");
|
|
764
624
|
case "running":
|
|
765
|
-
return
|
|
625
|
+
return pc4.blue("[~]");
|
|
766
626
|
case "completed":
|
|
767
|
-
return
|
|
627
|
+
return pc4.green("[+]");
|
|
768
628
|
case "failed":
|
|
769
|
-
return
|
|
629
|
+
return pc4.red("[x]");
|
|
770
630
|
case "skipped":
|
|
771
|
-
return
|
|
631
|
+
return pc4.gray("[-]");
|
|
772
632
|
default:
|
|
773
|
-
return
|
|
633
|
+
return pc4.gray("[?]");
|
|
774
634
|
}
|
|
775
635
|
}
|
|
776
636
|
function formatDuration(startedAt, completedAt) {
|
|
@@ -790,48 +650,55 @@ var demoRuns2, statusCommand;
|
|
|
790
650
|
var init_status = __esm({
|
|
791
651
|
"src/commands/status.ts"() {
|
|
792
652
|
"use strict";
|
|
793
|
-
|
|
653
|
+
init_config();
|
|
794
654
|
demoRuns2 = /* @__PURE__ */ new Map();
|
|
795
655
|
statusCommand = new Command3("status").description("Show the status of a Codowave run").argument("[run-id]", "Run ID (defaults to latest)").option("-r, --repo <owner/repo>", "Filter by repository").action(async (_runId, _options) => {
|
|
796
656
|
try {
|
|
657
|
+
let config;
|
|
658
|
+
try {
|
|
659
|
+
config = readConfig();
|
|
660
|
+
} catch {
|
|
661
|
+
}
|
|
797
662
|
const run = getRun(_runId);
|
|
798
663
|
if (!run) {
|
|
799
|
-
console.log(
|
|
664
|
+
console.log(pc4.yellow("No runs found. Run `codowave run <issue>` to start a new run."));
|
|
800
665
|
return;
|
|
801
666
|
}
|
|
802
667
|
if (_options?.repo && run.repo !== _options.repo) {
|
|
803
|
-
console.log(
|
|
668
|
+
console.log(pc4.yellow("No run found for repository " + _options.repo));
|
|
804
669
|
return;
|
|
805
670
|
}
|
|
806
|
-
console.log(
|
|
807
|
-
console.log(
|
|
808
|
-
console.log(
|
|
809
|
-
console.log(
|
|
810
|
-
console.log(
|
|
811
|
-
console.log(
|
|
671
|
+
console.log(pc4.bold("\n=== Run Status ===\n"));
|
|
672
|
+
console.log(pc4.bold("ID: ") + run.id);
|
|
673
|
+
console.log(pc4.bold("Repo: ") + run.repo);
|
|
674
|
+
console.log(pc4.bold("Issue: ") + run.issue);
|
|
675
|
+
console.log(pc4.bold("Status: ") + formatStatus(run.status));
|
|
676
|
+
console.log(pc4.bold("Branch: ") + (run.branchName || pc4.gray("(none)")));
|
|
812
677
|
if (run.prNumber) {
|
|
813
|
-
console.log(
|
|
678
|
+
console.log(pc4.bold("PR: ") + "#" + run.prNumber + " - " + (run.prTitle || ""));
|
|
814
679
|
}
|
|
815
680
|
if (run.startedAt) {
|
|
816
|
-
console.log(
|
|
681
|
+
console.log(pc4.bold("Started: ") + new Date(run.startedAt).toLocaleString());
|
|
817
682
|
}
|
|
818
683
|
if (run.completedAt) {
|
|
819
|
-
console.log(
|
|
684
|
+
console.log(pc4.bold("Duration: ") + formatDuration(run.startedAt, run.completedAt));
|
|
820
685
|
} else if (run.startedAt) {
|
|
821
|
-
console.log(
|
|
686
|
+
console.log(pc4.bold("Duration: ") + pc4.blue("running... ") + formatDuration(run.startedAt));
|
|
822
687
|
}
|
|
823
688
|
if (run.errorMessage) {
|
|
824
|
-
console.log(
|
|
689
|
+
console.log(pc4.bold("Error: ") + pc4.red(run.errorMessage));
|
|
825
690
|
}
|
|
826
|
-
console.log(
|
|
691
|
+
console.log(pc4.bold("\n=== Stages ===\n"));
|
|
827
692
|
for (const stage of run.stages) {
|
|
828
693
|
const statusIcon = formatStageStatus(stage.status);
|
|
829
|
-
const statusText =
|
|
830
|
-
console.log(" " + statusIcon + " " +
|
|
694
|
+
const statusText = pc4.bold("[" + stage.status + "]");
|
|
695
|
+
console.log(" " + statusIcon + " " + pc4.bold(stage.name.padEnd(20)) + " " + statusText);
|
|
831
696
|
}
|
|
832
697
|
console.log("");
|
|
833
698
|
} catch (err) {
|
|
834
|
-
|
|
699
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
700
|
+
console.error(pc4.red("\n=== Error: " + message + " ===\n"));
|
|
701
|
+
process.exit(1);
|
|
835
702
|
}
|
|
836
703
|
});
|
|
837
704
|
}
|
|
@@ -843,76 +710,83 @@ __export(logs_exports, {
|
|
|
843
710
|
logsCommand: () => logsCommand
|
|
844
711
|
});
|
|
845
712
|
import { Command as Command4 } from "commander";
|
|
846
|
-
import
|
|
713
|
+
import pc5 from "picocolors";
|
|
847
714
|
var logsCommand;
|
|
848
715
|
var init_logs = __esm({
|
|
849
716
|
"src/commands/logs.ts"() {
|
|
850
717
|
"use strict";
|
|
718
|
+
init_config();
|
|
851
719
|
init_status();
|
|
852
|
-
init_error();
|
|
853
720
|
logsCommand = new Command4("logs").description("Stream logs for a Codowave run").argument("[run-id]", "Run ID (defaults to latest)").option("-f, --follow", "Follow log output (SSE stream)").option("-s, --stage <name>", "Show logs for a specific stage").option("--no-color", "Disable colored output").action(async (_runId, _options) => {
|
|
854
721
|
try {
|
|
722
|
+
let config;
|
|
723
|
+
try {
|
|
724
|
+
config = readConfig();
|
|
725
|
+
} catch {
|
|
726
|
+
}
|
|
855
727
|
const run = getRun(_runId);
|
|
856
728
|
if (!run) {
|
|
857
|
-
console.log(
|
|
729
|
+
console.log(pc5.yellow("No runs found. Run `codowave run <issue>` to start a new run."));
|
|
858
730
|
return;
|
|
859
731
|
}
|
|
860
732
|
if (_options?.stage) {
|
|
861
733
|
const stage = run.stages.find((s) => s.name === _options.stage);
|
|
862
734
|
if (!stage) {
|
|
863
|
-
console.log(
|
|
864
|
-
console.log(
|
|
735
|
+
console.log(pc5.red('Stage "' + _options.stage + '" not found.'));
|
|
736
|
+
console.log(pc5.gray("Available stages: ") + run.stages.map((s) => s.name).join(", "));
|
|
865
737
|
return;
|
|
866
738
|
}
|
|
867
|
-
console.log(
|
|
868
|
-
console.log(
|
|
739
|
+
console.log(pc5.bold("\n=== Logs: " + stage.name + " ===\n"));
|
|
740
|
+
console.log(pc5.bold("Status: ") + stage.status);
|
|
869
741
|
if (stage.logs) {
|
|
870
|
-
console.log(
|
|
742
|
+
console.log(pc5.gray("\n--- Output ---\n"));
|
|
871
743
|
console.log(stage.logs);
|
|
872
744
|
} else {
|
|
873
|
-
console.log(
|
|
745
|
+
console.log(pc5.gray("\n(no logs available yet)"));
|
|
874
746
|
}
|
|
875
747
|
if (_options.follow && stage.status === "running") {
|
|
876
|
-
console.log(
|
|
877
|
-
console.log(
|
|
748
|
+
console.log(pc5.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
749
|
+
console.log(pc5.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
878
750
|
}
|
|
879
751
|
console.log("");
|
|
880
752
|
return;
|
|
881
753
|
}
|
|
882
|
-
console.log(
|
|
883
|
-
console.log(
|
|
884
|
-
console.log(
|
|
754
|
+
console.log(pc5.bold("\n=== Logs: " + run.id + " ===\n"));
|
|
755
|
+
console.log(pc5.bold("Issue: ") + run.issue);
|
|
756
|
+
console.log(pc5.bold("Status: ") + run.status);
|
|
885
757
|
console.log("");
|
|
886
758
|
for (const stage of run.stages) {
|
|
887
759
|
const statusIcon = stage.status === "completed" ? "[+]" : stage.status === "failed" ? "[x]" : stage.status === "running" ? "[~]" : "[ ]";
|
|
888
|
-
console.log(
|
|
760
|
+
console.log(pc5.bold("\n" + statusIcon + " " + stage.name + "\n"));
|
|
889
761
|
if (stage.logs) {
|
|
890
762
|
console.log(stage.logs);
|
|
891
763
|
} else if (stage.status === "pending") {
|
|
892
|
-
console.log(
|
|
764
|
+
console.log(pc5.gray("(pending)"));
|
|
893
765
|
} else if (stage.status === "running") {
|
|
894
|
-
console.log(
|
|
766
|
+
console.log(pc5.blue("(running...)"));
|
|
895
767
|
} else if (stage.status === "skipped") {
|
|
896
|
-
console.log(
|
|
768
|
+
console.log(pc5.gray("(skipped)"));
|
|
897
769
|
}
|
|
898
770
|
}
|
|
899
771
|
if (_options?.follow && run.status === "in_progress") {
|
|
900
|
-
console.log(
|
|
901
|
-
console.log(
|
|
772
|
+
console.log(pc5.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
773
|
+
console.log(pc5.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
902
774
|
let dots = 0;
|
|
903
775
|
const interval = setInterval(() => {
|
|
904
776
|
dots = (dots + 1) % 4;
|
|
905
|
-
process.stdout.write(
|
|
777
|
+
process.stdout.write(pc5.blue("\r" + " ".repeat(dots) + " waiting for updates..."));
|
|
906
778
|
}, 500);
|
|
907
779
|
process.on("SIGINT", () => {
|
|
908
780
|
clearInterval(interval);
|
|
909
|
-
console.log(
|
|
781
|
+
console.log(pc5.gray("\n\n(Stopped following)"));
|
|
910
782
|
process.exit(0);
|
|
911
783
|
});
|
|
912
784
|
}
|
|
913
785
|
console.log("");
|
|
914
786
|
} catch (err) {
|
|
915
|
-
|
|
787
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
788
|
+
console.error(pc5.red("\n=== Error: " + message + " ===\n"));
|
|
789
|
+
process.exit(1);
|
|
916
790
|
}
|
|
917
791
|
});
|
|
918
792
|
}
|
|
@@ -924,7 +798,7 @@ __export(config_cmd_exports, {
|
|
|
924
798
|
configCommand: () => configCommand
|
|
925
799
|
});
|
|
926
800
|
import { Command as Command5 } from "commander";
|
|
927
|
-
import
|
|
801
|
+
import pc6 from "picocolors";
|
|
928
802
|
var configCommand;
|
|
929
803
|
var init_config_cmd = __esm({
|
|
930
804
|
"src/commands/config-cmd.ts"() {
|
|
@@ -932,29 +806,29 @@ var init_config_cmd = __esm({
|
|
|
932
806
|
init_config();
|
|
933
807
|
configCommand = new Command5("config").description("Get or set Codowave configuration values");
|
|
934
808
|
configCommand.command("list").description("List all available config options").action(() => {
|
|
935
|
-
console.log(
|
|
936
|
-
console.log(` ${
|
|
937
|
-
console.log(` ${
|
|
938
|
-
console.log(` ${
|
|
939
|
-
console.log(` ${
|
|
809
|
+
console.log(pc6.bold("\n\u{1F4CB} Available Config Options:\n"));
|
|
810
|
+
console.log(` ${pc6.cyan("apiKey")} ${pc6.gray("\u2014 Your Codowave API key")}`);
|
|
811
|
+
console.log(` ${pc6.cyan("apiUrl")} ${pc6.gray("\u2014 API endpoint URL (default: https://api.codowave.com)")}`);
|
|
812
|
+
console.log(` ${pc6.cyan("repos")} ${pc6.gray("\u2014 List of configured repositories")}`);
|
|
813
|
+
console.log(` ${pc6.cyan("configPath")} ${pc6.gray("\u2014 Path to the config file")}`);
|
|
940
814
|
console.log("");
|
|
941
815
|
});
|
|
942
816
|
configCommand.command("get <key>").description("Get a config value").action((key) => {
|
|
943
817
|
try {
|
|
944
818
|
const config = readConfigOrThrow();
|
|
945
819
|
if (key === "configPath") {
|
|
946
|
-
console.log(
|
|
820
|
+
console.log(pc6.green(getConfigPath()));
|
|
947
821
|
return;
|
|
948
822
|
}
|
|
949
823
|
if (key === "repos") {
|
|
950
824
|
if (config.repos.length === 0) {
|
|
951
|
-
console.log(
|
|
825
|
+
console.log(pc6.yellow("No repos configured."));
|
|
952
826
|
} else {
|
|
953
|
-
console.log(
|
|
827
|
+
console.log(pc6.bold("\n\u{1F4E6} Configured Repositories:\n"));
|
|
954
828
|
config.repos.forEach((repo, index) => {
|
|
955
|
-
console.log(` ${index + 1}. ${
|
|
829
|
+
console.log(` ${index + 1}. ${pc6.cyan(`${repo.owner}/${repo.name}`)}`);
|
|
956
830
|
if (repo.id) {
|
|
957
|
-
console.log(` ${
|
|
831
|
+
console.log(` ${pc6.gray("ID: " + repo.id)}`);
|
|
958
832
|
}
|
|
959
833
|
});
|
|
960
834
|
console.log("");
|
|
@@ -963,13 +837,13 @@ var init_config_cmd = __esm({
|
|
|
963
837
|
}
|
|
964
838
|
const value = config[key];
|
|
965
839
|
if (value === void 0) {
|
|
966
|
-
console.error(
|
|
967
|
-
console.log(
|
|
840
|
+
console.error(pc6.red(`\u2716 Unknown config key: ${key}`));
|
|
841
|
+
console.log(pc6.gray(` Run \`codowave config list\` to see available options.`));
|
|
968
842
|
process.exit(1);
|
|
969
843
|
}
|
|
970
844
|
console.log(value);
|
|
971
845
|
} catch (err) {
|
|
972
|
-
console.error(
|
|
846
|
+
console.error(pc6.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
973
847
|
process.exit(1);
|
|
974
848
|
}
|
|
975
849
|
});
|
|
@@ -977,45 +851,45 @@ var init_config_cmd = __esm({
|
|
|
977
851
|
try {
|
|
978
852
|
const validKeys = ["apiKey", "apiUrl"];
|
|
979
853
|
if (!validKeys.includes(key)) {
|
|
980
|
-
console.error(
|
|
981
|
-
console.log(
|
|
982
|
-
console.log(
|
|
854
|
+
console.error(pc6.red(`\u2716 Cannot set '${key}' directly.`));
|
|
855
|
+
console.log(pc6.gray(` For 'repos', use \`codowave init\` to manage repositories.`));
|
|
856
|
+
console.log(pc6.gray(` Run \`codowave config list\` to see available options.`));
|
|
983
857
|
process.exit(1);
|
|
984
858
|
}
|
|
985
859
|
if (key === "apiUrl") {
|
|
986
860
|
try {
|
|
987
861
|
new URL(value);
|
|
988
862
|
} catch {
|
|
989
|
-
console.error(
|
|
863
|
+
console.error(pc6.red(`\u2716 Invalid URL: ${value}`));
|
|
990
864
|
process.exit(1);
|
|
991
865
|
}
|
|
992
866
|
}
|
|
993
867
|
const updates = { [key]: value };
|
|
994
868
|
const newConfig = updateConfig(updates);
|
|
995
|
-
console.log(
|
|
996
|
-
console.log(
|
|
869
|
+
console.log(pc6.green(`\u2713 Updated ${key}`));
|
|
870
|
+
console.log(pc6.gray(` ${key} = ${newConfig[key]}`));
|
|
997
871
|
} catch (err) {
|
|
998
|
-
console.error(
|
|
872
|
+
console.error(pc6.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
999
873
|
process.exit(1);
|
|
1000
874
|
}
|
|
1001
875
|
});
|
|
1002
876
|
configCommand.command("show").description("Show all current config values").action(() => {
|
|
1003
877
|
try {
|
|
1004
878
|
const config = readConfigOrThrow();
|
|
1005
|
-
console.log(
|
|
1006
|
-
console.log(` ${
|
|
1007
|
-
console.log(` ${
|
|
1008
|
-
console.log(` ${
|
|
1009
|
-
console.log(` ${
|
|
879
|
+
console.log(pc6.bold("\n\u2699\uFE0F Current Configuration:\n"));
|
|
880
|
+
console.log(` ${pc6.cyan("apiKey")}: ${config.apiKey ? pc6.green("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") + pc6.gray(" (hidden)") : pc6.yellow("not set")}`);
|
|
881
|
+
console.log(` ${pc6.cyan("apiUrl")}: ${config.apiUrl}`);
|
|
882
|
+
console.log(` ${pc6.cyan("repos")}: ${config.repos.length} repository(s) configured`);
|
|
883
|
+
console.log(` ${pc6.cyan("configPath")}: ${pc6.gray(getConfigPath())}`);
|
|
1010
884
|
if (config.repos.length > 0) {
|
|
1011
|
-
console.log(
|
|
885
|
+
console.log(pc6.bold(pc6.gray("\n Repositories:")));
|
|
1012
886
|
config.repos.forEach((repo) => {
|
|
1013
|
-
console.log(` \u2022 ${repo.owner}/${repo.name}${repo.id ?
|
|
887
|
+
console.log(` \u2022 ${repo.owner}/${repo.name}${repo.id ? pc6.gray(` (${repo.id})`) : ""}`);
|
|
1014
888
|
});
|
|
1015
889
|
}
|
|
1016
890
|
console.log("");
|
|
1017
891
|
} catch (err) {
|
|
1018
|
-
console.error(
|
|
892
|
+
console.error(pc6.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
1019
893
|
process.exit(1);
|
|
1020
894
|
}
|
|
1021
895
|
});
|
|
@@ -1032,14 +906,14 @@ __export(connect_exports, {
|
|
|
1032
906
|
performConnect: () => performConnect
|
|
1033
907
|
});
|
|
1034
908
|
import { Command as Command6 } from "commander";
|
|
1035
|
-
import
|
|
909
|
+
import pc7 from "picocolors";
|
|
1036
910
|
async function performConnect(accessToken) {
|
|
1037
911
|
const config = updateConfig({
|
|
1038
912
|
apiKey: accessToken,
|
|
1039
913
|
apiUrl: PRO_API_URL
|
|
1040
914
|
});
|
|
1041
|
-
console.log(
|
|
1042
|
-
console.log(
|
|
915
|
+
console.log(pc7.green("\u2713 Connected to Codowave Pro!"));
|
|
916
|
+
console.log(pc7.gray(` API URL: ${config.apiUrl}`));
|
|
1043
917
|
}
|
|
1044
918
|
var PRO_API_URL, connectCommand;
|
|
1045
919
|
var init_connect = __esm({
|
|
@@ -1049,35 +923,35 @@ var init_connect = __esm({
|
|
|
1049
923
|
PRO_API_URL = "https://api.codowave.com";
|
|
1050
924
|
connectCommand = new Command6("connect").description("Connect to Codowave Pro (upgrade from OSS)").action(async () => {
|
|
1051
925
|
try {
|
|
1052
|
-
console.log(
|
|
1053
|
-
console.log(
|
|
926
|
+
console.log(pc7.bold("\n\u{1F517} Codowave Connect\n"));
|
|
927
|
+
console.log(pc7.gray("This command upgrades your OSS installation to Codowave Pro.\n"));
|
|
1054
928
|
const config = readConfig();
|
|
1055
929
|
const isAlreadyPro = config?.apiUrl === PRO_API_URL;
|
|
1056
930
|
if (isAlreadyPro) {
|
|
1057
|
-
console.log(
|
|
1058
|
-
console.log(
|
|
931
|
+
console.log(pc7.green("\u2713 You are already connected to Codowave Pro!"));
|
|
932
|
+
console.log(pc7.gray(` API URL: ${config?.apiUrl}`));
|
|
1059
933
|
console.log("");
|
|
1060
934
|
return;
|
|
1061
935
|
}
|
|
1062
|
-
console.log(
|
|
1063
|
-
console.log(
|
|
936
|
+
console.log(pc7.blue("Starting OAuth device flow...\n"));
|
|
937
|
+
console.log(pc7.gray(" 1. Requesting device code..."));
|
|
1064
938
|
const deviceCode = `CODOWAVE-${Date.now().toString(36).toUpperCase()}`;
|
|
1065
939
|
const verificationUri = "https://codowave.com/activate";
|
|
1066
|
-
console.log(
|
|
1067
|
-
console.log(
|
|
1068
|
-
console.log(
|
|
1069
|
-
console.log(
|
|
1070
|
-
console.log(
|
|
1071
|
-
console.log(
|
|
1072
|
-
console.log(
|
|
940
|
+
console.log(pc7.green("\n \u26A0\uFE0F Device Code: ") + pc7.bold(deviceCode));
|
|
941
|
+
console.log(pc7.gray("\n 2. Please visit: ") + pc7.cyan(verificationUri));
|
|
942
|
+
console.log(pc7.gray(" and enter the device code above.\n"));
|
|
943
|
+
console.log(pc7.yellow(" \u2139\uFE0F This is a stub implementation."));
|
|
944
|
+
console.log(pc7.gray(" In production, this would poll for OAuth completion.\n"));
|
|
945
|
+
console.log(pc7.blue(" 3. Would save Pro token and switch API URL...\n"));
|
|
946
|
+
console.log(pc7.bold("What would happen:\n"));
|
|
1073
947
|
console.log(` \u2022 Save Pro API token to ${getConfigPath()}`);
|
|
1074
948
|
console.log(` \u2022 Set apiUrl to ${PRO_API_URL}`);
|
|
1075
949
|
console.log("");
|
|
1076
|
-
console.log(
|
|
950
|
+
console.log(pc7.gray("Run with ") + pc7.cyan("CODOWAVE_CONNECT=1") + pc7.gray(" to enable (not implemented yet)"));
|
|
1077
951
|
console.log("");
|
|
1078
952
|
} catch (err) {
|
|
1079
953
|
const message = err instanceof Error ? err.message : String(err);
|
|
1080
|
-
console.error(
|
|
954
|
+
console.error(pc7.red(`
|
|
1081
955
|
\u2716 Error: ${message}
|
|
1082
956
|
`));
|
|
1083
957
|
process.exit(1);
|
|
@@ -1089,35 +963,7 @@ var init_connect = __esm({
|
|
|
1089
963
|
// src/index.ts
|
|
1090
964
|
init_config();
|
|
1091
965
|
import { Command as Command7 } from "commander";
|
|
1092
|
-
import
|
|
1093
|
-
|
|
1094
|
-
// src/utils/global-error.ts
|
|
1095
|
-
init_error();
|
|
1096
|
-
import process2 from "process";
|
|
1097
|
-
import pc2 from "picocolors";
|
|
1098
|
-
function setupGlobalErrorHandlers() {
|
|
1099
|
-
process2.on("uncaughtException", (err) => {
|
|
1100
|
-
console.error(pc2.red("\n\u{1F4A5} Unexpected Error"));
|
|
1101
|
-
console.error(pc2.gray(err.stack || ""));
|
|
1102
|
-
handleError(err, "uncaughtException");
|
|
1103
|
-
});
|
|
1104
|
-
process2.on("unhandledRejection", (reason, _promise) => {
|
|
1105
|
-
const message = reason instanceof Error ? reason.message : String(reason);
|
|
1106
|
-
const stack = reason instanceof Error ? reason.stack : void 0;
|
|
1107
|
-
console.error(pc2.red("\n\u{1F4A5} Unhandled Promise Rejection"));
|
|
1108
|
-
if (stack) {
|
|
1109
|
-
console.error(pc2.gray(stack));
|
|
1110
|
-
} else {
|
|
1111
|
-
console.error(pc2.gray(`Reason: ${message}`));
|
|
1112
|
-
}
|
|
1113
|
-
console.error(pc2.yellow("\nWarning: Unhandled promise rejections can cause instability."));
|
|
1114
|
-
console.error(pc2.gray("Please report this issue: https://github.com/CodowaveAI/Codowave/issues"));
|
|
1115
|
-
process2.exit(1);
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// src/index.ts
|
|
1120
|
-
setupGlobalErrorHandlers();
|
|
966
|
+
import pc8 from "picocolors";
|
|
1121
967
|
var { initCommand: initCommand2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
1122
968
|
var { runCommand: runCommand2 } = await Promise.resolve().then(() => (init_run(), run_exports));
|
|
1123
969
|
var { statusCommand: statusCommand2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
@@ -1127,14 +973,14 @@ var { connectCommand: connectCommand2 } = await Promise.resolve().then(() => (in
|
|
|
1127
973
|
var VERSION = "0.1.0";
|
|
1128
974
|
var program = new Command7();
|
|
1129
975
|
program.name("codowave").description(
|
|
1130
|
-
|
|
976
|
+
pc8.bold("Codowave") + " \u2014 AI-powered coding agent for your GitHub repositories"
|
|
1131
977
|
).version(VERSION, "-v, --version", "Output the current version").helpOption("-h, --help", "Display help").addHelpText(
|
|
1132
978
|
"beforeAll",
|
|
1133
979
|
`
|
|
1134
|
-
${
|
|
1135
|
-
${
|
|
1136
|
-
${
|
|
1137
|
-
${
|
|
980
|
+
${pc8.cyan(" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")}
|
|
981
|
+
${pc8.cyan(" \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D")}
|
|
982
|
+
${pc8.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 ")}
|
|
983
|
+
${pc8.cyan(" \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2554\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557")}
|
|
1138
984
|
`
|
|
1139
985
|
).option("--api-url <url>", "Override the Codowave API URL");
|
|
1140
986
|
program.addCommand(initCommand2);
|
|
@@ -1144,7 +990,7 @@ program.addCommand(logsCommand2);
|
|
|
1144
990
|
program.addCommand(configCommand2);
|
|
1145
991
|
program.addCommand(connectCommand2);
|
|
1146
992
|
program.configureOutput({
|
|
1147
|
-
writeErr: (str) => process.stderr.write(
|
|
993
|
+
writeErr: (str) => process.stderr.write(pc8.red(str))
|
|
1148
994
|
});
|
|
1149
995
|
var args = process.argv.slice(2);
|
|
1150
996
|
var isInitOrHelp = args[0] === "init" || args.includes("--help") || args.includes("-h") || args.includes("--version") || args.includes("-v") || args.length === 0;
|
|
@@ -1152,15 +998,16 @@ if (!isInitOrHelp) {
|
|
|
1152
998
|
const config = readConfig();
|
|
1153
999
|
if (!config) {
|
|
1154
1000
|
console.warn(
|
|
1155
|
-
|
|
1156
|
-
"\u26A0 No config found. Run " +
|
|
1001
|
+
pc8.yellow(
|
|
1002
|
+
"\u26A0 No config found. Run " + pc8.bold("codowave init") + " to get started.\n"
|
|
1157
1003
|
)
|
|
1158
1004
|
);
|
|
1159
1005
|
}
|
|
1160
1006
|
}
|
|
1161
1007
|
program.parseAsync(process.argv).catch((err) => {
|
|
1162
|
-
console.error(
|
|
1008
|
+
console.error(pc8.red(`
|
|
1163
1009
|
\u2716 Error: ${err instanceof Error ? err.message : String(err)}
|
|
1164
1010
|
`));
|
|
1165
1011
|
process.exit(1);
|
|
1166
1012
|
});
|
|
1013
|
+
//# sourceMappingURL=index.js.map
|