Fix doc updater: docs moved to code.claude.com - #12
Open
karstenpet-ctrl wants to merge 1 commit into
Open
Conversation
The docs relocated off docs.claude.com, which broke update_docs.js in three ways: - fetchUrl treated any non-2xx as fatal, so the 301 on llms.txt killed the script immediately. Now follows up to 5 redirects. - docs.claude.com/llms.txt redirects to platform.claude.com/llms.txt, the API docs index, which lists no Claude Code pages. The Claude Code index is code.claude.com/llms.txt, and the path shape changed from /en/docs/claude-code/<page>.md to /docs/en/<page>.md. - 48 of the 172 new pages are nested and 8 basenames collide (hooks, mcp, overview, permissions, plugins, quickstart, sessions, skills), so path.basename() silently overwrote real docs. Nested paths now flatten, e.g. agent-sdk/hooks.md -> agent-sdk-hooks.md. Fixes obra#7 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Fixes #7.
update_docs.jshas been dead since the docs moved offdocs.claude.com. There are three separate failures — fixing only the hostname still produces a silently corruptedreferences/directory, so all three are addressed here.1.
fetchUrldoesn't follow redirectsAny non-2xx was fatal, so the script died on the first request:
Now follows up to 5 redirects, resolving
Locationrelative to the current URL. Worth keeping independently of the host fix — it makes the next docs reshuffle degrade gracefully instead of hard-failing.2. The source index moved, and the redirect target is the wrong index
docs.claude.com/llms.txtredirects toplatform.claude.com/llms.txt, which is the API / developer platform index and contains zero Claude Code pages:The Claude Code index is at
https://code.claude.com/llms.txt, with pages atcode.claude.com/docs/en/*.md:The path shape changed too —
/en/docs/claude-code/<page>.mdbecame/docs/en/<page>.md— soCLAUDE_CODE_PATTERNneeded updating alongsideLLMS_TXT_URL.3.
path.basename()silently clobbers colliding filenamesThe one most worth catching. The new index has 172 pages, 48 of them nested (
agent-sdk/, etc.), and 8 basenames collide:With
path.basename(url),agent-sdk/hooks.mdoverwrites the Claude Codehooks.md— no error, no warning, just wrong content in a file the skill later cites as authoritative. Whichever URL sorts last wins. Nested paths now flatten on/, soagent-sdk/hooks.md→agent-sdk-hooks.md.Verification
URL discovery from this branch:
172 URLs → 172 unique filenames, no collisions.
Full run against a v0.3.1 install:
references/went from 42 files / 572K to 175 files / 6.7M — 133 new pages (the wholeagent-sdk/section,whats-new-*weeklies,worktrees,workflows,advisor,accessibility,zero-data-retention, …), 39 existing pages refreshed with changed content, 3 byte-identical, and 0 orphaned. Confirmed the collision pairs land separately:hooks.md(238K, "Hooks reference") andagent-sdk-hooks.md(49.8K) are distinct files with different checksums.Scope note
This PR changes only
update_docs.js— it does not include the regeneratedreferences/. That regeneration is a 133-new-file, ~6MB diff that would be unreviewable and conflict-prone, and it seems better folded into your release flow. Runningnode skills/working-with-claude-code/scripts/update_docs.jsafter merge produces it.Tested on macOS 15 (arm64), Node 26.5.0.