@mcp-graph-workflow/mcp-graph 5.5.0 → 5.5.2
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/dist/api/routes/integrations.d.ts.map +1 -1
- package/dist/api/routes/integrations.js +2 -1
- package/dist/api/routes/integrations.js.map +1 -1
- package/dist/api/routes/knowledge.js +1 -1
- package/dist/api/routes/knowledge.js.map +1 -1
- package/dist/api/routes/nodes.js +3 -3
- package/dist/api/routes/nodes.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +2 -1
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/import-cmd.d.ts.map +1 -1
- package/dist/cli/commands/import-cmd.js +2 -1
- package/dist/cli/commands/import-cmd.js.map +1 -1
- package/dist/cli/commands/index-cmd.d.ts.map +1 -1
- package/dist/cli/commands/index-cmd.js +2 -1
- package/dist/cli/commands/index-cmd.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/stats.d.ts.map +1 -1
- package/dist/cli/commands/stats.js +2 -1
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +3 -2
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/core/analyzer/ac-validator.d.ts.map +1 -1
- package/dist/core/analyzer/ac-validator.js +8 -2
- package/dist/core/analyzer/ac-validator.js.map +1 -1
- package/dist/core/analyzer/prd-quality.d.ts.map +1 -1
- package/dist/core/analyzer/prd-quality.js +9 -13
- package/dist/core/analyzer/prd-quality.js.map +1 -1
- package/dist/core/analyzer/scope-analyzer.d.ts.map +1 -1
- package/dist/core/analyzer/scope-analyzer.js +1 -2
- package/dist/core/analyzer/scope-analyzer.js.map +1 -1
- package/dist/core/code/code-types.d.ts +4 -4
- package/dist/core/config/ai-memory-generator.d.ts.map +1 -1
- package/dist/core/config/ai-memory-generator.js +10 -38
- package/dist/core/config/ai-memory-generator.js.map +1 -1
- package/dist/core/context/compact-context.d.ts.map +1 -1
- package/dist/core/context/compact-context.js +14 -4
- package/dist/core/context/compact-context.js.map +1 -1
- package/dist/core/context/context-assembler.d.ts.map +1 -1
- package/dist/core/context/context-assembler.js +22 -3
- package/dist/core/context/context-assembler.js.map +1 -1
- package/dist/core/context/rag-context.d.ts.map +1 -1
- package/dist/core/context/rag-context.js +23 -3
- package/dist/core/context/rag-context.js.map +1 -1
- package/dist/core/designer/coupling-analyzer.d.ts.map +1 -1
- package/dist/core/designer/coupling-analyzer.js +3 -0
- package/dist/core/designer/coupling-analyzer.js.map +1 -1
- package/dist/core/designer/definition-of-ready.d.ts.map +1 -1
- package/dist/core/designer/definition-of-ready.js +1 -11
- package/dist/core/designer/definition-of-ready.js.map +1 -1
- package/dist/core/designer/interface-checker.d.ts.map +1 -1
- package/dist/core/designer/interface-checker.js +2 -1
- package/dist/core/designer/interface-checker.js.map +1 -1
- package/dist/core/designer/traceability-matrix.d.ts.map +1 -1
- package/dist/core/designer/traceability-matrix.js +7 -3
- package/dist/core/designer/traceability-matrix.js.map +1 -1
- package/dist/core/graph/mermaid-export.d.ts +1 -0
- package/dist/core/graph/mermaid-export.d.ts.map +1 -1
- package/dist/core/graph/mermaid-export.js +14 -7
- package/dist/core/graph/mermaid-export.js.map +1 -1
- package/dist/core/handoff/delivery-checklist.d.ts.map +1 -1
- package/dist/core/handoff/delivery-checklist.js +5 -14
- package/dist/core/handoff/delivery-checklist.js.map +1 -1
- package/dist/core/implementer/definition-of-done.d.ts.map +1 -1
- package/dist/core/implementer/definition-of-done.js +8 -18
- package/dist/core/implementer/definition-of-done.js.map +1 -1
- package/dist/core/implementer/sprint-progress.d.ts.map +1 -1
- package/dist/core/implementer/sprint-progress.js +1 -1
- package/dist/core/implementer/sprint-progress.js.map +1 -1
- package/dist/core/implementer/tdd-checker.d.ts +4 -0
- package/dist/core/implementer/tdd-checker.d.ts.map +1 -1
- package/dist/core/implementer/tdd-checker.js +18 -3
- package/dist/core/implementer/tdd-checker.js.map +1 -1
- package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
- package/dist/core/importer/prd-to-graph.js +70 -1
- package/dist/core/importer/prd-to-graph.js.map +1 -1
- package/dist/core/listener/backlog-health.d.ts.map +1 -1
- package/dist/core/listener/backlog-health.js +12 -1
- package/dist/core/listener/backlog-health.js.map +1 -1
- package/dist/core/listener/feedback-readiness.d.ts.map +1 -1
- package/dist/core/listener/feedback-readiness.js +8 -14
- package/dist/core/listener/feedback-readiness.js.map +1 -1
- package/dist/core/parser/classify.d.ts.map +1 -1
- package/dist/core/parser/classify.js +10 -1
- package/dist/core/parser/classify.js.map +1 -1
- package/dist/core/parser/extract.d.ts.map +1 -1
- package/dist/core/parser/extract.js +29 -0
- package/dist/core/parser/extract.js.map +1 -1
- package/dist/core/planner/decompose.d.ts.map +1 -1
- package/dist/core/planner/decompose.js +1 -3
- package/dist/core/planner/decompose.js.map +1 -1
- package/dist/core/planner/lifecycle-phase.d.ts.map +1 -1
- package/dist/core/planner/lifecycle-phase.js +25 -14
- package/dist/core/planner/lifecycle-phase.js.map +1 -1
- package/dist/core/planner/next-task.d.ts.map +1 -1
- package/dist/core/planner/next-task.js +12 -3
- package/dist/core/planner/next-task.js.map +1 -1
- package/dist/core/planner/planning-report.d.ts.map +1 -1
- package/dist/core/planner/planning-report.js +2 -2
- package/dist/core/planner/planning-report.js.map +1 -1
- package/dist/core/planner/velocity.d.ts.map +1 -1
- package/dist/core/planner/velocity.js +1 -3
- package/dist/core/planner/velocity.js.map +1 -1
- package/dist/core/rag/phase-metadata.d.ts +2 -2
- package/dist/core/rag/phase-metadata.d.ts.map +1 -1
- package/dist/core/rag/phase-metadata.js +3 -4
- package/dist/core/rag/phase-metadata.js.map +1 -1
- package/dist/core/rag/phase-summary.d.ts.map +1 -1
- package/dist/core/rag/phase-summary.js +3 -3
- package/dist/core/rag/phase-summary.js.map +1 -1
- package/dist/core/reviewer/review-readiness.d.ts.map +1 -1
- package/dist/core/reviewer/review-readiness.js +5 -14
- package/dist/core/reviewer/review-readiness.js.map +1 -1
- package/dist/core/store/knowledge-store.js +2 -2
- package/dist/core/store/knowledge-store.js.map +1 -1
- package/dist/core/store/sqlite-store.js +1 -1
- package/dist/core/store/sqlite-store.js.map +1 -1
- package/dist/core/utils/ac-helpers.d.ts +14 -0
- package/dist/core/utils/ac-helpers.d.ts.map +1 -0
- package/dist/core/utils/ac-helpers.js +26 -0
- package/dist/core/utils/ac-helpers.js.map +1 -0
- package/dist/core/utils/constants.d.ts +10 -0
- package/dist/core/utils/constants.d.ts.map +1 -1
- package/dist/core/utils/constants.js +12 -0
- package/dist/core/utils/constants.js.map +1 -1
- package/dist/core/utils/errors.d.ts +2 -0
- package/dist/core/utils/errors.d.ts.map +1 -1
- package/dist/core/utils/errors.js +4 -0
- package/dist/core/utils/errors.js.map +1 -1
- package/dist/core/utils/grading.d.ts +8 -0
- package/dist/core/utils/grading.d.ts.map +1 -0
- package/dist/core/utils/grading.js +17 -0
- package/dist/core/utils/grading.js.map +1 -0
- package/dist/core/utils/node-type-sets.d.ts +17 -0
- package/dist/core/utils/node-type-sets.d.ts.map +1 -0
- package/dist/core/utils/node-type-sets.js +23 -0
- package/dist/core/utils/node-type-sets.js.map +1 -0
- package/dist/core/utils/xp-sizing.d.ts +16 -0
- package/dist/core/utils/xp-sizing.d.ts.map +1 -0
- package/dist/core/utils/xp-sizing.js +20 -0
- package/dist/core/utils/xp-sizing.js.map +1 -0
- package/dist/core/validator/definition-of-ready.d.ts.map +1 -1
- package/dist/core/validator/definition-of-ready.js +2 -12
- package/dist/core/validator/definition-of-ready.js.map +1 -1
- package/dist/core/validator/done-integrity-checker.d.ts.map +1 -1
- package/dist/core/validator/done-integrity-checker.js +1 -1
- package/dist/core/validator/done-integrity-checker.js.map +1 -1
- package/dist/core/validator/status-flow-checker.d.ts.map +1 -1
- package/dist/core/validator/status-flow-checker.js +1 -1
- package/dist/core/validator/status-flow-checker.js.map +1 -1
- package/dist/mcp/lifecycle-wrapper.d.ts +0 -4
- package/dist/mcp/lifecycle-wrapper.d.ts.map +1 -1
- package/dist/mcp/lifecycle-wrapper.js +5 -1
- package/dist/mcp/lifecycle-wrapper.js.map +1 -1
- package/dist/mcp/response-helpers.d.ts +20 -0
- package/dist/mcp/response-helpers.d.ts.map +1 -0
- package/dist/mcp/response-helpers.js +26 -0
- package/dist/mcp/response-helpers.js.map +1 -0
- package/dist/mcp/tools/add-node.d.ts.map +1 -1
- package/dist/mcp/tools/add-node.js +6 -16
- package/dist/mcp/tools/add-node.js.map +1 -1
- package/dist/mcp/tools/analyze.d.ts.map +1 -1
- package/dist/mcp/tools/analyze.js +29 -39
- package/dist/mcp/tools/analyze.js.map +1 -1
- package/dist/mcp/tools/clone-node.d.ts.map +1 -1
- package/dist/mcp/tools/clone-node.js +5 -28
- package/dist/mcp/tools/clone-node.js.map +1 -1
- package/dist/mcp/tools/context.d.ts.map +1 -1
- package/dist/mcp/tools/context.js +3 -14
- package/dist/mcp/tools/context.js.map +1 -1
- package/dist/mcp/tools/delete-node.d.ts.map +1 -1
- package/dist/mcp/tools/delete-node.js +3 -14
- package/dist/mcp/tools/delete-node.js.map +1 -1
- package/dist/mcp/tools/edge.d.ts.map +1 -1
- package/dist/mcp/tools/edge.js +18 -60
- package/dist/mcp/tools/edge.js.map +1 -1
- package/dist/mcp/tools/export.d.ts.map +1 -1
- package/dist/mcp/tools/export.js +14 -7
- package/dist/mcp/tools/export.js.map +1 -1
- package/dist/mcp/tools/import-prd.d.ts.map +1 -1
- package/dist/mcp/tools/import-prd.js +16 -34
- package/dist/mcp/tools/import-prd.js.map +1 -1
- package/dist/mcp/tools/init.d.ts.map +1 -1
- package/dist/mcp/tools/init.js +2 -8
- package/dist/mcp/tools/init.js.map +1 -1
- package/dist/mcp/tools/list-skills.d.ts.map +1 -1
- package/dist/mcp/tools/list-skills.js +16 -31
- package/dist/mcp/tools/list-skills.js.map +1 -1
- package/dist/mcp/tools/list.d.ts.map +1 -1
- package/dist/mcp/tools/list.js +12 -12
- package/dist/mcp/tools/list.js.map +1 -1
- package/dist/mcp/tools/manage-skill.d.ts.map +1 -1
- package/dist/mcp/tools/manage-skill.js +29 -86
- package/dist/mcp/tools/manage-skill.js.map +1 -1
- package/dist/mcp/tools/memory.d.ts.map +1 -1
- package/dist/mcp/tools/memory.js +17 -47
- package/dist/mcp/tools/memory.js.map +1 -1
- package/dist/mcp/tools/metrics.d.ts.map +1 -1
- package/dist/mcp/tools/metrics.js +9 -22
- package/dist/mcp/tools/metrics.js.map +1 -1
- package/dist/mcp/tools/move-node.d.ts.map +1 -1
- package/dist/mcp/tools/move-node.js +10 -36
- package/dist/mcp/tools/move-node.js.map +1 -1
- package/dist/mcp/tools/next.d.ts.map +1 -1
- package/dist/mcp/tools/next.js +22 -27
- package/dist/mcp/tools/next.js.map +1 -1
- package/dist/mcp/tools/node.d.ts.map +1 -1
- package/dist/mcp/tools/node.js +15 -37
- package/dist/mcp/tools/node.js.map +1 -1
- package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
- package/dist/mcp/tools/plan-sprint.js +15 -29
- package/dist/mcp/tools/plan-sprint.js.map +1 -1
- package/dist/mcp/tools/rag-context.d.ts.map +1 -1
- package/dist/mcp/tools/rag-context.js +5 -17
- package/dist/mcp/tools/rag-context.js.map +1 -1
- package/dist/mcp/tools/reindex-knowledge.d.ts.map +1 -1
- package/dist/mcp/tools/reindex-knowledge.js +2 -8
- package/dist/mcp/tools/reindex-knowledge.js.map +1 -1
- package/dist/mcp/tools/search.d.ts.map +1 -1
- package/dist/mcp/tools/search.js +2 -8
- package/dist/mcp/tools/search.js.map +1 -1
- package/dist/mcp/tools/set-phase.d.ts.map +1 -1
- package/dist/mcp/tools/set-phase.js +17 -46
- package/dist/mcp/tools/set-phase.js.map +1 -1
- package/dist/mcp/tools/show.d.ts.map +1 -1
- package/dist/mcp/tools/show.js +13 -24
- package/dist/mcp/tools/show.js.map +1 -1
- package/dist/mcp/tools/snapshot.d.ts.map +1 -1
- package/dist/mcp/tools/snapshot.js +5 -21
- package/dist/mcp/tools/snapshot.js.map +1 -1
- package/dist/mcp/tools/sync-stack-docs.d.ts.map +1 -1
- package/dist/mcp/tools/sync-stack-docs.js +8 -17
- package/dist/mcp/tools/sync-stack-docs.js.map +1 -1
- package/dist/mcp/tools/update-node.d.ts.map +1 -1
- package/dist/mcp/tools/update-node.js +3 -14
- package/dist/mcp/tools/update-node.js.map +1 -1
- package/dist/mcp/tools/update-status.d.ts.map +1 -1
- package/dist/mcp/tools/update-status.js +40 -24
- package/dist/mcp/tools/update-status.js.map +1 -1
- package/dist/mcp/tools/validate-ac.d.ts.map +1 -1
- package/dist/mcp/tools/validate-ac.js +2 -8
- package/dist/mcp/tools/validate-ac.js.map +1 -1
- package/dist/mcp/tools/validate-task.d.ts.map +1 -1
- package/dist/mcp/tools/validate-task.js +2 -6
- package/dist/mcp/tools/validate-task.js.map +1 -1
- package/dist/mcp/tools/validate.d.ts.map +1 -1
- package/dist/mcp/tools/validate.js +4 -10
- package/dist/mcp/tools/validate.js.map +1 -1
- package/dist/schemas/analyzer-schema.d.ts +7 -6
- package/dist/schemas/analyzer-schema.d.ts.map +1 -1
- package/dist/schemas/analyzer-schema.js +3 -1
- package/dist/schemas/analyzer-schema.js.map +1 -1
- package/dist/schemas/designer-schema.d.ts +16 -14
- package/dist/schemas/designer-schema.d.ts.map +1 -1
- package/dist/schemas/designer-schema.js +8 -15
- package/dist/schemas/designer-schema.js.map +1 -1
- package/dist/schemas/grade-schema.d.ts +13 -0
- package/dist/schemas/grade-schema.d.ts.map +1 -0
- package/dist/schemas/grade-schema.js +6 -0
- package/dist/schemas/grade-schema.js.map +1 -0
- package/dist/schemas/implementer-schema.d.ts +2 -0
- package/dist/schemas/implementer-schema.d.ts.map +1 -1
- package/dist/schemas/implementer-schema.js +6 -2
- package/dist/schemas/implementer-schema.js.map +1 -1
- package/dist/schemas/listener-schema.d.ts +2 -0
- package/dist/schemas/listener-schema.d.ts.map +1 -1
- package/dist/schemas/listener-schema.js +2 -0
- package/dist/schemas/listener-schema.js.map +1 -1
- package/dist/schemas/readiness-schema.d.ts +44 -0
- package/dist/schemas/readiness-schema.d.ts.map +1 -0
- package/dist/schemas/readiness-schema.js +22 -0
- package/dist/schemas/readiness-schema.js.map +1 -0
- package/dist/web/dashboard/dist/assets/{benchmark-tab-BW4QxI49.js → benchmark-tab-C5fwIqgM.js} +1 -1
- package/dist/web/dashboard/dist/assets/{constants-kpH_c6vY.js → constants-z0QkAiYv.js} +1 -1
- package/dist/web/dashboard/dist/assets/{context-tab-C5RAlXNW.js → context-tab-ChCyrRlr.js} +1 -1
- package/dist/web/dashboard/dist/assets/{gitnexus-tab-BnxxYl2F.js → gitnexus-tab-DnlGT63w.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-tab-Cv_wQ6Az.js → graph-tab-DjV9RD41.js} +1 -1
- package/dist/web/dashboard/dist/assets/{graph-utils-Ds1zJyD1.js → graph-utils-C6bvcT4d.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-Bic_URMs.js → index-DlZhNCGR.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-BAeZDWWy.js → index-dCyMex_p.js} +2 -2
- package/dist/web/dashboard/dist/assets/{insights-tab-U_ATOqPu.js → insights-tab-Cj4f85vS.js} +1 -1
- package/dist/web/dashboard/dist/assets/{logs-tab-B8psCXuB.js → logs-tab-C4C2Vn8-.js} +1 -1
- package/dist/web/dashboard/dist/assets/{memories-tab-DcWok2by.js → memories-tab-NtNwoxbT.js} +1 -1
- package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CjftveTc.js → prd-backlog-tab-Bxt7qiVG.js} +1 -1
- package/dist/web/dashboard/dist/assets/skills-tab-CIj4z1Ol.js +1 -0
- package/dist/web/dashboard/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/dashboard/dist/assets/skills-tab-Ddp1w4vS.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r,a as f,j as t}from"./index-
|
|
1
|
+
import{r,a as f,j as t}from"./index-dCyMex_p.js";function w(){const[l,o]=r.useState([]),[n,v]=r.useState(!0),d=r.useRef(0),p=r.useCallback(async()=>{try{const{logs:c}=await f.getLogs();o(c),c.length>0&&(d.current=c[c.length-1].id)}finally{v(!1)}},[]),u=r.useCallback(async()=>{await f.clearLogs(),o([]),d.current=0},[]);return r.useEffect(()=>{p()},[p]),r.useEffect(()=>{const c=new EventSource("/api/v1/events"),i=b=>{try{const s=JSON.parse(b.data),a={id:s.payload.id,level:s.payload.level,message:s.payload.message,context:s.payload.context,timestamp:s.timestamp};a.id>d.current&&(d.current=a.id,o(h=>[...h,a]))}catch{}};return c.addEventListener("log:entry",i),c.onerror=()=>{c.close(),setTimeout(()=>{},5e3)},()=>c.close()},[]),{logs:l,loading:n,clearLogs:u,refresh:p}}const k={info:"bg-blue-500/20 text-blue-400",warn:"bg-yellow-500/20 text-yellow-400",error:"bg-red-500/20 text-red-400",success:"bg-green-500/20 text-green-400",debug:"bg-gray-500/20 text-gray-400"},E=["info","warn","error","success","debug"];function y(l){return new Date(l).toLocaleTimeString("en-US",{hour12:!1})}function L(l){return!l||Object.keys(l).length===0?"":Object.entries(l).map(([o,n])=>`${o}="${String(n)}"`).join(" ")}function j(l){return l.map(o=>{const n=L(o.context);return`[${y(o.timestamp)}] [${o.level.toUpperCase()}] ${o.message}${n?" "+n:""}`}).join(`
|
|
2
2
|
`)}function O(){const{logs:l,loading:o,clearLogs:n,refresh:v}=w(),[d,p]=r.useState("all"),[u,c]=r.useState(""),[i,b]=r.useState(!0),s=r.useRef(null),a=r.useMemo(()=>{let e=l;if(d!=="all"&&(e=e.filter(x=>x.level===d)),u.trim()){const x=u.toLowerCase();e=e.filter(g=>g.message.toLowerCase().includes(x))}return e},[l,d,u]);r.useEffect(()=>{i&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[a,i]);const h=r.useCallback(()=>{if(!s.current)return;const{scrollTop:e,scrollHeight:x,clientHeight:g}=s.current,m=x-e-g<40;b(m)},[]),C=r.useCallback(async()=>{const e=j(a);await navigator.clipboard.writeText(e)},[a]),N=r.useCallback(()=>{const e=j(a),x=new Blob([e],{type:"text/plain"}),g=URL.createObjectURL(x),m=document.createElement("a");m.href=g,m.download=`mcp-graph-logs-${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.txt`,m.click(),URL.revokeObjectURL(g)},[a]),S=r.useCallback(async()=>{await n()},[n]);return o?t.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading logs..."}):t.jsxs("div",{className:"flex flex-col h-full","data-testid":"logs-tab",children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[t.jsxs("select",{value:d,onChange:e=>p(e.target.value),className:"px-2 py-1 text-sm rounded border border-[var(--color-border)] bg-[var(--color-bg)] text-[var(--color-text)]","data-testid":"log-level-filter",children:[t.jsx("option",{value:"all",children:"All Levels"}),E.map(e=>t.jsx("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))]}),t.jsx("input",{type:"text",value:u,onChange:e=>c(e.target.value),placeholder:"Search logs...",className:"flex-1 px-2 py-1 text-sm rounded border border-[var(--color-border)] bg-[var(--color-bg)] text-[var(--color-text)] placeholder:text-[var(--color-text-muted)]","data-testid":"log-search"}),t.jsx("button",{onClick:()=>b(!i),className:`px-2 py-1 text-xs rounded border ${i?"border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)]"}`,title:i?"Auto-scroll enabled":"Auto-scroll paused",children:i?"Auto-scroll ON":"Auto-scroll OFF"}),t.jsx("button",{onClick:C,className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Copy all visible logs",children:"Copy"}),t.jsx("button",{onClick:N,className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Download logs as .txt",children:"Download"}),t.jsx("button",{onClick:S,className:"px-2 py-1 text-xs rounded border border-red-500/30 text-red-400 hover:bg-red-500/10",title:"Clear all logs",children:"Clear"}),t.jsx("button",{onClick:()=>void v(),className:"px-2 py-1 text-xs rounded border border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Refresh logs",children:"Refresh"}),t.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[a.length," entries"]})]}),t.jsx("div",{ref:s,onScroll:h,className:"flex-1 overflow-y-auto font-mono text-xs p-2","data-testid":"log-list",children:a.length===0?t.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"No logs to display"}):a.map(e=>t.jsxs("div",{className:"flex items-start gap-2 py-0.5 hover:bg-[var(--color-bg-secondary)]",children:[t.jsx("span",{className:"text-[var(--color-text-muted)] shrink-0",children:y(e.timestamp)}),t.jsx("span",{className:`px-1.5 py-0 rounded text-[10px] font-semibold uppercase shrink-0 ${k[e.level]}`,children:e.level}),t.jsx("span",{className:"text-[var(--color-text)]",children:e.message}),e.context&&Object.keys(e.context).length>0&&t.jsx("span",{className:"text-[var(--color-text-muted)]",children:L(e.context)})]},e.id))})]})}export{O as LogsTab};
|
package/dist/web/dashboard/dist/assets/{memories-tab-DcWok2by.js → memories-tab-NtNwoxbT.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,a as b,j as e}from"./index-
|
|
1
|
+
import{r as i,a as b,j as e}from"./index-dCyMex_p.js";function j(t){const c=[];for(const l of t){const o=l.name.split("/");let a=c;for(let n=0;n<o.length;n++){const r=o[n],x=o.slice(0,n+1).join("/"),d=n===o.length-1;let s=a.find(f=>f.name===r);s||(s={name:r,path:x,children:[]},d&&(s.memory=l),a.push(s)),d&&!s.memory&&(s.memory=l),a=s.children}}return c}function S(){const[t,c]=i.useState([]),[l,o]=i.useState(null),[a,n]=i.useState(null),[r,x]=i.useState(!0),d=i.useCallback(async()=>{try{x(!0);const s=await b.getMemories().catch(()=>[]);c(s)}catch(s){n(s instanceof Error?s.message:"Failed to load")}finally{x(!1)}},[]);return i.useEffect(()=>{d()},[d]),r?e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading Memories..."}):a?e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load: ",a]}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Memories"}),e.jsx(g,{label:"Memories",active:t.length>0}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[t.length," memories"]})]}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(N,{memories:t,selectedMemory:l,onSelect:o}),e.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:e.jsx(y,{selectedMemory:l})})]})]})}function g({label:t,active:c}){const l=c?"var(--color-success)":"var(--color-text-muted)",o=c?"Active":"No data";return e.jsxs("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded-full",style:{background:`${l}20`,color:l},children:[t,": ",o]})}function N({memories:t,selectedMemory:c,onSelect:l}){const[o,a]=i.useState(""),[n,r]=i.useState(!1),[x,d]=i.useState(new Set),s=i.useMemo(()=>{if(!o.trim())return t;const m=o.toLowerCase();return t.filter(p=>p.name.toLowerCase().includes(m))},[t,o]),f=i.useMemo(()=>j(s),[s]),v=i.useCallback(m=>{d(p=>{const u=new Set(p);return u.has(m)?u.delete(m):u.add(m),u})},[]);return n?e.jsx("div",{className:"w-8 border-r border-[var(--color-border)] bg-[var(--color-bg-secondary)] flex flex-col items-center pt-2",children:e.jsx("button",{onClick:()=>r(!1),className:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text)] rotate-90",title:"Expand file explorer",children:"Files"})}):e.jsxs("div",{className:"w-64 border-r border-[var(--color-border)] bg-[var(--color-bg-secondary)] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-[var(--color-border)]",children:[e.jsx("span",{className:"text-[10px] font-semibold text-[var(--color-text-muted)] uppercase tracking-wider",children:"Files"}),e.jsx("button",{onClick:()=>r(!0),className:"text-[10px] text-[var(--color-text-muted)] hover:text-[var(--color-text)]",title:"Collapse",children:"✕"})]}),e.jsx("div",{className:"px-2 py-1.5 border-b border-[var(--color-border)]",children:e.jsx("input",{type:"text",value:o,onChange:m=>a(m.target.value),placeholder:"Search files...",className:"w-full text-[11px] px-2 py-1 rounded bg-[var(--color-bg)] border border-[var(--color-border)] focus:outline-none focus:border-[var(--color-accent)]"})}),e.jsx("div",{className:"flex-1 overflow-y-auto text-[11px]",children:t.length===0?e.jsx("div",{className:"px-2 py-4 text-center text-[var(--color-text-muted)]",children:"No memories"}):e.jsx(h,{nodes:f,depth:0,expandedPaths:x,onToggle:v,selectedMemory:c,onSelect:l})})]})}function h({nodes:t,depth:c,expandedPaths:l,onToggle:o,selectedMemory:a,onSelect:n}){return e.jsx(e.Fragment,{children:t.map(r=>{const x=r.children.length>0,d=l.has(r.path),s=r.memory!=null&&(a==null?void 0:a.name)===r.memory.name;return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>{x&&o(r.path),r.memory&&n(r.memory)},className:`w-full text-left px-2 py-0.5 flex items-center gap-1 hover:bg-[var(--color-bg-tertiary)] transition-colors ${s?"bg-[var(--color-accent)]15 text-[var(--color-accent)]":"text-[var(--color-text)]"}`,style:{paddingLeft:`${c*12+8}px`},children:[x?e.jsx("span",{className:"w-3 text-[9px] text-[var(--color-text-muted)]",children:d?"▾":"▸"}):e.jsx("span",{className:"w-3 text-[9px] text-[var(--color-text-muted)]",children:"·"}),e.jsx("span",{className:"truncate",children:r.name})]}),x&&d&&e.jsx(h,{nodes:r.children,depth:c+1,expandedPaths:l,onToggle:o,selectedMemory:a,onSelect:n})]},r.path)})})}function y({selectedMemory:t}){return t?e.jsxs("div",{className:"p-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-3 pb-2 border-b border-[var(--color-border)]",children:e.jsx("span",{className:"text-sm font-semibold",children:t.name})}),e.jsx("pre",{className:"text-xs whitespace-pre-wrap text-[var(--color-text-muted)] font-mono leading-relaxed",children:t.content})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm mb-1",children:"Select a memory from the explorer"}),e.jsx("p",{className:"text-xs",children:"Project memories appear as navigable files"})]})})}export{S as MemoriesTab};
|
package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CjftveTc.js → prd-backlog-tab-Bxt7qiVG.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e}from"./index-
|
|
1
|
+
import{r as a,j as e}from"./index-dCyMex_p.js";import{R as _,u as M,a as E,h as P,b as T,g as B,t as D,d as R,e as F,i as $,W as z,f as I,B as L,C as A,N as O}from"./graph-utils-C6bvcT4d.js";import{S as y}from"./constants-z0QkAiYv.js";import"./index-DlZhNCGR.js";const V=a.memo(function({graph:c,onNodeClick:N}){const{groups:w,nextTask:h,nodeMap:g}=a.useMemo(()=>{const d=c.nodes.filter(s=>s.type==="task"||s.type==="subtask"),x=new Map(c.nodes.map(s=>[s.id,s])),m=new Set(c.nodes.filter(s=>s.status==="done").map(s=>s.id)),f=d.filter(s=>s.status!=="backlog"&&s.status!=="ready"||s.blocked?!1:c.edges.filter(r=>r.from===s.id&&r.relationType==="depends_on").every(r=>m.has(r.to)));f.sort((s,t)=>s.priority-t.priority);const i=new Map;for(const s of d){const t=s.parentId||"__root__";i.has(t)||i.set(t,[]),i.get(t).push(s)}for(const s of i.values())s.sort((t,r)=>t.priority-r.priority);return{groups:i,nextTask:f[0]||null,nodeMap:x}},[c]);return c.nodes.filter(d=>d.type==="task"||d.type==="subtask").length===0?e.jsx("div",{className:"p-4 text-center text-[var(--color-text-muted)]",children:"No tasks in backlog."}):e.jsxs("div",{className:"p-2",children:[h&&e.jsxs("div",{className:"mb-3 px-3 py-2 bg-[var(--color-accent)]10 border border-[var(--color-accent)] rounded-lg",children:[e.jsx("span",{className:"text-xs font-medium text-[var(--color-accent)]",children:"Next:"})," ",e.jsx("span",{className:"text-sm font-semibold",children:h.title})]}),Array.from(w.entries()).map(([d,x])=>{const m=d!=="__root__"?g.get(d):null,f=m?m.title:"Ungrouped Tasks",i=x.filter(t=>t.status==="done").length,s=Math.round(i/x.length*100);return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1",children:[e.jsx("h4",{className:"text-xs font-semibold truncate",children:f}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[i,"/",x.length]})]}),e.jsx("div",{className:"h-1 mx-2 mb-1 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:y.done}})}),x.map(t=>{const r=(h==null?void 0:h.id)===t.id,v=y[t.status]||"#9e9e9e",j=c.edges.filter(n=>n.from===t.id&&n.relationType==="depends_on").map(n=>{var l;return((l=g.get(n.to))==null?void 0:l.title)||n.to});return e.jsxs("div",{onClick:()=>N(t),className:`mx-1 mb-1 px-2 py-1.5 rounded cursor-pointer hover:bg-[var(--color-bg-tertiary)] transition-colors ${r?"ring-1 ring-[var(--color-accent)]":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded font-medium shrink-0",style:{background:`${v}20`,color:v},children:t.status.replace("_"," ")}),e.jsx("span",{className:"text-xs truncate flex-1",children:t.title}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["P",t.priority]}),t.xpSize&&e.jsx("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:t.xpSize})]}),j.length>0&&e.jsxs("div",{className:"text-[10px] text-[var(--color-text-muted)] mt-0.5 truncate pl-1",children:["Depends on: ",j.join(", ")]})]},t.id)})]},d)})]})}),W={workflowNode:I},U={workflowEdge:z},Z={hideAttribution:!0};function G({graph:o}){const[c,N,w]=M([]),[h,g,d]=E([]),[x,m]=a.useState(null),[f,i]=a.useState(new Set),s=a.useRef(!0),{fitView:t}=P(),r=a.useMemo(()=>T(o.nodes,o.edges),[o.nodes,o.edges]),v=a.useCallback(l=>{i(u=>{const p=new Set(u);return p.has(l)?p.delete(l):p.add(l),p})},[]);a.useEffect(()=>{const l=B(o.nodes,f,r),u=D(l,void 0,r,f,v),p=new Set(u.map(S=>S.id)),k=R(o.edges,p),b=F(u,k,"TB");N(b.nodes),g(b.edges),s.current?s.current=!1:setTimeout(()=>t({duration:300}),50)},[o,N,g,f,r,v,t]);const C=a.useCallback((l,u)=>{m(u.data.sourceNode)},[]),j=a.useCallback(l=>{m(l)},[]),n=a.useMemo(()=>{const l=o.nodes.length,u=o.nodes.filter(b=>b.status==="done").length,p=o.nodes.filter(b=>b.status==="in_progress").length,k=o.nodes.filter(b=>b.status==="blocked").length;return{total:l,done:u,inProgress:p,blocked:k,pctDone:l?Math.round(u/l*100):0}},[o.nodes]);return e.jsxs("div",{className:"flex h-full",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-1.5 bg-[var(--color-bg-secondary)] border-b border-[var(--color-border)] flex items-center gap-2 text-xs relative z-10",children:e.jsxs("span",{className:"text-[var(--color-text-muted)]",children:["Showing ",c.length," of ",o.nodes.length," nodes — click ▶ to expand"]})}),o.nodes.length>0?e.jsxs($,{nodes:c,edges:h,onNodesChange:w,onEdgesChange:d,onNodeClick:C,nodeTypes:W,edgeTypes:U,nodesDraggable:!1,nodesConnectable:!1,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Z,children:[e.jsx(L,{gap:16,size:1}),e.jsx(A,{showInteractive:!1})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Import a PRD to see the workflow"})]}),e.jsxs("div",{className:"w-96 border-l border-[var(--color-border)] flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-[var(--color-border)] bg-[var(--color-bg-secondary)]",children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsxs("span",{children:[n.done,"/",n.total," done (",n.pctDone,"%)"]}),e.jsxs("span",{className:"text-[var(--color-text-muted)]",children:[n.inProgress," in progress, ",n.blocked," blocked"]})]}),e.jsxs("div",{className:"h-2 bg-[var(--color-bg-tertiary)] rounded-full overflow-hidden flex",children:[e.jsx("div",{className:"h-full transition-all",style:{width:`${n.pctDone}%`,background:y.done}}),e.jsx("div",{className:"h-full transition-all",style:{width:`${n.total?Math.round(n.inProgress/n.total*100):0}%`,background:y.in_progress}})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(V,{graph:o,onNodeClick:j})})]}),x&&e.jsx(O,{node:x,onClose:()=>m(null)})]})}function Q({graph:o}){return e.jsx(_,{children:e.jsx(G,{graph:o})})}export{Q as PrdBacklogTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,a as k,j as e}from"./index-dCyMex_p.js";import{P,L as O}from"./constants-z0QkAiYv.js";function D(){const[t,s]=a.useState([]),[x,l]=a.useState([]),[i,n]=a.useState(0),[m,h]=a.useState(!0),[b,v]=a.useState(null),d=a.useCallback(async()=>{h(!0),v(null);try{const[o,u]=await Promise.all([k.getSkills(),k.getRecommendations().catch(()=>({recommendations:[]}))]);s(o.skills),n(o.totalTokens),l(u.recommendations)}catch(o){v(o instanceof Error?o.message:"Failed to load skills")}finally{h(!1)}},[]);a.useEffect(()=>{d()},[d]);const j=a.useCallback(async(o,u)=>{s(C=>C.map(N=>N.name===o?{...N,enabled:u}:N));try{await k.toggleSkill(o,u)}catch{d()}},[d]),p=a.useCallback(async o=>{await k.createCustomSkill(o),d()},[d]),y=a.useCallback(async(o,u)=>{await k.updateCustomSkill(o,u),d()},[d]),f=a.useCallback(async o=>{await k.deleteCustomSkill(o),d()},[d]),g=t.filter(o=>o.enabled).reduce((o,u)=>o+u.estimatedTokens,0);return{skills:t,recommendations:x,totalTokens:i,activeTokens:g,loading:m,error:b,refresh:d,toggleSkill:j,createSkill:p,updateSkill:y,deleteSkill:f}}function A({skill:t,onClose:s,onToggle:x,onDelete:l,onEdit:i}){return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n=>{n.target===n.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[80vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold truncate",children:t.name}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium ${t.source==="built-in"?"bg-blue-500/10 text-blue-500":t.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-gray-500/10 text-gray-500"}`,children:t.source}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:t.category}),e.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tokens"]})]}),t.phases&&t.phases.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:t.phases.map(n=>{const m=P[n]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${m}20`,color:m},children:n},n)})}),e.jsx("div",{className:"flex items-center gap-3 mb-4 p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:n=>x(t.name,n.target.checked),className:"w-4 h-4 accent-[var(--color-accent)]"}),t.enabled?"Enabled":"Disabled"]})}),t.source==="custom"&&e.jsxs("div",{className:"flex gap-2",children:[i&&e.jsx("button",{onClick:()=>i(t),className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Edit"}),l&&t.id&&e.jsx("button",{onClick:()=>l(t.id),className:"px-3 py-1.5 text-sm text-red-500 border border-red-500/30 rounded hover:bg-red-500/10",children:"Delete"})]})]})}):null}const F=["know-me","software-design","security","testing","cost-reducer","research","ddd","frontend-design","other"];function z({open:t,onClose:s,onSubmit:x,editSkill:l}){const[i,n]=a.useState(""),[m,h]=a.useState(""),[b,v]=a.useState("know-me"),[d,j]=a.useState(["IMPLEMENT"]),[p,y]=a.useState(""),[f,g]=a.useState(!1),[o,u]=a.useState(null);a.useEffect(()=>{l?(n(l.name),h(l.description),v(l.category),j(l.phases??["IMPLEMENT"]),y("")):(n(""),h(""),v("know-me"),j(["IMPLEMENT"]),y("")),u(null)},[l,t]);const C=a.useCallback(r=>{j(S=>S.includes(r)?S.filter(T=>T!==r):[...S,r])},[]),N=a.useCallback(async()=>{if(!i.trim()||!m.trim()||!p.trim()||d.length===0){u("All fields are required and at least one phase must be selected.");return}g(!0),u(null);try{await x({name:i.trim(),description:m.trim(),category:b,phases:d,instructions:p.trim()}),s()}catch(r){u(r instanceof Error?r.message:"Failed to save skill")}finally{g(!1)}},[i,m,b,d,p,x,s]);return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r=>{r.target===r.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:l?"Edit Skill":"Create Custom Skill"}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Name"}),e.jsx("input",{type:"text",value:i,onChange:r=>n(r.target.value),placeholder:"my-workflow",disabled:!!l,className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Description"}),e.jsx("input",{type:"text",value:m,onChange:r=>h(r.target.value),placeholder:"What does this skill do?",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Category"}),e.jsx("select",{value:b,onChange:r=>v(r.target.value),className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:F.map(r=>e.jsx("option",{value:r,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Phases"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:O.map(r=>e.jsx("button",{type:"button",onClick:()=>C(r),className:`px-2 py-1 text-[10px] font-medium rounded-full border transition-colors ${d.includes(r)?"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)] hover:border-[var(--color-text)]"}`,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Instructions"}),e.jsx("textarea",{value:p,onChange:r=>y(r.target.value),rows:6,placeholder:"Instructions for the AI agent when this skill is active...",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] resize-y"})]}),o&&e.jsx("div",{className:"text-sm p-2 rounded bg-red-500/10 text-red-500",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:s,className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Cancel"}),e.jsx("button",{onClick:N,disabled:f,className:"px-3 py-1.5 text-sm bg-[var(--color-accent)] text-white rounded hover:opacity-90 disabled:opacity-50",children:f?"Saving...":l?"Update":"Create"})]})]})]})}):null}const I=4e3;function w({value:t,label:s}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] text-center","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xl font-bold",children:t}),e.jsx("div",{className:"text-[10px] text-[var(--color-text-muted)] uppercase",children:s})]})}function _({phase:t}){const s=P[t]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${s}20`,color:s},children:t})}function G({source:t}){const s={"built-in":"bg-[var(--color-accent)]/10 text-[var(--color-accent)]",filesystem:"bg-[var(--color-text-muted)]/10 text-[var(--color-text-muted)]",custom:"bg-purple-500/10 text-purple-500"};return e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${s[t]}`,children:t})}function H({skill:t,onToggle:s,onClick:x}){return e.jsxs("div",{className:`p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] cursor-pointer hover:border-[var(--color-accent)]/50 transition-all ${t.enabled?"":"opacity-50"}`,onClick:()=>x(t),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium truncate",children:t.name}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>{l.stopPropagation(),s(t.name,l.target.checked)},onClick:l=>l.stopPropagation(),className:"w-3.5 h-3.5 accent-[var(--color-accent)]"}),e.jsx(G,{source:t.source}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tok"]})]})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)] line-clamp-2",children:t.description})]})}function B({phase:t,skills:s,onToggle:x,onSkillClick:l}){const[i,n]=a.useState(!0),m=P[t]??"#6b7280",h=s.filter(b=>b.enabled).length;return e.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>n(!i),className:"w-full flex items-center justify-between px-3 py-2 text-xs font-medium hover:bg-[var(--color-bg-tertiary)] transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:m}}),t,e.jsxs("span",{className:"px-1.5 py-0.5 rounded-full bg-[var(--color-border)] text-[10px]",children:[h,"/",s.length]})]}),e.jsx("span",{className:"text-[var(--color-text-muted)]",children:i?"▲":"▼"})]}),i&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:s.map(b=>e.jsx(H,{skill:b,onToggle:x,onClick:l},b.name))})]})}function U({rec:t}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-accent)]/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium",children:t.skill}),e.jsx(_,{phase:t.phase})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:t.reason})]})}function q({totalTokens:t,activeTokens:s}){const x=Math.min(s/I,1),l=Math.min(t/I,1),i=Math.round(x*100),n=x>.8?"#ef4444":x>.5?"#f59e0b":"#10b981";return e.jsxs("div",{"data-testid":"token-budget-bar",className:"p-4 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[s.toLocaleString()," active / ",t.toLocaleString()," total (",i,"%)"]})]}),e.jsxs("div",{className:"w-full h-2 rounded-full bg-[var(--color-border)] relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-30",style:{width:`${Math.round(l*100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${i}%`,background:n}})]})]})}function Y(){const{skills:t,recommendations:s,totalTokens:x,activeTokens:l,loading:i,error:n,refresh:m,toggleSkill:h,createSkill:b,updateSkill:v,deleteSkill:d}=D(),[j,p]=a.useState(null),[y,f]=a.useState(!1),[g,o]=a.useState(null),u=a.useCallback(async c=>{await d(c),p(null)},[d]),C=a.useCallback(c=>{p(null),o(c),f(!0)},[]),N=a.useCallback(async c=>{g!=null&&g.id?await v(g.id,c):await b(c),o(null)},[g,b,v]);if(n)return e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load skills: ",n]});if(i)return e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading skills..."});const r=t.filter(c=>c.source==="built-in").length,S=t.filter(c=>c.source==="custom").length,T=t.filter(c=>c.enabled).length,M=new Map;for(const c of O){const E=t.filter($=>{var R;return(R=$.phases)==null?void 0:R.includes(c)});E.length>0&&M.set(c,E)}const L=t.filter(c=>!c.phases||c.phases.length===0);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Skills"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{o(null),f(!0)},className:"text-xs px-3 py-1.5 rounded-lg border border-[var(--color-accent)] text-[var(--color-accent)] hover:bg-[var(--color-accent)]/10 transition-colors",children:"+ Custom Skill"}),e.jsx("button",{onClick:()=>void m(),className:"text-xs px-3 py-1.5 rounded-lg bg-[var(--color-accent)] text-white hover:opacity-90 transition-opacity",children:"Refresh"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3","data-testid":"skills-stats",children:[e.jsx(w,{value:t.length,label:"Total Skills"}),e.jsx(w,{value:r,label:"Built-in"}),e.jsx(w,{value:S,label:"Custom"}),e.jsx(w,{value:T,label:"Enabled"}),e.jsx(w,{value:l.toLocaleString(),label:"Active Tokens"})]}),e.jsx(q,{totalTokens:x,activeTokens:l}),s.length>0&&e.jsxs("div",{"data-testid":"recommendations-section",className:"space-y-2",children:[e.jsxs("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:["Recommendations (",s.length,")"]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2",children:s.map(c=>e.jsx(U,{rec:c},c.skill))})]}),e.jsxs("div",{"data-testid":"skills-by-phase",className:"space-y-3",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Skills by Lifecycle Phase"}),[...M.entries()].map(([c,E])=>e.jsx(B,{phase:c,skills:E,onToggle:h,onSkillClick:p},c)),L.length>0&&e.jsx(B,{phase:"Other",skills:L,onToggle:h,onSkillClick:p})]}),e.jsx(A,{skill:j,onClose:()=>p(null),onToggle:h,onDelete:u,onEdit:C}),e.jsx(z,{open:y,onClose:()=>{f(!1),o(null)},onSubmit:N,editSkill:g})]})}export{Y as SkillsTab};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
7
7
|
<title>mcp-graph Workstation</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-dCyMex_p.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DQqYFXms.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,a as k,j as e}from"./index-BAeZDWWy.js";function O(){const[t,s]=a.useState([]),[x,l]=a.useState([]),[i,n]=a.useState(0),[m,h]=a.useState(!0),[b,v]=a.useState(null),d=a.useCallback(async()=>{h(!0),v(null);try{const[o,u]=await Promise.all([k.getSkills(),k.getRecommendations().catch(()=>({recommendations:[]}))]);s(o.skills),n(o.totalTokens),l(u.recommendations)}catch(o){v(o instanceof Error?o.message:"Failed to load skills")}finally{h(!1)}},[]);a.useEffect(()=>{d()},[d]);const N=a.useCallback(async(o,u)=>{s(S=>S.map(y=>y.name===o?{...y,enabled:u}:y));try{await k.toggleSkill(o,u)}catch{d()}},[d]),p=a.useCallback(async o=>{await k.createCustomSkill(o),d()},[d]),j=a.useCallback(async(o,u)=>{await k.updateCustomSkill(o,u),d()},[d]),f=a.useCallback(async o=>{await k.deleteCustomSkill(o),d()},[d]),g=t.filter(o=>o.enabled).reduce((o,u)=>o+u.estimatedTokens,0);return{skills:t,recommendations:x,totalTokens:i,activeTokens:g,loading:m,error:b,refresh:d,toggleSkill:N,createSkill:p,updateSkill:j,deleteSkill:f}}const F={ANALYZE:"#8b5cf6",DESIGN:"#3b82f6",PLAN:"#06b6d4",IMPLEMENT:"#10b981",VALIDATE:"#f59e0b",REVIEW:"#ef4444",HANDOFF:"#ec4899",LISTENING:"#6b7280"};function G({skill:t,onClose:s,onToggle:x,onDelete:l,onEdit:i}){return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n=>{n.target===n.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[80vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold truncate",children:t.name}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsx("p",{className:"text-sm text-[var(--color-text-muted)] mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsx("span",{className:`px-2 py-0.5 rounded text-[10px] font-medium ${t.source==="built-in"?"bg-blue-500/10 text-blue-500":t.source==="custom"?"bg-purple-500/10 text-purple-500":"bg-gray-500/10 text-gray-500"}`,children:t.source}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:t.category}),e.jsxs("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium bg-[var(--color-border)] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tokens"]})]}),t.phases&&t.phases.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:t.phases.map(n=>{const m=F[n]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${m}20`,color:m},children:n},n)})}),e.jsx("div",{className:"flex items-center gap-3 mb-4 p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:n=>x(t.name,n.target.checked),className:"w-4 h-4 accent-[var(--color-accent)]"}),t.enabled?"Enabled":"Disabled"]})}),t.source==="custom"&&e.jsxs("div",{className:"flex gap-2",children:[i&&e.jsx("button",{onClick:()=>i(t),className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Edit"}),l&&t.id&&e.jsx("button",{onClick:()=>l(t.id),className:"px-3 py-1.5 text-sm text-red-500 border border-red-500/30 rounded hover:bg-red-500/10",children:"Delete"})]})]})}):null}const $=["ANALYZE","DESIGN","PLAN","IMPLEMENT","VALIDATE","REVIEW","HANDOFF","LISTENING"],B=["know-me","software-design","security","testing","cost-reducer","research","ddd","frontend-design","other"];function H({open:t,onClose:s,onSubmit:x,editSkill:l}){const[i,n]=a.useState(""),[m,h]=a.useState(""),[b,v]=a.useState("know-me"),[d,N]=a.useState(["IMPLEMENT"]),[p,j]=a.useState(""),[f,g]=a.useState(!1),[o,u]=a.useState(null);a.useEffect(()=>{l?(n(l.name),h(l.description),v(l.category),N(l.phases??["IMPLEMENT"]),j("")):(n(""),h(""),v("know-me"),N(["IMPLEMENT"]),j("")),u(null)},[l,t]);const S=a.useCallback(r=>{N(E=>E.includes(r)?E.filter(L=>L!==r):[...E,r])},[]),y=a.useCallback(async()=>{if(!i.trim()||!m.trim()||!p.trim()||d.length===0){u("All fields are required and at least one phase must be selected.");return}g(!0),u(null);try{await x({name:i.trim(),description:m.trim(),category:b,phases:d,instructions:p.trim()}),s()}catch(r){u(r instanceof Error?r.message:"Failed to save skill")}finally{g(!1)}},[i,m,b,d,p,x,s]);return t?e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r=>{r.target===r.currentTarget&&s()},children:e.jsxs("div",{className:"bg-[var(--color-bg)] rounded-lg shadow-xl w-full max-w-lg p-6 max-h-[85vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:l?"Edit Skill":"Create Custom Skill"}),e.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-xl",children:"×"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Name"}),e.jsx("input",{type:"text",value:i,onChange:r=>n(r.target.value),placeholder:"my-workflow",disabled:!!l,className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] disabled:opacity-50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Description"}),e.jsx("input",{type:"text",value:m,onChange:r=>h(r.target.value),placeholder:"What does this skill do?",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Category"}),e.jsx("select",{value:b,onChange:r=>v(r.target.value),className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:B.map(r=>e.jsx("option",{value:r,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Phases"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$.map(r=>e.jsx("button",{type:"button",onClick:()=>S(r),className:`px-2 py-1 text-[10px] font-medium rounded-full border transition-colors ${d.includes(r)?"bg-[var(--color-accent)]/10 border-[var(--color-accent)] text-[var(--color-accent)]":"border-[var(--color-border)] text-[var(--color-text-muted)] hover:border-[var(--color-text)]"}`,children:r},r))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Instructions"}),e.jsx("textarea",{value:p,onChange:r=>j(r.target.value),rows:6,placeholder:"Instructions for the AI agent when this skill is active...",className:"w-full px-3 py-2 text-sm rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] resize-y"})]}),o&&e.jsx("div",{className:"text-sm p-2 rounded bg-red-500/10 text-red-500",children:o}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:s,className:"px-3 py-1.5 text-sm border border-[var(--color-border)] rounded hover:bg-[var(--color-bg-tertiary)]",children:"Cancel"}),e.jsx("button",{onClick:y,disabled:f,className:"px-3 py-1.5 text-sm bg-[var(--color-accent)] text-white rounded hover:opacity-90 disabled:opacity-50",children:f?"Saving...":l?"Update":"Create"})]})]})]})}):null}const V=["ANALYZE","DESIGN","PLAN","IMPLEMENT","VALIDATE","REVIEW","HANDOFF","LISTENING"],D={ANALYZE:"#8b5cf6",DESIGN:"#3b82f6",PLAN:"#06b6d4",IMPLEMENT:"#10b981",VALIDATE:"#f59e0b",REVIEW:"#ef4444",HANDOFF:"#ec4899",LISTENING:"#6b7280"},P=4e3;function C({value:t,label:s}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] text-center","data-testid":"metric-card",children:[e.jsx("div",{className:"text-xl font-bold",children:t}),e.jsx("div",{className:"text-[10px] text-[var(--color-text-muted)] uppercase",children:s})]})}function Y({phase:t}){const s=D[t]??"#6b7280";return e.jsx("span",{className:"px-2 py-0.5 rounded-full text-[10px] font-medium",style:{background:`${s}20`,color:s},children:t})}function W({source:t}){const s={"built-in":"bg-[var(--color-accent)]/10 text-[var(--color-accent)]",filesystem:"bg-[var(--color-text-muted)]/10 text-[var(--color-text-muted)]",custom:"bg-purple-500/10 text-purple-500"};return e.jsx("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${s[t]}`,children:t})}function _({skill:t,onToggle:s,onClick:x}){return e.jsxs("div",{className:`p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] cursor-pointer hover:border-[var(--color-accent)]/50 transition-all ${t.enabled?"":"opacity-50"}`,onClick:()=>x(t),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium truncate",children:t.name}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:l=>{l.stopPropagation(),s(t.name,l.target.checked)},onClick:l=>l.stopPropagation(),className:"w-3.5 h-3.5 accent-[var(--color-accent)]"}),e.jsx(W,{source:t.source}),e.jsxs("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:[t.estimatedTokens.toLocaleString()," tok"]})]})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)] line-clamp-2",children:t.description})]})}function M({phase:t,skills:s,onToggle:x,onSkillClick:l}){const[i,n]=a.useState(!0),m=D[t]??"#6b7280",h=s.filter(b=>b.enabled).length;return e.jsxs("div",{className:"rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)] overflow-hidden",children:[e.jsxs("button",{type:"button",onClick:()=>n(!i),className:"w-full flex items-center justify-between px-3 py-2 text-xs font-medium hover:bg-[var(--color-bg-tertiary)] transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:m}}),t,e.jsxs("span",{className:"px-1.5 py-0.5 rounded-full bg-[var(--color-border)] text-[10px]",children:[h,"/",s.length]})]}),e.jsx("span",{className:"text-[var(--color-text-muted)]",children:i?"▲":"▼"})]}),i&&e.jsx("div",{className:"px-3 pb-3 space-y-2",children:s.map(b=>e.jsx(_,{skill:b,onToggle:x,onClick:l},b.name))})]})}function Z({rec:t}){return e.jsxs("div",{className:"p-3 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-accent)]/30",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-sm font-medium",children:t.skill}),e.jsx(Y,{phase:t.phase})]}),e.jsx("p",{className:"text-xs text-[var(--color-text-muted)]",children:t.reason})]})}function z({totalTokens:t,activeTokens:s}){const x=Math.min(s/P,1),l=Math.min(t/P,1),i=Math.round(x*100),n=x>.8?"#ef4444":x>.5?"#f59e0b":"#10b981";return e.jsxs("div",{"data-testid":"token-budget-bar",className:"p-4 rounded-lg bg-[var(--color-bg-secondary)] border border-[var(--color-border)]",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Token Budget"}),e.jsxs("span",{className:"text-xs text-[var(--color-text-muted)]",children:[s.toLocaleString()," active / ",t.toLocaleString()," total (",i,"%)"]})]}),e.jsxs("div",{className:"w-full h-2 rounded-full bg-[var(--color-border)] relative",children:[e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 opacity-30",style:{width:`${Math.round(l*100)}%`,background:"#6b7280"}}),e.jsx("div",{className:"h-full rounded-full absolute top-0 left-0 transition-all",style:{width:`${i}%`,background:n}})]})]})}function q(){const{skills:t,recommendations:s,totalTokens:x,activeTokens:l,loading:i,error:n,refresh:m,toggleSkill:h,createSkill:b,updateSkill:v,deleteSkill:d}=O(),[N,p]=a.useState(null),[j,f]=a.useState(!1),[g,o]=a.useState(null),u=a.useCallback(async c=>{await d(c),p(null)},[d]),S=a.useCallback(c=>{p(null),o(c),f(!0)},[]),y=a.useCallback(async c=>{g!=null&&g.id?await v(g.id,c):await b(c),o(null)},[g,b,v]);if(n)return e.jsxs("div",{className:"flex items-center justify-center h-full text-[var(--color-danger)]",children:["Failed to load skills: ",n]});if(i)return e.jsx("div",{className:"flex items-center justify-center h-full text-[var(--color-text-muted)]",children:"Loading skills..."});const r=t.filter(c=>c.source==="built-in").length,E=t.filter(c=>c.source==="custom").length,L=t.filter(c=>c.enabled).length,T=new Map;for(const c of V){const w=t.filter(R=>{var A;return(A=R.phases)==null?void 0:A.includes(c)});w.length>0&&T.set(c,w)}const I=t.filter(c=>!c.phases||c.phases.length===0);return e.jsxs("div",{className:"p-6 max-w-6xl mx-auto space-y-6 overflow-y-auto h-full",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Skills"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{o(null),f(!0)},className:"text-xs px-3 py-1.5 rounded-lg border border-[var(--color-accent)] text-[var(--color-accent)] hover:bg-[var(--color-accent)]/10 transition-colors",children:"+ Custom Skill"}),e.jsx("button",{onClick:()=>void m(),className:"text-xs px-3 py-1.5 rounded-lg bg-[var(--color-accent)] text-white hover:opacity-90 transition-opacity",children:"Refresh"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-3","data-testid":"skills-stats",children:[e.jsx(C,{value:t.length,label:"Total Skills"}),e.jsx(C,{value:r,label:"Built-in"}),e.jsx(C,{value:E,label:"Custom"}),e.jsx(C,{value:L,label:"Enabled"}),e.jsx(C,{value:l.toLocaleString(),label:"Active Tokens"})]}),e.jsx(z,{totalTokens:x,activeTokens:l}),s.length>0&&e.jsxs("div",{"data-testid":"recommendations-section",className:"space-y-2",children:[e.jsxs("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:["Recommendations (",s.length,")"]}),e.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-2",children:s.map(c=>e.jsx(Z,{rec:c},c.skill))})]}),e.jsxs("div",{"data-testid":"skills-by-phase",className:"space-y-3",children:[e.jsx("h3",{className:"text-xs font-semibold text-[var(--color-text-muted)] uppercase",children:"Skills by Lifecycle Phase"}),[...T.entries()].map(([c,w])=>e.jsx(M,{phase:c,skills:w,onToggle:h,onSkillClick:p},c)),I.length>0&&e.jsx(M,{phase:"Other",skills:I,onToggle:h,onSkillClick:p})]}),e.jsx(G,{skill:N,onClose:()=>p(null),onToggle:h,onDelete:u,onEdit:S}),e.jsx(H,{open:j,onClose:()=>{f(!1),o(null)},onSubmit:y,editSkill:g})]})}export{q as SkillsTab};
|