From af9fe63b0c45f9035184f61f0acbd65af0f3ce12 Mon Sep 17 00:00:00 2001 From: Shaked Eyal Date: Thu, 6 Aug 2026 18:29:36 +0300 Subject: [PATCH 1/3] fix(slug): replace slash in branch name instead of deleting it Aligns gstack-slug with ship Step 8's tr '/' '-' so gstack-review-log and gstack-review-read stop writing feat/foo to featfoo while other writers use feat-foo. The [a-zA-Z0-9._-] invariant promised in the file header still holds; tr -cd remains the final filter. Refs #1127 --- bin/gstack-slug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/gstack-slug b/bin/gstack-slug index 24bbca4f1..87d4bb9ba 100755 --- a/bin/gstack-slug +++ b/bin/gstack-slug @@ -49,7 +49,7 @@ if [[ -n "$SLUG" ]]; then fi RAW_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || RAW_BRANCH="" -BRANCH=$(printf '%s' "${RAW_BRANCH:-}" | tr -cd 'a-zA-Z0-9._-') +BRANCH=$(printf '%s' "${RAW_BRANCH:-}" | tr '/' '-' | tr -cd 'a-zA-Z0-9._-') BRANCH="${BRANCH:-unknown}" echo "SLUG=$SLUG" echo "BRANCH=$BRANCH" From 7d78033381ccb1aed22be07fee1dc6a498d4603f Mon Sep 17 00:00:00 2001 From: Shaked Eyal Date: Thu, 6 Aug 2026 18:29:45 +0300 Subject: [PATCH 2/3] fix(ship): log Step 20 metrics through gstack-review-log Step 20 built ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl by hand and also carried a literal BRANCH token in the JSON payload. A slash branch turned the redirect into a subdirectory write, or failed outright when the directory did not exist. gstack-review-log takes no path argument and already resolves the slug and branch, creates the directory, validates the JSON, and enqueues for gbrain sync. The BRANCH placeholder is replaced by a shell expansion. Refs #1127 --- ship/SKILL.md.tmpl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ship/SKILL.md.tmpl b/ship/SKILL.md.tmpl index 068ac4fe5..0267accea 100644 --- a/ship/SKILL.md.tmpl +++ b/ship/SKILL.md.tmpl @@ -464,16 +464,17 @@ git push -u origin ## Step 20: Persist ship metrics -Log coverage and plan completion data so `/retro` can track trends: +Log coverage and plan completion data so `/retro` can track trends. + +Route the append through `gstack-review-log`. It resolves the project slug and +the canonical branch form itself, creates the directory, validates the JSON, and +enqueues the row for gbrain sync. It takes **no path argument** — never build a +`-reviews.jsonl` path by hand. A branch with a `/` in it turns a +hand-built path into a subdirectory write, and the row goes somewhere `/retro` +will never look. ```bash -eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG -``` - -Append to `~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl`: - -```bash -echo '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"BRANCH"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl +~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"'"$(git rev-parse --abbrev-ref HEAD)"'"}' ``` Substitute from earlier steps: @@ -482,7 +483,9 @@ Substitute from earlier steps: - **PLAN_DONE**: count of DONE + CHANGED items from Step 8 (0 if no plan file) - **VERIFY_RESULT**: "pass", "fail", or "skipped" from Step 8.1 - **VERSION**: from the VERSION file -- **BRANCH**: current branch name + +The branch name is filled in by the shell — there is no `BRANCH` placeholder to +substitute. This step is automatic — never skip it, never ask for confirmation. From 072249610f97f7dd0e01db2b30b90464d63aff9c Mon Sep 17 00:00:00 2001 From: Shaked Eyal Date: Thu, 6 Aug 2026 18:29:46 +0300 Subject: [PATCH 3/3] chore: regenerate ship SKILL.md and golden fixtures --- ship/SKILL.md | 21 ++++++++++++--------- test/fixtures/golden/claude-ship-SKILL.md | 21 ++++++++++++--------- test/fixtures/golden/codex-ship-SKILL.md | 21 ++++++++++++--------- test/fixtures/golden/factory-ship-SKILL.md | 21 ++++++++++++--------- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/ship/SKILL.md b/ship/SKILL.md index eadffaa8f..ebb7eda4c 100644 --- a/ship/SKILL.md +++ b/ship/SKILL.md @@ -1344,16 +1344,17 @@ git push -u origin ## Step 20: Persist ship metrics -Log coverage and plan completion data so `/retro` can track trends: +Log coverage and plan completion data so `/retro` can track trends. + +Route the append through `gstack-review-log`. It resolves the project slug and +the canonical branch form itself, creates the directory, validates the JSON, and +enqueues the row for gbrain sync. It takes **no path argument** — never build a +`-reviews.jsonl` path by hand. A branch with a `/` in it turns a +hand-built path into a subdirectory write, and the row goes somewhere `/retro` +will never look. ```bash -eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG -``` - -Append to `~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl`: - -```bash -echo '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"BRANCH"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl +~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"'"$(git rev-parse --abbrev-ref HEAD)"'"}' ``` Substitute from earlier steps: @@ -1362,7 +1363,9 @@ Substitute from earlier steps: - **PLAN_DONE**: count of DONE + CHANGED items from Step 8 (0 if no plan file) - **VERIFY_RESULT**: "pass", "fail", or "skipped" from Step 8.1 - **VERSION**: from the VERSION file -- **BRANCH**: current branch name + +The branch name is filled in by the shell — there is no `BRANCH` placeholder to +substitute. This step is automatic — never skip it, never ask for confirmation. diff --git a/test/fixtures/golden/claude-ship-SKILL.md b/test/fixtures/golden/claude-ship-SKILL.md index eadffaa8f..ebb7eda4c 100644 --- a/test/fixtures/golden/claude-ship-SKILL.md +++ b/test/fixtures/golden/claude-ship-SKILL.md @@ -1344,16 +1344,17 @@ git push -u origin ## Step 20: Persist ship metrics -Log coverage and plan completion data so `/retro` can track trends: +Log coverage and plan completion data so `/retro` can track trends. + +Route the append through `gstack-review-log`. It resolves the project slug and +the canonical branch form itself, creates the directory, validates the JSON, and +enqueues the row for gbrain sync. It takes **no path argument** — never build a +`-reviews.jsonl` path by hand. A branch with a `/` in it turns a +hand-built path into a subdirectory write, and the row goes somewhere `/retro` +will never look. ```bash -eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG -``` - -Append to `~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl`: - -```bash -echo '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"BRANCH"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl +~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"'"$(git rev-parse --abbrev-ref HEAD)"'"}' ``` Substitute from earlier steps: @@ -1362,7 +1363,9 @@ Substitute from earlier steps: - **PLAN_DONE**: count of DONE + CHANGED items from Step 8 (0 if no plan file) - **VERIFY_RESULT**: "pass", "fail", or "skipped" from Step 8.1 - **VERSION**: from the VERSION file -- **BRANCH**: current branch name + +The branch name is filled in by the shell — there is no `BRANCH` placeholder to +substitute. This step is automatic — never skip it, never ask for confirmation. diff --git a/test/fixtures/golden/codex-ship-SKILL.md b/test/fixtures/golden/codex-ship-SKILL.md index d99630c4b..a955d58e0 100644 --- a/test/fixtures/golden/codex-ship-SKILL.md +++ b/test/fixtures/golden/codex-ship-SKILL.md @@ -2730,16 +2730,17 @@ Print the branch name, remote URL, and instruct the user to create the PR/MR man ## Step 20: Persist ship metrics -Log coverage and plan completion data so `/retro` can track trends: +Log coverage and plan completion data so `/retro` can track trends. + +Route the append through `gstack-review-log`. It resolves the project slug and +the canonical branch form itself, creates the directory, validates the JSON, and +enqueues the row for gbrain sync. It takes **no path argument** — never build a +`-reviews.jsonl` path by hand. A branch with a `/` in it turns a +hand-built path into a subdirectory write, and the row goes somewhere `/retro` +will never look. ```bash -eval "$($GSTACK_ROOT/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG -``` - -Append to `~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl`: - -```bash -echo '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"BRANCH"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl +$GSTACK_ROOT/bin/gstack-review-log '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"'"$(git rev-parse --abbrev-ref HEAD)"'"}' ``` Substitute from earlier steps: @@ -2748,7 +2749,9 @@ Substitute from earlier steps: - **PLAN_DONE**: count of DONE + CHANGED items from Step 8 (0 if no plan file) - **VERIFY_RESULT**: "pass", "fail", or "skipped" from Step 8.1 - **VERSION**: from the VERSION file -- **BRANCH**: current branch name + +The branch name is filled in by the shell — there is no `BRANCH` placeholder to +substitute. This step is automatic — never skip it, never ask for confirmation. diff --git a/test/fixtures/golden/factory-ship-SKILL.md b/test/fixtures/golden/factory-ship-SKILL.md index a2acad24f..1f413fe02 100644 --- a/test/fixtures/golden/factory-ship-SKILL.md +++ b/test/fixtures/golden/factory-ship-SKILL.md @@ -3136,16 +3136,17 @@ Print the branch name, remote URL, and instruct the user to create the PR/MR man ## Step 20: Persist ship metrics -Log coverage and plan completion data so `/retro` can track trends: +Log coverage and plan completion data so `/retro` can track trends. + +Route the append through `gstack-review-log`. It resolves the project slug and +the canonical branch form itself, creates the directory, validates the JSON, and +enqueues the row for gbrain sync. It takes **no path argument** — never build a +`-reviews.jsonl` path by hand. A branch with a `/` in it turns a +hand-built path into a subdirectory write, and the row goes somewhere `/retro` +will never look. ```bash -eval "$($GSTACK_ROOT/bin/gstack-slug 2>/dev/null)" && mkdir -p ~/.gstack/projects/$SLUG -``` - -Append to `~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl`: - -```bash -echo '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"BRANCH"}' >> ~/.gstack/projects/$SLUG/$BRANCH-reviews.jsonl +$GSTACK_ROOT/bin/gstack-review-log '{"skill":"ship","timestamp":"'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'","coverage_pct":COVERAGE_PCT,"plan_items_total":PLAN_TOTAL,"plan_items_done":PLAN_DONE,"verification_result":"VERIFY_RESULT","version":"VERSION","branch":"'"$(git rev-parse --abbrev-ref HEAD)"'"}' ``` Substitute from earlier steps: @@ -3154,7 +3155,9 @@ Substitute from earlier steps: - **PLAN_DONE**: count of DONE + CHANGED items from Step 8 (0 if no plan file) - **VERIFY_RESULT**: "pass", "fail", or "skipped" from Step 8.1 - **VERSION**: from the VERSION file -- **BRANCH**: current branch name + +The branch name is filled in by the shell — there is no `BRANCH` placeholder to +substitute. This step is automatic — never skip it, never ask for confirmation.