diff --git a/src/cli/commands/watch.ts b/src/cli/commands/watch.ts index 6c06ed8..dddddd8 100644 --- a/src/cli/commands/watch.ts +++ b/src/cli/commands/watch.ts @@ -148,7 +148,7 @@ async function fetchReviewTasks(serverUrl: string): Promise { */ export async function watchEvents( serverUrl: string, - options: { once?: boolean; role?: string; awaitReview?: boolean } = {}, + options: { once?: boolean; role?: string; awaitReview?: boolean; newOnly?: boolean } = {}, ): Promise { const url = new URL('/events', serverUrl); // Pass role to the server for an additional server-side filter (saves @@ -181,7 +181,10 @@ export async function watchEvents( // --await-review: surface a submission that's ALREADY pending on connect, // so the architect isn't blind to reviews submitted before this watcher. - if (options.awaitReview) { + // --new-only suppresses this backlog check so the notifier can be re-armed + // without instantly exiting on a still-non-empty review queue (no spin) — + // it then fires only on the NEXT genuine task→review transition. + if (options.awaitReview && !options.newOnly) { const pending = await fetchReviewTasks(serverUrl); if (pending.length > 0) { for (const ev of pending) console.log(formatEvent(ev)); diff --git a/src/cli/index.ts b/src/cli/index.ts index ba00c09..13df86d 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -620,6 +620,7 @@ export function createProgram(cwd: string): Command { .option('--once', 'Exit 0 after the first event (useful as a blocking wait for agents)') .option('--role ', 'Client-side role filter (only show events for this role)') .option('--await-review', 'Exit when an implementer submits (task → review); architect review-queue notifier') + .option('--new-only', 'With --await-review: fire only on NEW submissions, ignore tasks already in review on connect (re-armable without spinning)') .action(async (options) => { const { serverUrl } = await resolveContext(program, cwd); if (!serverUrl) { @@ -631,6 +632,7 @@ export function createProgram(cwd: string): Command { once: options.once as boolean | undefined, role: options.role as string | undefined, awaitReview: options.awaitReview as boolean | undefined, + newOnly: options.newOnly as boolean | undefined, }); });