@caddis/cli 0.4.95 → 0.4.97

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.
Files changed (37) hide show
  1. package/README.md +2 -0
  2. package/bundles/antigravity-plugin/plugin.json +1 -1
  3. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_exit.cpython-311.pyc +0 -0
  4. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_file_lock.cpython-311.pyc +0 -0
  5. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_frontmatter.cpython-311.pyc +0 -0
  6. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_redact.cpython-311.pyc +0 -0
  7. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_roadmap.cpython-311.pyc +0 -0
  8. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_rows.cpython-311.pyc +0 -0
  9. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_status.cpython-311.pyc +0 -0
  10. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_tidy.cpython-311.pyc +0 -0
  11. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_todo.cpython-311.pyc +0 -0
  12. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_workstreams.cpython-311.pyc +0 -0
  13. package/bundles/antigravity-plugin/scripts/__pycache__/caddis_worktree_safety.cpython-311.pyc +0 -0
  14. package/bundles/antigravity-plugin/scripts/caddis_fleet.py +31 -21
  15. package/bundles/antigravity-plugin/scripts/caddis_gate.py +19 -2
  16. package/bundles/antigravity-plugin/scripts/caddis_guide.json +2 -2
  17. package/bundles/antigravity-plugin/scripts/caddis_hub_collect.py +51 -10
  18. package/bundles/antigravity-plugin/scripts/caddis_lanes.py +154 -130
  19. package/bundles/antigravity-plugin/scripts/caddis_todo.py +180 -3
  20. package/bundles/antigravity-plugin/scripts/schemas/hub-collect.schema.json +57 -0
  21. package/bundles/antigravity-plugin/scripts/schemas/hub-plans.schema.json +57 -0
  22. package/bundles/antigravity-plugin/scripts/setup_project_ai.py +13 -1
  23. package/bundles/antigravity-plugin/scripts/templates/coordinator.md +3 -3
  24. package/bundles/antigravity-plugin/skills/coordinate/SKILL.md +4 -1
  25. package/bundles/antigravity-plugin/skills/handoff/SKILL.md +21 -8
  26. package/bundles/manifest.json +2 -2
  27. package/dist/cli.js +214 -71
  28. package/dist/export/assets/{export-CMtV-slT.css → export-B5Lzo-9e.css} +1 -1
  29. package/dist/export/assets/{export-DtlDFN4L.js → export-PF4z_ff4.js} +29 -29
  30. package/dist/export/index.html +2 -2
  31. package/dist/ui/assets/{Activity-BDjet2xd.js → Activity-DN1XBfsH.js} +1 -1
  32. package/dist/ui/assets/{Guide-Czn5sK0f.js → Guide-D-lZVEKf.js} +1 -1
  33. package/dist/ui/assets/{RoadmapTab-Bd8geyQx.js → RoadmapTab-tqQd2sYq.js} +7 -7
  34. package/dist/ui/assets/{index-CmngQ8Mk.js → index-CWslZIzV.js} +44 -44
  35. package/dist/ui/assets/{index-Bd0Z4jR8.css → index-CwgRPpjT.css} +1 -1
  36. package/dist/ui/index.html +2 -2
  37. package/package.json +1 -1
@@ -6,8 +6,8 @@
6
6
  <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'none'; base-uri 'none'; form-action 'none'" />
7
7
  <title>Roadmap</title>
8
8
  <link rel="icon" href="data:," />
9
- <script type="module" crossorigin src="./assets/export-DtlDFN4L.js"></script>
10
- <link rel="stylesheet" crossorigin href="./assets/export-CMtV-slT.css">
9
+ <script type="module" crossorigin src="./assets/export-PF4z_ff4.js"></script>
10
+ <link rel="stylesheet" crossorigin href="./assets/export-B5Lzo-9e.css">
11
11
  </head>
12
12
  <body>
13
13
  <div id="root"></div>
