Install SWARQ
This guide is for a first-time setup of the SWARQ repository on a development machine. It takes about ten minutes. When you finish, the build, tests, and checks pass and the swarq CLI runs from the repository.
To create a board in a different project, see Set up a new workspace after this guide.
1. Prerequisites
| Tool | Version | Why |
|---|---|---|
| Node.js | 22 or later (.nvmrc pins 22) |
engines in the root package.json |
| pnpm | 10.28.0 (pinned by packageManager) |
Lockfile and workspace |
| git | any recent version | Hooks and branch rules |
| Docker | optional | Only for pnpm gate, the release gate |
Install pnpm through Corepack, which reads the pin in package.json:
nvm use # reads .nvmrc, if you use nvmcorepack enablenode --version # v22.xpnpm --version # 10.28.0Do not install pnpm globally with a different version.
2. Clone and install
git clone https://github.com/Fused-Gaming/swarq.gitcd swarqgit switch main # or the feature branch you were assignedpnpm install --frozen-lockfileAlways use --frozen-lockfile. It installs exactly what pnpm-lock.yaml records. Do not edit the lockfile by hand. If a dependency change is needed, see CLAUDE.md.
3. Build, typecheck, and test
pnpm buildpnpm typecheckpnpm testTurbo runs each script in every package, and each run ends with a summary line such as Tasks: 12 successful, 12 total. If a task fails, read its output before you change anything. Do not skip a task to get past it.
4. Run the repository checks
pnpm check:publishable # public packages do not depend on private onespnpm check:plugins # plugin manifests match their package versionspnpm test:session-hook # the Claude Code SessionStart hookpnpm check:secrets # no credential-shaped strings are trackedpnpm check:changelog # the root CHANGELOG.md matches the release contractAll five must pass before you open a pull request.
5. Run the CLI
The CLI is swarq, built from packages/cli. Until the package is installed on your PATH, run it from the build output:
node packages/cli/dist/bin.js helpnode packages/cli/dist/bin.js board showInside the repository, the package.json scripts call the same build (for example pnpm check:secrets). When @h4shed/swarq is installed as a dependency of a project, npx --no-install swarq also works, and the pre-commit hook uses that form.
6. Enable the pre-commit gate
The hook in .githooks/pre-commit blocks a commit that stages a token or a private key. Git needs to be told to use it, once per clone:
git config core.hooksPath .githooksCheck it:
git config --get core.hooksPath # prints .githooks7. Set up the GitHub token (optional, needed for sync)
Only swarq github sync, swarq github checkin, and swarq review pr-link --apply call GitHub. You do not need a token to build or test.
- Create a fine-grained personal access token scoped to
Fused-Gaming/swarq. - Store it as an environment variable named
SWARQ_PAT. SWARQ also readsGITHUB_TOKENorGH_TOKENwhenSWARQ_PATis unset, and uses the first one that is set. In a cloud session,GITHUB_TOKENandGH_TOKENcan hold a placeholder that only works through the session’s proxy, so setSWARQ_PAT. In a cloud session, add it as an environment secret. Locally, export it in your shell session or a secrets manager. - Never write the token into a file, a commit, or a chat message. The
.gitignorerules and the pre-commit hook catch some mistakes, but they are not a substitute for care.
Check that the token is read, using a dry run. A dry run changes nothing on GitHub:
node packages/cli/dist/bin.js github sync --repo Fused-Gaming/swarqWithout --apply, the command only prints the plan. Read it before you add --apply.
8. Optional: the release gate
pnpm gate builds the Docker image and runs the checks in Release gate test plan. It needs a running Docker daemon. pnpm gate --skip-docker runs the host checks only, and it is not a release gate.
9. Work on a change
- Work on a feature branch. Do not push to
main. - Record a release-worthy change with
pnpm changeset. The changeset check in CI fails without one. See Versioning and release policy. - Add an entry under
[Unreleased]inCHANGELOG.md, then runpnpm check:changelog. See Changelog contract. - Commit messages describe the change in the imperative.
- Before you open a pull request, run
pnpm build && pnpm typecheck && pnpm testagain.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
pnpm: command not found or a different pnpm version |
Corepack is not enabled, or an old global pnpm is first on PATH | corepack enable, then open a new shell |
ERR_PNPM_OUTDATED_LOCKFILE on install |
The lockfile does not match package.json |
Pull the latest branch. Do not regenerate the lockfile to get past it |
Cannot find module '@h4shed/swarq-…' when running the CLI |
A package was not built | Run pnpm build from the repository root |
--apply needs SWARQ_PAT (or GITHUB_TOKEN or GH_TOKEN) in the environment |
The token is not set in this shell | Set SWARQ_PAT (step 7), then rerun |
GitHub API 401 |
The token variable holds an unusable value, for example a placeholder in GITHUB_TOKEN |
Set SWARQ_PAT, which is read first |
swarq github: no board at .swarq/board.json |
You are running from the wrong directory | Run from the repository root, or pass --board <dir> |
Commit blocked by check-secrets |
A staged line looks like a token or key | Remove the value, rotate it if it was real, and commit again. The output shows the file, line, and pattern, never the value |