Skip to content

Commit 5dea069

Browse files
chore(dso-jt4w): close epic — Fix CLAUDE_PLUGIN_ROOT path resolution (merge worktree-20260319-094922)
2 parents 380c367 + 6f221dd commit 5dea069

File tree

9 files changed

+574
-16
lines changed

9 files changed

+574
-16
lines changed

.claude/scripts/dso

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ fi
3131

3232
# Export DSO_ROOT as CLAUDE_PLUGIN_ROOT so downstream scripts can rely on it
3333
# (They may use CLAUDE_PLUGIN_ROOT directly, e.g. hooks/lib/config-paths.sh)
34-
if [ -n "$DSO_ROOT" ]; then
34+
# Guard: only export when CLAUDE_PLUGIN_ROOT was NOT already set by the caller.
35+
# If the caller pre-set CLAUDE_PLUGIN_ROOT (step 1 above), DSO_ROOT came from
36+
# that value — re-exporting would be a no-op at best and would risk overwriting
37+
# a caller-controlled value with a stale config fallback in re-source scenarios.
38+
if [ -n "$DSO_ROOT" ] && [ -z "${CLAUDE_PLUGIN_ROOT:-}" ]; then
3539
export CLAUDE_PLUGIN_ROOT="$DSO_ROOT"
3640
fi
3741

.claude/settings.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"env": {
3-
"CLAUDE_PLUGIN_ROOT": "/Users/joeoakhart/digital-service-orchestra"
4-
},
52
"enabledPlugins": {
63
"dso@digital-service-orchestra": true
74
}

.tickets/dso-drn9.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-drn9
3-
status: open
3+
status: closed
44
deps: [dso-ilna, dso-hpbh]
55
links: []
66
created: 2026-03-19T18:19:13Z
@@ -10,7 +10,36 @@ assignee: Joe Oakhart
1010
parent: dso-jt4w
1111
jira_key: DIG-84
1212
---
13-
# resolution:
13+
# Revert BASH_SOURCE workaround in tk sync path resolution
1414

15-
Replace
15+
Revert the BASH_SOURCE workaround on tk line 5143 that was added to work around the
16+
broken CLAUDE_PLUGIN_ROOT. Now that the settings.json override is removed (dso-hpbh)
17+
and the shim correctly preserves the auto-set value (dso-ilna), the workaround is no
18+
longer needed.
1619

20+
The original line used `CLAUDE_PLUGIN_ROOT` to find `read-config.sh`; the workaround
21+
replaced it with a `BASH_SOURCE`-relative path. Restore the CLAUDE_PLUGIN_ROOT-based
22+
resolution.
23+
24+
## Acceptance Criteria
25+
26+
- tk line ~5143 uses `CLAUDE_PLUGIN_ROOT` (not BASH_SOURCE) to resolve read-config.sh
27+
- `tk sync` successfully resolves read-config.sh via the auto-set CLAUDE_PLUGIN_ROOT
28+
- No other BASH_SOURCE workarounds remain in tk for this path
29+
30+
31+
## Notes
32+
33+
<!-- note-id: 5fm4lxcp -->
34+
<!-- timestamp: 2026-03-19T20:38:26Z -->
35+
<!-- origin: agent -->
36+
<!-- sync: unsynced -->
37+
38+
CHECKPOINT 6/6: Done ✓ — No revert needed. The BASH_SOURCE workaround was never committed (unstaged local change lost during stash). Line 5146 already uses CLAUDE_PLUGIN_ROOT with BASH_SOURCE fallback, which is the correct pattern.
39+
40+
<!-- note-id: 15qmiv4k -->
41+
<!-- timestamp: 2026-03-19T20:38:26Z -->
42+
<!-- origin: agent -->
43+
<!-- sync: unsynced -->
44+
45+
CLOSE REASON: Fixed: BASH_SOURCE workaround was never committed — line 5146 already uses CLAUDE_PLUGIN_ROOT. Verified correct.

