@packmind/cli 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/main.cjs +1209 -608
  2. package/package.json +3 -1
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(string17, substring, replacer) {
384
- let index = string17.indexOf(substring);
383
+ function stringReplaceAll(string18, substring, replacer) {
384
+ let index = string18.indexOf(substring);
385
385
  if (index === -1) {
386
- return string17;
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 += string17.slice(endIndex, index) + substring + replacer;
392
+ returnValue += string18.slice(endIndex, index) + substring + replacer;
393
393
  endIndex = index + substringLength;
394
- index = string17.indexOf(substring, endIndex);
394
+ index = string18.indexOf(substring, endIndex);
395
395
  } while (index !== -1);
396
- returnValue += string17.slice(endIndex);
396
+ returnValue += string18.slice(endIndex);
397
397
  return returnValue;
398
398
  }
399
- function stringEncaseCRLFWithFirstIndex(string17, 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 = string17[index - 1] === "\r";
404
- returnValue += string17.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 = string17.indexOf("\n", endIndex);
406
+ index = string18.indexOf("\n", endIndex);
407
407
  } while (index !== -1);
408
- returnValue += string17.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, string17) => {
568
- if (self.level <= 0 || !string17) {
569
- return self[IS_EMPTY] ? "" : string17;
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 string17;
573
+ return string18;
574
574
  }
575
575
  const { openAll, closeAll } = styler;
576
- if (string17.includes("\x1B")) {
576
+ if (string18.includes("\x1B")) {
577
577
  while (styler !== void 0) {
578
- string17 = stringReplaceAll(string17, styler.close, styler.open);
578
+ string18 = stringReplaceAll(string18, styler.close, styler.open);
579
579
  styler = styler.parent;
580
580
  }
581
581
  }
582
- const lfIndex = string17.indexOf("\n");
582
+ const lfIndex = string18.indexOf("\n");
583
583
  if (lfIndex !== -1) {
584
- string17 = stringEncaseCRLFWithFirstIndex(string17, closeAll, openAll, lfIndex);
584
+ string18 = stringEncaseCRLFWithFirstIndex(string18, closeAll, openAll, lfIndex);
585
585
  }
586
- return openAll + string17 + 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 option19 of node.options) {
780
- if (opts.shortNames.includes(option19.key)) {
781
- result.push(option19);
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 = optional14;
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 optional14(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
@@ -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 option19 = 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(option19)}?`;
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(string17) {
1591
- if (typeof string17 !== "string") {
1592
- throw new TypeError(`Expected a \`string\`, got \`${typeof string17}\``);
1590
+ function stripAnsi(string18) {
1591
+ if (typeof string18 !== "string") {
1592
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string18}\``);
1593
1593
  }
1594
- if (!string17.includes("\x1B") && !string17.includes("\x9B")) {
1595
- return string17;
1594
+ if (!string18.includes("\x1B") && !string18.includes("\x9B")) {
1595
+ return string18;
1596
1596
  }
1597
- return string17.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 = command32;
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 command32(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 option19 of node.options) {
1797
- if (context.visitedNodes.has(option19)) {
1796
+ for (const option20 of node.options) {
1797
+ if (context.visitedNodes.has(option20)) {
1798
1798
  continue;
1799
1799
  }
1800
- unknownArguments.push(option19);
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 = option19;
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 option20 = options[0];
1955
+ const option21 = options[0];
1956
1956
  let rawValue;
1957
1957
  let envPrefix = "";
1958
- if (option20 === null || option20 === void 0 ? void 0 : option20.value) {
1959
- rawValue = option20.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 = (option20 === null || option20 === void 0 ? void 0 : option20.type) === "shortOption" ? `-${option20 === null || option20 === void 0 ? void 0 : option20.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 option19(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 option19 of node.options) {
2056
- if (error.nodes.includes(option19)) {
2057
- s += chalk_1.default.red(option19.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(option19.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("-");
@@ -2243,7 +2243,7 @@ var require_common = __commonJS({
2243
2243
  createDebug.coerce = coerce;
2244
2244
  createDebug.disable = disable;
2245
2245
  createDebug.enable = enable;
2246
- createDebug.enabled = enabled;
2246
+ createDebug.enabled = enabled2;
2247
2247
  createDebug.humanize = require_ms();
2248
2248
  createDebug.destroy = destroy;
2249
2249
  Object.keys(env2).forEach((key) => {
@@ -2382,7 +2382,7 @@ var require_common = __commonJS({
2382
2382
  createDebug.enable("");
2383
2383
  return namespaces;
2384
2384
  }
2385
- function enabled(name) {
2385
+ function enabled2(name) {
2386
2386
  for (const skip of createDebug.skips) {
2387
2387
  if (matchesTemplate(name, skip)) {
2388
2388
  return false;
@@ -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, string17] of (0, utils_1.enumerate)(strings)) {
3094
- const chars = [...string17];
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 });
@@ -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 option19 of options) {
3356
- visitedNodes.add(option19);
3355
+ for (const option20 of options) {
3356
+ visitedNodes.add(option20);
3357
3357
  }
3358
3358
  const optionValues = [];
3359
3359
  const errors = [];
3360
- for (const option19 of options) {
3361
- const decoded = await Result.safeAsync(flag_1.boolean.from((_b = (_a = option19.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: [option19], 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 option19 of options) {
3528
- visitedNodes.add(option19);
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 option19 of options) {
3534
- const providedValue = (_a = option19.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(option19);
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.33.0",
3861
+ version: "0.35.0",
3862
3862
  description: "A command-line interface for Packmind linting and code quality checks",
3863
3863
  private: false,
3864
3864
  bin: {
@@ -3915,7 +3915,7 @@ var require_package = __commonJS({
3915
3915
  });
3916
3916
 
3917
3917
  // apps/cli/src/main.ts
3918
- var import_cmd_ts42 = __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());
@@ -3933,6 +3933,24 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
3933
3933
  LogLevel2["SILLY"] = "silly";
3934
3934
  return LogLevel2;
3935
3935
  })(LogLevel || {});
3936
+ function formatConsoleLine(info) {
3937
+ const { timestamp, level, message, label, trace_id: traceId } = info;
3938
+ const meta = Object.fromEntries(
3939
+ Object.entries(info).filter(([key]) => !RENDERED_FIELDS.includes(key))
3940
+ );
3941
+ const metaStr = Object.keys(meta).length ? ` ${JSON.stringify(meta)}` : "";
3942
+ const traceStr = traceId ? ` [trace=${String(traceId).slice(0, 8)}]` : "";
3943
+ return `${timestamp} [${label}]${traceStr} ${level}: ${message}${metaStr}`;
3944
+ }
3945
+ var RENDERED_FIELDS = [
3946
+ "timestamp",
3947
+ "level",
3948
+ "message",
3949
+ "label",
3950
+ "trace_id",
3951
+ "span_id",
3952
+ "trace_flags"
3953
+ ];
3936
3954
  var PackmindLogger = class {
3937
3955
  constructor(name, level = "info" /* INFO */) {
3938
3956
  this.name = name;
@@ -3955,12 +3973,7 @@ var PackmindLogger = class {
3955
3973
  new import_winston.default.transports.Console({
3956
3974
  format: import_winston.default.format.combine(
3957
3975
  import_winston.default.format.colorize(),
3958
- import_winston.default.format.printf(
3959
- ({ timestamp, level: level2, message, label, ...meta }) => {
3960
- const metaStr = Object.keys(meta).length ? ` ${JSON.stringify(meta)}` : "";
3961
- return `${timestamp} [${label}] ${level2}: ${message}${metaStr}`;
3962
- }
3963
- )
3976
+ import_winston.default.format.printf(formatConsoleLine)
3964
3977
  )
3965
3978
  })
3966
3979
  ]
@@ -4088,7 +4101,8 @@ var VALID_CODING_AGENTS = [
4088
4101
  "gitlab_duo",
4089
4102
  "continue",
4090
4103
  "opencode",
4091
- "codex"
4104
+ "codex",
4105
+ "kiro"
4092
4106
  ];
4093
4107
  function isValidCodingAgent(value) {
4094
4108
  return VALID_CODING_AGENTS.includes(value);
@@ -4141,7 +4155,8 @@ var AGENT_CAPABILITIES = {
4141
4155
  copilot: { skills: true, standards: true, commands: true, recipes: true },
4142
4156
  continue: { skills: false, standards: true, commands: true, recipes: true },
4143
4157
  junie: { skills: false, standards: true, commands: true, recipes: true },
4144
- opencode: { skills: true, standards: true, commands: true, recipes: true }
4158
+ opencode: { skills: true, standards: true, commands: true, recipes: true },
4159
+ kiro: { skills: true, standards: true, commands: false, recipes: false }
4145
4160
  };
4146
4161
  function hasCapableAgent(agents, capability) {
4147
4162
  return agents.some((agent) => AGENT_CAPABILITIES[agent][capability]);
@@ -4164,7 +4179,8 @@ var CodingAgents = {
4164
4179
  gitlab_duo: "gitlab_duo",
4165
4180
  continue: "continue",
4166
4181
  opencode: "opencode",
4167
- codex: "codex"
4182
+ codex: "codex",
4183
+ kiro: "kiro"
4168
4184
  };
4169
4185
 
4170
4186
  // packages/types/src/coding-agent/CodingAgentArtefactPaths.ts
@@ -4213,6 +4229,11 @@ var CODING_AGENT_ARTEFACT_PATHS = {
4213
4229
  command: "",
4214
4230
  standard: "",
4215
4231
  skill: ".agents/skills/"
4232
+ },
4233
+ kiro: {
4234
+ command: "",
4235
+ standard: ".kiro/steering/",
4236
+ skill: ".kiro/skills/"
4216
4237
  }
4217
4238
  };
4218
4239
 
@@ -4390,9 +4411,11 @@ var RENDER_MODE_ORDER = [
4390
4411
  "GH_COPILOT" /* GH_COPILOT */,
4391
4412
  "CLAUDE" /* CLAUDE */,
4392
4413
  "CLAUDE_PLUGIN" /* CLAUDE_PLUGIN */,
4414
+ "COPILOT_PLUGIN" /* COPILOT_PLUGIN */,
4393
4415
  "CURSOR" /* CURSOR */,
4394
4416
  "GITLAB_DUO" /* GITLAB_DUO */,
4395
- "CONTINUE" /* CONTINUE */
4417
+ "CONTINUE" /* CONTINUE */,
4418
+ "KIRO" /* KIRO */
4396
4419
  ];
4397
4420
  var normalizeRenderModes = (modes) => {
4398
4421
  const uniqueModes = new Set(modes);
@@ -4417,13 +4440,20 @@ var RENDER_MODE_TO_CODING_AGENT = {
4417
4440
  ["GH_COPILOT" /* GH_COPILOT */]: CodingAgents.copilot,
4418
4441
  ["CLAUDE" /* CLAUDE */]: CodingAgents.claude,
4419
4442
  ["CLAUDE_PLUGIN" /* CLAUDE_PLUGIN */]: CodingAgents.claude_plugin,
4443
+ // No dedicated CodingAgent/deployer exists yet for the Copilot plugin
4444
+ // format — wiring it up (and populating this entry) is a later task.
4445
+ ["COPILOT_PLUGIN" /* COPILOT_PLUGIN */]: void 0,
4420
4446
  ["CURSOR" /* CURSOR */]: CodingAgents.cursor,
4421
4447
  ["GITLAB_DUO" /* GITLAB_DUO */]: CodingAgents.gitlab_duo,
4422
4448
  ["CONTINUE" /* CONTINUE */]: CodingAgents.continue,
4423
- ["CODEX" /* CODEX */]: CodingAgents.codex
4449
+ ["CODEX" /* CODEX */]: CodingAgents.codex,
4450
+ ["KIRO" /* KIRO */]: CodingAgents.kiro
4424
4451
  };
4425
4452
  var CODING_AGENT_TO_RENDER_MODE = Object.entries(RENDER_MODE_TO_CODING_AGENT).reduce(
4426
4453
  (acc, [renderMode, codingAgent]) => {
4454
+ if (codingAgent === void 0) {
4455
+ return acc;
4456
+ }
4427
4457
  acc[codingAgent] = renderMode;
4428
4458
  return acc;
4429
4459
  },
@@ -5327,7 +5357,8 @@ var createMarketplaceId = brandedIdFactory();
5327
5357
  // packages/types/src/marketplaces/MarketplaceDescriptorFilename.ts
5328
5358
  var MARKETPLACE_DESCRIPTOR_PATHS = [
5329
5359
  ".claude-plugin/marketplace.json",
5330
- "marketplace.json"
5360
+ "marketplace.json",
5361
+ ".github/plugin/marketplace.json"
5331
5362
  ];
5332
5363
  var MARKETPLACE_DESCRIPTOR_FILENAME = MARKETPLACE_DESCRIPTOR_PATHS[0];
5333
5364
 
@@ -5511,8 +5542,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
5511
5542
  static {
5512
5543
  this.fallbackRuleContent = "adhoc-rule";
5513
5544
  }
5514
- async execute(command32) {
5515
- const { program, fileContent, language } = command32;
5545
+ async execute(command35) {
5546
+ const { program, fileContent, language } = command35;
5516
5547
  const result = await this.linterExecutionUseCase.execute({
5517
5548
  filePath: "cli-single-file",
5518
5549
  fileContent,
@@ -5559,6 +5590,11 @@ function resolveSkillDirPath(absolutePath) {
5559
5590
 
5560
5591
  // apps/cli/src/application/services/GitService.ts
5561
5592
  var origin = "GitService";
5593
+ var DETACHED_HEAD = "HEAD";
5594
+ var LOCAL_REF_NAMESPACE = "refs/heads";
5595
+ var REMOTE_REF_NAMESPACE = "refs/remotes";
5596
+ var LOCAL_REF_PREFIX = `${LOCAL_REF_NAMESPACE}/`;
5597
+ var REMOTE_REF_PREFIX = `${REMOTE_REF_NAMESPACE}/`;
5562
5598
  var GitService = class {
5563
5599
  constructor(logger2 = new PackmindLogger(origin), gitRunner = (cmd, opts) => {
5564
5600
  const stdout = (0, import_child_process.execSync)(`git ${cmd}`, {
@@ -5571,27 +5607,37 @@ var GitService = class {
5571
5607
  this.gitRunner = gitRunner;
5572
5608
  this.logger = logger2;
5573
5609
  }
5574
- getGitRepositoryRoot(path37) {
5610
+ /**
5611
+ * Runs git and turns an invocation failure into a message the user can act on.
5612
+ *
5613
+ * The raw git stderr is deliberately dropped: every caller prints this message
5614
+ * as-is, and `fatal: not a git repository (or any of the parent directories)`
5615
+ * adds nothing the sentence does not already say. The command name is not
5616
+ * mentioned either — these helpers back `lint`, `install`, `git track`,
5617
+ * `git info` and more, so naming one is wrong for all the others.
5618
+ */
5619
+ runGit(gitCommand2, repoPath, failure) {
5575
5620
  try {
5576
- const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
5577
- cwd: path37
5578
- });
5579
- const gitRoot = stdout.trim();
5580
- this.logger.debug("Resolved git repository root", {
5581
- inputPath: path37,
5582
- gitRoot
5583
- });
5584
- return gitRoot;
5585
- } catch (error) {
5586
- if (error instanceof Error) {
5587
- throw new Error(
5588
- `Failed to get Git repository root. The path '${path37}' does not appear to be inside a Git repository.
5589
- ${error.message}`
5590
- );
5591
- }
5592
- throw new Error("Failed to get Git repository root: Unknown error");
5621
+ return this.gitRunner(gitCommand2, { cwd: repoPath }).stdout;
5622
+ } catch {
5623
+ throw new Error(
5624
+ `${failure}. The path '${repoPath}' does not appear to be inside a Git repository.`
5625
+ );
5593
5626
  }
5594
5627
  }
5628
+ getGitRepositoryRoot(path37) {
5629
+ const stdout = this.runGit(
5630
+ "rev-parse --show-toplevel",
5631
+ path37,
5632
+ "Failed to get Git repository root"
5633
+ );
5634
+ const gitRoot = stdout.trim();
5635
+ this.logger.debug("Resolved git repository root", {
5636
+ inputPath: path37,
5637
+ gitRoot
5638
+ });
5639
+ return gitRoot;
5640
+ }
5595
5641
  tryGetGitRepositoryRoot(path37) {
5596
5642
  try {
5597
5643
  return this.getGitRepositoryRoot(path37);
@@ -5612,82 +5658,117 @@ ${error.message}`
5612
5658
  }
5613
5659
  }
5614
5660
  getCurrentBranch(repoPath) {
5615
- try {
5616
- const { stdout } = this.gitRunner("rev-parse --abbrev-ref HEAD", {
5617
- cwd: repoPath
5618
- });
5619
- const branch = stdout.trim();
5620
- this.logger.debug("Resolved current branch", {
5621
- repoPath,
5622
- branch
5623
- });
5624
- return { branch };
5625
- } catch (error) {
5626
- if (error instanceof Error) {
5627
- throw new Error(
5628
- `Failed to get current Git branch. The path '${repoPath}' does not appear to be inside a Git repository.
5629
- ${error.message}`
5630
- );
5631
- }
5632
- throw new Error("Failed to get current Git branch: Unknown error");
5633
- }
5661
+ const stdout = this.runGit(
5662
+ "rev-parse --abbrev-ref HEAD",
5663
+ repoPath,
5664
+ "Failed to get current Git branch"
5665
+ );
5666
+ const branch = stdout.trim();
5667
+ const detached = branch === DETACHED_HEAD;
5668
+ this.logger.debug("Resolved current branch", {
5669
+ repoPath,
5670
+ branch,
5671
+ detached
5672
+ });
5673
+ return { branch, detached };
5634
5674
  }
5635
5675
  getCurrentBranches(repoPath) {
5636
- try {
5637
- const { stdout } = this.gitRunner("branch -a --contains HEAD", {
5638
- cwd: repoPath
5639
- });
5640
- const branches = this.parseBranches(stdout);
5641
- return { branches };
5642
- } catch (error) {
5643
- if (error instanceof Error) {
5644
- throw new Error(
5645
- `Failed to get Git branches. packmind-cli lint must be run in a Git repository.
5646
- ${error.message}`
5647
- );
5676
+ const stdout = this.runGit(
5677
+ "branch -a --contains HEAD",
5678
+ repoPath,
5679
+ "Failed to get Git branches"
5680
+ );
5681
+ return { branches: this.parseBranches(stdout) };
5682
+ }
5683
+ getAllBranches(repoPath) {
5684
+ const stdout = this.runGit(
5685
+ `for-each-ref --format="%(refname)" ${LOCAL_REF_NAMESPACE} ${REMOTE_REF_NAMESPACE}`,
5686
+ repoPath,
5687
+ "Failed to get Git branches"
5688
+ );
5689
+ return { branches: this.parseRefNames(stdout) };
5690
+ }
5691
+ /**
5692
+ * Local and remote-tracking branches are both accepted: `git track --branch`
5693
+ * does not require the branch to be checked out, only to exist.
5694
+ *
5695
+ * `for-each-ref` is plumbing, so its output is the list of refs and nothing
5696
+ * else. `git branch -a` renders for humans, and every decoration it adds used
5697
+ * to be read as part of the branch name — refusing branches that do exist:
5698
+ * `+ feature` for a branch held by a linked worktree, ANSI escapes under
5699
+ * `color.ui = always`, and every branch on one line under `column.ui = always`
5700
+ * (the last two are forced through a pipe, which is how the CLI runs git).
5701
+ *
5702
+ * The branch name is matched in-process instead of being handed to git: it
5703
+ * comes straight from `--branch`, and interpolating it into the command line
5704
+ * would pass user input to the shell.
5705
+ */
5706
+ branchExists(repoPath, branch) {
5707
+ const { branches } = this.getAllBranches(repoPath);
5708
+ return branches.includes(branch);
5709
+ }
5710
+ /**
5711
+ * Turns full refnames into branch names.
5712
+ *
5713
+ * The remote name is dropped, so a branch that exists only on a remote counts
5714
+ * as existing — what `--branch` promises, since it does not require a local
5715
+ * checkout. `refs/remotes/<remote>/HEAD` is skipped: it is a symref to the
5716
+ * remote's default branch, not a branch of its own.
5717
+ */
5718
+ parseRefNames(forEachRefOutput) {
5719
+ const branchNames = /* @__PURE__ */ new Set();
5720
+ for (const line of forEachRefOutput.split("\n")) {
5721
+ const refName = line.trim();
5722
+ if (refName.startsWith(LOCAL_REF_PREFIX)) {
5723
+ branchNames.add(refName.substring(LOCAL_REF_PREFIX.length));
5724
+ continue;
5725
+ }
5726
+ if (!refName.startsWith(REMOTE_REF_PREFIX)) {
5727
+ continue;
5728
+ }
5729
+ const withoutNamespace = refName.substring(REMOTE_REF_PREFIX.length);
5730
+ const remoteSeparator = withoutNamespace.indexOf("/");
5731
+ if (remoteSeparator === -1) {
5732
+ continue;
5733
+ }
5734
+ const branchName = withoutNamespace.substring(remoteSeparator + 1);
5735
+ if (branchName && branchName !== DETACHED_HEAD) {
5736
+ branchNames.add(branchName);
5648
5737
  }
5649
- throw new Error("Failed to get Git branches: Unknown error");
5650
5738
  }
5739
+ return Array.from(branchNames);
5651
5740
  }
5652
5741
  getGitRemoteUrl(repoPath, origin9) {
5653
- try {
5654
- const { stdout } = this.gitRunner("remote -v", {
5655
- cwd: repoPath
5656
- });
5657
- const remotes = this.parseRemotes(stdout);
5658
- if (remotes.length === 0) {
5659
- throw new Error("No Git remotes found in the repository");
5660
- }
5661
- let selectedRemote;
5662
- if (origin9) {
5663
- const foundRemote = remotes.find((remote) => remote.name === origin9);
5664
- if (!foundRemote) {
5665
- throw new Error(`Remote '${origin9}' not found in repository`);
5666
- }
5667
- selectedRemote = foundRemote.url;
5668
- } else if (remotes.length === 1) {
5669
- selectedRemote = remotes[0].url;
5670
- } else {
5671
- const originRemote = remotes.find((remote) => remote.name === "origin");
5672
- if (!originRemote) {
5673
- throw new Error(
5674
- "Multiple remotes found but no 'origin' remote. Please specify the remote name."
5675
- );
5676
- }
5677
- selectedRemote = originRemote.url;
5678
- }
5679
- return {
5680
- gitRemoteUrl: this.normalizeGitUrl(selectedRemote)
5681
- };
5682
- } catch (error) {
5683
- if (error instanceof Error) {
5742
+ const stdout = this.runGit(
5743
+ "remote -v",
5744
+ repoPath,
5745
+ "Failed to get Git remote URL"
5746
+ );
5747
+ const remotes = this.parseRemotes(stdout);
5748
+ if (remotes.length === 0) {
5749
+ throw new Error("No Git remotes found in the repository");
5750
+ }
5751
+ let selectedRemote;
5752
+ if (origin9) {
5753
+ const foundRemote = remotes.find((remote) => remote.name === origin9);
5754
+ if (!foundRemote) {
5755
+ throw new Error(`Remote '${origin9}' not found in repository`);
5756
+ }
5757
+ selectedRemote = foundRemote.url;
5758
+ } else if (remotes.length === 1) {
5759
+ selectedRemote = remotes[0].url;
5760
+ } else {
5761
+ const originRemote = remotes.find((remote) => remote.name === "origin");
5762
+ if (!originRemote) {
5684
5763
  throw new Error(
5685
- `Failed to get Git remote URL. packmind-cli lint must be run in a Git repository.
5686
- ${error.message}`
5764
+ "Multiple remotes found but no 'origin' remote. Please specify the remote name."
5687
5765
  );
5688
5766
  }
5689
- throw new Error("Failed to get Git remote URL: Unknown error");
5767
+ selectedRemote = originRemote.url;
5690
5768
  }
5769
+ return {
5770
+ gitRemoteUrl: this.normalizeGitUrl(selectedRemote)
5771
+ };
5691
5772
  }
5692
5773
  /**
5693
5774
  * Gets files that have been modified (staged + unstaged) compared to HEAD.
@@ -5896,8 +5977,8 @@ var GetGitRemoteUrlUseCase = class {
5896
5977
  constructor(gitRemoteUrlService = new GitService()) {
5897
5978
  this.gitRemoteUrlService = gitRemoteUrlService;
5898
5979
  }
5899
- async execute(command32) {
5900
- const { path: repoPath, origin: origin9 } = command32;
5980
+ async execute(command35) {
5981
+ const { path: repoPath, origin: origin9 } = command35;
5901
5982
  return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
5902
5983
  }
5903
5984
  };
@@ -5908,7 +5989,45 @@ var path3 = __toESM(require("path"));
5908
5989
 
5909
5990
  // apps/cli/src/infra/utils/consoleLogger.ts
5910
5991
  init_source();
5911
- var CLI_PREFIX = "packmind-cli";
5992
+
5993
+ // apps/cli/src/infra/utils/execName.ts
5994
+ var CANONICAL_EXEC_NAME = "packmind";
5995
+ var LEGACY_EXEC_NAME = "packmind-cli";
5996
+ var KNOWN_EXEC_NAMES = [
5997
+ LEGACY_EXEC_NAME,
5998
+ CANONICAL_EXEC_NAME
5999
+ ];
6000
+ var BUNFS_PREFIX = "/$bunfs/";
6001
+ function basenameWithoutExeExtension(candidate) {
6002
+ const basename4 = candidate.split(/[/\\]/).pop() ?? "";
6003
+ return basename4.replace(/\.exe$/i, "");
6004
+ }
6005
+ function matchKnownExecName(candidate) {
6006
+ if (candidate.includes(BUNFS_PREFIX)) {
6007
+ return void 0;
6008
+ }
6009
+ const name = basenameWithoutExeExtension(candidate).toLowerCase();
6010
+ return KNOWN_EXEC_NAMES.find((known) => known === name);
6011
+ }
6012
+ function resolveExecName(argv = process.argv, argv0 = process.argv0) {
6013
+ for (const candidate of [argv0, argv[0], argv[1]]) {
6014
+ if (!candidate) {
6015
+ continue;
6016
+ }
6017
+ const name = matchKnownExecName(candidate);
6018
+ if (name) {
6019
+ return name;
6020
+ }
6021
+ }
6022
+ return CANONICAL_EXEC_NAME;
6023
+ }
6024
+ function isLegacyExecName(argv = process.argv, argv0 = process.argv0) {
6025
+ return resolveExecName(argv, argv0) === LEGACY_EXEC_NAME;
6026
+ }
6027
+ var EXEC_NAME = resolveExecName();
6028
+
6029
+ // apps/cli/src/infra/utils/consoleLogger.ts
6030
+ var CLI_PREFIX = EXEC_NAME;
5912
6031
  function logConsole(message, logger2 = console) {
5913
6032
  logger2.log(message);
5914
6033
  }
@@ -6049,8 +6168,8 @@ var ListFilesInDirectoryUseCase = class {
6049
6168
  constructor(listFiles = new ListFiles()) {
6050
6169
  this.listFiles = listFiles;
6051
6170
  }
6052
- async execute(command32) {
6053
- const { path: directoryPath, extensions, excludes = [] } = command32;
6171
+ async execute(command35) {
6172
+ const { path: directoryPath, extensions, excludes = [] } = command35;
6054
6173
  const files = await this.listFiles.listFilesInDirectory(
6055
6174
  directoryPath,
6056
6175
  extensions,
@@ -6165,7 +6284,7 @@ var LintFilesAgainstRuleUseCase = class {
6165
6284
  };
6166
6285
  };
6167
6286
  }
6168
- async execute(command32) {
6287
+ async execute(command35) {
6169
6288
  const {
6170
6289
  path: userPath,
6171
6290
  draftMode,
@@ -6174,7 +6293,7 @@ var LintFilesAgainstRuleUseCase = class {
6174
6293
  language,
6175
6294
  diffMode,
6176
6295
  ignorePatterns
6177
- } = command32;
6296
+ } = command35;
6178
6297
  this.logger.debug(
6179
6298
  `Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
6180
6299
  );
@@ -6490,8 +6609,8 @@ var LintFilesAgainstRuleUseCase = class {
6490
6609
  return null;
6491
6610
  }
6492
6611
  }
6493
- async executeProgramsForFile(command32) {
6494
- const result = await this.services.linterExecutionUseCase.execute(command32);
6612
+ async executeProgramsForFile(command35) {
6613
+ const result = await this.services.linterExecutionUseCase.execute(command35);
6495
6614
  return result.violations;
6496
6615
  }
6497
6616
  extractExtensionFromFile(filePath) {
@@ -6514,8 +6633,8 @@ var LintFilesFromConfigUseCase = class {
6514
6633
  this.logger = logger2;
6515
6634
  this.detectionProgramsCache = /* @__PURE__ */ new Map();
6516
6635
  }
6517
- async execute(command32) {
6518
- const { path: userPath, diffMode, ignorePatterns } = command32;
6636
+ async execute(command35) {
6637
+ const { path: userPath, diffMode, ignorePatterns } = command35;
6519
6638
  this.logger.debug(
6520
6639
  `Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
6521
6640
  );
@@ -6775,8 +6894,8 @@ var LintFilesFromConfigUseCase = class {
6775
6894
  return null;
6776
6895
  }
6777
6896
  }
6778
- async executeProgramsForFile(command32) {
6779
- const result = await this.services.linterExecutionUseCase.execute(command32);
6897
+ async executeProgramsForFile(command35) {
6898
+ const result = await this.services.linterExecutionUseCase.execute(command35);
6780
6899
  return result.violations;
6781
6900
  }
6782
6901
  extractExtensionFromFile(filePath) {
@@ -6952,13 +7071,13 @@ var PackmindHttpClient = class {
6952
7071
  var ChangeProposalGateway = class {
6953
7072
  constructor(httpClient) {
6954
7073
  this.httpClient = httpClient;
6955
- this.batchCreate = async (command32) => {
7074
+ this.batchCreate = async (command35) => {
6956
7075
  const { organizationId } = this.httpClient.getAuthContext();
6957
7076
  return this.httpClient.request(
6958
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/batch`,
7077
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/change-proposals/batch`,
6959
7078
  {
6960
7079
  method: "POST",
6961
- body: { proposals: command32.proposals },
7080
+ body: { proposals: command35.proposals },
6962
7081
  onError: (response) => {
6963
7082
  if (response.status === 404) {
6964
7083
  throw new CommunityEditionError("change proposals");
@@ -6967,29 +7086,29 @@ var ChangeProposalGateway = class {
6967
7086
  }
6968
7087
  );
6969
7088
  };
6970
- this.batchApply = async (command32) => {
7089
+ this.batchApply = async (command35) => {
6971
7090
  const { organizationId } = this.httpClient.getAuthContext();
6972
7091
  return this.httpClient.request(
6973
7092
  `/api/v0/organizations/${organizationId}/playbook/apply`,
6974
7093
  {
6975
7094
  method: "POST",
6976
7095
  body: {
6977
- proposals: command32.proposals,
6978
- message: command32.message,
6979
- ...command32.directUpdate !== void 0 && {
6980
- directUpdate: command32.directUpdate
7096
+ proposals: command35.proposals,
7097
+ message: command35.message,
7098
+ ...command35.directUpdate !== void 0 && {
7099
+ directUpdate: command35.directUpdate
6981
7100
  }
6982
7101
  }
6983
7102
  }
6984
7103
  );
6985
7104
  };
6986
- this.check = async (command32) => {
7105
+ this.check = async (command35) => {
6987
7106
  const { organizationId } = this.httpClient.getAuthContext();
6988
7107
  return this.httpClient.request(
6989
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/check`,
7108
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/change-proposals/check`,
6990
7109
  {
6991
7110
  method: "POST",
6992
- body: { proposals: command32.proposals },
7111
+ body: { proposals: command35.proposals },
6993
7112
  onError: (response) => {
6994
7113
  if (response.status === 404) {
6995
7114
  throw new CommunityEditionError("change proposals");
@@ -7005,13 +7124,13 @@ var ChangeProposalGateway = class {
7005
7124
  var LinterGateway = class {
7006
7125
  constructor(httpClient) {
7007
7126
  this.httpClient = httpClient;
7008
- this.getDraftDetectionProgramsForRule = async (command32) => {
7127
+ this.getDraftDetectionProgramsForRule = async (command35) => {
7009
7128
  const payload = {
7010
- standardSlug: command32.standardSlug,
7011
- ruleId: command32.ruleId
7129
+ standardSlug: command35.standardSlug,
7130
+ ruleId: command35.ruleId
7012
7131
  };
7013
- if (command32.language) {
7014
- payload.language = command32.language;
7132
+ if (command35.language) {
7133
+ payload.language = command35.language;
7015
7134
  }
7016
7135
  return this.httpClient.request("/api/v0/list-draft-detection-program", {
7017
7136
  method: "POST",
@@ -7023,13 +7142,13 @@ var LinterGateway = class {
7023
7142
  }
7024
7143
  });
7025
7144
  };
7026
- this.getActiveDetectionProgramsForRule = async (command32) => {
7145
+ this.getActiveDetectionProgramsForRule = async (command35) => {
7027
7146
  const payload = {
7028
- standardSlug: command32.standardSlug,
7029
- ruleId: command32.ruleId
7147
+ standardSlug: command35.standardSlug,
7148
+ ruleId: command35.ruleId
7030
7149
  };
7031
- if (command32.language) {
7032
- payload.language = command32.language;
7150
+ if (command35.language) {
7151
+ payload.language = command35.language;
7033
7152
  }
7034
7153
  return this.httpClient.request("/api/v0/list-active-detection-program", {
7035
7154
  method: "POST",
@@ -7041,13 +7160,13 @@ var LinterGateway = class {
7041
7160
  }
7042
7161
  });
7043
7162
  };
7044
- this.getDetectionProgramsForPackages = async (command32) => {
7163
+ this.getDetectionProgramsForPackages = async (command35) => {
7045
7164
  const response = await this.httpClient.request(
7046
7165
  "/api/v0/detection-programs-for-packages",
7047
7166
  {
7048
7167
  method: "POST",
7049
7168
  body: {
7050
- packagesSlugs: command32.packagesSlugs
7169
+ packagesSlugs: command35.packagesSlugs
7051
7170
  },
7052
7171
  onError: (response2) => {
7053
7172
  if (response2.status === 404) {
@@ -7058,10 +7177,10 @@ var LinterGateway = class {
7058
7177
  );
7059
7178
  return handleScopeInTargetsResponse(response);
7060
7179
  };
7061
- this.trackLinterExecution = async (command32) => {
7180
+ this.trackLinterExecution = async (command35) => {
7062
7181
  return this.httpClient.request(`/api/v0/track-execution`, {
7063
7182
  method: "POST",
7064
- body: command32
7183
+ body: command35
7065
7184
  });
7066
7185
  };
7067
7186
  }
@@ -7115,27 +7234,27 @@ var SpacesGateway = class {
7115
7234
  var SkillsGateway = class {
7116
7235
  constructor(httpClient) {
7117
7236
  this.httpClient = httpClient;
7118
- this.upload = async (command32) => {
7237
+ this.upload = async (command35) => {
7119
7238
  const { organizationId } = this.httpClient.getAuthContext();
7120
7239
  return this.httpClient.request(
7121
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills/upload`,
7240
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/skills/upload`,
7122
7241
  {
7123
7242
  method: "POST",
7124
- body: command32
7243
+ body: command35
7125
7244
  }
7126
7245
  );
7127
7246
  };
7128
- this.getDefaults = async (command32) => {
7247
+ this.getDefaults = async (command35) => {
7129
7248
  const { organizationId } = this.httpClient.getAuthContext();
7130
7249
  const queryParams = new URLSearchParams();
7131
- if (command32.includeBeta) {
7250
+ if (command35.includeBeta) {
7132
7251
  queryParams.set("includeBeta", "true");
7133
- } else if (command32.cliVersion) {
7134
- queryParams.set("cliVersion", command32.cliVersion);
7252
+ } else if (command35.cliVersion) {
7253
+ queryParams.set("cliVersion", command35.cliVersion);
7135
7254
  }
7136
- if (command32.agents !== void 0) {
7255
+ if (command35.agents !== void 0) {
7137
7256
  queryParams.append("agentsConfigOverride", "true");
7138
- command32.agents.forEach((agent) => {
7257
+ command35.agents.forEach((agent) => {
7139
7258
  queryParams.append("agent", agent);
7140
7259
  });
7141
7260
  }
@@ -7144,10 +7263,10 @@ var SkillsGateway = class {
7144
7263
  `/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
7145
7264
  );
7146
7265
  };
7147
- this.list = async (command32) => {
7266
+ this.list = async (command35) => {
7148
7267
  const { organizationId } = this.httpClient.getAuthContext();
7149
7268
  return this.httpClient.request(
7150
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills`
7269
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/skills`
7151
7270
  );
7152
7271
  };
7153
7272
  }
@@ -7157,17 +7276,17 @@ var SkillsGateway = class {
7157
7276
  var CommandsGateway = class {
7158
7277
  constructor(httpClient) {
7159
7278
  this.httpClient = httpClient;
7160
- this.create = async (command32) => {
7279
+ this.create = async (command35) => {
7161
7280
  const { organizationId } = this.httpClient.getAuthContext();
7162
7281
  return this.httpClient.request(
7163
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/commands`,
7164
- { method: "POST", body: command32 }
7282
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/commands`,
7283
+ { method: "POST", body: command35 }
7165
7284
  );
7166
7285
  };
7167
- this.list = async (command32) => {
7286
+ this.list = async (command35) => {
7168
7287
  const { organizationId } = this.httpClient.getAuthContext();
7169
7288
  const listCommandsResponse = await this.httpClient.request(
7170
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/commands`
7289
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/commands`
7171
7290
  );
7172
7291
  if (listCommandsResponse instanceof Array) {
7173
7292
  return { recipes: listCommandsResponse };
@@ -7210,10 +7329,10 @@ var StandardsGateway = class {
7210
7329
  }
7211
7330
  );
7212
7331
  };
7213
- this.list = async (command32) => {
7332
+ this.list = async (command35) => {
7214
7333
  const { organizationId } = this.httpClient.getAuthContext();
7215
7334
  return this.httpClient.request(
7216
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/standards`
7335
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/standards`
7217
7336
  );
7218
7337
  };
7219
7338
  }
@@ -7224,10 +7343,10 @@ var PackagesGateway = class {
7224
7343
  constructor(apiKey, httpClient) {
7225
7344
  this.apiKey = apiKey;
7226
7345
  this.httpClient = httpClient;
7227
- this.list = async (command32) => {
7346
+ this.list = async (command35) => {
7228
7347
  const { organizationId } = this.httpClient.getAuthContext();
7229
7348
  return this.httpClient.request(
7230
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`
7349
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/packages`
7231
7350
  );
7232
7351
  };
7233
7352
  this.getSummary = async ({
@@ -7239,20 +7358,20 @@ var PackagesGateway = class {
7239
7358
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug6)}`
7240
7359
  );
7241
7360
  };
7242
- this.create = async (command32) => {
7361
+ this.create = async (command35) => {
7243
7362
  const { organizationId } = this.httpClient.getAuthContext();
7244
- const { recipeIds, ...rest } = command32;
7363
+ const { recipeIds, ...rest } = command35;
7245
7364
  return this.httpClient.request(
7246
- `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`,
7365
+ `/api/v0/organizations/${organizationId}/spaces/${command35.spaceId}/packages`,
7247
7366
  {
7248
7367
  method: "POST",
7249
7368
  body: { ...rest, commandIds: recipeIds }
7250
7369
  }
7251
7370
  );
7252
7371
  };
7253
- this.addArtefacts = async (command32) => {
7372
+ this.addArtefacts = async (command35) => {
7254
7373
  const { organizationId } = this.httpClient.getAuthContext();
7255
- const { packageId, spaceId, recipeIds, ...rest } = command32;
7374
+ const { packageId, spaceId, recipeIds, ...rest } = command35;
7256
7375
  return this.httpClient.request(
7257
7376
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
7258
7377
  {
@@ -7268,31 +7387,31 @@ var PackagesGateway = class {
7268
7387
  var DeploymentGateway = class {
7269
7388
  constructor(httpClient) {
7270
7389
  this.httpClient = httpClient;
7271
- this.pull = async (command32) => {
7390
+ this.pull = async (command35) => {
7272
7391
  const { organizationId } = this.httpClient.getAuthContext();
7273
7392
  const queryParams = new URLSearchParams();
7274
- if (command32.packagesSlugs && command32.packagesSlugs.length > 0) {
7275
- command32.packagesSlugs.forEach((slug6) => {
7393
+ if (command35.packagesSlugs && command35.packagesSlugs.length > 0) {
7394
+ command35.packagesSlugs.forEach((slug6) => {
7276
7395
  queryParams.append("packageSlug", slug6);
7277
7396
  });
7278
7397
  }
7279
- if (command32.previousPackagesSlugs && command32.previousPackagesSlugs.length > 0) {
7280
- command32.previousPackagesSlugs.forEach((slug6) => {
7398
+ if (command35.previousPackagesSlugs && command35.previousPackagesSlugs.length > 0) {
7399
+ command35.previousPackagesSlugs.forEach((slug6) => {
7281
7400
  queryParams.append("previousPackageSlug", slug6);
7282
7401
  });
7283
7402
  }
7284
- if (command32.gitRemoteUrl) {
7285
- queryParams.append("gitRemoteUrl", command32.gitRemoteUrl);
7403
+ if (command35.gitRemoteUrl) {
7404
+ queryParams.append("gitRemoteUrl", command35.gitRemoteUrl);
7286
7405
  }
7287
- if (command32.gitBranch) {
7288
- queryParams.append("gitBranch", command32.gitBranch);
7406
+ if (command35.gitBranch) {
7407
+ queryParams.append("gitBranch", command35.gitBranch);
7289
7408
  }
7290
- if (command32.relativePath) {
7291
- queryParams.append("relativePath", command32.relativePath);
7409
+ if (command35.relativePath) {
7410
+ queryParams.append("relativePath", command35.relativePath);
7292
7411
  }
7293
- if (command32.agents !== void 0) {
7412
+ if (command35.agents !== void 0) {
7294
7413
  queryParams.append("agentsConfigOverride", "true");
7295
- command32.agents.forEach((agent) => {
7414
+ command35.agents.forEach((agent) => {
7296
7415
  queryParams.append("agent", agent);
7297
7416
  });
7298
7417
  }
@@ -7300,101 +7419,102 @@ var DeploymentGateway = class {
7300
7419
  `/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
7301
7420
  );
7302
7421
  };
7303
- this.install = async (command32) => {
7422
+ this.install = async (command35) => {
7304
7423
  const { organizationId } = this.httpClient.getAuthContext();
7305
7424
  return this.httpClient.request(
7306
7425
  `/api/v0/organizations/${organizationId}/install`,
7307
7426
  {
7308
7427
  method: "POST",
7309
7428
  body: {
7310
- packagesSlugs: command32.packagesSlugs,
7311
- packmindLockFile: command32.packmindLockFile,
7312
- ...command32.relativePath && { relativePath: command32.relativePath },
7313
- ...command32.agents !== void 0 && { agents: command32.agents }
7429
+ packagesSlugs: command35.packagesSlugs,
7430
+ packmindLockFile: command35.packmindLockFile,
7431
+ ...command35.relativePath && { relativePath: command35.relativePath },
7432
+ ...command35.agents !== void 0 && { agents: command35.agents }
7314
7433
  }
7315
7434
  }
7316
7435
  );
7317
7436
  };
7318
- this.getDeployed = async (command32) => {
7437
+ this.getDeployed = async (command35) => {
7319
7438
  const { organizationId } = this.httpClient.getAuthContext();
7320
7439
  return this.httpClient.request(
7321
7440
  `/api/v0/organizations/${organizationId}/deployed-content`,
7322
7441
  {
7323
7442
  method: "POST",
7324
7443
  body: {
7325
- packagesSlugs: command32.packagesSlugs,
7326
- gitRemoteUrl: command32.gitRemoteUrl,
7327
- gitBranch: command32.gitBranch,
7328
- relativePath: command32.relativePath,
7329
- ...command32.agents !== void 0 && { agents: command32.agents }
7444
+ packagesSlugs: command35.packagesSlugs,
7445
+ gitRemoteUrl: command35.gitRemoteUrl,
7446
+ gitBranch: command35.gitBranch,
7447
+ relativePath: command35.relativePath,
7448
+ ...command35.agents !== void 0 && { agents: command35.agents }
7330
7449
  }
7331
7450
  }
7332
7451
  );
7333
7452
  };
7334
- this.getContentByVersions = async (command32) => {
7453
+ this.getContentByVersions = async (command35) => {
7335
7454
  const { organizationId } = this.httpClient.getAuthContext();
7336
7455
  return this.httpClient.request(
7337
7456
  `/api/v0/organizations/${organizationId}/content-by-versions`,
7338
7457
  {
7339
7458
  method: "POST",
7340
7459
  body: {
7341
- artifacts: command32.artifacts,
7342
- ...command32.agents !== void 0 && { agents: command32.agents }
7460
+ artifacts: command35.artifacts,
7461
+ ...command35.agents !== void 0 && { agents: command35.agents }
7343
7462
  }
7344
7463
  }
7345
7464
  );
7346
7465
  };
7347
- this.notifyDistribution = async (command32) => {
7466
+ this.notifyDistribution = async (command35) => {
7348
7467
  const { organizationId } = this.httpClient.getAuthContext();
7349
7468
  return this.httpClient.request(
7350
7469
  `/api/v0/organizations/${organizationId}/deployments`,
7351
7470
  {
7352
7471
  method: "POST",
7353
- body: command32
7472
+ body: command35
7354
7473
  }
7355
7474
  );
7356
7475
  };
7357
- this.notifyArtefactsDistribution = async (command32) => {
7476
+ this.notifyArtefactsDistribution = async (command35) => {
7358
7477
  const { organizationId } = this.httpClient.getAuthContext();
7359
7478
  return this.httpClient.request(
7360
7479
  `/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
7361
7480
  {
7362
7481
  method: "POST",
7363
7482
  body: {
7364
- gitRemoteUrl: command32.gitRemoteUrl,
7365
- gitBranch: command32.gitBranch,
7366
- relativePath: command32.relativePath,
7367
- packmindLockFile: command32.packmindLockFile
7483
+ gitRemoteUrl: command35.gitRemoteUrl,
7484
+ gitBranch: command35.gitBranch,
7485
+ relativePath: command35.relativePath,
7486
+ packmindLockFile: command35.packmindLockFile
7368
7487
  }
7369
7488
  }
7370
7489
  );
7371
7490
  };
7372
- this.renderPlugin = async (command32) => {
7491
+ this.renderPlugin = async (command35) => {
7373
7492
  const { organizationId } = this.httpClient.getAuthContext();
7374
7493
  return this.httpClient.request(
7375
7494
  `/api/v0/organizations/${organizationId}/plugins/render`,
7376
7495
  {
7377
7496
  method: "POST",
7378
7497
  body: {
7379
- packageSlug: command32.packageSlug,
7380
- mode: command32.mode,
7381
- pluginRoot: command32.pluginRoot,
7382
- pluginName: command32.pluginName,
7383
- gitRemoteUrl: command32.gitRemoteUrl,
7384
- gitBranch: command32.gitBranch
7498
+ packageSlug: command35.packageSlug,
7499
+ mode: command35.mode,
7500
+ pluginRoot: command35.pluginRoot,
7501
+ pluginName: command35.pluginName,
7502
+ gitRemoteUrl: command35.gitRemoteUrl,
7503
+ gitBranch: command35.gitBranch,
7504
+ targetVendor: command35.targetVendor
7385
7505
  }
7386
7506
  }
7387
7507
  );
7388
7508
  };
7389
- this.trackPluginDeleted = async (command32) => {
7509
+ this.trackPluginDeleted = async (command35) => {
7390
7510
  const { organizationId } = this.httpClient.getAuthContext();
7391
7511
  return this.httpClient.request(
7392
7512
  `/api/v0/organizations/${organizationId}/plugins/track-deleted`,
7393
7513
  {
7394
7514
  method: "POST",
7395
7515
  body: {
7396
- packageSlug: command32.packageSlug,
7397
- gitRemoteUrl: command32.gitRemoteUrl
7516
+ packageSlug: command35.packageSlug,
7517
+ gitRemoteUrl: command35.gitRemoteUrl
7398
7518
  }
7399
7519
  }
7400
7520
  );
@@ -7406,13 +7526,13 @@ var DeploymentGateway = class {
7406
7526
  );
7407
7527
  };
7408
7528
  }
7409
- async updateRenderModeConfiguration(command32) {
7529
+ async updateRenderModeConfiguration(command35) {
7410
7530
  const { organizationId } = this.httpClient.getAuthContext();
7411
7531
  await this.httpClient.request(
7412
7532
  `/api/v0/organizations/${organizationId}/deployments/renderModeConfiguration`,
7413
7533
  {
7414
7534
  method: "POST",
7415
- body: { activeRenderModes: command32.activeRenderModes }
7535
+ body: { activeRenderModes: command35.activeRenderModes }
7416
7536
  }
7417
7537
  );
7418
7538
  }
@@ -7469,18 +7589,18 @@ var RepositoryTrackingGateway = class {
7469
7589
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository?${query}`
7470
7590
  );
7471
7591
  };
7472
- this.setTrackedRepository = async (command32) => {
7592
+ this.setTrackedRepository = async (command35) => {
7473
7593
  const { organizationId } = this.httpClient.getAuthContext();
7474
7594
  return this.httpClient.request(
7475
7595
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7476
- { method: "POST", body: command32 }
7596
+ { method: "POST", body: command35 }
7477
7597
  );
7478
7598
  };
7479
- this.updateTrackedBranch = async (command32) => {
7599
+ this.updateTrackedBranch = async (command35) => {
7480
7600
  const { organizationId } = this.httpClient.getAuthContext();
7481
7601
  return this.httpClient.request(
7482
7602
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7483
- { method: "PUT", body: command32 }
7603
+ { method: "PUT", body: command35 }
7484
7604
  );
7485
7605
  };
7486
7606
  this.removeTrackedRepository = async ({ owner, repo }) => {
@@ -9252,8 +9372,8 @@ var ExecuteLinterProgramsUseCase = class {
9252
9372
  this.linterAstAdapter = linterAstAdapter;
9253
9373
  this.logger = logger2;
9254
9374
  }
9255
- async execute(command32) {
9256
- const { filePath, fileContent, language, programs } = command32;
9375
+ async execute(command35) {
9376
+ const { filePath, fileContent, language, programs } = command35;
9257
9377
  if (programs.length === 0) {
9258
9378
  return {
9259
9379
  file: filePath,
@@ -9852,12 +9972,16 @@ var Cache = class _Cache {
9852
9972
  // packages/feature-flags/src/registry.ts
9853
9973
  var ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY = "change-proposals-in-webapp";
9854
9974
  var ORGA_SPACE_MANAGEMENT_FEATURE_KEY = "orga-space-management";
9975
+ var SPACE_NAV_PLUGIN_FIRST_FEATURE_KEY = "space-nav-plugin-first";
9976
+ var COPILOT_MARKETPLACE_FEATURE_KEY = "copilot-marketplace";
9855
9977
  var DEFAULT_FEATURE_DOMAIN_MAP = {
9856
9978
  [ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY]: [
9857
9979
  "@packmind.com",
9858
9980
  "@promyze.com"
9859
9981
  ],
9860
- [ORGA_SPACE_MANAGEMENT_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9982
+ [ORGA_SPACE_MANAGEMENT_FEATURE_KEY]: ["@packmind.com", "@promyze.com"],
9983
+ [SPACE_NAV_PLUGIN_FIRST_FEATURE_KEY]: ["@packmind.com", "@promyze.com"],
9984
+ [COPILOT_MARKETPLACE_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9861
9985
  };
9862
9986
 
9863
9987
  // packages/node-utils/src/database/schemas.ts
@@ -9902,6 +10026,15 @@ var import_bullmq = require("bullmq");
9902
10026
  // packages/node-utils/src/jobs/infra/DelayedJobsFactory.ts
9903
10027
  var logger = new PackmindLogger("DelayedJobsFactory");
9904
10028
 
10029
+ // packages/node-utils/src/observability/withSpan.ts
10030
+ var import_api = require("@opentelemetry/api");
10031
+ var tracer = import_api.trace.getTracer("packmind");
10032
+
10033
+ // packages/node-utils/src/observability/instrumentMethods.ts
10034
+ var AsyncFunction = (async () => {
10035
+ }).constructor;
10036
+ var enabled = process.env["PACKMIND_OTEL_INSTRUMENT_METHODS"] !== "false";
10037
+
9905
10038
  // packages/node-utils/src/mail/SmtpMailService.ts
9906
10039
  var import_nodemailer = __toESM(require("nodemailer"));
9907
10040
 
@@ -10088,8 +10221,8 @@ var InstallPackagesUseCase = class {
10088
10221
  constructor(packmindGateway) {
10089
10222
  this.packmindGateway = packmindGateway;
10090
10223
  }
10091
- async execute(command32) {
10092
- const baseDirectory = command32.baseDirectory || process.cwd();
10224
+ async execute(command35) {
10225
+ const baseDirectory = command35.baseDirectory || process.cwd();
10093
10226
  const result = {
10094
10227
  filesCreated: 0,
10095
10228
  filesUpdated: 0,
@@ -10101,12 +10234,12 @@ var InstallPackagesUseCase = class {
10101
10234
  skillDirectoriesDeleted: 0
10102
10235
  };
10103
10236
  const response = await this.packmindGateway.deployment.pull({
10104
- packagesSlugs: command32.packagesSlugs,
10105
- previousPackagesSlugs: command32.previousPackagesSlugs,
10106
- gitRemoteUrl: command32.gitRemoteUrl,
10107
- gitBranch: command32.gitBranch,
10108
- relativePath: command32.relativePath,
10109
- agents: command32.agents
10237
+ packagesSlugs: command35.packagesSlugs,
10238
+ previousPackagesSlugs: command35.previousPackagesSlugs,
10239
+ gitRemoteUrl: command35.gitRemoteUrl,
10240
+ gitBranch: command35.gitBranch,
10241
+ relativePath: command35.relativePath,
10242
+ agents: command35.agents
10110
10243
  });
10111
10244
  const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
10112
10245
  (file) => file.path !== "packmind.json"
@@ -10481,8 +10614,8 @@ var InstallUseCase = class {
10481
10614
  this.configFileRepository = configFileRepository;
10482
10615
  this.spaceService = spaceService;
10483
10616
  }
10484
- async execute(command32) {
10485
- const baseDirectory = command32.baseDirectory || process.cwd();
10617
+ async execute(command35) {
10618
+ const baseDirectory = command35.baseDirectory || process.cwd();
10486
10619
  const result = {
10487
10620
  filesCreated: 0,
10488
10621
  filesUpdated: 0,
@@ -10512,7 +10645,7 @@ var InstallUseCase = class {
10512
10645
  },
10513
10646
  resolvedAgents: []
10514
10647
  };
10515
- const hasExplicitPackages = command32.packages && command32.packages.length > 0;
10648
+ const hasExplicitPackages = command35.packages && command35.packages.length > 0;
10516
10649
  const configExistedBefore = await this.configFileRepository.configExists(baseDirectory);
10517
10650
  const lockFile = await this.lockFileRepository.read(baseDirectory);
10518
10651
  const config = await this.configFileRepository.readConfig(baseDirectory);
@@ -10525,7 +10658,7 @@ var InstallUseCase = class {
10525
10658
  );
10526
10659
  }
10527
10660
  throw new Error(
10528
- "No packmind.json found in this directory. Run `packmind-cli install <@space/package>` first to install your packages."
10661
+ `No packmind.json found in this directory. Run \`${EXEC_NAME} install <@space/package>\` first to install your packages.`
10529
10662
  );
10530
10663
  }
10531
10664
  const effectiveLockFile = lockFile ?? {
@@ -10534,11 +10667,11 @@ var InstallUseCase = class {
10534
10667
  agents: [],
10535
10668
  artifacts: {}
10536
10669
  };
10537
- effectiveLockFile.cliVersion = command32.cliVersion;
10670
+ effectiveLockFile.cliVersion = command35.cliVersion;
10538
10671
  let packagesSlugs;
10539
10672
  let normalizedPackages = [];
10540
10673
  if (hasExplicitPackages) {
10541
- const explicitPackageSlugs = (command32.packages ?? []).map(
10674
+ const explicitPackageSlugs = (command35.packages ?? []).map(
10542
10675
  displayableParsedPackageSlug
10543
10676
  );
10544
10677
  normalizedPackages = await this.normalizePackageSlugs(explicitPackageSlugs);
@@ -10568,8 +10701,8 @@ var InstallUseCase = class {
10568
10701
  }
10569
10702
  return result;
10570
10703
  }
10571
- const installAgents = this.resolveInstallAgents(command32, config);
10572
- const stripPathPrefix = command32.homeAgent ? getAgentHomeDirPrefix(command32.homeAgent) ?? void 0 : void 0;
10704
+ const installAgents = this.resolveInstallAgents(command35, config);
10705
+ const stripPathPrefix = command35.homeAgent ? getAgentHomeDirPrefix(command35.homeAgent) ?? void 0 : void 0;
10573
10706
  const response = await this.packmindGateway.deployment.install({
10574
10707
  packagesSlugs,
10575
10708
  packmindLockFile: effectiveLockFile,
@@ -10709,7 +10842,7 @@ var InstallUseCase = class {
10709
10842
  } catch {
10710
10843
  }
10711
10844
  }
10712
- lockFileToPersist.cliVersion = command32.cliVersion;
10845
+ lockFileToPersist.cliVersion = command35.cliVersion;
10713
10846
  if (stripPathPrefix) {
10714
10847
  lockFileToPersist = this.stripLockFileArtifactPaths(
10715
10848
  lockFileToPersist,
@@ -10738,9 +10871,9 @@ var InstallUseCase = class {
10738
10871
  async normalizePackageSlugs(slugs) {
10739
10872
  return normalizePackageSlugs(slugs, this.spaceService);
10740
10873
  }
10741
- resolveInstallAgents(command32, config) {
10742
- if (command32.homeAgent) {
10743
- return [command32.homeAgent];
10874
+ resolveInstallAgents(command35, config) {
10875
+ if (command35.homeAgent) {
10876
+ return [command35.homeAgent];
10744
10877
  }
10745
10878
  return config?.agents;
10746
10879
  }
@@ -11054,8 +11187,8 @@ var UninstallUseCase = class {
11054
11187
  this.spaceService = spaceService;
11055
11188
  this.installUseCase = installUseCase;
11056
11189
  }
11057
- async execute(command32) {
11058
- const baseDirectory = command32.baseDirectory || process.cwd();
11190
+ async execute(command35) {
11191
+ const baseDirectory = command35.baseDirectory || process.cwd();
11059
11192
  const config = await this.configFileRepository.readConfig(baseDirectory);
11060
11193
  if (!config) {
11061
11194
  const configFileExists = await this.configFileRepository.configExists(baseDirectory);
@@ -11065,11 +11198,11 @@ var UninstallUseCase = class {
11065
11198
  );
11066
11199
  }
11067
11200
  throw new Error(
11068
- "No packmind.json found in this directory. Run `packmind-cli install <@space/package>` first to install your packages."
11201
+ `No packmind.json found in this directory. Run \`${EXEC_NAME} install <@space/package>\` first to install your packages.`
11069
11202
  );
11070
11203
  }
11071
11204
  const normalized = await normalizePackageSlugs(
11072
- command32.packages,
11205
+ command35.packages,
11073
11206
  this.spaceService
11074
11207
  );
11075
11208
  const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
@@ -11092,7 +11225,7 @@ ${pkgList}`
11092
11225
  try {
11093
11226
  return await this.installUseCase.execute({
11094
11227
  baseDirectory,
11095
- cliVersion: command32.cliVersion
11228
+ cliVersion: command35.cliVersion
11096
11229
  });
11097
11230
  } catch (error) {
11098
11231
  await this.configFileRepository.updateConfig(
@@ -11119,7 +11252,7 @@ function stripPrerelease(version2) {
11119
11252
  var SkillsInitBootstrapError = class extends Error {
11120
11253
  constructor() {
11121
11254
  super(
11122
- "Couldn't determine your organization's coding agents. Run `packmind init` to configure them interactively."
11255
+ `Couldn't determine your organization's coding agents. Run \`${EXEC_NAME} init\` to configure them interactively.`
11123
11256
  );
11124
11257
  this.isSkillsInitBootstrapError = true;
11125
11258
  this.name = "SkillsInitBootstrapError";
@@ -11134,8 +11267,8 @@ var InstallDefaultSkillsUseCase = class {
11134
11267
  constructor(repositories) {
11135
11268
  this.repositories = repositories;
11136
11269
  }
11137
- async execute(command32) {
11138
- const baseDirectory = command32.baseDirectory || process.cwd();
11270
+ async execute(command35) {
11271
+ const baseDirectory = command35.baseDirectory || process.cwd();
11139
11272
  await this.bootstrapEmptyDirectory(baseDirectory);
11140
11273
  const result = {
11141
11274
  filesCreated: 0,
@@ -11145,24 +11278,24 @@ var InstallDefaultSkillsUseCase = class {
11145
11278
  skippedIncompatibleSkillNames: [],
11146
11279
  incompatibleInstalledSkills: []
11147
11280
  };
11148
- let agents = command32.agents;
11281
+ let agents = command35.agents;
11149
11282
  if (!agents || agents.length === 0) {
11150
11283
  const config = await this.repositories.configFileRepository.readConfig(baseDirectory);
11151
11284
  agents = config?.agents;
11152
11285
  }
11153
11286
  const response = await this.repositories.packmindGateway.skills.getDefaults(
11154
11287
  {
11155
- cliVersion: command32.cliVersion,
11156
- includeBeta: command32.includeBeta,
11288
+ cliVersion: command35.cliVersion,
11289
+ includeBeta: command35.includeBeta,
11157
11290
  agents
11158
11291
  }
11159
11292
  );
11160
11293
  result.skippedSkillsCount = response.skippedSkillsCount;
11161
11294
  const incompatibleInstalledMap = /* @__PURE__ */ new Map();
11162
11295
  const incompatibleSkillDirs = /* @__PURE__ */ new Map();
11163
- if (command32.cliVersion) {
11296
+ if (command35.cliVersion) {
11164
11297
  for (const file of response.fileUpdates.createOrUpdate) {
11165
- if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command32.cliVersion)) {
11298
+ if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command35.cliVersion)) {
11166
11299
  const dir = path9.dirname(file.path);
11167
11300
  const skillName = this.getSkillName(file.content) ?? path9.basename(dir);
11168
11301
  incompatibleSkillDirs.set(dir, skillName);
@@ -11173,9 +11306,9 @@ var InstallDefaultSkillsUseCase = class {
11173
11306
  for (const file of response.fileUpdates.createOrUpdate) {
11174
11307
  try {
11175
11308
  if (!file.content) continue;
11176
- const isIncompatible = command32.cliVersion && (this.isVersionConstraintViolated(
11309
+ const isIncompatible = command35.cliVersion && (this.isVersionConstraintViolated(
11177
11310
  file.content,
11178
- command32.cliVersion
11311
+ command35.cliVersion
11179
11312
  ) || this.isUnderIncompatibleSkillDir(
11180
11313
  file.path,
11181
11314
  incompatibleSkillDirs
@@ -11218,7 +11351,7 @@ var InstallDefaultSkillsUseCase = class {
11218
11351
  await this.mergeLockFileSlice(
11219
11352
  baseDirectory,
11220
11353
  response.lockFileSlice ?? {},
11221
- command32.cliVersion
11354
+ command35.cliVersion
11222
11355
  );
11223
11356
  return result;
11224
11357
  }
@@ -11372,8 +11505,8 @@ var EnsureCliVersionUseCase = class {
11372
11505
  this.lockFileRepository = lockFileRepository;
11373
11506
  this.installDefaultSkillsUseCase = installDefaultSkillsUseCase;
11374
11507
  }
11375
- async execute(command32) {
11376
- const { baseDirectory, currentCliVersion, includeBeta } = command32;
11508
+ async execute(command35) {
11509
+ const { baseDirectory, currentCliVersion, includeBeta } = command35;
11377
11510
  const lockFile = await this.lockFileRepository.read(baseDirectory);
11378
11511
  if (!lockFile) {
11379
11512
  return { kind: "no-lockfile" };
@@ -11409,10 +11542,10 @@ var ListPackagesUseCase = class {
11409
11542
  this.packmindGateway = packmindGateway;
11410
11543
  this.spaceService = spaceService;
11411
11544
  }
11412
- async execute(command32) {
11413
- if (command32.spaceId) {
11545
+ async execute(command35) {
11546
+ if (command35.spaceId) {
11414
11547
  const response = await this.packmindGateway.packages.list({
11415
- spaceId: command32.spaceId
11548
+ spaceId: command35.spaceId
11416
11549
  });
11417
11550
  return response.packages;
11418
11551
  }
@@ -11431,8 +11564,8 @@ var GetPackageSummaryUseCase = class {
11431
11564
  constructor(gateway) {
11432
11565
  this.gateway = gateway;
11433
11566
  }
11434
- async execute(command32) {
11435
- return this.gateway.packages.getSummary(command32);
11567
+ async execute(command35) {
11568
+ return this.gateway.packages.getSummary(command35);
11436
11569
  }
11437
11570
  };
11438
11571
 
@@ -11724,8 +11857,8 @@ var LoginUseCase = class {
11724
11857
  startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
11725
11858
  };
11726
11859
  }
11727
- async execute(command32) {
11728
- const { host, code: providedCode } = command32;
11860
+ async execute(command35) {
11861
+ const { host, code: providedCode } = command35;
11729
11862
  let code;
11730
11863
  if (providedCode) {
11731
11864
  code = providedCode;
@@ -11827,6 +11960,7 @@ var import_stream = require("stream");
11827
11960
  var import_semver3 = __toESM(require("semver"));
11828
11961
  var GITHUB_REPO = "PackmindHub/packmind";
11829
11962
  var NPM_PACKAGE = "@packmind/cli";
11963
+ var RELEASE_ASSET_BASENAME = "packmind-cli";
11830
11964
  function getPlatformAssetSuffix(platform, arch) {
11831
11965
  const osMap = {
11832
11966
  linux: "linux",
@@ -11838,8 +11972,12 @@ function getPlatformAssetSuffix(platform, arch) {
11838
11972
  throw new Error(`Unsupported platform: ${platform}`);
11839
11973
  }
11840
11974
  const archName = platform === "darwin" && arch === "x64" ? "x64-baseline" : arch;
11975
+ return `${osName}-${archName}`;
11976
+ }
11977
+ function getReleaseAssetName(platform, arch, version2) {
11978
+ const platformSuffix = getPlatformAssetSuffix(platform, arch);
11841
11979
  const ext = platform === "win32" ? ".exe" : "";
11842
- return `${osName}-${archName}${ext}`;
11980
+ return `${RELEASE_ASSET_BASENAME}-${platformSuffix}-${version2}${ext}`;
11843
11981
  }
11844
11982
  async function fetchLatestVersionFromNpm(fetchFn) {
11845
11983
  const res = await fetchFn(`https://registry.npmjs.org/${NPM_PACKAGE}/latest`);
@@ -11873,8 +12011,7 @@ async function fetchLatestVersionFromGitHub(fetchFn) {
11873
12011
  }
11874
12012
  return cliReleases[0].version;
11875
12013
  }
11876
- async function downloadExecutable(fetchFn, version2, platformSuffix, targetPath) {
11877
- const assetName = `packmind-cli-${platformSuffix}-${version2}`;
12014
+ async function downloadExecutable(fetchFn, version2, assetName, targetPath) {
11878
12015
  const url = `https://github.com/${GITHUB_REPO}/releases/download/release-cli/${version2}/${assetName}`;
11879
12016
  logInfoConsole(`Downloading ${assetName}...`);
11880
12017
  const res = await fetchFn(url, { redirect: "follow" });
@@ -11901,27 +12038,62 @@ URL: ${url}`
11901
12038
  `Downloaded successfully (${(stats.size / 1048576).toFixed(1)} MB)`
11902
12039
  );
11903
12040
  }
11904
- function createForwardCompatSymlink(currentPath, platform) {
11905
- const dir = import_path2.default.dirname(currentPath);
11906
- const ext = platform === "win32" ? ".exe" : "";
11907
- const primaryName = `packmind-cli${ext}`;
11908
- const aliasName = `packmind${ext}`;
11909
- const currentBasename = import_path2.default.basename(currentPath);
11910
- if (currentBasename !== primaryName) {
11911
- return;
12041
+ function basenameOf(candidate) {
12042
+ return candidate.split(/[/\\]/).pop() ?? "";
12043
+ }
12044
+ function isManagedExecFileName(executablePath) {
12045
+ const basename4 = basenameOf(executablePath).replace(/\.exe$/i, "");
12046
+ return basename4 === CANONICAL_EXEC_NAME || basename4 === LEGACY_EXEC_NAME;
12047
+ }
12048
+ function resolveUpdateTargetPath(executablePath, platform) {
12049
+ if (!isManagedExecFileName(executablePath)) {
12050
+ return executablePath;
11912
12051
  }
11913
- const targetName = primaryName;
11914
- const symlinkName = aliasName;
11915
- const symlinkPath = import_path2.default.join(dir, symlinkName);
12052
+ const ext = platform === "win32" ? ".exe" : "";
12053
+ return import_path2.default.join(
12054
+ import_path2.default.dirname(executablePath),
12055
+ `${CANONICAL_EXEC_NAME}${ext}`
12056
+ );
12057
+ }
12058
+ function unlinkIfSymlink(targetPath) {
11916
12059
  try {
11917
- (0, import_fs19.unlinkSync)(symlinkPath);
12060
+ if ((0, import_fs19.lstatSync)(targetPath).isSymbolicLink()) {
12061
+ (0, import_fs19.unlinkSync)(targetPath);
12062
+ }
11918
12063
  } catch {
11919
12064
  }
11920
- try {
11921
- (0, import_fs19.symlinkSync)(targetName, symlinkPath);
12065
+ }
12066
+ function createLegacyExecAlias(canonicalPath, platform, runningExecutablePath) {
12067
+ const dir = import_path2.default.dirname(canonicalPath);
12068
+ const ext = platform === "win32" ? ".exe" : "";
12069
+ const canonicalName = `${CANONICAL_EXEC_NAME}${ext}`;
12070
+ const legacyName = `${LEGACY_EXEC_NAME}${ext}`;
12071
+ const legacyPath = import_path2.default.join(dir, legacyName);
12072
+ if (platform === "win32" && runningExecutablePath && basenameOf(runningExecutablePath).toLowerCase() === legacyName.toLowerCase()) {
11922
12073
  logInfoConsole(
11923
- `Created forward-compatible symlink: ${symlinkPath} -> ${targetName}`
12074
+ `Kept ${legacyPath} as-is: Windows cannot replace a running executable.
12075
+ Re-run the installer, or delete ${legacyName} manually, to finish switching to ${canonicalName}.`
11924
12076
  );
12077
+ return false;
12078
+ }
12079
+ const stagedPath = `${legacyPath}.new-alias`;
12080
+ try {
12081
+ removeIfPresent(stagedPath);
12082
+ (0, import_fs19.symlinkSync)(canonicalName, stagedPath);
12083
+ (0, import_fs19.renameSync)(stagedPath, legacyPath);
12084
+ logInfoConsole(`Created legacy alias: ${legacyPath} -> ${canonicalName}`);
12085
+ return true;
12086
+ } catch {
12087
+ removeIfPresent(stagedPath);
12088
+ logWarningConsole(
12089
+ `Could not create legacy alias: ${legacyPath} -> ${canonicalName} (non-critical)`
12090
+ );
12091
+ return false;
12092
+ }
12093
+ }
12094
+ function removeIfPresent(targetPath) {
12095
+ try {
12096
+ (0, import_fs19.unlinkSync)(targetPath);
11925
12097
  } catch {
11926
12098
  }
11927
12099
  }
@@ -11931,17 +12103,48 @@ function updateViaNpm(version2) {
11931
12103
  stdio: "inherit"
11932
12104
  });
11933
12105
  }
12106
+ function checkTargetBeforeReplacing(targetPath, executablePath) {
12107
+ if (targetPath === executablePath) {
12108
+ return;
12109
+ }
12110
+ let entry;
12111
+ try {
12112
+ entry = (0, import_fs19.lstatSync)(targetPath);
12113
+ } catch {
12114
+ return;
12115
+ }
12116
+ if (entry.isSymbolicLink()) {
12117
+ return;
12118
+ }
12119
+ if (!entry.isFile()) {
12120
+ throw new Error(
12121
+ `Cannot install at ${targetPath}: it already exists and is not a file.`
12122
+ );
12123
+ }
12124
+ logWarningConsole(`Replacing the existing file at ${targetPath}`);
12125
+ }
11934
12126
  async function updateViaExecutableReplace(deps, version2) {
11935
- const platformSuffix = getPlatformAssetSuffix(deps.platform, deps.arch);
11936
- const currentPath = deps.executablePath;
11937
- const tempPath = currentPath + ".update-tmp";
12127
+ const assetName = getReleaseAssetName(deps.platform, deps.arch, version2);
12128
+ const targetPath = resolveUpdateTargetPath(
12129
+ deps.executablePath,
12130
+ deps.platform
12131
+ );
12132
+ const tempPath = targetPath + ".update-tmp";
11938
12133
  try {
11939
- await downloadExecutable(deps.fetchFn, version2, platformSuffix, tempPath);
11940
- (0, import_fs19.renameSync)(tempPath, currentPath);
12134
+ checkTargetBeforeReplacing(targetPath, deps.executablePath);
12135
+ await downloadExecutable(deps.fetchFn, version2, assetName, tempPath);
12136
+ unlinkIfSymlink(targetPath);
12137
+ (0, import_fs19.renameSync)(tempPath, targetPath);
11941
12138
  if (deps.platform !== "win32") {
11942
- (0, import_fs19.chmodSync)(currentPath, 493);
12139
+ (0, import_fs19.chmodSync)(targetPath, 493);
11943
12140
  }
11944
- createForwardCompatSymlink(currentPath, deps.platform);
12141
+ const aliasCreated = isManagedExecFileName(deps.executablePath) && createLegacyExecAlias(targetPath, deps.platform, deps.executablePath);
12142
+ const legacyName = `${LEGACY_EXEC_NAME}${deps.platform === "win32" ? ".exe" : ""}`;
12143
+ const invokedIsLegacyName = basenameOf(deps.executablePath).toLowerCase() === legacyName.toLowerCase();
12144
+ return {
12145
+ targetPath,
12146
+ invokedExecutableUpdated: targetPath === deps.executablePath || aliasCreated && invokedIsLegacyName
12147
+ };
11945
12148
  } catch (error) {
11946
12149
  try {
11947
12150
  (0, import_fs19.unlinkSync)(tempPath);
@@ -11962,6 +12165,21 @@ function isHomebrewInstall(executablePath) {
11962
12165
  return false;
11963
12166
  }
11964
12167
  }
12168
+ function resolveUpdateFailureMessage(message, platform) {
12169
+ if (platform === "win32") {
12170
+ const isReplaceBlocked = message.includes("EPERM") || message.includes("EBUSY") || message.includes("EACCES") || message.includes("permission denied");
12171
+ if (!isReplaceBlocked) {
12172
+ return `Update failed: ${message}`;
12173
+ }
12174
+ return `Update failed: ${message}
12175
+ Could not replace the executable. Close any other running ${CANONICAL_EXEC_NAME} process, then re-run '${EXEC_NAME} update' from an Administrator terminal.`;
12176
+ }
12177
+ if (message.includes("EACCES") || message.includes("permission denied")) {
12178
+ return `Permission denied. Try running with sudo:
12179
+ sudo ${EXEC_NAME} update`;
12180
+ }
12181
+ return `Update failed: ${message}`;
12182
+ }
11965
12183
  async function updateHandler(deps) {
11966
12184
  const execBasename = import_path2.default.basename(deps.executablePath).replace(/\.exe$/, "");
11967
12185
  const jsRuntimes = ["node", "bun", "deno"];
@@ -11988,6 +12206,11 @@ async function updateHandler(deps) {
11988
12206
  logInfoConsole(
11989
12207
  `Current version: ${deps.currentVersion} (${deps.isExecutableMode ? "standalone executable" : "npm package"})`
11990
12208
  );
12209
+ if (isLegacyExecName()) {
12210
+ logInfoConsole(
12211
+ `The '${CANONICAL_EXEC_NAME}' executable is the one being updated; '${LEGACY_EXEC_NAME}' points to it.`
12212
+ );
12213
+ }
11991
12214
  let latestVersion;
11992
12215
  try {
11993
12216
  latestVersion = deps.isExecutableMode ? await fetchLatestVersionFromGitHub(deps.fetchFn) : await fetchLatestVersionFromNpm(deps.fetchFn);
@@ -12011,26 +12234,29 @@ async function updateHandler(deps) {
12011
12234
  return;
12012
12235
  }
12013
12236
  try {
12014
- if (deps.isExecutableMode) {
12015
- await updateViaExecutableReplace(deps, latestVersion);
12016
- } else {
12237
+ if (!deps.isExecutableMode) {
12017
12238
  updateViaNpm(latestVersion);
12239
+ logConsole("");
12240
+ logSuccessConsole(`Updated to v${latestVersion}`);
12241
+ return;
12018
12242
  }
12243
+ const outcome = await updateViaExecutableReplace(deps, latestVersion);
12019
12244
  logConsole("");
12020
- logSuccessConsole(`Updated to v${latestVersion}`);
12021
- if (deps.isExecutableMode) {
12022
- logInfoConsole(`Binary location: ${deps.executablePath}`);
12245
+ if (outcome.invokedExecutableUpdated) {
12246
+ logSuccessConsole(`Updated to v${latestVersion}`);
12247
+ } else {
12248
+ const invokedName = basenameOf(deps.executablePath);
12249
+ const targetName = basenameOf(outcome.targetPath);
12250
+ logSuccessConsole(`Updated ${targetName} to v${latestVersion}`);
12251
+ logWarningConsole(
12252
+ `${invokedName} was NOT updated and still runs v${deps.currentVersion}.
12253
+ Run '${CANONICAL_EXEC_NAME}' from now on, or re-run the installer to replace ${invokedName}.`
12254
+ );
12023
12255
  }
12256
+ logInfoConsole(`Binary location: ${outcome.targetPath}`);
12024
12257
  } catch (error) {
12025
12258
  const message = error instanceof Error ? error.message : String(error);
12026
- if (message.includes("EACCES") || message.includes("permission denied")) {
12027
- logErrorConsole(
12028
- `Permission denied. Try running with sudo:
12029
- sudo packmind-cli update`
12030
- );
12031
- } else {
12032
- logErrorConsole(`Update failed: ${message}`);
12033
- }
12259
+ logErrorConsole(resolveUpdateFailureMessage(message, deps.platform));
12034
12260
  process.exit(1);
12035
12261
  }
12036
12262
  }
@@ -12107,10 +12333,10 @@ var CheckCliVersionUseCase = class {
12107
12333
  now: deps?.now ?? (() => /* @__PURE__ */ new Date())
12108
12334
  };
12109
12335
  }
12110
- async execute(command32) {
12111
- const cached = this.readFreshCache(command32.currentVersion);
12336
+ async execute(command35) {
12337
+ const cached = this.readFreshCache(command35.currentVersion);
12112
12338
  if (cached) {
12113
- return this.toResult(command32.currentVersion, cached.latestVersion);
12339
+ return this.toResult(command35.currentVersion, cached.latestVersion);
12114
12340
  }
12115
12341
  const fetchPromise = this.deps.fetchLatestVersion(this.deps.fetchFn);
12116
12342
  fetchPromise.catch(() => void 0);
@@ -12128,7 +12354,7 @@ var CheckCliVersionUseCase = class {
12128
12354
  latestVersion,
12129
12355
  checkedAt: this.deps.now()
12130
12356
  });
12131
- return this.toResult(command32.currentVersion, latestVersion);
12357
+ return this.toResult(command35.currentVersion, latestVersion);
12132
12358
  } catch {
12133
12359
  return null;
12134
12360
  }
@@ -12200,7 +12426,7 @@ var ConfigFileRepository = class {
12200
12426
  );
12201
12427
  if (invalidAgents.length > 0) {
12202
12428
  logWarningConsole(
12203
- `Invalid agent(s) in ${configPath}: ${invalidAgents.join(", ")}. Valid agents are: packmind, junie, claude, cursor, copilot, agents_md, gitlab_duo, continue`
12429
+ `Invalid agent(s) in ${configPath}: ${invalidAgents.join(", ")}. Valid agents are: ${VALID_CODING_AGENTS.join(", ")}`
12204
12430
  );
12205
12431
  }
12206
12432
  const config = {
@@ -12576,10 +12802,10 @@ var ListStandardsUseCase = class {
12576
12802
  this.packmindGateway = packmindGateway;
12577
12803
  this.spaceService = spaceService;
12578
12804
  }
12579
- async execute(command32) {
12580
- if (command32.spaceId) {
12805
+ async execute(command35) {
12806
+ if (command35.spaceId) {
12581
12807
  const response = await this.packmindGateway.standards.list({
12582
- spaceId: command32.spaceId
12808
+ spaceId: command35.spaceId
12583
12809
  });
12584
12810
  return response.standards;
12585
12811
  }
@@ -12599,10 +12825,10 @@ var ListCommandsUseCase = class {
12599
12825
  this.packmindGateway = packmindGateway;
12600
12826
  this.spaceService = spaceService;
12601
12827
  }
12602
- async execute(command32) {
12603
- if (command32.spaceId) {
12828
+ async execute(command35) {
12829
+ if (command35.spaceId) {
12604
12830
  const response = await this.packmindGateway.commands.list({
12605
- spaceId: command32.spaceId
12831
+ spaceId: command35.spaceId
12606
12832
  });
12607
12833
  return response.recipes;
12608
12834
  }
@@ -12622,10 +12848,10 @@ var ListSkillsUseCase = class {
12622
12848
  this.packmindGateway = packmindGateway;
12623
12849
  this.spaceService = spaceService;
12624
12850
  }
12625
- async execute(command32) {
12626
- if (command32.spaceId) {
12851
+ async execute(command35) {
12852
+ if (command35.spaceId) {
12627
12853
  const skills = await this.packmindGateway.skills.list({
12628
- spaceId: command32.spaceId
12854
+ spaceId: command35.spaceId
12629
12855
  });
12630
12856
  return skills.map((s) => ({
12631
12857
  id: s.id,
@@ -12797,8 +13023,8 @@ var UploadSkillUseCase = class {
12797
13023
  constructor(deps) {
12798
13024
  this.deps = deps;
12799
13025
  }
12800
- async execute(command32) {
12801
- const files = await readSkillDirectory(command32.skillPath);
13026
+ async execute(command35) {
13027
+ const files = await readSkillDirectory(command35.skillPath);
12802
13028
  if (!files.find((f) => f.relativePath === "SKILL.md")) {
12803
13029
  throw new Error("SKILL.md not found in skill directory");
12804
13030
  }
@@ -12812,7 +13038,7 @@ var UploadSkillUseCase = class {
12812
13038
  if (totalSize > 10 * 1024 * 1024) {
12813
13039
  throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
12814
13040
  }
12815
- const space = await this.getSpace(command32.spaceSlug);
13041
+ const space = await this.getSpace(command35.spaceSlug);
12816
13042
  const payload = {
12817
13043
  files: files.map((f) => ({
12818
13044
  path: f.relativePath,
@@ -12824,7 +13050,7 @@ var UploadSkillUseCase = class {
12824
13050
  const uploadSkillResponse = await this.deps.gateway.skills.upload({
12825
13051
  spaceId: createSpaceId(space.id),
12826
13052
  files: payload.files,
12827
- originSkill: command32.originSkill
13053
+ originSkill: command35.originSkill
12828
13054
  });
12829
13055
  return {
12830
13056
  skillId: uploadSkillResponse.skill.id,
@@ -13383,6 +13609,10 @@ var DEPLOYER_PARSERS = [
13383
13609
  parse: parseContinueStandard
13384
13610
  },
13385
13611
  { pattern: ".github/instructions/packmind-", parse: parseCopilotStandard },
13612
+ {
13613
+ pattern: ".kiro/steering/packmind-standard-",
13614
+ parse: parseKiroStandard
13615
+ },
13386
13616
  // Home-install variant (e.g. `~/.claude`): the agent directory prefix is
13387
13617
  // stripped from on-disk and lockfile paths. Only Claude supports home-install
13388
13618
  // today, so an unprefixed `rules/packmind/standard-…` path is Claude-rendered.
@@ -13409,8 +13639,9 @@ var AGENT_PARSERS = {
13409
13639
  // single-file agent: standards can't be parsed individually
13410
13640
  opencode: () => null,
13411
13641
  // single-file agent: standards are embedded in AGENTS.md
13412
- codex: () => null
13642
+ codex: () => null,
13413
13643
  // single-file agent: standards are embedded in AGENTS.md
13644
+ kiro: parseKiroStandard
13414
13645
  };
13415
13646
  function parseStandardMdForAgent(content, agent) {
13416
13647
  return AGENT_PARSERS[agent](content);
@@ -13433,34 +13664,43 @@ function parsePackmindStandard(content) {
13433
13664
  if (!name) {
13434
13665
  return null;
13435
13666
  }
13667
+ let scopeLineIndex = -1;
13436
13668
  let rulesLineIndex = -1;
13437
13669
  for (let i = nameLineIndex + 1; i < lines.length; i++) {
13438
- if (lines[i].trim() === "## Rules") {
13670
+ const trimmed = lines[i].trim();
13671
+ if (scopeLineIndex < 0 && trimmed === SCOPE_HEADING) {
13672
+ scopeLineIndex = i;
13673
+ } else if (rulesLineIndex < 0 && trimmed === RULES_HEADING) {
13439
13674
  rulesLineIndex = i;
13440
- break;
13441
13675
  }
13442
13676
  }
13677
+ const scopeSection = scopeLineIndex >= 0 ? extractScopeSection(lines, scopeLineIndex + 1, rulesLineIndex < 0) : null;
13678
+ const sectionIndexes = [scopeLineIndex, rulesLineIndex].filter(
13679
+ (index) => index >= 0
13680
+ );
13681
+ const descriptionEnd = sectionIndexes.length ? Math.min(...sectionIndexes) : lines.length;
13443
13682
  const descriptionLines = [];
13444
- let rulesStartIndex = -1;
13445
- if (rulesLineIndex >= 0) {
13446
- for (let i = nameLineIndex + 1; i < rulesLineIndex; i++) {
13447
- descriptionLines.push(lines[i]);
13683
+ let rulesStartIndex = rulesLineIndex >= 0 ? rulesLineIndex + 1 : -1;
13684
+ for (let i = nameLineIndex + 1; i < descriptionEnd; i++) {
13685
+ if (rulesStartIndex < 0 && isRuleBullet(lines[i])) {
13686
+ rulesStartIndex = i;
13687
+ break;
13448
13688
  }
13449
- rulesStartIndex = rulesLineIndex + 1;
13450
- } else {
13451
- for (let i = nameLineIndex + 1; i < lines.length; i++) {
13452
- if (lines[i].startsWith("* ") || lines[i].startsWith("- ")) {
13689
+ descriptionLines.push(lines[i]);
13690
+ }
13691
+ if (rulesStartIndex < 0 && scopeSection) {
13692
+ for (let i = scopeSection.endIndex; i < lines.length; i++) {
13693
+ if (isRuleBullet(lines[i])) {
13453
13694
  rulesStartIndex = i;
13454
13695
  break;
13455
13696
  }
13456
- descriptionLines.push(lines[i]);
13457
13697
  }
13458
13698
  }
13459
13699
  const rules = extractRulesList(lines, rulesStartIndex);
13460
13700
  return {
13461
13701
  name,
13462
13702
  description: descriptionLines.join("\n").trim(),
13463
- scope: "",
13703
+ scope: scopeSection?.value ?? "",
13464
13704
  rules
13465
13705
  };
13466
13706
  }
@@ -13483,6 +13723,11 @@ function parseContinueStandard(content) {
13483
13723
  if (!parsed) return null;
13484
13724
  return addFrontmatterFields(parsed, frontmatter);
13485
13725
  }
13726
+ function parseKiroStandard(content) {
13727
+ const { frontmatter, body } = extractFrontmatter(content);
13728
+ const scope = extractScopeFromKey(frontmatter, "fileMatchPattern");
13729
+ return parseIdeStandardBody(body, scope);
13730
+ }
13486
13731
  function parseCopilotStandard(content) {
13487
13732
  const { frontmatter, body } = extractFrontmatter(content);
13488
13733
  const rawScope = extractFrontmatterValue(frontmatter, "applyTo");
@@ -13494,12 +13739,30 @@ function parseCopilotStandard(content) {
13494
13739
  return parseIdeStandardBody(body, scope);
13495
13740
  }
13496
13741
  var RULES_FALLBACK = "No rules defined yet.";
13742
+ var SCOPE_HEADING = "## Scope";
13743
+ var RULES_HEADING = "## Rules";
13744
+ function isRuleBullet(line) {
13745
+ return line.startsWith("* ") || line.startsWith("- ");
13746
+ }
13747
+ function extractScopeSection(lines, startIndex, stopAtBullet) {
13748
+ const patterns = [];
13749
+ let index = startIndex;
13750
+ for (; index < lines.length; index++) {
13751
+ const line = lines[index];
13752
+ if (line.startsWith("## ")) break;
13753
+ if (stopAtBullet && isRuleBullet(line)) break;
13754
+ const trimmed = line.trim();
13755
+ if (!trimmed) continue;
13756
+ patterns.push(isRuleBullet(trimmed) ? trimmed.slice(2).trim() : trimmed);
13757
+ }
13758
+ return { value: patterns.join(", "), endIndex: index };
13759
+ }
13497
13760
  function extractRulesList(lines, startIndex) {
13498
13761
  if (startIndex < 0) return [];
13499
13762
  const rules = [];
13500
13763
  for (let i = startIndex; i < lines.length; i++) {
13501
13764
  const line = lines[i];
13502
- if (line.startsWith("* ") || line.startsWith("- ")) {
13765
+ if (isRuleBullet(line)) {
13503
13766
  const content = line.slice(2).trim();
13504
13767
  if (content && content !== RULES_FALLBACK) {
13505
13768
  rules.push(content);
@@ -13550,7 +13813,7 @@ function parseIdeStandardBody(body, scope) {
13550
13813
  const descriptionLines = [];
13551
13814
  let rulesStartIndex = -1;
13552
13815
  for (let i = nameLineIndex + 1; i < lines.length; i++) {
13553
- if (lines[i].startsWith("* ") || lines[i].startsWith("- ")) {
13816
+ if (isRuleBullet(lines[i])) {
13554
13817
  rulesStartIndex = i;
13555
13818
  break;
13556
13819
  }
@@ -13611,11 +13874,36 @@ function normalizeScopeValue(rawValue) {
13611
13874
  if (!rawValue) return "";
13612
13875
  if (rawValue.startsWith("[")) {
13613
13876
  const inner = rawValue.slice(1, -1);
13614
- const items = inner.split(",").map((item) => item.trim().replace(/(?:^["'])|(?:["']$)/g, ""));
13877
+ const items = splitOutsideBraces(inner).map(
13878
+ (item) => item.replace(/(?:^["'])|(?:["']$)/g, "")
13879
+ );
13615
13880
  return items.join(", ");
13616
13881
  }
13617
13882
  return rawValue.replace(/(?:^["'])|(?:["']$)/g, "");
13618
13883
  }
13884
+ function splitOutsideBraces(value) {
13885
+ const items = [];
13886
+ let current = "";
13887
+ let braceDepth = 0;
13888
+ for (const char of value) {
13889
+ if (char === "{") {
13890
+ braceDepth++;
13891
+ current += char;
13892
+ } else if (char === "}") {
13893
+ braceDepth--;
13894
+ current += char;
13895
+ } else if (char === "," && braceDepth === 0) {
13896
+ const trimmed2 = current.trim();
13897
+ if (trimmed2) items.push(trimmed2);
13898
+ current = "";
13899
+ } else {
13900
+ current += char;
13901
+ }
13902
+ }
13903
+ const trimmed = current.trim();
13904
+ if (trimmed) items.push(trimmed);
13905
+ return items;
13906
+ }
13619
13907
 
13620
13908
  // apps/cli/src/application/utils/ruleSimilarity.ts
13621
13909
  var DEFAULT_SIMILARITY_THRESHOLD = 0.5;
@@ -13814,9 +14102,9 @@ var DiffArtefactsUseCase = class {
13814
14102
  new StandardDiffStrategy()
13815
14103
  ];
13816
14104
  }
13817
- async execute(command32) {
13818
- const baseDirectory = command32.baseDirectory || process.cwd();
13819
- const response = await this.fetchContent(command32, baseDirectory);
14105
+ async execute(command35) {
14106
+ const baseDirectory = command35.baseDirectory || process.cwd();
14107
+ const response = await this.fetchContent(command35, baseDirectory);
13820
14108
  const filteredFiles = response.fileUpdates.createOrUpdate.filter(
13821
14109
  (file) => file.path !== "packmind.json"
13822
14110
  );
@@ -13829,7 +14117,7 @@ var DiffArtefactsUseCase = class {
13829
14117
  );
13830
14118
  const prefixedSkillFolders = this.prefixSkillFolders(
13831
14119
  response.skillFolders,
13832
- command32.relativePath
14120
+ command35.relativePath
13833
14121
  );
13834
14122
  const diffs = [];
13835
14123
  for (const file of diffableFiles) {
@@ -13856,7 +14144,7 @@ var DiffArtefactsUseCase = class {
13856
14144
  targetId: response.targetId ? createTargetId(response.targetId) : void 0
13857
14145
  }));
13858
14146
  }
13859
- async fetchContent(command32, baseDirectory) {
14147
+ async fetchContent(command35, baseDirectory) {
13860
14148
  const lockFile = await this.lockFileRepository.read(baseDirectory);
13861
14149
  if (lockFile) {
13862
14150
  try {
@@ -13876,11 +14164,11 @@ var DiffArtefactsUseCase = class {
13876
14164
  }
13877
14165
  }
13878
14166
  return this.packmindGateway.deployment.getDeployed({
13879
- packagesSlugs: command32.packagesSlugs,
13880
- gitRemoteUrl: command32.gitRemoteUrl,
13881
- gitBranch: command32.gitBranch,
13882
- relativePath: command32.relativePath,
13883
- agents: command32.agents
14167
+ packagesSlugs: command35.packagesSlugs,
14168
+ gitRemoteUrl: command35.gitRemoteUrl,
14169
+ gitBranch: command35.gitBranch,
14170
+ relativePath: command35.relativePath,
14171
+ agents: command35.agents
13884
14172
  });
13885
14173
  }
13886
14174
  prefixSkillFolders(skillFolders, relativePath) {
@@ -13904,8 +14192,8 @@ var SubmitDiffsUseCase = class {
13904
14192
  constructor(packmindGateway) {
13905
14193
  this.packmindGateway = packmindGateway;
13906
14194
  }
13907
- async execute(command32) {
13908
- const { groupedDiffs, message } = command32;
14195
+ async execute(command35) {
14196
+ const { groupedDiffs, message } = command35;
13909
14197
  const skipped = [];
13910
14198
  const validDiffs = [];
13911
14199
  for (const group of groupedDiffs) {
@@ -13980,8 +14268,8 @@ var CheckDiffsUseCase = class {
13980
14268
  constructor(packmindGateway) {
13981
14269
  this.packmindGateway = packmindGateway;
13982
14270
  }
13983
- async execute(command32) {
13984
- const { groupedDiffs } = command32;
14271
+ async execute(command35) {
14272
+ const { groupedDiffs } = command35;
13985
14273
  const results = [];
13986
14274
  const validDiffs = [];
13987
14275
  const invalidDiffs = [];
@@ -14065,7 +14353,7 @@ var SpaceService = class {
14065
14353
  // apps/cli/src/infra/repositories/CliOutput.ts
14066
14354
  init_source();
14067
14355
  var import_log_update = __toESM(require("log-update"));
14068
- var CLI_PREFIX2 = "packmind-cli";
14356
+ var CLI_PREFIX2 = EXEC_NAME;
14069
14357
  var CliFormatter = class {
14070
14358
  static success(message) {
14071
14359
  return `${source_default.bgGreen.bold(CLI_PREFIX2)} ${source_default.green.bold(message)}`;
@@ -14079,8 +14367,8 @@ var CliFormatter = class {
14079
14367
  static error(message) {
14080
14368
  return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
14081
14369
  }
14082
- static command(command32) {
14083
- return source_default.yellow(command32);
14370
+ static command(command35) {
14371
+ return source_default.yellow(command35);
14084
14372
  }
14085
14373
  static loader(text) {
14086
14374
  return source_default.dim.italic(text);
@@ -14225,7 +14513,7 @@ var TrackRepositoryUseCase = class {
14225
14513
  this.gateway = gateway;
14226
14514
  this.gitService = gitService;
14227
14515
  }
14228
- async execute(command32) {
14516
+ async execute(command35) {
14229
14517
  const {
14230
14518
  repoPath,
14231
14519
  origin: origin9,
@@ -14233,12 +14521,18 @@ var TrackRepositoryUseCase = class {
14233
14521
  remove,
14234
14522
  branch: requestedBranch,
14235
14523
  confirm
14236
- } = command32;
14524
+ } = command35;
14237
14525
  const { gitRemoteUrl } = this.gitService.getGitRemoteUrl(repoPath);
14238
- const { branch: currentBranch } = this.gitService.getCurrentBranch(repoPath);
14526
+ const { branch: currentBranch, detached } = this.gitService.getCurrentBranch(repoPath);
14239
14527
  const branch = requestedBranch ?? currentBranch;
14240
14528
  const { owner, repo } = parseOwnerRepo(gitRemoteUrl);
14241
14529
  const providerVendor = parseProviderVendor(gitRemoteUrl);
14530
+ if (detached && !requestedBranch && !remove) {
14531
+ return { status: "detached-head", owner, repo };
14532
+ }
14533
+ if (requestedBranch && !this.gitService.branchExists(repoPath, requestedBranch)) {
14534
+ return { status: "branch-not-found", owner, repo, branch };
14535
+ }
14242
14536
  const { gitRepo: tracked } = await this.gateway.getTrackedRepository({
14243
14537
  owner,
14244
14538
  repo
@@ -14333,6 +14627,45 @@ var TrackRepositoryUseCase = class {
14333
14627
  }
14334
14628
  };
14335
14629
 
14630
+ // apps/cli/src/application/useCases/trackRepository/GetTrackingInfoUseCase.ts
14631
+ var GetTrackingInfoUseCase = class {
14632
+ constructor(gateway, gitService) {
14633
+ this.gateway = gateway;
14634
+ this.gitService = gitService;
14635
+ }
14636
+ async execute({
14637
+ repoPath
14638
+ }) {
14639
+ const { gitRemoteUrl } = this.gitService.getGitRemoteUrl(repoPath);
14640
+ const { branch: currentBranch, detached: currentBranchDetached } = this.gitService.getCurrentBranch(repoPath);
14641
+ const { owner, repo } = parseOwnerRepo(gitRemoteUrl);
14642
+ const { gitRepo } = await this.gateway.getTrackedRepository({
14643
+ owner,
14644
+ repo
14645
+ });
14646
+ if (!gitRepo) {
14647
+ return {
14648
+ status: "not-tracked",
14649
+ owner,
14650
+ repo,
14651
+ currentBranch,
14652
+ currentBranchDetached
14653
+ };
14654
+ }
14655
+ return {
14656
+ status: "tracked",
14657
+ owner,
14658
+ repo,
14659
+ trackedBranch: gitRepo.branch,
14660
+ currentBranch,
14661
+ currentBranchDetached,
14662
+ // Skipped when it is the branch we are on: being on it proves it exists,
14663
+ // and this is the common case, so it saves a git call.
14664
+ trackedBranchExists: gitRepo.branch === currentBranch || this.gitService.branchExists(repoPath, gitRepo.branch)
14665
+ };
14666
+ }
14667
+ };
14668
+
14336
14669
  // apps/cli/src/PackmindCliHexaFactory.ts
14337
14670
  var PackmindCliHexaFactory = class {
14338
14671
  constructor() {
@@ -14422,6 +14755,10 @@ var PackmindCliHexaFactory = class {
14422
14755
  trackRepository: new TrackRepositoryUseCase(
14423
14756
  this.repositories.packmindGateway.repositoryTracking,
14424
14757
  this.services.gitRemoteUrlService
14758
+ ),
14759
+ getTrackingInfo: new GetTrackingInfoUseCase(
14760
+ this.repositories.packmindGateway.repositoryTracking,
14761
+ this.services.gitRemoteUrlService
14425
14762
  )
14426
14763
  };
14427
14764
  }
@@ -14431,29 +14768,29 @@ var PackmindCliHexaFactory = class {
14431
14768
  var origin8 = "PackmindCliHexa";
14432
14769
  var PackmindCliHexa = class {
14433
14770
  constructor(logger2 = new PackmindLogger(origin8)) {
14434
- this.notifyDistribution = async (command32) => {
14771
+ this.notifyDistribution = async (command35) => {
14435
14772
  return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
14436
- command32
14773
+ command35
14437
14774
  );
14438
14775
  };
14439
- this.notifyArtefactsDistribution = async (command32) => {
14776
+ this.notifyArtefactsDistribution = async (command35) => {
14440
14777
  return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
14441
- command32
14778
+ command35
14442
14779
  );
14443
14780
  };
14444
- this.getTrackedRepository = async (command32) => {
14781
+ this.getTrackedRepository = async (command35) => {
14445
14782
  return this.hexa.repositories.packmindGateway.repositoryTracking.getTrackedRepository(
14446
- command32
14783
+ command35
14447
14784
  );
14448
14785
  };
14449
- this.renderPlugin = async (command32) => {
14786
+ this.renderPlugin = async (command35) => {
14450
14787
  return this.hexa.repositories.packmindGateway.deployment.renderPlugin(
14451
- command32
14788
+ command35
14452
14789
  );
14453
14790
  };
14454
- this.trackPluginDeleted = async (command32) => {
14791
+ this.trackPluginDeleted = async (command35) => {
14455
14792
  return this.hexa.repositories.packmindGateway.deployment.trackPluginDeleted(
14456
- command32
14793
+ command35
14457
14794
  );
14458
14795
  };
14459
14796
  this.logger = logger2;
@@ -14476,29 +14813,29 @@ var PackmindCliHexa = class {
14476
14813
  get output() {
14477
14814
  return this.hexa.repositories.output;
14478
14815
  }
14479
- async getGitRemoteUrl(command32) {
14480
- return this.hexa.useCases.getGitRemoteUrl.execute(command32);
14816
+ async getGitRemoteUrl(command35) {
14817
+ return this.hexa.useCases.getGitRemoteUrl.execute(command35);
14481
14818
  }
14482
- async listFilesInDirectory(command32) {
14483
- return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command32);
14819
+ async listFilesInDirectory(command35) {
14820
+ return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command35);
14484
14821
  }
14485
- async lintFilesAgainstRule(command32) {
14486
- return this.hexa.useCases.lintFilesAgainstRule.execute(command32);
14822
+ async lintFilesAgainstRule(command35) {
14823
+ return this.hexa.useCases.lintFilesAgainstRule.execute(command35);
14487
14824
  }
14488
- async lintFilesFromConfig(command32) {
14489
- return this.hexa.useCases.lintFilesFromConfig.execute(command32);
14825
+ async lintFilesFromConfig(command35) {
14826
+ return this.hexa.useCases.lintFilesFromConfig.execute(command35);
14490
14827
  }
14491
- async installPackages(command32) {
14492
- return this.hexa.useCases.installPackages.execute(command32);
14828
+ async installPackages(command35) {
14829
+ return this.hexa.useCases.installPackages.execute(command35);
14493
14830
  }
14494
- async install(command32) {
14495
- return this.hexa.useCases.install.execute(command32);
14831
+ async install(command35) {
14832
+ return this.hexa.useCases.install.execute(command35);
14496
14833
  }
14497
- async uninstall(command32) {
14498
- return this.hexa.useCases.uninstall.execute(command32);
14834
+ async uninstall(command35) {
14835
+ return this.hexa.useCases.uninstall.execute(command35);
14499
14836
  }
14500
- async diffArtefacts(command32) {
14501
- return this.hexa.useCases.diffArtefacts.execute(command32);
14837
+ async diffArtefacts(command35) {
14838
+ return this.hexa.useCases.diffArtefacts.execute(command35);
14502
14839
  }
14503
14840
  async submitDiffs(groupedDiffs, message) {
14504
14841
  return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
@@ -14506,20 +14843,20 @@ var PackmindCliHexa = class {
14506
14843
  async checkDiffs(groupedDiffs) {
14507
14844
  return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
14508
14845
  }
14509
- async listPackages(command32) {
14510
- return this.hexa.useCases.listPackages.execute(command32);
14846
+ async listPackages(command35) {
14847
+ return this.hexa.useCases.listPackages.execute(command35);
14511
14848
  }
14512
- async getPackageBySlug(command32) {
14513
- return this.hexa.useCases.getPackageBySlug.execute(command32);
14849
+ async getPackageBySlug(command35) {
14850
+ return this.hexa.useCases.getPackageBySlug.execute(command35);
14514
14851
  }
14515
- async listStandards(command32) {
14516
- return this.hexa.useCases.listStandards.execute(command32);
14852
+ async listStandards(command35) {
14853
+ return this.hexa.useCases.listStandards.execute(command35);
14517
14854
  }
14518
- async listCommands(command32) {
14519
- return this.hexa.useCases.listCommands.execute(command32);
14855
+ async listCommands(command35) {
14856
+ return this.hexa.useCases.listCommands.execute(command35);
14520
14857
  }
14521
- async listSkills(command32) {
14522
- return this.hexa.useCases.listSkills.execute(command32);
14858
+ async listSkills(command35) {
14859
+ return this.hexa.useCases.listSkills.execute(command35);
14523
14860
  }
14524
14861
  async configExists(baseDirectory) {
14525
14862
  return await this.hexa.repositories.configFileRepository.configExists(
@@ -14606,40 +14943,52 @@ var PackmindCliHexa = class {
14606
14943
  directory
14607
14944
  );
14608
14945
  }
14609
- async login(command32) {
14610
- return this.hexa.useCases.login.execute(command32);
14946
+ async login(command35) {
14947
+ return this.hexa.useCases.login.execute(command35);
14611
14948
  }
14612
- async logout(command32) {
14613
- return this.hexa.useCases.logout.execute(command32);
14949
+ async logout(command35) {
14950
+ return this.hexa.useCases.logout.execute(command35);
14614
14951
  }
14615
- async whoami(command32) {
14616
- return this.hexa.useCases.whoami.execute(command32);
14952
+ async whoami(command35) {
14953
+ return this.hexa.useCases.whoami.execute(command35);
14617
14954
  }
14618
- async checkCliVersion(command32) {
14619
- return this.hexa.useCases.checkCliVersion.execute(command32);
14955
+ async checkCliVersion(command35) {
14956
+ return this.hexa.useCases.checkCliVersion.execute(command35);
14620
14957
  }
14621
14958
  getCurrentBranch(repoPath) {
14622
14959
  return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
14623
14960
  }
14961
+ isDetachedHead(repoPath) {
14962
+ return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).detached;
14963
+ }
14964
+ branchExists(repoPath, branch) {
14965
+ return this.hexa.services.gitRemoteUrlService.branchExists(
14966
+ repoPath,
14967
+ branch
14968
+ );
14969
+ }
14624
14970
  getGitRemoteUrlFromPath(repoPath) {
14625
14971
  return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
14626
14972
  }
14627
- async uploadSkill(command32) {
14628
- return this.hexa.useCases.uploadSkill.execute(command32);
14973
+ async uploadSkill(command35) {
14974
+ return this.hexa.useCases.uploadSkill.execute(command35);
14629
14975
  }
14630
- async installDefaultSkills(command32) {
14631
- return this.hexa.useCases.installDefaultSkills.execute(command32);
14976
+ async installDefaultSkills(command35) {
14977
+ return this.hexa.useCases.installDefaultSkills.execute(command35);
14632
14978
  }
14633
- async bootstrapSkillsInitDirectory(command32) {
14979
+ async bootstrapSkillsInitDirectory(command35) {
14634
14980
  return this.hexa.useCases.installDefaultSkills.bootstrapEmptyDirectory(
14635
- command32.baseDirectory
14981
+ command35.baseDirectory
14636
14982
  );
14637
14983
  }
14638
- async ensureCliVersion(command32) {
14639
- return this.hexa.useCases.ensureCliVersion.execute(command32);
14984
+ async ensureCliVersion(command35) {
14985
+ return this.hexa.useCases.ensureCliVersion.execute(command35);
14986
+ }
14987
+ async trackRepository(command35) {
14988
+ return this.hexa.useCases.trackRepository.execute(command35);
14640
14989
  }
14641
- async trackRepository(command32) {
14642
- return this.hexa.useCases.trackRepository.execute(command32);
14990
+ async getTrackingInfo(command35) {
14991
+ return this.hexa.useCases.getTrackingInfo.execute(command35);
14643
14992
  }
14644
14993
  getPackmindGateway() {
14645
14994
  return this.hexa.repositories.packmindGateway;
@@ -14665,7 +15014,7 @@ var PackmindCliHexa = class {
14665
15014
  spaces = await this.getSpaces();
14666
15015
  } catch {
14667
15016
  logWarningConsole(
14668
- "Your Packmind instance is outdated and needs to be updated. It will not be supported in the v1 release of packmind-cli."
15017
+ "Your Packmind instance is outdated and needs to be updated. It will not be supported in the v1 release of the Packmind CLI."
14669
15018
  );
14670
15019
  return slugs;
14671
15020
  }
@@ -14902,7 +15251,7 @@ async function lintHandler(args2, deps) {
14902
15251
  );
14903
15252
  if (!hierarchicalConfig.hasConfigs) {
14904
15253
  throw new Error(
14905
- "No packmind.json config found. Run `packmind-cli install <some-package>` first to set up linting."
15254
+ `No packmind.json config found. Run \`${EXEC_NAME} install <some-package>\` first to set up linting.`
14906
15255
  );
14907
15256
  }
14908
15257
  const result = await packmindCliHexa.lintFilesFromConfig({
@@ -14915,13 +15264,13 @@ async function lintHandler(args2, deps) {
14915
15264
  } catch (error) {
14916
15265
  if (isNotLoggedInError(error) && continueOnMissingKey) {
14917
15266
  logWarningConsole(
14918
- "Warning: Not logged in to Packmind, linting is skipped. Run `packmind-cli login` to authenticate."
15267
+ `Warning: Not logged in to Packmind, linting is skipped. Run \`${EXEC_NAME} login\` to authenticate.`
14919
15268
  );
14920
15269
  exit(0);
14921
15270
  return;
14922
15271
  }
14923
15272
  if (error instanceof CommunityEditionError) {
14924
- logInfoConsole(`packmind-cli ${error.message}`);
15273
+ logInfoConsole(error.message);
14925
15274
  logInfoConsole("Linting skipped.");
14926
15275
  exit(0);
14927
15276
  return;
@@ -15306,7 +15655,7 @@ function buildIncapableArtifactsWarning(result) {
15306
15655
  ...mismatches.map(
15307
15656
  ({ noun, count, capable }) => ` - ${count} ${pluralize(noun, count)}: try ${formatCapableList(capable)}`
15308
15657
  ),
15309
- ` Run ${formatCommand("packmind-cli config agents")} to add a capable agent.`
15658
+ ` Run ${formatCommand(`${EXEC_NAME} config agents`)} to add a capable agent.`
15310
15659
  ];
15311
15660
  return lines.join("\n");
15312
15661
  }
@@ -15331,7 +15680,8 @@ var AGENT_ARTIFACT_CHECKS = [
15331
15680
  { agent: "agents_md", paths: ["AGENTS.md"] },
15332
15681
  { agent: "gitlab_duo", paths: [".gitlab/duo"] },
15333
15682
  { agent: "opencode", paths: [".opencode"] },
15334
- { agent: "codex", paths: [".agents/skills"], recursive: true }
15683
+ { agent: "codex", paths: [".agents/skills"], recursive: true },
15684
+ { agent: "kiro", paths: [".kiro"] }
15335
15685
  ];
15336
15686
  var AgentArtifactDetectionService = class {
15337
15687
  async detectAgentArtifacts(baseDirectory) {
@@ -15449,6 +15799,7 @@ var SELECTABLE_AGENTS = [
15449
15799
  "cursor",
15450
15800
  "gitlab_duo",
15451
15801
  "junie",
15802
+ "kiro",
15452
15803
  "opencode"
15453
15804
  ];
15454
15805
  var AGENT_DISPLAY_NAMES = {
@@ -15462,7 +15813,8 @@ var AGENT_DISPLAY_NAMES = {
15462
15813
  agents_md: "AGENTS.md",
15463
15814
  gitlab_duo: "GitLab Duo",
15464
15815
  opencode: "OpenCode",
15465
- codex: "Codex"
15816
+ codex: "Codex",
15817
+ kiro: "Kiro"
15466
15818
  };
15467
15819
  async function configAgentsHandler(deps) {
15468
15820
  const { configRepository, baseDirectory } = deps;
@@ -15599,7 +15951,7 @@ async function handleIncompatibleInstalledSkillsSilently(skills, baseDirectory)
15599
15951
  async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
15600
15952
  const skillNames = skills.map((s) => s.skillName).join(", ");
15601
15953
  logWarningConsole(
15602
- `The following skill(s) are installed but are not compatible with this version of packmind-cli: ${skillNames}`
15954
+ `The following skill(s) are installed but are not compatible with this version of ${EXEC_NAME}: ${skillNames}`
15603
15955
  );
15604
15956
  logInfoConsole("These skills will be deleted.");
15605
15957
  const confirmed = await confirm();
@@ -15641,13 +15993,11 @@ function reportEnsureCliVersionOutcome(outcome, currentCliVersion) {
15641
15993
  switch (outcome.kind) {
15642
15994
  case "older":
15643
15995
  logWarningConsole(
15644
- `[packmind-cli] Your CLI version ${currentCliVersion} is older than the version recorded in packmind-lock.json (${outcome.lockVersion}). Please update your CLI.`
15996
+ `Your CLI version ${currentCliVersion} is older than the version recorded in packmind-lock.json (${outcome.lockVersion}). Please update your CLI.`
15645
15997
  );
15646
15998
  break;
15647
15999
  case "newer":
15648
- logInfoConsole(
15649
- "[packmind-cli] CLI upgrade detected \u2014 refreshing default skills."
15650
- );
16000
+ logInfoConsole("CLI upgrade detected \u2014 refreshing default skills.");
15651
16001
  break;
15652
16002
  case "match":
15653
16003
  case "no-lockfile":
@@ -15661,7 +16011,7 @@ function configuredAgentsSupportSkills(configuredAgents) {
15661
16011
  return hasCapableAgent(configuredAgents, "skills");
15662
16012
  }
15663
16013
  function buildSkillsSkippedWarning(configuredAgents) {
15664
- const configHint = formatCommand("packmind-cli config agents");
16014
+ const configHint = formatCommand(`${EXEC_NAME} config agents`);
15665
16015
  if (configuredAgents.length === 0) {
15666
16016
  return `Skipping default skills \u2014 no coding agents are configured. Run ${configHint} to add one (e.g. claude).`;
15667
16017
  }
@@ -15760,7 +16110,7 @@ async function initHandler(deps) {
15760
16110
  const totalFiles = result.filesCreated + result.filesUpdated;
15761
16111
  if (result.skippedSkillsCount > 0) {
15762
16112
  logWarningConsole(
15763
- `${result.skippedSkillsCount} skill(s) were skipped because they require a newer version of packmind-cli. Run "${formatCommand("packmind-cli update")}" to get the latest version.`
16113
+ `${result.skippedSkillsCount} skill(s) were skipped because they require a newer version of ${EXEC_NAME}. Run "${formatCommand(`${EXEC_NAME} update`)}" to get the latest version.`
15764
16114
  );
15765
16115
  }
15766
16116
  if (totalFiles === 0) {
@@ -15903,7 +16253,7 @@ async function bootstrapInstallContext(deps) {
15903
16253
  }
15904
16254
  if (!isTTY) {
15905
16255
  logWarningConsole(
15906
- "No packmind.json and no agent context detected \u2014 run `packmind-cli init` to configure."
16256
+ `No packmind.json and no agent context detected \u2014 run \`${EXEC_NAME} init\` to configure.`
15907
16257
  );
15908
16258
  return {
15909
16259
  configReady: false,
@@ -16125,7 +16475,7 @@ function mergeInstallResults(results) {
16125
16475
  return merged;
16126
16476
  }
16127
16477
  function decideDistributionTracking(params) {
16128
- const { lookup, currentBranch } = params;
16478
+ const { lookup, currentBranch, branchExists, detached } = params;
16129
16479
  switch (lookup.status) {
16130
16480
  case "flag-off":
16131
16481
  return { action: "record-legacy" };
@@ -16137,9 +16487,16 @@ function decideDistributionTracking(params) {
16137
16487
  return { action: "skip", reason: "repo_not_tracked" };
16138
16488
  }
16139
16489
  if (tracked.branch !== currentBranch) {
16490
+ if (!branchExists(tracked.branch)) {
16491
+ return {
16492
+ action: "skip",
16493
+ reason: "tracked_branch_gone",
16494
+ trackedBranch: tracked.branch
16495
+ };
16496
+ }
16140
16497
  return {
16141
16498
  action: "skip",
16142
- reason: "wrong_branch",
16499
+ reason: detached ? "detached_head" : "wrong_branch",
16143
16500
  trackedBranch: tracked.branch
16144
16501
  };
16145
16502
  }
@@ -16164,9 +16521,19 @@ function reportDistributionTrackingDecision(decision, context) {
16164
16521
  if (decision.reason === "repo_not_tracked") {
16165
16522
  logWarningConsole(
16166
16523
  `Distribution not recorded \u2014 ${context.owner}/${context.repo} is not tracked in Packmind. Ask an admin to run ${formatCommand(
16167
- "packmind track"
16524
+ `${EXEC_NAME} git track`
16168
16525
  )} to start tracking it.`
16169
16526
  );
16527
+ } else if (decision.reason === "detached_head") {
16528
+ logWarningConsole(
16529
+ `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.`
16530
+ );
16531
+ } else if (decision.reason === "tracked_branch_gone") {
16532
+ logWarningConsole(
16533
+ `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(
16534
+ `${EXEC_NAME} git track --update`
16535
+ )} to move tracking to '${context.currentBranch}'.`
16536
+ );
16170
16537
  } else {
16171
16538
  logWarningConsole(
16172
16539
  `Distribution not recorded \u2014 you're on '${context.currentBranch}', but the tracked branch is '${decision.trackedBranch}'. Switch to '${decision.trackedBranch}' to record this distribution.`
@@ -16204,9 +16571,11 @@ async function computeDistributionTrackingDecision(packmindCliHexa, gitRoot) {
16204
16571
  let owner;
16205
16572
  let repo;
16206
16573
  let gitBranch;
16574
+ let detached;
16207
16575
  try {
16208
16576
  const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
16209
16577
  gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
16578
+ detached = packmindCliHexa.isDetachedHead(gitRoot);
16210
16579
  ({ owner, repo } = parseOwnerRepo(gitRemoteUrl));
16211
16580
  } catch {
16212
16581
  const decision2 = { action: "inform" };
@@ -16216,7 +16585,15 @@ async function computeDistributionTrackingDecision(packmindCliHexa, gitRoot) {
16216
16585
  const lookup = await resolveTrackingLookup(packmindCliHexa, owner, repo);
16217
16586
  const decision = decideDistributionTracking({
16218
16587
  lookup,
16219
- currentBranch: gitBranch
16588
+ currentBranch: gitBranch,
16589
+ branchExists: (branch) => {
16590
+ try {
16591
+ return packmindCliHexa.branchExists(gitRoot, branch);
16592
+ } catch {
16593
+ return true;
16594
+ }
16595
+ },
16596
+ detached
16220
16597
  });
16221
16598
  reportDistributionTrackingDecision(decision, {
16222
16599
  owner,
@@ -16587,7 +16964,8 @@ If the browser doesn't open, visit: ${normalizedHost}/cli-login?callback_url=${e
16587
16964
  logConsole(`
16588
16965
  Credentials saved to: ${result.credentialsPath}`);
16589
16966
  logConsole(
16590
- "\nYou can now use packmind-cli commands with your authenticated account."
16967
+ `
16968
+ You can now use ${EXEC_NAME} commands with your authenticated account.`
16591
16969
  );
16592
16970
  } catch (error) {
16593
16971
  if (error instanceof Error) {
@@ -16648,7 +17026,7 @@ function displayVersionNotice(result) {
16648
17026
  }
16649
17027
  logConsole("");
16650
17028
  logWarningConsole(
16651
- `Update available: ${result.currentVersion} \u2192 ${result.latestVersion} \u2014 run \`packmind-cli update\` to upgrade`
17029
+ `Update available: ${result.currentVersion} \u2192 ${result.latestVersion} \u2014 run \`${EXEC_NAME} update\` to upgrade`
16652
17030
  );
16653
17031
  }
16654
17032
 
@@ -16686,7 +17064,8 @@ Host: ${result.host}`);
16686
17064
  }
16687
17065
  logInfoConsole(`Source: ${result.source}`);
16688
17066
  if (result.isExpired) {
16689
- logConsole("\nRun `packmind-cli login` to re-authenticate.");
17067
+ logConsole(`
17068
+ Run \`${EXEC_NAME} login\` to re-authenticate.`);
16690
17069
  }
16691
17070
  }
16692
17071
  var whoamiCommand = (0, import_cmd_ts6.command)({
@@ -16704,7 +17083,7 @@ var whoamiCommand = (0, import_cmd_ts6.command)({
16704
17083
  logErrorConsole("Not authenticated");
16705
17084
  logConsole(
16706
17085
  `
16707
- No credentials found. Run \`packmind-cli login\` to authenticate.`
17086
+ No credentials found. Run \`${EXEC_NAME} login\` to authenticate.`
16708
17087
  );
16709
17088
  logConsole(`
16710
17089
  Credentials are loaded from (in order of priority):`);
@@ -16764,12 +17143,15 @@ var installDefaultSkillsCommand = (0, import_cmd_ts7.command)({
16764
17143
  logInfoConsole("Installing default skills...");
16765
17144
  const result = await packmindCliHexa.installDefaultSkills({
16766
17145
  includeBeta,
16767
- cliVersion: includeBeta ? void 0 : CLI_VERSION4,
17146
+ // Always report the real version: `includeBeta` already bypasses the
17147
+ // version filter on its own, and the version is what picks the
17148
+ // executable name the deployed skills tell the agent to run.
17149
+ cliVersion: CLI_VERSION4,
16768
17150
  baseDirectory
16769
17151
  });
16770
17152
  if (result.skippedSkillsCount > 0) {
16771
17153
  logWarningConsole(
16772
- `${result.skippedSkillsCount} skill(s) were skipped because they require a newer version of packmind-cli. Run "${formatCommand("packmind-cli update")}" to get the latest version.`
17154
+ `${result.skippedSkillsCount} skill(s) were skipped because they require a newer version of ${EXEC_NAME}. Run "${formatCommand(`${EXEC_NAME} update`)}" to get the latest version.`
16773
17155
  );
16774
17156
  }
16775
17157
  if (result.incompatibleInstalledSkills.length > 0) {
@@ -17192,15 +17574,15 @@ var CreatePackageUseCase = class {
17192
17574
  this.gateway = gateway;
17193
17575
  this.spaceService = spaceService;
17194
17576
  }
17195
- async execute(command32) {
17196
- const space = await this.getSpace(command32);
17577
+ async execute(command35) {
17578
+ const space = await this.getSpace(command35);
17197
17579
  const result = await this.gateway.packages.create({
17198
17580
  spaceId: space.id,
17199
- name: command32.name,
17200
- description: command32.description ?? "",
17581
+ name: command35.name,
17582
+ description: command35.description ?? "",
17201
17583
  recipeIds: [],
17202
17584
  standardIds: [],
17203
- originSkill: command32.originSkill
17585
+ originSkill: command35.originSkill
17204
17586
  });
17205
17587
  return {
17206
17588
  packageId: result.package.id,
@@ -17209,12 +17591,12 @@ var CreatePackageUseCase = class {
17209
17591
  spaceSlug: space.slug
17210
17592
  };
17211
17593
  }
17212
- async getSpace(command32) {
17594
+ async getSpace(command35) {
17213
17595
  const spaces = await this.spaceService.getSpaces();
17214
- if (command32.spaceSlug) {
17215
- const found = spaces.find((s) => s.slug === command32.spaceSlug);
17596
+ if (command35.spaceSlug) {
17597
+ const found = spaces.find((s) => s.slug === command35.spaceSlug);
17216
17598
  if (!found) {
17217
- throw new Error(`Space '${command32.spaceSlug}' not found.`);
17599
+ throw new Error(`Space '${command35.spaceSlug}' not found.`);
17218
17600
  }
17219
17601
  return found;
17220
17602
  }
@@ -17289,7 +17671,7 @@ var createPackageCommand = (0, import_cmd_ts15.command)({
17289
17671
  logConsole(` ${formatLabel("Link:")} ${result.webappUrl}`);
17290
17672
  }
17291
17673
  logConsole(
17292
- ` ${formatLabel("Install:")} ${formatCommand(`packmind-cli install ${result.slug}`)}`
17674
+ ` ${formatLabel("Install:")} ${formatCommand(`${EXEC_NAME} install ${result.slug}`)}`
17293
17675
  );
17294
17676
  if (result.deduplicated) {
17295
17677
  logWarningConsole(
@@ -17332,8 +17714,8 @@ var AddToPackageUseCase = class {
17332
17714
  this.gateway = gateway;
17333
17715
  this.spaceService = spaceService;
17334
17716
  }
17335
- async execute(command32) {
17336
- const { packageSlug, spaceSlug, itemType, itemSlugs } = command32;
17717
+ async execute(command35) {
17718
+ const { packageSlug, spaceSlug, itemType, itemSlugs } = command35;
17337
17719
  const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
17338
17720
  const packages = await this.gateway.packages.list({
17339
17721
  spaceId: space.id
@@ -17354,7 +17736,7 @@ var AddToPackageUseCase = class {
17354
17736
  standardIds: [],
17355
17737
  recipeIds: [],
17356
17738
  skillIds: [],
17357
- originSkill: command32.originSkill
17739
+ originSkill: command35.originSkill
17358
17740
  };
17359
17741
  if (itemType === "standard") {
17360
17742
  addCommand.standardIds = ids.map(createStandardId);
@@ -17406,7 +17788,7 @@ var AddToPackageUseCase = class {
17406
17788
  }
17407
17789
  async findCommandBySlug(slug6, spaceId) {
17408
17790
  const commands = await this.gateway.commands.list({ spaceId });
17409
- return commands.recipes.find((command32) => command32.slug === slug6) ?? null;
17791
+ return commands.recipes.find((command35) => command35.slug === slug6) ?? null;
17410
17792
  }
17411
17793
  async findSkillBySlug(slug6, spaceId) {
17412
17794
  const skills = await this.gateway.skills.list({ spaceId });
@@ -17444,7 +17826,7 @@ function resolvePackageRef(to, allSpaces, exit) {
17444
17826
  logInfoConsole(` --to @${s.slug}/${to.packageSlug}`);
17445
17827
  });
17446
17828
  logInfoConsole(
17447
- `Run \`packmind-cli packages list\` to see available packages per space.`
17829
+ `Run \`${EXEC_NAME} packages list\` to see available packages per space.`
17448
17830
  );
17449
17831
  exit(1);
17450
17832
  }
@@ -17468,7 +17850,7 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
17468
17850
  `${formatItemType(itemType, result.added.length)} ${formatItemList(result.added)} added to "${fullPackageSlug}"`
17469
17851
  );
17470
17852
  logSuccessConsole(
17471
- `Run ${formatCommand(`packmind-cli install ${fullPackageSlug}`)} to install the ${pluralize2(itemType, result.added.length)}`
17853
+ `Run ${formatCommand(`${EXEC_NAME} install ${fullPackageSlug}`)} to install the ${pluralize2(itemType, result.added.length)}`
17472
17854
  );
17473
17855
  }
17474
17856
  if (result.skipped.length) {
@@ -17482,11 +17864,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
17482
17864
  logErrorConsole(message);
17483
17865
  if (error instanceof ItemNotFoundError) {
17484
17866
  const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
17485
- const command32 = formatCommand(
17486
- `packmind-cli ${error.itemType}s list${spaceFlag}`
17867
+ const command35 = formatCommand(
17868
+ `${EXEC_NAME} ${error.itemType}s list${spaceFlag}`
17487
17869
  );
17488
17870
  logInfoConsole(
17489
- `Run \`${command32}\` to display available ${error.itemType}s`
17871
+ `Run \`${command35}\` to display available ${error.itemType}s`
17490
17872
  );
17491
17873
  }
17492
17874
  return { success: false, error: message };
@@ -17628,7 +18010,7 @@ ${availableSpaces}`
17628
18010
  scopedArtefacts,
17629
18011
  {
17630
18012
  content: "How to install a package:",
17631
- exampleCommand: `packmind-cli install ${firstSlug}`
18013
+ exampleCommand: `${EXEC_NAME} install ${firstSlug}`
17632
18014
  }
17633
18015
  );
17634
18016
  exit(0);
@@ -17746,8 +18128,8 @@ ${pkg.name} (${fullSlug}):
17746
18128
  }
17747
18129
  if (pkg.commands && pkg.commands.length > 0) {
17748
18130
  logConsole("Commands:");
17749
- pkg.commands.forEach((command32) => {
17750
- logConsole(` - ${command32.name}`);
18131
+ pkg.commands.forEach((command35) => {
18132
+ logConsole(` - ${command35.name}`);
17751
18133
  });
17752
18134
  logConsole("");
17753
18135
  }
@@ -17818,19 +18200,34 @@ var import_path6 = require("path");
17818
18200
  var import_fs21 = require("fs");
17819
18201
  var import_path5 = require("path");
17820
18202
  function detectPluginMode(cwd) {
17821
- const marketplace = (0, import_path5.join)(cwd, ".claude-plugin/marketplace.json");
18203
+ const claudeMarketplace = (0, import_path5.join)(cwd, ".claude-plugin/marketplace.json");
18204
+ const copilotMarketplace = (0, import_path5.join)(cwd, ".github/plugin/marketplace.json");
17822
18205
  const standalone = (0, import_path5.join)(cwd, ".claude-plugin/plugin.json");
17823
- if ((0, import_fs21.existsSync)(marketplace)) {
17824
- return { mode: "marketplace", manifestPath: marketplace };
18206
+ if ((0, import_fs21.existsSync)(claudeMarketplace)) {
18207
+ return {
18208
+ mode: "marketplace",
18209
+ vendor: "claude",
18210
+ manifestPath: claudeMarketplace
18211
+ };
18212
+ }
18213
+ if ((0, import_fs21.existsSync)(copilotMarketplace)) {
18214
+ return {
18215
+ mode: "marketplace",
18216
+ vendor: "copilot",
18217
+ manifestPath: copilotMarketplace
18218
+ };
17825
18219
  }
17826
18220
  if ((0, import_fs21.existsSync)(standalone)) {
17827
- return { mode: "standalone", manifestPath: standalone };
18221
+ return { mode: "standalone", vendor: "claude", manifestPath: standalone };
17828
18222
  }
17829
18223
  return { mode: "none" };
17830
18224
  }
18225
+ function stripBom(content) {
18226
+ return content.charCodeAt(0) === 65279 ? content.slice(1) : content;
18227
+ }
17831
18228
  function readMarketplace(path37) {
17832
18229
  const raw = (0, import_fs21.readFileSync)(path37, "utf8");
17833
- const parsed = JSON.parse(raw);
18230
+ const parsed = JSON.parse(stripBom(raw));
17834
18231
  return { ...parsed, plugins: parsed.plugins ?? [] };
17835
18232
  }
17836
18233
  function writeMarketplace(path37, content) {
@@ -17884,11 +18281,12 @@ async function renderPluginHandler(args2, deps) {
17884
18281
  const ctx = detectPluginMode(cwd);
17885
18282
  if (ctx.mode === "none") {
17886
18283
  deps.error(
17887
- "No .claude-plugin/marketplace.json or .claude-plugin/plugin.json found in this directory."
18284
+ "No .claude-plugin/marketplace.json, .github/plugin/marketplace.json, or .claude-plugin/plugin.json found in this directory."
17888
18285
  );
17889
18286
  deps.exit(1);
17890
18287
  return;
17891
18288
  }
18289
+ const targetVendor = ctx.vendor === "copilot" ? "github" : "anthropic";
17892
18290
  const pluginName = args2.packageSlug.packageSlug;
17893
18291
  const packageSlug = displayableParsedPackageSlug(args2.packageSlug);
17894
18292
  const { gitRemoteUrl, gitBranch } = await resolveGitContext(
@@ -17897,7 +18295,16 @@ async function renderPluginHandler(args2, deps) {
17897
18295
  );
17898
18296
  if (ctx.mode === "marketplace") {
17899
18297
  const manifestPath = ctx.manifestPath;
17900
- const marketplace = readMarketplace(manifestPath);
18298
+ let marketplace;
18299
+ try {
18300
+ marketplace = readMarketplace(manifestPath);
18301
+ } catch {
18302
+ deps.error(
18303
+ `${manifestPath} is not valid JSON. Fix the file and try again.`
18304
+ );
18305
+ deps.exit(1);
18306
+ return;
18307
+ }
17901
18308
  const existing = findPluginEntry(marketplace, pluginName);
17902
18309
  if (existing) {
17903
18310
  if (classifySource(existing.source) === "remote") {
@@ -17923,7 +18330,8 @@ async function renderPluginHandler(args2, deps) {
17923
18330
  pluginRoot: existingPluginRoot,
17924
18331
  pluginName,
17925
18332
  gitRemoteUrl,
17926
- gitBranch
18333
+ gitBranch,
18334
+ targetVendor
17927
18335
  });
17928
18336
  writeFiles(cwd, response2.files);
17929
18337
  const nextEntry = {
@@ -17946,7 +18354,8 @@ async function renderPluginHandler(args2, deps) {
17946
18354
  pluginRoot,
17947
18355
  pluginName,
17948
18356
  gitRemoteUrl,
17949
- gitBranch
18357
+ gitBranch,
18358
+ targetVendor
17950
18359
  });
17951
18360
  writeFiles(cwd, response.files);
17952
18361
  const updated = upsertPluginEntry(marketplace, {
@@ -17957,13 +18366,15 @@ async function renderPluginHandler(args2, deps) {
17957
18366
  writeMarketplace(manifestPath, updated);
17958
18367
  deps.log(`Rendered ${response.files.length} files into ./${pluginRoot}`);
17959
18368
  reportSkippedStandards(deps, response.skippedStandardsCount);
17960
- deps.log("Updated .claude-plugin/marketplace.json");
18369
+ deps.log(`Updated ${(0, import_path6.relative)(cwd, manifestPath)}`);
17961
18370
  deps.exit(0);
17962
18371
  return;
17963
18372
  }
17964
18373
  if (ctx.mode === "standalone") {
17965
18374
  const manifestPath = ctx.manifestPath;
17966
- const manifest = JSON.parse((0, import_fs22.readFileSync)(manifestPath, "utf8"));
18375
+ const manifest = JSON.parse(
18376
+ stripBom((0, import_fs22.readFileSync)(manifestPath, "utf8"))
18377
+ );
17967
18378
  if (manifest.name !== pluginName) {
17968
18379
  deps.error(`The plugin '${pluginName}' is not handled in this repo.`);
17969
18380
  deps.exit(1);
@@ -17983,7 +18394,8 @@ async function renderPluginHandler(args2, deps) {
17983
18394
  pluginRoot: "/",
17984
18395
  pluginName,
17985
18396
  gitRemoteUrl,
17986
- gitBranch
18397
+ gitBranch,
18398
+ targetVendor
17987
18399
  });
17988
18400
  writeFiles(cwd, response.files);
17989
18401
  deps.log(`Re-rendered ${response.files.length} files into ./`);
@@ -17995,7 +18407,7 @@ async function renderPluginHandler(args2, deps) {
17995
18407
  function reportSkippedStandards(deps, skippedStandardsCount) {
17996
18408
  if (skippedStandardsCount > 0) {
17997
18409
  deps.log(
17998
- `Skipped ${skippedStandardsCount} standards (not supported in Claude plugins).`
18410
+ `Skipped ${skippedStandardsCount} standards (not supported in plugins).`
17999
18411
  );
18000
18412
  }
18001
18413
  }
@@ -18026,7 +18438,7 @@ async function confirmOverwrite(message) {
18026
18438
  // apps/cli/src/infra/commands/plugins/RenderPluginCommand.ts
18027
18439
  var renderPluginCommand = (0, import_cmd_ts20.command)({
18028
18440
  name: "render",
18029
- description: "Render a Packmind package as a Claude plugin",
18441
+ description: "Render a Packmind package as a Claude Code or GitHub Copilot plugin",
18030
18442
  args: {
18031
18443
  packageSlug: (0, import_cmd_ts20.positional)({
18032
18444
  type: PackageSlugArgType,
@@ -18062,7 +18474,7 @@ async function deletePluginHandler(args2, deps) {
18062
18474
  const ctx = detectPluginMode(cwd);
18063
18475
  if (ctx.mode === "none") {
18064
18476
  deps.error(
18065
- "No .claude-plugin/marketplace.json or .claude-plugin/plugin.json found in this directory."
18477
+ "No .claude-plugin/marketplace.json, .github/plugin/marketplace.json, or .claude-plugin/plugin.json found in this directory."
18066
18478
  );
18067
18479
  deps.exit(1);
18068
18480
  return;
@@ -18106,7 +18518,9 @@ async function deletePluginHandler(args2, deps) {
18106
18518
  }
18107
18519
  if (ctx.mode === "standalone") {
18108
18520
  const manifestPath = ctx.manifestPath;
18109
- const manifest = JSON.parse((0, import_fs23.readFileSync)(manifestPath, "utf8"));
18521
+ const manifest = JSON.parse(
18522
+ stripBom((0, import_fs23.readFileSync)(manifestPath, "utf8"))
18523
+ );
18110
18524
  if (manifest.name !== pluginName) {
18111
18525
  deps.error(`The plugin '${pluginName}' is not handled in this repo.`);
18112
18526
  deps.exit(1);
@@ -18170,7 +18584,7 @@ var deletePluginCommand = (0, import_cmd_ts21.command)({
18170
18584
  // apps/cli/src/infra/commands/PluginsCommand.ts
18171
18585
  var pluginsCommand = (0, import_cmd_ts22.subcommands)({
18172
18586
  name: "plugins",
18173
- description: "Render Packmind packages as Claude plugins",
18587
+ description: "Render Packmind packages as Claude Code or GitHub Copilot plugins",
18174
18588
  cmds: {
18175
18589
  render: renderPluginCommand,
18176
18590
  delete: deletePluginCommand
@@ -19196,7 +19610,7 @@ ${formatSpaceList(allSpaces)}`
19196
19610
  message: `Multiple spaces found. Use --space to specify the target space:
19197
19611
  ${formatSpaceList(allSpaces)}
19198
19612
 
19199
- Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19613
+ Example: ${EXEC_NAME} playbook add --space ${allSpaces[0].slug} <path>`
19200
19614
  };
19201
19615
  }
19202
19616
  }
@@ -19215,7 +19629,7 @@ Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19215
19629
  status: "failed",
19216
19630
  filePath,
19217
19631
  message: `Cannot add this ${artifactType}: it is rendered for the "${codingAgent}" agent, which is not in your configured agents (${earlyLockFile.agents.join(", ")}).
19218
- 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.`
19632
+ This file is no longer managed by Packmind. Re-add "${codingAgent}" to your agents and run ${formatLabel(`${EXEC_NAME} install`)} to manage it again, or delete the file if it is no longer needed.`
19219
19633
  };
19220
19634
  }
19221
19635
  if (changeType === "updated" && existingLockEntry) {
@@ -19231,7 +19645,7 @@ This file is no longer managed by Packmind. Re-add "${codingAgent}" to your agen
19231
19645
  status: "failed",
19232
19646
  filePath,
19233
19647
  message: `"${artifactName}" is outdated (local: v${existingLockEntry.version}, remote: v${remoteVersion}).
19234
- Run ${formatLabel("packmind-cli install")} to update before making changes.`
19648
+ Run ${formatLabel(`${EXEC_NAME} install`)} to update before making changes.`
19235
19649
  };
19236
19650
  }
19237
19651
  } catch (err) {
@@ -19356,7 +19770,7 @@ async function playbookAddHandler(deps) {
19356
19770
  const { filePaths, exit, ...rest } = deps;
19357
19771
  if (filePaths.length === 0) {
19358
19772
  logErrorConsole(
19359
- "No path provided. Usage: packmind-cli playbook add <paths...>"
19773
+ `No path provided. Usage: ${EXEC_NAME} playbook add <paths...>`
19360
19774
  );
19361
19775
  exit(1);
19362
19776
  return;
@@ -19378,7 +19792,7 @@ async function playbookAddHandler(deps) {
19378
19792
  }
19379
19793
  if (stagedCount > 0) {
19380
19794
  logInfoConsole(
19381
- `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
19795
+ `Run ${formatLabel(`${EXEC_NAME} playbook submit`)} when you're ready to publish your changes.`
19382
19796
  );
19383
19797
  }
19384
19798
  exit(failedCount > 0 ? 1 : 0);
@@ -19450,7 +19864,7 @@ async function playbookRmHandler(deps) {
19450
19864
  } = deps;
19451
19865
  if (!filePath) {
19452
19866
  logErrorConsole(
19453
- "Missing file path. Usage: packmind-cli playbook rm <path>"
19867
+ `Missing file path. Usage: ${EXEC_NAME} playbook rm <path>`
19454
19868
  );
19455
19869
  exit(1);
19456
19870
  return;
@@ -19494,7 +19908,7 @@ async function playbookRmHandler(deps) {
19494
19908
  const codingAgent = lockResult.file.agent;
19495
19909
  if (artifactType === "skill" && isSkillSupportFile(absolutePath)) {
19496
19910
  logErrorConsole(
19497
- "Cannot remove an individual skill file. Point to the skill folder to remove the full skill, or manually delete the file and run `packmind playbook add <skill-folder>/` to stage the change."
19911
+ `Cannot remove an individual skill file. Point to the skill folder to remove the full skill, or manually delete the file and run \`${EXEC_NAME} playbook add <skill-folder>/\` to stage the change.`
19498
19912
  );
19499
19913
  exit(1);
19500
19914
  return;
@@ -19602,7 +20016,7 @@ async function playbookUnstageHandler(deps) {
19602
20016
  } = deps;
19603
20017
  if (!filePath) {
19604
20018
  logErrorConsole(
19605
- "Missing file path. Usage: packmind playbook unstage <path>"
20019
+ `Missing file path. Usage: ${EXEC_NAME} playbook unstage <path>`
19606
20020
  );
19607
20021
  exit(1);
19608
20022
  return;
@@ -19966,7 +20380,7 @@ async function playbookStatusHandler(deps) {
19966
20380
  );
19967
20381
  }
19968
20382
  logConsole("");
19969
- logConsole("Use `packmind playbook submit` to send them");
20383
+ logConsole(`Use \`${EXEC_NAME} playbook submit\` to send them`);
19970
20384
  }
19971
20385
  if (groupedUntracked.length > 0) {
19972
20386
  if (groupedStaged.length > 0) {
@@ -19981,7 +20395,7 @@ async function playbookStatusHandler(deps) {
19981
20395
  );
19982
20396
  }
19983
20397
  logConsole("");
19984
- logConsole("Use `packmind playbook add <path>` to track them");
20398
+ logConsole(`Use \`${EXEC_NAME} playbook add <path>\` to track them`);
19985
20399
  }
19986
20400
  if (groupedStaged.length === 0 && groupedUntracked.length === 0) {
19987
20401
  logConsole("No changes detected.");
@@ -20692,7 +21106,7 @@ async function buildProposals(changes, getTargetContext) {
20692
21106
  );
20693
21107
  if (!deployedContent && (entry.artifactType === "standard" || entry.artifactType === "command")) {
20694
21108
  logWarningConsole(
20695
- `Skipping "${entry.artifactName}" \u2014 deployed content unavailable. Run \`packmind pull\` to sync before submitting updates.`
21109
+ `Skipping "${entry.artifactName}" \u2014 deployed content unavailable. Run \`${EXEC_NAME} pull\` to sync before submitting updates.`
20696
21110
  );
20697
21111
  skipped.push(toSkippedEntry(entry, "deployed content unavailable"));
20698
21112
  continue;
@@ -20796,20 +21210,20 @@ function logPackageAddGuidance(created, packageSlugs) {
20796
21210
  logInfoConsole("To add the created artifact to a package, run:");
20797
21211
  if (standards.length === 1) {
20798
21212
  logInfoConsole(
20799
- ` ${formatCommand(`\`packmind-cli packages add --to ${pkgPlaceholder} --standard ${standards[0].slug}\``)}`
21213
+ ` ${formatCommand(`\`${EXEC_NAME} packages add --to ${pkgPlaceholder} --standard ${standards[0].slug}\``)}`
20800
21214
  );
20801
21215
  } else if (commands.length === 1) {
20802
21216
  logInfoConsole(
20803
- ` ${formatCommand(`\`packmind-cli packages add --to ${pkgPlaceholder} --command ${commands[0].slug}\``)}`
21217
+ ` ${formatCommand(`\`${EXEC_NAME} packages add --to ${pkgPlaceholder} --command ${commands[0].slug}\``)}`
20804
21218
  );
20805
21219
  } else if (skills.length === 1) {
20806
21220
  logInfoConsole(
20807
- ` ${formatCommand(`\`packmind-cli packages add --to ${pkgPlaceholder} --skill ${skills[0].slug}\``)}`
21221
+ ` ${formatCommand(`\`${EXEC_NAME} packages add --to ${pkgPlaceholder} --skill ${skills[0].slug}\``)}`
20808
21222
  );
20809
21223
  }
20810
21224
  } else {
20811
21225
  logInfoConsole(
20812
- `To add the created artifacts to a package, use ${formatCommand(`\`packmind-cli packages add --to ${pkgPlaceholder} --standard <artifact-slug>\``)} for each artifact.`
21226
+ `To add the created artifacts to a package, use ${formatCommand(`\`${EXEC_NAME} packages add --to ${pkgPlaceholder} --standard <artifact-slug>\``)} for each artifact.`
20813
21227
  );
20814
21228
  }
20815
21229
  if (packageSlugs.length > 1) {
@@ -20927,7 +21341,7 @@ async function playbookSubmitHandler(deps) {
20927
21341
  const reportSkippedConflicts = () => {
20928
21342
  if (conflictCount === 0) return;
20929
21343
  logInfoConsole(
20930
- `${conflictCount} change${conflictCount !== 1 ? "s were" : " was"} skipped and remain${conflictCount !== 1 ? "" : "s"} staged. Rename them and run \`packmind playbook submit\` again.`
21344
+ `${conflictCount} change${conflictCount !== 1 ? "s were" : " was"} skipped and remain${conflictCount !== 1 ? "" : "s"} staged. Rename them and run \`${EXEC_NAME} playbook submit\` again.`
20931
21345
  );
20932
21346
  };
20933
21347
  if (submittableChanges.length === 0) {
@@ -21002,7 +21416,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21002
21416
  );
21003
21417
  }
21004
21418
  logInfoConsole(
21005
- "Your staged changes were kept. Fix the issue above (for stale deployed content, run `packmind pull` to sync), or drop the affected change with `packmind playbook unstage <path>`, then retry."
21419
+ `Your staged changes were kept. Fix the issue above (for stale deployed content, run \`${EXEC_NAME} pull\` to sync), or drop the affected change with \`${EXEC_NAME} playbook unstage <path>\`, then retry.`
21006
21420
  );
21007
21421
  exit(1);
21008
21422
  return;
@@ -21068,7 +21482,8 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21068
21482
  if (err.statusCode === 422) {
21069
21483
  logErrorConsole("Failed to apply changes: a conflict was detected.");
21070
21484
  logInfoConsole(
21071
- "This usually means the artifact was modified since your last pull.\nRun `packmind pull` to sync your local state, then retry."
21485
+ `This usually means the artifact was modified since your last pull.
21486
+ Run \`${EXEC_NAME} pull\` to sync your local state, then retry.`
21072
21487
  );
21073
21488
  } else {
21074
21489
  logErrorConsole(`Failed to apply changes: ${err.message}`);
@@ -21150,7 +21565,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21150
21565
  if (isCommunityEditionError(error)) {
21151
21566
  logErrorConsole(error.message);
21152
21567
  logInfoConsole(
21153
- `Run ${formatCommand("`packmind-cli playbook submit --no-review`")} to apply changes directly.`
21568
+ `Run ${formatCommand(`\`${EXEC_NAME} playbook submit --no-review\``)} to apply changes directly.`
21154
21569
  );
21155
21570
  exit(1);
21156
21571
  return;
@@ -21229,7 +21644,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21229
21644
  }
21230
21645
  if (succeededSpaces.length > 0) {
21231
21646
  logWarningConsole(
21232
- `Submitted to: ${succeededSpaces.map(displaySpace2).join(", ")}. Run 'packmind playbook submit' again to retry failed spaces.`
21647
+ `Submitted to: ${succeededSpaces.map(displaySpace2).join(", ")}. Run '${EXEC_NAME} playbook submit' again to retry failed spaces.`
21233
21648
  );
21234
21649
  }
21235
21650
  exit(1);
@@ -21532,7 +21947,7 @@ function formatSubmittedDate(isoDate) {
21532
21947
  function buildSubmittedFooter(submittedDiffs) {
21533
21948
  const proposalCount = submittedDiffs.length;
21534
21949
  const proposalWord = proposalCount === 1 ? "change proposal" : "change proposals";
21535
- return `${proposalCount} ${proposalWord} ignored, run \`packmind-cli diff --include-submitted\` to see what's waiting for validation`;
21950
+ return `${proposalCount} ${proposalWord} ignored, run \`${EXEC_NAME} playbook diff --include-submitted\` to see what's waiting for validation`;
21536
21951
  }
21537
21952
  async function findTargetDirectories(searchPath, packmindCliHexa) {
21538
21953
  const targets = [];
@@ -22002,7 +22417,7 @@ for these file(s). After this change:
22002
22417
  - Organization-level settings will NO LONGER apply to these file(s).
22003
22418
  - Any future changes to organization agents will NOT affect these file(s).
22004
22419
 
22005
- To restore organization settings later, remove all local agents with: packmind-cli config agents rm <agent1> <agent2> ...`;
22420
+ To restore organization settings later, remove all local agents with: ${EXEC_NAME} config agents rm <agent1> <agent2> ...`;
22006
22421
  logWarningConsole(message);
22007
22422
  const confirmed = await deps.promptConfirm("Do you want to proceed?");
22008
22423
  if (!confirmed) {
@@ -22032,7 +22447,7 @@ To restore organization settings later, remove all local agents with: packmind-c
22032
22447
  }
22033
22448
  if (anyUpdated) {
22034
22449
  logInfoConsole(
22035
- `Run "${formatCommand("packmind install")}" to apply changes and deploy agent artifacts.`
22450
+ `Run "${formatCommand(`${EXEC_NAME} install`)}" to apply changes and deploy agent artifacts.`
22036
22451
  );
22037
22452
  }
22038
22453
  exit(0);
@@ -22258,7 +22673,7 @@ async function removeAgentsHandler(args2, deps) {
22258
22673
  }
22259
22674
  if (anyUpdated) {
22260
22675
  logInfoConsole(
22261
- `Run "${formatCommand("packmind install")}" to apply changes and remove agent artifacts.`
22676
+ `Run "${formatCommand(`${EXEC_NAME} install`)}" to apply changes and remove agent artifacts.`
22262
22677
  );
22263
22678
  }
22264
22679
  exit(0);
@@ -22376,6 +22791,123 @@ var initCommand = (0, import_cmd_ts38.command)({
22376
22791
  // apps/cli/src/infra/commands/TrackCommand.ts
22377
22792
  var import_cmd_ts39 = __toESM(require_cjs());
22378
22793
 
22794
+ // apps/cli/src/infra/commands/removedCommandHandler.ts
22795
+ function reportRemovedCommand(notifyError, removedCommand, replacementCommand, carriedFlags = []) {
22796
+ notifyError(`Command "${EXEC_NAME} ${removedCommand}" has been removed.`, {
22797
+ content: `Use the "${replacementCommand}" command instead:`,
22798
+ exampleCommand: [
22799
+ `${EXEC_NAME} ${replacementCommand}`,
22800
+ ...carriedFlags
22801
+ ].join(" ")
22802
+ });
22803
+ }
22804
+ function removedTrackHandler(deps) {
22805
+ if (deps.remove) {
22806
+ reportRemovedCommand(deps.notifyError, "track --remove", "git untrack");
22807
+ process.exit(1);
22808
+ return;
22809
+ }
22810
+ const carriedFlags = [];
22811
+ if (deps.update) {
22812
+ carriedFlags.push("--update");
22813
+ }
22814
+ if (deps.branch) {
22815
+ carriedFlags.push(`--branch ${deps.branch}`);
22816
+ }
22817
+ reportRemovedCommand(deps.notifyError, "track", "git track", carriedFlags);
22818
+ process.exit(1);
22819
+ }
22820
+ function removedUntrackHandler(deps) {
22821
+ reportRemovedCommand(deps.notifyError, "untrack", "git untrack");
22822
+ process.exit(1);
22823
+ }
22824
+
22825
+ // apps/cli/src/infra/commands/TrackCommand.ts
22826
+ var trackCommand = (0, import_cmd_ts39.command)({
22827
+ name: "track",
22828
+ // Listed in --help on purpose: a stub nobody can discover cannot redirect
22829
+ // anyone. "[Removed]" matches what running it actually says.
22830
+ description: '[Removed] Use "git track" instead',
22831
+ args: {
22832
+ update: (0, import_cmd_ts39.flag)({
22833
+ long: "update",
22834
+ description: "Move the tracked branch to the current branch (requires an existing tracked branch)"
22835
+ }),
22836
+ branch: (0, import_cmd_ts39.option)({
22837
+ type: (0, import_cmd_ts39.optional)(import_cmd_ts39.string),
22838
+ long: "branch",
22839
+ description: "Branch to track (defaults to the branch currently checked out)"
22840
+ }),
22841
+ // Accepted only so the old removal syntax gets the migration message
22842
+ // instead of a raw "unknown arguments" parser error.
22843
+ remove: (0, import_cmd_ts39.flag)({
22844
+ long: "remove",
22845
+ description: 'Removal now lives in the "git untrack" command'
22846
+ })
22847
+ },
22848
+ handler: async ({ update, branch, remove }) => {
22849
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22850
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22851
+ removedTrackHandler({
22852
+ update,
22853
+ branch,
22854
+ remove,
22855
+ notifyError: packmindCliHexa.output.notifyError.bind(
22856
+ packmindCliHexa.output
22857
+ )
22858
+ });
22859
+ }
22860
+ });
22861
+
22862
+ // apps/cli/src/infra/commands/UntrackCommand.ts
22863
+ var import_cmd_ts40 = __toESM(require_cjs());
22864
+ var untrackCommand = (0, import_cmd_ts40.command)({
22865
+ name: "untrack",
22866
+ description: '[Removed] Use "git untrack" instead',
22867
+ args: {},
22868
+ handler: async () => {
22869
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22870
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22871
+ removedUntrackHandler({
22872
+ notifyError: packmindCliHexa.output.notifyError.bind(
22873
+ packmindCliHexa.output
22874
+ )
22875
+ });
22876
+ }
22877
+ });
22878
+
22879
+ // apps/cli/src/infra/commands/UpdateCommand.ts
22880
+ var import_cmd_ts41 = __toESM(require_cjs());
22881
+ var { version: CLI_VERSION6 } = require_package();
22882
+ var updateCommand = (0, import_cmd_ts41.command)({
22883
+ name: "update",
22884
+ description: `Update ${CANONICAL_EXEC_NAME} to the latest version`,
22885
+ args: {
22886
+ check: (0, import_cmd_ts41.flag)({
22887
+ long: "check",
22888
+ description: "Only check if a newer version is available without performing the update"
22889
+ })
22890
+ },
22891
+ handler: async ({ check }) => {
22892
+ await updateHandler({
22893
+ currentVersion: CLI_VERSION6,
22894
+ isExecutableMode: hasEmbeddedWasmFiles(),
22895
+ executablePath: process.execPath,
22896
+ scriptPath: require.main?.filename,
22897
+ platform: process.platform,
22898
+ arch: process.arch,
22899
+ fetchFn: fetch,
22900
+ checkOnly: check
22901
+ });
22902
+ }
22903
+ });
22904
+
22905
+ // apps/cli/src/infra/commands/git/gitCommand.ts
22906
+ var import_cmd_ts45 = __toESM(require_cjs());
22907
+
22908
+ // apps/cli/src/infra/commands/git/infoCommand.ts
22909
+ var import_cmd_ts42 = __toESM(require_cjs());
22910
+
22379
22911
  // apps/cli/src/infra/commands/trackingErrors.ts
22380
22912
  function handleTrackingError(error) {
22381
22913
  if (error instanceof NotLoggedInError) {
@@ -22401,6 +22933,65 @@ function handleTrackingError(error) {
22401
22933
  process.exit(1);
22402
22934
  }
22403
22935
 
22936
+ // apps/cli/src/infra/commands/trackingInfoHandler.ts
22937
+ async function trackingInfoHandler(deps) {
22938
+ let result;
22939
+ try {
22940
+ result = await deps.getTrackingInfo({ repoPath: deps.baseDirectory });
22941
+ } catch (error) {
22942
+ handleTrackingError(error);
22943
+ return;
22944
+ }
22945
+ if (result.status === "not-tracked") {
22946
+ logInfoConsole(
22947
+ result.currentBranchDetached ? `${result.owner}/${result.repo} is not tracked in Packmind. No branch is checked out here \u2014 run ${formatCommand(
22948
+ `${EXEC_NAME} git track --branch <name>`
22949
+ )} to track one.` : `${result.owner}/${result.repo} is not tracked in Packmind. Run ${formatCommand(
22950
+ `${EXEC_NAME} git track`
22951
+ )} to track branch '${result.currentBranch}'.`
22952
+ );
22953
+ process.exit(0);
22954
+ return;
22955
+ }
22956
+ logInfoConsole(
22957
+ `Packmind tracks ${result.owner}/${result.repo} on branch '${result.trackedBranch}'.`
22958
+ );
22959
+ if (result.currentBranch !== result.trackedBranch) {
22960
+ logWarningConsole(mismatchWarning(result));
22961
+ }
22962
+ process.exit(0);
22963
+ }
22964
+ function mismatchWarning(result) {
22965
+ const moveTracking = result.currentBranchDetached ? `${formatCommand(`${EXEC_NAME} git track --update --branch <name>`)} to move tracking to a branch that exists` : `${formatCommand(`${EXEC_NAME} git track --update`)} to move tracking to '${result.currentBranch}'`;
22966
+ if (!result.trackedBranchExists) {
22967
+ 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(
22968
+ "git fetch"
22969
+ )} if the branch is still on the remote.`;
22970
+ }
22971
+ if (result.currentBranchDetached) {
22972
+ 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}.`;
22973
+ }
22974
+ return `You are on '${result.currentBranch}', so distributions from here are not recorded. Run ${moveTracking}.`;
22975
+ }
22976
+
22977
+ // apps/cli/src/infra/commands/git/infoCommand.ts
22978
+ var infoCommand = (0, import_cmd_ts42.command)({
22979
+ name: "info",
22980
+ description: "Show whether Packmind tracks the current repository, and on which branch",
22981
+ args: {},
22982
+ handler: async () => {
22983
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22984
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22985
+ await trackingInfoHandler({
22986
+ baseDirectory: process.cwd(),
22987
+ getTrackingInfo: packmindCliHexa.getTrackingInfo.bind(packmindCliHexa)
22988
+ });
22989
+ }
22990
+ });
22991
+
22992
+ // apps/cli/src/infra/commands/git/trackCommand.ts
22993
+ var import_cmd_ts43 = __toESM(require_cjs());
22994
+
22404
22995
  // apps/cli/src/infra/commands/trackHandler.ts
22405
22996
  async function trackHandler(deps) {
22406
22997
  const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
@@ -22451,14 +23042,28 @@ async function trackHandler(deps) {
22451
23042
  case "already-tracked-other-branch":
22452
23043
  logErrorConsole(
22453
23044
  `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.trackedBranch}. Run ${formatCommand(
22454
- "packmind track --update"
23045
+ // `--update` alone moves tracking to the checked-out branch, which is
23046
+ // not the target when a branch was named explicitly.
23047
+ deps.branch ? `${EXEC_NAME} git track --update --branch ${result.branch}` : `${EXEC_NAME} git track --update`
22455
23048
  )} to move it to ${result.branch}.`
22456
23049
  );
22457
23050
  process.exit(1);
22458
23051
  return;
23052
+ case "detached-head":
23053
+ logErrorConsole(
23054
+ `No branch is checked out for ${result.owner}/${result.repo} \u2014 HEAD is detached. Check a branch out, or name one with ${formatCommand(`${EXEC_NAME} git track --branch <name>`)}.`
23055
+ );
23056
+ process.exit(1);
23057
+ return;
23058
+ case "branch-not-found":
23059
+ logErrorConsole(
23060
+ `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.`
23061
+ );
23062
+ process.exit(1);
23063
+ return;
22459
23064
  case "nothing-tracked":
22460
23065
  logErrorConsole(
22461
- `Nothing is tracked yet \u2014 run ${formatCommand("packmind init")} or ${formatCommand("packmind track")} to start tracking.`
23066
+ `Nothing is tracked yet \u2014 run ${formatCommand(`${EXEC_NAME} init`)} or ${formatCommand(`${EXEC_NAME} git track`)} to start tracking.`
22462
23067
  );
22463
23068
  process.exit(1);
22464
23069
  return;
@@ -22467,19 +23072,19 @@ async function trackHandler(deps) {
22467
23072
  }
22468
23073
  }
22469
23074
 
22470
- // apps/cli/src/infra/commands/TrackCommand.ts
22471
- var trackCommand = (0, import_cmd_ts39.command)({
23075
+ // apps/cli/src/infra/commands/git/trackCommand.ts
23076
+ var trackCommand2 = (0, import_cmd_ts43.command)({
22472
23077
  name: "track",
22473
23078
  description: "Set the repository and branch Packmind tracks for the current project",
22474
23079
  args: {
22475
- update: (0, import_cmd_ts39.flag)({
23080
+ update: (0, import_cmd_ts43.flag)({
22476
23081
  long: "update",
22477
- description: "Move the tracked branch to the current branch (requires an existing tracked branch)"
23082
+ description: "Move the tracked branch to the checked-out branch, or to --branch when it is given (requires an existing tracked branch)"
22478
23083
  }),
22479
- branch: (0, import_cmd_ts39.option)({
22480
- type: (0, import_cmd_ts39.optional)(import_cmd_ts39.string),
23084
+ branch: (0, import_cmd_ts43.option)({
23085
+ type: (0, import_cmd_ts43.optional)(import_cmd_ts43.string),
22481
23086
  long: "branch",
22482
- description: "Branch to track (defaults to the branch currently checked out)"
23087
+ description: "Branch to track instead of the checked-out one; combines with --update to move tracking to it"
22483
23088
  })
22484
23089
  },
22485
23090
  handler: async ({ update, branch }) => {
@@ -22494,8 +23099,8 @@ var trackCommand = (0, import_cmd_ts39.command)({
22494
23099
  }
22495
23100
  });
22496
23101
 
22497
- // apps/cli/src/infra/commands/UntrackCommand.ts
22498
- var import_cmd_ts40 = __toESM(require_cjs());
23102
+ // apps/cli/src/infra/commands/git/untrackCommand.ts
23103
+ var import_cmd_ts44 = __toESM(require_cjs());
22499
23104
 
22500
23105
  // apps/cli/src/infra/commands/untrackHandler.ts
22501
23106
  async function untrackHandler(deps) {
@@ -22537,8 +23142,8 @@ async function untrackHandler(deps) {
22537
23142
  }
22538
23143
  }
22539
23144
 
22540
- // apps/cli/src/infra/commands/UntrackCommand.ts
22541
- var untrackCommand = (0, import_cmd_ts40.command)({
23145
+ // apps/cli/src/infra/commands/git/untrackCommand.ts
23146
+ var untrackCommand2 = (0, import_cmd_ts44.command)({
22542
23147
  name: "untrack",
22543
23148
  description: "Remove Packmind's tracking of the current repository (keeps every recorded distribution)",
22544
23149
  args: {},
@@ -22552,33 +23157,28 @@ var untrackCommand = (0, import_cmd_ts40.command)({
22552
23157
  }
22553
23158
  });
22554
23159
 
22555
- // apps/cli/src/infra/commands/UpdateCommand.ts
22556
- var import_cmd_ts41 = __toESM(require_cjs());
22557
- var { version: CLI_VERSION6 } = require_package();
22558
- var updateCommand = (0, import_cmd_ts41.command)({
22559
- name: "update",
22560
- description: "Update packmind-cli to the latest version",
22561
- args: {
22562
- check: (0, import_cmd_ts41.flag)({
22563
- long: "check",
22564
- description: "Only check if a newer version is available without performing the update"
22565
- })
22566
- },
22567
- handler: async ({ check }) => {
22568
- await updateHandler({
22569
- currentVersion: CLI_VERSION6,
22570
- isExecutableMode: hasEmbeddedWasmFiles(),
22571
- executablePath: process.execPath,
22572
- scriptPath: require.main?.filename,
22573
- platform: process.platform,
22574
- arch: process.arch,
22575
- fetchFn: fetch,
22576
- checkOnly: check
22577
- });
23160
+ // apps/cli/src/infra/commands/git/gitCommand.ts
23161
+ var gitCommand = (0, import_cmd_ts45.subcommands)({
23162
+ name: "git",
23163
+ description: "Manage repository tracking in Packmind",
23164
+ cmds: {
23165
+ info: infoCommand,
23166
+ track: trackCommand2,
23167
+ untrack: untrackCommand2
22578
23168
  }
22579
23169
  });
22580
23170
 
23171
+ // apps/cli/src/infra/commands/legacyExecNameWarning.ts
23172
+ var LEGACY_EXEC_NAME_WARNING = `\`${LEGACY_EXEC_NAME}\` is deprecated and will stop receiving updates. Use \`${CANONICAL_EXEC_NAME}\` instead.`;
23173
+ function warnOnLegacyExecName(argv = process.argv, logWarning = logWarningConsole) {
23174
+ if (!isLegacyExecName(argv)) {
23175
+ return;
23176
+ }
23177
+ logWarning(LEGACY_EXEC_NAME_WARNING);
23178
+ }
23179
+
22581
23180
  // apps/cli/src/main.ts
23181
+ warnOnLegacyExecName();
22582
23182
  var { version: CLI_VERSION7 } = require_package();
22583
23183
  function findEnvFile() {
22584
23184
  const currentDir = process.cwd();
@@ -22614,15 +23214,16 @@ if (hasEmbeddedWasmFiles()) {
22614
23214
  }
22615
23215
  var args = process.argv.slice(2);
22616
23216
  if (args.includes("--version") || args.includes("-v")) {
22617
- logConsole(`packmind-cli version ${CLI_VERSION7}`);
23217
+ logConsole(`${EXEC_NAME} version ${CLI_VERSION7}`);
22618
23218
  process.exit(0);
22619
23219
  }
22620
- var app = (0, import_cmd_ts42.subcommands)({
22621
- name: "packmind-cli",
23220
+ var app = (0, import_cmd_ts46.subcommands)({
23221
+ name: EXEC_NAME,
22622
23222
  description: "Packmind CLI tool",
22623
23223
  cmds: {
22624
23224
  commands: commandsCommand,
22625
23225
  config: configCommand,
23226
+ git: gitCommand,
22626
23227
  init: initCommand,
22627
23228
  install: installCommand,
22628
23229
  lint: lintCommand,
@@ -22641,7 +23242,7 @@ var app = (0, import_cmd_ts42.subcommands)({
22641
23242
  whoami: whoamiCommand
22642
23243
  }
22643
23244
  });
22644
- (0, import_cmd_ts42.run)(app, args).catch((error) => {
23245
+ (0, import_cmd_ts46.run)(app, args).catch((error) => {
22645
23246
  logErrorConsole(error.message);
22646
23247
  process.exit(1);
22647
23248
  });