@dgxo/mashadevcli 1.1.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 (140) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
  7. package/bundle/docs/CONTRIBUTING.md +1 -0
  8. package/bundle/docs/admin/enterprise-controls.md +115 -0
  9. package/bundle/docs/assets/connected_devtools.png +0 -0
  10. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  13. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  14. package/bundle/docs/assets/release_patch.png +0 -0
  15. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  16. package/bundle/docs/assets/theme-ansi.png +0 -0
  17. package/bundle/docs/assets/theme-atom-one.png +0 -0
  18. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  19. package/bundle/docs/assets/theme-ayu.png +0 -0
  20. package/bundle/docs/assets/theme-custom.png +0 -0
  21. package/bundle/docs/assets/theme-default-light.png +0 -0
  22. package/bundle/docs/assets/theme-default.png +0 -0
  23. package/bundle/docs/assets/theme-dracula.png +0 -0
  24. package/bundle/docs/assets/theme-github-light.png +0 -0
  25. package/bundle/docs/assets/theme-github.png +0 -0
  26. package/bundle/docs/assets/theme-google-light.png +0 -0
  27. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  28. package/bundle/docs/changelogs/index.md +867 -0
  29. package/bundle/docs/changelogs/latest.md +208 -0
  30. package/bundle/docs/changelogs/preview.md +187 -0
  31. package/bundle/docs/cli/checkpointing.md +93 -0
  32. package/bundle/docs/cli/cli-reference.md +115 -0
  33. package/bundle/docs/cli/creating-skills.md +80 -0
  34. package/bundle/docs/cli/custom-commands.md +327 -0
  35. package/bundle/docs/cli/enterprise.md +604 -0
  36. package/bundle/docs/cli/gemini-ignore.md +71 -0
  37. package/bundle/docs/cli/gemini-md.md +116 -0
  38. package/bundle/docs/cli/generation-settings.md +210 -0
  39. package/bundle/docs/cli/headless.md +50 -0
  40. package/bundle/docs/cli/model-routing.md +42 -0
  41. package/bundle/docs/cli/model.md +53 -0
  42. package/bundle/docs/cli/plan-mode.md +375 -0
  43. package/bundle/docs/cli/rewind.md +51 -0
  44. package/bundle/docs/cli/sandbox.md +257 -0
  45. package/bundle/docs/cli/session-management.md +184 -0
  46. package/bundle/docs/cli/settings.md +165 -0
  47. package/bundle/docs/cli/skills.md +134 -0
  48. package/bundle/docs/cli/system-prompt.md +125 -0
  49. package/bundle/docs/cli/telemetry.md +922 -0
  50. package/bundle/docs/cli/themes.md +269 -0
  51. package/bundle/docs/cli/token-caching.md +20 -0
  52. package/bundle/docs/cli/trusted-folders.md +126 -0
  53. package/bundle/docs/cli/tutorials/automation.md +283 -0
  54. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  55. package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
  56. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  57. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  58. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  59. package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
  60. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  61. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  62. package/bundle/docs/core/index.md +107 -0
  63. package/bundle/docs/core/remote-agents.md +84 -0
  64. package/bundle/docs/core/subagents.md +307 -0
  65. package/bundle/docs/examples/proxy-script.md +83 -0
  66. package/bundle/docs/extensions/best-practices.md +188 -0
  67. package/bundle/docs/extensions/index.md +61 -0
  68. package/bundle/docs/extensions/reference.md +333 -0
  69. package/bundle/docs/extensions/releasing.md +154 -0
  70. package/bundle/docs/extensions/writing-extensions.md +308 -0
  71. package/bundle/docs/get-started/authentication.md +402 -0
  72. package/bundle/docs/get-started/examples.md +139 -0
  73. package/bundle/docs/get-started/gemini-3.md +115 -0
  74. package/bundle/docs/get-started/index.md +82 -0
  75. package/bundle/docs/get-started/installation.md +174 -0
  76. package/bundle/docs/hooks/best-practices.md +709 -0
  77. package/bundle/docs/hooks/index.md +164 -0
  78. package/bundle/docs/hooks/reference.md +330 -0
  79. package/bundle/docs/hooks/writing-hooks.md +474 -0
  80. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  81. package/bundle/docs/ide-integration/index.md +224 -0
  82. package/bundle/docs/index.md +141 -0
  83. package/bundle/docs/integration-tests.md +211 -0
  84. package/bundle/docs/issue-and-pr-automation.md +172 -0
  85. package/bundle/docs/local-development.md +134 -0
  86. package/bundle/docs/mermaid/context.mmd +103 -0
  87. package/bundle/docs/mermaid/render-path.mmd +64 -0
  88. package/bundle/docs/npm.md +62 -0
  89. package/bundle/docs/redirects.json +20 -0
  90. package/bundle/docs/reference/commands.md +526 -0
  91. package/bundle/docs/reference/configuration.md +1786 -0
  92. package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
  93. package/bundle/docs/reference/memport.md +246 -0
  94. package/bundle/docs/reference/policy-engine.md +364 -0
  95. package/bundle/docs/reference/tools.md +106 -0
  96. package/bundle/docs/release-confidence.md +164 -0
  97. package/bundle/docs/releases.md +540 -0
  98. package/bundle/docs/resources/faq.md +175 -0
  99. package/bundle/docs/resources/quota-and-pricing.md +165 -0
  100. package/bundle/docs/resources/tos-privacy.md +102 -0
  101. package/bundle/docs/resources/troubleshooting.md +176 -0
  102. package/bundle/docs/resources/uninstall.md +56 -0
  103. package/bundle/docs/sidebar.json +233 -0
  104. package/bundle/docs/tools/activate-skill.md +43 -0
  105. package/bundle/docs/tools/ask-user.md +95 -0
  106. package/bundle/docs/tools/file-system.md +129 -0
  107. package/bundle/docs/tools/internal-docs.md +46 -0
  108. package/bundle/docs/tools/mcp-server.md +1150 -0
  109. package/bundle/docs/tools/memory.md +35 -0
  110. package/bundle/docs/tools/planning.md +58 -0
  111. package/bundle/docs/tools/shell.md +216 -0
  112. package/bundle/docs/tools/todos.md +35 -0
  113. package/bundle/docs/tools/web-fetch.md +35 -0
  114. package/bundle/docs/tools/web-search.md +32 -0
  115. package/bundle/docs/update/update-guide.md +111 -0
  116. package/bundle/masha.js +563471 -0
  117. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
  118. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
  119. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
  120. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
  121. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
  122. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
  123. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
  124. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
  125. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
  126. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
  127. package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
  128. package/bundle/policies/conseca.toml +6 -0
  129. package/bundle/policies/discovered.toml +8 -0
  130. package/bundle/policies/plan.toml +109 -0
  131. package/bundle/policies/read-only.toml +53 -0
  132. package/bundle/policies/write.toml +80 -0
  133. package/bundle/policies/yolo.toml +54 -0
  134. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  135. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  136. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  137. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  138. package/bundle/sandbox-macos-strict-open.sb +131 -0
  139. package/bundle/sandbox-macos-strict-proxied.sb +133 -0
  140. package/package.json +169 -0
@@ -0,0 +1,80 @@
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
+ # - Extension policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Workspace policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ # - User policies (TOML): 4 + priority/1000 (e.g., priority 100 → 4.100)
11
+ # - Admin policies (TOML): 5 + priority/1000 (e.g., priority 100 → 5.100)
12
+ #
13
+ # This ensures Admin > User > Workspace > Extension > Default hierarchy is always preserved,
14
+ # while allowing user-specified priorities to work within each tier.
15
+ #
16
+ # Settings-based and dynamic rules (all in user tier 4.x):
17
+ # 4.95: Tools that the user has selected as "Always Allow" in the interactive UI
18
+ # 4.9: MCP servers excluded list (security: persistent server blocks)
19
+ # 4.4: Command line flag --exclude-tools (explicit temporary blocks)
20
+ # 4.3: Command line flag --allowed-tools (explicit temporary allows)
21
+ # 4.2: MCP servers with trust=true (persistent trusted servers)
22
+ # 4.1: MCP servers allowed list (persistent general server allows)
23
+ #
24
+ # TOML policy priorities (before transformation):
25
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
26
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
27
+ # 50: Read-only tools (becomes 1.050 in default tier)
28
+ # 999: YOLO mode allow-all (becomes 1.999 in default tier)
29
+
30
+ [[rule]]
31
+ toolName = "replace"
32
+ decision = "ask_user"
33
+ priority = 10
34
+
35
+ [[rule]]
36
+ toolName = "replace"
37
+ decision = "allow"
38
+ priority = 15
39
+ modes = ["autoEdit"]
40
+
41
+ [rule.safety_checker]
42
+ type = "in-process"
43
+ name = "allowed-path"
44
+ required_context = ["environment"]
45
+
46
+ [[rule]]
47
+ toolName = "save_memory"
48
+ decision = "ask_user"
49
+ priority = 10
50
+
51
+ [[rule]]
52
+ toolName = "run_shell_command"
53
+ decision = "ask_user"
54
+ priority = 10
55
+
56
+ [[rule]]
57
+ toolName = "write_file"
58
+ decision = "ask_user"
59
+ priority = 10
60
+
61
+ [[rule]]
62
+ toolName = "activate_skill"
63
+ decision = "ask_user"
64
+ priority = 10
65
+
66
+ [[rule]]
67
+ toolName = "write_file"
68
+ decision = "allow"
69
+ priority = 15
70
+ modes = ["autoEdit"]
71
+
72
+ [rule.safety_checker]
73
+ type = "in-process"
74
+ name = "allowed-path"
75
+ required_context = ["environment"]
76
+
77
+ [[rule]]
78
+ toolName = "web_fetch"
79
+ decision = "ask_user"
80
+ priority = 10
@@ -0,0 +1,54 @@
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
+ # - Extension policies (TOML): 2 + priority/1000 (e.g., priority 100 → 2.100)
9
+ # - Workspace policies (TOML): 3 + priority/1000 (e.g., priority 100 → 3.100)
10
+ # - User policies (TOML): 4 + priority/1000 (e.g., priority 100 → 4.100)
11
+ # - Admin policies (TOML): 5 + priority/1000 (e.g., priority 100 → 5.100)
12
+ #
13
+ # This ensures Admin > User > Workspace > Extension > Default hierarchy is always preserved,
14
+ # while allowing user-specified priorities to work within each tier.
15
+ #
16
+ # Settings-based and dynamic rules (all in user tier 4.x):
17
+ # 4.95: Tools that the user has selected as "Always Allow" in the interactive UI
18
+ # 4.9: MCP servers excluded list (security: persistent server blocks)
19
+ # 4.4: Command line flag --exclude-tools (explicit temporary blocks)
20
+ # 4.3: Command line flag --allowed-tools (explicit temporary allows)
21
+ # 4.2: MCP servers with trust=true (persistent trusted servers)
22
+ # 4.1: MCP servers allowed list (persistent general server allows)
23
+ #
24
+ # TOML policy priorities (before transformation):
25
+ # 10: Write tools default to ASK_USER (becomes 1.010 in default tier)
26
+ # 15: Auto-edit tool override (becomes 1.015 in default tier)
27
+ # 50: Read-only tools (becomes 1.050 in default tier)
28
+ # 998: YOLO mode allow-all (becomes 1.998 in default tier)
29
+ # 999: Ask-user tool (becomes 1.999 in default tier)
30
+
31
+ # Ask-user tool always requires user interaction, even in YOLO mode.
32
+ # This ensures the model can gather user preferences/decisions when needed.
33
+ # Note: In non-interactive mode, this decision is converted to DENY by the policy engine.
34
+ [[rule]]
35
+ toolName = "ask_user"
36
+ decision = "ask_user"
37
+ priority = 999
38
+ modes = ["yolo"]
39
+
40
+ # Plan mode transitions are blocked in YOLO mode to maintain state consistency
41
+ # and because planning currently requires human interaction (plan approval),
42
+ # which conflicts with YOLO's autonomous nature.
43
+ [[rule]]
44
+ toolName = ["enter_plan_mode", "exit_plan_mode"]
45
+ decision = "deny"
46
+ priority = 999
47
+ modes = ["yolo"]
48
+
49
+ # Allow everything else in YOLO mode
50
+ [[rule]]
51
+ decision = "allow"
52
+ priority = 998
53
+ modes = ["yolo"]
54
+ allow_redirection = true
@@ -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") "/.gemini"))
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") "/.gemini"))
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,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") "/.gemini"))
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)
@@ -0,0 +1,98 @@
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") "/.gemini"))
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 outbound network traffic through proxy on localhost:8877
96
+ ;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
97
+ ;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
98
+ (allow network-outbound (remote tcp "localhost:8877"))
@@ -0,0 +1,131 @@
1
+ (version 1)
2
+
3
+ ;; deny everything by default
4
+ (deny default)
5
+
6
+ ;; allow reading ONLY from working directory, system paths, and essential user paths
7
+ (allow file-read*
8
+ (literal "/")
9
+ (subpath (param "TARGET_DIR"))
10
+ (subpath (param "TMP_DIR"))
11
+ (subpath (param "CACHE_DIR"))
12
+ ;; Only allow reading essential dotfiles/directories under HOME, not the entire HOME
13
+ (subpath (string-append (param "HOME_DIR") "/.gemini"))
14
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
15
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
16
+ (literal (string-append (param "HOME_DIR") "/.gitconfig"))
17
+ (subpath (string-append (param "HOME_DIR") "/.nvm"))
18
+ (subpath (string-append (param "HOME_DIR") "/.fnm"))
19
+ (subpath (string-append (param "HOME_DIR") "/.node"))
20
+ (subpath (string-append (param "HOME_DIR") "/.config"))
21
+ ;; Allow reads from included directories
22
+ (subpath (param "INCLUDE_DIR_0"))
23
+ (subpath (param "INCLUDE_DIR_1"))
24
+ (subpath (param "INCLUDE_DIR_2"))
25
+ (subpath (param "INCLUDE_DIR_3"))
26
+ (subpath (param "INCLUDE_DIR_4"))
27
+ ;; System paths required for Node.js, shell, and common tools
28
+ (subpath "/usr")
29
+ (subpath "/bin")
30
+ (subpath "/sbin")
31
+ (subpath "/Library")
32
+ (subpath "/System")
33
+ (subpath "/private")
34
+ (subpath "/dev")
35
+ (subpath "/etc")
36
+ (subpath "/opt")
37
+ (subpath "/Applications")
38
+ )
39
+
40
+ ;; allow path traversal everywhere (metadata only: stat/lstat, NOT readdir or file content)
41
+ ;; this is needed for Node.js module resolution to traverse intermediate directories
42
+ (allow file-read-metadata)
43
+
44
+ ;; allow exec/fork (children inherit policy)
45
+ (allow process-exec)
46
+ (allow process-fork)
47
+
48
+ ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
49
+ (allow signal (target self))
50
+
51
+ ;; allow read access to specific information about system
52
+ ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
53
+ (allow sysctl-read
54
+ (sysctl-name "hw.activecpu")
55
+ (sysctl-name "hw.busfrequency_compat")
56
+ (sysctl-name "hw.byteorder")
57
+ (sysctl-name "hw.cacheconfig")
58
+ (sysctl-name "hw.cachelinesize_compat")
59
+ (sysctl-name "hw.cpufamily")
60
+ (sysctl-name "hw.cpufrequency_compat")
61
+ (sysctl-name "hw.cputype")
62
+ (sysctl-name "hw.l1dcachesize_compat")
63
+ (sysctl-name "hw.l1icachesize_compat")
64
+ (sysctl-name "hw.l2cachesize_compat")
65
+ (sysctl-name "hw.l3cachesize_compat")
66
+ (sysctl-name "hw.logicalcpu_max")
67
+ (sysctl-name "hw.machine")
68
+ (sysctl-name "hw.ncpu")
69
+ (sysctl-name "hw.nperflevels")
70
+ (sysctl-name "hw.optional.arm.FEAT_BF16")
71
+ (sysctl-name "hw.optional.arm.FEAT_DotProd")
72
+ (sysctl-name "hw.optional.arm.FEAT_FCMA")
73
+ (sysctl-name "hw.optional.arm.FEAT_FHM")
74
+ (sysctl-name "hw.optional.arm.FEAT_FP16")
75
+ (sysctl-name "hw.optional.arm.FEAT_I8MM")
76
+ (sysctl-name "hw.optional.arm.FEAT_JSCVT")
77
+ (sysctl-name "hw.optional.arm.FEAT_LSE")
78
+ (sysctl-name "hw.optional.arm.FEAT_RDM")
79
+ (sysctl-name "hw.optional.arm.FEAT_SHA512")
80
+ (sysctl-name "hw.optional.armv8_2_sha512")
81
+ (sysctl-name "hw.packages")
82
+ (sysctl-name "hw.pagesize_compat")
83
+ (sysctl-name "hw.physicalcpu_max")
84
+ (sysctl-name "hw.tbfrequency_compat")
85
+ (sysctl-name "hw.vectorunit")
86
+ (sysctl-name "kern.hostname")
87
+ (sysctl-name "kern.maxfilesperproc")
88
+ (sysctl-name "kern.osproductversion")
89
+ (sysctl-name "kern.osrelease")
90
+ (sysctl-name "kern.ostype")
91
+ (sysctl-name "kern.osvariant_status")
92
+ (sysctl-name "kern.osversion")
93
+ (sysctl-name "kern.secure_kernel")
94
+ (sysctl-name "kern.usrstack64")
95
+ (sysctl-name "kern.version")
96
+ (sysctl-name "sysctl.proc_cputype")
97
+ (sysctl-name-prefix "hw.perflevel")
98
+ )
99
+
100
+ ;; allow writes to specific paths
101
+ (allow file-write*
102
+ (subpath (param "TARGET_DIR"))
103
+ (subpath (param "TMP_DIR"))
104
+ (subpath (param "CACHE_DIR"))
105
+ (subpath (string-append (param "HOME_DIR") "/.gemini"))
106
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
107
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
108
+ (literal (string-append (param "HOME_DIR") "/.gitconfig"))
109
+ ;; Allow writes to included directories from --include-directories
110
+ (subpath (param "INCLUDE_DIR_0"))
111
+ (subpath (param "INCLUDE_DIR_1"))
112
+ (subpath (param "INCLUDE_DIR_2"))
113
+ (subpath (param "INCLUDE_DIR_3"))
114
+ (subpath (param "INCLUDE_DIR_4"))
115
+ (literal "/dev/stdout")
116
+ (literal "/dev/stderr")
117
+ (literal "/dev/null")
118
+ )
119
+
120
+ ;; allow communication with sysmond for process listing (e.g. for pgrep)
121
+ (allow mach-lookup (global-name "com.apple.sysmond"))
122
+
123
+ ;; enable terminal access required by ink
124
+ ;; fixes setRawMode EPERM failure (at node:tty:81:24)
125
+ (allow file-ioctl (regex #"^/dev/tty.*"))
126
+
127
+ ;; allow inbound network traffic on debugger port
128
+ (allow network-inbound (local ip "localhost:9229"))
129
+
130
+ ;; allow all outbound network traffic
131
+ (allow network-outbound)
@@ -0,0 +1,133 @@
1
+ (version 1)
2
+
3
+ ;; deny everything by default
4
+ (deny default)
5
+
6
+ ;; allow reading ONLY from working directory, system paths, and essential user paths
7
+ (allow file-read*
8
+ (literal "/")
9
+ (subpath (param "TARGET_DIR"))
10
+ (subpath (param "TMP_DIR"))
11
+ (subpath (param "CACHE_DIR"))
12
+ ;; Only allow reading essential dotfiles/directories under HOME, not the entire HOME
13
+ (subpath (string-append (param "HOME_DIR") "/.gemini"))
14
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
15
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
16
+ (literal (string-append (param "HOME_DIR") "/.gitconfig"))
17
+ (subpath (string-append (param "HOME_DIR") "/.nvm"))
18
+ (subpath (string-append (param "HOME_DIR") "/.fnm"))
19
+ (subpath (string-append (param "HOME_DIR") "/.node"))
20
+ (subpath (string-append (param "HOME_DIR") "/.config"))
21
+ ;; Allow reads from included directories
22
+ (subpath (param "INCLUDE_DIR_0"))
23
+ (subpath (param "INCLUDE_DIR_1"))
24
+ (subpath (param "INCLUDE_DIR_2"))
25
+ (subpath (param "INCLUDE_DIR_3"))
26
+ (subpath (param "INCLUDE_DIR_4"))
27
+ ;; System paths required for Node.js, shell, and common tools
28
+ (subpath "/usr")
29
+ (subpath "/bin")
30
+ (subpath "/sbin")
31
+ (subpath "/Library")
32
+ (subpath "/System")
33
+ (subpath "/private")
34
+ (subpath "/dev")
35
+ (subpath "/etc")
36
+ (subpath "/opt")
37
+ (subpath "/Applications")
38
+ )
39
+
40
+ ;; allow path traversal everywhere (metadata only: stat/lstat, NOT readdir or file content)
41
+ ;; this is needed for Node.js module resolution to traverse intermediate directories
42
+ (allow file-read-metadata)
43
+
44
+ ;; allow exec/fork (children inherit policy)
45
+ (allow process-exec)
46
+ (allow process-fork)
47
+
48
+ ;; allow signals to self, e.g. SIGPIPE on write to closed pipe
49
+ (allow signal (target self))
50
+
51
+ ;; allow read access to specific information about system
52
+ ;; from https://source.chromium.org/chromium/chromium/src/+/main:sandbox/policy/mac/common.sb;l=273-319;drc=7b3962fe2e5fc9e2ee58000dc8fbf3429d84d3bd
53
+ (allow sysctl-read
54
+ (sysctl-name "hw.activecpu")
55
+ (sysctl-name "hw.busfrequency_compat")
56
+ (sysctl-name "hw.byteorder")
57
+ (sysctl-name "hw.cacheconfig")
58
+ (sysctl-name "hw.cachelinesize_compat")
59
+ (sysctl-name "hw.cpufamily")
60
+ (sysctl-name "hw.cpufrequency_compat")
61
+ (sysctl-name "hw.cputype")
62
+ (sysctl-name "hw.l1dcachesize_compat")
63
+ (sysctl-name "hw.l1icachesize_compat")
64
+ (sysctl-name "hw.l2cachesize_compat")
65
+ (sysctl-name "hw.l3cachesize_compat")
66
+ (sysctl-name "hw.logicalcpu_max")
67
+ (sysctl-name "hw.machine")
68
+ (sysctl-name "hw.ncpu")
69
+ (sysctl-name "hw.nperflevels")
70
+ (sysctl-name "hw.optional.arm.FEAT_BF16")
71
+ (sysctl-name "hw.optional.arm.FEAT_DotProd")
72
+ (sysctl-name "hw.optional.arm.FEAT_FCMA")
73
+ (sysctl-name "hw.optional.arm.FEAT_FHM")
74
+ (sysctl-name "hw.optional.arm.FEAT_FP16")
75
+ (sysctl-name "hw.optional.arm.FEAT_I8MM")
76
+ (sysctl-name "hw.optional.arm.FEAT_JSCVT")
77
+ (sysctl-name "hw.optional.arm.FEAT_LSE")
78
+ (sysctl-name "hw.optional.arm.FEAT_RDM")
79
+ (sysctl-name "hw.optional.arm.FEAT_SHA512")
80
+ (sysctl-name "hw.optional.armv8_2_sha512")
81
+ (sysctl-name "hw.packages")
82
+ (sysctl-name "hw.pagesize_compat")
83
+ (sysctl-name "hw.physicalcpu_max")
84
+ (sysctl-name "hw.tbfrequency_compat")
85
+ (sysctl-name "hw.vectorunit")
86
+ (sysctl-name "kern.hostname")
87
+ (sysctl-name "kern.maxfilesperproc")
88
+ (sysctl-name "kern.osproductversion")
89
+ (sysctl-name "kern.osrelease")
90
+ (sysctl-name "kern.ostype")
91
+ (sysctl-name "kern.osvariant_status")
92
+ (sysctl-name "kern.osversion")
93
+ (sysctl-name "kern.secure_kernel")
94
+ (sysctl-name "kern.usrstack64")
95
+ (sysctl-name "kern.version")
96
+ (sysctl-name "sysctl.proc_cputype")
97
+ (sysctl-name-prefix "hw.perflevel")
98
+ )
99
+
100
+ ;; allow writes to specific paths
101
+ (allow file-write*
102
+ (subpath (param "TARGET_DIR"))
103
+ (subpath (param "TMP_DIR"))
104
+ (subpath (param "CACHE_DIR"))
105
+ (subpath (string-append (param "HOME_DIR") "/.gemini"))
106
+ (subpath (string-append (param "HOME_DIR") "/.npm"))
107
+ (subpath (string-append (param "HOME_DIR") "/.cache"))
108
+ (literal (string-append (param "HOME_DIR") "/.gitconfig"))
109
+ ;; Allow writes to included directories from --include-directories
110
+ (subpath (param "INCLUDE_DIR_0"))
111
+ (subpath (param "INCLUDE_DIR_1"))
112
+ (subpath (param "INCLUDE_DIR_2"))
113
+ (subpath (param "INCLUDE_DIR_3"))
114
+ (subpath (param "INCLUDE_DIR_4"))
115
+ (literal "/dev/stdout")
116
+ (literal "/dev/stderr")
117
+ (literal "/dev/null")
118
+ )
119
+
120
+ ;; allow communication with sysmond for process listing (e.g. for pgrep)
121
+ (allow mach-lookup (global-name "com.apple.sysmond"))
122
+
123
+ ;; enable terminal access required by ink
124
+ ;; fixes setRawMode EPERM failure (at node:tty:81:24)
125
+ (allow file-ioctl (regex #"^/dev/tty.*"))
126
+
127
+ ;; allow inbound network traffic on debugger port
128
+ (allow network-inbound (local ip "localhost:9229"))
129
+
130
+ ;; allow outbound network traffic through proxy on localhost:8877
131
+ ;; set `GEMINI_SANDBOX_PROXY_COMMAND=<command>` to run proxy alongside sandbox
132
+ ;; proxy must listen on :::8877 (see docs/examples/proxy-script.md)
133
+ (allow network-outbound (remote tcp "localhost:8877"))