@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/README.md +105 -2
- package/blocks/conversation/agent-prompt/examples.mdx +44 -0
- package/blocks/conversation/agent-prompt/index.tsx +114 -0
- package/blocks/conversation/composer/draft.css +25 -0
- package/blocks/conversation/composer/draft.tsx +589 -0
- package/blocks/conversation/composer/examples.mdx +114 -0
- package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
- package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
- package/blocks/conversation/composer/index.tsx +517 -0
- package/blocks/conversation/composer/queued-row.tsx +102 -0
- package/blocks/conversation/composer/shared.ts +38 -0
- package/blocks/conversation/composer/suggestion-row.tsx +64 -0
- package/blocks/conversation/composer/use-composer-files.ts +142 -0
- package/blocks/conversation/composer/use-history-nav.ts +60 -0
- package/blocks/conversation/composer/use-message-queue.ts +108 -0
- package/blocks/conversation/composer/use-region-height.ts +34 -0
- package/blocks/conversation/failure-states/examples.mdx +58 -0
- package/blocks/conversation/failure-states/index.tsx +274 -0
- package/blocks/conversation/transcript/examples.mdx +43 -0
- package/blocks/conversation/transcript/index.tsx +204 -0
- package/blocks/conversation/transcript-search/examples.mdx +50 -0
- package/blocks/conversation/transcript-search/index.tsx +469 -0
- package/blocks/dialogs/command-palette/examples.mdx +33 -0
- package/blocks/dialogs/command-palette/index.tsx +232 -0
- package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
- package/blocks/dialogs/hook-dialog/index.tsx +286 -0
- package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
- package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
- package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
- package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
- package/blocks/panes/artifacts-pane/examples.mdx +23 -0
- package/blocks/panes/artifacts-pane/index.tsx +82 -0
- package/blocks/panes/changes-pane/examples.mdx +23 -0
- package/blocks/panes/changes-pane/index.tsx +248 -0
- package/blocks/panes/file-pane/examples.mdx +13 -0
- package/blocks/panes/file-pane/index.tsx +102 -0
- package/blocks/panes/pr-pane/examples.mdx +13 -0
- package/blocks/panes/pr-pane/index.tsx +191 -0
- package/blocks/panes/side-pane/examples.mdx +58 -0
- package/blocks/panes/side-pane/index.tsx +187 -0
- package/blocks/panes/tasks-pane/examples.mdx +23 -0
- package/blocks/panes/tasks-pane/index.tsx +127 -0
- package/blocks/panes/terminal-pane/examples.mdx +13 -0
- package/blocks/panes/terminal-pane/index.tsx +99 -0
- package/blocks/panes/usage-pane/examples.mdx +13 -0
- package/blocks/panes/usage-pane/index.tsx +75 -0
- package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
- package/blocks/profiles/profile-onboarding/index.tsx +580 -0
- package/blocks/profiles/profile-switcher/examples.mdx +18 -0
- package/blocks/profiles/profile-switcher/index.tsx +197 -0
- package/blocks/profiles/profile-usage/examples.mdx +21 -0
- package/blocks/profiles/profile-usage/index.tsx +127 -0
- package/blocks/sessions/inbox/examples.mdx +35 -0
- package/blocks/sessions/inbox/index.tsx +372 -0
- package/blocks/sessions/session-board/examples.mdx +34 -0
- package/blocks/sessions/session-board/index.tsx +570 -0
- package/blocks/sessions/session-sidebar/examples.mdx +43 -0
- package/blocks/sessions/session-sidebar/index.tsx +442 -0
- package/blocks/settings/extensions/examples.mdx +10 -0
- package/blocks/settings/extensions/index.tsx +72 -0
- package/blocks/settings/hooks/examples.mdx +16 -0
- package/blocks/settings/hooks/index.tsx +127 -0
- package/blocks/settings/mcp-servers/examples.mdx +26 -0
- package/blocks/settings/mcp-servers/index.tsx +204 -0
- package/blocks/settings/memory/examples.mdx +22 -0
- package/blocks/settings/memory/index.tsx +113 -0
- package/blocks/settings/notifications/examples.mdx +8 -0
- package/blocks/settings/notifications/index.tsx +63 -0
- package/blocks/settings/permission-rules/examples.mdx +37 -0
- package/blocks/settings/permission-rules/index.tsx +317 -0
- package/blocks/settings/plugin-catalog/examples.mdx +52 -0
- package/blocks/settings/plugin-catalog/index.tsx +407 -0
- package/blocks/settings/plugins/examples.mdx +10 -0
- package/blocks/settings/plugins/index.tsx +72 -0
- package/blocks/settings/settings-window/examples.mdx +40 -0
- package/blocks/settings/settings-window/index.tsx +188 -0
- package/blocks/settings/worktrees/examples.mdx +17 -0
- package/blocks/settings/worktrees/index.tsx +145 -0
- package/components/conversation/agent-run/examples.mdx +30 -0
- package/components/conversation/agent-run/index.tsx +82 -0
- package/components/conversation/chapter-nav/examples.mdx +30 -0
- package/components/conversation/chapter-nav/index.tsx +123 -0
- package/components/conversation/message/examples.mdx +53 -0
- package/components/conversation/message/index.tsx +128 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +22 -0
- package/components/conversation/reasoning/index.tsx +54 -0
- package/components/conversation/recap/examples.mdx +21 -0
- package/components/conversation/recap/index.tsx +67 -0
- package/components/conversation/todo-list/examples.mdx +32 -0
- package/components/conversation/todo-list/index.tsx +106 -0
- package/components/conversation/tool-call/examples.mdx +48 -0
- package/components/conversation/tool-call/index.tsx +142 -0
- package/components/conversation/work-summary/examples.mdx +50 -0
- package/components/conversation/work-summary/index.tsx +87 -0
- package/components/prompts/permission-request/examples.mdx +32 -0
- package/components/prompts/permission-request/index.tsx +74 -0
- package/components/prompts/plan-approval/examples.mdx +37 -0
- package/components/prompts/plan-approval/index.tsx +76 -0
- package/components/prompts/prompt-card/examples.mdx +31 -0
- package/components/prompts/prompt-card/index.tsx +82 -0
- package/components/prompts/question-prompt/examples.mdx +46 -0
- package/components/prompts/question-prompt/index.tsx +118 -0
- package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
- package/dist/blocks/conversation/agent-prompt/index.js +13 -0
- package/dist/blocks/conversation/composer/index.d.ts +4 -0
- package/dist/blocks/conversation/composer/index.js +15 -0
- package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
- package/dist/blocks/conversation/failure-states/index.js +8 -0
- package/dist/blocks/conversation/transcript/index.d.ts +50 -0
- package/dist/blocks/conversation/transcript/index.js +17 -0
- package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
- package/dist/blocks/conversation/transcript-search/index.js +11 -0
- package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
- package/dist/blocks/dialogs/command-palette/index.js +20 -0
- package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
- package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
- package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
- package/dist/blocks/panes/artifacts-pane/index.js +9 -0
- package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
- package/dist/blocks/panes/changes-pane/index.js +9 -0
- package/dist/blocks/panes/file-pane/index.d.ts +3 -0
- package/dist/blocks/panes/file-pane/index.js +9 -0
- package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
- package/dist/blocks/panes/pr-pane/index.js +10 -0
- package/dist/blocks/panes/side-pane/index.d.ts +5 -0
- package/dist/blocks/panes/side-pane/index.js +21 -0
- package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
- package/dist/blocks/panes/tasks-pane/index.js +10 -0
- package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
- package/dist/blocks/panes/terminal-pane/index.js +9 -0
- package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
- package/dist/blocks/panes/usage-pane/index.js +11 -0
- package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
- package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-switcher/index.js +11 -0
- package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-usage/index.js +10 -0
- package/dist/blocks/sessions/inbox/index.d.ts +2 -0
- package/dist/blocks/sessions/inbox/index.js +11 -0
- package/dist/blocks/sessions/session-board/index.d.ts +4 -0
- package/dist/blocks/sessions/session-board/index.js +26 -0
- package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
- package/dist/blocks/sessions/session-sidebar/index.js +15 -0
- package/dist/blocks/settings/extensions/index.d.ts +2 -0
- package/dist/blocks/settings/extensions/index.js +9 -0
- package/dist/blocks/settings/hooks/index.d.ts +4 -0
- package/dist/blocks/settings/hooks/index.js +9 -0
- package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
- package/dist/blocks/settings/mcp-servers/index.js +9 -0
- package/dist/blocks/settings/memory/index.d.ts +4 -0
- package/dist/blocks/settings/memory/index.js +8 -0
- package/dist/blocks/settings/notifications/index.d.ts +2 -0
- package/dist/blocks/settings/notifications/index.js +8 -0
- package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
- package/dist/blocks/settings/permission-rules/index.js +10 -0
- package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
- package/dist/blocks/settings/plugin-catalog/index.js +11 -0
- package/dist/blocks/settings/plugins/index.d.ts +4 -0
- package/dist/blocks/settings/plugins/index.js +9 -0
- package/dist/blocks/settings/settings-window/index.d.ts +4 -0
- package/dist/blocks/settings/settings-window/index.js +8 -0
- package/dist/blocks/settings/worktrees/index.d.ts +4 -0
- package/dist/blocks/settings/worktrees/index.js +9 -0
- package/dist/components/conversation/agent-run/index.d.ts +3 -0
- package/dist/components/conversation/agent-run/index.js +10 -0
- package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
- package/dist/components/conversation/chapter-nav/index.js +11 -0
- package/dist/components/conversation/message/index.d.ts +2 -0
- package/dist/components/conversation/message/index.js +15 -0
- package/dist/components/conversation/reasoning/index.d.ts +2 -0
- package/dist/components/conversation/reasoning/index.js +8 -0
- package/dist/components/conversation/recap/index.d.ts +2 -0
- package/dist/components/conversation/recap/index.js +9 -0
- package/dist/components/conversation/todo-list/index.d.ts +2 -0
- package/dist/components/conversation/todo-list/index.js +9 -0
- package/dist/components/conversation/tool-call/index.d.ts +3 -0
- package/dist/components/conversation/tool-call/index.js +13 -0
- package/dist/components/conversation/work-summary/index.d.ts +2 -0
- package/dist/components/conversation/work-summary/index.js +10 -0
- package/dist/components/prompts/permission-request/index.d.ts +2 -0
- package/dist/components/prompts/permission-request/index.js +9 -0
- package/dist/components/prompts/plan-approval/index.d.ts +2 -0
- package/dist/components/prompts/plan-approval/index.js +9 -0
- package/dist/components/prompts/prompt-card/index.d.ts +3 -0
- package/dist/components/prompts/prompt-card/index.js +8 -0
- package/dist/components/prompts/question-prompt/index.d.ts +2 -0
- package/dist/components/prompts/question-prompt/index.js +9 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +231 -0
- package/dist/lib/config-parts.d.ts +2 -0
- package/dist/lib/config-parts.js +16 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +10 -0
- package/dist/lib/pace-bar.d.ts +11 -0
- package/dist/lib/pace-bar.js +6 -0
- package/dist/lib/pace.d.ts +4 -0
- package/dist/lib/pace.js +12 -0
- package/dist/lib/pane-parts.d.ts +25 -0
- package/dist/lib/pane-parts.js +11 -0
- package/dist/lib/row-trigger.d.ts +5 -0
- package/dist/lib/row-trigger.js +7 -0
- package/dist/lib/settings-parts.d.ts +70 -0
- package/dist/lib/settings-parts.js +24 -0
- package/dist/lib/side-pane-types.d.ts +2 -0
- package/dist/lib/side-pane-types.js +1 -0
- package/dist/lib/status-glyph.d.ts +8 -0
- package/dist/lib/status-glyph.js +12 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.js +1 -0
- package/dist/shared/chunk-04a497rr.js +21 -0
- package/dist/shared/chunk-13yf0mza.d.ts +70 -0
- package/dist/shared/chunk-1aq2xzv5.js +558 -0
- package/dist/shared/chunk-1f96cz69.js +45 -0
- package/dist/shared/chunk-1yt061np.d.ts +64 -0
- package/dist/shared/chunk-218qabm5.js +250 -0
- package/dist/shared/chunk-2fk5aq60.js +313 -0
- package/dist/shared/chunk-4248zvmh.js +177 -0
- package/dist/shared/chunk-45rqgey6.d.ts +25 -0
- package/dist/shared/chunk-4n0v64qx.js +179 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58qvny6a.d.ts +29 -0
- package/dist/shared/chunk-5fhkkn39.js +130 -0
- package/dist/shared/chunk-5hw0525a.d.ts +33 -0
- package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
- package/dist/shared/chunk-5meda998.js +238 -0
- package/dist/shared/chunk-5pqksw7z.js +91 -0
- package/dist/shared/chunk-6220dy5n.js +70 -0
- package/dist/shared/chunk-64bnh22t.d.ts +59 -0
- package/dist/shared/chunk-66sh633m.d.ts +60 -0
- package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
- package/dist/shared/chunk-6g4970a6.d.ts +20 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
- package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
- package/dist/shared/chunk-8mecznyr.js +357 -0
- package/dist/shared/chunk-8pag6vmd.js +255 -0
- package/dist/shared/chunk-8xg5gwwy.js +38 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-a4s440b6.js +79 -0
- package/dist/shared/chunk-at0jje23.d.ts +110 -0
- package/dist/shared/chunk-awd573h9.js +34 -0
- package/dist/shared/chunk-b171wjge.d.ts +25 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-bzs6amnv.js +187 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-cd4f87as.d.ts +28 -0
- package/dist/shared/chunk-cmwby8f9.js +467 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-e46apgve.d.ts +40 -0
- package/dist/shared/chunk-ejtknc0w.js +21 -0
- package/dist/shared/chunk-eqajdxn8.js +82 -0
- package/dist/shared/chunk-fbn0h7cr.js +123 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g28hweee.d.ts +35 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-gkyk663q.d.ts +53 -0
- package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
- package/dist/shared/chunk-hxjgey30.d.ts +36 -0
- package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
- package/dist/shared/chunk-jpq101w3.js +91 -0
- package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
- package/dist/shared/chunk-k5zegxje.d.ts +81 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-kw9npka5.js +224 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-paezqfg1.js +106 -0
- package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
- package/dist/shared/chunk-qhxz1etk.js +96 -0
- package/dist/shared/chunk-qj5ev9ak.js +531 -0
- package/dist/shared/chunk-qnwggvjy.js +150 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rjfwje37.d.ts +234 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-rzajcn44.d.ts +49 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
- package/dist/shared/chunk-t21t9x7e.js +188 -0
- package/dist/shared/chunk-tc75ng2c.js +235 -0
- package/dist/shared/chunk-tkx1krwc.js +88 -0
- package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
- package/dist/shared/chunk-tv9a1sek.js +137 -0
- package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vd59gzzd.js +86 -0
- package/dist/shared/chunk-vgh4f3sv.js +118 -0
- package/dist/shared/chunk-vjht1zn1.js +391 -0
- package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
- package/dist/shared/chunk-w5z8qnf8.js +175 -0
- package/dist/shared/chunk-wgvzavx1.js +1488 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
- package/dist/shared/chunk-x9jf26yb.js +318 -0
- package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
- package/dist/shared/chunk-xkchhs2z.js +129 -0
- package/dist/shared/chunk-xzfrskd7.js +202 -0
- package/dist/shared/chunk-y4cj4y54.js +423 -0
- package/dist/shared/chunk-y934at6m.js +7 -0
- package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
- package/dist/shared/chunk-zfhmbb7n.js +63 -0
- package/dist/shared/chunk-zk0t4vq5.js +71 -0
- package/dist/shared/chunk-znp9gna7.d.ts +23 -0
- package/dist/styles.css +467 -0
- package/index.ts +49 -0
- package/lib/config-parts.tsx +97 -0
- package/lib/icons.tsx +149 -0
- package/lib/pace-bar.tsx +24 -0
- package/lib/pace.ts +74 -0
- package/lib/pane-parts.tsx +76 -0
- package/lib/row-trigger.tsx +44 -0
- package/lib/settings-parts.tsx +232 -0
- package/lib/side-pane-types.ts +75 -0
- package/lib/status-glyph.tsx +25 -0
- package/lib/types.ts +204 -0
- package/mock/demo-reply.tsx +33 -0
- package/mock/demo-session.tsx +150 -0
- package/mock/mock-config.ts +173 -0
- package/mock/mock-extras.ts +288 -0
- package/mock/mock-panes.ts +190 -0
- package/mock/mock-settings.ts +92 -0
- package/mock/mock.ts +548 -0
- package/mock/screen-frame.tsx +49 -0
- package/package.json +114 -4
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useIcon2
|
|
5
|
+
} from "./chunk-xkchhs2z.js";
|
|
6
|
+
import {
|
|
7
|
+
PaneSection2,
|
|
8
|
+
IconAction2,
|
|
9
|
+
PaneEmpty2
|
|
10
|
+
} from "./chunk-eqajdxn8.js";
|
|
11
|
+
|
|
12
|
+
// blocks/panes/changes-pane/index.tsx
|
|
13
|
+
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
14
|
+
import Diff, { parsePatch } from "@justanarthur/modo-ui/components/data-display/diff";
|
|
15
|
+
import ChoiceList from "@justanarthur/modo-ui/components/inputs/choice-list";
|
|
16
|
+
import Input from "@justanarthur/modo-ui/components/inputs/input";
|
|
17
|
+
import { useSize } from "@justanarthur/modo-ui/lib/size-context";
|
|
18
|
+
import { cn } from "@justanarthur/modo-ui/lib/utils";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
21
|
+
/*!
|
|
22
|
+
* Local addition: the side pane's Changes — the session's changed files,
|
|
23
|
+
* staged and unstaged, under a commit field, and the picked file's diff.
|
|
24
|
+
*/
|
|
25
|
+
var STATUS_LETTER = { added: "A", modified: "M", deleted: "D" };
|
|
26
|
+
function countLines(patch) {
|
|
27
|
+
const lines = parsePatch(patch);
|
|
28
|
+
return {
|
|
29
|
+
added: lines.filter((l) => l.kind === "add").length,
|
|
30
|
+
removed: lines.filter((l) => l.kind === "remove").length
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function splitPath(path) {
|
|
34
|
+
const at = path.lastIndexOf("/");
|
|
35
|
+
return { dir: path.slice(0, at), name: path.slice(at + 1) };
|
|
36
|
+
}
|
|
37
|
+
function FileRow({ change }) {
|
|
38
|
+
const size = useSize();
|
|
39
|
+
const { dir, name } = splitPath(change.path);
|
|
40
|
+
const { added, removed } = countLines(change.patch);
|
|
41
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
42
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: "w-3 shrink-0 font-mono text-caption text-muted-foreground",
|
|
46
|
+
children: STATUS_LETTER[change.status]
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsxs("span", {
|
|
49
|
+
className: cn("min-w-0 flex-1 truncate", size.text),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx("span", {
|
|
52
|
+
className: cn("text-foreground", change.status === "deleted" && "line-through"),
|
|
53
|
+
children: name
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ jsxs("span", {
|
|
56
|
+
className: "text-caption text-muted-foreground",
|
|
57
|
+
children: [
|
|
58
|
+
" ",
|
|
59
|
+
dir
|
|
60
|
+
]
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsxs("span", {
|
|
65
|
+
className: "flex shrink-0 gap-1.5 font-mono text-caption tabular-nums transition-[opacity] duration-fast group-focus-within/pick:opacity-0 group-hover/pick:opacity-0 pointer-coarse:opacity-0",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsxs("span", {
|
|
68
|
+
className: "text-status-success",
|
|
69
|
+
children: [
|
|
70
|
+
"+",
|
|
71
|
+
added
|
|
72
|
+
]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsxs("span", {
|
|
75
|
+
className: "text-status-error",
|
|
76
|
+
children: [
|
|
77
|
+
"−",
|
|
78
|
+
removed
|
|
79
|
+
]
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function FileList({
|
|
87
|
+
label,
|
|
88
|
+
files,
|
|
89
|
+
value,
|
|
90
|
+
onValueChange,
|
|
91
|
+
actions
|
|
92
|
+
}) {
|
|
93
|
+
const size = useSize();
|
|
94
|
+
return /* @__PURE__ */ jsx(ChoiceList, {
|
|
95
|
+
label,
|
|
96
|
+
value,
|
|
97
|
+
onValueChange,
|
|
98
|
+
rowClassName: cn("items-center py-0", size.control),
|
|
99
|
+
options: files.map((change) => ({
|
|
100
|
+
value: change.path,
|
|
101
|
+
label: change.path,
|
|
102
|
+
content: /* @__PURE__ */ jsx(FileRow, {
|
|
103
|
+
change
|
|
104
|
+
}),
|
|
105
|
+
actions: actions(change)
|
|
106
|
+
}))
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ChangesPane2({ changes, onStage, onRevert, onCommit, onOpenFile }) {
|
|
110
|
+
const [files, setFiles] = useState(changes);
|
|
111
|
+
const [picked, setPicked] = useState(changes[0]?.path ?? "");
|
|
112
|
+
const [message, setMessage] = useState("");
|
|
113
|
+
const [wrap, setWrap] = useState(true);
|
|
114
|
+
const Plus = useIcon2("plus");
|
|
115
|
+
const Minus = useIcon2("minus");
|
|
116
|
+
const Revert = useIcon2("rotate-ccw");
|
|
117
|
+
const Wrap = useIcon2("text-wrap");
|
|
118
|
+
const Open = useIcon2("external-link");
|
|
119
|
+
if (files.length === 0)
|
|
120
|
+
return /* @__PURE__ */ jsx(PaneEmpty2, {
|
|
121
|
+
icon: "circle-check",
|
|
122
|
+
title: "No changes",
|
|
123
|
+
detail: "The working tree matches the last commit."
|
|
124
|
+
});
|
|
125
|
+
const staged = files.filter((f) => f.staged);
|
|
126
|
+
const unstaged = files.filter((f) => !f.staged);
|
|
127
|
+
const change = files.find((f) => f.path === picked) ?? files[0];
|
|
128
|
+
const setStaged = (paths, value) => {
|
|
129
|
+
setFiles((fs) => fs.map((f) => paths.includes(f.path) ? { ...f, staged: value } : f));
|
|
130
|
+
onStage?.(paths, value);
|
|
131
|
+
};
|
|
132
|
+
const drop = (paths) => setFiles((fs) => fs.filter((f) => !paths.includes(f.path)));
|
|
133
|
+
const revert = (paths) => {
|
|
134
|
+
drop(paths);
|
|
135
|
+
onRevert?.(paths);
|
|
136
|
+
};
|
|
137
|
+
const commit = () => {
|
|
138
|
+
const paths = staged.map((f) => f.path);
|
|
139
|
+
drop(paths);
|
|
140
|
+
setMessage("");
|
|
141
|
+
onCommit?.(message, paths);
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
144
|
+
className: "flex flex-col gap-2",
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ jsxs("div", {
|
|
147
|
+
className: "flex items-center gap-2 px-2 pb-1",
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ jsx(Input, {
|
|
150
|
+
variant: "bordered",
|
|
151
|
+
"aria-label": "Commit message",
|
|
152
|
+
placeholder: staged.length > 0 ? "Message, or Claude writes one" : "Stage files to commit",
|
|
153
|
+
value: message,
|
|
154
|
+
onValueChange: setMessage,
|
|
155
|
+
disabled: staged.length === 0,
|
|
156
|
+
className: "min-w-0 flex-1"
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx(Button, {
|
|
159
|
+
size: "compact",
|
|
160
|
+
disabled: staged.length === 0,
|
|
161
|
+
onClick: commit,
|
|
162
|
+
children: "Commit"
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
}),
|
|
166
|
+
staged.length > 0 && /* @__PURE__ */ jsx(PaneSection2, {
|
|
167
|
+
title: "Staged",
|
|
168
|
+
meta: staged.length,
|
|
169
|
+
actions: /* @__PURE__ */ jsx(IconAction2, {
|
|
170
|
+
icon: Minus,
|
|
171
|
+
label: "Unstage all",
|
|
172
|
+
onClick: () => setStaged(staged.map((f) => f.path), false)
|
|
173
|
+
}),
|
|
174
|
+
children: /* @__PURE__ */ jsx(FileList, {
|
|
175
|
+
label: "Staged files",
|
|
176
|
+
files: staged,
|
|
177
|
+
value: picked,
|
|
178
|
+
onValueChange: setPicked,
|
|
179
|
+
actions: (f) => /* @__PURE__ */ jsx(IconAction2, {
|
|
180
|
+
icon: Minus,
|
|
181
|
+
label: "Unstage",
|
|
182
|
+
onClick: () => setStaged([f.path], false)
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
}),
|
|
186
|
+
unstaged.length > 0 && /* @__PURE__ */ jsx(PaneSection2, {
|
|
187
|
+
title: "Changes",
|
|
188
|
+
meta: unstaged.length,
|
|
189
|
+
actions: /* @__PURE__ */ jsxs(Fragment, {
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
192
|
+
icon: Revert,
|
|
193
|
+
label: "Revert all",
|
|
194
|
+
onClick: () => revert(unstaged.map((f) => f.path))
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
197
|
+
icon: Plus,
|
|
198
|
+
label: "Stage all",
|
|
199
|
+
onClick: () => setStaged(unstaged.map((f) => f.path), true)
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
}),
|
|
203
|
+
children: /* @__PURE__ */ jsx(FileList, {
|
|
204
|
+
label: "Unstaged files",
|
|
205
|
+
files: unstaged,
|
|
206
|
+
value: picked,
|
|
207
|
+
onValueChange: setPicked,
|
|
208
|
+
actions: (f) => /* @__PURE__ */ jsxs(Fragment, {
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
211
|
+
icon: Revert,
|
|
212
|
+
label: "Revert",
|
|
213
|
+
onClick: () => revert([f.path])
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
216
|
+
icon: Plus,
|
|
217
|
+
label: "Stage",
|
|
218
|
+
onClick: () => setStaged([f.path], true)
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
}),
|
|
224
|
+
change && /* @__PURE__ */ jsx(PaneSection2, {
|
|
225
|
+
title: splitPath(change.path).name,
|
|
226
|
+
meta: splitPath(change.path).dir,
|
|
227
|
+
actions: /* @__PURE__ */ jsxs(Fragment, {
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
230
|
+
icon: Wrap,
|
|
231
|
+
label: wrap ? "Scroll long lines" : "Wrap long lines",
|
|
232
|
+
pressed: wrap,
|
|
233
|
+
onClick: () => setWrap(!wrap)
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx(IconAction2, {
|
|
236
|
+
icon: Open,
|
|
237
|
+
label: "Open in editor",
|
|
238
|
+
onClick: () => onOpenFile?.(change.path)
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
}),
|
|
242
|
+
children: /* @__PURE__ */ jsx(Diff, {
|
|
243
|
+
wrap,
|
|
244
|
+
patch: change.patch
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
]
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
export { ChangesPane2 };
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SCOPES2
|
|
5
|
+
} from "./chunk-5pqksw7z.js";
|
|
6
|
+
import {
|
|
7
|
+
useIcon2
|
|
8
|
+
} from "./chunk-xkchhs2z.js";
|
|
9
|
+
import {
|
|
10
|
+
Section2,
|
|
11
|
+
Group2,
|
|
12
|
+
ON_HOVER2
|
|
13
|
+
} from "./chunk-5meda998.js";
|
|
14
|
+
|
|
15
|
+
// blocks/settings/permission-rules/index.tsx
|
|
16
|
+
import Button from "@justanarthur/modo-ui/components/actions/button";
|
|
17
|
+
import Badge from "@justanarthur/modo-ui/components/data-display/badge";
|
|
18
|
+
import List from "@justanarthur/modo-ui/components/data-display/list";
|
|
19
|
+
import Input from "@justanarthur/modo-ui/components/inputs/input";
|
|
20
|
+
import Select from "@justanarthur/modo-ui/components/inputs/select";
|
|
21
|
+
import { useControllableState } from "@justanarthur/modo-ui/lib/use-controllable-state";
|
|
22
|
+
import { useState } from "react";
|
|
23
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
24
|
+
/*!
|
|
25
|
+
* Local addition: the AI app's permissions settings section — the default
|
|
26
|
+
* permission mode, allow / ask / deny rules with their scope, added inline
|
|
27
|
+
* and moved between groups, and the extra directories the sessions may
|
|
28
|
+
* touch.
|
|
29
|
+
*/
|
|
30
|
+
var BEHAVIORS = [
|
|
31
|
+
{ value: "allow", label: "Allow", note: "Runs without asking." },
|
|
32
|
+
{ value: "ask", label: "Ask", note: "Asks every time, even where an allow rule matches." },
|
|
33
|
+
{ value: "deny", label: "Deny", note: "Never runs; deny wins over every other rule." }
|
|
34
|
+
];
|
|
35
|
+
var MODES = [
|
|
36
|
+
{ value: "default", label: "Ask first", note: "Asks the first time each tool is used." },
|
|
37
|
+
{ value: "acceptEdits", label: "Accept edits", note: "File edits go through; commands still ask." },
|
|
38
|
+
{ value: "plan", label: "Plan", note: "Reads and plans; changes nothing until a plan is approved." },
|
|
39
|
+
{ value: "bypassPermissions", label: "Bypass", note: "Never asks. Only in a sandbox or a container." }
|
|
40
|
+
];
|
|
41
|
+
var SCOPE_BADGE = { user: "gray", project: "blue", local: "violet" };
|
|
42
|
+
var RULE = /^(?:[A-Z][A-Za-z]*|mcp__[\w-]+(?:__[\w-]+)?)(?:\([^()]+\))?$/;
|
|
43
|
+
var EMPTY = { mode: "default", rules: [], directories: [] };
|
|
44
|
+
function ruleError(rule, rules) {
|
|
45
|
+
if (!rule)
|
|
46
|
+
return;
|
|
47
|
+
if (!RULE.test(rule))
|
|
48
|
+
return "A tool name, optionally with a pattern: Bash(bun run *), Edit(ui/**), WebFetch(domain:github.com).";
|
|
49
|
+
const clash = rules.find((r) => r.rule === rule);
|
|
50
|
+
if (clash)
|
|
51
|
+
return `Already in ${BEHAVIORS.find((b) => b.value === clash.behavior)?.label}.`;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
function Picker({
|
|
55
|
+
label,
|
|
56
|
+
options,
|
|
57
|
+
value,
|
|
58
|
+
onValueChange,
|
|
59
|
+
className
|
|
60
|
+
}) {
|
|
61
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
62
|
+
size: "compact",
|
|
63
|
+
value,
|
|
64
|
+
onValueChange: (next) => onValueChange(options.find((o) => o.value === next)?.value ?? value),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx(Select.Trigger, {
|
|
67
|
+
variant: "borderless",
|
|
68
|
+
"aria-label": label,
|
|
69
|
+
className
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsx(Select.Content, {
|
|
72
|
+
children: options.map((o, i) => /* @__PURE__ */ jsx(Select.Item, {
|
|
73
|
+
index: i,
|
|
74
|
+
value: o.value,
|
|
75
|
+
children: o.label
|
|
76
|
+
}, o.value))
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function Line({ children, actions }) {
|
|
82
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
83
|
+
className: "group/row flex h-9 min-w-0 items-center gap-[var(--space-2)] border-b border-border last:border-b-0",
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: "flex min-w-0 flex-1 items-center gap-[var(--space-2)]",
|
|
87
|
+
children
|
|
88
|
+
}),
|
|
89
|
+
actions
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function Remove({ label, onPress }) {
|
|
94
|
+
const Trash = useIcon2("trash");
|
|
95
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "icon-compact",
|
|
98
|
+
"aria-label": label,
|
|
99
|
+
className: ON_HOVER2,
|
|
100
|
+
onClick: onPress,
|
|
101
|
+
children: /* @__PURE__ */ jsx(Trash, {})
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function AddRule({ rules, onAdd }) {
|
|
105
|
+
const [text, setRule] = useState("");
|
|
106
|
+
const rule = text.trim();
|
|
107
|
+
const [behavior, setBehavior] = useState("allow");
|
|
108
|
+
const [scope, setScope] = useState("project");
|
|
109
|
+
const Plus = useIcon2("plus");
|
|
110
|
+
const error = ruleError(rule, rules);
|
|
111
|
+
const add = () => {
|
|
112
|
+
if (!rule || error)
|
|
113
|
+
return;
|
|
114
|
+
onAdd({ rule, behavior, scope });
|
|
115
|
+
setRule("");
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
118
|
+
className: "flex flex-col gap-[var(--space-1)]",
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: "flex flex-wrap items-center gap-[var(--space-2)]",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Input, {
|
|
124
|
+
variant: "bordered",
|
|
125
|
+
size: "compact",
|
|
126
|
+
"aria-label": "New rule",
|
|
127
|
+
placeholder: "Bash(bun run *)",
|
|
128
|
+
className: "min-w-48 flex-1 font-mono",
|
|
129
|
+
value: text,
|
|
130
|
+
invalid: Boolean(error),
|
|
131
|
+
onValueChange: setRule,
|
|
132
|
+
onKeyDown: (e) => e.key === "Enter" && add()
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ jsx(Picker, {
|
|
135
|
+
label: "Rule behavior",
|
|
136
|
+
options: BEHAVIORS,
|
|
137
|
+
value: behavior,
|
|
138
|
+
onValueChange: setBehavior
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ jsx(Picker, {
|
|
141
|
+
label: "Rule scope",
|
|
142
|
+
options: SCOPES2,
|
|
143
|
+
value: scope,
|
|
144
|
+
onValueChange: setScope
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ jsx(Button, {
|
|
147
|
+
size: "compact",
|
|
148
|
+
variant: "secondary",
|
|
149
|
+
leadingIcon: Plus,
|
|
150
|
+
disabled: !rule || Boolean(error),
|
|
151
|
+
onClick: add,
|
|
152
|
+
children: "Add rule"
|
|
153
|
+
})
|
|
154
|
+
]
|
|
155
|
+
}),
|
|
156
|
+
error && /* @__PURE__ */ jsx("span", {
|
|
157
|
+
className: "text-caption text-destructive",
|
|
158
|
+
children: error
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function AddDirectory({ directories, onAdd }) {
|
|
164
|
+
const [text, setPath] = useState("");
|
|
165
|
+
const path = text.trim();
|
|
166
|
+
const Plus = useIcon2("plus");
|
|
167
|
+
const taken = directories.includes(path);
|
|
168
|
+
const add = () => {
|
|
169
|
+
if (!path || taken)
|
|
170
|
+
return;
|
|
171
|
+
onAdd(path);
|
|
172
|
+
setPath("");
|
|
173
|
+
};
|
|
174
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
175
|
+
className: "flex flex-col gap-[var(--space-1)] pt-[var(--space-2)]",
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsxs("div", {
|
|
178
|
+
className: "flex items-center gap-[var(--space-2)]",
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ jsx(Input, {
|
|
181
|
+
variant: "bordered",
|
|
182
|
+
size: "compact",
|
|
183
|
+
"aria-label": "New directory",
|
|
184
|
+
placeholder: "../../shared-config",
|
|
185
|
+
className: "min-w-0 flex-1 font-mono",
|
|
186
|
+
value: text,
|
|
187
|
+
invalid: taken,
|
|
188
|
+
onValueChange: setPath,
|
|
189
|
+
onKeyDown: (e) => e.key === "Enter" && add()
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ jsx(Button, {
|
|
192
|
+
size: "compact",
|
|
193
|
+
variant: "secondary",
|
|
194
|
+
leadingIcon: Plus,
|
|
195
|
+
disabled: !path || taken,
|
|
196
|
+
onClick: add,
|
|
197
|
+
children: "Add directory"
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
taken && /* @__PURE__ */ jsx("span", {
|
|
202
|
+
className: "text-caption text-destructive",
|
|
203
|
+
children: "Already listed."
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function PermissionRules2({ value, defaultValue = EMPTY, onChange }) {
|
|
209
|
+
const [settings, setSettings] = useControllableState(value, defaultValue, onChange);
|
|
210
|
+
const set = (patch) => setSettings({ ...settings, ...patch });
|
|
211
|
+
const setRules = (rules) => set({ rules });
|
|
212
|
+
const mode = MODES.find((m) => m.value === settings.mode);
|
|
213
|
+
return /* @__PURE__ */ jsxs(Section2, {
|
|
214
|
+
title: "Permissions",
|
|
215
|
+
lead: "What the sessions may do without asking. Project rules come from the repo's .claude/settings.json, local ones from its git-ignored settings.local.json.",
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsx(List, {
|
|
218
|
+
className: "-ml-[var(--space-2)]",
|
|
219
|
+
children: /* @__PURE__ */ jsx(List.Row, {
|
|
220
|
+
label: "Default mode",
|
|
221
|
+
description: mode?.note,
|
|
222
|
+
children: /* @__PURE__ */ jsx(Picker, {
|
|
223
|
+
label: "Default mode",
|
|
224
|
+
options: MODES,
|
|
225
|
+
value: settings.mode,
|
|
226
|
+
onValueChange: (next) => set({ mode: next })
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ jsx(AddRule, {
|
|
231
|
+
rules: settings.rules,
|
|
232
|
+
onAdd: (rule) => setRules([...settings.rules, rule])
|
|
233
|
+
}),
|
|
234
|
+
BEHAVIORS.map((behavior) => {
|
|
235
|
+
const rules = settings.rules.filter((r) => r.behavior === behavior.value);
|
|
236
|
+
return /* @__PURE__ */ jsx(Group2, {
|
|
237
|
+
title: `${behavior.label} · ${behavior.note}`,
|
|
238
|
+
aside: /* @__PURE__ */ jsx("span", {
|
|
239
|
+
className: "tabular-nums",
|
|
240
|
+
children: rules.length
|
|
241
|
+
}),
|
|
242
|
+
children: rules.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
243
|
+
className: "m-0 py-[var(--space-2)] text-body text-muted-foreground",
|
|
244
|
+
children: [
|
|
245
|
+
"No ",
|
|
246
|
+
behavior.label.toLowerCase(),
|
|
247
|
+
" rules."
|
|
248
|
+
]
|
|
249
|
+
}) : /* @__PURE__ */ jsx("ul", {
|
|
250
|
+
"aria-label": behavior.label,
|
|
251
|
+
className: "m-0 flex list-none flex-col p-0",
|
|
252
|
+
children: rules.map((rule) => /* @__PURE__ */ jsxs(Line, {
|
|
253
|
+
actions: /* @__PURE__ */ jsxs(Fragment, {
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsx(Picker, {
|
|
256
|
+
label: `Move ${rule.rule}`,
|
|
257
|
+
options: BEHAVIORS,
|
|
258
|
+
value: rule.behavior,
|
|
259
|
+
className: ON_HOVER2,
|
|
260
|
+
onValueChange: (next) => setRules(settings.rules.map((r) => r === rule ? { ...r, behavior: next } : r))
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ jsx(Remove, {
|
|
263
|
+
label: `Remove ${rule.rule}`,
|
|
264
|
+
onPress: () => setRules(settings.rules.filter((r) => r !== rule))
|
|
265
|
+
})
|
|
266
|
+
]
|
|
267
|
+
}),
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ jsx("span", {
|
|
270
|
+
className: "min-w-0 truncate font-mono text-caption text-foreground",
|
|
271
|
+
children: rule.rule
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
274
|
+
size: "compact",
|
|
275
|
+
color: SCOPE_BADGE[rule.scope],
|
|
276
|
+
children: rule.scope
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}, rule.rule))
|
|
280
|
+
})
|
|
281
|
+
}, behavior.value);
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ jsxs(Group2, {
|
|
284
|
+
title: "Additional directories · read and edited like the repo",
|
|
285
|
+
aside: /* @__PURE__ */ jsx("span", {
|
|
286
|
+
className: "tabular-nums",
|
|
287
|
+
children: settings.directories.length
|
|
288
|
+
}),
|
|
289
|
+
children: [
|
|
290
|
+
settings.directories.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
291
|
+
"aria-label": "Additional directories",
|
|
292
|
+
className: "m-0 flex list-none flex-col p-0",
|
|
293
|
+
children: settings.directories.map((path) => /* @__PURE__ */ jsx(Line, {
|
|
294
|
+
actions: /* @__PURE__ */ jsx(Remove, {
|
|
295
|
+
label: `Remove ${path}`,
|
|
296
|
+
onPress: () => set({ directories: settings.directories.filter((d) => d !== path) })
|
|
297
|
+
}),
|
|
298
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
299
|
+
className: "min-w-0 truncate font-mono text-caption text-foreground",
|
|
300
|
+
children: path
|
|
301
|
+
})
|
|
302
|
+
}, path))
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ jsx(AddDirectory, {
|
|
305
|
+
directories: settings.directories,
|
|
306
|
+
onAdd: (path) => set({ directories: [...settings.directories, path] })
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
export { PermissionRules2 };
|