Skip to main content

Module spec

Module spec 

Source
Expand description

Spec parsing for ask.json library entries — Rust port of packages/cli/src/spec.ts.

The spec string is the user-facing identifier; the library name is the slug used for .ask/docs/<name>@<ver>/ and .claude/skills/<name>-docs/. Slug derivation:

  • npm:next → next
  • npm:@mastra/client-js → mastra-client-js (scoped flatten)
  • github:vercel/next.js → next.js

Enums§

ParsedSpec
A parsed ask.json spec string. Discriminated the same way as the TS ParsedSpec union.

Functions§

library_name_from_spec
The library slug for a spec (parse_spec(spec).name()).
parse_spec
Parse a spec string into its ecosystem-tagged form.
slugify_npm_name
@mastra/client-js → mastra-client-js. Scoped npm names are not valid as .ask/docs/<dir> or Claude Code skill dir names, so we flatten them the same way the registry server does. Non-scoped names pass through unchanged.
split_explicit_version
Split an inline @version suffix off a spec — port of splitExplicitVersion in commands/ensure-checkout.ts.