singularity-forge/BACKLOG.md
Mikael Hugo 2bb9cdbeef feat(scaffold): ADR-022 scaffold profiles (all phases)
Add profile-aware scaffold system so SF does not lay down irrelevant
templates in infra/ops/docs repos.

## What ships

Phase 1 — data model
- scaffold-versioning.js: add 'disabled' to VALID_STATES; readScaffoldManifest
  returns profile field; recordScaffoldApply preserves manifest.profile (fixes
  roundtrip bug where profile was stripped on every write).
- scaffold-constants.js: PROFILES (app/library/infra/docs/minimal as Set<string>)
  and PROFILE_NAMES exports.

Phase 2 — profile-aware drift detection
- scaffold-drift.js: disabled bucket in emptyCounts, resolveActiveProfileSet
  integration, profile param on detectScaffoldDrift/migrateLegacyScaffold.
- doc-checker.js: filter to active profile, skip disabled-state files.

Phase 3 — auto-detection on first run
- scaffold-profiles.js: detectRepoProfile() heuristics (nix→infra,
  terraform→infra, react→app, node-no-ui→library, docs-only→docs, else→app).
- agentic-docs-scaffold.js: reads profile from manifest, auto-detects on first
  run, persists to manifest, filters SCAFFOLD_FILES to active profile.

Phase 4 — migrate command
- commands-scaffold-migrate.js: sf scaffold migrate --profile <name>
  Re-enables pending files entering the new profile; stamps state=disabled
  (or prunes with --prune) files leaving it; warns on editing/completed files.
- commands/handlers/ops.js, commands/catalog.js: registered and tab-completed.

Phase 5 — custom profiles + PREFERENCES.md frontmatter
- scaffold-profiles.js: readPreferencesProfile(), loadCustomProfileSet()
  (~/.sf/profiles/<name>.yaml with extends/add/remove), resolveActiveProfileSet()
  implementing full ADR-022 §6 precedence.
- All callers updated to use resolveActiveProfileSet as the single source of truth.

Tests: 28 new tests in adr-022-scaffold-profiles.test.mjs — all passing.
Pre-existing node:test stubs (3 files) unaffected.

ADR: docs/dev/ADR-022-scaffold-profiles.md

Misc: triage TODO.md dump into BACKLOG.md (phases-helpers export error T1,
/todo triage typed-handler gap T1, structured triage tiers T2, sha-track
markdown files T2, cross-repo triage T3). Reset TODO.md to empty template.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-12 15:28:03 +02:00

3.8 KiB

Backlog

Items gated on future milestones or external dependencies.


Phases-helpers extension-load error (pre-triage, T1)

  • Source: TODO.md triage 2025-06
  • Symptom: Every sf … invocation prints Extension load error: './phases-helpers.js' does not provide an export named 'closeoutAndStop'
  • Root cause: Recent rename in phases-helpers.js not propagated to its importer(s); or npm run copy-resources shipped a partial state.
  • Fix: Locate callers of closeoutAndStop in the extension source, update the import to the new symbol name. Add a test that imports every symbol from the extension entry point and asserts they all resolve.
  • Priority: T1 — noisy on every run, degrades operator confidence.

Slash command /todo triage must route through typed backend (pre-triage, T1)

  • Source: TODO.md triage 2025-06
  • Symptom: sf --print "/todo triage" triggers the agent, which reads TODO.md and emits triage-shaped markdown, but never calls handleTodo → triageTodoDump. DB records never written; patched backend bypassed.
  • Fix:
    1. In the slash-command dispatch prompt, enumerate handlers and forbid the LLM from doing the work itself when a typed handler exists.
    2. Add integration test: run sf --print "/todo triage" against a fixture TODO.md, assert triage_runs rows appear in sf.db.
  • Priority: T1 — core correctness issue, not a UX polish.

Triage result needs structured tier/priority per item (pre-triage, T2)

  • Source: TODO.md triage 2025-06
  • Problem: Tiers (T1/T2/T3) appear only in LLM prose appended to BUILD_PLAN.md, not as structured fields per item. Blocks downstream automation that needs to escalate Tier-1 items to milestones.
  • Fix: Extend triage JSON schema:
    { title: string, tier: "T1" | "T2" | "T3", rationale: string }
    
    Update appendBacklogItems + future milestone-escalator to consume the structured tier.
  • Priority: T2 — enables milestone automation; blocks sf plan promote from triage.

Sha-track source-of-truth markdown files, diff on change (pre-triage, T2)

  • Source: TODO.md triage 2025-06
  • Want: On session start + autonomous-cycle entry, hash AGENTS.md, README.md, .sf/wiki/**/*.md, .sf/milestones/**/*.md, docs/adr/**/*.md, docs/plans/**/*.md. Diff against last-seen hash in sf.db. Surface changed files for review/accept.
  • Schema:
    CREATE TABLE tracked_md_files (
      relpath TEXT PRIMARY KEY, sha256 TEXT NOT NULL, size_bytes INTEGER NOT NULL,
      last_seen_at TEXT NOT NULL, last_seen_commit TEXT, category TEXT
    );
    
  • Out of scope: TODO.md, CHANGELOG.md, BUILD_PLAN.md, node_modules, dist.
  • Priority: T2 — high value for cross-agent coordination; deferred behind T1 fixes.

Cross-repo triage / unified backlog view (pre-triage, T3)

  • Source: TODO.md triage 2025-06
  • Want: sf headless triage-all-repos --config ~/.sf/repos.yaml — walk N repo paths, run triageTodoDump per repo in its own SF db, emit a unified read-only aggregated report sorted by priority/tier.
  • Constraints: Per-repo SF dbs stay separate; cross-repo view is read-only aggregation into ~/.sf/cross-repo-view.md.
  • Priority: T3 — useful for multi-repo operators; deferred until T1/T2 items land.

M009 Promote-Only Adoption Review

  • Gate: M010 (schedule system) must ship first
  • Date: 2026-05-04
  • Action: sf schedule add --in 2w --kind review "Review promote-only adoption: count promotions, scan git log for .sf/ touches, assess sf plan promote ergonomics"
  • Intent: Two weeks after M009 closes, review whether agents and humans are following the promote-only rule. Count promotions via sf plan list. Scan git log for .sf/ commits. Assess sf plan promote ergonomics and whether the workflow needs adjustment.