Repository navigation
fix(bins): every npx bin was a silent no-op + add Astro integration (0.5.0) - #29
Merged
Merged
Conversation
…gration (0.5.0) The CLI guard compared import.meta.url against the basename of process.argv[1]. npm installs bins as node_modules/.bin symlinks, so argv[1] is the link (astro-seo-llms) while import.meta.url is the real file (llms-txt.mjs) — the comparison never matched, so every bin and `npm run` build hook exited 0 and generated nothing. Resolve argv[1] with realpathSync + pathToFileURL instead, and cover it with a regression test that executes a bin through a symlink, the way npm does. Integration: - astro-seo-toolkit/integration writes llms.txt, llms-full.txt, sitemap.xml and robots.txt during astro:build:done, from one or more content dirs (deduped by URL). Exposes generate/writeFiles/normalizeOptions. - new bins: astro-seo-toolkit (every file at once), astro-seo-check. - usage hints print the npx form. Repo: - scripts/sync-skill.mjs generates the skill's vendored copies and restores the executable bit; `npm run check:skill` fails on drift. - README: who-it's-for, the integration section, a comparison table. Documents that npm 12 blocks `github:` specs (allow-git=none), so the old `npx -y github:RelayStack/...` snippet is replaced with a clone that actually runs. - CHANGELOG/CITATION 0.5.0, CODE_OF_CONDUCT, CONTRIBUTING bin rule, SKILL.md integration flow, examples/astro on the integration, social card redesigned and exported to PNG. tests: 33 (was 27)
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.
The bug this fixes
Every bin in the published package was a silent no-op.
npm installs bins as
node_modules/.bin/*symlinks. When npm (ornpx, ornpm run) executes one,process.argv[1]is the link (astro-seo-llms) whileimport.meta.urlis the real file (llms-txt.mjs). The comparison is therefore alwaysfalse, the CLI block never runs, and the process exits0having written nothing.Reproduced on 0.4.0:
That means the README's advertised paths —
npx astro-seo-llms …, build-script hooks, thegithub:shorthand — all did nothing for anyone who tried them. Fixed by resolving the path:Covered by a new test (
bins run when invoked through a .bin-style symlink) that executes a bin through a symlink exactly as npm does.What else is here
astro-seo-toolkit/integration— a real Astro integration. Writesllms.txt,llms-full.txt,sitemap.xml,robots.txtduringastro:build:done, from one or more content dirs (deduped by URL). Exportsgenerate/writeFiles/normalizeOptionsfor build scripts.astro-seo-toolkit(all files at once) andastro-seo-check.npx astro-seo-*form instead ofnode <file>.mjs.scripts/sync-skill.mjsgenerates the skill's vendored copies and restores the executable bit;npm run check:skillfails on drift.allow-git=none, sonpx -y github:RelayStack/astro-seo-toolkit …errors out (EALLOWGIT), and even with--allow-git=allthe bin isn't exposed. Replaced with agit clonesnippet that works.CODE_OF_CONDUCT.md, CHANGELOG/CITATION 0.5.0,examples/astroon the integration, social card redesigned (docs/social-preview.png).Verification
Held back
.github/workflows/test.yml(adds thecheck:skillstep and a packaging smoke test that installs the tarball and invokes each bin) and a new.github/workflows/release.ymlare not in this PR: the token used to push lacks theworkflowscope, so GitHub rejects them. Rungh auth refresh -h github.com -s workflowand they can go in a follow-up.Follow-up (not in this PR)
Publish
0.5.0to npm sonpx astro-seo-toolkitresolves from the registry. Requiresnpm login.