@packmind/cli 0.13.0 → 0.14.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 +1177 -305
  2. package/package.json +3 -2
package/main.cjs CHANGED
@@ -371,32 +371,32 @@ var init_supports_color = __esm({
371
371
  });
372
372
 
373
373
  // node_modules/chalk/source/utilities.js
374
- function stringReplaceAll(string6, substring, replacer) {
375
- let index = string6.indexOf(substring);
374
+ function stringReplaceAll(string8, substring, replacer) {
375
+ let index = string8.indexOf(substring);
376
376
  if (index === -1) {
377
- return string6;
377
+ return string8;
378
378
  }
379
379
  const substringLength = substring.length;
380
380
  let endIndex = 0;
381
381
  let returnValue = "";
382
382
  do {
383
- returnValue += string6.slice(endIndex, index) + substring + replacer;
383
+ returnValue += string8.slice(endIndex, index) + substring + replacer;
384
384
  endIndex = index + substringLength;
385
- index = string6.indexOf(substring, endIndex);
385
+ index = string8.indexOf(substring, endIndex);
386
386
  } while (index !== -1);
387
- returnValue += string6.slice(endIndex);
387
+ returnValue += string8.slice(endIndex);
388
388
  return returnValue;
389
389
  }
390
- function stringEncaseCRLFWithFirstIndex(string6, prefix, postfix, index) {
390
+ function stringEncaseCRLFWithFirstIndex(string8, prefix, postfix, index) {
391
391
  let endIndex = 0;
392
392
  let returnValue = "";
393
393
  do {
394
- const gotCR = string6[index - 1] === "\r";
395
- returnValue += string6.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
394
+ const gotCR = string8[index - 1] === "\r";
395
+ returnValue += string8.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
396
396
  endIndex = index + 1;
397
- index = string6.indexOf("\n", endIndex);
397
+ index = string8.indexOf("\n", endIndex);
398
398
  } while (index !== -1);
399
- returnValue += string6.slice(endIndex);
399
+ returnValue += string8.slice(endIndex);
400
400
  return returnValue;
401
401
  }
402
402
  var init_utilities = __esm({
@@ -555,26 +555,26 @@ var init_source = __esm({
555
555
  builder[IS_EMPTY] = _isEmpty;
556
556
  return builder;
557
557
  };
558
- applyStyle = (self, string6) => {
559
- if (self.level <= 0 || !string6) {
560
- return self[IS_EMPTY] ? "" : string6;
558
+ applyStyle = (self, string8) => {
559
+ if (self.level <= 0 || !string8) {
560
+ return self[IS_EMPTY] ? "" : string8;
561
561
  }
562
562
  let styler = self[STYLER];
563
563
  if (styler === void 0) {
564
- return string6;
564
+ return string8;
565
565
  }
566
566
  const { openAll, closeAll } = styler;
567
- if (string6.includes("\x1B")) {
567
+ if (string8.includes("\x1B")) {
568
568
  while (styler !== void 0) {
569
- string6 = stringReplaceAll(string6, styler.close, styler.open);
569
+ string8 = stringReplaceAll(string8, styler.close, styler.open);
570
570
  styler = styler.parent;
571
571
  }
572
572
  }
573
- const lfIndex = string6.indexOf("\n");
573
+ const lfIndex = string8.indexOf("\n");
574
574
  if (lfIndex !== -1) {
575
- string6 = stringEncaseCRLFWithFirstIndex(string6, closeAll, openAll, lfIndex);
575
+ string8 = stringEncaseCRLFWithFirstIndex(string8, closeAll, openAll, lfIndex);
576
576
  }
577
- return openAll + string6 + closeAll;
577
+ return openAll + string8 + closeAll;
578
578
  };
579
579
  Object.defineProperties(createChalk.prototype, styles2);
580
580
  chalk = createChalk();
@@ -1255,7 +1255,7 @@ var require_positional = __commonJS({
1255
1255
  return mod && mod.__esModule ? mod : { "default": mod };
1256
1256
  };
1257
1257
  Object.defineProperty(exports2, "__esModule", { value: true });
1258
- exports2.positional = positional3;
1258
+ exports2.positional = positional5;
1259
1259
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1260
1260
  var Result = __importStar(require_Result());
1261
1261
  var types_1 = require_types();
@@ -1295,8 +1295,8 @@ var require_positional = __commonJS({
1295
1295
  var _a2;
1296
1296
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
1297
1297
  const defaultValueFn = (_a2 = config.defaultValue) !== null && _a2 !== void 0 ? _a2 : config.type.defaultValue;
1298
- const positional4 = positionals[0];
1299
- if (!positional4) {
1298
+ const positional6 = positionals[0];
1299
+ if (!positional6) {
1300
1300
  if (defaultValueFn) {
1301
1301
  return Result.ok(defaultValueFn());
1302
1302
  }
@@ -1309,13 +1309,13 @@ var require_positional = __commonJS({
1309
1309
  ]
1310
1310
  });
1311
1311
  }
1312
- visitedNodes.add(positional4);
1313
- const decoded = await Result.safeAsync(config.type.from(positional4.raw));
1312
+ visitedNodes.add(positional6);
1313
+ const decoded = await Result.safeAsync(config.type.from(positional6.raw));
1314
1314
  if (Result.isErr(decoded)) {
1315
1315
  return Result.err({
1316
1316
  errors: [
1317
1317
  {
1318
- nodes: [positional4],
1318
+ nodes: [positional6],
1319
1319
  message: decoded.error.message
1320
1320
  }
1321
1321
  ]
@@ -1325,7 +1325,7 @@ var require_positional = __commonJS({
1325
1325
  }
1326
1326
  };
1327
1327
  }
1328
- function positional3(config) {
1328
+ function positional5(config) {
1329
1329
  return fullPositional({
1330
1330
  type: types_1.string,
1331
1331
  ...config
@@ -1379,13 +1379,13 @@ var require_subcommands = __commonJS({
1379
1379
  return mod && mod.__esModule ? mod : { "default": mod };
1380
1380
  };
1381
1381
  Object.defineProperty(exports2, "__esModule", { value: true });
1382
- exports2.subcommands = subcommands3;
1382
+ exports2.subcommands = subcommands5;
1383
1383
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1384
1384
  var didyoumean_1 = __importDefault(require_didYouMean_1_2_1());
1385
1385
  var Result = __importStar(require_Result());
1386
1386
  var circuitbreaker_1 = require_circuitbreaker();
1387
1387
  var positional_1 = require_positional();
1388
- function subcommands3(config) {
1388
+ function subcommands5(config) {
1389
1389
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1390
1390
  const type = {
1391
1391
  async from(str) {
@@ -1578,11 +1578,11 @@ var strip_ansi_exports = {};
1578
1578
  __export(strip_ansi_exports, {
1579
1579
  default: () => stripAnsi
1580
1580
  });
1581
- function stripAnsi(string6) {
1582
- if (typeof string6 !== "string") {
1583
- throw new TypeError(`Expected a \`string\`, got \`${typeof string6}\``);
1581
+ function stripAnsi(string8) {
1582
+ if (typeof string8 !== "string") {
1583
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string8}\``);
1584
1584
  }
1585
- return string6.replace(regex, "");
1585
+ return string8.replace(regex, "");
1586
1586
  }
1587
1587
  var regex;
1588
1588
  var init_strip_ansi = __esm({
@@ -1698,12 +1698,12 @@ var require_command = __commonJS({
1698
1698
  return mod && mod.__esModule ? mod : { "default": mod };
1699
1699
  };
1700
1700
  Object.defineProperty(exports2, "__esModule", { value: true });
1701
- exports2.command = command9;
1701
+ exports2.command = command12;
1702
1702
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1703
1703
  var Result = __importStar(require_Result());
1704
1704
  var circuitbreaker_1 = require_circuitbreaker();
1705
1705
  var utils_1 = require_utils();
1706
- function command9(config) {
1706
+ function command12(config) {
1707
1707
  const argEntries = (0, utils_1.entries)(config.args);
1708
1708
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1709
1709
  return {
@@ -3084,8 +3084,8 @@ var require_tokenizer = __commonJS({
3084
3084
  tokens.push(token);
3085
3085
  overallIndex += token.raw.length;
3086
3086
  };
3087
- for (const [stringIndex, string6] of (0, utils_1.enumerate)(strings)) {
3088
- const chars = [...string6];
3087
+ for (const [stringIndex, string8] of (0, utils_1.enumerate)(strings)) {
3088
+ const chars = [...string8];
3089
3089
  for (let i = 0; i < chars.length; i++) {
3090
3090
  if (chars[i] === "-" && chars[i + 1] === "-") {
3091
3091
  push({ type: "longPrefix", raw: "--", index: overallIndex });
@@ -3241,14 +3241,14 @@ var require_restPositionals = __commonJS({
3241
3241
  const positionals = nodes.filter((node) => node.type === "positionalArgument" && !visitedNodes.has(node));
3242
3242
  const results = [];
3243
3243
  const errors = [];
3244
- for (const positional3 of positionals) {
3245
- visitedNodes.add(positional3);
3246
- const decoded = await Result.safeAsync(config.type.from(positional3.raw));
3244
+ for (const positional5 of positionals) {
3245
+ visitedNodes.add(positional5);
3246
+ const decoded = await Result.safeAsync(config.type.from(positional5.raw));
3247
3247
  if (Result.isOk(decoded)) {
3248
3248
  results.push(decoded.value);
3249
3249
  } else {
3250
3250
  errors.push({
3251
- nodes: [positional3],
3251
+ nodes: [positional5],
3252
3252
  message: decoded.error.message
3253
3253
  });
3254
3254
  }
@@ -3852,7 +3852,7 @@ var require_package = __commonJS({
3852
3852
  "apps/cli/package.json"(exports2, module2) {
3853
3853
  module2.exports = {
3854
3854
  name: "@packmind/cli",
3855
- version: "0.13.0",
3855
+ version: "0.14.0",
3856
3856
  description: "A command-line interface for Packmind linting and code quality checks",
3857
3857
  private: false,
3858
3858
  bin: {
@@ -3887,14 +3887,15 @@ var require_package = __commonJS({
3887
3887
  },
3888
3888
  dependencies: {
3889
3889
  "@types/inquirer": "^9.0.9",
3890
- inquirer: "^13.0.2"
3890
+ inquirer: "^13.0.2",
3891
+ zod: "^4.3.5"
3891
3892
  }
3892
3893
  };
3893
3894
  }
3894
3895
  });
3895
3896
 
3896
3897
  // apps/cli/src/main.ts
3897
- var import_cmd_ts10 = __toESM(require_cjs());
3898
+ var import_cmd_ts15 = __toESM(require_cjs());
3898
3899
 
3899
3900
  // apps/cli/src/infra/commands/LinterCommand.ts
3900
3901
  var import_cmd_ts = __toESM(require_cjs());
@@ -4048,6 +4049,13 @@ var AnonymousTrialAccountActivatedEvent = class extends UserEvent {
4048
4049
  }
4049
4050
  };
4050
4051
 
4052
+ // packages/types/src/accounts/events/OrganizationCreatedEvent.ts
4053
+ var OrganizationCreatedEvent = class extends UserEvent {
4054
+ static {
4055
+ this.eventName = "accounts.organization.created";
4056
+ }
4057
+ };
4058
+
4051
4059
  // packages/types/src/accounts/TrialActivationToken.ts
4052
4060
  var createTrialActivationTokenId = brandedIdFactory();
4053
4061
  var createTrialActivationToken = brandedIdFactory();
@@ -4195,6 +4203,13 @@ var RuleAddedEvent = class extends UserEvent {
4195
4203
  }
4196
4204
  };
4197
4205
 
4206
+ // packages/types/src/standards/events/RuleDeletedEvent.ts
4207
+ var RuleDeletedEvent = class extends UserEvent {
4208
+ static {
4209
+ this.eventName = "standards.rule.deleted";
4210
+ }
4211
+ };
4212
+
4198
4213
  // packages/types/src/standards/events/RuleUpdatedEvent.ts
4199
4214
  var RuleUpdatedEvent = class extends UserEvent {
4200
4215
  static {
@@ -4728,6 +4743,17 @@ function createUserContextChangeEvent(userId, organizationId, changeType, role)
4728
4743
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
4729
4744
  };
4730
4745
  }
4746
+ function createDistributionStatusChangeEvent(distributionId, status, organizationId) {
4747
+ return {
4748
+ type: "DISTRIBUTION_STATUS_CHANGE",
4749
+ data: {
4750
+ distributionId,
4751
+ status,
4752
+ organizationId
4753
+ },
4754
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
4755
+ };
4756
+ }
4731
4757
 
4732
4758
  // apps/cli/src/application/useCases/ExecuteSingleFileAstUseCase.ts
4733
4759
  var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
@@ -4740,8 +4766,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
4740
4766
  static {
4741
4767
  this.fallbackRuleContent = "adhoc-rule";
4742
4768
  }
4743
- async execute(command9) {
4744
- const { program, fileContent, language } = command9;
4769
+ async execute(command12) {
4770
+ const { program, fileContent, language } = command12;
4745
4771
  const result = await this.linterExecutionUseCase.execute({
4746
4772
  filePath: "cli-single-file",
4747
4773
  fileContent,
@@ -4766,6 +4792,18 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
4766
4792
  // apps/cli/src/application/services/GitService.ts
4767
4793
  var import_child_process = require("child_process");
4768
4794
  var path = __toESM(require("path"));
4795
+
4796
+ // apps/cli/src/application/utils/pathUtils.ts
4797
+ function normalizePath(p) {
4798
+ return p.replace(/\\/g, "/");
4799
+ }
4800
+ function pathStartsWith(filePath, prefix) {
4801
+ const normalizedFile = normalizePath(filePath);
4802
+ const normalizedPrefix = normalizePath(prefix);
4803
+ return normalizedFile.startsWith(normalizedPrefix + "/") || normalizedFile === normalizedPrefix;
4804
+ }
4805
+
4806
+ // apps/cli/src/application/services/GitService.ts
4769
4807
  var origin = "GitService";
4770
4808
  var GitService = class {
4771
4809
  constructor(logger2 = new PackmindLogger(origin), gitRunner = (cmd, opts) => {
@@ -4779,30 +4817,30 @@ var GitService = class {
4779
4817
  this.gitRunner = gitRunner;
4780
4818
  this.logger = logger2;
4781
4819
  }
4782
- getGitRepositoryRoot(path12) {
4820
+ getGitRepositoryRoot(path13) {
4783
4821
  try {
4784
4822
  const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
4785
- cwd: path12
4823
+ cwd: path13
4786
4824
  });
4787
4825
  const gitRoot = stdout.trim();
4788
4826
  this.logger.debug("Resolved git repository root", {
4789
- inputPath: path12,
4827
+ inputPath: path13,
4790
4828
  gitRoot
4791
4829
  });
4792
4830
  return gitRoot;
4793
4831
  } catch (error) {
4794
4832
  if (error instanceof Error) {
4795
4833
  throw new Error(
4796
- `Failed to get Git repository root. The path '${path12}' does not appear to be inside a Git repository.
4834
+ `Failed to get Git repository root. The path '${path13}' does not appear to be inside a Git repository.
4797
4835
  ${error.message}`
4798
4836
  );
4799
4837
  }
4800
4838
  throw new Error("Failed to get Git repository root: Unknown error");
4801
4839
  }
4802
4840
  }
4803
- tryGetGitRepositoryRoot(path12) {
4841
+ tryGetGitRepositoryRoot(path13) {
4804
4842
  try {
4805
- return this.getGitRepositoryRoot(path12);
4843
+ return this.getGitRepositoryRoot(path13);
4806
4844
  } catch {
4807
4845
  return null;
4808
4846
  }
@@ -4965,7 +5003,7 @@ ${error.message}`
4965
5003
  const { stdout } = this.gitRunner("diff --name-only HEAD", {
4966
5004
  cwd: gitRoot
4967
5005
  });
4968
- return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => path.join(gitRoot, relativePath));
5006
+ return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => normalizePath(path.join(gitRoot, relativePath)));
4969
5007
  } catch (error) {
4970
5008
  if (error instanceof Error && error.message.includes("unknown revision")) {
4971
5009
  this.logger.debug(
@@ -4983,7 +5021,7 @@ ${error.message}`
4983
5021
  const { stdout } = this.gitRunner("diff --cached --name-only", {
4984
5022
  cwd: gitRoot
4985
5023
  });
4986
- return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => path.join(gitRoot, relativePath));
5024
+ return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => normalizePath(path.join(gitRoot, relativePath)));
4987
5025
  }
4988
5026
  /**
4989
5027
  * Gets untracked files (new files not yet added to git).
@@ -4994,7 +5032,7 @@ ${error.message}`
4994
5032
  const { stdout } = this.gitRunner("ls-files --others --exclude-standard", {
4995
5033
  cwd: gitRoot
4996
5034
  });
4997
- return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => path.join(gitRoot, relativePath));
5035
+ return stdout.trim().split("\n").filter((line) => line.length > 0).map((relativePath) => normalizePath(path.join(gitRoot, relativePath)));
4998
5036
  }
4999
5037
  /**
5000
5038
  * Gets line-level diff information for modified files.
@@ -5066,7 +5104,7 @@ ${error.message}`
5066
5104
  for (const line of lines) {
5067
5105
  const fileMatch = line.match(/^diff --git a\/(.+) b\/(.+)$/);
5068
5106
  if (fileMatch) {
5069
- currentFile = path.join(gitRoot, fileMatch[2]);
5107
+ currentFile = normalizePath(path.join(gitRoot, fileMatch[2]));
5070
5108
  continue;
5071
5109
  }
5072
5110
  const hunkMatch = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/);
@@ -5109,8 +5147,8 @@ var GetGitRemoteUrlUseCase = class {
5109
5147
  constructor(gitRemoteUrlService = new GitService()) {
5110
5148
  this.gitRemoteUrlService = gitRemoteUrlService;
5111
5149
  }
5112
- async execute(command9) {
5113
- const { path: repoPath, origin: origin11 } = command9;
5150
+ async execute(command12) {
5151
+ const { path: repoPath, origin: origin11 } = command12;
5114
5152
  return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin11);
5115
5153
  }
5116
5154
  };
@@ -5118,6 +5156,42 @@ var GetGitRemoteUrlUseCase = class {
5118
5156
  // apps/cli/src/application/services/ListFiles.ts
5119
5157
  var fs = __toESM(require("fs/promises"));
5120
5158
  var path2 = __toESM(require("path"));
5159
+
5160
+ // apps/cli/src/infra/utils/consoleLogger.ts
5161
+ init_source();
5162
+ var CLI_PREFIX = "packmind-cli";
5163
+ function logConsole(message, logger2 = console) {
5164
+ logger2.log(message);
5165
+ }
5166
+ function logWarningConsole(message, logger2 = console) {
5167
+ logger2.warn(source_default.bgYellow.bold(CLI_PREFIX), source_default.yellow(message));
5168
+ }
5169
+ function logInfoConsole(message, logger2 = console) {
5170
+ logger2.log(source_default.bgBlue.bold(CLI_PREFIX), source_default.blue(message));
5171
+ }
5172
+ function logErrorConsole(message, logger2 = console) {
5173
+ logger2.error(source_default.bgRed.bold(CLI_PREFIX), source_default.red(message));
5174
+ }
5175
+ function logSuccessConsole(message, logger2 = console) {
5176
+ logger2.log(source_default.bgGreen.bold(CLI_PREFIX), source_default.green.bold(message));
5177
+ }
5178
+ function formatSlug(text) {
5179
+ return source_default.blue.bold(text);
5180
+ }
5181
+ function formatLabel(text) {
5182
+ return source_default.dim(text);
5183
+ }
5184
+ function formatError(text) {
5185
+ return source_default.red(text);
5186
+ }
5187
+ function formatBold(text) {
5188
+ return source_default.bold(text);
5189
+ }
5190
+ function formatFilePath(text) {
5191
+ return source_default.underline.gray(text);
5192
+ }
5193
+
5194
+ // apps/cli/src/application/services/ListFiles.ts
5121
5195
  var ListFiles = class {
5122
5196
  async listFilesInDirectory(directoryPath, extensions, excludes = [], skipHidden = true) {
5123
5197
  const results = [];
@@ -5165,7 +5239,7 @@ var ListFiles = class {
5165
5239
  }
5166
5240
  }
5167
5241
  } catch (error) {
5168
- console.error(`Error reading directory ${directoryPath}:`, error);
5242
+ logErrorConsole(`Error reading directory ${directoryPath}: ${error}`);
5169
5243
  }
5170
5244
  }
5171
5245
  shouldExcludePath(filePath, excludes) {
@@ -5199,7 +5273,7 @@ var ListFiles = class {
5199
5273
  try {
5200
5274
  return await fs.readFile(filePath, "utf-8");
5201
5275
  } catch (error) {
5202
- console.error(`Error reading file ${filePath}:`, error);
5276
+ logErrorConsole(`Error reading file ${filePath}: ${error}`);
5203
5277
  throw error;
5204
5278
  }
5205
5279
  }
@@ -5210,8 +5284,8 @@ var ListFilesInDirectoryUseCase = class {
5210
5284
  constructor(listFiles = new ListFiles()) {
5211
5285
  this.listFiles = listFiles;
5212
5286
  }
5213
- async execute(command9) {
5214
- const { path: directoryPath, extensions, excludes = [] } = command9;
5287
+ async execute(command12) {
5288
+ const { path: directoryPath, extensions, excludes = [] } = command12;
5215
5289
  const files = await this.listFiles.listFilesInDirectory(
5216
5290
  directoryPath,
5217
5291
  extensions,
@@ -5226,7 +5300,7 @@ var ListFilesInDirectoryUseCase = class {
5226
5300
  content
5227
5301
  });
5228
5302
  } catch (error) {
5229
- console.error(`Error reading file ${file.path}:`, error);
5303
+ logErrorConsole(`Error reading file ${file.path}: ${error}`);
5230
5304
  }
5231
5305
  }
5232
5306
  return filesWithContent;
@@ -5296,7 +5370,7 @@ var LintFilesInDirectoryUseCase = class {
5296
5370
  }
5297
5371
  return pattern;
5298
5372
  }
5299
- async execute(command9) {
5373
+ async execute(command12) {
5300
5374
  const {
5301
5375
  path: userPath,
5302
5376
  draftMode,
@@ -5304,7 +5378,7 @@ var LintFilesInDirectoryUseCase = class {
5304
5378
  ruleId,
5305
5379
  language,
5306
5380
  diffMode
5307
- } = command9;
5381
+ } = command12;
5308
5382
  this.logger.debug(
5309
5383
  `Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
5310
5384
  );
@@ -5326,7 +5400,7 @@ var LintFilesInDirectoryUseCase = class {
5326
5400
  directoryForGitOps
5327
5401
  );
5328
5402
  const absoluteLintPath = absoluteUserPath;
5329
- if (!absoluteLintPath.startsWith(gitRepoRoot)) {
5403
+ if (!pathStartsWith(absoluteLintPath, gitRepoRoot)) {
5330
5404
  throw new Error(
5331
5405
  `The path "${absoluteLintPath}" is not within the git repository at "${gitRepoRoot}"`
5332
5406
  );
@@ -5484,7 +5558,7 @@ var LintFilesInDirectoryUseCase = class {
5484
5558
  const violations = [];
5485
5559
  for (const file of files) {
5486
5560
  const fileViolations = [];
5487
- const relativeFilePath = file.path.startsWith(gitRepoRoot) ? file.path.substring(gitRepoRoot.length) : file.path;
5561
+ const relativeFilePath = pathStartsWith(file.path, gitRepoRoot) ? file.path.substring(gitRepoRoot.length) : file.path;
5488
5562
  const normalizedFilePath = relativeFilePath.startsWith("/") ? relativeFilePath : "/" + relativeFilePath;
5489
5563
  this.logger.debug(
5490
5564
  `Processing file: absolute="${file.path}", relative="${normalizedFilePath}"`
@@ -5525,7 +5599,7 @@ var LintFilesInDirectoryUseCase = class {
5525
5599
  activeProgram.language
5526
5600
  );
5527
5601
  if (!programLanguage) {
5528
- console.error(
5602
+ logErrorConsole(
5529
5603
  `Unsupported language "${activeProgram.language}" for file ${file.path}`
5530
5604
  );
5531
5605
  continue;
@@ -5543,7 +5617,7 @@ var LintFilesInDirectoryUseCase = class {
5543
5617
  });
5544
5618
  programsByLanguage.set(programLanguage, programsForLanguage);
5545
5619
  } catch (error) {
5546
- console.error(
5620
+ logErrorConsole(
5547
5621
  `Error preparing program for file ${file.path}: ${error}`
5548
5622
  );
5549
5623
  }
@@ -5566,13 +5640,13 @@ var LintFilesInDirectoryUseCase = class {
5566
5640
  });
5567
5641
  fileViolations.push(...result);
5568
5642
  } catch (error) {
5569
- console.error(
5643
+ logErrorConsole(
5570
5644
  `Error executing programs for file ${file.path} (${language2}): ${error}`
5571
5645
  );
5572
5646
  }
5573
5647
  }
5574
5648
  } catch (error) {
5575
- console.error(
5649
+ logErrorConsole(
5576
5650
  `Error reading file content for ${file.path}: ${error}`
5577
5651
  );
5578
5652
  }
@@ -5623,8 +5697,8 @@ var LintFilesInDirectoryUseCase = class {
5623
5697
  return null;
5624
5698
  }
5625
5699
  }
5626
- async executeProgramsForFile(command9) {
5627
- const result = await this.services.linterExecutionUseCase.execute(command9);
5700
+ async executeProgramsForFile(command12) {
5701
+ const result = await this.services.linterExecutionUseCase.execute(command12);
5628
5702
  return result.violations;
5629
5703
  }
5630
5704
  extractExtensionFromFile(filePath) {
@@ -5681,8 +5755,8 @@ var LintFilesLocallyUseCase = class {
5681
5755
  }
5682
5756
  return pattern;
5683
5757
  }
5684
- async execute(command9) {
5685
- const { path: userPath, diffMode } = command9;
5758
+ async execute(command12) {
5759
+ const { path: userPath, diffMode } = command12;
5686
5760
  this.logger.debug(
5687
5761
  `Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
5688
5762
  );
@@ -5771,7 +5845,7 @@ var LintFilesLocallyUseCase = class {
5771
5845
  const allStandardsChecked = /* @__PURE__ */ new Set();
5772
5846
  for (const file of files) {
5773
5847
  const fileViolations = [];
5774
- const relativeFilePath = file.path.startsWith(basePath) ? file.path.substring(basePath.length) : file.path;
5848
+ const relativeFilePath = pathStartsWith(file.path, basePath) ? file.path.substring(basePath.length) : file.path;
5775
5849
  const normalizedFilePath = relativeFilePath.startsWith("/") ? relativeFilePath : "/" + relativeFilePath;
5776
5850
  this.logger.debug(
5777
5851
  `Processing file: absolute="${file.path}", relative="${normalizedFilePath}"`
@@ -5817,7 +5891,7 @@ var LintFilesLocallyUseCase = class {
5817
5891
  });
5818
5892
  programsByLanguage.set(programLanguage, programsForLanguage);
5819
5893
  } catch (error) {
5820
- console.error(
5894
+ logErrorConsole(
5821
5895
  `Error preparing program for file ${file.path}: ${error}`
5822
5896
  );
5823
5897
  }
@@ -5841,13 +5915,13 @@ var LintFilesLocallyUseCase = class {
5841
5915
  });
5842
5916
  fileViolations.push(...result);
5843
5917
  } catch (error) {
5844
- console.error(
5918
+ logErrorConsole(
5845
5919
  `Error executing programs for file ${file.path} (${language}): ${error}`
5846
5920
  );
5847
5921
  }
5848
5922
  }
5849
5923
  } catch (error) {
5850
- console.error(
5924
+ logErrorConsole(
5851
5925
  `Error reading file content for ${file.path}: ${error}`
5852
5926
  );
5853
5927
  }
@@ -5889,7 +5963,7 @@ var LintFilesLocallyUseCase = class {
5889
5963
  */
5890
5964
  findMatchingTargets(absoluteFilePath, configs) {
5891
5965
  return configs.filter(
5892
- (config) => absoluteFilePath.startsWith(config.absoluteTargetPath + "/") || absoluteFilePath === config.absoluteTargetPath
5966
+ (config) => pathStartsWith(absoluteFilePath, config.absoluteTargetPath)
5893
5967
  );
5894
5968
  }
5895
5969
  /**
@@ -5924,8 +5998,8 @@ var LintFilesLocallyUseCase = class {
5924
5998
  return null;
5925
5999
  }
5926
6000
  }
5927
- async executeProgramsForFile(command9) {
5928
- const result = await this.services.linterExecutionUseCase.execute(command9);
6001
+ async executeProgramsForFile(command12) {
6002
+ const result = await this.services.linterExecutionUseCase.execute(command12);
5929
6003
  return result.violations;
5930
6004
  }
5931
6005
  extractExtensionFromFile(filePath) {
@@ -5940,7 +6014,8 @@ var LintFilesLocallyUseCase = class {
5940
6014
  // apps/cli/src/infra/utils/readSkillDirectory.ts
5941
6015
  var import_promises = __toESM(require("fs/promises"));
5942
6016
  var import_path = __toESM(require("path"));
5943
- function normalizePath(filePath) {
6017
+ var import_minimatch3 = require("minimatch");
6018
+ function normalizePath2(filePath) {
5944
6019
  let normalized = filePath.replace(/\\/g, "/");
5945
6020
  if (normalized.startsWith("/") || normalized.startsWith("\\")) {
5946
6021
  normalized = normalized.substring(1);
@@ -6018,6 +6093,13 @@ function isBinaryFile(filePath, buffer) {
6018
6093
  }
6019
6094
  var MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024;
6020
6095
  var MAX_FILE_SIZE_MB = 10;
6096
+ var BLACKLIST_PATTERNS = ["**/.DS_Store"];
6097
+ function isBlacklisted(relativePath) {
6098
+ const normalizedPath = relativePath.replace(/\\/g, "/");
6099
+ return BLACKLIST_PATTERNS.some(
6100
+ (pattern) => (0, import_minimatch3.minimatch)(normalizedPath, pattern, { dot: true })
6101
+ );
6102
+ }
6021
6103
  async function readSkillDirectory(dirPath) {
6022
6104
  const files = [];
6023
6105
  async function readDir(currentPath, basePath) {
@@ -6025,6 +6107,9 @@ async function readSkillDirectory(dirPath) {
6025
6107
  for (const entry of entries) {
6026
6108
  const fullPath = import_path.default.join(currentPath, entry.name);
6027
6109
  const relativePath = import_path.default.relative(basePath, fullPath);
6110
+ if (isBlacklisted(relativePath)) {
6111
+ continue;
6112
+ }
6028
6113
  if (entry.isDirectory()) {
6029
6114
  await readDir(fullPath, basePath);
6030
6115
  } else if (entry.isFile()) {
@@ -6037,7 +6122,7 @@ async function readSkillDirectory(dirPath) {
6037
6122
  }
6038
6123
  const buffer = await import_promises.default.readFile(fullPath);
6039
6124
  const isBinary = isBinaryFile(fullPath, buffer);
6040
- const normalizedPath = normalizePath(relativePath);
6125
+ const normalizedPath = normalizePath2(relativePath);
6041
6126
  let content;
6042
6127
  if (isBinary) {
6043
6128
  content = buffer.toString("base64");
@@ -6080,6 +6165,93 @@ var NotLoggedInError = class extends Error {
6080
6165
  }
6081
6166
  };
6082
6167
 
6168
+ // apps/cli/src/infra/http/PackmindHttpClient.ts
6169
+ var PackmindHttpClient = class {
6170
+ constructor(apiKey) {
6171
+ this.apiKey = apiKey;
6172
+ }
6173
+ getAuthContext() {
6174
+ if (!this.apiKey) {
6175
+ throw new NotLoggedInError();
6176
+ }
6177
+ let decoded;
6178
+ try {
6179
+ const decodedString = Buffer.from(this.apiKey, "base64").toString(
6180
+ "utf-8"
6181
+ );
6182
+ decoded = JSON.parse(decodedString);
6183
+ } catch {
6184
+ throw new Error("Invalid API key");
6185
+ }
6186
+ const jwtPayload = this.decodeJwt(decoded.jwt);
6187
+ const organizationId = jwtPayload?.organization?.id;
6188
+ if (!organizationId) {
6189
+ throw new Error("Invalid API key: missing organizationId");
6190
+ }
6191
+ return {
6192
+ host: decoded.host,
6193
+ jwt: decoded.jwt,
6194
+ organizationId
6195
+ };
6196
+ }
6197
+ decodeJwt(jwt) {
6198
+ try {
6199
+ const parts = jwt.split(".");
6200
+ if (parts.length !== 3) {
6201
+ return null;
6202
+ }
6203
+ const payloadBase64 = parts[1];
6204
+ const payloadString = Buffer.from(payloadBase64, "base64").toString(
6205
+ "utf-8"
6206
+ );
6207
+ return JSON.parse(payloadString);
6208
+ } catch {
6209
+ return null;
6210
+ }
6211
+ }
6212
+ async request(path13, options = {}) {
6213
+ const { host } = this.getAuthContext();
6214
+ const { method = "GET", body } = options;
6215
+ const url = `${host}${path13}`;
6216
+ try {
6217
+ const response = await fetch(url, {
6218
+ method,
6219
+ headers: {
6220
+ "Content-Type": "application/json",
6221
+ Authorization: `Bearer ${this.apiKey}`
6222
+ },
6223
+ ...body ? { body: JSON.stringify(body) } : {}
6224
+ });
6225
+ if (!response.ok) {
6226
+ let errorMsg = `API request failed: ${response.status} ${response.statusText}`;
6227
+ try {
6228
+ const errorBody = await response.json();
6229
+ if (errorBody?.message) {
6230
+ errorMsg = errorBody.message;
6231
+ }
6232
+ } catch {
6233
+ }
6234
+ const error = new Error(errorMsg);
6235
+ error.statusCode = response.status;
6236
+ throw error;
6237
+ }
6238
+ return response.json();
6239
+ } catch (error) {
6240
+ const err = error;
6241
+ if (err.statusCode) throw error;
6242
+ const code = err?.code || err?.cause?.code;
6243
+ if (code === "ECONNREFUSED" || code === "ENOTFOUND" || err?.name === "FetchError" || typeof err?.message === "string" && (err.message.includes("Failed to fetch") || err.message.includes("network") || err.message.includes("NetworkError"))) {
6244
+ throw new Error(
6245
+ `Packmind server is not accessible at ${host}. Please check your network connection or the server URL.`
6246
+ );
6247
+ }
6248
+ throw new Error(
6249
+ `Request failed: ${err?.message || JSON.stringify(error)}`
6250
+ );
6251
+ }
6252
+ }
6253
+ };
6254
+
6083
6255
  // apps/cli/src/infra/repositories/PackmindGateway.ts
6084
6256
  function decodeJwt(jwt) {
6085
6257
  try {
@@ -6136,7 +6308,7 @@ function decodeApiKey(apiKey) {
6136
6308
  var PackmindGateway = class {
6137
6309
  constructor(apiKey) {
6138
6310
  this.apiKey = apiKey;
6139
- this.getPullData = async (command9) => {
6311
+ this.getPullData = async (command12) => {
6140
6312
  const decodedApiKey = decodeApiKey(this.apiKey);
6141
6313
  if (!decodedApiKey.isValid) {
6142
6314
  if (decodedApiKey.error === "NOT_LOGGED_IN") {
@@ -6151,16 +6323,25 @@ var PackmindGateway = class {
6151
6323
  }
6152
6324
  const organizationId = jwtPayload.organization.id;
6153
6325
  const queryParams = new URLSearchParams();
6154
- if (command9.packagesSlugs && command9.packagesSlugs.length > 0) {
6155
- command9.packagesSlugs.forEach((slug) => {
6326
+ if (command12.packagesSlugs && command12.packagesSlugs.length > 0) {
6327
+ command12.packagesSlugs.forEach((slug) => {
6156
6328
  queryParams.append("packageSlug", slug);
6157
6329
  });
6158
6330
  }
6159
- if (command9.previousPackagesSlugs && command9.previousPackagesSlugs.length > 0) {
6160
- command9.previousPackagesSlugs.forEach((slug) => {
6331
+ if (command12.previousPackagesSlugs && command12.previousPackagesSlugs.length > 0) {
6332
+ command12.previousPackagesSlugs.forEach((slug) => {
6161
6333
  queryParams.append("previousPackageSlug", slug);
6162
6334
  });
6163
6335
  }
6336
+ if (command12.gitRemoteUrl) {
6337
+ queryParams.append("gitRemoteUrl", command12.gitRemoteUrl);
6338
+ }
6339
+ if (command12.gitBranch) {
6340
+ queryParams.append("gitBranch", command12.gitBranch);
6341
+ }
6342
+ if (command12.relativePath) {
6343
+ queryParams.append("relativePath", command12.relativePath);
6344
+ }
6164
6345
  const url = `${host}/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`;
6165
6346
  try {
6166
6347
  const response = await fetch(url, {
@@ -6697,7 +6878,7 @@ var PackmindGateway = class {
6697
6878
  );
6698
6879
  }
6699
6880
  };
6700
- this.uploadSkill = async (command9) => {
6881
+ this.uploadSkill = async (command12) => {
6701
6882
  const decodedApiKey = decodeApiKey(this.apiKey);
6702
6883
  if (!decodedApiKey.isValid) {
6703
6884
  if (decodedApiKey.error === "NOT_LOGGED_IN") {
@@ -6725,7 +6906,7 @@ var PackmindGateway = class {
6725
6906
  }
6726
6907
  const space = await spaceResponse.json();
6727
6908
  const spaceId = space.id;
6728
- const files = await readSkillDirectory(command9.skillPath);
6909
+ const files = await readSkillDirectory(command12.skillPath);
6729
6910
  if (!files.find((f) => f.relativePath === "SKILL.md")) {
6730
6911
  throw new Error("SKILL.md not found in skill directory");
6731
6912
  }
@@ -6795,6 +6976,96 @@ var PackmindGateway = class {
6795
6976
  );
6796
6977
  }
6797
6978
  };
6979
+ this.getDefaultSkills = async () => {
6980
+ const decodedApiKey = decodeApiKey(this.apiKey);
6981
+ if (!decodedApiKey.isValid) {
6982
+ if (decodedApiKey.error === "NOT_LOGGED_IN") {
6983
+ throw new NotLoggedInError();
6984
+ }
6985
+ throw new Error(`Invalid API key: ${decodedApiKey.error}`);
6986
+ }
6987
+ const { host, jwt } = decodedApiKey.payload;
6988
+ const jwtPayload = decodeJwt(jwt);
6989
+ if (!jwtPayload?.organization?.id) {
6990
+ throw new Error("Invalid API key: missing organizationId in JWT");
6991
+ }
6992
+ const organizationId = jwtPayload.organization.id;
6993
+ const url = `${host}/api/v0/organizations/${organizationId}/skills/default`;
6994
+ try {
6995
+ const response = await fetch(url, {
6996
+ method: "GET",
6997
+ headers: {
6998
+ "Content-Type": "application/json",
6999
+ Authorization: `Bearer ${this.apiKey}`
7000
+ }
7001
+ });
7002
+ if (!response.ok) {
7003
+ let errorMsg = `API request failed: ${response.status} ${response.statusText}`;
7004
+ try {
7005
+ const errorBody = await response.json();
7006
+ if (errorBody?.message) {
7007
+ errorMsg = errorBody.message;
7008
+ }
7009
+ } catch {
7010
+ }
7011
+ throw new Error(errorMsg);
7012
+ }
7013
+ const result = await response.json();
7014
+ return result;
7015
+ } catch (error) {
7016
+ const err = error;
7017
+ const code = err?.code || err?.cause?.code;
7018
+ if (code === "ECONNREFUSED" || code === "ENOTFOUND" || err?.name === "FetchError" || typeof err?.message === "string" && (err.message.includes("Failed to fetch") || err.message.includes("network") || err.message.includes("NetworkError"))) {
7019
+ throw new Error(
7020
+ `Packmind server is not accessible at ${host}. Please check your network connection or the server URL.`
7021
+ );
7022
+ }
7023
+ throw new Error(
7024
+ `Failed to get default skills: Error: ${err?.message || JSON.stringify(error)}`
7025
+ );
7026
+ }
7027
+ };
7028
+ this.getGlobalSpace = async () => {
7029
+ const { organizationId } = this.httpClient.getAuthContext();
7030
+ return this.httpClient.request(
7031
+ `/api/v0/organizations/${organizationId}/spaces/global`
7032
+ );
7033
+ };
7034
+ this.createStandardInSpace = async (spaceId, data) => {
7035
+ const { organizationId } = this.httpClient.getAuthContext();
7036
+ return this.httpClient.request(
7037
+ `/api/v0/organizations/${organizationId}/spaces/${spaceId}/standards`,
7038
+ { method: "POST", body: data }
7039
+ );
7040
+ };
7041
+ this.getRulesForStandard = async (spaceId, standardId) => {
7042
+ const { organizationId } = this.httpClient.getAuthContext();
7043
+ return this.httpClient.request(
7044
+ `/api/v0/organizations/${organizationId}/spaces/${spaceId}/standards/${standardId}/rules`
7045
+ );
7046
+ };
7047
+ this.addExampleToRule = async (spaceId, standardId, ruleId, example) => {
7048
+ const { organizationId } = this.httpClient.getAuthContext();
7049
+ await this.httpClient.request(
7050
+ `/api/v0/organizations/${organizationId}/spaces/${spaceId}/standards/${standardId}/rules/${ruleId}/examples`,
7051
+ {
7052
+ method: "POST",
7053
+ body: {
7054
+ lang: example.language,
7055
+ positive: example.positive,
7056
+ negative: example.negative
7057
+ }
7058
+ }
7059
+ );
7060
+ };
7061
+ this.createCommand = async (spaceId, data) => {
7062
+ const { organizationId } = this.httpClient.getAuthContext();
7063
+ return this.httpClient.request(
7064
+ `/api/v0/organizations/${organizationId}/spaces/${spaceId}/recipes`,
7065
+ { method: "POST", body: data }
7066
+ );
7067
+ };
7068
+ this.httpClient = new PackmindHttpClient(apiKey);
6798
7069
  }
6799
7070
  };
6800
7071
 
@@ -8538,8 +8809,8 @@ var ExecuteLinterProgramsUseCase = class {
8538
8809
  this.linterAstAdapter = linterAstAdapter;
8539
8810
  this.logger = logger2;
8540
8811
  }
8541
- async execute(command9) {
8542
- const { filePath, fileContent, language, programs } = command9;
8812
+ async execute(command12) {
8813
+ const { filePath, fileContent, language, programs } = command12;
8543
8814
  if (programs.length === 0) {
8544
8815
  return {
8545
8816
  file: filePath,
@@ -9543,6 +9814,51 @@ var SSEEventPublisher = class _SSEEventPublisher {
9543
9814
  throw error;
9544
9815
  }
9545
9816
  }
9817
+ /**
9818
+ * Publish a distribution status change event for cache invalidation
9819
+ * This triggers React Query to refetch the distribution data when status changes
9820
+ */
9821
+ static async publishDistributionStatusChangeEvent(distributionId, status, organizationId) {
9822
+ _SSEEventPublisher.logger.info(
9823
+ "Publishing distribution status change event",
9824
+ {
9825
+ distributionId,
9826
+ status,
9827
+ organizationId
9828
+ }
9829
+ );
9830
+ try {
9831
+ const event = createDistributionStatusChangeEvent(
9832
+ distributionId,
9833
+ status,
9834
+ organizationId
9835
+ );
9836
+ await _SSEEventPublisher.publishEvent(
9837
+ "DISTRIBUTION_STATUS_CHANGE",
9838
+ [organizationId],
9839
+ event
9840
+ );
9841
+ _SSEEventPublisher.logger.debug(
9842
+ "Successfully published distribution status change event",
9843
+ {
9844
+ distributionId,
9845
+ status,
9846
+ organizationId
9847
+ }
9848
+ );
9849
+ } catch (error) {
9850
+ _SSEEventPublisher.logger.error(
9851
+ "Failed to publish distribution status change event",
9852
+ {
9853
+ distributionId,
9854
+ status,
9855
+ organizationId,
9856
+ error: error instanceof Error ? error.message : String(error)
9857
+ }
9858
+ );
9859
+ throw error;
9860
+ }
9861
+ }
9546
9862
  /**
9547
9863
  * Generic method to publish any SSE event type to Redis pub/sub
9548
9864
  */
@@ -9627,6 +9943,11 @@ ${sectionBlock}
9627
9943
  return result;
9628
9944
  }
9629
9945
 
9946
+ // packages/node-utils/src/text/urlUtils.ts
9947
+ function removeTrailingSlash(url) {
9948
+ return url.endsWith("/") ? url.slice(0, -1) : url;
9949
+ }
9950
+
9630
9951
  // apps/cli/src/application/useCases/InstallPackagesUseCase.ts
9631
9952
  var fs5 = __toESM(require("fs/promises"));
9632
9953
  var path6 = __toESM(require("path"));
@@ -9634,8 +9955,8 @@ var InstallPackagesUseCase = class {
9634
9955
  constructor(packmindGateway) {
9635
9956
  this.packmindGateway = packmindGateway;
9636
9957
  }
9637
- async execute(command9) {
9638
- const baseDirectory = command9.baseDirectory || process.cwd();
9958
+ async execute(command12) {
9959
+ const baseDirectory = command12.baseDirectory || process.cwd();
9639
9960
  const result = {
9640
9961
  filesCreated: 0,
9641
9962
  filesUpdated: 0,
@@ -9643,11 +9964,15 @@ var InstallPackagesUseCase = class {
9643
9964
  errors: [],
9644
9965
  recipesCount: 0,
9645
9966
  standardsCount: 0,
9646
- skillsCount: 0
9967
+ skillsCount: 0,
9968
+ skillDirectoriesDeleted: 0
9647
9969
  };
9648
9970
  const response = await this.packmindGateway.getPullData({
9649
- packagesSlugs: command9.packagesSlugs,
9650
- previousPackagesSlugs: command9.previousPackagesSlugs
9971
+ packagesSlugs: command12.packagesSlugs,
9972
+ previousPackagesSlugs: command12.previousPackagesSlugs,
9973
+ gitRemoteUrl: command12.gitRemoteUrl,
9974
+ gitBranch: command12.gitBranch,
9975
+ relativePath: command12.relativePath
9651
9976
  });
9652
9977
  const uniqueFilesMap = /* @__PURE__ */ new Map();
9653
9978
  for (const file of response.fileUpdates.createOrUpdate) {
@@ -9664,6 +9989,10 @@ var InstallPackagesUseCase = class {
9664
9989
  }
9665
9990
  }
9666
9991
  try {
9992
+ result.skillDirectoriesDeleted = await this.deleteSkillFolders(
9993
+ baseDirectory,
9994
+ response.skillFolders
9995
+ );
9667
9996
  for (const file of uniqueFiles) {
9668
9997
  try {
9669
9998
  await this.createOrUpdateFile(baseDirectory, file, result);
@@ -9841,6 +10170,99 @@ ${endMarker}`;
9841
10170
  escapeRegex(str) {
9842
10171
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9843
10172
  }
10173
+ /**
10174
+ * Deletes all skill folders before recreating them with fresh content.
10175
+ * Returns the count of files that were actually deleted.
10176
+ */
10177
+ async deleteSkillFolders(baseDirectory, folders) {
10178
+ let deletedFilesCount = 0;
10179
+ for (const folder of folders) {
10180
+ const fullPath = path6.join(baseDirectory, folder);
10181
+ try {
10182
+ await fs5.access(fullPath);
10183
+ const fileCount = await this.countFilesInDirectory(fullPath);
10184
+ await fs5.rm(fullPath, { recursive: true, force: true });
10185
+ deletedFilesCount += fileCount;
10186
+ } catch {
10187
+ }
10188
+ }
10189
+ return deletedFilesCount;
10190
+ }
10191
+ /**
10192
+ * Recursively counts all files in a directory.
10193
+ */
10194
+ async countFilesInDirectory(dirPath) {
10195
+ let count = 0;
10196
+ const entries = await fs5.readdir(dirPath, { withFileTypes: true });
10197
+ for (const entry of entries) {
10198
+ const entryPath = path6.join(dirPath, entry.name);
10199
+ if (entry.isDirectory()) {
10200
+ count += await this.countFilesInDirectory(entryPath);
10201
+ } else {
10202
+ count++;
10203
+ }
10204
+ }
10205
+ return count;
10206
+ }
10207
+ };
10208
+
10209
+ // apps/cli/src/application/useCases/InstallDefaultSkillsUseCase.ts
10210
+ var fs6 = __toESM(require("fs/promises"));
10211
+ var path7 = __toESM(require("path"));
10212
+ var InstallDefaultSkillsUseCase = class {
10213
+ constructor(packmindGateway) {
10214
+ this.packmindGateway = packmindGateway;
10215
+ }
10216
+ async execute(command12) {
10217
+ const baseDirectory = command12.baseDirectory || process.cwd();
10218
+ const result = {
10219
+ filesCreated: 0,
10220
+ filesUpdated: 0,
10221
+ errors: []
10222
+ };
10223
+ const response = await this.packmindGateway.getDefaultSkills({});
10224
+ console.log(JSON.stringify(response, null, 2));
10225
+ try {
10226
+ for (const file of response.fileUpdates.createOrUpdate) {
10227
+ try {
10228
+ await this.createOrUpdateFile(baseDirectory, file, result);
10229
+ } catch (error) {
10230
+ const errorMsg = error instanceof Error ? error.message : String(error);
10231
+ result.errors.push(
10232
+ `Failed to create/update ${file.path}: ${errorMsg}`
10233
+ );
10234
+ }
10235
+ }
10236
+ } catch (error) {
10237
+ const errorMsg = error instanceof Error ? error.message : String(error);
10238
+ result.errors.push(`Failed to install default skills: ${errorMsg}`);
10239
+ }
10240
+ return result;
10241
+ }
10242
+ async createOrUpdateFile(baseDirectory, file, result) {
10243
+ const fullPath = path7.join(baseDirectory, file.path);
10244
+ const directory = path7.dirname(fullPath);
10245
+ await fs6.mkdir(directory, { recursive: true });
10246
+ const fileExists = await this.fileExists(fullPath);
10247
+ if (fileExists) {
10248
+ const existingContent = await fs6.readFile(fullPath, "utf-8");
10249
+ if (existingContent !== file.content) {
10250
+ await fs6.writeFile(fullPath, file.content, "utf-8");
10251
+ result.filesUpdated++;
10252
+ }
10253
+ } else {
10254
+ await fs6.writeFile(fullPath, file.content, "utf-8");
10255
+ result.filesCreated++;
10256
+ }
10257
+ }
10258
+ async fileExists(filePath) {
10259
+ try {
10260
+ await fs6.access(filePath);
10261
+ return true;
10262
+ } catch {
10263
+ return false;
10264
+ }
10265
+ }
9844
10266
  };
9845
10267
 
9846
10268
  // apps/cli/src/application/useCases/ListPackagesUseCase.ts
@@ -9858,8 +10280,8 @@ var GetPackageSummaryUseCase = class {
9858
10280
  constructor(gateway) {
9859
10281
  this.gateway = gateway;
9860
10282
  }
9861
- async execute(command9) {
9862
- return this.gateway.getPackageSummary(command9);
10283
+ async execute(command12) {
10284
+ return this.gateway.getPackageSummary(command12);
9863
10285
  }
9864
10286
  };
9865
10287
 
@@ -9919,13 +10341,13 @@ var EnvCredentialsProvider = class {
9919
10341
  };
9920
10342
 
9921
10343
  // apps/cli/src/infra/utils/credentials/FileCredentialsProvider.ts
9922
- var fs6 = __toESM(require("fs"));
9923
- var path7 = __toESM(require("path"));
10344
+ var fs7 = __toESM(require("fs"));
10345
+ var path8 = __toESM(require("path"));
9924
10346
  var os2 = __toESM(require("os"));
9925
10347
  var CREDENTIALS_DIR = ".packmind";
9926
10348
  var CREDENTIALS_FILE = "credentials.json";
9927
10349
  function getCredentialsPath() {
9928
- return path7.join(os2.homedir(), CREDENTIALS_DIR, CREDENTIALS_FILE);
10350
+ return path8.join(os2.homedir(), CREDENTIALS_DIR, CREDENTIALS_FILE);
9929
10351
  }
9930
10352
  var FileCredentialsProvider = class {
9931
10353
  getSourceName() {
@@ -9933,11 +10355,11 @@ var FileCredentialsProvider = class {
9933
10355
  }
9934
10356
  hasCredentials() {
9935
10357
  const credentialsPath = getCredentialsPath();
9936
- if (!fs6.existsSync(credentialsPath)) {
10358
+ if (!fs7.existsSync(credentialsPath)) {
9937
10359
  return false;
9938
10360
  }
9939
10361
  try {
9940
- const content = fs6.readFileSync(credentialsPath, "utf-8");
10362
+ const content = fs7.readFileSync(credentialsPath, "utf-8");
9941
10363
  const credentials = JSON.parse(content);
9942
10364
  return !!credentials.apiKey;
9943
10365
  } catch {
@@ -9946,11 +10368,11 @@ var FileCredentialsProvider = class {
9946
10368
  }
9947
10369
  loadCredentials() {
9948
10370
  const credentialsPath = getCredentialsPath();
9949
- if (!fs6.existsSync(credentialsPath)) {
10371
+ if (!fs7.existsSync(credentialsPath)) {
9950
10372
  return null;
9951
10373
  }
9952
10374
  try {
9953
- const content = fs6.readFileSync(credentialsPath, "utf-8");
10375
+ const content = fs7.readFileSync(credentialsPath, "utf-8");
9954
10376
  const credentials = JSON.parse(content);
9955
10377
  if (!credentials.apiKey) {
9956
10378
  return null;
@@ -9973,13 +10395,13 @@ var FileCredentialsProvider = class {
9973
10395
  }
9974
10396
  };
9975
10397
  function saveCredentials(apiKey) {
9976
- const credentialsDir = path7.join(os2.homedir(), CREDENTIALS_DIR);
9977
- if (!fs6.existsSync(credentialsDir)) {
9978
- fs6.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
10398
+ const credentialsDir = path8.join(os2.homedir(), CREDENTIALS_DIR);
10399
+ if (!fs7.existsSync(credentialsDir)) {
10400
+ fs7.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
9979
10401
  }
9980
10402
  const credentialsPath = getCredentialsPath();
9981
10403
  const credentials = { apiKey };
9982
- fs6.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
10404
+ fs7.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
9983
10405
  mode: 384
9984
10406
  });
9985
10407
  }
@@ -10058,7 +10480,8 @@ async function defaultPromptForCode() {
10058
10480
  });
10059
10481
  }
10060
10482
  async function defaultExchangeCodeForApiKey(code, host) {
10061
- const url = `${host}/api/v0/auth/cli-login-exchange`;
10483
+ const normalizedHost = removeTrailingSlash(host);
10484
+ const url = `${normalizedHost}/api/v0/auth/cli-login-exchange`;
10062
10485
  const response = await fetch(url, {
10063
10486
  method: "POST",
10064
10487
  headers: {
@@ -10137,15 +10560,16 @@ var LoginUseCase = class {
10137
10560
  startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
10138
10561
  };
10139
10562
  }
10140
- async execute(command9) {
10141
- const { host, code: providedCode } = command9;
10563
+ async execute(command12) {
10564
+ const { host, code: providedCode } = command12;
10142
10565
  let code;
10143
10566
  if (providedCode) {
10144
10567
  code = providedCode;
10145
10568
  } else {
10146
10569
  const callbackPromise = this.deps.startCallbackServer();
10147
10570
  const callbackUrl = `http://127.0.0.1:${CALLBACK_PORT}`;
10148
- const loginUrl = `${host}/cli-login?callback_url=${encodeURIComponent(callbackUrl)}`;
10571
+ const normalizedHost = removeTrailingSlash(host);
10572
+ const loginUrl = `${normalizedHost}/cli-login?callback_url=${encodeURIComponent(callbackUrl)}`;
10149
10573
  try {
10150
10574
  await this.deps.openBrowser(loginUrl);
10151
10575
  } catch {
@@ -10169,14 +10593,14 @@ var LoginUseCase = class {
10169
10593
  };
10170
10594
 
10171
10595
  // apps/cli/src/application/useCases/LogoutUseCase.ts
10172
- var fs7 = __toESM(require("fs"));
10596
+ var fs8 = __toESM(require("fs"));
10173
10597
  var ENV_VAR_NAME2 = "PACKMIND_API_KEY_V3";
10174
10598
  var LogoutUseCase = class {
10175
10599
  constructor(deps) {
10176
10600
  this.deps = {
10177
10601
  getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
10178
- fileExists: deps?.fileExists ?? ((path12) => fs7.existsSync(path12)),
10179
- deleteFile: deps?.deleteFile ?? ((path12) => fs7.unlinkSync(path12)),
10602
+ fileExists: deps?.fileExists ?? ((path13) => fs8.existsSync(path13)),
10603
+ deleteFile: deps?.deleteFile ?? ((path13) => fs8.unlinkSync(path13)),
10180
10604
  hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
10181
10605
  };
10182
10606
  }
@@ -10236,8 +10660,8 @@ var SetupMcpUseCase = class {
10236
10660
  constructor(deps) {
10237
10661
  this.deps = deps;
10238
10662
  }
10239
- async execute(command9) {
10240
- const { agentTypes } = command9;
10663
+ async execute(command12) {
10664
+ const { agentTypes } = command12;
10241
10665
  const [tokenResult, urlResult] = await Promise.all([
10242
10666
  this.deps.gateway.getMcpToken({}),
10243
10667
  this.deps.gateway.getMcpUrl({})
@@ -10272,8 +10696,8 @@ var SetupMcpUseCase = class {
10272
10696
  };
10273
10697
 
10274
10698
  // apps/cli/src/application/services/McpConfigService.ts
10275
- var fs8 = __toESM(require("fs"));
10276
- var path8 = __toESM(require("path"));
10699
+ var fs9 = __toESM(require("fs"));
10700
+ var path9 = __toESM(require("path"));
10277
10701
  var os3 = __toESM(require("os"));
10278
10702
  var import_child_process2 = require("child_process");
10279
10703
  var McpConfigService = class {
@@ -10308,9 +10732,9 @@ var McpConfigService = class {
10308
10732
  return JSON.stringify(mcpConfig, null, 2);
10309
10733
  }
10310
10734
  installClaudeMcp(config) {
10311
- const command9 = `claude mcp add --transport http packmind ${config.url} --header "Authorization: Bearer ${config.accessToken}"`;
10735
+ const command12 = `claude mcp add --transport http packmind ${config.url} --header "Authorization: Bearer ${config.accessToken}"`;
10312
10736
  try {
10313
- (0, import_child_process2.execSync)(command9, { stdio: "pipe" });
10737
+ (0, import_child_process2.execSync)(command12, { stdio: "pipe" });
10314
10738
  return { success: true };
10315
10739
  } catch (error) {
10316
10740
  const execError = error;
@@ -10320,11 +10744,11 @@ var McpConfigService = class {
10320
10744
  }
10321
10745
  installCursorMcp(config) {
10322
10746
  try {
10323
- const cursorConfigPath = path8.join(os3.homedir(), ".cursor", "mcp.json");
10747
+ const cursorConfigPath = path9.join(os3.homedir(), ".cursor", "mcp.json");
10324
10748
  const cursorConfig = this.buildCursorConfig(config);
10325
10749
  const existingConfig = this.readExistingJsonConfig(cursorConfigPath);
10326
10750
  const mergedConfig = this.mergeConfig(existingConfig, cursorConfig);
10327
- fs8.writeFileSync(cursorConfigPath, JSON.stringify(mergedConfig, null, 2));
10751
+ fs9.writeFileSync(cursorConfigPath, JSON.stringify(mergedConfig, null, 2));
10328
10752
  return { success: true };
10329
10753
  } catch (error) {
10330
10754
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -10333,15 +10757,15 @@ var McpConfigService = class {
10333
10757
  }
10334
10758
  installVSCodeMcp(config) {
10335
10759
  try {
10336
- const vscodeDir = path8.join(this.projectDir, ".vscode");
10337
- if (!fs8.existsSync(vscodeDir)) {
10338
- fs8.mkdirSync(vscodeDir, { recursive: true });
10760
+ const vscodeDir = path9.join(this.projectDir, ".vscode");
10761
+ if (!fs9.existsSync(vscodeDir)) {
10762
+ fs9.mkdirSync(vscodeDir, { recursive: true });
10339
10763
  }
10340
- const vscodeConfigPath = path8.join(vscodeDir, "mcp.json");
10764
+ const vscodeConfigPath = path9.join(vscodeDir, "mcp.json");
10341
10765
  const vscodeConfig = this.buildVSCodeConfig(config);
10342
10766
  const existingConfig = this.readExistingJsonConfig(vscodeConfigPath);
10343
10767
  const mergedConfig = this.mergeVSCodeConfig(existingConfig, vscodeConfig);
10344
- fs8.writeFileSync(vscodeConfigPath, JSON.stringify(mergedConfig, null, 2));
10768
+ fs9.writeFileSync(vscodeConfigPath, JSON.stringify(mergedConfig, null, 2));
10345
10769
  return { success: true };
10346
10770
  } catch (error) {
10347
10771
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -10350,14 +10774,14 @@ var McpConfigService = class {
10350
10774
  }
10351
10775
  installContinueMcp(config) {
10352
10776
  try {
10353
- const continueDir = path8.join(this.projectDir, ".continue");
10354
- const mcpServersDir = path8.join(continueDir, "mcpServers");
10355
- if (!fs8.existsSync(mcpServersDir)) {
10356
- fs8.mkdirSync(mcpServersDir, { recursive: true });
10777
+ const continueDir = path9.join(this.projectDir, ".continue");
10778
+ const mcpServersDir = path9.join(continueDir, "mcpServers");
10779
+ if (!fs9.existsSync(mcpServersDir)) {
10780
+ fs9.mkdirSync(mcpServersDir, { recursive: true });
10357
10781
  }
10358
- const continueConfigPath = path8.join(mcpServersDir, "packmind.yaml");
10782
+ const continueConfigPath = path9.join(mcpServersDir, "packmind.yaml");
10359
10783
  const continueConfig = this.buildContinueYamlConfig(config);
10360
- fs8.writeFileSync(continueConfigPath, continueConfig);
10784
+ fs9.writeFileSync(continueConfigPath, continueConfig);
10361
10785
  return { success: true };
10362
10786
  } catch (error) {
10363
10787
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -10405,8 +10829,8 @@ mcpServers:
10405
10829
  }
10406
10830
  readExistingJsonConfig(filePath) {
10407
10831
  try {
10408
- if (fs8.existsSync(filePath)) {
10409
- const content = fs8.readFileSync(filePath, "utf-8");
10832
+ if (fs9.existsSync(filePath)) {
10833
+ const content = fs9.readFileSync(filePath, "utf-8");
10410
10834
  return JSON.parse(content);
10411
10835
  }
10412
10836
  } catch {
@@ -10439,41 +10863,8 @@ mcpServers:
10439
10863
  };
10440
10864
 
10441
10865
  // apps/cli/src/infra/repositories/ConfigFileRepository.ts
10442
- var fs9 = __toESM(require("fs/promises"));
10443
- var path9 = __toESM(require("path"));
10444
-
10445
- // apps/cli/src/infra/utils/consoleLogger.ts
10446
- init_source();
10447
- var CLI_PREFIX = "packmind-cli";
10448
- function logWarningConsole(message) {
10449
- console.warn(source_default.bgYellow.bold(CLI_PREFIX), source_default.yellow(message));
10450
- }
10451
- function logInfoConsole(message) {
10452
- console.log(source_default.bgBlue.bold(CLI_PREFIX), source_default.blue(message));
10453
- }
10454
- function logErrorConsole(message) {
10455
- console.error(source_default.bgRed.bold(CLI_PREFIX), source_default.red(message));
10456
- }
10457
- function logSuccessConsole(message) {
10458
- console.log(source_default.bgGreen.bold(CLI_PREFIX), source_default.green.bold(message));
10459
- }
10460
- function formatSlug(text) {
10461
- return source_default.blue.bold(text);
10462
- }
10463
- function formatLabel(text) {
10464
- return source_default.dim(text);
10465
- }
10466
- function formatError(text) {
10467
- return source_default.red(text);
10468
- }
10469
- function formatBold(text) {
10470
- return source_default.bold(text);
10471
- }
10472
- function formatFilePath(text) {
10473
- return source_default.underline.gray(text);
10474
- }
10475
-
10476
- // apps/cli/src/infra/repositories/ConfigFileRepository.ts
10866
+ var fs10 = __toESM(require("fs/promises"));
10867
+ var path10 = __toESM(require("path"));
10477
10868
  var ConfigFileRepository = class {
10478
10869
  constructor() {
10479
10870
  this.CONFIG_FILENAME = "packmind.json";
@@ -10488,23 +10879,23 @@ var ConfigFileRepository = class {
10488
10879
  ];
10489
10880
  }
10490
10881
  async writeConfig(baseDirectory, config) {
10491
- const configPath = path9.join(baseDirectory, this.CONFIG_FILENAME);
10882
+ const configPath = path10.join(baseDirectory, this.CONFIG_FILENAME);
10492
10883
  const configContent = JSON.stringify(config, null, 2) + "\n";
10493
- await fs9.writeFile(configPath, configContent, "utf-8");
10884
+ await fs10.writeFile(configPath, configContent, "utf-8");
10494
10885
  }
10495
10886
  async configExists(baseDirectory) {
10496
- const configPath = path9.join(baseDirectory, this.CONFIG_FILENAME);
10887
+ const configPath = path10.join(baseDirectory, this.CONFIG_FILENAME);
10497
10888
  try {
10498
- await fs9.access(configPath);
10889
+ await fs10.access(configPath);
10499
10890
  return true;
10500
10891
  } catch {
10501
10892
  return false;
10502
10893
  }
10503
10894
  }
10504
10895
  async readConfig(baseDirectory) {
10505
- const configPath = path9.join(baseDirectory, this.CONFIG_FILENAME);
10896
+ const configPath = path10.join(baseDirectory, this.CONFIG_FILENAME);
10506
10897
  try {
10507
- const configContent = await fs9.readFile(configPath, "utf-8");
10898
+ const configContent = await fs10.readFile(configPath, "utf-8");
10508
10899
  const config = JSON.parse(configContent);
10509
10900
  if (!config.packages || typeof config.packages !== "object") {
10510
10901
  throw new Error(
@@ -10531,12 +10922,12 @@ var ConfigFileRepository = class {
10531
10922
  * @returns Array of directory paths that contain a packmind.json file
10532
10923
  */
10533
10924
  async findDescendantConfigs(directory) {
10534
- const normalizedDir = path9.resolve(directory);
10925
+ const normalizedDir = normalizePath(path10.resolve(directory));
10535
10926
  const results = [];
10536
10927
  const searchRecursively = async (currentDir) => {
10537
10928
  let entries;
10538
10929
  try {
10539
- entries = await fs9.readdir(currentDir, { withFileTypes: true });
10930
+ entries = await fs10.readdir(currentDir, { withFileTypes: true });
10540
10931
  } catch {
10541
10932
  return;
10542
10933
  }
@@ -10547,7 +10938,7 @@ var ConfigFileRepository = class {
10547
10938
  if (this.EXCLUDED_DIRECTORIES.includes(entry.name)) {
10548
10939
  continue;
10549
10940
  }
10550
- const entryPath = path9.join(currentDir, entry.name);
10941
+ const entryPath = normalizePath(path10.join(currentDir, entry.name));
10551
10942
  const config = await this.readConfig(entryPath);
10552
10943
  if (config) {
10553
10944
  results.push(entryPath);
@@ -10569,19 +10960,21 @@ var ConfigFileRepository = class {
10569
10960
  async readHierarchicalConfig(startDirectory, stopDirectory) {
10570
10961
  const configs = [];
10571
10962
  const configPaths = [];
10572
- const normalizedStart = path9.resolve(startDirectory);
10573
- const normalizedStop = stopDirectory ? path9.resolve(stopDirectory) : null;
10963
+ const normalizedStart = normalizePath(path10.resolve(startDirectory));
10964
+ const normalizedStop = stopDirectory ? normalizePath(path10.resolve(stopDirectory)) : null;
10574
10965
  let currentDir = normalizedStart;
10575
10966
  while (true) {
10576
10967
  const config = await this.readConfig(currentDir);
10577
10968
  if (config) {
10578
10969
  configs.push(config);
10579
- configPaths.push(path9.join(currentDir, this.CONFIG_FILENAME));
10970
+ configPaths.push(
10971
+ normalizePath(path10.join(currentDir, this.CONFIG_FILENAME))
10972
+ );
10580
10973
  }
10581
10974
  if (normalizedStop !== null && currentDir === normalizedStop) {
10582
10975
  break;
10583
10976
  }
10584
- const parentDir = path9.dirname(currentDir);
10977
+ const parentDir = normalizePath(path10.dirname(currentDir));
10585
10978
  if (parentDir === currentDir) {
10586
10979
  break;
10587
10980
  }
@@ -10610,8 +11003,8 @@ var ConfigFileRepository = class {
10610
11003
  * @returns All configs found with their target paths
10611
11004
  */
10612
11005
  async findAllConfigsInTree(startDirectory, stopDirectory) {
10613
- const normalizedStart = path9.resolve(startDirectory);
10614
- const normalizedStop = stopDirectory ? path9.resolve(stopDirectory) : null;
11006
+ const normalizedStart = normalizePath(path10.resolve(startDirectory));
11007
+ const normalizedStop = stopDirectory ? normalizePath(path10.resolve(stopDirectory)) : null;
10615
11008
  const basePath = normalizedStop ?? normalizedStart;
10616
11009
  const configsMap = /* @__PURE__ */ new Map();
10617
11010
  let currentDir = normalizedStart;
@@ -10628,7 +11021,7 @@ var ConfigFileRepository = class {
10628
11021
  if (normalizedStop !== null && currentDir === normalizedStop) {
10629
11022
  break;
10630
11023
  }
10631
- const parentDir = path9.dirname(currentDir);
11024
+ const parentDir = normalizePath(path10.dirname(currentDir));
10632
11025
  if (parentDir === currentDir) {
10633
11026
  break;
10634
11027
  }
@@ -10637,18 +11030,19 @@ var ConfigFileRepository = class {
10637
11030
  const searchRoot = normalizedStop ?? normalizedStart;
10638
11031
  const descendantDirs = await this.findDescendantConfigs(searchRoot);
10639
11032
  for (const descendantDir of descendantDirs) {
10640
- if (configsMap.has(descendantDir)) {
11033
+ const normalizedDescendantDir = normalizePath(descendantDir);
11034
+ if (configsMap.has(normalizedDescendantDir)) {
10641
11035
  continue;
10642
11036
  }
10643
- const config = await this.readConfig(descendantDir);
11037
+ const config = await this.readConfig(normalizedDescendantDir);
10644
11038
  if (config) {
10645
11039
  const targetPath = this.computeRelativeTargetPath(
10646
- descendantDir,
11040
+ normalizedDescendantDir,
10647
11041
  basePath
10648
11042
  );
10649
- configsMap.set(descendantDir, {
11043
+ configsMap.set(normalizedDescendantDir, {
10650
11044
  targetPath,
10651
- absoluteTargetPath: descendantDir,
11045
+ absoluteTargetPath: normalizedDescendantDir,
10652
11046
  packages: config.packages
10653
11047
  });
10654
11048
  }
@@ -10671,10 +11065,12 @@ var ConfigFileRepository = class {
10671
11065
  };
10672
11066
  }
10673
11067
  computeRelativeTargetPath(absolutePath, basePath) {
10674
- if (absolutePath === basePath) {
11068
+ const normalizedAbsolute = normalizePath(absolutePath);
11069
+ const normalizedBase = normalizePath(basePath);
11070
+ if (normalizedAbsolute === normalizedBase) {
10675
11071
  return "/";
10676
11072
  }
10677
- const relativePath = absolutePath.substring(basePath.length);
11073
+ const relativePath = normalizedAbsolute.substring(normalizedBase.length);
10678
11074
  return relativePath.startsWith("/") ? relativePath : "/" + relativePath;
10679
11075
  }
10680
11076
  };
@@ -10712,6 +11108,9 @@ var PackmindCliHexaFactory = class {
10712
11108
  installPackages: new InstallPackagesUseCase(
10713
11109
  this.repositories.packmindGateway
10714
11110
  ),
11111
+ installDefaultSkills: new InstallDefaultSkillsUseCase(
11112
+ this.repositories.packmindGateway
11113
+ ),
10715
11114
  listPackages: new ListPackagesUseCase(this.repositories.packmindGateway),
10716
11115
  getPackageBySlug: new GetPackageSummaryUseCase(
10717
11116
  this.repositories.packmindGateway
@@ -10748,29 +11147,29 @@ var PackmindCliHexa = class {
10748
11147
  this.logger.info("Destroying PackmindCliHexa");
10749
11148
  this.logger.info("PackmindCliHexa destroyed");
10750
11149
  }
10751
- async getGitRemoteUrl(command9) {
10752
- return this.hexa.useCases.getGitRemoteUrl.execute(command9);
11150
+ async getGitRemoteUrl(command12) {
11151
+ return this.hexa.useCases.getGitRemoteUrl.execute(command12);
10753
11152
  }
10754
- async executeSingleFileAst(command9) {
10755
- return this.hexa.useCases.executeSingleFileAst.execute(command9);
11153
+ async executeSingleFileAst(command12) {
11154
+ return this.hexa.useCases.executeSingleFileAst.execute(command12);
10756
11155
  }
10757
- async listFilesInDirectory(command9) {
10758
- return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command9);
11156
+ async listFilesInDirectory(command12) {
11157
+ return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command12);
10759
11158
  }
10760
- async lintFilesInDirectory(command9) {
10761
- return this.hexa.useCases.lintFilesInDirectory.execute(command9);
11159
+ async lintFilesInDirectory(command12) {
11160
+ return this.hexa.useCases.lintFilesInDirectory.execute(command12);
10762
11161
  }
10763
- async lintFilesLocally(command9) {
10764
- return this.hexa.useCases.lintFilesLocally.execute(command9);
11162
+ async lintFilesLocally(command12) {
11163
+ return this.hexa.useCases.lintFilesLocally.execute(command12);
10765
11164
  }
10766
- async installPackages(command9) {
10767
- return this.hexa.useCases.installPackages.execute(command9);
11165
+ async installPackages(command12) {
11166
+ return this.hexa.useCases.installPackages.execute(command12);
10768
11167
  }
10769
- async listPackages(command9) {
10770
- return this.hexa.useCases.listPackages.execute(command9);
11168
+ async listPackages(command12) {
11169
+ return this.hexa.useCases.listPackages.execute(command12);
10771
11170
  }
10772
- async getPackageBySlug(command9) {
10773
- return this.hexa.useCases.getPackageBySlug.execute(command9);
11171
+ async getPackageBySlug(command12) {
11172
+ return this.hexa.useCases.getPackageBySlug.execute(command12);
10774
11173
  }
10775
11174
  async configExists(baseDirectory) {
10776
11175
  return await this.hexa.repositories.configFileRepository.configExists(
@@ -10829,17 +11228,17 @@ var PackmindCliHexa = class {
10829
11228
  directory
10830
11229
  );
10831
11230
  }
10832
- async login(command9) {
10833
- return this.hexa.useCases.login.execute(command9);
11231
+ async login(command12) {
11232
+ return this.hexa.useCases.login.execute(command12);
10834
11233
  }
10835
- async logout(command9) {
10836
- return this.hexa.useCases.logout.execute(command9);
11234
+ async logout(command12) {
11235
+ return this.hexa.useCases.logout.execute(command12);
10837
11236
  }
10838
- async whoami(command9) {
10839
- return this.hexa.useCases.whoami.execute(command9);
11237
+ async whoami(command12) {
11238
+ return this.hexa.useCases.whoami.execute(command12);
10840
11239
  }
10841
- async setupMcp(command9) {
10842
- return this.hexa.useCases.setupMcp.execute(command9);
11240
+ async setupMcp(command12) {
11241
+ return this.hexa.useCases.setupMcp.execute(command12);
10843
11242
  }
10844
11243
  getCurrentBranch(repoPath) {
10845
11244
  return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
@@ -10847,11 +11246,17 @@ var PackmindCliHexa = class {
10847
11246
  getGitRemoteUrlFromPath(repoPath) {
10848
11247
  return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
10849
11248
  }
10850
- async notifyDistribution(command9) {
10851
- return this.hexa.repositories.packmindGateway.notifyDistribution(command9);
11249
+ async notifyDistribution(command12) {
11250
+ return this.hexa.repositories.packmindGateway.notifyDistribution(command12);
10852
11251
  }
10853
- async uploadSkill(command9) {
10854
- return this.hexa.repositories.packmindGateway.uploadSkill(command9);
11252
+ async uploadSkill(command12) {
11253
+ return this.hexa.repositories.packmindGateway.uploadSkill(command12);
11254
+ }
11255
+ async installDefaultSkills(command12) {
11256
+ return this.hexa.useCases.installDefaultSkills.execute(command12);
11257
+ }
11258
+ getPackmindGateway() {
11259
+ return this.hexa.repositories.packmindGateway;
10855
11260
  }
10856
11261
  };
10857
11262
 
@@ -10864,7 +11269,7 @@ var IDELintLogger = class {
10864
11269
  }
10865
11270
  logViolation(violation) {
10866
11271
  violation.violations.forEach(({ line, character, standard, rule }) => {
10867
- console.log(
11272
+ logConsole(
10868
11273
  `${violation.file}:${line}:${character}:error:@${standard}/${rule}`
10869
11274
  );
10870
11275
  });
@@ -10890,9 +11295,9 @@ var HumanReadableLogger = class {
10890
11295
  }
10891
11296
  }
10892
11297
  logViolation(violation) {
10893
- console.log(formatFilePath(violation.file));
11298
+ logConsole(formatFilePath(violation.file));
10894
11299
  violation.violations.forEach(({ line, character, standard, rule }) => {
10895
- console.log(
11300
+ logConsole(
10896
11301
  formatError(` ${line}:${character} error @${standard}/${rule}`)
10897
11302
  );
10898
11303
  });
@@ -10908,7 +11313,7 @@ function isNotLoggedInError(error) {
10908
11313
  }
10909
11314
  async function lintHandler(args2, deps) {
10910
11315
  const {
10911
- path: path12,
11316
+ path: path13,
10912
11317
  draft,
10913
11318
  rule,
10914
11319
  language,
@@ -10928,7 +11333,7 @@ async function lintHandler(args2, deps) {
10928
11333
  throw new Error("option --rule is required to use --draft mode");
10929
11334
  }
10930
11335
  const startedAt = Date.now();
10931
- const targetPath = path12 ?? ".";
11336
+ const targetPath = path13 ?? ".";
10932
11337
  const hasArguments = !!(draft || rule || language);
10933
11338
  const absolutePath = resolvePath(targetPath);
10934
11339
  if (diff) {
@@ -11185,8 +11590,8 @@ function extractWasmFiles() {
11185
11590
 
11186
11591
  // apps/cli/src/main.ts
11187
11592
  var import_dotenv = require("dotenv");
11188
- var fs12 = __toESM(require("fs"));
11189
- var path11 = __toESM(require("path"));
11593
+ var fs15 = __toESM(require("fs"));
11594
+ var path12 = __toESM(require("path"));
11190
11595
 
11191
11596
  // apps/cli/src/infra/commands/InstallCommand.ts
11192
11597
  var import_cmd_ts2 = __toESM(require_cjs());
@@ -11220,6 +11625,31 @@ async function notifyDistributionIfInGitRepo(params) {
11220
11625
  return false;
11221
11626
  }
11222
11627
  }
11628
+ async function installDefaultSkillsIfAtGitRoot(params) {
11629
+ const { packmindCliHexa, cwd, log } = params;
11630
+ const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
11631
+ if (!gitRoot || cwd !== gitRoot) {
11632
+ return;
11633
+ }
11634
+ try {
11635
+ log("\nInstalling default skills...");
11636
+ const skillsResult = await packmindCliHexa.installDefaultSkills({});
11637
+ if (skillsResult.errors.length > 0) {
11638
+ skillsResult.errors.forEach((err) => {
11639
+ log(` Warning: ${err}`);
11640
+ });
11641
+ }
11642
+ const totalSkillFiles = skillsResult.filesCreated + skillsResult.filesUpdated;
11643
+ if (totalSkillFiles > 0) {
11644
+ log(
11645
+ `Default skills: added ${skillsResult.filesCreated} files, changed ${skillsResult.filesUpdated} files`
11646
+ );
11647
+ } else if (skillsResult.errors.length === 0) {
11648
+ log("Default skills are already up to date");
11649
+ }
11650
+ } catch {
11651
+ }
11652
+ }
11223
11653
  async function listPackagesHandler(_args, deps) {
11224
11654
  const { packmindCliHexa, exit, log, error } = deps;
11225
11655
  try {
@@ -11437,8 +11867,9 @@ async function executeInstallForDirectory(directory, deps) {
11437
11867
  errorMessage: result.errors.join(", ")
11438
11868
  };
11439
11869
  }
11870
+ const skillDirsDeleted = result.skillDirectoriesDeleted || 0;
11440
11871
  let notificationSent = false;
11441
- if (result.filesCreated > 0 || result.filesUpdated > 0 || result.filesDeleted > 0) {
11872
+ if (result.filesCreated > 0 || result.filesUpdated > 0 || result.filesDeleted > 0 || skillDirsDeleted > 0) {
11442
11873
  notificationSent = await notifyDistributionIfInGitRepo({
11443
11874
  packmindCliHexa,
11444
11875
  cwd: directory,
@@ -11451,7 +11882,7 @@ async function executeInstallForDirectory(directory, deps) {
11451
11882
  success: true,
11452
11883
  filesCreated: result.filesCreated,
11453
11884
  filesUpdated: result.filesUpdated,
11454
- filesDeleted: result.filesDeleted,
11885
+ filesDeleted: result.filesDeleted + skillDirsDeleted,
11455
11886
  notificationSent
11456
11887
  };
11457
11888
  } catch (err) {
@@ -11526,11 +11957,32 @@ async function installPackagesHandler(args2, deps) {
11526
11957
  log(
11527
11958
  `Fetching ${packageCount} ${packageWord}: ${allPackages.join(", ")}...`
11528
11959
  );
11960
+ let gitRemoteUrl;
11961
+ let gitBranch;
11962
+ let relativePath;
11963
+ const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
11964
+ if (gitRoot) {
11965
+ try {
11966
+ gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
11967
+ gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
11968
+ relativePath = cwd.startsWith(gitRoot) ? cwd.slice(gitRoot.length) : "/";
11969
+ if (!relativePath.startsWith("/")) {
11970
+ relativePath = "/" + relativePath;
11971
+ }
11972
+ if (!relativePath.endsWith("/")) {
11973
+ relativePath = relativePath + "/";
11974
+ }
11975
+ } catch {
11976
+ }
11977
+ }
11529
11978
  const result = await packmindCliHexa.installPackages({
11530
11979
  baseDirectory: cwd,
11531
11980
  packagesSlugs: allPackages,
11532
- previousPackagesSlugs: configPackages
11981
+ previousPackagesSlugs: configPackages,
11533
11982
  // Pass previous config for change detection
11983
+ gitRemoteUrl,
11984
+ gitBranch,
11985
+ relativePath
11534
11986
  });
11535
11987
  const parts = [];
11536
11988
  if (result.recipesCount > 0) parts.push(`${result.recipesCount} commands`);
@@ -11538,9 +11990,11 @@ async function installPackagesHandler(args2, deps) {
11538
11990
  parts.push(`${result.standardsCount} standards`);
11539
11991
  if (result.skillsCount > 0) parts.push(`${result.skillsCount} skills`);
11540
11992
  log(`Installing ${parts.join(", ") || "artifacts"}...`);
11993
+ const skillDirsDeleted = result.skillDirectoriesDeleted || 0;
11994
+ const totalDeleted = result.filesDeleted + skillDirsDeleted;
11541
11995
  log(
11542
11996
  `
11543
- added ${result.filesCreated} files, changed ${result.filesUpdated} files, removed ${result.filesDeleted} files`
11997
+ added ${result.filesCreated} files, changed ${result.filesUpdated} files, removed ${totalDeleted} files`
11544
11998
  );
11545
11999
  if (result.errors.length > 0) {
11546
12000
  log("\n\u26A0\uFE0F Errors encountered:");
@@ -11551,12 +12005,12 @@ added ${result.filesCreated} files, changed ${result.filesUpdated} files, remove
11551
12005
  return {
11552
12006
  filesCreated: result.filesCreated,
11553
12007
  filesUpdated: result.filesUpdated,
11554
- filesDeleted: result.filesDeleted,
12008
+ filesDeleted: totalDeleted,
11555
12009
  notificationSent: false
11556
12010
  };
11557
12011
  }
11558
12012
  let notificationSent = false;
11559
- if (result.filesCreated > 0 || result.filesUpdated > 0 || result.filesDeleted > 0) {
12013
+ if (result.filesCreated > 0 || result.filesUpdated > 0 || result.filesDeleted > 0 || skillDirsDeleted > 0) {
11560
12014
  notificationSent = await notifyDistributionIfInGitRepo({
11561
12015
  packmindCliHexa,
11562
12016
  cwd,
@@ -11564,10 +12018,11 @@ added ${result.filesCreated} files, changed ${result.filesUpdated} files, remove
11564
12018
  log
11565
12019
  });
11566
12020
  }
12021
+ await installDefaultSkillsIfAtGitRoot({ packmindCliHexa, cwd, log });
11567
12022
  return {
11568
12023
  filesCreated: result.filesCreated,
11569
12024
  filesUpdated: result.filesUpdated,
11570
- filesDeleted: result.filesDeleted,
12025
+ filesDeleted: totalDeleted,
11571
12026
  notificationSent
11572
12027
  };
11573
12028
  } catch (err) {
@@ -12015,10 +12470,11 @@ var loginCommand = (0, import_cmd_ts4.command)({
12015
12470
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
12016
12471
  try {
12017
12472
  if (!code) {
12018
- console.log("\nOpening browser for authentication...");
12019
- console.log(
12473
+ logConsole("\nOpening browser for authentication...");
12474
+ const normalizedHost = removeTrailingSlash(host);
12475
+ logConsole(
12020
12476
  `
12021
- If the browser doesn't open, visit: ${host}/cli-login?callback_url=${encodeURIComponent("http://127.0.0.1:19284")}
12477
+ If the browser doesn't open, visit: ${normalizedHost}/cli-login?callback_url=${encodeURIComponent("http://127.0.0.1:19284")}
12022
12478
  `
12023
12479
  );
12024
12480
  logInfoConsole("Waiting for browser authentication...");
@@ -12026,9 +12482,9 @@ If the browser doesn't open, visit: ${host}/cli-login?callback_url=${encodeURICo
12026
12482
  logInfoConsole("Exchanging code for API key...");
12027
12483
  const result = await packmindCliHexa.login({ host, code });
12028
12484
  logSuccessConsole("Login successful!");
12029
- console.log(`
12485
+ logConsole(`
12030
12486
  Credentials saved to: ${result.credentialsPath}`);
12031
- console.log(
12487
+ logConsole(
12032
12488
  "\nYou can now use packmind-cli commands with your authenticated account."
12033
12489
  );
12034
12490
  } catch (error) {
@@ -12059,20 +12515,20 @@ var logoutCommand = (0, import_cmd_ts5.command)({
12059
12515
  }
12060
12516
  if (result.hadCredentialsFile) {
12061
12517
  logSuccessConsole("Logged out successfully.");
12062
- console.log(`Removed credentials from: ${result.credentialsPath}`);
12518
+ logConsole(`Removed credentials from: ${result.credentialsPath}`);
12063
12519
  }
12064
12520
  if (result.hasEnvVar) {
12065
12521
  if (!result.hadCredentialsFile) {
12066
12522
  logInfoConsole("No stored credentials file found.");
12067
12523
  }
12068
- console.log(
12524
+ logConsole(
12069
12525
  "\nNote: PACKMIND_API_KEY_V3 environment variable is still set."
12070
12526
  );
12071
- console.log("To fully log out, run: unset PACKMIND_API_KEY_V3");
12527
+ logConsole("To fully log out, run: unset PACKMIND_API_KEY_V3");
12072
12528
  }
12073
12529
  } catch (error) {
12074
12530
  logErrorConsole("Failed to remove credentials file.");
12075
- console.log(
12531
+ logConsole(
12076
12532
  `Error: ${error instanceof Error ? error.message : String(error)}`
12077
12533
  );
12078
12534
  process.exit(1);
@@ -12101,20 +12557,20 @@ function formatExpiresAt(expiresAt) {
12101
12557
  return "Expires soon";
12102
12558
  }
12103
12559
  function displayAuthInfo(result) {
12104
- console.log(`
12560
+ logConsole(`
12105
12561
  Host: ${result.host}`);
12106
12562
  if (result.organizationName) {
12107
- console.log(`Organization: ${result.organizationName}`);
12563
+ logConsole(`Organization: ${result.organizationName}`);
12108
12564
  }
12109
12565
  if (result.userName) {
12110
- console.log(`User: ${result.userName}`);
12566
+ logConsole(`User: ${result.userName}`);
12111
12567
  }
12112
12568
  if (result.expiresAt) {
12113
- console.log(formatExpiresAt(result.expiresAt));
12569
+ logConsole(formatExpiresAt(result.expiresAt));
12114
12570
  }
12115
12571
  logInfoConsole(`Source: ${result.source}`);
12116
12572
  if (result.isExpired) {
12117
- console.log("\nRun `packmind-cli login` to re-authenticate.");
12573
+ logConsole("\nRun `packmind-cli login` to re-authenticate.");
12118
12574
  }
12119
12575
  }
12120
12576
  var whoamiCommand = (0, import_cmd_ts6.command)({
@@ -12127,14 +12583,14 @@ var whoamiCommand = (0, import_cmd_ts6.command)({
12127
12583
  const result = await packmindCliHexa.whoami({});
12128
12584
  if (!result.isAuthenticated) {
12129
12585
  logErrorConsole("Not authenticated");
12130
- console.log(
12586
+ logConsole(
12131
12587
  `
12132
12588
  No credentials found. Run \`packmind-cli login\` to authenticate.`
12133
12589
  );
12134
- console.log(`
12590
+ logConsole(`
12135
12591
  Credentials are loaded from (in order of priority):`);
12136
- console.log(` 1. PACKMIND_API_KEY_V3 environment variable`);
12137
- console.log(` 2. ${result.credentialsPath}`);
12592
+ logConsole(` 1. PACKMIND_API_KEY_V3 environment variable`);
12593
+ logConsole(` 2. ${result.credentialsPath}`);
12138
12594
  process.exit(1);
12139
12595
  }
12140
12596
  if (result.isExpired) {
@@ -12151,13 +12607,13 @@ Credentials are loaded from (in order of priority):`);
12151
12607
 
12152
12608
  // apps/cli/src/infra/commands/SetupMcpCommand.ts
12153
12609
  var import_cmd_ts7 = __toESM(require_cjs());
12154
- var fs11 = __toESM(require("fs"));
12610
+ var fs12 = __toESM(require("fs"));
12155
12611
  var readline2 = __toESM(require("readline"));
12156
12612
  var inquirer = __toESM(require("inquirer"));
12157
12613
 
12158
12614
  // apps/cli/src/application/services/AgentDetectionService.ts
12159
- var fs10 = __toESM(require("fs"));
12160
- var path10 = __toESM(require("path"));
12615
+ var fs11 = __toESM(require("fs"));
12616
+ var path11 = __toESM(require("path"));
12161
12617
  var os4 = __toESM(require("os"));
12162
12618
  var import_child_process3 = require("child_process");
12163
12619
  var AgentDetectionService = class {
@@ -12184,21 +12640,21 @@ var AgentDetectionService = class {
12184
12640
  return this.isCommandAvailable("claude");
12185
12641
  }
12186
12642
  isCursorAvailable() {
12187
- const cursorConfigDir = path10.join(os4.homedir(), ".cursor");
12188
- return fs10.existsSync(cursorConfigDir);
12643
+ const cursorConfigDir = path11.join(os4.homedir(), ".cursor");
12644
+ return fs11.existsSync(cursorConfigDir);
12189
12645
  }
12190
12646
  isVSCodeAvailable() {
12191
- const vscodeDir = path10.join(this.projectDir, ".vscode");
12192
- return fs10.existsSync(vscodeDir);
12647
+ const vscodeDir = path11.join(this.projectDir, ".vscode");
12648
+ return fs11.existsSync(vscodeDir);
12193
12649
  }
12194
12650
  isContinueAvailable() {
12195
- const continueDir = path10.join(this.projectDir, ".continue");
12196
- return fs10.existsSync(continueDir);
12651
+ const continueDir = path11.join(this.projectDir, ".continue");
12652
+ return fs11.existsSync(continueDir);
12197
12653
  }
12198
- isCommandAvailable(command9) {
12654
+ isCommandAvailable(command12) {
12199
12655
  try {
12200
12656
  const whichCommand = process.platform === "win32" ? "where" : "which";
12201
- (0, import_child_process3.execSync)(`${whichCommand} ${command9}`, { stdio: "pipe" });
12657
+ (0, import_child_process3.execSync)(`${whichCommand} ${command12}`, { stdio: "pipe" });
12202
12658
  return true;
12203
12659
  } catch {
12204
12660
  return false;
@@ -12232,8 +12688,8 @@ var ALL_AGENTS2 = [
12232
12688
  { type: "continue", name: "Continue.dev" }
12233
12689
  ];
12234
12690
  async function promptAgentsWithReadline(choices) {
12235
- const input = fs11.createReadStream("/dev/tty");
12236
- const output = fs11.createWriteStream("/dev/tty");
12691
+ const input = fs12.createReadStream("/dev/tty");
12692
+ const output = fs12.createWriteStream("/dev/tty");
12237
12693
  const rl = readline2.createInterface({
12238
12694
  input,
12239
12695
  output
@@ -12278,18 +12734,18 @@ var setupMcpCommand = (0, import_cmd_ts7.command)({
12278
12734
  const credentials = loadCredentials();
12279
12735
  if (!credentials) {
12280
12736
  logErrorConsole("Not authenticated");
12281
- console.log("\nNo credentials found. You can authenticate by either:");
12282
- console.log(" 1. Running `packmind-cli login`");
12283
- console.log(" 2. Setting PACKMIND_API_KEY_V3 environment variable");
12284
- console.log(`
12737
+ logConsole("\nNo credentials found. You can authenticate by either:");
12738
+ logConsole(" 1. Running `packmind-cli login`");
12739
+ logConsole(" 2. Setting PACKMIND_API_KEY_V3 environment variable");
12740
+ logConsole(`
12285
12741
  Credentials are loaded from (in order of priority):`);
12286
- console.log(` 1. PACKMIND_API_KEY_V3 environment variable`);
12287
- console.log(` 2. ${getCredentialsPath()}`);
12742
+ logConsole(` 1. PACKMIND_API_KEY_V3 environment variable`);
12743
+ logConsole(` 2. ${getCredentialsPath()}`);
12288
12744
  process.exit(1);
12289
12745
  }
12290
12746
  if (credentials.isExpired) {
12291
12747
  logErrorConsole("Credentials expired");
12292
- console.log("\nRun `packmind-cli login` to re-authenticate.");
12748
+ logConsole("\nRun `packmind-cli login` to re-authenticate.");
12293
12749
  process.exit(1);
12294
12750
  }
12295
12751
  const agentDetectionService = new AgentDetectionService();
@@ -12297,16 +12753,16 @@ Credentials are loaded from (in order of priority):`);
12297
12753
  if (targets.length > 0) {
12298
12754
  selectedAgents = targets.map((t) => agentArgToType[t]);
12299
12755
  } else {
12300
- console.log("\nDetecting installed AI agents...\n");
12756
+ logConsole("\nDetecting installed AI agents...\n");
12301
12757
  const detectedAgents = agentDetectionService.detectAgents();
12302
12758
  if (detectedAgents.length > 0) {
12303
- console.log("Found agents:");
12759
+ logConsole("Found agents:");
12304
12760
  detectedAgents.forEach((detectedAgent) => {
12305
- console.log(` - ${detectedAgent.name}`);
12761
+ logConsole(` - ${detectedAgent.name}`);
12306
12762
  });
12307
- console.log("");
12763
+ logConsole("");
12308
12764
  } else {
12309
- console.log("No supported agents detected.\n");
12765
+ logConsole("No supported agents detected.\n");
12310
12766
  }
12311
12767
  const detectedTypes = new Set(detectedAgents.map((a) => a.type));
12312
12768
  const choices = ALL_AGENTS2.map((agentInfo) => ({
@@ -12330,12 +12786,12 @@ Credentials are loaded from (in order of priority):`);
12330
12786
  promptedAgents = result2.selectedAgents;
12331
12787
  }
12332
12788
  if (promptedAgents.length === 0) {
12333
- console.log("\nNo agents selected. Exiting.");
12789
+ logConsole("\nNo agents selected. Exiting.");
12334
12790
  process.exit(0);
12335
12791
  }
12336
12792
  selectedAgents = promptedAgents;
12337
12793
  }
12338
- console.log("\nFetching MCP configuration...\n");
12794
+ logConsole("\nFetching MCP configuration...\n");
12339
12795
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
12340
12796
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
12341
12797
  let result;
@@ -12344,14 +12800,14 @@ Credentials are loaded from (in order of priority):`);
12344
12800
  } catch (error) {
12345
12801
  logErrorConsole("Failed to fetch MCP configuration from server.");
12346
12802
  if (error instanceof Error) {
12347
- console.log(` ${error.message}`);
12803
+ logConsole(` ${error.message}`);
12348
12804
  }
12349
12805
  process.exit(1);
12350
12806
  }
12351
12807
  let successCount = 0;
12352
12808
  const failedAgents = [];
12353
12809
  for (const agentResult of result.results) {
12354
- console.log(`Installing MCP for ${agentResult.agentName}...`);
12810
+ logConsole(`Installing MCP for ${agentResult.agentName}...`);
12355
12811
  if (agentResult.success) {
12356
12812
  logSuccessConsole(` ${agentResult.agentName} configured successfully`);
12357
12813
  successCount++;
@@ -12363,27 +12819,27 @@ Credentials are loaded from (in order of priority):`);
12363
12819
  });
12364
12820
  }
12365
12821
  }
12366
- console.log("");
12822
+ logConsole("");
12367
12823
  if (failedAgents.length > 0) {
12368
12824
  for (const failed of failedAgents) {
12369
12825
  logWarningConsole(`Failed to configure ${failed.name}:`);
12370
- console.log(`
12826
+ logConsole(`
12371
12827
  Error: ${failed.error}`);
12372
12828
  if (failed.error.includes("ENOENT") || failed.error.includes("not found") || failed.error.includes("command not found")) {
12373
- console.log(
12829
+ logConsole(
12374
12830
  `
12375
12831
  Hint: Make sure the agent CLI is installed and available in your PATH.`
12376
12832
  );
12377
12833
  }
12378
- console.log(`
12834
+ logConsole(`
12379
12835
  Manual configuration:`);
12380
- console.log(result.manualConfigJson);
12381
- console.log("");
12836
+ logConsole(result.manualConfigJson ?? "undefined");
12837
+ logConsole("");
12382
12838
  }
12383
12839
  }
12384
12840
  if (successCount > 0) {
12385
12841
  const agentWord = successCount === 1 ? "agent" : "agents";
12386
- console.log(
12842
+ logConsole(
12387
12843
  formatBold(`Done! MCP configured for ${successCount} ${agentWord}.`)
12388
12844
  );
12389
12845
  }
@@ -12394,7 +12850,7 @@ Credentials are loaded from (in order of priority):`);
12394
12850
  });
12395
12851
 
12396
12852
  // apps/cli/src/infra/commands/SkillsCommand.ts
12397
- var import_cmd_ts9 = __toESM(require_cjs());
12853
+ var import_cmd_ts10 = __toESM(require_cjs());
12398
12854
 
12399
12855
  // apps/cli/src/infra/commands/skills/AddSkillCommand.ts
12400
12856
  var import_cmd_ts8 = __toESM(require_cjs());
@@ -12444,12 +12900,426 @@ var addSkillCommand = (0, import_cmd_ts8.command)({
12444
12900
  }
12445
12901
  });
12446
12902
 
12903
+ // apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
12904
+ var import_cmd_ts9 = __toESM(require_cjs());
12905
+ var installDefaultSkillsCommand = (0, import_cmd_ts9.command)({
12906
+ name: "install-default",
12907
+ description: "Install default Packmind skills for configured coding agents",
12908
+ args: {},
12909
+ handler: async () => {
12910
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
12911
+ const packmindCliHexa = new PackmindCliHexa(packmindLogger);
12912
+ try {
12913
+ logInfoConsole("Installing default skills...");
12914
+ const result = await packmindCliHexa.installDefaultSkills({});
12915
+ console.log(JSON.stringify(result, null, 2));
12916
+ if (result.errors.length > 0) {
12917
+ for (const error of result.errors) {
12918
+ logErrorConsole(`Error: ${error}`);
12919
+ }
12920
+ process.exit(1);
12921
+ }
12922
+ const totalFiles = result.filesCreated + result.filesUpdated;
12923
+ if (totalFiles === 0) {
12924
+ logInfoConsole("Default skills are already up to date.");
12925
+ } else {
12926
+ logSuccessConsole("Default skills installed successfully!");
12927
+ if (result.filesCreated > 0) {
12928
+ logInfoConsole(` Files created: ${result.filesCreated}`);
12929
+ }
12930
+ if (result.filesUpdated > 0) {
12931
+ logInfoConsole(` Files updated: ${result.filesUpdated}`);
12932
+ }
12933
+ }
12934
+ } catch (error) {
12935
+ if (error instanceof Error) {
12936
+ logErrorConsole(`Installation failed: ${error.message}`);
12937
+ } else {
12938
+ logErrorConsole(`Installation failed: ${String(error)}`);
12939
+ }
12940
+ process.exit(1);
12941
+ }
12942
+ }
12943
+ });
12944
+
12447
12945
  // apps/cli/src/infra/commands/SkillsCommand.ts
12448
- var skillsCommand = (0, import_cmd_ts9.subcommands)({
12946
+ var skillsCommand = (0, import_cmd_ts10.subcommands)({
12449
12947
  name: "skills",
12450
12948
  description: "Manage skills in your Packmind organization",
12451
12949
  cmds: {
12452
- add: addSkillCommand
12950
+ add: addSkillCommand,
12951
+ init: installDefaultSkillsCommand
12952
+ }
12953
+ });
12954
+
12955
+ // apps/cli/src/infra/commands/StandardsCommand.ts
12956
+ var import_cmd_ts12 = __toESM(require_cjs());
12957
+
12958
+ // apps/cli/src/infra/commands/CreateStandardCommand.ts
12959
+ var import_cmd_ts11 = __toESM(require_cjs());
12960
+
12961
+ // apps/cli/src/infra/utils/readPlaybookFile.ts
12962
+ var fs13 = __toESM(require("fs/promises"));
12963
+
12964
+ // apps/cli/src/domain/entities/PlaybookDTO.ts
12965
+ var import_zod = require("zod");
12966
+ var playbookRuleExampleSchema = import_zod.z.object({
12967
+ positive: import_zod.z.string().describe("Valid example of the rule"),
12968
+ negative: import_zod.z.string().describe("Invalid example of the rule"),
12969
+ language: import_zod.z.string().describe("Programming language")
12970
+ });
12971
+ var playbookRuleSchema = import_zod.z.object({
12972
+ content: import_zod.z.string().min(1).describe("Rule description starting with action verb"),
12973
+ examples: playbookRuleExampleSchema.optional()
12974
+ });
12975
+ var playbookDTOSchema = import_zod.z.object({
12976
+ name: import_zod.z.string().min(1).describe("Standard name"),
12977
+ description: import_zod.z.string().min(1).describe("Standard description"),
12978
+ scope: import_zod.z.string().min(1).describe("Standard scope/context"),
12979
+ rules: import_zod.z.array(playbookRuleSchema).min(1).describe("Array of rules (minimum 1)")
12980
+ });
12981
+
12982
+ // apps/cli/src/infra/utils/playbookValidator.ts
12983
+ function validatePlaybook(data) {
12984
+ const result = playbookDTOSchema.safeParse(data);
12985
+ if (!result.success) {
12986
+ const errorList = result.error.issues;
12987
+ return {
12988
+ isValid: false,
12989
+ errors: errorList.map((e) => `${e.path.join(".")}: ${e.message}`)
12990
+ };
12991
+ }
12992
+ return {
12993
+ isValid: true,
12994
+ data: result.data
12995
+ };
12996
+ }
12997
+
12998
+ // apps/cli/src/infra/utils/readPlaybookFile.ts
12999
+ async function readPlaybookFile(filePath) {
13000
+ try {
13001
+ const content = await fs13.readFile(filePath, "utf-8");
13002
+ let parsed;
13003
+ try {
13004
+ parsed = JSON.parse(content);
13005
+ } catch (e) {
13006
+ return {
13007
+ isValid: false,
13008
+ errors: [
13009
+ `Invalid JSON: ${e instanceof Error ? e.message : "Unknown error"}`
13010
+ ]
13011
+ };
13012
+ }
13013
+ return validatePlaybook(parsed);
13014
+ } catch (e) {
13015
+ return {
13016
+ isValid: false,
13017
+ errors: [
13018
+ `Failed to read file: ${e instanceof Error ? e.message : "Unknown error"}`
13019
+ ]
13020
+ };
13021
+ }
13022
+ }
13023
+
13024
+ // apps/cli/src/infra/commands/createStandardHandler.ts
13025
+ async function createStandardHandler(filePath, useCase) {
13026
+ const readResult = await readPlaybookFile(filePath);
13027
+ if (!readResult.isValid) {
13028
+ return {
13029
+ success: false,
13030
+ error: `Validation failed: ${readResult.errors?.join(", ")}`
13031
+ };
13032
+ }
13033
+ if (!readResult.data) {
13034
+ return {
13035
+ success: false,
13036
+ error: "Failed to read playbook data"
13037
+ };
13038
+ }
13039
+ try {
13040
+ const result = await useCase.execute(readResult.data);
13041
+ return {
13042
+ success: true,
13043
+ standardId: result.standardId,
13044
+ standardName: result.name
13045
+ };
13046
+ } catch (e) {
13047
+ return {
13048
+ success: false,
13049
+ error: `Error creating standard: ${e instanceof Error ? e.message : "Unknown error"}`
13050
+ };
13051
+ }
13052
+ }
13053
+
13054
+ // apps/cli/src/application/useCases/CreateStandardFromPlaybookUseCase.ts
13055
+ var CreateStandardFromPlaybookUseCase = class {
13056
+ constructor(gateway) {
13057
+ this.gateway = gateway;
13058
+ }
13059
+ async execute(playbook) {
13060
+ const space = await this.gateway.getGlobalSpace();
13061
+ const standard = await this.gateway.createStandardInSpace(space.id, {
13062
+ name: playbook.name,
13063
+ description: playbook.description,
13064
+ scope: playbook.scope,
13065
+ rules: playbook.rules.map((r) => ({ content: r.content }))
13066
+ });
13067
+ const rulesWithExamples = playbook.rules.filter((r) => r.examples);
13068
+ if (rulesWithExamples.length > 0) {
13069
+ const createdRules = await this.gateway.getRulesForStandard(
13070
+ space.id,
13071
+ standard.id
13072
+ );
13073
+ for (let i = 0; i < playbook.rules.length; i++) {
13074
+ const rule = playbook.rules[i];
13075
+ if (rule.examples && createdRules[i]) {
13076
+ try {
13077
+ await this.gateway.addExampleToRule(
13078
+ space.id,
13079
+ standard.id,
13080
+ createdRules[i].id,
13081
+ rule.examples
13082
+ );
13083
+ } catch {
13084
+ }
13085
+ }
13086
+ }
13087
+ }
13088
+ return { standardId: standard.id, name: standard.name };
13089
+ }
13090
+ };
13091
+
13092
+ // apps/cli/src/infra/commands/CreateStandardCommand.ts
13093
+ var createStandardCommand = (0, import_cmd_ts11.command)({
13094
+ name: "create",
13095
+ description: "Create a coding standard from a playbook JSON file",
13096
+ args: {
13097
+ file: (0, import_cmd_ts11.positional)({
13098
+ displayName: "file",
13099
+ description: "Path to the playbook JSON file",
13100
+ type: import_cmd_ts11.string
13101
+ })
13102
+ },
13103
+ handler: async ({ file }) => {
13104
+ try {
13105
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
13106
+ const hexa = new PackmindCliHexa(packmindLogger);
13107
+ const gateway = hexa.getPackmindGateway();
13108
+ const useCase = new CreateStandardFromPlaybookUseCase(gateway);
13109
+ const result = await createStandardHandler(file, useCase);
13110
+ if (result.success) {
13111
+ logSuccessConsole(
13112
+ `Standard "${result.standardName}" created successfully (ID: ${result.standardId})`
13113
+ );
13114
+ process.exit(0);
13115
+ } else {
13116
+ logErrorConsole(`Failed to create standard: ${result.error}`);
13117
+ process.exit(1);
13118
+ }
13119
+ } catch (e) {
13120
+ logErrorConsole(
13121
+ `Error: ${e instanceof Error ? e.message : "Unknown error"}`
13122
+ );
13123
+ process.exit(1);
13124
+ }
13125
+ }
13126
+ });
13127
+
13128
+ // apps/cli/src/infra/commands/StandardsCommand.ts
13129
+ var standardsCommand = (0, import_cmd_ts12.subcommands)({
13130
+ name: "standards",
13131
+ description: "Manage coding standards",
13132
+ cmds: {
13133
+ create: createStandardCommand
13134
+ }
13135
+ });
13136
+
13137
+ // apps/cli/src/infra/commands/CommandsCommand.ts
13138
+ var import_cmd_ts14 = __toESM(require_cjs());
13139
+
13140
+ // apps/cli/src/infra/commands/CreateCommandCommand.ts
13141
+ var import_cmd_ts13 = __toESM(require_cjs());
13142
+
13143
+ // apps/cli/src/infra/utils/readCommandPlaybookFile.ts
13144
+ var fs14 = __toESM(require("fs/promises"));
13145
+
13146
+ // apps/cli/src/domain/entities/CommandPlaybookDTO.ts
13147
+ var import_zod2 = require("zod");
13148
+ var commandStepSchema = import_zod2.z.object({
13149
+ name: import_zod2.z.string().min(1).describe("Step name/title"),
13150
+ description: import_zod2.z.string().min(1).describe("Step description with implementation details"),
13151
+ codeSnippet: import_zod2.z.string().optional().describe("Optional code snippet demonstrating the step")
13152
+ });
13153
+ var commandPlaybookDTOSchema = import_zod2.z.object({
13154
+ name: import_zod2.z.string().min(1).describe("Command name"),
13155
+ summary: import_zod2.z.string().min(1).describe("Command summary describing intent and value"),
13156
+ whenToUse: import_zod2.z.array(import_zod2.z.string().min(1)).min(1).describe("Array of scenarios when this command is applicable (minimum 1)"),
13157
+ contextValidationCheckpoints: import_zod2.z.array(import_zod2.z.string().min(1)).min(1).describe(
13158
+ "Array of checkpoints to validate context before implementation (minimum 1)"
13159
+ ),
13160
+ steps: import_zod2.z.array(commandStepSchema).min(1).describe("Array of implementation steps (minimum 1)")
13161
+ });
13162
+
13163
+ // apps/cli/src/infra/utils/commandPlaybookValidator.ts
13164
+ function validateCommandPlaybook(data) {
13165
+ const result = commandPlaybookDTOSchema.safeParse(data);
13166
+ if (!result.success) {
13167
+ const errorList = result.error.issues;
13168
+ return {
13169
+ isValid: false,
13170
+ errors: errorList.map((e) => `${e.path.join(".")}: ${e.message}`)
13171
+ };
13172
+ }
13173
+ return {
13174
+ isValid: true,
13175
+ data: result.data
13176
+ };
13177
+ }
13178
+
13179
+ // apps/cli/src/infra/utils/readCommandPlaybookFile.ts
13180
+ async function readCommandPlaybookFile(filePath) {
13181
+ try {
13182
+ const content = await fs14.readFile(filePath, "utf-8");
13183
+ let parsed;
13184
+ try {
13185
+ parsed = JSON.parse(content);
13186
+ } catch (e) {
13187
+ return {
13188
+ isValid: false,
13189
+ errors: [
13190
+ `Invalid JSON: ${e instanceof Error ? e.message : "Unknown error"}`
13191
+ ]
13192
+ };
13193
+ }
13194
+ return validateCommandPlaybook(parsed);
13195
+ } catch (e) {
13196
+ return {
13197
+ isValid: false,
13198
+ errors: [
13199
+ `Failed to read file: ${e instanceof Error ? e.message : "Unknown error"}`
13200
+ ]
13201
+ };
13202
+ }
13203
+ }
13204
+
13205
+ // apps/cli/src/infra/commands/createCommandHandler.ts
13206
+ function buildWebappUrl(host, orgSlug, commandId) {
13207
+ return `${host}/org/${orgSlug}/space/global/commands/${commandId}`;
13208
+ }
13209
+ async function createCommandHandler(filePath, useCase) {
13210
+ const readResult = await readCommandPlaybookFile(filePath);
13211
+ if (!readResult.isValid) {
13212
+ return {
13213
+ success: false,
13214
+ error: `Validation failed: ${readResult.errors?.join(", ")}`
13215
+ };
13216
+ }
13217
+ if (!readResult.data) {
13218
+ return {
13219
+ success: false,
13220
+ error: "Failed to read command playbook data"
13221
+ };
13222
+ }
13223
+ try {
13224
+ const result = await useCase.execute(readResult.data);
13225
+ let webappUrl;
13226
+ const apiKey = loadApiKey();
13227
+ if (apiKey) {
13228
+ const decoded = decodeApiKey2(apiKey);
13229
+ if (decoded?.host && decoded?.jwt?.organization?.slug) {
13230
+ webappUrl = buildWebappUrl(
13231
+ decoded.host,
13232
+ decoded.jwt.organization.slug,
13233
+ result.commandId
13234
+ );
13235
+ }
13236
+ }
13237
+ return {
13238
+ success: true,
13239
+ commandId: result.commandId,
13240
+ commandName: result.name,
13241
+ webappUrl
13242
+ };
13243
+ } catch (e) {
13244
+ return {
13245
+ success: false,
13246
+ error: `Error creating command: ${e instanceof Error ? e.message : "Unknown error"}`
13247
+ };
13248
+ }
13249
+ }
13250
+
13251
+ // apps/cli/src/application/useCases/CreateCommandFromPlaybookUseCase.ts
13252
+ var CreateCommandFromPlaybookUseCase = class {
13253
+ constructor(gateway) {
13254
+ this.gateway = gateway;
13255
+ }
13256
+ async execute(playbook) {
13257
+ const space = await this.gateway.getGlobalSpace();
13258
+ const command12 = await this.gateway.createCommand(space.id, {
13259
+ name: playbook.name,
13260
+ summary: playbook.summary,
13261
+ whenToUse: playbook.whenToUse,
13262
+ contextValidationCheckpoints: playbook.contextValidationCheckpoints,
13263
+ steps: playbook.steps.map((step) => ({
13264
+ name: step.name,
13265
+ description: step.description,
13266
+ codeSnippet: step.codeSnippet
13267
+ }))
13268
+ });
13269
+ return {
13270
+ commandId: command12.id,
13271
+ name: command12.name,
13272
+ slug: command12.slug
13273
+ };
13274
+ }
13275
+ };
13276
+
13277
+ // apps/cli/src/infra/commands/CreateCommandCommand.ts
13278
+ var createCommandCommand = (0, import_cmd_ts13.command)({
13279
+ name: "create",
13280
+ description: "Create a command from a playbook JSON file",
13281
+ args: {
13282
+ file: (0, import_cmd_ts13.positional)({
13283
+ displayName: "file",
13284
+ description: "Path to the command playbook JSON file",
13285
+ type: import_cmd_ts13.string
13286
+ })
13287
+ },
13288
+ handler: async ({ file }) => {
13289
+ try {
13290
+ const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
13291
+ const hexa = new PackmindCliHexa(packmindLogger);
13292
+ const gateway = hexa.getPackmindGateway();
13293
+ const useCase = new CreateCommandFromPlaybookUseCase(gateway);
13294
+ const result = await createCommandHandler(file, useCase);
13295
+ if (result.success) {
13296
+ logSuccessConsole(
13297
+ `Command "${result.commandName}" created successfully (ID: ${result.commandId})`
13298
+ );
13299
+ if (result.webappUrl) {
13300
+ logConsole("");
13301
+ logConsole(`View it in the webapp: ${result.webappUrl}`);
13302
+ }
13303
+ process.exit(0);
13304
+ } else {
13305
+ logErrorConsole(`Failed to create command: ${result.error}`);
13306
+ process.exit(1);
13307
+ }
13308
+ } catch (e) {
13309
+ logErrorConsole(
13310
+ `Error: ${e instanceof Error ? e.message : "Unknown error"}`
13311
+ );
13312
+ process.exit(1);
13313
+ }
13314
+ }
13315
+ });
13316
+
13317
+ // apps/cli/src/infra/commands/CommandsCommand.ts
13318
+ var commandsCommand = (0, import_cmd_ts14.subcommands)({
13319
+ name: "commands",
13320
+ description: "Manage commands",
13321
+ cmds: {
13322
+ create: createCommandCommand
12453
13323
  }
12454
13324
  });
12455
13325
 
@@ -12459,20 +13329,20 @@ function findEnvFile() {
12459
13329
  const currentDir = process.cwd();
12460
13330
  const gitService = new GitService();
12461
13331
  const gitRoot = gitService.getGitRepositoryRootSync(currentDir);
12462
- const filesystemRoot = path11.parse(currentDir).root;
13332
+ const filesystemRoot = path12.parse(currentDir).root;
12463
13333
  const stopDir = gitRoot ?? filesystemRoot;
12464
13334
  let searchDir = currentDir;
12465
- let parentDir = path11.dirname(searchDir);
13335
+ let parentDir = path12.dirname(searchDir);
12466
13336
  while (searchDir !== parentDir) {
12467
- const envPath2 = path11.join(searchDir, ".env");
12468
- if (fs12.existsSync(envPath2)) {
13337
+ const envPath2 = path12.join(searchDir, ".env");
13338
+ if (fs15.existsSync(envPath2)) {
12469
13339
  return envPath2;
12470
13340
  }
12471
13341
  if (searchDir === stopDir) {
12472
13342
  return null;
12473
13343
  }
12474
13344
  searchDir = parentDir;
12475
- parentDir = path11.dirname(searchDir);
13345
+ parentDir = path12.dirname(searchDir);
12476
13346
  }
12477
13347
  return null;
12478
13348
  }
@@ -12489,10 +13359,10 @@ if (hasEmbeddedWasmFiles()) {
12489
13359
  }
12490
13360
  var args = process.argv.slice(2);
12491
13361
  if (args.includes("--version") || args.includes("-v")) {
12492
- console.log(`packmind-cli version ${CLI_VERSION}`);
13362
+ logConsole(`packmind-cli version ${CLI_VERSION}`);
12493
13363
  process.exit(0);
12494
13364
  }
12495
- var app = (0, import_cmd_ts10.subcommands)({
13365
+ var app = (0, import_cmd_ts15.subcommands)({
12496
13366
  name: "packmind-cli",
12497
13367
  description: "Packmind CLI tool",
12498
13368
  cmds: {
@@ -12505,10 +13375,12 @@ var app = (0, import_cmd_ts10.subcommands)({
12505
13375
  logout: logoutCommand,
12506
13376
  whoami: whoamiCommand,
12507
13377
  "setup-mcp": setupMcpCommand,
12508
- skills: skillsCommand
13378
+ skills: skillsCommand,
13379
+ standards: standardsCommand,
13380
+ commands: commandsCommand
12509
13381
  }
12510
13382
  });
12511
- (0, import_cmd_ts10.run)(app, args).catch((error) => {
13383
+ (0, import_cmd_ts15.run)(app, args).catch((error) => {
12512
13384
  logErrorConsole(error.message);
12513
13385
  process.exit(1);
12514
13386
  });