Repository navigation
fix(playbooks): kebab-case names so /playbook keeps the name when text follows it - #379
Merged
Merged
Conversation
"/playbook release, then make a crew" expanded to "Start playbook release, then make a crew", so the whole sentence read as the playbook name. A name now ends at whitespace (trailing punctuation dropped) or is a JSON-quoted string when it contains spaces, and any text after it stays as its own paragraph. Playbook Author suggests hyphenated lowercase names so quoting stays rare. Part of #320. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bryantderosier
requested review from
BastiHu,
Jacksondr5 and
tyler-barton-horizon
September 29, 2026 17:31
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: Jacksondr5/j5code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Comment |
Replaces the JSON-quoting rule for names with spaces. PLAYBOOK_NAME_PATTERN now matches AgentPersonaId, so the word after /playbook (and later @Playbook:) is the name with no quoting. Discovery lists a misnamed file as invalid with a suggested rename instead of hiding it, deletion still works on it, and Settings import converts "Release Plan.yaml" to release-plan.yaml. Part of #320. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/playbooktreated everything after the command as the playbook name. "/playbook release, then make a crew" went out as "Start playbook release, then make a crew", so the agent was asked to start a playbook named "release, then make a crew"./playbook releasefollowed by more text on the next line wasn't expanded at all. The underlying cause is that playbook names allowed spaces, so no text rule could tell where a name ends.@playbook:(#320) has the same problem.What I changed
packages/contracts/src/j5/playbook.ts→PLAYBOOK_NAME_PATTERN: a playbook name is now kebab-case (^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$), the same patternAgentPersonaIdalready enforces. NewsuggestPlaybookNameturns a stem like "Release Plan" intorelease-plan.apps/server/src/j5/playbooks/PlaybookStore.ts→discover: a.yamlfile with any other name is still listed, with aninvalid_nameissue that suggests the rename, instead of being silently hidden.removeDefinitionaccepts any safe file stem, so a misnamed file can still be deleted from Settings.startrefuses non-kebab names with a message pointing atplaybook_list.apps/web/src/j5/playbooks/importPlaybookFile.ts→playbookImportName: Settings import converts names (Release Plan.yamlis saved asrelease-plan.yaml) instead of rejecting them.packages/client-runtime/src/j5/playbooks.ts→expandPlaybookPrompt: the word after/playbookis the name (lowercased, without trailing punctuation or.yaml), and any text after it is kept as its own paragraph ("Start playbook release." then "then make a crew"). A word that isn't a valid name leaves the message unchanged.PLAYBOOK_AUTHOR_INSTRUCTIONSnow requires kebab-case names and puts the human-readable name intitle.docs/user/playbooks.md: the naming rule, import conversion, and trailing text.Why this shape
The first commit tried JSON-quoting names that contain spaces. I dropped that for one rule shared with personas:
@playbook:release-reviewreads exactly like@persona:code-reviewer, and #320 needs no quoting. Nothing is lost for display, because every definition already has atitleand the library, Fleet, and step board show it. I rejected a convention alone (Playbook Author suggesting hyphens) because imports and hand-saved files would still allow spaces. The client can't check names against the workspace's playbook list, since the expansion runs on web and three mobile submit paths without it, so the rule has to work on the text alone.Invariants
suggestPlaybookNamealways returns a name that matchesPLAYBOOK_NAME_PATTERN, ornull./playbook(case-insensitive, followed by whitespace or the end) is rewritten./playbooks,/plan, and mid-sentence/playbookare untouched.Surfaces
/playbookexpansion, the Settings library (misnamed files show the rename hint), and Settings importexpandPlaybookPrompt. The web and mobile libraries render the server'sissue.messageas they already do. Import is web and desktop onlyplaybook_listandplaybook_startreturn the same shapes, with a new issue code on misnamed filespackages/contracts)PLAYBOOK_NAME_PATTERNand the newsuggestPlaybookNamehelper, both in the J5-ownedsrc/j5/playbook.tsdocs/user/playbooks.mdOut of scope
@playbook:mention and its pickers (Mention a playbook with @playbook: in the composer #320).Upgrade and data
No migration. Run history stores absolute definition paths and is unaffected. A workspace file whose name isn't kebab-case now shows as invalid until it's renamed. The only definition I know of in real use,
agent-development-delivery.yaml, already matches.Verification
vp test run packages/contracts/src/j5/playbook.test.ts packages/client-runtime/src/j5/playbooks.test.ts apps/web/src/j5/playbooks/importPlaybookFile.test.ts apps/server/src/j5/playbooks/: 110 passed. New tests: the name pattern and suggestion; trailing text, the next-line case, and invalid words in the expansion; a misnamed file listed with a hint, refused at start, and deleted; import conversion.vp test run apps/web/src/j5/playbooks apps/mobile/src/j5/playbooks apps/mobile/src/features/threads/use-composer-command-menu.test.ts apps/server/src/j5/a2a/Migrations.test.ts: 49 passed.tsc --noEmitforpackages/contracts,packages/client-runtime,apps/server, andapps/web: 0 errors.vp linton the touched files: clean.Review focus
PlaybookStore.discoverandremoveDefinition: a misnamed file should stay visible and deletable, and never be startable.2026 plan.yamlimports asplaybook-2026-plan.Part of #320
Claude Opus 5.5 via J5 Code
🤖 Generated with Claude Code