Skip to content

Commit 8061c70

Browse files
feat(dso-ojbb): implement --dryrun flag in dso-setup.sh (TDD GREEN)
Add --dryrun mode to scripts/dso-setup.sh. When invoked with --dryrun, the script previews all planned actions without making filesystem changes. - Pre-scan args loop to detect --dryrun (position-independent) - Strip --dryrun from positional args before set -- processing - Guard all 5 action blocks with DRYRUN check (shim copy, config write, pre-commit copy, ci.yml copy, pre-commit install, git init) - Dryrun else branches print [dryrun] Would ... preview messages - Print/show blocks (env guidance, next steps, optional deps) remain unconditional as specified - All 26 tests pass (21 existing + 5 new dryrun tests) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 97483c8 commit 8061c70

File tree

6 files changed

+106
-22
lines changed

6 files changed

+106
-22
lines changed

.tickets/.index.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@
219219
"title": "Implementation planning tradeoffs",
220220
"type": "epic"
221221
},
222+
"dso-gul1": {
223+
"deps": [],
224+
"priority": 3,
225+
"status": "open",
226+
"title": "Fix: exclude .worktree-blackboard.json timestamp churn from review diffs",
227+
"type": "bug"
228+
},
222229
"dso-hq8y": {
223230
"deps": [],
224231
"priority": 2,
@@ -277,6 +284,13 @@
277284
"title": "Retro skill should include an overall visual review",
278285
"type": "epic"
279286
},
287+
"dso-meet": {
288+
"deps": [],
289+
"priority": 3,
290+
"status": "open",
291+
"title": "Fix: dso-setup.sh dryrun messages should reflect conditional copy logic (only if absent)",
292+
"type": "bug"
293+
},
280294
"dso-o8bw": {
281295
"deps": [],
282296
"priority": 1,
@@ -475,6 +489,13 @@
475489
"title": "As a DSO contributor, I can verify shim reliability via automated cross-context smoke test",
476490
"type": "story"
477491
},
492+
"dso-yh8q": {
493+
"deps": [],
494+
"priority": 3,
495+
"status": "open",
496+
"title": "Fix: dso-setup.sh dryrun pre-commit message should check pre-commit availability",
497+
"type": "bug"
498+
},
478499
"dso-zc6s": {
479500
"deps": [
480501
"dso-60hd",

.tickets/.sync-state.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,6 @@
227227
"jira_hash": "b2fcb1e44695c32874c75055e4b8c9e8",
228228
"last_synced": "2026-03-17T18:34:36Z"
229229
},
230-
"last_sync_commit": "9339dafec863c3c76ecce611e84d269099ff1a53",
231-
"last_pull_timestamp": "2026-03-18T16:21:09Z"
230+
"last_sync_commit": "97483c86e09d1e7aeda3f7c78973648c0740747c",
231+
"last_pull_timestamp": "2026-03-18T16:35:34Z"
232232
}

.tickets/dso-tisu.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-tisu
3-
status: open
3+
status: in_progress
44
deps: [dso-yncv]
55
links: []
66
created: 2026-03-18T16:05:22Z
@@ -44,3 +44,33 @@ Implementation:
4444
- [ ] ruff check passes (exit 0)
4545
Verify: cd $(git rev-parse --show-toplevel) && ruff check scripts/*.py tests/**/*.py
4646

47+
48+
## Notes
49+
50+
**2026-03-18T16:32:02Z**
51+
52+
CHECKPOINT 1/6: Task context loaded ✓
53+
54+
**2026-03-18T16:32:05Z**
55+
56+
CHECKPOINT 2/6: Code patterns understood ✓
57+
58+
**2026-03-18T16:32:24Z**
59+
60+
CHECKPOINT 3/6: Tests written ✓ (already from TDD RED — confirmed 5 dryrun tests failing)
61+
62+
**2026-03-18T16:32:50Z**
63+
64+
CHECKPOINT 4/6: Implementation complete ✓
65+
66+
**2026-03-18T16:33:11Z**
67+
68+
CHECKPOINT 5/6: Validation passed ✓ — 26/26 tests pass, ruff clean
69+
70+
**2026-03-18T16:33:37Z**
71+
72+
CHECKPOINT 6/6: Done ✓ — All 5 AC verified: AC1 pass, AC2 pass, AC3 pass, AC4 pass, AC5 pass
73+
74+
**2026-03-18T16:41:33Z**
75+
76+
CHECKPOINT 6/6: Done ✓ — Files: scripts/dso-setup.sh. Tests: 26 passed, 0 failed. Review passed after fix (git init guard added).

.tickets/dso-yncv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
id: dso-yncv
3-
status: in_progress
3+
status: closed
44
deps: []
55
links: []
66
created: 2026-03-18T16:05:03Z

.worktree-blackboard.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": 1,
3-
"batch_id": "batch-1773850609-82930",
4-
"created_at": "2026-03-18T16:16:49Z",
3+
"batch_id": "batch-1773851476-14182",
4+
"created_at": "2026-03-18T16:31:16Z",
55
"agents": []
66
}

