@claude-collective/cli 0.29.4 → 0.30.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 (175) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/config/skills-matrix.yaml +1 -1
  3. package/config/stacks.yaml +1 -1
  4. package/dist/{chunk-XPMEGGJK.js → chunk-34E7MWJI.js} +13 -38
  5. package/dist/chunk-34E7MWJI.js.map +1 -0
  6. package/dist/{chunk-IFODQTCX.js → chunk-52XVP55K.js} +6 -3
  7. package/dist/chunk-52XVP55K.js.map +1 -0
  8. package/dist/{chunk-N73GQTCK.js → chunk-5P6RUVA7.js} +6 -6
  9. package/dist/{chunk-ZX5DM4D5.js → chunk-AGNT3FUE.js} +3 -3
  10. package/dist/{chunk-A4T4YSV4.js → chunk-AGQRRJSY.js} +2 -2
  11. package/dist/{chunk-6F3ZKDVE.js → chunk-AXND7NCM.js} +3 -3
  12. package/dist/{chunk-EP6J44I4.js → chunk-DH6F7EOJ.js} +5 -5
  13. package/dist/{chunk-AG5YGYJT.js → chunk-DTFEFLUU.js} +2 -2
  14. package/dist/chunk-EOJTMX7T.js +183 -0
  15. package/dist/chunk-EOJTMX7T.js.map +1 -0
  16. package/dist/{chunk-AJFSCLJ7.js → chunk-F23LEXMC.js} +2 -2
  17. package/dist/{chunk-G5WXKKQM.js → chunk-FFZSN5C5.js} +5 -5
  18. package/dist/chunk-FFZSN5C5.js.map +1 -0
  19. package/dist/{chunk-FY5D4KIC.js → chunk-H2NM6BDH.js} +2 -2
  20. package/dist/{chunk-56ERY7H7.js → chunk-HMZPUOWU.js} +4 -4
  21. package/dist/{chunk-RI5QEK5W.js → chunk-I6YQDA2J.js} +2 -2
  22. package/dist/{chunk-MQAYAISQ.js → chunk-JWIH7YQE.js} +2 -2
  23. package/dist/{chunk-VTUPUKFD.js → chunk-KFL72CWK.js} +2 -2
  24. package/dist/{chunk-OA5RCL2L.js → chunk-LY5HM34M.js} +2 -2
  25. package/dist/{chunk-XZKVOPCR.js → chunk-MYLRA7NI.js} +4 -4
  26. package/dist/{chunk-EUPMWSM3.js → chunk-QR2ONHDW.js} +5 -5
  27. package/dist/{chunk-SSHG7MEE.js → chunk-QUL7R35E.js} +307 -504
  28. package/dist/chunk-QUL7R35E.js.map +1 -0
  29. package/dist/{chunk-7UKQZSWT.js → chunk-RFW2RIM7.js} +2 -2
  30. package/dist/{chunk-PNXFJPXF.js → chunk-URUSBWWI.js} +2 -2
  31. package/dist/{chunk-GVVEPVR7.js → chunk-VHVRPLDY.js} +4 -4
  32. package/dist/{chunk-IRG52AN5.js → chunk-VIBOSHRL.js} +2 -2
  33. package/dist/{chunk-IQUBOWWU.js → chunk-WWLEF4MQ.js} +3 -3
  34. package/dist/{chunk-WLQUQXWO.js → chunk-WXW6SQ5K.js} +3 -3
  35. package/dist/{chunk-DUIYVKFK.js → chunk-X5AD7WWC.js} +12 -12
  36. package/dist/commands/build/marketplace.js +1 -1
  37. package/dist/commands/build/plugins.js +3 -3
  38. package/dist/commands/build/stack.js +3 -3
  39. package/dist/commands/compile.js +21 -70
  40. package/dist/commands/compile.js.map +1 -1
  41. package/dist/commands/config/get.js +2 -2
  42. package/dist/commands/config/index.js +3 -3
  43. package/dist/commands/config/path.js +2 -2
  44. package/dist/commands/config/set-project.js +2 -2
  45. package/dist/commands/config/show.js +3 -3
  46. package/dist/commands/config/unset-project.js +2 -2
  47. package/dist/commands/diff.js +2 -2
  48. package/dist/commands/doctor.js +2 -2
  49. package/dist/commands/edit.js +40 -71
  50. package/dist/commands/edit.js.map +1 -1
  51. package/dist/commands/eject.js +2 -2
  52. package/dist/commands/import/skill.js +2 -2
  53. package/dist/commands/info.js +2 -2
  54. package/dist/commands/init.js +79 -109
  55. package/dist/commands/init.js.map +1 -1
  56. package/dist/commands/list.js +2 -2
  57. package/dist/commands/new/agent.js +5 -3
  58. package/dist/commands/new/agent.js.map +1 -1
  59. package/dist/commands/new/skill.js +2 -2
  60. package/dist/commands/outdated.js +2 -2
  61. package/dist/commands/search.js +4 -4
  62. package/dist/commands/uninstall.js +41 -29
  63. package/dist/commands/uninstall.js.map +1 -1
  64. package/dist/commands/update.js +4 -6
  65. package/dist/commands/update.js.map +1 -1
  66. package/dist/commands/validate.js +2 -2
  67. package/dist/commands/version/bump.js +2 -2
  68. package/dist/commands/version/index.js +2 -2
  69. package/dist/commands/version/set.js +2 -2
  70. package/dist/commands/version/show.js +2 -2
  71. package/dist/components/skill-search/skill-search.js +3 -3
  72. package/dist/components/wizard/category-grid.js +2 -2
  73. package/dist/components/wizard/category-grid.test.js +2 -2
  74. package/dist/components/wizard/domain-selection.js +4 -4
  75. package/dist/components/wizard/help-modal.js +2 -2
  76. package/dist/components/wizard/menu-item.js +2 -2
  77. package/dist/components/wizard/search-modal.js +2 -2
  78. package/dist/components/wizard/search-modal.test.js +2 -2
  79. package/dist/components/wizard/section-progress.js +2 -2
  80. package/dist/components/wizard/section-progress.test.js +2 -2
  81. package/dist/components/wizard/source-grid.js +3 -3
  82. package/dist/components/wizard/source-grid.test.js +3 -3
  83. package/dist/components/wizard/stack-selection.js +6 -6
  84. package/dist/components/wizard/step-approach.js +6 -6
  85. package/dist/components/wizard/step-approach.test.js +6 -6
  86. package/dist/components/wizard/step-build.js +5 -5
  87. package/dist/components/wizard/step-build.test.js +5 -5
  88. package/dist/components/wizard/step-confirm.js +2 -2
  89. package/dist/components/wizard/step-confirm.test.js +4 -4
  90. package/dist/components/wizard/step-refine.js +2 -2
  91. package/dist/components/wizard/step-refine.test.js +2 -2
  92. package/dist/components/wizard/step-settings.js +4 -4
  93. package/dist/components/wizard/step-settings.test.js +8 -8
  94. package/dist/components/wizard/step-settings.test.js.map +1 -1
  95. package/dist/components/wizard/step-sources.js +7 -7
  96. package/dist/components/wizard/step-sources.test.js +7 -7
  97. package/dist/components/wizard/step-stack.js +8 -8
  98. package/dist/components/wizard/step-stack.test.js +8 -8
  99. package/dist/components/wizard/view-title.js +2 -2
  100. package/dist/components/wizard/wizard-layout.js +6 -6
  101. package/dist/components/wizard/wizard-tabs.js +2 -2
  102. package/dist/components/wizard/wizard-tabs.test.js +2 -2
  103. package/dist/components/wizard/wizard.js +21 -21
  104. package/dist/config/skills-matrix.yaml +1 -1
  105. package/dist/config/stacks.yaml +1 -1
  106. package/dist/hooks/init.js +2 -2
  107. package/dist/{source-manager-TV2YGPAN.js → source-manager-S5XTC6RW.js} +3 -3
  108. package/dist/src/agents/developer/api-developer/agent.yaml +1 -1
  109. package/dist/src/agents/developer/cli-developer/agent.yaml +1 -1
  110. package/dist/src/agents/developer/web-architecture/agent.yaml +1 -1
  111. package/dist/src/agents/developer/web-developer/agent.yaml +1 -1
  112. package/dist/src/agents/meta/agent-summoner/agent.yaml +1 -1
  113. package/dist/src/agents/meta/documentor/agent.yaml +1 -1
  114. package/dist/src/agents/meta/skill-summoner/agent.yaml +1 -1
  115. package/dist/src/agents/meta/skill-summoner/output-format.md +1 -1
  116. package/dist/src/agents/migration/cli-migrator/agent.yaml +1 -1
  117. package/dist/src/agents/pattern/pattern-scout/agent.yaml +1 -1
  118. package/dist/src/agents/pattern/web-pattern-critique/agent.yaml +1 -1
  119. package/dist/src/agents/planning/web-pm/agent.yaml +1 -1
  120. package/dist/src/agents/researcher/api-researcher/agent.yaml +1 -1
  121. package/dist/src/agents/researcher/web-researcher/agent.yaml +1 -1
  122. package/dist/src/agents/reviewer/api-reviewer/agent.yaml +1 -1
  123. package/dist/src/agents/reviewer/cli-reviewer/agent.yaml +1 -1
  124. package/dist/src/agents/reviewer/web-reviewer/agent.yaml +1 -1
  125. package/dist/src/agents/tester/cli-tester/agent.yaml +1 -1
  126. package/dist/src/agents/tester/web-tester/agent.yaml +1 -1
  127. package/dist/stores/wizard-store.js +3 -3
  128. package/dist/stores/wizard-store.test.js +3 -3
  129. package/package.json +1 -1
  130. package/src/agents/developer/api-developer/agent.yaml +1 -1
  131. package/src/agents/developer/cli-developer/agent.yaml +1 -1
  132. package/src/agents/developer/web-architecture/agent.yaml +1 -1
  133. package/src/agents/developer/web-developer/agent.yaml +1 -1
  134. package/src/agents/meta/agent-summoner/agent.yaml +1 -1
  135. package/src/agents/meta/documentor/agent.yaml +1 -1
  136. package/src/agents/meta/skill-summoner/agent.yaml +1 -1
  137. package/src/agents/meta/skill-summoner/output-format.md +1 -1
  138. package/src/agents/migration/cli-migrator/agent.yaml +1 -1
  139. package/src/agents/pattern/pattern-scout/agent.yaml +1 -1
  140. package/src/agents/pattern/web-pattern-critique/agent.yaml +1 -1
  141. package/src/agents/planning/web-pm/agent.yaml +1 -1
  142. package/src/agents/researcher/api-researcher/agent.yaml +1 -1
  143. package/src/agents/researcher/web-researcher/agent.yaml +1 -1
  144. package/src/agents/reviewer/api-reviewer/agent.yaml +1 -1
  145. package/src/agents/reviewer/cli-reviewer/agent.yaml +1 -1
  146. package/src/agents/reviewer/web-reviewer/agent.yaml +1 -1
  147. package/src/agents/tester/cli-tester/agent.yaml +1 -1
  148. package/src/agents/tester/web-tester/agent.yaml +1 -1
  149. package/dist/chunk-G5WXKKQM.js.map +0 -1
  150. package/dist/chunk-IFODQTCX.js.map +0 -1
  151. package/dist/chunk-SSHG7MEE.js.map +0 -1
  152. package/dist/chunk-XPMEGGJK.js.map +0 -1
  153. /package/dist/{chunk-N73GQTCK.js.map → chunk-5P6RUVA7.js.map} +0 -0
  154. /package/dist/{chunk-ZX5DM4D5.js.map → chunk-AGNT3FUE.js.map} +0 -0
  155. /package/dist/{chunk-A4T4YSV4.js.map → chunk-AGQRRJSY.js.map} +0 -0
  156. /package/dist/{chunk-6F3ZKDVE.js.map → chunk-AXND7NCM.js.map} +0 -0
  157. /package/dist/{chunk-EP6J44I4.js.map → chunk-DH6F7EOJ.js.map} +0 -0
  158. /package/dist/{chunk-AG5YGYJT.js.map → chunk-DTFEFLUU.js.map} +0 -0
  159. /package/dist/{chunk-AJFSCLJ7.js.map → chunk-F23LEXMC.js.map} +0 -0
  160. /package/dist/{chunk-FY5D4KIC.js.map → chunk-H2NM6BDH.js.map} +0 -0
  161. /package/dist/{chunk-56ERY7H7.js.map → chunk-HMZPUOWU.js.map} +0 -0
  162. /package/dist/{chunk-RI5QEK5W.js.map → chunk-I6YQDA2J.js.map} +0 -0
  163. /package/dist/{chunk-MQAYAISQ.js.map → chunk-JWIH7YQE.js.map} +0 -0
  164. /package/dist/{chunk-VTUPUKFD.js.map → chunk-KFL72CWK.js.map} +0 -0
  165. /package/dist/{chunk-OA5RCL2L.js.map → chunk-LY5HM34M.js.map} +0 -0
  166. /package/dist/{chunk-XZKVOPCR.js.map → chunk-MYLRA7NI.js.map} +0 -0
  167. /package/dist/{chunk-EUPMWSM3.js.map → chunk-QR2ONHDW.js.map} +0 -0
  168. /package/dist/{chunk-7UKQZSWT.js.map → chunk-RFW2RIM7.js.map} +0 -0
  169. /package/dist/{chunk-PNXFJPXF.js.map → chunk-URUSBWWI.js.map} +0 -0
  170. /package/dist/{chunk-GVVEPVR7.js.map → chunk-VHVRPLDY.js.map} +0 -0
  171. /package/dist/{chunk-IRG52AN5.js.map → chunk-VIBOSHRL.js.map} +0 -0
  172. /package/dist/{chunk-IQUBOWWU.js.map → chunk-WWLEF4MQ.js.map} +0 -0
  173. /package/dist/{chunk-WLQUQXWO.js.map → chunk-WXW6SQ5K.js.map} +0 -0
  174. /package/dist/{chunk-DUIYVKFK.js.map → chunk-X5AD7WWC.js.map} +0 -0
  175. /package/dist/{source-manager-TV2YGPAN.js.map → source-manager-S5XTC6RW.js.map} +0 -0
