@pleri/olam-cli 0.1.159 → 0.1.160
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/dist/agent-stream/agent-sdk-to-chunks.js +3 -0
- package/dist/agent-stream/driver-runner.js +9 -4
- package/dist/agent-stream/host-driver-launch.js +48 -0
- package/dist/commands/flywheel/check-persona-skeleton.d.ts +30 -2
- package/dist/commands/flywheel/check-persona-skeleton.d.ts.map +1 -1
- package/dist/commands/flywheel/check-persona-skeleton.js +143 -6
- package/dist/commands/flywheel/check-persona-skeleton.js.map +1 -1
- package/dist/commands/flywheel/diversity-check.d.ts +12 -2
- package/dist/commands/flywheel/diversity-check.d.ts.map +1 -1
- package/dist/commands/flywheel/diversity-check.js +56 -6
- package/dist/commands/flywheel/diversity-check.js.map +1 -1
- package/dist/commands/flywheel/index.d.ts.map +1 -1
- package/dist/commands/flywheel/index.js +2 -0
- package/dist/commands/flywheel/index.js.map +1 -1
- package/dist/commands/flywheel/install-shims.d.ts +36 -3
- package/dist/commands/flywheel/install-shims.d.ts.map +1 -1
- package/dist/commands/flywheel/install-shims.js +118 -7
- package/dist/commands/flywheel/install-shims.js.map +1 -1
- package/dist/commands/flywheel/k10-measure.d.ts +12 -2
- package/dist/commands/flywheel/k10-measure.d.ts.map +1 -1
- package/dist/commands/flywheel/k10-measure.js +55 -6
- package/dist/commands/flywheel/k10-measure.js.map +1 -1
- package/dist/commands/flywheel/migrate-overlays.d.ts +115 -0
- package/dist/commands/flywheel/migrate-overlays.d.ts.map +1 -0
- package/dist/commands/flywheel/migrate-overlays.js +766 -0
- package/dist/commands/flywheel/migrate-overlays.js.map +1 -0
- package/dist/commands/flywheel/sanitize-persona-output.d.ts +33 -2
- package/dist/commands/flywheel/sanitize-persona-output.d.ts.map +1 -1
- package/dist/commands/flywheel/sanitize-persona-output.js +94 -6
- package/dist/commands/flywheel/sanitize-persona-output.js.map +1 -1
- package/dist/commands/memory/index.d.ts.map +1 -1
- package/dist/commands/memory/index.js +2 -0
- package/dist/commands/memory/index.js.map +1 -1
- package/dist/commands/memory/install-hooks.d.ts +22 -0
- package/dist/commands/memory/install-hooks.d.ts.map +1 -0
- package/dist/commands/memory/install-hooks.js +156 -0
- package/dist/commands/memory/install-hooks.js.map +1 -0
- package/dist/commands/skills-doctor.js +2 -2
- package/dist/commands/skills-doctor.js.map +1 -1
- package/dist/commands/skills-source.d.ts.map +1 -1
- package/dist/commands/skills-source.js +10 -0
- package/dist/commands/skills-source.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +169 -1
- package/dist/commands/skills.js.map +1 -1
- package/dist/image-digests.json +7 -7
- package/dist/index.js +3046 -718
- package/dist/lib/flywheel-probes.d.ts +58 -0
- package/dist/lib/flywheel-probes.d.ts.map +1 -0
- package/dist/lib/flywheel-probes.js +163 -0
- package/dist/lib/flywheel-probes.js.map +1 -0
- package/dist/lib/shim-generator.d.ts +51 -0
- package/dist/lib/shim-generator.d.ts.map +1 -0
- package/dist/lib/shim-generator.js +88 -0
- package/dist/lib/shim-generator.js.map +1 -0
- package/dist/lib/skills-apply-overlays.d.ts +35 -0
- package/dist/lib/skills-apply-overlays.d.ts.map +1 -0
- package/dist/lib/skills-apply-overlays.js +243 -0
- package/dist/lib/skills-apply-overlays.js.map +1 -0
- package/dist/mcp-server.js +1106 -453
- package/hermes-bundle/version.json +1 -1
- package/host-cp/k8s/manifests/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
- package/host-cp/k8s/manifests/memory-service/30-configmap.yaml +11 -0
- package/host-cp/k8s/manifests/memory-service/35-configmap-iii-config.yaml +76 -0
- package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +11 -1
- package/host-cp/src/crystallize-planning.mjs +261 -0
- package/host-cp/src/plan-chat-service.mjs +84 -2
- package/host-cp/src/planning-sessions.mjs +270 -0
- package/package.json +1 -1
|
@@ -1,15 +1,126 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `olam flywheel install-shims` —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* `olam flywheel install-shims` — write backwards-compat shims to ~/.claude/scripts/.
|
|
3
|
+
*
|
|
4
|
+
* Generates a bash shim per spec in SHIM_SPECS and writes it to
|
|
5
|
+
* ~/.claude/scripts/<basename>. Detects existing non-shim files (operator's
|
|
6
|
+
* own scripts or atlas-toolbox-shipped originals) and prompts/backs-up
|
|
7
|
+
* before overwriting. Idempotent — re-runs produce no diff when content
|
|
8
|
+
* matches.
|
|
9
|
+
*
|
|
10
|
+
* Replaces the A1 stub.
|
|
11
|
+
*
|
|
12
|
+
* Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A14
|
|
13
|
+
* Closes part of K1 OQ20 (correct hook-point for shim installation).
|
|
5
14
|
*/
|
|
15
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { homedir } from 'node:os';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { SHIM_SPECS, generateShim } from '../../lib/shim-generator.js';
|
|
19
|
+
const SHIM_HEADER_MARKER = '# AUTO-GENERATED by `olam flywheel install-shims`';
|
|
20
|
+
/**
|
|
21
|
+
* Programmatic API for refreshing all shims. Used by:
|
|
22
|
+
* - `olam flywheel install-shims` CLI action (this file).
|
|
23
|
+
* - `olam skills source pull` post-step (B2 hook point).
|
|
24
|
+
*/
|
|
25
|
+
export function refreshShims(opts = {}) {
|
|
26
|
+
const targetDir = opts.targetDir ?? join(homedir(), '.claude', 'scripts');
|
|
27
|
+
const results = [];
|
|
28
|
+
let written = 0;
|
|
29
|
+
let overwritten = 0;
|
|
30
|
+
let unchanged = 0;
|
|
31
|
+
let preserved = 0;
|
|
32
|
+
for (const spec of SHIM_SPECS) {
|
|
33
|
+
const result = installOne(spec, targetDir, opts);
|
|
34
|
+
results.push(result);
|
|
35
|
+
switch (result.action) {
|
|
36
|
+
case 'written':
|
|
37
|
+
written += 1;
|
|
38
|
+
break;
|
|
39
|
+
case 'overwritten':
|
|
40
|
+
overwritten += 1;
|
|
41
|
+
break;
|
|
42
|
+
case 'unchanged':
|
|
43
|
+
unchanged += 1;
|
|
44
|
+
break;
|
|
45
|
+
case 'preserved-existing':
|
|
46
|
+
preserved += 1;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { results, written, overwritten, unchanged, preserved };
|
|
51
|
+
}
|
|
52
|
+
function isOlamGeneratedShim(text) {
|
|
53
|
+
return text.includes(SHIM_HEADER_MARKER);
|
|
54
|
+
}
|
|
55
|
+
function installOne(spec, targetDir, opts) {
|
|
56
|
+
const targetPath = join(targetDir, spec.basename);
|
|
57
|
+
const newContent = generateShim(spec);
|
|
58
|
+
if (!existsSync(targetPath)) {
|
|
59
|
+
if (opts.dryRun !== true) {
|
|
60
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
61
|
+
writeFileSync(targetPath, newContent, { mode: 0o755 });
|
|
62
|
+
}
|
|
63
|
+
return { basename: spec.basename, action: 'written', targetPath };
|
|
64
|
+
}
|
|
65
|
+
const existing = readFileSync(targetPath, 'utf8');
|
|
66
|
+
if (existing === newContent) {
|
|
67
|
+
return { basename: spec.basename, action: 'unchanged', targetPath };
|
|
68
|
+
}
|
|
69
|
+
// Existing file with different content. If it's our generated shim (older
|
|
70
|
+
// version), overwrite freely. Otherwise it's operator/atlas-toolbox content
|
|
71
|
+
// — back up unless --force.
|
|
72
|
+
if (isOlamGeneratedShim(existing)) {
|
|
73
|
+
if (opts.dryRun !== true) {
|
|
74
|
+
writeFileSync(targetPath, newContent, { mode: 0o755 });
|
|
75
|
+
}
|
|
76
|
+
return { basename: spec.basename, action: 'overwritten', targetPath };
|
|
77
|
+
}
|
|
78
|
+
if (opts.force === true) {
|
|
79
|
+
const backupPath = `${targetPath}.shim-backup-${Math.floor(Date.now() / 1000)}`;
|
|
80
|
+
if (opts.dryRun !== true) {
|
|
81
|
+
copyFileSync(targetPath, backupPath);
|
|
82
|
+
writeFileSync(targetPath, newContent, { mode: 0o755 });
|
|
83
|
+
}
|
|
84
|
+
return { basename: spec.basename, action: 'overwritten', targetPath, backupPath };
|
|
85
|
+
}
|
|
86
|
+
// Without --force, preserve existing.
|
|
87
|
+
return { basename: spec.basename, action: 'preserved-existing', targetPath };
|
|
88
|
+
}
|
|
6
89
|
export function registerFlywheelInstallShims(parent) {
|
|
7
90
|
parent
|
|
8
91
|
.command('install-shims')
|
|
9
|
-
.description('
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
92
|
+
.description('Install backwards-compat bash shims under ~/.claude/scripts/ that delegate to olam flywheel <subcmd>')
|
|
93
|
+
.option('--force', 'overwrite existing non-shim files (backs them up to .shim-backup-<ts>)')
|
|
94
|
+
.option('--dry-run', 'preview which shims would be written without modifying disk')
|
|
95
|
+
.option('--target-dir <path>', 'override target directory (default: ~/.claude/scripts/); for tests')
|
|
96
|
+
.action((opts) => {
|
|
97
|
+
const targetDir = opts.targetDir ?? join(homedir(), '.claude', 'scripts');
|
|
98
|
+
const summary = refreshShims(opts);
|
|
99
|
+
const lines = [];
|
|
100
|
+
const dryRunSuffix = opts.dryRun === true ? ' (dry-run)' : '';
|
|
101
|
+
for (const result of summary.results) {
|
|
102
|
+
switch (result.action) {
|
|
103
|
+
case 'written':
|
|
104
|
+
lines.push(` WRITTEN ${result.targetPath}${dryRunSuffix}`);
|
|
105
|
+
break;
|
|
106
|
+
case 'overwritten':
|
|
107
|
+
lines.push(` OVERWRITTEN ${result.targetPath}${dryRunSuffix}${result.backupPath !== undefined ? ` (backup: ${result.backupPath})` : ''}`);
|
|
108
|
+
break;
|
|
109
|
+
case 'unchanged':
|
|
110
|
+
lines.push(` UNCHANGED ${result.targetPath}`);
|
|
111
|
+
break;
|
|
112
|
+
case 'preserved-existing':
|
|
113
|
+
lines.push(` PRESERVED ${result.targetPath} (existing non-shim file; use --force to overwrite + backup)`);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
process.stdout.write(`olam flywheel install-shims → ${targetDir}\n`);
|
|
118
|
+
for (const line of lines)
|
|
119
|
+
process.stdout.write(line + '\n');
|
|
120
|
+
process.stdout.write(`\nwritten: ${summary.written}, overwritten: ${summary.overwritten}, unchanged: ${summary.unchanged}, preserved: ${summary.preserved}\n`);
|
|
121
|
+
// Preserved files indicate operator action needed; exit 1 to surface.
|
|
122
|
+
if (summary.preserved > 0)
|
|
123
|
+
process.exit(1);
|
|
13
124
|
});
|
|
14
125
|
}
|
|
15
126
|
//# sourceMappingURL=install-shims.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-shims.js","sourceRoot":"","sources":["../../../src/commands/flywheel/install-shims.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"install-shims.js","sourceRoot":"","sources":["../../../src/commands/flywheel/install-shims.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrG,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAiB,MAAM,6BAA6B,CAAC;AAEtF,MAAM,kBAAkB,GAAG,mDAAmD,CAAC;AAuB/E;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B,EAAE;IACzD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,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,EAAE,EAAE,CAAC,CAAC;oBAC3I,MAAM;gBACR,KAAK,WAAW;oBACd,KAAK,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;oBACjD,MAAM;gBACR,KAAK,oBAAoB;oBACvB,KAAK,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,UAAU,8DAA8D,CAAC,CAAC;oBAC7G,MAAM;YACV,CAAC;QACH,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,SAAS,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,cAAc,OAAO,CAAC,OAAO,kBAAkB,OAAO,CAAC,WAAW,gBAAgB,OAAO,CAAC,SAAS,gBAAgB,OAAO,CAAC,SAAS,IAAI,CACzI,CAAC;QACF,sEAAsE;QACtE,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `olam flywheel k10-measure` —
|
|
3
|
-
*
|
|
2
|
+
* `olam flywheel k10-measure` — K10 token-budget measurement CLI.
|
|
3
|
+
*
|
|
4
|
+
* Reads `--upstream <path>` + optional `--overlay <path>`; counts tokens via
|
|
5
|
+
* the len/CHARS_PER_TOKEN heuristic; emits PASS/REJECT verdict matching the
|
|
6
|
+
* Python predecessor's compute_budget contract.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes:
|
|
9
|
+
* 0 = PASS (within budget OR no overlay)
|
|
10
|
+
* 1 = REJECT (over budget)
|
|
11
|
+
* 2 = unexpected error (cannot read upstream file)
|
|
12
|
+
*
|
|
13
|
+
* Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A5
|
|
4
14
|
*/
|
|
5
15
|
import type { Command } from 'commander';
|
|
6
16
|
export declare function registerFlywheelK10Measure(parent: Command): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k10-measure.d.ts","sourceRoot":"","sources":["../../../src/commands/flywheel/k10-measure.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"k10-measure.d.ts","sourceRoot":"","sources":["../../../src/commands/flywheel/k10-measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgDhE"}
|
|
@@ -1,14 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `olam flywheel k10-measure` —
|
|
3
|
-
*
|
|
2
|
+
* `olam flywheel k10-measure` — K10 token-budget measurement CLI.
|
|
3
|
+
*
|
|
4
|
+
* Reads `--upstream <path>` + optional `--overlay <path>`; counts tokens via
|
|
5
|
+
* the len/CHARS_PER_TOKEN heuristic; emits PASS/REJECT verdict matching the
|
|
6
|
+
* Python predecessor's compute_budget contract.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes:
|
|
9
|
+
* 0 = PASS (within budget OR no overlay)
|
|
10
|
+
* 1 = REJECT (over budget)
|
|
11
|
+
* 2 = unexpected error (cannot read upstream file)
|
|
12
|
+
*
|
|
13
|
+
* Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A5
|
|
4
14
|
*/
|
|
15
|
+
import { readFileSync } from 'node:fs';
|
|
16
|
+
import { computeBudget, tokensFromText } from '@olam/core/src/lib/k10-budget.js';
|
|
5
17
|
export function registerFlywheelK10Measure(parent) {
|
|
6
18
|
parent
|
|
7
19
|
.command('k10-measure')
|
|
8
|
-
.description('
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
.description('Measure K10 token budget for upstream + optional overlay; emit PASS/REJECT verdict')
|
|
21
|
+
.requiredOption('--upstream <path>', 'path to upstream file (e.g. persona prompt)')
|
|
22
|
+
.option('--overlay <path>', 'path to overlay file (omit if none — PASS without enforcement)')
|
|
23
|
+
.option('--json', 'emit verdict as JSON instead of human-readable')
|
|
24
|
+
.action((opts) => {
|
|
25
|
+
let upstreamText;
|
|
26
|
+
try {
|
|
27
|
+
upstreamText = readFileSync(opts.upstream, 'utf8');
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
process.stderr.write(`[k10-measure-error] cannot read upstream ${opts.upstream}: ${err instanceof Error ? err.message : 'unknown'}\n`);
|
|
31
|
+
process.exit(2);
|
|
32
|
+
}
|
|
33
|
+
const upstreamTokens = tokensFromText(upstreamText);
|
|
34
|
+
let overlayTokens = null;
|
|
35
|
+
if (opts.overlay !== undefined) {
|
|
36
|
+
try {
|
|
37
|
+
const overlayText = readFileSync(opts.overlay, 'utf8');
|
|
38
|
+
overlayTokens = tokensFromText(overlayText);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
process.stderr.write(`[k10-measure-error] cannot read overlay ${opts.overlay}: ${err instanceof Error ? err.message : 'unknown'}\n`);
|
|
42
|
+
process.exit(2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const result = computeBudget(upstreamTokens, overlayTokens);
|
|
46
|
+
if (opts.json) {
|
|
47
|
+
process.stdout.write(JSON.stringify(result) + '\n');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
process.stdout.write(`${result.verdict}: ${result.message}\n`);
|
|
51
|
+
process.stdout.write(` upstream_tokens: ${result.upstream_tokens}\n`);
|
|
52
|
+
if (result.overlay_tokens !== null) {
|
|
53
|
+
process.stdout.write(` overlay_tokens: ${result.overlay_tokens}\n`);
|
|
54
|
+
}
|
|
55
|
+
if (result.merged !== null) {
|
|
56
|
+
process.stdout.write(` merged: ${result.merged}\n`);
|
|
57
|
+
}
|
|
58
|
+
process.stdout.write(` remaining: ${result.remaining} of ${5500} cap\n`);
|
|
59
|
+
}
|
|
60
|
+
process.exit(result.verdict === 'PASS' ? 0 : 1);
|
|
12
61
|
});
|
|
13
62
|
}
|
|
14
63
|
//# sourceMappingURL=k10-measure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"k10-measure.js","sourceRoot":"","sources":["../../../src/commands/flywheel/k10-measure.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"k10-measure.js","sourceRoot":"","sources":["../../../src/commands/flywheel/k10-measure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAQjF,MAAM,UAAU,0BAA0B,CAAC,MAAe;IACxD,MAAM;SACH,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,oFAAoF,CAAC;SACjG,cAAc,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;SAClF,MAAM,CAAC,kBAAkB,EAAE,gEAAgE,CAAC;SAC5F,MAAM,CAAC,QAAQ,EAAE,gDAAgD,CAAC;SAClE,MAAM,CAAC,CAAC,IAA+B,EAAE,EAAE;QAC1C,IAAI,YAAoB,CAAC;QACzB,IAAI,CAAC;YACH,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,4CAA4C,IAAI,CAAC,QAAQ,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,IAAI,CACjH,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;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B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,MAAM,CAAC,SAAS,OAAO,IAAI,QAAQ,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `olam flywheel migrate-overlays` — operator-local overlay-layer migration.
|
|
3
|
+
*
|
|
4
|
+
* Scans `~/.claude/{skills,agents}.overrides/` recursively for hardcoded
|
|
5
|
+
* `~/.claude/scripts/<name>` references matching the SHIM_TARGETS registry;
|
|
6
|
+
* sed-replaces each match with the corresponding `olam flywheel <subcmd>`
|
|
7
|
+
* invocation. Each operator runs this once to migrate THEIR layer 3
|
|
8
|
+
* (per-user overlay files) from the legacy script-path contract to the new
|
|
9
|
+
* flywheel CLI surface.
|
|
10
|
+
*
|
|
11
|
+
* Closes K1 OQ23 (pass-3 resolution): the migration helper that scales
|
|
12
|
+
* the namespace migration beyond just this operator's overlays. Each
|
|
13
|
+
* operator with their own `.overrides/` tree runs this command once.
|
|
14
|
+
*
|
|
15
|
+
* Replaces:
|
|
16
|
+
* `bash ~/.claude/scripts/emit-breadcrumb.sh ...` → `olam flywheel emit-breadcrumb ...`
|
|
17
|
+
* `python3 ~/.claude/scripts/sanitize-persona-output.py ...` → `olam flywheel sanitize-persona-output ...`
|
|
18
|
+
* `~/.claude/scripts/k5-rubric-helper.py` → `olam flywheel k5-validate`
|
|
19
|
+
* etc. (full set per SHIM_TARGETS registry at @olam/core/lib/shim-targets)
|
|
20
|
+
*
|
|
21
|
+
* Flags:
|
|
22
|
+
* --dry-run — preview changes without writing
|
|
23
|
+
* --target-dir <path> — override the search root (default: ~/.claude/); for tests
|
|
24
|
+
* --json — emit summary as JSON for tooling
|
|
25
|
+
*
|
|
26
|
+
* --push — PUSH mode: copy overlays into atlas-toolbox clone
|
|
27
|
+
* --target <name> — required with --push; name of a registered skill source
|
|
28
|
+
*
|
|
29
|
+
* Idempotent: re-runs against already-migrated overlays produce no diff.
|
|
30
|
+
*
|
|
31
|
+
* Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-c-tasks.md § C7
|
|
32
|
+
* Phase B: docs/plans/member-overlays-sync/phase-b-tasks.md
|
|
33
|
+
*/
|
|
34
|
+
import type { Command } from 'commander';
|
|
35
|
+
interface MigrateOverlaysOptions {
|
|
36
|
+
dryRun?: boolean;
|
|
37
|
+
targetDir?: string;
|
|
38
|
+
json?: boolean;
|
|
39
|
+
push?: boolean;
|
|
40
|
+
target?: string;
|
|
41
|
+
forceCurrentBranch?: boolean;
|
|
42
|
+
initMember?: string;
|
|
43
|
+
/** For tests: inject clone path directly instead of reading from registry. */
|
|
44
|
+
_testClonePath?: string;
|
|
45
|
+
/** For tests: inject atlas-user directly instead of reading ~/.claude/.atlas-user. */
|
|
46
|
+
_testAtlasUser?: string;
|
|
47
|
+
/** For tests: override OLAM_CLAUDE_DIR for resolveAtlasUser. */
|
|
48
|
+
_testClaudeDir?: string;
|
|
49
|
+
/** For tests: inject git URLs by source name. */
|
|
50
|
+
_testSkillSources?: Array<{
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
gitUrl: string;
|
|
54
|
+
branch: string;
|
|
55
|
+
addedAt: number;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
interface FileMigrationResult {
|
|
59
|
+
path: string;
|
|
60
|
+
replacements: Array<{
|
|
61
|
+
basename: string;
|
|
62
|
+
count: number;
|
|
63
|
+
replacedBy: string;
|
|
64
|
+
}>;
|
|
65
|
+
totalReplacements: number;
|
|
66
|
+
}
|
|
67
|
+
interface MigrationSummary {
|
|
68
|
+
scanned: number;
|
|
69
|
+
modified: number;
|
|
70
|
+
unchanged: number;
|
|
71
|
+
totalReplacements: number;
|
|
72
|
+
perFile: FileMigrationResult[];
|
|
73
|
+
}
|
|
74
|
+
export interface PushSummary {
|
|
75
|
+
filesCopied: number;
|
|
76
|
+
filesUnchanged: number;
|
|
77
|
+
filesCreated: number;
|
|
78
|
+
branchName: string;
|
|
79
|
+
nextStepGhCommand: string;
|
|
80
|
+
/** Full copy-paste block for stdout in human mode; populated only on real (non-dry-run) run. */
|
|
81
|
+
_copyPasteBlock?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface InitMemberSummary {
|
|
84
|
+
memberName: string;
|
|
85
|
+
branchName: string;
|
|
86
|
+
nextStepGhCommand: string;
|
|
87
|
+
/** Paths created or would-create in dry-run. */
|
|
88
|
+
createdPaths: string[];
|
|
89
|
+
/** Full copy-paste block for stdout in human mode; absent in dry-run. */
|
|
90
|
+
_copyPasteBlock?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Error thrown by push-mode operations. Carries an exit code so callers
|
|
94
|
+
* can distinguish between different failure scenarios.
|
|
95
|
+
*/
|
|
96
|
+
export declare class PushError extends Error {
|
|
97
|
+
readonly exitCode: number;
|
|
98
|
+
constructor(exitCode: number, message: string);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Core push-overlays implementation (Phase B).
|
|
102
|
+
* Returns PushSummary. Throws PushError on validation/pre-flight failures
|
|
103
|
+
* (lets callers handle process.exit vs test assertions cleanly).
|
|
104
|
+
*/
|
|
105
|
+
export declare function pushOverlays(opts: MigrateOverlaysOptions): PushSummary;
|
|
106
|
+
/**
|
|
107
|
+
* Scaffold members/<name>/{skills,agents}.overrides/.gitkeep + README.md
|
|
108
|
+
* in the atlas-toolbox clone. Leaves the working tree dirty.
|
|
109
|
+
* Throws PushError on validation / pre-flight / idempotency failures.
|
|
110
|
+
*/
|
|
111
|
+
export declare function initMember(opts: MigrateOverlaysOptions): InitMemberSummary;
|
|
112
|
+
export declare function migrateOverlays(opts?: MigrateOverlaysOptions): MigrationSummary;
|
|
113
|
+
export declare function registerFlywheelMigrateOverlays(parent: Command): void;
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=migrate-overlays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-overlays.d.ts","sourceRoot":"","sources":["../../../src/commands/flywheel/migrate-overlays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAcH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,UAAU,sBAAsB;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1G;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,M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