agents-inc 0.175.0 → 0.177.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 (104) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +2 -2
  3. package/dist/chunk-2FE4AJNC.js +164 -0
  4. package/dist/chunk-2FE4AJNC.js.map +1 -0
  5. package/dist/{chunk-U46LYYRA.js → chunk-4SIBDIIO.js} +49 -13
  6. package/dist/chunk-4SIBDIIO.js.map +1 -0
  7. package/dist/chunk-5ZK4IND4.js +30 -0
  8. package/dist/chunk-5ZK4IND4.js.map +1 -0
  9. package/dist/{chunk-GNMRXXRY.js → chunk-77SHXTDD.js} +137 -56
  10. package/dist/chunk-77SHXTDD.js.map +1 -0
  11. package/dist/{chunk-EHEBN4NB.js → chunk-7OJ2SS4E.js} +10 -86
  12. package/dist/chunk-7OJ2SS4E.js.map +1 -0
  13. package/dist/{chunk-6HJVH27C.js → chunk-7WN6TUZP.js} +7 -8
  14. package/dist/chunk-7WN6TUZP.js.map +1 -0
  15. package/dist/chunk-AVKX3IXF.js +117 -0
  16. package/dist/chunk-AVKX3IXF.js.map +1 -0
  17. package/dist/{chunk-YM3VEDAP.js → chunk-D2PC7NIR.js} +2042 -1875
  18. package/dist/chunk-D2PC7NIR.js.map +1 -0
  19. package/dist/{chunk-37QFHJUW.js → chunk-E6W3PYGF.js} +909 -80
  20. package/dist/chunk-E6W3PYGF.js.map +1 -0
  21. package/dist/chunk-H33ZAEKH.js +147 -0
  22. package/dist/chunk-H33ZAEKH.js.map +1 -0
  23. package/dist/{chunk-MFCZARV2.js → chunk-JEFVFZAR.js} +50 -152
  24. package/dist/chunk-JEFVFZAR.js.map +1 -0
  25. package/dist/{chunk-TG3SPPZY.js → chunk-KKGJH46C.js} +3 -21
  26. package/dist/chunk-KKGJH46C.js.map +1 -0
  27. package/dist/chunk-OIQKRXHH.js +142 -0
  28. package/dist/chunk-OIQKRXHH.js.map +1 -0
  29. package/dist/{chunk-SNXEYAFP.js → chunk-TNN72UL6.js} +294 -247
  30. package/dist/chunk-TNN72UL6.js.map +1 -0
  31. package/dist/{chunk-Q4NWATGH.js → chunk-V3WJMNBF.js} +98 -23
  32. package/dist/chunk-V3WJMNBF.js.map +1 -0
  33. package/dist/chunk-VFD2XYM7.js +14 -0
  34. package/dist/chunk-VFD2XYM7.js.map +1 -0
  35. package/dist/{chunk-XYBHH3M5.js → chunk-WH7JXGDA.js} +2 -2
  36. package/dist/{chunk-DQB3E2SX.js → chunk-XSR4WRXJ.js} +3 -3
  37. package/dist/{chunk-EGC7PNDI.js → chunk-Y5VMB73R.js} +302 -119
  38. package/dist/chunk-Y5VMB73R.js.map +1 -0
  39. package/dist/chunk-ZIBWVTLN.js +18 -0
  40. package/dist/chunk-ZIBWVTLN.js.map +1 -0
  41. package/dist/commands/build/marketplace.js +6 -9
  42. package/dist/commands/build/marketplace.js.map +1 -1
  43. package/dist/commands/build/plugins.js +10 -38
  44. package/dist/commands/build/plugins.js.map +1 -1
  45. package/dist/commands/compile.js +64 -81
  46. package/dist/commands/compile.js.map +1 -1
  47. package/dist/commands/doctor.js +266 -153
  48. package/dist/commands/doctor.js.map +1 -1
  49. package/dist/commands/edit.js +84 -158
  50. package/dist/commands/edit.js.map +1 -1
  51. package/dist/commands/eject.js +66 -52
  52. package/dist/commands/eject.js.map +1 -1
  53. package/dist/commands/init.js +19 -16
  54. package/dist/commands/list.js +13 -13
  55. package/dist/commands/list.js.map +1 -1
  56. package/dist/commands/new/marketplace.js +5 -4
  57. package/dist/commands/new/marketplace.js.map +1 -1
  58. package/dist/commands/search.js +18 -12
  59. package/dist/commands/search.js.map +1 -1
  60. package/dist/commands/share.js +27 -52
  61. package/dist/commands/share.js.map +1 -1
  62. package/dist/commands/uninstall.js +145 -58
  63. package/dist/commands/uninstall.js.map +1 -1
  64. package/dist/commands/update.js +101 -36
  65. package/dist/commands/update.js.map +1 -1
  66. package/dist/components/common/header-row.js +9 -0
  67. package/dist/components/common/select-list.js +2 -2
  68. package/dist/components/common/skill-agent-summary.js +4 -3
  69. package/dist/components/common/summary-panel.js +6 -4
  70. package/dist/hooks/init.js +35 -21
  71. package/dist/hooks/init.js.map +1 -1
  72. package/dist/load-agent-defs-OCFWOZD2.js +14 -0
  73. package/dist/{recompile-project-agents-2QTFMYDC.js → recompile-project-agents-CXZBPIUS.js} +9 -9
  74. package/dist/{recompile-project-agents-2QTFMYDC.js.map → recompile-project-agents-CXZBPIUS.js.map} +1 -1
  75. package/dist/{source-loader-I6SWWDUF.js → source-loader-GGDQDMN4.js} +6 -4
  76. package/dist/source-loader-GGDQDMN4.js.map +1 -0
  77. package/package.json +1 -1
  78. package/src/schemas/stacks.schema.json +105 -1
  79. package/dist/chunk-37QFHJUW.js.map +0 -1
  80. package/dist/chunk-6HJVH27C.js.map +0 -1
  81. package/dist/chunk-EGC7PNDI.js.map +0 -1
  82. package/dist/chunk-EHEBN4NB.js.map +0 -1
  83. package/dist/chunk-GNMRXXRY.js.map +0 -1
  84. package/dist/chunk-ICHWAFAC.js +0 -263
  85. package/dist/chunk-ICHWAFAC.js.map +0 -1
  86. package/dist/chunk-MFCZARV2.js.map +0 -1
  87. package/dist/chunk-P5XEK7HC.js +0 -35
  88. package/dist/chunk-P5XEK7HC.js.map +0 -1
  89. package/dist/chunk-Q4NWATGH.js.map +0 -1
  90. package/dist/chunk-SI2LLEIR.js +0 -160
  91. package/dist/chunk-SI2LLEIR.js.map +0 -1
  92. package/dist/chunk-SNXEYAFP.js.map +0 -1
  93. package/dist/chunk-SRII2GMF.js +0 -428
  94. package/dist/chunk-SRII2GMF.js.map +0 -1
  95. package/dist/chunk-TG3SPPZY.js.map +0 -1
  96. package/dist/chunk-U46LYYRA.js.map +0 -1
  97. package/dist/chunk-YLFKFVQP.js +0 -39
  98. package/dist/chunk-YLFKFVQP.js.map +0 -1
  99. package/dist/chunk-YM3VEDAP.js.map +0 -1
  100. package/dist/load-agent-defs-BJ4KBKBA.js +0 -14
  101. /package/dist/{chunk-XYBHH3M5.js.map → chunk-WH7JXGDA.js.map} +0 -0
  102. /package/dist/{chunk-DQB3E2SX.js.map → chunk-XSR4WRXJ.js.map} +0 -0
  103. /package/dist/{load-agent-defs-BJ4KBKBA.js.map → components/common/header-row.js.map} +0 -0
  104. /package/dist/{source-loader-I6SWWDUF.js.map → load-agent-defs-OCFWOZD2.js.map} +0 -0
@@ -5,18 +5,19 @@ import {
5
5
  loadSource,
6
6
  mutateGlobal,
7
7
  writeProjectPartial
8
- } from "../chunk-SNXEYAFP.js";
9
- import "../chunk-Q4NWATGH.js";
10
- import "../chunk-DQB3E2SX.js";
11
- import "../chunk-SI2LLEIR.js";
12
- import "../chunk-GNMRXXRY.js";
8
+ } from "../chunk-TNN72UL6.js";
9
+ import "../chunk-V3WJMNBF.js";
10
+ import "../chunk-XSR4WRXJ.js";
11
+ import "../chunk-VFD2XYM7.js";
12
+ import "../chunk-5ZK4IND4.js";
13
+ import "../chunk-77SHXTDD.js";
13
14
  import {
14
15
  BaseCommand,
15
16
  EXIT_CODES,
16
17
  providerFlag,
17
- providerNamedBy,
18
- refuseAnAmbiguousInstallation
19
- } from "../chunk-37QFHJUW.js";
18
+ providerNamedBy
19
+ } from "../chunk-E6W3PYGF.js";
20
+ import "../chunk-2FE4AJNC.js";
20
21
  import {
21
22
  INCOMPLETE_WORK_RECOVERY,
22
23
  INFO_MESSAGES,
@@ -34,17 +35,18 @@ import {
34
35
  relativeConfigPath,
35
36
  resolveInstallPaths,
36
37
  resolveSource,
38
+ scopeAt,
37
39
  sourceFolderInUse
38
- } from "../chunk-YM3VEDAP.js";
40
+ } from "../chunk-D2PC7NIR.js";
39
41
  import {
40
42
  matrix,
41
43
  plural
42
- } from "../chunk-TG3SPPZY.js";
44
+ } from "../chunk-KKGJH46C.js";
43
45
  import {
44
46
  DIRS,
45
47
  PROJECT_ROOT,
46
48
  bytewise
47
- } from "../chunk-U46LYYRA.js";
49
+ } from "../chunk-4SIBDIIO.js";
48
50
  import "../chunk-GHHJYNAN.js";
49
51
 
50
52
  // src/cli/commands/eject.ts
