@packmind/cli 0.26.1 → 0.28.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 +668 -1080
  2. package/package.json +2 -1
package/main.cjs CHANGED
@@ -843,7 +843,7 @@ var require_types = __commonJS({
843
843
  Object.defineProperty(exports2, "__esModule", { value: true });
844
844
  exports2.boolean = exports2.string = exports2.number = void 0;
845
845
  exports2.optional = optional17;
846
- exports2.array = array3;
846
+ exports2.array = array2;
847
847
  var type_1 = require_type();
848
848
  exports2.number = {
849
849
  async from(str) {
@@ -877,7 +877,7 @@ var require_types = __commonJS({
877
877
  }
878
878
  };
879
879
  }
880
- function array3(t) {
880
+ function array2(t) {
881
881
  return {
882
882
  ...t,
883
883
  async from(inputs) {
@@ -1526,9 +1526,9 @@ Did you mean ${chalk_1.default.italic(option22)}?`;
1526
1526
  }
1527
1527
  };
1528
1528
  }
1529
- function flatMap(array3, f) {
1529
+ function flatMap(array2, f) {
1530
1530
  const rs = [];
1531
- for (const item of array3) {
1531
+ for (const item of array2) {
1532
1532
  rs.push(...f(item));
1533
1533
  }
1534
1534
  return rs;
@@ -1701,12 +1701,12 @@ var require_command = __commonJS({
1701
1701
  return mod && mod.__esModule ? mod : { "default": mod };
1702
1702
  };
1703
1703
  Object.defineProperty(exports2, "__esModule", { value: true });
1704
- exports2.command = command33;
1704
+ exports2.command = command32;
1705
1705
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
1706
1706
  var Result = __importStar(require_Result());
1707
1707
  var circuitbreaker_1 = require_circuitbreaker();
1708
1708
  var utils_1 = require_utils();
1709
- function command33(config) {
1709
+ function command32(config) {
1710
1710
  const argEntries = (0, utils_1.entries)(config.args);
1711
1711
  const circuitbreaker = (0, circuitbreaker_1.createCircuitBreaker)(!!config.version);
1712
1712
  return {
@@ -2590,7 +2590,7 @@ var require_has_flag = __commonJS({
2590
2590
  var require_supports_color = __commonJS({
2591
2591
  "node_modules/supports-color/index.js"(exports2, module2) {
2592
2592
  "use strict";
2593
- var os6 = require("os");
2593
+ var os4 = require("os");
2594
2594
  var tty2 = require("tty");
2595
2595
  var hasFlag2 = require_has_flag();
2596
2596
  var { env: env2 } = process;
@@ -2638,7 +2638,7 @@ var require_supports_color = __commonJS({
2638
2638
  return min;
2639
2639
  }
2640
2640
  if (process.platform === "win32") {
2641
- const osRelease = os6.release().split(".");
2641
+ const osRelease = os4.release().split(".");
2642
2642
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2643
2643
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
2644
2644
  }
@@ -3430,11 +3430,11 @@ var require_multioption = __commonJS({
3430
3430
  return mod && mod.__esModule ? mod : { "default": mod };
3431
3431
  };
3432
3432
  Object.defineProperty(exports2, "__esModule", { value: true });
3433
- exports2.multioption = multioption3;
3433
+ exports2.multioption = multioption2;
3434
3434
  var chalk_1 = __importDefault((init_source(), __toCommonJS(source_exports)));
3435
3435
  var Result = __importStar(require_Result());
3436
3436
  var findOption_1 = require_findOption();
3437
- function multioption3(config) {
3437
+ function multioption2(config) {
3438
3438
  return {
3439
3439
  helpTopics() {
3440
3440
  var _a, _b;
@@ -3855,7 +3855,7 @@ var require_package = __commonJS({
3855
3855
  "apps/cli/package.json"(exports2, module2) {
3856
3856
  module2.exports = {
3857
3857
  name: "@packmind/cli",
3858
- version: "0.26.1",
3858
+ version: "0.28.0",
3859
3859
  description: "A command-line interface for Packmind linting and code quality checks",
3860
3860
  private: false,
3861
3861
  bin: {
@@ -3901,7 +3901,7 @@ var require_package = __commonJS({
3901
3901
  });
3902
3902
 
3903
3903
  // apps/cli/src/main.ts
3904
- var import_cmd_ts42 = __toESM(require_cjs());
3904
+ var import_cmd_ts41 = __toESM(require_cjs());
3905
3905
 
3906
3906
  // apps/cli/src/infra/commands/LinterCommand.ts
3907
3907
  var import_cmd_ts = __toESM(require_cjs());
@@ -4311,13 +4311,16 @@ function camelToKebab(str) {
4311
4311
  }
4312
4312
  var CLAUDE_CODE_ADDITIONAL_FIELDS = {
4313
4313
  "argument-hint": "argumentHint",
4314
+ when_to_use: "whenToUse",
4314
4315
  "disable-model-invocation": "disableModelInvocation",
4315
4316
  "user-invocable": "userInvocable",
4316
4317
  model: "model",
4317
4318
  context: "context",
4318
4319
  agent: "agent",
4319
4320
  effort: "effort",
4320
- hooks: "hooks"
4321
+ hooks: "hooks",
4322
+ paths: "paths",
4323
+ shell: "shell"
4321
4324
  };
4322
4325
  var CAMEL_TO_YAML_KEY = Object.fromEntries(
4323
4326
  Object.entries(CLAUDE_CODE_ADDITIONAL_FIELDS).map(([yaml4, camel]) => [
@@ -5320,8 +5323,8 @@ var ExecuteSingleFileAstUseCase = class _ExecuteSingleFileAstUseCase {
5320
5323
  static {
5321
5324
  this.fallbackRuleContent = "adhoc-rule";
5322
5325
  }
5323
- async execute(command33) {
5324
- const { program, fileContent, language } = command33;
5326
+ async execute(command32) {
5327
+ const { program, fileContent, language } = command32;
5325
5328
  const result = await this.linterExecutionUseCase.execute({
5326
5329
  filePath: "cli-single-file",
5327
5330
  fileContent,
@@ -5380,30 +5383,30 @@ var GitService = class {
5380
5383
  this.gitRunner = gitRunner;
5381
5384
  this.logger = logger2;
5382
5385
  }
5383
- getGitRepositoryRoot(path37) {
5386
+ getGitRepositoryRoot(path35) {
5384
5387
  try {
5385
5388
  const { stdout } = this.gitRunner("rev-parse --show-toplevel", {
5386
- cwd: path37
5389
+ cwd: path35
5387
5390
  });
5388
5391
  const gitRoot = stdout.trim();
5389
5392
  this.logger.debug("Resolved git repository root", {
5390
- inputPath: path37,
5393
+ inputPath: path35,
5391
5394
  gitRoot
5392
5395
  });
5393
5396
  return gitRoot;
5394
5397
  } catch (error) {
5395
5398
  if (error instanceof Error) {
5396
5399
  throw new Error(
5397
- `Failed to get Git repository root. The path '${path37}' does not appear to be inside a Git repository.
5400
+ `Failed to get Git repository root. The path '${path35}' does not appear to be inside a Git repository.
5398
5401
  ${error.message}`
5399
5402
  );
5400
5403
  }
5401
5404
  throw new Error("Failed to get Git repository root: Unknown error");
5402
5405
  }
5403
5406
  }
5404
- tryGetGitRepositoryRoot(path37) {
5407
+ tryGetGitRepositoryRoot(path35) {
5405
5408
  try {
5406
- return this.getGitRepositoryRoot(path37);
5409
+ return this.getGitRepositoryRoot(path35);
5407
5410
  } catch {
5408
5411
  return null;
5409
5412
  }
@@ -5705,8 +5708,8 @@ var GetGitRemoteUrlUseCase = class {
5705
5708
  constructor(gitRemoteUrlService = new GitService()) {
5706
5709
  this.gitRemoteUrlService = gitRemoteUrlService;
5707
5710
  }
5708
- async execute(command33) {
5709
- const { path: repoPath, origin: origin9 } = command33;
5711
+ async execute(command32) {
5712
+ const { path: repoPath, origin: origin9 } = command32;
5710
5713
  return this.gitRemoteUrlService.getGitRemoteUrl(repoPath, origin9);
5711
5714
  }
5712
5715
  };
@@ -5858,8 +5861,8 @@ var ListFilesInDirectoryUseCase = class {
5858
5861
  constructor(listFiles = new ListFiles()) {
5859
5862
  this.listFiles = listFiles;
5860
5863
  }
5861
- async execute(command33) {
5862
- const { path: directoryPath, extensions, excludes = [] } = command33;
5864
+ async execute(command32) {
5865
+ const { path: directoryPath, extensions, excludes = [] } = command32;
5863
5866
  const files = await this.listFiles.listFilesInDirectory(
5864
5867
  directoryPath,
5865
5868
  extensions,
@@ -5974,7 +5977,7 @@ var LintFilesAgainstRuleUseCase = class {
5974
5977
  };
5975
5978
  };
5976
5979
  }
5977
- async execute(command33) {
5980
+ async execute(command32) {
5978
5981
  const {
5979
5982
  path: userPath,
5980
5983
  draftMode,
@@ -5983,7 +5986,7 @@ var LintFilesAgainstRuleUseCase = class {
5983
5986
  language,
5984
5987
  diffMode,
5985
5988
  ignorePatterns
5986
- } = command33;
5989
+ } = command32;
5987
5990
  this.logger.debug(
5988
5991
  `Starting linting: path="${userPath}", draftMode=${!!draftMode}, standardSlug="${standardSlug || "N/A"}", ruleId="${ruleId || "N/A"}", language="${language || "N/A"}", diffMode="${diffMode ?? "none"}"`
5989
5992
  );
@@ -6299,8 +6302,8 @@ var LintFilesAgainstRuleUseCase = class {
6299
6302
  return null;
6300
6303
  }
6301
6304
  }
6302
- async executeProgramsForFile(command33) {
6303
- const result = await this.services.linterExecutionUseCase.execute(command33);
6305
+ async executeProgramsForFile(command32) {
6306
+ const result = await this.services.linterExecutionUseCase.execute(command32);
6304
6307
  return result.violations;
6305
6308
  }
6306
6309
  extractExtensionFromFile(filePath) {
@@ -6323,8 +6326,8 @@ var LintFilesFromConfigUseCase = class {
6323
6326
  this.logger = logger2;
6324
6327
  this.detectionProgramsCache = /* @__PURE__ */ new Map();
6325
6328
  }
6326
- async execute(command33) {
6327
- const { path: userPath, diffMode, ignorePatterns } = command33;
6329
+ async execute(command32) {
6330
+ const { path: userPath, diffMode, ignorePatterns } = command32;
6328
6331
  this.logger.debug(
6329
6332
  `Starting local linting: path="${userPath}", diffMode="${diffMode ?? "none"}"`
6330
6333
  );
@@ -6584,8 +6587,8 @@ var LintFilesFromConfigUseCase = class {
6584
6587
  return null;
6585
6588
  }
6586
6589
  }
6587
- async executeProgramsForFile(command33) {
6588
- const result = await this.services.linterExecutionUseCase.execute(command33);
6590
+ async executeProgramsForFile(command32) {
6591
+ const result = await this.services.linterExecutionUseCase.execute(command32);
6589
6592
  return result.violations;
6590
6593
  }
6591
6594
  extractExtensionFromFile(filePath) {
@@ -6625,6 +6628,40 @@ function isCommunityEditionError(tbd) {
6625
6628
  }
6626
6629
 
6627
6630
  // apps/cli/src/infra/http/PackmindHttpClient.ts
6631
+ var import_undici = require("undici");
6632
+ var tls = __toESM(require("tls"));
6633
+ var fs4 = __toESM(require("fs"));
6634
+ function buildDispatcher() {
6635
+ const cas = [...tls.rootCertificates];
6636
+ const programFiles = process.env["ProgramFiles"] ?? "C:\\Program Files";
6637
+ const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
6638
+ const systemCertFiles = [
6639
+ "/etc/ssl/certs/ca-certificates.crt",
6640
+ // Debian/Ubuntu
6641
+ "/etc/ssl/cert.pem",
6642
+ // macOS / Alpine
6643
+ "/etc/ssl/certs/ca-bundle.crt",
6644
+ // RHEL / CentOS
6645
+ // Git for Windows bundles (most common CA source on Windows)
6646
+ `${programFiles}\\Git\\usr\\ssl\\certs\\ca-bundle.crt`,
6647
+ `${programFiles}\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt`,
6648
+ `${programFilesX86}\\Git\\usr\\ssl\\certs\\ca-bundle.crt`,
6649
+ `${programFilesX86}\\Git\\mingw64\\ssl\\certs\\ca-bundle.crt`,
6650
+ `D:\\ca-certificates.crt`,
6651
+ `/private/etc/ssl/certs/ca-certificates.crt`,
6652
+ // Mac OS
6653
+ process.env.NODE_EXTRA_CA_CERTS
6654
+ // user-defined extra CAs
6655
+ ].filter(Boolean);
6656
+ for (const certFile of systemCertFiles) {
6657
+ try {
6658
+ cas.push(fs4.readFileSync(certFile));
6659
+ } catch {
6660
+ }
6661
+ }
6662
+ return new import_undici.Agent({ connect: { ca: cas } });
6663
+ }
6664
+ var dispatcher = buildDispatcher();
6628
6665
  var PackmindHttpClient = class {
6629
6666
  constructor(apiKey) {
6630
6667
  this.apiKey = apiKey;
@@ -6668,10 +6705,10 @@ var PackmindHttpClient = class {
6668
6705
  return null;
6669
6706
  }
6670
6707
  }
6671
- async request(path37, options = {}) {
6708
+ async request(path35, options = {}) {
6672
6709
  const { host } = this.getAuthContext();
6673
6710
  const { method = "GET", body } = options;
6674
- const url = `${host}${path37}`;
6711
+ const url = `${host}${path35}`;
6675
6712
  try {
6676
6713
  const response = await fetch(url, {
6677
6714
  method,
@@ -6680,7 +6717,9 @@ var PackmindHttpClient = class {
6680
6717
  Authorization: `Bearer ${this.apiKey}`,
6681
6718
  "User-Agent": `packmind-cli:${import_package.version}`
6682
6719
  },
6683
- ...body ? { body: JSON.stringify(body) } : {}
6720
+ ...body ? { body: JSON.stringify(body) } : {},
6721
+ // @ts-expect-error — Node.js fetch (undici) accepts a dispatcher option not present in the DOM types
6722
+ dispatcher
6684
6723
  });
6685
6724
  if (!response.ok) {
6686
6725
  if (options.onError) {
@@ -6722,13 +6761,13 @@ var PackmindHttpClient = class {
6722
6761
  var ChangeProposalGateway = class {
6723
6762
  constructor(httpClient) {
6724
6763
  this.httpClient = httpClient;
6725
- this.batchCreate = async (command33) => {
6764
+ this.batchCreate = async (command32) => {
6726
6765
  const { organizationId } = this.httpClient.getAuthContext();
6727
6766
  return this.httpClient.request(
6728
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/change-proposals/batch`,
6767
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/batch`,
6729
6768
  {
6730
6769
  method: "POST",
6731
- body: { proposals: command33.proposals },
6770
+ body: { proposals: command32.proposals },
6732
6771
  onError: (response) => {
6733
6772
  if (response.status === 404) {
6734
6773
  throw new CommunityEditionError("change proposals");
@@ -6737,29 +6776,29 @@ var ChangeProposalGateway = class {
6737
6776
  }
6738
6777
  );
6739
6778
  };
6740
- this.batchApply = async (command33) => {
6779
+ this.batchApply = async (command32) => {
6741
6780
  const { organizationId } = this.httpClient.getAuthContext();
6742
6781
  return this.httpClient.request(
6743
6782
  `/api/v0/organizations/${organizationId}/playbook/apply`,
6744
6783
  {
6745
6784
  method: "POST",
6746
6785
  body: {
6747
- proposals: command33.proposals,
6748
- message: command33.message,
6749
- ...command33.directUpdate !== void 0 && {
6750
- directUpdate: command33.directUpdate
6786
+ proposals: command32.proposals,
6787
+ message: command32.message,
6788
+ ...command32.directUpdate !== void 0 && {
6789
+ directUpdate: command32.directUpdate
6751
6790
  }
6752
6791
  }
6753
6792
  }
6754
6793
  );
6755
6794
  };
6756
- this.check = async (command33) => {
6795
+ this.check = async (command32) => {
6757
6796
  const { organizationId } = this.httpClient.getAuthContext();
6758
6797
  return this.httpClient.request(
6759
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/change-proposals/check`,
6798
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/change-proposals/check`,
6760
6799
  {
6761
6800
  method: "POST",
6762
- body: { proposals: command33.proposals },
6801
+ body: { proposals: command32.proposals },
6763
6802
  onError: (response) => {
6764
6803
  if (response.status === 404) {
6765
6804
  throw new CommunityEditionError("change proposals");
@@ -6775,13 +6814,13 @@ var ChangeProposalGateway = class {
6775
6814
  var LinterGateway = class {
6776
6815
  constructor(httpClient) {
6777
6816
  this.httpClient = httpClient;
6778
- this.getDraftDetectionProgramsForRule = async (command33) => {
6817
+ this.getDraftDetectionProgramsForRule = async (command32) => {
6779
6818
  const payload = {
6780
- standardSlug: command33.standardSlug,
6781
- ruleId: command33.ruleId
6819
+ standardSlug: command32.standardSlug,
6820
+ ruleId: command32.ruleId
6782
6821
  };
6783
- if (command33.language) {
6784
- payload.language = command33.language;
6822
+ if (command32.language) {
6823
+ payload.language = command32.language;
6785
6824
  }
6786
6825
  return this.httpClient.request("/api/v0/list-draft-detection-program", {
6787
6826
  method: "POST",
@@ -6793,13 +6832,13 @@ var LinterGateway = class {
6793
6832
  }
6794
6833
  });
6795
6834
  };
6796
- this.getActiveDetectionProgramsForRule = async (command33) => {
6835
+ this.getActiveDetectionProgramsForRule = async (command32) => {
6797
6836
  const payload = {
6798
- standardSlug: command33.standardSlug,
6799
- ruleId: command33.ruleId
6837
+ standardSlug: command32.standardSlug,
6838
+ ruleId: command32.ruleId
6800
6839
  };
6801
- if (command33.language) {
6802
- payload.language = command33.language;
6840
+ if (command32.language) {
6841
+ payload.language = command32.language;
6803
6842
  }
6804
6843
  return this.httpClient.request("/api/v0/list-active-detection-program", {
6805
6844
  method: "POST",
@@ -6811,13 +6850,13 @@ var LinterGateway = class {
6811
6850
  }
6812
6851
  });
6813
6852
  };
6814
- this.getDetectionProgramsForPackages = async (command33) => {
6853
+ this.getDetectionProgramsForPackages = async (command32) => {
6815
6854
  const response = await this.httpClient.request(
6816
6855
  "/api/v0/detection-programs-for-packages",
6817
6856
  {
6818
6857
  method: "POST",
6819
6858
  body: {
6820
- packagesSlugs: command33.packagesSlugs
6859
+ packagesSlugs: command32.packagesSlugs
6821
6860
  },
6822
6861
  onError: (response2) => {
6823
6862
  if (response2.status === 404) {
@@ -6828,10 +6867,10 @@ var LinterGateway = class {
6828
6867
  );
6829
6868
  return handleScopeInTargetsResponse(response);
6830
6869
  };
6831
- this.trackLinterExecution = async (command33) => {
6870
+ this.trackLinterExecution = async (command32) => {
6832
6871
  return this.httpClient.request(`/api/v0/track-execution`, {
6833
6872
  method: "POST",
6834
- body: command33
6873
+ body: command32
6835
6874
  });
6836
6875
  };
6837
6876
  }
@@ -6853,25 +6892,6 @@ function handleScopeInTargetsResponse(response) {
6853
6892
  };
6854
6893
  }
6855
6894
 
6856
- // apps/cli/src/infra/repositories/McpGateway.ts
6857
- var McpGateway = class {
6858
- constructor(httpClient) {
6859
- this.httpClient = httpClient;
6860
- this.getToken = async () => {
6861
- const { organizationId } = this.httpClient.getAuthContext();
6862
- return this.httpClient.request(
6863
- `/api/v0/organizations/${organizationId}/mcp/token`
6864
- );
6865
- };
6866
- this.getUrl = async () => {
6867
- const { organizationId } = this.httpClient.getAuthContext();
6868
- return this.httpClient.request(
6869
- `/api/v0/organizations/${organizationId}/mcp/url`
6870
- );
6871
- };
6872
- }
6873
- };
6874
-
6875
6895
  // apps/cli/src/infra/repositories/SpacesGateway.ts
6876
6896
  var SpacesGateway = class {
6877
6897
  constructor(httpClient) {
@@ -6904,27 +6924,27 @@ var SpacesGateway = class {
6904
6924
  var SkillsGateway = class {
6905
6925
  constructor(httpClient) {
6906
6926
  this.httpClient = httpClient;
6907
- this.upload = async (command33) => {
6927
+ this.upload = async (command32) => {
6908
6928
  const { organizationId } = this.httpClient.getAuthContext();
6909
6929
  return this.httpClient.request(
6910
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/skills/upload`,
6930
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills/upload`,
6911
6931
  {
6912
6932
  method: "POST",
6913
- body: command33
6933
+ body: command32
6914
6934
  }
6915
6935
  );
6916
6936
  };
6917
- this.getDefaults = async (command33) => {
6937
+ this.getDefaults = async (command32) => {
6918
6938
  const { organizationId } = this.httpClient.getAuthContext();
6919
6939
  const queryParams = new URLSearchParams();
6920
- if (command33.includeBeta) {
6940
+ if (command32.includeBeta) {
6921
6941
  queryParams.set("includeBeta", "true");
6922
- } else if (command33.cliVersion) {
6923
- queryParams.set("cliVersion", command33.cliVersion);
6942
+ } else if (command32.cliVersion) {
6943
+ queryParams.set("cliVersion", command32.cliVersion);
6924
6944
  }
6925
- if (command33.agents !== void 0) {
6945
+ if (command32.agents !== void 0) {
6926
6946
  queryParams.append("agentsConfigOverride", "true");
6927
- command33.agents.forEach((agent) => {
6947
+ command32.agents.forEach((agent) => {
6928
6948
  queryParams.append("agent", agent);
6929
6949
  });
6930
6950
  }
@@ -6933,10 +6953,10 @@ var SkillsGateway = class {
6933
6953
  `/api/v0/organizations/${organizationId}/skills/default${queryString ? `?${queryString}` : ""}`
6934
6954
  );
6935
6955
  };
6936
- this.list = async (command33) => {
6956
+ this.list = async (command32) => {
6937
6957
  const { organizationId } = this.httpClient.getAuthContext();
6938
6958
  return this.httpClient.request(
6939
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/skills`
6959
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/skills`
6940
6960
  );
6941
6961
  };
6942
6962
  }
@@ -6946,17 +6966,17 @@ var SkillsGateway = class {
6946
6966
  var CommandsGateway = class {
6947
6967
  constructor(httpClient) {
6948
6968
  this.httpClient = httpClient;
6949
- this.create = async (command33) => {
6969
+ this.create = async (command32) => {
6950
6970
  const { organizationId } = this.httpClient.getAuthContext();
6951
6971
  return this.httpClient.request(
6952
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/recipes`,
6953
- { method: "POST", body: command33 }
6972
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`,
6973
+ { method: "POST", body: command32 }
6954
6974
  );
6955
6975
  };
6956
- this.list = async (command33) => {
6976
+ this.list = async (command32) => {
6957
6977
  const { organizationId } = this.httpClient.getAuthContext();
6958
6978
  const listRecipesResponse = await this.httpClient.request(
6959
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/recipes`
6979
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/recipes`
6960
6980
  );
6961
6981
  if (listRecipesResponse instanceof Array) {
6962
6982
  return { recipes: listRecipesResponse };
@@ -6997,10 +7017,10 @@ var StandardsGateway = class {
6997
7017
  }
6998
7018
  );
6999
7019
  };
7000
- this.list = async (command33) => {
7020
+ this.list = async (command32) => {
7001
7021
  const { organizationId } = this.httpClient.getAuthContext();
7002
7022
  return this.httpClient.request(
7003
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/standards`
7023
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/standards`
7004
7024
  );
7005
7025
  };
7006
7026
  }
@@ -7011,10 +7031,10 @@ var PackagesGateway = class {
7011
7031
  constructor(apiKey, httpClient) {
7012
7032
  this.apiKey = apiKey;
7013
7033
  this.httpClient = httpClient;
7014
- this.list = async (command33) => {
7034
+ this.list = async (command32) => {
7015
7035
  const { organizationId } = this.httpClient.getAuthContext();
7016
7036
  return this.httpClient.request(
7017
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/packages`
7037
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`
7018
7038
  );
7019
7039
  };
7020
7040
  this.getSummary = async ({
@@ -7026,24 +7046,24 @@ var PackagesGateway = class {
7026
7046
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/summary/${encodeURIComponent(slug3)}`
7027
7047
  );
7028
7048
  };
7029
- this.create = async (command33) => {
7049
+ this.create = async (command32) => {
7030
7050
  const { organizationId } = this.httpClient.getAuthContext();
7031
7051
  return this.httpClient.request(
7032
- `/api/v0/organizations/${organizationId}/spaces/${command33.spaceId}/packages`,
7052
+ `/api/v0/organizations/${organizationId}/spaces/${command32.spaceId}/packages`,
7033
7053
  {
7034
7054
  method: "POST",
7035
- body: command33
7055
+ body: command32
7036
7056
  }
7037
7057
  );
7038
7058
  };
7039
- this.addArtefacts = async (command33) => {
7059
+ this.addArtefacts = async (command32) => {
7040
7060
  const { organizationId } = this.httpClient.getAuthContext();
7041
- const { packageId, spaceId } = command33;
7061
+ const { packageId, spaceId } = command32;
7042
7062
  return this.httpClient.request(
7043
7063
  `/api/v0/organizations/${organizationId}/spaces/${spaceId}/packages/${packageId}/add-artifacts`,
7044
7064
  {
7045
7065
  method: "POST",
7046
- body: command33
7066
+ body: command32
7047
7067
  }
7048
7068
  );
7049
7069
  };
@@ -7054,31 +7074,31 @@ var PackagesGateway = class {
7054
7074
  var DeploymentGateway = class {
7055
7075
  constructor(httpClient) {
7056
7076
  this.httpClient = httpClient;
7057
- this.pull = async (command33) => {
7077
+ this.pull = async (command32) => {
7058
7078
  const { organizationId } = this.httpClient.getAuthContext();
7059
7079
  const queryParams = new URLSearchParams();
7060
- if (command33.packagesSlugs && command33.packagesSlugs.length > 0) {
7061
- command33.packagesSlugs.forEach((slug3) => {
7080
+ if (command32.packagesSlugs && command32.packagesSlugs.length > 0) {
7081
+ command32.packagesSlugs.forEach((slug3) => {
7062
7082
  queryParams.append("packageSlug", slug3);
7063
7083
  });
7064
7084
  }
7065
- if (command33.previousPackagesSlugs && command33.previousPackagesSlugs.length > 0) {
7066
- command33.previousPackagesSlugs.forEach((slug3) => {
7085
+ if (command32.previousPackagesSlugs && command32.previousPackagesSlugs.length > 0) {
7086
+ command32.previousPackagesSlugs.forEach((slug3) => {
7067
7087
  queryParams.append("previousPackageSlug", slug3);
7068
7088
  });
7069
7089
  }
7070
- if (command33.gitRemoteUrl) {
7071
- queryParams.append("gitRemoteUrl", command33.gitRemoteUrl);
7090
+ if (command32.gitRemoteUrl) {
7091
+ queryParams.append("gitRemoteUrl", command32.gitRemoteUrl);
7072
7092
  }
7073
- if (command33.gitBranch) {
7074
- queryParams.append("gitBranch", command33.gitBranch);
7093
+ if (command32.gitBranch) {
7094
+ queryParams.append("gitBranch", command32.gitBranch);
7075
7095
  }
7076
- if (command33.relativePath) {
7077
- queryParams.append("relativePath", command33.relativePath);
7096
+ if (command32.relativePath) {
7097
+ queryParams.append("relativePath", command32.relativePath);
7078
7098
  }
7079
- if (command33.agents !== void 0) {
7099
+ if (command32.agents !== void 0) {
7080
7100
  queryParams.append("agentsConfigOverride", "true");
7081
- command33.agents.forEach((agent) => {
7101
+ command32.agents.forEach((agent) => {
7082
7102
  queryParams.append("agent", agent);
7083
7103
  });
7084
7104
  }
@@ -7086,71 +7106,71 @@ var DeploymentGateway = class {
7086
7106
  `/api/v0/organizations/${organizationId}/pull?${queryParams.toString()}`
7087
7107
  );
7088
7108
  };
7089
- this.install = async (command33) => {
7109
+ this.install = async (command32) => {
7090
7110
  const { organizationId } = this.httpClient.getAuthContext();
7091
7111
  return this.httpClient.request(
7092
7112
  `/api/v0/organizations/${organizationId}/install`,
7093
7113
  {
7094
7114
  method: "POST",
7095
7115
  body: {
7096
- packagesSlugs: command33.packagesSlugs,
7097
- packmindLockFile: command33.packmindLockFile,
7098
- ...command33.relativePath && { relativePath: command33.relativePath },
7099
- ...command33.agents !== void 0 && { agents: command33.agents }
7116
+ packagesSlugs: command32.packagesSlugs,
7117
+ packmindLockFile: command32.packmindLockFile,
7118
+ ...command32.relativePath && { relativePath: command32.relativePath },
7119
+ ...command32.agents !== void 0 && { agents: command32.agents }
7100
7120
  }
7101
7121
  }
7102
7122
  );
7103
7123
  };
7104
- this.getDeployed = async (command33) => {
7124
+ this.getDeployed = async (command32) => {
7105
7125
  const { organizationId } = this.httpClient.getAuthContext();
7106
7126
  return this.httpClient.request(
7107
7127
  `/api/v0/organizations/${organizationId}/deployed-content`,
7108
7128
  {
7109
7129
  method: "POST",
7110
7130
  body: {
7111
- packagesSlugs: command33.packagesSlugs,
7112
- gitRemoteUrl: command33.gitRemoteUrl,
7113
- gitBranch: command33.gitBranch,
7114
- relativePath: command33.relativePath,
7115
- ...command33.agents !== void 0 && { agents: command33.agents }
7131
+ packagesSlugs: command32.packagesSlugs,
7132
+ gitRemoteUrl: command32.gitRemoteUrl,
7133
+ gitBranch: command32.gitBranch,
7134
+ relativePath: command32.relativePath,
7135
+ ...command32.agents !== void 0 && { agents: command32.agents }
7116
7136
  }
7117
7137
  }
7118
7138
  );
7119
7139
  };
7120
- this.getContentByVersions = async (command33) => {
7140
+ this.getContentByVersions = async (command32) => {
7121
7141
  const { organizationId } = this.httpClient.getAuthContext();
7122
7142
  return this.httpClient.request(
7123
7143
  `/api/v0/organizations/${organizationId}/content-by-versions`,
7124
7144
  {
7125
7145
  method: "POST",
7126
7146
  body: {
7127
- artifacts: command33.artifacts,
7128
- ...command33.agents !== void 0 && { agents: command33.agents }
7147
+ artifacts: command32.artifacts,
7148
+ ...command32.agents !== void 0 && { agents: command32.agents }
7129
7149
  }
7130
7150
  }
7131
7151
  );
7132
7152
  };
7133
- this.notifyDistribution = async (command33) => {
7153
+ this.notifyDistribution = async (command32) => {
7134
7154
  const { organizationId } = this.httpClient.getAuthContext();
7135
7155
  return this.httpClient.request(
7136
7156
  `/api/v0/organizations/${organizationId}/deployments`,
7137
7157
  {
7138
7158
  method: "POST",
7139
- body: command33
7159
+ body: command32
7140
7160
  }
7141
7161
  );
7142
7162
  };
7143
- this.notifyArtefactsDistribution = async (command33) => {
7163
+ this.notifyArtefactsDistribution = async (command32) => {
7144
7164
  const { organizationId } = this.httpClient.getAuthContext();
7145
7165
  return this.httpClient.request(
7146
7166
  `/api/v0/organizations/${organizationId}/deployments/notify-artifacts-distribution`,
7147
7167
  {
7148
7168
  method: "POST",
7149
7169
  body: {
7150
- gitRemoteUrl: command33.gitRemoteUrl,
7151
- gitBranch: command33.gitBranch,
7152
- relativePath: command33.relativePath,
7153
- packmindLockFile: command33.packmindLockFile
7170
+ gitRemoteUrl: command32.gitRemoteUrl,
7171
+ gitBranch: command32.gitBranch,
7172
+ relativePath: command32.relativePath,
7173
+ packmindLockFile: command32.packmindLockFile
7154
7174
  }
7155
7175
  }
7156
7176
  );
@@ -7201,7 +7221,6 @@ var PackmindGateway = class {
7201
7221
  this.httpClient = new PackmindHttpClient(apiKey);
7202
7222
  this.changeProposals = new ChangeProposalGateway(this.httpClient);
7203
7223
  this.linter = new LinterGateway(this.httpClient);
7204
- this.mcp = new McpGateway(this.httpClient);
7205
7224
  this.spaces = new SpacesGateway(this.httpClient);
7206
7225
  this.skills = new SkillsGateway(this.httpClient);
7207
7226
  this.commands = new CommandsGateway(this.httpClient);
@@ -8952,8 +8971,8 @@ var ExecuteLinterProgramsUseCase = class {
8952
8971
  this.linterAstAdapter = linterAstAdapter;
8953
8972
  this.logger = logger2;
8954
8973
  }
8955
- async execute(command33) {
8956
- const { filePath, fileContent, language, programs } = command33;
8974
+ async execute(command32) {
8975
+ const { filePath, fileContent, language, programs } = command32;
8957
8976
  if (programs.length === 0) {
8958
8977
  return {
8959
8978
  file: filePath,
@@ -9701,7 +9720,7 @@ function parseSkillMd(content) {
9701
9720
  }
9702
9721
 
9703
9722
  // apps/cli/src/application/useCases/InstallPackagesUseCase.ts
9704
- var fs4 = __toESM(require("fs/promises"));
9723
+ var fs5 = __toESM(require("fs/promises"));
9705
9724
  var path6 = __toESM(require("path"));
9706
9725
 
9707
9726
  // apps/cli/src/infra/utils/permissions.ts
@@ -9739,8 +9758,8 @@ var InstallPackagesUseCase = class {
9739
9758
  constructor(packmindGateway) {
9740
9759
  this.packmindGateway = packmindGateway;
9741
9760
  }
9742
- async execute(command33) {
9743
- const baseDirectory = command33.baseDirectory || process.cwd();
9761
+ async execute(command32) {
9762
+ const baseDirectory = command32.baseDirectory || process.cwd();
9744
9763
  const result = {
9745
9764
  filesCreated: 0,
9746
9765
  filesUpdated: 0,
@@ -9752,12 +9771,12 @@ var InstallPackagesUseCase = class {
9752
9771
  skillDirectoriesDeleted: 0
9753
9772
  };
9754
9773
  const response = await this.packmindGateway.deployment.pull({
9755
- packagesSlugs: command33.packagesSlugs,
9756
- previousPackagesSlugs: command33.previousPackagesSlugs,
9757
- gitRemoteUrl: command33.gitRemoteUrl,
9758
- gitBranch: command33.gitBranch,
9759
- relativePath: command33.relativePath,
9760
- agents: command33.agents
9774
+ packagesSlugs: command32.packagesSlugs,
9775
+ previousPackagesSlugs: command32.previousPackagesSlugs,
9776
+ gitRemoteUrl: command32.gitRemoteUrl,
9777
+ gitBranch: command32.gitBranch,
9778
+ relativePath: command32.relativePath,
9779
+ agents: command32.agents
9761
9780
  });
9762
9781
  const filteredCreateOrUpdate = response.fileUpdates.createOrUpdate.filter(
9763
9782
  (file) => file.path !== "packmind.json"
@@ -9813,7 +9832,7 @@ var InstallPackagesUseCase = class {
9813
9832
  async createOrUpdateFile(baseDirectory, file, result, skillFilePermissions) {
9814
9833
  const fullPath = path6.join(baseDirectory, file.path);
9815
9834
  const directory = path6.dirname(fullPath);
9816
- await fs4.mkdir(directory, { recursive: true });
9835
+ await fs5.mkdir(directory, { recursive: true });
9817
9836
  const fileExists = await this.fileExists(fullPath);
9818
9837
  if (file.content !== void 0) {
9819
9838
  await this.handleFullContentUpdate(
@@ -9833,13 +9852,13 @@ var InstallPackagesUseCase = class {
9833
9852
  );
9834
9853
  }
9835
9854
  if (skillFilePermissions && supportsUnixPermissions()) {
9836
- await fs4.chmod(fullPath, parsePermissionString(skillFilePermissions));
9855
+ await fs5.chmod(fullPath, parsePermissionString(skillFilePermissions));
9837
9856
  }
9838
9857
  }
9839
9858
  async handleFullContentUpdate(fullPath, content, fileExists, result, isBase64) {
9840
9859
  if (isBase64) {
9841
9860
  const buffer = Buffer.from(content, "base64");
9842
- await fs4.writeFile(fullPath, buffer);
9861
+ await fs5.writeFile(fullPath, buffer);
9843
9862
  if (fileExists) {
9844
9863
  result.filesUpdated++;
9845
9864
  } else {
@@ -9848,7 +9867,7 @@ var InstallPackagesUseCase = class {
9848
9867
  return;
9849
9868
  }
9850
9869
  if (fileExists) {
9851
- const existingContent = await fs4.readFile(fullPath, "utf-8");
9870
+ const existingContent = await fs5.readFile(fullPath, "utf-8");
9852
9871
  const commentMarker = this.extractCommentMarker(content);
9853
9872
  let finalContent;
9854
9873
  if (!commentMarker) {
@@ -9861,18 +9880,18 @@ var InstallPackagesUseCase = class {
9861
9880
  );
9862
9881
  }
9863
9882
  if (existingContent !== finalContent) {
9864
- await fs4.writeFile(fullPath, finalContent, "utf-8");
9883
+ await fs5.writeFile(fullPath, finalContent, "utf-8");
9865
9884
  result.filesUpdated++;
9866
9885
  }
9867
9886
  } else {
9868
- await fs4.writeFile(fullPath, content, "utf-8");
9887
+ await fs5.writeFile(fullPath, content, "utf-8");
9869
9888
  result.filesCreated++;
9870
9889
  }
9871
9890
  }
9872
9891
  async handleSectionsUpdate(fullPath, sections, fileExists, result, baseDirectory) {
9873
9892
  let currentContent = "";
9874
9893
  if (fileExists) {
9875
- currentContent = await fs4.readFile(fullPath, "utf-8");
9894
+ currentContent = await fs5.readFile(fullPath, "utf-8");
9876
9895
  }
9877
9896
  const mergedContent = mergeSectionsIntoFileContent(
9878
9897
  currentContent,
@@ -9880,11 +9899,11 @@ var InstallPackagesUseCase = class {
9880
9899
  );
9881
9900
  if (currentContent !== mergedContent) {
9882
9901
  if (this.isEffectivelyEmpty(mergedContent) && fileExists) {
9883
- await fs4.unlink(fullPath);
9902
+ await fs5.unlink(fullPath);
9884
9903
  result.filesDeleted++;
9885
9904
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
9886
9905
  } else {
9887
- await fs4.writeFile(fullPath, mergedContent, "utf-8");
9906
+ await fs5.writeFile(fullPath, mergedContent, "utf-8");
9888
9907
  if (fileExists) {
9889
9908
  result.filesUpdated++;
9890
9909
  } else {
@@ -9895,20 +9914,20 @@ var InstallPackagesUseCase = class {
9895
9914
  }
9896
9915
  async deleteFile(baseDirectory, filePath, result) {
9897
9916
  const fullPath = path6.join(baseDirectory, filePath);
9898
- const stat9 = await fs4.stat(fullPath).catch(() => null);
9917
+ const stat9 = await fs5.stat(fullPath).catch(() => null);
9899
9918
  if (stat9?.isDirectory()) {
9900
- await fs4.rm(fullPath, { recursive: true, force: true });
9919
+ await fs5.rm(fullPath, { recursive: true, force: true });
9901
9920
  result.filesDeleted++;
9902
9921
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
9903
9922
  } else if (stat9?.isFile()) {
9904
- await fs4.unlink(fullPath);
9923
+ await fs5.unlink(fullPath);
9905
9924
  result.filesDeleted++;
9906
9925
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
9907
9926
  }
9908
9927
  }
9909
9928
  async fileExists(filePath) {
9910
9929
  try {
9911
- await fs4.access(filePath);
9930
+ await fs5.access(filePath);
9912
9931
  return true;
9913
9932
  } catch {
9914
9933
  return false;
@@ -9979,9 +9998,9 @@ ${endMarker}`;
9979
9998
  for (const folder of folders) {
9980
9999
  const fullPath = path6.join(baseDirectory, folder);
9981
10000
  try {
9982
- await fs4.access(fullPath);
10001
+ await fs5.access(fullPath);
9983
10002
  const fileCount = await this.countFilesInDirectory(fullPath);
9984
- await fs4.rm(fullPath, { recursive: true, force: true });
10003
+ await fs5.rm(fullPath, { recursive: true, force: true });
9985
10004
  deletedFilesCount += fileCount;
9986
10005
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
9987
10006
  } catch {
@@ -9994,7 +10013,7 @@ ${endMarker}`;
9994
10013
  */
9995
10014
  async countFilesInDirectory(dirPath) {
9996
10015
  let count = 0;
9997
- const entries = await fs4.readdir(dirPath, { withFileTypes: true });
10016
+ const entries = await fs5.readdir(dirPath, { withFileTypes: true });
9998
10017
  for (const entry of entries) {
9999
10018
  const entryPath = path6.join(dirPath, entry.name);
10000
10019
  if (entry.isDirectory()) {
@@ -10010,7 +10029,7 @@ ${endMarker}`;
10010
10029
  */
10011
10030
  async isDirectoryEmpty(dirPath) {
10012
10031
  try {
10013
- const entries = await fs4.readdir(dirPath);
10032
+ const entries = await fs5.readdir(dirPath);
10014
10033
  return entries.length === 0;
10015
10034
  } catch {
10016
10035
  return false;
@@ -10027,7 +10046,7 @@ ${endMarker}`;
10027
10046
  const isEmpty = await this.isDirectoryEmpty(currentDir);
10028
10047
  if (!isEmpty) break;
10029
10048
  try {
10030
- await fs4.rmdir(currentDir);
10049
+ await fs5.rmdir(currentDir);
10031
10050
  } catch {
10032
10051
  break;
10033
10052
  }
@@ -10037,7 +10056,7 @@ ${endMarker}`;
10037
10056
  };
10038
10057
 
10039
10058
  // apps/cli/src/application/useCases/InstallUseCase.ts
10040
- var fs5 = __toESM(require("fs/promises"));
10059
+ var fs6 = __toESM(require("fs/promises"));
10041
10060
  var path7 = __toESM(require("path"));
10042
10061
 
10043
10062
  // apps/cli/src/application/utils/normalizePackageSlugs.ts
@@ -10064,8 +10083,8 @@ var InstallUseCase = class {
10064
10083
  this.configFileRepository = configFileRepository;
10065
10084
  this.spaceService = spaceService;
10066
10085
  }
10067
- async execute(command33) {
10068
- const baseDirectory = command33.baseDirectory || process.cwd();
10086
+ async execute(command32) {
10087
+ const baseDirectory = command32.baseDirectory || process.cwd();
10069
10088
  const result = {
10070
10089
  filesCreated: 0,
10071
10090
  filesUpdated: 0,
@@ -10083,7 +10102,7 @@ var InstallUseCase = class {
10083
10102
  skillDirectoriesDeleted: 0,
10084
10103
  missingAccess: []
10085
10104
  };
10086
- const hasExplicitPackages = command33.packages && command33.packages.length > 0;
10105
+ const hasExplicitPackages = command32.packages && command32.packages.length > 0;
10087
10106
  const lockFile = await this.lockFileRepository.read(baseDirectory);
10088
10107
  const config = await this.configFileRepository.readConfig(baseDirectory);
10089
10108
  if (!config && !hasExplicitPackages) {
@@ -10101,13 +10120,15 @@ var InstallUseCase = class {
10101
10120
  lockfileVersion: 1,
10102
10121
  packageSlugs: [],
10103
10122
  agents: [],
10104
- installedAt: (/* @__PURE__ */ new Date()).toISOString(),
10105
10123
  artifacts: {}
10106
10124
  };
10125
+ if (!command32.skipInstalledAt) {
10126
+ effectiveLockFile.installedAt = (/* @__PURE__ */ new Date()).toISOString();
10127
+ }
10107
10128
  let packagesSlugs;
10108
10129
  let normalizedPackages = [];
10109
10130
  if (hasExplicitPackages) {
10110
- normalizedPackages = await this.normalizePackageSlugs(command33.packages);
10131
+ normalizedPackages = await this.normalizePackageSlugs(command32.packages);
10111
10132
  await this.validatePackageAccess(normalizedPackages);
10112
10133
  const normalizedConfigPackages = config ? await this.normalizeAndSaveConfigPackages(baseDirectory, config) : [];
10113
10134
  packagesSlugs = [
@@ -10152,6 +10173,18 @@ var InstallUseCase = class {
10152
10173
  uniqueFilesMap.set(file.path, file);
10153
10174
  }
10154
10175
  const uniqueFiles = Array.from(uniqueFilesMap.values());
10176
+ if (command32.skipInstalledAt) {
10177
+ for (const file of uniqueFiles) {
10178
+ if (file.path === "packmind-lock.json" && file.content) {
10179
+ try {
10180
+ const lockFileData = JSON.parse(file.content);
10181
+ delete lockFileData.installedAt;
10182
+ file.content = JSON.stringify(lockFileData, null, 2) + "\n";
10183
+ } catch {
10184
+ }
10185
+ }
10186
+ }
10187
+ }
10155
10188
  for (const file of uniqueFiles) {
10156
10189
  if (file.path.includes(".packmind/recipes/") && file.path.endsWith(".md")) {
10157
10190
  result.recipesCount++;
@@ -10288,7 +10321,7 @@ var InstallUseCase = class {
10288
10321
  async createOrUpdateFile(baseDirectory, file, result, skillFilePermissions) {
10289
10322
  const fullPath = path7.join(baseDirectory, file.path);
10290
10323
  const directory = path7.dirname(fullPath);
10291
- await fs5.mkdir(directory, { recursive: true });
10324
+ await fs6.mkdir(directory, { recursive: true });
10292
10325
  const fileExists = await this.fileExists(fullPath);
10293
10326
  if (file.content !== void 0) {
10294
10327
  await this.handleFullContentUpdate(
@@ -10308,13 +10341,13 @@ var InstallUseCase = class {
10308
10341
  );
10309
10342
  }
10310
10343
  if (skillFilePermissions && supportsUnixPermissions()) {
10311
- await fs5.chmod(fullPath, parsePermissionString(skillFilePermissions));
10344
+ await fs6.chmod(fullPath, parsePermissionString(skillFilePermissions));
10312
10345
  }
10313
10346
  }
10314
10347
  async handleFullContentUpdate(fullPath, content, fileExists, result, isBase64) {
10315
10348
  if (isBase64) {
10316
10349
  const buffer = Buffer.from(content, "base64");
10317
- await fs5.writeFile(fullPath, buffer);
10350
+ await fs6.writeFile(fullPath, buffer);
10318
10351
  if (fileExists) {
10319
10352
  result.filesUpdated++;
10320
10353
  } else {
@@ -10323,7 +10356,7 @@ var InstallUseCase = class {
10323
10356
  return;
10324
10357
  }
10325
10358
  if (fileExists) {
10326
- const existingContent = await fs5.readFile(fullPath, "utf-8");
10359
+ const existingContent = await fs6.readFile(fullPath, "utf-8");
10327
10360
  const commentMarker = this.extractCommentMarker(content);
10328
10361
  let finalContent;
10329
10362
  if (!commentMarker) {
@@ -10336,18 +10369,18 @@ var InstallUseCase = class {
10336
10369
  );
10337
10370
  }
10338
10371
  if (existingContent !== finalContent) {
10339
- await fs5.writeFile(fullPath, finalContent, "utf-8");
10372
+ await fs6.writeFile(fullPath, finalContent, "utf-8");
10340
10373
  result.filesUpdated++;
10341
10374
  }
10342
10375
  } else {
10343
- await fs5.writeFile(fullPath, content, "utf-8");
10376
+ await fs6.writeFile(fullPath, content, "utf-8");
10344
10377
  result.filesCreated++;
10345
10378
  }
10346
10379
  }
10347
10380
  async handleSectionsUpdate(fullPath, sections, fileExists, result, baseDirectory) {
10348
10381
  let currentContent = "";
10349
10382
  if (fileExists) {
10350
- currentContent = await fs5.readFile(fullPath, "utf-8");
10383
+ currentContent = await fs6.readFile(fullPath, "utf-8");
10351
10384
  }
10352
10385
  const mergedContent = mergeSectionsIntoFileContent(
10353
10386
  currentContent,
@@ -10355,11 +10388,11 @@ var InstallUseCase = class {
10355
10388
  );
10356
10389
  if (currentContent !== mergedContent) {
10357
10390
  if (this.isEffectivelyEmpty(mergedContent) && fileExists) {
10358
- await fs5.unlink(fullPath);
10391
+ await fs6.unlink(fullPath);
10359
10392
  result.filesDeleted++;
10360
10393
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
10361
10394
  } else {
10362
- await fs5.writeFile(fullPath, mergedContent, "utf-8");
10395
+ await fs6.writeFile(fullPath, mergedContent, "utf-8");
10363
10396
  if (fileExists) {
10364
10397
  result.filesUpdated++;
10365
10398
  } else {
@@ -10370,13 +10403,13 @@ var InstallUseCase = class {
10370
10403
  }
10371
10404
  async deleteFile(baseDirectory, filePath, result) {
10372
10405
  const fullPath = path7.join(baseDirectory, filePath);
10373
- const stat9 = await fs5.stat(fullPath).catch(() => null);
10406
+ const stat9 = await fs6.stat(fullPath).catch(() => null);
10374
10407
  if (stat9?.isDirectory()) {
10375
- await fs5.rm(fullPath, { recursive: true, force: true });
10408
+ await fs6.rm(fullPath, { recursive: true, force: true });
10376
10409
  result.filesDeleted++;
10377
10410
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
10378
10411
  } else if (stat9?.isFile()) {
10379
- await fs5.unlink(fullPath);
10412
+ await fs6.unlink(fullPath);
10380
10413
  result.filesDeleted++;
10381
10414
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
10382
10415
  }
@@ -10386,7 +10419,7 @@ var InstallUseCase = class {
10386
10419
  }
10387
10420
  async fileExists(filePath) {
10388
10421
  try {
10389
- await fs5.access(filePath);
10422
+ await fs6.access(filePath);
10390
10423
  return true;
10391
10424
  } catch {
10392
10425
  return false;
@@ -10438,9 +10471,9 @@ ${endMarker}`;
10438
10471
  for (const folder of folders) {
10439
10472
  const fullPath = path7.join(baseDirectory, folder);
10440
10473
  try {
10441
- await fs5.access(fullPath);
10474
+ await fs6.access(fullPath);
10442
10475
  const fileCount = await this.countFilesInDirectory(fullPath);
10443
- await fs5.rm(fullPath, { recursive: true, force: true });
10476
+ await fs6.rm(fullPath, { recursive: true, force: true });
10444
10477
  deletedFilesCount += fileCount;
10445
10478
  await this.removeEmptyParentDirectories(fullPath, baseDirectory);
10446
10479
  } catch {
@@ -10450,7 +10483,7 @@ ${endMarker}`;
10450
10483
  }
10451
10484
  async countFilesInDirectory(dirPath) {
10452
10485
  let count = 0;
10453
- const entries = await fs5.readdir(dirPath, { withFileTypes: true });
10486
+ const entries = await fs6.readdir(dirPath, { withFileTypes: true });
10454
10487
  for (const entry of entries) {
10455
10488
  const entryPath = path7.join(dirPath, entry.name);
10456
10489
  if (entry.isDirectory()) {
@@ -10463,7 +10496,7 @@ ${endMarker}`;
10463
10496
  }
10464
10497
  async isDirectoryEmpty(dirPath) {
10465
10498
  try {
10466
- const entries = await fs5.readdir(dirPath);
10499
+ const entries = await fs6.readdir(dirPath);
10467
10500
  return entries.length === 0;
10468
10501
  } catch {
10469
10502
  return false;
@@ -10476,7 +10509,7 @@ ${endMarker}`;
10476
10509
  const isEmpty = await this.isDirectoryEmpty(currentDir);
10477
10510
  if (!isEmpty) break;
10478
10511
  try {
10479
- await fs5.rmdir(currentDir);
10512
+ await fs6.rmdir(currentDir);
10480
10513
  } catch {
10481
10514
  break;
10482
10515
  }
@@ -10492,8 +10525,8 @@ var UninstallUseCase = class {
10492
10525
  this.spaceService = spaceService;
10493
10526
  this.installUseCase = installUseCase;
10494
10527
  }
10495
- async execute(command33) {
10496
- const baseDirectory = command33.baseDirectory || process.cwd();
10528
+ async execute(command32) {
10529
+ const baseDirectory = command32.baseDirectory || process.cwd();
10497
10530
  const config = await this.configFileRepository.readConfig(baseDirectory);
10498
10531
  if (!config) {
10499
10532
  const configFileExists = await this.configFileRepository.configExists(baseDirectory);
@@ -10507,7 +10540,7 @@ var UninstallUseCase = class {
10507
10540
  );
10508
10541
  }
10509
10542
  const normalized = await normalizePackageSlugs(
10510
- command33.packages,
10543
+ command32.packages,
10511
10544
  this.spaceService
10512
10545
  );
10513
10546
  const notInstalled = normalized.filter((pkg) => !(pkg in config.packages));
@@ -10541,15 +10574,15 @@ ${pkgList}`
10541
10574
  };
10542
10575
 
10543
10576
  // apps/cli/src/application/useCases/InstallDefaultSkillsUseCase.ts
10544
- var fs6 = __toESM(require("fs/promises"));
10577
+ var fs7 = __toESM(require("fs/promises"));
10545
10578
  var path8 = __toESM(require("path"));
10546
10579
  var import_semver = __toESM(require("semver"));
10547
10580
  var InstallDefaultSkillsUseCase = class {
10548
10581
  constructor(repositories) {
10549
10582
  this.repositories = repositories;
10550
10583
  }
10551
- async execute(command33) {
10552
- const baseDirectory = command33.baseDirectory || process.cwd();
10584
+ async execute(command32) {
10585
+ const baseDirectory = command32.baseDirectory || process.cwd();
10553
10586
  const result = {
10554
10587
  filesCreated: 0,
10555
10588
  filesUpdated: 0,
@@ -10562,17 +10595,17 @@ var InstallDefaultSkillsUseCase = class {
10562
10595
  const agents = config?.agents;
10563
10596
  const response = await this.repositories.packmindGateway.skills.getDefaults(
10564
10597
  {
10565
- cliVersion: command33.cliVersion,
10566
- includeBeta: command33.includeBeta,
10598
+ cliVersion: command32.cliVersion,
10599
+ includeBeta: command32.includeBeta,
10567
10600
  agents
10568
10601
  }
10569
10602
  );
10570
10603
  result.skippedSkillsCount = response.skippedSkillsCount;
10571
10604
  const incompatibleInstalledMap = /* @__PURE__ */ new Map();
10572
10605
  const incompatibleSkillDirs = /* @__PURE__ */ new Map();
10573
- if (command33.cliVersion) {
10606
+ if (command32.cliVersion) {
10574
10607
  for (const file of response.fileUpdates.createOrUpdate) {
10575
- if (path8.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command33.cliVersion)) {
10608
+ if (path8.basename(file.path) === "SKILL.md" && file.content && this.isVersionConstraintViolated(file.content, command32.cliVersion)) {
10576
10609
  const dir = path8.dirname(file.path);
10577
10610
  const skillName = this.getSkillName(file.content) ?? path8.basename(dir);
10578
10611
  incompatibleSkillDirs.set(dir, skillName);
@@ -10583,9 +10616,9 @@ var InstallDefaultSkillsUseCase = class {
10583
10616
  for (const file of response.fileUpdates.createOrUpdate) {
10584
10617
  try {
10585
10618
  if (!file.content) continue;
10586
- const isIncompatible = command33.cliVersion && (this.isVersionConstraintViolated(
10619
+ const isIncompatible = command32.cliVersion && (this.isVersionConstraintViolated(
10587
10620
  file.content,
10588
- command33.cliVersion
10621
+ command32.cliVersion
10589
10622
  ) || this.isUnderIncompatibleSkillDir(
10590
10623
  file.path,
10591
10624
  incompatibleSkillDirs
@@ -10630,22 +10663,22 @@ var InstallDefaultSkillsUseCase = class {
10630
10663
  async createOrUpdateFile(baseDirectory, file, result) {
10631
10664
  const fullPath = path8.join(baseDirectory, file.path);
10632
10665
  const directory = path8.dirname(fullPath);
10633
- await fs6.mkdir(directory, { recursive: true });
10666
+ await fs7.mkdir(directory, { recursive: true });
10634
10667
  const fileExists = await this.fileExists(fullPath);
10635
10668
  if (fileExists) {
10636
- const existingContent = await fs6.readFile(fullPath, "utf-8");
10669
+ const existingContent = await fs7.readFile(fullPath, "utf-8");
10637
10670
  if (existingContent !== file.content) {
10638
- await fs6.writeFile(fullPath, file.content, "utf-8");
10671
+ await fs7.writeFile(fullPath, file.content, "utf-8");
10639
10672
  result.filesUpdated++;
10640
10673
  }
10641
10674
  } else {
10642
- await fs6.writeFile(fullPath, file.content, "utf-8");
10675
+ await fs7.writeFile(fullPath, file.content, "utf-8");
10643
10676
  result.filesCreated++;
10644
10677
  }
10645
10678
  }
10646
10679
  async fileExists(filePath) {
10647
10680
  try {
10648
- await fs6.access(filePath);
10681
+ await fs7.access(filePath);
10649
10682
  return true;
10650
10683
  } catch {
10651
10684
  return false;
@@ -10700,10 +10733,10 @@ var ListPackagesUseCase = class {
10700
10733
  this.packmindGateway = packmindGateway;
10701
10734
  this.spaceService = spaceService;
10702
10735
  }
10703
- async execute(command33) {
10704
- if (command33.spaceId) {
10736
+ async execute(command32) {
10737
+ if (command32.spaceId) {
10705
10738
  const response = await this.packmindGateway.packages.list({
10706
- spaceId: command33.spaceId
10739
+ spaceId: command32.spaceId
10707
10740
  });
10708
10741
  return response.packages;
10709
10742
  }
@@ -10722,8 +10755,8 @@ var GetPackageSummaryUseCase = class {
10722
10755
  constructor(gateway) {
10723
10756
  this.gateway = gateway;
10724
10757
  }
10725
- async execute(command33) {
10726
- return this.gateway.packages.getSummary(command33);
10758
+ async execute(command32) {
10759
+ return this.gateway.packages.getSummary(command32);
10727
10760
  }
10728
10761
  };
10729
10762
 
@@ -10783,7 +10816,7 @@ var EnvCredentialsProvider = class {
10783
10816
  };
10784
10817
 
10785
10818
  // apps/cli/src/infra/utils/credentials/FileCredentialsProvider.ts
10786
- var fs7 = __toESM(require("fs"));
10819
+ var fs8 = __toESM(require("fs"));
10787
10820
  var path9 = __toESM(require("path"));
10788
10821
  var os2 = __toESM(require("os"));
10789
10822
  var CREDENTIALS_DIR = ".packmind";
@@ -10797,11 +10830,11 @@ var FileCredentialsProvider = class {
10797
10830
  }
10798
10831
  hasCredentials() {
10799
10832
  const credentialsPath = getCredentialsPath();
10800
- if (!fs7.existsSync(credentialsPath)) {
10833
+ if (!fs8.existsSync(credentialsPath)) {
10801
10834
  return false;
10802
10835
  }
10803
10836
  try {
10804
- const content = fs7.readFileSync(credentialsPath, "utf-8");
10837
+ const content = fs8.readFileSync(credentialsPath, "utf-8");
10805
10838
  const credentials = JSON.parse(content);
10806
10839
  return !!credentials.apiKey;
10807
10840
  } catch {
@@ -10810,11 +10843,11 @@ var FileCredentialsProvider = class {
10810
10843
  }
10811
10844
  loadCredentials() {
10812
10845
  const credentialsPath = getCredentialsPath();
10813
- if (!fs7.existsSync(credentialsPath)) {
10846
+ if (!fs8.existsSync(credentialsPath)) {
10814
10847
  return null;
10815
10848
  }
10816
10849
  try {
10817
- const content = fs7.readFileSync(credentialsPath, "utf-8");
10850
+ const content = fs8.readFileSync(credentialsPath, "utf-8");
10818
10851
  const credentials = JSON.parse(content);
10819
10852
  if (!credentials.apiKey) {
10820
10853
  return null;
@@ -10838,12 +10871,12 @@ var FileCredentialsProvider = class {
10838
10871
  };
10839
10872
  function saveCredentials(apiKey) {
10840
10873
  const credentialsDir = path9.join(os2.homedir(), CREDENTIALS_DIR);
10841
- if (!fs7.existsSync(credentialsDir)) {
10842
- fs7.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
10874
+ if (!fs8.existsSync(credentialsDir)) {
10875
+ fs8.mkdirSync(credentialsDir, { recursive: true, mode: 448 });
10843
10876
  }
10844
10877
  const credentialsPath = getCredentialsPath();
10845
10878
  const credentials = { apiKey };
10846
- fs7.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
10879
+ fs8.writeFileSync(credentialsPath, JSON.stringify(credentials, null, 2), {
10847
10880
  mode: 384
10848
10881
  });
10849
10882
  }
@@ -11002,8 +11035,8 @@ var LoginUseCase = class {
11002
11035
  startCallbackServer: deps?.startCallbackServer ?? defaultStartCallbackServer
11003
11036
  };
11004
11037
  }
11005
- async execute(command33) {
11006
- const { host, code: providedCode } = command33;
11038
+ async execute(command32) {
11039
+ const { host, code: providedCode } = command32;
11007
11040
  let code;
11008
11041
  if (providedCode) {
11009
11042
  code = providedCode;
@@ -11035,14 +11068,14 @@ var LoginUseCase = class {
11035
11068
  };
11036
11069
 
11037
11070
  // apps/cli/src/application/useCases/LogoutUseCase.ts
11038
- var fs8 = __toESM(require("fs"));
11071
+ var fs9 = __toESM(require("fs"));
11039
11072
  var ENV_VAR_NAME2 = "PACKMIND_API_KEY_V3";
11040
11073
  var LogoutUseCase = class {
11041
11074
  constructor(deps) {
11042
11075
  this.deps = {
11043
11076
  getCredentialsPath: deps?.getCredentialsPath ?? getCredentialsPath,
11044
- fileExists: deps?.fileExists ?? ((path37) => fs8.existsSync(path37)),
11045
- deleteFile: deps?.deleteFile ?? ((path37) => fs8.unlinkSync(path37)),
11077
+ fileExists: deps?.fileExists ?? ((path35) => fs9.existsSync(path35)),
11078
+ deleteFile: deps?.deleteFile ?? ((path35) => fs9.unlinkSync(path35)),
11046
11079
  hasEnvVar: deps?.hasEnvVar ?? (() => !!process.env[ENV_VAR_NAME2])
11047
11080
  };
11048
11081
  }
@@ -11321,7 +11354,7 @@ var CheckCliVersionUseCase = class {
11321
11354
  timeoutMs: deps?.timeoutMs ?? VERSION_CHECK_TIMEOUT_MS
11322
11355
  };
11323
11356
  }
11324
- async execute(command33) {
11357
+ async execute(command32) {
11325
11358
  try {
11326
11359
  const latestVersion = await Promise.race([
11327
11360
  this.deps.fetchLatestVersion(this.deps.fetchFn),
@@ -11332,9 +11365,9 @@ var CheckCliVersionUseCase = class {
11332
11365
  )
11333
11366
  )
11334
11367
  ]);
11335
- const updateAvailable = import_semver3.default.gt(latestVersion, command33.currentVersion);
11368
+ const updateAvailable = import_semver3.default.gt(latestVersion, command32.currentVersion);
11336
11369
  return {
11337
- currentVersion: command33.currentVersion,
11370
+ currentVersion: command32.currentVersion,
11338
11371
  latestVersion,
11339
11372
  updateAvailable
11340
11373
  };
@@ -11344,222 +11377,9 @@ var CheckCliVersionUseCase = class {
11344
11377
  }
11345
11378
  };
11346
11379
 
11347
- // apps/cli/src/application/useCases/SetupMcpUseCase.ts
11348
- var ALL_AGENTS = [
11349
- { type: "claude", name: "Claude Code" },
11350
- { type: "cursor", name: "Cursor" },
11351
- { type: "vscode", name: "VS Code" },
11352
- { type: "continue", name: "Continue.dev" }
11353
- ];
11354
- var SetupMcpUseCase = class {
11355
- constructor(deps) {
11356
- this.deps = deps;
11357
- }
11358
- async execute(command33) {
11359
- const { agentTypes } = command33;
11360
- const [tokenResult, urlResult] = await Promise.all([
11361
- this.deps.gateway.mcp.getToken({}),
11362
- this.deps.gateway.mcp.getUrl({})
11363
- ]);
11364
- const config = {
11365
- url: urlResult.url,
11366
- accessToken: tokenResult.access_token
11367
- };
11368
- const results = [];
11369
- let hasFailure = false;
11370
- for (const agentType of agentTypes) {
11371
- const agentName = ALL_AGENTS.find((a) => a.type === agentType)?.name || agentType;
11372
- const installResult = this.deps.mcpConfigService.installForAgent(
11373
- agentType,
11374
- config
11375
- );
11376
- results.push({
11377
- agentType,
11378
- agentName,
11379
- success: installResult.success,
11380
- error: installResult.error
11381
- });
11382
- if (!installResult.success) {
11383
- hasFailure = true;
11384
- }
11385
- }
11386
- return {
11387
- results,
11388
- manualConfigJson: hasFailure ? this.deps.mcpConfigService.getClassicConfig(config) : void 0
11389
- };
11390
- }
11391
- };
11392
-
11393
- // apps/cli/src/application/services/McpConfigService.ts
11394
- var fs9 = __toESM(require("fs"));
11395
- var path11 = __toESM(require("path"));
11396
- var os3 = __toESM(require("os"));
11397
- var import_child_process3 = require("child_process");
11398
- var McpConfigService = class {
11399
- constructor(projectDir = process.cwd()) {
11400
- this.projectDir = projectDir;
11401
- }
11402
- installForAgent(agent, config) {
11403
- switch (agent) {
11404
- case "claude":
11405
- return this.installClaudeMcp(config);
11406
- case "cursor":
11407
- return this.installCursorMcp(config);
11408
- case "vscode":
11409
- return this.installVSCodeMcp(config);
11410
- case "continue":
11411
- return this.installContinueMcp(config);
11412
- default:
11413
- return { success: false, error: `Unknown agent: ${agent}` };
11414
- }
11415
- }
11416
- getClassicConfig(config) {
11417
- const mcpConfig = {
11418
- mcpServers: {
11419
- packmind: {
11420
- url: config.url,
11421
- headers: {
11422
- Authorization: `Bearer ${config.accessToken}`
11423
- }
11424
- }
11425
- }
11426
- };
11427
- return JSON.stringify(mcpConfig, null, 2);
11428
- }
11429
- installClaudeMcp(config) {
11430
- const command33 = `claude mcp add --transport http packmind ${config.url} --header "Authorization: Bearer ${config.accessToken}"`;
11431
- try {
11432
- (0, import_child_process3.execSync)(command33, { stdio: "pipe" });
11433
- return { success: true };
11434
- } catch (error) {
11435
- const execError = error;
11436
- const errorMessage = execError.stderr ? execError.stderr.toString().trim() : execError.message || String(error);
11437
- return { success: false, error: errorMessage };
11438
- }
11439
- }
11440
- installCursorMcp(config) {
11441
- try {
11442
- const cursorConfigPath = path11.join(os3.homedir(), ".cursor", "mcp.json");
11443
- const cursorConfig = this.buildCursorConfig(config);
11444
- const existingConfig = this.readExistingJsonConfig(cursorConfigPath);
11445
- const mergedConfig = this.mergeConfig(existingConfig, cursorConfig);
11446
- fs9.writeFileSync(cursorConfigPath, JSON.stringify(mergedConfig, null, 2));
11447
- return { success: true };
11448
- } catch (error) {
11449
- const errorMessage = error instanceof Error ? error.message : String(error);
11450
- return { success: false, error: errorMessage };
11451
- }
11452
- }
11453
- installVSCodeMcp(config) {
11454
- try {
11455
- const vscodeDir = path11.join(this.projectDir, ".vscode");
11456
- if (!fs9.existsSync(vscodeDir)) {
11457
- fs9.mkdirSync(vscodeDir, { recursive: true });
11458
- }
11459
- const vscodeConfigPath = path11.join(vscodeDir, "mcp.json");
11460
- const vscodeConfig = this.buildVSCodeConfig(config);
11461
- const existingConfig = this.readExistingJsonConfig(vscodeConfigPath);
11462
- const mergedConfig = this.mergeVSCodeConfig(existingConfig, vscodeConfig);
11463
- fs9.writeFileSync(vscodeConfigPath, JSON.stringify(mergedConfig, null, 2));
11464
- return { success: true };
11465
- } catch (error) {
11466
- const errorMessage = error instanceof Error ? error.message : String(error);
11467
- return { success: false, error: errorMessage };
11468
- }
11469
- }
11470
- installContinueMcp(config) {
11471
- try {
11472
- const continueDir = path11.join(this.projectDir, ".continue");
11473
- const mcpServersDir = path11.join(continueDir, "mcpServers");
11474
- if (!fs9.existsSync(mcpServersDir)) {
11475
- fs9.mkdirSync(mcpServersDir, { recursive: true });
11476
- }
11477
- const continueConfigPath = path11.join(mcpServersDir, "packmind.yaml");
11478
- const continueConfig = this.buildContinueYamlConfig(config);
11479
- fs9.writeFileSync(continueConfigPath, continueConfig);
11480
- return { success: true };
11481
- } catch (error) {
11482
- const errorMessage = error instanceof Error ? error.message : String(error);
11483
- return { success: false, error: errorMessage };
11484
- }
11485
- }
11486
- buildCursorConfig(config) {
11487
- return {
11488
- mcpServers: {
11489
- packmind: {
11490
- url: config.url,
11491
- headers: {
11492
- Authorization: `Bearer ${config.accessToken}`
11493
- }
11494
- }
11495
- }
11496
- };
11497
- }
11498
- buildVSCodeConfig(config) {
11499
- return {
11500
- servers: {
11501
- "packmind-mcp-vscode": {
11502
- url: config.url,
11503
- type: "http",
11504
- headers: {
11505
- Authorization: `Bearer ${config.accessToken}`
11506
- }
11507
- }
11508
- },
11509
- inputs: []
11510
- };
11511
- }
11512
- buildContinueYamlConfig(config) {
11513
- return `name: Packmind MCP Server
11514
- version: 0.0.1
11515
- schema: v1
11516
- mcpServers:
11517
- - name: Packmind
11518
- type: streamable-http
11519
- url: ${config.url}
11520
- requestOptions:
11521
- headers:
11522
- Authorization: "Bearer ${config.accessToken}"
11523
- `;
11524
- }
11525
- readExistingJsonConfig(filePath) {
11526
- try {
11527
- if (fs9.existsSync(filePath)) {
11528
- const content = fs9.readFileSync(filePath, "utf-8");
11529
- return JSON.parse(content);
11530
- }
11531
- } catch {
11532
- }
11533
- return {};
11534
- }
11535
- mergeConfig(existing, newConfig) {
11536
- const existingServers = existing["mcpServers"] || {};
11537
- const newServers = newConfig["mcpServers"] || {};
11538
- return {
11539
- ...existing,
11540
- mcpServers: {
11541
- ...existingServers,
11542
- ...newServers
11543
- }
11544
- };
11545
- }
11546
- mergeVSCodeConfig(existing, newConfig) {
11547
- const existingServers = existing["servers"] || {};
11548
- const newServers = newConfig["servers"] || {};
11549
- return {
11550
- ...existing,
11551
- servers: {
11552
- ...existingServers,
11553
- ...newServers
11554
- },
11555
- inputs: existing["inputs"] || newConfig["inputs"] || []
11556
- };
11557
- }
11558
- };
11559
-
11560
11380
  // apps/cli/src/infra/repositories/ConfigFileRepository.ts
11561
11381
  var fs10 = __toESM(require("fs/promises"));
11562
- var path12 = __toESM(require("path"));
11382
+ var path11 = __toESM(require("path"));
11563
11383
  var ConfigFileRepository = class {
11564
11384
  constructor() {
11565
11385
  this.CONFIG_FILENAME = "packmind.json";
@@ -11623,7 +11443,7 @@ var ConfigFileRepository = class {
11623
11443
  }
11624
11444
  }
11625
11445
  getConfigPath(directory) {
11626
- return path12.join(directory, this.CONFIG_FILENAME);
11446
+ return path11.join(directory, this.CONFIG_FILENAME);
11627
11447
  }
11628
11448
  async writeConfigToPath(configPath, config) {
11629
11449
  const configContent = JSON.stringify(config, null, 2) + "\n";
@@ -11634,7 +11454,7 @@ var ConfigFileRepository = class {
11634
11454
  * Excludes common build/dependency directories (node_modules, .git, dist, etc.)
11635
11455
  */
11636
11456
  async findDescendantConfigs(directory) {
11637
- const normalizedDir = normalizePath2(path12.resolve(directory));
11457
+ const normalizedDir = normalizePath2(path11.resolve(directory));
11638
11458
  return this.searchDescendantsRecursively(normalizedDir);
11639
11459
  }
11640
11460
  async searchDescendantsRecursively(currentDir) {
@@ -11647,7 +11467,7 @@ var ConfigFileRepository = class {
11647
11467
  if (!entry.isDirectory() || this.isExcludedDirectory(entry.name)) {
11648
11468
  continue;
11649
11469
  }
11650
- const entryPath = normalizePath2(path12.join(currentDir, entry.name));
11470
+ const entryPath = normalizePath2(path11.join(currentDir, entry.name));
11651
11471
  const config = await this.readConfig(entryPath);
11652
11472
  if (config) {
11653
11473
  results.push(entryPath);
@@ -11678,21 +11498,21 @@ var ConfigFileRepository = class {
11678
11498
  async readHierarchicalConfig(startDirectory, stopDirectory) {
11679
11499
  const configs = [];
11680
11500
  const configPaths = [];
11681
- const normalizedStart = normalizePath2(path12.resolve(startDirectory));
11682
- const normalizedStop = stopDirectory ? normalizePath2(path12.resolve(stopDirectory)) : null;
11501
+ const normalizedStart = normalizePath2(path11.resolve(startDirectory));
11502
+ const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
11683
11503
  let currentDir = normalizedStart;
11684
11504
  while (true) {
11685
11505
  const config = await this.readConfig(currentDir);
11686
11506
  if (config) {
11687
11507
  configs.push(config);
11688
11508
  configPaths.push(
11689
- normalizePath2(path12.join(currentDir, this.CONFIG_FILENAME))
11509
+ normalizePath2(path11.join(currentDir, this.CONFIG_FILENAME))
11690
11510
  );
11691
11511
  }
11692
11512
  if (normalizedStop !== null && currentDir === normalizedStop) {
11693
11513
  break;
11694
11514
  }
11695
- const parentDir = normalizePath2(path12.dirname(currentDir));
11515
+ const parentDir = normalizePath2(path11.dirname(currentDir));
11696
11516
  if (parentDir === currentDir) {
11697
11517
  break;
11698
11518
  }
@@ -11717,8 +11537,8 @@ var ConfigFileRepository = class {
11717
11537
  * and returns each config with its target path.
11718
11538
  */
11719
11539
  async findAllConfigsInTree(startDirectory, stopDirectory) {
11720
- const normalizedStart = normalizePath2(path12.resolve(startDirectory));
11721
- const normalizedStop = stopDirectory ? normalizePath2(path12.resolve(stopDirectory)) : null;
11540
+ const normalizedStart = normalizePath2(path11.resolve(startDirectory));
11541
+ const normalizedStop = stopDirectory ? normalizePath2(path11.resolve(stopDirectory)) : null;
11722
11542
  const basePath = normalizedStop ?? normalizedStart;
11723
11543
  const searchRoot = normalizedStop ?? normalizedStart;
11724
11544
  const configsMap = /* @__PURE__ */ new Map();
@@ -11744,7 +11564,7 @@ var ConfigFileRepository = class {
11744
11564
  if (stopDir !== null && currentDir === stopDir) {
11745
11565
  break;
11746
11566
  }
11747
- const parentDir = normalizePath2(path12.dirname(currentDir));
11567
+ const parentDir = normalizePath2(path11.dirname(currentDir));
11748
11568
  if (parentDir === currentDir) {
11749
11569
  break;
11750
11570
  }
@@ -11894,7 +11714,7 @@ var ConfigFileRepository = class {
11894
11714
 
11895
11715
  // apps/cli/src/infra/repositories/LockFileRepository.ts
11896
11716
  var fs11 = __toESM(require("fs/promises"));
11897
- var path13 = __toESM(require("path"));
11717
+ var path12 = __toESM(require("path"));
11898
11718
  var LockFileRepository = class {
11899
11719
  constructor() {
11900
11720
  this.LOCK_FILENAME = "packmind-lock.json";
@@ -11925,10 +11745,10 @@ var LockFileRepository = class {
11925
11745
  return false;
11926
11746
  }
11927
11747
  const obj = data;
11928
- return typeof obj.installedAt === "string" && Array.isArray(obj.packageSlugs) && Array.isArray(obj.agents) && (obj.targetId === void 0 || typeof obj.targetId === "string") && typeof obj.artifacts === "object" && obj.artifacts !== null && !Array.isArray(obj.artifacts);
11748
+ return Array.isArray(obj.packageSlugs) && Array.isArray(obj.agents) && (obj.targetId === void 0 || typeof obj.targetId === "string") && typeof obj.artifacts === "object" && obj.artifacts !== null && !Array.isArray(obj.artifacts);
11929
11749
  }
11930
11750
  getLockFilePath(baseDirectory) {
11931
- return path13.join(baseDirectory, this.LOCK_FILENAME);
11751
+ return path12.join(baseDirectory, this.LOCK_FILENAME);
11932
11752
  }
11933
11753
  };
11934
11754
 
@@ -11938,10 +11758,10 @@ var ListStandardsUseCase = class {
11938
11758
  this.packmindGateway = packmindGateway;
11939
11759
  this.spaceService = spaceService;
11940
11760
  }
11941
- async execute(command33) {
11942
- if (command33.spaceId) {
11761
+ async execute(command32) {
11762
+ if (command32.spaceId) {
11943
11763
  const response = await this.packmindGateway.standards.list({
11944
- spaceId: command33.spaceId
11764
+ spaceId: command32.spaceId
11945
11765
  });
11946
11766
  return response.standards;
11947
11767
  }
@@ -11961,10 +11781,10 @@ var ListCommandsUseCase = class {
11961
11781
  this.packmindGateway = packmindGateway;
11962
11782
  this.spaceService = spaceService;
11963
11783
  }
11964
- async execute(command33) {
11965
- if (command33.spaceId) {
11784
+ async execute(command32) {
11785
+ if (command32.spaceId) {
11966
11786
  const response = await this.packmindGateway.commands.list({
11967
- spaceId: command33.spaceId
11787
+ spaceId: command32.spaceId
11968
11788
  });
11969
11789
  return response.recipes;
11970
11790
  }
@@ -11984,10 +11804,10 @@ var ListSkillsUseCase = class {
11984
11804
  this.packmindGateway = packmindGateway;
11985
11805
  this.spaceService = spaceService;
11986
11806
  }
11987
- async execute(command33) {
11988
- if (command33.spaceId) {
11807
+ async execute(command32) {
11808
+ if (command32.spaceId) {
11989
11809
  const skills = await this.packmindGateway.skills.list({
11990
- spaceId: command33.spaceId
11810
+ spaceId: command32.spaceId
11991
11811
  });
11992
11812
  return skills.map((s) => ({
11993
11813
  slug: s.slug,
@@ -12024,7 +11844,7 @@ function normalizeLineEndings(content) {
12024
11844
  }
12025
11845
 
12026
11846
  // apps/cli/src/infra/utils/binaryDetection.ts
12027
- var path14 = __toESM(require("path"));
11847
+ var path13 = __toESM(require("path"));
12028
11848
  var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
12029
11849
  // Images
12030
11850
  ".png",
@@ -12082,7 +11902,7 @@ var BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
12082
11902
  ".sqlite3"
12083
11903
  ]);
12084
11904
  function isBinaryExtension(filePath) {
12085
- const ext = path14.extname(filePath).toLowerCase();
11905
+ const ext = path13.extname(filePath).toLowerCase();
12086
11906
  return BINARY_EXTENSIONS.has(ext);
12087
11907
  }
12088
11908
  function isBinaryBuffer(buffer) {
@@ -12162,8 +11982,8 @@ var UploadSkillUseCase = class {
12162
11982
  constructor(deps) {
12163
11983
  this.deps = deps;
12164
11984
  }
12165
- async execute(command33) {
12166
- const files = await readSkillDirectory(command33.skillPath);
11985
+ async execute(command32) {
11986
+ const files = await readSkillDirectory(command32.skillPath);
12167
11987
  if (!files.find((f) => f.relativePath === "SKILL.md")) {
12168
11988
  throw new Error("SKILL.md not found in skill directory");
12169
11989
  }
@@ -12177,7 +11997,7 @@ var UploadSkillUseCase = class {
12177
11997
  if (totalSize > 10 * 1024 * 1024) {
12178
11998
  throw new Error(`Skill size (${totalSize} bytes) exceeds 10MB limit`);
12179
11999
  }
12180
- const space = await this.getSpace(command33.spaceSlug);
12000
+ const space = await this.getSpace(command32.spaceSlug);
12181
12001
  const payload = {
12182
12002
  files: files.map((f) => ({
12183
12003
  path: f.relativePath,
@@ -12189,7 +12009,7 @@ var UploadSkillUseCase = class {
12189
12009
  const uploadSkillResponse = await this.deps.gateway.skills.upload({
12190
12010
  spaceId: createSpaceId(space.id),
12191
12011
  files: payload.files,
12192
- originSkill: command33.originSkill
12012
+ originSkill: command32.originSkill
12193
12013
  });
12194
12014
  return {
12195
12015
  skillId: uploadSkillResponse.skill.id,
@@ -12229,13 +12049,13 @@ ${spaceList}`
12229
12049
  // apps/cli/src/application/useCases/diffStrategies/CommandDiffStrategy.ts
12230
12050
  var import_diff2 = require("diff");
12231
12051
  var fs13 = __toESM(require("fs/promises"));
12232
- var path16 = __toESM(require("path"));
12052
+ var path15 = __toESM(require("path"));
12233
12053
  var CommandDiffStrategy = class {
12234
12054
  supports(file) {
12235
12055
  return file.artifactType === "command";
12236
12056
  }
12237
12057
  async diff(file, baseDirectory) {
12238
- const fullPath = path16.join(baseDirectory, file.path);
12058
+ const fullPath = path15.join(baseDirectory, file.path);
12239
12059
  let localContent;
12240
12060
  try {
12241
12061
  localContent = await fs13.readFile(fullPath, "utf-8");
@@ -12269,7 +12089,7 @@ var CommandDiffStrategy = class {
12269
12089
  // apps/cli/src/application/useCases/diffStrategies/SkillDiffStrategy.ts
12270
12090
  var import_diff3 = require("diff");
12271
12091
  var fs14 = __toESM(require("fs/promises"));
12272
- var path17 = __toESM(require("path"));
12092
+ var path16 = __toESM(require("path"));
12273
12093
 
12274
12094
  // apps/cli/src/application/utils/stripFrontmatter.ts
12275
12095
  var FRONTMATTER_DELIMITER2 = "---";
@@ -12304,7 +12124,7 @@ var SkillDiffStrategy = class {
12304
12124
  async diffNewFiles(skillFolders, serverFiles, baseDirectory) {
12305
12125
  const diffs = [];
12306
12126
  for (const folder of skillFolders) {
12307
- const folderPath = path17.join(baseDirectory, folder);
12127
+ const folderPath = path16.join(baseDirectory, folder);
12308
12128
  const localFiles = await this.listFilesRecursively(folderPath);
12309
12129
  const serverPathsInFolder = new Set(
12310
12130
  serverFiles.filter((f) => f.path.startsWith(folder + "/")).map((f) => f.path)
@@ -12323,7 +12143,7 @@ var SkillDiffStrategy = class {
12323
12143
  if (serverPathsInFolder.has(filePath)) {
12324
12144
  continue;
12325
12145
  }
12326
- const fullPath = path17.join(baseDirectory, filePath);
12146
+ const fullPath = path16.join(baseDirectory, filePath);
12327
12147
  const localRead = await this.tryReadFileBinaryAware(fullPath);
12328
12148
  if (localRead === null) {
12329
12149
  continue;
@@ -12350,7 +12170,7 @@ var SkillDiffStrategy = class {
12350
12170
  return diffs;
12351
12171
  }
12352
12172
  async diffSkillMd(file, baseDirectory) {
12353
- const fullPath = path17.join(baseDirectory, file.path);
12173
+ const fullPath = path16.join(baseDirectory, file.path);
12354
12174
  const localContent = await this.tryReadFile(fullPath);
12355
12175
  if (localContent === null) {
12356
12176
  return [];
@@ -12407,7 +12227,7 @@ var SkillDiffStrategy = class {
12407
12227
  return [];
12408
12228
  }
12409
12229
  const skillFileId = createSkillFileId(file.skillFileId);
12410
- const fullPath = path17.join(baseDirectory, file.path);
12230
+ const fullPath = path16.join(baseDirectory, file.path);
12411
12231
  const localRead = await this.tryReadFileBinaryAware(fullPath);
12412
12232
  const fileRelativePath = this.computeRelativePath(file.path, skillFolders);
12413
12233
  if (localRead === null) {
@@ -12642,7 +12462,7 @@ var SkillDiffStrategy = class {
12642
12462
  }
12643
12463
  const files = [];
12644
12464
  for (const entry of entries) {
12645
- const fullPath = path17.join(dirPath, entry);
12465
+ const fullPath = path16.join(dirPath, entry);
12646
12466
  const stat9 = await this.tryStatFile(fullPath);
12647
12467
  if (!stat9) {
12648
12468
  continue;
@@ -12687,7 +12507,7 @@ var SkillDiffStrategy = class {
12687
12507
 
12688
12508
  // apps/cli/src/application/useCases/diffStrategies/StandardDiffStrategy.ts
12689
12509
  var fs15 = __toESM(require("fs/promises"));
12690
- var path18 = __toESM(require("path"));
12510
+ var path17 = __toESM(require("path"));
12691
12511
 
12692
12512
  // apps/cli/src/application/utils/parseStandardMd.ts
12693
12513
  var DEPLOYER_PARSERS = [
@@ -12995,7 +12815,7 @@ var StandardDiffStrategy = class {
12995
12815
  return file.artifactType === "standard";
12996
12816
  }
12997
12817
  async diff(file, baseDirectory) {
12998
- const fullPath = path18.join(baseDirectory, file.path);
12818
+ const fullPath = path17.join(baseDirectory, file.path);
12999
12819
  let localContent;
13000
12820
  try {
13001
12821
  localContent = await fs15.readFile(fullPath, "utf-8");
@@ -13122,9 +12942,9 @@ var DiffArtefactsUseCase = class {
13122
12942
  new StandardDiffStrategy()
13123
12943
  ];
13124
12944
  }
13125
- async execute(command33) {
13126
- const baseDirectory = command33.baseDirectory || process.cwd();
13127
- const response = await this.fetchContent(command33, baseDirectory);
12945
+ async execute(command32) {
12946
+ const baseDirectory = command32.baseDirectory || process.cwd();
12947
+ const response = await this.fetchContent(command32, baseDirectory);
13128
12948
  const filteredFiles = response.fileUpdates.createOrUpdate.filter(
13129
12949
  (file) => file.path !== "packmind.json"
13130
12950
  );
@@ -13137,7 +12957,7 @@ var DiffArtefactsUseCase = class {
13137
12957
  );
13138
12958
  const prefixedSkillFolders = this.prefixSkillFolders(
13139
12959
  response.skillFolders,
13140
- command33.relativePath
12960
+ command32.relativePath
13141
12961
  );
13142
12962
  const diffs = [];
13143
12963
  for (const file of diffableFiles) {
@@ -13164,7 +12984,7 @@ var DiffArtefactsUseCase = class {
13164
12984
  targetId: response.targetId ? createTargetId(response.targetId) : void 0
13165
12985
  }));
13166
12986
  }
13167
- async fetchContent(command33, baseDirectory) {
12987
+ async fetchContent(command32, baseDirectory) {
13168
12988
  const lockFile = await this.lockFileRepository.read(baseDirectory);
13169
12989
  if (lockFile) {
13170
12990
  try {
@@ -13184,11 +13004,11 @@ var DiffArtefactsUseCase = class {
13184
13004
  }
13185
13005
  }
13186
13006
  return this.packmindGateway.deployment.getDeployed({
13187
- packagesSlugs: command33.packagesSlugs,
13188
- gitRemoteUrl: command33.gitRemoteUrl,
13189
- gitBranch: command33.gitBranch,
13190
- relativePath: command33.relativePath,
13191
- agents: command33.agents
13007
+ packagesSlugs: command32.packagesSlugs,
13008
+ gitRemoteUrl: command32.gitRemoteUrl,
13009
+ gitBranch: command32.gitBranch,
13010
+ relativePath: command32.relativePath,
13011
+ agents: command32.agents
13192
13012
  });
13193
13013
  }
13194
13014
  prefixSkillFolders(skillFolders, relativePath) {
@@ -13212,8 +13032,8 @@ var SubmitDiffsUseCase = class {
13212
13032
  constructor(packmindGateway) {
13213
13033
  this.packmindGateway = packmindGateway;
13214
13034
  }
13215
- async execute(command33) {
13216
- const { groupedDiffs, message } = command33;
13035
+ async execute(command32) {
13036
+ const { groupedDiffs, message } = command32;
13217
13037
  const skipped = [];
13218
13038
  const validDiffs = [];
13219
13039
  for (const group of groupedDiffs) {
@@ -13288,8 +13108,8 @@ var CheckDiffsUseCase = class {
13288
13108
  constructor(packmindGateway) {
13289
13109
  this.packmindGateway = packmindGateway;
13290
13110
  }
13291
- async execute(command33) {
13292
- const { groupedDiffs } = command33;
13111
+ async execute(command32) {
13112
+ const { groupedDiffs } = command32;
13293
13113
  const results = [];
13294
13114
  const validDiffs = [];
13295
13115
  const invalidDiffs = [];
@@ -13387,8 +13207,8 @@ var CliFormatter = class {
13387
13207
  static error(message) {
13388
13208
  return `${source_default.bgRed.bold(CLI_PREFIX2)} ${source_default.red(message)}`;
13389
13209
  }
13390
- static command(command33) {
13391
- return source_default.yellow(command33);
13210
+ static command(command32) {
13211
+ return source_default.yellow(command32);
13392
13212
  }
13393
13213
  static loader(text) {
13394
13214
  return source_default.dim.italic(text);
@@ -13564,10 +13384,6 @@ var PackmindCliHexaFactory = class {
13564
13384
  logout: new LogoutUseCase(),
13565
13385
  whoami: new WhoamiUseCase(),
13566
13386
  checkCliVersion: new CheckCliVersionUseCase(),
13567
- setupMcp: new SetupMcpUseCase({
13568
- gateway: this.repositories.packmindGateway,
13569
- mcpConfigService: new McpConfigService()
13570
- }),
13571
13387
  listStandards: new ListStandardsUseCase(
13572
13388
  this.repositories.packmindGateway,
13573
13389
  this.services.spaceService
@@ -13598,14 +13414,14 @@ var PackmindCliHexaFactory = class {
13598
13414
  var origin8 = "PackmindCliHexa";
13599
13415
  var PackmindCliHexa = class {
13600
13416
  constructor(logger2 = new PackmindLogger(origin8)) {
13601
- this.notifyDistribution = async (command33) => {
13417
+ this.notifyDistribution = async (command32) => {
13602
13418
  return this.hexa.repositories.packmindGateway.deployment.notifyDistribution(
13603
- command33
13419
+ command32
13604
13420
  );
13605
13421
  };
13606
- this.notifyArtefactsDistribution = async (command33) => {
13422
+ this.notifyArtefactsDistribution = async (command32) => {
13607
13423
  return this.hexa.repositories.packmindGateway.deployment.notifyArtefactsDistribution(
13608
- command33
13424
+ command32
13609
13425
  );
13610
13426
  };
13611
13427
  this.logger = logger2;
@@ -13628,29 +13444,29 @@ var PackmindCliHexa = class {
13628
13444
  get output() {
13629
13445
  return this.hexa.repositories.output;
13630
13446
  }
13631
- async getGitRemoteUrl(command33) {
13632
- return this.hexa.useCases.getGitRemoteUrl.execute(command33);
13447
+ async getGitRemoteUrl(command32) {
13448
+ return this.hexa.useCases.getGitRemoteUrl.execute(command32);
13633
13449
  }
13634
- async listFilesInDirectory(command33) {
13635
- return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command33);
13450
+ async listFilesInDirectory(command32) {
13451
+ return this.hexa.useCases.listFilesInDirectoryUseCase.execute(command32);
13636
13452
  }
13637
- async lintFilesAgainstRule(command33) {
13638
- return this.hexa.useCases.lintFilesAgainstRule.execute(command33);
13453
+ async lintFilesAgainstRule(command32) {
13454
+ return this.hexa.useCases.lintFilesAgainstRule.execute(command32);
13639
13455
  }
13640
- async lintFilesFromConfig(command33) {
13641
- return this.hexa.useCases.lintFilesFromConfig.execute(command33);
13456
+ async lintFilesFromConfig(command32) {
13457
+ return this.hexa.useCases.lintFilesFromConfig.execute(command32);
13642
13458
  }
13643
- async installPackages(command33) {
13644
- return this.hexa.useCases.installPackages.execute(command33);
13459
+ async installPackages(command32) {
13460
+ return this.hexa.useCases.installPackages.execute(command32);
13645
13461
  }
13646
- async install(command33) {
13647
- return this.hexa.useCases.install.execute(command33);
13462
+ async install(command32) {
13463
+ return this.hexa.useCases.install.execute(command32);
13648
13464
  }
13649
- async uninstall(command33) {
13650
- return this.hexa.useCases.uninstall.execute(command33);
13465
+ async uninstall(command32) {
13466
+ return this.hexa.useCases.uninstall.execute(command32);
13651
13467
  }
13652
- async diffArtefacts(command33) {
13653
- return this.hexa.useCases.diffArtefacts.execute(command33);
13468
+ async diffArtefacts(command32) {
13469
+ return this.hexa.useCases.diffArtefacts.execute(command32);
13654
13470
  }
13655
13471
  async submitDiffs(groupedDiffs, message) {
13656
13472
  return this.hexa.useCases.submitDiffs.execute({ groupedDiffs, message });
@@ -13658,20 +13474,20 @@ var PackmindCliHexa = class {
13658
13474
  async checkDiffs(groupedDiffs) {
13659
13475
  return this.hexa.useCases.checkDiffs.execute({ groupedDiffs });
13660
13476
  }
13661
- async listPackages(command33) {
13662
- return this.hexa.useCases.listPackages.execute(command33);
13477
+ async listPackages(command32) {
13478
+ return this.hexa.useCases.listPackages.execute(command32);
13663
13479
  }
13664
- async getPackageBySlug(command33) {
13665
- return this.hexa.useCases.getPackageBySlug.execute(command33);
13480
+ async getPackageBySlug(command32) {
13481
+ return this.hexa.useCases.getPackageBySlug.execute(command32);
13666
13482
  }
13667
- async listStandards(command33) {
13668
- return this.hexa.useCases.listStandards.execute(command33);
13483
+ async listStandards(command32) {
13484
+ return this.hexa.useCases.listStandards.execute(command32);
13669
13485
  }
13670
- async listCommands(command33) {
13671
- return this.hexa.useCases.listCommands.execute(command33);
13486
+ async listCommands(command32) {
13487
+ return this.hexa.useCases.listCommands.execute(command32);
13672
13488
  }
13673
- async listSkills(command33) {
13674
- return this.hexa.useCases.listSkills.execute(command33);
13489
+ async listSkills(command32) {
13490
+ return this.hexa.useCases.listSkills.execute(command32);
13675
13491
  }
13676
13492
  async configExists(baseDirectory) {
13677
13493
  return await this.hexa.repositories.configFileRepository.configExists(
@@ -13758,20 +13574,17 @@ var PackmindCliHexa = class {
13758
13574
  directory
13759
13575
  );
13760
13576
  }
13761
- async login(command33) {
13762
- return this.hexa.useCases.login.execute(command33);
13577
+ async login(command32) {
13578
+ return this.hexa.useCases.login.execute(command32);
13763
13579
  }
13764
- async logout(command33) {
13765
- return this.hexa.useCases.logout.execute(command33);
13580
+ async logout(command32) {
13581
+ return this.hexa.useCases.logout.execute(command32);
13766
13582
  }
13767
- async whoami(command33) {
13768
- return this.hexa.useCases.whoami.execute(command33);
13583
+ async whoami(command32) {
13584
+ return this.hexa.useCases.whoami.execute(command32);
13769
13585
  }
13770
- async checkCliVersion(command33) {
13771
- return this.hexa.useCases.checkCliVersion.execute(command33);
13772
- }
13773
- async setupMcp(command33) {
13774
- return this.hexa.useCases.setupMcp.execute(command33);
13586
+ async checkCliVersion(command32) {
13587
+ return this.hexa.useCases.checkCliVersion.execute(command32);
13775
13588
  }
13776
13589
  getCurrentBranch(repoPath) {
13777
13590
  return this.hexa.services.gitRemoteUrlService.getCurrentBranch(repoPath).branch;
@@ -13779,11 +13592,11 @@ var PackmindCliHexa = class {
13779
13592
  getGitRemoteUrlFromPath(repoPath) {
13780
13593
  return this.hexa.services.gitRemoteUrlService.getGitRemoteUrl(repoPath).gitRemoteUrl;
13781
13594
  }
13782
- async uploadSkill(command33) {
13783
- return this.hexa.useCases.uploadSkill.execute(command33);
13595
+ async uploadSkill(command32) {
13596
+ return this.hexa.useCases.uploadSkill.execute(command32);
13784
13597
  }
13785
- async installDefaultSkills(command33) {
13786
- return this.hexa.useCases.installDefaultSkills.execute(command33);
13598
+ async installDefaultSkills(command32) {
13599
+ return this.hexa.useCases.installDefaultSkills.execute(command32);
13787
13600
  }
13788
13601
  getPackmindGateway() {
13789
13602
  return this.hexa.repositories.packmindGateway;
@@ -13912,26 +13725,26 @@ var pathModule = __toESM(require("path"));
13912
13725
 
13913
13726
  // apps/cli/src/application/services/PackmindIgnoreReader.ts
13914
13727
  var fs16 = __toESM(require("fs/promises"));
13915
- var path19 = __toESM(require("path"));
13728
+ var path18 = __toESM(require("path"));
13916
13729
  var IGNORE_FILENAME = ".packmindignore";
13917
13730
  var PackmindIgnoreReader = class {
13918
13731
  async readIgnorePatterns(startDirectory, stopDirectory) {
13919
13732
  const patterns = [];
13920
- const normalizedStart = path19.resolve(startDirectory);
13921
- const normalizedStop = stopDirectory ? path19.resolve(stopDirectory) : null;
13733
+ const normalizedStart = path18.resolve(startDirectory);
13734
+ const normalizedStop = stopDirectory ? path18.resolve(stopDirectory) : null;
13922
13735
  if (normalizedStop === null) {
13923
- const ignoreFile = path19.join(normalizedStart, IGNORE_FILENAME);
13736
+ const ignoreFile = path18.join(normalizedStart, IGNORE_FILENAME);
13924
13737
  return this.parseIgnoreFile(ignoreFile);
13925
13738
  }
13926
13739
  let currentDir = normalizedStart;
13927
13740
  while (true) {
13928
- const ignoreFile = path19.join(currentDir, IGNORE_FILENAME);
13741
+ const ignoreFile = path18.join(currentDir, IGNORE_FILENAME);
13929
13742
  const filePatterns = await this.parseIgnoreFile(ignoreFile);
13930
13743
  patterns.push(...filePatterns);
13931
13744
  if (currentDir === normalizedStop) {
13932
13745
  break;
13933
13746
  }
13934
- const parentDir = path19.dirname(currentDir);
13747
+ const parentDir = path18.dirname(currentDir);
13935
13748
  if (parentDir === currentDir) {
13936
13749
  break;
13937
13750
  }
@@ -13963,7 +13776,7 @@ function isNotLoggedInError(error) {
13963
13776
  }
13964
13777
  async function lintHandler(args2, deps) {
13965
13778
  const {
13966
- path: path37,
13779
+ path: path35,
13967
13780
  draft,
13968
13781
  rule,
13969
13782
  language,
@@ -13985,7 +13798,7 @@ async function lintHandler(args2, deps) {
13985
13798
  throw new Error("option --rule is required to use --draft mode");
13986
13799
  }
13987
13800
  const startedAt = Date.now();
13988
- const targetPath = path37 ?? ".";
13801
+ const targetPath = path35 ?? ".";
13989
13802
  const absolutePath = resolvePath(targetPath);
13990
13803
  let stats;
13991
13804
  try {
@@ -14307,12 +14120,12 @@ function extractWasmFiles() {
14307
14120
 
14308
14121
  // apps/cli/src/main.ts
14309
14122
  var import_dotenv = require("dotenv");
14310
- var fs28 = __toESM(require("fs"));
14311
- var path36 = __toESM(require("path"));
14123
+ var fs26 = __toESM(require("fs"));
14124
+ var path34 = __toESM(require("path"));
14312
14125
 
14313
14126
  // apps/cli/src/infra/commands/InstallCommand.ts
14314
14127
  var import_cmd_ts2 = __toESM(require_cjs());
14315
- var path20 = __toESM(require("path"));
14128
+ var path19 = __toESM(require("path"));
14316
14129
  var fs18 = __toESM(require("fs"));
14317
14130
 
14318
14131
  // apps/cli/src/infra/commands/installPackagesHandler.ts
@@ -14401,8 +14214,8 @@ function findSubDirectoriesWithPackmindJson(dirPath, recursive) {
14401
14214
  }
14402
14215
  for (const entry of entries) {
14403
14216
  if (!entry.isDirectory()) continue;
14404
- const subDir = path20.join(dirPath, entry.name);
14405
- if (fs18.existsSync(path20.join(subDir, "packmind.json"))) {
14217
+ const subDir = path19.join(dirPath, entry.name);
14218
+ if (fs18.existsSync(path19.join(subDir, "packmind.json"))) {
14406
14219
  result.push(subDir);
14407
14220
  }
14408
14221
  if (recursive) {
@@ -14479,7 +14292,7 @@ async function notifyArtefactsDistributionIfInGitRepo(params) {
14479
14292
  try {
14480
14293
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(dir);
14481
14294
  if (!gitRoot) return;
14482
- const lockFilePath = path20.join(dir, "packmind-lock.json");
14295
+ const lockFilePath = path19.join(dir, "packmind-lock.json");
14483
14296
  const content = fs18.readFileSync(lockFilePath, "utf-8");
14484
14297
  const packmindLockFile = JSON.parse(content);
14485
14298
  const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
@@ -14533,7 +14346,8 @@ async function installHandler({
14533
14346
  packages,
14534
14347
  list,
14535
14348
  show,
14536
- status
14349
+ status,
14350
+ skipInstalledAt
14537
14351
  }) {
14538
14352
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
14539
14353
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
@@ -14559,7 +14373,7 @@ async function installHandler({
14559
14373
  logConsole(`Use ${formatCommand(showCommand)} instead.`);
14560
14374
  process.exit(1);
14561
14375
  }
14562
- const cwd = installPath ? path20.resolve(process.cwd(), installPath) : process.cwd();
14376
+ const cwd = installPath ? path19.resolve(process.cwd(), installPath) : process.cwd();
14563
14377
  if (installPath) {
14564
14378
  if (!fs18.existsSync(cwd)) {
14565
14379
  logErrorConsole(`Path does not exist: ${cwd}`);
@@ -14579,7 +14393,7 @@ async function installHandler({
14579
14393
  targetDirs = [cwd];
14580
14394
  } else {
14581
14395
  targetDirs = [];
14582
- if (fs18.existsSync(path20.join(cwd, "packmind.json"))) {
14396
+ if (fs18.existsSync(path19.join(cwd, "packmind.json"))) {
14583
14397
  targetDirs.push(cwd);
14584
14398
  }
14585
14399
  targetDirs.push(...findSubDirectoriesWithPackmindJson(cwd, true));
@@ -14594,7 +14408,8 @@ async function installHandler({
14594
14408
  try {
14595
14409
  const result = await packmindCliHexa.install({
14596
14410
  baseDirectory: dir,
14597
- packages: packages.length > 0 ? packages : void 0
14411
+ packages: packages.length > 0 ? packages : void 0,
14412
+ skipInstalledAt
14598
14413
  });
14599
14414
  results.push(result);
14600
14415
  await notifyArtefactsDistributionIfInGitRepo({
@@ -14660,6 +14475,10 @@ var installCommand = (0, import_cmd_ts2.command)({
14660
14475
  long: "show",
14661
14476
  description: "[Deprecated] Show details of a specific package",
14662
14477
  defaultValue: () => ""
14478
+ }),
14479
+ skipInstalledAt: (0, import_cmd_ts2.flag)({
14480
+ long: "skip-installed-at",
14481
+ description: "Omit the installedAt timestamp from the packmind-lock.json file"
14663
14482
  })
14664
14483
  },
14665
14484
  handler: installHandler
@@ -14908,266 +14727,18 @@ Credentials are loaded from (in order of priority):`);
14908
14727
  }
14909
14728
  });
14910
14729
 
14911
- // apps/cli/src/infra/commands/SetupMcpCommand.ts
14912
- var import_cmd_ts7 = __toESM(require_cjs());
14913
- var fs20 = __toESM(require("fs"));
14914
- var readline2 = __toESM(require("readline"));
14915
- var inquirer = __toESM(require("inquirer"));
14916
-
14917
- // apps/cli/src/application/services/AgentDetectionService.ts
14918
- var fs19 = __toESM(require("fs"));
14919
- var path21 = __toESM(require("path"));
14920
- var os4 = __toESM(require("os"));
14921
- var import_child_process4 = require("child_process");
14922
- var AgentDetectionService = class {
14923
- constructor(projectDir = process.cwd()) {
14924
- this.projectDir = projectDir;
14925
- }
14926
- detectAgents() {
14927
- const agents = [];
14928
- if (this.isClaudeAvailable()) {
14929
- agents.push({ type: "claude", name: "Claude Code" });
14930
- }
14931
- if (this.isCursorAvailable()) {
14932
- agents.push({ type: "cursor", name: "Cursor" });
14933
- }
14934
- if (this.isVSCodeAvailable()) {
14935
- agents.push({ type: "vscode", name: "VS Code" });
14936
- }
14937
- if (this.isContinueAvailable()) {
14938
- agents.push({ type: "continue", name: "Continue.dev" });
14939
- }
14940
- return agents;
14941
- }
14942
- isClaudeAvailable() {
14943
- return this.isCommandAvailable("claude");
14944
- }
14945
- isCursorAvailable() {
14946
- const cursorConfigDir = path21.join(os4.homedir(), ".cursor");
14947
- return fs19.existsSync(cursorConfigDir);
14948
- }
14949
- isVSCodeAvailable() {
14950
- const vscodeDir = path21.join(this.projectDir, ".vscode");
14951
- return fs19.existsSync(vscodeDir);
14952
- }
14953
- isContinueAvailable() {
14954
- const continueDir = path21.join(this.projectDir, ".continue");
14955
- return fs19.existsSync(continueDir);
14956
- }
14957
- isCommandAvailable(command33) {
14958
- try {
14959
- const whichCommand = process.platform === "win32" ? "where" : "which";
14960
- (0, import_child_process4.execSync)(`${whichCommand} ${command33}`, { stdio: "pipe" });
14961
- return true;
14962
- } catch {
14963
- return false;
14964
- }
14965
- }
14966
- };
14967
-
14968
- // apps/cli/src/infra/commands/customParameters/AgentArgType.ts
14969
- var VALID_AGENTS = Object.keys(CodingAgents).filter(
14970
- (a) => a !== "packmind"
14971
- );
14972
- var agentArgToType = {
14973
- copilot: "vscode",
14974
- cursor: "cursor",
14975
- claude: "claude",
14976
- continue: "continue"
14977
- };
14978
- var AgentArgType = {
14979
- from: async (input) => {
14980
- const normalized = input.toLowerCase();
14981
- if (VALID_AGENTS.includes(normalized)) {
14982
- return normalized;
14983
- }
14984
- throw new Error(
14985
- `Invalid agent '${input}'. Valid options are: ${VALID_AGENTS.join(", ")}`
14986
- );
14987
- }
14988
- };
14989
-
14990
- // apps/cli/src/infra/commands/SetupMcpCommand.ts
14991
- var ALL_AGENTS2 = [
14992
- { type: "claude", name: "Claude Code" },
14993
- { type: "cursor", name: "Cursor" },
14994
- { type: "vscode", name: "VS Code" },
14995
- { type: "continue", name: "Continue.dev" }
14996
- ];
14997
- async function promptAgentsWithReadline(choices) {
14998
- const input = fs20.createReadStream("/dev/tty");
14999
- const output = fs20.createWriteStream("/dev/tty");
15000
- const rl = readline2.createInterface({
15001
- input,
15002
- output
15003
- });
15004
- output.write("Select agents to configure:\n");
15005
- choices.forEach((choice, index) => {
15006
- const marker = choice.checked ? "*" : " ";
15007
- output.write(` ${index + 1}. [${marker}] ${choice.name}
15008
- `);
15009
- });
15010
- output.write("\n");
15011
- const preselected = choices.map((c, i) => c.checked ? i + 1 : null).filter((i) => i !== null);
15012
- const defaultValue = preselected.length > 0 ? preselected.join(",") : "1,2,3";
15013
- return new Promise((resolve15) => {
15014
- rl.question(
15015
- `Enter numbers separated by commas (default: ${defaultValue}): `,
15016
- (answer) => {
15017
- rl.close();
15018
- input.destroy();
15019
- output.destroy();
15020
- const trimmed = answer.trim();
15021
- const numbersStr = trimmed === "" ? defaultValue : trimmed;
15022
- const numbers = numbersStr.split(",").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n) && n >= 1 && n <= choices.length);
15023
- const selectedAgents = numbers.map((n) => choices[n - 1].value);
15024
- resolve15(selectedAgents);
15025
- }
15026
- );
15027
- });
15028
- }
15029
- var setupMcpCommand = (0, import_cmd_ts7.command)({
15030
- name: "setup-mcp",
15031
- description: "Configure MCP (Model Context Protocol) for AI coding agents",
15032
- args: {
15033
- targets: (0, import_cmd_ts7.multioption)({
15034
- type: (0, import_cmd_ts7.array)(AgentArgType),
15035
- long: "target",
15036
- short: "t",
15037
- description: "Target agent(s) to configure (copilot, cursor, claude, or continue). Can be specified multiple times. If omitted, interactive mode is used."
15038
- })
15039
- },
15040
- handler: async ({ targets }) => {
15041
- const credentials = loadCredentials();
15042
- if (!credentials) {
15043
- logErrorConsole("Not authenticated");
15044
- logConsole("\nNo credentials found. You can authenticate by either:");
15045
- logConsole(" 1. Running `packmind-cli login`");
15046
- logConsole(" 2. Setting PACKMIND_API_KEY_V3 environment variable");
15047
- logConsole(`
15048
- Credentials are loaded from (in order of priority):`);
15049
- logConsole(` 1. PACKMIND_API_KEY_V3 environment variable`);
15050
- logConsole(` 2. ${getCredentialsPath()}`);
15051
- process.exit(1);
15052
- }
15053
- if (credentials.isExpired) {
15054
- logErrorConsole("Credentials expired");
15055
- logConsole("\nRun `packmind-cli login` to re-authenticate.");
15056
- process.exit(1);
15057
- }
15058
- const agentDetectionService = new AgentDetectionService();
15059
- let selectedAgents;
15060
- if (targets.length > 0) {
15061
- selectedAgents = targets.map((t) => agentArgToType[t]).filter((a) => a !== void 0);
15062
- } else {
15063
- logConsole("\nDetecting installed AI agents...\n");
15064
- const detectedAgents = agentDetectionService.detectAgents();
15065
- if (detectedAgents.length > 0) {
15066
- logConsole("Found agents:");
15067
- detectedAgents.forEach((detectedAgent) => {
15068
- logConsole(` - ${detectedAgent.name}`);
15069
- });
15070
- logConsole("");
15071
- } else {
15072
- logConsole("No supported agents detected.\n");
15073
- }
15074
- const detectedTypes = new Set(detectedAgents.map((a) => a.type));
15075
- const choices = ALL_AGENTS2.map((agentInfo) => ({
15076
- name: agentInfo.name,
15077
- value: agentInfo.type,
15078
- checked: detectedTypes.has(agentInfo.type)
15079
- }));
15080
- let promptedAgents;
15081
- const useSimplePrompt = process.env.PACKMIND_SIMPLE_PROMPT === "1" || !process.stdin.isTTY;
15082
- if (useSimplePrompt) {
15083
- promptedAgents = await promptAgentsWithReadline(choices);
15084
- } else {
15085
- const result2 = await inquirer.default.prompt([
15086
- {
15087
- type: "checkbox",
15088
- name: "selectedAgents",
15089
- message: "Select agents to configure (use space to select):",
15090
- choices
15091
- }
15092
- ]);
15093
- promptedAgents = result2.selectedAgents;
15094
- }
15095
- if (promptedAgents.length === 0) {
15096
- logConsole("\nNo agents selected. Exiting.");
15097
- process.exit(0);
15098
- }
15099
- selectedAgents = promptedAgents;
15100
- }
15101
- logConsole("\nFetching MCP configuration...\n");
15102
- const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
15103
- const packmindCliHexa = new PackmindCliHexa(packmindLogger);
15104
- let result;
15105
- try {
15106
- result = await packmindCliHexa.setupMcp({ agentTypes: selectedAgents });
15107
- } catch (error) {
15108
- logErrorConsole("Failed to fetch MCP configuration from server.");
15109
- if (error instanceof Error) {
15110
- logConsole(` ${error.message}`);
15111
- }
15112
- process.exit(1);
15113
- }
15114
- let successCount = 0;
15115
- const failedAgents = [];
15116
- for (const agentResult of result.results) {
15117
- logConsole(`Installing MCP for ${agentResult.agentName}...`);
15118
- if (agentResult.success) {
15119
- logSuccessConsole(` ${agentResult.agentName} configured successfully`);
15120
- successCount++;
15121
- } else {
15122
- logErrorConsole(` Failed to configure ${agentResult.agentName}`);
15123
- failedAgents.push({
15124
- name: agentResult.agentName,
15125
- error: agentResult.error || ""
15126
- });
15127
- }
15128
- }
15129
- logConsole("");
15130
- if (failedAgents.length > 0) {
15131
- for (const failed of failedAgents) {
15132
- logWarningConsole(`Failed to configure ${failed.name}:`);
15133
- logConsole(`
15134
- Error: ${failed.error}`);
15135
- if (failed.error.includes("ENOENT") || failed.error.includes("not found") || failed.error.includes("command not found")) {
15136
- logConsole(
15137
- `
15138
- Hint: Make sure the agent CLI is installed and available in your PATH.`
15139
- );
15140
- }
15141
- logConsole(`
15142
- Manual configuration:`);
15143
- logConsole(result.manualConfigJson ?? "undefined");
15144
- logConsole("");
15145
- }
15146
- }
15147
- if (successCount > 0) {
15148
- const agentWord = successCount === 1 ? "agent" : "agents";
15149
- logConsole(
15150
- formatBold(`Done! MCP configured for ${successCount} ${agentWord}.`)
15151
- );
15152
- }
15153
- if (failedAgents.length > 0) {
15154
- process.exit(1);
15155
- }
15156
- }
15157
- });
15158
-
15159
14730
  // apps/cli/src/infra/commands/SkillsCommand.ts
15160
- var import_cmd_ts12 = __toESM(require_cjs());
14731
+ var import_cmd_ts11 = __toESM(require_cjs());
15161
14732
 
15162
14733
  // apps/cli/src/infra/commands/skills/AddSkillCommand.ts
15163
- var import_cmd_ts9 = __toESM(require_cjs());
14734
+ var import_cmd_ts8 = __toESM(require_cjs());
15164
14735
 
15165
14736
  // apps/cli/src/infra/commands/sharedOptions.ts
15166
- var import_cmd_ts8 = __toESM(require_cjs());
15167
- var originSkillOption = (0, import_cmd_ts8.option)({
14737
+ var import_cmd_ts7 = __toESM(require_cjs());
14738
+ var originSkillOption = (0, import_cmd_ts7.option)({
15168
14739
  long: "origin-skill",
15169
14740
  description: "Name of the skill that triggered this command",
15170
- type: (0, import_cmd_ts8.optional)(import_cmd_ts8.string)
14741
+ type: (0, import_cmd_ts7.optional)(import_cmd_ts7.string)
15171
14742
  });
15172
14743
 
15173
14744
  // apps/cli/src/infra/commands/customParameters/SpaceSlug.ts
@@ -15178,19 +14749,19 @@ var SpaceSlug = {
15178
14749
  };
15179
14750
 
15180
14751
  // apps/cli/src/infra/commands/skills/AddSkillCommand.ts
15181
- var addSkillCommand = (0, import_cmd_ts9.command)({
14752
+ var addSkillCommand = (0, import_cmd_ts8.command)({
15182
14753
  name: "add",
15183
14754
  description: "[Deprecated] Add a skill from a local directory to a Packmind organization",
15184
14755
  args: {
15185
- skillPath: (0, import_cmd_ts9.positional)({
15186
- type: import_cmd_ts9.string,
14756
+ skillPath: (0, import_cmd_ts8.positional)({
14757
+ type: import_cmd_ts8.string,
15187
14758
  displayName: "path",
15188
14759
  description: "Path to skill directory containing SKILL.md"
15189
14760
  }),
15190
- space: (0, import_cmd_ts9.option)({
14761
+ space: (0, import_cmd_ts8.option)({
15191
14762
  long: "space",
15192
14763
  description: "Slug of the space in which to add the skill (with or without leading @)",
15193
- type: (0, import_cmd_ts9.optional)(SpaceSlug)
14764
+ type: (0, import_cmd_ts8.optional)(SpaceSlug)
15194
14765
  }),
15195
14766
  originSkill: originSkillOption
15196
14767
  },
@@ -15209,12 +14780,12 @@ var addSkillCommand = (0, import_cmd_ts9.command)({
15209
14780
  });
15210
14781
 
15211
14782
  // apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
15212
- var import_cmd_ts10 = __toESM(require_cjs());
15213
- var readline3 = __toESM(require("readline"));
14783
+ var import_cmd_ts9 = __toESM(require_cjs());
14784
+ var readline2 = __toESM(require("readline"));
15214
14785
 
15215
14786
  // apps/cli/src/infra/commands/skills/incompatibleSkillsHandler.ts
15216
- var fs21 = __toESM(require("fs/promises"));
15217
- var path22 = __toESM(require("path"));
14787
+ var fs19 = __toESM(require("fs/promises"));
14788
+ var path20 = __toESM(require("path"));
15218
14789
  async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm) {
15219
14790
  const skillNames = skills.map((s) => s.skillName).join(", ");
15220
14791
  logWarningConsole(
@@ -15227,10 +14798,10 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
15227
14798
  return;
15228
14799
  }
15229
14800
  for (const skill of skills) {
15230
- const skillRootDirs = skill.filePaths.filter((p) => path22.basename(p) === "SKILL.md").map((p) => path22.dirname(p));
14801
+ const skillRootDirs = skill.filePaths.filter((p) => path20.basename(p) === "SKILL.md").map((p) => path20.dirname(p));
15231
14802
  for (const dir of skillRootDirs) {
15232
14803
  try {
15233
- await fs21.rm(path22.join(baseDirectory, dir), {
14804
+ await fs19.rm(path20.join(baseDirectory, dir), {
15234
14805
  recursive: true,
15235
14806
  force: true
15236
14807
  });
@@ -15243,7 +14814,7 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
15243
14814
  for (const relativePath of skill.filePaths) {
15244
14815
  if (!skillRootDirs.some((dir) => relativePath.startsWith(dir + "/"))) {
15245
14816
  try {
15246
- await fs21.unlink(path22.join(baseDirectory, relativePath));
14817
+ await fs19.unlink(path20.join(baseDirectory, relativePath));
15247
14818
  } catch (error) {
15248
14819
  logErrorConsole(
15249
14820
  `Failed to delete "${relativePath}": ${error instanceof Error ? error.message : String(error)}`
@@ -15257,11 +14828,11 @@ async function handleIncompatibleInstalledSkills(skills, baseDirectory, confirm)
15257
14828
 
15258
14829
  // apps/cli/src/infra/commands/skills/InstallDefaultSkillsCommand.ts
15259
14830
  var { version: CLI_VERSION3 } = require_package();
15260
- var installDefaultSkillsCommand = (0, import_cmd_ts10.command)({
14831
+ var installDefaultSkillsCommand = (0, import_cmd_ts9.command)({
15261
14832
  name: "install-default",
15262
14833
  description: "Install default Packmind skills for configured coding agents",
15263
14834
  args: {
15264
- includeBeta: (0, import_cmd_ts10.flag)({
14835
+ includeBeta: (0, import_cmd_ts9.flag)({
15265
14836
  long: "include-beta",
15266
14837
  description: "Include unreleased/beta skills"
15267
14838
  })
@@ -15324,7 +14895,7 @@ async function handleIncompatibleInstalledSkillsWithPrompt(skills, baseDirectory
15324
14895
  );
15325
14896
  }
15326
14897
  async function promptConfirmation(question) {
15327
- const rl = readline3.createInterface({
14898
+ const rl = readline2.createInterface({
15328
14899
  input: process.stdin,
15329
14900
  output: process.stdout
15330
14901
  });
@@ -15337,7 +14908,7 @@ async function promptConfirmation(question) {
15337
14908
  }
15338
14909
 
15339
14910
  // apps/cli/src/infra/commands/ListSkillsCommand.ts
15340
- var import_cmd_ts11 = __toESM(require_cjs());
14911
+ var import_cmd_ts10 = __toESM(require_cjs());
15341
14912
 
15342
14913
  // apps/cli/src/infra/utils/spaceFilterUtils.ts
15343
14914
  function resolveSpaceFromArgs(spaceArg, spaces) {
@@ -15433,12 +15004,12 @@ ${availableSpaces}`
15433
15004
  }
15434
15005
 
15435
15006
  // apps/cli/src/infra/commands/ListSkillsCommand.ts
15436
- var listSkillsCommand = (0, import_cmd_ts11.command)({
15007
+ var listSkillsCommand = (0, import_cmd_ts10.command)({
15437
15008
  name: "list",
15438
15009
  description: "List available skills",
15439
15010
  args: {
15440
- space: (0, import_cmd_ts11.option)({
15441
- type: (0, import_cmd_ts11.optional)(SpaceSlug),
15011
+ space: (0, import_cmd_ts10.option)({
15012
+ type: (0, import_cmd_ts10.optional)(SpaceSlug),
15442
15013
  long: "space",
15443
15014
  description: "Filter skills by space slug"
15444
15015
  })
@@ -15457,7 +15028,7 @@ var listSkillsCommand = (0, import_cmd_ts11.command)({
15457
15028
  });
15458
15029
 
15459
15030
  // apps/cli/src/infra/commands/SkillsCommand.ts
15460
- var skillsCommand = (0, import_cmd_ts12.subcommands)({
15031
+ var skillsCommand = (0, import_cmd_ts11.subcommands)({
15461
15032
  name: "skills",
15462
15033
  description: "Manage skills in your Packmind organization",
15463
15034
  cmds: {
@@ -15468,23 +15039,23 @@ var skillsCommand = (0, import_cmd_ts12.subcommands)({
15468
15039
  });
15469
15040
 
15470
15041
  // apps/cli/src/infra/commands/StandardsCommand.ts
15471
- var import_cmd_ts15 = __toESM(require_cjs());
15042
+ var import_cmd_ts14 = __toESM(require_cjs());
15472
15043
 
15473
15044
  // apps/cli/src/infra/commands/CreateStandardCommand.ts
15474
- var import_cmd_ts13 = __toESM(require_cjs());
15475
- var createStandardCommand = (0, import_cmd_ts13.command)({
15045
+ var import_cmd_ts12 = __toESM(require_cjs());
15046
+ var createStandardCommand = (0, import_cmd_ts12.command)({
15476
15047
  name: "create",
15477
15048
  description: "[Deprecated] Create a coding standard from a playbook JSON file or stdin",
15478
15049
  args: {
15479
- file: (0, import_cmd_ts13.positional)({
15050
+ file: (0, import_cmd_ts12.positional)({
15480
15051
  displayName: "file",
15481
15052
  description: "Path to the playbook JSON file (reads from stdin if omitted)",
15482
- type: (0, import_cmd_ts13.optional)(import_cmd_ts13.string)
15053
+ type: (0, import_cmd_ts12.optional)(import_cmd_ts12.string)
15483
15054
  }),
15484
- space: (0, import_cmd_ts13.option)({
15055
+ space: (0, import_cmd_ts12.option)({
15485
15056
  long: "space",
15486
15057
  description: "Slug of the space in which to create the standard (with or without leading @)",
15487
- type: (0, import_cmd_ts13.optional)(SpaceSlug)
15058
+ type: (0, import_cmd_ts12.optional)(SpaceSlug)
15488
15059
  }),
15489
15060
  originSkill: originSkillOption
15490
15061
  },
@@ -15503,7 +15074,7 @@ var createStandardCommand = (0, import_cmd_ts13.command)({
15503
15074
  });
15504
15075
 
15505
15076
  // apps/cli/src/infra/commands/ListStandardsCommand.ts
15506
- var import_cmd_ts14 = __toESM(require_cjs());
15077
+ var import_cmd_ts13 = __toESM(require_cjs());
15507
15078
 
15508
15079
  // apps/cli/src/infra/commands/standards/listStandardsHandler.ts
15509
15080
  async function listStandardsHandler(args2, deps) {
@@ -15560,12 +15131,12 @@ ${availableSpaces}`
15560
15131
  }
15561
15132
 
15562
15133
  // apps/cli/src/infra/commands/ListStandardsCommand.ts
15563
- var listStandardsCommand = (0, import_cmd_ts14.command)({
15134
+ var listStandardsCommand = (0, import_cmd_ts13.command)({
15564
15135
  name: "list",
15565
15136
  description: "List available coding standards",
15566
15137
  args: {
15567
- space: (0, import_cmd_ts14.option)({
15568
- type: (0, import_cmd_ts14.optional)(SpaceSlug),
15138
+ space: (0, import_cmd_ts13.option)({
15139
+ type: (0, import_cmd_ts13.optional)(SpaceSlug),
15569
15140
  long: "space",
15570
15141
  description: "Filter standards by space slug"
15571
15142
  })
@@ -15584,7 +15155,7 @@ var listStandardsCommand = (0, import_cmd_ts14.command)({
15584
15155
  });
15585
15156
 
15586
15157
  // apps/cli/src/infra/commands/StandardsCommand.ts
15587
- var standardsCommand = (0, import_cmd_ts15.subcommands)({
15158
+ var standardsCommand = (0, import_cmd_ts14.subcommands)({
15588
15159
  name: "standards",
15589
15160
  description: "Manage coding standards",
15590
15161
  cmds: {
@@ -15594,23 +15165,23 @@ var standardsCommand = (0, import_cmd_ts15.subcommands)({
15594
15165
  });
15595
15166
 
15596
15167
  // apps/cli/src/infra/commands/CommandsCommand.ts
15597
- var import_cmd_ts18 = __toESM(require_cjs());
15168
+ var import_cmd_ts17 = __toESM(require_cjs());
15598
15169
 
15599
15170
  // apps/cli/src/infra/commands/CreateCommandCommand.ts
15600
- var import_cmd_ts16 = __toESM(require_cjs());
15601
- var createCommandCommand = (0, import_cmd_ts16.command)({
15171
+ var import_cmd_ts15 = __toESM(require_cjs());
15172
+ var createCommandCommand = (0, import_cmd_ts15.command)({
15602
15173
  name: "create",
15603
15174
  description: "[Deprecated] Create a command from a playbook JSON file or stdin",
15604
15175
  args: {
15605
- file: (0, import_cmd_ts16.positional)({
15176
+ file: (0, import_cmd_ts15.positional)({
15606
15177
  displayName: "file",
15607
15178
  description: "Path to the command playbook JSON file (reads from stdin if omitted)",
15608
- type: (0, import_cmd_ts16.optional)(import_cmd_ts16.string)
15179
+ type: (0, import_cmd_ts15.optional)(import_cmd_ts15.string)
15609
15180
  }),
15610
- space: (0, import_cmd_ts16.option)({
15181
+ space: (0, import_cmd_ts15.option)({
15611
15182
  long: "space",
15612
15183
  description: "Slug of the space in which to create the command",
15613
- type: (0, import_cmd_ts16.optional)(SpaceSlug)
15184
+ type: (0, import_cmd_ts15.optional)(SpaceSlug)
15614
15185
  }),
15615
15186
  originSkill: originSkillOption
15616
15187
  },
@@ -15629,7 +15200,7 @@ var createCommandCommand = (0, import_cmd_ts16.command)({
15629
15200
  });
15630
15201
 
15631
15202
  // apps/cli/src/infra/commands/ListCommandsCommand.ts
15632
- var import_cmd_ts17 = __toESM(require_cjs());
15203
+ var import_cmd_ts16 = __toESM(require_cjs());
15633
15204
 
15634
15205
  // apps/cli/src/infra/commands/commands/listCommandsHandler.ts
15635
15206
  async function listCommandsHandler(args2, deps) {
@@ -15685,12 +15256,12 @@ ${availableSpaces}`
15685
15256
  }
15686
15257
 
15687
15258
  // apps/cli/src/infra/commands/ListCommandsCommand.ts
15688
- var listCommandsCommand = (0, import_cmd_ts17.command)({
15259
+ var listCommandsCommand = (0, import_cmd_ts16.command)({
15689
15260
  name: "list",
15690
15261
  description: "List available commands",
15691
15262
  args: {
15692
- space: (0, import_cmd_ts17.option)({
15693
- type: (0, import_cmd_ts17.optional)(SpaceSlug),
15263
+ space: (0, import_cmd_ts16.option)({
15264
+ type: (0, import_cmd_ts16.optional)(SpaceSlug),
15694
15265
  long: "space",
15695
15266
  description: "Filter commands by space slug"
15696
15267
  })
@@ -15707,7 +15278,7 @@ var listCommandsCommand = (0, import_cmd_ts17.command)({
15707
15278
  });
15708
15279
 
15709
15280
  // apps/cli/src/infra/commands/CommandsCommand.ts
15710
- var commandsCommand = (0, import_cmd_ts18.subcommands)({
15281
+ var commandsCommand = (0, import_cmd_ts17.subcommands)({
15711
15282
  name: "commands",
15712
15283
  description: "Manage commands",
15713
15284
  cmds: {
@@ -15717,11 +15288,11 @@ var commandsCommand = (0, import_cmd_ts18.subcommands)({
15717
15288
  });
15718
15289
 
15719
15290
  // apps/cli/src/infra/commands/DiffCommand.ts
15720
- var import_cmd_ts19 = __toESM(require_cjs());
15291
+ var import_cmd_ts18 = __toESM(require_cjs());
15721
15292
 
15722
15293
  // apps/cli/src/infra/commands/playbook/diffArtefactsHandler.ts
15723
15294
  var nodePath = __toESM(require("path"));
15724
- var fs22 = __toESM(require("fs/promises"));
15295
+ var fs20 = __toESM(require("fs/promises"));
15725
15296
 
15726
15297
  // apps/cli/src/infra/utils/diffFormatter.ts
15727
15298
  var import_diff4 = require("diff");
@@ -16020,7 +15591,7 @@ async function diffArtefactsHandler(deps) {
16020
15591
  const searchPath = nodePath.resolve(cwd, deps.path ?? ".");
16021
15592
  if (deps.path !== void 0) {
16022
15593
  try {
16023
- await fs22.stat(searchPath);
15594
+ await fs20.stat(searchPath);
16024
15595
  } catch {
16025
15596
  logErrorConsole(`Path does not exist: ${searchPath}`);
16026
15597
  exit(1);
@@ -16150,37 +15721,37 @@ async function diffArtefactsHandler(deps) {
16150
15721
  }
16151
15722
 
16152
15723
  // apps/cli/src/infra/commands/DiffCommand.ts
16153
- var diffCommand = (0, import_cmd_ts19.command)({
15724
+ var diffCommand = (0, import_cmd_ts18.command)({
16154
15725
  name: "diff",
16155
15726
  description: "[Deprecated] Use `playbook diff` commands instead. Run for migration guidance",
16156
15727
  args: {
16157
- submit: (0, import_cmd_ts19.flag)({
15728
+ submit: (0, import_cmd_ts18.flag)({
16158
15729
  long: "submit",
16159
15730
  description: "Submit detected changes as change proposals"
16160
15731
  }),
16161
- includeSubmitted: (0, import_cmd_ts19.flag)({
15732
+ includeSubmitted: (0, import_cmd_ts18.flag)({
16162
15733
  long: "include-submitted",
16163
15734
  description: "Include already submitted changes in the output"
16164
15735
  }),
16165
- message: (0, import_cmd_ts19.option)({
15736
+ message: (0, import_cmd_ts18.option)({
16166
15737
  long: "message",
16167
15738
  short: "m",
16168
15739
  description: "Message describing the intent behind the changes (max 1024 chars)",
16169
- type: (0, import_cmd_ts19.optional)(import_cmd_ts19.string)
15740
+ type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
16170
15741
  }),
16171
- path: (0, import_cmd_ts19.option)({
15742
+ path: (0, import_cmd_ts18.option)({
16172
15743
  long: "path",
16173
15744
  short: "p",
16174
15745
  description: "Path to analyze (relative to current directory)",
16175
- type: (0, import_cmd_ts19.optional)(import_cmd_ts19.string)
15746
+ type: (0, import_cmd_ts18.optional)(import_cmd_ts18.string)
16176
15747
  }),
16177
- positionals: (0, import_cmd_ts19.restPositionals)({
16178
- type: import_cmd_ts19.string,
15748
+ positionals: (0, import_cmd_ts18.restPositionals)({
15749
+ type: import_cmd_ts18.string,
16179
15750
  displayName: "args",
16180
15751
  description: "Subcommand and arguments (e.g., add <path>, remove <path>)"
16181
15752
  })
16182
15753
  },
16183
- handler: async ({ submit, includeSubmitted, message, path: path37, positionals }) => {
15754
+ handler: async ({ submit, includeSubmitted, message, path: path35, positionals }) => {
16184
15755
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
16185
15756
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
16186
15757
  if (submit) {
@@ -16196,7 +15767,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
16196
15767
  process.exit(1);
16197
15768
  }
16198
15769
  if (positionals[0] === "add") {
16199
- const addFilePath = path37 && positionals[1] ? `${path37}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
15770
+ const addFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
16200
15771
  const addCommand = `packmind-cli playbook add ${addFilePath}`;
16201
15772
  logErrorConsole("Deprecated: `packmind-cli diff add` has been removed");
16202
15773
  logInfoConsole("Use the following command instead:");
@@ -16204,7 +15775,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
16204
15775
  process.exit(1);
16205
15776
  }
16206
15777
  if (positionals[0] === "remove" || positionals[0] === "rm") {
16207
- const removeFilePath = path37 && positionals[1] ? `${path37}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
15778
+ const removeFilePath = path35 && positionals[1] ? `${path35}/${positionals[1]}`.replace(/\/+/g, "/") : positionals[1];
16208
15779
  const removeCommand = `packmind-cli playbook remove ${removeFilePath}`;
16209
15780
  logErrorConsole(
16210
15781
  "Deprecated: `packmind-cli diff remove` has been removed"
@@ -16213,7 +15784,7 @@ var diffCommand = (0, import_cmd_ts19.command)({
16213
15784
  logInfoConsole(` ${formatCommand(removeCommand)}`);
16214
15785
  process.exit(1);
16215
15786
  }
16216
- const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${path37 ? ` --path ${path37}` : ""}`;
15787
+ const diffCommand3 = `packmind-cli playbook diff${includeSubmitted ? " --include-submitted" : ""}${path35 ? ` --path ${path35}` : ""}`;
16217
15788
  logErrorConsole("Deprecated: `packmind-cli diff` will be removed");
16218
15789
  logInfoConsole("Use the following command instead:");
16219
15790
  logInfoConsole(` ${formatCommand(diffCommand3)}`);
@@ -16223,16 +15794,16 @@ var diffCommand = (0, import_cmd_ts19.command)({
16223
15794
  getCwd: () => process.cwd(),
16224
15795
  log: console.log,
16225
15796
  includeSubmitted,
16226
- path: path37
15797
+ path: path35
16227
15798
  });
16228
15799
  }
16229
15800
  });
16230
15801
 
16231
15802
  // apps/cli/src/infra/commands/PackagesCommand.ts
16232
- var import_cmd_ts24 = __toESM(require_cjs());
15803
+ var import_cmd_ts23 = __toESM(require_cjs());
16233
15804
 
16234
15805
  // apps/cli/src/infra/commands/CreatePackageCommand.ts
16235
- var import_cmd_ts20 = __toESM(require_cjs());
15806
+ var import_cmd_ts19 = __toESM(require_cjs());
16236
15807
 
16237
15808
  // apps/cli/src/infra/commands/packages/createPackageHandler.ts
16238
15809
  function toExpectedSlug(name) {
@@ -16289,15 +15860,15 @@ var CreatePackageUseCase = class {
16289
15860
  this.gateway = gateway;
16290
15861
  this.spaceService = spaceService;
16291
15862
  }
16292
- async execute(command33) {
16293
- const space = await this.getSpace(command33);
15863
+ async execute(command32) {
15864
+ const space = await this.getSpace(command32);
16294
15865
  const result = await this.gateway.packages.create({
16295
15866
  spaceId: space.id,
16296
- name: command33.name,
16297
- description: command33.description ?? "",
15867
+ name: command32.name,
15868
+ description: command32.description ?? "",
16298
15869
  recipeIds: [],
16299
15870
  standardIds: [],
16300
- originSkill: command33.originSkill
15871
+ originSkill: command32.originSkill
16301
15872
  });
16302
15873
  return {
16303
15874
  packageId: result.package.id,
@@ -16306,12 +15877,12 @@ var CreatePackageUseCase = class {
16306
15877
  spaceSlug: space.slug
16307
15878
  };
16308
15879
  }
16309
- async getSpace(command33) {
15880
+ async getSpace(command32) {
16310
15881
  const spaces = await this.spaceService.getSpaces();
16311
- if (command33.spaceSlug) {
16312
- const found = spaces.find((s) => s.slug === command33.spaceSlug);
15882
+ if (command32.spaceSlug) {
15883
+ const found = spaces.find((s) => s.slug === command32.spaceSlug);
16313
15884
  if (!found) {
16314
- throw new Error(`Space '${command33.spaceSlug}' not found.`);
15885
+ throw new Error(`Space '${command32.spaceSlug}' not found.`);
16315
15886
  }
16316
15887
  return found;
16317
15888
  }
@@ -16329,25 +15900,25 @@ ${spaceList}`
16329
15900
  };
16330
15901
 
16331
15902
  // apps/cli/src/infra/commands/CreatePackageCommand.ts
16332
- var createPackageCommand = (0, import_cmd_ts20.command)({
15903
+ var createPackageCommand = (0, import_cmd_ts19.command)({
16333
15904
  name: "create",
16334
15905
  description: "Create a new package",
16335
15906
  args: {
16336
- name: (0, import_cmd_ts20.positional)({
15907
+ name: (0, import_cmd_ts19.positional)({
16337
15908
  displayName: "name",
16338
15909
  description: "Name of the package to create",
16339
- type: import_cmd_ts20.string
15910
+ type: import_cmd_ts19.string
16340
15911
  }),
16341
- description: (0, import_cmd_ts20.option)({
15912
+ description: (0, import_cmd_ts19.option)({
16342
15913
  long: "description",
16343
15914
  short: "d",
16344
15915
  description: "Description of the package (optional)",
16345
- type: (0, import_cmd_ts20.optional)(import_cmd_ts20.string)
15916
+ type: (0, import_cmd_ts19.optional)(import_cmd_ts19.string)
16346
15917
  }),
16347
- space: (0, import_cmd_ts20.option)({
15918
+ space: (0, import_cmd_ts19.option)({
16348
15919
  long: "space",
16349
15920
  description: "Slug of the space in which to create the package",
16350
- type: (0, import_cmd_ts20.optional)(SpaceSlug)
15921
+ type: (0, import_cmd_ts19.optional)(SpaceSlug)
16351
15922
  }),
16352
15923
  originSkill: originSkillOption
16353
15924
  },
@@ -16401,7 +15972,7 @@ var createPackageCommand = (0, import_cmd_ts20.command)({
16401
15972
  });
16402
15973
 
16403
15974
  // apps/cli/src/infra/commands/AddToPackageCommand.ts
16404
- var import_cmd_ts21 = __toESM(require_cjs());
15975
+ var import_cmd_ts20 = __toESM(require_cjs());
16405
15976
 
16406
15977
  // apps/cli/src/domain/errors/ItemNotFoundError.ts
16407
15978
  var ItemNotFoundError = class extends Error {
@@ -16421,8 +15992,8 @@ var AddToPackageUseCase = class {
16421
15992
  this.gateway = gateway;
16422
15993
  this.spaceService = spaceService;
16423
15994
  }
16424
- async execute(command33) {
16425
- const { packageSlug, spaceSlug, itemType, itemSlugs } = command33;
15995
+ async execute(command32) {
15996
+ const { packageSlug, spaceSlug, itemType, itemSlugs } = command32;
16426
15997
  const space = spaceSlug ? await this.resolveSpaceBySlug(spaceSlug) : await this.spaceService.getDefaultSpace();
16427
15998
  const packages = await this.gateway.packages.list({
16428
15999
  spaceId: space.id
@@ -16443,7 +16014,7 @@ var AddToPackageUseCase = class {
16443
16014
  standardIds: [],
16444
16015
  recipeIds: [],
16445
16016
  skillIds: [],
16446
- originSkill: command33.originSkill
16017
+ originSkill: command32.originSkill
16447
16018
  };
16448
16019
  if (itemType === "standard") {
16449
16020
  addCommand.standardIds = ids.map(createStandardId);
@@ -16495,7 +16066,7 @@ var AddToPackageUseCase = class {
16495
16066
  }
16496
16067
  async findCommandBySlug(slug3, spaceId) {
16497
16068
  const commands = await this.gateway.commands.list({ spaceId });
16498
- return commands.recipes.find((command33) => command33.slug === slug3) ?? null;
16069
+ return commands.recipes.find((command32) => command32.slug === slug3) ?? null;
16499
16070
  }
16500
16071
  async findSkillBySlug(slug3, spaceId) {
16501
16072
  const skills = await this.gateway.skills.list({ spaceId });
@@ -16581,11 +16152,11 @@ async function executeAddToPackage(pkgSlug, spaceSlug, itemType, itemSlugs, useC
16581
16152
  logErrorConsole(message);
16582
16153
  if (error instanceof ItemNotFoundError) {
16583
16154
  const spaceFlag = error.spaceSlug ? ` --space ${error.spaceSlug}` : "";
16584
- const command33 = formatCommand(
16155
+ const command32 = formatCommand(
16585
16156
  `packmind-cli ${error.itemType}s list${spaceFlag}`
16586
16157
  );
16587
16158
  logInfoConsole(
16588
- `Run \`${command33}\` to display available ${error.itemType}s`
16159
+ `Run \`${command32}\` to display available ${error.itemType}s`
16589
16160
  );
16590
16161
  }
16591
16162
  return { success: false, error: message };
@@ -16611,29 +16182,29 @@ async function addToPackageHandler(args2, deps) {
16611
16182
  }
16612
16183
 
16613
16184
  // apps/cli/src/infra/commands/AddToPackageCommand.ts
16614
- var addToPackageCommand = (0, import_cmd_ts21.command)({
16185
+ var addToPackageCommand = (0, import_cmd_ts20.command)({
16615
16186
  name: "add",
16616
16187
  description: "Add standards, commands, or skills to a package",
16617
16188
  args: {
16618
- to: (0, import_cmd_ts21.option)({
16189
+ to: (0, import_cmd_ts20.option)({
16619
16190
  long: "to",
16620
16191
  description: "Target package slug (use @space/package format when multiple spaces exist)",
16621
- type: import_cmd_ts21.string
16192
+ type: import_cmd_ts20.string
16622
16193
  }),
16623
- standards: (0, import_cmd_ts21.multioption)({
16194
+ standards: (0, import_cmd_ts20.multioption)({
16624
16195
  long: "standard",
16625
16196
  description: "Standard slug(s) to add",
16626
- type: (0, import_cmd_ts21.array)(import_cmd_ts21.string)
16197
+ type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
16627
16198
  }),
16628
- commands: (0, import_cmd_ts21.multioption)({
16199
+ commands: (0, import_cmd_ts20.multioption)({
16629
16200
  long: "command",
16630
16201
  description: "Command slug(s) to add",
16631
- type: (0, import_cmd_ts21.array)(import_cmd_ts21.string)
16202
+ type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
16632
16203
  }),
16633
- skills: (0, import_cmd_ts21.multioption)({
16204
+ skills: (0, import_cmd_ts20.multioption)({
16634
16205
  long: "skill",
16635
16206
  description: "Skill slug(s) to add",
16636
- type: (0, import_cmd_ts21.array)(import_cmd_ts21.string)
16207
+ type: (0, import_cmd_ts20.array)(import_cmd_ts20.string)
16637
16208
  }),
16638
16209
  originSkill: originSkillOption
16639
16210
  },
@@ -16669,7 +16240,7 @@ var addToPackageCommand = (0, import_cmd_ts21.command)({
16669
16240
  });
16670
16241
 
16671
16242
  // apps/cli/src/infra/commands/listPackagesCommand.ts
16672
- var import_cmd_ts22 = __toESM(require_cjs());
16243
+ var import_cmd_ts21 = __toESM(require_cjs());
16673
16244
 
16674
16245
  // apps/cli/src/infra/commands/packages/listPackagesHandler.ts
16675
16246
  async function listPackagesHandler(args2, deps) {
@@ -16736,12 +16307,12 @@ ${availableSpaces}`
16736
16307
  }
16737
16308
 
16738
16309
  // apps/cli/src/infra/commands/listPackagesCommand.ts
16739
- var listPackagesCommand = (0, import_cmd_ts22.command)({
16310
+ var listPackagesCommand = (0, import_cmd_ts21.command)({
16740
16311
  name: "list",
16741
16312
  description: "List available packages",
16742
16313
  args: {
16743
- space: (0, import_cmd_ts22.option)({
16744
- type: (0, import_cmd_ts22.optional)(SpaceSlug),
16314
+ space: (0, import_cmd_ts21.option)({
16315
+ type: (0, import_cmd_ts21.optional)(SpaceSlug),
16745
16316
  long: "space",
16746
16317
  description: "Filter packages by space slug"
16747
16318
  })
@@ -16758,7 +16329,7 @@ var listPackagesCommand = (0, import_cmd_ts22.command)({
16758
16329
  });
16759
16330
 
16760
16331
  // apps/cli/src/infra/commands/packages/showPackageCommand.ts
16761
- var import_cmd_ts23 = __toESM(require_cjs());
16332
+ var import_cmd_ts22 = __toESM(require_cjs());
16762
16333
 
16763
16334
  // apps/cli/src/infra/commands/packages/showPackageHandler.ts
16764
16335
  function isNotFoundError(err) {
@@ -16877,12 +16448,12 @@ ${pkg.name} (${fullSlug}):
16877
16448
  }
16878
16449
 
16879
16450
  // apps/cli/src/infra/commands/packages/showPackageCommand.ts
16880
- var showPackageCommand = (0, import_cmd_ts23.command)({
16451
+ var showPackageCommand = (0, import_cmd_ts22.command)({
16881
16452
  name: "show",
16882
16453
  description: "Show details of a specific package",
16883
16454
  args: {
16884
- slug: (0, import_cmd_ts23.positional)({
16885
- type: import_cmd_ts23.string,
16455
+ slug: (0, import_cmd_ts22.positional)({
16456
+ type: import_cmd_ts22.string,
16886
16457
  displayName: "package",
16887
16458
  description: "Package slug (e.g. backend or @my-space/backend)"
16888
16459
  })
@@ -16895,7 +16466,7 @@ var showPackageCommand = (0, import_cmd_ts23.command)({
16895
16466
  });
16896
16467
 
16897
16468
  // apps/cli/src/infra/commands/PackagesCommand.ts
16898
- var packagesCommand = (0, import_cmd_ts24.subcommands)({
16469
+ var packagesCommand = (0, import_cmd_ts23.subcommands)({
16899
16470
  name: "packages",
16900
16471
  description: "Manage packages",
16901
16472
  cmds: {
@@ -16907,24 +16478,24 @@ var packagesCommand = (0, import_cmd_ts24.subcommands)({
16907
16478
  });
16908
16479
 
16909
16480
  // apps/cli/src/infra/commands/PlaybookCommand.ts
16910
- var import_cmd_ts31 = __toESM(require_cjs());
16481
+ var import_cmd_ts30 = __toESM(require_cjs());
16911
16482
 
16912
16483
  // apps/cli/src/infra/commands/playbook/AddCommand.ts
16913
16484
  var import_fs21 = require("fs");
16914
- var import_cmd_ts25 = __toESM(require_cjs());
16485
+ var import_cmd_ts24 = __toESM(require_cjs());
16915
16486
 
16916
16487
  // apps/cli/src/infra/repositories/PlaybookLocalRepository.ts
16917
16488
  var crypto = __toESM(require("crypto"));
16918
- var fs23 = __toESM(require("fs"));
16919
- var os5 = __toESM(require("os"));
16920
- var path23 = __toESM(require("path"));
16489
+ var fs21 = __toESM(require("fs"));
16490
+ var os3 = __toESM(require("os"));
16491
+ var path21 = __toESM(require("path"));
16921
16492
  var yaml = __toESM(require("yaml"));
16922
16493
  var PlaybookLocalRepository = class {
16923
16494
  constructor(repoRoot) {
16924
16495
  const normalized = this.normalizeRepoRoot(repoRoot);
16925
16496
  const hash = crypto.createHash("md5").update(normalized).digest("hex");
16926
- this.storagePath = path23.join(
16927
- os5.homedir(),
16497
+ this.storagePath = path21.join(
16498
+ os3.homedir(),
16928
16499
  ".packmind",
16929
16500
  hash,
16930
16501
  "playbook.yaml"
@@ -16971,11 +16542,11 @@ var PlaybookLocalRepository = class {
16971
16542
  return normalized;
16972
16543
  }
16973
16544
  readYaml() {
16974
- if (!fs23.existsSync(this.storagePath)) {
16545
+ if (!fs21.existsSync(this.storagePath)) {
16975
16546
  return { version: 1, changes: [] };
16976
16547
  }
16977
16548
  try {
16978
- const content = fs23.readFileSync(this.storagePath, "utf-8");
16549
+ const content = fs21.readFileSync(this.storagePath, "utf-8");
16979
16550
  const parsed = yaml.parse(content);
16980
16551
  if (!parsed || !Array.isArray(parsed.changes)) {
16981
16552
  return { version: 1, changes: [] };
@@ -16989,20 +16560,20 @@ var PlaybookLocalRepository = class {
16989
16560
  }
16990
16561
  }
16991
16562
  writeYaml(data) {
16992
- const dir = path23.dirname(this.storagePath);
16993
- fs23.mkdirSync(dir, { recursive: true });
16994
- fs23.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
16563
+ const dir = path21.dirname(this.storagePath);
16564
+ fs21.mkdirSync(dir, { recursive: true });
16565
+ fs21.writeFileSync(this.storagePath, yaml.stringify(data), "utf-8");
16995
16566
  }
16996
16567
  };
16997
16568
 
16998
16569
  // apps/cli/src/infra/commands/playbook/addHandler.ts
16999
- var fs24 = __toESM(require("fs"));
17000
- var path27 = __toESM(require("path"));
16570
+ var fs22 = __toESM(require("fs"));
16571
+ var path25 = __toESM(require("path"));
17001
16572
  var yaml2 = __toESM(require("yaml"));
17002
16573
  var import_slug = __toESM(require("slug"));
17003
16574
 
17004
16575
  // apps/cli/src/application/utils/parseCommandFile.ts
17005
- var path24 = __toESM(require("path"));
16576
+ var path22 = __toESM(require("path"));
17006
16577
  var FRONTMATTER_DELIMITER3 = "---";
17007
16578
  function parseCommandFile(content, filePath) {
17008
16579
  content = normalizeLineEndings(content);
@@ -17058,7 +16629,7 @@ function stripYamlQuotes2(value) {
17058
16629
  return value;
17059
16630
  }
17060
16631
  function extractFilenameSlug(filePath) {
17061
- let basename4 = path24.basename(filePath);
16632
+ let basename4 = path22.basename(filePath);
17062
16633
  if (basename4.endsWith(".prompt.md")) {
17063
16634
  basename4 = basename4.slice(0, -".prompt.md".length);
17064
16635
  } else if (basename4.endsWith(".md")) {
@@ -17225,7 +16796,7 @@ function parseSkillDirectory(files) {
17225
16796
  }
17226
16797
 
17227
16798
  // apps/cli/src/application/utils/findNearestConfigDir.ts
17228
- var path25 = __toESM(require("path"));
16799
+ var path23 = __toESM(require("path"));
17229
16800
  async function findNearestConfigDir(startDir, packmindCliHexa) {
17230
16801
  let current = startDir;
17231
16802
  while (true) {
@@ -17233,7 +16804,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
17233
16804
  if (exists) {
17234
16805
  return current;
17235
16806
  }
17236
- const parent = path25.dirname(current);
16807
+ const parent = path23.dirname(current);
17237
16808
  if (parent === current) {
17238
16809
  return null;
17239
16810
  }
@@ -17242,7 +16813,7 @@ async function findNearestConfigDir(startDir, packmindCliHexa) {
17242
16813
  }
17243
16814
 
17244
16815
  // apps/cli/src/application/utils/resolveDeployedContext.ts
17245
- var path26 = __toESM(require("path"));
16816
+ var path24 = __toESM(require("path"));
17246
16817
  async function resolveDeployedContext(packmindCliHexa, targetDir) {
17247
16818
  try {
17248
16819
  const space = await packmindCliHexa.getDefaultSpace();
@@ -17254,7 +16825,7 @@ async function resolveDeployedContext(packmindCliHexa, targetDir) {
17254
16825
  }
17255
16826
  const gitRemoteUrl = packmindCliHexa.getGitRemoteUrlFromPath(gitRoot);
17256
16827
  const gitBranch = packmindCliHexa.getCurrentBranch(gitRoot);
17257
- const rel = path26.relative(gitRoot, targetDir);
16828
+ const rel = path24.relative(gitRoot, targetDir);
17258
16829
  const relativePath = rel.startsWith("..") ? "/" : rel ? `/${rel}/` : "/";
17259
16830
  const deployedContent = await packmindCliHexa.getPackmindGateway().deployment.getDeployed({
17260
16831
  packagesSlugs: configPackages,
@@ -17319,19 +16890,19 @@ async function fetchDeployedFiles(gateway, lockFile) {
17319
16890
 
17320
16891
  // apps/cli/src/infra/commands/playbook/addHandler.ts
17321
16892
  async function tryStageRemovedFromLockFile(resolvedPath, deps) {
17322
- const fileDir = path27.dirname(resolvedPath);
16893
+ const fileDir = path25.dirname(resolvedPath);
17323
16894
  const targetDir = await findNearestConfigDir(fileDir, deps.packmindCliHexa);
17324
16895
  if (!targetDir) return false;
17325
16896
  const lockFile = await deps.lockFileRepository.read(targetDir);
17326
16897
  if (!lockFile) return false;
17327
- const normalizedPath = normalizePath2(path27.relative(targetDir, resolvedPath));
16898
+ const normalizedPath = normalizePath2(path25.relative(targetDir, resolvedPath));
17328
16899
  const lockEntry = findLockFileEntryForPath(
17329
16900
  normalizedPath,
17330
16901
  lockFile.artifacts
17331
16902
  );
17332
16903
  if (!lockEntry) return false;
17333
16904
  const gitRoot = await deps.packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
17334
- const configDir = gitRoot ? normalizePath2(path27.relative(gitRoot, targetDir)) : "";
16905
+ const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
17335
16906
  const deployedContext = await resolveDeployedContext(
17336
16907
  deps.packmindCliHexa,
17337
16908
  targetDir
@@ -17363,22 +16934,22 @@ async function tryStageRemovedFromLockFile(resolvedPath, deps) {
17363
16934
  }
17364
16935
  function resolveSkillDirectoryRoot(absolutePath) {
17365
16936
  if (absolutePath.endsWith("SKILL.md")) {
17366
- return path27.dirname(absolutePath);
16937
+ return path25.dirname(absolutePath);
17367
16938
  }
17368
16939
  try {
17369
- if (fs24.statSync(absolutePath).isDirectory()) {
16940
+ if (fs22.statSync(absolutePath).isDirectory()) {
17370
16941
  return absolutePath;
17371
16942
  }
17372
16943
  } catch {
17373
16944
  return absolutePath;
17374
16945
  }
17375
- let current = path27.dirname(absolutePath);
17376
- const root = path27.parse(current).root;
16946
+ let current = path25.dirname(absolutePath);
16947
+ const root = path25.parse(current).root;
17377
16948
  while (current !== root) {
17378
- if (fs24.existsSync(path27.join(current, "SKILL.md"))) {
16949
+ if (fs22.existsSync(path25.join(current, "SKILL.md"))) {
17379
16950
  return current;
17380
16951
  }
17381
- current = path27.dirname(current);
16952
+ current = path25.dirname(current);
17382
16953
  }
17383
16954
  return absolutePath;
17384
16955
  }
@@ -17401,17 +16972,17 @@ async function playbookAddHandler(deps) {
17401
16972
  exit(1);
17402
16973
  return;
17403
16974
  }
17404
- const absolutePath = path27.resolve(cwd, filePath);
16975
+ const absolutePath = path25.resolve(cwd, filePath);
17405
16976
  let artifactType;
17406
16977
  let codingAgent;
17407
16978
  const earlyTargetDir = await findNearestConfigDir(
17408
- path27.dirname(absolutePath),
16979
+ path25.dirname(absolutePath),
17409
16980
  packmindCliHexa
17410
16981
  );
17411
16982
  const earlyLockFile = earlyTargetDir ? await lockFileRepository.read(earlyTargetDir) : null;
17412
16983
  if (earlyLockFile && earlyTargetDir) {
17413
16984
  const normalizedForLookup = normalizePath2(
17414
- path27.relative(earlyTargetDir, absolutePath)
16985
+ path25.relative(earlyTargetDir, absolutePath)
17415
16986
  );
17416
16987
  const lockResult = findLockFileEntryAndFileForPath(
17417
16988
  normalizedForLookup,
@@ -17545,7 +17116,7 @@ Content goes here...`
17545
17116
  return;
17546
17117
  }
17547
17118
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
17548
- const configDir = gitRoot ? normalizePath2(path27.relative(gitRoot, targetDir)) : "";
17119
+ const configDir = gitRoot ? normalizePath2(path25.relative(gitRoot, targetDir)) : "";
17549
17120
  const deployedContext = await resolveDeployedContext(
17550
17121
  packmindCliHexa,
17551
17122
  targetDir
@@ -17553,7 +17124,7 @@ Content goes here...`
17553
17124
  const targetId = deployedContext?.targetId ?? earlyLockFile?.targetId;
17554
17125
  const normalizedFilePath = (() => {
17555
17126
  const refPath = artifactType === "skill" && skillDirPath ? skillDirPath : absolutePath;
17556
- return normalizePath2(path27.relative(targetDir, refPath));
17127
+ return normalizePath2(path25.relative(targetDir, refPath));
17557
17128
  })();
17558
17129
  let spaceId;
17559
17130
  let spaceName;
@@ -17668,7 +17239,7 @@ Run ${formatLabel("packmind-cli install")} to update before making changes.`
17668
17239
  );
17669
17240
  const allMatch = skillDeployedFiles.length > 0 && skillDeployedFiles.length === skillFiles.length && skillDeployedFiles.every((deployed) => {
17670
17241
  const localFile = skillFiles.find(
17671
- (f) => normalizePath2(path27.join(normalizedFilePath, f.relativePath)) === normalizePath2(deployed.path)
17242
+ (f) => normalizePath2(path25.join(normalizedFilePath, f.relativePath)) === normalizePath2(deployed.path)
17672
17243
  );
17673
17244
  return localFile && deployed.content?.trim() === localFile.content.trim() && (!deployed.skillFilePermissions || deployed.skillFilePermissions === localFile.permissions);
17674
17245
  });
@@ -17738,17 +17309,17 @@ function formatSpaceList(spaces) {
17738
17309
  }
17739
17310
 
17740
17311
  // apps/cli/src/infra/commands/playbook/AddCommand.ts
17741
- var addPlaybookCommand = (0, import_cmd_ts25.command)({
17312
+ var addPlaybookCommand = (0, import_cmd_ts24.command)({
17742
17313
  name: "add",
17743
17314
  description: "Stage a local artifact change",
17744
17315
  args: {
17745
- filePath: (0, import_cmd_ts25.positional)({
17746
- type: import_cmd_ts25.string,
17316
+ filePath: (0, import_cmd_ts24.positional)({
17317
+ type: import_cmd_ts24.string,
17747
17318
  displayName: "path",
17748
17319
  description: "Path to the artifact file or directory to stage"
17749
17320
  }),
17750
- space: (0, import_cmd_ts25.option)({
17751
- type: (0, import_cmd_ts25.optional)(SpaceSlug),
17321
+ space: (0, import_cmd_ts24.option)({
17322
+ type: (0, import_cmd_ts24.optional)(SpaceSlug),
17752
17323
  long: "space",
17753
17324
  description: "Target space slug"
17754
17325
  })
@@ -17777,11 +17348,11 @@ var addPlaybookCommand = (0, import_cmd_ts25.command)({
17777
17348
  });
17778
17349
 
17779
17350
  // apps/cli/src/infra/commands/playbook/RmCommand.ts
17780
- var import_cmd_ts26 = __toESM(require_cjs());
17351
+ var import_cmd_ts25 = __toESM(require_cjs());
17781
17352
 
17782
17353
  // apps/cli/src/infra/commands/playbook/rmHandler.ts
17783
- var fs25 = __toESM(require("fs"));
17784
- var path28 = __toESM(require("path"));
17354
+ var fs23 = __toESM(require("fs"));
17355
+ var path26 = __toESM(require("path"));
17785
17356
  function isSkillSupportFile(absolutePath) {
17786
17357
  const normalized = absolutePath.replace(/\\/g, "/");
17787
17358
  const skillDirMatch = normalized.match(/\/skills\/[^/]+\//);
@@ -17808,14 +17379,14 @@ async function playbookRmHandler(deps) {
17808
17379
  exit(1);
17809
17380
  return;
17810
17381
  }
17811
- const absolutePath = path28.resolve(getCwd(), filePath);
17812
- if (!fs25.existsSync(absolutePath)) {
17382
+ const absolutePath = path26.resolve(getCwd(), filePath);
17383
+ if (!fs23.existsSync(absolutePath)) {
17813
17384
  logErrorConsole(`File not found: "${filePath}"`);
17814
17385
  exit(1);
17815
17386
  return;
17816
17387
  }
17817
17388
  const targetDir = await findNearestConfigDir(
17818
- path28.dirname(absolutePath),
17389
+ path26.dirname(absolutePath),
17819
17390
  packmindCliHexa
17820
17391
  );
17821
17392
  if (!targetDir) {
@@ -17832,7 +17403,7 @@ async function playbookRmHandler(deps) {
17832
17403
  return;
17833
17404
  }
17834
17405
  const normalizedForLookup = normalizePath2(
17835
- path28.relative(targetDir, absolutePath)
17406
+ path26.relative(targetDir, absolutePath)
17836
17407
  );
17837
17408
  const lockResult = findLockFileEntryAndFileForPath(
17838
17409
  normalizedForLookup,
@@ -17854,7 +17425,7 @@ async function playbookRmHandler(deps) {
17854
17425
  }
17855
17426
  const resolvedAbsolutePath = artifactType === "skill" ? resolveSkillDirPath(absolutePath) : absolutePath;
17856
17427
  const normalizedFilePath = normalizePath2(
17857
- path28.relative(targetDir, resolvedAbsolutePath)
17428
+ path26.relative(targetDir, resolvedAbsolutePath)
17858
17429
  );
17859
17430
  const lockEntry = findLockFileEntryAndFileForPath(normalizedFilePath, lockFile.artifacts)?.entry ?? lockResult.entry;
17860
17431
  if (!lockEntry) {
@@ -17882,7 +17453,7 @@ async function playbookRmHandler(deps) {
17882
17453
  }
17883
17454
  const spaceName = matchingSpace.name;
17884
17455
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(targetDir);
17885
- const configDir = gitRoot ? normalizePath2(path28.relative(gitRoot, targetDir)) : "";
17456
+ const configDir = gitRoot ? normalizePath2(path26.relative(gitRoot, targetDir)) : "";
17886
17457
  const deployedContext = await resolveDeployedContext(
17887
17458
  packmindCliHexa,
17888
17459
  targetDir
@@ -17908,13 +17479,13 @@ async function playbookRmHandler(deps) {
17908
17479
  }
17909
17480
 
17910
17481
  // apps/cli/src/infra/commands/playbook/RmCommand.ts
17911
- var rmPlaybookCommand = (0, import_cmd_ts26.command)({
17482
+ var rmPlaybookCommand = (0, import_cmd_ts25.command)({
17912
17483
  name: "rm",
17913
17484
  description: "Stage an artifact for removal",
17914
17485
  aliases: ["remove"],
17915
17486
  args: {
17916
- filePath: (0, import_cmd_ts26.positional)({
17917
- type: import_cmd_ts26.string,
17487
+ filePath: (0, import_cmd_ts25.positional)({
17488
+ type: import_cmd_ts25.string,
17918
17489
  displayName: "path",
17919
17490
  description: "Path to the artifact file or directory to remove"
17920
17491
  })
@@ -17940,10 +17511,10 @@ var rmPlaybookCommand = (0, import_cmd_ts26.command)({
17940
17511
  });
17941
17512
 
17942
17513
  // apps/cli/src/infra/commands/playbook/UnstageCommand.ts
17943
- var import_cmd_ts27 = __toESM(require_cjs());
17514
+ var import_cmd_ts26 = __toESM(require_cjs());
17944
17515
 
17945
17516
  // apps/cli/src/infra/commands/playbook/unstageHandler.ts
17946
- var path29 = __toESM(require("path"));
17517
+ var path27 = __toESM(require("path"));
17947
17518
  async function playbookUnstageHandler(deps) {
17948
17519
  const {
17949
17520
  packmindCliHexa,
@@ -17961,10 +17532,10 @@ async function playbookUnstageHandler(deps) {
17961
17532
  return;
17962
17533
  }
17963
17534
  const cwd = getCwd();
17964
- const absolutePath = path29.resolve(cwd, filePath);
17535
+ const absolutePath = path27.resolve(cwd, filePath);
17965
17536
  const resolvedPath = resolveSkillDirPath(absolutePath);
17966
17537
  const configDir = await findNearestConfigDir(
17967
- path29.dirname(resolvedPath),
17538
+ path27.dirname(resolvedPath),
17968
17539
  packmindCliHexa
17969
17540
  );
17970
17541
  if (!configDir) {
@@ -17977,10 +17548,10 @@ async function playbookUnstageHandler(deps) {
17977
17548
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
17978
17549
  const baseDir = gitRoot ?? configDir;
17979
17550
  const normalizedFilePath = normalizePath2(
17980
- path29.relative(baseDir, resolvedPath)
17551
+ path27.relative(baseDir, resolvedPath)
17981
17552
  );
17982
17553
  const matchingEntries = playbookLocalRepository.getChanges().filter((c) => {
17983
- const fullEntryPath = c.configDir ? normalizePath2(path29.join(c.configDir, c.filePath)) : c.filePath;
17554
+ const fullEntryPath = c.configDir ? normalizePath2(path27.join(c.configDir, c.filePath)) : c.filePath;
17984
17555
  return fullEntryPath === normalizedFilePath;
17985
17556
  });
17986
17557
  if (matchingEntries.length === 0) {
@@ -18024,17 +17595,17 @@ ${spaceList}`
18024
17595
  }
18025
17596
 
18026
17597
  // apps/cli/src/infra/commands/playbook/UnstageCommand.ts
18027
- var unstagePlaybookCommand = (0, import_cmd_ts27.command)({
17598
+ var unstagePlaybookCommand = (0, import_cmd_ts26.command)({
18028
17599
  name: "unstage",
18029
17600
  description: "Remove a staged change",
18030
17601
  args: {
18031
- filePath: (0, import_cmd_ts27.positional)({
18032
- type: import_cmd_ts27.string,
17602
+ filePath: (0, import_cmd_ts26.positional)({
17603
+ type: import_cmd_ts26.string,
18033
17604
  displayName: "path",
18034
17605
  description: "Path to the artifact file or directory to unstage"
18035
17606
  }),
18036
- space: (0, import_cmd_ts27.option)({
18037
- type: (0, import_cmd_ts27.optional)(SpaceSlug),
17607
+ space: (0, import_cmd_ts26.option)({
17608
+ type: (0, import_cmd_ts26.optional)(SpaceSlug),
18038
17609
  long: "space",
18039
17610
  description: "Target space slug (required when artifact is staged for multiple spaces)"
18040
17611
  })
@@ -18060,19 +17631,19 @@ var unstagePlaybookCommand = (0, import_cmd_ts27.command)({
18060
17631
 
18061
17632
  // apps/cli/src/infra/commands/playbook/StatusCommand.ts
18062
17633
  var import_fs23 = require("fs");
18063
- var import_cmd_ts28 = __toESM(require_cjs());
17634
+ var import_cmd_ts27 = __toESM(require_cjs());
18064
17635
 
18065
17636
  // apps/cli/src/infra/utils/listDirectoryFiles.ts
18066
17637
  var import_fs22 = require("fs");
18067
- var path30 = __toESM(require("path"));
17638
+ var path28 = __toESM(require("path"));
18068
17639
  function listDirectoryFiles(dirPath) {
18069
17640
  const results = [];
18070
17641
  const entries = (0, import_fs22.readdirSync)(dirPath, { withFileTypes: true });
18071
17642
  for (const entry of entries) {
18072
- const fullPath = path30.join(dirPath, entry.name);
17643
+ const fullPath = path28.join(dirPath, entry.name);
18073
17644
  if (entry.isDirectory()) {
18074
17645
  for (const nested of listDirectoryFiles(fullPath)) {
18075
- results.push(path30.join(entry.name, nested));
17646
+ results.push(path28.join(entry.name, nested));
18076
17647
  }
18077
17648
  } else if (entry.isFile()) {
18078
17649
  results.push(entry.name);
@@ -18082,7 +17653,7 @@ function listDirectoryFiles(dirPath) {
18082
17653
  }
18083
17654
 
18084
17655
  // apps/cli/src/infra/commands/playbook/statusHandler.ts
18085
- var path31 = __toESM(require("path"));
17656
+ var path29 = __toESM(require("path"));
18086
17657
 
18087
17658
  // apps/cli/src/infra/utils/stringUtils.ts
18088
17659
  function capitalize(s) {
@@ -18117,7 +17688,7 @@ function groupStagedChanges(changes, cwd, gitRoot) {
18117
17688
  const changeType = change.changeType ?? "updated";
18118
17689
  const key = `${change.artifactType}:${change.artifactName}:${changeType}`;
18119
17690
  const rootRelativePath = change.configDir ? `${change.configDir}/${change.filePath}` : change.filePath;
18120
- const displayPath = gitRoot ? normalizePath2(path31.relative(cwd, path31.join(gitRoot, rootRelativePath))) : rootRelativePath;
17691
+ const displayPath = gitRoot ? normalizePath2(path29.relative(cwd, path29.join(gitRoot, rootRelativePath))) : rootRelativePath;
18121
17692
  const existing = groups.get(key);
18122
17693
  if (existing) {
18123
17694
  existing.filePaths.push(displayPath);
@@ -18175,12 +17746,12 @@ async function playbookStatusHandler(deps) {
18175
17746
  const fallbackConfigDir = await findNearestConfigDir(cwd, packmindCliHexa);
18176
17747
  const configDirs = /* @__PURE__ */ new Set([...stagedByConfigDir.keys()]);
18177
17748
  if (fallbackConfigDir && !configDirs.has("__cwd__")) {
18178
- const rel = gitRoot ? normalizePath2(path31.relative(gitRoot, fallbackConfigDir)) : "";
17749
+ const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, fallbackConfigDir)) : "";
18179
17750
  if (!configDirs.has(rel)) configDirs.add(rel);
18180
17751
  }
18181
17752
  const descendantDirs = await packmindCliHexa.findDescendantConfigs(cwd);
18182
17753
  for (const descendantDir of descendantDirs) {
18183
- const rel = gitRoot ? normalizePath2(path31.relative(gitRoot, descendantDir)) : normalizePath2(path31.relative(cwd, descendantDir));
17754
+ const rel = gitRoot ? normalizePath2(path29.relative(gitRoot, descendantDir)) : normalizePath2(path29.relative(cwd, descendantDir));
18184
17755
  if (!configDirs.has(rel)) configDirs.add(rel);
18185
17756
  }
18186
17757
  for (const configDirKey of configDirs) {
@@ -18188,7 +17759,7 @@ async function playbookStatusHandler(deps) {
18188
17759
  if (configDirKey === "__cwd__") {
18189
17760
  projectDir = fallbackConfigDir;
18190
17761
  } else if (gitRoot) {
18191
- projectDir = path31.join(gitRoot, configDirKey);
17762
+ projectDir = path29.join(gitRoot, configDirKey);
18192
17763
  } else {
18193
17764
  continue;
18194
17765
  }
@@ -18213,11 +17784,11 @@ async function playbookStatusHandler(deps) {
18213
17784
  continue;
18214
17785
  }
18215
17786
  const displayPath = normalizePath2(
18216
- path31.relative(cwd, path31.join(projectDir, deployedFile.path))
17787
+ path29.relative(cwd, path29.join(projectDir, deployedFile.path))
18217
17788
  );
18218
17789
  let localContent;
18219
17790
  try {
18220
- localContent = readFile11(path31.join(projectDir, deployedFile.path));
17791
+ localContent = readFile11(path29.join(projectDir, deployedFile.path));
18221
17792
  } catch {
18222
17793
  const artifact = findArtifactForFile(
18223
17794
  deployedFile.path,
@@ -18246,7 +17817,7 @@ async function playbookStatusHandler(deps) {
18246
17817
  });
18247
17818
  }
18248
17819
  } else if (deployedFile.skillFilePermissions && getFileMode) {
18249
- const localMode = getFileMode(path31.join(projectDir, deployedFile.path));
17820
+ const localMode = getFileMode(path29.join(projectDir, deployedFile.path));
18250
17821
  if (localMode !== null) {
18251
17822
  const localPermissions = modeToPermissionStringOrDefault(localMode);
18252
17823
  if (localPermissions !== deployedFile.skillFilePermissions) {
@@ -18275,13 +17846,13 @@ async function playbookStatusHandler(deps) {
18275
17846
  (f) => normalizePath2(f.path).endsWith("/SKILL.md")
18276
17847
  );
18277
17848
  if (!skillMdFile) continue;
18278
- const skillDir = normalizePath2(path31.dirname(skillMdFile.path));
17849
+ const skillDir = normalizePath2(path29.dirname(skillMdFile.path));
18279
17850
  if (targetStagedPaths.has(skillDir) || targetSkillDirPaths.some(
18280
17851
  (staged) => skillDir === staged || skillDir.startsWith(staged + "/")
18281
17852
  )) {
18282
17853
  continue;
18283
17854
  }
18284
- const absoluteSkillDir = path31.join(projectDir, skillDir);
17855
+ const absoluteSkillDir = path29.join(projectDir, skillDir);
18285
17856
  let localFiles;
18286
17857
  try {
18287
17858
  localFiles = listDirectoryFiles2(absoluteSkillDir);
@@ -18290,11 +17861,11 @@ async function playbookStatusHandler(deps) {
18290
17861
  }
18291
17862
  for (const localRelPath of localFiles) {
18292
17863
  const normalizedLocalPath = normalizePath2(
18293
- path31.join(skillDir, localRelPath)
17864
+ path29.join(skillDir, localRelPath)
18294
17865
  );
18295
17866
  if (!deployedPathSet.has(normalizedLocalPath)) {
18296
17867
  const displayPath = normalizePath2(
18297
- path31.relative(cwd, path31.join(projectDir, normalizedLocalPath))
17868
+ path29.relative(cwd, path29.join(projectDir, normalizedLocalPath))
18298
17869
  );
18299
17870
  untrackedChanges.push({
18300
17871
  artifactName: entry.name,
@@ -18342,7 +17913,7 @@ async function playbookStatusHandler(deps) {
18342
17913
  }
18343
17914
 
18344
17915
  // apps/cli/src/infra/commands/playbook/StatusCommand.ts
18345
- var statusPlaybookCommand = (0, import_cmd_ts28.command)({
17916
+ var statusPlaybookCommand = (0, import_cmd_ts27.command)({
18346
17917
  name: "status",
18347
17918
  description: "Show staged and untracked changes",
18348
17919
  args: {},
@@ -18376,13 +17947,13 @@ var statusPlaybookCommand = (0, import_cmd_ts28.command)({
18376
17947
 
18377
17948
  // apps/cli/src/infra/commands/playbook/SubmitCommand.ts
18378
17949
  var import_fs24 = require("fs");
18379
- var import_child_process5 = require("child_process");
17950
+ var import_child_process3 = require("child_process");
18380
17951
  var import_os2 = require("os");
18381
17952
  var import_path5 = require("path");
18382
- var import_cmd_ts29 = __toESM(require_cjs());
17953
+ var import_cmd_ts28 = __toESM(require_cjs());
18383
17954
 
18384
17955
  // apps/cli/src/infra/commands/playbook/submitHandler.ts
18385
- var path33 = __toESM(require("path"));
17956
+ var path31 = __toESM(require("path"));
18386
17957
 
18387
17958
  // apps/cli/src/infra/commands/playbook/submit/duplicateNameChecker.ts
18388
17959
  var import_slug2 = __toESM(require("slug"));
@@ -18444,7 +18015,7 @@ async function checkForDuplicateNames(createdEntries, packmindGateway) {
18444
18015
  }
18445
18016
 
18446
18017
  // apps/cli/src/infra/commands/playbook/submit/targetContextResolver.ts
18447
- var path32 = __toESM(require("path"));
18018
+ var path30 = __toESM(require("path"));
18448
18019
  async function createTargetContextResolver(deps) {
18449
18020
  const { lockFileRepository, cwd, packmindCliHexa } = deps;
18450
18021
  const gitRoot = await packmindCliHexa.tryGetGitRepositoryRoot(cwd);
@@ -18455,7 +18026,7 @@ async function createTargetContextResolver(deps) {
18455
18026
  if (cache.has(key)) return cache.get(key);
18456
18027
  let projectDir;
18457
18028
  if (entry.configDir !== void 0 && gitRoot) {
18458
- projectDir = path32.join(gitRoot, entry.configDir);
18029
+ projectDir = path30.join(gitRoot, entry.configDir);
18459
18030
  } else {
18460
18031
  projectDir = await findNearestConfigDir(cwd, packmindCliHexa);
18461
18032
  }
@@ -19403,7 +18974,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
19403
18974
  const entryCtx = resolver.getCachedContext(entry.configDir);
19404
18975
  if (!entryCtx?.projectDir) continue;
19405
18976
  try {
19406
- const fullPath = path33.join(entryCtx.projectDir, entry.filePath);
18977
+ const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
19407
18978
  if (entry.artifactType === "skill") {
19408
18979
  deps.rmSync(fullPath, { recursive: true });
19409
18980
  } else {
@@ -19431,7 +19002,7 @@ Only one agent version can be submitted at a time. Use "playbook unstage" to rem
19431
19002
  const entryCtx = resolver.getCachedContext(entry.configDir);
19432
19003
  if (!entryCtx?.projectDir) continue;
19433
19004
  try {
19434
- const fullPath = path33.join(entryCtx.projectDir, entry.filePath);
19005
+ const fullPath = path31.join(entryCtx.projectDir, entry.filePath);
19435
19006
  if (entry.artifactType === "skill") {
19436
19007
  deps.rmSync(fullPath, { recursive: true });
19437
19008
  } else {
@@ -19484,7 +19055,7 @@ function openEditorForMessage(prefill) {
19484
19055
  const tmpFile = (0, import_path5.join)((0, import_os2.tmpdir)(), `packmind-submit-${Date.now()}.md`);
19485
19056
  try {
19486
19057
  (0, import_fs24.writeFileSync)(tmpFile, prefill, "utf-8");
19487
- (0, import_child_process5.execSync)(`${editor} "${tmpFile}"`, { stdio: "inherit" });
19058
+ (0, import_child_process3.execSync)(`${editor} "${tmpFile}"`, { stdio: "inherit" });
19488
19059
  const content = (0, import_fs24.readFileSync)(tmpFile, "utf-8");
19489
19060
  const stripped = content.split("\n").filter((line) => !line.startsWith("#")).join("\n").trim();
19490
19061
  return stripped || null;
@@ -19497,17 +19068,17 @@ function openEditorForMessage(prefill) {
19497
19068
  }
19498
19069
  }
19499
19070
  }
19500
- var submitPlaybookCommand = (0, import_cmd_ts29.command)({
19071
+ var submitPlaybookCommand = (0, import_cmd_ts28.command)({
19501
19072
  name: "submit",
19502
19073
  description: "Submit staged changes as proposals",
19503
19074
  args: {
19504
- message: (0, import_cmd_ts29.option)({
19505
- type: (0, import_cmd_ts29.optional)(import_cmd_ts29.string),
19075
+ message: (0, import_cmd_ts28.option)({
19076
+ type: (0, import_cmd_ts28.optional)(import_cmd_ts28.string),
19506
19077
  long: "message",
19507
19078
  short: "m",
19508
19079
  description: "Message describing the intent behind the proposed changes"
19509
19080
  }),
19510
- noReview: (0, import_cmd_ts29.flag)({
19081
+ noReview: (0, import_cmd_ts28.flag)({
19511
19082
  long: "no-review",
19512
19083
  description: "Apply changes directly without creating proposals for review"
19513
19084
  })
@@ -19537,23 +19108,23 @@ var submitPlaybookCommand = (0, import_cmd_ts29.command)({
19537
19108
  });
19538
19109
 
19539
19110
  // apps/cli/src/infra/commands/playbook/DiffCommand.ts
19540
- var import_cmd_ts30 = __toESM(require_cjs());
19541
- var diffCommand2 = (0, import_cmd_ts30.command)({
19111
+ var import_cmd_ts29 = __toESM(require_cjs());
19112
+ var diffCommand2 = (0, import_cmd_ts29.command)({
19542
19113
  name: "diff",
19543
19114
  description: "Show differences between local command files and server content",
19544
19115
  args: {
19545
- includeSubmitted: (0, import_cmd_ts30.flag)({
19116
+ includeSubmitted: (0, import_cmd_ts29.flag)({
19546
19117
  long: "include-submitted",
19547
19118
  description: "Include already submitted changes in the output"
19548
19119
  }),
19549
- path: (0, import_cmd_ts30.option)({
19120
+ path: (0, import_cmd_ts29.option)({
19550
19121
  long: "path",
19551
19122
  short: "p",
19552
19123
  description: "Path to analyze (relative to current directory)",
19553
- type: (0, import_cmd_ts30.optional)(import_cmd_ts30.string)
19124
+ type: (0, import_cmd_ts29.optional)(import_cmd_ts29.string)
19554
19125
  })
19555
19126
  },
19556
- handler: async ({ includeSubmitted, path: path37 }) => {
19127
+ handler: async ({ includeSubmitted, path: path35 }) => {
19557
19128
  const packmindLogger = new PackmindLogger("PackmindCLI", "info" /* INFO */);
19558
19129
  const packmindCliHexa = new PackmindCliHexa(packmindLogger);
19559
19130
  await diffArtefactsHandler({
@@ -19562,13 +19133,13 @@ var diffCommand2 = (0, import_cmd_ts30.command)({
19562
19133
  getCwd: () => process.cwd(),
19563
19134
  log: console.log,
19564
19135
  includeSubmitted,
19565
- path: path37
19136
+ path: path35
19566
19137
  });
19567
19138
  }
19568
19139
  });
19569
19140
 
19570
19141
  // apps/cli/src/infra/commands/PlaybookCommand.ts
19571
- var playbookCommand = (0, import_cmd_ts31.subcommands)({
19142
+ var playbookCommand = (0, import_cmd_ts30.subcommands)({
19572
19143
  name: "playbook",
19573
19144
  description: "Manage local playbook files and propose changes to your team",
19574
19145
  cmds: {
@@ -19582,10 +19153,10 @@ var playbookCommand = (0, import_cmd_ts31.subcommands)({
19582
19153
  });
19583
19154
 
19584
19155
  // apps/cli/src/infra/commands/SpacesCommand.ts
19585
- var import_cmd_ts33 = __toESM(require_cjs());
19156
+ var import_cmd_ts32 = __toESM(require_cjs());
19586
19157
 
19587
19158
  // apps/cli/src/infra/commands/ListSpacesCommand.ts
19588
- var import_cmd_ts32 = __toESM(require_cjs());
19159
+ var import_cmd_ts31 = __toESM(require_cjs());
19589
19160
 
19590
19161
  // apps/cli/src/infra/commands/spaces/listSpacesHandler.ts
19591
19162
  function displaySpace(space) {
@@ -19621,7 +19192,7 @@ async function listSpacesHandler(deps) {
19621
19192
  }
19622
19193
 
19623
19194
  // apps/cli/src/infra/commands/ListSpacesCommand.ts
19624
- var listSpacesCommand = (0, import_cmd_ts32.command)({
19195
+ var listSpacesCommand = (0, import_cmd_ts31.command)({
19625
19196
  name: "list",
19626
19197
  description: "List available spaces in the organization",
19627
19198
  args: {},
@@ -19636,7 +19207,7 @@ var listSpacesCommand = (0, import_cmd_ts32.command)({
19636
19207
  });
19637
19208
 
19638
19209
  // apps/cli/src/infra/commands/SpacesCommand.ts
19639
- var spacesCommand = (0, import_cmd_ts33.subcommands)({
19210
+ var spacesCommand = (0, import_cmd_ts32.subcommands)({
19640
19211
  name: "spaces",
19641
19212
  description: "Manage spaces in your Packmind organization",
19642
19213
  cmds: {
@@ -19645,14 +19216,14 @@ var spacesCommand = (0, import_cmd_ts33.subcommands)({
19645
19216
  });
19646
19217
 
19647
19218
  // apps/cli/src/infra/commands/config/ConfigCommand.ts
19648
- var import_cmd_ts39 = __toESM(require_cjs());
19219
+ var import_cmd_ts38 = __toESM(require_cjs());
19649
19220
 
19650
19221
  // apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
19651
- var import_cmd_ts38 = __toESM(require_cjs());
19222
+ var import_cmd_ts37 = __toESM(require_cjs());
19652
19223
 
19653
19224
  // apps/cli/src/application/services/AgentArtifactDetectionService.ts
19654
- var fs26 = __toESM(require("fs/promises"));
19655
- var path34 = __toESM(require("path"));
19225
+ var fs24 = __toESM(require("fs/promises"));
19226
+ var path32 = __toESM(require("path"));
19656
19227
  var AGENT_ARTIFACT_CHECKS = [
19657
19228
  { agent: "claude", paths: [".claude"] },
19658
19229
  { agent: "cursor", paths: [".cursor"] },
@@ -19681,7 +19252,7 @@ var AgentArtifactDetectionService = class {
19681
19252
  }
19682
19253
  } else {
19683
19254
  for (const relativePath of check.paths) {
19684
- const fullPath = path34.join(baseDirectory, relativePath);
19255
+ const fullPath = path32.join(baseDirectory, relativePath);
19685
19256
  const exists = await this.pathExists(fullPath);
19686
19257
  if (exists) {
19687
19258
  detected.push({
@@ -19697,7 +19268,7 @@ var AgentArtifactDetectionService = class {
19697
19268
  }
19698
19269
  async pathExists(filePath) {
19699
19270
  try {
19700
- await fs26.access(filePath);
19271
+ await fs24.access(filePath);
19701
19272
  return true;
19702
19273
  } catch {
19703
19274
  return false;
@@ -19708,16 +19279,16 @@ var AgentArtifactDetectionService = class {
19708
19279
  while (queue.length > 0) {
19709
19280
  const currentDir = queue.shift();
19710
19281
  for (const targetPath of targetPaths) {
19711
- const fullPath = path34.join(currentDir, targetPath);
19282
+ const fullPath = path32.join(currentDir, targetPath);
19712
19283
  if (await this.pathExists(fullPath)) {
19713
19284
  return fullPath;
19714
19285
  }
19715
19286
  }
19716
19287
  try {
19717
- const entries = await fs26.readdir(currentDir, { withFileTypes: true });
19288
+ const entries = await fs24.readdir(currentDir, { withFileTypes: true });
19718
19289
  for (const entry of entries) {
19719
19290
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
19720
- queue.push(path34.join(currentDir, entry.name));
19291
+ queue.push(path32.join(currentDir, entry.name));
19721
19292
  }
19722
19293
  }
19723
19294
  } catch {
@@ -19728,22 +19299,22 @@ var AgentArtifactDetectionService = class {
19728
19299
  };
19729
19300
 
19730
19301
  // apps/cli/src/infra/commands/config/configAgentsHandler.ts
19731
- var readline4 = __toESM(require("readline"));
19732
- var inquirer2 = __toESM(require("inquirer"));
19302
+ var readline3 = __toESM(require("readline"));
19303
+ var inquirer = __toESM(require("inquirer"));
19733
19304
 
19734
19305
  // apps/cli/src/infra/commands/config/agents/agentsHandlerUtils.ts
19735
- var path35 = __toESM(require("path"));
19736
- var fs27 = __toESM(require("fs/promises"));
19306
+ var path33 = __toESM(require("path"));
19307
+ var fs25 = __toESM(require("fs/promises"));
19737
19308
  function getRelativePath(dir, startDirectory) {
19738
19309
  if (dir === startDirectory) return "./packmind.json";
19739
- return "./" + path35.relative(startDirectory, dir) + "/packmind.json";
19310
+ return "./" + path33.relative(startDirectory, dir) + "/packmind.json";
19740
19311
  }
19741
19312
  async function resolveStartDirectory(args2, getCwd, exit) {
19742
19313
  let startDirectory = getCwd();
19743
19314
  if (args2.path) {
19744
- const resolvedPath = path35.resolve(getCwd(), args2.path);
19315
+ const resolvedPath = path33.resolve(getCwd(), args2.path);
19745
19316
  try {
19746
- const stat9 = await fs27.stat(resolvedPath);
19317
+ const stat9 = await fs25.stat(resolvedPath);
19747
19318
  if (!stat9.isDirectory()) {
19748
19319
  logErrorConsole(`Path is not a directory: ${resolvedPath}`);
19749
19320
  exit(1);
@@ -19805,9 +19376,9 @@ async function configAgentsHandler(deps) {
19805
19376
  }));
19806
19377
  let selectedAgents;
19807
19378
  if (useSimplePrompt) {
19808
- selectedAgents = await promptAgentsWithReadline2(choices);
19379
+ selectedAgents = await promptAgentsWithReadline(choices);
19809
19380
  } else {
19810
- const result = await inquirer2.default.prompt([
19381
+ const result = await inquirer.default.prompt([
19811
19382
  {
19812
19383
  type: "checkbox",
19813
19384
  name: "selectedAgents",
@@ -19838,10 +19409,10 @@ async function configAgentsHandler(deps) {
19838
19409
  );
19839
19410
  }
19840
19411
  }
19841
- async function promptAgentsWithReadline2(choices) {
19412
+ async function promptAgentsWithReadline(choices) {
19842
19413
  const input = process.stdin;
19843
19414
  const output = process.stdout;
19844
- const rl = readline4.createInterface({
19415
+ const rl = readline3.createInterface({
19845
19416
  input,
19846
19417
  output
19847
19418
  });
@@ -19910,12 +19481,30 @@ async function propagateAgentsToDescendants(configRepository, baseDirectory, sel
19910
19481
  }
19911
19482
 
19912
19483
  // apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
19913
- var readline5 = __toESM(require("readline"));
19914
- var import_cmd_ts35 = __toESM(require_cjs());
19484
+ var readline4 = __toESM(require("readline"));
19485
+ var import_cmd_ts34 = __toESM(require_cjs());
19915
19486
 
19916
19487
  // apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
19917
- var import_cmd_ts34 = __toESM(require_cjs());
19918
- var agentNamesPositional = (0, import_cmd_ts34.restPositionals)({
19488
+ var import_cmd_ts33 = __toESM(require_cjs());
19489
+
19490
+ // apps/cli/src/infra/commands/customParameters/AgentArgType.ts
19491
+ var VALID_AGENTS = Object.keys(CodingAgents).filter(
19492
+ (a) => a !== "packmind"
19493
+ );
19494
+ var AgentArgType = {
19495
+ from: async (input) => {
19496
+ const normalized = input.toLowerCase();
19497
+ if (VALID_AGENTS.includes(normalized)) {
19498
+ return normalized;
19499
+ }
19500
+ throw new Error(
19501
+ `Invalid agent '${input}'. Valid options are: ${VALID_AGENTS.join(", ")}`
19502
+ );
19503
+ }
19504
+ };
19505
+
19506
+ // apps/cli/src/infra/commands/customParameters/AgentNamesPositional.ts
19507
+ var agentNamesPositional = (0, import_cmd_ts33.restPositionals)({
19919
19508
  type: AgentArgType,
19920
19509
  displayName: "agents",
19921
19510
  description: "Agent identifiers (e.g. claude cursor)"
@@ -20011,7 +19600,7 @@ To restore organization settings later, remove all local agents with: packmind-c
20011
19600
  // apps/cli/src/infra/commands/config/ConfigAgentsAddCommand.ts
20012
19601
  function createPromptConfirm() {
20013
19602
  return (message) => new Promise((resolve15) => {
20014
- const rl = readline5.createInterface({
19603
+ const rl = readline4.createInterface({
20015
19604
  input: process.stdin,
20016
19605
  output: process.stdout
20017
19606
  });
@@ -20021,12 +19610,12 @@ function createPromptConfirm() {
20021
19610
  });
20022
19611
  });
20023
19612
  }
20024
- var addAgentsCommand = (0, import_cmd_ts35.command)({
19613
+ var addAgentsCommand = (0, import_cmd_ts34.command)({
20025
19614
  name: "add",
20026
19615
  description: "Add coding agents to packmind.json files",
20027
19616
  args: {
20028
- path: (0, import_cmd_ts35.option)({
20029
- type: import_cmd_ts35.string,
19617
+ path: (0, import_cmd_ts34.option)({
19618
+ type: import_cmd_ts34.string,
20030
19619
  short: "p",
20031
19620
  long: "path",
20032
19621
  defaultValue: () => "",
@@ -20052,7 +19641,7 @@ var addAgentsCommand = (0, import_cmd_ts35.command)({
20052
19641
  });
20053
19642
 
20054
19643
  // apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
20055
- var import_cmd_ts36 = __toESM(require_cjs());
19644
+ var import_cmd_ts35 = __toESM(require_cjs());
20056
19645
 
20057
19646
  // apps/cli/src/infra/commands/config/agents/listAgentsHandler.ts
20058
19647
  var SOURCE_LABELS = {
@@ -20132,12 +19721,12 @@ async function listAgentsHandler(args2, deps) {
20132
19721
  }
20133
19722
 
20134
19723
  // apps/cli/src/infra/commands/config/ConfigAgentsListCommand.ts
20135
- var listAgentsCommand = (0, import_cmd_ts36.command)({
19724
+ var listAgentsCommand = (0, import_cmd_ts35.command)({
20136
19725
  name: "list",
20137
19726
  description: "List coding agents configured across packmind.json files",
20138
19727
  args: {
20139
- path: (0, import_cmd_ts36.option)({
20140
- type: import_cmd_ts36.string,
19728
+ path: (0, import_cmd_ts35.option)({
19729
+ type: import_cmd_ts35.string,
20141
19730
  short: "p",
20142
19731
  long: "path",
20143
19732
  defaultValue: () => "",
@@ -20161,7 +19750,7 @@ var listAgentsCommand = (0, import_cmd_ts36.command)({
20161
19750
  });
20162
19751
 
20163
19752
  // apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
20164
- var import_cmd_ts37 = __toESM(require_cjs());
19753
+ var import_cmd_ts36 = __toESM(require_cjs());
20165
19754
 
20166
19755
  // apps/cli/src/infra/commands/config/agents/removeAgentsHandler.ts
20167
19756
  async function removeAgentsHandler(args2, deps) {
@@ -20244,13 +19833,13 @@ function logConfiguredAgentsHint(configuredAgents) {
20244
19833
  }
20245
19834
 
20246
19835
  // apps/cli/src/infra/commands/config/ConfigAgentsRemoveCommand.ts
20247
- var removeAgentsCommand = (0, import_cmd_ts37.command)({
19836
+ var removeAgentsCommand = (0, import_cmd_ts36.command)({
20248
19837
  name: "rm",
20249
19838
  aliases: ["remove"],
20250
19839
  description: "Remove coding agents from packmind.json files",
20251
19840
  args: {
20252
- path: (0, import_cmd_ts37.option)({
20253
- type: import_cmd_ts37.string,
19841
+ path: (0, import_cmd_ts36.option)({
19842
+ type: import_cmd_ts36.string,
20254
19843
  short: "p",
20255
19844
  long: "path",
20256
19845
  defaultValue: () => "",
@@ -20272,7 +19861,7 @@ var removeAgentsCommand = (0, import_cmd_ts37.command)({
20272
19861
  });
20273
19862
 
20274
19863
  // apps/cli/src/infra/commands/config/ConfigAgentsCommand.ts
20275
- var configAgentsSetupCommand = (0, import_cmd_ts38.command)({
19864
+ var configAgentsSetupCommand = (0, import_cmd_ts37.command)({
20276
19865
  name: "setup",
20277
19866
  description: "Configure which coding agents to generate artifacts for",
20278
19867
  args: {},
@@ -20290,7 +19879,7 @@ var configAgentsSetupCommand = (0, import_cmd_ts38.command)({
20290
19879
  });
20291
19880
  }
20292
19881
  });
20293
- var configAgentsCommand = (0, import_cmd_ts38.subcommands)({
19882
+ var configAgentsCommand = (0, import_cmd_ts37.subcommands)({
20294
19883
  name: "agents",
20295
19884
  description: "Manage coding agents configuration",
20296
19885
  cmds: {
@@ -20302,7 +19891,7 @@ var configAgentsCommand = (0, import_cmd_ts38.subcommands)({
20302
19891
  });
20303
19892
 
20304
19893
  // apps/cli/src/infra/commands/config/ConfigCommand.ts
20305
- var configCommand = (0, import_cmd_ts39.subcommands)({
19894
+ var configCommand = (0, import_cmd_ts38.subcommands)({
20306
19895
  name: "config",
20307
19896
  description: "Manage Packmind configuration",
20308
19897
  cmds: {
@@ -20311,7 +19900,7 @@ var configCommand = (0, import_cmd_ts39.subcommands)({
20311
19900
  });
20312
19901
 
20313
19902
  // apps/cli/src/infra/commands/InitCommand.ts
20314
- var import_cmd_ts40 = __toESM(require_cjs());
19903
+ var import_cmd_ts39 = __toESM(require_cjs());
20315
19904
 
20316
19905
  // apps/cli/src/infra/commands/initHandler.ts
20317
19906
  async function initHandler(deps) {
@@ -20373,7 +19962,7 @@ async function initHandler(deps) {
20373
19962
 
20374
19963
  // apps/cli/src/infra/commands/InitCommand.ts
20375
19964
  var { version: CLI_VERSION4 } = require_package();
20376
- var initCommand = (0, import_cmd_ts40.command)({
19965
+ var initCommand = (0, import_cmd_ts39.command)({
20377
19966
  name: "init",
20378
19967
  description: "Initialize Packmind in the current project",
20379
19968
  args: {},
@@ -20401,13 +19990,13 @@ var initCommand = (0, import_cmd_ts40.command)({
20401
19990
  });
20402
19991
 
20403
19992
  // apps/cli/src/infra/commands/UpdateCommand.ts
20404
- var import_cmd_ts41 = __toESM(require_cjs());
19993
+ var import_cmd_ts40 = __toESM(require_cjs());
20405
19994
  var { version: CLI_VERSION5 } = require_package();
20406
- var updateCommand = (0, import_cmd_ts41.command)({
19995
+ var updateCommand = (0, import_cmd_ts40.command)({
20407
19996
  name: "update",
20408
19997
  description: "Update packmind-cli to the latest version",
20409
19998
  args: {
20410
- check: (0, import_cmd_ts41.flag)({
19999
+ check: (0, import_cmd_ts40.flag)({
20411
20000
  long: "check",
20412
20001
  description: "Only check if a newer version is available without performing the update"
20413
20002
  })
@@ -20432,20 +20021,20 @@ function findEnvFile() {
20432
20021
  const currentDir = process.cwd();
20433
20022
  const gitService = new GitService();
20434
20023
  const gitRoot = gitService.getGitRepositoryRootSync(currentDir);
20435
- const filesystemRoot = path36.parse(currentDir).root;
20024
+ const filesystemRoot = path34.parse(currentDir).root;
20436
20025
  const stopDir = gitRoot ?? filesystemRoot;
20437
20026
  let searchDir = currentDir;
20438
- let parentDir = path36.dirname(searchDir);
20027
+ let parentDir = path34.dirname(searchDir);
20439
20028
  while (searchDir !== parentDir) {
20440
- const envPath2 = path36.join(searchDir, ".env");
20441
- if (fs28.existsSync(envPath2)) {
20029
+ const envPath2 = path34.join(searchDir, ".env");
20030
+ if (fs26.existsSync(envPath2)) {
20442
20031
  return envPath2;
20443
20032
  }
20444
20033
  if (searchDir === stopDir) {
20445
20034
  return null;
20446
20035
  }
20447
20036
  searchDir = parentDir;
20448
- parentDir = path36.dirname(searchDir);
20037
+ parentDir = path34.dirname(searchDir);
20449
20038
  }
20450
20039
  return null;
20451
20040
  }
@@ -20465,7 +20054,7 @@ if (args.includes("--version") || args.includes("-v")) {
20465
20054
  logConsole(`packmind-cli version ${CLI_VERSION6}`);
20466
20055
  process.exit(0);
20467
20056
  }
20468
- var app = (0, import_cmd_ts42.subcommands)({
20057
+ var app = (0, import_cmd_ts41.subcommands)({
20469
20058
  name: "packmind-cli",
20470
20059
  description: "Packmind CLI tool",
20471
20060
  cmds: {
@@ -20479,7 +20068,6 @@ var app = (0, import_cmd_ts42.subcommands)({
20479
20068
  logout: logoutCommand,
20480
20069
  packages: packagesCommand,
20481
20070
  playbook: playbookCommand,
20482
- "setup-mcp": setupMcpCommand,
20483
20071
  skills: skillsCommand,
20484
20072
  spaces: spacesCommand,
20485
20073
  standards: standardsCommand,
@@ -20488,7 +20076,7 @@ var app = (0, import_cmd_ts42.subcommands)({
20488
20076
  whoami: whoamiCommand
20489
20077
  }
20490
20078
  });
20491
- (0, import_cmd_ts42.run)(app, args).catch((error) => {
20079
+ (0, import_cmd_ts41.run)(app, args).catch((error) => {
20492
20080
  logErrorConsole(error.message);
20493
20081
  process.exit(1);
20494
20082
  });