@codeflyai/codefly 0.24.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 (104) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +375 -0
  3. package/bundle/codefly.js +486433 -0
  4. package/bundle/docs/architecture.md +80 -0
  5. package/bundle/docs/assets/connected_devtools.png +0 -0
  6. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  7. package/bundle/docs/assets/release_patch.png +0 -0
  8. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  9. package/bundle/docs/assets/theme-ansi.png +0 -0
  10. package/bundle/docs/assets/theme-atom-one.png +0 -0
  11. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  12. package/bundle/docs/assets/theme-ayu.png +0 -0
  13. package/bundle/docs/assets/theme-custom.png +0 -0
  14. package/bundle/docs/assets/theme-default-light.png +0 -0
  15. package/bundle/docs/assets/theme-default.png +0 -0
  16. package/bundle/docs/assets/theme-dracula.png +0 -0
  17. package/bundle/docs/assets/theme-github-light.png +0 -0
  18. package/bundle/docs/assets/theme-github.png +0 -0
  19. package/bundle/docs/assets/theme-google-light.png +0 -0
  20. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  21. package/bundle/docs/changelogs/index.md +592 -0
  22. package/bundle/docs/changelogs/latest.md +225 -0
  23. package/bundle/docs/changelogs/preview.md +129 -0
  24. package/bundle/docs/changelogs/releases.md +896 -0
  25. package/bundle/docs/cli/authentication.md +3 -0
  26. package/bundle/docs/cli/checkpointing.md +94 -0
  27. package/bundle/docs/cli/codefly-ignore.md +71 -0
  28. package/bundle/docs/cli/codefly-md.md +109 -0
  29. package/bundle/docs/cli/commands.md +354 -0
  30. package/bundle/docs/cli/configuration.md +780 -0
  31. package/bundle/docs/cli/custom-commands.md +315 -0
  32. package/bundle/docs/cli/enterprise.md +565 -0
  33. package/bundle/docs/cli/generation-settings.md +210 -0
  34. package/bundle/docs/cli/headless.md +388 -0
  35. package/bundle/docs/cli/index.md +63 -0
  36. package/bundle/docs/cli/keyboard-shortcuts.md +143 -0
  37. package/bundle/docs/cli/model-routing.md +37 -0
  38. package/bundle/docs/cli/model.md +62 -0
  39. package/bundle/docs/cli/sandbox.md +171 -0
  40. package/bundle/docs/cli/session-management.md +158 -0
  41. package/bundle/docs/cli/settings.md +113 -0
  42. package/bundle/docs/cli/system-prompt.md +95 -0
  43. package/bundle/docs/cli/telemetry.md +792 -0
  44. package/bundle/docs/cli/themes.md +237 -0
  45. package/bundle/docs/cli/token-caching.md +20 -0
  46. package/bundle/docs/cli/trusted-folders.md +95 -0
  47. package/bundle/docs/cli/tutorials.md +83 -0
  48. package/bundle/docs/cli/uninstall.md +47 -0
  49. package/bundle/docs/core/index.md +101 -0
  50. package/bundle/docs/core/memport.md +244 -0
  51. package/bundle/docs/core/policy-engine.md +267 -0
  52. package/bundle/docs/core/tools-api.md +131 -0
  53. package/bundle/docs/examples/proxy-script.md +83 -0
  54. package/bundle/docs/extensions/extension-releasing.md +183 -0
  55. package/bundle/docs/extensions/getting-started-extensions.md +245 -0
  56. package/bundle/docs/extensions/index.md +293 -0
  57. package/bundle/docs/faq.md +154 -0
  58. package/bundle/docs/get-started/authentication.md +321 -0
  59. package/bundle/docs/get-started/configuration-v1.md +888 -0
  60. package/bundle/docs/get-started/configuration.md +1524 -0
  61. package/bundle/docs/get-started/deployment.md +143 -0
  62. package/bundle/docs/get-started/examples.md +219 -0
  63. package/bundle/docs/get-started/gemini-3.md +116 -0
  64. package/bundle/docs/get-started/index.md +71 -0
  65. package/bundle/docs/get-started/installation.md +141 -0
  66. package/bundle/docs/hooks/best-practices.md +856 -0
  67. package/bundle/docs/hooks/index.md +687 -0
  68. package/bundle/docs/hooks/reference.md +168 -0
  69. package/bundle/docs/hooks/writing-hooks.md +1026 -0
  70. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  71. package/bundle/docs/ide-integration/index.md +202 -0
  72. package/bundle/docs/index.md +147 -0
  73. package/bundle/docs/integration-tests.md +211 -0
  74. package/bundle/docs/issue-and-pr-automation.md +134 -0
  75. package/bundle/docs/local-development.md +128 -0
  76. package/bundle/docs/mermaid/context.mmd +103 -0
  77. package/bundle/docs/mermaid/render-path.mmd +64 -0
  78. package/bundle/docs/npm.md +62 -0
  79. package/bundle/docs/quota-and-pricing.md +158 -0
  80. package/bundle/docs/release-confidence.md +164 -0
  81. package/bundle/docs/releases.md +540 -0
  82. package/bundle/docs/sidebar.json +297 -0
  83. package/bundle/docs/tools/file-system.md +217 -0
  84. package/bundle/docs/tools/index.md +95 -0
  85. package/bundle/docs/tools/mcp-server.md +1044 -0
  86. package/bundle/docs/tools/memory.md +54 -0
  87. package/bundle/docs/tools/shell.md +260 -0
  88. package/bundle/docs/tools/todos.md +57 -0
  89. package/bundle/docs/tools/web-fetch.md +59 -0
  90. package/bundle/docs/tools/web-search.md +42 -0
  91. package/bundle/docs/tos-privacy.md +96 -0
  92. package/bundle/docs/troubleshooting.md +158 -0
  93. package/bundle/policies/agent.toml +31 -0
  94. package/bundle/policies/discovered.toml +8 -0
  95. package/bundle/policies/read-only.toml +61 -0
  96. package/bundle/policies/write.toml +78 -0
  97. package/bundle/policies/yolo.toml +31 -0
  98. package/bundle/sandbox-macos-permissive-closed.sb +32 -0
  99. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  100. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  101. package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
  102. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  103. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  104. package/package.json +148 -0
