@packmind/cli 0.32.0 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/main.cjs +1310 -669
  2. package/package.json +3 -3
package/main.cjs CHANGED
@@ -243,9 +243,9 @@ var init_ansi_styles = __esm({
243
243
  });
244
244
 
245
245
  // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
246
- function hasFlag(flag8, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
247
- const prefix = flag8.startsWith("-") ? "" : flag8.length === 1 ? "-" : "--";
248
- const position = argv.indexOf(prefix + flag8);
246
+ function hasFlag(flag9, argv = globalThis.Deno ? globalThis.Deno.args : import_node_process.default.argv) {
247
+ const prefix = flag9.startsWith("-") ? "" : flag9.length === 1 ? "-" : "--";
248
+ const position = argv.indexOf(prefix + flag9);
249
249
  const terminatorPosition = argv.indexOf("--");
250
250
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
251
251
  }
@@ -380,32 +380,32 @@ var init_supports_color = __esm({
380
380
  });
381
381
 
382
382
  // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
383
- function stringReplaceAll(string16, substring, replacer) {
384
- let index = string16.indexOf(substring);
383
+ function stringReplaceAll(string18, substring, replacer) {
384
+ let index = string18.indexOf(substring);
385
385
  if (index === -1) {
386
- return string16;
386
+ return string18;
387
387
  }
388
388
  const substringLength = substring.length;
389
389
  let endIndex = 0;
390
390
  let returnValue = "";
391
391
  do {
392
- returnValue += string16.slice(endIndex, index) + substring + replacer;
392
+ returnValue += string18.slice(endIndex, index) + substring + replacer;
393
393
  endIndex = index + substringLength;
394
- index = string16.indexOf(substring, endIndex);
394
+ index = string18.indexOf(substring, endIndex);
395
395
  } while (index !== -1);
396
- returnValue += string16.slice(endIndex);
396
+ returnValue += string18.slice(endIndex);
397
397
  return returnValue;
398
398
  }
399
- function stringEncaseCRLFWithFirstIndex(string16, prefix, postfix, index) {
399
+ function stringEncaseCRLFWithFirstIndex(string18, prefix, postfix, index) {
400
400
  let endIndex = 0;
401
401
  let returnValue = "";
402
402
  do {
403
- const gotCR = string16[index - 1] === "\r";
404
- returnValue += string16.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
403
+ const gotCR = string18[index - 1] === "\r";
404
+ returnValue += string18.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
405
405
  endIndex = index + 1;
406
- index = string16.indexOf("\n", endIndex);
406
+ index = string18.indexOf("\n", endIndex);
407
407
  } while (index !== -1);
408
- returnValue += string16.slice(endIndex);
408
+ returnValue += string18.slice(endIndex);
409
409
  return returnValue;
410
410
  }
411
411
  var init_utilities = __esm({
@@ -564,26 +564,26 @@ var init_source = __esm({
564
564
  builder[IS_EMPTY] = _isEmpty;
565
565
  return builder;
566
566
  };
567
- applyStyle = (self, string16) => {
568
- if (self.level <= 0 || !string16) {
569
- return self[IS_EMPTY] ? "" : string16;
567
+ applyStyle = (self, string18) => {
568
+ if (self.level <= 0 || !string18) {
569
+ return self[IS_EMPTY] ? "" : string18;
570
570
  }
571
571
  let styler = self[STYLER];
572
572
  if (styler === void 0) {
573
- return string16;
573
+ return string18;
574
574
  }
575
575
  const { openAll, closeAll } = styler;
576
- if (string16.includes("\x1B")) {
576
+ if (string18.includes("\x1B")) {
577
577
  while (styler !== void 0) {
578
- string16 = stringReplaceAll(string16, styler.close, styler.open);
578
+ string18 = stringReplaceAll(string18, styler.close, styler.open);
579
579
  styler = styler.parent;
580
580
  }
581
581
  }
582
- const lfIndex = string16.indexOf("\n");
582
+ const lfIndex = string18.indexOf("\n");
583
583
  if (lfIndex !== -1) {
584
- string16 = stringEncaseCRLFWithFirstIndex(string16, closeAll, openAll, lfIndex);
584
+ string18 = stringEncaseCRLFWithFirstIndex(string18, closeAll, openAll, lfIndex);
585
585
  }
586
- return openAll + string16 + closeAll;
586
+ return openAll + string18 + closeAll;
587
587
  };
588
588
  Object.defineProperties(createChalk.prototype, styles2);
589
589
  chalk = createChalk();
@@ -776,9 +776,9 @@ var require_findOption = __commonJS({
776
776
  continue;
777
777
  }
778
778
  if (node.type === "shortOptions" && opts.shortNames.length) {
779
- for (const option18 of node.options) {
780
- if (opts.shortNames.includes(option18.key)) {
781
- result.push(option18);
779
+ for (const option20 of node.options) {
780
+ if (opts.shortNames.includes(option20.key)) {
781
+ result.push(option20);
782
782
  }
783
783
  }
784
784
  }
@@ -851,7 +851,7 @@ var require_types = __commonJS({
851
851
  "use strict";
852
852
  Object.defineProperty(exports2, "__esModule", { value: true });
853
853
  exports2.boolean = exports2.string = exports2.number = void 0;
854
- exports2.optional = optional13;
854
+ exports2.optional = optional15;
855
855
  exports2.array = array2;
856
856
  var type_1 = require_type();
857
857
  exports2.number = {
@@ -878,7 +878,7 @@ var require_types = __commonJS({
878
878
  return false;
879
879
  }
880
880
  };
881
- function optional13(t) {
881
+ function optional15(t) {
882
882
  return {
883
883
  ...t,
884
884
  defaultValue() {
@@ -944,7 +944,7 @@ var require_flag = __commonJS({
944
944
  Object.defineProperty(exports2, "__esModule", { value: true });
945
945
  exports2.boolean = void 0;
946
946
  exports2.fullFlag = fullFlag;
947
- exports2.flag = flag8;
947
+ exports2.flag = flag9;
948
948
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
949
949
  var Result = __importStar(require_Result());
950
950
  var findOption_1 = require_findOption();
@@ -1093,7 +1093,7 @@ var require_flag = __commonJS({
1093
1093
  }
1094
1094
  };
1095
1095
  }
1096
- function flag8(config) {
1096
+ function flag9(config) {
1097
1097
  return fullFlag({
1098
1098
  type: types_1.boolean,
1099
1099
  ...config
@@ -1264,7 +1264,7 @@ var require_positional = __commonJS({
1264
1264
  return mod && mod.__esModule ? mod : { "default": mod };
1265
1265
  };
1266
1266
  Object.defineProperty(exports2, "__esModule", { value: true });
1267
- exports2.positional = positional9;
1267
+ exports2.positional = positional8;
1268
1268
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1269
1269
  var Result = __importStar(require_Result());
1270
1270
  var types_1 = require_types();
@@ -1304,8 +1304,8 @@ var require_positional = __commonJS({
1304
1304
  var _a2;
1305
1305
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
1306
1306
  const defaultValueFn = (_a2 = config.defaultValue) !== null && _a2 !== void 0 ? _a2 : config.type.defaultValue;
1307
- const positional10 = positionals[0];
1308
- if (!positional10) {
1307
+ const positional9 = positionals[0];
1308
+ if (!positional9) {
1309
1309
  if (defaultValueFn) {
1310
1310
  return Result.ok(defaultValueFn());
1311
1311
  }
@@ -1318,13 +1318,13 @@ var require_positional = __commonJS({
1318
1318
  ]
1319
1319
  });
1320
1320
  }
1321
- visitedNodes.add(positional10);
1322
- const decoded = await Result.safeAsync(config.type.from(positional10.raw));
1321
+ visitedNodes.add(positional9);
1322
+ const decoded = await Result.safeAsync(config.type.from(positional9.raw));
1323
1323
  if (Result.isErr(decoded)) {
1324
1324
  return Result.err({
1325
1325
  errors: [
1326
1326
  {
1327
- nodes: [positional10],
1327
+ nodes: [positional9],
1328
1328
  message: decoded.error.message
1329
1329
  }
1330
1330
  ]
@@ -1334,7 +1334,7 @@ var require_positional = __commonJS({
1334
1334
  }
1335
1335
  };
1336
1336
  }
1337
- function positional9(config) {
1337
+ function positional8(config) {
1338
1338
  return fullPositional({
1339
1339
  type: types_1.string,
1340
1340
  ...config
@@ -1388,13 +1388,13 @@ var require_subcommands = __commonJS({
1388
1388
  return mod && mod.__esModule ? mod : { "default": mod };
1389
1389
  };
1390
1390
  Object.defineProperty(exports2, "__esModule", { value: true });
1391
- exports2.subcommands = subcommands11;
1391
+ exports2.subcommands = subcommands12;
1392
1392
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1393
1393
  var didyoumean_1 = __importDefault(require_didYouMean_1_2_1());
1394
1394
  var Result = __importStar(require_Result());
1395
1395
  var circuitbreaker_1 = require_circuitbreaker();
1396
1396
  var positional_1 = require_positional();
1397
- function subcommands11(config) {
1397
+ function subcommands12(config) {
1398
1398
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1399
1399
  const type = {
1400
1400
  async from(str) {
@@ -1412,9 +1412,9 @@ var require_subcommands = __commonJS({
1412
1412
  let errorMessage = "Not a valid subcommand name";
1413
1413
  const closeOptions = (0, didyoumean_1.default)(str, flatMap(commands, (x) => x.names));
1414
1414
  if (closeOptions) {
1415
- const option18 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
1415
+ const option20 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
1416
1416
  errorMessage += `
1417
- Did you mean ${chalk_1.default.italic(option18)}?`;
1417
+ Did you mean ${chalk_1.default.italic(option20)}?`;
1418
1418
  }
1419
1419
  throw new Error(errorMessage);
1420
1420
  }
@@ -1587,14 +1587,14 @@ var strip_ansi_exports = {};
1587
1587
  __export(strip_ansi_exports, {
1588
1588
  default: () => stripAnsi
1589
1589
  });
1590
- function stripAnsi(string16) {
1591
- if (typeof string16 !== "string") {
1592
- throw new TypeError(`Expected a \`string\`, got \`${typeof string16}\``);
1590
+ function stripAnsi(string18) {
1591
+ if (typeof string18 !== "string") {
1592
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string18}\``);
1593
1593
  }
1594
- if (!string16.includes("\x1B") && !string16.includes("\x9B")) {
1595
- return string16;
1594
+ if (!string18.includes("\x1B") && !string18.includes("\x9B")) {
1595
+ return string18;
1596
1596
  }
1597
- return string16.replace(regex, "");
1597
+ return string18.replace(regex, "");
1598
1598
  }
1599
1599
  var regex;
1600
1600
  var init_strip_ansi = __esm({
@@ -1710,12 +1710,12 @@ var require_command = __commonJS({
1710
1710
  return mod && mod.__esModule ? mod : { "default": mod };
1711
1711
  };
1712
1712
  Object.defineProperty(exports2, "__esModule", { value: true });
1713
- exports2.command = command31;
1713
+ exports2.command = command35;
1714
1714
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1715
1715
  var Result = __importStar(require_Result());
1716
1716
  var circuitbreaker_1 = require_circuitbreaker();
1717
1717
  var utils_1 = require_utils();
1718
- function command31(config) {
1718
+ function command35(config) {
1719
1719
  const argEntries = (0, utils_1.entries)(config.args);
1720
1720
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1721
1721
  return {
@@ -1793,11 +1793,11 @@ var require_command = __commonJS({
1793
1793
  }
1794
1794
  if (node.type === "forcePositional") {
1795
1795
  } else if (node.type === "shortOptions") {
1796
- for (const option18 of node.options) {
1797
- if (context.visitedNodes.has(option18)) {
1796
+ for (const option20 of node.options) {
1797
+ if (context.visitedNodes.has(option20)) {
1798
1798
  continue;
1799
1799
  }
1800
- unknownArguments.push(option18);
1800
+ unknownArguments.push(option20);
1801
1801
  }
1802
1802
  } else {
1803
1803
  unknownArguments.push(node);
@@ -1876,7 +1876,7 @@ var require_option = __commonJS({
1876
1876
  return mod && mod.__esModule ? mod : { "default": mod };
1877
1877
  };
1878
1878
  Object.defineProperty(exports2, "__esModule", { value: true });
1879
- exports2.option = option18;
1879
+ exports2.option = option20;
1880
1880
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1881
1881
  var Result = __importStar(require_Result());
1882
1882
  var findOption_1 = require_findOption();
@@ -1952,11 +1952,11 @@ var require_option = __commonJS({
1952
1952
  const valueFromEnv = config.env ? process.env[config.env] : void 0;
1953
1953
  const defaultValueFn = config.defaultValue || config.type.defaultValue;
1954
1954
  const onMissingFn = config.onMissing || config.type.onMissing;
1955
- const option19 = options[0];
1955
+ const option21 = options[0];
1956
1956
  let rawValue;
1957
1957
  let envPrefix = "";
1958
- if (option19 === null || option19 === void 0 ? void 0 : option19.value) {
1959
- rawValue = option19.value.node.raw;
1958
+ if (option21 === null || option21 === void 0 ? void 0 : option21.value) {
1959
+ rawValue = option21.value.node.raw;
1960
1960
  } else if (valueFromEnv !== void 0) {
1961
1961
  rawValue = valueFromEnv;
1962
1962
  envPrefix = `env[${chalk_1.default.italic(config.env)}]: `;
@@ -1991,7 +1991,7 @@ var require_option = __commonJS({
1991
1991
  });
1992
1992
  }
1993
1993
  } else {
1994
- const raw = (option19 === null || option19 === void 0 ? void 0 : option19.type) === "shortOption" ? `-${option19 === null || option19 === void 0 ? void 0 : option19.key}` : `--${config.long}`;
1994
+ const raw = (option21 === null || option21 === void 0 ? void 0 : option21.type) === "shortOption" ? `-${option21 === null || option21 === void 0 ? void 0 : option21.key}` : `--${config.long}`;
1995
1995
  return Result.err({
1996
1996
  errors: [
1997
1997
  {
@@ -2013,7 +2013,7 @@ var require_option = __commonJS({
2013
2013
  }
2014
2014
  };
2015
2015
  }
2016
- function option18(config) {
2016
+ function option20(config) {
2017
2017
  return fullOption({
2018
2018
  type: types_1.string,
2019
2019
  ...config
@@ -2052,12 +2052,12 @@ var require_errorBox = __commonJS({
2052
2052
  if (node.type === "shortOptions") {
2053
2053
  let failed = false;
2054
2054
  let s = "";
2055
- for (const option18 of node.options) {
2056
- if (error.nodes.includes(option18)) {
2057
- s += chalk_1.default.red(option18.raw);
2055
+ for (const option20 of node.options) {
2056
+ if (error.nodes.includes(option20)) {
2057
+ s += chalk_1.default.red(option20.raw);
2058
2058
  failed = true;
2059
2059
  } else {
2060
- s += chalk_1.default.dim(option18.raw);
2060
+ s += chalk_1.default.dim(option20.raw);
2061
2061
  }
2062
2062
  }
2063
2063
  const prefix = failed ? chalk_1.default.red("-") : chalk_1.default.dim("-");
@@ -2586,10 +2586,10 @@ var require_browser = __commonJS({
2586
2586
  var require_has_flag = __commonJS({
2587
2587
  "node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports2, module2) {
2588
2588
  "use strict";
2589
- module2.exports = (flag8, argv) => {
2589
+ module2.exports = (flag9, argv) => {
2590
2590
  argv = argv || process.argv;
2591
- const prefix = flag8.startsWith("-") ? "" : flag8.length === 1 ? "-" : "--";
2592
- const pos = argv.indexOf(prefix + flag8);
2591
+ const prefix = flag9.startsWith("-") ? "" : flag9.length === 1 ? "-" : "--";
2592
+ const pos = argv.indexOf(prefix + flag9);
2593
2593
  const terminatorPos = argv.indexOf("--");
2594
2594
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
2595
2595
  };
@@ -3090,8 +3090,8 @@ var require_tokenizer = __commonJS({
3090
3090
  tokens.push(token);
3091
3091
  overallIndex += token.raw.length;
3092
3092
  };
3093
- for (const [stringIndex, string16] of (0, utils_1.enumerate)(strings)) {
3094
- const chars = [...string16];
3093
+ for (const [stringIndex, string18] of (0, utils_1.enumerate)(strings)) {
3094
+ const chars = [...string18];
3095
3095
  for (let i = 0; i < chars.length; i++) {
3096
3096
  if (chars[i] === "-" && chars[i + 1] === "-") {
3097
3097
  push({ type: "longPrefix", raw: "--", index: overallIndex });
@@ -3224,7 +3224,7 @@ var require_restPositionals = __commonJS({
3224
3224
  };
3225
3225
  })();
3226
3226
  Object.defineProperty(exports2, "__esModule", { value: true });
3227
- exports2.restPositionals = restPositionals4;
3227
+ exports2.restPositionals = restPositionals5;
3228
3228
  var Result = __importStar(require_Result());
3229
3229
  var types_1 = require_types();
3230
3230
  function fullRestPositionals(config) {
@@ -3247,14 +3247,14 @@ var require_restPositionals = __commonJS({
3247
3247
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
3248
3248
  const results = [];
3249
3249
  const errors = [];
3250
- for (const positional9 of positionals) {
3251
- visitedNodes.add(positional9);
3252
- const decoded = await Result.safeAsync(config.type.from(positional9.raw));
3250
+ for (const positional8 of positionals) {
3251
+ visitedNodes.add(positional8);
3252
+ const decoded = await Result.safeAsync(config.type.from(positional8.raw));
3253
3253
  if (Result.isOk(decoded)) {
3254
3254
  results.push(decoded.value);
3255
3255
  } else {
3256
3256
  errors.push({
3257
- nodes: [positional9],
3257
+ nodes: [positional8],
3258
3258
  message: decoded.error.message
3259
3259
  });
3260
3260
  }
@@ -3268,7 +3268,7 @@ var require_restPositionals = __commonJS({
3268
3268
  }
3269
3269
  };
3270
3270
  }
3271
- function restPositionals4(config) {
3271
+ function restPositionals5(config) {
3272
3272
  return fullRestPositionals({
3273
3273
  type: types_1.string,
3274
3274
  ...config
@@ -3352,15 +3352,15 @@ var require_multiflag = __commonJS({
3352
3352
  longNames: [config.long],
3353
3353
  shortNames: config.short ? [config.short] : []
3354
3354
  }).filter((x) => !visitedNodes.has(x));
3355
- for (const option18 of options) {
3356
- visitedNodes.add(option18);
3355
+ for (const option20 of options) {
3356
+ visitedNodes.add(option20);
3357
3357
  }
3358
3358
  const optionValues = [];
3359
3359
  const errors = [];
3360
- for (const option18 of options) {
3361
- 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"));
3360
+ for (const option20 of options) {
3361
+ const decoded = await Result.safeAsync(flag_1.boolean.from((_b = (_a = option20.value) === null || _a === void 0 ? void 0 : _a.node.raw) !== null && _b !== void 0 ? _b : "true"));
3362
3362
  if (Result.isErr(decoded)) {
3363
- errors.push({ nodes: [option18], message: decoded.error.message });
3363
+ errors.push({ nodes: [option20], message: decoded.error.message });
3364
3364
  } else {
3365
3365
  optionValues.push(decoded.value);
3366
3366
  }
@@ -3524,16 +3524,16 @@ var require_multioption = __commonJS({
3524
3524
  });
3525
3525
  }
3526
3526
  }
3527
- for (const option18 of options) {
3528
- visitedNodes.add(option18);
3527
+ for (const option20 of options) {
3528
+ visitedNodes.add(option20);
3529
3529
  }
3530
3530
  const optionValues = [];
3531
3531
  const errors = [];
3532
3532
  const flagNodes = [];
3533
- for (const option18 of options) {
3534
- const providedValue = (_a = option18.value) === null || _a === void 0 ? void 0 : _a.node.raw;
3533
+ for (const option20 of options) {
3534
+ const providedValue = (_a = option20.value) === null || _a === void 0 ? void 0 : _a.node.raw;
3535
3535
  if (providedValue === void 0) {
3536
- flagNodes.push(option18);
3536
+ flagNodes.push(option20);
3537
3537
  continue;
3538
3538
  }
3539
3539
  optionValues.push(providedValue);
@@ -3858,7 +3858,7 @@ var require_package = __commonJS({
3858
3858
  "apps/cli/package.json"(exports2, module2) {
3859
3859
  module2.exports = {
3860
3860
  name: "@packmind/cli",
3861
- version: "0.32.0",
3861
+ version: "0.34.1",
3862
3862
  description: "A command-line interface for Packmind linting and code quality checks",
3863
3863
  private: false,
3864
3864
  bin: {
@@ -3899,11 +3899,11 @@ var require_package = __commonJS({
3899
3899
  dotenv: "^16",
3900
3900
  inquirer: "^13.0.2",
3901
3901
  "log-update": "^8.0.0",
3902
- minimatch: "^10",
3902
+ minimatch: "^10.2.6",
3903
3903
  open: "^11.0.0",
3904
3904
  semver: "^7.7.4",
3905
3905
  slug: "^11.0.0",
3906
- undici: "^7.28.0",
3906
+ undici: "^7.29.0",
3907
3907
  which: "^4.0.0",
3908
3908
  yaml: "^2.8.3"
3909
3909
  },
@@ -3915,7 +3915,7 @@ var require_package = __commonJS({
3915
3915
  });
3916
3916
 
3917
3917
  // apps/cli/src/main.ts
3918
- var import_cmd_ts41 = __toESM(require_cjs());
3918
+ var import_cmd_ts46 = __toESM(require_cjs());
3919
3919
 
3920
3920
  // apps/cli/src/infra/commands/LinterCommand.ts
3921
3921
  var import_cmd_ts = __toESM(require_cjs());
@@ -4044,6 +4044,10 @@ var PackmindEvent = class {
4044
4044
  var UserEvent = class extends PackmindEvent {
4045
4045
  };
4046
4046
 
4047
+ // packages/types/src/events/SystemEvent.ts
4048
+ var SystemEvent = class extends PackmindEvent {
4049
+ };
4050
+
4047
4051
  // packages/types/src/accounts/events/UserSignedUpEvent.ts
4048
4052
  var UserSignedUpEvent = class extends UserEvent {
4049
4053
  static {
@@ -4386,6 +4390,7 @@ var RENDER_MODE_ORDER = [
4386
4390
  "GH_COPILOT" /* GH_COPILOT */,
4387
4391
  "CLAUDE" /* CLAUDE */,
4388
4392
  "CLAUDE_PLUGIN" /* CLAUDE_PLUGIN */,
4393
+ "COPILOT_PLUGIN" /* COPILOT_PLUGIN */,
4389
4394
  "CURSOR" /* CURSOR */,
4390
4395
  "GITLAB_DUO" /* GITLAB_DUO */,
4391
4396
  "CONTINUE" /* CONTINUE */
@@ -4413,6 +4418,9 @@ var RENDER_MODE_TO_CODING_AGENT = {
4413
4418
  ["GH_COPILOT" /* GH_COPILOT */]: CodingAgents.copilot,
4414
4419
  ["CLAUDE" /* CLAUDE */]: CodingAgents.claude,
4415
4420
  ["CLAUDE_PLUGIN" /* CLAUDE_PLUGIN */]: CodingAgents.claude_plugin,
4421
+ // No dedicated CodingAgent/deployer exists yet for the Copilot plugin
4422
+ // format — wiring it up (and populating this entry) is a later task.
4423
+ ["COPILOT_PLUGIN" /* COPILOT_PLUGIN */]: void 0,
4416
4424
  ["CURSOR" /* CURSOR */]: CodingAgents.cursor,
4417
4425
  ["GITLAB_DUO" /* GITLAB_DUO */]: CodingAgents.gitlab_duo,
4418
4426
  ["CONTINUE" /* CONTINUE */]: CodingAgents.continue,
@@ -4420,6 +4428,9 @@ var RENDER_MODE_TO_CODING_AGENT = {
4420
4428
  };
4421
4429
  var CODING_AGENT_TO_RENDER_MODE = Object.entries(RENDER_MODE_TO_CODING_AGENT).reduce(
4422
4430
  (acc, [renderMode, codingAgent]) => {
4431
+ if (codingAgent === void 0) {
4432
+ return acc;
4433
+ }
4423
4434
  acc[codingAgent] = renderMode;
4424
4435
  return acc;
4425
4436
  },
@@ -4499,6 +4510,13 @@ var createGitProviderId = brandedIdFactory();
4499
4510
  // packages/types/src/git/OrganizationGitHubApp.ts
4500
4511
  var createOrganizationGitHubAppId = brandedIdFactory();
4501
4512
 
4513
+ // packages/types/src/git/events/RepositoryTrackingRemovedEvent.ts
4514
+ var RepositoryTrackingRemovedEvent = class extends UserEvent {
4515
+ static {
4516
+ this.eventName = "git.repository.tracking-removed";
4517
+ }
4518
+ };
4519
+
4502
4520
  // packages/types/src/git/events/RepositoryTrackingSetEvent.ts
4503
4521
  var RepositoryTrackingSetEvent = class extends UserEvent {
4504
4522
  static {
@@ -5310,6 +5328,87 @@ var LLM_PROVIDER_METADATA = {
5310
5328
  // packages/types/src/llm/AIProviderId.ts
5311
5329
  var createAIProviderId = brandedIdFactory();
5312
5330
 
5331
+ // packages/types/src/marketplaces/MarketplaceId.ts
5332
+ var createMarketplaceId = brandedIdFactory();
5333
+
5334
+ // packages/types/src/marketplaces/MarketplaceDescriptorFilename.ts
5335
+ var MARKETPLACE_DESCRIPTOR_PATHS = [
5336
+ ".claude-plugin/marketplace.json",
5337
+ "marketplace.json",
5338
+ ".github/plugin/marketplace.json"
5339
+ ];
5340
+ var MARKETPLACE_DESCRIPTOR_FILENAME = MARKETPLACE_DESCRIPTOR_PATHS[0];
5341
+
5342
+ // packages/types/src/marketplaces/MarketplaceDistributionId.ts
5343
+ var createMarketplaceDistributionId = brandedIdFactory();
5344
+
5345
+ // packages/types/src/marketplaces/PluginInstallationId.ts
5346
+ var createPluginInstallationId = brandedIdFactory();
5347
+
5348
+ // packages/types/src/marketplaces/errors/GitProviderTokenInvalidError.ts
5349
+ var GitProviderTokenInvalidError = class _GitProviderTokenInvalidError extends Error {
5350
+ static {
5351
+ /**
5352
+ * Exact verbatim user-facing message defined by the feature spec.
5353
+ * Do not modify without coordinating with the spec / docs.
5354
+ */
5355
+ this.USER_FACING_MESSAGE = "The package could not be published. Reason: Invalid or expired Git token.";
5356
+ }
5357
+ constructor() {
5358
+ super(_GitProviderTokenInvalidError.USER_FACING_MESSAGE);
5359
+ this.name = "GitProviderTokenInvalidError";
5360
+ }
5361
+ };
5362
+
5363
+ // packages/types/src/marketplaces/events/MarketplaceLinkedEvent.ts
5364
+ var MarketplaceLinkedEvent = class extends UserEvent {
5365
+ static {
5366
+ this.eventName = "deployments.marketplace.linked";
5367
+ }
5368
+ };
5369
+
5370
+ // packages/types/src/marketplaces/events/MarketplacePluginRemovalInitiatedEvent.ts
5371
+ var MarketplacePluginRemovalInitiatedEvent = class extends UserEvent {
5372
+ static {
5373
+ this.eventName = "deployments.distribution.retired";
5374
+ }
5375
+ };
5376
+
5377
+ // packages/types/src/marketplaces/events/MarketplaceUnlinkedEvent.ts
5378
+ var MarketplaceUnlinkedEvent = class extends UserEvent {
5379
+ static {
5380
+ this.eventName = "deployments.marketplace.unlinked";
5381
+ }
5382
+ };
5383
+
5384
+ // packages/types/src/marketplaces/events/PluginInstallTrackedEvent.ts
5385
+ var PluginInstallTrackedEvent = class extends SystemEvent {
5386
+ static {
5387
+ this.eventName = "deployments.plugin.install-tracked";
5388
+ }
5389
+ };
5390
+
5391
+ // packages/types/src/marketplaces/events/PluginPublishAttemptedEvent.ts
5392
+ var PluginPublishAttemptedEvent = class extends UserEvent {
5393
+ static {
5394
+ this.eventName = "deployments.plugin.publish-attempted";
5395
+ }
5396
+ };
5397
+
5398
+ // packages/types/src/marketplaces/events/PluginPublishFailedEvent.ts
5399
+ var PluginPublishFailedEvent = class extends UserEvent {
5400
+ static {
5401
+ this.eventName = "deployments.plugin.publish-failed";
5402
+ }
5403
+ };
5404
+
5405
+ // packages/types/src/marketplaces/events/PluginPublishedEvent.ts
5406
+ var PluginPublishedEvent = class extends UserEvent {
5407
+ static {
5408
+ this.eventName = "deployments.plugin.published";
5409
+ }
5410
+ };
5411
+
5313
5412
  // packages/types/src/playbookChangeManagement/ChangeProposalId.ts
5314
5413
  var createChangeProposalId = brandedIdFactory();
5315
5414
 
@@ -5420,8 +5519,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
5420
5519
  static {
5421
5520
  this.fallbackRuleContent = "adhoc-rule";
5422
5521
  }
5423
- async execute(command31) {
5424
- const { program, fileContent, language } = command31;
5522
+ async execute(command35) {
5523
+ const { program, fileContent, language } = command35;
5425
5524
  const result = await this.linterExecutionUseCase.execute({
5426
5525
  filePath: "cli-single-file",
5427
5526
  fileContent,
@@ -5468,6 +5567,11 @@ function resolveSkillDirPath(absolutePath) {
5468
5567
 
5469
5568
  // apps/cli/src/application/services/GitService.ts
5470
5569
  var origin = "GitService";
5570
+ var DETACHED_HEAD = "HEAD";
5571
+ var LOCAL_REF_NAMESPACE = "refs/heads";
5572
+ var REMOTE_REF_NAMESPACE = "refs/remotes";
5573
+ var LOCAL_REF_PREFIX = `${LOCAL_REF_NAMESPACE}/`;
5574
+ var REMOTE_REF_PREFIX = `${REMOTE_REF_NAMESPACE}/`;
5471
5575
  var GitService = class {
5472
5576
  constructor(logger2 = new PackmindLogger(origin), gitRunner = (cmd, opts) => {
5473
5577
  const stdout = (0, import_child_process.execSync)(`git ${cmd}`, {
@@ -5480,27 +5584,37 @@ var GitService = class {
5480
5584
  this.gitRunner = gitRunner;
5481
5585
  this.logger = logger2;
5482
5586
  }
5483
- getGitRepositoryRoot(path37) {
5587
+ /**
5588
+ * Runs git and turns an invocation failure into a message the user can act on.
5589
+ *
5590
+ * The raw git stderr is deliberately dropped: every caller prints this message
5591
+ * as-is, and `fatal: not a git repository (or any of the parent directories)`
5592
+ * adds nothing the sentence does not already say. The command name is not
5593
+ * mentioned either — these helpers back `lint`, `install`, `git track`,
5594
+ * `git info` and more, so naming one is wrong for all the others.
5595
+ */
5596
+ runGit(gitCommand2, repoPath, failure) {
5484
5597
  try {
5485
- const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
5486
- cwd: path37
5487
- });
5488
- const gitRoot = stdout.trim();
5489
- this.logger.debug("Resolved git repository root", {
5490
- inputPath: path37,
5491
- gitRoot
5492
- });
5493
- return gitRoot;
5494
- } catch (error) {
5495
- if (error instanceof Error) {
5496
- throw new Error(
5497
- `Failed to get Git repository root. The path '${path37}' does not appear to be inside a Git repository.
5498
- ${error.message}`
5499
- );
5500
- }
5501
- throw new Error("Failed to get Git repository root: Unknown error");
5598
+ return this.gitRunner(gitCommand2, { cwd: repoPath }).stdout;
5599
+ } catch {
5600
+ throw new Error(
5601
+ `${failure}. The path '${repoPath}' does not appear to be inside a Git repository.`
5602
+ );
5502
5603
  }
5503
5604
  }
5605
+ getGitRepositoryRoot(path37) {
5606
+ const stdout = this.runGit(
5607
+ "rev-parse --show-toplevel",
5608
+ path37,
5609
+ "Failed to get Git repository root"
5610
+ );
5611
+ const gitRoot = stdout.trim();
5612
+ this.logger.debug("Resolved git repository root", {
5613
+ inputPath: path37,
5614
+ gitRoot
5615
+ });
5616
+ return gitRoot;
5617
+ }
5504
5618
  tryGetGitRepositoryRoot(path37) {
5505
5619
  try {
5506
5620
  return this.getGitRepositoryRoot(path37);
@@ -5521,82 +5635,117 @@ ${error.message}`
5521
5635
  }
5522
5636
  }
5523
5637
  getCurrentBranch(repoPath) {
5524
- try {
5525
- const { stdout } = this.gitRunner("rev-parse --abbrev-ref HEAD", {
5526
- cwd: repoPath
5527
- });
5528
- const branch = stdout.trim();
5529
- this.logger.debug("Resolved current branch", {
5530
- repoPath,
5531
- branch
5532
- });
5533
- return { branch };
5534
- } catch (error) {
5535
- if (error instanceof Error) {
5536
- throw new Error(
5537
- `Failed to get current Git branch. The path '${repoPath}' does not appear to be inside a Git repository.
5538
- ${error.message}`
5539
- );
5540
- }
5541
- throw new Error("Failed to get current Git branch: Unknown error");
5542
- }
5638
+ const stdout = this.runGit(
5639
+ "rev-parse --abbrev-ref HEAD",
5640
+ repoPath,
5641
+ "Failed to get current Git branch"
5642
+ );
5643
+ const branch = stdout.trim();
5644
+ const detached = branch === DETACHED_HEAD;
5645
+ this.logger.debug("Resolved current branch", {
5646
+ repoPath,
5647
+ branch,
5648
+ detached
5649
+ });
5650
+ return { branch, detached };
5543
5651
  }
5544
5652
  getCurrentBranches(repoPath) {
5545
- try {
5546
- const { stdout } = this.gitRunner("branch -a --contains HEAD", {
5547
- cwd: repoPath
5548
- });
5549
- const branches = this.parseBranches(stdout);
5550
- return { branches };
5551
- } catch (error) {
5552
- if (error instanceof Error) {
5553
- throw new Error(
5554
- `Failed to get Git branches. packmind-cli lint must be run in a Git repository.
5555
- ${error.message}`
5556
- );
5653
+ const stdout = this.runGit(
5654
+ "branch -a --contains HEAD",
5655
+ repoPath,
5656
+ "Failed to get Git branches"
5657
+ );
5658
+ return { branches: this.parseBranches(stdout) };
5659
+ }
5660
+ getAllBranches(repoPath) {
5661
+ const stdout = this.runGit(
5662
+ `for-each-ref --format="%(refname)" ${LOCAL_REF_NAMESPACE} ${REMOTE_REF_NAMESPACE}`,
5663
+ repoPath,
5664
+ "Failed to get Git branches"
5665
+ );
5666
+ return { branches: this.parseRefNames(stdout) };
5667
+ }
5668
+ /**
5669
+ * Local and remote-tracking branches are both accepted: `git track --branch`
5670
+ * does not require the branch to be checked out, only to exist.
5671
+ *
5672
+ * `for-each-ref` is plumbing, so its output is the list of refs and nothing
5673
+ * else. `git branch -a` renders for humans, and every decoration it adds used
5674
+ * to be read as part of the branch name — refusing branches that do exist:
5675
+ * `+ feature` for a branch held by a linked worktree, ANSI escapes under
5676
+ * `color.ui = always`, and every branch on one line under `column.ui = always`
5677
+ * (the last two are forced through a pipe, which is how the CLI runs git).
5678
+ *
5679
+ * The branch name is matched in-process instead of being handed to git: it
5680
+ * comes straight from `--branch`, and interpolating it into the command line
5681
+ * would pass user input to the shell.
5682
+ */
5683
+ branchExists(repoPath, branch) {
5684
+ const { branches } = this.getAllBranches(repoPath);
5685
+ return branches.includes(branch);
5686
+ }
5687
+ /**
5688
+ * Turns full refnames into branch names.
5689
+ *
5690
+ * The remote name is dropped, so a branch that exists only on a remote counts
5691
+ * as existing — what `--branch` promises, since it does not require a local
5692
+ * checkout. `refs/remotes/<remote>/HEAD` is skipped: it is a symref to the
5693
+ * remote's default branch, not a branch of its own.
5694
+ */
5695
+ parseRefNames(forEachRefOutput) {
5696
+ const branchNames = /* @__PURE__ */ new Set();
5697
+ for (const line of forEachRefOutput.split("\n")) {
5698
+ const refName = line.trim();
5699
+ if (refName.startsWith(LOCAL_REF_PREFIX)) {
5700
+ branchNames.add(refName.substring(LOCAL_REF_PREFIX.length));
5701
+ continue;
5702
+ }
5703
+ if (!refName.startsWith(REMOTE_REF_PREFIX)) {
5704
+ continue;
5705
+ }
5706
+ const withoutNamespace = refName.substring(REMOTE_REF_PREFIX.length);
5707
+ const remoteSeparator = withoutNamespace.indexOf("/");
5708
+ if (remoteSeparator === -1) {
5709
+ continue;
5710
+ }
5711
+ const branchName = withoutNamespace.substring(remoteSeparator + 1);
5712
+ if (branchName && branchName !== DETACHED_HEAD) {
5713
+ branchNames.add(branchName);
5557
5714
  }
5558
- throw new Error("Failed to get Git branches: Unknown error");
5559
5715
  }
5716
+ return Array.from(branchNames);
5560
5717
  }
5561
5718
  getGitRemoteUrl(repoPath, origin9) {
5562
- try {
5563
- const { stdout } = this.gitRunner("remote -v", {
5564
- cwd: repoPath
5565
- });
5566
- const remotes = this.parseRemotes(stdout);
5567
- if (remotes.length === 0) {
5568
- throw new Error("No Git remotes found in the repository");
5569
- }
5570
- let selectedRemote;
5571
- if (origin9) {
5572
- const foundRemote = remotes.find((remote) => remote.name === origin9);
5573
- if (!foundRemote) {
5574
- throw new Error(`Remote '${origin9}' not found in repository`);
5575
- }
5576
- selectedRemote = foundRemote.url;
5577
- } else if (remotes.length === 1) {
5578
- selectedRemote = remotes[0].url;
5579
- } else {
5580
- const originRemote = remotes.find((remote) => remote.name === "origin");
5581
- if (!originRemote) {
5582
- throw new Error(
5583
- "Multiple remotes found but no 'origin' remote. Please specify the remote name."
5584
- );
5585
- }
5586
- selectedRemote = originRemote.url;
5587
- }
5588
- return {
5589
- gitRemoteUrl: this.normalizeGitUrl(selectedRemote)
5590
- };
5591
- } catch (error) {
5592
- if (error instanceof Error) {
5719
+ const stdout = this.runGit(
5720
+ "remote -v",
5721
+ repoPath,
5722
+ "Failed to get Git remote URL"
5723
+ );
5724
+ const remotes = this.parseRemotes(stdout);
5725
+ if (remotes.length === 0) {
5726
+ throw new Error("No Git remotes found in the repository");
5727
+ }
5728
+ let selectedRemote;
5729
+ if (origin9) {
5730
+ const foundRemote = remotes.find((remote) => remote.name === origin9);
5731
+ if (!foundRemote) {
5732
+ throw new Error(`Remote '${origin9}' not found in repository`);
5733
+ }
5734
+ selectedRemote = foundRemote.url;
5735
+ } else if (remotes.length === 1) {
5736
+ selectedRemote = remotes[0].url;
5737
+ } else {
5738
+ const originRemote = remotes.find((remote) => remote.name === "origin");
5739
+ if (!originRemote) {
5593
5740
  throw new Error(
5594
- `Failed to get Git remote URL. packmind-cli lint must be run in a Git repository.
5595
- ${error.message}`
5741
+ "Multiple remotes found but no 'origin' remote. Please specify the remote name."
5596
5742
  );
5597
5743
  }
5598
- throw new Error("Failed to get Git remote URL: Unknown error");
5744
+ selectedRemote = originRemote.url;
5599
5745
  }
5746
+ return {
5747
+ gitRemoteUrl: this.normalizeGitUrl(selectedRemote)
5748
+ };
5600
5749
  }
5601
5750
  /**
5602
5751
  * Gets files that have been modified (staged + unstaged) compared to HEAD.
@@ -5805,8 +5954,8 @@ var GetGitRemoteUrlUseCase = class {
5805
5954
  constructor(gitRemoteUrlService = new GitService()) {
5806
5955
  this.gitRemoteUrlService = gitRemoteUrlService;
5807
5956
  }
5808
- async execute(command31) {
5809
- const { path: repoPath, origin: origin9 } = command31;
5957
+ async execute(command35) {
5958
+ const { path: repoPath, origin: origin9 } = command35;
5810
5959
  return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
5811
5960
  }
5812
5961
  };
@@ -5958,8 +6107,8 @@ var ListFilesInDirectoryUseCase = class {
5958
6107
  constructor(listFiles = new ListFiles()) {
5959
6108
  this.listFiles = listFiles;
5960
6109
  }
5961
- async execute(command31) {
5962
- const { path: directoryPath, extensions, excludes = [] } = command31;
6110
+ async execute(command35) {
6111
+ const { path: directoryPath, extensions, excludes = [] } = command35;
5963
6112
  const files = await this.listFiles.listFilesInDirectory(
5964
6113
  directoryPath,
5965
6114
  extensions,
@@ -6074,7 +6223,7 @@ var LintFilesAgainstRuleUseCase = class {
6074
6223
  };
6075
6224
  };
6076
6225
  }
6077
- async execute(command31) {
6226
+ async execute(command35) {
6078
6227
  const {
6079
6228
  path: userPath,
6080
6229
  draftMode,
@@ -6083,7 +6232,7 @@ var LintFilesAgainstRuleUseCase = class {
6083
6232
  language,
6084
6233
  diffMode,
6085
6234
  ignorePatterns
6086
- } = command31;
6235
+ } = command35;
6087
6236
  this.logger.debug(
6088
6237
  `Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
6089
6238
  );
@@ -6399,8 +6548,8 @@ var LintFilesAgainstRuleUseCase = class {
6399
6548
  return null;
6400
6549
  }
6401
6550
  }
6402
- async executeProgramsForFile(command31) {
6403
- const result = await this.services.linterExecutionUseCase.execute(command31);
6551
+ async executeProgramsForFile(command35) {
6552
+ const result = await this.services.linterExecutionUseCase.execute(command35);
6404
6553
  return result.violations;
6405
6554
  }
6406
6555
  extractExtensionFromFile(filePath) {
@@ -6423,8 +6572,8 @@ var LintFilesFromConfigUseCase = class {
6423
6572
  this.logger = logger2;
6424
6573
  this.detectionProgramsCache = /* @__PURE__ */ new Map();
6425
6574
  }
6426
- async execute(command31) {
6427
- const { path: userPath, diffMode, ignorePatterns } = command31;
6575
+ async execute(command35) {
6576
+ const { path: userPath, diffMode, ignorePatterns } = command35;
6428
6577
  this.logger.debug(
6429
6578
  `Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
6430
6579
  );
@@ -6684,8 +6833,8 @@ var LintFilesFromConfigUseCase = class {
6684
6833
  return null;
6685
6834
  }
6686
6835
  }
6687
- async executeProgramsForFile(command31) {
6688
- const result = await this.services.linterExecutionUseCase.execute(command31);
6836
+ async executeProgramsForFile(command35) {
6837
+ const result = await this.services.linterExecutionUseCase.execute(command35);
6689
6838
  return result.violations;
6690
6839
  }
6691
6840
  extractExtensionFromFile(filePath) {
@@ -6861,13 +7010,13 @@ var PackmindHttpClient = class {
6861
7010
  var ChangeProposalGateway = class {
6862
7011
  constructor(httpClient) {
6863
7012
  this.httpClient = httpClient;
6864
- this.batchCreate = async (command31) => {
7013
+ this.batchCreate = async (command35) => {
6865
7014
  const { organizationId } = this.httpClient.getAuthContext();
6866
7015
  return this.httpClient.request(
6867
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/change-proposals/batch`,
7016
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/change-proposals/batch`,
6868
7017
  {
6869
7018
  method: "POST",
6870
- body: { proposals: command31.proposals },
7019
+ body: { proposals: command35.proposals },
6871
7020
  onError: (response) => {
6872
7021
  if (response.status === 404) {
6873
7022
  throw new CommunityEditionError("change proposals");
@@ -6876,29 +7025,29 @@ var ChangeProposalGateway = class {
6876
7025
  }
6877
7026
  );
6878
7027
  };
6879
- this.batchApply = async (command31) => {
7028
+ this.batchApply = async (command35) => {
6880
7029
  const { organizationId } = this.httpClient.getAuthContext();
6881
7030
  return this.httpClient.request(
6882
7031
  `/api/v0/organizations/${organizationId}/playbook/apply`,
6883
7032
  {
6884
7033
  method: "POST",
6885
7034
  body: {
6886
- proposals: command31.proposals,
6887
- message: command31.message,
6888
- ...command31.directUpdate !== void 0 && {
6889
- directUpdate: command31.directUpdate
7035
+ proposals: command35.proposals,
7036
+ message: command35.message,
7037
+ ...command35.directUpdate !== void 0 && {
7038
+ directUpdate: command35.directUpdate
6890
7039
  }
6891
7040
  }
6892
7041
  }
6893
7042
  );
6894
7043
  };
6895
- this.check = async (command31) => {
7044
+ this.check = async (command35) => {
6896
7045
  const { organizationId } = this.httpClient.getAuthContext();
6897
7046
  return this.httpClient.request(
6898
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/change-proposals/check`,
7047
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/change-proposals/check`,
6899
7048
  {
6900
7049
  method: "POST",
6901
- body: { proposals: command31.proposals },
7050
+ body: { proposals: command35.proposals },
6902
7051
  onError: (response) => {
6903
7052
  if (response.status === 404) {
6904
7053
  throw new CommunityEditionError("change proposals");
@@ -6914,13 +7063,13 @@ var ChangeProposalGateway = class {
6914
7063
  var LinterGateway = class {
6915
7064
  constructor(httpClient) {
6916
7065
  this.httpClient = httpClient;
6917
- this.getDraftDetectionProgramsForRule = async (command31) => {
7066
+ this.getDraftDetectionProgramsForRule = async (command35) => {
6918
7067
  const payload = {
6919
- standardSlug: command31.standardSlug,
6920
- ruleId: command31.ruleId
7068
+ standardSlug: command35.standardSlug,
7069
+ ruleId: command35.ruleId
6921
7070
  };
6922
- if (command31.language) {
6923
- payload.language = command31.language;
7071
+ if (command35.language) {
7072
+ payload.language = command35.language;
6924
7073
  }
6925
7074
  return this.httpClient.request("/api/v0/list-draft-detection-program", {
6926
7075
  method: "POST",
@@ -6932,13 +7081,13 @@ var LinterGateway = class {
6932
7081
  }
6933
7082
  });
6934
7083
  };
6935
- this.getActiveDetectionProgramsForRule = async (command31) => {
7084
+ this.getActiveDetectionProgramsForRule = async (command35) => {
6936
7085
  const payload = {
6937
- standardSlug: command31.standardSlug,
6938
- ruleId: command31.ruleId
7086
+ standardSlug: command35.standardSlug,
7087
+ ruleId: command35.ruleId
6939
7088
  };
6940
- if (command31.language) {
6941
- payload.language = command31.language;
7089
+ if (command35.language) {
7090
+ payload.language = command35.language;
6942
7091
  }
6943
7092
  return this.httpClient.request("/api/v0/list-active-detection-program", {
6944
7093
  method: "POST",
@@ -6950,13 +7099,13 @@ var LinterGateway = class {
6950
7099
  }
6951
7100
  });
6952
7101
  };
6953
- this.getDetectionProgramsForPackages = async (command31) => {
7102
+ this.getDetectionProgramsForPackages = async (command35) => {
6954
7103
  const response = await this.httpClient.request(
6955
7104
  "/api/v0/detection-programs-for-packages",
6956
7105
  {
6957
7106
  method: "POST",
6958
7107
  body: {
6959
- packagesSlugs: command31.packagesSlugs
7108
+ packagesSlugs: command35.packagesSlugs
6960
7109
  },
6961
7110
  onError: (response2) => {
6962
7111
  if (response2.status === 404) {
@@ -6967,10 +7116,10 @@ var LinterGateway = class {
6967
7116
  );
6968
7117
  return handleScopeInTargetsResponse(response);
6969
7118
  };
6970
- this.trackLinterExecution = async (command31) => {
7119
+ this.trackLinterExecution = async (command35) => {
6971
7120
  return this.httpClient.request(`/api/v0/track-execution`, {
6972
7121
  method: "POST",
6973
- body: command31
7122
+ body: command35
6974
7123
  });
6975
7124
  };
6976
7125
  }
@@ -7024,27 +7173,27 @@ var SpacesGateway = class {
7024
7173
  var SkillsGateway = class {
7025
7174
  constructor(httpClient) {
7026
7175
  this.httpClient = httpClient;
7027
- this.upload = async (command31) => {
7176
+ this.upload = async (command35) => {
7028
7177
  const { organizationId } = this.httpClient.getAuthContext();
7029
7178
  return this.httpClient.request(
7030
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/skills/upload`,
7179
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/skills/upload`,
7031
7180
  {
7032
7181
  method: "POST",
7033
- body: command31
7182
+ body: command35
7034
7183
  }
7035
7184
  );
7036
7185
  };
7037
- this.getDefaults = async (command31) => {
7186
+ this.getDefaults = async (command35) => {
7038
7187
  const { organizationId } = this.httpClient.getAuthContext();
7039
7188
  const queryParams = new URLSearchParams();
7040
- if (command31.includeBeta) {
7189
+ if (command35.includeBeta) {
7041
7190
  queryParams.set("includeBeta", "true");
7042
- } else if (command31.cliVersion) {
7043
- queryParams.set("cliVersion", command31.cliVersion);
7191
+ } else if (command35.cliVersion) {
7192
+ queryParams.set("cliVersion", command35.cliVersion);
7044
7193
  }
7045
- if (command31.agents !== void 0) {
7194
+ if (command35.agents !== void 0) {
7046
7195
  queryParams.append("agentsConfigOverride", "true");
7047
- command31.agents.forEach((agent) => {
7196
+ command35.agents.forEach((agent) => {
7048
7197
  queryParams.append("agent", agent);
7049
7198
  });
7050
7199
  }
@@ -7053,10 +7202,10 @@ var SkillsGateway = class {
7053
7202
  `/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
7054
7203
  );
7055
7204
  };
7056
- this.list = async (command31) => {
7205
+ this.list = async (command35) => {
7057
7206
  const { organizationId } = this.httpClient.getAuthContext();
7058
7207
  return this.httpClient.request(
7059
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/skills`
7208
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/skills`
7060
7209
  );
7061
7210
  };
7062
7211
  }
@@ -7066,17 +7215,17 @@ var SkillsGateway = class {
7066
7215
  var CommandsGateway = class {
7067
7216
  constructor(httpClient) {
7068
7217
  this.httpClient = httpClient;
7069
- this.create = async (command31) => {
7218
+ this.create = async (command35) => {
7070
7219
  const { organizationId } = this.httpClient.getAuthContext();
7071
7220
  return this.httpClient.request(
7072
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/commands`,
7073
- { method: "POST", body: command31 }
7221
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/commands`,
7222
+ { method: "POST", body: command35 }
7074
7223
  );
7075
7224
  };
7076
- this.list = async (command31) => {
7225
+ this.list = async (command35) => {
7077
7226
  const { organizationId } = this.httpClient.getAuthContext();
7078
7227
  const listCommandsResponse = await this.httpClient.request(
7079
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/commands`
7228
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/commands`
7080
7229
  );
7081
7230
  if (listCommandsResponse instanceof Array) {
7082
7231
  return { recipes: listCommandsResponse };
@@ -7119,10 +7268,10 @@ var StandardsGateway = class {
7119
7268
  }
7120
7269
  );
7121
7270
  };
7122
- this.list = async (command31) => {
7271
+ this.list = async (command35) => {
7123
7272
  const { organizationId } = this.httpClient.getAuthContext();
7124
7273
  return this.httpClient.request(
7125
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/standards`
7274
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/standards`
7126
7275
  );
7127
7276
  };
7128
7277
  }
@@ -7133,10 +7282,10 @@ var PackagesGateway = class {
7133
7282
  constructor(apiKey, httpClient) {
7134
7283
  this.apiKey = apiKey;
7135
7284
  this.httpClient = httpClient;
7136
- this.list = async (command31) => {
7285
+ this.list = async (command35) => {
7137
7286
  const { organizationId } = this.httpClient.getAuthContext();
7138
7287
  return this.httpClient.request(
7139
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/packages`
7288
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/packages`
7140
7289
  );
7141
7290
  };
7142
7291
  this.getSummary = async ({
@@ -7148,20 +7297,20 @@ var PackagesGateway = class {
7148
7297
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug6)}`
7149
7298
  );
7150
7299
  };
7151
- this.create = async (command31) => {
7300
+ this.create = async (command35) => {
7152
7301
  const { organizationId } = this.httpClient.getAuthContext();
7153
- const { recipeIds, ...rest } = command31;
7302
+ const { recipeIds, ...rest } = command35;
7154
7303
  return this.httpClient.request(
7155
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/packages`,
7304
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/packages`,
7156
7305
  {
7157
7306
  method: "POST",
7158
7307
  body: { ...rest, commandIds: recipeIds }
7159
7308
  }
7160
7309
  );
7161
7310
  };
7162
- this.addArtefacts = async (command31) => {
7311
+ this.addArtefacts = async (command35) => {
7163
7312
  const { organizationId } = this.httpClient.getAuthContext();
7164
- const { packageId, spaceId, recipeIds, ...rest } = command31;
7313
+ const { packageId, spaceId, recipeIds, ...rest } = command35;
7165
7314
  return this.httpClient.request(
7166
7315
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
7167
7316
  {
@@ -7177,31 +7326,31 @@ var PackagesGateway = class {
7177
7326
  var DeploymentGateway = class {
7178
7327
  constructor(httpClient) {
7179
7328
  this.httpClient = httpClient;
7180
- this.pull = async (command31) => {
7329
+ this.pull = async (command35) => {
7181
7330
  const { organizationId } = this.httpClient.getAuthContext();
7182
7331
  const queryParams = new URLSearchParams();
7183
- if (command31.packagesSlugs && command31.packagesSlugs.length > 0) {
7184
- command31.packagesSlugs.forEach((slug6) => {
7332
+ if (command35.packagesSlugs && command35.packagesSlugs.length > 0) {
7333
+ command35.packagesSlugs.forEach((slug6) => {
7185
7334
  queryParams.append("packageSlug", slug6);
7186
7335
  });
7187
7336
  }
7188
- if (command31.previousPackagesSlugs && command31.previousPackagesSlugs.length > 0) {
7189
- command31.previousPackagesSlugs.forEach((slug6) => {
7337
+ if (command35.previousPackagesSlugs && command35.previousPackagesSlugs.length > 0) {
7338
+ command35.previousPackagesSlugs.forEach((slug6) => {
7190
7339
  queryParams.append("previousPackageSlug", slug6);
7191
7340
  });
7192
7341
  }
7193
- if (command31.gitRemoteUrl) {
7194
- queryParams.append("gitRemoteUrl", command31.gitRemoteUrl);
7342
+ if (command35.gitRemoteUrl) {
7343
+ queryParams.append("gitRemoteUrl", command35.gitRemoteUrl);
7195
7344
  }
7196
- if (command31.gitBranch) {
7197
- queryParams.append("gitBranch", command31.gitBranch);
7345
+ if (command35.gitBranch) {
7346
+ queryParams.append("gitBranch", command35.gitBranch);
7198
7347
  }
7199
- if (command31.relativePath) {
7200
- queryParams.append("relativePath", command31.relativePath);
7348
+ if (command35.relativePath) {
7349
+ queryParams.append("relativePath", command35.relativePath);
7201
7350
  }
7202
- if (command31.agents !== void 0) {
7351
+ if (command35.agents !== void 0) {
7203
7352
  queryParams.append("agentsConfigOverride", "true");
7204
- command31.agents.forEach((agent) => {
7353
+ command35.agents.forEach((agent) => {
7205
7354
  queryParams.append("agent", agent);
7206
7355
  });
7207
7356
  }
@@ -7209,101 +7358,101 @@ var DeploymentGateway = class {
7209
7358
  `/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
7210
7359
  );
7211
7360
  };
7212
- this.install = async (command31) => {
7361
+ this.install = async (command35) => {
7213
7362
  const { organizationId } = this.httpClient.getAuthContext();
7214
7363
  return this.httpClient.request(
7215
7364
  `/api/v0/organizations/${organizationId}/install`,
7216
7365
  {
7217
7366
  method: "POST",
7218
7367
  body: {
7219
- packagesSlugs: command31.packagesSlugs,
7220
- packmindLockFile: command31.packmindLockFile,
7221
- ...command31.relativePath && { relativePath: command31.relativePath },
7222
- ...command31.agents !== void 0 && { agents: command31.agents }
7368
+ packagesSlugs: command35.packagesSlugs,
7369
+ packmindLockFile: command35.packmindLockFile,
7370
+ ...command35.relativePath && { relativePath: command35.relativePath },
7371
+ ...command35.agents !== void 0 && { agents: command35.agents }
7223
7372
  }
7224
7373
  }
7225
7374
  );
7226
7375
  };
7227
- this.getDeployed = async (command31) => {
7376
+ this.getDeployed = async (command35) => {
7228
7377
  const { organizationId } = this.httpClient.getAuthContext();
7229
7378
  return this.httpClient.request(
7230
7379
  `/api/v0/organizations/${organizationId}/deployed-content`,
7231
7380
  {
7232
7381
  method: "POST",
7233
7382
  body: {
7234
- packagesSlugs: command31.packagesSlugs,
7235
- gitRemoteUrl: command31.gitRemoteUrl,
7236
- gitBranch: command31.gitBranch,
7237
- relativePath: command31.relativePath,
7238
- ...command31.agents !== void 0 && { agents: command31.agents }
7383
+ packagesSlugs: command35.packagesSlugs,
7384
+ gitRemoteUrl: command35.gitRemoteUrl,
7385
+ gitBranch: command35.gitBranch,
7386
+ relativePath: command35.relativePath,
7387
+ ...command35.agents !== void 0 && { agents: command35.agents }
7239
7388
  }
7240
7389
  }
7241
7390
  );
7242
7391
  };
7243
- this.getContentByVersions = async (command31) => {
7392
+ this.getContentByVersions = async (command35) => {
7244
7393
  const { organizationId } = this.httpClient.getAuthContext();
7245
7394
  return this.httpClient.request(
7246
7395
  `/api/v0/organizations/${organizationId}/content-by-versions`,
7247
7396
  {
7248
7397
  method: "POST",
7249
7398
  body: {
7250
- artifacts: command31.artifacts,
7251
- ...command31.agents !== void 0 && { agents: command31.agents }
7399
+ artifacts: command35.artifacts,
7400
+ ...command35.agents !== void 0 && { agents: command35.agents }
7252
7401
  }
7253
7402
  }
7254
7403
  );
7255
7404
  };
7256
- this.notifyDistribution = async (command31) => {
7405
+ this.notifyDistribution = async (command35) => {
7257
7406
  const { organizationId } = this.httpClient.getAuthContext();
7258
7407
  return this.httpClient.request(
7259
7408
  `/api/v0/organizations/${organizationId}/deployments`,
7260
7409
  {
7261
7410
  method: "POST",
7262
- body: command31
7411
+ body: command35
7263
7412
  }
7264
7413
  );
7265
7414
  };
7266
- this.notifyArtefactsDistribution = async (command31) => {
7415
+ this.notifyArtefactsDistribution = async (command35) => {
7267
7416
  const { organizationId } = this.httpClient.getAuthContext();
7268
7417
  return this.httpClient.request(
7269
7418
  `/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
7270
7419
  {
7271
7420
  method: "POST",
7272
7421
  body: {
7273
- gitRemoteUrl: command31.gitRemoteUrl,
7274
- gitBranch: command31.gitBranch,
7275
- relativePath: command31.relativePath,
7276
- packmindLockFile: command31.packmindLockFile
7422
+ gitRemoteUrl: command35.gitRemoteUrl,
7423
+ gitBranch: command35.gitBranch,
7424
+ relativePath: command35.relativePath,
7425
+ packmindLockFile: command35.packmindLockFile
7277
7426
  }
7278
7427
  }
7279
7428
  );
7280
7429
  };
7281
- this.renderPlugin = async (command31) => {
7430
+ this.renderPlugin = async (command35) => {
7282
7431
  const { organizationId } = this.httpClient.getAuthContext();
7283
7432
  return this.httpClient.request(
7284
7433
  `/api/v0/organizations/${organizationId}/plugins/render`,
7285
7434
  {
7286
7435
  method: "POST",
7287
7436
  body: {
7288
- packageSlug: command31.packageSlug,
7289
- mode: command31.mode,
7290
- pluginRoot: command31.pluginRoot,
7291
- pluginName: command31.pluginName,
7292
- gitRemoteUrl: command31.gitRemoteUrl,
7293
- gitBranch: command31.gitBranch
7437
+ packageSlug: command35.packageSlug,
7438
+ mode: command35.mode,
7439
+ pluginRoot: command35.pluginRoot,
7440
+ pluginName: command35.pluginName,
7441
+ gitRemoteUrl: command35.gitRemoteUrl,
7442
+ gitBranch: command35.gitBranch
7294
7443
  }
7295
7444
  }
7296
7445
  );
7297
7446
  };
7298
- this.trackPluginDeleted = async (command31) => {
7447
+ this.trackPluginDeleted = async (command35) => {
7299
7448
  const { organizationId } = this.httpClient.getAuthContext();
7300
7449
  return this.httpClient.request(
7301
7450
  `/api/v0/organizations/${organizationId}/plugins/track-deleted`,
7302
7451
  {
7303
7452
  method: "POST",
7304
7453
  body: {
7305
- packageSlug: command31.packageSlug,
7306
- gitRemoteUrl: command31.gitRemoteUrl
7454
+ packageSlug: command35.packageSlug,
7455
+ gitRemoteUrl: command35.gitRemoteUrl
7307
7456
  }
7308
7457
  }
7309
7458
  );
@@ -7315,13 +7464,13 @@ var DeploymentGateway = class {
7315
7464
  );
7316
7465
  };
7317
7466
  }
7318
- async updateRenderModeConfiguration(command31) {
7467
+ async updateRenderModeConfiguration(command35) {
7319
7468
  const { organizationId } = this.httpClient.getAuthContext();
7320
7469
  await this.httpClient.request(
7321
7470
  `/api/v0/organizations/${organizationId}/deployments/renderModeConfiguration`,
7322
7471
  {
7323
7472
  method: "POST",
7324
- body: { activeRenderModes: command31.activeRenderModes }
7473
+ body: { activeRenderModes: command35.activeRenderModes }
7325
7474
  }
7326
7475
  );
7327
7476
  }
@@ -7378,18 +7527,26 @@ var RepositoryTrackingGateway = class {
7378
7527
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository?${query}`
7379
7528
  );
7380
7529
  };
7381
- this.setTrackedRepository = async (command31) => {
7530
+ this.setTrackedRepository = async (command35) => {
7382
7531
  const { organizationId } = this.httpClient.getAuthContext();
7383
7532
  return this.httpClient.request(
7384
7533
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7385
- { method: "POST", body: command31 }
7534
+ { method: "POST", body: command35 }
7386
7535
  );
7387
7536
  };
7388
- this.updateTrackedBranch = async (command31) => {
7537
+ this.updateTrackedBranch = async (command35) => {
7389
7538
  const { organizationId } = this.httpClient.getAuthContext();
7390
7539
  return this.httpClient.request(
7391
7540
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7392
- { method: "PUT", body: command31 }
7541
+ { method: "PUT", body: command35 }
7542
+ );
7543
+ };
7544
+ this.removeTrackedRepository = async ({ owner, repo }) => {
7545
+ const { organizationId } = this.httpClient.getAuthContext();
7546
+ const query = new URLSearchParams({ owner, repo }).toString();
7547
+ return this.httpClient.request(
7548
+ `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository?${query}`,
7549
+ { method: "DELETE" }
7393
7550
  );
7394
7551
  };
7395
7552
  }
@@ -9153,8 +9310,8 @@ var ExecuteLinterProgramsUseCase = class {
9153
9310
  this.linterAstAdapter = linterAstAdapter;
9154
9311
  this.logger = logger2;
9155
9312
  }
9156
- async execute(command31) {
9157
- const { filePath, fileContent, language, programs } = command31;
9313
+ async execute(command35) {
9314
+ const { filePath, fileContent, language, programs } = command35;
9158
9315
  if (programs.length === 0) {
9159
9316
  return {
9160
9317
  file: filePath,
@@ -9753,16 +9910,14 @@ var Cache = class _Cache {
9753
9910
  // packages/feature-flags/src/registry.ts
9754
9911
  var ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY = "change-proposals-in-webapp";
9755
9912
  var ORGA_SPACE_MANAGEMENT_FEATURE_KEY = "orga-space-management";
9756
- var GOVERNANCE_FEATURE_KEY = "governance";
9757
- var CLI_REPO_TRACKING_FEATURE_KEY = "cli-repo-tracking";
9913
+ var SPACE_NAV_PLUGIN_FIRST_FEATURE_KEY = "space-nav-plugin-first";
9758
9914
  var DEFAULT_FEATURE_DOMAIN_MAP = {
9759
9915
  [ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY]: [
9760
9916
  "@packmind.com",
9761
9917
  "@promyze.com"
9762
9918
  ],
9763
9919
  [ORGA_SPACE_MANAGEMENT_FEATURE_KEY]: ["@packmind.com", "@promyze.com"],
9764
- [GOVERNANCE_FEATURE_KEY]: ["joan.racenet@packmind.com"],
9765
- [CLI_REPO_TRACKING_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9920
+ [SPACE_NAV_PLUGIN_FIRST_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9766
9921
  };
9767
9922
 
9768
9923
  // packages/node-utils/src/database/schemas.ts
@@ -9993,8 +10148,8 @@ var InstallPackagesUseCase = class {
9993
10148
  constructor(packmindGateway) {
9994
10149
  this.packmindGateway = packmindGateway;
9995
10150
  }
9996
- async execute(command31) {
9997
- const baseDirectory = command31.baseDirectory || process.cwd();
10151
+ async execute(command35) {
10152
+ const baseDirectory = command35.baseDirectory || process.cwd();
9998
10153
  const result = {
9999
10154
  filesCreated: 0,
10000
10155
  filesUpdated: 0,
@@ -10006,12 +10161,12 @@ var InstallPackagesUseCase = class {
10006
10161
  skillDirectoriesDeleted: 0
10007
10162
  };
10008
10163
  const response = await this.packmindGateway.deployment.pull({
10009
- packagesSlugs: command31.packagesSlugs,
10010
- previousPackagesSlugs: command31.previousPackagesSlugs,
10011
- gitRemoteUrl: command31.gitRemoteUrl,
10012
- gitBranch: command31.gitBranch,
10013
- relativePath: command31.relativePath,
10014
- agents: command31.agents
10164
+ packagesSlugs: command35.packagesSlugs,
10165
+ previousPackagesSlugs: command35.previousPackagesSlugs,
10166
+ gitRemoteUrl: command35.gitRemoteUrl,
10167
+ gitBranch: command35.gitBranch,
10168
+ relativePath: command35.relativePath,
10169
+ agents: command35.agents
10015
10170
  });
10016
10171
  const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
10017
10172
  (file) => file.path !== "packmind.json"
@@ -10386,8 +10541,8 @@ var InstallUseCase = class {
10386
10541
  this.configFileRepository = configFileRepository;
10387
10542
  this.spaceService = spaceService;
10388
10543
  }
10389
- async execute(command31) {
10390
- const baseDirectory = command31.baseDirectory || process.cwd();
10544
+ async execute(command35) {
10545
+ const baseDirectory = command35.baseDirectory || process.cwd();
10391
10546
  const result = {
10392
10547
  filesCreated: 0,
10393
10548
  filesUpdated: 0,
@@ -10417,7 +10572,7 @@ var InstallUseCase = class {
10417
10572
  },
10418
10573
  resolvedAgents: []
10419
10574
  };
10420
- const hasExplicitPackages = command31.packages && command31.packages.length > 0;
10575
+ const hasExplicitPackages = command35.packages && command35.packages.length > 0;
10421
10576
  const configExistedBefore = await this.configFileRepository.configExists(baseDirectory);
10422
10577
  const lockFile = await this.lockFileRepository.read(baseDirectory);
10423
10578
  const config = await this.configFileRepository.readConfig(baseDirectory);
@@ -10439,11 +10594,11 @@ var InstallUseCase = class {
10439
10594
  agents: [],
10440
10595
  artifacts: {}
10441
10596
  };
10442
- effectiveLockFile.cliVersion = command31.cliVersion;
10597
+ effectiveLockFile.cliVersion = command35.cliVersion;
10443
10598
  let packagesSlugs;
10444
10599
  let normalizedPackages = [];
10445
10600
  if (hasExplicitPackages) {
10446
- const explicitPackageSlugs = (command31.packages ?? []).map(
10601
+ const explicitPackageSlugs = (command35.packages ?? []).map(
10447
10602
  displayableParsedPackageSlug
10448
10603
  );
10449
10604
  normalizedPackages = await this.normalizePackageSlugs(explicitPackageSlugs);
@@ -10473,8 +10628,8 @@ var InstallUseCase = class {
10473
10628
  }
10474
10629
  return result;
10475
10630
  }
10476
- const installAgents = this.resolveInstallAgents(command31, config);
10477
- const stripPathPrefix = command31.homeAgent ? getAgentHomeDirPrefix(command31.homeAgent) ?? void 0 : void 0;
10631
+ const installAgents = this.resolveInstallAgents(command35, config);
10632
+ const stripPathPrefix = command35.homeAgent ? getAgentHomeDirPrefix(command35.homeAgent) ?? void 0 : void 0;
10478
10633
  const response = await this.packmindGateway.deployment.install({
10479
10634
  packagesSlugs,
10480
10635
  packmindLockFile: effectiveLockFile,
@@ -10614,7 +10769,7 @@ var InstallUseCase = class {
10614
10769
  } catch {
10615
10770
  }
10616
10771
  }
10617
- lockFileToPersist.cliVersion = command31.cliVersion;
10772
+ lockFileToPersist.cliVersion = command35.cliVersion;
10618
10773
  if (stripPathPrefix) {
10619
10774
  lockFileToPersist = this.stripLockFileArtifactPaths(
10620
10775
  lockFileToPersist,
@@ -10643,9 +10798,9 @@ var InstallUseCase = class {
10643
10798
  async normalizePackageSlugs(slugs) {
10644
10799
  return normalizePackageSlugs(slugs, this.spaceService);
10645
10800
  }
10646
- resolveInstallAgents(command31, config) {
10647
- if (command31.homeAgent) {
10648
- return [command31.homeAgent];
10801
+ resolveInstallAgents(command35, config) {
10802
+ if (command35.homeAgent) {
10803
+ return [command35.homeAgent];
10649
10804
  }
10650
10805
  return config?.agents;
10651
10806
  }
@@ -10959,8 +11114,8 @@ var UninstallUseCase = class {
10959
11114
  this.spaceService = spaceService;
10960
11115
  this.installUseCase = installUseCase;
10961
11116
  }
10962
- async execute(command31) {
10963
- const baseDirectory = command31.baseDirectory || process.cwd();
11117
+ async execute(command35) {
11118
+ const baseDirectory = command35.baseDirectory || process.cwd();
10964
11119
  const config = await this.configFileRepository.readConfig(baseDirectory);
10965
11120
  if (!config) {
10966
11121
  const configFileExists = await this.configFileRepository.configExists(baseDirectory);
@@ -10974,7 +11129,7 @@ var UninstallUseCase = class {
10974
11129
  );
10975
11130
  }
10976
11131
  const normalized = await normalizePackageSlugs(
10977
- command31.packages,
11132
+ command35.packages,
10978
11133
  this.spaceService
10979
11134
  );
10980
11135
  const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
@@ -10997,7 +11152,7 @@ ${pkgList}`
10997
11152
  try {
10998
11153
  return await this.installUseCase.execute({
10999
11154
  baseDirectory,
11000
- cliVersion: command31.cliVersion
11155
+ cliVersion: command35.cliVersion
11001
11156
  });
11002
11157
  } catch (error) {
11003
11158
  await this.configFileRepository.updateConfig(
@@ -11039,8 +11194,8 @@ var InstallDefaultSkillsUseCase = class {
11039
11194
  constructor(repositories) {
11040
11195
  this.repositories = repositories;
11041
11196
  }
11042
- async execute(command31) {
11043
- const baseDirectory = command31.baseDirectory || process.cwd();
11197
+ async execute(command35) {
11198
+ const baseDirectory = command35.baseDirectory || process.cwd();
11044
11199
  await this.bootstrapEmptyDirectory(baseDirectory);
11045
11200
  const result = {
11046
11201
  filesCreated: 0,
@@ -11050,24 +11205,24 @@ var InstallDefaultSkillsUseCase = class {
11050
11205
  skippedIncompatibleSkillNames: [],
11051
11206
  incompatibleInstalledSkills: []
11052
11207
  };
11053
- let agents = command31.agents;
11208
+ let agents = command35.agents;
11054
11209
  if (!agents || agents.length === 0) {
11055
11210
  const config = await this.repositories.configFileRepository.readConfig(baseDirectory);
11056
11211
  agents = config?.agents;
11057
11212
  }
11058
11213
  const response = await this.repositories.packmindGateway.skills.getDefaults(
11059
11214
  {
11060
- cliVersion: command31.cliVersion,
11061
- includeBeta: command31.includeBeta,
11215
+ cliVersion: command35.cliVersion,
11216
+ includeBeta: command35.includeBeta,
11062
11217
  agents
11063
11218
  }
11064
11219
  );
11065
11220
  result.skippedSkillsCount = response.skippedSkillsCount;
11066
11221
  const incompatibleInstalledMap = /* @__PURE__ */ new Map();
11067
11222
  const incompatibleSkillDirs = /* @__PURE__ */ new Map();
11068
- if (command31.cliVersion) {
11223
+ if (command35.cliVersion) {
11069
11224
  for (const file of response.fileUpdates.createOrUpdate) {
11070
- if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command31.cliVersion)) {
11225
+ if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command35.cliVersion)) {
11071
11226
  const dir = path9.dirname(file.path);
11072
11227
  const skillName = this.getSkillName(file.content) ?? path9.basename(dir);
11073
11228
  incompatibleSkillDirs.set(dir, skillName);
@@ -11078,9 +11233,9 @@ var InstallDefaultSkillsUseCase = class {
11078
11233
  for (const file of response.fileUpdates.createOrUpdate) {
11079
11234
  try {
11080
11235
  if (!file.content) continue;
11081
- const isIncompatible = command31.cliVersion && (this.isVersionConstraintViolated(
11236
+ const isIncompatible = command35.cliVersion && (this.isVersionConstraintViolated(
11082
11237
  file.content,
11083
- command31.cliVersion
11238
+ command35.cliVersion
11084
11239
  ) || this.isUnderIncompatibleSkillDir(
11085
11240
  file.path,
11086
11241
  incompatibleSkillDirs
@@ -11123,7 +11278,7 @@ var InstallDefaultSkillsUseCase = class {
11123
11278
  await this.mergeLockFileSlice(
11124
11279
  baseDirectory,
11125
11280
  response.lockFileSlice ?? {},
11126
- command31.cliVersion
11281
+ command35.cliVersion
11127
11282
  );
11128
11283
  return result;
11129
11284
  }
@@ -11277,8 +11432,8 @@ var EnsureCliVersionUseCase = class {
11277
11432
  this.lockFileRepository = lockFileRepository;
11278
11433
  this.installDefaultSkillsUseCase = installDefaultSkillsUseCase;
11279
11434
  }
11280
- async execute(command31) {
11281
- const { baseDirectory, currentCliVersion, includeBeta } = command31;
11435
+ async execute(command35) {
11436
+ const { baseDirectory, currentCliVersion, includeBeta } = command35;
11282
11437
  const lockFile = await this.lockFileRepository.read(baseDirectory);
11283
11438
  if (!lockFile) {
11284
11439
  return { kind: "no-lockfile" };
@@ -11314,10 +11469,10 @@ var ListPackagesUseCase = class {
11314
11469
  this.packmindGateway = packmindGateway;
11315
11470
  this.spaceService = spaceService;
11316
11471
  }
11317
- async execute(command31) {
11318
- if (command31.spaceId) {
11472
+ async execute(command35) {
11473
+ if (command35.spaceId) {
11319
11474
  const response = await this.packmindGateway.packages.list({
11320
- spaceId: command31.spaceId
11475
+ spaceId: command35.spaceId
11321
11476
  });
11322
11477
  return response.packages;
11323
11478
  }
@@ -11336,8 +11491,8 @@ var GetPackageSummaryUseCase = class {
11336
11491
  constructor(gateway) {
11337
11492
  this.gateway = gateway;
11338
11493
  }
11339
- async execute(command31) {
11340
- return this.gateway.packages.getSummary(command31);
11494
+ async execute(command35) {
11495
+ return this.gateway.packages.getSummary(command35);
11341
11496
  }
11342
11497
  };
11343
11498
 
@@ -11629,8 +11784,8 @@ var LoginUseCase = class {
11629
11784
  startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
11630
11785
  };
11631
11786
  }
11632
- async execute(command31) {
11633
- const { host, code: providedCode } = command31;
11787
+ async execute(command35) {
11788
+ const { host, code: providedCode } = command35;
11634
11789
  let code;
11635
11790
  if (providedCode) {
11636
11791
  code = providedCode;
@@ -12012,10 +12167,10 @@ var CheckCliVersionUseCase = class {
12012
12167
  now: deps?.now ?? (() => /* @__PURE__ */ new Date())
12013
12168
  };
12014
12169
  }
12015
- async execute(command31) {
12016
- const cached = this.readFreshCache(command31.currentVersion);
12170
+ async execute(command35) {
12171
+ const cached = this.readFreshCache(command35.currentVersion);
12017
12172
  if (cached) {
12018
- return this.toResult(command31.currentVersion, cached.latestVersion);
12173
+ return this.toResult(command35.currentVersion, cached.latestVersion);
12019
12174
  }
12020
12175
  const fetchPromise = this.deps.fetchLatestVersion(this.deps.fetchFn);
12021
12176
  fetchPromise.catch(() => void 0);
@@ -12033,7 +12188,7 @@ var CheckCliVersionUseCase = class {
12033
12188
  latestVersion,
12034
12189
  checkedAt: this.deps.now()
12035
12190
  });
12036
- return this.toResult(command31.currentVersion, latestVersion);
12191
+ return this.toResult(command35.currentVersion, latestVersion);
12037
12192
  } catch {
12038
12193
  return null;
12039
12194
  }
@@ -12481,10 +12636,10 @@ var ListStandardsUseCase = class {
12481
12636
  this.packmindGateway = packmindGateway;
12482
12637
  this.spaceService = spaceService;
12483
12638
  }
12484
- async execute(command31) {
12485
- if (command31.spaceId) {
12639
+ async execute(command35) {
12640
+ if (command35.spaceId) {
12486
12641
  const response = await this.packmindGateway.standards.list({
12487
- spaceId: command31.spaceId
12642
+ spaceId: command35.spaceId
12488
12643
  });
12489
12644
  return response.standards;
12490
12645
  }
@@ -12504,10 +12659,10 @@ var ListCommandsUseCase = class {
12504
12659
  this.packmindGateway = packmindGateway;
12505
12660
  this.spaceService = spaceService;
12506
12661
  }
12507
- async execute(command31) {
12508
- if (command31.spaceId) {
12662
+ async execute(command35) {
12663
+ if (command35.spaceId) {
12509
12664
  const response = await this.packmindGateway.commands.list({
12510
- spaceId: command31.spaceId
12665
+ spaceId: command35.spaceId
12511
12666
  });
12512
12667
  return response.recipes;
12513
12668
  }
@@ -12527,10 +12682,10 @@ var ListSkillsUseCase = class {
12527
12682
  this.packmindGateway = packmindGateway;
12528
12683
  this.spaceService = spaceService;
12529
12684
  }
12530
- async execute(command31) {
12531
- if (command31.spaceId) {
12685
+ async execute(command35) {
12686
+ if (command35.spaceId) {
12532
12687
  const skills = await this.packmindGateway.skills.list({
12533
- spaceId: command31.spaceId
12688
+ spaceId: command35.spaceId
12534
12689
  });
12535
12690
  return skills.map((s) => ({
12536
12691
  id: s.id,
@@ -12702,8 +12857,8 @@ var UploadSkillUseCase = class {
12702
12857
  constructor(deps) {
12703
12858
  this.deps = deps;
12704
12859
  }
12705
- async execute(command31) {
12706
- const files = await readSkillDirectory(command31.skillPath);
12860
+ async execute(command35) {
12861
+ const files = await readSkillDirectory(command35.skillPath);
12707
12862
  if (!files.find((f) => f.relativePath === "SKILL.md")) {
12708
12863
  throw new Error("SKILL.md not found in skill directory");
12709
12864
  }
@@ -12717,7 +12872,7 @@ var UploadSkillUseCase = class {
12717
12872
  if (totalSize > 10 * 1024 * 1024) {
12718
12873
  throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
12719
12874
  }
12720
- const space = await this.getSpace(command31.spaceSlug);
12875
+ const space = await this.getSpace(command35.spaceSlug);
12721
12876
  const payload = {
12722
12877
  files: files.map((f) => ({
12723
12878
  path: f.relativePath,
@@ -12729,7 +12884,7 @@ var UploadSkillUseCase = class {
12729
12884
  const uploadSkillResponse = await this.deps.gateway.skills.upload({
12730
12885
  spaceId: createSpaceId(space.id),
12731
12886
  files: payload.files,
12732
- originSkill: command31.originSkill
12887
+ originSkill: command35.originSkill
12733
12888
  });
12734
12889
  return {
12735
12890
  skillId: uploadSkillResponse.skill.id,
@@ -13338,34 +13493,43 @@ function parsePackmindStandard(content) {
13338
13493
  if (!name) {
13339
13494
  return null;
13340
13495
  }
13496
+ let scopeLineIndex = -1;
13341
13497
  let rulesLineIndex = -1;
13342
13498
  for (let i = nameLineIndex + 1; i < lines.length; i++) {
13343
- if (lines[i].trim() === "## Rules") {
13499
+ const trimmed = lines[i].trim();
13500
+ if (scopeLineIndex < 0 && trimmed === SCOPE_HEADING) {
13501
+ scopeLineIndex = i;
13502
+ } else if (rulesLineIndex < 0 && trimmed === RULES_HEADING) {
13344
13503
  rulesLineIndex = i;
13345
- break;
13346
13504
  }
13347
13505
  }
13506
+ const scopeSection = scopeLineIndex >= 0 ? extractScopeSection(lines, scopeLineIndex + 1, rulesLineIndex < 0) : null;
13507
+ const sectionIndexes = [scopeLineIndex, rulesLineIndex].filter(
13508
+ (index) => index >= 0
13509
+ );
13510
+ const descriptionEnd = sectionIndexes.length ? Math.min(...sectionIndexes) : lines.length;
13348
13511
  const descriptionLines = [];
13349
- let rulesStartIndex = -1;
13350
- if (rulesLineIndex >= 0) {
13351
- for (let i = nameLineIndex + 1; i < rulesLineIndex; i++) {
13352
- descriptionLines.push(lines[i]);
13512
+ let rulesStartIndex = rulesLineIndex >= 0 ? rulesLineIndex + 1 : -1;
13513
+ for (let i = nameLineIndex + 1; i < descriptionEnd; i++) {
13514
+ if (rulesStartIndex < 0 && isRuleBullet(lines[i])) {
13515
+ rulesStartIndex = i;
13516
+ break;
13353
13517
  }
13354
- rulesStartIndex = rulesLineIndex + 1;
13355
- } else {
13356
- for (let i = nameLineIndex + 1; i < lines.length; i++) {
13357
- if (lines[i].startsWith("* ") || lines[i].startsWith("- ")) {
13518
+ descriptionLines.push(lines[i]);
13519
+ }
13520
+ if (rulesStartIndex < 0 && scopeSection) {
13521
+ for (let i = scopeSection.endIndex; i < lines.length; i++) {
13522
+ if (isRuleBullet(lines[i])) {
13358
13523
  rulesStartIndex = i;
13359
13524
  break;
13360
13525
  }
13361
- descriptionLines.push(lines[i]);
13362
13526
  }
13363
13527
  }
13364
13528
  const rules = extractRulesList(lines, rulesStartIndex);
13365
13529
  return {
13366
13530
  name,
13367
13531
  description: descriptionLines.join("\n").trim(),
13368
- scope: "",
13532
+ scope: scopeSection?.value ?? "",
13369
13533
  rules
13370
13534
  };
13371
13535
  }
@@ -13399,12 +13563,30 @@ function parseCopilotStandard(content) {
13399
13563
  return parseIdeStandardBody(body, scope);
13400
13564
  }
13401
13565
  var RULES_FALLBACK = "No rules defined yet.";
13566
+ var SCOPE_HEADING = "## Scope";
13567
+ var RULES_HEADING = "## Rules";
13568
+ function isRuleBullet(line) {
13569
+ return line.startsWith("* ") || line.startsWith("- ");
13570
+ }
13571
+ function extractScopeSection(lines, startIndex, stopAtBullet) {
13572
+ const patterns = [];
13573
+ let index = startIndex;
13574
+ for (; index < lines.length; index++) {
13575
+ const line = lines[index];
13576
+ if (line.startsWith("## ")) break;
13577
+ if (stopAtBullet && isRuleBullet(line)) break;
13578
+ const trimmed = line.trim();
13579
+ if (!trimmed) continue;
13580
+ patterns.push(isRuleBullet(trimmed) ? trimmed.slice(2).trim() : trimmed);
13581
+ }
13582
+ return { value: patterns.join(", "), endIndex: index };
13583
+ }
13402
13584
  function extractRulesList(lines, startIndex) {
13403
13585
  if (startIndex < 0) return [];
13404
13586
  const rules = [];
13405
13587
  for (let i = startIndex; i < lines.length; i++) {
13406
13588
  const line = lines[i];
13407
- if (line.startsWith("* ") || line.startsWith("- ")) {
13589
+ if (isRuleBullet(line)) {
13408
13590
  const content = line.slice(2).trim();
13409
13591
  if (content && content !== RULES_FALLBACK) {
13410
13592
  rules.push(content);
@@ -13455,7 +13637,7 @@ function parseIdeStandardBody(body, scope) {
13455
13637
  const descriptionLines = [];
13456
13638
  let rulesStartIndex = -1;
13457
13639
  for (let i = nameLineIndex + 1; i < lines.length; i++) {
13458
- if (lines[i].startsWith("* ") || lines[i].startsWith("- ")) {
13640
+ if (isRuleBullet(lines[i])) {
13459
13641
  rulesStartIndex = i;
13460
13642
  break;
13461
13643
  }
@@ -13719,9 +13901,9 @@ var DiffArtefactsUseCase = class {
13719
13901
  new StandardDiffStrategy()
13720
13902
  ];
13721
13903
  }
13722
- async execute(command31) {
13723
- const baseDirectory = command31.baseDirectory || process.cwd();
13724
- const response = await this.fetchContent(command31, baseDirectory);
13904
+ async execute(command35) {
13905
+ const baseDirectory = command35.baseDirectory || process.cwd();
13906
+ const response = await this.fetchContent(command35, baseDirectory);
13725
13907
  const filteredFiles = response.fileUpdates.createOrUpdate.filter(
13726
13908
  (file) => file.path !== "packmind.json"
13727
13909
  );
@@ -13734,7 +13916,7 @@ var DiffArtefactsUseCase = class {
13734
13916
  );
13735
13917
  const prefixedSkillFolders = this.prefixSkillFolders(
13736
13918
  response.skillFolders,
13737
- command31.relativePath
13919
+ command35.relativePath
13738
13920
  );
13739
13921
  const diffs = [];
13740
13922
  for (const file of diffableFiles) {
@@ -13761,7 +13943,7 @@ var DiffArtefactsUseCase = class {
13761
13943
  targetId: response.targetId ? createTargetId(response.targetId) : void 0
13762
13944
  }));
13763
13945
  }
13764
- async fetchContent(command31, baseDirectory) {
13946
+ async fetchContent(command35, baseDirectory) {
13765
13947
  const lockFile = await this.lockFileRepository.read(baseDirectory);
13766
13948
  if (lockFile) {
13767
13949
  try {
@@ -13781,11 +13963,11 @@ var DiffArtefactsUseCase = class {
13781
13963
  }
13782
13964
  }
13783
13965
  return this.packmindGateway.deployment.getDeployed({
13784
- packagesSlugs: command31.packagesSlugs,
13785
- gitRemoteUrl: command31.gitRemoteUrl,
13786
- gitBranch: command31.gitBranch,
13787
- relativePath: command31.relativePath,
13788
- agents: command31.agents
13966
+ packagesSlugs: command35.packagesSlugs,
13967
+ gitRemoteUrl: command35.gitRemoteUrl,
13968
+ gitBranch: command35.gitBranch,
13969
+ relativePath: command35.relativePath,
13970
+ agents: command35.agents
13789
13971
  });
13790
13972
  }
13791
13973
  prefixSkillFolders(skillFolders, relativePath) {
@@ -13809,8 +13991,8 @@ var SubmitDiffsUseCase = class {
13809
13991
  constructor(packmindGateway) {
13810
13992
  this.packmindGateway = packmindGateway;
13811
13993
  }
13812
- async execute(command31) {
13813
- const { groupedDiffs, message } = command31;
13994
+ async execute(command35) {
13995
+ const { groupedDiffs, message } = command35;
13814
13996
  const skipped = [];
13815
13997
  const validDiffs = [];
13816
13998
  for (const group of groupedDiffs) {
@@ -13885,8 +14067,8 @@ var CheckDiffsUseCase = class {
13885
14067
  constructor(packmindGateway) {
13886
14068
  this.packmindGateway = packmindGateway;
13887
14069
  }
13888
- async execute(command31) {
13889
- const { groupedDiffs } = command31;
14070
+ async execute(command35) {
14071
+ const { groupedDiffs } = command35;
13890
14072
  const results = [];
13891
14073
  const validDiffs = [];
13892
14074
  const invalidDiffs = [];
@@ -13984,8 +14166,8 @@ var CliFormatter = class {
13984
14166
  static error(message) {
13985
14167
  return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
13986
14168
  }
13987
- static command(command31) {
13988
- return source_default.yellow(command31);
14169
+ static command(command35) {
14170
+ return source_default.yellow(command35);
13989
14171
  }
13990
14172
  static loader(text) {
13991
14173
  return source_default.dim.italic(text);
@@ -14130,16 +14312,61 @@ var TrackRepositoryUseCase = class {
14130
14312
  this.gateway = gateway;
14131
14313
  this.gitService = gitService;
14132
14314
  }
14133
- async execute(command31) {
14134
- const { repoPath, origin: origin9, update, confirm } = command31;
14315
+ async execute(command35) {
14316
+ const {
14317
+ repoPath,
14318
+ origin: origin9,
14319
+ update,
14320
+ remove,
14321
+ branch: requestedBranch,
14322
+ confirm
14323
+ } = command35;
14135
14324
  const { gitRemoteUrl } = this.gitService.getGitRemoteUrl(repoPath);
14136
- const { branch } = this.gitService.getCurrentBranch(repoPath);
14325
+ const { branch: currentBranch, detached } = this.gitService.getCurrentBranch(repoPath);
14326
+ const branch = requestedBranch ?? currentBranch;
14137
14327
  const { owner, repo } = parseOwnerRepo(gitRemoteUrl);
14138
14328
  const providerVendor = parseProviderVendor(gitRemoteUrl);
14329
+ if (detached && !requestedBranch && !remove) {
14330
+ return { status: "detached-head", owner, repo };
14331
+ }
14332
+ if (requestedBranch && !this.gitService.branchExists(repoPath, requestedBranch)) {
14333
+ return { status: "branch-not-found", owner, repo, branch };
14334
+ }
14139
14335
  const { gitRepo: tracked } = await this.gateway.getTrackedRepository({
14140
14336
  owner,
14141
14337
  repo
14142
14338
  });
14339
+ if (remove) {
14340
+ if (tracked) {
14341
+ const confirmed2 = await confirm({
14342
+ mode: "remove",
14343
+ owner,
14344
+ repo,
14345
+ branch: tracked.branch
14346
+ });
14347
+ if (!confirmed2) {
14348
+ return { status: "cancelled" };
14349
+ }
14350
+ }
14351
+ const response = await this.gateway.removeTrackedRepository({
14352
+ owner,
14353
+ repo
14354
+ });
14355
+ if (response.status === "not-tracked") {
14356
+ return {
14357
+ status: "not-tracked",
14358
+ owner,
14359
+ repo,
14360
+ organizationName: response.organizationName
14361
+ };
14362
+ }
14363
+ return {
14364
+ status: "removed",
14365
+ owner,
14366
+ repo,
14367
+ branch: response.gitRepo.branch
14368
+ };
14369
+ }
14143
14370
  if (update) {
14144
14371
  if (!tracked) {
14145
14372
  return { status: "nothing-tracked", owner, repo, branch };
@@ -14199,6 +14426,45 @@ var TrackRepositoryUseCase = class {
14199
14426
  }
14200
14427
  };
14201
14428
 
14429
+ // apps/cli/src/application/useCases/trackRepository/GetTrackingInfoUseCase.ts
14430
+ var GetTrackingInfoUseCase = class {
14431
+ constructor(gateway, gitService) {
14432
+ this.gateway = gateway;
14433
+ this.gitService = gitService;
14434
+ }
14435
+ async execute({
14436
+ repoPath
14437
+ }) {
14438
+ const { gitRemoteUrl } = this.gitService.getGitRemoteUrl(repoPath);
14439
+ const { branch: currentBranch, detached: currentBranchDetached } = this.gitService.getCurrentBranch(repoPath);
14440
+ const { owner, repo } = parseOwnerRepo(gitRemoteUrl);
14441
+ const { gitRepo } = await this.gateway.getTrackedRepository({
14442
+ owner,
14443
+ repo
14444
+ });
14445
+ if (!gitRepo) {
14446
+ return {
14447
+ status: "not-tracked",
14448
+ owner,
14449
+ repo,
14450
+ currentBranch,
14451
+ currentBranchDetached
14452
+ };
14453
+ }
14454
+ return {
14455
+ status: "tracked",
14456
+ owner,
14457
+ repo,
14458
+ trackedBranch: gitRepo.branch,
14459
+ currentBranch,
14460
+ currentBranchDetached,
14461
+ // Skipped when it is the branch we are on: being on it proves it exists,
14462
+ // and this is the common case, so it saves a git call.
14463
+ trackedBranchExists: gitRepo.branch === currentBranch || this.gitService.branchExists(repoPath, gitRepo.branch)
14464
+ };
14465
+ }
14466
+ };
14467
+
14202
14468
  // apps/cli/src/PackmindCliHexaFactory.ts
14203
14469
  var PackmindCliHexaFactory = class {
14204
14470
  constructor() {
@@ -14288,6 +14554,10 @@ var PackmindCliHexaFactory = class {
14288
14554
  trackRepository: new TrackRepositoryUseCase(
14289
14555
  this.repositories.packmindGateway.repositoryTracking,
14290
14556
  this.services.gitRemoteUrlService
14557
+ ),
14558
+ getTrackingInfo: new GetTrackingInfoUseCase(
14559
+ this.repositories.packmindGateway.repositoryTracking,
14560
+ this.services.gitRemoteUrlService
14291
14561
  )
14292
14562
  };
14293
14563
  }
@@ -14297,29 +14567,29 @@ var PackmindCliHexaFactory = class {
14297
14567
  var origin8 = "PackmindCliHexa";
14298
14568
  var PackmindCliHexa = class {
14299
14569
  constructor(logger2 = new PackmindLogger(origin8)) {
14300
- this.notifyDistribution = async (command31) => {
14570
+ this.notifyDistribution = async (command35) => {
14301
14571
  return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
14302
- command31
14572
+ command35
14303
14573
  );
14304
14574
  };
14305
- this.notifyArtefactsDistribution = async (command31) => {
14575
+ this.notifyArtefactsDistribution = async (command35) => {
14306
14576
  return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
14307
- command31
14577
+ command35
14308
14578
  );
14309
14579
  };
14310
- this.getTrackedRepository = async (command31) => {
14580
+ this.getTrackedRepository = async (command35) => {
14311
14581
  return this.hexa.repositories.packmindGateway.repositoryTracking.getTrackedRepository(
14312
- command31
14582
+ command35
14313
14583
  );
14314
14584
  };
14315
- this.renderPlugin = async (command31) => {
14585
+ this.renderPlugin = async (command35) => {
14316
14586
  return this.hexa.repositories.packmindGateway.deployment.renderPlugin(
14317
- command31
14587
+ command35
14318
14588
  );
14319
14589
  };
14320
- this.trackPluginDeleted = async (command31) => {
14590
+ this.trackPluginDeleted = async (command35) => {
14321
14591
  return this.hexa.repositories.packmindGateway.deployment.trackPluginDeleted(
14322
- command31
14592
+ command35
14323
14593
  );
14324
14594
  };
14325
14595
  this.logger = logger2;
@@ -14342,29 +14612,29 @@ var PackmindCliHexa = class {
14342
14612
  get output() {
14343
14613
  return this.hexa.repositories.output;
14344
14614
  }
14345
- async getGitRemoteUrl(command31) {
14346
- return this.hexa.useCases.getGitRemoteUrl.execute(command31);
14615
+ async getGitRemoteUrl(command35) {
14616
+ return this.hexa.useCases.getGitRemoteUrl.execute(command35);
14347
14617
  }
14348
- async listFilesInDirectory(command31) {
14349
- return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command31);
14618
+ async listFilesInDirectory(command35) {
14619
+ return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command35);
14350
14620
  }
14351
- async lintFilesAgainstRule(command31) {
14352
- return this.hexa.useCases.lintFilesAgainstRule.execute(command31);
14621
+ async lintFilesAgainstRule(command35) {
14622
+ return this.hexa.useCases.lintFilesAgainstRule.execute(command35);
14353
14623
  }
14354
- async lintFilesFromConfig(command31) {
14355
- return this.hexa.useCases.lintFilesFromConfig.execute(command31);
14624
+ async lintFilesFromConfig(command35) {
14625
+ return this.hexa.useCases.lintFilesFromConfig.execute(command35);
14356
14626
  }
14357
- async installPackages(command31) {
14358
- return this.hexa.useCases.installPackages.execute(command31);
14627
+ async installPackages(command35) {
14628
+ return this.hexa.useCases.installPackages.execute(command35);
14359
14629
  }
14360
- async install(command31) {
14361
- return this.hexa.useCases.install.execute(command31);
14630
+ async install(command35) {
14631
+ return this.hexa.useCases.install.execute(command35);
14362
14632
  }
14363
- async uninstall(command31) {
14364
- return this.hexa.useCases.uninstall.execute(command31);
14633
+ async uninstall(command35) {
14634
+ return this.hexa.useCases.uninstall.execute(command35);
14365
14635
  }
14366
- async diffArtefacts(command31) {
14367
- return this.hexa.useCases.diffArtefacts.execute(command31);
14636
+ async diffArtefacts(command35) {
14637
+ return this.hexa.useCases.diffArtefacts.execute(command35);
14368
14638
  }
14369
14639
  async submitDiffs(groupedDiffs, message) {
14370
14640
  return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
@@ -14372,20 +14642,20 @@ var PackmindCliHexa = class {
14372
14642
  async checkDiffs(groupedDiffs) {
14373
14643
  return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
14374
14644
  }
14375
- async listPackages(command31) {
14376
- return this.hexa.useCases.listPackages.execute(command31);
14645
+ async listPackages(command35) {
14646
+ return this.hexa.useCases.listPackages.execute(command35);
14377
14647
  }
14378
- async getPackageBySlug(command31) {
14379
- return this.hexa.useCases.getPackageBySlug.execute(command31);
14648
+ async getPackageBySlug(command35) {
14649
+ return this.hexa.useCases.getPackageBySlug.execute(command35);
14380
14650
  }
14381
- async listStandards(command31) {
14382
- return this.hexa.useCases.listStandards.execute(command31);
14651
+ async listStandards(command35) {
14652
+ return this.hexa.useCases.listStandards.execute(command35);
14383
14653
  }
14384
- async listCommands(command31) {
14385
- return this.hexa.useCases.listCommands.execute(command31);
14654
+ async listCommands(command35) {
14655
+ return this.hexa.useCases.listCommands.execute(command35);
14386
14656
  }
14387
- async listSkills(command31) {
14388
- return this.hexa.useCases.listSkills.execute(command31);
14657
+ async listSkills(command35) {
14658
+ return this.hexa.useCases.listSkills.execute(command35);
14389
14659
  }
14390
14660
  async configExists(baseDirectory) {
14391
14661
  return await this.hexa.repositories.configFileRepository.configExists(
@@ -14472,40 +14742,52 @@ var PackmindCliHexa = class {
14472
14742
  directory
14473
14743
  );
14474
14744
  }
14475
- async login(command31) {
14476
- return this.hexa.useCases.login.execute(command31);
14745
+ async login(command35) {
14746
+ return this.hexa.useCases.login.execute(command35);
14477
14747
  }
14478
- async logout(command31) {
14479
- return this.hexa.useCases.logout.execute(command31);
14748
+ async logout(command35) {
14749
+ return this.hexa.useCases.logout.execute(command35);
14480
14750
  }
14481
- async whoami(command31) {
14482
- return this.hexa.useCases.whoami.execute(command31);
14751
+ async whoami(command35) {
14752
+ return this.hexa.useCases.whoami.execute(command35);
14483
14753
  }
14484
- async checkCliVersion(command31) {
14485
- return this.hexa.useCases.checkCliVersion.execute(command31);
14754
+ async checkCliVersion(command35) {
14755
+ return this.hexa.useCases.checkCliVersion.execute(command35);
14486
14756
  }
14487
14757
  getCurrentBranch(repoPath) {
14488
14758
  return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
14489
14759
  }
14760
+ isDetachedHead(repoPath) {
14761
+ return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).detached;
14762
+ }
14763
+ branchExists(repoPath, branch) {
14764
+ return this.hexa.services.gitRemoteUrlService.branchExists(
14765
+ repoPath,
14766
+ branch
14767
+ );
14768
+ }
14490
14769
  getGitRemoteUrlFromPath(repoPath) {
14491
14770
  return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
14492
14771
  }
14493
- async uploadSkill(command31) {
14494
- return this.hexa.useCases.uploadSkill.execute(command31);
14772
+ async uploadSkill(command35) {
14773
+ return this.hexa.useCases.uploadSkill.execute(command35);
14495
14774
  }
14496
- async installDefaultSkills(command31) {
14497
- return this.hexa.useCases.installDefaultSkills.execute(command31);
14775
+ async installDefaultSkills(command35) {
14776
+ return this.hexa.useCases.installDefaultSkills.execute(command35);
14498
14777
  }
14499
- async bootstrapSkillsInitDirectory(command31) {
14778
+ async bootstrapSkillsInitDirectory(command35) {
14500
14779
  return this.hexa.useCases.installDefaultSkills.bootstrapEmptyDirectory(
14501
- command31.baseDirectory
14780
+ command35.baseDirectory
14502
14781
  );
14503
14782
  }
14504
- async ensureCliVersion(command31) {
14505
- return this.hexa.useCases.ensureCliVersion.execute(command31);
14783
+ async ensureCliVersion(command35) {
14784
+ return this.hexa.useCases.ensureCliVersion.execute(command35);
14785
+ }
14786
+ async trackRepository(command35) {
14787
+ return this.hexa.useCases.trackRepository.execute(command35);
14506
14788
  }
14507
- async trackRepository(command31) {
14508
- return this.hexa.useCases.trackRepository.execute(command31);
14789
+ async getTrackingInfo(command35) {
14790
+ return this.hexa.useCases.getTrackingInfo.execute(command35);
14509
14791
  }
14510
14792
  getPackmindGateway() {
14511
14793
  return this.hexa.repositories.packmindGateway;
@@ -15537,6 +15819,9 @@ function buildSkillsSkippedWarning(configuredAgents) {
15537
15819
  // apps/cli/src/infra/commands/trackingPrompts.ts
15538
15820
  var inquirer2 = __toESM(require("inquirer"));
15539
15821
  function buildTrackConfirmationMessage(details) {
15822
+ if (details.mode === "remove") {
15823
+ return `Stop tracking ${details.owner}/${details.repo}? Packmind currently tracks branch ${details.branch}.`;
15824
+ }
15540
15825
  if (details.mode === "update") {
15541
15826
  return `Change the tracked branch for ${details.owner}/${details.repo} from ${details.fromBranch} to ${details.branch}?`;
15542
15827
  }
@@ -15548,7 +15833,7 @@ async function defaultConfirmPrompt(message) {
15548
15833
  type: "confirm",
15549
15834
  name: "confirmed",
15550
15835
  message,
15551
- default: true
15836
+ default: false
15552
15837
  }
15553
15838
  ]);
15554
15839
  return confirmed;
@@ -15668,6 +15953,7 @@ async function offerRepositoryTracking(deps) {
15668
15953
  repoPath: deps.baseDirectory,
15669
15954
  origin: "init",
15670
15955
  update: false,
15956
+ remove: false,
15671
15957
  confirm
15672
15958
  });
15673
15959
  switch (result.status) {
@@ -15987,7 +16273,7 @@ function mergeInstallResults(results) {
15987
16273
  return merged;
15988
16274
  }
15989
16275
  function decideDistributionTracking(params) {
15990
- const { lookup, currentBranch } = params;
16276
+ const { lookup, currentBranch, branchExists, detached } = params;
15991
16277
  switch (lookup.status) {
15992
16278
  case "flag-off":
15993
16279
  return { action: "record-legacy" };
@@ -15999,9 +16285,16 @@ function decideDistributionTracking(params) {
15999
16285
  return { action: "skip", reason: "repo_not_tracked" };
16000
16286
  }
16001
16287
  if (tracked.branch !== currentBranch) {
16288
+ if (!branchExists(tracked.branch)) {
16289
+ return {
16290
+ action: "skip",
16291
+ reason: "tracked_branch_gone",
16292
+ trackedBranch: tracked.branch
16293
+ };
16294
+ }
16002
16295
  return {
16003
16296
  action: "skip",
16004
- reason: "wrong_branch",
16297
+ reason: detached ? "detached_head" : "wrong_branch",
16005
16298
  trackedBranch: tracked.branch
16006
16299
  };
16007
16300
  }
@@ -16026,9 +16319,19 @@ function reportDistributionTrackingDecision(decision, context) {
16026
16319
  if (decision.reason === "repo_not_tracked") {
16027
16320
  logWarningConsole(
16028
16321
  `Distribution not recorded \u2014 ${context.owner}/${context.repo} is not tracked in Packmind. Ask an admin to run ${formatCommand(
16029
- "packmind track"
16322
+ "packmind git track"
16030
16323
  )} to start tracking it.`
16031
16324
  );
16325
+ } else if (decision.reason === "detached_head") {
16326
+ logWarningConsole(
16327
+ `Distribution not recorded \u2014 no branch is checked out here (HEAD is detached), and Packmind records distributions on '${decision.trackedBranch}'. Check that branch out to record this distribution.`
16328
+ );
16329
+ } else if (decision.reason === "tracked_branch_gone") {
16330
+ logWarningConsole(
16331
+ `Distribution not recorded \u2014 the tracked branch '${decision.trackedBranch}' is not in this repository, so nothing is recorded anywhere. Ask an admin to run ${formatCommand(
16332
+ "packmind git track --update"
16333
+ )} to move tracking to '${context.currentBranch}'.`
16334
+ );
16032
16335
  } else {
16033
16336
  logWarningConsole(
16034
16337
  `Distribution not recorded \u2014 you're on '${context.currentBranch}', but the tracked branch is '${decision.trackedBranch}'. Switch to '${decision.trackedBranch}' to record this distribution.`
@@ -16066,9 +16369,11 @@ async function computeDistributionTrackingDecision(packmindCliHexa, gitRoot) {
16066
16369
  let owner;
16067
16370
  let repo;
16068
16371
  let gitBranch;
16372
+ let detached;
16069
16373
  try {
16070
16374
  const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
16071
16375
  gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
16376
+ detached = packmindCliHexa.isDetachedHead(gitRoot);
16072
16377
  ({ owner, repo } = parseOwnerRepo(gitRemoteUrl));
16073
16378
  } catch {
16074
16379
  const decision2 = { action: "inform" };
@@ -16078,7 +16383,15 @@ async function computeDistributionTrackingDecision(packmindCliHexa, gitRoot) {
16078
16383
  const lookup = await resolveTrackingLookup(packmindCliHexa, owner, repo);
16079
16384
  const decision = decideDistributionTracking({
16080
16385
  lookup,
16081
- currentBranch: gitBranch
16386
+ currentBranch: gitBranch,
16387
+ branchExists: (branch) => {
16388
+ try {
16389
+ return packmindCliHexa.branchExists(gitRoot, branch);
16390
+ } catch {
16391
+ return true;
16392
+ }
16393
+ },
16394
+ detached
16082
16395
  });
16083
16396
  reportDistributionTrackingDecision(decision, {
16084
16397
  owner,
@@ -17054,15 +17367,15 @@ var CreatePackageUseCase = class {
17054
17367
  this.gateway = gateway;
17055
17368
  this.spaceService = spaceService;
17056
17369
  }
17057
- async execute(command31) {
17058
- const space = await this.getSpace(command31);
17370
+ async execute(command35) {
17371
+ const space = await this.getSpace(command35);
17059
17372
  const result = await this.gateway.packages.create({
17060
17373
  spaceId: space.id,
17061
- name: command31.name,
17062
- description: command31.description ?? "",
17374
+ name: command35.name,
17375
+ description: command35.description ?? "",
17063
17376
  recipeIds: [],
17064
17377
  standardIds: [],
17065
- originSkill: command31.originSkill
17378
+ originSkill: command35.originSkill
17066
17379
  });
17067
17380
  return {
17068
17381
  packageId: result.package.id,
@@ -17071,12 +17384,12 @@ var CreatePackageUseCase = class {
17071
17384
  spaceSlug: space.slug
17072
17385
  };
17073
17386
  }
17074
- async getSpace(command31) {
17387
+ async getSpace(command35) {
17075
17388
  const spaces = await this.spaceService.getSpaces();
17076
- if (command31.spaceSlug) {
17077
- const found = spaces.find((s) => s.slug === command31.spaceSlug);
17389
+ if (command35.spaceSlug) {
17390
+ const found = spaces.find((s) => s.slug === command35.spaceSlug);
17078
17391
  if (!found) {
17079
- throw new Error(`Space '${command31.spaceSlug}' not found.`);
17392
+ throw new Error(`Space '${command35.spaceSlug}' not found.`);
17080
17393
  }
17081
17394
  return found;
17082
17395
  }
@@ -17194,8 +17507,8 @@ var AddToPackageUseCase = class {
17194
17507
  this.gateway = gateway;
17195
17508
  this.spaceService = spaceService;
17196
17509
  }
17197
- async execute(command31) {
17198
- const { packageSlug, spaceSlug, itemType, itemSlugs } = command31;
17510
+ async execute(command35) {
17511
+ const { packageSlug, spaceSlug, itemType, itemSlugs } = command35;
17199
17512
  const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
17200
17513
  const packages = await this.gateway.packages.list({
17201
17514
  spaceId: space.id
@@ -17216,7 +17529,7 @@ var AddToPackageUseCase = class {
17216
17529
  standardIds: [],
17217
17530
  recipeIds: [],
17218
17531
  skillIds: [],
17219
- originSkill: command31.originSkill
17532
+ originSkill: command35.originSkill
17220
17533
  };
17221
17534
  if (itemType === "standard") {
17222
17535
  addCommand.standardIds = ids.map(createStandardId);
@@ -17268,7 +17581,7 @@ var AddToPackageUseCase = class {
17268
17581
  }
17269
17582
  async findCommandBySlug(slug6, spaceId) {
17270
17583
  const commands = await this.gateway.commands.list({ spaceId });
17271
- return commands.recipes.find((command31) => command31.slug === slug6) ?? null;
17584
+ return commands.recipes.find((command35) => command35.slug === slug6) ?? null;
17272
17585
  }
17273
17586
  async findSkillBySlug(slug6, spaceId) {
17274
17587
  const skills = await this.gateway.skills.list({ spaceId });
@@ -17344,11 +17657,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
17344
17657
  logErrorConsole(message);
17345
17658
  if (error instanceof ItemNotFoundError) {
17346
17659
  const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
17347
- const command31 = formatCommand(
17660
+ const command35 = formatCommand(
17348
17661
  `packmind-cli ${error.itemType}s list${spaceFlag}`
17349
17662
  );
17350
17663
  logInfoConsole(
17351
- `Run \`${command31}\` to display available ${error.itemType}s`
17664
+ `Run \`${command35}\` to display available ${error.itemType}s`
17352
17665
  );
17353
17666
  }
17354
17667
  return { success: false, error: message };
@@ -17608,8 +17921,8 @@ ${pkg.name} (${fullSlug}):
17608
17921
  }
17609
17922
  if (pkg.commands && pkg.commands.length > 0) {
17610
17923
  logConsole("Commands:");
17611
- pkg.commands.forEach((command31) => {
17612
- logConsole(` - ${command31.name}`);
17924
+ pkg.commands.forEach((command35) => {
17925
+ logConsole(` - ${command35.name}`);
17613
17926
  });
17614
17927
  logConsole("");
17615
17928
  }
@@ -17680,19 +17993,34 @@ var import_path6 = require("path");
17680
17993
  var import_fs21 = require("fs");
17681
17994
  var import_path5 = require("path");
17682
17995
  function detectPluginMode(cwd) {
17683
- const marketplace = (0, import_path5.join)(cwd, ".claude-plugin/marketplace.json");
17996
+ const claudeMarketplace = (0, import_path5.join)(cwd, ".claude-plugin/marketplace.json");
17997
+ const copilotMarketplace = (0, import_path5.join)(cwd, ".github/plugin/marketplace.json");
17684
17998
  const standalone = (0, import_path5.join)(cwd, ".claude-plugin/plugin.json");
17685
- if ((0, import_fs21.existsSync)(marketplace)) {
17686
- return { mode: "marketplace", manifestPath: marketplace };
17999
+ if ((0, import_fs21.existsSync)(claudeMarketplace)) {
18000
+ return {
18001
+ mode: "marketplace",
18002
+ vendor: "claude",
18003
+ manifestPath: claudeMarketplace
18004
+ };
18005
+ }
18006
+ if ((0, import_fs21.existsSync)(copilotMarketplace)) {
18007
+ return {
18008
+ mode: "marketplace",
18009
+ vendor: "copilot",
18010
+ manifestPath: copilotMarketplace
18011
+ };
17687
18012
  }
17688
18013
  if ((0, import_fs21.existsSync)(standalone)) {
17689
- return { mode: "standalone", manifestPath: standalone };
18014
+ return { mode: "standalone", vendor: "claude", manifestPath: standalone };
17690
18015
  }
17691
18016
  return { mode: "none" };
17692
18017
  }
18018
+ function stripBom(content) {
18019
+ return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
18020
+ }
17693
18021
  function readMarketplace(path37) {
17694
18022
  const raw = (0, import_fs21.readFileSync)(path37, "utf8");
17695
- const parsed = JSON.parse(raw);
18023
+ const parsed = JSON.parse(stripBom(raw));
17696
18024
  return { ...parsed, plugins: parsed.plugins ?? [] };
17697
18025
  }
17698
18026
  function writeMarketplace(path37, content) {
@@ -17746,7 +18074,7 @@ async function renderPluginHandler(args2, deps) {
17746
18074
  const ctx = detectPluginMode(cwd);
17747
18075
  if (ctx.mode === "none") {
17748
18076
  deps.error(
17749
- "No .claude-plugin/marketplace.json or .claude-plugin/plugin.json found in this directory."
18077
+ "No .claude-plugin/marketplace.json, .github/plugin/marketplace.json, or .claude-plugin/plugin.json found in this directory."
17750
18078
  );
17751
18079
  deps.exit(1);
17752
18080
  return;
@@ -17759,7 +18087,17 @@ async function renderPluginHandler(args2, deps) {
17759
18087
  );
17760
18088
  if (ctx.mode === "marketplace") {
17761
18089
  const manifestPath = ctx.manifestPath;
17762
- const marketplace = readMarketplace(manifestPath);
18090
+ const targetVendor = ctx.vendor === "copilot" ? "github" : "anthropic";
18091
+ let marketplace;
18092
+ try {
18093
+ marketplace = readMarketplace(manifestPath);
18094
+ } catch {
18095
+ deps.error(
18096
+ `${manifestPath} is not valid JSON. Fix the file and try again.`
18097
+ );
18098
+ deps.exit(1);
18099
+ return;
18100
+ }
17763
18101
  const existing = findPluginEntry(marketplace, pluginName);
17764
18102
  if (existing) {
17765
18103
  if (classifySource(existing.source) === "remote") {
@@ -17785,7 +18123,8 @@ async function renderPluginHandler(args2, deps) {
17785
18123
  pluginRoot: existingPluginRoot,
17786
18124
  pluginName,
17787
18125
  gitRemoteUrl,
17788
- gitBranch
18126
+ gitBranch,
18127
+ targetVendor
17789
18128
  });
17790
18129
  writeFiles(cwd, response2.files);
17791
18130
  const nextEntry = {
@@ -17808,7 +18147,8 @@ async function renderPluginHandler(args2, deps) {
17808
18147
  pluginRoot,
17809
18148
  pluginName,
17810
18149
  gitRemoteUrl,
17811
- gitBranch
18150
+ gitBranch,
18151
+ targetVendor
17812
18152
  });
17813
18153
  writeFiles(cwd, response.files);
17814
18154
  const updated = upsertPluginEntry(marketplace, {
@@ -17825,7 +18165,9 @@ async function renderPluginHandler(args2, deps) {
17825
18165
  }
17826
18166
  if (ctx.mode === "standalone") {
17827
18167
  const manifestPath = ctx.manifestPath;
17828
- const manifest = JSON.parse((0, import_fs22.readFileSync)(manifestPath, "utf8"));
18168
+ const manifest = JSON.parse(
18169
+ stripBom((0, import_fs22.readFileSync)(manifestPath, "utf8"))
18170
+ );
17829
18171
  if (manifest.name !== pluginName) {
17830
18172
  deps.error(`The plugin '${pluginName}' is not handled in this repo.`);
17831
18173
  deps.exit(1);
@@ -17924,7 +18266,7 @@ async function deletePluginHandler(args2, deps) {
17924
18266
  const ctx = detectPluginMode(cwd);
17925
18267
  if (ctx.mode === "none") {
17926
18268
  deps.error(
17927
- "No .claude-plugin/marketplace.json or .claude-plugin/plugin.json found in this directory."
18269
+ "No .claude-plugin/marketplace.json, .github/plugin/marketplace.json, or .claude-plugin/plugin.json found in this directory."
17928
18270
  );
17929
18271
  deps.exit(1);
17930
18272
  return;
@@ -17968,7 +18310,9 @@ async function deletePluginHandler(args2, deps) {
17968
18310
  }
17969
18311
  if (ctx.mode === "standalone") {
17970
18312
  const manifestPath = ctx.manifestPath;
17971
- const manifest = JSON.parse((0, import_fs23.readFileSync)(manifestPath, "utf8"));
18313
+ const manifest = JSON.parse(
18314
+ stripBom((0, import_fs23.readFileSync)(manifestPath, "utf8"))
18315
+ );
17972
18316
  if (manifest.name !== pluginName) {
17973
18317
  deps.error(`The plugin '${pluginName}' is not handled in this repo.`);
17974
18318
  deps.exit(1);
@@ -18128,7 +18472,7 @@ var PlaybookLocalRepository = class {
18128
18472
  }
18129
18473
  };
18130
18474
 
18131
- // apps/cli/src/infra/commands/playbook/addHandler.ts
18475
+ // apps/cli/src/infra/commands/playbook/add/stageSinglePath.ts
18132
18476
  var fs25 = __toESM(require("fs"));
18133
18477
  var path29 = __toESM(require("path"));
18134
18478
  var yaml2 = __toESM(require("yaml"));
@@ -18792,7 +19136,7 @@ function adoptArtifactIntoLockFile({
18792
19136
  };
18793
19137
  }
18794
19138
 
18795
- // apps/cli/src/infra/commands/playbook/addHandler.ts
19139
+ // apps/cli/src/infra/commands/playbook/add/stageSinglePath.ts
18796
19140
  async function tryStageRemovedFromLockFile(resolvedPath, deps) {
18797
19141
  const fileDir = path29.dirname(resolvedPath);
18798
19142
  const targetDir = await findNearestConfigDir(fileDir, deps.packmindCliHexa);
@@ -18830,10 +19174,6 @@ async function tryStageRemovedFromLockFile(resolvedPath, deps) {
18830
19174
  logSuccessConsole(
18831
19175
  `Staged "${lockEntry.name}" (${lockEntry.type}, removed) to playbook${spaceInfo}`
18832
19176
  );
18833
- logInfoConsole(
18834
- `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
18835
- );
18836
- deps.exit(0);
18837
19177
  return true;
18838
19178
  }
18839
19179
  function resolveSkillDirectoryRoot(absolutePath) {
@@ -18857,25 +19197,17 @@ function resolveSkillDirectoryRoot(absolutePath) {
18857
19197
  }
18858
19198
  return absolutePath;
18859
19199
  }
18860
- async function playbookAddHandler(deps) {
19200
+ async function stageSinglePath(deps) {
18861
19201
  const {
18862
19202
  packmindCliHexa,
18863
19203
  filePath,
18864
19204
  spaceSlug,
18865
- exit,
18866
19205
  cwd,
18867
19206
  readFile: readFile11,
18868
19207
  readSkillDirectory: readSkillDirectory2,
18869
19208
  playbookLocalRepository,
18870
19209
  lockFileRepository
18871
19210
  } = deps;
18872
- if (!filePath) {
18873
- logErrorConsole(
18874
- "Missing file path. Usage: packmind-cli playbook add <path>"
18875
- );
18876
- exit(1);
18877
- return;
18878
- }
18879
19211
  const absolutePath = path29.resolve(cwd, filePath);
18880
19212
  let artifactType;
18881
19213
  let codingAgent;
@@ -18899,11 +19231,11 @@ async function playbookAddHandler(deps) {
18899
19231
  } else {
18900
19232
  const artefactResult = resolveArtefactFromPath(absolutePath);
18901
19233
  if (!artefactResult) {
18902
- logErrorConsole(
18903
- `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
18904
- );
18905
- exit(1);
18906
- return;
19234
+ return {
19235
+ status: "failed",
19236
+ filePath,
19237
+ message: `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
19238
+ };
18907
19239
  }
18908
19240
  artifactType = artefactResult.artifactType;
18909
19241
  codingAgent = artefactResult.codingAgent;
@@ -18911,11 +19243,11 @@ async function playbookAddHandler(deps) {
18911
19243
  } else {
18912
19244
  const artefactResult = resolveArtefactFromPath(absolutePath);
18913
19245
  if (!artefactResult) {
18914
- logErrorConsole(
18915
- `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
18916
- );
18917
- exit(1);
18918
- return;
19246
+ return {
19247
+ status: "failed",
19248
+ filePath,
19249
+ message: `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
19250
+ };
18919
19251
  }
18920
19252
  artifactType = artefactResult.artifactType;
18921
19253
  codingAgent = artefactResult.codingAgent;
@@ -18925,9 +19257,7 @@ async function playbookAddHandler(deps) {
18925
19257
  artifactType
18926
19258
  );
18927
19259
  if (!formatValidation.valid) {
18928
- logErrorConsole(formatValidation.reason);
18929
- exit(1);
18930
- return;
19260
+ return { status: "failed", filePath, message: formatValidation.reason };
18931
19261
  }
18932
19262
  let localContent;
18933
19263
  let artifactName;
@@ -18945,21 +19275,20 @@ async function playbookAddHandler(deps) {
18945
19275
  packmindCliHexa,
18946
19276
  lockFileRepository,
18947
19277
  playbookLocalRepository,
18948
- codingAgent,
18949
- exit
19278
+ codingAgent
18950
19279
  });
18951
- if (staged) return;
19280
+ if (staged) return { status: "staged", filePath, artifactType };
18952
19281
  const errorMessage = err instanceof Error ? err.message : String(err);
18953
- logErrorConsole(`Failed to read skill directory: ${errorMessage}`);
18954
- exit(1);
18955
- return;
19282
+ return {
19283
+ status: "failed",
19284
+ filePath,
19285
+ message: `Failed to read skill directory: ${errorMessage}`
19286
+ };
18956
19287
  }
18957
19288
  skillFiles = files;
18958
19289
  const parseResult = parseSkillDirectory(files);
18959
19290
  if (!parseResult.success) {
18960
- logErrorConsole(parseResult.error);
18961
- exit(1);
18962
- return;
19291
+ return { status: "failed", filePath, message: parseResult.error };
18963
19292
  }
18964
19293
  artifactName = parseResult.payload.name;
18965
19294
  serializedContent = yaml2.stringify(parseResult.payload);
@@ -18973,21 +19302,24 @@ async function playbookAddHandler(deps) {
18973
19302
  packmindCliHexa,
18974
19303
  lockFileRepository,
18975
19304
  playbookLocalRepository,
18976
- codingAgent,
18977
- exit
19305
+ codingAgent
18978
19306
  });
18979
- if (staged) return;
19307
+ if (staged) return { status: "staged", filePath, artifactType };
18980
19308
  const errorMessage = err instanceof Error ? err.message : String(err);
18981
- logErrorConsole(`Failed to read file: ${errorMessage}`);
18982
- exit(1);
18983
- return;
19309
+ return {
19310
+ status: "failed",
19311
+ filePath,
19312
+ message: `Failed to read file: ${errorMessage}`
19313
+ };
18984
19314
  }
18985
19315
  if (artifactType === "command") {
18986
19316
  const parseResult = parseCommandFile(localContent, absolutePath);
18987
19317
  if (!parseResult.success) {
18988
- logErrorConsole(`Failed to parse command file: ${parseResult.error}`);
18989
- exit(1);
18990
- return;
19318
+ return {
19319
+ status: "failed",
19320
+ filePath,
19321
+ message: `Failed to parse command file: ${parseResult.error}`
19322
+ };
18991
19323
  }
18992
19324
  artifactName = parseResult.parsed.name;
18993
19325
  } else {
@@ -18997,15 +19329,15 @@ async function playbookAddHandler(deps) {
18997
19329
  } else {
18998
19330
  const lenient = parseLenientStandard(localContent);
18999
19331
  if (!lenient) {
19000
- logErrorConsole(
19001
- `${filePath} is not a valid artifact. Expected format:
19332
+ return {
19333
+ status: "failed",
19334
+ filePath,
19335
+ message: `Not a valid artifact. Expected format:
19002
19336
 
19003
19337
  # My standard name
19004
19338
 
19005
19339
  Content goes here...`
19006
- );
19007
- exit(1);
19008
- return;
19340
+ };
19009
19341
  }
19010
19342
  artifactName = lenient.name;
19011
19343
  }
@@ -19014,11 +19346,11 @@ Content goes here...`
19014
19346
  }
19015
19347
  const targetDir = earlyTargetDir;
19016
19348
  if (!targetDir) {
19017
- logErrorConsole(
19018
- "Not inside a Packmind project. No packmind.json found in any parent directory."
19019
- );
19020
- exit(1);
19021
- return;
19349
+ return {
19350
+ status: "failed",
19351
+ filePath,
19352
+ message: "Not inside a Packmind project. No packmind.json found in any parent directory."
19353
+ };
19022
19354
  }
19023
19355
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
19024
19356
  const configDir = gitRoot ? normalizePath2(path29.relative(gitRoot, targetDir)) : void 0;
@@ -19036,23 +19368,23 @@ Content goes here...`
19036
19368
  const allSpaces = await packmindCliHexa.getSpaces();
19037
19369
  const existingLockEntry = earlyLockFile && findLockFileEntryForPath(normalizedFilePath, earlyLockFile.artifacts);
19038
19370
  if (existingLockEntry && !spaceSlug && !allSpaces.some((s) => s.id === existingLockEntry.spaceId)) {
19039
- logErrorConsole(
19040
- `Cannot add changes to this ${artifactType}: the space it belongs to is not available to you.
19371
+ return {
19372
+ status: "failed",
19373
+ filePath,
19374
+ message: `Cannot add changes to this ${artifactType}: the space it belongs to is not available to you.
19041
19375
  Use --space to stage it as a new artifact in an accessible space:
19042
19376
  ${formatSpaceList(allSpaces)}`
19043
- );
19044
- exit(1);
19045
- return;
19377
+ };
19046
19378
  }
19047
19379
  if (spaceSlug) {
19048
19380
  const matchedSpace = allSpaces.find((s) => s.slug === spaceSlug);
19049
19381
  if (!matchedSpace) {
19050
- logErrorConsole(
19051
- `Space "@${spaceSlug}" not found. Available spaces:
19382
+ return {
19383
+ status: "failed",
19384
+ filePath,
19385
+ message: `Space "@${spaceSlug}" not found. Available spaces:
19052
19386
  ${formatSpaceList(allSpaces)}`
19053
- );
19054
- exit(1);
19055
- return;
19387
+ };
19056
19388
  }
19057
19389
  spaceId = matchedSpace.id;
19058
19390
  spaceName = matchedSpace.name;
@@ -19064,14 +19396,14 @@ ${formatSpaceList(allSpaces)}`
19064
19396
  spaceId = existingLockEntry.spaceId;
19065
19397
  spaceName = allSpaces.find((s) => s.id === spaceId)?.name;
19066
19398
  } else {
19067
- logErrorConsole(
19068
- `Multiple spaces found. Use --space to specify the target space:
19399
+ return {
19400
+ status: "failed",
19401
+ filePath,
19402
+ message: `Multiple spaces found. Use --space to specify the target space:
19069
19403
  ${formatSpaceList(allSpaces)}
19070
19404
 
19071
19405
  Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19072
- );
19073
- exit(1);
19074
- return;
19406
+ };
19075
19407
  }
19076
19408
  }
19077
19409
  let changeType = "created";
@@ -19085,12 +19417,12 @@ Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19085
19417
  }
19086
19418
  }
19087
19419
  if (changeType === "created" && earlyLockFile && earlyLockFile.agents.length > 0 && !earlyLockFile.agents.includes(codingAgent)) {
19088
- logErrorConsole(
19089
- `Cannot add this ${artifactType}: it is rendered for the "${codingAgent}" agent, which is not in your configured agents (${earlyLockFile.agents.join(", ")}).
19420
+ return {
19421
+ status: "failed",
19422
+ filePath,
19423
+ message: `Cannot add this ${artifactType}: it is rendered for the "${codingAgent}" agent, which is not in your configured agents (${earlyLockFile.agents.join(", ")}).
19090
19424
  This file is no longer managed by Packmind. Re-add "${codingAgent}" to your agents and run ${formatLabel("packmind-cli install")} to manage it again, or delete the file if it is no longer needed.`
19091
- );
19092
- exit(1);
19093
- return;
19425
+ };
19094
19426
  }
19095
19427
  if (changeType === "updated" && existingLockEntry) {
19096
19428
  try {
@@ -19101,18 +19433,20 @@ This file is no longer managed by Packmind. Re-add "${codingAgent}" to your agen
19101
19433
  existingLockEntry.spaceId
19102
19434
  );
19103
19435
  if (existingLockEntry.version < remoteVersion) {
19104
- logErrorConsole(
19105
- `"${artifactName}" is outdated (local: v${existingLockEntry.version}, remote: v${remoteVersion}).
19436
+ return {
19437
+ status: "failed",
19438
+ filePath,
19439
+ message: `"${artifactName}" is outdated (local: v${existingLockEntry.version}, remote: v${remoteVersion}).
19106
19440
  Run ${formatLabel("packmind-cli install")} to update before making changes.`
19107
- );
19108
- exit(1);
19109
- return;
19441
+ };
19110
19442
  }
19111
19443
  } catch (err) {
19112
19444
  const errorMessage = err instanceof Error ? err.message : String(err);
19113
- logErrorConsole(`Failed to check artifact version: ${errorMessage}`);
19114
- exit(1);
19115
- return;
19445
+ return {
19446
+ status: "failed",
19447
+ filePath,
19448
+ message: `Failed to check artifact version: ${errorMessage}`
19449
+ };
19116
19450
  }
19117
19451
  }
19118
19452
  if (changeType === "created") {
@@ -19126,11 +19460,11 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19126
19460
  );
19127
19461
  } catch (err) {
19128
19462
  const errorMessage = err instanceof Error ? err.message : String(err);
19129
- logErrorConsole(
19130
- `Failed to check for existing ${artifactType}s: ${errorMessage}`
19131
- );
19132
- exit(1);
19133
- return;
19463
+ return {
19464
+ status: "failed",
19465
+ filePath,
19466
+ message: `Failed to check for existing ${artifactType}s: ${errorMessage}`
19467
+ };
19134
19468
  }
19135
19469
  if (existingArtifact) {
19136
19470
  let remoteVersion;
@@ -19143,11 +19477,11 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19143
19477
  ));
19144
19478
  } catch (err) {
19145
19479
  const errorMessage = err instanceof Error ? err.message : String(err);
19146
- logErrorConsole(
19147
- `Failed to link "${existingArtifact.name}" to the existing ${artifactType}: ${errorMessage}`
19148
- );
19149
- exit(1);
19150
- return;
19480
+ return {
19481
+ status: "failed",
19482
+ filePath,
19483
+ message: `Failed to link "${existingArtifact.name}" to the existing ${artifactType}: ${errorMessage}`
19484
+ };
19151
19485
  }
19152
19486
  const adoptedFilePath = artifactType === "skill" ? `${normalizedFilePath}/SKILL.md` : normalizedFilePath;
19153
19487
  activeLockFile = adoptArtifactIntoLockFile({
@@ -19187,8 +19521,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19187
19521
  });
19188
19522
  if (allMatch) {
19189
19523
  logInfoConsole("Already up to date \u2014 local content matches deployed.");
19190
- exit(0);
19191
- return;
19524
+ return { status: "skipped", filePath, artifactType };
19192
19525
  }
19193
19526
  } else {
19194
19527
  const deployedFile = deployedFiles.find(
@@ -19196,8 +19529,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19196
19529
  );
19197
19530
  if (deployedFile && deployedFile.content?.trim() === localContent.trim()) {
19198
19531
  logInfoConsole("Already up to date \u2014 local content matches deployed.");
19199
- exit(0);
19200
- return;
19532
+ return { status: "skipped", filePath, artifactType };
19201
19533
  }
19202
19534
  }
19203
19535
  }
@@ -19218,25 +19550,55 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19218
19550
  logSuccessConsole(
19219
19551
  `Staged "${artifactName}" (${artifactType}, ${changeType}) to playbook${spaceInfo}. ${formatLabel(codingAgent)}`
19220
19552
  );
19221
- logInfoConsole(
19222
- `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
19223
- );
19224
- exit(0);
19553
+ return { status: "staged", filePath, artifactType };
19225
19554
  }
19226
19555
  function formatSpaceList(spaces) {
19227
19556
  const maxSlugLength = Math.max(...spaces.map((s) => s.slug.length));
19228
19557
  return spaces.map((s) => ` ${s.slug.padEnd(maxSlugLength)} (${s.name})`).join("\n");
19229
19558
  }
19230
19559
 
19560
+ // apps/cli/src/infra/commands/playbook/addHandler.ts
19561
+ async function playbookAddHandler(deps) {
19562
+ const { filePaths, exit, ...rest } = deps;
19563
+ if (filePaths.length === 0) {
19564
+ logErrorConsole(
19565
+ "No path provided. Usage: packmind-cli playbook add <paths...>"
19566
+ );
19567
+ exit(1);
19568
+ return;
19569
+ }
19570
+ const outcomes = [];
19571
+ for (const filePath of filePaths) {
19572
+ const outcome = await stageSinglePath({ ...rest, filePath });
19573
+ outcomes.push(outcome);
19574
+ if (outcome.status === "failed") {
19575
+ logErrorConsole(`${filePath}: ${outcome.message ?? "failed to stage"}`);
19576
+ }
19577
+ }
19578
+ const failedCount = outcomes.filter((o) => o.status === "failed").length;
19579
+ const stagedCount = outcomes.filter((o) => o.status === "staged").length;
19580
+ if (filePaths.length > 1) {
19581
+ logInfoConsole(
19582
+ `${stagedCount} staged, ${failedCount} failed of ${filePaths.length}.`
19583
+ );
19584
+ }
19585
+ if (stagedCount > 0) {
19586
+ logInfoConsole(
19587
+ `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
19588
+ );
19589
+ }
19590
+ exit(failedCount > 0 ? 1 : 0);
19591
+ }
19592
+
19231
19593
  // apps/cli/src/infra/commands/playbook/AddCommand.ts
19232
19594
  var addPlaybookCommand = (0, import_cmd_ts23.command)({
19233
19595
  name: "add",
19234
- description: "Stage a local artifact change",
19596
+ description: "Stage one or more local artifact changes",
19235
19597
  args: {
19236
- filePath: (0, import_cmd_ts23.positional)({
19598
+ filePaths: (0, import_cmd_ts23.restPositionals)({
19237
19599
  type: import_cmd_ts23.string,
19238
- displayName: "path",
19239
- description: "Path to the artifact file or directory to stage"
19600
+ displayName: "paths",
19601
+ description: "Paths to the artifact files or directories to stage"
19240
19602
  }),
19241
19603
  space: (0, import_cmd_ts23.option)({
19242
19604
  type: (0, import_cmd_ts23.optional)(SpaceSlug),
@@ -19244,7 +19606,7 @@ var addPlaybookCommand = (0, import_cmd_ts23.command)({
19244
19606
  description: "Target space slug"
19245
19607
  })
19246
19608
  },
19247
- handler: async ({ filePath, space }) => {
19609
+ handler: async ({ filePaths, space }) => {
19248
19610
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
19249
19611
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
19250
19612
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(
@@ -19255,7 +19617,7 @@ var addPlaybookCommand = (0, import_cmd_ts23.command)({
19255
19617
  const lockFileRepository = new LockFileRepository();
19256
19618
  await playbookAddHandler({
19257
19619
  packmindCliHexa,
19258
- filePath,
19620
+ filePaths,
19259
19621
  spaceSlug: space,
19260
19622
  exit: process.exit,
19261
19623
  cwd: process.cwd(),
@@ -19875,6 +20237,9 @@ var path35 = __toESM(require("path"));
19875
20237
 
19876
20238
  // apps/cli/src/infra/commands/playbook/submit/duplicateNameChecker.ts
19877
20239
  var import_slug5 = __toESM(require("slug"));
20240
+ function duplicateNameKey(entry) {
20241
+ return `${entry.spaceId}:${entry.artifactType}:${(0, import_slug5.default)(entry.artifactName)}`;
20242
+ }
19878
20243
  async function checkForDuplicateNames(createdEntries, packmindGateway) {
19879
20244
  const errors = [];
19880
20245
  const groups = /* @__PURE__ */ new Map();
@@ -19889,9 +20254,12 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
19889
20254
  for (const entry of entries) {
19890
20255
  const sluggedName = (0, import_slug5.default)(entry.artifactName);
19891
20256
  if (seen.has(sluggedName)) {
19892
- errors.push(
19893
- `A ${entry.artifactType} named "${entry.artifactName}" is staged multiple times. Remove the duplicate with "playbook unstage" or rename the artifact.`
19894
- );
20257
+ errors.push({
20258
+ spaceId: entry.spaceId,
20259
+ artifactType: entry.artifactType,
20260
+ artifactName: entry.artifactName,
20261
+ message: `A ${entry.artifactType} named "${entry.artifactName}" is staged multiple times. Remove the duplicate with "playbook unstage" or rename the artifact.`
20262
+ });
19895
20263
  } else {
19896
20264
  seen.set(sluggedName, entry.artifactName);
19897
20265
  }
@@ -19921,9 +20289,12 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
19921
20289
  const existingNamesSlugged = new Set(existingNames.map((n) => (0, import_slug5.default)(n)));
19922
20290
  for (const entry of entries) {
19923
20291
  if (existingNamesSlugged.has((0, import_slug5.default)(entry.artifactName))) {
19924
- errors.push(
19925
- `A ${entry.artifactType} named "${entry.artifactName}" already exists in this space. Use "playbook unstage" to remove it or rename the artifact.`
19926
- );
20292
+ errors.push({
20293
+ spaceId: entry.spaceId,
20294
+ artifactType: entry.artifactType,
20295
+ artifactName: entry.artifactName,
20296
+ message: `A ${entry.artifactType} named "${entry.artifactName}" already exists in this space. Use "playbook unstage" to remove it or rename the artifact.`
20297
+ });
19927
20298
  }
19928
20299
  }
19929
20300
  } catch {
@@ -20743,13 +21114,42 @@ async function playbookSubmitHandler(deps) {
20743
21114
  exit(0);
20744
21115
  return;
20745
21116
  }
21117
+ const createdEntries = changes.filter((c) => c.changeType === "created");
21118
+ const conflictingKeys = /* @__PURE__ */ new Set();
21119
+ if (createdEntries.length > 0) {
21120
+ const duplicateErrors = await checkForDuplicateNames(
21121
+ createdEntries,
21122
+ packmindCliHexa.getPackmindGateway()
21123
+ );
21124
+ for (const error of duplicateErrors) {
21125
+ logErrorConsole(error.message);
21126
+ conflictingKeys.add(duplicateNameKey(error));
21127
+ }
21128
+ }
21129
+ const submittableChanges = changes.filter(
21130
+ (c) => !(c.changeType === "created" && conflictingKeys.has(duplicateNameKey(c)))
21131
+ );
21132
+ const conflictCount = changes.length - submittableChanges.length;
21133
+ const reportSkippedConflicts = () => {
21134
+ if (conflictCount === 0) return;
21135
+ logInfoConsole(
21136
+ `${conflictCount} change${conflictCount !== 1 ? "s were" : " was"} skipped and remain${conflictCount !== 1 ? "" : "s"} staged. Rename them and run \`packmind playbook submit\` again.`
21137
+ );
21138
+ };
21139
+ if (submittableChanges.length === 0) {
21140
+ logErrorConsole(
21141
+ "Nothing to submit: every staged change has a name conflict."
21142
+ );
21143
+ exit(1);
21144
+ return;
21145
+ }
20746
21146
  let resolvedMessage;
20747
21147
  if (message) {
20748
21148
  resolvedMessage = message;
20749
21149
  } else if (noReview) {
20750
21150
  resolvedMessage = "";
20751
21151
  } else {
20752
- const prefill = buildEditorPrefill(changes);
21152
+ const prefill = buildEditorPrefill(submittableChanges);
20753
21153
  const editorResult = openEditor(prefill);
20754
21154
  if (!editorResult) {
20755
21155
  logErrorConsole("Aborting: empty message.");
@@ -20764,20 +21164,6 @@ async function playbookSubmitHandler(deps) {
20764
21164
  }
20765
21165
  resolvedMessage = stripped;
20766
21166
  }
20767
- const createdEntries = changes.filter((c) => c.changeType === "created");
20768
- if (createdEntries.length > 0) {
20769
- const duplicateErrors = await checkForDuplicateNames(
20770
- createdEntries,
20771
- packmindCliHexa.getPackmindGateway()
20772
- );
20773
- if (duplicateErrors.length > 0) {
20774
- for (const error of duplicateErrors) {
20775
- logErrorConsole(error);
20776
- }
20777
- exit(1);
20778
- return;
20779
- }
20780
- }
20781
21167
  const resolver = await createTargetContextResolver({
20782
21168
  lockFileRepository,
20783
21169
  cwd,
@@ -20787,7 +21173,7 @@ async function playbookSubmitHandler(deps) {
20787
21173
  proposals: allProposals,
20788
21174
  conflicts,
20789
21175
  skipped
20790
- } = await buildProposals(changes, resolver.getTargetContext);
21176
+ } = await buildProposals(submittableChanges, resolver.getTargetContext);
20791
21177
  const descriptionErrors = validateProposalSkillDescriptions(allProposals);
20792
21178
  if (descriptionErrors.length > 0) {
20793
21179
  for (const error of descriptionErrors) {
@@ -20831,10 +21217,11 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20831
21217
  logConsole(
20832
21218
  "Nothing to submit \u2014 no changes detected compared to deployed versions."
20833
21219
  );
20834
- for (const entry of changes) {
21220
+ for (const entry of submittableChanges) {
20835
21221
  playbookLocalRepository.removeChange(entry.filePath, entry.spaceId);
20836
21222
  }
20837
- exit(0);
21223
+ reportSkippedConflicts();
21224
+ exit(conflictCount > 0 ? 1 : 0);
20838
21225
  return;
20839
21226
  }
20840
21227
  const removalPackageIds = /* @__PURE__ */ new Set();
@@ -20847,7 +21234,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20847
21234
  }
20848
21235
  }
20849
21236
  const filePathsBySpaceId = /* @__PURE__ */ new Map();
20850
- for (const entry of changes) {
21237
+ for (const entry of submittableChanges) {
20851
21238
  const existing = filePathsBySpaceId.get(entry.spaceId) ?? /* @__PURE__ */ new Set();
20852
21239
  existing.add(entry.filePath);
20853
21240
  filePathsBySpaceId.set(entry.spaceId, existing);
@@ -20871,7 +21258,8 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20871
21258
  );
20872
21259
  if (applyProposals.length === 0) {
20873
21260
  logConsole("Nothing to apply directly.");
20874
- exit(0);
21261
+ reportSkippedConflicts();
21262
+ exit(conflictCount > 0 ? 1 : 0);
20875
21263
  return;
20876
21264
  }
20877
21265
  let response;
@@ -20935,11 +21323,12 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20935
21323
  createdSpaceIds
20936
21324
  );
20937
21325
  logPackageAddGuidance(response.created, packageSlugs);
20938
- exit(0);
21326
+ reportSkippedConflicts();
21327
+ exit(conflictCount > 0 ? 1 : 0);
20939
21328
  return;
20940
21329
  }
20941
21330
  const spaceNameById = /* @__PURE__ */ new Map();
20942
- for (const change of changes) {
21331
+ for (const change of submittableChanges) {
20943
21332
  if (change.spaceName && !spaceNameById.has(change.spaceId)) {
20944
21333
  spaceNameById.set(change.spaceId, change.spaceName);
20945
21334
  }
@@ -20978,7 +21367,9 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20978
21367
  totalSkipped += response.skipped;
20979
21368
  if (response.errors.length > 0) {
20980
21369
  const filePaths = filePathsBySpaceId.get(spaceId) ?? /* @__PURE__ */ new Set();
20981
- const spaceChanges = changes.filter((c) => filePaths.has(c.filePath));
21370
+ const spaceChanges = submittableChanges.filter(
21371
+ (c) => filePaths.has(c.filePath)
21372
+ );
20982
21373
  const allRemovals = spaceChanges.length > 0 && spaceChanges.every((c) => c.changeType === "removed");
20983
21374
  const allSpaceNotFound = response.errors.every(
20984
21375
  (e) => e.code === "SpaceNotFoundError"
@@ -21018,7 +21409,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21018
21409
  for (const filePath of filePaths) {
21019
21410
  playbookLocalRepository.removeChange(filePath, spaceId);
21020
21411
  }
21021
- const removedEntries = changes.filter(
21412
+ const removedEntries = submittableChanges.filter(
21022
21413
  (c) => c.changeType === "removed" && filePaths.has(c.filePath)
21023
21414
  );
21024
21415
  for (const entry of removedEntries) {
@@ -21072,7 +21463,8 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21072
21463
  if (totalCreated > 0) {
21073
21464
  await logReviewUrls(packmindCliHexa, succeededSpaces);
21074
21465
  }
21075
- exit(0);
21466
+ reportSkippedConflicts();
21467
+ exit(conflictCount > 0 ? 1 : 0);
21076
21468
  }
21077
21469
 
21078
21470
  // apps/cli/src/infra/utils/editorMessage.ts
@@ -22190,6 +22582,206 @@ var initCommand = (0, import_cmd_ts38.command)({
22190
22582
  // apps/cli/src/infra/commands/TrackCommand.ts
22191
22583
  var import_cmd_ts39 = __toESM(require_cjs());
22192
22584
 
22585
+ // apps/cli/src/infra/commands/removedCommandHandler.ts
22586
+ function reportRemovedCommand(notifyError, removedCommand, replacementCommand, carriedFlags = []) {
22587
+ notifyError(`Command "packmind ${removedCommand}" has been removed.`, {
22588
+ content: `Use the "${replacementCommand}" command instead:`,
22589
+ exampleCommand: [`packmind ${replacementCommand}`, ...carriedFlags].join(
22590
+ " "
22591
+ )
22592
+ });
22593
+ }
22594
+ function removedTrackHandler(deps) {
22595
+ if (deps.remove) {
22596
+ reportRemovedCommand(deps.notifyError, "track --remove", "git untrack");
22597
+ process.exit(1);
22598
+ return;
22599
+ }
22600
+ const carriedFlags = [];
22601
+ if (deps.update) {
22602
+ carriedFlags.push("--update");
22603
+ }
22604
+ if (deps.branch) {
22605
+ carriedFlags.push(`--branch ${deps.branch}`);
22606
+ }
22607
+ reportRemovedCommand(deps.notifyError, "track", "git track", carriedFlags);
22608
+ process.exit(1);
22609
+ }
22610
+ function removedUntrackHandler(deps) {
22611
+ reportRemovedCommand(deps.notifyError, "untrack", "git untrack");
22612
+ process.exit(1);
22613
+ }
22614
+
22615
+ // apps/cli/src/infra/commands/TrackCommand.ts
22616
+ var trackCommand = (0, import_cmd_ts39.command)({
22617
+ name: "track",
22618
+ // Listed in --help on purpose: a stub nobody can discover cannot redirect
22619
+ // anyone. "[Removed]" matches what running it actually says.
22620
+ description: '[Removed] Use "git track" instead',
22621
+ args: {
22622
+ update: (0, import_cmd_ts39.flag)({
22623
+ long: "update",
22624
+ description: "Move the tracked branch to the current branch (requires an existing tracked branch)"
22625
+ }),
22626
+ branch: (0, import_cmd_ts39.option)({
22627
+ type: (0, import_cmd_ts39.optional)(import_cmd_ts39.string),
22628
+ long: "branch",
22629
+ description: "Branch to track (defaults to the branch currently checked out)"
22630
+ }),
22631
+ // Accepted only so the old removal syntax gets the migration message
22632
+ // instead of a raw "unknown arguments" parser error.
22633
+ remove: (0, import_cmd_ts39.flag)({
22634
+ long: "remove",
22635
+ description: 'Removal now lives in the "git untrack" command'
22636
+ })
22637
+ },
22638
+ handler: async ({ update, branch, remove }) => {
22639
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22640
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22641
+ removedTrackHandler({
22642
+ update,
22643
+ branch,
22644
+ remove,
22645
+ notifyError: packmindCliHexa.output.notifyError.bind(
22646
+ packmindCliHexa.output
22647
+ )
22648
+ });
22649
+ }
22650
+ });
22651
+
22652
+ // apps/cli/src/infra/commands/UntrackCommand.ts
22653
+ var import_cmd_ts40 = __toESM(require_cjs());
22654
+ var untrackCommand = (0, import_cmd_ts40.command)({
22655
+ name: "untrack",
22656
+ description: '[Removed] Use "git untrack" instead',
22657
+ args: {},
22658
+ handler: async () => {
22659
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22660
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22661
+ removedUntrackHandler({
22662
+ notifyError: packmindCliHexa.output.notifyError.bind(
22663
+ packmindCliHexa.output
22664
+ )
22665
+ });
22666
+ }
22667
+ });
22668
+
22669
+ // apps/cli/src/infra/commands/UpdateCommand.ts
22670
+ var import_cmd_ts41 = __toESM(require_cjs());
22671
+ var { version: CLI_VERSION6 } = require_package();
22672
+ var updateCommand = (0, import_cmd_ts41.command)({
22673
+ name: "update",
22674
+ description: "Update packmind-cli to the latest version",
22675
+ args: {
22676
+ check: (0, import_cmd_ts41.flag)({
22677
+ long: "check",
22678
+ description: "Only check if a newer version is available without performing the update"
22679
+ })
22680
+ },
22681
+ handler: async ({ check }) => {
22682
+ await updateHandler({
22683
+ currentVersion: CLI_VERSION6,
22684
+ isExecutableMode: hasEmbeddedWasmFiles(),
22685
+ executablePath: process.execPath,
22686
+ scriptPath: require.main?.filename,
22687
+ platform: process.platform,
22688
+ arch: process.arch,
22689
+ fetchFn: fetch,
22690
+ checkOnly: check
22691
+ });
22692
+ }
22693
+ });
22694
+
22695
+ // apps/cli/src/infra/commands/git/gitCommand.ts
22696
+ var import_cmd_ts45 = __toESM(require_cjs());
22697
+
22698
+ // apps/cli/src/infra/commands/git/infoCommand.ts
22699
+ var import_cmd_ts42 = __toESM(require_cjs());
22700
+
22701
+ // apps/cli/src/infra/commands/trackingErrors.ts
22702
+ function handleTrackingError(error) {
22703
+ if (error instanceof NotLoggedInError) {
22704
+ logErrorConsole(error.message);
22705
+ process.exit(1);
22706
+ return;
22707
+ }
22708
+ const statusCode = error?.statusCode;
22709
+ if (statusCode === 404) {
22710
+ logErrorConsole("Repository tracking is not available for your account.");
22711
+ process.exit(1);
22712
+ return;
22713
+ }
22714
+ if (statusCode === 403) {
22715
+ logErrorConsole(
22716
+ "Only organization admins can change which repository Packmind tracks. Ask an admin of your organization to run this command."
22717
+ );
22718
+ process.exit(1);
22719
+ return;
22720
+ }
22721
+ const message = error instanceof Error ? error.message : String(error);
22722
+ logErrorConsole(message);
22723
+ process.exit(1);
22724
+ }
22725
+
22726
+ // apps/cli/src/infra/commands/trackingInfoHandler.ts
22727
+ async function trackingInfoHandler(deps) {
22728
+ let result;
22729
+ try {
22730
+ result = await deps.getTrackingInfo({ repoPath: deps.baseDirectory });
22731
+ } catch (error) {
22732
+ handleTrackingError(error);
22733
+ return;
22734
+ }
22735
+ if (result.status === "not-tracked") {
22736
+ logInfoConsole(
22737
+ result.currentBranchDetached ? `${result.owner}/${result.repo} is not tracked in Packmind. No branch is checked out here \u2014 run ${formatCommand(
22738
+ "packmind git track --branch <name>"
22739
+ )} to track one.` : `${result.owner}/${result.repo} is not tracked in Packmind. Run ${formatCommand(
22740
+ "packmind git track"
22741
+ )} to track branch '${result.currentBranch}'.`
22742
+ );
22743
+ process.exit(0);
22744
+ return;
22745
+ }
22746
+ logInfoConsole(
22747
+ `Packmind tracks ${result.owner}/${result.repo} on branch '${result.trackedBranch}'.`
22748
+ );
22749
+ if (result.currentBranch !== result.trackedBranch) {
22750
+ logWarningConsole(mismatchWarning(result));
22751
+ }
22752
+ process.exit(0);
22753
+ }
22754
+ function mismatchWarning(result) {
22755
+ const moveTracking = result.currentBranchDetached ? `${formatCommand("packmind git track --update --branch <name>")} to move tracking to a branch that exists` : `${formatCommand("packmind git track --update")} to move tracking to '${result.currentBranch}'`;
22756
+ if (!result.trackedBranchExists) {
22757
+ return `Branch '${result.trackedBranch}' is not in this repository \u2014 deleted after a merge, or never fetched here \u2014 so no distribution is recorded anywhere. Run ${moveTracking}, or ${formatCommand(
22758
+ "git fetch"
22759
+ )} if the branch is still on the remote.`;
22760
+ }
22761
+ if (result.currentBranchDetached) {
22762
+ return `No branch is checked out here \u2014 HEAD is detached \u2014 so distributions from here are not recorded. Check '${result.trackedBranch}' out to record them, or run ${moveTracking}.`;
22763
+ }
22764
+ return `You are on '${result.currentBranch}', so distributions from here are not recorded. Run ${moveTracking}.`;
22765
+ }
22766
+
22767
+ // apps/cli/src/infra/commands/git/infoCommand.ts
22768
+ var infoCommand = (0, import_cmd_ts42.command)({
22769
+ name: "info",
22770
+ description: "Show whether Packmind tracks the current repository, and on which branch",
22771
+ args: {},
22772
+ handler: async () => {
22773
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22774
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22775
+ await trackingInfoHandler({
22776
+ baseDirectory: process.cwd(),
22777
+ getTrackingInfo: packmindCliHexa.getTrackingInfo.bind(packmindCliHexa)
22778
+ });
22779
+ }
22780
+ });
22781
+
22782
+ // apps/cli/src/infra/commands/git/trackCommand.ts
22783
+ var import_cmd_ts43 = __toESM(require_cjs());
22784
+
22193
22785
  // apps/cli/src/infra/commands/trackHandler.ts
22194
22786
  async function trackHandler(deps) {
22195
22787
  const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
@@ -22203,10 +22795,12 @@ async function trackHandler(deps) {
22203
22795
  repoPath: deps.baseDirectory,
22204
22796
  origin: "track",
22205
22797
  update: deps.update,
22798
+ remove: false,
22799
+ branch: deps.branch,
22206
22800
  confirm
22207
22801
  });
22208
22802
  } catch (error) {
22209
- handleTrackError(error);
22803
+ handleTrackingError(error);
22210
22804
  return;
22211
22805
  }
22212
22806
  switch (result.status) {
@@ -22226,99 +22820,144 @@ async function trackHandler(deps) {
22226
22820
  logInfoConsole("No changes made. The tracked branch is unchanged.");
22227
22821
  process.exit(0);
22228
22822
  return;
22823
+ // The desired state is already in place, whether or not --update was
22824
+ // passed, so both spellings succeed. Exit codes follow one rule: 0 when
22825
+ // the desired state holds, 1 when it cannot be reached.
22229
22826
  case "already-tracked-same-branch":
22230
- if (deps.update) {
22231
- logErrorConsole(
22232
- `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22233
- );
22234
- process.exit(1);
22235
- } else {
22236
- logInfoConsole(
22237
- `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22238
- );
22239
- process.exit(0);
22240
- }
22827
+ logInfoConsole(
22828
+ `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22829
+ );
22830
+ process.exit(0);
22241
22831
  return;
22242
22832
  case "already-tracked-other-branch":
22243
22833
  logErrorConsole(
22244
22834
  `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.trackedBranch}. Run ${formatCommand(
22245
- "packmind track --update"
22835
+ // `--update` alone moves tracking to the checked-out branch, which is
22836
+ // not the target when a branch was named explicitly.
22837
+ deps.branch ? `packmind git track --update --branch ${result.branch}` : "packmind git track --update"
22246
22838
  )} to move it to ${result.branch}.`
22247
22839
  );
22248
22840
  process.exit(1);
22249
22841
  return;
22842
+ case "detached-head":
22843
+ logErrorConsole(
22844
+ `No branch is checked out for ${result.owner}/${result.repo} \u2014 HEAD is detached. Check a branch out, or name one with ${formatCommand("packmind git track --branch <name>")}.`
22845
+ );
22846
+ process.exit(1);
22847
+ return;
22848
+ case "branch-not-found":
22849
+ logErrorConsole(
22850
+ `Branch ${result.branch} does not exist in ${result.owner}/${result.repo}. Check the spelling, or run ${formatCommand("git fetch")} first if the branch only exists on the remote.`
22851
+ );
22852
+ process.exit(1);
22853
+ return;
22250
22854
  case "nothing-tracked":
22251
22855
  logErrorConsole(
22252
- `Nothing is tracked yet \u2014 run ${formatCommand("packmind init")} or ${formatCommand("packmind track")} to start tracking.`
22856
+ `Nothing is tracked yet \u2014 run ${formatCommand("packmind init")} or ${formatCommand("packmind git track")} to start tracking.`
22253
22857
  );
22254
22858
  process.exit(1);
22255
22859
  return;
22860
+ default:
22861
+ return;
22256
22862
  }
22257
22863
  }
22258
- function handleTrackError(error) {
22259
- if (error instanceof NotLoggedInError) {
22260
- logErrorConsole(error.message);
22261
- process.exit(1);
22262
- return;
22263
- }
22264
- const statusCode = error?.statusCode;
22265
- if (statusCode === 404) {
22266
- logErrorConsole("Repository tracking is not available for your account.");
22267
- process.exit(1);
22268
- return;
22269
- }
22270
- const message = error instanceof Error ? error.message : String(error);
22271
- logErrorConsole(message);
22272
- process.exit(1);
22273
- }
22274
22864
 
22275
- // apps/cli/src/infra/commands/TrackCommand.ts
22276
- var trackCommand = (0, import_cmd_ts39.command)({
22865
+ // apps/cli/src/infra/commands/git/trackCommand.ts
22866
+ var trackCommand2 = (0, import_cmd_ts43.command)({
22277
22867
  name: "track",
22278
22868
  description: "Set the repository and branch Packmind tracks for the current project",
22279
22869
  args: {
22280
- update: (0, import_cmd_ts39.flag)({
22870
+ update: (0, import_cmd_ts43.flag)({
22281
22871
  long: "update",
22282
- description: "Move the tracked branch to the current branch (requires an existing tracked branch)"
22872
+ description: "Move the tracked branch to the checked-out branch, or to --branch when it is given (requires an existing tracked branch)"
22873
+ }),
22874
+ branch: (0, import_cmd_ts43.option)({
22875
+ type: (0, import_cmd_ts43.optional)(import_cmd_ts43.string),
22876
+ long: "branch",
22877
+ description: "Branch to track instead of the checked-out one; combines with --update to move tracking to it"
22283
22878
  })
22284
22879
  },
22285
- handler: async ({ update }) => {
22880
+ handler: async ({ update, branch }) => {
22286
22881
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22287
22882
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22288
22883
  await trackHandler({
22289
22884
  update,
22885
+ branch,
22290
22886
  baseDirectory: process.cwd(),
22291
22887
  trackRepository: packmindCliHexa.trackRepository.bind(packmindCliHexa)
22292
22888
  });
22293
22889
  }
22294
22890
  });
22295
22891
 
22296
- // apps/cli/src/infra/commands/UpdateCommand.ts
22297
- var import_cmd_ts40 = __toESM(require_cjs());
22298
- var { version: CLI_VERSION6 } = require_package();
22299
- var updateCommand = (0, import_cmd_ts40.command)({
22300
- name: "update",
22301
- description: "Update packmind-cli to the latest version",
22302
- args: {
22303
- check: (0, import_cmd_ts40.flag)({
22304
- long: "check",
22305
- description: "Only check if a newer version is available without performing the update"
22306
- })
22307
- },
22308
- handler: async ({ check }) => {
22309
- await updateHandler({
22310
- currentVersion: CLI_VERSION6,
22311
- isExecutableMode: hasEmbeddedWasmFiles(),
22312
- executablePath: process.execPath,
22313
- scriptPath: require.main?.filename,
22314
- platform: process.platform,
22315
- arch: process.arch,
22316
- fetchFn: fetch,
22317
- checkOnly: check
22892
+ // apps/cli/src/infra/commands/git/untrackCommand.ts
22893
+ var import_cmd_ts44 = __toESM(require_cjs());
22894
+
22895
+ // apps/cli/src/infra/commands/untrackHandler.ts
22896
+ async function untrackHandler(deps) {
22897
+ const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
22898
+ const confirm = createTrackConfirm({
22899
+ isTTY,
22900
+ confirmPrompt: deps.confirmPrompt
22901
+ });
22902
+ let result;
22903
+ try {
22904
+ result = await deps.trackRepository({
22905
+ repoPath: deps.baseDirectory,
22906
+ origin: "track",
22907
+ update: false,
22908
+ remove: true,
22909
+ confirm
22910
+ });
22911
+ } catch (error) {
22912
+ handleTrackingError(error);
22913
+ return;
22914
+ }
22915
+ switch (result.status) {
22916
+ case "removed":
22917
+ logSuccessConsole(
22918
+ `Packmind no longer tracks ${result.owner}/${result.repo}. Distributions recorded on branch ${result.branch} are kept and reappear if you track it again.`
22919
+ );
22920
+ process.exit(0);
22921
+ return;
22922
+ case "not-tracked":
22923
+ logWarningConsole(
22924
+ `Repository is not tracked in '${result.organizationName}' organization`
22925
+ );
22926
+ process.exit(0);
22927
+ return;
22928
+ default:
22929
+ logInfoConsole("No changes made. The tracked branch is unchanged.");
22930
+ process.exit(0);
22931
+ return;
22932
+ }
22933
+ }
22934
+
22935
+ // apps/cli/src/infra/commands/git/untrackCommand.ts
22936
+ var untrackCommand2 = (0, import_cmd_ts44.command)({
22937
+ name: "untrack",
22938
+ description: "Remove Packmind's tracking of the current repository (keeps every recorded distribution)",
22939
+ args: {},
22940
+ handler: async () => {
22941
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22942
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22943
+ await untrackHandler({
22944
+ baseDirectory: process.cwd(),
22945
+ trackRepository: packmindCliHexa.trackRepository.bind(packmindCliHexa)
22318
22946
  });
22319
22947
  }
22320
22948
  });
22321
22949
 
22950
+ // apps/cli/src/infra/commands/git/gitCommand.ts
22951
+ var gitCommand = (0, import_cmd_ts45.subcommands)({
22952
+ name: "git",
22953
+ description: "Manage repository tracking in Packmind",
22954
+ cmds: {
22955
+ info: infoCommand,
22956
+ track: trackCommand2,
22957
+ untrack: untrackCommand2
22958
+ }
22959
+ });
22960
+
22322
22961
  // apps/cli/src/main.ts
22323
22962
  var { version: CLI_VERSION7 } = require_package();
22324
22963
  function findEnvFile() {
@@ -22358,12 +22997,13 @@ if (args.includes("--version") || args.includes("-v")) {
22358
22997
  logConsole(`packmind-cli version ${CLI_VERSION7}`);
22359
22998
  process.exit(0);
22360
22999
  }
22361
- var app = (0, import_cmd_ts41.subcommands)({
23000
+ var app = (0, import_cmd_ts46.subcommands)({
22362
23001
  name: "packmind-cli",
22363
23002
  description: "Packmind CLI tool",
22364
23003
  cmds: {
22365
23004
  commands: commandsCommand,
22366
23005
  config: configCommand,
23006
+ git: gitCommand,
22367
23007
  init: initCommand,
22368
23008
  install: installCommand,
22369
23009
  lint: lintCommand,
@@ -22377,11 +23017,12 @@ var app = (0, import_cmd_ts41.subcommands)({
22377
23017
  standards: standardsCommand,
22378
23018
  track: trackCommand,
22379
23019
  uninstall: uninstallCommand,
23020
+ untrack: untrackCommand,
22380
23021
  update: updateCommand,
22381
23022
  whoami: whoamiCommand
22382
23023
  }
22383
23024
  });
22384
- (0, import_cmd_ts41.run)(app, args).catch((error) => {
23025
+ (0, import_cmd_ts46.run)(app, args).catch((error) => {
22385
23026
  logErrorConsole(error.message);
22386
23027
  process.exit(1);
22387
23028
  });