Skip to content

fix(core): accept string commands in workspace hook config#781

Merged
christso merged 5 commits intomainfrom
fix/778-string-command
Mar 26, 2026
Merged

fix(core): accept string commands in workspace hook config#781
christso merged 5 commits intomainfrom
fix/778-string-command

Conversation

@christso
Copy link
Copy Markdown
Collaborator

@christso christso commented Mar 26, 2026

Summary

  • Workspace hook command now accepts a string (e.g., command: node scripts/setup.mjs) by auto-splitting on whitespace
  • Previously, string commands were silently ignored — parseWorkspaceScriptConfig returned undefined with no warning

Test plan

  • New test: should accept string command and auto-split on whitespace
  • All 21 workspace config parsing tests pass
  • All 1187 core tests pass
  • Pre-push hooks (build, typecheck, lint, test, validate) all pass

Red/Green UAT

Test YAML — suite defines a default hook with array syntax; one test case tries to override it with string syntax:

workspace:
  hooks:
    before_all:
      command: ["node", "default-setup.mjs"]

tests:
  - id: uses-default
    input: "Hello"
    criteria: "Should work"
  - id: custom-override
    input: "Hello"
    criteria: "Should work"
    workspace:
      hooks:
        before_all:
          command: node custom-setup.mjs

Reproduction command (from repo root):

bun -e "
import { loadTests } from './packages/core/src/evaluation/yaml-parser.js';
const cases = await loadTests('/tmp/subtle-test.yaml', '/tmp');
for (const c of cases) {
  console.log(c.id + ':', JSON.stringify(c.workspace?.hooks?.before_all?.command));
}
"

RED (on main) — override silently falls back to suite default

uses-default: ["node","default-setup.mjs"]
custom-override: ["node","default-setup.mjs"]   ← wrong! should be custom-setup.mjs

The string command is silently ignored, so custom-override inherits the suite-level default. The user thinks their custom hook ran, but it didn't.

GREEN (on fix/778-string-command) — override works correctly

uses-default: ["node","default-setup.mjs"]
custom-override: ["node","custom-setup.mjs"]     ← correct

Closes #778

🤖 Generated with Claude Code

christso and others added 2 commits March 26, 2026 07:38
Workspace hooks silently ignored string commands (e.g., `command: node scripts/setup.mjs`)
because parseWorkspaceScriptConfig only accepted arrays. Now auto-splits string commands on
whitespace to match user expectations.

Closes #778

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 26, 2026

Deploying agentv with  Cloudflare Pages  Cloudflare Pages

Latest commit: a3d2781
Status: ✅  Deploy successful!
Preview URL: https://c8aabe3a.agentv.pages.dev
Branch Preview URL: https://fix-778-string-command.agentv.pages.dev

View logs

christso and others added 3 commits March 26, 2026 07:52
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract parseCommandArray to handle string/array normalization upfront,
keeping parseWorkspaceScriptConfig as a single linear flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@christso christso merged commit 3e2382a into main Mar 26, 2026
2 checks passed
@christso christso deleted the fix/778-string-command branch March 26, 2026 08:04
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.

Workspace hook command silently ignored when string instead of array

1 participant