codeburn/packages/cli
ozymandiashh 6f5793b063 fix(cli): restore pi/omp, cline and opencode session discovery
Three discovery paths silently dropped sessions. Each fix carries a regression
test that fails against the current code.

**pi/omp** inspected only the first physical line of each transcript. When Oh
My Pi started writing a `type: "title"` slot line ahead of the session header,
every OMP session became invisible. Discovery now scans a bounded twenty
leading lines for the session record, skipping blank and malformed lines rather
than giving up; the bound caps how many LINES are inspected (twenty parse
attempts per file), so a message-only or pathological transcript costs at most
twenty line reads instead of a scan to EOF. It does not cap bytes: the
streaming reader buffers one physical line whole, so a single oversized line
is bounded only by the stream reader's cap, not by this bound. Discovery also
validates the session record's `cwd` before `basename`, falling back to the
project directory for a malformed non-string value — a `cwd: 42` record no
longer crashes discovery.

**cline** scanned only the VS Code stable globalStorage root, so sessions
written under Code - Insiders or VSCodium were never found. All variant roots
are scanned now, matching the roo-code and kilo-code siblings, plus Cline's
home-data root, deduplicated by task id with the newest copy winning.

**opencode and kilo-code** had a session-level fallback query selecting
`model_id` — a column neither schema has; both store `model` as JSON text. On
any real database the query threw, the fallback returned null, and the
zero-yield session rollup never emitted a call. Usage for interrupted or
user-only sessions was simply missing, with no error surfaced. The query now
reads the real column and reports `providerID/id`, which the display-name and
pricing paths already canonicalize. A kilo-code mirror of the opencode
zero-yield fallback test pins the fix on the kilo path end to end.

**Versioning.** The per-provider parse fingerprints (session-cache.ts) are
bumped so already-cached sessions re-parse once and pick up the working
fallback; they do not collide with the sibling ports. The shared
DAILY_CACHE_VERSION/MIN_SUPPORTED_VERSION is bumped 16 -> 17: a warm
complete daily cache skips re-hydration, and the ten-year retention window
would otherwise keep serving the pre-fix opencode/kilo/pi/omp zeroes forever,
exactly where this fix matters most. The bump forces the one-time re-derive;
a regression test seeds the pre-fix v16 complete cache and proves the
recovered usage lands. v16 itself is skipped: main already spent it on the
codex structural-discovery fix (eece4cf), so claiming 16 here would load a
main-built v16 cache as current and complete and the invalidation would
never fire.

One caveat: pi/omp discovery now uses the streaming reader with its 4 GB cap
while parse still caps at 128 MB, so a file between those sizes is listed at
discovery and skipped at parse. No usage delta, but the asymmetry is real.
2026-08-05 17:16:02 +03:00
..
src fix(cli): restore pi/omp, cline and opencode session discovery 2026-08-05 17:16:02 +03:00
tests fix(cli): restore pi/omp, cline and opencode session discovery 2026-08-05 17:16:02 +03:00
package.json fix: couple core and CLI releases 2026-07-27 11:55:29 -07:00
tsconfig.json chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
tsup.config.ts chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00
vitest.config.ts chore(workspace): move CLI to packages/cli, add @codeburn/core skeleton (phase 1) 2026-07-26 10:19:33 -07:00