kaizen-agent 1.86.0 → 1.87.1
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 +1 -1
- package/cli/annotate-proxy.ts +6 -3
- package/cli/build-web.ts +46 -16
- package/cli/dev.ts +67 -0
- package/cli/docs.ts +1 -1
- package/cli/notes.ts +9 -3
- package/cli/ports.ts +121 -0
- package/cli/settings.ts +16 -17
- package/cli/state.ts +15 -29
- package/cli/task-service.ts +79 -17
- package/cli/tasks.ts +2 -2
- package/cli/term-image.ts +18 -0
- package/cli/ui-audit.allow.json +0 -1
- package/cli/ui-audit.ts +12 -12
- package/cli/web.ts +188 -58
- package/package.json +21 -4
- package/skills/kaizen/spec.md +10 -3
- package/tsconfig.json +16 -0
- package/web/README.md +105 -0
- package/web/{annotate.js → annotate/annotate.ts} +51 -50
- package/web/boot/boot.ts +7 -0
- package/web/components/annotate/annotate-bar.tsx +78 -0
- package/web/components/annotate/annotate-panel.tsx +20 -0
- package/web/components/annotate/annotate-settings.tsx +60 -0
- package/web/components/annotate/index.ts +1 -0
- package/web/components/annotate/notes-list.tsx +75 -0
- package/web/components/board/board-card.tsx +177 -0
- package/web/components/board/board-column.tsx +212 -0
- package/web/components/board/board-mode-switch.tsx +21 -0
- package/web/components/board/board-popups.tsx +45 -0
- package/web/components/board/card-footer.tsx +58 -0
- package/web/components/board/card-form.tsx +168 -0
- package/web/components/board/card-kids.tsx +53 -0
- package/web/components/board/clear-menu.tsx +36 -0
- package/web/components/board/filter-box.tsx +42 -0
- package/web/components/board/index.ts +6 -0
- package/web/components/board/run-form.tsx +129 -0
- package/web/components/board/severity-menu.tsx +44 -0
- package/web/components/board/status-strip.tsx +75 -0
- package/web/components/board/task-form.tsx +140 -0
- package/web/components/board/ws-card.tsx +38 -0
- package/web/components/context/context-panel.tsx +244 -0
- package/web/components/context/index.ts +1 -0
- package/web/components/decision/decision-bar.tsx +422 -0
- package/web/components/decision/index.ts +1 -0
- package/web/components/decision/inline-form.tsx +47 -0
- package/web/components/decision/plan-answers-form.tsx +78 -0
- package/web/components/decision/revise-form.tsx +65 -0
- package/web/components/decision/task-reply-form.tsx +48 -0
- package/web/components/footer/foot-bar.tsx +67 -0
- package/web/components/footer/index.ts +1 -0
- package/web/components/git/git-ask.tsx +88 -0
- package/web/components/git/git-commits.tsx +53 -0
- package/web/components/git/git-confirm.tsx +78 -0
- package/web/components/git/git-counts.tsx +10 -0
- package/web/components/git/git-files.tsx +113 -0
- package/web/components/git/git-head.tsx +70 -0
- package/web/components/git/git-icon.tsx +25 -0
- package/web/components/git/git-message.tsx +44 -0
- package/web/components/git/git-split.tsx +64 -0
- package/web/components/git/git-tab.tsx +55 -0
- package/web/components/git/index.ts +1 -0
- package/web/components/home/chat-list.tsx +57 -0
- package/web/components/home/home-composer.tsx +169 -0
- package/web/components/home/home-message.tsx +120 -0
- package/web/components/home/home-window.tsx +253 -0
- package/web/components/home/home-ws-add.tsx +47 -0
- package/web/components/home/index.ts +6 -0
- package/web/components/home/onboarding-dialog.tsx +371 -0
- package/web/components/icebox/board-chip.tsx +27 -0
- package/web/components/icebox/board-menu.tsx +41 -0
- package/web/components/icebox/bulk-bar.tsx +41 -0
- package/web/components/icebox/capture-box.tsx +155 -0
- package/web/components/icebox/choice-menu.tsx +39 -0
- package/web/components/icebox/collection-dialog.tsx +60 -0
- package/web/components/icebox/favicon.tsx +39 -0
- package/web/components/icebox/index.ts +10 -0
- package/web/components/icebox/kind-label.tsx +22 -0
- package/web/components/icebox/kind-menu.tsx +20 -0
- package/web/components/icebox/promote-form.tsx +93 -0
- package/web/components/icebox/reply-box.tsx +88 -0
- package/web/components/icebox/request-actions.tsx +141 -0
- package/web/components/icebox/request-badges.tsx +13 -0
- package/web/components/icebox/request-card.tsx +99 -0
- package/web/components/icebox/request-detail.tsx +43 -0
- package/web/components/icebox/request-images.tsx +33 -0
- package/web/components/icebox/request-phone-row.tsx +181 -0
- package/web/components/icebox/request-row.tsx +120 -0
- package/web/components/icebox/service-chip.tsx +58 -0
- package/web/components/icebox/snooze-menu.tsx +83 -0
- package/web/components/icebox/source-card.tsx +225 -0
- package/web/components/icebox/source-drawer.tsx +112 -0
- package/web/components/icebox/source-form.tsx +147 -0
- package/web/components/icebox/swipe-deck.tsx +242 -0
- package/web/components/layout/index.ts +1 -0
- package/web/components/layout/page-frame.tsx +44 -0
- package/web/components/markdown/index.ts +1 -0
- package/web/components/markdown/markdown.tsx +156 -0
- package/web/components/notebook/editor-pane.tsx +23 -0
- package/web/components/notebook/index.ts +5 -0
- package/web/components/notebook/note-body.tsx +172 -0
- package/web/components/notebook/note-tree.tsx +99 -0
- package/web/components/notebook/notes-head.tsx +37 -0
- package/web/components/notebook/notes-side.tsx +46 -0
- package/web/components/notes/index.ts +1 -0
- package/web/components/notes/note-composer.tsx +90 -0
- package/web/components/notes/notes-chat.tsx +58 -0
- package/web/components/panes/browser-pane.tsx +281 -0
- package/web/components/panes/index.ts +3 -0
- package/web/components/panes/preview-pane.tsx +91 -0
- package/web/components/panes/terminal-pane.tsx +52 -0
- package/web/components/phone/haptic.tsx +29 -0
- package/web/components/phone/index.ts +6 -0
- package/web/components/phone/phone-card.tsx +118 -0
- package/web/components/phone/phone-home.tsx +304 -0
- package/web/components/phone/phone-sheets.tsx +103 -0
- package/web/components/phone/qr-code.tsx +6 -0
- package/web/components/phone/usage-chips.tsx +85 -0
- package/web/components/phone/whatsapp-card.tsx +85 -0
- package/web/components/project/add-project-dialog.tsx +435 -0
- package/web/components/project/index.ts +3 -0
- package/web/components/project/project-bar.tsx +101 -0
- package/web/components/project/ws-menu.tsx +21 -0
- package/web/components/rail/agent-chips.tsx +110 -0
- package/web/components/rail/index.ts +4 -0
- package/web/components/rail/rail-filter.tsx +118 -0
- package/web/components/rail/rail-list.tsx +259 -0
- package/web/components/rail/source-marks.tsx +21 -0
- package/web/components/resources/index.ts +1 -0
- package/web/components/resources/resources-popup.tsx +490 -0
- package/web/components/run/doc-body.tsx +123 -0
- package/web/components/run/file-viewer.tsx +53 -0
- package/web/components/run/fix-form.tsx +88 -0
- package/web/components/run/index.ts +16 -0
- package/web/components/run/inline-md.tsx +30 -0
- package/web/components/run/key-hint.tsx +29 -0
- package/web/components/run/pane-gutter.tsx +52 -0
- package/web/components/run/pane-header.tsx +35 -0
- package/web/components/run/pane.tsx +140 -0
- package/web/components/run/panel-grip.tsx +49 -0
- package/web/components/run/panel-head.tsx +56 -0
- package/web/components/run/panel-tabs.tsx +35 -0
- package/web/components/run/phase-steps.tsx +37 -0
- package/web/components/run/project-notes.tsx +49 -0
- package/web/components/run/run-add-menu.tsx +80 -0
- package/web/components/run/run-bar.tsx +40 -0
- package/web/components/run/run-empty.tsx +10 -0
- package/web/components/run/run-footer.tsx +53 -0
- package/web/components/run/run-history.tsx +24 -0
- package/web/components/run/run-panes.tsx +78 -0
- package/web/components/run/run-picker.tsx +51 -0
- package/web/components/run/run-progress.tsx +30 -0
- package/web/components/run/run-tabs.tsx +147 -0
- package/web/components/run/run-wait.tsx +18 -0
- package/web/components/search/index.ts +1 -0
- package/web/components/search/search-palette.tsx +159 -0
- package/web/components/settings/account-rows.tsx +128 -0
- package/web/components/settings/agent-rows.tsx +249 -0
- package/web/components/settings/automation-rows.tsx +211 -0
- package/web/components/settings/browser-row.tsx +111 -0
- package/web/components/settings/cleanup-row.tsx +32 -0
- package/web/components/settings/commit-input.tsx +39 -0
- package/web/components/settings/index.ts +4 -0
- package/web/components/settings/integration-row.tsx +158 -0
- package/web/components/settings/mic-row.tsx +48 -0
- package/web/components/settings/orchestration-flow.tsx +87 -0
- package/web/components/settings/setting-row.tsx +131 -0
- package/web/components/settings/settings-item.tsx +78 -0
- package/web/components/settings/settings-loading.tsx +41 -0
- package/web/components/settings/settings-nav.tsx +119 -0
- package/web/components/settings/settings-scope.tsx +66 -0
- package/web/components/settings/settings-section.tsx +33 -0
- package/web/components/settings/skill-card.tsx +131 -0
- package/web/components/settings/stepper.tsx +74 -0
- package/web/components/settings/update-bar.tsx +167 -0
- package/web/components/shared/action-menu.tsx +76 -0
- package/web/components/shared/ask-host.tsx +18 -0
- package/web/components/shared/attach-button.tsx +23 -0
- package/web/components/shared/chip.tsx +19 -0
- package/web/components/shared/client-mark.tsx +15 -0
- package/web/components/shared/confirm-dialog.tsx +35 -0
- package/web/components/shared/empty-state.tsx +29 -0
- package/web/components/shared/field.tsx +77 -0
- package/web/components/shared/filter-popover.tsx +29 -0
- package/web/components/shared/form-frame.tsx +19 -0
- package/web/components/shared/icon-button.tsx +50 -0
- package/web/components/shared/index.ts +18 -0
- package/web/components/shared/mic-button.tsx +75 -0
- package/web/components/shared/pager.tsx +49 -0
- package/web/components/shared/picker.tsx +108 -0
- package/web/components/shared/project-mark.tsx +38 -0
- package/web/components/shared/segmented.tsx +43 -0
- package/web/components/shared/state-dot.tsx +4 -0
- package/web/components/shared/status-mark.tsx +26 -0
- package/web/components/shell/index.ts +3 -0
- package/web/components/shell/rail.tsx +259 -0
- package/web/components/shell/sprite.tsx +124 -0
- package/web/components/shell/wordmark.tsx +13 -0
- package/web/components/task/artifact-view.tsx +148 -0
- package/web/components/task/chat-bubble.tsx +43 -0
- package/web/components/task/filter-menu.tsx +38 -0
- package/web/components/task/index.ts +7 -0
- package/web/components/task/result-checks.tsx +34 -0
- package/web/components/task/result-view.tsx +113 -0
- package/web/components/task/status-badge.tsx +24 -0
- package/web/components/task/task-row.tsx +34 -0
- package/web/components/task/typing-dots.tsx +16 -0
- package/web/components/terminal/index.ts +3 -0
- package/web/components/terminal/terminal-bar.tsx +91 -0
- package/web/components/terminal/terminal-grid.tsx +149 -0
- package/web/components/terminal/terminal-modes.tsx +23 -0
- package/web/components/terminal/terminal-tile.tsx +139 -0
- package/web/dist/annotate.js +24 -0
- package/web/dist/board.css +718 -0
- package/web/dist/board.js +115 -0
- package/web/dist/boot.js +2 -0
- package/web/dist/notebook.css +319 -0
- package/web/dist/notebook.js +89 -0
- package/web/dist/popup.css +41 -0
- package/web/dist/popup.js +13 -0
- package/web/{term.js → dist/term.js} +48 -48
- package/web/dist/ui.css +3 -0
- package/web/dist/video.js +108 -0
- package/web/html/board.html +17 -0
- package/web/html/notes.html +14 -0
- package/web/html/popup.html +13 -0
- package/web/{video.html → html/video.html} +14 -15
- package/web/lib/annotate/index.ts +2 -0
- package/web/lib/annotate/notes.ts +105 -0
- package/web/lib/annotate/page.ts +121 -0
- package/web/lib/annotate/rules.ts +37 -0
- package/web/lib/annotate/session.ts +336 -0
- package/web/lib/board/board-actions.ts +119 -0
- package/web/lib/board/board-open.ts +12 -0
- package/web/lib/board/board-store.ts +159 -0
- package/web/lib/board/filter-box.ts +7 -0
- package/web/lib/board/index.ts +10 -0
- package/web/lib/board/nav.ts +29 -0
- package/web/lib/board/on-state.ts +90 -0
- package/web/lib/board/popups.ts +22 -0
- package/web/lib/board/snapshot.ts +105 -0
- package/web/lib/board/strip.ts +43 -0
- package/web/{board → lib/board}/ws-board.ts +1 -1
- package/web/lib/context/context-rules.ts +27 -0
- package/web/lib/context/context-store.ts +95 -0
- package/web/lib/context/feed.ts +28 -0
- package/web/lib/context/index.ts +3 -0
- package/web/lib/core/api.ts +86 -0
- package/web/lib/core/ask.ts +24 -0
- package/web/lib/core/board.ts +290 -0
- package/web/lib/core/brief.ts +31 -0
- package/web/lib/core/format.ts +8 -0
- package/web/lib/core/host.ts +107 -0
- package/web/lib/core/index.ts +16 -0
- package/web/{board → lib/core}/labels.ts +6 -5
- package/web/lib/core/layers.ts +7 -0
- package/web/lib/core/leave.ts +7 -0
- package/web/lib/core/motion.ts +10 -0
- package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
- package/web/lib/core/notifier.ts +15 -0
- package/web/lib/core/store.ts +39 -0
- package/web/lib/core/term-handle.ts +8 -0
- package/web/lib/core/toast.ts +29 -0
- package/web/lib/core/utils.ts +15 -0
- package/web/lib/decision/index.ts +1 -0
- package/web/lib/decision/plan-questions.ts +39 -0
- package/web/lib/dictation/chunks.ts +93 -0
- package/web/lib/dictation/dictation-store.ts +22 -0
- package/web/lib/dictation/engine.ts +265 -0
- package/web/lib/dictation/index.ts +5 -0
- package/web/lib/dictation/mic.ts +42 -0
- package/web/lib/dictation/terminal-dictation.ts +50 -0
- package/web/lib/footer/footer-rules.ts +13 -0
- package/web/lib/footer/footer-store.ts +42 -0
- package/web/lib/footer/index.ts +2 -0
- package/web/lib/git/git-actions.ts +110 -0
- package/web/lib/git/git-panel.ts +43 -0
- package/web/lib/git/git-store.ts +47 -0
- package/web/lib/git/git.ts +170 -0
- package/web/lib/git/index.ts +4 -0
- package/web/lib/home/home-engine.ts +16 -0
- package/web/lib/home/home-events.ts +9 -0
- package/web/lib/home/home-store.ts +247 -0
- package/web/lib/home/home-window.ts +193 -0
- package/web/lib/home/home.ts +85 -0
- package/web/lib/home/index.ts +7 -0
- package/web/lib/home/onboarding.ts +199 -0
- package/web/lib/home/use-float-drag.ts +62 -0
- package/web/lib/icebox/icebox-actions.ts +518 -0
- package/web/lib/icebox/icebox-store.ts +112 -0
- package/web/lib/icebox/icebox-view.ts +48 -0
- package/web/lib/icebox/icebox.ts +273 -0
- package/web/lib/icebox/index.ts +8 -0
- package/web/lib/icebox/use-card-drag.ts +82 -0
- package/web/lib/icebox/use-ice-keys.ts +75 -0
- package/web/lib/icebox/use-icebox.ts +41 -0
- package/web/lib/icebox/use-row-swipe.ts +107 -0
- package/web/lib/markdown/index.ts +1 -0
- package/web/lib/markdown/markdown.ts +136 -0
- package/web/lib/notebook/autosave.ts +131 -0
- package/web/lib/notebook/deal.ts +58 -0
- package/web/lib/notebook/engine-complete.ts +128 -0
- package/web/lib/notebook/engine-preview.ts +287 -0
- package/web/lib/notebook/engine-types.ts +26 -0
- package/web/lib/notebook/engine-widgets.ts +218 -0
- package/web/lib/notebook/engine.ts +74 -0
- package/web/lib/notebook/index.ts +9 -0
- package/web/lib/notebook/kit-loader.ts +16 -0
- package/web/lib/notebook/kit.ts +12 -0
- package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
- package/web/lib/notebook/vault-actions.ts +239 -0
- package/web/lib/notebook/vault-rules.ts +74 -0
- package/web/lib/notebook/vault-session.ts +73 -0
- package/web/lib/notebook/vault-store.ts +63 -0
- package/web/lib/notes/index.ts +4 -0
- package/web/lib/notes/md-html.ts +115 -0
- package/web/lib/notes/notes-actions.ts +32 -0
- package/web/lib/notes/notes-store.ts +22 -0
- package/web/lib/notes/notes.ts +58 -0
- package/web/{board → lib/notes}/rich.ts +1 -2
- package/web/lib/phone/index.ts +7 -0
- package/web/lib/phone/phone-actions.ts +77 -0
- package/web/lib/phone/phone-home.ts +102 -0
- package/web/lib/phone/phone-setup.ts +59 -0
- package/web/lib/phone/phone-sheet.ts +25 -0
- package/web/lib/phone/phone-store.ts +32 -0
- package/web/lib/phone/sheet-swipe.ts +55 -0
- package/web/lib/phone/use-phone-setup.ts +89 -0
- package/web/lib/project/add-project.ts +37 -0
- package/web/lib/project/branch.ts +14 -0
- package/web/lib/project/index.ts +5 -0
- package/web/lib/project/project-bar.ts +76 -0
- package/web/lib/project/project-pick.ts +36 -0
- package/web/lib/project/ws-menu.ts +8 -0
- package/web/lib/rail/agents.ts +63 -0
- package/web/lib/rail/card-links.ts +20 -0
- package/web/lib/rail/index.ts +7 -0
- package/web/lib/rail/rail-actions.ts +74 -0
- package/web/lib/rail/rail-boot.ts +99 -0
- package/web/lib/rail/rail-store.ts +85 -0
- package/web/lib/rail/rules.ts +241 -0
- package/web/lib/rail/source-marks.ts +17 -0
- package/web/lib/rail/use-rank-drag.ts +108 -0
- package/web/lib/resources/index.ts +3 -0
- package/web/lib/resources/resources-actions.ts +59 -0
- package/web/lib/resources/resources-store.ts +48 -0
- package/web/lib/resources/rules.ts +56 -0
- package/web/lib/router/index.ts +3 -0
- package/web/lib/router/route-rules.ts +96 -0
- package/web/lib/router/route-store.ts +115 -0
- package/web/lib/router/use-route-classes.ts +15 -0
- package/web/lib/run/browser.ts +53 -0
- package/web/lib/run/card-terminal.ts +32 -0
- package/web/lib/run/doc.ts +42 -0
- package/web/lib/run/grip.ts +8 -0
- package/web/lib/run/index.ts +19 -0
- package/web/lib/run/kept.ts +58 -0
- package/web/lib/run/layout-store.ts +156 -0
- package/web/lib/run/layout.ts +195 -0
- package/web/lib/run/panel-actions.ts +104 -0
- package/web/lib/run/panel-derive.ts +148 -0
- package/web/lib/run/panel-store.ts +125 -0
- package/web/lib/run/preview.ts +105 -0
- package/web/lib/run/run-actions.ts +118 -0
- package/web/lib/run/run-view-store.ts +134 -0
- package/web/lib/run/term-loader.ts +19 -0
- package/web/lib/run/use-panel-run.ts +125 -0
- package/web/lib/run/use-run-lifecycle.ts +70 -0
- package/web/lib/run/viewer.ts +12 -0
- package/web/lib/run/workspace.ts +281 -0
- package/web/lib/run/ws-actions.ts +293 -0
- package/web/lib/run/ws-derive.ts +50 -0
- package/web/lib/run/ws-draw.ts +102 -0
- package/web/lib/run/ws-store.ts +21 -0
- package/web/lib/run/ws-tabs.ts +125 -0
- package/web/lib/search/index.ts +3 -0
- package/web/lib/search/search-match.ts +48 -0
- package/web/lib/search/search-rows.ts +228 -0
- package/web/lib/search/search.ts +30 -0
- package/web/lib/search/use-search-rows.ts +22 -0
- package/web/lib/server/attention.ts +29 -0
- package/web/lib/server/index.ts +6 -0
- package/web/lib/server/poll-rules.ts +57 -0
- package/web/lib/server/poller.ts +210 -0
- package/web/lib/server/server-store.ts +39 -0
- package/web/lib/server/types.ts +31 -0
- package/web/lib/server/use-server.ts +19 -0
- package/web/lib/settings/agent-favicons.ts +14 -0
- package/web/lib/settings/index.ts +7 -0
- package/web/lib/settings/panel-settings.ts +29 -0
- package/web/lib/settings/settings-actions.ts +357 -0
- package/web/lib/settings/settings-store.ts +114 -0
- package/web/lib/settings/settings.ts +413 -0
- package/web/lib/settings/skill-icons.ts +24 -0
- package/web/lib/settings/update.ts +70 -0
- package/web/lib/shared/data-urls.ts +32 -0
- package/web/lib/shared/index.ts +4 -0
- package/web/lib/shared/use-draft.ts +38 -0
- package/web/lib/shared/use-narrow.ts +11 -0
- package/web/lib/shared/use-pager.ts +24 -0
- package/web/lib/shell/appearance.ts +97 -0
- package/web/lib/shell/help-store.ts +4 -0
- package/web/lib/shell/index.ts +4 -0
- package/web/lib/shell/shell-store.ts +23 -0
- package/web/lib/shell/stored-look.ts +47 -0
- package/web/lib/task/index.ts +7 -0
- package/web/lib/task/task-results.ts +92 -0
- package/web/lib/task/tasks.ts +134 -0
- package/web/lib/task/use-live-frame.ts +85 -0
- package/web/lib/task/use-saved-text.ts +25 -0
- package/web/lib/task/use-task.ts +161 -0
- package/web/lib/task/use-tasks.ts +50 -0
- package/web/{board → lib/task}/zoom.ts +25 -12
- package/web/lib/terminal/hidden-badge.ts +15 -0
- package/web/lib/terminal/index.ts +8 -0
- package/web/lib/terminal/layout.ts +138 -0
- package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
- package/web/lib/terminal/terminal-store.ts +65 -0
- package/web/lib/terminal/terms-feed.ts +37 -0
- package/web/lib/terminal/use-arranged.ts +15 -0
- package/web/lib/terminal/use-terminal-keys.ts +37 -0
- package/web/lib/url/index.ts +1 -0
- package/web/lib/url/safe-url.ts +9 -0
- package/web/notebook/notebook.ts +27 -0
- package/web/notebook/notes-lib.ts +3 -0
- package/web/pages/board/App.tsx +76 -0
- package/web/pages/board/header.tsx +83 -0
- package/web/pages/board/help.tsx +59 -0
- package/web/pages/board/host-bridge.ts +94 -0
- package/web/pages/board/host.tsx +19 -0
- package/web/pages/board/keys.ts +112 -0
- package/web/pages/board/live.ts +39 -0
- package/web/pages/board/main.ts +32 -0
- package/web/pages/board/pages.tsx +86 -0
- package/web/pages/board/panel.tsx +157 -0
- package/web/pages/board/portal.tsx +39 -0
- package/web/pages/board/use-boot.ts +13 -0
- package/web/pages/board/views.ts +63 -0
- package/web/pages/board-page.tsx +62 -0
- package/web/pages/home-page.tsx +127 -0
- package/web/pages/icebox-page.tsx +440 -0
- package/web/pages/notebook/App.tsx +35 -0
- package/web/pages/notebook-page.tsx +50 -0
- package/web/pages/popup/App.tsx +207 -0
- package/web/pages/settings-page.tsx +111 -0
- package/web/pages/task-page.tsx +397 -0
- package/web/pages/tasks-page.tsx +151 -0
- package/web/pages/terminal-page.tsx +15 -0
- package/web/popup/popup.ts +7 -0
- package/web/{term.ts → term/term.ts} +48 -20
- package/web/ui/alert-dialog.tsx +39 -0
- package/web/ui/badge.tsx +20 -0
- package/web/ui/button.tsx +37 -0
- package/web/ui/checkbox.tsx +20 -0
- package/web/ui/command.tsx +41 -0
- package/web/ui/dialog.tsx +28 -0
- package/web/ui/dropdown-menu.tsx +54 -0
- package/web/ui/icon.tsx +17 -0
- package/web/ui/index.ts +21 -0
- package/web/ui/input.tsx +9 -0
- package/web/ui/label.tsx +7 -0
- package/web/ui/legacy/board.css +715 -0
- package/web/{notes.html → ui/legacy/notes.css} +23 -157
- package/web/ui/legacy/popup.css +40 -0
- package/web/ui/popover.tsx +28 -0
- package/web/ui/select.tsx +61 -0
- package/web/ui/sheet.tsx +43 -0
- package/web/ui/skeleton.tsx +6 -0
- package/web/ui/sonner.tsx +25 -0
- package/web/ui/spinner.tsx +12 -0
- package/web/ui/switch.tsx +18 -0
- package/web/ui/tabs.tsx +18 -0
- package/web/ui/textarea.tsx +14 -0
- package/web/ui/theme.css +125 -0
- package/web/ui/toggle.tsx +8 -0
- package/web/ui/tooltip.tsx +26 -0
- package/web/{video.ts → video/video.ts} +5 -5
- package/web/board/add-project.ts +0 -147
- package/web/board/agent-favicons.ts +0 -9
- package/web/board/agent-term.ts +0 -51
- package/web/board/annotate-lib.ts +0 -19
- package/web/board/annotate.ts +0 -221
- package/web/board/api.ts +0 -180
- package/web/board/approvals.ts +0 -109
- package/web/board/badge.ts +0 -115
- package/web/board/cards.ts +0 -1080
- package/web/board/chat.ts +0 -128
- package/web/board/context.ts +0 -248
- package/web/board/dictation.ts +0 -343
- package/web/board/dom.ts +0 -132
- package/web/board/drafts.ts +0 -21
- package/web/board/fixes.ts +0 -89
- package/web/board/git.ts +0 -416
- package/web/board/home-ws.ts +0 -266
- package/web/board/home.ts +0 -421
- package/web/board/icebox.ts +0 -1788
- package/web/board/keys.ts +0 -121
- package/web/board/live.ts +0 -87
- package/web/board/main.ts +0 -94
- package/web/board/markdown.ts +0 -210
- package/web/board/onboarding.ts +0 -227
- package/web/board/panel.ts +0 -437
- package/web/board/phone-setup.ts +0 -79
- package/web/board/phone.ts +0 -219
- package/web/board/projects.ts +0 -277
- package/web/board/resources.ts +0 -170
- package/web/board/run-pick.ts +0 -41
- package/web/board/run-view.ts +0 -1316
- package/web/board/search-match.ts +0 -20
- package/web/board/search.ts +0 -330
- package/web/board/settings-accounts.ts +0 -76
- package/web/board/settings-agents.ts +0 -102
- package/web/board/settings-automations.ts +0 -71
- package/web/board/settings-cleanup.ts +0 -42
- package/web/board/settings-orchestration.ts +0 -32
- package/web/board/settings-pages.ts +0 -62
- package/web/board/settings-skills.ts +0 -103
- package/web/board/settings-voice.ts +0 -28
- package/web/board/settings.ts +0 -490
- package/web/board/store.ts +0 -47
- package/web/board/task-page.ts +0 -628
- package/web/board/task-results.ts +0 -234
- package/web/board/tasks.ts +0 -242
- package/web/board/terms.ts +0 -390
- package/web/board/update.ts +0 -171
- package/web/board/viewer.ts +0 -47
- package/web/board/views.ts +0 -164
- package/web/board/whatsapp-setup.ts +0 -149
- package/web/board/workspace.ts +0 -650
- package/web/board/ws-board-ui.ts +0 -95
- package/web/board/ws-tabs.ts +0 -227
- package/web/board.html +0 -1563
- package/web/board.js +0 -505
- package/web/notebook.js +0 -519
- package/web/notebook.ts +0 -1254
- package/web/popup.html +0 -141
- package/web/video.js +0 -575
- /package/web/{term.css → dist/term.css} +0 -0
- /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
- /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
- /package/web/{term-paste.ts → term/term-paste.ts} +0 -0
package/web/board/keys.ts
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { store } from "./store.ts";
|
|
2
|
-
import { load } from "./api.ts";
|
|
3
|
-
import { focusedKey, formPopup, key, nav, newTask, render, runPopup } from "./cards.ts";
|
|
4
|
-
import { $ } from "./dom.ts";
|
|
5
|
-
import { iceNav, srcOpen } from "./icebox.ts";
|
|
6
|
-
import { close, openRun } from "./panel.ts";
|
|
7
|
-
import { keep } from "./projects.ts";
|
|
8
|
-
import { view } from "./views.ts";
|
|
9
|
-
|
|
10
|
-
export function initKeys() {
|
|
11
|
-
$("kbd").onclick = () => $("help").classList.add("on");
|
|
12
|
-
$("help").onclick = () => $("help").classList.remove("on");
|
|
13
|
-
document.addEventListener("click", () => {
|
|
14
|
-
if (store.menuKey || store.clearMenu || store.sevMenu) {
|
|
15
|
-
store.menuKey = null;
|
|
16
|
-
store.clearMenu = false;
|
|
17
|
-
store.sevMenu = false;
|
|
18
|
-
render();
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
document.onkeydown = (e) => {
|
|
22
|
-
// The icebox reads its own keys first; a checkbox there keeps them, for x then j.
|
|
23
|
-
if (
|
|
24
|
-
view === "sources" &&
|
|
25
|
-
iceNav &&
|
|
26
|
-
srcOpen() &&
|
|
27
|
-
!$("help").classList.contains("on") &&
|
|
28
|
-
!e.target.matches("input:not([type=checkbox]),select,textarea,[contenteditable]") &&
|
|
29
|
-
!e.target.closest("#src-sec") &&
|
|
30
|
-
iceNav(e)
|
|
31
|
-
)
|
|
32
|
-
return;
|
|
33
|
-
// A dialog handles its own keys; Escape there must not also close the panel.
|
|
34
|
-
if (e.target.matches("input,select,textarea,[contenteditable]") || e.target.closest("dialog")) return;
|
|
35
|
-
// The shortcuts overlay (?) is off for now, with its menu button; keys still work.
|
|
36
|
-
if (e.key === "/" && $("sq") && $("panel").classList.contains("open")) {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
$("sq").focus();
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (e.key === "/" && (view === "board" || view === "tasks") && $("bq")) {
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
$("bq").focus();
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (e.key === "Escape") {
|
|
47
|
-
$("help").classList.remove("on");
|
|
48
|
-
if (store.mode) {
|
|
49
|
-
store.mode = null;
|
|
50
|
-
render();
|
|
51
|
-
} else close();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// The Terminal page has no cards to move between; its keys are the terminals'.
|
|
55
|
-
if (view === "terminal" || view === "task") return;
|
|
56
|
-
if (e.key === "n" && !document.querySelector("dialog[open]")) {
|
|
57
|
-
newTask();
|
|
58
|
-
}
|
|
59
|
-
if (e.key === "a") {
|
|
60
|
-
store.all = !store.all;
|
|
61
|
-
keep(store.all ? null : store.S.dir);
|
|
62
|
-
load();
|
|
63
|
-
}
|
|
64
|
-
const mv = {
|
|
65
|
-
ArrowUp: [0, -1],
|
|
66
|
-
k: [0, -1],
|
|
67
|
-
ArrowDown: [0, 1],
|
|
68
|
-
j: [0, 1],
|
|
69
|
-
ArrowLeft: [-1, 0],
|
|
70
|
-
h: [-1, 0],
|
|
71
|
-
ArrowRight: [1, 0],
|
|
72
|
-
l: [1, 0],
|
|
73
|
-
}[e.key];
|
|
74
|
-
// In a run's panel: left/right between its tabs, up/down scroll it. Other panels keep the browser's arrows.
|
|
75
|
-
const rc =
|
|
76
|
-
mv &&
|
|
77
|
-
store.openKey &&
|
|
78
|
-
!e.altKey &&
|
|
79
|
-
!e.ctrlKey &&
|
|
80
|
-
!e.metaKey &&
|
|
81
|
-
store.S.cards.find((c) => key(c) === store.openKey && c.kind === "run");
|
|
82
|
-
if (rc && $("ptabs").children.length) {
|
|
83
|
-
e.preventDefault();
|
|
84
|
-
if (mv[0]) {
|
|
85
|
-
const ks = [...$("ptabs").children].map((b) => b.dataset.k).concat($("pterm").hidden ? [] : ["term"]),
|
|
86
|
-
i = ks.indexOf(store.tab),
|
|
87
|
-
t = ks[i < 0 ? (mv[0] > 0 ? 0 : ks.length - 1) : Math.max(0, Math.min(ks.length - 1, i + mv[0]))];
|
|
88
|
-
if (t !== store.tab) {
|
|
89
|
-
store.tab = t;
|
|
90
|
-
openRun(rc, true);
|
|
91
|
-
}
|
|
92
|
-
} else $("pbody").scrollBy({ top: mv[1] * 40 });
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (
|
|
96
|
-
mv &&
|
|
97
|
-
!$("panel").classList.contains("open") &&
|
|
98
|
-
!e.altKey &&
|
|
99
|
-
!e.ctrlKey &&
|
|
100
|
-
!e.metaKey &&
|
|
101
|
-
(e.target === document.body || e.target.matches("#board .card"))
|
|
102
|
-
) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
nav(...mv);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// The open card, else the focused one.
|
|
108
|
-
const ok = store.openKey || focusedKey(),
|
|
109
|
-
oc = ok && store.S.cards.find((c) => key(c) === ok);
|
|
110
|
-
if (!oc) return;
|
|
111
|
-
if (e.key === "e" && oc.kind === "idea") {
|
|
112
|
-
formPopup(oc, "edit");
|
|
113
|
-
}
|
|
114
|
-
if (e.key === "x" && !["done", "abandoned", "starting"].includes(oc.status)) {
|
|
115
|
-
formPopup(oc, "reject");
|
|
116
|
-
}
|
|
117
|
-
if (e.key === "r" && oc.kind === "idea") {
|
|
118
|
-
runPopup(oc);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
package/web/board/live.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { store } from "./store.ts";
|
|
2
|
-
import { flushLoad, load } from "./api.ts";
|
|
3
|
-
import { $ } from "./dom.ts";
|
|
4
|
-
import { iceBusy, openSources, srcOpen } from "./icebox.ts";
|
|
5
|
-
import { deep } from "./panel.ts";
|
|
6
|
-
import { keep, urlAll } from "./projects.ts";
|
|
7
|
-
import { go, markView } from "./views.ts";
|
|
8
|
-
|
|
9
|
-
// ---- live
|
|
10
|
-
let boot = null;
|
|
11
|
-
let pendingReload = false;
|
|
12
|
-
function reloadWhenAway() {
|
|
13
|
-
if (document.body.classList.contains("homev")) pendingReload = true;
|
|
14
|
-
else location.reload();
|
|
15
|
-
}
|
|
16
|
-
function listen() {
|
|
17
|
-
const es = new EventSource("/events");
|
|
18
|
-
es.onmessage = (ev) => {
|
|
19
|
-
if (ev.data === "changed") {
|
|
20
|
-
load(true);
|
|
21
|
-
if (srcOpen() && !iceBusy && !$("src-go")?.disabled && !$("src-add")?.disabled) openSources();
|
|
22
|
-
} else if (ev.data.startsWith("hello ")) {
|
|
23
|
-
const b = ev.data.slice(6);
|
|
24
|
-
if (boot && b !== boot) reloadWhenAway();
|
|
25
|
-
boot = b;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
es.onerror = () => {
|
|
29
|
-
es.close();
|
|
30
|
-
setTimeout(listen, 3000);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// Back to the project picked last time, unless the URL says which view it wants. A
|
|
34
|
-
// plain fetch: a project that is gone should fall back to all, not raise a toast.
|
|
35
|
-
// A page named in the address shows from the first paint; it is filled once the board has loaded.
|
|
36
|
-
const v0 = ((v) => (v === "icebox" ? "sources" : v === "ws" ? "run" : v === "ideas" ? "tasks" : v))(
|
|
37
|
-
new URLSearchParams(location.search).get("view"),
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export function initLive() {
|
|
41
|
-
addEventListener("kz-view", () => {
|
|
42
|
-
if (pendingReload && !document.body.classList.contains("homev")) location.reload();
|
|
43
|
-
});
|
|
44
|
-
// Back from a terminal: what was committed or pushed there touched nothing the server watches.
|
|
45
|
-
addEventListener("focus", () => load(true));
|
|
46
|
-
addEventListener("visibilitychange", flushLoad);
|
|
47
|
-
// No view in the address is Home.
|
|
48
|
-
const first = ["settings", "sources", "terminal", "board", "tasks", "task", "run"].includes(v0) ? v0 : "home";
|
|
49
|
-
markView(first);
|
|
50
|
-
document.body.classList.toggle("paged", first !== "board");
|
|
51
|
-
document.body.classList.toggle("ice", v0 === "sources");
|
|
52
|
-
document.body.classList.toggle("termv", v0 === "terminal");
|
|
53
|
-
document.body.classList.toggle("homev", first === "home");
|
|
54
|
-
document.body.classList.toggle("taskv", first === "tasks");
|
|
55
|
-
document.body.classList.toggle("taskpagev", first === "task");
|
|
56
|
-
document.body.classList.toggle("runv", first === "run");
|
|
57
|
-
(async () => {
|
|
58
|
-
let d;
|
|
59
|
-
try {
|
|
60
|
-
d = localStorage.getItem("kz-proj");
|
|
61
|
-
} catch (e) {}
|
|
62
|
-
if (d && !urlAll)
|
|
63
|
-
try {
|
|
64
|
-
if (
|
|
65
|
-
(
|
|
66
|
-
await fetch("/cd", {
|
|
67
|
-
method: "POST",
|
|
68
|
-
headers: { "content-type": "application/json" },
|
|
69
|
-
body: JSON.stringify({ dir: d }),
|
|
70
|
-
})
|
|
71
|
-
).ok
|
|
72
|
-
) {
|
|
73
|
-
store.all = false;
|
|
74
|
-
store.dir = d;
|
|
75
|
-
} else keep();
|
|
76
|
-
} catch (e) {}
|
|
77
|
-
try {
|
|
78
|
-
const f = JSON.parse(sessionStorage.getItem("kz-form"));
|
|
79
|
-
if (f) [store.mode, store.modeKey] = f;
|
|
80
|
-
} catch (e) {}
|
|
81
|
-
load().then(() => {
|
|
82
|
-
go(v0);
|
|
83
|
-
deep();
|
|
84
|
-
});
|
|
85
|
-
listen();
|
|
86
|
-
})();
|
|
87
|
-
}
|
package/web/board/main.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// The board page: bundled into web/board.js by `bun run build:web` (iife, so nothing
|
|
2
|
-
// leaks onto window). Each module is one part of the page; this file wires them up in
|
|
3
|
-
// the order the page needs.
|
|
4
|
-
// The page never touches the filesystem. Everything comes from /state and the run
|
|
5
|
-
// files behind /run/:id; every change goes through a POST and comes back as an SSE
|
|
6
|
-
// tick that reloads the board. See design.md for the visual rules.
|
|
7
|
-
import { initPanel } from "./panel.ts";
|
|
8
|
-
import { initViews } from "./views.ts";
|
|
9
|
-
import { initProjects, pick } from "./projects.ts";
|
|
10
|
-
import { initUpdate } from "./update.ts";
|
|
11
|
-
import { initKeys } from "./keys.ts";
|
|
12
|
-
import { filterBox, statusSheet } from "./cards.ts";
|
|
13
|
-
import { initLive } from "./live.ts";
|
|
14
|
-
import { store } from "./store.ts";
|
|
15
|
-
import { initViewer } from "./viewer.ts";
|
|
16
|
-
import { initContext } from "./context.ts";
|
|
17
|
-
import { cardHref, initFooter, initRail, markCurrent, wsHref } from "./workspace.ts";
|
|
18
|
-
import { go } from "./views.ts";
|
|
19
|
-
import { openWorkspace } from "./run-view.ts";
|
|
20
|
-
import { initOnboarding } from "./onboarding.ts";
|
|
21
|
-
import { initHomeWs } from "./home-ws.ts";
|
|
22
|
-
|
|
23
|
-
initPanel();
|
|
24
|
-
initViews();
|
|
25
|
-
initProjects();
|
|
26
|
-
initUpdate();
|
|
27
|
-
initKeys();
|
|
28
|
-
initLive();
|
|
29
|
-
initViewer();
|
|
30
|
-
initContext();
|
|
31
|
-
filterBox();
|
|
32
|
-
statusSheet();
|
|
33
|
-
initRail();
|
|
34
|
-
initFooter(() => go("terminal", true));
|
|
35
|
-
initHomeWs();
|
|
36
|
-
// The rail's rows and + open a card or the new-task form here, on the board, when it has them.
|
|
37
|
-
// A row of another project than the one picked switches the board to that project first.
|
|
38
|
-
addEventListener("kz-open-card", (e: any) => {
|
|
39
|
-
const { dir, id, text } = e.detail;
|
|
40
|
-
const find = () =>
|
|
41
|
-
store.S.cards.find(
|
|
42
|
-
(x) => x.state === dir && (id ? x.kind === "run" && x.id === id : x.kind === "idea" && x.text === text),
|
|
43
|
-
);
|
|
44
|
-
const c = find();
|
|
45
|
-
if (c) {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
return openWorkspace(c);
|
|
48
|
-
}
|
|
49
|
-
if (!dir || dir === store.dir) return;
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
const href = cardHref({ state: dir, kind: id ? "run" : "idea", id, text });
|
|
52
|
-
pick(dir)
|
|
53
|
-
.then(() => {
|
|
54
|
-
const c = find();
|
|
55
|
-
if (c) openWorkspace(c);
|
|
56
|
-
else location.href = href;
|
|
57
|
-
})
|
|
58
|
-
.catch(() => (location.href = href));
|
|
59
|
-
});
|
|
60
|
-
// A workspace row opens in place: the run view resolves it (showRunView).
|
|
61
|
-
addEventListener("kz-open-ws", (e: any) => {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
history.pushState(null, "", wsHref(e.detail.dir, e.detail.ws));
|
|
64
|
-
markCurrent();
|
|
65
|
-
go("ws");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// One popup at a time: a press anywhere first shuts every open popup it is not inside,
|
|
69
|
-
// before any handler runs (several stop propagation), so the one it opens is the only one
|
|
70
|
-
// left. Combos hide theirs, a <details> menu closes, a card's or column's menu goes away.
|
|
71
|
-
document.addEventListener(
|
|
72
|
-
"pointerdown",
|
|
73
|
-
(e) => {
|
|
74
|
-
const t = e.target as Node;
|
|
75
|
-
for (const p of document.querySelectorAll<HTMLElement>(".menu-pop:not([hidden])")) {
|
|
76
|
-
const own = p.closest(".combo,details") || p.parentElement;
|
|
77
|
-
if (!own || own.contains(t)) continue;
|
|
78
|
-
if (own instanceof HTMLDetailsElement) own.open = false;
|
|
79
|
-
else if (own.classList.contains("combo")) {
|
|
80
|
-
p.hidden = true;
|
|
81
|
-
own.querySelector("[aria-expanded]")?.setAttribute("aria-expanded", "false");
|
|
82
|
-
} else {
|
|
83
|
-
// Drawn by render() from store: drop it now without a redraw, which would swallow this click.
|
|
84
|
-
p.remove();
|
|
85
|
-
own.classList.remove("menu");
|
|
86
|
-
store.menuKey = null;
|
|
87
|
-
store.clearMenu = false;
|
|
88
|
-
store.sevMenu = false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
true,
|
|
93
|
-
);
|
|
94
|
-
void initOnboarding();
|
package/web/board/markdown.ts
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { esc } from "./dom.ts";
|
|
2
|
-
import { safeUrl } from "../notes-lib.ts";
|
|
3
|
-
|
|
4
|
-
// The builder's "## Preview" section of 03-impl.md: how to run the app, or the result itself,
|
|
5
|
-
// and its "### How to test" steps.
|
|
6
|
-
// "## Commit" is the message the builder wrote for the work, offered at commit and push.
|
|
7
|
-
function section(impl, name) {
|
|
8
|
-
const m = impl && impl.match(new RegExp(`^##\\s+${name}\\s*\\n([\\s\\S]*?)(?=\\n##\\s|$(?![\\s\\S]))`, "m"));
|
|
9
|
-
return m ? m[1].trim() : null;
|
|
10
|
-
}
|
|
11
|
-
export const preview = (impl) => section(impl, "Preview");
|
|
12
|
-
// Links to a card's attachments/ (notes, or screenshots the builder put in Preview) via /file.
|
|
13
|
-
// Any other relative link (../video.mp4, out/x.srt) would resolve against the board's URL
|
|
14
|
-
// and open "not found": the board serves attachments only, so it shows as its path instead.
|
|
15
|
-
export const attach = (t, c) =>
|
|
16
|
-
t.replace(/(!?)\[([^\]]*)\]\(([^)\s]+)\)/g, (all, img, label, p) => {
|
|
17
|
-
if (/^attachments\/[^)]+$/.test(p))
|
|
18
|
-
return `${img}[${label}](/file?dir=${encodeURIComponent(c.state)}&p=${encodeURIComponent((c.kind === "run" ? `runs/${c.id}/` : "") + p)})`;
|
|
19
|
-
if (/^([a-z][\w+.-]*:|\/|#)/i.test(p)) return all;
|
|
20
|
-
return `${label} (\`${p}\`)`;
|
|
21
|
-
});
|
|
22
|
-
export const commitMsg = (impl) => (section(impl, "Commit") || "").replace(/^```\w*\n|\n```$/g, "").trim();
|
|
23
|
-
// A plan's Open questions as a pick list: `Q: question` lines with `- option` lines under
|
|
24
|
-
// each, "(recommended)" marking the default and "multi-select" in the question allowing
|
|
25
|
-
// several. A blank or other line ends a question's options. The format is pinned in
|
|
26
|
-
// spec-plan.md; a section with content in any other shape is null, none at all is [].
|
|
27
|
-
export function planQuestions(src) {
|
|
28
|
-
const lines = (src || "").split("\n"),
|
|
29
|
-
at = lines.findIndex((l) => /^#+\s*(\d+\.\s*)?open questions/i.test(l.trim()));
|
|
30
|
-
if (at < 0) return [];
|
|
31
|
-
const lvl = /^#+/.exec(lines[at].trim())[0].length,
|
|
32
|
-
out = [];
|
|
33
|
-
let cur = null,
|
|
34
|
-
said = false;
|
|
35
|
-
for (const raw of lines.slice(at + 1)) {
|
|
36
|
-
const l = raw.trim(),
|
|
37
|
-
h = /^#+(?=\s)/.exec(l);
|
|
38
|
-
if (h && h[0].length <= lvl) break;
|
|
39
|
-
if (!h && l && !/^```/.test(l) && !/^none\.?$/i.test(l)) said = true;
|
|
40
|
-
const q = /^\**Q\d*\s*[:.)]\**\s*(.+)$/.exec(l);
|
|
41
|
-
if (q) {
|
|
42
|
-
out.push((cur = { q: q[1].trim(), multi: /multi-?select/i.test(q[1]), options: [] }));
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
const o = /^[-*]\s+(.+)$/.exec(l);
|
|
46
|
-
if (o && cur) {
|
|
47
|
-
const t = o[1].trim();
|
|
48
|
-
cur.options.push({
|
|
49
|
-
text: t,
|
|
50
|
-
rec: /\(recommended\)/i.test(t),
|
|
51
|
-
label: t
|
|
52
|
-
.replace(/\s*\(recommended\)/i, "")
|
|
53
|
-
.split(/\s+[—–-]\s+|:\s/)[0]
|
|
54
|
-
.trim(),
|
|
55
|
-
});
|
|
56
|
-
} else if (cur && cur.options.length) cur = null;
|
|
57
|
-
}
|
|
58
|
-
const qs = out.filter((x) => x.options.length);
|
|
59
|
-
return qs.length || !said ? qs : null;
|
|
60
|
-
}
|
|
61
|
-
// A task is one inbox line, so a structured request arrives as one wall:
|
|
62
|
-
// "Fix x Problem: … Scope: … Acceptance criteria: (1) … (2) …". Split it, for display
|
|
63
|
-
// only, into the text before the first label and one part per label; inline (1) (2)
|
|
64
|
-
// become a numbered list. Fewer than two labels is plain text and is left whole.
|
|
65
|
-
export function brief(t) {
|
|
66
|
-
// A label opens a sentence; only the first may follow the head without punctuation,
|
|
67
|
-
// and then only as one word ("… previews Problem:"), so "the Board shows: x" is prose.
|
|
68
|
-
const re =
|
|
69
|
-
/(^|[.!?)]\s+|\s)((?:[A-Z][A-Z-]+(?: [A-Z][A-Z-]+){1,3}|[A-Z][\w-]*(?: [a-z][\w-]*){0,3})(?: \([^)]*\))?):\s+/g,
|
|
70
|
-
cut = [];
|
|
71
|
-
let m;
|
|
72
|
-
while ((m = re.exec(t)))
|
|
73
|
-
if (!/^\s+$/.test(m[1]) || (!cut.length && !m[2].includes(" ")))
|
|
74
|
-
cut.push([m.index + m[1].length, m[2], re.lastIndex]);
|
|
75
|
-
if (cut.length < 2) return { head: t, parts: [] };
|
|
76
|
-
// Inline (1) (2) … become a list; numbers that do not run 1, 2, 3 keep their own text.
|
|
77
|
-
const parts = cut.map(([, label, from], i) => {
|
|
78
|
-
const body = t.slice(from, i + 1 < cut.length ? cut[i + 1][0] : t.length).trim(),
|
|
79
|
-
n = body.split(/\s*\((\d+)\)\s+/);
|
|
80
|
-
if (n.length < 5) return { label, body };
|
|
81
|
-
const its = [];
|
|
82
|
-
for (let k = 1; k < n.length; k += 2) its.push([n[k], n[k + 1]]);
|
|
83
|
-
const seq = its.every(([d], k) => +d === k + 1);
|
|
84
|
-
return {
|
|
85
|
-
label,
|
|
86
|
-
body: (n[0] ? n[0] + "\n" : "") + its.map(([d, x], k) => (seq ? `${k + 1}. ${x}` : `- (${d}) ${x}`)).join("\n"),
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
return { head: t.slice(0, cut[0][0]).trim() || `${parts[0].label}: ${t.slice(cut[0][2], cut[1][0]).trim()}`, parts };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Enough markdown for kaizen's own files: headings, lists, fences, tables,
|
|
93
|
-
// inline code, bold, italic, hard line breaks. Everything is escaped first. With `tick`, a backlog item
|
|
94
|
-
// (`- open: …`, `- done: …`, `- rejected: …`) shows its status as a checkbox.
|
|
95
|
-
export function md(src, tick) {
|
|
96
|
-
const lines = src.split("\n"),
|
|
97
|
-
out = [];
|
|
98
|
-
let i = 0,
|
|
99
|
-
list = null;
|
|
100
|
-
const inl = (s) =>
|
|
101
|
-
esc(s)
|
|
102
|
-
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
|
103
|
-
.replace(/\*\*([^*]+)\*\*/g, "<b>$1</b>")
|
|
104
|
-
.replace(/(^|[^*])\*([^*\s<][^*<]*?)\*(?!\*)/g, "$1<i>$2</i>")
|
|
105
|
-
.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (m, a, u) =>
|
|
106
|
-
safeUrl(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer"><img src="${u}" alt="${a}"></a>` : m,
|
|
107
|
-
)
|
|
108
|
-
.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (m, t, u) =>
|
|
109
|
-
safeUrl(u) ? `<a href="${u}" target="_blank" rel="noopener noreferrer">${t}</a>` : m,
|
|
110
|
-
);
|
|
111
|
-
const endList = () => {
|
|
112
|
-
if (list) {
|
|
113
|
-
out.push(`</${list}>`);
|
|
114
|
-
list = null;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
while (i < lines.length) {
|
|
118
|
-
const l = lines[i];
|
|
119
|
-
if (/^```/.test(l)) {
|
|
120
|
-
endList();
|
|
121
|
-
const buf = [];
|
|
122
|
-
i++;
|
|
123
|
-
while (i < lines.length && !/^```/.test(lines[i])) buf.push(lines[i++]);
|
|
124
|
-
out.push(`<pre>${esc(buf.join("\n"))}</pre>`);
|
|
125
|
-
i++;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
const hm = /^(#{1,6})\s+(.*)$/.exec(l);
|
|
129
|
-
if (hm) {
|
|
130
|
-
endList();
|
|
131
|
-
out.push(`<h${Math.min(hm[1].length, 3)}>${inl(hm[2])}</h${Math.min(hm[1].length, 3)}>`);
|
|
132
|
-
i++;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
if (/^---+$/.test(l.trim())) {
|
|
136
|
-
endList();
|
|
137
|
-
out.push("<hr>");
|
|
138
|
-
i++;
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (/^\|/.test(l)) {
|
|
142
|
-
endList();
|
|
143
|
-
const rows = [];
|
|
144
|
-
while (i < lines.length && /^\|/.test(lines[i])) rows.push(lines[i++]);
|
|
145
|
-
const cells = (r) =>
|
|
146
|
-
r
|
|
147
|
-
.replace(/^\||\|$/g, "")
|
|
148
|
-
.split("|")
|
|
149
|
-
.map((c) => inl(c.trim()));
|
|
150
|
-
out.push(
|
|
151
|
-
"<table>" +
|
|
152
|
-
rows
|
|
153
|
-
.filter((r) => !/^\|\s*-/.test(r))
|
|
154
|
-
.map(
|
|
155
|
-
(r, n) =>
|
|
156
|
-
`<tr>${cells(r)
|
|
157
|
-
.map((c) => (n ? `<td>${c}</td>` : `<th>${c}</th>`))
|
|
158
|
-
.join("")}</tr>`,
|
|
159
|
-
)
|
|
160
|
-
.join("") +
|
|
161
|
-
"</table>",
|
|
162
|
-
);
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
const li = /^\s*(?:[-*]|\d+\.)\s+(.*)$/.exec(l);
|
|
166
|
-
if (li) {
|
|
167
|
-
const t = /^\s*\d+\./.test(l) ? "ol" : "ul";
|
|
168
|
-
if (list !== t) {
|
|
169
|
-
endList();
|
|
170
|
-
out.push(`<${t}>`);
|
|
171
|
-
list = t;
|
|
172
|
-
}
|
|
173
|
-
const tk = tick && /^(open|done|rejected):\s*(.*)$/.exec(li[1]);
|
|
174
|
-
out.push(
|
|
175
|
-
tk
|
|
176
|
-
? `<li class="tk${tk[1] === "rejected" ? " rej" : ""}"><label><input type="checkbox" tabindex="-1" aria-disabled="true" onclick="return false"${tk[1] === "done" ? " checked" : ""} aria-label="${tk[1]}"><span>${inl(tk[2])}</span></label></li>`
|
|
177
|
-
: `<li>${inl(li[1])}</li>`,
|
|
178
|
-
);
|
|
179
|
-
i++;
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (!l.trim()) {
|
|
183
|
-
endList();
|
|
184
|
-
i++;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
endList();
|
|
188
|
-
const buf = [l];
|
|
189
|
-
i++;
|
|
190
|
-
while (i < lines.length && lines[i].trim() && !/^(#|```|\||\s*[-*]\s|\s*\d+\.\s|---)/.test(lines[i]))
|
|
191
|
-
buf.push(lines[i++]);
|
|
192
|
-
// A line ending in two spaces is a hard line break.
|
|
193
|
-
out.push(
|
|
194
|
-
`<p>${inl(buf.map((l, k) => (k < buf.length - 1 && / {2}$/.test(l) ? l.trimEnd() + "\0" : l)).join(" ")).replace(/\0 /g, "<br>")}</p>`,
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
endList();
|
|
198
|
-
return out.join("");
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// A building run's progress.md, one `- todo|doing|done: text` line per Work-list item.
|
|
202
|
-
// prev: the statuses last drawn for this run; an item whose status moved gets .chg.
|
|
203
|
-
export function progress(src, prev) {
|
|
204
|
-
const items = [...src.matchAll(/^\s*-\s*(todo|doing|done):\s*(.*)$/gm)].map((m) => [m[1], m[2]]);
|
|
205
|
-
if (!items.length) return "";
|
|
206
|
-
const n = items.filter((t) => t[0] === "done").length,
|
|
207
|
-
pct = Math.round((n / items.length) * 100),
|
|
208
|
-
ic = { done: "✓", doing: '<span class="pulse"></span>', todo: "" };
|
|
209
|
-
return `<div class="prog"><div class="ph"><b>${n} of ${items.length} done</b><span>${pct}%</span></div><div class="pbar"><i style="width:${pct}%"></i></div><ol>${items.map(([st, t], i) => `<li class="p-${st}${prev && prev[i] && prev[i] !== st ? " chg" : ""}"><span class="pi">${ic[st]}</span><span>${esc(t).replace(/`([^`]+)`/g, "<code>$1</code>")}</span></li>`).join("")}</ol></div>`;
|
|
210
|
-
}
|