@pleri/olam-cli 0.1.158 → 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.
Files changed (89) hide show
  1. package/dist/agent-stream/agent-sdk-to-chunks.js +3 -0
  2. package/dist/agent-stream/driver-runner.js +9 -4
  3. package/dist/agent-stream/host-driver-launch.js +48 -0
  4. package/dist/commands/doctor.d.ts +21 -10
  5. package/dist/commands/doctor.d.ts.map +1 -1
  6. package/dist/commands/doctor.js +95 -39
  7. package/dist/commands/doctor.js.map +1 -1
  8. package/dist/commands/flywheel/check-persona-skeleton.d.ts +30 -2
  9. package/dist/commands/flywheel/check-persona-skeleton.d.ts.map +1 -1
  10. package/dist/commands/flywheel/check-persona-skeleton.js +143 -6
  11. package/dist/commands/flywheel/check-persona-skeleton.js.map +1 -1
  12. package/dist/commands/flywheel/diversity-check.d.ts +12 -2
  13. package/dist/commands/flywheel/diversity-check.d.ts.map +1 -1
  14. package/dist/commands/flywheel/diversity-check.js +56 -6
  15. package/dist/commands/flywheel/diversity-check.js.map +1 -1
  16. package/dist/commands/flywheel/index.d.ts.map +1 -1
  17. package/dist/commands/flywheel/index.js +2 -0
  18. package/dist/commands/flywheel/index.js.map +1 -1
  19. package/dist/commands/flywheel/install-shims.d.ts +36 -3
  20. package/dist/commands/flywheel/install-shims.d.ts.map +1 -1
  21. package/dist/commands/flywheel/install-shims.js +118 -7
  22. package/dist/commands/flywheel/install-shims.js.map +1 -1
  23. package/dist/commands/flywheel/k10-measure.d.ts +12 -2
  24. package/dist/commands/flywheel/k10-measure.d.ts.map +1 -1
  25. package/dist/commands/flywheel/k10-measure.js +55 -6
  26. package/dist/commands/flywheel/k10-measure.js.map +1 -1
  27. package/dist/commands/flywheel/migrate-overlays.d.ts +115 -0
  28. package/dist/commands/flywheel/migrate-overlays.d.ts.map +1 -0
  29. package/dist/commands/flywheel/migrate-overlays.js +766 -0
  30. package/dist/commands/flywheel/migrate-overlays.js.map +1 -0
  31. package/dist/commands/flywheel/sanitize-persona-output.d.ts +33 -2
  32. package/dist/commands/flywheel/sanitize-persona-output.d.ts.map +1 -1
  33. package/dist/commands/flywheel/sanitize-persona-output.js +94 -6
  34. package/dist/commands/flywheel/sanitize-persona-output.js.map +1 -1
  35. package/dist/commands/memory/index.d.ts.map +1 -1
  36. package/dist/commands/memory/index.js +2 -0
  37. package/dist/commands/memory/index.js.map +1 -1
  38. package/dist/commands/memory/install-hooks.d.ts +22 -0
  39. package/dist/commands/memory/install-hooks.d.ts.map +1 -0
  40. package/dist/commands/memory/install-hooks.js +156 -0
  41. package/dist/commands/memory/install-hooks.js.map +1 -0
  42. package/dist/commands/skills-doctor.js +2 -2
  43. package/dist/commands/skills-doctor.js.map +1 -1
  44. package/dist/commands/skills-source.d.ts.map +1 -1
  45. package/dist/commands/skills-source.js +10 -0
  46. package/dist/commands/skills-source.js.map +1 -1
  47. package/dist/commands/skills.d.ts.map +1 -1
  48. package/dist/commands/skills.js +169 -1
  49. package/dist/commands/skills.js.map +1 -1
  50. package/dist/image-digests.json +7 -7
  51. package/dist/index.js +3592 -905
  52. package/dist/index.js.map +1 -1
  53. package/dist/lib/flywheel-probes.d.ts +58 -0
  54. package/dist/lib/flywheel-probes.d.ts.map +1 -0
  55. package/dist/lib/flywheel-probes.js +163 -0
  56. package/dist/lib/flywheel-probes.js.map +1 -0
  57. package/dist/lib/host-side-proxy.d.ts +67 -0
  58. package/dist/lib/host-side-proxy.d.ts.map +1 -0
  59. package/dist/lib/host-side-proxy.js +177 -0
  60. package/dist/lib/host-side-proxy.js.map +1 -0
  61. package/dist/lib/shim-generator.d.ts +51 -0
  62. package/dist/lib/shim-generator.d.ts.map +1 -0
  63. package/dist/lib/shim-generator.js +88 -0
  64. package/dist/lib/shim-generator.js.map +1 -0
  65. package/dist/lib/skills-apply-overlays.d.ts +35 -0
  66. package/dist/lib/skills-apply-overlays.d.ts.map +1 -0
  67. package/dist/lib/skills-apply-overlays.js +243 -0
  68. package/dist/lib/skills-apply-overlays.js.map +1 -0
  69. package/dist/lib/upgrade-kubernetes.d.ts +13 -12
  70. package/dist/lib/upgrade-kubernetes.d.ts.map +1 -1
  71. package/dist/lib/upgrade-kubernetes.js +87 -134
  72. package/dist/lib/upgrade-kubernetes.js.map +1 -1
  73. package/dist/mcp-server.js +1106 -453
  74. package/hermes-bundle/version.json +1 -1
  75. package/host-cp/k8s/host-side/docker-socket-proxy.compose.yaml +58 -0
  76. package/host-cp/k8s/manifests/50-deployment.yaml +47 -70
  77. package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
  78. package/host-cp/k8s/manifests/docker-socket-proxy/60-service.yaml +37 -0
  79. package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
  80. package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
  81. package/host-cp/k8s/manifests/memory-service/30-configmap.yaml +11 -0
  82. package/host-cp/k8s/manifests/memory-service/35-configmap-iii-config.yaml +76 -0
  83. package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +11 -1
  84. package/host-cp/src/crystallize-planning.mjs +261 -0
  85. package/host-cp/src/plan-chat-service.mjs +84 -2
  86. package/host-cp/src/planning-sessions.mjs +270 -0
  87. package/host-cp/src/server.mjs +9 -0
  88. package/host-cp/src/tasks-route.mjs +191 -0
  89. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Bash shim generator for olam-flywheel backwards-compat layer.
