@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,21 @@
1
+ import {
2
+ fleetPreflightVerdict,
3
+ readFleetPreflightRecords,
4
+ recordFleetPreflight,
5
+ routeFactVerdict,
6
+ runFleetNodePreflight
7
+ } from "./chunk-BBUH4VAA.js";
8
+ import "./chunk-GOTUR54M.js";
9
+ import "./chunk-UGYAX5YI.js";
10
+ import "./chunk-5N2FG33Q.js";
11
+ import "./chunk-VPAWTYLY.js";
12
+ import "./chunk-X3NE4WVW.js";
13
+ import "./chunk-DXQNI4PC.js";
14
+ export {
15
+ fleetPreflightVerdict,
16
+ readFleetPreflightRecords,
17
+ recordFleetPreflight,
18
+ routeFactVerdict,
19
+ runFleetNodePreflight
20
+ };
21
+ //# sourceMappingURL=fleet-preflight-CLIAX7YR.js.map
@@ -0,0 +1,227 @@
1
+ import {
2
+ CONTEXT_INIT_FLAG_TABLE,
3
+ bootstrapInputFromInitOptions,
4
+ modelBootstrapGenerate,
5
+ validateInitOptions
6
+ } from "./chunk-O4EJEDHO.js";
7
+ import "./chunk-4UQA7NCT.js";
8
+ import "./chunk-3DANZDGR.js";
9
+ import "./chunk-JPOWPFCU.js";
10
+ import "./chunk-527KG6XR.js";
11
+ import "./chunk-UU3R62TT.js";
12
+ import {
13
+ runBootstrap
14
+ } from "./chunk-UWIJNAOB.js";
15
+ import "./chunk-X3BR7HWV.js";
16
+ import "./chunk-VOO7NYPP.js";
17
+ import "./chunk-GNGDQYDU.js";
18
+ import "./chunk-2J63S4SF.js";
19
+ import "./chunk-RQDWMVRB.js";
20
+ import "./chunk-7BHLZB3A.js";
21
+ import "./chunk-TPOCL34A.js";
22
+ import "./chunk-E3NYWENM.js";
23
+ import "./chunk-XV4ZJ6ZM.js";
24
+ import "./chunk-26BZQOAD.js";
25
+ import "./chunk-WD6AJM35.js";
26
+ import "./chunk-QV47YRF4.js";
27
+ import "./chunk-CLJ5HLUD.js";
28
+ import "./chunk-BBUH4VAA.js";
29
+ import "./chunk-GOTUR54M.js";
30
+ import "./chunk-KBR4MZZR.js";
31
+ import {
32
+ VALID_THINKING_LEVELS
33
+ } from "./chunk-TKHQ4DGZ.js";
34
+ import "./chunk-D5YD55AR.js";
35
+ import "./chunk-JWHCJDCI.js";
36
+ import "./chunk-UHTSULZS.js";
37
+ import "./chunk-5LDRNKX2.js";
38
+ import "./chunk-UGYAX5YI.js";
39
+ import "./chunk-5N2FG33Q.js";
40
+ import "./chunk-VPAWTYLY.js";
41
+ import "./chunk-X3NE4WVW.js";
42
+ import "./chunk-DXQNI4PC.js";
43
+
44
+ // src/cli/init.ts
45
+ import { stdin as input, stdout as output } from "node:process";
46
+ import { createInterface } from "node:readline/promises";
47
+ var HELP = `Usage:
48
+ clio-coder context init [--preview] [--heuristic] [--yes] [--json] [--adopt] [--global] [--propose|--apply|--rewrite]
49
+ [--target <id> [--model <id>] [--thinking <level>]]
50
+
51
+ Explore the repository and bootstrap the project context in one pass: CLIO-CODER.md,
52
+ the codewiki index, and the .clio-coder state. The configured Clio
53
+ target drafts CLIO-CODER.md grounded in the existing handbook, codewiki structure, and
54
+ sibling agent context. Existing CLIO-CODER.md files are preserved by default; use
55
+ --propose for an ignored draft, --apply to update the handbook using it as source,
56
+ or --rewrite to replace it with a fresh draft that ignores the current CLIO-CODER.md.
57
+
58
+ Options:
59
+ --preview show the plan without writing any files
60
+ --heuristic skip model exploration; use the deterministic generator (offline)
61
+ --adopt refresh only the managed Imported agent context section
62
+ --global include global sibling agent context from user home directory
63
+ --propose write an ignored .clio-coder/proposals/CLIO-CODER-*.md draft when CLIO-CODER.md exists
64
+ --apply replace an existing CLIO-CODER.md with a draft grounded in the existing handbook
65
+ --rewrite replace an existing CLIO-CODER.md with a fresh draft that ignores it as source
66
+ --json emit one machine-readable result object on stdout
67
+ --yes, -y update .gitignore without prompting
68
+ --target <id> override the configured Scout target for this noninteractive run
69
+ --model <id> override the Scout wire model (requires --target)
70
+ --thinking <n> override Scout thinking: ${VALID_THINKING_LEVELS.join("|")} (requires --target)
71
+ `;
72
+ function hasFlag(args, name) {
73
+ return args.includes(name);
74
+ }
75
+ function parseContextInitArgs(args) {
76
+ const options = {};
77
+ let json = false;
78
+ let target;
79
+ let model;
80
+ let thinkingLevel;
81
+ const thinkingLevels = new Set(VALID_THINKING_LEVELS);
82
+ for (let index = 0; index < args.length; index += 1) {
83
+ const arg = args[index];
84
+ if (arg === "--help" || arg === "-h" || arg === "--yes" || arg === "-y") continue;
85
+ if (arg === "--json") {
86
+ json = true;
87
+ continue;
88
+ }
89
+ if (arg === "--target" || arg === "--model" || arg === "--thinking") {
90
+ const value = args[index + 1];
91
+ if (!value || value.startsWith("-")) return { options, json, error: `${arg} requires a value` };
92
+ index += 1;
93
+ if (arg === "--target") target = value;
94
+ else if (arg === "--model") model = value;
95
+ else {
96
+ if (!thinkingLevels.has(value)) {
97
+ return { options, json, error: `--thinking must be one of: ${[...thinkingLevels].join("|")}` };
98
+ }
99
+ thinkingLevel = value;
100
+ }
101
+ continue;
102
+ }
103
+ const row = CONTEXT_INIT_FLAG_TABLE.find((candidate) => candidate.flag === arg || candidate.aliases?.includes(arg));
104
+ if (!row) {
105
+ return { options, json, error: arg.startsWith("-") ? `unknown flag ${arg}` : `unexpected argument ${arg}` };
106
+ }
107
+ options[row.field] = true;
108
+ }
109
+ if (!target && (model || thinkingLevel)) {
110
+ return { options, json, error: "--model and --thinking require --target" };
111
+ }
112
+ return {
113
+ options,
114
+ json,
115
+ ...target ? { target } : {},
116
+ ...model ? { model } : {},
117
+ ...thinkingLevel ? { thinkingLevel } : {},
118
+ error: null
119
+ };
120
+ }
121
+ async function confirmGitignore(assumeYes) {
122
+ if (assumeYes) return true;
123
+ if (!input.isTTY) return false;
124
+ const rl = createInterface({ input, output });
125
+ try {
126
+ const answer = await rl.question("Update .gitignore for Clio context artifacts? [y/N] ");
127
+ return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
128
+ } finally {
129
+ rl.close();
130
+ }
131
+ }
132
+ async function runInitCommand(args) {
133
+ if (hasFlag(args, "--help") || hasFlag(args, "-h")) {
134
+ process.stdout.write(HELP);
135
+ return 0;
136
+ }
137
+ const assumeYes = hasFlag(args, "--yes") || hasFlag(args, "-y");
138
+ const parsed = parseContextInitArgs(args);
139
+ if (parsed.error) {
140
+ process.stderr.write(`clio-coder context init: ${parsed.error}
141
+ `);
142
+ process.stdout.write(HELP);
143
+ return 2;
144
+ }
145
+ const validationError = validateInitOptions(parsed.options);
146
+ if (validationError) {
147
+ process.stderr.write(`${validationError}
148
+ `);
149
+ process.stdout.write(HELP);
150
+ return 2;
151
+ }
152
+ const bootstrapOptions = bootstrapInputFromInitOptions(parsed.options);
153
+ const useModel = parsed.options.heuristic !== true && parsed.options.preview !== true;
154
+ const startedAt = performance.now();
155
+ const phaseTimings = /* @__PURE__ */ new Map();
156
+ try {
157
+ const result = await runBootstrap({
158
+ cwd: process.cwd(),
159
+ io: {
160
+ stdout: (s) => {
161
+ if (!parsed.json) process.stdout.write(s);
162
+ },
163
+ stderr: (s) => process.stderr.write(s)
164
+ },
165
+ onProgress: (event) => {
166
+ const now = performance.now();
167
+ const timing = phaseTimings.get(event.phase);
168
+ if (event.status === "started") phaseTimings.set(event.phase, { startedAt: now });
169
+ else if (event.status === "completed" && timing) timing.completedMs = Math.max(0, now - timing.startedAt);
170
+ },
171
+ confirmGitignore: () => confirmGitignore(assumeYes),
172
+ ...bootstrapOptions,
173
+ ...useModel ? {
174
+ generate: modelBootstrapGenerate({
175
+ ...parsed.target ? {
176
+ route: {
177
+ target: parsed.target,
178
+ ...parsed.model ? { model: parsed.model } : {},
179
+ ...parsed.thinkingLevel ? { thinkingLevel: parsed.thinkingLevel } : {}
180
+ }
181
+ } : {},
182
+ onFallback: (err, mode) => process.stderr.write(
183
+ `clio-coder context init: model exploration unavailable, using ${mode === "existing" ? "existing CLIO-CODER.md" : "heuristic"} (${err.message})
184
+ `
185
+ )
186
+ }),
187
+ modelId: "configured-clio-target"
188
+ } : {}
189
+ });
190
+ if (parsed.json) {
191
+ process.stdout.write(
192
+ `${JSON.stringify({
193
+ version: 1,
194
+ action: result.summary.action,
195
+ projectType: result.projectType,
196
+ codewikiEntries: result.summary.codewikiEntries,
197
+ clioMdPath: result.clioMdPath,
198
+ statePath: result.statePath,
199
+ preload: result.preload,
200
+ adoption: result.summary.adoption,
201
+ generation: result.telemetry.generation,
202
+ timings: {
203
+ wallMs: Math.max(0, performance.now() - startedAt),
204
+ ...phaseTimings.get("codewiki")?.completedMs !== void 0 ? { codewikiMs: phaseTimings.get("codewiki")?.completedMs } : {},
205
+ ...phaseTimings.get("generate")?.completedMs !== void 0 ? { generationMs: phaseTimings.get("generate")?.completedMs } : {}
206
+ }
207
+ })}
208
+ `
209
+ );
210
+ }
211
+ if (parsed.options.rewriteClioMd === true && result.telemetry.generation.mode === "existing") {
212
+ process.stderr.write(
213
+ "clio-coder context init: --rewrite did not rewrite CLIO-CODER.md; the model draft failed and the fallback rebuilt the handbook from the existing file.\n rerun `clio-coder context init --rewrite` once the bootstrap target answers, or `clio-coder context init --rewrite --heuristic` to replace it with the deterministic draft.\n"
214
+ );
215
+ return 1;
216
+ }
217
+ return 0;
218
+ } catch (err) {
219
+ process.stderr.write(`clio-coder context init failed: ${err instanceof Error ? err.message : String(err)}
220
+ `);
221
+ return 1;
222
+ }
223
+ }
224
+ export {
225
+ runInitCommand
226
+ };
227
+ //# sourceMappingURL=init-2OZDJE2D.js.map
@@ -0,0 +1,207 @@
1
+ import {
2
+ approveMemoryRecord,
3
+ loadMemoryRecords,
4
+ memoryStatus,
5
+ proposeMemoryFromEvidence,
6
+ pruneStaleMemory,
7
+ rejectMemoryRecord
8
+ } from "./chunk-VOO7NYPP.js";
9
+ import "./chunk-GNGDQYDU.js";
10
+ import "./chunk-2J63S4SF.js";
11
+ import "./chunk-RQDWMVRB.js";
12
+ import "./chunk-7BHLZB3A.js";
13
+ import "./chunk-TPOCL34A.js";
14
+ import "./chunk-E3NYWENM.js";
15
+ import "./chunk-XV4ZJ6ZM.js";
16
+ import "./chunk-26BZQOAD.js";
17
+ import "./chunk-WD6AJM35.js";
18
+ import "./chunk-QV47YRF4.js";
19
+ import "./chunk-CLJ5HLUD.js";
20
+ import "./chunk-BBUH4VAA.js";
21
+ import "./chunk-GOTUR54M.js";
22
+ import "./chunk-PIDUD6M2.js";
23
+ import {
24
+ printError,
25
+ printOk
26
+ } from "./chunk-67MTHP2E.js";
27
+ import "./chunk-TKHQ4DGZ.js";
28
+ import "./chunk-D5YD55AR.js";
29
+ import "./chunk-JWHCJDCI.js";
30
+ import "./chunk-UHTSULZS.js";
31
+ import "./chunk-5LDRNKX2.js";
32
+ import "./chunk-UGYAX5YI.js";
33
+ import "./chunk-5N2FG33Q.js";
34
+ import "./chunk-VPAWTYLY.js";
35
+ import {
36
+ clioDataDir
37
+ } from "./chunk-X3NE4WVW.js";
38
+ import "./chunk-DXQNI4PC.js";
39
+
40
+ // src/cli/memory.ts
41
+ var HELP = `clio-coder memory list
42
+ clio-coder memory propose --from-evidence <evidenceId>
43
+ clio-coder memory approve <memoryId>
44
+ clio-coder memory reject <memoryId>
45
+ clio-coder memory prune --stale
46
+
47
+ Manage scoped, approved, evidence-linked local memory records.
48
+ `;
49
+ function parseMemoryArgs(args) {
50
+ const parsed = { stale: false, help: false };
51
+ for (let index = 0; index < args.length; index += 1) {
52
+ const arg = args[index];
53
+ if (arg === void 0) continue;
54
+ if (arg === "--help" || arg === "-h") {
55
+ parsed.help = true;
56
+ continue;
57
+ }
58
+ if (parsed.command === void 0) {
59
+ if (arg === "list" || arg === "propose" || arg === "approve" || arg === "reject" || arg === "prune") {
60
+ parsed.command = arg;
61
+ continue;
62
+ }
63
+ throw new Error(`unknown memory command: ${arg}`);
64
+ }
65
+ if (parsed.command === "propose") {
66
+ if (arg === "--from-evidence") {
67
+ const value = args[index + 1];
68
+ if (value === void 0 || value.startsWith("-")) throw new Error("--from-evidence requires an evidence id");
69
+ parsed.evidenceId = value;
70
+ index += 1;
71
+ continue;
72
+ }
73
+ throw new Error(`unknown memory propose argument: ${arg}`);
74
+ }
75
+ if (parsed.command === "approve" || parsed.command === "reject") {
76
+ if (parsed.memoryId === void 0 && !arg.startsWith("-")) {
77
+ parsed.memoryId = arg;
78
+ continue;
79
+ }
80
+ throw new Error(`unexpected memory ${parsed.command} argument: ${arg}`);
81
+ }
82
+ if (parsed.command === "prune") {
83
+ if (arg === "--stale") {
84
+ parsed.stale = true;
85
+ continue;
86
+ }
87
+ throw new Error(`unknown memory prune argument: ${arg}`);
88
+ }
89
+ throw new Error(`unexpected memory argument: ${arg}`);
90
+ }
91
+ if (parsed.help) return parsed;
92
+ if (parsed.command === void 0) throw new Error("memory requires list, propose, approve, reject, or prune");
93
+ if (parsed.command === "propose" && parsed.evidenceId === void 0) {
94
+ throw new Error("propose requires --from-evidence <evidenceId>");
95
+ }
96
+ if ((parsed.command === "approve" || parsed.command === "reject") && parsed.memoryId === void 0) {
97
+ throw new Error(`${parsed.command} requires a memory id`);
98
+ }
99
+ if (parsed.command === "prune" && !parsed.stale) throw new Error("prune requires --stale");
100
+ if (parsed.command === "list" && (parsed.evidenceId !== void 0 || parsed.memoryId !== void 0 || parsed.stale)) {
101
+ throw new Error("list does not accept extra arguments");
102
+ }
103
+ return parsed;
104
+ }
105
+ async function runMemoryCommand(args) {
106
+ let parsed;
107
+ try {
108
+ parsed = parseMemoryArgs(args);
109
+ } catch (error) {
110
+ printError(error instanceof Error ? error.message : String(error));
111
+ process.stdout.write(HELP);
112
+ return 2;
113
+ }
114
+ if (parsed.help) {
115
+ process.stdout.write(HELP);
116
+ return 0;
117
+ }
118
+ const dataDir = clioDataDir();
119
+ try {
120
+ if (parsed.command === "list") {
121
+ renderMemoryList(await loadMemoryRecords(dataDir));
122
+ return 0;
123
+ }
124
+ if (parsed.command === "propose") {
125
+ const evidenceId = parsed.evidenceId;
126
+ if (evidenceId === void 0) {
127
+ printError("propose requires --from-evidence <evidenceId>");
128
+ return 2;
129
+ }
130
+ const result = await proposeMemoryFromEvidence(dataDir, evidenceId);
131
+ renderProposal(result.record, result.created);
132
+ return 0;
133
+ }
134
+ if (parsed.command === "approve") {
135
+ const memoryId = parsed.memoryId;
136
+ if (memoryId === void 0) {
137
+ printError("approve requires a memory id");
138
+ return 2;
139
+ }
140
+ const record = await approveMemoryRecord(dataDir, memoryId);
141
+ printOk(`approved ${record.id}`);
142
+ return 0;
143
+ }
144
+ if (parsed.command === "reject") {
145
+ const memoryId = parsed.memoryId;
146
+ if (memoryId === void 0) {
147
+ printError("reject requires a memory id");
148
+ return 2;
149
+ }
150
+ const record = await rejectMemoryRecord(dataDir, memoryId);
151
+ printOk(`rejected ${record.id}`);
152
+ return 0;
153
+ }
154
+ if (parsed.command === "prune") {
155
+ const pruned = await pruneStaleMemory(dataDir);
156
+ printOk(`pruned ${pruned.length} stale memory record${pruned.length === 1 ? "" : "s"}`);
157
+ return 0;
158
+ }
159
+ printError("memory requires list, propose, approve, reject, or prune");
160
+ return 2;
161
+ } catch (error) {
162
+ printError(error instanceof Error ? error.message : String(error));
163
+ return 1;
164
+ }
165
+ }
166
+ function renderProposal(record, created) {
167
+ process.stdout.write(`memory: ${record.id}
168
+ `);
169
+ process.stdout.write(`status: ${created ? "proposed" : memoryStatus(record)}
170
+ `);
171
+ process.stdout.write(`scope: ${record.scope}
172
+ `);
173
+ process.stdout.write(`key: ${record.key}
174
+ `);
175
+ process.stdout.write(`evidence: ${record.evidenceRefs.join(", ")}
176
+ `);
177
+ process.stdout.write(`confidence: ${record.confidence.toFixed(2)}
178
+ `);
179
+ process.stdout.write(`lesson: ${record.lesson}
180
+ `);
181
+ }
182
+ function renderMemoryList(records) {
183
+ process.stdout.write(`${records.length} memory record${records.length === 1 ? "" : "s"}
184
+ `);
185
+ if (records.length === 0) return;
186
+ process.stdout.write("\n");
187
+ for (const record of records) {
188
+ process.stdout.write(
189
+ [
190
+ record.id.padEnd(21),
191
+ memoryStatus(record).padEnd(10),
192
+ record.scope.padEnd(13),
193
+ `confidence=${record.confidence.toFixed(2)}`.padEnd(16),
194
+ `evidence=${record.evidenceRefs.join(",")}`
195
+ ].join("")
196
+ );
197
+ process.stdout.write("\n");
198
+ process.stdout.write(` key: ${record.key}
199
+ `);
200
+ process.stdout.write(` lesson: ${record.lesson}
201
+ `);
202
+ }
203
+ }
204
+ export {
205
+ runMemoryCommand
206
+ };
207
+ //# sourceMappingURL=memory-3PIQQAKX.js.map
@@ -0,0 +1,237 @@
1
+ import "./chunk-NI4DEJMC.js";
2
+ import {
3
+ ensureClioState
4
+ } from "./chunk-7RBKDI66.js";
5
+ import {
6
+ ConfigDomainModule,
7
+ loadDomains
8
+ } from "./chunk-527KG6XR.js";
9
+ import "./chunk-UU3R62TT.js";
10
+ import "./chunk-HMYNFFY4.js";
11
+ import "./chunk-262G75JS.js";
12
+ import "./chunk-TFSSEXL6.js";
13
+ import "./chunk-PIDUD6M2.js";
14
+ import {
15
+ printError
16
+ } from "./chunk-67MTHP2E.js";
17
+ import {
18
+ ProvidersDomainModule,
19
+ modelCandidatesForStatus,
20
+ resolveModelCapabilities
21
+ } from "./chunk-TKHQ4DGZ.js";
22
+ import "./chunk-D5YD55AR.js";
23
+ import "./chunk-JWHCJDCI.js";
24
+ import "./chunk-UHTSULZS.js";
25
+ import "./chunk-5LDRNKX2.js";
26
+ import "./chunk-UGYAX5YI.js";
27
+ import "./chunk-5N2FG33Q.js";
28
+ import "./chunk-VPAWTYLY.js";
29
+ import "./chunk-X3NE4WVW.js";
30
+ import "./chunk-DXQNI4PC.js";
31
+
32
+ // src/cli/models.ts
33
+ import chalk from "chalk";
34
+ var HELP = `clio-coder models [search] [--target <id>] [--json] [--offline]
35
+
36
+ List live-discovered models for configured targets.
37
+
38
+ Options:
39
+ --offline use cached/configured/catalog model hints without probing targets
40
+ `;
41
+ function parseModelArgs(args) {
42
+ const parsed = { json: false, offline: false, help: false };
43
+ for (let i = 0; i < args.length; i += 1) {
44
+ const arg = args[i];
45
+ if (arg === void 0) continue;
46
+ if (arg === "--help" || arg === "-h") {
47
+ parsed.help = true;
48
+ continue;
49
+ }
50
+ if (arg === "--json") {
51
+ parsed.json = true;
52
+ continue;
53
+ }
54
+ if (arg === "--offline") {
55
+ parsed.offline = true;
56
+ continue;
57
+ }
58
+ if (arg === "--target") {
59
+ const value = args[i + 1];
60
+ if (!value) throw new Error("--target requires a value");
61
+ parsed.target = value;
62
+ i += 1;
63
+ continue;
64
+ }
65
+ if (arg?.startsWith("-")) throw new Error(`unknown flag: ${arg}`);
66
+ if (parsed.search) throw new Error("models accepts at most one search term");
67
+ parsed.search = arg;
68
+ }
69
+ return parsed;
70
+ }
71
+ async function runModelsCommand(args) {
72
+ let parsed;
73
+ try {
74
+ parsed = parseModelArgs(args);
75
+ } catch (error) {
76
+ printError(error instanceof Error ? error.message : String(error));
77
+ process.stderr.write(HELP);
78
+ return 2;
79
+ }
80
+ if (parsed.help) {
81
+ process.stdout.write(HELP);
82
+ return 0;
83
+ }
84
+ ensureClioState();
85
+ const loaded = await loadDomains([ConfigDomainModule, ProvidersDomainModule]);
86
+ const providers = loaded.getContract("providers");
87
+ if (!providers) {
88
+ process.stderr.write("models: provider domain not loaded\n");
89
+ await loaded.stop();
90
+ return 1;
91
+ }
92
+ if (!parsed.offline) {
93
+ try {
94
+ await providers.probeAllLive();
95
+ } catch (err) {
96
+ process.stderr.write(`models: live probe failed: ${err instanceof Error ? err.message : String(err)}
97
+ `);
98
+ }
99
+ }
100
+ const entries = providers.list();
101
+ if (parsed.target !== void 0 && !entries.some((e) => e.target.id === parsed.target)) {
102
+ printError(`no target with id ${parsed.target}. ${targetCount(entries.length)} configured.`);
103
+ await loaded.stop();
104
+ return 2;
105
+ }
106
+ const filtered = parsed.target ? entries.filter((e) => e.target.id === parsed.target) : entries;
107
+ const rows = collectRows(filtered, providers).filter((row) => matchesSearch(row, parsed.search));
108
+ if (parsed.json) {
109
+ process.stdout.write(`${JSON.stringify(rows, null, 2)}
110
+ `);
111
+ } else if (rows.length === 0) {
112
+ process.stdout.write(`${emptyModelsMessage(parsed, entries.length, filtered.length)}
113
+ `);
114
+ } else {
115
+ renderRows(rows);
116
+ }
117
+ await loaded.stop();
118
+ return 0;
119
+ }
120
+ function collectRows(entries, providers) {
121
+ const rows = [];
122
+ for (const status of entries) {
123
+ const runtimeId = status.runtime?.id ?? status.target.runtime;
124
+ const candidates = modelCandidatesForStatus(status);
125
+ if (candidates.length === 0) {
126
+ const caps = resolveRowCapabilities(status, status.target.defaultModel ?? null, providers);
127
+ rows.push({
128
+ targetId: status.target.id,
129
+ runtimeId,
130
+ modelId: "(no models)",
131
+ state: "-",
132
+ ...formatCapabilities(caps)
133
+ });
134
+ continue;
135
+ }
136
+ for (const candidate of candidates) {
137
+ const modelId = candidate.id;
138
+ const caps = resolveRowCapabilities(status, modelId, providers);
139
+ rows.push({
140
+ targetId: status.target.id,
141
+ runtimeId,
142
+ modelId,
143
+ state: candidate.loadState ?? "-",
144
+ ...formatCapabilities(caps)
145
+ });
146
+ }
147
+ }
148
+ return rows;
149
+ }
150
+ function resolveRowCapabilities(status, modelId, providers) {
151
+ return resolveModelCapabilities(status, modelId, providers.knowledgeBase, {
152
+ detectedReasoning: modelId ? providers.getDetectedReasoning(status.target.id, modelId) : null
153
+ });
154
+ }
155
+ function formatCapabilities(c) {
156
+ return {
157
+ caps: capabilityBadges(c),
158
+ contextWindow: c.contextWindow,
159
+ maxTokens: c.maxTokens,
160
+ reasoning: c.reasoning
161
+ };
162
+ }
163
+ function capabilityBadges(c) {
164
+ const badge = (on, letter) => on ? letter : "-";
165
+ return [
166
+ badge(c.chat, "C"),
167
+ badge(c.tools, "T"),
168
+ badge(c.reasoning, "R"),
169
+ badge(c.vision, "V"),
170
+ badge(c.embeddings, "E"),
171
+ badge(c.rerank, "K"),
172
+ badge(c.fim, "F")
173
+ ].join("");
174
+ }
175
+ function compactTokenCount(value) {
176
+ if (!Number.isFinite(value) || value <= 0) return "-";
177
+ if (value >= 1e6) {
178
+ const rounded = value / 1e6;
179
+ return `${Number.isInteger(rounded) ? rounded.toFixed(0) : rounded.toFixed(1)}m`;
180
+ }
181
+ if (value >= 1e3) return `${Math.round(value / 1e3)}k`;
182
+ return String(value);
183
+ }
184
+ function emptyModelsMessage(args, configuredTargets, matchedTargets) {
185
+ if (configuredTargets === 0) {
186
+ return "no targets configured. run `clio-coder configure` or `clio-coder targets add` to register one.";
187
+ }
188
+ if (args.target !== void 0 && matchedTargets === 0) {
189
+ return `no target with id ${args.target}. ${targetCount(configuredTargets)} configured.`;
190
+ }
191
+ if (args.search !== void 0) {
192
+ return `no models matched "${args.search}" across ${targetCount(matchedTargets)}.`;
193
+ }
194
+ return `no models found across ${targetCount(matchedTargets)}.`;
195
+ }
196
+ function targetCount(n) {
197
+ return `${n} target${n === 1 ? "" : "s"}`;
198
+ }
199
+ var MODEL_ID_WIDTH_CAP = 56;
200
+ var COLUMN_GAP = " ";
201
+ function truncateModelId(id) {
202
+ if (id.length <= MODEL_ID_WIDTH_CAP) return id;
203
+ return `${id.slice(0, MODEL_ID_WIDTH_CAP - 3)}...`;
204
+ }
205
+ function modelTableLines(rows) {
206
+ const includeState = rows.some((row) => row.state && row.state !== "-");
207
+ const headers = includeState ? ["target", "runtime", "model", "state", "caps", "ctx", "max"] : ["target", "runtime", "model", "caps", "ctx", "max"];
208
+ const cells = rows.map((row) => {
209
+ const base = [row.targetId, row.runtimeId, truncateModelId(row.modelId)];
210
+ if (includeState) base.push(row.state || "-");
211
+ base.push(row.caps, compactTokenCount(row.contextWindow), compactTokenCount(row.maxTokens));
212
+ return base;
213
+ });
214
+ const widths = headers.map((h, col) => Math.max(h.length, ...cells.map((cell) => cell[col]?.length ?? 0)));
215
+ const formatLine = (values) => values.map((value, col) => value.padEnd(widths[col] ?? 0)).join(COLUMN_GAP).trimEnd();
216
+ return [formatLine(headers), ...cells.map(formatLine)];
217
+ }
218
+ function renderRows(rows) {
219
+ const [header, ...body] = modelTableLines(rows);
220
+ process.stdout.write(`${chalk.bold(header ?? "")}
221
+ `);
222
+ for (const line of body) {
223
+ process.stdout.write(`${line}
224
+ `);
225
+ }
226
+ }
227
+ function matchesSearch(row, search) {
228
+ if (!search) return true;
229
+ const needle = search.toLowerCase();
230
+ return row.targetId.toLowerCase().includes(needle) || row.runtimeId.toLowerCase().includes(needle) || row.modelId.toLowerCase().includes(needle) || row.state.toLowerCase().includes(needle);
231
+ }
232
+ export {
233
+ emptyModelsMessage,
234
+ modelTableLines,
235
+ runModelsCommand
236
+ };
237
+ //# sourceMappingURL=models-DY35XI7Y.js.map