@@ -2,33 +2,37 @@
2
2
  import {
3
3
  getAgentDefinitions,
4
4
  recompileAgents
5
- } from "../chunk-XPMEGGJK.js";
5
+ } from "../chunk-34E7MWJI.js";
6
6
  import {
7
7
  Wizard
8
- } from "../chunk-DUIYVKFK.js";
9
- import "../chunk-EP6J44I4.js";
10
- import "../chunk-7UKQZSWT.js";
11
- import "../chunk-G5WXKKQM.js";
12
- import "../chunk-N73GQTCK.js";
13
- import "../chunk-56ERY7H7.js";
14
- import "../chunk-XZKVOPCR.js";
15
- import "../chunk-GVVEPVR7.js";
16
- import "../chunk-EUPMWSM3.js";
17
- import "../chunk-FY5D4KIC.js";
18
- import "../chunk-AG5YGYJT.js";
8
+ } from "../chunk-X5AD7WWC.js";
9
+ import "../chunk-DH6F7EOJ.js";
10
+ import "../chunk-RFW2RIM7.js";
11
+ import "../chunk-FFZSN5C5.js";
12
+ import "../chunk-5P6RUVA7.js";
13
+ import "../chunk-HMZPUOWU.js";
14
+ import "../chunk-MYLRA7NI.js";
15
+ import "../chunk-VHVRPLDY.js";
16
+ import "../chunk-QR2ONHDW.js";
17
+ import "../chunk-H2NM6BDH.js";
18
+ import "../chunk-DTFEFLUU.js";
19
19
  import "../chunk-V2ZIH7HV.js";
