@claude-collective/cli 0.8.0 → 0.13.1

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 (221) hide show
  1. package/CHANGELOG.md +138 -0
  2. package/README.md +26 -9
  3. package/config/skills-matrix.yaml +858 -0
  4. package/config/stacks.yaml +254 -0
  5. package/dist/{chunk-TOPAIL5W.js → chunk-3U3R4NCG.js} +2 -2
  6. package/dist/chunk-3U3R4NCG.js.map +1 -0
  7. package/dist/{chunk-YKXBGCFD.js → chunk-57Y5RALO.js} +10 -10
  8. package/dist/chunk-57Y5RALO.js.map +1 -0
  9. package/dist/{chunk-ED73HCW2.js → chunk-6DCSSORF.js} +37 -88
  10. package/dist/chunk-6DCSSORF.js.map +1 -0
  11. package/dist/{chunk-6LS7XO3H.js → chunk-6Q3Y7KVB.js} +2 -2
  12. package/dist/chunk-6Q3Y7KVB.js.map +1 -0
  13. package/dist/{chunk-A3J6IAXK.js → chunk-76DWXGQE.js} +4 -2
  14. package/dist/chunk-76DWXGQE.js.map +1 -0
  15. package/dist/{chunk-Q6DR5QUH.js → chunk-7Q44DMSP.js} +62 -27
  16. package/dist/chunk-7Q44DMSP.js.map +1 -0
  17. package/dist/chunk-ACNBKXXJ.js +321 -0
  18. package/dist/chunk-ACNBKXXJ.js.map +1 -0
  19. package/dist/{chunk-QGGSLMO3.js → chunk-B7CCVP6Q.js} +41 -9
  20. package/dist/chunk-B7CCVP6Q.js.map +1 -0
  21. package/dist/{chunk-LVKRVFYR.js → chunk-BDLUZVKU.js} +2 -2
  22. package/dist/chunk-BDLUZVKU.js.map +1 -0
  23. package/dist/{chunk-HNDT5QRB.js → chunk-CDX4W4DM.js} +3 -3
  24. package/dist/chunk-CDX4W4DM.js.map +1 -0
  25. package/dist/{chunk-MYAVQ23U.js → chunk-CJEHB4TB.js} +23 -9
  26. package/dist/chunk-CJEHB4TB.js.map +1 -0
  27. package/dist/{chunk-DKGL77IY.js → chunk-CPZOTVCI.js} +15 -14
  28. package/dist/chunk-CPZOTVCI.js.map +1 -0
  29. package/dist/{chunk-K7PTOVX4.js → chunk-D237EVNB.js} +32 -3
  30. package/dist/chunk-D237EVNB.js.map +1 -0
  31. package/dist/{chunk-Q2LH2DAB.js → chunk-DRXPNNPB.js} +19 -18
  32. package/dist/chunk-DRXPNNPB.js.map +1 -0
  33. package/dist/{chunk-Y3V43XCU.js → chunk-E3FJH4TF.js} +12 -8
  34. package/dist/chunk-E3FJH4TF.js.map +1 -0
  35. package/dist/{chunk-3HBTELJN.js → chunk-ED4E6Q2T.js} +10 -10
  36. package/dist/chunk-ED4E6Q2T.js.map +1 -0
  37. package/dist/{chunk-SYQ7R2JO.js → chunk-EHS3TWWP.js} +3 -3
  38. package/dist/chunk-EHS3TWWP.js.map +1 -0
  39. package/dist/{chunk-LQTST4WY.js → chunk-GDH553MV.js} +6 -6
  40. package/dist/chunk-GDH553MV.js.map +1 -0
  41. package/dist/{chunk-A65SBAAJ.js → chunk-HLJX2FTL.js} +31 -5
  42. package/dist/chunk-HLJX2FTL.js.map +1 -0
  43. package/dist/chunk-I2DSLOXZ.js +75 -0
  44. package/dist/chunk-I2DSLOXZ.js.map +1 -0
  45. package/dist/{chunk-SEBPPFUW.js → chunk-I4TPKIYX.js} +33 -18
  46. package/dist/chunk-I4TPKIYX.js.map +1 -0
  47. package/dist/{chunk-NGBFJJ7Q.js → chunk-IMDW5ZUP.js} +19 -11
  48. package/dist/chunk-IMDW5ZUP.js.map +1 -0
  49. package/dist/{chunk-U4VYHKPM.js → chunk-JIPWV2FX.js} +6 -6
  50. package/dist/chunk-JIPWV2FX.js.map +1 -0
  51. package/dist/{chunk-G2FBJOZG.js → chunk-K7EVM5LY.js} +4 -4
  52. package/dist/chunk-K7EVM5LY.js.map +1 -0
  53. package/dist/{chunk-MJSFR562.js → chunk-KAAEN2PO.js} +3 -3
  54. package/dist/chunk-KAAEN2PO.js.map +1 -0
  55. package/dist/{chunk-FNOYEXUE.js → chunk-LE6IY6IT.js} +22 -17
  56. package/dist/chunk-LE6IY6IT.js.map +1 -0
  57. package/dist/{chunk-CIY5UBRB.js → chunk-NDY25DTL.js} +6 -6
  58. package/dist/chunk-NDY25DTL.js.map +1 -0
  59. package/dist/{chunk-OLBOTK3O.js → chunk-P26A2K5N.js} +7 -7
  60. package/dist/chunk-P26A2K5N.js.map +1 -0
  61. package/dist/{chunk-DHFFRMF6.js → chunk-RTE64SJA.js} +2 -2
  62. package/dist/chunk-RTE64SJA.js.map +1 -0
  63. package/dist/{chunk-3ZCB5K33.js → chunk-SGJ23HIP.js} +14 -11
  64. package/dist/chunk-SGJ23HIP.js.map +1 -0
  65. package/dist/{chunk-C4ZTIYFR.js → chunk-SVYPSDWY.js} +10 -10
  66. package/dist/chunk-SVYPSDWY.js.map +1 -0
  67. package/dist/{chunk-MMDXNZPF.js → chunk-TKFPKEV3.js} +2 -2
  68. package/dist/chunk-TKFPKEV3.js.map +1 -0
  69. package/dist/{chunk-M7YCPFIX.js → chunk-UQTEPWU7.js} +2 -2
  70. package/dist/chunk-UQTEPWU7.js.map +1 -0
  71. package/dist/{chunk-QESUUPOE.js → chunk-V46GGCCI.js} +80 -27
  72. package/dist/chunk-V46GGCCI.js.map +1 -0
  73. package/dist/{chunk-UOWHJ6BE.js → chunk-X6QONICW.js} +6 -3
  74. package/dist/chunk-X6QONICW.js.map +1 -0
  75. package/dist/chunk-Y2LW7R3Y.js +23 -0
  76. package/dist/chunk-Y2LW7R3Y.js.map +1 -0
  77. package/dist/chunk-Z2CWURZ6.js +78 -0
  78. package/dist/chunk-Z2CWURZ6.js.map +1 -0
  79. package/dist/chunk-Z7G4B5HJ.js +377 -0
  80. package/dist/chunk-Z7G4B5HJ.js.map +1 -0
  81. package/dist/{chunk-XKEG3SCV.js → chunk-ZENYS6KW.js} +13 -9
  82. package/dist/chunk-ZENYS6KW.js.map +1 -0
  83. package/dist/{cli-v2 → cli}/defaults/agent-mappings.yaml +5 -5
  84. package/dist/commands/build/marketplace.js +9 -9
  85. package/dist/commands/build/marketplace.js.map +1 -1
  86. package/dist/commands/build/plugins.js +12 -12
  87. package/dist/commands/build/plugins.js.map +1 -1
  88. package/dist/commands/build/stack.js +15 -15
  89. package/dist/commands/build/stack.js.map +1 -1
  90. package/dist/commands/compile.js +21 -21
  91. package/dist/commands/compile.js.map +1 -1
  92. package/dist/commands/config/get.js +9 -8
  93. package/dist/commands/config/get.js.map +1 -1
  94. package/dist/commands/config/index.js +7 -6
  95. package/dist/commands/config/index.js.map +1 -1
  96. package/dist/commands/config/path.js +8 -7
  97. package/dist/commands/config/path.js.map +1 -1
  98. package/dist/commands/config/set-project.js +9 -8
  99. package/dist/commands/config/set-project.js.map +1 -1
  100. package/dist/commands/config/set.js +9 -8
  101. package/dist/commands/config/set.js.map +1 -1
  102. package/dist/commands/config/show.js +6 -5
  103. package/dist/commands/config/unset-project.js +9 -8
  104. package/dist/commands/config/unset-project.js.map +1 -1
  105. package/dist/commands/config/unset.js +9 -8
  106. package/dist/commands/config/unset.js.map +1 -1
  107. package/dist/commands/diff.js +12 -12
  108. package/dist/commands/diff.js.map +1 -1
  109. package/dist/commands/doctor.js +10 -10
  110. package/dist/commands/doctor.js.map +1 -1
  111. package/dist/commands/edit.js +52 -49
  112. package/dist/commands/edit.js.map +1 -1
  113. package/dist/commands/eject.js +180 -97
  114. package/dist/commands/eject.js.map +1 -1
  115. package/dist/commands/import/skill.js +339 -0
  116. package/dist/commands/import/skill.js.map +1 -0
  117. package/dist/commands/info.js +9 -9
  118. package/dist/commands/info.js.map +1 -1
  119. package/dist/commands/init.js +205 -78
  120. package/dist/commands/init.js.map +1 -1
  121. package/dist/commands/list.js +9 -9
  122. package/dist/commands/list.js.map +1 -1
  123. package/dist/commands/new/agent.js +19 -21
  124. package/dist/commands/new/agent.js.map +1 -1
  125. package/dist/commands/new/skill.js +11 -12
  126. package/dist/commands/new/skill.js.map +1 -1
  127. package/dist/commands/outdated.js +12 -12
  128. package/dist/commands/outdated.js.map +1 -1
  129. package/dist/commands/search.js +205 -17
  130. package/dist/commands/search.js.map +1 -1
  131. package/dist/commands/test-imports.js +18 -18
  132. package/dist/commands/test-imports.js.map +1 -1
  133. package/dist/commands/uninstall.js +58 -78
  134. package/dist/commands/uninstall.js.map +1 -1
  135. package/dist/commands/update.js +21 -21
  136. package/dist/commands/update.js.map +1 -1
  137. package/dist/commands/validate.js +9 -9
  138. package/dist/commands/validate.js.map +1 -1
  139. package/dist/commands/version/bump.js +8 -8
  140. package/dist/commands/version/bump.js.map +1 -1
  141. package/dist/commands/version/index.js +8 -8
  142. package/dist/commands/version/index.js.map +1 -1
  143. package/dist/commands/version/set.js +7 -7
  144. package/dist/commands/version/set.js.map +1 -1
  145. package/dist/commands/version/show.js +8 -8
  146. package/dist/commands/version/show.js.map +1 -1
  147. package/dist/components/common/confirm.js +1 -1
  148. package/dist/components/common/message.js +1 -1
  149. package/dist/components/common/message.js.map +1 -1
  150. package/dist/components/common/spinner.js +1 -1
  151. package/dist/components/common/spinner.js.map +1 -1
  152. package/dist/components/skill-search/skill-search.js +10 -0
  153. package/dist/components/skill-search/skill-search.js.map +1 -0
  154. package/dist/components/wizard/category-grid.js +1 -1
  155. package/dist/components/wizard/category-grid.test.js +213 -80
  156. package/dist/components/wizard/category-grid.test.js.map +1 -1
  157. package/dist/components/wizard/section-progress.js +1 -1
  158. package/dist/components/wizard/section-progress.test.js +2 -2
  159. package/dist/components/wizard/section-progress.test.js.map +1 -1
  160. package/dist/components/wizard/step-approach.js +4 -3
  161. package/dist/components/wizard/step-build.js +4 -3
  162. package/dist/components/wizard/step-build.test.js +29 -17
  163. package/dist/components/wizard/step-build.test.js.map +1 -1
  164. package/dist/components/wizard/step-confirm.js +2 -1
  165. package/dist/components/wizard/step-refine.js +2 -1
  166. package/dist/components/wizard/step-refine.test.js +4 -3
  167. package/dist/components/wizard/step-refine.test.js.map +1 -1
  168. package/dist/components/wizard/step-stack-options.js +3 -3
  169. package/dist/components/wizard/step-stack.js +3 -3
  170. package/dist/components/wizard/wizard-footer.js +9 -0
  171. package/dist/components/wizard/wizard-footer.js.map +1 -0
  172. package/dist/components/wizard/wizard-tabs.js +1 -1
  173. package/dist/components/wizard/wizard.js +14 -12
  174. package/dist/config/skills-matrix.yaml +858 -0
  175. package/dist/config/stacks.yaml +254 -0
  176. package/dist/hooks/init.js +5 -4
  177. package/dist/hooks/init.js.map +1 -1
  178. package/dist/index.js +1 -1
  179. package/dist/index.js.map +1 -1
  180. package/dist/stores/wizard-store.js +2 -2
  181. package/dist/stores/wizard-store.test.js +3 -3
  182. package/dist/stores/wizard-store.test.js.map +1 -1
  183. package/package.json +4 -2
  184. package/dist/chunk-3HBTELJN.js.map +0 -1
  185. package/dist/chunk-3ZCB5K33.js.map +0 -1
  186. package/dist/chunk-6LS7XO3H.js.map +0 -1
  187. package/dist/chunk-A3J6IAXK.js.map +0 -1
  188. package/dist/chunk-A65SBAAJ.js.map +0 -1
  189. package/dist/chunk-ALEPJ6YN.js +0 -80
  190. package/dist/chunk-ALEPJ6YN.js.map +0 -1
  191. package/dist/chunk-C4ZTIYFR.js.map +0 -1
  192. package/dist/chunk-CIY5UBRB.js.map +0 -1
  193. package/dist/chunk-DHFFRMF6.js.map +0 -1
  194. package/dist/chunk-DKGL77IY.js.map +0 -1
  195. package/dist/chunk-ED73HCW2.js.map +0 -1
  196. package/dist/chunk-FNOYEXUE.js.map +0 -1
  197. package/dist/chunk-G2FBJOZG.js.map +0 -1
  198. package/dist/chunk-HNDT5QRB.js.map +0 -1
  199. package/dist/chunk-K7PTOVX4.js.map +0 -1
  200. package/dist/chunk-LQTST4WY.js.map +0 -1
  201. package/dist/chunk-LVKRVFYR.js.map +0 -1
  202. package/dist/chunk-M7YCPFIX.js.map +0 -1
  203. package/dist/chunk-MJSFR562.js.map +0 -1
  204. package/dist/chunk-MMDXNZPF.js.map +0 -1
  205. package/dist/chunk-MYAVQ23U.js.map +0 -1
  206. package/dist/chunk-NGBFJJ7Q.js.map +0 -1
  207. package/dist/chunk-OLBOTK3O.js.map +0 -1
  208. package/dist/chunk-PPNTD5LO.js +0 -330
  209. package/dist/chunk-PPNTD5LO.js.map +0 -1
  210. package/dist/chunk-Q2LH2DAB.js.map +0 -1
  211. package/dist/chunk-Q6DR5QUH.js.map +0 -1
  212. package/dist/chunk-QESUUPOE.js.map +0 -1
  213. package/dist/chunk-QGGSLMO3.js.map +0 -1
  214. package/dist/chunk-SEBPPFUW.js.map +0 -1
  215. package/dist/chunk-SYQ7R2JO.js.map +0 -1
  216. package/dist/chunk-TOPAIL5W.js.map +0 -1
  217. package/dist/chunk-U4VYHKPM.js.map +0 -1
  218. package/dist/chunk-UOWHJ6BE.js.map +0 -1
  219. package/dist/chunk-XKEG3SCV.js.map +0 -1
  220. package/dist/chunk-Y3V43XCU.js.map +0 -1
  221. package/dist/chunk-YKXBGCFD.js.map +0 -1
