@packmind/cli 0.30.1 → 0.31.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/main.cjs +1174 -1385
- package/package.json +1 -2
package/main.cjs
CHANGED
|
@@ -234,9 +234,9 @@ var init_ansi_styles = __esm({
|
|
|
234
234
|
});
|
|
235
235
|
|
|
236
236
|
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
237
|
-
function hasFlag(
|
|
238
|
-
const prefix =
|
|
239
|
-
const position = argv.indexOf(prefix +
|
|
237
|
+
function hasFlag(flag7, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
|
|
238
|
+
const prefix = flag7.startsWith("-") ? "" : flag7.length === 1 ? "-" : "--";
|
|
239
|
+
const position = argv.indexOf(prefix + flag7);
|
|
240
240
|
const terminatorPosition = argv.indexOf("--");
|
|
241
241
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
242
242
|
}
|
|
@@ -371,32 +371,32 @@ var init_supports_color = __esm({
|
|
|
371
371
|
});
|
|
372
372
|
|
|
373
373
|
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
374
|
-
function stringReplaceAll(
|
|
375
|
-
let index =
|
|
374
|
+
function stringReplaceAll(string16, substring, replacer) {
|
|
375
|
+
let index = string16.indexOf(substring);
|
|
376
376
|
if (index === -1) {
|
|
377
|
-
return
|
|
377
|
+
return string16;
|
|
378
378
|
}
|
|
379
379
|
const substringLength = substring.length;
|
|
380
380
|
let endIndex = 0;
|
|
381
381
|
let returnValue = "";
|
|
382
382
|
do {
|
|
383
|
-
returnValue +=
|
|
383
|
+
returnValue += string16.slice(endIndex, index) + substring + replacer;
|
|
384
384
|
endIndex = index + substringLength;
|
|
385
|
-
index =
|
|
385
|
+
index = string16.indexOf(substring, endIndex);
|
|
386
386
|
} while (index !== -1);
|
|
387
|
-
returnValue +=
|
|
387
|
+
returnValue += string16.slice(endIndex);
|
|
388
388
|
return returnValue;
|
|
389
389
|
}
|
|
390
|
-
function stringEncaseCRLFWithFirstIndex(
|
|
390
|
+
function stringEncaseCRLFWithFirstIndex(string16, prefix, postfix, index) {
|
|
391
391
|
let endIndex = 0;
|
|
392
392
|
let returnValue = "";
|
|
393
393
|
do {
|
|
394
|
-
const gotCR =
|
|
395
|
-
returnValue +=
|
|
394
|
+
const gotCR = string16[index - 1] === "\r";
|
|
395
|
+
returnValue += string16.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
396
396
|
endIndex = index + 1;
|
|
397
|
-
index =
|
|
397
|
+
index = string16.indexOf("\n", endIndex);
|
|
398
398
|
} while (index !== -1);
|
|
399
|
-
returnValue +=
|
|
399
|
+
returnValue += string16.slice(endIndex);
|
|
400
400
|
return returnValue;
|
|
401
401
|
}
|
|
402
402
|
var init_utilities = __esm({
|
|
@@ -555,26 +555,26 @@ var init_source = __esm({
|
|
|
555
555
|
builder[IS_EMPTY] = _isEmpty;
|
|
556
556
|
return builder;
|
|
557
557
|
};
|
|
558
|
-
applyStyle = (self,
|
|
559
|
-
if (self.level <= 0 || !
|
|
560
|
-
return self[IS_EMPTY] ? "" :
|
|
558
|
+
applyStyle = (self, string16) => {
|
|
559
|
+
if (self.level <= 0 || !string16) {
|
|
560
|
+
return self[IS_EMPTY] ? "" : string16;
|
|
561
561
|
}
|
|
562
562
|
let styler = self[STYLER];
|
|
563
563
|
if (styler === void 0) {
|
|
564
|
-
return
|
|
564
|
+
return string16;
|
|
565
565
|
}
|
|
566
566
|
const { openAll, closeAll } = styler;
|
|
567
|
-
if (
|
|
567
|
+
if (string16.includes("\x1B")) {
|
|
568
568
|
while (styler !== void 0) {
|
|
569
|
-
|
|
569
|
+
string16 = stringReplaceAll(string16, styler.close, styler.open);
|
|
570
570
|
styler = styler.parent;
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
|
-
const lfIndex =
|
|
573
|
+
const lfIndex = string16.indexOf("\n");
|
|
574
574
|
if (lfIndex !== -1) {
|
|
575
|
-
|
|
575
|
+
string16 = stringEncaseCRLFWithFirstIndex(string16, closeAll, openAll, lfIndex);
|
|
576
576
|
}
|
|
577
|
-
return openAll +
|
|
577
|
+
return openAll + string16 + closeAll;
|
|
578
578
|
};
|
|
579
579
|
Object.defineProperties(createChalk.prototype, styles2);
|
|
580
580
|
chalk = createChalk();
|
|
@@ -767,9 +767,9 @@ var require_findOption = __commonJS({
|
|
|
767
767
|
continue;
|
|
768
768
|
}
|
|
769
769
|
if (node.type === "shortOptions" && opts.shortNames.length) {
|
|
770
|
-
for (const
|
|
771
|
-
if (opts.shortNames.includes(
|
|
772
|
-
result.push(
|
|
770
|
+
for (const option18 of node.options) {
|
|
771
|
+
if (opts.shortNames.includes(option18.key)) {
|
|
772
|
+
result.push(option18);
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
}
|
|
@@ -842,7 +842,7 @@ var require_types = __commonJS({
|
|
|
842
842
|
"use strict";
|
|
843
843
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
844
844
|
exports2.boolean = exports2.string = exports2.number = void 0;
|
|
845
|
-
exports2.optional =
|
|
845
|
+
exports2.optional = optional13;
|
|
846
846
|
exports2.array = array2;
|
|
847
847
|
var type_1 = require_type();
|
|
848
848
|
exports2.number = {
|
|
@@ -869,7 +869,7 @@ var require_types = __commonJS({
|
|
|
869
869
|
return false;
|
|
870
870
|
}
|
|
871
871
|
};
|
|
872
|
-
function
|
|
872
|
+
function optional13(t) {
|
|
873
873
|
return {
|
|
874
874
|
...t,
|
|
875
875
|
defaultValue() {
|
|
@@ -935,7 +935,7 @@ var require_flag = __commonJS({
|
|
|
935
935
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
936
936
|
exports2.boolean = void 0;
|
|
937
937
|
exports2.fullFlag = fullFlag;
|
|
938
|
-
exports2.flag =
|
|
938
|
+
exports2.flag = flag7;
|
|
939
939
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
940
940
|
var Result = __importStar(require_Result());
|
|
941
941
|
var findOption_1 = require_findOption();
|
|
@@ -1084,7 +1084,7 @@ var require_flag = __commonJS({
|
|
|
1084
1084
|
}
|
|
1085
1085
|
};
|
|
1086
1086
|
}
|
|
1087
|
-
function
|
|
1087
|
+
function flag7(config) {
|
|
1088
1088
|
return fullFlag({
|
|
1089
1089
|
type: types_1.boolean,
|
|
1090
1090
|
...config
|
|
@@ -1255,7 +1255,7 @@ var require_positional = __commonJS({
|
|
|
1255
1255
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1256
1256
|
};
|
|
1257
1257
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1258
|
-
exports2.positional =
|
|
1258
|
+
exports2.positional = positional9;
|
|
1259
1259
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
1260
1260
|
var Result = __importStar(require_Result());
|
|
1261
1261
|
var types_1 = require_types();
|
|
@@ -1295,8 +1295,8 @@ var require_positional = __commonJS({
|
|
|
1295
1295
|
var _a2;
|
|
1296
1296
|
const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
|
|
1297
1297
|
const defaultValueFn = (_a2 = config.defaultValue) !== null && _a2 !== void 0 ? _a2 : config.type.defaultValue;
|
|
1298
|
-
const
|
|
1299
|
-
if (!
|
|
1298
|
+
const positional10 = positionals[0];
|
|
1299
|
+
if (!positional10) {
|
|
1300
1300
|
if (defaultValueFn) {
|
|
1301
1301
|
return Result.ok(defaultValueFn());
|
|
1302
1302
|
}
|
|
@@ -1309,13 +1309,13 @@ var require_positional = __commonJS({
|
|
|
1309
1309
|
]
|
|
1310
1310
|
});
|
|
1311
1311
|
}
|
|
1312
|
-
visitedNodes.add(
|
|
1313
|
-
const decoded = await Result.safeAsync(config.type.from(
|
|
1312
|
+
visitedNodes.add(positional10);
|
|
1313
|
+
const decoded = await Result.safeAsync(config.type.from(positional10.raw));
|
|
1314
1314
|
if (Result.isErr(decoded)) {
|
|
1315
1315
|
return Result.err({
|
|
1316
1316
|
errors: [
|
|
1317
1317
|
{
|
|
1318
|
-
nodes: [
|
|
1318
|
+
nodes: [positional10],
|
|
1319
1319
|
message: decoded.error.message
|
|
1320
1320
|
}
|
|
1321
1321
|
]
|
|
@@ -1325,7 +1325,7 @@ var require_positional = __commonJS({
|
|
|
1325
1325
|
}
|
|
1326
1326
|
};
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function positional9(config) {
|
|
1329
1329
|
return fullPositional({
|
|
1330
1330
|
type: types_1.string,
|
|
1331
1331
|
...config
|
|
@@ -1403,9 +1403,9 @@ var require_subcommands = __commonJS({
|
|
|
1403
1403
|
let errorMessage = "Not a valid subcommand name";
|
|
1404
1404
|
const closeOptions = (0, didyoumean_1.default)(str, flatMap(commands, (x) => x.names));
|
|
1405
1405
|
if (closeOptions) {
|
|
1406
|
-
const
|
|
1406
|
+
const option18 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
|
|
1407
1407
|
errorMessage += `
|
|
1408
|
-
Did you mean ${chalk_1.default.italic(
|
|
1408
|
+
Did you mean ${chalk_1.default.italic(option18)}?`;
|
|
1409
1409
|
}
|
|
1410
1410
|
throw new Error(errorMessage);
|
|
1411
1411
|
}
|
|
@@ -1578,14 +1578,14 @@ var strip_ansi_exports = {};
|
|
|
1578
1578
|
__export(strip_ansi_exports, {
|
|
1579
1579
|
default: () => stripAnsi
|
|
1580
1580
|
});
|
|
1581
|
-
function stripAnsi(
|
|
1582
|
-
if (typeof
|
|
1583
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof
|
|
1581
|
+
function stripAnsi(string16) {
|
|
1582
|
+
if (typeof string16 !== "string") {
|
|
1583
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string16}\``);
|
|
1584
1584
|
}
|
|
1585
|
-
if (!
|
|
1586
|
-
return
|
|
1585
|
+
if (!string16.includes("\x1B") && !string16.includes("\x9B")) {
|
|
1586
|
+
return string16;
|
|
1587
1587
|
}
|
|
1588
|
-
return
|
|
1588
|
+
return string16.replace(regex, "");
|
|
1589
1589
|
}
|
|
1590
1590
|
var regex;
|
|
1591
1591
|
var init_strip_ansi = __esm({
|
|
@@ -1701,12 +1701,12 @@ var require_command = __commonJS({
|
|
|
1701
1701
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1702
1702
|
};
|
|
1703
1703
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1704
|
-
exports2.command =
|
|
1704
|
+
exports2.command = command30;
|
|
1705
1705
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
1706
1706
|
var Result = __importStar(require_Result());
|
|
1707
1707
|
var circuitbreaker_1 = require_circuitbreaker();
|
|
1708
1708
|
var utils_1 = require_utils();
|
|
1709
|
-
function
|
|
1709
|
+
function command30(config) {
|
|
1710
1710
|
const argEntries = (0, utils_1.entries)(config.args);
|
|
1711
1711
|
const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
|
|
1712
1712
|
return {
|
|
@@ -1784,11 +1784,11 @@ var require_command = __commonJS({
|
|
|
1784
1784
|
}
|
|
1785
1785
|
if (node.type === "forcePositional") {
|
|
1786
1786
|
} else if (node.type === "shortOptions") {
|
|
1787
|
-
for (const
|
|
1788
|
-
if (context.visitedNodes.has(
|
|
1787
|
+
for (const option18 of node.options) {
|
|
1788
|
+
if (context.visitedNodes.has(option18)) {
|
|
1789
1789
|
continue;
|
|
1790
1790
|
}
|
|
1791
|
-
unknownArguments.push(
|
|
1791
|
+
unknownArguments.push(option18);
|
|
1792
1792
|
}
|
|
1793
1793
|
} else {
|
|
1794
1794
|
unknownArguments.push(node);
|
|
@@ -1867,7 +1867,7 @@ var require_option = __commonJS({
|
|
|
1867
1867
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
1868
1868
|
};
|
|
1869
1869
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1870
|
-
exports2.option =
|
|
1870
|
+
exports2.option = option18;
|
|
1871
1871
|
var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
|
|
1872
1872
|
var Result = __importStar(require_Result());
|
|
1873
1873
|
var findOption_1 = require_findOption();
|
|
@@ -1943,11 +1943,11 @@ var require_option = __commonJS({
|
|
|
1943
1943
|
const valueFromEnv = config.env ? process.env[config.env] : void 0;
|
|
1944
1944
|
const defaultValueFn = config.defaultValue || config.type.defaultValue;
|
|
1945
1945
|
const onMissingFn = config.onMissing || config.type.onMissing;
|
|
1946
|
-
const
|
|
1946
|
+
const option19 = options[0];
|
|
1947
1947
|
let rawValue;
|
|
1948
1948
|
let envPrefix = "";
|
|
1949
|
-
if (
|
|
1950
|
-
rawValue =
|
|
1949
|
+
if (option19 === null || option19 === void 0 ? void 0 : option19.value) {
|
|
1950
|
+
rawValue = option19.value.node.raw;
|
|
1951
1951
|
} else if (valueFromEnv !== void 0) {
|
|
1952
1952
|
rawValue = valueFromEnv;
|
|
1953
1953
|
envPrefix = `env[${chalk_1.default.italic(config.env)}]: `;
|
|
@@ -1982,7 +1982,7 @@ var require_option = __commonJS({
|
|
|
1982
1982
|
});
|
|
1983
1983
|
}
|
|
1984
1984
|
} else {
|
|
1985
|
-
const raw = (
|
|
1985
|
+
const raw = (option19 === null || option19 === void 0 ? void 0 : option19.type) === "shortOption" ? `-${option19 === null || option19 === void 0 ? void 0 : option19.key}` : `--${config.long}`;
|
|
1986
1986
|
return Result.err({
|
|
1987
1987
|
errors: [
|
|
1988
1988
|
{
|
|
@@ -2004,7 +2004,7 @@ var require_option = __commonJS({
|
|
|
2004
2004
|
}
|
|
2005
2005
|
};
|
|
2006
2006
|
}
|
|
2007
|
-
function
|
|
2007
|
+
function option18(config) {
|
|
2008
2008
|
return fullOption({
|
|
2009
2009
|
type: types_1.string,
|
|
2010
2010
|
...config
|
|
@@ -2043,12 +2043,12 @@ var require_errorBox = __commonJS({
|
|
|
2043
2043
|
if (node.type === "shortOptions") {
|
|
2044
2044
|
let failed = false;
|
|
2045
2045
|
let s = "";
|
|
2046
|
-
for (const
|
|
2047
|
-
if (error.nodes.includes(
|
|
2048
|
-
s += chalk_1.default.red(
|
|
2046
|
+
for (const option18 of node.options) {
|
|
2047
|
+
if (error.nodes.includes(option18)) {
|
|
2048
|
+
s += chalk_1.default.red(option18.raw);
|
|
2049
2049
|
failed = true;
|
|
2050
2050
|
} else {
|
|
2051
|
-
s += chalk_1.default.dim(
|
|
2051
|
+
s += chalk_1.default.dim(option18.raw);
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
2054
2054
|
const prefix = failed ? chalk_1.default.red("-") : chalk_1.default.dim("-");
|
|
@@ -2577,10 +2577,10 @@ var require_browser = __commonJS({
|
|
|
2577
2577
|
var require_has_flag = __commonJS({
|
|
2578
2578
|
"node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports2, module2) {
|
|
2579
2579
|
"use strict";
|
|
2580
|
-
module2.exports = (
|
|
2580
|
+
module2.exports = (flag7, argv) => {
|
|
2581
2581
|
argv = argv || process.argv;
|
|
2582
|
-
const prefix =
|
|
2583
|
-
const pos = argv.indexOf(prefix +
|
|
2582
|
+
const prefix = flag7.startsWith("-") ? "" : flag7.length === 1 ? "-" : "--";
|
|
2583
|
+
const pos = argv.indexOf(prefix + flag7);
|
|
2584
2584
|
const terminatorPos = argv.indexOf("--");
|
|
2585
2585
|
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
2586
2586
|
};
|
|
@@ -3081,8 +3081,8 @@ var require_tokenizer = __commonJS({
|
|
|
3081
3081
|
tokens.push(token);
|
|
3082
3082
|
overallIndex += token.raw.length;
|
|
3083
3083
|
};
|
|
3084
|
-
for (const [stringIndex,
|
|
3085
|
-
const chars = [...
|
|
3084
|
+
for (const [stringIndex, string16] of (0, utils_1.enumerate)(strings)) {
|
|
3085
|
+
const chars = [...string16];
|
|
3086
3086
|
for (let i = 0; i < chars.length; i++) {
|
|
3087
3087
|
if (chars[i] === "-" && chars[i + 1] === "-") {
|
|
3088
3088
|
push({ type: "longPrefix", raw: "--", index: overallIndex });
|
|
@@ -3215,7 +3215,7 @@ var require_restPositionals = __commonJS({
|
|
|
3215
3215
|
};
|
|
3216
3216
|
})();
|
|
3217
3217
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3218
|
-
exports2.restPositionals =
|
|
3218
|
+
exports2.restPositionals = restPositionals4;
|
|
3219
3219
|
var Result = __importStar(require_Result());
|
|
3220
3220
|
var types_1 = require_types();
|
|
3221
3221
|
function fullRestPositionals(config) {
|
|
@@ -3238,14 +3238,14 @@ var require_restPositionals = __commonJS({
|
|
|
3238
3238
|
const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
|
|
3239
3239
|
const results = [];
|
|
3240
3240
|
const errors = [];
|
|
3241
|
-
for (const
|
|
3242
|
-
visitedNodes.add(
|
|
3243
|
-
const decoded = await Result.safeAsync(config.type.from(
|
|
3241
|
+
for (const positional9 of positionals) {
|
|
3242
|
+
visitedNodes.add(positional9);
|
|
3243
|
+
const decoded = await Result.safeAsync(config.type.from(positional9.raw));
|
|
3244
3244
|
if (Result.isOk(decoded)) {
|
|
3245
3245
|
results.push(decoded.value);
|
|
3246
3246
|
} else {
|
|
3247
3247
|
errors.push({
|
|
3248
|
-
nodes: [
|
|
3248
|
+
nodes: [positional9],
|
|
3249
3249
|
message: decoded.error.message
|
|
3250
3250
|
});
|
|
3251
3251
|
}
|
|
@@ -3259,7 +3259,7 @@ var require_restPositionals = __commonJS({
|
|
|
3259
3259
|
}
|
|
3260
3260
|
};
|
|
3261
3261
|
}
|
|
3262
|
-
function
|
|
3262
|
+
function restPositionals4(config) {
|
|
3263
3263
|
return fullRestPositionals({
|
|
3264
3264
|
type: types_1.string,
|
|
3265
3265
|
...config
|
|
@@ -3343,15 +3343,15 @@ var require_multiflag = __commonJS({
|
|
|
3343
3343
|
longNames: [config.long],
|
|
3344
3344
|
shortNames: config.short ? [config.short] : []
|
|
3345
3345
|
}).filter((x) => !visitedNodes.has(x));
|
|
3346
|
-
for (const
|
|
3347
|
-
visitedNodes.add(
|
|
3346
|
+
for (const option18 of options) {
|
|
3347
|
+
visitedNodes.add(option18);
|
|
3348
3348
|
}
|
|
3349
3349
|
const optionValues = [];
|
|
3350
3350
|
const errors = [];
|
|
3351
|
-
for (const
|
|
3352
|
-
const decoded = await Result.safeAsync(flag_1.boolean.from((_b = (_a =
|
|
3351
|
+
for (const option18 of options) {
|
|
3352
|
+
const decoded = await Result.safeAsync(flag_1.boolean.from((_b = (_a = option18.value) === null || _a === void 0 ? void 0 : _a.node.raw) !== null && _b !== void 0 ? _b : "true"));
|
|
3353
3353
|
if (Result.isErr(decoded)) {
|
|
3354
|
-
errors.push({ nodes: [
|
|
3354
|
+
errors.push({ nodes: [option18], message: decoded.error.message });
|
|
3355
3355
|
} else {
|
|
3356
3356
|
optionValues.push(decoded.value);
|
|
3357
3357
|
}
|
|
@@ -3515,16 +3515,16 @@ var require_multioption = __commonJS({
|
|
|
3515
3515
|
});
|
|
3516
3516
|
}
|
|
3517
3517
|
}
|
|
3518
|
-
for (const
|
|
3519
|
-
visitedNodes.add(
|
|
3518
|
+
for (const option18 of options) {
|
|
3519
|
+
visitedNodes.add(option18);
|
|
3520
3520
|
}
|
|
3521
3521
|
const optionValues = [];
|
|
3522
3522
|
const errors = [];
|
|
3523
3523
|
const flagNodes = [];
|
|
3524
|
-
for (const
|
|
3525
|
-
const providedValue = (_a =
|
|
3524
|
+
for (const option18 of options) {
|
|
3525
|
+
const providedValue = (_a = option18.value) === null || _a === void 0 ? void 0 : _a.node.raw;
|
|
3526
3526
|
if (providedValue === void 0) {
|
|
3527
|
-
flagNodes.push(
|
|
3527
|
+
flagNodes.push(option18);
|
|
3528
3528
|
continue;
|
|
3529
3529
|
}
|
|
3530
3530
|
optionValues.push(providedValue);
|
|
@@ -3849,7 +3849,7 @@ var require_package = __commonJS({
|
|
|
3849
3849
|
"apps/cli/package.json"(exports2, module2) {
|
|
3850
3850
|
module2.exports = {
|
|
3851
3851
|
name: "@packmind/cli",
|
|
3852
|
-
version: "0.
|
|
3852
|
+
version: "0.31.0",
|
|
3853
3853
|
description: "A command-line interface for Packmind linting and code quality checks",
|
|
3854
3854
|
private: false,
|
|
3855
3855
|
bin: {
|
|
@@ -3901,7 +3901,7 @@ var require_package = __commonJS({
|
|
|
3901
3901
|
});
|
|
3902
3902
|
|
|
3903
3903
|
// apps/cli/src/main.ts
|
|
3904
|
-
var
|
|
3904
|
+
var import_cmd_ts40 = __toESM(require_cjs());
|
|
3905
3905
|
|
|
3906
3906
|
// apps/cli/src/infra/commands/LinterCommand.ts
|
|
3907
3907
|
var import_cmd_ts = __toESM(require_cjs());
|
|
@@ -4044,20 +4044,6 @@ var UserJoinedOrganizationEvent = class extends UserEvent {
|
|
|
4044
4044
|
}
|
|
4045
4045
|
};
|
|
4046
4046
|
|
|
4047
|
-
// packages/types/src/accounts/events/AnonymousTrialStartedEvent.ts
|
|
4048
|
-
var AnonymousTrialStartedEvent = class extends UserEvent {
|
|
4049
|
-
static {
|
|
4050
|
-
this.eventName = "accounts.anonymous-trial.started";
|
|
4051
|
-
}
|
|
4052
|
-
};
|
|
4053
|
-
|
|
4054
|
-
// packages/types/src/accounts/events/AnonymousTrialAccountActivatedEvent.ts
|
|
4055
|
-
var AnonymousTrialAccountActivatedEvent = class extends UserEvent {
|
|
4056
|
-
static {
|
|
4057
|
-
this.eventName = "accounts.anonymous-trial.activated";
|
|
4058
|
-
}
|
|
4059
|
-
};
|
|
4060
|
-
|
|
4061
4047
|
// packages/types/src/accounts/events/OrganizationCreatedEvent.ts
|
|
4062
4048
|
var OrganizationCreatedEvent = class extends UserEvent {
|
|
4063
4049
|
static {
|
|
@@ -4072,10 +4058,6 @@ var UserSignedInEvent = class extends UserEvent {
|
|
|
4072
4058
|
}
|
|
4073
4059
|
};
|
|
4074
4060
|
|
|
4075
|
-
// packages/types/src/accounts/TrialActivationToken.ts
|
|
4076
|
-
var createTrialActivationTokenId = brandedIdFactory();
|
|
4077
|
-
var createTrialActivationToken = brandedIdFactory();
|
|
4078
|
-
|
|
4079
4061
|
// packages/types/src/coding-agent/validation.ts
|
|
4080
4062
|
var VALID_CODING_AGENTS = [
|
|
4081
4063
|
"packmind",
|
|
@@ -4366,7 +4348,8 @@ var CLAUDE_CODE_ADDITIONAL_FIELDS = {
|
|
|
4366
4348
|
effort: "effort",
|
|
4367
4349
|
hooks: "hooks",
|
|
4368
4350
|
paths: "paths",
|
|
4369
|
-
shell: "shell"
|
|
4351
|
+
shell: "shell",
|
|
4352
|
+
"disallowed-tools": "disallowedTools"
|
|
4370
4353
|
};
|
|
4371
4354
|
var CAMEL_TO_YAML_KEY = Object.fromEntries(
|
|
4372
4355
|
Object.entries(CLAUDE_CODE_ADDITIONAL_FIELDS).map(([yaml4, camel]) => [
|
|
@@ -4547,6 +4530,20 @@ var SpaceVisibilityUpdatedEvent = class extends UserEvent {
|
|
|
4547
4530
|
}
|
|
4548
4531
|
};
|
|
4549
4532
|
|
|
4533
|
+
// packages/types/src/spaces/events/SpaceDeletedEvent.ts
|
|
4534
|
+
var SpaceDeletedEvent = class extends UserEvent {
|
|
4535
|
+
static {
|
|
4536
|
+
this.eventName = "spaces.space.deleted";
|
|
4537
|
+
}
|
|
4538
|
+
};
|
|
4539
|
+
|
|
4540
|
+
// packages/types/src/spaces/events/SpaceRenamedEvent.ts
|
|
4541
|
+
var SpaceRenamedEvent = class extends UserEvent {
|
|
4542
|
+
static {
|
|
4543
|
+
this.eventName = "spaces.space.renamed";
|
|
4544
|
+
}
|
|
4545
|
+
};
|
|
4546
|
+
|
|
4550
4547
|
// packages/types/src/spaces-management/events/PlaybookArtefactMovedEvent.ts
|
|
4551
4548
|
var PlaybookArtefactMovedEvent = class extends UserEvent {
|
|
4552
4549
|
static {
|
|
@@ -5395,8 +5392,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
|
|
|
5395
5392
|
static {
|
|
5396
5393
|
this.fallbackRuleContent = "adhoc-rule";
|
|
5397
5394
|
}
|
|
5398
|
-
async execute(
|
|
5399
|
-
const { program, fileContent, language } =
|
|
5395
|
+
async execute(command30) {
|
|
5396
|
+
const { program, fileContent, language } = command30;
|
|
5400
5397
|
const result = await this.linterExecutionUseCase.execute({
|
|
5401
5398
|
filePath: "cli-single-file",
|
|
5402
5399
|
fileContent,
|
|
@@ -5780,8 +5777,8 @@ var GetGitRemoteUrlUseCase = class {
|
|
|
5780
5777
|
constructor(gitRemoteUrlService = new GitService()) {
|
|
5781
5778
|
this.gitRemoteUrlService = gitRemoteUrlService;
|
|
5782
5779
|
}
|
|
5783
|
-
async execute(
|
|
5784
|
-
const { path: repoPath, origin: origin9 } =
|
|
5780
|
+
async execute(command30) {
|
|
5781
|
+
const { path: repoPath, origin: origin9 } = command30;
|
|
5785
5782
|
return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
|
|
5786
5783
|
}
|
|
5787
5784
|
};
|
|
@@ -5933,8 +5930,8 @@ var ListFilesInDirectoryUseCase = class {
|
|
|
5933
5930
|
constructor(listFiles = new ListFiles()) {
|
|
5934
5931
|
this.listFiles = listFiles;
|
|
5935
5932
|
}
|
|
5936
|
-
async execute(
|
|
5937
|
-
const { path: directoryPath, extensions, excludes = [] } =
|
|
5933
|
+
async execute(command30) {
|
|
5934
|
+
const { path: directoryPath, extensions, excludes = [] } = command30;
|
|
5938
5935
|
const files = await this.listFiles.listFilesInDirectory(
|
|
5939
5936
|
directoryPath,
|
|
5940
5937
|
extensions,
|
|
@@ -6049,7 +6046,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
6049
6046
|
};
|
|
6050
6047
|
};
|
|
6051
6048
|
}
|
|
6052
|
-
async execute(
|
|
6049
|
+
async execute(command30) {
|
|
6053
6050
|
const {
|
|
6054
6051
|
path: userPath,
|
|
6055
6052
|
draftMode,
|
|
@@ -6058,7 +6055,7 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
6058
6055
|
language,
|
|
6059
6056
|
diffMode,
|
|
6060
6057
|
ignorePatterns
|
|
6061
|
-
} =
|
|
6058
|
+
} = command30;
|
|
6062
6059
|
this.logger.debug(
|
|
6063
6060
|
`Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
|
|
6064
6061
|
);
|
|
@@ -6374,8 +6371,8 @@ var LintFilesAgainstRuleUseCase = class {
|
|
|
6374
6371
|
return null;
|
|
6375
6372
|
}
|
|
6376
6373
|
}
|
|
6377
|
-
async executeProgramsForFile(
|
|
6378
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6374
|
+
async executeProgramsForFile(command30) {
|
|
6375
|
+
const result = await this.services.linterExecutionUseCase.execute(command30);
|
|
6379
6376
|
return result.violations;
|
|
6380
6377
|
}
|
|
6381
6378
|
extractExtensionFromFile(filePath) {
|
|
@@ -6398,8 +6395,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6398
6395
|
this.logger = logger2;
|
|
6399
6396
|
this.detectionProgramsCache = /* @__PURE__ */ new Map();
|
|
6400
6397
|
}
|
|
6401
|
-
async execute(
|
|
6402
|
-
const { path: userPath, diffMode, ignorePatterns } =
|
|
6398
|
+
async execute(command30) {
|
|
6399
|
+
const { path: userPath, diffMode, ignorePatterns } = command30;
|
|
6403
6400
|
this.logger.debug(
|
|
6404
6401
|
`Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
|
|
6405
6402
|
);
|
|
@@ -6659,8 +6656,8 @@ var LintFilesFromConfigUseCase = class {
|
|
|
6659
6656
|
return null;
|
|
6660
6657
|
}
|
|
6661
6658
|
}
|
|
6662
|
-
async executeProgramsForFile(
|
|
6663
|
-
const result = await this.services.linterExecutionUseCase.execute(
|
|
6659
|
+
async executeProgramsForFile(command30) {
|
|
6660
|
+
const result = await this.services.linterExecutionUseCase.execute(command30);
|
|
6664
6661
|
return result.violations;
|
|
6665
6662
|
}
|
|
6666
6663
|
extractExtensionFromFile(filePath) {
|
|
@@ -6836,13 +6833,13 @@ var PackmindHttpClient = class {
|
|
|
6836
6833
|
var ChangeProposalGateway = class {
|
|
6837
6834
|
constructor(httpClient) {
|
|
6838
6835
|
this.httpClient = httpClient;
|
|
6839
|
-
this.batchCreate = async (
|
|
6836
|
+
this.batchCreate = async (command30) => {
|
|
6840
6837
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6841
6838
|
return this.httpClient.request(
|
|
6842
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6839
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/change-proposals/batch`,
|
|
6843
6840
|
{
|
|
6844
6841
|
method: "POST",
|
|
6845
|
-
body: { proposals:
|
|
6842
|
+
body: { proposals: command30.proposals },
|
|
6846
6843
|
onError: (response) => {
|
|
6847
6844
|
if (response.status === 404) {
|
|
6848
6845
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6851,29 +6848,29 @@ var ChangeProposalGateway = class {
|
|
|
6851
6848
|
}
|
|
6852
6849
|
);
|
|
6853
6850
|
};
|
|
6854
|
-
this.batchApply = async (
|
|
6851
|
+
this.batchApply = async (command30) => {
|
|
6855
6852
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6856
6853
|
return this.httpClient.request(
|
|
6857
6854
|
`/api/v0/organizations/${organizationId}/playbook/apply`,
|
|
6858
6855
|
{
|
|
6859
6856
|
method: "POST",
|
|
6860
6857
|
body: {
|
|
6861
|
-
proposals:
|
|
6862
|
-
message:
|
|
6863
|
-
...
|
|
6864
|
-
directUpdate:
|
|
6858
|
+
proposals: command30.proposals,
|
|
6859
|
+
message: command30.message,
|
|
6860
|
+
...command30.directUpdate !== void 0 && {
|
|
6861
|
+
directUpdate: command30.directUpdate
|
|
6865
6862
|
}
|
|
6866
6863
|
}
|
|
6867
6864
|
}
|
|
6868
6865
|
);
|
|
6869
6866
|
};
|
|
6870
|
-
this.check = async (
|
|
6867
|
+
this.check = async (command30) => {
|
|
6871
6868
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
6872
6869
|
return this.httpClient.request(
|
|
6873
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
6870
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/change-proposals/check`,
|
|
6874
6871
|
{
|
|
6875
6872
|
method: "POST",
|
|
6876
|
-
body: { proposals:
|
|
6873
|
+
body: { proposals: command30.proposals },
|
|
6877
6874
|
onError: (response) => {
|
|
6878
6875
|
if (response.status === 404) {
|
|
6879
6876
|
throw new CommunityEditionError("change proposals");
|
|
@@ -6889,13 +6886,13 @@ var ChangeProposalGateway = class {
|
|
|
6889
6886
|
var LinterGateway = class {
|
|
6890
6887
|
constructor(httpClient) {
|
|
6891
6888
|
this.httpClient = httpClient;
|
|
6892
|
-
this.getDraftDetectionProgramsForRule = async (
|
|
6889
|
+
this.getDraftDetectionProgramsForRule = async (command30) => {
|
|
6893
6890
|
const payload = {
|
|
6894
|
-
standardSlug:
|
|
6895
|
-
ruleId:
|
|
6891
|
+
standardSlug: command30.standardSlug,
|
|
6892
|
+
ruleId: command30.ruleId
|
|
6896
6893
|
};
|
|
6897
|
-
if (
|
|
6898
|
-
payload.language =
|
|
6894
|
+
if (command30.language) {
|
|
6895
|
+
payload.language = command30.language;
|
|
6899
6896
|
}
|
|
6900
6897
|
return this.httpClient.request("/api/v0/list-draft-detection-program", {
|
|
6901
6898
|
method: "POST",
|
|
@@ -6907,13 +6904,13 @@ var LinterGateway = class {
|
|
|
6907
6904
|
}
|
|
6908
6905
|
});
|
|
6909
6906
|
};
|
|
6910
|
-
this.getActiveDetectionProgramsForRule = async (
|
|
6907
|
+
this.getActiveDetectionProgramsForRule = async (command30) => {
|
|
6911
6908
|
const payload = {
|
|
6912
|
-
standardSlug:
|
|
6913
|
-
ruleId:
|
|
6909
|
+
standardSlug: command30.standardSlug,
|
|
6910
|
+
ruleId: command30.ruleId
|
|
6914
6911
|
};
|
|
6915
|
-
if (
|
|
6916
|
-
payload.language =
|
|
6912
|
+
if (command30.language) {
|
|
6913
|
+
payload.language = command30.language;
|
|
6917
6914
|
}
|
|
6918
6915
|
return this.httpClient.request("/api/v0/list-active-detection-program", {
|
|
6919
6916
|
method: "POST",
|
|
@@ -6925,13 +6922,13 @@ var LinterGateway = class {
|
|
|
6925
6922
|
}
|
|
6926
6923
|
});
|
|
6927
6924
|
};
|
|
6928
|
-
this.getDetectionProgramsForPackages = async (
|
|
6925
|
+
this.getDetectionProgramsForPackages = async (command30) => {
|
|
6929
6926
|
const response = await this.httpClient.request(
|
|
6930
6927
|
"/api/v0/detection-programs-for-packages",
|
|
6931
6928
|
{
|
|
6932
6929
|
method: "POST",
|
|
6933
6930
|
body: {
|
|
6934
|
-
packagesSlugs:
|
|
6931
|
+
packagesSlugs: command30.packagesSlugs
|
|
6935
6932
|
},
|
|
6936
6933
|
onError: (response2) => {
|
|
6937
6934
|
if (response2.status === 404) {
|
|
@@ -6942,10 +6939,10 @@ var LinterGateway = class {
|
|
|
6942
6939
|
);
|
|
6943
6940
|
return handleScopeInTargetsResponse(response);
|
|
6944
6941
|
};
|
|
6945
|
-
this.trackLinterExecution = async (
|
|
6942
|
+
this.trackLinterExecution = async (command30) => {
|
|
6946
6943
|
return this.httpClient.request(`/api/v0/track-execution`, {
|
|
6947
6944
|
method: "POST",
|
|
6948
|
-
body:
|
|
6945
|
+
body: command30
|
|
6949
6946
|
});
|
|
6950
6947
|
};
|
|
6951
6948
|
}
|
|
@@ -6999,27 +6996,27 @@ var SpacesGateway = class {
|
|
|
6999
6996
|
var SkillsGateway = class {
|
|
7000
6997
|
constructor(httpClient) {
|
|
7001
6998
|
this.httpClient = httpClient;
|
|
7002
|
-
this.upload = async (
|
|
6999
|
+
this.upload = async (command30) => {
|
|
7003
7000
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7004
7001
|
return this.httpClient.request(
|
|
7005
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7002
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/skills/upload`,
|
|
7006
7003
|
{
|
|
7007
7004
|
method: "POST",
|
|
7008
|
-
body:
|
|
7005
|
+
body: command30
|
|
7009
7006
|
}
|
|
7010
7007
|
);
|
|
7011
7008
|
};
|
|
7012
|
-
this.getDefaults = async (
|
|
7009
|
+
this.getDefaults = async (command30) => {
|
|
7013
7010
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7014
7011
|
const queryParams = new URLSearchParams();
|
|
7015
|
-
if (
|
|
7012
|
+
if (command30.includeBeta) {
|
|
7016
7013
|
queryParams.set("includeBeta", "true");
|
|
7017
|
-
} else if (
|
|
7018
|
-
queryParams.set("cliVersion",
|
|
7014
|
+
} else if (command30.cliVersion) {
|
|
7015
|
+
queryParams.set("cliVersion", command30.cliVersion);
|
|
7019
7016
|
}
|
|
7020
|
-
if (
|
|
7017
|
+
if (command30.agents !== void 0) {
|
|
7021
7018
|
queryParams.append("agentsConfigOverride", "true");
|
|
7022
|
-
|
|
7019
|
+
command30.agents.forEach((agent) => {
|
|
7023
7020
|
queryParams.append("agent", agent);
|
|
7024
7021
|
});
|
|
7025
7022
|
}
|
|
@@ -7028,10 +7025,10 @@ var SkillsGateway = class {
|
|
|
7028
7025
|
`/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
|
|
7029
7026
|
);
|
|
7030
7027
|
};
|
|
7031
|
-
this.list = async (
|
|
7028
|
+
this.list = async (command30) => {
|
|
7032
7029
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7033
7030
|
return this.httpClient.request(
|
|
7034
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7031
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/skills`
|
|
7035
7032
|
);
|
|
7036
7033
|
};
|
|
7037
7034
|
}
|
|
@@ -7041,17 +7038,17 @@ var SkillsGateway = class {
|
|
|
7041
7038
|
var CommandsGateway = class {
|
|
7042
7039
|
constructor(httpClient) {
|
|
7043
7040
|
this.httpClient = httpClient;
|
|
7044
|
-
this.create = async (
|
|
7041
|
+
this.create = async (command30) => {
|
|
7045
7042
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7046
7043
|
return this.httpClient.request(
|
|
7047
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7048
|
-
{ method: "POST", body:
|
|
7044
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/recipes`,
|
|
7045
|
+
{ method: "POST", body: command30 }
|
|
7049
7046
|
);
|
|
7050
7047
|
};
|
|
7051
|
-
this.list = async (
|
|
7048
|
+
this.list = async (command30) => {
|
|
7052
7049
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7053
7050
|
const listRecipesResponse = await this.httpClient.request(
|
|
7054
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7051
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/recipes`
|
|
7055
7052
|
);
|
|
7056
7053
|
if (listRecipesResponse instanceof Array) {
|
|
7057
7054
|
return { recipes: listRecipesResponse };
|
|
@@ -7092,10 +7089,10 @@ var StandardsGateway = class {
|
|
|
7092
7089
|
}
|
|
7093
7090
|
);
|
|
7094
7091
|
};
|
|
7095
|
-
this.list = async (
|
|
7092
|
+
this.list = async (command30) => {
|
|
7096
7093
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7097
7094
|
return this.httpClient.request(
|
|
7098
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7095
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/standards`
|
|
7099
7096
|
);
|
|
7100
7097
|
};
|
|
7101
7098
|
}
|
|
@@ -7106,10 +7103,10 @@ var PackagesGateway = class {
|
|
|
7106
7103
|
constructor(apiKey, httpClient) {
|
|
7107
7104
|
this.apiKey = apiKey;
|
|
7108
7105
|
this.httpClient = httpClient;
|
|
7109
|
-
this.list = async (
|
|
7106
|
+
this.list = async (command30) => {
|
|
7110
7107
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7111
7108
|
return this.httpClient.request(
|
|
7112
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7109
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/packages`
|
|
7113
7110
|
);
|
|
7114
7111
|
};
|
|
7115
7112
|
this.getSummary = async ({
|
|
@@ -7121,24 +7118,24 @@ var PackagesGateway = class {
|
|
|
7121
7118
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug6)}`
|
|
7122
7119
|
);
|
|
7123
7120
|
};
|
|
7124
|
-
this.create = async (
|
|
7121
|
+
this.create = async (command30) => {
|
|
7125
7122
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7126
7123
|
return this.httpClient.request(
|
|
7127
|
-
`/api/v0/organizations/${organizationId}/spaces/${
|
|
7124
|
+
`/api/v0/organizations/${organizationId}/spaces/${command30.spaceId}/packages`,
|
|
7128
7125
|
{
|
|
7129
7126
|
method: "POST",
|
|
7130
|
-
body:
|
|
7127
|
+
body: command30
|
|
7131
7128
|
}
|
|
7132
7129
|
);
|
|
7133
7130
|
};
|
|
7134
|
-
this.addArtefacts = async (
|
|
7131
|
+
this.addArtefacts = async (command30) => {
|
|
7135
7132
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7136
|
-
const { packageId, spaceId } =
|
|
7133
|
+
const { packageId, spaceId } = command30;
|
|
7137
7134
|
return this.httpClient.request(
|
|
7138
7135
|
`/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
|
|
7139
7136
|
{
|
|
7140
7137
|
method: "POST",
|
|
7141
|
-
body:
|
|
7138
|
+
body: command30
|
|
7142
7139
|
}
|
|
7143
7140
|
);
|
|
7144
7141
|
};
|
|
@@ -7149,31 +7146,31 @@ var PackagesGateway = class {
|
|
|
7149
7146
|
var DeploymentGateway = class {
|
|
7150
7147
|
constructor(httpClient) {
|
|
7151
7148
|
this.httpClient = httpClient;
|
|
7152
|
-
this.pull = async (
|
|
7149
|
+
this.pull = async (command30) => {
|
|
7153
7150
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7154
7151
|
const queryParams = new URLSearchParams();
|
|
7155
|
-
if (
|
|
7156
|
-
|
|
7152
|
+
if (command30.packagesSlugs && command30.packagesSlugs.length > 0) {
|
|
7153
|
+
command30.packagesSlugs.forEach((slug6) => {
|
|
7157
7154
|
queryParams.append("packageSlug", slug6);
|
|
7158
7155
|
});
|
|
7159
7156
|
}
|
|
7160
|
-
if (
|
|
7161
|
-
|
|
7157
|
+
if (command30.previousPackagesSlugs && command30.previousPackagesSlugs.length > 0) {
|
|
7158
|
+
command30.previousPackagesSlugs.forEach((slug6) => {
|
|
7162
7159
|
queryParams.append("previousPackageSlug", slug6);
|
|
7163
7160
|
});
|
|
7164
7161
|
}
|
|
7165
|
-
if (
|
|
7166
|
-
queryParams.append("gitRemoteUrl",
|
|
7162
|
+
if (command30.gitRemoteUrl) {
|
|
7163
|
+
queryParams.append("gitRemoteUrl", command30.gitRemoteUrl);
|
|
7167
7164
|
}
|
|
7168
|
-
if (
|
|
7169
|
-
queryParams.append("gitBranch",
|
|
7165
|
+
if (command30.gitBranch) {
|
|
7166
|
+
queryParams.append("gitBranch", command30.gitBranch);
|
|
7170
7167
|
}
|
|
7171
|
-
if (
|
|
7172
|
-
queryParams.append("relativePath",
|
|
7168
|
+
if (command30.relativePath) {
|
|
7169
|
+
queryParams.append("relativePath", command30.relativePath);
|
|
7173
7170
|
}
|
|
7174
|
-
if (
|
|
7171
|
+
if (command30.agents !== void 0) {
|
|
7175
7172
|
queryParams.append("agentsConfigOverride", "true");
|
|
7176
|
-
|
|
7173
|
+
command30.agents.forEach((agent) => {
|
|
7177
7174
|
queryParams.append("agent", agent);
|
|
7178
7175
|
});
|
|
7179
7176
|
}
|
|
@@ -7181,101 +7178,101 @@ var DeploymentGateway = class {
|
|
|
7181
7178
|
`/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
|
|
7182
7179
|
);
|
|
7183
7180
|
};
|
|
7184
|
-
this.install = async (
|
|
7181
|
+
this.install = async (command30) => {
|
|
7185
7182
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7186
7183
|
return this.httpClient.request(
|
|
7187
7184
|
`/api/v0/organizations/${organizationId}/install`,
|
|
7188
7185
|
{
|
|
7189
7186
|
method: "POST",
|
|
7190
7187
|
body: {
|
|
7191
|
-
packagesSlugs:
|
|
7192
|
-
packmindLockFile:
|
|
7193
|
-
...
|
|
7194
|
-
...
|
|
7188
|
+
packagesSlugs: command30.packagesSlugs,
|
|
7189
|
+
packmindLockFile: command30.packmindLockFile,
|
|
7190
|
+
...command30.relativePath && { relativePath: command30.relativePath },
|
|
7191
|
+
...command30.agents !== void 0 && { agents: command30.agents }
|
|
7195
7192
|
}
|
|
7196
7193
|
}
|
|
7197
7194
|
);
|
|
7198
7195
|
};
|
|
7199
|
-
this.getDeployed = async (
|
|
7196
|
+
this.getDeployed = async (command30) => {
|
|
7200
7197
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7201
7198
|
return this.httpClient.request(
|
|
7202
7199
|
`/api/v0/organizations/${organizationId}/deployed-content`,
|
|
7203
7200
|
{
|
|
7204
7201
|
method: "POST",
|
|
7205
7202
|
body: {
|
|
7206
|
-
packagesSlugs:
|
|
7207
|
-
gitRemoteUrl:
|
|
7208
|
-
gitBranch:
|
|
7209
|
-
relativePath:
|
|
7210
|
-
...
|
|
7203
|
+
packagesSlugs: command30.packagesSlugs,
|
|
7204
|
+
gitRemoteUrl: command30.gitRemoteUrl,
|
|
7205
|
+
gitBranch: command30.gitBranch,
|
|
7206
|
+
relativePath: command30.relativePath,
|
|
7207
|
+
...command30.agents !== void 0 && { agents: command30.agents }
|
|
7211
7208
|
}
|
|
7212
7209
|
}
|
|
7213
7210
|
);
|
|
7214
7211
|
};
|
|
7215
|
-
this.getContentByVersions = async (
|
|
7212
|
+
this.getContentByVersions = async (command30) => {
|
|
7216
7213
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7217
7214
|
return this.httpClient.request(
|
|
7218
7215
|
`/api/v0/organizations/${organizationId}/content-by-versions`,
|
|
7219
7216
|
{
|
|
7220
7217
|
method: "POST",
|
|
7221
7218
|
body: {
|
|
7222
|
-
artifacts:
|
|
7223
|
-
...
|
|
7219
|
+
artifacts: command30.artifacts,
|
|
7220
|
+
...command30.agents !== void 0 && { agents: command30.agents }
|
|
7224
7221
|
}
|
|
7225
7222
|
}
|
|
7226
7223
|
);
|
|
7227
7224
|
};
|
|
7228
|
-
this.notifyDistribution = async (
|
|
7225
|
+
this.notifyDistribution = async (command30) => {
|
|
7229
7226
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7230
7227
|
return this.httpClient.request(
|
|
7231
7228
|
`/api/v0/organizations/${organizationId}/deployments`,
|
|
7232
7229
|
{
|
|
7233
7230
|
method: "POST",
|
|
7234
|
-
body:
|
|
7231
|
+
body: command30
|
|
7235
7232
|
}
|
|
7236
7233
|
);
|
|
7237
7234
|
};
|
|
7238
|
-
this.notifyArtefactsDistribution = async (
|
|
7235
|
+
this.notifyArtefactsDistribution = async (command30) => {
|
|
7239
7236
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7240
7237
|
return this.httpClient.request(
|
|
7241
7238
|
`/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
|
|
7242
7239
|
{
|
|
7243
7240
|
method: "POST",
|
|
7244
7241
|
body: {
|
|
7245
|
-
gitRemoteUrl:
|
|
7246
|
-
gitBranch:
|
|
7247
|
-
relativePath:
|
|
7248
|
-
packmindLockFile:
|
|
7242
|
+
gitRemoteUrl: command30.gitRemoteUrl,
|
|
7243
|
+
gitBranch: command30.gitBranch,
|
|
7244
|
+
relativePath: command30.relativePath,
|
|
7245
|
+
packmindLockFile: command30.packmindLockFile
|
|
7249
7246
|
}
|
|
7250
7247
|
}
|
|
7251
7248
|
);
|
|
7252
7249
|
};
|
|
7253
|
-
this.renderPlugin = async (
|
|
7250
|
+
this.renderPlugin = async (command30) => {
|
|
7254
7251
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7255
7252
|
return this.httpClient.request(
|
|
7256
7253
|
`/api/v0/organizations/${organizationId}/plugins/render`,
|
|
7257
7254
|
{
|
|
7258
7255
|
method: "POST",
|
|
7259
7256
|
body: {
|
|
7260
|
-
packageSlug:
|
|
7261
|
-
mode:
|
|
7262
|
-
pluginRoot:
|
|
7263
|
-
pluginName:
|
|
7264
|
-
gitRemoteUrl:
|
|
7265
|
-
gitBranch:
|
|
7257
|
+
packageSlug: command30.packageSlug,
|
|
7258
|
+
mode: command30.mode,
|
|
7259
|
+
pluginRoot: command30.pluginRoot,
|
|
7260
|
+
pluginName: command30.pluginName,
|
|
7261
|
+
gitRemoteUrl: command30.gitRemoteUrl,
|
|
7262
|
+
gitBranch: command30.gitBranch
|
|
7266
7263
|
}
|
|
7267
7264
|
}
|
|
7268
7265
|
);
|
|
7269
7266
|
};
|
|
7270
|
-
this.trackPluginDeleted = async (
|
|
7267
|
+
this.trackPluginDeleted = async (command30) => {
|
|
7271
7268
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7272
7269
|
return this.httpClient.request(
|
|
7273
7270
|
`/api/v0/organizations/${organizationId}/plugins/track-deleted`,
|
|
7274
7271
|
{
|
|
7275
7272
|
method: "POST",
|
|
7276
7273
|
body: {
|
|
7277
|
-
packageSlug:
|
|
7278
|
-
gitRemoteUrl:
|
|
7274
|
+
packageSlug: command30.packageSlug,
|
|
7275
|
+
gitRemoteUrl: command30.gitRemoteUrl
|
|
7279
7276
|
}
|
|
7280
7277
|
}
|
|
7281
7278
|
);
|
|
@@ -7287,13 +7284,13 @@ var DeploymentGateway = class {
|
|
|
7287
7284
|
);
|
|
7288
7285
|
};
|
|
7289
7286
|
}
|
|
7290
|
-
async updateRenderModeConfiguration(
|
|
7287
|
+
async updateRenderModeConfiguration(command30) {
|
|
7291
7288
|
const { organizationId } = this.httpClient.getAuthContext();
|
|
7292
7289
|
await this.httpClient.request(
|
|
7293
7290
|
`/api/v0/organizations/${organizationId}/deployments/renderModeConfiguration`,
|
|
7294
7291
|
{
|
|
7295
7292
|
method: "POST",
|
|
7296
|
-
body: { activeRenderModes:
|
|
7293
|
+
body: { activeRenderModes: command30.activeRenderModes }
|
|
7297
7294
|
}
|
|
7298
7295
|
);
|
|
7299
7296
|
}
|
|
@@ -9093,8 +9090,8 @@ var ExecuteLinterProgramsUseCase = class {
|
|
|
9093
9090
|
this.linterAstAdapter = linterAstAdapter;
|
|
9094
9091
|
this.logger = logger2;
|
|
9095
9092
|
}
|
|
9096
|
-
async execute(
|
|
9097
|
-
const { filePath, fileContent, language, programs } =
|
|
9093
|
+
async execute(command30) {
|
|
9094
|
+
const { filePath, fileContent, language, programs } = command30;
|
|
9098
9095
|
if (programs.length === 0) {
|
|
9099
9096
|
return {
|
|
9100
9097
|
file: filePath,
|
|
@@ -9913,8 +9910,8 @@ var InstallPackagesUseCase = class {
|
|
|
9913
9910
|
constructor(packmindGateway) {
|
|
9914
9911
|
this.packmindGateway = packmindGateway;
|
|
9915
9912
|
}
|
|
9916
|
-
async execute(
|
|
9917
|
-
const baseDirectory =
|
|
9913
|
+
async execute(command30) {
|
|
9914
|
+
const baseDirectory = command30.baseDirectory || process.cwd();
|
|
9918
9915
|
const result = {
|
|
9919
9916
|
filesCreated: 0,
|
|
9920
9917
|
filesUpdated: 0,
|
|
@@ -9926,12 +9923,12 @@ var InstallPackagesUseCase = class {
|
|
|
9926
9923
|
skillDirectoriesDeleted: 0
|
|
9927
9924
|
};
|
|
9928
9925
|
const response = await this.packmindGateway.deployment.pull({
|
|
9929
|
-
packagesSlugs:
|
|
9930
|
-
previousPackagesSlugs:
|
|
9931
|
-
gitRemoteUrl:
|
|
9932
|
-
gitBranch:
|
|
9933
|
-
relativePath:
|
|
9934
|
-
agents:
|
|
9926
|
+
packagesSlugs: command30.packagesSlugs,
|
|
9927
|
+
previousPackagesSlugs: command30.previousPackagesSlugs,
|
|
9928
|
+
gitRemoteUrl: command30.gitRemoteUrl,
|
|
9929
|
+
gitBranch: command30.gitBranch,
|
|
9930
|
+
relativePath: command30.relativePath,
|
|
9931
|
+
agents: command30.agents
|
|
9935
9932
|
});
|
|
9936
9933
|
const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
|
|
9937
9934
|
(file) => file.path !== "packmind.json"
|
|
@@ -10306,8 +10303,8 @@ var InstallUseCase = class {
|
|
|
10306
10303
|
this.configFileRepository = configFileRepository;
|
|
10307
10304
|
this.spaceService = spaceService;
|
|
10308
10305
|
}
|
|
10309
|
-
async execute(
|
|
10310
|
-
const baseDirectory =
|
|
10306
|
+
async execute(command30) {
|
|
10307
|
+
const baseDirectory = command30.baseDirectory || process.cwd();
|
|
10311
10308
|
const result = {
|
|
10312
10309
|
filesCreated: 0,
|
|
10313
10310
|
filesUpdated: 0,
|
|
@@ -10337,7 +10334,7 @@ var InstallUseCase = class {
|
|
|
10337
10334
|
},
|
|
10338
10335
|
resolvedAgents: []
|
|
10339
10336
|
};
|
|
10340
|
-
const hasExplicitPackages =
|
|
10337
|
+
const hasExplicitPackages = command30.packages && command30.packages.length > 0;
|
|
10341
10338
|
const configExistedBefore = await this.configFileRepository.configExists(baseDirectory);
|
|
10342
10339
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
10343
10340
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
@@ -10358,13 +10355,13 @@ var InstallUseCase = class {
|
|
|
10358
10355
|
packageSlugs: [],
|
|
10359
10356
|
agents: [],
|
|
10360
10357
|
artifacts: {},
|
|
10361
|
-
...
|
|
10358
|
+
...command30.skipInstalledAt ? {} : { installedAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
10362
10359
|
};
|
|
10363
|
-
effectiveLockFile.cliVersion =
|
|
10360
|
+
effectiveLockFile.cliVersion = command30.cliVersion;
|
|
10364
10361
|
let packagesSlugs;
|
|
10365
10362
|
let normalizedPackages = [];
|
|
10366
10363
|
if (hasExplicitPackages) {
|
|
10367
|
-
const explicitPackageSlugs = (
|
|
10364
|
+
const explicitPackageSlugs = (command30.packages ?? []).map(
|
|
10368
10365
|
displayableParsedPackageSlug
|
|
10369
10366
|
);
|
|
10370
10367
|
normalizedPackages = await this.normalizePackageSlugs(explicitPackageSlugs);
|
|
@@ -10394,8 +10391,8 @@ var InstallUseCase = class {
|
|
|
10394
10391
|
}
|
|
10395
10392
|
return result;
|
|
10396
10393
|
}
|
|
10397
|
-
const installAgents = this.resolveInstallAgents(
|
|
10398
|
-
const stripPathPrefix =
|
|
10394
|
+
const installAgents = this.resolveInstallAgents(command30, config);
|
|
10395
|
+
const stripPathPrefix = command30.homeAgent ? getAgentHomeDirPrefix(command30.homeAgent) ?? void 0 : void 0;
|
|
10399
10396
|
const response = await this.packmindGateway.deployment.install({
|
|
10400
10397
|
packagesSlugs,
|
|
10401
10398
|
packmindLockFile: effectiveLockFile,
|
|
@@ -10535,10 +10532,10 @@ var InstallUseCase = class {
|
|
|
10535
10532
|
} catch {
|
|
10536
10533
|
}
|
|
10537
10534
|
}
|
|
10538
|
-
if (
|
|
10535
|
+
if (command30.skipInstalledAt) {
|
|
10539
10536
|
delete lockFileToPersist.installedAt;
|
|
10540
10537
|
}
|
|
10541
|
-
lockFileToPersist.cliVersion =
|
|
10538
|
+
lockFileToPersist.cliVersion = command30.cliVersion;
|
|
10542
10539
|
if (stripPathPrefix) {
|
|
10543
10540
|
lockFileToPersist = this.stripLockFileArtifactPaths(
|
|
10544
10541
|
lockFileToPersist,
|
|
@@ -10567,9 +10564,9 @@ var InstallUseCase = class {
|
|
|
10567
10564
|
async normalizePackageSlugs(slugs) {
|
|
10568
10565
|
return normalizePackageSlugs(slugs, this.spaceService);
|
|
10569
10566
|
}
|
|
10570
|
-
resolveInstallAgents(
|
|
10571
|
-
if (
|
|
10572
|
-
return [
|
|
10567
|
+
resolveInstallAgents(command30, config) {
|
|
10568
|
+
if (command30.homeAgent) {
|
|
10569
|
+
return [command30.homeAgent];
|
|
10573
10570
|
}
|
|
10574
10571
|
return config?.agents;
|
|
10575
10572
|
}
|
|
@@ -10883,8 +10880,8 @@ var UninstallUseCase = class {
|
|
|
10883
10880
|
this.spaceService = spaceService;
|
|
10884
10881
|
this.installUseCase = installUseCase;
|
|
10885
10882
|
}
|
|
10886
|
-
async execute(
|
|
10887
|
-
const baseDirectory =
|
|
10883
|
+
async execute(command30) {
|
|
10884
|
+
const baseDirectory = command30.baseDirectory || process.cwd();
|
|
10888
10885
|
const config = await this.configFileRepository.readConfig(baseDirectory);
|
|
10889
10886
|
if (!config) {
|
|
10890
10887
|
const configFileExists = await this.configFileRepository.configExists(baseDirectory);
|
|
@@ -10898,7 +10895,7 @@ var UninstallUseCase = class {
|
|
|
10898
10895
|
);
|
|
10899
10896
|
}
|
|
10900
10897
|
const normalized = await normalizePackageSlugs(
|
|
10901
|
-
|
|
10898
|
+
command30.packages,
|
|
10902
10899
|
this.spaceService
|
|
10903
10900
|
);
|
|
10904
10901
|
const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
|
|
@@ -10921,7 +10918,7 @@ ${pkgList}`
|
|
|
10921
10918
|
try {
|
|
10922
10919
|
return await this.installUseCase.execute({
|
|
10923
10920
|
baseDirectory,
|
|
10924
|
-
cliVersion:
|
|
10921
|
+
cliVersion: command30.cliVersion
|
|
10925
10922
|
});
|
|
10926
10923
|
} catch (error) {
|
|
10927
10924
|
await this.configFileRepository.updateConfig(
|
|
@@ -10963,8 +10960,8 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10963
10960
|
constructor(repositories) {
|
|
10964
10961
|
this.repositories = repositories;
|
|
10965
10962
|
}
|
|
10966
|
-
async execute(
|
|
10967
|
-
const baseDirectory =
|
|
10963
|
+
async execute(command30) {
|
|
10964
|
+
const baseDirectory = command30.baseDirectory || process.cwd();
|
|
10968
10965
|
await this.bootstrapEmptyDirectory(baseDirectory);
|
|
10969
10966
|
const result = {
|
|
10970
10967
|
filesCreated: 0,
|
|
@@ -10974,24 +10971,24 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
10974
10971
|
skippedIncompatibleSkillNames: [],
|
|
10975
10972
|
incompatibleInstalledSkills: []
|
|
10976
10973
|
};
|
|
10977
|
-
let agents =
|
|
10974
|
+
let agents = command30.agents;
|
|
10978
10975
|
if (!agents || agents.length === 0) {
|
|
10979
10976
|
const config = await this.repositories.configFileRepository.readConfig(baseDirectory);
|
|
10980
10977
|
agents = config?.agents;
|
|
10981
10978
|
}
|
|
10982
10979
|
const response = await this.repositories.packmindGateway.skills.getDefaults(
|
|
10983
10980
|
{
|
|
10984
|
-
cliVersion:
|
|
10985
|
-
includeBeta:
|
|
10981
|
+
cliVersion: command30.cliVersion,
|
|
10982
|
+
includeBeta: command30.includeBeta,
|
|
10986
10983
|
agents
|
|
10987
10984
|
}
|
|
10988
10985
|
);
|
|
10989
10986
|
result.skippedSkillsCount = response.skippedSkillsCount;
|
|
10990
10987
|
const incompatibleInstalledMap = /* @__PURE__ */ new Map();
|
|
10991
10988
|
const incompatibleSkillDirs = /* @__PURE__ */ new Map();
|
|
10992
|
-
if (
|
|
10989
|
+
if (command30.cliVersion) {
|
|
10993
10990
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
10994
|
-
if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content,
|
|
10991
|
+
if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command30.cliVersion)) {
|
|
10995
10992
|
const dir = path9.dirname(file.path);
|
|
10996
10993
|
const skillName = this.getSkillName(file.content) ?? path9.basename(dir);
|
|
10997
10994
|
incompatibleSkillDirs.set(dir, skillName);
|
|
@@ -11002,9 +10999,9 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
11002
10999
|
for (const file of response.fileUpdates.createOrUpdate) {
|
|
11003
11000
|
try {
|
|
11004
11001
|
if (!file.content) continue;
|
|
11005
|
-
const isIncompatible =
|
|
11002
|
+
const isIncompatible = command30.cliVersion && (this.isVersionConstraintViolated(
|
|
11006
11003
|
file.content,
|
|
11007
|
-
|
|
11004
|
+
command30.cliVersion
|
|
11008
11005
|
) || this.isUnderIncompatibleSkillDir(
|
|
11009
11006
|
file.path,
|
|
11010
11007
|
incompatibleSkillDirs
|
|
@@ -11047,7 +11044,7 @@ var InstallDefaultSkillsUseCase = class {
|
|
|
11047
11044
|
await this.mergeLockFileSlice(
|
|
11048
11045
|
baseDirectory,
|
|
11049
11046
|
response.lockFileSlice ?? {},
|
|
11050
|
-
|
|
11047
|
+
command30.cliVersion
|
|
11051
11048
|
);
|
|
11052
11049
|
return result;
|
|
11053
11050
|
}
|
|
@@ -11201,8 +11198,8 @@ var EnsureCliVersionUseCase = class {
|
|
|
11201
11198
|
this.lockFileRepository = lockFileRepository;
|
|
11202
11199
|
this.installDefaultSkillsUseCase = installDefaultSkillsUseCase;
|
|
11203
11200
|
}
|
|
11204
|
-
async execute(
|
|
11205
|
-
const { baseDirectory, currentCliVersion, includeBeta } =
|
|
11201
|
+
async execute(command30) {
|
|
11202
|
+
const { baseDirectory, currentCliVersion, includeBeta } = command30;
|
|
11206
11203
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
11207
11204
|
if (!lockFile) {
|
|
11208
11205
|
return { kind: "no-lockfile" };
|
|
@@ -11238,10 +11235,10 @@ var ListPackagesUseCase = class {
|
|
|
11238
11235
|
this.packmindGateway = packmindGateway;
|
|
11239
11236
|
this.spaceService = spaceService;
|
|
11240
11237
|
}
|
|
11241
|
-
async execute(
|
|
11242
|
-
if (
|
|
11238
|
+
async execute(command30) {
|
|
11239
|
+
if (command30.spaceId) {
|
|
11243
11240
|
const response = await this.packmindGateway.packages.list({
|
|
11244
|
-
spaceId:
|
|
11241
|
+
spaceId: command30.spaceId
|
|
11245
11242
|
});
|
|
11246
11243
|
return response.packages;
|
|
11247
11244
|
}
|
|
@@ -11260,8 +11257,8 @@ var GetPackageSummaryUseCase = class {
|
|
|
11260
11257
|
constructor(gateway) {
|
|
11261
11258
|
this.gateway = gateway;
|
|
11262
11259
|
}
|
|
11263
|
-
async execute(
|
|
11264
|
-
return this.gateway.packages.getSummary(
|
|
11260
|
+
async execute(command30) {
|
|
11261
|
+
return this.gateway.packages.getSummary(command30);
|
|
11265
11262
|
}
|
|
11266
11263
|
};
|
|
11267
11264
|
|
|
@@ -11556,8 +11553,8 @@ var LoginUseCase = class {
|
|
|
11556
11553
|
startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
|
|
11557
11554
|
};
|
|
11558
11555
|
}
|
|
11559
|
-
async execute(
|
|
11560
|
-
const { host, code: providedCode } =
|
|
11556
|
+
async execute(command30) {
|
|
11557
|
+
const { host, code: providedCode } = command30;
|
|
11561
11558
|
let code;
|
|
11562
11559
|
if (providedCode) {
|
|
11563
11560
|
code = providedCode;
|
|
@@ -11939,10 +11936,10 @@ var CheckCliVersionUseCase = class {
|
|
|
11939
11936
|
now: deps?.now ?? (() => /* @__PURE__ */ new Date())
|
|
11940
11937
|
};
|
|
11941
11938
|
}
|
|
11942
|
-
async execute(
|
|
11943
|
-
const cached = this.readFreshCache(
|
|
11939
|
+
async execute(command30) {
|
|
11940
|
+
const cached = this.readFreshCache(command30.currentVersion);
|
|
11944
11941
|
if (cached) {
|
|
11945
|
-
return this.toResult(
|
|
11942
|
+
return this.toResult(command30.currentVersion, cached.latestVersion);
|
|
11946
11943
|
}
|
|
11947
11944
|
const fetchPromise = this.deps.fetchLatestVersion(this.deps.fetchFn);
|
|
11948
11945
|
fetchPromise.catch(() => void 0);
|
|
@@ -11960,7 +11957,7 @@ var CheckCliVersionUseCase = class {
|
|
|
11960
11957
|
latestVersion,
|
|
11961
11958
|
checkedAt: this.deps.now()
|
|
11962
11959
|
});
|
|
11963
|
-
return this.toResult(
|
|
11960
|
+
return this.toResult(command30.currentVersion, latestVersion);
|
|
11964
11961
|
} catch {
|
|
11965
11962
|
return null;
|
|
11966
11963
|
}
|
|
@@ -12408,10 +12405,10 @@ var ListStandardsUseCase = class {
|
|
|
12408
12405
|
this.packmindGateway = packmindGateway;
|
|
12409
12406
|
this.spaceService = spaceService;
|
|
12410
12407
|
}
|
|
12411
|
-
async execute(
|
|
12412
|
-
if (
|
|
12408
|
+
async execute(command30) {
|
|
12409
|
+
if (command30.spaceId) {
|
|
12413
12410
|
const response = await this.packmindGateway.standards.list({
|
|
12414
|
-
spaceId:
|
|
12411
|
+
spaceId: command30.spaceId
|
|
12415
12412
|
});
|
|
12416
12413
|
return response.standards;
|
|
12417
12414
|
}
|
|
@@ -12431,10 +12428,10 @@ var ListCommandsUseCase = class {
|
|
|
12431
12428
|
this.packmindGateway = packmindGateway;
|
|
12432
12429
|
this.spaceService = spaceService;
|
|
12433
12430
|
}
|
|
12434
|
-
async execute(
|
|
12435
|
-
if (
|
|
12431
|
+
async execute(command30) {
|
|
12432
|
+
if (command30.spaceId) {
|
|
12436
12433
|
const response = await this.packmindGateway.commands.list({
|
|
12437
|
-
spaceId:
|
|
12434
|
+
spaceId: command30.spaceId
|
|
12438
12435
|
});
|
|
12439
12436
|
return response.recipes;
|
|
12440
12437
|
}
|
|
@@ -12454,10 +12451,10 @@ var ListSkillsUseCase = class {
|
|
|
12454
12451
|
this.packmindGateway = packmindGateway;
|
|
12455
12452
|
this.spaceService = spaceService;
|
|
12456
12453
|
}
|
|
12457
|
-
async execute(
|
|
12458
|
-
if (
|
|
12454
|
+
async execute(command30) {
|
|
12455
|
+
if (command30.spaceId) {
|
|
12459
12456
|
const skills = await this.packmindGateway.skills.list({
|
|
12460
|
-
spaceId:
|
|
12457
|
+
spaceId: command30.spaceId
|
|
12461
12458
|
});
|
|
12462
12459
|
return skills.map((s) => ({
|
|
12463
12460
|
id: s.id,
|
|
@@ -12634,8 +12631,8 @@ var UploadSkillUseCase = class {
|
|
|
12634
12631
|
constructor(deps) {
|
|
12635
12632
|
this.deps = deps;
|
|
12636
12633
|
}
|
|
12637
|
-
async execute(
|
|
12638
|
-
const files = await readSkillDirectory(
|
|
12634
|
+
async execute(command30) {
|
|
12635
|
+
const files = await readSkillDirectory(command30.skillPath);
|
|
12639
12636
|
if (!files.find((f) => f.relativePath === "SKILL.md")) {
|
|
12640
12637
|
throw new Error("SKILL.md not found in skill directory");
|
|
12641
12638
|
}
|
|
@@ -12649,7 +12646,7 @@ var UploadSkillUseCase = class {
|
|
|
12649
12646
|
if (totalSize > 10 * 1024 * 1024) {
|
|
12650
12647
|
throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
|
|
12651
12648
|
}
|
|
12652
|
-
const space = await this.getSpace(
|
|
12649
|
+
const space = await this.getSpace(command30.spaceSlug);
|
|
12653
12650
|
const payload = {
|
|
12654
12651
|
files: files.map((f) => ({
|
|
12655
12652
|
path: f.relativePath,
|
|
@@ -12661,7 +12658,7 @@ var UploadSkillUseCase = class {
|
|
|
12661
12658
|
const uploadSkillResponse = await this.deps.gateway.skills.upload({
|
|
12662
12659
|
spaceId: createSpaceId(space.id),
|
|
12663
12660
|
files: payload.files,
|
|
12664
|
-
originSkill:
|
|
12661
|
+
originSkill: command30.originSkill
|
|
12665
12662
|
});
|
|
12666
12663
|
return {
|
|
12667
12664
|
skillId: uploadSkillResponse.skill.id,
|
|
@@ -13651,9 +13648,9 @@ var DiffArtefactsUseCase = class {
|
|
|
13651
13648
|
new StandardDiffStrategy()
|
|
13652
13649
|
];
|
|
13653
13650
|
}
|
|
13654
|
-
async execute(
|
|
13655
|
-
const baseDirectory =
|
|
13656
|
-
const response = await this.fetchContent(
|
|
13651
|
+
async execute(command30) {
|
|
13652
|
+
const baseDirectory = command30.baseDirectory || process.cwd();
|
|
13653
|
+
const response = await this.fetchContent(command30, baseDirectory);
|
|
13657
13654
|
const filteredFiles = response.fileUpdates.createOrUpdate.filter(
|
|
13658
13655
|
(file) => file.path !== "packmind.json"
|
|
13659
13656
|
);
|
|
@@ -13666,7 +13663,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13666
13663
|
);
|
|
13667
13664
|
const prefixedSkillFolders = this.prefixSkillFolders(
|
|
13668
13665
|
response.skillFolders,
|
|
13669
|
-
|
|
13666
|
+
command30.relativePath
|
|
13670
13667
|
);
|
|
13671
13668
|
const diffs = [];
|
|
13672
13669
|
for (const file of diffableFiles) {
|
|
@@ -13693,7 +13690,7 @@ var DiffArtefactsUseCase = class {
|
|
|
13693
13690
|
targetId: response.targetId ? createTargetId(response.targetId) : void 0
|
|
13694
13691
|
}));
|
|
13695
13692
|
}
|
|
13696
|
-
async fetchContent(
|
|
13693
|
+
async fetchContent(command30, baseDirectory) {
|
|
13697
13694
|
const lockFile = await this.lockFileRepository.read(baseDirectory);
|
|
13698
13695
|
if (lockFile) {
|
|
13699
13696
|
try {
|
|
@@ -13713,11 +13710,11 @@ var DiffArtefactsUseCase = class {
|
|
|
13713
13710
|
}
|
|
13714
13711
|
}
|
|
13715
13712
|
return this.packmindGateway.deployment.getDeployed({
|
|
13716
|
-
packagesSlugs:
|
|
13717
|
-
gitRemoteUrl:
|
|
13718
|
-
gitBranch:
|
|
13719
|
-
relativePath:
|
|
13720
|
-
agents:
|
|
13713
|
+
packagesSlugs: command30.packagesSlugs,
|
|
13714
|
+
gitRemoteUrl: command30.gitRemoteUrl,
|
|
13715
|
+
gitBranch: command30.gitBranch,
|
|
13716
|
+
relativePath: command30.relativePath,
|
|
13717
|
+
agents: command30.agents
|
|
13721
13718
|
});
|
|
13722
13719
|
}
|
|
13723
13720
|
prefixSkillFolders(skillFolders, relativePath) {
|
|
@@ -13741,8 +13738,8 @@ var SubmitDiffsUseCase = class {
|
|
|
13741
13738
|
constructor(packmindGateway) {
|
|
13742
13739
|
this.packmindGateway = packmindGateway;
|
|
13743
13740
|
}
|
|
13744
|
-
async execute(
|
|
13745
|
-
const { groupedDiffs, message } =
|
|
13741
|
+
async execute(command30) {
|
|
13742
|
+
const { groupedDiffs, message } = command30;
|
|
13746
13743
|
const skipped = [];
|
|
13747
13744
|
const validDiffs = [];
|
|
13748
13745
|
for (const group of groupedDiffs) {
|
|
@@ -13817,8 +13814,8 @@ var CheckDiffsUseCase = class {
|
|
|
13817
13814
|
constructor(packmindGateway) {
|
|
13818
13815
|
this.packmindGateway = packmindGateway;
|
|
13819
13816
|
}
|
|
13820
|
-
async execute(
|
|
13821
|
-
const { groupedDiffs } =
|
|
13817
|
+
async execute(command30) {
|
|
13818
|
+
const { groupedDiffs } = command30;
|
|
13822
13819
|
const results = [];
|
|
13823
13820
|
const validDiffs = [];
|
|
13824
13821
|
const invalidDiffs = [];
|
|
@@ -13916,8 +13913,8 @@ var CliFormatter = class {
|
|
|
13916
13913
|
static error(message) {
|
|
13917
13914
|
return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
|
|
13918
13915
|
}
|
|
13919
|
-
static command(
|
|
13920
|
-
return source_default.yellow(
|
|
13916
|
+
static command(command30) {
|
|
13917
|
+
return source_default.yellow(command30);
|
|
13921
13918
|
}
|
|
13922
13919
|
static loader(text) {
|
|
13923
13920
|
return source_default.dim.italic(text);
|
|
@@ -14130,24 +14127,24 @@ var PackmindCliHexaFactory = class {
|
|
|
14130
14127
|
var origin8 = "PackmindCliHexa";
|
|
14131
14128
|
var PackmindCliHexa = class {
|
|
14132
14129
|
constructor(logger2 = new PackmindLogger(origin8)) {
|
|
14133
|
-
this.notifyDistribution = async (
|
|
14130
|
+
this.notifyDistribution = async (command30) => {
|
|
14134
14131
|
return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
|
|
14135
|
-
|
|
14132
|
+
command30
|
|
14136
14133
|
);
|
|
14137
14134
|
};
|
|
14138
|
-
this.notifyArtefactsDistribution = async (
|
|
14135
|
+
this.notifyArtefactsDistribution = async (command30) => {
|
|
14139
14136
|
return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
|
|
14140
|
-
|
|
14137
|
+
command30
|
|
14141
14138
|
);
|
|
14142
14139
|
};
|
|
14143
|
-
this.renderPlugin = async (
|
|
14140
|
+
this.renderPlugin = async (command30) => {
|
|
14144
14141
|
return this.hexa.repositories.packmindGateway.deployment.renderPlugin(
|
|
14145
|
-
|
|
14142
|
+
command30
|
|
14146
14143
|
);
|
|
14147
14144
|
};
|
|
14148
|
-
this.trackPluginDeleted = async (
|
|
14145
|
+
this.trackPluginDeleted = async (command30) => {
|
|
14149
14146
|
return this.hexa.repositories.packmindGateway.deployment.trackPluginDeleted(
|
|
14150
|
-
|
|
14147
|
+
command30
|
|
14151
14148
|
);
|
|
14152
14149
|
};
|
|
14153
14150
|
this.logger = logger2;
|
|
@@ -14170,29 +14167,29 @@ var PackmindCliHexa = class {
|
|
|
14170
14167
|
get output() {
|
|
14171
14168
|
return this.hexa.repositories.output;
|
|
14172
14169
|
}
|
|
14173
|
-
async getGitRemoteUrl(
|
|
14174
|
-
return this.hexa.useCases.getGitRemoteUrl.execute(
|
|
14170
|
+
async getGitRemoteUrl(command30) {
|
|
14171
|
+
return this.hexa.useCases.getGitRemoteUrl.execute(command30);
|
|
14175
14172
|
}
|
|
14176
|
-
async listFilesInDirectory(
|
|
14177
|
-
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(
|
|
14173
|
+
async listFilesInDirectory(command30) {
|
|
14174
|
+
return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command30);
|
|
14178
14175
|
}
|
|
14179
|
-
async lintFilesAgainstRule(
|
|
14180
|
-
return this.hexa.useCases.lintFilesAgainstRule.execute(
|
|
14176
|
+
async lintFilesAgainstRule(command30) {
|
|
14177
|
+
return this.hexa.useCases.lintFilesAgainstRule.execute(command30);
|
|
14181
14178
|
}
|
|
14182
|
-
async lintFilesFromConfig(
|
|
14183
|
-
return this.hexa.useCases.lintFilesFromConfig.execute(
|
|
14179
|
+
async lintFilesFromConfig(command30) {
|
|
14180
|
+
return this.hexa.useCases.lintFilesFromConfig.execute(command30);
|
|
14184
14181
|
}
|
|
14185
|
-
async installPackages(
|
|
14186
|
-
return this.hexa.useCases.installPackages.execute(
|
|
14182
|
+
async installPackages(command30) {
|
|
14183
|
+
return this.hexa.useCases.installPackages.execute(command30);
|
|
14187
14184
|
}
|
|
14188
|
-
async install(
|
|
14189
|
-
return this.hexa.useCases.install.execute(
|
|
14185
|
+
async install(command30) {
|
|
14186
|
+
return this.hexa.useCases.install.execute(command30);
|
|
14190
14187
|
}
|
|
14191
|
-
async uninstall(
|
|
14192
|
-
return this.hexa.useCases.uninstall.execute(
|
|
14188
|
+
async uninstall(command30) {
|
|
14189
|
+
return this.hexa.useCases.uninstall.execute(command30);
|
|
14193
14190
|
}
|
|
14194
|
-
async diffArtefacts(
|
|
14195
|
-
return this.hexa.useCases.diffArtefacts.execute(
|
|
14191
|
+
async diffArtefacts(command30) {
|
|
14192
|
+
return this.hexa.useCases.diffArtefacts.execute(command30);
|
|
14196
14193
|
}
|
|
14197
14194
|
async submitDiffs(groupedDiffs, message) {
|
|
14198
14195
|
return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
|
|
@@ -14200,20 +14197,20 @@ var PackmindCliHexa = class {
|
|
|
14200
14197
|
async checkDiffs(groupedDiffs) {
|
|
14201
14198
|
return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
|
|
14202
14199
|
}
|
|
14203
|
-
async listPackages(
|
|
14204
|
-
return this.hexa.useCases.listPackages.execute(
|
|
14200
|
+
async listPackages(command30) {
|
|
14201
|
+
return this.hexa.useCases.listPackages.execute(command30);
|
|
14205
14202
|
}
|
|
14206
|
-
async getPackageBySlug(
|
|
14207
|
-
return this.hexa.useCases.getPackageBySlug.execute(
|
|
14203
|
+
async getPackageBySlug(command30) {
|
|
14204
|
+
return this.hexa.useCases.getPackageBySlug.execute(command30);
|
|
14208
14205
|
}
|
|
14209
|
-
async listStandards(
|
|
14210
|
-
return this.hexa.useCases.listStandards.execute(
|
|
14206
|
+
async listStandards(command30) {
|
|
14207
|
+
return this.hexa.useCases.listStandards.execute(command30);
|
|
14211
14208
|
}
|
|
14212
|
-
async listCommands(
|
|
14213
|
-
return this.hexa.useCases.listCommands.execute(
|
|
14209
|
+
async listCommands(command30) {
|
|
14210
|
+
return this.hexa.useCases.listCommands.execute(command30);
|
|
14214
14211
|
}
|
|
14215
|
-
async listSkills(
|
|
14216
|
-
return this.hexa.useCases.listSkills.execute(
|
|
14212
|
+
async listSkills(command30) {
|
|
14213
|
+
return this.hexa.useCases.listSkills.execute(command30);
|
|
14217
14214
|
}
|
|
14218
14215
|
async configExists(baseDirectory) {
|
|
14219
14216
|
return await this.hexa.repositories.configFileRepository.configExists(
|
|
@@ -14300,17 +14297,17 @@ var PackmindCliHexa = class {
|
|
|
14300
14297
|
directory
|
|
14301
14298
|
);
|
|
14302
14299
|
}
|
|
14303
|
-
async login(
|
|
14304
|
-
return this.hexa.useCases.login.execute(
|
|
14300
|
+
async login(command30) {
|
|
14301
|
+
return this.hexa.useCases.login.execute(command30);
|
|
14305
14302
|
}
|
|
14306
|
-
async logout(
|
|
14307
|
-
return this.hexa.useCases.logout.execute(
|
|
14303
|
+
async logout(command30) {
|
|
14304
|
+
return this.hexa.useCases.logout.execute(command30);
|
|
14308
14305
|
}
|
|
14309
|
-
async whoami(
|
|
14310
|
-
return this.hexa.useCases.whoami.execute(
|
|
14306
|
+
async whoami(command30) {
|
|
14307
|
+
return this.hexa.useCases.whoami.execute(command30);
|
|
14311
14308
|
}
|
|
14312
|
-
async checkCliVersion(
|
|
14313
|
-
return this.hexa.useCases.checkCliVersion.execute(
|
|
14309
|
+
async checkCliVersion(command30) {
|
|
14310
|
+
return this.hexa.useCases.checkCliVersion.execute(command30);
|
|
14314
14311
|
}
|
|
14315
14312
|
getCurrentBranch(repoPath) {
|
|
14316
14313
|
return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
|
|
@@ -14318,19 +14315,19 @@ var PackmindCliHexa = class {
|
|
|
14318
14315
|
getGitRemoteUrlFromPath(repoPath) {
|
|
14319
14316
|
return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
|
|
14320
14317
|
}
|
|
14321
|
-
async uploadSkill(
|
|
14322
|
-
return this.hexa.useCases.uploadSkill.execute(
|
|
14318
|
+
async uploadSkill(command30) {
|
|
14319
|
+
return this.hexa.useCases.uploadSkill.execute(command30);
|
|
14323
14320
|
}
|
|
14324
|
-
async installDefaultSkills(
|
|
14325
|
-
return this.hexa.useCases.installDefaultSkills.execute(
|
|
14321
|
+
async installDefaultSkills(command30) {
|
|
14322
|
+
return this.hexa.useCases.installDefaultSkills.execute(command30);
|
|
14326
14323
|
}
|
|
14327
|
-
async bootstrapSkillsInitDirectory(
|
|
14324
|
+
async bootstrapSkillsInitDirectory(command30) {
|
|
14328
14325
|
return this.hexa.useCases.installDefaultSkills.bootstrapEmptyDirectory(
|
|
14329
|
-
|
|
14326
|
+
command30.baseDirectory
|
|
14330
14327
|
);
|
|
14331
14328
|
}
|
|
14332
|
-
async ensureCliVersion(
|
|
14333
|
-
return this.hexa.useCases.ensureCliVersion.execute(
|
|
14329
|
+
async ensureCliVersion(command30) {
|
|
14330
|
+
return this.hexa.useCases.ensureCliVersion.execute(command30);
|
|
14334
14331
|
}
|
|
14335
14332
|
getPackmindGateway() {
|
|
14336
14333
|
return this.hexa.repositories.packmindGateway;
|
|
@@ -14675,21 +14672,6 @@ var RuleID = {
|
|
|
14675
14672
|
}
|
|
14676
14673
|
};
|
|
14677
14674
|
|
|
14678
|
-
// apps/cli/src/infra/commands/customParameters/DiffModeType.ts
|
|
14679
|
-
var DiffModeType = {
|
|
14680
|
-
from: async (input) => {
|
|
14681
|
-
switch (input) {
|
|
14682
|
-
case "files":
|
|
14683
|
-
return "files" /* FILES */;
|
|
14684
|
-
case "lines":
|
|
14685
|
-
return "lines" /* LINES */;
|
|
14686
|
-
}
|
|
14687
|
-
throw new Error(
|
|
14688
|
-
`${input} is not a valid value for the --diff option. Expected values are: files, lines`
|
|
14689
|
-
);
|
|
14690
|
-
}
|
|
14691
|
-
};
|
|
14692
|
-
|
|
14693
14675
|
// apps/cli/src/infra/commands/customParameters/LevelType.ts
|
|
14694
14676
|
var LevelType = {
|
|
14695
14677
|
from: async (input) => {
|
|
@@ -14748,11 +14730,6 @@ var lintCommand = (0, import_cmd_ts.command)({
|
|
|
14748
14730
|
long: "continue-on-missing-key",
|
|
14749
14731
|
description: "Skip linting and exit with status code 0 if PACKMIND_API_KEY_V3 is not set"
|
|
14750
14732
|
}),
|
|
14751
|
-
diff: (0, import_cmd_ts.option)({
|
|
14752
|
-
long: "diff",
|
|
14753
|
-
description: "[Deprecated: use --changed-files or --changed-lines] Filter violations by git diff (files | lines)",
|
|
14754
|
-
type: (0, import_cmd_ts.optional)(DiffModeType)
|
|
14755
|
-
}),
|
|
14756
14733
|
changedFiles: (0, import_cmd_ts.flag)({
|
|
14757
14734
|
long: "changed-files",
|
|
14758
14735
|
description: "Only lint files that have changed"
|
|
@@ -14773,16 +14750,6 @@ var lintCommand = (0, import_cmd_ts.command)({
|
|
|
14773
14750
|
"Options --changed-files and --changed-lines are mutually exclusive"
|
|
14774
14751
|
);
|
|
14775
14752
|
}
|
|
14776
|
-
if (args2.diff) {
|
|
14777
|
-
const replacement = args2.diff === "files" /* FILES */ ? "--changed-files" : "--changed-lines";
|
|
14778
|
-
logWarningConsole(`--diff is deprecated. Use ${replacement} instead.`);
|
|
14779
|
-
}
|
|
14780
|
-
let diff = args2.diff;
|
|
14781
|
-
if (args2.changedFiles) {
|
|
14782
|
-
diff = "files" /* FILES */;
|
|
14783
|
-
} else if (args2.changedLines) {
|
|
14784
|
-
diff = "lines" /* LINES */;
|
|
14785
|
-
}
|
|
14786
14753
|
const packmindLogger = new PackmindLogger(
|
|
14787
14754
|
"PackmindCLI",
|
|
14788
14755
|
args2.debug ? "debug" /* DEBUG */ : "info" /* INFO */
|
|
@@ -14794,7 +14761,13 @@ var lintCommand = (0, import_cmd_ts.command)({
|
|
|
14794
14761
|
resolvePath: (targetPath) => pathModule2.isAbsolute(targetPath) ? targetPath : pathModule2.resolve(process.cwd(), targetPath),
|
|
14795
14762
|
exit: (code) => process.exit(code)
|
|
14796
14763
|
};
|
|
14797
|
-
|
|
14764
|
+
const handlerArgs = args2;
|
|
14765
|
+
if (args2.changedFiles) {
|
|
14766
|
+
handlerArgs.diff = "files" /* FILES */;
|
|
14767
|
+
} else if (args2.changedLines) {
|
|
14768
|
+
handlerArgs.diff = "lines" /* LINES */;
|
|
14769
|
+
}
|
|
14770
|
+
await lintHandler(handlerArgs, deps);
|
|
14798
14771
|
}
|
|
14799
14772
|
});
|
|
14800
14773
|
|
|
@@ -15828,8 +15801,6 @@ async function installDefaultSkillsIfAtGitRoot(params) {
|
|
|
15828
15801
|
async function installHandler({
|
|
15829
15802
|
installPath,
|
|
15830
15803
|
packages,
|
|
15831
|
-
list,
|
|
15832
|
-
show,
|
|
15833
15804
|
status,
|
|
15834
15805
|
skipInstalledAt
|
|
15835
15806
|
}) {
|
|
@@ -15846,17 +15817,6 @@ async function installHandler({
|
|
|
15846
15817
|
await statusHandler({}, deps);
|
|
15847
15818
|
return;
|
|
15848
15819
|
}
|
|
15849
|
-
if (list) {
|
|
15850
|
-
logErrorConsole('Command "packmind-cli install --list" has been removed.');
|
|
15851
|
-
logConsole(`Use ${formatCommand("packmind-cli packages list")} instead.`);
|
|
15852
|
-
process.exit(1);
|
|
15853
|
-
}
|
|
15854
|
-
if (show) {
|
|
15855
|
-
const showCommand = `packmind-cli packages show ${displayableParsedPackageSlug(show)}`;
|
|
15856
|
-
logErrorConsole('Command "packmind-cli install --show" has been removed.');
|
|
15857
|
-
logConsole(`Use ${formatCommand(showCommand)} instead.`);
|
|
15858
|
-
process.exit(1);
|
|
15859
|
-
}
|
|
15860
15820
|
const cwd = installPath ? path24.resolve(process.cwd(), installPath) : process.cwd();
|
|
15861
15821
|
if (installPath) {
|
|
15862
15822
|
if (!fs23.existsSync(cwd)) {
|
|
@@ -16008,15 +15968,6 @@ var installCommand = (0, import_cmd_ts2.command)({
|
|
|
16008
15968
|
long: "status",
|
|
16009
15969
|
description: "Show status of all packmind.json files and their packages in the workspace"
|
|
16010
15970
|
}),
|
|
16011
|
-
list: (0, import_cmd_ts2.flag)({
|
|
16012
|
-
long: "list",
|
|
16013
|
-
description: "[Deprecated] List available packages"
|
|
16014
|
-
}),
|
|
16015
|
-
show: (0, import_cmd_ts2.option)({
|
|
16016
|
-
type: (0, import_cmd_ts2.optional)(PackageSlugArgType),
|
|
16017
|
-
long: "show",
|
|
16018
|
-
description: "[Deprecated] Show details of a specific package"
|
|
16019
|
-
}),
|
|
16020
15971
|
skipInstalledAt: (0, import_cmd_ts2.flag)({
|
|
16021
15972
|
long: "skip-installed-at",
|
|
16022
15973
|
description: "Omit the installedAt timestamp from the packmind-lock.json file"
|
|
@@ -16280,65 +16231,16 @@ Credentials are loaded from (in order of priority):`);
|
|
|
16280
16231
|
});
|
|
16281
16232
|
|
|
16282
16233
|
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
16283
|
-
var
|
|
16284
|
-
|
|
16285
|
-
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
16286
|
-
var import_cmd_ts8 = __toESM(require_cjs());
|
|
16287
|
-
|
|
16288
|
-
// apps/cli/src/infra/commands/sharedOptions.ts
|
|
16289
|
-
var import_cmd_ts7 = __toESM(require_cjs());
|
|
16290
|
-
var originSkillOption = (0, import_cmd_ts7.option)({
|
|
16291
|
-
long: "origin-skill",
|
|
16292
|
-
description: "Name of the skill that triggered this command",
|
|
16293
|
-
type: (0, import_cmd_ts7.optional)(import_cmd_ts7.string)
|
|
16294
|
-
});
|
|
16295
|
-
|
|
16296
|
-
// apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
|
|
16297
|
-
var SpaceSlug = {
|
|
16298
|
-
from: async (input) => {
|
|
16299
|
-
return input.startsWith("@") ? input.slice(1) : input;
|
|
16300
|
-
}
|
|
16301
|
-
};
|
|
16302
|
-
|
|
16303
|
-
// apps/cli/src/infra/commands/skills/AddSkillCommand.ts
|
|
16304
|
-
var addSkillCommand = (0, import_cmd_ts8.command)({
|
|
16305
|
-
name: "add",
|
|
16306
|
-
description: "[Deprecated] Add a skill from a local directory to a Packmind organization",
|
|
16307
|
-
args: {
|
|
16308
|
-
skillPath: (0, import_cmd_ts8.positional)({
|
|
16309
|
-
type: import_cmd_ts8.string,
|
|
16310
|
-
displayName: "path",
|
|
16311
|
-
description: "Path to skill directory containing SKILL.md"
|
|
16312
|
-
}),
|
|
16313
|
-
space: (0, import_cmd_ts8.option)({
|
|
16314
|
-
long: "space",
|
|
16315
|
-
description: "Slug of the space in which to add the skill (with or without leading @)",
|
|
16316
|
-
type: (0, import_cmd_ts8.optional)(SpaceSlug)
|
|
16317
|
-
}),
|
|
16318
|
-
originSkill: originSkillOption
|
|
16319
|
-
},
|
|
16320
|
-
handler: async () => {
|
|
16321
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
16322
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
16323
|
-
packmindCliHexa.output.notifyError(
|
|
16324
|
-
'Command "packmind-cli skills add" has been removed.',
|
|
16325
|
-
{
|
|
16326
|
-
content: 'Use the "playbook add" command instead:',
|
|
16327
|
-
exampleCommand: "packmind-cli playbook add .packmind/commands/my-command.md"
|
|
16328
|
-
}
|
|
16329
|
-
);
|
|
16330
|
-
process.exit(1);
|
|
16331
|
-
}
|
|
16332
|
-
});
|
|
16234
|
+
var import_cmd_ts9 = __toESM(require_cjs());
|
|
16333
16235
|
|
|
16334
16236
|
// apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
|
|
16335
|
-
var
|
|
16237
|
+
var import_cmd_ts7 = __toESM(require_cjs());
|
|
16336
16238
|
var { version: CLI_VERSION4 } = require_package();
|
|
16337
|
-
var installDefaultSkillsCommand = (0,
|
|
16239
|
+
var installDefaultSkillsCommand = (0, import_cmd_ts7.command)({
|
|
16338
16240
|
name: "install-default",
|
|
16339
16241
|
description: "Install default Packmind skills for configured coding agents",
|
|
16340
16242
|
args: {
|
|
16341
|
-
includeBeta: (0,
|
|
16243
|
+
includeBeta: (0, import_cmd_ts7.flag)({
|
|
16342
16244
|
long: "include-beta",
|
|
16343
16245
|
description: "Include unreleased/beta skills"
|
|
16344
16246
|
})
|
|
@@ -16415,7 +16317,7 @@ var installDefaultSkillsCommand = (0, import_cmd_ts9.command)({
|
|
|
16415
16317
|
});
|
|
16416
16318
|
|
|
16417
16319
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
16418
|
-
var
|
|
16320
|
+
var import_cmd_ts8 = __toESM(require_cjs());
|
|
16419
16321
|
|
|
16420
16322
|
// apps/cli/src/infra/utils/spaceFilterUtils.ts
|
|
16421
16323
|
function resolveSpaceFromArgs(spaceArg, spaces) {
|
|
@@ -16510,13 +16412,20 @@ ${availableSpaces}`
|
|
|
16510
16412
|
}
|
|
16511
16413
|
}
|
|
16512
16414
|
|
|
16415
|
+
// apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
|
|
16416
|
+
var SpaceSlug = {
|
|
16417
|
+
from: async (input) => {
|
|
16418
|
+
return input.startsWith("@") ? input.slice(1) : input;
|
|
16419
|
+
}
|
|
16420
|
+
};
|
|
16421
|
+
|
|
16513
16422
|
// apps/cli/src/infra/commands/ListSkillsCommand.ts
|
|
16514
|
-
var listSkillsCommand = (0,
|
|
16423
|
+
var listSkillsCommand = (0, import_cmd_ts8.command)({
|
|
16515
16424
|
name: "list",
|
|
16516
16425
|
description: "List available skills",
|
|
16517
16426
|
args: {
|
|
16518
|
-
space: (0,
|
|
16519
|
-
type: (0,
|
|
16427
|
+
space: (0, import_cmd_ts8.option)({
|
|
16428
|
+
type: (0, import_cmd_ts8.optional)(SpaceSlug),
|
|
16520
16429
|
long: "space",
|
|
16521
16430
|
description: "Filter skills by space slug"
|
|
16522
16431
|
})
|
|
@@ -16535,53 +16444,20 @@ var listSkillsCommand = (0, import_cmd_ts10.command)({
|
|
|
16535
16444
|
});
|
|
16536
16445
|
|
|
16537
16446
|
// apps/cli/src/infra/commands/SkillsCommand.ts
|
|
16538
|
-
var skillsCommand = (0,
|
|
16447
|
+
var skillsCommand = (0, import_cmd_ts9.subcommands)({
|
|
16539
16448
|
name: "skills",
|
|
16540
16449
|
description: "Manage skills in your Packmind organization",
|
|
16541
16450
|
cmds: {
|
|
16542
|
-
add: addSkillCommand,
|
|
16543
16451
|
init: installDefaultSkillsCommand,
|
|
16544
16452
|
list: listSkillsCommand
|
|
16545
16453
|
}
|
|
16546
16454
|
});
|
|
16547
16455
|
|
|
16548
16456
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
16549
|
-
var
|
|
16550
|
-
|
|
16551
|
-
// apps/cli/src/infra/commands/CreateStandardCommand.ts
|
|
16552
|
-
var import_cmd_ts12 = __toESM(require_cjs());
|
|
16553
|
-
var createStandardCommand = (0, import_cmd_ts12.command)({
|
|
16554
|
-
name: "create",
|
|
16555
|
-
description: "[Deprecated] Create a coding standard from a playbook JSON file or stdin",
|
|
16556
|
-
args: {
|
|
16557
|
-
file: (0, import_cmd_ts12.positional)({
|
|
16558
|
-
displayName: "file",
|
|
16559
|
-
description: "Path to the playbook JSON file (reads from stdin if omitted)",
|
|
16560
|
-
type: (0, import_cmd_ts12.optional)(import_cmd_ts12.string)
|
|
16561
|
-
}),
|
|
16562
|
-
space: (0, import_cmd_ts12.option)({
|
|
16563
|
-
long: "space",
|
|
16564
|
-
description: "Slug of the space in which to create the standard (with or without leading @)",
|
|
16565
|
-
type: (0, import_cmd_ts12.optional)(SpaceSlug)
|
|
16566
|
-
}),
|
|
16567
|
-
originSkill: originSkillOption
|
|
16568
|
-
},
|
|
16569
|
-
handler: async () => {
|
|
16570
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
16571
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
16572
|
-
packmindCliHexa.output.notifyError(
|
|
16573
|
-
'Command "packmind-cli standards create" has been removed.',
|
|
16574
|
-
{
|
|
16575
|
-
content: 'Use the "playbook add" command instead:',
|
|
16576
|
-
exampleCommand: "packmind-cli playbook add .packmind/standards/my-standard.md"
|
|
16577
|
-
}
|
|
16578
|
-
);
|
|
16579
|
-
process.exit(1);
|
|
16580
|
-
}
|
|
16581
|
-
});
|
|
16457
|
+
var import_cmd_ts11 = __toESM(require_cjs());
|
|
16582
16458
|
|
|
16583
16459
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
16584
|
-
var
|
|
16460
|
+
var import_cmd_ts10 = __toESM(require_cjs());
|
|
16585
16461
|
|
|
16586
16462
|
// apps/cli/src/infra/commands/standards/listStandardsHandler.ts
|
|
16587
16463
|
async function listStandardsHandler(args2, deps) {
|
|
@@ -16638,12 +16514,12 @@ ${availableSpaces}`
|
|
|
16638
16514
|
}
|
|
16639
16515
|
|
|
16640
16516
|
// apps/cli/src/infra/commands/ListStandardsCommand.ts
|
|
16641
|
-
var listStandardsCommand = (0,
|
|
16517
|
+
var listStandardsCommand = (0, import_cmd_ts10.command)({
|
|
16642
16518
|
name: "list",
|
|
16643
16519
|
description: "List available coding standards",
|
|
16644
16520
|
args: {
|
|
16645
|
-
space: (0,
|
|
16646
|
-
type: (0,
|
|
16521
|
+
space: (0, import_cmd_ts10.option)({
|
|
16522
|
+
type: (0, import_cmd_ts10.optional)(SpaceSlug),
|
|
16647
16523
|
long: "space",
|
|
16648
16524
|
description: "Filter standards by space slug"
|
|
16649
16525
|
})
|
|
@@ -16662,52 +16538,19 @@ var listStandardsCommand = (0, import_cmd_ts13.command)({
|
|
|
16662
16538
|
});
|
|
16663
16539
|
|
|
16664
16540
|
// apps/cli/src/infra/commands/StandardsCommand.ts
|
|
16665
|
-
var standardsCommand = (0,
|
|
16541
|
+
var standardsCommand = (0, import_cmd_ts11.subcommands)({
|
|
16666
16542
|
name: "standards",
|
|
16667
16543
|
description: "Manage coding standards",
|
|
16668
16544
|
cmds: {
|
|
16669
|
-
create: createStandardCommand,
|
|
16670
16545
|
list: listStandardsCommand
|
|
16671
16546
|
}
|
|
16672
16547
|
});
|
|
16673
16548
|
|
|
16674
16549
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
16675
|
-
var
|
|
16676
|
-
|
|
16677
|
-
// apps/cli/src/infra/commands/CreateCommandCommand.ts
|
|
16678
|
-
var import_cmd_ts15 = __toESM(require_cjs());
|
|
16679
|
-
var createCommandCommand = (0, import_cmd_ts15.command)({
|
|
16680
|
-
name: "create",
|
|
16681
|
-
description: "[Deprecated] Create a command from a playbook JSON file or stdin",
|
|
16682
|
-
args: {
|
|
16683
|
-
file: (0, import_cmd_ts15.positional)({
|
|
16684
|
-
displayName: "file",
|
|
16685
|
-
description: "Path to the command playbook JSON file (reads from stdin if omitted)",
|
|
16686
|
-
type: (0, import_cmd_ts15.optional)(import_cmd_ts15.string)
|
|
16687
|
-
}),
|
|
16688
|
-
space: (0, import_cmd_ts15.option)({
|
|
16689
|
-
long: "space",
|
|
16690
|
-
description: "Slug of the space in which to create the command",
|
|
16691
|
-
type: (0, import_cmd_ts15.optional)(SpaceSlug)
|
|
16692
|
-
}),
|
|
16693
|
-
originSkill: originSkillOption
|
|
16694
|
-
},
|
|
16695
|
-
handler: async () => {
|
|
16696
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
16697
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
16698
|
-
packmindCliHexa.output.notifyError(
|
|
16699
|
-
'Command "packmind-cli commands create" has been removed.',
|
|
16700
|
-
{
|
|
16701
|
-
content: 'Use the "playbook add" command instead:',
|
|
16702
|
-
exampleCommand: "packmind-cli playbook add .packmind/commands/my-command.md"
|
|
16703
|
-
}
|
|
16704
|
-
);
|
|
16705
|
-
process.exit(1);
|
|
16706
|
-
}
|
|
16707
|
-
});
|
|
16550
|
+
var import_cmd_ts13 = __toESM(require_cjs());
|
|
16708
16551
|
|
|
16709
16552
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
16710
|
-
var
|
|
16553
|
+
var import_cmd_ts12 = __toESM(require_cjs());
|
|
16711
16554
|
|
|
16712
16555
|
// apps/cli/src/infra/commands/commands/listCommandsHandler.ts
|
|
16713
16556
|
async function listCommandsHandler(args2, deps) {
|
|
@@ -16763,12 +16606,12 @@ ${availableSpaces}`
|
|
|
16763
16606
|
}
|
|
16764
16607
|
|
|
16765
16608
|
// apps/cli/src/infra/commands/ListCommandsCommand.ts
|
|
16766
|
-
var listCommandsCommand = (0,
|
|
16609
|
+
var listCommandsCommand = (0, import_cmd_ts12.command)({
|
|
16767
16610
|
name: "list",
|
|
16768
16611
|
description: "List available commands",
|
|
16769
16612
|
args: {
|
|
16770
|
-
space: (0,
|
|
16771
|
-
type: (0,
|
|
16613
|
+
space: (0, import_cmd_ts12.option)({
|
|
16614
|
+
type: (0, import_cmd_ts12.optional)(SpaceSlug),
|
|
16772
16615
|
long: "space",
|
|
16773
16616
|
description: "Filter commands by space slug"
|
|
16774
16617
|
})
|
|
@@ -16785,618 +16628,105 @@ var listCommandsCommand = (0, import_cmd_ts16.command)({
|
|
|
16785
16628
|
});
|
|
16786
16629
|
|
|
16787
16630
|
// apps/cli/src/infra/commands/CommandsCommand.ts
|
|
16788
|
-
var commandsCommand = (0,
|
|
16631
|
+
var commandsCommand = (0, import_cmd_ts13.subcommands)({
|
|
16789
16632
|
name: "commands",
|
|
16790
16633
|
description: "Manage commands",
|
|
16791
16634
|
cmds: {
|
|
16792
|
-
create: createCommandCommand,
|
|
16793
16635
|
list: listCommandsCommand
|
|
16794
16636
|
}
|
|
16795
16637
|
});
|
|
16796
16638
|
|
|
16797
|
-
// apps/cli/src/infra/commands/
|
|
16798
|
-
var
|
|
16639
|
+
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
16640
|
+
var import_cmd_ts19 = __toESM(require_cjs());
|
|
16799
16641
|
|
|
16800
|
-
// apps/cli/src/infra/commands/
|
|
16801
|
-
var
|
|
16802
|
-
var fs24 = __toESM(require("fs/promises"));
|
|
16642
|
+
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
16643
|
+
var import_cmd_ts15 = __toESM(require_cjs());
|
|
16803
16644
|
|
|
16804
|
-
// apps/cli/src/infra/
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
|
|
16810
|
-
|
|
16811
|
-
|
|
16812
|
-
|
|
16813
|
-
|
|
16814
|
-
|
|
16815
|
-
|
|
16816
|
-
|
|
16817
|
-
|
|
16818
|
-
|
|
16819
|
-
|
|
16645
|
+
// apps/cli/src/infra/commands/packages/createPackageHandler.ts
|
|
16646
|
+
function toExpectedSlug(name) {
|
|
16647
|
+
return name.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
16648
|
+
}
|
|
16649
|
+
function buildWebappUrl(host, orgSlug, spaceSlug, packageId) {
|
|
16650
|
+
return `${host}/org/${orgSlug}/space/${spaceSlug}/packages/${packageId}`;
|
|
16651
|
+
}
|
|
16652
|
+
async function createPackageHandler(name, description, useCase, originSkill, spaceSlug) {
|
|
16653
|
+
const trimmedName = name.trim();
|
|
16654
|
+
if (!trimmedName) {
|
|
16655
|
+
return { success: false, error: "Package name is required" };
|
|
16656
|
+
}
|
|
16657
|
+
try {
|
|
16658
|
+
const result = await useCase.execute({
|
|
16659
|
+
name: trimmedName,
|
|
16660
|
+
description,
|
|
16661
|
+
originSkill,
|
|
16662
|
+
spaceSlug
|
|
16663
|
+
});
|
|
16664
|
+
let webappUrl;
|
|
16665
|
+
const apiKey = loadApiKey();
|
|
16666
|
+
if (apiKey) {
|
|
16667
|
+
const decoded = decodeApiKey(apiKey);
|
|
16668
|
+
if (decoded?.host && decoded?.jwt?.organization?.slug) {
|
|
16669
|
+
webappUrl = buildWebappUrl(
|
|
16670
|
+
decoded.host,
|
|
16671
|
+
decoded.jwt.organization.slug,
|
|
16672
|
+
result.spaceSlug,
|
|
16673
|
+
result.packageId
|
|
16674
|
+
);
|
|
16820
16675
|
}
|
|
16821
16676
|
}
|
|
16677
|
+
const deduplicated = result.slug !== toExpectedSlug(trimmedName);
|
|
16678
|
+
return {
|
|
16679
|
+
success: true,
|
|
16680
|
+
slug: `@${result.spaceSlug}/${result.slug}`,
|
|
16681
|
+
packageName: result.name,
|
|
16682
|
+
packageId: result.packageId,
|
|
16683
|
+
webappUrl,
|
|
16684
|
+
deduplicated
|
|
16685
|
+
};
|
|
16686
|
+
} catch (e) {
|
|
16687
|
+
return {
|
|
16688
|
+
success: false,
|
|
16689
|
+
error: e instanceof Error ? e.message : "Unknown error"
|
|
16690
|
+
};
|
|
16822
16691
|
}
|
|
16823
|
-
return {
|
|
16824
|
-
lines,
|
|
16825
|
-
hasChanges: lines.length > 0
|
|
16826
|
-
};
|
|
16827
16692
|
}
|
|
16828
16693
|
|
|
16829
|
-
// apps/cli/src/
|
|
16830
|
-
|
|
16831
|
-
|
|
16832
|
-
|
|
16833
|
-
|
|
16834
|
-
lines.push({ type: "removed", text: `${displayKey}: ${oldValue}` });
|
|
16694
|
+
// apps/cli/src/application/useCases/CreatePackageUseCase.ts
|
|
16695
|
+
var CreatePackageUseCase = class {
|
|
16696
|
+
constructor(gateway, spaceService) {
|
|
16697
|
+
this.gateway = gateway;
|
|
16698
|
+
this.spaceService = spaceService;
|
|
16835
16699
|
}
|
|
16836
|
-
|
|
16837
|
-
|
|
16700
|
+
async execute(command30) {
|
|
16701
|
+
const space = await this.getSpace(command30);
|
|
16702
|
+
const result = await this.gateway.packages.create({
|
|
16703
|
+
spaceId: space.id,
|
|
16704
|
+
name: command30.name,
|
|
16705
|
+
description: command30.description ?? "",
|
|
16706
|
+
recipeIds: [],
|
|
16707
|
+
standardIds: [],
|
|
16708
|
+
originSkill: command30.originSkill
|
|
16709
|
+
});
|
|
16710
|
+
return {
|
|
16711
|
+
packageId: result.package.id,
|
|
16712
|
+
name: result.package.name,
|
|
16713
|
+
slug: result.package.slug,
|
|
16714
|
+
spaceSlug: space.slug
|
|
16715
|
+
};
|
|
16838
16716
|
}
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
|
|
16843
|
-
|
|
16844
|
-
|
|
16845
|
-
|
|
16846
|
-
|
|
16847
|
-
|
|
16848
|
-
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
const key = JSON.stringify({ type: diff.type, payload: diff.payload });
|
|
16853
|
-
const group = groups.get(key) ?? [];
|
|
16854
|
-
group.push(diff);
|
|
16855
|
-
groups.set(key, group);
|
|
16856
|
-
}
|
|
16857
|
-
return Array.from(groups.values());
|
|
16858
|
-
}
|
|
16859
|
-
function groupDiffsByArtefact(diffs) {
|
|
16860
|
-
const groups = /* @__PURE__ */ new Map();
|
|
16861
|
-
for (const diff of diffs) {
|
|
16862
|
-
const key = `${diff.artifactType}:${diff.artifactName}`;
|
|
16863
|
-
const group = groups.get(key) ?? [];
|
|
16864
|
-
group.push(diff);
|
|
16865
|
-
groups.set(key, group);
|
|
16866
|
-
}
|
|
16867
|
-
return groups;
|
|
16868
|
-
}
|
|
16869
|
-
function formatDiffPayload(diff, log) {
|
|
16870
|
-
const payload = diff.payload;
|
|
16871
|
-
if (diff.type === "addSkillFile" /* addSkillFile */) {
|
|
16872
|
-
const item = payload.item;
|
|
16873
|
-
if (item.isBase64) {
|
|
16874
|
-
log(source_default.green(" + [binary file]"));
|
|
16875
|
-
} else {
|
|
16876
|
-
for (const line of item.content.split("\n")) {
|
|
16877
|
-
log(source_default.green(` + ${line}`));
|
|
16878
|
-
}
|
|
16879
|
-
}
|
|
16880
|
-
return;
|
|
16881
|
-
}
|
|
16882
|
-
if (diff.type === "deleteSkillFile" /* deleteSkillFile */) {
|
|
16883
|
-
const item = payload.item;
|
|
16884
|
-
if (item.isBase64) {
|
|
16885
|
-
log(source_default.red(" - [binary file]"));
|
|
16886
|
-
} else {
|
|
16887
|
-
const lines2 = item.content.split("\n");
|
|
16888
|
-
const MAX_DELETED_LINES = 3;
|
|
16889
|
-
const preview = lines2.slice(0, MAX_DELETED_LINES);
|
|
16890
|
-
for (const line of preview) {
|
|
16891
|
-
log(source_default.red(` - ${line}`));
|
|
16892
|
-
}
|
|
16893
|
-
if (lines2.length > MAX_DELETED_LINES) {
|
|
16894
|
-
const remaining = lines2.length - MAX_DELETED_LINES;
|
|
16895
|
-
log(source_default.red(` ... and ${remaining} more lines deleted`));
|
|
16896
|
-
}
|
|
16897
|
-
}
|
|
16898
|
-
return;
|
|
16899
|
-
}
|
|
16900
|
-
if (diff.type === "updateSkillFileContent" /* updateSkillFileContent */) {
|
|
16901
|
-
const typedPayload = payload;
|
|
16902
|
-
if (typedPayload.isBase64) {
|
|
16903
|
-
log(source_default.green(" ~ [binary content changed]"));
|
|
16904
|
-
return;
|
|
16905
|
-
}
|
|
16906
|
-
}
|
|
16907
|
-
if (diff.type === "addRule" /* addRule */) {
|
|
16908
|
-
const item = payload.item;
|
|
16909
|
-
log(source_default.green(` + ${item.content}`));
|
|
16910
|
-
return;
|
|
16911
|
-
}
|
|
16912
|
-
if (diff.type === "deleteRule" /* deleteRule */) {
|
|
16913
|
-
const item = payload.item;
|
|
16914
|
-
log(source_default.red(` - ${item.content}`));
|
|
16915
|
-
return;
|
|
16916
|
-
}
|
|
16917
|
-
if (diff.type === "updateSkillAdditionalProperty" /* updateSkillAdditionalProperty */) {
|
|
16918
|
-
const lines2 = formatAdditionalPropertyDiff(
|
|
16919
|
-
payload.targetId,
|
|
16920
|
-
payload.oldValue,
|
|
16921
|
-
payload.newValue
|
|
16922
|
-
);
|
|
16923
|
-
for (const line of lines2) {
|
|
16924
|
-
log(
|
|
16925
|
-
line.type === "removed" ? source_default.red(` - ${line.text}`) : source_default.green(` + ${line.text}`)
|
|
16926
|
-
);
|
|
16927
|
-
}
|
|
16928
|
-
return;
|
|
16929
|
-
}
|
|
16930
|
-
const oldValue = payload.oldValue;
|
|
16931
|
-
const newValue = payload.newValue;
|
|
16932
|
-
const { lines } = formatContentDiff(oldValue, newValue);
|
|
16933
|
-
for (const line of lines) {
|
|
16934
|
-
log(line);
|
|
16935
|
-
}
|
|
16936
|
-
}
|
|
16937
|
-
function formatSubmittedDate(isoDate) {
|
|
16938
|
-
const date = new Date(isoDate);
|
|
16939
|
-
const datePart = date.toLocaleDateString("en-US", {
|
|
16940
|
-
year: "numeric",
|
|
16941
|
-
month: "short",
|
|
16942
|
-
day: "numeric"
|
|
16943
|
-
});
|
|
16944
|
-
const timePart = date.toLocaleTimeString("en-US", {
|
|
16945
|
-
hour: "numeric",
|
|
16946
|
-
minute: "2-digit",
|
|
16947
|
-
hour12: true
|
|
16948
|
-
});
|
|
16949
|
-
return `${datePart} ${timePart}`;
|
|
16950
|
-
}
|
|
16951
|
-
function buildSubmittedFooter(submittedDiffs) {
|
|
16952
|
-
const proposalCount = submittedDiffs.length;
|
|
16953
|
-
const proposalWord = proposalCount === 1 ? "change proposal" : "change proposals";
|
|
16954
|
-
return `${proposalCount} ${proposalWord} ignored, run \`packmind-cli diff --include-submitted\` to see what's waiting for validation`;
|
|
16955
|
-
}
|
|
16956
|
-
async function findTargetDirectories(searchPath, packmindCliHexa) {
|
|
16957
|
-
const targets = [];
|
|
16958
|
-
const exists = await packmindCliHexa.configExists(searchPath);
|
|
16959
|
-
if (exists) {
|
|
16960
|
-
targets.push(searchPath);
|
|
16961
|
-
}
|
|
16962
|
-
const descendants = await packmindCliHexa.findDescendantConfigs(searchPath);
|
|
16963
|
-
for (const dir of descendants) {
|
|
16964
|
-
if (!targets.includes(dir)) {
|
|
16965
|
-
targets.push(dir);
|
|
16966
|
-
}
|
|
16967
|
-
}
|
|
16968
|
-
if (targets.length === 0) {
|
|
16969
|
-
let currentDir = nodePath.dirname(searchPath);
|
|
16970
|
-
while (true) {
|
|
16971
|
-
const ancestorExists = await packmindCliHexa.configExists(currentDir);
|
|
16972
|
-
if (ancestorExists) {
|
|
16973
|
-
targets.push(currentDir);
|
|
16974
|
-
break;
|
|
16975
|
-
}
|
|
16976
|
-
const parentDir = nodePath.dirname(currentDir);
|
|
16977
|
-
if (parentDir === currentDir) {
|
|
16978
|
-
break;
|
|
16979
|
-
}
|
|
16980
|
-
currentDir = parentDir;
|
|
16981
|
-
}
|
|
16982
|
-
}
|
|
16983
|
-
return targets;
|
|
16984
|
-
}
|
|
16985
|
-
function computeRelativePath(targetAbsDir, gitRoot) {
|
|
16986
|
-
const rel = nodePath.relative(gitRoot, targetAbsDir);
|
|
16987
|
-
if (rel.startsWith("..")) return "/";
|
|
16988
|
-
return rel ? `/${rel}/` : "/";
|
|
16989
|
-
}
|
|
16990
|
-
async function collectGitInfo(deps) {
|
|
16991
|
-
const { packmindCliHexa, exit, getCwd } = deps;
|
|
16992
|
-
const cwd = getCwd();
|
|
16993
|
-
let gitRemoteUrl;
|
|
16994
|
-
let gitBranch;
|
|
16995
|
-
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
16996
|
-
if (gitRoot) {
|
|
16997
|
-
try {
|
|
16998
|
-
gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
16999
|
-
gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
17000
|
-
} catch (err) {
|
|
17001
|
-
logWarningConsole(
|
|
17002
|
-
`Failed to collect git info: ${err instanceof Error ? err.message : String(err)}`
|
|
17003
|
-
);
|
|
17004
|
-
}
|
|
17005
|
-
}
|
|
17006
|
-
if (!gitRemoteUrl || !gitBranch || !gitRoot) {
|
|
17007
|
-
logErrorConsole(
|
|
17008
|
-
"Could not determine git repository info. The diff command requires a git repository with a remote configured."
|
|
17009
|
-
);
|
|
17010
|
-
exit(1);
|
|
17011
|
-
return null;
|
|
17012
|
-
}
|
|
17013
|
-
return { gitRemoteUrl, gitBranch, gitRoot };
|
|
17014
|
-
}
|
|
17015
|
-
function extractUniqueAndSortedArtefacts(groups) {
|
|
17016
|
-
const typeSortOrder = {
|
|
17017
|
-
command: 0,
|
|
17018
|
-
skill: 1,
|
|
17019
|
-
standard: 2
|
|
17020
|
-
};
|
|
17021
|
-
const uniqueArtefacts = /* @__PURE__ */ new Map();
|
|
17022
|
-
for (const [key, groupDiffs] of groups) {
|
|
17023
|
-
if (!uniqueArtefacts.has(key)) {
|
|
17024
|
-
uniqueArtefacts.set(key, {
|
|
17025
|
-
type: groupDiffs[0].artifactType,
|
|
17026
|
-
name: groupDiffs[0].artifactName
|
|
17027
|
-
});
|
|
17028
|
-
}
|
|
17029
|
-
}
|
|
17030
|
-
const sortedArtefacts = Array.from(uniqueArtefacts.values()).sort(
|
|
17031
|
-
(a, b) => typeSortOrder[a.type] - typeSortOrder[b.type] || a.name.localeCompare(b.name, void 0, { sensitivity: "base" })
|
|
17032
|
-
);
|
|
17033
|
-
return sortedArtefacts;
|
|
17034
|
-
}
|
|
17035
|
-
function displayDiffs(params) {
|
|
17036
|
-
const {
|
|
17037
|
-
diffsToDisplay,
|
|
17038
|
-
displayPathMap,
|
|
17039
|
-
submittedLookup,
|
|
17040
|
-
includeSubmitted,
|
|
17041
|
-
unsubmittedItems,
|
|
17042
|
-
submittedItems,
|
|
17043
|
-
log
|
|
17044
|
-
} = params;
|
|
17045
|
-
log(formatHeader(`
|
|
17046
|
-
Changes found:
|
|
17047
|
-
`));
|
|
17048
|
-
const groups = groupDiffsByArtefact(diffsToDisplay);
|
|
17049
|
-
for (const [, groupDiffs] of groups) {
|
|
17050
|
-
const { artifactType, artifactName } = groupDiffs[0];
|
|
17051
|
-
const typeLabel = ARTIFACT_TYPE_LABELS[artifactType];
|
|
17052
|
-
log(formatBold(`${typeLabel} "${artifactName}"`));
|
|
17053
|
-
const subGroups = subGroupByChangeContent(groupDiffs);
|
|
17054
|
-
for (const subGroup of subGroups) {
|
|
17055
|
-
for (const diff of subGroup) {
|
|
17056
|
-
log(` ${formatFilePath(displayPathMap.get(diff) ?? diff.filePath)}`);
|
|
17057
|
-
}
|
|
17058
|
-
const label = CHANGE_PROPOSAL_TYPE_LABELS[subGroup[0].type] ?? "content changed";
|
|
17059
|
-
const checkItem = submittedLookup.get(subGroup[0]);
|
|
17060
|
-
if (includeSubmitted && checkItem?.exists && checkItem.createdAt) {
|
|
17061
|
-
const dateStr = formatSubmittedDate(checkItem.createdAt);
|
|
17062
|
-
const messageSuffix = checkItem.message ? ` "${checkItem.message.length > 50 ? checkItem.message.slice(0, 50) + "..." : checkItem.message}"` : "";
|
|
17063
|
-
log(
|
|
17064
|
-
` - ${label} ${source_default.dim(`[already submitted on ${dateStr}${messageSuffix}]`)}`
|
|
17065
|
-
);
|
|
17066
|
-
} else {
|
|
17067
|
-
log(` - ${label}`);
|
|
17068
|
-
}
|
|
17069
|
-
formatDiffPayload(subGroup[0], log);
|
|
17070
|
-
}
|
|
17071
|
-
log("");
|
|
17072
|
-
}
|
|
17073
|
-
const changeCount = diffsToDisplay.length;
|
|
17074
|
-
const changeWord = changeCount === 1 ? "change" : "changes";
|
|
17075
|
-
const sortedArtefacts = extractUniqueAndSortedArtefacts(groups);
|
|
17076
|
-
const artefactCount = sortedArtefacts.length;
|
|
17077
|
-
const artefactWord = artefactCount === 1 ? "artefact" : "artefacts";
|
|
17078
|
-
const allSubmittedSuffix = includeSubmitted && unsubmittedItems.length === 0 ? " (all already submitted)" : "";
|
|
17079
|
-
logWarningConsole(
|
|
17080
|
-
`Summary: ${changeCount} ${changeWord} found on ${artefactCount} ${artefactWord}${allSubmittedSuffix}:`
|
|
17081
|
-
);
|
|
17082
|
-
for (const artefact of sortedArtefacts) {
|
|
17083
|
-
const typeLabel = ARTIFACT_TYPE_LABELS[artefact.type];
|
|
17084
|
-
const key = `${artefact.type}:${artefact.name}`;
|
|
17085
|
-
const artefactDiffs = groups.get(key) ?? [];
|
|
17086
|
-
const allDiffsSubmitted = includeSubmitted && artefactDiffs.length > 0 && artefactDiffs.every((d) => submittedLookup.get(d)?.exists);
|
|
17087
|
-
const suffix = allDiffsSubmitted ? " (all already submitted)" : "";
|
|
17088
|
-
logWarningConsole(`* ${typeLabel} "${artefact.name}"${suffix}`);
|
|
17089
|
-
}
|
|
17090
|
-
if (!includeSubmitted && submittedItems.length > 0) {
|
|
17091
|
-
logInfoConsole(buildSubmittedFooter(submittedItems));
|
|
17092
|
-
}
|
|
17093
|
-
return changeCount;
|
|
17094
|
-
}
|
|
17095
|
-
async function diffArtefactsHandler(deps) {
|
|
17096
|
-
const { packmindCliHexa, exit, getCwd, log, includeSubmitted } = deps;
|
|
17097
|
-
const cwd = getCwd();
|
|
17098
|
-
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
17099
|
-
if (deps.path !== void 0) {
|
|
17100
|
-
try {
|
|
17101
|
-
await fs24.stat(searchPath);
|
|
17102
|
-
} catch {
|
|
17103
|
-
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
17104
|
-
exit(1);
|
|
17105
|
-
return { diffsFound: 0 };
|
|
17106
|
-
}
|
|
17107
|
-
}
|
|
17108
|
-
let targetDirs;
|
|
17109
|
-
try {
|
|
17110
|
-
targetDirs = await findTargetDirectories(searchPath, packmindCliHexa);
|
|
17111
|
-
} catch (err) {
|
|
17112
|
-
logErrorConsole(
|
|
17113
|
-
`Failed to discover target directories: ${err instanceof Error ? err.message : String(err)}`
|
|
17114
|
-
);
|
|
17115
|
-
exit(1);
|
|
17116
|
-
return { diffsFound: 0 };
|
|
17117
|
-
}
|
|
17118
|
-
if (targetDirs.length === 0) {
|
|
17119
|
-
const hierarchicalConfig = await packmindCliHexa.readHierarchicalConfig(
|
|
17120
|
-
cwd,
|
|
17121
|
-
null
|
|
17122
|
-
);
|
|
17123
|
-
if (!hierarchicalConfig.hasConfigs) {
|
|
17124
|
-
logErrorConsole(
|
|
17125
|
-
"Not inside a Packmind project. No packmind.json found in the current directory or any parent directory."
|
|
17126
|
-
);
|
|
17127
|
-
exit(1);
|
|
17128
|
-
} else {
|
|
17129
|
-
log("No Packmind targets found under the current directory.");
|
|
17130
|
-
exit(0);
|
|
17131
|
-
}
|
|
17132
|
-
return { diffsFound: 0 };
|
|
17133
|
-
}
|
|
17134
|
-
try {
|
|
17135
|
-
const gitInfo = await collectGitInfo(deps);
|
|
17136
|
-
if (!gitInfo) {
|
|
17137
|
-
return { diffsFound: 0 };
|
|
17138
|
-
}
|
|
17139
|
-
const { gitRemoteUrl, gitBranch, gitRoot } = gitInfo;
|
|
17140
|
-
const targetResults = [];
|
|
17141
|
-
for (const targetDir of targetDirs) {
|
|
17142
|
-
const config = await packmindCliHexa.readFullConfig(targetDir);
|
|
17143
|
-
if (!config) continue;
|
|
17144
|
-
const configPackages = Object.keys(config.packages);
|
|
17145
|
-
if (configPackages.length === 0) continue;
|
|
17146
|
-
const relativePath = computeRelativePath(targetDir, gitRoot);
|
|
17147
|
-
const targetRelativePath = nodePath.relative(cwd, targetDir);
|
|
17148
|
-
if (targetDirs.length > 1) {
|
|
17149
|
-
log("");
|
|
17150
|
-
logInfoConsole(`Target: ${targetRelativePath}`);
|
|
17151
|
-
}
|
|
17152
|
-
const packageCount = configPackages.length;
|
|
17153
|
-
const packageWord = packageCount === 1 ? "package" : "packages";
|
|
17154
|
-
logInfoConsole(
|
|
17155
|
-
`Comparing ${packageCount} ${packageWord}: ${configPackages.join(", ")}...`
|
|
17156
|
-
);
|
|
17157
|
-
const diffs = await packmindCliHexa.diffArtefacts({
|
|
17158
|
-
baseDirectory: targetDir,
|
|
17159
|
-
packagesSlugs: configPackages,
|
|
17160
|
-
gitRemoteUrl,
|
|
17161
|
-
gitBranch,
|
|
17162
|
-
relativePath,
|
|
17163
|
-
agents: config.agents
|
|
17164
|
-
});
|
|
17165
|
-
const filterPrefix = nodePath.relative(targetDir, searchPath);
|
|
17166
|
-
const filteredDiffs = filterPrefix !== "" && !filterPrefix.startsWith("..") ? diffs.filter(
|
|
17167
|
-
(d) => d.filePath === filterPrefix || d.filePath.startsWith(filterPrefix + "/")
|
|
17168
|
-
) : diffs;
|
|
17169
|
-
targetResults.push({ targetRelativePath, diffs: filteredDiffs });
|
|
17170
|
-
}
|
|
17171
|
-
if (targetResults.length === 0) {
|
|
17172
|
-
log("No packages configured in any target.");
|
|
17173
|
-
exit(0);
|
|
17174
|
-
return { diffsFound: 0 };
|
|
17175
|
-
}
|
|
17176
|
-
const displayPathMap = /* @__PURE__ */ new Map();
|
|
17177
|
-
for (const { targetRelativePath, diffs } of targetResults) {
|
|
17178
|
-
for (const diff of diffs) {
|
|
17179
|
-
displayPathMap.set(
|
|
17180
|
-
diff,
|
|
17181
|
-
targetRelativePath ? `${targetRelativePath}/${diff.filePath}` : diff.filePath
|
|
17182
|
-
);
|
|
17183
|
-
}
|
|
17184
|
-
}
|
|
17185
|
-
const allDiffs = targetResults.flatMap((r) => r.diffs);
|
|
17186
|
-
if (allDiffs.length === 0) {
|
|
17187
|
-
log("No changes found.");
|
|
17188
|
-
exit(0);
|
|
17189
|
-
return { diffsFound: 0 };
|
|
17190
|
-
}
|
|
17191
|
-
const allGroupedDiffs = Array.from(groupDiffsByArtefact(allDiffs).values());
|
|
17192
|
-
const checkResult = await packmindCliHexa.checkDiffs(allGroupedDiffs);
|
|
17193
|
-
const submittedItems = checkResult.results.filter((r) => r.exists);
|
|
17194
|
-
const unsubmittedItems = checkResult.results.filter((r) => !r.exists);
|
|
17195
|
-
const diffsToDisplay = includeSubmitted ? allDiffs : unsubmittedItems.map((r) => r.diff);
|
|
17196
|
-
const submittedLookup = /* @__PURE__ */ new Map();
|
|
17197
|
-
for (const item of checkResult.results) {
|
|
17198
|
-
submittedLookup.set(item.diff, item);
|
|
17199
|
-
}
|
|
17200
|
-
if (diffsToDisplay.length === 0) {
|
|
17201
|
-
log("No new changes found.");
|
|
17202
|
-
if (submittedItems.length > 0) {
|
|
17203
|
-
logInfoConsole(buildSubmittedFooter(submittedItems));
|
|
17204
|
-
}
|
|
17205
|
-
exit(0);
|
|
17206
|
-
return { diffsFound: 0 };
|
|
17207
|
-
}
|
|
17208
|
-
const changeCount = displayDiffs({
|
|
17209
|
-
diffsToDisplay,
|
|
17210
|
-
displayPathMap,
|
|
17211
|
-
submittedLookup,
|
|
17212
|
-
includeSubmitted,
|
|
17213
|
-
unsubmittedItems,
|
|
17214
|
-
submittedItems,
|
|
17215
|
-
log
|
|
17216
|
-
});
|
|
17217
|
-
exit(0);
|
|
17218
|
-
return { diffsFound: changeCount };
|
|
17219
|
-
} catch (err) {
|
|
17220
|
-
if (err instanceof Error) {
|
|
17221
|
-
logErrorConsole(err.message);
|
|
17222
|
-
} else {
|
|
17223
|
-
logErrorConsole(String(err));
|
|
17224
|
-
}
|
|
17225
|
-
exit(1);
|
|
17226
|
-
return { diffsFound: 0 };
|
|
17227
|
-
}
|
|
17228
|
-
}
|
|
17229
|
-
|
|
17230
|
-
// apps/cli/src/infra/commands/DiffCommand.ts
|
|
17231
|
-
var diffCommand = (0, import_cmd_ts18.command)({
|
|
17232
|
-
name: "diff",
|
|
17233
|
-
description: "[Deprecated] Use `playbook diff` commands instead. Run for migration guidance",
|
|
17234
|
-
args: {
|
|
17235
|
-
submit: (0, import_cmd_ts18.flag)({
|
|
17236
|
-
long: "submit",
|
|
17237
|
-
description: "Submit detected changes as change proposals"
|
|
17238
|
-
}),
|
|
17239
|
-
includeSubmitted: (0, import_cmd_ts18.flag)({
|
|
17240
|
-
long: "include-submitted",
|
|
17241
|
-
description: "Include already submitted changes in the output"
|
|
17242
|
-
}),
|
|
17243
|
-
message: (0, import_cmd_ts18.option)({
|
|
17244
|
-
long: "message",
|
|
17245
|
-
short: "m",
|
|
17246
|
-
description: "Message describing the intent behind the changes (max 1024 chars)",
|
|
17247
|
-
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
17248
|
-
}),
|
|
17249
|
-
path: (0, import_cmd_ts18.option)({
|
|
17250
|
-
long: "path",
|
|
17251
|
-
short: "p",
|
|
17252
|
-
description: "Path to analyze (relative to current directory)",
|
|
17253
|
-
type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
|
|
17254
|
-
}),
|
|
17255
|
-
positionals: (0, import_cmd_ts18.restPositionals)({
|
|
17256
|
-
type: import_cmd_ts18.string,
|
|
17257
|
-
displayName: "args",
|
|
17258
|
-
description: "Subcommand and arguments (e.g., add <path>, remove <path>)"
|
|
17259
|
-
})
|
|
17260
|
-
},
|
|
17261
|
-
handler: async ({ submit, includeSubmitted, message, path: path37, positionals }) => {
|
|
17262
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
17263
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
17264
|
-
if (submit) {
|
|
17265
|
-
logErrorConsole(
|
|
17266
|
-
"Deprecated: `packmind-cli diff --submit` has been removed"
|
|
17267
|
-
);
|
|
17268
|
-
logInfoConsole("Use the following command instead:");
|
|
17269
|
-
let submitCommand = `packmind-cli playbook submit`;
|
|
17270
|
-
if (message) {
|
|
17271
|
-
submitCommand = `${submitCommand} -m "${message}"`;
|
|
17272
|
-
}
|
|
17273
|
-
logInfoConsole(` ${formatCommand(submitCommand)}`);
|
|
17274
|
-
process.exit(1);
|
|
17275
|
-
}
|
|
17276
|
-
if (positionals[0] === "add") {
|
|
17277
|
-
const addFilePath = path37 && positionals[1] ? `${path37}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
17278
|
-
const addCommand = `packmind-cli playbook add ${addFilePath}`;
|
|
17279
|
-
logErrorConsole("Deprecated: `packmind-cli diff add` has been removed");
|
|
17280
|
-
logInfoConsole("Use the following command instead:");
|
|
17281
|
-
logInfoConsole(` ${formatCommand(addCommand)}`);
|
|
17282
|
-
process.exit(1);
|
|
17283
|
-
}
|
|
17284
|
-
if (positionals[0] === "remove" || positionals[0] === "rm") {
|
|
17285
|
-
const removeFilePath = path37 && positionals[1] ? `${path37}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
|
|
17286
|
-
const removeCommand = `packmind-cli playbook remove ${removeFilePath}`;
|
|
17287
|
-
logErrorConsole(
|
|
17288
|
-
"Deprecated: `packmind-cli diff remove` has been removed"
|
|
17289
|
-
);
|
|
17290
|
-
logInfoConsole("Use the following command instead:");
|
|
17291
|
-
logInfoConsole(` ${formatCommand(removeCommand)}`);
|
|
17292
|
-
process.exit(1);
|
|
17293
|
-
}
|
|
17294
|
-
const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${path37 ? ` --path ${path37}` : ""}`;
|
|
17295
|
-
logErrorConsole("Deprecated: `packmind-cli diff` will be removed");
|
|
17296
|
-
logInfoConsole("Use the following command instead:");
|
|
17297
|
-
logInfoConsole(` ${formatCommand(diffCommand3)}`);
|
|
17298
|
-
await diffArtefactsHandler({
|
|
17299
|
-
packmindCliHexa,
|
|
17300
|
-
exit: process.exit,
|
|
17301
|
-
getCwd: () => process.cwd(),
|
|
17302
|
-
log: console.log,
|
|
17303
|
-
includeSubmitted,
|
|
17304
|
-
path: path37
|
|
17305
|
-
});
|
|
17306
|
-
}
|
|
17307
|
-
});
|
|
17308
|
-
|
|
17309
|
-
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
17310
|
-
var import_cmd_ts23 = __toESM(require_cjs());
|
|
17311
|
-
|
|
17312
|
-
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
17313
|
-
var import_cmd_ts19 = __toESM(require_cjs());
|
|
17314
|
-
|
|
17315
|
-
// apps/cli/src/infra/commands/packages/createPackageHandler.ts
|
|
17316
|
-
function toExpectedSlug(name) {
|
|
17317
|
-
return name.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
17318
|
-
}
|
|
17319
|
-
function buildWebappUrl(host, orgSlug, spaceSlug, packageId) {
|
|
17320
|
-
return `${host}/org/${orgSlug}/space/${spaceSlug}/packages/${packageId}`;
|
|
17321
|
-
}
|
|
17322
|
-
async function createPackageHandler(name, description, useCase, originSkill, spaceSlug) {
|
|
17323
|
-
const trimmedName = name.trim();
|
|
17324
|
-
if (!trimmedName) {
|
|
17325
|
-
return { success: false, error: "Package name is required" };
|
|
17326
|
-
}
|
|
17327
|
-
try {
|
|
17328
|
-
const result = await useCase.execute({
|
|
17329
|
-
name: trimmedName,
|
|
17330
|
-
description,
|
|
17331
|
-
originSkill,
|
|
17332
|
-
spaceSlug
|
|
17333
|
-
});
|
|
17334
|
-
let webappUrl;
|
|
17335
|
-
const apiKey = loadApiKey();
|
|
17336
|
-
if (apiKey) {
|
|
17337
|
-
const decoded = decodeApiKey(apiKey);
|
|
17338
|
-
if (decoded?.host && decoded?.jwt?.organization?.slug) {
|
|
17339
|
-
webappUrl = buildWebappUrl(
|
|
17340
|
-
decoded.host,
|
|
17341
|
-
decoded.jwt.organization.slug,
|
|
17342
|
-
result.spaceSlug,
|
|
17343
|
-
result.packageId
|
|
17344
|
-
);
|
|
17345
|
-
}
|
|
17346
|
-
}
|
|
17347
|
-
const deduplicated = result.slug !== toExpectedSlug(trimmedName);
|
|
17348
|
-
return {
|
|
17349
|
-
success: true,
|
|
17350
|
-
slug: `@${result.spaceSlug}/${result.slug}`,
|
|
17351
|
-
packageName: result.name,
|
|
17352
|
-
packageId: result.packageId,
|
|
17353
|
-
webappUrl,
|
|
17354
|
-
deduplicated
|
|
17355
|
-
};
|
|
17356
|
-
} catch (e) {
|
|
17357
|
-
return {
|
|
17358
|
-
success: false,
|
|
17359
|
-
error: e instanceof Error ? e.message : "Unknown error"
|
|
17360
|
-
};
|
|
17361
|
-
}
|
|
17362
|
-
}
|
|
17363
|
-
|
|
17364
|
-
// apps/cli/src/application/useCases/CreatePackageUseCase.ts
|
|
17365
|
-
var CreatePackageUseCase = class {
|
|
17366
|
-
constructor(gateway, spaceService) {
|
|
17367
|
-
this.gateway = gateway;
|
|
17368
|
-
this.spaceService = spaceService;
|
|
17369
|
-
}
|
|
17370
|
-
async execute(command34) {
|
|
17371
|
-
const space = await this.getSpace(command34);
|
|
17372
|
-
const result = await this.gateway.packages.create({
|
|
17373
|
-
spaceId: space.id,
|
|
17374
|
-
name: command34.name,
|
|
17375
|
-
description: command34.description ?? "",
|
|
17376
|
-
recipeIds: [],
|
|
17377
|
-
standardIds: [],
|
|
17378
|
-
originSkill: command34.originSkill
|
|
17379
|
-
});
|
|
17380
|
-
return {
|
|
17381
|
-
packageId: result.package.id,
|
|
17382
|
-
name: result.package.name,
|
|
17383
|
-
slug: result.package.slug,
|
|
17384
|
-
spaceSlug: space.slug
|
|
17385
|
-
};
|
|
17386
|
-
}
|
|
17387
|
-
async getSpace(command34) {
|
|
17388
|
-
const spaces = await this.spaceService.getSpaces();
|
|
17389
|
-
if (command34.spaceSlug) {
|
|
17390
|
-
const found = spaces.find((s) => s.slug === command34.spaceSlug);
|
|
17391
|
-
if (!found) {
|
|
17392
|
-
throw new Error(`Space '${command34.spaceSlug}' not found.`);
|
|
17393
|
-
}
|
|
17394
|
-
return found;
|
|
17395
|
-
}
|
|
17396
|
-
if (spaces.length > 1) {
|
|
17397
|
-
const spaceList = spaces.map((s) => ` - ${s.name} (--space ${s.slug})`).join("\n");
|
|
17398
|
-
throw new Error(
|
|
17399
|
-
`Your organization has multiple spaces. Please specify one using the --space option.
|
|
16717
|
+
async getSpace(command30) {
|
|
16718
|
+
const spaces = await this.spaceService.getSpaces();
|
|
16719
|
+
if (command30.spaceSlug) {
|
|
16720
|
+
const found = spaces.find((s) => s.slug === command30.spaceSlug);
|
|
16721
|
+
if (!found) {
|
|
16722
|
+
throw new Error(`Space '${command30.spaceSlug}' not found.`);
|
|
16723
|
+
}
|
|
16724
|
+
return found;
|
|
16725
|
+
}
|
|
16726
|
+
if (spaces.length > 1) {
|
|
16727
|
+
const spaceList = spaces.map((s) => ` - ${s.name} (--space ${s.slug})`).join("\n");
|
|
16728
|
+
throw new Error(
|
|
16729
|
+
`Your organization has multiple spaces. Please specify one using the --space option.
|
|
17400
16730
|
|
|
17401
16731
|
Available spaces:
|
|
17402
16732
|
${spaceList}`
|
|
@@ -17406,26 +16736,34 @@ ${spaceList}`
|
|
|
17406
16736
|
}
|
|
17407
16737
|
};
|
|
17408
16738
|
|
|
16739
|
+
// apps/cli/src/infra/commands/sharedOptions.ts
|
|
16740
|
+
var import_cmd_ts14 = __toESM(require_cjs());
|
|
16741
|
+
var originSkillOption = (0, import_cmd_ts14.option)({
|
|
16742
|
+
long: "origin-skill",
|
|
16743
|
+
description: "Name of the skill that triggered this command",
|
|
16744
|
+
type: (0, import_cmd_ts14.optional)(import_cmd_ts14.string)
|
|
16745
|
+
});
|
|
16746
|
+
|
|
17409
16747
|
// apps/cli/src/infra/commands/CreatePackageCommand.ts
|
|
17410
|
-
var createPackageCommand = (0,
|
|
16748
|
+
var createPackageCommand = (0, import_cmd_ts15.command)({
|
|
17411
16749
|
name: "create",
|
|
17412
16750
|
description: "Create a new package",
|
|
17413
16751
|
args: {
|
|
17414
|
-
name: (0,
|
|
16752
|
+
name: (0, import_cmd_ts15.positional)({
|
|
17415
16753
|
displayName: "name",
|
|
17416
16754
|
description: "Name of the package to create",
|
|
17417
|
-
type:
|
|
16755
|
+
type: import_cmd_ts15.string
|
|
17418
16756
|
}),
|
|
17419
|
-
description: (0,
|
|
16757
|
+
description: (0, import_cmd_ts15.option)({
|
|
17420
16758
|
long: "description",
|
|
17421
16759
|
short: "d",
|
|
17422
16760
|
description: "Description of the package (optional)",
|
|
17423
|
-
type: (0,
|
|
16761
|
+
type: (0, import_cmd_ts15.optional)(import_cmd_ts15.string)
|
|
17424
16762
|
}),
|
|
17425
|
-
space: (0,
|
|
16763
|
+
space: (0, import_cmd_ts15.option)({
|
|
17426
16764
|
long: "space",
|
|
17427
16765
|
description: "Slug of the space in which to create the package",
|
|
17428
|
-
type: (0,
|
|
16766
|
+
type: (0, import_cmd_ts15.optional)(SpaceSlug)
|
|
17429
16767
|
}),
|
|
17430
16768
|
originSkill: originSkillOption
|
|
17431
16769
|
},
|
|
@@ -17479,7 +16817,7 @@ var createPackageCommand = (0, import_cmd_ts19.command)({
|
|
|
17479
16817
|
});
|
|
17480
16818
|
|
|
17481
16819
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
17482
|
-
var
|
|
16820
|
+
var import_cmd_ts16 = __toESM(require_cjs());
|
|
17483
16821
|
|
|
17484
16822
|
// apps/cli/src/domain/errors/ItemNotFoundError.ts
|
|
17485
16823
|
var ItemNotFoundError = class extends Error {
|
|
@@ -17499,8 +16837,8 @@ var AddToPackageUseCase = class {
|
|
|
17499
16837
|
this.gateway = gateway;
|
|
17500
16838
|
this.spaceService = spaceService;
|
|
17501
16839
|
}
|
|
17502
|
-
async execute(
|
|
17503
|
-
const { packageSlug, spaceSlug, itemType, itemSlugs } =
|
|
16840
|
+
async execute(command30) {
|
|
16841
|
+
const { packageSlug, spaceSlug, itemType, itemSlugs } = command30;
|
|
17504
16842
|
const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
|
|
17505
16843
|
const packages = await this.gateway.packages.list({
|
|
17506
16844
|
spaceId: space.id
|
|
@@ -17521,7 +16859,7 @@ var AddToPackageUseCase = class {
|
|
|
17521
16859
|
standardIds: [],
|
|
17522
16860
|
recipeIds: [],
|
|
17523
16861
|
skillIds: [],
|
|
17524
|
-
originSkill:
|
|
16862
|
+
originSkill: command30.originSkill
|
|
17525
16863
|
};
|
|
17526
16864
|
if (itemType === "standard") {
|
|
17527
16865
|
addCommand.standardIds = ids.map(createStandardId);
|
|
@@ -17573,7 +16911,7 @@ var AddToPackageUseCase = class {
|
|
|
17573
16911
|
}
|
|
17574
16912
|
async findCommandBySlug(slug6, spaceId) {
|
|
17575
16913
|
const commands = await this.gateway.commands.list({ spaceId });
|
|
17576
|
-
return commands.recipes.find((
|
|
16914
|
+
return commands.recipes.find((command30) => command30.slug === slug6) ?? null;
|
|
17577
16915
|
}
|
|
17578
16916
|
async findSkillBySlug(slug6, spaceId) {
|
|
17579
16917
|
const skills = await this.gateway.skills.list({ spaceId });
|
|
@@ -17649,11 +16987,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
|
|
|
17649
16987
|
logErrorConsole(message);
|
|
17650
16988
|
if (error instanceof ItemNotFoundError) {
|
|
17651
16989
|
const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
|
|
17652
|
-
const
|
|
16990
|
+
const command30 = formatCommand(
|
|
17653
16991
|
`packmind-cli ${error.itemType}s list${spaceFlag}`
|
|
17654
16992
|
);
|
|
17655
16993
|
logInfoConsole(
|
|
17656
|
-
`Run \`${
|
|
16994
|
+
`Run \`${command30}\` to display available ${error.itemType}s`
|
|
17657
16995
|
);
|
|
17658
16996
|
}
|
|
17659
16997
|
return { success: false, error: message };
|
|
@@ -17683,29 +17021,29 @@ async function addToPackageHandler(args2, deps) {
|
|
|
17683
17021
|
}
|
|
17684
17022
|
|
|
17685
17023
|
// apps/cli/src/infra/commands/AddToPackageCommand.ts
|
|
17686
|
-
var addToPackageCommand = (0,
|
|
17024
|
+
var addToPackageCommand = (0, import_cmd_ts16.command)({
|
|
17687
17025
|
name: "add",
|
|
17688
17026
|
description: "Add standards, commands, or skills to a package",
|
|
17689
17027
|
args: {
|
|
17690
|
-
to: (0,
|
|
17028
|
+
to: (0, import_cmd_ts16.option)({
|
|
17691
17029
|
long: "to",
|
|
17692
17030
|
description: "Target package slug (use @space/package format when multiple spaces exist)",
|
|
17693
17031
|
type: PackageSlugArgType
|
|
17694
17032
|
}),
|
|
17695
|
-
standards: (0,
|
|
17033
|
+
standards: (0, import_cmd_ts16.multioption)({
|
|
17696
17034
|
long: "standard",
|
|
17697
17035
|
description: "Standard slug(s) to add",
|
|
17698
|
-
type: (0,
|
|
17036
|
+
type: (0, import_cmd_ts16.array)(import_cmd_ts16.string)
|
|
17699
17037
|
}),
|
|
17700
|
-
commands: (0,
|
|
17038
|
+
commands: (0, import_cmd_ts16.multioption)({
|
|
17701
17039
|
long: "command",
|
|
17702
17040
|
description: "Command slug(s) to add",
|
|
17703
|
-
type: (0,
|
|
17041
|
+
type: (0, import_cmd_ts16.array)(import_cmd_ts16.string)
|
|
17704
17042
|
}),
|
|
17705
|
-
skills: (0,
|
|
17043
|
+
skills: (0, import_cmd_ts16.multioption)({
|
|
17706
17044
|
long: "skill",
|
|
17707
17045
|
description: "Skill slug(s) to add",
|
|
17708
|
-
type: (0,
|
|
17046
|
+
type: (0, import_cmd_ts16.array)(import_cmd_ts16.string)
|
|
17709
17047
|
}),
|
|
17710
17048
|
originSkill: originSkillOption
|
|
17711
17049
|
},
|
|
@@ -17741,7 +17079,7 @@ var addToPackageCommand = (0, import_cmd_ts20.command)({
|
|
|
17741
17079
|
});
|
|
17742
17080
|
|
|
17743
17081
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
17744
|
-
var
|
|
17082
|
+
var import_cmd_ts17 = __toESM(require_cjs());
|
|
17745
17083
|
|
|
17746
17084
|
// apps/cli/src/infra/commands/packages/listPackagesHandler.ts
|
|
17747
17085
|
async function listPackagesHandler(args2, deps) {
|
|
@@ -17808,12 +17146,12 @@ ${availableSpaces}`
|
|
|
17808
17146
|
}
|
|
17809
17147
|
|
|
17810
17148
|
// apps/cli/src/infra/commands/listPackagesCommand.ts
|
|
17811
|
-
var listPackagesCommand = (0,
|
|
17149
|
+
var listPackagesCommand = (0, import_cmd_ts17.command)({
|
|
17812
17150
|
name: "list",
|
|
17813
17151
|
description: "List available packages",
|
|
17814
17152
|
args: {
|
|
17815
|
-
space: (0,
|
|
17816
|
-
type: (0,
|
|
17153
|
+
space: (0, import_cmd_ts17.option)({
|
|
17154
|
+
type: (0, import_cmd_ts17.optional)(SpaceSlug),
|
|
17817
17155
|
long: "space",
|
|
17818
17156
|
description: "Filter packages by space slug"
|
|
17819
17157
|
})
|
|
@@ -17830,7 +17168,7 @@ var listPackagesCommand = (0, import_cmd_ts21.command)({
|
|
|
17830
17168
|
});
|
|
17831
17169
|
|
|
17832
17170
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
17833
|
-
var
|
|
17171
|
+
var import_cmd_ts18 = __toESM(require_cjs());
|
|
17834
17172
|
|
|
17835
17173
|
// apps/cli/src/infra/commands/packages/showPackageHandler.ts
|
|
17836
17174
|
function isNotFoundError(err) {
|
|
@@ -17907,22 +17245,14 @@ ${pkg.name} (${fullSlug}):
|
|
|
17907
17245
|
if (pkg.standards && pkg.standards.length > 0) {
|
|
17908
17246
|
logConsole("Standards:");
|
|
17909
17247
|
pkg.standards.forEach((standard) => {
|
|
17910
|
-
|
|
17911
|
-
logConsole(` - ${standard.name}: ${standard.summary}`);
|
|
17912
|
-
} else {
|
|
17913
|
-
logConsole(` - ${standard.name}`);
|
|
17914
|
-
}
|
|
17248
|
+
logConsole(` - ${standard.name}`);
|
|
17915
17249
|
});
|
|
17916
17250
|
logConsole("");
|
|
17917
17251
|
}
|
|
17918
17252
|
if (pkg.recipes && pkg.recipes.length > 0) {
|
|
17919
17253
|
logConsole("Commands:");
|
|
17920
17254
|
pkg.recipes.forEach((recipe) => {
|
|
17921
|
-
|
|
17922
|
-
logConsole(` - ${recipe.name}: ${recipe.summary}`);
|
|
17923
|
-
} else {
|
|
17924
|
-
logConsole(` - ${recipe.name}`);
|
|
17925
|
-
}
|
|
17255
|
+
logConsole(` - ${recipe.name}`);
|
|
17926
17256
|
});
|
|
17927
17257
|
logConsole("");
|
|
17928
17258
|
}
|
|
@@ -17950,11 +17280,11 @@ ${pkg.name} (${fullSlug}):
|
|
|
17950
17280
|
}
|
|
17951
17281
|
|
|
17952
17282
|
// apps/cli/src/infra/commands/packages/showPackageCommand.ts
|
|
17953
|
-
var showPackageCommand = (0,
|
|
17283
|
+
var showPackageCommand = (0, import_cmd_ts18.command)({
|
|
17954
17284
|
name: "show",
|
|
17955
17285
|
description: "Show details of a specific package",
|
|
17956
17286
|
args: {
|
|
17957
|
-
slug: (0,
|
|
17287
|
+
slug: (0, import_cmd_ts18.positional)({
|
|
17958
17288
|
type: PackageSlugArgType,
|
|
17959
17289
|
displayName: "package",
|
|
17960
17290
|
description: "Package slug (e.g. backend or @my-space/backend)"
|
|
@@ -17968,7 +17298,7 @@ var showPackageCommand = (0, import_cmd_ts22.command)({
|
|
|
17968
17298
|
});
|
|
17969
17299
|
|
|
17970
17300
|
// apps/cli/src/infra/commands/PackagesCommand.ts
|
|
17971
|
-
var packagesCommand = (0,
|
|
17301
|
+
var packagesCommand = (0, import_cmd_ts19.subcommands)({
|
|
17972
17302
|
name: "packages",
|
|
17973
17303
|
description: "Manage packages",
|
|
17974
17304
|
cmds: {
|
|
@@ -17980,10 +17310,10 @@ var packagesCommand = (0, import_cmd_ts23.subcommands)({
|
|
|
17980
17310
|
});
|
|
17981
17311
|
|
|
17982
17312
|
// apps/cli/src/infra/commands/PluginsCommand.ts
|
|
17983
|
-
var
|
|
17313
|
+
var import_cmd_ts22 = __toESM(require_cjs());
|
|
17984
17314
|
|
|
17985
17315
|
// apps/cli/src/infra/commands/plugins/RenderPluginCommand.ts
|
|
17986
|
-
var
|
|
17316
|
+
var import_cmd_ts20 = __toESM(require_cjs());
|
|
17987
17317
|
|
|
17988
17318
|
// apps/cli/src/infra/commands/plugins/renderPluginHandler.ts
|
|
17989
17319
|
var import_fs22 = require("fs");
|
|
@@ -18199,11 +17529,11 @@ async function confirmOverwrite(message) {
|
|
|
18199
17529
|
}
|
|
18200
17530
|
|
|
18201
17531
|
// apps/cli/src/infra/commands/plugins/RenderPluginCommand.ts
|
|
18202
|
-
var renderPluginCommand = (0,
|
|
17532
|
+
var renderPluginCommand = (0, import_cmd_ts20.command)({
|
|
18203
17533
|
name: "render",
|
|
18204
17534
|
description: "Render a Packmind package as a Claude plugin",
|
|
18205
17535
|
args: {
|
|
18206
|
-
packageSlug: (0,
|
|
17536
|
+
packageSlug: (0, import_cmd_ts20.positional)({
|
|
18207
17537
|
type: PackageSlugArgType,
|
|
18208
17538
|
displayName: "package-slug",
|
|
18209
17539
|
description: "Package slug (e.g. security or @my-space/security)"
|
|
@@ -18227,7 +17557,7 @@ var renderPluginCommand = (0, import_cmd_ts24.command)({
|
|
|
18227
17557
|
});
|
|
18228
17558
|
|
|
18229
17559
|
// apps/cli/src/infra/commands/plugins/DeletePluginCommand.ts
|
|
18230
|
-
var
|
|
17560
|
+
var import_cmd_ts21 = __toESM(require_cjs());
|
|
18231
17561
|
|
|
18232
17562
|
// apps/cli/src/infra/commands/plugins/deletePluginHandler.ts
|
|
18233
17563
|
var import_fs23 = require("fs");
|
|
@@ -18315,11 +17645,11 @@ async function trackDeletion(deps, packageSlug, gitRemoteUrl) {
|
|
|
18315
17645
|
}
|
|
18316
17646
|
|
|
18317
17647
|
// apps/cli/src/infra/commands/plugins/DeletePluginCommand.ts
|
|
18318
|
-
var deletePluginCommand = (0,
|
|
17648
|
+
var deletePluginCommand = (0, import_cmd_ts21.command)({
|
|
18319
17649
|
name: "delete",
|
|
18320
17650
|
description: "Delete a rendered Packmind plugin from this workspace",
|
|
18321
17651
|
args: {
|
|
18322
|
-
packageSlug: (0,
|
|
17652
|
+
packageSlug: (0, import_cmd_ts21.positional)({
|
|
18323
17653
|
type: PackageSlugArgType,
|
|
18324
17654
|
displayName: "package-slug",
|
|
18325
17655
|
description: "Package slug (e.g. security or @my-space/security)"
|
|
@@ -18343,7 +17673,7 @@ var deletePluginCommand = (0, import_cmd_ts25.command)({
|
|
|
18343
17673
|
});
|
|
18344
17674
|
|
|
18345
17675
|
// apps/cli/src/infra/commands/PluginsCommand.ts
|
|
18346
|
-
var pluginsCommand = (0,
|
|
17676
|
+
var pluginsCommand = (0, import_cmd_ts22.subcommands)({
|
|
18347
17677
|
name: "plugins",
|
|
18348
17678
|
description: "Render Packmind packages as Claude plugins",
|
|
18349
17679
|
cmds: {
|
|
@@ -18353,15 +17683,15 @@ var pluginsCommand = (0, import_cmd_ts26.subcommands)({
|
|
|
18353
17683
|
});
|
|
18354
17684
|
|
|
18355
17685
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
18356
|
-
var
|
|
17686
|
+
var import_cmd_ts29 = __toESM(require_cjs());
|
|
18357
17687
|
|
|
18358
17688
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
18359
17689
|
var import_fs24 = require("fs");
|
|
18360
|
-
var
|
|
17690
|
+
var import_cmd_ts23 = __toESM(require_cjs());
|
|
18361
17691
|
|
|
18362
17692
|
// apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
|
|
18363
17693
|
var crypto = __toESM(require("crypto"));
|
|
18364
|
-
var
|
|
17694
|
+
var fs24 = __toESM(require("fs"));
|
|
18365
17695
|
var os5 = __toESM(require("os"));
|
|
18366
17696
|
var path25 = __toESM(require("path"));
|
|
18367
17697
|
var yaml = __toESM(require("yaml"));
|
|
@@ -18417,11 +17747,11 @@ var PlaybookLocalRepository = class {
|
|
|
18417
17747
|
return normalized;
|
|
18418
17748
|
}
|
|
18419
17749
|
readYaml() {
|
|
18420
|
-
if (!
|
|
17750
|
+
if (!fs24.existsSync(this.storagePath)) {
|
|
18421
17751
|
return { version: 1, changes: [] };
|
|
18422
17752
|
}
|
|
18423
17753
|
try {
|
|
18424
|
-
const content =
|
|
17754
|
+
const content = fs24.readFileSync(this.storagePath, "utf-8");
|
|
18425
17755
|
const parsed = yaml.parse(content);
|
|
18426
17756
|
if (!parsed || !Array.isArray(parsed.changes)) {
|
|
18427
17757
|
return { version: 1, changes: [] };
|
|
@@ -18436,13 +17766,13 @@ var PlaybookLocalRepository = class {
|
|
|
18436
17766
|
}
|
|
18437
17767
|
writeYaml(data) {
|
|
18438
17768
|
const dir = path25.dirname(this.storagePath);
|
|
18439
|
-
|
|
18440
|
-
|
|
17769
|
+
fs24.mkdirSync(dir, { recursive: true });
|
|
17770
|
+
fs24.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
|
|
18441
17771
|
}
|
|
18442
17772
|
};
|
|
18443
17773
|
|
|
18444
17774
|
// apps/cli/src/infra/commands/playbook/addHandler.ts
|
|
18445
|
-
var
|
|
17775
|
+
var fs25 = __toESM(require("fs"));
|
|
18446
17776
|
var path29 = __toESM(require("path"));
|
|
18447
17777
|
var yaml2 = __toESM(require("yaml"));
|
|
18448
17778
|
|
|
@@ -19103,7 +18433,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
19103
18433
|
return path29.dirname(absolutePath);
|
|
19104
18434
|
}
|
|
19105
18435
|
try {
|
|
19106
|
-
if (
|
|
18436
|
+
if (fs25.statSync(absolutePath).isDirectory()) {
|
|
19107
18437
|
return absolutePath;
|
|
19108
18438
|
}
|
|
19109
18439
|
} catch {
|
|
@@ -19112,7 +18442,7 @@ function resolveSkillDirectoryRoot(absolutePath) {
|
|
|
19112
18442
|
let current = path29.dirname(absolutePath);
|
|
19113
18443
|
const root = path29.parse(current).root;
|
|
19114
18444
|
while (current !== root) {
|
|
19115
|
-
if (
|
|
18445
|
+
if (fs25.existsSync(path29.join(current, "SKILL.md"))) {
|
|
19116
18446
|
return current;
|
|
19117
18447
|
}
|
|
19118
18448
|
current = path29.dirname(current);
|
|
@@ -19491,17 +18821,17 @@ function formatSpaceList(spaces) {
|
|
|
19491
18821
|
}
|
|
19492
18822
|
|
|
19493
18823
|
// apps/cli/src/infra/commands/playbook/AddCommand.ts
|
|
19494
|
-
var addPlaybookCommand = (0,
|
|
18824
|
+
var addPlaybookCommand = (0, import_cmd_ts23.command)({
|
|
19495
18825
|
name: "add",
|
|
19496
18826
|
description: "Stage a local artifact change",
|
|
19497
18827
|
args: {
|
|
19498
|
-
filePath: (0,
|
|
19499
|
-
type:
|
|
18828
|
+
filePath: (0, import_cmd_ts23.positional)({
|
|
18829
|
+
type: import_cmd_ts23.string,
|
|
19500
18830
|
displayName: "path",
|
|
19501
18831
|
description: "Path to the artifact file or directory to stage"
|
|
19502
18832
|
}),
|
|
19503
|
-
space: (0,
|
|
19504
|
-
type: (0,
|
|
18833
|
+
space: (0, import_cmd_ts23.option)({
|
|
18834
|
+
type: (0, import_cmd_ts23.optional)(SpaceSlug),
|
|
19505
18835
|
long: "space",
|
|
19506
18836
|
description: "Target space slug"
|
|
19507
18837
|
})
|
|
@@ -19530,10 +18860,10 @@ var addPlaybookCommand = (0, import_cmd_ts27.command)({
|
|
|
19530
18860
|
});
|
|
19531
18861
|
|
|
19532
18862
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
19533
|
-
var
|
|
18863
|
+
var import_cmd_ts24 = __toESM(require_cjs());
|
|
19534
18864
|
|
|
19535
18865
|
// apps/cli/src/infra/commands/playbook/rmHandler.ts
|
|
19536
|
-
var
|
|
18866
|
+
var fs26 = __toESM(require("fs"));
|
|
19537
18867
|
var path30 = __toESM(require("path"));
|
|
19538
18868
|
function isSkillSupportFile(absolutePath) {
|
|
19539
18869
|
const normalized = absolutePath.replace(/\\/g, "/");
|
|
@@ -19562,7 +18892,7 @@ async function playbookRmHandler(deps) {
|
|
|
19562
18892
|
return;
|
|
19563
18893
|
}
|
|
19564
18894
|
const absolutePath = path30.resolve(getCwd(), filePath);
|
|
19565
|
-
if (!
|
|
18895
|
+
if (!fs26.existsSync(absolutePath)) {
|
|
19566
18896
|
logErrorConsole(`File not found: "${filePath}"`);
|
|
19567
18897
|
exit(1);
|
|
19568
18898
|
return;
|
|
@@ -19661,13 +18991,13 @@ async function playbookRmHandler(deps) {
|
|
|
19661
18991
|
}
|
|
19662
18992
|
|
|
19663
18993
|
// apps/cli/src/infra/commands/playbook/RmCommand.ts
|
|
19664
|
-
var rmPlaybookCommand = (0,
|
|
18994
|
+
var rmPlaybookCommand = (0, import_cmd_ts24.command)({
|
|
19665
18995
|
name: "rm",
|
|
19666
18996
|
description: "Stage an artifact for removal",
|
|
19667
18997
|
aliases: ["remove"],
|
|
19668
18998
|
args: {
|
|
19669
|
-
filePath: (0,
|
|
19670
|
-
type:
|
|
18999
|
+
filePath: (0, import_cmd_ts24.positional)({
|
|
19000
|
+
type: import_cmd_ts24.string,
|
|
19671
19001
|
displayName: "path",
|
|
19672
19002
|
description: "Path to the artifact file or directory to remove"
|
|
19673
19003
|
})
|
|
@@ -19693,7 +19023,7 @@ var rmPlaybookCommand = (0, import_cmd_ts28.command)({
|
|
|
19693
19023
|
});
|
|
19694
19024
|
|
|
19695
19025
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
19696
|
-
var
|
|
19026
|
+
var import_cmd_ts25 = __toESM(require_cjs());
|
|
19697
19027
|
|
|
19698
19028
|
// apps/cli/src/infra/commands/playbook/unstageHandler.ts
|
|
19699
19029
|
var path31 = __toESM(require("path"));
|
|
@@ -19777,17 +19107,17 @@ ${spaceList}`
|
|
|
19777
19107
|
}
|
|
19778
19108
|
|
|
19779
19109
|
// apps/cli/src/infra/commands/playbook/UnstageCommand.ts
|
|
19780
|
-
var unstagePlaybookCommand = (0,
|
|
19110
|
+
var unstagePlaybookCommand = (0, import_cmd_ts25.command)({
|
|
19781
19111
|
name: "unstage",
|
|
19782
19112
|
description: "Remove a staged change",
|
|
19783
19113
|
args: {
|
|
19784
|
-
filePath: (0,
|
|
19785
|
-
type:
|
|
19114
|
+
filePath: (0, import_cmd_ts25.positional)({
|
|
19115
|
+
type: import_cmd_ts25.string,
|
|
19786
19116
|
displayName: "path",
|
|
19787
19117
|
description: "Path to the artifact file or directory to unstage"
|
|
19788
19118
|
}),
|
|
19789
|
-
space: (0,
|
|
19790
|
-
type: (0,
|
|
19119
|
+
space: (0, import_cmd_ts25.option)({
|
|
19120
|
+
type: (0, import_cmd_ts25.optional)(SpaceSlug),
|
|
19791
19121
|
long: "space",
|
|
19792
19122
|
description: "Target space slug (required when artifact is staged for multiple spaces)"
|
|
19793
19123
|
})
|
|
@@ -19813,7 +19143,7 @@ var unstagePlaybookCommand = (0, import_cmd_ts29.command)({
|
|
|
19813
19143
|
|
|
19814
19144
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
19815
19145
|
var import_fs26 = require("fs");
|
|
19816
|
-
var
|
|
19146
|
+
var import_cmd_ts26 = __toESM(require_cjs());
|
|
19817
19147
|
|
|
19818
19148
|
// apps/cli/src/infra/utils/listDirectoryFiles.ts
|
|
19819
19149
|
var import_fs25 = require("fs");
|
|
@@ -20096,7 +19426,7 @@ async function playbookStatusHandler(deps) {
|
|
|
20096
19426
|
}
|
|
20097
19427
|
|
|
20098
19428
|
// apps/cli/src/infra/commands/playbook/StatusCommand.ts
|
|
20099
|
-
var statusPlaybookCommand = (0,
|
|
19429
|
+
var statusPlaybookCommand = (0, import_cmd_ts26.command)({
|
|
20100
19430
|
name: "status",
|
|
20101
19431
|
description: "Show staged and untracked changes",
|
|
20102
19432
|
args: {},
|
|
@@ -20130,7 +19460,7 @@ var statusPlaybookCommand = (0, import_cmd_ts30.command)({
|
|
|
20130
19460
|
|
|
20131
19461
|
// apps/cli/src/infra/commands/playbook/SubmitCommand.ts
|
|
20132
19462
|
var import_fs28 = require("fs");
|
|
20133
|
-
var
|
|
19463
|
+
var import_cmd_ts27 = __toESM(require_cjs());
|
|
20134
19464
|
|
|
20135
19465
|
// apps/cli/src/infra/commands/playbook/submitHandler.ts
|
|
20136
19466
|
var path35 = __toESM(require("path"));
|
|
@@ -20913,6 +20243,31 @@ function logPackageAddGuidance(created, packageSlugs) {
|
|
|
20913
20243
|
logInfoConsole(` Available packages: ${packageSlugs.join(", ")}`);
|
|
20914
20244
|
}
|
|
20915
20245
|
}
|
|
20246
|
+
async function logReviewUrls(packmindCliHexa, spaceIds) {
|
|
20247
|
+
if (spaceIds.length === 0) return;
|
|
20248
|
+
const buildUrl = resolveUrlBuilder(() => "review-changes/");
|
|
20249
|
+
try {
|
|
20250
|
+
const allSpaces = await packmindCliHexa.getSpaces();
|
|
20251
|
+
const spaceById = new Map(allSpaces.map((s) => [s.id, s]));
|
|
20252
|
+
const urls = [];
|
|
20253
|
+
for (const spaceId of spaceIds) {
|
|
20254
|
+
const spaceSlug = spaceById.get(spaceId)?.slug;
|
|
20255
|
+
if (!spaceSlug) continue;
|
|
20256
|
+
const url = buildUrl(spaceSlug, "");
|
|
20257
|
+
if (url) urls.push(url);
|
|
20258
|
+
}
|
|
20259
|
+
if (urls.length === 0) return;
|
|
20260
|
+
if (urls.length === 1) {
|
|
20261
|
+
logInfoConsole(`Review your change proposals at: ${urls[0]}`);
|
|
20262
|
+
} else {
|
|
20263
|
+
logInfoConsole("Review your change proposals at:");
|
|
20264
|
+
for (const url of urls) {
|
|
20265
|
+
logInfoConsole(` - ${url}`);
|
|
20266
|
+
}
|
|
20267
|
+
}
|
|
20268
|
+
} catch {
|
|
20269
|
+
}
|
|
20270
|
+
}
|
|
20916
20271
|
async function logRemovedPackagesNotification(packmindCliHexa, packageIds) {
|
|
20917
20272
|
if (packageIds.size === 0) return;
|
|
20918
20273
|
try {
|
|
@@ -21250,194 +20605,629 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
|
|
|
21250
20605
|
});
|
|
21251
20606
|
}
|
|
21252
20607
|
} else {
|
|
21253
|
-
succeededSpaces.push(spaceId);
|
|
21254
|
-
const filePaths = filePathsBySpaceId.get(spaceId) ?? /* @__PURE__ */ new Set();
|
|
21255
|
-
for (const filePath of filePaths) {
|
|
21256
|
-
playbookLocalRepository.removeChange(filePath, spaceId);
|
|
20608
|
+
succeededSpaces.push(spaceId);
|
|
20609
|
+
const filePaths = filePathsBySpaceId.get(spaceId) ?? /* @__PURE__ */ new Set();
|
|
20610
|
+
for (const filePath of filePaths) {
|
|
20611
|
+
playbookLocalRepository.removeChange(filePath, spaceId);
|
|
20612
|
+
}
|
|
20613
|
+
const removedEntries = changes.filter(
|
|
20614
|
+
(c) => c.changeType === "removed" && filePaths.has(c.filePath)
|
|
20615
|
+
);
|
|
20616
|
+
for (const entry of removedEntries) {
|
|
20617
|
+
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
20618
|
+
if (!entryCtx?.projectDir) continue;
|
|
20619
|
+
try {
|
|
20620
|
+
const fullPath = path35.join(entryCtx.projectDir, entry.filePath);
|
|
20621
|
+
if (entry.artifactType === "skill") {
|
|
20622
|
+
deps.rmSync(fullPath, { recursive: true });
|
|
20623
|
+
} else {
|
|
20624
|
+
deps.unlinkSync(fullPath);
|
|
20625
|
+
}
|
|
20626
|
+
} catch {
|
|
20627
|
+
}
|
|
20628
|
+
}
|
|
20629
|
+
}
|
|
20630
|
+
}
|
|
20631
|
+
if (failedSpaces.length > 0) {
|
|
20632
|
+
for (const { spaceId, errors } of failedSpaces) {
|
|
20633
|
+
logErrorConsole(
|
|
20634
|
+
`Failed to submit to space '${displaySpace2(spaceId)}': ${errors.join(", ")}`
|
|
20635
|
+
);
|
|
20636
|
+
}
|
|
20637
|
+
if (succeededSpaces.length > 0) {
|
|
20638
|
+
logWarningConsole(
|
|
20639
|
+
`Submitted to: ${succeededSpaces.map(displaySpace2).join(", ")}. Run 'packmind playbook submit' again to retry failed spaces.`
|
|
20640
|
+
);
|
|
20641
|
+
}
|
|
20642
|
+
exit(1);
|
|
20643
|
+
return;
|
|
20644
|
+
}
|
|
20645
|
+
await logRemovedPackagesNotification(packmindCliHexa, removalPackageIds);
|
|
20646
|
+
const parts = [];
|
|
20647
|
+
if (totalCreated > 0) {
|
|
20648
|
+
parts.push(`${totalCreated} submitted`);
|
|
20649
|
+
}
|
|
20650
|
+
if (totalSkipped > 0) {
|
|
20651
|
+
parts.push(`${totalSkipped} skipped (already submitted)`);
|
|
20652
|
+
}
|
|
20653
|
+
if (totalCreated > 0 && totalSkipped === 0) {
|
|
20654
|
+
logSuccessConsole(
|
|
20655
|
+
`Submitted ${totalCreated} change proposal${totalCreated !== 1 ? "s" : ""}`
|
|
20656
|
+
);
|
|
20657
|
+
} else if (totalCreated === 0 && totalSkipped > 0) {
|
|
20658
|
+
logWarningConsole(
|
|
20659
|
+
`All proposals were already submitted (${totalSkipped} skipped)`
|
|
20660
|
+
);
|
|
20661
|
+
} else {
|
|
20662
|
+
logSuccessConsole(`Change proposals: ${parts.join(", ")}`);
|
|
20663
|
+
}
|
|
20664
|
+
if (totalCreated > 0) {
|
|
20665
|
+
await logReviewUrls(packmindCliHexa, succeededSpaces);
|
|
20666
|
+
}
|
|
20667
|
+
exit(0);
|
|
20668
|
+
}
|
|
20669
|
+
|
|
20670
|
+
// apps/cli/src/infra/utils/editorMessage.ts
|
|
20671
|
+
var import_child_process3 = require("child_process");
|
|
20672
|
+
var import_fs27 = require("fs");
|
|
20673
|
+
var import_os2 = require("os");
|
|
20674
|
+
var import_path8 = require("path");
|
|
20675
|
+
|
|
20676
|
+
// apps/cli/src/infra/utils/resolveEditor.ts
|
|
20677
|
+
var which = __toESM(require("which"));
|
|
20678
|
+
var EDITOR_NOT_FOUND_MESSAGE = 'No text editor found. Set the EDITOR environment variable to your preferred editor, or pass the message inline with -m "<message>".';
|
|
20679
|
+
var WINDOWS_CANDIDATES = ["notepad"];
|
|
20680
|
+
var UNIX_CANDIDATES = ["nano", "vim", "vi"];
|
|
20681
|
+
function isAvailable(cmd) {
|
|
20682
|
+
try {
|
|
20683
|
+
which.sync(cmd);
|
|
20684
|
+
return true;
|
|
20685
|
+
} catch {
|
|
20686
|
+
return false;
|
|
20687
|
+
}
|
|
20688
|
+
}
|
|
20689
|
+
function resolveEditor(platform = process.platform) {
|
|
20690
|
+
if (process.env.VISUAL) {
|
|
20691
|
+
return process.env.VISUAL;
|
|
20692
|
+
}
|
|
20693
|
+
if (process.env.EDITOR) {
|
|
20694
|
+
return process.env.EDITOR;
|
|
20695
|
+
}
|
|
20696
|
+
const candidates = platform === "win32" ? WINDOWS_CANDIDATES : UNIX_CANDIDATES;
|
|
20697
|
+
for (const candidate of candidates) {
|
|
20698
|
+
if (isAvailable(candidate)) {
|
|
20699
|
+
return candidate;
|
|
20700
|
+
}
|
|
20701
|
+
}
|
|
20702
|
+
throw new Error(EDITOR_NOT_FOUND_MESSAGE);
|
|
20703
|
+
}
|
|
20704
|
+
|
|
20705
|
+
// apps/cli/src/infra/utils/editorMessage.ts
|
|
20706
|
+
var EDITOR_TEMPLATE = `
|
|
20707
|
+
# Enter a message describing the intent behind these changes.
|
|
20708
|
+
# Lines starting with '#' will be ignored.
|
|
20709
|
+
# An empty message aborts the submission.
|
|
20710
|
+
`;
|
|
20711
|
+
function openEditorForMessage(prefill) {
|
|
20712
|
+
const editor = resolveEditor();
|
|
20713
|
+
const tmpFile = (0, import_path8.join)((0, import_os2.tmpdir)(), `packmind-msg-${Date.now()}.txt`);
|
|
20714
|
+
try {
|
|
20715
|
+
(0, import_fs27.writeFileSync)(tmpFile, prefill ?? EDITOR_TEMPLATE, "utf-8");
|
|
20716
|
+
const result = (0, import_child_process3.spawnSync)(editor, [tmpFile], {
|
|
20717
|
+
stdio: "inherit"
|
|
20718
|
+
});
|
|
20719
|
+
if (result.status !== 0) {
|
|
20720
|
+
throw new Error(`Editor exited with status ${result.status}`);
|
|
20721
|
+
}
|
|
20722
|
+
const content = (0, import_fs27.readFileSync)(tmpFile, "utf-8");
|
|
20723
|
+
return content.split("\n").filter((line) => !line.startsWith("#")).join("\n").trim();
|
|
20724
|
+
} finally {
|
|
20725
|
+
try {
|
|
20726
|
+
(0, import_fs27.unlinkSync)(tmpFile);
|
|
20727
|
+
} catch {
|
|
20728
|
+
}
|
|
20729
|
+
}
|
|
20730
|
+
}
|
|
20731
|
+
|
|
20732
|
+
// apps/cli/src/infra/commands/playbook/safeOpenEditor.ts
|
|
20733
|
+
function safeOpenEditor(prefill) {
|
|
20734
|
+
try {
|
|
20735
|
+
const result = openEditorForMessage(prefill);
|
|
20736
|
+
return result.length > 0 ? result : null;
|
|
20737
|
+
} catch (error) {
|
|
20738
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
20739
|
+
logErrorConsole(`Failed to open editor: ${message}`);
|
|
20740
|
+
return null;
|
|
20741
|
+
}
|
|
20742
|
+
}
|
|
20743
|
+
|
|
20744
|
+
// apps/cli/src/infra/commands/playbook/SubmitCommand.ts
|
|
20745
|
+
var submitPlaybookCommand = (0, import_cmd_ts27.command)({
|
|
20746
|
+
name: "submit",
|
|
20747
|
+
description: "Submit staged changes as proposals",
|
|
20748
|
+
args: {
|
|
20749
|
+
message: (0, import_cmd_ts27.option)({
|
|
20750
|
+
type: (0, import_cmd_ts27.optional)(import_cmd_ts27.string),
|
|
20751
|
+
long: "message",
|
|
20752
|
+
short: "m",
|
|
20753
|
+
description: "Message describing the intent behind the proposed changes"
|
|
20754
|
+
}),
|
|
20755
|
+
noReview: (0, import_cmd_ts27.flag)({
|
|
20756
|
+
long: "no-review",
|
|
20757
|
+
description: "Apply changes directly without creating proposals for review"
|
|
20758
|
+
})
|
|
20759
|
+
},
|
|
20760
|
+
handler: async ({ message, noReview }) => {
|
|
20761
|
+
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
20762
|
+
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
20763
|
+
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(
|
|
20764
|
+
process.cwd()
|
|
20765
|
+
);
|
|
20766
|
+
const repoRoot = gitRoot ?? process.cwd();
|
|
20767
|
+
const playbookLocalRepository = new PlaybookLocalRepository(repoRoot);
|
|
20768
|
+
const lockFileRepository = new LockFileRepository();
|
|
20769
|
+
await playbookSubmitHandler({
|
|
20770
|
+
packmindCliHexa,
|
|
20771
|
+
playbookLocalRepository,
|
|
20772
|
+
lockFileRepository,
|
|
20773
|
+
cwd: process.cwd(),
|
|
20774
|
+
exit: process.exit,
|
|
20775
|
+
message,
|
|
20776
|
+
noReview,
|
|
20777
|
+
openEditor: safeOpenEditor,
|
|
20778
|
+
unlinkSync: (p) => (0, import_fs28.unlinkSync)(p),
|
|
20779
|
+
rmSync: (p, opts) => (0, import_fs28.rmSync)(p, opts)
|
|
20780
|
+
});
|
|
20781
|
+
}
|
|
20782
|
+
});
|
|
20783
|
+
|
|
20784
|
+
// apps/cli/src/infra/commands/playbook/DiffCommand.ts
|
|
20785
|
+
var import_cmd_ts28 = __toESM(require_cjs());
|
|
20786
|
+
|
|
20787
|
+
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
20788
|
+
var nodePath = __toESM(require("path"));
|
|
20789
|
+
var fs27 = __toESM(require("fs/promises"));
|
|
20790
|
+
|
|
20791
|
+
// apps/cli/src/infra/utils/diffFormatter.ts
|
|
20792
|
+
var import_diff4 = require("diff");
|
|
20793
|
+
init_source();
|
|
20794
|
+
function formatContentDiff(oldContent, newContent) {
|
|
20795
|
+
const changes = (0, import_diff4.diffLines)(oldContent, newContent);
|
|
20796
|
+
const lines = [];
|
|
20797
|
+
for (const change of changes) {
|
|
20798
|
+
const trimmedValue = change.value.replace(/\n$/, "");
|
|
20799
|
+
const changeLines = trimmedValue.split("\n");
|
|
20800
|
+
if (change.added) {
|
|
20801
|
+
for (const line of changeLines) {
|
|
20802
|
+
lines.push(source_default.green(` + ${line}`));
|
|
20803
|
+
}
|
|
20804
|
+
} else if (change.removed) {
|
|
20805
|
+
for (const line of changeLines) {
|
|
20806
|
+
lines.push(source_default.red(` - ${line}`));
|
|
20807
|
+
}
|
|
20808
|
+
}
|
|
20809
|
+
}
|
|
20810
|
+
return {
|
|
20811
|
+
lines,
|
|
20812
|
+
hasChanges: lines.length > 0
|
|
20813
|
+
};
|
|
20814
|
+
}
|
|
20815
|
+
|
|
20816
|
+
// apps/cli/src/infra/commands/formatAdditionalPropertyDiff.ts
|
|
20817
|
+
function formatAdditionalPropertyDiff(targetId, oldValue, newValue) {
|
|
20818
|
+
const displayKey = CAMEL_TO_YAML_KEY[targetId] ?? camelToKebab(targetId);
|
|
20819
|
+
const lines = [];
|
|
20820
|
+
if (oldValue && oldValue !== "null") {
|
|
20821
|
+
lines.push({ type: "removed", text: `${displayKey}: ${oldValue}` });
|
|
20822
|
+
}
|
|
20823
|
+
if (newValue && newValue !== "null") {
|
|
20824
|
+
lines.push({ type: "added", text: `${displayKey}: ${newValue}` });
|
|
20825
|
+
}
|
|
20826
|
+
return lines;
|
|
20827
|
+
}
|
|
20828
|
+
|
|
20829
|
+
// apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
|
|
20830
|
+
init_source();
|
|
20831
|
+
var ARTIFACT_TYPE_LABELS = {
|
|
20832
|
+
command: "Command",
|
|
20833
|
+
standard: "Standard",
|
|
20834
|
+
skill: "Skill"
|
|
20835
|
+
};
|
|
20836
|
+
function subGroupByChangeContent(diffs) {
|
|
20837
|
+
const groups = /* @__PURE__ */ new Map();
|
|
20838
|
+
for (const diff of diffs) {
|
|
20839
|
+
const key = JSON.stringify({ type: diff.type, payload: diff.payload });
|
|
20840
|
+
const group = groups.get(key) ?? [];
|
|
20841
|
+
group.push(diff);
|
|
20842
|
+
groups.set(key, group);
|
|
20843
|
+
}
|
|
20844
|
+
return Array.from(groups.values());
|
|
20845
|
+
}
|
|
20846
|
+
function groupDiffsByArtefact(diffs) {
|
|
20847
|
+
const groups = /* @__PURE__ */ new Map();
|
|
20848
|
+
for (const diff of diffs) {
|
|
20849
|
+
const key = `${diff.artifactType}:${diff.artifactName}`;
|
|
20850
|
+
const group = groups.get(key) ?? [];
|
|
20851
|
+
group.push(diff);
|
|
20852
|
+
groups.set(key, group);
|
|
20853
|
+
}
|
|
20854
|
+
return groups;
|
|
20855
|
+
}
|
|
20856
|
+
function formatDiffPayload(diff, log) {
|
|
20857
|
+
const payload = diff.payload;
|
|
20858
|
+
if (diff.type === "addSkillFile" /* addSkillFile */) {
|
|
20859
|
+
const item = payload.item;
|
|
20860
|
+
if (item.isBase64) {
|
|
20861
|
+
log(source_default.green(" + [binary file]"));
|
|
20862
|
+
} else {
|
|
20863
|
+
for (const line of item.content.split("\n")) {
|
|
20864
|
+
log(source_default.green(` + ${line}`));
|
|
20865
|
+
}
|
|
20866
|
+
}
|
|
20867
|
+
return;
|
|
20868
|
+
}
|
|
20869
|
+
if (diff.type === "deleteSkillFile" /* deleteSkillFile */) {
|
|
20870
|
+
const item = payload.item;
|
|
20871
|
+
if (item.isBase64) {
|
|
20872
|
+
log(source_default.red(" - [binary file]"));
|
|
20873
|
+
} else {
|
|
20874
|
+
const lines2 = item.content.split("\n");
|
|
20875
|
+
const MAX_DELETED_LINES = 3;
|
|
20876
|
+
const preview = lines2.slice(0, MAX_DELETED_LINES);
|
|
20877
|
+
for (const line of preview) {
|
|
20878
|
+
log(source_default.red(` - ${line}`));
|
|
21257
20879
|
}
|
|
21258
|
-
|
|
21259
|
-
|
|
21260
|
-
|
|
21261
|
-
for (const entry of removedEntries) {
|
|
21262
|
-
const entryCtx = resolver.getCachedContext(entry.configDir);
|
|
21263
|
-
if (!entryCtx?.projectDir) continue;
|
|
21264
|
-
try {
|
|
21265
|
-
const fullPath = path35.join(entryCtx.projectDir, entry.filePath);
|
|
21266
|
-
if (entry.artifactType === "skill") {
|
|
21267
|
-
deps.rmSync(fullPath, { recursive: true });
|
|
21268
|
-
} else {
|
|
21269
|
-
deps.unlinkSync(fullPath);
|
|
21270
|
-
}
|
|
21271
|
-
} catch {
|
|
21272
|
-
}
|
|
20880
|
+
if (lines2.length > MAX_DELETED_LINES) {
|
|
20881
|
+
const remaining = lines2.length - MAX_DELETED_LINES;
|
|
20882
|
+
log(source_default.red(` ... and ${remaining} more lines deleted`));
|
|
21273
20883
|
}
|
|
21274
20884
|
}
|
|
20885
|
+
return;
|
|
21275
20886
|
}
|
|
21276
|
-
if (
|
|
21277
|
-
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
20887
|
+
if (diff.type === "updateSkillFileContent" /* updateSkillFileContent */) {
|
|
20888
|
+
const typedPayload = payload;
|
|
20889
|
+
if (typedPayload.isBase64) {
|
|
20890
|
+
log(source_default.green(" ~ [binary content changed]"));
|
|
20891
|
+
return;
|
|
21281
20892
|
}
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
20893
|
+
}
|
|
20894
|
+
if (diff.type === "addRule" /* addRule */) {
|
|
20895
|
+
const item = payload.item;
|
|
20896
|
+
log(source_default.green(` + ${item.content}`));
|
|
20897
|
+
return;
|
|
20898
|
+
}
|
|
20899
|
+
if (diff.type === "deleteRule" /* deleteRule */) {
|
|
20900
|
+
const item = payload.item;
|
|
20901
|
+
log(source_default.red(` - ${item.content}`));
|
|
20902
|
+
return;
|
|
20903
|
+
}
|
|
20904
|
+
if (diff.type === "updateSkillAdditionalProperty" /* updateSkillAdditionalProperty */) {
|
|
20905
|
+
const lines2 = formatAdditionalPropertyDiff(
|
|
20906
|
+
payload.targetId,
|
|
20907
|
+
payload.oldValue,
|
|
20908
|
+
payload.newValue
|
|
20909
|
+
);
|
|
20910
|
+
for (const line of lines2) {
|
|
20911
|
+
log(
|
|
20912
|
+
line.type === "removed" ? source_default.red(` - ${line.text}`) : source_default.green(` + ${line.text}`)
|
|
21285
20913
|
);
|
|
21286
20914
|
}
|
|
21287
|
-
exit(1);
|
|
21288
20915
|
return;
|
|
21289
20916
|
}
|
|
21290
|
-
|
|
21291
|
-
const
|
|
21292
|
-
|
|
21293
|
-
|
|
20917
|
+
const oldValue = payload.oldValue;
|
|
20918
|
+
const newValue = payload.newValue;
|
|
20919
|
+
const { lines } = formatContentDiff(oldValue, newValue);
|
|
20920
|
+
for (const line of lines) {
|
|
20921
|
+
log(line);
|
|
21294
20922
|
}
|
|
21295
|
-
|
|
21296
|
-
|
|
20923
|
+
}
|
|
20924
|
+
function formatSubmittedDate(isoDate) {
|
|
20925
|
+
const date = new Date(isoDate);
|
|
20926
|
+
const datePart = date.toLocaleDateString("en-US", {
|
|
20927
|
+
year: "numeric",
|
|
20928
|
+
month: "short",
|
|
20929
|
+
day: "numeric"
|
|
20930
|
+
});
|
|
20931
|
+
const timePart = date.toLocaleTimeString("en-US", {
|
|
20932
|
+
hour: "numeric",
|
|
20933
|
+
minute: "2-digit",
|
|
20934
|
+
hour12: true
|
|
20935
|
+
});
|
|
20936
|
+
return `${datePart} ${timePart}`;
|
|
20937
|
+
}
|
|
20938
|
+
function buildSubmittedFooter(submittedDiffs) {
|
|
20939
|
+
const proposalCount = submittedDiffs.length;
|
|
20940
|
+
const proposalWord = proposalCount === 1 ? "change proposal" : "change proposals";
|
|
20941
|
+
return `${proposalCount} ${proposalWord} ignored, run \`packmind-cli diff --include-submitted\` to see what's waiting for validation`;
|
|
20942
|
+
}
|
|
20943
|
+
async function findTargetDirectories(searchPath, packmindCliHexa) {
|
|
20944
|
+
const targets = [];
|
|
20945
|
+
const exists = await packmindCliHexa.configExists(searchPath);
|
|
20946
|
+
if (exists) {
|
|
20947
|
+
targets.push(searchPath);
|
|
21297
20948
|
}
|
|
21298
|
-
|
|
21299
|
-
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21303
|
-
|
|
21304
|
-
|
|
20949
|
+
const descendants = await packmindCliHexa.findDescendantConfigs(searchPath);
|
|
20950
|
+
for (const dir of descendants) {
|
|
20951
|
+
if (!targets.includes(dir)) {
|
|
20952
|
+
targets.push(dir);
|
|
20953
|
+
}
|
|
20954
|
+
}
|
|
20955
|
+
if (targets.length === 0) {
|
|
20956
|
+
let currentDir = nodePath.dirname(searchPath);
|
|
20957
|
+
while (true) {
|
|
20958
|
+
const ancestorExists = await packmindCliHexa.configExists(currentDir);
|
|
20959
|
+
if (ancestorExists) {
|
|
20960
|
+
targets.push(currentDir);
|
|
20961
|
+
break;
|
|
20962
|
+
}
|
|
20963
|
+
const parentDir = nodePath.dirname(currentDir);
|
|
20964
|
+
if (parentDir === currentDir) {
|
|
20965
|
+
break;
|
|
20966
|
+
}
|
|
20967
|
+
currentDir = parentDir;
|
|
20968
|
+
}
|
|
20969
|
+
}
|
|
20970
|
+
return targets;
|
|
20971
|
+
}
|
|
20972
|
+
function computeRelativePath(targetAbsDir, gitRoot) {
|
|
20973
|
+
const rel = nodePath.relative(gitRoot, targetAbsDir);
|
|
20974
|
+
if (rel.startsWith("..")) return "/";
|
|
20975
|
+
return rel ? `/${rel}/` : "/";
|
|
20976
|
+
}
|
|
20977
|
+
async function collectGitInfo(deps) {
|
|
20978
|
+
const { packmindCliHexa, exit, getCwd } = deps;
|
|
20979
|
+
const cwd = getCwd();
|
|
20980
|
+
let gitRemoteUrl;
|
|
20981
|
+
let gitBranch;
|
|
20982
|
+
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
|
|
20983
|
+
if (gitRoot) {
|
|
20984
|
+
try {
|
|
20985
|
+
gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
|
|
20986
|
+
gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
|
|
20987
|
+
} catch (err) {
|
|
20988
|
+
logWarningConsole(
|
|
20989
|
+
`Failed to collect git info: ${err instanceof Error ? err.message : String(err)}`
|
|
20990
|
+
);
|
|
20991
|
+
}
|
|
20992
|
+
}
|
|
20993
|
+
if (!gitRemoteUrl || !gitBranch || !gitRoot) {
|
|
20994
|
+
logErrorConsole(
|
|
20995
|
+
"Could not determine git repository info. The diff command requires a git repository with a remote configured."
|
|
21305
20996
|
);
|
|
21306
|
-
|
|
21307
|
-
|
|
20997
|
+
exit(1);
|
|
20998
|
+
return null;
|
|
21308
20999
|
}
|
|
21309
|
-
|
|
21000
|
+
return { gitRemoteUrl, gitBranch, gitRoot };
|
|
21310
21001
|
}
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21323
|
-
|
|
21324
|
-
|
|
21325
|
-
which.sync(cmd);
|
|
21326
|
-
return true;
|
|
21327
|
-
} catch {
|
|
21328
|
-
return false;
|
|
21002
|
+
function extractUniqueAndSortedArtefacts(groups) {
|
|
21003
|
+
const typeSortOrder = {
|
|
21004
|
+
command: 0,
|
|
21005
|
+
skill: 1,
|
|
21006
|
+
standard: 2
|
|
21007
|
+
};
|
|
21008
|
+
const uniqueArtefacts = /* @__PURE__ */ new Map();
|
|
21009
|
+
for (const [key, groupDiffs] of groups) {
|
|
21010
|
+
if (!uniqueArtefacts.has(key)) {
|
|
21011
|
+
uniqueArtefacts.set(key, {
|
|
21012
|
+
type: groupDiffs[0].artifactType,
|
|
21013
|
+
name: groupDiffs[0].artifactName
|
|
21014
|
+
});
|
|
21015
|
+
}
|
|
21329
21016
|
}
|
|
21017
|
+
const sortedArtefacts = Array.from(uniqueArtefacts.values()).sort(
|
|
21018
|
+
(a, b) => typeSortOrder[a.type] - typeSortOrder[b.type] || a.name.localeCompare(b.name, void 0, { sensitivity: "base" })
|
|
21019
|
+
);
|
|
21020
|
+
return sortedArtefacts;
|
|
21330
21021
|
}
|
|
21331
|
-
function
|
|
21332
|
-
|
|
21333
|
-
|
|
21022
|
+
function displayDiffs(params) {
|
|
21023
|
+
const {
|
|
21024
|
+
diffsToDisplay,
|
|
21025
|
+
displayPathMap,
|
|
21026
|
+
submittedLookup,
|
|
21027
|
+
includeSubmitted,
|
|
21028
|
+
unsubmittedItems,
|
|
21029
|
+
submittedItems,
|
|
21030
|
+
log
|
|
21031
|
+
} = params;
|
|
21032
|
+
log(formatHeader(`
|
|
21033
|
+
Changes found:
|
|
21034
|
+
`));
|
|
21035
|
+
const groups = groupDiffsByArtefact(diffsToDisplay);
|
|
21036
|
+
for (const [, groupDiffs] of groups) {
|
|
21037
|
+
const { artifactType, artifactName } = groupDiffs[0];
|
|
21038
|
+
const typeLabel = ARTIFACT_TYPE_LABELS[artifactType];
|
|
21039
|
+
log(formatBold(`${typeLabel} "${artifactName}"`));
|
|
21040
|
+
const subGroups = subGroupByChangeContent(groupDiffs);
|
|
21041
|
+
for (const subGroup of subGroups) {
|
|
21042
|
+
for (const diff of subGroup) {
|
|
21043
|
+
log(` ${formatFilePath(displayPathMap.get(diff) ?? diff.filePath)}`);
|
|
21044
|
+
}
|
|
21045
|
+
const label = CHANGE_PROPOSAL_TYPE_LABELS[subGroup[0].type] ?? "content changed";
|
|
21046
|
+
const checkItem = submittedLookup.get(subGroup[0]);
|
|
21047
|
+
if (includeSubmitted && checkItem?.exists && checkItem.createdAt) {
|
|
21048
|
+
const dateStr = formatSubmittedDate(checkItem.createdAt);
|
|
21049
|
+
const messageSuffix = checkItem.message ? ` "${checkItem.message.length > 50 ? checkItem.message.slice(0, 50) + "..." : checkItem.message}"` : "";
|
|
21050
|
+
log(
|
|
21051
|
+
` - ${label} ${source_default.dim(`[already submitted on ${dateStr}${messageSuffix}]`)}`
|
|
21052
|
+
);
|
|
21053
|
+
} else {
|
|
21054
|
+
log(` - ${label}`);
|
|
21055
|
+
}
|
|
21056
|
+
formatDiffPayload(subGroup[0], log);
|
|
21057
|
+
}
|
|
21058
|
+
log("");
|
|
21334
21059
|
}
|
|
21335
|
-
|
|
21336
|
-
|
|
21060
|
+
const changeCount = diffsToDisplay.length;
|
|
21061
|
+
const changeWord = changeCount === 1 ? "change" : "changes";
|
|
21062
|
+
const sortedArtefacts = extractUniqueAndSortedArtefacts(groups);
|
|
21063
|
+
const artefactCount = sortedArtefacts.length;
|
|
21064
|
+
const artefactWord = artefactCount === 1 ? "artefact" : "artefacts";
|
|
21065
|
+
const allSubmittedSuffix = includeSubmitted && unsubmittedItems.length === 0 ? " (all already submitted)" : "";
|
|
21066
|
+
logWarningConsole(
|
|
21067
|
+
`Summary: ${changeCount} ${changeWord} found on ${artefactCount} ${artefactWord}${allSubmittedSuffix}:`
|
|
21068
|
+
);
|
|
21069
|
+
for (const artefact of sortedArtefacts) {
|
|
21070
|
+
const typeLabel = ARTIFACT_TYPE_LABELS[artefact.type];
|
|
21071
|
+
const key = `${artefact.type}:${artefact.name}`;
|
|
21072
|
+
const artefactDiffs = groups.get(key) ?? [];
|
|
21073
|
+
const allDiffsSubmitted = includeSubmitted && artefactDiffs.length > 0 && artefactDiffs.every((d) => submittedLookup.get(d)?.exists);
|
|
21074
|
+
const suffix = allDiffsSubmitted ? " (all already submitted)" : "";
|
|
21075
|
+
logWarningConsole(`* ${typeLabel} "${artefact.name}"${suffix}`);
|
|
21337
21076
|
}
|
|
21338
|
-
|
|
21339
|
-
|
|
21340
|
-
if (isAvailable(candidate)) {
|
|
21341
|
-
return candidate;
|
|
21342
|
-
}
|
|
21077
|
+
if (!includeSubmitted && submittedItems.length > 0) {
|
|
21078
|
+
logInfoConsole(buildSubmittedFooter(submittedItems));
|
|
21343
21079
|
}
|
|
21344
|
-
|
|
21080
|
+
return changeCount;
|
|
21345
21081
|
}
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
# An empty message aborts the submission.
|
|
21352
|
-
`;
|
|
21353
|
-
function openEditorForMessage(prefill) {
|
|
21354
|
-
const editor = resolveEditor();
|
|
21355
|
-
const tmpFile = (0, import_path8.join)((0, import_os2.tmpdir)(), `packmind-msg-${Date.now()}.txt`);
|
|
21356
|
-
try {
|
|
21357
|
-
(0, import_fs27.writeFileSync)(tmpFile, prefill ?? EDITOR_TEMPLATE, "utf-8");
|
|
21358
|
-
const result = (0, import_child_process3.spawnSync)(editor, [tmpFile], {
|
|
21359
|
-
stdio: "inherit"
|
|
21360
|
-
});
|
|
21361
|
-
if (result.status !== 0) {
|
|
21362
|
-
throw new Error(`Editor exited with status ${result.status}`);
|
|
21363
|
-
}
|
|
21364
|
-
const content = (0, import_fs27.readFileSync)(tmpFile, "utf-8");
|
|
21365
|
-
return content.split("\n").filter((line) => !line.startsWith("#")).join("\n").trim();
|
|
21366
|
-
} finally {
|
|
21082
|
+
async function diffArtefactsHandler(deps) {
|
|
21083
|
+
const { packmindCliHexa, exit, getCwd, log, includeSubmitted } = deps;
|
|
21084
|
+
const cwd = getCwd();
|
|
21085
|
+
const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
|
|
21086
|
+
if (deps.path !== void 0) {
|
|
21367
21087
|
try {
|
|
21368
|
-
|
|
21088
|
+
await fs27.stat(searchPath);
|
|
21369
21089
|
} catch {
|
|
21090
|
+
logErrorConsole(`Path does not exist: ${searchPath}`);
|
|
21091
|
+
exit(1);
|
|
21092
|
+
return { diffsFound: 0 };
|
|
21370
21093
|
}
|
|
21371
21094
|
}
|
|
21372
|
-
|
|
21373
|
-
|
|
21374
|
-
// apps/cli/src/infra/commands/playbook/safeOpenEditor.ts
|
|
21375
|
-
function safeOpenEditor(prefill) {
|
|
21095
|
+
let targetDirs;
|
|
21376
21096
|
try {
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21097
|
+
targetDirs = await findTargetDirectories(searchPath, packmindCliHexa);
|
|
21098
|
+
} catch (err) {
|
|
21099
|
+
logErrorConsole(
|
|
21100
|
+
`Failed to discover target directories: ${err instanceof Error ? err.message : String(err)}`
|
|
21101
|
+
);
|
|
21102
|
+
exit(1);
|
|
21103
|
+
return { diffsFound: 0 };
|
|
21383
21104
|
}
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
name: "submit",
|
|
21389
|
-
description: "Submit staged changes as proposals",
|
|
21390
|
-
args: {
|
|
21391
|
-
message: (0, import_cmd_ts31.option)({
|
|
21392
|
-
type: (0, import_cmd_ts31.optional)(import_cmd_ts31.string),
|
|
21393
|
-
long: "message",
|
|
21394
|
-
short: "m",
|
|
21395
|
-
description: "Message describing the intent behind the proposed changes"
|
|
21396
|
-
}),
|
|
21397
|
-
noReview: (0, import_cmd_ts31.flag)({
|
|
21398
|
-
long: "no-review",
|
|
21399
|
-
description: "Apply changes directly without creating proposals for review"
|
|
21400
|
-
})
|
|
21401
|
-
},
|
|
21402
|
-
handler: async ({ message, noReview }) => {
|
|
21403
|
-
const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
|
|
21404
|
-
const packmindCliHexa = new PackmindCliHexa(packmindLogger);
|
|
21405
|
-
const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(
|
|
21406
|
-
process.cwd()
|
|
21105
|
+
if (targetDirs.length === 0) {
|
|
21106
|
+
const hierarchicalConfig = await packmindCliHexa.readHierarchicalConfig(
|
|
21107
|
+
cwd,
|
|
21108
|
+
null
|
|
21407
21109
|
);
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
-
|
|
21413
|
-
|
|
21414
|
-
|
|
21415
|
-
|
|
21416
|
-
|
|
21417
|
-
|
|
21418
|
-
|
|
21419
|
-
|
|
21420
|
-
|
|
21421
|
-
|
|
21110
|
+
if (!hierarchicalConfig.hasConfigs) {
|
|
21111
|
+
logErrorConsole(
|
|
21112
|
+
"Not inside a Packmind project. No packmind.json found in the current directory or any parent directory."
|
|
21113
|
+
);
|
|
21114
|
+
exit(1);
|
|
21115
|
+
} else {
|
|
21116
|
+
log("No Packmind targets found under the current directory.");
|
|
21117
|
+
exit(0);
|
|
21118
|
+
}
|
|
21119
|
+
return { diffsFound: 0 };
|
|
21120
|
+
}
|
|
21121
|
+
try {
|
|
21122
|
+
const gitInfo = await collectGitInfo(deps);
|
|
21123
|
+
if (!gitInfo) {
|
|
21124
|
+
return { diffsFound: 0 };
|
|
21125
|
+
}
|
|
21126
|
+
const { gitRemoteUrl, gitBranch, gitRoot } = gitInfo;
|
|
21127
|
+
const targetResults = [];
|
|
21128
|
+
for (const targetDir of targetDirs) {
|
|
21129
|
+
const config = await packmindCliHexa.readFullConfig(targetDir);
|
|
21130
|
+
if (!config) continue;
|
|
21131
|
+
const configPackages = Object.keys(config.packages);
|
|
21132
|
+
if (configPackages.length === 0) continue;
|
|
21133
|
+
const relativePath = computeRelativePath(targetDir, gitRoot);
|
|
21134
|
+
const targetRelativePath = nodePath.relative(cwd, targetDir);
|
|
21135
|
+
if (targetDirs.length > 1) {
|
|
21136
|
+
log("");
|
|
21137
|
+
logInfoConsole(`Target: ${targetRelativePath}`);
|
|
21138
|
+
}
|
|
21139
|
+
const packageCount = configPackages.length;
|
|
21140
|
+
const packageWord = packageCount === 1 ? "package" : "packages";
|
|
21141
|
+
logInfoConsole(
|
|
21142
|
+
`Comparing ${packageCount} ${packageWord}: ${configPackages.join(", ")}...`
|
|
21143
|
+
);
|
|
21144
|
+
const diffs = await packmindCliHexa.diffArtefacts({
|
|
21145
|
+
baseDirectory: targetDir,
|
|
21146
|
+
packagesSlugs: configPackages,
|
|
21147
|
+
gitRemoteUrl,
|
|
21148
|
+
gitBranch,
|
|
21149
|
+
relativePath,
|
|
21150
|
+
agents: config.agents
|
|
21151
|
+
});
|
|
21152
|
+
const filterPrefix = nodePath.relative(targetDir, searchPath);
|
|
21153
|
+
const filteredDiffs = filterPrefix !== "" && !filterPrefix.startsWith("..") ? diffs.filter(
|
|
21154
|
+
(d) => d.filePath === filterPrefix || d.filePath.startsWith(filterPrefix + "/")
|
|
21155
|
+
) : diffs;
|
|
21156
|
+
targetResults.push({ targetRelativePath, diffs: filteredDiffs });
|
|
21157
|
+
}
|
|
21158
|
+
if (targetResults.length === 0) {
|
|
21159
|
+
log("No packages configured in any target.");
|
|
21160
|
+
exit(0);
|
|
21161
|
+
return { diffsFound: 0 };
|
|
21162
|
+
}
|
|
21163
|
+
const displayPathMap = /* @__PURE__ */ new Map();
|
|
21164
|
+
for (const { targetRelativePath, diffs } of targetResults) {
|
|
21165
|
+
for (const diff of diffs) {
|
|
21166
|
+
displayPathMap.set(
|
|
21167
|
+
diff,
|
|
21168
|
+
targetRelativePath ? `${targetRelativePath}/${diff.filePath}` : diff.filePath
|
|
21169
|
+
);
|
|
21170
|
+
}
|
|
21171
|
+
}
|
|
21172
|
+
const allDiffs = targetResults.flatMap((r) => r.diffs);
|
|
21173
|
+
if (allDiffs.length === 0) {
|
|
21174
|
+
log("No changes found.");
|
|
21175
|
+
exit(0);
|
|
21176
|
+
return { diffsFound: 0 };
|
|
21177
|
+
}
|
|
21178
|
+
const allGroupedDiffs = Array.from(groupDiffsByArtefact(allDiffs).values());
|
|
21179
|
+
const checkResult = await packmindCliHexa.checkDiffs(allGroupedDiffs);
|
|
21180
|
+
const submittedItems = checkResult.results.filter((r) => r.exists);
|
|
21181
|
+
const unsubmittedItems = checkResult.results.filter((r) => !r.exists);
|
|
21182
|
+
const diffsToDisplay = includeSubmitted ? allDiffs : unsubmittedItems.map((r) => r.diff);
|
|
21183
|
+
const submittedLookup = /* @__PURE__ */ new Map();
|
|
21184
|
+
for (const item of checkResult.results) {
|
|
21185
|
+
submittedLookup.set(item.diff, item);
|
|
21186
|
+
}
|
|
21187
|
+
if (diffsToDisplay.length === 0) {
|
|
21188
|
+
log("No new changes found.");
|
|
21189
|
+
if (submittedItems.length > 0) {
|
|
21190
|
+
logInfoConsole(buildSubmittedFooter(submittedItems));
|
|
21191
|
+
}
|
|
21192
|
+
exit(0);
|
|
21193
|
+
return { diffsFound: 0 };
|
|
21194
|
+
}
|
|
21195
|
+
const changeCount = displayDiffs({
|
|
21196
|
+
diffsToDisplay,
|
|
21197
|
+
displayPathMap,
|
|
21198
|
+
submittedLookup,
|
|
21199
|
+
includeSubmitted,
|
|
21200
|
+
unsubmittedItems,
|
|
21201
|
+
submittedItems,
|
|
21202
|
+
log
|
|
21422
21203
|
});
|
|
21204
|
+
exit(0);
|
|
21205
|
+
return { diffsFound: changeCount };
|
|
21206
|
+
} catch (err) {
|
|
21207
|
+
if (err instanceof Error) {
|
|
21208
|
+
logErrorConsole(err.message);
|
|
21209
|
+
} else {
|
|
21210
|
+
logErrorConsole(String(err));
|
|
21211
|
+
}
|
|
21212
|
+
exit(1);
|
|
21213
|
+
return { diffsFound: 0 };
|
|
21423
21214
|
}
|
|
21424
|
-
}
|
|
21215
|
+
}
|
|
21425
21216
|
|
|
21426
21217
|
// apps/cli/src/infra/commands/playbook/DiffCommand.ts
|
|
21427
|
-
var
|
|
21428
|
-
var diffCommand2 = (0, import_cmd_ts32.command)({
|
|
21218
|
+
var diffCommand = (0, import_cmd_ts28.command)({
|
|
21429
21219
|
name: "diff",
|
|
21430
21220
|
description: "Show differences between local command files and server content",
|
|
21431
21221
|
args: {
|
|
21432
|
-
includeSubmitted: (0,
|
|
21222
|
+
includeSubmitted: (0, import_cmd_ts28.flag)({
|
|
21433
21223
|
long: "include-submitted",
|
|
21434
21224
|
description: "Include already submitted changes in the output"
|
|
21435
21225
|
}),
|
|
21436
|
-
path: (0,
|
|
21226
|
+
path: (0, import_cmd_ts28.option)({
|
|
21437
21227
|
long: "path",
|
|
21438
21228
|
short: "p",
|
|
21439
21229
|
description: "Path to analyze (relative to current directory)",
|
|
21440
|
-
type: (0,
|
|
21230
|
+
type: (0, import_cmd_ts28.optional)(import_cmd_ts28.string)
|
|
21441
21231
|
})
|
|
21442
21232
|
},
|
|
21443
21233
|
handler: async ({ includeSubmitted, path: path37 }) => {
|
|
@@ -21455,24 +21245,24 @@ var diffCommand2 = (0, import_cmd_ts32.command)({
|
|
|
21455
21245
|
});
|
|
21456
21246
|
|
|
21457
21247
|
// apps/cli/src/infra/commands/PlaybookCommand.ts
|
|
21458
|
-
var playbookCommand = (0,
|
|
21248
|
+
var playbookCommand = (0, import_cmd_ts29.subcommands)({
|
|
21459
21249
|
name: "playbook",
|
|
21460
21250
|
description: "Manage local playbook files and propose changes to your team",
|
|
21461
21251
|
cmds: {
|
|
21462
21252
|
add: addPlaybookCommand,
|
|
21463
21253
|
rm: rmPlaybookCommand,
|
|
21464
21254
|
unstage: unstagePlaybookCommand,
|
|
21465
|
-
diff:
|
|
21255
|
+
diff: diffCommand,
|
|
21466
21256
|
status: statusPlaybookCommand,
|
|
21467
21257
|
submit: submitPlaybookCommand
|
|
21468
21258
|
}
|
|
21469
21259
|
});
|
|
21470
21260
|
|
|
21471
21261
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
21472
|
-
var
|
|
21262
|
+
var import_cmd_ts31 = __toESM(require_cjs());
|
|
21473
21263
|
|
|
21474
21264
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
21475
|
-
var
|
|
21265
|
+
var import_cmd_ts30 = __toESM(require_cjs());
|
|
21476
21266
|
|
|
21477
21267
|
// apps/cli/src/infra/commands/spaces/listSpacesHandler.ts
|
|
21478
21268
|
function displaySpace(space) {
|
|
@@ -21508,7 +21298,7 @@ async function listSpacesHandler(deps) {
|
|
|
21508
21298
|
}
|
|
21509
21299
|
|
|
21510
21300
|
// apps/cli/src/infra/commands/ListSpacesCommand.ts
|
|
21511
|
-
var listSpacesCommand = (0,
|
|
21301
|
+
var listSpacesCommand = (0, import_cmd_ts30.command)({
|
|
21512
21302
|
name: "list",
|
|
21513
21303
|
description: "List available spaces in the organization",
|
|
21514
21304
|
args: {},
|
|
@@ -21523,7 +21313,7 @@ var listSpacesCommand = (0, import_cmd_ts34.command)({
|
|
|
21523
21313
|
});
|
|
21524
21314
|
|
|
21525
21315
|
// apps/cli/src/infra/commands/SpacesCommand.ts
|
|
21526
|
-
var spacesCommand = (0,
|
|
21316
|
+
var spacesCommand = (0, import_cmd_ts31.subcommands)({
|
|
21527
21317
|
name: "spaces",
|
|
21528
21318
|
description: "Manage spaces in your Packmind organization",
|
|
21529
21319
|
cmds: {
|
|
@@ -21532,17 +21322,17 @@ var spacesCommand = (0, import_cmd_ts35.subcommands)({
|
|
|
21532
21322
|
});
|
|
21533
21323
|
|
|
21534
21324
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
21535
|
-
var
|
|
21325
|
+
var import_cmd_ts37 = __toESM(require_cjs());
|
|
21536
21326
|
|
|
21537
21327
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
21538
|
-
var
|
|
21328
|
+
var import_cmd_ts36 = __toESM(require_cjs());
|
|
21539
21329
|
|
|
21540
21330
|
// apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
|
|
21541
21331
|
var readline5 = __toESM(require("readline"));
|
|
21542
|
-
var
|
|
21332
|
+
var import_cmd_ts33 = __toESM(require_cjs());
|
|
21543
21333
|
|
|
21544
21334
|
// apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
|
|
21545
|
-
var
|
|
21335
|
+
var import_cmd_ts32 = __toESM(require_cjs());
|
|
21546
21336
|
|
|
21547
21337
|
// apps/cli/src/infra/commands/customParameters/AgentArgType.ts
|
|
21548
21338
|
var VALID_AGENTS = Object.keys(CodingAgents).filter(
|
|
@@ -21561,7 +21351,7 @@ var AgentArgType = {
|
|
|
21561
21351
|
};
|
|
21562
21352
|
|
|
21563
21353
|
// apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
|
|
21564
|
-
var agentNamesPositional = (0,
|
|
21354
|
+
var agentNamesPositional = (0, import_cmd_ts32.restPositionals)({
|
|
21565
21355
|
type: AgentArgType,
|
|
21566
21356
|
displayName: "agents",
|
|
21567
21357
|
description: "Agent identifiers (e.g. claude cursor)"
|
|
@@ -21667,12 +21457,12 @@ function createPromptConfirm() {
|
|
|
21667
21457
|
});
|
|
21668
21458
|
});
|
|
21669
21459
|
}
|
|
21670
|
-
var addAgentsCommand = (0,
|
|
21460
|
+
var addAgentsCommand = (0, import_cmd_ts33.command)({
|
|
21671
21461
|
name: "add",
|
|
21672
21462
|
description: "Add coding agents to packmind.json files",
|
|
21673
21463
|
args: {
|
|
21674
|
-
path: (0,
|
|
21675
|
-
type:
|
|
21464
|
+
path: (0, import_cmd_ts33.option)({
|
|
21465
|
+
type: import_cmd_ts33.string,
|
|
21676
21466
|
short: "p",
|
|
21677
21467
|
long: "path",
|
|
21678
21468
|
defaultValue: () => "",
|
|
@@ -21698,7 +21488,7 @@ var addAgentsCommand = (0, import_cmd_ts37.command)({
|
|
|
21698
21488
|
});
|
|
21699
21489
|
|
|
21700
21490
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
21701
|
-
var
|
|
21491
|
+
var import_cmd_ts34 = __toESM(require_cjs());
|
|
21702
21492
|
|
|
21703
21493
|
// apps/cli/src/infra/commands/config/agents/listAgentsHandler.ts
|
|
21704
21494
|
var SOURCE_LABELS = {
|
|
@@ -21778,12 +21568,12 @@ async function listAgentsHandler(args2, deps) {
|
|
|
21778
21568
|
}
|
|
21779
21569
|
|
|
21780
21570
|
// apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
|
|
21781
|
-
var listAgentsCommand = (0,
|
|
21571
|
+
var listAgentsCommand = (0, import_cmd_ts34.command)({
|
|
21782
21572
|
name: "list",
|
|
21783
21573
|
description: "List coding agents configured across packmind.json files",
|
|
21784
21574
|
args: {
|
|
21785
|
-
path: (0,
|
|
21786
|
-
type:
|
|
21575
|
+
path: (0, import_cmd_ts34.option)({
|
|
21576
|
+
type: import_cmd_ts34.string,
|
|
21787
21577
|
short: "p",
|
|
21788
21578
|
long: "path",
|
|
21789
21579
|
defaultValue: () => "",
|
|
@@ -21807,7 +21597,7 @@ var listAgentsCommand = (0, import_cmd_ts38.command)({
|
|
|
21807
21597
|
});
|
|
21808
21598
|
|
|
21809
21599
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
21810
|
-
var
|
|
21600
|
+
var import_cmd_ts35 = __toESM(require_cjs());
|
|
21811
21601
|
|
|
21812
21602
|
// apps/cli/src/infra/commands/config/agents/removeAgentsHandler.ts
|
|
21813
21603
|
async function removeAgentsHandler(args2, deps) {
|
|
@@ -21890,13 +21680,13 @@ function logConfiguredAgentsHint(configuredAgents) {
|
|
|
21890
21680
|
}
|
|
21891
21681
|
|
|
21892
21682
|
// apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
|
|
21893
|
-
var removeAgentsCommand = (0,
|
|
21683
|
+
var removeAgentsCommand = (0, import_cmd_ts35.command)({
|
|
21894
21684
|
name: "rm",
|
|
21895
21685
|
aliases: ["remove"],
|
|
21896
21686
|
description: "Remove coding agents from packmind.json files",
|
|
21897
21687
|
args: {
|
|
21898
|
-
path: (0,
|
|
21899
|
-
type:
|
|
21688
|
+
path: (0, import_cmd_ts35.option)({
|
|
21689
|
+
type: import_cmd_ts35.string,
|
|
21900
21690
|
short: "p",
|
|
21901
21691
|
long: "path",
|
|
21902
21692
|
defaultValue: () => "",
|
|
@@ -21918,7 +21708,7 @@ var removeAgentsCommand = (0, import_cmd_ts39.command)({
|
|
|
21918
21708
|
});
|
|
21919
21709
|
|
|
21920
21710
|
// apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
|
|
21921
|
-
var configAgentsSetupCommand = (0,
|
|
21711
|
+
var configAgentsSetupCommand = (0, import_cmd_ts36.command)({
|
|
21922
21712
|
name: "setup",
|
|
21923
21713
|
description: "Configure which coding agents to generate artifacts for",
|
|
21924
21714
|
args: {},
|
|
@@ -21936,7 +21726,7 @@ var configAgentsSetupCommand = (0, import_cmd_ts40.command)({
|
|
|
21936
21726
|
});
|
|
21937
21727
|
}
|
|
21938
21728
|
});
|
|
21939
|
-
var configAgentsCommand = (0,
|
|
21729
|
+
var configAgentsCommand = (0, import_cmd_ts36.subcommands)({
|
|
21940
21730
|
name: "agents",
|
|
21941
21731
|
description: "Manage coding agents configuration",
|
|
21942
21732
|
cmds: {
|
|
@@ -21948,7 +21738,7 @@ var configAgentsCommand = (0, import_cmd_ts40.subcommands)({
|
|
|
21948
21738
|
});
|
|
21949
21739
|
|
|
21950
21740
|
// apps/cli/src/infra/commands/config/ConfigCommand.ts
|
|
21951
|
-
var configCommand = (0,
|
|
21741
|
+
var configCommand = (0, import_cmd_ts37.subcommands)({
|
|
21952
21742
|
name: "config",
|
|
21953
21743
|
description: "Manage Packmind configuration",
|
|
21954
21744
|
cmds: {
|
|
@@ -21957,9 +21747,9 @@ var configCommand = (0, import_cmd_ts41.subcommands)({
|
|
|
21957
21747
|
});
|
|
21958
21748
|
|
|
21959
21749
|
// apps/cli/src/infra/commands/InitCommand.ts
|
|
21960
|
-
var
|
|
21750
|
+
var import_cmd_ts38 = __toESM(require_cjs());
|
|
21961
21751
|
var { version: CLI_VERSION5 } = require_package();
|
|
21962
|
-
var initCommand = (0,
|
|
21752
|
+
var initCommand = (0, import_cmd_ts38.command)({
|
|
21963
21753
|
name: "init",
|
|
21964
21754
|
description: "Initialize Packmind in the current project",
|
|
21965
21755
|
args: {},
|
|
@@ -21988,13 +21778,13 @@ var initCommand = (0, import_cmd_ts42.command)({
|
|
|
21988
21778
|
});
|
|
21989
21779
|
|
|
21990
21780
|
// apps/cli/src/infra/commands/UpdateCommand.ts
|
|
21991
|
-
var
|
|
21781
|
+
var import_cmd_ts39 = __toESM(require_cjs());
|
|
21992
21782
|
var { version: CLI_VERSION6 } = require_package();
|
|
21993
|
-
var updateCommand = (0,
|
|
21783
|
+
var updateCommand = (0, import_cmd_ts39.command)({
|
|
21994
21784
|
name: "update",
|
|
21995
21785
|
description: "Update packmind-cli to the latest version",
|
|
21996
21786
|
args: {
|
|
21997
|
-
check: (0,
|
|
21787
|
+
check: (0, import_cmd_ts39.flag)({
|
|
21998
21788
|
long: "check",
|
|
21999
21789
|
description: "Only check if a newer version is available without performing the update"
|
|
22000
21790
|
})
|
|
@@ -22052,13 +21842,12 @@ if (args.includes("--version") || args.includes("-v")) {
|
|
|
22052
21842
|
logConsole(`packmind-cli version ${CLI_VERSION7}`);
|
|
22053
21843
|
process.exit(0);
|
|
22054
21844
|
}
|
|
22055
|
-
var app = (0,
|
|
21845
|
+
var app = (0, import_cmd_ts40.subcommands)({
|
|
22056
21846
|
name: "packmind-cli",
|
|
22057
21847
|
description: "Packmind CLI tool",
|
|
22058
21848
|
cmds: {
|
|
22059
21849
|
commands: commandsCommand,
|
|
22060
21850
|
config: configCommand,
|
|
22061
|
-
diff: diffCommand,
|
|
22062
21851
|
init: initCommand,
|
|
22063
21852
|
install: installCommand,
|
|
22064
21853
|
lint: lintCommand,
|
|
@@ -22075,7 +21864,7 @@ var app = (0, import_cmd_ts44.subcommands)({
|
|
|
22075
21864
|
whoami: whoamiCommand
|
|
22076
21865
|
}
|
|
22077
21866
|
});
|
|
22078
|
-
(0,
|
|
21867
|
+
(0, import_cmd_ts40.run)(app, args).catch((error) => {
|
|
22079
21868
|
logErrorConsole(error.message);
|
|
22080
21869
|
process.exit(1);
|
|
22081
21870
|
});
|