scripts/dso-setup.sh

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,74 @@ detect_prerequisites() {
8686

8787
_prereq_warnings=$(detect_prerequisites)
8888

89+
# ── Parse --dryrun flag (position-independent) ────────────────────────────────
90+
DRYRUN=''
91+
_args_filtered=()
92+
for _arg in "$@"; do
93+
if [[ "$_arg" == '--dryrun' ]]; then
94+
DRYRUN=1
95+
else
96+
_args_filtered+=("$_arg")
97+
fi
98+
done
99+
set -- "${_args_filtered[@]+"${_args_filtered[@]}"}"
100+
89101
TARGET_REPO="${1:-$(git rev-parse --show-toplevel)}"
90102
PLUGIN_ROOT="${2:-$(cd "$(dirname "$0")/.." && pwd)}"
91103

92104
# Ensure TARGET_REPO is a git repository so the dso shim can locate
93105
# workflow-config.conf via `git rev-parse --show-toplevel`.
94106
if ! git -C "$TARGET_REPO" rev-parse --show-toplevel >/dev/null 2>&1; then
95-
git -C "$TARGET_REPO" init -q
107+
if [[ -z "$DRYRUN" ]]; then
108+
git -C "$TARGET_REPO" init -q
109+
else
110+
echo "[dryrun] Would run: git init -q in $TARGET_REPO"
111+
fi
96112
fi
97113

98-
mkdir -p "$TARGET_REPO/.claude/scripts/"
99-
cp "$PLUGIN_ROOT/templates/host-project/dso" "$TARGET_REPO/.claude/scripts/dso"
100-
chmod +x "$TARGET_REPO/.claude/scripts/dso"
114+
if [[ -z "$DRYRUN" ]]; then
115+
mkdir -p "$TARGET_REPO/.claude/scripts/"
116+
cp "$PLUGIN_ROOT/templates/host-project/dso" "$TARGET_REPO/.claude/scripts/dso"
117+
chmod +x "$TARGET_REPO/.claude/scripts/dso"
118+
else
119+
echo "[dryrun] Would copy $PLUGIN_ROOT/templates/host-project/dso -> $TARGET_REPO/.claude/scripts/dso (chmod +x)"
120+
fi
101121

102122
CONFIG="$TARGET_REPO/workflow-config.conf"
103-
if grep -q '^dso\.plugin_root=' "$CONFIG" 2>/dev/null; then
104-
# Update existing entry (idempotent)
105-
sed -i.bak "s|^dso\.plugin_root=.*|dso.plugin_root=$PLUGIN_ROOT|" "$CONFIG" && rm -f "$CONFIG.bak"
123+
if [[ -z "$DRYRUN" ]]; then
124+
if grep -q '^dso\.plugin_root=' "$CONFIG" 2>/dev/null; then
125+
# Update existing entry (idempotent)
126+
sed -i.bak "s|^dso\.plugin_root=.*|dso.plugin_root=$PLUGIN_ROOT|" "$CONFIG" && rm -f "$CONFIG.bak"
127+
else
128+
printf 'dso.plugin_root=%s\n' "$PLUGIN_ROOT" >> "$CONFIG"
129+
fi
106130
else
107-
printf 'dso.plugin_root=%s\n' "$PLUGIN_ROOT" >> "$CONFIG"
131+
echo "[dryrun] Would write dso.plugin_root=$PLUGIN_ROOT to $CONFIG"
108132
fi
109133

110134
# ── Copy example config files (only if absent — never overwrite) ──────────────
111135
TARGET_PRECOMMIT="$TARGET_REPO/.pre-commit-config.yaml"
112-
if [ ! -f "$TARGET_PRECOMMIT" ]; then
113-
cp "$PLUGIN_ROOT/examples/pre-commit-config.example.yaml" "$TARGET_PRECOMMIT"
114-
fi
136+
if [[ -z "$DRYRUN" ]]; then
137+
if [ ! -f "$TARGET_PRECOMMIT" ]; then
138+
cp "$PLUGIN_ROOT/examples/pre-commit-config.example.yaml" "$TARGET_PRECOMMIT"
139+
fi
115140

116-
mkdir -p "$TARGET_REPO/.github/workflows"
117-
if [ ! -f "$TARGET_REPO/.github/workflows/ci.yml" ]; then
118-
cp "$PLUGIN_ROOT/examples/ci.example.yml" "$TARGET_REPO/.github/workflows/ci.yml"
141+
mkdir -p "$TARGET_REPO/.github/workflows"
142+
if [ ! -f "$TARGET_REPO/.github/workflows/ci.yml" ]; then
143+
cp "$PLUGIN_ROOT/examples/ci.example.yml" "$TARGET_REPO/.github/workflows/ci.yml"
144+
fi
145+
else
146+
echo "[dryrun] Would copy pre-commit-config.example.yaml -> $TARGET_PRECOMMIT"
147+
echo "[dryrun] Would copy ci.example.yml -> $TARGET_REPO/.github/workflows/ci.yml"
119148
fi
120149

121150
# ── Register pre-commit hooks (must come AFTER config copy) ───────────────────
122-
if command -v pre-commit >/dev/null 2>&1 && [ -f "$TARGET_PRECOMMIT" ]; then
123-
(cd "$TARGET_REPO" && pre-commit install && pre-commit install --hook-type pre-push) || true
151+
if [[ -z "$DRYRUN" ]]; then
152+
if command -v pre-commit >/dev/null 2>&1 && [ -f "$TARGET_PRECOMMIT" ]; then
153+
(cd "$TARGET_REPO" && pre-commit install && pre-commit install --hook-type pre-push) || true
154+
fi
155+
else
156+
echo "[dryrun] Would run: pre-commit install && pre-commit install --hook-type pre-push"
124157
fi
125158

126159
# ── Optional dependency detection (non-blocking) ──────────────────────────────

0 commit comments

Comments
 (0)