@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,301 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LifecycleDomainModule,
|
|
3
|
+
listMigrations
|
|
4
|
+
} from "./chunk-NI4DEJMC.js";
|
|
5
|
+
import "./chunk-7RBKDI66.js";
|
|
6
|
+
import {
|
|
7
|
+
ConfigDomainModule,
|
|
8
|
+
loadDomains
|
|
9
|
+
} from "./chunk-527KG6XR.js";
|
|
10
|
+
import "./chunk-UU3R62TT.js";
|
|
11
|
+
import {
|
|
12
|
+
getVersionInfo
|
|
13
|
+
} from "./chunk-HMYNFFY4.js";
|
|
14
|
+
import "./chunk-262G75JS.js";
|
|
15
|
+
import {
|
|
16
|
+
initializeClioHome
|
|
17
|
+
} from "./chunk-TFSSEXL6.js";
|
|
18
|
+
import "./chunk-PIDUD6M2.js";
|
|
19
|
+
import {
|
|
20
|
+
printError,
|
|
21
|
+
printHeader,
|
|
22
|
+
printOk
|
|
23
|
+
} from "./chunk-67MTHP2E.js";
|
|
24
|
+
import "./chunk-D5YD55AR.js";
|
|
25
|
+
import "./chunk-JWHCJDCI.js";
|
|
26
|
+
import "./chunk-UHTSULZS.js";
|
|
27
|
+
import "./chunk-5LDRNKX2.js";
|
|
28
|
+
import "./chunk-UGYAX5YI.js";
|
|
29
|
+
import "./chunk-5N2FG33Q.js";
|
|
30
|
+
import "./chunk-VPAWTYLY.js";
|
|
31
|
+
import {
|
|
32
|
+
clioStateDir
|
|
33
|
+
} from "./chunk-X3NE4WVW.js";
|
|
34
|
+
import "./chunk-DXQNI4PC.js";
|
|
35
|
+
|
|
36
|
+
// src/cli/upgrade.ts
|
|
37
|
+
import { spawn } from "node:child_process";
|
|
38
|
+
|
|
39
|
+
// src/domains/lifecycle/install-method.ts
|
|
40
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
41
|
+
import { join, resolve, sep } from "node:path";
|
|
42
|
+
var PACKAGE_NAME = "@iowarp/clio-coder";
|
|
43
|
+
var DIST_CLI_SUFFIX = join("dist", "cli", "index.js");
|
|
44
|
+
function detectInstallMethod(entryPath = process.argv[1]) {
|
|
45
|
+
const root = sourceCheckoutRoot(entryPath);
|
|
46
|
+
return root === null ? "npm" : "source";
|
|
47
|
+
}
|
|
48
|
+
function sourceCheckoutRoot(entryPath = process.argv[1]) {
|
|
49
|
+
if (!entryPath || entryPath.trim().length === 0) return null;
|
|
50
|
+
let entry;
|
|
51
|
+
try {
|
|
52
|
+
entry = realpathSync(resolve(entryPath));
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const suffix = sep + DIST_CLI_SUFFIX;
|
|
57
|
+
if (!entry.endsWith(suffix)) return null;
|
|
58
|
+
if (entry.split(sep).includes("node_modules")) return null;
|
|
59
|
+
const root = entry.slice(0, entry.length - suffix.length);
|
|
60
|
+
try {
|
|
61
|
+
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
62
|
+
if (pkg.name !== PACKAGE_NAME) return null;
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const hasCheckoutMarker = existsSync(join(root, ".git")) || existsSync(join(root, "src", "cli", "index.ts"));
|
|
67
|
+
return hasCheckoutMarker ? root : null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/cli/upgrade.ts
|
|
71
|
+
var CHANNELS = ["latest", "beta", "dev"];
|
|
72
|
+
var HELP = `clio-coder upgrade [--dry-run] [--channel=<latest|beta|dev>] [--skip-migrations]
|
|
73
|
+
|
|
74
|
+
Refresh state metadata and apply pending data-dir migrations. An npm-installed
|
|
75
|
+
binary is also reinstalled via npm; a source-checkout install instead prints
|
|
76
|
+
the git-based update steps and never touches the global npm prefix.
|
|
77
|
+
|
|
78
|
+
Flags:
|
|
79
|
+
--dry-run print planned actions without changing anything
|
|
80
|
+
--channel=<chan> npm dist-tag to install (latest|beta|dev). npm installs only.
|
|
81
|
+
--skip-migrations skip migrations after the install step
|
|
82
|
+
`;
|
|
83
|
+
var SOURCE_UPGRADE_STEPS = ["git pull", "npm run install:local", "hash -r"];
|
|
84
|
+
function printSourceUpgradeSteps() {
|
|
85
|
+
process.stdout.write("[upgrade] source checkout install: update the code with:\n");
|
|
86
|
+
for (const step of SOURCE_UPGRADE_STEPS) process.stdout.write(` ${step}
|
|
87
|
+
`);
|
|
88
|
+
}
|
|
89
|
+
function parseUpgradeArgs(argv) {
|
|
90
|
+
let dryRun = false;
|
|
91
|
+
let channel = "latest";
|
|
92
|
+
let skipMigrations = false;
|
|
93
|
+
let help = false;
|
|
94
|
+
let postInstall = false;
|
|
95
|
+
for (const arg of argv) {
|
|
96
|
+
if (arg === "upgrade") continue;
|
|
97
|
+
if (arg === "--help" || arg === "-h") {
|
|
98
|
+
help = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (arg === "--dry-run") {
|
|
102
|
+
dryRun = true;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (arg === "--skip-migrations") {
|
|
106
|
+
skipMigrations = true;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (arg === "--post-install") {
|
|
110
|
+
postInstall = true;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (arg.startsWith("--channel=")) {
|
|
114
|
+
const value = arg.slice("--channel=".length);
|
|
115
|
+
if (!CHANNELS.includes(value)) {
|
|
116
|
+
throw new Error(`--channel must be one of ${CHANNELS.join("|")}, got '${value}'`);
|
|
117
|
+
}
|
|
118
|
+
channel = value;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`unknown upgrade argument: ${arg}`);
|
|
122
|
+
}
|
|
123
|
+
return { dryRun, channel, skipMigrations, help, postInstall };
|
|
124
|
+
}
|
|
125
|
+
function streamPrefixed(source, sink) {
|
|
126
|
+
let buffered = "";
|
|
127
|
+
source.on("data", (chunk) => {
|
|
128
|
+
buffered += typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
129
|
+
let idx = buffered.indexOf("\n");
|
|
130
|
+
while (idx !== -1) {
|
|
131
|
+
const line = buffered.slice(0, idx);
|
|
132
|
+
buffered = buffered.slice(idx + 1);
|
|
133
|
+
sink.write(`[upgrade] ${line}
|
|
134
|
+
`);
|
|
135
|
+
idx = buffered.indexOf("\n");
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
source.on("end", () => {
|
|
139
|
+
if (buffered.length > 0) sink.write(`[upgrade] ${buffered}
|
|
140
|
+
`);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
async function runNpmInstall(channel) {
|
|
144
|
+
const args = ["install", "-g", `@iowarp/clio-coder@${channel}`];
|
|
145
|
+
process.stdout.write(`[upgrade] npm ${args.join(" ")}
|
|
146
|
+
`);
|
|
147
|
+
await new Promise((resolve2, reject) => {
|
|
148
|
+
const child = spawn("npm", args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
149
|
+
streamPrefixed(child.stdout, process.stdout);
|
|
150
|
+
streamPrefixed(child.stderr, process.stderr);
|
|
151
|
+
child.on("error", reject);
|
|
152
|
+
child.on("exit", (code) => {
|
|
153
|
+
if (code === 0) resolve2();
|
|
154
|
+
else reject(new Error(`npm exited with code ${code ?? -1}`));
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async function runDoctorFixAfterInstall() {
|
|
159
|
+
const args = ["doctor", "--fix"];
|
|
160
|
+
process.stdout.write(`[upgrade] clio-coder ${args.join(" ")}
|
|
161
|
+
`);
|
|
162
|
+
await new Promise((resolve2, reject) => {
|
|
163
|
+
const child = spawn("clio-coder", args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
164
|
+
streamPrefixed(child.stdout, process.stdout);
|
|
165
|
+
streamPrefixed(child.stderr, process.stderr);
|
|
166
|
+
child.on("error", reject);
|
|
167
|
+
child.on("exit", (code) => {
|
|
168
|
+
if (code === 0) resolve2();
|
|
169
|
+
else reject(new Error(`clio-coder doctor --fix exited with code ${code ?? -1}`));
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async function runPostInstallUpgrade(opts) {
|
|
174
|
+
const args = ["upgrade", "--post-install", `--channel=${opts.channel}`];
|
|
175
|
+
if (opts.skipMigrations) args.push("--skip-migrations");
|
|
176
|
+
process.stdout.write(`[upgrade] clio-coder ${args.join(" ")}
|
|
177
|
+
`);
|
|
178
|
+
await new Promise((resolve2, reject) => {
|
|
179
|
+
const child = spawn("clio-coder", args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
180
|
+
streamPrefixed(child.stdout, process.stdout);
|
|
181
|
+
streamPrefixed(child.stderr, process.stderr);
|
|
182
|
+
child.on("error", reject);
|
|
183
|
+
child.on("exit", (code) => {
|
|
184
|
+
if (code === 0) resolve2();
|
|
185
|
+
else reject(new Error(`clio-coder upgrade --post-install exited with code ${code ?? -1}`));
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async function runUpgradeCommand(argv) {
|
|
190
|
+
let opts;
|
|
191
|
+
try {
|
|
192
|
+
opts = parseUpgradeArgs(argv);
|
|
193
|
+
} catch (err) {
|
|
194
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
195
|
+
return 2;
|
|
196
|
+
}
|
|
197
|
+
if (opts.help) {
|
|
198
|
+
process.stdout.write(HELP);
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
const before = getVersionInfo().clio;
|
|
202
|
+
const stateDir = clioStateDir();
|
|
203
|
+
const method = detectInstallMethod();
|
|
204
|
+
printHeader("Clio Coder upgrade");
|
|
205
|
+
process.stdout.write(`install ${method === "source" ? "source checkout" : "npm"}
|
|
206
|
+
`);
|
|
207
|
+
if (method === "npm") process.stdout.write(`channel ${opts.channel}
|
|
208
|
+
`);
|
|
209
|
+
process.stdout.write(`current ${before}
|
|
210
|
+
`);
|
|
211
|
+
process.stdout.write(`state dir ${stateDir}
|
|
212
|
+
`);
|
|
213
|
+
const noNetwork = Boolean(process.env.CLIO_CODER_TEST_UPGRADE_NO_NETWORK);
|
|
214
|
+
const migrations = listMigrations();
|
|
215
|
+
const migrationIds = migrations.map((m) => m.id);
|
|
216
|
+
if (opts.dryRun) {
|
|
217
|
+
if (method === "source") {
|
|
218
|
+
printSourceUpgradeSteps();
|
|
219
|
+
} else {
|
|
220
|
+
process.stdout.write(`[upgrade] would run: npm install -g @iowarp/clio-coder@${opts.channel}
|
|
221
|
+
`);
|
|
222
|
+
}
|
|
223
|
+
if (opts.skipMigrations) {
|
|
224
|
+
process.stdout.write("[upgrade] would skip migrations (--skip-migrations)\n");
|
|
225
|
+
} else {
|
|
226
|
+
process.stdout.write(`[upgrade] would consider ${migrationIds.length} migration(s):
|
|
227
|
+
`);
|
|
228
|
+
for (const id of migrationIds) process.stdout.write(` - ${id}
|
|
229
|
+
`);
|
|
230
|
+
}
|
|
231
|
+
process.stdout.write("[upgrade] would refresh state metadata\n");
|
|
232
|
+
printOk("dry run complete, no changes made");
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
if (opts.postInstall) {
|
|
236
|
+
process.stdout.write("[upgrade] running post-install checks with the active clio binary\n");
|
|
237
|
+
} else if (method === "source") {
|
|
238
|
+
process.stdout.write("[upgrade] source checkout install detected; skipping npm install\n");
|
|
239
|
+
} else if (noNetwork) {
|
|
240
|
+
process.stdout.write("[upgrade] CLIO_CODER_TEST_UPGRADE_NO_NETWORK set, skipping npm install\n");
|
|
241
|
+
} else {
|
|
242
|
+
try {
|
|
243
|
+
await runNpmInstall(opts.channel);
|
|
244
|
+
} catch (err) {
|
|
245
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
246
|
+
return 1;
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
await runPostInstallUpgrade(opts);
|
|
250
|
+
printOk(`${before} -> post-install checks complete`);
|
|
251
|
+
return 0;
|
|
252
|
+
} catch (err) {
|
|
253
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
254
|
+
return 1;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
let appliedCount = 0;
|
|
258
|
+
let appliedIds = [];
|
|
259
|
+
if (opts.skipMigrations) {
|
|
260
|
+
process.stdout.write("[upgrade] skipping migrations (--skip-migrations)\n");
|
|
261
|
+
} else {
|
|
262
|
+
const loaded = await loadDomains([ConfigDomainModule, LifecycleDomainModule]);
|
|
263
|
+
try {
|
|
264
|
+
const lifecycle = loaded.getContract("lifecycle");
|
|
265
|
+
if (!lifecycle) {
|
|
266
|
+
printError("lifecycle domain unavailable");
|
|
267
|
+
return 1;
|
|
268
|
+
}
|
|
269
|
+
const result = await lifecycle.runMigrations(stateDir);
|
|
270
|
+
appliedIds = [...result.applied];
|
|
271
|
+
appliedCount = appliedIds.length;
|
|
272
|
+
if (appliedCount === 0) {
|
|
273
|
+
process.stdout.write("[upgrade] no pending migrations\n");
|
|
274
|
+
} else {
|
|
275
|
+
for (const id of appliedIds) process.stdout.write(`[upgrade] applied migration ${id}
|
|
276
|
+
`);
|
|
277
|
+
}
|
|
278
|
+
} finally {
|
|
279
|
+
await loaded.stop();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
if (method === "source" || noNetwork) {
|
|
283
|
+
initializeClioHome();
|
|
284
|
+
process.stdout.write("[upgrade] refreshed state metadata\n");
|
|
285
|
+
} else {
|
|
286
|
+
try {
|
|
287
|
+
await runDoctorFixAfterInstall();
|
|
288
|
+
} catch (err) {
|
|
289
|
+
printError(err instanceof Error ? err.message : String(err));
|
|
290
|
+
return 1;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (method === "source") printSourceUpgradeSteps();
|
|
294
|
+
const after = getVersionInfo().clio;
|
|
295
|
+
printOk(`${before} -> ${after} (migrations: ${appliedCount})`);
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
export {
|
|
299
|
+
runUpgradeCommand
|
|
300
|
+
};
|
|
301
|
+
//# sourceMappingURL=upgrade-WYYBKGDY.js.map
|