Skip to content

allow hyphen in command ref token names - #4356

Open
HuzaifaChaudary wants to merge 1 commit into
github:mainfrom
HuzaifaChaudary:fix/command-ref-token-hyphen
Open

allow hyphen in command ref token names#4356
HuzaifaChaudary wants to merge 1 commit into
github:mainfrom
HuzaifaChaudary:fix/command-ref-token-hyphen

Conversation

@HuzaifaChaudary

Copy link
Copy Markdown

problem

the command ref token can not hold a command name that has a hyphen in it. the pattern is

__SPECKIT_COMMAND_([A-Z][A-Z0-9_]*)__

the bundled command speckit.agent-context.update has a hyphen in the middle segment so there is no way to write a token for it. the text SPECKIT_COMMAND_AGENT-CONTEXT_UPDATE matches nothing and it stays in the generated file as plain text. the agent then reads a raw token instead of a real command.

fix

allow a literal hyphen in the character class in the two places that resolve the token

  • src/specify_cli/integrations/base.py in resolve_command_refs
  • src/specify_cli/extensions/__init__.py in the extension skills resolver

no decode change is needed. the existing replace call already leaves a hyphen untouched. so AGENT-CONTEXT_UPDATE becomes agent-context.update with the dot separator and agent-context-update with the hyphen separator.

this is option 2 from the review on #4204 which is the direction that was asked for there.

tests

i added 4 tests

  • hyphenated name with the dot separator
  • hyphenated name with the hyphen separator
  • a leading hyphen still does not match because the first character is still [A-Z]
  • extension skill registration resolves a hyphenated token

all 4 fail before the change and pass after it.

full suite after the change is 7139 passed and 9 failed. the same 9 fail on main without my change so they are not from this. they are the python parity template tests.

ruff 0.15.0 check src tests passes which is what the workflow runs.

ai disclosure

i used an ai assistant to help me read the code and write the tests. i reviewed the change myself and ran the suite locally.

fixes #4328

the token pattern was matching only A-Z 0-9 and underscore so a command
name like speckit.agent-context.update can not be written as a token and
the token stays in the output as plain text

now the character class allows a hyphen also in both places that resolve
the token
Copilot AI balanced review requested due to automatic review settings August 27, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: __SPECKIT_COMMAND_<NAME>__ still can't represent hyphenated command names — #4204 stalled after review

2 participants