@codevector/cli 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -9
- package/dist/index.js +465 -1253
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5004,13 +5004,13 @@ var init_schemas = __esm({
|
|
|
5004
5004
|
}
|
|
5005
5005
|
return propValues;
|
|
5006
5006
|
});
|
|
5007
|
-
const
|
|
5007
|
+
const isObject4 = isObject2;
|
|
5008
5008
|
const catchall = def.catchall;
|
|
5009
5009
|
let value;
|
|
5010
5010
|
inst._zod.parse = (payload, ctx) => {
|
|
5011
5011
|
value ?? (value = _normalized.value);
|
|
5012
5012
|
const input = payload.value;
|
|
5013
|
-
if (!
|
|
5013
|
+
if (!isObject4(input)) {
|
|
5014
5014
|
payload.issues.push({
|
|
5015
5015
|
expected: "object",
|
|
5016
5016
|
code: "invalid_type",
|
|
@@ -5137,7 +5137,7 @@ var init_schemas = __esm({
|
|
|
5137
5137
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
5138
5138
|
};
|
|
5139
5139
|
let fastpass;
|
|
5140
|
-
const
|
|
5140
|
+
const isObject4 = isObject2;
|
|
5141
5141
|
const jit = !globalConfig.jitless;
|
|
5142
5142
|
const allowsEval2 = allowsEval;
|
|
5143
5143
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -5146,7 +5146,7 @@ var init_schemas = __esm({
|
|
|
5146
5146
|
inst._zod.parse = (payload, ctx) => {
|
|
5147
5147
|
value ?? (value = _normalized.value);
|
|
5148
5148
|
const input = payload.value;
|
|
5149
|
-
if (!
|
|
5149
|
+
if (!isObject4(input)) {
|
|
5150
5150
|
payload.issues.push({
|
|
5151
5151
|
expected: "object",
|
|
5152
5152
|
code: "invalid_type",
|
|
@@ -18075,1053 +18075,17 @@ var init_prompt = __esm({
|
|
|
18075
18075
|
}
|
|
18076
18076
|
});
|
|
18077
18077
|
|
|
18078
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/error.js
|
|
18079
|
-
function getLineColFromPtr(string4, ptr) {
|
|
18080
|
-
let lines = string4.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
18081
|
-
return [lines.length, lines.pop().length + 1];
|
|
18082
|
-
}
|
|
18083
|
-
function makeCodeBlock(string4, line, column) {
|
|
18084
|
-
let lines = string4.split(/\r\n|\n|\r/g);
|
|
18085
|
-
let codeblock = "";
|
|
18086
|
-
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
18087
|
-
for (let i = line - 1; i <= line + 1; i++) {
|
|
18088
|
-
let l = lines[i - 1];
|
|
18089
|
-
if (!l)
|
|
18090
|
-
continue;
|
|
18091
|
-
codeblock += i.toString().padEnd(numberLen, " ");
|
|
18092
|
-
codeblock += ": ";
|
|
18093
|
-
codeblock += l;
|
|
18094
|
-
codeblock += "\n";
|
|
18095
|
-
if (i === line) {
|
|
18096
|
-
codeblock += " ".repeat(numberLen + column + 2);
|
|
18097
|
-
codeblock += "^\n";
|
|
18098
|
-
}
|
|
18099
|
-
}
|
|
18100
|
-
return codeblock;
|
|
18101
|
-
}
|
|
18102
|
-
var TomlError;
|
|
18103
|
-
var init_error = __esm({
|
|
18104
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/error.js"() {
|
|
18105
|
-
"use strict";
|
|
18106
|
-
TomlError = class extends Error {
|
|
18107
|
-
line;
|
|
18108
|
-
column;
|
|
18109
|
-
codeblock;
|
|
18110
|
-
constructor(message, options) {
|
|
18111
|
-
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
18112
|
-
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
18113
|
-
super(`Invalid TOML document: ${message}
|
|
18114
|
-
|
|
18115
|
-
${codeblock}`, options);
|
|
18116
|
-
this.line = line;
|
|
18117
|
-
this.column = column;
|
|
18118
|
-
this.codeblock = codeblock;
|
|
18119
|
-
}
|
|
18120
|
-
};
|
|
18121
|
-
}
|
|
18122
|
-
});
|
|
18123
|
-
|
|
18124
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/util.js
|
|
18125
|
-
function isEscaped(str, ptr) {
|
|
18126
|
-
let i = 0;
|
|
18127
|
-
while (str[ptr - ++i] === "\\")
|
|
18128
|
-
;
|
|
18129
|
-
return --i && i % 2;
|
|
18130
|
-
}
|
|
18131
|
-
function indexOfNewline(str, start = 0, end = str.length) {
|
|
18132
|
-
let idx = str.indexOf("\n", start);
|
|
18133
|
-
if (str[idx - 1] === "\r")
|
|
18134
|
-
idx--;
|
|
18135
|
-
return idx <= end ? idx : -1;
|
|
18136
|
-
}
|
|
18137
|
-
function skipComment(str, ptr) {
|
|
18138
|
-
for (let i = ptr; i < str.length; i++) {
|
|
18139
|
-
let c = str[i];
|
|
18140
|
-
if (c === "\n")
|
|
18141
|
-
return i;
|
|
18142
|
-
if (c === "\r" && str[i + 1] === "\n")
|
|
18143
|
-
return i + 1;
|
|
18144
|
-
if (c < " " && c !== " " || c === "\x7F") {
|
|
18145
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
18146
|
-
toml: str,
|
|
18147
|
-
ptr
|
|
18148
|
-
});
|
|
18149
|
-
}
|
|
18150
|
-
}
|
|
18151
|
-
return str.length;
|
|
18152
|
-
}
|
|
18153
|
-
function skipVoid(str, ptr, banNewLines, banComments) {
|
|
18154
|
-
let c;
|
|
18155
|
-
while (1) {
|
|
18156
|
-
while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
|
|
18157
|
-
ptr++;
|
|
18158
|
-
if (banComments || c !== "#")
|
|
18159
|
-
break;
|
|
18160
|
-
ptr = skipComment(str, ptr);
|
|
18161
|
-
}
|
|
18162
|
-
return ptr;
|
|
18163
|
-
}
|
|
18164
|
-
function skipUntil(str, ptr, sep2, end, banNewLines = false) {
|
|
18165
|
-
if (!end) {
|
|
18166
|
-
ptr = indexOfNewline(str, ptr);
|
|
18167
|
-
return ptr < 0 ? str.length : ptr;
|
|
18168
|
-
}
|
|
18169
|
-
for (let i = ptr; i < str.length; i++) {
|
|
18170
|
-
let c = str[i];
|
|
18171
|
-
if (c === "#") {
|
|
18172
|
-
i = indexOfNewline(str, i);
|
|
18173
|
-
} else if (c === sep2) {
|
|
18174
|
-
return i + 1;
|
|
18175
|
-
} else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
|
|
18176
|
-
return i;
|
|
18177
|
-
}
|
|
18178
|
-
}
|
|
18179
|
-
throw new TomlError("cannot find end of structure", {
|
|
18180
|
-
toml: str,
|
|
18181
|
-
ptr
|
|
18182
|
-
});
|
|
18183
|
-
}
|
|
18184
|
-
function getStringEnd(str, seek) {
|
|
18185
|
-
let first = str[seek];
|
|
18186
|
-
let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
|
|
18187
|
-
seek += target.length - 1;
|
|
18188
|
-
do
|
|
18189
|
-
seek = str.indexOf(target, ++seek);
|
|
18190
|
-
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
18191
|
-
if (seek > -1) {
|
|
18192
|
-
seek += target.length;
|
|
18193
|
-
if (target.length > 1) {
|
|
18194
|
-
if (str[seek] === first)
|
|
18195
|
-
seek++;
|
|
18196
|
-
if (str[seek] === first)
|
|
18197
|
-
seek++;
|
|
18198
|
-
}
|
|
18199
|
-
}
|
|
18200
|
-
return seek;
|
|
18201
|
-
}
|
|
18202
|
-
var init_util2 = __esm({
|
|
18203
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/util.js"() {
|
|
18204
|
-
"use strict";
|
|
18205
|
-
init_error();
|
|
18206
|
-
}
|
|
18207
|
-
});
|
|
18208
|
-
|
|
18209
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/date.js
|
|
18210
|
-
var DATE_TIME_RE, TomlDate;
|
|
18211
|
-
var init_date = __esm({
|
|
18212
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/date.js"() {
|
|
18213
|
-
"use strict";
|
|
18214
|
-
DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
18215
|
-
TomlDate = class _TomlDate extends Date {
|
|
18216
|
-
#hasDate = false;
|
|
18217
|
-
#hasTime = false;
|
|
18218
|
-
#offset = null;
|
|
18219
|
-
constructor(date5) {
|
|
18220
|
-
let hasDate = true;
|
|
18221
|
-
let hasTime = true;
|
|
18222
|
-
let offset = "Z";
|
|
18223
|
-
if (typeof date5 === "string") {
|
|
18224
|
-
let match = date5.match(DATE_TIME_RE);
|
|
18225
|
-
if (match) {
|
|
18226
|
-
if (!match[1]) {
|
|
18227
|
-
hasDate = false;
|
|
18228
|
-
date5 = `0000-01-01T${date5}`;
|
|
18229
|
-
}
|
|
18230
|
-
hasTime = !!match[2];
|
|
18231
|
-
hasTime && date5[10] === " " && (date5 = date5.replace(" ", "T"));
|
|
18232
|
-
if (match[2] && +match[2] > 23) {
|
|
18233
|
-
date5 = "";
|
|
18234
|
-
} else {
|
|
18235
|
-
offset = match[3] || null;
|
|
18236
|
-
date5 = date5.toUpperCase();
|
|
18237
|
-
if (!offset && hasTime)
|
|
18238
|
-
date5 += "Z";
|
|
18239
|
-
}
|
|
18240
|
-
} else {
|
|
18241
|
-
date5 = "";
|
|
18242
|
-
}
|
|
18243
|
-
}
|
|
18244
|
-
super(date5);
|
|
18245
|
-
if (!isNaN(this.getTime())) {
|
|
18246
|
-
this.#hasDate = hasDate;
|
|
18247
|
-
this.#hasTime = hasTime;
|
|
18248
|
-
this.#offset = offset;
|
|
18249
|
-
}
|
|
18250
|
-
}
|
|
18251
|
-
isDateTime() {
|
|
18252
|
-
return this.#hasDate && this.#hasTime;
|
|
18253
|
-
}
|
|
18254
|
-
isLocal() {
|
|
18255
|
-
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
18256
|
-
}
|
|
18257
|
-
isDate() {
|
|
18258
|
-
return this.#hasDate && !this.#hasTime;
|
|
18259
|
-
}
|
|
18260
|
-
isTime() {
|
|
18261
|
-
return this.#hasTime && !this.#hasDate;
|
|
18262
|
-
}
|
|
18263
|
-
isValid() {
|
|
18264
|
-
return this.#hasDate || this.#hasTime;
|
|
18265
|
-
}
|
|
18266
|
-
toISOString() {
|
|
18267
|
-
let iso = super.toISOString();
|
|
18268
|
-
if (this.isDate())
|
|
18269
|
-
return iso.slice(0, 10);
|
|
18270
|
-
if (this.isTime())
|
|
18271
|
-
return iso.slice(11, 23);
|
|
18272
|
-
if (this.#offset === null)
|
|
18273
|
-
return iso.slice(0, -1);
|
|
18274
|
-
if (this.#offset === "Z")
|
|
18275
|
-
return iso;
|
|
18276
|
-
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
18277
|
-
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
18278
|
-
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
18279
|
-
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
18280
|
-
}
|
|
18281
|
-
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
18282
|
-
let date5 = new _TomlDate(jsDate);
|
|
18283
|
-
date5.#offset = offset;
|
|
18284
|
-
return date5;
|
|
18285
|
-
}
|
|
18286
|
-
static wrapAsLocalDateTime(jsDate) {
|
|
18287
|
-
let date5 = new _TomlDate(jsDate);
|
|
18288
|
-
date5.#offset = null;
|
|
18289
|
-
return date5;
|
|
18290
|
-
}
|
|
18291
|
-
static wrapAsLocalDate(jsDate) {
|
|
18292
|
-
let date5 = new _TomlDate(jsDate);
|
|
18293
|
-
date5.#hasTime = false;
|
|
18294
|
-
date5.#offset = null;
|
|
18295
|
-
return date5;
|
|
18296
|
-
}
|
|
18297
|
-
static wrapAsLocalTime(jsDate) {
|
|
18298
|
-
let date5 = new _TomlDate(jsDate);
|
|
18299
|
-
date5.#hasDate = false;
|
|
18300
|
-
date5.#offset = null;
|
|
18301
|
-
return date5;
|
|
18302
|
-
}
|
|
18303
|
-
};
|
|
18304
|
-
}
|
|
18305
|
-
});
|
|
18306
|
-
|
|
18307
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/primitive.js
|
|
18308
|
-
function parseString(str, ptr = 0, endPtr = str.length) {
|
|
18309
|
-
let isLiteral = str[ptr] === "'";
|
|
18310
|
-
let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
|
|
18311
|
-
if (isMultiline) {
|
|
18312
|
-
endPtr -= 2;
|
|
18313
|
-
if (str[ptr += 2] === "\r")
|
|
18314
|
-
ptr++;
|
|
18315
|
-
if (str[ptr] === "\n")
|
|
18316
|
-
ptr++;
|
|
18317
|
-
}
|
|
18318
|
-
let tmp = 0;
|
|
18319
|
-
let isEscape;
|
|
18320
|
-
let parsed = "";
|
|
18321
|
-
let sliceStart = ptr;
|
|
18322
|
-
while (ptr < endPtr - 1) {
|
|
18323
|
-
let c = str[ptr++];
|
|
18324
|
-
if (c === "\n" || c === "\r" && str[ptr] === "\n") {
|
|
18325
|
-
if (!isMultiline) {
|
|
18326
|
-
throw new TomlError("newlines are not allowed in strings", {
|
|
18327
|
-
toml: str,
|
|
18328
|
-
ptr: ptr - 1
|
|
18329
|
-
});
|
|
18330
|
-
}
|
|
18331
|
-
} else if (c < " " && c !== " " || c === "\x7F") {
|
|
18332
|
-
throw new TomlError("control characters are not allowed in strings", {
|
|
18333
|
-
toml: str,
|
|
18334
|
-
ptr: ptr - 1
|
|
18335
|
-
});
|
|
18336
|
-
}
|
|
18337
|
-
if (isEscape) {
|
|
18338
|
-
isEscape = false;
|
|
18339
|
-
if (c === "x" || c === "u" || c === "U") {
|
|
18340
|
-
let code = str.slice(ptr, ptr += c === "x" ? 2 : c === "u" ? 4 : 8);
|
|
18341
|
-
if (!ESCAPE_REGEX.test(code)) {
|
|
18342
|
-
throw new TomlError("invalid unicode escape", {
|
|
18343
|
-
toml: str,
|
|
18344
|
-
ptr: tmp
|
|
18345
|
-
});
|
|
18346
|
-
}
|
|
18347
|
-
try {
|
|
18348
|
-
parsed += String.fromCodePoint(parseInt(code, 16));
|
|
18349
|
-
} catch {
|
|
18350
|
-
throw new TomlError("invalid unicode escape", {
|
|
18351
|
-
toml: str,
|
|
18352
|
-
ptr: tmp
|
|
18353
|
-
});
|
|
18354
|
-
}
|
|
18355
|
-
} else if (isMultiline && (c === "\n" || c === " " || c === " " || c === "\r")) {
|
|
18356
|
-
ptr = skipVoid(str, ptr - 1, true);
|
|
18357
|
-
if (str[ptr] !== "\n" && str[ptr] !== "\r") {
|
|
18358
|
-
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
18359
|
-
toml: str,
|
|
18360
|
-
ptr: tmp
|
|
18361
|
-
});
|
|
18362
|
-
}
|
|
18363
|
-
ptr = skipVoid(str, ptr);
|
|
18364
|
-
} else if (c in ESC_MAP) {
|
|
18365
|
-
parsed += ESC_MAP[c];
|
|
18366
|
-
} else {
|
|
18367
|
-
throw new TomlError("unrecognized escape sequence", {
|
|
18368
|
-
toml: str,
|
|
18369
|
-
ptr: tmp
|
|
18370
|
-
});
|
|
18371
|
-
}
|
|
18372
|
-
sliceStart = ptr;
|
|
18373
|
-
} else if (!isLiteral && c === "\\") {
|
|
18374
|
-
tmp = ptr - 1;
|
|
18375
|
-
isEscape = true;
|
|
18376
|
-
parsed += str.slice(sliceStart, tmp);
|
|
18377
|
-
}
|
|
18378
|
-
}
|
|
18379
|
-
return parsed + str.slice(sliceStart, endPtr - 1);
|
|
18380
|
-
}
|
|
18381
|
-
function parseValue(value, toml, ptr, integersAsBigInt) {
|
|
18382
|
-
if (value === "true")
|
|
18383
|
-
return true;
|
|
18384
|
-
if (value === "false")
|
|
18385
|
-
return false;
|
|
18386
|
-
if (value === "-inf")
|
|
18387
|
-
return -Infinity;
|
|
18388
|
-
if (value === "inf" || value === "+inf")
|
|
18389
|
-
return Infinity;
|
|
18390
|
-
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
18391
|
-
return NaN;
|
|
18392
|
-
if (value === "-0")
|
|
18393
|
-
return integersAsBigInt ? 0n : 0;
|
|
18394
|
-
let isInt = INT_REGEX.test(value);
|
|
18395
|
-
if (isInt || FLOAT_REGEX.test(value)) {
|
|
18396
|
-
if (LEADING_ZERO.test(value)) {
|
|
18397
|
-
throw new TomlError("leading zeroes are not allowed", {
|
|
18398
|
-
toml,
|
|
18399
|
-
ptr
|
|
18400
|
-
});
|
|
18401
|
-
}
|
|
18402
|
-
value = value.replace(/_/g, "");
|
|
18403
|
-
let numeric = +value;
|
|
18404
|
-
if (isNaN(numeric)) {
|
|
18405
|
-
throw new TomlError("invalid number", {
|
|
18406
|
-
toml,
|
|
18407
|
-
ptr
|
|
18408
|
-
});
|
|
18409
|
-
}
|
|
18410
|
-
if (isInt) {
|
|
18411
|
-
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
18412
|
-
throw new TomlError("integer value cannot be represented losslessly", {
|
|
18413
|
-
toml,
|
|
18414
|
-
ptr
|
|
18415
|
-
});
|
|
18416
|
-
}
|
|
18417
|
-
if (isInt || integersAsBigInt === true)
|
|
18418
|
-
numeric = BigInt(value);
|
|
18419
|
-
}
|
|
18420
|
-
return numeric;
|
|
18421
|
-
}
|
|
18422
|
-
const date5 = new TomlDate(value);
|
|
18423
|
-
if (!date5.isValid()) {
|
|
18424
|
-
throw new TomlError("invalid value", {
|
|
18425
|
-
toml,
|
|
18426
|
-
ptr
|
|
18427
|
-
});
|
|
18428
|
-
}
|
|
18429
|
-
return date5;
|
|
18430
|
-
}
|
|
18431
|
-
var INT_REGEX, FLOAT_REGEX, LEADING_ZERO, ESCAPE_REGEX, ESC_MAP;
|
|
18432
|
-
var init_primitive = __esm({
|
|
18433
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/primitive.js"() {
|
|
18434
|
-
"use strict";
|
|
18435
|
-
init_util2();
|
|
18436
|
-
init_date();
|
|
18437
|
-
init_error();
|
|
18438
|
-
INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
18439
|
-
FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
18440
|
-
LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
18441
|
-
ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
|
|
18442
|
-
ESC_MAP = {
|
|
18443
|
-
b: "\b",
|
|
18444
|
-
t: " ",
|
|
18445
|
-
n: "\n",
|
|
18446
|
-
f: "\f",
|
|
18447
|
-
r: "\r",
|
|
18448
|
-
e: "\x1B",
|
|
18449
|
-
'"': '"',
|
|
18450
|
-
"\\": "\\"
|
|
18451
|
-
};
|
|
18452
|
-
}
|
|
18453
|
-
});
|
|
18454
|
-
|
|
18455
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/extract.js
|
|
18456
|
-
function sliceAndTrimEndOf(str, startPtr, endPtr) {
|
|
18457
|
-
let value = str.slice(startPtr, endPtr);
|
|
18458
|
-
let commentIdx = value.indexOf("#");
|
|
18459
|
-
if (commentIdx > -1) {
|
|
18460
|
-
skipComment(str, commentIdx);
|
|
18461
|
-
value = value.slice(0, commentIdx);
|
|
18462
|
-
}
|
|
18463
|
-
return [value.trimEnd(), commentIdx];
|
|
18464
|
-
}
|
|
18465
|
-
function extractValue(str, ptr, end, depth, integersAsBigInt) {
|
|
18466
|
-
if (depth === 0) {
|
|
18467
|
-
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
18468
|
-
toml: str,
|
|
18469
|
-
ptr
|
|
18470
|
-
});
|
|
18471
|
-
}
|
|
18472
|
-
let c = str[ptr];
|
|
18473
|
-
if (c === "[" || c === "{") {
|
|
18474
|
-
let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
|
|
18475
|
-
if (end) {
|
|
18476
|
-
endPtr2 = skipVoid(str, endPtr2);
|
|
18477
|
-
if (str[endPtr2] === ",")
|
|
18478
|
-
endPtr2++;
|
|
18479
|
-
else if (str[endPtr2] !== end) {
|
|
18480
|
-
throw new TomlError("expected comma or end of structure", {
|
|
18481
|
-
toml: str,
|
|
18482
|
-
ptr: endPtr2
|
|
18483
|
-
});
|
|
18484
|
-
}
|
|
18485
|
-
}
|
|
18486
|
-
return [value, endPtr2];
|
|
18487
|
-
}
|
|
18488
|
-
let endPtr;
|
|
18489
|
-
if (c === '"' || c === "'") {
|
|
18490
|
-
endPtr = getStringEnd(str, ptr);
|
|
18491
|
-
let parsed = parseString(str, ptr, endPtr);
|
|
18492
|
-
if (end) {
|
|
18493
|
-
endPtr = skipVoid(str, endPtr);
|
|
18494
|
-
if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") {
|
|
18495
|
-
throw new TomlError("unexpected character encountered", {
|
|
18496
|
-
toml: str,
|
|
18497
|
-
ptr: endPtr
|
|
18498
|
-
});
|
|
18499
|
-
}
|
|
18500
|
-
endPtr += +(str[endPtr] === ",");
|
|
18501
|
-
}
|
|
18502
|
-
return [parsed, endPtr];
|
|
18503
|
-
}
|
|
18504
|
-
endPtr = skipUntil(str, ptr, ",", end);
|
|
18505
|
-
let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","));
|
|
18506
|
-
if (!slice[0]) {
|
|
18507
|
-
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
18508
|
-
toml: str,
|
|
18509
|
-
ptr
|
|
18510
|
-
});
|
|
18511
|
-
}
|
|
18512
|
-
if (end && slice[1] > -1) {
|
|
18513
|
-
endPtr = skipVoid(str, ptr + slice[1]);
|
|
18514
|
-
endPtr += +(str[endPtr] === ",");
|
|
18515
|
-
}
|
|
18516
|
-
return [
|
|
18517
|
-
parseValue(slice[0], str, ptr, integersAsBigInt),
|
|
18518
|
-
endPtr
|
|
18519
|
-
];
|
|
18520
|
-
}
|
|
18521
|
-
var init_extract = __esm({
|
|
18522
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/extract.js"() {
|
|
18523
|
-
"use strict";
|
|
18524
|
-
init_primitive();
|
|
18525
|
-
init_struct();
|
|
18526
|
-
init_util2();
|
|
18527
|
-
init_error();
|
|
18528
|
-
}
|
|
18529
|
-
});
|
|
18530
|
-
|
|
18531
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/struct.js
|
|
18532
|
-
function parseKey(str, ptr, end = "=") {
|
|
18533
|
-
let dot = ptr - 1;
|
|
18534
|
-
let parsed = [];
|
|
18535
|
-
let endPtr = str.indexOf(end, ptr);
|
|
18536
|
-
if (endPtr < 0) {
|
|
18537
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
18538
|
-
toml: str,
|
|
18539
|
-
ptr
|
|
18540
|
-
});
|
|
18541
|
-
}
|
|
18542
|
-
do {
|
|
18543
|
-
let c = str[ptr = ++dot];
|
|
18544
|
-
if (c !== " " && c !== " ") {
|
|
18545
|
-
if (c === '"' || c === "'") {
|
|
18546
|
-
if (c === str[ptr + 1] && c === str[ptr + 2]) {
|
|
18547
|
-
throw new TomlError("multiline strings are not allowed in keys", {
|
|
18548
|
-
toml: str,
|
|
18549
|
-
ptr
|
|
18550
|
-
});
|
|
18551
|
-
}
|
|
18552
|
-
let eos = getStringEnd(str, ptr);
|
|
18553
|
-
if (eos < 0) {
|
|
18554
|
-
throw new TomlError("unfinished string encountered", {
|
|
18555
|
-
toml: str,
|
|
18556
|
-
ptr
|
|
18557
|
-
});
|
|
18558
|
-
}
|
|
18559
|
-
dot = str.indexOf(".", eos);
|
|
18560
|
-
let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
18561
|
-
let newLine = indexOfNewline(strEnd);
|
|
18562
|
-
if (newLine > -1) {
|
|
18563
|
-
throw new TomlError("newlines are not allowed in keys", {
|
|
18564
|
-
toml: str,
|
|
18565
|
-
ptr: ptr + dot + newLine
|
|
18566
|
-
});
|
|
18567
|
-
}
|
|
18568
|
-
if (strEnd.trimStart()) {
|
|
18569
|
-
throw new TomlError("found extra tokens after the string part", {
|
|
18570
|
-
toml: str,
|
|
18571
|
-
ptr: eos
|
|
18572
|
-
});
|
|
18573
|
-
}
|
|
18574
|
-
if (endPtr < eos) {
|
|
18575
|
-
endPtr = str.indexOf(end, eos);
|
|
18576
|
-
if (endPtr < 0) {
|
|
18577
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
18578
|
-
toml: str,
|
|
18579
|
-
ptr
|
|
18580
|
-
});
|
|
18581
|
-
}
|
|
18582
|
-
}
|
|
18583
|
-
parsed.push(parseString(str, ptr, eos));
|
|
18584
|
-
} else {
|
|
18585
|
-
dot = str.indexOf(".", ptr);
|
|
18586
|
-
let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
18587
|
-
if (!KEY_PART_RE.test(part)) {
|
|
18588
|
-
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
18589
|
-
toml: str,
|
|
18590
|
-
ptr
|
|
18591
|
-
});
|
|
18592
|
-
}
|
|
18593
|
-
parsed.push(part.trimEnd());
|
|
18594
|
-
}
|
|
18595
|
-
}
|
|
18596
|
-
} while (dot + 1 && dot < endPtr);
|
|
18597
|
-
return [parsed, skipVoid(str, endPtr + 1, true, true)];
|
|
18598
|
-
}
|
|
18599
|
-
function parseInlineTable(str, ptr, depth, integersAsBigInt) {
|
|
18600
|
-
let res = {};
|
|
18601
|
-
let seen = /* @__PURE__ */ new Set();
|
|
18602
|
-
let c;
|
|
18603
|
-
ptr++;
|
|
18604
|
-
while ((c = str[ptr++]) !== "}" && c) {
|
|
18605
|
-
if (c === ",") {
|
|
18606
|
-
throw new TomlError("expected value, found comma", {
|
|
18607
|
-
toml: str,
|
|
18608
|
-
ptr: ptr - 1
|
|
18609
|
-
});
|
|
18610
|
-
} else if (c === "#")
|
|
18611
|
-
ptr = skipComment(str, ptr);
|
|
18612
|
-
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
18613
|
-
let k2;
|
|
18614
|
-
let t = res;
|
|
18615
|
-
let hasOwn = false;
|
|
18616
|
-
let [key, keyEndPtr] = parseKey(str, ptr - 1);
|
|
18617
|
-
for (let i = 0; i < key.length; i++) {
|
|
18618
|
-
if (i)
|
|
18619
|
-
t = hasOwn ? t[k2] : t[k2] = {};
|
|
18620
|
-
k2 = key[i];
|
|
18621
|
-
if ((hasOwn = Object.hasOwn(t, k2)) && (typeof t[k2] !== "object" || seen.has(t[k2]))) {
|
|
18622
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
18623
|
-
toml: str,
|
|
18624
|
-
ptr
|
|
18625
|
-
});
|
|
18626
|
-
}
|
|
18627
|
-
if (!hasOwn && k2 === "__proto__") {
|
|
18628
|
-
Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
|
|
18629
|
-
}
|
|
18630
|
-
}
|
|
18631
|
-
if (hasOwn) {
|
|
18632
|
-
throw new TomlError("trying to redefine an already defined value", {
|
|
18633
|
-
toml: str,
|
|
18634
|
-
ptr
|
|
18635
|
-
});
|
|
18636
|
-
}
|
|
18637
|
-
let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
18638
|
-
seen.add(value);
|
|
18639
|
-
t[k2] = value;
|
|
18640
|
-
ptr = valueEndPtr;
|
|
18641
|
-
}
|
|
18642
|
-
}
|
|
18643
|
-
if (!c) {
|
|
18644
|
-
throw new TomlError("unfinished table encountered", {
|
|
18645
|
-
toml: str,
|
|
18646
|
-
ptr
|
|
18647
|
-
});
|
|
18648
|
-
}
|
|
18649
|
-
return [res, ptr];
|
|
18650
|
-
}
|
|
18651
|
-
function parseArray(str, ptr, depth, integersAsBigInt) {
|
|
18652
|
-
let res = [];
|
|
18653
|
-
let c;
|
|
18654
|
-
ptr++;
|
|
18655
|
-
while ((c = str[ptr++]) !== "]" && c) {
|
|
18656
|
-
if (c === ",") {
|
|
18657
|
-
throw new TomlError("expected value, found comma", {
|
|
18658
|
-
toml: str,
|
|
18659
|
-
ptr: ptr - 1
|
|
18660
|
-
});
|
|
18661
|
-
} else if (c === "#")
|
|
18662
|
-
ptr = skipComment(str, ptr);
|
|
18663
|
-
else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
|
|
18664
|
-
let e2 = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
18665
|
-
res.push(e2[0]);
|
|
18666
|
-
ptr = e2[1];
|
|
18667
|
-
}
|
|
18668
|
-
}
|
|
18669
|
-
if (!c) {
|
|
18670
|
-
throw new TomlError("unfinished array encountered", {
|
|
18671
|
-
toml: str,
|
|
18672
|
-
ptr
|
|
18673
|
-
});
|
|
18674
|
-
}
|
|
18675
|
-
return [res, ptr];
|
|
18676
|
-
}
|
|
18677
|
-
var KEY_PART_RE;
|
|
18678
|
-
var init_struct = __esm({
|
|
18679
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/struct.js"() {
|
|
18680
|
-
"use strict";
|
|
18681
|
-
init_primitive();
|
|
18682
|
-
init_extract();
|
|
18683
|
-
init_util2();
|
|
18684
|
-
init_error();
|
|
18685
|
-
KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
18686
|
-
}
|
|
18687
|
-
});
|
|
18688
|
-
|
|
18689
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/parse.js
|
|
18690
|
-
function peekTable(key, table, meta3, type) {
|
|
18691
|
-
let t = table;
|
|
18692
|
-
let m2 = meta3;
|
|
18693
|
-
let k2;
|
|
18694
|
-
let hasOwn = false;
|
|
18695
|
-
let state;
|
|
18696
|
-
for (let i = 0; i < key.length; i++) {
|
|
18697
|
-
if (i) {
|
|
18698
|
-
t = hasOwn ? t[k2] : t[k2] = {};
|
|
18699
|
-
m2 = (state = m2[k2]).c;
|
|
18700
|
-
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
18701
|
-
return null;
|
|
18702
|
-
}
|
|
18703
|
-
if (state.t === 2) {
|
|
18704
|
-
let l = t.length - 1;
|
|
18705
|
-
t = t[l];
|
|
18706
|
-
m2 = m2[l].c;
|
|
18707
|
-
}
|
|
18708
|
-
}
|
|
18709
|
-
k2 = key[i];
|
|
18710
|
-
if ((hasOwn = Object.hasOwn(t, k2)) && m2[k2]?.t === 0 && m2[k2]?.d) {
|
|
18711
|
-
return null;
|
|
18712
|
-
}
|
|
18713
|
-
if (!hasOwn) {
|
|
18714
|
-
if (k2 === "__proto__") {
|
|
18715
|
-
Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
|
|
18716
|
-
Object.defineProperty(m2, k2, { enumerable: true, configurable: true, writable: true });
|
|
18717
|
-
}
|
|
18718
|
-
m2[k2] = {
|
|
18719
|
-
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
18720
|
-
d: false,
|
|
18721
|
-
i: 0,
|
|
18722
|
-
c: {}
|
|
18723
|
-
};
|
|
18724
|
-
}
|
|
18725
|
-
}
|
|
18726
|
-
state = m2[k2];
|
|
18727
|
-
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
18728
|
-
return null;
|
|
18729
|
-
}
|
|
18730
|
-
if (type === 2) {
|
|
18731
|
-
if (!state.d) {
|
|
18732
|
-
state.d = true;
|
|
18733
|
-
t[k2] = [];
|
|
18734
|
-
}
|
|
18735
|
-
t[k2].push(t = {});
|
|
18736
|
-
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
18737
|
-
}
|
|
18738
|
-
if (state.d) {
|
|
18739
|
-
return null;
|
|
18740
|
-
}
|
|
18741
|
-
state.d = true;
|
|
18742
|
-
if (type === 1) {
|
|
18743
|
-
t = hasOwn ? t[k2] : t[k2] = {};
|
|
18744
|
-
} else if (type === 0 && hasOwn) {
|
|
18745
|
-
return null;
|
|
18746
|
-
}
|
|
18747
|
-
return [k2, t, state.c];
|
|
18748
|
-
}
|
|
18749
|
-
function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
18750
|
-
let res = {};
|
|
18751
|
-
let meta3 = {};
|
|
18752
|
-
let tbl = res;
|
|
18753
|
-
let m2 = meta3;
|
|
18754
|
-
for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
|
|
18755
|
-
if (toml[ptr] === "[") {
|
|
18756
|
-
let isTableArray = toml[++ptr] === "[";
|
|
18757
|
-
let k2 = parseKey(toml, ptr += +isTableArray, "]");
|
|
18758
|
-
if (isTableArray) {
|
|
18759
|
-
if (toml[k2[1] - 1] !== "]") {
|
|
18760
|
-
throw new TomlError("expected end of table declaration", {
|
|
18761
|
-
toml,
|
|
18762
|
-
ptr: k2[1] - 1
|
|
18763
|
-
});
|
|
18764
|
-
}
|
|
18765
|
-
k2[1]++;
|
|
18766
|
-
}
|
|
18767
|
-
let p2 = peekTable(
|
|
18768
|
-
k2[0],
|
|
18769
|
-
res,
|
|
18770
|
-
meta3,
|
|
18771
|
-
isTableArray ? 2 : 1
|
|
18772
|
-
/* Type.EXPLICIT */
|
|
18773
|
-
);
|
|
18774
|
-
if (!p2) {
|
|
18775
|
-
throw new TomlError("trying to redefine an already defined table or value", {
|
|
18776
|
-
toml,
|
|
18777
|
-
ptr
|
|
18778
|
-
});
|
|
18779
|
-
}
|
|
18780
|
-
m2 = p2[2];
|
|
18781
|
-
tbl = p2[1];
|
|
18782
|
-
ptr = k2[1];
|
|
18783
|
-
} else {
|
|
18784
|
-
let k2 = parseKey(toml, ptr);
|
|
18785
|
-
let p2 = peekTable(
|
|
18786
|
-
k2[0],
|
|
18787
|
-
tbl,
|
|
18788
|
-
m2,
|
|
18789
|
-
0
|
|
18790
|
-
/* Type.DOTTED */
|
|
18791
|
-
);
|
|
18792
|
-
if (!p2) {
|
|
18793
|
-
throw new TomlError("trying to redefine an already defined table or value", {
|
|
18794
|
-
toml,
|
|
18795
|
-
ptr
|
|
18796
|
-
});
|
|
18797
|
-
}
|
|
18798
|
-
let v2 = extractValue(toml, k2[1], void 0, maxDepth, integersAsBigInt);
|
|
18799
|
-
p2[1][p2[0]] = v2[0];
|
|
18800
|
-
ptr = v2[1];
|
|
18801
|
-
}
|
|
18802
|
-
ptr = skipVoid(toml, ptr, true);
|
|
18803
|
-
if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
|
|
18804
|
-
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
18805
|
-
toml,
|
|
18806
|
-
ptr
|
|
18807
|
-
});
|
|
18808
|
-
}
|
|
18809
|
-
ptr = skipVoid(toml, ptr);
|
|
18810
|
-
}
|
|
18811
|
-
return res;
|
|
18812
|
-
}
|
|
18813
|
-
var init_parse3 = __esm({
|
|
18814
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/parse.js"() {
|
|
18815
|
-
"use strict";
|
|
18816
|
-
init_struct();
|
|
18817
|
-
init_extract();
|
|
18818
|
-
init_util2();
|
|
18819
|
-
init_error();
|
|
18820
|
-
}
|
|
18821
|
-
});
|
|
18822
|
-
|
|
18823
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js
|
|
18824
|
-
function extendedTypeOf(obj) {
|
|
18825
|
-
let type = typeof obj;
|
|
18826
|
-
if (type === "object") {
|
|
18827
|
-
if (Array.isArray(obj))
|
|
18828
|
-
return "array";
|
|
18829
|
-
if (obj instanceof Date)
|
|
18830
|
-
return "date";
|
|
18831
|
-
}
|
|
18832
|
-
return type;
|
|
18833
|
-
}
|
|
18834
|
-
function isArrayOfTables(obj) {
|
|
18835
|
-
for (let i = 0; i < obj.length; i++) {
|
|
18836
|
-
if (extendedTypeOf(obj[i]) !== "object")
|
|
18837
|
-
return false;
|
|
18838
|
-
}
|
|
18839
|
-
return obj.length != 0;
|
|
18840
|
-
}
|
|
18841
|
-
function formatString(s) {
|
|
18842
|
-
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
18843
|
-
}
|
|
18844
|
-
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
18845
|
-
if (depth === 0) {
|
|
18846
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
18847
|
-
}
|
|
18848
|
-
if (type === "number") {
|
|
18849
|
-
if (isNaN(val))
|
|
18850
|
-
return "nan";
|
|
18851
|
-
if (val === Infinity)
|
|
18852
|
-
return "inf";
|
|
18853
|
-
if (val === -Infinity)
|
|
18854
|
-
return "-inf";
|
|
18855
|
-
if (numberAsFloat && Number.isInteger(val))
|
|
18856
|
-
return val.toFixed(1);
|
|
18857
|
-
return val.toString();
|
|
18858
|
-
}
|
|
18859
|
-
if (type === "bigint" || type === "boolean") {
|
|
18860
|
-
return val.toString();
|
|
18861
|
-
}
|
|
18862
|
-
if (type === "string") {
|
|
18863
|
-
return formatString(val);
|
|
18864
|
-
}
|
|
18865
|
-
if (type === "date") {
|
|
18866
|
-
if (isNaN(val.getTime())) {
|
|
18867
|
-
throw new TypeError("cannot serialize invalid date");
|
|
18868
|
-
}
|
|
18869
|
-
return val.toISOString();
|
|
18870
|
-
}
|
|
18871
|
-
if (type === "object") {
|
|
18872
|
-
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
18873
|
-
}
|
|
18874
|
-
if (type === "array") {
|
|
18875
|
-
return stringifyArray(val, depth, numberAsFloat);
|
|
18876
|
-
}
|
|
18877
|
-
}
|
|
18878
|
-
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
18879
|
-
let keys = Object.keys(obj);
|
|
18880
|
-
if (keys.length === 0)
|
|
18881
|
-
return "{}";
|
|
18882
|
-
let res = "{ ";
|
|
18883
|
-
for (let i = 0; i < keys.length; i++) {
|
|
18884
|
-
let k2 = keys[i];
|
|
18885
|
-
if (i)
|
|
18886
|
-
res += ", ";
|
|
18887
|
-
res += BARE_KEY.test(k2) ? k2 : formatString(k2);
|
|
18888
|
-
res += " = ";
|
|
18889
|
-
res += stringifyValue(obj[k2], extendedTypeOf(obj[k2]), depth - 1, numberAsFloat);
|
|
18890
|
-
}
|
|
18891
|
-
return res + " }";
|
|
18892
|
-
}
|
|
18893
|
-
function stringifyArray(array2, depth, numberAsFloat) {
|
|
18894
|
-
if (array2.length === 0)
|
|
18895
|
-
return "[]";
|
|
18896
|
-
let res = "[ ";
|
|
18897
|
-
for (let i = 0; i < array2.length; i++) {
|
|
18898
|
-
if (i)
|
|
18899
|
-
res += ", ";
|
|
18900
|
-
if (array2[i] === null || array2[i] === void 0) {
|
|
18901
|
-
throw new TypeError("arrays cannot contain null or undefined values");
|
|
18902
|
-
}
|
|
18903
|
-
res += stringifyValue(array2[i], extendedTypeOf(array2[i]), depth - 1, numberAsFloat);
|
|
18904
|
-
}
|
|
18905
|
-
return res + " ]";
|
|
18906
|
-
}
|
|
18907
|
-
function stringifyArrayTable(array2, key, depth, numberAsFloat) {
|
|
18908
|
-
if (depth === 0) {
|
|
18909
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
18910
|
-
}
|
|
18911
|
-
let res = "";
|
|
18912
|
-
for (let i = 0; i < array2.length; i++) {
|
|
18913
|
-
res += `${res && "\n"}[[${key}]]
|
|
18914
|
-
`;
|
|
18915
|
-
res += stringifyTable(0, array2[i], key, depth, numberAsFloat);
|
|
18916
|
-
}
|
|
18917
|
-
return res;
|
|
18918
|
-
}
|
|
18919
|
-
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
18920
|
-
if (depth === 0) {
|
|
18921
|
-
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
18922
|
-
}
|
|
18923
|
-
let preamble = "";
|
|
18924
|
-
let tables = "";
|
|
18925
|
-
let keys = Object.keys(obj);
|
|
18926
|
-
for (let i = 0; i < keys.length; i++) {
|
|
18927
|
-
let k2 = keys[i];
|
|
18928
|
-
if (obj[k2] !== null && obj[k2] !== void 0) {
|
|
18929
|
-
let type = extendedTypeOf(obj[k2]);
|
|
18930
|
-
if (type === "symbol" || type === "function") {
|
|
18931
|
-
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
18932
|
-
}
|
|
18933
|
-
let key = BARE_KEY.test(k2) ? k2 : formatString(k2);
|
|
18934
|
-
if (type === "array" && isArrayOfTables(obj[k2])) {
|
|
18935
|
-
tables += (tables && "\n") + stringifyArrayTable(obj[k2], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
18936
|
-
} else if (type === "object") {
|
|
18937
|
-
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
18938
|
-
tables += (tables && "\n") + stringifyTable(tblKey, obj[k2], tblKey, depth - 1, numberAsFloat);
|
|
18939
|
-
} else {
|
|
18940
|
-
preamble += key;
|
|
18941
|
-
preamble += " = ";
|
|
18942
|
-
preamble += stringifyValue(obj[k2], type, depth, numberAsFloat);
|
|
18943
|
-
preamble += "\n";
|
|
18944
|
-
}
|
|
18945
|
-
}
|
|
18946
|
-
}
|
|
18947
|
-
if (tableKey && (preamble || !tables))
|
|
18948
|
-
preamble = preamble ? `[${tableKey}]
|
|
18949
|
-
${preamble}` : `[${tableKey}]`;
|
|
18950
|
-
return preamble && tables ? `${preamble}
|
|
18951
|
-
${tables}` : preamble || tables;
|
|
18952
|
-
}
|
|
18953
|
-
function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
|
|
18954
|
-
if (extendedTypeOf(obj) !== "object") {
|
|
18955
|
-
throw new TypeError("stringify can only be called with an object");
|
|
18956
|
-
}
|
|
18957
|
-
let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
18958
|
-
if (str[str.length - 1] !== "\n")
|
|
18959
|
-
return str + "\n";
|
|
18960
|
-
return str;
|
|
18961
|
-
}
|
|
18962
|
-
var BARE_KEY;
|
|
18963
|
-
var init_stringify = __esm({
|
|
18964
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/stringify.js"() {
|
|
18965
|
-
"use strict";
|
|
18966
|
-
BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
18967
|
-
}
|
|
18968
|
-
});
|
|
18969
|
-
|
|
18970
|
-
// ../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/index.js
|
|
18971
|
-
var init_dist6 = __esm({
|
|
18972
|
-
"../../node_modules/.pnpm/smol-toml@1.6.1/node_modules/smol-toml/dist/index.js"() {
|
|
18973
|
-
"use strict";
|
|
18974
|
-
init_parse3();
|
|
18975
|
-
init_stringify();
|
|
18976
|
-
init_date();
|
|
18977
|
-
init_error();
|
|
18978
|
-
}
|
|
18979
|
-
});
|
|
18980
|
-
|
|
18981
|
-
// src/config-writers/codex.ts
|
|
18982
|
-
import {
|
|
18983
|
-
chmodSync as chmodSync3,
|
|
18984
|
-
existsSync as existsSync4,
|
|
18985
|
-
mkdirSync as mkdirSync4,
|
|
18986
|
-
readFileSync as readFileSync6,
|
|
18987
|
-
renameSync as renameSync3,
|
|
18988
|
-
statSync as statSync4,
|
|
18989
|
-
writeFileSync as writeFileSync5
|
|
18990
|
-
} from "fs";
|
|
18991
|
-
import { dirname as dirname4, join as join5 } from "path";
|
|
18992
|
-
import { homedir as homedir4 } from "os";
|
|
18993
|
-
function codexConfigPath(scope = "user") {
|
|
18994
|
-
switch (scope) {
|
|
18995
|
-
case "user":
|
|
18996
|
-
return join5(homedir4(), ".codex", "config.toml");
|
|
18997
|
-
case "project":
|
|
18998
|
-
case "local":
|
|
18999
|
-
return join5(userCwd(), ".codex", "config.toml");
|
|
19000
|
-
}
|
|
19001
|
-
}
|
|
19002
|
-
function readTomlOrEmpty(path) {
|
|
19003
|
-
if (!existsSync4(path)) return {};
|
|
19004
|
-
const raw = readFileSync6(path, "utf8");
|
|
19005
|
-
if (raw.trim().length === 0) return {};
|
|
19006
|
-
const parsed = parse3(raw);
|
|
19007
|
-
if (!isObject4(parsed)) {
|
|
19008
|
-
throw new Error(`${path} is not a TOML table. Refusing to overwrite.`);
|
|
19009
|
-
}
|
|
19010
|
-
return parsed;
|
|
19011
|
-
}
|
|
19012
|
-
function writeTomlAtomic(path, value) {
|
|
19013
|
-
const dir = dirname4(path);
|
|
19014
|
-
mkdirSync4(dir, { recursive: true, mode: 448 });
|
|
19015
|
-
let mode;
|
|
19016
|
-
if (existsSync4(path)) {
|
|
19017
|
-
mode = statSync4(path).mode & 511;
|
|
19018
|
-
}
|
|
19019
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
19020
|
-
writeFileSync5(tmp, `${stringify(value)}
|
|
19021
|
-
`);
|
|
19022
|
-
if (mode !== void 0) {
|
|
19023
|
-
try {
|
|
19024
|
-
chmodSync3(tmp, mode);
|
|
19025
|
-
} catch {
|
|
19026
|
-
}
|
|
19027
|
-
}
|
|
19028
|
-
renameSync3(tmp, path);
|
|
19029
|
-
}
|
|
19030
|
-
function isObject4(v2) {
|
|
19031
|
-
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2);
|
|
19032
|
-
}
|
|
19033
|
-
function trimRightSlash4(url2) {
|
|
19034
|
-
return url2.endsWith("/") ? url2.slice(0, -1) : url2;
|
|
19035
|
-
}
|
|
19036
|
-
function buildHttpHeaders(scope, project) {
|
|
19037
|
-
const safe = (v2) => v2.replace(/[\r\n]/g, "").trim();
|
|
19038
|
-
const headers = {
|
|
19039
|
-
"x-client-app": "codex"
|
|
19040
|
-
};
|
|
19041
|
-
if (scope !== "user" && project) {
|
|
19042
|
-
const slug = safe(project);
|
|
19043
|
-
if (slug) {
|
|
19044
|
-
headers["x-project"] = slug;
|
|
19045
|
-
}
|
|
19046
|
-
}
|
|
19047
|
-
return headers;
|
|
19048
|
-
}
|
|
19049
|
-
var ENV_VAR_NAME2, PROVIDER_ID, writeCodexConfig;
|
|
19050
|
-
var init_codex = __esm({
|
|
19051
|
-
"src/config-writers/codex.ts"() {
|
|
19052
|
-
"use strict";
|
|
19053
|
-
init_dist6();
|
|
19054
|
-
init_gitignore();
|
|
19055
|
-
init_paths();
|
|
19056
|
-
ENV_VAR_NAME2 = "CODEVECTOR_GATEWAY_KEY";
|
|
19057
|
-
PROVIDER_ID = "codevector";
|
|
19058
|
-
writeCodexConfig = ({
|
|
19059
|
-
gatewayUrl,
|
|
19060
|
-
scope,
|
|
19061
|
-
project,
|
|
19062
|
-
model,
|
|
19063
|
-
availableModels = []
|
|
19064
|
-
}) => {
|
|
19065
|
-
const path = codexConfigPath(scope);
|
|
19066
|
-
const gateway = trimRightSlash4(gatewayUrl);
|
|
19067
|
-
const existing = readTomlOrEmpty(path);
|
|
19068
|
-
const merged = { ...existing };
|
|
19069
|
-
merged.model_provider = PROVIDER_ID;
|
|
19070
|
-
const providers = isObject4(merged.model_providers) ? { ...merged.model_providers } : {};
|
|
19071
|
-
providers[PROVIDER_ID] = {
|
|
19072
|
-
name: "CodeVector Gateway",
|
|
19073
|
-
base_url: `${gateway}/gateway/openai/v1`,
|
|
19074
|
-
env_key: ENV_VAR_NAME2,
|
|
19075
|
-
wire_api: "responses",
|
|
19076
|
-
http_headers: buildHttpHeaders(scope, project)
|
|
19077
|
-
};
|
|
19078
|
-
merged.model_providers = providers;
|
|
19079
|
-
if (model) {
|
|
19080
|
-
merged.model = model.slug;
|
|
19081
|
-
const meta3 = availableModels.find((m2) => m2.slug === model.slug);
|
|
19082
|
-
if (meta3?.supportsReasoning === true) {
|
|
19083
|
-
merged.model_reasoning_summary = "auto";
|
|
19084
|
-
merged.model_supports_reasoning_summaries = true;
|
|
19085
|
-
} else {
|
|
19086
|
-
delete merged.model_reasoning_summary;
|
|
19087
|
-
delete merged.model_supports_reasoning_summaries;
|
|
19088
|
-
}
|
|
19089
|
-
} else {
|
|
19090
|
-
delete merged.model;
|
|
19091
|
-
delete merged.model_reasoning_summary;
|
|
19092
|
-
delete merged.model_supports_reasoning_summaries;
|
|
19093
|
-
}
|
|
19094
|
-
writeTomlAtomic(path, merged);
|
|
19095
|
-
const notes = [
|
|
19096
|
-
`codex does not auto-load .env files. Add to your shell rc: export ${ENV_VAR_NAME2}=<your key>`
|
|
19097
|
-
];
|
|
19098
|
-
if (scope === "local") {
|
|
19099
|
-
if (ensureGitignored(".codex/config.toml")) {
|
|
19100
|
-
notes.push("Added `.codex/config.toml` to .gitignore.");
|
|
19101
|
-
}
|
|
19102
|
-
}
|
|
19103
|
-
return {
|
|
19104
|
-
tool: "codex",
|
|
19105
|
-
status: "configured",
|
|
19106
|
-
path,
|
|
19107
|
-
scope,
|
|
19108
|
-
notes: notes.join(" ")
|
|
19109
|
-
};
|
|
19110
|
-
};
|
|
19111
|
-
}
|
|
19112
|
-
});
|
|
19113
|
-
|
|
19114
18078
|
// src/lib/project-config.ts
|
|
19115
|
-
import { existsSync as
|
|
19116
|
-
import { dirname as
|
|
18079
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
18080
|
+
import { dirname as dirname4, join as join5, parse as parsePath, resolve } from "path";
|
|
19117
18081
|
function findProjectConfigPath(startDir) {
|
|
19118
18082
|
let dir = resolve(startDir);
|
|
19119
18083
|
const root = parsePath(dir).root;
|
|
19120
18084
|
while (true) {
|
|
19121
|
-
const candidate =
|
|
19122
|
-
if (
|
|
18085
|
+
const candidate = join5(dir, PROJECT_CONFIG_FILENAME);
|
|
18086
|
+
if (existsSync4(candidate)) return candidate;
|
|
19123
18087
|
if (dir === root) return null;
|
|
19124
|
-
const parent =
|
|
18088
|
+
const parent = dirname4(dir);
|
|
19125
18089
|
if (parent === dir) return null;
|
|
19126
18090
|
dir = parent;
|
|
19127
18091
|
}
|
|
@@ -19129,7 +18093,7 @@ function findProjectConfigPath(startDir) {
|
|
|
19129
18093
|
function readProjectConfigAt(path) {
|
|
19130
18094
|
let raw;
|
|
19131
18095
|
try {
|
|
19132
|
-
raw =
|
|
18096
|
+
raw = readFileSync6(path, "utf8");
|
|
19133
18097
|
} catch {
|
|
19134
18098
|
return null;
|
|
19135
18099
|
}
|
|
@@ -19151,7 +18115,7 @@ function readProjectConfig(startDir) {
|
|
|
19151
18115
|
}
|
|
19152
18116
|
function writeProjectConfig(path, config2) {
|
|
19153
18117
|
const parsed = ProjectConfigSchema.parse(config2);
|
|
19154
|
-
|
|
18118
|
+
writeFileSync5(path, `${JSON.stringify(parsed, null, 2)}
|
|
19155
18119
|
`, { mode: 420 });
|
|
19156
18120
|
}
|
|
19157
18121
|
var PROJECT_CONFIG_FILENAME, ProjectConfigSchema;
|
|
@@ -19172,7 +18136,7 @@ var init_project_config = __esm({
|
|
|
19172
18136
|
|
|
19173
18137
|
// src/lib/project-context.ts
|
|
19174
18138
|
import { execFileSync } from "child_process";
|
|
19175
|
-
import { join as
|
|
18139
|
+
import { join as join6 } from "path";
|
|
19176
18140
|
function safeGit(args, cwd) {
|
|
19177
18141
|
try {
|
|
19178
18142
|
const out = execFileSync("git", args, {
|
|
@@ -19210,7 +18174,7 @@ function resolveProjectContext(cwd = process.cwd(), ticketPattern = DEFAULT_TICK
|
|
|
19210
18174
|
return { project, ticket };
|
|
19211
18175
|
}
|
|
19212
18176
|
function readLocalConfig(cwd) {
|
|
19213
|
-
const config2 = readProjectConfigAt(
|
|
18177
|
+
const config2 = readProjectConfigAt(join6(cwd, PROJECT_CONFIG_FILENAME));
|
|
19214
18178
|
if (!config2) return null;
|
|
19215
18179
|
const result = {};
|
|
19216
18180
|
if (config2.projectName) result.projectName = config2.projectName;
|
|
@@ -19251,9 +18215,9 @@ var init_shell = __esm({
|
|
|
19251
18215
|
});
|
|
19252
18216
|
|
|
19253
18217
|
// src/lib/shell-hook.ts
|
|
19254
|
-
import { existsSync as
|
|
19255
|
-
import { homedir as
|
|
19256
|
-
import { join as
|
|
18218
|
+
import { existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
|
|
18219
|
+
import { homedir as homedir4 } from "os";
|
|
18220
|
+
import { join as join7 } from "path";
|
|
19257
18221
|
function shellHookRecipe(shell) {
|
|
19258
18222
|
return RECIPES[shell];
|
|
19259
18223
|
}
|
|
@@ -19283,20 +18247,20 @@ function shellHookOneLiner(shell = detectShell()) {
|
|
|
19283
18247
|
return `Optional: add \`${line}\` to ${rc} so credentials auto-activate on cd.`;
|
|
19284
18248
|
}
|
|
19285
18249
|
function rcCandidates(shell, platform = process.platform) {
|
|
19286
|
-
const home =
|
|
18250
|
+
const home = homedir4();
|
|
19287
18251
|
switch (shell) {
|
|
19288
18252
|
case "bash":
|
|
19289
|
-
return platform === "darwin" ? [
|
|
18253
|
+
return platform === "darwin" ? [join7(home, ".bash_profile"), join7(home, ".bashrc")] : [join7(home, ".bashrc")];
|
|
19290
18254
|
case "zsh":
|
|
19291
|
-
return [
|
|
18255
|
+
return [join7(home, ".zshrc")];
|
|
19292
18256
|
case "fish":
|
|
19293
|
-
return [
|
|
18257
|
+
return [join7(home, ".config", "fish", "config.fish")];
|
|
19294
18258
|
}
|
|
19295
18259
|
}
|
|
19296
18260
|
function isHookInstalled(shell, platform = process.platform) {
|
|
19297
18261
|
for (const path of rcCandidates(shell, platform)) {
|
|
19298
18262
|
try {
|
|
19299
|
-
if (
|
|
18263
|
+
if (existsSync5(path) && /codevector hook/.test(readFileSync7(path, "utf8"))) return true;
|
|
19300
18264
|
} catch {
|
|
19301
18265
|
}
|
|
19302
18266
|
}
|
|
@@ -19321,8 +18285,8 @@ __export(init_exports, {
|
|
|
19321
18285
|
initCommand: () => initCommand
|
|
19322
18286
|
});
|
|
19323
18287
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
19324
|
-
import { existsSync as
|
|
19325
|
-
import { join as
|
|
18288
|
+
import { existsSync as existsSync6 } from "fs";
|
|
18289
|
+
import { join as join8 } from "path";
|
|
19326
18290
|
function isInteractive(args) {
|
|
19327
18291
|
if (!process.stdout.isTTY) return false;
|
|
19328
18292
|
return !args.gateway;
|
|
@@ -19453,8 +18417,8 @@ var init_init = __esm({
|
|
|
19453
18417
|
},
|
|
19454
18418
|
async run({ args }) {
|
|
19455
18419
|
const cwd = userCwd();
|
|
19456
|
-
const target =
|
|
19457
|
-
const existing =
|
|
18420
|
+
const target = join8(cwd, PROJECT_CONFIG_FILENAME);
|
|
18421
|
+
const existing = existsSync6(target) ? readProjectConfigAt(target) : null;
|
|
19458
18422
|
const interactive = isInteractive(args);
|
|
19459
18423
|
if (existing && !args.force && !interactive) {
|
|
19460
18424
|
throw new Error(
|
|
@@ -19486,7 +18450,7 @@ var init_init = __esm({
|
|
|
19486
18450
|
if (!args["skip-configure"] && interactive && gateway) {
|
|
19487
18451
|
const run = unwrap(
|
|
19488
18452
|
await ue({
|
|
19489
|
-
message: "Configure coding tools (Claude Code,
|
|
18453
|
+
message: "Configure coding tools (Claude Code, OpenCode) for this repo now?",
|
|
19490
18454
|
initialValue: true
|
|
19491
18455
|
})
|
|
19492
18456
|
);
|
|
@@ -19506,9 +18470,9 @@ var init_init = __esm({
|
|
|
19506
18470
|
});
|
|
19507
18471
|
|
|
19508
18472
|
// src/commands/configure.ts
|
|
19509
|
-
import { homedir as
|
|
19510
|
-
import { existsSync as
|
|
19511
|
-
import { join as
|
|
18473
|
+
import { homedir as homedir5 } from "os";
|
|
18474
|
+
import { existsSync as existsSync7 } from "fs";
|
|
18475
|
+
import { join as join9 } from "path";
|
|
19512
18476
|
async function resolveTools(args) {
|
|
19513
18477
|
if (args.all) return [...ALL_TOOLS];
|
|
19514
18478
|
if (args.tool) {
|
|
@@ -19571,12 +18535,10 @@ function pathHint(tools, scope) {
|
|
|
19571
18535
|
return relativizeHomeAndCwd(claudeSettingsPath(scope));
|
|
19572
18536
|
case "opencode":
|
|
19573
18537
|
return relativizeHomeAndCwd(opencodeSettingsPath(scope));
|
|
19574
|
-
case "codex":
|
|
19575
|
-
return relativizeHomeAndCwd(codexConfigPath(scope));
|
|
19576
18538
|
}
|
|
19577
18539
|
}
|
|
19578
18540
|
function relativizeHomeAndCwd(absolutePath) {
|
|
19579
|
-
const home =
|
|
18541
|
+
const home = homedir5();
|
|
19580
18542
|
const cwd = userCwd();
|
|
19581
18543
|
if (home && absolutePath.startsWith(`${home}/`)) {
|
|
19582
18544
|
return `~${absolutePath.slice(home.length)}`;
|
|
@@ -19590,7 +18552,7 @@ function isTool(value) {
|
|
|
19590
18552
|
return ALL_TOOLS.includes(value);
|
|
19591
18553
|
}
|
|
19592
18554
|
function mergeToolsIntoProjectConfig(cwd, tools, gatewayUrl) {
|
|
19593
|
-
const path =
|
|
18555
|
+
const path = join9(cwd, PROJECT_CONFIG_FILENAME);
|
|
19594
18556
|
const existing = readProjectConfigAt(path) ?? {};
|
|
19595
18557
|
const byTool = new Map((existing.tools ?? []).map((c) => [c.tool, c]));
|
|
19596
18558
|
for (const cfg of tools) byTool.set(cfg.tool, cfg);
|
|
@@ -19684,14 +18646,12 @@ var init_configure = __esm({
|
|
|
19684
18646
|
init_project_config();
|
|
19685
18647
|
init_shell_hook();
|
|
19686
18648
|
init_claude_code();
|
|
19687
|
-
init_codex();
|
|
19688
18649
|
init_opencode();
|
|
19689
18650
|
WRITERS2 = {
|
|
19690
18651
|
"claude-code": writeClaudeCodeConfig,
|
|
19691
|
-
opencode: writeOpencodeConfig
|
|
19692
|
-
codex: writeCodexConfig
|
|
18652
|
+
opencode: writeOpencodeConfig
|
|
19693
18653
|
};
|
|
19694
|
-
ALL_TOOLS = ["claude-code", "opencode"
|
|
18654
|
+
ALL_TOOLS = ["claude-code", "opencode"];
|
|
19695
18655
|
SCOPES = ["local", "project"];
|
|
19696
18656
|
configureCommand = defineCommand({
|
|
19697
18657
|
meta: {
|
|
@@ -19702,7 +18662,7 @@ var init_configure = __esm({
|
|
|
19702
18662
|
tool: {
|
|
19703
18663
|
type: "positional",
|
|
19704
18664
|
required: false,
|
|
19705
|
-
description: "Tool to configure. Prompted if omitted. One of: claude-code, opencode,
|
|
18665
|
+
description: "Tool to configure. Prompted if omitted. One of: claude-code, opencode, all."
|
|
19706
18666
|
},
|
|
19707
18667
|
scope: {
|
|
19708
18668
|
type: "string",
|
|
@@ -19727,7 +18687,7 @@ var init_configure = __esm({
|
|
|
19727
18687
|
);
|
|
19728
18688
|
}
|
|
19729
18689
|
const cwd = userCwd();
|
|
19730
|
-
if (process.stdout.isTTY && !
|
|
18690
|
+
if (process.stdout.isTTY && !existsSync7(join9(cwd, PROJECT_CONFIG_FILENAME))) {
|
|
19731
18691
|
const runInit = unwrap(
|
|
19732
18692
|
await ue({
|
|
19733
18693
|
message: `No ${PROJECT_CONFIG_FILENAME} in this repo yet. Run \`codevector init\` first to set it up (project name, ticket pattern, gateway)?`,
|
|
@@ -20085,15 +19045,13 @@ init_dist();
|
|
|
20085
19045
|
init_dist5();
|
|
20086
19046
|
init_api_client();
|
|
20087
19047
|
init_claude_code();
|
|
20088
|
-
init_codex();
|
|
20089
19048
|
init_opencode();
|
|
20090
19049
|
init_credentials();
|
|
20091
19050
|
init_paths();
|
|
20092
19051
|
init_project_config();
|
|
20093
19052
|
var WRITERS = {
|
|
20094
19053
|
"claude-code": writeClaudeCodeConfig,
|
|
20095
|
-
opencode: writeOpencodeConfig
|
|
20096
|
-
codex: writeCodexConfig
|
|
19054
|
+
opencode: writeOpencodeConfig
|
|
20097
19055
|
};
|
|
20098
19056
|
var configSyncCommand = defineCommand({
|
|
20099
19057
|
meta: {
|
|
@@ -20128,7 +19086,7 @@ var configSyncCommand = defineCommand({
|
|
|
20128
19086
|
`Active profile "${profiles.activeProfile}" is missing from credentials. Run \`codevector auth login\`.`
|
|
20129
19087
|
);
|
|
20130
19088
|
}
|
|
20131
|
-
if (config2.gateway &&
|
|
19089
|
+
if (config2.gateway && trimRightSlash4(creds.gatewayUrl) !== trimRightSlash4(config2.gateway)) {
|
|
20132
19090
|
R2.warn(
|
|
20133
19091
|
`Active profile points at ${creds.gatewayUrl} but manifest pins ${config2.gateway}. Sync will use the active profile.`
|
|
20134
19092
|
);
|
|
@@ -20244,7 +19202,7 @@ async function fetchReachableChatModels(creds) {
|
|
|
20244
19202
|
return [];
|
|
20245
19203
|
}
|
|
20246
19204
|
}
|
|
20247
|
-
function
|
|
19205
|
+
function trimRightSlash4(url2) {
|
|
20248
19206
|
return url2.endsWith("/") ? url2.slice(0, -1) : url2;
|
|
20249
19207
|
}
|
|
20250
19208
|
|
|
@@ -20267,26 +19225,25 @@ init_dist();
|
|
|
20267
19225
|
init_dist5();
|
|
20268
19226
|
init_api_client();
|
|
20269
19227
|
init_claude_code();
|
|
20270
|
-
init_codex();
|
|
20271
19228
|
init_opencode();
|
|
20272
19229
|
init_credentials();
|
|
20273
|
-
import { existsSync as
|
|
20274
|
-
import { join as
|
|
19230
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9, rmSync as rmSync2, writeFileSync as writeFileSync7 } from "fs";
|
|
19231
|
+
import { join as join11 } from "path";
|
|
20275
19232
|
|
|
20276
19233
|
// src/lib/install-pref.ts
|
|
20277
19234
|
init_paths();
|
|
20278
|
-
import { existsSync as
|
|
20279
|
-
import { join as
|
|
19235
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync8, realpathSync, renameSync as renameSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
19236
|
+
import { join as join10, sep } from "path";
|
|
20280
19237
|
import { fileURLToPath } from "url";
|
|
20281
|
-
var INSTALL_PREF_FILE =
|
|
19238
|
+
var INSTALL_PREF_FILE = join10(CODEVECTOR_CONFIG_DIR, "install.json");
|
|
20282
19239
|
var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn"];
|
|
20283
19240
|
function isPackageManager(v2) {
|
|
20284
19241
|
return typeof v2 === "string" && PACKAGE_MANAGERS.includes(v2);
|
|
20285
19242
|
}
|
|
20286
19243
|
function readInstallPref() {
|
|
20287
|
-
if (!
|
|
19244
|
+
if (!existsSync8(INSTALL_PREF_FILE)) return void 0;
|
|
20288
19245
|
try {
|
|
20289
|
-
const raw =
|
|
19246
|
+
const raw = readFileSync8(INSTALL_PREF_FILE, "utf8");
|
|
20290
19247
|
const parsed = JSON.parse(raw);
|
|
20291
19248
|
if (!isPackageManager(parsed.packageManager)) return void 0;
|
|
20292
19249
|
const source = parsed.source === "user" ? "user" : "auto";
|
|
@@ -20300,10 +19257,10 @@ function readInstallPref() {
|
|
|
20300
19257
|
}
|
|
20301
19258
|
}
|
|
20302
19259
|
function writeInstallPref(pref) {
|
|
20303
|
-
|
|
19260
|
+
mkdirSync4(CODEVECTOR_CONFIG_DIR, { recursive: true, mode: 448 });
|
|
20304
19261
|
const tmp = `${INSTALL_PREF_FILE}.${process.pid}.tmp`;
|
|
20305
|
-
|
|
20306
|
-
|
|
19262
|
+
writeFileSync6(tmp, JSON.stringify(pref, null, 2));
|
|
19263
|
+
renameSync3(tmp, INSTALL_PREF_FILE);
|
|
20307
19264
|
}
|
|
20308
19265
|
function packageManagerFromPath(installPath) {
|
|
20309
19266
|
if (installPath.includes(`${sep}.pnpm${sep}`)) return "pnpm";
|
|
@@ -20420,9 +19377,9 @@ function inspectUpdateManager() {
|
|
|
20420
19377
|
function inspectClaudeSettings() {
|
|
20421
19378
|
for (const scope of CLAUDE_SCOPE_ORDER) {
|
|
20422
19379
|
const path = claudeSettingsPath(scope);
|
|
20423
|
-
if (!
|
|
19380
|
+
if (!existsSync9(path)) continue;
|
|
20424
19381
|
try {
|
|
20425
|
-
const raw = JSON.parse(
|
|
19382
|
+
const raw = JSON.parse(readFileSync9(path, "utf8"));
|
|
20426
19383
|
if (typeof raw.env?.ANTHROPIC_BASE_URL === "string") {
|
|
20427
19384
|
return {
|
|
20428
19385
|
level: "ok",
|
|
@@ -20490,7 +19447,7 @@ function inspectManifestDrift() {
|
|
|
20490
19447
|
});
|
|
20491
19448
|
continue;
|
|
20492
19449
|
}
|
|
20493
|
-
if (!
|
|
19450
|
+
if (!existsSync9(path)) {
|
|
20494
19451
|
checks.push({
|
|
20495
19452
|
level: "fail",
|
|
20496
19453
|
label: `manifest drift: ${tool.tool}`,
|
|
@@ -20500,7 +19457,7 @@ function inspectManifestDrift() {
|
|
|
20500
19457
|
}
|
|
20501
19458
|
let raw;
|
|
20502
19459
|
try {
|
|
20503
|
-
raw =
|
|
19460
|
+
raw = readFileSync9(path, "utf8");
|
|
20504
19461
|
} catch (err) {
|
|
20505
19462
|
checks.push({
|
|
20506
19463
|
level: "fail",
|
|
@@ -20530,7 +19487,7 @@ function pruneAcceptanceHook() {
|
|
|
20530
19487
|
const cleaned = [];
|
|
20531
19488
|
for (const scope of CLAUDE_SCOPE_ORDER) {
|
|
20532
19489
|
const path = claudeSettingsPath(scope);
|
|
20533
|
-
if (!
|
|
19490
|
+
if (!existsSync9(path)) continue;
|
|
20534
19491
|
try {
|
|
20535
19492
|
if (removeAcceptanceHookFromSettings(path)) cleaned.push(scope);
|
|
20536
19493
|
} catch {
|
|
@@ -20543,8 +19500,8 @@ function pruneAcceptanceHook() {
|
|
|
20543
19500
|
detail: `cleared stale hook from claude-code settings [${cleaned.join(", ")}]`
|
|
20544
19501
|
});
|
|
20545
19502
|
}
|
|
20546
|
-
const legacyHooksDir =
|
|
20547
|
-
if (
|
|
19503
|
+
const legacyHooksDir = join11(CODEVECTOR_CONFIG_DIR, "hooks");
|
|
19504
|
+
if (existsSync9(legacyHooksDir)) {
|
|
20548
19505
|
try {
|
|
20549
19506
|
rmSync2(legacyHooksDir, { recursive: true, force: true });
|
|
20550
19507
|
checks.push({
|
|
@@ -20558,7 +19515,7 @@ function pruneAcceptanceHook() {
|
|
|
20558
19515
|
return checks;
|
|
20559
19516
|
}
|
|
20560
19517
|
function removeAcceptanceHookFromSettings(path) {
|
|
20561
|
-
const parsed = JSON.parse(
|
|
19518
|
+
const parsed = JSON.parse(readFileSync9(path, "utf8"));
|
|
20562
19519
|
const hooks = parsed.hooks;
|
|
20563
19520
|
if (!isPlainObject3(hooks)) return false;
|
|
20564
19521
|
let mutated = false;
|
|
@@ -20572,7 +19529,7 @@ function removeAcceptanceHookFromSettings(path) {
|
|
|
20572
19529
|
else hooks[event] = entries;
|
|
20573
19530
|
}
|
|
20574
19531
|
if (Object.keys(hooks).length === 0) delete parsed.hooks;
|
|
20575
|
-
if (mutated)
|
|
19532
|
+
if (mutated) writeFileSync7(path, `${JSON.stringify(parsed, null, 2)}
|
|
20576
19533
|
`);
|
|
20577
19534
|
return mutated;
|
|
20578
19535
|
}
|
|
@@ -20615,8 +19572,6 @@ function manifestToolPath(tool, scope) {
|
|
|
20615
19572
|
return claudeSettingsPath(scope);
|
|
20616
19573
|
case "opencode":
|
|
20617
19574
|
return opencodeSettingsPath(scope);
|
|
20618
|
-
case "codex":
|
|
20619
|
-
return codexConfigPath(scope);
|
|
20620
19575
|
default:
|
|
20621
19576
|
return null;
|
|
20622
19577
|
}
|
|
@@ -20689,10 +19644,10 @@ var envCommand = defineCommand({
|
|
|
20689
19644
|
}
|
|
20690
19645
|
const { name: profileName, profile } = match;
|
|
20691
19646
|
const headers = buildAnthropicCustomHeaders(projectName);
|
|
20692
|
-
emitExport(lines, shell, "ANTHROPIC_BASE_URL", `${
|
|
19647
|
+
emitExport(lines, shell, "ANTHROPIC_BASE_URL", `${trimRightSlash5(profile.gatewayUrl)}/gateway/anthropic`);
|
|
20693
19648
|
emitExport(lines, shell, "ANTHROPIC_API_KEY", profile.apiKey);
|
|
20694
19649
|
if (headers) emitExport(lines, shell, "ANTHROPIC_CUSTOM_HEADERS", headers);
|
|
20695
|
-
emitExport(lines, shell, "OPENAI_BASE_URL", `${
|
|
19650
|
+
emitExport(lines, shell, "OPENAI_BASE_URL", `${trimRightSlash5(profile.gatewayUrl)}/gateway/openai/v1`);
|
|
20696
19651
|
emitExport(lines, shell, "OPENAI_API_KEY", profile.apiKey);
|
|
20697
19652
|
emitExport(lines, shell, "CODEVECTOR_ACTIVE_DIR", repoDir);
|
|
20698
19653
|
emitExport(lines, shell, "CODEVECTOR_ACTIVE_PROFILE", profileName);
|
|
@@ -20700,7 +19655,7 @@ var envCommand = defineCommand({
|
|
|
20700
19655
|
emitEcho(
|
|
20701
19656
|
lines,
|
|
20702
19657
|
shell,
|
|
20703
|
-
`codevector: ${profileName} -> ${
|
|
19658
|
+
`codevector: ${profileName} -> ${trimRightSlash5(profile.gatewayUrl)}${projectSuffix}`
|
|
20704
19659
|
);
|
|
20705
19660
|
process.stdout.write(lines.join("\n") + "\n");
|
|
20706
19661
|
}
|
|
@@ -20747,7 +19702,7 @@ function emitDeactivate(lines, shell, previousDir) {
|
|
|
20747
19702
|
function shellQuote(value) {
|
|
20748
19703
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
20749
19704
|
}
|
|
20750
|
-
function
|
|
19705
|
+
function trimRightSlash5(url2) {
|
|
20751
19706
|
return url2.endsWith("/") ? url2.slice(0, -1) : url2;
|
|
20752
19707
|
}
|
|
20753
19708
|
function dirOf(filePath) {
|
|
@@ -20761,9 +19716,9 @@ function buildAnthropicCustomHeaders(projectName) {
|
|
|
20761
19716
|
return `x-project: ${safe}`;
|
|
20762
19717
|
}
|
|
20763
19718
|
function pickProfileForGateway(profiles, activeProfile, gateway) {
|
|
20764
|
-
const target =
|
|
19719
|
+
const target = trimRightSlash5(gateway);
|
|
20765
19720
|
const matches = Object.entries(profiles).filter(
|
|
20766
|
-
([, p2]) =>
|
|
19721
|
+
([, p2]) => trimRightSlash5(p2.gatewayUrl) === target
|
|
20767
19722
|
);
|
|
20768
19723
|
if (matches.length === 0) return null;
|
|
20769
19724
|
if (activeProfile) {
|
|
@@ -20775,6 +19730,378 @@ function pickProfileForGateway(profiles, activeProfile, gateway) {
|
|
|
20775
19730
|
return { name: picked[0], profile: picked[1] };
|
|
20776
19731
|
}
|
|
20777
19732
|
|
|
19733
|
+
// src/commands/github/index.ts
|
|
19734
|
+
init_dist();
|
|
19735
|
+
|
|
19736
|
+
// src/commands/github/init.ts
|
|
19737
|
+
init_dist();
|
|
19738
|
+
init_dist5();
|
|
19739
|
+
init_api_client();
|
|
19740
|
+
init_credentials();
|
|
19741
|
+
init_paths();
|
|
19742
|
+
init_prompt();
|
|
19743
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
19744
|
+
import { join as join12 } from "path";
|
|
19745
|
+
|
|
19746
|
+
// src/commands/github/workflow-yaml.ts
|
|
19747
|
+
function generateWorkflowYaml(opts) {
|
|
19748
|
+
const baseUrl = opts.gatewayUrl.replace(/\/$/, "");
|
|
19749
|
+
const sanitized = { ...opts, gatewayUrl: baseUrl };
|
|
19750
|
+
return sanitized.tool === "claude-code" ? claudeCodeWorkflow(sanitized) : opencodeWorkflow(sanitized);
|
|
19751
|
+
}
|
|
19752
|
+
function claudeCodeWorkflow(opts) {
|
|
19753
|
+
const modelEnv = opts.model ? ` ANTHROPIC_MODEL: ${opts.model}
|
|
19754
|
+
` : "";
|
|
19755
|
+
return [
|
|
19756
|
+
`# Generated by codevector github init. Do not edit manually.`,
|
|
19757
|
+
`# Routes all PR review requests through the CodeVector gateway.`,
|
|
19758
|
+
`name: CodeVector PR Review (Claude Code)`,
|
|
19759
|
+
``,
|
|
19760
|
+
`on:`,
|
|
19761
|
+
` pull_request:`,
|
|
19762
|
+
` types: [opened, synchronize]`,
|
|
19763
|
+
` issue_comment:`,
|
|
19764
|
+
` types: [created]`,
|
|
19765
|
+
` pull_request_review_comment:`,
|
|
19766
|
+
` types: [created]`,
|
|
19767
|
+
``,
|
|
19768
|
+
`concurrency:`,
|
|
19769
|
+
` group: codevector-pr-review-claude-code-\${{ github.event.pull_request.number || github.event.issue.number }}`,
|
|
19770
|
+
` cancel-in-progress: true`,
|
|
19771
|
+
``,
|
|
19772
|
+
`permissions:`,
|
|
19773
|
+
` contents: read`,
|
|
19774
|
+
` pull-requests: write`,
|
|
19775
|
+
``,
|
|
19776
|
+
`jobs:`,
|
|
19777
|
+
` review:`,
|
|
19778
|
+
` if: |`,
|
|
19779
|
+
` github.event_name == 'pull_request' ||`,
|
|
19780
|
+
` (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@claude')) ||`,
|
|
19781
|
+
` (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))`,
|
|
19782
|
+
` runs-on: ubuntu-latest`,
|
|
19783
|
+
` steps:`,
|
|
19784
|
+
` - uses: actions/checkout@v4`,
|
|
19785
|
+
` - uses: actions/setup-node@v4`,
|
|
19786
|
+
` with:`,
|
|
19787
|
+
` node-version: '24'`,
|
|
19788
|
+
` - run: npm install -g @anthropic-ai/claude-code`,
|
|
19789
|
+
` - name: Review PR`,
|
|
19790
|
+
` env:`,
|
|
19791
|
+
` ANTHROPIC_API_KEY: \${{ secrets.${opts.secretName} }}`,
|
|
19792
|
+
` ANTHROPIC_BASE_URL: ${opts.gatewayUrl}/gateway/anthropic`,
|
|
19793
|
+
`${modelEnv}`,
|
|
19794
|
+
` run: |`,
|
|
19795
|
+
` claude --dangerously-skip-permissions -p "Review this PR and provide concise, actionable feedback. Focus on bugs, security issues, and code quality." \\`,
|
|
19796
|
+
` --output-format text \\`,
|
|
19797
|
+
` --allowedTools "Bash(git diff origin/\${{ github.base_ref }}...HEAD),Bash(git log origin/\${{ github.base_ref }}..HEAD),Read" \\`,
|
|
19798
|
+
` > review.md`,
|
|
19799
|
+
` - name: Post review comment`,
|
|
19800
|
+
` env:`,
|
|
19801
|
+
` GH_TOKEN: \${{ github.token }}`,
|
|
19802
|
+
` run: |`,
|
|
19803
|
+
` gh pr comment \${{ github.event.pull_request.number || github.event.issue.number }} --body-file review.md`
|
|
19804
|
+
].join("\n").trimEnd() + "\n";
|
|
19805
|
+
}
|
|
19806
|
+
function opencodeModelEntryLines(model) {
|
|
19807
|
+
const name = model.split("-").map((w3) => w3.charAt(0).toUpperCase() + w3.slice(1)).join(" ");
|
|
19808
|
+
return [
|
|
19809
|
+
` "models": {`,
|
|
19810
|
+
` "${model}": {`,
|
|
19811
|
+
` "name": "${name}"`,
|
|
19812
|
+
` }`,
|
|
19813
|
+
` }`
|
|
19814
|
+
];
|
|
19815
|
+
}
|
|
19816
|
+
function opencodeWorkflow(opts) {
|
|
19817
|
+
const model = opts.model || "deepseek-pro";
|
|
19818
|
+
return [
|
|
19819
|
+
`# Generated by codevector github init. Do not edit manually.`,
|
|
19820
|
+
`# Routes all PR review requests through the CodeVector gateway via OpenCode CLI.`,
|
|
19821
|
+
`name: CodeVector PR Review (OpenCode)`,
|
|
19822
|
+
``,
|
|
19823
|
+
`on:`,
|
|
19824
|
+
` pull_request:`,
|
|
19825
|
+
` types: [opened, synchronize]`,
|
|
19826
|
+
` issue_comment:`,
|
|
19827
|
+
` types: [created]`,
|
|
19828
|
+
` pull_request_review_comment:`,
|
|
19829
|
+
` types: [created]`,
|
|
19830
|
+
``,
|
|
19831
|
+
`concurrency:`,
|
|
19832
|
+
` group: codevector-pr-review-opencode-\${{ github.event.pull_request.number || github.event.issue.number }}`,
|
|
19833
|
+
` cancel-in-progress: true`,
|
|
19834
|
+
``,
|
|
19835
|
+
`permissions:`,
|
|
19836
|
+
` contents: read`,
|
|
19837
|
+
` pull-requests: write`,
|
|
19838
|
+
``,
|
|
19839
|
+
`jobs:`,
|
|
19840
|
+
` review:`,
|
|
19841
|
+
` if: |`,
|
|
19842
|
+
` github.event_name == 'pull_request' ||`,
|
|
19843
|
+
` (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@opencode')) ||`,
|
|
19844
|
+
` (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@opencode'))`,
|
|
19845
|
+
` runs-on: ubuntu-latest`,
|
|
19846
|
+
` steps:`,
|
|
19847
|
+
` - uses: actions/checkout@v4`,
|
|
19848
|
+
` - name: Install OpenCode CLI`,
|
|
19849
|
+
` run: curl -fsSL https://opencode.ai/install | bash`,
|
|
19850
|
+
` - name: Configure OpenCode`,
|
|
19851
|
+
` run: |`,
|
|
19852
|
+
` cat > opencode.json << 'OPEOF'`,
|
|
19853
|
+
` {`,
|
|
19854
|
+
` "$schema": "https://opencode.ai/config.json",`,
|
|
19855
|
+
` "provider": {`,
|
|
19856
|
+
` "codevector": {`,
|
|
19857
|
+
` "options": {`,
|
|
19858
|
+
` "apiKey": "{env:CODEVECTOR_API_KEY}",`,
|
|
19859
|
+
` "baseURL": "${opts.gatewayUrl}/gateway/openai/v1",`,
|
|
19860
|
+
` "headers": {`,
|
|
19861
|
+
` "x-client-app": "opencode",`,
|
|
19862
|
+
` "x-project": "codevector"`,
|
|
19863
|
+
` }`,
|
|
19864
|
+
` },`,
|
|
19865
|
+
...opencodeModelEntryLines(model),
|
|
19866
|
+
` }`,
|
|
19867
|
+
` },`,
|
|
19868
|
+
` "model": "codevector/${model}"`,
|
|
19869
|
+
` }`,
|
|
19870
|
+
` OPEOF`,
|
|
19871
|
+
` - name: Generate PR Diff`,
|
|
19872
|
+
` env:`,
|
|
19873
|
+
` GH_TOKEN: \${{ github.token }}`,
|
|
19874
|
+
` run: |`,
|
|
19875
|
+
` PR_NUMBER=\${{ github.event.pull_request.number || github.event.issue.number }}`,
|
|
19876
|
+
` gh pr diff $PR_NUMBER > pr_diff.txt`,
|
|
19877
|
+
` - name: Fetch AI Review`,
|
|
19878
|
+
` env:`,
|
|
19879
|
+
` CODEVECTOR_API_KEY: \${{ secrets.${opts.secretName} }}`,
|
|
19880
|
+
` run: |`,
|
|
19881
|
+
` export PATH="$HOME/.opencode/bin:$PATH"`,
|
|
19882
|
+
` opencode run --model codevector/${model} \\`,
|
|
19883
|
+
` --dangerously-skip-permissions \\`,
|
|
19884
|
+
` "Review this PR and provide concise, actionable feedback. Focus on bugs, security issues, and code quality." \\`,
|
|
19885
|
+
` -f pr_diff.txt \\`,
|
|
19886
|
+
` > review.md`,
|
|
19887
|
+
` - name: Post review comment`,
|
|
19888
|
+
` env:`,
|
|
19889
|
+
` GH_TOKEN: \${{ github.token }}`,
|
|
19890
|
+
` run: |`,
|
|
19891
|
+
` PR_NUMBER=\${{ github.event.pull_request.number || github.event.issue.number }}`,
|
|
19892
|
+
` gh pr comment $PR_NUMBER --body-file review.md`
|
|
19893
|
+
].join("\n").trimEnd() + "\n";
|
|
19894
|
+
}
|
|
19895
|
+
|
|
19896
|
+
// src/commands/github/init.ts
|
|
19897
|
+
var ALL_TOOLS2 = ["claude-code", "opencode"];
|
|
19898
|
+
var WORKFLOW_FILENAMES = {
|
|
19899
|
+
"claude-code": "codevector-pr-review-claude-code.yml",
|
|
19900
|
+
opencode: "codevector-pr-review-opencode.yml"
|
|
19901
|
+
};
|
|
19902
|
+
var githubInitCommand = defineCommand({
|
|
19903
|
+
meta: {
|
|
19904
|
+
name: "init",
|
|
19905
|
+
description: "Generate a GitHub Actions workflow that routes PR review through the CodeVector gateway."
|
|
19906
|
+
},
|
|
19907
|
+
args: {
|
|
19908
|
+
tool: {
|
|
19909
|
+
type: "string",
|
|
19910
|
+
description: "Tool: claude-code or opencode. Prompted if omitted.",
|
|
19911
|
+
valueHint: "claude-code|opencode"
|
|
19912
|
+
},
|
|
19913
|
+
model: {
|
|
19914
|
+
type: "string",
|
|
19915
|
+
description: "Model slug to pin for PR review. Prompted if interactive and --tool is set."
|
|
19916
|
+
},
|
|
19917
|
+
"secret-name": {
|
|
19918
|
+
type: "string",
|
|
19919
|
+
default: "CODEVECTOR_API_KEY",
|
|
19920
|
+
description: "GitHub secret name for the API key."
|
|
19921
|
+
},
|
|
19922
|
+
"gateway-url": {
|
|
19923
|
+
type: "string",
|
|
19924
|
+
description: "Gateway base URL. Uses the active profile if omitted."
|
|
19925
|
+
},
|
|
19926
|
+
force: {
|
|
19927
|
+
type: "boolean",
|
|
19928
|
+
default: false,
|
|
19929
|
+
description: "Overwrite existing workflow file without prompting."
|
|
19930
|
+
},
|
|
19931
|
+
"dry-run": {
|
|
19932
|
+
type: "boolean",
|
|
19933
|
+
default: false,
|
|
19934
|
+
description: "Print the workflow to stdout instead of writing to disk."
|
|
19935
|
+
}
|
|
19936
|
+
},
|
|
19937
|
+
async run({ args }) {
|
|
19938
|
+
const interactive = isInteractive2(args);
|
|
19939
|
+
if (interactive) ge("codevector github init");
|
|
19940
|
+
const profile = await getActiveProfile();
|
|
19941
|
+
const gatewayUrl = resolveGatewayUrl(args, profile, interactive);
|
|
19942
|
+
const tool = await resolveTool(args, interactive);
|
|
19943
|
+
const model = await resolveModel(args, tool, gatewayUrl, profile, interactive);
|
|
19944
|
+
const secretName = args["secret-name"] ?? "CODEVECTOR_API_KEY";
|
|
19945
|
+
const yaml = generateWorkflowYaml({
|
|
19946
|
+
tool,
|
|
19947
|
+
gatewayUrl: gatewayUrl.replace(/\/$/, ""),
|
|
19948
|
+
secretName,
|
|
19949
|
+
...model ? { model } : {}
|
|
19950
|
+
});
|
|
19951
|
+
if (args["dry-run"]) {
|
|
19952
|
+
process.stdout.write(yaml);
|
|
19953
|
+
if (interactive) {
|
|
19954
|
+
Se(
|
|
19955
|
+
`Run without --dry-run to write .github/workflows/${WORKFLOW_FILENAMES[tool]}.`,
|
|
19956
|
+
"Dry run"
|
|
19957
|
+
);
|
|
19958
|
+
ye("Done.");
|
|
19959
|
+
}
|
|
19960
|
+
return;
|
|
19961
|
+
}
|
|
19962
|
+
const cwd = userCwd();
|
|
19963
|
+
const workflowsDir = join12(cwd, ".github", "workflows");
|
|
19964
|
+
const filePath = join12(workflowsDir, WORKFLOW_FILENAMES[tool]);
|
|
19965
|
+
if (existsSync10(filePath) && !args.force) {
|
|
19966
|
+
if (!interactive) {
|
|
19967
|
+
throw new Error(
|
|
19968
|
+
`${filePath} already exists. Pass --force to overwrite.`
|
|
19969
|
+
);
|
|
19970
|
+
}
|
|
19971
|
+
const overwrite = unwrap(
|
|
19972
|
+
await ue({
|
|
19973
|
+
message: `${WORKFLOW_FILENAMES[tool]} already exists. Overwrite?`,
|
|
19974
|
+
initialValue: false
|
|
19975
|
+
})
|
|
19976
|
+
);
|
|
19977
|
+
if (!overwrite) {
|
|
19978
|
+
ye("Cancelled.");
|
|
19979
|
+
return;
|
|
19980
|
+
}
|
|
19981
|
+
}
|
|
19982
|
+
mkdirSync5(workflowsDir, { recursive: true });
|
|
19983
|
+
writeFileSync8(filePath, yaml, { mode: 420 });
|
|
19984
|
+
if (interactive) {
|
|
19985
|
+
R2.success(`Wrote ${filePath}`);
|
|
19986
|
+
Se(
|
|
19987
|
+
`Run this to activate:
|
|
19988
|
+
gh secret set ${secretName} --body "cv_xxxx"`,
|
|
19989
|
+
"Next step"
|
|
19990
|
+
);
|
|
19991
|
+
ye("Done.");
|
|
19992
|
+
} else {
|
|
19993
|
+
R2.success(`Wrote ${filePath}`);
|
|
19994
|
+
}
|
|
19995
|
+
}
|
|
19996
|
+
});
|
|
19997
|
+
function isInteractive2(args) {
|
|
19998
|
+
if (!process.stdout.isTTY) return false;
|
|
19999
|
+
return !args.tool || !args["gateway-url"];
|
|
20000
|
+
}
|
|
20001
|
+
function resolveGatewayUrl(args, profile, interactive) {
|
|
20002
|
+
if (args["gateway-url"]) {
|
|
20003
|
+
const url2 = args["gateway-url"];
|
|
20004
|
+
try {
|
|
20005
|
+
new URL(url2);
|
|
20006
|
+
} catch {
|
|
20007
|
+
throw new Error(`Invalid --gateway-url: "${url2}" is not a valid URL.`);
|
|
20008
|
+
}
|
|
20009
|
+
return url2;
|
|
20010
|
+
}
|
|
20011
|
+
if (profile) return profile.gatewayUrl;
|
|
20012
|
+
if (!interactive) {
|
|
20013
|
+
throw new Error(
|
|
20014
|
+
"No active profile and --gateway-url not provided. Run `codevector auth login` or pass --gateway-url."
|
|
20015
|
+
);
|
|
20016
|
+
}
|
|
20017
|
+
throw new Error(
|
|
20018
|
+
"Not signed in and --gateway-url not provided. Run `codevector auth login` first, or pass --gateway-url."
|
|
20019
|
+
);
|
|
20020
|
+
}
|
|
20021
|
+
async function resolveTool(args, interactive) {
|
|
20022
|
+
if (args.tool) {
|
|
20023
|
+
if (!isTool2(args.tool)) {
|
|
20024
|
+
throw new Error(
|
|
20025
|
+
`Unsupported tool "${args.tool}". Use one of: ${ALL_TOOLS2.join(", ")}.`
|
|
20026
|
+
);
|
|
20027
|
+
}
|
|
20028
|
+
return args.tool;
|
|
20029
|
+
}
|
|
20030
|
+
if (!interactive) {
|
|
20031
|
+
throw new Error("--tool is required in non-interactive mode.");
|
|
20032
|
+
}
|
|
20033
|
+
return unwrap(
|
|
20034
|
+
await xe({
|
|
20035
|
+
message: "Which tool should the workflow use for PR review?",
|
|
20036
|
+
options: [
|
|
20037
|
+
{ value: "claude-code", label: "Claude Code", hint: "uses the @anthropic-ai/claude-code CLI" },
|
|
20038
|
+
{ value: "opencode", label: "OpenCode", hint: "uses the OpenCode CLI" }
|
|
20039
|
+
],
|
|
20040
|
+
initialValue: "claude-code"
|
|
20041
|
+
})
|
|
20042
|
+
);
|
|
20043
|
+
}
|
|
20044
|
+
async function resolveModel(args, _tool, gatewayUrl, profile, interactive) {
|
|
20045
|
+
if (args.model) return args.model;
|
|
20046
|
+
if (!interactive) return void 0;
|
|
20047
|
+
const models = profile ? await fetchReachableChatModels3(gatewayUrl, profile.apiKey) : [];
|
|
20048
|
+
if (models.length === 0) {
|
|
20049
|
+
R2.info("No chat models reachable \u2014 skipping model pin.");
|
|
20050
|
+
return void 0;
|
|
20051
|
+
}
|
|
20052
|
+
const SKIP = "__skip__";
|
|
20053
|
+
const picked = unwrap(
|
|
20054
|
+
await xe({
|
|
20055
|
+
message: "Pin a default model for PR review? (optional)",
|
|
20056
|
+
options: [
|
|
20057
|
+
{ value: SKIP, label: "Skip (recommended)", hint: "let the tool pick per request" },
|
|
20058
|
+
...models.map((m2) => ({
|
|
20059
|
+
value: m2.slug,
|
|
20060
|
+
label: m2.slug,
|
|
20061
|
+
hint: `${m2.displayName}${m2.providerKind ? ` \xB7 ${m2.providerKind}` : ""}`
|
|
20062
|
+
}))
|
|
20063
|
+
],
|
|
20064
|
+
initialValue: SKIP
|
|
20065
|
+
})
|
|
20066
|
+
);
|
|
20067
|
+
return picked === SKIP ? void 0 : picked;
|
|
20068
|
+
}
|
|
20069
|
+
async function fetchReachableChatModels3(gatewayUrl, apiKey) {
|
|
20070
|
+
const client = gatewayClient(gatewayUrl, apiKey, 1e4);
|
|
20071
|
+
const s = ft();
|
|
20072
|
+
s.start("Loading reachable models\u2026");
|
|
20073
|
+
try {
|
|
20074
|
+
const res = await call(parseResponse(client.models.$get()));
|
|
20075
|
+
const models = res.data.filter((m2) => m2.kind === "chat").map((m2) => ({
|
|
20076
|
+
slug: m2.slug,
|
|
20077
|
+
providerKind: m2.providerKind,
|
|
20078
|
+
displayName: m2.displayName
|
|
20079
|
+
}));
|
|
20080
|
+
s.stop(`${models.length} model${models.length === 1 ? "" : "s"} reachable`);
|
|
20081
|
+
return models;
|
|
20082
|
+
} catch (err) {
|
|
20083
|
+
s.stop("Could not load models");
|
|
20084
|
+
R2.warn(
|
|
20085
|
+
`Continuing without model list \u2014 ${err instanceof ApiClientError ? err.message : String(err)}.`
|
|
20086
|
+
);
|
|
20087
|
+
return [];
|
|
20088
|
+
}
|
|
20089
|
+
}
|
|
20090
|
+
function isTool2(value) {
|
|
20091
|
+
return ALL_TOOLS2.includes(value);
|
|
20092
|
+
}
|
|
20093
|
+
|
|
20094
|
+
// src/commands/github/index.ts
|
|
20095
|
+
var githubCommand = defineCommand({
|
|
20096
|
+
meta: {
|
|
20097
|
+
name: "github",
|
|
20098
|
+
description: "Generate GitHub Actions workflows that route PR review through the CodeVector gateway."
|
|
20099
|
+
},
|
|
20100
|
+
subCommands: {
|
|
20101
|
+
init: githubInitCommand
|
|
20102
|
+
}
|
|
20103
|
+
});
|
|
20104
|
+
|
|
20778
20105
|
// src/commands/hook.ts
|
|
20779
20106
|
init_dist();
|
|
20780
20107
|
init_shell();
|
|
@@ -21067,20 +20394,16 @@ var modelsCommand = defineCommand({
|
|
|
21067
20394
|
// src/commands/profile.ts
|
|
21068
20395
|
init_dist();
|
|
21069
20396
|
init_dist5();
|
|
21070
|
-
init_dist6();
|
|
21071
20397
|
init_claude_code();
|
|
21072
|
-
init_codex();
|
|
21073
20398
|
init_opencode();
|
|
21074
20399
|
init_api_client();
|
|
21075
20400
|
init_credentials();
|
|
21076
20401
|
init_paths();
|
|
21077
20402
|
init_prompt();
|
|
21078
20403
|
init_project_context();
|
|
21079
|
-
import { existsSync as existsSync11, readFileSync as readFileSync11 } from "fs";
|
|
21080
20404
|
var WRITERS3 = {
|
|
21081
20405
|
"claude-code": writeClaudeCodeConfig,
|
|
21082
|
-
opencode: writeOpencodeConfig
|
|
21083
|
-
codex: writeCodexConfig
|
|
20406
|
+
opencode: writeOpencodeConfig
|
|
21084
20407
|
};
|
|
21085
20408
|
var profileListCommand = defineCommand({
|
|
21086
20409
|
meta: {
|
|
@@ -21148,14 +20471,9 @@ Gateway: ${active.gatewayUrl}
|
|
|
21148
20471
|
Key: ${maskApiKey(active.apiKey)}`,
|
|
21149
20472
|
`Profile: ${selected}`
|
|
21150
20473
|
);
|
|
21151
|
-
const
|
|
21152
|
-
|
|
21153
|
-
|
|
21154
|
-
const toolConfigs = hasCodexUserConfig ? storedToolConfigs : [...storedToolConfigs, defaultCodexConfig];
|
|
21155
|
-
if (!hasCodexUserConfig) {
|
|
21156
|
-
R2.info(
|
|
21157
|
-
storedToolConfigs.length === 0 ? "No stored tool configurations for this profile; applying codex user-scope config." : "No stored codex configuration for this profile; applying codex user-scope config."
|
|
21158
|
-
);
|
|
20474
|
+
const toolConfigs = active.toolConfigs ?? [];
|
|
20475
|
+
if (toolConfigs.length === 0) {
|
|
20476
|
+
R2.info("No stored tool configurations for this profile; nothing to reapply.");
|
|
21159
20477
|
}
|
|
21160
20478
|
const fetched = await fetchReachableModels(active.gatewayUrl, active.apiKey);
|
|
21161
20479
|
if (!fetched.ok) {
|
|
@@ -21184,28 +20502,12 @@ Key: ${maskApiKey(active.apiKey)}`,
|
|
|
21184
20502
|
});
|
|
21185
20503
|
continue;
|
|
21186
20504
|
}
|
|
21187
|
-
const storedModelSlug =
|
|
20505
|
+
const storedModelSlug = tc.modelSlug;
|
|
21188
20506
|
const reachableModel = storedModelSlug ? reachable.find((m2) => m2.slug === storedModelSlug) : void 0;
|
|
21189
|
-
const
|
|
21190
|
-
let modelArg = storedModelSlug && pinAllowed ? { slug: reachableModel.slug, providerKind: reachableModel.providerKind } : void 0;
|
|
20507
|
+
const modelArg = reachableModel ? { slug: reachableModel.slug, providerKind: reachableModel.providerKind } : void 0;
|
|
21191
20508
|
let extraNote;
|
|
21192
|
-
if (
|
|
21193
|
-
extraNote = `Pinned model "codex" is an alias; selecting a concrete reachable model for this profile.`;
|
|
21194
|
-
} else if (storedModelSlug && !reachableModel) {
|
|
20509
|
+
if (storedModelSlug && !reachableModel) {
|
|
21195
20510
|
extraNote = `Pinned model "${tc.modelSlug}" is not reachable with this profile; model pin removed.`;
|
|
21196
|
-
} else if (storedModelSlug && reachableModel && !pinAllowed) {
|
|
21197
|
-
extraNote = `Pinned model "${tc.modelSlug}" is incompatible with Codex Responses; model pin removed.`;
|
|
21198
|
-
}
|
|
21199
|
-
if (tool === "codex" && !modelArg) {
|
|
21200
|
-
const fallback = pickCodexFallbackModel(reachable);
|
|
21201
|
-
if (fallback) {
|
|
21202
|
-
modelArg = { slug: fallback.slug, providerKind: fallback.providerKind };
|
|
21203
|
-
if (tc.modelSlug) {
|
|
21204
|
-
extraNote = `Pinned model "${tc.modelSlug}" unavailable for this profile; defaulting Codex to "${fallback.slug}".`;
|
|
21205
|
-
} else {
|
|
21206
|
-
extraNote = `No stored Codex model pin for this profile; defaulting to "${fallback.slug}".`;
|
|
21207
|
-
}
|
|
21208
|
-
}
|
|
21209
20511
|
}
|
|
21210
20512
|
try {
|
|
21211
20513
|
const result = writer({
|
|
@@ -21249,18 +20551,6 @@ Key: ${maskApiKey(active.apiKey)}`,
|
|
|
21249
20551
|
return ` ! ${r.tool}: skipped \u2014 ${r.notes ?? "unknown reason"}`;
|
|
21250
20552
|
});
|
|
21251
20553
|
Se(lines.join("\n"), "Tool configurations updated");
|
|
21252
|
-
const codexConfigured = results.some(
|
|
21253
|
-
(r) => r.tool === "codex" && r.status === "configured"
|
|
21254
|
-
);
|
|
21255
|
-
if (codexConfigured) {
|
|
21256
|
-
Se(
|
|
21257
|
-
`codex reads its API key from $CODEVECTOR_GATEWAY_KEY in your shell, not from codevector's credentials file.
|
|
21258
|
-
Update your shell to use this profile's key:
|
|
21259
|
-
export CODEVECTOR_GATEWAY_KEY=${active.apiKey}
|
|
21260
|
-
Or add it to your shell rc to persist across sessions.`,
|
|
21261
|
-
"codex requires env var update"
|
|
21262
|
-
);
|
|
21263
|
-
}
|
|
21264
20554
|
}
|
|
21265
20555
|
});
|
|
21266
20556
|
var profileCommand = defineCommand({
|
|
@@ -21303,42 +20593,6 @@ async function fetchReachableModels(gatewayUrl, apiKey) {
|
|
|
21303
20593
|
return { ok: false, reason: err instanceof ApiClientError ? err.message : String(err) };
|
|
21304
20594
|
}
|
|
21305
20595
|
}
|
|
21306
|
-
function isResponsesCompatibleProviderKind(providerKind) {
|
|
21307
|
-
return providerKind === "openai" || providerKind === "openai_compatible";
|
|
21308
|
-
}
|
|
21309
|
-
function pickCodexFallbackModel(reachable) {
|
|
21310
|
-
const candidates = reachable.filter((m2) => isResponsesCompatibleProviderKind(m2.providerKind));
|
|
21311
|
-
if (candidates.length === 0) {
|
|
21312
|
-
return void 0;
|
|
21313
|
-
}
|
|
21314
|
-
const ranked = readCodexNuxRankedModels();
|
|
21315
|
-
for (const slug of ranked) {
|
|
21316
|
-
const match = candidates.find((m2) => m2.slug === slug);
|
|
21317
|
-
if (match) return match;
|
|
21318
|
-
}
|
|
21319
|
-
return candidates[0];
|
|
21320
|
-
}
|
|
21321
|
-
function readCodexNuxRankedModels() {
|
|
21322
|
-
const path = codexConfigPath();
|
|
21323
|
-
if (!existsSync11(path)) return [];
|
|
21324
|
-
let parsed;
|
|
21325
|
-
try {
|
|
21326
|
-
parsed = parse3(readFileSync11(path, "utf8"));
|
|
21327
|
-
} catch {
|
|
21328
|
-
return [];
|
|
21329
|
-
}
|
|
21330
|
-
if (!isObject5(parsed)) return [];
|
|
21331
|
-
const tui = asObject(parsed.tui);
|
|
21332
|
-
const availability = asObject(tui?.model_availability_nux);
|
|
21333
|
-
if (!availability) return [];
|
|
21334
|
-
return Object.entries(availability).filter((entry) => typeof entry[1] === "number" && Number.isFinite(entry[1])).sort((a, b2) => b2[1] - a[1] || a[0].localeCompare(b2[0])).map(([slug]) => slug);
|
|
21335
|
-
}
|
|
21336
|
-
function isObject5(value) {
|
|
21337
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
21338
|
-
}
|
|
21339
|
-
function asObject(value) {
|
|
21340
|
-
return isObject5(value) ? value : void 0;
|
|
21341
|
-
}
|
|
21342
20596
|
|
|
21343
20597
|
// src/commands/skills.ts
|
|
21344
20598
|
init_dist();
|
|
@@ -21560,24 +20814,24 @@ Last saved: ${creds.savedAt}`,
|
|
|
21560
20814
|
init_dist();
|
|
21561
20815
|
init_dist5();
|
|
21562
20816
|
init_api_client();
|
|
21563
|
-
import { existsSync as
|
|
20817
|
+
import { existsSync as existsSync12 } from "fs";
|
|
21564
20818
|
|
|
21565
20819
|
// src/lib/backup.ts
|
|
21566
20820
|
import {
|
|
21567
20821
|
copyFileSync,
|
|
21568
|
-
existsSync as
|
|
20822
|
+
existsSync as existsSync11,
|
|
21569
20823
|
mkdirSync as mkdirSync6,
|
|
21570
20824
|
readdirSync,
|
|
21571
|
-
statSync as
|
|
20825
|
+
statSync as statSync4
|
|
21572
20826
|
} from "fs";
|
|
21573
|
-
import { basename, dirname as
|
|
21574
|
-
import { homedir as
|
|
21575
|
-
var BACKUP_ROOT = process.env.CODEVECTOR_BACKUP_ROOT ?? join13(
|
|
20827
|
+
import { basename, dirname as dirname5, join as join13 } from "path";
|
|
20828
|
+
import { homedir as homedir6 } from "os";
|
|
20829
|
+
var BACKUP_ROOT = process.env.CODEVECTOR_BACKUP_ROOT ?? join13(homedir6(), ".codevector", "backups");
|
|
21576
20830
|
function backupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
21577
20831
|
return d.toISOString().replace(/:/g, "-");
|
|
21578
20832
|
}
|
|
21579
20833
|
function backupFile(sourcePath, tool, timestamp) {
|
|
21580
|
-
if (!
|
|
20834
|
+
if (!existsSync11(sourcePath)) return void 0;
|
|
21581
20835
|
const destDir = join13(BACKUP_ROOT, timestamp, tool);
|
|
21582
20836
|
mkdirSync6(destDir, { recursive: true, mode: 448 });
|
|
21583
20837
|
const dest = join13(destDir, basename(sourcePath));
|
|
@@ -21585,7 +20839,7 @@ function backupFile(sourcePath, tool, timestamp) {
|
|
|
21585
20839
|
return dest;
|
|
21586
20840
|
}
|
|
21587
20841
|
function listBackupRuns() {
|
|
21588
|
-
if (!
|
|
20842
|
+
if (!existsSync11(BACKUP_ROOT)) return [];
|
|
21589
20843
|
const entries = readdirSync(BACKUP_ROOT, { withFileTypes: true }).filter((e2) => e2.isDirectory()).map((e2) => e2.name).sort().reverse();
|
|
21590
20844
|
const runs = [];
|
|
21591
20845
|
for (const ts of entries) {
|
|
@@ -21610,14 +20864,14 @@ function listBackupRuns() {
|
|
|
21610
20864
|
return runs;
|
|
21611
20865
|
}
|
|
21612
20866
|
function restoreBackup(backupPath, originalPath) {
|
|
21613
|
-
if (!
|
|
20867
|
+
if (!existsSync11(backupPath)) {
|
|
21614
20868
|
throw new Error(`Backup file missing: ${backupPath}`);
|
|
21615
20869
|
}
|
|
21616
|
-
mkdirSync6(
|
|
20870
|
+
mkdirSync6(dirname5(originalPath), { recursive: true });
|
|
21617
20871
|
copyFileSync(backupPath, originalPath);
|
|
21618
20872
|
}
|
|
21619
20873
|
function backupRunMtime(dir) {
|
|
21620
|
-
return
|
|
20874
|
+
return statSync4(dir).mtime;
|
|
21621
20875
|
}
|
|
21622
20876
|
|
|
21623
20877
|
// src/commands/system.ts
|
|
@@ -21625,13 +20879,11 @@ init_credentials();
|
|
|
21625
20879
|
init_prompt();
|
|
21626
20880
|
init_shell_hook();
|
|
21627
20881
|
init_claude_code();
|
|
21628
|
-
init_codex();
|
|
21629
20882
|
init_opencode();
|
|
21630
|
-
var TOOLS = ["claude-code", "opencode"
|
|
20883
|
+
var TOOLS = ["claude-code", "opencode"];
|
|
21631
20884
|
var WRITERS4 = {
|
|
21632
20885
|
"claude-code": writeClaudeCodeConfig,
|
|
21633
|
-
opencode: writeOpencodeConfig
|
|
21634
|
-
codex: writeCodexConfig
|
|
20886
|
+
opencode: writeOpencodeConfig
|
|
21635
20887
|
};
|
|
21636
20888
|
function userPathFor(tool) {
|
|
21637
20889
|
switch (tool) {
|
|
@@ -21639,8 +20891,6 @@ function userPathFor(tool) {
|
|
|
21639
20891
|
return claudeSettingsPath("user");
|
|
21640
20892
|
case "opencode":
|
|
21641
20893
|
return opencodeSettingsPath("user");
|
|
21642
|
-
case "codex":
|
|
21643
|
-
return codexConfigPath("user");
|
|
21644
20894
|
}
|
|
21645
20895
|
}
|
|
21646
20896
|
var systemConfigureCommand = defineCommand({
|
|
@@ -21675,7 +20925,7 @@ var systemConfigureCommand = defineCommand({
|
|
|
21675
20925
|
} else {
|
|
21676
20926
|
R2.info("No pre-existing user-scope config files to back up.");
|
|
21677
20927
|
}
|
|
21678
|
-
const reachable = await
|
|
20928
|
+
const reachable = await fetchReachableChatModels4(creds);
|
|
21679
20929
|
const results = [];
|
|
21680
20930
|
for (const tool of TOOLS) {
|
|
21681
20931
|
const writer = WRITERS4[tool];
|
|
@@ -21771,13 +21021,13 @@ var systemRestoreCommand = defineCommand({
|
|
|
21771
21021
|
R2.info(`Backup ${chosen.timestamp} \u2014 ${chosen.entries.length} file(s):`);
|
|
21772
21022
|
const plan = [];
|
|
21773
21023
|
for (const e2 of chosen.entries) {
|
|
21774
|
-
if (!
|
|
21024
|
+
if (!isTool3(e2.tool)) {
|
|
21775
21025
|
R2.warn(` skip ${e2.tool} (unknown tool in backup)`);
|
|
21776
21026
|
continue;
|
|
21777
21027
|
}
|
|
21778
21028
|
const target = userPathFor(e2.tool);
|
|
21779
21029
|
plan.push({ tool: e2.tool, backup: e2.backup, target });
|
|
21780
|
-
R2.info(` ${e2.tool} \u2192 ${target}${
|
|
21030
|
+
R2.info(` ${e2.tool} \u2192 ${target}${existsSync12(target) ? " (will overwrite)" : " (new)"}`);
|
|
21781
21031
|
}
|
|
21782
21032
|
if (plan.length === 0) {
|
|
21783
21033
|
ye("Nothing to restore.");
|
|
@@ -21810,10 +21060,10 @@ async function confirmRestore() {
|
|
|
21810
21060
|
if (q(v2)) return false;
|
|
21811
21061
|
return v2 === true;
|
|
21812
21062
|
}
|
|
21813
|
-
function
|
|
21063
|
+
function isTool3(value) {
|
|
21814
21064
|
return TOOLS.includes(value);
|
|
21815
21065
|
}
|
|
21816
|
-
async function
|
|
21066
|
+
async function fetchReachableChatModels4(creds) {
|
|
21817
21067
|
const client = gatewayClient(creds.gatewayUrl, creds.apiKey, 1e4);
|
|
21818
21068
|
const s = ft();
|
|
21819
21069
|
s.start("Loading reachable models\u2026");
|
|
@@ -21868,7 +21118,7 @@ import { spawnSync } from "child_process";
|
|
|
21868
21118
|
// package.json
|
|
21869
21119
|
var package_default = {
|
|
21870
21120
|
name: "@codevector/cli",
|
|
21871
|
-
version: "0.
|
|
21121
|
+
version: "0.7.0",
|
|
21872
21122
|
description: "CodeVector CLI \u2014 installs and configures first-party coding-tool integrations.",
|
|
21873
21123
|
license: "UNLICENSED",
|
|
21874
21124
|
bin: {
|
|
@@ -21918,7 +21168,7 @@ init_prompt();
|
|
|
21918
21168
|
|
|
21919
21169
|
// src/lib/update-notifier.ts
|
|
21920
21170
|
init_paths();
|
|
21921
|
-
import { existsSync as
|
|
21171
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync9 } from "fs";
|
|
21922
21172
|
import { join as join14 } from "path";
|
|
21923
21173
|
var PKG_NAME = "@codevector/cli";
|
|
21924
21174
|
var REGISTRY_URL = `https://registry.npmjs.org/${PKG_NAME}/latest`;
|
|
@@ -21926,9 +21176,9 @@ var CHECK_CACHE_FILE = join14(CODEVECTOR_CONFIG_DIR, "update-check.json");
|
|
|
21926
21176
|
var CHECK_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
21927
21177
|
var FETCH_TIMEOUT_MS = 2e3;
|
|
21928
21178
|
function readCache() {
|
|
21929
|
-
if (!
|
|
21179
|
+
if (!existsSync13(CHECK_CACHE_FILE)) return void 0;
|
|
21930
21180
|
try {
|
|
21931
|
-
const raw =
|
|
21181
|
+
const raw = readFileSync10(CHECK_CACHE_FILE, "utf8");
|
|
21932
21182
|
const parsed = JSON.parse(raw);
|
|
21933
21183
|
if (typeof parsed.checkedAt !== "number") return void 0;
|
|
21934
21184
|
return {
|
|
@@ -22232,6 +21482,7 @@ var main = defineCommand({
|
|
|
22232
21482
|
config: configCommand,
|
|
22233
21483
|
configure: configureCommand,
|
|
22234
21484
|
init: initCommand,
|
|
21485
|
+
github: githubCommand,
|
|
22235
21486
|
doctor: doctorCommand,
|
|
22236
21487
|
env: envCommand,
|
|
22237
21488
|
hook: hookCommand,
|
|
@@ -22248,43 +21499,4 @@ var main = defineCommand({
|
|
|
22248
21499
|
printUpdateNoticeIfCached(package_default.version);
|
|
22249
21500
|
scheduleUpdateCheck();
|
|
22250
21501
|
runMain(main);
|
|
22251
|
-
/*! Bundled license information:
|
|
22252
|
-
|
|
22253
|
-
smol-toml/dist/error.js:
|
|
22254
|
-
smol-toml/dist/util.js:
|
|
22255
|
-
smol-toml/dist/date.js:
|
|
22256
|
-
smol-toml/dist/primitive.js:
|
|
22257
|
-
smol-toml/dist/extract.js:
|
|
22258
|
-
smol-toml/dist/struct.js:
|
|
22259
|
-
smol-toml/dist/parse.js:
|
|
22260
|
-
smol-toml/dist/stringify.js:
|
|
22261
|
-
smol-toml/dist/index.js:
|
|
22262
|
-
(*!
|
|
22263
|
-
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
22264
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
22265
|
-
*
|
|
22266
|
-
* Redistribution and use in source and binary forms, with or without
|
|
22267
|
-
* modification, are permitted provided that the following conditions are met:
|
|
22268
|
-
*
|
|
22269
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
22270
|
-
* list of conditions and the following disclaimer.
|
|
22271
|
-
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
22272
|
-
* this list of conditions and the following disclaimer in the
|
|
22273
|
-
* documentation and/or other materials provided with the distribution.
|
|
22274
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
22275
|
-
* may be used to endorse or promote products derived from this software without
|
|
22276
|
-
* specific prior written permission.
|
|
22277
|
-
*
|
|
22278
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
22279
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
22280
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22281
|
-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22282
|
-
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
22283
|
-
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22284
|
-
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22285
|
-
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22286
|
-
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
22287
|
-
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
22288
|
-
*)
|
|
22289
|
-
*/
|
|
22290
21502
|
//# sourceMappingURL=index.js.map
|