oh-my-claudecode 0.2.3 → 0.2.4
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 +48 -1
- 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 +78 -0
- package/dist/cli/bind.d.ts.map +1 -0
- package/dist/cli/bind.js +417 -0
- package/dist/cli/bind.js.map +1 -0
- package/dist/cli/index.js +61 -0
- 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/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/package.json +5 -2
- /package/commands/{bind-necronomicon.md → necronomicon-bind.md} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sisyphus-migrate.js","sourceRoot":"","sources":["../../src/cli/sisyphus-migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,aAAa,EACb,YAAY,EACZ,QAAQ,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,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AC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IACzC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-rolled TUI primitive for `oh-my-claudecode bind`.
|
|
3
|
+
*
|
|
4
|
+
* No external deps. Everything is a pure function (returns a string)
|
|
5
|
+
* or operates on an injectable writer so tests can run without a real
|
|
6
|
+
* TTY. When stdout is a TTY, `TuiWriter.replaceLastLine` uses ANSI
|
|
7
|
+
* escape codes to redraw the last line in place — real animated
|
|
8
|
+
* progress. When not a TTY (piped, redirected, CI log), it falls
|
|
9
|
+
* back to plain sequential lines so the output still makes sense in
|
|
10
|
+
* a log file.
|
|
11
|
+
*
|
|
12
|
+
* Intentionally minimal: progress bar, section header, status line,
|
|
13
|
+
* byte/duration formatters, and a writer with one redraw method.
|
|
14
|
+
* Anything fancier (panes, tables, multi-line redraw) is overkill for
|
|
15
|
+
* the bind ritual's progress reporting.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Strip ANSI escape sequences from a string. Used by tests to assert
|
|
19
|
+
* on content without caring about colour codes, and by non-TTY fallback
|
|
20
|
+
* to produce log-friendly plain output.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stripAnsi(s: string): string;
|
|
23
|
+
export interface ProgressBarOptions {
|
|
24
|
+
current: number;
|
|
25
|
+
total: number;
|
|
26
|
+
label: string;
|
|
27
|
+
/** Bar width in cells. Default 20 — fits in a chat UI line. */
|
|
28
|
+
width?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Render a monospace progress bar as a single string. The bar is
|
|
32
|
+
* 20 cells by default, using ▓ for filled and ░ for empty so it
|
|
33
|
+
* renders cleanly in any terminal with a reasonable font.
|
|
34
|
+
*
|
|
35
|
+
* Handles 0/0 (renders as empty bar), overshoot (clamps to 100%),
|
|
36
|
+
* and negative values (clamps to 0%).
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderProgressBar(opts: ProgressBarOptions): string;
|
|
39
|
+
/**
|
|
40
|
+
* Render a titled divider line — the header printed at the start of
|
|
41
|
+
* each bind phase so the user sees structure: "Phase I: Embedding"
|
|
42
|
+
* with a horizontal rule above and below.
|
|
43
|
+
*/
|
|
44
|
+
export declare function renderSectionHeader(title: string, width?: number): string;
|
|
45
|
+
export type StatusKind = "ok" | "warn" | "error" | "pending" | "info";
|
|
46
|
+
/**
|
|
47
|
+
* Render a status line with a coloured glyph prefix. Used by the
|
|
48
|
+
* bind runner to report the outcome of each phase:
|
|
49
|
+
* ✓ green — success
|
|
50
|
+
* ⚠ yellow — warning
|
|
51
|
+
* ✗ red — failure
|
|
52
|
+
* … dim — pending / in-progress
|
|
53
|
+
* ℹ cyan — info / context
|
|
54
|
+
*/
|
|
55
|
+
export declare function renderStatusLine(kind: StatusKind, message: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Format a byte count as a human-readable string. Uses 1024-based
|
|
58
|
+
* units (B, KB, MB, GB) with one decimal place once we're over 1 KB.
|
|
59
|
+
*/
|
|
60
|
+
export declare function formatBytes(bytes: number): string;
|
|
61
|
+
/**
|
|
62
|
+
* Format a duration in milliseconds as a compact string. Prefers
|
|
63
|
+
* "1.5s", "1m5s", "1h2m" over "0h0m1.5s".
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatDuration(ms: number): string;
|
|
66
|
+
export interface WriterBackend {
|
|
67
|
+
write(chunk: string): void;
|
|
68
|
+
isTTY: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Stateful writer that prints lines and can redraw the last one in
|
|
72
|
+
* place — used to animate a progress bar without spamming the chat
|
|
73
|
+
* log with dozens of copies. Construct with a backend (stdout by
|
|
74
|
+
* default); tests pass a fake backend with a capture buffer.
|
|
75
|
+
*
|
|
76
|
+
* Non-TTY semantics: `replaceLastLine` just prints a new line. This
|
|
77
|
+
* keeps log files readable and CI output sensible.
|
|
78
|
+
*/
|
|
79
|
+
export declare class TuiWriter {
|
|
80
|
+
private backend;
|
|
81
|
+
private lastLinePrinted;
|
|
82
|
+
constructor(backend: WriterBackend);
|
|
83
|
+
/** Print a line of text with trailing newline. */
|
|
84
|
+
line(text: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Redraw the most recently printed line with new content. On TTY,
|
|
87
|
+
* moves the cursor up one line, erases it, and rewrites. On
|
|
88
|
+
* non-TTY, just prints a new line (no escape codes).
|
|
89
|
+
*/
|
|
90
|
+
replaceLastLine(text: string): void;
|
|
91
|
+
/** Print a raw string with no newline handling. Useful for spinners. */
|
|
92
|
+
write(text: string): void;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=tui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/cli/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0BH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C;AAMD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAWlE;AAMD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAMrE;AAMD,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;AAErE;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAa1E;AAMD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAejD;AAMD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;;;;GAQG;AACH,qBAAa,SAAS;IAGR,OAAO,CAAC,OAAO;IAF3B,OAAO,CAAC,eAAe,CAAQ;gBAEX,OAAO,EAAE,aAAa;IAE1C,kDAAkD;IAClD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASnC,wEAAwE;IACxE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAG1B"}
|
package/dist/cli/tui.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-rolled TUI primitive for `oh-my-claudecode bind`.
|
|
3
|
+
*
|
|
4
|
+
* No external deps. Everything is a pure function (returns a string)
|
|
5
|
+
* or operates on an injectable writer so tests can run without a real
|
|
6
|
+
* TTY. When stdout is a TTY, `TuiWriter.replaceLastLine` uses ANSI
|
|
7
|
+
* escape codes to redraw the last line in place — real animated
|
|
8
|
+
* progress. When not a TTY (piped, redirected, CI log), it falls
|
|
9
|
+
* back to plain sequential lines so the output still makes sense in
|
|
10
|
+
* a log file.
|
|
11
|
+
*
|
|
12
|
+
* Intentionally minimal: progress bar, section header, status line,
|
|
13
|
+
* byte/duration formatters, and a writer with one redraw method.
|
|
14
|
+
* Anything fancier (panes, tables, multi-line redraw) is overkill for
|
|
15
|
+
* the bind ritual's progress reporting.
|
|
16
|
+
*/
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// ANSI escape helpers
|
|
19
|
+
// ============================================================================
|
|
20
|
+
const ESC = "\x1b[";
|
|
21
|
+
/** Move cursor up N lines. */
|
|
22
|
+
const cursorUp = (n) => `${ESC}${n}A`;
|
|
23
|
+
/** Erase the entire current line (cursor stays). */
|
|
24
|
+
const eraseLine = `${ESC}2K`;
|
|
25
|
+
/** Return to start of line. */
|
|
26
|
+
const cr = "\r";
|
|
27
|
+
/** Colour wrappers — only used when stdout is a TTY. */
|
|
28
|
+
const dim = (s) => `${ESC}2m${s}${ESC}0m`;
|
|
29
|
+
const bold = (s) => `${ESC}1m${s}${ESC}0m`;
|
|
30
|
+
const green = (s) => `${ESC}32m${s}${ESC}0m`;
|
|
31
|
+
const yellow = (s) => `${ESC}33m${s}${ESC}0m`;
|
|
32
|
+
const red = (s) => `${ESC}31m${s}${ESC}0m`;
|
|
33
|
+
const cyan = (s) => `${ESC}36m${s}${ESC}0m`;
|
|
34
|
+
const magenta = (s) => `${ESC}35m${s}${ESC}0m`;
|
|
35
|
+
/**
|
|
36
|
+
* Strip ANSI escape sequences from a string. Used by tests to assert
|
|
37
|
+
* on content without caring about colour codes, and by non-TTY fallback
|
|
38
|
+
* to produce log-friendly plain output.
|
|
39
|
+
*/
|
|
40
|
+
export function stripAnsi(s) {
|
|
41
|
+
// eslint-disable-next-line no-control-regex
|
|
42
|
+
return s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Render a monospace progress bar as a single string. The bar is
|
|
46
|
+
* 20 cells by default, using ▓ for filled and ░ for empty so it
|
|
47
|
+
* renders cleanly in any terminal with a reasonable font.
|
|
48
|
+
*
|
|
49
|
+
* Handles 0/0 (renders as empty bar), overshoot (clamps to 100%),
|
|
50
|
+
* and negative values (clamps to 0%).
|
|
51
|
+
*/
|
|
52
|
+
export function renderProgressBar(opts) {
|
|
53
|
+
const width = opts.width ?? 20;
|
|
54
|
+
const { current, total, label } = opts;
|
|
55
|
+
const pct = total > 0 ? Math.max(0, Math.min(1, current / total)) : 0;
|
|
56
|
+
const filled = Math.round(pct * width);
|
|
57
|
+
const empty = width - filled;
|
|
58
|
+
const bar = "▓".repeat(filled) + "░".repeat(empty);
|
|
59
|
+
const pctStr = `${Math.round(pct * 100)}%`.padStart(4);
|
|
60
|
+
const counter = `${current}/${total}`;
|
|
61
|
+
return `${cyan(`[${bar}]`)} ${bold(pctStr)} ${dim(`— ${counter} ${label}`)}`;
|
|
62
|
+
}
|
|
63
|
+
// ============================================================================
|
|
64
|
+
// Section header
|
|
65
|
+
// ============================================================================
|
|
66
|
+
/**
|
|
67
|
+
* Render a titled divider line — the header printed at the start of
|
|
68
|
+
* each bind phase so the user sees structure: "Phase I: Embedding"
|
|
69
|
+
* with a horizontal rule above and below.
|
|
70
|
+
*/
|
|
71
|
+
export function renderSectionHeader(title, width = 60) {
|
|
72
|
+
const padded = ` ${title} `;
|
|
73
|
+
const sideLen = Math.max(0, Math.floor((width - padded.length) / 2));
|
|
74
|
+
const side = "═".repeat(sideLen);
|
|
75
|
+
const line = `${side}${padded}${side}`;
|
|
76
|
+
return `\n${magenta(line)}\n`;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Render a status line with a coloured glyph prefix. Used by the
|
|
80
|
+
* bind runner to report the outcome of each phase:
|
|
81
|
+
* ✓ green — success
|
|
82
|
+
* ⚠ yellow — warning
|
|
83
|
+
* ✗ red — failure
|
|
84
|
+
* … dim — pending / in-progress
|
|
85
|
+
* ℹ cyan — info / context
|
|
86
|
+
*/
|
|
87
|
+
export function renderStatusLine(kind, message) {
|
|
88
|
+
switch (kind) {
|
|
89
|
+
case "ok":
|
|
90
|
+
return ` ${green("✓")} ${message}`;
|
|
91
|
+
case "warn":
|
|
92
|
+
return ` ${yellow("⚠")} ${message}`;
|
|
93
|
+
case "error":
|
|
94
|
+
return ` ${red("✗")} ${message}`;
|
|
95
|
+
case "pending":
|
|
96
|
+
return ` ${dim("…")} ${message}`;
|
|
97
|
+
case "info":
|
|
98
|
+
return ` ${cyan("ℹ")} ${message}`;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Formatters
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/**
|
|
105
|
+
* Format a byte count as a human-readable string. Uses 1024-based
|
|
106
|
+
* units (B, KB, MB, GB) with one decimal place once we're over 1 KB.
|
|
107
|
+
*/
|
|
108
|
+
export function formatBytes(bytes) {
|
|
109
|
+
if (bytes < 1024)
|
|
110
|
+
return `${bytes} B`;
|
|
111
|
+
const kb = bytes / 1024;
|
|
112
|
+
if (kb < 1024)
|
|
113
|
+
return `${kb.toFixed(1)} KB`;
|
|
114
|
+
const mb = kb / 1024;
|
|
115
|
+
if (mb < 1024)
|
|
116
|
+
return `${mb.toFixed(1)} MB`;
|
|
117
|
+
const gb = mb / 1024;
|
|
118
|
+
return `${gb.toFixed(1)} GB`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Format a duration in milliseconds as a compact string. Prefers
|
|
122
|
+
* "1.5s", "1m5s", "1h2m" over "0h0m1.5s".
|
|
123
|
+
*/
|
|
124
|
+
export function formatDuration(ms) {
|
|
125
|
+
if (ms < 1000)
|
|
126
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
127
|
+
const totalSec = Math.floor(ms / 1000);
|
|
128
|
+
if (totalSec < 60) {
|
|
129
|
+
const sec = ms / 1000;
|
|
130
|
+
return `${sec.toFixed(1)}s`;
|
|
131
|
+
}
|
|
132
|
+
const totalMin = Math.floor(totalSec / 60);
|
|
133
|
+
if (totalMin < 60) {
|
|
134
|
+
const sec = totalSec % 60;
|
|
135
|
+
return `${totalMin}m${sec}s`;
|
|
136
|
+
}
|
|
137
|
+
const totalHr = Math.floor(totalMin / 60);
|
|
138
|
+
const min = totalMin % 60;
|
|
139
|
+
return `${totalHr}h${min}m`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Stateful writer that prints lines and can redraw the last one in
|
|
143
|
+
* place — used to animate a progress bar without spamming the chat
|
|
144
|
+
* log with dozens of copies. Construct with a backend (stdout by
|
|
145
|
+
* default); tests pass a fake backend with a capture buffer.
|
|
146
|
+
*
|
|
147
|
+
* Non-TTY semantics: `replaceLastLine` just prints a new line. This
|
|
148
|
+
* keeps log files readable and CI output sensible.
|
|
149
|
+
*/
|
|
150
|
+
export class TuiWriter {
|
|
151
|
+
backend;
|
|
152
|
+
lastLinePrinted = false;
|
|
153
|
+
constructor(backend) {
|
|
154
|
+
this.backend = backend;
|
|
155
|
+
}
|
|
156
|
+
/** Print a line of text with trailing newline. */
|
|
157
|
+
line(text) {
|
|
158
|
+
const out = this.backend.isTTY ? text : stripAnsi(text);
|
|
159
|
+
this.backend.write(out + "\n");
|
|
160
|
+
this.lastLinePrinted = true;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Redraw the most recently printed line with new content. On TTY,
|
|
164
|
+
* moves the cursor up one line, erases it, and rewrites. On
|
|
165
|
+
* non-TTY, just prints a new line (no escape codes).
|
|
166
|
+
*/
|
|
167
|
+
replaceLastLine(text) {
|
|
168
|
+
if (!this.lastLinePrinted || !this.backend.isTTY) {
|
|
169
|
+
this.line(text);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
// Move up, erase, carriage return, write, newline.
|
|
173
|
+
this.backend.write(`${cursorUp(1)}${eraseLine}${cr}${text}\n`);
|
|
174
|
+
}
|
|
175
|
+
/** Print a raw string with no newline handling. Useful for spinners. */
|
|
176
|
+
write(text) {
|
|
177
|
+
this.backend.write(this.backend.isTTY ? text : stripAnsi(text));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=tui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../../src/cli/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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AAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACvD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;IAC7B,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,IAAY;QAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACjD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACf,OAAM;QACR,CAAC;QACD,mDAAmD;QACnD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,CAAA;IAChE,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,IAAY;QAChB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IACjE,CAAC;CACF"}
|
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
import type { FakeSdk } from "../state/fake-sdk.js";
|
|
2
2
|
import type { StateKV } from "../state/kv.js";
|
|
3
|
+
/**
|
|
4
|
+
* Best-effort inverse of `sanitizeCwd` — maps a sanitized Claude Code
|
|
5
|
+
* directory name (e.g. `-home-alice-foo`) back to the absolute path
|
|
6
|
+
* that produced it (`/home/alice/foo`). Reliable for paths that contain
|
|
7
|
+
* no literal dashes; ambiguous for paths that do (e.g. `my-project`
|
|
8
|
+
* would round-trip incorrectly). For the common case of home paths
|
|
9
|
+
* like `/home/<user>/<project>` it's exact.
|
|
10
|
+
*
|
|
11
|
+
* Used by the all-projects backfill path to reconstruct the original
|
|
12
|
+
* cwd from every directory under `~/.claude/projects/` so observations
|
|
13
|
+
* can be tagged with a real absolute project path instead of just the
|
|
14
|
+
* sanitized label.
|
|
15
|
+
*/
|
|
16
|
+
export declare function unsanitizeClaudeCodeDirName(dirName: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Descriptor for one project's transcripts, yielded by the
|
|
19
|
+
* `enumerateTranscriptProjects` scanner.
|
|
20
|
+
*/
|
|
21
|
+
export interface TranscriptProject {
|
|
22
|
+
/** Absolute path, best-effort reconstructed from the sanitized name. */
|
|
23
|
+
projectCwd: string;
|
|
24
|
+
/** Raw directory name on disk, e.g. `-home-alice-foo`. */
|
|
25
|
+
sanitized: string;
|
|
26
|
+
/** Absolute path to the transcript dir itself. */
|
|
27
|
+
dirPath: string;
|
|
28
|
+
/** Number of valid `.jsonl` files in the directory. */
|
|
29
|
+
transcriptCount: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List every project subdirectory under a given `~/.claude/projects/`
|
|
33
|
+
* base path, returning one descriptor per subdir. Used by the all-
|
|
34
|
+
* projects backfill mode so a single `bind` run ingests every project's
|
|
35
|
+
* history, not just the cwd's.
|
|
36
|
+
*
|
|
37
|
+
* Subdirs that contain zero `.jsonl` files are still returned with
|
|
38
|
+
* `transcriptCount: 0` so the caller can report them in the TUI as
|
|
39
|
+
* "known but empty" rather than silently skipping.
|
|
40
|
+
*
|
|
41
|
+
* Returns empty array (never throws) when `baseDir` doesn't exist —
|
|
42
|
+
* fresh machines with no prior Claude Code history show up as zero
|
|
43
|
+
* projects rather than a hard error.
|
|
44
|
+
*/
|
|
45
|
+
export declare function enumerateTranscriptProjects(baseDir: string): TranscriptProject[];
|
|
3
46
|
/** Metadata about a discovered transcript file. */
|
|
4
47
|
interface TranscriptInfo {
|
|
5
48
|
sessionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../../../../src/features/yith-archive/functions/backfill.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AA2C7C,mDAAmD;AACnD,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,EAAE,CA2BxE;
|
|
1
|
+
{"version":3,"file":"backfill.d.ts","sourceRoot":"","sources":["../../../../src/features/yith-archive/functions/backfill.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AA2C7C;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAInE;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAA;IAClB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAA;IACf,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,GACd,iBAAiB,EAAE,CA2CrB;AAED,mDAAmD;AACnD,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,EAAE,CA2BxE;AAwPD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR;AAqND,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,OAAO,GACV,IAAI,CA6FN"}
|