Skip to content

simiancraft/simiancraft-skills / skills/burn-down-github-issues

burn-down-github-issues

Unverified

Run 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.

FileKindSize
SKILL.mdskill md17.0 KB
board.tsscript6.5 KB
callbacks/README.mdmarkdown1.1 KB
callbacks/on-size-over-ceilingother843 B
card.tsscript4.3 KB
chart-machine.tsscript3.9 KB
claim-race.tsscript6.1 KB
export-machine.tsscript1.8 KB
lanes.tsscript5.2 KB
lib/admission.test.tsscript7.6 KB
lib/admission.tsscript5.5 KB
lib/board-writer.test.tsscript3.6 KB
lib/board-writer.tsscript11.8 KB
lib/carving-revisit.test.tsscript7.5 KB
lib/carving.tsscript26.9 KB
lib/floor/config.test.tsscript456 B
lib/floor/config.tsscript8.1 KB
lib/floor/floor.test.tsscript9.9 KB
lib/floor/floor.tsscript28.7 KB
lib/floor/incident.tsscript11.2 KB
lib/floor/ledger.tsscript5.6 KB
lib/floor/probe.tsscript3.6 KB
lib/lanes.tsscript4.4 KB
lib/machine.test.tsscript11.2 KB
lib/machine.tsscript52.4 KB
lib/place-callbacks.test.tsscript2.5 KB
lib/place-callbacks.tsscript3.0 KB
lib/preflight.test.tsscript4.5 KB
lib/preflight.tsscript1.2 KB
lib/pressure.test.tsscript56.9 KB
lib/refs.test.tsscript1010 B
lib/refs.tsscript1.9 KB
lib/run-scope.test.tsscript5.4 KB
lib/run-scope.tsscript1.2 KB
lib/scenarios.test.tsscript17.1 KB
lib/simulate.test.tsscript7.3 KB
lib/simulate.tsscript7.0 KB
lib/world-sweep.test.tsscript21.4 KB
loop.source.test.tsscript4.8 KB
loop.tsscript66.2 KB
prompts/diagnose.mdmarkdown2.1 KB
prompts/walk.mdmarkdown3.6 KB
references/adopting.mdmarkdown26.3 KB
references/architecture.mdmarkdown20.7 KB
references/floor.mdmarkdown14.6 KB
references/operating.mdmarkdown19.6 KB
references/state-machine.mdmarkdown31.1 KB
status.tsscript4.9 KB
watch.tsscript6.4 KB
#!/usr/bin/env bun
/**
 * Write the lanes onto the operator's board. From inside an adopting repository, after board.ts:
 *
 *   bun run <skill-dir>/lanes.ts             # set Status to the full lane set, ensure the Phase field, verify
 *   bun run <skill-dir>/lanes.ts --dry-run   # print what would change
 *
 * Status is the board's built-in single-select field; its options become the lanes, sent as the
 * complete set in board order (the mutation replaces the whole set and reassigns every option id,
 * so nothing here stores an id). Phase is a second single-select field, created when absent, that
 * the loop writes alongside Status so a view grouped by Phase is the collapsed board.
 *
 * Idempotent: a board already carrying the set is verified and left alone. Needs the `project`
 * scope; see references/adopting.md, "The board".
 */

import { existsSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { invokeRootFrom, loadProjectConfig, PIPELINE_DEFAULTS, repoRootFrom } from '../fix-github-issue/lib/config.ts';
import type { Board } from './board.ts';
import { type LaneColor, phaseOptions, statusOptions } from './lib/lanes.ts';

const args = process.argv.slice(2);
const DRY_RUN = args.includes('--dry-run');

const REPO_ROOT = repoRootFrom(process.cwd());
const INVOKE_ROOT = invokeRootFrom(process.cwd(), REPO_ROOT);
const CONFIG = await loadProjectConfig({
  invokeRoot: INVOKE_ROOT,
  repoRoot: REPO_ROOT,
  fileName: 'burn-down-github-issues.config.ts',
  defaults: PIPELINE_DEFAULTS,
  positiveIntegers: [],
  help: ['lanes.ts reads the same config the loop does; see references/adopting.md'],
});
const POINTER = join(resolve(REPO_ROOT, CONFIG.project.worktreeRoot, 'runs'), 'board.json');
if (!existsSync(POINTER)) {
  console.error(`no board pointer at ${POINTER}; run board.ts first`);
  process.exit(1);
}
const board = JSON.parse(readFileSync(POINTER, 'utf8')) as Board;

type Option = { id: string; name: string; color: LaneColor; description: string };
type Field = { id: string; name: string; options: Option[] };

function graphql(query: string): unknown {
  const proc = Bun.spawnSync(['gh', 'api', 'graphql', '-f', `query=${query}`], { stderr: 'pipe', stdout: 'pipe' });
  if (proc.exitCode !== 0) {
    console.error(proc.stderr.toString().trim() || proc.stdout.toString().trim());
    process.exit(1);
  }
  const parsed = JSON.parse(proc.stdout.toString()) as { data: unknown; errors?: Array<{ message: string }> };
  if (parsed.errors?.length) {
    console.error(parsed.errors.map((e) => e.message).join('\n'));
    process.exit(1);
  }
  return parsed.data;
}

function readFields(): Field[] {
  const data = graphql(
    `{ node(id:"${board.id}") { ... on ProjectV2 { fields(first:50) { nodes { ... on ProjectV2SingleSelectField { id name options { id name color description } } } } } } }`,
  ) as { node: { fields: { nodes: Array<Partial<Field>> } } };
  return data.node.fields.nodes.filter((f): f is Field => typeof f.id === 'string' && Array.isArray(f.options));
}

/** GraphQL input literal for an option list; names and descriptions are JSON-quoted, colors are enums. */
function optionsLiteral(options: Array<{ name: string; color: LaneColor; description: string }>): string {
  return `[${options.map((o) => `{name:${JSON.stringify(o.name)}, color:${o.color}, description:${JSON.stringify(o.description)}}`).join(', ')}]`;
}

function same(current: Option[], wanted: Array<{ name: string; color: LaneColor; description: string }>): boolean {
  if (current.length !== wanted.length) return false;
  return current.every((c, i) => c.name === wanted[i].name && c.color === wanted[i].color && c.description === wanted[i].description);
}

function ensureField(name: string, wanted: Array<{ name: string; color: LaneColor; description: string }>): void {
  const before = readFields().find((f) => f.name === name);
  if (before && same(before.options, wanted)) {
    console.log(`  ${name}: ${wanted.length} options already in place`);
    return;
  }
  if (DRY_RUN) {
    console.log(`  DRY RUN  ${before ? 'would rewrite' : 'would create'} ${name} with ${wanted.length} options:`);
    for (const o of wanted) console.log(`             ${o.name}`);
    return;
  }
  if (before) {
    graphql(
      `mutation { updateProjectV2Field(input:{ fieldId:"${before.id}", singleSelectOptions:${optionsLiteral(wanted)} }) { projectV2Field { ... on ProjectV2SingleSelectField { id } } } }`,
    );
  } else {
    graphql(
      `mutation { createProjectV2Field(input:{ projectId:"${board.id}", dataType:SINGLE_SELECT, name:${JSON.stringify(name)}, singleSelectOptions:${optionsLiteral(wanted)} }) { projectV2Field { ... on ProjectV2SingleSelectField { id } } } }`,
    );
  }
  // Verify by an independent read: the mutation's echo is not what is trusted.
  const after = readFields().find((f) => f.name === name);
  if (!after || !same(after.options, wanted)) {
    console.error(`verification failed: ${name} does not read back as the ${wanted.length} wanted options`);
    process.exit(1);
  }
  console.log(`  ${name}: ${before ? 'rewritten' : 'created'} and verified, ${wanted.length} options`);
}

console.log(`lanes on ${board.title} #${board.number} ${board.url}`);
ensureField('Status', statusOptions());
ensureField('Phase', phaseOptions());
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall