Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu

branch="$(git branch --show-current)"

if [ "$branch" = "main" ]; then
echo "Committing directly to main is blocked. Create a feature branch." >&2
exit 1
fi

npm run commit-check
11 changes: 11 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -eu

while read -r local_ref _ remote_ref _; do
case "$remote_ref" in
refs/heads/main)
echo "Pushing directly to main is blocked. Open a pull request instead." >&2
exit 1
;;
esac
done
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Default-style configuration:
},
{
"id": "openai/gpt-5.3-codex-spark",
"description": "Faster, lower-cost code-focused option for lightweight implementation tasks."
"description": "Faster, lower-cost code-focused option for small code implementations or quickly searching for things."
}
],

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"build": "npm run clean && tsc -p tsconfig.build.json",
"check": "npm run lint && npm run typecheck && npm run test",
"clean": "rm -rf dist",
"commit-check": "npm run check && npm run build",
"lint": "eslint . --max-warnings=0",
"prepare": "node --import tsx scripts/install-hooks.ts",
"test": "node --import tsx --test test/**/*.test.ts",
"typecheck": "tsc -p tsconfig.json --noEmit",
"prepack": "npm run build"
Expand Down
18 changes: 18 additions & 0 deletions scripts/install-hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { execFileSync } from "node:child_process"
import { existsSync } from "node:fs"
import * as path from "node:path"
import { fileURLToPath } from "node:url"

const scriptDir = path.dirname(fileURLToPath(import.meta.url))
const repoRoot = path.resolve(scriptDir, "..")
const hooksDir = path.join(repoRoot, ".githooks")
const gitDir = path.join(repoRoot, ".git")

if (!existsSync(gitDir) || !existsSync(hooksDir)) {
process.exit(0)
}

execFileSync("git", ["config", "--local", "core.hooksPath", ".githooks"], {
cwd: repoRoot,
stdio: "inherit",
})
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"forceConsistentCasingInFileNames": true,
"noEmit": true
},
"include": ["src/**/*.ts", "test/**/*.ts"],
"include": ["src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts"],
"exclude": ["dist", "coverage", "node_modules"]
}