ADR-024: npm Scoped and Versioned Package Specs

Status

Accepted

Related: ADR-022 (per-manager validator precedent); tracked in issue #259.

Date

2026-11-15

Context

Stamp validated nearly every package name with one strict allowlist (^[a-zA-Z0-9_][a-zA-Z0-9_\-\.\+]*$). npm’s native grammar was rejected:

> stamp info -m npm @fission-ai/openspec@latest
Error: invalid package name: invalid package name "@fission-ai/openspec@latest": contains invalid characters

Three defects compounded:

npm accepts [<@scope>/]<pkg> with an optional @<tag>, @<version>, or @<version range>. npm ls -g --depth=0 already reports scoped names without versions, so ListInstalled and reconcile were never the problem.

Decision

Support npm’s package-spec grammar through a per-manager validator.

Alternatives Considered

Keep the generic validator and require -m npm help text

Rejected: the native syntax is documented by npm and used by real packages; rejecting it makes stamp unable to reach them.

Reject version specs, telling users to pin with npm directly

Rejected: npm accepts them, and pass-through costs nothing. The manifest normalization keeps matching intact.

Store the full spec (pkg@1.2.3) in the manifest

Rejected: ListInstalled reports unversioned names, so a versioned manifest entry would never match — the package would look missing and could not be removed by name.

Accept a bare scope/name by inserting the @ implicitly

Rejected: silently rewriting user input hides a typo. A hint is actionable and keeps npm’s grammar as the contract.

Validate without --manager by accepting if any manager’s validator accepts

Rejected: it runs every validator to reach the same decision the adapters make, and still needs a rule for names no validator accepts. Skipping pre-validation is simpler.

Consequences