PlaybookGuidelines

Connect a project

How another Ziteox project installs and updates @ziteox/ui through Core’s npm proxy, and how to link a local Forge build for development.

Connect a project

What this is

How another Ziteox project consumes @ziteox/ui (and later other Forge packages). Forge stays the source. Consumer repos install a published version through Core’s npm registry proxy, or temporarily a packed local build while you develop.

Full proxy details: Install packages through Core.

Chosen approach

One approach only:

  • Versioned private @ziteox/ui on GitHub Packages (npm.pkg.github.com, scope @ziteox) — upstream storage.
  • Versions managed with Changesets.
  • Published only by the manual Release workflow (.github/workflows/release.yml), using the workflow’s GITHUB_TOKEN with packages: write.
  • Consumers install through Core (/npm/*) with a project token scoped packages:read. Env var: ZITEOX_CORE_NPM_TOKEN — never committed. Core holds the upstream Packages credential.
  • Version bumps in consumers via Dependabot (or Renovate) once Core/registry access is wired for that host.
  • Local dev: forge-connect link installs a packed tarball (file:), not a symlink. The consumer keeps a single copy of React/Next. Symlinked packages cause duplicate React / hook errors and need transpilePackages plus outside-root config.

Deprecated: putting a shared GITHUB_PACKAGES_TOKEN (classic PAT) in consumer .npmrc / host env. Prefer Core; see From package token to connector.

Why not the alternatives

ApproachWhy not
Git dependenciesNo real semver, slow installs, needs a build on install
npm public registryThe code is private
pnpm / npm link symlinks for daily useDuplicate React; Next/Turbopack outside-root issues
Copying source into the consumerDrift from Forge

Sources

Tokens per place

Production Core (https://core.ziteox.com) is not live yet. Local Core: http://localhost:8787. Mint tokens via admin POST /v1/admin/tokens with scopes: ["packages:read"] — see Install packages through Core.

PlaceWhat to use
Local MacZITEOX_CORE_NPM_TOKEN = zxcore_… with packages:read; .npmrc points at local or future Core /npm/
Vercel / Railway / other hostsSame env var at build time; registry host = Core (not npm.pkg.github.com)
GitHub Actions in a consumer repoStore the project token as a repo secret (ZITEOX_CORE_NPM_TOKEN); do not use a shared GitHub Packages PAT

Never commit a token. The .npmrc line uses ${ZITEOX_CORE_NPM_TOKEN}, not a literal value.

Using the helper

From Forge:

pnpm forge-connect --help

Or:

node <forge>/scripts/forge-connect.mjs [--cwd <dir>] <command> [options]

setup

pnpm forge-connect --cwd <consumer> setup [--version <range>] [--workspace <name>] [--dry-run] [--with-peers]

Merges .npmrc for the @ziteox scope, requires an install token, installs @ziteox/ui (default ^0.1.1), and reports peer gaps. Pass --with-peers to install missing peers.

Target .npmrc (Core) — production host not live yet; local example:

@ziteox:registry=http://localhost:8787/npm/
//localhost:8787/:_authToken=${ZITEOX_CORE_NPM_TOKEN}

Production shape when Core is live:

@ziteox:registry=https://core.ziteox.com/npm/
//core.ziteox.com/:_authToken=${ZITEOX_CORE_NPM_TOKEN}

Host-root _authToken covers both /npm/ packuments and /download tarballs. Do not set replace-registry-host=always — npm only rewrites lockfile hosts against the default registry, not a scoped @ziteox:registry (with always, @ziteox tarballs were rewritten to registry.npmjs.org → 404). Commit lockfile @ziteox resolved hosts as https://core.ziteox.com/download/... (path + integrity unchanged). Never commit localhost lockfile URLs — local Core overrides stay per-machine. Details: Install packages through Core.

forge-connect setup may still write the older GitHub Packages lines until the helper is updated — prefer the Core lines above (or npmrcFor from @ziteox/core-client). Existing unrelated .npmrc lines are kept. A literal auth token value (not ${…}) is an error.

Deprecated .npmrc (do not use for new hosts):

@ziteox:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGES_TOKEN}
pnpm forge-connect --cwd <consumer> link [--forge <path>] [--workspace <name>] [--no-build] [--gitignore]

Builds @ziteox/ui in the Forge checkout (unless --no-build), packs it into .forge-link/, installs the tarball as a file: dependency, then prefers a package.json path relative to the target package. Re-run to refresh. Unlink before committing.

link does not need ZITEOX_CORE_NPM_TOKEN (or the deprecated GITHUB_PACKAGES_TOKEN).

pnpm forge-connect --cwd <consumer> unlink [--workspace <name>]

Restores the original @ziteox/ui spec from .forge-link/state.json and removes .forge-link/. If the original was a registry range, unlink reinstalls from the registry and therefore needs the token (same exit 2 message if missing). If the original was absent, it uninstalls the package and does not need the token.

status

pnpm forge-connect --cwd <consumer> status [--workspace <name>]

Prints package manager, lock root, package.json path, @ziteox/ui spec and installed version, .npmrc status, and whether link mode is active.

  • Add .forge-link/ to .gitignore (or pass --gitignore on link).
  • Do not commit a linked file: spec or the tarball directory. Unlink before committing.

Peers

Exact peerDependencies from packages/ui/package.json (current Forge):

{
  "motion": "^12.0.0 || ^13.0.0 || ^14.0.0",
  "next-themes": "^0.4.0",
  "react": "^18.0.0 || ^19.0.0",
  "react-dom": "^18.0.0 || ^19.0.0",
  "web-haptics": "^0.0.6"
}

Current facts (B5)

  • Admin portal workspaces (ziteox-admin, ziteox-client, ziteox-auth) declare @ziteox/ui ^0.1.0. The lockfile resolves 0.1.1 from npm.pkg.github.com.
  • This Forge repo is at 0.1.2, not published yet.
  • The read token secret per host and the consumer CI setup do not exist yet (Laki / Clerk decision).

Per-project steps

Admin portal (portal)

npm workspaces: ziteox-admin, ziteox-client, ziteox-auth. Already has the root .npmrc for GitHub Packages.

# From Forge, once the read token is available:
pnpm forge-connect --cwd <portal> setup --workspace ziteox-admin --version ^0.1.2
pnpm forge-connect --cwd <portal> setup --workspace ziteox-client --version ^0.1.2
pnpm forge-connect --cwd <portal> setup --workspace ziteox-auth --version ^0.1.2

Bump each app to the published version when 0.1.2 (or later) is on the registry.

For local Forge work without publishing:

pnpm forge-connect --cwd <portal> link --forge <forge> --workspace ziteox-admin
# …repeat per workspace as needed; unlink before commit

Next: transpilePackages is not needed for the built dist package from the registry or a packed tarball. Add it only if the build complains.

MultiStrom (Projects/MultiStrom)

npm, Next 16, Payload. Uses motion ^14. Older @ziteox/ui 0.1.1 peers only motion ^12, which causes npm ERESOLVE. This branch widened the peer to ^12.0.0 || ^13.0.0 || ^14.0.0 (commit 1a9f9fc, tested against motion 14.9.0), so the first publish (0.1.2) installs cleanly.

MultiStrom has no next-themes / web-haptics in package.json. npm may auto-install peers; list them explicitly with setup:

pnpm forge-connect --cwd <MultiStrom> setup --version ^0.1.2 --with-peers

No .npmrc yet — setup writes it. For local Forge:

pnpm forge-connect --cwd <MultiStrom> link --forge <forge>
pnpm forge-connect --cwd <MultiStrom> unlink

laborbusser-web

pnpm 10. The helper detects pnpm. Keep existing .npmrc lines (for example only-built-dependencies); setup appends the @ziteox registry lines idempotently.

pnpm forge-connect --cwd <laborbusser-web> setup --version ^0.1.2 --with-peers

ziteox-website

Path and stack are not confirmed here — see Open questions. Generic steps once you know the lock root:

pnpm forge-connect --cwd <ziteox-website> setup --version ^0.1.2 --with-peers
# or link for local Forge work, then unlink before commit

Releasing a new version

For Laki, in this Forge repo:

  1. pnpm changeset — record the bump.
  2. Commit the changeset.
  3. Run the Release workflow manually in GitHub Actions (workflow_dispatch only — nothing runs on push).

Nothing has been published from this repo yet. The first release would publish 0.1.2. Needs Laki’s OK.

Installs go through Core (packages:read) — see Install packages through Core. Design history: From package token to connector.

Tested locally

Throwaway copies under /tmp/forge-proof (real repos untouched). Against this branch’s unpublished @ziteox/ui 0.1.2 built in a clean Forge copy. Link / negative checks did not need a registry token.

Admin portal copy (npm workspaces, Next 15.5.28):

  • Before linking, a page importing HamburgerButton with material="emboss" and @ziteox/ui/materials failed typecheck against installed 0.1.1 (no ./materials export, no material prop).
  • After forge-connect link --forge <clean copy> --workspace ziteox-admin: package.json spec file:../.forge-link/ziteox-ui-0.1.2.tgz, installed 0.1.2, tsc --noEmit exit 0, next build exit 0 with route /forge-proof.

MultiStrom copy (npm, Next 16.2.10, motion 14.9.0):

  • First link failed with ERESOLVE on the old motion ^12 peer.
  • After the peer widening, link exit 0, tsc --noEmit exit 0, next build exit 0 with route /forge-proof.
  • unlink restored the original state (no @ziteox/ui).

Without a registry token:

  • setup / unlink that reinstall from the registry exit 2 when the expected token env var is unset.
  • A direct npm view @ziteox/ui against GitHub Packages returns E401 with no auth; against Core /npm/ returns 401 token_invalid without a Bearer token.

Not proven yet against production Core: end-to-end install (Core URL not live). Local Core e2e covers packument/tarball proxy against a mock upstream.

link needs no token. Keep .forge-link/ gitignored and unlink before committing.