@codyswann/lisa 3.69.6 → 3.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/all/copy-overwrite/scripts/lisa-gates.mjs +254 -35
  2. package/all/copy-overwrite/scripts/lisa-hooks/block-no-verify.sh +224 -7
  3. package/all/create-only/.github/workflows/continuous-gates.yml +74 -0
  4. package/cdk/create-only/.github/workflows/deploy.yml +41 -1
  5. package/dist/codex/scripts/block-no-verify.sh +190 -3
  6. package/dist/configs/vitest/scratch-global-setup.d.ts +32 -0
  7. package/dist/configs/vitest/scratch-global-setup.d.ts.map +1 -1
  8. package/dist/configs/vitest/scratch-global-setup.js +48 -0
  9. package/dist/configs/vitest/scratch-global-setup.js.map +1 -1
  10. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  11. package/dist/core/lisa-owned-hash-ledger.js +3 -0
  12. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  13. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  14. package/dist/core/upstream-evidence-manifest.js +18 -9
  15. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  16. package/dist/opencode/hooks-installer.d.ts.map +1 -1
  17. package/dist/opencode/hooks-installer.js +14 -0
  18. package/dist/opencode/hooks-installer.js.map +1 -1
  19. package/expo/create-only/.github/workflows/deploy.yml +42 -1
  20. package/harper-fabric/create-only/.github/workflows/deploy.yml +37 -0
  21. package/nestjs/create-only/.github/workflows/deploy.yml +44 -1
  22. package/package.json +1 -1
  23. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  25. package/plugins/lisa/hooks/block-no-verify.agy.sh +200 -6
  26. package/plugins/lisa/hooks/block-no-verify.sh +224 -7
  27. package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +200 -6
  28. package/plugins/lisa-agy/plugin.json +1 -1
  29. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  31. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  32. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-copilot/hooks/block-no-verify.sh +224 -7
  36. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-cursor/hooks/block-no-verify.sh +224 -7
  38. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  40. package/plugins/lisa-expo-agy/plugin.json +1 -1
  41. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  45. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  46. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  50. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  51. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  55. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  56. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  60. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  61. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  65. package/plugins/lisa-rails-agy/plugin.json +1 -1
  66. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  71. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  74. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  75. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  76. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  78. package/plugins/src/base/hooks/block-no-verify.agy.sh +200 -6
  79. package/plugins/src/base/hooks/block-no-verify.sh +224 -7
  80. package/rails/create-only/.github/workflows/deploy.yml +41 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (migration write-protection)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-openclaw",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Connect staff roles to Telegram or Slack via OpenClaw — facilitator/specialist hub-and-spoke routing and repo-coding topics, for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-phaser",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Phaser 4 game-development rules for TypeScript projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Ruby on Rails-specific skills and hooks for RuboCop and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "TypeScript-specific hooks for formatting, linting, and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, ast-grep scanning, and error-suppression blocking on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "Distributable LLM Wiki kernel — ingest, query, lint, and maintain a git-native markdown knowledge base across Claude and Codex.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-wiki",
3
- "version": "3.69.6",
3
+ "version": "3.70.1",
4
4
  "description": "LLM Wiki — a distributable, git-native markdown knowledge base for Claude Code and Codex",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,11 +1,20 @@
1
1
  #!/usr/bin/env bash
2
2
  # Antigravity (agy) PreToolUse hook: blocks shell commands that bypass Lisa's
3
3
  # git quality gates (exact parity with the Claude block-no-verify.sh): the
4
- # `--no-verify` long flag, `HUSKY=0`/`HUSKY_SKIP_HOOKS=` (disables husky hooks),
5
- # and `core.hooksPath` pointed at /dev/null or set empty (disables all git
6
- # hooks). Shell-token matching avoids false positives from issue bodies,
7
- # heredocs, and commit-message prose while still catching quoted real argv
8
- # values such as `git -c "core.hooksPath=/dev/null"`.
4
+ # `--no-verify` long flag and any abbreviation git accepts for it, its short
5
+ # form `-n` as a real argv token of a `git commit` (bare or bundled, as in
6
+ # `-nm "msg"`), `HUSKY=0`/`HUSKY_SKIP_HOOKS=` (disables husky hooks), and
7
+ # `core.hooksPath` pointed anywhere but an allowlisted in-repo hooks dir
8
+ # (disables all git hooks). Shell-token matching avoids false positives from
9
+ # issue bodies, heredocs, and commit-message prose while still catching quoted
10
+ # real argv values such as `git -c "core.hooksPath=/dev/null"`.
11
+ #
12
+ # This file used to be cited BY the Claude variant as the reason the short `-n`
13
+ # was excluded ("grep cannot distinguish a real -n option from prose"). Neither
14
+ # variant greps: both tokenize, which is exactly what tells an option from a
15
+ # quoted message. The cross-reference outlived the matcher it described, and a
16
+ # stale rationale is worse than none — it reads as a considered decision and
17
+ # stops the next reader from re-examining it.
9
18
  #