@@ -1,4 +1,4 @@
1
- import{c as K,a as _,D as I,b as O,d as z,r as C,j as n,e as B}from"./index-CmngQ8Mk.js";import{l as Y}from"./time-D00tu2ZP.js";/**
1
+ import{c as K,a as _,D as I,b as O,d as z,r as C,j as n,e as B}from"./index-CWslZIzV.js";import{l as Y}from"./time-D00tu2ZP.js";/**
2
2
  * @license lucide-react v1.61.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as k,j as e,g as f}from"./index-CmngQ8Mk.js";const ie=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1250 1250" role="img" aria-label="Caddis">
1
+ import{r as k,j as e,g as f}from"./index-CWslZIzV.js";const ie=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1250 1250" role="img" aria-label="Caddis">
2
2
  <path class="p-blue" fill="#0D42FC" d="M640 98C705 150 720 215 680 275C640 340 590 375 540 420C480 470 410 520 395 605C385 700 355 790 270 855C310 780 315 700 305 640C300 540 340 460 480 340L545 285C600 235 645 180 640 98Z M545 535L625 585C610 610 595 635 580 650L500 597C515 575 530 555 545 535Z"/>
3
3
  <path class="p-purple" fill="#8730FB" d="M210 1025C200 950 225 890 270 855C330 810 400 750 445 670L525 720C440 830 330 930 250 985C235 998 222 1012 210 1025Z M875 622C960 690 1030 780 1028 850C1025 910 990 950 960 975L905 950C935 900 935 850 900 790C875 755 840 720 800 672C830 650 850 635 875 622Z"/>
4
4
  <path class="p-cyan" fill="#00CAD5" d="M1025 182C1050 250 1030 320 985 360C940 395 880 390 820 405C750 420 690 460 668 500L592 452C650 360 760 310 880 290C950 275 990 235 1025 182Z"/>
@@ -1,31 +1,31 @@
1
- import{c as $,j as e,r as j,p as L,f as Q,h as Y,P as Z,w as ee,T,e as se,b as D,l as ae,i as ne,k as re,m as le,n as te,o as ie,d as ce,q as oe,s as de,t as he,u as me,v as pe,N as ue,x as xe}from"./index-CmngQ8Mk.js";import{y as ze}from"./index-CmngQ8Mk.js";import{l as P}from"./time-D00tu2ZP.js";/**
1
+ import{c as $,j as e,r as j,p as L,f as Q,h as Y,P as Z,w as ee,T,e as se,b as D,l as ae,i as ne,k as re,m as le,n as te,o as ie,q as ce,d as oe,s as de,t as he,u as me,v as pe,x as xe,N as ue,y as je}from"./index-CWslZIzV.js";import{z as Fe}from"./index-CWslZIzV.js";import{l as P}from"./time-D00tu2ZP.js";/**
2
2
  * @license lucide-react v1.61.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 S={name:"arrow-right-left",size:24,node:[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]};S.node;const je=$(S);/**
6
+ */const S={name:"arrow-right-left",size:24,node:[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]};S.node;const Ne=$(S);/**
7
7
  * @license lucide-react v1.61.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 M={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};M.node;const Ne=$(M);/**
11
+ */const M={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};M.node;const ke=$(M);/**
12
12
  * @license lucide-react v1.61.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 _={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};_.node;const ke=$(_);/**
16
+ */const _={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};_.node;const ge=$(_);/**
17
17
  * @license lucide-react v1.61.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 I={name:"loader",size:24,node:[["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"}]]};I.node;const ge=$(I);/**
21
+ */const I={name:"loader",size:24,node:[["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"}]]};I.node;const fe=$(I);/**
22
22
  * @license lucide-react v1.61.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const O={name:"octagon-alert",size:24,node:[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],aliases:["alert-octagon"]};O.node;const fe=$(O);/**
26
+ */const O={name:"octagon-alert",size:24,node:[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],aliases:["alert-octagon"]};O.node;const be=$(O);/**
27
27
  * @license lucide-react v1.61.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const A={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};A.node;const be=$(A);function V({phase:s}){return e.jsxs(e.Fragment,{children:[s.prs.map(a=>a.url?e.jsxs("a",{className:"rm-pr mono","data-testid":"rm-pr",href:a.url,target:"_blank",rel:"noreferrer noopener",children:["#",a.number]},a.number):e.jsxs("span",{className:"rm-pr mono","data-testid":"rm-pr",children:["#",a.number]},a.number)),e.jsx("span",{className:`rm-stage tile-${s.tile}`,"data-testid":"rm-stage",children:s.stage})]})}function v({status:s}){const a=s==="done"||s==="not-needed";return e.jsx("span",{className:`chip ${a?"chip-resolved":s==="in-progress"?"chip-waiting":"chip-hub"}`,children:s})}function we({detail:s,note:a=null,variant:l,onClose:t}){const n=j.useId(),r=j.useRef(null);if(j.useEffect(()=>{var k;(k=r.current)==null||k.focus()},[s==null?void 0:s.phase.ref]),!s)return null;const{title:i,text:o,phase:h}=s,u=L(h);return e.jsxs("aside",{className:"rm-panel","data-testid":"rm-panel",role:"dialog","aria-modal":"false","aria-labelledby":n,children:[e.jsxs("h3",{id:n,"data-testid":"rm-panel-title",tabIndex:-1,ref:r,children:[h.ref," ",i]}),e.jsx("button",{type:"button",className:"rm-panel-close","data-testid":"rm-panel-close","aria-label":"Close",onClick:t,children:"×"}),e.jsx(v,{status:h.tile}),h.tracker&&e.jsx("p",{"data-testid":"rm-panel-tracker",children:h.tracker}),u&&e.jsx("p",{"data-testid":"rm-panel-meta",children:u}),e.jsx("div",{className:"rm-panel-prs",children:e.jsx(V,{phase:h})}),l!=="site"&&(o!==null?e.jsx("pre",{className:"rm-panel-text","data-testid":"rm-panel-text",children:o}):a==="loading"?e.jsx("p",{"data-testid":"rm-panel-note",children:"Loading the plan section…"}):a==="error"?e.jsx("p",{"data-testid":"rm-panel-note",children:"Could not load the plan section."}):e.jsx("p",{"data-testid":"rm-panel-empty",children:"The plan has no section for this phase."}))]})}function R(){try{return typeof window<"u"?window.localStorage:null}catch{return null}}function z(s){const[a,l]=j.useState(()=>s??Q(R()));return[a,n=>()=>{l(n),ee(R(),n)}]}function F({view:s,choose:a}){return e.jsxs("div",{className:"rm-view",role:"group","aria-label":"View","data-testid":"rm-view",children:[e.jsx("button",{type:"button","data-testid":"rm-view-timeline","aria-pressed":s==="timeline",onClick:a("timeline"),children:"Timeline"}),e.jsx("button",{type:"button","data-testid":"rm-view-board","aria-pressed":s==="board",onClick:a("board"),children:"Board"})]})}const H=s=>s instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName);function B({m:s,pool:a,repo:l,variant:t}){const[n,r]=j.useState(null),[i,o]=j.useState(null),[h,u]=j.useState(0),k=j.useRef(null),d=n?Y(s,a,n):null,g=j.useContext(Z),c=d==null?void 0:d.planPath,m=d==null?void 0:d.key,w=d!==null&&t!=="site"&&d.hasSection&&d.text===null&&d.planPath!==null&&g!==null;j.useEffect(()=>{if(!w||!n||!d||!d.planPath||!g)return;let x=!0;return g(l.path,d.planPath,d.key).then(y=>{x&&o({ref:n,text:y.text||null,error:!1})},()=>{x&&o({ref:n,text:null,error:!0})}),()=>{x=!1}},[n,w,g,l.path,c,m,h]);const p=i&&i.ref===n?i:null,b=(x,y)=>{if(k.current=y,x===n){p!=null&&p.error&&(o(null),u(J=>J+1));return}o(null),r(x)},N=()=>{var x;o(null),r(null),(x=k.current)==null||x.focus()};j.useEffect(()=>{if(n===null)return;const x=y=>{H(y.target)||y.key==="Escape"&&N()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n]);const f=e.jsx(we,{detail:d?{title:d.title,text:d.text??(p==null?void 0:p.text)??null,phase:d.phase}:null,note:w&&!p?"loading":p!=null&&p.error?"error":null,variant:t,onClose:N});return{open:b,panel:f}}const ye={todo:ke,"in-progress":ge,done:Ne,moved:je,blocked:fe},K={size:14,"aria-hidden":!0};function E({tile:s}){const a=ye[s];return e.jsx(a,{...K})}function U({done:s,total:a}){const l=a?Math.round(100*s/a):0;return e.jsxs("div",{className:"rm-bar-wrap",children:[e.jsx("div",{className:"rm-bar",role:"img","aria-label":`${s} of ${a} phases done`,children:e.jsx("i",{style:{width:`${l}%`}})}),e.jsxs("span",{className:"rm-bar-text",children:[s,"/",a," phases · ",l,"%"]})]})}function ve(s,a){const l=document.getElementById(`ms-${s}-${a}`);l instanceof HTMLDetailsElement&&(l.open=!0),l==null||l.scrollIntoView({block:"start"})}function q({m:s,match:a,onOpen:l}){const t=r=>!a||a.phases.has(r.ref),n=s.milestones.length;return e.jsxs("section",{className:"rm-section","data-testid":"rm-timeline","aria-label":"Timeline",children:[e.jsx("h3",{className:"flow-h",children:"Timeline"}),e.jsxs("div",{className:"rm-timeline-grid",style:{"--rm-cols":n},children:[e.jsxs("div",{className:"rm-head-row",children:[e.jsx("div",{className:"rm-cell rm-head rm-lane",children:"Plan / milestone"}),s.milestones.map(r=>e.jsxs("div",{className:"rm-cell rm-head",children:[e.jsx("strong",{children:r.id})," ",e.jsx(v,{status:r.status}),e.jsx("span",{className:"rm-sub",children:r.depends.length?`after ${r.depends.join(", ")}`:"starts first"}),r.blockers.length>0&&e.jsxs("span",{className:"rm-gate-count",children:[r.blockers.length," gate(s)"]})]},r.id))]}),s.lanes.map(r=>e.jsxs("div",{className:"rm-row",children:[e.jsxs("div",{className:"rm-cell rm-lane",children:[r.plan,e.jsxs("span",{className:"rm-sub",children:[r.done,"/",r.total," done"]})]}),s.milestones.map(i=>e.jsx("div",{className:"rm-cell",children:i.phases.filter(o=>o.plan===r.plan&&t(o)).map(o=>e.jsxs("button",{type:"button",className:"rm-tile","data-state":o.tile,"data-risk":o.highRisk?"high":void 0,title:`${o.ref} ${o.name} | ${o.tracker||o.stage}`,onClick:h=>l(o.ref,h.currentTarget),children:[e.jsx(E,{tile:o.tile}),s.kind!=="plan"&&e.jsx("b",{className:"mono",children:o.num}),e.jsx("span",{children:o.name}),e.jsx("span",{className:"sr-only",children:T[o.tile]}),o.highRisk&&e.jsx("i",{className:"rm-risk","aria-label":"high risk"})]},o.ref))},i.id))]},r.plan)),s.blockers.length>0&&e.jsxs("div",{className:"rm-row",children:[e.jsx("div",{className:"rm-cell rm-lane",children:"Owner and outside"}),s.milestones.map(r=>e.jsx("div",{className:"rm-cell",children:r.blockers.map((i,o)=>e.jsxs("div",{className:"rm-gate-note",title:i.reason,children:[i.type,": ",i.reason.length>60?`${i.reason.slice(0,60)}…`:i.reason]},o))},r.id))]})]}),e.jsx("div",{className:"rm-timeline-list","data-testid":"rm-timeline-list",children:s.milestones.map(r=>e.jsxs("div",{children:[e.jsxs("h4",{className:"rm-list-h",children:[r.id," ",e.jsx(v,{status:r.status})]}),r.phases.filter(t).map(i=>e.jsxs("button",{type:"button",className:"rm-tile","data-state":i.tile,"data-risk":i.highRisk?"high":void 0,onClick:o=>l(i.ref,o.currentTarget),children:[e.jsx(E,{tile:i.tile}),s.kind!=="plan"&&e.jsxs("b",{className:"mono",children:[i.plan," ",i.num]}),e.jsx("span",{children:i.name}),e.jsx("span",{className:"sr-only",children:T[i.tile]}),i.highRisk&&e.jsx("i",{className:"rm-risk","aria-label":"high risk"})]},i.ref))]},r.id))}),e.jsxs("div",{className:"rm-legend","data-testid":"rm-legend",children:[e.jsx("span",{children:"to do · in progress · done · moved · blocked: each tile has an icon and a label"}),e.jsx("span",{children:"red dot = Risk high (stops for review)"})]})]})}function G({m:s,match:a,onOpen:l}){return e.jsxs("section",{className:"rm-section","data-testid":"rm-milestones","aria-label":"Milestones and phases",children:[e.jsx("h3",{className:"flow-h",children:"Milestones and phases"}),s.milestones.filter(t=>!a||a.milestones.has(t.id)).map(t=>e.jsxs("details",{className:"rm-ms",id:`ms-${s.slug}-${t.id}`,open:a?!0:void 0,children:[e.jsxs("summary",{children:[e.jsx("strong",{children:t.id})," ",e.jsx(v,{status:t.status}),s.kind!=="plan"&&e.jsxs("span",{className:"rm-sub",children:["owner ",t.owner,t.target?` · target ${t.target}`:""," · after ",t.depends.join(", ")||"-"]})]}),t.phases.length===0?e.jsx("p",{className:"col-empty",children:"No build phases."}):e.jsx("ul",{className:"flow-list",children:t.phases.filter(n=>!a||a.phases.has(n.ref)).map(n=>e.jsxs("li",{className:"flow-row","data-testid":"rm-phase","data-state":n.tile,children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("code",{className:"mono",children:n.ref}),e.jsx("button",{type:"button",className:"flow-title rm-open",onClick:r=>l(n.ref,r.currentTarget),children:n.name}),e.jsx(V,{phase:n})]}),e.jsxs("span",{className:"flow-why",children:[L(n)||"no model, lane or risk recorded",n.tracker?` · Tracker: ${n.tracker}`:""]})]},n.ref))})]},`${t.id}-${a?"q":"n"}`))]})}const W=(s,a,l)=>s==="site"?l?`#/roadmap/${encodeURIComponent(l)}`:"#/":se(a,"roadmap",l);function $e({repo:s,m:a,variant:l}){const t=D(s);return e.jsxs("div",{className:"rm-list-view",children:[(a.errors.length>0||a.repoError||a.roadmaps.some(n=>n.detailError))&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:[a.repoError&&e.jsxs("div",{children:["Could not read this repo: ",a.repoError]}),a.errors.map(n=>e.jsxs("div",{children:["Could not read ",n.slug,": ",n.error]},n.slug)),a.roadmaps.filter(n=>n.detailError).map(n=>e.jsxs("div",{children:["Detail unavailable for ",n.slug,": ",n.detailError]},n.slug))]}),e.jsx("ul",{className:"flow-list rm-cards","data-testid":"rm-list","aria-label":"Roadmaps",children:a.roadmaps.map(n=>{const r=ae(n);return e.jsx("li",{children:e.jsxs("a",{className:`rm-rcard rm-card tone-${r.tone}`,"data-testid":"rm-card",href:W(l,t,n.slug),children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.slug})," ",e.jsx("span",{className:"rm-sub",children:r.branch??""})]}),e.jsx(U,{done:r.phasesDone,total:r.phasesTotal}),e.jsxs("span",{className:"rm-sub",children:[r.milestonesDone,"/",r.milestonesTotal," milestones"]}),e.jsx("span",{className:"rm-dots",children:r.dots.map(i=>e.jsx("span",{className:`rm-dot s-${i.status}`,children:i.id},i.id))}),e.jsxs("span",{className:"rm-sub",children:["next: ",r.next,l==="hub"?` · runner: ${r.runner}`:"",r.gates>0?` · ${r.gates} open gate${r.gates===1?"":"s"}`:""]})]})},n.slug)})})]})}const Te={todo:"todo","in-progress":"prog",blocked:"block",done:"done",moved:"done"},C=s=>s.replace(/^☐\s*/u,"").trim();function Pe({plan:s}){if(s.rows.length===0)return null;const a=ne(s);return e.jsxs("span",{className:"rm-pkpis","data-testid":"rm-plan-kpis",children:[e.jsxs("span",{className:"rm-pkpi",children:[e.jsxs("span",{className:"rm-pkpi-num",children:[a.done," / ",a.total]})," ","done"]}),e.jsx("span",{className:"rm-pbar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a.pct,"aria-label":"Share of rows done",children:e.jsx("span",{style:{width:`${a.pct}%`}})}),e.jsxs("span",{className:"rm-pkpi rm-pkpi-pct",children:[a.pct," %"]}),e.jsxs("span",{className:`rm-pkpi${a.inProgress?" tone-prog":""}`,children:[e.jsx("span",{className:"rm-pkpi-num",children:a.inProgress})," in progress"]}),e.jsxs("span",{className:`rm-pkpi${a.blocked?" tone-block":""}`,children:[e.jsx("span",{className:"rm-pkpi-num",children:a.blocked})," blocked"]}),e.jsxs("span",{className:"rm-pkpi",children:[e.jsx("span",{className:"rm-pkpi-num",children:a.todo})," to do"]})]})}function Re({plan:s}){if(s.rows.length===0)return e.jsx("p",{className:"col-empty","data-testid":"rm-plan-board",children:"This plan has no Tracker table."});const a=re(s);return e.jsx("div",{className:"rm-cols rm-cols-4","data-testid":"rm-plan-board",children:le.map(l=>e.jsxs("div",{"data-col":l.key,children:[e.jsxs("h4",{className:"rm-list-h",children:[l.label," · ",a[l.key].length]}),a[l.key].length===0?e.jsx("p",{className:"col-empty",children:"none"}):a[l.key].map((t,n)=>e.jsxs("div",{className:`rm-rcard rm-pcard tone-${Te[t.state]}${t.state==="moved"?" is-moved":""}`,children:[e.jsx("strong",{children:t.phase}),C(t.status)?e.jsx("span",{className:"rm-sub",children:C(t.status)}):null]},`${t.phase}-${n}`))]},l.key))})}function Ee({m:s,plan:a,repo:l,variant:t,initialView:n}){const[r,i]=z(n),{open:o,panel:h}=B({m:s,pool:[a],repo:l,variant:t}),u=s.kpis;return e.jsxs("div",{className:"rm-detail","data-testid":"rm-detail",children:[s.detailError&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Roadmap detail is unavailable: ",s.detailError,". Phase names, Tracker cells and PR links are missing."]}),e.jsx("header",{"data-testid":"rm-header",children:e.jsxs("p",{className:"page-subtitle",children:[u.phasesDone," of ",u.phasesTotal," phases done"]})}),e.jsx(F,{view:r,choose:i}),e.jsxs("section",{className:"rm-kpis kpi-strip","data-testid":"rm-kpis","aria-label":"Summary",children:[e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Phases done"}),e.jsxs("span",{className:"kpi-num",children:[u.phasesDone," / ",u.phasesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"In progress"}),e.jsx("span",{className:"kpi-num",children:u.inProgress.length}),e.jsx("span",{className:"kpi-sub tone-muted",children:u.inProgress.join(", ")||"none"})]})]}),r==="timeline"?e.jsx(q,{m:s,match:null,onOpen:o}):e.jsx(Re,{plan:a}),e.jsx(G,{m:s,match:null,onOpen:o}),h]})}function Ce(s){const[a]=j.useState(()=>te(s));return a}function Le({plan:s,repo:a,variant:l,initialView:t,defaultOpen:n}){const[r,i]=j.useState(n);return e.jsxs("details",{className:"rm-plan","aria-label":s.title,open:r||void 0,onToggle:o=>i(o.currentTarget.open),children:[e.jsxs("summary",{className:"rm-plan-sum",children:[e.jsx("span",{className:"rm-plan-title",children:s.title}),e.jsxs("span",{className:"rm-sub",children:[s.open," open"]}),e.jsx(Pe,{plan:s}),e.jsx("span",{className:"rm-plan-only",children:"plan only, no runner"})]}),r&&e.jsx(Ee,{m:ie(a,s),plan:s,repo:a,variant:l,initialView:t})]})}function X({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n}){const r=Ce(s);return e.jsx(e.Fragment,{children:s.map(i=>e.jsx(Le,{plan:i,repo:a,variant:l,initialView:t,defaultOpen:n||i.path===r},i.path))})}function De({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n=!1}){return e.jsxs("div",{className:"flow","data-testid":"rm-plans",children:[e.jsx("p",{className:"page-subtitle",children:"No roadmap here. These plans are active. Click a plan to open or close it."}),e.jsx(X,{plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n})]})}function Se({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n=!1}){return s.length===0?null:e.jsxs("div",{className:"flow","data-testid":"rm-other-plans",children:[e.jsx("h2",{className:"rm-title",children:"Plans with no roadmap"}),e.jsx(X,{plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n})]})}function Me({m:s,repo:a,crumbHref:l,match:t,variant:n,initialView:r,plans:i}){const[o,h]=z(r),{open:u,panel:k}=B({m:s,pool:i??[],repo:a,variant:n}),d=s.kpis,g=c=>()=>ve(s.slug,c);return e.jsxs("div",{className:"rm-detail","data-testid":"rm-detail",children:[e.jsxs("nav",{className:"rm-crumbs","data-testid":"rm-crumbs","aria-label":"Breadcrumb",children:[l?e.jsx("a",{href:l,children:"Roadmaps"}):e.jsx("span",{children:"Roadmaps"})," › ",e.jsx("span",{children:ce(a)})," › ",e.jsx("strong",{children:s.slug})]}),s.detailError&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Roadmap detail is unavailable: ",s.detailError,". Phase names, Tracker cells and PR links are missing."]}),e.jsxs("header",{"data-testid":"rm-header",children:[e.jsxs("h2",{className:"rm-title",children:["Roadmap ",s.slug]}),e.jsxs("p",{className:"page-subtitle",children:[d.milestonesDone," of ",d.milestonesTotal," milestones · ",d.phasesDone," of ",d.phasesTotal," phases done",s.branch?e.jsxs(e.Fragment,{children:[" · branch ",e.jsx("code",{children:s.branch})]}):null,s.originCommit?e.jsxs(e.Fragment,{children:[" · origin ",e.jsx("code",{children:s.originCommit})]}):null]}),s.lanes.length>0&&e.jsx("div",{className:"rm-chips","data-testid":"rm-chips",children:s.lanes.map(c=>e.jsxs("span",{className:"rm-chip",children:[e.jsx("b",{children:c.plan})," ",e.jsxs("span",{className:"mono",children:[c.done,"/",c.total," phases"]})]},c.plan))})]}),e.jsx(F,{view:o,choose:h}),e.jsxs("section",{className:`rm-section rm-waiting${s.gates.length?" has":""}`,"data-testid":"rm-waiting","aria-label":"Waiting for you",children:[e.jsx("h3",{className:"flow-h",children:"Waiting for you"}),s.gates.length===0?e.jsx("p",{className:"col-empty",children:"No owner gate is waiting."}):e.jsx("ul",{className:"flow-list",children:s.gates.map((c,m)=>e.jsxs("li",{className:"flow-row",children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("strong",{children:c.milestone}),e.jsx("span",{className:"chip chip-owner-gate",children:"owner-gate"})]}),e.jsx("span",{className:"flow-why",children:c.reason}),c.check&&e.jsx("code",{className:"mono",children:c.check})]},m))})]}),e.jsxs("section",{className:"rm-kpis kpi-strip","data-testid":"rm-kpis","aria-label":"Summary",children:[e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Phases done"}),e.jsxs("span",{className:"kpi-num",children:[d.phasesDone," / ",d.phasesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Milestones done"}),e.jsxs("span",{className:"kpi-num",children:[d.milestonesDone," / ",d.milestonesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"In progress"}),e.jsx("span",{className:"kpi-num",children:d.inProgress.length}),e.jsx("span",{className:"kpi-sub tone-muted",children:d.inProgress.join(", ")||"none"})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"High-risk phases"}),e.jsx("span",{className:`kpi-num${d.highRisk?" bad":""}`,children:d.highRisk})]}),e.jsxs("div",{className:"kpi-tile deploy",children:[e.jsx("span",{className:"kpi-label",children:"Next batch for the runner"}),e.jsx("span",{className:"kpi-val",children:d.next})]})]}),e.jsxs("section",{className:"rm-section","data-testid":"rm-flow","aria-label":"Flow",children:[e.jsx("h3",{className:"flow-h",children:"Flow"}),e.jsx("div",{className:"rm-chain",children:s.milestones.map((c,m)=>e.jsxs("span",{className:"rm-chain-item",children:[m>0&&e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsxs("button",{type:"button",className:`rm-node tone-${c.tone}`,onClick:g(c.id),children:[e.jsx("b",{children:c.id})," ",e.jsx(v,{status:c.status}),e.jsxs("span",{className:"rm-sub",children:[c.depends.length?`after ${c.depends.join(", ")}`:"starts first"," · ",c.done,"/",c.total," ph"]})]})]},c.id))})]}),o==="timeline"?e.jsx(q,{m:s,match:t,onOpen:u}):e.jsxs("section",{className:"rm-section","data-testid":"rm-board","aria-label":"Now, next, later",children:[e.jsx("h3",{className:"flow-h",children:"Now, next, later"}),e.jsx("div",{className:"rm-cols",children:["now","next","later"].map(c=>e.jsxs("div",{children:[e.jsx("h4",{className:"rm-list-h",children:c[0].toUpperCase()+c.slice(1)}),s.board[c].length===0?e.jsx("p",{className:"col-empty",children:"none"}):s.board[c].map(m=>e.jsxs("button",{type:"button",className:`rm-rcard tone-${m.tone}`,onClick:g(m.id),children:[e.jsxs("span",{children:[e.jsx("strong",{children:m.id})," ",e.jsx(v,{status:m.status})]}),e.jsx(U,{done:m.done,total:m.total}),m.blockers.map((w,p)=>e.jsx("span",{className:"rm-sub",children:w.type},p))]},m.id))]},c))})]}),e.jsxs("section",{className:"rm-section","data-testid":"rm-gates","aria-label":"Gates and blockers",children:[e.jsxs("h3",{className:"flow-h",children:["Gates and blockers · ",s.blockers.length," open"]}),s.blockers.length===0?e.jsx("p",{className:"col-empty",children:"No blockers."}):e.jsx("ul",{className:"flow-list",children:s.blockers.map((c,m)=>e.jsxs("li",{className:"flow-row",children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("strong",{children:c.milestone}),e.jsx("span",{className:`chip ${c.type==="owner-gate"?"chip-owner-gate":"chip-hub"}`,children:c.type})]}),e.jsx("span",{className:"flow-why",children:c.reason}),c.check&&e.jsx("code",{className:"mono",children:c.check})]},m))})]}),e.jsx(G,{m:s,match:t,onOpen:u}),n==="hub"&&e.jsxs("section",{className:"rm-section","data-testid":"rm-runner","aria-label":"Runner",children:[e.jsx("h3",{className:"flow-h",children:"Runner"}),s.runner.running?e.jsxs("p",{children:["Running batch ",e.jsx("code",{children:s.runner.running.batch}),s.runner.running.since?` since ${P(s.runner.running.since)}`:"",s.runner.running.host?` (host ${s.runner.running.host}${s.runner.running.pid?`, pid ${s.runner.running.pid}`:""})`:"","."]}):e.jsx("p",{className:"col-empty",children:"No runner holds this roadmap now."}),s.runner.staleBatch!==null&&e.jsxs("p",{children:["A stale runner lock remains (batch ",e.jsx("code",{children:s.runner.staleBatch}),"): the runner that held it is gone."]}),s.runner.lastStop&&e.jsxs("p",{children:["Last stop record: ",s.runner.lastStopAt?`${P(s.runner.lastStopAt)}: `:"",s.runner.lastStop,"."]}),s.runner.errors.map(c=>e.jsxs("p",{className:"tone-warn",children:["Could not read ",c,"."]},c)),s.runner.next&&e.jsxs("p",{children:["Next batch: ",e.jsx("code",{children:s.runner.next})]})]}),k]})}function Oe({repo:s,slug:a,stale:l=!1,lastOkAt:t=null,variant:n="hub",initialView:r,initialOpenAll:i=!1,nowMs:o}){const h=oe(s),[u,k]=j.useState(""),d=j.useRef(null);j.useEffect(()=>{const b=N=>{var f;N.key==="/"&&!H(N.target)&&!N.ctrlKey&&!N.metaKey&&!N.altKey&&(N.preventDefault(),(f=d.current)==null||f.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=D(s),c=l&&e.jsxs("p",{className:"lane-note","data-testid":"rm-stale",children:["Roadmap data is old. Last good read ",de(t),". The numbers below are greyed."]}),m=n==="hub"?he(s.plans,o??Date.now()):null,w=m&&e.jsx("p",{className:`page-subtitle rm-source${m.old?" tone-warn":""}`,"data-testid":"rm-source",children:m.text});let p;if(h.mode==="none")p=e.jsxs("div",{className:"notice","data-testid":"rm-none",children:[e.jsx("h2",{className:"rm-title",children:ue}),e.jsxs("p",{children:["Create one with ",e.jsx("code",{className:"cmd",children:xe}),"."]})]});else if(h.mode==="error")p=e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Could not read this repo: ",h.repoError]});else if(h.mode==="plans")p=e.jsx(De,{plans:h.plans,repo:s,variant:n,initialView:r,initialOpenAll:i});else{const b=a?h.roadmaps.find(N=>N.slug===a):n==="hub"&&me(h)?h.roadmaps[0]:void 0;if(b){const N=h.roadmaps.length+h.errors.length>1,f=pe(b,u);p=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-searchbar",children:[e.jsxs("label",{className:"rm-search",children:[e.jsx(be,{...K}),e.jsx("span",{className:"sr-only",children:"Search this roadmap"}),e.jsx("input",{ref:d,type:"search","data-testid":"rm-search",placeholder:"Search phases, PRs, milestones (press /)",value:u,onChange:x=>k(x.target.value),onKeyDown:x=>{x.key==="Escape"&&k("")}})]}),e.jsx("span",{className:"rm-match","data-testid":"rm-match-count","aria-live":"polite",children:f?`${f.count} ${f.count===1?"match":"matches"}`:""})]}),e.jsx(Me,{m:b,plans:h.plans,repo:s,crumbHref:N?W(n,g):null,match:f,variant:n,initialView:r})]})}else p=e.jsxs(e.Fragment,{children:[a&&e.jsxs("p",{className:"lane-note","data-testid":"rm-missing",children:["No roadmap named ",a," in this repo."]}),e.jsx($e,{repo:s,m:h,variant:n})]})}return e.jsxs("div",{className:`rm${l?" stale":""}`,"data-testid":"roadmap-tab",children:[c,w,p,h.mode==="roadmaps"?e.jsx(Se,{plans:h.otherPlans,repo:s,variant:n,initialView:r,initialOpenAll:i}):null]})}export{ze as collectorStale,Oe as default};
