maestro-flow 0.3.8 → 0.3.9
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/.claude/commands/learn-decompose.md +3 -3
- package/.claude/commands/learn-follow.md +5 -5
- package/.claude/commands/learn-investigate.md +3 -3
- package/.claude/commands/learn-retro.md +6 -6
- package/.claude/commands/learn-second-opinion.md +3 -3
- package/.claude/commands/maestro-analyze.md +123 -99
- package/.claude/commands/maestro-brainstorm.md +2 -2
- package/.claude/commands/maestro-execute.md +137 -97
- package/.claude/commands/maestro-fork.md +111 -0
- package/.claude/commands/maestro-init.md +6 -6
- package/.claude/commands/maestro-merge.md +77 -0
- package/.claude/commands/maestro-milestone-audit.md +72 -60
- package/.claude/commands/maestro-milestone-complete.md +67 -59
- package/.claude/commands/maestro-milestone-release.md +6 -6
- package/.claude/commands/maestro-plan.md +151 -130
- package/.claude/commands/maestro-quick.md +4 -4
- package/.claude/commands/maestro-roadmap.md +5 -5
- package/.claude/commands/maestro-spec-generate.md +5 -5
- package/.claude/commands/maestro-ui-design.md +3 -3
- package/.claude/commands/maestro-verify.md +106 -87
- package/.claude/commands/maestro.md +10 -4
- package/.claude/commands/manage-codebase-rebuild.md +4 -4
- package/.claude/commands/manage-codebase-refresh.md +1 -1
- package/.claude/commands/manage-harvest.md +5 -5
- package/.claude/commands/manage-issue-discover.md +1 -1
- package/.claude/commands/manage-issue-execute.md +6 -6
- package/.claude/commands/manage-issue.md +6 -6
- package/.claude/commands/manage-learn.md +2 -2
- package/.claude/commands/manage-memory-capture.md +4 -4
- package/.claude/commands/manage-memory.md +2 -2
- package/.claude/commands/manage-status.md +24 -24
- package/.claude/commands/quality-business-test.md +5 -5
- package/.claude/commands/quality-debug.md +4 -4
- package/.claude/commands/quality-integration-test.md +4 -4
- package/.claude/commands/quality-refactor.md +3 -3
- package/.claude/commands/quality-retrospective.md +2 -2
- package/.claude/commands/quality-review.md +4 -4
- package/.claude/commands/quality-sync.md +3 -3
- package/.claude/commands/quality-test-gen.md +4 -4
- package/.claude/commands/quality-test.md +9 -9
- package/.claude/commands/spec-add.md +2 -2
- package/.claude/commands/spec-load.md +1 -1
- package/.claude/commands/spec-setup.md +5 -5
- package/.claude/commands/wiki-connect.md +3 -3
- package/.claude/commands/wiki-digest.md +4 -4
- package/.codex/skills/maestro-analyze/SKILL.md +52 -14
- package/.codex/skills/maestro-execute/SKILL.md +27 -26
- package/.codex/skills/maestro-milestone-audit/SKILL.md +103 -209
- package/.codex/skills/maestro-milestone-complete/SKILL.md +149 -158
- package/.codex/skills/maestro-plan/SKILL.md +47 -17
- package/.codex/skills/maestro-roadmap/SKILL.md +3 -2
- package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +2 -2
- package/.codex/skills/team-executor/roles/executor/commands/monitor.md +1 -1
- package/.codex/skills/team-lifecycle-v4/roles/coordinator/commands/monitor.md +2 -2
- package/.codex/skills/team-lifecycle-v4/specs/knowledge-transfer.md +2 -2
- package/.codex/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-review/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-testing/roles/coordinator/commands/monitor.md +1 -1
- package/README.md +19 -14
- package/README.zh-CN.md +16 -12
- package/bin/maestro-mcp.js +1 -1
- package/chains/_intent-map.json +21 -9
- package/chains/_router.json +30 -77
- package/chains/brainstorm-driven.json +17 -6
- package/chains/full-lifecycle.json +22 -23
- package/chains/milestone-close.json +20 -7
- package/chains/milestone-fork-merge.json +50 -0
- package/chains/roadmap-driven.json +17 -6
- package/chains/spec-driven.json +17 -6
- package/dashboard/dist/assets/{ArtifactsPage-BmPOu8sO.js → ArtifactsPage-DZNCi6tn.js} +12 -7
- package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +49 -0
- package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +22 -0
- package/dashboard/dist/assets/CollabPage-B4NAHXS2.js +1 -0
- package/dashboard/dist/assets/ExecutionPanel-CFt4LJyq.js +1 -0
- package/dashboard/dist/assets/KanbanPage-C8USth6H.js +21 -0
- package/dashboard/dist/assets/{MarkdownRenderer-BjZ43aSa.js → MarkdownRenderer-X4af_WNb.js} +1 -1
- package/dashboard/dist/assets/McpPage-BKfCVIyU.js +21 -0
- package/dashboard/dist/assets/OutputPanel-BlBQFJSW.js +1 -0
- package/dashboard/dist/assets/ProblemsPanel-De3DLvoI.js +1 -0
- package/dashboard/dist/assets/{RequirementBoardPage-B7yRL0s_.js → RequirementBoardPage-Bf1trzqs.js} +2 -2
- package/dashboard/dist/assets/{RequirementPage-D8J_-b6O.js → RequirementPage-Bllxe2XI.js} +10 -5
- package/dashboard/dist/assets/{SpecsPage-6lO8v8_C.js → SpecsPage-9lwxKT27.js} +2 -2
- package/dashboard/dist/assets/{SupervisorPage-Ds5N378a.js → SupervisorPage-SusdfHFq.js} +1 -1
- package/dashboard/dist/assets/{TeamsPage-DrkKr17T.js → TeamsPage-DsuM6OwC.js} +2 -2
- package/dashboard/dist/assets/TreeBrowser-Q12qobZs.js +6 -0
- package/dashboard/dist/assets/WorkflowPage-D_Fzdy3_.js +6 -0
- package/dashboard/dist/assets/{arrow-left-CadP5YgU.js → arrow-left-Bqtb2hle.js} +1 -1
- package/dashboard/dist/assets/{check-5xufDzS8.js → check-u6fGOwQO.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-CYbpR4ev.js → chevron-right-Csu22t58.js} +1 -1
- package/dashboard/dist/assets/{circle-Bm-5Q-Yh.js → circle-CMrkbRNg.js} +1 -1
- package/dashboard/dist/assets/{circle-alert-BqcYuT7x.js → circle-alert-c3tH1P4z.js} +1 -1
- package/dashboard/dist/assets/{circle-check-big-yyzAFysU.js → circle-check-big-TDSeWstm.js} +1 -1
- package/dashboard/dist/assets/{circle-check-DEVzW_lm.js → circle-check-gYxxSYuH.js} +1 -1
- package/dashboard/dist/assets/{code-BBdC8Wmw.js → code-CFN2uX9V.js} +1 -1
- package/dashboard/dist/assets/{columns-3-CQ9Trztr.js → columns-3-38xIDlzy.js} +1 -1
- package/dashboard/dist/assets/{download-DayuF-sn.js → download-DC7KkKyP.js} +1 -1
- package/dashboard/dist/assets/{folder-CqXeSKeC.js → folder-CWq_lAnf.js} +1 -1
- package/dashboard/dist/assets/index-DWG-WrzT.js +231 -0
- package/dashboard/dist/assets/{index-Dru5HYy0.js → index-Do71weNR.js} +1 -1
- package/dashboard/dist/assets/index-GUNJodSR.css +1 -0
- package/dashboard/dist/assets/{list-DBOD6IUt.js → list-CgIP_2A-.js} +1 -1
- package/dashboard/dist/assets/{minus-fQI1Syn2.js → minus-DYoN5UGk.js} +1 -1
- package/dashboard/dist/assets/{pen-line-Bkbbngl5.js → pen-line-Bh_WKYHm.js} +1 -1
- package/dashboard/dist/assets/{proxy-teW12DdZ.js → proxy-BKxDAKTj.js} +1 -1
- package/dashboard/dist/assets/{search-Bq3ygFUW.js → search-SieXnOgr.js} +1 -1
- package/dashboard/dist/assets/{shallow-22ZN8sFt.js → shallow-Bme1JY57.js} +1 -1
- package/dashboard/dist/assets/{table-BEYtdWc4.js → table-llyEtj-7.js} +1 -1
- package/dashboard/dist/assets/terminal-BB3Xfuv5.js +6 -0
- package/dashboard/dist/assets/{trash-2-DMqGBgcF.js → trash-2-C8f4vFFM.js} +1 -1
- package/dashboard/dist/assets/{zap-9DVkGVtt.js → zap-4uwlzVm0.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +8 -4
- package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.js +2 -1
- package/dashboard/dist-server/dashboard/src/server/agents/entry-normalizer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js +20 -10
- package/dashboard/dist-server/dashboard/src/server/agents/stream-json-adapter.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/git.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/server/routes/git.js +79 -0
- package/dashboard/dist-server/dashboard/src/server/routes/git.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/server/routes/index.js +3 -0
- package/dashboard/dist-server/dashboard/src/server/routes/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/workspace.js +43 -0
- package/dashboard/dist-server/dashboard/src/server/routes/workspace.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.js +43 -3
- package/dashboard/dist-server/dashboard/src/server/state/state-manager.js.map +1 -1
- package/dashboard/package.json +59 -59
- package/dist/src/cli.js +3 -1
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/{team.d.ts → collab.d.ts} +2 -2
- package/dist/src/commands/collab.d.ts.map +1 -0
- package/dist/src/commands/{team.js → collab.js} +391 -24
- package/dist/src/commands/collab.js.map +1 -0
- package/dist/src/commands/msg.d.ts.map +1 -1
- package/dist/src/commands/msg.js +4 -3
- package/dist/src/commands/msg.js.map +1 -1
- package/dist/src/hooks/team-monitor.d.ts.map +1 -1
- package/dist/src/hooks/team-monitor.js +16 -0
- package/dist/src/hooks/team-monitor.js.map +1 -1
- package/dist/src/tools/collab-adapter.d.ts +85 -0
- package/dist/src/tools/collab-adapter.d.ts.map +1 -0
- package/dist/src/tools/collab-adapter.js +320 -0
- package/dist/src/tools/collab-adapter.js.map +1 -0
- package/dist/src/tools/namespace-guard.d.ts +2 -0
- package/dist/src/tools/namespace-guard.d.ts.map +1 -1
- package/dist/src/tools/namespace-guard.js +12 -0
- package/dist/src/tools/namespace-guard.js.map +1 -1
- package/dist/src/tools/phase-gate-evaluator.d.ts +45 -0
- package/dist/src/tools/phase-gate-evaluator.d.ts.map +1 -0
- package/dist/src/tools/phase-gate-evaluator.js +42 -0
- package/dist/src/tools/phase-gate-evaluator.js.map +1 -0
- package/dist/src/tools/team-members.d.ts +18 -0
- package/dist/src/tools/team-members.d.ts.map +1 -1
- package/dist/src/tools/team-members.js +50 -0
- package/dist/src/tools/team-members.js.map +1 -1
- package/dist/src/tools/team-tasks.d.ts +120 -0
- package/dist/src/tools/team-tasks.d.ts.map +1 -0
- package/dist/src/tools/team-tasks.js +365 -0
- package/dist/src/tools/team-tasks.js.map +1 -0
- package/dist/src/tools/transition-recorder.d.ts +3 -0
- package/dist/src/tools/transition-recorder.d.ts.map +1 -1
- package/dist/src/tools/transition-recorder.js +52 -1
- package/dist/src/tools/transition-recorder.js.map +1 -1
- package/dist/src/utils/get-version.d.ts.map +1 -1
- package/dist/src/utils/get-version.js +15 -4
- package/dist/src/utils/get-version.js.map +1 -1
- package/package.json +1 -1
- package/templates/config.json +7 -0
- package/templates/worktree-scope.json +10 -0
- package/templates/worktrees.json +27 -0
- package/workflows/analyze.md +86 -36
- package/workflows/brainstorm.md +17 -37
- package/workflows/execute.md +94 -28
- package/workflows/fork.md +309 -0
- package/workflows/init.md +10 -1
- package/workflows/issue.md +66 -7
- package/workflows/maestro-coordinate.md +23 -16
- package/workflows/maestro.md +52 -35
- package/workflows/merge.md +285 -0
- package/workflows/milestone-audit.md +89 -70
- package/workflows/milestone-complete.md +89 -156
- package/workflows/plan.md +122 -17
- package/workflows/retrospective.md +3 -3
- package/workflows/roadmap.md +11 -3
- package/workflows/spec-generate.md +9 -0
- package/workflows/status.md +76 -27
- package/workflows/ui-design.md +14 -12
- package/workflows/verify.md +44 -8
- package/.claude/commands/maestro-phase-add.md +0 -63
- package/.claude/commands/maestro-phase-transition.md +0 -75
- package/.codex/skills/maestro-phase-add/SKILL.md +0 -154
- package/.codex/skills/maestro-phase-transition/SKILL.md +0 -173
- package/chains/singles/phase-add.json +0 -31
- package/chains/singles/phase-transition.json +0 -23
- package/dashboard/dist/assets/ChatInput-CL8YDfOU.js +0 -67
- package/dashboard/dist/assets/ChatPage-CT-ozBK2.js +0 -8
- package/dashboard/dist/assets/CollabPage-C0rWMden.js +0 -1
- package/dashboard/dist/assets/KanbanPage-C6WbAlwI.js +0 -16
- package/dashboard/dist/assets/McpPage-BPIXADQi.js +0 -16
- package/dashboard/dist/assets/TreeBrowser-g_QUKemL.js +0 -11
- package/dashboard/dist/assets/WorkflowPage-X8aNkDEr.js +0 -6
- package/dashboard/dist/assets/git-branch-SqFf4Ru5.js +0 -6
- package/dashboard/dist/assets/index-D2Mtyw7I.css +0 -1
- package/dashboard/dist/assets/index-nufWop4p.js +0 -231
- package/dashboard/dist/assets/wrench-B84-zdLI.js +0 -11
- package/dist/src/commands/team.d.ts.map +0 -1
- package/dist/src/commands/team.js.map +0 -1
- package/workflows/phase-add.md +0 -252
- package/workflows/phase-transition.md +0 -399
package/dashboard/dist/assets/{RequirementBoardPage-B7yRL0s_.js → RequirementBoardPage-Bf1trzqs.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as g,
|
|
1
|
+
import{d as g,Z as z,Y as y,j as e,_ as S,c as k,r as d,$ as u}from"./index-DWG-WrzT.js";import{C as f}from"./circle-CMrkbRNg.js";import{M as h}from"./minus-DYoN5UGk.js";import{A as w}from"./arrow-left-Bqtb2hle.js";import{C as j}from"./circle-check-big-TDSeWstm.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{d as g,Q as z,N as y,j as e,U as S,c as k,r as d,Y as u}from"./index-nufW
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const q=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],N=g("loader",q),p={open:"var(--color-text-tertiary)",registered:"var(--color-accent-blue)",in_progress:"var(--color-accent-blue)",resolved:"var(--color-accent-green)",closed:"var(--color-accent-green)",deferred:"var(--color-text-tertiary)"};function M({status:s}){switch(s){case"resolved":case"closed":return e.jsx(j,{size:14,style:{color:p[s]}});case"in_progress":return e.jsx(N,{size:14,className:"animate-spin",style:{color:p[s]}});case"open":case"registered":return e.jsx(f,{size:14,style:{color:p[s]}});case"deferred":default:return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function R({issue:s}){const t={low:"bg-green-500/15 text-green-400",medium:"bg-yellow-500/15 text-yellow-400",high:"bg-orange-500/15 text-orange-400",urgent:"bg-red-500/15 text-red-400"};return e.jsxs("div",{className:"p-[var(--spacing-3)] rounded-[var(--radius-sm)] flex flex-col gap-[var(--spacing-2)]",style:{background:"var(--color-bg-secondary)",border:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)]",children:[e.jsx(M,{status:s.status}),e.jsx("span",{className:"flex-1 text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:s.title}),e.jsx("span",{className:"shrink-0 text-[length:var(--font-size-xs)] text-text-tertiary",children:s.type})]}),s.description&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] line-clamp-2",style:{color:"var(--color-text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[length:var(--font-size-xs)] ${t[s.priority]??""}`,children:s.priority}),e.jsx("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:s.status})]})]})}function b({status:s}){switch(s){case"running":return e.jsx(N,{size:14,className:"animate-spin",style:{color:"var(--color-accent-blue)"}});case"completed":return e.jsx(j,{size:14,style:{color:"var(--color-accent-green)"}});case"failed":return e.jsx(C,{size:14,style:{color:"var(--color-accent-red)"}});case"skipped":return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}});case"pending":default:return e.jsx(f,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function _({step:s,isSelected:t,onSelect:l}){return e.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-sm)] text-left transition-colors",style:{background:t?"var(--color-bg-tertiary)":"transparent"},children:[e.jsx(b,{status:s.status}),e.jsxs("span",{className:"flex-1 text-[length:var(--font-size-sm)] truncate",style:{color:"var(--color-text-primary)"},children:[s.cmd,s.args?` ${s.args}`:""]}),s.summary&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] shrink-0",style:{color:"var(--color-text-secondary)"},children:s.summary})]})}function
|
|
11
|
+
*/const q=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],N=g("loader",q),p={open:"var(--color-text-tertiary)",registered:"var(--color-accent-blue)",in_progress:"var(--color-accent-blue)",resolved:"var(--color-accent-green)",closed:"var(--color-accent-green)",deferred:"var(--color-text-tertiary)"};function M({status:s}){switch(s){case"resolved":case"closed":return e.jsx(j,{size:14,style:{color:p[s]}});case"in_progress":return e.jsx(N,{size:14,className:"animate-spin",style:{color:p[s]}});case"open":case"registered":return e.jsx(f,{size:14,style:{color:p[s]}});case"deferred":default:return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function R({issue:s}){const t={low:"bg-green-500/15 text-green-400",medium:"bg-yellow-500/15 text-yellow-400",high:"bg-orange-500/15 text-orange-400",urgent:"bg-red-500/15 text-red-400"};return e.jsxs("div",{className:"p-[var(--spacing-3)] rounded-[var(--radius-sm)] flex flex-col gap-[var(--spacing-2)]",style:{background:"var(--color-bg-secondary)",border:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"flex items-start gap-[var(--spacing-2)]",children:[e.jsx(M,{status:s.status}),e.jsx("span",{className:"flex-1 text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:s.title}),e.jsx("span",{className:"shrink-0 text-[length:var(--font-size-xs)] text-text-tertiary",children:s.type})]}),s.description&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] line-clamp-2",style:{color:"var(--color-text-secondary)"},children:s.description}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[length:var(--font-size-xs)] ${t[s.priority]??""}`,children:s.priority}),e.jsx("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:s.status})]})]})}function b({status:s}){switch(s){case"running":return e.jsx(N,{size:14,className:"animate-spin",style:{color:"var(--color-accent-blue)"}});case"completed":return e.jsx(j,{size:14,style:{color:"var(--color-accent-green)"}});case"failed":return e.jsx(C,{size:14,style:{color:"var(--color-accent-red)"}});case"skipped":return e.jsx(h,{size:14,style:{color:"var(--color-text-tertiary)"}});case"pending":default:return e.jsx(f,{size:14,style:{color:"var(--color-text-tertiary)"}})}}function _({step:s,isSelected:t,onSelect:l}){return e.jsxs("button",{type:"button",onClick:l,className:"w-full flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-sm)] text-left transition-colors",style:{background:t?"var(--color-bg-tertiary)":"transparent"},children:[e.jsx(b,{status:s.status}),e.jsxs("span",{className:"flex-1 text-[length:var(--font-size-sm)] truncate",style:{color:"var(--color-text-primary)"},children:[s.cmd,s.args?` ${s.args}`:""]}),s.summary&&e.jsx("span",{className:"text-[length:var(--font-size-xs)] shrink-0",style:{color:"var(--color-text-secondary)"},children:s.summary})]})}function $({issueIds:s}){const{issues:t,fetchIssues:l,loading:n}=k();d.useEffect(()=>{l()},[l]);const c=d.useMemo(()=>t.filter(a=>s.includes(a.id)),[t,s]),i=d.useMemo(()=>{const a={};for(const o of c)a[o.status]=(a[o.status]??0)+1;return a},[c]);return n&&c.length===0?e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"Loading issues..."}):e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-4)] p-[var(--spacing-4)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-4)]",children:[e.jsxs("span",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:[c.length," Issues"]}),Object.entries(i).map(([a,o])=>e.jsxs("span",{className:"text-[length:var(--font-size-xs)]",style:{color:"var(--color-text-secondary)"},children:[a,": ",o]},a))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-[var(--spacing-3)]",children:c.map(a=>e.jsx(R,{issue:a},a.id))}),c.length===0&&e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:"No issues found for this requirement."})]})}function B({sessionId:s}){const t=u(r=>r.session),l=u(r=>r.selectStep);u(r=>r.selectedStepIndex);const[n,c]=d.useState(null),i=(t==null?void 0:t.sessionId)===s,a=i?t.steps:[],o=d.useMemo(()=>n!=null?a.find(r=>r.index===n)??null:null,[a,n]),v=d.useCallback(r=>{c(m=>m===r?null:r),i&&l(r)},[i,l]),x=d.useMemo(()=>{const r={completed:0,running:0,failed:0,pending:0,skipped:0};for(const m of a)r[m.status]=(r[m.status]??0)+1;return r},[a]);return i?e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-[280px] shrink-0 flex flex-col overflow-y-auto",style:{borderRight:"1px solid var(--color-border)"},children:[e.jsxs("div",{className:"px-[var(--spacing-4)] py-[var(--spacing-3)] shrink-0",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("div",{className:"text-[length:var(--font-size-sm)] font-medium",style:{color:"var(--color-text-primary)"},children:t.chainName??"Session Steps"}),e.jsxs("div",{className:"text-[length:var(--font-size-xs)] mt-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:["Step ",t.currentStep+1," / ",a.length||"?"," | ",x.completed," done",x.failed>0&&`, ${x.failed} failed`,t.avgQuality!=null&&` | Quality: ${t.avgQuality}`]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-2)]",children:a.map(r=>e.jsx(_,{step:r,isSelected:n===r.index,onSelect:()=>v(r.index)},r.index))})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-[var(--spacing-4)]",children:o?e.jsxs("div",{className:"flex flex-col gap-[var(--spacing-3)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)]",children:[e.jsx(b,{status:o.status}),e.jsx("span",{className:"text-[length:var(--font-size-base)] font-medium",style:{color:"var(--color-text-primary)"},children:o.cmd}),o.args&&e.jsx("span",{className:"text-[length:var(--font-size-sm)]",style:{color:"var(--color-text-secondary)"},children:o.args})]}),o.summary&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Summary"}),e.jsx("div",{className:"text-[length:var(--font-size-sm)] rounded-[var(--radius-sm)] p-[var(--spacing-3)]",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.summary})]}),o.analysis&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-medium mb-[var(--spacing-1)]",style:{color:"var(--color-text-secondary)"},children:"Analysis"}),e.jsx("pre",{className:"text-[length:var(--font-size-xs)] rounded-[var(--radius-sm)] p-[var(--spacing-3)] overflow-x-auto whitespace-pre-wrap",style:{color:"var(--color-text-primary)",background:"var(--color-bg-secondary)"},children:o.analysis})]})]}):e.jsx("div",{className:"text-[length:var(--font-size-sm)] text-center py-[var(--spacing-6)]",style:{color:"var(--color-text-tertiary)"},children:"Select a step to view details"})})]}):e.jsx("div",{className:"flex items-center justify-center py-[var(--spacing-8)]",style:{color:"var(--color-text-tertiary)"},children:e.jsxs("span",{className:"text-[length:var(--font-size-sm)]",children:["Coordinate session not active. Session: ",s]})})}function P(){const{id:s}=z(),t=y(r=>r.currentRequirement),l=y(r=>r.committedResult),n=l!=null&&l.requirementId===s,c=n?l.mode:null,i=n?l.issueIds??[]:[],a=n?l.coordinateSessionId??"":"",o=t!=null&&t.id===s,v=o?t.title:`Requirement ${s??""}`,x=o?t.summary:null;return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"shrink-0 flex items-center gap-[var(--spacing-3)] px-[var(--spacing-4)] py-[var(--spacing-3)]",style:{borderBottom:"1px solid var(--color-border)"},children:[e.jsx("a",{href:"/requirement",className:"flex items-center justify-center w-7 h-7 rounded-[var(--radius-sm)] transition-colors",style:{color:"var(--color-text-secondary)"},title:"Back to Requirements",children:e.jsx(w,{size:16})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-[length:var(--font-size-base)] font-semibold truncate",style:{color:"var(--color-text-primary)"},children:v}),x&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] truncate mt-[var(--spacing-0-5)]",style:{color:"var(--color-text-secondary)"},children:x})]}),c&&e.jsx("span",{className:"shrink-0 px-[var(--spacing-2)] py-[var(--spacing-1)] rounded-[var(--radius-sm)] text-[length:var(--font-size-xs)] font-medium",style:{background:c==="issues"?"var(--color-accent-blue)":"var(--color-accent-green)",color:"#fff"},children:c==="issues"?"Issues":"Coordinate"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[!c&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"var(--color-text-tertiary)"},children:e.jsx("span",{className:"text-[length:var(--font-size-sm)]",children:"No board data available for this requirement."})}),c==="issues"&&e.jsx($,{issueIds:i}),c==="coordinate"&&e.jsx(B,{sessionId:a})]}),e.jsx(S,{})]})}export{P as RequirementBoardPage};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import{d as
|
|
1
|
+
import{d as h,Y as b,r as g,j as e,Q as f,X as C,N as R,M as _}from"./index-DWG-WrzT.js";import{u as y}from"./shallow-Bme1JY57.js";import{Z as D}from"./zap-4uwlzVm0.js";import{T as E}from"./trash-2-C8f4vFFM.js";import{C as L}from"./code-CFN2uX9V.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const M=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],T=h("arrow-right",M);/**
|
|
7
7
|
* @license lucide-react v0.577.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const q=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],F=h("circle-plus",q);/**
|
|
12
12
|
* @license lucide-react v0.577.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const S=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],$=h("git-branch",S);/**
|
|
17
17
|
* @license lucide-react v0.577.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const W=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],P=f("rotate-ccw",W),H=[{value:"high-level",label:"High-level",desc:"3-5 epics"},{value:"standard",label:"Standard",desc:"5-10 tasks"},{value:"atomic",label:"Atomic",desc:"10-20 steps"}],A={done:"bg-accent-green",failed:"bg-accent-red",reviewing:"bg-accent-orange",expanding:"bg-accent-blue",committing:"bg-accent-orange",draft:"bg-text-tertiary"},N={feature:"bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",task:"bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",bug:"bg-[var(--color-tint-blocked)] text-[var(--color-accent-red)]",improvement:"bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]"},k={urgent:"bg-accent-red",high:"bg-accent-orange",medium:"bg-accent-yellow",low:"bg-text-placeholder"},O={small:"S",medium:"M",large:"L","1h":"1h","2h":"2h","4h":"4h","1d":"1d","2d":"2d","1w":"1w"};function K(){const[t,l]=g.useState(""),[s,c]=g.useState("standard"),[o,p]=g.useState("sdk"),{expand:d,isLoading:i,continueFrom:a,setContinueFrom:x}=h(y(r=>({expand:r.expand,isLoading:r.isLoading,continueFrom:r.continueFrom,setContinueFrom:r.setContinueFrom}))),m=g.useCallback(()=>{const r=t.trim();!r||i||d(r,s,o)},[t,s,o,d,i]),v=g.useCallback(r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),m())},[m]);return e.jsxs("div",{className:"px-[var(--spacing-5)] pt-[var(--spacing-6)] shrink-0",children:[e.jsx("h1",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-[var(--spacing-1)]",style:{fontFamily:"var(--style-heading-font)",letterSpacing:"var(--style-heading-letter-spacing)"},children:"Expand requirements"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mb-[var(--spacing-4)]",children:"Natural language to structured decomposition"}),e.jsxs("div",{className:`bg-bg-card border rounded-[var(--style-composer-radius)] shadow-sm transition-all duration-[var(--duration-normal)] focus-within:shadow-[0_2px_10px_rgba(0,0,0,0.03),0_0_0_3px_rgba(200,134,58,0.08)] ${a?"border-[var(--color-accent-purple)] focus-within:border-[var(--color-accent-purple)]":"border-border focus-within:border-[var(--color-accent-orange)]"}`,children:[a&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] pt-[var(--spacing-2-5)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] flex-1 min-w-0 px-[var(--spacing-2-5)] py-[var(--spacing-1-5)] rounded-[var(--radius-default)] bg-[var(--color-tint-planning)]",children:[e.jsx(b,{size:12,strokeWidth:2,className:"text-[var(--color-accent-purple)] shrink-0"}),e.jsx("span",{className:"text-[10px] font-semibold text-[var(--color-accent-purple)] shrink-0",children:"Continue from"}),e.jsx("span",{className:"text-[10px] font-medium text-text-secondary truncate",children:a.title||a.userInput.substring(0,40)}),e.jsxs("span",{className:"text-[9px] text-text-placeholder shrink-0",children:[a.items.length," items"]})]}),e.jsx("button",{type:"button",className:"w-[20px] h-[20px] rounded-[var(--radius-sm)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-fast)] shrink-0",onClick:()=>x(null),title:"Dismiss context",children:e.jsx(C,{size:12,strokeWidth:2})})]}),e.jsx("textarea",{className:"w-full border-none bg-transparent resize-none outline-none text-text-primary leading-relaxed font-sans",style:{fontSize:"var(--style-composer-textarea-size)",padding:"var(--style-composer-padding)",paddingBottom:"var(--spacing-2)",paddingTop:a?"var(--spacing-2)":void 0},placeholder:a?"Describe additional requirements to build upon...":"Describe a feature, user story, or requirement...",rows:3,value:t,onChange:r=>l(r.target.value),onKeyDown:v}),e.jsxs("div",{className:"flex items-center px-[var(--spacing-3)] pb-[var(--spacing-2)] gap-[var(--spacing-1)]",children:[e.jsx("div",{className:"flex gap-[1px] bg-bg-secondary rounded-[var(--radius-default)] p-[2px]",children:H.map(r=>e.jsx("button",{type:"button",className:`text-[length:var(--font-size-xs)] font-medium px-[var(--spacing-2-5)] py-[3px] rounded-[var(--radius-sm)] transition-all duration-[var(--duration-fast)] ${s===r.value?"bg-bg-card text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,onClick:()=>c(r.value),children:r.label},r.value))}),e.jsx("div",{className:"flex gap-[1px] bg-bg-secondary rounded-[var(--radius-default)] p-[2px] ml-[var(--spacing-1)]",children:["sdk","cli"].map(r=>e.jsx("button",{type:"button",className:`text-[length:var(--font-size-xs)] font-medium px-[var(--spacing-2)] py-[3px] rounded-[var(--radius-sm)] transition-all duration-[var(--duration-fast)] ${o===r?"bg-bg-card text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,onClick:()=>p(r),children:r==="sdk"?"SDK":"CLI"},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1)] text-[length:var(--font-size-xs)] font-semibold px-[var(--spacing-4)] py-[5px] rounded-[var(--radius-default)] bg-text-primary text-text-inverse hover:opacity-85 transition-opacity duration-[var(--duration-fast)] disabled:opacity-[var(--opacity-disabled)]",disabled:!t.trim()||i,onClick:m,children:[a?e.jsx(b,{size:13,strokeWidth:2}):e.jsx(E,{size:13,strokeWidth:2}),i?"Expanding...":a?"Continue":"Expand"]})]})]}),e.jsxs("div",{className:"flex gap-[var(--spacing-2-5)] px-[var(--spacing-1)] mt-[var(--spacing-1-5)] text-[length:10px] text-text-placeholder",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"font-mono text-[10px] px-[5px] py-[1px] border border-border-divider rounded-[3px] bg-bg-secondary",children:"Ctrl+Enter"})," ","expand"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"font-mono text-[10px] px-[5px] py-[1px] border border-border-divider rounded-[3px] bg-bg-secondary",children:"Tab"})," ","depth"]})]})]})}function B(){const{history:t,currentRequirement:l,loadHistory:s}=h(y(i=>({history:i.history,currentRequirement:i.currentRequirement,loadHistory:i.loadHistory})));if(t.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center px-[var(--spacing-5)]",children:e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-placeholder text-center",children:"No expansion history yet"})});const c=new Date,o=[],p=[],d=[];for(const i of t){const a=new Date(i.createdAt);a.getDate()===c.getDate()&&a.getMonth()===c.getMonth()&&a.getFullYear()===c.getFullYear()?p.push(i):d.push(i)}return p.length&&o.push({label:"Today",items:p}),d.length&&o.push({label:"Earlier",items:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[var(--spacing-5)] mt-[var(--spacing-5)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] text-[length:10px] font-semibold text-text-tertiary uppercase tracking-[0.06em] mb-[var(--spacing-2)]",children:[e.jsx(R,{size:12,strokeWidth:2}),"History"]}),e.jsx("div",{className:"flex flex-col gap-[2px]",children:o.map(i=>e.jsxs("div",{children:[o.length>1&&e.jsx("div",{className:"text-[length:10px] text-text-placeholder px-[var(--spacing-2-5)] py-[var(--spacing-1)] mt-[var(--spacing-1)]",children:i.label}),i.items.map(a=>{const x=(l==null?void 0:l.id)===a.id;return e.jsxs("button",{type:"button",className:`w-full text-left flex items-center gap-[var(--spacing-3)] px-[var(--spacing-2-5)] py-[var(--spacing-2)] rounded-[var(--radius-md)] transition-all duration-[var(--duration-normal)] ${x?"bg-bg-active":"hover:bg-bg-hover"}`,onClick:()=>s(a.id),children:[e.jsx("span",{className:`inline-block w-[8px] h-[8px] rounded-full shrink-0 ${A[a.status]??"bg-text-tertiary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-semibold truncate text-text-primary",children:a.title||a.userInput.substring(0,50)}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mt-[2px]",children:[a.status==="done"&&e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]",children:"done"}),a.status==="failed"&&e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-blocked)] text-[var(--color-accent-red)]",children:"failed"}),a.items.length>0&&e.jsxs("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",children:[a.items.length," items"]}),e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",children:a.depth})]})]}),e.jsx("span",{className:"text-[10px] text-text-placeholder shrink-0",children:U(a.createdAt)})]},a.id)})]},i.label))})]})}function U(t){const l=Date.now()-new Date(t).getTime(),s=Math.floor(l/6e4);if(s<1)return"now";if(s<60)return`${s}m`;const c=Math.floor(s/60);return c<24?`${c}h`:`${Math.floor(c/24)}d`}function Y(){const{currentRequirement:t,isLoading:l,error:s,progressMessage:c}=h(y(p=>({currentRequirement:p.currentRequirement,isLoading:p.isLoading,error:p.error,progressMessage:p.progressMessage}))),o=t==null?void 0:t.status;return t?o==="expanding"||o==="committing"?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-5)]",children:[e.jsxs("div",{className:"relative w-12 h-12",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-bg-tertiary"}),e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-transparent animate-spin",style:{borderTopColor:o==="expanding"?"var(--color-accent-blue)":"var(--color-accent-orange)"}})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary",children:o==="expanding"?"Expanding requirement":"Committing"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[var(--spacing-1)]",children:c||(o==="expanding"?"Analyzing and structuring...":"Creating issues...")})]})]}):o==="failed"?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-4)]",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[var(--color-tint-blocked)] flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-red)",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),e.jsxs("div",{className:"text-center max-w-sm",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary",children:"Expansion Failed"}),(s??t.error)&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-[var(--spacing-2)] leading-relaxed",children:s??t.error})]})]}):e.jsx(G,{}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-4)] text-text-placeholder",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("polyline",{points:"10 9 9 9 8 9"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-secondary",children:"No expansion yet"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[var(--spacing-1)]",children:"Enter a requirement and click Expand to generate a structured checklist"})]})]})}function G(){const[t,l]=g.useState(""),{currentRequirement:s,refine:c,commit:o,updateItem:p,isLoading:d,committedResult:i,resetRequirement:a,setContinueFrom:x}=h(y(n=>({currentRequirement:n.currentRequirement,refine:n.refine,commit:n.commit,updateItem:n.updateItem,isLoading:n.isLoading,committedResult:n.committedResult,resetRequirement:n.resetRequirement,setContinueFrom:n.setContinueFrom}))),m=g.useCallback(()=>{const n=t.trim();n&&(c(n),l(""))},[t,c]);if(!s)return null;const v=s.status==="done",r=s.items,j=Z(r);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-[var(--spacing-5)] py-[var(--spacing-4)] border-b border-border-divider shrink-0",children:e.jsx("div",{className:"flex items-start gap-[var(--spacing-3)]",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-[length:var(--font-size-md)] font-bold text-text-primary truncate",children:s.title||"Expanded Requirement"}),s.summary&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-secondary leading-relaxed mt-[var(--spacing-1)] line-clamp-2",children:s.summary}),e.jsxs("div",{className:"flex gap-[var(--spacing-2)] mt-[var(--spacing-2)]",children:[e.jsxs("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",children:[r.length," items"]}),e.jsxs("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",children:[r.filter(n=>n.dependencies.length>0).length," deps"]}),e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-verifying)] text-[var(--color-accent-orange)]",children:s.depth}),v&&e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]",children:i?`committed · ${i.mode}`:"done"})]})]})})}),j.length>1&&e.jsxs("div",{className:"px-[var(--spacing-5)] py-[var(--spacing-3)] border-b border-border-divider bg-bg-secondary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[var(--spacing-2)]",children:[e.jsx(L,{size:12,strokeWidth:2}),"Dependency Flow"]}),e.jsx("div",{className:"flex items-center gap-[var(--spacing-1)] overflow-x-auto pb-[var(--spacing-1)]",children:j.map((n,u)=>e.jsxs("span",{className:"flex items-center gap-[var(--spacing-1)] shrink-0",children:[u>0&&e.jsx(F,{size:10,className:"text-text-placeholder"}),e.jsxs("span",{className:`text-[10px] font-semibold px-[var(--spacing-2-5)] py-[3px] rounded-[var(--radius-sm)] whitespace-nowrap ${w[u%w.length]}`,children:[u+1,". ",n]})]},u))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[28px]",children:"#"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1]",children:"Item"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[68px]",children:"Type"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[88px]",children:"Priority"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[52px]",children:"Effort"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[76px]",children:"Deps"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[56px]"})]})}),e.jsx("tbody",{children:r.map((n,u)=>e.jsx(V,{item:n,index:u,items:r,disabled:v,onUpdate:z=>p(n.id,z)},n.id))})]})}),!v&&e.jsxs("div",{className:"flex gap-[var(--spacing-2)] px-[var(--spacing-5)] py-[var(--spacing-3)] border-t border-border-divider bg-bg-primary shrink-0",children:[e.jsx("textarea",{className:"flex-1 border border-border rounded-[var(--radius-md)] px-[var(--spacing-3-5)] py-[var(--spacing-2)] text-[length:var(--font-size-sm)] text-text-primary bg-bg-card outline-none resize-none placeholder:text-text-placeholder focus:border-[var(--color-accent-purple)] transition-colors duration-[var(--duration-normal)]",rows:1,placeholder:"Provide feedback to refine this expansion...",value:t,onChange:n=>l(n.target.value),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),m())}}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] shrink-0 px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:!t.trim()||d,onClick:m,children:[e.jsx(D,{size:14,strokeWidth:1.8}),"Refine"]})]}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-5)] py-[var(--spacing-3)] border-t border-border bg-bg-primary shrink-0",children:[v?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)]",onClick:a,children:[e.jsx(P,{size:14,strokeWidth:1.8}),"New Requirement"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-[var(--color-accent-purple)]/20 text-[var(--color-accent-purple)] text-[length:var(--font-size-xs)] font-semibold hover:bg-[var(--color-tint-planning)] transition-all duration-[var(--duration-normal)]",onClick:()=>x(s),title:"Use this expansion as context for further planning",children:[e.jsx(b,{size:14,strokeWidth:1.8}),"Continue Planning"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] bg-accent-green text-text-inverse text-[length:var(--font-size-xs)] font-semibold hover:opacity-85 transition-opacity duration-[var(--duration-fast)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>o("issues"),children:[e.jsx(S,{size:14,strokeWidth:1.8}),"Commit as Issues"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>o("coordinate"),children:[e.jsx(T,{size:14,strokeWidth:1.8}),"Coordinate"]}),e.jsx("div",{className:"w-px h-[20px] bg-border-divider mx-[var(--spacing-1)]"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-[var(--color-accent-purple)]/20 text-[var(--color-accent-purple)] text-[length:var(--font-size-xs)] font-semibold hover:bg-[var(--color-tint-planning)] transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>x(s),title:"Use this expansion as context for further planning",children:[e.jsx(b,{size:14,strokeWidth:1.8}),"Continue"]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:[r.length," items · ",s.depth]})]})]})}function V({item:t,index:l,items:s,disabled:c,onUpdate:o}){const p=t.dependencies.map(d=>{const i=s.findIndex(a=>a.id===d);return i>=0?`#${i+1}`:null}).filter(Boolean);return e.jsxs("tr",{className:"transition-colors duration-[var(--duration-normal)] hover:bg-bg-hover",children:[e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top text-[length:var(--font-size-xs)] font-semibold text-text-placeholder text-center",children:l+1}),e.jsxs("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:[e.jsx("div",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary leading-tight",children:t.title}),e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[2px] leading-snug",children:t.description})]}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsx("span",{className:`inline-flex text-[9px] font-semibold px-[7px] py-[2px] rounded-full uppercase tracking-[0.03em] ${N[t.type]??N.task}`,children:t.type})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",children:[e.jsx("span",{className:`inline-block w-[6px] h-[6px] rounded-full ${k[t.priority]??k.medium}`}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary capitalize",children:t.priority})]})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2)] py-[2px] rounded-[var(--radius-sm)] bg-bg-secondary text-text-secondary",children:O[t.estimated_effort]??t.estimated_effort??"—"})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:p.length>0?e.jsx("div",{className:"flex flex-wrap gap-[3px]",children:p.map(d=>e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-[var(--radius-sm)] bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)] cursor-pointer hover:bg-[var(--color-accent-purple)] hover:text-white transition-colors duration-[var(--duration-fast)]",children:d},d))}):e.jsx("span",{className:"text-[10px] text-text-placeholder",children:"—"})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:!c&&e.jsxs("div",{className:"flex gap-[2px]",children:[e.jsx("button",{type:"button",className:"w-[26px] h-[26px] rounded-[var(--radius-default)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-normal)]",title:"Edit",children:e.jsx($,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"w-[26px] h-[26px] rounded-[var(--radius-default)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-normal)]",title:"Remove",children:e.jsx(_,{size:14,strokeWidth:1.8})})]})})]})}const w=["bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]","bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]","bg-[var(--color-tint-verifying)] text-[var(--color-accent-orange)]","bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]"];function Z(t){return t.length===0?[]:t.map(l=>{const s=l.title.split(/\s+/);return s.length>3?s.slice(0,3).join(" "):l.title})}function ae(){const t=h(l=>l.fetchHistory);return g.useEffect(()=>{t()},[t]),e.jsxs("div",{className:"h-full flex",children:[e.jsxs("div",{className:"w-[40%] shrink-0 border-r border-border flex flex-col overflow-hidden bg-bg-primary",children:[e.jsx(K,{}),e.jsx(B,{})]}),e.jsx("div",{className:"w-[60%] flex flex-col overflow-hidden bg-bg-primary",children:e.jsx(Y,{})})]})}export{ae as RequirementPage};
|
|
21
|
+
*/const I=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],W=h("pencil",I);/**
|
|
22
|
+
* @license lucide-react v0.577.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const P=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],H=h("rotate-ccw",P),A=[{value:"high-level",label:"High-level",desc:"3-5 epics"},{value:"standard",label:"Standard",desc:"5-10 tasks"},{value:"atomic",label:"Atomic",desc:"10-20 steps"}],O={done:"bg-accent-green",failed:"bg-accent-red",reviewing:"bg-accent-orange",expanding:"bg-accent-blue",committing:"bg-accent-orange",draft:"bg-text-tertiary"},N={feature:"bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",task:"bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",bug:"bg-[var(--color-tint-blocked)] text-[var(--color-accent-red)]",improvement:"bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]"},k={urgent:"bg-accent-red",high:"bg-accent-orange",medium:"bg-accent-yellow",low:"bg-text-placeholder"},K={small:"S",medium:"M",large:"L","1h":"1h","2h":"2h","4h":"4h","1d":"1d","2d":"2d","1w":"1w"};function B(){const[t,l]=g.useState(""),[s,c]=g.useState("standard"),[o,p]=g.useState("sdk"),{expand:d,isLoading:i,continueFrom:a,setContinueFrom:x}=b(y(r=>({expand:r.expand,isLoading:r.isLoading,continueFrom:r.continueFrom,setContinueFrom:r.setContinueFrom}))),m=g.useCallback(()=>{const r=t.trim();!r||i||d(r,s,o)},[t,s,o,d,i]),v=g.useCallback(r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),m())},[m]);return e.jsxs("div",{className:"px-[var(--spacing-5)] pt-[var(--spacing-6)] shrink-0",children:[e.jsx("h1",{className:"text-[length:var(--font-size-xl)] font-bold text-text-primary mb-[var(--spacing-1)]",style:{fontFamily:"var(--style-heading-font)",letterSpacing:"var(--style-heading-letter-spacing)"},children:"Expand requirements"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mb-[var(--spacing-4)]",children:"Natural language to structured decomposition"}),e.jsxs("div",{className:`bg-bg-card border rounded-[var(--style-composer-radius)] shadow-sm transition-all duration-[var(--duration-normal)] focus-within:shadow-[0_2px_10px_rgba(0,0,0,0.03),0_0_0_3px_rgba(200,134,58,0.08)] ${a?"border-[var(--color-accent-purple)] focus-within:border-[var(--color-accent-purple)]":"border-border focus-within:border-[var(--color-accent-orange)]"}`,children:[a&&e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-3)] pt-[var(--spacing-2-5)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] flex-1 min-w-0 px-[var(--spacing-2-5)] py-[var(--spacing-1-5)] rounded-[var(--radius-default)] bg-[var(--color-tint-planning)]",children:[e.jsx(f,{size:12,strokeWidth:2,className:"text-[var(--color-accent-purple)] shrink-0"}),e.jsx("span",{className:"text-[10px] font-semibold text-[var(--color-accent-purple)] shrink-0",children:"Continue from"}),e.jsx("span",{className:"text-[10px] font-medium text-text-secondary truncate",children:a.title||a.userInput.substring(0,40)}),e.jsxs("span",{className:"text-[9px] text-text-placeholder shrink-0",children:[a.items.length," items"]})]}),e.jsx("button",{type:"button",className:"w-[20px] h-[20px] rounded-[var(--radius-sm)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-fast)] shrink-0",onClick:()=>x(null),title:"Dismiss context",children:e.jsx(C,{size:12,strokeWidth:2})})]}),e.jsx("textarea",{className:"w-full border-none bg-transparent resize-none outline-none text-text-primary leading-relaxed font-sans",style:{fontSize:"var(--style-composer-textarea-size)",padding:"var(--style-composer-padding)",paddingBottom:"var(--spacing-2)",paddingTop:a?"var(--spacing-2)":void 0},placeholder:a?"Describe additional requirements to build upon...":"Describe a feature, user story, or requirement...",rows:3,value:t,onChange:r=>l(r.target.value),onKeyDown:v}),e.jsxs("div",{className:"flex items-center px-[var(--spacing-3)] pb-[var(--spacing-2)] gap-[var(--spacing-1)]",children:[e.jsx("div",{className:"flex gap-[1px] bg-bg-secondary rounded-[var(--radius-default)] p-[2px]",children:A.map(r=>e.jsx("button",{type:"button",className:`text-[length:var(--font-size-xs)] font-medium px-[var(--spacing-2-5)] py-[3px] rounded-[var(--radius-sm)] transition-all duration-[var(--duration-fast)] ${s===r.value?"bg-bg-card text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,onClick:()=>c(r.value),children:r.label},r.value))}),e.jsx("div",{className:"flex gap-[1px] bg-bg-secondary rounded-[var(--radius-default)] p-[2px] ml-[var(--spacing-1)]",children:["sdk","cli"].map(r=>e.jsx("button",{type:"button",className:`text-[length:var(--font-size-xs)] font-medium px-[var(--spacing-2)] py-[3px] rounded-[var(--radius-sm)] transition-all duration-[var(--duration-fast)] ${o===r?"bg-bg-card text-text-primary shadow-sm":"text-text-tertiary hover:text-text-secondary"}`,onClick:()=>p(r),children:r==="sdk"?"SDK":"CLI"},r))}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1)] text-[length:var(--font-size-xs)] font-semibold px-[var(--spacing-4)] py-[5px] rounded-[var(--radius-default)] bg-text-primary text-text-inverse hover:opacity-85 transition-opacity duration-[var(--duration-fast)] disabled:opacity-[var(--opacity-disabled)]",disabled:!t.trim()||i,onClick:m,children:[a?e.jsx(f,{size:13,strokeWidth:2}):e.jsx(D,{size:13,strokeWidth:2}),i?"Expanding...":a?"Continue":"Expand"]})]})]}),e.jsxs("div",{className:"flex gap-[var(--spacing-2-5)] px-[var(--spacing-1)] mt-[var(--spacing-1-5)] text-[length:10px] text-text-placeholder",children:[e.jsxs("span",{children:[e.jsx("kbd",{className:"font-mono text-[10px] px-[5px] py-[1px] border border-border-divider rounded-[3px] bg-bg-secondary",children:"Ctrl+Enter"})," ","expand"]}),e.jsxs("span",{children:[e.jsx("kbd",{className:"font-mono text-[10px] px-[5px] py-[1px] border border-border-divider rounded-[3px] bg-bg-secondary",children:"Tab"})," ","depth"]})]})]})}function Y(){const{history:t,currentRequirement:l,loadHistory:s}=b(y(i=>({history:i.history,currentRequirement:i.currentRequirement,loadHistory:i.loadHistory})));if(t.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center px-[var(--spacing-5)]",children:e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-placeholder text-center",children:"No expansion history yet"})});const c=new Date,o=[],p=[],d=[];for(const i of t){const a=new Date(i.createdAt);a.getDate()===c.getDate()&&a.getMonth()===c.getMonth()&&a.getFullYear()===c.getFullYear()?p.push(i):d.push(i)}return p.length&&o.push({label:"Today",items:p}),d.length&&o.push({label:"Earlier",items:d}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-[var(--spacing-5)] mt-[var(--spacing-5)]",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] text-[length:10px] font-semibold text-text-tertiary uppercase tracking-[0.06em] mb-[var(--spacing-2)]",children:[e.jsx(R,{size:12,strokeWidth:2}),"History"]}),e.jsx("div",{className:"flex flex-col gap-[2px]",children:o.map(i=>e.jsxs("div",{children:[o.length>1&&e.jsx("div",{className:"text-[length:10px] text-text-placeholder px-[var(--spacing-2-5)] py-[var(--spacing-1)] mt-[var(--spacing-1)]",children:i.label}),i.items.map(a=>{const x=(l==null?void 0:l.id)===a.id;return e.jsxs("button",{type:"button",className:`w-full text-left flex items-center gap-[var(--spacing-3)] px-[var(--spacing-2-5)] py-[var(--spacing-2)] rounded-[var(--radius-md)] transition-all duration-[var(--duration-normal)] ${x?"bg-bg-active":"hover:bg-bg-hover"}`,onClick:()=>s(a.id),children:[e.jsx("span",{className:`inline-block w-[8px] h-[8px] rounded-full shrink-0 ${O[a.status]??"bg-text-tertiary"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[length:var(--font-size-xs)] font-semibold truncate text-text-primary",children:a.title||a.userInput.substring(0,50)}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] mt-[2px]",children:[a.status==="done"&&e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]",children:"done"}),a.status==="failed"&&e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-blocked)] text-[var(--color-accent-red)]",children:"failed"}),a.items.length>0&&e.jsxs("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",children:[a.items.length," items"]}),e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-full bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",children:a.depth})]})]}),e.jsx("span",{className:"text-[10px] text-text-placeholder shrink-0",children:U(a.createdAt)})]},a.id)})]},i.label))})]})}function U(t){const l=Date.now()-new Date(t).getTime(),s=Math.floor(l/6e4);if(s<1)return"now";if(s<60)return`${s}m`;const c=Math.floor(s/60);return c<24?`${c}h`:`${Math.floor(c/24)}d`}function V(){const{currentRequirement:t,isLoading:l,error:s,progressMessage:c}=b(y(p=>({currentRequirement:p.currentRequirement,isLoading:p.isLoading,error:p.error,progressMessage:p.progressMessage}))),o=t==null?void 0:t.status;return t?o==="expanding"||o==="committing"?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-5)]",children:[e.jsxs("div",{className:"relative w-12 h-12",children:[e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-bg-tertiary"}),e.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-transparent animate-spin",style:{borderTopColor:o==="expanding"?"var(--color-accent-blue)":"var(--color-accent-orange)"}})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary",children:o==="expanding"?"Expanding requirement":"Committing"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[var(--spacing-1)]",children:c||(o==="expanding"?"Analyzing and structuring...":"Creating issues...")})]})]}):o==="failed"?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-4)]",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-[var(--color-tint-blocked)] flex items-center justify-center",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-accent-red)",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),e.jsxs("div",{className:"text-center max-w-sm",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-primary",children:"Expansion Failed"}),(s??t.error)&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-accent-red mt-[var(--spacing-2)] leading-relaxed",children:s??t.error})]})]}):e.jsx(Z,{}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-[var(--spacing-4)] text-text-placeholder",children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("polyline",{points:"10 9 9 9 8 9"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[length:var(--font-size-sm)] font-medium text-text-secondary",children:"No expansion yet"}),e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[var(--spacing-1)]",children:"Enter a requirement and click Expand to generate a structured checklist"})]})]})}function Z(){const[t,l]=g.useState(""),{currentRequirement:s,refine:c,commit:o,updateItem:p,isLoading:d,committedResult:i,resetRequirement:a,setContinueFrom:x}=b(y(n=>({currentRequirement:n.currentRequirement,refine:n.refine,commit:n.commit,updateItem:n.updateItem,isLoading:n.isLoading,committedResult:n.committedResult,resetRequirement:n.resetRequirement,setContinueFrom:n.setContinueFrom}))),m=g.useCallback(()=>{const n=t.trim();n&&(c(n),l(""))},[t,c]);if(!s)return null;const v=s.status==="done",r=s.items,j=Q(r);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-[var(--spacing-5)] py-[var(--spacing-4)] border-b border-border-divider shrink-0",children:e.jsx("div",{className:"flex items-start gap-[var(--spacing-3)]",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-[length:var(--font-size-md)] font-bold text-text-primary truncate",children:s.title||"Expanded Requirement"}),s.summary&&e.jsx("p",{className:"text-[length:var(--font-size-xs)] text-text-secondary leading-relaxed mt-[var(--spacing-1)] line-clamp-2",children:s.summary}),e.jsxs("div",{className:"flex gap-[var(--spacing-2)] mt-[var(--spacing-2)]",children:[e.jsxs("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]",children:[r.length," items"]}),e.jsxs("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]",children:[r.filter(n=>n.dependencies.length>0).length," deps"]}),e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-verifying)] text-[var(--color-accent-orange)]",children:s.depth}),v&&e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2-5)] py-[2px] rounded-full bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]",children:i?`committed · ${i.mode}`:"done"})]})]})})}),j.length>1&&e.jsxs("div",{className:"px-[var(--spacing-5)] py-[var(--spacing-3)] border-b border-border-divider bg-bg-secondary shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1-5)] text-[10px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[var(--spacing-2)]",children:[e.jsx($,{size:12,strokeWidth:2}),"Dependency Flow"]}),e.jsx("div",{className:"flex items-center gap-[var(--spacing-1)] overflow-x-auto pb-[var(--spacing-1)]",children:j.map((n,u)=>e.jsxs("span",{className:"flex items-center gap-[var(--spacing-1)] shrink-0",children:[u>0&&e.jsx(T,{size:10,className:"text-text-placeholder"}),e.jsxs("span",{className:`text-[10px] font-semibold px-[var(--spacing-2-5)] py-[3px] rounded-[var(--radius-sm)] whitespace-nowrap ${w[u%w.length]}`,children:[u+1,". ",n]})]},u))})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[28px]",children:"#"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1]",children:"Item"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[68px]",children:"Type"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[88px]",children:"Priority"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[52px]",children:"Effort"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[76px]",children:"Deps"}),e.jsx("th",{className:"text-[10px] font-semibold uppercase tracking-[0.04em] text-text-tertiary text-left px-[var(--spacing-3-5)] py-[var(--spacing-2-5)] border-b border-border-divider bg-bg-primary sticky top-0 z-[1] w-[56px]"})]})}),e.jsx("tbody",{children:r.map((n,u)=>e.jsx(G,{item:n,index:u,items:r,disabled:v,onUpdate:z=>p(n.id,z)},n.id))})]})}),!v&&e.jsxs("div",{className:"flex gap-[var(--spacing-2)] px-[var(--spacing-5)] py-[var(--spacing-3)] border-t border-border-divider bg-bg-primary shrink-0",children:[e.jsx("textarea",{className:"flex-1 border border-border rounded-[var(--radius-md)] px-[var(--spacing-3-5)] py-[var(--spacing-2)] text-[length:var(--font-size-sm)] text-text-primary bg-bg-card outline-none resize-none placeholder:text-text-placeholder focus:border-[var(--color-accent-purple)] transition-colors duration-[var(--duration-normal)]",rows:1,placeholder:"Provide feedback to refine this expansion...",value:t,onChange:n=>l(n.target.value),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),m())}}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] shrink-0 px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:!t.trim()||d,onClick:m,children:[e.jsx(_,{size:14,strokeWidth:1.8}),"Refine"]})]}),e.jsxs("div",{className:"flex items-center gap-[var(--spacing-2)] px-[var(--spacing-5)] py-[var(--spacing-3)] border-t border-border bg-bg-primary shrink-0",children:[v?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)]",onClick:a,children:[e.jsx(H,{size:14,strokeWidth:1.8}),"New Requirement"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-[var(--color-accent-purple)]/20 text-[var(--color-accent-purple)] text-[length:var(--font-size-xs)] font-semibold hover:bg-[var(--color-tint-planning)] transition-all duration-[var(--duration-normal)]",onClick:()=>x(s),title:"Use this expansion as context for further planning",children:[e.jsx(f,{size:14,strokeWidth:1.8}),"Continue Planning"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] bg-accent-green text-text-inverse text-[length:var(--font-size-xs)] font-semibold hover:opacity-85 transition-opacity duration-[var(--duration-fast)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>o("issues"),children:[e.jsx(F,{size:14,strokeWidth:1.8}),"Commit as Issues"]}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-4)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-border text-text-secondary text-[length:var(--font-size-xs)] font-semibold hover:text-text-primary hover:bg-bg-hover transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>o("coordinate"),children:[e.jsx(L,{size:14,strokeWidth:1.8}),"Coordinate"]}),e.jsx("div",{className:"w-px h-[20px] bg-border-divider mx-[var(--spacing-1)]"}),e.jsxs("button",{type:"button",className:"flex items-center gap-[var(--spacing-1-5)] px-[var(--spacing-3)] py-[var(--spacing-2)] rounded-[var(--radius-md)] border border-[var(--color-accent-purple)]/20 text-[var(--color-accent-purple)] text-[length:var(--font-size-xs)] font-semibold hover:bg-[var(--color-tint-planning)] transition-all duration-[var(--duration-normal)] disabled:opacity-[var(--opacity-disabled)]",disabled:d,onClick:()=>x(s),title:"Use this expansion as context for further planning",children:[e.jsx(f,{size:14,strokeWidth:1.8}),"Continue"]})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-[10px] text-text-tertiary",children:[r.length," items · ",s.depth]})]})]})}function G({item:t,index:l,items:s,disabled:c,onUpdate:o}){const p=t.dependencies.map(d=>{const i=s.findIndex(a=>a.id===d);return i>=0?`#${i+1}`:null}).filter(Boolean);return e.jsxs("tr",{className:"transition-colors duration-[var(--duration-normal)] hover:bg-bg-hover",children:[e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top text-[length:var(--font-size-xs)] font-semibold text-text-placeholder text-center",children:l+1}),e.jsxs("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:[e.jsx("div",{className:"text-[length:var(--font-size-sm)] font-semibold text-text-primary leading-tight",children:t.title}),e.jsx("div",{className:"text-[length:var(--font-size-xs)] text-text-tertiary mt-[2px] leading-snug",children:t.description})]}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsx("span",{className:`inline-flex text-[9px] font-semibold px-[7px] py-[2px] rounded-full uppercase tracking-[0.03em] ${N[t.type]??N.task}`,children:t.type})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsxs("div",{className:"flex items-center gap-[var(--spacing-1)]",children:[e.jsx("span",{className:`inline-block w-[6px] h-[6px] rounded-full ${k[t.priority]??k.medium}`}),e.jsx("span",{className:"text-[length:var(--font-size-xs)] text-text-secondary capitalize",children:t.priority})]})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:e.jsx("span",{className:"text-[10px] font-semibold px-[var(--spacing-2)] py-[2px] rounded-[var(--radius-sm)] bg-bg-secondary text-text-secondary",children:K[t.estimated_effort]??t.estimated_effort??"—"})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:p.length>0?e.jsx("div",{className:"flex flex-wrap gap-[3px]",children:p.map(d=>e.jsx("span",{className:"text-[9px] font-semibold px-[6px] py-[1px] rounded-[var(--radius-sm)] bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)] cursor-pointer hover:bg-[var(--color-accent-purple)] hover:text-white transition-colors duration-[var(--duration-fast)]",children:d},d))}):e.jsx("span",{className:"text-[10px] text-text-placeholder",children:"—"})}),e.jsx("td",{className:"px-[var(--spacing-3-5)] py-[var(--spacing-3)] border-b border-border-divider align-top",children:!c&&e.jsxs("div",{className:"flex gap-[2px]",children:[e.jsx("button",{type:"button",className:"w-[26px] h-[26px] rounded-[var(--radius-default)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-normal)]",title:"Edit",children:e.jsx(W,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",className:"w-[26px] h-[26px] rounded-[var(--radius-default)] flex items-center justify-center text-text-placeholder hover:bg-bg-hover hover:text-text-primary transition-all duration-[var(--duration-normal)]",title:"Remove",children:e.jsx(E,{size:14,strokeWidth:1.8})})]})})]})}const w=["bg-[var(--color-tint-exploring)] text-[var(--color-accent-blue)]","bg-[var(--color-tint-planning)] text-[var(--color-accent-purple)]","bg-[var(--color-tint-verifying)] text-[var(--color-accent-orange)]","bg-[var(--color-tint-completed)] text-[var(--color-accent-green)]"];function Q(t){return t.length===0?[]:t.map(l=>{const s=l.title.split(/\s+/);return s.length>3?s.slice(0,3).join(" "):l.title})}function ae(){const t=b(l=>l.fetchHistory);return g.useEffect(()=>{t()},[t]),e.jsxs("div",{className:"h-full flex",children:[e.jsxs("div",{className:"w-[40%] shrink-0 border-r border-border flex flex-col overflow-hidden bg-bg-primary",children:[e.jsx(B,{}),e.jsx(Y,{})]}),e.jsx("div",{className:"w-[60%] flex flex-col overflow-hidden bg-bg-primary",children:e.jsx(V,{})})]})}export{ae as RequirementPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as A,o as ie,
|
|
1
|
+
import{d as A,o as ie,K as F,r as p,j as e,D as Y,N as le,F as U,Q as ce,X as de,R as xe,P as pe,O as be,f as ue,T as me,h as O,i as B,V as ge}from"./index-DWG-WrzT.js";import{u as fe}from"./shallow-Bme1JY57.js";import{C as ye}from"./columns-3-38xIDlzy.js";import{L as he}from"./list-CgIP_2A-.js";import{S as ve}from"./search-SieXnOgr.js";import{C as J}from"./circle-CMrkbRNg.js";import{m as L}from"./proxy-BKxDAKTj.js";import{C as we}from"./circle-alert-c3tH1P4z.js";import{T as Q}from"./trash-2-C8f4vFFM.js";import{P as X}from"./pen-line-Bh_WKYHm.js";import{C as je}from"./check-u6fGOwQO.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -33,4 +33,4 @@ import{d as A,o as ie,H as F,r as p,j as e,w as Y,q as le,F as U,J as ce,X as de
|
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const _e=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ee=A("tag",_e),f=ie((r,c)=>({entries:[],files:[],loading:!1,error:null,activeView:"kanban",typeFilter:"all",categoryFilter:"all",keywordFilter:"all",search:"",selectedEntry:null,hiddenColumns:new Set,setActiveView:o=>r({activeView:o}),setTypeFilter:o=>r({typeFilter:o}),setCategoryFilter:o=>r({categoryFilter:o}),setKeywordFilter:o=>r({keywordFilter:o}),setSearch:o=>r({search:o}),setSelectedEntry:o=>r({selectedEntry:o}),toggleColumn:o=>r(a=>{const n=new Set(a.hiddenColumns);return n.has(o)?n.delete(o):n.add(o),{hiddenColumns:n}}),fetchEntries:async()=>{r({loading:!0,error:null});try{const o=await fetch(F.SPECS);if(!o.ok)throw new Error(`Failed: ${o.status}`);const a=await o.json();r({entries:a.entries??[],loading:!1})}catch(o){r({loading:!1,error:String(o)})}},fetchFiles:async()=>{try{const o=await fetch(F.SPECS_FILES);if(!o.ok)return;const a=await o.json();r({files:a.files??[]})}catch{}},addEntry:async(o,a,n)=>{r({error:null});try{const d=await fetch(F.SPECS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:o,content:a,file:n})});if(!d.ok){const g=await d.json().catch(()=>({error:`HTTP ${d.status}`}));throw new Error(g.error)}return c().fetchEntries(),null}catch(d){return r({error:String(d)}),null}},deleteEntry:async o=>{r({error:null});const a=c().entries;r(n=>({entries:n.entries.filter(d=>d.id!==o)}));try{(await fetch(`${F.SPECS}/${o}`,{method:"DELETE"})).ok||r({entries:a})}catch{r({entries:a})}},filteredEntries:()=>{const{entries:o,typeFilter:a,categoryFilter:n,keywordFilter:d,search:g}=c();let y=o;if(a!=="all"&&(y=y.filter(u=>u.type===a)),n!=="all"&&(y=y.filter(u=>u.category===n)),d!=="all"&&(y=y.filter(u=>u.keywords.includes(d))),g){const u=g.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(u)||h.content.toLowerCase().includes(u)||h.id.toLowerCase().includes(u)||h.keywords.some(v=>v.toLowerCase().includes(u)))}return y},entriesByType:()=>{const o=c().filteredEntries(),a={bug:[],pattern:[],decision:[],rule:[],debug:[],test:[],review:[],validation:[],general:[]};for(const n of o)(a[n.type]??a.general).push(n);return a},typeCounts:()=>{const{entries:o}=c(),a={all:o.length,bug:0,pattern:0,decision:0,rule:0,debug:0,test:0,review:0,validation:0,general:0};for(const n of o)a[n.type]=(a[n.type]??0)+1;return a},allCategories:()=>{const{entries:o}=c(),a=new Set;for(const n of o)n.category&&a.add(n.category);return Array.from(a).sort()},allKeywords:()=>{const{entries:o}=c(),a=new Set;for(const n of o)for(const d of n.keywords)a.add(d);return Array.from(a).sort()}})),ze={general:{label:"General",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"},planning:{label:"Planning",icon:e.jsx(Ce,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-planning)",color:"#9178B5"},execution:{label:"Execution",icon:e.jsx(Te,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-exploring)",color:"#5B8DB8"},debug:{label:"Debug",icon:e.jsx(we,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-blocked)",color:"#C46555"},test:{label:"Test",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-completed)",color:"#5A9E78"},review:{label:"Review",icon:e.jsx(ce,{size:14,strokeWidth:1.8}),tintBg:"rgba(219,176,108,0.12)",color:"#C4A055"},validation:{label:"Validation",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"rgba(90,158,120,0.10)",color:"#3D8B5F"}},Le=["general","planning","execution","debug","test","review","validation"],Me={label:"",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"};function I(r){return ze[r]??{...Me,label:r.charAt(0).toUpperCase()+r.slice(1)}}const We={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function $e(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function qe({onAddEntry:r}){const c=f(s=>s.entries),o=f(s=>s.typeFilter),a=f(s=>s.keywordFilter),n=f(s=>s.search),d=f(s=>s.selectedEntry),g=f(s=>s.setSelectedEntry),y=f(s=>s.setKeywordFilter),u=f(s=>s.hiddenColumns),h=f(s=>s.toggleColumn),v=p.useMemo(()=>{const s=new Set;for(const x of c)x.category&&s.add(x.category);const i=[];for(const x of Le)s.has(x)&&(i.push(x),s.delete(x));for(const x of Array.from(s).sort())i.push(x);return i},[c]),N=p.useMemo(()=>{const s=new Set;for(const i of c)for(const x of i.keywords)s.add(x);return Array.from(s).sort()},[c]),w=p.useMemo(()=>{let s=c;if(o!=="all"&&(s=s.filter(i=>i.type===o)),a!=="all"&&(s=s.filter(i=>i.keywords.includes(a))),n){const i=n.toLowerCase();s=s.filter(x=>x.title.toLowerCase().includes(i)||x.content.toLowerCase().includes(i)||x.id.toLowerCase().includes(i)||x.keywords.some(C=>C.toLowerCase().includes(i)))}return s},[c,o,a,n]),m=p.useMemo(()=>{const s={};for(const i of v)s[i]=[];for(const i of w){const x=i.category||"general";s[x]||(s[x]=[]),s[x].push(i)}return s},[w,v]),k=p.useMemo(()=>{const s={};for(const i of c){const x=i.category||"general";s[x]=(s[x]??0)+1}return s},[c]),S=p.useMemo(()=>v.filter(s=>!u.has(s)),[v,u]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-[6px] px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[v.map(s=>{const i=I(s),x=!u.has(s),C=k[s]??0;return e.jsxs("button",{type:"button",onClick:()=>h(s),className:["text-[11px] font-medium px-[10px] py-[4px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",x?"bg-bg-card text-text-primary border-border hover:shadow-sm":"bg-bg-secondary text-text-quaternary border-border-divider opacity-60"].join(" "),style:x?{borderColor:i.color,boxShadow:`0 0 0 1px ${i.color}22`}:void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 transition-opacity",style:{background:i.color,opacity:x?1:.35}}),i.label,e.jsx("span",{className:"text-[10px] font-mono opacity-60",children:C})]},s)}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx(ee,{size:11,strokeWidth:2,className:"text-text-quaternary shrink-0"}),N.map(s=>{const i=a===s;return e.jsx("button",{type:"button",onClick:()=>y(i?"all":s),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",i?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:s},s)})]})]}),e.jsxs("div",{className:"flex gap-3 flex-1 overflow-x-auto p-3",children:[S.map((s,i)=>{const x=I(s),C=m[s]??[];return e.jsxs("div",{className:"flex flex-col min-w-[260px] flex-1 bg-bg-secondary rounded-[12px] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[14px] py-3 border-b border-black/[0.04]",children:[e.jsx("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center shrink-0",style:{background:x.tintBg,color:x.color},children:x.icon}),e.jsx("span",{className:"text-[13px] font-bold text-text-primary",children:x.label}),e.jsx("span",{className:"text-[10px] text-text-tertiary bg-bg-card px-[6px] rounded-full font-mono",children:C.length}),e.jsx("button",{type:"button",onClick:r,className:"ml-auto w-6 h-6 rounded-[6px] border border-dashed border-border bg-transparent cursor-pointer flex items-center justify-center text-text-quaternary hover:border-text-tertiary hover:text-text-primary hover:bg-bg-card transition-all",children:e.jsx(Y,{size:12,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 flex flex-col gap-2",children:[C.map((E,D)=>e.jsx(Ve,{entry:E,selected:d===E.id,onClick:()=>g(E.id),index:i*100+D},E.id)),C.length===0&&e.jsx("div",{className:"flex items-center justify-center py-8 text-[11px] text-text-quaternary",children:"No entries"})]})]},s)}),S.length===0&&e.jsx("div",{className:"flex items-center justify-center flex-1 text-[13px] text-text-tertiary",children:"All columns hidden — click a category tag above to show it."})]})]})}function Ve({entry:r,selected:c,onClick:o,index:a}){const n=We[r.type];return e.jsxs(L.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,delay:Math.min(a*.03,.3)},onClick:o,className:["bg-bg-card rounded-[10px] px-[14px] py-3 border cursor-pointer","transition-all duration-[180ms]","hover:-translate-y-[2px] hover:shadow-[0_4px_16px_rgba(0,0,0,0.06)] hover:border-border",c?"border-[#9178B5] shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border-divider"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[6px] mb-2",children:[e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em]",style:{background:n.bg,color:n.text},children:r.type}),e.jsx("span",{className:"text-[10px] font-mono text-text-quaternary ml-auto",children:r.id})]}),e.jsx("div",{className:"text-[13px] text-text-primary font-medium leading-[1.5] mb-2 line-clamp-3",children:r.content||r.title}),r.keywords.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[r.keywords.slice(0,4).map(d=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono",children:d},d)),r.keywords.length>4&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-4]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] text-text-quaternary font-mono flex items-center gap-[3px]",children:[e.jsx(le,{size:10,strokeWidth:2}),$e(r.timestamp)]}),r.file&&e.jsxs("span",{className:"text-[10px] text-text-tertiary flex items-center gap-[3px] ml-auto",children:[e.jsx(U,{size:10,strokeWidth:2}),r.file.split("/").pop()]})]})]})}const Pe={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}},Oe={bug:"#C46555",pattern:"#5B8DB8",decision:"#9178B5",rule:"#5A9E78",debug:"#B85B4A",test:"#3D8B5F",review:"#C4A055",validation:"#4A7DA8",general:"#A09D97"},te={general:"#A09D97",planning:"#9178B5",execution:"#5B8DB8",debug:"#C46555",test:"#5A9E78",review:"#C4A055",validation:"#3D8B5F"},Re=[{value:"all",label:"All"},{value:"bug",label:"Bug"},{value:"pattern",label:"Pattern"},{value:"decision",label:"Decision"},{value:"rule",label:"Rule"},{value:"debug",label:"Debug"},{value:"test",label:"Test"},{value:"review",label:"Review"},{value:"validation",label:"Validation"},{value:"general",label:"General"}],K=[{key:"id",label:"ID",width:60},{key:"type",label:"Type",width:80},{key:"category",label:"Category",width:100},{key:"content",label:"Content",alwaysVisible:!0},{key:"keywords",label:"Keywords",width:180},{key:"file",label:"File",width:140},{key:"added",label:"Added",width:90},{key:"actions",label:"",width:80,alwaysVisible:!0}];function Ie(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function Ke(){const r=f(t=>t.entries),c=f(t=>t.typeFilter),o=f(t=>t.setTypeFilter),a=f(t=>t.categoryFilter),n=f(t=>t.setCategoryFilter),d=f(t=>t.keywordFilter),g=f(t=>t.setKeywordFilter),y=f(t=>t.search),u=f(t=>t.selectedEntry),h=f(t=>t.setSelectedEntry),v=f(t=>t.deleteEntry),N=f(t=>t.addEntry),[w,m]=p.useState("timestamp"),[k,S]=p.useState("desc"),[s,i]=p.useState(!1),[x,C]=p.useState("bug"),[E,D]=p.useState(""),[z,re]=p.useState(new Set),oe=p.useCallback(t=>{re(l=>{const b=new Set(l);return b.has(t)?b.delete(t):b.add(t),b})},[]),T=p.useMemo(()=>K.filter(t=>t.alwaysVisible||!z.has(t.key)),[z]),M=p.useMemo(()=>{const t=new Set;for(const l of r)l.category&&t.add(l.category);return Array.from(t).sort()},[r]),W=p.useMemo(()=>{const t=new Set;for(const l of r)for(const b of l.keywords)t.add(b);return Array.from(t).sort()},[r]),se=p.useMemo(()=>{const t={all:r.length,bug:0,pattern:0,decision:0,rule:0,general:0};for(const l of r)t[l.type]=(t[l.type]??0)+1;return t},[r]),ae=p.useMemo(()=>{const t={};for(const l of r){const b=l.category||"general";t[b]=(t[b]??0)+1}return t},[r]),$=p.useMemo(()=>{let t=r;if(c!=="all"&&(t=t.filter(l=>l.type===c)),a!=="all"&&(t=t.filter(l=>l.category===a)),d!=="all"&&(t=t.filter(l=>l.keywords.includes(d))),y){const l=y.toLowerCase();t=t.filter(b=>b.title.toLowerCase().includes(l)||b.content.toLowerCase().includes(l)||b.id.toLowerCase().includes(l)||b.keywords.some(j=>j.toLowerCase().includes(l)))}return t},[r,c,a,d,y]),q=p.useMemo(()=>{const t=[...$];return t.sort((l,b)=>{let j=0;return w==="timestamp"?j=new Date(l.timestamp).getTime()-new Date(b.timestamp).getTime():w==="id"?j=l.id.localeCompare(b.id):w==="type"?j=l.type.localeCompare(b.type):w==="category"&&(j=(l.category||"").localeCompare(b.category||"")),k==="desc"?-j:j}),t},[$,w,k]),V=p.useCallback(t=>{m(l=>l===t?(S(b=>b==="desc"?"asc":"desc"),l):(S("desc"),t))},[]),P=p.useCallback(async()=>{E.trim()&&(await N(x,E.trim(),"learnings.md"),D(""),i(!1))},[x,E,N]),ne=p.useCallback((t,l)=>{t.stopPropagation(),v(l)},[v]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Type"}),Re.map(t=>{const l=c===t.value;return e.jsxs("button",{type:"button",onClick:()=>o(t.value),className:["text-[11px] font-medium px-3 py-1 rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:[t.value!=="all"&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":Oe[t.value]}}),t.label,e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:se[t.value]??0})]},t.value)}),M.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Category"}),e.jsx("button",{type:"button",onClick:()=>n("all"),className:["text-[11px] font-medium px-2 py-[3px] rounded-full border cursor-pointer transition-all",a==="all"?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"All"}),M.map(t=>{const l=a===t,b=te[t]??"#A09D97";return e.jsxs("button",{type:"button",onClick:()=>n(l?"all":t),className:["text-[11px] font-medium px-[10px] py-[3px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"border-transparent text-white":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),style:l?{background:b}:void 0,children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":b}}),t.charAt(0).toUpperCase()+t.slice(1),e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:ae[t]??0})]},t)})]}),W.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:e.jsx(ee,{size:10,strokeWidth:2,className:"inline-block mr-[2px] align-middle"})}),W.map(t=>{const l=d===t;return e.jsx("button",{type:"button",onClick:()=>g(l?"all":t),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:t},t)})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-1",children:K.filter(t=>!t.alwaysVisible).map(t=>{const l=z.has(t.key);return e.jsxs("button",{type:"button",onClick:()=>oe(t.key),className:["text-[10px] font-medium px-[6px] py-[3px] rounded-[4px] border cursor-pointer transition-all","flex items-center gap-[3px]",l?"bg-bg-secondary text-text-quaternary border-border-divider opacity-50":"bg-bg-card text-text-tertiary border-border hover:text-text-primary"].join(" "),title:`${l?"Show":"Hide"} ${t.label} column`,children:[l?e.jsx(Se,{size:9,strokeWidth:2}):e.jsx(Ae,{size:9,strokeWidth:2}),t.label]},t.key)})}),e.jsx("div",{className:"w-px h-[18px] bg-border-divider"}),e.jsxs("button",{type:"button",onClick:()=>V("timestamp"),className:"text-[11px] font-medium px-[10px] py-1 rounded-[6px] border border-border bg-bg-card text-text-tertiary cursor-pointer font-sans transition-all hover:border-text-tertiary hover:text-text-primary flex items-center gap-1",children:[e.jsx(Z,{size:12,strokeWidth:2,className:k==="asc"?"rotate-180 transition-transform":"transition-transform"}),k==="desc"?"Newest":"Oldest"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{children:T.map(t=>{const b={id:"id",type:"type",category:"category",added:"timestamp"}[t.key];return e.jsx(He,{width:t.width,active:b?w===b:!1,onClick:b?()=>V(b):void 0,children:t.label},t.key)})})}),e.jsxs("tbody",{children:[s&&e.jsx("tr",{children:T.map(t=>{const l="var(--color-tint-planning)",b="rgba(145,120,181,0.3)";return t.key==="id"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("span",{className:"font-mono text-[11px] font-semibold",style:{color:"#9178B5"},children:"NEW"})},t.key):t.key==="type"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("select",{value:x,onChange:j=>C(j.target.value),className:"px-2 py-1 rounded-[6px] border border-border bg-bg-card text-[11px] text-text-primary font-sans outline-none cursor-pointer",children:[e.jsx("option",{value:"bug",children:"bug"}),e.jsx("option",{value:"pattern",children:"pattern"}),e.jsx("option",{value:"decision",children:"decision"}),e.jsx("option",{value:"rule",children:"rule"}),e.jsx("option",{value:"debug",children:"debug"}),e.jsx("option",{value:"test",children:"test"}),e.jsx("option",{value:"review",children:"review"}),e.jsx("option",{value:"validation",children:"validation"}),e.jsx("option",{value:"general",children:"general"})]})},t.key):t.key==="content"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("input",{type:"text",value:E,onChange:j=>D(j.target.value),placeholder:"Describe the entry...",autoFocus:!0,onKeyDown:j=>{j.key==="Enter"&&P(),j.key==="Escape"&&i(!1)},className:"w-full px-[10px] py-[6px] rounded-[6px] border border-border bg-bg-card text-[13px] text-text-primary font-sans outline-none focus:border-[#9178B5] transition-colors"})},t.key):t.key==="actions"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void P(),className:"px-3 py-[5px] rounded-[6px] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] transition-all",children:"Save"}),e.jsx("button",{type:"button",onClick:()=>i(!1),className:"px-3 py-[5px] rounded-[6px] border-none bg-bg-secondary text-text-secondary text-[11px] font-semibold cursor-pointer font-sans hover:bg-bg-tertiary transition-all",children:"Cancel"})]})},t.key):e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top font-mono text-[11px] text-text-tertiary",style:{background:l,borderBottomColor:b},children:"—"},t.key)})}),q.map((t,l)=>e.jsx(Ge,{entry:t,selected:u===t.id,onClick:()=>h(t.id),onDelete:ne,index:l,visibleColumns:T},t.id)),q.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:T.length,className:"text-center py-12 text-[13px] text-text-tertiary",children:"No entries found"})})]})]})})]})}function He({children:r,width:c,active:o,onClick:a}){return e.jsxs("th",{style:{width:c?`${c}px`:void 0},onClick:a,className:["sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.06em] px-3 py-2","bg-bg-secondary border-b border-border select-none whitespace-nowrap",a?"cursor-pointer":"",o?"text-text-primary":"text-text-tertiary hover:text-text-primary"].join(" "),children:[r,o&&e.jsx(Z,{size:10,strokeWidth:2,className:"inline-block align-middle ml-[3px]"})]})}function Ge({entry:r,selected:c,onClick:o,onDelete:a,index:n,visibleColumns:d}){const g=Pe[r.type],y=te[r.category]??"#A09D97",u={id:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.id}),type:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:g.bg,color:g.text},children:r.type}),category:e.jsx("span",{className:"text-[10px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:`${y}15`,color:y},children:r.category||"general"}),content:e.jsx("span",{className:"text-[13px] text-text-primary font-medium leading-[1.5] max-w-[500px] block",children:r.content||r.title}),keywords:e.jsxs("div",{className:"flex flex-wrap gap-[3px]",children:[r.keywords.slice(0,3).map(h=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono whitespace-nowrap",children:h},h)),r.keywords.length>3&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-3]})]}),file:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.file?r.file.split("/").pop():""}),added:e.jsx("span",{className:"font-mono text-[11px] text-text-quaternary whitespace-nowrap",children:Ie(r.timestamp)}),actions:e.jsxs("div",{className:"flex gap-[2px] whitespace-nowrap",children:[e.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),o()},className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-bg-hover hover:text-text-primary",children:e.jsx(Q,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",onClick:h=>a(h,r.id),className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-[rgba(196,101,85,0.08)] hover:text-[#C46555]",children:e.jsx(X,{size:14,strokeWidth:1.8})})]})};return e.jsx(L.tr,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15,delay:Math.min(n*.02,.3)},onClick:o,className:["cursor-pointer transition-colors group",c?"[&>td]:bg-tint-planning":"hover:[&>td]:bg-bg-hover"].join(" "),children:d.map(h=>e.jsx("td",{className:"px-3 py-[10px] border-b border-border-divider align-top",children:u[h.key]},h.key))})}const H={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function Ye(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);if(d<24)return`${d}h ago`;const g=Math.floor(d/24);return g<7?`${g}d ago`:c.toLocaleDateString()}function Ue({entry:r,onClose:c}){const o=f(g=>g.deleteEntry),a=p.useMemo(()=>H[r.type]??H.general,[r.type]),n=p.useMemo(()=>r.file?r.file.split("/").pop():"",[r.file]);function d(){o(r.id),c()}return e.jsxs(L.aside,{initial:{width:0,opacity:0},animate:{width:380,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:400,damping:30},className:"shrink-0 border-l border-border bg-bg-primary overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-divider shrink-0 min-h-[48px]",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"Entry Detail"}),e.jsx("button",{type:"button",onClick:c,"aria-label":"Close detail panel",className:"w-7 h-7 rounded-[8px] border-none bg-transparent cursor-pointer text-text-tertiary flex items-center justify-center hover:bg-bg-hover hover:text-text-primary transition-colors",children:e.jsx(de,{size:14,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",style:{width:380},children:[e.jsx("span",{className:"inline-flex items-center gap-[5px] text-[10px] font-bold px-[10px] py-[3px] rounded-[6px] mb-3 uppercase tracking-[0.04em]",style:{background:a.bg,color:a.text},children:r.type}),e.jsx("div",{className:"text-[16px] font-bold text-text-primary leading-[1.5] mb-4",children:r.title||r.content}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[e.jsx(_,{label:"ID",value:r.id,mono:!0}),e.jsx(_,{label:"Added",value:Ye(r.timestamp),mono:!0}),e.jsx(_,{label:"File",value:n||"--",mono:!0}),e.jsx(_,{label:"Type",value:r.type})]}),r.content&&r.title&&r.content!==r.title&&e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-[6px]",children:"Description"}),e.jsx("div",{className:"text-[13px] text-text-secondary leading-[1.6] whitespace-pre-wrap",children:r.content})]}),e.jsxs("div",{className:"flex gap-2 pt-3 border-t border-border-divider",children:[e.jsxs("button",{type:"button",className:"flex-1 py-2 rounded-[8px] border border-text-primary bg-text-primary text-[12px] font-semibold text-white cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:bg-[#1A1816] transition-all",children:[e.jsx(Q,{size:13,strokeWidth:2}),"Edit"]}),e.jsxs("button",{type:"button",onClick:d,className:"flex-1 py-2 rounded-[8px] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:border-[#C46555] hover:text-[#C46555] hover:bg-[rgba(196,101,85,0.08)] transition-all",children:[e.jsx(X,{size:13,strokeWidth:2}),"Delete"]})]})]})]})}function _({label:r,value:c,mono:o}){return e.jsxs("div",{className:"px-3 py-2 bg-bg-secondary rounded-[8px]",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] text-text-quaternary mb-[2px]",children:r}),e.jsx("div",{className:["text-[13px] font-semibold text-text-primary",o?"font-mono text-[12px]":""].join(" "),children:c})]})}const Je=[{value:"bug",label:"Bug",activeBg:"var(--color-tint-blocked)",activeText:"#C46555",activeBorder:"#C46555"},{value:"pattern",label:"Pattern",activeBg:"var(--color-tint-exploring)",activeText:"#5B8DB8",activeBorder:"#5B8DB8"},{value:"decision",label:"Decision",activeBg:"var(--color-tint-planning)",activeText:"#9178B5",activeBorder:"#9178B5"},{value:"rule",label:"Rule",activeBg:"var(--color-tint-completed)",activeText:"#5A9E78",activeBorder:"#5A9E78"},{value:"debug",label:"Debug",activeBg:"rgba(196,101,85,0.10)",activeText:"#B85B4A",activeBorder:"#B85B4A"},{value:"test",label:"Test",activeBg:"rgba(90,158,120,0.10)",activeText:"#3D8B5F",activeBorder:"#3D8B5F"},{value:"review",label:"Review",activeBg:"rgba(219,176,108,0.12)",activeText:"#C4A055",activeBorder:"#C4A055"},{value:"validation",label:"Validation",activeBg:"rgba(91,141,184,0.10)",activeText:"#4A7DA8",activeBorder:"#4A7DA8"}];function Xe({open:r,onOpenChange:c}){const o=f(m=>m.addEntry),a=f(m=>m.files),[n,d]=p.useState("bug"),[g,y]=p.useState(""),[u,h]=p.useState(""),[v,N]=p.useState(!1);p.useEffect(()=>{r||(d("bug"),y(""),h(""))},[r]),p.useEffect(()=>{a.length>0&&!u&&h(a[0].path)},[a,u]);const w=p.useCallback(async()=>{g.trim()&&(N(!0),await o(n,g.trim(),u),N(!1),c(!1))},[n,g,u,o,c]);return e.jsx(xe,{open:r,onOpenChange:c,children:e.jsxs(pe,{children:[e.jsx(be,{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(ue,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[480px] max-w-[95vw] max-h-[80vh]","rounded-[16px] border border-border bg-bg-card shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-divider shrink-0",children:[e.jsx(me,{className:"text-[16px] font-bold text-text-primary",children:"New Spec Entry"}),e.jsx(O,{className:B("w-7 h-7 flex items-center justify-center rounded-[8px]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors border-none bg-transparent cursor-pointer"),"aria-label":"Close",children:e.jsxs("svg",{className:"w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Type"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Je.map(m=>{const k=n===m.value;return e.jsx("button",{type:"button",onClick:()=>d(m.value),className:B("py-[10px] rounded-[10px] border-[1.5px] bg-bg-card cursor-pointer","text-center text-[11px] font-semibold font-sans transition-all"),style:k?{borderColor:m.activeBorder,color:m.activeText,background:m.activeBg,fontWeight:700}:{borderColor:"var(--color-border, #E8E5DE)",color:"var(--color-text-tertiary, #A09D97)"},children:m.label},m.value)})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Content"}),e.jsx("textarea",{value:g,onChange:m=>y(m.target.value),placeholder:"Describe the bug, pattern, decision, or rule...",rows:5,className:B("w-full min-h-[120px] px-[14px] py-[10px] rounded-[8px]","border border-border bg-bg-primary text-[13px] text-text-primary","font-sans leading-[1.6] resize-y outline-none","focus:border-[#9178B5] transition-colors","placeholder:text-text-quaternary")}),e.jsx("div",{className:"text-[11px] text-text-quaternary mt-1",children:"Supports markdown. Will be timestamped automatically."})]}),a.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Target File"}),e.jsx("select",{value:u,onChange:m=>h(m.target.value),className:B("w-full px-3 py-2 rounded-[8px] border border-border","bg-bg-primary text-[12px] text-text-primary font-sans","outline-none cursor-pointer","focus:border-[#9178B5] transition-colors"),children:a.map(m=>e.jsxs("option",{value:m.path,children:[m.name," (",m.category,")"]},m.path))})]}),u&&e.jsxs("div",{className:"bg-bg-primary rounded-[10px] px-4 py-[14px] border border-border-divider",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-2",children:"Will write to"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-[10px] py-[6px] rounded-[6px] bg-bg-card border border-border-divider text-[11px] font-mono text-text-secondary",children:[e.jsx(U,{size:12,strokeWidth:1.8,className:"text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-semibold",children:u})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-border-divider shrink-0",children:[e.jsx(O,{className:B("px-4 py-2 rounded-[8px] border border-border bg-bg-card","text-[12px] font-semibold text-text-secondary cursor-pointer font-sans","hover:border-text-tertiary hover:text-text-primary transition-all"),children:"Cancel"}),e.jsxs("button",{type:"button",disabled:!g.trim()||v,onClick:()=>void w(),className:B("flex items-center gap-[6px] px-[14px] py-2 rounded-[8px] border-none","bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans","hover:bg-[#1A1816] hover:-translate-y-px hover:shadow-md transition-all","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none"),children:[e.jsx(je,{size:14,strokeWidth:2}),v?"Adding...":"Add Entry"]})]})]})]})})}const Qe=[{label:"Kanban",icon:e.jsx(ye,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Table",icon:e.jsx(he,{size:14,strokeWidth:1.8}),shortcut:"2"}],G=["kanban","table"];function dt(){const{activeView:r,setActiveView:c,fetchEntries:o,fetchFiles:a,entries:n,search:d,setSearch:g,selectedEntry:y,setSelectedEntry:u,loading:h,error:v}=f(fe(i=>({activeView:i.activeView,setActiveView:i.setActiveView,fetchEntries:i.fetchEntries,fetchFiles:i.fetchFiles,entries:i.entries,search:i.search,setSearch:i.setSearch,selectedEntry:i.selectedEntry,setSelectedEntry:i.setSelectedEntry,loading:i.loading,error:i.error}))),[N,w]=p.useState(!1),{register:m,unregister:k}=p.useContext(ge),S=p.useCallback(i=>c(G[i]),[c]);p.useEffect(()=>{m({items:Qe.map(i=>({label:i.label,icon:i.icon,shortcut:i.shortcut})),activeIndex:G.indexOf(r),onSwitch:S})},[r,m,S]),p.useEffect(()=>()=>k(),[k]),p.useEffect(()=>{function i(x){x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement||(x.key==="1"?c("kanban"):x.key==="2"&&c("table"))}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),p.useEffect(()=>{o(),a()},[o,a]);const s=y?n.find(i=>i.id===y)??null:null;return h&&n.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading specs..."}):v&&n.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load specs"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:v}),e.jsx("button",{type:"button",onClick:()=>void o(),className:"px-3 py-1 rounded-[var(--radius-md)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("span",{className:"text-[16px] font-bold text-text-primary",children:"Specs"}),e.jsxs("span",{className:"text-[11px] text-text-tertiary font-mono tabular-nums",children:[n.length," entries"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[5px] rounded-[8px] bg-bg-card w-[240px] focus-within:border-[#9178B5] transition-colors",style:{border:"var(--style-btn-secondary-border)"},children:[e.jsx(ve,{size:13,strokeWidth:2,className:"text-text-quaternary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search specs...",value:d,onChange:i=>g(i.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary font-sans w-full placeholder:text-text-quaternary"})]}),e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[8px] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] hover:[transform:var(--style-card-hover-transform)] hover:[box-shadow:var(--style-card-hover-shadow)] transition-all",children:[e.jsx(Y,{size:14,strokeWidth:2}),"New Entry"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[r==="kanban"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(qe,{onAddEntry:()=>w(!0)})}),r==="table"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(Ke,{})})]}),s&&e.jsx(Ue,{entry:s,onClose:()=>u(null)})]}),e.jsx(Xe,{open:N,onOpenChange:w})]})}export{dt as SpecsPage};
|
|
36
|
+
*/const _e=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ee=A("tag",_e),f=ie((r,c)=>({entries:[],files:[],loading:!1,error:null,activeView:"kanban",typeFilter:"all",categoryFilter:"all",keywordFilter:"all",search:"",selectedEntry:null,hiddenColumns:new Set,setActiveView:o=>r({activeView:o}),setTypeFilter:o=>r({typeFilter:o}),setCategoryFilter:o=>r({categoryFilter:o}),setKeywordFilter:o=>r({keywordFilter:o}),setSearch:o=>r({search:o}),setSelectedEntry:o=>r({selectedEntry:o}),toggleColumn:o=>r(a=>{const n=new Set(a.hiddenColumns);return n.has(o)?n.delete(o):n.add(o),{hiddenColumns:n}}),fetchEntries:async()=>{r({loading:!0,error:null});try{const o=await fetch(F.SPECS);if(!o.ok)throw new Error(`Failed: ${o.status}`);const a=await o.json();r({entries:a.entries??[],loading:!1})}catch(o){r({loading:!1,error:String(o)})}},fetchFiles:async()=>{try{const o=await fetch(F.SPECS_FILES);if(!o.ok)return;const a=await o.json();r({files:a.files??[]})}catch{}},addEntry:async(o,a,n)=>{r({error:null});try{const d=await fetch(F.SPECS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:o,content:a,file:n})});if(!d.ok){const g=await d.json().catch(()=>({error:`HTTP ${d.status}`}));throw new Error(g.error)}return c().fetchEntries(),null}catch(d){return r({error:String(d)}),null}},deleteEntry:async o=>{r({error:null});const a=c().entries;r(n=>({entries:n.entries.filter(d=>d.id!==o)}));try{(await fetch(`${F.SPECS}/${o}`,{method:"DELETE"})).ok||r({entries:a})}catch{r({entries:a})}},filteredEntries:()=>{const{entries:o,typeFilter:a,categoryFilter:n,keywordFilter:d,search:g}=c();let y=o;if(a!=="all"&&(y=y.filter(u=>u.type===a)),n!=="all"&&(y=y.filter(u=>u.category===n)),d!=="all"&&(y=y.filter(u=>u.keywords.includes(d))),g){const u=g.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(u)||h.content.toLowerCase().includes(u)||h.id.toLowerCase().includes(u)||h.keywords.some(v=>v.toLowerCase().includes(u)))}return y},entriesByType:()=>{const o=c().filteredEntries(),a={bug:[],pattern:[],decision:[],rule:[],debug:[],test:[],review:[],validation:[],general:[]};for(const n of o)(a[n.type]??a.general).push(n);return a},typeCounts:()=>{const{entries:o}=c(),a={all:o.length,bug:0,pattern:0,decision:0,rule:0,debug:0,test:0,review:0,validation:0,general:0};for(const n of o)a[n.type]=(a[n.type]??0)+1;return a},allCategories:()=>{const{entries:o}=c(),a=new Set;for(const n of o)n.category&&a.add(n.category);return Array.from(a).sort()},allKeywords:()=>{const{entries:o}=c(),a=new Set;for(const n of o)for(const d of n.keywords)a.add(d);return Array.from(a).sort()}})),ze={general:{label:"General",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"},planning:{label:"Planning",icon:e.jsx(Ce,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-planning)",color:"#9178B5"},execution:{label:"Execution",icon:e.jsx(Te,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-exploring)",color:"#5B8DB8"},debug:{label:"Debug",icon:e.jsx(we,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-blocked)",color:"#C46555"},test:{label:"Test",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-completed)",color:"#5A9E78"},review:{label:"Review",icon:e.jsx(ce,{size:14,strokeWidth:1.8}),tintBg:"rgba(219,176,108,0.12)",color:"#C4A055"},validation:{label:"Validation",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"rgba(90,158,120,0.10)",color:"#3D8B5F"}},Le=["general","planning","execution","debug","test","review","validation"],Me={label:"",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"};function I(r){return ze[r]??{...Me,label:r.charAt(0).toUpperCase()+r.slice(1)}}const We={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function $e(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function Ve({onAddEntry:r}){const c=f(s=>s.entries),o=f(s=>s.typeFilter),a=f(s=>s.keywordFilter),n=f(s=>s.search),d=f(s=>s.selectedEntry),g=f(s=>s.setSelectedEntry),y=f(s=>s.setKeywordFilter),u=f(s=>s.hiddenColumns),h=f(s=>s.toggleColumn),v=p.useMemo(()=>{const s=new Set;for(const x of c)x.category&&s.add(x.category);const i=[];for(const x of Le)s.has(x)&&(i.push(x),s.delete(x));for(const x of Array.from(s).sort())i.push(x);return i},[c]),N=p.useMemo(()=>{const s=new Set;for(const i of c)for(const x of i.keywords)s.add(x);return Array.from(s).sort()},[c]),w=p.useMemo(()=>{let s=c;if(o!=="all"&&(s=s.filter(i=>i.type===o)),a!=="all"&&(s=s.filter(i=>i.keywords.includes(a))),n){const i=n.toLowerCase();s=s.filter(x=>x.title.toLowerCase().includes(i)||x.content.toLowerCase().includes(i)||x.id.toLowerCase().includes(i)||x.keywords.some(C=>C.toLowerCase().includes(i)))}return s},[c,o,a,n]),m=p.useMemo(()=>{const s={};for(const i of v)s[i]=[];for(const i of w){const x=i.category||"general";s[x]||(s[x]=[]),s[x].push(i)}return s},[w,v]),k=p.useMemo(()=>{const s={};for(const i of c){const x=i.category||"general";s[x]=(s[x]??0)+1}return s},[c]),S=p.useMemo(()=>v.filter(s=>!u.has(s)),[v,u]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-[6px] px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[v.map(s=>{const i=I(s),x=!u.has(s),C=k[s]??0;return e.jsxs("button",{type:"button",onClick:()=>h(s),className:["text-[11px] font-medium px-[10px] py-[4px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",x?"bg-bg-card text-text-primary border-border hover:shadow-sm":"bg-bg-secondary text-text-quaternary border-border-divider opacity-60"].join(" "),style:x?{borderColor:i.color,boxShadow:`0 0 0 1px ${i.color}22`}:void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 transition-opacity",style:{background:i.color,opacity:x?1:.35}}),i.label,e.jsx("span",{className:"text-[10px] font-mono opacity-60",children:C})]},s)}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx(ee,{size:11,strokeWidth:2,className:"text-text-quaternary shrink-0"}),N.map(s=>{const i=a===s;return e.jsx("button",{type:"button",onClick:()=>y(i?"all":s),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",i?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:s},s)})]})]}),e.jsxs("div",{className:"flex gap-3 flex-1 overflow-x-auto p-3",children:[S.map((s,i)=>{const x=I(s),C=m[s]??[];return e.jsxs("div",{className:"flex flex-col min-w-[260px] flex-1 bg-bg-secondary rounded-[12px] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[14px] py-3 border-b border-black/[0.04]",children:[e.jsx("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center shrink-0",style:{background:x.tintBg,color:x.color},children:x.icon}),e.jsx("span",{className:"text-[13px] font-bold text-text-primary",children:x.label}),e.jsx("span",{className:"text-[10px] text-text-tertiary bg-bg-card px-[6px] rounded-full font-mono",children:C.length}),e.jsx("button",{type:"button",onClick:r,className:"ml-auto w-6 h-6 rounded-[6px] border border-dashed border-border bg-transparent cursor-pointer flex items-center justify-center text-text-quaternary hover:border-text-tertiary hover:text-text-primary hover:bg-bg-card transition-all",children:e.jsx(Y,{size:12,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 flex flex-col gap-2",children:[C.map((E,D)=>e.jsx(qe,{entry:E,selected:d===E.id,onClick:()=>g(E.id),index:i*100+D},E.id)),C.length===0&&e.jsx("div",{className:"flex items-center justify-center py-8 text-[11px] text-text-quaternary",children:"No entries"})]})]},s)}),S.length===0&&e.jsx("div",{className:"flex items-center justify-center flex-1 text-[13px] text-text-tertiary",children:"All columns hidden — click a category tag above to show it."})]})]})}function qe({entry:r,selected:c,onClick:o,index:a}){const n=We[r.type];return e.jsxs(L.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,delay:Math.min(a*.03,.3)},onClick:o,className:["bg-bg-card rounded-[10px] px-[14px] py-3 border cursor-pointer","transition-all duration-[180ms]","hover:-translate-y-[2px] hover:shadow-[0_4px_16px_rgba(0,0,0,0.06)] hover:border-border",c?"border-[#9178B5] shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border-divider"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[6px] mb-2",children:[e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em]",style:{background:n.bg,color:n.text},children:r.type}),e.jsx("span",{className:"text-[10px] font-mono text-text-quaternary ml-auto",children:r.id})]}),e.jsx("div",{className:"text-[13px] text-text-primary font-medium leading-[1.5] mb-2 line-clamp-3",children:r.content||r.title}),r.keywords.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[r.keywords.slice(0,4).map(d=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono",children:d},d)),r.keywords.length>4&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-4]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] text-text-quaternary font-mono flex items-center gap-[3px]",children:[e.jsx(le,{size:10,strokeWidth:2}),$e(r.timestamp)]}),r.file&&e.jsxs("span",{className:"text-[10px] text-text-tertiary flex items-center gap-[3px] ml-auto",children:[e.jsx(U,{size:10,strokeWidth:2}),r.file.split("/").pop()]})]})]})}const Pe={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}},Oe={bug:"#C46555",pattern:"#5B8DB8",decision:"#9178B5",rule:"#5A9E78",debug:"#B85B4A",test:"#3D8B5F",review:"#C4A055",validation:"#4A7DA8",general:"#A09D97"},te={general:"#A09D97",planning:"#9178B5",execution:"#5B8DB8",debug:"#C46555",test:"#5A9E78",review:"#C4A055",validation:"#3D8B5F"},Re=[{value:"all",label:"All"},{value:"bug",label:"Bug"},{value:"pattern",label:"Pattern"},{value:"decision",label:"Decision"},{value:"rule",label:"Rule"},{value:"debug",label:"Debug"},{value:"test",label:"Test"},{value:"review",label:"Review"},{value:"validation",label:"Validation"},{value:"general",label:"General"}],K=[{key:"id",label:"ID",width:60},{key:"type",label:"Type",width:80},{key:"category",label:"Category",width:100},{key:"content",label:"Content",alwaysVisible:!0},{key:"keywords",label:"Keywords",width:180},{key:"file",label:"File",width:140},{key:"added",label:"Added",width:90},{key:"actions",label:"",width:80,alwaysVisible:!0}];function Ie(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function Ke(){const r=f(t=>t.entries),c=f(t=>t.typeFilter),o=f(t=>t.setTypeFilter),a=f(t=>t.categoryFilter),n=f(t=>t.setCategoryFilter),d=f(t=>t.keywordFilter),g=f(t=>t.setKeywordFilter),y=f(t=>t.search),u=f(t=>t.selectedEntry),h=f(t=>t.setSelectedEntry),v=f(t=>t.deleteEntry),N=f(t=>t.addEntry),[w,m]=p.useState("timestamp"),[k,S]=p.useState("desc"),[s,i]=p.useState(!1),[x,C]=p.useState("bug"),[E,D]=p.useState(""),[z,re]=p.useState(new Set),oe=p.useCallback(t=>{re(l=>{const b=new Set(l);return b.has(t)?b.delete(t):b.add(t),b})},[]),T=p.useMemo(()=>K.filter(t=>t.alwaysVisible||!z.has(t.key)),[z]),M=p.useMemo(()=>{const t=new Set;for(const l of r)l.category&&t.add(l.category);return Array.from(t).sort()},[r]),W=p.useMemo(()=>{const t=new Set;for(const l of r)for(const b of l.keywords)t.add(b);return Array.from(t).sort()},[r]),se=p.useMemo(()=>{const t={all:r.length,bug:0,pattern:0,decision:0,rule:0,general:0};for(const l of r)t[l.type]=(t[l.type]??0)+1;return t},[r]),ae=p.useMemo(()=>{const t={};for(const l of r){const b=l.category||"general";t[b]=(t[b]??0)+1}return t},[r]),$=p.useMemo(()=>{let t=r;if(c!=="all"&&(t=t.filter(l=>l.type===c)),a!=="all"&&(t=t.filter(l=>l.category===a)),d!=="all"&&(t=t.filter(l=>l.keywords.includes(d))),y){const l=y.toLowerCase();t=t.filter(b=>b.title.toLowerCase().includes(l)||b.content.toLowerCase().includes(l)||b.id.toLowerCase().includes(l)||b.keywords.some(j=>j.toLowerCase().includes(l)))}return t},[r,c,a,d,y]),V=p.useMemo(()=>{const t=[...$];return t.sort((l,b)=>{let j=0;return w==="timestamp"?j=new Date(l.timestamp).getTime()-new Date(b.timestamp).getTime():w==="id"?j=l.id.localeCompare(b.id):w==="type"?j=l.type.localeCompare(b.type):w==="category"&&(j=(l.category||"").localeCompare(b.category||"")),k==="desc"?-j:j}),t},[$,w,k]),q=p.useCallback(t=>{m(l=>l===t?(S(b=>b==="desc"?"asc":"desc"),l):(S("desc"),t))},[]),P=p.useCallback(async()=>{E.trim()&&(await N(x,E.trim(),"learnings.md"),D(""),i(!1))},[x,E,N]),ne=p.useCallback((t,l)=>{t.stopPropagation(),v(l)},[v]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Type"}),Re.map(t=>{const l=c===t.value;return e.jsxs("button",{type:"button",onClick:()=>o(t.value),className:["text-[11px] font-medium px-3 py-1 rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:[t.value!=="all"&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":Oe[t.value]}}),t.label,e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:se[t.value]??0})]},t.value)}),M.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Category"}),e.jsx("button",{type:"button",onClick:()=>n("all"),className:["text-[11px] font-medium px-2 py-[3px] rounded-full border cursor-pointer transition-all",a==="all"?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"All"}),M.map(t=>{const l=a===t,b=te[t]??"#A09D97";return e.jsxs("button",{type:"button",onClick:()=>n(l?"all":t),className:["text-[11px] font-medium px-[10px] py-[3px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"border-transparent text-white":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),style:l?{background:b}:void 0,children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":b}}),t.charAt(0).toUpperCase()+t.slice(1),e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:ae[t]??0})]},t)})]}),W.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:e.jsx(ee,{size:10,strokeWidth:2,className:"inline-block mr-[2px] align-middle"})}),W.map(t=>{const l=d===t;return e.jsx("button",{type:"button",onClick:()=>g(l?"all":t),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:t},t)})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-1",children:K.filter(t=>!t.alwaysVisible).map(t=>{const l=z.has(t.key);return e.jsxs("button",{type:"button",onClick:()=>oe(t.key),className:["text-[10px] font-medium px-[6px] py-[3px] rounded-[4px] border cursor-pointer transition-all","flex items-center gap-[3px]",l?"bg-bg-secondary text-text-quaternary border-border-divider opacity-50":"bg-bg-card text-text-tertiary border-border hover:text-text-primary"].join(" "),title:`${l?"Show":"Hide"} ${t.label} column`,children:[l?e.jsx(Se,{size:9,strokeWidth:2}):e.jsx(Ae,{size:9,strokeWidth:2}),t.label]},t.key)})}),e.jsx("div",{className:"w-px h-[18px] bg-border-divider"}),e.jsxs("button",{type:"button",onClick:()=>q("timestamp"),className:"text-[11px] font-medium px-[10px] py-1 rounded-[6px] border border-border bg-bg-card text-text-tertiary cursor-pointer font-sans transition-all hover:border-text-tertiary hover:text-text-primary flex items-center gap-1",children:[e.jsx(Z,{size:12,strokeWidth:2,className:k==="asc"?"rotate-180 transition-transform":"transition-transform"}),k==="desc"?"Newest":"Oldest"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{children:T.map(t=>{const b={id:"id",type:"type",category:"category",added:"timestamp"}[t.key];return e.jsx(Ge,{width:t.width,active:b?w===b:!1,onClick:b?()=>q(b):void 0,children:t.label},t.key)})})}),e.jsxs("tbody",{children:[s&&e.jsx("tr",{children:T.map(t=>{const l="var(--color-tint-planning)",b="rgba(145,120,181,0.3)";return t.key==="id"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("span",{className:"font-mono text-[11px] font-semibold",style:{color:"#9178B5"},children:"NEW"})},t.key):t.key==="type"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("select",{value:x,onChange:j=>C(j.target.value),className:"px-2 py-1 rounded-[6px] border border-border bg-bg-card text-[11px] text-text-primary font-sans outline-none cursor-pointer",children:[e.jsx("option",{value:"bug",children:"bug"}),e.jsx("option",{value:"pattern",children:"pattern"}),e.jsx("option",{value:"decision",children:"decision"}),e.jsx("option",{value:"rule",children:"rule"}),e.jsx("option",{value:"debug",children:"debug"}),e.jsx("option",{value:"test",children:"test"}),e.jsx("option",{value:"review",children:"review"}),e.jsx("option",{value:"validation",children:"validation"}),e.jsx("option",{value:"general",children:"general"})]})},t.key):t.key==="content"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("input",{type:"text",value:E,onChange:j=>D(j.target.value),placeholder:"Describe the entry...",autoFocus:!0,onKeyDown:j=>{j.key==="Enter"&&P(),j.key==="Escape"&&i(!1)},className:"w-full px-[10px] py-[6px] rounded-[6px] border border-border bg-bg-card text-[13px] text-text-primary font-sans outline-none focus:border-[#9178B5] transition-colors"})},t.key):t.key==="actions"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void P(),className:"px-3 py-[5px] rounded-[6px] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] transition-all",children:"Save"}),e.jsx("button",{type:"button",onClick:()=>i(!1),className:"px-3 py-[5px] rounded-[6px] border-none bg-bg-secondary text-text-secondary text-[11px] font-semibold cursor-pointer font-sans hover:bg-bg-tertiary transition-all",children:"Cancel"})]})},t.key):e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top font-mono text-[11px] text-text-tertiary",style:{background:l,borderBottomColor:b},children:"—"},t.key)})}),V.map((t,l)=>e.jsx(He,{entry:t,selected:u===t.id,onClick:()=>h(t.id),onDelete:ne,index:l,visibleColumns:T},t.id)),V.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:T.length,className:"text-center py-12 text-[13px] text-text-tertiary",children:"No entries found"})})]})]})})]})}function Ge({children:r,width:c,active:o,onClick:a}){return e.jsxs("th",{style:{width:c?`${c}px`:void 0},onClick:a,className:["sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.06em] px-3 py-2","bg-bg-secondary border-b border-border select-none whitespace-nowrap",a?"cursor-pointer":"",o?"text-text-primary":"text-text-tertiary hover:text-text-primary"].join(" "),children:[r,o&&e.jsx(Z,{size:10,strokeWidth:2,className:"inline-block align-middle ml-[3px]"})]})}function He({entry:r,selected:c,onClick:o,onDelete:a,index:n,visibleColumns:d}){const g=Pe[r.type],y=te[r.category]??"#A09D97",u={id:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.id}),type:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:g.bg,color:g.text},children:r.type}),category:e.jsx("span",{className:"text-[10px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:`${y}15`,color:y},children:r.category||"general"}),content:e.jsx("span",{className:"text-[13px] text-text-primary font-medium leading-[1.5] max-w-[500px] block",children:r.content||r.title}),keywords:e.jsxs("div",{className:"flex flex-wrap gap-[3px]",children:[r.keywords.slice(0,3).map(h=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono whitespace-nowrap",children:h},h)),r.keywords.length>3&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-3]})]}),file:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.file?r.file.split("/").pop():""}),added:e.jsx("span",{className:"font-mono text-[11px] text-text-quaternary whitespace-nowrap",children:Ie(r.timestamp)}),actions:e.jsxs("div",{className:"flex gap-[2px] whitespace-nowrap",children:[e.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),o()},className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-bg-hover hover:text-text-primary",children:e.jsx(X,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",onClick:h=>a(h,r.id),className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-[rgba(196,101,85,0.08)] hover:text-[#C46555]",children:e.jsx(Q,{size:14,strokeWidth:1.8})})]})};return e.jsx(L.tr,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15,delay:Math.min(n*.02,.3)},onClick:o,className:["cursor-pointer transition-colors group",c?"[&>td]:bg-tint-planning":"hover:[&>td]:bg-bg-hover"].join(" "),children:d.map(h=>e.jsx("td",{className:"px-3 py-[10px] border-b border-border-divider align-top",children:u[h.key]},h.key))})}const G={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function Ye(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);if(d<24)return`${d}h ago`;const g=Math.floor(d/24);return g<7?`${g}d ago`:c.toLocaleDateString()}function Ue({entry:r,onClose:c}){const o=f(g=>g.deleteEntry),a=p.useMemo(()=>G[r.type]??G.general,[r.type]),n=p.useMemo(()=>r.file?r.file.split("/").pop():"",[r.file]);function d(){o(r.id),c()}return e.jsxs(L.aside,{initial:{width:0,opacity:0},animate:{width:380,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:400,damping:30},className:"shrink-0 border-l border-border bg-bg-primary overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-divider shrink-0 min-h-[48px]",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"Entry Detail"}),e.jsx("button",{type:"button",onClick:c,"aria-label":"Close detail panel",className:"w-7 h-7 rounded-[8px] border-none bg-transparent cursor-pointer text-text-tertiary flex items-center justify-center hover:bg-bg-hover hover:text-text-primary transition-colors",children:e.jsx(de,{size:14,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",style:{width:380},children:[e.jsx("span",{className:"inline-flex items-center gap-[5px] text-[10px] font-bold px-[10px] py-[3px] rounded-[6px] mb-3 uppercase tracking-[0.04em]",style:{background:a.bg,color:a.text},children:r.type}),e.jsx("div",{className:"text-[16px] font-bold text-text-primary leading-[1.5] mb-4",children:r.title||r.content}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[e.jsx(_,{label:"ID",value:r.id,mono:!0}),e.jsx(_,{label:"Added",value:Ye(r.timestamp),mono:!0}),e.jsx(_,{label:"File",value:n||"--",mono:!0}),e.jsx(_,{label:"Type",value:r.type})]}),r.content&&r.title&&r.content!==r.title&&e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-[6px]",children:"Description"}),e.jsx("div",{className:"text-[13px] text-text-secondary leading-[1.6] whitespace-pre-wrap",children:r.content})]}),e.jsxs("div",{className:"flex gap-2 pt-3 border-t border-border-divider",children:[e.jsxs("button",{type:"button",className:"flex-1 py-2 rounded-[8px] border border-text-primary bg-text-primary text-[12px] font-semibold text-white cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:bg-[#1A1816] transition-all",children:[e.jsx(X,{size:13,strokeWidth:2}),"Edit"]}),e.jsxs("button",{type:"button",onClick:d,className:"flex-1 py-2 rounded-[8px] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:border-[#C46555] hover:text-[#C46555] hover:bg-[rgba(196,101,85,0.08)] transition-all",children:[e.jsx(Q,{size:13,strokeWidth:2}),"Delete"]})]})]})]})}function _({label:r,value:c,mono:o}){return e.jsxs("div",{className:"px-3 py-2 bg-bg-secondary rounded-[8px]",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] text-text-quaternary mb-[2px]",children:r}),e.jsx("div",{className:["text-[13px] font-semibold text-text-primary",o?"font-mono text-[12px]":""].join(" "),children:c})]})}const Je=[{value:"bug",label:"Bug",activeBg:"var(--color-tint-blocked)",activeText:"#C46555",activeBorder:"#C46555"},{value:"pattern",label:"Pattern",activeBg:"var(--color-tint-exploring)",activeText:"#5B8DB8",activeBorder:"#5B8DB8"},{value:"decision",label:"Decision",activeBg:"var(--color-tint-planning)",activeText:"#9178B5",activeBorder:"#9178B5"},{value:"rule",label:"Rule",activeBg:"var(--color-tint-completed)",activeText:"#5A9E78",activeBorder:"#5A9E78"},{value:"debug",label:"Debug",activeBg:"rgba(196,101,85,0.10)",activeText:"#B85B4A",activeBorder:"#B85B4A"},{value:"test",label:"Test",activeBg:"rgba(90,158,120,0.10)",activeText:"#3D8B5F",activeBorder:"#3D8B5F"},{value:"review",label:"Review",activeBg:"rgba(219,176,108,0.12)",activeText:"#C4A055",activeBorder:"#C4A055"},{value:"validation",label:"Validation",activeBg:"rgba(91,141,184,0.10)",activeText:"#4A7DA8",activeBorder:"#4A7DA8"}];function Qe({open:r,onOpenChange:c}){const o=f(m=>m.addEntry),a=f(m=>m.files),[n,d]=p.useState("bug"),[g,y]=p.useState(""),[u,h]=p.useState(""),[v,N]=p.useState(!1);p.useEffect(()=>{r||(d("bug"),y(""),h(""))},[r]),p.useEffect(()=>{a.length>0&&!u&&h(a[0].path)},[a,u]);const w=p.useCallback(async()=>{g.trim()&&(N(!0),await o(n,g.trim(),u),N(!1),c(!1))},[n,g,u,o,c]);return e.jsx(xe,{open:r,onOpenChange:c,children:e.jsxs(pe,{children:[e.jsx(be,{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(ue,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[480px] max-w-[95vw] max-h-[80vh]","rounded-[16px] border border-border bg-bg-card shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-divider shrink-0",children:[e.jsx(me,{className:"text-[16px] font-bold text-text-primary",children:"New Spec Entry"}),e.jsx(O,{className:B("w-7 h-7 flex items-center justify-center rounded-[8px]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors border-none bg-transparent cursor-pointer"),"aria-label":"Close",children:e.jsxs("svg",{className:"w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Type"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Je.map(m=>{const k=n===m.value;return e.jsx("button",{type:"button",onClick:()=>d(m.value),className:B("py-[10px] rounded-[10px] border-[1.5px] bg-bg-card cursor-pointer","text-center text-[11px] font-semibold font-sans transition-all"),style:k?{borderColor:m.activeBorder,color:m.activeText,background:m.activeBg,fontWeight:700}:{borderColor:"var(--color-border, #E8E5DE)",color:"var(--color-text-tertiary, #A09D97)"},children:m.label},m.value)})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Content"}),e.jsx("textarea",{value:g,onChange:m=>y(m.target.value),placeholder:"Describe the bug, pattern, decision, or rule...",rows:5,className:B("w-full min-h-[120px] px-[14px] py-[10px] rounded-[8px]","border border-border bg-bg-primary text-[13px] text-text-primary","font-sans leading-[1.6] resize-y outline-none","focus:border-[#9178B5] transition-colors","placeholder:text-text-quaternary")}),e.jsx("div",{className:"text-[11px] text-text-quaternary mt-1",children:"Supports markdown. Will be timestamped automatically."})]}),a.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Target File"}),e.jsx("select",{value:u,onChange:m=>h(m.target.value),className:B("w-full px-3 py-2 rounded-[8px] border border-border","bg-bg-primary text-[12px] text-text-primary font-sans","outline-none cursor-pointer","focus:border-[#9178B5] transition-colors"),children:a.map(m=>e.jsxs("option",{value:m.path,children:[m.name," (",m.category,")"]},m.path))})]}),u&&e.jsxs("div",{className:"bg-bg-primary rounded-[10px] px-4 py-[14px] border border-border-divider",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-2",children:"Will write to"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-[10px] py-[6px] rounded-[6px] bg-bg-card border border-border-divider text-[11px] font-mono text-text-secondary",children:[e.jsx(U,{size:12,strokeWidth:1.8,className:"text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-semibold",children:u})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-border-divider shrink-0",children:[e.jsx(O,{className:B("px-4 py-2 rounded-[8px] border border-border bg-bg-card","text-[12px] font-semibold text-text-secondary cursor-pointer font-sans","hover:border-text-tertiary hover:text-text-primary transition-all"),children:"Cancel"}),e.jsxs("button",{type:"button",disabled:!g.trim()||v,onClick:()=>void w(),className:B("flex items-center gap-[6px] px-[14px] py-2 rounded-[8px] border-none","bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans","hover:bg-[#1A1816] hover:-translate-y-px hover:shadow-md transition-all","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none"),children:[e.jsx(je,{size:14,strokeWidth:2}),v?"Adding...":"Add Entry"]})]})]})]})})}const Xe=[{label:"Kanban",icon:e.jsx(ye,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Table",icon:e.jsx(he,{size:14,strokeWidth:1.8}),shortcut:"2"}],H=["kanban","table"];function dt(){const{activeView:r,setActiveView:c,fetchEntries:o,fetchFiles:a,entries:n,search:d,setSearch:g,selectedEntry:y,setSelectedEntry:u,loading:h,error:v}=f(fe(i=>({activeView:i.activeView,setActiveView:i.setActiveView,fetchEntries:i.fetchEntries,fetchFiles:i.fetchFiles,entries:i.entries,search:i.search,setSearch:i.setSearch,selectedEntry:i.selectedEntry,setSelectedEntry:i.setSelectedEntry,loading:i.loading,error:i.error}))),[N,w]=p.useState(!1),{register:m,unregister:k}=p.useContext(ge),S=p.useCallback(i=>c(H[i]),[c]);p.useEffect(()=>{m({items:Xe.map(i=>({label:i.label,icon:i.icon,shortcut:i.shortcut})),activeIndex:H.indexOf(r),onSwitch:S})},[r,m,S]),p.useEffect(()=>()=>k(),[k]),p.useEffect(()=>{function i(x){x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement||(x.key==="1"?c("kanban"):x.key==="2"&&c("table"))}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),p.useEffect(()=>{o(),a()},[o,a]);const s=y?n.find(i=>i.id===y)??null:null;return h&&n.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading specs..."}):v&&n.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load specs"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:v}),e.jsx("button",{type:"button",onClick:()=>void o(),className:"px-3 py-1 rounded-[var(--radius-md)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("span",{className:"text-[16px] font-bold text-text-primary",children:"Specs"}),e.jsxs("span",{className:"text-[11px] text-text-tertiary font-mono tabular-nums",children:[n.length," entries"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[5px] rounded-[8px] bg-bg-card w-[240px] focus-within:border-[#9178B5] transition-colors",style:{border:"var(--style-btn-secondary-border)"},children:[e.jsx(ve,{size:13,strokeWidth:2,className:"text-text-quaternary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search specs...",value:d,onChange:i=>g(i.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary font-sans w-full placeholder:text-text-quaternary"})]}),e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[8px] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] hover:[transform:var(--style-card-hover-transform)] hover:[box-shadow:var(--style-card-hover-shadow)] transition-all",children:[e.jsx(Y,{size:14,strokeWidth:2}),"New Entry"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[r==="kanban"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(Ve,{onAddEntry:()=>w(!0)})}),r==="table"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(Ke,{})})]}),s&&e.jsx(Ue,{entry:s,onClose:()=>u(null)})]}),e.jsx(Qe,{open:N,onOpenChange:w})]})}export{dt as SpecsPage};
|