Skip to content

feat: fix init clobber + add prospec upgrade path (BL-044)#42

Merged
benwu95 merged 3 commits into
mainfrom
bl-044-fix-init-clobber-add-upgrade
Jun 21, 2026
Merged

feat: fix init clobber + add prospec upgrade path (BL-044)#42
benwu95 merged 3 commits into
mainfrom
bl-044-fix-init-clobber-add-upgrade

Conversation

@benwu95

@benwu95 benwu95 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the prospec init data-loss hole and adds the missing version-upgrade path (BL-044).

P0 — init clobber fix. prospec init's idempotency gate only checked .prospec.yaml, but then unconditionally overwrote 7+ files including the curated trust zone (CONSTITUTION.md / _conventions.md / _index.md). Deleting .prospec.yaml to re-localize triggers wiped curated content. Init now uses a per-file skip-if-exists guard (matching knowledge-init.service) — it rebuilds only missing files; the .prospec.yaml-last completion marker is preserved.

P1 — upgrade path.

  • prospec upgrade (CLI, zero-LLM): records the prospec version in .prospec.yaml version (canonical re-serialize) + re-runs agent sync + prints a migration report. Writes no docs; not in INIT_COMMANDS, so an uninitialized project gets ConfigNotFound.
  • /prospec-upgrade (Skill): scans the files prospec init created, refreshes their format to the latest templates with per-file consent, localizes triggers for newly-added skills (fill-missing), and re-syncs.
  • .prospec.yaml version now means the prospec version the project uses (a legacy "1.0" is treated as stale and bumped on first upgrade). No separate prospec_version field.

P2 — close the trigger re-localization gap. agent sync now names the skills missing a skill_triggers entry (partial localization), and /prospec-quickstart fills only the missing triggers — so you never need to delete .prospec.yaml to re-localize. Also: /prospec-knowledge-update now asks for consent before migrating drifted AI-knowledge format.

How it was verified

  • Full SDD lifecycle: story → plan → tasks → implement → review (adversarial, 0 criticals) → verify (Grade A) → archive.
  • 1760 tests pass; typecheck, lint, verify:skills (28/28), and the drift engine (8/8, 0 warn) all green; coverage 96%.
  • Dogfooded on this repo: ran prospec upgrade + /prospec-upgradeversion 1.0→0.3.2, the new skill's triggers localized, init-created docs untouched.

Notes

  • Requirements graduated into the Feature Specs (project-setup, agent-integration, ai-knowledge); README.md + README.zh-TW.md gained an "Upgrading Prospec" guide.
  • During archive, 4 delta-spec REQ IDs were found to collide with pre-existing REQs in other features (drift-detection / sdd-workflow) and were renumbered (TYPES-037, SERVICES-035, TEMPLATES-121/122). The drift engine validates REQ-reference resolution but not ID uniqueness — a candidate backlog item, alongside the readme-counts check not covering _index file counts.

🤖 Generated with Claude Code

benwu95 added 3 commits June 22, 2026 01:56
- fix(init): per-file skip-if-exists guard so re-running init never clobbers curated trust-zone files (CONSTITUTION/_conventions/_index); rebuilds only missing files, .prospec.yaml-last marker preserved
- feat(cli): add `prospec upgrade` — record the prospec version in .prospec.yaml (canonical format) + run agent sync + print a migration report; not in INIT_COMMANDS so the config-existence gate blocks uninitialized projects
- feat(types): redefine .prospec.yaml `version` as the prospec version the project uses; add types/version.ts (PROSPEC_VERSION single source) and types/canonical-docs.ts; register prospec-upgrade skill (excludeFromEntryConfig)
- feat(skill): add /prospec-upgrade — scan init-created files, refresh their format to the latest templates with per-file consent, localize new-skill triggers, re-sync
- feat(skill): /prospec-knowledge-update asks consent before migrating drifted AI-knowledge format (Phase 2.5)
- feat(agent-sync): name the skills missing skill_triggers in the hint; quickstart localizes fill-missing instead of all-or-nothing
- docs: document `prospec upgrade` + /prospec-upgrade in README (x2), bump skill count 16->17, sync _index and types module README
- test: cover init recovery, upgrade orchestrator, missing-trigger detection, version semantics, entry-exclusion contract; adds e2e + integration
- mark BL-044 complete in planning/backlog.md (catalog ✅ + completion note, Grade A)
- upgrade this repo via `prospec upgrade`: .prospec.yaml `version` 1.0 -> 0.3.2 (now the prospec version) + canonical re-serialization
- localize the new prospec-upgrade skill triggers to Traditional Chinese via /prospec-upgrade (16 existing entries untouched)
- archive fix-init-clobber-add-upgrade: summary.md → prospec/specs/_archived-history/ (committed audit trail); artifacts moved to .prospec/archive (gitignored)
- graduate REQs into Feature Specs: project-setup (US-011/012), agent-integration (US-433/434), ai-knowledge (US-353)
- renumber 4 REQ ids that collided with drift-detection/sdd-workflow: TYPES-034→037, SERVICES-031→035, TEMPLATES-109→121, TEMPLATES-110→122
- sync module READMEs (types/services/cli/templates/tests) + module-map keywords for the upgrade path; refresh raw-scan.md
- add "Upgrading Prospec" guide to README + README.zh-TW (prospec upgrade -> /prospec-upgrade) with the correct github:benwu95/prospec install
- product.md last_updated; harvest PB-003/004/005 recurrences into _lessons-ledger
@github-actions

Copy link
Copy Markdown

Prospec Check

Prospec drift check (structural — deterministic, zero LLM)

  PASS  req-references
  PASS  file-paths
  PASS  import-direction
  PASS  knowledge-health
  SKIP  task-completion — source unavailable: .prospec/changes/ not found (not version-controlled)
  PASS  dangling-prefix
  PASS  feature-modules
  PASS  readme-counts

Knowledge coverage: 6/6 modules documented

Checked 7/8 checks: 0 fail, 0 warn, 1 skipped (not counted as pass)
Semantic consistency: not-checked (run /prospec-review)
Report written: prospec-report.json

@github-actions

Copy link
Copy Markdown

Test Coverage

Metric Coverage Covered / Total
lines 96.43% 2891 / 2998
statements 96% 3175 / 3307
functions 95.83% 529 / 552
branches 94.23% 1734 / 1840

@benwu95 benwu95 merged commit 6454d79 into main Jun 21, 2026
4 checks passed
@benwu95 benwu95 deleted the bl-044-fix-init-clobber-add-upgrade branch June 21, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant