codowave 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{index.mjs → dist/index.js} +782 -1111
- package/package.json +4 -6
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
1
3
|
var __create = Object.create;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
9
|
var __esm = (fn, res) => function __init() {
|
|
14
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
11
|
};
|
|
16
|
-
var __commonJS = (cb, mod) => function
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
17
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
14
|
};
|
|
19
15
|
var __export = (target, all) => {
|
|
@@ -39,7 +35,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
35
|
|
|
40
36
|
// node_modules/commander/lib/error.js
|
|
41
37
|
var require_error = __commonJS({
|
|
42
|
-
"node_modules/commander/lib/error.js"(
|
|
38
|
+
"node_modules/commander/lib/error.js"(exports2) {
|
|
43
39
|
var CommanderError2 = class extends Error {
|
|
44
40
|
/**
|
|
45
41
|
* Constructs the CommanderError class
|
|
@@ -67,14 +63,14 @@ var require_error = __commonJS({
|
|
|
67
63
|
this.name = this.constructor.name;
|
|
68
64
|
}
|
|
69
65
|
};
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
exports2.CommanderError = CommanderError2;
|
|
67
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
72
68
|
}
|
|
73
69
|
});
|
|
74
70
|
|
|
75
71
|
// node_modules/commander/lib/argument.js
|
|
76
72
|
var require_argument = __commonJS({
|
|
77
|
-
"node_modules/commander/lib/argument.js"(
|
|
73
|
+
"node_modules/commander/lib/argument.js"(exports2) {
|
|
78
74
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
79
75
|
var Argument2 = class {
|
|
80
76
|
/**
|
|
@@ -194,14 +190,14 @@ var require_argument = __commonJS({
|
|
|
194
190
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
195
191
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
196
192
|
}
|
|
197
|
-
|
|
198
|
-
|
|
193
|
+
exports2.Argument = Argument2;
|
|
194
|
+
exports2.humanReadableArgName = humanReadableArgName;
|
|
199
195
|
}
|
|
200
196
|
});
|
|
201
197
|
|
|
202
198
|
// node_modules/commander/lib/help.js
|
|
203
199
|
var require_help = __commonJS({
|
|
204
|
-
"node_modules/commander/lib/help.js"(
|
|
200
|
+
"node_modules/commander/lib/help.js"(exports2) {
|
|
205
201
|
var { humanReadableArgName } = require_argument();
|
|
206
202
|
var Help2 = class {
|
|
207
203
|
constructor() {
|
|
@@ -237,8 +233,8 @@ var require_help = __commonJS({
|
|
|
237
233
|
* @returns {number}
|
|
238
234
|
*/
|
|
239
235
|
compareOptions(a, b) {
|
|
240
|
-
const getSortKey = (
|
|
241
|
-
return
|
|
236
|
+
const getSortKey = (option2) => {
|
|
237
|
+
return option2.short ? option2.short.replace(/^-/, "") : option2.long.replace(/^--/, "");
|
|
242
238
|
};
|
|
243
239
|
return getSortKey(a).localeCompare(getSortKey(b));
|
|
244
240
|
}
|
|
@@ -249,7 +245,7 @@ var require_help = __commonJS({
|
|
|
249
245
|
* @returns {Option[]}
|
|
250
246
|
*/
|
|
251
247
|
visibleOptions(cmd) {
|
|
252
|
-
const visibleOptions = cmd.options.filter((
|
|
248
|
+
const visibleOptions = cmd.options.filter((option2) => !option2.hidden);
|
|
253
249
|
const helpOption = cmd._getHelpOption();
|
|
254
250
|
if (helpOption && !helpOption.hidden) {
|
|
255
251
|
const removeShort = helpOption.short && cmd._findOption(helpOption.short);
|
|
@@ -282,7 +278,7 @@ var require_help = __commonJS({
|
|
|
282
278
|
const globalOptions = [];
|
|
283
279
|
for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
|
|
284
280
|
const visibleOptions = ancestorCmd.options.filter(
|
|
285
|
-
(
|
|
281
|
+
(option2) => !option2.hidden
|
|
286
282
|
);
|
|
287
283
|
globalOptions.push(...visibleOptions);
|
|
288
284
|
}
|
|
@@ -325,8 +321,8 @@ var require_help = __commonJS({
|
|
|
325
321
|
* @param {Option} option
|
|
326
322
|
* @returns {string}
|
|
327
323
|
*/
|
|
328
|
-
optionTerm(
|
|
329
|
-
return
|
|
324
|
+
optionTerm(option2) {
|
|
325
|
+
return option2.flags;
|
|
330
326
|
}
|
|
331
327
|
/**
|
|
332
328
|
* Get the argument term to show in the list of arguments.
|
|
@@ -357,8 +353,8 @@ var require_help = __commonJS({
|
|
|
357
353
|
* @returns {number}
|
|
358
354
|
*/
|
|
359
355
|
longestOptionTermLength(cmd, helper) {
|
|
360
|
-
return helper.visibleOptions(cmd).reduce((max,
|
|
361
|
-
return Math.max(max, helper.optionTerm(
|
|
356
|
+
return helper.visibleOptions(cmd).reduce((max, option2) => {
|
|
357
|
+
return Math.max(max, helper.optionTerm(option2).length);
|
|
362
358
|
}, 0);
|
|
363
359
|
}
|
|
364
360
|
/**
|
|
@@ -369,8 +365,8 @@ var require_help = __commonJS({
|
|
|
369
365
|
* @returns {number}
|
|
370
366
|
*/
|
|
371
367
|
longestGlobalOptionTermLength(cmd, helper) {
|
|
372
|
-
return helper.visibleGlobalOptions(cmd).reduce((max,
|
|
373
|
-
return Math.max(max, helper.optionTerm(
|
|
368
|
+
return helper.visibleGlobalOptions(cmd).reduce((max, option2) => {
|
|
369
|
+
return Math.max(max, helper.optionTerm(option2).length);
|
|
374
370
|
}, 0);
|
|
375
371
|
}
|
|
376
372
|
/**
|
|
@@ -427,32 +423,32 @@ var require_help = __commonJS({
|
|
|
427
423
|
* @param {Option} option
|
|
428
424
|
* @return {string}
|
|
429
425
|
*/
|
|
430
|
-
optionDescription(
|
|
426
|
+
optionDescription(option2) {
|
|
431
427
|
const extraInfo = [];
|
|
432
|
-
if (
|
|
428
|
+
if (option2.argChoices) {
|
|
433
429
|
extraInfo.push(
|
|
434
430
|
// use stringify to match the display of the default value
|
|
435
|
-
`choices: ${
|
|
431
|
+
`choices: ${option2.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`
|
|
436
432
|
);
|
|
437
433
|
}
|
|
438
|
-
if (
|
|
439
|
-
const showDefault =
|
|
434
|
+
if (option2.defaultValue !== void 0) {
|
|
435
|
+
const showDefault = option2.required || option2.optional || option2.isBoolean() && typeof option2.defaultValue === "boolean";
|
|
440
436
|
if (showDefault) {
|
|
441
437
|
extraInfo.push(
|
|
442
|
-
`default: ${
|
|
438
|
+
`default: ${option2.defaultValueDescription || JSON.stringify(option2.defaultValue)}`
|
|
443
439
|
);
|
|
444
440
|
}
|
|
445
441
|
}
|
|
446
|
-
if (
|
|
447
|
-
extraInfo.push(`preset: ${JSON.stringify(
|
|
442
|
+
if (option2.presetArg !== void 0 && option2.optional) {
|
|
443
|
+
extraInfo.push(`preset: ${JSON.stringify(option2.presetArg)}`);
|
|
448
444
|
}
|
|
449
|
-
if (
|
|
450
|
-
extraInfo.push(`env: ${
|
|
445
|
+
if (option2.envVar !== void 0) {
|
|
446
|
+
extraInfo.push(`env: ${option2.envVar}`);
|
|
451
447
|
}
|
|
452
448
|
if (extraInfo.length > 0) {
|
|
453
|
-
return `${
|
|
449
|
+
return `${option2.description} (${extraInfo.join(", ")})`;
|
|
454
450
|
}
|
|
455
|
-
return
|
|
451
|
+
return option2.description;
|
|
456
452
|
}
|
|
457
453
|
/**
|
|
458
454
|
* Get the argument description to show in the list of arguments.
|
|
@@ -525,20 +521,20 @@ var require_help = __commonJS({
|
|
|
525
521
|
if (argumentList.length > 0) {
|
|
526
522
|
output = output.concat(["Arguments:", formatList(argumentList), ""]);
|
|
527
523
|
}
|
|
528
|
-
const optionList = helper.visibleOptions(cmd).map((
|
|
524
|
+
const optionList = helper.visibleOptions(cmd).map((option2) => {
|
|
529
525
|
return formatItem(
|
|
530
|
-
helper.optionTerm(
|
|
531
|
-
helper.optionDescription(
|
|
526
|
+
helper.optionTerm(option2),
|
|
527
|
+
helper.optionDescription(option2)
|
|
532
528
|
);
|
|
533
529
|
});
|
|
534
530
|
if (optionList.length > 0) {
|
|
535
531
|
output = output.concat(["Options:", formatList(optionList), ""]);
|
|
536
532
|
}
|
|
537
533
|
if (this.showGlobalOptions) {
|
|
538
|
-
const globalOptionList = helper.visibleGlobalOptions(cmd).map((
|
|
534
|
+
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option2) => {
|
|
539
535
|
return formatItem(
|
|
540
|
-
helper.optionTerm(
|
|
541
|
-
helper.optionDescription(
|
|
536
|
+
helper.optionTerm(option2),
|
|
537
|
+
helper.optionDescription(option2)
|
|
542
538
|
);
|
|
543
539
|
});
|
|
544
540
|
if (globalOptionList.length > 0) {
|
|
@@ -609,13 +605,13 @@ var require_help = __commonJS({
|
|
|
609
605
|
}).join("\n");
|
|
610
606
|
}
|
|
611
607
|
};
|
|
612
|
-
|
|
608
|
+
exports2.Help = Help2;
|
|
613
609
|
}
|
|
614
610
|
});
|
|
615
611
|
|
|
616
612
|
// node_modules/commander/lib/option.js
|
|
617
613
|
var require_option = __commonJS({
|
|
618
|
-
"node_modules/commander/lib/option.js"(
|
|
614
|
+
"node_modules/commander/lib/option.js"(exports2) {
|
|
619
615
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
620
616
|
var Option2 = class {
|
|
621
617
|
/**
|
|
@@ -834,11 +830,11 @@ var require_option = __commonJS({
|
|
|
834
830
|
this.positiveOptions = /* @__PURE__ */ new Map();
|
|
835
831
|
this.negativeOptions = /* @__PURE__ */ new Map();
|
|
836
832
|
this.dualOptions = /* @__PURE__ */ new Set();
|
|
837
|
-
options.forEach((
|
|
838
|
-
if (
|
|
839
|
-
this.negativeOptions.set(
|
|
833
|
+
options.forEach((option2) => {
|
|
834
|
+
if (option2.negate) {
|
|
835
|
+
this.negativeOptions.set(option2.attributeName(), option2);
|
|
840
836
|
} else {
|
|
841
|
-
this.positiveOptions.set(
|
|
837
|
+
this.positiveOptions.set(option2.attributeName(), option2);
|
|
842
838
|
}
|
|
843
839
|
});
|
|
844
840
|
this.negativeOptions.forEach((value, key) => {
|
|
@@ -854,12 +850,12 @@ var require_option = __commonJS({
|
|
|
854
850
|
* @param {Option} option
|
|
855
851
|
* @returns {boolean}
|
|
856
852
|
*/
|
|
857
|
-
valueFromOption(value,
|
|
858
|
-
const optionKey =
|
|
853
|
+
valueFromOption(value, option2) {
|
|
854
|
+
const optionKey = option2.attributeName();
|
|
859
855
|
if (!this.dualOptions.has(optionKey)) return true;
|
|
860
856
|
const preset = this.negativeOptions.get(optionKey).presetArg;
|
|
861
857
|
const negativeValue = preset !== void 0 ? preset : false;
|
|
862
|
-
return
|
|
858
|
+
return option2.negate === (negativeValue === value);
|
|
863
859
|
}
|
|
864
860
|
};
|
|
865
861
|
function camelcase(str) {
|
|
@@ -880,14 +876,14 @@ var require_option = __commonJS({
|
|
|
880
876
|
}
|
|
881
877
|
return { shortFlag, longFlag };
|
|
882
878
|
}
|
|
883
|
-
|
|
884
|
-
|
|
879
|
+
exports2.Option = Option2;
|
|
880
|
+
exports2.DualOptions = DualOptions;
|
|
885
881
|
}
|
|
886
882
|
});
|
|
887
883
|
|
|
888
884
|
// node_modules/commander/lib/suggestSimilar.js
|
|
889
885
|
var require_suggestSimilar = __commonJS({
|
|
890
|
-
"node_modules/commander/lib/suggestSimilar.js"(
|
|
886
|
+
"node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
891
887
|
var maxDistance = 3;
|
|
892
888
|
function editDistance(a, b) {
|
|
893
889
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -961,18 +957,18 @@ var require_suggestSimilar = __commonJS({
|
|
|
961
957
|
}
|
|
962
958
|
return "";
|
|
963
959
|
}
|
|
964
|
-
|
|
960
|
+
exports2.suggestSimilar = suggestSimilar;
|
|
965
961
|
}
|
|
966
962
|
});
|
|
967
963
|
|
|
968
964
|
// node_modules/commander/lib/command.js
|
|
969
965
|
var require_command = __commonJS({
|
|
970
|
-
"node_modules/commander/lib/command.js"(
|
|
971
|
-
var EventEmitter =
|
|
972
|
-
var childProcess =
|
|
973
|
-
var path =
|
|
974
|
-
var fs =
|
|
975
|
-
var
|
|
966
|
+
"node_modules/commander/lib/command.js"(exports2) {
|
|
967
|
+
var EventEmitter = require("node:events").EventEmitter;
|
|
968
|
+
var childProcess = require("node:child_process");
|
|
969
|
+
var path = require("node:path");
|
|
970
|
+
var fs = require("node:fs");
|
|
971
|
+
var process2 = require("node:process");
|
|
976
972
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
977
973
|
var { CommanderError: CommanderError2 } = require_error();
|
|
978
974
|
var { Help: Help2 } = require_help();
|
|
@@ -1018,10 +1014,10 @@ var require_command = __commonJS({
|
|
|
1018
1014
|
this._showHelpAfterError = false;
|
|
1019
1015
|
this._showSuggestionAfterError = true;
|
|
1020
1016
|
this._outputConfiguration = {
|
|
1021
|
-
writeOut: (str) =>
|
|
1022
|
-
writeErr: (str) =>
|
|
1023
|
-
getOutHelpWidth: () =>
|
|
1024
|
-
getErrHelpWidth: () =>
|
|
1017
|
+
writeOut: (str) => process2.stdout.write(str),
|
|
1018
|
+
writeErr: (str) => process2.stderr.write(str),
|
|
1019
|
+
getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : void 0,
|
|
1020
|
+
getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : void 0,
|
|
1025
1021
|
outputError: (str, write) => write(str)
|
|
1026
1022
|
};
|
|
1027
1023
|
this._hidden = false;
|
|
@@ -1400,7 +1396,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1400
1396
|
if (this._exitCallback) {
|
|
1401
1397
|
this._exitCallback(new CommanderError2(exitCode, code, message));
|
|
1402
1398
|
}
|
|
1403
|
-
|
|
1399
|
+
process2.exit(exitCode);
|
|
1404
1400
|
}
|
|
1405
1401
|
/**
|
|
1406
1402
|
* Register callback `fn` for the command.
|
|
@@ -1471,14 +1467,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1471
1467
|
* @param {Option} option
|
|
1472
1468
|
* @private
|
|
1473
1469
|
*/
|
|
1474
|
-
_registerOption(
|
|
1475
|
-
const matchingOption =
|
|
1470
|
+
_registerOption(option2) {
|
|
1471
|
+
const matchingOption = option2.short && this._findOption(option2.short) || option2.long && this._findOption(option2.long);
|
|
1476
1472
|
if (matchingOption) {
|
|
1477
|
-
const matchingFlag =
|
|
1478
|
-
throw new Error(`Cannot add option '${
|
|
1473
|
+
const matchingFlag = option2.long && this._findOption(option2.long) ? option2.long : option2.short;
|
|
1474
|
+
throw new Error(`Cannot add option '${option2.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
|
|
1479
1475
|
- already used by option '${matchingOption.flags}'`);
|
|
1480
1476
|
}
|
|
1481
|
-
this.options.push(
|
|
1477
|
+
this.options.push(option2);
|
|
1482
1478
|
}
|
|
1483
1479
|
/**
|
|
1484
1480
|
* Check for command name and alias conflicts with existing commands.
|
|
@@ -1509,36 +1505,36 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1509
1505
|
* @param {Option} option
|
|
1510
1506
|
* @return {Command} `this` command for chaining
|
|
1511
1507
|
*/
|
|
1512
|
-
addOption(
|
|
1513
|
-
this._registerOption(
|
|
1514
|
-
const oname =
|
|
1515
|
-
const name =
|
|
1516
|
-
if (
|
|
1517
|
-
const positiveLongFlag =
|
|
1508
|
+
addOption(option2) {
|
|
1509
|
+
this._registerOption(option2);
|
|
1510
|
+
const oname = option2.name();
|
|
1511
|
+
const name = option2.attributeName();
|
|
1512
|
+
if (option2.negate) {
|
|
1513
|
+
const positiveLongFlag = option2.long.replace(/^--no-/, "--");
|
|
1518
1514
|
if (!this._findOption(positiveLongFlag)) {
|
|
1519
1515
|
this.setOptionValueWithSource(
|
|
1520
1516
|
name,
|
|
1521
|
-
|
|
1517
|
+
option2.defaultValue === void 0 ? true : option2.defaultValue,
|
|
1522
1518
|
"default"
|
|
1523
1519
|
);
|
|
1524
1520
|
}
|
|
1525
|
-
} else if (
|
|
1526
|
-
this.setOptionValueWithSource(name,
|
|
1521
|
+
} else if (option2.defaultValue !== void 0) {
|
|
1522
|
+
this.setOptionValueWithSource(name, option2.defaultValue, "default");
|
|
1527
1523
|
}
|
|
1528
1524
|
const handleOptionValue = (val, invalidValueMessage, valueSource) => {
|
|
1529
|
-
if (val == null &&
|
|
1530
|
-
val =
|
|
1525
|
+
if (val == null && option2.presetArg !== void 0) {
|
|
1526
|
+
val = option2.presetArg;
|
|
1531
1527
|
}
|
|
1532
1528
|
const oldValue = this.getOptionValue(name);
|
|
1533
|
-
if (val !== null &&
|
|
1534
|
-
val = this._callParseArg(
|
|
1535
|
-
} else if (val !== null &&
|
|
1536
|
-
val =
|
|
1529
|
+
if (val !== null && option2.parseArg) {
|
|
1530
|
+
val = this._callParseArg(option2, val, oldValue, invalidValueMessage);
|
|
1531
|
+
} else if (val !== null && option2.variadic) {
|
|
1532
|
+
val = option2._concatValue(val, oldValue);
|
|
1537
1533
|
}
|
|
1538
1534
|
if (val == null) {
|
|
1539
|
-
if (
|
|
1535
|
+
if (option2.negate) {
|
|
1540
1536
|
val = false;
|
|
1541
|
-
} else if (
|
|
1537
|
+
} else if (option2.isBoolean() || option2.optional) {
|
|
1542
1538
|
val = true;
|
|
1543
1539
|
} else {
|
|
1544
1540
|
val = "";
|
|
@@ -1547,12 +1543,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1547
1543
|
this.setOptionValueWithSource(name, val, valueSource);
|
|
1548
1544
|
};
|
|
1549
1545
|
this.on("option:" + oname, (val) => {
|
|
1550
|
-
const invalidValueMessage = `error: option '${
|
|
1546
|
+
const invalidValueMessage = `error: option '${option2.flags}' argument '${val}' is invalid.`;
|
|
1551
1547
|
handleOptionValue(val, invalidValueMessage, "cli");
|
|
1552
1548
|
});
|
|
1553
|
-
if (
|
|
1549
|
+
if (option2.envVar) {
|
|
1554
1550
|
this.on("optionEnv:" + oname, (val) => {
|
|
1555
|
-
const invalidValueMessage = `error: option '${
|
|
1551
|
+
const invalidValueMessage = `error: option '${option2.flags}' value '${val}' from env '${option2.envVar}' is invalid.`;
|
|
1556
1552
|
handleOptionValue(val, invalidValueMessage, "env");
|
|
1557
1553
|
});
|
|
1558
1554
|
}
|
|
@@ -1570,21 +1566,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1570
1566
|
"To add an Option object use addOption() instead of option() or requiredOption()"
|
|
1571
1567
|
);
|
|
1572
1568
|
}
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1569
|
+
const option2 = this.createOption(flags, description);
|
|
1570
|
+
option2.makeOptionMandatory(!!config.mandatory);
|
|
1575
1571
|
if (typeof fn === "function") {
|
|
1576
|
-
|
|
1572
|
+
option2.default(defaultValue).argParser(fn);
|
|
1577
1573
|
} else if (fn instanceof RegExp) {
|
|
1578
1574
|
const regex = fn;
|
|
1579
1575
|
fn = (val, def) => {
|
|
1580
1576
|
const m = regex.exec(val);
|
|
1581
1577
|
return m ? m[0] : def;
|
|
1582
1578
|
};
|
|
1583
|
-
|
|
1579
|
+
option2.default(defaultValue).argParser(fn);
|
|
1584
1580
|
} else {
|
|
1585
|
-
|
|
1581
|
+
option2.default(fn);
|
|
1586
1582
|
}
|
|
1587
|
-
return this.addOption(
|
|
1583
|
+
return this.addOption(option2);
|
|
1588
1584
|
}
|
|
1589
1585
|
/**
|
|
1590
1586
|
* Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.
|
|
@@ -1798,16 +1794,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1798
1794
|
}
|
|
1799
1795
|
parseOptions = parseOptions || {};
|
|
1800
1796
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
1801
|
-
if (
|
|
1797
|
+
if (process2.versions?.electron) {
|
|
1802
1798
|
parseOptions.from = "electron";
|
|
1803
1799
|
}
|
|
1804
|
-
const execArgv =
|
|
1800
|
+
const execArgv = process2.execArgv ?? [];
|
|
1805
1801
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
|
|
1806
1802
|
parseOptions.from = "eval";
|
|
1807
1803
|
}
|
|
1808
1804
|
}
|
|
1809
1805
|
if (argv === void 0) {
|
|
1810
|
-
argv =
|
|
1806
|
+
argv = process2.argv;
|
|
1811
1807
|
}
|
|
1812
1808
|
this.rawArgs = argv.slice();
|
|
1813
1809
|
let userArgs;
|
|
@@ -1818,7 +1814,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1818
1814
|
userArgs = argv.slice(2);
|
|
1819
1815
|
break;
|
|
1820
1816
|
case "electron":
|
|
1821
|
-
if (
|
|
1817
|
+
if (process2.defaultApp) {
|
|
1822
1818
|
this._scriptPath = argv[1];
|
|
1823
1819
|
userArgs = argv.slice(2);
|
|
1824
1820
|
} else {
|
|
@@ -1946,23 +1942,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1946
1942
|
}
|
|
1947
1943
|
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1948
1944
|
let proc;
|
|
1949
|
-
if (
|
|
1945
|
+
if (process2.platform !== "win32") {
|
|
1950
1946
|
if (launchWithNode) {
|
|
1951
1947
|
args2.unshift(executableFile);
|
|
1952
|
-
args2 = incrementNodeInspectorPort(
|
|
1953
|
-
proc = childProcess.spawn(
|
|
1948
|
+
args2 = incrementNodeInspectorPort(process2.execArgv).concat(args2);
|
|
1949
|
+
proc = childProcess.spawn(process2.argv[0], args2, { stdio: "inherit" });
|
|
1954
1950
|
} else {
|
|
1955
1951
|
proc = childProcess.spawn(executableFile, args2, { stdio: "inherit" });
|
|
1956
1952
|
}
|
|
1957
1953
|
} else {
|
|
1958
1954
|
args2.unshift(executableFile);
|
|
1959
|
-
args2 = incrementNodeInspectorPort(
|
|
1960
|
-
proc = childProcess.spawn(
|
|
1955
|
+
args2 = incrementNodeInspectorPort(process2.execArgv).concat(args2);
|
|
1956
|
+
proc = childProcess.spawn(process2.execPath, args2, { stdio: "inherit" });
|
|
1961
1957
|
}
|
|
1962
1958
|
if (!proc.killed) {
|
|
1963
1959
|
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
1964
1960
|
signals.forEach((signal) => {
|
|
1965
|
-
|
|
1961
|
+
process2.on(signal, () => {
|
|
1966
1962
|
if (proc.killed === false && proc.exitCode === null) {
|
|
1967
1963
|
proc.kill(signal);
|
|
1968
1964
|
}
|
|
@@ -1973,7 +1969,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1973
1969
|
proc.on("close", (code) => {
|
|
1974
1970
|
code = code ?? 1;
|
|
1975
1971
|
if (!exitCallback) {
|
|
1976
|
-
|
|
1972
|
+
process2.exit(code);
|
|
1977
1973
|
} else {
|
|
1978
1974
|
exitCallback(
|
|
1979
1975
|
new CommanderError2(
|
|
@@ -1996,7 +1992,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1996
1992
|
throw new Error(`'${executableFile}' not executable`);
|
|
1997
1993
|
}
|
|
1998
1994
|
if (!exitCallback) {
|
|
1999
|
-
|
|
1995
|
+
process2.exit(1);
|
|
2000
1996
|
} else {
|
|
2001
1997
|
const wrappedError = new CommanderError2(
|
|
2002
1998
|
1,
|
|
@@ -2270,7 +2266,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2270
2266
|
* @package
|
|
2271
2267
|
*/
|
|
2272
2268
|
_findOption(arg) {
|
|
2273
|
-
return this.options.find((
|
|
2269
|
+
return this.options.find((option2) => option2.is(arg));
|
|
2274
2270
|
}
|
|
2275
2271
|
/**
|
|
2276
2272
|
* Display an error message if a mandatory option does not have a value.
|
|
@@ -2293,22 +2289,22 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2293
2289
|
* @private
|
|
2294
2290
|
*/
|
|
2295
2291
|
_checkForConflictingLocalOptions() {
|
|
2296
|
-
const definedNonDefaultOptions = this.options.filter((
|
|
2297
|
-
const optionKey =
|
|
2292
|
+
const definedNonDefaultOptions = this.options.filter((option2) => {
|
|
2293
|
+
const optionKey = option2.attributeName();
|
|
2298
2294
|
if (this.getOptionValue(optionKey) === void 0) {
|
|
2299
2295
|
return false;
|
|
2300
2296
|
}
|
|
2301
2297
|
return this.getOptionValueSource(optionKey) !== "default";
|
|
2302
2298
|
});
|
|
2303
2299
|
const optionsWithConflicting = definedNonDefaultOptions.filter(
|
|
2304
|
-
(
|
|
2300
|
+
(option2) => option2.conflictsWith.length > 0
|
|
2305
2301
|
);
|
|
2306
|
-
optionsWithConflicting.forEach((
|
|
2302
|
+
optionsWithConflicting.forEach((option2) => {
|
|
2307
2303
|
const conflictingAndDefined = definedNonDefaultOptions.find(
|
|
2308
|
-
(defined) =>
|
|
2304
|
+
(defined) => option2.conflictsWith.includes(defined.attributeName())
|
|
2309
2305
|
);
|
|
2310
2306
|
if (conflictingAndDefined) {
|
|
2311
|
-
this._conflictingOption(
|
|
2307
|
+
this._conflictingOption(option2, conflictingAndDefined);
|
|
2312
2308
|
}
|
|
2313
2309
|
});
|
|
2314
2310
|
}
|
|
@@ -2360,32 +2356,32 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2360
2356
|
}
|
|
2361
2357
|
activeVariadicOption = null;
|
|
2362
2358
|
if (maybeOption(arg)) {
|
|
2363
|
-
const
|
|
2364
|
-
if (
|
|
2365
|
-
if (
|
|
2359
|
+
const option2 = this._findOption(arg);
|
|
2360
|
+
if (option2) {
|
|
2361
|
+
if (option2.required) {
|
|
2366
2362
|
const value = args2.shift();
|
|
2367
|
-
if (value === void 0) this.optionMissingArgument(
|
|
2368
|
-
this.emit(`option:${
|
|
2369
|
-
} else if (
|
|
2363
|
+
if (value === void 0) this.optionMissingArgument(option2);
|
|
2364
|
+
this.emit(`option:${option2.name()}`, value);
|
|
2365
|
+
} else if (option2.optional) {
|
|
2370
2366
|
let value = null;
|
|
2371
2367
|
if (args2.length > 0 && !maybeOption(args2[0])) {
|
|
2372
2368
|
value = args2.shift();
|
|
2373
2369
|
}
|
|
2374
|
-
this.emit(`option:${
|
|
2370
|
+
this.emit(`option:${option2.name()}`, value);
|
|
2375
2371
|
} else {
|
|
2376
|
-
this.emit(`option:${
|
|
2372
|
+
this.emit(`option:${option2.name()}`);
|
|
2377
2373
|
}
|
|
2378
|
-
activeVariadicOption =
|
|
2374
|
+
activeVariadicOption = option2.variadic ? option2 : null;
|
|
2379
2375
|
continue;
|
|
2380
2376
|
}
|
|
2381
2377
|
}
|
|
2382
2378
|
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
|
|
2383
|
-
const
|
|
2384
|
-
if (
|
|
2385
|
-
if (
|
|
2386
|
-
this.emit(`option:${
|
|
2379
|
+
const option2 = this._findOption(`-${arg[1]}`);
|
|
2380
|
+
if (option2) {
|
|
2381
|
+
if (option2.required || option2.optional && this._combineFlagAndOptionalValue) {
|
|
2382
|
+
this.emit(`option:${option2.name()}`, arg.slice(2));
|
|
2387
2383
|
} else {
|
|
2388
|
-
this.emit(`option:${
|
|
2384
|
+
this.emit(`option:${option2.name()}`);
|
|
2389
2385
|
args2.unshift(`-${arg.slice(2)}`);
|
|
2390
2386
|
}
|
|
2391
2387
|
continue;
|
|
@@ -2393,9 +2389,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2393
2389
|
}
|
|
2394
2390
|
if (/^--[^=]+=/.test(arg)) {
|
|
2395
2391
|
const index = arg.indexOf("=");
|
|
2396
|
-
const
|
|
2397
|
-
if (
|
|
2398
|
-
this.emit(`option:${
|
|
2392
|
+
const option2 = this._findOption(arg.slice(0, index));
|
|
2393
|
+
if (option2 && (option2.required || option2.optional)) {
|
|
2394
|
+
this.emit(`option:${option2.name()}`, arg.slice(index + 1));
|
|
2399
2395
|
continue;
|
|
2400
2396
|
}
|
|
2401
2397
|
}
|
|
@@ -2487,16 +2483,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2487
2483
|
* @private
|
|
2488
2484
|
*/
|
|
2489
2485
|
_parseOptionsEnv() {
|
|
2490
|
-
this.options.forEach((
|
|
2491
|
-
if (
|
|
2492
|
-
const optionKey =
|
|
2486
|
+
this.options.forEach((option2) => {
|
|
2487
|
+
if (option2.envVar && option2.envVar in process2.env) {
|
|
2488
|
+
const optionKey = option2.attributeName();
|
|
2493
2489
|
if (this.getOptionValue(optionKey) === void 0 || ["default", "config", "env"].includes(
|
|
2494
2490
|
this.getOptionValueSource(optionKey)
|
|
2495
2491
|
)) {
|
|
2496
|
-
if (
|
|
2497
|
-
this.emit(`optionEnv:${
|
|
2492
|
+
if (option2.required || option2.optional) {
|
|
2493
|
+
this.emit(`optionEnv:${option2.name()}`, process2.env[option2.envVar]);
|
|
2498
2494
|
} else {
|
|
2499
|
-
this.emit(`optionEnv:${
|
|
2495
|
+
this.emit(`optionEnv:${option2.name()}`);
|
|
2500
2496
|
}
|
|
2501
2497
|
}
|
|
2502
2498
|
}
|
|
@@ -2513,15 +2509,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2513
2509
|
return this.getOptionValue(optionKey) !== void 0 && !["default", "implied"].includes(this.getOptionValueSource(optionKey));
|
|
2514
2510
|
};
|
|
2515
2511
|
this.options.filter(
|
|
2516
|
-
(
|
|
2517
|
-
this.getOptionValue(
|
|
2518
|
-
|
|
2512
|
+
(option2) => option2.implied !== void 0 && hasCustomOptionValue(option2.attributeName()) && dualHelper.valueFromOption(
|
|
2513
|
+
this.getOptionValue(option2.attributeName()),
|
|
2514
|
+
option2
|
|
2519
2515
|
)
|
|
2520
|
-
).forEach((
|
|
2521
|
-
Object.keys(
|
|
2516
|
+
).forEach((option2) => {
|
|
2517
|
+
Object.keys(option2.implied).filter((impliedKey) => !hasCustomOptionValue(impliedKey)).forEach((impliedKey) => {
|
|
2522
2518
|
this.setOptionValueWithSource(
|
|
2523
2519
|
impliedKey,
|
|
2524
|
-
|
|
2520
|
+
option2.implied[impliedKey],
|
|
2525
2521
|
"implied"
|
|
2526
2522
|
);
|
|
2527
2523
|
});
|
|
@@ -2543,8 +2539,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2543
2539
|
* @param {Option} option
|
|
2544
2540
|
* @private
|
|
2545
2541
|
*/
|
|
2546
|
-
optionMissingArgument(
|
|
2547
|
-
const message = `error: option '${
|
|
2542
|
+
optionMissingArgument(option2) {
|
|
2543
|
+
const message = `error: option '${option2.flags}' argument missing`;
|
|
2548
2544
|
this.error(message, { code: "commander.optionMissingArgument" });
|
|
2549
2545
|
}
|
|
2550
2546
|
/**
|
|
@@ -2553,8 +2549,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2553
2549
|
* @param {Option} option
|
|
2554
2550
|
* @private
|
|
2555
2551
|
*/
|
|
2556
|
-
missingMandatoryOptionValue(
|
|
2557
|
-
const message = `error: required option '${
|
|
2552
|
+
missingMandatoryOptionValue(option2) {
|
|
2553
|
+
const message = `error: required option '${option2.flags}' not specified`;
|
|
2558
2554
|
this.error(message, { code: "commander.missingMandatoryOptionValue" });
|
|
2559
2555
|
}
|
|
2560
2556
|
/**
|
|
@@ -2564,9 +2560,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2564
2560
|
* @param {Option} conflictingOption
|
|
2565
2561
|
* @private
|
|
2566
2562
|
*/
|
|
2567
|
-
_conflictingOption(
|
|
2568
|
-
const findBestOptionFromValue = (
|
|
2569
|
-
const optionKey =
|
|
2563
|
+
_conflictingOption(option2, conflictingOption) {
|
|
2564
|
+
const findBestOptionFromValue = (option3) => {
|
|
2565
|
+
const optionKey = option3.attributeName();
|
|
2570
2566
|
const optionValue = this.getOptionValue(optionKey);
|
|
2571
2567
|
const negativeOption = this.options.find(
|
|
2572
2568
|
(target) => target.negate && optionKey === target.attributeName()
|
|
@@ -2577,10 +2573,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2577
2573
|
if (negativeOption && (negativeOption.presetArg === void 0 && optionValue === false || negativeOption.presetArg !== void 0 && optionValue === negativeOption.presetArg)) {
|
|
2578
2574
|
return negativeOption;
|
|
2579
2575
|
}
|
|
2580
|
-
return positiveOption ||
|
|
2576
|
+
return positiveOption || option3;
|
|
2581
2577
|
};
|
|
2582
|
-
const getErrorMessage2 = (
|
|
2583
|
-
const bestOption = findBestOptionFromValue(
|
|
2578
|
+
const getErrorMessage2 = (option3) => {
|
|
2579
|
+
const bestOption = findBestOptionFromValue(option3);
|
|
2584
2580
|
const optionKey = bestOption.attributeName();
|
|
2585
2581
|
const source = this.getOptionValueSource(optionKey);
|
|
2586
2582
|
if (source === "env") {
|
|
@@ -2588,7 +2584,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2588
2584
|
}
|
|
2589
2585
|
return `option '${bestOption.flags}'`;
|
|
2590
2586
|
};
|
|
2591
|
-
const message = `error: ${getErrorMessage2(
|
|
2587
|
+
const message = `error: ${getErrorMessage2(option2)} cannot be used with ${getErrorMessage2(conflictingOption)}`;
|
|
2592
2588
|
this.error(message, { code: "commander.conflictingOption" });
|
|
2593
2589
|
}
|
|
2594
2590
|
/**
|
|
@@ -2604,7 +2600,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2604
2600
|
let candidateFlags = [];
|
|
2605
2601
|
let command = this;
|
|
2606
2602
|
do {
|
|
2607
|
-
const moreFlags = command.createHelp().visibleOptions(command).filter((
|
|
2603
|
+
const moreFlags = command.createHelp().visibleOptions(command).filter((option2) => option2.long).map((option2) => option2.long);
|
|
2608
2604
|
candidateFlags = candidateFlags.concat(moreFlags);
|
|
2609
2605
|
command = command.parent;
|
|
2610
2606
|
} while (command && !command._enablePositionalOptions);
|
|
@@ -2910,8 +2906,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2910
2906
|
* @param {Option} option
|
|
2911
2907
|
* @return {Command} `this` command for chaining
|
|
2912
2908
|
*/
|
|
2913
|
-
addHelpOption(
|
|
2914
|
-
this._helpOption =
|
|
2909
|
+
addHelpOption(option2) {
|
|
2910
|
+
this._helpOption = option2;
|
|
2915
2911
|
return this;
|
|
2916
2912
|
}
|
|
2917
2913
|
/**
|
|
@@ -2923,7 +2919,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2923
2919
|
*/
|
|
2924
2920
|
help(contextOptions) {
|
|
2925
2921
|
this.outputHelp(contextOptions);
|
|
2926
|
-
let exitCode =
|
|
2922
|
+
let exitCode = process2.exitCode || 0;
|
|
2927
2923
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
2928
2924
|
exitCode = 1;
|
|
2929
2925
|
}
|
|
@@ -3004,29 +3000,29 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3004
3000
|
return arg;
|
|
3005
3001
|
});
|
|
3006
3002
|
}
|
|
3007
|
-
|
|
3003
|
+
exports2.Command = Command2;
|
|
3008
3004
|
}
|
|
3009
3005
|
});
|
|
3010
3006
|
|
|
3011
3007
|
// node_modules/commander/index.js
|
|
3012
3008
|
var require_commander = __commonJS({
|
|
3013
|
-
"node_modules/commander/index.js"(
|
|
3009
|
+
"node_modules/commander/index.js"(exports2) {
|
|
3014
3010
|
var { Argument: Argument2 } = require_argument();
|
|
3015
3011
|
var { Command: Command2 } = require_command();
|
|
3016
3012
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3017
3013
|
var { Help: Help2 } = require_help();
|
|
3018
3014
|
var { Option: Option2 } = require_option();
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3015
|
+
exports2.program = new Command2();
|
|
3016
|
+
exports2.createCommand = (name) => new Command2(name);
|
|
3017
|
+
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3018
|
+
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3019
|
+
exports2.Command = Command2;
|
|
3020
|
+
exports2.Option = Option2;
|
|
3021
|
+
exports2.Argument = Argument2;
|
|
3022
|
+
exports2.Help = Help2;
|
|
3023
|
+
exports2.CommanderError = CommanderError2;
|
|
3024
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
3025
|
+
exports2.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3030
3026
|
}
|
|
3031
3027
|
});
|
|
3032
3028
|
|
|
@@ -3054,78 +3050,6 @@ var init_esm = __esm({
|
|
|
3054
3050
|
}
|
|
3055
3051
|
});
|
|
3056
3052
|
|
|
3057
|
-
// ../../node_modules/picocolors/picocolors.js
|
|
3058
|
-
var require_picocolors = __commonJS({
|
|
3059
|
-
"../../node_modules/picocolors/picocolors.js"(exports, module) {
|
|
3060
|
-
var p = process || {};
|
|
3061
|
-
var argv = p.argv || [];
|
|
3062
|
-
var env = p.env || {};
|
|
3063
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
3064
|
-
var formatter = (open, close, replace = open) => (input) => {
|
|
3065
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
3066
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
3067
|
-
};
|
|
3068
|
-
var replaceClose = (string, close, replace, index) => {
|
|
3069
|
-
let result = "", cursor = 0;
|
|
3070
|
-
do {
|
|
3071
|
-
result += string.substring(cursor, index) + replace;
|
|
3072
|
-
cursor = index + close.length;
|
|
3073
|
-
index = string.indexOf(close, cursor);
|
|
3074
|
-
} while (~index);
|
|
3075
|
-
return result + string.substring(cursor);
|
|
3076
|
-
};
|
|
3077
|
-
var createColors = (enabled = isColorSupported) => {
|
|
3078
|
-
let f = enabled ? formatter : () => String;
|
|
3079
|
-
return {
|
|
3080
|
-
isColorSupported: enabled,
|
|
3081
|
-
reset: f("\x1B[0m", "\x1B[0m"),
|
|
3082
|
-
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
3083
|
-
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
3084
|
-
italic: f("\x1B[3m", "\x1B[23m"),
|
|
3085
|
-
underline: f("\x1B[4m", "\x1B[24m"),
|
|
3086
|
-
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
3087
|
-
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
3088
|
-
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
3089
|
-
black: f("\x1B[30m", "\x1B[39m"),
|
|
3090
|
-
red: f("\x1B[31m", "\x1B[39m"),
|
|
3091
|
-
green: f("\x1B[32m", "\x1B[39m"),
|
|
3092
|
-
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
3093
|
-
blue: f("\x1B[34m", "\x1B[39m"),
|
|
3094
|
-
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
3095
|
-
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
3096
|
-
white: f("\x1B[37m", "\x1B[39m"),
|
|
3097
|
-
gray: f("\x1B[90m", "\x1B[39m"),
|
|
3098
|
-
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
3099
|
-
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
3100
|
-
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
3101
|
-
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
3102
|
-
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
3103
|
-
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
3104
|
-
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
3105
|
-
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
3106
|
-
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
3107
|
-
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
3108
|
-
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
3109
|
-
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
3110
|
-
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
3111
|
-
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
3112
|
-
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
3113
|
-
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
3114
|
-
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
3115
|
-
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
3116
|
-
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
3117
|
-
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
3118
|
-
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
3119
|
-
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
3120
|
-
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
3121
|
-
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
3122
|
-
};
|
|
3123
|
-
};
|
|
3124
|
-
module.exports = createColors();
|
|
3125
|
-
module.exports.createColors = createColors;
|
|
3126
|
-
}
|
|
3127
|
-
});
|
|
3128
|
-
|
|
3129
3053
|
// ../../node_modules/zod/v3/helpers/util.js
|
|
3130
3054
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
3131
3055
|
var init_util = __esm({
|
|
@@ -3705,10 +3629,10 @@ function isValidJWT(jwt, alg) {
|
|
|
3705
3629
|
if (!jwtRegex.test(jwt))
|
|
3706
3630
|
return false;
|
|
3707
3631
|
try {
|
|
3708
|
-
const [
|
|
3709
|
-
if (!
|
|
3632
|
+
const [header2] = jwt.split(".");
|
|
3633
|
+
if (!header2)
|
|
3710
3634
|
return false;
|
|
3711
|
-
const base64 =
|
|
3635
|
+
const base64 = header2.replace(/-/g, "+").replace(/_/g, "/").padEnd(header2.length + (4 - header2.length % 4) % 4, "=");
|
|
3712
3636
|
const decoded = JSON.parse(atob(base64));
|
|
3713
3637
|
if (typeof decoded !== "object" || decoded === null)
|
|
3714
3638
|
return false;
|
|
@@ -4108,8 +4032,8 @@ var init_types = __esm({
|
|
|
4108
4032
|
promise() {
|
|
4109
4033
|
return ZodPromise.create(this, this._def);
|
|
4110
4034
|
}
|
|
4111
|
-
or(
|
|
4112
|
-
return ZodUnion.create([this,
|
|
4035
|
+
or(option2) {
|
|
4036
|
+
return ZodUnion.create([this, option2], this._def);
|
|
4113
4037
|
}
|
|
4114
4038
|
and(incoming) {
|
|
4115
4039
|
return ZodIntersection.create(this, incoming, this._def);
|
|
@@ -5862,7 +5786,7 @@ var init_types = __esm({
|
|
|
5862
5786
|
return INVALID;
|
|
5863
5787
|
}
|
|
5864
5788
|
if (ctx.common.async) {
|
|
5865
|
-
return Promise.all(options.map(async (
|
|
5789
|
+
return Promise.all(options.map(async (option2) => {
|
|
5866
5790
|
const childCtx = {
|
|
5867
5791
|
...ctx,
|
|
5868
5792
|
common: {
|
|
@@ -5872,7 +5796,7 @@ var init_types = __esm({
|
|
|
5872
5796
|
parent: null
|
|
5873
5797
|
};
|
|
5874
5798
|
return {
|
|
5875
|
-
result: await
|
|
5799
|
+
result: await option2._parseAsync({
|
|
5876
5800
|
data: ctx.data,
|
|
5877
5801
|
path: ctx.path,
|
|
5878
5802
|
parent: childCtx
|
|
@@ -5883,7 +5807,7 @@ var init_types = __esm({
|
|
|
5883
5807
|
} else {
|
|
5884
5808
|
let dirty = void 0;
|
|
5885
5809
|
const issues = [];
|
|
5886
|
-
for (const
|
|
5810
|
+
for (const option2 of options) {
|
|
5887
5811
|
const childCtx = {
|
|
5888
5812
|
...ctx,
|
|
5889
5813
|
common: {
|
|
@@ -5892,7 +5816,7 @@ var init_types = __esm({
|
|
|
5892
5816
|
},
|
|
5893
5817
|
parent: null
|
|
5894
5818
|
};
|
|
5895
|
-
const result =
|
|
5819
|
+
const result = option2._parseSync({
|
|
5896
5820
|
data: ctx.data,
|
|
5897
5821
|
path: ctx.path,
|
|
5898
5822
|
parent: childCtx
|
|
@@ -5973,8 +5897,8 @@ var init_types = __esm({
|
|
|
5973
5897
|
}
|
|
5974
5898
|
const discriminator = this.discriminator;
|
|
5975
5899
|
const discriminatorValue = ctx.data[discriminator];
|
|
5976
|
-
const
|
|
5977
|
-
if (!
|
|
5900
|
+
const option2 = this.optionsMap.get(discriminatorValue);
|
|
5901
|
+
if (!option2) {
|
|
5978
5902
|
addIssueToContext(ctx, {
|
|
5979
5903
|
code: ZodIssueCode.invalid_union_discriminator,
|
|
5980
5904
|
options: Array.from(this.optionsMap.keys()),
|
|
@@ -5983,13 +5907,13 @@ var init_types = __esm({
|
|
|
5983
5907
|
return INVALID;
|
|
5984
5908
|
}
|
|
5985
5909
|
if (ctx.common.async) {
|
|
5986
|
-
return
|
|
5910
|
+
return option2._parseAsync({
|
|
5987
5911
|
data: ctx.data,
|
|
5988
5912
|
path: ctx.path,
|
|
5989
5913
|
parent: ctx
|
|
5990
5914
|
});
|
|
5991
5915
|
} else {
|
|
5992
|
-
return
|
|
5916
|
+
return option2._parseSync({
|
|
5993
5917
|
data: ctx.data,
|
|
5994
5918
|
path: ctx.path,
|
|
5995
5919
|
parent: ctx
|
|
@@ -7232,6 +7156,78 @@ var init_zod = __esm({
|
|
|
7232
7156
|
}
|
|
7233
7157
|
});
|
|
7234
7158
|
|
|
7159
|
+
// ../../node_modules/picocolors/picocolors.js
|
|
7160
|
+
var require_picocolors = __commonJS({
|
|
7161
|
+
"../../node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
7162
|
+
var p = process || {};
|
|
7163
|
+
var argv = p.argv || [];
|
|
7164
|
+
var env = p.env || {};
|
|
7165
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
7166
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
7167
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
7168
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
7169
|
+
};
|
|
7170
|
+
var replaceClose = (string, close, replace, index) => {
|
|
7171
|
+
let result = "", cursor = 0;
|
|
7172
|
+
do {
|
|
7173
|
+
result += string.substring(cursor, index) + replace;
|
|
7174
|
+
cursor = index + close.length;
|
|
7175
|
+
index = string.indexOf(close, cursor);
|
|
7176
|
+
} while (~index);
|
|
7177
|
+
return result + string.substring(cursor);
|
|
7178
|
+
};
|
|
7179
|
+
var createColors = (enabled = isColorSupported) => {
|
|
7180
|
+
let f = enabled ? formatter : () => String;
|
|
7181
|
+
return {
|
|
7182
|
+
isColorSupported: enabled,
|
|
7183
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
7184
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
7185
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
7186
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
7187
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
7188
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
7189
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
7190
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
7191
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
7192
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
7193
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
7194
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
7195
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
7196
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
7197
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
7198
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
7199
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
7200
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
7201
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
7202
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
7203
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
7204
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
7205
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
7206
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
7207
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
7208
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
7209
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
7210
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
7211
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
7212
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
7213
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
7214
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
7215
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
7216
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
7217
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
7218
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
7219
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
7220
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
7221
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
7222
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
7223
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
7224
|
+
};
|
|
7225
|
+
};
|
|
7226
|
+
module2.exports = createColors();
|
|
7227
|
+
module2.exports.createColors = createColors;
|
|
7228
|
+
}
|
|
7229
|
+
});
|
|
7230
|
+
|
|
7235
7231
|
// src/utils/error.ts
|
|
7236
7232
|
function getErrorMessage(err) {
|
|
7237
7233
|
if (err instanceof CodowaveError) {
|
|
@@ -7324,15 +7320,12 @@ Context: ${JSON.stringify(this.context, null, 2)}`;
|
|
|
7324
7320
|
});
|
|
7325
7321
|
|
|
7326
7322
|
// src/config.ts
|
|
7327
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
7328
|
-
import { join } from "path";
|
|
7329
|
-
import { homedir } from "os";
|
|
7330
7323
|
function readConfig() {
|
|
7331
|
-
if (!existsSync(CONFIG_FILE)) {
|
|
7324
|
+
if (!(0, import_fs.existsSync)(CONFIG_FILE)) {
|
|
7332
7325
|
return null;
|
|
7333
7326
|
}
|
|
7334
7327
|
try {
|
|
7335
|
-
const raw = readFileSync(CONFIG_FILE, "utf-8");
|
|
7328
|
+
const raw = (0, import_fs.readFileSync)(CONFIG_FILE, "utf-8");
|
|
7336
7329
|
const json = JSON.parse(raw);
|
|
7337
7330
|
const parsed = ConfigSchema.safeParse(json);
|
|
7338
7331
|
if (!parsed.success) {
|
|
@@ -7359,10 +7352,10 @@ function readConfigOrThrow() {
|
|
|
7359
7352
|
return config;
|
|
7360
7353
|
}
|
|
7361
7354
|
function writeConfig(config) {
|
|
7362
|
-
if (!existsSync(CONFIG_DIR)) {
|
|
7363
|
-
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
7355
|
+
if (!(0, import_fs.existsSync)(CONFIG_DIR)) {
|
|
7356
|
+
(0, import_fs.mkdirSync)(CONFIG_DIR, { recursive: true });
|
|
7364
7357
|
}
|
|
7365
|
-
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
7358
|
+
(0, import_fs.writeFileSync)(CONFIG_FILE, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
7366
7359
|
}
|
|
7367
7360
|
function updateConfig(updates) {
|
|
7368
7361
|
const current = readConfig() ?? {
|
|
@@ -7382,10 +7375,13 @@ function updateConfig(updates) {
|
|
|
7382
7375
|
function getConfigPath() {
|
|
7383
7376
|
return CONFIG_FILE;
|
|
7384
7377
|
}
|
|
7385
|
-
var AIProviderSchema, ConfigSchema, CONFIG_DIR, CONFIG_FILE;
|
|
7378
|
+
var import_fs, import_path, import_os, AIProviderSchema, ConfigSchema, CONFIG_DIR, CONFIG_FILE;
|
|
7386
7379
|
var init_config = __esm({
|
|
7387
7380
|
"src/config.ts"() {
|
|
7388
7381
|
"use strict";
|
|
7382
|
+
import_fs = require("fs");
|
|
7383
|
+
import_path = require("path");
|
|
7384
|
+
import_os = require("os");
|
|
7389
7385
|
init_zod();
|
|
7390
7386
|
init_error();
|
|
7391
7387
|
AIProviderSchema = external_exports.object({
|
|
@@ -7408,8 +7404,8 @@ var init_config = __esm({
|
|
|
7408
7404
|
autopilot: external_exports.boolean().default(false),
|
|
7409
7405
|
labels: external_exports.array(external_exports.string()).default(["codowave-agent"])
|
|
7410
7406
|
});
|
|
7411
|
-
CONFIG_DIR = join(homedir(), ".codowave");
|
|
7412
|
-
CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
7407
|
+
CONFIG_DIR = (0, import_path.join)((0, import_os.homedir)(), ".codowave");
|
|
7408
|
+
CONFIG_FILE = (0, import_path.join)(CONFIG_DIR, "config.json");
|
|
7413
7409
|
}
|
|
7414
7410
|
});
|
|
7415
7411
|
|
|
@@ -7418,54 +7414,176 @@ var init_exports = {};
|
|
|
7418
7414
|
__export(init_exports, {
|
|
7419
7415
|
initCommand: () => initCommand
|
|
7420
7416
|
});
|
|
7421
|
-
|
|
7417
|
+
function header(text) {
|
|
7418
|
+
return `
|
|
7419
|
+
${import_picocolors2.default.bold(import_picocolors2.default.bgBlue(import_picocolors2.default.white(` ${text} `)))}
|
|
7420
|
+
`;
|
|
7421
|
+
}
|
|
7422
|
+
function option(label, key) {
|
|
7423
|
+
return import_picocolors2.default.gray(` ${import_picocolors2.default.cyan("\u203A")} ${label}`);
|
|
7424
|
+
}
|
|
7425
|
+
async function prompt(question) {
|
|
7426
|
+
const readline = await import("readline");
|
|
7427
|
+
const rl = readline.createInterface({
|
|
7428
|
+
input: process.stdin,
|
|
7429
|
+
output: process.stdout
|
|
7430
|
+
});
|
|
7431
|
+
return new Promise((resolve) => {
|
|
7432
|
+
rl.question(import_picocolors2.default.gray(question), (ans) => {
|
|
7433
|
+
rl.close();
|
|
7434
|
+
resolve(ans.trim());
|
|
7435
|
+
});
|
|
7436
|
+
});
|
|
7437
|
+
}
|
|
7438
|
+
async function selectOption(options, promptText) {
|
|
7439
|
+
console.log(header(promptText));
|
|
7440
|
+
options.forEach((opt, i) => {
|
|
7441
|
+
console.log(option(`${i + 1}. ${opt}`, String(i + 1)));
|
|
7442
|
+
});
|
|
7443
|
+
console.log("");
|
|
7444
|
+
const ans = await prompt(import_picocolors2.default.gray("Select: "));
|
|
7445
|
+
const idx = parseInt(ans) - 1;
|
|
7446
|
+
if (isNaN(idx) || idx < 0 || idx >= options.length) {
|
|
7447
|
+
return 0;
|
|
7448
|
+
}
|
|
7449
|
+
return idx;
|
|
7450
|
+
}
|
|
7451
|
+
var import_picocolors2, WAVE_ASCII, PROVIDERS, initCommand;
|
|
7422
7452
|
var init_init = __esm({
|
|
7423
7453
|
"src/commands/init.tsx"() {
|
|
7424
7454
|
"use strict";
|
|
7425
7455
|
init_esm();
|
|
7426
|
-
|
|
7456
|
+
import_picocolors2 = __toESM(require_picocolors());
|
|
7427
7457
|
init_config();
|
|
7428
|
-
|
|
7458
|
+
WAVE_ASCII = `
|
|
7459
|
+
\uFF5E
|
|
7460
|
+
\uFF5E
|
|
7461
|
+
~~~~\uFF5E
|
|
7462
|
+
~~~~\uFF5E
|
|
7463
|
+
~~~~\uFF5E
|
|
7464
|
+
`;
|
|
7465
|
+
PROVIDERS = [
|
|
7466
|
+
{
|
|
7467
|
+
id: "openai",
|
|
7468
|
+
name: "OpenAI",
|
|
7469
|
+
models: ["gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4"],
|
|
7470
|
+
authTypes: ["API Key"]
|
|
7471
|
+
},
|
|
7472
|
+
{
|
|
7473
|
+
id: "anthropic",
|
|
7474
|
+
name: "Anthropic",
|
|
7475
|
+
models: ["claude-sonnet-4-20250514", "claude-3-5-sonnet-20241022", "claude-3-opus-20240229"],
|
|
7476
|
+
authTypes: ["API Key"]
|
|
7477
|
+
},
|
|
7478
|
+
{
|
|
7479
|
+
id: "minimax",
|
|
7480
|
+
name: "MiniMax",
|
|
7481
|
+
models: ["MiniMax-Text-01", "MiniMax-Text-01Turbo"],
|
|
7482
|
+
authTypes: ["API Key"]
|
|
7483
|
+
},
|
|
7484
|
+
{
|
|
7485
|
+
id: "kimi",
|
|
7486
|
+
name: "Kimi (Moonshot)",
|
|
7487
|
+
models: ["kimi-k2", "kimi-k2-preview"],
|
|
7488
|
+
authTypes: ["API Key"]
|
|
7489
|
+
},
|
|
7490
|
+
{
|
|
7491
|
+
id: "openrouter",
|
|
7492
|
+
name: "OpenRouter",
|
|
7493
|
+
models: ["anthropic/claude-3.5-sonnet", "openai/gpt-4o", "google/gemini-pro-1.5"],
|
|
7494
|
+
authTypes: ["API Key"]
|
|
7495
|
+
},
|
|
7496
|
+
{
|
|
7497
|
+
id: "ollama",
|
|
7498
|
+
name: "Ollama (Local)",
|
|
7499
|
+
models: ["llama3", "mistral", "codellama", "phi3"],
|
|
7500
|
+
authTypes: ["Local"]
|
|
7501
|
+
}
|
|
7502
|
+
];
|
|
7503
|
+
initCommand = new Command("init").description("Initialize Codowave").action(async () => {
|
|
7504
|
+
console.log(import_picocolors2.default.cyan(WAVE_ASCII));
|
|
7505
|
+
console.log(import_picocolors2.default.bold(import_picocolors2.default.blue(" Codowave v0.2.0")));
|
|
7506
|
+
console.log(import_picocolors2.default.gray(" AI-powered coding agent for GitHub\n"));
|
|
7507
|
+
console.log(header("\u26A0\uFE0F Security Warning"));
|
|
7508
|
+
console.log(import_picocolors2.default.yellow("This tool will execute code on your repositories."));
|
|
7509
|
+
console.log(import_picocolors2.default.yellow("It can create branches, commits, and pull requests."));
|
|
7510
|
+
console.log(import_picocolors2.default.gray("\nMake sure you understand the risks before proceeding.\n"));
|
|
7511
|
+
const agree = await prompt(import_picocolors2.default.gray("Do you agree to proceed? (yes/no): "));
|
|
7512
|
+
if (!agree.toLowerCase().startsWith("y")) {
|
|
7513
|
+
console.log(import_picocolors2.default.gray("\nCancelled.\n"));
|
|
7514
|
+
process.exit(0);
|
|
7515
|
+
}
|
|
7516
|
+
console.log(import_picocolors2.default.green("\n\u2713 No account required - this is open source!\n"));
|
|
7517
|
+
const providerNames = PROVIDERS.map((p) => p.name);
|
|
7518
|
+
const providerIdx = await selectOption(providerNames, "Select AI Provider");
|
|
7519
|
+
const provider = PROVIDERS[providerIdx];
|
|
7520
|
+
const authTypes = provider.authTypes;
|
|
7521
|
+
const authIdx = authTypes.length > 1 ? await selectOption(authTypes, "Select Authentication") : 0;
|
|
7522
|
+
let apiKey = "";
|
|
7523
|
+
if (authTypes[authIdx] !== "Local") {
|
|
7524
|
+
console.log(header("API Key"));
|
|
7525
|
+
console.log(import_picocolors2.default.gray(`Enter your ${provider.name} API key:`));
|
|
7526
|
+
apiKey = await prompt(import_picocolors2.default.gray("\nAPI Key: "));
|
|
7527
|
+
if (!apiKey) {
|
|
7528
|
+
console.log(import_picocolors2.default.red("\n\u2716 API key is required\n"));
|
|
7529
|
+
process.exit(1);
|
|
7530
|
+
}
|
|
7531
|
+
}
|
|
7532
|
+
const modelIdx = await selectOption(provider.models, "Select Model");
|
|
7533
|
+
const model = provider.models[modelIdx];
|
|
7534
|
+
console.log(header("Repositories"));
|
|
7535
|
+
console.log(import_picocolors2.default.gray("Enter repositories to automate (owner/repo, comma-separated):"));
|
|
7536
|
+
const reposInput = await prompt(import_picocolors2.default.gray("\nRepos (or press Enter to skip): "));
|
|
7429
7537
|
let repos = [];
|
|
7430
|
-
if (
|
|
7431
|
-
repos =
|
|
7538
|
+
if (reposInput.trim()) {
|
|
7539
|
+
repos = reposInput.split(",").map((r) => {
|
|
7432
7540
|
const [owner, name] = r.trim().split("/");
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
\u274C Invalid repo format: ${r}. Use owner/repo
|
|
7436
|
-
`));
|
|
7437
|
-
process.exit(1);
|
|
7438
|
-
}
|
|
7439
|
-
return { owner, name };
|
|
7440
|
-
});
|
|
7541
|
+
return { owner: owner || "", name: name || "" };
|
|
7542
|
+
}).filter((r) => r.owner && r.name);
|
|
7441
7543
|
}
|
|
7442
|
-
|
|
7544
|
+
console.log(header("Autopilot"));
|
|
7545
|
+
console.log(import_picocolors2.default.gray("Enable autopilot mode? (automatically processes issues)"));
|
|
7546
|
+
const autopilotAns = await prompt(import_picocolors2.default.gray("\nEnable autopilot? (yes/no): "));
|
|
7547
|
+
const autopilot = autopilotAns.toLowerCase().startsWith("y");
|
|
7443
7548
|
const config = {
|
|
7444
|
-
apiKey:
|
|
7445
|
-
apiUrl:
|
|
7446
|
-
githubAppId:
|
|
7447
|
-
githubAppPrivateKey:
|
|
7549
|
+
apiKey: apiKey || "local",
|
|
7550
|
+
apiUrl: "https://api.codowave.com",
|
|
7551
|
+
githubAppId: "",
|
|
7552
|
+
githubAppPrivateKey: "",
|
|
7448
7553
|
repos,
|
|
7449
|
-
autopilot
|
|
7450
|
-
labels
|
|
7554
|
+
autopilot,
|
|
7555
|
+
labels: ["status/approved", "status/in-progress", "status/merged"],
|
|
7556
|
+
ai: {
|
|
7557
|
+
provider: provider.id,
|
|
7558
|
+
apiKey,
|
|
7559
|
+
model,
|
|
7560
|
+
baseUrl: provider.id === "ollama" ? "http://localhost:11434" : void 0
|
|
7561
|
+
}
|
|
7451
7562
|
};
|
|
7452
7563
|
writeConfig(config);
|
|
7453
|
-
console.log(
|
|
7454
|
-
console.log(`
|
|
7455
|
-
console.log(`
|
|
7456
|
-
console.log(`
|
|
7457
|
-
console.log(
|
|
7564
|
+
console.log(import_picocolors2.default.green("\n\u2705 Codowave initialized!\n"));
|
|
7565
|
+
console.log(` ${import_picocolors2.default.cyan("Provider:")} ${provider.name}`);
|
|
7566
|
+
console.log(` ${import_picocolors2.default.cyan("Model:")} ${model}`);
|
|
7567
|
+
console.log(` ${import_picocolors2.default.cyan("Autopilot:")} ${autopilot ? import_picocolors2.default.green("enabled") : import_picocolors2.default.red("disabled")}`);
|
|
7568
|
+
console.log(` ${import_picocolors2.default.cyan("Repos:")} ${repos.length > 0 ? repos.map((r) => `${r.owner}/${r.name}`).join(", ") : import_picocolors2.default.gray("none")}`);
|
|
7569
|
+
console.log(import_picocolors2.default.gray(`
|
|
7458
7570
|
Config: ${getConfigPath()}
|
|
7459
7571
|
`));
|
|
7460
7572
|
});
|
|
7461
7573
|
}
|
|
7462
7574
|
});
|
|
7463
7575
|
|
|
7576
|
+
// src/index.ts
|
|
7577
|
+
init_esm();
|
|
7578
|
+
init_config();
|
|
7579
|
+
init_init();
|
|
7580
|
+
|
|
7464
7581
|
// src/commands/run.ts
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7582
|
+
init_esm();
|
|
7583
|
+
var import_picocolors3 = __toESM(require_picocolors());
|
|
7584
|
+
init_config();
|
|
7585
|
+
init_error();
|
|
7586
|
+
var demoRuns = /* @__PURE__ */ new Map();
|
|
7469
7587
|
function parseIssue(input) {
|
|
7470
7588
|
const urlMatch = input.match(/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)/);
|
|
7471
7589
|
if (urlMatch && urlMatch[1] && urlMatch[2] && urlMatch[3]) {
|
|
@@ -7579,11 +7697,11 @@ function createDemoRun(issue) {
|
|
|
7579
7697
|
function streamDemoRun(run) {
|
|
7580
7698
|
const stages = ["context", "planning", "implementation", "testing", "pr-creation"];
|
|
7581
7699
|
let currentStage = 0;
|
|
7582
|
-
console.log(
|
|
7583
|
-
console.log(
|
|
7584
|
-
console.log(
|
|
7585
|
-
console.log(
|
|
7586
|
-
console.log(
|
|
7700
|
+
console.log(import_picocolors3.default.bold("\n=== Starting Run ===\n"));
|
|
7701
|
+
console.log(import_picocolors3.default.bold("Run ID: ") + run.id);
|
|
7702
|
+
console.log(import_picocolors3.default.bold("Repo: ") + run.repo);
|
|
7703
|
+
console.log(import_picocolors3.default.bold("Issue: ") + run.issue);
|
|
7704
|
+
console.log(import_picocolors3.default.bold("Branch: ") + run.branchName);
|
|
7587
7705
|
console.log("");
|
|
7588
7706
|
const interval = setInterval(() => {
|
|
7589
7707
|
if (currentStage >= stages.length) {
|
|
@@ -7592,10 +7710,10 @@ function streamDemoRun(run) {
|
|
|
7592
7710
|
run.completedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7593
7711
|
run.prNumber = 100 + Math.floor(Math.random() * 50);
|
|
7594
7712
|
run.prTitle = `feat: Implement issue #${run.issue}`;
|
|
7595
|
-
console.log(
|
|
7596
|
-
console.log(
|
|
7597
|
-
console.log(
|
|
7598
|
-
console.log(
|
|
7713
|
+
console.log(import_picocolors3.default.green("\n\u2713 Run completed successfully!"));
|
|
7714
|
+
console.log(import_picocolors3.default.bold("\n=== Result ===\n"));
|
|
7715
|
+
console.log(import_picocolors3.default.bold("PR: ") + `#${run.prNumber} - ${run.prTitle}`);
|
|
7716
|
+
console.log(import_picocolors3.default.bold("Branch: ") + run.branchName);
|
|
7599
7717
|
console.log("");
|
|
7600
7718
|
process.exit(0);
|
|
7601
7719
|
return;
|
|
@@ -7604,7 +7722,7 @@ function streamDemoRun(run) {
|
|
|
7604
7722
|
const stage = run.stages.find((s) => s.name === stageName);
|
|
7605
7723
|
if (stage) {
|
|
7606
7724
|
stage.status = "running";
|
|
7607
|
-
console.log(
|
|
7725
|
+
console.log(import_picocolors3.default.blue(`
|
|
7608
7726
|
--- ${stageName} ---`));
|
|
7609
7727
|
setTimeout(() => {
|
|
7610
7728
|
stage.status = "completed";
|
|
@@ -7618,79 +7736,67 @@ function streamDemoRun(run) {
|
|
|
7618
7736
|
process.on("SIGINT", () => {
|
|
7619
7737
|
clearInterval(interval);
|
|
7620
7738
|
run.status = "cancelled";
|
|
7621
|
-
console.log(
|
|
7739
|
+
console.log(import_picocolors3.default.yellow("\n\n\u26A0 Run cancelled"));
|
|
7622
7740
|
process.exit(1);
|
|
7623
7741
|
});
|
|
7624
7742
|
}
|
|
7625
|
-
var
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
console.error(import_picocolors4.default.red("Repository required. Use -r option or include in issue URL."));
|
|
7659
|
-
process.exit(1);
|
|
7660
|
-
}
|
|
7661
|
-
const runId = await triggerRun(config, parsed);
|
|
7662
|
-
console.log(import_picocolors4.default.green(`\u2713 Run triggered: ${runId}`));
|
|
7663
|
-
if (_options.stream) {
|
|
7664
|
-
console.log(import_picocolors4.default.blue("\nStreaming run progress..."));
|
|
7665
|
-
} else {
|
|
7666
|
-
console.log(import_picocolors4.default.gray(`
|
|
7743
|
+
var runCommand = new Command("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) => {
|
|
7744
|
+
try {
|
|
7745
|
+
const parsed = parseIssue(_issueArg);
|
|
7746
|
+
if (!parsed) {
|
|
7747
|
+
console.error(import_picocolors3.default.red("\nInvalid issue format. Expected one of:"));
|
|
7748
|
+
console.error(import_picocolors3.default.gray(" \u2022 Issue number: 123"));
|
|
7749
|
+
console.error(import_picocolors3.default.gray(" \u2022 Full URL: https://github.com/owner/repo/issues/123"));
|
|
7750
|
+
console.error(import_picocolors3.default.gray(" \u2022 Short form: owner/repo#123"));
|
|
7751
|
+
console.error(import_picocolors3.default.gray(" \u2022 With repo flag: --repo owner/repo 123"));
|
|
7752
|
+
process.exit(1);
|
|
7753
|
+
}
|
|
7754
|
+
if (_options.repo) {
|
|
7755
|
+
const parts = _options.repo.split("/");
|
|
7756
|
+
parsed.owner = parts[0] || "";
|
|
7757
|
+
parsed.repo = parts[1] || "";
|
|
7758
|
+
}
|
|
7759
|
+
let config = null;
|
|
7760
|
+
try {
|
|
7761
|
+
config = readConfig();
|
|
7762
|
+
} catch {
|
|
7763
|
+
}
|
|
7764
|
+
if (config && config.apiKey && config.repos.length > 0) {
|
|
7765
|
+
console.log(import_picocolors3.default.blue("Connecting to Codowave API..."));
|
|
7766
|
+
if (!parsed.owner || !parsed.repo) {
|
|
7767
|
+
console.error(import_picocolors3.default.red("Repository required. Use -r option or include in issue URL."));
|
|
7768
|
+
process.exit(1);
|
|
7769
|
+
}
|
|
7770
|
+
const runId = await triggerRun(config, parsed);
|
|
7771
|
+
console.log(import_picocolors3.default.green(`\u2713 Run triggered: ${runId}`));
|
|
7772
|
+
if (_options.stream) {
|
|
7773
|
+
console.log(import_picocolors3.default.blue("\nStreaming run progress..."));
|
|
7774
|
+
} else {
|
|
7775
|
+
console.log(import_picocolors3.default.gray(`
|
|
7667
7776
|
Run started. Use \`codowave status ${runId}\` to check progress.`));
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7777
|
+
}
|
|
7778
|
+
} else {
|
|
7779
|
+
console.log(import_picocolors3.default.yellow("\u26A0 No config found. Running in demo mode.\n"));
|
|
7780
|
+
const run = createDemoRun(parsed);
|
|
7781
|
+
if (_options.stream || !process.stdout.isTTY) {
|
|
7782
|
+
streamDemoRun(run);
|
|
7783
|
+
} else {
|
|
7784
|
+
console.log(import_picocolors3.default.green(`\u2713 Run started: ${run.id}`));
|
|
7785
|
+
console.log(import_picocolors3.default.gray(`
|
|
7677
7786
|
Use \`codowave status ${run.id}\` to check progress.`));
|
|
7678
|
-
|
|
7679
|
-
}
|
|
7680
|
-
}
|
|
7681
|
-
} catch (err) {
|
|
7682
|
-
handleError(err, "run");
|
|
7787
|
+
console.log(import_picocolors3.default.gray(`Use \`codowave logs ${run.id} -f\` to follow logs.`));
|
|
7683
7788
|
}
|
|
7684
|
-
}
|
|
7789
|
+
}
|
|
7790
|
+
} catch (err) {
|
|
7791
|
+
handleError(err, "run");
|
|
7685
7792
|
}
|
|
7686
7793
|
});
|
|
7687
7794
|
|
|
7688
7795
|
// src/commands/status.ts
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
});
|
|
7796
|
+
init_esm();
|
|
7797
|
+
var import_picocolors4 = __toESM(require_picocolors());
|
|
7798
|
+
init_error();
|
|
7799
|
+
var demoRuns2 = /* @__PURE__ */ new Map();
|
|
7694
7800
|
function initDemoData() {
|
|
7695
7801
|
if (demoRuns2.size === 0) {
|
|
7696
7802
|
const demoRun = {
|
|
@@ -7742,33 +7848,33 @@ function getRun(runId) {
|
|
|
7742
7848
|
function formatStatus(status) {
|
|
7743
7849
|
switch (status) {
|
|
7744
7850
|
case "pending":
|
|
7745
|
-
return
|
|
7851
|
+
return import_picocolors4.default.gray("pending");
|
|
7746
7852
|
case "in_progress":
|
|
7747
|
-
return
|
|
7853
|
+
return import_picocolors4.default.blue("in_progress");
|
|
7748
7854
|
case "completed":
|
|
7749
|
-
return
|
|
7855
|
+
return import_picocolors4.default.green("completed");
|
|
7750
7856
|
case "failed":
|
|
7751
|
-
return
|
|
7857
|
+
return import_picocolors4.default.red("failed");
|
|
7752
7858
|
case "cancelled":
|
|
7753
|
-
return
|
|
7859
|
+
return import_picocolors4.default.gray("cancelled");
|
|
7754
7860
|
default:
|
|
7755
|
-
return
|
|
7861
|
+
return import_picocolors4.default.gray(status);
|
|
7756
7862
|
}
|
|
7757
7863
|
}
|
|
7758
7864
|
function formatStageStatus(status) {
|
|
7759
7865
|
switch (status) {
|
|
7760
7866
|
case "pending":
|
|
7761
|
-
return
|
|
7867
|
+
return import_picocolors4.default.gray("[ ]");
|
|
7762
7868
|
case "running":
|
|
7763
|
-
return
|
|
7869
|
+
return import_picocolors4.default.blue("[~]");
|
|
7764
7870
|
case "completed":
|
|
7765
|
-
return
|
|
7871
|
+
return import_picocolors4.default.green("[+]");
|
|
7766
7872
|
case "failed":
|
|
7767
|
-
return
|
|
7873
|
+
return import_picocolors4.default.red("[x]");
|
|
7768
7874
|
case "skipped":
|
|
7769
|
-
return
|
|
7875
|
+
return import_picocolors4.default.gray("[-]");
|
|
7770
7876
|
default:
|
|
7771
|
-
return
|
|
7877
|
+
return import_picocolors4.default.gray("[?]");
|
|
7772
7878
|
}
|
|
7773
7879
|
}
|
|
7774
7880
|
function formatDuration(startedAt, completedAt) {
|
|
@@ -7784,775 +7890,340 @@ function formatDuration(startedAt, completedAt) {
|
|
|
7784
7890
|
const remainingMinutes = minutes % 60;
|
|
7785
7891
|
return `${hours}h ${remainingMinutes}m`;
|
|
7786
7892
|
}
|
|
7787
|
-
var
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
for (const stage of run.stages) {
|
|
7828
|
-
const statusIcon = formatStageStatus(stage.status);
|
|
7829
|
-
const statusText = import_picocolors5.default.bold("[" + stage.status + "]");
|
|
7830
|
-
console.log(" " + statusIcon + " " + import_picocolors5.default.bold(stage.name.padEnd(20)) + " " + statusText);
|
|
7831
|
-
}
|
|
7832
|
-
console.log("");
|
|
7833
|
-
} catch (err) {
|
|
7834
|
-
handleError(err, "status");
|
|
7835
|
-
}
|
|
7836
|
-
});
|
|
7893
|
+
var statusCommand = new Command("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) => {
|
|
7894
|
+
try {
|
|
7895
|
+
const run = getRun(_runId);
|
|
7896
|
+
if (!run) {
|
|
7897
|
+
console.log(import_picocolors4.default.yellow("No runs found. Run `codowave run <issue>` to start a new run."));
|
|
7898
|
+
return;
|
|
7899
|
+
}
|
|
7900
|
+
if (_options?.repo && run.repo !== _options.repo) {
|
|
7901
|
+
console.log(import_picocolors4.default.yellow("No run found for repository " + _options.repo));
|
|
7902
|
+
return;
|
|
7903
|
+
}
|
|
7904
|
+
console.log(import_picocolors4.default.bold("\n=== Run Status ===\n"));
|
|
7905
|
+
console.log(import_picocolors4.default.bold("ID: ") + run.id);
|
|
7906
|
+
console.log(import_picocolors4.default.bold("Repo: ") + run.repo);
|
|
7907
|
+
console.log(import_picocolors4.default.bold("Issue: ") + run.issue);
|
|
7908
|
+
console.log(import_picocolors4.default.bold("Status: ") + formatStatus(run.status));
|
|
7909
|
+
console.log(import_picocolors4.default.bold("Branch: ") + (run.branchName || import_picocolors4.default.gray("(none)")));
|
|
7910
|
+
if (run.prNumber) {
|
|
7911
|
+
console.log(import_picocolors4.default.bold("PR: ") + "#" + run.prNumber + " - " + (run.prTitle || ""));
|
|
7912
|
+
}
|
|
7913
|
+
if (run.startedAt) {
|
|
7914
|
+
console.log(import_picocolors4.default.bold("Started: ") + new Date(run.startedAt).toLocaleString());
|
|
7915
|
+
}
|
|
7916
|
+
if (run.completedAt) {
|
|
7917
|
+
console.log(import_picocolors4.default.bold("Duration: ") + formatDuration(run.startedAt, run.completedAt));
|
|
7918
|
+
} else if (run.startedAt) {
|
|
7919
|
+
console.log(import_picocolors4.default.bold("Duration: ") + import_picocolors4.default.blue("running... ") + formatDuration(run.startedAt));
|
|
7920
|
+
}
|
|
7921
|
+
if (run.errorMessage) {
|
|
7922
|
+
console.log(import_picocolors4.default.bold("Error: ") + import_picocolors4.default.red(run.errorMessage));
|
|
7923
|
+
}
|
|
7924
|
+
console.log(import_picocolors4.default.bold("\n=== Stages ===\n"));
|
|
7925
|
+
for (const stage of run.stages) {
|
|
7926
|
+
const statusIcon = formatStageStatus(stage.status);
|
|
7927
|
+
const statusText = import_picocolors4.default.bold("[" + stage.status + "]");
|
|
7928
|
+
console.log(" " + statusIcon + " " + import_picocolors4.default.bold(stage.name.padEnd(20)) + " " + statusText);
|
|
7929
|
+
}
|
|
7930
|
+
console.log("");
|
|
7931
|
+
} catch (err) {
|
|
7932
|
+
handleError(err, "status");
|
|
7837
7933
|
}
|
|
7838
7934
|
});
|
|
7839
7935
|
|
|
7840
7936
|
// src/commands/logs.ts
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
return;
|
|
7866
|
-
}
|
|
7867
|
-
console.log(import_picocolors6.default.bold("\n=== Logs: " + stage.name + " ===\n"));
|
|
7868
|
-
console.log(import_picocolors6.default.bold("Status: ") + stage.status);
|
|
7869
|
-
if (stage.logs) {
|
|
7870
|
-
console.log(import_picocolors6.default.gray("\n--- Output ---\n"));
|
|
7871
|
-
console.log(stage.logs);
|
|
7872
|
-
} else {
|
|
7873
|
-
console.log(import_picocolors6.default.gray("\n(no logs available yet)"));
|
|
7874
|
-
}
|
|
7875
|
-
if (_options.follow && stage.status === "running") {
|
|
7876
|
-
console.log(import_picocolors6.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
7877
|
-
console.log(import_picocolors6.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
7878
|
-
}
|
|
7879
|
-
console.log("");
|
|
7880
|
-
return;
|
|
7881
|
-
}
|
|
7882
|
-
console.log(import_picocolors6.default.bold("\n=== Logs: " + run.id + " ===\n"));
|
|
7883
|
-
console.log(import_picocolors6.default.bold("Issue: ") + run.issue);
|
|
7884
|
-
console.log(import_picocolors6.default.bold("Status: ") + run.status);
|
|
7885
|
-
console.log("");
|
|
7886
|
-
for (const stage of run.stages) {
|
|
7887
|
-
const statusIcon = stage.status === "completed" ? "[+]" : stage.status === "failed" ? "[x]" : stage.status === "running" ? "[~]" : "[ ]";
|
|
7888
|
-
console.log(import_picocolors6.default.bold("\n" + statusIcon + " " + stage.name + "\n"));
|
|
7889
|
-
if (stage.logs) {
|
|
7890
|
-
console.log(stage.logs);
|
|
7891
|
-
} else if (stage.status === "pending") {
|
|
7892
|
-
console.log(import_picocolors6.default.gray("(pending)"));
|
|
7893
|
-
} else if (stage.status === "running") {
|
|
7894
|
-
console.log(import_picocolors6.default.blue("(running...)"));
|
|
7895
|
-
} else if (stage.status === "skipped") {
|
|
7896
|
-
console.log(import_picocolors6.default.gray("(skipped)"));
|
|
7897
|
-
}
|
|
7898
|
-
}
|
|
7899
|
-
if (_options?.follow && run.status === "in_progress") {
|
|
7900
|
-
console.log(import_picocolors6.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
7901
|
-
console.log(import_picocolors6.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
7902
|
-
let dots = 0;
|
|
7903
|
-
const interval = setInterval(() => {
|
|
7904
|
-
dots = (dots + 1) % 4;
|
|
7905
|
-
process.stdout.write(import_picocolors6.default.blue("\r" + " ".repeat(dots) + " waiting for updates..."));
|
|
7906
|
-
}, 500);
|
|
7907
|
-
process.on("SIGINT", () => {
|
|
7908
|
-
clearInterval(interval);
|
|
7909
|
-
console.log(import_picocolors6.default.gray("\n\n(Stopped following)"));
|
|
7910
|
-
process.exit(0);
|
|
7911
|
-
});
|
|
7912
|
-
}
|
|
7913
|
-
console.log("");
|
|
7914
|
-
} catch (err) {
|
|
7915
|
-
handleError(err, "logs");
|
|
7937
|
+
init_esm();
|
|
7938
|
+
var import_picocolors5 = __toESM(require_picocolors());
|
|
7939
|
+
init_error();
|
|
7940
|
+
var logsCommand = new Command("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) => {
|
|
7941
|
+
try {
|
|
7942
|
+
const run = getRun(_runId);
|
|
7943
|
+
if (!run) {
|
|
7944
|
+
console.log(import_picocolors5.default.yellow("No runs found. Run `codowave run <issue>` to start a new run."));
|
|
7945
|
+
return;
|
|
7946
|
+
}
|
|
7947
|
+
if (_options?.stage) {
|
|
7948
|
+
const stage = run.stages.find((s) => s.name === _options.stage);
|
|
7949
|
+
if (!stage) {
|
|
7950
|
+
console.log(import_picocolors5.default.red('Stage "' + _options.stage + '" not found.'));
|
|
7951
|
+
console.log(import_picocolors5.default.gray("Available stages: ") + run.stages.map((s) => s.name).join(", "));
|
|
7952
|
+
return;
|
|
7953
|
+
}
|
|
7954
|
+
console.log(import_picocolors5.default.bold("\n=== Logs: " + stage.name + " ===\n"));
|
|
7955
|
+
console.log(import_picocolors5.default.bold("Status: ") + stage.status);
|
|
7956
|
+
if (stage.logs) {
|
|
7957
|
+
console.log(import_picocolors5.default.gray("\n--- Output ---\n"));
|
|
7958
|
+
console.log(stage.logs);
|
|
7959
|
+
} else {
|
|
7960
|
+
console.log(import_picocolors5.default.gray("\n(no logs available yet)"));
|
|
7916
7961
|
}
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
// src/commands/config-cmd.ts
|
|
7922
|
-
var config_cmd_exports = {};
|
|
7923
|
-
__export(config_cmd_exports, {
|
|
7924
|
-
configCommand: () => configCommand
|
|
7925
|
-
});
|
|
7926
|
-
var import_picocolors7, configCommand;
|
|
7927
|
-
var init_config_cmd = __esm({
|
|
7928
|
-
"src/commands/config-cmd.ts"() {
|
|
7929
|
-
"use strict";
|
|
7930
|
-
init_esm();
|
|
7931
|
-
import_picocolors7 = __toESM(require_picocolors());
|
|
7932
|
-
init_config();
|
|
7933
|
-
configCommand = new Command("config").description("Get or set Codowave configuration values");
|
|
7934
|
-
configCommand.action(() => {
|
|
7935
|
-
try {
|
|
7936
|
-
const config = readConfig();
|
|
7937
|
-
if (config) {
|
|
7938
|
-
console.log(import_picocolors7.default.bold("\n\u2699\uFE0F Current Configuration:\n"));
|
|
7939
|
-
console.log(` ${import_picocolors7.default.cyan("apiKey")}: ${config.apiKey ? import_picocolors7.default.green("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") + import_picocolors7.default.gray(" (hidden)") : import_picocolors7.default.yellow("not set")}`);
|
|
7940
|
-
console.log(` ${import_picocolors7.default.cyan("apiUrl")}: ${config.apiUrl}`);
|
|
7941
|
-
console.log(` ${import_picocolors7.default.cyan("autopilot")}: ${config.autopilot ? import_picocolors7.default.green("enabled") : import_picocolors7.default.yellow("disabled")}`);
|
|
7942
|
-
console.log(` ${import_picocolors7.default.cyan("labels")}: ${config.labels?.join(", ") || import_picocolors7.default.yellow("not set")}`);
|
|
7943
|
-
console.log(` ${import_picocolors7.default.cyan("repos")}: ${config.repos.length} repository(s) configured`);
|
|
7944
|
-
console.log(import_picocolors7.default.gray("\n To reconfigure, run: ") + import_picocolors7.default.bold("codowave init") + import_picocolors7.default.gray("\n"));
|
|
7945
|
-
} else {
|
|
7946
|
-
console.log(import_picocolors7.default.yellow("\n\u26A0 No configuration found.\n"));
|
|
7947
|
-
console.log(import_picocolors7.default.gray(" Run ") + import_picocolors7.default.bold("codowave init") + import_picocolors7.default.gray(" to get started.\n"));
|
|
7948
|
-
}
|
|
7949
|
-
} catch {
|
|
7950
|
-
console.log(import_picocolors7.default.yellow("\n\u26A0 No configuration found.\n"));
|
|
7951
|
-
console.log(import_picocolors7.default.gray(" Run ") + import_picocolors7.default.bold("codowave init") + import_picocolors7.default.gray(" to get started.\n"));
|
|
7962
|
+
if (_options.follow && stage.status === "running") {
|
|
7963
|
+
console.log(import_picocolors5.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
7964
|
+
console.log(import_picocolors5.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
7952
7965
|
}
|
|
7953
|
-
});
|
|
7954
|
-
configCommand.command("list").description("List all available config options").action(() => {
|
|
7955
|
-
console.log(import_picocolors7.default.bold("\n\u{1F4CB} Available Config Options:\n"));
|
|
7956
|
-
console.log(` ${import_picocolors7.default.cyan("apiKey")} ${import_picocolors7.default.gray("\u2014 Your Codowave API key")}`);
|
|
7957
|
-
console.log(` ${import_picocolors7.default.cyan("apiUrl")} ${import_picocolors7.default.gray("\u2014 API endpoint URL (default: https://api.codowave.com)")}`);
|
|
7958
|
-
console.log(` ${import_picocolors7.default.cyan("repos")} ${import_picocolors7.default.gray("\u2014 List of configured repositories")}`);
|
|
7959
|
-
console.log(` ${import_picocolors7.default.cyan("autopilot")} ${import_picocolors7.default.gray("\u2014 Enable/disable autopilot mode (true/false)")}`);
|
|
7960
|
-
console.log(` ${import_picocolors7.default.cyan("labels")} ${import_picocolors7.default.gray("\u2014 GitHub labels for agent PRs (comma-separated)")}`);
|
|
7961
|
-
console.log(` ${import_picocolors7.default.cyan("configPath")} ${import_picocolors7.default.gray("\u2014 Path to the config file")}`);
|
|
7962
7966
|
console.log("");
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
}
|
|
7981
|
-
});
|
|
7982
|
-
console.log("");
|
|
7983
|
-
}
|
|
7984
|
-
return;
|
|
7985
|
-
}
|
|
7986
|
-
if (key === "labels") {
|
|
7987
|
-
if (config.labels.length === 0) {
|
|
7988
|
-
console.log(import_picocolors7.default.yellow("No labels configured."));
|
|
7989
|
-
} else {
|
|
7990
|
-
console.log(import_picocolors7.default.bold("\n\u{1F3F7}\uFE0F Configured Labels:\n"));
|
|
7991
|
-
config.labels.forEach((label, index) => {
|
|
7992
|
-
console.log(` ${index + 1}. ${import_picocolors7.default.cyan(label)}`);
|
|
7993
|
-
});
|
|
7994
|
-
console.log("");
|
|
7995
|
-
}
|
|
7996
|
-
return;
|
|
7997
|
-
}
|
|
7998
|
-
const value = config[key];
|
|
7999
|
-
if (value === void 0) {
|
|
8000
|
-
console.error(import_picocolors7.default.red(`\u2716 Unknown config key: ${key}`));
|
|
8001
|
-
console.log(import_picocolors7.default.gray(` Run \`codowave config list\` to see available options.`));
|
|
8002
|
-
process.exit(1);
|
|
8003
|
-
}
|
|
8004
|
-
console.log(value);
|
|
8005
|
-
} catch (err) {
|
|
8006
|
-
console.error(import_picocolors7.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8007
|
-
process.exit(1);
|
|
8008
|
-
}
|
|
8009
|
-
});
|
|
8010
|
-
configCommand.command("set <key> <value>").description("Set a config value").action((key, value) => {
|
|
8011
|
-
try {
|
|
8012
|
-
const validKeys = ["apiKey", "apiUrl", "autopilot", "labels"];
|
|
8013
|
-
if (!validKeys.includes(key)) {
|
|
8014
|
-
console.error(import_picocolors7.default.red(`\u2716 Cannot set '${key}' directly.`));
|
|
8015
|
-
console.log(import_picocolors7.default.gray(` For 'repos', use \`codowave repo add\` to manage repositories.`));
|
|
8016
|
-
console.log(import_picocolors7.default.gray(` Run \`codowave config list\` to see available options.`));
|
|
8017
|
-
process.exit(1);
|
|
8018
|
-
}
|
|
8019
|
-
if (key === "apiUrl") {
|
|
8020
|
-
try {
|
|
8021
|
-
new URL(value);
|
|
8022
|
-
} catch {
|
|
8023
|
-
console.error(import_picocolors7.default.red(`\u2716 Invalid URL: ${value}`));
|
|
8024
|
-
process.exit(1);
|
|
8025
|
-
}
|
|
8026
|
-
}
|
|
8027
|
-
if (key === "autopilot") {
|
|
8028
|
-
if (value !== "true" && value !== "false") {
|
|
8029
|
-
console.error(import_picocolors7.default.red(`\u2716 Invalid value for autopilot: must be 'true' or 'false'`));
|
|
8030
|
-
process.exit(1);
|
|
8031
|
-
}
|
|
8032
|
-
}
|
|
8033
|
-
if (key === "labels") {
|
|
8034
|
-
const labels = value.split(",").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
8035
|
-
const updates2 = { labels };
|
|
8036
|
-
const newConfig2 = updateConfig(updates2);
|
|
8037
|
-
console.log(import_picocolors7.default.green(`\u2713 Updated labels`));
|
|
8038
|
-
console.log(import_picocolors7.default.gray(` labels = ${newConfig2.labels.join(", ")}`));
|
|
8039
|
-
return;
|
|
8040
|
-
}
|
|
8041
|
-
let typedValue = value;
|
|
8042
|
-
if (key === "autopilot") {
|
|
8043
|
-
typedValue = value === "true";
|
|
8044
|
-
}
|
|
8045
|
-
const updates = { [key]: typedValue };
|
|
8046
|
-
const newConfig = updateConfig(updates);
|
|
8047
|
-
console.log(import_picocolors7.default.green(`\u2713 Updated ${key}`));
|
|
8048
|
-
if (key === "apiKey") {
|
|
8049
|
-
console.log(import_picocolors7.default.gray(` ${key} = \u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022`));
|
|
8050
|
-
} else {
|
|
8051
|
-
console.log(import_picocolors7.default.gray(` ${key} = ${newConfig[key]}`));
|
|
8052
|
-
}
|
|
8053
|
-
} catch (err) {
|
|
8054
|
-
console.error(import_picocolors7.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8055
|
-
process.exit(1);
|
|
8056
|
-
}
|
|
8057
|
-
});
|
|
8058
|
-
configCommand.command("show").description("Show all current config values").action(() => {
|
|
8059
|
-
try {
|
|
8060
|
-
const config = readConfigOrThrow();
|
|
8061
|
-
console.log(import_picocolors7.default.bold("\n\u2699\uFE0F Current Configuration:\n"));
|
|
8062
|
-
console.log(` ${import_picocolors7.default.cyan("apiKey")}: ${config.apiKey ? import_picocolors7.default.green("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") + import_picocolors7.default.gray(" (hidden)") : import_picocolors7.default.yellow("not set")}`);
|
|
8063
|
-
console.log(` ${import_picocolors7.default.cyan("apiUrl")}: ${config.apiUrl}`);
|
|
8064
|
-
console.log(` ${import_picocolors7.default.cyan("autopilot")}: ${config.autopilot ? import_picocolors7.default.green("enabled") : import_picocolors7.default.yellow("disabled")}`);
|
|
8065
|
-
console.log(` ${import_picocolors7.default.cyan("labels")}: ${config.labels.join(", ") || import_picocolors7.default.yellow("not set")}`);
|
|
8066
|
-
console.log(` ${import_picocolors7.default.cyan("repos")}: ${config.repos.length} repository(s) configured`);
|
|
8067
|
-
console.log(` ${import_picocolors7.default.cyan("configPath")}: ${import_picocolors7.default.gray(getConfigPath())}`);
|
|
8068
|
-
if (config.repos.length > 0) {
|
|
8069
|
-
console.log(import_picocolors7.default.bold(import_picocolors7.default.gray("\n Repositories:")));
|
|
8070
|
-
config.repos.forEach((repo) => {
|
|
8071
|
-
console.log(` \u2022 ${repo.owner}/${repo.name}${repo.id ? import_picocolors7.default.gray(` (${repo.id})`) : ""}`);
|
|
8072
|
-
});
|
|
8073
|
-
}
|
|
8074
|
-
if (config.labels.length > 0) {
|
|
8075
|
-
console.log(import_picocolors7.default.bold(import_picocolors7.default.gray("\n Labels:")));
|
|
8076
|
-
config.labels.forEach((label) => {
|
|
8077
|
-
console.log(` \u2022 ${label}`);
|
|
8078
|
-
});
|
|
8079
|
-
}
|
|
8080
|
-
console.log("");
|
|
8081
|
-
} catch (err) {
|
|
8082
|
-
console.error(import_picocolors7.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8083
|
-
process.exit(1);
|
|
7967
|
+
return;
|
|
7968
|
+
}
|
|
7969
|
+
console.log(import_picocolors5.default.bold("\n=== Logs: " + run.id + " ===\n"));
|
|
7970
|
+
console.log(import_picocolors5.default.bold("Issue: ") + run.issue);
|
|
7971
|
+
console.log(import_picocolors5.default.bold("Status: ") + run.status);
|
|
7972
|
+
console.log("");
|
|
7973
|
+
for (const stage of run.stages) {
|
|
7974
|
+
const statusIcon = stage.status === "completed" ? "[+]" : stage.status === "failed" ? "[x]" : stage.status === "running" ? "[~]" : "[ ]";
|
|
7975
|
+
console.log(import_picocolors5.default.bold("\n" + statusIcon + " " + stage.name + "\n"));
|
|
7976
|
+
if (stage.logs) {
|
|
7977
|
+
console.log(stage.logs);
|
|
7978
|
+
} else if (stage.status === "pending") {
|
|
7979
|
+
console.log(import_picocolors5.default.gray("(pending)"));
|
|
7980
|
+
} else if (stage.status === "running") {
|
|
7981
|
+
console.log(import_picocolors5.default.blue("(running...)"));
|
|
7982
|
+
} else if (stage.status === "skipped") {
|
|
7983
|
+
console.log(import_picocolors5.default.gray("(skipped)"));
|
|
8084
7984
|
}
|
|
8085
|
-
}
|
|
7985
|
+
}
|
|
7986
|
+
if (_options?.follow && run.status === "in_progress") {
|
|
7987
|
+
console.log(import_picocolors5.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
7988
|
+
console.log(import_picocolors5.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
7989
|
+
let dots = 0;
|
|
7990
|
+
const interval = setInterval(() => {
|
|
7991
|
+
dots = (dots + 1) % 4;
|
|
7992
|
+
process.stdout.write(import_picocolors5.default.blue("\r" + " ".repeat(dots) + " waiting for updates..."));
|
|
7993
|
+
}, 500);
|
|
7994
|
+
process.on("SIGINT", () => {
|
|
7995
|
+
clearInterval(interval);
|
|
7996
|
+
console.log(import_picocolors5.default.gray("\n\n(Stopped following)"));
|
|
7997
|
+
process.exit(0);
|
|
7998
|
+
});
|
|
7999
|
+
}
|
|
8000
|
+
console.log("");
|
|
8001
|
+
} catch (err) {
|
|
8002
|
+
handleError(err, "logs");
|
|
8086
8003
|
}
|
|
8087
8004
|
});
|
|
8088
8005
|
|
|
8089
|
-
// src/commands/
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
});
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
}
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
try {
|
|
8113
|
-
console.log(import_picocolors8.default.bold("\n\u{1F517} Codowave Connect\n"));
|
|
8114
|
-
console.log(import_picocolors8.default.gray("This command upgrades your OSS installation to Codowave Pro.\n"));
|
|
8115
|
-
const config = readConfig();
|
|
8116
|
-
const isAlreadyPro = config?.apiUrl === PRO_API_URL;
|
|
8117
|
-
if (isAlreadyPro) {
|
|
8118
|
-
console.log(import_picocolors8.default.green("\u2713 You are already connected to Codowave Pro!"));
|
|
8119
|
-
console.log(import_picocolors8.default.gray(` API URL: ${config?.apiUrl}`));
|
|
8120
|
-
console.log("");
|
|
8121
|
-
return;
|
|
8122
|
-
}
|
|
8123
|
-
console.log(import_picocolors8.default.blue("Starting OAuth device flow...\n"));
|
|
8124
|
-
console.log(import_picocolors8.default.gray(" 1. Requesting device code..."));
|
|
8125
|
-
const deviceCode = `CODOWAVE-${Date.now().toString(36).toUpperCase()}`;
|
|
8126
|
-
const verificationUri = "https://codowave.com/activate";
|
|
8127
|
-
console.log(import_picocolors8.default.green("\n \u26A0\uFE0F Device Code: ") + import_picocolors8.default.bold(deviceCode));
|
|
8128
|
-
console.log(import_picocolors8.default.gray("\n 2. Please visit: ") + import_picocolors8.default.cyan(verificationUri));
|
|
8129
|
-
console.log(import_picocolors8.default.gray(" and enter the device code above.\n"));
|
|
8130
|
-
console.log(import_picocolors8.default.yellow(" \u2139\uFE0F This is a stub implementation."));
|
|
8131
|
-
console.log(import_picocolors8.default.gray(" In production, this would poll for OAuth completion.\n"));
|
|
8132
|
-
console.log(import_picocolors8.default.blue(" 3. Would save Pro token and switch API URL...\n"));
|
|
8133
|
-
console.log(import_picocolors8.default.bold("What would happen:\n"));
|
|
8134
|
-
console.log(` \u2022 Save Pro API token to ${getConfigPath()}`);
|
|
8135
|
-
console.log(` \u2022 Set apiUrl to ${PRO_API_URL}`);
|
|
8136
|
-
console.log("");
|
|
8137
|
-
console.log(import_picocolors8.default.gray("Run with ") + import_picocolors8.default.cyan("CODOWAVE_CONNECT=1") + import_picocolors8.default.gray(" to enable (not implemented yet)"));
|
|
8138
|
-
console.log("");
|
|
8139
|
-
} catch (err) {
|
|
8140
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
8141
|
-
console.error(import_picocolors8.default.red(`
|
|
8142
|
-
\u2716 Error: ${message}
|
|
8143
|
-
`));
|
|
8144
|
-
process.exit(1);
|
|
8145
|
-
}
|
|
8146
|
-
});
|
|
8006
|
+
// src/commands/config-cmd.ts
|
|
8007
|
+
init_esm();
|
|
8008
|
+
var import_picocolors6 = __toESM(require_picocolors());
|
|
8009
|
+
init_config();
|
|
8010
|
+
var configCommand = new Command("config").description("Get or set Codowave configuration values");
|
|
8011
|
+
configCommand.action(() => {
|
|
8012
|
+
try {
|
|
8013
|
+
const config = readConfig();
|
|
8014
|
+
if (config) {
|
|
8015
|
+
console.log(import_picocolors6.default.bold("\n\u2699\uFE0F Current Configuration:\n"));
|
|
8016
|
+
console.log(` ${import_picocolors6.default.cyan("apiKey")}: ${config.apiKey ? import_picocolors6.default.green("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") + import_picocolors6.default.gray(" (hidden)") : import_picocolors6.default.yellow("not set")}`);
|
|
8017
|
+
console.log(` ${import_picocolors6.default.cyan("apiUrl")}: ${config.apiUrl}`);
|
|
8018
|
+
console.log(` ${import_picocolors6.default.cyan("autopilot")}: ${config.autopilot ? import_picocolors6.default.green("enabled") : import_picocolors6.default.yellow("disabled")}`);
|
|
8019
|
+
console.log(` ${import_picocolors6.default.cyan("labels")}: ${config.labels?.join(", ") || import_picocolors6.default.yellow("not set")}`);
|
|
8020
|
+
console.log(` ${import_picocolors6.default.cyan("repos")}: ${config.repos.length} repository(s) configured`);
|
|
8021
|
+
console.log(import_picocolors6.default.gray("\n To reconfigure, run: ") + import_picocolors6.default.bold("codowave init") + import_picocolors6.default.gray("\n"));
|
|
8022
|
+
} else {
|
|
8023
|
+
console.log(import_picocolors6.default.yellow("\n\u26A0 No configuration found.\n"));
|
|
8024
|
+
console.log(import_picocolors6.default.gray(" Run ") + import_picocolors6.default.bold("codowave init") + import_picocolors6.default.gray(" to get started.\n"));
|
|
8025
|
+
}
|
|
8026
|
+
} catch {
|
|
8027
|
+
console.log(import_picocolors6.default.yellow("\n\u26A0 No configuration found.\n"));
|
|
8028
|
+
console.log(import_picocolors6.default.gray(" Run ") + import_picocolors6.default.bold("codowave init") + import_picocolors6.default.gray(" to get started.\n"));
|
|
8147
8029
|
}
|
|
8148
8030
|
});
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8031
|
+
configCommand.command("list").description("List all available config options").action(() => {
|
|
8032
|
+
console.log(import_picocolors6.default.bold("\n\u{1F4CB} Available Config Options:\n"));
|
|
8033
|
+
console.log(` ${import_picocolors6.default.cyan("apiKey")} ${import_picocolors6.default.gray("\u2014 Your Codowave API key")}`);
|
|
8034
|
+
console.log(` ${import_picocolors6.default.cyan("apiUrl")} ${import_picocolors6.default.gray("\u2014 API endpoint URL (default: https://api.codowave.com)")}`);
|
|
8035
|
+
console.log(` ${import_picocolors6.default.cyan("repos")} ${import_picocolors6.default.gray("\u2014 List of configured repositories")}`);
|
|
8036
|
+
console.log(` ${import_picocolors6.default.cyan("autopilot")} ${import_picocolors6.default.gray("\u2014 Enable/disable autopilot mode (true/false)")}`);
|
|
8037
|
+
console.log(` ${import_picocolors6.default.cyan("labels")} ${import_picocolors6.default.gray("\u2014 GitHub labels for agent PRs (comma-separated)")}`);
|
|
8038
|
+
console.log(` ${import_picocolors6.default.cyan("configPath")} ${import_picocolors6.default.gray("\u2014 Path to the config file")}`);
|
|
8039
|
+
console.log("");
|
|
8154
8040
|
});
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
"
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
console.log(import_picocolors9.default.yellow("\n\u26A0 No repositories configured.\n"));
|
|
8168
|
-
console.log(import_picocolors9.default.gray(" Run ") + import_picocolors9.default.bold("codowave repo add <owner/repo>") + import_picocolors9.default.gray(" to add a repository.\n"));
|
|
8169
|
-
return;
|
|
8170
|
-
}
|
|
8171
|
-
console.log(import_picocolors9.default.bold("\n\u{1F4E6} Managed Repositories:\n"));
|
|
8041
|
+
configCommand.command("get <key>").description("Get a config value").action((key) => {
|
|
8042
|
+
try {
|
|
8043
|
+
const config = readConfigOrThrow();
|
|
8044
|
+
if (key === "configPath") {
|
|
8045
|
+
console.log(import_picocolors6.default.green(getConfigPath()));
|
|
8046
|
+
return;
|
|
8047
|
+
}
|
|
8048
|
+
if (key === "repos") {
|
|
8049
|
+
if (config.repos.length === 0) {
|
|
8050
|
+
console.log(import_picocolors6.default.yellow("No repos configured."));
|
|
8051
|
+
} else {
|
|
8052
|
+
console.log(import_picocolors6.default.bold("\n\u{1F4E6} Configured Repositories:\n"));
|
|
8172
8053
|
config.repos.forEach((repo, index) => {
|
|
8173
|
-
console.log(` ${index + 1}. ${
|
|
8054
|
+
console.log(` ${index + 1}. ${import_picocolors6.default.cyan(`${repo.owner}/${repo.name}`)}`);
|
|
8174
8055
|
if (repo.id) {
|
|
8175
|
-
console.log(` ${
|
|
8056
|
+
console.log(` ${import_picocolors6.default.gray("ID: " + repo.id)}`);
|
|
8176
8057
|
}
|
|
8177
8058
|
});
|
|
8178
8059
|
console.log("");
|
|
8179
|
-
} catch (err) {
|
|
8180
|
-
console.error(import_picocolors9.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8181
|
-
process.exit(1);
|
|
8182
|
-
}
|
|
8183
|
-
});
|
|
8184
|
-
repoCommand.command("add <owner/repo>").description("Add a repository (format: owner/repo)").action((repoArg) => {
|
|
8185
|
-
try {
|
|
8186
|
-
const parts = repoArg.split("/");
|
|
8187
|
-
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
8188
|
-
console.error(import_picocolors9.default.red(`\u2716 Invalid repository format. Use: owner/repo`));
|
|
8189
|
-
console.log(import_picocolors9.default.gray(" Example: codowave repo add octocat/Hello-World"));
|
|
8190
|
-
process.exit(1);
|
|
8191
|
-
}
|
|
8192
|
-
const owner = parts[0];
|
|
8193
|
-
const name = parts[1];
|
|
8194
|
-
const config = readConfigOrThrow();
|
|
8195
|
-
const exists = config.repos.some(
|
|
8196
|
-
(r) => r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase()
|
|
8197
|
-
);
|
|
8198
|
-
if (exists) {
|
|
8199
|
-
console.error(import_picocolors9.default.red(`\u2716 Repository ${repoArg} is already configured.`));
|
|
8200
|
-
process.exit(1);
|
|
8201
|
-
}
|
|
8202
|
-
const newRepo = { owner, name };
|
|
8203
|
-
const updatedRepos = [...config.repos, newRepo];
|
|
8204
|
-
updateConfig({ repos: updatedRepos });
|
|
8205
|
-
console.log(import_picocolors9.default.green(`
|
|
8206
|
-
\u2713 Added repository ${repoArg}
|
|
8207
|
-
`));
|
|
8208
|
-
} catch (err) {
|
|
8209
|
-
console.error(import_picocolors9.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8210
|
-
process.exit(1);
|
|
8211
8060
|
}
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
const config = readConfigOrThrow();
|
|
8224
|
-
const exists = config.repos.some(
|
|
8225
|
-
(r) => r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase()
|
|
8226
|
-
);
|
|
8227
|
-
if (!exists) {
|
|
8228
|
-
console.error(import_picocolors9.default.red(`\u2716 Repository ${repoArg} is not configured.`));
|
|
8229
|
-
console.log(import_picocolors9.default.gray(" Run ") + import_picocolors9.default.bold("codowave repo list") + import_picocolors9.default.gray(" to see configured repositories.\n"));
|
|
8230
|
-
process.exit(1);
|
|
8231
|
-
}
|
|
8232
|
-
const updatedRepos = config.repos.filter(
|
|
8233
|
-
(r) => !(r.owner.toLowerCase() === owner.toLowerCase() && r.name.toLowerCase() === name.toLowerCase())
|
|
8234
|
-
);
|
|
8235
|
-
updateConfig({ repos: updatedRepos });
|
|
8236
|
-
console.log(import_picocolors9.default.green(`
|
|
8237
|
-
\u2713 Removed repository ${repoArg}
|
|
8238
|
-
`));
|
|
8239
|
-
} catch (err) {
|
|
8240
|
-
console.error(import_picocolors9.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8241
|
-
process.exit(1);
|
|
8061
|
+
return;
|
|
8062
|
+
}
|
|
8063
|
+
if (key === "labels") {
|
|
8064
|
+
if (config.labels.length === 0) {
|
|
8065
|
+
console.log(import_picocolors6.default.yellow("No labels configured."));
|
|
8066
|
+
} else {
|
|
8067
|
+
console.log(import_picocolors6.default.bold("\n\u{1F3F7}\uFE0F Configured Labels:\n"));
|
|
8068
|
+
config.labels.forEach((label, index) => {
|
|
8069
|
+
console.log(` ${index + 1}. ${import_picocolors6.default.cyan(label)}`);
|
|
8070
|
+
});
|
|
8071
|
+
console.log("");
|
|
8242
8072
|
}
|
|
8243
|
-
|
|
8073
|
+
return;
|
|
8074
|
+
}
|
|
8075
|
+
const value = config[key];
|
|
8076
|
+
if (value === void 0) {
|
|
8077
|
+
console.error(import_picocolors6.default.red(`\u2716 Unknown config key: ${key}`));
|
|
8078
|
+
console.log(import_picocolors6.default.gray(` Run \`codowave config list\` to see available options.`));
|
|
8079
|
+
process.exit(1);
|
|
8080
|
+
}
|
|
8081
|
+
console.log(value);
|
|
8082
|
+
} catch (err) {
|
|
8083
|
+
console.error(import_picocolors6.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8084
|
+
process.exit(1);
|
|
8244
8085
|
}
|
|
8245
8086
|
});
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
"
|
|
8256
|
-
init_esm();
|
|
8257
|
-
import_picocolors10 = __toESM(require_picocolors());
|
|
8258
|
-
init_config();
|
|
8259
|
-
autopilotCommand = new Command("autopilot").description("Toggle autopilot mode");
|
|
8260
|
-
autopilotCommand.command("enable").description("Enable autopilot mode").action(() => {
|
|
8261
|
-
try {
|
|
8262
|
-
updateConfig({ autopilot: true });
|
|
8263
|
-
console.log(import_picocolors10.default.green("\n\u2713 Autopilot enabled\n"));
|
|
8264
|
-
console.log(import_picocolors10.default.gray(" Codowave will automatically process PRs and issues.\n"));
|
|
8265
|
-
} catch (err) {
|
|
8266
|
-
console.error(import_picocolors10.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8267
|
-
process.exit(1);
|
|
8268
|
-
}
|
|
8269
|
-
});
|
|
8270
|
-
autopilotCommand.command("disable").description("Disable autopilot mode").action(() => {
|
|
8087
|
+
configCommand.command("set <key> <value>").description("Set a config value").action((key, value) => {
|
|
8088
|
+
try {
|
|
8089
|
+
const validKeys = ["apiKey", "apiUrl", "autopilot", "labels"];
|
|
8090
|
+
if (!validKeys.includes(key)) {
|
|
8091
|
+
console.error(import_picocolors6.default.red(`\u2716 Cannot set '${key}' directly.`));
|
|
8092
|
+
console.log(import_picocolors6.default.gray(` For 'repos', use \`codowave repo add\` to manage repositories.`));
|
|
8093
|
+
console.log(import_picocolors6.default.gray(` Run \`codowave config list\` to see available options.`));
|
|
8094
|
+
process.exit(1);
|
|
8095
|
+
}
|
|
8096
|
+
if (key === "apiUrl") {
|
|
8271
8097
|
try {
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
console.error(import_picocolors10.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8098
|
+
new URL(value);
|
|
8099
|
+
} catch {
|
|
8100
|
+
console.error(import_picocolors6.default.red(`\u2716 Invalid URL: ${value}`));
|
|
8276
8101
|
process.exit(1);
|
|
8277
8102
|
}
|
|
8278
|
-
}
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
// src/commands/labels-cmd.ts
|
|
8283
|
-
var labels_cmd_exports = {};
|
|
8284
|
-
__export(labels_cmd_exports, {
|
|
8285
|
-
labelsCommand: () => labelsCommand
|
|
8286
|
-
});
|
|
8287
|
-
var import_picocolors11, labelsCommand;
|
|
8288
|
-
var init_labels_cmd = __esm({
|
|
8289
|
-
"src/commands/labels-cmd.ts"() {
|
|
8290
|
-
"use strict";
|
|
8291
|
-
init_esm();
|
|
8292
|
-
import_picocolors11 = __toESM(require_picocolors());
|
|
8293
|
-
init_config();
|
|
8294
|
-
labelsCommand = new Command("labels").description("Configure GitHub labels for agent activity");
|
|
8295
|
-
labelsCommand.command("set <labels>").description("Set GitHub labels (comma-separated)").action((labelsArg) => {
|
|
8296
|
-
try {
|
|
8297
|
-
const labels = labelsArg.split(",").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
8298
|
-
if (labels.length === 0) {
|
|
8299
|
-
console.error(import_picocolors11.default.red("\u2716 No labels provided."));
|
|
8300
|
-
console.log(import_picocolors11.default.gray(" Example: codowave labels set codowave-agent,needs-review"));
|
|
8301
|
-
process.exit(1);
|
|
8302
|
-
}
|
|
8303
|
-
updateConfig({ labels });
|
|
8304
|
-
console.log(import_picocolors11.default.green("\n\u2713 Labels updated\n"));
|
|
8305
|
-
console.log(import_picocolors11.default.gray(" Labels: ") + import_picocolors11.default.cyan(labels.join(", ")) + "\n");
|
|
8306
|
-
} catch (err) {
|
|
8307
|
-
console.error(import_picocolors11.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8103
|
+
}
|
|
8104
|
+
if (key === "autopilot") {
|
|
8105
|
+
if (value !== "true" && value !== "false") {
|
|
8106
|
+
console.error(import_picocolors6.default.red(`\u2716 Invalid value for autopilot: must be 'true' or 'false'`));
|
|
8308
8107
|
process.exit(1);
|
|
8309
8108
|
}
|
|
8310
|
-
}
|
|
8109
|
+
}
|
|
8110
|
+
if (key === "labels") {
|
|
8111
|
+
const labels = value.split(",").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
8112
|
+
const updates2 = { labels };
|
|
8113
|
+
const newConfig2 = updateConfig(updates2);
|
|
8114
|
+
console.log(import_picocolors6.default.green(`\u2713 Updated labels`));
|
|
8115
|
+
console.log(import_picocolors6.default.gray(` labels = ${newConfig2.labels.join(", ")}`));
|
|
8116
|
+
return;
|
|
8117
|
+
}
|
|
8118
|
+
let typedValue = value;
|
|
8119
|
+
if (key === "autopilot") {
|
|
8120
|
+
typedValue = value === "true";
|
|
8121
|
+
}
|
|
8122
|
+
const updates = { [key]: typedValue };
|
|
8123
|
+
const newConfig = updateConfig(updates);
|
|
8124
|
+
console.log(import_picocolors6.default.green(`\u2713 Updated ${key}`));
|
|
8125
|
+
if (key === "apiKey") {
|
|
8126
|
+
console.log(import_picocolors6.default.gray(` ${key} = \u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022`));
|
|
8127
|
+
} else {
|
|
8128
|
+
console.log(import_picocolors6.default.gray(` ${key} = ${newConfig[key]}`));
|
|
8129
|
+
}
|
|
8130
|
+
} catch (err) {
|
|
8131
|
+
console.error(import_picocolors6.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8132
|
+
process.exit(1);
|
|
8311
8133
|
}
|
|
8312
8134
|
});
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
});
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
"
|
|
8322
|
-
"
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
stages: [
|
|
8340
|
-
{ name: "context", status: "completed" },
|
|
8341
|
-
{ name: "planning", status: "completed" },
|
|
8342
|
-
{ name: "implementation", status: "running" },
|
|
8343
|
-
{ name: "testing", status: "pending" },
|
|
8344
|
-
{ name: "pr-creation", status: "pending" }
|
|
8345
|
-
]
|
|
8346
|
-
},
|
|
8347
|
-
{
|
|
8348
|
-
id: "abc-123-def",
|
|
8349
|
-
repo: "CodowaveAI/Codowave",
|
|
8350
|
-
status: "completed",
|
|
8351
|
-
issue: "#52: Add authentication flow",
|
|
8352
|
-
prNumber: 78,
|
|
8353
|
-
prTitle: "feat: Add OAuth authentication flow",
|
|
8354
|
-
branchName: "feat/auth-flow",
|
|
8355
|
-
startedAt: new Date(Date.now() - 60 * 60 * 1e3).toISOString(),
|
|
8356
|
-
completedAt: new Date(Date.now() - 45 * 60 * 1e3).toISOString(),
|
|
8357
|
-
stages: [
|
|
8358
|
-
{ name: "context", status: "completed" },
|
|
8359
|
-
{ name: "planning", status: "completed" },
|
|
8360
|
-
{ name: "implementation", status: "completed" },
|
|
8361
|
-
{ name: "testing", status: "completed" },
|
|
8362
|
-
{ name: "pr-creation", status: "completed" }
|
|
8363
|
-
]
|
|
8364
|
-
},
|
|
8365
|
-
{
|
|
8366
|
-
id: "xyz-789-ghi",
|
|
8367
|
-
repo: "CodowaveAI/Codowave",
|
|
8368
|
-
status: "failed",
|
|
8369
|
-
issue: "#51: Fix memory leak",
|
|
8370
|
-
branchName: "fix/memory-leak",
|
|
8371
|
-
startedAt: new Date(Date.now() - 120 * 60 * 1e3).toISOString(),
|
|
8372
|
-
completedAt: new Date(Date.now() - 100 * 60 * 1e3).toISOString(),
|
|
8373
|
-
errorMessage: "Test suite failed: 3 tests failed",
|
|
8374
|
-
stages: [
|
|
8375
|
-
{ name: "context", status: "completed" },
|
|
8376
|
-
{ name: "planning", status: "completed" },
|
|
8377
|
-
{ name: "implementation", status: "completed" },
|
|
8378
|
-
{ name: "testing", status: "failed" },
|
|
8379
|
-
{ name: "pr-creation", status: "skipped" }
|
|
8380
|
-
]
|
|
8381
|
-
}
|
|
8382
|
-
];
|
|
8383
|
-
let filteredRuns = demoRuns3;
|
|
8384
|
-
if (options.repo) {
|
|
8385
|
-
filteredRuns = filteredRuns.filter((r) => r.repo === options.repo);
|
|
8386
|
-
}
|
|
8387
|
-
if (options.status) {
|
|
8388
|
-
filteredRuns = filteredRuns.filter((r) => r.status === options.status);
|
|
8389
|
-
}
|
|
8390
|
-
filteredRuns = filteredRuns.slice(0, limit);
|
|
8391
|
-
if (filteredRuns.length === 0) {
|
|
8392
|
-
console.log(import_picocolors12.default.yellow("\nNo runs found.\n"));
|
|
8393
|
-
return;
|
|
8394
|
-
}
|
|
8395
|
-
console.log(import_picocolors12.default.bold("\n\u{1F4CB} Recent Runs\n"));
|
|
8396
|
-
console.log(
|
|
8397
|
-
import_picocolors12.default.gray(" ID ") + " " + import_picocolors12.default.gray("Status ") + " " + import_picocolors12.default.gray("Issue")
|
|
8398
|
-
);
|
|
8399
|
-
console.log(import_picocolors12.default.gray(" ").padEnd(60, "\u2500"));
|
|
8400
|
-
for (const run of filteredRuns) {
|
|
8401
|
-
const statusColor = run.status === "completed" ? import_picocolors12.default.green : run.status === "failed" ? import_picocolors12.default.red : run.status === "in_progress" ? import_picocolors12.default.blue : import_picocolors12.default.gray;
|
|
8402
|
-
console.log(
|
|
8403
|
-
` ${run.id.padEnd(13)} ${statusColor(run.status.padEnd(11))} ${run.issue.substring(0, 40)}`
|
|
8404
|
-
);
|
|
8405
|
-
}
|
|
8406
|
-
console.log("");
|
|
8407
|
-
} catch (err) {
|
|
8408
|
-
handleError(err, "runs list");
|
|
8409
|
-
}
|
|
8410
|
-
});
|
|
8411
|
-
runsCommand.command("logs <run-id>").description("View logs for a specific run").option("-f, --follow", "Follow log output (stream)").option("-s, --stage <name>", "Show logs for a specific stage").action(async (runId, options) => {
|
|
8412
|
-
try {
|
|
8413
|
-
const run = getRun(runId);
|
|
8414
|
-
if (!run) {
|
|
8415
|
-
console.log(import_picocolors12.default.red(`Run "${runId}" not found.`));
|
|
8416
|
-
console.log(import_picocolors12.default.gray(" Run `codowave runs list` to see available runs.\n"));
|
|
8417
|
-
process.exit(1);
|
|
8418
|
-
}
|
|
8419
|
-
if (options.stage) {
|
|
8420
|
-
const stage = run.stages.find((s) => s.name === options.stage);
|
|
8421
|
-
if (!stage) {
|
|
8422
|
-
console.log(import_picocolors12.default.red(`Stage "${options.stage}" not found.`));
|
|
8423
|
-
console.log(import_picocolors12.default.gray("Available stages: ") + run.stages.map((s) => s.name).join(", "));
|
|
8424
|
-
return;
|
|
8425
|
-
}
|
|
8426
|
-
console.log(import_picocolors12.default.bold("\n=== Logs: " + stage.name + " ===\n"));
|
|
8427
|
-
console.log(import_picocolors12.default.bold("Status: ") + stage.status);
|
|
8428
|
-
if (stage.logs) {
|
|
8429
|
-
console.log(import_picocolors12.default.gray("\n--- Output ---\n"));
|
|
8430
|
-
console.log(stage.logs);
|
|
8431
|
-
} else {
|
|
8432
|
-
console.log(import_picocolors12.default.gray("\n(no logs available yet)"));
|
|
8433
|
-
}
|
|
8434
|
-
if (options.follow && stage.status === "running") {
|
|
8435
|
-
console.log(import_picocolors12.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
8436
|
-
console.log(import_picocolors12.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
8437
|
-
}
|
|
8438
|
-
console.log("");
|
|
8439
|
-
return;
|
|
8440
|
-
}
|
|
8441
|
-
console.log(import_picocolors12.default.bold("\n=== Logs: " + run.id + " ===\n"));
|
|
8442
|
-
console.log(import_picocolors12.default.bold("Issue: ") + run.issue);
|
|
8443
|
-
console.log(import_picocolors12.default.bold("Status: ") + run.status);
|
|
8444
|
-
console.log("");
|
|
8445
|
-
for (const stage of run.stages) {
|
|
8446
|
-
const statusIcon = stage.status === "completed" ? "[+]" : stage.status === "failed" ? "[x]" : stage.status === "running" ? "[~]" : "[ ]";
|
|
8447
|
-
console.log(import_picocolors12.default.bold("\n" + statusIcon + " " + stage.name + "\n"));
|
|
8448
|
-
if (stage.logs) {
|
|
8449
|
-
console.log(stage.logs);
|
|
8450
|
-
} else if (stage.status === "pending") {
|
|
8451
|
-
console.log(import_picocolors12.default.gray("(pending)"));
|
|
8452
|
-
} else if (stage.status === "running") {
|
|
8453
|
-
console.log(import_picocolors12.default.blue("(running...)"));
|
|
8454
|
-
} else if (stage.status === "skipped") {
|
|
8455
|
-
console.log(import_picocolors12.default.gray("(skipped)"));
|
|
8456
|
-
}
|
|
8457
|
-
}
|
|
8458
|
-
if (options.follow && run.status === "in_progress") {
|
|
8459
|
-
console.log(import_picocolors12.default.blue("\n--- Following live logs (Ctrl+C to exit) ---\n"));
|
|
8460
|
-
console.log(import_picocolors12.default.gray("(Live streaming would connect to API SSE endpoint in production)"));
|
|
8461
|
-
}
|
|
8462
|
-
console.log("");
|
|
8463
|
-
} catch (err) {
|
|
8464
|
-
handleError(err, "runs logs");
|
|
8465
|
-
}
|
|
8466
|
-
});
|
|
8467
|
-
runsCommand.action(() => {
|
|
8468
|
-
runsCommand.help();
|
|
8469
|
-
});
|
|
8135
|
+
configCommand.command("show").description("Show all current config values").action(() => {
|
|
8136
|
+
try {
|
|
8137
|
+
const config = readConfigOrThrow();
|
|
8138
|
+
console.log(import_picocolors6.default.bold("\n\u2699\uFE0F Current Configuration:\n"));
|
|
8139
|
+
console.log(` ${import_picocolors6.default.cyan("apiKey")}: ${config.apiKey ? import_picocolors6.default.green("\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022") + import_picocolors6.default.gray(" (hidden)") : import_picocolors6.default.yellow("not set")}`);
|
|
8140
|
+
console.log(` ${import_picocolors6.default.cyan("apiUrl")}: ${config.apiUrl}`);
|
|
8141
|
+
console.log(` ${import_picocolors6.default.cyan("autopilot")}: ${config.autopilot ? import_picocolors6.default.green("enabled") : import_picocolors6.default.yellow("disabled")}`);
|
|
8142
|
+
console.log(` ${import_picocolors6.default.cyan("labels")}: ${config.labels.join(", ") || import_picocolors6.default.yellow("not set")}`);
|
|
8143
|
+
console.log(` ${import_picocolors6.default.cyan("repos")}: ${config.repos.length} repository(s) configured`);
|
|
8144
|
+
console.log(` ${import_picocolors6.default.cyan("configPath")}: ${import_picocolors6.default.gray(getConfigPath())}`);
|
|
8145
|
+
if (config.repos.length > 0) {
|
|
8146
|
+
console.log(import_picocolors6.default.bold(import_picocolors6.default.gray("\n Repositories:")));
|
|
8147
|
+
config.repos.forEach((repo) => {
|
|
8148
|
+
console.log(` \u2022 ${repo.owner}/${repo.name}${repo.id ? import_picocolors6.default.gray(` (${repo.id})`) : ""}`);
|
|
8149
|
+
});
|
|
8150
|
+
}
|
|
8151
|
+
if (config.labels.length > 0) {
|
|
8152
|
+
console.log(import_picocolors6.default.bold(import_picocolors6.default.gray("\n Labels:")));
|
|
8153
|
+
config.labels.forEach((label) => {
|
|
8154
|
+
console.log(` \u2022 ${label}`);
|
|
8155
|
+
});
|
|
8156
|
+
}
|
|
8157
|
+
console.log("");
|
|
8158
|
+
} catch (err) {
|
|
8159
|
+
console.error(import_picocolors6.default.red(`\u2716 ${err instanceof Error ? err.message : String(err)}`));
|
|
8160
|
+
process.exit(1);
|
|
8470
8161
|
}
|
|
8471
8162
|
});
|
|
8472
8163
|
|
|
8473
|
-
// src/
|
|
8164
|
+
// src/commands/connect.ts
|
|
8474
8165
|
init_esm();
|
|
8475
|
-
var
|
|
8166
|
+
var import_picocolors7 = __toESM(require_picocolors());
|
|
8476
8167
|
init_config();
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
const message = reason instanceof Error ? reason.message : String(reason);
|
|
8490
|
-
const stack = reason instanceof Error ? reason.stack : void 0;
|
|
8491
|
-
console.error(import_picocolors2.default.red("\n\u{1F4A5} Unhandled Promise Rejection"));
|
|
8492
|
-
if (stack) {
|
|
8493
|
-
console.error(import_picocolors2.default.gray(stack));
|
|
8494
|
-
} else {
|
|
8495
|
-
console.error(import_picocolors2.default.gray(`Reason: ${message}`));
|
|
8168
|
+
var PRO_API_URL = "https://api.codowave.com";
|
|
8169
|
+
var connectCommand = new Command("connect").description("Connect to Codowave Pro (upgrade from OSS)").action(async () => {
|
|
8170
|
+
try {
|
|
8171
|
+
console.log(import_picocolors7.default.bold("\n\u{1F517} Codowave Connect\n"));
|
|
8172
|
+
console.log(import_picocolors7.default.gray("This command upgrades your OSS installation to Codowave Pro.\n"));
|
|
8173
|
+
const config = readConfig();
|
|
8174
|
+
const isAlreadyPro = config?.apiUrl === PRO_API_URL;
|
|
8175
|
+
if (isAlreadyPro) {
|
|
8176
|
+
console.log(import_picocolors7.default.green("\u2713 You are already connected to Codowave Pro!"));
|
|
8177
|
+
console.log(import_picocolors7.default.gray(` API URL: ${config?.apiUrl}`));
|
|
8178
|
+
console.log("");
|
|
8179
|
+
return;
|
|
8496
8180
|
}
|
|
8497
|
-
console.
|
|
8498
|
-
console.
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8181
|
+
console.log(import_picocolors7.default.blue("Starting OAuth device flow...\n"));
|
|
8182
|
+
console.log(import_picocolors7.default.gray(" 1. Requesting device code..."));
|
|
8183
|
+
const deviceCode = `CODOWAVE-${Date.now().toString(36).toUpperCase()}`;
|
|
8184
|
+
const verificationUri = "https://codowave.com/activate";
|
|
8185
|
+
console.log(import_picocolors7.default.green("\n \u26A0\uFE0F Device Code: ") + import_picocolors7.default.bold(deviceCode));
|
|
8186
|
+
console.log(import_picocolors7.default.gray("\n 2. Please visit: ") + import_picocolors7.default.cyan(verificationUri));
|
|
8187
|
+
console.log(import_picocolors7.default.gray(" and enter the device code above.\n"));
|
|
8188
|
+
console.log(import_picocolors7.default.yellow(" \u2139\uFE0F This is a stub implementation."));
|
|
8189
|
+
console.log(import_picocolors7.default.gray(" In production, this would poll for OAuth completion.\n"));
|
|
8190
|
+
console.log(import_picocolors7.default.blue(" 3. Would save Pro token and switch API URL...\n"));
|
|
8191
|
+
console.log(import_picocolors7.default.bold("What would happen:\n"));
|
|
8192
|
+
console.log(` \u2022 Save Pro API token to ${getConfigPath()}`);
|
|
8193
|
+
console.log(` \u2022 Set apiUrl to ${PRO_API_URL}`);
|
|
8194
|
+
console.log("");
|
|
8195
|
+
console.log(import_picocolors7.default.gray("Run with ") + import_picocolors7.default.cyan("CODOWAVE_CONNECT=1") + import_picocolors7.default.gray(" to enable (not implemented yet)"));
|
|
8196
|
+
console.log("");
|
|
8197
|
+
} catch (err) {
|
|
8198
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
8199
|
+
console.error(import_picocolors7.default.red(`
|
|
8200
|
+
\u2716 Error: ${message}
|
|
8201
|
+
`));
|
|
8202
|
+
process.exit(1);
|
|
8203
|
+
}
|
|
8204
|
+
});
|
|
8502
8205
|
|
|
8503
8206
|
// src/index.ts
|
|
8504
|
-
|
|
8505
|
-
var { initCommand: initCommand2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
8506
|
-
var { runCommand: runCommand2 } = await Promise.resolve().then(() => (init_run(), run_exports));
|
|
8507
|
-
var { statusCommand: statusCommand2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
8508
|
-
var { logsCommand: logsCommand2 } = await Promise.resolve().then(() => (init_logs(), logs_exports));
|
|
8509
|
-
var { configCommand: configCommand2 } = await Promise.resolve().then(() => (init_config_cmd(), config_cmd_exports));
|
|
8510
|
-
var { connectCommand: connectCommand2 } = await Promise.resolve().then(() => (init_connect(), connect_exports));
|
|
8511
|
-
var { repoCommand: repoCommand2 } = await Promise.resolve().then(() => (init_repo_cmd(), repo_cmd_exports));
|
|
8512
|
-
var { autopilotCommand: autopilotCommand2 } = await Promise.resolve().then(() => (init_autopilot_cmd(), autopilot_cmd_exports));
|
|
8513
|
-
var { labelsCommand: labelsCommand2 } = await Promise.resolve().then(() => (init_labels_cmd(), labels_cmd_exports));
|
|
8514
|
-
var { runsCommand: runsCommand2 } = await Promise.resolve().then(() => (init_runs_cmd(), runs_cmd_exports));
|
|
8515
|
-
var VERSION = "0.1.0";
|
|
8207
|
+
var VERSION = "0.2.0";
|
|
8516
8208
|
var program2 = new Command();
|
|
8517
|
-
program2.name("codowave").description(
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
${import_picocolors13.default.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")}
|
|
8523
|
-
${import_picocolors13.default.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")}
|
|
8524
|
-
${import_picocolors13.default.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 ")}
|
|
8525
|
-
${import_picocolors13.default.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")}
|
|
8526
|
-
`
|
|
8527
|
-
).option("--api-url <url>", "Override the Codowave API URL");
|
|
8528
|
-
program2.addCommand(initCommand2);
|
|
8529
|
-
program2.addCommand(runCommand2);
|
|
8530
|
-
program2.addCommand(statusCommand2);
|
|
8531
|
-
program2.addCommand(logsCommand2);
|
|
8532
|
-
program2.addCommand(configCommand2);
|
|
8533
|
-
program2.addCommand(connectCommand2);
|
|
8534
|
-
program2.addCommand(repoCommand2);
|
|
8535
|
-
program2.addCommand(autopilotCommand2);
|
|
8536
|
-
program2.addCommand(labelsCommand2);
|
|
8537
|
-
program2.addCommand(runsCommand2);
|
|
8538
|
-
program2.configureOutput({
|
|
8539
|
-
writeErr: (str) => process.stderr.write(import_picocolors13.default.red(str))
|
|
8209
|
+
program2.name("codowave").description("Codowave OSS CLI \u2014 AI-powered coding agent for your GitHub repositories").version(VERSION, "-v, --version", "Output the current version").option("--api-url <url>", "Override the Codowave API URL");
|
|
8210
|
+
program2.addCommand(initCommand);
|
|
8211
|
+
program2.command("onboard", { isDefault: false }).description("Initialize Codowave (alias for init)").action(async () => {
|
|
8212
|
+
const { initCommand: initCommand2 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
8213
|
+
await initCommand2.action();
|
|
8540
8214
|
});
|
|
8215
|
+
program2.addCommand(runCommand);
|
|
8216
|
+
program2.addCommand(statusCommand);
|
|
8217
|
+
program2.addCommand(logsCommand);
|
|
8218
|
+
program2.addCommand(configCommand);
|
|
8219
|
+
program2.addCommand(connectCommand);
|
|
8541
8220
|
var args = process.argv.slice(2);
|
|
8542
|
-
var
|
|
8543
|
-
if (!
|
|
8221
|
+
var isHelp = args.includes("--help") || args.includes("-h") || args.includes("--version") || args.includes("-v") || args.length === 0;
|
|
8222
|
+
if (!isHelp) {
|
|
8544
8223
|
const config = readConfig();
|
|
8545
|
-
if (!config) {
|
|
8546
|
-
console.
|
|
8547
|
-
|
|
8548
|
-
"\u26A0 No config found. Run " + import_picocolors13.default.bold("codowave init") + " to get started.\n"
|
|
8549
|
-
)
|
|
8550
|
-
);
|
|
8224
|
+
if (!config?.apiKey) {
|
|
8225
|
+
console.log("\n\u274C Codowave not initialized. Run: codowave init\n");
|
|
8226
|
+
process.exit(1);
|
|
8551
8227
|
}
|
|
8552
8228
|
}
|
|
8553
|
-
program2.
|
|
8554
|
-
console.error(import_picocolors13.default.red(`
|
|
8555
|
-
\u2716 Error: ${err instanceof Error ? err.message : String(err)}
|
|
8556
|
-
`));
|
|
8557
|
-
process.exit(1);
|
|
8558
|
-
});
|
|
8229
|
+
program2.parse();
|