simiancraft/simiancraft-skills / skills/burn-down-github-issues
burn-down-github-issues
UnverifiedRun an unattended burndown of a GitHub issue backlog as cards on a per-operator GitHub Projects board whose lanes are an explicit state machine: appraise and size the inbox, carve what is over the ceiling, fix the ready ones in parallel git worktrees, prove each fix on a draft pull request, have an isolated second-engine reviewer judge it, land one branch at a time with freshness checks, and dead-letter per phase whatever a machine cannot finish. Use when the task is "work the backlog unattended", "triage and fix recent issues", "run the issue loop", "burn down issues", or "where is issue N on the board". Requires a per-repository burn-down-github-issues.config.ts at the target repo's root (the loop refuses to start without it), the prove-work-on-github skill, the codex and claude CLIs for the default seats, and a gh token with the project scope for the board. Skip for one-off fixes to a known issue you are already working interactively, and for backlogs whose issues are mostly product decisions rather than code.
watch.ts
View on GitHub#!/usr/bin/env bun
/**
* Follow a run without composing shell. From inside an adopting repository:
*
* bun run <skill-dir>/watch.ts # events from the current run; exits when the driver exits
* bun run <skill-dir>/watch.ts --all # every line, not only events
* bun run <skill-dir>/watch.ts --wait # print nothing until the run ends, then its terminal lines
*
* The loop tees its console, the floor's walks and readouts included, to
* `<worktreeRoot>/runs/driver.log`. This script polls that file in-process and reports the pid it found in the lock, so an agent watching a run needs one
* command and no `tail`, `kill`, `pgrep`, or subshell. It reads and never writes.
*
* With no lock, or a lock whose pid is gone, it prints what the last run left and exits 0; a run
* that is still alive when the watcher is interrupted is untouched.
*/
import { closeSync, existsSync, openSync, readFileSync, readSync, statSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { invokeRootFrom, loadProjectConfig, PIPELINE_DEFAULTS, repoRootFrom } from '../fix-github-issue/lib/config.ts';
const args = process.argv.slice(2);
const flag = (name: string) => args.includes(`--${name}`);
const ALL = flag('all');
const WAIT = flag('wait');
/** The lines an operator acts on; everything else is agent chatter echoed through. */
const EVENT = new RegExp(
[
'run pid \\d+ started',
'floor:',
'ยท floor walk',
'^- (โ
|๐|๐ฉบ|โ ๏ธ|โ)',
'^ - ',
'running (appraiser|worker|reviewer|walker) on',
'appraisal:',
'verdict:',
'review:',
'review round',
'merge PR',
'merged',
'park',
'DLQ',
'needs-(decision|human)',
'already-fixed',
'obsolete',
'closed',
'worker failed',
'reviewer wrote no verdict',
'exceeded \\d+ minutes',
'refusing',
'did not report',
'conflicts with',
'uncommitted changes',
'Cannot find',
'SyntaxError',
'line-switch',
'paused',
'liveness: down',
': (present|intact|absent|not-checkable|not-yet-deployed|unverified) by',
'incident',
'Walking \\d+',
'nothing on the floor',
'received SIG',
'^done$',
'nothing in Ready',
'backlog by lane',
'board:',
'nothing to appraise',
].join('|'),
);
/** A terminal line is one that decides an issue's fate or ends the run; `--wait` prints only these. */
const TERMINAL =
/merge PR|merged|park|DLQ|needs-(decision|human)|already-fixed|obsolete|worker failed|reviewer wrote no verdict|exceeded \d+ minutes|refusing|conflicts with|incident|liveness: down|received SIG|^done$|nothing in Ready/;
type Followed = { path: string; offset: number; label: string; inode?: number };
function readLockPid(lockPath: string): number | null {
if (!existsSync(lockPath)) return null;
const pid = Number(readFileSync(lockPath, 'utf8').trim());
if (!Number.isInteger(pid) || pid <= 0) return null;
try {
process.kill(pid, 0);
return pid;
} catch {
return null;
}
}
function alive(pid: number): boolean {
try {
process.kill(pid, 0);
return true;
} catch {
return false;
}
}
/**
* Returns the new complete lines since the last call, leaving a partial trailing line for next
* time. A replaced file (different inode) or a shrunken one restarts from zero; a file that
* vanishes between the stat and the read is simply retried on the next poll.
*/
function drain(file: Followed): string[] {
let size: number;
let inode: number;
try {
const stat = statSync(file.path);
size = stat.size;
inode = stat.ino;
} catch {
return [];
}
if (file.inode !== undefined && file.inode !== inode) file.offset = 0; // rotated or replaced
file.inode = inode;
if (size < file.offset) file.offset = 0; // truncated; start over
if (size === file.offset) return [];
const buffer = Buffer.alloc(size - file.offset);
let text: string;
try {
const fd = openSync(file.path, 'r');
try {
readSync(fd, buffer, 0, buffer.length, file.offset);
} finally {
closeSync(fd);
}
text = buffer.toString('utf8');
} catch {
return [];
}
const lastNewline = text.lastIndexOf('\n');
if (lastNewline < 0) return [];
file.offset += Buffer.byteLength(text.slice(0, lastNewline + 1));
return text.slice(0, lastNewline).split('\n');
}
/** Start at the header of the most recent run in the file, so an old run's lines are not replayed. */
function seekToLastRun(file: Followed, header: RegExp): void {
if (!existsSync(file.path)) return;
const text = readFileSync(file.path, 'utf8');
let at = -1;
for (const match of text.matchAll(header)) at = match.index ?? at;
file.offset = at < 0 ? 0 : Buffer.byteLength(text.slice(0, at));
}
async function main(): Promise<void> {
const repoRoot = repoRootFrom(process.cwd());
const invokeRoot = invokeRootFrom(process.cwd(), repoRoot);
const { project } = await loadProjectConfig({
invokeRoot,
repoRoot,
fileName: 'burn-down-github-issues.config.ts',
defaults: PIPELINE_DEFAULTS,
positiveIntegers: ['maxReviewRounds'],
help: ['watch.ts reads the same config as loop.ts to find the runs directory.'],
});
const runDir = resolve(repoRoot, project.worktreeRoot, 'runs');
const lockPath = join(runDir, 'loop.lock');
const files: Followed[] = [{ path: join(runDir, 'driver.log'), offset: 0, label: 'loop' }];
// The driver's header is timestamped like every other log line.
seekToLastRun(files[0], /^\d{2}:\d{2}:\d{2} run pid \d+ started/gm);
const pid = readLockPid(lockPath);
const held: string[] = [];
const emit = (label: string, line: string) => {
const text = files.length > 1 ? `[${label}] ${line}` : line;
if (WAIT) {
if (TERMINAL.test(line)) held.push(text);
return;
}
if (ALL || EVENT.test(line)) console.log(text);
};
const pump = () => {
for (const file of files) for (const line of drain(file)) if (line.trim() !== '') emit(file.label, line);
};
if (pid === null) {
console.log(`no running driver (${lockPath} absent or its pid is gone); showing what the last run left`);
pump();
if (WAIT) for (const line of held) console.log(line);
return;
}
console.log(`following pid ${pid} via ${lockPath}`);
pump();
while (alive(pid)) {
await Bun.sleep(1000);
pump();
}
await Bun.sleep(1500); // let the final lines land after the process exits
pump();
if (WAIT) for (const line of held) console.log(line);
console.log(`driver ${pid} exited`);
}
await main();
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why โ repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" โ or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself โ your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |