gemini-cli-leo 0.1.30 → 0.1.31-pre.3
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/docs/changelogs/index.md +46 -0
- package/docs/changelogs/latest.md +82 -100
- package/docs/changelogs/preview.md +82 -115
- package/docs/cli/enterprise.md +23 -5
- package/docs/ide-integration/ide-companion-spec.md +10 -4
- package/docs/reference/policy-engine.md +45 -6
- package/docs/tools/shell.md +2 -1
- package/gemini.mjs +77334 -89131
- package/package.json +1 -1
|
@@ -93,6 +93,41 @@ the arguments don't match the pattern, the rule does not apply. For a list of
|
|
|
93
93
|
argument keys available for each tool, see the **Parameters** in the
|
|
94
94
|
[Tools reference](/docs/reference/tools#available-tools).
|
|
95
95
|
|
|
96
|
+
In the stable JSON string, each top-level argument is delimited by the `\x00`
|
|
97
|
+
character, while nested objects and array items aren't. To match only a
|
|
98
|
+
top-level argument, start the pattern with `\x00`, for example
|
|
99
|
+
`'\x00"command":"git '`.
|
|
100
|
+
|
|
101
|
+
Patterns use [RE2 syntax](https://github.com/google/re2/wiki/Syntax). Gemini CLI
|
|
102
|
+
matches them in time proportional to the length of the arguments, so evaluation
|
|
103
|
+
time stays predictable for large arguments. RE2 differs from JavaScript regular
|
|
104
|
+
expressions in the following ways:
|
|
105
|
+
|
|
106
|
+
- Lookahead (`(?=...)`, `(?!...)`), lookbehind (`(?<=...)`, `(?<!...)`), and
|
|
107
|
+
backreferences (`\1`) aren't supported.
|
|
108
|
+
- `\uXXXX` escapes aren't supported. Use `\x{XXXX}` instead.
|
|
109
|
+
- A backslash in front of a non-ASCII character isn't supported. Write the
|
|
110
|
+
character itself.
|
|
111
|
+
- A repetition count can't exceed 1,000. For example, `a{1001}` is rejected.
|
|
112
|
+
- `\s` matches ASCII whitespace only. It doesn't match a no-break space or other
|
|
113
|
+
Unicode spaces.
|
|
114
|
+
- `.` matches every character except a newline, including a carriage return.
|
|
115
|
+
|
|
116
|
+
Gemini CLI also limits the compiled size of a pattern to 2,000 instructions.
|
|
117
|
+
Repetition counts multiply the compiled size, so large counts are the usual
|
|
118
|
+
reason a pattern exceeds this limit. For example, `.{1000}` is accepted, but
|
|
119
|
+
`.{1000}.{1000}` and `.{0,1000}` aren't. We recommend keeping repetition counts
|
|
120
|
+
small.
|
|
121
|
+
|
|
122
|
+
If a pattern doesn't compile or exceeds the size limit, Gemini CLI skips that
|
|
123
|
+
rule and reports the error when it starts.
|
|
124
|
+
|
|
125
|
+
<!-- prettier-ignore -->
|
|
126
|
+
> [!NOTE]
|
|
127
|
+
> Earlier versions of Gemini CLI evaluated patterns as JavaScript regular
|
|
128
|
+
> expressions. If a rule that used to load now reports an invalid pattern,
|
|
129
|
+
> rewrite the pattern without the unsupported constructs.
|
|
130
|
+
|
|
96
131
|
#### Execution environment
|
|
97
132
|
|
|
98
133
|
If `interactive` is specified, the rule will only apply if the CLI's execution
|
|
@@ -306,19 +341,22 @@ mcpName = "my-custom-server"
|
|
|
306
341
|
# key-value pairs provided here are present in the tool's annotations.
|
|
307
342
|
toolAnnotations = { readOnlyHint = true }
|
|
308
343
|
|
|
309
|
-
# (Optional) A
|
|
310
|
-
|
|
344
|
+
# (Optional) A regular expression in RE2 syntax to match against the tool's
|
|
345
|
+
# arguments.
|
|
346
|
+
argsPattern = '\x00"command":"(?:git|npm)'
|
|
311
347
|
|
|
312
348
|
# (Optional) A string or array of strings that a shell command must start with.
|
|
313
349
|
# This is syntactic sugar for `toolName = "run_shell_command"` and an
|
|
314
350
|
# `argsPattern`.
|
|
315
351
|
commandPrefix = "git"
|
|
316
352
|
|
|
317
|
-
# (Optional) A
|
|
353
|
+
# (Optional) A regular expression in RE2 syntax to match against the entire
|
|
354
|
+
# shell command.
|
|
318
355
|
# This is also syntactic sugar for `toolName = "run_shell_command"`.
|
|
319
356
|
# Note: This pattern is tested against the JSON representation of the arguments
|
|
320
|
-
# (e.g., `{"command":"<your_command>"}`).
|
|
321
|
-
#
|
|
357
|
+
# (e.g., `{"command":"<your_command>"}`). It matches only the top-level
|
|
358
|
+
# `command` argument and starts at the beginning of the command, so
|
|
359
|
+
# alternatives such as `ls|pwd` also apply from the start of the command.
|
|
322
360
|
# Anchors like `^` or `$` apply to the full JSON string,
|
|
323
361
|
# so `^` should usually be avoided here.
|
|
324
362
|
# You cannot use commandPrefix and commandRegex in the same rule.
|
|
@@ -386,7 +424,8 @@ and [Tools reference](/docs/reference/tools#available-tools).
|
|
|
386
424
|
- `commandPrefix`: Matches if the `command` argument starts with the given
|
|
387
425
|
string.
|
|
388
426
|
- `commandRegex`: Matches if the `command` argument matches the given regular
|
|
389
|
-
expression.
|
|
427
|
+
expression. The pattern uses the same RE2 syntax as
|
|
428
|
+
[`argsPattern`](#arguments-pattern).
|
|
390
429
|
|
|
391
430
|
**Example:**
|
|
392
431
|
|
package/docs/tools/shell.md
CHANGED
|
@@ -26,7 +26,8 @@ fields for writing rules that target shell commands:
|
|
|
26
26
|
|
|
27
27
|
- `commandPrefix`: Matches if the `command` argument starts with a given string.
|
|
28
28
|
- `commandRegex`: Matches if the `command` argument matches a given regular
|
|
29
|
-
expression.
|
|
29
|
+
expression. Patterns use RE2 syntax, which is described in
|
|
30
|
+
[Arguments pattern](../reference/policy-engine.md#arguments-pattern).
|
|
30
31
|
|
|
31
32
|
These are syntactic sugar for combining `toolName = "run_shell_command"` with an
|
|
32
33
|
`argsPattern` in a policy TOML file. They are **not** arguments of
|