mirror of
https://github.com/thedotmack/claude-mem.git
synced 2026-09-20 04:23:02 +08:00
d431f0e689
* fix(worker): dispatch transcript subcommand in worker-service main (2450)
`npx claude-mem transcript watch` exits silently in v13.2.0. The npx
CLI looks for `<marketplace>/plugin/scripts/transcript-watcher.cjs`
and falls back to `spawnBunWorkerCommand('transcript', ['watch'])`
when it is missing — and the bundle never produces that file. The
fallback lands in `worker-service.cjs transcript watch`, but the
worker switch has no `transcript` case, so it falls through to the
`--daemon` default and the command becomes a no-op.
Add the missing case in `worker-service.ts` so it dispatches to the
shared `runTranscriptCommand` from `src/services/transcripts/cli.ts`.
`init`, `watch`, and `validate` now all work through the worker-service
entry point.
A structural-plus-behavioral test verifies the wiring fails without
the patch and passes with it.
Co-Authored-By: Claude <noreply@anthropic.com>
* test(transcripts): replace source-scan with runtime parse + dispatch tests (2450)
Address Greptile review nit on PR 2500: the previous cli-dispatch test
asserted dispatch by regex-matching the worker-service.ts source text,
which would silently pass through quote/path refactors that actually
break routing. Replace with two runtime tests:
1. parseWorkerServiceCommand(["transcript", <sub>, ...]) returns
{ command: "transcript", args: [<sub>, ...] } for watch / init /
validate — proves the argv parser routes the new subcommand
correctly without scanning source.
2. runTranscriptCommand("init", ...) writes a real config file —
proves the dispatch target works end-to-end.
Export parseWorkerServiceCommand + ParsedWorkerCommand to enable the
parser-level assertion. No behavior change in worker-service.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
42 lines
1.8 KiB
TypeScript
42 lines
1.8 KiB
TypeScript
import { describe, it, expect } from 'bun:test';
|
|
import { existsSync, mkdtempSync, readFileSync, rmSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
import { runTranscriptCommand } from '../../src/services/transcripts/cli.js';
|
|
import { parseWorkerServiceCommand } from '../../src/services/worker-service.js';
|
|
|
|
describe('npx claude-mem transcript watch fallback (2450)', () => {
|
|
it('parseWorkerServiceCommand routes "transcript <sub>" argv to command=transcript + args=[sub, ...]', () => {
|
|
const parsedWatch = parseWorkerServiceCommand(['transcript', 'watch']);
|
|
expect(parsedWatch.command).toBe('transcript');
|
|
expect(parsedWatch.args).toEqual(['watch']);
|
|
|
|
const parsedInit = parseWorkerServiceCommand([
|
|
'transcript',
|
|
'init',
|
|
'--config',
|
|
'/tmp/example.json',
|
|
]);
|
|
expect(parsedInit.command).toBe('transcript');
|
|
expect(parsedInit.args).toEqual(['init', '--config', '/tmp/example.json']);
|
|
|
|
const parsedValidate = parseWorkerServiceCommand(['transcript', 'validate']);
|
|
expect(parsedValidate.command).toBe('transcript');
|
|
expect(parsedValidate.args).toEqual(['validate']);
|
|
});
|
|
|
|
it('runTranscriptCommand("init", …) writes a default config (dispatch target works end-to-end)', async () => {
|
|
const tmpDir = mkdtempSync(join(tmpdir(), 'claude-mem-transcript-cli-'));
|
|
const configPath = join(tmpDir, 'transcript-watch.json');
|
|
try {
|
|
const exitCode = await runTranscriptCommand('init', ['--config', configPath]);
|
|
expect(exitCode).toBe(0);
|
|
expect(existsSync(configPath)).toBe(true);
|
|
const parsed = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
expect(parsed).toHaveProperty('watches');
|
|
} finally {
|
|
rmSync(tmpDir, { recursive: true, force: true });
|
|
}
|
|
});
|
|
});
|