@dfosco/storyboard-core 4.2.0-beta.2 → 4.2.0-beta.21
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/commandpalette.config.json +109 -24
- package/dist/storyboard-ui.css +1 -1
- package/dist/storyboard-ui.js +17379 -28568
- package/dist/storyboard-ui.js.map +1 -1
- package/dist/tailwind.css +1 -1
- package/package.json +5 -2
- package/scaffold/agents/prompt-agent.agent.md +181 -0
- package/scaffold/agents/terminal-agent.agent.md +351 -0
- package/scaffold/codex/config.toml +246 -0
- package/scaffold/manifest.json +5 -0
- package/scaffold/skills/canvas/SKILL.md +5 -4
- package/scaffold/skills/ship/SKILL.md +1 -1
- package/scaffold/storyboard.config.json +14 -1
- package/scaffold/toolbar.config.json +1 -1
- package/src/ActionMenuButton.jsx +100 -0
- package/src/AutosyncMenuButton.css +67 -0
- package/src/AutosyncMenuButton.jsx +241 -0
- package/src/BranchSelect.jsx +29 -0
- package/src/BranchSelect.module.css +30 -0
- package/src/CanvasAgentsMenu.jsx +87 -0
- package/src/CanvasCreateMenu.jsx +609 -0
- package/src/CanvasSnap.css +27 -0
- package/src/CanvasSnap.jsx +51 -0
- package/src/CanvasUndoRedo.css +36 -0
- package/src/CanvasUndoRedo.jsx +62 -0
- package/src/CanvasZoomControl.css +53 -0
- package/src/CanvasZoomControl.jsx +49 -0
- package/src/CanvasZoomToFit.css +18 -0
- package/src/CanvasZoomToFit.jsx +26 -0
- package/src/CommandMenu.css +8 -0
- package/src/CommandMenu.jsx +286 -0
- package/src/CommandPalette.jsx +35 -0
- package/src/CommandPaletteTrigger.jsx +25 -0
- package/src/CommentsMenuButton.jsx +38 -0
- package/src/CoreUIBar.css +47 -0
- package/src/CoreUIBar.jsx +855 -0
- package/src/CreateMenuButton.jsx +116 -0
- package/src/HideChromeTrigger.jsx +40 -0
- package/src/InspectorPanel.css +109 -0
- package/src/InspectorPanel.jsx +629 -0
- package/src/PwaInstallBanner.css +42 -0
- package/src/PwaInstallBanner.jsx +124 -0
- package/src/SidePanel.jsx +260 -0
- package/src/ThemeMenuButton.jsx +136 -0
- package/src/autosync/server.js +202 -5
- package/src/autosync/server.test.js +112 -0
- package/src/canvas/__tests__/agent-integration.test.js +593 -0
- package/src/canvas/__tests__/helpers/browser.js +95 -0
- package/src/canvas/__tests__/helpers/canvas-api.js +129 -0
- package/src/canvas/__tests__/helpers/perf.js +118 -0
- package/src/canvas/__tests__/helpers/setup.js +176 -0
- package/src/canvas/__tests__/helpers/tmux.js +130 -0
- package/src/canvas/__tests__/helpers/transcript.js +129 -0
- package/src/canvas/__tests__/terminal-integration.test.js +175 -0
- package/src/canvas/hot-pool.js +757 -0
- package/src/canvas/materializer.js +31 -0
- package/src/canvas/materializer.test.js +56 -0
- package/src/canvas/selectedWidgets.js +65 -7
- package/src/canvas/server.js +1801 -22
- package/src/canvas/server.test.js +239 -0
- package/src/canvas/terminal-config.js +331 -0
- package/src/canvas/terminal-registry.js +38 -0
- package/src/canvas/terminal-server.js +1037 -29
- package/src/canvas/writeGuard.js +51 -3
- package/src/canvasConfig.js +67 -1
- package/src/canvasConfig.test.js +79 -1
- package/src/cli/agent.js +85 -0
- package/src/cli/branch.js +232 -0
- package/src/cli/canvasAdd.js +59 -12
- package/src/cli/canvasBatch.js +98 -0
- package/src/cli/canvasBounds.js +1 -1
- package/src/cli/canvasRead.js +1 -1
- package/src/cli/canvasUpdate.js +179 -0
- package/src/cli/create.js +38 -14
- package/src/cli/dev.js +157 -83
- package/src/cli/exit.js +23 -24
- package/src/cli/index.js +55 -2
- package/src/cli/proxy.js +96 -37
- package/src/cli/schemas.js +22 -4
- package/src/cli/server.js +148 -25
- package/src/cli/serverUrl.js +8 -3
- package/src/cli/sessions.js +131 -5
- package/src/cli/setup.js +109 -11
- package/src/cli/terminal-commands.js +16 -8
- package/src/cli/terminal-messaging.js +231 -0
- package/src/cli/terminal-welcome.js +365 -33
- package/src/commandActions.js +1 -0
- package/src/commandPaletteConfig.js +9 -0
- package/src/comments/auth.js +2 -1
- package/src/comments/ui/AuthModal.jsx +114 -0
- package/src/comments/ui/CommentWindow.jsx +329 -0
- package/src/comments/ui/CommentsDrawer.jsx +102 -0
- package/src/comments/ui/Composer.jsx +64 -0
- package/src/comments/ui/authModal.test.js +1 -1
- package/src/comments/ui/commentWindow.js +16 -17
- package/src/comments/ui/commentsDrawer.js +25 -26
- package/src/comments/ui/composer.js +23 -24
- package/src/comments/ui/index.js +2 -3
- package/src/configSchema.js +59 -1
- package/src/configStore.js +161 -0
- package/src/core-ui-colors.css +12 -0
- package/src/devtools.js +17 -19
- package/src/devtools.test.js +18 -9
- package/src/featureFlags.js +12 -5
- package/src/fuzzySearch.test.js +10 -0
- package/src/index.js +14 -2
- package/src/lib/components/ui/alert/alert-action.jsx +11 -0
- package/src/lib/components/ui/alert/alert-description.jsx +11 -0
- package/src/lib/components/ui/alert/alert-title.jsx +11 -0
- package/src/lib/components/ui/alert/alert.jsx +25 -0
- package/src/lib/components/ui/alert/index.js +15 -15
- package/src/lib/components/ui/avatar/avatar-badge.jsx +22 -0
- package/src/lib/components/ui/avatar/avatar-fallback.jsx +18 -0
- package/src/lib/components/ui/avatar/avatar-group-count.jsx +19 -0
- package/src/lib/components/ui/avatar/avatar-group.jsx +19 -0
- package/src/lib/components/ui/avatar/avatar-image.jsx +15 -0
- package/src/lib/components/ui/avatar/avatar.jsx +19 -0
- package/src/lib/components/ui/avatar/index.js +20 -20
- package/src/lib/components/ui/badge/badge.jsx +31 -0
- package/src/lib/components/ui/badge/index.js +2 -2
- package/src/lib/components/ui/button/button.jsx +100 -0
- package/src/lib/components/ui/button/index.js +9 -9
- package/src/lib/components/ui/card/card-action.jsx +11 -0
- package/src/lib/components/ui/card/card-content.jsx +11 -0
- package/src/lib/components/ui/card/card-description.jsx +11 -0
- package/src/lib/components/ui/card/card-footer.jsx +11 -0
- package/src/lib/components/ui/card/card-header.jsx +19 -0
- package/src/lib/components/ui/card/card-title.jsx +11 -0
- package/src/lib/components/ui/card/card.jsx +17 -0
- package/src/lib/components/ui/card/index.js +23 -23
- package/src/lib/components/ui/checkbox/checkbox.jsx +29 -0
- package/src/lib/components/ui/checkbox/index.js +5 -5
- package/src/lib/components/ui/collapsible/collapsible-content.jsx +7 -0
- package/src/lib/components/ui/collapsible/collapsible-trigger.jsx +7 -0
- package/src/lib/components/ui/collapsible/collapsible.jsx +7 -0
- package/src/lib/components/ui/collapsible/index.js +11 -11
- package/src/lib/components/ui/dialog/dialog-close.jsx +7 -0
- package/src/lib/components/ui/dialog/dialog-content.jsx +34 -0
- package/src/lib/components/ui/dialog/dialog-description.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-footer.jsx +23 -0
- package/src/lib/components/ui/dialog/dialog-header.jsx +11 -0
- package/src/lib/components/ui/dialog/dialog-overlay.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-portal.jsx +4 -0
- package/src/lib/components/ui/dialog/dialog-title.jsx +15 -0
- package/src/lib/components/ui/dialog/dialog-trigger.jsx +7 -0
- package/src/lib/components/ui/dialog/dialog.jsx +4 -0
- package/src/lib/components/ui/dialog/index.js +32 -32
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.jsx +8 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.jsx +30 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.jsx +22 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.jsx +16 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.jsx +20 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.jsx +17 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-portal.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.jsx +29 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.jsx +15 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.jsx +16 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.jsx +15 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.jsx +23 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.jsx +7 -0
- package/src/lib/components/ui/dropdown-menu/dropdown-menu.jsx +4 -0
- package/src/lib/components/ui/dropdown-menu/index.js +52 -52
- package/src/lib/components/ui/input/index.js +5 -5
- package/src/lib/components/ui/input/input.jsx +19 -0
- package/src/lib/components/ui/label/index.js +5 -5
- package/src/lib/components/ui/label/label.jsx +19 -0
- package/src/lib/components/ui/panel/index.js +21 -21
- package/src/lib/components/ui/panel/panel-body.jsx +11 -0
- package/src/lib/components/ui/panel/panel-close.jsx +16 -0
- package/src/lib/components/ui/panel/panel-content.jsx +29 -0
- package/src/lib/components/ui/panel/panel-footer.jsx +11 -0
- package/src/lib/components/ui/panel/panel-header.jsx +11 -0
- package/src/lib/components/ui/panel/panel-title.jsx +12 -0
- package/src/lib/components/ui/panel/panel.jsx +4 -0
- package/src/lib/components/ui/popover/index.js +26 -26
- package/src/lib/components/ui/popover/popover-close.jsx +7 -0
- package/src/lib/components/ui/popover/popover-content.jsx +22 -0
- package/src/lib/components/ui/popover/popover-description.jsx +11 -0
- package/src/lib/components/ui/popover/popover-header.jsx +11 -0
- package/src/lib/components/ui/popover/popover-portal.jsx +4 -0
- package/src/lib/components/ui/popover/popover-title.jsx +11 -0
- package/src/lib/components/ui/popover/popover-trigger.jsx +8 -0
- package/src/lib/components/ui/popover/popover.jsx +4 -0
- package/src/lib/components/ui/searchable-list.jsx +159 -0
- package/src/lib/components/ui/select/index.js +35 -35
- package/src/lib/components/ui/select/select-content.jsx +30 -0
- package/src/lib/components/ui/select/select-group-heading.jsx +17 -0
- package/src/lib/components/ui/select/select-group.jsx +15 -0
- package/src/lib/components/ui/select/select-item.jsx +26 -0
- package/src/lib/components/ui/select/select-label.jsx +11 -0
- package/src/lib/components/ui/select/select-portal.jsx +4 -0
- package/src/lib/components/ui/select/select-scroll-down-button.jsx +18 -0
- package/src/lib/components/ui/select/select-scroll-up-button.jsx +18 -0
- package/src/lib/components/ui/select/select-separator.jsx +15 -0
- package/src/lib/components/ui/select/select-trigger.jsx +25 -0
- package/src/lib/components/ui/select/select.jsx +4 -0
- package/src/lib/components/ui/separator/index.js +5 -5
- package/src/lib/components/ui/separator/separator.jsx +22 -0
- package/src/lib/components/ui/sheet/index.js +32 -32
- package/src/lib/components/ui/sheet/sheet-close.jsx +7 -0
- package/src/lib/components/ui/sheet/sheet-content.jsx +35 -0
- package/src/lib/components/ui/sheet/sheet-description.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-footer.jsx +11 -0
- package/src/lib/components/ui/sheet/sheet-header.jsx +11 -0
- package/src/lib/components/ui/sheet/sheet-overlay.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-portal.jsx +4 -0
- package/src/lib/components/ui/sheet/sheet-title.jsx +15 -0
- package/src/lib/components/ui/sheet/sheet-trigger.jsx +7 -0
- package/src/lib/components/ui/sheet/sheet.jsx +4 -0
- package/src/lib/components/ui/textarea/index.js +5 -5
- package/src/lib/components/ui/textarea/textarea.jsx +18 -0
- package/src/lib/components/ui/toggle/index.js +6 -9
- package/src/lib/components/ui/toggle/toggle.jsx +36 -0
- package/src/lib/components/ui/toggle-group/index.js +8 -8
- package/src/lib/components/ui/toggle-group/toggle-group-item.jsx +29 -0
- package/src/lib/components/ui/toggle-group/toggle-group.jsx +43 -0
- package/src/lib/components/ui/tooltip/index.js +3 -3
- package/src/lib/components/ui/tooltip/tooltip-content.jsx +21 -0
- package/src/lib/components/ui/tooltip/tooltip-trigger.jsx +23 -0
- package/src/lib/components/ui/tooltip/tooltip.jsx +11 -0
- package/src/lib/components/ui/trigger-button/index.js +3 -3
- package/src/lib/components/ui/trigger-button/trigger-button.css +38 -0
- package/src/lib/components/ui/trigger-button/trigger-button.jsx +63 -0
- package/src/logger/devLogger.js +238 -0
- package/src/logger/devLogger.test.js +193 -0
- package/src/modes.test.js +4 -4
- package/src/mountStoryboardCore.js +123 -27
- package/src/paletteProviders.js +3 -0
- package/src/paletteProviders.test.js +2 -2
- package/src/server/index.js +98 -36
- package/src/sidepanel.css +214 -0
- package/src/styles/tailwind.css +1 -1
- package/src/svelte-plugin-ui/__tests__/ModeSwitch.test.ts +8 -8
- package/src/svelte-plugin-ui/__tests__/ToolbarShell.test.ts +11 -10
- package/src/svelte-plugin-ui/components/Icon.css +11 -0
- package/src/svelte-plugin-ui/components/Icon.jsx +281 -0
- package/src/svelte-plugin-ui/components/ModeSwitch.css +90 -0
- package/src/svelte-plugin-ui/components/ModeSwitch.jsx +47 -0
- package/src/svelte-plugin-ui/components/ToolbarShell.css +80 -0
- package/src/svelte-plugin-ui/components/ToolbarShell.jsx +84 -0
- package/src/svelte-plugin-ui/components/Viewfinder.css +412 -0
- package/src/svelte-plugin-ui/components/Viewfinder.jsx +512 -0
- package/src/svelte-plugin-ui/mount.ts +12 -16
- package/src/toolRegistry.js +4 -4
- package/src/toolbarConfigStore.js +30 -0
- package/src/tools/handlers/autosync.js +1 -1
- package/src/tools/handlers/canvasAddWidget.js +1 -1
- package/src/tools/handlers/canvasAgents.js +19 -0
- package/src/tools/handlers/canvasToolbar.js +8 -8
- package/src/tools/handlers/commandPalette.js +9 -0
- package/src/tools/handlers/comments.js +1 -1
- package/src/tools/handlers/create.js +1 -1
- package/src/tools/handlers/devtools.js +16 -0
- package/src/tools/handlers/devtools.test.js +38 -0
- package/src/tools/handlers/flows.js +1 -1
- package/src/tools/handlers/hideChrome.js +9 -0
- package/src/tools/handlers/paletteTheme.js +35 -0
- package/src/tools/handlers/theme.js +1 -1
- package/src/tools/registry.js +4 -1
- package/src/tools/surfaces/commandList.js +3 -3
- package/src/tools/surfaces/mainToolbar.js +3 -3
- package/src/tools/surfaces/registry.js +4 -4
- package/src/ui/design-modes.ts +2 -2
- package/src/ui/viewfinder.ts +1 -1
- package/src/vite/server-plugin.js +242 -60
- package/src/workshop/features/createCanvas/CreateCanvasForm.jsx +260 -0
- package/src/workshop/features/createCanvas/index.js +1 -1
- package/src/workshop/features/createFlow/CreateFlowForm.jsx +334 -0
- package/src/workshop/features/createFlow/index.js +1 -1
- package/src/workshop/features/createPage/CreatePageForm.jsx +304 -0
- package/src/workshop/features/createPage/index.js +1 -1
- package/src/workshop/features/createPrototype/CreatePrototypeForm.jsx +289 -0
- package/src/workshop/features/createPrototype/index.js +1 -1
- package/src/workshop/features/createPrototype/server.js +98 -0
- package/src/workshop/features/createStory/CreateStoryForm.jsx +208 -0
- package/src/workshop/features/createStory/index.js +1 -1
- package/src/workshop/ui/WorkshopPanel.jsx +98 -0
- package/src/workshop/ui/mount.ts +1 -1
- package/src/worktree/port.js +48 -0
- package/src/worktree/serverRegistry.js +120 -0
- package/toolbar.config.json +93 -42
- package/widgets.config.json +580 -12
- package/src/ActionMenuButton.svelte +0 -119
- package/src/AutosyncMenuButton.svelte +0 -397
- package/src/CanvasCreateMenu.svelte +0 -295
- package/src/CanvasSnap.svelte +0 -87
- package/src/CanvasUndoRedo.svelte +0 -108
- package/src/CanvasZoomControl.svelte +0 -111
- package/src/CanvasZoomToFit.svelte +0 -52
- package/src/CommandMenu.svelte +0 -249
- package/src/CommandPalette.svelte +0 -33
- package/src/CommentsMenuButton.svelte +0 -53
- package/src/CoreUIBar.svelte +0 -847
- package/src/CreateMenuButton.svelte +0 -133
- package/src/DocPanel.svelte +0 -299
- package/src/InspectorPanel.svelte +0 -745
- package/src/PwaInstallBanner.svelte +0 -124
- package/src/SidePanel.svelte +0 -480
- package/src/ThemeMenuButton.svelte +0 -132
- package/src/comments/ui/AuthModal.svelte +0 -108
- package/src/comments/ui/CommentWindow.svelte +0 -333
- package/src/comments/ui/CommentsDrawer.svelte +0 -96
- package/src/comments/ui/Composer.svelte +0 -65
- package/src/lib/components/ui/alert/alert-action.svelte +0 -19
- package/src/lib/components/ui/alert/alert-description.svelte +0 -22
- package/src/lib/components/ui/alert/alert-title.svelte +0 -22
- package/src/lib/components/ui/alert/alert.svelte +0 -38
- package/src/lib/components/ui/avatar/avatar-badge.svelte +0 -25
- package/src/lib/components/ui/avatar/avatar-fallback.svelte +0 -20
- package/src/lib/components/ui/avatar/avatar-group-count.svelte +0 -22
- package/src/lib/components/ui/avatar/avatar-group.svelte +0 -22
- package/src/lib/components/ui/avatar/avatar-image.svelte +0 -17
- package/src/lib/components/ui/avatar/avatar.svelte +0 -24
- package/src/lib/components/ui/badge/badge.svelte +0 -44
- package/src/lib/components/ui/button/button.svelte +0 -108
- package/src/lib/components/ui/card/card-action.svelte +0 -21
- package/src/lib/components/ui/card/card-content.svelte +0 -19
- package/src/lib/components/ui/card/card-description.svelte +0 -19
- package/src/lib/components/ui/card/card-footer.svelte +0 -18
- package/src/lib/components/ui/card/card-header.svelte +0 -21
- package/src/lib/components/ui/card/card-title.svelte +0 -14
- package/src/lib/components/ui/card/card.svelte +0 -21
- package/src/lib/components/ui/checkbox/checkbox.svelte +0 -39
- package/src/lib/components/ui/collapsible/collapsible-content.svelte +0 -7
- package/src/lib/components/ui/collapsible/collapsible-trigger.svelte +0 -7
- package/src/lib/components/ui/collapsible/collapsible.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog-close.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog-content.svelte +0 -42
- package/src/lib/components/ui/dialog/dialog-description.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-footer.svelte +0 -29
- package/src/lib/components/ui/dialog/dialog-header.svelte +0 -19
- package/src/lib/components/ui/dialog/dialog-overlay.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-portal.svelte +0 -7
- package/src/lib/components/ui/dialog/dialog-title.svelte +0 -17
- package/src/lib/components/ui/dialog/dialog-trigger.svelte +0 -11
- package/src/lib/components/ui/dialog/dialog.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +0 -16
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +0 -40
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +0 -27
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +0 -18
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-group.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +0 -24
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +0 -20
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-portal.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +0 -16
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +0 -34
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +0 -17
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +0 -19
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +0 -17
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +0 -27
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-sub.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +0 -7
- package/src/lib/components/ui/dropdown-menu/dropdown-menu.svelte +0 -7
- package/src/lib/components/ui/input/input.svelte +0 -40
- package/src/lib/components/ui/label/label.svelte +0 -20
- package/src/lib/components/ui/panel/panel-body.svelte +0 -13
- package/src/lib/components/ui/panel/panel-close.svelte +0 -16
- package/src/lib/components/ui/panel/panel-content.svelte +0 -33
- package/src/lib/components/ui/panel/panel-footer.svelte +0 -13
- package/src/lib/components/ui/panel/panel-header.svelte +0 -16
- package/src/lib/components/ui/panel/panel-title.svelte +0 -14
- package/src/lib/components/ui/panel/panel.svelte +0 -15
- package/src/lib/components/ui/popover/popover-close.svelte +0 -7
- package/src/lib/components/ui/popover/popover-content.svelte +0 -27
- package/src/lib/components/ui/popover/popover-description.svelte +0 -19
- package/src/lib/components/ui/popover/popover-header.svelte +0 -19
- package/src/lib/components/ui/popover/popover-portal.svelte +0 -7
- package/src/lib/components/ui/popover/popover-title.svelte +0 -19
- package/src/lib/components/ui/popover/popover-trigger.svelte +0 -17
- package/src/lib/components/ui/popover/popover.svelte +0 -7
- package/src/lib/components/ui/select/select-content.svelte +0 -40
- package/src/lib/components/ui/select/select-group-heading.svelte +0 -19
- package/src/lib/components/ui/select/select-group.svelte +0 -17
- package/src/lib/components/ui/select/select-item.svelte +0 -38
- package/src/lib/components/ui/select/select-label.svelte +0 -18
- package/src/lib/components/ui/select/select-portal.svelte +0 -7
- package/src/lib/components/ui/select/select-scroll-down-button.svelte +0 -20
- package/src/lib/components/ui/select/select-scroll-up-button.svelte +0 -20
- package/src/lib/components/ui/select/select-separator.svelte +0 -17
- package/src/lib/components/ui/select/select-trigger.svelte +0 -27
- package/src/lib/components/ui/select/select.svelte +0 -11
- package/src/lib/components/ui/separator/separator.svelte +0 -23
- package/src/lib/components/ui/sheet/sheet-close.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet-content.svelte +0 -43
- package/src/lib/components/ui/sheet/sheet-description.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-footer.svelte +0 -18
- package/src/lib/components/ui/sheet/sheet-header.svelte +0 -19
- package/src/lib/components/ui/sheet/sheet-overlay.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-portal.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet-title.svelte +0 -17
- package/src/lib/components/ui/sheet/sheet-trigger.svelte +0 -7
- package/src/lib/components/ui/sheet/sheet.svelte +0 -7
- package/src/lib/components/ui/textarea/textarea.svelte +0 -21
- package/src/lib/components/ui/toggle/toggle.svelte +0 -45
- package/src/lib/components/ui/toggle-group/toggle-group-item.svelte +0 -35
- package/src/lib/components/ui/toggle-group/toggle-group.svelte +0 -63
- package/src/lib/components/ui/tooltip/tooltip-content.svelte +0 -24
- package/src/lib/components/ui/tooltip/tooltip-trigger.svelte +0 -27
- package/src/lib/components/ui/tooltip/tooltip.svelte +0 -9
- package/src/lib/components/ui/trigger-button/trigger-button.svelte +0 -106
- package/src/svelte-plugin-ui/components/Icon.svelte +0 -181
- package/src/svelte-plugin-ui/components/ModeSwitch.svelte +0 -121
- package/src/svelte-plugin-ui/components/ToolbarShell.svelte +0 -150
- package/src/svelte-plugin-ui/components/Viewfinder.svelte +0 -1001
- package/src/tools/handlers/docs.js +0 -11
- package/src/workshop/features/createCanvas/CreateCanvasForm.svelte +0 -139
- package/src/workshop/features/createFlow/CreateFlowForm.svelte +0 -314
- package/src/workshop/features/createPage/CreatePageForm.svelte +0 -249
- package/src/workshop/features/createPrototype/CreatePrototypeForm.svelte +0 -287
- package/src/workshop/features/createStory/CreateStoryForm.svelte +0 -161
- package/src/workshop/ui/WorkshopPanel.svelte +0 -97
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import './trigger-button.css';
|
|
2
|
+
import { useMemo, forwardRef } from "react";
|
|
3
|
+
import { cn } from "../../../utils/index.js";
|
|
4
|
+
import { registerSmoothCorners } from '../../../../smoothCorners.js';
|
|
5
|
+
import { Button } from '../../../components/ui/button/index.js';
|
|
6
|
+
|
|
7
|
+
registerSmoothCorners();
|
|
8
|
+
|
|
9
|
+
const TriggerButton = forwardRef(function TriggerButton({
|
|
10
|
+
className,
|
|
11
|
+
wrapperClass = "",
|
|
12
|
+
active = false,
|
|
13
|
+
inactive = false,
|
|
14
|
+
dimmed = false,
|
|
15
|
+
localOnly = false,
|
|
16
|
+
size = "icon-2xl",
|
|
17
|
+
children,
|
|
18
|
+
// Separate Radix trigger props from button props
|
|
19
|
+
'aria-expanded': ariaExpanded,
|
|
20
|
+
'data-state': dataState,
|
|
21
|
+
'aria-haspopup': ariaHaspopup,
|
|
22
|
+
...props
|
|
23
|
+
}, ref) {
|
|
24
|
+
const borderWidth = useMemo(
|
|
25
|
+
() => ['icon-2xl', 'icon-xl', '2xl', 'xl'].includes(size) ? '3px' : '2px',
|
|
26
|
+
[size]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<span
|
|
31
|
+
ref={ref}
|
|
32
|
+
data-trigger-button=""
|
|
33
|
+
data-active={active || undefined}
|
|
34
|
+
data-inactive={inactive || undefined}
|
|
35
|
+
data-dimmed={dimmed || undefined}
|
|
36
|
+
data-local-only={localOnly || undefined}
|
|
37
|
+
style={{ '--sb--trigger-border-width': borderWidth }}
|
|
38
|
+
aria-expanded={ariaExpanded}
|
|
39
|
+
data-state={dataState}
|
|
40
|
+
aria-haspopup={ariaHaspopup}
|
|
41
|
+
>
|
|
42
|
+
<Button
|
|
43
|
+
variant="trigger"
|
|
44
|
+
size={size}
|
|
45
|
+
disabled={inactive}
|
|
46
|
+
wrapperClass={cn(
|
|
47
|
+
"smooth-corners [--sb--smooth-corners:4] hover:rotate-2 focus-visible:rotate-2 transition-transform",
|
|
48
|
+
active && !inactive && "rotate-2",
|
|
49
|
+
wrapperClass
|
|
50
|
+
)}
|
|
51
|
+
className={cn(
|
|
52
|
+
"smooth-corners leading-none font-semibold",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</Button>
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export default TriggerButton;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev Logger — structured JSONL logging for storyboard dev server errors.
|
|
3
|
+
*
|
|
4
|
+
* Writes one JSONL file per day to `.storyboard/logs/{YYYY-MM-DD}.jsonl`.
|
|
5
|
+
* Automatically enriches log entries with context extracted from request URLs
|
|
6
|
+
* (canvas name, prototype, page, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* import { createDevLogger } from './logger/devLogger.js'
|
|
10
|
+
* const logger = createDevLogger({ root, devDomain, branch })
|
|
11
|
+
* logger.logResponse({ status: 404, method: 'GET', url: '/...', route: 'canvas', error: '...' })
|
|
12
|
+
* logger.logEvent('warn', 'Something happened', { extra: 'context' })
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fs from 'node:fs'
|
|
16
|
+
import path from 'node:path'
|
|
17
|
+
|
|
18
|
+
const LOGS_DIR_NAME = 'logs'
|
|
19
|
+
const STORYBOARD_DIR = '.storyboard'
|
|
20
|
+
const MAX_AGE_DAYS = 7
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Format a Date as YYYY-MM-DD.
|
|
24
|
+
*/
|
|
25
|
+
function dateStamp(date = new Date()) {
|
|
26
|
+
return date.toISOString().slice(0, 10)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Extract contextual metadata from a request URL.
|
|
31
|
+
* Parses query params and path segments to find canvas, prototype, and page.
|
|
32
|
+
*/
|
|
33
|
+
function extractContext(url) {
|
|
34
|
+
const ctx = { canvas: null, prototype: null, page: null }
|
|
35
|
+
if (!url) return ctx
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const parsed = new URL(url, 'http://localhost')
|
|
39
|
+
const params = parsed.searchParams
|
|
40
|
+
|
|
41
|
+
// Canvas name from ?name= query param (used by canvas CRUD routes)
|
|
42
|
+
if (params.has('name')) ctx.canvas = params.get('name')
|
|
43
|
+
|
|
44
|
+
// Prototype from path: /PrototypeName/... or ?prototype=
|
|
45
|
+
if (params.has('prototype')) ctx.prototype = params.get('prototype')
|
|
46
|
+
|
|
47
|
+
// Page from path segments or ?page=
|
|
48
|
+
if (params.has('page')) ctx.page = params.get('page')
|
|
49
|
+
|
|
50
|
+
// Infer from path: /_storyboard/canvas/... → canvas route
|
|
51
|
+
const pathname = parsed.pathname
|
|
52
|
+
if (!ctx.canvas && pathname.includes('/canvas/')) {
|
|
53
|
+
const segments = pathname.split('/').filter(Boolean)
|
|
54
|
+
const canvasIdx = segments.indexOf('canvas')
|
|
55
|
+
if (canvasIdx >= 0 && segments[canvasIdx + 1]) {
|
|
56
|
+
const sub = segments[canvasIdx + 1]
|
|
57
|
+
// Skip known sub-routes
|
|
58
|
+
if (!['read', 'list', 'update', 'widget', 'create', 'folders',
|
|
59
|
+
'connector', 'stories', 'create-story', 'github', 'image',
|
|
60
|
+
'images', 'terminal-buffer', 'terminal-snapshot',
|
|
61
|
+
'rename-page', 'reorder-pages', 'page-order',
|
|
62
|
+
'update-folder-meta', 'duplicate', 'image-proxy'].includes(sub)) {
|
|
63
|
+
ctx.canvas = sub
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
// URL parsing failed — return empty context
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return ctx
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Prune log files older than MAX_AGE_DAYS.
|
|
76
|
+
*/
|
|
77
|
+
function pruneOldLogs(logsDir) {
|
|
78
|
+
try {
|
|
79
|
+
const files = fs.readdirSync(logsDir)
|
|
80
|
+
const cutoff = Date.now() - MAX_AGE_DAYS * 24 * 60 * 60 * 1000
|
|
81
|
+
|
|
82
|
+
for (const file of files) {
|
|
83
|
+
if (!file.endsWith('.jsonl')) continue
|
|
84
|
+
const dateStr = file.replace('.jsonl', '')
|
|
85
|
+
const fileDate = new Date(dateStr + 'T00:00:00Z')
|
|
86
|
+
if (isNaN(fileDate.getTime())) continue
|
|
87
|
+
if (fileDate.getTime() < cutoff) {
|
|
88
|
+
try {
|
|
89
|
+
fs.unlinkSync(path.join(logsDir, file))
|
|
90
|
+
} catch { /* best-effort */ }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} catch {
|
|
94
|
+
// Directory might not exist yet — that's fine
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Create a dev logger instance.
|
|
100
|
+
*
|
|
101
|
+
* @param {object} opts
|
|
102
|
+
* @param {string} opts.root — project root directory
|
|
103
|
+
* @param {string} [opts.devDomain] — dev domain from config (e.g. "storyboard-core")
|
|
104
|
+
* @param {string} [opts.branch] — current git branch
|
|
105
|
+
* @param {boolean} [opts.verbose] — also log to console (controlled by dev-logs flag)
|
|
106
|
+
* @returns {{ logResponse: Function, logEvent: Function, logsDir: string }}
|
|
107
|
+
*/
|
|
108
|
+
export function createDevLogger({ root, devDomain = null, branch = null, verbose = false } = {}) {
|
|
109
|
+
const logsDir = path.join(root, STORYBOARD_DIR, LOGS_DIR_NAME)
|
|
110
|
+
let dirEnsured = false
|
|
111
|
+
|
|
112
|
+
function ensureDir() {
|
|
113
|
+
if (dirEnsured) return true
|
|
114
|
+
try {
|
|
115
|
+
fs.mkdirSync(logsDir, { recursive: true })
|
|
116
|
+
dirEnsured = true
|
|
117
|
+
return true
|
|
118
|
+
} catch {
|
|
119
|
+
return false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Prune old logs on startup (non-blocking, best-effort)
|
|
124
|
+
try { pruneOldLogs(logsDir) } catch { /* ignore */ }
|
|
125
|
+
|
|
126
|
+
function writeEntry(entry) {
|
|
127
|
+
if (!ensureDir()) return
|
|
128
|
+
const filename = `${dateStamp()}.jsonl`
|
|
129
|
+
const filepath = path.join(logsDir, filename)
|
|
130
|
+
const line = JSON.stringify(entry) + '\n'
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
fs.appendFileSync(filepath, line, 'utf-8')
|
|
134
|
+
} catch {
|
|
135
|
+
// If we can't write logs, fail silently — never crash the server
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (verbose) {
|
|
139
|
+
const tag = entry.status ? `[${entry.status}]` : `[${entry.level}]`
|
|
140
|
+
const msg = entry.error || entry.message || ''
|
|
141
|
+
console.warn(`[storyboard-logs] ${tag} ${entry.method || ''} ${entry.url || ''} — ${msg}`)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Log an HTTP error response (4xx/5xx).
|
|
147
|
+
*
|
|
148
|
+
* @param {object} opts
|
|
149
|
+
* @param {number} opts.status — HTTP status code
|
|
150
|
+
* @param {string} opts.method — HTTP method (GET, POST, etc.)
|
|
151
|
+
* @param {string} opts.url — full request URL
|
|
152
|
+
* @param {string} [opts.route] — top-level route prefix (e.g. "canvas", "workshop")
|
|
153
|
+
* @param {string} [opts.subRoute] — sub-route path after prefix
|
|
154
|
+
* @param {string} [opts.error] — error message from the response body
|
|
155
|
+
* @param {object} [opts.context] — additional context (overrides auto-extracted)
|
|
156
|
+
*/
|
|
157
|
+
function logResponse({ status, method, url, route = null, subRoute = null, error = null, context = {} }) {
|
|
158
|
+
if (status < 400) return
|
|
159
|
+
|
|
160
|
+
const autoContext = extractContext(url)
|
|
161
|
+
const mergedContext = { ...autoContext, ...context }
|
|
162
|
+
|
|
163
|
+
// Strip null values from context
|
|
164
|
+
for (const key of Object.keys(mergedContext)) {
|
|
165
|
+
if (mergedContext[key] == null) delete mergedContext[key]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const entry = {
|
|
169
|
+
ts: new Date().toISOString(),
|
|
170
|
+
level: status >= 500 ? 'error' : 'warn',
|
|
171
|
+
status,
|
|
172
|
+
method: method || 'UNKNOWN',
|
|
173
|
+
url: url || '',
|
|
174
|
+
route: route || null,
|
|
175
|
+
subRoute: subRoute || null,
|
|
176
|
+
error: error || null,
|
|
177
|
+
devDomain: devDomain || null,
|
|
178
|
+
branch: branch || null,
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (Object.keys(mergedContext).length > 0) {
|
|
182
|
+
entry.context = mergedContext
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
writeEntry(entry)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Log a general event (not tied to an HTTP response).
|
|
190
|
+
*
|
|
191
|
+
* @param {'info'|'warn'|'error'} level
|
|
192
|
+
* @param {string} message
|
|
193
|
+
* @param {object} [context] — arbitrary context data
|
|
194
|
+
*/
|
|
195
|
+
function logEvent(level, message, context = {}) {
|
|
196
|
+
const entry = {
|
|
197
|
+
ts: new Date().toISOString(),
|
|
198
|
+
level,
|
|
199
|
+
message,
|
|
200
|
+
devDomain: devDomain || null,
|
|
201
|
+
branch: branch || null,
|
|
202
|
+
}
|
|
203
|
+
if (Object.keys(context).length > 0) {
|
|
204
|
+
entry.context = context
|
|
205
|
+
}
|
|
206
|
+
writeEntry(entry)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return { logResponse, logEvent, logsDir, _extractContext: extractContext }
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ─── Module-level singleton ───
|
|
213
|
+
// Set once by server-plugin.js, then any server-side module can call devLog().
|
|
214
|
+
|
|
215
|
+
let _instance = null
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Register the global dev logger instance.
|
|
219
|
+
* Called once during server startup (server-plugin.js configureServer).
|
|
220
|
+
*/
|
|
221
|
+
export function setDevLogger(logger) {
|
|
222
|
+
_instance = logger
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get the global dev logger. Returns a no-op logger if not yet initialized.
|
|
227
|
+
* Safe to call from any server-side module without constructor plumbing.
|
|
228
|
+
*/
|
|
229
|
+
export function devLog() {
|
|
230
|
+
return _instance || _noop
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const _noop = {
|
|
234
|
+
logResponse() {},
|
|
235
|
+
logEvent() {},
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export { extractContext, pruneOldLogs, dateStamp }
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import os from 'node:os'
|
|
5
|
+
import { createDevLogger, extractContext, pruneOldLogs, dateStamp } from './devLogger.js'
|
|
6
|
+
|
|
7
|
+
function makeTmpDir() {
|
|
8
|
+
return fs.mkdtempSync(path.join(os.tmpdir(), 'devlogger-test-'))
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe('devLogger', () => {
|
|
12
|
+
let tmpRoot
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
tmpRoot = makeTmpDir()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
fs.rmSync(tmpRoot, { recursive: true, force: true })
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
describe('createDevLogger', () => {
|
|
23
|
+
it('creates the logs directory on first write', () => {
|
|
24
|
+
const logger = createDevLogger({ root: tmpRoot, devDomain: 'test', branch: 'main' })
|
|
25
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
26
|
+
|
|
27
|
+
// Not created yet (lazy)
|
|
28
|
+
expect(fs.existsSync(logsDir)).toBe(false)
|
|
29
|
+
|
|
30
|
+
logger.logResponse({ status: 404, method: 'GET', url: '/_storyboard/canvas/read?name=missing', error: 'Not found' })
|
|
31
|
+
|
|
32
|
+
expect(fs.existsSync(logsDir)).toBe(true)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('writes JSONL entries with correct format', () => {
|
|
36
|
+
const logger = createDevLogger({ root: tmpRoot, devDomain: 'test-domain', branch: 'feat-x' })
|
|
37
|
+
|
|
38
|
+
logger.logResponse({
|
|
39
|
+
status: 404,
|
|
40
|
+
method: 'GET',
|
|
41
|
+
url: '/_storyboard/canvas/read?name=my-canvas',
|
|
42
|
+
route: 'canvas',
|
|
43
|
+
subRoute: '/read',
|
|
44
|
+
error: 'Canvas "my-canvas" not found',
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
48
|
+
const files = fs.readdirSync(logsDir)
|
|
49
|
+
expect(files).toHaveLength(1)
|
|
50
|
+
expect(files[0]).toMatch(/^\d{4}-\d{2}-\d{2}\.jsonl$/)
|
|
51
|
+
|
|
52
|
+
const content = fs.readFileSync(path.join(logsDir, files[0]), 'utf-8')
|
|
53
|
+
const lines = content.trim().split('\n')
|
|
54
|
+
expect(lines).toHaveLength(1)
|
|
55
|
+
|
|
56
|
+
const entry = JSON.parse(lines[0])
|
|
57
|
+
expect(entry.ts).toMatch(/^\d{4}-\d{2}-\d{2}T/)
|
|
58
|
+
expect(entry.level).toBe('warn')
|
|
59
|
+
expect(entry.status).toBe(404)
|
|
60
|
+
expect(entry.method).toBe('GET')
|
|
61
|
+
expect(entry.route).toBe('canvas')
|
|
62
|
+
expect(entry.subRoute).toBe('/read')
|
|
63
|
+
expect(entry.error).toBe('Canvas "my-canvas" not found')
|
|
64
|
+
expect(entry.devDomain).toBe('test-domain')
|
|
65
|
+
expect(entry.branch).toBe('feat-x')
|
|
66
|
+
expect(entry.context.canvas).toBe('my-canvas')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('uses level "error" for 5xx status codes', () => {
|
|
70
|
+
const logger = createDevLogger({ root: tmpRoot })
|
|
71
|
+
logger.logResponse({ status: 500, method: 'POST', url: '/test', error: 'Internal error' })
|
|
72
|
+
|
|
73
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
74
|
+
const files = fs.readdirSync(logsDir)
|
|
75
|
+
const entry = JSON.parse(fs.readFileSync(path.join(logsDir, files[0]), 'utf-8').trim())
|
|
76
|
+
expect(entry.level).toBe('error')
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it('does not log 2xx responses', () => {
|
|
80
|
+
const logger = createDevLogger({ root: tmpRoot })
|
|
81
|
+
logger.logResponse({ status: 200, method: 'GET', url: '/ok' })
|
|
82
|
+
logger.logResponse({ status: 201, method: 'POST', url: '/created' })
|
|
83
|
+
|
|
84
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
85
|
+
expect(fs.existsSync(logsDir)).toBe(false) // never written, dir never created
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('appends multiple entries to the same day file', () => {
|
|
89
|
+
const logger = createDevLogger({ root: tmpRoot })
|
|
90
|
+
logger.logResponse({ status: 404, method: 'GET', url: '/a', error: 'A' })
|
|
91
|
+
logger.logResponse({ status: 400, method: 'POST', url: '/b', error: 'B' })
|
|
92
|
+
logger.logResponse({ status: 502, method: 'GET', url: '/c', error: 'C' })
|
|
93
|
+
|
|
94
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
95
|
+
const files = fs.readdirSync(logsDir)
|
|
96
|
+
expect(files).toHaveLength(1)
|
|
97
|
+
|
|
98
|
+
const lines = fs.readFileSync(path.join(logsDir, files[0]), 'utf-8').trim().split('\n')
|
|
99
|
+
expect(lines).toHaveLength(3)
|
|
100
|
+
expect(JSON.parse(lines[0]).error).toBe('A')
|
|
101
|
+
expect(JSON.parse(lines[1]).error).toBe('B')
|
|
102
|
+
expect(JSON.parse(lines[2]).error).toBe('C')
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
describe('logEvent', () => {
|
|
107
|
+
it('logs general events with level and message', () => {
|
|
108
|
+
const logger = createDevLogger({ root: tmpRoot, devDomain: 'test' })
|
|
109
|
+
logger.logEvent('warn', 'Hot pool failed to start', { poolId: 'copilot' })
|
|
110
|
+
|
|
111
|
+
const logsDir = path.join(tmpRoot, '.storyboard', 'logs')
|
|
112
|
+
const files = fs.readdirSync(logsDir)
|
|
113
|
+
const entry = JSON.parse(fs.readFileSync(path.join(logsDir, files[0]), 'utf-8').trim())
|
|
114
|
+
|
|
115
|
+
expect(entry.level).toBe('warn')
|
|
116
|
+
expect(entry.message).toBe('Hot pool failed to start')
|
|
117
|
+
expect(entry.context.poolId).toBe('copilot')
|
|
118
|
+
expect(entry.devDomain).toBe('test')
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
describe('extractContext', () => {
|
|
123
|
+
it('extracts canvas name from ?name= query param', () => {
|
|
124
|
+
const ctx = extractContext('/_storyboard/canvas/read?name=design-system')
|
|
125
|
+
expect(ctx.canvas).toBe('design-system')
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('extracts prototype from ?prototype= query param', () => {
|
|
129
|
+
const ctx = extractContext('/_storyboard/workshop/create?prototype=Dashboard')
|
|
130
|
+
expect(ctx.prototype).toBe('Dashboard')
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('extracts page from ?page= query param', () => {
|
|
134
|
+
const ctx = extractContext('/_storyboard/something?page=settings')
|
|
135
|
+
expect(ctx.page).toBe('settings')
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('returns empty context for non-parseable URLs', () => {
|
|
139
|
+
const ctx = extractContext('')
|
|
140
|
+
expect(ctx.canvas).toBeNull()
|
|
141
|
+
expect(ctx.prototype).toBeNull()
|
|
142
|
+
expect(ctx.page).toBeNull()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
it('returns empty context for null input', () => {
|
|
146
|
+
const ctx = extractContext(null)
|
|
147
|
+
expect(ctx.canvas).toBeNull()
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
describe('dateStamp', () => {
|
|
152
|
+
it('returns YYYY-MM-DD format', () => {
|
|
153
|
+
const stamp = dateStamp(new Date('2026-04-25T12:00:00Z'))
|
|
154
|
+
expect(stamp).toBe('2026-04-25')
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
describe('pruneOldLogs', () => {
|
|
159
|
+
it('removes log files older than 7 days', () => {
|
|
160
|
+
const logsDir = path.join(tmpRoot, 'logs')
|
|
161
|
+
fs.mkdirSync(logsDir, { recursive: true })
|
|
162
|
+
|
|
163
|
+
// Create old file (10 days ago)
|
|
164
|
+
const old = new Date(Date.now() - 10 * 24 * 60 * 60 * 1000)
|
|
165
|
+
const oldFile = `${dateStamp(old)}.jsonl`
|
|
166
|
+
fs.writeFileSync(path.join(logsDir, oldFile), '{"test":true}\n')
|
|
167
|
+
|
|
168
|
+
// Create recent file (today)
|
|
169
|
+
const todayFile = `${dateStamp()}.jsonl`
|
|
170
|
+
fs.writeFileSync(path.join(logsDir, todayFile), '{"test":true}\n')
|
|
171
|
+
|
|
172
|
+
pruneOldLogs(logsDir)
|
|
173
|
+
|
|
174
|
+
const remaining = fs.readdirSync(logsDir)
|
|
175
|
+
expect(remaining).toContain(todayFile)
|
|
176
|
+
expect(remaining).not.toContain(oldFile)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('ignores non-jsonl files', () => {
|
|
180
|
+
const logsDir = path.join(tmpRoot, 'logs')
|
|
181
|
+
fs.mkdirSync(logsDir, { recursive: true })
|
|
182
|
+
fs.writeFileSync(path.join(logsDir, 'readme.txt'), 'keep me')
|
|
183
|
+
|
|
184
|
+
pruneOldLogs(logsDir)
|
|
185
|
+
|
|
186
|
+
expect(fs.existsSync(path.join(logsDir, 'readme.txt'))).toBe(true)
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
it('handles non-existent directory gracefully', () => {
|
|
190
|
+
expect(() => pruneOldLogs(path.join(tmpRoot, 'nonexistent'))).not.toThrow()
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
})
|
package/src/modes.test.js
CHANGED
|
@@ -359,7 +359,7 @@ describe('locked mode', () => {
|
|
|
359
359
|
describe('tool registry', () => {
|
|
360
360
|
const SAMPLE_TOOLS = {
|
|
361
361
|
'*': [
|
|
362
|
-
{ id: '
|
|
362
|
+
{ id: 'workspace', label: 'Workspace', group: 'dev' },
|
|
363
363
|
{ id: 'reset-params', label: 'Reset all params', group: 'dev' },
|
|
364
364
|
],
|
|
365
365
|
'present': [
|
|
@@ -372,14 +372,14 @@ describe('tool registry', () => {
|
|
|
372
372
|
initTools(SAMPLE_TOOLS)
|
|
373
373
|
const tools = getToolsForMode('present')
|
|
374
374
|
const ids = tools.map(t => t.id)
|
|
375
|
-
expect(ids).toContain('
|
|
375
|
+
expect(ids).toContain('workspace')
|
|
376
376
|
expect(ids).toContain('comments-toggle')
|
|
377
377
|
})
|
|
378
378
|
|
|
379
379
|
it('wildcard tools appear in all modes', () => {
|
|
380
380
|
initTools(SAMPLE_TOOLS)
|
|
381
381
|
const protoTools = getToolsForMode('prototype')
|
|
382
|
-
expect(protoTools.map(t => t.id)).toContain('
|
|
382
|
+
expect(protoTools.map(t => t.id)).toContain('workspace')
|
|
383
383
|
})
|
|
384
384
|
|
|
385
385
|
it('mode-specific tools only appear in their mode', () => {
|
|
@@ -390,7 +390,7 @@ describe('tool registry', () => {
|
|
|
390
390
|
|
|
391
391
|
it('tools start with default state', () => {
|
|
392
392
|
initTools(SAMPLE_TOOLS)
|
|
393
|
-
const state = getToolState('
|
|
393
|
+
const state = getToolState('workspace')
|
|
394
394
|
expect(state).toEqual({
|
|
395
395
|
enabled: true,
|
|
396
396
|
active: false,
|