opencode-commit-guard 1.0.7 → 1.1.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.
- package/README.md +25 -8
- package/dist/index.js +1572 -1346
- package/package.json +31 -29
- package/index.ts +0 -1
- package/src/capture.ts +0 -415
- package/src/config.ts +0 -78
- package/src/plugin.ts +0 -418
- package/src/scope.ts +0 -1
- package/src/shell.ts +0 -1159
- package/src/types.ts +0 -67
- package/src/validator.ts +0 -197
package/README.md
CHANGED
|
@@ -50,11 +50,11 @@ You can also specify custom configuration options:
|
|
|
50
50
|
|
|
51
51
|
## Configuration options
|
|
52
52
|
|
|
53
|
-
| Option
|
|
54
|
-
|
|
55
|
-
| `requireScope`
|
|
56
|
-
| `allowedScopes` | `string[]` | `undefined` | Restricts allowed scope identifiers to a specified list.
|
|
57
|
-
| `maxLineLength` | `number`
|
|
53
|
+
| Option | Type | Default | Description |
|
|
54
|
+
| --------------- | ---------- | ----------- | -------------------------------------------------------------------------------- |
|
|
55
|
+
| `requireScope` | `boolean` | `true` | Requires the first line to match `<scope>: <subject>`. |
|
|
56
|
+
| `allowedScopes` | `string[]` | `undefined` | Restricts allowed scope identifiers to a specified list. |
|
|
57
|
+
| `maxLineLength` | `number` | `72` | Limits every line in the subject and body to this length. Set to `0` to disable. |
|
|
58
58
|
|
|
59
59
|
## Capture commit context
|
|
60
60
|
|
|
@@ -70,6 +70,9 @@ Repeat an explicit `workdir` when you check that checkout.
|
|
|
70
70
|
An argument-free call selects the session directory when it is inside a Git repository, even after an explicit selection.
|
|
71
71
|
If the shell result lacks a verified successful process exit, capture again instead of using a partial baseline.
|
|
72
72
|
The command writes full historical messages to a private file and prints a fixed receipt.
|
|
73
|
+
On Linux and macOS, capture uses Bash, portable `base64`, and a 15-second process-group watchdog.
|
|
74
|
+
On Windows, capture uses Windows PowerShell through an encoded command that you can run from PowerShell, `pwsh`, `cmd.exe`, or Git Bash.
|
|
75
|
+
Both capture paths limit the artifact to 256 KiB and preserve NUL-delimited Git history.
|
|
73
76
|
The plugin appends the capture outcome and commit rules to the shell result.
|
|
74
77
|
`RECEIPT_OK` confirms only that the artifact was written, not that the baseline was published.
|
|
75
78
|
The next context call reports whether a capture is unclaimed, awaiting permission or execution, expired, or failed.
|
|
@@ -107,6 +110,9 @@ The plugin rejects subject lines that omit the colon, leave the scope empty, or
|
|
|
107
110
|
### 2. Allowed scopes (`allowedScopes`)
|
|
108
111
|
|
|
109
112
|
When `allowedScopes` contains values, the extracted scope must match an entry in the list.
|
|
113
|
+
Set `allowedScopes: []` to disable the scope allowlist.
|
|
114
|
+
The plugin normalizes the empty array to `undefined`.
|
|
115
|
+
The plugin rejects unknown option keys and lists the valid options: `requireScope`, `allowedScopes`, and `maxLineLength`.
|
|
110
116
|
For conventional commits such as `feat(parser): ...`, the plugin accepts either the inner scope (`parser`), the full scope token (`feat(parser)`), or the type prefix (`feat`).
|
|
111
117
|
Each configured entry must match the scope syntax; spaces and characters such as `@` are invalid.
|
|
112
118
|
|
|
@@ -158,16 +164,27 @@ It also rejects unquoted or ambiguous standard-input sources.
|
|
|
158
164
|
Supply the final message literally; message words containing shell expansion are rejected without evaluation.
|
|
159
165
|
Single quotes and ANSI-C quotes (`$'...'`) supply literal text.
|
|
160
166
|
The parser inspects commits inside command substitutions, backticks, and literal `bash`, `sh`, or `zsh` `-c` bodies.
|
|
161
|
-
|
|
162
|
-
Run
|
|
167
|
+
Double-quoted parameters support nested defaults and quotes, such as `"${VAR:-"default"}"`, but remain expansions rather than literal message text.
|
|
168
|
+
Run command substitutions and backticks outside these parameters; the parser rejects executable substitutions inside them.
|
|
169
|
+
Command substitutions support command-position `case` branches, optional leading pattern parentheses, and `;;`, `;&`, and `;;&` terminators.
|
|
170
|
+
The guard also validates commits inside those branches.
|
|
163
171
|
Run function and `coproc` declarations outside command substitutions; their compound bodies are rejected there.
|
|
164
172
|
Use `bash -c` or `zsh -c` instead of `sh -c` for bodies containing `$'` quoting; the guard rejects this nonportable syntax under `sh`.
|
|
165
173
|
Unquoted heredoc delimiters match after backslash-newline continuations are removed; quote the delimiter to preserve literal body text.
|
|
166
|
-
|
|
174
|
+
Use a literal shell body if expansion can change its executable words.
|
|
175
|
+
Both `bash -c "$SCRIPT"` and `bash -c "FOO=$BAR pytest"` fail closed because expansion can introduce executable commands.
|
|
176
|
+
Parser failures identify pre-execution shell inspection with a `[commit-guard]` prefix.
|
|
177
|
+
Simplify unsupported syntax or quote literal text; run Git directly when committing.
|
|
167
178
|
Put trailers in the literal message body or use `-s`; `--trailer` is rejected.
|
|
168
179
|
The guard resolves the signing baseline before reporting message-format violations.
|
|
169
180
|
`git commit --help` and `git commit -h` do not require a baseline.
|
|
170
181
|
|
|
182
|
+
### Code Mode boundary
|
|
183
|
+
|
|
184
|
+
The `commit_context` tool remains available through Code Mode.
|
|
185
|
+
The OC-1 proposal to exclude it with `codemode: false` is deferred and is not implemented.
|
|
186
|
+
Require the same verified foreground shell result and `Frozen commit baseline` report regardless of how you call the tool.
|
|
187
|
+
|
|
171
188
|
## Development
|
|
172
189
|
|
|
173
190
|
Use Bun for all repository operations.
|