oh-my-claudecode 0.2.3 → 0.2.5
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/README.md +50 -2
- package/commands/necronomicon-bind.md +69 -0
- package/dist/cli/bind-cron.d.ts +86 -0
- package/dist/cli/bind-cron.d.ts.map +1 -0
- package/dist/cli/bind-cron.js +161 -0
- package/dist/cli/bind-cron.js.map +1 -0
- package/dist/cli/bind.d.ts +102 -0
- package/dist/cli/bind.d.ts.map +1 -0
- package/dist/cli/bind.js +466 -0
- package/dist/cli/bind.js.map +1 -0
- package/dist/cli/index.js +102 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/project-scan.d.ts +94 -0
- package/dist/cli/project-scan.d.ts.map +1 -0
- package/dist/cli/project-scan.js +387 -0
- package/dist/cli/project-scan.js.map +1 -0
- package/dist/cli/sisyphus-migrate.d.ts +50 -0
- package/dist/cli/sisyphus-migrate.d.ts.map +1 -0
- package/dist/cli/sisyphus-migrate.js +226 -0
- package/dist/cli/sisyphus-migrate.js.map +1 -0
- package/dist/cli/tui.d.ts +94 -0
- package/dist/cli/tui.d.ts.map +1 -0
- package/dist/cli/tui.js +180 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +28 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/config/schema.d.ts +4 -4
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/features/yith-archive/functions/backfill.d.ts +43 -0
- package/dist/features/yith-archive/functions/backfill.d.ts.map +1 -1
- package/dist/features/yith-archive/functions/backfill.js +303 -145
- package/dist/features/yith-archive/functions/backfill.js.map +1 -1
- package/dist/features/yith-archive/functions/compress-batch.d.ts +4 -0
- package/dist/features/yith-archive/functions/compress-batch.d.ts.map +1 -0
- package/dist/features/yith-archive/functions/compress-batch.js +290 -0
- package/dist/features/yith-archive/functions/compress-batch.js.map +1 -0
- package/dist/features/yith-archive/functions/compress.d.ts +2 -1
- package/dist/features/yith-archive/functions/compress.d.ts.map +1 -1
- package/dist/features/yith-archive/functions/compress.js +1 -1
- package/dist/features/yith-archive/functions/compress.js.map +1 -1
- package/dist/features/yith-archive/functions/opencode-import.d.ts +67 -0
- package/dist/features/yith-archive/functions/opencode-import.d.ts.map +1 -0
- package/dist/features/yith-archive/functions/opencode-import.js +272 -0
- package/dist/features/yith-archive/functions/opencode-import.js.map +1 -0
- package/dist/features/yith-archive/index.d.ts.map +1 -1
- package/dist/features/yith-archive/index.js +4 -0
- package/dist/features/yith-archive/index.js.map +1 -1
- package/dist/features/yith-archive/providers/embedding/local.d.ts +22 -0
- package/dist/features/yith-archive/providers/embedding/local.d.ts.map +1 -1
- package/dist/features/yith-archive/providers/embedding/local.js +56 -2
- package/dist/features/yith-archive/providers/embedding/local.js.map +1 -1
- package/dist/features/yith-archive/state/bind-state.d.ts +84 -0
- package/dist/features/yith-archive/state/bind-state.d.ts.map +1 -0
- package/dist/features/yith-archive/state/bind-state.js +120 -0
- package/dist/features/yith-archive/state/bind-state.js.map +1 -0
- package/dist/features/yith-archive/state/schema.d.ts +14 -0
- package/dist/features/yith-archive/state/schema.d.ts.map +1 -1
- package/dist/features/yith-archive/state/schema.js +14 -0
- package/dist/features/yith-archive/state/schema.js.map +1 -1
- package/dist/hooks/cthulhu-auto.d.ts +1 -1
- package/dist/hooks/cthulhu-auto.d.ts.map +1 -1
- package/dist/hooks/cthulhu-auto.js +75 -11
- package/dist/hooks/cthulhu-auto.js.map +1 -1
- package/dist/hooks/cthulhu-preflight.d.ts +45 -0
- package/dist/hooks/cthulhu-preflight.d.ts.map +1 -0
- package/dist/hooks/cthulhu-preflight.js +91 -0
- package/dist/hooks/cthulhu-preflight.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/yith-capture.d.ts +35 -0
- package/dist/hooks/yith-capture.d.ts.map +1 -0
- package/dist/hooks/yith-capture.js +113 -0
- package/dist/hooks/yith-capture.js.map +1 -0
- package/package.json +5 -2
- package/commands/bind-necronomicon.md +0 -106
package/dist/cli/bind.js
ADDED
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oh-my-claudecode bind — the CLI subcommand that drives the
|
|
3
|
+
* Necronomicon binding ritual.
|
|
4
|
+
*
|
|
5
|
+
* Architecture: a state-machine runner (`runBind`) reads `KV.bindState`,
|
|
6
|
+
* walks through each phase in `BIND_PHASE_ORDER`, invokes the matching
|
|
7
|
+
* `PhaseRunner`, and persists progress after every transition. Phases
|
|
8
|
+
* are injectable — tests pass fakes; production passes the real
|
|
9
|
+
* runners defined in `defaultPhaseRunners()`.
|
|
10
|
+
*
|
|
11
|
+
* Failure semantics: if any phase throws, `runBind` records the error
|
|
12
|
+
* into bindState, halts (does NOT run subsequent phases), and returns.
|
|
13
|
+
* The CLI entry point surfaces the error via the TUI and exits with
|
|
14
|
+
* a non-zero code. A re-run picks up from the failed phase and retries
|
|
15
|
+
* it — the state machine treats `failed` the same as `pending`.
|
|
16
|
+
*
|
|
17
|
+
* Cron-friendly: the same entry point is called from `bind --resume`
|
|
18
|
+
* which prints to stdout and exits, so a crontab can invoke it on
|
|
19
|
+
* an interval without an interactive session.
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
22
|
+
import { homedir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { KV } from "../features/yith-archive/state/schema.js";
|
|
25
|
+
import { migrateSisyphusDir } from "./sisyphus-migrate.js";
|
|
26
|
+
import { projectSummaryToObservations, scanProject, } from "./project-scan.js";
|
|
27
|
+
import { BIND_PHASE_ORDER, initialBindState, markPhase, } from "../features/yith-archive/state/bind-state.js";
|
|
28
|
+
import { renderProgressBar, renderSectionHeader, renderStatusLine, formatBytes, formatDuration, } from "./tui.js";
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Phase label + runner
|
|
31
|
+
// ============================================================================
|
|
32
|
+
/** Human-readable label for each phase — what the user sees in the TUI. */
|
|
33
|
+
function phaseLabel(phase) {
|
|
34
|
+
switch (phase) {
|
|
35
|
+
case "embedding_download":
|
|
36
|
+
return "Phase I: The Embedding Sigil";
|
|
37
|
+
case "claude_transcripts":
|
|
38
|
+
return "Phase II: Claude Code Transcripts";
|
|
39
|
+
case "opencode_import":
|
|
40
|
+
return "Phase III: Opencode Grimoire";
|
|
41
|
+
case "sisyphus_migrate":
|
|
42
|
+
return "Phase IV: Sisyphus Migration";
|
|
43
|
+
case "preliminary_seed":
|
|
44
|
+
return "Phase V: Project Code Scan";
|
|
45
|
+
case "pending_compression_trigger":
|
|
46
|
+
return "Phase VI: Sealing the Tome";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* State-machine driver. Reads bindState, runs pending phases in order,
|
|
51
|
+
* persists progress after each, halts on first failure.
|
|
52
|
+
*
|
|
53
|
+
* Returns the final BindState so callers (the CLI entry point) can
|
|
54
|
+
* summarize what happened and exit with the right code.
|
|
55
|
+
*/
|
|
56
|
+
export async function runBind(opts) {
|
|
57
|
+
const { archive, tui, phases = defaultPhaseRunners(), force, onlyPhases, projectCwd, } = opts;
|
|
58
|
+
const kv = archive.kv;
|
|
59
|
+
// Load or create bindState.
|
|
60
|
+
let state = (await kv.get(KV.bindState, "current").catch(() => null)) ??
|
|
61
|
+
initialBindState();
|
|
62
|
+
// If the user asked for a forced re-run of specific phases, reset
|
|
63
|
+
// them to pending before walking the state machine.
|
|
64
|
+
if (force && force.length > 0) {
|
|
65
|
+
for (const phase of force) {
|
|
66
|
+
state = markPhase(state, phase, { status: "pending" });
|
|
67
|
+
}
|
|
68
|
+
await kv.set(KV.bindState, "current", state);
|
|
69
|
+
await kv.persist();
|
|
70
|
+
}
|
|
71
|
+
// The set of phases eligible to run this invocation. When the
|
|
72
|
+
// caller scopes us via `onlyPhases`, we narrow the iteration to
|
|
73
|
+
// exactly that set and leave unrelated phases' bindState
|
|
74
|
+
// untouched — crucial for the Stop-hook path where we don't want
|
|
75
|
+
// a capture tick to falsely advance the embedding/opencode/
|
|
76
|
+
// sisyphus/preliminary phases.
|
|
77
|
+
const eligible = onlyPhases && onlyPhases.length > 0
|
|
78
|
+
? new Set(onlyPhases)
|
|
79
|
+
: new Set(BIND_PHASE_ORDER);
|
|
80
|
+
// Don't print the ritual banner when scoped — it's noisy for
|
|
81
|
+
// background hook invocations that fire every assistant turn.
|
|
82
|
+
if (!onlyPhases || onlyPhases.length > 1) {
|
|
83
|
+
tui.line(renderSectionHeader("Necronomicon Binding Ritual"));
|
|
84
|
+
tui.line(renderStatusLine("info", `Necronomicon: ${necronomiconPath()}`));
|
|
85
|
+
// Report any already-completed phases so the user sees resume state.
|
|
86
|
+
for (const phase of BIND_PHASE_ORDER) {
|
|
87
|
+
if (state.phases[phase].status === "completed") {
|
|
88
|
+
tui.line(renderStatusLine("ok", `${phaseLabel(phase)} (already bound)`));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const started = Date.now();
|
|
93
|
+
// Iterate the narrowed phase list in BIND_PHASE_ORDER sequence.
|
|
94
|
+
// We don't use `firstPendingPhase` here because the narrow-mode
|
|
95
|
+
// caller explicitly wants to re-run specific phases regardless of
|
|
96
|
+
// their bindState — e.g., `--claude-only` fires on every hook
|
|
97
|
+
// tick and re-runs claude_transcripts with the advanced cursors,
|
|
98
|
+
// which is idempotent at the observation level.
|
|
99
|
+
const orderedEligible = BIND_PHASE_ORDER.filter((p) => eligible.has(p));
|
|
100
|
+
// When scoped, run every eligible phase unconditionally. When
|
|
101
|
+
// unscoped, skip already-completed ones (normal resume behavior).
|
|
102
|
+
const phasesToRun = onlyPhases && onlyPhases.length > 0
|
|
103
|
+
? orderedEligible
|
|
104
|
+
: orderedEligible.filter((p) => state.phases[p].status !== "completed");
|
|
105
|
+
for (const phase of phasesToRun) {
|
|
106
|
+
// When unscoped, stop at the first incomplete phase and fall
|
|
107
|
+
// through the legacy while(true)-pattern expectations below.
|
|
108
|
+
// Keeping the scoped path simple: just walk the list.
|
|
109
|
+
const runner = phases.find((p) => p.name === phase);
|
|
110
|
+
if (!runner) {
|
|
111
|
+
// No runner registered for this phase — treat as completed
|
|
112
|
+
// (phase isn't implemented yet). Mark it completed so we don't
|
|
113
|
+
// block forever, and note it in the details.
|
|
114
|
+
tui.line(renderStatusLine("warn", `${phaseLabel(phase)} — no runner registered, skipping`));
|
|
115
|
+
state = markPhase(state, phase, {
|
|
116
|
+
status: "completed",
|
|
117
|
+
details: { skipped: true, reason: "no runner registered" },
|
|
118
|
+
});
|
|
119
|
+
await kv.set(KV.bindState, "current", state);
|
|
120
|
+
await kv.persist();
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
// Mark in_progress, persist, announce.
|
|
124
|
+
state = markPhase(state, phase, { status: "in_progress" });
|
|
125
|
+
await kv.set(KV.bindState, "current", state);
|
|
126
|
+
await kv.persist();
|
|
127
|
+
// Skip the section header in scoped hook-mode — noisy for every
|
|
128
|
+
// assistant-turn tick.
|
|
129
|
+
if (!onlyPhases || onlyPhases.length > 1) {
|
|
130
|
+
tui.line(renderSectionHeader(phaseLabel(phase)));
|
|
131
|
+
}
|
|
132
|
+
const phaseStarted = Date.now();
|
|
133
|
+
try {
|
|
134
|
+
const result = await runner.run({ archive, tui, projectCwd });
|
|
135
|
+
const elapsed = formatDuration(Date.now() - phaseStarted);
|
|
136
|
+
state = markPhase(state, phase, {
|
|
137
|
+
status: "completed",
|
|
138
|
+
details: result.details,
|
|
139
|
+
});
|
|
140
|
+
await kv.set(KV.bindState, "current", state);
|
|
141
|
+
await kv.persist();
|
|
142
|
+
tui.line(renderStatusLine("ok", `${phaseLabel(phase)} — complete in ${elapsed}`));
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
146
|
+
state = markPhase(state, phase, { status: "failed", error: msg });
|
|
147
|
+
await kv.set(KV.bindState, "current", state);
|
|
148
|
+
await kv.persist();
|
|
149
|
+
tui.line(renderStatusLine("error", `${phaseLabel(phase)} — ${msg}`));
|
|
150
|
+
tui.line(renderStatusLine("info", "Re-run `oh-my-claudecode bind` to retry from this phase."));
|
|
151
|
+
return state;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Skip the closing ritual banner for scoped / background runs.
|
|
155
|
+
if (!onlyPhases || onlyPhases.length > 1) {
|
|
156
|
+
const totalElapsed = formatDuration(Date.now() - started);
|
|
157
|
+
tui.line(renderSectionHeader("Binding Complete"));
|
|
158
|
+
tui.line(renderStatusLine("ok", `The Necronomicon is bound. Ritual elapsed: ${totalElapsed}`));
|
|
159
|
+
// Pending-compression teaser so the user knows what comes next.
|
|
160
|
+
const pending = await kv
|
|
161
|
+
.get(KV.pendingCompression, "state")
|
|
162
|
+
.catch(() => null);
|
|
163
|
+
if (pending && pending.count > 0) {
|
|
164
|
+
tui.line(renderStatusLine("info", `${pending.count} raw observations awaiting compression — ` +
|
|
165
|
+
`processed in the background or via /necronomicon-bind in a session.`));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return state;
|
|
169
|
+
}
|
|
170
|
+
// ============================================================================
|
|
171
|
+
// Default phase runners
|
|
172
|
+
// ============================================================================
|
|
173
|
+
/** Path where the Necronomicon file lives on this machine. */
|
|
174
|
+
function necronomiconPath() {
|
|
175
|
+
return join(homedir(), ".oh-my-claudecode", "yith", "necronomicon.json");
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Walk the given root directory up to `maxDepth` levels deep looking
|
|
179
|
+
* for `.sisyphus/` subdirectories. Used by the sisyphus migration
|
|
180
|
+
* phase to find every legacy project that needs translating without
|
|
181
|
+
* requiring the user to enumerate them. Excludes well-known heavy
|
|
182
|
+
* paths (node_modules, .git, .cache) to keep the walk bounded.
|
|
183
|
+
*/
|
|
184
|
+
function findSisyphusDirs(root, maxDepth) {
|
|
185
|
+
const skip = new Set([
|
|
186
|
+
"node_modules",
|
|
187
|
+
".git",
|
|
188
|
+
".cache",
|
|
189
|
+
".next",
|
|
190
|
+
"dist",
|
|
191
|
+
".oh-my-claudecode",
|
|
192
|
+
".claude",
|
|
193
|
+
".npm",
|
|
194
|
+
".npm-global",
|
|
195
|
+
]);
|
|
196
|
+
const out = [];
|
|
197
|
+
const walk = (dir, depth) => {
|
|
198
|
+
if (depth > maxDepth)
|
|
199
|
+
return;
|
|
200
|
+
let entries;
|
|
201
|
+
try {
|
|
202
|
+
entries = readdirSync(dir);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
for (const entry of entries) {
|
|
208
|
+
if (skip.has(entry))
|
|
209
|
+
continue;
|
|
210
|
+
const full = join(dir, entry);
|
|
211
|
+
let s;
|
|
212
|
+
try {
|
|
213
|
+
s = statSync(full);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (!s.isDirectory())
|
|
219
|
+
continue;
|
|
220
|
+
if (entry === ".sisyphus") {
|
|
221
|
+
out.push(full);
|
|
222
|
+
continue; // don't recurse into .sisyphus itself
|
|
223
|
+
}
|
|
224
|
+
walk(full, depth + 1);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
walk(root, 0);
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Production phase runners. Tests inject fakes; the CLI entry point
|
|
232
|
+
* uses these defaults.
|
|
233
|
+
*
|
|
234
|
+
* Each runner is a thin wrapper that calls the underlying feature
|
|
235
|
+
* (provider warmup, backfill function, opencode importer, etc.) and
|
|
236
|
+
* reports progress via the context's TUI writer.
|
|
237
|
+
*
|
|
238
|
+
* Phases B, C, and D (opencode_import, sisyphus_migrate,
|
|
239
|
+
* preliminary_seed) currently register placeholders that log a
|
|
240
|
+
* "pending implementation" status and complete without work. They
|
|
241
|
+
* get real implementations in their respective phase files.
|
|
242
|
+
*/
|
|
243
|
+
export function defaultPhaseRunners() {
|
|
244
|
+
return [
|
|
245
|
+
{
|
|
246
|
+
name: "embedding_download",
|
|
247
|
+
async run({ archive, tui }) {
|
|
248
|
+
const provider = archive.embeddingProvider;
|
|
249
|
+
if (!provider || typeof provider.warmUp !== "function") {
|
|
250
|
+
tui.line(renderStatusLine("info", "No embedding provider configured — BM25-only mode, skipping model download."));
|
|
251
|
+
return { details: { skipped: true, reason: "no embedding provider" } };
|
|
252
|
+
}
|
|
253
|
+
tui.line(renderStatusLine("pending", `Fetching ${provider.name ?? "embedding model"}...`));
|
|
254
|
+
let lastLoaded = 0;
|
|
255
|
+
let lastTotal = 0;
|
|
256
|
+
await provider.warmUp({
|
|
257
|
+
onProgress: (e) => {
|
|
258
|
+
if (e.phase === "downloading" && e.loaded && e.total) {
|
|
259
|
+
lastLoaded = e.loaded;
|
|
260
|
+
lastTotal = e.total;
|
|
261
|
+
tui.replaceLastLine(renderProgressBar({
|
|
262
|
+
current: e.loaded,
|
|
263
|
+
total: e.total,
|
|
264
|
+
label: `${formatBytes(e.loaded)} / ${formatBytes(e.total)}`,
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
else if (e.phase === "loading") {
|
|
268
|
+
tui.line(renderStatusLine("pending", e.message ?? "Loading..."));
|
|
269
|
+
}
|
|
270
|
+
else if (e.phase === "ready") {
|
|
271
|
+
tui.line(renderStatusLine("ok", e.message ?? "Embedding model ready"));
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
});
|
|
275
|
+
return {
|
|
276
|
+
details: {
|
|
277
|
+
bytesDownloaded: lastLoaded,
|
|
278
|
+
totalBytes: lastTotal,
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "claude_transcripts",
|
|
285
|
+
async run({ archive, tui, projectCwd }) {
|
|
286
|
+
// Scoped mode: only scan the current project's transcripts.
|
|
287
|
+
// Used by the Stop-hook capture path so each assistant-turn
|
|
288
|
+
// tick is bounded to ~milliseconds regardless of how many
|
|
289
|
+
// unrelated projects the user has ever opened.
|
|
290
|
+
const scoped = typeof projectCwd === "string" && projectCwd.length > 0;
|
|
291
|
+
if (scoped) {
|
|
292
|
+
tui.line(renderStatusLine("pending", `Scanning transcripts for ${projectCwd}...`));
|
|
293
|
+
const r = (await archive.sdk.trigger("mem::backfill-sessions", {
|
|
294
|
+
projectCwd,
|
|
295
|
+
allProjects: false,
|
|
296
|
+
dryRun: false,
|
|
297
|
+
}));
|
|
298
|
+
const obs = r.observationsCreated ?? 0;
|
|
299
|
+
const ts = r.transcriptsScanned ?? 0;
|
|
300
|
+
tui.line(renderStatusLine("ok", `Ingested ${obs} new observations from ${ts} transcripts.`));
|
|
301
|
+
return { details: { observations: obs, transcripts: ts, scoped: true } };
|
|
302
|
+
}
|
|
303
|
+
tui.line(renderStatusLine("pending", "Scanning ~/.claude/projects/ for transcripts..."));
|
|
304
|
+
const result = (await archive.sdk.trigger("mem::backfill-sessions", {
|
|
305
|
+
allProjects: true,
|
|
306
|
+
dryRun: false,
|
|
307
|
+
}));
|
|
308
|
+
const projects = result.totalProjects ?? 0;
|
|
309
|
+
const obs = result.totalObservationsCreated ?? 0;
|
|
310
|
+
const transcripts = result.totalTranscriptsScanned ?? 0;
|
|
311
|
+
tui.line(renderStatusLine("ok", `Ingested ${obs} raw observations from ${transcripts} transcripts across ${projects} projects`));
|
|
312
|
+
// Per-project breakdown — lets the user see which projects
|
|
313
|
+
// contributed what at a glance. Truncate at 10 to keep the
|
|
314
|
+
// output manageable for users with many projects.
|
|
315
|
+
const perProject = result.perProject ?? [];
|
|
316
|
+
for (const p of perProject.slice(0, 10)) {
|
|
317
|
+
if (p.observationsCreated > 0) {
|
|
318
|
+
tui.line(renderStatusLine("info", `${p.projectCwd}: ${p.observationsCreated} obs`));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (perProject.length > 10) {
|
|
322
|
+
tui.line(renderStatusLine("info", `... and ${perProject.length - 10} more projects`));
|
|
323
|
+
}
|
|
324
|
+
return { details: { projects, observations: obs, transcripts } };
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: "opencode_import",
|
|
329
|
+
async run({ archive, tui }) {
|
|
330
|
+
// Check if an opencode database exists at the default path.
|
|
331
|
+
// The function handles "not found" gracefully, but we short-
|
|
332
|
+
// circuit here so the TUI output is clearer.
|
|
333
|
+
const defaultDb = join(homedir(), ".local", "share", "opencode", "opencode.db");
|
|
334
|
+
if (!existsSync(defaultDb)) {
|
|
335
|
+
tui.line(renderStatusLine("info", "No opencode.db found — skipping opencode import."));
|
|
336
|
+
return { details: { skipped: true, reason: "no opencode db" } };
|
|
337
|
+
}
|
|
338
|
+
tui.line(renderStatusLine("pending", `Reading opencode history from ${defaultDb}...`));
|
|
339
|
+
const result = (await archive.sdk.trigger("mem::import-opencode", {
|
|
340
|
+
dbPath: defaultDb,
|
|
341
|
+
}));
|
|
342
|
+
if (!result.success) {
|
|
343
|
+
throw new Error(result.error ?? "opencode import failed");
|
|
344
|
+
}
|
|
345
|
+
tui.line(renderStatusLine("ok", `Imported ${result.observationsCreated} opencode observations ` +
|
|
346
|
+
`(${result.observationsSkipped} duplicates skipped) from ` +
|
|
347
|
+
`${result.sessionsScanned} sessions across ${result.projectsScanned} projects.`));
|
|
348
|
+
return {
|
|
349
|
+
details: {
|
|
350
|
+
created: result.observationsCreated,
|
|
351
|
+
skipped: result.observationsSkipped,
|
|
352
|
+
sessions: result.sessionsScanned,
|
|
353
|
+
projects: result.projectsScanned,
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
name: "sisyphus_migrate",
|
|
360
|
+
async run({ tui }) {
|
|
361
|
+
// Walk the user's home for any `.sisyphus/` dirs to migrate.
|
|
362
|
+
// We don't go deeper than 5 levels — sisyphus dirs were always
|
|
363
|
+
// project-root-scoped.
|
|
364
|
+
tui.line(renderStatusLine("pending", "Scanning for .sisyphus directories..."));
|
|
365
|
+
const discovered = findSisyphusDirs(homedir(), 5);
|
|
366
|
+
if (discovered.length === 0) {
|
|
367
|
+
tui.line(renderStatusLine("info", "No .sisyphus directories found."));
|
|
368
|
+
return { details: { dirs: 0 } };
|
|
369
|
+
}
|
|
370
|
+
let migrated = 0;
|
|
371
|
+
for (const dir of discovered) {
|
|
372
|
+
const projectRoot = join(dir, "..");
|
|
373
|
+
const dest = join(projectRoot, ".elder-gods");
|
|
374
|
+
const result = migrateSisyphusDir({ source: dir, dest });
|
|
375
|
+
const copied = result.plansCopied +
|
|
376
|
+
result.handoffsCopied +
|
|
377
|
+
result.evidenceCopied +
|
|
378
|
+
result.legacyCopied;
|
|
379
|
+
if (copied > 0) {
|
|
380
|
+
tui.line(renderStatusLine("ok", `${dir} → ${dest}: ${result.plansCopied} plans, ` +
|
|
381
|
+
`${result.handoffsCopied} handoffs, ` +
|
|
382
|
+
`${result.evidenceCopied} evidence files`));
|
|
383
|
+
migrated++;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return { details: { discovered: discovered.length, migrated } };
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: "preliminary_seed",
|
|
391
|
+
async run({ archive, tui }) {
|
|
392
|
+
// Scan every project directory we already know about (from
|
|
393
|
+
// the Claude Code transcripts phase) and emit synthesized
|
|
394
|
+
// preliminary observations. If the project dir no longer
|
|
395
|
+
// exists on disk, skip it with a warning.
|
|
396
|
+
tui.line(renderStatusLine("pending", "Scanning project code for preliminary memories..."));
|
|
397
|
+
// Re-enumerate sessions to find the set of project cwds.
|
|
398
|
+
const sessions = await archive.kv
|
|
399
|
+
.list(KV.sessions)
|
|
400
|
+
.catch(() => []);
|
|
401
|
+
const projectCwds = new Set();
|
|
402
|
+
for (const s of sessions) {
|
|
403
|
+
if (s.project && s.project.startsWith("/")) {
|
|
404
|
+
projectCwds.add(s.project);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
let scanned = 0;
|
|
408
|
+
let created = 0;
|
|
409
|
+
for (const cwd of projectCwds) {
|
|
410
|
+
if (!existsSync(cwd))
|
|
411
|
+
continue;
|
|
412
|
+
try {
|
|
413
|
+
const summary = await scanProject(cwd);
|
|
414
|
+
const obs = projectSummaryToObservations(summary);
|
|
415
|
+
const sessionId = `proj:${cwd}`;
|
|
416
|
+
// Upsert a synthetic "project-scan" session so the
|
|
417
|
+
// observations land somewhere the search index can find.
|
|
418
|
+
await archive.kv.set(KV.sessions, sessionId, {
|
|
419
|
+
id: sessionId,
|
|
420
|
+
project: cwd,
|
|
421
|
+
cwd,
|
|
422
|
+
startedAt: new Date().toISOString(),
|
|
423
|
+
status: "completed",
|
|
424
|
+
observationCount: obs.length,
|
|
425
|
+
});
|
|
426
|
+
for (const o of obs) {
|
|
427
|
+
const existing = await archive.kv
|
|
428
|
+
.get(KV.observations(sessionId), o.id)
|
|
429
|
+
.catch(() => null);
|
|
430
|
+
if (existing)
|
|
431
|
+
continue;
|
|
432
|
+
await archive.kv.set(KV.observations(sessionId), o.id, { ...o, sessionId });
|
|
433
|
+
created++;
|
|
434
|
+
}
|
|
435
|
+
scanned++;
|
|
436
|
+
}
|
|
437
|
+
catch (err) {
|
|
438
|
+
tui.line(renderStatusLine("warn", `${cwd}: ${err instanceof Error ? err.message : String(err)}`));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
tui.line(renderStatusLine("ok", `Scanned ${scanned} projects, seeded ${created} preliminary observations.`));
|
|
442
|
+
return { details: { scanned, created } };
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
name: "pending_compression_trigger",
|
|
447
|
+
async run({ archive, tui }) {
|
|
448
|
+
const pending = await archive.kv
|
|
449
|
+
.get(KV.pendingCompression, "state")
|
|
450
|
+
.catch(() => null);
|
|
451
|
+
const count = pending?.count ?? 0;
|
|
452
|
+
if (count > 0) {
|
|
453
|
+
tui.line(renderStatusLine("info", `${count} raw observations queued for compression. ` +
|
|
454
|
+
`Run /necronomicon-bind inside Claude Code to process them, ` +
|
|
455
|
+
`or install the cron entry with \`oh-my-claudecode bind --install-cron\` ` +
|
|
456
|
+
`for unattended background compression via \`claude -p\`.`));
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
tui.line(renderStatusLine("ok", "No observations pending compression."));
|
|
460
|
+
}
|
|
461
|
+
return { details: { pendingCompression: count } };
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
];
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=bind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/cli/bind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,OAAO,EAAE,EAAE,EAAE,MAAM,0CAA0C,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EACL,4BAA4B,EAC5B,WAAW,GACZ,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,gBAAgB,EAEhB,gBAAgB,EAChB,SAAS,GAGV,MAAM,8CAA8C,CAAA;AACrD,OAAO,EAEL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAA;AA+DjB,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,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E,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAA;YAC1C,CAAC;SACF;QACD;YACE,IAAI,EAAE,6BAA6B;YACnC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE;gBACxB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,EAAE;qBAC7B,GAAG,CAAoB,EAAE,CAAC,kBAAkB,EAAE,OAAO,CAAC;qBACtD,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;gBACpB,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,CAAC,CAAA;gBACjC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;oBACd,GAAG,CAAC,IAAI,CACN,gBAAgB,CACd,MAAM,EACN,GAAG,KAAK,4CAA4C;wBAClD,6DAA6D;wBAC7D,0EAA0E;wBAC1E,0DAA0D,CAC7D,CACF,CAAA;gBACH,CAAC;qBAAM,CAAC;oBACN,GAAG,CAAC,IAAI,CACN,gBAAgB,CAAC,IAAI,EAAE,sCAAsC,CAAC,CAC/D,CAAA;gBACH,CAAC;gBACD,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,CAAA;YACnD,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import * as path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
+
import { execFileSync } from "node:child_process";
|
|
4
5
|
import { runInstall } from "./install.js";
|
|
5
6
|
import { runDoctor, printYithFunctionCatalog } from "./doctor.js";
|
|
7
|
+
import { CLI_VERSION } from "./version.js";
|
|
8
|
+
import { runBind } from "./bind.js";
|
|
9
|
+
import { buildClaudePSpawnCommand, buildCrontabLine, installCrontabEntry, parseIntervalSpec, } from "./bind-cron.js";
|
|
10
|
+
import { TuiWriter } from "./tui.js";
|
|
6
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
12
|
const __dirname = path.dirname(__filename);
|
|
8
13
|
const PACKAGE_ROOT = path.resolve(__dirname, "../..");
|
|
@@ -10,7 +15,7 @@ const program = new Command();
|
|
|
10
15
|
program
|
|
11
16
|
.name("oh-my-claudecode")
|
|
12
17
|
.description("Elder Gods agentic harness for Claude Code")
|
|
13
|
-
.version(
|
|
18
|
+
.version(CLI_VERSION);
|
|
14
19
|
program
|
|
15
20
|
.command("install")
|
|
16
21
|
.description("Interactive setup wizard — installs hooks, skills, and config")
|
|
@@ -54,5 +59,101 @@ program
|
|
|
54
59
|
}
|
|
55
60
|
console.log();
|
|
56
61
|
});
|
|
62
|
+
program
|
|
63
|
+
.command("bind")
|
|
64
|
+
.description("Run the Necronomicon binding ritual — download embedding model, " +
|
|
65
|
+
"ingest past transcripts, import opencode history, migrate sisyphus " +
|
|
66
|
+
"dirs, seed preliminary memories. Resumable.")
|
|
67
|
+
.option("--resume", "Cron-friendly: run only pending work and exit")
|
|
68
|
+
.option("--install-cron", "Install a system crontab entry that runs `bind --resume` on an interval")
|
|
69
|
+
.option("--interval <spec>", "Interval for the cron entry (e.g. 1h, 30m, 1d). Used with --install-cron.", "1h")
|
|
70
|
+
.option("--force <phase>", "Re-run a specific phase even if already completed")
|
|
71
|
+
.option("--claude-only", "Run only the claude_transcripts phase. Used by the Stop hook for fast per-tick ingestion.")
|
|
72
|
+
.option("--compress-only", "Spawn `claude -p` to drain the pending-compression queue and exit. Non-blocking when --background is set.")
|
|
73
|
+
.option("--background", "Fork the current invocation into the background and return immediately. Used by the Stop hook so assistant responses don't block.")
|
|
74
|
+
.option("--project <cwd>", "Scope the transcript scan to a specific project cwd (default: all projects).")
|
|
75
|
+
.action(async (options) => {
|
|
76
|
+
// Background fork: re-exec ourselves detached so the parent (the
|
|
77
|
+
// Stop hook shell) returns immediately. Node's spawn with `detached`
|
|
78
|
+
// + `unref` lets us exit the parent while the child continues.
|
|
79
|
+
// Used exclusively by the hook so assistant-turn latency stays low.
|
|
80
|
+
if (options.background) {
|
|
81
|
+
const { spawn } = await import("node:child_process");
|
|
82
|
+
const args = process.argv.slice(2).filter((a) => a !== "--background");
|
|
83
|
+
const child = spawn(process.execPath, [process.argv[1], ...args], {
|
|
84
|
+
detached: true,
|
|
85
|
+
stdio: "ignore",
|
|
86
|
+
env: process.env,
|
|
87
|
+
});
|
|
88
|
+
child.unref();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (options.compressOnly) {
|
|
92
|
+
// Spawn `claude -p` with the compression loop prompt. We don't
|
|
93
|
+
// await it — if caller passed --background we already forked
|
|
94
|
+
// above; otherwise we fire-and-forget so the CLI itself returns
|
|
95
|
+
// promptly and the user isn't blocked by a multi-minute claude -p.
|
|
96
|
+
const { spawn } = await import("node:child_process");
|
|
97
|
+
const spawnCmd = buildClaudePSpawnCommand({ limit: 50 });
|
|
98
|
+
// spawnCmd is a shell-formatted string; run via /bin/sh -c.
|
|
99
|
+
const child = spawn("/bin/sh", ["-c", spawnCmd], {
|
|
100
|
+
detached: true,
|
|
101
|
+
stdio: "ignore",
|
|
102
|
+
});
|
|
103
|
+
child.unref();
|
|
104
|
+
console.log("Spawned background compression tick via `claude -p`. " +
|
|
105
|
+
"Check `~/.oh-my-claudecode/yith/necronomicon.json` and the log " +
|
|
106
|
+
"for progress.");
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (options.installCron) {
|
|
110
|
+
// Install the crontab entry that runs `bind --resume`.
|
|
111
|
+
const schedule = parseIntervalSpec(options.interval ?? "1h");
|
|
112
|
+
const binCmd = process.argv[1] ?? "oh-my-claudecode";
|
|
113
|
+
const crontabBody = buildCrontabLine({
|
|
114
|
+
schedule,
|
|
115
|
+
command: `${binCmd} bind --resume`,
|
|
116
|
+
});
|
|
117
|
+
let current = "";
|
|
118
|
+
try {
|
|
119
|
+
current = execFileSync("crontab", ["-l"], {
|
|
120
|
+
encoding: "utf-8",
|
|
121
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
current = "";
|
|
126
|
+
}
|
|
127
|
+
const updated = installCrontabEntry(current, crontabBody);
|
|
128
|
+
execFileSync("crontab", ["-"], { input: updated });
|
|
129
|
+
console.log(`Installed crontab entry on schedule '${schedule}'. The cron ` +
|
|
130
|
+
`tick will run \`${binCmd} bind --resume\` to ingest new data ` +
|
|
131
|
+
`and drive compression via \`claude -p\`.`);
|
|
132
|
+
console.log(`Spawn command preview:\n ${buildClaudePSpawnCommand({})}`);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const { createYithArchive } = await import("../features/yith-archive/index.js");
|
|
136
|
+
const archive = createYithArchive();
|
|
137
|
+
const tui = new TuiWriter({
|
|
138
|
+
write: (s) => process.stdout.write(s),
|
|
139
|
+
isTTY: process.stdout.isTTY ?? false,
|
|
140
|
+
});
|
|
141
|
+
try {
|
|
142
|
+
await runBind({
|
|
143
|
+
archive,
|
|
144
|
+
tui,
|
|
145
|
+
force: options.force
|
|
146
|
+
? [
|
|
147
|
+
options.force,
|
|
148
|
+
]
|
|
149
|
+
: undefined,
|
|
150
|
+
onlyPhases: options.claudeOnly ? ["claude_transcripts"] : undefined,
|
|
151
|
+
projectCwd: options.project,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
await archive.shutdown();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
57
158
|
program.parse();
|
|
58
159
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAA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