Skip to content

fix(check): judge docs and links by what the package ships - #58

Merged
tenphi merged 1 commit into
mainfrom
claude/serene-maxwell-x9jzo5
Nov 21, 2026
Merged

tenphi merged 1 commit into
mainfrom
claude/serene-maxwell-x9jzo5

Conversation

@tenphi

@tenphi tenphi commented Nov 21, 2026

Copy link
Copy Markdown
Owner

In short

  • harnesspm check now judges docs and links by what the package ships: it reads files in package.json as npm does. Before, it asked git and the disk.
  • So it checks docs built at prepack (git ignores them, npm packs them), reports links to files that don't ship, and checks links in .mdx pages.
  • The private-key warning needs a key body, so a PEM header used as a placeholder no longer triggers it.
  • The new check found 29 dead links in harnesspm's own published spec. They now lead to GitHub.

Closes #52. Closes #53.

What changed

Before After
Docs pages check reads Files git keeps in the docs folder Files files packs in the docs folder, git-ignored or not
A link to an existing file files leaves out Passes ❌ points at a file the package does not ship
Links in .mdx pages Not checked Checked
-----BEGIN PRIVATE KEY----- alone ⚠️ looks like a private key No warning. A header with a key body still warns.

How files is read (packs() in src/check.ts): a listed path, a folder and everything in it, or a glob with *, ** and ?, less ! entries, plus what npm always packs (package.json, README, license, main, bin). Without files, or with a pattern it doesn't read (braces, character classes), check behaves as before. So it never reports a false "does not ship".

Why not ask npm

The first version asked npm pack --dry-run --json --ignore-scripts. npm 10.9.9 still runs the package's prepare script with --ignore-scripts (it skips only prepack). For @cube-dev/ui-kit, whose prepare is husky install && harnesspm sync, one listing took 4.8 s and ran a sync. A prepare that ran check would loop. So check reads files itself, takes 0.14 s there, and runs nothing. Recorded in docs/research/package-managers.md.

Spec

  • 2.7 rule 5: the gitignore rule stays for the index and the lock. check reads the docs as the tarball has them.
  • 2.10: how check reads files, and why it never runs npm.
  • The spec's 29 links into docs/research/, which isn't in files, now point to GitHub, as the site's pages already do.

Where this came from

cube-js/cube-ui-kit#1697 builds UI Kit's docs into docs/ at prepack, next to its tracked docs/rules/. Its prepack runs harnesspm check, which read only docs/rules/, so it had to check the extracted tarball in a test instead.

Verification

  • npm run typecheck, npm test (121 tests, 3 new), npm run check (harness + sync --check).
  • New check on real harnesses: Glaze (its .mdx docs), Tasty, eslint-plugin-tasty, harnesspm itself and UI Kit (repo and packed) all pass.
  • In UI Kit's repo with the docs built, a dead link planted in docs/components/actions/Button.md is reported. Without built docs (its CI lint job), check passes. On the packed UI Kit, the PasswordInput placeholder no longer warns.
  • The reproduction from check: docs built at prepack go unchecked, and links to files the tarball leaves out pass #52 now fails on each case.

Generated by Claude Code

check took the docs pages from git and tested links against the disk. So
docs built at prepack, which git ignores but npm packs, went unchecked,
and a link to a file the package does not ship passed. check now reads
`files` in package.json as npm does (paths, folders, globs, ! entries and
the files npm always packs) and links in .mdx pages are checked too. It
never runs npm: npm pack --dry-run runs prepare even with --ignore-scripts.

The private-key warning now needs a key body, so a PEM header used as a
placeholder in docs no longer triggers it.

The new check found 29 spec links into docs/research/, which does not
ship. They now lead to GitHub.

Closes #52
Closes #53

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
@github-actions

Copy link
Copy Markdown
Contributor

📦 Snapshot release

Published 0.0.0-snapshot.2e307b9.

npx @tenphi/[email protected] --help
npm install -D @tenphi/[email protected]

@tenphi
tenphi merged commit 70951e3 into main Nov 21, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 21, 2026

This branch was previously deployed

1 inactive deployment
release — 3fa61450 Deployed Nov 21, 2026 by tenphi via Snapshot release #86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants