@claude-collective/cli 0.2.0 → 0.8.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 (190) hide show
  1. package/CHANGELOG.md +178 -0
  2. package/README.md +1 -1
  3. package/dist/chunk-3HBTELJN.js +114 -0
  4. package/dist/chunk-3HBTELJN.js.map +1 -0
  5. package/dist/chunk-3ZCB5K33.js +54 -0
  6. package/dist/chunk-3ZCB5K33.js.map +1 -0
  7. package/dist/chunk-66UDJBF6.js +96 -0
  8. package/dist/chunk-66UDJBF6.js.map +1 -0
  9. package/dist/chunk-6LS7XO3H.js +31 -0
  10. package/dist/chunk-6LS7XO3H.js.map +1 -0
  11. package/dist/chunk-A3J6IAXK.js +57 -0
  12. package/dist/chunk-A3J6IAXK.js.map +1 -0
  13. package/dist/chunk-A65SBAAJ.js +69 -0
  14. package/dist/chunk-A65SBAAJ.js.map +1 -0
  15. package/dist/chunk-ALEPJ6YN.js +80 -0
  16. package/dist/chunk-ALEPJ6YN.js.map +1 -0
  17. package/dist/chunk-C4ZTIYFR.js +84 -0
  18. package/dist/chunk-C4ZTIYFR.js.map +1 -0
  19. package/dist/chunk-CIY5UBRB.js +453 -0
  20. package/dist/chunk-CIY5UBRB.js.map +1 -0
  21. package/dist/chunk-DHET7RCE.js +50 -0
  22. package/dist/chunk-DHET7RCE.js.map +1 -0
  23. package/dist/chunk-DHFFRMF6.js +31 -0
  24. package/dist/chunk-DHFFRMF6.js.map +1 -0
  25. package/dist/chunk-DKGL77IY.js +307 -0
  26. package/dist/chunk-DKGL77IY.js.map +1 -0
  27. package/dist/chunk-ED73HCW2.js +315 -0
  28. package/dist/chunk-ED73HCW2.js.map +1 -0
  29. package/dist/chunk-FNOYEXUE.js +308 -0
  30. package/dist/chunk-FNOYEXUE.js.map +1 -0
  31. package/dist/chunk-G2FBJOZG.js +141 -0
  32. package/dist/chunk-G2FBJOZG.js.map +1 -0
  33. package/dist/chunk-HNDT5QRB.js +120 -0
  34. package/dist/chunk-HNDT5QRB.js.map +1 -0
  35. package/dist/chunk-K7PTOVX4.js +158 -0
  36. package/dist/chunk-K7PTOVX4.js.map +1 -0
  37. package/dist/chunk-LQTST4WY.js +91 -0
  38. package/dist/chunk-LQTST4WY.js.map +1 -0
  39. package/dist/chunk-LVKRVFYR.js +54 -0
  40. package/dist/chunk-LVKRVFYR.js.map +1 -0
  41. package/dist/chunk-M7YCPFIX.js +108 -0
  42. package/dist/chunk-M7YCPFIX.js.map +1 -0
  43. package/dist/chunk-MJSFR562.js +57 -0
  44. package/dist/chunk-MJSFR562.js.map +1 -0
  45. package/dist/chunk-MMDXNZPF.js +69 -0
  46. package/dist/chunk-MMDXNZPF.js.map +1 -0
  47. package/dist/chunk-MYAVQ23U.js +356 -0
  48. package/dist/chunk-MYAVQ23U.js.map +1 -0
  49. package/dist/chunk-NGBFJJ7Q.js +124 -0
  50. package/dist/chunk-NGBFJJ7Q.js.map +1 -0
  51. package/dist/chunk-OLBOTK3O.js +64 -0
  52. package/dist/chunk-OLBOTK3O.js.map +1 -0
  53. package/dist/chunk-PPNTD5LO.js +330 -0
  54. package/dist/chunk-PPNTD5LO.js.map +1 -0
  55. package/dist/chunk-Q2LH2DAB.js +392 -0
  56. package/dist/chunk-Q2LH2DAB.js.map +1 -0
  57. package/dist/chunk-Q6DR5QUH.js +547 -0
  58. package/dist/chunk-Q6DR5QUH.js.map +1 -0
  59. package/dist/chunk-QESUUPOE.js +241 -0
  60. package/dist/chunk-QESUUPOE.js.map +1 -0
  61. package/dist/chunk-QGGSLMO3.js +607 -0
  62. package/dist/chunk-QGGSLMO3.js.map +1 -0
  63. package/dist/chunk-SEBPPFUW.js +478 -0
  64. package/dist/chunk-SEBPPFUW.js.map +1 -0
  65. package/dist/chunk-SYQ7R2JO.js +95 -0
  66. package/dist/chunk-SYQ7R2JO.js.map +1 -0
  67. package/dist/chunk-TOPAIL5W.js +22 -0
  68. package/dist/chunk-TOPAIL5W.js.map +1 -0
  69. package/dist/chunk-U4VYHKPM.js +110 -0
  70. package/dist/chunk-U4VYHKPM.js.map +1 -0
  71. package/dist/chunk-UOWHJ6BE.js +83 -0
  72. package/dist/chunk-UOWHJ6BE.js.map +1 -0
  73. package/dist/chunk-XKEG3SCV.js +86 -0
  74. package/dist/chunk-XKEG3SCV.js.map +1 -0
  75. package/dist/chunk-XY3XDVMI.js +15599 -0
  76. package/dist/chunk-XY3XDVMI.js.map +1 -0
  77. package/dist/chunk-Y3V43XCU.js +76 -0
  78. package/dist/chunk-Y3V43XCU.js.map +1 -0
  79. package/dist/chunk-YKXBGCFD.js +129 -0
  80. package/dist/chunk-YKXBGCFD.js.map +1 -0
  81. package/dist/cli-v2/defaults/agent-mappings.yaml +185 -0
  82. package/dist/commands/build/marketplace.js +254 -0
  83. package/dist/commands/build/marketplace.js.map +1 -0
  84. package/dist/commands/build/plugins.js +324 -0
  85. package/dist/commands/build/plugins.js.map +1 -0
  86. package/dist/commands/build/stack.js +169 -0
  87. package/dist/commands/build/stack.js.map +1 -0
  88. package/dist/commands/compile.js +461 -0
  89. package/dist/commands/compile.js.map +1 -0
  90. package/dist/commands/config/get.js +60 -0
  91. package/dist/commands/config/get.js.map +1 -0
  92. package/dist/commands/config/index.js +22 -0
  93. package/dist/commands/config/index.js.map +1 -0
  94. package/dist/commands/config/path.js +35 -0
  95. package/dist/commands/config/path.js.map +1 -0
  96. package/dist/commands/config/set-project.js +61 -0
  97. package/dist/commands/config/set-project.js.map +1 -0
  98. package/dist/commands/config/set.js +60 -0
  99. package/dist/commands/config/set.js.map +1 -0
  100. package/dist/commands/config/show.js +13 -0
  101. package/dist/commands/config/show.js.map +1 -0
  102. package/dist/commands/config/unset-project.js +57 -0
  103. package/dist/commands/config/unset-project.js.map +1 -0
  104. package/dist/commands/config/unset.js +56 -0
  105. package/dist/commands/config/unset.js.map +1 -0
  106. package/dist/commands/diff.js +755 -0
  107. package/dist/commands/diff.js.map +1 -0
  108. package/dist/commands/doctor.js +413 -0
  109. package/dist/commands/doctor.js.map +1 -0
  110. package/dist/commands/edit.js +254 -0
  111. package/dist/commands/edit.js.map +1 -0
  112. package/dist/commands/eject.js +208 -0
  113. package/dist/commands/eject.js.map +1 -0
  114. package/dist/commands/info.js +205 -0
  115. package/dist/commands/info.js.map +1 -0
  116. package/dist/commands/init.js +915 -0
  117. package/dist/commands/init.js.map +1 -0
  118. package/dist/commands/list.js +44 -0
  119. package/dist/commands/list.js.map +1 -0
  120. package/dist/commands/new/agent.js +230 -0
  121. package/dist/commands/new/agent.js.map +1 -0
  122. package/dist/commands/new/skill.js +204 -0
  123. package/dist/commands/new/skill.js.map +1 -0
  124. package/dist/commands/outdated.js +242 -0
  125. package/dist/commands/outdated.js.map +1 -0
  126. package/dist/commands/search.js +115 -0
  127. package/dist/commands/search.js.map +1 -0
  128. package/dist/commands/test-imports.js +92 -0
  129. package/dist/commands/test-imports.js.map +1 -0
  130. package/dist/commands/uninstall.js +309 -0
  131. package/dist/commands/uninstall.js.map +1 -0
  132. package/dist/commands/update.js +428 -0
  133. package/dist/commands/update.js.map +1 -0
  134. package/dist/commands/validate.js +375 -0
  135. package/dist/commands/validate.js.map +1 -0
  136. package/dist/commands/version/bump.js +95 -0
  137. package/dist/commands/version/bump.js.map +1 -0
  138. package/dist/commands/version/index.js +70 -0
  139. package/dist/commands/version/index.js.map +1 -0
  140. package/dist/commands/version/set.js +101 -0
  141. package/dist/commands/version/set.js.map +1 -0
  142. package/dist/commands/version/show.js +70 -0
  143. package/dist/commands/version/show.js.map +1 -0
  144. package/dist/components/common/confirm.js +9 -0
  145. package/dist/components/common/confirm.js.map +1 -0
  146. package/dist/components/common/message.js +24 -0
  147. package/dist/components/common/message.js.map +1 -0
  148. package/dist/components/common/spinner.js +14 -0
  149. package/dist/components/common/spinner.js.map +1 -0
  150. package/dist/components/wizard/category-grid.js +9 -0
  151. package/dist/components/wizard/category-grid.js.map +1 -0
  152. package/dist/components/wizard/category-grid.test.js +728 -0
  153. package/dist/components/wizard/category-grid.test.js.map +1 -0
  154. package/dist/components/wizard/section-progress.js +9 -0
  155. package/dist/components/wizard/section-progress.js.map +1 -0
  156. package/dist/components/wizard/section-progress.test.js +281 -0
  157. package/dist/components/wizard/section-progress.test.js.map +1 -0
  158. package/dist/components/wizard/step-approach.js +11 -0
  159. package/dist/components/wizard/step-approach.js.map +1 -0
  160. package/dist/components/wizard/step-build.js +15 -0
  161. package/dist/components/wizard/step-build.js.map +1 -0
  162. package/dist/components/wizard/step-build.test.js +729 -0
  163. package/dist/components/wizard/step-build.test.js.map +1 -0
  164. package/dist/components/wizard/step-confirm.js +9 -0
  165. package/dist/components/wizard/step-confirm.js.map +1 -0
  166. package/dist/components/wizard/step-refine.js +9 -0
  167. package/dist/components/wizard/step-refine.js.map +1 -0
  168. package/dist/components/wizard/step-refine.test.js +235 -0
  169. package/dist/components/wizard/step-refine.test.js.map +1 -0
  170. package/dist/components/wizard/step-stack-options.js +11 -0
  171. package/dist/components/wizard/step-stack-options.js.map +1 -0
  172. package/dist/components/wizard/step-stack.js +11 -0
  173. package/dist/components/wizard/step-stack.js.map +1 -0
  174. package/dist/components/wizard/wizard-tabs.js +11 -0
  175. package/dist/components/wizard/wizard-tabs.js.map +1 -0
  176. package/dist/components/wizard/wizard.js +20 -0
  177. package/dist/components/wizard/wizard.js.map +1 -0
  178. package/dist/hooks/init.js +41 -0
  179. package/dist/hooks/init.js.map +1 -0
  180. package/dist/index.js +10 -0
  181. package/dist/index.js.map +1 -0
  182. package/dist/magic-string.es-RGXYGAW3.js +1316 -0
  183. package/dist/magic-string.es-RGXYGAW3.js.map +1 -0
  184. package/dist/stores/wizard-store.js +10 -0
  185. package/dist/stores/wizard-store.js.map +1 -0
  186. package/dist/stores/wizard-store.test.js +405 -0
  187. package/dist/stores/wizard-store.test.js.map +1 -0
  188. package/package.json +44 -25
  189. package/dist/cli/index.js +0 -6314
  190. package/dist/cli/index.js.map +0 -1
