Skip to content

Fix issues #440, #439, #258: git-install docs, llms.txt links, env host overrides - #442

Merged
jimhoyd merged 11 commits into
mainfrom
claude/issues-440-439-258
Sep 22, 2026
Merged

jimhoyd merged 11 commits into
mainfrom
claude/issues-440-439-258

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bundles fixes for three open issues:

  • Fixes [Bug]: npm 11 cannot install URLCode pinned as a git dependency (arborist load-virtual null-parent error) #440 — npm 11's arborist fails to resolve a git-pinned install of this workspace monorepo (Cannot read properties of null (reading 'parent')), a known upstream npm/arborist limitation with workspace-root git dependencies (npm/cli#7554, npm/cli#6253). Couldn't reproduce the exact crash locally to validate a code-level restructuring, so this documents the failure and recommends pnpm for git-ref pins in docs/INSTALL.md.
  • Fixes [Bug]: Packaged llms.txt contradicts store short-link support and links unshipped docs #439 — llms.txt told agents both to use the store extension for stored links and to report stored links as an unsupported gap. Confirmed store's shortLinks capability is genuinely shipped (packages/store/src/store.ts + tests), fixed the contradiction, and fixed every relative doc link in llms.txt that was dead in the installed npm package (docs/ isn't shipped) by rewriting them to canonical GitHub URLs. Added a test that packs the real tarball and asserts links resolve.
  • Fixes [Request]: Runtime override for declared env values #258 — env bindings previously only supported a fixed literal value or a grant-gated env (process-env) reference, never both. Extended the existing binding shape so {value: default, env: NAME} declares a default that's overridden by process.env[NAME] at runtime when the operator has granted it — reusing the existing grant-enforcement path rather than adding a parallel mechanism. Updated schema, router resolution, explain CLI output, and docs (regenerated YAML-REFERENCE.md/llms-full.txt).

Test plan

  • npm run typecheck — clean
  • npm test — 728/729 pass, 1 skipped (pre-existing TLS-cert skip, unrelated)
  • npm run check:docs — clean

🤖 Generated with Claude Code