.tickets/dso-hpbh.md

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-hpbh
3-
status: open
3+
status: closed
44
deps: []
55
links: []
66
created: 2026-03-19T18:19:02Z
@@ -10,7 +10,72 @@ assignee: Joe Oakhart
1010
parent: dso-jt4w
1111
jira_key: DIG-85
1212
---
13-
# scripts.
13+
# Remove CLAUDE_PLUGIN_ROOT override from .claude/settings.json
1414

15-
Remove
15+
Remove the `CLAUDE_PLUGIN_ROOT` entry from the `env` section of `.claude/settings.json`.
16+
This override points to the repo root (`/Users/joeoakhart/digital-service-orchestra`)
17+
instead of the plugin cache path that Claude Code auto-sets. Removing it lets the
18+
auto-set value flow through to plugin scripts unmodified.
1619

20+
## ACCEPTANCE CRITERIA
21+
22+
- `.claude/settings.json` no longer contains a `CLAUDE_PLUGIN_ROOT` key in `env`
23+
Verify: `{ python3 -c "import json; d=json.load(open('.claude/settings.json')); assert 'CLAUDE_PLUGIN_ROOT' not in d.get('env',{})" && echo PASS; } || echo FAIL`
24+
- Other env vars in settings.json are preserved unchanged
25+
Verify: `test -f .claude/settings.json && python3 -c "import json; json.load(open('.claude/settings.json'))" && echo PASS || echo FAIL`
26+
27+
## File Impact
28+
29+
- `.claude/settings.json`
30+
31+
32+
## Notes
33+
34+
<!-- note-id: t1h7msjm -->
35+
<!-- timestamp: 2026-03-19T20:13:42Z -->
36+
<!-- origin: agent -->
37+
<!-- sync: unsynced -->
38+
39+
CHECKPOINT 1/6: Task context loaded ✓
40+
41+
<!-- note-id: 02gaiky8 -->
42+
<!-- timestamp: 2026-03-19T20:13:56Z -->
43+
<!-- origin: agent -->
44+
<!-- sync: unsynced -->
45+
46+
CHECKPOINT 2/6: Code patterns understood ✓
47+
48+
<!-- note-id: evecs0a9 -->
49+
<!-- timestamp: 2026-03-19T20:14:04Z -->
50+
<!-- origin: agent -->
51+
<!-- sync: unsynced -->
52+
53+
CHECKPOINT 3/6: Tests written (none required) ✓
54+
55+
<!-- note-id: koneppkn -->
56+
<!-- timestamp: 2026-03-19T20:15:19Z -->
57+
<!-- origin: agent -->
58+
<!-- sync: unsynced -->
59+
60+
CHECKPOINT 4/6: Implementation complete ✓
61+
62+
<!-- note-id: 79085qs9 -->
63+
<!-- timestamp: 2026-03-19T20:15:31Z -->
64+
<!-- origin: agent -->
65+
<!-- sync: unsynced -->
66+
67+
CHECKPOINT 5/6: Validation passed ✓
68+
69+
<!-- note-id: zniavdah -->
70+
<!-- timestamp: 2026-03-19T20:15:35Z -->
71+
<!-- origin: agent -->
72+
<!-- sync: unsynced -->
73+
74+
CHECKPOINT 6/6: Done ✓
75+
76+
<!-- note-id: sxr3r9ue -->
77+
<!-- timestamp: 2026-03-19T20:31:01Z -->
78+
<!-- origin: agent -->
79+
<!-- sync: unsynced -->
80+
81+
CLOSE REASON: Fixed: removed CLAUDE_PLUGIN_ROOT from .claude/settings.json env

.tickets/dso-ilna.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-ilna
3-
status: open
3+
status: closed
44
deps: [dso-taha]
55
links: []
66
created: 2026-03-19T18:19:54Z
@@ -18,3 +18,54 @@ set (when DSO_ROOT came from the config fallback). When Claude Code sets CLAUDE_
1818
correctly, the shim must not touch it.
1919