@@ -106,11 +108,9 @@ var Eject = class _Eject extends BaseCommand {
106
108
  async run() {
107
109
  const { args, flags } = await this.parse(_Eject);
108
110
  const projectDir = process.cwd();
109
- await refuseAnAmbiguousInstallation(
110
- projectDir,
111
- "eject",
112
- providerNamedBy(flags.provider),
113
- (message) => this.error(message, { exit: EXIT_CODES.INVALID_ARGS })
111
+ await this.refuseAnAmbiguousInstallation(projectDir, "eject", providerNamedBy(flags.provider));
112
+ await this.sayWhenTheProjectsConfigDeclaresNothing(
113
+ INFO_MESSAGES.DECLARES_NOTHING_TO_EJECT_FROM
114
114
  );
115
115
  await this.ensureConfigReadable(projectDir);
116
116
  const ejectType = this.validateEjectType(args.type);
@@ -255,14 +255,15 @@ var Eject = class _Eject extends BaseCommand {
255
255
  );
256
256
  }
257
257
  async handleSkills(destinationDir, force, sourceResult) {
258
- const result = await ejectSkills({ destinationDir, force, sourceResult, matrix });
259
- if (result.skipped) {
260
- this.warn(result.skipReason);
258
+ if (sourceResult.marketplaceSkillIds.size === 0) {
259
+ this.warn("No skills found in the marketplace to eject.");
261
260
  return;
262
261
  }
263
- if (result.skippedSkillCount > 0) {
264
- this.warn(skillsAlreadyThere(destinationDir, result.skippedSkillCount));
262
+ const result = await ejectSkills({ destinationDir, force, sourceResult, matrix });
263
+ for (const warning of skillsLeftWarnings(destinationDir, result)) {
264
+ this.warn(warning);
265
265
  }
266
+ if (result.copiedSkills.length === 0) return;
266
267
  this.logSuccess(
267
268
  `${plural(result.copiedSkills.length, "skill")} ejected to ${destinationDir} from ${result.sourceLabel}`
268
269
  );
@@ -275,8 +276,21 @@ function expandHome(outputPath) {
275
276
  function subAgentsAlreadyThere(destDir, subAgents) {
276
277
  return `Agent partials already exist at ${destDir} \u2014 skipped ${plural(subAgents.length, "sub-agent")}: ${subAgents.join(", ")}. Use --force to overwrite them.`;
277
278
  }
278
- function skillsAlreadyThere(destinationDir, skippedCount) {
279
- return `Skills already exist at ${destinationDir} \u2014 skipped ${plural(skippedCount, "skill")}. Use --force to overwrite them.`;
279
+ function skillsLeftWarnings(destinationDir, { copiedSkills, alreadyThere, keptElsewhere }) {
280
+ return [
281
+ ...alreadyThereWarning(destinationDir, alreadyThere.length, copiedSkills.length > 0),
282
+ ...keptElsewhere.map(localCopyKept)
283
+ ];
284
+ }
285
+ function alreadyThereWarning(destinationDir, alreadyThereCount, copiedAny) {
286
+ if (alreadyThereCount === 0) return [];
287
+ if (!copiedAny) return [`Skills already exist at ${destinationDir}. Use --force to overwrite.`];
288
+ return [
289
+ `Skills already exist at ${destinationDir} \u2014 skipped ${plural(alreadyThereCount, "skill")}. Use --force to overwrite them.`
290
+ ];
291
+ }
292
+ function localCopyKept({ skillId, copyDir }) {
293
+ return `Skipped ${skillId}: its local copy at ${copyDir} stays as it is, even with --force.`;
280
294
  }
281
295
  async function alreadyIn(dir, names) {
282
296
  const checked = await Promise.all(
@@ -363,40 +377,40 @@ async function ejectSkills(options) {
363
377
  const marketplaceSkillIds = [...sourceResult.marketplaceSkillIds];
364
378
  const alreadyThere = force ? [] : await alreadyIn(destinationDir, marketplaceSkillIds);
365
379
  const notThere = marketplaceSkillIds.filter((skillId) => !alreadyThere.includes(skillId));
366
- const skillIds = notThere.filter(
367
- (skillId) => !isLocalCopyElsewhere(matrix2.skills[skillId], destinationDir)
368
- );
369
- if (skillIds.length === 0 && alreadyThere.length > 0) {
370
- return {
371
- skipped: true,
372
- skipReason: `Skills already exist at ${destinationDir}. Use --force to overwrite.`
373
- };
374
- }
375
- if (skillIds.length === 0) {
376
- return { skipped: true, skipReason: "No skills found in the marketplace to eject." };
377
- }
378
- await ensureDir(destinationDir);
379
- const copiedSkills = await copyMarketplaceSkillsToLocalFlattened(
380
- skillIds,
381
- destinationDir,
382
- sourceResult
383
- );
384
- const sourceLabel = sourceResult.isLocal ? sourceResult.sourcePath : sourceResult.marketplace || sourceResult.sourceConfig.source;
380
+ const keptElsewhere = localCopiesElsewhere(notThere, matrix2, destinationDir);
381
+ const keptIds = new Set(keptElsewhere.map(({ skillId }) => skillId));
382
+ const toCopy = notThere.filter((skillId) => !keptIds.has(skillId));
385
383
  return {
386
- skipped: false,
387
- copiedSkills,
388
- skippedSkillCount: alreadyThere.length,
389
- sourceLabel
384
+ copiedSkills: await copyInto(destinationDir, toCopy, sourceResult),
385
+ alreadyThere,
386
+ keptElsewhere,
387
+ sourceLabel: sourceLabelOf(sourceResult)
390
388
  };
391
389
  }
392
- function isLocalCopyElsewhere(skill, destinationDir) {
393
- if (!skill?.local) return false;
394
- if (!skill.localPath) return true;
395
- return path.resolve(skill.localPath) !== path.resolve(destinationDir, skill.id);
390
+ async function copyInto(destinationDir, skillIds, sourceResult) {
391
+ if (skillIds.length === 0) return [];
392
+ await ensureDir(destinationDir);
393
+ return copyMarketplaceSkillsToLocalFlattened(skillIds, destinationDir, sourceResult);
394
+ }
395
+ function sourceLabelOf(sourceResult) {
396
+ return sourceResult.isLocal ? sourceResult.sourcePath : sourceResult.marketplace || sourceResult.sourceConfig.source;
397
+ }
398
+ function localCopiesElsewhere(skillIds, matrix2, destinationDir) {
399
+ return skillIds.flatMap((skillId) => {
400
+ const copyDir = localCopyDirElsewhere(matrix2.skills[skillId], destinationDir);
401
+ return copyDir === void 0 ? [] : [{ skillId, copyDir }];
402
+ }).sort((a, b) => bytewise(a.skillId, b.skillId));
403
+ }
404
+ function localCopyDirElsewhere(skill, destinationDir) {
405
+ if (!skill?.local) return void 0;
406
+ if (skill.localPath === void 0) {
407
+ throw new Error(`Local skill '${skill.id}' was discovered without its directory`);
408
+ }
409
+ const copyDir = path.resolve(skill.localPath);
410
+ return copyDir === path.resolve(destinationDir, skill.id) ? void 0 : copyDir;
396
411
  }
397
412
  function installedSkillsDir(projectDir) {
398
- const scope = isHomeDirectory(projectDir) ? "global" : "project";
399
- return resolveInstallPaths(projectDir, scope).skillsDir;
413
+ return resolveInstallPaths(projectDir, scopeAt(projectDir)).skillsDir;
400
414
  }
401
415
  async function ensureMinimalConfig(options) {
402
416
  const { projectDir, sourceResult } = options;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/commands/eject.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\nimport path from \"path\";\nimport os from \"os\";\nimport { BaseCommand } from \"../base-command.js\";\nimport {\n copy,\n ensureDir,\n directoryExists,\n fileExists,\n isSymlink,\n listDirectories,\n} from \"../utils/fs.js\";\nimport { DIRS, PROJECT_ROOT } from \"../consts.js\";\nimport {\n providerInUse,\n relativeConfigPath,\n sourceFolderInUse,\n} from \"../lib/installation/install-layout.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { type SourceLoadResult } from \"../lib/loading/index.js\";\nimport { loadSource } from \"../lib/operations/index.js\";\nimport { matrix } from \"../lib/matrix/matrix-provider\";\nimport { resolveSource, getProjectConfigPath } from \"../lib/configuration/index.js\";\nimport {\n ensureBlankPair,\n lazyGateDeps,\n mutateGlobal,\n writeProjectPartial,\n} from \"../lib/config-gate/index.js\";\nimport { isHomeDirectory, resolveInstallPaths } from \"../lib/installation/index.js\";\nimport {\n providerFlag,\n providerNamedBy,\n refuseAnAmbiguousInstallation,\n} from \"../lib/installation/provider-flag.js\";\nimport { copyMarketplaceSkillsToLocalFlattened, type CopiedSkill } from \"../lib/skills/index.js\";\nimport { INCOMPLETE_WORK_RECOVERY, INFO_MESSAGES } from \"../utils/messages.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { bytewise, plural } from \"../utils/string.js\";\nimport type { MergedSkillsMatrix, ResolvedSkill } from \"../types/index.js\";\n\nconst EJECT_TYPES = [\"agent-partials\", \"templates\", \"skills\", \"all\"] as const;\ntype EjectType = (typeof EJECT_TYPES)[number];\n\nfunction isEjectType(value: string): value is EjectType {\n return (EJECT_TYPES as readonly string[]).includes(value);\n}\n\n/** Skills come from the marketplace this installation reads, so only their ejects load it. */\ntype EjectPlan =\n | { type: \"agent-partials\" | \"templates\" }\n | { type: \"skills\" | \"all\"; sourceResult: SourceLoadResult };\n\nfunction loadedSourceOf(plan: EjectPlan): SourceLoadResult | undefined {\n return \"sourceResult\" in plan ? plan.sourceResult : undefined;\n}\n\nexport default class Eject extends BaseCommand {\n static summary = \"Eject skills, agent partials, or templates for local customization\";\n static description =\n \"Copy agent partials, templates, or skills to your project for customization. \" +\n \"Agent partials and templates are always copied from the CLI. \" +\n \"Skills are copied from the marketplace this installation is configured to read \" +\n \"(the public one by default).\";\n\n static examples = [\n {\n description: \"Eject agent partials for customization\",\n command: \"<%= config.bin %> <%= command.id %> agent-partials\",\n },\n {\n description: \"Eject only agent templates\",\n command: \"<%= config.bin %> <%= command.id %> templates\",\n },\n {\n description: \"Eject skills to local directory\",\n command: \"<%= config.bin %> <%= command.id %> skills\",\n },\n {\n description: \"Eject everything with force overwrite\",\n command: \"<%= config.bin %> <%= command.id %> all --force\",\n },\n {\n description: \"Eject to a custom output directory\",\n command: \"<%= config.bin %> <%= command.id %> skills -o ./custom-dir\",\n },\n ];\n\n static args = {\n type: Args.string({\n description: \"What to eject: agent-partials, templates, skills, all\",\n required: false,\n options: [...EJECT_TYPES],\n }),\n };\n\n static flags = {\n provider: providerFlag(),\n force: Flags.boolean({\n char: \"f\",\n description: \"Overwrite existing files\",\n default: false,\n }),\n output: Flags.string({\n char: \"o\",\n // No default: each eject type has its own destination and this replaces all three.\n description:\n \"Write everything into this directory instead of each eject type's own destination\",\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Eject);\n const projectDir = process.cwd();\n\n // Before the layout settle: this decides which installation that refusal is about.\n await refuseAnAmbiguousInstallation(\n projectDir,\n \"eject\",\n providerNamedBy(flags.provider),\n (message) => this.error(message, { exit: EXIT_CODES.INVALID_ARGS }),\n );\n\n // Before anything is copied, so a refusal never follows files already written.\n await this.ensureConfigReadable(projectDir);\n const ejectType = this.validateEjectType(args.type);\n const outputBase = await this.resolveOutputBase(flags, projectDir);\n\n this.printHeader(\n await this.resolveBrandingName(projectDir),\n flags.output ? outputBase : undefined,\n );\n\n const plan = await this.planEject(ejectType, projectDir);\n await this.executeEject(plan, outputBase, flags, projectDir);\n await this.ensureConfig(projectDir, loadedSourceOf(plan));\n\n this.reportEnding();\n }\n\n /** Withholds `Eject complete!` when part of the eject did not land. */\n private reportEnding(): void {\n this.log(\"\");\n if (!this.hasIncompleteWork) this.logSuccess(\"Eject complete!\");\n this.log(\"\");\n\n this.exitIfWorkIncomplete();\n }\n\n private validateEjectType(typeArg: string | undefined): EjectType {\n if (!typeArg) {\n this.error(\"Please specify what to eject: agent-partials, templates, skills, or all\", {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n if (!isEjectType(typeArg)) {\n this.error(`Unknown eject type: ${typeArg}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n return typeArg;\n }\n\n private async resolveOutputBase(\n flags: { output: string | undefined },\n projectDir: string,\n ): Promise<string> {\n if (!flags.output) return sourceFolderInUse(projectDir, providerInUse(projectDir)).dir;\n\n const outputBase = path.resolve(projectDir, expandHome(flags.output));\n await this.refuseUnwritableOutput(outputBase);\n return outputBase;\n }\n\n private async refuseUnwritableOutput(outputBase: string): Promise<void> {\n // First, as the checks below follow a link, and so would every write.\n if (await isSymlink(outputBase)) {\n this.error(`Output path is a link: ${outputBase}. Name the folder it points to instead.`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n // `fileExists` is true of a directory too; an existing directory is written into, and each\n // kind then skips what it would write there already unless --force.\n const namesAFile = (await fileExists(outputBase)) && !(await directoryExists(outputBase));\n if (namesAFile) {\n this.error(`Output path exists as a file: ${outputBase}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n }\n\n private printHeader(brandingName: string, outputBase?: string): void {\n this.log(\"\");\n this.log(`${brandingName} Eject`);\n this.log(\"\");\n\n if (outputBase) {\n this.log(`Output directory: ${outputBase}`);\n }\n }\n\n private async planEject(type: EjectType, projectDir: string): Promise<EjectPlan> {\n if (type === \"agent-partials\" || type === \"templates\") return { type };\n\n const { sourceResult } = await loadSource({ projectDir });\n return { type, sourceResult };\n }\n\n private async executeEject(\n plan: EjectPlan,\n outputBase: string,\n flags: { force: boolean; output: string | undefined },\n projectDir: string,\n ): Promise<void> {\n const directOutput = !!flags.output;\n\n switch (plan.type) {\n case \"agent-partials\":\n await this.handleAgentPartials(outputBase, flags.force, directOutput, false);\n break;\n case \"templates\":\n await this.handleAgentPartials(outputBase, flags.force, directOutput, true);\n break;\n case \"skills\":\n await this.handleSkills(\n skillsDestination(projectDir, directOutput, outputBase),\n flags.force,\n plan.sourceResult,\n );\n break;\n case \"all\": {\n // The partials carry the templates as one unit, so they arrive once and obey --force.\n await this.handleAgentPartials(outputBase, flags.force, directOutput, false);\n await this.handleSkills(\n skillsDestination(projectDir, directOutput, outputBase),\n flags.force,\n plan.sourceResult,\n );\n break;\n }\n default: {\n const _exhaustive: never = plan;\n return _exhaustive;\n }\n }\n }\n\n /**\n * Writes a minimal config where there is none. A refusal is reported as incomplete work rather\n * than thrown, because the ejection has already landed.\n */\n private async ensureConfig(\n projectDir: string,\n sourceResult: SourceLoadResult | undefined,\n ): Promise<void> {\n // Named before the write, which may create the provider folder.\n const configTsRel = relativeConfigPath(projectDir, providerInUse(projectDir));\n\n try {\n const configResult = await ensureMinimalConfig({\n projectDir,\n ...(sourceResult !== undefined && { sourceResult }),\n });\n if (configResult.created) {\n this.logSuccess(`Created ${configTsRel}`);\n }\n } catch (error) {\n this.reportIncompleteWork(\n `Could not create ${configTsRel}: ${getErrorMessage(error)}`,\n INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION,\n );\n }\n }\n\n private async handleAgentPartials(\n outputBase: string,\n force: boolean,\n directOutput: boolean,\n templatesOnly: boolean,\n ): Promise<void> {\n const result = await ejectAgentPartials({\n outputBase,\n force,\n directOutput,\n templatesOnly,\n });\n\n if (result.skipped) {\n this.warn(result.skipReason);\n return;\n }\n\n if (result.skippedSubAgents.length > 0) {\n this.warn(subAgentsAlreadyThere(result.destDir, result.skippedSubAgents));\n }\n\n if (result.templatesSkipped) {\n this.warn(\n \"Agent templates already exist — skipping templates, only ejecting agent partials.\",\n );\n }\n\n this.logSuccess(\n `${templatesOnly ? \"Agent templates\" : \"Agent partials\"} ejected to ${result.destDir}`,\n );\n this.log(\n templatesOnly\n ? \"You can now customize agent templates locally.\"\n : INFO_MESSAGES.AGENT_PARTIALS_CUSTOMIZABLE,\n );\n }\n\n private async handleSkills(\n destinationDir: string,\n force: boolean,\n sourceResult: SourceLoadResult,\n ): Promise<void> {\n const result = await ejectSkills({ destinationDir, force, sourceResult, matrix });\n\n if (result.skipped) {\n this.warn(result.skipReason);\n return;\n }\n\n if (result.skippedSkillCount > 0) {\n this.warn(skillsAlreadyThere(destinationDir, result.skippedSkillCount));\n }\n\n this.logSuccess(\n `${plural(result.copiedSkills.length, \"skill\")} ejected to ${destinationDir} from ${result.sourceLabel}`,\n );\n this.log(\"You can now customize skill content locally.\");\n }\n}\n\nfunction expandHome(outputPath: string): string {\n return outputPath.startsWith(\"~\") ? path.join(os.homedir(), outputPath.slice(1)) : outputPath;\n}\n\n/** Some of what an eject copies was already there: named, with the rest copied beside it. */\nfunction subAgentsAlreadyThere(destDir: string, subAgents: readonly string[]): string {\n return `Agent partials already exist at ${destDir} — skipped ${plural(subAgents.length, \"sub-agent\")}: ${subAgents.join(\", \")}. Use --force to overwrite them.`;\n}\n\n/** Counted rather than named: a re-run into a nearly full folder skips most of the marketplace. */\nfunction skillsAlreadyThere(destinationDir: string, skippedCount: number): string {\n return `Skills already exist at ${destinationDir} — skipped ${plural(skippedCount, \"skill\")}. Use --force to overwrite them.`;\n}\n\n/** Those of `names` already at `dir`, file or folder: what an eject without --force leaves. */\nasync function alreadyIn<Name extends string>(\n dir: string,\n names: readonly Name[],\n): Promise<Name[]> {\n const checked = await Promise.all(\n names.map(async (name) => ({ name, there: await fileExists(path.join(dir, name)) })),\n );\n return checked.filter(({ there }) => there).map(({ name }) => name);\n}\n\ntype EjectAgentPartialsOptions = {\n outputBase: string;\n force: boolean;\n directOutput?: boolean;\n templatesOnly?: boolean;\n};\n\ntype EjectAgentPartialsResult =\n | {\n skipped: true;\n skipReason: string;\n }\n | {\n skipped: false;\n destDir: string;\n /** The sub-agents left as they were, by name, bytewise-sorted. */\n skippedSubAgents: string[];\n templatesSkipped: boolean;\n };\n\nfunction resolveEjectDestDir(\n outputBase: string,\n directOutput: boolean,\n templatesOnly: boolean,\n): string {\n if (directOutput) return outputBase;\n const agentsDir = path.join(outputBase, path.basename(DIRS.agents));\n return templatesOnly ? path.join(agentsDir, path.basename(DIRS.templates)) : agentsDir;\n}\n\nasync function ejectAgentPartials(\n options: EjectAgentPartialsOptions,\n): Promise<EjectAgentPartialsResult> {\n const { outputBase, force, directOutput = false, templatesOnly = false } = options;\n const destDir = resolveEjectDestDir(outputBase, directOutput, templatesOnly);\n\n return templatesOnly ? ejectTemplates(destDir, force) : ejectSubAgentPartials(destDir, force);\n}\n\n/** Whole or not at all: a templates folder already there is kept unless --force. */\nasync function ejectTemplates(destDir: string, force: boolean): Promise<EjectAgentPartialsResult> {\n const sourceDir = path.join(PROJECT_ROOT, DIRS.templates);\n\n if (!(await directoryExists(sourceDir))) {\n return { skipped: true, skipReason: \"No agent templates found in CLI.\" };\n }\n\n if ((await directoryExists(destDir)) && !force) {\n return {\n skipped: true,\n skipReason: `Agent templates already exist at ${destDir}. Use --force to overwrite.`,\n };\n }\n\n await ensureDir(destDir);\n await copy(sourceDir, destDir);\n return { skipped: false, destDir, skippedSubAgents: [], templatesSkipped: false };\n}\n\n/** Unit by unit: one already there is kept unless --force, and the rest are copied beside it. */\nasync function ejectSubAgentPartials(\n destDir: string,\n force: boolean,\n): Promise<EjectAgentPartialsResult> {\n const sourceDir = path.join(PROJECT_ROOT, DIRS.agents);\n\n if (!(await directoryExists(sourceDir))) {\n return { skipped: true, skipReason: \"No agent partials found in CLI.\" };\n }\n\n const units = await partialUnitsIn(sourceDir);\n const present = force ? [] : await alreadyIn(destDir, units);\n const absent = units.filter((unit) => !present.includes(unit));\n\n if (absent.length === 0) {\n return {\n skipped: true,\n skipReason: `Agent partials already exist at ${destDir}. Use --force to overwrite.`,\n };\n }\n\n await copyUnits(absent, sourceDir, destDir);\n\n return {\n skipped: false,\n destDir,\n skippedSubAgents: subAgentNames(present),\n templatesSkipped: present.some(isTemplatesUnit),\n };\n}\n\nconst TEMPLATES_UNIT = path.basename(DIRS.templates);\n\nfunction isTemplatesUnit(unit: string): boolean {\n return unit === TEMPLATES_UNIT;\n}\n\n/**\n * What a re-eject keeps or copies whole: each sub-agent's directory, as `<category>/<agent>`, and\n * the templates. A category folder is not one, so a file of the user's in it is written beside.\n */\nasync function partialUnitsIn(agentsSourceDir: string): Promise<string[]> {\n const entries = await listDirectories(agentsSourceDir);\n const categories = entries.filter((entry) => !isTemplatesUnit(entry));\n const subAgentDirs = await Promise.all(\n categories.map((category) => subAgentDirsOf(agentsSourceDir, category)),\n );\n return [...entries.filter(isTemplatesUnit), ...subAgentDirs.flat()];\n}\n\nasync function subAgentDirsOf(agentsSourceDir: string, category: string): Promise<string[]> {\n const agents = await listDirectories(path.join(agentsSourceDir, category));\n return agents.map((agent) => path.join(category, agent));\n}\n\n/** As the skipped-list warning names them: by directory name, bytewise-sorted. */\nfunction subAgentNames(units: readonly string[]): string[] {\n return units\n .filter((unit) => !isTemplatesUnit(unit))\n .map((unit) => path.basename(unit))\n .sort(bytewise);\n}\n\n/** `copy` makes the folders above each unit. */\nasync function copyUnits(\n units: readonly string[],\n sourceDir: string,\n destDir: string,\n): Promise<void> {\n for (const unit of units) {\n await copy(path.join(sourceDir, unit), path.join(destDir, unit));\n }\n}\n\nfunction skillsDestination(projectDir: string, directOutput: boolean, outputBase: string): string {\n return directOutput ? outputBase : installedSkillsDir(projectDir);\n}\n\ntype EjectSkillsOptions = {\n destinationDir: string;\n force: boolean;\n sourceResult: SourceLoadResult;\n matrix: MergedSkillsMatrix;\n};\n\ntype EjectSkillsResult =\n | {\n skipped: true;\n skipReason: string;\n }\n | {\n skipped: false;\n copiedSkills: CopiedSkill[];\n /** How many skills were left as they were. */\n skippedSkillCount: number;\n sourceLabel: string;\n };\n\n/**\n * Only the loaded marketplace's own skills, each copied from the marketplace: others' are not on\n * disk here. One already in the destination is skipped unless --force; a local copy anywhere else\n * is the user's own and is left out either way.\n */\nasync function ejectSkills(options: EjectSkillsOptions): Promise<EjectSkillsResult> {\n const { destinationDir, force, sourceResult, matrix } = options;\n\n const marketplaceSkillIds = [...sourceResult.marketplaceSkillIds];\n const alreadyThere = force ? [] : await alreadyIn(destinationDir, marketplaceSkillIds);\n const notThere = marketplaceSkillIds.filter((skillId) => !alreadyThere.includes(skillId));\n const skillIds = notThere.filter(\n (skillId) => !isLocalCopyElsewhere(matrix.skills[skillId], destinationDir),\n );\n\n if (skillIds.length === 0 && alreadyThere.length > 0) {\n return {\n skipped: true,\n skipReason: `Skills already exist at ${destinationDir}. Use --force to overwrite.`,\n };\n }\n\n if (skillIds.length === 0) {\n return { skipped: true, skipReason: \"No skills found in the marketplace to eject.\" };\n }\n\n await ensureDir(destinationDir);\n\n const copiedSkills = await copyMarketplaceSkillsToLocalFlattened(\n skillIds,\n destinationDir,\n sourceResult,\n );\n\n const sourceLabel = sourceResult.isLocal\n ? sourceResult.sourcePath\n : sourceResult.marketplace || sourceResult.sourceConfig.source;\n\n return {\n skipped: false,\n copiedSkills,\n skippedSkillCount: alreadyThere.length,\n sourceLabel,\n };\n}\n\n/** Local, and not the copy at `<destinationDir>/<id>`, which is where an eject writes the skill. */\nfunction isLocalCopyElsewhere(skill: ResolvedSkill | undefined, destinationDir: string): boolean {\n if (!skill?.local) return false;\n if (!skill.localPath) return true;\n return path.resolve(skill.localPath) !== path.resolve(destinationDir, skill.id);\n}\n\n/** Where the host of the installation `projectDir` roots reads skills. */\nfunction installedSkillsDir(projectDir: string): string {\n const scope = isHomeDirectory(projectDir) ? \"global\" : \"project\";\n return resolveInstallPaths(projectDir, scope).skillsDir;\n}\n\ntype EnsureMinimalConfigOptions = {\n projectDir: string;\n sourceResult?: SourceLoadResult;\n};\n\ntype EnsureMinimalConfigResult = {\n configPath: string;\n created: boolean;\n};\n\nasync function ensureMinimalConfig(\n options: EnsureMinimalConfigOptions,\n): Promise<EnsureMinimalConfigResult> {\n const { projectDir, sourceResult } = options;\n\n const provider = providerInUse(projectDir);\n const tsConfigPath = getProjectConfigPath(projectDir, provider);\n\n if (await fileExists(tsConfigPath)) {\n return { configPath: tsConfigPath, created: false };\n }\n\n // ABORT on an unreadable global config: the invented file would record a marketplace from nowhere.\n const resolvedConfig =\n sourceResult?.sourceConfig ?? (await resolveSource({ caller: \"stored\", projectDir }));\n const source = resolvedConfig.source || undefined;\n\n // At home the invented config is the global manifest, which needs its config-types sibling.\n if (isHomeDirectory(projectDir)) {\n await ensureBlankPair(provider);\n if (source) await recordSourceInGlobal(projectDir, source);\n return { configPath: tsConfigPath, created: true };\n }\n\n await writeProjectPartial(\n projectDir,\n {\n skills: [],\n agents: [],\n ...(source ? { marketplace: source } : {}),\n ...(resolvedConfig.marketplace ? { marketplaceName: resolvedConfig.marketplace } : {}),\n },\n { fallbackName: path.basename(projectDir) },\n );\n\n return { configPath: tsConfigPath, created: true };\n}\n\n/** At home the config is the global manifest projects inline from, so it goes through the gate. */\nasync function recordSourceInGlobal(projectDir: string, source: string): Promise<void> {\n await mutateGlobal(\n { kind: \"set-source\", source, fallbackName: path.basename(projectDir) },\n lazyGateDeps(projectDir),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,aAAa;AAC5B,OAAO,UAAU;AACjB,OAAO,QAAQ;AAuCf,IAAM,cAAc,CAAC,kBAAkB,aAAa,UAAU,KAAK;AAGnE,SAAS,YAAY,OAAmC;AACtD,SAAQ,YAAkC,SAAS,KAAK;AAC1D;AAOA,SAAS,eAAe,MAA+C;AACrE,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AAC;AAAA,MACT,QAAQ,CAAC;AAAA,MACT,GAAI,SAAS,EAAE,aAAa,OAAO,IAAI,CAAC;AAAA,MACxC,GAAI,eAAe,cAAc,EAAE,iBAAiB,eAAe,YAAY,IAAI,CAAC;AAAA,IACtF;AAAA,IACA,EAAE,cAAc,KAAK,SAAS,UAAU,EAAE;AAAA,EAC5C;AAEA,SAAO,EAAE,YAAY,cAAc,SAAS,KAAK;AACnD;AAGA,eAAe,qBAAqB,YAAoB,QAA+B;AACrF,QAAM;AAAA,IACJ,EAAE,MAAM,cAAc,QAAQ,cAAc,KAAK,SAAS,UAAU,EAAE;AAAA,IACtE,aAAa,UAAU;AAAA,EACzB;AACF;","names":["matrix"]}
1
+ {"version":3,"sources":["../../src/cli/commands/eject.ts"],"sourcesContent":["import { Args, Flags } from \"@oclif/core\";\nimport path from \"path\";\nimport os from \"os\";\nimport { BaseCommand } from \"../base-command.js\";\nimport {\n copy,\n ensureDir,\n directoryExists,\n fileExists,\n isSymlink,\n listDirectories,\n} from \"../utils/fs.js\";\nimport { DIRS, PROJECT_ROOT } from \"../consts.js\";\nimport {\n providerInUse,\n relativeConfigPath,\n sourceFolderInUse,\n} from \"../lib/installation/install-layout.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { type SourceLoadResult } from \"../lib/loading/index.js\";\nimport { loadSource } from \"../lib/operations/index.js\";\nimport { matrix } from \"../lib/matrix/matrix-provider\";\nimport { resolveSource, getProjectConfigPath } from \"../lib/configuration/index.js\";\nimport {\n ensureBlankPair,\n lazyGateDeps,\n mutateGlobal,\n writeProjectPartial,\n} from \"../lib/config-gate/index.js\";\nimport { isHomeDirectory, resolveInstallPaths, scopeAt } from \"../lib/installation/index.js\";\nimport { providerFlag, providerNamedBy } from \"../lib/installation/provider-flag.js\";\nimport { copyMarketplaceSkillsToLocalFlattened, type CopiedSkill } from \"../lib/skills/index.js\";\nimport { INCOMPLETE_WORK_RECOVERY, INFO_MESSAGES } from \"../utils/messages.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { bytewise, plural } from \"../utils/string.js\";\nimport type { MergedSkillsMatrix, ResolvedSkill, SkillId } from \"../types/index.js\";\n\nconst EJECT_TYPES = [\"agent-partials\", \"templates\", \"skills\", \"all\"] as const;\ntype EjectType = (typeof EJECT_TYPES)[number];\n\nfunction isEjectType(value: string): value is EjectType {\n return (EJECT_TYPES as readonly string[]).includes(value);\n}\n\n/** Skills come from the marketplace this installation reads, so only their ejects load it. */\ntype EjectPlan =\n | { type: \"agent-partials\" | \"templates\" }\n | { type: \"skills\" | \"all\"; sourceResult: SourceLoadResult };\n\nfunction loadedSourceOf(plan: EjectPlan): SourceLoadResult | undefined {\n return \"sourceResult\" in plan ? plan.sourceResult : undefined;\n}\n\nexport default class Eject extends BaseCommand {\n static summary = \"Eject skills, agent partials, or templates for local customization\";\n static description =\n \"Copy agent partials, templates, or skills to your project for customization. \" +\n \"Agent partials and templates are always copied from the CLI. \" +\n \"Skills are copied from the marketplace this installation is configured to read \" +\n \"(the public one by default).\";\n\n static examples = [\n {\n description: \"Eject agent partials for customization\",\n command: \"<%= config.bin %> <%= command.id %> agent-partials\",\n },\n {\n description: \"Eject only agent templates\",\n command: \"<%= config.bin %> <%= command.id %> templates\",\n },\n {\n description: \"Eject skills to local directory\",\n command: \"<%= config.bin %> <%= command.id %> skills\",\n },\n {\n description: \"Eject everything with force overwrite\",\n command: \"<%= config.bin %> <%= command.id %> all --force\",\n },\n {\n description: \"Eject to a custom output directory\",\n command: \"<%= config.bin %> <%= command.id %> skills -o ./custom-dir\",\n },\n ];\n\n static args = {\n type: Args.string({\n description: \"What to eject: agent-partials, templates, skills, all\",\n required: false,\n options: [...EJECT_TYPES],\n }),\n };\n\n static flags = {\n provider: providerFlag(),\n force: Flags.boolean({\n char: \"f\",\n description: \"Overwrite existing files\",\n default: false,\n }),\n output: Flags.string({\n char: \"o\",\n // No default: each eject type has its own destination and this replaces all three.\n description:\n \"Write everything into this directory instead of each eject type's own destination\",\n }),\n };\n\n async run(): Promise<void> {\n const { args, flags } = await this.parse(Eject);\n const projectDir = process.cwd();\n\n // Before the layout settle: this decides which installation that refusal is about.\n await this.refuseAnAmbiguousInstallation(projectDir, \"eject\", providerNamedBy(flags.provider));\n await this.sayWhenTheProjectsConfigDeclaresNothing(\n INFO_MESSAGES.DECLARES_NOTHING_TO_EJECT_FROM,\n );\n\n // Before anything is copied, so a refusal never follows files already written.\n await this.ensureConfigReadable(projectDir);\n const ejectType = this.validateEjectType(args.type);\n const outputBase = await this.resolveOutputBase(flags, projectDir);\n\n this.printHeader(\n await this.resolveBrandingName(projectDir),\n flags.output ? outputBase : undefined,\n );\n\n const plan = await this.planEject(ejectType, projectDir);\n await this.executeEject(plan, outputBase, flags, projectDir);\n await this.ensureConfig(projectDir, loadedSourceOf(plan));\n\n this.reportEnding();\n }\n\n /** Withholds `Eject complete!` when part of the eject did not land. */\n private reportEnding(): void {\n this.log(\"\");\n if (!this.hasIncompleteWork) this.logSuccess(\"Eject complete!\");\n this.log(\"\");\n\n this.exitIfWorkIncomplete();\n }\n\n private validateEjectType(typeArg: string | undefined): EjectType {\n if (!typeArg) {\n this.error(\"Please specify what to eject: agent-partials, templates, skills, or all\", {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n if (!isEjectType(typeArg)) {\n this.error(`Unknown eject type: ${typeArg}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n return typeArg;\n }\n\n private async resolveOutputBase(\n flags: { output: string | undefined },\n projectDir: string,\n ): Promise<string> {\n if (!flags.output) return sourceFolderInUse(projectDir, providerInUse(projectDir)).dir;\n\n const outputBase = path.resolve(projectDir, expandHome(flags.output));\n await this.refuseUnwritableOutput(outputBase);\n return outputBase;\n }\n\n private async refuseUnwritableOutput(outputBase: string): Promise<void> {\n // First, as the checks below follow a link, and so would every write.\n if (await isSymlink(outputBase)) {\n this.error(`Output path is a link: ${outputBase}. Name the folder it points to instead.`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n\n // `fileExists` is true of a directory too; an existing directory is written into, and each\n // kind then skips what it would write there already unless --force.\n const namesAFile = (await fileExists(outputBase)) && !(await directoryExists(outputBase));\n if (namesAFile) {\n this.error(`Output path exists as a file: ${outputBase}`, {\n exit: EXIT_CODES.INVALID_ARGS,\n });\n }\n }\n\n private printHeader(brandingName: string, outputBase?: string): void {\n this.log(\"\");\n this.log(`${brandingName} Eject`);\n this.log(\"\");\n\n if (outputBase) {\n this.log(`Output directory: ${outputBase}`);\n }\n }\n\n private async planEject(type: EjectType, projectDir: string): Promise<EjectPlan> {\n if (type === \"agent-partials\" || type === \"templates\") return { type };\n\n const { sourceResult } = await loadSource({ projectDir });\n return { type, sourceResult };\n }\n\n private async executeEject(\n plan: EjectPlan,\n outputBase: string,\n flags: { force: boolean; output: string | undefined },\n projectDir: string,\n ): Promise<void> {\n const directOutput = !!flags.output;\n\n switch (plan.type) {\n case \"agent-partials\":\n await this.handleAgentPartials(outputBase, flags.force, directOutput, false);\n break;\n case \"templates\":\n await this.handleAgentPartials(outputBase, flags.force, directOutput, true);\n break;\n case \"skills\":\n await this.handleSkills(\n skillsDestination(projectDir, directOutput, outputBase),\n flags.force,\n plan.sourceResult,\n );\n break;\n case \"all\": {\n // The partials carry the templates as one unit, so they arrive once and obey --force.\n await this.handleAgentPartials(outputBase, flags.force, directOutput, false);\n await this.handleSkills(\n skillsDestination(projectDir, directOutput, outputBase),\n flags.force,\n plan.sourceResult,\n );\n break;\n }\n default: {\n const _exhaustive: never = plan;\n return _exhaustive;\n }\n }\n }\n\n /**\n * Writes a minimal config where there is none. A refusal is reported as incomplete work rather\n * than thrown, because the ejection has already landed.\n */\n private async ensureConfig(\n projectDir: string,\n sourceResult: SourceLoadResult | undefined,\n ): Promise<void> {\n // Named before the write, which may create the provider folder.\n const configTsRel = relativeConfigPath(projectDir, providerInUse(projectDir));\n\n try {\n const configResult = await ensureMinimalConfig({\n projectDir,\n ...(sourceResult !== undefined && { sourceResult }),\n });\n if (configResult.created) {\n this.logSuccess(`Created ${configTsRel}`);\n }\n } catch (error) {\n this.reportIncompleteWork(\n `Could not create ${configTsRel}: ${getErrorMessage(error)}`,\n INCOMPLETE_WORK_RECOVERY.INSPECT_INSTALLATION,\n );\n }\n }\n\n private async handleAgentPartials(\n outputBase: string,\n force: boolean,\n directOutput: boolean,\n templatesOnly: boolean,\n ): Promise<void> {\n const result = await ejectAgentPartials({\n outputBase,\n force,\n directOutput,\n templatesOnly,\n });\n\n if (result.skipped) {\n this.warn(result.skipReason);\n return;\n }\n\n if (result.skippedSubAgents.length > 0) {\n this.warn(subAgentsAlreadyThere(result.destDir, result.skippedSubAgents));\n }\n\n if (result.templatesSkipped) {\n this.warn(\n \"Agent templates already exist — skipping templates, only ejecting agent partials.\",\n );\n }\n\n this.logSuccess(\n `${templatesOnly ? \"Agent templates\" : \"Agent partials\"} ejected to ${result.destDir}`,\n );\n this.log(\n templatesOnly\n ? \"You can now customize agent templates locally.\"\n : INFO_MESSAGES.AGENT_PARTIALS_CUSTOMIZABLE,\n );\n }\n\n private async handleSkills(\n destinationDir: string,\n force: boolean,\n sourceResult: SourceLoadResult,\n ): Promise<void> {\n if (sourceResult.marketplaceSkillIds.size === 0) {\n this.warn(\"No skills found in the marketplace to eject.\");\n return;\n }\n\n const result = await ejectSkills({ destinationDir, force, sourceResult, matrix });\n\n for (const warning of skillsLeftWarnings(destinationDir, result)) {\n this.warn(warning);\n }\n if (result.copiedSkills.length === 0) return;\n\n this.logSuccess(\n `${plural(result.copiedSkills.length, \"skill\")} ejected to ${destinationDir} from ${result.sourceLabel}`,\n );\n this.log(\"You can now customize skill content locally.\");\n }\n}\n\nfunction expandHome(outputPath: string): string {\n return outputPath.startsWith(\"~\") ? path.join(os.homedir(), outputPath.slice(1)) : outputPath;\n}\n\n/** Some of what an eject copies was already there: named, with the rest copied beside it. */\nfunction subAgentsAlreadyThere(destDir: string, subAgents: readonly string[]): string {\n return `Agent partials already exist at ${destDir} — skipped ${plural(subAgents.length, \"sub-agent\")}: ${subAgents.join(\", \")}. Use --force to overwrite them.`;\n}\n\n/** Those already at the destination as one line, then each local copy elsewhere by name. */\nfunction skillsLeftWarnings(\n destinationDir: string,\n { copiedSkills, alreadyThere, keptElsewhere }: EjectSkillsResult,\n): string[] {\n return [\n ...alreadyThereWarning(destinationDir, alreadyThere.length, copiedSkills.length > 0),\n ...keptElsewhere.map(localCopyKept),\n ];\n}\n\n/** Counted rather than named: a re-run into a nearly full folder skips most of the marketplace. */\nfunction alreadyThereWarning(\n destinationDir: string,\n alreadyThereCount: number,\n copiedAny: boolean,\n): string[] {\n if (alreadyThereCount === 0) return [];\n if (!copiedAny) return [`Skills already exist at ${destinationDir}. Use --force to overwrite.`];\n return [\n `Skills already exist at ${destinationDir} — skipped ${plural(alreadyThereCount, \"skill\")}. Use --force to overwrite them.`,\n ];\n}\n\nfunction localCopyKept({ skillId, copyDir }: LocalCopyElsewhere): string {\n return `Skipped ${skillId}: its local copy at ${copyDir} stays as it is, even with --force.`;\n}\n\n/** Those of `names` already at `dir`, file or folder: what an eject without --force leaves. */\nasync function alreadyIn<Name extends string>(\n dir: string,\n names: readonly Name[],\n): Promise<Name[]> {\n const checked = await Promise.all(\n names.map(async (name) => ({ name, there: await fileExists(path.join(dir, name)) })),\n );\n return checked.filter(({ there }) => there).map(({ name }) => name);\n}\n\ntype EjectAgentPartialsOptions = {\n outputBase: string;\n force: boolean;\n directOutput?: boolean;\n templatesOnly?: boolean;\n};\n\ntype EjectAgentPartialsResult =\n | {\n skipped: true;\n skipReason: string;\n }\n | {\n skipped: false;\n destDir: string;\n /** The sub-agents left as they were, by name, bytewise-sorted. */\n skippedSubAgents: string[];\n templatesSkipped: boolean;\n };\n\nfunction resolveEjectDestDir(\n outputBase: string,\n directOutput: boolean,\n templatesOnly: boolean,\n): string {\n if (directOutput) return outputBase;\n const agentsDir = path.join(outputBase, path.basename(DIRS.agents));\n return templatesOnly ? path.join(agentsDir, path.basename(DIRS.templates)) : agentsDir;\n}\n\nasync function ejectAgentPartials(\n options: EjectAgentPartialsOptions,\n): Promise<EjectAgentPartialsResult> {\n const { outputBase, force, directOutput = false, templatesOnly = false } = options;\n const destDir = resolveEjectDestDir(outputBase, directOutput, templatesOnly);\n\n return templatesOnly ? ejectTemplates(destDir, force) : ejectSubAgentPartials(destDir, force);\n}\n\n/** Whole or not at all: a templates folder already there is kept unless --force. */\nasync function ejectTemplates(destDir: string, force: boolean): Promise<EjectAgentPartialsResult> {\n const sourceDir = path.join(PROJECT_ROOT, DIRS.templates);\n\n if (!(await directoryExists(sourceDir))) {\n return { skipped: true, skipReason: \"No agent templates found in CLI.\" };\n }\n\n if ((await directoryExists(destDir)) && !force) {\n return {\n skipped: true,\n skipReason: `Agent templates already exist at ${destDir}. Use --force to overwrite.`,\n };\n }\n\n await ensureDir(destDir);\n await copy(sourceDir, destDir);\n return { skipped: false, destDir, skippedSubAgents: [], templatesSkipped: false };\n}\n\n/** Unit by unit: one already there is kept unless --force, and the rest are copied beside it. */\nasync function ejectSubAgentPartials(\n destDir: string,\n force: boolean,\n): Promise<EjectAgentPartialsResult> {\n const sourceDir = path.join(PROJECT_ROOT, DIRS.agents);\n\n if (!(await directoryExists(sourceDir))) {\n return { skipped: true, skipReason: \"No agent partials found in CLI.\" };\n }\n\n const units = await partialUnitsIn(sourceDir);\n const present = force ? [] : await alreadyIn(destDir, units);\n const absent = units.filter((unit) => !present.includes(unit));\n\n if (absent.length === 0) {\n return {\n skipped: true,\n skipReason: `Agent partials already exist at ${destDir}. Use --force to overwrite.`,\n };\n }\n\n await copyUnits(absent, sourceDir, destDir);\n\n return {\n skipped: false,\n destDir,\n skippedSubAgents: subAgentNames(present),\n templatesSkipped: present.some(isTemplatesUnit),\n };\n}\n\nconst TEMPLATES_UNIT = path.basename(DIRS.templates);\n\nfunction isTemplatesUnit(unit: string): boolean {\n return unit === TEMPLATES_UNIT;\n}\n\n/**\n * What a re-eject keeps or copies whole: each sub-agent's directory, as `<category>/<agent>`, and\n * the templates. A category folder is not one, so a file of the user's in it is written beside.\n */\nasync function partialUnitsIn(agentsSourceDir: string): Promise<string[]> {\n const entries = await listDirectories(agentsSourceDir);\n const categories = entries.filter((entry) => !isTemplatesUnit(entry));\n const subAgentDirs = await Promise.all(\n categories.map((category) => subAgentDirsOf(agentsSourceDir, category)),\n );\n return [...entries.filter(isTemplatesUnit), ...subAgentDirs.flat()];\n}\n\nasync function subAgentDirsOf(agentsSourceDir: string, category: string): Promise<string[]> {\n const agents = await listDirectories(path.join(agentsSourceDir, category));\n return agents.map((agent) => path.join(category, agent));\n}\n\n/** As the skipped-list warning names them: by directory name, bytewise-sorted. */\nfunction subAgentNames(units: readonly string[]): string[] {\n return units\n .filter((unit) => !isTemplatesUnit(unit))\n .map((unit) => path.basename(unit))\n .sort(bytewise);\n}\n\n/** `copy` makes the folders above each unit. */\nasync function copyUnits(\n units: readonly string[],\n sourceDir: string,\n destDir: string,\n): Promise<void> {\n for (const unit of units) {\n await copy(path.join(sourceDir, unit), path.join(destDir, unit));\n }\n}\n\nfunction skillsDestination(projectDir: string, directOutput: boolean, outputBase: string): string {\n return directOutput ? outputBase : installedSkillsDir(projectDir);\n}\n\ntype EjectSkillsOptions = {\n destinationDir: string;\n force: boolean;\n sourceResult: SourceLoadResult;\n matrix: MergedSkillsMatrix;\n};\n\n/** The user's own copy of a skill, outside the folder an eject writes that skill to. */\ntype LocalCopyElsewhere = { skillId: SkillId; copyDir: string };\n\ntype EjectSkillsResult = {\n copiedSkills: CopiedSkill[];\n /** At the destination already, so left as they were; none under --force. */\n alreadyThere: SkillId[];\n /** Left out with or without --force; bytewise by id. */\n keptElsewhere: LocalCopyElsewhere[];\n sourceLabel: string;\n};\n\n/**\n * Only the loaded marketplace's own skills, each copied from the marketplace: others' are not on\n * disk here. One already in the destination is skipped unless --force; a local copy anywhere else\n * is the user's own and is left out either way.\n */\nasync function ejectSkills(options: EjectSkillsOptions): Promise<EjectSkillsResult> {\n const { destinationDir, force, sourceResult, matrix } = options;\n\n const marketplaceSkillIds = [...sourceResult.marketplaceSkillIds];\n const alreadyThere = force ? [] : await alreadyIn(destinationDir, marketplaceSkillIds);\n const notThere = marketplaceSkillIds.filter((skillId) => !alreadyThere.includes(skillId));\n const keptElsewhere = localCopiesElsewhere(notThere, matrix, destinationDir);\n const keptIds = new Set(keptElsewhere.map(({ skillId }) => skillId));\n const toCopy = notThere.filter((skillId) => !keptIds.has(skillId));\n\n return {\n copiedSkills: await copyInto(destinationDir, toCopy, sourceResult),\n alreadyThere,\n keptElsewhere,\n sourceLabel: sourceLabelOf(sourceResult),\n };\n}\n\n/** Makes no folder when there is nothing to copy. */\nasync function copyInto(\n destinationDir: string,\n skillIds: SkillId[],\n sourceResult: SourceLoadResult,\n): Promise<CopiedSkill[]> {\n if (skillIds.length === 0) return [];\n\n await ensureDir(destinationDir);\n return copyMarketplaceSkillsToLocalFlattened(skillIds, destinationDir, sourceResult);\n}\n\nfunction sourceLabelOf(sourceResult: SourceLoadResult): string {\n return sourceResult.isLocal\n ? sourceResult.sourcePath\n : sourceResult.marketplace || sourceResult.sourceConfig.source;\n}\n\nfunction localCopiesElsewhere(\n skillIds: readonly SkillId[],\n matrix: MergedSkillsMatrix,\n destinationDir: string,\n): LocalCopyElsewhere[] {\n return skillIds\n .flatMap((skillId) => {\n const copyDir = localCopyDirElsewhere(matrix.skills[skillId], destinationDir);\n return copyDir === undefined ? [] : [{ skillId, copyDir }];\n })\n .sort((a, b) => bytewise(a.skillId, b.skillId));\n}\n\n/** Its local copy's folder, unless that is `<destinationDir>/<id>`, where an eject writes it. */\nfunction localCopyDirElsewhere(\n skill: ResolvedSkill | undefined,\n destinationDir: string,\n): string | undefined {\n if (!skill?.local) return undefined;\n if (skill.localPath === undefined) {\n throw new Error(`Local skill '${skill.id}' was discovered without its directory`);\n }\n\n const copyDir = path.resolve(skill.localPath);\n return copyDir === path.resolve(destinationDir, skill.id) ? undefined : copyDir;\n}\n\n/** Where the host of the installation `projectDir` roots reads skills. */\nfunction installedSkillsDir(projectDir: string): string {\n return resolveInstallPaths(projectDir, scopeAt(projectDir)).skillsDir;\n}\n\ntype EnsureMinimalConfigOptions = {\n projectDir: string;\n sourceResult?: SourceLoadResult;\n};\n\ntype EnsureMinimalConfigResult = {\n configPath: string;\n created: boolean;\n};\n\nasync function ensureMinimalConfig(\n options: EnsureMinimalConfigOptions,\n): Promise<EnsureMinimalConfigResult> {\n const { projectDir, sourceResult } = options;\n\n const provider = providerInUse(projectDir);\n const tsConfigPath = getProjectConfigPath(projectDir, provider);\n\n if (await fileExists(tsConfigPath)) {\n return { configPath: tsConfigPath, created: false };\n }\n\n // ABORT on an unreadable global config: the invented file would record a marketplace from nowhere.\n const resolvedConfig =\n sourceResult?.sourceConfig ?? (await resolveSource({ caller: \"stored\", projectDir }));\n const source = resolvedConfig.source || undefined;\n\n // At home the invented config is the global manifest, which needs its config-types sibling.\n if (isHomeDirectory(projectDir)) {\n await ensureBlankPair(provider);\n if (source) await recordSourceInGlobal(projectDir, source);\n return { configPath: tsConfigPath, created: true };\n }\n\n await writeProjectPartial(\n projectDir,\n {\n skills: [],\n agents: [],\n ...(source ? { marketplace: source } : {}),\n ...(resolvedConfig.marketplace ? { marketplaceName: resolvedConfig.marketplace } : {}),\n },\n { fallbackName: path.basename(projectDir) },\n );\n\n return { configPath: tsConfigPath, created: true };\n}\n\n/** At home the config is the global manifest projects inline from, so it goes through the gate. */\nasync function recordSourceInGlobal(projectDir: string, source: string): Promise<void> {\n await mutateGlobal(\n { kind: \"set-source\", source, fallbackName: path.basename(projectDir) },\n lazyGateDeps(projectDir),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,aAAa;AAC5B,OAAO,UAAU;AACjB,OAAO,QAAQ;AAmCf,IAAM,cAAc,CAAC,kBAAkB,aAAa,UAAU,KAAK;AAGnE,SAAS,YAAY,OAAmC;AACtD,SAAQ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 +4,28 @@ import {
4
4
  Init,
5
5
  formatDashboardText,
6
6
  runDashboardFlow
7
- } from "../chunk-EGC7PNDI.js";
8
- import "../chunk-XYBHH3M5.js";
9
- import "../chunk-P5XEK7HC.js";
10
- import "../chunk-SRII2GMF.js";
7
+ } from "../chunk-Y5VMB73R.js";
8
+ import "../chunk-WH7JXGDA.js";
9
+ import "../chunk-AVKX3IXF.js";
11
10
  import "../chunk-OZXAJNLA.js";
12
11
  import "../chunk-P6CYS4JK.js";
13
- import "../chunk-6HJVH27C.js";
14
- import "../chunk-EHEBN4NB.js";
15
- import "../chunk-SNXEYAFP.js";
16
- import "../chunk-Q4NWATGH.js";
17
- import "../chunk-DQB3E2SX.js";
18
- import "../chunk-SI2LLEIR.js";
19
- import "../chunk-GNMRXXRY.js";
12
+ import "../chunk-7WN6TUZP.js";
13
+ import "../chunk-7OJ2SS4E.js";
14
+ import "../chunk-H33ZAEKH.js";
15
+ import "../chunk-TNN72UL6.js";
16
+ import "../chunk-V3WJMNBF.js";
17
+ import "../chunk-XSR4WRXJ.js";
18
+ import "../chunk-VFD2XYM7.js";
19
+ import "../chunk-5ZK4IND4.js";
20
+ import "../chunk-77SHXTDD.js";
20
21
  import "../chunk-KIK5EZYD.js";
21
- import "../chunk-ICHWAFAC.js";
22
- import "../chunk-37QFHJUW.js";
23
- import "../chunk-YM3VEDAP.js";
24
- import "../chunk-TG3SPPZY.js";
25
- import "../chunk-U46LYYRA.js";
22
+ import "../chunk-ZIBWVTLN.js";
23
+ import "../chunk-OIQKRXHH.js";
24
+ import "../chunk-E6W3PYGF.js";
25
+ import "../chunk-2FE4AJNC.js";
26
+ import "../chunk-D2PC7NIR.js";
27
+ import "../chunk-KKGJH46C.js";
28
+ import "../chunk-4SIBDIIO.js";
26
29
  import "../chunk-GHHJYNAN.js";
27
30
  export {
28
31
  Dashboard,
@@ -3,15 +3,20 @@ import {
3
3
  render
4
4
  } from "../chunk-KIK5EZYD.js";
5
5
  import {
6
- SkillAgentSummary,
7
- computeScopeDiff
8
- } from "../chunk-ICHWAFAC.js";
6
+ HeaderRow
7
+ } from "../chunk-ZIBWVTLN.js";
8
+ import {
9
+ SkillAgentSummary
10
+ } from "../chunk-OIQKRXHH.js";
9
11
  import {
10
12
  BaseCommand,
11
13
  otherInstallationsInThisScope,
12
14
  providerFlag,
13
15
  providerNamedBy
14
- } from "../chunk-37QFHJUW.js";
16
+ } from "../chunk-E6W3PYGF.js";
17
+ import {
18
+ computeScopeDiff
19
+ } from "../chunk-2FE4AJNC.js";
15
20
  import {
16
21
  INSTALL_MODE_LABELS,
17
22
  chooseProviderForThisRun,
@@ -19,25 +24,20 @@ import {
19
24
  formatInstallationDisplay,
20
25
  getInstallationInfo,
21
26
  loadProjectConfig
22
- } from "../chunk-YM3VEDAP.js";
27
+ } from "../chunk-D2PC7NIR.js";
23
28
  import {
24
29
  getSkillEntryDisplayName
25
- } from "../chunk-TG3SPPZY.js";
30
+ } from "../chunk-KKGJH46C.js";
26
31
  import {
27
- CLI_COLORS,
28
32
  CLI_INVOKE_COMMAND,
29
33
  DEFAULT_BRANDING
30
- } from "../chunk-U46LYYRA.js";
34
+ } from "../chunk-4SIBDIIO.js";
31
35
  import "../chunk-GHHJYNAN.js";
32
36
 
33
37
  // src/cli/commands/list.tsx
34
38
  import { useEffect } from "react";
35
- import { Box, Text, useApp } from "ink";
39
+ import { Box, useApp } from "ink";
36
40
  import { jsx, jsxs } from "react/jsx-runtime";
37
- var HeaderRow = ({ label, value }) => /* @__PURE__ */ jsxs(Box, { flexDirection: "row", columnGap: 1, children: [
38
- /* @__PURE__ */ jsx(Box, { flexShrink: 0, children: /* @__PURE__ */ jsx(Text, { color: CLI_COLORS.WARNING, bold: true, children: label }) }),
39
- /* @__PURE__ */ jsx(Text, { color: CLI_COLORS.NEUTRAL, children: value })
40
- ] });
41
41
  var ListView = ({ mode, source, skillConfigs, agentConfigs }) => {
42
42
  const { exit } = useApp();
43
43
  useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/commands/list.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\n\nimport { Box, Text, useApp } from \"ink\";\nimport { render } from \"../components/render.js\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport { CLI_INVOKE_COMMAND, CLI_COLORS, DEFAULT_BRANDING } from \"../consts.js\";\nimport { chooseProviderForThisRun } from \"../lib/installation/install-layout.js\";\nimport {\n otherInstallationsInThisScope,\n providerFlag,\n providerNamedBy,\n} from \"../lib/installation/provider-flag.js\";\nimport { getInstallationInfo, formatInstallationDisplay } from \"../lib/plugins/index.js\";\nimport {\n detectInstallation,\n INSTALL_MODE_LABELS,\n type Installation,\n} from \"../lib/installation/installation.js\";\nimport { loadProjectConfig } from \"../lib/configuration/project-config.js\";\nimport { computeScopeDiff, type SkillDiffRow } from \"../lib/configuration/scope-diff.js\";\nimport { getSkillEntryDisplayName } from \"../lib/matrix/matrix-provider.js\";\nimport { SkillAgentSummary } from \"../components/common/skill-agent-summary.js\";\nimport type { AgentScopeConfig, ProjectConfig, SkillConfig, SkillScope } from \"../types/config.js\";\n\ntype ListViewProps = {\n mode: string;\n source?: string | undefined;\n skillConfigs: SkillConfig[];\n agentConfigs: AgentScopeConfig[];\n};\n\ntype ActiveRoster = Pick<ListViewProps, \"skillConfigs\" | \"agentConfigs\">;\n\n/** The label never shrinks: a value too long for the line wraps beside it instead. */\nconst HeaderRow: React.FC<{ label: string; value: string }> = ({ label, value }) => (\n <Box flexDirection=\"row\" columnGap={1}>\n <Box flexShrink={0}>\n <Text color={CLI_COLORS.WARNING} bold>\n {label}\n </Text>\n </Box>\n <Text color={CLI_COLORS.NEUTRAL}>{value}</Text>\n </Box>\n);\n\nconst ListView: React.FC<ListViewProps> = ({ mode, source, skillConfigs, agentConfigs }) => {\n const { exit } = useApp();\n\n useEffect(() => {\n const timer = setTimeout(() => exit(), 0);\n return () => clearTimeout(timer);\n }, [exit]);\n\n return (\n <Box flexDirection=\"column\" paddingX={1} paddingY={1}>\n <Box flexDirection=\"column\" marginBottom={1}>\n <HeaderRow label=\"Mode\" value={mode} />\n {source && <HeaderRow label=\"Marketplace\" value={source} />}\n </Box>\n\n {/* Installed and current are one configuration, so every row reads unchanged. */}\n <SkillAgentSummary\n skillConfigs={skillConfigs}\n agentConfigs={agentConfigs}\n installedSkillConfigs={skillConfigs}\n installedAgentConfigs={agentConfigs}\n isInitMode={false}\n />\n </Box>\n );\n};\n\nexport default class List extends BaseCommand {\n static summary = \"Show installation information\";\n static description = `Display details about the ${DEFAULT_BRANDING.NAME} installation (local or plugin mode)`;\n static aliases = [\"ls\"];\n\n static flags = { provider: providerFlag() };\n\n static examples = [\n {\n description: \"Show current installation details\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n ];\n\n /** Names the other installation in this scope; reports rather than refuses, like `doctor`. */\n private async sayWhichInstallationThisIs(providerFlagValue: string | undefined): Promise<void> {\n const named = providerNamedBy(providerFlagValue);\n if (named !== undefined) {\n chooseProviderForThisRun(named);\n return;\n }\n\n const line = await otherInstallationsInThisScope(process.cwd());\n if (line !== null) this.log(line);\n }\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n await this.sayWhenTheGlobalInstallationStandsIn(providerNamedBy(flags.provider));\n await this.sayWhichInstallationThisIs(flags.provider);\n await this.ensureConfigReadable(process.cwd());\n\n const installation = await detectInstallation();\n if (!installation) return this.reportNoInstallation();\n\n const loaded = await loadProjectConfig(installation.projectDir);\n if (loaded === null) return this.printInstallationInfo([]);\n if (!process.stdin.isTTY) {\n return this.printInstallationInfo(skillLinesOf(activeRosterOf(loaded.config)));\n }\n\n await showListView(installation, loaded.config);\n }\n\n private reportNoInstallation(): void {\n this.log(\"No installation found.\");\n this.log(`Run '${CLI_INVOKE_COMMAND} init' to create one.`);\n }\n\n private async printInstallationInfo(skillLines: string[]): Promise<void> {\n const info = await getInstallationInfo();\n if (!info) return;\n\n this.log(\"\");\n this.log(formatInstallationDisplay(info, skillLines));\n this.log(\"\");\n }\n}\n\nasync function showListView(installation: Installation, config: ProjectConfig): Promise<void> {\n const { waitUntilExit, clear } = render(\n <ListView\n mode={INSTALL_MODE_LABELS[installation.mode]}\n source={config.marketplace}\n {...activeRosterOf(config)}\n />,\n );\n\n await waitUntilExit();\n clear();\n}\n\nfunction activeRosterOf(config: ProjectConfig): ActiveRoster {\n return {\n skillConfigs: config.skills.filter((skill) => !skill.excluded),\n agentConfigs: config.agents.filter((agent) => !agent.excluded),\n };\n}\n\n/** The panel's skill rows, read as it reads them: project rows first, each under the panel's name. */\nfunction skillLinesOf({ skillConfigs, agentConfigs }: ActiveRoster): string[] {\n const { projectSkillRows, globalSkillRows } = computeScopeDiff({\n currentSkills: skillConfigs,\n currentAgents: agentConfigs,\n installedSkillConfigs: skillConfigs,\n installedAgentConfigs: agentConfigs,\n isInitMode: false,\n });\n\n return [\n ...projectSkillRows.map((row) => skillLine(row, \"project\")),\n ...globalSkillRows.map((row) => skillLine(row, \"global\")),\n ];\n}\n\nfunction skillLine(row: SkillDiffRow, scope: SkillScope): string {\n return `${getSkillEntryDisplayName(row)} (${scope})`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,iBAAiB;AAEjC,SAAS,KAAK,MAAM,cAAc;AAkChC,SAEI,KAFJ;AADF,IAAM,YAAwD,CAAC,EAAE,OAAO,MAAM,MAC5E,qBAAC,OAAI,eAAc,OAAM,WAAW,GAClC;AAAA,sBAAC,OAAI,YAAY,GACf,8BAAC,QAAK,OAAO,WAAW,SAAS,MAAI,MAClC,iBACH,GACF;AAAA,EACA,oBAAC,QAAK,OAAO,WAAW,SAAU,iBAAM;AAAA,GAC1C;AAGF,IAAM,WAAoC,CAAC,EAAE,MAAM,QAAQ,cAAc,aAAa,MAAM;AAC1F,QAAM,EAAE,KAAK,IAAI,OAAO;AAExB,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM,KAAK,GAAG,CAAC;AACxC,WAAO,MAAM,aAAa,KAAK;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;AAAA,IACL,GAAG,iBAAiB,IAAI,CAAC,QAAQ,UAAU,KAAK,SAAS,CAAC;AAAA,IAC1D,GAAG,gBAAgB,IAAI,CAAC,QAAQ,UAAU,KAAK,QAAQ,CAAC;AAAA,EAC1D;AACF;AAEA,SAAS,UAAU,KAAmB,OAA2B;AAC/D,SAAO,GAAG,yBAAyB,GAAG,CAAC,KAAK,KAAK;AACnD;","names":[]}
1
+ {"version":3,"sources":["../../src/cli/commands/list.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\n\nimport { Box, useApp } from \"ink\";\nimport { render } from \"../components/render.js\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport { CLI_INVOKE_COMMAND, DEFAULT_BRANDING } from \"../consts.js\";\nimport { chooseProviderForThisRun } from \"../lib/installation/install-layout.js\";\nimport {\n otherInstallationsInThisScope,\n providerFlag,\n providerNamedBy,\n} from \"../lib/installation/provider-flag.js\";\nimport { getInstallationInfo, formatInstallationDisplay } from \"../lib/plugins/index.js\";\nimport {\n detectInstallation,\n INSTALL_MODE_LABELS,\n type Installation,\n} from \"../lib/installation/installation.js\";\nimport { loadProjectConfig } from \"../lib/configuration/project-config.js\";\nimport { computeScopeDiff, type SkillDiffRow } from \"../lib/configuration/scope-diff.js\";\nimport { getSkillEntryDisplayName } from \"../lib/matrix/matrix-provider.js\";\nimport { HeaderRow } from \"../components/common/header-row.js\";\nimport { SkillAgentSummary } from \"../components/common/skill-agent-summary.js\";\nimport type { AgentScopeConfig, ProjectConfig, SkillConfig, SkillScope } from \"../types/config.js\";\n\ntype ListViewProps = {\n mode: string;\n source?: string | undefined;\n skillConfigs: SkillConfig[];\n agentConfigs: AgentScopeConfig[];\n};\n\ntype ActiveRoster = Pick<ListViewProps, \"skillConfigs\" | \"agentConfigs\">;\n\nconst ListView: React.FC<ListViewProps> = ({ mode, source, skillConfigs, agentConfigs }) => {\n const { exit } = useApp();\n\n useEffect(() => {\n const timer = setTimeout(() => exit(), 0);\n return () => clearTimeout(timer);\n }, [exit]);\n\n return (\n <Box flexDirection=\"column\" paddingX={1} paddingY={1}>\n <Box flexDirection=\"column\" marginBottom={1}>\n <HeaderRow label=\"Mode\" value={mode} />\n {source && <HeaderRow label=\"Marketplace\" value={source} />}\n </Box>\n\n {/* Installed and current are one configuration, so every row reads unchanged. */}\n <SkillAgentSummary\n skillConfigs={skillConfigs}\n agentConfigs={agentConfigs}\n installedSkillConfigs={skillConfigs}\n installedAgentConfigs={agentConfigs}\n isInitMode={false}\n />\n </Box>\n );\n};\n\nexport default class List extends BaseCommand {\n static summary = \"Show installation information\";\n static description = `Display details about the ${DEFAULT_BRANDING.NAME} installation (local or plugin mode)`;\n static aliases = [\"ls\"];\n\n static flags = { provider: providerFlag() };\n\n static examples = [\n {\n description: \"Show current installation details\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n ];\n\n /** Names the other installation in this scope; reports rather than refuses, like `doctor`. */\n private async sayWhichInstallationThisIs(providerFlagValue: string | undefined): Promise<void> {\n const named = providerNamedBy(providerFlagValue);\n if (named !== undefined) {\n chooseProviderForThisRun(named);\n return;\n }\n\n const line = await otherInstallationsInThisScope(process.cwd());\n if (line !== null) this.log(line);\n }\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n await this.sayWhenTheGlobalInstallationStandsIn(providerNamedBy(flags.provider));\n await this.sayWhichInstallationThisIs(flags.provider);\n await this.ensureConfigReadable(process.cwd());\n\n const installation = await detectInstallation();\n if (!installation) return this.reportNoInstallation();\n\n const loaded = await loadProjectConfig(installation.projectDir);\n if (loaded === null) return this.printInstallationInfo([]);\n if (!process.stdin.isTTY) {\n return this.printInstallationInfo(skillLinesOf(activeRosterOf(loaded.config)));\n }\n\n await showListView(installation, loaded.config);\n }\n\n private reportNoInstallation(): void {\n this.log(\"No installation found.\");\n this.log(`Run '${CLI_INVOKE_COMMAND} init' to create one.`);\n }\n\n private async printInstallationInfo(skillLines: string[]): Promise<void> {\n const info = await getInstallationInfo();\n if (!info) return;\n\n this.log(\"\");\n this.log(formatInstallationDisplay(info, skillLines));\n this.log(\"\");\n }\n}\n\nasync function showListView(installation: Installation, config: ProjectConfig): Promise<void> {\n const { waitUntilExit, clear } = render(\n <ListView\n mode={INSTALL_MODE_LABELS[installation.mode]}\n source={config.marketplace}\n {...activeRosterOf(config)}\n />,\n );\n\n await waitUntilExit();\n clear();\n}\n\nfunction activeRosterOf(config: ProjectConfig): ActiveRoster {\n return {\n skillConfigs: config.skills.filter((skill) => !skill.excluded),\n agentConfigs: config.agents.filter((agent) => !agent.excluded),\n };\n}\n\n/** The panel's skill rows, read as it reads them: project rows first, each under the panel's name. */\nfunction skillLinesOf({ skillConfigs, agentConfigs }: ActiveRoster): string[] {\n const { projectSkillRows, globalSkillRows } = computeScopeDiff({\n currentSkills: skillConfigs,\n currentAgents: agentConfigs,\n installedSkillConfigs: skillConfigs,\n installedAgentConfigs: agentConfigs,\n isInitMode: false,\n });\n\n return [\n ...projectSkillRows.map((row) => skillLine(row, \"project\")),\n ...globalSkillRows.map((row) => skillLine(row, \"global\")),\n ];\n}\n\nfunction skillLine(row: SkillDiffRow, scope: SkillScope): string {\n return `${getSkillEntryDisplayName(row)} (${scope})`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAgB,iBAAiB;AAEjC,SAAS,KAAK,cAAc;AA2CtB,SACE,KADF;AAVN,IAAM,WAAoC,CAAC,EAAE,MAAM,QAAQ,cAAc,aAAa,MAAM;AAC1F,QAAM,EAAE,KAAK,IAAI,OAAO;AAExB,YAAU,MAAM;AACd,UAAM,QAAQ,WAAW,MAAM,KAAK,GAAG,CAAC;AACxC,WAAO,MAAM,aAAa,KAAK;AAAA,EACjC,GAAG,CAAC,IAAI,CAAC;AAET,SACE,qBAAC,OAAI,eAAc,UAAS,UAAU,GAAG,UAAU,GACjD;AAAA,yBAAC,OAAI,eAAc,UAAS,cAAc,GACxC;AAAA,0BAAC,aAAU,OAAM,QAAO,OAAO,MAAM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AmB,OAA2B;AAC/D,SAAO,GAAG,yBAAyB,GAAG,CAAC,KAAK,KAAK;AACnD;","names":[]}
@@ -2,14 +2,15 @@
2
2
  import {
3
3
  BaseCommand,
4
4
  EXIT_CODES
5
- } from "../../chunk-37QFHJUW.js";
5
+ } from "../../chunk-E6W3PYGF.js";
6
+ import "../../chunk-2FE4AJNC.js";
6
7
  import {
7
8
  isDirectoryEmpty,
8
9
  validateKebabCaseName,
9
10
  validateMarketplaceName,
10
11
  writeFile
11
- } from "../../chunk-YM3VEDAP.js";
12
- import "../../chunk-TG3SPPZY.js";
12
+ } from "../../chunk-D2PC7NIR.js";
13
+ import "../../chunk-KKGJH46C.js";
13
14
  import {
14
15
  CLI_INVOKE_COMMAND,
15
16
  DEFAULT_VERSION,
@@ -19,7 +20,7 @@ import {
19
20
  SKILL_RULES_PATH,
20
21
  STACKS_FILE_PATH,
21
22
  STANDARD_FILES
22
- } from "../../chunk-U46LYYRA.js";
23
+ } from "../../chunk-4SIBDIIO.js";
23
24
  import "../../chunk-GHHJYNAN.js";
24
25
 
25
26
  // src/cli/commands/new/marketplace.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/commands/new/marketplace.ts","../../../src/cli/lib/marketplace-scaffold.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\nimport path from \"path\";\n\nimport { BaseCommand } from \"../../base-command.js\";\nimport { CLI_INVOKE_COMMAND, EDITOR_URL, SKILLS_DIR_PATH } from \"../../consts.js\";\nimport { EXIT_CODES } from \"../../lib/exit-codes.js\";\nimport { validateMarketplaceName } from \"../../lib/marketplace-generator.js\";\nimport { exampleSkillId, writeMarketplaceScaffold } from \"../../lib/marketplace-scaffold.js\";\nimport { validateKebabCaseName } from \"../../lib/validate-kebab-name.js\";\nimport { isDirectoryEmpty } from \"../../utils/fs.js\";\n\nconst RESERVED_NAME_WAY_OUT = `run '${CLI_INVOKE_COMMAND} new marketplace <other-name>'`;\n\n/** No `--force` on purpose: it would overwrite work this command did not author. */\nfunction occupiedDirectoryError(marketplaceDir: string): string {\n return (\n `${marketplaceDir} already holds files. A scaffold writes a whole marketplace, ` +\n `so it will not write into a directory that already has contents. Choose another ` +\n `name, or empty that directory first.`\n );\n}\n\nexport default class NewMarketplace extends BaseCommand {\n static summary = \"Scaffold a marketplace of your own\";\n\n static description =\n \"Create a directory holding everything the CLI needs to read a marketplace: a package.json \" +\n \"carrying its identity, the three config files, and one example skill already named in the \" +\n \"marketplace's own namespace. It scaffolds only — run 'build plugins' and 'build marketplace' \" +\n \"to publish what you have written.\";\n\n static examples = [\n {\n description: \"Scaffold a marketplace named acme into ./acme\",\n command: \"<%= config.bin %> <%= command.id %> acme\",\n },\n ];\n\n static args = {\n name: Args.string({\n description:\n \"Name of the marketplace (kebab-case). Becomes the directory, the package.json name, \" +\n \"and the prefix every skill id must carry.\",\n required: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(NewMarketplace);\n const marketplaceName = args.name;\n const marketplaceDir = path.join(process.cwd(), marketplaceName);\n\n this.refuseUnusableName(marketplaceName);\n await this.refuseOccupiedDirectory(marketplaceDir);\n\n try {\n const written = await writeMarketplaceScaffold(marketplaceDir, marketplaceName);\n this.reportCreated(marketplaceName, marketplaceDir, written);\n this.reportNextSteps(marketplaceName, marketplaceDir);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /** `build marketplace`'s name rules, enforced at creation rather than at publish. */\n private refuseUnusableName(marketplaceName: string): void {\n const kebabError = validateKebabCaseName(marketplaceName, \"Marketplace\");\n if (kebabError) {\n this.error(kebabError, { exit: EXIT_CODES.INVALID_ARGS });\n }\n\n // The scaffolded package.json uses this name, so it is also the package name.\n const reservedError = validateMarketplaceName(\n marketplaceName,\n marketplaceName,\n RESERVED_NAME_WAY_OUT,\n );\n if (reservedError) {\n this.error(reservedError, { exit: EXIT_CODES.ERROR });\n }\n }\n\n private async refuseOccupiedDirectory(marketplaceDir: string): Promise<void> {\n if (await isDirectoryEmpty(marketplaceDir)) return;\n\n this.error(occupiedDirectoryError(marketplaceDir), { exit: EXIT_CODES.ERROR });\n }\n\n private reportCreated(\n marketplaceName: string,\n marketplaceDir: string,\n written: readonly string[],\n ): void {\n this.log(\"\");\n this.logSuccess(`Created marketplace '${marketplaceName}' at ${marketplaceDir}`);\n for (const relPath of written) {\n this.log(` ${relPath}`);\n }\n }\n\n private reportNextSteps(marketplaceName: string, marketplaceDir: string): void {\n const skillDir = path.join(SKILLS_DIR_PATH, exampleSkillId(marketplaceName));\n const steps = [\n `cd ${marketplaceName}`,\n \"Replace the placeholder 'author' in package.json with your own handle — it is what 'build marketplace' records as this marketplace's owner\",\n `Replace ${skillDir}/ with a skill of your own. Every skill id must begin with '${marketplaceName}-'`,\n `${CLI_INVOKE_COMMAND} build plugins`,\n `${CLI_INVOKE_COMMAND} build marketplace`,\n `Push it to GitHub, then add it from the Marketplace button at ${EDITOR_URL}`,\n `${CLI_INVOKE_COMMAND} init --from <id> --marketplace ${marketplaceDir} (from a project — tests your local changes against a configuration built there)`,\n ];\n\n this.log(\"\");\n this.log(\"Next steps:\");\n for (const [index, step] of steps.entries()) {\n this.log(` ${index + 1}. ${step}`);\n }\n this.log(\"\");\n }\n}\n","import path from \"path\";\n\nimport {\n DEFAULT_VERSION,\n SKILL_CATEGORIES_PATH,\n SKILL_RULES_PATH,\n SKILLS_DIR_PATH,\n STACKS_FILE_PATH,\n STANDARD_FILES,\n} from \"../consts.js\";\nimport { writeFile } from \"../utils/fs.js\";\n\ntype ScaffoldFile = {\n /** Path relative to the marketplace root. */\n relPath: string;\n contents: string;\n};\n\nconst EXAMPLE_SKILL_SUFFIX = \"example-skill\";\n\n/** `web` rather than an invented domain, which would reach no sub-agent. */\nconst EXAMPLE_DOMAIN = \"web\";\n\n/** No built-in category holds this key, so declaring it adds one rather than redefining another. */\nconst EXAMPLE_CATEGORY = `${EXAMPLE_DOMAIN}-example`;\n\n/** Not namespaced: the namespace rule governs ids, not slugs. */\nconst EXAMPLE_SLUG = \"example-skill\";\n\n/** Where the scaffolded category sorts among the categories a marketplace grows later. */\nconst EXAMPLE_CATEGORY_ORDER = 1;\n\nconst INITIAL_PACKAGE_VERSION = \"0.1.0\";\n\nconst EXAMPLE_STACK_AGENT = \"web-developer\";\n\n/** Prefixed with the marketplace name, which `build marketplace` requires of every id. */\nexport function exampleSkillId(marketplaceName: string): string {\n return `${marketplaceName}-${EXAMPLE_SKILL_SUFFIX}`;\n}\n\n/** Writes exactly what the marketplace guide promises; a config pair would look installed. */\nexport async function writeMarketplaceScaffold(\n marketplaceDir: string,\n marketplaceName: string,\n): Promise<string[]> {\n const files = scaffoldFiles(marketplaceName);\n\n await Promise.all(\n files.map((file) => writeFile(path.join(marketplaceDir, file.relPath), file.contents)),\n );\n\n return files.map((file) => file.relPath);\n}\n\nfunction scaffoldFiles(marketplaceName: string): ScaffoldFile[] {\n const skillId = exampleSkillId(marketplaceName);\n const skillDir = path.join(SKILLS_DIR_PATH, skillId);\n\n return [\n { relPath: STANDARD_FILES.PACKAGE_JSON, contents: packageJson(marketplaceName) },\n { relPath: SKILL_CATEGORIES_PATH, contents: skillCategoriesModule() },\n { relPath: SKILL_RULES_PATH, contents: skillRulesModule() },\n { relPath: STACKS_FILE_PATH, contents: stacksModule(marketplaceName, skillId) },\n { relPath: path.join(skillDir, STANDARD_FILES.SKILL_MD), contents: skillMd(skillId) },\n {\n relPath: path.join(skillDir, STANDARD_FILES.METADATA_YAML),\n contents: metadataYaml(marketplaceName),\n },\n ];\n}\n\n/** The loader reads only a default export, so the export form is load-bearing. */\nfunction configModule(comment: string, data: unknown): string {\n return `${comment}\\nexport default ${JSON.stringify(data, null, 2)};\\n`;\n}\n\n/** `author` is the marketplace's own handle, a placeholder the next steps say to replace. */\nfunction packageJson(marketplaceName: string): string {\n return `${JSON.stringify(\n {\n name: marketplaceName,\n version: INITIAL_PACKAGE_VERSION,\n description: `Skills curated for ${marketplaceName}'s conventions`,\n author: { name: authorHandle(marketplaceName) },\n },\n null,\n 2,\n )}\\n`;\n}\n\nfunction authorHandle(marketplaceName: string): string {\n return `@${marketplaceName}`;\n}\n\nfunction skillCategoriesModule(): string {\n return configModule(\"// The categories this marketplace's skills fall into.\", {\n version: DEFAULT_VERSION,\n categories: {\n [EXAMPLE_CATEGORY]: {\n id: EXAMPLE_CATEGORY,\n displayName: \"Example\",\n description: \"Replace this with a category of your own\",\n domain: EXAMPLE_DOMAIN,\n exclusive: false,\n order: EXAMPLE_CATEGORY_ORDER,\n },\n },\n });\n}\n\n/** Version only: rules name skills by the CLI's slug union, which a marketplace's own lack. */\nfunction skillRulesModule(): string {\n return configModule(\n [\n \"// Relationships between skills — conflicts, requires, alternatives.\",\n \"//\",\n \"// Rules may only name skills the public catalogue carries; this marketplace's own\",\n \"// skills cannot be named here yet, and a rule that names one will not load.\",\n ].join(\"\\n\"),\n { version: DEFAULT_VERSION },\n );\n}\n\nfunction stacksModule(marketplaceName: string, skillId: string): string {\n return configModule(\"// The stacks this marketplace offers.\", {\n stacks: [\n {\n id: `${marketplaceName}-starter`,\n name: `${marketplaceName} starter`,\n description: `Every skill ${marketplaceName} ships`,\n agents: {\n [EXAMPLE_STACK_AGENT]: {\n [EXAMPLE_CATEGORY]: [{ id: skillId }],\n },\n },\n },\n ],\n });\n}\n\n/** The frontmatter id is also the directory name (`doctor` compares them). */\nfunction skillMd(skillId: string): string {\n return `---\nname: ${skillId}\ndescription: A placeholder skill — replace it with one of your own\n---\n\n# Example Skill\n\nThis is where a skill's content goes: the conventions, patterns and rules you want\nevery sub-agent carrying it to follow.\n\nReplace this file and the \\`${STANDARD_FILES.METADATA_YAML}\\` beside it, and rename the\ndirectory to the id your skill should publish under.\n`;\n}\n\nfunction metadataYaml(marketplaceName: string): string {\n return [\n \"custom: true\",\n `domain: ${EXAMPLE_DOMAIN}`,\n `author: \"${authorHandle(marketplaceName)}\"`,\n \"displayName: Example Skill\",\n `category: ${EXAMPLE_CATEGORY}`,\n `slug: ${EXAMPLE_SLUG}`,\n 'cliDescription: \"A placeholder skill to replace with your own\"',\n 'usageGuidance: \"Use when you need a worked example of this marketplace\\'s skill shape\"',\n \"\",\n ].join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,OAAOA,WAAU;;;ACDjB,OAAO,UAAU;AAkBjB,IAAM,uBAAuB;AAG7B,IAAM,iBAAiB;AAGvB,IAAM,mBAAmB,GAAG,cAAc;AAG1C,IAAM,eAAe;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BAA0B;AAEhC,IAAM,sBAAsB;AAGrB,SAAS,eAAe,iBAAiC;AAC9D,SAAO,GAAG,eAAe,IAAI,oBAAoB;AACnD;AAGA,eAAsB,yBACpB,gBACA,iBACmB;AACnB,QAAM,QAAQ,cAAc,eAAe;AAE3C,QAAM,QAAQ;AAAA,IACZ,MAAM,IAAI,CAAC,SAAS,UAAU,KAAK,KAAK,gBAAgB,KAAK,OAAO,GAAG,KAAK,QAAQ,CAAC;AAAA,EACvF;AAEA,SAAO,MAAM,IAAI,CAAC,SAAS,KAAK,OAAO;AACzC;AAEA,SAAS,cAAc,iBAAyC;AAC9D,QAAM,UAAU,eAAe,eAAe;AAC9C,QAAM,WAAW,KAAK,KAAK,iBAAiB,OAAO;AAEnD,SAAO;AAAA,IACL,EAAE,SAAS,eAAe,cAAc,UAAU,YAAY,eAAe,EAAE;AAAA,IAC/E,EAAE,SAAS,uBAAuB,UAAU,sBAAsB,EAAE;AAAA,IACpE,EAAE,SAAS,kBAAkB,UAAU,iBAAiB,EAAE;AAAA,IAC1D,EAAE,SAAS,kBAAkB,UAAU,aAAa,iBAAiB,OAAO,EAAE;AAAA,IAC9E,EAAE,SAAS,KAAK,KAAK,UAAU,eAAe,QAAQ,GAAG,UAAU,QAAQ,OAAO,EAAE;AAAA,IACpF;AAAA,MACE,SAAS,KAAK,KAAK,UAAU,eAAe,aAAa;AAAA,MACzD,UAAU,aAAa,eAAe;AAAA,IACxC;AAAA,EACF;AAC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li/lib/marketplace-scaffold.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\nimport path from \"path\";\n\nimport { BaseCommand } from \"../../base-command.js\";\nimport { CLI_INVOKE_COMMAND, EDITOR_URL, SKILLS_DIR_PATH } from \"../../consts.js\";\nimport { EXIT_CODES } from \"../../lib/exit-codes.js\";\nimport { validateMarketplaceName } from \"../../lib/marketplace-generator.js\";\nimport { exampleSkillId, writeMarketplaceScaffold } from \"../../lib/marketplace-scaffold.js\";\nimport { validateKebabCaseName } from \"../../lib/validate-kebab-name.js\";\nimport { isDirectoryEmpty } from \"../../utils/fs.js\";\n\nconst RESERVED_NAME_WAY_OUT = `run '${CLI_INVOKE_COMMAND} new marketplace <other-name>'`;\n\n/** No `--force` on purpose: it would overwrite work this command did not author. */\nfunction occupiedDirectoryError(marketplaceDir: string): string {\n return (\n `${marketplaceDir} already holds files. A scaffold writes a whole marketplace, ` +\n `so it will not write into a directory that already has contents. Choose another ` +\n `name, or empty that directory first.`\n );\n}\n\nexport default class NewMarketplace extends BaseCommand {\n static summary = \"Scaffold a marketplace of your own\";\n\n static description =\n \"Create a directory holding everything the CLI needs to read a marketplace: a package.json \" +\n \"carrying its identity, the three config files, and one example skill already named in the \" +\n \"marketplace's own namespace. It scaffolds only — run 'build plugins' and 'build marketplace' \" +\n \"to publish what you have written.\";\n\n static examples = [\n {\n description: \"Scaffold a marketplace named acme into ./acme\",\n command: \"<%= config.bin %> <%= command.id %> acme\",\n },\n ];\n\n static args = {\n name: Args.string({\n description:\n \"Name of the marketplace (kebab-case). Becomes the directory, the package.json name, \" +\n \"and the prefix every skill id must carry.\",\n required: true,\n }),\n };\n\n async run(): Promise<void> {\n const { args } = await this.parse(NewMarketplace);\n const marketplaceName = args.name;\n const marketplaceDir = path.join(process.cwd(), marketplaceName);\n\n this.refuseUnusableName(marketplaceName);\n await this.refuseOccupiedDirectory(marketplaceDir);\n\n try {\n const written = await writeMarketplaceScaffold(marketplaceDir, marketplaceName);\n this.reportCreated(marketplaceName, marketplaceDir, written);\n this.reportNextSteps(marketplaceName, marketplaceDir);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /** `build marketplace`'s name rules, enforced at creation rather than at publish. */\n private refuseUnusableName(marketplaceName: string): void {\n const kebabError = validateKebabCaseName(marketplaceName, \"Marketplace\");\n if (kebabError) {\n this.error(kebabError, { exit: EXIT_CODES.INVALID_ARGS });\n }\n\n // The scaffolded package.json uses this name, so it is also the package name.\n const reservedError = validateMarketplaceName(\n marketplaceName,\n marketplaceName,\n RESERVED_NAME_WAY_OUT,\n );\n if (reservedError) {\n this.error(reservedError, { exit: EXIT_CODES.ERROR });\n }\n }\n\n private async refuseOccupiedDirectory(marketplaceDir: string): Promise<void> {\n if (await isDirectoryEmpty(marketplaceDir)) return;\n\n this.error(occupiedDirectoryError(marketplaceDir), { exit: EXIT_CODES.ERROR });\n }\n\n private reportCreated(\n marketplaceName: string,\n marketplaceDir: string,\n written: readonly string[],\n ): void {\n this.log(\"\");\n this.logSuccess(`Created marketplace '${marketplaceName}' at ${marketplaceDir}`);\n for (const relPath of written) {\n this.log(` ${relPath}`);\n }\n }\n\n private reportNextSteps(marketplaceName: string, marketplaceDir: string): void {\n const skillDir = path.join(SKILLS_DIR_PATH, exampleSkillId(marketplaceName));\n const steps = [\n `cd ${marketplaceName}`,\n \"Replace the placeholder 'author' in package.json with your own handle — it is what 'build marketplace' records as this marketplace's owner\",\n `Replace ${skillDir}/ with a skill of your own. Every skill id must begin with '${marketplaceName}-'`,\n `${CLI_INVOKE_COMMAND} build plugins`,\n `${CLI_INVOKE_COMMAND} build marketplace`,\n `Push it to GitHub, then add it from the Marketplace button at ${EDITOR_URL}`,\n `${CLI_INVOKE_COMMAND} init --from <id> --marketplace ${marketplaceDir} (from a project — tests your local changes against a configuration built there)`,\n ];\n\n this.log(\"\");\n this.log(\"Next steps:\");\n for (const [index, step] of steps.entries()) {\n this.log(` ${index + 1}. ${step}`);\n }\n this.log(\"\");\n }\n}\n","import path from \"path\";\n\nimport {\n DEFAULT_VERSION,\n SKILL_CATEGORIES_PATH,\n SKILL_RULES_PATH,\n SKILLS_DIR_PATH,\n STACKS_FILE_PATH,\n STANDARD_FILES,\n} from \"../consts.js\";\nimport { writeFile } from \"../utils/fs.js\";\n\ntype ScaffoldFile = {\n /** Path relative to the marketplace root. */\n relPath: string;\n contents: string;\n};\n\nconst EXAMPLE_SKILL_SUFFIX = \"example-skill\";\n\n/** `web` rather than an invented domain, which would reach no sub-agent. */\nconst EXAMPLE_DOMAIN = \"web\";\n\n/** No built-in category holds this key, so declaring it adds one rather than redefining another. */\nconst EXAMPLE_CATEGORY = `${EXAMPLE_DOMAIN}-example`;\n\n/** Not namespaced: the namespace rule governs ids, not slugs. */\nconst EXAMPLE_SLUG = \"example-skill\";\n\n/** Where the scaffolded category sorts among the categories a marketplace grows later. */\nconst EXAMPLE_CATEGORY_ORDER = 1;\n\nconst INITIAL_PACKAGE_VERSION = \"0.1.0\";\n\nconst EXAMPLE_STACK_AGENT = \"web-developer\";\n\n/** Prefixed with the marketplace name, which `build marketplace` requires of every id. */\nexport function exampleSkillId(marketplaceName: string): string {\n return `${marketplaceName}-${EXAMPLE_SKILL_SUFFIX}`;\n}\n\n/** Writes exactly what the marketplace guide promises; a config pair would look installed. */\nexport async function writeMarketplaceScaffold(\n marketplaceDir: string,\n marketplaceName: string,\n): Promise<string[]> {\n const files = scaffoldFiles(marketplaceName);\n\n await Promise.all(\n files.map((file) => writeFile(path.join(marketplaceDir, file.relPath), file.contents)),\n );\n\n return files.map((file) => file.relPath);\n}\n\nfunction scaffoldFiles(marketplaceName: string): ScaffoldFile[] {\n const skillId = exampleSkillId(marketplaceName);\n const skillDir = path.join(SKILLS_DIR_PATH, skillId);\n\n return [\n { relPath: STANDARD_FILES.PACKAGE_JSON, contents: packageJson(marketplaceName) },\n { relPath: SKILL_CATEGORIES_PATH, contents: skillCategoriesModule() },\n { relPath: SKILL_RULES_PATH, contents: skillRulesModule() },\n { relPath: STACKS_FILE_PATH, contents: stacksModule(marketplaceName, skillId) },\n { relPath: path.join(skillDir, STANDARD_FILES.SKILL_MD), contents: skillMd(skillId) },\n {\n relPath: path.join(skillDir, STANDARD_FILES.METADATA_YAML),\n contents: metadataYaml(marketplaceName),\n },\n ];\n}\n\n/** The loader reads only a default export, so the export form is load-bearing. */\nfunction configModule(comment: string, data: unknown): string {\n return `${comment}\\nexport default ${JSON.stringify(data, null, 2)};\\n`;\n}\n\n/** `author` is the marketplace's own handle, a placeholder the next steps say to replace. */\nfunction packageJson(marketplaceName: string): string {\n return `${JSON.stringify(\n {\n name: marketplaceName,\n version: INITIAL_PACKAGE_VERSION,\n description: `Skills curated for ${marketplaceName}'s conventions`,\n author: { name: authorHandle(marketplaceName) },\n },\n null,\n 2,\n )}\\n`;\n}\n\nfunction authorHandle(marketplaceName: string): string {\n return `@${marketplaceName}`;\n}\n\nfunction skillCategoriesModule(): string {\n return configModule(\"// The categories this marketplace's skills fall into.\", {\n version: DEFAULT_VERSION,\n categories: {\n [EXAMPLE_CATEGORY]: {\n id: EXAMPLE_CATEGORY,\n displayName: \"Example\",\n description: \"Replace this with a category of your own\",\n domain: EXAMPLE_DOMAIN,\n exclusive: false,\n order: EXAMPLE_CATEGORY_ORDER,\n },\n },\n });\n}\n\n/** Version only: rules name skills by the CLI's slug union, which a marketplace's own lack. */\nfunction skillRulesModule(): string {\n return configModule(\n [\n \"// Relationships between skills — conflicts, requires, alternatives.\",\n \"//\",\n \"// Rules may only name skills the public catalogue carries; this marketplace's own\",\n \"// skills cannot be named here yet, and a rule that names one will not load.\",\n ].join(\"\\n\"),\n { version: DEFAULT_VERSION },\n );\n}\n\nfunction stacksModule(marketplaceName: string, skillId: string): string {\n return configModule(\"// The stacks this marketplace offers.\", {\n stacks: [\n {\n id: `${marketplaceName}-starter`,\n name: `${marketplaceName} starter`,\n description: `Every skill ${marketplaceName} ships`,\n agents: {\n [EXAMPLE_STACK_AGENT]: {\n [EXAMPLE_CATEGORY]: [{ id: skillId }],\n },\n },\n },\n ],\n });\n}\n\n/** The frontmatter id is also the directory name (`doctor` compares them). */\nfunction skillMd(skillId: string): string {\n return `---\nname: ${skillId}\ndescription: A placeholder skill — replace it with one of your own\n---\n\n# Example Skill\n\nThis is where a skill's content goes: the conventions, patterns and rules you want\nevery sub-agent carrying it to follow.\n\nReplace this file and the \\`${STANDARD_FILES.METADATA_YAML}\\` beside it, and rename the\ndirectory to the id your skill should publish under.\n`;\n}\n\nfunction metadataYaml(marketplaceName: string): string {\n return [\n \"custom: true\",\n `domain: ${EXAMPLE_DOMAIN}`,\n `author: \"${authorHandle(marketplaceName)}\"`,\n \"displayName: Example Skill\",\n `category: ${EXAMPLE_CATEGORY}`,\n `slug: ${EXAMPLE_SLUG}`,\n 'cliDescription: \"A placeholder skill to replace with your own\"',\n 'usageGuidance: \"Use when you need a worked example of this marketplace\\'s skill shape\"',\n \"\",\n ].join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,OAAOA,WAAU;;;ACDjB,OAAO,UAAU;AAkBjB,IAAM,uBAAuB;AAG7B,IAAM,iBAAiB;AAGvB,IAAM,mBAAmB,GAAG,cAAc;AAG1C,IAAM,eAAe;AAGrB,IAAM,yBAAyB;AAE/B,IAAM,0BAA0B;AAEhC,IAAM,sBAAsB;AAGrB,SAAS,eAAe,iBAAiC;AAC9D,SAAO,GAAG,eAAe,IAAI,oBAAoB;AACnD;AAGA,eAAsB,yBACpB,gBACA,iBACmB;AACnB,QAAM,QAAQ,cAAc,eAAe;AAE3C,QAAM,QAAQ;AAAA,IACZ,MAAM,IAAI,CAAC,SAAS,UAAU,KAAK,KAAK,gBAAgB,KAAK,OAAO,GAAG,KAAK,QAAQ,CAAC;AAAA,EACvF;AAEA,SAAO,MAAM,IAAI,CAAC,SAAS,KAAK,OAAO;AACzC;AAEA,SAAS,cAAc,iBAAyC;AAC9D,QAAM,UAAU,eAAe,eAAe;AAC9C,QAAM,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