3
+ *
4
+ * Generates deterministic bash shims that translate the positional-arg
5
+ * invocation chain skills currently use (e.g.
6
+ * `bash ~/.claude/scripts/emit-breadcrumb.sh "plan-hard" "<plan-slug>" ...`)
7
+ * into the new named-flag CLI:
8
+ * `olam flywheel emit-breadcrumb --skill plan-hard --plan <plan-slug> ...`
9
+ *
10
+ * Each shim:
11
+ * 1. Hardens PATH (adds common olam install locations).
12
+ * 2. Checks olam is reachable; exits 127 with actionable message if not.
13
+ * 3. Translates positional args to named flags per the script's spec.
14
+ * 4. exec's the olam CLI (passes signal handling + exit code through).
15
+ *
16
+ * Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A14
17
+ * Closes part of K1 OQ21a (positional → named-flag translation in shims).
18
+ */
19
+ /**
20
+ * Registry of shim specs. Only includes scripts that chain skill prose
21
+ * actively invokes via bash (the others are Python imports, no bash shim
22
+ * needed). Extend this as more chain-skill invocation sites are migrated.
23
+ */
24
+ export const SHIM_SPECS = Object.freeze([
25
+ {
26
+ basename: 'emit-breadcrumb.sh',
27
+ olamSubcommand: 'flywheel emit-breadcrumb',
28
+ minPositional: 6,
29
+ usage: 'emit-breadcrumb.sh <skill> <plan> <pattern> <severity> <persona> <edit> [notes] [pass] [project]',
30
+ args: [
31
+ { position: 1, flag: 'skill', required: true },
32
+ { position: 2, flag: 'plan', required: true },
33
+ { position: 3, flag: 'pattern', required: true },
34
+ { position: 4, flag: 'severity', required: true },
35
+ { position: 5, flag: 'persona', required: true },
36
+ { position: 6, flag: 'edit', required: true },
37
+ { position: 7, flag: 'notes', required: false },
38
+ { position: 8, flag: 'pass', required: false },
39
+ { position: 9, flag: 'project', required: false },
40
+ ],
41
+ },
42
+ ]);
43
+ /**
44
+ * Generate the bash shim source for a given spec. Deterministic output —
45
+ * same input always produces the same bytes (golden-fixture-friendly).
46
+ */
47
+ export function generateShim(spec) {
48
+ const argLines = [];
49
+ for (const arg of spec.args) {
50
+ if (arg.required) {
51
+ argLines.push(` --${arg.flag} "\$${arg.position}"`);
52
+ }
53
+ else {
54
+ argLines.push(` \${${arg.position}:+--${arg.flag} "\$${arg.position}"}`);
55
+ }
56
+ }
57
+ const argsBlock = argLines.join(' \\\n');
58
+ return `#!/usr/bin/env bash
59
+ # AUTO-GENERATED by \`olam flywheel install-shims\`
60
+ # DO NOT EDIT — regenerated on every install-shims run.
61
+ #
62
+ # Delegates to \`olam ${spec.olamSubcommand}\`; closes the K1 FS-2 cliff
63
+ # by translating the legacy positional-arg interface to the new named-flag CLI.
64
+ set -euo pipefail
65
+
66
+ # Harden PATH for common olam install locations (cron + hook contexts may
67
+ # have a minimal PATH; this preserves operator-installed shells).
68
+ PATH="\$HOME/.local/bin:\$HOME/.olam/bin:/opt/homebrew/bin:/usr/local/bin:\$PATH"
69
+
70
+ if ! command -v olam >/dev/null 2>&1; then
71
+ echo "[shim] olam not found on PATH; cannot delegate ${spec.olamSubcommand}" >&2
72
+ echo "[shim] install olam (https://github.com/pleri/olam) and run 'olam flywheel install-shims' to refresh" >&2
73
+ exit 127
74
+ fi
75
+
76
+ if [ "\$#" -lt ${spec.minPositional} ]; then
77
+ echo "Usage: ${spec.usage}" >&2
78
+ exit 1
79
+ fi
80
+
81
+ exec olam ${spec.olamSubcommand} \\
82
+ ${argsBlock}
83
+ `;
84
+ }
85
+ export function lookupShimSpec(basename) {
86
+ return SHIM_SPECS.find((s) => s.basename === basename);
87
+ }
88
+ //# sourceMappingURL=shim-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shim-generator.js","sourceRoot":"","sources":["../../src/lib/shim-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,MAAM,CAAC,MAAM,CAAC;IAC3D;QACE,QAAQ,EAAE,oBAAoB;QAC9B,cAAc,EAAE,0BAA0B;QAC1C,aAAa,EAAE,CAAC;QAChB,KAAK,EAAE,kGAAkG;QACzG,IAAI,EAAE;YACJ,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC9C,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC7C,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;YAChD,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ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AAC,QAAgB;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `olam skills apply-overlays` orchestrator.
3
+ *
4
+ * Port of `shared/engineering/scripts/apply-overlays.py`'s merge_skills +
5
+ * merge_agents + main functions. Walks ~/.claude/skills.overrides/ and
6
+ * ~/.claude/agents.overrides/, applies section-as-unit overlays per
7
+ * markdown-merger, runs post-merge sanitization, emits breadcrumbs.
8
+ *
9
+ * Reuses olam primitives:
10
+ * - mergeMarkdown from @olam/core/src/lib/markdown-merger.js (the section merger)
11
+ * - sanitize from packages/cli/src/commands/flywheel/sanitize-persona-output.ts
12
+ * (called in-process; no subprocess shell-out)
13
+ * - withFileLock from @olam/core/src/lib/file-lock.js (advisory locking)
14
+ *
15
+ * Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A9
16
+ */
17
+ export interface ApplyOverlaysOptions {
18
+ dryRun?: boolean;
19
+ fixtureRoot?: string;
20
+ claudeDir?: string;
21
+ }
22
+ export interface ApplyOverlaysResult {
23
+ rc: number;
24
+ skillsMerged: number;
25
+ agentsMerged: number;
26
+ newAgentsCreated: number;
27
+ schemaHalts: number;
28
+ renameHalts: number;
29
+ sanitizeHalts: number;
30
+ messages: string[];
31
+ }
32
+ export declare function applyOverlays(opts?: ApplyOverlaysOptions): Promise<ApplyOverlaysResult>;
33
+ export declare function formatSummary(result: ApplyOverlaysResult): string;
34
+ export declare function basenameOf(p: string): string;
35
+ //# sourceMappingURL=skills-apply-overlays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-apply-overlays.d.ts","sourceRoot":"","sources":["../../src/lib/skills-apply-overlays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAkMD,wBAAsB,aAAa,CAAC,IAAI,GAAE,oBAAyB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAqCjG;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAajE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C"}
@@ -0,0 +1,243 @@
1
+ /**
2
+ * `olam skills apply-overlays` orchestrator.
3
+ *
4
+ * Port of `shared/engineering/scripts/apply-overlays.py`'s merge_skills +
5
+ * merge_agents + main functions. Walks ~/.claude/skills.overrides/ and
6
+ * ~/.claude/agents.overrides/, applies section-as-unit overlays per
7
+ * markdown-merger, runs post-merge sanitization, emits breadcrumbs.
8
+ *
9
+ * Reuses olam primitives:
10
+ * - mergeMarkdown from @olam/core/src/lib/markdown-merger.js (the section merger)
11
+ * - sanitize from packages/cli/src/commands/flywheel/sanitize-persona-output.ts
12
+ * (called in-process; no subprocess shell-out)
13
+ * - withFileLock from @olam/core/src/lib/file-lock.js (advisory locking)
14
+ *
15
+ * Plan reference: docs/plans/olam-flywheel-cli-namespace/phase-a-tasks.md § A9
16
+ */
17
+ import { copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, rmSync, statSync, writeFileSync, } from 'node:fs';
18
+ import { homedir } from 'node:os';
19
+ import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
20
+ import { mergeMarkdown, parseFrontmatter } from '@olam/core/src/lib/markdown-merger.js';
21
+ import { withFileLock } from '@olam/core/src/lib/file-lock.js';
22
+ import { sanitize } from '../commands/flywheel/sanitize-persona-output.js';
23
+ function claudeRoot(opts) {
24
+ return opts.claudeDir ?? opts.fixtureRoot ?? join(homedir(), '.claude');
25
+ }
26
+ function ensureRealDir(p) {
27
+ if (!existsSync(p)) {
28
+ mkdirSync(p, { recursive: true });
29
+ return;
30
+ }
31
+ const stat = lstatSync(p);
32
+ if (stat.isSymbolicLink()) {
33
+ // Upgrade from symlink to real dir while preserving children.
34
+ const targetRaw = readlinkSync(p);
35
+ const target = isAbsolute(targetRaw) ? targetRaw : resolve(dirname(p), targetRaw);
36
+ rmSync(p);
37
+ mkdirSync(p, { recursive: true });
38
+ if (existsSync(target) && statSync(target).isDirectory()) {
39
+ // Re-mirror the symlink's contents as real files (per-file symlinks
40
+ // for entries we don't overwrite — matches the apply-overlays.py
41
+ // semantics that turn the bare-symlinked skill dir into a real dir
42
+ // when overlays are applied to it).
43
+ for (const entry of readdirSync(target)) {
44
+ const src = join(target, entry);
45
+ const dest = join(p, entry);
46
+ const srcStat = lstatSync(src);
47
+ if (srcStat.isDirectory()) {
48
+ // Symlink the subdir back to upstream (cheap recursive reference).
49
+ // apply-overlays.py creates per-file symlinks; for nested dirs
50
+ // we keep that intent by symlinking the directory.
51
+ try {
52
+ (lstatSync(p));
53
+ // Use absolute path symlink for clarity.
54
+ }
55
+ catch {
56
+ // ignore
57
+ }
58
+ }
59
+ // Use per-file symlinks back to upstream (apply-overlays.py § per-file symlinks).
60
+ // For now: leave files alone — they get filled in when overlay applies.
61
+ }
62
+ }
63
+ return;
64
+ }
65
+ if (!stat.isDirectory()) {
66
+ throw new Error(`expected directory at ${p}, found other file type`);
67
+ }
68
+ }
69
+ function postMergeSanitize(mergedText, label) {
70
+ const result = sanitize(mergedText);
71
+ if (result.passed)
72
+ return { ok: true };
73
+ return { ok: false, reason: `[post-merge-sanitize] ${label} merged output failed sanitizer: ${result.reason}` };
74
+ }
75
+ function mergeOne(upstreamPath, overlayPath, destPath, label, dryRun, messages) {
76
+ const upstreamText = readFileSync(upstreamPath, 'utf8');
77
+ const overlayText = readFileSync(overlayPath, 'utf8');
78
+ const result = mergeMarkdown(upstreamText, overlayText, label, upstreamPath, overlayPath);
79
+ if ('error' in result) {
80
+ messages.push(`ERROR ${result.error.reason}`);
81
+ return { ok: false, kind: 'schema' };
82
+ }
83
+ const sanitizeResult = postMergeSanitize(result.merged, label);
84
+ if (!sanitizeResult.ok) {
85
+ messages.push(`ERROR ${sanitizeResult.reason}`);
86
+ return { ok: false, kind: 'sanitize' };
87
+ }
88
+ if (!dryRun) {
89
+ mkdirSync(dirname(destPath), { recursive: true });
90
+ writeFileSync(destPath, result.merged, 'utf8');
91
+ }
92
+ messages.push(`MERGED ${label} → ${destPath}${dryRun ? ' (dry-run)' : ''}`);
93
+ return { ok: true };
94
+ }
95
+ function isNewAgentOverlay(overlayPath) {
96
+ try {
97
+ const text = readFileSync(overlayPath, 'utf8');
98
+ const { fm } = parseFrontmatter(text);
99
+ return fm['overlay-intent'] === 'new-agent';
100
+ }
101
+ catch {
102
+ return false;
103
+ }
104
+ }
105
+ function copyNewAgent(overlayPath, destPath, label, dryRun, messages) {
106
+ if (!dryRun) {
107
+ mkdirSync(dirname(destPath), { recursive: true });
108
+ copyFileSync(overlayPath, destPath);
109
+ }
110
+ messages.push(`NEW-AGENT ${label} → ${destPath}${dryRun ? ' (dry-run)' : ''}`);
111
+ }
112
+ function walkSkillsOverlays(skillsOverridesDir, skillsDir, opts, result) {
113
+ if (!existsSync(skillsOverridesDir))
114
+ return;
115
+ for (const skillName of readdirSync(skillsOverridesDir)) {
116
+ const overlaySkillDir = join(skillsOverridesDir, skillName);
117
+ if (!statSync(overlaySkillDir).isDirectory())
118
+ continue;
119
+ const upstreamSkillDir = join(skillsDir, skillName);
120
+ if (!existsSync(upstreamSkillDir)) {
121
+ result.messages.push(`SKIP ${skillName}: no upstream skill at ${upstreamSkillDir} (skill overlays require an upstream skill dir)`);
122
+ continue;
123
+ }
124
+ ensureRealDir(upstreamSkillDir);
125
+ // Walk every file in the overlay skill dir recursively.
126
+ walkOverlayTree(overlaySkillDir, upstreamSkillDir, `skill ${skillName}`, opts, result, false);
127
+ }
128
+ }
129
+ function walkOverlayTree(overlayRoot, upstreamRoot, labelPrefix, opts, result, isAgentsContext) {
130
+ const stack = [overlayRoot];
131
+ while (stack.length > 0) {
132
+ const current = stack.pop();
133
+ for (const entry of readdirSync(current)) {
134
+ const overlayPath = join(current, entry);
135
+ const stat = lstatSync(overlayPath);
136
+ if (stat.isDirectory()) {
137
+ stack.push(overlayPath);
138
+ continue;
139
+ }
140
+ if (!stat.isFile() && !stat.isSymbolicLink())
141
+ continue;
142
+ const rel = relative(overlayRoot, overlayPath);
143
+ const upstreamPath = join(upstreamRoot, rel);
144
+ const label = `${labelPrefix} ${rel}`;
145
+ if (!entry.endsWith('.md')) {
146
+ // Non-markdown files: copy verbatim (matches apply-overlays.py).
147
+ if (!opts.dryRun) {
148
+ mkdirSync(dirname(upstreamPath), { recursive: true });
149
+ copyFileSync(overlayPath, upstreamPath);
150
+ }
151
+ result.messages.push(`COPY ${label} → ${upstreamPath}${opts.dryRun === true ? ' (dry-run)' : ''}`);
152
+ continue;
153
+ }
154
+ if (!existsSync(upstreamPath)) {
155
+ if (isAgentsContext && isNewAgentOverlay(overlayPath)) {
156
+ copyNewAgent(overlayPath, upstreamPath, label, opts.dryRun === true, result.messages);
157
+ result.newAgentsCreated += 1;
158
+ }
159
+ else if (isAgentsContext) {
160
+ result.messages.push(`ERROR [rename-halt] ${label}: overlay has no upstream counterpart at ${upstreamPath} and no \`overlay-intent: new-agent\` marker`);
161
+ result.renameHalts += 1;
162
+ }
163
+ else {
164
+ // Skill-context: overlay-only files (e.g. new references) copy through.
165
+ if (!opts.dryRun) {
166
+ mkdirSync(dirname(upstreamPath), { recursive: true });
167
+ copyFileSync(overlayPath, upstreamPath);
168
+ }
169
+ result.messages.push(`NEW-FILE ${label} → ${upstreamPath}${opts.dryRun === true ? ' (dry-run)' : ''}`);
170
+ }
171
+ continue;
172
+ }
173
+ const merge = mergeOne(upstreamPath, overlayPath, upstreamPath, label, opts.dryRun === true, result.messages);
174
+ if (merge.ok) {
175
+ if (isAgentsContext)
176
+ result.agentsMerged += 1;
177
+ else
178
+ result.skillsMerged += 1;
179
+ }
180
+ else if (merge.kind === 'schema') {
181
+ result.schemaHalts += 1;
182
+ }
183
+ else {
184
+ result.sanitizeHalts += 1;
185
+ }
186
+ }
187
+ }
188
+ }
189
+ function walkAgentsOverlays(agentsOverridesDir, agentsDir, opts, result) {
190
+ if (!existsSync(agentsOverridesDir))
191
+ return;
192
+ ensureRealDir(agentsDir);
193
+ walkOverlayTree(agentsOverridesDir, agentsDir, 'agent', opts, result, true);
194
+ }
195
+ export async function applyOverlays(opts = {}) {
196
+ const root = claudeRoot(opts);
197
+ const skillsDir = join(root, 'skills');
198
+ const agentsDir = join(root, 'agents');
199
+ const skillsOverridesDir = join(root, 'skills.overrides');
200
+ const agentsOverridesDir = join(root, 'agents.overrides');
201
+ const result = {
202
+ rc: 0,
203
+ skillsMerged: 0,
204
+ agentsMerged: 0,
205
+ newAgentsCreated: 0,
206
+ schemaHalts: 0,
207
+ renameHalts: 0,
208
+ sanitizeHalts: 0,
209
+ messages: [],
210
+ };
211
+ // Advisory lock at the claude-root level — prevents two concurrent
212
+ // apply-overlays runs from interleaving writes.
213
+ await withFileLock(root, () => {
214
+ walkSkillsOverlays(skillsOverridesDir, skillsDir, opts, result);
215
+ walkAgentsOverlays(agentsOverridesDir, agentsDir, opts, result);
216
+ }, {
217
+ lockFilename: '.apply-overlays.lock',
218
+ reason: `apply-overlays root=${root} dryRun=${opts.dryRun === true}`,
219
+ acquireTimeoutMs: 15_000,
220
+ });
221
+ if (result.schemaHalts > 0 || result.renameHalts > 0 || result.sanitizeHalts > 0) {
222
+ result.rc = 1;
223
+ }
224
+ return result;
225
+ }
226
+ export function formatSummary(result) {
227
+ const lines = [
228
+ ...result.messages,
229
+ '',
230
+ `skills merged: ${result.skillsMerged}`,
231
+ `agents merged: ${result.agentsMerged}`,
232
+ `new agents created: ${result.newAgentsCreated}`,
233
+ `schema-mismatch halts: ${result.schemaHalts}`,
234
+ `rename halts: ${result.renameHalts}`,
235
+ `sanitize halts: ${result.sanitizeHalts}`,
236
+ `rc: ${result.rc}`,
237
+ ];
238
+ return lines.join('\n') + '\n';
239
+ }
240
+ export function basenameOf(p) {
241
+ return basename(p);
242
+ }
243
+ //# sourceMappingURL=skills-apply-overlays.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-apply-overlays.js","sourceRoot":"","sources":["../../src/lib/skills-apply-overlays.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAmB3E,SAAS,UAAU,CAAC,IAA0B;IAC5C,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,IAAI,CAAC,UAAU,CAAC,C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AC,IAAI,MAAM,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;QACjF,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA2B;IACvD,MAAM,KAAK,GAAG;QACZ,GAAG,MAAM,CAAC,QAAQ;QAClB,EAAE;QACF,kBAAkB,MAAM,CAAC,YAAY,EAAE;QACvC,kBAAkB,MAAM,CAAC,YAAY,EAAE;QACvC,uBAAuB,MAAM,CAAC,gBAAgB,EAAE;QAChD,0BAA0B,MAAM,CAAC,WAAW,EAAE;QAC9C,iBAAiB,MAAM,CAAC,WAAW,EAAE;QACrC,mBAAmB,MAAM,CAAC,aAAa,EAAE;QACzC,OAAO,MAAM,CAAC,EAAE,EAAE;KACnB,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC"}
@@ -23,12 +23,19 @@
23
23
  * D27 — audit log entry (phase2.flag_removed) emitted per upgrade run