10
19
  # agy protocol (distinct from the Claude block-no-verify.sh exit-code protocol):
11
20
  # - stdin = JSON: { "toolCall": { "name": "run_command",
@@ -25,7 +34,7 @@ allow() {
25
34
  }
26
35
 
27
36
  deny() {
28
- printf '%s\n' '{"decision":"deny","reason":"This command bypasses Lisa pre-commit/pre-push quality gates (--no-verify, HUSKY=0, or core.hooksPath disabling). Fix the underlying issue (security audit, lint, typecheck, tests, formatting) instead. If a fix is genuinely impossible, ask the user to make the risk-acceptance decision and add a specific documented ignore; never bypass the hook."}'
37
+ printf '%s\n' '{"decision":"deny","reason":"This command bypasses Lisa pre-commit/pre-push quality gates (--no-verify or its short form -n, HUSKY=0, or core.hooksPath disabling). `git commit -n` and a cluster such as `-nm \"msg\"` skip pre-commit exactly as completely as the long flag. Fix the underlying issue (security audit, lint, typecheck, tests, formatting) instead. If a fix is genuinely impossible, ask the user to make the risk-acceptance decision and add a specific documented ignore; never bypass the hook."}'
29
38
  exit 0
30
39
  }
31
40
 
@@ -123,6 +132,191 @@ def is_permitted_hooks_path(value):
123
132
  return cleaned.rstrip("/") in PERMITTED_HOOKS_PATHS
124
133
 
125
134
 
