@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.
- package/CHANGELOG.md +407 -0
- package/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +224 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +798 -0
- package/SECURITY.md +72 -0
- package/assets/clio-coder-logo-128.webp +0 -0
- package/damage-control-rules.yaml +419 -0
- package/dist/acp-UMLFVA3F.js +92 -0
- package/dist/agents-Q4MYPMUW.js +91 -0
- package/dist/auth-O6HYIJ6J.js +521 -0
- package/dist/chunk-262G75JS.js +35 -0
- package/dist/chunk-26BZQOAD.js +1281 -0
- package/dist/chunk-2J63S4SF.js +508 -0
- package/dist/chunk-3DANZDGR.js +717 -0
- package/dist/chunk-4UQA7NCT.js +29 -0
- package/dist/chunk-527KG6XR.js +497 -0
- package/dist/chunk-5LDRNKX2.js +1063 -0
- package/dist/chunk-5N2FG33Q.js +25 -0
- package/dist/chunk-67MTHP2E.js +135 -0
- package/dist/chunk-6CWDTGUC.js +20 -0
- package/dist/chunk-7BHLZB3A.js +2115 -0
- package/dist/chunk-7RBKDI66.js +348 -0
- package/dist/chunk-AMFR5YA3.js +541 -0
- package/dist/chunk-BBUH4VAA.js +1224 -0
- package/dist/chunk-BYEU76JP.js +899 -0
- package/dist/chunk-CLJ5HLUD.js +458 -0
- package/dist/chunk-D5YD55AR.js +116 -0
- package/dist/chunk-DXQNI4PC.js +61 -0
- package/dist/chunk-E3NYWENM.js +1004 -0
- package/dist/chunk-GNGDQYDU.js +34688 -0
- package/dist/chunk-GOTUR54M.js +9 -0
- package/dist/chunk-HBU5MTAM.js +41 -0
- package/dist/chunk-HMYNFFY4.js +28 -0
- package/dist/chunk-JPOWPFCU.js +1010 -0
- package/dist/chunk-JWHCJDCI.js +1215 -0
- package/dist/chunk-KBR4MZZR.js +41 -0
- package/dist/chunk-KKKPTZLM.js +93 -0
- package/dist/chunk-ME6DNWIU.js +66 -0
- package/dist/chunk-NI4DEJMC.js +88 -0
- package/dist/chunk-O4EJEDHO.js +659 -0
- package/dist/chunk-PIDUD6M2.js +31 -0
- package/dist/chunk-PS4PFJQP.js +29459 -0
- package/dist/chunk-QV47YRF4.js +48 -0
- package/dist/chunk-RQDWMVRB.js +279 -0
- package/dist/chunk-TFSSEXL6.js +136 -0
- package/dist/chunk-TKHQ4DGZ.js +8290 -0
- package/dist/chunk-TPOCL34A.js +2876 -0
- package/dist/chunk-UGYAX5YI.js +565 -0
- package/dist/chunk-UHTSULZS.js +461 -0
- package/dist/chunk-UU3R62TT.js +128 -0
- package/dist/chunk-UWIJNAOB.js +3906 -0
- package/dist/chunk-VOO7NYPP.js +914 -0
- package/dist/chunk-VPAWTYLY.js +117 -0
- package/dist/chunk-WD6AJM35.js +1216 -0
- package/dist/chunk-X3BR7HWV.js +115 -0
- package/dist/chunk-X3NE4WVW.js +120 -0
- package/dist/chunk-XNISANGE.js +1395 -0
- package/dist/chunk-XV4ZJ6ZM.js +3177 -0
- package/dist/cli/index.js +236 -0
- package/dist/clio-KIQ5SNDS.js +53 -0
- package/dist/components-JVHMUBEB.js +653 -0
- package/dist/config-ZFCDBMDC.js +372 -0
- package/dist/configure-G4E3A2PG.js +27 -0
- package/dist/context-CDXTP2MP.js +293 -0
- package/dist/context-E3KIFVXI.js +185 -0
- package/dist/context-clear-3F4PLXOS.js +102 -0
- package/dist/context-index-Q7YSYTR3.js +106 -0
- package/dist/docs-YIETIWZI.js +280 -0
- package/dist/doctor-M5HJJZOL.js +61 -0
- package/dist/domains/agents/builtins/architect.md +33 -0
- package/dist/domains/agents/builtins/coder.md +31 -0
- package/dist/domains/agents/builtins/context-bootstrap.md +38 -0
- package/dist/domains/agents/builtins/debugger.md +30 -0
- package/dist/domains/agents/builtins/documenter.md +31 -0
- package/dist/domains/agents/builtins/git-master.md +30 -0
- package/dist/domains/agents/builtins/provenance.md +30 -0
- package/dist/domains/agents/builtins/researcher.md +71 -0
- package/dist/domains/agents/builtins/scout.md +42 -0
- package/dist/domains/agents/builtins/tester.md +31 -0
- package/dist/domains/agents/builtins/verifier.md +30 -0
- package/dist/domains/agents/builtins/wiki-writer.md +41 -0
- package/dist/eval-B3KZZESM.js +2674 -0
- package/dist/evidence-V67CHM35.js +233 -0
- package/dist/evolve-YDZSUQYA.js +518 -0
- package/dist/extensions-SRG7XCAH.js +207 -0
- package/dist/fleet-CA2CRTVG.js +760 -0
- package/dist/fleet-preflight-CLIAX7YR.js +21 -0
- package/dist/init-2OZDJE2D.js +227 -0
- package/dist/memory-3PIQQAKX.js +207 -0
- package/dist/models-DY35XI7Y.js +237 -0
- package/dist/paths-5OMXW7Z4.js +57 -0
- package/dist/preload-KZVHET2B.js +11 -0
- package/dist/reset-PIFYNOS3.js +216 -0
- package/dist/run-3VSPP24F.js +735 -0
- package/dist/share-D36RQCXM.js +241 -0
- package/dist/skills-F2MRLELY.js +445 -0
- package/dist/skills-eval-E2ZTW4PL.js +932 -0
- package/dist/targets-DZMEZAH4.js +977 -0
- package/dist/trace-7NYCUI2J.js +250 -0
- package/dist/uninstall-AD3JWHBB.js +322 -0
- package/dist/upgrade-WYYBKGDY.js +301 -0
- package/dist/usage-ULIDAGFF.js +755 -0
- package/dist/version-ROZ6CZKH.js +16 -0
- package/dist/wiki-generate-PKFIX6OB.js +377 -0
- package/dist/worker/entry.js +1739 -0
- package/docs/README.md +93 -0
- package/docs/acp.md +120 -0
- package/docs/alcf-provider.md +72 -0
- package/docs/architecture.md +172 -0
- package/docs/artifact-versions.md +54 -0
- package/docs/built-in-agents.md +265 -0
- package/docs/capacity-and-scheduling.md +97 -0
- package/docs/commands-and-modes.md +554 -0
- package/docs/config-knobs-audit.md +115 -0
- package/docs/configuration-and-targets.md +812 -0
- package/docs/context-engine.md +236 -0
- package/docs/dispatch-architecture-rationale.md +126 -0
- package/docs/documentation-coverage.md +46 -0
- package/docs/documentation-guide.md +166 -0
- package/docs/environment-variables.md +105 -0
- package/docs/eval-runner.md +205 -0
- package/docs/evals-internal.md +298 -0
- package/docs/evidence-and-memory.md +243 -0
- package/docs/evolution.md +143 -0
- package/docs/exit-codes-and-output.md +74 -0
- package/docs/extensions-and-sharing.md +306 -0
- package/docs/fleet-demo-runbook.md +179 -0
- package/docs/fleet-dispatch.md +591 -0
- package/docs/glossary.md +75 -0
- package/docs/html/agents_blueprint.html +936 -0
- package/docs/html/alcf_blueprint.html +324 -0
- package/docs/html/architecture_blueprint.html +850 -0
- package/docs/html/commands_blueprint.html +794 -0
- package/docs/html/config_knobs_audit_blueprint.html +178 -0
- package/docs/html/configuration_blueprint.html +1080 -0
- package/docs/html/context_blueprint.html +603 -0
- package/docs/html/documentation_blueprint.html +832 -0
- package/docs/html/environment_blueprint.html +404 -0
- package/docs/html/eval_blueprint.html +743 -0
- package/docs/html/evals_internal_blueprint.html +190 -0
- package/docs/html/evolution_blueprint.html +674 -0
- package/docs/html/extensions_blueprint.html +2065 -0
- package/docs/html/fleet_dispatch_blueprint.html +286 -0
- package/docs/html/index.html +919 -0
- package/docs/html/lifecycle_blueprint.html +723 -0
- package/docs/html/memory_blueprint.html +699 -0
- package/docs/html/middleware_blueprint.html +664 -0
- package/docs/html/models_blueprint.html +2366 -0
- package/docs/html/observability_blueprint.html +683 -0
- package/docs/html/provider_adapter_blueprint.html +245 -0
- package/docs/html/safety_blueprint.html +1386 -0
- package/docs/html/shared.css +571 -0
- package/docs/html/shared.js +143 -0
- package/docs/html/skills_blueprint.html +671 -0
- package/docs/html/soak_blueprint.html +182 -0
- package/docs/html/tool_usage_blueprint.html +350 -0
- package/docs/html/tools_blueprint.html +2249 -0
- package/docs/html/trace_blueprint.html +235 -0
- package/docs/html/tui_design_blueprint.html +314 -0
- package/docs/html/validation_blueprint.html +961 -0
- package/docs/html/worker_dispatch_blueprint.html +231 -0
- package/docs/installation-and-lifecycle.md +308 -0
- package/docs/middleware-and-components.md +148 -0
- package/docs/model-catalog.md +189 -0
- package/docs/observability.md +233 -0
- package/docs/proactive-memory.md +452 -0
- package/docs/prompt-envelope-and-tools.md +142 -0
- package/docs/provider-adapter-cookbook.md +148 -0
- package/docs/release-cut-checklist.md +138 -0
- package/docs/safety-model.md +357 -0
- package/docs/scientific-validation.md +105 -0
- package/docs/session-lifecycle.md +156 -0
- package/docs/skills-marketplace.md +46 -0
- package/docs/tool-usage.md +527 -0
- package/docs/trace-store.md +132 -0
- package/docs/troubleshooting.md +33 -0
- package/docs/tui-design.md +239 -0
- package/docs/worker-dispatch-mechanics.md +242 -0
- package/package.json +132 -0
- package/skills/README.md +408 -0
- package/skills/git/commit-crafting/SKILL.md +79 -0
- package/skills/git/commit-crafting/evals.md +92 -0
- package/skills/git/create-pr/SKILL.md +116 -0
- package/skills/git/create-pr/evals.md +114 -0
- package/skills/git/investigate-issue/SKILL.md +139 -0
- package/skills/git/investigate-issue/evals.md +94 -0
- package/skills/git/resolve-merge-conflicts/SKILL.md +96 -0
- package/skills/git/resolve-merge-conflicts/evals.md +58 -0
- package/skills/git/review-changes/SKILL.md +103 -0
- package/skills/git/review-changes/evals.md +85 -0
- package/skills/git/worktree-create/SKILL.md +92 -0
- package/skills/git/worktree-create/evals.md +97 -0
- package/skills/git/worktree-create/references/worktree-setup.md +66 -0
- package/skills/git/worktree-merge/SKILL.md +95 -0
- package/skills/git/worktree-merge/evals.md +114 -0
- package/skills/skill-marketplace.json +261 -0
- package/skills/workflow/cut-it/SKILL.md +86 -0
- package/skills/workflow/cut-it/evals.md +42 -0
- package/src/domains/agents/builtins/architect.md +33 -0
- package/src/domains/agents/builtins/coder.md +31 -0
- package/src/domains/agents/builtins/context-bootstrap.md +38 -0
- package/src/domains/agents/builtins/debugger.md +30 -0
- package/src/domains/agents/builtins/documenter.md +31 -0
- package/src/domains/agents/builtins/git-master.md +30 -0
- package/src/domains/agents/builtins/provenance.md +30 -0
- package/src/domains/agents/builtins/researcher.md +71 -0
- package/src/domains/agents/builtins/scout.md +42 -0
- package/src/domains/agents/builtins/tester.md +31 -0
- package/src/domains/agents/builtins/verifier.md +30 -0
- package/src/domains/agents/builtins/wiki-writer.md +41 -0
- package/src/domains/agents/fleets/build-review.md +34 -0
- package/src/domains/agents/fleets/build-test.md +35 -0
- package/src/domains/agents/fleets/sdlc.md +86 -0
- package/src/domains/prompts/fragments/identity/clio-worker.md +11 -0
- package/src/domains/prompts/fragments/identity/clio.md +26 -0
- package/src/domains/prompts/fragments/operating/contract.md +64 -0
- package/src/domains/prompts/fragments/safety/auto-edit.md +14 -0
- package/src/domains/prompts/fragments/safety/full-auto.md +14 -0
- package/src/domains/prompts/fragments/safety/read-only.md +13 -0
- package/src/domains/prompts/fragments/safety/suggest.md +13 -0
- package/src/domains/prompts/fragments/wiki/page.md +75 -0
- package/src/domains/prompts/fragments/wiki/plan.md +48 -0
- package/src/domains/providers/models/cloud-models/alcf.yaml +40 -0
- package/src/domains/providers/models/local-models/clio-local-coding-targets.yaml +993 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readLayeredSettings,
|
|
3
|
+
settingsSourceFor
|
|
4
|
+
} from "./chunk-UU3R62TT.js";
|
|
5
|
+
import {
|
|
6
|
+
loadOperatorProfile,
|
|
7
|
+
loadProjectRules,
|
|
8
|
+
renderOperatorProfile,
|
|
9
|
+
renderPromptContext
|
|
10
|
+
} from "./chunk-UWIJNAOB.js";
|
|
11
|
+
import "./chunk-X3BR7HWV.js";
|
|
12
|
+
import {
|
|
13
|
+
loadMemoryRecordsSync,
|
|
14
|
+
memoryStorePath
|
|
15
|
+
} from "./chunk-VOO7NYPP.js";
|
|
16
|
+
import {
|
|
17
|
+
loadUserHooks,
|
|
18
|
+
readHookSources
|
|
19
|
+
} from "./chunk-GNGDQYDU.js";
|
|
20
|
+
import "./chunk-2J63S4SF.js";
|
|
21
|
+
import "./chunk-RQDWMVRB.js";
|
|
22
|
+
import "./chunk-7BHLZB3A.js";
|
|
23
|
+
import "./chunk-TPOCL34A.js";
|
|
24
|
+
import "./chunk-E3NYWENM.js";
|
|
25
|
+
import "./chunk-XV4ZJ6ZM.js";
|
|
26
|
+
import {
|
|
27
|
+
defaultScopedResourceRoots
|
|
28
|
+
} from "./chunk-26BZQOAD.js";
|
|
29
|
+
import "./chunk-WD6AJM35.js";
|
|
30
|
+
import "./chunk-QV47YRF4.js";
|
|
31
|
+
import {
|
|
32
|
+
listInstalledExtensions
|
|
33
|
+
} from "./chunk-CLJ5HLUD.js";
|
|
34
|
+
import "./chunk-BBUH4VAA.js";
|
|
35
|
+
import "./chunk-GOTUR54M.js";
|
|
36
|
+
import {
|
|
37
|
+
classifyProjectPreload
|
|
38
|
+
} from "./chunk-KBR4MZZR.js";
|
|
39
|
+
import "./chunk-PIDUD6M2.js";
|
|
40
|
+
import {
|
|
41
|
+
printError
|
|
42
|
+
} from "./chunk-67MTHP2E.js";
|
|
43
|
+
import {
|
|
44
|
+
ceilChars
|
|
45
|
+
} from "./chunk-TKHQ4DGZ.js";
|
|
46
|
+
import "./chunk-D5YD55AR.js";
|
|
47
|
+
import "./chunk-JWHCJDCI.js";
|
|
48
|
+
import "./chunk-UHTSULZS.js";
|
|
49
|
+
import "./chunk-5LDRNKX2.js";
|
|
50
|
+
import "./chunk-UGYAX5YI.js";
|
|
51
|
+
import "./chunk-5N2FG33Q.js";
|
|
52
|
+
import "./chunk-VPAWTYLY.js";
|
|
53
|
+
import {
|
|
54
|
+
clioDataDir
|
|
55
|
+
} from "./chunk-X3NE4WVW.js";
|
|
56
|
+
import "./chunk-DXQNI4PC.js";
|
|
57
|
+
|
|
58
|
+
// src/cli/config-inspect.ts
|
|
59
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
60
|
+
import { join } from "node:path";
|
|
61
|
+
function getByPath(root, dotted) {
|
|
62
|
+
let current = root;
|
|
63
|
+
for (const key of dotted.split(".")) {
|
|
64
|
+
if (current === null || typeof current !== "object") return void 0;
|
|
65
|
+
current = current[key];
|
|
66
|
+
}
|
|
67
|
+
return current;
|
|
68
|
+
}
|
|
69
|
+
function shortHash(text) {
|
|
70
|
+
let hash = 0;
|
|
71
|
+
for (let i = 0; i < text.length; i++) hash = hash * 31 + text.charCodeAt(i) | 0;
|
|
72
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
73
|
+
}
|
|
74
|
+
function inspectSettings(cwd, graph) {
|
|
75
|
+
try {
|
|
76
|
+
const layered = readLayeredSettings(cwd);
|
|
77
|
+
for (const issue of layered.issues) graph.issues.push(`settings ${issue.origin}: ${issue.path}: ${issue.message}`);
|
|
78
|
+
const keys = Object.keys(layered.sources).sort();
|
|
79
|
+
for (const key of keys) {
|
|
80
|
+
graph.settings.push({
|
|
81
|
+
key,
|
|
82
|
+
value: getByPath(layered.settings, key),
|
|
83
|
+
source: settingsSourceFor(layered.sources, key)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
} catch (err) {
|
|
87
|
+
graph.issues.push(`settings: ${err instanceof Error ? err.message : String(err)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function inspectClioMd(cwd, graph) {
|
|
91
|
+
const path = join(cwd, "CLIO-CODER.md");
|
|
92
|
+
if (!existsSync(path)) return;
|
|
93
|
+
try {
|
|
94
|
+
const text = readFileSync(path, "utf8");
|
|
95
|
+
const promptContext = renderPromptContext(cwd);
|
|
96
|
+
const preload = classifyProjectPreload({ hasClioMd: promptContext.clioMd !== null, text: promptContext.text });
|
|
97
|
+
graph.entries.push({
|
|
98
|
+
category: "clio-md",
|
|
99
|
+
id: "CLIO-CODER.md",
|
|
100
|
+
scope: "project",
|
|
101
|
+
sourcePath: path,
|
|
102
|
+
hash: shortHash(text),
|
|
103
|
+
trust: "trusted",
|
|
104
|
+
precedence: "single",
|
|
105
|
+
reloadClass: "next-turn",
|
|
106
|
+
contextCostTokens: ceilChars(text.length),
|
|
107
|
+
detail: {
|
|
108
|
+
preload: preload.label,
|
|
109
|
+
preloadChars: preload.chars,
|
|
110
|
+
preloadLines: preload.lines,
|
|
111
|
+
...preload.nearLimit ? { preloadNearLimit: true } : {}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
} catch (err) {
|
|
115
|
+
graph.issues.push(`clio-md: ${err instanceof Error ? err.message : String(err)}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function inspectRules(cwd, graph) {
|
|
119
|
+
try {
|
|
120
|
+
const loaded = loadProjectRules(cwd);
|
|
121
|
+
for (const issue of loaded.issues) graph.issues.push(`rule: ${issue}`);
|
|
122
|
+
for (const rule of loaded.rules) {
|
|
123
|
+
graph.entries.push({
|
|
124
|
+
category: "rule",
|
|
125
|
+
id: rule.id,
|
|
126
|
+
scope: "project",
|
|
127
|
+
sourcePath: rule.sourcePath,
|
|
128
|
+
hash: rule.hash,
|
|
129
|
+
trust: "trusted",
|
|
130
|
+
precedence: "single",
|
|
131
|
+
reloadClass: "next-turn",
|
|
132
|
+
contextCostTokens: rule.tokenEstimate,
|
|
133
|
+
detail: {
|
|
134
|
+
enabled: rule.enabled,
|
|
135
|
+
conditional: rule.paths !== void 0,
|
|
136
|
+
...rule.paths ? { paths: rule.paths } : {}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (loaded.excludes.length > 0) {
|
|
141
|
+
graph.entries.push({
|
|
142
|
+
category: "rule",
|
|
143
|
+
id: "context.excludes",
|
|
144
|
+
scope: "project",
|
|
145
|
+
reloadClass: "next-turn",
|
|
146
|
+
detail: { excludes: loaded.excludes }
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
} catch (err) {
|
|
150
|
+
graph.issues.push(`rules: ${err instanceof Error ? err.message : String(err)}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function inspectOperatorProfile(cwd, graph) {
|
|
154
|
+
try {
|
|
155
|
+
const loaded = loadOperatorProfile(cwd);
|
|
156
|
+
for (const issue of loaded.issues) graph.issues.push(`operator-profile: ${issue}`);
|
|
157
|
+
if (loaded.origin === "none") return;
|
|
158
|
+
const rendered = renderOperatorProfile(loaded.profile);
|
|
159
|
+
const entry = {
|
|
160
|
+
category: "operator-profile",
|
|
161
|
+
id: "operator-profile",
|
|
162
|
+
scope: loaded.origin,
|
|
163
|
+
trust: "trusted",
|
|
164
|
+
precedence: "single",
|
|
165
|
+
reloadClass: "next-turn",
|
|
166
|
+
contextCostTokens: rendered.tokenEstimate,
|
|
167
|
+
detail: { fields: Object.keys(loaded.profile) }
|
|
168
|
+
};
|
|
169
|
+
if (loaded.sourcePath !== void 0) entry.sourcePath = loaded.sourcePath;
|
|
170
|
+
if (loaded.hash !== void 0) entry.hash = loaded.hash;
|
|
171
|
+
graph.entries.push(entry);
|
|
172
|
+
} catch (err) {
|
|
173
|
+
graph.issues.push(`operator-profile: ${err instanceof Error ? err.message : String(err)}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function inspectHooks(cwd, graph) {
|
|
177
|
+
try {
|
|
178
|
+
const extensions = listInstalledExtensions(cwd).filter((ext) => ext.enabled && ext.effective).map((ext) => ({ id: ext.id, rootPath: ext.rootPath }));
|
|
179
|
+
const { batches, fileIssues } = readHookSources({ cwd, extensions });
|
|
180
|
+
for (const issue of fileIssues) graph.issues.push(`hook ${issue.source.origin}: ${issue.message}`);
|
|
181
|
+
const loaded = loadUserHooks(batches, { workspaceRoot: cwd });
|
|
182
|
+
for (const issue of loaded.issues) {
|
|
183
|
+
graph.issues.push(`hook ${issue.source.sourcePath}#${issue.index}: ${issue.issues.join("; ")}`);
|
|
184
|
+
}
|
|
185
|
+
for (const hook of loaded.hooks) {
|
|
186
|
+
graph.entries.push({
|
|
187
|
+
category: "hook",
|
|
188
|
+
id: hook.id,
|
|
189
|
+
scope: hook.source.origin,
|
|
190
|
+
sourcePath: hook.source.sourcePath,
|
|
191
|
+
hash: hook.hash,
|
|
192
|
+
trust: hook.source.origin === "extension" ? "untrusted" : "trusted",
|
|
193
|
+
precedence: "winner",
|
|
194
|
+
reloadClass: "restart",
|
|
195
|
+
detail: { on: hook.on, kind: hook.spec.kind, enabled: hook.enabled, ...hook.tools ? { tools: hook.tools } : {} }
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
for (const { loser } of loaded.overridden) {
|
|
199
|
+
graph.entries.push({
|
|
200
|
+
category: "hook",
|
|
201
|
+
id: loser.id,
|
|
202
|
+
scope: loser.source.origin,
|
|
203
|
+
sourcePath: loser.source.sourcePath,
|
|
204
|
+
hash: loser.hash,
|
|
205
|
+
trust: loser.source.origin === "extension" ? "untrusted" : "trusted",
|
|
206
|
+
precedence: "loser",
|
|
207
|
+
reloadClass: "restart",
|
|
208
|
+
detail: { on: loser.on, kind: loser.spec.kind }
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
} catch (err) {
|
|
212
|
+
graph.issues.push(`hooks: ${err instanceof Error ? err.message : String(err)}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function inspectExtensions(cwd, graph) {
|
|
216
|
+
try {
|
|
217
|
+
for (const ext of listInstalledExtensions(cwd, { all: true })) {
|
|
218
|
+
graph.entries.push({
|
|
219
|
+
category: "extension",
|
|
220
|
+
id: ext.id,
|
|
221
|
+
scope: ext.scope,
|
|
222
|
+
sourcePath: ext.rootPath,
|
|
223
|
+
hash: shortHash(`${ext.id}@${ext.version}`),
|
|
224
|
+
trust: "untrusted",
|
|
225
|
+
precedence: ext.effective ? "winner" : "loser",
|
|
226
|
+
reloadClass: "restart",
|
|
227
|
+
detail: { version: ext.version, enabled: ext.enabled, effective: ext.effective }
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
} catch (err) {
|
|
231
|
+
graph.issues.push(`extensions: ${err instanceof Error ? err.message : String(err)}`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function inspectResourceRoots(cwd, graph) {
|
|
235
|
+
for (const [kind, category] of [
|
|
236
|
+
["skills", "skill-root"],
|
|
237
|
+
["prompts", "prompt-root"]
|
|
238
|
+
]) {
|
|
239
|
+
try {
|
|
240
|
+
for (const root of defaultScopedResourceRoots(kind, cwd)) {
|
|
241
|
+
graph.entries.push({
|
|
242
|
+
category,
|
|
243
|
+
id: `${kind}:${root.scope}`,
|
|
244
|
+
scope: root.scope,
|
|
245
|
+
sourcePath: root.path,
|
|
246
|
+
trust: root.scope === "package" ? "untrusted" : "trusted",
|
|
247
|
+
precedence: "single",
|
|
248
|
+
reloadClass: "next-turn",
|
|
249
|
+
detail: { present: existsSync(root.path), source: root.source }
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
} catch (err) {
|
|
253
|
+
graph.issues.push(`${kind}: ${err instanceof Error ? err.message : String(err)}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function inspectSafetyAndMemory(cwd, graph) {
|
|
258
|
+
try {
|
|
259
|
+
const layered = readLayeredSettings(cwd);
|
|
260
|
+
graph.entries.push({
|
|
261
|
+
category: "safety",
|
|
262
|
+
id: "autonomy",
|
|
263
|
+
scope: settingsSourceFor(layered.sources, "autonomy"),
|
|
264
|
+
reloadClass: "hot",
|
|
265
|
+
trust: "n/a",
|
|
266
|
+
precedence: "single",
|
|
267
|
+
detail: { autonomy: layered.settings.autonomy ?? "auto-edit" }
|
|
268
|
+
});
|
|
269
|
+
} catch (err) {
|
|
270
|
+
graph.issues.push(`safety: ${err instanceof Error ? err.message : String(err)}`);
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
const path = memoryStorePath(clioDataDir());
|
|
274
|
+
const records = existsSync(path) ? loadMemoryRecordsSync(path) : [];
|
|
275
|
+
graph.entries.push({
|
|
276
|
+
category: "memory",
|
|
277
|
+
id: "memory-store",
|
|
278
|
+
scope: "user",
|
|
279
|
+
sourcePath: path,
|
|
280
|
+
reloadClass: "hot",
|
|
281
|
+
trust: "trusted",
|
|
282
|
+
precedence: "single",
|
|
283
|
+
detail: { present: existsSync(path), records: records.length }
|
|
284
|
+
});
|
|
285
|
+
} catch (err) {
|
|
286
|
+
graph.issues.push(`memory: ${err instanceof Error ? err.message : String(err)}`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function buildCustomizationGraph(cwd) {
|
|
290
|
+
const graph = { cwd, settings: [], entries: [], issues: [] };
|
|
291
|
+
inspectSettings(cwd, graph);
|
|
292
|
+
inspectClioMd(cwd, graph);
|
|
293
|
+
inspectRules(cwd, graph);
|
|
294
|
+
inspectOperatorProfile(cwd, graph);
|
|
295
|
+
inspectHooks(cwd, graph);
|
|
296
|
+
inspectExtensions(cwd, graph);
|
|
297
|
+
inspectResourceRoots(cwd, graph);
|
|
298
|
+
inspectSafetyAndMemory(cwd, graph);
|
|
299
|
+
return graph;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/cli/config.ts
|
|
303
|
+
var HELP = `clio-coder config inspect [--json]
|
|
304
|
+
|
|
305
|
+
Print the effective-customization graph: what settings, context files, rules,
|
|
306
|
+
skills, prompts, agents, extensions, safety, memory, hooks, and the operator
|
|
307
|
+
profile loaded, from where, with what precedence, trust, reload class, and
|
|
308
|
+
context cost. Read-only; nothing is created.
|
|
309
|
+
|
|
310
|
+
This is the "why is Clio behaving this way" surface. Parse the --json form in
|
|
311
|
+
scripts instead of the table.
|
|
312
|
+
`;
|
|
313
|
+
function renderText(cwd) {
|
|
314
|
+
const graph = buildCustomizationGraph(cwd);
|
|
315
|
+
const out = [`Effective customization for ${cwd}`, ""];
|
|
316
|
+
out.push("Settings (only keys a layer set; everything else is built-in):");
|
|
317
|
+
if (graph.settings.length === 0) out.push(" (none; all built-in defaults)");
|
|
318
|
+
for (const entry of graph.settings) {
|
|
319
|
+
out.push(` ${entry.key} = ${JSON.stringify(entry.value)} [${entry.source}]`);
|
|
320
|
+
}
|
|
321
|
+
out.push("");
|
|
322
|
+
const byCategory = /* @__PURE__ */ new Map();
|
|
323
|
+
for (const entry of graph.entries) {
|
|
324
|
+
const list = byCategory.get(entry.category) ?? [];
|
|
325
|
+
list.push(entry);
|
|
326
|
+
byCategory.set(entry.category, list);
|
|
327
|
+
}
|
|
328
|
+
for (const [category, entries] of byCategory) {
|
|
329
|
+
out.push(`${category}:`);
|
|
330
|
+
for (const entry of entries) {
|
|
331
|
+
const cost = entry.contextCostTokens !== void 0 ? `, ~${entry.contextCostTokens} tok` : "";
|
|
332
|
+
const hash = entry.hash ? `, #${entry.hash}` : "";
|
|
333
|
+
const precedence = entry.precedence ? `, ${entry.precedence}` : "";
|
|
334
|
+
out.push(` ${entry.id} [${entry.scope}${precedence}, reload:${entry.reloadClass}${hash}${cost}]`);
|
|
335
|
+
if (entry.sourcePath) out.push(` from ${entry.sourcePath}`);
|
|
336
|
+
}
|
|
337
|
+
out.push("");
|
|
338
|
+
}
|
|
339
|
+
if (graph.issues.length > 0) {
|
|
340
|
+
out.push("Issues:");
|
|
341
|
+
for (const issue of graph.issues) out.push(` - ${issue}`);
|
|
342
|
+
out.push("");
|
|
343
|
+
}
|
|
344
|
+
return `${out.join("\n").trimEnd()}
|
|
345
|
+
`;
|
|
346
|
+
}
|
|
347
|
+
function runConfigCommand(args = []) {
|
|
348
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
349
|
+
process.stdout.write(HELP);
|
|
350
|
+
return 0;
|
|
351
|
+
}
|
|
352
|
+
const positional = args.filter((arg) => !arg.startsWith("-"));
|
|
353
|
+
const sub = positional[0] ?? "inspect";
|
|
354
|
+
if (sub !== "inspect") {
|
|
355
|
+
printError(`unknown config subcommand: ${sub}`);
|
|
356
|
+
process.stderr.write(HELP);
|
|
357
|
+
return 2;
|
|
358
|
+
}
|
|
359
|
+
const json = args.includes("--json");
|
|
360
|
+
const cwd = process.cwd();
|
|
361
|
+
if (json) {
|
|
362
|
+
process.stdout.write(`${JSON.stringify(buildCustomizationGraph(cwd), null, 2)}
|
|
363
|
+
`);
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
process.stdout.write(renderText(cwd));
|
|
367
|
+
return 0;
|
|
368
|
+
}
|
|
369
|
+
export {
|
|
370
|
+
runConfigCommand
|
|
371
|
+
};
|
|
372
|
+
//# sourceMappingURL=config-ZFCDBMDC.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runConfigureCommand,
|
|
3
|
+
runTargetRemove,
|
|
4
|
+
runTargetRename
|
|
5
|
+
} from "./chunk-XNISANGE.js";
|
|
6
|
+
import "./chunk-KKKPTZLM.js";
|
|
7
|
+
import "./chunk-ME6DNWIU.js";
|
|
8
|
+
import "./chunk-262G75JS.js";
|
|
9
|
+
import "./chunk-TFSSEXL6.js";
|
|
10
|
+
import "./chunk-PIDUD6M2.js";
|
|
11
|
+
import "./chunk-67MTHP2E.js";
|
|
12
|
+
import "./chunk-TKHQ4DGZ.js";
|
|
13
|
+
import "./chunk-D5YD55AR.js";
|
|
14
|
+
import "./chunk-JWHCJDCI.js";
|
|
15
|
+
import "./chunk-UHTSULZS.js";
|
|
16
|
+
import "./chunk-5LDRNKX2.js";
|
|
17
|
+
import "./chunk-UGYAX5YI.js";
|
|
18
|
+
import "./chunk-5N2FG33Q.js";
|
|
19
|
+
import "./chunk-VPAWTYLY.js";
|
|
20
|
+
import "./chunk-X3NE4WVW.js";
|
|
21
|
+
import "./chunk-DXQNI4PC.js";
|
|
22
|
+
export {
|
|
23
|
+
runConfigureCommand,
|
|
24
|
+
runTargetRemove,
|
|
25
|
+
runTargetRename
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=configure-G4E3A2PG.js.map
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// src/cli/context.ts
|
|
2
|
+
var HELP = `Usage:
|
|
3
|
+
clio-coder context
|
|
4
|
+
clio-coder context init [--yes] [--preview|--heuristic] [--adopt] [--propose|--apply|--rewrite]
|
|
5
|
+
clio-coder context refresh [--wiki]
|
|
6
|
+
clio-coder context wiki [--update] [--status] [--depth auto|simple|medium|detailed]
|
|
7
|
+
[--target <id>] [--model <id>] [--thinking off|low|medium|high]
|
|
8
|
+
clio-coder context reset [--all] [--yes]
|
|
9
|
+
clio-coder context index [--json]
|
|
10
|
+
|
|
11
|
+
Project context commands:
|
|
12
|
+
clio-coder context show project context status (CLIO-CODER.md, preload, codewiki)
|
|
13
|
+
clio-coder context init explore the repo and bootstrap CLIO-CODER.md and codewiki
|
|
14
|
+
clio-coder context refresh re-index the codewiki and optionally update the Markdown wiki
|
|
15
|
+
clio-coder context wiki generate or inspect the agent-authored Markdown wiki
|
|
16
|
+
clio-coder context reset clear accumulated project context artifacts
|
|
17
|
+
clio-coder context index build the codewiki index without model calls
|
|
18
|
+
`;
|
|
19
|
+
function printWikiProgress(event) {
|
|
20
|
+
if (event.status === "completed") return;
|
|
21
|
+
const detail = event.detail ? ` (${event.detail})` : "";
|
|
22
|
+
process.stderr.write(`clio-coder context wiki: ${event.message}${detail}
|
|
23
|
+
`);
|
|
24
|
+
}
|
|
25
|
+
function compactMetric(value, suffix) {
|
|
26
|
+
if (value < 1e3) return `${value}${suffix}`;
|
|
27
|
+
return `${(value / 1e3).toFixed(1)}k${suffix}`;
|
|
28
|
+
}
|
|
29
|
+
function formatGenerationStatus(generation) {
|
|
30
|
+
if (!generation) return null;
|
|
31
|
+
const details = [`parser ${generation.parserOutcome}`];
|
|
32
|
+
if (generation.structuredOutputMode) details.push(generation.structuredOutputMode);
|
|
33
|
+
const route = [generation.targetId, generation.wireModelId, generation.runtimeId].filter(
|
|
34
|
+
(value) => typeof value === "string"
|
|
35
|
+
);
|
|
36
|
+
if (route.length > 0) details.push(route.join("/"));
|
|
37
|
+
if (generation.thinkingLevel) details.push(`thinking ${generation.thinkingLevel}`);
|
|
38
|
+
const usage = [];
|
|
39
|
+
if (generation.tokenCount !== void 0) usage.push(`${generation.tokenCount} tokens`);
|
|
40
|
+
if (generation.toolCalls !== void 0) usage.push(`${generation.toolCalls} tools`);
|
|
41
|
+
if (generation.durationMs !== void 0) usage.push(`${(generation.durationMs / 1e3).toFixed(2)}s`);
|
|
42
|
+
if (generation.promptBytes !== void 0 && generation.outputBytes !== void 0) {
|
|
43
|
+
usage.push(`${compactMetric(generation.promptBytes, "B")} in/${compactMetric(generation.outputBytes, "B")} out`);
|
|
44
|
+
}
|
|
45
|
+
if (usage.length > 0) details.push(usage.join(", "));
|
|
46
|
+
if (generation.fallbackReason) {
|
|
47
|
+
const reason = generation.fallbackReason.length > 160 ? `${generation.fallbackReason.slice(0, 157)}...` : generation.fallbackReason;
|
|
48
|
+
details.push(`fallback: ${reason}`);
|
|
49
|
+
}
|
|
50
|
+
return `generation: ${generation.mode} (${details.join("; ")})`;
|
|
51
|
+
}
|
|
52
|
+
async function printContextStatus() {
|
|
53
|
+
const context = await import("./context-E3KIFVXI.js");
|
|
54
|
+
const preload = await import("./preload-KZVHET2B.js");
|
|
55
|
+
const cwd = process.cwd();
|
|
56
|
+
const clio = context.tryReadClioMd(cwd);
|
|
57
|
+
const state = context.readClioState(cwd);
|
|
58
|
+
const clioMdState = !clio ? "none" : !clio.ok ? "malformed" : state?.contextSources !== void 0 && context.adoptionSourcesChanged(state.contextSources, { cwd }) ? "stale" : "ok";
|
|
59
|
+
const prompt = context.renderPromptContext(cwd);
|
|
60
|
+
const preloadClass = preload.classifyProjectPreload({
|
|
61
|
+
hasClioMd: prompt.clioMd !== null,
|
|
62
|
+
text: prompt.text
|
|
63
|
+
});
|
|
64
|
+
const codewiki = context.readCodewiki(cwd);
|
|
65
|
+
const codewikiCount = codewiki ? context.codewikiEntries(codewiki).length : 0;
|
|
66
|
+
const codewikiState = !codewiki ? "absent" : state && !context.isStale(state.fingerprint, context.computeFingerprint(cwd, codewiki)) ? "fresh" : "stale (run clio-coder context refresh)";
|
|
67
|
+
const codewikiLines = [`codewiki: ${codewikiState} (${codewikiCount} entr${codewikiCount === 1 ? "y" : "ies"})`];
|
|
68
|
+
if (codewiki) codewikiLines.push(context.renderCodewikiDigest(codewiki));
|
|
69
|
+
const adoptionSources = state?.contextSources ?? [];
|
|
70
|
+
const adoptionChanged = state?.contextSources !== void 0 ? context.adoptionSourcesChanged(adoptionSources, { cwd }) : false;
|
|
71
|
+
const adoptionState = adoptionChanged ? "changed (run clio-coder context init --adopt)" : "up to date";
|
|
72
|
+
const generationLine = formatGenerationStatus(state?.lastBootstrap);
|
|
73
|
+
process.stdout.write(
|
|
74
|
+
[
|
|
75
|
+
`CLIO-CODER.md: ${clioMdState}`,
|
|
76
|
+
`preload: ${preloadClass.label}`,
|
|
77
|
+
...codewikiLines,
|
|
78
|
+
`adoption: ${adoptionSources.length} source${adoptionSources.length === 1 ? "" : "s"}, ${adoptionState}`,
|
|
79
|
+
...generationLine ? [generationLine] : [],
|
|
80
|
+
""
|
|
81
|
+
].join("\n")
|
|
82
|
+
);
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
async function runRefreshCommand(args) {
|
|
86
|
+
let updateWiki = false;
|
|
87
|
+
for (const arg of args) {
|
|
88
|
+
if (arg === "--help" || arg === "-h") {
|
|
89
|
+
process.stdout.write(HELP);
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
if (arg === "--wiki") {
|
|
93
|
+
updateWiki = true;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
process.stderr.write(`clio-coder context refresh: unknown flag ${arg}
|
|
97
|
+
`);
|
|
98
|
+
process.stdout.write(HELP);
|
|
99
|
+
return 2;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
const { runContextRefresh } = await import("./context-E3KIFVXI.js");
|
|
103
|
+
const wikiEntry = updateWiki ? await import("./wiki-generate-PKFIX6OB.js") : null;
|
|
104
|
+
const result = await runContextRefresh({
|
|
105
|
+
cwd: process.cwd(),
|
|
106
|
+
io: {
|
|
107
|
+
stdout: (s) => process.stdout.write(s),
|
|
108
|
+
stderr: (s) => process.stderr.write(s)
|
|
109
|
+
},
|
|
110
|
+
wiki: updateWiki,
|
|
111
|
+
...wikiEntry ? { wikiGenerate: wikiEntry.modelWikiGenerate(), wikiModel: await wikiEntry.resolveDocumenterModelId() } : {}
|
|
112
|
+
});
|
|
113
|
+
if (result.hint) process.stdout.write(`${result.hint}
|
|
114
|
+
`);
|
|
115
|
+
if (result.wiki) {
|
|
116
|
+
if (result.wiki.status === "failed") {
|
|
117
|
+
process.stderr.write(
|
|
118
|
+
`clio-coder context refresh: wiki update failed: ${(result.wiki.problems ?? ["unknown failure"]).join("; ")}
|
|
119
|
+
`
|
|
120
|
+
);
|
|
121
|
+
return 1;
|
|
122
|
+
}
|
|
123
|
+
process.stdout.write(
|
|
124
|
+
result.wiki.status === "noop" ? `clio-coder context refresh: wiki unchanged (${result.wiki.pages} page${result.wiki.pages === 1 ? "" : "s"})
|
|
125
|
+
` : `clio-coder context refresh: wiki updated (${result.wiki.pages} page${result.wiki.pages === 1 ? "" : "s"})
|
|
126
|
+
`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return 0;
|
|
130
|
+
} catch (err) {
|
|
131
|
+
process.stderr.write(`clio-coder context refresh failed: ${err instanceof Error ? err.message : String(err)}
|
|
132
|
+
`);
|
|
133
|
+
return 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async function runWikiStatusCommand() {
|
|
137
|
+
const context = await import("./context-E3KIFVXI.js");
|
|
138
|
+
const cwd = process.cwd();
|
|
139
|
+
const meta = context.readWikiMeta(cwd);
|
|
140
|
+
if (!meta) {
|
|
141
|
+
const pageCount = context.listWikiPages(cwd).length;
|
|
142
|
+
process.stdout.write(`wiki: absent (${pageCount} page${pageCount === 1 ? "" : "s"})
|
|
143
|
+
`);
|
|
144
|
+
return 0;
|
|
145
|
+
}
|
|
146
|
+
const currentHead = context.currentWikiGitHead(cwd);
|
|
147
|
+
const lines = [
|
|
148
|
+
`wiki: present (${meta.pages.length} page${meta.pages.length === 1 ? "" : "s"})`,
|
|
149
|
+
`updatedAt: ${meta.updatedAt}`,
|
|
150
|
+
`gitHead: ${meta.gitHead ?? "none"}`
|
|
151
|
+
];
|
|
152
|
+
if (meta.generation) {
|
|
153
|
+
const { depth, requestedDepth, sourceFiles, pagesPlanned, pagesWritten } = meta.generation;
|
|
154
|
+
lines.push(
|
|
155
|
+
`depth: ${depth} (requested ${requestedDepth}; ${sourceFiles} source files; ${pagesWritten}/${pagesPlanned} planned pages written)`
|
|
156
|
+
);
|
|
157
|
+
if (pagesWritten < pagesPlanned) {
|
|
158
|
+
lines.push(`pending: ${pagesPlanned - pagesWritten} page(s); run \`clio-coder context wiki --update\` to finish`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (currentHead !== meta.gitHead) {
|
|
162
|
+
lines.push(`staleness: gitHead differs from current HEAD (${currentHead ?? "none"})`);
|
|
163
|
+
}
|
|
164
|
+
process.stdout.write(`${lines.join("\n")}
|
|
165
|
+
`);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
var VALUE_FLAGS = /* @__PURE__ */ new Set(["--target", "--model", "--thinking", "--depth"]);
|
|
169
|
+
function isWikiDepth(value) {
|
|
170
|
+
return value === "auto" || value === "simple" || value === "medium" || value === "detailed";
|
|
171
|
+
}
|
|
172
|
+
function isThinkingLevel(value) {
|
|
173
|
+
return value === "off" || value === "low" || value === "medium" || value === "high";
|
|
174
|
+
}
|
|
175
|
+
async function runWikiCommand(args) {
|
|
176
|
+
let forceUpdate = false;
|
|
177
|
+
let status = false;
|
|
178
|
+
let depth = "auto";
|
|
179
|
+
let target;
|
|
180
|
+
let model;
|
|
181
|
+
let thinkingLevel;
|
|
182
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
183
|
+
const arg = args[index];
|
|
184
|
+
if (arg === "--help" || arg === "-h") {
|
|
185
|
+
process.stdout.write(HELP);
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
if (arg === "--update") {
|
|
189
|
+
forceUpdate = true;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (arg === "--status") {
|
|
193
|
+
status = true;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (VALUE_FLAGS.has(arg ?? "")) {
|
|
197
|
+
const value = args[index + 1];
|
|
198
|
+
index += 1;
|
|
199
|
+
if (arg === "--target" || arg === "--model") {
|
|
200
|
+
if (!value || value.startsWith("--")) {
|
|
201
|
+
process.stderr.write(`clio-coder context wiki: ${arg} requires a value
|
|
202
|
+
`);
|
|
203
|
+
return 2;
|
|
204
|
+
}
|
|
205
|
+
if (arg === "--target") target = value;
|
|
206
|
+
else model = value;
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (arg === "--thinking") {
|
|
210
|
+
if (!isThinkingLevel(value)) {
|
|
211
|
+
process.stderr.write("clio-coder context wiki: --thinking must be off, low, medium, or high\n");
|
|
212
|
+
return 2;
|
|
213
|
+
}
|
|
214
|
+
thinkingLevel = value;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!isWikiDepth(value)) {
|
|
218
|
+
process.stderr.write("clio-coder context wiki: --depth must be auto, simple, medium, or detailed\n");
|
|
219
|
+
return 2;
|
|
220
|
+
}
|
|
221
|
+
depth = value;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
process.stderr.write(`clio-coder context wiki: unknown flag ${arg}
|
|
225
|
+
`);
|
|
226
|
+
process.stdout.write(HELP);
|
|
227
|
+
return 2;
|
|
228
|
+
}
|
|
229
|
+
if (status) return runWikiStatusCommand();
|
|
230
|
+
try {
|
|
231
|
+
const context = await import("./context-E3KIFVXI.js");
|
|
232
|
+
const { modelWikiGenerate, resolveDocumenterModelId } = await import("./wiki-generate-PKFIX6OB.js");
|
|
233
|
+
const route = {
|
|
234
|
+
...target !== void 0 ? { target } : {},
|
|
235
|
+
...model !== void 0 ? { model } : {},
|
|
236
|
+
...thinkingLevel !== void 0 ? { thinkingLevel } : {}
|
|
237
|
+
};
|
|
238
|
+
const result = await context.runWikiGenerate({
|
|
239
|
+
cwd: process.cwd(),
|
|
240
|
+
...forceUpdate ? { mode: "update" } : {},
|
|
241
|
+
depth,
|
|
242
|
+
model: await resolveDocumenterModelId(route),
|
|
243
|
+
generate: modelWikiGenerate({ route }),
|
|
244
|
+
onProgress: printWikiProgress
|
|
245
|
+
});
|
|
246
|
+
if (result.status === "failed") {
|
|
247
|
+
process.stderr.write(`clio-coder context wiki failed: ${(result.problems ?? ["unknown failure"]).join("; ")}
|
|
248
|
+
`);
|
|
249
|
+
return 1;
|
|
250
|
+
}
|
|
251
|
+
process.stdout.write(
|
|
252
|
+
result.status === "noop" ? `clio-coder context wiki: unchanged (${result.pages} page${result.pages === 1 ? "" : "s"})
|
|
253
|
+
` : `clio-coder context wiki: generated ${result.pages} page${result.pages === 1 ? "" : "s"}
|
|
254
|
+
`
|
|
255
|
+
);
|
|
256
|
+
return 0;
|
|
257
|
+
} catch (err) {
|
|
258
|
+
process.stderr.write(`clio-coder context wiki failed: ${err instanceof Error ? err.message : String(err)}
|
|
259
|
+
`);
|
|
260
|
+
return 1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
async function runContextCommand(args) {
|
|
264
|
+
const [verb, ...rest] = args;
|
|
265
|
+
if (verb === void 0) {
|
|
266
|
+
return printContextStatus();
|
|
267
|
+
}
|
|
268
|
+
if (verb === "--help" || verb === "-h") {
|
|
269
|
+
process.stdout.write(HELP);
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
switch (verb) {
|
|
273
|
+
case "init":
|
|
274
|
+
return (await import("./init-2OZDJE2D.js")).runInitCommand(rest);
|
|
275
|
+
case "refresh":
|
|
276
|
+
return runRefreshCommand(rest);
|
|
277
|
+
case "wiki":
|
|
278
|
+
return runWikiCommand(rest);
|
|
279
|
+
case "reset":
|
|
280
|
+
return (await import("./context-clear-3F4PLXOS.js")).runContextClearCommand(rest);
|
|
281
|
+
case "index":
|
|
282
|
+
return (await import("./context-index-Q7YSYTR3.js")).runContextIndexCommand(rest);
|
|
283
|
+
default:
|
|
284
|
+
process.stderr.write(`clio-coder context: unknown subcommand ${verb}
|
|
285
|
+
`);
|
|
286
|
+
process.stdout.write(HELP);
|
|
287
|
+
return 2;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export {
|
|
291
|
+
runContextCommand
|
|
292
|
+
};
|
|
293
|
+
//# sourceMappingURL=context-CDXTP2MP.js.map
|