Repository navigation
Fix issues #440, #439, #258: git-install docs, llms.txt links, env host overrides - #442
Conversation
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]>
…-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]>
|
Pushed a fix to this branch's #258 portion: the previous commit let a binding declare both Now Typecheck, lint, |
…-258 # Conflicts: # scripts/package-audit.ts
…claude/issues-440-439-258
Summary
Bundles fixes for three open issues:
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 indocs/INSTALL.md.llms.txttold agents both to use the store extension for stored links and to report stored links as an unsupported gap. Confirmed store'sshortLinkscapability is genuinely shipped (packages/store/src/store.ts+ tests), fixed the contradiction, and fixed every relative doc link inllms.txtthat 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.envbindings previously only supported a fixed literalvalueor a grant-gatedenv(process-env) reference, never both. Extended the existing binding shape so{value: default, env: NAME}declares a default that's overridden byprocess.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,explainCLI output, and docs (regeneratedYAML-REFERENCE.md/llms-full.txt).Test plan
npm run typecheck— cleannpm test— 728/729 pass, 1 skipped (pre-existing TLS-cert skip, unrelated)npm run check:docs— clean🤖 Generated with Claude Code