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]>
29 lines
997 B
Bash
Executable File
29 lines
997 B
Bash
Executable File
#!/bin/sh
|
|
# Shared agent guard for new-file creation (Claude PreToolUse[Write],
|
|
# Codex PreToolUse[file-edit]). Cursor can only run this advisorily (its
|
|
# afterFileEdit cannot block) — see .cursor/hooks/after-file-edit.sh.
|
|
#
|
|
# New TypeScript files must be type-strict: block creating a brand-new file that
|
|
# contains `// @ts-strict-ignore`. Existing files (241 of them) are grandfathered
|
|
# automatically because this only fires when the target path does not yet exist.
|
|
|
|
input=$(cat)
|
|
file=$(printf '%s' "$input" | jq -r '.tool_input.file_path // empty')
|
|
[ -n "$file" ] || exit 0
|
|
case "$file" in
|
|
*.ts | *.tsx) ;;
|
|
*) exit 0 ;;
|
|
esac
|
|
|
|
# Only guard new files; edits to existing files are untouched.
|
|
[ -f "$file" ] && exit 0
|
|
|
|
content=$(printf '%s' "$input" | jq -r '.tool_input.content // empty')
|
|
case "$content" in
|
|
*"@ts-strict-ignore"*)
|
|
echo "Blocked: new files must be type-strict — remove '// @ts-strict-ignore' and fix the types instead (AGENTS.md)." >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
exit 0
|