singularity-forge/docs/dev
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
..
building-coding-agents chore: CI workflows, package.json updates, test fixes, docs cleanup 2026-05-02 06:30:45 +02:00
context-and-hooks sf snapshot: pre-dispatch, uncommitted changes after 31m inactivity 2026-05-10 06:26:32 +02:00
extending-pi sf snapshot: uncommitted changes after 93m inactivity 2026-05-06 11:37:27 +02:00
pi-ui-tui docs: reorganize into user-docs/ and dev/ subdirectories 2026-04-10 09:25:31 -05:00
proposals refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
what-is-pi refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
ADR-001-branchless-worktree-architecture.md docs: align sf purpose doctrine and docs 2026-05-06 00:38:36 +02:00
ADR-003-pipeline-simplification.md sf snapshot: uncommitted changes after 49m inactivity 2026-05-08 01:07:24 +02:00
ADR-004-capability-aware-model-routing.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
ADR-005-multi-model-provider-tool-strategy.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
ADR-007-model-catalog-split.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
ADR-008-IMPLEMENTATION-PLAN.md integrate: hook quick wins into UOK dispatch loop 2026-05-06 22:34:41 +02:00
ADR-008-sf-tools-over-mcp-for-provider-parity.md integrate: hook quick wins into UOK dispatch loop 2026-05-06 22:34:41 +02:00
ADR-009-IMPLEMENTATION-PLAN.md fix(sf): correct stale .sf milestone paths in prompts + ADR-impl absolute links 2026-05-02 18:06:16 +02:00
ADR-009-orchestration-kernel-refactor.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
ADR-010-pi-clean-seam-architecture.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-011-swarm-chat-and-debate-mode.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-012-multi-instance-federation.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-013-network-and-remote-execution.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-014-singularity-knowledge-and-agent-platform.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-015-flight-recorder.md feat: add SF skills and subagent debate mode 2026-04-29 17:44:30 +02:00
ADR-016-charm-ai-stack-adoption.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ADR-017-charm-tui-client.md docs: remove stale direct db and mcp guidance 2026-05-07 03:33:14 +02:00
ADR-018-repo-native-harness-evolution.md docs: plan judge calibration service 2026-04-29 18:28:45 +02:00
ADR-019-workspace-vm-convergence.md fix(sf): harden exit and worktree cleanup 2026-05-02 09:30:14 +02:00
ADR-020-internal-wire-architecture.md feat: SF strengthening + ADR-020 wire architecture (Phases 1-2) 2026-05-02 00:03:34 +02:00
ADR-021-versioned-documents-and-upgrade-path.md chore: commit current workspace state 2026-05-05 14:46:18 +02:00
ADR-022-scaffold-profiles.md feat(scaffold): ADR-022 scaffold profiles (all phases) 2026-05-12 15:28:03 +02:00
architecture.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
ci-cd-pipeline.md feat(sf): align node sqlite uok runtime 2026-05-08 03:01:20 +02:00
FILE-SYSTEM-MAP.md sf snapshot: uncommitted changes after 49m inactivity 2026-05-08 01:07:24 +02:00
FRONTIER-TECHNIQUES.md chore: sync workspace state after rebrand 2026-04-15 14:54:20 +02:00
generated-artifact-policy.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
json-contracts.md feat: stabilize autonomous workflow system 2026-05-01 20:18:50 +02:00
MEMORY-SYSTEM-ARCHITECTURE.md feat(sf): align node sqlite uok runtime 2026-05-08 03:01:20 +02:00
MEMORY-SYSTEM-INTEGRATION-GUIDE.md feat(sf): align node sqlite uok runtime 2026-05-08 03:01:20 +02:00
pi-context-optimization-opportunities.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
PRD-branchless-worktree-architecture.md refactor(native): rename gsd_parser.rs to forge_parser.rs 2026-04-15 14:58:21 +02:00
PRD-pi-clean-seam-refactor.md sf snapshot: uncommitted changes after 110m inactivity 2026-05-08 00:17:47 +02:00
repo-native-harness-architecture.md docs: plan judge calibration service 2026-04-29 18:28:45 +02:00
repo-native-harness-template-kits.md docs: plan judge calibration service 2026-04-29 18:28:45 +02:00
SETUP.md docs(runtime): align source docs with node 26 2026-05-08 07:17:33 +02:00
SQLITE-MIGRATION.md feat(sf): align node sqlite uok runtime 2026-05-08 03:01:20 +02:00
UOK-SELF-EVOLUTION.md sf snapshot: uncommitted changes after 64m inactivity 2026-05-06 16:28:31 +02:00