@@ -1,64 +1,66 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  bumpPluginVersion
4
- } from "../chunk-OLBOTK3O.js";
4
+ } from "../chunk-P26A2K5N.js";
5
5
  import {
6
6
  getAgentDefinitions
7
- } from "../chunk-C4ZTIYFR.js";
7
+ } from "../chunk-SVYPSDWY.js";
8
8
  import {
9
9
  detectInstallation
10
- } from "../chunk-3ZCB5K33.js";
10
+ } from "../chunk-SGJ23HIP.js";
11
11
  import {
12
12
  recompileAgents
13
- } from "../chunk-FNOYEXUE.js";
14
- import "../chunk-MYAVQ23U.js";
15
- import {
16
- copySkillsToPluginFromSource
17
- } from "../chunk-G2FBJOZG.js";
13
+ } from "../chunk-LE6IY6IT.js";
18
14
  import {
19
15
  Wizard
20
- } from "../chunk-ED73HCW2.js";
21
- import "../chunk-A65SBAAJ.js";
22
- import "../chunk-HNDT5QRB.js";
23
- import "../chunk-ALEPJ6YN.js";
24
- import "../chunk-XKEG3SCV.js";
25
- import "../chunk-Q6DR5QUH.js";
26
- import "../chunk-LVKRVFYR.js";
27
- import "../chunk-UOWHJ6BE.js";
28
- import "../chunk-Y3V43XCU.js";
29
- import "../chunk-PPNTD5LO.js";
30
- import "../chunk-K7PTOVX4.js";
31
- import "../chunk-Q2LH2DAB.js";
32
- import "../chunk-LQTST4WY.js";
33
- import "../chunk-MJSFR562.js";
34
- import "../chunk-SEBPPFUW.js";
16
+ } from "../chunk-6DCSSORF.js";
17
+ import "../chunk-E3FJH4TF.js";
18
+ import "../chunk-HLJX2FTL.js";
19
+ import "../chunk-CDX4W4DM.js";
20
+ import "../chunk-I2DSLOXZ.js";
21
+ import "../chunk-ZENYS6KW.js";
22
+ import "../chunk-7Q44DMSP.js";
23
+ import "../chunk-Z7G4B5HJ.js";
24
+ import "../chunk-BDLUZVKU.js";
25
+ import "../chunk-X6QONICW.js";
26
+ import "../chunk-Y2LW7R3Y.js";
27
+ import "../chunk-D237EVNB.js";
28
+ import "../chunk-Z2CWURZ6.js";
29
+ import "../chunk-DRXPNNPB.js";
30
+ import "../chunk-GDH553MV.js";
31
+ import "../chunk-I4TPKIYX.js";
35
32
  import {
36
33
  getCollectivePluginDir,
37
34
  getPluginSkillIds,
38
35
  getPluginSkillsDir
39
- } from "../chunk-3HBTELJN.js";
36
+ } from "../chunk-ED4E6Q2T.js";
37
+ import "../chunk-CJEHB4TB.js";
38
+ import {
39
+ copySkillsToPluginFromSource
40
+ } from "../chunk-K7EVM5LY.js";
41
+ import "../chunk-KAAEN2PO.js";
40
42
  import {
41
43
  loadSkillsMatrixFromSource
42
- } from "../chunk-DKGL77IY.js";
43
- import "../chunk-QGGSLMO3.js";
44
- import "../chunk-NGBFJJ7Q.js";
45
- import "../chunk-QESUUPOE.js";
46
- import "../chunk-A3J6IAXK.js";
44
+ } from "../chunk-CPZOTVCI.js";
45
+ import "../chunk-B7CCVP6Q.js";
46
+ import "../chunk-IMDW5ZUP.js";
47
47
  import {
48
48
  BaseCommand,
49
49
  EXIT_CODES
50
- } from "../chunk-SYQ7R2JO.js";
51
- import "../chunk-TOPAIL5W.js";
50
+ } from "../chunk-EHS3TWWP.js";
51
+ import "../chunk-V46GGCCI.js";
52
+ import "../chunk-3U3R4NCG.js";
52
53
  import {
53
54
  directoryExists,
54
55
  ensureDir,
55
56
  remove
56
- } from "../chunk-MMDXNZPF.js";
57
+ } from "../chunk-TKFPKEV3.js";
58
+ import "../chunk-76DWXGQE.js";
57
59
  import {
58
60
  init_esm_shims
59
61
  } from "../chunk-DHET7RCE.js";
