fix: Improve migrate.md with clearer execution instructions

- 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 <noreply@anthropic.com>
This commit is contained in:
2025-12-22 17:47:52 +02:00
parent 940c6a9f58
commit d388ab4893

View File

@@ -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. 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/` Execute these bash commands:
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
```bash ```bash
# Create new structure
mkdir -p .auto-build/specs mkdir -p .auto-build/specs
mkdir -p .auto-build/memory/sessions mkdir -p .auto-build/memory/sessions
```
### 3. Move 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
```bash cp -r .auto-build-data/specs/* .auto-build/specs/
# Move all feature specs echo "✅ Copied specs to .auto-build/specs/"
if [ -d ".auto-build-data/specs" ] && [ "$(ls -A .auto-build-data/specs)" ]; then else
mv .auto-build-data/specs/* .auto-build/specs/ echo " No specs to migrate"
echo "Moved specs to .auto-build/specs/"
fi fi
```
### 4. Move Memory # Move memory files if they exist
```bash
# Move memory files
if [ -f ".auto-build-data/memory/patterns.json" ]; then 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 fi
if [ -f ".auto-build-data/memory/gotchas.json" ]; then 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 fi
if [ -d ".auto-build-data/memory/sessions" ] && [ "$(ls -A .auto-build-data/memory/sessions)" ]; then if [ -d ".auto-build-data/memory/sessions" ] && [ "$(ls -A .auto-build-data/memory/sessions 2>/dev/null)" ]; then
mv .auto-build-data/memory/sessions/* .auto-build/memory/sessions/ cp -r .auto-build-data/memory/sessions/* .auto-build/memory/sessions/
echo "✅ Copied sessions"
fi fi
echo "Moved memory to .auto-build/memory/" # Initialize missing files
```
### 5. Initialize Missing Files
If memory files don't exist, create them:
```bash
if [ ! -f ".auto-build/memory/patterns.json" ]; then if [ ! -f ".auto-build/memory/patterns.json" ]; then
echo '{"patterns": [], "updated": null}' > .auto-build/memory/patterns.json echo '{"patterns": [], "updated": null}' > .auto-build/memory/patterns.json
echo "✅ Created patterns.json"
fi fi
if [ ! -f ".auto-build/memory/gotchas.json" ]; then if [ ! -f ".auto-build/memory/gotchas.json" ]; then
echo '{"gotchas": [], "updated": null}' > .auto-build/memory/gotchas.json echo '{"gotchas": [], "updated": null}' > .auto-build/memory/gotchas.json
echo "✅ Created gotchas.json"
fi 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 ```bash
# Remove old entries if present # Add .auto-build-data/ to gitignore if not present
grep -v "^\.auto-build-data/" .gitignore > .gitignore.tmp && mv .gitignore.tmp .gitignore if ! grep -q "^\.auto-build-data/" .gitignore 2>/dev/null; then
# Add correct entry
if ! grep -q "^\.auto-build-data/" .gitignore; then
echo "" >> .gitignore echo "" >> .gitignore
echo "# Auto-Build local data (worktrees, cache)" >> .gitignore echo "# Auto-Build local data (worktrees, cache)" >> .gitignore
echo ".auto-build-data/" >> .gitignore echo ".auto-build-data/" >> .gitignore
echo "✅ Updated .gitignore"
fi fi
``` ```
### 7. Display Summary ## Step 3: Show Results
After running the commands, display this summary:
``` ```
════════════════════════════════════════════════════════════════ ════════════════════════════════════════════════════════════════
@@ -136,6 +110,7 @@ NEXT STEPS:
## Notes ## 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 - After migration, specs and memory are **version controlled** and shared with your team
- Worktrees remain local as they are machine-specific - Worktrees remain local as they are machine-specific
- You can delete `.auto-build-data/specs/` and `.auto-build-data/memory/` after verifying migration