Skip to main content

/framework-sync - Sync Development to Protected Installation

For Individual Contributors Only

Commits and pushes coditect-core changes from your development copy, then updates the protected installation with the latest version.

System Prompt

EXECUTION DIRECTIVE: When the user invokes this command, you MUST:

  1. Verify contributor status - Check for development copy in coditect-rollout-master
  2. Show pending changes - Display git status of coditect-core
  3. Commit changes - Stage and commit with conventional commit message
  4. Push to remote - Push to origin/main
  5. Update protected installation - Re-clone or pull latest to protected location
  6. Verify sync - Confirm protected installation matches remote

REQUIRES CONFIRMATION: This command pushes to remote and modifies protected installation.


Usage

# Authentication
/framework-sync --register # Register this machine as contributor
/framework-sync --list-machines # List all registered contributor machines

# Sync Operations (requires registered machine)
/framework-sync # Full sync: coditect-core + parent + protected
/framework-sync --commit-only # Only commit and push, don't update protected
/framework-sync --update-only # Only update protected from remote
/framework-sync --no-parent # Skip coditect-rollout-master submodule update
/framework-sync --message "feat: ..." # Provide commit message directly
/framework-sync --dry-run # Show what would happen

Architecture Overview

DEVELOPMENT (Git-Tracked):
~/PROJECTS/coditect-rollout-master/submodules/core/coditect-core/
↓ git add, commit, push

REMOTE (GitHub):
github.com/coditect-ai/coditect-core (main branch)
↓ git clone --depth 1

PROTECTED (Read-Only):
~/Library/Application Support/CODITECT/core/

What It Does

Step 1: Verify Contributor Setup

# Check for development copy
DEV_COPY="$HOME/PROJECTS/coditect-rollout-master/submodules/core/coditect-core"

if [ ! -d "$DEV_COPY/.git" ]; then
echo "⚠ Development copy not found or not a git repo"
echo " Expected: $DEV_COPY"
echo " This command is for individual contributors only."
exit 1
fi

# Check for protected installation
PROTECTED="$HOME/Library/Application Support/CODITECT/core"
if [ ! -d "$PROTECTED" ]; then
echo "⚠ Protected installation not found"
echo " Run: python3 scripts/CODITECT-CORE-INITIAL-SETUP.py"
exit 1
fi

Step 2: Show Pending Changes

cd "$DEV_COPY"

echo "=== Git Status ==="
git status --short

echo ""
echo "=== Unpushed Commits ==="
git log origin/main..HEAD --oneline

echo ""
echo "=== Modified Files ==="
git diff --stat

Step 3: Commit Changes (Interactive)

# Stage changes
echo "Files to stage:"
git status --short

# User confirms or selects files
git add -A # or selective

# Generate commit message
# Use conventional commits: feat/fix/docs/refactor/chore
git commit -m "feat(component): Add new feature

Description of changes.

Co-Authored-By: Claude <noreply@anthropic.com>"

Step 4: Push to Remote

# Verify we're on main
BRANCH=$(git branch --show-current)
if [ "$BRANCH" != "main" ]; then
echo "⚠ Not on main branch. Current: $BRANCH"
echo " Merge to main before syncing."
exit 1
fi

# Push
git push origin main
echo "✓ Pushed to origin/main"

Step 5: Update Protected Installation

PROTECTED="$HOME/Library/Application Support/CODITECT/core"

# Option A: Fresh clone (safer, ensures clean state)
echo "Updating protected installation..."
rm -rf "$PROTECTED"
git clone --depth 1 https://github.com/coditect-ai/coditect-core.git "$PROTECTED"

# Remove .git to prevent modification
rm -rf "$PROTECTED/.git"

# Set read-only permissions
find "$PROTECTED" -type f -exec chmod 444 {} \;
find "$PROTECTED" -type f -name "*.sh" -exec chmod 555 {} \;
find "$PROTECTED" -type f -name "*.py" -exec chmod 555 {} \;

echo "✓ Protected installation updated"

Step 6: Verify Sync

# Compare versions
DEV_VERSION=$(cd "$DEV_COPY" && git rev-parse --short HEAD)
PROTECTED_VERSION=$(cat "$PROTECTED/config/version.json" 2>/dev/null | grep -o '"commit": "[^"]*"' | cut -d'"' -f4)

echo "Development: $DEV_VERSION"
echo "Protected: Latest from remote"

# Verify component counts match
DEV_AGENTS=$(ls "$DEV_COPY/agents/"*.md 2>/dev/null | wc -l)
PROT_AGENTS=$(ls "$PROTECTED/agents/"*.md 2>/dev/null | wc -l)

echo "Agents: Dev=$DEV_AGENTS, Protected=$PROT_AGENTS"

Component Lifecycle

For Contributors: Development → Production

1. CREATE in development copy:
~/PROJECTS/coditect-rollout-master/submodules/core/coditect-core/

Example: Create commands/symlinks.md

2. TEST locally:
- Command works via /symlinks
- Script executes correctly

3. COMMIT and PUSH:
/framework-sync

4. UPDATE protected installation:
/framework-sync --update-only

5. VERIFY in protected:
ls ~/.coditect/commands/symlinks.md

For Customers: Automatic Updates

Customers don't have development copies. They update via:

python3 ~/.coditect/scripts/CODITECT-CORE-INITIAL-SETUP.py

This re-clones the latest version to the protected location.

Important Notes

When to Use This Command

  • ✅ After creating new agents, commands, skills, scripts
  • ✅ After modifying framework components
  • ✅ After fixing bugs in coditect-core
  • ✅ When you want protected installation to match your development

When NOT to Use

  • ❌ For customer installations (they use install script)
  • ❌ For untested changes (test locally first)
  • ❌ For work-in-progress (commit to feature branch first)

Protected Installation Characteristics

AspectProtectedDevelopment
Location~/Library/Application Support/CODITECT/corecoditect-rollout-master/submodules/core
Git.git removed (no git ops)Full git history
PermissionsRead-only (0o444/0o555)Read-write
Symlinks point toThis locationN/A (is the source)
UpdatesVia this command or install scriptgit pull

Troubleshooting

"Permission denied" on protected files

The protected installation is intentionally read-only. To update:

/framework-sync --update-only

"Diverged from remote"

Your development copy has diverged. Resolve:

cd ~/PROJECTS/coditect-rollout-master/submodules/core/coditect-core
git fetch origin
git rebase origin/main
# or
git merge origin/main

Protected installation missing

Re-run initial setup:

python3 ~/.coditect/scripts/CODITECT-CORE-INITIAL-SETUP.py --accept-license

See Also

  • /symlinks - Manage project symlinks
  • /component-create - Create new components
  • CODITECT-CORE-INITIAL-SETUP.py - Full installation
  • ADR-057 - Installation architecture