31
+ */const A={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};A.node;const we=$(A);function z({phase:s}){return e.jsxs(e.Fragment,{children:[s.prs.map(a=>a.url?e.jsxs("a",{className:"rm-pr mono","data-testid":"rm-pr",href:a.url,target:"_blank",rel:"noreferrer noopener",children:["#",a.number]},a.number):e.jsxs("span",{className:"rm-pr mono","data-testid":"rm-pr",children:["#",a.number]},a.number)),e.jsx("span",{className:`rm-stage tile-${s.tile}`,"data-testid":"rm-stage",children:s.stage})]})}function v({status:s}){const a=s==="done"||s==="not-needed";return e.jsx("span",{className:`chip ${a?"chip-resolved":s==="in-progress"?"chip-waiting":"chip-hub"}`,children:s})}function ye({detail:s,note:a=null,variant:l,onClose:t}){const n=j.useId(),r=j.useRef(null);if(j.useEffect(()=>{var k;(k=r.current)==null||k.focus()},[s==null?void 0:s.phase.ref]),!s)return null;const{title:i,text:o,phase:h}=s,x=L(h);return e.jsxs("aside",{className:"rm-panel","data-testid":"rm-panel",role:"dialog","aria-modal":"false","aria-labelledby":n,children:[e.jsxs("h3",{id:n,"data-testid":"rm-panel-title",tabIndex:-1,ref:r,children:[h.ref," ",i]}),e.jsx("button",{type:"button",className:"rm-panel-close","data-testid":"rm-panel-close","aria-label":"Close",onClick:t,children:"×"}),e.jsx(v,{status:h.tile}),h.tracker&&e.jsx("p",{"data-testid":"rm-panel-tracker",children:h.tracker}),x&&e.jsx("p",{"data-testid":"rm-panel-meta",children:x}),e.jsx("div",{className:"rm-panel-prs",children:e.jsx(z,{phase:h})}),l!=="site"&&(o!==null?e.jsx("pre",{className:"rm-panel-text","data-testid":"rm-panel-text",children:o}):a==="loading"?e.jsx("p",{"data-testid":"rm-panel-note",children:"Loading the plan section…"}):a==="error"?e.jsx("p",{"data-testid":"rm-panel-note",children:"Could not load the plan section."}):e.jsx("p",{"data-testid":"rm-panel-empty",children:"The plan has no section for this phase."}))]})}function R(){try{return typeof window<"u"?window.localStorage:null}catch{return null}}function V(s){const[a,l]=j.useState(()=>s??Q(R()));return[a,n=>()=>{l(n),ee(R(),n)}]}function F({view:s,choose:a}){return e.jsxs("div",{className:"rm-view",role:"group","aria-label":"View","data-testid":"rm-view",children:[e.jsx("button",{type:"button","data-testid":"rm-view-timeline","aria-pressed":s==="timeline",onClick:a("timeline"),children:"Timeline"}),e.jsx("button",{type:"button","data-testid":"rm-view-board","aria-pressed":s==="board",onClick:a("board"),children:"Board"})]})}const H=s=>s instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName);function B({m:s,pool:a,repo:l,variant:t}){const[n,r]=j.useState(null),[i,o]=j.useState(null),[h,x]=j.useState(0),k=j.useRef(null),d=n?Y(s,a,n):null,g=j.useContext(Z),c=d==null?void 0:d.planPath,m=d==null?void 0:d.key,w=d!==null&&t!=="site"&&d.hasSection&&d.text===null&&d.planPath!==null&&g!==null;j.useEffect(()=>{if(!w||!n||!d||!d.planPath||!g)return;let u=!0;return g(l.path,d.planPath,d.key).then(y=>{u&&o({ref:n,text:y.text||null,error:!1})},()=>{u&&o({ref:n,text:null,error:!0})}),()=>{u=!1}},[n,w,g,l.path,c,m,h]);const p=i&&i.ref===n?i:null,b=(u,y)=>{if(k.current=y,u===n){p!=null&&p.error&&(o(null),x(J=>J+1));return}o(null),r(u)},N=()=>{var u;o(null),r(null),(u=k.current)==null||u.focus()};j.useEffect(()=>{if(n===null)return;const u=y=>{H(y.target)||y.key==="Escape"&&N()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n]);const f=e.jsx(ye,{detail:d?{title:d.title,text:d.text??(p==null?void 0:p.text)??null,phase:d.phase}:null,note:w&&!p?"loading":p!=null&&p.error?"error":null,variant:t,onClose:N});return{open:b,panel:f}}const ve={todo:ge,"in-progress":fe,done:ke,moved:Ne,blocked:be},K={size:14,"aria-hidden":!0};function E({tile:s}){const a=ve[s];return e.jsx(a,{...K})}function U({done:s,total:a}){const l=a?Math.round(100*s/a):0;return e.jsxs("div",{className:"rm-bar-wrap",children:[e.jsx("div",{className:"rm-bar",role:"img","aria-label":`${s} of ${a} phases done`,children:e.jsx("i",{style:{width:`${l}%`}})}),e.jsxs("span",{className:"rm-bar-text",children:[s,"/",a," phases · ",l,"%"]})]})}function $e(s,a){const l=document.getElementById(`ms-${s}-${a}`);l instanceof HTMLDetailsElement&&(l.open=!0),l==null||l.scrollIntoView({block:"start"})}function q({m:s,match:a,onOpen:l}){const t=r=>!a||a.phases.has(r.ref),n=s.milestones.length;return e.jsxs("section",{className:"rm-section","data-testid":"rm-timeline","aria-label":"Timeline",children:[e.jsx("h3",{className:"flow-h",children:"Timeline"}),e.jsxs("div",{className:"rm-timeline-grid",style:{"--rm-cols":n},children:[e.jsxs("div",{className:"rm-head-row",children:[e.jsx("div",{className:"rm-cell rm-head rm-lane",children:"Plan / milestone"}),s.milestones.map(r=>e.jsxs("div",{className:"rm-cell rm-head",children:[e.jsx("strong",{children:r.id})," ",e.jsx(v,{status:r.status}),e.jsx("span",{className:"rm-sub",children:r.depends.length?`after ${r.depends.join(", ")}`:"starts first"}),r.blockers.length>0&&e.jsxs("span",{className:"rm-gate-count",children:[r.blockers.length," gate(s)"]})]},r.id))]}),s.lanes.map(r=>e.jsxs("div",{className:"rm-row",children:[e.jsxs("div",{className:"rm-cell rm-lane",children:[r.plan,e.jsxs("span",{className:"rm-sub",children:[r.done,"/",r.total," done"]})]}),s.milestones.map(i=>e.jsx("div",{className:"rm-cell",children:i.phases.filter(o=>o.plan===r.plan&&t(o)).map(o=>e.jsxs("button",{type:"button",className:"rm-tile","data-state":o.tile,"data-risk":o.highRisk?"high":void 0,title:`${o.ref} ${o.name} | ${o.tracker||o.stage}`,onClick:h=>l(o.ref,h.currentTarget),children:[e.jsx(E,{tile:o.tile}),s.kind!=="plan"&&e.jsx("b",{className:"mono",children:o.num}),e.jsx("span",{children:o.name}),e.jsx("span",{className:"sr-only",children:T[o.tile]}),o.highRisk&&e.jsx("i",{className:"rm-risk","aria-label":"high risk"})]},o.ref))},i.id))]},r.plan)),s.blockers.length>0&&e.jsxs("div",{className:"rm-row",children:[e.jsx("div",{className:"rm-cell rm-lane",children:"Owner and outside"}),s.milestones.map(r=>e.jsx("div",{className:"rm-cell",children:r.blockers.map((i,o)=>e.jsxs("div",{className:"rm-gate-note",title:i.reason,children:[i.type,": ",i.reason.length>60?`${i.reason.slice(0,60)}…`:i.reason]},o))},r.id))]})]}),e.jsx("div",{className:"rm-timeline-list","data-testid":"rm-timeline-list",children:s.milestones.map(r=>e.jsxs("div",{children:[e.jsxs("h4",{className:"rm-list-h",children:[r.id," ",e.jsx(v,{status:r.status})]}),r.phases.filter(t).map(i=>e.jsxs("button",{type:"button",className:"rm-tile","data-state":i.tile,"data-risk":i.highRisk?"high":void 0,onClick:o=>l(i.ref,o.currentTarget),children:[e.jsx(E,{tile:i.tile}),s.kind!=="plan"&&e.jsxs("b",{className:"mono",children:[i.plan," ",i.num]}),e.jsx("span",{children:i.name}),e.jsx("span",{className:"sr-only",children:T[i.tile]}),i.highRisk&&e.jsx("i",{className:"rm-risk","aria-label":"high risk"})]},i.ref))]},r.id))}),e.jsxs("div",{className:"rm-legend","data-testid":"rm-legend",children:[e.jsx("span",{children:"to do · in progress · done · moved · blocked: each tile has an icon and a label"}),e.jsx("span",{children:"red dot = Risk high (stops for review)"})]})]})}function G({m:s,match:a,onOpen:l}){return e.jsxs("section",{className:"rm-section","data-testid":"rm-milestones","aria-label":"Milestones and phases",children:[e.jsx("h3",{className:"flow-h",children:"Milestones and phases"}),s.milestones.filter(t=>!a||a.milestones.has(t.id)).map(t=>e.jsxs("details",{className:"rm-ms",id:`ms-${s.slug}-${t.id}`,open:a?!0:void 0,children:[e.jsxs("summary",{children:[e.jsx("strong",{children:t.id})," ",e.jsx(v,{status:t.status}),s.kind!=="plan"&&e.jsxs("span",{className:"rm-sub",children:["owner ",t.owner,t.target?` · target ${t.target}`:""," · after ",t.depends.join(", ")||"-"]})]}),t.phases.length===0?e.jsx("p",{className:"col-empty",children:"No build phases."}):e.jsx("ul",{className:"flow-list",children:t.phases.filter(n=>!a||a.phases.has(n.ref)).map(n=>e.jsxs("li",{className:"flow-row","data-testid":"rm-phase","data-state":n.tile,children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("code",{className:"mono",children:n.ref}),e.jsx("button",{type:"button",className:"flow-title rm-open",onClick:r=>l(n.ref,r.currentTarget),children:n.name}),e.jsx(z,{phase:n})]}),e.jsxs("span",{className:"flow-why",children:[L(n)||"no model, lane or risk recorded",n.tracker?` · Tracker: ${n.tracker}`:""]})]},n.ref))})]},`${t.id}-${a?"q":"n"}`))]})}const W=(s,a,l)=>s==="site"?l?`#/roadmap/${encodeURIComponent(l)}`:"#/":se(a,"roadmap",l);function Te({repo:s,m:a,variant:l}){const t=D(s);return e.jsxs("div",{className:"rm-list-view",children:[(a.errors.length>0||a.repoError||a.roadmaps.some(n=>n.detailError))&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:[a.repoError&&e.jsxs("div",{children:["Could not read this repo: ",a.repoError]}),a.errors.map(n=>e.jsxs("div",{children:["Could not read ",n.slug,": ",n.error]},n.slug)),a.roadmaps.filter(n=>n.detailError).map(n=>e.jsxs("div",{children:["Detail unavailable for ",n.slug,": ",n.detailError]},n.slug))]}),e.jsx("ul",{className:"flow-list rm-cards","data-testid":"rm-list","aria-label":"Roadmaps",children:a.roadmaps.map(n=>{const r=ae(n);return e.jsx("li",{children:e.jsxs("a",{className:`rm-rcard rm-card tone-${r.tone}`,"data-testid":"rm-card",href:W(l,t,n.slug),children:[e.jsxs("span",{children:[e.jsx("strong",{children:r.slug})," ",e.jsx("span",{className:"rm-sub",children:r.branch??""})]}),e.jsx(U,{done:r.phasesDone,total:r.phasesTotal}),e.jsxs("span",{className:"rm-sub",children:[r.milestonesDone,"/",r.milestonesTotal," milestones"]}),e.jsx("span",{className:"rm-dots",children:r.dots.map(i=>e.jsx("span",{className:`rm-dot s-${i.status}`,children:i.id},i.id))}),e.jsxs("span",{className:"rm-sub",children:["next: ",r.next,l==="hub"?` · runner: ${r.runner}`:"",r.gates>0?` · ${r.gates} open gate${r.gates===1?"":"s"}`:""]})]})},n.slug)})})]})}const Pe={todo:"todo","in-progress":"prog",blocked:"block",done:"done",moved:"done"},C=s=>s.replace(/^☐\s*/u,"").trim();function Re({plan:s}){if(s.rows.length===0)return null;const a=ne(s);return e.jsxs("span",{className:"rm-pkpis","data-testid":"rm-plan-kpis",children:[e.jsxs("span",{className:"rm-pkpi",children:[e.jsxs("span",{className:"rm-pkpi-num",children:[a.done," / ",a.total]})," ","done"]}),e.jsx("span",{className:"rm-pbar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a.pct,"aria-label":"Share of rows done",children:e.jsx("span",{style:{width:`${a.pct}%`}})}),e.jsxs("span",{className:"rm-pkpi rm-pkpi-pct",children:[a.pct," %"]}),e.jsxs("span",{className:`rm-pkpi${a.inProgress?" tone-prog":""}`,children:[e.jsx("span",{className:"rm-pkpi-num",children:a.inProgress})," in progress"]}),e.jsxs("span",{className:`rm-pkpi${a.blocked?" tone-block":""}`,children:[e.jsx("span",{className:"rm-pkpi-num",children:a.blocked})," blocked"]}),e.jsxs("span",{className:"rm-pkpi",children:[e.jsx("span",{className:"rm-pkpi-num",children:a.todo})," to do"]})]})}function Ee({plan:s}){if(s.rows.length===0)return e.jsx("p",{className:"col-empty","data-testid":"rm-plan-board",children:"This plan has no Tracker table."});const a=re(s);return e.jsx("div",{className:"rm-cols rm-cols-4","data-testid":"rm-plan-board",children:le.map(l=>e.jsxs("div",{"data-col":l.key,children:[e.jsxs("h4",{className:"rm-list-h",children:[l.label," · ",a[l.key].length]}),a[l.key].length===0?e.jsx("p",{className:"col-empty",children:"none"}):a[l.key].map((t,n)=>e.jsxs("div",{className:`rm-rcard rm-pcard tone-${Pe[t.state]}${t.state==="moved"?" is-moved":""}`,children:[e.jsx("strong",{children:t.phase}),C(t.status)?e.jsx("span",{className:"rm-sub",children:C(t.status)}):null]},`${t.phase}-${n}`))]},l.key))})}function Ce({m:s,plan:a,repo:l,variant:t,initialView:n}){const[r,i]=V(n),{open:o,panel:h}=B({m:s,pool:[a],repo:l,variant:t}),x=s.kpis;return e.jsxs("div",{className:"rm-detail","data-testid":"rm-detail",children:[s.detailError&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Roadmap detail is unavailable: ",s.detailError,". Phase names, Tracker cells and PR links are missing."]}),e.jsx("header",{"data-testid":"rm-header",children:e.jsxs("p",{className:"page-subtitle",children:[x.phasesDone," of ",x.phasesTotal," phases done"]})}),e.jsx(F,{view:r,choose:i}),e.jsxs("section",{className:"rm-kpis kpi-strip","data-testid":"rm-kpis","aria-label":"Summary",children:[e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Phases done"}),e.jsxs("span",{className:"kpi-num",children:[x.phasesDone," / ",x.phasesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"In progress"}),e.jsx("span",{className:"kpi-num",children:x.inProgress.length}),e.jsx("span",{className:"kpi-sub tone-muted",children:x.inProgress.join(", ")||"none"})]})]}),r==="timeline"?e.jsx(q,{m:s,match:null,onOpen:o}):e.jsx(Ee,{plan:a}),e.jsx(G,{m:s,match:null,onOpen:o}),h]})}function Le(s){const[a]=j.useState(()=>te(s));return a}function De({plan:s,repo:a,variant:l,initialView:t,defaultOpen:n}){const[r,i]=j.useState(n);return e.jsxs("details",{className:"rm-plan","aria-label":s.title,open:r||void 0,onToggle:o=>i(o.currentTarget.open),children:[e.jsxs("summary",{className:"rm-plan-sum",children:[e.jsx("span",{className:"rm-plan-title",children:s.title}),e.jsxs("span",{className:"rm-sub",children:[s.open," open"]}),s.overlay&&e.jsx("span",{className:"rm-plan-branch","data-testid":"rm-plan-branch",children:ie(s.overlay)}),e.jsx(Re,{plan:s}),e.jsx("span",{className:"rm-plan-only",children:"plan only, no runner"})]}),r&&e.jsx(Ce,{m:ce(a,s),plan:s,repo:a,variant:l,initialView:t})]})}function X({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n}){const r=Le(s);return e.jsx(e.Fragment,{children:s.map(i=>e.jsx(De,{plan:i,repo:a,variant:l,initialView:t,defaultOpen:n||i.path===r},i.path))})}function Se({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n=!1}){return e.jsxs("div",{className:"flow","data-testid":"rm-plans",children:[e.jsx("p",{className:"page-subtitle",children:"No roadmap here. These plans are active. Click a plan to open or close it."}),e.jsx(X,{plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n})]})}function Me({plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n=!1}){return s.length===0?null:e.jsxs("div",{className:"flow","data-testid":"rm-other-plans",children:[e.jsx("h2",{className:"rm-title",children:"Plans with no roadmap"}),e.jsx(X,{plans:s,repo:a,variant:l,initialView:t,initialOpenAll:n})]})}function _e({m:s,repo:a,crumbHref:l,match:t,variant:n,initialView:r,plans:i}){const[o,h]=V(r),{open:x,panel:k}=B({m:s,pool:i??[],repo:a,variant:n}),d=s.kpis,g=c=>()=>$e(s.slug,c);return e.jsxs("div",{className:"rm-detail","data-testid":"rm-detail",children:[e.jsxs("nav",{className:"rm-crumbs","data-testid":"rm-crumbs","aria-label":"Breadcrumb",children:[l?e.jsx("a",{href:l,children:"Roadmaps"}):e.jsx("span",{children:"Roadmaps"})," › ",e.jsx("span",{children:oe(a)})," › ",e.jsx("strong",{children:s.slug})]}),s.detailError&&e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Roadmap detail is unavailable: ",s.detailError,". Phase names, Tracker cells and PR links are missing."]}),e.jsxs("header",{"data-testid":"rm-header",children:[e.jsxs("h2",{className:"rm-title",children:["Roadmap ",s.slug]}),e.jsxs("p",{className:"page-subtitle",children:[d.milestonesDone," of ",d.milestonesTotal," milestones · ",d.phasesDone," of ",d.phasesTotal," phases done",s.branch?e.jsxs(e.Fragment,{children:[" · branch ",e.jsx("code",{children:s.branch})]}):null,s.originCommit?e.jsxs(e.Fragment,{children:[" · origin ",e.jsx("code",{children:s.originCommit})]}):null]}),s.lanes.length>0&&e.jsx("div",{className:"rm-chips","data-testid":"rm-chips",children:s.lanes.map(c=>e.jsxs("span",{className:"rm-chip",children:[e.jsx("b",{children:c.plan})," ",e.jsxs("span",{className:"mono",children:[c.done,"/",c.total," phases"]})]},c.plan))})]}),e.jsx(F,{view:o,choose:h}),e.jsxs("section",{className:`rm-section rm-waiting${s.gates.length?" has":""}`,"data-testid":"rm-waiting","aria-label":"Waiting for you",children:[e.jsx("h3",{className:"flow-h",children:"Waiting for you"}),s.gates.length===0?e.jsx("p",{className:"col-empty",children:"No owner gate is waiting."}):e.jsx("ul",{className:"flow-list",children:s.gates.map((c,m)=>e.jsxs("li",{className:"flow-row",children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("strong",{children:c.milestone}),e.jsx("span",{className:"chip chip-owner-gate",children:"owner-gate"})]}),e.jsx("span",{className:"flow-why",children:c.reason}),c.check&&e.jsx("code",{className:"mono",children:c.check})]},m))})]}),e.jsxs("section",{className:"rm-kpis kpi-strip","data-testid":"rm-kpis","aria-label":"Summary",children:[e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Phases done"}),e.jsxs("span",{className:"kpi-num",children:[d.phasesDone," / ",d.phasesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"Milestones done"}),e.jsxs("span",{className:"kpi-num",children:[d.milestonesDone," / ",d.milestonesTotal]})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"In progress"}),e.jsx("span",{className:"kpi-num",children:d.inProgress.length}),e.jsx("span",{className:"kpi-sub tone-muted",children:d.inProgress.join(", ")||"none"})]}),e.jsxs("div",{className:"kpi-tile",children:[e.jsx("span",{className:"kpi-label",children:"High-risk phases"}),e.jsx("span",{className:`kpi-num${d.highRisk?" bad":""}`,children:d.highRisk})]}),e.jsxs("div",{className:"kpi-tile deploy",children:[e.jsx("span",{className:"kpi-label",children:"Next batch for the runner"}),e.jsx("span",{className:"kpi-val",children:d.next})]})]}),e.jsxs("section",{className:"rm-section","data-testid":"rm-flow","aria-label":"Flow",children:[e.jsx("h3",{className:"flow-h",children:"Flow"}),e.jsx("div",{className:"rm-chain",children:s.milestones.map((c,m)=>e.jsxs("span",{className:"rm-chain-item",children:[m>0&&e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsxs("button",{type:"button",className:`rm-node tone-${c.tone}`,onClick:g(c.id),children:[e.jsx("b",{children:c.id})," ",e.jsx(v,{status:c.status}),e.jsxs("span",{className:"rm-sub",children:[c.depends.length?`after ${c.depends.join(", ")}`:"starts first"," · ",c.done,"/",c.total," ph"]})]})]},c.id))})]}),o==="timeline"?e.jsx(q,{m:s,match:t,onOpen:x}):e.jsxs("section",{className:"rm-section","data-testid":"rm-board","aria-label":"Now, next, later",children:[e.jsx("h3",{className:"flow-h",children:"Now, next, later"}),e.jsx("div",{className:"rm-cols",children:["now","next","later"].map(c=>e.jsxs("div",{children:[e.jsx("h4",{className:"rm-list-h",children:c[0].toUpperCase()+c.slice(1)}),s.board[c].length===0?e.jsx("p",{className:"col-empty",children:"none"}):s.board[c].map(m=>e.jsxs("button",{type:"button",className:`rm-rcard tone-${m.tone}`,onClick:g(m.id),children:[e.jsxs("span",{children:[e.jsx("strong",{children:m.id})," ",e.jsx(v,{status:m.status})]}),e.jsx(U,{done:m.done,total:m.total}),m.blockers.map((w,p)=>e.jsx("span",{className:"rm-sub",children:w.type},p))]},m.id))]},c))})]}),e.jsxs("section",{className:"rm-section","data-testid":"rm-gates","aria-label":"Gates and blockers",children:[e.jsxs("h3",{className:"flow-h",children:["Gates and blockers · ",s.blockers.length," open"]}),s.blockers.length===0?e.jsx("p",{className:"col-empty",children:"No blockers."}):e.jsx("ul",{className:"flow-list",children:s.blockers.map((c,m)=>e.jsxs("li",{className:"flow-row",children:[e.jsxs("div",{className:"flow-row-head",children:[e.jsx("strong",{children:c.milestone}),e.jsx("span",{className:`chip ${c.type==="owner-gate"?"chip-owner-gate":"chip-hub"}`,children:c.type})]}),e.jsx("span",{className:"flow-why",children:c.reason}),c.check&&e.jsx("code",{className:"mono",children:c.check})]},m))})]}),e.jsx(G,{m:s,match:t,onOpen:x}),n==="hub"&&e.jsxs("section",{className:"rm-section","data-testid":"rm-runner","aria-label":"Runner",children:[e.jsx("h3",{className:"flow-h",children:"Runner"}),s.runner.running?e.jsxs("p",{children:["Running batch ",e.jsx("code",{children:s.runner.running.batch}),s.runner.running.since?` since ${P(s.runner.running.since)}`:"",s.runner.running.host?` (host ${s.runner.running.host}${s.runner.running.pid?`, pid ${s.runner.running.pid}`:""})`:"","."]}):e.jsx("p",{className:"col-empty",children:"No runner holds this roadmap now."}),s.runner.staleBatch!==null&&e.jsxs("p",{children:["A stale runner lock remains (batch ",e.jsx("code",{children:s.runner.staleBatch}),"): the runner that held it is gone."]}),s.runner.lastStop&&e.jsxs("p",{children:["Last stop record: ",s.runner.lastStopAt?`${P(s.runner.lastStopAt)}: `:"",s.runner.lastStop,"."]}),s.runner.errors.map(c=>e.jsxs("p",{className:"tone-warn",children:["Could not read ",c,"."]},c)),s.runner.next&&e.jsxs("p",{children:["Next batch: ",e.jsx("code",{children:s.runner.next})]})]}),k]})}function Ae({repo:s,slug:a,stale:l=!1,lastOkAt:t=null,variant:n="hub",initialView:r,initialOpenAll:i=!1,nowMs:o}){const h=de(s),[x,k]=j.useState(""),d=j.useRef(null);j.useEffect(()=>{const b=N=>{var f;N.key==="/"&&!H(N.target)&&!N.ctrlKey&&!N.metaKey&&!N.altKey&&(N.preventDefault(),(f=d.current)==null||f.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[]);const g=D(s),c=l&&e.jsxs("p",{className:"lane-note","data-testid":"rm-stale",children:["Roadmap data is old. Last good read ",he(t),". The numbers below are greyed."]}),m=n==="hub"?me(s.plans,o??Date.now()):null,w=m&&e.jsx("p",{className:`page-subtitle rm-source${m.old?" tone-warn":""}`,"data-testid":"rm-source",children:m.text});let p;if(h.mode==="none")p=e.jsxs("div",{className:"notice","data-testid":"rm-none",children:[e.jsx("h2",{className:"rm-title",children:ue}),e.jsxs("p",{children:["Create one with ",e.jsx("code",{className:"cmd",children:je}),"."]})]});else if(h.mode==="error")p=e.jsxs("div",{className:"lane-note","data-testid":"rm-errors",children:["Could not read this repo: ",h.repoError]});else if(h.mode==="plans")p=e.jsx(Se,{plans:h.plans,repo:s,variant:n,initialView:r,initialOpenAll:i});else{const b=a?h.roadmaps.find(N=>N.slug===a):n==="hub"&&pe(h)?h.roadmaps[0]:void 0;if(b){const N=h.roadmaps.length+h.errors.length>1,f=xe(b,x);p=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rm-searchbar",children:[e.jsxs("label",{className:"rm-search",children:[e.jsx(we,{...K}),e.jsx("span",{className:"sr-only",children:"Search this roadmap"}),e.jsx("input",{ref:d,type:"search","data-testid":"rm-search",placeholder:"Search phases, PRs, milestones (press /)",value:x,onChange:u=>k(u.target.value),onKeyDown:u=>{u.key==="Escape"&&k("")}})]}),e.jsx("span",{className:"rm-match","data-testid":"rm-match-count","aria-live":"polite",children:f?`${f.count} ${f.count===1?"match":"matches"}`:""})]}),e.jsx(_e,{m:b,plans:h.plans,repo:s,crumbHref:N?W(n,g):null,match:f,variant:n,initialView:r})]})}else p=e.jsxs(e.Fragment,{children:[a&&e.jsxs("p",{className:"lane-note","data-testid":"rm-missing",children:["No roadmap named ",a," in this repo."]}),e.jsx(Te,{repo:s,m:h,variant:n})]})}return e.jsxs("div",{className:`rm${l?" stale":""}`,"data-testid":"roadmap-tab",children:[c,w,p,h.mode==="roadmaps"?e.jsx(Me,{plans:h.otherPlans,repo:s,variant:n,initialView:r,initialOpenAll:i}):null]})}export{Fe as collectorStale,Ae as default};