Context
scripts/hooks/json-helper.cjs is 1,837 lines with 29 switch cases. PR #193 extracted sidecar-ops.cjs as the first domain module using the handle(command, args, cwd) => boolean pattern.
Pattern
Each extraction follows the established routing pattern:
// In json-helper.cjs — lazy-loaded, routed before the main switch
if (op === 'some-operation') {
const someOps = require('./lib/some-ops.cjs');
if (someOps.handle(op, args, process.cwd())) {
process.exit(0);
}
}
Extraction Candidates
Logical groupings by domain:
- Learning operations —
process-observations, render-ready, reconcile-manifest, merge-observation, temporal-decay, filter-observations, learning-created, learning-new
- Knowledge operations —
knowledge-append, read-sidecar (done)
- Session/memory operations —
session-output, prompt-output, backup-construct
- JSON utilities —
get-field, get-field-file, validate, compact, update-field, update-fields, construct
Acceptance Criteria
Context
scripts/hooks/json-helper.cjsis 1,837 lines with 29 switch cases. PR #193 extractedsidecar-ops.cjsas the first domain module using thehandle(command, args, cwd) => booleanpattern.Pattern
Each extraction follows the established routing pattern:
Extraction Candidates
Logical groupings by domain:
process-observations,render-ready,reconcile-manifest,merge-observation,temporal-decay,filter-observations,learning-created,learning-newknowledge-append,read-sidecar(done)session-output,prompt-output,backup-constructget-field,get-field-file,validate,compact,update-field,update-fields,constructAcceptance Criteria
handle(command, args, cwd) => booleanrequire()— no eager top-level imports