Date: 2025-12-07 Version: 1.0.0 Status: Active - Please follow this guide to update your code!
We've completed a comprehensive repository reorganization to achieve professional structure:
- β 100% root-path cleanup (38 β 0 scripts at root)
- β 9 AI systems organized with consistent structure
- β 54 files moved to new professional locations
- β 6 comprehensive READMEs created (9,350+ lines)
Impact: Your imports and script paths need updating!
If you have:
- Local branches with code changes
- Scripts that import from old paths
- Documentation referencing old paths
- CI/CD pipelines using old paths
You MUST update them using this guide!
project-12-plugin-ai-agent-rabbitmq/
βββ scripts/
β βββ orchestrator.js β At root!
β βββ mcp-server.js β At root!
β βββ brainstorm-system.js β At root!
β βββ voting-system.js β At root!
β βββ deploy.sh β At root!
β βββ health-check.sh β At root!
β βββ ... (38 files at root!) β Chaos!
β βββ database/
β βββ db-client.js β Wrong location!
project-12-plugin-ai-agent-rabbitmq/
βββ src/
β βββ core/ β
Core orchestration
β β βββ orchestrator.js
β β βββ mcp-server.js
β β βββ rabbitmq-client.js
β β βββ monitor.js
β β βββ cli-menu.js
β β
β βββ database/ β
Database layer
β β βββ client.js
β β βββ migrations-runner.js
β β βββ repositories/
β β
β βββ systems/ β
AI systems
β βββ brainstorm/
β βββ voting/
β βββ mentorship/
β βββ rewards/
β βββ penalties/
β βββ gamification/
β βββ reputation/
β βββ battle/
β βββ leaderboard/
β
βββ scripts/
βββ deployment/ β
Production deployment
βββ infrastructure/ β
Operations
βββ backup/ β
Backup & restore
βββ demo/ β
Demos
βββ setup/ β
Development setup
βββ utils/ β
Utilities
| Old Path | New Path | Type |
|---|---|---|
scripts/orchestrator.js |
src/core/orchestrator.js |
Core |
scripts/mcp-server.js |
src/core/mcp-server.js |
Core |
scripts/rabbitmq-client.js |
src/core/rabbitmq-client.js |
Core |
scripts/monitor.js |
src/core/monitor.js |
Core |
scripts/cli-menu.js |
src/core/cli-menu.js |
Core |
| Old Path | New Path | Type |
|---|---|---|
scripts/database/db-client.js |
src/database/client.js |
Database |
scripts/database/migrations-runner.js |
src/database/migrations-runner.js |
Database |
scripts/database/repositories/* |
src/database/repositories/* |
Database |
| Old Path | New Path | Type |
|---|---|---|
scripts/brainstorm-system.js |
src/systems/brainstorm/system.js |
System |
scripts/voting-system.js |
src/systems/voting/system.js |
System |
scripts/mentorship-system.js |
src/systems/mentorship/system.js |
System |
scripts/rewards-system.js |
src/systems/rewards/system.js |
System |
scripts/penalties-system.js |
src/systems/penalties/system.js |
System |
scripts/gamification/* |
src/systems/gamification/* |
System |
| Old Path | New Path | Category |
|---|---|---|
scripts/deploy.sh |
scripts/deployment/02-deploy.sh |
Deployment |
scripts/rollback.sh |
scripts/deployment/04-rollback.sh |
Deployment |
scripts/health-check.sh |
scripts/infrastructure/health-check.sh |
Infrastructure |
scripts/backup-all.sh |
scripts/backup/backup.sh |
Backup |
scripts/setup-database.sh |
scripts/setup/setup-database.sh |
Setup |
scripts/launch-claude-demo.sh |
scripts/demo/launch-claude-demo.sh |
Demo |
Before:
// β OLD - Won't work anymore!
import { AgentOrchestrator } from './scripts/orchestrator.js';
import { RabbitMQClient } from './scripts/rabbitmq-client.js';
import { BrainstormSystem } from './scripts/brainstorm-system.js';
import { VotingSystem } from './scripts/voting-system.js';
import { dbClient } from './scripts/database/db-client.js';After:
// β
NEW - Use these paths!
import { AgentOrchestrator } from './src/core/orchestrator.js';
import { RabbitMQClient } from './src/core/rabbitmq-client.js';
import { BrainstormSystem } from './src/systems/brainstorm/system.js';
import { VotingSystem } from './src/systems/voting/system.js';
import { dbClient } from './src/database/client.js';Before:
// β OLD
const { AgentOrchestrator } = require('./scripts/orchestrator.js');
const { RabbitMQClient } = require('./scripts/rabbitmq-client.js');After:
// β
NEW
const { AgentOrchestrator } = require('./src/core/orchestrator.js');
const { RabbitMQClient } = require('./src/core/rabbitmq-client.js');Before:
# β OLD
./scripts/health-check.sh
./scripts/deploy.sh
./scripts/backup-all.sh
node scripts/orchestrator.js team-leaderAfter:
# β
NEW
./scripts/infrastructure/health-check.sh
./scripts/deployment/02-deploy.sh
./scripts/backup/backup.sh
node src/core/orchestrator.js team-leaderBefore:
{
"scripts": {
"start": "node scripts/orchestrator.js",
"monitor": "node scripts/monitor.js"
}
}After:
{
"scripts": {
"start": "node src/core/orchestrator.js",
"monitor": "node src/core/monitor.js"
}
}Note: Main package.json is already updated! This is for your custom scripts.
Before:
{
"mcpServers": {
"my-server": {
"args": ["scripts/mcp-server.js"]
}
}
}After:
{
"mcpServers": {
"my-server": {
"args": ["src/core/mcp-server.js"]
}
}
}Note: Main .mcp.json is already updated! This is for custom MCP configs.
# Find all files with old import paths
grep -r "from './scripts/" --include="*.js" . | grep -v node_modules
# Find all require statements with old paths
grep -r "require.*scripts/" --include="*.js" . | grep -v node_modules
# Find shell scripts referencing old paths
grep -r "scripts/orchestrator.js" --include="*.sh" .
grep -r "scripts/health-check.sh" --include="*.sh" .
# Find documentation with old paths
grep -r "scripts/" --include="*.md" . | grep -E "(orchestrator|mcp-server|deploy)"git checkout main
git pull origin mainVerify: You should see the new structure:
ls -la src/core/
ls -la src/systems/
ls -la scripts/deployment/# Checkout your feature branch
git checkout feature/your-feature
# Merge or rebase from main
git merge main
# OR
git rebase main
# Resolve any conflicts (see "Conflict Resolution" section below)Option A: Manual Update (Recommended for small changes)
Open each file and update imports following the examples above.
Option B: Automated Find & Replace (Use with caution!)
# Create backup first!
git checkout -b backup/before-migration
# Then run find & replace
find . -name "*.js" -type f -exec sed -i \
's|from '\''./scripts/orchestrator.js'\''|from '\''./src/core/orchestrator.js'\''|g' {} \;
find . -name "*.js" -type f -exec sed -i \
's|from '\''./scripts/rabbitmq-client.js'\''|from '\''./src/core/rabbitmq-client.js'\''|g' {} \;
# Verify changes
git diff# Update your custom scripts
sed -i 's|scripts/orchestrator.js|src/core/orchestrator.js|g' your-script.sh
sed -i 's|scripts/health-check.sh|scripts/infrastructure/health-check.sh|g' your-script.sh# Run linter (if you have one)
npm run lint
# Run tests
npm test
# Verify imports work
node --check src/core/orchestrator.js
node --check your-updated-file.jsgit add .
git commit -m "chore: Update import paths after repository reorganization
- Updated core imports to src/core/*
- Updated system imports to src/systems/*
- Updated script execution paths
- See MIGRATION.md for details"<<<<<<< HEAD (your branch)
import { AgentOrchestrator } from './scripts/orchestrator.js';
=======
import { AgentOrchestrator } from './src/core/orchestrator.js';
>>>>>>> mainResolution: Keep the main branch version (new path):
import { AgentOrchestrator } from './src/core/orchestrator.js';<<<<<<< HEAD
node scripts/orchestrator.js team-leader
=======
node src/core/orchestrator.js team-leader
>>>>>>> mainResolution: Keep the main branch version (new path):
node src/core/orchestrator.js team-leaderAll scripts now have comprehensive READMEs:
- scripts/README.md - Main index, start here!
- scripts/deployment/README.md - Deployment procedures
- scripts/infrastructure/README.md - Operations & monitoring
- scripts/backup/README.md - Backup & recovery
- scripts/setup/README.md - Development setup
- scripts/demo/README.md - Interactive demos
Navigation tip: Start with scripts/README.md for quick links!
After migration, verify:
- All imports resolve correctly (no "module not found" errors)
- npm scripts work (
npm start,npm test) - Shell scripts execute successfully
- MCP server starts without errors
- Tests pass
- No broken references in documentation
- CI/CD pipeline passes (if applicable)
Cause: Old import path
Solution: Update to './src/core/orchestrator.js'
Cause: Old script path
Solution: Use scripts/infrastructure/health-check.sh
Cause: Old path in .mcp.json
Solution: Update to src/core/mcp-server.js
Cause: Test files using old paths Solution: Update test imports:
// OLD
const module = await import('../../scripts/orchestrator.js');
// NEW
const module = await import('../../src/core/orchestrator.js');Most IDEs support project-wide search & replace:
- Search:
scripts/orchestrator.js - Replace:
src/core/orchestrator.js - Review each match before replacing
Use updated npm scripts instead of direct paths:
# β
GOOD - Uses package.json scripts (already updated!)
npm start
npm run monitor
# β BAD - Hardcoded paths (will break!)
node scripts/orchestrator.jsBefore migrating, we created .bak backups:
# Compare your changes with backup
diff README.md README.md.bak
# Restore if needed
cp README.md.bak README.md- Read this guide thoroughly - Most questions answered here
- Check README.md - Updated with new paths
- See PHASE_1_2_COMPLETION_REPORT.md - Detailed change log
- Repository Issues: Open GitHub issue
- Urgent Questions: Contact maintainers
- CI/CD Issues: Check
.github/workflows/
# Core files
scripts/orchestrator.js β src/core/orchestrator.js
scripts/mcp-server.js β src/core/mcp-server.js
scripts/rabbitmq-client.js β src/core/rabbitmq-client.js
# Systems
scripts/brainstorm-system.js β src/systems/brainstorm/system.js
scripts/voting-system.js β src/systems/voting/system.js
# Scripts
scripts/deploy.sh β scripts/deployment/02-deploy.sh
scripts/health-check.sh β scripts/infrastructure/health-check.sh
scripts/backup-all.sh β scripts/backup/backup.shTrack your migration progress:
- Code imports updated
- Shell scripts updated
- npm scripts verified
- Tests passing
- Documentation updated
- CI/CD pipeline adjusted
- Team members notified
- Deployment verified
After successful migration:
-
Remove backup files:
rm *.bak rm examples/*.bak
-
Celebrate! π You've successfully migrated to a professional repository structure!
-
Share feedback: Let the team know how the migration went!
Migration Guide Version: 1.0.0 Last Updated: 2025-12-07 Questions? Check PHASE_1_2_COMPLETION_REPORT.md for details