Skip to content

v0.13.0 — Coding rules are enforced, not suggested

Choose a tag to compare

@tranquocthong tranquocthong released this 24 Sep 07:33
· 141 commits to main since this release
a1ac56b

Added

  • Coding rules in project-author.md are now enforced, not suggested. A team's rules reached the code only as a paragraph the executor was told to "read if present". Nothing checked them, and the pre-ship reviewer was even told "House style is not a finding", so violations reached the team's own reviewers and the PR was rejected there. Four gaps, four fixes:
    • verify.rules, a diff-scoped rule gate. forbiddenPatterns scans the whole tree on every task, so adding a rule to a project whose old code already breaks it failed every task, and in practice nobody added one. verify-code now has a code-rules check that fails only on lines this branch added or changed (merge-base with branching.base, uncommitted and untracked included) and reports the old violations as a preexisting count. Rules can be scoped by glob, and besides forbid they can say "a file with A must also have B" (when + require), for rules like "@Scheduled needs @SchedulerLock". A broken rule is skipped with a warning and never fails the gate. forbiddenPatterns is unchanged.
    • The executor answers every rule. /sf:phase pastes the ## Code Rules bullets verbatim into each executor prompt, and the executor must return a pass | n/a | violated row per bullet. A missing table or an open violated row is sent back, like missing TDD evidence.
    • The reviewer checks every rule, and a violation blocks. The "house style is not a finding" instruction is gone. Each ## Code Rules bullet is a checklist item, and a violation is a project-rule finding: review-collect raises it to at least medium and treats it as blocking, with review-accept as the override. Taste outside ## Code Rules stays low.
    • /sf:doctor validates verify.rules, and new projects get an empty ## Code Rules section in project-author.md (existing files are not touched).
  • Backlog is now a record type, not a folder of free-form notes. .spec-flow/backlog/ was a convention nothing read: no order, no status, and /sf:status reported "nothing pending" while deferred work sat there. backlog-new --title --priority high|medium|low [--desc] [--feature] [--epic] writes NNN-bl-<slug>.md (id bl-NNN, numbered from the highest existing prefix, like bug-new). Priority is required and has no silent default, since a defaulted priority carries no information. backlog-list sorts high > medium > low > unset, then oldest first, and filters by --status (default open), --epic, --feature. backlog-set changes priority or status (open|done|dropped) in place, leaving the rest of the file byte-for-byte.
    • Existing hand-written backlog files keep working: without the record marker they are listed as legacy with priority unset, and a list never rewrites them. /sf:doctor warns about them (and about records with no priority) with the backlog-set command that fixes each.
    • After a ship, the "nothing pending" next step now names the top open backlog item, and /sf:status shows the open count and the top three. With no open backlog both outputs are unchanged.
  • An epic is now a directory, not a single file. An epic spans many specs and many months, and the documents that belong to it belong to no single spec: the per-phase SRS, cross-phase decisions, environment state (SIT, UAT, handoff), gotchas, e2e mocks. epic-new used to write one .spec-flow/epics/<slug>.md with a hand-written status: pending that was wrong after the first phase, and sub-features were grouped only by a name prefix. In practice teams skipped it and built their own epics/ folder outside .spec-flow/.
    • epic-new creates .spec-flow/epics/<slug>/ with EPIC.md and conventional srs/ decisions/ state/ assets/ subdirectories. The subdirectories are a convention; nothing is enforced.
    • epic-attach --epic --feature adds a feature to an epic and writes specs/<feature>/EPIC as the back link. A feature belongs to at most one epic (EPIC_CONFLICT otherwise). /sf:ingest <srs> --epic <slug> attaches as it ingests, creating the epic if needed, which fits the common case: phases ingested one at a time over months rather than split once.
    • epic-list and the new epic-show compute progress from each sub-feature's real tasks and ship record (done, total, shipped) instead of trusting a written status. /sf:status shows the epic's progress when the active feature belongs to one.
    • SD, tasks, checklist and verification stay in specs/<feature>/; the epic directory holds only cross-phase material.
    • Single-file epics still list and show (legacy: true); epic-attach refuses them with the one-line conversion command, and nothing is migrated automatically.
    • /sf:doctor warns (never fails) about single-file epics, links that disagree in either direction, and files in an epic directory whose names look like secrets (priv_key, secret, .pem, .env…) and that git does not ignore, since .spec-flow/ is usually committed.