Skip to content

Migrate ck-era .claude drift in /sd:setup - #14

Merged
developzoneio merged 2 commits into
mainfrom
fix/setup-drift-migration
Jun 23, 2026
Merged

Migrate ck-era .claude drift in /sd:setup#14
developzoneio merged 2 commits into
mainfrom
fix/setup-drift-migration

Conversation

@developzoneio

Copy link
Copy Markdown
Owner

Closes #13

Problem

/sd:setup classified a project as complete on file presence alone and exited, so projects scaffolded under the old ck (ck-spec-system) engine name kept stale .claude/* references that were never migrated. Most critically, all three Claude Code hooks pointed at the non-existent ~/.claude/hooks/ck/ directory and were silently not firing.

Change

Adds Phase 1.5 - Drift check & migrate to commands/setup.md:

  • Rule-based detection (never a raw line-diff, so <<placeholder>> and project-specific values are preserved) against the templates loaded in Phase 0, seeded by the ck -> sd rename but generic in shape so future renames / new fields are caught too:
    • settings.json: hook namespace dirs (hooks/ck -> hooks/sd), missing _bash_adaptation / _schema_notes blocks, stale _comment_top.
    • project-config.json: $schema URL, /ck:* // ck:* names in _use docs, missing ticket.snapshot / paths.layers, pinned model IDs -> aliases.
    • settings.local.json: stale ...\templates\ck\ permission paths.
  • Runs in complete and partial states (whenever .claude/project-config.json or .claude/settings.json exists) - the complete early exit now happens only after a clean drift check.
  • Hook-resolution check: verifies every hook command path resolves on disk and warns loudly otherwise (the symptom that made the bug invisible). Also added to Phase 7.
  • Gated and reversible: previews every change in one batch-confirmation gate (silence != approval), backs up each file .bak.<timestamp>, then applies targeted, value-preserving patches.

No flag (decided against - automatic-but-gated is what actually fixes the silent gap). Stays zero-argument.

Verification

scripts\validate.ps1 - all 6 checks pass, including the real install-to-temp count (commands/sd = 10 files, so the edited command installs cleanly) and the CHANGELOG [Unreleased] gate. Manual /sd:setup walkthrough against a stale ck-era fixture is documented in the plan (requires interactive slash-command execution; not CI-runnable).

🤖 Generated with Claude Code

developzoneio and others added 2 commits June 23, 2026 14:07
/sd:setup classified a project as `complete` on file presence alone and
exited, so projects scaffolded under the old `ck` engine name kept stale
`.claude/*` references - most critically three hooks pointing at the
non-existent ~/.claude/hooks/ck/ dir, silently not firing.

Add Phase 1.5 (drift check & migrate): rule-based detection against the
loaded templates (seeded by the ck->sd rename) covering hook paths,
$schema, /ck:* names in _use docs, missing fields (ticket.snapshot,
paths.layers), pinned model IDs, and stale settings.local.json perms.
Runs in `complete` and `partial`, previews every change in one batch
gate, backs up each file, and verifies hook paths resolve on disk (also
added to Phase 7).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@developzoneio
developzoneio merged commit 4d4d290 into main Jun 23, 2026
4 checks passed
@developzoneio
developzoneio deleted the fix/setup-drift-migration branch June 23, 2026 15:50
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.

/sd:setup exits blind on complete projects and never migrates ck-era drift

1 participant