20
- import "../chunk-WLQUQXWO.js";
21
- import "../chunk-MQAYAISQ.js";
22
- import "../chunk-OA5RCL2L.js";
23
- import "../chunk-ZX5DM4D5.js";
20
+ import "../chunk-WXW6SQ5K.js";
21
+ import "../chunk-JWIH7YQE.js";
22
+ import "../chunk-LY5HM34M.js";
23
+ import "../chunk-AGNT3FUE.js";
24
24
  import "../chunk-DIRH4PDF.js";
25
- import "../chunk-VTUPUKFD.js";
25
+ import "../chunk-KFL72CWK.js";
26
26
  import "../chunk-7ICBJZV2.js";
27
- import "../chunk-IRG52AN5.js";
27
+ import "../chunk-VIBOSHRL.js";
28
28
  import "../chunk-WPED6CL3.js";
29
- import "../chunk-AJFSCLJ7.js";
29
+ import "../chunk-F23LEXMC.js";
30
30
  import "../chunk-RXC7AF7N.js";
31
- import "../chunk-IQUBOWWU.js";
31
+ import {
32
+ claudePluginInstall,
33
+ claudePluginUninstall
34
+ } from "../chunk-EOJTMX7T.js";
35
+ import "../chunk-WWLEF4MQ.js";
32
36
  import {
33
37
  ERROR_MESSAGES,
34
38
  INFO_MESSAGES,
@@ -40,26 +44,17 @@ import {
40
44
  } from "../chunk-5I6VY2E7.js";
41
45
  import {
42
46
  archiveLocalSkill,
43
- bumpPluginVersion,
44
- claudePluginInstall,
45
- claudePluginUninstall,
46
- copySkillsToPluginFromSource,
47
47
  detectInstallation,
48
- getCollectivePluginDir,
48
+ discoverAllPluginSkills,
49
49
  getMarketplaceLabel,
50
- getPluginSkillIds,
51
- getPluginSkillsDir,
52
50
  loadSkillsMatrixFromSource,
53
51
  restoreArchivedSkill,
54
52
  typedEntries
55
- } from "../chunk-SSHG7MEE.js";
53
+ } from "../chunk-QUL7R35E.js";
56
54
  import {
57
- directoryExists,
58
- ensureDir,
59
- getErrorMessage,
60
- remove
55
+ getErrorMessage
61
56
  } from "../chunk-5WIHSJRO.js";
62
- import "../chunk-IFODQTCX.js";
57
+ import "../chunk-52XVP55K.js";
63
58
  import {
64
59
  init_esm_shims
65
60
  } from "../chunk-AWKZ5BDL.js";
@@ -111,8 +106,8 @@ var Edit = class _Edit extends BaseCommand {
111
106
  exit: EXIT_CODES.ERROR
112
107
  });
113
108
  }
114
- const pluginDir = getCollectivePluginDir();
115
- const pluginSkillsDir = installation.mode === "local" ? installation.skillsDir : getPluginSkillsDir(pluginDir);
109
+ const projectDir = process.cwd();
110
+ const isPluginMode = installation.mode === "plugin";
116
111
  const modeLabel = installation.mode === "local" ? "Local" : "Plugin";
117
112
  this.log(`Edit ${modeLabel} Skills
118
113
  `);
@@ -121,7 +116,7 @@ var Edit = class _Edit extends BaseCommand {
121
116
  try {
122
117
  sourceResult = await loadSkillsMatrixFromSource({
123
118
  sourceFlag: flags.source,
124
- projectDir: process.cwd(),
119
+ projectDir,
125
120
  forceRefresh: flags.refresh
126
121
  });
127
122
  const sourceInfo = sourceResult.isLocal ? "local" : sourceResult.sourceConfig.sourceOrigin;
@@ -135,7 +130,8 @@ var Edit = class _Edit extends BaseCommand {
135
130
  this.log("Reading current skills...");
136
131
  let currentSkillIds;
137
132
  try {
138
- currentSkillIds = await getPluginSkillIds(pluginSkillsDir, sourceResult.matrix);
133
+ const discoveredSkills = await discoverAllPluginSkills(projectDir);
134
+ currentSkillIds = Object.keys(discoveredSkills);
139
135
  this.log(`\u2713 Current plugin has ${currentSkillIds.length} skills
140
136
  `);
141
137
  } catch (error) {
@@ -218,7 +214,6 @@ var Edit = class _Edit extends BaseCommand {
218
214
  this.log(` ~ ${skillId} (${fromLabel} \u2192 ${toLabel})`);
219
215
  }
220
216
  this.log("");
221
- const projectDir = process.cwd();
222
217
  for (const [skillId, change] of sourceChanges) {
223
218
  if (change.from === "local") {
224
219
  await archiveLocalSkill(projectDir, skillId);
@@ -227,7 +222,7 @@ var Edit = class _Edit extends BaseCommand {
227
222
  await restoreArchivedSkill(projectDir, skillId);
228
223
  }
229
224
  }
230
- if (installation.mode === "plugin" && sourceResult.marketplace) {
225
+ if (isPluginMode && sourceResult.marketplace) {
231
226
  for (const skillId of addedSkills) {
232
227
  const pluginRef = `${skillId}@${sourceResult.marketplace}`;
233
228
  this.log(`Installing plugin: ${pluginRef}...`);
@@ -246,28 +241,6 @@ var Edit = class _Edit extends BaseCommand {
246
241
  }
247
242
  }
248
243
  }
249
- this.log(STATUS_MESSAGES.COPYING_SKILLS);
250
- try {
251
- if (await directoryExists(pluginSkillsDir)) {
252
- await remove(pluginSkillsDir);
253
- }
254
- await ensureDir(pluginSkillsDir);
255
- await copySkillsToPluginFromSource(
256
- result.selectedSkills,
257
- pluginDir,
258
- sourceResult.matrix,
259
- sourceResult,
260
- result.sourceSelections,
261
- (completed, total) => {
262
- process.stdout.write(`\r Copying ${completed} of ${total} skills...`);
263
- }
264
- );
265
- process.stdout.write("\n");
266
- this.log(`\u2713 Copied ${result.selectedSkills.length} skills to plugin
267
- `);
268
- } catch (error) {
269
- this.handleError(error);
270
- }
271
244
  let sourcePath;
272
245
  this.log(
273
246
  flags["agent-source"] ? STATUS_MESSAGES.FETCHING_AGENT_PARTIALS : STATUS_MESSAGES.LOADING_AGENT_PARTIALS
@@ -283,9 +256,13 @@ var Edit = class _Edit extends BaseCommand {
283
256
  }
284
257
  this.log(STATUS_MESSAGES.RECOMPILING_AGENTS);
285
258
  try {
259
+ const recompileSkills = await discoverAllPluginSkills(projectDir);
286
260
  const recompileResult = await recompileAgents({
287
- pluginDir,
288
- sourcePath
261
+ pluginDir: projectDir,
262
+ sourcePath,
263
+ skills: recompileSkills,
264
+ projectDir,
265
+ outputDir: installation.agentsDir
289
266
  });
290
267
  if (recompileResult.failed.length > 0) {
291
268
  this.log(
@@ -305,14 +282,6 @@ var Edit = class _Edit extends BaseCommand {
305
282
  this.warn(`Agent recompilation failed: ${getErrorMessage(error)}`);
306
283
  this.log("You can manually recompile with 'cc compile'.\n");
307
284
  }
308
- this.log("Updating plugin version...");
309
- try {
310
- const newVersion = await bumpPluginVersion(pluginDir, "patch");
311
- this.log(`\u2713 Version bumped to ${newVersion}
312
- `);
313
- } catch (error) {
314
- this.handleError(error);
315
- }
316
285
  const summaryParts = [`${addedSkills.length} added`, `${removedSkills.length} removed`];
317
286
  if (hasSourceChanges) {
318
287
  summaryParts.push(`${sourceChanges.size} source${sourceChanges.size > 1 ? "s" : ""} changed`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/commands/edit.tsx"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { render } from \"ink\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport { Wizard, type WizardResultV2 } from \"../components/wizard/wizard.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { loadSkillsMatrixFromSource, getMarketplaceLabel } from \"../lib/loading/index.js\";\nimport { directoryExists, ensureDir, remove } from \"../utils/fs.js\";\nimport {\n getCollectivePluginDir,\n getPluginSkillsDir,\n getPluginSkillIds,\n bumpPluginVersion,\n} from \"../lib/plugins/index.js\";\nimport {\n copySkillsToPluginFromSource,\n archiveLocalSkill,\n restoreArchivedSkill,\n} from \"../lib/skills/index.js\";\nimport { recompileAgents, getAgentDefinitions } from \"../lib/agents/index.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { detectInstallation } from \"../lib/installation/index.js\";\nimport { ERROR_MESSAGES, STATUS_MESSAGES, INFO_MESSAGES } from \"../utils/messages.js\";\nimport { claudePluginInstall, claudePluginUninstall } from \"../utils/exec.js\";\nimport type { SkillId } from \"../types/index.js\";\nimport { typedEntries } from \"../utils/typed-object.js\";\n\nconst SOURCE_DISPLAY_NAMES: Record<string, string> = {\n public: \"Public\",\n local: \"Local\",\n};\n\nfunction formatSourceDisplayName(sourceName: string): string {\n return SOURCE_DISPLAY_NAMES[sourceName] ?? sourceName;\n}\n\nexport default class Edit extends BaseCommand {\n static summary = \"Edit skills in the plugin\";\n static description = \"Modify the currently installed skills via interactive wizard\";\n\n static examples = [\n {\n description: \"Open the edit wizard\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n {\n description: \"Edit with a custom source\",\n command: \"<%= config.bin %> <%= command.id %> --source github:org/marketplace\",\n },\n {\n description: \"Force refresh skills from remote\",\n command: \"<%= config.bin %> <%= command.id %> --refresh\",\n },\n ];\n\n static flags = {\n ...BaseCommand.baseFlags,\n refresh: Flags.boolean({\n description: \"Force refresh from remote sources\",\n default: false,\n }),\n \"agent-source\": Flags.string({\n description: \"Remote agent partials source (default: local CLI)\",\n }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Edit);\n\n const installation = await detectInstallation();\n\n if (!installation) {\n this.error(ERROR_MESSAGES.NO_INSTALLATION, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n const pluginDir = getCollectivePluginDir();\n const pluginSkillsDir =\n installation.mode === \"local\" ? installation.skillsDir : getPluginSkillsDir(pluginDir);\n\n const modeLabel = installation.mode === \"local\" ? \"Local\" : \"Plugin\";\n this.log(`Edit ${modeLabel} Skills\\n`);\n\n this.log(STATUS_MESSAGES.LOADING_MARKETPLACE_SOURCE);\n let sourceResult;\n try {\n sourceResult = await loadSkillsMatrixFromSource({\n sourceFlag: flags.source,\n projectDir: process.cwd(),\n forceRefresh: flags.refresh,\n });\n\n const sourceInfo = sourceResult.isLocal ? \"local\" : sourceResult.sourceConfig.sourceOrigin;\n this.log(\n `✓ Loaded ${Object.keys(sourceResult.matrix.skills).length} skills (${sourceInfo})\\n`,\n );\n } catch (error) {\n this.handleError(error);\n }\n\n this.log(\"Reading current skills...\");\n let currentSkillIds: SkillId[];\n try {\n currentSkillIds = await getPluginSkillIds(pluginSkillsDir, sourceResult.matrix);\n this.log(`✓ Current plugin has ${currentSkillIds.length} skills\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n let wizardResult: WizardResultV2 | null = null;\n const marketplaceLabel = getMarketplaceLabel(sourceResult);\n\n const { waitUntilExit } = render(\n <Wizard\n matrix={sourceResult.matrix}\n version={this.config.version}\n marketplaceLabel={marketplaceLabel}\n initialStep=\"build\"\n initialInstallMode={sourceResult.marketplace ? \"plugin\" : \"local\"}\n installedSkillIds={currentSkillIds}\n projectDir={process.cwd()}\n onComplete={(result) => {\n wizardResult = result as WizardResultV2;\n }}\n onCancel={() => {\n this.log(\"\\nEdit cancelled\");\n }}\n />,\n );\n\n await waitUntilExit();\n\n const result = wizardResult as WizardResultV2 | null;\n\n if (!result || result.cancelled) {\n this.error(\"Cancelled\", { exit: EXIT_CODES.CANCELLED });\n }\n\n if (!result.validation.valid) {\n const errorMessages = result.validation.errors.map((e) => e.message).join(\"\\n \");\n this.error(`Selection has validation errors:\\n ${errorMessages}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n const addedSkills = result.selectedSkills.filter((id) => !currentSkillIds.includes(id));\n const removedSkills = currentSkillIds.filter((id) => !result.selectedSkills.includes(id));\n\n // Detect source changes (user changed which source provides a skill)\n const sourceChanges = new Map<SkillId, { from: string; to: string }>();\n for (const [skillId, selectedSource] of typedEntries<SkillId, string>(\n result.sourceSelections,\n )) {\n const skill = sourceResult.matrix.skills[skillId];\n if (skill?.activeSource && skill.activeSource.name !== selectedSource) {\n sourceChanges.set(skillId, {\n from: skill.activeSource.name,\n to: selectedSource,\n });\n }\n }\n\n const hasSourceChanges = sourceChanges.size > 0;\n const hasSkillChanges = addedSkills.length > 0 || removedSkills.length > 0;\n\n if (result.validation.warnings.length > 0) {\n this.log(\"\\nWarnings:\");\n for (const warning of result.validation.warnings) {\n this.warn(` ! ${warning.message}`);\n }\n this.log(\"\");\n }\n\n if (!hasSkillChanges && !hasSourceChanges) {\n this.log(INFO_MESSAGES.NO_CHANGES_MADE);\n this.log(\"Plugin unchanged\\n\");\n return;\n }\n\n this.log(\"\\nChanges:\");\n for (const skillId of addedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` + ${skill?.displayName || skillId}`);\n }\n for (const skillId of removedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` - ${skill?.displayName || skillId}`);\n }\n for (const [skillId, change] of sourceChanges) {\n const fromLabel = formatSourceDisplayName(change.from);\n const toLabel = formatSourceDisplayName(change.to);\n this.log(` ~ ${skillId} (${fromLabel} \\u2192 ${toLabel})`);\n }\n this.log(\"\");\n\n // Apply source switches (archive/restore local skills)\n const projectDir = process.cwd();\n for (const [skillId, change] of sourceChanges) {\n if (change.from === \"local\") {\n await archiveLocalSkill(projectDir, skillId);\n }\n if (change.to === \"local\") {\n await restoreArchivedSkill(projectDir, skillId);\n }\n }\n\n // Install/uninstall individual skill plugins when in plugin mode with a marketplace\n if (installation.mode === \"plugin\" && sourceResult.marketplace) {\n for (const skillId of addedSkills) {\n const pluginRef = `${skillId}@${sourceResult.marketplace}`;\n this.log(`Installing plugin: ${pluginRef}...`);\n try {\n await claudePluginInstall(pluginRef, \"project\", projectDir);\n } catch (error) {\n this.warn(`Failed to install plugin ${pluginRef}: ${getErrorMessage(error)}`);\n }\n }\n for (const skillId of removedSkills) {\n this.log(`Uninstalling plugin: ${skillId}...`);\n try {\n await claudePluginUninstall(skillId, \"project\", projectDir);\n } catch (error) {\n this.warn(`Failed to uninstall plugin ${skillId}: ${getErrorMessage(error)}`);\n }\n }\n }\n\n this.log(STATUS_MESSAGES.COPYING_SKILLS);\n try {\n if (await directoryExists(pluginSkillsDir)) {\n await remove(pluginSkillsDir);\n }\n await ensureDir(pluginSkillsDir);\n\n await copySkillsToPluginFromSource(\n result.selectedSkills,\n pluginDir,\n sourceResult.matrix,\n sourceResult,\n result.sourceSelections,\n (completed, total) => {\n process.stdout.write(`\\r Copying ${completed} of ${total} skills...`);\n },\n );\n process.stdout.write(\"\\n\");\n this.log(`✓ Copied ${result.selectedSkills.length} skills to plugin\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n let sourcePath: string;\n this.log(\n flags[\"agent-source\"]\n ? STATUS_MESSAGES.FETCHING_AGENT_PARTIALS\n : STATUS_MESSAGES.LOADING_AGENT_PARTIALS,\n );\n try {\n const agentDefs = await getAgentDefinitions(flags[\"agent-source\"], {\n forceRefresh: flags.refresh,\n });\n sourcePath = agentDefs.sourcePath;\n this.log(flags[\"agent-source\"] ? \"✓ Agent partials fetched\\n\" : \"✓ Agent partials loaded\\n\");\n } catch (error) {\n this.handleError(error);\n }\n\n this.log(STATUS_MESSAGES.RECOMPILING_AGENTS);\n try {\n const recompileResult = await recompileAgents({\n pluginDir,\n sourcePath,\n });\n\n if (recompileResult.failed.length > 0) {\n this.log(\n `✓ Recompiled ${recompileResult.compiled.length} agents (${recompileResult.failed.length} failed)\\n`,\n );\n for (const warning of recompileResult.warnings) {\n this.warn(warning);\n }\n } else if (recompileResult.compiled.length > 0) {\n this.log(`✓ Recompiled ${recompileResult.compiled.length} agents\\n`);\n } else {\n this.log(\"✓ No agents to recompile\\n\");\n }\n } catch (error) {\n this.warn(`Agent recompilation failed: ${getErrorMessage(error)}`);\n this.log(\"You can manually recompile with 'cc compile'.\\n\");\n }\n\n this.log(\"Updating plugin version...\");\n try {\n const newVersion = await bumpPluginVersion(pluginDir, \"patch\");\n this.log(`✓ Version bumped to ${newVersion}\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n const summaryParts = [`${addedSkills.length} added`, `${removedSkills.length} removed`];\n if (hasSourceChanges) {\n summaryParts.push(`${sourceChanges.size} source${sourceChanges.size > 1 ? \"s\" : \"\"} changed`);\n }\n this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jE,WAAK,IAAI,iDAAiD;AAAA,IAC5D;AAEA,SAAK,IAAI,4BAA4B;AACrC,QAAI;AACF,YAAM,aAAa,MAAM,kBAAkB,WAAW,OAAO;AAC7D,WAAK,IAAI,4BAAuB,UAAU;AAAA,CAAI;AAAA,IAChD,SAAS,OAAO;AACd,WAAK,YAAY,KAAK;AAAA,IACxB;AAEA,UAAM,eAAe,CAAC,GAAG,YAAY,MAAM,UAAU,GAAG,cAAc,MAAM,UAAU;AACtF,QAAI,kBAAkB;AACpB,mBAAa,KAAK,GAAG,cAAc,IAAI,UAAU,cAAc,OAAO,IAAI,MAAM,EAAE,UAAU;AAAA,IAC9F;AACA,SAAK,IAAI;AAAA,0BAA6B,aAAa,KAAK,IAAI,CAAC;AAAA,CAAK;AAAA,EACpE;AACF;","names":["result"]}
1
+ {"version":3,"sources":["../../src/cli/commands/edit.tsx"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { render } from \"ink\";\n\nimport { BaseCommand } from \"../base-command.js\";\nimport { Wizard, type WizardResultV2 } from \"../components/wizard/wizard.js\";\nimport { getErrorMessage } from \"../utils/errors.js\";\nimport { loadSkillsMatrixFromSource, getMarketplaceLabel } from \"../lib/loading/index.js\";\nimport { discoverAllPluginSkills } from \"../lib/plugins/index.js\";\nimport { archiveLocalSkill, restoreArchivedSkill } from \"../lib/skills/index.js\";\nimport { recompileAgents, getAgentDefinitions } from \"../lib/agents/index.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { detectInstallation } from \"../lib/installation/index.js\";\nimport { ERROR_MESSAGES, STATUS_MESSAGES, INFO_MESSAGES } from \"../utils/messages.js\";\nimport { claudePluginInstall, claudePluginUninstall } from \"../utils/exec.js\";\nimport type { SkillId } from \"../types/index.js\";\nimport { typedEntries } from \"../utils/typed-object.js\";\n\nconst SOURCE_DISPLAY_NAMES: Record<string, string> = {\n public: \"Public\",\n local: \"Local\",\n};\n\nfunction formatSourceDisplayName(sourceName: string): string {\n return SOURCE_DISPLAY_NAMES[sourceName] ?? sourceName;\n}\n\nexport default class Edit extends BaseCommand {\n static summary = \"Edit skills in the plugin\";\n static description = \"Modify the currently installed skills via interactive wizard\";\n\n static examples = [\n {\n description: \"Open the edit wizard\",\n command: \"<%= config.bin %> <%= command.id %>\",\n },\n {\n description: \"Edit with a custom source\",\n command: \"<%= config.bin %> <%= command.id %> --source github:org/marketplace\",\n },\n {\n description: \"Force refresh skills from remote\",\n command: \"<%= config.bin %> <%= command.id %> --refresh\",\n },\n ];\n\n static flags = {\n ...BaseCommand.baseFlags,\n refresh: Flags.boolean({\n description: \"Force refresh from remote sources\",\n default: false,\n }),\n \"agent-source\": Flags.string({\n description: \"Remote agent partials source (default: local CLI)\",\n }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Edit);\n\n const installation = await detectInstallation();\n\n if (!installation) {\n this.error(ERROR_MESSAGES.NO_INSTALLATION, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n const projectDir = process.cwd();\n const isPluginMode = installation.mode === \"plugin\";\n\n const modeLabel = installation.mode === \"local\" ? \"Local\" : \"Plugin\";\n this.log(`Edit ${modeLabel} Skills\\n`);\n\n this.log(STATUS_MESSAGES.LOADING_MARKETPLACE_SOURCE);\n let sourceResult;\n try {\n sourceResult = await loadSkillsMatrixFromSource({\n sourceFlag: flags.source,\n projectDir,\n forceRefresh: flags.refresh,\n });\n\n const sourceInfo = sourceResult.isLocal ? \"local\" : sourceResult.sourceConfig.sourceOrigin;\n this.log(\n `✓ Loaded ${Object.keys(sourceResult.matrix.skills).length} skills (${sourceInfo})\\n`,\n );\n } catch (error) {\n this.handleError(error);\n }\n\n this.log(\"Reading current skills...\");\n let currentSkillIds: SkillId[];\n try {\n const discoveredSkills = await discoverAllPluginSkills(projectDir);\n // Boundary cast: discoverAllPluginSkills keys are skill IDs from frontmatter\n currentSkillIds = Object.keys(discoveredSkills) as SkillId[];\n this.log(`✓ Current plugin has ${currentSkillIds.length} skills\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n let wizardResult: WizardResultV2 | null = null;\n const marketplaceLabel = getMarketplaceLabel(sourceResult);\n\n const { waitUntilExit } = render(\n <Wizard\n matrix={sourceResult.matrix}\n version={this.config.version}\n marketplaceLabel={marketplaceLabel}\n initialStep=\"build\"\n initialInstallMode={sourceResult.marketplace ? \"plugin\" : \"local\"}\n installedSkillIds={currentSkillIds}\n projectDir={process.cwd()}\n onComplete={(result) => {\n wizardResult = result as WizardResultV2;\n }}\n onCancel={() => {\n this.log(\"\\nEdit cancelled\");\n }}\n />,\n );\n\n await waitUntilExit();\n\n const result = wizardResult as WizardResultV2 | null;\n\n if (!result || result.cancelled) {\n this.error(\"Cancelled\", { exit: EXIT_CODES.CANCELLED });\n }\n\n if (!result.validation.valid) {\n const errorMessages = result.validation.errors.map((e) => e.message).join(\"\\n \");\n this.error(`Selection has validation errors:\\n ${errorMessages}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n const addedSkills = result.selectedSkills.filter((id) => !currentSkillIds.includes(id));\n const removedSkills = currentSkillIds.filter((id) => !result.selectedSkills.includes(id));\n\n // Detect source changes (user changed which source provides a skill)\n const sourceChanges = new Map<SkillId, { from: string; to: string }>();\n for (const [skillId, selectedSource] of typedEntries<SkillId, string>(\n result.sourceSelections,\n )) {\n const skill = sourceResult.matrix.skills[skillId];\n if (skill?.activeSource && skill.activeSource.name !== selectedSource) {\n sourceChanges.set(skillId, {\n from: skill.activeSource.name,\n to: selectedSource,\n });\n }\n }\n\n const hasSourceChanges = sourceChanges.size > 0;\n const hasSkillChanges = addedSkills.length > 0 || removedSkills.length > 0;\n\n if (result.validation.warnings.length > 0) {\n this.log(\"\\nWarnings:\");\n for (const warning of result.validation.warnings) {\n this.warn(` ! ${warning.message}`);\n }\n this.log(\"\");\n }\n\n if (!hasSkillChanges && !hasSourceChanges) {\n this.log(INFO_MESSAGES.NO_CHANGES_MADE);\n this.log(\"Plugin unchanged\\n\");\n return;\n }\n\n this.log(\"\\nChanges:\");\n for (const skillId of addedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` + ${skill?.displayName || skillId}`);\n }\n for (const skillId of removedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` - ${skill?.displayName || skillId}`);\n }\n for (const [skillId, change] of sourceChanges) {\n const fromLabel = formatSourceDisplayName(change.from);\n const toLabel = formatSourceDisplayName(change.to);\n this.log(` ~ ${skillId} (${fromLabel} \\u2192 ${toLabel})`);\n }\n this.log(\"\");\n\n // Apply source switches (archive/restore local skills)\n for (const [skillId, change] of sourceChanges) {\n if (change.from === \"local\") {\n await archiveLocalSkill(projectDir, skillId);\n }\n if (change.to === \"local\") {\n await restoreArchivedSkill(projectDir, skillId);\n }\n }\n\n // Install/uninstall skill plugins when in plugin mode with a marketplace\n if (isPluginMode && sourceResult.marketplace) {\n for (const skillId of addedSkills) {\n const pluginRef = `${skillId}@${sourceResult.marketplace}`;\n this.log(`Installing plugin: ${pluginRef}...`);\n try {\n await claudePluginInstall(pluginRef, \"project\", projectDir);\n } catch (error) {\n this.warn(`Failed to install plugin ${pluginRef}: ${getErrorMessage(error)}`);\n }\n }\n for (const skillId of removedSkills) {\n this.log(`Uninstalling plugin: ${skillId}...`);\n try {\n await claudePluginUninstall(skillId, \"project\", projectDir);\n } catch (error) {\n this.warn(`Failed to uninstall plugin ${skillId}: ${getErrorMessage(error)}`);\n }\n }\n }\n\n let sourcePath: string;\n this.log(\n flags[\"agent-source\"]\n ? STATUS_MESSAGES.FETCHING_AGENT_PARTIALS\n : STATUS_MESSAGES.LOADING_AGENT_PARTIALS,\n );\n try {\n const agentDefs = await getAgentDefinitions(flags[\"agent-source\"], {\n forceRefresh: flags.refresh,\n });\n sourcePath = agentDefs.sourcePath;\n this.log(flags[\"agent-source\"] ? \"✓ Agent partials fetched\\n\" : \"✓ Agent partials loaded\\n\");\n } catch (error) {\n this.handleError(error);\n }\n\n this.log(STATUS_MESSAGES.RECOMPILING_AGENTS);\n try {\n const recompileSkills = await discoverAllPluginSkills(projectDir);\n\n const recompileResult = await recompileAgents({\n pluginDir: projectDir,\n sourcePath,\n skills: recompileSkills,\n projectDir,\n outputDir: installation.agentsDir,\n });\n\n if (recompileResult.failed.length > 0) {\n this.log(\n `✓ Recompiled ${recompileResult.compiled.length} agents (${recompileResult.failed.length} failed)\\n`,\n );\n for (const warning of recompileResult.warnings) {\n this.warn(warning);\n }\n } else if (recompileResult.compiled.length > 0) {\n this.log(`✓ Recompiled ${recompileResult.compiled.length} agents\\n`);\n } else {\n this.log(\"✓ No agents to recompile\\n\");\n }\n } catch (error) {\n this.warn(`Agent recompilation failed: ${getErrorMessage(error)}`);\n this.log(\"You can manually recompile with 'cc compile'.\\n\");\n }\n\n const summaryParts = [`${addedSkills.length} added`, `${removedSkills.length} removed`];\n if (hasSourceChanges) {\n summaryParts.push(`${sourceChanges.size} source${sourceChanges.size > 1 ? \"s\" : \"\"} changed`);\n }\n this.log(`\\n\\u2713 Plugin updated! (${summaryParts.join(\", \")})\\n`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,aAAa;AACtB,SAAS,cAAc;AAwGjB;AAxFN,IAAM,uBAA+C;AAAA,EACnD,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,SAAS,wBAAwB,YAA4B;AAC3D,SAAO,qBAAqB,UAAU,KAAK;AAC7C;AAEA,IAAqB,OAArB,MAAqB,cAAa,YAAY;AAAA,EAC5C,OAAO,UAAU;AAAA,EACjB,OAAO,cAAc;AAAA,EAErB,OAAO,WAAW;AAAA,IAChB;AAAA,MACE,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA;AAAA,MACE,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,OAAO,QAAQ;AAAA,IACb,GA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AAA,MACrE,OAAO;AACL,aAAK,IAAI,iCAA4B;AAAA,MACvC;AAAA,IACF,SAAS,OAAO;AACd,WAAK,KAAK,+BAA+B,gBAAgB,KAAK,CAAC,EAAE;AACjE,WAAK,IAAI,iDAAiD;AAAA,IAC5D;AAEA,UAAM,eAAe,CAAC,GAAG,YAAY,MAAM,UAAU,GAAG,cAAc,MAAM,UAAU;AACtF,QAAI,kBAAkB;AACpB,mBAAa,KAAK,GAAG,cAAc,IAAI,UAAU,cAAc,OAAO,IAAI,MAAM,EAAE,UAAU;AAAA,IAC9F;AACA,SAAK,IAAI;AAAA,0BAA6B,aAAa,KAAK,IAAI,CAAC;AAAA,CAAK;AAAA,EACpE;AACF;","names":["result"]}
@@ -10,7 +10,7 @@ import {
10
10
  resolveSource,
11
11
  saveSourceToProjectConfig,
12
12
  typedKeys
13
- } from "../chunk-SSHG7MEE.js";
13
+ } from "../chunk-QUL7R35E.js";
14
14
  import {
15
15
  copy,
16
16
  directoryExists,
@@ -25,7 +25,7 @@ import {
25
25
  PROJECT_ROOT,
26
26
  STANDARD_FILES,
27
27
  YAML_FORMATTING
28
- } from "../chunk-IFODQTCX.js";
28
+ } from "../chunk-52XVP55K.js";
29
29
  import {
30
30
  init_esm_shims
31
31
  } from "../chunk-AWKZ5BDL.js";
@@ -12,7 +12,7 @@ import {
12
12
  computeFileHash,
13
13
  fetchFromSource,
14
14
  getCurrentDate
15
- } from "../../chunk-SSHG7MEE.js";
15
+ } from "../../chunk-QUL7R35E.js";
16
16
  import {
17
17
  copy,
18
18
  directoryExists,
@@ -30,7 +30,7 @@ import {
30
30
  LOCAL_SKILLS_PATH,
31
31
  STANDARD_FILES,
32
32
  YAML_FORMATTING
33
- } from "../../chunk-IFODQTCX.js";
33
+ } from "../../chunk-52XVP55K.js";
34
34
  import {
35
35
  init_esm_shims
36
36
  } from "../../chunk-AWKZ5BDL.js";
@@ -9,14 +9,14 @@ import {
9
9
  import {
10
10
  discoverLocalSkills,
11
11
  loadSkillsMatrixFromSource
12
- } from "../chunk-SSHG7MEE.js";
12
+ } from "../chunk-QUL7R35E.js";
13
13
  import {
14
14
  fileExists,
15
15
  readFile
16
16
  } from "../chunk-5WIHSJRO.js";
17
17
  import {
18
18
  STANDARD_FILES
19
- } from "../chunk-IFODQTCX.js";
19
+ } from "../chunk-52XVP55K.js";
20
20
  import {
21
21
  init_esm_shims
22
22
  } from "../chunk-AWKZ5BDL.js";
@@ -1,33 +1,37 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Wizard
4
- } from "../chunk-DUIYVKFK.js";
5
- import "../chunk-EP6J44I4.js";
6
- import "../chunk-7UKQZSWT.js";
7
- import "../chunk-G5WXKKQM.js";
8
- import "../chunk-N73GQTCK.js";
9
- import "../chunk-56ERY7H7.js";
10
- import "../chunk-XZKVOPCR.js";
11
- import "../chunk-GVVEPVR7.js";
12
- import "../chunk-EUPMWSM3.js";
13
- import "../chunk-FY5D4KIC.js";
14
- import "../chunk-AG5YGYJT.js";
4
+ } from "../chunk-X5AD7WWC.js";
5
+ import "../chunk-DH6F7EOJ.js";
6
+ import "../chunk-RFW2RIM7.js";
7
+ import "../chunk-FFZSN5C5.js";
8
+ import "../chunk-5P6RUVA7.js";
9
+ import "../chunk-HMZPUOWU.js";
10
+ import "../chunk-MYLRA7NI.js";
11
+ import "../chunk-VHVRPLDY.js";
12
+ import "../chunk-QR2ONHDW.js";
13
+ import "../chunk-H2NM6BDH.js";
14
+ import "../chunk-DTFEFLUU.js";
15
15
  import "../chunk-V2ZIH7HV.js";
16
- import "../chunk-WLQUQXWO.js";
17
- import "../chunk-MQAYAISQ.js";
18
- import "../chunk-OA5RCL2L.js";
19
- import "../chunk-ZX5DM4D5.js";
16
+ import "../chunk-WXW6SQ5K.js";
17
+ import "../chunk-JWIH7YQE.js";
18
+ import "../chunk-LY5HM34M.js";
19
+ import "../chunk-AGNT3FUE.js";
20
20
  import "../chunk-DIRH4PDF.js";
21
- import "../chunk-VTUPUKFD.js";
21
+ import "../chunk-KFL72CWK.js";
22
22
  import "../chunk-7ICBJZV2.js";
23
- import "../chunk-IRG52AN5.js";
23
+ import "../chunk-VIBOSHRL.js";
24
24
  import "../chunk-WPED6CL3.js";
25
- import "../chunk-AJFSCLJ7.js";
25
+ import "../chunk-F23LEXMC.js";
26
26
  import "../chunk-RXC7AF7N.js";
27
- import "../chunk-IQUBOWWU.js";
27
+ import {
28
+ claudePluginInstall,
29
+ claudePluginMarketplaceAdd,
30
+ claudePluginMarketplaceExists
31
+ } from "../chunk-EOJTMX7T.js";
32
+ import "../chunk-WWLEF4MQ.js";
28
33
  import {
29
34
  DRY_RUN_MESSAGES,
30
- ERROR_MESSAGES,
31
35
  INFO_MESSAGES,
32
36
  STATUS_MESSAGES,
33
37
  SUCCESS_MESSAGES
@@ -37,19 +41,16 @@ import {
37
41
  EXIT_CODES
38
42
  } from "../chunk-5I6VY2E7.js";
39
43
  import {
40
- claudePluginInstall,
41
- claudePluginMarketplaceAdd,
42
- claudePluginMarketplaceExists,
43
- getCollectivePluginDir,
44
+ detectInstallation,
44
45
  getMarketplaceLabel,
46
+ hasIndividualPlugins,
45
47
  installLocal,
46
- installStackAsPlugin,
47
- loadSkillsMatrixFromSource,
48
- saveSourceToProjectConfig
49
- } from "../chunk-SSHG7MEE.js";
48
+ installPluginConfig,
49
+ loadSkillsMatrixFromSource
50
+ } from "../chunk-QUL7R35E.js";
50
51
  import {
51
- directoryExists,
52
52
  fileExists,
53
+ getErrorMessage,
53
54
  readFileSafe,
54
55
  settingsFileSchema,
55
56
  warn,
@@ -60,7 +61,7 @@ import {
60
61
  CLI_COLORS,
61
62
  LOCAL_SKILLS_PATH,
62
63
  MAX_CONFIG_FILE_SIZE
63
- } from "../chunk-IFODQTCX.js";
64
+ } from "../chunk-52XVP55K.js";
64
65
  import {
65
66
  init_esm_shims
66
67
  } from "../chunk-AWKZ5BDL.js";
@@ -184,10 +185,11 @@ var Init = class _Init extends BaseCommand {
184
185
  this.log(`${DRY_RUN_MESSAGES.PREVIEW_NO_FILES_CREATED}
185
186
  `);
186
187
  }
187
- const pluginDir = getCollectivePluginDir();
188
- const pluginExists = await directoryExists(pluginDir);
189
- if (pluginExists) {
190
- this.warn(`Claude Collective is already initialized at ${pluginDir}`);
188
+ const individualPluginsExist = await hasIndividualPlugins(projectDir);
189
+ const existingInstallation = await detectInstallation(projectDir);
190
+ if (individualPluginsExist || existingInstallation) {
191
+ const location = individualPluginsExist ? `.claude/settings.json` : existingInstallation?.configPath ?? projectDir;
192
+ this.warn(`Claude Collective is already initialized at ${location}`);
191
193
  this.log(`Use 'cc edit' to modify skills.`);
192
194
  this.log(INFO_MESSAGES.NO_CHANGES_MADE);
193
195
  return;
@@ -200,7 +202,7 @@ var Init = class _Init extends BaseCommand {
200
202
  forceRefresh: flags.refresh
201
203
  });
202
204
  } catch (error) {
203
- this.error(error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR, {
205
+ this.error(getErrorMessage(error), {
204
206
  exit: EXIT_CODES.ERROR
205
207
  });
206
208
  }
@@ -294,9 +296,7 @@ ${DRY_RUN_MESSAGES.COMPLETE_NO_FILES_CREATED}`);
294
296
  return;
295
297
  }
296
298
  if (result.installMode === "plugin") {
297
- if (result.selectedStackId) {
298
- await this.installPluginMode(result, sourceResult, flags);
299
- } else if (sourceResult.marketplace) {
299
+ if (sourceResult.marketplace) {
300
300
  await this.installIndividualPlugins(result, sourceResult, flags);
301
301
  } else {
302
302
  this.warn("Plugin Mode requires a marketplace for individual skill installation.");
@@ -308,105 +308,75 @@ ${DRY_RUN_MESSAGES.COMPLETE_NO_FILES_CREATED}`);
308
308
  }
309
309
  await this.installLocalMode(result, sourceResult, flags);
310
310
  }
311
- async installPluginMode(result, sourceResult, flags) {
312
- if (!result.selectedStackId) {
313
- throw new Error(
314
- "Plugin Mode requires a stack selection, but no stack was selected.\nTo fix this, either:\n 1. Re-run 'cc init' and select a stack during the wizard\n 2. Use Local Mode instead (copies skills to .claude/skills/)"
315
- );
316
- }
311
+ async installIndividualPlugins(result, sourceResult, flags) {
317
312
  const projectDir = process.cwd();
318
313
  if (sourceResult.marketplace) {
319
314
  const marketplaceExists = await claudePluginMarketplaceExists(sourceResult.marketplace);
320
315
  if (!marketplaceExists) {
321
316
  this.log(`Registering marketplace "${sourceResult.marketplace}"...`);
322
317
  try {
323
- await claudePluginMarketplaceAdd(
324
- sourceResult.sourceConfig.source,
325
- sourceResult.marketplace
326
- );
318
+ await claudePluginMarketplaceAdd(sourceResult.marketplace);
327
319
  this.log(`Registered marketplace: ${sourceResult.marketplace}`);
328
320
  } catch (error) {
329
- this.error(error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR_SHORT, {
321
+ this.error(getErrorMessage(error), {
330
322
  exit: EXIT_CODES.ERROR
331
323
  });
332
324
  }
333
325
  }
334
326
  }
335
- const installMethod = sourceResult.marketplace ? `Installing from marketplace "${sourceResult.marketplace}"` : "Compiling and installing";
336
- this.log(`${installMethod} stack "${result.selectedStackId}"...`);
327
+ this.log("Installing skill plugins...");
328
+ for (const skillId of result.selectedSkills) {
329
+ const pluginRef = `${skillId}@${sourceResult.marketplace}`;
330
+ try {
331
+ await claudePluginInstall(pluginRef, "project", projectDir);
332
+ this.log(` Installed ${pluginRef}`);
333
+ } catch (error) {
334
+ this.error(`Failed to install plugin ${pluginRef}: ${getErrorMessage(error)}`, {
335
+ exit: EXIT_CODES.ERROR
336
+ });
337
+ }
338
+ }
339
+ this.log(`Installed ${result.selectedSkills.length} skill plugins
340
+ `);
341
+ this.log("Generating configuration...");
337
342
  try {
338
- const installResult = await installStackAsPlugin({
339
- stackId: result.selectedStackId,
343
+ const configResult = await installPluginConfig({
344
+ wizardResult: result,
345
+ sourceResult,
340
346
  projectDir,
341
- sourcePath: sourceResult.sourcePath,
342
- agentSourcePath: sourceResult.sourcePath,
343
- marketplace: sourceResult.marketplace
347
+ sourceFlag: flags.source
344
348
  });
345
- const installedFrom = installResult.fromMarketplace ? `from marketplace` : `(compiled locally)`;
346
- this.log(`Installed stack plugin: ${installResult.pluginName} ${installedFrom}
349
+ if (configResult.wasMerged) {
350
+ this.log(`Merged with existing config at ${configResult.mergedConfigPath}`);
351
+ }
352
+ this.log(`Configuration saved (${configResult.config.agents.length} agents)
353
+ `);
354
+ this.log(STATUS_MESSAGES.COMPILING_AGENTS);
355
+ this.log(`Compiled ${configResult.compiledAgents.length} agents to .claude/agents/
347
356
  `);
348
357
  this.log(`${SUCCESS_MESSAGES.INIT_SUCCESS}
349
358
  `);
350
- this.log(`Stack "${installResult.stackName}" installed as plugin`);
351
- if (installResult.agents.length > 0) {
352
- this.log("\nAgents included:");
353
- for (const agentName of installResult.agents) {
354
- this.log(` ${agentName}`);
355
- }
356
- this.log(`
357
- Skills bundled: ${installResult.skills.length}`);
359
+ this.log("Agents compiled to:");
360
+ this.log(` ${configResult.agentsDir}`);
361
+ for (const agentName of configResult.compiledAgents) {
362
+ this.log(` ${agentName}.md`);
358
363
  }
359
364
  this.log("");
360
- if (flags.source) {
361
- await saveSourceToProjectConfig(projectDir, flags.source);
362
- this.log(`Source saved to .claude-src/config.yaml`);
363
- }
365
+ this.log("Configuration:");
366
+ this.log(` ${configResult.configPath}`);
367
+ this.log("");
368
+ this.log("To customize agent-skill assignments:");
369
+ this.log(` 1. Edit .claude-src/config.yaml`);
370
+ this.log(` 2. Run 'cc compile' to regenerate agents`);
371
+ this.log("");
364
372
  const permissionWarning = await checkPermissions(projectDir);
365
373
  if (permissionWarning) {
366
374
  const { waitUntilExit } = render(permissionWarning);
367
375
  await waitUntilExit();
368
376
  }
369
377
  } catch (error) {
370
- this.error(error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR_SHORT, {
371
- exit: EXIT_CODES.ERROR
372
- });
373
- }
374
- }
375
- async installIndividualPlugins(result, sourceResult, flags) {
376
- const projectDir = process.cwd();
377
- if (sourceResult.marketplace) {
378
- const marketplaceExists = await claudePluginMarketplaceExists(sourceResult.marketplace);
379
- if (!marketplaceExists) {
380
- this.log(`Registering marketplace "${sourceResult.marketplace}"...`);
381
- try {
382
- await claudePluginMarketplaceAdd(
383
- sourceResult.sourceConfig.source,
384
- sourceResult.marketplace
385
- );
386
- this.log(`Registered marketplace: ${sourceResult.marketplace}`);
387
- } catch (error) {
388
- this.error(error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR_SHORT, {
389
- exit: EXIT_CODES.ERROR
390
- });
391
- }
392
- }
393
- }
394
- this.log("Installing skill plugins...");
395
- for (const skillId of result.selectedSkills) {
396
- const pluginRef = `${skillId}@${sourceResult.marketplace}`;
397
- try {
398
- await claudePluginInstall(pluginRef, "project", projectDir);
399
- this.log(` Installed ${pluginRef}`);
400
- } catch (error) {
401
- this.error(
402
- `Failed to install plugin ${pluginRef}: ${error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR_SHORT}`,
403
- { exit: EXIT_CODES.ERROR }
404
- );
405
- }
378
+ this.handleError(error);
406
379
  }
407
- this.log(`Installed ${result.selectedSkills.length} skill plugins
408
- `);
409
- await this.installLocalMode(result, sourceResult, flags);
410
380
  }
411
381
  async installLocalMode(result, sourceResult, flags) {
412
382
  const projectDir = process.cwd();