codebyplan 1.13.9 → 1.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
# - Web-UI flag (app_file_approval_by_user) consumption + reset
|
|
13
13
|
# - Writes both PATCH /api/rounds/${ROUND_ID} and PATCH /api/tasks/${TASK_ID}
|
|
14
14
|
#
|
|
15
|
+
# Caller worktree identity:
|
|
16
|
+
# The CLI auto-resolves caller_worktree_id (override flag → cache →
|
|
17
|
+
# in-process tuple API) and hard-fails with exit 1 if it cannot resolve
|
|
18
|
+
# on the write path. This hook resolves the worktree id before invoking the
|
|
19
|
+
# CLI and passes it via --caller-worktree-id so the server can honor the
|
|
20
|
+
# feat-worktree lock. The hook itself stays non-fatal (exits 0) and surfaces
|
|
21
|
+
# the CLI's stderr output to the user.
|
|
22
|
+
#
|
|
15
23
|
# Flags:
|
|
16
24
|
# --dry-run Pass through to CLI (prints merged payload, no API writes).
|
|
17
25
|
# Used by fixture-based smoke tests.
|
|
@@ -67,11 +75,19 @@ if [ -z "$TASK_ID" ]; then
|
|
|
67
75
|
exit 0
|
|
68
76
|
fi
|
|
69
77
|
|
|
78
|
+
# Resolve worktree id before invoking the CLI so the server can honor the
|
|
79
|
+
# feat-worktree lock. On miss (unregistered worktree) the CLI falls back to
|
|
80
|
+
# its in-process resolve and hard-fails with guidance if still unresolved.
|
|
81
|
+
WORKTREE_ID=$(npx codebyplan resolve-worktree 2>/dev/null)
|
|
82
|
+
|
|
70
83
|
# Delegate to the codebyplan CLI (single source of truth for merge semantics)
|
|
71
84
|
CMD_ARGS=("round" "sync-approvals" "--round-id" "$ROUND_ID" "--task-id" "$TASK_ID")
|
|
85
|
+
if [ -n "$WORKTREE_ID" ]; then
|
|
86
|
+
CMD_ARGS+=("--caller-worktree-id" "$WORKTREE_ID")
|
|
87
|
+
fi
|
|
72
88
|
[ "$DRY_RUN" = "true" ] && CMD_ARGS+=("--dry-run")
|
|
73
89
|
|
|
74
|
-
if npx codebyplan "${CMD_ARGS[@]}"
|
|
90
|
+
if npx codebyplan "${CMD_ARGS[@]}"; then
|
|
75
91
|
echo "cbp-mcp-round-sync: synced via CLI for round ${ROUND_ID}" >&2
|
|
76
92
|
else
|
|
77
93
|
echo "cbp-mcp-round-sync: CLI sync failed for round ${ROUND_ID} (non-fatal)" >&2
|
|
@@ -196,7 +196,7 @@ echo '{}' > "$WORKTREE_PATH/.codebyplan/shipment.json"
|
|
|
196
196
|
echo '{}' > "$WORKTREE_PATH/.codebyplan/vendor.json"
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
The `.codebyplan/device.local.json` file is created by `npx codebyplan setup` on the device (gitignored). The `worktree_id` is never
|
|
199
|
+
The `.codebyplan/device.local.json` file is created by `npx codebyplan setup` on the device (gitignored). The `worktree_id` is never COMMITTED; it may be cached per-device in the gitignored `.codebyplan/worktree.local.json` (branch-keyed, re-derivable via `codebyplan resolve-worktree --cache`), otherwise resolved at runtime from the `(device_id, repo path, branch)` tuple via `npx codebyplan resolve-worktree`.
|
|
200
200
|
|
|
201
201
|
No need to mark as `skip-worktree` — the committed files are merge-safe per CHK-108 and CHK-120.
|
|
202
202
|
|
|
@@ -69,7 +69,20 @@ Run:
|
|
|
69
69
|
npx codebyplan round sync-approvals --round-id <round_id> --task-id <task_id>
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
The CLI auto-resolves the worktree id
|
|
72
|
+
The CLI auto-resolves the caller worktree id with the following precedence:
|
|
73
|
+
1. `--caller-worktree-id <uuid>` override (if passed — skips all resolution)
|
|
74
|
+
2. Per-device branch-keyed cache (`.codebyplan/worktree.local.json`)
|
|
75
|
+
3. In-process tuple API call: `POST /worktrees/resolve` using `(device_id, repo_path, branch)`
|
|
76
|
+
|
|
77
|
+
On the write path (non `--dry-run`), if the worktree id cannot be resolved the CLI **hard-fails with exit 1** and prints an actionable message. To pre-populate the cache:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
npx codebyplan resolve-worktree --cache
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If this worktree is not yet registered, run `npx codebyplan setup` first, then re-run `/cbp-round-update`.
|
|
84
|
+
|
|
85
|
+
The CLI parses `git status --short`, merges drift + staging + web-UI flag, and writes both round and task (forwarding `caller_worktree_id` on both writes so the server honors the feat-worktree lock).
|
|
73
86
|
|
|
74
87
|
Read the stdout JSON: `{ added, stale_marked, reactivated, total_files }`.
|
|
75
88
|
|