From d388ab489386664f0f1745cf69b6bb88a9c2dceb Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Mon, 22 Dec 2025 17:47:52 +0200 Subject: [PATCH] fix: Improve migrate.md with clearer execution instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added explicit "Execute These Steps Immediately" section - Changed from mv to cp for safer migration (preserves original) - Made bash commands directly executable - Added error handling with 2>/dev/null 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- plugin/commands/migrate.md | 89 ++++++++++++++------------------------ 1 file changed, 32 insertions(+), 57 deletions(-) diff --git a/plugin/commands/migrate.md b/plugin/commands/migrate.md index d095386..8ad3d8e 100644 --- a/plugin/commands/migrate.md +++ b/plugin/commands/migrate.md @@ -6,98 +6,72 @@ description: Migrate from old .auto-build-data/ structure to new .auto-build/ st Migrate specs and memory from the old `.auto-build-data/` location to the new `.auto-build/` location for team collaboration. -## When to Use +## IMPORTANT: Execute These Steps Immediately -Run this command if you have an existing project that was using Auto-Build v1.0.5 or earlier, where specs and memory were stored in `.auto-build-data/` (gitignored). +When this command is invoked, you MUST execute the following steps in order. Do not ask questions - just do it. -## What It Does +## Step 1: Run Migration Commands -1. **Moves specs**: `.auto-build-data/specs/` → `.auto-build/specs/` -2. **Moves memory**: `.auto-build-data/memory/` → `.auto-build/memory/` -3. **Keeps local data**: `.auto-build-data/worktrees/` and `.auto-build-data/cache/` stay local -4. **Updates .gitignore**: Ensures only `.auto-build-data/` is ignored - -## Workflow - -### 1. Check for Existing Data - -First, check if migration is needed: - -```bash -# Check if old structure exists -ls -la .auto-build-data/specs/ -ls -la .auto-build-data/memory/ -``` - -If `.auto-build-data/specs/` or `.auto-build-data/memory/` exist with data, proceed with migration. - -### 2. Create New Structure +Execute these bash commands: ```bash +# Create new structure mkdir -p .auto-build/specs mkdir -p .auto-build/memory/sessions -``` -### 3. Move Specs - -```bash -# Move all feature specs -if [ -d ".auto-build-data/specs" ] && [ "$(ls -A .auto-build-data/specs)" ]; then - mv .auto-build-data/specs/* .auto-build/specs/ - echo "Moved specs to .auto-build/specs/" +# Move specs if they exist in old location +if [ -d ".auto-build-data/specs" ] && [ "$(ls -A .auto-build-data/specs 2>/dev/null)" ]; then + cp -r .auto-build-data/specs/* .auto-build/specs/ + echo "✅ Copied specs to .auto-build/specs/" +else + echo "â„šī¸ No specs to migrate" fi -``` -### 4. Move Memory - -```bash -# Move memory files +# Move memory files if they exist if [ -f ".auto-build-data/memory/patterns.json" ]; then - mv .auto-build-data/memory/patterns.json .auto-build/memory/ + cp .auto-build-data/memory/patterns.json .auto-build/memory/ + echo "✅ Copied patterns.json" fi if [ -f ".auto-build-data/memory/gotchas.json" ]; then - mv .auto-build-data/memory/gotchas.json .auto-build/memory/ + cp .auto-build-data/memory/gotchas.json .auto-build/memory/ + echo "✅ Copied gotchas.json" fi -if [ -d ".auto-build-data/memory/sessions" ] && [ "$(ls -A .auto-build-data/memory/sessions)" ]; then - mv .auto-build-data/memory/sessions/* .auto-build/memory/sessions/ +if [ -d ".auto-build-data/memory/sessions" ] && [ "$(ls -A .auto-build-data/memory/sessions 2>/dev/null)" ]; then + cp -r .auto-build-data/memory/sessions/* .auto-build/memory/sessions/ + echo "✅ Copied sessions" fi -echo "Moved memory to .auto-build/memory/" -``` - -### 5. Initialize Missing Files - -If memory files don't exist, create them: - -```bash +# Initialize missing files if [ ! -f ".auto-build/memory/patterns.json" ]; then echo '{"patterns": [], "updated": null}' > .auto-build/memory/patterns.json + echo "✅ Created patterns.json" fi if [ ! -f ".auto-build/memory/gotchas.json" ]; then echo '{"gotchas": [], "updated": null}' > .auto-build/memory/gotchas.json + echo "✅ Created gotchas.json" fi ``` -### 6. Update .gitignore +## Step 2: Update .gitignore -Ensure `.gitignore` only ignores `.auto-build-data/`: +Check and update `.gitignore` to ensure `.auto-build-data/` is ignored but `.auto-build/` is NOT: ```bash -# Remove old entries if present -grep -v "^\.auto-build-data/" .gitignore > .gitignore.tmp && mv .gitignore.tmp .gitignore - -# Add correct entry -if ! grep -q "^\.auto-build-data/" .gitignore; then +# Add .auto-build-data/ to gitignore if not present +if ! grep -q "^\.auto-build-data/" .gitignore 2>/dev/null; then echo "" >> .gitignore echo "# Auto-Build local data (worktrees, cache)" >> .gitignore echo ".auto-build-data/" >> .gitignore + echo "✅ Updated .gitignore" fi ``` -### 7. Display Summary +## Step 3: Show Results + +After running the commands, display this summary: ``` ════════════════════════════════════════════════════════════════ @@ -136,6 +110,7 @@ NEXT STEPS: ## Notes -- This migration is **one-way** - the old structure is not preserved +- This migration **copies** files (original structure preserved in case of issues) - After migration, specs and memory are **version controlled** and shared with your team - Worktrees remain local as they are machine-specific +- You can delete `.auto-build-data/specs/` and `.auto-build-data/memory/` after verifying migration