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