Repository navigation
Bounded redirect quick path for agents (refs #383) - #386
Merged
Merged
Conversation
Establishes and proves the current redirect support matrix by running
`urlcode validate`/`test`/`audit` against fixed, parameterized-path,
fixed-depth-suffix, query-preserving, method-preserving and 404 shapes
(all supported), and against wildcard-suffix/`{rest...}` and
host/scheme/relative destinations (both refused, with their exact
validation errors).
- `urlcode context --task redirects` / MCP `get_context {"task":"redirects"}`:
one bounded call returning every shape's support, exact YAML or exact
error, the tested workaround for gaps, and this project's own redirects.
Same budget-dropping mechanics as the existing `buildContext`.
- Early "Building only redirects? Start here" section in llms.txt, and a
redirect-first block at the top of docs/AI-AUTHORING.md's built-in
features table, both pointing at the new task-scoped context.
- Extended the existing `redirect` recipe (not duplicated) to cover fixed,
parameterized-path, query-preserving and default-404 shapes in one
runnable project, with fixtures for every one plus HEAD/405 coverage.
- docs/OPEN-DECISIONS.md: concrete proposals for wildcard-suffix redirects
(with security/ordering notes) and why host/scheme redirects are a
deliberate refusal, not a gap to close casually.
Verified: `npm run verify` (lint, typecheck, check:code, check:docs,
build, full test suite, workspace verify, audit:packages) passes.
Core package: 430 files against the 440-entry cap (unchanged cap).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
jimhoyd
force-pushed
the
docs/redirect-quick-path-383
branch
from
September 21, 2026 15:22
5d25d79 to
2052289
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #383. Not merging this PR — leaving it open for review.
Support matrix established by running validate/test/audit (not assumed)
redirect: {url, status}/users/:id->/profiles/:id){id}placeholder inredirect.url, naming a declared path parameter/legacy/a/b->/modern/a/b){param}per segmentredirect.query.pass(explicit allowlist) /query.mapmethods+status: 307/308site.notFound(shipped in 0.4.7, not 0.4.6) or the runtime default/legacy/*->/modern/*, any depth)redirect: {url: "https://.../*"}->"Only static or extension routes support a terminal /* wildcard";{rest...}->"Invalid route parameter"/relative,//host/x->"Redirect URL must be absolute HTTP(S)";{host}placeholder ->"Redirect placeholders are allowed only in path segments"@jimhoyd/urlcodepublished versions: 0.4.1, 0.4.2, 0.4.6, 0.4.7.site.notFoundshipped in 0.4.7 (commit f01baec, issue #316) — not present in 0.4.6, the version the benchmark agent used, so its declarative-404 gap report for 0.4.6 was accurate for that revision.What shipped
urlcode context --project DIR --task redirects(MCPget_context {"task":"redirects"}): one bounded call returning every shape above with exact YAML or exact error, the tested workaround for the two gaps, this project's own redirects, and the usualvalidate/test/auditcommands. Same budget-dropping mechanics as the existingbuildContext/--budget.recipes/redirect: extended (not duplicated) to a runnable project covering fixed, parameterized-path, query-preserving and default-404 shapes in oneurlcode.yaml, with fixtures for every shape plus HEAD/405 coverage.urlcode recipes search redirectstill finds it first./**+{**}capture) with ordering/security notes (open-redirect risk stays closed because the destination host is still a literal), and an explanation of why host/scheme redirects are a deliberate refusal rather than a gap to close casually.Token comparison (context --task redirects vs whole-project context)
Measured via
urlcode context --project recipes/redirect --stats(characters/4 estimate, same estimator as the existing--stats):urlcode context: ~1094 tokens for this 2-route project.urlcode context --task redirects(guidance + this project's redirects + commands): ~1249 tokens — the extra cost is the fixed shape catalog (9 shapes with exact YAML), which is what replaces reading docs/RECIPES catalogs/package inspection; a--budgetstill bounds it (e.g.--budget 400drops to guidance-only in ~25 tokens).llms-full.txt) for comparison: ~57,809 tokens.Package entry count
npm run audit:packages: core package (@jimhoyd/urlcode) is 430 files against the unchanged 440-entry cap. Cap not raised.Open decisions (not implemented here, need a maintainer decision)
docs/OPEN-DECISIONS.md, refs [Gap]: give agents a redirect-focused URLCode quick path #383): proposed/**route key +{**}destination capture, with route-ordering and open-redirect notes.docs/OPEN-DECISIONS.md, refs [Gap]: give agents a redirect-focused URLCode quick path #383): no proposed YAML — flagged as a deliberate security refusal (open-redirect/header-injection), not an encoding gap.Verification
npm run verify(lint, typecheck,check:code,check:docs, build, full test suite including the newtest/context-task.test.ts, workspace verify,audit:packages) passes end to end.npm run docs:llmsregeneratedllms-full.txt.🤖 Generated with Claude Code