[--pattern ] [--exclude ] [--dry-run] --json`
3. Parse JSON output
4. Return results
## Step 4: Process CLI Response
The CLI returns JSON like:
**Successful Sync**:
```json
{
"status": "success",
"operation": "sync-project",
"project": "auth-service",
"environment": "test",
"target_branch": "test",
"direction": "bidirectional",
"to_codex": {
"files_synced": 25,
"files_deleted": 2,
"commit_sha": "abc123...",
"commit_url": "https://github.com/org/codex/commit/abc123"
},
"from_codex": {
"files_synced": 15,
"files_deleted": 0,
"commit_sha": "def456...",
"commit_url": "https://github.com/org/project/commit/def456"
},
"dry_run": false,
"duration_seconds": 12.5
}
```
**Dry-Run Preview**:
```json
{
"status": "success",
"operation": "sync-project",
"project": "auth-service",
"environment": "test",
"target_branch": "test",
"direction": "bidirectional",
"dry_run": true,
"would_sync": {
"to_codex": {
"files": 25,
"deletions": 2,
"exceeds_threshold": false
},
"from_codex": {
"files": 15,
"deletions": 0,
"exceeds_threshold": false
}
},
"recommendation": "Safe to proceed"
}
```
IF status == "success":
- Extract sync results from CLI response
- Proceed to output formatting
- CONTINUE
IF status == "failure":
- Extract error message from CLI
- Return error to caller
- DONE (with error)
## Step 5: Output Completion Message
Output:
```
✅ COMPLETED: Project Sync
Project: {project}
Environment: {environment} (branch: {target_branch})
Direction: {direction}
Results:
- Files synced to codex: {count}
- Files synced from codex: {count}
- Commits created: {count}
- Deletions: {count}
Summary:
{brief description of what was synced}
───────────────────────────────────────
Next: Verify changes in repositories
```
## Step 6: Return Results
Return structured JSON with sync results (pass through from CLI).
COMPLETION: Operation complete when sync results shown.