@kabmo-labs/kabmo 0.11.1 → 0.12.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/README.md +67 -421
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +426 -413
- package/dist/client/static/js/{index-amss8pge.js → index-0smc9gm2.js} +1123 -747
- package/dist/client/static/js/index-shexbk5f.css +1 -0
- package/marketplace/marketplace.json +13 -3
- package/marketplace/plugins/command-runner/package.json +4 -2
- package/marketplace/plugins/git-forge/README.md +219 -0
- package/marketplace/plugins/git-forge/icon.svg +20 -0
- package/marketplace/plugins/git-forge/package.json +56 -0
- package/marketplace/plugins/git-forge/src/app.tsx +82 -0
- package/marketplace/plugins/git-forge/src/command.test.ts +181 -0
- package/marketplace/plugins/git-forge/src/command.ts +119 -0
- package/marketplace/plugins/git-forge/src/header.tsx +87 -0
- package/marketplace/plugins/git-forge/src/panel/Badge.tsx +76 -0
- package/marketplace/plugins/git-forge/src/panel/Change.tsx +150 -0
- package/marketplace/plugins/git-forge/src/panel/CiBadge.tsx +51 -0
- package/marketplace/plugins/git-forge/src/panel/Credential.tsx +107 -0
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +70 -0
- package/marketplace/plugins/git-forge/src/panel/Header.tsx +255 -0
- package/marketplace/plugins/git-forge/src/panel/ItemView.tsx +198 -0
- package/marketplace/plugins/git-forge/src/panel/List.tsx +89 -0
- package/marketplace/plugins/git-forge/src/panel/Row.tsx +68 -0
- package/marketplace/plugins/git-forge/src/panel/Sidebar.tsx +94 -0
- package/marketplace/plugins/git-forge/src/panel/Write.tsx +236 -0
- package/marketplace/plugins/git-forge/src/panel/format.ts +78 -0
- package/marketplace/plugins/git-forge/src/panel/index.test.tsx +344 -0
- package/marketplace/plugins/git-forge/src/panel/index.tsx +193 -0
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +250 -0
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +269 -0
- package/marketplace/plugins/git-forge/src/protocol.ts +308 -0
- package/marketplace/plugins/git-forge/src/server/adapters.test.ts +274 -0
- package/marketplace/plugins/git-forge/src/server/bitbucket.ts +307 -0
- package/marketplace/plugins/git-forge/src/server/capabilities.test.ts +116 -0
- package/marketplace/plugins/git-forge/src/server/capabilities.ts +105 -0
- package/marketplace/plugins/git-forge/src/server/ci.test.ts +88 -0
- package/marketplace/plugins/git-forge/src/server/ci.ts +118 -0
- package/marketplace/plugins/git-forge/src/server/context.ts +76 -0
- package/marketplace/plugins/git-forge/src/server/diff.test.ts +127 -0
- package/marketplace/plugins/git-forge/src/server/diff.ts +120 -0
- package/marketplace/plugins/git-forge/src/server/filters.test.ts +138 -0
- package/marketplace/plugins/git-forge/src/server/filters.ts +138 -0
- package/marketplace/plugins/git-forge/src/server/forges.test.ts +235 -0
- package/marketplace/plugins/git-forge/src/server/gitea.ts +296 -0
- package/marketplace/plugins/git-forge/src/server/github-extras.ts +92 -0
- package/marketplace/plugins/git-forge/src/server/github.ts +320 -0
- package/marketplace/plugins/git-forge/src/server/gitlab-detail.ts +207 -0
- package/marketplace/plugins/git-forge/src/server/gitlab.test.ts +195 -0
- package/marketplace/plugins/git-forge/src/server/gitlab.ts +176 -0
- package/marketplace/plugins/git-forge/src/server/http.test.ts +270 -0
- package/marketplace/plugins/git-forge/src/server/http.ts +329 -0
- package/marketplace/plugins/git-forge/src/server/map.ts +120 -0
- package/marketplace/plugins/git-forge/src/server/registry.ts +47 -0
- package/marketplace/plugins/git-forge/src/server/remote.test.ts +146 -0
- package/marketplace/plugins/git-forge/src/server/remote.ts +188 -0
- package/marketplace/plugins/git-forge/src/server/scope-probe.test.ts +98 -0
- package/marketplace/plugins/git-forge/src/server/scope-probe.ts +128 -0
- package/marketplace/plugins/git-forge/src/server/scope.ts +66 -0
- package/marketplace/plugins/git-forge/src/server/test-context.ts +67 -0
- package/marketplace/plugins/git-forge/src/server/test-host.ts +51 -0
- package/marketplace/plugins/git-forge/src/server/token.test.ts +107 -0
- package/marketplace/plugins/git-forge/src/server/token.ts +139 -0
- package/marketplace/plugins/git-forge/src/server/write-http.test.ts +127 -0
- package/marketplace/plugins/git-forge/src/server/write-http.ts +110 -0
- package/marketplace/plugins/git-forge/src/server/writes.test.ts +218 -0
- package/marketplace/plugins/git-forge/src/server/writes.ts +313 -0
- package/marketplace/plugins/git-forge/src/server.ts +284 -0
- package/marketplace/plugins/git-forge/tsconfig.json +16 -0
- package/marketplace/plugins/session-info/package.json +4 -2
- package/marketplace/plugins/stats/package.json +4 -2
- package/package.json +6 -1
- package/src/client/components/common/code-surface/blame-hover.ts +188 -0
- package/src/client/components/common/code-surface/blame-panel.test.ts +304 -0
- package/src/client/components/common/code-surface/blame-panel.ts +306 -0
- package/src/client/components/common/code-surface/blame.test.ts +303 -0
- package/src/client/components/common/code-surface/blame.ts +227 -0
- package/src/client/components/common/code-surface/conflict-markers.test.ts +135 -0
- package/src/client/components/common/code-surface/conflict-markers.ts +144 -0
- package/src/client/components/common/code-surface/documents.ts +48 -1
- package/src/client/components/common/code-surface/extensions.test.ts +4 -0
- package/src/client/components/common/code-surface/extensions.ts +44 -0
- package/src/client/components/common/code-surface/fold-stack.test.ts +4 -0
- package/src/client/components/common/code-surface/indent.test.ts +5 -0
- package/src/client/components/common/code-surface/index.tsx +16 -2
- package/src/client/components/common/code-surface/lint-parsers.test.ts +109 -0
- package/src/client/components/common/code-surface/lint-parsers.ts +134 -0
- package/src/client/components/common/code-surface/lint.test.ts +101 -0
- package/src/client/components/common/code-surface/lint.ts +85 -0
- package/src/client/components/common/code-surface/props.ts +17 -0
- package/src/client/components/common/code-surface/surface-failures.test.ts +132 -0
- package/src/client/components/common/code-surface/theme.ts +71 -0
- package/src/client/components/common/header-controls/index.test.tsx +1 -1
- package/src/client/components/common/header-controls/plugin-entry.test.tsx +1 -1
- package/src/client/components/common/header-controls/shell-chrome.test.tsx +1 -1
- package/src/client/components/common/provider-icon/Plate.tsx +88 -0
- package/src/client/components/common/provider-icon/index.tsx +55 -11
- package/src/client/components/layout/session-sidebar/SessionsView.tsx +5 -2
- package/src/client/components/mobile/SessionSidebar.tsx +2 -10
- package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +6 -0
- package/src/client/components/mobile/mobile-right-sidebar/StatusBar.tsx +8 -0
- package/src/client/components/settings/categories/AppearanceSettings.tsx +3 -0
- package/src/client/components/settings/categories/ProviderSettings.tsx +43 -41
- package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +97 -0
- package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +106 -54
- package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +14 -1
- package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +39 -150
- package/src/client/components/settings/categories/panel-plugins/Meta.test.tsx +143 -0
- package/src/client/components/settings/categories/panel-plugins/Meta.tsx +157 -0
- package/src/client/components/settings/categories/panel-plugins/Placement.test.tsx +149 -0
- package/src/client/components/settings/categories/panel-plugins/Placement.tsx +99 -0
- package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +270 -0
- package/src/client/components/settings/categories/panel-plugins/Section.tsx +11 -3
- package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +25 -0
- package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +135 -80
- package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +51 -21
- package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +175 -0
- package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +275 -0
- package/src/client/components/settings/categories/provider-settings/Header.tsx +40 -9
- package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +142 -160
- package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
- package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +84 -46
- package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +217 -102
- package/src/client/components/settings/categories/provider-settings/PresetPicker.tsx +5 -2
- package/src/client/components/settings/categories/provider-settings/SidebarList.plugin.test.ts +3 -3
- package/src/client/components/settings/categories/provider-settings/SidebarList.tsx +158 -102
- package/src/client/components/settings/categories/provider-settings/auth-section.test.tsx +135 -0
- package/src/client/components/settings/categories/provider-settings/groups.test.ts +98 -0
- package/src/client/components/settings/categories/provider-settings/groups.ts +108 -0
- package/src/client/components/settings/categories/provider-settings/layout.test.tsx +325 -0
- package/src/client/components/settings/categories/provider-settings/model-dialogs.test.tsx +135 -0
- package/src/client/components/settings/categories/provider-settings/preset-picker.test.tsx +73 -0
- package/src/client/components/settings/categories/usage-settings/ProviderCard.tsx +22 -2
- package/src/client/components/settings/categories/usage-settings/ProviderDetail.tsx +2 -0
- package/src/client/components/settings/categories/usage-settings/SidebarList.tsx +16 -6
- package/src/client/components/settings/categories/usage-settings/providers.ts +3 -0
- package/src/client/components/settings/categories/usage-settings/usage-and-picker.test.ts +19 -0
- package/src/client/components/settings/categories/usage-settings/usage-icons.test.tsx +143 -0
- package/src/client/components/workspace/chat-timeline/MinimapShortcuts.test.ts +2 -1
- package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +23 -19
- package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +23 -19
- package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +20 -18
- package/src/client/components/workspace/chat-timeline/chat-input/compact.test.tsx +19 -6
- package/src/client/components/workspace/chat-timeline/index.tsx +7 -16
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +100 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +3 -47
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +8 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/wait-test-util.ts +62 -0
- package/src/client/components/workspace/diff-panel/HunkStepper.tsx +62 -0
- package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +29 -0
- package/src/client/components/workspace/diff-panel/Toolbar.tsx +32 -1
- package/src/client/components/workspace/diff-panel/changes.ts +69 -0
- package/src/client/components/workspace/diff-panel/chunks.ts +85 -0
- package/src/client/components/workspace/diff-panel/index.tsx +21 -1
- package/src/client/components/workspace/diff-panel/merge.test.ts +145 -0
- package/src/client/components/workspace/diff-panel/merge.ts +63 -68
- package/src/client/components/workspace/editor/EditorDropOverlay.tsx +6 -1
- package/src/client/components/workspace/editor/FileDocument.tsx +51 -1
- package/src/client/components/workspace/editor/FilePane.tsx +25 -1
- package/src/client/components/workspace/editor/StatusBar.tsx +19 -0
- package/src/client/components/workspace/editor/Toolbar.tsx +29 -5
- package/src/client/components/workspace/editor/toolbar-clusters.test.ts +86 -0
- package/src/client/components/workspace/editor/toolbar-clusters.tsx +48 -16
- package/src/client/components/workspace/editor/viewers/bytes.ts +16 -0
- package/src/client/components/workspace/git-panel/index.test.ts +46 -1
- package/src/client/components/workspace/git-panel/index.tsx +11 -38
- package/src/client/components/workspace/model-dropdown/Item.plugin.test.ts +66 -0
- package/src/client/components/workspace/model-dropdown/Item.tsx +71 -62
- package/src/client/components/workspace/model-dropdown/Section.tsx +31 -14
- package/src/client/components/workspace/model-dropdown/collapsed.ts +72 -0
- package/src/client/components/workspace/model-dropdown/index.tsx +42 -19
- package/src/client/components/workspace/model-dropdown/refresh.test.tsx +260 -0
- package/src/client/components/workspace/model-dropdown/trigger.test.ts +34 -0
- package/src/client/components/workspace/model-dropdown/use-catalog.ts +13 -2
- package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +19 -3
- package/src/client/hooks/chat/omp/folder-auto-expand.ts +113 -0
- package/src/client/hooks/chat/omp/index.ts +20 -0
- package/src/client/hooks/chat/omp/pending-rows.ts +21 -0
- package/src/client/hooks/chat/omp/pending-sessions.test.ts +16 -1
- package/src/client/hooks/chat/omp/session-sidebar-controller.test.ts +102 -0
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +21 -1
- package/src/client/hooks/chat/omp/stream.ts +8 -1
- package/src/client/hooks/chat/timeline/index.ts +1 -1
- package/src/client/hooks/chat/timeline/new-chat-open.ts +60 -0
- package/src/client/hooks/editor/blame-settings.ts +67 -0
- package/src/client/hooks/editor/blame.test.ts +272 -0
- package/src/client/hooks/editor/blame.ts +232 -0
- package/src/client/hooks/editor/file-editor-types.ts +23 -0
- package/src/client/hooks/editor/save-file.test.ts +20 -0
- package/src/client/hooks/editor/use-editor-drop.test-util.ts +198 -0
- package/src/client/hooks/editor/use-editor-drop.test.ts +70 -175
- package/src/client/hooks/editor/use-editor-drop.ts +19 -36
- package/src/client/hooks/editor/use-file-editor.ts +7 -1
- package/src/client/hooks/settings/providers/actions.ts +90 -194
- package/src/client/hooks/settings/providers/api.ts +7 -1
- package/src/client/hooks/settings/providers/index.ts +171 -59
- package/src/client/hooks/settings/providers/login.test.ts +79 -0
- package/src/client/hooks/settings/providers/login.ts +276 -0
- package/src/client/hooks/settings/providers/messages.ts +28 -0
- package/src/client/hooks/settings/providers/model-actions.ts +178 -0
- package/src/client/hooks/ui/editor-error-toast.ts +47 -0
- package/src/client/hooks/ui/open-file.ts +7 -0
- package/src/client/hooks/ui/toasts.ts +7 -0
- package/src/client/hooks/workspace/file-tabs.ts +4 -1
- package/src/client/hooks/workspace/folder-expansion.test.ts +62 -0
- package/src/client/hooks/workspace/folder-expansion.ts +33 -0
- package/src/client/hooks/workspace/git-action-outcome.ts +86 -0
- package/src/client/hooks/workspace/git-actions.ts +29 -2
- package/src/client/hooks/workspace/plugin-contributions.test.ts +117 -0
- package/src/client/hooks/workspace/plugin-contributions.ts +146 -0
- package/src/client/lib/editor-errors.test.ts +85 -0
- package/src/client/lib/editor-errors.ts +71 -0
- package/src/client/lib/fs/resolve-open.test.ts +125 -0
- package/src/client/lib/fs/resolve-open.ts +90 -0
- package/src/client/lib/git/action-message.test.ts +82 -0
- package/src/client/lib/git/action-message.ts +160 -0
- package/src/client/lib/launch/device-files.test.ts +160 -0
- package/src/client/lib/launch/device-files.ts +197 -0
- package/src/client/lib/native/open-paths.test.ts +140 -0
- package/src/client/lib/native/open-paths.ts +157 -0
- package/src/client/lib/plugins/bootstrap.test.ts +1 -1
- package/src/client/main.tsx +20 -0
- package/src/server/db.server.test.ts +39 -0
- package/src/server/db.server.ts +21 -2
- package/src/server/lib/db/schema.ts +2 -0
- package/src/server/lib/fs/external-roots.test.ts +100 -0
- package/src/server/lib/fs/external-roots.ts +101 -0
- package/src/server/lib/fs/git-actions-branch.ts +15 -2
- package/src/server/lib/fs/git-actions-shared.ts +24 -0
- package/src/server/lib/fs/git-actions-sync.test.ts +18 -7
- package/src/server/lib/fs/git-actions-worktree.ts +5 -1
- package/src/server/lib/fs/git-blame.test.ts +206 -0
- package/src/server/lib/fs/git-blame.ts +189 -0
- package/src/server/lib/fs/root.ts +14 -0
- package/src/server/lib/http/same-origin.ts +28 -7
- package/src/server/lib/models/catalog.server.ts +230 -0
- package/src/server/lib/models/catalog.test.ts +83 -0
- package/src/server/lib/models/credential-origin.server.ts +108 -0
- package/src/server/lib/models/credential-origin.test.ts +132 -0
- package/src/server/lib/models/provider-icon-fetch.ts +115 -0
- package/src/server/lib/models/provider-icon-parse.test.ts +134 -0
- package/src/server/lib/models/provider-icon-parse.ts +139 -0
- package/src/server/lib/models/provider-icon-store.server.ts +118 -0
- package/src/server/lib/models/provider-icon-store.test.ts +107 -0
- package/src/server/lib/models/provider-icon.server.ts +209 -0
- package/src/server/lib/models/provider-items.server.ts +211 -37
- package/src/server/lib/models/provider-items.test.ts +201 -0
- package/src/server/lib/models/provider-registry.server.test.ts +27 -9
- package/src/server/lib/models/provider-registry.server.ts +160 -67
- package/src/server/lib/models/registry.server.test.ts +3 -3
- package/src/server/lib/models/registry.server.ts +8 -0
- package/src/server/lib/omp/config/definitions.test.ts +5 -4
- package/src/server/lib/omp/config/models-config.ts +42 -0
- package/src/server/lib/omp/config/provider-entry.test.ts +205 -0
- package/src/server/lib/omp/config/provider-entry.ts +197 -0
- package/src/server/lib/omp/config/provider-seeds.ts +10 -0
- package/src/server/lib/omp/core/models-json.ts +69 -0
- package/src/server/lib/omp/session/messages.ts +17 -3
- package/src/server/lib/omp/session/sidebar-data.canonical.test.ts +13 -3
- package/src/server/lib/panels/bundled-catalog.server.ts +7 -0
- package/src/server/lib/panels/catalog-offers.server.ts +68 -0
- package/src/server/lib/panels/git-update.server.test.ts +14 -0
- package/src/server/lib/panels/git-update.server.ts +63 -1
- package/src/server/lib/panels/manifest.test.ts +65 -0
- package/src/server/lib/panels/manifest.ts +55 -1
- package/src/server/lib/panels/offers.server.test.ts +191 -0
- package/src/server/lib/panels/offers.server.ts +108 -0
- package/src/server/lib/panels/registry.server.test.ts +35 -1
- package/src/server/lib/panels/registry.server.ts +51 -142
- package/src/server/lib/panels/scan.server.ts +162 -0
- package/src/server/lib/route-adapter.ts +13 -2
- package/src/server/lib/tray/tray.test.ts +2 -1
- package/src/server/lib/usage/providers.server.ts +4 -1
- package/src/server/routes/chat/session.ts +7 -1
- package/src/server/routes/fs/git-blame-loader.test.ts +146 -0
- package/src/server/routes/fs/git.ts +17 -0
- package/src/server/routes/fs/grant.test.ts +135 -0
- package/src/server/routes/fs/grant.ts +79 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/fs/scope.ts +34 -17
- package/src/server/routes/omp/login.ts +41 -14
- package/src/server/routes/omp/routes.test.ts +23 -10
- package/src/server/routes/settings/index.ts +8 -0
- package/src/server/routes/settings/provider-entry.ts +108 -0
- package/src/server/routes/settings/provider-icon.ts +99 -0
- package/src/server/routes/settings/provider-model.ts +4 -1
- package/src/server/routes/settings/provider-refresh.ts +87 -0
- package/src/server/routes/settings/providers.ts +31 -2
- package/src/shared/lib/chat/omp/fold.test.ts +34 -0
- package/src/shared/lib/chat/omp/tool-frames.test.ts +20 -0
- package/src/shared/lib/chat/omp/tool-frames.ts +5 -1
- package/src/shared/lib/chat/omp/tool-results.ts +29 -3
- package/src/shared/lib/chat/tool/wait-facts.ts +4 -0
- package/src/shared/lib/fs/git-blame.test.ts +266 -0
- package/src/shared/lib/fs/git-blame.ts +246 -0
- package/src/shared/lib/git/url.ts +18 -0
- package/src/shared/lib/markdown/sanitize.test.ts +57 -0
- package/src/shared/lib/markdown/sanitize.ts +30 -7
- package/src/shared/lib/models/provider/connection.ts +135 -0
- package/src/shared/lib/models/provider/dialect.test.ts +4 -2
- package/src/shared/lib/models/provider/dialect.ts +76 -6
- package/src/shared/lib/models/provider/models.ts +2 -0
- package/src/shared/lib/models/provider/origin.ts +94 -0
- package/src/shared/lib/models/provider/provider-ui.test.ts +7 -0
- package/src/shared/lib/models/server-cache.ts +8 -3
- package/src/shared/lib/omp/session/messages-map-pending.test.ts +110 -0
- package/src/shared/lib/omp/session/messages-map.ts +34 -2
- package/src/shared/lib/omp/session/prewarm-misc.test.ts +7 -90
- package/src/shared/lib/omp/session/prewarm.test.ts +133 -0
- package/src/shared/lib/omp/session/prewarm.ts +23 -1
- package/src/shared/lib/omp/session/wait.test.ts +28 -0
- package/src/shared/lib/omp/session/wait.ts +38 -3
- package/src/shared/lib/panels/slot-labels.test.ts +61 -0
- package/src/shared/lib/panels/slot-labels.ts +133 -0
- package/src/shared/lib/workspace/panel-ids.ts +11 -0
- package/src/shared/types/fs.ts +6 -0
- package/src/shared/types/index.ts +1 -0
- package/src/shared/types/models.ts +12 -0
- package/src/shared/types/panels-registry.ts +277 -0
- package/src/shared/types/panels.ts +46 -213
- package/src/shared/types/settings/provider.ts +58 -0
- package/src/shared/types/settings/usage.ts +10 -0
- package/src/test-support/pristine-globals.ts +7 -0
- package/dist/client/static/js/index-bq6qeayr.css +0 -1
- package/src/client/components/settings/categories/provider-settings/ReconnectModal.tsx +0 -184
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The section list — the panel's sidebar, drawn the way the wiki panel draws its
|
|
8
|
+
* nav, with one difference forced by the subject: at a narrow container the
|
|
9
|
+
* sections become a horizontal strip above the content instead of a column
|
|
10
|
+
* beside it.
|
|
11
|
+
*
|
|
12
|
+
* The wiki can hide its nav behind a drill because a reader there goes nav →
|
|
13
|
+
* page; a forge reader moves between sections constantly (a PR that closes an
|
|
14
|
+
* issue is two sections apart), so the switch has to stay on screen at every
|
|
15
|
+
* width. A strip costs one line and keeps the counts visible, where a drill
|
|
16
|
+
* would bury the panel's primary axis one click deep.
|
|
17
|
+
*
|
|
18
|
+
* A count of zero is shown rather than hidden — "0 releases" is information, and
|
|
19
|
+
* a missing row would make the reader wonder whether the section exists at all.
|
|
20
|
+
* A `+` says the host returned a full page.
|
|
21
|
+
*
|
|
22
|
+
* There is no provider header here: the header's own badge already names the
|
|
23
|
+
* host, and a second `GITHUB` label six lines below it was the panel saying the
|
|
24
|
+
* same thing twice in a 40px column.
|
|
25
|
+
*
|
|
26
|
+
* The state filter (open / closed / all) is deliberately NOT here. It belongs to
|
|
27
|
+
* the list it filters, so it sits in the header beside the refresh — a control
|
|
28
|
+
* that changes the list must not look like a fourth section.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import type { ForgeList, ForgeProvider, ForgeSection } from '../protocol';
|
|
32
|
+
import { Glyph, ICON } from './Glyph';
|
|
33
|
+
import { sectionLabel, sectionShort } from './format';
|
|
34
|
+
|
|
35
|
+
interface SidebarProps {
|
|
36
|
+
sections: readonly ForgeSection[];
|
|
37
|
+
active: ForgeSection;
|
|
38
|
+
list: ForgeList | null;
|
|
39
|
+
provider: ForgeProvider;
|
|
40
|
+
onSelect: (section: ForgeSection) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The mark a section's row carries, so the three are distinguishable at a glance. */
|
|
44
|
+
const SECTION_ICON: Record<ForgeSection, string> = {
|
|
45
|
+
issues: ICON.issueOpen,
|
|
46
|
+
pulls: ICON.pull,
|
|
47
|
+
releases: ICON.release,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export function Sidebar({ sections, active, list, provider, onSelect }: SidebarProps) {
|
|
51
|
+
return (
|
|
52
|
+
<div className="flex h-full min-h-0 w-full flex-col bg-canvas/40">
|
|
53
|
+
<div className="flex min-h-0 flex-1 flex-row overflow-x-auto scrollbar-overlay-container py-0.5 @[520px]:flex-col @[520px]:overflow-x-visible">
|
|
54
|
+
{sections.map((section) => {
|
|
55
|
+
const isActive = section === active;
|
|
56
|
+
const data = list?.sections[section];
|
|
57
|
+
const count = data ? data.items.length : null;
|
|
58
|
+
const name = sectionLabel(section, provider);
|
|
59
|
+
// The name is stated ONCE, explicitly. Both the long and the short
|
|
60
|
+
// label are in the DOM (the breakpoint decides which is drawn), so
|
|
61
|
+
// without this the accessible name concatenates them — measured as
|
|
62
|
+
// `IssuesIssues2+`, which a screen reader reads as two words and a
|
|
63
|
+
// count with no separation. The count is part of the name because it
|
|
64
|
+
// is the reason the row exists.
|
|
65
|
+
const accessibleName = count === null ? name : `${name} — ${count}${data?.truncated ? '+' : ''}`;
|
|
66
|
+
return (
|
|
67
|
+
<button
|
|
68
|
+
key={section}
|
|
69
|
+
type="button"
|
|
70
|
+
onClick={() => onSelect(section)}
|
|
71
|
+
title={name}
|
|
72
|
+
aria-label={accessibleName}
|
|
73
|
+
aria-current={isActive ? 'true' : undefined}
|
|
74
|
+
className={`flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap px-2.5 py-1 text-left text-xs transition-colors @[520px]:w-full @[520px]:whitespace-normal ${
|
|
75
|
+
isActive ? 'bg-ink/8 font-medium text-ink' : 'text-ink/70 hover:bg-ink/5 hover:text-ink'
|
|
76
|
+
}`}
|
|
77
|
+
>
|
|
78
|
+
<Glyph path={SECTION_ICON[section]} size={11} />
|
|
79
|
+
<span aria-hidden="true" className="hidden truncate @[520px]:inline">
|
|
80
|
+
{name}
|
|
81
|
+
</span>
|
|
82
|
+
<span aria-hidden="true" className="@[520px]:hidden">
|
|
83
|
+
{sectionShort(section, provider)}
|
|
84
|
+
</span>
|
|
85
|
+
<span aria-hidden="true" className="ml-auto flex-shrink-0 pl-1 font-mono text-[10px] text-ink/40">
|
|
86
|
+
{count === null ? '' : data?.truncated ? `${count}+` : count}
|
|
87
|
+
</span>
|
|
88
|
+
</button>
|
|
89
|
+
);
|
|
90
|
+
})}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The write surface: one comment box, and the verbs this item allows.
|
|
8
|
+
*
|
|
9
|
+
* ## Every verb is a CONFIRMED action, and the dialog names the consequence
|
|
10
|
+
*
|
|
11
|
+
* "Merge" is one word and an irreversible change to a branch everyone shares, so
|
|
12
|
+
* the confirmation states what will happen — the method, the branch pair, that
|
|
13
|
+
* the source branch may be deleted — rather than asking "are you sure?". The same
|
|
14
|
+
* for close and for request-changes: a dialog that only asks whether the reader
|
|
15
|
+
* meant to click teaches them to click through it.
|
|
16
|
+
*
|
|
17
|
+
* ## The buttons come from the SERVER's capability table
|
|
18
|
+
*
|
|
19
|
+
* `detail.capabilities` is computed per read from the provider, the section and
|
|
20
|
+
* whether a credential exists. A public repository read anonymously therefore
|
|
21
|
+
* offers nothing, and the panel does not have to guess — a button that can only
|
|
22
|
+
* fail is worse than no button, and a second copy of the rules here would drift
|
|
23
|
+
* from the one the server enforces.
|
|
24
|
+
*
|
|
25
|
+
* ## A refusal is reported where the action was
|
|
26
|
+
*
|
|
27
|
+
* The server's sentence ("GitLab has no request-changes event…") lands in the
|
|
28
|
+
* strip above the box, not in a toast: it names what is missing from THIS action,
|
|
29
|
+
* and a message that scrolls away is one the reader has to reproduce.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { useState } from 'preact/hooks';
|
|
33
|
+
|
|
34
|
+
import type { ForgeCapabilities, ForgeCredential, ForgeDetail, ForgeItem, ForgeWrite } from '../protocol';
|
|
35
|
+
import type { ForgeWriteState } from './use-forge';
|
|
36
|
+
import { Glyph, ICON } from './Glyph';
|
|
37
|
+
|
|
38
|
+
interface WriteProps {
|
|
39
|
+
item: ForgeItem;
|
|
40
|
+
detail: ForgeDetail | null;
|
|
41
|
+
capabilities: ForgeCapabilities | null;
|
|
42
|
+
write: ForgeWriteState;
|
|
43
|
+
/** Which credential the server resolved. Absent when it could not be read. */
|
|
44
|
+
credential?: ForgeCredential;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Which dialog is open, if any. */
|
|
48
|
+
type Pending = 'close' | 'reopen' | 'approve' | 'request_changes' | 'merge' | null;
|
|
49
|
+
|
|
50
|
+
const MERGE_METHODS: Array<{ value: 'merge' | 'squash' | 'rebase'; label: string; hint: string }> = [
|
|
51
|
+
{ value: 'merge', label: 'Merge commit', hint: 'Keeps every commit and adds a merge commit.' },
|
|
52
|
+
{ value: 'squash', label: 'Squash', hint: 'One commit on the target branch; the branch history is not kept.' },
|
|
53
|
+
{ value: 'rebase', label: 'Rebase', hint: 'Replays the commits onto the target, with no merge commit.' },
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
/** The sentence a confirmation shows before an irreversible verb runs. */
|
|
57
|
+
export function consequence(item: ForgeItem, pending: Pending, method: 'merge' | 'squash' | 'rebase'): string {
|
|
58
|
+
if (pending === 'merge') {
|
|
59
|
+
const chosen = MERGE_METHODS.find((entry) => entry.value === method);
|
|
60
|
+
return `Merge ${item.number !== null ? `#${item.number}` : item.title} into its target branch with "${chosen?.label ?? method}". ${chosen?.hint ?? ''}`;
|
|
61
|
+
}
|
|
62
|
+
if (pending === 'close') return `Close ${item.number !== null ? `#${item.number}` : item.title}. It stays readable and can be reopened.`;
|
|
63
|
+
if (pending === 'reopen') return `Reopen ${item.number !== null ? `#${item.number}` : item.title}.`;
|
|
64
|
+
if (pending === 'approve') return 'Approve this change. It counts as a review in the host’s own rules.';
|
|
65
|
+
if (pending === 'request_changes') return 'Request changes. The author is notified and the review blocks a merge where the host enforces it.';
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function WriteBar({ item, detail, capabilities, write }: WriteProps) {
|
|
70
|
+
const [body, setBody] = useState('');
|
|
71
|
+
const [pending, setPending] = useState<Pending>(null);
|
|
72
|
+
const [method, setMethod] = useState<'merge' | 'squash' | 'rebase'>('merge');
|
|
73
|
+
|
|
74
|
+
const caps = capabilities;
|
|
75
|
+
const anyVerb = caps ? caps.comment || caps.state || caps.review || caps.merge : false;
|
|
76
|
+
const closed = item.state === 'closed' || item.state === 'merged';
|
|
77
|
+
/** How the item is named in a button's accessible name. */
|
|
78
|
+
const label = item.number !== null ? `#${item.number}` : item.title;
|
|
79
|
+
|
|
80
|
+
const submitComment = async () => {
|
|
81
|
+
const text = body.trim();
|
|
82
|
+
if (!text) return;
|
|
83
|
+
const ok = await write.run({ kind: 'comment', body: text });
|
|
84
|
+
if (ok) setBody('');
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const confirm = async () => {
|
|
88
|
+
if (!pending) return;
|
|
89
|
+
const intent: ForgeWrite | null =
|
|
90
|
+
pending === 'close'
|
|
91
|
+
? { kind: 'state', state: 'closed' }
|
|
92
|
+
: pending === 'reopen'
|
|
93
|
+
? { kind: 'state', state: 'open' }
|
|
94
|
+
: pending === 'merge'
|
|
95
|
+
? { kind: 'merge', method }
|
|
96
|
+
: pending === 'approve'
|
|
97
|
+
? { kind: 'review', verdict: 'approve', body: body.trim() }
|
|
98
|
+
: { kind: 'review', verdict: 'request_changes', body: body.trim() };
|
|
99
|
+
setPending(null);
|
|
100
|
+
const ok = intent ? await write.run(intent) : false;
|
|
101
|
+
if (ok && (pending === 'approve' || pending === 'request_changes')) setBody('');
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
if (!anyVerb && !detail?.capabilities) {
|
|
105
|
+
// A repository read without a credential: the reason is the server's own
|
|
106
|
+
// note, which the detail already carries above the body.
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className="flex flex-shrink-0 flex-col gap-1.5 border-t border-ink/10 px-2.5 py-1.5">
|
|
112
|
+
{caps?.comment && (
|
|
113
|
+
<div className="flex flex-col gap-1">
|
|
114
|
+
<textarea
|
|
115
|
+
value={body}
|
|
116
|
+
onInput={(event) => setBody(event.currentTarget.value)}
|
|
117
|
+
placeholder="Add a comment…"
|
|
118
|
+
aria-label="Comment"
|
|
119
|
+
rows={2}
|
|
120
|
+
className="w-full resize-y rounded border border-ink/15 bg-canvas px-2 py-1.5 text-[11px] text-ink outline-none placeholder-ink/35 focus:border-ink/40"
|
|
121
|
+
/>
|
|
122
|
+
<div className="flex flex-wrap items-center gap-1">
|
|
123
|
+
<button
|
|
124
|
+
type="button"
|
|
125
|
+
onClick={() => void submitComment()}
|
|
126
|
+
disabled={write.pending || body.trim().length === 0}
|
|
127
|
+
aria-label={`Post a comment on ${label}`}
|
|
128
|
+
className="rounded border border-ink/15 px-2 py-1 text-[10px] text-ink transition-colors hover:bg-ink/5 disabled:opacity-40"
|
|
129
|
+
>
|
|
130
|
+
Comment
|
|
131
|
+
</button>
|
|
132
|
+
|
|
133
|
+
{caps.review && !closed && (
|
|
134
|
+
<>
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
onClick={() => setPending('approve')}
|
|
138
|
+
disabled={write.pending}
|
|
139
|
+
aria-label={`Approve ${label}`}
|
|
140
|
+
className="rounded border border-ink/15 px-2 py-1 text-[10px] text-ink transition-colors hover:bg-ink/5 disabled:opacity-40"
|
|
141
|
+
>
|
|
142
|
+
Approve
|
|
143
|
+
</button>
|
|
144
|
+
<button
|
|
145
|
+
type="button"
|
|
146
|
+
onClick={() => setPending('request_changes')}
|
|
147
|
+
disabled={write.pending}
|
|
148
|
+
aria-label={`Request changes on ${label}`}
|
|
149
|
+
className="rounded border border-ink/15 px-2 py-1 text-[10px] text-ink transition-colors hover:bg-ink/5 disabled:opacity-40"
|
|
150
|
+
>
|
|
151
|
+
Request changes
|
|
152
|
+
</button>
|
|
153
|
+
</>
|
|
154
|
+
)}
|
|
155
|
+
|
|
156
|
+
{caps.merge && !closed && (
|
|
157
|
+
<button
|
|
158
|
+
type="button"
|
|
159
|
+
onClick={() => setPending('merge')}
|
|
160
|
+
disabled={write.pending}
|
|
161
|
+
aria-label={`Merge ${label}`}
|
|
162
|
+
className="ml-auto flex items-center gap-1 rounded border border-ink/15 px-2 py-1 text-[10px] text-ink transition-colors hover:bg-ink/5 disabled:opacity-40"
|
|
163
|
+
>
|
|
164
|
+
<Glyph path={ICON.merge} size={10} />
|
|
165
|
+
Merge
|
|
166
|
+
</button>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
{/*
|
|
170
|
+
The accessible name carries the ITEM (`Close #12`), because the
|
|
171
|
+
bare word collides with the header's `Closed` filter: two controls
|
|
172
|
+
whose names differ by a letter are ambiguous to a screen reader and
|
|
173
|
+
to anything else that addresses a control by name.
|
|
174
|
+
*/}
|
|
175
|
+
{caps.state && (
|
|
176
|
+
<button
|
|
177
|
+
type="button"
|
|
178
|
+
onClick={() => setPending(closed ? 'reopen' : 'close')}
|
|
179
|
+
disabled={write.pending}
|
|
180
|
+
aria-label={`${closed ? 'Reopen' : 'Close'} ${label}`}
|
|
181
|
+
className={`${caps.merge && !closed ? '' : 'ml-auto'} rounded border border-ink/15 px-2 py-1 text-[10px] text-ink transition-colors hover:bg-ink/5 disabled:opacity-40`}
|
|
182
|
+
>
|
|
183
|
+
{closed ? 'Reopen' : 'Close'}
|
|
184
|
+
</button>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
)}
|
|
189
|
+
|
|
190
|
+
{write.error && <p className="text-[10.5px] text-error">{write.error}</p>}
|
|
191
|
+
{write.notice && <p className="text-[10.5px] text-success">{write.notice}</p>}
|
|
192
|
+
|
|
193
|
+
{pending && (
|
|
194
|
+
<div className="rounded border border-ink/20 bg-canvas p-2">
|
|
195
|
+
<p className="text-[11px] leading-snug text-ink">{consequence(item, pending, method)}</p>
|
|
196
|
+
{pending === 'merge' && (
|
|
197
|
+
<div className="mt-1.5 flex flex-col gap-0.5">
|
|
198
|
+
{MERGE_METHODS.map((entry) => (
|
|
199
|
+
<label key={entry.value} className="flex items-start gap-1.5 text-[10.5px] text-ink/80">
|
|
200
|
+
<input
|
|
201
|
+
type="radio"
|
|
202
|
+
name="forge-merge-method"
|
|
203
|
+
checked={method === entry.value}
|
|
204
|
+
onChange={() => setMethod(entry.value)}
|
|
205
|
+
className="mt-0.5"
|
|
206
|
+
/>
|
|
207
|
+
<span>
|
|
208
|
+
<span className="font-medium text-ink">{entry.label}</span>
|
|
209
|
+
<span className="text-ink/50"> — {entry.hint}</span>
|
|
210
|
+
</span>
|
|
211
|
+
</label>
|
|
212
|
+
))}
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
<div className="mt-1.5 flex items-center gap-1">
|
|
216
|
+
<button
|
|
217
|
+
type="button"
|
|
218
|
+
onClick={() => void confirm()}
|
|
219
|
+
disabled={write.pending}
|
|
220
|
+
className="rounded bg-ink px-2 py-1 text-[10px] text-canvas transition-opacity hover:opacity-90 disabled:opacity-40"
|
|
221
|
+
>
|
|
222
|
+
{pending === 'merge' ? 'Merge' : pending === 'close' ? 'Close' : pending === 'reopen' ? 'Reopen' : pending === 'approve' ? 'Approve' : 'Request changes'}
|
|
223
|
+
</button>
|
|
224
|
+
<button
|
|
225
|
+
type="button"
|
|
226
|
+
onClick={() => setPending(null)}
|
|
227
|
+
className="rounded px-2 py-1 text-[10px] text-ink/60 hover:text-ink"
|
|
228
|
+
>
|
|
229
|
+
Cancel
|
|
230
|
+
</button>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Presentation of one item's state and time.
|
|
8
|
+
*
|
|
9
|
+
* The tone vocabulary is Kabmo's own status table (`todo/progress.ts` uses the
|
|
10
|
+
* same three tokens): `success` for a live/open state, `warning` for something
|
|
11
|
+
* that wants attention, `ink/45` for settled. A forge's states map onto that
|
|
12
|
+
* directly, which is why no colour is invented here.
|
|
13
|
+
*
|
|
14
|
+
* `stateLabel` is the one place a vendor word is translated for the reader, and
|
|
15
|
+
* it is deliberately generic: `merged` on GitLab and `merged` on GitHub are the
|
|
16
|
+
* same word, but a GitLab *merge request* is what the sidebar calls the section.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { ForgeItemState, ForgeProvider, ForgeSection } from '../protocol';
|
|
20
|
+
|
|
21
|
+
export const STATE_TONE: Record<ForgeItemState, string> = {
|
|
22
|
+
open: 'text-success',
|
|
23
|
+
closed: 'text-ink/45',
|
|
24
|
+
merged: 'text-info',
|
|
25
|
+
draft: 'text-ink/55',
|
|
26
|
+
published: 'text-success',
|
|
27
|
+
prerelease: 'text-warning',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const STATE_LABEL: Record<ForgeItemState, string> = {
|
|
31
|
+
open: 'Open',
|
|
32
|
+
closed: 'Closed',
|
|
33
|
+
merged: 'Merged',
|
|
34
|
+
draft: 'Draft',
|
|
35
|
+
published: 'Published',
|
|
36
|
+
prerelease: 'Pre-release',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** What a section is called, which is the one vendor difference a reader sees. */
|
|
40
|
+
export function sectionLabel(section: ForgeSection, provider: ForgeProvider): string {
|
|
41
|
+
if (section === 'issues') return 'Issues';
|
|
42
|
+
if (section === 'releases') return 'Releases';
|
|
43
|
+
return provider === 'gitlab' ? 'Merge requests' : 'Pull requests';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The short form the phone's chip and the sidebar count use. */
|
|
47
|
+
export function sectionShort(section: ForgeSection, provider: ForgeProvider): string {
|
|
48
|
+
if (section === 'issues') return 'Issues';
|
|
49
|
+
if (section === 'releases') return 'Releases';
|
|
50
|
+
return provider === 'gitlab' ? 'MRs' : 'PRs';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A compact age: `now`, `5m`, `3h`, `2d`, `4w`.
|
|
55
|
+
*
|
|
56
|
+
* Compact rather than "3 days ago" because a row is one line at 11px in a 320px
|
|
57
|
+
* panel, and the date is context rather than the thing being read.
|
|
58
|
+
*/
|
|
59
|
+
export function relativeTime(iso: string, now = Date.now()): string {
|
|
60
|
+
const at = Date.parse(iso);
|
|
61
|
+
if (!Number.isFinite(at)) return '';
|
|
62
|
+
const seconds = Math.max(0, Math.round((now - at) / 1000));
|
|
63
|
+
if (seconds < 60) return 'now';
|
|
64
|
+
const minutes = Math.round(seconds / 60);
|
|
65
|
+
if (minutes < 60) return `${minutes}m`;
|
|
66
|
+
const hours = Math.round(minutes / 60);
|
|
67
|
+
if (hours < 24) return `${hours}h`;
|
|
68
|
+
const days = Math.round(hours / 24);
|
|
69
|
+
if (days < 7) return `${days}d`;
|
|
70
|
+
const weeks = Math.round(days / 7);
|
|
71
|
+
if (weeks < 5) return `${weeks}w`;
|
|
72
|
+
return `${Math.round(days / 30)}mo`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** `#12` for an issue or request; the tag for a release. */
|
|
76
|
+
export function itemIdLabel(item: { number: number | null; tag: string | null }): string {
|
|
77
|
+
return item.number !== null ? `#${item.number}` : (item.tag ?? '');
|
|
78
|
+
}
|