Skip to content

Add urlcode studio: the review report served on localhost, rebuilt on every reload - #751

Merged
jimhoyd merged 1 commit into
mainfrom
claude/urlcode-studio
Sep 25, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/urlcode-studio

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

urlcode report (#749) writes a file you regenerate by hand after each change. urlcode studio [BEFORE] [--project DIR] [--port 4100] [--policy F] [--host-file F] serves the same page on localhost and rebuilds it from disk on every page load, so reloading shows the project as it is now.

  • Same page, same data as report; studio.ts adds no analysis. Read-only: no editing, no project code run.
  • The policy file and BEFORE are re-read per load, so a re-pin shows on reload. The host file is trusted operator code: loaded once at start.
  • A project that does not load (for example urlcode.yaml mid-edit) renders its error; the studio keeps running.
  • Loopback only: --host must be 127.0.0.1, ::1 or localhost, and requests whose Host is not a loopback name get 403, so a web page cannot read it through DNS rebinding. Only an explicit --port is read, never PORT (the serve/dev container setting).

Found while building it: loadDocument admits two loads per process. The report ran explain and review in parallel; when one failed on broken YAML, the sibling kept a slot and the next load was refused ("Configuration compilation capacity unavailable"). The report now loads sequentially, and concurrent studio requests share one in-flight build.

readChangeInput in yaml-change.ts replaces the directory-or-YAML reader that diff and report each had inline.

Docs: new Studio subsection under the review report, and llms.txt.

Verification

  • npm run verify: pass, 0 failures.
  • npm run test:package: pass.
  • test/studio.test.ts (5 tests): the page follows file edits; broken YAML gives a 500 error page with no script and the studio keeps serving; non-loopback --host refused, foreign Host 403, POST 405 with Allow, other paths 404, HEAD without a body; 6 concurrent loads all 200; BEFORE comparison; the CLI prints its listening event and exits 0 on SIGINT.
  • Smoke-tested against a private production project: page 200, foreign Host 403, POST 405, clean stop.

Not included: the page does not refresh itself. That needs script, which the page's CSP currently forbids, so it is left for a separate decision.

Compatibility and security

  • New CLI command; studio joins hostFileCommands and policyCommands. No YAML, schema or runtime change.

  • The report now runs explain then review sequentially instead of in parallel; output is unchanged.

  • Serves only the read-only report, with Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline', Cache-Control: no-store, X-Content-Type-Options: nosniff and Referrer-Policy: no-referrer.

  • Changes match the documented portable contract; docs/examples are updated where needed.

  • Relevant tests and package checks pass, or limitations are explained above.

  • No credentials, customer data or private project material are included.

  • Runtime/starter changes remain aligned where applicable.

🤖 Generated with Claude Code

…uilt on every reload

`urlcode studio [BEFORE] [--port 4100] [--policy F] [--host-file F]` serves
the `urlcode report` page and rebuilds it from disk on each page load, so a
reload shows the project as it is now. It adds no analysis and changes
nothing: one read-only page, no project code run. The policy file and BEFORE
are re-read per load; the host file is loaded once. A project that does not
load (mid-edit YAML) renders its error and the studio keeps running.

It listens on loopback only and answers only requests whose Host is a
loopback name, so a web page cannot read it through DNS rebinding. It reads
only an explicit --port, never PORT (the serve/dev container setting).

loadDocument admits two loads per process. The report ran explain and review
in parallel; when one failed, the sibling kept a slot and the next load was
refused with "Configuration compilation capacity unavailable". The report now
loads sequentially, and concurrent studio requests share one build.

readChangeInput (yaml-change.ts) replaces the directory-or-YAML reader diff
and report each had inline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 25, 2026 14:56
@jimhoyd
jimhoyd merged commit e11b2d1 into main Sep 25, 2026
24 checks passed
@jimhoyd
jimhoyd deleted the claude/urlcode-studio branch September 25, 2026 14:59
jimhoyd added a commit that referenced this pull request Sep 25, 2026
Studio (#751) and the report (#749) were documented only in TOOLING.md,
llms.txt and the CLI help. Add a row to the docs index, a sentence in the
README's "Try it", and name studio next to report in the AI-authoring
hand-back step. llms-full.txt regenerated.

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant