Skip to content

[Bug]: generated context commands mishandle project paths and working directories #790

Closed

Description

@jimhoyd

Runtime revision and environment

Published URLCode 0.6.3; core main/tag 2383b1213546fb9fd1fbc51aa4d2ed6dfe27a457, macOS, Node 26.10.0. Synthetic installed site.

Minimal reproduction

Create a valid route project under a site directory named app with spaces, then run:

urlcode context --project '/tmp/review-site/app with spaces' --json
urlcode context --task redirects --project '/tmp/review-site/app with spaces' --json

Both succeed in producing context, but their commands.validate contains:

npx --no --package @jimhoyd/urlcode urlcode validate --local --project /tmp/review-site/app with spaces

Execute that returned command from the installed site: it fails. Passing the same project path as one quoted CLI argument succeeds.

Expected: every emitted project argument is shell-quoted for the supported shell/platform, including projectFlag overrides. The new shellWord helper is applied to hostFile/origin but ${flag} is still interpolated bare in both buildContext and buildTaskContext. Cover ordinary spaces and an apostrophe in project paths; use platform-appropriate quoting.

Relevant output

Both emitted commands exit 1 with {"event":"error","message":"Unexpected positional arguments"}. The project itself has only one declarative respond route and validates normally. The issue is the recommended command, not project loading.

Activity

  1. jimhoyd commented on Sep 26, 2026

    @jimhoyd
    CollaboratorAuthor

    A second reproduced path-handling problem affects commands returned by the local MCP server on 0.6.3. The generated client setup starts MCP from the installed site root, with --project app --host-file host.mjs. Calling get_context returns:

    npx --no --package @jimhoyd/urlcode urlcode validate --local --project . --host-file /tmp/review-site/host.mjs --origin https://site.example

    Executing this exact command from that site root exits 1: Host file must be outside the application project. Executing it after changing into site/app succeeds (8 routes in my fresh init --with admin,form-records --example site). The returned command gives no working-directory change or requirement.

    The tool should return a command that targets the configured application from the documented client working directory, or include an explicit working directory with each command. Quoting alone will not fix this case. Verified through the real serveMcp → get_context response and execution of its commands.validate, with a revision-pinned composed host; no user project changed.

  2. changed the title [-][Bug]: generated context commands do not quote project paths[/-] [+][Bug]: generated context commands mishandle project paths and working directories[/+] on Sep 26, 2026
  3. added
    bug
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions