MCPcopy
hub / github.com/openai/codex-plugin-cc / main

Function main

plugins/codex/scripts/stop-review-gate-hook.mjs:142–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140}
141
142function main() {
143 const input = readHookInput();
144 const cwd = input.cwd || process.env.CLAUDE_PROJECT_DIR || process.cwd();
145 const workspaceRoot = resolveWorkspaceRoot(cwd);
146 const config = getConfig(workspaceRoot);
147
148 const jobs = sortJobsNewestFirst(filterJobsForCurrentSession(listJobs(workspaceRoot), input));
149 const runningJob = jobs.find((job) => job.status === "queued" || job.status === "running");
150 const runningTaskNote = runningJob
151 ? `Codex task ${runningJob.id} is still running. Check /codex:status and use /codex:cancel ${runningJob.id} if you want to stop it before ending the session.`
152 : null;
153
154 if (!config.stopReviewGate) {
155 logNote(runningTaskNote);
156 return;
157 }
158
159 const setupNote = buildSetupNote(cwd);
160 if (setupNote) {
161 logNote(setupNote);
162 logNote(runningTaskNote);
163 return;
164 }
165
166 const review = runStopReview(cwd, input);
167 if (!review.ok) {
168 emitDecision({
169 decision: "block",
170 reason: runningTaskNote ? `${runningTaskNote} ${review.reason}` : review.reason
171 });
172 return;
173 }
174
175 logNote(runningTaskNote);
176}
177
178try {
179 main();

Callers 1

Calls 10

resolveWorkspaceRootFunction · 0.90
getConfigFunction · 0.90
sortJobsNewestFirstFunction · 0.90
listJobsFunction · 0.90
logNoteFunction · 0.85
buildSetupNoteFunction · 0.85
runStopReviewFunction · 0.85
emitDecisionFunction · 0.85
readHookInputFunction · 0.70

Tested by

no test coverage detected