135
+ # `git commit -n` is the short spelling of --no-verify and skips pre-commit and
136
+ # commit-msg identically; so does a cluster such as `-nm "msg"`. Matching it
137
+ # needs SCOPE, which is why it was long excluded: `-n` means --dry-run to `git
138
+ # push`, --no-stat to `git merge`, and a line count to head/tail/sort/grep. Only
139
+ # `git commit` reads it as a hook bypass, so only that invocation's argv is
140
+ # scanned. Parity with the Claude block-no-verify.sh, which carries the full
141
+ # rationale for why a tokenizer can make this distinction and a grep could not.
142
+ #
143
+ # A SECOND tokenizer pass, deliberately not shared with the checks above:
144
+ # `shlex.split` glues `|` and `;` to their neighbours, so `git commit -m x &&
145
+ # grep -n foo` would read as one long git invocation and refuse the grep.
146
+ # `punctuation_chars=True` emits the operators as their own tokens, giving the
147
+ # scan a boundary to stop at.
148
+ COMMAND_SEPARATORS = {
149
+ ";", "|", "||", "&", "&&", "(", ")", "<", ">", ">>", "<<", "&|",
150
+ }
151
+
152
+ # git's own options taking a SEPARATE value token, skipped when looking for the
153
+ # subcommand so `git -c core.hooksPath=x commit` still reaches `commit`.
154
+ GIT_GLOBAL_SEPARATE_VALUE = {
155
+ "-c", "-C", "--config-env", "--git-dir", "--work-tree",
156
+ "--namespace", "--exec-path", "--super-prefix",
157
+ }
158
+
159
+ # `git commit` long options whose value can be a separate token, listed so the
160
+ # VALUE is never read as a flag (`git commit --author "A -n B" -m x` is fine).
161
+ # Only genuinely value-taking options belong here: a boolean added by mistake
162
+ # would swallow the next token and miss `git commit --amend -n`.
163
+ COMMIT_LONG_SEPARATE_VALUE = {
164
+ "--message", "--file", "--author", "--date", "--template", "--cleanup",
165
+ "--reuse-message", "--reedit-message", "--fixup", "--squash",
166
+ "--pathspec-from-file", "--trailer",
167
+ }
168
+
169
+ # Short options REQUIRING a value. In a cluster the value is whatever follows in
170
+ # the same token, or the next token when nothing does — which is why `-mn` is
171
+ # the message "n" and not a bypass, while `-nm msg` is one.
172
+ COMMIT_SHORT_REQUIRED_VALUE = set("mFcCt")
173
+
174
+ # Short options taking an OPTIONAL value, which git reads only when attached:
175
+ # `-uno` is --untracked-files=no, so `-un` is a mode and not a bypass.
176
+ COMMIT_SHORT_OPTIONAL_VALUE = set("uS")
177
+
178
+
179
+ def line_boundaries_as_separators(text):
180
+ """Turn newlines into command separators, keeping continuations intact.
181
+
182
+ A newline ends a command exactly as `;` does, but shlex treats it as plain
183
+ whitespace — so `git commit -m x` on one line and `grep -n foo` on the next
184
+ read as ONE invocation and the grep gets refused. That is the same
185
+ false-positive class the short-form match exists to avoid, arriving through
186
+ the boundary rather than through the token.
187
+
188
+ Backslash-newline is joined first, because there the newline is NOT a
189
+ boundary: `git commit \\` + newline + `-nm x` is one command, and turning
190
+ that newline into a separator would hide a real bypass.
191
+
192
+ Args:
193
+ text: The command line, heredoc payloads already stripped.
194
+
195
+ Returns:
196
+ The same command with line breaks spelled as separators.
197
+ """
198
+ joined = text.replace("\r\n", "\n").replace("\\\n", " ")
199
+ return joined.replace("\n", " ; ")
200
+
201
+
202
+ def shell_tokens(text):
203
+ """Tokenize a command with shell operators kept as their own tokens.
204
+
205
+ Args:
206
+ text: The command line, heredoc payloads already stripped.
207
+
208
+ Returns:
209
+ The token list, with `;`, `|`, `&&`, `(` and friends standing alone.
210
+ """
211
+ lexer = shlex.shlex(
212
+ line_boundaries_as_separators(text), posix=True, punctuation_chars=True
213
+ )
214
+ lexer.whitespace_split = True
215
+ # shlex treats `#` as a comment introducer and would truncate the line;
216
+ # `shlex.split` disables it, and so must this.
217
+ lexer.commenters = ""
218
+ return list(lexer)
219
+
220
+
221
+ def cluster_skips_verification(cluster):
222
+ """Read a short-option cluster the way git's own parser reads it.
223
+
224
+ Args:
225
+ cluster: A single token beginning with one `-`, e.g. `-nm` or `-mn`.
226
+
227
+ Returns:
228
+ A pair (bypasses, consumes_next_token).
229
+ """
230
+ body = cluster[1:]
231
+ for offset, letter in enumerate(body):
232
+ if letter == "n":
233
+ return (True, False)
234
+ if letter in COMMIT_SHORT_REQUIRED_VALUE:
235
+ return (False, offset == len(body) - 1)
236
+ if letter in COMMIT_SHORT_OPTIONAL_VALUE:
237
+ return (False, False)
238
+ return (False, False)
239
+
240
+
241
+ def commit_bypasses_verification(argv):
242
+ """Whether a `git commit` invocation's argv carries a real short `-n`.
243
+
244
+ Args:
245
+ argv: Tokens following the `commit` subcommand, to the end of the line.
246
+
247
+ Returns:
248
+ True if git would read one of them as --no-verify.
249
+ """
250
+ index = 0
251
+ while index < len(argv):
252
+ token = argv[index]
253
+ index += 1
254
+ # `--` ends the options; a file legitimately named `-n` is not a bypass.
255
+ if token in COMMAND_SEPARATORS or token == "--":
256
+ return False
257
+ if token.startswith("--"):
258
+ if token in COMMIT_LONG_SEPARATE_VALUE:
259
+ index += 1
260
+ continue
261
+ # A bare `-` is git's stdin placeholder, not an option cluster.
262
+ if not token.startswith("-") or token == "-":
263
+ continue
264
+ bypasses, consumes_next = cluster_skips_verification(token)
265
+ if bypasses:
266
+ return True
267
+ if consumes_next:
268
+ index += 1
269
+ return False
270
+
271
+
272
+ def subcommand_after_git(tokens, start):
273
+ """Find the subcommand a `git` token introduces, and its argv.
274
+
275
+ Args:
276
+ tokens: The full operator-aware token list.
277
+ start: Index just past the `git` token.
278
+
279
+ Returns:
280
+ A pair (subcommand, argv), or None when the invocation names none.
281
+ """
282
+ index = start
283
+ while index < len(tokens):
284
+ token = tokens[index]
285
+ if token in COMMAND_SEPARATORS:
286
+ return None
287
+ if not token.startswith("-"):
288
+ return (token, tokens[index + 1:])
289
+ index += 2 if token in GIT_GLOBAL_SEPARATE_VALUE else 1
290
+ return None
291
+
292
+
293
+ def git_commit_skips_verification(text):
294
+ """Whether the command runs `git commit` with the short `-n` bypass.
295
+
296
+ Args:
297
+ text: The command line, heredoc payloads already stripped.
298
+
299
+ Returns:
300
+ True if any `git commit` invocation on the line skips verification.
301
+ """
302
+ try:
303
+ scoped_tokens = shell_tokens(text)
304
+ except ValueError:
305
+ return False
306
+ for index, token in enumerate(scoped_tokens):
307
+ # `/usr/bin/git` and a bare `git` are the same program; an env prefix
308
+ # (`HUSKY=1 git commit -n`) simply sits in an earlier token.
309
+ if token != "git" and not token.endswith("/git"):
310
+ continue
311
+ found = subcommand_after_git(scoped_tokens, index + 1)
312
+ if found and found[0] == "commit" and commit_bypasses_verification(found[1]):
313
+ return True
314
+ return False
315
+
316
+
317
+ if git_commit_skips_verification(strip_heredocs(command)):
318
+ sys.exit(1)
319
+
126
320
  for i, token in enumerate(normalized_tokens):
127
321
  if disables_verification(token):
128
322
  sys.exit(1)