Summary
point add declares dependencies in point.json and regenerates point.lock with pinned paths. Project-wide check, build, and related commands resolve use <package>.<module> imports through the lockfile — no manual path wiring in every file.
Manifest and lockfile
Every Point project has a point.json manifest:
{
"name": "point",
"version": "0.0.5",
"dependencies": {
"std": "workspace:std"
}
}point.lock pins resolved packages with schemaVersion: "point.lock.v1":
{
"schemaVersion": "point.lock.v1",
"packages": {
"point": {
"version": "0.0.5",
"dependencies": {
"std": "workspace:std"
}
},
"std": {
"version": "workspace",
"path": "std"
}
}
}The lockfile is JSON on purpose — agents and CI can inspect and update it safely. Do not hand-edit paths unless you know what you are doing; prefer point add to keep manifest and lock in sync.
The add command
point add <name> <spec>| Argument | Meaning |
|---|---|
<name> | Local alias used in use imports (e.g. std, logic) — must be a valid identifier |
<spec> | Dependency locator: workspace:…, file:…, or npm:… |
The command updates point.json dependencies, resolves paths relative to the project root, and writes a fresh point.lock. On success it prints which files changed.
Invalid names, missing point.json, unknown spec prefixes, or paths that do not exist exit with code 1 and a clear error message.
Dependency specs
| Spec | Status | Meaning |
|---|---|---|
workspace:<path> | Supported | Local Point package directory — typical in monorepos |
file:<path> | Supported | Local path on disk, relative to project root |
npm:<package> | Supported | npm registry package — installs to node_modules/ and pins path in lock |
### workspace: — monorepo packages
Use when the dependency lives in the same repository or workspace layout:
point add std workspace:stdThe locator is a directory path (relative to the project root) that contains a point.json or .point modules. After resolution, point.lock stores the normalized relative path and version: "workspace".
In this repository, the root project depends on the shared std library this way:
"dependencies": {
"std": "workspace:std"
}Then use std.text resolves to std/text.point via the lockfile entry for std.
### file: — local packages on disk
Use for sibling directories, vendored packages, or paths outside a workspace convention:
point add logic file:packages/point-logicThe locator is any existing directory relative to the project root. Resolution pins version: "file" and the normalized path in point.lock. If the directory has its own point.json, nested package metadata is recorded under the nested package name.
### npm: — registry packages
Install published Point packages from any npm-compatible registry (public npm, GitHub Packages, or a private mirror). The CLI runs `bun add --no-save` (falls back to npm install --no-save), locates point.json or src/*.point in the package, and pins the path under node_modules/ in point.lock:
point add logic npm:@hatchingpoint/point-logic
point add logic npm:@hatchingpoint/point-logic@0.0.2Then use logic.store-readiness resolves through the lockfile.
Note: Packages that ship only emitted JavaScript in dist/ (no .point source in the tarball) cannot be typechecked via point add. Prefer packages that include Point source, or import emitted JS directly for runtime-only use.
#### Registry configuration
point add does not implement a separate Point registry protocol. It delegates to npm for download and path resolution. Configure the registry the same way you would for any scoped package:
| Registry | When to use | Project setup |
|---|---|---|
| registry.npmjs.org | Public open-source libraries (@hatchingpoint/*) | Default — no extra config |
| GitHub Packages | Org-private or repo-scoped packages | .npmrc + publishConfig.registry on the library |
| Private Verdaccio / Artifactory | Enterprise mirrors | .npmrc registry= URL |
GitHub Packages (consumer) — in the consuming project root, add .npmrc (commit for teams, or use CI secrets locally):
@your-org:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}Then install as usual:
export GITHUB_TOKEN=ghp_... # classic PAT with read:packages, or Actions GITHUB_TOKEN
point add logic npm:@your-org/point-logic
point check-allRegistry clients honor .npmrc, so point.lock pins the same node_modules/@your-org/point-logic path whether the tarball came from npmjs or GitHub.
GitHub Packages (publisher) — see npm packages — Publish workflow for package.json publishConfig and CI token setup.
Resolution at check and build
After dependencies are locked:
use <package>.<module>without afrompath resolves throughpoint.lock(e.g.use std.http→std/http.point).- Relative imports such as
use Module from "./module.point"still work alongside lockfile packages. check-all,build-all, and related project commands loadpoint.lockfrom the project root when building the module graph.
If a package name is missing from the lockfile, check/build report an error that includes the suggested point add command.
Publish → consume workflow
End-to-end flow for a Point library team:
Author .point → point check / point build → npm publish → point add npm: → use pkg.module| Step | Who | Command / artifact |
|---|---|---|
| 1. Author | Library maintainer | Edit src/*.point only; add point.json |
| 2. Verify | CI | point check, point build (and optional point build-py) |
| 3. Package | Maintainer | package.json "files" includes dist/, point.json, src/*.point |
| 4. Publish | Maintainer / CI | npm publish (public) or npm publish --registry https://npm.pkg.github.com |
| 5. Declare | App team | point add <alias> npm:@scope/pkg[@version] |
| 6. Import | App authors | use <alias>.<module> — resolved via point.lock |
Reference implementation: @hatchingpoint/point-logic in packages/point-logic/ (monorepo) — same layout works in a standalone repository.
Hosted package index: There is no first-party Point registry service yet. Discovery is via npm search, GitHub repo README, or an internal catalog you maintain manually. Installation still uses point add … npm:… against whichever npm registry hosts the tarball.
Examples
Monorepo std library (this repository):
point add std workspace:stdLocal logic package before publish:
point add logic file:packages/point-logicRegistry dependency (public npm):
point add logic npm:@hatchingpoint/point-logicRegistry dependency (GitHub Packages, after `.npmrc` is configured):
point add logic npm:@your-org/point-logic@1.0.0Common mistakes
- Using
npm:on packages that ship onlydist/JS — they won't resolve forpoint check; use packages with.pointsource orfile:for local copies. - Adding a dependency name that does not match how you
useit — the lockfile alias must match the prefix inuse std.text,use logic.store, etc. - Expecting
point addto install JavaScript npm deps forexternalblocks — those still belong inpackage.json;point addis for Point package modules only. - Editing
point.lockpaths by hand after moving directories — re-runpoint addor regenerate the lock from the manifest. - Publishing or consuming GitHub Packages without a scoped
.npmrc— npm defaults to registry.npmjs.org andpoint add npm:@your-org/...will 404. - Forgetting to include
src/*.pointandpoint.jsonin the published tarball — consumers cannotpoint checkagainst your package.
See also
- CLI reference —
addexit codes and project commands - npm packages —
@hatchingpoint/point, publishing, andexternalinterop - Authoring vs runtime — manifest vs emitted artifacts