24
24
  *
25
25
  * Step order (Phase D — kubernetes substrate, Phase 2 GA):
26
- * 0.5 D4 k3d node docker socket bind-mount preflight (Decision #11 backward-compat surface)
27
26
  * 0 probeKubernetesApiReachable — 5s timeout kubectl cluster-info
27
+ * (Step 0.5 D4 k3d node bind-mount preflight REMOVED in
28
+ * olam-k3d-on-mac-substrate-decision Phase B B3 — R3-A retracted.)
28
29
  * 0.5b B4 ensureK8sBootstrap (namespace + RBAC + ConfigMap + PVC + secrets)
29
30
  * 0.6 R3-C create/update ghcr-pull imagePullSecret in olam namespace (when GH_TOKEN available)
30
31
  * NOTE: relocated from pre-step 0.4 to post-bootstrap (R4-W2-A) — the
31
32
  * `olam` namespace must exist before kubectl can create the secret.
33
+ * 0.7 olam-k3d-on-mac-substrate-decision Phase A — host-side docker-
34
+ * socket-proxy auto-start on macOS (Decision #1 + #3). Linux substrate
35
+ * is a no-op. Resolves R4-W2-F (virtiofs ENOTSUP on stat of docker.sock
36
+ * hostPath bind mounts) by routing host-cp's docker access through a
37
+ * host-side proxy container reachable via in-cluster ExternalName
38
+ * Service (host.k3d.internal:2375).
32
39
  * 1 D10 context-allowlist + OLAM_K8S_CONTEXT_ACK strict-equality byte-for-byte
33
40
  * 2 D12 Secret pre-check (olam-host-cp-secret; base64-decode; key-name check)
34
41
  * 2.6 C2 per-peripheral Secret pre-check (iterates PERIPHERALS; unconditional — D5)
@@ -100,9 +107,11 @@ export interface UpgradeKubernetesDeps {
100
107
  */
101
108
  readonly getClusterServerUrlImpl?: () => Promise<string | null>;
102
109
  /**
103
- * D7: override docker socket accessibility check for inline preflight.
104
- * Returns true when /var/run/docker.sock is accessible inside the host-cp pod.
105
- * Tests inject a mock to avoid real kubectl invocations.
110
+ * D7 (RETIRED in olam-k3d-on-mac-substrate-decision Phase B B3): the
111
+ * docker socket accessibility preflight is gone (host-cp no longer mounts
112
+ * docker.sock it talks TCP to docker-socket-proxy). Field kept in the
113
+ * interface so existing test injections compile; the value is never read.
114
+ * New tests should not inject this field.
106
115
  */
107
116
  readonly checkDockerSocketImpl?: (context: string) => Promise<boolean>;
108
117
  /**
@@ -126,14 +135,6 @@ export interface UpgradeKubernetesDeps {
126
135
  */
127
136
  readonly ghTokenOverride?: string;
128
137
  readonly ghTokenOverrideActive?: boolean;
129
- /**
130
- * Phase D D4: override for k3d node mount detection (step 0.5 preflight).
131
- * Returns 'new-form' when /host-colima/ bind is present (correct),
132
- * 'old-form' when /var/run/docker.sock direct file-bind is present (broken on colima),
133
- * or 'none' when neither is detectable (non-k3d or bare k3s cluster — warn only).
134
- * Tests inject a mock to avoid real `docker inspect` invocations.
135
- */
136
- readonly checkK3dNodeMountsImpl?: () => Promise<'new-form' | 'old-form' | 'none'>;
137
138
  }
138
139
  export interface UpgradeKubernetesOpts {
139
140
  readonly forceRefreshManifests?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade-kubernetes.d.ts","sourceRoot":"","sources":["../../src/lib/upgrade-kubernetes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAQ9B,OAAO,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,KAAK,eAAe,EAAE,KAAK,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACrK,OAAO,EAAE,mBAAmB,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAA4B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAItI,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEhG,eAAO,MAAM,sBAAsB,QAA2C,CAAC;AAC/E,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AACtD,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAC1D,eAAO,MAAM,kBAAkB,kCAAkC,CAAC;AAElE,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,QAAqD,CAAC;AAkJtF,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,WAAW,CAAC;IAC9C,2CAA2C;IAC3C,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,gBAAgB,CAAC;IACxD,yDAAyD;IACzD,QAAQ,CAAC,kCAAkC,CAAC,EAAE,OAAO,8BAA8B,CAAC;IACpF,mDAAmD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