clawmini 0.0.7 → 0.0.9
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/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/.github/workflows/release.yml +49 -0
- package/CHANGELOG.md +36 -0
- package/README.md +5 -4
- package/dist/adapter-discord/index.d.mts.map +1 -1
- package/dist/adapter-discord/index.mjs +465 -282
- package/dist/adapter-discord/index.mjs.map +1 -1
- package/dist/adapter-google-chat/index.mjs +367 -243
- package/dist/adapter-google-chat/index.mjs.map +1 -1
- package/dist/cli/index.mjs +684 -24
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lite.mjs +43 -13
- package/dist/cli/lite.mjs.map +1 -1
- package/dist/cli/{propose-policy.mjs → manage-policies.mjs} +270 -47
- package/dist/cli/manage-policies.mjs.map +1 -0
- package/dist/cli/run-host.d.mts +1 -0
- package/dist/cli/run-host.mjs +3090 -0
- package/dist/cli/run-host.mjs.map +1 -0
- package/dist/config-CPFQIGdG.mjs +57 -0
- package/dist/config-CPFQIGdG.mjs.map +1 -0
- package/dist/config-Dvl-Pov4.mjs +76 -0
- package/dist/config-Dvl-Pov4.mjs.map +1 -0
- package/dist/daemon/index.d.mts.map +1 -1
- package/dist/daemon/index.mjs +970 -332
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/supervisor-actions-CiW56eLi.mjs +843 -0
- package/dist/supervisor-actions-CiW56eLi.mjs.map +1 -0
- package/dist/turn-log-buffer-DRgW53gl.mjs +767 -0
- package/dist/turn-log-buffer-DRgW53gl.mjs.map +1 -0
- package/dist/web/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
- package/dist/web/_app/immutable/chunks/BhRSsUCh.js +2 -0
- package/dist/web/_app/immutable/chunks/BiLeM2i1.js +1 -0
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/CME08kGM.js → dist/web/_app/immutable/chunks/BmBj85Ll.js} +1 -1
- package/dist/web/_app/immutable/chunks/BrERcKAH.js +1 -0
- package/dist/web/_app/immutable/chunks/Bv9252RM.js +1 -0
- package/dist/web/_app/immutable/chunks/CIXNBPKi.js +1 -0
- package/dist/web/_app/immutable/chunks/DISKL3GN.js +2 -0
- package/dist/web/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
- package/dist/web/_app/immutable/chunks/DnQ3vS13.js +1 -0
- package/dist/web/_app/immutable/chunks/KsloHTKS.js +1 -0
- package/{web/.svelte-kit/output/client/_app/immutable/chunks/Ck-be5J2.js → dist/web/_app/immutable/chunks/RsHsUj-8.js} +2 -2
- package/dist/web/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
- package/dist/web/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
- package/dist/web/_app/immutable/entry/start.Di0-Jhte.js +1 -0
- package/dist/web/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
- package/dist/web/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
- package/dist/web/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
- package/{web/.svelte-kit/output/client/_app/immutable/nodes/3.Dr0ot9sV.js → dist/web/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
- package/dist/web/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
- package/dist/web/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +12 -12
- package/dist/workspace-oWmVh5mi.mjs +1001 -0
- package/dist/workspace-oWmVh5mi.mjs.map +1 -0
- package/docs/23_adapter_slash_autocomplete/development_log.md +19 -0
- package/docs/23_adapter_slash_autocomplete/notes.md +18 -0
- package/docs/23_adapter_slash_autocomplete/prd.md +46 -0
- package/docs/23_adapter_slash_autocomplete/questions.md +6 -0
- package/docs/23_adapter_slash_autocomplete/tickets.md +21 -0
- package/docs/24_subagent_job_policy_fixes/development_log.md +22 -0
- package/docs/24_subagent_job_policy_fixes/notes.md +28 -0
- package/docs/24_subagent_job_policy_fixes/prd.md +59 -0
- package/docs/24_subagent_job_policy_fixes/questions.md +3 -0
- package/docs/24_subagent_job_policy_fixes/tickets.md +49 -0
- package/docs/25_e2e_test_improvements/development_log.md +30 -0
- package/docs/25_e2e_test_improvements/notes.md +29 -0
- package/docs/25_e2e_test_improvements/prd.md +43 -0
- package/docs/25_e2e_test_improvements/questions.md +12 -0
- package/docs/25_e2e_test_improvements/tickets-2.md +22 -0
- package/docs/25_e2e_test_improvements/tickets.md +22 -0
- package/docs/25_policy_cwd/development_log.md +30 -0
- package/docs/25_policy_cwd/notes.md +28 -0
- package/docs/25_policy_cwd/prd.md +77 -0
- package/docs/25_policy_cwd/questions.md +6 -0
- package/docs/25_policy_cwd/tickets.md +77 -0
- package/docs/CLI_REFERENCE.md +3 -1
- package/docs/PHILOSOPHY.md +35 -0
- package/docs/adapter-visibility/SPEC.md +461 -0
- package/docs/adapter-visibility/SPEC_v2.md +202 -0
- package/docs/auto-update/SPEC.md +344 -0
- package/docs/backups/SPEC.md +296 -0
- package/docs/backups/clawmini.gitignore +69 -0
- package/docs/guides/assets/clawmini-avatar.png +0 -0
- package/docs/guides/backups.md +332 -0
- package/docs/guides/discord_adapter_setup.md +1 -1
- package/docs/guides/google_chat_adapter_setup.md +81 -0
- package/docs/unified-startup/SPEC.md +203 -0
- package/e2e/_helpers/test-environment.test.ts +49 -0
- package/e2e/_helpers/test-environment.ts +548 -0
- package/e2e/adapters/_google-chat-fixtures.ts +340 -0
- package/{src/cli/e2e → e2e/adapters}/adapter-discord.test.ts +22 -23
- package/e2e/adapters/adapter-google-chat-downtime.test.ts +157 -0
- package/e2e/adapters/adapter-google-chat-inbound.test.ts +697 -0
- package/e2e/adapters/adapter-google-chat-outbound.test.ts +297 -0
- package/e2e/adapters/adapter-google-chat-roundtrip.test.ts +56 -0
- package/e2e/adapters/adapter-google-chat-threads.test.ts +1078 -0
- package/e2e/agents/custom-api-env.test.ts +80 -0
- package/e2e/agents/export-lite-func.test.ts +104 -0
- package/e2e/agents/fallbacks.test.ts +124 -0
- package/e2e/agents/interrupt.test.ts +50 -0
- package/e2e/agents/no-reply-necessary.test.ts +57 -0
- package/e2e/agents/session-timeout-subagents.test.ts +76 -0
- package/e2e/agents/subagent-authorization.test.ts +246 -0
- package/e2e/agents/subagent-env.test.ts +49 -0
- package/e2e/agents/subagent-lifecycle.test.ts +782 -0
- package/e2e/agents/subagents-depth.test.ts +47 -0
- package/e2e/cli/agents.test.ts +176 -0
- package/e2e/cli/auto-update.test.ts +741 -0
- package/e2e/cli/basic.test.ts +44 -0
- package/{src/cli/e2e → e2e/cli}/export-lite.test.ts +16 -12
- package/e2e/cli/init-gitignore.test.ts +86 -0
- package/e2e/cli/init.test.ts +76 -0
- package/e2e/cli/messages.test.ts +363 -0
- package/e2e/cli/serve.test.ts +76 -0
- package/{src/cli/e2e → e2e/cli}/skills.test.ts +11 -10
- package/{src/cli/e2e → e2e/daemon}/daemon.test.ts +57 -195
- package/e2e/jobs/agent-jobs.test.ts +216 -0
- package/e2e/jobs/cron.test.ts +64 -0
- package/e2e/jobs/restart.test.ts +108 -0
- package/e2e/policies/approval-session.test.ts +69 -0
- package/e2e/policies/auto-create-policies-file.test.ts +35 -0
- package/e2e/policies/builtin-manage-policies.test.ts +184 -0
- package/e2e/policies/builtin-run-host.test.ts +180 -0
- package/e2e/policies/environment-policies.test.ts +177 -0
- package/e2e/policies/manage-policies.test.ts +566 -0
- package/e2e/policies/output-size.test.ts +98 -0
- package/e2e/policies/policies-context-cwd.test.ts +160 -0
- package/e2e/policies/relative-script-path.test.ts +60 -0
- package/e2e/policies/requests-show.test.ts +135 -0
- package/e2e/policies/requests.test.ts +208 -0
- package/e2e/policies/slash-policies.test.ts +308 -0
- package/e2e/policies/startup-cleanup.test.ts +48 -0
- package/e2e/routers/session-timeout.test.ts +106 -0
- package/e2e/routers/slash-model.test.ts +152 -0
- package/e2e/routers/slash-new.test.ts +50 -0
- package/e2e/routers/slash-restart-adapter.test.ts +96 -0
- package/e2e/routers/slash-restart.test.ts +114 -0
- package/e2e/routers/slash-shutdown.test.ts +55 -0
- package/e2e/routers/slash-stop.test.ts +232 -0
- package/e2e/routers/slash-upgrade.test.ts +88 -0
- package/{src/cli/e2e → e2e/sandbox}/environments.test.ts +14 -13
- package/eslint.config.js +6 -0
- package/napkin.md +1 -1
- package/package.json +8 -3
- package/src/adapter-discord/commands.test.ts +42 -0
- package/src/adapter-discord/commands.ts +33 -0
- package/src/adapter-discord/config.ts +12 -0
- package/src/adapter-discord/forwarder.test.ts +499 -21
- package/src/adapter-discord/forwarder.ts +343 -124
- package/src/adapter-discord/inbound-cache.test.ts +47 -0
- package/src/adapter-discord/inbound-cache.ts +37 -0
- package/src/adapter-discord/index.test.ts +67 -2
- package/src/adapter-discord/index.ts +84 -216
- package/src/adapter-discord/interactions.test.ts +54 -3
- package/src/adapter-discord/interactions.ts +97 -53
- package/src/adapter-discord/processMessage.ts +239 -0
- package/src/adapter-discord/state.ts +1 -0
- package/src/adapter-google-chat/auth.test.ts +9 -5
- package/src/adapter-google-chat/auth.ts +29 -23
- package/src/adapter-google-chat/cards.ts +7 -2
- package/src/adapter-google-chat/client.test.ts +37 -2
- package/src/adapter-google-chat/client.ts +138 -38
- package/src/adapter-google-chat/config.ts +19 -0
- package/src/adapter-google-chat/forwarder.test.ts +81 -56
- package/src/adapter-google-chat/forwarder.ts +394 -185
- package/src/adapter-google-chat/inbound-cache.test.ts +61 -0
- package/src/adapter-google-chat/inbound-cache.ts +36 -0
- package/src/adapter-google-chat/state.test.ts +1 -0
- package/src/adapter-google-chat/state.ts +9 -1
- package/src/adapter-google-chat/subscriptions.ts +8 -6
- package/src/cli/builtin-policies.ts +44 -0
- package/src/cli/commands/agents.ts +59 -5
- package/src/cli/commands/down.ts +54 -2
- package/src/cli/commands/environments.ts +8 -2
- package/src/cli/commands/init.ts +31 -0
- package/src/cli/commands/logs.ts +116 -0
- package/src/cli/commands/policies.ts +6 -4
- package/src/cli/commands/serve.test.ts +67 -0
- package/src/cli/commands/serve.ts +284 -0
- package/src/cli/commands/up.ts +122 -2
- package/src/cli/commands/web-api/agents.ts +3 -2
- package/src/cli/index.ts +4 -0
- package/src/cli/install-detection.test.ts +72 -0
- package/src/cli/install-detection.ts +48 -0
- package/src/cli/lite.ts +54 -22
- package/src/cli/manage-policies-utils.ts +104 -0
- package/src/cli/manage-policies.ts +291 -0
- package/src/cli/run-host.ts +45 -0
- package/src/cli/supervisor-actions.ts +267 -0
- package/src/cli/supervisor-control.test.ts +129 -0
- package/src/cli/supervisor-control.ts +155 -0
- package/src/cli/supervisor-pid.ts +68 -0
- package/src/cli/supervisor.ts +277 -0
- package/src/daemon/agent/agent-context.ts +11 -11
- package/src/daemon/agent/agent-session.ts +8 -1
- package/src/daemon/agent/chat-logger.test.ts +78 -9
- package/src/daemon/agent/chat-logger.ts +25 -5
- package/src/daemon/agent/turn-registry.test.ts +89 -0
- package/src/daemon/agent/turn-registry.ts +94 -0
- package/src/daemon/agent/types.ts +2 -0
- package/src/daemon/api/agent-policy-endpoints.ts +263 -0
- package/src/daemon/api/agent-router.ts +47 -126
- package/src/daemon/api/index.test.ts +1 -0
- package/src/daemon/api/policy-request.test.ts +7 -5
- package/src/daemon/api/router-utils.ts +6 -5
- package/src/daemon/api/subagent-router.ts +110 -74
- package/src/daemon/api/subagent-utils.test.ts +60 -0
- package/src/daemon/api/subagent-utils.ts +113 -87
- package/src/daemon/api/user-router.ts +34 -8
- package/src/daemon/auth.ts +1 -0
- package/src/daemon/cron.test.ts +62 -4
- package/src/daemon/cron.ts +42 -16
- package/src/daemon/events.ts +65 -0
- package/src/daemon/index.ts +24 -1
- package/src/daemon/message-interruption.test.ts +1 -0
- package/src/daemon/message-jobs.test.ts +1 -0
- package/src/daemon/message.ts +78 -14
- package/src/daemon/observation.test.ts +26 -18
- package/src/daemon/pending-replies.test.ts +112 -0
- package/src/daemon/pending-replies.ts +162 -0
- package/src/daemon/policy-request-service.ts +3 -1
- package/src/daemon/policy-utils.test.ts +66 -1
- package/src/daemon/policy-utils.ts +126 -1
- package/src/daemon/request-store.ts +31 -0
- package/src/daemon/routers/session-timeout.ts +4 -0
- package/src/daemon/routers/slash-model.test.ts +344 -0
- package/src/daemon/routers/slash-model.ts +207 -0
- package/src/daemon/routers/slash-policies.test.ts +38 -32
- package/src/daemon/routers/slash-policies.ts +84 -33
- package/src/daemon/routers/slash-restart.test.ts +69 -0
- package/src/daemon/routers/slash-restart.ts +36 -0
- package/src/daemon/routers/slash-shutdown.test.ts +50 -0
- package/src/daemon/routers/slash-shutdown.ts +28 -0
- package/src/daemon/routers/slash-upgrade.test.ts +116 -0
- package/src/daemon/routers/slash-upgrade.ts +76 -0
- package/src/daemon/routers/types.ts +7 -0
- package/src/daemon/routers.ts +16 -0
- package/src/shared/adapters/blockquote.test.ts +28 -0
- package/src/shared/adapters/blockquote.ts +20 -0
- package/src/shared/adapters/filtering.test.ts +224 -10
- package/src/shared/adapters/filtering.ts +95 -7
- package/src/shared/adapters/inbound-cache.test.ts +48 -0
- package/src/shared/adapters/inbound-cache.ts +54 -0
- package/src/shared/adapters/turn-log-buffer.ts +266 -0
- package/src/shared/adapters/turn-log.test.ts +389 -0
- package/src/shared/adapters/turn-log.ts +357 -0
- package/src/shared/agent-utils.ts +12 -5
- package/src/shared/chats.test.ts +4 -0
- package/src/shared/chats.ts +9 -0
- package/src/shared/config.ts +16 -1
- package/src/shared/lite.ts +76 -2
- package/src/shared/policies.ts +26 -0
- package/src/shared/template-manifest.ts +267 -0
- package/src/shared/utils/shell.ts +61 -0
- package/src/shared/version.ts +34 -0
- package/src/shared/workspace.test.ts +217 -0
- package/src/shared/workspace.ts +626 -48
- package/templates/environments/cladding/allowlist-domain.mjs +125 -0
- package/templates/environments/cladding/env.json +21 -1
- package/templates/environments/cladding/run-with-network.mjs +54 -0
- package/templates/environments/macos-proxy/allowlist-domain.mjs +95 -0
- package/templates/environments/macos-proxy/env.json +8 -1
- package/templates/environments/macos-proxy/proxy.mjs +42 -13
- package/templates/gemini/template.json +5 -0
- package/templates/gemini-claw/template.json +13 -0
- package/templates/skills/clawmini-requests/SKILL.md +69 -10
- package/templates/skills/run-host/SKILL.md +51 -0
- package/templates/skills/skill-creator/SKILL.md +4 -3
- package/templates/skills/skill-creator/scripts/validate.sh +52 -0
- package/tsdown.config.ts +10 -1
- package/vitest.config.ts +2 -2
- package/web/.svelte-kit/ambient.d.ts +292 -176
- package/web/.svelte-kit/generated/server/internal.js +1 -1
- package/web/.svelte-kit/output/client/.vite/manifest.json +127 -137
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{Drm9vgeP.js → 3AZlWB6U.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BhRSsUCh.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BiLeM2i1.js +1 -0
- package/{dist/web/_app/immutable/chunks/CME08kGM.js → web/.svelte-kit/output/client/_app/immutable/chunks/BmBj85Ll.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BrERcKAH.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Bv9252RM.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CIXNBPKi.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DISKL3GN.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{Zeh-C-mx.js → DcpaLzmX.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DnQ3vS13.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/chunks/KsloHTKS.js +1 -0
- package/{dist/web/_app/immutable/chunks/Ck-be5J2.js → web/.svelte-kit/output/client/_app/immutable/chunks/RsHsUj-8.js} +2 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/{G_zz-Gou.js → wpfV79dV.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CIw1Qj0n.js +2 -0
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.Di0-Jhte.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{0.CYS8iApT.js → 0.DYyUA1au.js} +1 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.D-3QEMMZ.js +1 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{2.BnwnD1Ki.js → 2.4olHnH7U.js} +1 -1
- package/{dist/web/_app/immutable/nodes/3.Dr0ot9sV.js → web/.svelte-kit/output/client/_app/immutable/nodes/3.4w0bE-m2.js} +3 -3
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.CZvjhVHt.js +60 -0
- package/web/.svelte-kit/output/client/_app/immutable/nodes/{5.BBGQ_i84.js → 5.DLbPVJY2.js} +1 -1
- package/web/.svelte-kit/output/client/_app/version.json +1 -1
- package/web/.svelte-kit/output/server/.vite/manifest.json +12 -10
- package/web/.svelte-kit/output/server/chunks/Icon.js +1 -1
- package/web/.svelte-kit/output/server/chunks/client.js +1 -1
- package/web/.svelte-kit/output/server/chunks/exports.js +1 -1
- package/web/.svelte-kit/output/server/chunks/index-server.js +2 -1
- package/web/.svelte-kit/output/server/chunks/internal.js +1 -1
- package/web/.svelte-kit/output/server/chunks/render-context.js +77 -0
- package/web/.svelte-kit/output/server/chunks/root.js +739 -788
- package/web/.svelte-kit/output/server/chunks/shared.js +234 -21
- package/web/.svelte-kit/output/server/index.js +126 -90
- package/web/.svelte-kit/output/server/manifest-full.js +1 -1
- package/web/.svelte-kit/output/server/manifest.js +1 -1
- package/web/.svelte-kit/output/server/nodes/0.js +1 -1
- package/web/.svelte-kit/output/server/nodes/1.js +1 -1
- package/web/.svelte-kit/output/server/nodes/2.js +1 -1
- package/web/.svelte-kit/output/server/nodes/3.js +1 -1
- package/web/.svelte-kit/output/server/nodes/4.js +1 -1
- package/web/.svelte-kit/output/server/nodes/5.js +1 -1
- package/web/.svelte-kit/output/server/remote-entry.js +245 -81
- package/web/.svelte-kit/tsconfig.json +4 -1
- package/dist/cli/propose-policy.mjs.map +0 -1
- package/dist/lite-CBxOT1y5.mjs +0 -241
- package/dist/lite-CBxOT1y5.mjs.map +0 -1
- package/dist/routing-D8rTxtaV.mjs +0 -245
- package/dist/routing-D8rTxtaV.mjs.map +0 -1
- package/dist/web/_app/immutable/chunks/B6YN0Nuq.js +0 -1
- package/dist/web/_app/immutable/chunks/BmRlVmv6.js +0 -1
- package/dist/web/_app/immutable/chunks/CK9JZLaG.js +0 -2
- package/dist/web/_app/immutable/chunks/Ck3rYNON.js +0 -1
- package/dist/web/_app/immutable/chunks/DMtIqaiV.js +0 -2
- package/dist/web/_app/immutable/chunks/DhD271EB.js +0 -1
- package/dist/web/_app/immutable/chunks/DpuLqk8d.js +0 -1
- package/dist/web/_app/immutable/chunks/DsIToJCP.js +0 -1
- package/dist/web/_app/immutable/chunks/bBmtyQMj.js +0 -1
- package/dist/web/_app/immutable/entry/app.CJmSwntr.js +0 -2
- package/dist/web/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
- package/dist/web/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
- package/dist/web/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
- package/dist/workspace-BJmJBfKi.mjs +0 -456
- package/dist/workspace-BJmJBfKi.mjs.map +0 -1
- package/src/cli/e2e/agents.test.ts +0 -140
- package/src/cli/e2e/basic.test.ts +0 -43
- package/src/cli/e2e/cron.test.ts +0 -132
- package/src/cli/e2e/export-lite-func.test.ts +0 -206
- package/src/cli/e2e/fallbacks.test.ts +0 -175
- package/src/cli/e2e/init.test.ts +0 -77
- package/src/cli/e2e/messages.test.ts +0 -332
- package/src/cli/e2e/propose-policy.test.ts +0 -203
- package/src/cli/e2e/requests.test.ts +0 -180
- package/src/cli/e2e/session-timeout.test.ts +0 -192
- package/src/cli/e2e/slash-new.test.ts +0 -93
- package/src/cli/e2e/subagents.test.ts +0 -106
- package/src/cli/e2e/utils.ts +0 -66
- package/src/cli/propose-policy.ts +0 -91
- package/web/.svelte-kit/output/client/_app/immutable/chunks/B6YN0Nuq.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/BmRlVmv6.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/CK9JZLaG.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/Ck3rYNON.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DMtIqaiV.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DhD271EB.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DpuLqk8d.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/DsIToJCP.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/chunks/bBmtyQMj.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/entry/app.CJmSwntr.js +0 -2
- package/web/.svelte-kit/output/client/_app/immutable/entry/start.ZpUrT2ak.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/1.Bli0Hqzn.js +0 -1
- package/web/.svelte-kit/output/client/_app/immutable/nodes/4.oBhvQhcA.js +0 -60
- package/web/.svelte-kit/output/server/chunks/false.js +0 -4
- /package/dist/cli/{propose-policy.d.mts → manage-policies.d.mts} +0 -0
- /package/{src/cli/e2e → e2e/_helpers}/global-setup.ts +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
import { randomBytes } from "node:crypto";
|
|
5
7
|
|
|
6
8
|
//#region \0rolldown/runtime.js
|
|
7
9
|
var __create = Object.create;
|
|
@@ -3054,7 +3056,77 @@ var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3054
3056
|
//#endregion
|
|
3055
3057
|
//#region node_modules/commander/esm.mjs
|
|
3056
3058
|
var import_commander = /* @__PURE__ */ __toESM(require_commander(), 1);
|
|
3057
|
-
const { program
|
|
3059
|
+
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = import_commander.default;
|
|
3060
|
+
|
|
3061
|
+
//#endregion
|
|
3062
|
+
//#region src/shared/policies.ts
|
|
3063
|
+
const BUILTIN_POLICY_SCRIPTS_DIR = ".clawmini/policy-scripts";
|
|
3064
|
+
const BUILTIN_POLICIES = {
|
|
3065
|
+
"manage-policies": {
|
|
3066
|
+
description: "Add, update, or remove clawmini policies (subcommands: add, update, remove). Reads are unrestricted via `requests show`.",
|
|
3067
|
+
command: `./${BUILTIN_POLICY_SCRIPTS_DIR}/manage-policies.js`,
|
|
3068
|
+
allowHelp: true,
|
|
3069
|
+
autoApprove: false
|
|
3070
|
+
},
|
|
3071
|
+
"run-host": {
|
|
3072
|
+
description: "Run an arbitrary shell command on the host via `sh -c`",
|
|
3073
|
+
command: `./${BUILTIN_POLICY_SCRIPTS_DIR}/run-host.js`,
|
|
3074
|
+
allowHelp: true,
|
|
3075
|
+
autoApprove: false
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
|
|
3079
|
+
//#endregion
|
|
3080
|
+
//#region src/shared/utils/shell.ts
|
|
3081
|
+
function parseShellArgs(input) {
|
|
3082
|
+
const args = [];
|
|
3083
|
+
let current = "";
|
|
3084
|
+
let inSingle = false;
|
|
3085
|
+
let inDouble = false;
|
|
3086
|
+
let hasContent = false;
|
|
3087
|
+
for (let i = 0; i < input.length; i++) {
|
|
3088
|
+
const ch = input[i];
|
|
3089
|
+
if (inSingle) {
|
|
3090
|
+
if (ch === "'") inSingle = false;
|
|
3091
|
+
else current += ch;
|
|
3092
|
+
continue;
|
|
3093
|
+
}
|
|
3094
|
+
if (inDouble) {
|
|
3095
|
+
if (ch === "\"") inDouble = false;
|
|
3096
|
+
else if (ch === "\\" && i + 1 < input.length) {
|
|
3097
|
+
const next = input[i + 1];
|
|
3098
|
+
if (next === "\"" || next === "\\") {
|
|
3099
|
+
current += next;
|
|
3100
|
+
i++;
|
|
3101
|
+
} else current += ch;
|
|
3102
|
+
} else current += ch;
|
|
3103
|
+
continue;
|
|
3104
|
+
}
|
|
3105
|
+
if (ch === "'") {
|
|
3106
|
+
inSingle = true;
|
|
3107
|
+
hasContent = true;
|
|
3108
|
+
} else if (ch === "\"") {
|
|
3109
|
+
inDouble = true;
|
|
3110
|
+
hasContent = true;
|
|
3111
|
+
} else if (ch === "\\" && i + 1 < input.length) {
|
|
3112
|
+
current += input[i + 1];
|
|
3113
|
+
i++;
|
|
3114
|
+
hasContent = true;
|
|
3115
|
+
} else if (ch === " " || ch === " ") {
|
|
3116
|
+
if (hasContent) {
|
|
3117
|
+
args.push(current);
|
|
3118
|
+
current = "";
|
|
3119
|
+
hasContent = false;
|
|
3120
|
+
}
|
|
3121
|
+
} else {
|
|
3122
|
+
current += ch;
|
|
3123
|
+
hasContent = true;
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
if (inSingle || inDouble) throw new Error("Unterminated quote in command string.");
|
|
3127
|
+
if (hasContent) args.push(current);
|
|
3128
|
+
return args;
|
|
3129
|
+
}
|
|
3058
3130
|
|
|
3059
3131
|
//#endregion
|
|
3060
3132
|
//#region node_modules/zod/v4/core/core.js
|
|
@@ -6987,6 +7059,13 @@ const meta = meta$1;
|
|
|
6987
7059
|
|
|
6988
7060
|
//#endregion
|
|
6989
7061
|
//#region src/shared/config.ts
|
|
7062
|
+
const PolicyDefinitionSchema = looseObject({
|
|
7063
|
+
description: string().optional(),
|
|
7064
|
+
command: string(),
|
|
7065
|
+
args: array(string()).optional(),
|
|
7066
|
+
allowHelp: boolean().optional(),
|
|
7067
|
+
autoApprove: boolean().optional()
|
|
7068
|
+
});
|
|
6990
7069
|
const FallbackSchema = looseObject({
|
|
6991
7070
|
commands: looseObject({
|
|
6992
7071
|
new: string().optional(),
|
|
@@ -6999,6 +7078,7 @@ const FallbackSchema = looseObject({
|
|
|
6999
7078
|
delayMs: number().int().min(0).default(1e3)
|
|
7000
7079
|
});
|
|
7001
7080
|
const AgentSchema = looseObject({
|
|
7081
|
+
extends: string().optional(),
|
|
7002
7082
|
commands: looseObject({
|
|
7003
7083
|
new: string().optional(),
|
|
7004
7084
|
append: string().optional(),
|
|
@@ -7009,8 +7089,9 @@ const AgentSchema = looseObject({
|
|
|
7009
7089
|
apiUrlEnvVar: string().optional(),
|
|
7010
7090
|
env: record(string(), union([string(), boolean()])).optional(),
|
|
7011
7091
|
subagentEnv: record(string(), union([string(), boolean()])).optional(),
|
|
7092
|
+
modelShorthands: record(string(), string()).optional(),
|
|
7012
7093
|
directory: string().optional(),
|
|
7013
|
-
skillsDir: string().optional(),
|
|
7094
|
+
skillsDir: string().nullable().optional(),
|
|
7014
7095
|
fallbacks: array(FallbackSchema).optional(),
|
|
7015
7096
|
files: string().default("./attachments").optional()
|
|
7016
7097
|
});
|
|
@@ -7063,13 +7144,16 @@ const ChatSettingsSchema = looseObject({
|
|
|
7063
7144
|
});
|
|
7064
7145
|
const AgentSessionSettingsSchema = looseObject({ env: record(string(), union([string(), boolean()])).optional() });
|
|
7065
7146
|
const EnvironmentSchema = looseObject({
|
|
7147
|
+
extends: string().optional(),
|
|
7066
7148
|
init: string().optional(),
|
|
7067
7149
|
up: string().optional(),
|
|
7068
7150
|
down: string().optional(),
|
|
7069
7151
|
prefix: string().optional(),
|
|
7070
7152
|
envFormat: string().optional(),
|
|
7071
7153
|
exportLiteTo: string().optional(),
|
|
7072
|
-
|
|
7154
|
+
baseDir: string().optional(),
|
|
7155
|
+
env: record(string(), union([string(), boolean()])).optional(),
|
|
7156
|
+
policies: record(string(), PolicyDefinitionSchema).optional()
|
|
7073
7157
|
});
|
|
7074
7158
|
const SettingsSchema = looseObject({
|
|
7075
7159
|
chats: looseObject({ defaultId: string().optional() }).optional(),
|
|
@@ -7084,6 +7168,11 @@ const SettingsSchema = looseObject({
|
|
|
7084
7168
|
})]).optional()
|
|
7085
7169
|
});
|
|
7086
7170
|
|
|
7171
|
+
//#endregion
|
|
7172
|
+
//#region src/shared/template-manifest.ts
|
|
7173
|
+
const TemplateManifestSchema = looseObject({ files: record(string(), _enum(["track", "seed-once"])).optional() });
|
|
7174
|
+
const InstalledFilesSchema = looseObject({ files: record(string(), looseObject({ sha: string() })).optional() });
|
|
7175
|
+
|
|
7087
7176
|
//#endregion
|
|
7088
7177
|
//#region src/shared/workspace.ts
|
|
7089
7178
|
function getWorkspaceRoot(startDir = process.cwd()) {
|
|
@@ -7100,60 +7189,194 @@ function getClawminiDir(startDir = process.cwd()) {
|
|
|
7100
7189
|
}
|
|
7101
7190
|
|
|
7102
7191
|
//#endregion
|
|
7103
|
-
//#region src/cli/
|
|
7104
|
-
const
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
1. Propose a policy using a direct shell command:
|
|
7108
|
-
clawmini-lite request propose-policy -- --name npm-install --description "Run npm install" --command "npm install"
|
|
7109
|
-
|
|
7110
|
-
2. Propose a policy using a custom script file:
|
|
7111
|
-
# First, write your script to a file (e.g., install.sh)
|
|
7112
|
-
clawmini-lite request propose-policy --file script=./install.sh -- --name custom-install --description "Run custom install script" --script-file "{{script}}"
|
|
7113
|
-
`).parse(process.argv);
|
|
7114
|
-
const options = program.opts();
|
|
7115
|
-
const name = options.name;
|
|
7116
|
-
const description = options.description;
|
|
7117
|
-
const commandStr = options.command;
|
|
7118
|
-
const scriptFile = options.scriptFile;
|
|
7119
|
-
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
7120
|
-
console.error("Error: Policy name must only contain lowercase letters, numbers, and hyphens.");
|
|
7192
|
+
//#region src/cli/manage-policies-utils.ts
|
|
7193
|
+
const NAME_RE = /^[a-z0-9-]+$/;
|
|
7194
|
+
function fail(message) {
|
|
7195
|
+
console.error(`Error: ${message}`);
|
|
7121
7196
|
process.exit(1);
|
|
7122
7197
|
}
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
process.exit(1);
|
|
7198
|
+
function assertValidName(name) {
|
|
7199
|
+
if (!NAME_RE.test(name)) fail("Policy name must only contain lowercase letters, numbers, and hyphens.");
|
|
7126
7200
|
}
|
|
7127
|
-
|
|
7128
|
-
const
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7201
|
+
function loadPolicies() {
|
|
7202
|
+
const dirPath = getClawminiDir();
|
|
7203
|
+
const policiesPath = path.join(dirPath, "policies.json");
|
|
7204
|
+
if (!fs.existsSync(dirPath)) fail(".clawmini directory not found. Please run \"clawmini init\" first.");
|
|
7205
|
+
let policies = { policies: {} };
|
|
7206
|
+
if (fs.existsSync(policiesPath)) policies = JSON.parse(fs.readFileSync(policiesPath, "utf8"));
|
|
7207
|
+
return {
|
|
7208
|
+
dirPath,
|
|
7209
|
+
policies,
|
|
7210
|
+
policiesPath
|
|
7211
|
+
};
|
|
7132
7212
|
}
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7213
|
+
function writePolicies(policiesPath, policies) {
|
|
7214
|
+
const tmpPath = `${policiesPath}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
7215
|
+
try {
|
|
7216
|
+
fs.writeFileSync(tmpPath, JSON.stringify(policies, null, 2));
|
|
7217
|
+
fs.renameSync(tmpPath, policiesPath);
|
|
7218
|
+
} catch (err) {
|
|
7219
|
+
try {
|
|
7220
|
+
fs.unlinkSync(tmpPath);
|
|
7221
|
+
} catch {}
|
|
7222
|
+
throw err;
|
|
7223
|
+
}
|
|
7224
|
+
}
|
|
7225
|
+
function installScript(dirPath, name, scriptFile) {
|
|
7141
7226
|
const scriptsDir = path.join(dirPath, "policy-scripts");
|
|
7142
7227
|
if (!fs.existsSync(scriptsDir)) fs.mkdirSync(scriptsDir, { recursive: true });
|
|
7143
7228
|
const ext = path.extname(scriptFile) || ".sh";
|
|
7144
7229
|
const destScript = path.join(scriptsDir, `${name}${ext}`);
|
|
7145
7230
|
fs.copyFileSync(scriptFile, destScript);
|
|
7146
7231
|
fs.chmodSync(destScript, 493);
|
|
7147
|
-
|
|
7148
|
-
}
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7232
|
+
return `./.clawmini/policy-scripts/${path.basename(destScript)}`;
|
|
7233
|
+
}
|
|
7234
|
+
function scriptInsidePolicyScripts(dirPath, command) {
|
|
7235
|
+
const workspaceRoot = path.dirname(dirPath);
|
|
7236
|
+
const abs = path.resolve(workspaceRoot, command);
|
|
7237
|
+
const scriptsDir = path.join(dirPath, "policy-scripts");
|
|
7238
|
+
const sep = path.sep;
|
|
7239
|
+
const dirWithSep = scriptsDir.endsWith(sep) ? scriptsDir : scriptsDir + sep;
|
|
7240
|
+
return abs.startsWith(dirWithSep) ? abs : null;
|
|
7241
|
+
}
|
|
7242
|
+
function unlinkIfExists(filePath) {
|
|
7243
|
+
try {
|
|
7244
|
+
fs.unlinkSync(filePath);
|
|
7245
|
+
} catch (err) {
|
|
7246
|
+
if (err.code !== "ENOENT") throw err;
|
|
7247
|
+
}
|
|
7248
|
+
}
|
|
7249
|
+
function applyCommandString(definition, commandStr) {
|
|
7250
|
+
let parts;
|
|
7251
|
+
try {
|
|
7252
|
+
parts = parseShellArgs(commandStr);
|
|
7253
|
+
} catch (err) {
|
|
7254
|
+
fail(`--command: ${err instanceof Error ? err.message : String(err)}`);
|
|
7255
|
+
}
|
|
7256
|
+
const [head, ...rest] = parts;
|
|
7257
|
+
if (head === void 0) fail("--command must contain a command to run.");
|
|
7258
|
+
definition.command = head;
|
|
7259
|
+
if (rest.length > 0) definition.args = rest;
|
|
7260
|
+
}
|
|
7261
|
+
|
|
7262
|
+
//#endregion
|
|
7263
|
+
//#region src/cli/manage-policies.ts
|
|
7264
|
+
const root = new Command("manage-policies");
|
|
7265
|
+
root.description("Manage clawmini policies. Subcommands: add, update, remove. Reads are unrestricted — use `clawmini-lite requests show <name>` instead.");
|
|
7266
|
+
root.command("add").description("Register a new policy. Errors if the name already exists.").requiredOption("--name <policy_name>", "Name of the policy").requiredOption("--description <description>", "Description of the policy").option("--command <command_string>", "The shell command to run (e.g. \"npm install -g\")").option("--script-file <path>", "Path to a script file (mapped securely via --file)").option("--dangerously-auto-approve", "Skip user approval for every invocation of this policy. Only safe for fully sandboxed, side-effect-free commands.", false).option("--dangerously-allow-help", "Allow the agent to run the policy with `--help` without approval. Only safe if the underlying command treats `--help` as read-only.", false).addHelpText("after", `
|
|
7267
|
+
Examples:
|
|
7268
|
+
1. Add a policy that wraps a shell command:
|
|
7269
|
+
clawmini-lite request manage-policies -- add --name npm-install --description "Run npm install" --command "npm install"
|
|
7270
|
+
|
|
7271
|
+
2. Add a policy backed by a script file:
|
|
7272
|
+
clawmini-lite request manage-policies --file script=./install.sh -- add --name custom-install --description "Run custom install script" --script-file "{{script}}"
|
|
7273
|
+
|
|
7274
|
+
3. Add a read-only policy that auto-approves and exposes --help:
|
|
7275
|
+
clawmini-lite request manage-policies -- add --name list-files --description "List files" --command "ls" --dangerously-auto-approve --dangerously-allow-help
|
|
7276
|
+
`).action((options) => {
|
|
7277
|
+
const name = options.name;
|
|
7278
|
+
const description = options.description;
|
|
7279
|
+
const commandStr = options.command;
|
|
7280
|
+
const scriptFile = options.scriptFile;
|
|
7281
|
+
const autoApprove = !!options.dangerouslyAutoApprove;
|
|
7282
|
+
const allowHelp = !!options.dangerouslyAllowHelp;
|
|
7283
|
+
assertValidName(name);
|
|
7284
|
+
if (!commandStr && !scriptFile) fail("Must provide either --command or --script-file.");
|
|
7285
|
+
if (commandStr && scriptFile) fail("--command and --script-file are mutually exclusive.");
|
|
7286
|
+
const { dirPath, policies, policiesPath } = loadPolicies();
|
|
7287
|
+
if (Object.prototype.hasOwnProperty.call(policies.policies, name)) fail(`Policy '${name}' is already registered. Use 'manage-policies update' to modify it, or 'manage-policies remove' first.`);
|
|
7288
|
+
const definition = {
|
|
7289
|
+
description,
|
|
7290
|
+
allowHelp,
|
|
7291
|
+
autoApprove,
|
|
7292
|
+
command: ""
|
|
7293
|
+
};
|
|
7294
|
+
if (scriptFile) definition.command = installScript(dirPath, name, scriptFile);
|
|
7295
|
+
else if (commandStr) applyCommandString(definition, commandStr);
|
|
7296
|
+
policies.policies[name] = definition;
|
|
7297
|
+
writePolicies(policiesPath, policies);
|
|
7298
|
+
console.log(`Successfully added policy '${name}'.`);
|
|
7299
|
+
});
|
|
7300
|
+
root.command("update").description("Modify fields on an existing user-registered policy.").requiredOption("--name <policy_name>", "Name of the policy to update").option("--description <description>", "New description").option("--command <command_string>", "Replace the shell command (e.g. \"npm install -g\")").option("--script-file <path>", "Replace the policy with a script file (mapped via --file)").option("--dangerously-auto-approve", "Enable autoApprove. Only safe for fully sandboxed, side-effect-free commands.").option("--no-dangerously-auto-approve", "Disable autoApprove.").option("--dangerously-allow-help", "Enable allowHelp. Only safe if the underlying command treats `--help` as read-only.").option("--no-dangerously-allow-help", "Disable allowHelp.").addHelpText("after", `
|
|
7301
|
+
Examples:
|
|
7302
|
+
1. Update the description of an existing policy:
|
|
7303
|
+
clawmini-lite request manage-policies -- update --name npm-install --description "Run npm install (with cache)"
|
|
7304
|
+
|
|
7305
|
+
2. Replace the command:
|
|
7306
|
+
clawmini-lite request manage-policies -- update --name npm-install --command "npm ci"
|
|
7307
|
+
|
|
7308
|
+
3. Enable the dangerous flags:
|
|
7309
|
+
clawmini-lite request manage-policies -- update --name list-files --dangerously-auto-approve --dangerously-allow-help
|
|
7310
|
+
|
|
7311
|
+
4. Turn a dangerous flag off again:
|
|
7312
|
+
clawmini-lite request manage-policies -- update --name list-files --no-dangerously-auto-approve
|
|
7313
|
+
`).action((options) => {
|
|
7314
|
+
const name = options.name;
|
|
7315
|
+
const description = options.description;
|
|
7316
|
+
const commandStr = options.command;
|
|
7317
|
+
const scriptFile = options.scriptFile;
|
|
7318
|
+
const autoApprove = options.dangerouslyAutoApprove;
|
|
7319
|
+
const allowHelp = options.dangerouslyAllowHelp;
|
|
7320
|
+
assertValidName(name);
|
|
7321
|
+
if (commandStr && scriptFile) fail("--command and --script-file are mutually exclusive.");
|
|
7322
|
+
if (description === void 0 && commandStr === void 0 && scriptFile === void 0 && autoApprove === void 0 && allowHelp === void 0) fail("No fields specified to update. Pass at least one of --description, --command, --script-file, --dangerously-auto-approve, --dangerously-allow-help.");
|
|
7323
|
+
const { dirPath, policies, policiesPath } = loadPolicies();
|
|
7324
|
+
const existing = policies.policies[name];
|
|
7325
|
+
if (existing === false) fail(`Policy '${name}' is currently disabled. Run 'manage-policies remove --name ${name}' to clear the disable, then 'manage-policies add' to register it.`);
|
|
7326
|
+
if (existing === void 0) fail(`No user-registered policy '${name}' to update. Use 'manage-policies add' to register one.`);
|
|
7327
|
+
const priorScriptAbs = scriptInsidePolicyScripts(dirPath, existing.command);
|
|
7328
|
+
const updated = { ...existing };
|
|
7329
|
+
if (description !== void 0) updated.description = description;
|
|
7330
|
+
if (scriptFile !== void 0) {
|
|
7331
|
+
updated.command = installScript(dirPath, name, scriptFile);
|
|
7332
|
+
delete updated.args;
|
|
7333
|
+
} else if (commandStr !== void 0) {
|
|
7334
|
+
delete updated.args;
|
|
7335
|
+
applyCommandString(updated, commandStr);
|
|
7336
|
+
}
|
|
7337
|
+
if (autoApprove !== void 0) updated.autoApprove = autoApprove;
|
|
7338
|
+
if (allowHelp !== void 0) updated.allowHelp = allowHelp;
|
|
7339
|
+
policies.policies[name] = updated;
|
|
7340
|
+
writePolicies(policiesPath, policies);
|
|
7341
|
+
const newScriptAbs = scriptInsidePolicyScripts(dirPath, updated.command);
|
|
7342
|
+
if (priorScriptAbs && priorScriptAbs !== newScriptAbs) unlinkIfExists(priorScriptAbs);
|
|
7343
|
+
console.log(`Successfully updated policy '${name}'.`);
|
|
7344
|
+
});
|
|
7345
|
+
root.command("remove").description("Remove (or disable) a registered policy.").requiredOption("--name <policy_name>", "Name of the policy to remove").option("--disable-builtin", "When the name matches a built-in policy, write `false` to opt out instead of just deleting the user override.", false).addHelpText("after", `
|
|
7346
|
+
Examples:
|
|
7347
|
+
1. Remove a user-registered policy:
|
|
7348
|
+
clawmini-lite request manage-policies -- remove --name npm-install
|
|
7349
|
+
|
|
7350
|
+
2. Disable a built-in policy (writes \`false\` to opt out):
|
|
7351
|
+
clawmini-lite request manage-policies -- remove --name manage-policies --disable-builtin
|
|
7352
|
+
|
|
7353
|
+
3. Drop a user override of a built-in (the built-in then surfaces again):
|
|
7354
|
+
clawmini-lite request manage-policies -- remove --name manage-policies
|
|
7355
|
+
`).action((options) => {
|
|
7356
|
+
const name = options.name;
|
|
7357
|
+
const disableBuiltin = !!options.disableBuiltin;
|
|
7358
|
+
assertValidName(name);
|
|
7359
|
+
const { policies, policiesPath } = loadPolicies();
|
|
7360
|
+
const isBuiltin = name in BUILTIN_POLICIES;
|
|
7361
|
+
const existing = policies.policies[name];
|
|
7362
|
+
if (disableBuiltin) {
|
|
7363
|
+
if (!isBuiltin) fail(`--disable-builtin can only be used for built-in policies; '${name}' is not a built-in.`);
|
|
7364
|
+
if (existing === false) fail(`Built-in policy '${name}' is already disabled.`);
|
|
7365
|
+
if (existing !== void 0) fail(`Policy '${name}' has a user override that would be lost. Run 'manage-policies remove --name ${name}' first, then re-run with --disable-builtin.`);
|
|
7366
|
+
policies.policies[name] = false;
|
|
7367
|
+
writePolicies(policiesPath, policies);
|
|
7368
|
+
console.log(`Successfully disabled built-in policy '${name}'.`);
|
|
7369
|
+
return;
|
|
7370
|
+
}
|
|
7371
|
+
if (existing === void 0) fail(`No policy entry '${name}' to remove.${isBuiltin ? ` '${name}' is a built-in. To opt out, re-run with --disable-builtin.` : ""}`);
|
|
7372
|
+
delete policies.policies[name];
|
|
7373
|
+
writePolicies(policiesPath, policies);
|
|
7374
|
+
if (existing === false) console.log(`Successfully cleared the disable entry for '${name}'.${isBuiltin ? " The built-in will surface again." : ""}`);
|
|
7375
|
+
else if (isBuiltin) console.log(`Successfully removed user override of built-in policy '${name}'. The built-in will surface again.`);
|
|
7376
|
+
else console.log(`Successfully removed policy '${name}'.`);
|
|
7377
|
+
});
|
|
7378
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) root.parse(process.argv);
|
|
7156
7379
|
|
|
7157
7380
|
//#endregion
|
|
7158
7381
|
export { };
|
|
7159
|
-
//# sourceMappingURL=
|
|
7382
|
+
//# sourceMappingURL=manage-policies.mjs.map
|