2020
TDD: GREEN -- test_shim_preserves_claude_plugin_root_when_preset now passes.
21+
22+
## Notes
23+
24+
<!-- note-id: mlwj5by2 -->
25+
<!-- timestamp: 2026-03-19T20:32:14Z -->
26+
<!-- origin: agent -->
27+
<!-- sync: unsynced -->
28+
29+
CHECKPOINT 1/6: Task context loaded ✓
30+
31+
<!-- note-id: 8wkq878j -->
32+
<!-- timestamp: 2026-03-19T20:32:24Z -->
33+
<!-- origin: agent -->
34+
<!-- sync: unsynced -->
35+
36+
CHECKPOINT 2/6: Code patterns understood ✓
37+
38+
<!-- note-id: di3f8n3d -->
39+
<!-- timestamp: 2026-03-19T20:32:28Z -->
40+
<!-- origin: agent -->
41+
<!-- sync: unsynced -->
42+
43+
CHECKPOINT 3/6: Tests written (none required — dso-taha wrote RED test) ✓
44+
45+
<!-- note-id: it7im6m0 -->
46+
<!-- timestamp: 2026-03-19T20:33:39Z -->
47+
<!-- origin: agent -->
48+
<!-- sync: unsynced -->
49+
50+
CHECKPOINT 4/6: Implementation complete ✓
51+
52+
<!-- note-id: c3u6s6a1 -->
53+
<!-- timestamp: 2026-03-19T20:33:50Z -->
54+
<!-- origin: agent -->
55+
<!-- sync: unsynced -->
56+
57+
CHECKPOINT 5/6: Validation passed ✓
58+
59+
<!-- note-id: u0lq8fla -->
60+
<!-- timestamp: 2026-03-19T20:34:02Z -->
61+
<!-- origin: agent -->
62+
<!-- sync: unsynced -->
63+
64+
CHECKPOINT 6/6: Done ✓
65+
66+
<!-- note-id: sc21pdq8 -->
67+
<!-- timestamp: 2026-03-19T20:37:05Z -->
68+
<!-- origin: agent -->
69+
<!-- sync: unsynced -->
70+
71+
CLOSE REASON: Fixed: added guard to .claude/scripts/dso and templates/host-project/dso

.tickets/dso-jt4w.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-jt4w
3-
status: in_progress
3+
status: closed
44
deps: []
55
links: []
66
created: 2026-03-19T18:05:25Z
@@ -32,3 +32,10 @@ Remove CLAUDE_PLUGIN_ROOT from .claude/settings.json so Claude Code's auto-set c
3232
<!-- origin: agent -->
3333
<!-- sync: synced -->
3434
Epic created via /dso:brainstorm. Option B chosen: remove override + harden shim fallback.
35+
36+
<!-- note-id: 7oh0c7lc -->
37+
<!-- timestamp: 2026-03-19T20:39:28Z -->
38+
<!-- origin: agent -->
39+
<!-- sync: unsynced -->
40+
41+
CLOSE REASON: Epic complete: all 4 tasks closed, all success criteria verified

.tickets/dso-taha.md

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-taha
3-
status: open
3+
status: closed
44
deps: []
55
links: []
66
created: 2026-03-19T18:18:42Z
@@ -10,7 +10,75 @@ assignee: Joe Oakhart
1010
parent: dso-jt4w
1111
jira_key: DIG-81
1212
---
13-
# .claude/scripts/dso:
13+
# Add failing test for shim CLAUDE_PLUGIN_ROOT preservation (RED)
1414

15-
Add
15+
Write a test (`test_shim_preserves_claude_plugin_root_when_preset`) that verifies
16+
the `.claude/scripts/dso` shim does NOT overwrite `CLAUDE_PLUGIN_ROOT` when it is
17+
already set by the caller (e.g., by Claude Code). The test should fail against the
18+
current shim code (lines 32-36 unconditionally re-export).
1619

