This is a pnpm monorepo for public, installable Roam developer-extension artifacts whose source remains private.
- Always create a workspace with
pnpm create:prototype -- --name <kebab-case> --title "<title>" --description "<public description>". - Pass
--spec <file>when a specification is provided. ReadSPEC.mdcompletely before implementation. - Use
--adopt-existingonly for a placeholder containingREADME.mdand optionalSPEC.md. Preserve those documents. - Do not copy the template by hand or create a branch/repository per prototype.
- Keep prototype code inside
prototypes/<slug>and shared convention material insidepackages/extension-base. - Import
roamjs-componentsdirectly.packages/extension-baseis build tooling, configuration, and a template, not a browser runtime API. - With this repository's ESM build, never default-import a published CommonJS subpath from
roamjs-components. Import named exports from package barrels instead, such asimport { addStyle } from "roamjs-components/dom". - Support both documented loading modes: Roam's developer-extension URL loader and the
roam/jsESM loader. Treatargs.extensionAPIas optional and provide a fallback or clearly gate features that require it;window.roamAlphaAPIremains available in both modes. - Read the relevant guidance under
packages/extension-base/skillsbefore using Roam graph writes, commands, navigation, or React rendering. - For new graph reads, prefer
await window.roamAlphaAPI.data.async.*. Never use legacy top-level aliases such asroamAlphaAPI.q,roamAlphaAPI.pull, orroamAlphaAPI.createBlock. - Keep
runExtensionas the lifecycle wrapper. Dispose observers, listeners, commands, timers, and mounted UI when the extension unloads. - Never edit generated
distfiles. Build them with pnpm and the shared esbuild CLI. - Keep all browser code and public documentation secret-free. Only
process.env.NODE_ENVandprocess.env.VERSIONare allowed.
Run pnpm test, pnpm build, and pnpm prepare:artifacts. Only extension.js, README.md, optional extension.css, and optional CHANGELOG.md may be published.