diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-13 13:49:21 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-13 13:49:21 -0500 |
| commit | f537150ff3f67899d27a7f121bc302f61a307c1c (patch) | |
| tree | 325145d96c398575991d7be5006fdc5cb0f8895f | |
| parent | 25bde1f7e342cdf428dbb9468d0d14323be34db6 (diff) | |
| download | rulesets-f537150ff3f67899d27a7f121bc302f61a307c1c.tar.gz rulesets-f537150ff3f67899d27a7f121bc302f61a307c1c.zip | |
feat(hooks): title sessions host-project with a hyphen, no space
The SessionStart hook joined host and project with a space ("ratio rulesets"), which reads as two words in the claude.ai/code and mobile session lists. I changed the join to "$host-$project" ("ratio-rulesets") so the title is one token, and updated the three session-title-hook.bats expectations test-first.
| -rwxr-xr-x | hooks/session-title.sh | 6 | ||||
| -rw-r--r-- | scripts/tests/session-title-hook.bats | 10 | ||||
| -rw-r--r-- | todo.org | 5 |
3 files changed, 11 insertions, 10 deletions
diff --git a/hooks/session-title.sh b/hooks/session-title.sh index 8a12f61..87fa4ad 100755 --- a/hooks/session-title.sh +++ b/hooks/session-title.sh @@ -1,6 +1,6 @@ #!/bin/sh -# SessionStart(startup|resume) hook: title the session "<host> <project>" -# (e.g. "ratio rulesets", "velox work") so remote sessions are identifiable +# SessionStart(startup|resume) hook: title the session "<host>-<project>" +# (e.g. "ratio-rulesets", "velox-work") so remote sessions are identifiable # in the claude.ai/code and mobile session lists instead of auto-generated # names. # @@ -38,4 +38,4 @@ fi # uname -n, not hostname: Arch doesn't ship hostname by default (inetutils). host=$(uname -n) -python3 -c 'import json,sys; print(json.dumps({"hookSpecificOutput":{"hookEventName":"SessionStart","sessionTitle":sys.argv[1]}}))' "$host $project" +python3 -c 'import json,sys; print(json.dumps({"hookSpecificOutput":{"hookEventName":"SessionStart","sessionTitle":sys.argv[1]}}))' "$host-$project" diff --git a/scripts/tests/session-title-hook.bats b/scripts/tests/session-title-hook.bats index 60b633d..5ce8b6a 100644 --- a/scripts/tests/session-title-hook.bats +++ b/scripts/tests/session-title-hook.bats @@ -1,6 +1,6 @@ #!/usr/bin/env bats # hooks/session-title.sh — SessionStart hook that titles the session -# "<host> <project>" (uname -n + git-toplevel basename, cwd basename outside +# "<host>-<project>" (uname -n + git-toplevel basename, cwd basename outside # a repo) so remote sessions are identifiable on web/mobile. It only sets a # title when the session doesn't have one yet: a /rename or an earlier run # must not be clobbered on resume. @@ -25,13 +25,13 @@ run_hook() { fi } -@test "titles host + repo basename inside a git repo" { +@test "titles host-repo basename inside a git repo" { git -C "$TMPDIR_T" init -q -b main mkdir -p "$TMPDIR_T/sub/dir" run run_hook "$TMPDIR_T" [ "$status" -eq 0 ] title=$(echo "$output" | jq -r '.hookSpecificOutput.sessionTitle') - [ "$title" = "$HOST $(basename "$TMPDIR_T")" ] + [ "$title" = "$HOST-$(basename "$TMPDIR_T")" ] } @test "uses the repo toplevel basename from a subdirectory" { @@ -40,7 +40,7 @@ run_hook() { run run_hook "$TMPDIR_T/sub/dir" [ "$status" -eq 0 ] title=$(echo "$output" | jq -r '.hookSpecificOutput.sessionTitle') - [ "$title" = "$HOST $(basename "$TMPDIR_T")" ] + [ "$title" = "$HOST-$(basename "$TMPDIR_T")" ] } @test "falls back to cwd basename outside a git repo" { @@ -48,7 +48,7 @@ run_hook() { run run_hook "$TMPDIR_T/chime" [ "$status" -eq 0 ] title=$(echo "$output" | jq -r '.hookSpecificOutput.sessionTitle') - [ "$title" = "$HOST chime" ] + [ "$title" = "$HOST-chime" ] } @test "emits valid SessionStart hookSpecificOutput" { @@ -1059,12 +1059,13 @@ Codex ran the spec-review workflow. Outcome: the combined spec is =Not ready= be *** 2026-06-12 Fri @ 02:39:38 -0500 Second review after response pass Codex re-ran spec-review after the dispositions were folded in. Outcome by arc: Phase 1.5 helper instances =Ready with caveats=; phases 2-5 remain =Not ready= behind the explicit decisions/reverification gate. No new blocking findings for the helper slice. Review file updated in place: [[file:docs/design/2026-05-28-generic-agent-runtime-spec-review.org]]. -** TODO [#C] Session title hostname-project, no space :feature:quick: +** DONE [#C] Session title hostname-project, no space :feature:quick: +CLOSED: [2026-06-13 Sat] :PROPERTIES: :CREATED: [2026-06-13 Sat] :LAST_REVIEWED: 2026-06-13 :END: -Routed from the roam global inbox via inbox-zero 2026-06-13. The SessionStart hook (=hooks/session-title.sh=) emits =<host> <project>= with a space; Craig wants =<host>-<project>= with a hyphen and no space. One-line change at the =sessionTitle= assembly (currently ="$host $project"=) plus its header comment, and the matching expectation in =session-title-hook.bats=. +Routed from the roam global inbox via inbox-zero 2026-06-13. The SessionStart hook (=hooks/session-title.sh=) emitted =<host> <project>= with a space; Craig wanted =<host>-<project>= with a hyphen and no space. Changed the =sessionTitle= join to ="$host-$project"= plus the header comments, and updated the three =session-title-hook.bats= expectations (test-first; 6/6 green). * Rulesets Resolved ** DONE [#C] Fix =cj-scan= false positives on cj fences nested inside other =#+begin_*= blocks :bug: |
