Appearance
Phase 2 Implementation Complete ✅
Summary
The merge-files tool has been implemented and is ready for testing.
What It Does
Merges unique content from one markdown file into another:
- Creates backups (A.original, B.original)
- Parses both files into sections by heading
- Identifies unique sections in A (not in B)
- Merges unique sections into B under appropriate headings
- Updates TOC in B
- Updates all links pointing to A to redirect to B
- Removes A from VitePress config
- Preserves A, A.original, B.original for manual review
Features Implemented
✅ Section parsing - Breaks files into sections by markdown headings
✅ Duplicate detection - Identifies similar/duplicate content
✅ Smart merging - Finds best-fit headings or creates new ones
✅ TOC updates - Automatically updates Table of Contents
✅ Link redirects - Updates all references from A → B
✅ Config updates - Removes merged file from VitePress
✅ Backup preservation - Keeps originals for review/undo
✅ Edge cases - Handles empty files, identical files, etc.
✅ Verbose mode - Shows detailed progress with -v flag
Files Created
notes/tools/
├── merge-files.ts # Main tool
└── docs/
├── test-merge.sh # Test runner
└── test/
└── merge-fixtures/ # Test files
├── file-a.md # Source file
├── file-b.md # Target file
└── test-links.md # File with links to AUsage
Compile:
bash
cd /Users/sand/GitHub/webseriously/notes/tools
npx tscRun:
bash
node notes/tools/dist/merge-files.js A.md B.md # Merge A into B
node notes/tools/dist/merge-files.js -v A.md B.md # Verbose mode
node notes/tools/dist/merge-files.js --help # Show helpTest
Run the test script:
bash
bash notes/tools/docs/test-merge.shThis will:
- Reset test fixtures to original state
- Compile TypeScript
- Run merge tool on test files
- Show merged content and updated links
- List backup files created
Next Steps
- Test the tool - Run test-merge.sh
- Verify results - Check merged content, links, backups
- Mark Phase 2 complete - If tests pass
- Move to Phase 3 - Integration & documentation
Status: READY FOR TESTING 🚀