Bootstrap Metric Insights Linear CLI setup files for both Cursor and Claude.
Shared (every run): LINEAR_CLI.md, AGENTS.md, .dev-environment.md,
.assistant-setup/page-workflow-context.md, .assistant-setup/SETUP_STATUS.md,
.assistant-setup/ca-ai-tools-setup.json
Cursor rules (Cursor and/or Claude): .cursor/rules/*.mdc — Claude Code follows the same rules. Emitted for Claude-only runs too.
| Path | When |
|---|---|
setup-cursor-assistant.md |
Cursor selected |
.cursorrules, .cursorignore |
Cursor selected |
.cursor/rules/* (assistant-setup-health, code-style, linear-cli, linear-task-gates, portal-env-credentials, test-case-rules, test-suite-template, README; figma-mcp.mdc if Figma MCP) |
Cursor and/or Claude |
.cursor/skills/* (ai-development + DOD-FULL, testing-flow, testing-with-linear, ui-check-simple, linear-report, linear-workflow, test-documentation, playwright-mcp, figma-implementation, form-builder; figma-code-connect + references if Figma MCP) |
Cursor selected |
.cursor/prompts/react-component-unit.md |
Cursor selected |
.cursor/mcp.json, .cursor/ca-ai-tools-setup.json |
Cursor + MCP option |
setup-claude-assistant.md, CLAUDE.md, .claude/settings.json |
Claude selected |
.claude/skills/* (same skill set as Cursor, under .claude/skills/) |
Claude selected |
.claude/agents/code-style.md |
Claude selected |
.claude/agents/figma-mcp.md |
Claude + Figma MCP |
.mcp.json (repo root) |
Claude + MCP option |
Skip/--force behavior: setup assistant markdown is always refreshed; most other paths are created once, then skipped unless --force (see package docs below).
The .mdc / .md rule and agent content under templates/ is not written from scratch — it is kept in sync with real Metric Insights repos that use this bootstrapper day to day (for example mi-pp/AI-Test-App). Teams refine a rule while doing actual work in a bootstrapped repo (tighten a convention, add a new rule/agent file, fix a cross-reference); those refinements get ported back here so the next bootstrap ships them.
When auditing templates/ for drift against a reference repo:
- Diff this repo's
templates/tree against the reference repo's generated.claude//.cursor/files. - For anything that exists downstream but not here, check the commit that introduced it in the reference repo — a new rule usually lands together with cross-reference updates in
code-style.*,AGENTS.md,CLAUDE.md, and.cursor/rules/README.md; port those alongside it. - Don't assume staleness only runs one direction: a reference repo can also fall behind this tool's structural additions (new skills/workflows) if it wasn't re-bootstrapped with
--force. Treat each file independently rather than blanket-copying either direction.
This public repository ships a prebuilt npm tarball as a GitHub Release asset named
ca-ai-tools-setup.tgz. A release tag such as v0.1.0 must match package.json; release CI validates
the source, smoke-tests the packed artifact, verifies the tag commit is on main, and attaches the tarball
to the GitHub Release. Prerelease versions (1.2.3-rc.1) create a GitHub prerelease.
No GitHub Packages registry or package token is required. Developers install the CLI directly from the public release asset:
# Latest stable release
https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz
# Exact version (preferred for reviewable setup/update PRs)
https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.1.0/ca-ai-tools-setup.tgzThe package-release GitHub environment should require an internal reviewer before the release job can publish.
To release, merge a reviewed version bump, create and push the matching vX.Y.Z tag, then approve the protected
job. Roll back a target repository by running check and update with the previous release tarball and reviewing
the reverse diff.
The tarball contains prebuilt dist/** plus templates/**; developer machines do not compile TypeScript
during installation.
Binary name: ca-ai-tools-setup. Below, TARGET is another repo path; omit --target to use the
current directory.
Set a package URL once, then reuse it with npx or pnpm:
export CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz
# or pin a version:
# export CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.1.0/ca-ai-tools-setup.tgznpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup
pnpm --package="$CA_AI_TOOLS_SETUP_TGZ" exec ca-ai-tools-setup- pnpm:
pnpm execruns thebinfrom the temporary--packageinstall; add--beforeca-ai-tools-setuponly if your shell swallows flags meant for the CLI. - Yarn / Bun: prefer
npxorpnpmfor HTTPS tarball one-shots.
The export VAR=... / "$VAR" syntax used throughout this README is Bash. On Windows, set and reference the
variable using your shell's own syntax instead:
PowerShell:
$env:CA_AI_TOOLS_SETUP_TGZ = "https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz"
# or pin a version:
# $env:CA_AI_TOOLS_SETUP_TGZ = "https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.1.0/ca-ai-tools-setup.tgz"
npx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup
pnpm --package="$env:CA_AI_TOOLS_SETUP_TGZ" exec ca-ai-tools-setupcmd.exe:
set CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz
npx --yes --package="%CA_AI_TOOLS_SETUP_TGZ%" ca-ai-tools-setup
pnpm --package="%CA_AI_TOOLS_SETUP_TGZ%" exec ca-ai-tools-setupEvery Bash example below that uses export VAR=... / "$VAR" has a PowerShell equivalent shown right after it,
using the $env:CA_AI_TOOLS_SETUP_TGZ form above.
Git Bash / WSL on Windows can use the original Bash examples unchanged.
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setupnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setupnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-appnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-appSelects both assistants, Playwright MCP on, Figma MCP off, QA AI rules off. Emits
.cursor/mcp.json / .mcp.json when MCP is enabled for the selected assistants.
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yesnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yespnpm --package="$CA_AI_TOOLS_SETUP_TGZ" exec ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yespnpm --package="$env:CA_AI_TOOLS_SETUP_TGZ" exec ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yesNo files written; QA AI rules init is not executed.
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yes --dry-runnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yes --dry-runnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor --yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor --yesnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants claude --yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants claude --yesDisable Playwright MCP (no .cursor/mcp.json / .mcp.json from this run unless Figma is on):
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --mcp-playwright nonenpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --mcp-playwright noneEnable both Playwright and Figma MCP (requires FIGMA_API_KEY where Figma is used):
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --mcp-playwright yes --mcp-figma yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --mcp-playwright yes --mcp-figma yesAfter generating files, runs init for the package using the detected runner (pnpm dlx, yarn dlx,
bunx, or npx) with --cursor / --claude aligned to --assistants. Needs package.json
in the target repo.
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --qa-ai-rules yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --assistants cursor,claude --yes --qa-ai-rules yesnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor --yes --qa-ai-rules yesnpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor --yes --qa-ai-rules yesnpx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yes --forcenpx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup --target ../my-app --assistants cursor,claude --yes --forceFrom this repository after npm install && npm run build:
node dist/cli.js --target ../my-app --assistants cursor,claude --dry-runAll generated Cursor and Claude files are intended to be committed. Any authenticated developer may prepare the initial setup or an update; after the PR merges, everyone else receives the files through a normal pull. The installer is not added to the application package or lockfile.
Use an exact release tarball, inspect the complete generated diff, run the target repository's validation, and open a setup PR:
export CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.1.0/ca-ai-tools-setup.tgz
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup \
--target ../my-app --assistants cursor,claude --yes$env:CA_AI_TOOLS_SETUP_TGZ = "https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.1.0/ca-ai-tools-setup.tgz"
npx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup `
--target ../my-app --assistants cursor,claude --yescheck is read-only. It returns exit code 0 when the tracked setup is synchronized, 2 when files or metadata
need attention, and 1 for invalid input or I/O failures. Use the latest release asset here — the point of
check is to see whether a newer release exists at all, so pinning to a specific tag defeats the purpose (that
tag may be older than what's tracked, or not exist yet):
export CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup check ../my-app$env:CA_AI_TOOLS_SETUP_TGZ = "https://github.com/mi-examples/ca-ai-tools-setup/releases/latest/download/ca-ai-tools-setup.tgz"
npx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup check ../my-appRun a preview, apply the update, review git diff, resolve any reported protected-file conflicts, validate the
target repository, and open a normal PR. update --dry-run also exits 2 when changes or conflicts are pending.
Once check tells you which release is newer, pin update to that exact tag (not latest) so the PR stays
reproducible and reviewable:
export CA_AI_TOOLS_SETUP_TGZ=https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.2.0/ca-ai-tools-setup.tgz
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup update ../my-app --dry-run
npx --yes --package="$CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup update ../my-app$env:CA_AI_TOOLS_SETUP_TGZ = "https://github.com/mi-examples/ca-ai-tools-setup/releases/download/v0.2.0/ca-ai-tools-setup.tgz"
npx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup update ../my-app --dry-run
npx --yes --package="$env:CA_AI_TOOLS_SETUP_TGZ" ca-ai-tools-setup update ../my-appUpdate ownership rules:
- Managed rules, skills, workflows, prompts, agents, and shared references update automatically only when their current hash matches the recorded generated baseline.
- Repository-owned files such as
.cursorrules,CLAUDE.md,.dev-environment.md, and page context are preserved and recorded as adopted content. - MCP JSON and Claude settings use semantic merge only when their baseline is unchanged.
- Existing
AGENTS.mdcontent is never replaced, including with--force; missing generated agent rows are merged into its registry table or appended as a separate generated section. - Locally modified managed/structured files block the entire update so a partial write cannot occur. Use
--forceonly when replacing those generated baselines is intentional. - Unchanged managed files removed by a release are deleted; modified or protected orphaned files are preserved and reported.
The metadata file records package version, release commit/template revision, and per-file SHA-256 hashes with line endings normalized for Windows/macOS/Linux checkouts. It contains no timestamp, so identical content produces identical tracked output.
.assistant-setup/SETUP_STATUS.md is the agent-facing marker. Its absence means setup is missing or incomplete;
its embedded package version identifies what generated the repository. The always-on
.cursor/rules/assistant-setup-health.mdc rule tells Cursor and Claude to run the read-only check command when
freshness matters and to request approval before any update.
check [target]: inspect a tracked setup without writing; exits2when an update or migration is requiredupdate [target]: apply a deterministic tracked-file update using the configuration stored in setup metadata--version/-v: print the installed CLI package version--target <path>: target repo directory (resolved from the current working directory; omit or press Enter in the prompt to use the current directory)--assistants <list>: comma-separated assistants, e.g.cursor,claude--dry-run: preview generation or update changes without writing; forupdate, exits2when changes or conflicts are pending--force: overwrite generated managed/structured baselines; protected files remain preserved inupdatemode--yes/-y: non-interactive defaults (existingsetup-cursor-assistant.md/setup-claude-assistant.mdare always replaced; existing.cursor/mcp.json/.mcp.jsonare left unchanged unless you pass--force)--mcp-playwright <yes|no>: add or skip Playwright MCP files for the assistants you selected (yes/true/1/cursor/onvsnone/no/false/0/off). Cursor →.cursor/mcp.json; Claude →.mcp.jsonat repo root. With--yesand no flag, defaults to yes--mcp-figma <yes|no>: add or skip Figma MCP files for the assistants you selected (yes/true/1/figma/onvsnone/no/false/0/off). Cursor →.cursor/mcp.json; Claude →.mcp.jsonat repo root. With--yesand no flag, defaults to no (requiresFIGMA_API_KEY)--qa-ai-rules <yes|no>: after generating files, run@metricinsights/qa-ai-rulessetup in the target repo (yes/true/1/onvsnone/no/false/0/off). Uses--cursor/--claudeflags aligned with--assistants. The CLI picks a one-shot runner frompackage.jsonpackageManager(Corepack) and lockfiles:pnpm dlxwhen pnpm,yarn dlxfor Yarn 2+ / Berry layout,bunxwhen Bun, otherwisenpx. Skipped when--dry-runis set. If there is nopackage.jsonin the target, the CLI skips with a warning (you can runnpx/pnpm dlx/yarn dlx/bunxmanually). With--yesand no flag, defaults to no
The generator creates .assistant-setup/page-workflow-context.md as a lightweight working document for page-focused tasks.
Use it to capture:
- Key routes/page entry points
- Primary user flows
- Preconditions (auth, env, feature flags, seed data)
- Expected stable UI markers and known caveats
The file is template-first by design and should be updated per repository.
Use Metric Insights API docs as a baseline reference: API Access.
Important:
- Documentation coverage is helpful but not always complete for every environment.
- Request/response shapes and validation rules may differ by instance version.
- Validate assumptions against the target instance (token + representative API checks) and record confirmed differences in
.dev-environment.md(under API compatibility notes).
npm install
npm testnpm install installs development dependencies without producing dist/. Run npm run build for a local CLI.
prepack builds the release artifact and records release provenance. Use npm run typecheck for
tsc --noEmit over src/ and tests/.
- Interactive MCP conflicts: If any MCP server is enabled and
.cursor/mcp.jsonor.mcp.jsonalready exists, the CLI asks per file: Skip (keep as-is), Merge (union ofmcpServers; generated server names override duplicates), or Overwrite (replace with the template).--dry-runand--yesskip these prompts;--forceoverwrites every generated path without merging. - Legacy metadata migration: old files
.cursor/linear-cli-setup.jsonand.assistant-setup/linear-cli-setup.jsonare migrated to new names on update when possible; with--force, old legacy files are removed. - Obsolete QA flow cleanup (PP-3640): every re-run removes legacy
ai-testing/ui-checkskills and.claude/workflows/ui-check.mdif they still exist from older bootstraps, then deletes any empty parent folders left behind (e.g..cursor/skills/ai-testing/). - Setup assistant markdown files are always refreshed by the legacy generation flow. For subsequent tracked updates,
prefer
checkandupdate, which use recorded baselines instead of blanket replacement. .dev-environment.mdis tracked repository guidance and may describe Authentication (MI_ACCESS_TOKEN,/data/page/index/auth/info, session cookies), but must not contain credentials. StoreMI_USERNAME/MI_PASSWORDonly in.mi-credentials.local.env(gitignored).- Page workflow context file (
.assistant-setup/page-workflow-context.md) is generated as a shared artifact and can be refined per project. - Node.js: This package keeps
engines.node>=20for running the bootstrap CLI. Repositories on@metricinsights/pp-dev≥ 1.0 need Node.js ≥ 24 (declared in itsengines); alignenginesand workflow images in those app repos when you adopt that pp-dev version. - CI: Consumer app repositories may not have GitHub Actions (or other CI) yet—that is still often the exception—but the goal is for build / lint / test on every change to become the default. This tool does not generate CI files; add workflows in each app repo when you standardize, and pin the same Node version you use locally (see above for pp-dev).