scmJS docs

Plugin typings

Plugin repositories compile against @scm-js/plugin-api, an npm package holding one generated index.d.ts bundled from src/plugins/api.ts.

npm run build:plugin-types      # → plugin-api/index.d.ts + package.json (gitignored)
npm run publish:plugin-types    # publish to npm and push to github.com/scm-js/plugin-api

The build refuses a bundle that still carries an import, since a file naming jotai or react is one a plugin repository cannot compile with alone. The version is the API's, not the editor's: the major is PLUGIN_API_VERSION, the minor moves when the declarations do, and a build that did not move the contract publishes nothing. The plugin-api job in the Build workflow runs it on every build; the git push needs the PLUGIN_API_PAT organisation secret (it reports rather than fails without it) and the npm publish is behind the PUBLISH_PLUGIN_API repository variable, authenticating by OIDC through npm's trusted publishing with --provenance. Setting that up is in scripts/publish-plugin-api.mjs and the job's comments. tests/plugin-api-package.test.ts pins the version rule and the no-imports rule.

The shared workflow each plugin repository calls, scm-js/.github's plugin-ci.yml, type-checks, tests, rebuilds and commits the plugin's dist/plugin.js on its main branch, and at a tag checks that the committed bundle is what the source builds to.