20+
TDD RED phase — this test must fail before dso-ilna implements the fix.
21+
22+
## ACCEPTANCE CRITERIA
23+
24+
- Test file exists for shim CLAUDE_PLUGIN_ROOT preservation
25+
Verify: `test -f tests/scripts/test-dso-shim-plugin-root.sh && echo PASS || echo FAIL`
26+
- Test exercises the shim with CLAUDE_PLUGIN_ROOT pre-set and validates preservation
27+
Verify: `grep -q 'CLAUDE_PLUGIN_ROOT' tests/scripts/test-dso-shim-plugin-root.sh && echo PASS || echo FAIL`
28+
- Test fails (RED) against the current shim implementation (lines 32-36 unconditionally re-export)
29+
30+
## File Impact
31+
32+
- `tests/scripts/test-dso-shim-plugin-root.sh`
33+
34+
35+
## Notes
36+
37+
<!-- note-id: 00ne5md6 -->
38+
<!-- timestamp: 2026-03-19T20:13:58Z -->
39+
<!-- origin: agent -->
40+
<!-- sync: unsynced -->
41+
42+
CHECKPOINT 1/6: Task context loaded ✓
43+
44+
<!-- note-id: bh57xfwj -->
45+
<!-- timestamp: 2026-03-19T20:14:22Z -->
46+
<!-- origin: agent -->
47+
<!-- sync: unsynced -->
48+
49+
CHECKPOINT 2/6: Code patterns understood ✓
50+
51+
<!-- note-id: jt9mpjnc -->
52+
<!-- timestamp: 2026-03-19T20:20:29Z -->
53+
<!-- origin: agent -->
54+
<!-- sync: unsynced -->
55+
56+
CHECKPOINT 3/6: Tests written ✓
57+
58+
<!-- note-id: c6xxzfu8 -->
59+
<!-- timestamp: 2026-03-19T20:20:39Z -->
60+
<!-- origin: agent -->
61+
<!-- sync: unsynced -->
62+
63+
CHECKPOINT 4/6: Implementation complete ✓
64+
65+
<!-- note-id: g7jelq13 -->
66+
<!-- timestamp: 2026-03-19T20:20:49Z -->
67+
<!-- origin: agent -->
68+
<!-- sync: unsynced -->
69+
70+
CHECKPOINT 5/6: Validation passed ✓
71+
72+
<!-- note-id: z95thjom -->
73+
<!-- timestamp: 2026-03-19T20:21:05Z -->
74+
<!-- origin: agent -->
75+
<!-- sync: unsynced -->
76+
77+
CHECKPOINT 6/6: Done ✓
78+
79+
<!-- note-id: s0tmdwl0 -->
80+
<!-- timestamp: 2026-03-19T20:31:02Z -->
81+
<!-- origin: agent -->
82+
<!-- sync: unsynced -->
83+
84+
CLOSE REASON: Fixed: added test-dso-shim-plugin-root.sh with RED test for shim preservation

templates/host-project/dso

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ fi
3131

3232
# Export DSO_ROOT as CLAUDE_PLUGIN_ROOT so downstream scripts can rely on it
3333
# (They may use CLAUDE_PLUGIN_ROOT directly, e.g. hooks/lib/config-paths.sh)
34-
if [ -n "$DSO_ROOT" ]; then
34+
# Guard: only export when CLAUDE_PLUGIN_ROOT was NOT already set by the caller.
35+
# If the caller pre-set CLAUDE_PLUGIN_ROOT (step 1 above), DSO_ROOT came from
36+
# that value — re-exporting would be a no-op at best and would risk overwriting
37+
# a caller-controlled value with a stale config fallback in re-source scenarios.
38+
if [ -n "$DSO_ROOT" ] && [ -z "${CLAUDE_PLUGIN_ROOT:-}" ]; then
3539
export CLAUDE_PLUGIN_ROOT="$DSO_ROOT"
3640
fi
3741

0 commit comments

Comments
 (0)