| autoload | true |
|---|---|
| maturity | poc |
Detect and migrate stale ADD project files when plugin version > project version.
On every session start, before any other work:
- Read
.add/config.jsonversionand plugin'splugin.jsonversion - If they match → stop silently
- If project > plugin → warn and stop
- If no config → not an ADD project, stop silently
- If config has no
version→ assume0.1.0
-
Build path: Read
${CLAUDE_PLUGIN_ROOT}/templates/migrations.json. Chain hops from project version to plugin version (skip missing hops). -
Back up: Before modifying ANY file, copy to
{file}.pre-migration.bak. If backup fails, abort entirely. -
Execute steps from the manifest for each hop. Supported actions:
add_fields— add new JSON fields with defaults (skip existing)convert_md_to_json— parse markdown to structured JSON (skip if JSON exists)restructure— ensure markdown has required sectionsrename_fields— move JSON fields to new keysremove_fields— delete deprecated JSON fieldsremove_stale_rule_copies— find files in.claude/rules/whose basename matches a plugin rule in${CLAUDE_PLUGIN_ROOT}/rules/(alsoadd-prefixed variants; user-authored files never match). List the matches and ask the user ONCE for confirmation; on yes, back each up per step 2, then delete. NEVER delete without explicit confirmation.
-
Update version in config after all steps succeed. On partial failure, stay at last successful hop.
-
Print report: Show backed-up files, migrated files, skipped files, failures, new version.
- Unparseable files → log and skip, continue remaining steps
- Backup failure → abort entirely (never modify without backup)
- Partial failure → version stays at last successful hop
- Dry-run: same process, no modifications, "DRY RUN" prefix in report
- After success: append summary to
.add/migration-log.md