opencode-commit-guard 1.1.2 → 1.2.0

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 (3) hide show
  1. package/README.md +16 -5
  2. package/dist/index.js +1030 -209
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -5,12 +5,13 @@ It requires `@opencode/plugin` 2.4.1 or newer.
5
5
 
6
6
  ## Overview
7
7
 
8
- The plugin inspects every `shell` and `bash` tool call before it runs.
8
+ The plugin inspects every `shell` and `bash` tool call before it runs, across POSIX shells and PowerShell 7 (`pwsh`).
9
9
  If a `git commit` breaks a formatting rule, the plugin rejects the tool call with an error.
10
10
  The error lists each violation and shows a conforming example, so the agent can fix the message and retry.
11
11
 
12
12
  Before the first commit in each session and checkout, the agent captures a Git baseline with the `commit_context` tool.
13
13
  The baseline records the effective `commit.gpgsign` setting, which determines whether a commit needs a signoff.
14
+ On Windows, context capture and command inspection target PowerShell 7 (`pwsh`).
14
15
 
15
16
  The plugin does not change Git hooks or repository configuration.
16
17
 
@@ -89,28 +90,38 @@ Otherwise, the returned `result.output` text includes the `Frozen commit baselin
89
90
  - **Line length**: No subject or body line exceeds `maxLineLength`.
90
91
  - **Signoff**: If the captured `commit.gpgsign` is `true`, add `-s` or a `Signed-off-by:` trailer.
91
92
  Signoff is not a cryptographic signature.
92
- - **Literal messages**: Supply messages with `-m`, `--message`, or one quoted heredoc on standard input.
93
+ - **Literal messages**: Supply messages with `-m`, `--message`, one quoted heredoc on POSIX standard input, or a single literal here-string pipeline in PowerShell 7.
93
94
  The plugin rejects message files, shell expansion in messages, and `--trailer`.
94
95
  - **Direct target**: Run `git commit` directly in the captured checkout.
95
96
  The plugin rejects `git -C`, Git directory flags, Git environment overrides, and directory-changing wrappers.
96
97
 
97
- Use real newlines inside `$'...'` for a message body:
98
+ In POSIX shells, use real newlines inside `$'...'` for a message body:
98
99
 
99
100
  ```bash
100
101
  git commit -s -m $'kernel: Fix race in thermal driver\n\nHold the lock while the sensor list changes.'
101
102
  ```
102
103
 
104
+ In PowerShell 7 (`pwsh`), use single quotes or pipe a literal here-string to `git commit -F -`:
105
+
106
+ ```powershell
107
+ @'
108
+ kernel: Fix race in thermal driver
109
+
110
+ Hold the lock while the sensor list changes.
111
+ '@ | git commit -s -F -
112
+ ```
113
+
103
114
  `git commit --help` and `git commit -h` do not need a baseline.
104
115
 
105
116
  ## Development
106
117
 
107
- Use Bun 1.3 or newer; the test suite runs tests concurrently.
118
+ Use Bun 1.4 or newer; the test suite runs tests concurrently.
108
119
 
109
120
  ```sh
110
121
  bun install
122
+ bun run check # lint, format check, typecheck, and tests
111
123
  bun test # unit tests and real OpenCode host tests
112
124
  bun run typecheck # TypeScript type checking
113
- bun run check # lint and format check
114
125
  bun run build # build dist/
115
126
  ```
116
127