Scripts
Scripts
Section titled “Scripts”All automation scripts live in the scripts/ directory. They are written in Bash and require no dependencies beyond standard Unix tools (with optional gh and jq for GitHub features).
setup.sh
Section titled “setup.sh”Purpose: First-time setup of coding standards in a project.
Usage:
./scripts/setup.shOr via Make:
make setupWhat it does:
- Detects whether it is running inside the standards repo itself or inside a project that uses it as a submodule.
- Copies
.cursorrulesto the project root (backs up any existing file). - Copies Cursor custom commands from
.cursor/commands/to the project. - Installs all AI agent configurations:
.github/copilot-instructions.md(GitHub Copilot).aiderrc(Aider / Claude Code).codexrc(OpenAI Codex).gemini/GEMINI.mdand.gemini/settings.json(Gemini CLI)
- Installs a
post-mergegit hook that checks for standards updates. - Runs
setup-git-aliases.shto configure global git aliases. - Adds
.cursorrules.backupand.standards_tmp/to.gitignore.
Flags: None. The script auto-detects everything from the environment.
sync-standards.sh
Section titled “sync-standards.sh”Purpose: Pull the latest standards and update all configuration files.
Usage:
./scripts/sync-standards.shOr via Make:
make sync-standardsWhat it does:
- If a
.standardssubmodule exists, fetches from the remote and pulls if there are new commits. - Updates
.cursorrulesif it has changed. - Syncs Cursor custom commands.
- Syncs all AI agent configurations (Copilot, Aider, Codex, Gemini). Missing configurations are added automatically; existing ones are updated when they differ from the source.
- Validates Gemini
settings.jsonfor valid JSON before copying (usespython3orjqif available). - Runs
setup-git-aliases.shto ensure aliases are current. - Lists available standards files.
setup-git-aliases.sh
Section titled “setup-git-aliases.sh”Purpose: Configure global git aliases and settings based on project conventions.
Usage:
./scripts/setup-git-aliases.shCalled automatically by setup.sh and sync-standards.sh.
What it configures:
Git settings:
| Setting | Value | Purpose |
|---|---|---|
push.autoSetupRemote | true | Auto-set upstream when pushing new branches |
push.default | simple | Push only the current branch |
init.defaultBranch | main | Default branch name for new repos |
Key aliases:
| Alias | Command | Description |
|---|---|---|
git co | checkout | Switch branches |
git cob | checkout -b | Create and switch to a new branch |
git st | status | Show working tree status |
git cm | commit -m | Commit with a message |
git lg | log --oneline --decorate --graph --all | Visual log graph |
git up | fetch + rebase origin/main | Update branch from main |
git refresh-main | (complex) | Reset local main to match origin/main |
git feat <name> | checkout -b feature/<name> | Start a feature branch |
git fix <name> | checkout -b fix/<name> | Start a fix branch |
git pushf | push --force-with-lease | Safe force push |
git aliases | (list all aliases) | Show configured aliases |
The script prompts before overwriting any existing alias that has a different value.
add-copilot-instructions-pr.sh
Section titled “add-copilot-instructions-pr.sh”Purpose: Create a pull request that adds GitHub Copilot custom instructions to a repository.
Usage:
./scripts/add-copilot-instructions-pr.sh [base-branch]Or via Make:
make add-copilot-instructionsWhat it does:
- Checks for GitHub CLI (
gh). - Locates the Copilot instructions source file in the standards repo.
- Creates a feature branch (
add-copilot-instructionsorupdate-copilot-instructions). - Copies
.github/copilot-instructions.mdinto the project. - Commits and pushes.
- Opens a pull request via
gh pr createwith a detailed description.
Prerequisites: gh CLI installed and authenticated.
Arguments:
| Argument | Default | Description |
|---|---|---|
base-branch | main | Branch to target with the PR |
fetch-pr-comments.sh
Section titled “fetch-pr-comments.sh”Purpose: Fetch all unresolved comments on a pull request and save them as JSON for AI processing.
Usage:
./scripts/fetch-pr-comments.sh [PR_NUMBER]If no PR number is given, the script looks up the PR associated with the current branch.
What it does:
- Checks for
ghandjq. - Fetches PR metadata, unresolved review threads, and general comments in a single API call.
- Writes structured JSON to
.standards_tmp/pr-comments-<timestamp>.json. - Prints the file path to stdout (for the Cursor
/address_feedbackcommand to consume).
Output format:
{ "pr": { "number": 42, "url": "...", "title": "...", "state": "OPEN", "author": {...} }, "reviewThreads": [...], "generalComments": [...], "summary": { "totalUnresolvedThreads": 3, "totalUnresolvedComments": 1 }}Prerequisites: gh CLI (authenticated), jq.
generate-pr-content.sh
Section titled “generate-pr-content.sh”Purpose: Gather git information about the current branch for AI-powered PR generation.
Usage:
./scripts/generate-pr-content.sh [base-branch]What it does:
- Collects branch name, commit messages, changed file list, and diff statistics.
- Writes everything to
.standards_tmp/pr-content-<timestamp>.txt. - Prints the file path to stdout (for the Cursor
/prcommand to consume).
Arguments:
| Argument | Default | Description |
|---|---|---|
base-branch | main | Branch to diff against |