Fix /wf-list truncating descriptions at an escaped quote - #1
Merged
hesreallyhim merged 2 commits intoJul 31, 2026
Merged
Conversation
/wf-list parsed each script's meta with an inline `node -e` regex,
`description:\s*['"]([^'"]+)['"]`, which ends the string at the first
quote INSIDE it. The three descriptions containing an apostrophe —
acceptance-qa ("a ticket\'s acceptance criteria"), design-tournament
("the losers\' best ideas") and refactor-campaign ("each target\'s
behavior") — were reported truncated with a trailing backslash, so the
listing looked corrupt and the reader had to reopen the files to recover
what the workflows actually do. The same regex advertised only the first
required arg, so api-migration showed [needs from] instead of from, to.
Replace the inline parser with scripts/list-workflows.mjs, which reads
meta the way the validator and tracer already do: brace-counted with
escape awareness, screened as data, evaluated in an empty realm. Nothing
executes a workflow script. Adds a keyword filter and --json.
That extractor was already copy-pasted between the validator and the
tracer (and had drifted — the tracer's copy dropped the template-literal
message), and /wf-list reimplementing it by regex is how the truncation
shipped. Hoist it into scripts/workflow-meta.mjs and import it in all
three; tests fail if a local copy reappears.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DH3GoMST3WGcd5wKmrM1KR
Two findings on the /wf-list fix: 1. A keyword could be mistaken for a directory. The listing resolved its positional args by "does this name an existing directory?", so `/wf-list test` run from a project with a test/ directory listed that directory instead of filtering for "test" — and the answer changed with the caller's working directory. The directory is now behind --dir; a positional is always the keyword. Unknown options and a second positional are errors rather than silent no-ops. 2. The brace scan mishandled a closing quote after an even number of backslashes. It asked whether the PREVIOUS character was a backslash, which reads 'C:\\' as unterminated even though that backslash is itself escaped. The scan then ran past meta into the body: extraction returned null and the validator rejected a VALID script, citing a phase() call several lines below the literal. An escape now consumes the next character, whatever it is. Adds tests/fixtures/benign-meta-trailing-escape.temp.js, which must validate clean and round-trip its description. Reverting either fix fails the suite (5 checks and 1 respectively). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DH3GoMST3WGcd5wKmrM1KR
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.
/wf-list parsed each script's meta with an inline
node -eregex,description:\s*['"]([^'"]+)['"], which ends the string at the firstquote INSIDE it. The three descriptions containing an apostrophe —
acceptance-qa ("a ticket's acceptance criteria"), design-tournament
("the losers' best ideas") and refactor-campaign ("each target's
behavior") — were reported truncated with a trailing backslash, so the
listing looked corrupt and the reader had to reopen the files to recover
what the workflows actually do. The same regex advertised only the first
required arg, so api-migration showed [needs from] instead of from, to.
Replace the inline parser with scripts/list-workflows.mjs, which reads
meta the way the validator and tracer already do: brace-counted with
escape awareness, screened as data, evaluated in an empty realm. Nothing
executes a workflow script. Adds a keyword filter and --json.
That extractor was already copy-pasted between the validator and the
tracer (and had drifted — the tracer's copy dropped the template-literal
message), and /wf-list reimplementing it by regex is how the truncation
shipped. Hoist it into scripts/workflow-meta.mjs and import it in all
three; tests fail if a local copy reappears.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com