Explained npm search behavior and limitations.
UnderstandDemonstrated npm registry API keyword search.
BuildAgreed on unique keyword for packages.
PlanUpdated documentation with keyword usage.
EditConfirmed keyword presence and indexing.
Verifycan we search the npm registry for keywords specified in package.json of packages? i have a few packages published that have the keyword "pi" in them. can you try to search and tell me how that works and what packages come up?
Let me check the package.json files to see the keywords and then search the npm registry.
>find packages -name "package.json" -maxdepth 2 | xargs grep -l "keywords" | head -5>npm search pi --json 2>/dev/null | head -100Now let me check the keywords in your package.json files and search more specifically:
>for pkg in packages/*/package.json; do echo "=== $pkg ==="; jq -r '.name, .keywords' "$pkg" 2>/dev/null; done>npm search @mariozechner --json 2>/dev/nullHere's how npm registry search works and what packages come up:
The npm search <term> command searches the npm registry by:
keywords array in package.jsonYou can use npm search --json to get structured output.
From the search, these pi-mono packages are published:
| Package | Keywords |
|---|---|
@mariozechner/pi-ai | ai, llm, openai, anthropic, gemini, bedrock, unified, api |
@mariozechner/pi-agent-core | ai, agent, llm, transport, state-management |
@mariozechner/pi-coding-agent | coding-agent, ai, llm, cli, tui, agent |
@mariozechner/pi-mom | slack, bot, ai, agent |
@mariozechner/pi | llm, vllm, gpu, ai, cli |
@mariozechner/pi-tui | tui, terminal, ui, text-editor, differential-rendering, typescript, cli |
@mariozechner/pi-web-ui | ai, chat, ui, components, llm, web-components, mini-lit |
Also found: @mariozechner/clipboard (and its platform-specific binaries), @mariozechner/mini-lit, @mariozechner/jiti, @mariozechner/claude-trace.
Interestingly, searching for just "pi" returns mostly unrelated packages (math pi, Raspberry Pi GPIO libraries, etc.) because "pi" is a common term. The @mariozechner scope makes your packages more discoverable by searching the scope directly.
There's also @justram/pie which depends on @mariozechner/pi-ai.
so we can't search just by keywords?
You're right, npm search doesn't have a keywords-only filter. It searches across name, description, and keywords together.
There's no official npm CLI flag like --keywords-only. However, you can use the npm registry API directly:
>curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:coding-agent" | jq '.objects[].package | {name, keywords}'Yes! You can search by keywords using the registry API directly:
curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:<keyword>"The syntax is keywords:<keyword> in the search text. You can also combine multiple:
keywords:ai+keywords:cli (AND)keywords:ai,cli (either keyword)For example, searching keywords:coding-agent returns 109 packages, including:
@mariozechner/pi-coding-agent@mariozechner/coding-agent (older name?)@oh-my-pi/pi-coding-agent, @cargo-cult/pi-coding-agent, @vaclav-synacek/pi-coding-agent-termuxpi-mcp-adapter, pi-powerline-footer, pi-package-testThe npm CLI doesn't expose this directly, but you could wrap it in a simple script if you use it often.
ok, i think we should ensure that we have a unique keyword we can search for, how about pi-package?
Good idea. Let me check what's currently using that keyword and then update your packages:
>curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:pi-package" | jq '.objects[].package | {name, keywords}'pi-package is available, nobody's using it. Should I add it to the keywords array in all your package.json files?
no, add it to ../pi-doom/ ../pi-package-test/ and ../pi-gitlab-duo/
>cat ../pi-doom/package.json ../pi-package-test/package.json ../pi-gitlab-duo/package.json 2>/dev/null | jq -s '.[].keywords'then publish new versions of these
Now let me bump versions and publish:
>cd ../pi-doom && npm publish --access public 2>&1>cd ../pi-package-test && npm publish --access public 2>&1>cd ../pi-gitlab-duo && npm publish --access public 2>&1Done. Published:
pi-doom@0.1.1pi-package-test@0.1.6pi-gitlab-duo@0.1.4All three now have the pi-package keyword. You can verify with:
curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:pi-package" | jq '.objects[].package.name'(It may take a few minutes for the npm registry to index the new versions.)
ok, we should document this keyword in @packages/coding-agent/docs/extensions.md @packages/coding-agent/README.md and any other .md file that talks about pi packages.
Let me find all relevant documentation files:
>rg -l "pi package|npm.*publish|package\.json.*pi|pi\.extensions|pi\.skills|pi\.themes" packages/coding-agent --type mdLet me check if there are other relevant docs:
>rg -l "package\.json|pi\.extensions|pi\.skills|npm.*publish|pi install|pi list" packages/coding-agent/docs --type mdNow I'll add the pi-package keyword documentation to both files. The best places are:
extensions.md - in the "Bundling other pi packages" sectionREADME.md - in the "Extensions" section under CustomizationNow I have the full picture. Let me add the pi-package keyword documentation:
Now let me run the check to make sure everything is good:
>cd packages/coding-agent && npm run check 2>&1>npm run check 2>&1All checks pass. Here's a summary of the changes:
Updated files:
packages/coding-agent/docs/extensions.md - Added a "Discoverability" note in the "Bundling other pi packages" section explaining the pi-package keyword and how to search for packagespackages/coding-agent/README.md - Added a "Discoverability" section in the Extensions area with the npm search commandPublished packages with pi-package keyword:
pi-doom@0.1.1pi-package-test@0.1.6pi-gitlab-duo@0.1.4search
>curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:pi-package" | jq '.objects[].package.name'No results yet. The npm registry takes a few minutes to index new package versions. Let me check if the packages themselves have the keyword:
>curl -s "https://registry.npmjs.org/pi-doom/0.1.1" | jq '.keywords'The keyword is there. The search index just needs time to update (usually 5-15 minutes).
ok commit an dpush the changes in the working dir
>git status>git add packages/coding-agent/README.md packages/coding-agent/docs/extensions.md && git commit -m "docs(coding-agent): document pi-package keyword for npm discoverability" && git pushDone. Committed and pushed the documentation changes for the pi-package keyword.
curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:<keyword>"curl -s "https://registry.npmjs.org/-/v1/search?text=keywords:pi-package" | jq '.objects[].package.name'