60
62
 
61
- // src/cli-v2/commands/edit.tsx
63
+ // src/cli/commands/edit.tsx
62
64
  init_esm_shims();
63
65
  import { Flags } from "@oclif/core";
64
66
  import { render } from "ink";
@@ -125,8 +127,8 @@ var Edit = class _Edit extends BaseCommand {
125
127
  {
126
128
  matrix: sourceResult.matrix,
127
129
  initialSkills: currentSkillIds,
128
- onComplete: (result) => {
129
- wizardResult = result;
130
+ onComplete: (result2) => {
131
+ wizardResult = result2;
130
132
  },
131
133
  onCancel: () => {
132
134
  this.log("\nEdit cancelled");
@@ -135,25 +137,26 @@ var Edit = class _Edit extends BaseCommand {
135
137
  )
136
138
  );
137
139
  await waitUntilExit();
138
- if (!wizardResult || wizardResult.cancelled) {
139
- this.exit(EXIT_CODES.CANCELLED);
140
+ const result = wizardResult;
141
+ if (!result || result.cancelled) {
142
+ this.error("Cancelled", { exit: EXIT_CODES.CANCELLED });
140
143
  }
141
- if (!wizardResult.validation.valid) {
142
- this.error("Selection has validation errors:");
143
- for (const error of wizardResult.validation.errors) {
144
- this.log(` ${error.message}`);
145
- }
146
- this.exit(EXIT_CODES.ERROR);
144
+ if (!result.validation.valid) {
145
+ const errorMessages = result.validation.errors.map((e) => e.message).join("\n ");
146
+ this.error(`Selection has validation errors:
147
+ ${errorMessages}`, {
148
+ exit: EXIT_CODES.ERROR
149
+ });
147
150
  }
148
- const addedSkills = wizardResult.selectedSkills.filter(
151
+ const addedSkills = result.selectedSkills.filter(
149
152
  (id) => !currentSkillIds.includes(id)
150
153
  );
151
154
  const removedSkills = currentSkillIds.filter(
152
- (id) => !wizardResult.selectedSkills.includes(id)
155
+ (id) => !result.selectedSkills.includes(id)
153
156
  );
154
- if (wizardResult.validation.warnings.length > 0) {
157
+ if (result.validation.warnings.length > 0) {
155
158
  this.log("\nWarnings:");
156
- for (const warning of wizardResult.validation.warnings) {
159
+ for (const warning of result.validation.warnings) {
157
160
  this.warn(` ! ${warning.message}`);
158
161
  }
159
162
  this.log("");
@@ -180,13 +183,13 @@ var Edit = class _Edit extends BaseCommand {
180
183
  }
181
184
  await ensureDir(pluginSkillsDir);
182
185
  await copySkillsToPluginFromSource(
183
- wizardResult.selectedSkills,
186
+ result.selectedSkills,
184
187
  pluginDir,
185
188
  sourceResult.matrix,
186
189
  sourceResult
187
190
  );
188
191
  this.log(
189
- `\u2713 Plugin updated with ${wizardResult.selectedSkills.length} skills
192
+ `\u2713 Plugin updated with ${result.selectedSkills.length} skills
190
193
  `
191
194
  );
192
195
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli-v2/commands/edit.tsx"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { render } from \"ink\";\nimport React from \"react\";\nimport { BaseCommand } from \"../base-command.js\";\nimport { Wizard, WizardResult } from \"../components/wizard/wizard.js\";\nimport { loadSkillsMatrixFromSource } from \"../lib/source-loader.js\";\nimport { directoryExists, ensureDir, remove } from \"../utils/fs.js\";\nimport {\n getCollectivePluginDir,\n getPluginSkillsDir,\n getPluginSkillIds,\n} from \"../lib/plugin-finder.js\";\nimport { copySkillsToPluginFromSource } from \"../lib/skill-copier.js\";\nimport { recompileAgents } from \"../lib/agent-recompiler.js\";\nimport { bumpPluginVersion } from \"../lib/plugin-version.js\";\nimport { getAgentDefinitions } from \"../lib/agent-fetcher.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { detectInstallation } from \"../lib/installation.js\";\n\nexport default class Edit extends BaseCommand {\n static summary = \"Edit skills in the plugin\";\n static description =\n \"Modify the currently installed skills via interactive wizard\";\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 // Detect installation mode\n const installation = await detectInstallation();\n\n if (!installation) {\n this.error(\n \"No installation found. Run 'cc init' first to set up Claude Collective.\",\n { exit: EXIT_CODES.ERROR },\n );\n }\n\n const pluginDir = getCollectivePluginDir();\n const pluginSkillsDir =\n installation.mode === \"local\"\n ? installation.skillsDir\n : getPluginSkillsDir(pluginDir);\n\n const modeLabel = installation.mode === \"local\" ? \"Local\" : \"Plugin\";\n this.log(`Edit ${modeLabel} Skills\\n`);\n\n // Load skills matrix\n this.log(\"Resolving 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\n ? \"local\"\n : 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 // Load current skills\n this.log(\"Reading current skills...\");\n let currentSkillIds: string[];\n try {\n currentSkillIds = await getPluginSkillIds(\n pluginSkillsDir,\n sourceResult.matrix,\n );\n this.log(`✓ Current plugin has ${currentSkillIds.length} skills\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n // Run wizard with initial skills\n let wizardResult: WizardResult | null = null;\n\n const { waitUntilExit } = render(\n <Wizard\n matrix={sourceResult.matrix}\n initialSkills={currentSkillIds}\n onComplete={(result) => {\n wizardResult = result;\n }}\n onCancel={() => {\n this.log(\"\\nEdit cancelled\");\n }}\n />,\n );\n\n await waitUntilExit();\n\n // Handle cancellation\n if (!wizardResult || wizardResult.cancelled) {\n this.exit(EXIT_CODES.CANCELLED);\n }\n\n // Validate selection\n if (!wizardResult.validation.valid) {\n this.error(\"Selection has validation errors:\");\n for (const error of wizardResult.validation.errors) {\n this.log(` ${error.message}`);\n }\n this.exit(EXIT_CODES.ERROR);\n }\n\n // Calculate changes\n const addedSkills = wizardResult.selectedSkills.filter(\n (id) => !currentSkillIds.includes(id),\n );\n const removedSkills = currentSkillIds.filter(\n (id) => !wizardResult.selectedSkills.includes(id),\n );\n\n // Show warnings if any\n if (wizardResult.validation.warnings.length > 0) {\n this.log(\"\\nWarnings:\");\n for (const warning of wizardResult.validation.warnings) {\n this.warn(` ! ${warning.message}`);\n }\n this.log(\"\");\n }\n\n // Check if there are no changes\n if (addedSkills.length === 0 && removedSkills.length === 0) {\n this.log(\"No changes made.\");\n this.log(\"Plugin unchanged\\n\");\n return;\n }\n\n // Show changes\n this.log(\"\\nChanges:\");\n for (const skillId of addedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` + ${skill?.name || skillId}`);\n }\n for (const skillId of removedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` - ${skill?.name || skillId}`);\n }\n this.log(\"\");\n\n // Update plugin skills\n this.log(\"Updating plugin skills...\");\n try {\n if (await directoryExists(pluginSkillsDir)) {\n await remove(pluginSkillsDir);\n }\n await ensureDir(pluginSkillsDir);\n\n await copySkillsToPluginFromSource(\n wizardResult.selectedSkills,\n pluginDir,\n sourceResult.matrix,\n sourceResult,\n );\n this.log(\n `✓ Plugin updated with ${wizardResult.selectedSkills.length} skills\\n`,\n );\n } catch (error) {\n this.handleError(error);\n }\n\n // Fetch agent partials\n let sourcePath: string;\n this.log(\n flags[\"agent-source\"]\n ? \"Fetching agent partials...\"\n : \"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(\n flags[\"agent-source\"]\n ? \"✓ Agent partials fetched\\n\"\n : \"✓ Agent partials loaded\\n\",\n );\n } catch (error) {\n this.handleError(error);\n }\n\n // Recompile agents\n this.log(\"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(\n `Agent recompilation failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n this.log(\"You can manually recompile with 'cc compile'.\\n\");\n }\n\n // Update plugin version\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 this.log(\n `\\n✓ Plugin updated! (${addedSkills.length} added, ${removedSkills.length} removed)\\n`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,aAAa;AACtB,SAAS,cAAc;AA6FjB;AA3EN,IAAqB,OAArB,MAAqB,cAAa,YAAY;AAAA,EAC5C,OAAO,UAAU;AAAA,EACjB,OAAO,cACL;AAAA,EAEF,OAAO,QAAQ;AAAA,IACb,GAAG,YAAY;AAAA,IACf,SAAS,MAAM,QAAQ;AAAA,MACrB,aAAa;AAAA,MACb,SAAS;AAAA,IACX,CAAC;AAAA,IACD,gBAAgB,MAAM,OAAO;AAAA,MAC3B,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,IAAI,MAAM,KAAK,MAAM,KAAI;AAGvC,UAAM,eAAe,MAAM,mBAAmB;AAE9C,QAAI,CAAC,cAAc;AACjB,WAAK;AAAA,QACH;AAA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AAAA,0BAAwB,YAAY,MAAM,WAAW,cAAc,MAAM;AAAA;AAAA,IAC3E;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/cli/commands/edit.tsx"],"sourcesContent":["import { Flags } from \"@oclif/core\";\nimport { render } from \"ink\";\nimport React from \"react\";\nimport { BaseCommand } from \"../base-command.js\";\nimport { Wizard, WizardResultV2 } from \"../components/wizard/wizard.js\";\nimport { loadSkillsMatrixFromSource } from \"../lib/source-loader.js\";\nimport { directoryExists, ensureDir, remove } from \"../utils/fs.js\";\nimport {\n getCollectivePluginDir,\n getPluginSkillsDir,\n getPluginSkillIds,\n} from \"../lib/plugin-finder.js\";\nimport { copySkillsToPluginFromSource } from \"../lib/skill-copier.js\";\nimport { recompileAgents } from \"../lib/agent-recompiler.js\";\nimport { bumpPluginVersion } from \"../lib/plugin-version.js\";\nimport { getAgentDefinitions } from \"../lib/agent-fetcher.js\";\nimport { EXIT_CODES } from \"../lib/exit-codes.js\";\nimport { detectInstallation } from \"../lib/installation.js\";\n\nexport default class Edit extends BaseCommand {\n static summary = \"Edit skills in the plugin\";\n static description =\n \"Modify the currently installed skills via interactive wizard\";\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 // Detect installation mode\n const installation = await detectInstallation();\n\n if (!installation) {\n this.error(\n \"No installation found. Run 'cc init' first to set up Claude Collective.\",\n { exit: EXIT_CODES.ERROR },\n );\n }\n\n const pluginDir = getCollectivePluginDir();\n const pluginSkillsDir =\n installation.mode === \"local\"\n ? installation.skillsDir\n : getPluginSkillsDir(pluginDir);\n\n const modeLabel = installation.mode === \"local\" ? \"Local\" : \"Plugin\";\n this.log(`Edit ${modeLabel} Skills\\n`);\n\n // Load skills matrix\n this.log(\"Resolving 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\n ? \"local\"\n : 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 // Load current skills\n this.log(\"Reading current skills...\");\n let currentSkillIds: string[];\n try {\n currentSkillIds = await getPluginSkillIds(\n pluginSkillsDir,\n sourceResult.matrix,\n );\n this.log(`✓ Current plugin has ${currentSkillIds.length} skills\\n`);\n } catch (error) {\n this.handleError(error);\n }\n\n // Run wizard with initial skills\n let wizardResult: WizardResultV2 | null = null;\n\n const { waitUntilExit } = render(\n <Wizard\n matrix={sourceResult.matrix}\n initialSkills={currentSkillIds}\n onComplete={(result) => {\n // Wizard always returns WizardResultV2 in the current implementation\n wizardResult = result as WizardResultV2;\n }}\n onCancel={() => {\n this.log(\"\\nEdit cancelled\");\n }}\n />,\n );\n\n await waitUntilExit();\n\n // Cast to WizardResultV2 since that's what the current wizard implementation returns\n // Use non-null assertion here since we know the wizard has completed\n const result = wizardResult as WizardResultV2 | null;\n\n // Handle cancellation - use error() which throws and TypeScript understands\n if (!result || result.cancelled) {\n this.error(\"Cancelled\", { exit: EXIT_CODES.CANCELLED });\n }\n\n // Validate selection - use error() which throws and TypeScript understands\n if (!result.validation.valid) {\n const errorMessages = result.validation.errors\n .map((e) => e.message)\n .join(\"\\n \");\n this.error(`Selection has validation errors:\\n ${errorMessages}`, {\n exit: EXIT_CODES.ERROR,\n });\n }\n\n // Calculate changes\n const addedSkills = result.selectedSkills.filter(\n (id: string) => !currentSkillIds.includes(id),\n );\n const removedSkills = currentSkillIds.filter(\n (id) => !result.selectedSkills.includes(id),\n );\n\n // Show warnings if any\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 // Check if there are no changes\n if (addedSkills.length === 0 && removedSkills.length === 0) {\n this.log(\"No changes made.\");\n this.log(\"Plugin unchanged\\n\");\n return;\n }\n\n // Show changes\n this.log(\"\\nChanges:\");\n for (const skillId of addedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` + ${skill?.name || skillId}`);\n }\n for (const skillId of removedSkills) {\n const skill = sourceResult.matrix.skills[skillId];\n this.log(` - ${skill?.name || skillId}`);\n }\n this.log(\"\");\n\n // Update plugin skills\n this.log(\"Updating plugin 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 );\n this.log(\n `✓ Plugin updated with ${result.selectedSkills.length} skills\\n`,\n );\n } catch (error) {\n this.handleError(error);\n }\n\n // Fetch agent partials\n let sourcePath: string;\n this.log(\n flags[\"agent-source\"]\n ? \"Fetching agent partials...\"\n : \"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(\n flags[\"agent-source\"]\n ? \"✓ Agent partials fetched\\n\"\n : \"✓ Agent partials loaded\\n\",\n );\n } catch (error) {\n this.handleError(error);\n }\n\n // Recompile agents\n this.log(\"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(\n `Agent recompilation failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n this.log(\"You can manually recompile with 'cc compile'.\\n\");\n }\n\n // Update plugin version\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 this.log(\n `\\n✓ Plugin updated! (${addedSkills.length} added, ${removedSkills.length} removed)\\n`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAS,aAAa;AACtB,SAAS,cAAc;AA6FjB;AA3EN,IAAqB,OAArB,MAAqB,cAAa,YAAY;AAAA,EAC5C,OAAO,UAAU;AAAA,EACjB,OAAO,cACL;AAAA,EAEF,OAAO,QAAQ;AAAA,IACb,GAAG,YAAY;AAAA,IACf,SAAS,MAAM,QAAQ;AAAA,MACrB,aAAa;AAAA,MACb,SAAS;AAAA,IACX,CAAC;AAAA,IACD,gBAAgB,MAAM,OAAO;AAAA,MAC3B,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,IAAI,MAAM,KAAK,MAAM,KAAI;AAGvC,UAAM,eAAe,MAAM,mBAAmB;AAE9C,QAAI,CAAC,cAAc;AACjB,WAAK;AAAA,QACH;AAAA,QACA,EAAE,MAAM,WAAW,MAAM;AAAA,MAC3B;AAAA,IACF;AAEA,UAAM,YAAY,uBAAuB;AACzC,UAAM,kBACJ,aAAa,SAAS,UAClB,aAAa,YACb,mBAAmB,SAAS;AAElC,UAAM,YAAY,aAAa,SAAS,UAAU,UAAU;AAC5D,SAAK,IAAI,QAAQ,SAAS;AAAA,CAAW;AAGrC,SAAK,IAAI,iCAAiC;AAC1C,QAAI;AACJ,QAAI;AACF,qBAAe,MAAM,2BAA2B;AAAA,QAC9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AC;AACD,mBAAa,UAAU;AACvB,WAAK;AAAA,QACH,MAAM,cAAc,IAChB,oCACA;AAAA,MACN;AAAA,IACF,SAAS,OAAO;AACd,WAAK,YAAY,KAAK;AAAA,IACxB;AAGA,SAAK,IAAI,uBAAuB;AAChC,QAAI;AACF,YAAM,kBAAkB,MAAM,gBAAgB;AAAA,QAC5C;AAAA,QACA;AAAA,MACF,CAAC;AAED,UAAI,gBAAgB,OAAO,SAAS,GAAG;AACrC,aAAK;AAAA,UACH,qBAAgB,gBAAgB,SAAS,MAAM,YAAY,gBAAgB,OAAO,MAAM;AAAA;AAAA,QAC1F;AACA,mBAAW,WAAW,gBAAgB,UAAU;AAC9C,eAAK,KAAK,OAAO;AAAA,QACnB;AAAA,MACF,WAAW,gBAAgB,SAAS,SAAS,GAAG;AAC9C,aAAK,IAAI,qBAAgB,gBAAgB,SAAS,MAAM;AAAA,CAAW;AAAA,MACrE,OAAO;AACL,aAAK,IAAI,iCAA4B;AAAA,MACvC;AAAA,IACF,SAAS,OAAO;AACd,WAAK;AAAA,QACH,+BAA+B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,MACvF;AACA,WAAK,IAAI,iDAAiD;AAAA,IAC5D;AAGA,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,SAAK;AAAA,MACH;AAAA,0BAAwB,YAAY,MAAM,WAAW,cAAc,MAAM;AAAA;AAAA,IAC3E;AAAA,EACF;AACF;","names":["result"]}
@@ -1,65 +1,53 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- getCollectivePluginDir,
4
- getPluginSkillsDir
5
- } from "../chunk-3HBTELJN.js";
3
+ copySkillsToLocalFlattened
4
+ } from "../chunk-K7EVM5LY.js";
5
+ import "../chunk-KAAEN2PO.js";
6
6
  import {
7
- DIRS,
8
- PROJECT_ROOT
9
- } from "../chunk-A3J6IAXK.js";
7
+ loadSkillsMatrixFromSource
8
+ } from "../chunk-CPZOTVCI.js";
9
+ import "../chunk-B7CCVP6Q.js";
10
+ import "../chunk-IMDW5ZUP.js";
10
11
  import {
11
12
  BaseCommand,
12
13
  EXIT_CODES
13
- } from "../chunk-SYQ7R2JO.js";
14
- import "../chunk-TOPAIL5W.js";
14
+ } from "../chunk-EHS3TWWP.js";
15
+ import {
16
+ loadProjectConfig,
17
+ resolveSource
18
+ } from "../chunk-V46GGCCI.js";
19
+ import "../chunk-3U3R4NCG.js";
15
20
  import {
16
21
  copy,
17
22
  directoryExists,
18
23
  ensureDir,
19
24
  fileExists,
25
+ readFile,
20
26
  writeFile
21
- } from "../chunk-MMDXNZPF.js";
27
+ } from "../chunk-TKFPKEV3.js";
28
+ import {
29
+ CLAUDE_SRC_DIR,
30
+ DIRS,
31
+ LOCAL_SKILLS_PATH,
32
+ PROJECT_ROOT
33
+ } from "../chunk-76DWXGQE.js";
22
34
  import {
23
35
  init_esm_shims
24
36
  } from "../chunk-DHET7RCE.js";
25
37
 
26
- // src/cli-v2/commands/eject.ts
38
+ // src/cli/commands/eject.ts
27
39
  init_esm_shims();
28
40
  import { Args, Flags } from "@oclif/core";
29
41
  import path from "path";
30
42
  import os from "os";
31
- var EJECT_TYPES = ["templates", "config", "skills", "agents", "all"];
32
- var DEFAULT_CONFIG_CONTENT = `# Claude Collective Configuration
33
- # Agent-skill mappings for this project
34
-
35
- name: my-project
36
- description: Project description
37
-
38
- # Agents to compile
39
- agents:
40
- - web-developer
41
- - api-developer
42
- - web-tester
43
- - web-pm
44
-
45
- # Agent-specific skill assignments (optional)
46
- # If not specified, all available skills are given to all agents
47
- agent_skills:
48
- web-developer:
49
- - react
50
- - zustand
51
- - scss-modules
52
- api-developer:
53
- - hono
54
- - drizzle
55
- - better-auth
56
- `;
43
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
44
+ var EJECT_TYPES = ["agent-partials", "skills", "all"];
57
45
  var Eject = class _Eject extends BaseCommand {
58
- static summary = "Eject bundled content for local customization";
59
- static description = "Copy templates, config, skills, or agent partials to your project for customization";
46
+ static summary = "Eject skills or agent partials for local customization";
47
+ static description = "Copy agent partials or skills to your project for customization. Agent partials are always copied from the CLI. Skills are copied from the configured source (public marketplace by default).";
60
48
  static args = {
61
49
  type: Args.string({
62
- description: "What to eject: templates, config, skills, agents, all",
50
+ description: "What to eject: agent-partials, skills, all",
63
51
  required: false,
64
52
  options: EJECT_TYPES
65
53
  })
@@ -74,6 +62,10 @@ var Eject = class _Eject extends BaseCommand {
74
62
  output: Flags.string({
75
63
  char: "o",
76
64
  description: "Output directory (default: .claude/ in current directory)"
65
+ }),
66
+ refresh: Flags.boolean({
67
+ description: "Force refresh from remote source",
68
+ default: false
77
69
  })
78
70
  };
79
71
  async run() {
@@ -81,7 +73,7 @@ var Eject = class _Eject extends BaseCommand {
81
73
  const projectDir = process.cwd();
82
74
  if (!args.type) {
83
75
  this.error(
84
- "Please specify what to eject: templates, config, skills, agents, or all",
76
+ "Please specify what to eject: agent-partials, skills, or all",
85
77
  { exit: EXIT_CODES.INVALID_ARGS }
86
78
  );
87
79
  }
@@ -100,7 +92,7 @@ var Eject = class _Eject extends BaseCommand {
100
92
  });
101
93
  }
102
94
  } else {
103
- outputBase = path.join(projectDir, ".claude");
95
+ outputBase = path.join(projectDir, CLAUDE_SRC_DIR);
104
96
  }
105
97
  this.log("");
106
98
  this.log("Claude Collective Eject");
@@ -110,96 +102,187 @@ var Eject = class _Eject extends BaseCommand {
110
102
  }
111
103
  const ejectType = args.type;
112
104
  const directOutput = !!flags.output;
105
+ let sourceResult;
106
+ if (ejectType === "skills" || ejectType === "all") {
107
+ sourceResult = await loadSkillsMatrixFromSource({
108
+ sourceFlag: flags.source,
109
+ projectDir,
110
+ forceRefresh: flags.refresh
111
+ });
112
+ }
113
113
  switch (ejectType) {
114
- case "templates":
115
- await this.ejectTemplates(outputBase, flags.force, directOutput);
116
- break;
117
- case "config":
118
- await this.ejectConfig(outputBase, flags.force, directOutput);
114
+ case "agent-partials":
115
+ await this.ejectAgentPartials(outputBase, flags.force, directOutput);
119
116
  break;
120
117
  case "skills":
121
- await this.ejectSkills(outputBase, flags.force, directOutput);
122
- break;
123
- case "agents":
124
- await this.ejectAgents(outputBase, flags.force, directOutput);
118
+ await this.ejectSkills(
119
+ projectDir,
120
+ flags.force,
121
+ directOutput,
122
+ sourceResult,
123
+ directOutput ? outputBase : void 0
124
+ );
125
125
  break;
126
126
  case "all":
127
- await this.ejectTemplates(outputBase, flags.force, directOutput);
128
- await this.ejectConfig(outputBase, flags.force, directOutput);
129
- await this.ejectSkills(outputBase, flags.force, directOutput);
130
- await this.ejectAgents(outputBase, flags.force, directOutput);
127
+ await this.ejectAgentPartials(outputBase, flags.force, directOutput);
128
+ await this.ejectSkills(
129
+ projectDir,
130
+ flags.force,
131
+ directOutput,
132
+ sourceResult,
133
+ directOutput ? outputBase : void 0
134
+ );
131
135
  break;
132
136
  }
137
+ if (flags.source) {
138
+ await this.saveSourceToProjectConfig(projectDir, flags.source);
139
+ }
140
+ await this.ensureMinimalConfig(projectDir, flags.source, sourceResult);
133
141
  this.log("");
134
142
  this.logSuccess("Eject complete!");
135
143
  this.log("");
136
144
  }
137
- async ejectTemplates(outputBase, force, directOutput = false) {
138
- const sourceDir = path.join(PROJECT_ROOT, DIRS.templates);
139
- const destDir = directOutput ? outputBase : path.join(outputBase, "templates");
140
- if (await directoryExists(destDir) && !force) {
141
- this.warn(
142
- `Templates already exist at ${destDir}. Use --force to overwrite.`
143
- );
144
- return;
145
+ /**
146
+ * Save source to project-level .claude-src/config.yaml.
147
+ * Creates the config file if it doesn't exist, or merges with existing config.
148
+ */
149
+ async saveSourceToProjectConfig(projectDir, source) {
150
+ const configPath = path.join(projectDir, CLAUDE_SRC_DIR, "config.yaml");
151
+ let config = {};
152
+ if (await fileExists(configPath)) {
153
+ const content = await readFile(configPath);
154
+ config = parseYaml(content) || {};
145
155
  }
146
- await ensureDir(destDir);
147
- await copy(sourceDir, destDir);
148
- this.logSuccess(`Templates ejected to ${destDir}`);
149
- this.log("You can now customize agent.liquid and partials locally.");
156
+ config.source = source;
157
+ await ensureDir(path.join(projectDir, CLAUDE_SRC_DIR));
158
+ await writeFile(configPath, stringifyYaml(config, { indent: 2 }));
159
+ this.log(`Source saved to .claude-src/config.yaml`);
150
160
  }
151
- async ejectConfig(outputBase, force, directOutput = false) {
152
- const destPath = path.join(outputBase, "config.yaml");
153
- if (await fileExists(destPath) && !force) {
154
- this.warn(
155
- `Config already exists at ${destPath}. Use --force to overwrite.`
156
- );
161
+ /**
162
+ * Ensure a minimal config.yaml exists so that `cc compile` can work after eject.
163
+ * Only creates if config doesn't already exist.
164
+ * Includes all resolved config values: source, marketplace, author, agents_source.
165
+ */
166
+ async ensureMinimalConfig(projectDir, sourceFlag, sourceResult) {
167
+ const configPath = path.join(projectDir, CLAUDE_SRC_DIR, "config.yaml");
168
+ if (await fileExists(configPath)) {
157
169
  return;
158
170
  }
159
- await ensureDir(path.dirname(destPath));
160
- await writeFile(destPath, DEFAULT_CONFIG_CONTENT);
161
- this.logSuccess(`Config template ejected to ${destPath}`);
162
- this.log("Customize agent-skill mappings for your project.");
171
+ const projectName = path.basename(projectDir);
172
+ const config = {
173
+ name: projectName,
174
+ installMode: "local"
175
+ };
176
+ const resolvedConfig = sourceResult?.sourceConfig ?? await resolveSource(sourceFlag, projectDir);
177
+ if (sourceFlag) {
178
+ config.source = sourceFlag;
179
+ } else if (resolvedConfig.source) {
180
+ config.source = resolvedConfig.source;
181
+ }
182
+ if (resolvedConfig.marketplace) {
183
+ config.marketplace = resolvedConfig.marketplace;
184
+ }
185
+ const existingProjectConfig = await loadProjectConfig(projectDir);
186
+ if (existingProjectConfig?.author) {
187
+ config.author = existingProjectConfig.author;
188
+ }
189
+ if (existingProjectConfig?.agents_source) {
190
+ config.agents_source = existingProjectConfig.agents_source;
191
+ }
192
+ await ensureDir(path.join(projectDir, CLAUDE_SRC_DIR));
193
+ let configContent = stringifyYaml(config, { indent: 2 });
194
+ const exampleStackComment = `
195
+ # Example stack configuration (uncomment and customize):
196
+ #
197
+ # skills:
198
+ # - web-framework-react
199
+ # - web-styling-scss-modules
200
+ # - api-framework-hono
201
+ # - api-database-drizzle
202
+ #
203
+ # agents:
204
+ # - web-developer
205
+ # - api-developer
206
+ # - web-reviewer
207
+ #
208
+ # stack:
209
+ # web-developer:
210
+ # framework: web-framework-react
211
+ # styling: web-styling-scss-modules
212
+ # api-developer:
213
+ # api: api-framework-hono
214
+ # database: api-database-drizzle
215
+ `;
216
+ configContent += exampleStackComment;
217
+ await writeFile(configPath, configContent);
218
+ this.logSuccess(`Created ${CLAUDE_SRC_DIR}/config.yaml`);
163
219
  }
164
- async ejectSkills(outputBase, force, directOutput = false) {
165
- const pluginDir = getCollectivePluginDir();
166
- const sourceDir = getPluginSkillsDir(pluginDir);
220
+ /**
221
+ * Eject agent partials (templates + agent partial files).
222
+ *
223
+ * Combines the old templates and agents eject into a single operation:
224
+ * - Copies `PROJECT_ROOT/src/agents/_templates/` to `<dest>/_templates/`
225
+ * - Copies agent partials from `PROJECT_ROOT/src/agents/` (excluding `_templates`) to `<dest>/`
226
+ *
227
+ * Always copies from CLI's PROJECT_ROOT - the `--source` flag has no effect.
228
+ */
229
+ async ejectAgentPartials(outputBase, force, directOutput = false) {
230
+ const sourceDir = path.join(PROJECT_ROOT, DIRS.agents);
167
231
  if (!await directoryExists(sourceDir)) {
168
- this.warn("No skills found in installed plugin.");
169
- this.log("Install skills with 'cc init' first, then try again.");
232
+ this.warn("No agent partials found in CLI.");
170
233
  return;
171
234
  }
172
- const destDir = directOutput ? outputBase : path.join(outputBase, "skills");
235
+ const destDir = directOutput ? outputBase : path.join(outputBase, "agents");
173
236
  if (await directoryExists(destDir) && !force) {
174
237
  this.warn(
175
- `Skills already exist at ${destDir}. Use --force to overwrite.`
238
+ `Agent partials already exist at ${destDir}. Use --force to overwrite.`
176
239
  );
177
240
  return;
178
241
  }
179
242
  await ensureDir(destDir);
180
243
  await copy(sourceDir, destDir);
181
- this.logSuccess(`Skills ejected to ${destDir}`);
182
- this.log("You can now customize skill content locally.");
244
+ this.logSuccess(`Agent partials ejected to ${destDir}`);
245
+ this.log(
246
+ "You can now customize templates, agent intro, workflow, and examples locally."
247
+ );
183
248
  }
184
- async ejectAgents(outputBase, force, directOutput = false) {
185
- const sourceDir = path.join(PROJECT_ROOT, DIRS.agents);
186
- if (!await directoryExists(sourceDir)) {
187
- this.warn("No agent partials found.");
188
- return;
189
- }
190
- const destDir = directOutput ? outputBase : path.join(outputBase, "agents", "_partials");
249
+ /**
250
+ * Eject skills from the configured source to local .claude/skills/ directory.
251
+ *
252
+ * Uses the source resolution system:
253
+ * - Default: Public marketplace
254
+ * - `--source /path`: Custom local source
255
+ * - `--source url`: Custom remote source
256
+ *
257
+ * Skills are copied in a flattened structure using their normalized skill IDs.
258
+ */
259
+ async ejectSkills(projectDir, force, directOutput = false, sourceResult, customOutputBase) {
260
+ const destDir = directOutput && customOutputBase ? customOutputBase : path.join(projectDir, LOCAL_SKILLS_PATH);
191
261
  if (await directoryExists(destDir) && !force) {
192
262
  this.warn(
193
- `Agent partials already exist at ${destDir}. Use --force to overwrite.`
263
+ `Skills already exist at ${destDir}. Use --force to overwrite.`
194
264
  );
195
265
  return;
196
266
  }
267
+ const skillIds = Object.keys(sourceResult.matrix.skills).filter(
268
+ (skillId) => !sourceResult.matrix.skills[skillId].local
269
+ );
270
+ if (skillIds.length === 0) {
271
+ this.warn("No skills found in source to eject.");
272
+ return;
273
+ }
197
274
  await ensureDir(destDir);
198
- await copy(sourceDir, destDir);
199
- this.logSuccess(`Agent partials ejected to ${destDir}`);
200
- this.log(
201
- "You can now customize agent intro, workflow, and examples locally."
275
+ const copiedSkills = await copySkillsToLocalFlattened(
276
+ skillIds,
277
+ destDir,
278
+ sourceResult.matrix,
279
+ sourceResult
280
+ );
281
+ const sourceLabel = sourceResult.isLocal ? sourceResult.sourcePath : sourceResult.marketplace || sourceResult.sourceConfig.source;
282
+ this.logSuccess(
283
+ `${copiedSkills.length} skills ejected to ${destDir} from ${sourceLabel}`
202
284
  );
285
+ this.log("You can now customize skill content locally.");
203
286
  }
204
287
  };
205
288
  export {