feat(watch): --new-only for --await-review — re-armable architect review-notifier without backlog spin
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
caf60ea939
commit
1e29a7b9b9
@ -148,7 +148,7 @@ async function fetchReviewTasks(serverUrl: string): Promise<AgentHubEvent[]> {
|
|||||||
*/
|
*/
|
||||||
export async function watchEvents(
|
export async function watchEvents(
|
||||||
serverUrl: string,
|
serverUrl: string,
|
||||||
options: { once?: boolean; role?: string; awaitReview?: boolean } = {},
|
options: { once?: boolean; role?: string; awaitReview?: boolean; newOnly?: boolean } = {},
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const url = new URL('/events', serverUrl);
|
const url = new URL('/events', serverUrl);
|
||||||
// Pass role to the server for an additional server-side filter (saves
|
// 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,
|
// --await-review: surface a submission that's ALREADY pending on connect,
|
||||||
// so the architect isn't blind to reviews submitted before this watcher.
|
// 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);
|
const pending = await fetchReviewTasks(serverUrl);
|
||||||
if (pending.length > 0) {
|
if (pending.length > 0) {
|
||||||
for (const ev of pending) console.log(formatEvent(ev));
|
for (const ev of pending) console.log(formatEvent(ev));
|
||||||
|
|||||||
@ -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('--once', 'Exit 0 after the first event (useful as a blocking wait for agents)')
|
||||||
.option('--role <role>', 'Client-side role filter (only show events for this role)')
|
.option('--role <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('--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) => {
|
.action(async (options) => {
|
||||||
const { serverUrl } = await resolveContext(program, cwd);
|
const { serverUrl } = await resolveContext(program, cwd);
|
||||||
if (!serverUrl) {
|
if (!serverUrl) {
|
||||||
@ -631,6 +632,7 @@ export function createProgram(cwd: string): Command {
|
|||||||
once: options.once as boolean | undefined,
|
once: options.once as boolean | undefined,
|
||||||
role: options.role as string | undefined,
|
role: options.role as string | undefined,
|
||||||
awaitReview: options.awaitReview as boolean | undefined,
|
awaitReview: options.awaitReview as boolean | undefined,
|
||||||
|
newOnly: options.newOnly as boolean | undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user