-
Notifications
You must be signed in to change notification settings - Fork 1
Pipeline Plan inline
Seth Ford edited this page Mar 2, 2026
·
10 revisions
Plan saved to docs/plans/2026-03-01-ping-command.md.
Minimum viable change: 4 touches — create scripts/sw-ping.sh, create scripts/sw-ping-test.sh, add ping) case to scripts/sw router, add entry to package.json test script.
Alternatives considered:
| Approach | Trade-offs |
|---|---|
| Standalone script (chosen) | Identical to 100+ existing commands; fully isolated; testable independently; ~67 lines |
| Inline in router | Fewer files but mixes concerns, no independent test path, against project architecture |
Chosen: Standalone script — same pattern as sw-hello.sh, lowest blast radius.
| Action | File | Notes |
|---|---|---|
| Create | scripts/sw-ping.sh |
New command — ~67 lines, mirrors sw-hello.sh |
| Create | scripts/sw-ping-test.sh |
6-test suite — mirrors sw-hello-test.sh |
| Modify | scripts/sw |
Insert ping) case before hello) at line 605 |
| Modify | package.json |
Insert bash scripts/sw-ping-test.sh && between pipeline-vitals and pm tests |
-
Create
scripts/sw-ping-test.shwith 6 tests: output=pong, exit 0,--helpcontainsUSAGE,-hcontainsUSAGE,--versionmatches semver, invalid option exits 1 - Run test — confirm fails (file not found) — TDD red phase
-
Create
scripts/sw-ping.sh— exact structure ofsw-hello.shwithecho "pong"in the""case;VERSION="3.2.4",set -euo pipefail, ERR trap chmod +x scripts/sw-ping.sh-
Run
bash scripts/sw-ping-test.sh— confirm PASS: 6 FAIL: 0 -
Commit
sw-ping.sh+sw-ping-test.sh -
Edit
scripts/sw— insertping) exec "$SCRIPT_DIR/sw-ping.sh" "$@" ;;beforehello)case -
Verify
bash scripts/sw pingprintspong - Commit router change
-
Edit
package.json— insertbash scripts/sw-ping-test.sh &&aftersw-pipeline-vitals-test.sh -
Run
npm test— confirm full suite passes - Commit package.json
- Task 1: Create
scripts/sw-ping-test.sh(6 tests) - Task 2: Run test — confirm fails (TDD red)
- Task 3: Create
scripts/sw-ping.sh(mirrors sw-hello.sh, outputspong) - Task 4:
chmod +x scripts/sw-ping.sh - Task 5: Run
bash scripts/sw-ping-test.sh— PASS: 6 FAIL: 0 - Task 6: Commit sw-ping.sh + sw-ping-test.sh
- Task 7: Add
ping)case toscripts/swbeforehello)(line 605) - Task 8: Verify
bash scripts/sw pingprintspong - Task 9: Commit router change
- Task 10: Add
bash scripts/sw-ping-test.sh &&topackage.jsontest script - Task 11: Run
npm test— confirm all suites pass - Task 12: Commit package.json
| Risk | What Breaks | Mitigation |
|---|---|---|
Router entry after *)
|
ping is unreachable — falls through to "Unknown command" |
Insert before hello) which is before *)
|
Extra whitespace in pong output |
assert_equals "pong" "$output" fails |
Use bare echo "pong" — no color/prefix |
| ERR trap + invalid option test | Trap fires on intentional exit 1 during test | Mirror hello-test pattern: ` |
| package.json position | Test skipped if misplaced | Insert alphabetically between pipeline-vitals and pm |
| VERSION drift | Conventions violation | Use VERSION="3.2.4" (from sw-hello.sh) |
-
bash scripts/sw-ping.shprints exactlypong - Exit code is 0
-
bash scripts/sw-ping-test.sh→ PASS: 6 FAIL: 0 -
bash scripts/sw pingprintspong(router verified) -
npm testpasses with ping test included -
sw-ping.shis executable and usesset -euo pipefail,VERSION="3.2.4", ERR trap