painapple-code 1.0.0__py3-none-any.whl
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.
- painapple_code/__init__.py +30 -0
- painapple_code/__main__.py +18 -0
- painapple_code/_version.py +24 -0
- painapple_code/auth_middleware.py +930 -0
- painapple_code/cli/__init__.py +204 -0
- painapple_code/cli/deploy/__init__.py +15 -0
- painapple_code/cli/deploy/claude_seed.py +41 -0
- painapple_code/cli/deploy/config.py +260 -0
- painapple_code/cli/deploy/container.py +715 -0
- painapple_code/cli/deploy/launch.py +163 -0
- painapple_code/cli/deploy/runtime.py +223 -0
- painapple_code/cli/lifecycle_cmd.py +443 -0
- painapple_code/cli/list_cmd.py +572 -0
- painapple_code/cli/manage_cmd.py +670 -0
- painapple_code/cli/netinfo.py +125 -0
- painapple_code/cli/profiles.py +390 -0
- painapple_code/cli/serve_args.py +163 -0
- painapple_code/cli/serve_config.py +256 -0
- painapple_code/cli/setup_cmd.py +664 -0
- painapple_code/cli/ui.py +438 -0
- painapple_code/cost_analytics.py +879 -0
- painapple_code/data/models.defaults.yaml +18 -0
- painapple_code/data/models.yaml +18 -0
- painapple_code/data/presets.defaults.json +32 -0
- painapple_code/data/strings.yaml +2269 -0
- painapple_code/helpers.py +406 -0
- painapple_code/paths.py +1514 -0
- painapple_code/prompt_explorer.py +984 -0
- painapple_code/providers/__init__.py +224 -0
- painapple_code/providers/base.py +710 -0
- painapple_code/providers/claude/__init__.py +74 -0
- painapple_code/providers/claude/capabilities.py +218 -0
- painapple_code/providers/claude/errors.py +79 -0
- painapple_code/providers/claude/launch.py +50 -0
- painapple_code/providers/claude/summary.py +89 -0
- painapple_code/providers/claude/translate.py +74 -0
- painapple_code/providers/claude_sdk/__init__.py +139 -0
- painapple_code/providers/claude_sdk/driver.py +412 -0
- painapple_code/providers/codex/__init__.py +87 -0
- painapple_code/providers/codex/capabilities.py +321 -0
- painapple_code/providers/codex/errors.py +70 -0
- painapple_code/providers/codex/launch.py +142 -0
- painapple_code/providers/codex/summary.py +196 -0
- painapple_code/providers/codex/translate.py +204 -0
- painapple_code/providers/codex_app_server/__init__.py +100 -0
- painapple_code/providers/codex_app_server/capabilities.py +41 -0
- painapple_code/providers/codex_app_server/launch.py +202 -0
- painapple_code/providers/codex_app_server/summary.py +291 -0
- painapple_code/providers/codex_app_server/translate.py +263 -0
- painapple_code/providers/codex_app_server/transport.py +238 -0
- painapple_code/routes/__init__.py +0 -0
- painapple_code/routes/api_agents.py +441 -0
- painapple_code/routes/api_app.py +368 -0
- painapple_code/routes/api_app_commit_sections.py +127 -0
- painapple_code/routes/api_app_config.py +997 -0
- painapple_code/routes/api_app_session_prefs.py +217 -0
- painapple_code/routes/api_browser.py +690 -0
- painapple_code/routes/api_commands.py +374 -0
- painapple_code/routes/api_costs.py +128 -0
- painapple_code/routes/api_drafts.py +139 -0
- painapple_code/routes/api_exec.py +149 -0
- painapple_code/routes/api_files.py +542 -0
- painapple_code/routes/api_git.py +657 -0
- painapple_code/routes/api_logs.py +649 -0
- painapple_code/routes/api_plugins.py +275 -0
- painapple_code/routes/api_project_config.py +418 -0
- painapple_code/routes/api_prompts.py +231 -0
- painapple_code/routes/api_providers.py +53 -0
- painapple_code/routes/api_search.py +411 -0
- painapple_code/routes/api_session_stash.py +234 -0
- painapple_code/routes/api_session_welcome.py +151 -0
- painapple_code/routes/api_sessions.py +742 -0
- painapple_code/routes/api_shadow.py +323 -0
- painapple_code/routes/api_shadow_db.py +512 -0
- painapple_code/routes/api_shadow_files.py +332 -0
- painapple_code/routes/api_shadow_search.py +476 -0
- painapple_code/routes/api_skills.py +610 -0
- painapple_code/routes/api_tasks.py +147 -0
- painapple_code/routes/api_terminal.py +540 -0
- painapple_code/routes/api_upload.py +293 -0
- painapple_code/routes/api_viewer.py +229 -0
- painapple_code/routes/dependencies.py +109 -0
- painapple_code/routes/ws_chat.py +837 -0
- painapple_code/server.py +2208 -0
- painapple_code/server_logging.py +263 -0
- painapple_code/services/__init__.py +0 -0
- painapple_code/services/agent_session.py +2738 -0
- painapple_code/session_store.py +253 -0
- painapple_code/session_store_core.py +879 -0
- painapple_code/shadow_db.py +830 -0
- painapple_code/shadow_db_plans.py +369 -0
- painapple_code/shadow_db_queries.py +595 -0
- painapple_code/shadow_db_schema.py +676 -0
- painapple_code/shadow_git.py +1296 -0
- painapple_code/shadow_git_frontmatter.py +314 -0
- painapple_code/shadow_git_sections.py +520 -0
- painapple_code/shadow_git_summary.py +462 -0
- painapple_code/shadow_parser.py +560 -0
- painapple_code/static/css/00-variables.css +276 -0
- painapple_code/static/css/01-base.css +245 -0
- painapple_code/static/css/02-tooltips.css +36 -0
- painapple_code/static/css/09-left-rail.css +448 -0
- painapple_code/static/css/10-header.css +777 -0
- painapple_code/static/css/11-connection-bar.css +120 -0
- painapple_code/static/css/20-messages.css +750 -0
- painapple_code/static/css/21-tool-blocks.css +2340 -0
- painapple_code/static/css/22-edit-diff.css +619 -0
- painapple_code/static/css/23-thinking.css +1584 -0
- painapple_code/static/css/24-background-tasks.css +359 -0
- painapple_code/static/css/25-context-block.css +252 -0
- painapple_code/static/css/26-session-setup.css +144 -0
- painapple_code/static/css/30-markdown.css +854 -0
- painapple_code/static/css/40-input.css +2418 -0
- painapple_code/static/css/41-autocomplete.css +127 -0
- painapple_code/static/css/42-activity-strip.css +97 -0
- painapple_code/static/css/43-file-autocomplete.css +121 -0
- painapple_code/static/css/44-snippets-autocomplete.css +224 -0
- painapple_code/static/css/45-selection-bar.css +433 -0
- painapple_code/static/css/46-keyboard-bar.css +119 -0
- painapple_code/static/css/47-keyboard-longpress.css +116 -0
- painapple_code/static/css/47-token-profile.css +106 -0
- painapple_code/static/css/50-welcome.css +3095 -0
- painapple_code/static/css/51-modals.css +301 -0
- painapple_code/static/css/52-utilities.css +77 -0
- painapple_code/static/css/53-image-upload.css +456 -0
- painapple_code/static/css/54-todo-list.css +102 -0
- painapple_code/static/css/55-file-upload.css +113 -0
- painapple_code/static/css/56-chat-navigator.css +218 -0
- painapple_code/static/css/56-permission-card.css +332 -0
- painapple_code/static/css/56-plan-approval.css +204 -0
- painapple_code/static/css/56-question-form.css +602 -0
- painapple_code/static/css/57-swipe-indicator.css +95 -0
- painapple_code/static/css/58-session-families.css +627 -0
- painapple_code/static/css/59-about.css +196 -0
- painapple_code/static/css/61-log-explorer.css +723 -0
- painapple_code/static/css/62-json-tree.css +489 -0
- painapple_code/static/css/62-skills-widget.css +650 -0
- painapple_code/static/css/63-commands-widget.css +30 -0
- painapple_code/static/css/63-plugins-widget.css +174 -0
- painapple_code/static/css/63-terminal.css +516 -0
- painapple_code/static/css/64-search-files-widget.css +448 -0
- painapple_code/static/css/65-snippets-widget.css +426 -0
- painapple_code/static/css/66-active-sessions.css +979 -0
- painapple_code/static/css/66-agents-widget.css +265 -0
- painapple_code/static/css/66-file-explorer-widget.css +855 -0
- painapple_code/static/css/66-git-panel.css +791 -0
- painapple_code/static/css/66-history-explorer.css +1496 -0
- painapple_code/static/css/67-diff-viewer.css +602 -0
- painapple_code/static/css/67-editor-view.css +748 -0
- painapple_code/static/css/67-file-preview-widget.css +1873 -0
- painapple_code/static/css/68-browser-widget.css +337 -0
- painapple_code/static/css/68-compare-wizard.css +355 -0
- painapple_code/static/css/68-csv-preview.css +106 -0
- painapple_code/static/css/68-diff-preview.css +103 -0
- painapple_code/static/css/68-helpers-install-widget.css +491 -0
- painapple_code/static/css/68-image-annotate.css +346 -0
- painapple_code/static/css/68-terminal-view.css +98 -0
- painapple_code/static/css/68-uploads-widget.css +229 -0
- painapple_code/static/css/69-cost-analytics.css +537 -0
- painapple_code/static/css/70-config-panel.css +3736 -0
- painapple_code/static/css/70-excalidraw.css +136 -0
- painapple_code/static/css/70-prompt-explorer.css +890 -0
- painapple_code/static/css/71-chart.css +111 -0
- painapple_code/static/css/72-discussion-sidebar.css +678 -0
- painapple_code/static/css/74-debug-logs.css +656 -0
- painapple_code/static/css/80-open-dialog.css +146 -0
- painapple_code/static/css/80-quick-switcher.css +383 -0
- painapple_code/static/css/80-widget-system.css +1763 -0
- painapple_code/static/css/81-quick-actions.css +1020 -0
- painapple_code/static/css/82-context-popover.css +1233 -0
- painapple_code/static/css/83-context-menu.css +339 -0
- painapple_code/static/css/85-lazy-loading.css +102 -0
- painapple_code/static/css/86-zen-mode.css +708 -0
- painapple_code/static/css/87-grid-switcher.css +346 -0
- painapple_code/static/css/login.css +198 -0
- painapple_code/static/dist/app.bundle.js +7177 -0
- painapple_code/static/feature-triage.html +446 -0
- painapple_code/static/icons/apple-touch-icon.png +0 -0
- painapple_code/static/icons/favicon-32.png +0 -0
- painapple_code/static/icons/favicon.ico +0 -0
- painapple_code/static/icons/icon-128.png +0 -0
- painapple_code/static/icons/icon-144.png +0 -0
- painapple_code/static/icons/icon-152.png +0 -0
- painapple_code/static/icons/icon-180.png +0 -0
- painapple_code/static/icons/icon-192.png +0 -0
- painapple_code/static/icons/icon-384.png +0 -0
- painapple_code/static/icons/icon-512.png +0 -0
- painapple_code/static/icons/icon-72.png +0 -0
- painapple_code/static/icons/icon-96.png +0 -0
- painapple_code/static/js/action-delegate.js +187 -0
- painapple_code/static/js/activity-strip.js +193 -0
- painapple_code/static/js/app/context-menus.js +619 -0
- painapple_code/static/js/app/file-preview.js +163 -0
- painapple_code/static/js/app/init-ui.js +574 -0
- painapple_code/static/js/app/input-events.js +561 -0
- painapple_code/static/js/app/input-resize.js +313 -0
- painapple_code/static/js/app/message-actions.js +419 -0
- painapple_code/static/js/app/panels.js +210 -0
- painapple_code/static/js/app/rendering-delegators.js +246 -0
- painapple_code/static/js/app/server-loading.js +365 -0
- painapple_code/static/js/app/session-ops.js +287 -0
- painapple_code/static/js/app/session-switch.js +443 -0
- painapple_code/static/js/app/settings-helpers.js +280 -0
- painapple_code/static/js/app/startup-welcome.js +290 -0
- painapple_code/static/js/app-context.js +157 -0
- painapple_code/static/js/app.js +2134 -0
- painapple_code/static/js/auth-fetch.js +46 -0
- painapple_code/static/js/background-tasks.js +274 -0
- painapple_code/static/js/boot.js +73 -0
- painapple_code/static/js/caret-position.js +171 -0
- painapple_code/static/js/chat-navigator.js +710 -0
- painapple_code/static/js/chat-search.js +323 -0
- painapple_code/static/js/command-executor.js +176 -0
- painapple_code/static/js/command-store.js +497 -0
- painapple_code/static/js/components.js +1414 -0
- painapple_code/static/js/config.js +218 -0
- painapple_code/static/js/context-menu.js +740 -0
- painapple_code/static/js/controllers/chat-controller.js +4252 -0
- painapple_code/static/js/controllers/dialog-controller.js +217 -0
- painapple_code/static/js/controllers/tab-controller.js +1828 -0
- painapple_code/static/js/controllers/thinking-controller.js +915 -0
- painapple_code/static/js/diff-utils.js +486 -0
- painapple_code/static/js/drafts-pill.js +95 -0
- painapple_code/static/js/editor-view.js +815 -0
- painapple_code/static/js/effort-settings.js +430 -0
- painapple_code/static/js/feature-triage.js +811 -0
- painapple_code/static/js/file-autocomplete.js +516 -0
- painapple_code/static/js/file-tabs.js +123 -0
- painapple_code/static/js/gestures.js +448 -0
- painapple_code/static/js/grid-switcher.js +334 -0
- painapple_code/static/js/input-handler.js +1472 -0
- painapple_code/static/js/keyboard-bar.js +495 -0
- painapple_code/static/js/layout-switcher.js +109 -0
- painapple_code/static/js/linkify-utils.js +200 -0
- painapple_code/static/js/login.js +141 -0
- painapple_code/static/js/open-dialog.js +879 -0
- painapple_code/static/js/orphan-terminals.js +373 -0
- painapple_code/static/js/path-utils.js +179 -0
- painapple_code/static/js/perf-marks.js +102 -0
- painapple_code/static/js/permission-settings.js +475 -0
- painapple_code/static/js/pointer-input.js +59 -0
- painapple_code/static/js/preview/json-tree-menu.js +226 -0
- painapple_code/static/js/preview/json-tree-toolbar.js +291 -0
- painapple_code/static/js/preview/json-tree.js +457 -0
- painapple_code/static/js/preview/preview-breadcrumb.js +387 -0
- painapple_code/static/js/preview/preview-edit.js +367 -0
- painapple_code/static/js/preview/preview-events.js +361 -0
- painapple_code/static/js/preview/preview-history.js +567 -0
- painapple_code/static/js/preview/preview-inline-edit.js +869 -0
- painapple_code/static/js/preview/preview-poll.js +108 -0
- painapple_code/static/js/preview/preview-render.js +572 -0
- painapple_code/static/js/preview/preview-search.js +421 -0
- painapple_code/static/js/preview/preview-state.js +256 -0
- painapple_code/static/js/preview/preview-utils.js +251 -0
- painapple_code/static/js/preview-plugins/chart-plugin.js +22 -0
- painapple_code/static/js/preview-plugins/csv-plugin.js +188 -0
- painapple_code/static/js/preview-plugins/diff-plugin.js +258 -0
- painapple_code/static/js/preview-plugins/excalidraw-plugin.js +25 -0
- painapple_code/static/js/preview-plugins/html-plugin.js +104 -0
- painapple_code/static/js/preview-plugins/image-plugin.js +20 -0
- painapple_code/static/js/preview-plugins/index.js +34 -0
- painapple_code/static/js/preview-plugins/json-plugin.js +99 -0
- painapple_code/static/js/preview-plugins/jsonl-plugin.js +152 -0
- painapple_code/static/js/preview-plugins/markdown-plugin.js +266 -0
- painapple_code/static/js/preview-plugins/panzoom-plugin.js +63 -0
- painapple_code/static/js/preview-plugins/plugin-helpers.js +282 -0
- painapple_code/static/js/project-color-picker.js +110 -0
- painapple_code/static/js/project-colors.js +163 -0
- painapple_code/static/js/prompt-favorites.js +187 -0
- painapple_code/static/js/quick-actions-menu.js +1736 -0
- painapple_code/static/js/quick-actions-registry.js +1239 -0
- painapple_code/static/js/quick-switcher/controller.js +294 -0
- painapple_code/static/js/quick-switcher/fuzzy-scorer.js +123 -0
- painapple_code/static/js/quick-switcher/index.js +30 -0
- painapple_code/static/js/quick-switcher/providers/base-provider.js +51 -0
- painapple_code/static/js/quick-switcher/providers/command-provider.js +56 -0
- painapple_code/static/js/quick-switcher/providers/file-provider.js +291 -0
- painapple_code/static/js/quick-switcher/providers/panel-provider.js +132 -0
- painapple_code/static/js/quick-switcher/providers/project-provider.js +361 -0
- painapple_code/static/js/quick-switcher/providers/read-files-provider.js +104 -0
- painapple_code/static/js/quick-switcher/providers/skills-provider.js +129 -0
- painapple_code/static/js/quick-switcher/registry.js +69 -0
- painapple_code/static/js/quick-switcher/ui/item.js +54 -0
- painapple_code/static/js/quick-switcher/ui/picker.js +464 -0
- painapple_code/static/js/recent-opens.js +40 -0
- painapple_code/static/js/scroll-manager.js +530 -0
- painapple_code/static/js/scroll-state-machine.js +359 -0
- painapple_code/static/js/selection/action-bar.js +793 -0
- painapple_code/static/js/selection/index.js +15 -0
- painapple_code/static/js/selection/selection-handler.js +877 -0
- painapple_code/static/js/selection/state.js +181 -0
- painapple_code/static/js/session/agent-progress.js +202 -0
- painapple_code/static/js/session/handle-agent-message.js +481 -0
- painapple_code/static/js/session/handle-message.js +550 -0
- painapple_code/static/js/session/interactive.js +587 -0
- painapple_code/static/js/session/message-store.js +271 -0
- painapple_code/static/js/session/messages.js +253 -0
- painapple_code/static/js/session/persistence.js +179 -0
- painapple_code/static/js/session/restore.js +136 -0
- painapple_code/static/js/session/sync.js +333 -0
- painapple_code/static/js/session-container-pool.js +371 -0
- painapple_code/static/js/session-setup-panel.js +274 -0
- painapple_code/static/js/session.js +1047 -0
- painapple_code/static/js/shortcut-hints.js +272 -0
- painapple_code/static/js/shortcuts.js +1146 -0
- painapple_code/static/js/skills-autocomplete.js +262 -0
- painapple_code/static/js/snippets-autocomplete.js +738 -0
- painapple_code/static/js/stash-refs-view.js +83 -0
- painapple_code/static/js/stash-ui.js +768 -0
- painapple_code/static/js/stash.js +785 -0
- painapple_code/static/js/status-bar.js +1184 -0
- painapple_code/static/js/token-profile.js +274 -0
- painapple_code/static/js/tool-renderer-blocks.js +1626 -0
- painapple_code/static/js/tool-renderer-thinking.js +813 -0
- painapple_code/static/js/tool-renderer.js +1500 -0
- painapple_code/static/js/tooltips.js +197 -0
- painapple_code/static/js/upload-manager.js +1019 -0
- painapple_code/static/js/utils.js +521 -0
- painapple_code/static/js/welcome/api.js +363 -0
- painapple_code/static/js/welcome/cards.js +626 -0
- painapple_code/static/js/welcome/context-menu.js +585 -0
- painapple_code/static/js/welcome/families.js +801 -0
- painapple_code/static/js/welcome/preview.js +234 -0
- painapple_code/static/js/welcome/state.js +129 -0
- painapple_code/static/js/welcome.js +1874 -0
- painapple_code/static/js/widget-system/base-widget.js +717 -0
- painapple_code/static/js/widget-system/device-manager.js +178 -0
- painapple_code/static/js/widget-system/event-bus.js +152 -0
- painapple_code/static/js/widget-system/icons.js +120 -0
- painapple_code/static/js/widget-system/index.js +49 -0
- painapple_code/static/js/widget-system/init.js +54 -0
- painapple_code/static/js/widget-system/types/bottom-sheet.js +307 -0
- painapple_code/static/js/widget-system/types/floating.js +915 -0
- painapple_code/static/js/widget-system/types/index.js +40 -0
- painapple_code/static/js/widget-system/types/modal.js +147 -0
- painapple_code/static/js/widget-system/types/sidebar.js +158 -0
- painapple_code/static/js/widget-system/types/tab.js +146 -0
- painapple_code/static/js/widget-system/types/top-sheet.js +203 -0
- painapple_code/static/js/widget-system/widget-manager.js +1187 -0
- painapple_code/static/js/widgets/about-widget.js +260 -0
- painapple_code/static/js/widgets/active-sessions-widget.js +760 -0
- painapple_code/static/js/widgets/agents-widget.js +897 -0
- painapple_code/static/js/widgets/browser-widget.js +579 -0
- painapple_code/static/js/widgets/commands-widget.js +694 -0
- painapple_code/static/js/widgets/config/commit-sections.js +449 -0
- painapple_code/static/js/widgets/config/dir-autocomplete.js +224 -0
- painapple_code/static/js/widgets/config/gestures.js +161 -0
- painapple_code/static/js/widgets/config/models-tab.js +988 -0
- painapple_code/static/js/widgets/config/quick-actions-tab.js +882 -0
- painapple_code/static/js/widgets/config/shortcut-editor.js +587 -0
- painapple_code/static/js/widgets/config/state.js +517 -0
- painapple_code/static/js/widgets/config/system-controls.js +90 -0
- painapple_code/static/js/widgets/config-widget.js +1535 -0
- painapple_code/static/js/widgets/cost-analytics-widget.js +621 -0
- painapple_code/static/js/widgets/debug-widget.js +693 -0
- painapple_code/static/js/widgets/diff-viewer-widget.js +1420 -0
- painapple_code/static/js/widgets/discussion-widget.js +1107 -0
- painapple_code/static/js/widgets/file-explorer-widget.js +2166 -0
- painapple_code/static/js/widgets/file-preview-widget.js +861 -0
- painapple_code/static/js/widgets/git-widget.js +794 -0
- painapple_code/static/js/widgets/helpers-install-widget.js +720 -0
- painapple_code/static/js/widgets/history-explorer-widget.js +1804 -0
- painapple_code/static/js/widgets/image-annotate-widget.js +951 -0
- painapple_code/static/js/widgets/image-preview-widget.js +692 -0
- painapple_code/static/js/widgets/index.js +176 -0
- painapple_code/static/js/widgets/log-explorer-widget.js +1057 -0
- painapple_code/static/js/widgets/plugins-widget.js +305 -0
- painapple_code/static/js/widgets/prompt-explorer-widget.js +1119 -0
- painapple_code/static/js/widgets/search-files-widget.js +529 -0
- painapple_code/static/js/widgets/skills-widget.js +843 -0
- painapple_code/static/js/widgets/snippets-widget.js +479 -0
- painapple_code/static/js/widgets/sub-agents-widget.js +333 -0
- painapple_code/static/js/widgets/tasks-widget.js +379 -0
- painapple_code/static/js/widgets/terminal/connection.js +283 -0
- painapple_code/static/js/widgets/terminal/gestures.js +357 -0
- painapple_code/static/js/widgets/terminal/init.js +642 -0
- painapple_code/static/js/widgets/terminal/link-providers.js +532 -0
- painapple_code/static/js/widgets/terminal/osc52.js +213 -0
- painapple_code/static/js/widgets/terminal/render.js +159 -0
- painapple_code/static/js/widgets/terminal/size.js +54 -0
- painapple_code/static/js/widgets/terminal/state.js +211 -0
- painapple_code/static/js/widgets/terminal/wrap-utils.js +101 -0
- painapple_code/static/js/widgets/terminal-widget.js +793 -0
- painapple_code/static/js/widgets/uploads-widget.js +461 -0
- painapple_code/static/js/widgets/zen-widget.js +1001 -0
- painapple_code/static/login.html +51 -0
- painapple_code/static/manifest.json +73 -0
- painapple_code/static/sw.js +293 -0
- painapple_code/static/vendor/LICENSES.txt +769 -0
- painapple_code/static/vendor/README.md +103 -0
- painapple_code/static/vendor/codemirror.js +35 -0
- painapple_code/static/vendor/codemirror.js.LEGAL.txt +304 -0
- painapple_code/static/vendor/github-markdown-dark.min.css +1124 -0
- painapple_code/static/vendor/highlight-github-dark.min.css +10 -0
- painapple_code/static/vendor/highlight-lang-dockerfile.min.js +8 -0
- painapple_code/static/vendor/highlight-lang-nginx.min.js +21 -0
- painapple_code/static/vendor/highlight-lang-properties.min.js +10 -0
- painapple_code/static/vendor/highlight-lang-scala.min.js +28 -0
- painapple_code/static/vendor/highlight.min.js +1213 -0
- painapple_code/static/vendor/marked.min.js +6 -0
- painapple_code/static/vendor/purify.min.js +3 -0
- painapple_code/static/vendor/xterm-addon-fit.js +2 -0
- painapple_code/static/vendor/xterm.css +209 -0
- painapple_code/static/vendor/xterm.js +2 -0
- painapple_code/static/web-client.html +635 -0
- painapple_code/subprocess_registry.py +535 -0
- painapple_code/tls_cert.py +79 -0
- painapple_code/tools/agents/shadow-git-helper.md +400 -0
- painapple_code/tools/excalidraw-to-svg.js +143 -0
- painapple_code/tools/install-helpers.sh +148 -0
- painapple_code/tools/shadow-git +320 -0
- painapple_code/tools/shadow-query +120 -0
- painapple_code/tools/vegalite-to-svg.js +79 -0
- painapple_code/turn_query.py +766 -0
- painapple_code/turn_tracker.py +221 -0
- painapple_code/utils/__init__.py +0 -0
- painapple_code/utils/agent_cli.py +306 -0
- painapple_code/utils/chart.py +103 -0
- painapple_code/utils/excalidraw.py +107 -0
- painapple_code/utils/file_lock.py +162 -0
- painapple_code/utils/file_paths.py +648 -0
- painapple_code/utils/generate_icons.py +251 -0
- painapple_code/utils/proc.py +205 -0
- painapple_code/utils/pty_backend.py +59 -0
- painapple_code/utils/pty_posix.py +160 -0
- painapple_code/utils/pty_windows.py +245 -0
- painapple_code/utils/token_profiles.py +91 -0
- painapple_code/viewer_templates.py +657 -0
- painapple_code/welcome_search.py +879 -0
- painapple_code-1.0.0.dist-info/METADATA +292 -0
- painapple_code-1.0.0.dist-info/RECORD +436 -0
- painapple_code-1.0.0.dist-info/WHEEL +5 -0
- painapple_code-1.0.0.dist-info/entry_points.txt +2 -0
- painapple_code-1.0.0.dist-info/licenses/LICENSE +661 -0
- painapple_code-1.0.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +261 -0
- painapple_code-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Feature-triage tool behaviour. Extracted from an inline <script> in
|
|
3
|
+
* feature-triage.html so the CSP can keep script-src free of 'unsafe-inline'.
|
|
4
|
+
*/
|
|
5
|
+
// ── State ──────────────────────────────────────────────────
|
|
6
|
+
let FEATURES = [], GROUPS = [], FILE_MAP = {};
|
|
7
|
+
let decisions = {}, notes = {};
|
|
8
|
+
let currentView = 'grid';
|
|
9
|
+
let searchQuery = '';
|
|
10
|
+
let gridFilter = 'all';
|
|
11
|
+
let detailFeatureId = null;
|
|
12
|
+
let detailList = []; // filtered list for prev/next
|
|
13
|
+
let collapsedGroups = {};
|
|
14
|
+
|
|
15
|
+
// ── Data loading ───────────────────────────────────────────
|
|
16
|
+
async function loadData() {
|
|
17
|
+
const [featRes, triageRes] = await Promise.all([
|
|
18
|
+
fetch('/api/features').then(r => r.json()),
|
|
19
|
+
fetch('/api/triage-state').then(r => r.json())
|
|
20
|
+
]);
|
|
21
|
+
GROUPS = featRes.groups || [];
|
|
22
|
+
FEATURES = featRes.features || [];
|
|
23
|
+
decisions = triageRes.decisions || {};
|
|
24
|
+
notes = triageRes.notes || {};
|
|
25
|
+
buildFileMap();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function buildFileMap() {
|
|
29
|
+
FILE_MAP = {};
|
|
30
|
+
for (const f of FEATURES) {
|
|
31
|
+
const allFiles = [
|
|
32
|
+
...(f.primary_files || []).map(p => ({ file: p, type: 'primary' })),
|
|
33
|
+
...(f.supporting_files || []).map(p => ({ file: p, type: 'supporting' })),
|
|
34
|
+
];
|
|
35
|
+
// Also include spec file inventory
|
|
36
|
+
if (f.spec && f.spec.file_inventory) {
|
|
37
|
+
for (const fi of f.spec.file_inventory) {
|
|
38
|
+
const exists = allFiles.find(a => a.file === fi.file || fi.file.endsWith(a.file) || a.file.endsWith(fi.file));
|
|
39
|
+
if (!exists) allFiles.push({ file: fi.file, type: 'inventory', lines: fi.lines, role: fi.role });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
for (const af of allFiles) {
|
|
43
|
+
if (!FILE_MAP[af.file]) FILE_MAP[af.file] = { features: [], lines: af.lines, role: af.role };
|
|
44
|
+
FILE_MAP[af.file].features.push({ id: f.id, name: f.name, type: af.type });
|
|
45
|
+
if (af.lines && !FILE_MAP[af.file].lines) FILE_MAP[af.file].lines = af.lines;
|
|
46
|
+
if (af.role && !FILE_MAP[af.file].role) FILE_MAP[af.file].role = af.role;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Persistence ────────────────────────────────────────────
|
|
52
|
+
let saveTimeout = null;
|
|
53
|
+
function persistState() {
|
|
54
|
+
clearTimeout(saveTimeout);
|
|
55
|
+
saveTimeout = setTimeout(() => {
|
|
56
|
+
fetch('/api/triage-state', {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: { 'Content-Type': 'application/json' },
|
|
59
|
+
body: JSON.stringify({ decisions, notes })
|
|
60
|
+
});
|
|
61
|
+
}, 500);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ── Search ─────────────────────────────────────────────────
|
|
65
|
+
function matchesSearch(f, q) {
|
|
66
|
+
if (!q) return true;
|
|
67
|
+
const terms = q.toLowerCase().split(/\s+/).filter(Boolean);
|
|
68
|
+
let haystack = `${f.id} ${f.name} ${f.group} ${f.priority} ${f.complexity} ${notes[f.id]||''} ${decisions[f.id]||''}`;
|
|
69
|
+
if (f.spec) {
|
|
70
|
+
haystack += ` ${f.spec.what_it_does} ${f.spec.why_it_exists}`;
|
|
71
|
+
if (f.spec.key_behaviors) haystack += ' ' + f.spec.key_behaviors.join(' ');
|
|
72
|
+
if (f.spec.edge_cases) haystack += ' ' + f.spec.edge_cases;
|
|
73
|
+
}
|
|
74
|
+
if (f.tags) haystack += ' ' + f.tags.join(' ');
|
|
75
|
+
if (f.primary_files) haystack += ' ' + f.primary_files.join(' ');
|
|
76
|
+
haystack = haystack.toLowerCase();
|
|
77
|
+
return terms.every(t => {
|
|
78
|
+
if (t.startsWith('-') && t.length > 1) return !haystack.includes(t.slice(1));
|
|
79
|
+
return haystack.includes(t);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getFilteredFeatures() {
|
|
84
|
+
return FEATURES.filter(f => {
|
|
85
|
+
if (!matchesSearch(f, searchQuery)) return false;
|
|
86
|
+
if (gridFilter === 'all') return true;
|
|
87
|
+
if (gridFilter === 'pending') return !decisions[f.id];
|
|
88
|
+
return decisions[f.id] === gridFilter;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ── View management ────────────────────────────────────────
|
|
93
|
+
function showView(view, skipHash) {
|
|
94
|
+
currentView = view;
|
|
95
|
+
document.querySelectorAll('.view').forEach(v => v.classList.remove('active'));
|
|
96
|
+
document.querySelectorAll('.header-nav button').forEach(b => b.classList.remove('active'));
|
|
97
|
+
const btn = document.querySelector(`.header-nav button[data-view="${view}"]`);
|
|
98
|
+
if (btn) btn.classList.add('active');
|
|
99
|
+
|
|
100
|
+
if (view === 'detail') {
|
|
101
|
+
document.getElementById('detail-view').classList.add('active');
|
|
102
|
+
document.getElementById('export-bar').style.display = 'none';
|
|
103
|
+
} else {
|
|
104
|
+
document.getElementById(`${view}-view`).classList.add('active');
|
|
105
|
+
document.getElementById('export-bar').style.display = (view === 'summary') ? 'flex' : 'none';
|
|
106
|
+
if (view === 'grid') renderGrid();
|
|
107
|
+
if (view === 'files') renderFiles();
|
|
108
|
+
if (view === 'summary') renderSummary();
|
|
109
|
+
}
|
|
110
|
+
if (!skipHash) updateHash();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function updateHash() {
|
|
114
|
+
let hash = currentView;
|
|
115
|
+
if (currentView === 'detail' && detailFeatureId) hash = `feature/${detailFeatureId}`;
|
|
116
|
+
history.replaceState(null, '', '#' + hash);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function restoreFromHash() {
|
|
120
|
+
const hash = location.hash.slice(1);
|
|
121
|
+
if (!hash) return false;
|
|
122
|
+
const parts = hash.split('/');
|
|
123
|
+
if (parts[0] === 'feature' && parts[1]) {
|
|
124
|
+
openDetail(parts[1]);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
if (parts[0] === 'tiles') {
|
|
128
|
+
// compat with old triage URLs
|
|
129
|
+
if (parts[1]) { openDetail(parts[1]); return true; }
|
|
130
|
+
showView('grid', true);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
if (['grid', 'files', 'summary'].includes(parts[0])) {
|
|
134
|
+
showView(parts[0], true);
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ── Progress & stats ───────────────────────────────────────
|
|
141
|
+
function updateStats() {
|
|
142
|
+
const counts = { keep: 0, cut: 0, merge: 0, rethink: 0 };
|
|
143
|
+
FEATURES.forEach(f => { if (decisions[f.id]) counts[decisions[f.id]]++; });
|
|
144
|
+
const decided = Object.values(counts).reduce((a, b) => a + b, 0);
|
|
145
|
+
const total = FEATURES.length;
|
|
146
|
+
const pct = total ? Math.round((decided / total) * 100) : 0;
|
|
147
|
+
|
|
148
|
+
document.getElementById('progress-fill').style.width = pct + '%';
|
|
149
|
+
document.getElementById('header-stats').innerHTML = `
|
|
150
|
+
<span>${decided}/${total}</span>
|
|
151
|
+
<span class="dot keep"></span>${counts.keep}
|
|
152
|
+
<span class="dot cut"></span>${counts.cut}
|
|
153
|
+
<span class="dot merge"></span>${counts.merge}
|
|
154
|
+
<span class="dot rethink"></span>${counts.rethink}
|
|
155
|
+
`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ── Markdown renderer ──────────────────────────────────────
|
|
159
|
+
function escHtml(s) {
|
|
160
|
+
return s.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Escapes a value for use inside a quoted HTML attribute (escHtml leaves
|
|
164
|
+
// quotes alone, which is fine for text nodes but not for attributes).
|
|
165
|
+
function escAttr(s) {
|
|
166
|
+
return String(s == null ? '' : s)
|
|
167
|
+
.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>')
|
|
168
|
+
.replace(/"/g,'"').replace(/'/g,''');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function inlineMd(text) {
|
|
172
|
+
return text
|
|
173
|
+
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
|
174
|
+
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
|
175
|
+
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>')
|
|
176
|
+
.replace(/\b([A-H]\d{2})\b/g, (m, id) => {
|
|
177
|
+
const f = FEATURES.find(f => f.id === id);
|
|
178
|
+
return f ? `<a class="related-chip" data-action="openDetail" data-id="${escAttr(id)}" title="${f.name}">${id}</a>` : m;
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function renderMd(text) {
|
|
183
|
+
if (!text) return '<span style="color:var(--text-faint)">No content</span>';
|
|
184
|
+
const lines = text.split('\n');
|
|
185
|
+
let html = '';
|
|
186
|
+
let inCode = false, inList = false, listTag = '', inTable = false, isFirstTableRow = true;
|
|
187
|
+
|
|
188
|
+
function closeList() { if (inList) { html += `</${listTag}>`; inList = false; } }
|
|
189
|
+
function closeTable() { if (inTable) { html += '</tbody></table>'; inTable = false; } }
|
|
190
|
+
|
|
191
|
+
for (const line of lines) {
|
|
192
|
+
// Code blocks
|
|
193
|
+
if (line.trim().startsWith('```')) {
|
|
194
|
+
if (inCode) { html += '</code></pre>'; inCode = false; }
|
|
195
|
+
else { closeList(); closeTable(); html += '<pre><code>'; inCode = true; }
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (inCode) { html += escHtml(line) + '\n'; continue; }
|
|
199
|
+
|
|
200
|
+
// Tables
|
|
201
|
+
if (line.trim().startsWith('|') && line.trim().endsWith('|')) {
|
|
202
|
+
closeList();
|
|
203
|
+
if (line.trim().match(/^\|[\s:|-]+\|$/)) continue; // separator
|
|
204
|
+
const cells = line.split('|').slice(1, -1).map(c => c.trim());
|
|
205
|
+
if (!inTable) {
|
|
206
|
+
html += '<table><tbody>';
|
|
207
|
+
inTable = true;
|
|
208
|
+
isFirstTableRow = true;
|
|
209
|
+
}
|
|
210
|
+
const tag = isFirstTableRow ? 'th' : 'td';
|
|
211
|
+
html += '<tr>' + cells.map(c => `<${tag}>${inlineMd(c)}</${tag}>`).join('') + '</tr>';
|
|
212
|
+
isFirstTableRow = false;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
closeTable();
|
|
216
|
+
|
|
217
|
+
const trimmed = line.trim();
|
|
218
|
+
|
|
219
|
+
// Sub-headers
|
|
220
|
+
if (trimmed.startsWith('### ')) {
|
|
221
|
+
closeList();
|
|
222
|
+
html += `<h4>${inlineMd(trimmed.slice(4))}</h4>`;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Bullet lists
|
|
227
|
+
const bullet = trimmed.match(/^[-*]\s+(.+)/);
|
|
228
|
+
if (bullet) {
|
|
229
|
+
if (!inList || listTag !== 'ul') { closeList(); html += '<ul>'; inList = true; listTag = 'ul'; }
|
|
230
|
+
html += `<li>${inlineMd(bullet[1])}</li>`;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Numbered lists
|
|
235
|
+
const num = trimmed.match(/^\d+\.\s+(.+)/);
|
|
236
|
+
if (num) {
|
|
237
|
+
if (!inList || listTag !== 'ol') { closeList(); html += '<ol>'; inList = true; listTag = 'ol'; }
|
|
238
|
+
html += `<li>${inlineMd(num[1])}</li>`;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Empty line
|
|
243
|
+
if (!trimmed) { closeList(); continue; }
|
|
244
|
+
|
|
245
|
+
// Continuation of list item (indented)
|
|
246
|
+
if (inList && line.match(/^\s{2,}/)) {
|
|
247
|
+
html += ` ${inlineMd(trimmed)}`;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Paragraph
|
|
252
|
+
closeList();
|
|
253
|
+
html += `<p>${inlineMd(trimmed)}</p>`;
|
|
254
|
+
}
|
|
255
|
+
closeList(); closeTable();
|
|
256
|
+
if (inCode) html += '</code></pre>';
|
|
257
|
+
return html;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// ── Grid View ──────────────────────────────────────────────
|
|
261
|
+
function renderGrid() {
|
|
262
|
+
const filtered = getFilteredFeatures();
|
|
263
|
+
detailList = filtered.map(f => f.id);
|
|
264
|
+
|
|
265
|
+
// Build group structure
|
|
266
|
+
const groupedFeatures = {};
|
|
267
|
+
for (const g of GROUPS) groupedFeatures[g.id] = [];
|
|
268
|
+
for (const f of filtered) {
|
|
269
|
+
if (!groupedFeatures[f.group]) groupedFeatures[f.group] = [];
|
|
270
|
+
groupedFeatures[f.group].push(f);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
let toolbarHtml = `
|
|
274
|
+
<div class="grid-toolbar">
|
|
275
|
+
<button class="filter-chip ${gridFilter==='all'?'active':''}" data-action="setGridFilter" data-filter="all">All</button>
|
|
276
|
+
<button class="filter-chip keep ${gridFilter==='keep'?'active':''}" data-action="setGridFilter" data-filter="keep">Keep</button>
|
|
277
|
+
<button class="filter-chip cut ${gridFilter==='cut'?'active':''}" data-action="setGridFilter" data-filter="cut">Cut</button>
|
|
278
|
+
<button class="filter-chip merge ${gridFilter==='merge'?'active':''}" data-action="setGridFilter" data-filter="merge">Merge</button>
|
|
279
|
+
<button class="filter-chip rethink ${gridFilter==='rethink'?'active':''}" data-action="setGridFilter" data-filter="rethink">Rethink</button>
|
|
280
|
+
<button class="filter-chip ${gridFilter==='pending'?'active':''}" data-action="setGridFilter" data-filter="pending">Pending</button>
|
|
281
|
+
<span class="grid-count">${filtered.length} features</span>
|
|
282
|
+
</div>
|
|
283
|
+
`;
|
|
284
|
+
|
|
285
|
+
let contentHtml = '<div class="grid-content">';
|
|
286
|
+
for (const g of GROUPS) {
|
|
287
|
+
const gf = groupedFeatures[g.id] || [];
|
|
288
|
+
if (gf.length === 0) continue;
|
|
289
|
+
const collapsed = collapsedGroups[g.id];
|
|
290
|
+
contentHtml += `<div class="grid-group">`;
|
|
291
|
+
contentHtml += `<div class="grid-group-header ${collapsed?'collapsed':''}" data-action="toggleGroup" data-gid="${escAttr(g.id)}">
|
|
292
|
+
<span class="chevron">\u25B6</span>
|
|
293
|
+
<h2>${g.id}: ${g.name}</h2>
|
|
294
|
+
<span class="count">${gf.length}</span>
|
|
295
|
+
</div>`;
|
|
296
|
+
if (!collapsed) {
|
|
297
|
+
contentHtml += '<div class="grid-group-tiles">';
|
|
298
|
+
for (const f of gf) {
|
|
299
|
+
const d = decisions[f.id];
|
|
300
|
+
const desc = f.spec?.what_it_does || '';
|
|
301
|
+
const bCount = f.spec?.key_behaviors?.length || 0;
|
|
302
|
+
const fCount = f.spec?.file_inventory?.length || 0;
|
|
303
|
+
contentHtml += `
|
|
304
|
+
<div class="tile ${d ? 'decision-'+d : ''}" data-action="openDetail" data-id="${escAttr(f.id)}">
|
|
305
|
+
${d ? `<div class="tile-decision-dot ${d}"></div>` : ''}
|
|
306
|
+
<div class="tile-header">
|
|
307
|
+
<span class="tile-id">${f.id}</span>
|
|
308
|
+
<span class="tile-name">${f.name}</span>
|
|
309
|
+
</div>
|
|
310
|
+
<div class="tile-desc">${desc ? escHtml(desc.split('.')[0] + '.') : ''}</div>
|
|
311
|
+
<div class="tile-meta">
|
|
312
|
+
<span class="tile-badge ${f.priority}">${f.priority}</span>
|
|
313
|
+
<span class="tile-badge">${f.complexity}</span>
|
|
314
|
+
${bCount ? `<span class="tile-badge b-count">${bCount} behaviors</span>` : ''}
|
|
315
|
+
${fCount ? `<span class="tile-badge f-count">${fCount} files</span>` : ''}
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
contentHtml += '</div>';
|
|
321
|
+
}
|
|
322
|
+
contentHtml += '</div>';
|
|
323
|
+
}
|
|
324
|
+
contentHtml += '</div>';
|
|
325
|
+
|
|
326
|
+
document.getElementById('grid-view').innerHTML = toolbarHtml + contentHtml;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function setGridFilter(f) {
|
|
330
|
+
gridFilter = f;
|
|
331
|
+
renderGrid();
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function toggleGroup(gid) {
|
|
335
|
+
collapsedGroups[gid] = !collapsedGroups[gid];
|
|
336
|
+
renderGrid();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// ── Detail View ────────────────────────────────────────────
|
|
340
|
+
function openDetail(id) {
|
|
341
|
+
const f = FEATURES.find(x => x.id === id);
|
|
342
|
+
if (!f) return;
|
|
343
|
+
detailFeatureId = id;
|
|
344
|
+
if (!detailList.includes(id)) detailList = FEATURES.map(x => x.id);
|
|
345
|
+
renderDetail(f);
|
|
346
|
+
showView('detail');
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function renderDetail(f) {
|
|
350
|
+
const idx = detailList.indexOf(f.id);
|
|
351
|
+
const prevId = idx > 0 ? detailList[idx - 1] : null;
|
|
352
|
+
const nextId = idx < detailList.length - 1 ? detailList[idx + 1] : null;
|
|
353
|
+
const d = decisions[f.id] || '';
|
|
354
|
+
const n = notes[f.id] || '';
|
|
355
|
+
const s = f.spec || {};
|
|
356
|
+
const group = GROUPS.find(g => g.id === f.group);
|
|
357
|
+
|
|
358
|
+
let html = `
|
|
359
|
+
<div class="detail-header">
|
|
360
|
+
<button class="detail-back" data-action="goBackFromDetail" title="Back to grid">\u2190</button>
|
|
361
|
+
<div class="detail-title">
|
|
362
|
+
<span class="id">${f.id}</span>
|
|
363
|
+
<span class="name">${f.name}</span>
|
|
364
|
+
</div>
|
|
365
|
+
<span style="color:var(--text-faint);font-size:12px">${idx+1}/${detailList.length}</span>
|
|
366
|
+
<button class="detail-nav-btn" data-action="navDetail" data-dir="-1" ${!prevId?'disabled':''} title="Previous (Left arrow)">\u2190</button>
|
|
367
|
+
<button class="detail-nav-btn" data-action="navDetail" data-dir="1" ${!nextId?'disabled':''} title="Next (Right arrow)">\u2192</button>
|
|
368
|
+
</div>
|
|
369
|
+
<div class="detail-body">
|
|
370
|
+
<div class="detail-pills">
|
|
371
|
+
<span class="pill ${f.priority}">${f.priority}</span>
|
|
372
|
+
<span class="pill complexity">${f.complexity} complexity</span>
|
|
373
|
+
<span class="pill group">${group ? group.name : f.group}</span>
|
|
374
|
+
${f.tags ? f.tags.map(t => `<span class="pill tag">${t}</span>`).join('') : ''}
|
|
375
|
+
${s.journey_turns ? `<span class="pill tag">${s.journey_turns} journey turns</span>` : ''}
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<div class="detail-decisions">
|
|
379
|
+
<button class="decision-btn keep ${d==='keep'?'selected':''}" data-action="setDecision" data-id="${escAttr(f.id)}" data-decision="keep">Keep</button>
|
|
380
|
+
<button class="decision-btn cut ${d==='cut'?'selected':''}" data-action="setDecision" data-id="${escAttr(f.id)}" data-decision="cut">Cut</button>
|
|
381
|
+
<button class="decision-btn merge ${d==='merge'?'selected':''}" data-action="setDecision" data-id="${escAttr(f.id)}" data-decision="merge">Merge</button>
|
|
382
|
+
<button class="decision-btn rethink ${d==='rethink'?'selected':''}" data-action="setDecision" data-id="${escAttr(f.id)}" data-decision="rethink">Rethink</button>
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<textarea class="detail-notes" placeholder="Notes about this feature..."
|
|
386
|
+
data-action="setNotes" data-id="${escAttr(f.id)}">${escHtml(n)}</textarea>
|
|
387
|
+
`;
|
|
388
|
+
|
|
389
|
+
// What It Does + Why It Exists (always open)
|
|
390
|
+
if (s.what_it_does || s.why_it_exists) {
|
|
391
|
+
html += `
|
|
392
|
+
<div class="spec-section open">
|
|
393
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
394
|
+
<span class="chevron">\u25B6</span>
|
|
395
|
+
<span class="title">Overview</span>
|
|
396
|
+
</div>
|
|
397
|
+
<div class="spec-section-content">
|
|
398
|
+
<div class="md-content">
|
|
399
|
+
${s.what_it_does ? `<p>${inlineMd(s.what_it_does)}</p>` : ''}
|
|
400
|
+
${s.why_it_exists ? `<h4>Why It Exists</h4><p>${inlineMd(s.why_it_exists)}</p>` : ''}
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Key Behaviors
|
|
408
|
+
if (s.key_behaviors && s.key_behaviors.length) {
|
|
409
|
+
let bhtml = '';
|
|
410
|
+
s.key_behaviors.forEach((b, i) => {
|
|
411
|
+
const numMatch = b.match(/^(\d+)\.\s*(.*)/s);
|
|
412
|
+
const text = numMatch ? numMatch[2] : b;
|
|
413
|
+
bhtml += `<div class="behavior-item"><span class="behavior-num">${i+1}</span><span class="behavior-text">${inlineMd(text)}</span></div>`;
|
|
414
|
+
});
|
|
415
|
+
html += `
|
|
416
|
+
<div class="spec-section open">
|
|
417
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
418
|
+
<span class="chevron">\u25B6</span>
|
|
419
|
+
<span class="title">Key Behaviors</span>
|
|
420
|
+
<span class="count">${s.key_behaviors.length}</span>
|
|
421
|
+
</div>
|
|
422
|
+
<div class="spec-section-content" style="padding:0">${bhtml}</div>
|
|
423
|
+
</div>
|
|
424
|
+
`;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Architecture
|
|
428
|
+
if (s.architecture) {
|
|
429
|
+
html += makeSection('Architecture', s.architecture);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// API Surface
|
|
433
|
+
if (s.api_surface) {
|
|
434
|
+
html += makeSection('API Surface', s.api_surface);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// State Management
|
|
438
|
+
if (s.state_management) {
|
|
439
|
+
html += makeSection('State Management', s.state_management);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// File Inventory
|
|
443
|
+
if (s.file_inventory && s.file_inventory.length) {
|
|
444
|
+
const totalLines = s.file_inventory.reduce((sum, fi) => sum + (parseInt(fi.lines) || 0), 0);
|
|
445
|
+
let thtml = '<table class="file-table">';
|
|
446
|
+
for (const fi of s.file_inventory) {
|
|
447
|
+
thtml += `<tr>
|
|
448
|
+
<td class="ft-file" data-action="navigateToFile" data-file="${escAttr(fi.file)}">${escHtml(fi.file)}</td>
|
|
449
|
+
<td class="ft-lines">${fi.lines}</td>
|
|
450
|
+
<td class="ft-role">${escHtml(fi.role)}</td>
|
|
451
|
+
</tr>`;
|
|
452
|
+
}
|
|
453
|
+
thtml += '</table>';
|
|
454
|
+
html += `
|
|
455
|
+
<div class="spec-section open">
|
|
456
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
457
|
+
<span class="chevron">\u25B6</span>
|
|
458
|
+
<span class="title">File Inventory</span>
|
|
459
|
+
<span class="count">${s.file_inventory.length} files, ${totalLines.toLocaleString()} lines</span>
|
|
460
|
+
</div>
|
|
461
|
+
<div class="spec-section-content" style="padding:0">${thtml}</div>
|
|
462
|
+
</div>
|
|
463
|
+
`;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// Dependencies + Related Features
|
|
467
|
+
const relatedIds = f.related_features || [];
|
|
468
|
+
if (s.dependencies || relatedIds.length) {
|
|
469
|
+
let depHtml = '';
|
|
470
|
+
if (s.dependencies) depHtml += `<div class="md-content">${renderMd(s.dependencies)}</div>`;
|
|
471
|
+
if (relatedIds.length) {
|
|
472
|
+
depHtml += '<div style="margin-top:10px"><strong style="font-size:12px;color:var(--text-dim)">Related Features:</strong><div style="margin-top:4px">';
|
|
473
|
+
for (const rid of relatedIds) {
|
|
474
|
+
const rf = FEATURES.find(x => x.id === rid);
|
|
475
|
+
depHtml += `<span class="related-chip" data-action="openDetail" data-id="${escAttr(rid)}" title="${rf ? rf.name : rid}">${rid}${rf ? ' ' + rf.name : ''}</span>`;
|
|
476
|
+
}
|
|
477
|
+
depHtml += '</div></div>';
|
|
478
|
+
}
|
|
479
|
+
html += `
|
|
480
|
+
<div class="spec-section">
|
|
481
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
482
|
+
<span class="chevron">\u25B6</span>
|
|
483
|
+
<span class="title">Dependencies & Related</span>
|
|
484
|
+
<span class="count">${relatedIds.length} related</span>
|
|
485
|
+
</div>
|
|
486
|
+
<div class="spec-section-content">${depHtml}</div>
|
|
487
|
+
</div>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Decisions Made
|
|
492
|
+
if (s.decisions) {
|
|
493
|
+
html += makeSection('Decisions Made', s.decisions);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// Edge Cases
|
|
497
|
+
if (s.edge_cases) {
|
|
498
|
+
html += makeSection('Edge Cases & Constraints', s.edge_cases);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// Requirements for 2.0
|
|
502
|
+
if (s.requirements) {
|
|
503
|
+
html += makeSection('Requirements for 2.0', s.requirements);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// iPadOS workarounds
|
|
507
|
+
if (f.ipados_workarounds && f.ipados_workarounds.length) {
|
|
508
|
+
let wHtml = '<ul>';
|
|
509
|
+
for (const w of f.ipados_workarounds) wHtml += `<li>${inlineMd(w)}</li>`;
|
|
510
|
+
wHtml += '</ul>';
|
|
511
|
+
html += `
|
|
512
|
+
<div class="spec-section">
|
|
513
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
514
|
+
<span class="chevron">\u25B6</span>
|
|
515
|
+
<span class="title">iPadOS Workarounds</span>
|
|
516
|
+
<span class="count">${f.ipados_workarounds.length}</span>
|
|
517
|
+
</div>
|
|
518
|
+
<div class="spec-section-content"><div class="md-content">${wHtml}</div></div>
|
|
519
|
+
</div>
|
|
520
|
+
`;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
html += '</div>'; // detail-body
|
|
524
|
+
document.getElementById('detail-view').innerHTML = html;
|
|
525
|
+
document.getElementById('detail-view').scrollTop = 0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function makeSection(title, content, open) {
|
|
529
|
+
return `
|
|
530
|
+
<div class="spec-section ${open ? 'open' : ''}">
|
|
531
|
+
<div class="spec-section-header" data-action="toggleSection">
|
|
532
|
+
<span class="chevron">\u25B6</span>
|
|
533
|
+
<span class="title">${title}</span>
|
|
534
|
+
</div>
|
|
535
|
+
<div class="spec-section-content"><div class="md-content">${renderMd(content)}</div></div>
|
|
536
|
+
</div>
|
|
537
|
+
`;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function toggleSection(header) {
|
|
541
|
+
header.parentElement.classList.toggle('open');
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function setDecision(id, dec) {
|
|
545
|
+
if (decisions[id] === dec) delete decisions[id];
|
|
546
|
+
else decisions[id] = dec;
|
|
547
|
+
persistState();
|
|
548
|
+
updateStats();
|
|
549
|
+
const f = FEATURES.find(x => x.id === id);
|
|
550
|
+
if (f) renderDetail(f);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function setNotes(id, text) {
|
|
554
|
+
if (text.trim()) notes[id] = text;
|
|
555
|
+
else delete notes[id];
|
|
556
|
+
persistState();
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function navDetail(dir) {
|
|
560
|
+
const idx = detailList.indexOf(detailFeatureId);
|
|
561
|
+
const newIdx = idx + dir;
|
|
562
|
+
if (newIdx >= 0 && newIdx < detailList.length) {
|
|
563
|
+
openDetail(detailList[newIdx]);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function goBackFromDetail() {
|
|
568
|
+
showView('grid');
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function navigateToFile(file) {
|
|
572
|
+
showView('files');
|
|
573
|
+
setTimeout(() => {
|
|
574
|
+
const input = document.querySelector('.files-search');
|
|
575
|
+
// bubbles:true so the delegated 'input' listener on document sees it
|
|
576
|
+
// (real user input events bubble; a bare new Event('input') does not).
|
|
577
|
+
if (input) { input.value = file; input.dispatchEvent(new Event('input', { bubbles: true })); }
|
|
578
|
+
}, 50);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// ── Files View ─────────────────────────────────────────────
|
|
582
|
+
function renderFiles() {
|
|
583
|
+
let fileSearch = '';
|
|
584
|
+
const el = document.querySelector('.files-search');
|
|
585
|
+
if (el) fileSearch = el.value;
|
|
586
|
+
|
|
587
|
+
// Build sorted file list
|
|
588
|
+
const entries = Object.entries(FILE_MAP).sort(([a], [b]) => a.localeCompare(b));
|
|
589
|
+
const filtered = fileSearch
|
|
590
|
+
? entries.filter(([path]) => path.toLowerCase().includes(fileSearch.toLowerCase()))
|
|
591
|
+
: entries;
|
|
592
|
+
|
|
593
|
+
// Group by directory
|
|
594
|
+
const dirs = {};
|
|
595
|
+
for (const [path, info] of filtered) {
|
|
596
|
+
const parts = path.split('/');
|
|
597
|
+
const dir = parts.length > 1 ? parts.slice(0, -1).join('/') : '.';
|
|
598
|
+
if (!dirs[dir]) dirs[dir] = [];
|
|
599
|
+
dirs[dir].push({ path, ...info, filename: parts[parts.length - 1] });
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
let html = `
|
|
603
|
+
<div class="files-toolbar">
|
|
604
|
+
<input class="files-search" placeholder="Filter files..." value="${escAttr(fileSearch)}" data-action="renderFiles">
|
|
605
|
+
<span class="files-count">${filtered.length} files across ${FEATURES.length} features</span>
|
|
606
|
+
</div>
|
|
607
|
+
<div class="files-content">
|
|
608
|
+
`;
|
|
609
|
+
|
|
610
|
+
for (const dir of Object.keys(dirs).sort()) {
|
|
611
|
+
html += `<div class="file-group">`;
|
|
612
|
+
html += `<div class="file-group-header">${dir}/</div>`;
|
|
613
|
+
for (const f of dirs[dir]) {
|
|
614
|
+
html += `<div class="file-entry">
|
|
615
|
+
<span class="file-name">${escHtml(f.filename)}</span>
|
|
616
|
+
<span class="file-lines">${f.lines || ''}</span>
|
|
617
|
+
<div class="file-features">
|
|
618
|
+
${f.features.map(ff => `<span class="file-feat-chip ${ff.type === 'primary' ? 'primary' : ''}" data-action="openDetail" data-id="${escAttr(ff.id)}" title="${ff.name}">${ff.id}</span>`).join('')}
|
|
619
|
+
</div>
|
|
620
|
+
</div>`;
|
|
621
|
+
}
|
|
622
|
+
html += '</div>';
|
|
623
|
+
}
|
|
624
|
+
html += '</div>';
|
|
625
|
+
document.getElementById('files-view').innerHTML = html;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// ── Summary View ───────────────────────────────────────────
|
|
629
|
+
function renderSummary() {
|
|
630
|
+
const counts = { keep: 0, cut: 0, merge: 0, rethink: 0 };
|
|
631
|
+
FEATURES.forEach(f => { if (decisions[f.id]) counts[decisions[f.id]]++; });
|
|
632
|
+
const pending = FEATURES.length - Object.values(counts).reduce((a, b) => a + b, 0);
|
|
633
|
+
|
|
634
|
+
let html = '<div class="summary-content">';
|
|
635
|
+
html += `<div class="summary-grid">
|
|
636
|
+
<div class="stat-card"><div class="stat-num keep">${counts.keep}</div><div class="stat-label">Keep</div></div>
|
|
637
|
+
<div class="stat-card"><div class="stat-num cut">${counts.cut}</div><div class="stat-label">Cut</div></div>
|
|
638
|
+
<div class="stat-card"><div class="stat-num merge">${counts.merge}</div><div class="stat-label">Merge</div></div>
|
|
639
|
+
<div class="stat-card"><div class="stat-num rethink">${counts.rethink}</div><div class="stat-label">Rethink</div></div>
|
|
640
|
+
<div class="stat-card"><div class="stat-num pending">${pending}</div><div class="stat-label">Pending</div></div>
|
|
641
|
+
</div>`;
|
|
642
|
+
|
|
643
|
+
// Priority breakdown
|
|
644
|
+
const byPriority = { critical: [], high: [], medium: [], low: [] };
|
|
645
|
+
FEATURES.forEach(f => { if (byPriority[f.priority]) byPriority[f.priority].push(f); });
|
|
646
|
+
html += `<div class="summary-section"><h3>Priority Breakdown</h3>`;
|
|
647
|
+
for (const [p, list] of Object.entries(byPriority)) {
|
|
648
|
+
if (!list.length) continue;
|
|
649
|
+
const decided = list.filter(f => decisions[f.id]).length;
|
|
650
|
+
html += `<div style="margin-bottom:4px;font-size:13px;color:var(--text-dim)">
|
|
651
|
+
<strong style="text-transform:capitalize">${p}</strong>: ${list.length} features (${decided} decided)
|
|
652
|
+
</div>`;
|
|
653
|
+
}
|
|
654
|
+
html += '</div>';
|
|
655
|
+
|
|
656
|
+
// Per-group rows
|
|
657
|
+
for (const g of GROUPS) {
|
|
658
|
+
const gf = FEATURES.filter(f => f.group === g.id);
|
|
659
|
+
if (!gf.length) continue;
|
|
660
|
+
html += `<div class="summary-section"><h3>${g.id}: ${g.name}</h3>`;
|
|
661
|
+
for (const f of gf) {
|
|
662
|
+
const d = decisions[f.id] || 'pending';
|
|
663
|
+
const n = notes[f.id] || '';
|
|
664
|
+
html += `
|
|
665
|
+
<div class="summary-row" data-action="openDetail" data-id="${escAttr(f.id)}">
|
|
666
|
+
<span class="sid">${f.id}</span>
|
|
667
|
+
<span class="sname">${f.name}</span>
|
|
668
|
+
<span class="spriority ${f.priority}">${f.priority}</span>
|
|
669
|
+
${n ? `<span class="snote" title="${escHtml(n)}">${escHtml(n)}</span>` : ''}
|
|
670
|
+
<span class="sdecision ${d}">${d}</span>
|
|
671
|
+
</div>
|
|
672
|
+
`;
|
|
673
|
+
}
|
|
674
|
+
html += '</div>';
|
|
675
|
+
}
|
|
676
|
+
html += '</div>';
|
|
677
|
+
document.getElementById('summary-view').innerHTML = html;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// ── Export ──────────────────────────────────────────────────
|
|
681
|
+
function exportMarkdown() {
|
|
682
|
+
let md = '# Feature Triage Results\n\n';
|
|
683
|
+
md += `**Date:** ${new Date().toISOString().split('T')[0]}\n`;
|
|
684
|
+
const counts = { keep: 0, cut: 0, merge: 0, rethink: 0 };
|
|
685
|
+
FEATURES.forEach(f => { if (decisions[f.id]) counts[decisions[f.id]]++; });
|
|
686
|
+
md += `**Decisions:** ${counts.keep} keep, ${counts.cut} cut, ${counts.merge} merge, ${counts.rethink} rethink, ${FEATURES.length - Object.keys(decisions).length} pending\n\n`;
|
|
687
|
+
md += '| ID | Feature | Priority | Decision | Notes |\n';
|
|
688
|
+
md += '|----|---------|----------|----------|-------|\n';
|
|
689
|
+
for (const f of FEATURES) {
|
|
690
|
+
const d = decisions[f.id] || 'pending';
|
|
691
|
+
const n = (notes[f.id] || '').replace(/\|/g, '\\|').replace(/\n/g, ' ');
|
|
692
|
+
md += `| ${f.id} | ${f.name} | ${f.priority} | ${d} | ${n} |\n`;
|
|
693
|
+
}
|
|
694
|
+
copyToClipboard(md);
|
|
695
|
+
showToast('Markdown copied to clipboard');
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
function exportJSON() {
|
|
699
|
+
const data = FEATURES.map(f => ({
|
|
700
|
+
id: f.id, name: f.name, group: f.group, priority: f.priority,
|
|
701
|
+
decision: decisions[f.id] || null, notes: notes[f.id] || null
|
|
702
|
+
}));
|
|
703
|
+
copyToClipboard(JSON.stringify(data, null, 2));
|
|
704
|
+
showToast('JSON copied to clipboard');
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function copyToClipboard(text) {
|
|
708
|
+
navigator.clipboard.writeText(text).catch(() => {
|
|
709
|
+
const ta = document.createElement('textarea');
|
|
710
|
+
ta.value = text; document.body.appendChild(ta);
|
|
711
|
+
ta.select(); document.execCommand('copy');
|
|
712
|
+
document.body.removeChild(ta);
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function showToast(msg) {
|
|
717
|
+
const t = document.getElementById('toast');
|
|
718
|
+
t.textContent = msg; t.classList.add('show');
|
|
719
|
+
setTimeout(() => t.classList.remove('show'), 2000);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// ── Keyboard ───────────────────────────────────────────────
|
|
723
|
+
document.addEventListener('keydown', (e) => {
|
|
724
|
+
// Don't intercept when typing in inputs
|
|
725
|
+
if (e.target.tagName === 'TEXTAREA') return;
|
|
726
|
+
if (e.target.tagName === 'INPUT') {
|
|
727
|
+
if (e.key === 'Escape') {
|
|
728
|
+
e.target.blur();
|
|
729
|
+
e.target.value = '';
|
|
730
|
+
searchQuery = '';
|
|
731
|
+
renderGrid();
|
|
732
|
+
}
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
if (e.key === 'Escape') {
|
|
737
|
+
if (currentView === 'detail') { goBackFromDetail(); return; }
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// Detail view shortcuts
|
|
741
|
+
if (currentView === 'detail') {
|
|
742
|
+
if (e.key === 'ArrowLeft') { navDetail(-1); return; }
|
|
743
|
+
if (e.key === 'ArrowRight') { navDetail(1); return; }
|
|
744
|
+
if (e.key === '1') { setDecision(detailFeatureId, 'keep'); return; }
|
|
745
|
+
if (e.key === '2') { setDecision(detailFeatureId, 'cut'); return; }
|
|
746
|
+
if (e.key === '3') { setDecision(detailFeatureId, 'merge'); return; }
|
|
747
|
+
if (e.key === '4') { setDecision(detailFeatureId, 'rethink'); return; }
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// Grid view: type to search
|
|
751
|
+
if (currentView === 'grid' && e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
|
|
752
|
+
const input = document.getElementById('global-search');
|
|
753
|
+
if (input) { input.focus(); return; }
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
// Global search
|
|
758
|
+
document.getElementById('global-search').addEventListener('input', (e) => {
|
|
759
|
+
searchQuery = e.target.value;
|
|
760
|
+
if (currentView === 'grid') renderGrid();
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
// Nav buttons
|
|
764
|
+
document.querySelectorAll('.header-nav button').forEach(btn => {
|
|
765
|
+
btn.addEventListener('click', () => showView(btn.dataset.view));
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
// ── Delegated actions ──────────────────────────────────────
|
|
769
|
+
// Markup carries data-action (+ data-* arguments) instead of inline on*
|
|
770
|
+
// handlers, so script-src can drop 'unsafe-inline'.
|
|
771
|
+
const CLICK_ACTIONS = {
|
|
772
|
+
openDetail: (el) => openDetail(el.dataset.id),
|
|
773
|
+
setGridFilter: (el) => setGridFilter(el.dataset.filter),
|
|
774
|
+
toggleGroup: (el) => toggleGroup(el.dataset.gid),
|
|
775
|
+
goBackFromDetail: () => goBackFromDetail(),
|
|
776
|
+
navDetail: (el) => navDetail(Number(el.dataset.dir)),
|
|
777
|
+
setDecision: (el) => setDecision(el.dataset.id, el.dataset.decision),
|
|
778
|
+
toggleSection: (el) => toggleSection(el),
|
|
779
|
+
navigateToFile: (el) => navigateToFile(el.dataset.file),
|
|
780
|
+
exportMarkdown: () => exportMarkdown(),
|
|
781
|
+
exportJSON: () => exportJSON(),
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
const INPUT_ACTIONS = {
|
|
785
|
+
setNotes: (el) => setNotes(el.dataset.id, el.value),
|
|
786
|
+
renderFiles: () => renderFiles(),
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
function delegateActions(table) {
|
|
790
|
+
return (e) => {
|
|
791
|
+
const target = e.target;
|
|
792
|
+
if (!target || typeof target.closest !== 'function') return;
|
|
793
|
+
const el = target.closest('[data-action]');
|
|
794
|
+
if (!el) return;
|
|
795
|
+
const name = el.dataset.action;
|
|
796
|
+
if (!Object.prototype.hasOwnProperty.call(table, name)) return;
|
|
797
|
+
table[name](el, e);
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
document.addEventListener('click', delegateActions(CLICK_ACTIONS));
|
|
802
|
+
document.addEventListener('input', delegateActions(INPUT_ACTIONS));
|
|
803
|
+
|
|
804
|
+
// ── Init ───────────────────────────────────────────────────
|
|
805
|
+
(async () => {
|
|
806
|
+
await loadData();
|
|
807
|
+
updateStats();
|
|
808
|
+
if (!restoreFromHash()) {
|
|
809
|
+
showView('grid');
|
|
810
|
+
}
|
|
811
|
+
})();
|