feat(omo-codex): add post-compact rule budget to codex hook
Trim rule and result char budgets after compaction via new postCompactMaxRuleChars/postCompactMaxResultChars config, applied through withPostCompactBudget. Extract codex-hook helpers into dynamic-target-fingerprints, hook-output, path-utils, rules-engine-factory, and transcript-rule-filter modules.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
import { configFromEnvironment } from "./config.js";
|
||||
import { createEngine } from "./rules/engine.js";
|
||||
import { findRuleCandidates } from "./rules/finder.js";
|
||||
import { findProjectRoot } from "./rules/project-root.js";
|
||||
|
||||
interface RulesEngineFactoryOptions {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}
|
||||
|
||||
export function createRulesEngine(options: RulesEngineFactoryOptions, config = configFromEnvironment(options.env)) {
|
||||
return createEngine(config, {
|
||||
findCandidates: findRuleCandidates,
|
||||
findProjectRoot,
|
||||
readFile: (path) => {
|
||||
try {
|
||||
return readFileSync(path, "utf8");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user