refactor(jcode): fold three reverse-scan copies into one, reuse the shared hook POST

The jcode journal reader, the Claude transcript reader and the Command Code
transcript reader each carried their own copy of the same reverse chunked line
scan; they now share one tested helper. jcode's managed hook script drops its
hand-rolled curl for buildPosixAgentHookPostCommand, which also gains it the
raw-JSON transport and the --noproxy guard the bespoke copy was missing.

Co-authored-by: czzczz <chanzrz_zbf@foxmail.com>
This commit is contained in:
Neil
2026-10-03 01:49:40 -07:00
committed by Neil
co-authored by czzczz
parent 7fb201f60f
commit 0a45ad5ec4
17 changed files with 335 additions and 357 deletions
+3 -3
View File
@@ -105,10 +105,10 @@ describe.runIf(process.platform !== 'win32')('jcode managed hook as jcode runs i
const script = readFileSync(scriptPath, 'utf8')
const gateBranch = script.slice(script.indexOf('if [ "$JCODE_HOOK_EVENT" = pre_tool ]'))
expect(gateBranch).toContain('orca_post_jcode_event >/dev/null 2>&1 &')
// The observer path keeps the plain call, so a slow POST cannot be lost to
// a script that exited first.
// The observer path keeps the foreground call, so a slow POST cannot be lost
// to a script that exited first.
expect(gateBranch).toContain('orca_post_jcode_event >/dev/null 2>&1 || :')
expect(script.trimEnd().endsWith('exit 0')).toBe(true)
expect(script).toContain('\norca_post_jcode_event\n')
} finally {
cleanup()
}