@iowarp/clio-coder 0.3.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 (226) hide show
  1. package/CHANGELOG.md +407 -0
  2. package/CODE_OF_CONDUCT.md +21 -0
  3. package/CONTRIBUTING.md +224 -0
  4. package/LICENSE +202 -0
  5. package/NOTICE +9 -0
  6. package/README.md +798 -0
  7. package/SECURITY.md +72 -0
  8. package/assets/clio-coder-logo-128.webp +0 -0
  9. package/damage-control-rules.yaml +419 -0
  10. package/dist/acp-UMLFVA3F.js +92 -0
  11. package/dist/agents-Q4MYPMUW.js +91 -0
  12. package/dist/auth-O6HYIJ6J.js +521 -0
  13. package/dist/chunk-262G75JS.js +35 -0
  14. package/dist/chunk-26BZQOAD.js +1281 -0
  15. package/dist/chunk-2J63S4SF.js +508 -0
  16. package/dist/chunk-3DANZDGR.js +717 -0
  17. package/dist/chunk-4UQA7NCT.js +29 -0
  18. package/dist/chunk-527KG6XR.js +497 -0
  19. package/dist/chunk-5LDRNKX2.js +1063 -0
  20. package/dist/chunk-5N2FG33Q.js +25 -0
  21. package/dist/chunk-67MTHP2E.js +135 -0
  22. package/dist/chunk-6CWDTGUC.js +20 -0
  23. package/dist/chunk-7BHLZB3A.js +2115 -0
  24. package/dist/chunk-7RBKDI66.js +348 -0
  25. package/dist/chunk-AMFR5YA3.js +541 -0
  26. package/dist/chunk-BBUH4VAA.js +1224 -0
  27. package/dist/chunk-BYEU76JP.js +899 -0
  28. package/dist/chunk-CLJ5HLUD.js +458 -0
  29. package/dist/chunk-D5YD55AR.js +116 -0
  30. package/dist/chunk-DXQNI4PC.js +61 -0
  31. package/dist/chunk-E3NYWENM.js +1004 -0
  32. package/dist/chunk-GNGDQYDU.js +34688 -0
  33. package/dist/chunk-GOTUR54M.js +9 -0
  34. package/dist/chunk-HBU5MTAM.js +41 -0
  35. package/dist/chunk-HMYNFFY4.js +28 -0
  36. package/dist/chunk-JPOWPFCU.js +1010 -0
  37. package/dist/chunk-JWHCJDCI.js +1215 -0
  38. package/dist/chunk-KBR4MZZR.js +41 -0
  39. package/dist/chunk-KKKPTZLM.js +93 -0
  40. package/dist/chunk-ME6DNWIU.js +66 -0
  41. package/dist/chunk-NI4DEJMC.js +88 -0
  42. package/dist/chunk-O4EJEDHO.js +659 -0
  43. package/dist/chunk-PIDUD6M2.js +31 -0
  44. package/dist/chunk-PS4PFJQP.js +29459 -0
  45. package/dist/chunk-QV47YRF4.js +48 -0
  46. package/dist/chunk-RQDWMVRB.js +279 -0
  47. package/dist/chunk-TFSSEXL6.js +136 -0
  48. package/dist/chunk-TKHQ4DGZ.js +8290 -0
  49. package/dist/chunk-TPOCL34A.js +2876 -0
  50. package/dist/chunk-UGYAX5YI.js +565 -0
  51. package/dist/chunk-UHTSULZS.js +461 -0
  52. package/dist/chunk-UU3R62TT.js +128 -0
  53. package/dist/chunk-UWIJNAOB.js +3906 -0
  54. package/dist/chunk-VOO7NYPP.js +914 -0
  55. package/dist/chunk-VPAWTYLY.js +117 -0
  56. package/dist/chunk-WD6AJM35.js +1216 -0
  57. package/dist/chunk-X3BR7HWV.js +115 -0
  58. package/dist/chunk-X3NE4WVW.js +120 -0
  59. package/dist/chunk-XNISANGE.js +1395 -0
  60. package/dist/chunk-XV4ZJ6ZM.js +3177 -0
  61. package/dist/cli/index.js +236 -0
  62. package/dist/clio-KIQ5SNDS.js +53 -0
  63. package/dist/components-JVHMUBEB.js +653 -0
  64. package/dist/config-ZFCDBMDC.js +372 -0
  65. package/dist/configure-G4E3A2PG.js +27 -0
  66. package/dist/context-CDXTP2MP.js +293 -0
  67. package/dist/context-E3KIFVXI.js +185 -0
  68. package/dist/context-clear-3F4PLXOS.js +102 -0
  69. package/dist/context-index-Q7YSYTR3.js +106 -0
  70. package/dist/docs-YIETIWZI.js +280 -0
  71. package/dist/doctor-M5HJJZOL.js +61 -0
  72. package/dist/domains/agents/builtins/architect.md +33 -0
  73. package/dist/domains/agents/builtins/coder.md +31 -0
  74. package/dist/domains/agents/builtins/context-bootstrap.md +38 -0
  75. package/dist/domains/agents/builtins/debugger.md +30 -0
  76. package/dist/domains/agents/builtins/documenter.md +31 -0
  77. package/dist/domains/agents/builtins/git-master.md +30 -0
  78. package/dist/domains/agents/builtins/provenance.md +30 -0
  79. package/dist/domains/agents/builtins/researcher.md +71 -0
  80. package/dist/domains/agents/builtins/scout.md +42 -0
  81. package/dist/domains/agents/builtins/tester.md +31 -0
  82. package/dist/domains/agents/builtins/verifier.md +30 -0
  83. package/dist/domains/agents/builtins/wiki-writer.md +41 -0
  84. package/dist/eval-B3KZZESM.js +2674 -0
  85. package/dist/evidence-V67CHM35.js +233 -0
  86. package/dist/evolve-YDZSUQYA.js +518 -0
  87. package/dist/extensions-SRG7XCAH.js +207 -0
  88. package/dist/fleet-CA2CRTVG.js +760 -0
  89. package/dist/fleet-preflight-CLIAX7YR.js +21 -0
  90. package/dist/init-2OZDJE2D.js +227 -0
  91. package/dist/memory-3PIQQAKX.js +207 -0
  92. package/dist/models-DY35XI7Y.js +237 -0
  93. package/dist/paths-5OMXW7Z4.js +57 -0
  94. package/dist/preload-KZVHET2B.js +11 -0
  95. package/dist/reset-PIFYNOS3.js +216 -0
  96. package/dist/run-3VSPP24F.js +735 -0
  97. package/dist/share-D36RQCXM.js +241 -0
  98. package/dist/skills-F2MRLELY.js +445 -0
  99. package/dist/skills-eval-E2ZTW4PL.js +932 -0
  100. package/dist/targets-DZMEZAH4.js +977 -0
  101. package/dist/trace-7NYCUI2J.js +250 -0
  102. package/dist/uninstall-AD3JWHBB.js +322 -0
  103. package/dist/upgrade-WYYBKGDY.js +301 -0
  104. package/dist/usage-ULIDAGFF.js +755 -0
  105. package/dist/version-ROZ6CZKH.js +16 -0
  106. package/dist/wiki-generate-PKFIX6OB.js +377 -0
  107. package/dist/worker/entry.js +1739 -0
  108. package/docs/README.md +93 -0
  109. package/docs/acp.md +120 -0
  110. package/docs/alcf-provider.md +72 -0
  111. package/docs/architecture.md +172 -0
  112. package/docs/artifact-versions.md +54 -0
  113. package/docs/built-in-agents.md +265 -0
  114. package/docs/capacity-and-scheduling.md +97 -0
  115. package/docs/commands-and-modes.md +554 -0
  116. package/docs/config-knobs-audit.md +115 -0
  117. package/docs/configuration-and-targets.md +812 -0
  118. package/docs/context-engine.md +236 -0
  119. package/docs/dispatch-architecture-rationale.md +126 -0
  120. package/docs/documentation-coverage.md +46 -0
  121. package/docs/documentation-guide.md +166 -0
  122. package/docs/environment-variables.md +105 -0
  123. package/docs/eval-runner.md +205 -0
  124. package/docs/evals-internal.md +298 -0
  125. package/docs/evidence-and-memory.md +243 -0
  126. package/docs/evolution.md +143 -0
  127. package/docs/exit-codes-and-output.md +74 -0
  128. package/docs/extensions-and-sharing.md +306 -0
  129. package/docs/fleet-demo-runbook.md +179 -0
  130. package/docs/fleet-dispatch.md +591 -0
  131. package/docs/glossary.md +75 -0
  132. package/docs/html/agents_blueprint.html +936 -0
  133. package/docs/html/alcf_blueprint.html +324 -0
  134. package/docs/html/architecture_blueprint.html +850 -0
  135. package/docs/html/commands_blueprint.html +794 -0
  136. package/docs/html/config_knobs_audit_blueprint.html +178 -0
  137. package/docs/html/configuration_blueprint.html +1080 -0
  138. package/docs/html/context_blueprint.html +603 -0
  139. package/docs/html/documentation_blueprint.html +832 -0
  140. package/docs/html/environment_blueprint.html +404 -0
  141. package/docs/html/eval_blueprint.html +743 -0
  142. package/docs/html/evals_internal_blueprint.html +190 -0
  143. package/docs/html/evolution_blueprint.html +674 -0
  144. package/docs/html/extensions_blueprint.html +2065 -0
  145. package/docs/html/fleet_dispatch_blueprint.html +286 -0
  146. package/docs/html/index.html +919 -0
  147. package/docs/html/lifecycle_blueprint.html +723 -0
  148. package/docs/html/memory_blueprint.html +699 -0
  149. package/docs/html/middleware_blueprint.html +664 -0
  150. package/docs/html/models_blueprint.html +2366 -0
  151. package/docs/html/observability_blueprint.html +683 -0
  152. package/docs/html/provider_adapter_blueprint.html +245 -0
  153. package/docs/html/safety_blueprint.html +1386 -0
  154. package/docs/html/shared.css +571 -0
  155. package/docs/html/shared.js +143 -0
  156. package/docs/html/skills_blueprint.html +671 -0
  157. package/docs/html/soak_blueprint.html +182 -0
  158. package/docs/html/tool_usage_blueprint.html +350 -0
  159. package/docs/html/tools_blueprint.html +2249 -0
  160. package/docs/html/trace_blueprint.html +235 -0
  161. package/docs/html/tui_design_blueprint.html +314 -0
  162. package/docs/html/validation_blueprint.html +961 -0
  163. package/docs/html/worker_dispatch_blueprint.html +231 -0
  164. package/docs/installation-and-lifecycle.md +308 -0
  165. package/docs/middleware-and-components.md +148 -0
  166. package/docs/model-catalog.md +189 -0
  167. package/docs/observability.md +233 -0
  168. package/docs/proactive-memory.md +452 -0
  169. package/docs/prompt-envelope-and-tools.md +142 -0
  170. package/docs/provider-adapter-cookbook.md +148 -0
  171. package/docs/release-cut-checklist.md +138 -0
  172. package/docs/safety-model.md +357 -0
  173. package/docs/scientific-validation.md +105 -0
  174. package/docs/session-lifecycle.md +156 -0
  175. package/docs/skills-marketplace.md +46 -0
  176. package/docs/tool-usage.md +527 -0
  177. package/docs/trace-store.md +132 -0
  178. package/docs/troubleshooting.md +33 -0
  179. package/docs/tui-design.md +239 -0
  180. package/docs/worker-dispatch-mechanics.md +242 -0
  181. package/package.json +132 -0
  182. package/skills/README.md +408 -0
  183. package/skills/git/commit-crafting/SKILL.md +79 -0
  184. package/skills/git/commit-crafting/evals.md +92 -0
  185. package/skills/git/create-pr/SKILL.md +116 -0
  186. package/skills/git/create-pr/evals.md +114 -0
  187. package/skills/git/investigate-issue/SKILL.md +139 -0
  188. package/skills/git/investigate-issue/evals.md +94 -0
  189. package/skills/git/resolve-merge-conflicts/SKILL.md +96 -0
  190. package/skills/git/resolve-merge-conflicts/evals.md +58 -0
  191. package/skills/git/review-changes/SKILL.md +103 -0
  192. package/skills/git/review-changes/evals.md +85 -0
  193. package/skills/git/worktree-create/SKILL.md +92 -0
  194. package/skills/git/worktree-create/evals.md +97 -0
  195. package/skills/git/worktree-create/references/worktree-setup.md +66 -0
  196. package/skills/git/worktree-merge/SKILL.md +95 -0
  197. package/skills/git/worktree-merge/evals.md +114 -0
  198. package/skills/skill-marketplace.json +261 -0
  199. package/skills/workflow/cut-it/SKILL.md +86 -0
  200. package/skills/workflow/cut-it/evals.md +42 -0
  201. package/src/domains/agents/builtins/architect.md +33 -0
  202. package/src/domains/agents/builtins/coder.md +31 -0
  203. package/src/domains/agents/builtins/context-bootstrap.md +38 -0
  204. package/src/domains/agents/builtins/debugger.md +30 -0
  205. package/src/domains/agents/builtins/documenter.md +31 -0
  206. package/src/domains/agents/builtins/git-master.md +30 -0
  207. package/src/domains/agents/builtins/provenance.md +30 -0
  208. package/src/domains/agents/builtins/researcher.md +71 -0
  209. package/src/domains/agents/builtins/scout.md +42 -0
  210. package/src/domains/agents/builtins/tester.md +31 -0
  211. package/src/domains/agents/builtins/verifier.md +30 -0
  212. package/src/domains/agents/builtins/wiki-writer.md +41 -0
  213. package/src/domains/agents/fleets/build-review.md +34 -0
  214. package/src/domains/agents/fleets/build-test.md +35 -0
  215. package/src/domains/agents/fleets/sdlc.md +86 -0
  216. package/src/domains/prompts/fragments/identity/clio-worker.md +11 -0
  217. package/src/domains/prompts/fragments/identity/clio.md +26 -0
  218. package/src/domains/prompts/fragments/operating/contract.md +64 -0
  219. package/src/domains/prompts/fragments/safety/auto-edit.md +14 -0
  220. package/src/domains/prompts/fragments/safety/full-auto.md +14 -0
  221. package/src/domains/prompts/fragments/safety/read-only.md +13 -0
  222. package/src/domains/prompts/fragments/safety/suggest.md +13 -0
  223. package/src/domains/prompts/fragments/wiki/page.md +75 -0
  224. package/src/domains/prompts/fragments/wiki/plan.md +48 -0
  225. package/src/domains/providers/models/cloud-models/alcf.yaml +40 -0
  226. package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +993 -0
