@packmind/cli 0.32.0 → 0.33.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 +781 -521
  2. package/package.json +3 -3
package/main.cjs CHANGED
@@ -380,32 +380,32 @@ var init_supports_color = __esm({
380
380
  });
381
381
 
382
382
  // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
383
- function stringReplaceAll(string16, substring, replacer) {
384
- let index = string16.indexOf(substring);
383
+ function stringReplaceAll(string17, substring, replacer) {
384
+ let index = string17.indexOf(substring);
385
385
  if (index === -1) {
386
- return string16;
386
+ return string17;
387
387
  }
388
388
  const substringLength = substring.length;
389
389
  let endIndex = 0;
390
390
  let returnValue = "";
391
391
  do {
392
- returnValue += string16.slice(endIndex, index) + substring + replacer;
392
+ returnValue += string17.slice(endIndex, index) + substring + replacer;
393
393
  endIndex = index + substringLength;
394
- index = string16.indexOf(substring, endIndex);
394
+ index = string17.indexOf(substring, endIndex);
395
395
  } while (index !== -1);
396
- returnValue += string16.slice(endIndex);
396
+ returnValue += string17.slice(endIndex);
397
397
  return returnValue;
398
398
  }
399
- function stringEncaseCRLFWithFirstIndex(string16, prefix, postfix, index) {
399
+ function stringEncaseCRLFWithFirstIndex(string17, prefix, postfix, index) {
400
400
  let endIndex = 0;
401
401
  let returnValue = "";
402
402
  do {
403
- const gotCR = string16[index - 1] === "\r";
404
- returnValue += string16.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
403
+ const gotCR = string17[index - 1] === "\r";
404
+ returnValue += string17.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
405
405
  endIndex = index + 1;
406
- index = string16.indexOf("\n", endIndex);
406
+ index = string17.indexOf("\n", endIndex);
407
407
  } while (index !== -1);
408
- returnValue += string16.slice(endIndex);
408
+ returnValue += string17.slice(endIndex);
409
409
  return returnValue;
410
410
  }
411
411
  var init_utilities = __esm({
@@ -564,26 +564,26 @@ var init_source = __esm({
564
564
  builder[IS_EMPTY] = _isEmpty;
565
565
  return builder;
566
566
  };
567
- applyStyle = (self, string16) => {
568
- if (self.level <= 0 || !string16) {
569
- return self[IS_EMPTY] ? "" : string16;
567
+ applyStyle = (self, string17) => {
568
+ if (self.level <= 0 || !string17) {
569
+ return self[IS_EMPTY] ? "" : string17;
570
570
  }
571
571
  let styler = self[STYLER];
572
572
  if (styler === void 0) {
573
- return string16;
573
+ return string17;
574
574
  }
575
575
  const { openAll, closeAll } = styler;
576
- if (string16.includes("\x1B")) {
576
+ if (string17.includes("\x1B")) {
577
577
  while (styler !== void 0) {
578
- string16 = stringReplaceAll(string16, styler.close, styler.open);
578
+ string17 = stringReplaceAll(string17, styler.close, styler.open);
579
579
  styler = styler.parent;
580
580
  }
581
581
  }
582
- const lfIndex = string16.indexOf("\n");
582
+ const lfIndex = string17.indexOf("\n");
583
583
  if (lfIndex !== -1) {
584
- string16 = stringEncaseCRLFWithFirstIndex(string16, closeAll, openAll, lfIndex);
584
+ string17 = stringEncaseCRLFWithFirstIndex(string17, closeAll, openAll, lfIndex);
585
585
  }
586
- return openAll + string16 + closeAll;
586
+ return openAll + string17 + closeAll;
587
587
  };
588
588
  Object.defineProperties(createChalk.prototype, styles2);
589
589
  chalk = createChalk();
@@ -776,9 +776,9 @@ var require_findOption = __commonJS({
776
776
  continue;
777
777
  }
778
778
  if (node.type === "shortOptions" && opts.shortNames.length) {
779
- for (const option18 of node.options) {
780
- if (opts.shortNames.includes(option18.key)) {
781
- result.push(option18);
779
+ for (const option19 of node.options) {
780
+ if (opts.shortNames.includes(option19.key)) {
781
+ result.push(option19);
782
782
  }
783
783
  }
784
784
  }
@@ -851,7 +851,7 @@ var require_types = __commonJS({
851
851
  "use strict";
852
852
  Object.defineProperty(exports2, "__esModule", { value: true });
853
853
  exports2.boolean = exports2.string = exports2.number = void 0;
854
- exports2.optional = optional13;
854
+ exports2.optional = optional14;
855
855
  exports2.array = array2;
856
856
  var type_1 = require_type();
857
857
  exports2.number = {
@@ -878,7 +878,7 @@ var require_types = __commonJS({
878
878
  return false;
879
879
  }
880
880
  };
881
- function optional13(t) {
881
+ function optional14(t) {
882
882
  return {
883
883
  ...t,
884
884
  defaultValue() {
@@ -1264,7 +1264,7 @@ var require_positional = __commonJS({
1264
1264
  return mod && mod.__esModule ? mod : { "default": mod };
1265
1265
  };
1266
1266
  Object.defineProperty(exports2, "__esModule", { value: true });
1267
- exports2.positional = positional9;
1267
+ exports2.positional = positional8;
1268
1268
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1269
1269
  var Result = __importStar(require_Result());
1270
1270
  var types_1 = require_types();
@@ -1304,8 +1304,8 @@ var require_positional = __commonJS({
1304
1304
  var _a2;
1305
1305
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
1306
1306
  const defaultValueFn = (_a2 = config.defaultValue) !== null && _a2 !== void 0 ? _a2 : config.type.defaultValue;
1307
- const positional10 = positionals[0];
1308
- if (!positional10) {
1307
+ const positional9 = positionals[0];
1308
+ if (!positional9) {
1309
1309
  if (defaultValueFn) {
1310
1310
  return Result.ok(defaultValueFn());
1311
1311
  }
@@ -1318,13 +1318,13 @@ var require_positional = __commonJS({
1318
1318
  ]
1319
1319
  });
1320
1320
  }
1321
- visitedNodes.add(positional10);
1322
- const decoded = await Result.safeAsync(config.type.from(positional10.raw));
1321
+ visitedNodes.add(positional9);
1322
+ const decoded = await Result.safeAsync(config.type.from(positional9.raw));
1323
1323
  if (Result.isErr(decoded)) {
1324
1324
  return Result.err({
1325
1325
  errors: [
1326
1326
  {
1327
- nodes: [positional10],
1327
+ nodes: [positional9],
1328
1328
  message: decoded.error.message
1329
1329
  }
1330
1330
  ]
@@ -1334,7 +1334,7 @@ var require_positional = __commonJS({
1334
1334
  }
1335
1335
  };
1336
1336
  }
1337
- function positional9(config) {
1337
+ function positional8(config) {
1338
1338
  return fullPositional({
1339
1339
  type: types_1.string,
1340
1340
  ...config
@@ -1412,9 +1412,9 @@ var require_subcommands = __commonJS({
1412
1412
  let errorMessage = "Not a valid subcommand name";
1413
1413
  const closeOptions = (0, didyoumean_1.default)(str, flatMap(commands, (x) => x.names));
1414
1414
  if (closeOptions) {
1415
- const option18 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
1415
+ const option19 = Array.isArray(closeOptions) ? closeOptions[0] : closeOptions;
1416
1416
  errorMessage += `
1417
- Did you mean ${chalk_1.default.italic(option18)}?`;
1417
+ Did you mean ${chalk_1.default.italic(option19)}?`;
1418
1418
  }
1419
1419
  throw new Error(errorMessage);
1420
1420
  }
@@ -1587,14 +1587,14 @@ var strip_ansi_exports = {};
1587
1587
  __export(strip_ansi_exports, {
1588
1588
  default: () => stripAnsi
1589
1589
  });
1590
- function stripAnsi(string16) {
1591
- if (typeof string16 !== "string") {
1592
- throw new TypeError(`Expected a \`string\`, got \`${typeof string16}\``);
1590
+ function stripAnsi(string17) {
1591
+ if (typeof string17 !== "string") {
1592
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string17}\``);
1593
1593
  }
1594
- if (!string16.includes("\x1B") && !string16.includes("\x9B")) {
1595
- return string16;
1594
+ if (!string17.includes("\x1B") && !string17.includes("\x9B")) {
1595
+ return string17;
1596
1596
  }
1597
- return string16.replace(regex, "");
1597
+ return string17.replace(regex, "");
1598
1598
  }
1599
1599
  var regex;
1600
1600
  var init_strip_ansi = __esm({
@@ -1710,12 +1710,12 @@ var require_command = __commonJS({
1710
1710
  return mod && mod.__esModule ? mod : { "default": mod };
1711
1711
  };
1712
1712
  Object.defineProperty(exports2, "__esModule", { value: true });
1713
- exports2.command = command31;
1713
+ exports2.command = command32;
1714
1714
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1715
1715
  var Result = __importStar(require_Result());
1716
1716
  var circuitbreaker_1 = require_circuitbreaker();
1717
1717
  var utils_1 = require_utils();
1718
- function command31(config) {
1718
+ function command32(config) {
1719
1719
  const argEntries = (0, utils_1.entries)(config.args);
1720
1720
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1721
1721
  return {
@@ -1793,11 +1793,11 @@ var require_command = __commonJS({
1793
1793
  }
1794
1794
  if (node.type === "forcePositional") {
1795
1795
  } else if (node.type === "shortOptions") {
1796
- for (const option18 of node.options) {
1797
- if (context.visitedNodes.has(option18)) {
1796
+ for (const option19 of node.options) {
1797
+ if (context.visitedNodes.has(option19)) {
1798
1798
  continue;
1799
1799
  }
1800
- unknownArguments.push(option18);
1800
+ unknownArguments.push(option19);
1801
1801
  }
1802
1802
  } else {
1803
1803
  unknownArguments.push(node);
@@ -1876,7 +1876,7 @@ var require_option = __commonJS({
1876
1876
  return mod && mod.__esModule ? mod : { "default": mod };
1877
1877
  };
1878
1878
  Object.defineProperty(exports2, "__esModule", { value: true });
1879
- exports2.option = option18;
1879
+ exports2.option = option19;
1880
1880
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1881
1881
  var Result = __importStar(require_Result());
1882
1882
  var findOption_1 = require_findOption();
@@ -1952,11 +1952,11 @@ var require_option = __commonJS({
1952
1952
  const valueFromEnv = config.env ? process.env[config.env] : void 0;
1953
1953
  const defaultValueFn = config.defaultValue || config.type.defaultValue;
1954
1954
  const onMissingFn = config.onMissing || config.type.onMissing;
1955
- const option19 = options[0];
1955
+ const option20 = options[0];
1956
1956
  let rawValue;
1957
1957
  let envPrefix = "";
1958
- if (option19 === null || option19 === void 0 ? void 0 : option19.value) {
1959
- rawValue = option19.value.node.raw;
1958
+ if (option20 === null || option20 === void 0 ? void 0 : option20.value) {
1959
+ rawValue = option20.value.node.raw;
1960
1960
  } else if (valueFromEnv !== void 0) {
1961
1961
  rawValue = valueFromEnv;
1962
1962
  envPrefix = `env[${chalk_1.default.italic(config.env)}]: `;
@@ -1991,7 +1991,7 @@ var require_option = __commonJS({
1991
1991
  });
1992
1992
  }
1993
1993
  } else {
1994
- const raw = (option19 === null || option19 === void 0 ? void 0 : option19.type) === "shortOption" ? `-${option19 === null || option19 === void 0 ? void 0 : option19.key}` : `--${config.long}`;
1994
+ const raw = (option20 === null || option20 === void 0 ? void 0 : option20.type) === "shortOption" ? `-${option20 === null || option20 === void 0 ? void 0 : option20.key}` : `--${config.long}`;
1995
1995
  return Result.err({
1996
1996
  errors: [
1997
1997
  {
@@ -2013,7 +2013,7 @@ var require_option = __commonJS({
2013
2013
  }
2014
2014
  };
2015
2015
  }
2016
- function option18(config) {
2016
+ function option19(config) {
2017
2017
  return fullOption({
2018
2018
  type: types_1.string,
2019
2019
  ...config
@@ -2052,12 +2052,12 @@ var require_errorBox = __commonJS({
2052
2052
  if (node.type === "shortOptions") {
2053
2053
  let failed = false;
2054
2054
  let s = "";
2055
- for (const option18 of node.options) {
2056
- if (error.nodes.includes(option18)) {
2057
- s += chalk_1.default.red(option18.raw);
2055
+ for (const option19 of node.options) {
2056
+ if (error.nodes.includes(option19)) {
2057
+ s += chalk_1.default.red(option19.raw);
2058
2058
  failed = true;
2059
2059
  } else {
2060
- s += chalk_1.default.dim(option18.raw);
2060
+ s += chalk_1.default.dim(option19.raw);
2061
2061
  }
2062
2062
  }
2063
2063
  const prefix = failed ? chalk_1.default.red("-") : chalk_1.default.dim("-");
@@ -3090,8 +3090,8 @@ var require_tokenizer = __commonJS({
3090
3090
  tokens.push(token);
3091
3091
  overallIndex += token.raw.length;
3092
3092
  };
3093
- for (const [stringIndex, string16] of (0, utils_1.enumerate)(strings)) {
3094
- const chars = [...string16];
3093
+ for (const [stringIndex, string17] of (0, utils_1.enumerate)(strings)) {
3094
+ const chars = [...string17];
3095
3095
  for (let i = 0; i < chars.length; i++) {
3096
3096
  if (chars[i] === "-" && chars[i + 1] === "-") {
3097
3097
  push({ type: "longPrefix", raw: "--", index: overallIndex });
@@ -3224,7 +3224,7 @@ var require_restPositionals = __commonJS({
3224
3224
  };
3225
3225
  })();
3226
3226
  Object.defineProperty(exports2, "__esModule", { value: true });
3227
- exports2.restPositionals = restPositionals4;
3227
+ exports2.restPositionals = restPositionals5;
3228
3228
  var Result = __importStar(require_Result());
3229
3229
  var types_1 = require_types();
3230
3230
  function fullRestPositionals(config) {
@@ -3247,14 +3247,14 @@ var require_restPositionals = __commonJS({
3247
3247
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
3248
3248
  const results = [];
3249
3249
  const errors = [];
3250
- for (const positional9 of positionals) {
3251
- visitedNodes.add(positional9);
3252
- const decoded = await Result.safeAsync(config.type.from(positional9.raw));
3250
+ for (const positional8 of positionals) {
3251
+ visitedNodes.add(positional8);
3252
+ const decoded = await Result.safeAsync(config.type.from(positional8.raw));
3253
3253
  if (Result.isOk(decoded)) {
3254
3254
  results.push(decoded.value);
3255
3255
  } else {
3256
3256
  errors.push({
3257
- nodes: [positional9],
3257
+ nodes: [positional8],
3258
3258
  message: decoded.error.message
3259
3259
  });
3260
3260
  }
@@ -3268,7 +3268,7 @@ var require_restPositionals = __commonJS({
3268
3268
  }
3269
3269
  };
3270
3270
  }
3271
- function restPositionals4(config) {
3271
+ function restPositionals5(config) {
3272
3272
  return fullRestPositionals({
3273
3273
  type: types_1.string,
3274
3274
  ...config
@@ -3352,15 +3352,15 @@ var require_multiflag = __commonJS({
3352
3352
  longNames: [config.long],
3353
3353
  shortNames: config.short ? [config.short] : []
3354
3354
  }).filter((x) => !visitedNodes.has(x));
3355
- for (const option18 of options) {
3356
- visitedNodes.add(option18);
3355
+ for (const option19 of options) {
3356
+ visitedNodes.add(option19);
3357
3357
  }
3358
3358
  const optionValues = [];
3359
3359
  const errors = [];
3360
- for (const option18 of options) {
3361
- const decoded = await Result.safeAsync(flag_1.boolean.from((_b = (_a = option18.value) === null || _a === void 0 ? void 0 : _a.node.raw) !== null && _b !== void 0 ? _b : "true"));
3360
+ for (const 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"));
3362
3362
  if (Result.isErr(decoded)) {
3363
- errors.push({ nodes: [option18], message: decoded.error.message });
3363
+ errors.push({ nodes: [option19], message: decoded.error.message });
3364
3364
  } else {
3365
3365
  optionValues.push(decoded.value);
3366
3366
  }
@@ -3524,16 +3524,16 @@ var require_multioption = __commonJS({
3524
3524
  });
3525
3525
  }
3526
3526
  }
3527
- for (const option18 of options) {
3528
- visitedNodes.add(option18);
3527
+ for (const option19 of options) {
3528
+ visitedNodes.add(option19);
3529
3529
  }
3530
3530
  const optionValues = [];
3531
3531
  const errors = [];
3532
3532
  const flagNodes = [];
3533
- for (const option18 of options) {
3534
- const providedValue = (_a = option18.value) === null || _a === void 0 ? void 0 : _a.node.raw;
3533
+ for (const option19 of options) {
3534
+ const providedValue = (_a = option19.value) === null || _a === void 0 ? void 0 : _a.node.raw;
3535
3535
  if (providedValue === void 0) {
3536
- flagNodes.push(option18);
3536
+ flagNodes.push(option19);
3537
3537
  continue;
3538
3538
  }
3539
3539
  optionValues.push(providedValue);
@@ -3858,7 +3858,7 @@ var require_package = __commonJS({
3858
3858
  "apps/cli/package.json"(exports2, module2) {
3859
3859
  module2.exports = {
3860
3860
  name: "@packmind/cli",
3861
- version: "0.32.0",
3861
+ version: "0.33.0",
3862
3862
  description: "A command-line interface for Packmind linting and code quality checks",
3863
3863
  private: false,
3864
3864
  bin: {
@@ -3899,11 +3899,11 @@ var require_package = __commonJS({
3899
3899
  dotenv: "^16",
3900
3900
  inquirer: "^13.0.2",
3901
3901
  "log-update": "^8.0.0",
3902
- minimatch: "^10",
3902
+ minimatch: "^10.2.6",
3903
3903
  open: "^11.0.0",
3904
3904
  semver: "^7.7.4",
3905
3905
  slug: "^11.0.0",
3906
- undici: "^7.28.0",
3906
+ undici: "^7.29.0",
3907
3907
  which: "^4.0.0",
3908
3908
  yaml: "^2.8.3"
3909
3909
  },
@@ -3915,7 +3915,7 @@ var require_package = __commonJS({
3915
3915
  });
3916
3916
 
3917
3917
  // apps/cli/src/main.ts
3918
- var import_cmd_ts41 = __toESM(require_cjs());
3918
+ var import_cmd_ts42 = __toESM(require_cjs());
3919
3919
 
3920
3920
  // apps/cli/src/infra/commands/LinterCommand.ts
3921
3921
  var import_cmd_ts = __toESM(require_cjs());
@@ -4044,6 +4044,10 @@ var PackmindEvent = class {
4044
4044
  var UserEvent = class extends PackmindEvent {
4045
4045
  };
4046
4046
 
4047
+ // packages/types/src/events/SystemEvent.ts
4048
+ var SystemEvent = class extends PackmindEvent {
4049
+ };
4050
+
4047
4051
  // packages/types/src/accounts/events/UserSignedUpEvent.ts
4048
4052
  var UserSignedUpEvent = class extends UserEvent {
4049
4053
  static {
@@ -4499,6 +4503,13 @@ var createGitProviderId = brandedIdFactory();
4499
4503
  // packages/types/src/git/OrganizationGitHubApp.ts
4500
4504
  var createOrganizationGitHubAppId = brandedIdFactory();
4501
4505
 
4506
+ // packages/types/src/git/events/RepositoryTrackingRemovedEvent.ts
4507
+ var RepositoryTrackingRemovedEvent = class extends UserEvent {
4508
+ static {
4509
+ this.eventName = "git.repository.tracking-removed";
4510
+ }
4511
+ };
4512
+
4502
4513
  // packages/types/src/git/events/RepositoryTrackingSetEvent.ts
4503
4514
  var RepositoryTrackingSetEvent = class extends UserEvent {
4504
4515
  static {
@@ -5310,6 +5321,86 @@ var LLM_PROVIDER_METADATA = {
5310
5321
  // packages/types/src/llm/AIProviderId.ts
5311
5322
  var createAIProviderId = brandedIdFactory();
5312
5323
 
5324
+ // packages/types/src/marketplaces/MarketplaceId.ts
5325
+ var createMarketplaceId = brandedIdFactory();
5326
+
5327
+ // packages/types/src/marketplaces/MarketplaceDescriptorFilename.ts
5328
+ var MARKETPLACE_DESCRIPTOR_PATHS = [
5329
+ ".claude-plugin/marketplace.json",
5330
+ "marketplace.json"
5331
+ ];
5332
+ var MARKETPLACE_DESCRIPTOR_FILENAME = MARKETPLACE_DESCRIPTOR_PATHS[0];
5333
+
5334
+ // packages/types/src/marketplaces/MarketplaceDistributionId.ts
5335
+ var createMarketplaceDistributionId = brandedIdFactory();
5336
+
5337
+ // packages/types/src/marketplaces/PluginInstallationId.ts
5338
+ var createPluginInstallationId = brandedIdFactory();
5339
+
5340
+ // packages/types/src/marketplaces/errors/GitProviderTokenInvalidError.ts
5341
+ var GitProviderTokenInvalidError = class _GitProviderTokenInvalidError extends Error {
5342
+ static {
5343
+ /**
5344
+ * Exact verbatim user-facing message defined by the feature spec.
5345
+ * Do not modify without coordinating with the spec / docs.
5346
+ */
5347
+ this.USER_FACING_MESSAGE = "The package could not be published. Reason: Invalid or expired Git token.";
5348
+ }
5349
+ constructor() {
5350
+ super(_GitProviderTokenInvalidError.USER_FACING_MESSAGE);
5351
+ this.name = "GitProviderTokenInvalidError";
5352
+ }
5353
+ };
5354
+
5355
+ // packages/types/src/marketplaces/events/MarketplaceLinkedEvent.ts
5356
+ var MarketplaceLinkedEvent = class extends UserEvent {
5357
+ static {
5358
+ this.eventName = "deployments.marketplace.linked";
5359
+ }
5360
+ };
5361
+
5362
+ // packages/types/src/marketplaces/events/MarketplacePluginRemovalInitiatedEvent.ts
5363
+ var MarketplacePluginRemovalInitiatedEvent = class extends UserEvent {
5364
+ static {
5365
+ this.eventName = "deployments.distribution.retired";
5366
+ }
5367
+ };
5368
+
5369
+ // packages/types/src/marketplaces/events/MarketplaceUnlinkedEvent.ts
5370
+ var MarketplaceUnlinkedEvent = class extends UserEvent {
5371
+ static {
5372
+ this.eventName = "deployments.marketplace.unlinked";
5373
+ }
5374
+ };
5375
+
5376
+ // packages/types/src/marketplaces/events/PluginInstallTrackedEvent.ts
5377
+ var PluginInstallTrackedEvent = class extends SystemEvent {
5378
+ static {
5379
+ this.eventName = "deployments.plugin.install-tracked";
5380
+ }
5381
+ };
5382
+
5383
+ // packages/types/src/marketplaces/events/PluginPublishAttemptedEvent.ts
5384
+ var PluginPublishAttemptedEvent = class extends UserEvent {
5385
+ static {
5386
+ this.eventName = "deployments.plugin.publish-attempted";
5387
+ }
5388
+ };
5389
+
5390
+ // packages/types/src/marketplaces/events/PluginPublishFailedEvent.ts
5391
+ var PluginPublishFailedEvent = class extends UserEvent {
5392
+ static {
5393
+ this.eventName = "deployments.plugin.publish-failed";
5394
+ }
5395
+ };
5396
+
5397
+ // packages/types/src/marketplaces/events/PluginPublishedEvent.ts
5398
+ var PluginPublishedEvent = class extends UserEvent {
5399
+ static {
5400
+ this.eventName = "deployments.plugin.published";
5401
+ }
5402
+ };
5403
+
5313
5404
  // packages/types/src/playbookChangeManagement/ChangeProposalId.ts
5314
5405
  var createChangeProposalId = brandedIdFactory();
5315
5406
 
@@ -5420,8 +5511,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
5420
5511
  static {
5421
5512
  this.fallbackRuleContent = "adhoc-rule";
5422
5513
  }
5423
- async execute(command31) {
5424
- const { program, fileContent, language } = command31;
5514
+ async execute(command32) {
5515
+ const { program, fileContent, language } = command32;
5425
5516
  const result = await this.linterExecutionUseCase.execute({
5426
5517
  filePath: "cli-single-file",
5427
5518
  fileContent,
@@ -5805,8 +5896,8 @@ var GetGitRemoteUrlUseCase = class {
5805
5896
  constructor(gitRemoteUrlService = new GitService()) {
5806
5897
  this.gitRemoteUrlService = gitRemoteUrlService;
5807
5898
  }
5808
- async execute(command31) {
5809
- const { path: repoPath, origin: origin9 } = command31;
5899
+ async execute(command32) {
5900
+ const { path: repoPath, origin: origin9 } = command32;
5810
5901
  return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
5811
5902
  }
5812
5903
  };
@@ -5958,8 +6049,8 @@ var ListFilesInDirectoryUseCase = class {
5958
6049
  constructor(listFiles = new ListFiles()) {
5959
6050
  this.listFiles = listFiles;
5960
6051
  }
5961
- async execute(command31) {
5962
- const { path: directoryPath, extensions, excludes = [] } = command31;
6052
+ async execute(command32) {
6053
+ const { path: directoryPath, extensions, excludes = [] } = command32;
5963
6054
  const files = await this.listFiles.listFilesInDirectory(
5964
6055
  directoryPath,
5965
6056
  extensions,
@@ -6074,7 +6165,7 @@ var LintFilesAgainstRuleUseCase = class {
6074
6165
  };
6075
6166
  };
6076
6167
  }
6077
- async execute(command31) {
6168
+ async execute(command32) {
6078
6169
  const {
6079
6170
  path: userPath,
6080
6171
  draftMode,
@@ -6083,7 +6174,7 @@ var LintFilesAgainstRuleUseCase = class {
6083
6174
  language,
6084
6175
  diffMode,
6085
6176
  ignorePatterns
6086
- } = command31;
6177
+ } = command32;
6087
6178
  this.logger.debug(
6088
6179
  `Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
6089
6180
  );
@@ -6399,8 +6490,8 @@ var LintFilesAgainstRuleUseCase = class {
6399
6490
  return null;
6400
6491
  }
6401
6492
  }
6402
- async executeProgramsForFile(command31) {
6403
- const result = await this.services.linterExecutionUseCase.execute(command31);
6493
+ async executeProgramsForFile(command32) {
6494
+ const result = await this.services.linterExecutionUseCase.execute(command32);
6404
6495
  return result.violations;
6405
6496
  }
6406
6497
  extractExtensionFromFile(filePath) {
@@ -6423,8 +6514,8 @@ var LintFilesFromConfigUseCase = class {
6423
6514
  this.logger = logger2;
6424
6515
  this.detectionProgramsCache = /* @__PURE__ */ new Map();
6425
6516
  }
6426
- async execute(command31) {
6427
- const { path: userPath, diffMode, ignorePatterns } = command31;
6517
+ async execute(command32) {
6518
+ const { path: userPath, diffMode, ignorePatterns } = command32;
6428
6519
  this.logger.debug(
6429
6520
  `Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
6430
6521
  );
@@ -6684,8 +6775,8 @@ var LintFilesFromConfigUseCase = class {
6684
6775
  return null;
6685
6776
  }
6686
6777
  }
6687
- async executeProgramsForFile(command31) {
6688
- const result = await this.services.linterExecutionUseCase.execute(command31);
6778
+ async executeProgramsForFile(command32) {
6779
+ const result = await this.services.linterExecutionUseCase.execute(command32);
6689
6780
  return result.violations;
6690
6781
  }
6691
6782
  extractExtensionFromFile(filePath) {
@@ -6861,13 +6952,13 @@ var PackmindHttpClient = class {
6861
6952
  var ChangeProposalGateway = class {
6862
6953
  constructor(httpClient) {
6863
6954
  this.httpClient = httpClient;
6864
- this.batchCreate = async (command31) => {
6955
+ this.batchCreate = async (command32) => {
6865
6956
  const { organizationId } = this.httpClient.getAuthContext();
6866
6957
  return this.httpClient.request(
6867
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/change-proposals/batch`,
6958
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/batch`,
6868
6959
  {
6869
6960
  method: "POST",
6870
- body: { proposals: command31.proposals },
6961
+ body: { proposals: command32.proposals },
6871
6962
  onError: (response) => {
6872
6963
  if (response.status === 404) {
6873
6964
  throw new CommunityEditionError("change proposals");
@@ -6876,29 +6967,29 @@ var ChangeProposalGateway = class {
6876
6967
  }
6877
6968
  );
6878
6969
  };
6879
- this.batchApply = async (command31) => {
6970
+ this.batchApply = async (command32) => {
6880
6971
  const { organizationId } = this.httpClient.getAuthContext();
6881
6972
  return this.httpClient.request(
6882
6973
  `/api/v0/organizations/${organizationId}/playbook/apply`,
6883
6974
  {
6884
6975
  method: "POST",
6885
6976
  body: {
6886
- proposals: command31.proposals,
6887
- message: command31.message,
6888
- ...command31.directUpdate !== void 0 && {
6889
- directUpdate: command31.directUpdate
6977
+ proposals: command32.proposals,
6978
+ message: command32.message,
6979
+ ...command32.directUpdate !== void 0 && {
6980
+ directUpdate: command32.directUpdate
6890
6981
  }
6891
6982
  }
6892
6983
  }
6893
6984
  );
6894
6985
  };
6895
- this.check = async (command31) => {
6986
+ this.check = async (command32) => {
6896
6987
  const { organizationId } = this.httpClient.getAuthContext();
6897
6988
  return this.httpClient.request(
6898
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/change-proposals/check`,
6989
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/check`,
6899
6990
  {
6900
6991
  method: "POST",
6901
- body: { proposals: command31.proposals },
6992
+ body: { proposals: command32.proposals },
6902
6993
  onError: (response) => {
6903
6994
  if (response.status === 404) {
6904
6995
  throw new CommunityEditionError("change proposals");
@@ -6914,13 +7005,13 @@ var ChangeProposalGateway = class {
6914
7005
  var LinterGateway = class {
6915
7006
  constructor(httpClient) {
6916
7007
  this.httpClient = httpClient;
6917
- this.getDraftDetectionProgramsForRule = async (command31) => {
7008
+ this.getDraftDetectionProgramsForRule = async (command32) => {
6918
7009
  const payload = {
6919
- standardSlug: command31.standardSlug,
6920
- ruleId: command31.ruleId
7010
+ standardSlug: command32.standardSlug,
7011
+ ruleId: command32.ruleId
6921
7012
  };
6922
- if (command31.language) {
6923
- payload.language = command31.language;
7013
+ if (command32.language) {
7014
+ payload.language = command32.language;
6924
7015
  }
6925
7016
  return this.httpClient.request("/api/v0/list-draft-detection-program", {
6926
7017
  method: "POST",
@@ -6932,13 +7023,13 @@ var LinterGateway = class {
6932
7023
  }
6933
7024
  });
6934
7025
  };
6935
- this.getActiveDetectionProgramsForRule = async (command31) => {
7026
+ this.getActiveDetectionProgramsForRule = async (command32) => {
6936
7027
  const payload = {
6937
- standardSlug: command31.standardSlug,
6938
- ruleId: command31.ruleId
7028
+ standardSlug: command32.standardSlug,
7029
+ ruleId: command32.ruleId
6939
7030
  };
6940
- if (command31.language) {
6941
- payload.language = command31.language;
7031
+ if (command32.language) {
7032
+ payload.language = command32.language;
6942
7033
  }
6943
7034
  return this.httpClient.request("/api/v0/list-active-detection-program", {
6944
7035
  method: "POST",
@@ -6950,13 +7041,13 @@ var LinterGateway = class {
6950
7041
  }
6951
7042
  });
6952
7043
  };
6953
- this.getDetectionProgramsForPackages = async (command31) => {
7044
+ this.getDetectionProgramsForPackages = async (command32) => {
6954
7045
  const response = await this.httpClient.request(
6955
7046
  "/api/v0/detection-programs-for-packages",
6956
7047
  {
6957
7048
  method: "POST",
6958
7049
  body: {
6959
- packagesSlugs: command31.packagesSlugs
7050
+ packagesSlugs: command32.packagesSlugs
6960
7051
  },
6961
7052
  onError: (response2) => {
6962
7053
  if (response2.status === 404) {
@@ -6967,10 +7058,10 @@ var LinterGateway = class {
6967
7058
  );
6968
7059
  return handleScopeInTargetsResponse(response);
6969
7060
  };
6970
- this.trackLinterExecution = async (command31) => {
7061
+ this.trackLinterExecution = async (command32) => {
6971
7062
  return this.httpClient.request(`/api/v0/track-execution`, {
6972
7063
  method: "POST",
6973
- body: command31
7064
+ body: command32
6974
7065
  });
6975
7066
  };
6976
7067
  }
@@ -7024,27 +7115,27 @@ var SpacesGateway = class {
7024
7115
  var SkillsGateway = class {
7025
7116
  constructor(httpClient) {
7026
7117
  this.httpClient = httpClient;
7027
- this.upload = async (command31) => {
7118
+ this.upload = async (command32) => {
7028
7119
  const { organizationId } = this.httpClient.getAuthContext();
7029
7120
  return this.httpClient.request(
7030
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/skills/upload`,
7121
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills/upload`,
7031
7122
  {
7032
7123
  method: "POST",
7033
- body: command31
7124
+ body: command32
7034
7125
  }
7035
7126
  );
7036
7127
  };
7037
- this.getDefaults = async (command31) => {
7128
+ this.getDefaults = async (command32) => {
7038
7129
  const { organizationId } = this.httpClient.getAuthContext();
7039
7130
  const queryParams = new URLSearchParams();
7040
- if (command31.includeBeta) {
7131
+ if (command32.includeBeta) {
7041
7132
  queryParams.set("includeBeta", "true");
7042
- } else if (command31.cliVersion) {
7043
- queryParams.set("cliVersion", command31.cliVersion);
7133
+ } else if (command32.cliVersion) {
7134
+ queryParams.set("cliVersion", command32.cliVersion);
7044
7135
  }
7045
- if (command31.agents !== void 0) {
7136
+ if (command32.agents !== void 0) {
7046
7137
  queryParams.append("agentsConfigOverride", "true");
7047
- command31.agents.forEach((agent) => {
7138
+ command32.agents.forEach((agent) => {
7048
7139
  queryParams.append("agent", agent);
7049
7140
  });
7050
7141
  }
@@ -7053,10 +7144,10 @@ var SkillsGateway = class {
7053
7144
  `/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
7054
7145
  );
7055
7146
  };
7056
- this.list = async (command31) => {
7147
+ this.list = async (command32) => {
7057
7148
  const { organizationId } = this.httpClient.getAuthContext();
7058
7149
  return this.httpClient.request(
7059
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/skills`
7150
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills`
7060
7151
  );
7061
7152
  };
7062
7153
  }
@@ -7066,17 +7157,17 @@ var SkillsGateway = class {
7066
7157
  var CommandsGateway = class {
7067
7158
  constructor(httpClient) {
7068
7159
  this.httpClient = httpClient;
7069
- this.create = async (command31) => {
7160
+ this.create = async (command32) => {
7070
7161
  const { organizationId } = this.httpClient.getAuthContext();
7071
7162
  return this.httpClient.request(
7072
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/commands`,
7073
- { method: "POST", body: command31 }
7163
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/commands`,
7164
+ { method: "POST", body: command32 }
7074
7165
  );
7075
7166
  };
7076
- this.list = async (command31) => {
7167
+ this.list = async (command32) => {
7077
7168
  const { organizationId } = this.httpClient.getAuthContext();
7078
7169
  const listCommandsResponse = await this.httpClient.request(
7079
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/commands`
7170
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/commands`
7080
7171
  );
7081
7172
  if (listCommandsResponse instanceof Array) {
7082
7173
  return { recipes: listCommandsResponse };
@@ -7119,10 +7210,10 @@ var StandardsGateway = class {
7119
7210
  }
7120
7211
  );
7121
7212
  };
7122
- this.list = async (command31) => {
7213
+ this.list = async (command32) => {
7123
7214
  const { organizationId } = this.httpClient.getAuthContext();
7124
7215
  return this.httpClient.request(
7125
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/standards`
7216
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/standards`
7126
7217
  );
7127
7218
  };
7128
7219
  }
@@ -7133,10 +7224,10 @@ var PackagesGateway = class {
7133
7224
  constructor(apiKey, httpClient) {
7134
7225
  this.apiKey = apiKey;
7135
7226
  this.httpClient = httpClient;
7136
- this.list = async (command31) => {
7227
+ this.list = async (command32) => {
7137
7228
  const { organizationId } = this.httpClient.getAuthContext();
7138
7229
  return this.httpClient.request(
7139
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/packages`
7230
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`
7140
7231
  );
7141
7232
  };
7142
7233
  this.getSummary = async ({
@@ -7148,20 +7239,20 @@ var PackagesGateway = class {
7148
7239
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug6)}`
7149
7240
  );
7150
7241
  };
7151
- this.create = async (command31) => {
7242
+ this.create = async (command32) => {
7152
7243
  const { organizationId } = this.httpClient.getAuthContext();
7153
- const { recipeIds, ...rest } = command31;
7244
+ const { recipeIds, ...rest } = command32;
7154
7245
  return this.httpClient.request(
7155
- `/api/v0/organizations/${organizationId}/spaces/${command31.spaceId}/packages`,
7246
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`,
7156
7247
  {
7157
7248
  method: "POST",
7158
7249
  body: { ...rest, commandIds: recipeIds }
7159
7250
  }
7160
7251
  );
7161
7252
  };
7162
- this.addArtefacts = async (command31) => {
7253
+ this.addArtefacts = async (command32) => {
7163
7254
  const { organizationId } = this.httpClient.getAuthContext();
7164
- const { packageId, spaceId, recipeIds, ...rest } = command31;
7255
+ const { packageId, spaceId, recipeIds, ...rest } = command32;
7165
7256
  return this.httpClient.request(
7166
7257
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
7167
7258
  {
@@ -7177,31 +7268,31 @@ var PackagesGateway = class {
7177
7268
  var DeploymentGateway = class {
7178
7269
  constructor(httpClient) {
7179
7270
  this.httpClient = httpClient;
7180
- this.pull = async (command31) => {
7271
+ this.pull = async (command32) => {
7181
7272
  const { organizationId } = this.httpClient.getAuthContext();
7182
7273
  const queryParams = new URLSearchParams();
7183
- if (command31.packagesSlugs && command31.packagesSlugs.length > 0) {
7184
- command31.packagesSlugs.forEach((slug6) => {
7274
+ if (command32.packagesSlugs && command32.packagesSlugs.length > 0) {
7275
+ command32.packagesSlugs.forEach((slug6) => {
7185
7276
  queryParams.append("packageSlug", slug6);
7186
7277
  });
7187
7278
  }
7188
- if (command31.previousPackagesSlugs && command31.previousPackagesSlugs.length > 0) {
7189
- command31.previousPackagesSlugs.forEach((slug6) => {
7279
+ if (command32.previousPackagesSlugs && command32.previousPackagesSlugs.length > 0) {
7280
+ command32.previousPackagesSlugs.forEach((slug6) => {
7190
7281
  queryParams.append("previousPackageSlug", slug6);
7191
7282
  });
7192
7283
  }
7193
- if (command31.gitRemoteUrl) {
7194
- queryParams.append("gitRemoteUrl", command31.gitRemoteUrl);
7284
+ if (command32.gitRemoteUrl) {
7285
+ queryParams.append("gitRemoteUrl", command32.gitRemoteUrl);
7195
7286
  }
7196
- if (command31.gitBranch) {
7197
- queryParams.append("gitBranch", command31.gitBranch);
7287
+ if (command32.gitBranch) {
7288
+ queryParams.append("gitBranch", command32.gitBranch);
7198
7289
  }
7199
- if (command31.relativePath) {
7200
- queryParams.append("relativePath", command31.relativePath);
7290
+ if (command32.relativePath) {
7291
+ queryParams.append("relativePath", command32.relativePath);
7201
7292
  }
7202
- if (command31.agents !== void 0) {
7293
+ if (command32.agents !== void 0) {
7203
7294
  queryParams.append("agentsConfigOverride", "true");
7204
- command31.agents.forEach((agent) => {
7295
+ command32.agents.forEach((agent) => {
7205
7296
  queryParams.append("agent", agent);
7206
7297
  });
7207
7298
  }
@@ -7209,101 +7300,101 @@ var DeploymentGateway = class {
7209
7300
  `/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
7210
7301
  );
7211
7302
  };
7212
- this.install = async (command31) => {
7303
+ this.install = async (command32) => {
7213
7304
  const { organizationId } = this.httpClient.getAuthContext();
7214
7305
  return this.httpClient.request(
7215
7306
  `/api/v0/organizations/${organizationId}/install`,
7216
7307
  {
7217
7308
  method: "POST",
7218
7309
  body: {
7219
- packagesSlugs: command31.packagesSlugs,
7220
- packmindLockFile: command31.packmindLockFile,
7221
- ...command31.relativePath && { relativePath: command31.relativePath },
7222
- ...command31.agents !== void 0 && { agents: command31.agents }
7310
+ packagesSlugs: command32.packagesSlugs,
7311
+ packmindLockFile: command32.packmindLockFile,
7312
+ ...command32.relativePath && { relativePath: command32.relativePath },
7313
+ ...command32.agents !== void 0 && { agents: command32.agents }
7223
7314
  }
7224
7315
  }
7225
7316
  );
7226
7317
  };
7227
- this.getDeployed = async (command31) => {
7318
+ this.getDeployed = async (command32) => {
7228
7319
  const { organizationId } = this.httpClient.getAuthContext();
7229
7320
  return this.httpClient.request(
7230
7321
  `/api/v0/organizations/${organizationId}/deployed-content`,
7231
7322
  {
7232
7323
  method: "POST",
7233
7324
  body: {
7234
- packagesSlugs: command31.packagesSlugs,
7235
- gitRemoteUrl: command31.gitRemoteUrl,
7236
- gitBranch: command31.gitBranch,
7237
- relativePath: command31.relativePath,
7238
- ...command31.agents !== void 0 && { agents: command31.agents }
7325
+ packagesSlugs: command32.packagesSlugs,
7326
+ gitRemoteUrl: command32.gitRemoteUrl,
7327
+ gitBranch: command32.gitBranch,
7328
+ relativePath: command32.relativePath,
7329
+ ...command32.agents !== void 0 && { agents: command32.agents }
7239
7330
  }
7240
7331
  }
7241
7332
  );
7242
7333
  };
7243
- this.getContentByVersions = async (command31) => {
7334
+ this.getContentByVersions = async (command32) => {
7244
7335
  const { organizationId } = this.httpClient.getAuthContext();
7245
7336
  return this.httpClient.request(
7246
7337
  `/api/v0/organizations/${organizationId}/content-by-versions`,
7247
7338
  {
7248
7339
  method: "POST",
7249
7340
  body: {
7250
- artifacts: command31.artifacts,
7251
- ...command31.agents !== void 0 && { agents: command31.agents }
7341
+ artifacts: command32.artifacts,
7342
+ ...command32.agents !== void 0 && { agents: command32.agents }
7252
7343
  }
7253
7344
  }
7254
7345
  );
7255
7346
  };
7256
- this.notifyDistribution = async (command31) => {
7347
+ this.notifyDistribution = async (command32) => {
7257
7348
  const { organizationId } = this.httpClient.getAuthContext();
7258
7349
  return this.httpClient.request(
7259
7350
  `/api/v0/organizations/${organizationId}/deployments`,
7260
7351
  {
7261
7352
  method: "POST",
7262
- body: command31
7353
+ body: command32
7263
7354
  }
7264
7355
  );
7265
7356
  };
7266
- this.notifyArtefactsDistribution = async (command31) => {
7357
+ this.notifyArtefactsDistribution = async (command32) => {
7267
7358
  const { organizationId } = this.httpClient.getAuthContext();
7268
7359
  return this.httpClient.request(
7269
7360
  `/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
7270
7361
  {
7271
7362
  method: "POST",
7272
7363
  body: {
7273
- gitRemoteUrl: command31.gitRemoteUrl,
7274
- gitBranch: command31.gitBranch,
7275
- relativePath: command31.relativePath,
7276
- packmindLockFile: command31.packmindLockFile
7364
+ gitRemoteUrl: command32.gitRemoteUrl,
7365
+ gitBranch: command32.gitBranch,
7366
+ relativePath: command32.relativePath,
7367
+ packmindLockFile: command32.packmindLockFile
7277
7368
  }
7278
7369
  }
7279
7370
  );
7280
7371
  };
7281
- this.renderPlugin = async (command31) => {
7372
+ this.renderPlugin = async (command32) => {
7282
7373
  const { organizationId } = this.httpClient.getAuthContext();
7283
7374
  return this.httpClient.request(
7284
7375
  `/api/v0/organizations/${organizationId}/plugins/render`,
7285
7376
  {
7286
7377
  method: "POST",
7287
7378
  body: {
7288
- packageSlug: command31.packageSlug,
7289
- mode: command31.mode,
7290
- pluginRoot: command31.pluginRoot,
7291
- pluginName: command31.pluginName,
7292
- gitRemoteUrl: command31.gitRemoteUrl,
7293
- gitBranch: command31.gitBranch
7379
+ packageSlug: command32.packageSlug,
7380
+ mode: command32.mode,
7381
+ pluginRoot: command32.pluginRoot,
7382
+ pluginName: command32.pluginName,
7383
+ gitRemoteUrl: command32.gitRemoteUrl,
7384
+ gitBranch: command32.gitBranch
7294
7385
  }
7295
7386
  }
7296
7387
  );
7297
7388
  };
7298
- this.trackPluginDeleted = async (command31) => {
7389
+ this.trackPluginDeleted = async (command32) => {
7299
7390
  const { organizationId } = this.httpClient.getAuthContext();
7300
7391
  return this.httpClient.request(
7301
7392
  `/api/v0/organizations/${organizationId}/plugins/track-deleted`,
7302
7393
  {
7303
7394
  method: "POST",
7304
7395
  body: {
7305
- packageSlug: command31.packageSlug,
7306
- gitRemoteUrl: command31.gitRemoteUrl
7396
+ packageSlug: command32.packageSlug,
7397
+ gitRemoteUrl: command32.gitRemoteUrl
7307
7398
  }
7308
7399
  }
7309
7400
  );
@@ -7315,13 +7406,13 @@ var DeploymentGateway = class {
7315
7406
  );
7316
7407
  };
7317
7408
  }
7318
- async updateRenderModeConfiguration(command31) {
7409
+ async updateRenderModeConfiguration(command32) {
7319
7410
  const { organizationId } = this.httpClient.getAuthContext();
7320
7411
  await this.httpClient.request(
7321
7412
  `/api/v0/organizations/${organizationId}/deployments/renderModeConfiguration`,
7322
7413
  {
7323
7414
  method: "POST",
7324
- body: { activeRenderModes: command31.activeRenderModes }
7415
+ body: { activeRenderModes: command32.activeRenderModes }
7325
7416
  }
7326
7417
  );
7327
7418
  }
@@ -7378,18 +7469,26 @@ var RepositoryTrackingGateway = class {
7378
7469
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository?${query}`
7379
7470
  );
7380
7471
  };
7381
- this.setTrackedRepository = async (command31) => {
7472
+ this.setTrackedRepository = async (command32) => {
7382
7473
  const { organizationId } = this.httpClient.getAuthContext();
7383
7474
  return this.httpClient.request(
7384
7475
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7385
- { method: "POST", body: command31 }
7476
+ { method: "POST", body: command32 }
7386
7477
  );
7387
7478
  };
7388
- this.updateTrackedBranch = async (command31) => {
7479
+ this.updateTrackedBranch = async (command32) => {
7389
7480
  const { organizationId } = this.httpClient.getAuthContext();
7390
7481
  return this.httpClient.request(
7391
7482
  `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository`,
7392
- { method: "PUT", body: command31 }
7483
+ { method: "PUT", body: command32 }
7484
+ );
7485
+ };
7486
+ this.removeTrackedRepository = async ({ owner, repo }) => {
7487
+ const { organizationId } = this.httpClient.getAuthContext();
7488
+ const query = new URLSearchParams({ owner, repo }).toString();
7489
+ return this.httpClient.request(
7490
+ `/api/v0/organizations/${organizationId}/git/repositories/tracked-repository?${query}`,
7491
+ { method: "DELETE" }
7393
7492
  );
7394
7493
  };
7395
7494
  }
@@ -9153,8 +9252,8 @@ var ExecuteLinterProgramsUseCase = class {
9153
9252
  this.linterAstAdapter = linterAstAdapter;
9154
9253
  this.logger = logger2;
9155
9254
  }
9156
- async execute(command31) {
9157
- const { filePath, fileContent, language, programs } = command31;
9255
+ async execute(command32) {
9256
+ const { filePath, fileContent, language, programs } = command32;
9158
9257
  if (programs.length === 0) {
9159
9258
  return {
9160
9259
  file: filePath,
@@ -9753,16 +9852,12 @@ var Cache = class _Cache {
9753
9852
  // packages/feature-flags/src/registry.ts
9754
9853
  var ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY = "change-proposals-in-webapp";
9755
9854
  var ORGA_SPACE_MANAGEMENT_FEATURE_KEY = "orga-space-management";
9756
- var GOVERNANCE_FEATURE_KEY = "governance";
9757
- var CLI_REPO_TRACKING_FEATURE_KEY = "cli-repo-tracking";
9758
9855
  var DEFAULT_FEATURE_DOMAIN_MAP = {
9759
9856
  [ADD_CHANGE_PROPOSALS_IN_WEBAPP_FEATURE_KEY]: [
9760
9857
  "@packmind.com",
9761
9858
  "@promyze.com"
9762
9859
  ],
9763
- [ORGA_SPACE_MANAGEMENT_FEATURE_KEY]: ["@packmind.com", "@promyze.com"],
9764
- [GOVERNANCE_FEATURE_KEY]: ["joan.racenet@packmind.com"],
9765
- [CLI_REPO_TRACKING_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9860
+ [ORGA_SPACE_MANAGEMENT_FEATURE_KEY]: ["@packmind.com", "@promyze.com"]
9766
9861
  };
9767
9862
 
9768
9863
  // packages/node-utils/src/database/schemas.ts
@@ -9993,8 +10088,8 @@ var InstallPackagesUseCase = class {
9993
10088
  constructor(packmindGateway) {
9994
10089
  this.packmindGateway = packmindGateway;
9995
10090
  }
9996
- async execute(command31) {
9997
- const baseDirectory = command31.baseDirectory || process.cwd();
10091
+ async execute(command32) {
10092
+ const baseDirectory = command32.baseDirectory || process.cwd();
9998
10093
  const result = {
9999
10094
  filesCreated: 0,
10000
10095
  filesUpdated: 0,
@@ -10006,12 +10101,12 @@ var InstallPackagesUseCase = class {
10006
10101
  skillDirectoriesDeleted: 0
10007
10102
  };
10008
10103
  const response = await this.packmindGateway.deployment.pull({
10009
- packagesSlugs: command31.packagesSlugs,
10010
- previousPackagesSlugs: command31.previousPackagesSlugs,
10011
- gitRemoteUrl: command31.gitRemoteUrl,
10012
- gitBranch: command31.gitBranch,
10013
- relativePath: command31.relativePath,
10014
- agents: command31.agents
10104
+ packagesSlugs: command32.packagesSlugs,
10105
+ previousPackagesSlugs: command32.previousPackagesSlugs,
10106
+ gitRemoteUrl: command32.gitRemoteUrl,
10107
+ gitBranch: command32.gitBranch,
10108
+ relativePath: command32.relativePath,
10109
+ agents: command32.agents
10015
10110
  });
10016
10111
  const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
10017
10112
  (file) => file.path !== "packmind.json"
@@ -10386,8 +10481,8 @@ var InstallUseCase = class {
10386
10481
  this.configFileRepository = configFileRepository;
10387
10482
  this.spaceService = spaceService;
10388
10483
  }
10389
- async execute(command31) {
10390
- const baseDirectory = command31.baseDirectory || process.cwd();
10484
+ async execute(command32) {
10485
+ const baseDirectory = command32.baseDirectory || process.cwd();
10391
10486
  const result = {
10392
10487
  filesCreated: 0,
10393
10488
  filesUpdated: 0,
@@ -10417,7 +10512,7 @@ var InstallUseCase = class {
10417
10512
  },
10418
10513
  resolvedAgents: []
10419
10514
  };
10420
- const hasExplicitPackages = command31.packages && command31.packages.length > 0;
10515
+ const hasExplicitPackages = command32.packages && command32.packages.length > 0;
10421
10516
  const configExistedBefore = await this.configFileRepository.configExists(baseDirectory);
10422
10517
  const lockFile = await this.lockFileRepository.read(baseDirectory);
10423
10518
  const config = await this.configFileRepository.readConfig(baseDirectory);
@@ -10439,11 +10534,11 @@ var InstallUseCase = class {
10439
10534
  agents: [],
10440
10535
  artifacts: {}
10441
10536
  };
10442
- effectiveLockFile.cliVersion = command31.cliVersion;
10537
+ effectiveLockFile.cliVersion = command32.cliVersion;
10443
10538
  let packagesSlugs;
10444
10539
  let normalizedPackages = [];
10445
10540
  if (hasExplicitPackages) {
10446
- const explicitPackageSlugs = (command31.packages ?? []).map(
10541
+ const explicitPackageSlugs = (command32.packages ?? []).map(
10447
10542
  displayableParsedPackageSlug
10448
10543
  );
10449
10544
  normalizedPackages = await this.normalizePackageSlugs(explicitPackageSlugs);
@@ -10473,8 +10568,8 @@ var InstallUseCase = class {
10473
10568
  }
10474
10569
  return result;
10475
10570
  }
10476
- const installAgents = this.resolveInstallAgents(command31, config);
10477
- const stripPathPrefix = command31.homeAgent ? getAgentHomeDirPrefix(command31.homeAgent) ?? void 0 : void 0;
10571
+ const installAgents = this.resolveInstallAgents(command32, config);
10572
+ const stripPathPrefix = command32.homeAgent ? getAgentHomeDirPrefix(command32.homeAgent) ?? void 0 : void 0;
10478
10573
  const response = await this.packmindGateway.deployment.install({
10479
10574
  packagesSlugs,
10480
10575
  packmindLockFile: effectiveLockFile,
@@ -10614,7 +10709,7 @@ var InstallUseCase = class {
10614
10709
  } catch {
10615
10710
  }
10616
10711
  }
10617
- lockFileToPersist.cliVersion = command31.cliVersion;
10712
+ lockFileToPersist.cliVersion = command32.cliVersion;
10618
10713
  if (stripPathPrefix) {
10619
10714
  lockFileToPersist = this.stripLockFileArtifactPaths(
10620
10715
  lockFileToPersist,
@@ -10643,9 +10738,9 @@ var InstallUseCase = class {
10643
10738
  async normalizePackageSlugs(slugs) {
10644
10739
  return normalizePackageSlugs(slugs, this.spaceService);
10645
10740
  }
10646
- resolveInstallAgents(command31, config) {
10647
- if (command31.homeAgent) {
10648
- return [command31.homeAgent];
10741
+ resolveInstallAgents(command32, config) {
10742
+ if (command32.homeAgent) {
10743
+ return [command32.homeAgent];
10649
10744
  }
10650
10745
  return config?.agents;
10651
10746
  }
@@ -10959,8 +11054,8 @@ var UninstallUseCase = class {
10959
11054
  this.spaceService = spaceService;
10960
11055
  this.installUseCase = installUseCase;
10961
11056
  }
10962
- async execute(command31) {
10963
- const baseDirectory = command31.baseDirectory || process.cwd();
11057
+ async execute(command32) {
11058
+ const baseDirectory = command32.baseDirectory || process.cwd();
10964
11059
  const config = await this.configFileRepository.readConfig(baseDirectory);
10965
11060
  if (!config) {
10966
11061
  const configFileExists = await this.configFileRepository.configExists(baseDirectory);
@@ -10974,7 +11069,7 @@ var UninstallUseCase = class {
10974
11069
  );
10975
11070
  }
10976
11071
  const normalized = await normalizePackageSlugs(
10977
- command31.packages,
11072
+ command32.packages,
10978
11073
  this.spaceService
10979
11074
  );
10980
11075
  const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
@@ -10997,7 +11092,7 @@ ${pkgList}`
10997
11092
  try {
10998
11093
  return await this.installUseCase.execute({
10999
11094
  baseDirectory,
11000
- cliVersion: command31.cliVersion
11095
+ cliVersion: command32.cliVersion
11001
11096
  });
11002
11097
  } catch (error) {
11003
11098
  await this.configFileRepository.updateConfig(
@@ -11039,8 +11134,8 @@ var InstallDefaultSkillsUseCase = class {
11039
11134
  constructor(repositories) {
11040
11135
  this.repositories = repositories;
11041
11136
  }
11042
- async execute(command31) {
11043
- const baseDirectory = command31.baseDirectory || process.cwd();
11137
+ async execute(command32) {
11138
+ const baseDirectory = command32.baseDirectory || process.cwd();
11044
11139
  await this.bootstrapEmptyDirectory(baseDirectory);
11045
11140
  const result = {
11046
11141
  filesCreated: 0,
@@ -11050,24 +11145,24 @@ var InstallDefaultSkillsUseCase = class {
11050
11145
  skippedIncompatibleSkillNames: [],
11051
11146
  incompatibleInstalledSkills: []
11052
11147
  };
11053
- let agents = command31.agents;
11148
+ let agents = command32.agents;
11054
11149
  if (!agents || agents.length === 0) {
11055
11150
  const config = await this.repositories.configFileRepository.readConfig(baseDirectory);
11056
11151
  agents = config?.agents;
11057
11152
  }
11058
11153
  const response = await this.repositories.packmindGateway.skills.getDefaults(
11059
11154
  {
11060
- cliVersion: command31.cliVersion,
11061
- includeBeta: command31.includeBeta,
11155
+ cliVersion: command32.cliVersion,
11156
+ includeBeta: command32.includeBeta,
11062
11157
  agents
11063
11158
  }
11064
11159
  );
11065
11160
  result.skippedSkillsCount = response.skippedSkillsCount;
11066
11161
  const incompatibleInstalledMap = /* @__PURE__ */ new Map();
11067
11162
  const incompatibleSkillDirs = /* @__PURE__ */ new Map();
11068
- if (command31.cliVersion) {
11163
+ if (command32.cliVersion) {
11069
11164
  for (const file of response.fileUpdates.createOrUpdate) {
11070
- if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command31.cliVersion)) {
11165
+ if (path9.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command32.cliVersion)) {
11071
11166
  const dir = path9.dirname(file.path);
11072
11167
  const skillName = this.getSkillName(file.content) ?? path9.basename(dir);
11073
11168
  incompatibleSkillDirs.set(dir, skillName);
@@ -11078,9 +11173,9 @@ var InstallDefaultSkillsUseCase = class {
11078
11173
  for (const file of response.fileUpdates.createOrUpdate) {
11079
11174
  try {
11080
11175
  if (!file.content) continue;
11081
- const isIncompatible = command31.cliVersion && (this.isVersionConstraintViolated(
11176
+ const isIncompatible = command32.cliVersion && (this.isVersionConstraintViolated(
11082
11177
  file.content,
11083
- command31.cliVersion
11178
+ command32.cliVersion
11084
11179
  ) || this.isUnderIncompatibleSkillDir(
11085
11180
  file.path,
11086
11181
  incompatibleSkillDirs
@@ -11123,7 +11218,7 @@ var InstallDefaultSkillsUseCase = class {
11123
11218
  await this.mergeLockFileSlice(
11124
11219
  baseDirectory,
11125
11220
  response.lockFileSlice ?? {},
11126
- command31.cliVersion
11221
+ command32.cliVersion
11127
11222
  );
11128
11223
  return result;
11129
11224
  }
@@ -11277,8 +11372,8 @@ var EnsureCliVersionUseCase = class {
11277
11372
  this.lockFileRepository = lockFileRepository;
11278
11373
  this.installDefaultSkillsUseCase = installDefaultSkillsUseCase;
11279
11374
  }
11280
- async execute(command31) {
11281
- const { baseDirectory, currentCliVersion, includeBeta } = command31;
11375
+ async execute(command32) {
11376
+ const { baseDirectory, currentCliVersion, includeBeta } = command32;
11282
11377
  const lockFile = await this.lockFileRepository.read(baseDirectory);
11283
11378
  if (!lockFile) {
11284
11379
  return { kind: "no-lockfile" };
@@ -11314,10 +11409,10 @@ var ListPackagesUseCase = class {
11314
11409
  this.packmindGateway = packmindGateway;
11315
11410
  this.spaceService = spaceService;
11316
11411
  }
11317
- async execute(command31) {
11318
- if (command31.spaceId) {
11412
+ async execute(command32) {
11413
+ if (command32.spaceId) {
11319
11414
  const response = await this.packmindGateway.packages.list({
11320
- spaceId: command31.spaceId
11415
+ spaceId: command32.spaceId
11321
11416
  });
11322
11417
  return response.packages;
11323
11418
  }
@@ -11336,8 +11431,8 @@ var GetPackageSummaryUseCase = class {
11336
11431
  constructor(gateway) {
11337
11432
  this.gateway = gateway;
11338
11433
  }
11339
- async execute(command31) {
11340
- return this.gateway.packages.getSummary(command31);
11434
+ async execute(command32) {
11435
+ return this.gateway.packages.getSummary(command32);
11341
11436
  }
11342
11437
  };
11343
11438
 
@@ -11629,8 +11724,8 @@ var LoginUseCase = class {
11629
11724
  startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
11630
11725
  };
11631
11726
  }
11632
- async execute(command31) {
11633
- const { host, code: providedCode } = command31;
11727
+ async execute(command32) {
11728
+ const { host, code: providedCode } = command32;
11634
11729
  let code;
11635
11730
  if (providedCode) {
11636
11731
  code = providedCode;
@@ -12012,10 +12107,10 @@ var CheckCliVersionUseCase = class {
12012
12107
  now: deps?.now ?? (() => /* @__PURE__ */ new Date())
12013
12108
  };
12014
12109
  }
12015
- async execute(command31) {
12016
- const cached = this.readFreshCache(command31.currentVersion);
12110
+ async execute(command32) {
12111
+ const cached = this.readFreshCache(command32.currentVersion);
12017
12112
  if (cached) {
12018
- return this.toResult(command31.currentVersion, cached.latestVersion);
12113
+ return this.toResult(command32.currentVersion, cached.latestVersion);
12019
12114
  }
12020
12115
  const fetchPromise = this.deps.fetchLatestVersion(this.deps.fetchFn);
12021
12116
  fetchPromise.catch(() => void 0);
@@ -12033,7 +12128,7 @@ var CheckCliVersionUseCase = class {
12033
12128
  latestVersion,
12034
12129
  checkedAt: this.deps.now()
12035
12130
  });
12036
- return this.toResult(command31.currentVersion, latestVersion);
12131
+ return this.toResult(command32.currentVersion, latestVersion);
12037
12132
  } catch {
12038
12133
  return null;
12039
12134
  }
@@ -12481,10 +12576,10 @@ var ListStandardsUseCase = class {
12481
12576
  this.packmindGateway = packmindGateway;
12482
12577
  this.spaceService = spaceService;
12483
12578
  }
12484
- async execute(command31) {
12485
- if (command31.spaceId) {
12579
+ async execute(command32) {
12580
+ if (command32.spaceId) {
12486
12581
  const response = await this.packmindGateway.standards.list({
12487
- spaceId: command31.spaceId
12582
+ spaceId: command32.spaceId
12488
12583
  });
12489
12584
  return response.standards;
12490
12585
  }
@@ -12504,10 +12599,10 @@ var ListCommandsUseCase = class {
12504
12599
  this.packmindGateway = packmindGateway;
12505
12600
  this.spaceService = spaceService;
12506
12601
  }
12507
- async execute(command31) {
12508
- if (command31.spaceId) {
12602
+ async execute(command32) {
12603
+ if (command32.spaceId) {
12509
12604
  const response = await this.packmindGateway.commands.list({
12510
- spaceId: command31.spaceId
12605
+ spaceId: command32.spaceId
12511
12606
  });
12512
12607
  return response.recipes;
12513
12608
  }
@@ -12527,10 +12622,10 @@ var ListSkillsUseCase = class {
12527
12622
  this.packmindGateway = packmindGateway;
12528
12623
  this.spaceService = spaceService;
12529
12624
  }
12530
- async execute(command31) {
12531
- if (command31.spaceId) {
12625
+ async execute(command32) {
12626
+ if (command32.spaceId) {
12532
12627
  const skills = await this.packmindGateway.skills.list({
12533
- spaceId: command31.spaceId
12628
+ spaceId: command32.spaceId
12534
12629
  });
12535
12630
  return skills.map((s) => ({
12536
12631
  id: s.id,
@@ -12702,8 +12797,8 @@ var UploadSkillUseCase = class {
12702
12797
  constructor(deps) {
12703
12798
  this.deps = deps;
12704
12799
  }
12705
- async execute(command31) {
12706
- const files = await readSkillDirectory(command31.skillPath);
12800
+ async execute(command32) {
12801
+ const files = await readSkillDirectory(command32.skillPath);
12707
12802
  if (!files.find((f) => f.relativePath === "SKILL.md")) {
12708
12803
  throw new Error("SKILL.md not found in skill directory");
12709
12804
  }
@@ -12717,7 +12812,7 @@ var UploadSkillUseCase = class {
12717
12812
  if (totalSize > 10 * 1024 * 1024) {
12718
12813
  throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
12719
12814
  }
12720
- const space = await this.getSpace(command31.spaceSlug);
12815
+ const space = await this.getSpace(command32.spaceSlug);
12721
12816
  const payload = {
12722
12817
  files: files.map((f) => ({
12723
12818
  path: f.relativePath,
@@ -12729,7 +12824,7 @@ var UploadSkillUseCase = class {
12729
12824
  const uploadSkillResponse = await this.deps.gateway.skills.upload({
12730
12825
  spaceId: createSpaceId(space.id),
12731
12826
  files: payload.files,
12732
- originSkill: command31.originSkill
12827
+ originSkill: command32.originSkill
12733
12828
  });
12734
12829
  return {
12735
12830
  skillId: uploadSkillResponse.skill.id,
@@ -13719,9 +13814,9 @@ var DiffArtefactsUseCase = class {
13719
13814
  new StandardDiffStrategy()
13720
13815
  ];
13721
13816
  }
13722
- async execute(command31) {
13723
- const baseDirectory = command31.baseDirectory || process.cwd();
13724
- const response = await this.fetchContent(command31, baseDirectory);
13817
+ async execute(command32) {
13818
+ const baseDirectory = command32.baseDirectory || process.cwd();
13819
+ const response = await this.fetchContent(command32, baseDirectory);
13725
13820
  const filteredFiles = response.fileUpdates.createOrUpdate.filter(
13726
13821
  (file) => file.path !== "packmind.json"
13727
13822
  );
@@ -13734,7 +13829,7 @@ var DiffArtefactsUseCase = class {
13734
13829
  );
13735
13830
  const prefixedSkillFolders = this.prefixSkillFolders(
13736
13831
  response.skillFolders,
13737
- command31.relativePath
13832
+ command32.relativePath
13738
13833
  );
13739
13834
  const diffs = [];
13740
13835
  for (const file of diffableFiles) {
@@ -13761,7 +13856,7 @@ var DiffArtefactsUseCase = class {
13761
13856
  targetId: response.targetId ? createTargetId(response.targetId) : void 0
13762
13857
  }));
13763
13858
  }
13764
- async fetchContent(command31, baseDirectory) {
13859
+ async fetchContent(command32, baseDirectory) {
13765
13860
  const lockFile = await this.lockFileRepository.read(baseDirectory);
13766
13861
  if (lockFile) {
13767
13862
  try {
@@ -13781,11 +13876,11 @@ var DiffArtefactsUseCase = class {
13781
13876
  }
13782
13877
  }
13783
13878
  return this.packmindGateway.deployment.getDeployed({
13784
- packagesSlugs: command31.packagesSlugs,
13785
- gitRemoteUrl: command31.gitRemoteUrl,
13786
- gitBranch: command31.gitBranch,
13787
- relativePath: command31.relativePath,
13788
- agents: command31.agents
13879
+ packagesSlugs: command32.packagesSlugs,
13880
+ gitRemoteUrl: command32.gitRemoteUrl,
13881
+ gitBranch: command32.gitBranch,
13882
+ relativePath: command32.relativePath,
13883
+ agents: command32.agents
13789
13884
  });
13790
13885
  }
13791
13886
  prefixSkillFolders(skillFolders, relativePath) {
@@ -13809,8 +13904,8 @@ var SubmitDiffsUseCase = class {
13809
13904
  constructor(packmindGateway) {
13810
13905
  this.packmindGateway = packmindGateway;
13811
13906
  }
13812
- async execute(command31) {
13813
- const { groupedDiffs, message } = command31;
13907
+ async execute(command32) {
13908
+ const { groupedDiffs, message } = command32;
13814
13909
  const skipped = [];
13815
13910
  const validDiffs = [];
13816
13911
  for (const group of groupedDiffs) {
@@ -13885,8 +13980,8 @@ var CheckDiffsUseCase = class {
13885
13980
  constructor(packmindGateway) {
13886
13981
  this.packmindGateway = packmindGateway;
13887
13982
  }
13888
- async execute(command31) {
13889
- const { groupedDiffs } = command31;
13983
+ async execute(command32) {
13984
+ const { groupedDiffs } = command32;
13890
13985
  const results = [];
13891
13986
  const validDiffs = [];
13892
13987
  const invalidDiffs = [];
@@ -13984,8 +14079,8 @@ var CliFormatter = class {
13984
14079
  static error(message) {
13985
14080
  return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
13986
14081
  }
13987
- static command(command31) {
13988
- return source_default.yellow(command31);
14082
+ static command(command32) {
14083
+ return source_default.yellow(command32);
13989
14084
  }
13990
14085
  static loader(text) {
13991
14086
  return source_default.dim.italic(text);
@@ -14130,16 +14225,55 @@ var TrackRepositoryUseCase = class {
14130
14225
  this.gateway = gateway;
14131
14226
  this.gitService = gitService;
14132
14227
  }
14133
- async execute(command31) {
14134
- const { repoPath, origin: origin9, update, confirm } = command31;
14228
+ async execute(command32) {
14229
+ const {
14230
+ repoPath,
14231
+ origin: origin9,
14232
+ update,
14233
+ remove,
14234
+ branch: requestedBranch,
14235
+ confirm
14236
+ } = command32;
14135
14237
  const { gitRemoteUrl } = this.gitService.getGitRemoteUrl(repoPath);
14136
- const { branch } = this.gitService.getCurrentBranch(repoPath);
14238
+ const { branch: currentBranch } = this.gitService.getCurrentBranch(repoPath);
14239
+ const branch = requestedBranch ?? currentBranch;
14137
14240
  const { owner, repo } = parseOwnerRepo(gitRemoteUrl);
14138
14241
  const providerVendor = parseProviderVendor(gitRemoteUrl);
14139
14242
  const { gitRepo: tracked } = await this.gateway.getTrackedRepository({
14140
14243
  owner,
14141
14244
  repo
14142
14245
  });
14246
+ if (remove) {
14247
+ if (tracked) {
14248
+ const confirmed2 = await confirm({
14249
+ mode: "remove",
14250
+ owner,
14251
+ repo,
14252
+ branch: tracked.branch
14253
+ });
14254
+ if (!confirmed2) {
14255
+ return { status: "cancelled" };
14256
+ }
14257
+ }
14258
+ const response = await this.gateway.removeTrackedRepository({
14259
+ owner,
14260
+ repo
14261
+ });
14262
+ if (response.status === "not-tracked") {
14263
+ return {
14264
+ status: "not-tracked",
14265
+ owner,
14266
+ repo,
14267
+ organizationName: response.organizationName
14268
+ };
14269
+ }
14270
+ return {
14271
+ status: "removed",
14272
+ owner,
14273
+ repo,
14274
+ branch: response.gitRepo.branch
14275
+ };
14276
+ }
14143
14277
  if (update) {
14144
14278
  if (!tracked) {
14145
14279
  return { status: "nothing-tracked", owner, repo, branch };
@@ -14297,29 +14431,29 @@ var PackmindCliHexaFactory = class {
14297
14431
  var origin8 = "PackmindCliHexa";
14298
14432
  var PackmindCliHexa = class {
14299
14433
  constructor(logger2 = new PackmindLogger(origin8)) {
14300
- this.notifyDistribution = async (command31) => {
14434
+ this.notifyDistribution = async (command32) => {
14301
14435
  return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
14302
- command31
14436
+ command32
14303
14437
  );
14304
14438
  };
14305
- this.notifyArtefactsDistribution = async (command31) => {
14439
+ this.notifyArtefactsDistribution = async (command32) => {
14306
14440
  return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
14307
- command31
14441
+ command32
14308
14442
  );
14309
14443
  };
14310
- this.getTrackedRepository = async (command31) => {
14444
+ this.getTrackedRepository = async (command32) => {
14311
14445
  return this.hexa.repositories.packmindGateway.repositoryTracking.getTrackedRepository(
14312
- command31
14446
+ command32
14313
14447
  );
14314
14448
  };
14315
- this.renderPlugin = async (command31) => {
14449
+ this.renderPlugin = async (command32) => {
14316
14450
  return this.hexa.repositories.packmindGateway.deployment.renderPlugin(
14317
- command31
14451
+ command32
14318
14452
  );
14319
14453
  };
14320
- this.trackPluginDeleted = async (command31) => {
14454
+ this.trackPluginDeleted = async (command32) => {
14321
14455
  return this.hexa.repositories.packmindGateway.deployment.trackPluginDeleted(
14322
- command31
14456
+ command32
14323
14457
  );
14324
14458
  };
14325
14459
  this.logger = logger2;
@@ -14342,29 +14476,29 @@ var PackmindCliHexa = class {
14342
14476
  get output() {
14343
14477
  return this.hexa.repositories.output;
14344
14478
  }
14345
- async getGitRemoteUrl(command31) {
14346
- return this.hexa.useCases.getGitRemoteUrl.execute(command31);
14479
+ async getGitRemoteUrl(command32) {
14480
+ return this.hexa.useCases.getGitRemoteUrl.execute(command32);
14347
14481
  }
14348
- async listFilesInDirectory(command31) {
14349
- return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command31);
14482
+ async listFilesInDirectory(command32) {
14483
+ return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command32);
14350
14484
  }
14351
- async lintFilesAgainstRule(command31) {
14352
- return this.hexa.useCases.lintFilesAgainstRule.execute(command31);
14485
+ async lintFilesAgainstRule(command32) {
14486
+ return this.hexa.useCases.lintFilesAgainstRule.execute(command32);
14353
14487
  }
14354
- async lintFilesFromConfig(command31) {
14355
- return this.hexa.useCases.lintFilesFromConfig.execute(command31);
14488
+ async lintFilesFromConfig(command32) {
14489
+ return this.hexa.useCases.lintFilesFromConfig.execute(command32);
14356
14490
  }
14357
- async installPackages(command31) {
14358
- return this.hexa.useCases.installPackages.execute(command31);
14491
+ async installPackages(command32) {
14492
+ return this.hexa.useCases.installPackages.execute(command32);
14359
14493
  }
14360
- async install(command31) {
14361
- return this.hexa.useCases.install.execute(command31);
14494
+ async install(command32) {
14495
+ return this.hexa.useCases.install.execute(command32);
14362
14496
  }
14363
- async uninstall(command31) {
14364
- return this.hexa.useCases.uninstall.execute(command31);
14497
+ async uninstall(command32) {
14498
+ return this.hexa.useCases.uninstall.execute(command32);
14365
14499
  }
14366
- async diffArtefacts(command31) {
14367
- return this.hexa.useCases.diffArtefacts.execute(command31);
14500
+ async diffArtefacts(command32) {
14501
+ return this.hexa.useCases.diffArtefacts.execute(command32);
14368
14502
  }
14369
14503
  async submitDiffs(groupedDiffs, message) {
14370
14504
  return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
@@ -14372,20 +14506,20 @@ var PackmindCliHexa = class {
14372
14506
  async checkDiffs(groupedDiffs) {
14373
14507
  return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
14374
14508
  }
14375
- async listPackages(command31) {
14376
- return this.hexa.useCases.listPackages.execute(command31);
14509
+ async listPackages(command32) {
14510
+ return this.hexa.useCases.listPackages.execute(command32);
14377
14511
  }
14378
- async getPackageBySlug(command31) {
14379
- return this.hexa.useCases.getPackageBySlug.execute(command31);
14512
+ async getPackageBySlug(command32) {
14513
+ return this.hexa.useCases.getPackageBySlug.execute(command32);
14380
14514
  }
14381
- async listStandards(command31) {
14382
- return this.hexa.useCases.listStandards.execute(command31);
14515
+ async listStandards(command32) {
14516
+ return this.hexa.useCases.listStandards.execute(command32);
14383
14517
  }
14384
- async listCommands(command31) {
14385
- return this.hexa.useCases.listCommands.execute(command31);
14518
+ async listCommands(command32) {
14519
+ return this.hexa.useCases.listCommands.execute(command32);
14386
14520
  }
14387
- async listSkills(command31) {
14388
- return this.hexa.useCases.listSkills.execute(command31);
14521
+ async listSkills(command32) {
14522
+ return this.hexa.useCases.listSkills.execute(command32);
14389
14523
  }
14390
14524
  async configExists(baseDirectory) {
14391
14525
  return await this.hexa.repositories.configFileRepository.configExists(
@@ -14472,17 +14606,17 @@ var PackmindCliHexa = class {
14472
14606
  directory
14473
14607
  );
14474
14608
  }
14475
- async login(command31) {
14476
- return this.hexa.useCases.login.execute(command31);
14609
+ async login(command32) {
14610
+ return this.hexa.useCases.login.execute(command32);
14477
14611
  }
14478
- async logout(command31) {
14479
- return this.hexa.useCases.logout.execute(command31);
14612
+ async logout(command32) {
14613
+ return this.hexa.useCases.logout.execute(command32);
14480
14614
  }
14481
- async whoami(command31) {
14482
- return this.hexa.useCases.whoami.execute(command31);
14615
+ async whoami(command32) {
14616
+ return this.hexa.useCases.whoami.execute(command32);
14483
14617
  }
14484
- async checkCliVersion(command31) {
14485
- return this.hexa.useCases.checkCliVersion.execute(command31);
14618
+ async checkCliVersion(command32) {
14619
+ return this.hexa.useCases.checkCliVersion.execute(command32);
14486
14620
  }
14487
14621
  getCurrentBranch(repoPath) {
14488
14622
  return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
@@ -14490,22 +14624,22 @@ var PackmindCliHexa = class {
14490
14624
  getGitRemoteUrlFromPath(repoPath) {
14491
14625
  return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
14492
14626
  }
14493
- async uploadSkill(command31) {
14494
- return this.hexa.useCases.uploadSkill.execute(command31);
14627
+ async uploadSkill(command32) {
14628
+ return this.hexa.useCases.uploadSkill.execute(command32);
14495
14629
  }
14496
- async installDefaultSkills(command31) {
14497
- return this.hexa.useCases.installDefaultSkills.execute(command31);
14630
+ async installDefaultSkills(command32) {
14631
+ return this.hexa.useCases.installDefaultSkills.execute(command32);
14498
14632
  }
14499
- async bootstrapSkillsInitDirectory(command31) {
14633
+ async bootstrapSkillsInitDirectory(command32) {
14500
14634
  return this.hexa.useCases.installDefaultSkills.bootstrapEmptyDirectory(
14501
- command31.baseDirectory
14635
+ command32.baseDirectory
14502
14636
  );
14503
14637
  }
14504
- async ensureCliVersion(command31) {
14505
- return this.hexa.useCases.ensureCliVersion.execute(command31);
14638
+ async ensureCliVersion(command32) {
14639
+ return this.hexa.useCases.ensureCliVersion.execute(command32);
14506
14640
  }
14507
- async trackRepository(command31) {
14508
- return this.hexa.useCases.trackRepository.execute(command31);
14641
+ async trackRepository(command32) {
14642
+ return this.hexa.useCases.trackRepository.execute(command32);
14509
14643
  }
14510
14644
  getPackmindGateway() {
14511
14645
  return this.hexa.repositories.packmindGateway;
@@ -15537,6 +15671,9 @@ function buildSkillsSkippedWarning(configuredAgents) {
15537
15671
  // apps/cli/src/infra/commands/trackingPrompts.ts
15538
15672
  var inquirer2 = __toESM(require("inquirer"));
15539
15673
  function buildTrackConfirmationMessage(details) {
15674
+ if (details.mode === "remove") {
15675
+ return `Stop tracking ${details.owner}/${details.repo}? Packmind currently tracks branch ${details.branch}.`;
15676
+ }
15540
15677
  if (details.mode === "update") {
15541
15678
  return `Change the tracked branch for ${details.owner}/${details.repo} from ${details.fromBranch} to ${details.branch}?`;
15542
15679
  }
@@ -15548,7 +15685,7 @@ async function defaultConfirmPrompt(message) {
15548
15685
  type: "confirm",
15549
15686
  name: "confirmed",
15550
15687
  message,
15551
- default: true
15688
+ default: false
15552
15689
  }
15553
15690
  ]);
15554
15691
  return confirmed;
@@ -15668,6 +15805,7 @@ async function offerRepositoryTracking(deps) {
15668
15805
  repoPath: deps.baseDirectory,
15669
15806
  origin: "init",
15670
15807
  update: false,
15808
+ remove: false,
15671
15809
  confirm
15672
15810
  });
15673
15811
  switch (result.status) {
@@ -17054,15 +17192,15 @@ var CreatePackageUseCase = class {
17054
17192
  this.gateway = gateway;
17055
17193
  this.spaceService = spaceService;
17056
17194
  }
17057
- async execute(command31) {
17058
- const space = await this.getSpace(command31);
17195
+ async execute(command32) {
17196
+ const space = await this.getSpace(command32);
17059
17197
  const result = await this.gateway.packages.create({
17060
17198
  spaceId: space.id,
17061
- name: command31.name,
17062
- description: command31.description ?? "",
17199
+ name: command32.name,
17200
+ description: command32.description ?? "",
17063
17201
  recipeIds: [],
17064
17202
  standardIds: [],
17065
- originSkill: command31.originSkill
17203
+ originSkill: command32.originSkill
17066
17204
  });
17067
17205
  return {
17068
17206
  packageId: result.package.id,
@@ -17071,12 +17209,12 @@ var CreatePackageUseCase = class {
17071
17209
  spaceSlug: space.slug
17072
17210
  };
17073
17211
  }
17074
- async getSpace(command31) {
17212
+ async getSpace(command32) {
17075
17213
  const spaces = await this.spaceService.getSpaces();
17076
- if (command31.spaceSlug) {
17077
- const found = spaces.find((s) => s.slug === command31.spaceSlug);
17214
+ if (command32.spaceSlug) {
17215
+ const found = spaces.find((s) => s.slug === command32.spaceSlug);
17078
17216
  if (!found) {
17079
- throw new Error(`Space '${command31.spaceSlug}' not found.`);
17217
+ throw new Error(`Space '${command32.spaceSlug}' not found.`);
17080
17218
  }
17081
17219
  return found;
17082
17220
  }
@@ -17194,8 +17332,8 @@ var AddToPackageUseCase = class {
17194
17332
  this.gateway = gateway;
17195
17333
  this.spaceService = spaceService;
17196
17334
  }
17197
- async execute(command31) {
17198
- const { packageSlug, spaceSlug, itemType, itemSlugs } = command31;
17335
+ async execute(command32) {
17336
+ const { packageSlug, spaceSlug, itemType, itemSlugs } = command32;
17199
17337
  const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
17200
17338
  const packages = await this.gateway.packages.list({
17201
17339
  spaceId: space.id
@@ -17216,7 +17354,7 @@ var AddToPackageUseCase = class {
17216
17354
  standardIds: [],
17217
17355
  recipeIds: [],
17218
17356
  skillIds: [],
17219
- originSkill: command31.originSkill
17357
+ originSkill: command32.originSkill
17220
17358
  };
17221
17359
  if (itemType === "standard") {
17222
17360
  addCommand.standardIds = ids.map(createStandardId);
@@ -17268,7 +17406,7 @@ var AddToPackageUseCase = class {
17268
17406
  }
17269
17407
  async findCommandBySlug(slug6, spaceId) {
17270
17408
  const commands = await this.gateway.commands.list({ spaceId });
17271
- return commands.recipes.find((command31) => command31.slug === slug6) ?? null;
17409
+ return commands.recipes.find((command32) => command32.slug === slug6) ?? null;
17272
17410
  }
17273
17411
  async findSkillBySlug(slug6, spaceId) {
17274
17412
  const skills = await this.gateway.skills.list({ spaceId });
@@ -17344,11 +17482,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
17344
17482
  logErrorConsole(message);
17345
17483
  if (error instanceof ItemNotFoundError) {
17346
17484
  const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
17347
- const command31 = formatCommand(
17485
+ const command32 = formatCommand(
17348
17486
  `packmind-cli ${error.itemType}s list${spaceFlag}`
17349
17487
  );
17350
17488
  logInfoConsole(
17351
- `Run \`${command31}\` to display available ${error.itemType}s`
17489
+ `Run \`${command32}\` to display available ${error.itemType}s`
17352
17490
  );
17353
17491
  }
17354
17492
  return { success: false, error: message };
@@ -17608,8 +17746,8 @@ ${pkg.name} (${fullSlug}):
17608
17746
  }
17609
17747
  if (pkg.commands && pkg.commands.length > 0) {
17610
17748
  logConsole("Commands:");
17611
- pkg.commands.forEach((command31) => {
17612
- logConsole(` - ${command31.name}`);
17749
+ pkg.commands.forEach((command32) => {
17750
+ logConsole(` - ${command32.name}`);
17613
17751
  });
17614
17752
  logConsole("");
17615
17753
  }
@@ -18128,7 +18266,7 @@ var PlaybookLocalRepository = class {
18128
18266
  }
18129
18267
  };
18130
18268
 
18131
- // apps/cli/src/infra/commands/playbook/addHandler.ts
18269
+ // apps/cli/src/infra/commands/playbook/add/stageSinglePath.ts
18132
18270
  var fs25 = __toESM(require("fs"));
18133
18271
  var path29 = __toESM(require("path"));
18134
18272
  var yaml2 = __toESM(require("yaml"));
@@ -18792,7 +18930,7 @@ function adoptArtifactIntoLockFile({
18792
18930
  };
18793
18931
  }
18794
18932
 
18795
- // apps/cli/src/infra/commands/playbook/addHandler.ts
18933
+ // apps/cli/src/infra/commands/playbook/add/stageSinglePath.ts
18796
18934
  async function tryStageRemovedFromLockFile(resolvedPath, deps) {
18797
18935
  const fileDir = path29.dirname(resolvedPath);
18798
18936
  const targetDir = await findNearestConfigDir(fileDir, deps.packmindCliHexa);
@@ -18830,10 +18968,6 @@ async function tryStageRemovedFromLockFile(resolvedPath, deps) {
18830
18968
  logSuccessConsole(
18831
18969
  `Staged "${lockEntry.name}" (${lockEntry.type}, removed) to playbook${spaceInfo}`
18832
18970
  );
18833
- logInfoConsole(
18834
- `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
18835
- );
18836
- deps.exit(0);
18837
18971
  return true;
18838
18972
  }
18839
18973
  function resolveSkillDirectoryRoot(absolutePath) {
@@ -18857,25 +18991,17 @@ function resolveSkillDirectoryRoot(absolutePath) {
18857
18991
  }
18858
18992
  return absolutePath;
18859
18993
  }
18860
- async function playbookAddHandler(deps) {
18994
+ async function stageSinglePath(deps) {
18861
18995
  const {
18862
18996
  packmindCliHexa,
18863
18997
  filePath,
18864
18998
  spaceSlug,
18865
- exit,
18866
18999
  cwd,
18867
19000
  readFile: readFile11,
18868
19001
  readSkillDirectory: readSkillDirectory2,
18869
19002
  playbookLocalRepository,
18870
19003
  lockFileRepository
18871
19004
  } = deps;
18872
- if (!filePath) {
18873
- logErrorConsole(
18874
- "Missing file path. Usage: packmind-cli playbook add <path>"
18875
- );
18876
- exit(1);
18877
- return;
18878
- }
18879
19005
  const absolutePath = path29.resolve(cwd, filePath);
18880
19006
  let artifactType;
18881
19007
  let codingAgent;
@@ -18899,11 +19025,11 @@ async function playbookAddHandler(deps) {
18899
19025
  } else {
18900
19026
  const artefactResult = resolveArtefactFromPath(absolutePath);
18901
19027
  if (!artefactResult) {
18902
- logErrorConsole(
18903
- `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
18904
- );
18905
- exit(1);
18906
- return;
19028
+ return {
19029
+ status: "failed",
19030
+ filePath,
19031
+ message: `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
19032
+ };
18907
19033
  }
18908
19034
  artifactType = artefactResult.artifactType;
18909
19035
  codingAgent = artefactResult.codingAgent;
@@ -18911,11 +19037,11 @@ async function playbookAddHandler(deps) {
18911
19037
  } else {
18912
19038
  const artefactResult = resolveArtefactFromPath(absolutePath);
18913
19039
  if (!artefactResult) {
18914
- logErrorConsole(
18915
- `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
18916
- );
18917
- exit(1);
18918
- return;
19040
+ return {
19041
+ status: "failed",
19042
+ filePath,
19043
+ message: `Unsupported file path: ${absolutePath}. File must be in a recognized artefact directory (command, standard, or skill).`
19044
+ };
18919
19045
  }
18920
19046
  artifactType = artefactResult.artifactType;
18921
19047
  codingAgent = artefactResult.codingAgent;
@@ -18925,9 +19051,7 @@ async function playbookAddHandler(deps) {
18925
19051
  artifactType
18926
19052
  );
18927
19053
  if (!formatValidation.valid) {
18928
- logErrorConsole(formatValidation.reason);
18929
- exit(1);
18930
- return;
19054
+ return { status: "failed", filePath, message: formatValidation.reason };
18931
19055
  }
18932
19056
  let localContent;
18933
19057
  let artifactName;
@@ -18945,21 +19069,20 @@ async function playbookAddHandler(deps) {
18945
19069
  packmindCliHexa,
18946
19070
  lockFileRepository,
18947
19071
  playbookLocalRepository,
18948
- codingAgent,
18949
- exit
19072
+ codingAgent
18950
19073
  });
18951
- if (staged) return;
19074
+ if (staged) return { status: "staged", filePath, artifactType };
18952
19075
  const errorMessage = err instanceof Error ? err.message : String(err);
18953
- logErrorConsole(`Failed to read skill directory: ${errorMessage}`);
18954
- exit(1);
18955
- return;
19076
+ return {
19077
+ status: "failed",
19078
+ filePath,
19079
+ message: `Failed to read skill directory: ${errorMessage}`
19080
+ };
18956
19081
  }
18957
19082
  skillFiles = files;
18958
19083
  const parseResult = parseSkillDirectory(files);
18959
19084
  if (!parseResult.success) {
18960
- logErrorConsole(parseResult.error);
18961
- exit(1);
18962
- return;
19085
+ return { status: "failed", filePath, message: parseResult.error };
18963
19086
  }
18964
19087
  artifactName = parseResult.payload.name;
18965
19088
  serializedContent = yaml2.stringify(parseResult.payload);
@@ -18973,21 +19096,24 @@ async function playbookAddHandler(deps) {
18973
19096
  packmindCliHexa,
18974
19097
  lockFileRepository,
18975
19098
  playbookLocalRepository,
18976
- codingAgent,
18977
- exit
19099
+ codingAgent
18978
19100
  });
18979
- if (staged) return;
19101
+ if (staged) return { status: "staged", filePath, artifactType };
18980
19102
  const errorMessage = err instanceof Error ? err.message : String(err);
18981
- logErrorConsole(`Failed to read file: ${errorMessage}`);
18982
- exit(1);
18983
- return;
19103
+ return {
19104
+ status: "failed",
19105
+ filePath,
19106
+ message: `Failed to read file: ${errorMessage}`
19107
+ };
18984
19108
  }
18985
19109
  if (artifactType === "command") {
18986
19110
  const parseResult = parseCommandFile(localContent, absolutePath);
18987
19111
  if (!parseResult.success) {
18988
- logErrorConsole(`Failed to parse command file: ${parseResult.error}`);
18989
- exit(1);
18990
- return;
19112
+ return {
19113
+ status: "failed",
19114
+ filePath,
19115
+ message: `Failed to parse command file: ${parseResult.error}`
19116
+ };
18991
19117
  }
18992
19118
  artifactName = parseResult.parsed.name;
18993
19119
  } else {
@@ -18997,15 +19123,15 @@ async function playbookAddHandler(deps) {
18997
19123
  } else {
18998
19124
  const lenient = parseLenientStandard(localContent);
18999
19125
  if (!lenient) {
19000
- logErrorConsole(
19001
- `${filePath} is not a valid artifact. Expected format:
19126
+ return {
19127
+ status: "failed",
19128
+ filePath,
19129
+ message: `Not a valid artifact. Expected format:
19002
19130
 
19003
19131
  # My standard name
19004
19132
 
19005
19133
  Content goes here...`
19006
- );
19007
- exit(1);
19008
- return;
19134
+ };
19009
19135
  }
19010
19136
  artifactName = lenient.name;
19011
19137
  }
@@ -19014,11 +19140,11 @@ Content goes here...`
19014
19140
  }
19015
19141
  const targetDir = earlyTargetDir;
19016
19142
  if (!targetDir) {
19017
- logErrorConsole(
19018
- "Not inside a Packmind project. No packmind.json found in any parent directory."
19019
- );
19020
- exit(1);
19021
- return;
19143
+ return {
19144
+ status: "failed",
19145
+ filePath,
19146
+ message: "Not inside a Packmind project. No packmind.json found in any parent directory."
19147
+ };
19022
19148
  }
19023
19149
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
19024
19150
  const configDir = gitRoot ? normalizePath2(path29.relative(gitRoot, targetDir)) : void 0;
@@ -19036,23 +19162,23 @@ Content goes here...`
19036
19162
  const allSpaces = await packmindCliHexa.getSpaces();
19037
19163
  const existingLockEntry = earlyLockFile && findLockFileEntryForPath(normalizedFilePath, earlyLockFile.artifacts);
19038
19164
  if (existingLockEntry && !spaceSlug && !allSpaces.some((s) => s.id === existingLockEntry.spaceId)) {
19039
- logErrorConsole(
19040
- `Cannot add changes to this ${artifactType}: the space it belongs to is not available to you.
19165
+ return {
19166
+ status: "failed",
19167
+ filePath,
19168
+ message: `Cannot add changes to this ${artifactType}: the space it belongs to is not available to you.
19041
19169
  Use --space to stage it as a new artifact in an accessible space:
19042
19170
  ${formatSpaceList(allSpaces)}`
19043
- );
19044
- exit(1);
19045
- return;
19171
+ };
19046
19172
  }
19047
19173
  if (spaceSlug) {
19048
19174
  const matchedSpace = allSpaces.find((s) => s.slug === spaceSlug);
19049
19175
  if (!matchedSpace) {
19050
- logErrorConsole(
19051
- `Space "@${spaceSlug}" not found. Available spaces:
19176
+ return {
19177
+ status: "failed",
19178
+ filePath,
19179
+ message: `Space "@${spaceSlug}" not found. Available spaces:
19052
19180
  ${formatSpaceList(allSpaces)}`
19053
- );
19054
- exit(1);
19055
- return;
19181
+ };
19056
19182
  }
19057
19183
  spaceId = matchedSpace.id;
19058
19184
  spaceName = matchedSpace.name;
@@ -19064,14 +19190,14 @@ ${formatSpaceList(allSpaces)}`
19064
19190
  spaceId = existingLockEntry.spaceId;
19065
19191
  spaceName = allSpaces.find((s) => s.id === spaceId)?.name;
19066
19192
  } else {
19067
- logErrorConsole(
19068
- `Multiple spaces found. Use --space to specify the target space:
19193
+ return {
19194
+ status: "failed",
19195
+ filePath,
19196
+ message: `Multiple spaces found. Use --space to specify the target space:
19069
19197
  ${formatSpaceList(allSpaces)}
19070
19198
 
19071
19199
  Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19072
- );
19073
- exit(1);
19074
- return;
19200
+ };
19075
19201
  }
19076
19202
  }
19077
19203
  let changeType = "created";
@@ -19085,12 +19211,12 @@ Example: packmind-cli playbook add --space ${allSpaces[0].slug} <path>`
19085
19211
  }
19086
19212
  }
19087
19213
  if (changeType === "created" && earlyLockFile && earlyLockFile.agents.length > 0 && !earlyLockFile.agents.includes(codingAgent)) {
19088
- logErrorConsole(
19089
- `Cannot add this ${artifactType}: it is rendered for the "${codingAgent}" agent, which is not in your configured agents (${earlyLockFile.agents.join(", ")}).
19214
+ return {
19215
+ status: "failed",
19216
+ filePath,
19217
+ message: `Cannot add this ${artifactType}: it is rendered for the "${codingAgent}" agent, which is not in your configured agents (${earlyLockFile.agents.join(", ")}).
19090
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.`
19091
- );
19092
- exit(1);
19093
- return;
19219
+ };
19094
19220
  }
19095
19221
  if (changeType === "updated" && existingLockEntry) {
19096
19222
  try {
@@ -19101,18 +19227,20 @@ This file is no longer managed by Packmind. Re-add "${codingAgent}" to your agen
19101
19227
  existingLockEntry.spaceId
19102
19228
  );
19103
19229
  if (existingLockEntry.version < remoteVersion) {
19104
- logErrorConsole(
19105
- `"${artifactName}" is outdated (local: v${existingLockEntry.version}, remote: v${remoteVersion}).
19230
+ return {
19231
+ status: "failed",
19232
+ filePath,
19233
+ message: `"${artifactName}" is outdated (local: v${existingLockEntry.version}, remote: v${remoteVersion}).
19106
19234
  Run ${formatLabel("packmind-cli install")} to update before making changes.`
19107
- );
19108
- exit(1);
19109
- return;
19235
+ };
19110
19236
  }
19111
19237
  } catch (err) {
19112
19238
  const errorMessage = err instanceof Error ? err.message : String(err);
19113
- logErrorConsole(`Failed to check artifact version: ${errorMessage}`);
19114
- exit(1);
19115
- return;
19239
+ return {
19240
+ status: "failed",
19241
+ filePath,
19242
+ message: `Failed to check artifact version: ${errorMessage}`
19243
+ };
19116
19244
  }
19117
19245
  }
19118
19246
  if (changeType === "created") {
@@ -19126,11 +19254,11 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19126
19254
  );
19127
19255
  } catch (err) {
19128
19256
  const errorMessage = err instanceof Error ? err.message : String(err);
19129
- logErrorConsole(
19130
- `Failed to check for existing ${artifactType}s: ${errorMessage}`
19131
- );
19132
- exit(1);
19133
- return;
19257
+ return {
19258
+ status: "failed",
19259
+ filePath,
19260
+ message: `Failed to check for existing ${artifactType}s: ${errorMessage}`
19261
+ };
19134
19262
  }
19135
19263
  if (existingArtifact) {
19136
19264
  let remoteVersion;
@@ -19143,11 +19271,11 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19143
19271
  ));
19144
19272
  } catch (err) {
19145
19273
  const errorMessage = err instanceof Error ? err.message : String(err);
19146
- logErrorConsole(
19147
- `Failed to link "${existingArtifact.name}" to the existing ${artifactType}: ${errorMessage}`
19148
- );
19149
- exit(1);
19150
- return;
19274
+ return {
19275
+ status: "failed",
19276
+ filePath,
19277
+ message: `Failed to link "${existingArtifact.name}" to the existing ${artifactType}: ${errorMessage}`
19278
+ };
19151
19279
  }
19152
19280
  const adoptedFilePath = artifactType === "skill" ? `${normalizedFilePath}/SKILL.md` : normalizedFilePath;
19153
19281
  activeLockFile = adoptArtifactIntoLockFile({
@@ -19187,8 +19315,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19187
19315
  });
19188
19316
  if (allMatch) {
19189
19317
  logInfoConsole("Already up to date \u2014 local content matches deployed.");
19190
- exit(0);
19191
- return;
19318
+ return { status: "skipped", filePath, artifactType };
19192
19319
  }
19193
19320
  } else {
19194
19321
  const deployedFile = deployedFiles.find(
@@ -19196,8 +19323,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19196
19323
  );
19197
19324
  if (deployedFile && deployedFile.content?.trim() === localContent.trim()) {
19198
19325
  logInfoConsole("Already up to date \u2014 local content matches deployed.");
19199
- exit(0);
19200
- return;
19326
+ return { status: "skipped", filePath, artifactType };
19201
19327
  }
19202
19328
  }
19203
19329
  }
@@ -19218,25 +19344,55 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
19218
19344
  logSuccessConsole(
19219
19345
  `Staged "${artifactName}" (${artifactType}, ${changeType}) to playbook${spaceInfo}. ${formatLabel(codingAgent)}`
19220
19346
  );
19221
- logInfoConsole(
19222
- `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
19223
- );
19224
- exit(0);
19347
+ return { status: "staged", filePath, artifactType };
19225
19348
  }
19226
19349
  function formatSpaceList(spaces) {
19227
19350
  const maxSlugLength = Math.max(...spaces.map((s) => s.slug.length));
19228
19351
  return spaces.map((s) => ` ${s.slug.padEnd(maxSlugLength)} (${s.name})`).join("\n");
19229
19352
  }
19230
19353
 
19354
+ // apps/cli/src/infra/commands/playbook/addHandler.ts
19355
+ async function playbookAddHandler(deps) {
19356
+ const { filePaths, exit, ...rest } = deps;
19357
+ if (filePaths.length === 0) {
19358
+ logErrorConsole(
19359
+ "No path provided. Usage: packmind-cli playbook add <paths...>"
19360
+ );
19361
+ exit(1);
19362
+ return;
19363
+ }
19364
+ const outcomes = [];
19365
+ for (const filePath of filePaths) {
19366
+ const outcome = await stageSinglePath({ ...rest, filePath });
19367
+ outcomes.push(outcome);
19368
+ if (outcome.status === "failed") {
19369
+ logErrorConsole(`${filePath}: ${outcome.message ?? "failed to stage"}`);
19370
+ }
19371
+ }
19372
+ const failedCount = outcomes.filter((o) => o.status === "failed").length;
19373
+ const stagedCount = outcomes.filter((o) => o.status === "staged").length;
19374
+ if (filePaths.length > 1) {
19375
+ logInfoConsole(
19376
+ `${stagedCount} staged, ${failedCount} failed of ${filePaths.length}.`
19377
+ );
19378
+ }
19379
+ if (stagedCount > 0) {
19380
+ logInfoConsole(
19381
+ `Run ${formatLabel("packmind playbook submit")} when you're ready to publish your changes.`
19382
+ );
19383
+ }
19384
+ exit(failedCount > 0 ? 1 : 0);
19385
+ }
19386
+
19231
19387
  // apps/cli/src/infra/commands/playbook/AddCommand.ts
19232
19388
  var addPlaybookCommand = (0, import_cmd_ts23.command)({
19233
19389
  name: "add",
19234
- description: "Stage a local artifact change",
19390
+ description: "Stage one or more local artifact changes",
19235
19391
  args: {
19236
- filePath: (0, import_cmd_ts23.positional)({
19392
+ filePaths: (0, import_cmd_ts23.restPositionals)({
19237
19393
  type: import_cmd_ts23.string,
19238
- displayName: "path",
19239
- description: "Path to the artifact file or directory to stage"
19394
+ displayName: "paths",
19395
+ description: "Paths to the artifact files or directories to stage"
19240
19396
  }),
19241
19397
  space: (0, import_cmd_ts23.option)({
19242
19398
  type: (0, import_cmd_ts23.optional)(SpaceSlug),
@@ -19244,7 +19400,7 @@ var addPlaybookCommand = (0, import_cmd_ts23.command)({
19244
19400
  description: "Target space slug"
19245
19401
  })
19246
19402
  },
19247
- handler: async ({ filePath, space }) => {
19403
+ handler: async ({ filePaths, space }) => {
19248
19404
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
19249
19405
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
19250
19406
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(
@@ -19255,7 +19411,7 @@ var addPlaybookCommand = (0, import_cmd_ts23.command)({
19255
19411
  const lockFileRepository = new LockFileRepository();
19256
19412
  await playbookAddHandler({
19257
19413
  packmindCliHexa,
19258
- filePath,
19414
+ filePaths,
19259
19415
  spaceSlug: space,
19260
19416
  exit: process.exit,
19261
19417
  cwd: process.cwd(),
@@ -19875,6 +20031,9 @@ var path35 = __toESM(require("path"));
19875
20031
 
19876
20032
  // apps/cli/src/infra/commands/playbook/submit/duplicateNameChecker.ts
19877
20033
  var import_slug5 = __toESM(require("slug"));
20034
+ function duplicateNameKey(entry) {
20035
+ return `${entry.spaceId}:${entry.artifactType}:${(0, import_slug5.default)(entry.artifactName)}`;
20036
+ }
19878
20037
  async function checkForDuplicateNames(createdEntries, packmindGateway) {
19879
20038
  const errors = [];
19880
20039
  const groups = /* @__PURE__ */ new Map();
@@ -19889,9 +20048,12 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
19889
20048
  for (const entry of entries) {
19890
20049
  const sluggedName = (0, import_slug5.default)(entry.artifactName);
19891
20050
  if (seen.has(sluggedName)) {
19892
- errors.push(
19893
- `A ${entry.artifactType} named "${entry.artifactName}" is staged multiple times. Remove the duplicate with "playbook unstage" or rename the artifact.`
19894
- );
20051
+ errors.push({
20052
+ spaceId: entry.spaceId,
20053
+ artifactType: entry.artifactType,
20054
+ artifactName: entry.artifactName,
20055
+ message: `A ${entry.artifactType} named "${entry.artifactName}" is staged multiple times. Remove the duplicate with "playbook unstage" or rename the artifact.`
20056
+ });
19895
20057
  } else {
19896
20058
  seen.set(sluggedName, entry.artifactName);
19897
20059
  }
@@ -19921,9 +20083,12 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
19921
20083
  const existingNamesSlugged = new Set(existingNames.map((n) => (0, import_slug5.default)(n)));
19922
20084
  for (const entry of entries) {
19923
20085
  if (existingNamesSlugged.has((0, import_slug5.default)(entry.artifactName))) {
19924
- errors.push(
19925
- `A ${entry.artifactType} named "${entry.artifactName}" already exists in this space. Use "playbook unstage" to remove it or rename the artifact.`
19926
- );
20086
+ errors.push({
20087
+ spaceId: entry.spaceId,
20088
+ artifactType: entry.artifactType,
20089
+ artifactName: entry.artifactName,
20090
+ message: `A ${entry.artifactType} named "${entry.artifactName}" already exists in this space. Use "playbook unstage" to remove it or rename the artifact.`
20091
+ });
19927
20092
  }
19928
20093
  }
19929
20094
  } catch {
@@ -20743,13 +20908,42 @@ async function playbookSubmitHandler(deps) {
20743
20908
  exit(0);
20744
20909
  return;
20745
20910
  }
20911
+ const createdEntries = changes.filter((c) => c.changeType === "created");
20912
+ const conflictingKeys = /* @__PURE__ */ new Set();
20913
+ if (createdEntries.length > 0) {
20914
+ const duplicateErrors = await checkForDuplicateNames(
20915
+ createdEntries,
20916
+ packmindCliHexa.getPackmindGateway()
20917
+ );
20918
+ for (const error of duplicateErrors) {
20919
+ logErrorConsole(error.message);
20920
+ conflictingKeys.add(duplicateNameKey(error));
20921
+ }
20922
+ }
20923
+ const submittableChanges = changes.filter(
20924
+ (c) => !(c.changeType === "created" && conflictingKeys.has(duplicateNameKey(c)))
20925
+ );
20926
+ const conflictCount = changes.length - submittableChanges.length;
20927
+ const reportSkippedConflicts = () => {
20928
+ if (conflictCount === 0) return;
20929
+ logInfoConsole(
20930
+ `${conflictCount} change${conflictCount !== 1 ? "s were" : " was"} skipped and remain${conflictCount !== 1 ? "" : "s"} staged. Rename them and run \`packmind playbook submit\` again.`
20931
+ );
20932
+ };
20933
+ if (submittableChanges.length === 0) {
20934
+ logErrorConsole(
20935
+ "Nothing to submit: every staged change has a name conflict."
20936
+ );
20937
+ exit(1);
20938
+ return;
20939
+ }
20746
20940
  let resolvedMessage;
20747
20941
  if (message) {
20748
20942
  resolvedMessage = message;
20749
20943
  } else if (noReview) {
20750
20944
  resolvedMessage = "";
20751
20945
  } else {
20752
- const prefill = buildEditorPrefill(changes);
20946
+ const prefill = buildEditorPrefill(submittableChanges);
20753
20947
  const editorResult = openEditor(prefill);
20754
20948
  if (!editorResult) {
20755
20949
  logErrorConsole("Aborting: empty message.");
@@ -20764,20 +20958,6 @@ async function playbookSubmitHandler(deps) {
20764
20958
  }
20765
20959
  resolvedMessage = stripped;
20766
20960
  }
20767
- const createdEntries = changes.filter((c) => c.changeType === "created");
20768
- if (createdEntries.length > 0) {
20769
- const duplicateErrors = await checkForDuplicateNames(
20770
- createdEntries,
20771
- packmindCliHexa.getPackmindGateway()
20772
- );
20773
- if (duplicateErrors.length > 0) {
20774
- for (const error of duplicateErrors) {
20775
- logErrorConsole(error);
20776
- }
20777
- exit(1);
20778
- return;
20779
- }
20780
- }
20781
20961
  const resolver = await createTargetContextResolver({
20782
20962
  lockFileRepository,
20783
20963
  cwd,
@@ -20787,7 +20967,7 @@ async function playbookSubmitHandler(deps) {
20787
20967
  proposals: allProposals,
20788
20968
  conflicts,
20789
20969
  skipped
20790
- } = await buildProposals(changes, resolver.getTargetContext);
20970
+ } = await buildProposals(submittableChanges, resolver.getTargetContext);
20791
20971
  const descriptionErrors = validateProposalSkillDescriptions(allProposals);
20792
20972
  if (descriptionErrors.length > 0) {
20793
20973
  for (const error of descriptionErrors) {
@@ -20831,10 +21011,11 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20831
21011
  logConsole(
20832
21012
  "Nothing to submit \u2014 no changes detected compared to deployed versions."
20833
21013
  );
20834
- for (const entry of changes) {
21014
+ for (const entry of submittableChanges) {
20835
21015
  playbookLocalRepository.removeChange(entry.filePath, entry.spaceId);
20836
21016
  }
20837
- exit(0);
21017
+ reportSkippedConflicts();
21018
+ exit(conflictCount > 0 ? 1 : 0);
20838
21019
  return;
20839
21020
  }
20840
21021
  const removalPackageIds = /* @__PURE__ */ new Set();
@@ -20847,7 +21028,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20847
21028
  }
20848
21029
  }
20849
21030
  const filePathsBySpaceId = /* @__PURE__ */ new Map();
20850
- for (const entry of changes) {
21031
+ for (const entry of submittableChanges) {
20851
21032
  const existing = filePathsBySpaceId.get(entry.spaceId) ?? /* @__PURE__ */ new Set();
20852
21033
  existing.add(entry.filePath);
20853
21034
  filePathsBySpaceId.set(entry.spaceId, existing);
@@ -20871,7 +21052,8 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20871
21052
  );
20872
21053
  if (applyProposals.length === 0) {
20873
21054
  logConsole("Nothing to apply directly.");
20874
- exit(0);
21055
+ reportSkippedConflicts();
21056
+ exit(conflictCount > 0 ? 1 : 0);
20875
21057
  return;
20876
21058
  }
20877
21059
  let response;
@@ -20935,11 +21117,12 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20935
21117
  createdSpaceIds
20936
21118
  );
20937
21119
  logPackageAddGuidance(response.created, packageSlugs);
20938
- exit(0);
21120
+ reportSkippedConflicts();
21121
+ exit(conflictCount > 0 ? 1 : 0);
20939
21122
  return;
20940
21123
  }
20941
21124
  const spaceNameById = /* @__PURE__ */ new Map();
20942
- for (const change of changes) {
21125
+ for (const change of submittableChanges) {
20943
21126
  if (change.spaceName && !spaceNameById.has(change.spaceId)) {
20944
21127
  spaceNameById.set(change.spaceId, change.spaceName);
20945
21128
  }
@@ -20978,7 +21161,9 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
20978
21161
  totalSkipped += response.skipped;
20979
21162
  if (response.errors.length > 0) {
20980
21163
  const filePaths = filePathsBySpaceId.get(spaceId) ?? /* @__PURE__ */ new Set();
20981
- const spaceChanges = changes.filter((c) => filePaths.has(c.filePath));
21164
+ const spaceChanges = submittableChanges.filter(
21165
+ (c) => filePaths.has(c.filePath)
21166
+ );
20982
21167
  const allRemovals = spaceChanges.length > 0 && spaceChanges.every((c) => c.changeType === "removed");
20983
21168
  const allSpaceNotFound = response.errors.every(
20984
21169
  (e) => e.code === "SpaceNotFoundError"
@@ -21018,7 +21203,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21018
21203
  for (const filePath of filePaths) {
21019
21204
  playbookLocalRepository.removeChange(filePath, spaceId);
21020
21205
  }
21021
- const removedEntries = changes.filter(
21206
+ const removedEntries = submittableChanges.filter(
21022
21207
  (c) => c.changeType === "removed" && filePaths.has(c.filePath)
21023
21208
  );
21024
21209
  for (const entry of removedEntries) {
@@ -21072,7 +21257,8 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
21072
21257
  if (totalCreated > 0) {
21073
21258
  await logReviewUrls(packmindCliHexa, succeededSpaces);
21074
21259
  }
21075
- exit(0);
21260
+ reportSkippedConflicts();
21261
+ exit(conflictCount > 0 ? 1 : 0);
21076
21262
  }
21077
21263
 
21078
21264
  // apps/cli/src/infra/utils/editorMessage.ts
@@ -22190,6 +22376,31 @@ var initCommand = (0, import_cmd_ts38.command)({
22190
22376
  // apps/cli/src/infra/commands/TrackCommand.ts
22191
22377
  var import_cmd_ts39 = __toESM(require_cjs());
22192
22378
 
22379
+ // apps/cli/src/infra/commands/trackingErrors.ts
22380
+ function handleTrackingError(error) {
22381
+ if (error instanceof NotLoggedInError) {
22382
+ logErrorConsole(error.message);
22383
+ process.exit(1);
22384
+ return;
22385
+ }
22386
+ const statusCode = error?.statusCode;
22387
+ if (statusCode === 404) {
22388
+ logErrorConsole("Repository tracking is not available for your account.");
22389
+ process.exit(1);
22390
+ return;
22391
+ }
22392
+ if (statusCode === 403) {
22393
+ logErrorConsole(
22394
+ "Only organization admins can change which repository Packmind tracks. Ask an admin of your organization to run this command."
22395
+ );
22396
+ process.exit(1);
22397
+ return;
22398
+ }
22399
+ const message = error instanceof Error ? error.message : String(error);
22400
+ logErrorConsole(message);
22401
+ process.exit(1);
22402
+ }
22403
+
22193
22404
  // apps/cli/src/infra/commands/trackHandler.ts
22194
22405
  async function trackHandler(deps) {
22195
22406
  const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
@@ -22203,10 +22414,12 @@ async function trackHandler(deps) {
22203
22414
  repoPath: deps.baseDirectory,
22204
22415
  origin: "track",
22205
22416
  update: deps.update,
22417
+ remove: false,
22418
+ branch: deps.branch,
22206
22419
  confirm
22207
22420
  });
22208
22421
  } catch (error) {
22209
- handleTrackError(error);
22422
+ handleTrackingError(error);
22210
22423
  return;
22211
22424
  }
22212
22425
  switch (result.status) {
@@ -22226,18 +22439,14 @@ async function trackHandler(deps) {
22226
22439
  logInfoConsole("No changes made. The tracked branch is unchanged.");
22227
22440
  process.exit(0);
22228
22441
  return;
22442
+ // The desired state is already in place, whether or not --update was
22443
+ // passed, so both spellings succeed. Exit codes follow one rule: 0 when
22444
+ // the desired state holds, 1 when it cannot be reached.
22229
22445
  case "already-tracked-same-branch":
22230
- if (deps.update) {
22231
- logErrorConsole(
22232
- `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22233
- );
22234
- process.exit(1);
22235
- } else {
22236
- logInfoConsole(
22237
- `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22238
- );
22239
- process.exit(0);
22240
- }
22446
+ logInfoConsole(
22447
+ `Repository ${result.owner}/${result.repo} is already tracked on branch ${result.branch}.`
22448
+ );
22449
+ process.exit(0);
22241
22450
  return;
22242
22451
  case "already-tracked-other-branch":
22243
22452
  logErrorConsole(
@@ -22253,24 +22462,10 @@ async function trackHandler(deps) {
22253
22462
  );
22254
22463
  process.exit(1);
22255
22464
  return;
22465
+ default:
22466
+ return;
22256
22467
  }
22257
22468
  }
22258
- function handleTrackError(error) {
22259
- if (error instanceof NotLoggedInError) {
22260
- logErrorConsole(error.message);
22261
- process.exit(1);
22262
- return;
22263
- }
22264
- const statusCode = error?.statusCode;
22265
- if (statusCode === 404) {
22266
- logErrorConsole("Repository tracking is not available for your account.");
22267
- process.exit(1);
22268
- return;
22269
- }
22270
- const message = error instanceof Error ? error.message : String(error);
22271
- logErrorConsole(message);
22272
- process.exit(1);
22273
- }
22274
22469
 
22275
22470
  // apps/cli/src/infra/commands/TrackCommand.ts
22276
22471
  var trackCommand = (0, import_cmd_ts39.command)({
@@ -22280,27 +22475,91 @@ var trackCommand = (0, import_cmd_ts39.command)({
22280
22475
  update: (0, import_cmd_ts39.flag)({
22281
22476
  long: "update",
22282
22477
  description: "Move the tracked branch to the current branch (requires an existing tracked branch)"
22478
+ }),
22479
+ branch: (0, import_cmd_ts39.option)({
22480
+ type: (0, import_cmd_ts39.optional)(import_cmd_ts39.string),
22481
+ long: "branch",
22482
+ description: "Branch to track (defaults to the branch currently checked out)"
22283
22483
  })
22284
22484
  },
22285
- handler: async ({ update }) => {
22485
+ handler: async ({ update, branch }) => {
22286
22486
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22287
22487
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22288
22488
  await trackHandler({
22289
22489
  update,
22490
+ branch,
22290
22491
  baseDirectory: process.cwd(),
22291
22492
  trackRepository: packmindCliHexa.trackRepository.bind(packmindCliHexa)
22292
22493
  });
22293
22494
  }
22294
22495
  });
22295
22496
 
22296
- // apps/cli/src/infra/commands/UpdateCommand.ts
22497
+ // apps/cli/src/infra/commands/UntrackCommand.ts
22297
22498
  var import_cmd_ts40 = __toESM(require_cjs());
22499
+
22500
+ // apps/cli/src/infra/commands/untrackHandler.ts
22501
+ async function untrackHandler(deps) {
22502
+ const isTTY = deps.isTTY ?? Boolean(process.stdin.isTTY);
22503
+ const confirm = createTrackConfirm({
22504
+ isTTY,
22505
+ confirmPrompt: deps.confirmPrompt
22506
+ });
22507
+ let result;
22508
+ try {
22509
+ result = await deps.trackRepository({
22510
+ repoPath: deps.baseDirectory,
22511
+ origin: "track",
22512
+ update: false,
22513
+ remove: true,
22514
+ confirm
22515
+ });
22516
+ } catch (error) {
22517
+ handleTrackingError(error);
22518
+ return;
22519
+ }
22520
+ switch (result.status) {
22521
+ case "removed":
22522
+ logSuccessConsole(
22523
+ `Packmind no longer tracks ${result.owner}/${result.repo}. Distributions recorded on branch ${result.branch} are kept and reappear if you track it again.`
22524
+ );
22525
+ process.exit(0);
22526
+ return;
22527
+ case "not-tracked":
22528
+ logWarningConsole(
22529
+ `Repository is not tracked in '${result.organizationName}' organization`
22530
+ );
22531
+ process.exit(0);
22532
+ return;
22533
+ default:
22534
+ logInfoConsole("No changes made. The tracked branch is unchanged.");
22535
+ process.exit(0);
22536
+ return;
22537
+ }
22538
+ }
22539
+
22540
+ // apps/cli/src/infra/commands/UntrackCommand.ts
22541
+ var untrackCommand = (0, import_cmd_ts40.command)({
22542
+ name: "untrack",
22543
+ description: "Remove Packmind's tracking of the current repository (keeps every recorded distribution)",
22544
+ args: {},
22545
+ handler: async () => {
22546
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
22547
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
22548
+ await untrackHandler({
22549
+ baseDirectory: process.cwd(),
22550
+ trackRepository: packmindCliHexa.trackRepository.bind(packmindCliHexa)
22551
+ });
22552
+ }
22553
+ });
22554
+
22555
+ // apps/cli/src/infra/commands/UpdateCommand.ts
22556
+ var import_cmd_ts41 = __toESM(require_cjs());
22298
22557
  var { version: CLI_VERSION6 } = require_package();
22299
- var updateCommand = (0, import_cmd_ts40.command)({
22558
+ var updateCommand = (0, import_cmd_ts41.command)({
22300
22559
  name: "update",
22301
22560
  description: "Update packmind-cli to the latest version",
22302
22561
  args: {
22303
- check: (0, import_cmd_ts40.flag)({
22562
+ check: (0, import_cmd_ts41.flag)({
22304
22563
  long: "check",
22305
22564
  description: "Only check if a newer version is available without performing the update"
22306
22565
  })
@@ -22358,7 +22617,7 @@ if (args.includes("--version") || args.includes("-v")) {
22358
22617
  logConsole(`packmind-cli version ${CLI_VERSION7}`);
22359
22618
  process.exit(0);
22360
22619
  }
22361
- var app = (0, import_cmd_ts41.subcommands)({
22620
+ var app = (0, import_cmd_ts42.subcommands)({
22362
22621
  name: "packmind-cli",
22363
22622
  description: "Packmind CLI tool",
22364
22623
  cmds: {
@@ -22377,11 +22636,12 @@ var app = (0, import_cmd_ts41.subcommands)({
22377
22636
  standards: standardsCommand,
22378
22637
  track: trackCommand,
22379
22638
  uninstall: uninstallCommand,
22639
+ untrack: untrackCommand,
22380
22640
  update: updateCommand,
22381
22641
  whoami: whoamiCommand
22382
22642
  }
22383
22643
  });
22384
- (0, import_cmd_ts41.run)(app, args).catch((error) => {
22644
+ (0, import_cmd_ts42.run)(app, args).catch((error) => {
22385
22645
  logErrorConsole(error.message);
22386
22646
  process.exit(1);
22387
22647
  });