@@ -0,0 +1,392 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateStackPluginManifest,
4
+ getPluginManifestPath,
5
+ writePluginManifest
6
+ } from "./chunk-LQTST4WY.js";
7
+ import {
8
+ hashString
9
+ } from "./chunk-MJSFR562.js";
10
+ import {
11
+ createLiquidEngine,
12
+ resolveAgents,
13
+ stackToCompileConfig
14
+ } from "./chunk-SEBPPFUW.js";
15
+ import {
16
+ loadAllAgents,
17
+ loadSkillsByIds,
18
+ loadSkillsMatrix,
19
+ loadStackById,
20
+ resolveAgentConfigToSkills
21
+ } from "./chunk-QGGSLMO3.js";
22
+ import {
23
+ DEFAULT_VERSION,
24
+ DIRS,
25
+ PROJECT_ROOT,
26
+ SKILLS_MATRIX_PATH
27
+ } from "./chunk-A3J6IAXK.js";
28
+ import {
29
+ verbose
30
+ } from "./chunk-TOPAIL5W.js";
31
+ import {
32
+ copy,
33
+ directoryExists,
34
+ ensureDir,
35
+ fileExists,
36
+ readFile,
37
+ readFileOptional,
38
+ writeFile
39
+ } from "./chunk-MMDXNZPF.js";
40
+ import {
41
+ init_esm_shims
42
+ } from "./chunk-DHET7RCE.js";
43
+
44
+ // src/cli-v2/lib/stack-plugin-compiler.ts
45
+ init_esm_shims();
46
+ import path from "path";
47
+ var CONTENT_HASH_FILE = ".content-hash";
48
+ function parseMajorVersion(version) {
49
+ const match = version.match(/^(\d+)\./);
50
+ return match ? parseInt(match[1], 10) : 1;
51
+ }
52
+ function bumpMajorVersion(version) {
53
+ const major = parseMajorVersion(version);
54
+ return `${major + 1}.0.0`;
55
+ }
56
+ async function readExistingManifest(pluginDir) {
57
+ const manifestPath = getPluginManifestPath(pluginDir);
58
+ if (!await fileExists(manifestPath)) {
59
+ return null;
60
+ }
61
+ try {
62
+ const content = await readFile(manifestPath);
63
+ const manifest = JSON.parse(content);
64
+ const hashFilePath = manifestPath.replace("plugin.json", CONTENT_HASH_FILE);
65
+ let contentHash;
66
+ if (await fileExists(hashFilePath)) {
67
+ contentHash = (await readFile(hashFilePath)).trim();
68
+ }
69
+ return {
70
+ version: manifest.version ?? DEFAULT_VERSION,
71
+ contentHash
72
+ };
73
+ } catch {
74
+ return null;
75
+ }
76
+ }
77
+ function hashStackConfig(stack) {
78
+ const parts = [
79
+ `name:${stack.name}`,
80
+ `description:${stack.description ?? ""}`,
81
+ `skills:${(stack.skills || []).map((s) => s.id).sort().join(",")}`,
82
+ `agents:${Object.keys(stack.agents || {}).sort().join(",")}`
83
+ ];
84
+ return hashString(parts.join("\n"));
85
+ }
86
+ async function determineStackVersion(stack, pluginDir) {
87
+ const newHash = hashStackConfig(stack);
88
+ const existing = await readExistingManifest(pluginDir);
89
+ if (!existing) {
90
+ return {
91
+ version: DEFAULT_VERSION,
92
+ contentHash: newHash
93
+ };
94
+ }
95
+ if (existing.contentHash !== newHash) {
96
+ return {
97
+ version: bumpMajorVersion(existing.version),
98
+ contentHash: newHash
99
+ };
100
+ }
101
+ return {
102
+ version: existing.version,
103
+ contentHash: newHash
104
+ };
105
+ }
106
+ async function compileAgentForPlugin(name, agent, fallbackRoot, engine) {
107
+ verbose(`Compiling agent: ${name}`);
108
+ const agentSourceRoot = agent.sourceRoot || fallbackRoot;
109
+ const agentDir = path.join(agentSourceRoot, DIRS.agents, agent.path || name);
110
+ const intro = await readFile(path.join(agentDir, "intro.md"));
111
+ const workflow = await readFile(path.join(agentDir, "workflow.md"));
112
+ const examples = await readFileOptional(
113
+ path.join(agentDir, "examples.md"),
114
+ "## Examples\n\n_No examples defined._"
115
+ );
116
+ const criticalRequirementsTop = await readFileOptional(
117
+ path.join(agentDir, "critical-requirements.md"),
118
+ ""
119
+ );
120
+ const criticalReminders = await readFileOptional(
121
+ path.join(agentDir, "critical-reminders.md"),
122
+ ""
123
+ );
124
+ const agentPath = agent.path || name;
125
+ const category = agentPath.split("/")[0];
126
+ const categoryDir = path.join(agentSourceRoot, DIRS.agents, category);
127
+ let outputFormat = await readFileOptional(
128
+ path.join(agentDir, "output-format.md"),
129
+ ""
130
+ );
131
+ if (!outputFormat) {
132
+ outputFormat = await readFileOptional(
133
+ path.join(categoryDir, "output-format.md"),
134
+ ""
135
+ );
136
+ }
137
+ const preloadedSkills = agent.skills.filter((s) => s.preloaded);
138
+ const dynamicSkills = agent.skills.filter((s) => !s.preloaded);
139
+ const preloadedSkillIds = preloadedSkills.map((s) => s.id);
140
+ verbose(
141
+ `Skills for ${name}: ${preloadedSkills.length} preloaded, ${dynamicSkills.length} dynamic`
142
+ );
143
+ const data = {
144
+ agent,
145
+ intro,
146
+ workflow,
147
+ examples,
148
+ criticalRequirementsTop,
149
+ criticalReminders,
150
+ outputFormat,
151
+ skills: agent.skills,
152
+ preloadedSkills,
153
+ dynamicSkills,
154
+ preloadedSkillIds
155
+ };
156
+ return engine.renderFile("agent", data);
157
+ }
158
+ function generateStackReadme(stackId, stack, agents, skillPlugins) {
159
+ const lines = [];
160
+ lines.push(`# ${stack.name}`);
161
+ lines.push("");
162
+ lines.push(stack.description || "A Claude Code stack plugin.");
163
+ lines.push("");
164
+ if (stack.tags && stack.tags.length > 0) {
165
+ lines.push("## Tags");
166
+ lines.push("");
167
+ lines.push(stack.tags.map((t) => `\`${t}\``).join(" "));
168
+ lines.push("");
169
+ }
170
+ lines.push("## Installation");
171
+ lines.push("");
172
+ lines.push("Add this plugin to your Claude Code configuration:");
173
+ lines.push("");
174
+ lines.push("```json");
175
+ lines.push(`{`);
176
+ lines.push(` "plugins": ["${stackId}"]`);
177
+ lines.push(`}`);
178
+ lines.push("```");
179
+ lines.push("");
180
+ lines.push("## Agents");
181
+ lines.push("");
182
+ lines.push("This stack includes the following agents:");
183
+ lines.push("");
184
+ for (const agent of agents) {
185
+ lines.push(`- \`${agent}\``);
186
+ }
187
+ lines.push("");
188
+ if (skillPlugins.length > 0) {
189
+ lines.push("## Included Skills");
190
+ lines.push("");
191
+ lines.push("This stack includes the following skills:");
192
+ lines.push("");
193
+ const uniqueSkills = [...new Set(skillPlugins)].sort();
194
+ for (const skill of uniqueSkills) {
195
+ lines.push(`- \`${skill}\``);
196
+ }
197
+ lines.push("");
198
+ }
199
+ if (stack.philosophy) {
200
+ lines.push("## Philosophy");
201
+ lines.push("");
202
+ lines.push(stack.philosophy);
203
+ lines.push("");
204
+ }
205
+ if (stack.principles && stack.principles.length > 0) {
206
+ lines.push("## Principles");
207
+ lines.push("");
208
+ for (const principle of stack.principles) {
209
+ lines.push(`- ${principle}`);
210
+ }
211
+ lines.push("");
212
+ }
213
+ lines.push("---");
214
+ lines.push("");
215
+ lines.push("*Generated by Claude Collective stack-plugin-compiler*");
216
+ lines.push("");
217
+ return lines.join("\n");
218
+ }
219
+ function stackHasHooks(stack) {
220
+ return stack.hooks !== void 0 && Object.keys(stack.hooks).length > 0;
221
+ }
222
+ function generateHooksJson(hooks) {
223
+ const output = { hooks };
224
+ return JSON.stringify(output, null, 2);
225
+ }
226
+ async function compileStackPlugin(options) {
227
+ const { stackId, outputDir, projectRoot, agentSourcePath } = options;
228
+ const localAgentRoot = agentSourcePath || projectRoot;
229
+ verbose(`Compiling stack plugin: ${stackId}`);
230
+ verbose(` Stack/skills source: ${projectRoot}`);
231
+ verbose(` Local agent source: ${localAgentRoot}`);
232
+ verbose(` CLI agent source: ${PROJECT_ROOT}`);
233
+ const cliAgents = await loadAllAgents(PROJECT_ROOT);
234
+ const localAgents = await loadAllAgents(localAgentRoot);
235
+ const agents = { ...cliAgents, ...localAgents };
236
+ verbose(
237
+ ` Loaded ${Object.keys(localAgents).length} local agents, ${Object.keys(cliAgents).length} CLI agents`
238
+ );
239
+ const newStack = options.stack || await loadStackById(stackId, PROJECT_ROOT);
240
+ const matrixPath = path.join(PROJECT_ROOT, SKILLS_MATRIX_PATH);
241
+ const matrix = await loadSkillsMatrix(matrixPath);
242
+ const skillAliases = matrix.skill_aliases || {};
243
+ let stack;
244
+ if (newStack) {
245
+ verbose(` Found stack: ${newStack.name}`);
246
+ const agentSkillIds = /* @__PURE__ */ new Set();
247
+ for (const agentName of Object.keys(newStack.agents)) {
248
+ const agentConfig = newStack.agents[agentName];
249
+ const skillRefs = resolveAgentConfigToSkills(agentConfig, skillAliases);
250
+ for (const ref of skillRefs) {
251
+ agentSkillIds.add(ref.id);
252
+ }
253
+ }
254
+ stack = {
255
+ name: newStack.name,
256
+ version: "1.0.0",
257
+ author: "",
258
+ description: newStack.description,
259
+ skills: Array.from(agentSkillIds).map((id) => ({ id })),
260
+ agents: Object.keys(newStack.agents),
261
+ philosophy: newStack.philosophy
262
+ };
263
+ } else {
264
+ throw new Error(`Stack '${stackId}' not found in config/stacks.yaml`);
265
+ }
266
+ const skills = await loadSkillsByIds(stack.skills || [], projectRoot);
267
+ const compileConfig = stackToCompileConfig(stackId, stack);
268
+ const resolvedAgents = await resolveAgents(
269
+ agents,
270
+ skills,
271
+ compileConfig,
272
+ projectRoot,
273
+ newStack,
274
+ skillAliases
275
+ );
276
+ const pluginDir = path.join(outputDir, stackId);
277
+ const agentsDir = path.join(pluginDir, "agents");
278
+ await ensureDir(pluginDir);
279
+ await ensureDir(agentsDir);
280
+ const pluginSkillsDir = path.join(pluginDir, "skills");
281
+ await ensureDir(pluginSkillsDir);
282
+ const copiedSourcePaths = /* @__PURE__ */ new Set();
283
+ for (const [, resolvedSkill] of Object.entries(skills)) {
284
+ const sourceSkillDir = path.join(projectRoot, resolvedSkill.path);
285
+ if (copiedSourcePaths.has(resolvedSkill.path)) {
286
+ continue;
287
+ }
288
+ const destSkillDir = path.join(pluginSkillsDir, resolvedSkill.canonicalId);
289
+ if (await directoryExists(sourceSkillDir)) {
290
+ await copy(sourceSkillDir, destSkillDir);
291
+ copiedSourcePaths.add(resolvedSkill.path);
292
+ verbose(` Copied skill: ${resolvedSkill.canonicalId}`);
293
+ } else {
294
+ verbose(` Warning: Skill directory not found: ${sourceSkillDir}`);
295
+ }
296
+ }
297
+ const engine = await createLiquidEngine();
298
+ const compiledAgentNames = [];
299
+ const allSkillPlugins = [];
300
+ for (const [name, agent] of Object.entries(resolvedAgents)) {
301
+ const output = await compileAgentForPlugin(
302
+ name,
303
+ agent,
304
+ PROJECT_ROOT,
305
+ engine
306
+ );
307
+ await writeFile(path.join(agentsDir, `${name}.md`), output);
308
+ compiledAgentNames.push(name);
309
+ for (const skill of agent.skills) {
310
+ allSkillPlugins.push(skill.id);
311
+ }
312
+ verbose(` Compiled agent: ${name}`);
313
+ }
314
+ const stackDir = path.join(projectRoot, DIRS.stacks, stackId);
315
+ const claudeMdPath = path.join(stackDir, "CLAUDE.md");
316
+ if (await fileExists(claudeMdPath)) {
317
+ const claudeContent = await readFile(claudeMdPath);
318
+ await writeFile(path.join(pluginDir, "CLAUDE.md"), claudeContent);
319
+ verbose(` Copied CLAUDE.md`);
320
+ }
321
+ const hasHooks = stackHasHooks(stack);
322
+ if (hasHooks && stack.hooks) {
323
+ const hooksDir = path.join(pluginDir, "hooks");
324
+ await ensureDir(hooksDir);
325
+ const hooksJson = generateHooksJson(stack.hooks);
326
+ await writeFile(path.join(hooksDir, "hooks.json"), hooksJson);
327
+ verbose(` Generated hooks/hooks.json`);
328
+ }
329
+ const { version, contentHash } = await determineStackVersion(
330
+ stack,
331
+ pluginDir
332
+ );
333
+ const uniqueSkillPlugins = [...new Set(allSkillPlugins)];
334
+ const manifest = generateStackPluginManifest({
335
+ stackName: stackId,
336
+ description: stack.description,
337
+ author: stack.author,
338
+ version,
339
+ keywords: stack.tags,
340
+ hasAgents: true,
341
+ hasHooks,
342
+ hasSkills: true
343
+ });
344
+ await writePluginManifest(pluginDir, manifest);
345
+ const hashFilePath = getPluginManifestPath(pluginDir).replace(
346
+ "plugin.json",
347
+ CONTENT_HASH_FILE
348
+ );
349
+ await writeFile(hashFilePath, contentHash);
350
+ verbose(` Wrote plugin.json (v${version})`);
351
+ const readme = generateStackReadme(
352
+ stackId,
353
+ stack,
354
+ compiledAgentNames,
355
+ uniqueSkillPlugins
356
+ );
357
+ await writeFile(path.join(pluginDir, "README.md"), readme);
358
+ verbose(` Generated README.md`);
359
+ return {
360
+ pluginPath: pluginDir,
361
+ manifest,
362
+ stackName: stack.name,
363
+ agents: compiledAgentNames,
364
+ skillPlugins: uniqueSkillPlugins,
365
+ hasHooks
366
+ };
367
+ }
368
+ function printStackCompilationSummary(result) {
369
+ console.log(`
370
+ Stack plugin compiled: ${result.stackName}`);
371
+ console.log(` Path: ${result.pluginPath}`);
372
+ console.log(` Agents: ${result.agents.length}`);
373
+ for (const agent of result.agents) {
374
+ console.log(` - ${agent}`);
375
+ }
376
+ if (result.skillPlugins.length > 0) {
377
+ console.log(` Skills included: ${result.skillPlugins.length}`);
378
+ for (const skill of result.skillPlugins) {
379
+ console.log(` - ${skill}`);
380
+ }
381
+ }
382
+ if (result.hasHooks) {
383
+ console.log(` Hooks: enabled`);
384
+ }
385
+ }
386
+
387
+ export {
388
+ compileAgentForPlugin,
389
+ compileStackPlugin,
390
+ printStackCompilationSummary
391
+ };
392
+ //# sourceMappingURL=chunk-Q2LH2DAB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli-v2/lib/stack-plugin-compiler.ts"],"sourcesContent":["import path from \"path\";\nimport { Liquid } from \"liquidjs\";\nimport {\n readFile,\n readFileOptional,\n writeFile,\n ensureDir,\n copy,\n fileExists,\n directoryExists,\n} from \"../utils/fs\";\nimport { verbose } from \"../utils/logger\";\nimport { DIRS, PROJECT_ROOT, DEFAULT_VERSION } from \"../consts\";\nimport { createLiquidEngine } from \"./compiler\";\nimport {\n generateStackPluginManifest,\n writePluginManifest,\n getPluginManifestPath,\n} from \"./plugin-manifest\";\nimport { loadSkillsByIds, loadAllAgents } from \"./loader\";\nimport { loadStackById, resolveAgentConfigToSkills } from \"./stacks-loader\";\nimport { loadSkillsMatrix } from \"./matrix-loader\";\nimport { SKILLS_MATRIX_PATH } from \"../consts\";\nimport { resolveAgents, stackToCompileConfig } from \"./resolver\";\nimport type { Stack } from \"../types-stacks\";\nimport { hashString, getCurrentDate } from \"./versioning\";\nimport type {\n PluginManifest,\n StackConfig,\n AgentConfig,\n CompileConfig,\n Skill,\n CompiledAgentData,\n AgentHookDefinition,\n} from \"../../types\";\n\nconst CONTENT_HASH_FILE = \".content-hash\";\n\nfunction parseMajorVersion(version: string): number {\n const match = version.match(/^(\\d+)\\./);\n return match ? parseInt(match[1], 10) : 1;\n}\n\nfunction bumpMajorVersion(version: string): string {\n const major = parseMajorVersion(version);\n return `${major + 1}.0.0`;\n}\n\nasync function readExistingManifest(\n pluginDir: string,\n): Promise<{ version: string; contentHash: string | undefined } | null> {\n const manifestPath = getPluginManifestPath(pluginDir);\n\n if (!(await fileExists(manifestPath))) {\n return null;\n }\n\n try {\n const content = await readFile(manifestPath);\n const manifest = JSON.parse(content) as PluginManifest;\n\n const hashFilePath = manifestPath.replace(\"plugin.json\", CONTENT_HASH_FILE);\n let contentHash: string | undefined;\n if (await fileExists(hashFilePath)) {\n contentHash = (await readFile(hashFilePath)).trim();\n }\n\n return {\n version: manifest.version ?? DEFAULT_VERSION,\n contentHash,\n };\n } catch {\n return null;\n }\n}\n\nfunction hashStackConfig(stack: StackConfig): string {\n const parts: string[] = [\n `name:${stack.name}`,\n `description:${stack.description ?? \"\"}`,\n `skills:${(stack.skills || [])\n .map((s) => s.id)\n .sort()\n .join(\",\")}`,\n `agents:${Object.keys(stack.agents || {})\n .sort()\n .join(\",\")}`,\n ];\n return hashString(parts.join(\"\\n\"));\n}\n\nasync function determineStackVersion(\n stack: StackConfig,\n pluginDir: string,\n): Promise<{ version: string; contentHash: string }> {\n const newHash = hashStackConfig(stack);\n\n const existing = await readExistingManifest(pluginDir);\n\n if (!existing) {\n return {\n version: DEFAULT_VERSION,\n contentHash: newHash,\n };\n }\n\n if (existing.contentHash !== newHash) {\n return {\n version: bumpMajorVersion(existing.version),\n contentHash: newHash,\n };\n }\n\n return {\n version: existing.version,\n contentHash: newHash,\n };\n}\n\nexport interface StackPluginOptions {\n stackId: string;\n outputDir: string;\n projectRoot: string;\n agentSourcePath?: string;\n /** Optional stack configuration - if provided, bypasses loading from config/stacks.yaml */\n stack?: Stack;\n}\n\nexport interface CompiledStackPlugin {\n pluginPath: string;\n manifest: PluginManifest;\n stackName: string;\n agents: string[];\n skillPlugins: string[];\n hasHooks: boolean;\n}\n\nexport async function compileAgentForPlugin(\n name: string,\n agent: AgentConfig,\n fallbackRoot: string,\n engine: Liquid,\n): Promise<string> {\n verbose(`Compiling agent: ${name}`);\n\n // Use agent's sourceRoot if available (for multi-source loading), otherwise fallback\n const agentSourceRoot = agent.sourceRoot || fallbackRoot;\n const agentDir = path.join(agentSourceRoot, DIRS.agents, agent.path || name);\n\n const intro = await readFile(path.join(agentDir, \"intro.md\"));\n const workflow = await readFile(path.join(agentDir, \"workflow.md\"));\n const examples = await readFileOptional(\n path.join(agentDir, \"examples.md\"),\n \"## Examples\\n\\n_No examples defined._\",\n );\n const criticalRequirementsTop = await readFileOptional(\n path.join(agentDir, \"critical-requirements.md\"),\n \"\",\n );\n const criticalReminders = await readFileOptional(\n path.join(agentDir, \"critical-reminders.md\"),\n \"\",\n );\n\n const agentPath = agent.path || name;\n const category = agentPath.split(\"/\")[0];\n const categoryDir = path.join(agentSourceRoot, DIRS.agents, category);\n\n let outputFormat = await readFileOptional(\n path.join(agentDir, \"output-format.md\"),\n \"\",\n );\n if (!outputFormat) {\n outputFormat = await readFileOptional(\n path.join(categoryDir, \"output-format.md\"),\n \"\",\n );\n }\n\n const preloadedSkills = agent.skills.filter((s) => s.preloaded);\n const dynamicSkills = agent.skills.filter((s) => !s.preloaded);\n\n const preloadedSkillIds = preloadedSkills.map((s) => s.id);\n\n verbose(\n `Skills for ${name}: ${preloadedSkills.length} preloaded, ${dynamicSkills.length} dynamic`,\n );\n\n const data: CompiledAgentData = {\n agent,\n intro,\n workflow,\n examples,\n criticalRequirementsTop,\n criticalReminders,\n outputFormat,\n skills: agent.skills,\n preloadedSkills,\n dynamicSkills,\n preloadedSkillIds,\n };\n\n return engine.renderFile(\"agent\", data);\n}\n\nfunction generateStackReadme(\n stackId: string,\n stack: StackConfig,\n agents: string[],\n skillPlugins: string[],\n): string {\n const lines: string[] = [];\n\n lines.push(`# ${stack.name}`);\n lines.push(\"\");\n lines.push(stack.description || \"A Claude Code stack plugin.\");\n lines.push(\"\");\n\n if (stack.tags && stack.tags.length > 0) {\n lines.push(\"## Tags\");\n lines.push(\"\");\n lines.push(stack.tags.map((t) => `\\`${t}\\``).join(\" \"));\n lines.push(\"\");\n }\n\n lines.push(\"## Installation\");\n lines.push(\"\");\n lines.push(\"Add this plugin to your Claude Code configuration:\");\n lines.push(\"\");\n lines.push(\"```json\");\n lines.push(`{`);\n lines.push(` \"plugins\": [\"${stackId}\"]`);\n lines.push(`}`);\n lines.push(\"```\");\n lines.push(\"\");\n\n lines.push(\"## Agents\");\n lines.push(\"\");\n lines.push(\"This stack includes the following agents:\");\n lines.push(\"\");\n for (const agent of agents) {\n lines.push(`- \\`${agent}\\``);\n }\n lines.push(\"\");\n\n if (skillPlugins.length > 0) {\n lines.push(\"## Included Skills\");\n lines.push(\"\");\n lines.push(\"This stack includes the following skills:\");\n lines.push(\"\");\n const uniqueSkills = [...new Set(skillPlugins)].sort();\n for (const skill of uniqueSkills) {\n lines.push(`- \\`${skill}\\``);\n }\n lines.push(\"\");\n }\n\n if (stack.philosophy) {\n lines.push(\"## Philosophy\");\n lines.push(\"\");\n lines.push(stack.philosophy);\n lines.push(\"\");\n }\n\n if (stack.principles && stack.principles.length > 0) {\n lines.push(\"## Principles\");\n lines.push(\"\");\n for (const principle of stack.principles) {\n lines.push(`- ${principle}`);\n }\n lines.push(\"\");\n }\n\n lines.push(\"---\");\n lines.push(\"\");\n lines.push(\"*Generated by Claude Collective stack-plugin-compiler*\");\n lines.push(\"\");\n\n return lines.join(\"\\n\");\n}\n\ninterface HooksJsonOutput {\n hooks: Record<string, AgentHookDefinition[]>;\n}\n\nfunction stackHasHooks(stack: StackConfig): boolean {\n return stack.hooks !== undefined && Object.keys(stack.hooks).length > 0;\n}\n\nfunction generateHooksJson(\n hooks: Record<string, AgentHookDefinition[]>,\n): string {\n const output: HooksJsonOutput = { hooks };\n return JSON.stringify(output, null, 2);\n}\n\nexport async function compileStackPlugin(\n options: StackPluginOptions,\n): Promise<CompiledStackPlugin> {\n const { stackId, outputDir, projectRoot, agentSourcePath } = options;\n const localAgentRoot = agentSourcePath || projectRoot;\n\n verbose(`Compiling stack plugin: ${stackId}`);\n verbose(` Stack/skills source: ${projectRoot}`);\n verbose(` Local agent source: ${localAgentRoot}`);\n verbose(` CLI agent source: ${PROJECT_ROOT}`);\n\n // Load agents from both local project and CLI, with local taking precedence\n const cliAgents = await loadAllAgents(PROJECT_ROOT);\n const localAgents = await loadAllAgents(localAgentRoot);\n const agents = { ...cliAgents, ...localAgents };\n\n verbose(\n ` Loaded ${Object.keys(localAgents).length} local agents, ${Object.keys(cliAgents).length} CLI agents`,\n );\n\n // Use provided stack or load from CLI's config/stacks.yaml\n const newStack =\n options.stack || (await loadStackById(stackId, PROJECT_ROOT));\n\n // Load skill aliases from the matrix to resolve technology aliases to skill IDs\n // This is needed for Phase 7 skill resolution in resolveAgents\n const matrixPath = path.join(PROJECT_ROOT, SKILLS_MATRIX_PATH);\n const matrix = await loadSkillsMatrix(matrixPath);\n const skillAliases = matrix.skill_aliases || {};\n\n let stack: StackConfig;\n if (newStack) {\n verbose(` Found stack: ${newStack.name}`);\n\n // Extract skills from stack's agent configurations (Phase 7: skills in stacks, not agents)\n const agentSkillIds = new Set<string>();\n for (const agentName of Object.keys(newStack.agents)) {\n const agentConfig = newStack.agents[agentName];\n const skillRefs = resolveAgentConfigToSkills(agentConfig, skillAliases);\n for (const ref of skillRefs) {\n agentSkillIds.add(ref.id);\n }\n }\n\n // Build StackConfig for compatibility with rest of function\n stack = {\n name: newStack.name,\n version: \"1.0.0\",\n author: \"\",\n description: newStack.description,\n skills: Array.from(agentSkillIds).map((id) => ({ id })),\n agents: Object.keys(newStack.agents),\n philosophy: newStack.philosophy,\n };\n } else {\n throw new Error(`Stack '${stackId}' not found in config/stacks.yaml`);\n }\n\n const skills = await loadSkillsByIds(stack.skills || [], projectRoot);\n\n const compileConfig: CompileConfig = stackToCompileConfig(stackId, stack);\n\n // Pass newStack and skillAliases for Phase 7 skill resolution\n const resolvedAgents = await resolveAgents(\n agents,\n skills,\n compileConfig,\n projectRoot,\n newStack,\n skillAliases,\n );\n\n const pluginDir = path.join(outputDir, stackId);\n const agentsDir = path.join(pluginDir, \"agents\");\n\n await ensureDir(pluginDir);\n await ensureDir(agentsDir);\n\n const pluginSkillsDir = path.join(pluginDir, \"skills\");\n await ensureDir(pluginSkillsDir);\n\n const copiedSourcePaths = new Set<string>();\n\n for (const [, resolvedSkill] of Object.entries(skills)) {\n const sourceSkillDir = path.join(projectRoot, resolvedSkill.path);\n\n if (copiedSourcePaths.has(resolvedSkill.path)) {\n continue;\n }\n\n const destSkillDir = path.join(pluginSkillsDir, resolvedSkill.canonicalId);\n\n if (await directoryExists(sourceSkillDir)) {\n await copy(sourceSkillDir, destSkillDir);\n copiedSourcePaths.add(resolvedSkill.path);\n verbose(` Copied skill: ${resolvedSkill.canonicalId}`);\n } else {\n verbose(` Warning: Skill directory not found: ${sourceSkillDir}`);\n }\n }\n\n const engine = await createLiquidEngine();\n\n const compiledAgentNames: string[] = [];\n const allSkillPlugins: string[] = [];\n\n for (const [name, agent] of Object.entries(resolvedAgents)) {\n const output = await compileAgentForPlugin(\n name,\n agent,\n PROJECT_ROOT,\n engine,\n );\n await writeFile(path.join(agentsDir, `${name}.md`), output);\n compiledAgentNames.push(name);\n\n for (const skill of agent.skills) {\n allSkillPlugins.push(skill.id);\n }\n\n verbose(` Compiled agent: ${name}`);\n }\n\n const stackDir = path.join(projectRoot, DIRS.stacks, stackId);\n const claudeMdPath = path.join(stackDir, \"CLAUDE.md\");\n if (await fileExists(claudeMdPath)) {\n const claudeContent = await readFile(claudeMdPath);\n await writeFile(path.join(pluginDir, \"CLAUDE.md\"), claudeContent);\n verbose(` Copied CLAUDE.md`);\n }\n\n const hasHooks = stackHasHooks(stack);\n if (hasHooks && stack.hooks) {\n const hooksDir = path.join(pluginDir, \"hooks\");\n await ensureDir(hooksDir);\n const hooksJson = generateHooksJson(stack.hooks);\n await writeFile(path.join(hooksDir, \"hooks.json\"), hooksJson);\n verbose(` Generated hooks/hooks.json`);\n }\n\n const { version, contentHash } = await determineStackVersion(\n stack,\n pluginDir,\n );\n\n const uniqueSkillPlugins = [...new Set(allSkillPlugins)];\n const manifest = generateStackPluginManifest({\n stackName: stackId,\n description: stack.description,\n author: stack.author,\n version,\n keywords: stack.tags,\n hasAgents: true,\n hasHooks,\n hasSkills: true,\n });\n\n await writePluginManifest(pluginDir, manifest);\n\n const hashFilePath = getPluginManifestPath(pluginDir).replace(\n \"plugin.json\",\n CONTENT_HASH_FILE,\n );\n await writeFile(hashFilePath, contentHash);\n\n verbose(` Wrote plugin.json (v${version})`);\n\n const readme = generateStackReadme(\n stackId,\n stack,\n compiledAgentNames,\n uniqueSkillPlugins,\n );\n await writeFile(path.join(pluginDir, \"README.md\"), readme);\n verbose(` Generated README.md`);\n\n return {\n pluginPath: pluginDir,\n manifest,\n stackName: stack.name,\n agents: compiledAgentNames,\n skillPlugins: uniqueSkillPlugins,\n hasHooks,\n };\n}\n\nexport function printStackCompilationSummary(\n result: CompiledStackPlugin,\n): void {\n console.log(`\\nStack plugin compiled: ${result.stackName}`);\n console.log(` Path: ${result.pluginPath}`);\n console.log(` Agents: ${result.agents.length}`);\n for (const agent of result.agents) {\n console.log(` - ${agent}`);\n }\n if (result.skillPlugins.length > 0) {\n console.log(` Skills included: ${result.skillPlugins.length}`);\n for (const skill of result.skillPlugins) {\n console.log(` - ${skill}`);\n }\n }\n if (result.hasHooks) {\n console.log(` Hooks: enabled`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,OAAO,UAAU;AAoCjB,IAAM,oBAAoB;AAE1B,SAAS,kBAAkB,SAAyB;AAClD,QAAM,QAAQ,QAAQ,MAAM,UAAU;AACtC,SAAO,QAAQ,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