@@ -0,0 +1,241 @@
1
+ import {
2
+ importShareArchive,
3
+ planShareImport,
4
+ writeShareArchive
5
+ } from "./chunk-AMFR5YA3.js";
6
+ import "./chunk-PIDUD6M2.js";
7
+ import {
8
+ printError,
9
+ printOk
10
+ } from "./chunk-67MTHP2E.js";
11
+ import "./chunk-JWHCJDCI.js";
12
+ import "./chunk-UHTSULZS.js";
13
+ import "./chunk-5LDRNKX2.js";
14
+ import "./chunk-VPAWTYLY.js";
15
+ import "./chunk-X3NE4WVW.js";
16
+ import "./chunk-DXQNI4PC.js";
17
+
18
+ // src/cli/share.ts
19
+ import { resolve } from "node:path";
20
+ var HELP = `clio-coder share <command>
21
+
22
+ Export and import portable Clio project/resource archives.
23
+
24
+ Commands:
25
+ clio-coder share export --out <path> [--project|--user|--both] [--context] [--prompts] [--skills] [--settings] [--extensions]
26
+ clio-coder share import <path> [--dry-run] [--force] [--project|--user] [--json]
27
+ clio-coder share inspect <path> [--json]
28
+
29
+ Aliases:
30
+ clio-coder export --out <path> ...
31
+ clio-coder import <path> ...
32
+ `;
33
+ function parse(argv) {
34
+ const out = { positional: [], json: false, dryRun: false, force: false, help: false };
35
+ for (let i = 0; i < argv.length; i += 1) {
36
+ const arg = argv[i];
37
+ if (!arg) continue;
38
+ if (!out.command && !arg.startsWith("-")) {
39
+ out.command = arg;
40
+ continue;
41
+ }
42
+ const need = () => {
43
+ const value = argv[i + 1];
44
+ if (!value) return null;
45
+ i += 1;
46
+ return value;
47
+ };
48
+ switch (arg) {
49
+ case "--out": {
50
+ const value = need();
51
+ if (!value) return null;
52
+ out.out = value;
53
+ break;
54
+ }
55
+ case "--project":
56
+ if (out.scope && out.scope !== "project") return null;
57
+ out.scope = "project";
58
+ break;
59
+ case "--user":
60
+ if (out.scope && out.scope !== "user") return null;
61
+ out.scope = "user";
62
+ break;
63
+ case "--both":
64
+ if (out.scope && out.scope !== "both") return null;
65
+ out.scope = "both";
66
+ break;
67
+ case "--json":
68
+ out.json = true;
69
+ break;
70
+ case "--dry-run":
71
+ out.dryRun = true;
72
+ break;
73
+ case "--force":
74
+ case "-f":
75
+ out.force = true;
76
+ break;
77
+ case "--context":
78
+ out.includeContext = true;
79
+ break;
80
+ case "--prompts":
81
+ out.includePrompts = true;
82
+ break;
83
+ case "--skills":
84
+ out.includeSkills = true;
85
+ break;
86
+ case "--settings":
87
+ out.includeSettings = true;
88
+ break;
89
+ case "--extensions":
90
+ out.includeExtensions = true;
91
+ break;
92
+ case "--all":
93
+ out.includeContext = true;
94
+ out.includePrompts = true;
95
+ out.includeSkills = true;
96
+ out.includeSettings = true;
97
+ out.includeExtensions = true;
98
+ break;
99
+ case "--help":
100
+ case "-h":
101
+ out.help = true;
102
+ break;
103
+ default:
104
+ if (arg.startsWith("-")) return null;
105
+ out.positional.push(arg);
106
+ }
107
+ }
108
+ return out;
109
+ }
110
+ function hasBlockingDiagnostics(diagnostics) {
111
+ return diagnostics.some((diag) => diag.type === "error" || diag.type === "conflict");
112
+ }
113
+ function printDiagnostics(diagnostics) {
114
+ for (const diag of diagnostics) {
115
+ const detail = diag.path ? `${diag.message}: ${diag.path}` : diag.message;
116
+ if (diag.type === "error" || diag.type === "conflict") printError(detail);
117
+ else process.stderr.write(`warning: ${detail}
118
+ `);
119
+ }
120
+ }
121
+ function printRecovery(plan) {
122
+ if (!plan.recovery) return;
123
+ process.stderr.write("recovery: import stopped after a write failure\n");
124
+ process.stderr.write("written files:\n");
125
+ if (plan.recovery.written.length === 0) process.stderr.write(" none\n");
126
+ else {
127
+ for (const written of plan.recovery.written) process.stderr.write(` ${written}
128
+ `);
129
+ }
130
+ process.stderr.write("backups:\n");
131
+ if (plan.recovery.backups.length === 0) process.stderr.write(" none\n");
132
+ else {
133
+ for (const backup of plan.recovery.backups) process.stderr.write(` ${backup}
134
+ `);
135
+ }
136
+ if (plan.recovery.failed) process.stderr.write(`failed file:
137
+ ${plan.recovery.failed}
138
+ `);
139
+ }
140
+ function exportOptions(parsed) {
141
+ return {
142
+ ...parsed.scope ? { scope: parsed.scope } : {},
143
+ ...parsed.includeContext !== void 0 ? { includeContext: parsed.includeContext } : {},
144
+ ...parsed.includePrompts !== void 0 ? { includePrompts: parsed.includePrompts } : {},
145
+ ...parsed.includeSkills !== void 0 ? { includeSkills: parsed.includeSkills } : {},
146
+ ...parsed.includeSettings !== void 0 ? { includeSettings: parsed.includeSettings } : {},
147
+ ...parsed.includeExtensions !== void 0 ? { includeExtensions: parsed.includeExtensions } : {}
148
+ };
149
+ }
150
+ function printPlan(plan, dryRun) {
151
+ printDiagnostics(plan.diagnostics);
152
+ printRecovery(plan);
153
+ const verb = dryRun ? "would" : "will";
154
+ const counts = /* @__PURE__ */ new Map();
155
+ for (const action of plan.actions) counts.set(action.action, (counts.get(action.action) ?? 0) + 1);
156
+ process.stdout.write(
157
+ `import ${dryRun ? "dry-run" : "plan"}: ${verb} write ${counts.get("write") ?? 0}, overwrite ${counts.get("overwrite") ?? 0}, skip ${counts.get("skip") ?? 0}, settings ${counts.get("settings") ?? 0}
158
+ `
159
+ );
160
+ for (const action of plan.actions.slice(0, 12)) {
161
+ process.stdout.write(` ${action.action.padEnd(9)} ${action.type.padEnd(15)} ${action.path}
162
+ `);
163
+ }
164
+ if (plan.actions.length > 12) process.stdout.write(` ... ${plan.actions.length - 12} more action(s)
165
+ `);
166
+ }
167
+ function runShareCommand(argv) {
168
+ const parsed = parse(argv);
169
+ if (!parsed || parsed.help || !parsed.command) {
170
+ process.stdout.write(HELP);
171
+ return parsed ? 0 : 2;
172
+ }
173
+ switch (parsed.command) {
174
+ case "export": {
175
+ if (!parsed.out) {
176
+ process.stderr.write("usage: clio-coder share export --out <path>\n");
177
+ return 2;
178
+ }
179
+ const archive = writeShareArchive(resolve(parsed.out), exportOptions(parsed));
180
+ if (parsed.json) process.stdout.write(`${JSON.stringify({ archive }, null, 2)}
181
+ `);
182
+ else printOk(`exported ${archive.files.length} item(s) to ${resolve(parsed.out)}`);
183
+ return 0;
184
+ }
185
+ case "import": {
186
+ const archivePath = parsed.positional[0];
187
+ if (!archivePath || parsed.positional.length !== 1) {
188
+ process.stderr.write("usage: clio-coder share import <path> [--dry-run] [--force]\n");
189
+ return 2;
190
+ }
191
+ const options = {
192
+ dryRun: parsed.dryRun,
193
+ force: parsed.force,
194
+ ...parsed.scope === "user" || parsed.scope === "project" ? { scope: parsed.scope } : {}
195
+ };
196
+ const plan = parsed.dryRun ? planShareImport(resolve(archivePath), options) : importShareArchive(resolve(archivePath), options);
197
+ if (parsed.json) process.stdout.write(`${JSON.stringify(plan, null, 2)}
198
+ `);
199
+ else printPlan(plan, parsed.dryRun);
200
+ return hasBlockingDiagnostics(plan.diagnostics) ? 1 : 0;
201
+ }
202
+ case "inspect": {
203
+ const archivePath = parsed.positional[0];
204
+ if (!archivePath || parsed.positional.length !== 1) {
205
+ process.stderr.write("usage: clio-coder share inspect <path>\n");
206
+ return 2;
207
+ }
208
+ const plan = planShareImport(resolve(archivePath), { dryRun: true, force: true });
209
+ if (parsed.json)
210
+ process.stdout.write(`${JSON.stringify({ archive: plan.archive, diagnostics: plan.diagnostics }, null, 2)}
211
+ `);
212
+ else {
213
+ printDiagnostics(plan.diagnostics);
214
+ const archive = plan.archive;
215
+ if (archive) {
216
+ process.stdout.write(
217
+ `archive: ${archive.manifest.format} clio=${archive.manifest.clioVersion} files=${archive.files.length} created=${archive.manifest.createdAt}
218
+ `
219
+ );
220
+ }
221
+ }
222
+ return plan.diagnostics.some((diag) => diag.type === "error") ? 1 : 0;
223
+ }
224
+ default:
225
+ printError(`unknown share command: ${parsed.command}`);
226
+ process.stdout.write(HELP);
227
+ return 2;
228
+ }
229
+ }
230
+ function runExportCommand(argv) {
231
+ return runShareCommand(["export", ...argv]);
232
+ }
233
+ function runImportCommand(argv) {
234
+ return runShareCommand(["import", ...argv]);
235
+ }
236
+ export {
237
+ runExportCommand,
238
+ runImportCommand,
239
+ runShareCommand
240
+ };
241
+ //# sourceMappingURL=share-D36RQCXM.js.map
@@ -0,0 +1,445 @@
1
+ import "./chunk-2J63S4SF.js";
2
+ import {
3
+ discoverMarketplaceSkills,
4
+ installSkill,
5
+ loadSkills,
6
+ modelVisibleSkills,
7
+ updateSkills
8
+ } from "./chunk-26BZQOAD.js";
9
+ import "./chunk-QV47YRF4.js";
10
+ import "./chunk-CLJ5HLUD.js";
11
+ import "./chunk-PIDUD6M2.js";
12
+ import {
13
+ formatColumns,
14
+ printError,
15
+ printOk
16
+ } from "./chunk-67MTHP2E.js";
17
+ import "./chunk-5LDRNKX2.js";
18
+ import "./chunk-VPAWTYLY.js";
19
+ import "./chunk-X3NE4WVW.js";
20
+
21
+ // src/cli/skills.ts
22
+ import { resolve } from "node:path";
23
+ var HELP = `clio-coder skills <command>
24
+
25
+ Manage local Clio and Agent Skills-compatible skills.
26
+
27
+ Commands:
28
+ clio-coder skills list [--json] [--all]
29
+ clio-coder skills search <query> [--json]
30
+ clio-coder skills inspect <name> [--json]
31
+ clio-coder skills validate [path] [--json]
32
+ clio-coder skills install <name|path|github-url>... [--user|--project] [--name <name>] [--force]
33
+ clio-coder skills install --category <category> [--user|--project] [--force]
34
+ clio-coder skills update <name> | --all [--force]
35
+ clio-coder skills sync [--force]
36
+ clio-coder skills eval <name|path> [--scenario <id>] [--target <id>] [--workspace <path>] [--timeout <seconds>] [--trust-fixtures] [--allow-network] [--json]
37
+
38
+ search covers installed skills plus the local marketplace (a repo skills/
39
+ catalog, CLIO_CODER_SKILL_CATALOG_DIR, or the skill-marketplace.json index).
40
+
41
+ install resolves a bare name through that marketplace; a path or GitHub URL
42
+ installs directly, and an existing local path always wins over a same-named
43
+ marketplace entry. Several sources install in one command, and --category
44
+ installs every marketplace skill in one catalog group (git, research, ...).
45
+
46
+ eval (experimental) executes the skill's evals.md RED-GREEN scenarios: per
47
+ scenario a baseline headless run without the skill, a treatment run with it,
48
+ and a judge run scoring each Expected bullet from the transcripts. Exit is 1
49
+ when a treatment bullet fails and 3 when a scenario was never measured (a
50
+ truncated or unparseable judge response scores no bullet, which is not a skill
51
+ failure). Every arm runs hermetic: the network tool plane is stripped from the
52
+ child runs unless you pass --allow-network. The baseline and treatment arms run
53
+ at autonomy full-auto in per-run disposable workspaces, because a headless run
54
+ has no operator to approve anything and a gated arm measures the harness rather
55
+ than the skill. --scenario takes a full id as written
56
+ in evals.md, whose prefix is per-skill (S1, but also D2 in clio-dev, T3 in
57
+ clio-test, F1 in find-skills, H2 in context-handoff), or a bare number that
58
+ selects that scenario whatever its prefix. --json emits one JSONL row per
59
+ (scenario, bullet) with schema: "experimental". --workspace copies an existing
60
+ checkout into a throwaway seed; the source checkout is not mutated. Fixture
61
+ commands declared in evals.md are real shell run in that seed; they only execute
62
+ with --trust-fixtures, after you have reviewed the evals.md.
63
+ `;
64
+ function parse(argv) {
65
+ const out = {
66
+ positional: [],
67
+ json: false,
68
+ all: false,
69
+ help: false,
70
+ force: false,
71
+ trustFixtures: false,
72
+ allowNetwork: false
73
+ };
74
+ for (let i = 0; i < argv.length; i++) {
75
+ const arg = argv[i];
76
+ if (arg === void 0) continue;
77
+ if (!out.command && !arg.startsWith("-")) {
78
+ out.command = arg;
79
+ continue;
80
+ }
81
+ switch (arg) {
82
+ case "--json":
83
+ out.json = true;
84
+ break;
85
+ case "--all":
86
+ out.all = true;
87
+ break;
88
+ case "--force":
89
+ out.force = true;
90
+ break;
91
+ case "--trust-fixtures":
92
+ out.trustFixtures = true;
93
+ break;
94
+ case "--allow-network":
95
+ out.allowNetwork = true;
96
+ break;
97
+ case "--name": {
98
+ const value = argv[i + 1];
99
+ if (!value || value.startsWith("-")) throw new Error("--name requires a value");
100
+ out.name = value;
101
+ i++;
102
+ break;
103
+ }
104
+ case "--category": {
105
+ const value = argv[i + 1];
106
+ if (!value || value.startsWith("-")) throw new Error("--category requires a value");
107
+ out.category = value;
108
+ i++;
109
+ break;
110
+ }
111
+ case "--scenario": {
112
+ const value = argv[i + 1];
113
+ if (!value || value.startsWith("-")) throw new Error("--scenario requires a value");
114
+ out.scenario = value;
115
+ i++;
116
+ break;
117
+ }
118
+ case "--target": {
119
+ const value = argv[i + 1];
120
+ if (!value || value.startsWith("-")) throw new Error("--target requires a value");
121
+ out.target = value;
122
+ i++;
123
+ break;
124
+ }
125
+ case "--workspace": {
126
+ const value = argv[i + 1];
127
+ if (!value || value.startsWith("-")) throw new Error("--workspace requires a value");
128
+ out.workspace = value;
129
+ i++;
130
+ break;
131
+ }
132
+ case "--timeout": {
133
+ const value = argv[i + 1];
134
+ const seconds = value === void 0 ? Number.NaN : Number.parseInt(value, 10);
135
+ if (!Number.isInteger(seconds) || seconds <= 0) throw new Error("--timeout requires a positive integer");
136
+ out.timeoutSeconds = seconds;
137
+ i++;
138
+ break;
139
+ }
140
+ case "--user":
141
+ if (out.scope && out.scope !== "user") throw new Error("--user and --project are mutually exclusive");
142
+ out.scope = "user";
143
+ break;
144
+ case "--project":
145
+ if (out.scope && out.scope !== "project") throw new Error("--user and --project are mutually exclusive");
146
+ out.scope = "project";
147
+ break;
148
+ case "--help":
149
+ case "-h":
150
+ out.help = true;
151
+ break;
152
+ default:
153
+ if (arg.startsWith("-")) throw new Error(`unknown flag: ${arg}`);
154
+ out.positional.push(arg);
155
+ }
156
+ }
157
+ return out;
158
+ }
159
+ function printUpdateReports(reports) {
160
+ if (reports.length === 0) {
161
+ process.stdout.write("skills: nothing to update (no installed skills with source-url provenance)\n");
162
+ return 0;
163
+ }
164
+ for (const report of reports) {
165
+ const detail = report.detail ? ` (${report.detail})` : "";
166
+ process.stdout.write(`${report.name}: ${report.status}${detail}
167
+ `);
168
+ }
169
+ return reports.some((report) => report.status === "error") ? 1 : 0;
170
+ }
171
+ function printDiagnostics(diagnostics) {
172
+ for (const diag of diagnostics) {
173
+ const detail = diag.path ? `${diag.message}: ${diag.path}` : diag.message;
174
+ if (diag.type === "error") printError(detail);
175
+ else process.stderr.write(`warning: ${detail}
176
+ `);
177
+ }
178
+ }
179
+ function skillRows(skills) {
180
+ return skills.map((skill) => [
181
+ skill.name,
182
+ skill.scope,
183
+ skill.source,
184
+ skill.trusted ? "trusted" : "untrusted",
185
+ skill.disableModelInvocation ? "manual" : "model",
186
+ skill.hash.slice(0, 12),
187
+ skill.description
188
+ ]);
189
+ }
190
+ function printList(skills) {
191
+ if (skills.length === 0) {
192
+ process.stdout.write("skills: none\n");
193
+ return;
194
+ }
195
+ process.stdout.write(
196
+ formatColumns([["name", "scope", "source", "trust", "invoke", "hash", "description"], ...skillRows(skills)])
197
+ );
198
+ }
199
+ function printInspect(skill) {
200
+ process.stdout.write(`name: ${skill.name}
201
+ `);
202
+ process.stdout.write(`description: ${skill.description}
203
+ `);
204
+ process.stdout.write(`path: ${skill.filePath}
205
+ `);
206
+ process.stdout.write(`baseDir: ${skill.baseDir}
207
+ `);
208
+ process.stdout.write(`scope: ${skill.scope}
209
+ `);
210
+ process.stdout.write(`source: ${skill.source}
211
+ `);
212
+ process.stdout.write(`trusted: ${skill.trusted}
213
+ `);
214
+ process.stdout.write(`disableModelInvocation: ${skill.disableModelInvocation}
215
+ `);
216
+ process.stdout.write(`hash: ${skill.hash}
217
+ `);
218
+ if (skill.diagnostics.length > 0) {
219
+ process.stdout.write("diagnostics:\n");
220
+ for (const diag of skill.diagnostics) process.stdout.write(` ${diag.type}: ${diag.message}
221
+ `);
222
+ }
223
+ }
224
+ function formatMarketplaceOrigin(skill) {
225
+ const parts = [skill.origin === "catalog" ? "catalog" : "index"];
226
+ if (skill.version) parts.push(`v${skill.version}`);
227
+ if (skill.audit) parts.push(`audit: ${skill.audit}`);
228
+ return parts.join(", ");
229
+ }
230
+ function validationLoad(pathArg) {
231
+ if (!pathArg) return loadSkills({ cwd: process.cwd() });
232
+ return loadSkills({ disableDiscovery: true, explicitSkillPaths: [resolve(pathArg)] });
233
+ }
234
+ async function runSkillsCommand(argv) {
235
+ let parsed;
236
+ try {
237
+ parsed = parse(argv);
238
+ } catch (error) {
239
+ printError(error instanceof Error ? error.message : String(error));
240
+ process.stderr.write(HELP);
241
+ return 2;
242
+ }
243
+ if (parsed.help || !parsed.command) {
244
+ process.stdout.write(HELP);
245
+ return 0;
246
+ }
247
+ switch (parsed.command) {
248
+ case "list": {
249
+ const list = loadSkills({ cwd: process.cwd() });
250
+ const skills = parsed.all ? list.items : modelVisibleSkills(list.items);
251
+ if (parsed.json) process.stdout.write(`${JSON.stringify({ skills, diagnostics: list.diagnostics }, null, 2)}
252
+ `);
253
+ else {
254
+ printList(skills);
255
+ printDiagnostics(list.diagnostics);
256
+ }
257
+ return list.diagnostics.some((diag) => diag.type === "error") ? 1 : 0;
258
+ }
259
+ case "search": {
260
+ const query = parsed.positional.join(" ").trim().toLowerCase();
261
+ if (query.length === 0) {
262
+ process.stderr.write("usage: clio-coder skills search <query> [--json]\n");
263
+ return 2;
264
+ }
265
+ const list = loadSkills({ cwd: process.cwd() });
266
+ const discovery = discoverMarketplaceSkills({ cwd: process.cwd() });
267
+ const installedNames = new Set(list.items.map((skill) => skill.name));
268
+ const matchesQuery = (name, description) => name.toLowerCase().includes(query) || description.toLowerCase().includes(query);
269
+ const installed = list.items.filter((skill) => matchesQuery(skill.name, skill.description));
270
+ const marketplace = discovery.skills.filter(
271
+ (skill) => !installedNames.has(skill.name) && (matchesQuery(skill.name, skill.description) || skill.category?.toLowerCase() === query)
272
+ );
273
+ const exitCode = list.diagnostics.some((diag) => diag.type === "error") ? 1 : 0;
274
+ if (parsed.json) {
275
+ process.stdout.write(
276
+ `${JSON.stringify(
277
+ { query, installed, marketplace, diagnostics: list.diagnostics, marketplaceDiagnostics: discovery.diagnostics },
278
+ null,
279
+ 2
280
+ )}
281
+ `
282
+ );
283
+ return exitCode;
284
+ }
285
+ if (installed.length > 0) {
286
+ process.stdout.write("installed:\n");
287
+ for (const skill of installed) {
288
+ process.stdout.write(` ${skill.name.padEnd(24)} ${skill.description} (${skill.scope}/${skill.source})
289
+ `);
290
+ }
291
+ }
292
+ if (marketplace.length > 0) {
293
+ process.stdout.write("marketplace (clio-coder skills install <name>):\n");
294
+ for (const skill of marketplace) {
295
+ process.stdout.write(` ${skill.name.padEnd(24)} ${skill.description} (${formatMarketplaceOrigin(skill)})
296
+ `);
297
+ }
298
+ }
299
+ if (installed.length === 0 && marketplace.length === 0) {
300
+ process.stdout.write(`skills: no matches for "${query}"
301
+ `);
302
+ }
303
+ printDiagnostics(list.diagnostics);
304
+ for (const message of discovery.diagnostics) process.stderr.write(`warning: ${message}
305
+ `);
306
+ return exitCode;
307
+ }
308
+ case "inspect": {
309
+ const name = parsed.positional[0];
310
+ if (!name || parsed.positional.length !== 1) {
311
+ process.stderr.write("usage: clio-coder skills inspect <name> [--json]\n");
312
+ return 2;
313
+ }
314
+ const list = loadSkills({ cwd: process.cwd() });
315
+ const skill = list.items.find((entry) => entry.name === name);
316
+ if (!skill) {
317
+ const available = discoverMarketplaceSkills({ cwd: process.cwd() }).skills.some((entry) => entry.name === name);
318
+ printError(
319
+ available ? `skill not installed: ${name} (available in the marketplace; install it with: clio-coder skills install ${name})` : `unknown skill: ${name}`
320
+ );
321
+ return 1;
322
+ }
323
+ if (parsed.json) process.stdout.write(`${JSON.stringify({ skill }, null, 2)}
324
+ `);
325
+ else printInspect(skill);
326
+ return 0;
327
+ }
328
+ case "validate": {
329
+ const pathArg = parsed.positional[0];
330
+ if (parsed.positional.length > 1) {
331
+ process.stderr.write("usage: clio-coder skills validate [path] [--json]\n");
332
+ return 2;
333
+ }
334
+ const list = validationLoad(pathArg);
335
+ const loadedPaths = new Set(list.items.map((skill) => skill.filePath));
336
+ const hasInvalidDiagnostic = list.diagnostics.some(
337
+ (diag) => diag.type === "error" || diag.type === "collision" || diag.type === "warning" && diag.path !== void 0 && !loadedPaths.has(diag.path)
338
+ );
339
+ const ok = list.items.length > 0 && !hasInvalidDiagnostic;
340
+ if (parsed.json) {
341
+ process.stdout.write(`${JSON.stringify({ ok, skills: list.items, diagnostics: list.diagnostics }, null, 2)}
342
+ `);
343
+ } else {
344
+ printDiagnostics(list.diagnostics);
345
+ process.stdout.write(`${ok ? "valid" : "invalid"}: ${list.items.length} skill(s)
346
+ `);
347
+ }
348
+ return ok ? 0 : 1;
349
+ }
350
+ case "install": {
351
+ let sources = parsed.positional;
352
+ if (parsed.category !== void 0) {
353
+ if (sources.length > 0) {
354
+ process.stderr.write("--category installs a whole catalog group; do not also name skills\n");
355
+ return 2;
356
+ }
357
+ const grouped = discoverMarketplaceSkills().skills.filter((skill) => skill.category === parsed.category);
358
+ if (grouped.length === 0) {
359
+ printError(`no marketplace skills in category "${parsed.category}"`);
360
+ return 1;
361
+ }
362
+ sources = grouped.map((skill) => skill.name);
363
+ }
364
+ if (sources.length === 0) {
365
+ process.stderr.write(
366
+ "usage: clio-coder skills install <name|path|github-url>... [--user|--project] [--name <name>] [--force]\n clio-coder skills install --category <category> [--user|--project] [--force]\n"
367
+ );
368
+ return 2;
369
+ }
370
+ if (parsed.name !== void 0 && sources.length !== 1) {
371
+ process.stderr.write("--name applies to a single skill; install them one at a time to rename\n");
372
+ return 2;
373
+ }
374
+ let failed = 0;
375
+ for (const source of sources) {
376
+ try {
377
+ const result = installSkill({
378
+ source,
379
+ scope: parsed.scope ?? "project",
380
+ force: parsed.force,
381
+ ...parsed.name ? { name: parsed.name } : {}
382
+ });
383
+ printOk(`installed ${result.scope} skill ${result.name} at ${result.path}`);
384
+ for (const warning of result.warnings) process.stderr.write(`warning: ${warning}
385
+ `);
386
+ } catch (err) {
387
+ failed += 1;
388
+ printError(err instanceof Error ? err.message : String(err));
389
+ }
390
+ }
391
+ if (failed === sources.length) return 1;
392
+ process.stdout.write("audit is set to unknown; review the skill and set audit: pass yourself\n");
393
+ return failed > 0 ? 1 : 0;
394
+ }
395
+ case "update": {
396
+ const name = parsed.positional[0];
397
+ if (!name && !parsed.all || parsed.positional.length > 1) {
398
+ process.stderr.write("usage: clio-coder skills update <name> | --all [--force]\n");
399
+ return 2;
400
+ }
401
+ try {
402
+ const reports = updateSkills(name ? { name, force: parsed.force } : { all: true, force: parsed.force });
403
+ return printUpdateReports(reports);
404
+ } catch (err) {
405
+ printError(err instanceof Error ? err.message : String(err));
406
+ return 1;
407
+ }
408
+ }
409
+ case "sync": {
410
+ try {
411
+ return printUpdateReports(updateSkills({ all: true, force: parsed.force }));
412
+ } catch (err) {
413
+ printError(err instanceof Error ? err.message : String(err));
414
+ return 1;
415
+ }
416
+ }
417
+ case "eval": {
418
+ const name = parsed.positional[0];
419
+ if (!name || parsed.positional.length !== 1) {
420
+ process.stderr.write(
421
+ "usage: clio-coder skills eval <name|path> [--scenario <id>] [--target <id>] [--workspace <path>] [--timeout <seconds>] [--trust-fixtures] [--allow-network] [--json]\n"
422
+ );
423
+ return 2;
424
+ }
425
+ const { runSkillsEvalCommand } = await import("./skills-eval-E2ZTW4PL.js");
426
+ return runSkillsEvalCommand(name, {
427
+ json: parsed.json,
428
+ trustFixtures: parsed.trustFixtures,
429
+ allowNetwork: parsed.allowNetwork,
430
+ ...parsed.scenario !== void 0 ? { scenario: parsed.scenario } : {},
431
+ ...parsed.target !== void 0 ? { target: parsed.target } : {},
432
+ ...parsed.workspace !== void 0 ? { workspace: parsed.workspace } : {},
433
+ ...parsed.timeoutSeconds !== void 0 ? { timeoutSeconds: parsed.timeoutSeconds } : {}
434
+ });
435
+ }
436
+ default:
437
+ printError(`unknown skills command: ${parsed.command}`);
438
+ process.stderr.write(HELP);
439
+ return 2;
440
+ }
441
+ }
442
+ export {
443
+ runSkillsCommand
444
+ };
445
+ //# sourceMappingURL=skills-F2MRLELY.js.map