@@ -0,0 +1,158 @@
1
+ # Troubleshooting guide
2
+
3
+ This guide provides solutions to common issues and debugging tips, including
4
+ topics on:
5
+
6
+ - Authentication or login errors
7
+ - Frequently asked questions (FAQs)
8
+ - Debugging tips
9
+ - Existing GitHub Issues similar to yours or creating new Issues
10
+
11
+ ## Authentication or login errors
12
+
13
+ - **Error:
14
+ `You must be a named user on your organization's Gemini Code Assist Standard edition subscription to use this service. Please contact your administrator to request an entitlement to Gemini Code Assist Standard edition.`**
15
+ - **Cause:** This error might occur if Gemini CLI detects the
16
+ `GOOGLE_CLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT_ID` environment variable is
17
+ defined. Setting these variables forces an organization subscription check.
18
+ This might be an issue if you are using an individual Google account not
19
+ linked to an organizational subscription.
20
+
21
+ - **Solution:**
22
+ - **Individual Users:** Unset the `GOOGLE_CLOUD_PROJECT` and
23
+ `GOOGLE_CLOUD_PROJECT_ID` environment variables. Check and remove these
24
+ variables from your shell configuration files (for example, `.bashrc`,
25
+ `.zshrc`) and any `.env` files. If this doesn't resolve the issue, try
26
+ using a different Google account.
27
+
28
+ - **Organizational Users:** Contact your Google Cloud administrator to be
29
+ added to your organization's Gemini Code Assist subscription.
30
+
31
+ - **Error: `Failed to login. Message: Request contains an invalid argument`**
32
+ - **Cause:** Users with Google Workspace accounts or Google Cloud accounts
33
+ associated with their Gmail accounts may not be able to activate the free
34
+ tier of the Google Code Assist plan.
35
+ - **Solution:** For Google Cloud accounts, you can work around this by setting
36
+ `GOOGLE_CLOUD_PROJECT` to your project ID. Alternatively, you can obtain the
37
+ Gemini API key from
38
+ [Google AI Studio](http://aistudio.google.com/app/apikey), which also
39
+ includes a separate free tier.
40
+
41
+ - **Error: `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` or
42
+ `unable to get local issuer certificate`**
43
+ - **Cause:** You may be on a corporate network with a firewall that intercepts
44
+ and inspects SSL/TLS traffic. This often requires a custom root CA
45
+ certificate to be trusted by Node.js.
46
+ - **Solution:** Set the `NODE_EXTRA_CA_CERTS` environment variable to the
47
+ absolute path of your corporate root CA certificate file.
48
+ - Example: `export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt`
49
+
50
+ ## Common error messages and solutions
51
+
52
+ - **Error: `EADDRINUSE` (Address already in use) when starting an MCP server.**
53
+ - **Cause:** Another process is already using the port that the MCP server is
54
+ trying to bind to.
55
+ - **Solution:** Either stop the other process that is using the port or
56
+ configure the MCP server to use a different port.
57
+
58
+ - **Error: Command not found (when attempting to run Gemini CLI with
59
+ `gemini`).**
60
+ - **Cause:** Gemini CLI is not correctly installed or it is not in your
61
+ system's `PATH`.
62
+ - **Solution:** The update depends on how you installed Gemini CLI:
63
+ - If you installed `gemini` globally, check that your `npm` global binary
64
+ directory is in your `PATH`. You can update Gemini CLI using the command
65
+ `npm install -g @google/gemini-cli@latest`.
66
+ - If you are running `gemini` from source, ensure you are using the correct
67
+ command to invoke it (e.g., `node packages/cli/dist/index.js ...`). To
68
+ update Gemini CLI, pull the latest changes from the repository, and then
69
+ rebuild using the command `npm run build`.
70
+
71
+ - **Error: `MODULE_NOT_FOUND` or import errors.**
72
+ - **Cause:** Dependencies are not installed correctly, or the project hasn't
73
+ been built.
74
+ - **Solution:**
75
+ 1. Run `npm install` to ensure all dependencies are present.
76
+ 2. Run `npm run build` to compile the project.
77
+ 3. Verify that the build completed successfully with `npm run start`.
78
+
79
+ - **Error: "Operation not permitted", "Permission denied", or similar.**
80
+ - **Cause:** When sandboxing is enabled, Gemini CLI may attempt operations
81
+ that are restricted by your sandbox configuration, such as writing outside
82
+ the project directory or system temp directory.
83
+ - **Solution:** Refer to the [Configuration: Sandboxing](./cli/sandbox.md)
84
+ documentation for more information, including how to customize your sandbox
85
+ configuration.
86
+
87
+ - **Gemini CLI is not running in interactive mode in "CI" environments**
88
+ - **Issue:** The Gemini CLI does not enter interactive mode (no prompt
89
+ appears) if an environment variable starting with `CI_` (e.g., `CI_TOKEN`)
90
+ is set. This is because the `is-in-ci` package, used by the underlying UI
91
+ framework, detects these variables and assumes a non-interactive CI
92
+ environment.
93
+ - **Cause:** The `is-in-ci` package checks for the presence of `CI`,
94
+ `CONTINUOUS_INTEGRATION`, or any environment variable with a `CI_` prefix.
95
+ When any of these are found, it signals that the environment is
96
+ non-interactive, which prevents the Gemini CLI from starting in its
97
+ interactive mode.
98
+ - **Solution:** If the `CI_` prefixed variable is not needed for the CLI to
99
+ function, you can temporarily unset it for the command. e.g.,
100
+ `env -u CI_TOKEN gemini`
101
+
102
+ - **DEBUG mode not working from project .env file**
103
+ - **Issue:** Setting `DEBUG=true` in a project's `.env` file doesn't enable
104
+ debug mode for gemini-cli.
105
+ - **Cause:** The `DEBUG` and `DEBUG_MODE` variables are automatically excluded
106
+ from project `.env` files to prevent interference with gemini-cli behavior.
107
+ - **Solution:** Use a `.codefly/.env` file instead, or configure the
108
+ `advanced.excludedEnvVars` setting in your `settings.json` to exclude fewer
109
+ variables.
110
+
111
+ ## Exit codes
112
+
113
+ The Gemini CLI uses specific exit codes to indicate the reason for termination.
114
+ This is especially useful for scripting and automation.
115
+
116
+ | Exit Code | Error Type | Description |
117
+ | --------- | -------------------------- | --------------------------------------------------------------------------------------------------- |
118
+ | 41 | `FatalAuthenticationError` | An error occurred during the authentication process. |
119
+ | 42 | `FatalInputError` | Invalid or missing input was provided to the CLI. (non-interactive mode only) |
120
+ | 44 | `FatalSandboxError` | An error occurred with the sandboxing environment (e.g., Docker, Podman, or Seatbelt). |
121
+ | 52 | `FatalConfigError` | A configuration file (`settings.json`) is invalid or contains errors. |
122
+ | 53 | `FatalTurnLimitedError` | The maximum number of conversational turns for the session was reached. (non-interactive mode only) |
123
+
124
+ ## Debugging tips
125
+
126
+ - **CLI debugging:**
127
+ - Use the `--debug` flag for more detailed output.
128
+ - Check the CLI logs, often found in a user-specific configuration or cache
129
+ directory.
130
+
131
+ - **Core debugging:**
132
+ - Check the server console output for error messages or stack traces.
133
+ - Increase log verbosity if configurable.
134
+ - Use Node.js debugging tools (e.g., `node --inspect`) if you need to step
135
+ through server-side code.
136
+
137
+ - **Tool issues:**
138
+ - If a specific tool is failing, try to isolate the issue by running the
139
+ simplest possible version of the command or operation the tool performs.
140
+ - For `run_shell_command`, check that the command works directly in your shell
141
+ first.
142
+ - For _file system tools_, verify that paths are correct and check the
143
+ permissions.
144
+
145
+ - **Pre-flight checks:**
146
+ - Always run `npm run preflight` before committing code. This can catch many
147
+ common issues related to formatting, linting, and type errors.
148
+
149
+ ## Existing GitHub issues similar to yours or creating new issues
150
+
151
+ If you encounter an issue that was not covered here in this _Troubleshooting
152
+ guide_, consider searching the Gemini CLI
153
+ [Issue tracker on GitHub](https://github.com/google-gemini/gemini-cli/issues).
154
+ If you can't find an issue similar to yours, consider creating a new GitHub
155
+ Issue with a detailed description. Pull requests are also welcome!
156
+
157
+ > **Note:** Issues tagged as "🔒Maintainers only" are reserved for project
158
+ > maintainers. We will not accept pull requests related to these issues.
@@ -0,0 +1,31 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ toolName = "delegate_to_agent"
30
+ decision = "allow"
31
+ priority = 50
@@ -0,0 +1,8 @@
1
+ # Default policy for tools discovered via toolDiscoveryCommand.
2
+ # These tools are potentially dangerous as they are arbitrary scripts.
3
+ # We default them to ASK_USER for safety.
4
+
5
+ [[rule]]
6
+ toolName = "discovered_tool_*"
7
+ decision = "ask_user"
8
+ priority = 10
@@ -0,0 +1,61 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ toolName = "glob"
30
+ decision = "allow"
31
+ priority = 50
32
+
33
+ [[rule]]
34
+ toolName = "search_file_content"
35
+ decision = "allow"
36
+ priority = 50
37
+
38
+ [[rule]]
39
+ toolName = "list_directory"
40
+ decision = "allow"
41
+ priority = 50
42
+
43
+ [[rule]]
44
+ toolName = "read_file"
45
+ decision = "allow"
46
+ priority = 50
47
+
48
+ [[rule]]
49
+ toolName = "read_many_files"
50
+ decision = "allow"
51
+ priority = 50
52
+
53
+ [[rule]]
54
+ toolName = "google_web_search"
55
+ decision = "allow"
56
+ priority = 50
57
+
58
+ [[rule]]
59
+ toolName = "SubagentInvocation"
60
+ decision = "allow"
61
+ priority = 50
@@ -0,0 +1,78 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ toolName = "replace"
30
+ decision = "ask_user"
31
+ priority = 10
32
+
33
+ [[rule]]
34
+ toolName = "replace"
35
+ decision = "allow"
36
+ priority = 15
37
+ modes = ["autoEdit"]
38
+
39
+ [rule.safety_checker]
40
+ type = "in-process"
41
+ name = "allowed-path"
42
+ required_context = ["environment"]
43
+
44
+ [[rule]]
45
+ toolName = "save_memory"
46
+ decision = "ask_user"
47
+ priority = 10
48
+
49
+ [[rule]]
50
+ toolName = "run_shell_command"
51
+ decision = "ask_user"
52
+ priority = 10
53
+
54
+ [[rule]]
55
+ toolName = "write_file"
56
+ decision = "ask_user"
57
+ priority = 10
58
+
59
+ [[rule]]
60
+ toolName = "activate_skill"
61
+ decision = "ask_user"
62
+ priority = 10
63
+
64
+ [[rule]]
65
+ toolName = "write_file"
66
+ decision = "allow"
67
+ priority = 15
68
+ modes = ["autoEdit"]
69
+
70
+ [rule.safety_checker]
71
+ type = "in-process"
72
+ name = "allowed-path"
73
+ required_context = ["environment"]
74
+
75
+ [[rule]]
76
+ toolName = "web_fetch"
77
+ decision = "ask_user"
78
+ priority = 10
@@ -0,0 +1,31 @@
1
+ # Priority system for policy rules:
2
+ # - Higher priority numbers win over lower priority numbers
3
+ # - When multiple rules match, the highest priority rule is applied
4
+ # - Rules are evaluated in order of priority (highest first)
5
+ #
6
+ # Priority bands (tiers):
7
+ # - Default policies (TOML): 1 + priority/1000 (e.g., priority 100 → 1.100)
8
+ # - User policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Admin policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ #
11
+ # This ensures Admin > User > Default hierarchy is always preserved,
12
+ # while allowing user-specified priorities to work within each tier.
13
+ #
14
+ # Settings-based and dynamic rules (all in user tier 2.x):
15
+ # 2.95: Tools that the user has selected as "Always Allow" in the interactive UI
16
+ # 2.9: MCP servers excluded list (security: persistent server blocks)
17
+ # 2.4: Command line flag --exclude-tools (explicit temporary blocks)
18
+ # 2.3: Command line flag --allowed-tools (explicit temporary allows)
19
+ # 2.2: MCP servers with trust=true (persistent trusted servers)
20
+ # 2.1: MCP servers allowed list (persistent general server allows)
21
+ #
22
+ # TOML policy priorities (before transformation):
23
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
24
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
25
+ # 50: Read-only tools (becomes 1.050 in default tier)
26
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
27
+
28
+ [[rule]]
29
+ decision = "allow"
30
+ priority = 999
31
+ modes = ["yolo"]
@@ -0,0 +1,32 @@
1
+ (version 1)
2
+
3
+ ;; allow everything by default
4
+ (allow default)
5
+
6
+ ;; deny all writes EXCEPT under specific paths
7
+ (deny file-write*)
8
+ (allow file-write*
9
+ (subpath (param "TARGET_DIR"))
10
+ (subpath (param "TMP_DIR"))
11
+ (subpath (param "CACHE_DIR"))
12
+ (subpath (string-append (param "HOME_DIR") "/.codefly"))
13
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
14
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
15
+ (subpath (string-append (param "HOME_DIR") "/.gitconfig"))
16
+ ;; Allow writes to included directories from --include-directories
17
+ (subpath (param "INCLUDE_DIR_0"))
18
+ (subpath (param "INCLUDE_DIR_1"))
19
+ (subpath (param "INCLUDE_DIR_2"))
20
+ (subpath (param "INCLUDE_DIR_3"))
21
+ (subpath (param "INCLUDE_DIR_4"))
22
+ (literal "/dev/stdout")
23
+ (literal "/dev/stderr")
24
+ (literal "/dev/null")
25
+ )
26
+
27
+ ;; deny all inbound network traffic EXCEPT on debugger port
28
+ (deny network-inbound)
29
+ (allow network-inbound (local ip "localhost:9229"))
30
+
31
+ ;; deny all outbound network traffic
32
+ (deny network-outbound)
@@ -0,0 +1,27 @@
1
+ (version 1)
2
+
3
+ ;; allow everything by default
4
+ (allow default)
5
+
6
+ ;; deny all writes EXCEPT under specific paths
7
+ (deny file-write*)
8
+ (allow file-write*
9
+ (subpath (param "TARGET_DIR"))
10
+ (subpath (param "TMP_DIR"))
11
+ (subpath (param "CACHE_DIR"))
12
+ (subpath (string-append (param "HOME_DIR") "/.codefly"))
13
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
14
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
15
+ (subpath (string-append (param "HOME_DIR") "/.gitconfig"))
16
+ ;; Allow writes to included directories from --include-directories
17
+ (subpath (param "INCLUDE_DIR_0"))
18
+ (subpath (param "INCLUDE_DIR_1"))
19
+ (subpath (param "INCLUDE_DIR_2"))
20
+ (subpath (param "INCLUDE_DIR_3"))
21
+ (subpath (param "INCLUDE_DIR_4"))
22
+ (literal "/dev/stdout")
23
+ (literal "/dev/stderr")
24
+ (literal "/dev/null")
25
+ (literal "/dev/ptmx")
26
+ (regex #"^/dev/ttys[0-9]*$")
27
+ )
@@ -0,0 +1,37 @@
1
+ (version 1)
2
+
3
+ ;; allow everything by default
4
+ (allow default)
5
+
6
+ ;; deny all writes EXCEPT under specific paths
7
+ (deny file-write*)
8
+ (allow file-write*
9
+ (subpath (param "TARGET_DIR"))
10
+ (subpath (param "TMP_DIR"))
11
+ (subpath (param "CACHE_DIR"))
12
+ (subpath (string-append (param "HOME_DIR") "/.codefly"))
13
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
14
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
15
+ (subpath (string-append (param "HOME_DIR") "/.gitconfig"))
16
+ ;; Allow writes to included directories from --include-directories
17
+ (subpath (param "INCLUDE_DIR_0"))
18
+ (subpath (param "INCLUDE_DIR_1"))
19
+ (subpath (param "INCLUDE_DIR_2"))
20
+ (subpath (param "INCLUDE_DIR_3"))
21
+ (subpath (param "INCLUDE_DIR_4"))
22
+ (literal "/dev/stdout")
23
+ (literal "/dev/stderr")
24
+ (literal "/dev/null")
25
+ )
26
+
27
+ ;; deny all inbound network traffic EXCEPT on debugger port
28
+ (deny network-inbound)
29
+ (allow network-inbound (local ip "localhost:9229"))
30
+
31
+ ;; deny all outbound network traffic EXCEPT through proxy on localhost:8877
32
+ ;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
33
+ ;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
34
+ (deny network-outbound)
35
+ (allow network-outbound (remote tcp "localhost:8877"))
36
+
37
+ (allow network-bind (local ip "*:*"))
@@ -0,0 +1,93 @@
1
+ (version 1)
2
+
3
+ ;; deny everything by default
4
+ (deny default)
5
+
6
+ ;; allow reading files from anywhere on host
7
+ (allow file-read*)
8
+
9
+ ;; allow exec/fork (children inherit policy)
10
+ (allow process-exec)
11
+ (allow process-fork)
12
+
13
+ ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
14
+ (allow signal (target self))
15
+
16
+ ;; allow read access to specific information about system
17
+ ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
18
+ (allow sysctl-read
19
+ (sysctl-name "hw.activecpu")
20
+ (sysctl-name "hw.busfrequency_compat")
21
+ (sysctl-name "hw.byteorder")
22
+ (sysctl-name "hw.cacheconfig")
23
+ (sysctl-name "hw.cachelinesize_compat")
24
+ (sysctl-name "hw.cpufamily")
25
+ (sysctl-name "hw.cpufrequency_compat")
26
+ (sysctl-name "hw.cputype")
27
+ (sysctl-name "hw.l1dcachesize_compat")
28
+ (sysctl-name "hw.l1icachesize_compat")
29
+ (sysctl-name "hw.l2cachesize_compat")
30
+ (sysctl-name "hw.l3cachesize_compat")
31
+ (sysctl-name "hw.logicalcpu_max")
32
+ (sysctl-name "hw.machine")
33
+ (sysctl-name "hw.ncpu")
34
+ (sysctl-name "hw.nperflevels")
35
+ (sysctl-name "hw.optional.arm.FEAT_BF16")
36
+ (sysctl-name "hw.optional.arm.FEAT_DotProd")
37
+ (sysctl-name "hw.optional.arm.FEAT_FCMA")
38
+ (sysctl-name "hw.optional.arm.FEAT_FHM")
39
+ (sysctl-name "hw.optional.arm.FEAT_FP16")
40
+ (sysctl-name "hw.optional.arm.FEAT_I8MM")
41
+ (sysctl-name "hw.optional.arm.FEAT_JSCVT")
42
+ (sysctl-name "hw.optional.arm.FEAT_LSE")
43
+ (sysctl-name "hw.optional.arm.FEAT_RDM")
44
+ (sysctl-name "hw.optional.arm.FEAT_SHA512")
45
+ (sysctl-name "hw.optional.armv8_2_sha512")
46
+ (sysctl-name "hw.packages")
47
+ (sysctl-name "hw.pagesize_compat")
48
+ (sysctl-name "hw.physicalcpu_max")
49
+ (sysctl-name "hw.tbfrequency_compat")
50
+ (sysctl-name "hw.vectorunit")
51
+ (sysctl-name "kern.hostname")
52
+ (sysctl-name "kern.maxfilesperproc")
53
+ (sysctl-name "kern.osproductversion")
54
+ (sysctl-name "kern.osrelease")
55
+ (sysctl-name "kern.ostype")
56
+ (sysctl-name "kern.osvariant_status")
57
+ (sysctl-name "kern.osversion")
58
+ (sysctl-name "kern.secure_kernel")
59
+ (sysctl-name "kern.usrstack64")
60
+ (sysctl-name "kern.version")
61
+ (sysctl-name "sysctl.proc_cputype")
62
+ (sysctl-name-prefix "hw.perflevel")
63
+ )
64
+
65
+ ;; allow writes to specific paths
66
+ (allow file-write*
67
+ (subpath (param "TARGET_DIR"))
68
+ (subpath (param "TMP_DIR"))
69
+ (subpath (param "CACHE_DIR"))
70
+ (subpath (string-append (param "HOME_DIR") "/.codefly"))
71
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
72
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
73
+ (subpath (string-append (param "HOME_DIR") "/.gitconfig"))
74
+ ;; Allow writes to included directories from --include-directories
75
+ (subpath (param "INCLUDE_DIR_0"))
76
+ (subpath (param "INCLUDE_DIR_1"))
77
+ (subpath (param "INCLUDE_DIR_2"))
78
+ (subpath (param "INCLUDE_DIR_3"))
79
+ (subpath (param "INCLUDE_DIR_4"))
80
+ (literal "/dev/stdout")
81
+ (literal "/dev/stderr")
82
+ (literal "/dev/null")
83
+ )
84
+
85
+ ;; allow communication with sysmond for process listing (e.g. for pgrep)
86
+ (allow mach-lookup (global-name "com.apple.sysmond"))
87
+
88
+ ;; enable terminal access required by ink
89
+ ;; fixes setRawMode EPERM failure (at node:tty:81:24)
90
+ (allow file-ioctl (regex #"^/dev/tty.*"))
91
+
92
+ ;; allow inbound network traffic on debugger port
93
+ (allow network-inbound (local ip "localhost:9229"))
@@ -0,0 +1,96 @@
1
+ (version 1)
2
+
3
+ ;; deny everything by default
4
+ (deny default)
5
+
6
+ ;; allow reading files from anywhere on host
7
+ (allow file-read*)
8
+
9
+ ;; allow exec/fork (children inherit policy)
10
+ (allow process-exec)
11
+ (allow process-fork)
12
+
13
+ ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
14
+ (allow signal (target self))
15
+
16
+ ;; allow read access to specific information about system
17
+ ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
18
+ (allow sysctl-read
19
+ (sysctl-name "hw.activecpu")
20
+ (sysctl-name "hw.busfrequency_compat")
21
+ (sysctl-name "hw.byteorder")
22
+ (sysctl-name "hw.cacheconfig")
23
+ (sysctl-name "hw.cachelinesize_compat")
24
+ (sysctl-name "hw.cpufamily")
25
+ (sysctl-name "hw.cpufrequency_compat")
26
+ (sysctl-name "hw.cputype")
27
+ (sysctl-name "hw.l1dcachesize_compat")
28
+ (sysctl-name "hw.l1icachesize_compat")
29
+ (sysctl-name "hw.l2cachesize_compat")
30
+ (sysctl-name "hw.l3cachesize_compat")
31
+ (sysctl-name "hw.logicalcpu_max")
32
+ (sysctl-name "hw.machine")
33
+ (sysctl-name "hw.ncpu")
34
+ (sysctl-name "hw.nperflevels")
35
+ (sysctl-name "hw.optional.arm.FEAT_BF16")
36
+ (sysctl-name "hw.optional.arm.FEAT_DotProd")
37
+ (sysctl-name "hw.optional.arm.FEAT_FCMA")
38
+ (sysctl-name "hw.optional.arm.FEAT_FHM")
39
+ (sysctl-name "hw.optional.arm.FEAT_FP16")
40
+ (sysctl-name "hw.optional.arm.FEAT_I8MM")
41
+ (sysctl-name "hw.optional.arm.FEAT_JSCVT")
42
+ (sysctl-name "hw.optional.arm.FEAT_LSE")
43
+ (sysctl-name "hw.optional.arm.FEAT_RDM")
44
+ (sysctl-name "hw.optional.arm.FEAT_SHA512")
45
+ (sysctl-name "hw.optional.armv8_2_sha512")
46
+ (sysctl-name "hw.packages")
47
+ (sysctl-name "hw.pagesize_compat")
48
+ (sysctl-name "hw.physicalcpu_max")
49
+ (sysctl-name "hw.tbfrequency_compat")
50
+ (sysctl-name "hw.vectorunit")
51
+ (sysctl-name "kern.hostname")
52
+ (sysctl-name "kern.maxfilesperproc")
53
+ (sysctl-name "kern.osproductversion")
54
+ (sysctl-name "kern.osrelease")
55
+ (sysctl-name "kern.ostype")
56
+ (sysctl-name "kern.osvariant_status")
57
+ (sysctl-name "kern.osversion")
58
+ (sysctl-name "kern.secure_kernel")
59
+ (sysctl-name "kern.usrstack64")
60
+ (sysctl-name "kern.version")
61
+ (sysctl-name "sysctl.proc_cputype")
62
+ (sysctl-name-prefix "hw.perflevel")
63
+ )
64
+
65
+ ;; allow writes to specific paths
66
+ (allow file-write*
67
+ (subpath (param "TARGET_DIR"))
68
+ (subpath (param "TMP_DIR"))
69
+ (subpath (param "CACHE_DIR"))
70
+ (subpath (string-append (param "HOME_DIR") "/.codefly"))
71
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
72
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
73
+ (subpath (string-append (param "HOME_DIR") "/.gitconfig"))
74
+ ;; Allow writes to included directories from --include-directories
75
+ (subpath (param "INCLUDE_DIR_0"))
76
+ (subpath (param "INCLUDE_DIR_1"))
77
+ (subpath (param "INCLUDE_DIR_2"))
78
+ (subpath (param "INCLUDE_DIR_3"))
79
+ (subpath (param "INCLUDE_DIR_4"))
80
+ (literal "/dev/stdout")
81
+ (literal "/dev/stderr")
82
+ (literal "/dev/null")
83
+ )
84
+
85
+ ;; allow communication with sysmond for process listing (e.g. for pgrep)
86
+ (allow mach-lookup (global-name "com.apple.sysmond"))
87
+
88
+ ;; enable terminal access required by ink
89
+ ;; fixes setRawMode EPERM failure (at node:tty:81:24)
90
+ (allow file-ioctl (regex #"^/dev/tty.*"))
91
+
92
+ ;; allow inbound network traffic on debugger port
93
+ (allow network-inbound (local ip "localhost:9229"))
94
+
95
+ ;; allow all outbound network traffic
96
+ (allow network-outbound)