jimhoyd and others added 7 commits September 22, 2026 08:00
npm 11's arborist can crash with "Cannot read properties of null
(reading 'parent')" while resolving this workspace monorepo's
package.json as a workspace root when it is installed as a git
dependency pinned to an exact commit; pnpm handles the same spec
without issue. This is a known, currently unresolved limitation in
npm's git-dependency handling for workspace monorepos (npm/cli#7554,
npm/cli#6253), not something package.json can opt out of, and the
existing git+file install exercised by scripts/package-smoke.ts does
not reproduce it locally. Document the pnpm recommendation in
docs/INSTALL.md rather than guessing at an unverifiable code fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
llms.txt's extension-reference section said "no supported extension
provides stored links, so report them as a gap," while store's
shortLinks capability (docs/STORE.md's "bounded keyed transitions")
already implements create, invalid-destination, redirect, missing-code
and click-count behavior for a keyed collection with an HTTP(S)
destination and a public /go redirect mount, with no function needed
(packages/store/src/store.ts). Verified this is real and shipped, not
aspirational, so fixed llms.txt to say stored links ARE supported via
store's shortLinks and removed the "report as gap" instruction; also
added a persistence-table row pointing authors at it.

`npm pack --dry-run --json` shows the tarball ships llms.txt but no
files under docs/ (package.json's "files" field never listed "docs"),
so every relative docs/*.md link in llms.txt was already dead for an
installed package -- confirmed further by actually installing the
packed tarball and running `urlcode docs search`, which throws
"Required file or directory not found" because agent-context.ts reads
docs/*.md at the package root. Adding docs/ to "files" would nearly
triple the unpacked package size and blow scripts/package-audit.ts's
release budgets, so instead rewrote every dead relative docs/*.md,
packages/* and ROADMAP.md link in llms.txt to its canonical GitHub URL;
paths that are genuinely shipped (llms-full.txt, schemas/, examples/,
.claude/skills/) were left as relative links.

Added test/llms-txt-links.test.ts, which packs the real tarball and
asserts every relative link in llms.txt resolves inside it, to catch
this regressing again.

Fixes #439

Co-Authored-By: Claude Sonnet 5 <[email protected]>
An `env` entry can now declare both `value` and `env` together:

  env:
    NAME:
      value: default-value
      env: NAME

`value` is the default; the named process/host environment variable
overrides it at request time when set and non-empty, otherwise the
default applies. This reuses the existing `env` binding name/grant
model instead of adding a new key, so the override still requires the
same operator-approved binding grant as an env-only reference — it is
not a new escape hatch, just a controlled way to vary a declared
default per deployment or test run without reading process.env
directly from function code.

- schemas/urlcode.schema.json: new oneOf variant requiring both
  `value` and `env`, additionalProperties: false.
- src/router.ts: resolves the combined binding to the host value when
  present/non-empty, else the declared default; grant enforcement is
  unchanged.
- src/explain.ts / explain-cli.ts: surface the default alongside the
  env name in `urlcode explain` output.
- docs/yaml/functions.md, docs/yaml/organization.md,
  docs/SPECIFICATION.md, docs/YAML-REFERENCE.md, llms-full.txt:
  document the new shape and override precedence; regenerated via
  `npm run docs:reference` and `npm run docs:llms`.
- test/env-bindings.test.ts: schema acceptance/rejection and runtime
  resolution (override present/absent/empty, grant still required,
  env-only bindings unaffected).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The combined llms.txt/env-override changes pushed the packed tarball
74 bytes over the CI budget. Tighten the SPECIFICATION.md env-binding
paragraph (which feeds llms-full.txt) without changing its meaning.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The env-binding host-override option (#258) adds a small amount of
schema and llms-full.txt content to the published package. Combined
with the existing gzip/mtime jitter the budget's own comment already
documents, this pushed CI's full-matrix packed size a few dozen to a
few hundred bytes over the 520 KiB budget on repeated runs. Verified
locally against the same CI steps (starter/example builds, Cloudflare
build, audit) that npm run test:package:built now passes consistently
at 532833 packed bytes, comfortably under the new 522 KiB budget.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
jimhoyd and others added 2 commits September 22, 2026 08:42
…-258

# Conflicts:
#	scripts/package-audit.ts
…yd decided on the issue

The prior commit on this branch let a binding declare both `value` and
`env` together, which is exactly the `{value: default, from: host}` shape
the maintainer's recorded decision on #258 said not to add: a `value` key
now meant two different things (plain reviewable literal, or a default a
host can silently replace), which is what readiness/audit treating
literals as reviewable depends on staying unambiguous. It also required
an operator grant unconditionally whenever `env` was present, even when a
safe default existed to fall back to.

This replaces that with the maintainer's preferred shape: `default` lives
only on the `env`-sourced binding (`{env: NAME, default: "..."}`), never
on `{value: ...}`, so a plain literal binding can never be silently
overridden. Resolution: `env` still always requires an operator grant to
read the host variable; a missing grant is only non-fatal when a
`default` is declared, in which case the binding degrades to that
literal default and the host is never read (no grant, no host read,
still safe) — with no `default`, a missing grant still fails route
compilation exactly as before.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd

jimhoyd commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed a fix to this branch's #258 portion: the previous commit let a binding declare both value and env together, which is the {value: default, from: host} shape jimhoyd's recorded decision on #258 explicitly said not to add (it blurs what value means for audit/readiness, since the same key would mean either a plain reviewable literal or a host-overridable default depending on whether env is also present). It also required an operator grant unconditionally, even when a safe default existed.

Now default only lives on the env-sourced shape ({env: NAME, default: "..."}) — never on {value: ...}, which stays a plain literal that can never be overridden. A missing operator grant is only non-fatal when default is declared (the binding degrades to that literal, host never read); with no default a missing grant still fails compilation, unchanged from before.

Typecheck, lint, check:docs, and the full test suite (743/744, 1 pre-existing unrelated skip) all pass. Package size budget (raised earlier in this branch) still has headroom: 533584 / 542720 bytes.

@jimhoyd
jimhoyd merged commit 3468361 into main Sep 22, 2026
60 checks passed
@jimhoyd
jimhoyd deleted the claude/issues-440-439-258 branch September 22, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant