mirror of
https://github.com/actualbudget/actual.git
synced 2026-10-11 22:49:59 +00:00
* [AI] Replace mechanical agent rules with shared agent hooks + nano-staged Move the mechanical "remember to run X" rules out of AGENTS.md and the agent guidance docs into deterministic, cross-agent hooks, and migrate the pre-commit runner from lint-staged to nano-staged. - Add shared hook scripts in scripts/agent-hooks/ (git-guard, format-edited-file, no-strict-ignore-new-file, prefer-one-component, check-on-stop, common helpers) wired for Claude (.claude/settings.json), Codex (.codex/config.toml), and Cursor (.cursor/hooks.json + adapters). - Enforce "avoid enum" via a new actual/no-enum lint rule, grandfathering the two existing declarations in .oxlintrc.json overrides. - Migrate lint-staged -> nano-staged (.nano-staged.json, .husky/pre-commit, package.json). - Trim AGENTS.md, .github/agents/pr-and-commit-rules.md, the Cursor rule, and the committing skill down to the rules that aren't auto-enforced. - Add release note 8089.md. * [AI] Align PR-title wording in AGENTS.md with canonical rules * [AI] Fix check-on-stop hook on bash 3.2 and TSV column collapse The Stop hook silently no-op'd in two ways: - `declare -A` isn't supported on stock macOS bash 3.2, and the slash/hyphen path subscript aborted under `set -u`. Dedupe via a space-padded string match instead. - jq emitted an empty middle TSV field for a package with test but no typecheck; tab is IFS-whitespace so `read` collapsed it and shifted the columns (eslint-plugin-actual then ran neither). Emit non-empty sentinels (-, yes/no) so no field can collapse. Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
52 lines
2.2 KiB
TOML
52 lines
2.2 KiB
TOML
# Codex project hooks for actualbudget/actual.
|
|
#
|
|
# Codex discovers project config by walking up to the .git root, so this file
|
|
# applies to the whole repo. The hook scripts are shared with Claude Code and
|
|
# Cursor (see scripts/agent-hooks/). Codex's Bash hook is Claude-compatible
|
|
# (tool_input.command), so the git guard is reused directly; exit code 2 + stderr
|
|
# blocks the call.
|
|
#
|
|
# Known limitation: Codex's `apply_patch` PreToolUse payload carries the diff as a
|
|
# raw string in tool_input.command (no tool_input.file_path / .content), so the
|
|
# file-content hooks below (strict-ignore, format, one-component) only fire for
|
|
# the Write/Edit tools and no-op for apply_patch. They never false-block. The
|
|
# Bash/git guard and the Stop check work regardless. The file hooks are fully
|
|
# effective under Claude Code and Cursor.
|
|
#
|
|
# Non-managed hooks must be trusted once via `/hooks` in the Codex CLI.
|
|
|
|
# Block unsafe git/workspace commands ([AI] prefix, --no-verify, force-push,
|
|
# push-to-main, git config writes, yarn-from-a-workspace).
|
|
[[hooks.PreToolUse]]
|
|
matcher = "^Bash$"
|
|
[[hooks.PreToolUse.hooks]]
|
|
type = "command"
|
|
command = '"$(git rev-parse --show-toplevel)/scripts/agent-hooks/git-guard.sh"'
|
|
statusMessage = "Checking shell command against repo policy"
|
|
|
|
# Block creating a new file that contains // @ts-strict-ignore.
|
|
[[hooks.PreToolUse]]
|
|
matcher = "^apply_patch$|^Write$|^Edit$"
|
|
[[hooks.PreToolUse.hooks]]
|
|
type = "command"
|
|
command = '"$(git rev-parse --show-toplevel)/scripts/agent-hooks/no-strict-ignore-new-file.sh"'
|
|
statusMessage = "Checking new file is type-strict"
|
|
|
|
# Format/lint the edited file, and warn on multiple components in a new .tsx.
|
|
[[hooks.PostToolUse]]
|
|
matcher = "^apply_patch$|^Write$|^Edit$"
|
|
[[hooks.PostToolUse.hooks]]
|
|
type = "command"
|
|
command = '"$(git rev-parse --show-toplevel)/scripts/agent-hooks/format-edited-file.sh"'
|
|
[[hooks.PostToolUse.hooks]]
|
|
type = "command"
|
|
command = '"$(git rev-parse --show-toplevel)/scripts/agent-hooks/prefer-one-component.sh"'
|
|
|
|
# When the turn ends, typecheck + test the workspaces this branch touched.
|
|
[[hooks.Stop]]
|
|
[[hooks.Stop.hooks]]
|
|
type = "command"
|
|
command = '"$(git rev-parse --show-toplevel)/scripts/agent-hooks/check-on-stop.sh"'
|
|
timeout = 600
|
|
statusMessage = "Typecheck + test touched workspaces"
|