Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ same name lands on the session row (§9.7). A run stopped by a policy limit
| `fda_document` | documenter | request → document | Write up recent changes (docs paths only). |
| `fda_quality` | none | request → *quality* | Lint + typecheck + build + test with no agent — works with nothing logged in. |
| `fda_plan_build_test` | planner, builder (+reviewer for the UI gate) | request → plan → build → *test* → up to `stop.attempt_cap` × (fix → *test*), default 3, cut short by `no_progress` → *spec_coverage* → checklist gate → UI gate → *holdout* → *commit* | The task workhorse (`/task` uses it via the sequencer). |
| `fda_sdlc` | planner, builder, reviewer, documenter | request → plan → build → *test* (single run, no fix loop) → *spec_coverage* → checklist gate → UI gate → *holdout* → review → *commit_code* → document → *commit_docs* | Full cycle with an independent review — the review runs even when tests failed, and acceptance requires green tests AND an approved review. |
| `fda_sdlc` | planner, builder, reviewer, documenter | request → plan (or free *plan_skip* when the brief is self-contained — `sdlc.plan: auto`) → build → *test_1* + fix loop (up to `stop.attempt_cap` rounds, same tracker as the siblings) → *spec_coverage* → checklist gate → UI gate → *holdout* → review (green suites only; a red suite records the free *review_skip* instead) → *commit_code* → document (only with `sdlc.document: per_task`; the default `per_milestone` records the free *document_skip* and `/goal` drains docs with one `fda_document` per milestone) → *commit_docs* | Full cycle with an independent review — acceptance requires green tests AND an approved review; a suite still red after the fix rounds ends the run as `attempt_cap` (or `no_progress` when stalled) without paying the reviewer. |
| `fda_bug` | planner, builder (+reviewer) | request → plan → red_test → *red_check* → build → *test* → fix loop (≤ `stop.attempt_cap`, default 3; `no_progress` ends it early) → gates → *commit* | Defect fixing with a **valid RED** gate: the reproduction test must fail on an assertion BEFORE the fix (passing = "bug not reproduced"; module/syntax/env failures = invalid RED). |
| `fda_quick` | builder | request → build → *quality_1* (lint+typecheck+focal test) → one fix round (by design, not from `stop:`; still red = `attempt_cap`) → *quality_2* → *quicklog* → *commit* | Small guarded changes (`/quick`). Appends the `## Q-NNN` audit entry, then stamps the commit sha into it as a separate one-line commit. |
| `fda_build_test` | builder (+reviewer for the UI gate) | request → build → *test* → up to `stop.attempt_cap` × (fix → *test*), default 3, cut short by `no_progress` → *spec_coverage* → checklist gate → UI gate → *holdout* → *commit* | Like `fda_plan_build_test` but **without the planner** — the brief goes directly to the builder. Saves ~1-2.5M tokens per run when the brief is already autocontained. |
Expand Down
31 changes: 5 additions & 26 deletions fia-templates/fda_bug.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/** FDA Bug — plan → failing reproduction (valid RED) → fix → green suite → commit. */
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { existsSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { runFda, phaseParams } from './modules/fda-cli.mjs';
import { artifactsExist, filesNonEmpty, validateRedReason, parseSpecLine, checkSpecCoverage, checkSpecDiagram } from './modules/gates.mjs';
Expand All @@ -11,32 +11,11 @@ import { floorPath } from './modules/floor.mjs';
import { runSpecDeliveryClose } from './modules/spec-lifecycle.mjs';
import { OUTCOMES } from './modules/outcome.mjs';
import { changedContentSignature, createRepairTracker } from './modules/stop.mjs';
import { builderDeclaredFiles } from './modules/utils.mjs';
import * as git from './modules/git-helper.mjs';

/**
* Files declared by EVERY persisted builder envelope (red_test + build +
* fix_N). Same reason as fda_plan_build_test: on resume the in-memory
* envelopes may not cover earlier rounds — phase_results always do.
*/
function builderDeclaredFiles(run) {
const files = [];
let names = [];
try {
names = readdirSync(run.phaseResultsDir);
} catch {
/* no phase results dir — nothing persisted */
}
for (const name of names) {
if (!/^(red_test|build|fix_\d+|fix_checklist|fix_ui)\.json$/.test(name)) continue;
try {
const saved = JSON.parse(readFileSync(join(run.phaseResultsDir, name), 'utf8'));
files.push(...(saved.result?.changed_files || []), ...(saved.result?.artifacts || []));
} catch {
/* unreadable phase result — the in-memory envelopes still cover the rest */
}
}
return files;
}
/** This runner's builder rounds include the RED reproduction test. */
const BUG_RESULT_FILES = /^(red_test|build|fix_\d+|fix_checklist|fix_ui)\.json$/;

/** A phase that already ran in this fda_id (its result file is on disk). */
function phaseAlreadyRan(run, name) {
Expand Down Expand Up @@ -280,7 +259,7 @@ await runFda(
...redFiles,
...(previous.changed_files || []),
...(previous.artifacts || []),
...builderDeclaredFiles(run),
...builderDeclaredFiles(run, BUG_RESULT_FILES),
...(specClose.changed_files || []),
// The regression floor rises on a green suite (modules/floor.mjs)
// and rides the SAME commit as the work that raised it.
Expand Down
29 changes: 1 addition & 28 deletions fia-templates/fda_build_test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env node
/** FDA Build Test — build → test → commit (no planner, brief goes directly to builder). */
import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { runFda, phaseParams } from './modules/fda-cli.mjs';
import { artifactsExist, parseSpecLine, checkSpecCoverage, checkSpecDiagram, isFoundationBrief } from './modules/gates.mjs';
import { resolveBriefPath, runChecklistGate } from './modules/checklist.mjs';
Expand All @@ -12,34 +10,9 @@ import { runHoldoutGate } from './modules/holdout.mjs';
import { runSpecDeliveryClose } from './modules/spec-lifecycle.mjs';
import { OUTCOMES } from './modules/outcome.mjs';
import { changedContentSignature, createRepairTracker } from './modules/stop.mjs';
import { builderDeclaredFiles } from './modules/utils.mjs';
import * as git from './modules/git-helper.mjs';

/**
* Files declared by EVERY persisted builder envelope (build + fix_N). On resume
* the in-memory `previous` can be just the replayed build envelope (test_1
* re-runs and passes because the fix is already on disk, so the fix loop never
* executes) — files touched by earlier fix rounds live only in phase_results.
*/
function builderDeclaredFiles(run) {
const files = [];
let names = [];
try {
names = readdirSync(run.phaseResultsDir);
} catch {
/* no phase results dir — nothing persisted */
}
for (const name of names) {
if (!/^(build|fix_\d+|fix_checklist|fix_ui)\.json$/.test(name)) continue;
try {
const saved = JSON.parse(readFileSync(join(run.phaseResultsDir, name), 'utf8'));
files.push(...(saved.result?.changed_files || []), ...(saved.result?.artifacts || []));
} catch {
/* unreadable phase result — the in-memory envelopes still cover the rest */
}
}
return files;
}

await runFda(
async ({ run, prompt, args }) => {
// The repair cap and the no-progress window come from the student's
Expand Down
29 changes: 1 addition & 28 deletions fia-templates/fda_plan_build_test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env node
/** FDA Plan Build Test — plan → build → test → commit. */
import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { runFda, phaseParams } from './modules/fda-cli.mjs';
import { artifactsExist, filesNonEmpty, parseSpecLine, checkSpecCoverage, checkSpecDiagram, isFoundationBrief } from './modules/gates.mjs';
import { resolveBriefPath, runChecklistGate } from './modules/checklist.mjs';
Expand All @@ -12,34 +10,9 @@ import { runHoldoutGate } from './modules/holdout.mjs';
import { runSpecDeliveryClose } from './modules/spec-lifecycle.mjs';
import { OUTCOMES } from './modules/outcome.mjs';
import { changedContentSignature, createRepairTracker } from './modules/stop.mjs';
import { builderDeclaredFiles } from './modules/utils.mjs';
import * as git from './modules/git-helper.mjs';

/**
* Files declared by EVERY persisted builder envelope (build + fix_N). On resume
* the in-memory `previous` can be just the replayed build envelope (test_1
* re-runs and passes because the fix is already on disk, so the fix loop never
* executes) — files touched by earlier fix rounds live only in phase_results.
*/
function builderDeclaredFiles(run) {
const files = [];
let names = [];
try {
names = readdirSync(run.phaseResultsDir);
} catch {
/* no phase results dir — nothing persisted */
}
for (const name of names) {
if (!/^(build|fix_\d+|fix_checklist|fix_ui)\.json$/.test(name)) continue;
try {
const saved = JSON.parse(readFileSync(join(run.phaseResultsDir, name), 'utf8'));
files.push(...(saved.result?.changed_files || []), ...(saved.result?.artifacts || []));
} catch {
/* unreadable phase result — the in-memory envelopes still cover the rest */
}
}
return files;
}

await runFda(
async ({ run, prompt, args }) => {
// The repair cap and the no-progress window come from the student's
Expand Down
26 changes: 4 additions & 22 deletions fia-templates/fda_prototype.mjs
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
#!/usr/bin/env node
/** FDA Prototype — build → lint/typecheck → commit (no plan, no tests, no review). */
import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
import { runFda, phaseParams } from './modules/fda-cli.mjs';
import { artifactsExist, isFoundationBrief, isPrototypeBrief } from './modules/gates.mjs';
import { defaultSpecs, runQuality, asEnvelope } from './modules/quality.mjs';
import { OUTCOMES } from './modules/outcome.mjs';
import { builderDeclaredFiles } from './modules/utils.mjs';
import * as git from './modules/git-helper.mjs';

function builderDeclaredFiles(run) {
const files = [];
let names = [];
try {
names = readdirSync(run.phaseResultsDir);
} catch {
/* no phase results dir */
}
for (const name of names) {
if (!/^(build|fix)\.json$/.test(name)) continue;
try {
const saved = JSON.parse(readFileSync(join(run.phaseResultsDir, name), 'utf8'));
files.push(...(saved.result?.changed_files || []), ...(saved.result?.artifacts || []));
} catch {
/* unreadable phase result */
}
}
return files;
}
/** This runner has a single fix round, persisted as `fix.json`. */
const PROTOTYPE_RESULT_FILES = /^(build|fix)\.json$/;

function protoSpecs(projectRoot) {
return defaultSpecs(projectRoot).filter((s) => s.name === 'lint' || s.name === 'typecheck');
Expand Down Expand Up @@ -90,7 +72,7 @@ await runFda(
...new Set([
...(build.changed_files || []),
...(build.artifacts || []),
...builderDeclaredFiles(run),
...builderDeclaredFiles(run, PROTOTYPE_RESULT_FILES),
...(isFoundationBrief(prompt) ? git.runChangedPaths(run.repoRoot, run.baseline) : []),
]),
];
Expand Down
27 changes: 5 additions & 22 deletions fia-templates/fda_quick.mjs
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
#!/usr/bin/env node
/** FDA Quick — guardrailed small change: build → quality → quick-log → commit. */
import { readdirSync, readFileSync } from 'node:fs';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { runFda, phaseParams } from './modules/fda-cli.mjs';
import { artifactsExist } from './modules/gates.mjs';
import { defaultSpecs, focalSpec, runQuality, asEnvelope } from './modules/quality.mjs';
import { appendQuickLog, setQuickLogCommit } from './modules/quicklog.mjs';
import { OUTCOMES } from './modules/outcome.mjs';
import { builderDeclaredFiles } from './modules/utils.mjs';
import * as git from './modules/git-helper.mjs';

/** Files declared by the persisted builder envelopes (build + fix) — see fda_plan_build_test. */
function builderDeclaredFiles(run) {
const files = [];
let names = [];
try {
names = readdirSync(run.phaseResultsDir);
} catch {
/* no phase results dir — nothing persisted */
}
for (const name of names) {
if (!/^(build|fix)\.json$/.test(name)) continue;
try {
const saved = JSON.parse(readFileSync(join(run.phaseResultsDir, name), 'utf8'));
files.push(...(saved.result?.changed_files || []), ...(saved.result?.artifacts || []));
} catch {
/* unreadable phase result — the in-memory envelopes still cover the rest */
}
}
return files;
}
/** This runner has a single fix round, persisted as `fix.json`. */
const QUICK_RESULT_FILES = /^(build|fix)\.json$/;

/** The persisted result of an earlier phase of this fda_id, or null. */
function savedPhaseResult(run, name) {
Expand Down Expand Up @@ -105,7 +88,7 @@ await runFda(

if (quality.passed) {
const files = [
...new Set([...(build.changed_files || []), ...(build.artifacts || []), ...builderDeclaredFiles(run)]),
...new Set([...(build.changed_files || []), ...(build.artifacts || []), ...builderDeclaredFiles(run, QUICK_RESULT_FILES)]),
];
const logPath = join(process.env.FIA_AI_DOCS || 'ai-docs', 'todos', 'quick-log.md');
const logged = await run.runPhase(
Expand Down
Loading
Loading