Run once per project to detect configuration and write .cursor/rules/gsd-project.mdc.
When to run: First time you use the GSD workflow in a project, or when the project config changes (new package manager, new test framework, etc.).
What happens: I'll auto-detect everything I can, ask you to confirm or fill in any gaps, then write a project config file that all GSD commands read instead of guessing.
Expected output: .cursor/rules/gsd-project.mdc — the single source of truth for this project's GSD config.
basename $(git rev-parse --show-toplevel 2>/dev/null || pwd)Check for lockfiles (in order of priority):
ls pnpm-lock.yaml 2>/dev/null && echo "pnpm"
ls yarn.lock 2>/dev/null && echo "yarn"
ls package-lock.json 2>/dev/null && echo "npm"
ls bun.lockb 2>/dev/null && echo "bun"ls turbo.json 2>/dev/null && echo "turbo"
cat package.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('workspaces','none'))" 2>/dev/null
cat pnpm-workspace.yaml 2>/dev/nullgit show-ref --verify --quiet refs/heads/main && echo "main" || \
git show-ref --verify --quiet refs/heads/master && echo "master" || \
echo "main"cat package.json | python3 -c "import json,sys; d=json.load(sys.stdin); [print(k) for k in d.get('scripts',{}).keys()]" 2>/dev/nullMap detected scripts to GSD variables:
| GSD Variable | Look for scripts named |
|---|---|
{TS_CHECK_CMD} |
ts-check, typecheck, type-check |
{LINT_CMD} |
lint |
{LINT_FIX_CMD} |
lint-fix, lint:fix |
{TEST_CMD} |
test, check for cross-env TZ=UTC prefix |
{TEST_CHANGED_CMD} |
test:changed, test-changed |
cat package.json | python3 -c "
import json,sys
d=json.load(sys.stdin)
deps={**d.get('devDependencies',{}), **d.get('dependencies',{})}
if 'vitest' in deps: print('vitest')
elif 'jest' in deps or '@types/jest' in deps: print('jest')
else: print('unknown')
" 2>/dev/nullIf this is a monorepo root and the test framework lives in a subpackage, check one of the workspace packages.
Check for signs of a co-located backend:
ls -d *-service 2>/dev/null
ls -d backend 2>/dev/null
ls -d server 2>/dev/null
ls -d api 2>/dev/nullAlso check for frontend type/hook directories:
ls -d */types 2>/dev/null
ls -d */data 2>/dev/null
ls -d */hooks 2>/dev/nullIf a backend directory is found: Ask the user to confirm the paths for:
- Frontend types directory
- Frontend data/hooks directory
- Backend API controllers directory
- Backend DTO/model directory
If no backend found (component library, standalone frontend, MCP server): Set API Contract to N/A.
ls .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null || \
ls .github/pull_request_template.md 2>/dev/null || \
echo "none"Read from existing .cursor/rules/codacy.mdc if present:
cat .cursor/rules/codacy.mdc 2>/dev/null | grep -E "organization:|repository:"Default: auctiontechnologygroup.atlassian.net
If the project uses a different Jira domain, ask the user.
Present a summary of detected values and ask:
- "Does this look correct? Any changes?"
- Fill in any
unknownvalues with user input
Create or overwrite .cursor/rules/gsd-project.mdc:
---
description: GSD project configuration — run /setup-gsd to regenerate
globs: ["**/*"]
alwaysApply: false
---
## GSD Project Config: [PROJECT-NAME]
> Generated: [DATE] — re-run `/setup-gsd` to update
### Tooling
- Package manager: [pnpm|yarn|npm|bun]
- Monorepo: [turbo (workspaces: X) | pnpm workspaces | single package]
- Node version: [version from .nvmrc or .node-version or package.json engines]
### Git
- Base branch: [main|master]
### Commands
- TypeScript check: [PKG_MGR] run [ts-check|typecheck|type-check]
- Lint: [PKG_MGR] run lint
- Lint fix: [PKG_MGR] run [lint-fix|lint:fix]
- Test (targeted): [full test command including cross-env/TZ if needed] [test-file-path]
- Test (global): [PKG_MGR] run test
- Test framework: [vitest|jest]
### API Contract
[N/A - [project type, e.g., component library, MCP server]]
OR
- Frontend types: [relative path]
- Frontend hooks/data: [relative path]
- Backend API: [relative path]
- Backend DTOs: [relative path]
### PR Template
- Location: [.github/PULL_REQUEST_TEMPLATE.md | none]
### Jira
- Domain: [domain]
### Codacy
- Provider: gh
- Organization: [org]
- Repository: [repo]Output:
✅ GSD project config written to `.cursor/rules/gsd-project.mdc`
All GSD commands will now use this config. No more auto-detection on every run.
**Review the file** and adjust any values that look wrong.
To regenerate: run `/setup-gsd` again (it overwrites the existing file).
- Non-destructive to other rules: Only creates/updates
gsd-project.mdc— never touchescodacy.mdcor any other rule file. - Safe to re-run: Overwrites the previous config, asks for confirmation before writing.
- Monorepo tip: Run from the monorepo root. The config covers the whole repo; individual subpackage commands are specified in the Commands section.
- The
alwaysApply: falseflag: Cursor will only read this file when a GSD command explicitly loads it (via the Pre-Flight step), keeping it out of every other conversation's context.