Skip to content

Fix /wf-list truncating descriptions at an escaped quote - #1

Merged
hesreallyhim merged 2 commits into
mainfrom
claude/workflow-description-truncation-9a5989
Jul 31, 2026
Merged

Fix /wf-list truncating descriptions at an escaped quote#1
hesreallyhim merged 2 commits into
mainfrom
claude/workflow-description-truncation-9a5989

Conversation

@hesreallyhim

@hesreallyhim hesreallyhim commented Jul 31, 2026

Copy link
Copy Markdown
Owner

/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

/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

@hesreallyhim hesreallyhim left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

lgtm

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
@hesreallyhim
hesreallyhim merged commit 265ed2e into main Jul 31, 2026
4 checks passed
@hesreallyhim
hesreallyhim deleted the claude/workflow-description-truncation-9a5989 branch July 31, 2026 16:38
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.

2 participants