ex-workflow 1.1.1 → 1.2.0

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 (181) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +64 -31
  3. package/dist/adapters/index.cjs +1 -1
  4. package/dist/adapters/index.d.cts +1 -1
  5. package/dist/adapters/index.d.ts +1 -1
  6. package/dist/adapters/index.mjs +1 -1
  7. package/dist/{budget-CezCinPF.d.cts → budget-Bm839Qw0.d.cts} +8 -7
  8. package/dist/{budget-Bd8KpGIr.d.ts → budget-Gckmqj74.d.ts} +8 -7
  9. package/dist/chunk-32NVJV5C.mjs +2 -0
  10. package/dist/chunk-32NVJV5C.mjs.map +1 -0
  11. package/dist/chunk-3GKYL6VB.mjs +6 -0
  12. package/dist/chunk-3GKYL6VB.mjs.map +1 -0
  13. package/dist/chunk-3O5MPAJT.cjs +2 -0
  14. package/dist/chunk-3O5MPAJT.cjs.map +1 -0
  15. package/dist/{chunk-C2IYMWE6.cjs → chunk-43GLYYA2.cjs} +3 -3
  16. package/dist/chunk-43GLYYA2.cjs.map +1 -0
  17. package/dist/chunk-4HG6A3SF.mjs +2 -0
  18. package/dist/chunk-4HG6A3SF.mjs.map +1 -0
  19. package/dist/chunk-6D6FL3XK.mjs +2 -0
  20. package/dist/chunk-6D6FL3XK.mjs.map +1 -0
  21. package/dist/chunk-7EF47R2J.mjs +2 -0
  22. package/dist/chunk-7EF47R2J.mjs.map +1 -0
  23. package/dist/chunk-BBI7AKJK.cjs +2 -0
  24. package/dist/chunk-BBI7AKJK.cjs.map +1 -0
  25. package/dist/{chunk-KLWZEXZU.mjs → chunk-BD76VFI4.mjs} +3 -3
  26. package/dist/chunk-BD76VFI4.mjs.map +1 -0
  27. package/dist/chunk-BHAEPYRJ.cjs +2 -0
  28. package/dist/chunk-BHAEPYRJ.cjs.map +1 -0
  29. package/dist/chunk-BYPFTO7P.mjs +2 -0
  30. package/dist/chunk-BYPFTO7P.mjs.map +1 -0
  31. package/dist/chunk-C4ISBUZR.mjs +2 -0
  32. package/dist/chunk-C4ISBUZR.mjs.map +1 -0
  33. package/dist/chunk-FDZB73PH.mjs +2 -0
  34. package/dist/chunk-FDZB73PH.mjs.map +1 -0
  35. package/dist/chunk-GKN5M4B7.cjs +2 -0
  36. package/dist/chunk-GKN5M4B7.cjs.map +1 -0
  37. package/dist/chunk-IDZ435YZ.mjs +2 -0
  38. package/dist/{chunk-KIQOUUEZ.mjs.map → chunk-IDZ435YZ.mjs.map} +1 -1
  39. package/dist/chunk-IIEKK2S3.cjs +2 -0
  40. package/dist/chunk-IIEKK2S3.cjs.map +1 -0
  41. package/dist/chunk-JNLWI4JM.mjs +2 -0
  42. package/dist/chunk-JNLWI4JM.mjs.map +1 -0
  43. package/dist/chunk-K4VSMIJZ.cjs +2 -0
  44. package/dist/chunk-K4VSMIJZ.cjs.map +1 -0
  45. package/dist/chunk-LCN4UNYK.cjs +2 -0
  46. package/dist/chunk-LCN4UNYK.cjs.map +1 -0
  47. package/dist/chunk-LIATP6LY.mjs +2 -0
  48. package/dist/chunk-LIATP6LY.mjs.map +1 -0
  49. package/dist/chunk-MB465DI4.mjs +2 -0
  50. package/dist/chunk-MB465DI4.mjs.map +1 -0
  51. package/dist/chunk-OSHBJIYD.cjs +2 -0
  52. package/dist/chunk-OSHBJIYD.cjs.map +1 -0
  53. package/dist/chunk-OVR5CK3R.cjs +2 -0
  54. package/dist/chunk-OVR5CK3R.cjs.map +1 -0
  55. package/dist/chunk-OZAYOPLB.mjs +2 -0
  56. package/dist/chunk-OZAYOPLB.mjs.map +1 -0
  57. package/dist/chunk-PNWRA4JU.cjs +2 -0
  58. package/dist/{chunk-PO2SPQJP.cjs.map → chunk-PNWRA4JU.cjs.map} +1 -1
  59. package/dist/chunk-QAENYYU6.cjs +2 -0
  60. package/dist/chunk-QAENYYU6.cjs.map +1 -0
  61. package/dist/chunk-RXY434DX.cjs +6 -0
  62. package/dist/chunk-RXY434DX.cjs.map +1 -0
  63. package/dist/chunk-SFYUJQYW.cjs +2 -0
  64. package/dist/chunk-SFYUJQYW.cjs.map +1 -0
  65. package/dist/chunk-TQR3VFZU.mjs +2 -0
  66. package/dist/chunk-TQR3VFZU.mjs.map +1 -0
  67. package/dist/chunk-U3RU5LOF.cjs +2 -0
  68. package/dist/chunk-U3RU5LOF.cjs.map +1 -0
  69. package/dist/chunk-UUWDQVIJ.mjs +2 -0
  70. package/dist/chunk-UUWDQVIJ.mjs.map +1 -0
  71. package/dist/chunk-VXOZIP77.cjs +2 -0
  72. package/dist/chunk-VXOZIP77.cjs.map +1 -0
  73. package/dist/chunk-W2P27645.cjs +2 -0
  74. package/dist/chunk-W2P27645.cjs.map +1 -0
  75. package/dist/chunk-WPVL27G4.mjs +2 -0
  76. package/dist/chunk-WPVL27G4.mjs.map +1 -0
  77. package/dist/chunk-YS6CXERQ.mjs +2 -0
  78. package/dist/chunk-YS6CXERQ.mjs.map +1 -0
  79. package/dist/chunk-Z43GUETW.cjs +2 -0
  80. package/dist/chunk-Z43GUETW.cjs.map +1 -0
  81. package/dist/cli/bin.cjs +1 -1
  82. package/dist/cli/bin.cjs.map +1 -1
  83. package/dist/cli/bin.mjs +1 -1
  84. package/dist/cli/bin.mjs.map +1 -1
  85. package/dist/cli/index.cjs +1 -1
  86. package/dist/cli/index.mjs +1 -1
  87. package/dist/experimentation/index.cjs +1 -1
  88. package/dist/experimentation/index.d.cts +2 -2
  89. package/dist/experimentation/index.d.ts +2 -2
  90. package/dist/experimentation/index.mjs +1 -1
  91. package/dist/index.cjs +1 -1
  92. package/dist/index.cjs.map +1 -1
  93. package/dist/index.d.cts +143 -15
  94. package/dist/index.d.ts +143 -15
  95. package/dist/index.mjs +1 -1
  96. package/dist/index.mjs.map +1 -1
  97. package/dist/investigation/index.cjs +1 -1
  98. package/dist/investigation/index.d.cts +2 -2
  99. package/dist/investigation/index.d.ts +2 -2
  100. package/dist/investigation/index.mjs +1 -1
  101. package/dist/kanban/index.cjs +1 -1
  102. package/dist/kanban/index.d.cts +2 -1
  103. package/dist/kanban/index.d.ts +2 -1
  104. package/dist/kanban/index.mjs +1 -1
  105. package/dist/registry/index.cjs +2 -0
  106. package/dist/registry/index.cjs.map +1 -0
  107. package/dist/registry/index.d.cts +25 -0
  108. package/dist/registry/index.d.ts +25 -0
  109. package/dist/registry/index.mjs +2 -0
  110. package/dist/registry/index.mjs.map +1 -0
  111. package/dist/schema/index.cjs +1 -1
  112. package/dist/schema/index.d.cts +2 -0
  113. package/dist/schema/index.d.ts +2 -0
  114. package/dist/schema/index.mjs +1 -1
  115. package/dist/scrum/index.cjs +1 -1
  116. package/dist/scrum/index.d.cts +3 -3
  117. package/dist/scrum/index.d.ts +3 -3
  118. package/dist/scrum/index.mjs +1 -1
  119. package/dist/{types-BScHXlRx.d.ts → types-DjePDfms.d.cts} +61 -22
  120. package/dist/{types-BScHXlRx.d.cts → types-DjePDfms.d.ts} +61 -22
  121. package/dist/types.cjs +1 -1
  122. package/dist/types.d.cts +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/types.mjs +1 -1
  125. package/dist/waterfall/index.cjs +1 -1
  126. package/dist/waterfall/index.d.cts +1 -1
  127. package/dist/waterfall/index.d.ts +1 -1
  128. package/dist/waterfall/index.mjs +1 -1
  129. package/package.json +17 -3
  130. package/dist/chunk-2FRRD6A3.mjs +0 -2
  131. package/dist/chunk-2FRRD6A3.mjs.map +0 -1
  132. package/dist/chunk-6P3OKXSK.mjs +0 -2
  133. package/dist/chunk-6P3OKXSK.mjs.map +0 -1
  134. package/dist/chunk-7FS6KWTG.cjs +0 -2
  135. package/dist/chunk-7FS6KWTG.cjs.map +0 -1
  136. package/dist/chunk-7QQY4KJ2.mjs +0 -2
  137. package/dist/chunk-7QQY4KJ2.mjs.map +0 -1
  138. package/dist/chunk-AD4Z3JBL.cjs +0 -2
  139. package/dist/chunk-AD4Z3JBL.cjs.map +0 -1
  140. package/dist/chunk-ATCJ4IHP.mjs +0 -2
  141. package/dist/chunk-ATCJ4IHP.mjs.map +0 -1
  142. package/dist/chunk-C2IYMWE6.cjs.map +0 -1
  143. package/dist/chunk-EACZBAP3.cjs +0 -2
  144. package/dist/chunk-EACZBAP3.cjs.map +0 -1
  145. package/dist/chunk-EFCUM6DK.mjs +0 -2
  146. package/dist/chunk-EFCUM6DK.mjs.map +0 -1
  147. package/dist/chunk-EHBQBXWA.cjs +0 -2
  148. package/dist/chunk-EHBQBXWA.cjs.map +0 -1
  149. package/dist/chunk-FTS75UIU.mjs +0 -2
  150. package/dist/chunk-FTS75UIU.mjs.map +0 -1
  151. package/dist/chunk-HCRVWMG4.cjs +0 -2
  152. package/dist/chunk-HCRVWMG4.cjs.map +0 -1
  153. package/dist/chunk-KIQOUUEZ.mjs +0 -2
  154. package/dist/chunk-KLWZEXZU.mjs.map +0 -1
  155. package/dist/chunk-NDCQTRIV.mjs +0 -2
  156. package/dist/chunk-NDCQTRIV.mjs.map +0 -1
  157. package/dist/chunk-PMUGU5UJ.cjs +0 -2
  158. package/dist/chunk-PMUGU5UJ.cjs.map +0 -1
  159. package/dist/chunk-PO2SPQJP.cjs +0 -2
  160. package/dist/chunk-QZ6HD6DE.mjs +0 -6
  161. package/dist/chunk-QZ6HD6DE.mjs.map +0 -1
  162. package/dist/chunk-RL27372B.cjs +0 -2
  163. package/dist/chunk-RL27372B.cjs.map +0 -1
  164. package/dist/chunk-S3BXVHO7.cjs +0 -2
  165. package/dist/chunk-S3BXVHO7.cjs.map +0 -1
  166. package/dist/chunk-SP5MC7RR.mjs +0 -2
  167. package/dist/chunk-SP5MC7RR.mjs.map +0 -1
  168. package/dist/chunk-SVGTSPZF.cjs +0 -2
  169. package/dist/chunk-SVGTSPZF.cjs.map +0 -1
  170. package/dist/chunk-SYLO7FUL.mjs +0 -2
  171. package/dist/chunk-SYLO7FUL.mjs.map +0 -1
  172. package/dist/chunk-T3V5UE34.mjs +0 -2
  173. package/dist/chunk-T3V5UE34.mjs.map +0 -1
  174. package/dist/chunk-TS66RAJR.cjs +0 -2
  175. package/dist/chunk-TS66RAJR.cjs.map +0 -1
  176. package/dist/chunk-U23FUYPD.cjs +0 -6
  177. package/dist/chunk-U23FUYPD.cjs.map +0 -1
  178. package/dist/chunk-U6GHFKKE.mjs +0 -2
  179. package/dist/chunk-U6GHFKKE.mjs.map +0 -1
  180. package/dist/chunk-YJQ5YJ7S.cjs +0 -2
  181. package/dist/chunk-YJQ5YJ7S.cjs.map +0 -1
@@ -1,2 +0,0 @@
1
- import {c,e,d,g,f as f$1,b as b$3}from'./chunk-QZ6HD6DE.mjs';import {b as b$2,e as e$2,d as d$2,c as c$1}from'./chunk-ATCJ4IHP.mjs';import {l}from'./chunk-SP5MC7RR.mjs';import {I}from'./chunk-T3V5UE34.mjs';import {N}from'./chunk-SYLO7FUL.mjs';import {b as b$4}from'./chunk-7QQY4KJ2.mjs';import {h as h$2}from'./chunk-U6GHFKKE.mjs';import {f,V,d as d$1,P,J,u,W,A,Y,w as w$1,v,X}from'./chunk-6P3OKXSK.mjs';import {b as b$1,e as e$1,h as h$1,g as g$1,f as f$2}from'./chunk-KLWZEXZU.mjs';import {b,a}from'./chunk-2FRRD6A3.mjs';import {stat,readFile}from'fs/promises';import w from'path';var $={scrum:l,kanban:I,waterfall:N,investigation:b$4,experimentation:h$2},p=["exwf init <scrum|kanban|waterfall|investigation|experimentation> --config <file> [--roles <file>]","exwf add <item.json> [--by who] exwf edit <id> <patch.json> [--by who]","exwf next [--max n] [--fallback-tokens-per-weight n]","exwf complete <id> <handoff.json> --tokens-in n --tokens-out n --duration-ms n --model m [--estimate] [--role r]","exwf account <item> [--line n] [--tokens-in n] [--tokens-out n] [--duration-ms n] [--model m] [--by who]","exwf ceremony <name> [input.json] [--by who]","exwf decide <pendingId> approve|reject [--by who] [--note text]","exwf config set <patch.json> [--by who] exwf unblock <item> [--blocker id] [--note text] [--by who]","exwf status | board | metrics | pending | lessons","exwf validate <action.json> exwf role add <manifest.json> | role list"],rt=new Set(["estimate"]);function nt(l){let t=[],u={};for(let i=0;i<l.length;i++){let v=l[i];if(v.startsWith("--")){let n=v.slice(2);if(rt.has(n)){u[n]="true";continue}let f=l[i+1];(f===void 0||f.startsWith("--"))&&b("invalid-input",`--${n} needs a value`,`pass --${n} <text>`),u[n]=f,i++;}else t.push(v);}return {positional:t,flags:u}}async function x(l){try{return JSON.parse(await readFile(l,"utf8"))}catch(t){return b("invalid-input",`cannot read JSON from ${l}: ${t.message}`,"check the path and that the file is valid JSON")}}function h(l){let t=Object.hasOwn($,l.methodology)?$[l.methodology]:void 0;return t||b("config-invalid",`methodology "${l.methodology}" is not available in this build`,`available: ${Object.keys($).join(", ")}`),t()}function y(l,t){let u=Number(l[t]);return Number.isFinite(u)||b("invalid-input",`--${t} must be a number (got ${JSON.stringify(l[t])})`,`pass --${t} <n>`),u}var lt=new Set(["init","add","edit","next","complete","account","ceremony","decide","unblock"]);async function At(l,t){try{let[u,i]=nt(l).positional;return u!==void 0&&(lt.has(u)||u==="role"&&i==="add"||u==="config"&&i==="set")?await c(t,()=>ot(l,t)):await ot(l,t)}catch(u){if(u instanceof a)return {exit:1,out:{ok:false,error:u.toJSON()}};throw u}}async function ot(l,t){let{positional:u$1,flags:i}=nt(l),[v$1,...n]=u$1,f$3=i.by??"human",d$3=new Date().toISOString();switch(v$1){case "init":{let[e]=n,o=e&&Object.hasOwn($,e)?$[e]:void 0;if(!o||!i.config)return {exit:2,out:{ok:false,usage:p}};try{await stat(b$3(t)),b("invalid-input",`${b$3(t)} already exists`,"delete .workflow/state.json to start over");}catch(c){if(c instanceof a||c.code!=="ENOENT")throw c}let a$1=await x(w.resolve(t,i.config)),s=i.roles?await x(w.resolve(t,i.roles)):void 0;if(s!==void 0){Array.isArray(s)||b("invalid-input",`roles file ${i.roles} must contain an array of role manifests`,"wrap the manifests in [ ... ]");for(let c of s)b$1(e$1,c,`roles file ${i.roles}`);}let r=X(s?{methodology:o(),config:a$1,roles:s,by:f$3,now:d$3}:{methodology:o(),config:a$1,by:f$3,now:d$3});return await d(t,r.state),{exit:0,out:{ok:true,warnings:r.warnings,state:{methodology:r.state.methodology,stages:r.state.stages.map(c=>c.id),roles:Object.keys(r.state.roles)}}}}case "add":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=await x(w.resolve(t,n[0]));b$1(f$2,o,`item file ${n[0]}`);let a=W(e$1,h(e$1),{type:"item.add",by:f$3,payload:{item:o}},s=>v(s,o,f$3,d$3));return await d(t,a.state),{exit:0,out:{ok:true,warnings:a.warnings,item:u(a.state,o.id)}}}case "edit":{if(!n[0]||!n[1])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=n[0],a=await x(w.resolve(t,n[1]));b$1(g$1,a,`patch file ${n[1]}`);let s=W(e$1,h(e$1),{type:"item.edit",by:f$3,payload:{id:o,patch:a}},r=>w$1(r,o,a,f$3,d$3));return await d(t,s.state),{exit:0,out:{ok:true,warnings:s.warnings,item:u(s.state,o)}}}case "next":{let e$1=await e(t),o={now:d$3};i.max&&(o.max=y(i,"max")),i["fallback-tokens-per-weight"]&&(o.fallbackTokensPerWeight=y(i,"fallback-tokens-per-weight"));let a=c$1(e$1,h(e$1),o);for(let s of a.briefs)await f$1(t,s);return await d(t,a.state),{exit:0,out:{ok:true,reason:a.reason??null,skipped:a.skipped,briefs:a.briefs}}}case "complete":{if(!n[0]||!n[1])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=await x(w.resolve(t,n[1]));b$1(h$1,o,`handoff file ${n[1]}`),o.item!==n[0]&&b("handoff-invalid",`handoff.item "${o.item}" differs from the command's item "${n[0]}"`,"make them match");let a=i.role??o.role,s=y(i,"duration-ms"),r={item:n[0],role:a,model:i.model??"",tokensIn:y(i,"tokens-in"),tokensOut:y(i,"tokens-out"),durationMs:s,startedAt:new Date(Date.parse(d$3)-s).toISOString(),endedAt:d$3};i.estimate==="true"&&(r.estimate=true);let c=d$2(e$1,h(e$1),{...o,role:a},r,d$3);return await g(t,o,c.state.events.length),await d(t,c.state),{exit:0,out:{ok:true,warnings:c.warnings,item:u(c.state,n[0])}}}case "account":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o={};i["tokens-in"]!==void 0&&(o.tokensIn=y(i,"tokens-in")),i["tokens-out"]!==void 0&&(o.tokensOut=y(i,"tokens-out")),i["duration-ms"]!==void 0&&(o.durationMs=y(i,"duration-ms")),i.model!==void 0&&(o.model=i.model);let a=i.line!==void 0?y(i,"line"):void 0,s=e$2(e$1,n[0],o,i.by??"human",d$3,a);await d(t,s);let r=d$1(s),c=r.payload.line;return {exit:0,out:{ok:true,line:s.accounting.filter(A=>A.item===n[0])[c-1],event:r}}}case "ceremony":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=h(e$1),a=Object.hasOwn(o.ceremonies,n[0])?o.ceremonies[n[0]]:void 0;a||b("unknown-ceremony",`"${n[0]}" is not a ${o.name} ceremony`,`available: ${Object.keys(o.ceremonies).join(", ")}`);let s=n[1]?await x(w.resolve(t,n[1])):{},r=a(e$1,{...s,by:f$3,now:d$3});return await d(t,r.state),{exit:0,out:{ok:true,warnings:r.warnings,lastEvent:d$1(r.state)}}}case "config":{if(n[0]!=="set"||!n[1])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=await x(w.resolve(t,n[1])),a=Y(e$1,h(e$1),o,f$3,d$3);return await d(t,a.state),{exit:0,out:{ok:true,warnings:a.warnings,changed:d$1(a.state).payload.changed,config:a.state.config}}}case "unblock":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e$1=n[0],o=await e(t),a=u(o,e$1).blockers.filter(O=>!O.clearedAt).map(O=>O.id);a.length===0&&b("invalid-input",`item ${e$1} has no open blocker`,"nothing to clear; check exwf board");let s=i.blocker!==void 0?[i.blocker]:a,r=i.note,c=W(o,h(o),{type:"blocker.clear",by:f$3,payload:{id:e$1,blockers:s,note:r??null}},O=>s.reduce((A$1,at)=>A(A$1,e$1,at,f$3,d$3,r),O));return await d(t,c.state),{exit:0,out:{ok:true,warnings:c.warnings,item:u(c.state,e$1)}}}case "decide":{if(!n[0]||n[1]!=="approve"&&n[1]!=="reject")return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=e$1.pending.find(s=>s.id===n[0]),a=J(e$1,n[0],n[1],f$3,i.note??"",d$3,h(e$1));return await d(t,a),{exit:0,out:{ok:true,item:o?.item?u(a,o.item):null}}}case "status":{let e$1=await e(t),o=h(e$1),a={todo:0,in_progress:0,blocked:0,review:0,awaiting_human:0,done:0,dropped:0};for(let s of Object.values(e$1.items))a[s.status]+=1;return {exit:0,out:{ok:true,methodology:e$1.methodology,openIteration:P(e$1)??null,counts:a,pending:e$1.pending,openQuestions:b$2(e$1),lastEvent:d$1(e$1),report:o.report?o.report(e$1):null}}}case "board":{let e$1=await e(t);return {exit:0,out:{ok:true,columns:e$1.stages.map(a=>({stage:a.id,wipLimit:a.wipLimit??null,items:Object.values(e$1.items).filter(s=>s.stage===a.id&&s.status!=="dropped").map(s=>({id:s.id,title:s.title,status:s.status,role:s.role??null,age:s.transitions.length?Date.parse(d$3)-Date.parse(s.transitions[s.transitions.length-1].at):null}))}))}}}case "metrics":{let e$1=await e(t);return {exit:0,out:{ok:true,metrics:h(e$1).metrics(e$1)}}}case "pending":return {exit:0,out:{ok:true,pending:(await e(t)).pending}};case "lessons":return {exit:0,out:{ok:true,lessons:(await e(t)).lessons}};case "validate":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e$1=await e(t),o=await x(w.resolve(t,n[0]));return {exit:0,out:{ok:true,violations:V(e$1,h(e$1),o)}}}case "role":{let e$2=await e(t);if(n[0]==="list")return {exit:0,out:{ok:true,roles:Object.keys(e$2.roles),detail:e$2.roles}};if(n[0]==="add"&&n[1]){let o=await x(w.resolve(t,n[1]));b$1(e$1,o,`role manifest ${n[1]}`);let a=f(e$2,o,f$3,d$3);return await d(t,a),{exit:0,out:{ok:true,roles:Object.keys(a.roles)}}}return {exit:2,out:{ok:false,usage:p}}}default:return {exit:2,out:{ok:false,usage:p}}}}export{p as a,nt as b,At as c};//# sourceMappingURL=chunk-EFCUM6DK.mjs.map
2
- //# sourceMappingURL=chunk-EFCUM6DK.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli/commands.ts"],"names":["METHODOLOGIES","scrum","kanban","waterfall","investigation","experimentation","USAGE","BOOLEAN_FLAGS","parseArgs","argv","positional","flags","a","key","val","fail","readJson","file","readFile","e","methodologyOf","state","f","num","v","WRITERS","runCommand","cwd","cmd","sub","withStateLock","execute","WorkflowError","rest","by","now","name","stat","statePath","config","path","roles","r","assertValid","roleSchema","res","init","saveState","s","loadState","item","newItemSchema","applyAction","addItem","getItem","id","patch","itemPatchSchema","editItem","opts","next","b","saveBrief","handoff","handoffSchema","role","durationMs","acc","complete","saveHandoff","line","s2","correctAccounting","ev","lastEvent","idx","m","c","input","changeConfig","open","blockers","note","clearBlocker","entry","p","decide","counts","i","openIteration","openQuestions","st","action","validateAction","manifest","registerRole"],"mappings":"ukBA2CA,IAAMA,CAAAA,CAAmD,CACvD,KAAA,CAAOC,CAAAA,CACP,OAAQC,CAAAA,CACR,SAAA,CAAWC,CAAAA,CACX,aAAA,CAAeC,GAAAA,CACf,eAAA,CAAiBC,GACnB,CAAA,CAEaC,CAAAA,CAAQ,CACnB,mGAAA,CACA,6EAAA,CACA,sDAAA,CACA,kHAAA,CACA,2GACA,8CAAA,CACA,iEAAA,CACA,2GAAA,CACA,mDAAA,CACA,gFACF,CAAA,CAOMC,EAAAA,CAAgB,IAAI,GAAA,CAAI,CAAC,UAAU,CAAC,EAEnC,SAASC,EAAAA,CAAUC,CAAAA,CAAwB,CAChD,IAAMC,CAAAA,CAAuB,EAAC,CACxBC,CAAAA,CAAgC,EAAC,CACvC,IAAA,IAAS,CAAA,CAAI,CAAA,CAAG,CAAA,CAAIF,CAAAA,CAAK,MAAA,CAAQ,IAAK,CACpC,IAAMG,CAAAA,CAAIH,CAAAA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AAAA,CAAK,CAAC,CAAC,CAAC,CAAA,CAChEU,GAAAA,CAAYC,GAAAA,CAAYkD,CAAAA,CAAU,CAAA,cAAA,EAAiB7D,EAAK,CAAC,CAAC,CAAA,CAAE,CAAA,CAC5D,IAAMsC,CAAAA,CAAKwB,CAAAA,CAAa1E,GAAAA,CAAOyE,CAAAA,CAAU5D,GAAAA,CAAIC,GAAG,CAAA,CAChD,OAAA,MAAMY,CAAAA,CAAUpB,CAAAA,CAAK4C,CAAE,CAAA,CAChB,CAAE,IAAA,CAAM,CAAA,CAAG,GAAA,CAAK,CAAE,EAAA,CAAI,IAAA,CAAM,KAAA,CAAO,MAAA,CAAO,IAAA,CAAKA,CAAAA,CAAG,KAAK,CAAE,CAAE,CACpE,CACA,OAAO,CAAE,IAAA,CAAM,CAAA,CAAG,GAAA,CAAK,CAAE,EAAA,CAAI,KAAA,CAAO,KAAA,CAAOjE,CAAM,CAAE,CACrD,CACA,QACE,OAAO,CAAE,IAAA,CAAM,CAAA,CAAG,GAAA,CAAK,CAAE,EAAA,CAAI,KAAA,CAAO,KAAA,CAAOA,CAAM,CAAE,CACvD,CACF","file":"chunk-EFCUM6DK.mjs","sourcesContent":["import { readFile, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport {\n loadState,\n saveBrief,\n saveHandoff,\n saveState,\n statePath,\n withStateLock,\n} from \"../adapters/file.ts\";\nimport { next as planNext, openQuestions } from \"../brief.ts\";\nimport { complete } from \"../complete.ts\";\nimport { correctAccounting, type AccountingPatch } from \"../accounting.ts\";\nimport { WorkflowError, fail } from \"../errors.ts\";\nimport { decide } from \"../gates.ts\";\nimport { addItem, clearBlocker, editItem, getItem, type ItemPatch } from \"../items.ts\";\nimport { applyAction, changeConfig, init, validateAction } from \"../methodology.ts\";\nimport { openIteration, type PlanOptions } from \"../planner.ts\";\nimport { registerRole } from \"../roles.ts\";\nimport {\n assertValid,\n handoffSchema,\n itemPatchSchema,\n newItemSchema,\n roleSchema,\n} from \"../schema/index.ts\";\nimport { lastEvent } from \"../state.ts\";\nimport { scrum } from \"../scrum/index.ts\";\nimport { kanban } from \"../kanban/index.ts\";\nimport { waterfall } from \"../waterfall/index.ts\";\nimport { investigation } from \"../investigation/index.ts\";\nimport { experimentation } from \"../experimentation/index.ts\";\nimport type {\n Accounting,\n Action,\n Handoff,\n ItemStatus,\n Methodology,\n NewItem,\n Role,\n WorkflowState,\n} from \"../types.ts\";\n\nconst METHODOLOGIES: Record<string, () => Methodology> = {\n scrum: scrum as () => Methodology,\n kanban: kanban as () => Methodology,\n waterfall: waterfall as () => Methodology,\n investigation: investigation as () => Methodology,\n experimentation: experimentation as () => Methodology,\n};\n\nexport const USAGE = [\n \"exwf init <scrum|kanban|waterfall|investigation|experimentation> --config <file> [--roles <file>]\",\n \"exwf add <item.json> [--by who] exwf edit <id> <patch.json> [--by who]\",\n \"exwf next [--max n] [--fallback-tokens-per-weight n]\",\n \"exwf complete <id> <handoff.json> --tokens-in n --tokens-out n --duration-ms n --model m [--estimate] [--role r]\",\n \"exwf account <item> [--line n] [--tokens-in n] [--tokens-out n] [--duration-ms n] [--model m] [--by who]\",\n \"exwf ceremony <name> [input.json] [--by who]\",\n \"exwf decide <pendingId> approve|reject [--by who] [--note text]\",\n \"exwf config set <patch.json> [--by who] exwf unblock <item> [--blocker id] [--note text] [--by who]\",\n \"exwf status | board | metrics | pending | lessons\",\n \"exwf validate <action.json> exwf role add <manifest.json> | role list\",\n];\n\nexport interface Parsed {\n positional: string[];\n flags: Record<string, string>;\n}\n/** Flags that take no value; every other flag needs one. */\nconst BOOLEAN_FLAGS = new Set([\"estimate\"]);\n\nexport function parseArgs(argv: string[]): Parsed {\n const positional: string[] = [];\n const flags: Record<string, string> = {};\n for (let i = 0; i < argv.length; i++) {\n const a = argv[i]!;\n if (a.startsWith(\"--\")) {\n const key = a.slice(2);\n if (BOOLEAN_FLAGS.has(key)) {\n flags[key] = \"true\";\n continue;\n }\n const val = argv[i + 1];\n if (val === undefined || val.startsWith(\"--\"))\n fail(\"invalid-input\", `--${key} needs a value`, `pass --${key} <text>`);\n flags[key] = val;\n i++;\n } else positional.push(a);\n }\n return { positional, flags };\n}\n\nasync function readJson<T>(file: string): Promise<T> {\n try {\n return JSON.parse(await readFile(file, \"utf8\")) as T;\n } catch (e) {\n return fail(\n \"invalid-input\",\n `cannot read JSON from ${file}: ${(e as Error).message}`,\n \"check the path and that the file is valid JSON\",\n );\n }\n}\n\nfunction methodologyOf(state: WorkflowState): Methodology {\n const f = Object.hasOwn(METHODOLOGIES, state.methodology)\n ? METHODOLOGIES[state.methodology]\n : undefined;\n if (!f)\n fail(\n \"config-invalid\",\n `methodology \"${state.methodology}\" is not available in this build`,\n `available: ${Object.keys(METHODOLOGIES).join(\", \")}`,\n );\n return f();\n}\n\nfunction num(flags: Record<string, string>, key: string): number {\n const v = Number(flags[key]);\n if (!Number.isFinite(v))\n fail(\n \"invalid-input\",\n `--${key} must be a number (got ${JSON.stringify(flags[key])})`,\n `pass --${key} <n>`,\n );\n return v;\n}\n\nexport interface CommandResult {\n exit: 0 | 1 | 2;\n out: unknown;\n}\n\n/** Commands that load, change and save the state: they run under .workflow/state.lock. */\nconst WRITERS = new Set([\n \"init\",\n \"add\",\n \"edit\",\n \"next\",\n \"complete\",\n \"account\",\n \"ceremony\",\n \"decide\",\n \"unblock\",\n]);\n\nexport async function runCommand(argv: string[], cwd: string): Promise<CommandResult> {\n try {\n const [cmd, sub] = parseArgs(argv).positional;\n const writes =\n cmd !== undefined &&\n (WRITERS.has(cmd) ||\n (cmd === \"role\" && sub === \"add\") ||\n (cmd === \"config\" && sub === \"set\"));\n return writes ? await withStateLock(cwd, () => execute(argv, cwd)) : await execute(argv, cwd);\n } catch (e) {\n if (e instanceof WorkflowError) return { exit: 1, out: { ok: false, error: e.toJSON() } };\n throw e;\n }\n}\n\nasync function execute(argv: string[], cwd: string): Promise<CommandResult> {\n const { positional, flags } = parseArgs(argv);\n const [cmd, ...rest] = positional;\n const by = flags[\"by\"] ?? \"human\";\n const now = new Date().toISOString();\n switch (cmd) {\n case \"init\": {\n const [name] = rest;\n const f = name && Object.hasOwn(METHODOLOGIES, name) ? METHODOLOGIES[name] : undefined;\n if (!f || !flags[\"config\"]) return { exit: 2, out: { ok: false, usage: USAGE } };\n try {\n await stat(statePath(cwd));\n fail(\n \"invalid-input\",\n `${statePath(cwd)} already exists`,\n \"delete .workflow/state.json to start over\",\n );\n } catch (e) {\n if (e instanceof WorkflowError) throw e;\n if ((e as NodeJS.ErrnoException).code !== \"ENOENT\") throw e;\n }\n const config = await readJson<unknown>(path.resolve(cwd, flags[\"config\"]));\n const roles = flags[\"roles\"]\n ? await readJson<Role[]>(path.resolve(cwd, flags[\"roles\"]))\n : undefined;\n if (roles !== undefined) {\n if (!Array.isArray(roles))\n fail(\n \"invalid-input\",\n `roles file ${flags[\"roles\"]} must contain an array of role manifests`,\n \"wrap the manifests in [ ... ]\",\n );\n for (const r of roles) assertValid(roleSchema, r, `roles file ${flags[\"roles\"]}`);\n }\n const res = init(\n roles\n ? { methodology: f(), config, roles, by, now }\n : { methodology: f(), config, by, now },\n );\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n warnings: res.warnings,\n state: {\n methodology: res.state.methodology,\n stages: res.state.stages.map((s) => s.id),\n roles: Object.keys(res.state.roles),\n },\n },\n };\n }\n case \"add\": {\n if (!rest[0]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const item = await readJson<NewItem>(path.resolve(cwd, rest[0]));\n assertValid(newItemSchema, item, `item file ${rest[0]}`);\n const res = applyAction(\n state,\n methodologyOf(state),\n { type: \"item.add\", by, payload: { item } },\n (s) => addItem(s, item, by, now),\n );\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n warnings: res.warnings,\n item: getItem(res.state, item.id),\n },\n };\n }\n case \"edit\": {\n if (!rest[0] || !rest[1]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const id = rest[0];\n const patch = await readJson<ItemPatch>(path.resolve(cwd, rest[1]));\n assertValid(itemPatchSchema, patch, `patch file ${rest[1]}`);\n const res = applyAction(\n state,\n methodologyOf(state),\n { type: \"item.edit\", by, payload: { id, patch } },\n (s) => editItem(s, id, patch, by, now),\n );\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: { ok: true, warnings: res.warnings, item: getItem(res.state, id) },\n };\n }\n case \"next\": {\n const state = await loadState(cwd);\n const opts: PlanOptions = { now };\n if (flags[\"max\"]) opts.max = num(flags, \"max\");\n if (flags[\"fallback-tokens-per-weight\"])\n opts.fallbackTokensPerWeight = num(flags, \"fallback-tokens-per-weight\");\n const res = planNext(state, methodologyOf(state), opts);\n // briefs first: a crash then leaves an orphan brief (overwritten next dispatch), never a dispatched item without one\n for (const b of res.briefs) await saveBrief(cwd, b);\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n reason: res.reason ?? null,\n skipped: res.skipped,\n briefs: res.briefs,\n },\n };\n }\n case \"complete\": {\n if (!rest[0] || !rest[1]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const handoff = await readJson<Handoff>(path.resolve(cwd, rest[1]));\n assertValid(handoffSchema, handoff, `handoff file ${rest[1]}`);\n if (handoff.item !== rest[0])\n fail(\n \"handoff-invalid\",\n `handoff.item \"${handoff.item}\" differs from the command's item \"${rest[0]}\"`,\n \"make them match\",\n );\n const role = flags[\"role\"] ?? handoff.role;\n const durationMs = num(flags, \"duration-ms\");\n const acc: Accounting = {\n item: rest[0],\n role,\n model: flags[\"model\"] ?? \"\",\n tokensIn: num(flags, \"tokens-in\"),\n tokensOut: num(flags, \"tokens-out\"),\n durationMs,\n startedAt: new Date(Date.parse(now) - durationMs).toISOString(),\n endedAt: now,\n };\n if (flags[\"estimate\"] === \"true\") acc.estimate = true;\n const res = complete(state, methodologyOf(state), { ...handoff, role }, acc, now);\n // handoff first: a retry of the same command reproduces the same seq and overwrites an orphan\n await saveHandoff(cwd, handoff, res.state.events.length);\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n warnings: res.warnings,\n item: getItem(res.state, rest[0]),\n },\n };\n }\n case \"account\": {\n if (!rest[0]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const patch: AccountingPatch = {};\n if (flags[\"tokens-in\"] !== undefined) patch.tokensIn = num(flags, \"tokens-in\");\n if (flags[\"tokens-out\"] !== undefined) patch.tokensOut = num(flags, \"tokens-out\");\n if (flags[\"duration-ms\"] !== undefined) patch.durationMs = num(flags, \"duration-ms\");\n if (flags[\"model\"] !== undefined) patch.model = flags[\"model\"];\n const line = flags[\"line\"] !== undefined ? num(flags, \"line\") : undefined;\n const s2 = correctAccounting(state, rest[0], patch, flags[\"by\"] ?? \"human\", now, line);\n await saveState(cwd, s2);\n const ev = lastEvent(s2)!;\n const idx = (ev.payload as { line: number }).line;\n const mine = s2.accounting.filter((a) => a.item === rest[0]);\n return { exit: 0, out: { ok: true, line: mine[idx - 1], event: ev } };\n }\n case \"ceremony\": {\n if (!rest[0]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const m = methodologyOf(state);\n const c = Object.hasOwn(m.ceremonies, rest[0]) ? m.ceremonies[rest[0]] : undefined;\n if (!c)\n fail(\n \"unknown-ceremony\",\n `\"${rest[0]}\" is not a ${m.name} ceremony`,\n `available: ${Object.keys(m.ceremonies).join(\", \")}`,\n );\n const input = rest[1]\n ? await readJson<Record<string, unknown>>(path.resolve(cwd, rest[1]))\n : {};\n const res = c(state, { ...input, by, now });\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n warnings: res.warnings,\n lastEvent: lastEvent(res.state),\n },\n };\n }\n case \"config\": {\n if (rest[0] !== \"set\" || !rest[1]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const patch = await readJson<Record<string, unknown>>(path.resolve(cwd, rest[1]));\n const res = changeConfig(state, methodologyOf(state), patch, by, now);\n await saveState(cwd, res.state);\n return {\n exit: 0,\n out: {\n ok: true,\n warnings: res.warnings,\n changed: (lastEvent(res.state)!.payload as { changed: string[] }).changed,\n config: res.state.config,\n },\n };\n }\n case \"unblock\": {\n if (!rest[0]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const id = rest[0];\n const state = await loadState(cwd);\n const open = getItem(state, id)\n .blockers.filter((b) => !b.clearedAt)\n .map((b) => b.id);\n if (open.length === 0)\n fail(\n \"invalid-input\",\n `item ${id} has no open blocker`,\n \"nothing to clear; check exwf board\",\n );\n const blockers = flags[\"blocker\"] !== undefined ? [flags[\"blocker\"]] : open;\n const note = flags[\"note\"];\n const res = applyAction(\n state,\n methodologyOf(state),\n { type: \"blocker.clear\", by, payload: { id, blockers, note: note ?? null } },\n (s) => blockers.reduce((acc, b) => clearBlocker(acc, id, b, by, now, note), s),\n );\n await saveState(cwd, res.state);\n return { exit: 0, out: { ok: true, warnings: res.warnings, item: getItem(res.state, id) } };\n }\n case \"decide\": {\n if (!rest[0] || (rest[1] !== \"approve\" && rest[1] !== \"reject\"))\n return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const entry = state.pending.find((p) => p.id === rest[0]);\n const s2 = decide(\n state,\n rest[0],\n rest[1],\n by,\n flags[\"note\"] ?? \"\",\n now,\n methodologyOf(state),\n );\n await saveState(cwd, s2);\n return {\n exit: 0,\n out: { ok: true, item: entry?.item ? getItem(s2, entry.item) : null },\n };\n }\n case \"status\": {\n const state = await loadState(cwd);\n const m = methodologyOf(state);\n const counts: Record<ItemStatus, number> = {\n todo: 0,\n in_progress: 0,\n blocked: 0,\n review: 0,\n awaiting_human: 0,\n done: 0,\n dropped: 0,\n };\n for (const i of Object.values(state.items)) counts[i.status] += 1;\n return {\n exit: 0,\n out: {\n ok: true,\n methodology: state.methodology,\n openIteration: openIteration(state) ?? null,\n counts,\n pending: state.pending,\n openQuestions: openQuestions(state),\n lastEvent: lastEvent(state),\n report: m.report ? m.report(state) : null,\n },\n };\n }\n case \"board\": {\n const state = await loadState(cwd);\n const columns = state.stages.map((st) => ({\n stage: st.id,\n wipLimit: st.wipLimit ?? null,\n items: Object.values(state.items)\n .filter((i) => i.stage === st.id && i.status !== \"dropped\")\n .map((i) => ({\n id: i.id,\n title: i.title,\n status: i.status,\n role: i.role ?? null,\n age: i.transitions.length\n ? Date.parse(now) - Date.parse(i.transitions[i.transitions.length - 1]!.at)\n : null,\n })),\n }));\n return { exit: 0, out: { ok: true, columns } };\n }\n case \"metrics\": {\n const state = await loadState(cwd);\n return {\n exit: 0,\n out: { ok: true, metrics: methodologyOf(state).metrics(state) },\n };\n }\n case \"pending\":\n return {\n exit: 0,\n out: { ok: true, pending: (await loadState(cwd)).pending },\n };\n case \"lessons\":\n return {\n exit: 0,\n out: { ok: true, lessons: (await loadState(cwd)).lessons },\n };\n case \"validate\": {\n if (!rest[0]) return { exit: 2, out: { ok: false, usage: USAGE } };\n const state = await loadState(cwd);\n const action = await readJson<Action>(path.resolve(cwd, rest[0]));\n return {\n exit: 0,\n out: {\n ok: true,\n violations: validateAction(state, methodologyOf(state), action),\n },\n };\n }\n case \"role\": {\n const state = await loadState(cwd);\n if (rest[0] === \"list\")\n return {\n exit: 0,\n out: {\n ok: true,\n roles: Object.keys(state.roles),\n detail: state.roles,\n },\n };\n if (rest[0] === \"add\" && rest[1]) {\n const manifest = await readJson<Role>(path.resolve(cwd, rest[1]));\n assertValid(roleSchema, manifest, `role manifest ${rest[1]}`);\n const s2 = registerRole(state, manifest, by, now);\n await saveState(cwd, s2);\n return { exit: 0, out: { ok: true, roles: Object.keys(s2.roles) } };\n }\n return { exit: 2, out: { ok: false, usage: USAGE } };\n }\n default:\n return { exit: 2, out: { ok: false, usage: USAGE } };\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkHCRVWMG4_cjs=require('./chunk-HCRVWMG4.cjs'),chunkEACZBAP3_cjs=require('./chunk-EACZBAP3.cjs'),chunkS3BXVHO7_cjs=require('./chunk-S3BXVHO7.cjs');var L=["policy","skill","memory","spec","review"],v={retro:"review in a fresh worker",phaseRetrospective:"qa reads the srs"},w=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function $(n,i,d){let g=i.lessons??[];(!Array.isArray(g)||!g.every(s=>w(s)&&typeof s.text=="string"&&s.text.trim()!==""&&L.includes(s.scope)))&&chunkS3BXVHO7_cjs.b("invalid-input",`${d}.lessons entries need a text and a scope`,`scope is one of: ${L.join(", ")}`);let m=g,t=["human",...Object.keys(n.roles)];for(let s of m)s.from!==void 0&&(typeof s.from!="string"||!t.includes(s.from))&&chunkS3BXVHO7_cjs.b("invalid-input",`lesson from ${JSON.stringify(s.from)} is not a role`,`from is "human" or one of the roles: ${Object.keys(n.roles).join(", ")||"(none)"}`),s.item!==void 0&&(typeof s.item!="string"&&chunkS3BXVHO7_cjs.b("invalid-input","lesson item must be an item id","name an item with addItem first"),chunkEACZBAP3_cjs.u(n,s.item));let f=i.adopt??[],a=i.dismiss??[];(!Array.isArray(f)||!f.every(s=>w(s)&&typeof s.id=="string")||!Array.isArray(a)||!a.every(s=>typeof s=="string"))&&chunkS3BXVHO7_cjs.b("invalid-input",`${d}.adopt must be [{ id, suggestedChange? }] and dismiss a string[]`,'e.g. { "adopt": [{ "id": "L1" }], "dismiss": ["L2"] }');let p=[...f.map(s=>s.id),...a],l=p.find((s,o)=>p.indexOf(s)!==o);l!==void 0&&chunkS3BXVHO7_cjs.b("invalid-input",`lesson "${l}" is referenced more than once`,"adopt or dismiss each lesson once");for(let s of p){let o=n.lessons.find(c=>c.id===s);o||chunkS3BXVHO7_cjs.b("invalid-input",`no lesson "${s}"`,`raised lessons: ${n.lessons.filter(c=>c.status==="raised").map(c=>c.id).join(", ")||"(none)"}`),o.status!=="raised"&&chunkS3BXVHO7_cjs.b("invalid-input",`lesson "${s}" is already ${o.status}`,"only raised lessons can be adopted or dismissed");}let e=i.retire??[];return (!Array.isArray(e)||!e.every(s=>typeof s=="string")||e.some((s,o)=>e.indexOf(s)!==o))&&chunkS3BXVHO7_cjs.b("invalid-input",`${d}.retire must be a list of distinct agreement texts`,`e.g. { "retire": ["${v[d]??"review in a fresh worker"}"] }; each agreement once`),{lessons:m,adopt:f,dismiss:a,retire:e}}function x(n,i,d,g,m){let t=n,f=[],a=[],p=[],l=e=>{e&&(e.kind==="agreement"?(t=chunkHCRVWMG4_cjs.a(t,e,d,g),p.push(e.text)):m&&(t=m(t,e)??t));};for(let e of i.lessons){let s=`L${t.lessons.length+1}`,o={id:s,at:g,text:e.text,scope:e.scope,status:"adopted",from:e.from??d};e.item!==void 0&&(o.item=e.item),e.suggestedChange&&(o.suggestedChange=e.suggestedChange),t={...t,lessons:[...t.lessons,o]},f.push(s),a.push(s),l(e.suggestedChange);}for(let e of i.adopt)t={...t,lessons:t.lessons.map(s=>s.id===e.id?{...s,status:"adopted",...e.suggestedChange?{suggestedChange:e.suggestedChange}:{}}:s)},a.push(e.id),l(e.suggestedChange??t.lessons.find(s=>s.id===e.id)?.suggestedChange);for(let e of i.dismiss)t={...t,lessons:t.lessons.map(s=>s.id===e?{...s,status:"dismissed"}:s)};for(let e of i.retire)t=chunkHCRVWMG4_cjs.b(t,e,d,g);return {state:t,created:f,adopted:a,dismissed:i.dismiss,agreements:p,retired:i.retire}}exports.a=$;exports.b=x;//# sourceMappingURL=chunk-EHBQBXWA.cjs.map
2
- //# sourceMappingURL=chunk-EHBQBXWA.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lessons.ts"],"names":["LESSON_SCOPES","RETIRE_EXAMPLE","isObj","x","parseLessonInput","state","input","ceremony","lessons","l","fail","newLessons","roleIds","getItem","adopt","dismiss","a","d","refs","dupe","r","i","ref","retire","applyLessonInput","parsed","by","now","applyChange","s","created","adopted","agreements","change","c","applyAgreement","id","lesson","text","retireAgreement"],"mappings":"uKAKA,IAAMA,CAAAA,CAAmC,CAAC,QAAA,CAAU,OAAA,CA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A,CACA,OAAA,CAASP,CAAAA,CAAO,MAClB,CACF","file":"chunk-EHBQBXWA.cjs","sourcesContent":["import { applyAgreement, retireAgreement } from \"./agreements.ts\";\nimport { fail } from \"./errors.ts\";\nimport { getItem } from \"./items.ts\";\nimport type { Lesson, LessonChange, WorkflowState } from \"./types.ts\";\n\nconst LESSON_SCOPES: readonly string[] = [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"];\nconst RETIRE_EXAMPLE: Readonly<Record<string, string>> = {\n retro: \"review in a fresh worker\",\n phaseRetrospective: \"qa reads the srs\",\n};\nconst isObj = (x: unknown): x is Record<string, unknown> =>\n typeof x === \"object\" && x !== null && !Array.isArray(x);\n\nexport interface NewLesson {\n text: string;\n scope: Lesson[\"scope\"];\n from?: string;\n item?: string;\n suggestedChange?: LessonChange;\n}\nexport interface Adopt {\n id: string;\n suggestedChange?: LessonChange;\n}\nexport interface LessonInput {\n lessons: NewLesson[];\n adopt: Adopt[];\n dismiss: string[];\n retire: string[];\n}\nexport interface LessonOutcome {\n state: WorkflowState;\n /** ids of the lessons created by this input */\n created: string[];\n /** created ids first, then the adopted refs */\n adopted: string[];\n dismissed: string[];\n /** texts of the agreements added */\n agreements: string[];\n retired: string[];\n}\n\n/** Validates the lesson keys of a retrospective-style ceremony input; every failure names the ceremony. */\nexport function parseLessonInput(\n state: WorkflowState,\n input: Record<string, unknown>,\n ceremony: string,\n): LessonInput {\n const lessons = input[\"lessons\"] ?? [];\n if (\n !Array.isArray(lessons) ||\n !lessons.every(\n (l) =>\n isObj(l) &&\n typeof l[\"text\"] === \"string\" &&\n l[\"text\"].trim() !== \"\" &&\n LESSON_SCOPES.includes(l[\"scope\"] as string),\n )\n )\n fail(\n \"invalid-input\",\n `${ceremony}.lessons entries need a text and a scope`,\n `scope is one of: ${LESSON_SCOPES.join(\", \")}`,\n );\n const newLessons = lessons as NewLesson[];\n const roleIds = [\"human\", ...Object.keys(state.roles)];\n for (const l of newLessons) {\n if (l.from !== undefined && (typeof l.from !== \"string\" || !roleIds.includes(l.from)))\n fail(\n \"invalid-input\",\n `lesson from ${JSON.stringify(l.from)} is not a role`,\n `from is \"human\" or one of the roles: ${Object.keys(state.roles).join(\", \") || \"(none)\"}`,\n );\n if (l.item !== undefined) {\n if (typeof l.item !== \"string\")\n fail(\"invalid-input\", \"lesson item must be an item id\", \"name an item with addItem first\");\n getItem(state, l.item);\n }\n }\n const adopt = input[\"adopt\"] ?? [];\n const dismiss = input[\"dismiss\"] ?? [];\n if (\n !Array.isArray(adopt) ||\n !adopt.every((a) => isObj(a) && typeof a[\"id\"] === \"string\") ||\n !Array.isArray(dismiss) ||\n !dismiss.every((d) => typeof d === \"string\")\n )\n fail(\n \"invalid-input\",\n `${ceremony}.adopt must be [{ id, suggestedChange? }] and dismiss a string[]`,\n 'e.g. { \"adopt\": [{ \"id\": \"L1\" }], \"dismiss\": [\"L2\"] }',\n );\n const refs = [...(adopt as Adopt[]).map((a) => a.id), ...(dismiss as string[])];\n const dupe = refs.find((r, i) => refs.indexOf(r) !== i);\n if (dupe !== undefined)\n fail(\n \"invalid-input\",\n `lesson \"${dupe}\" is referenced more than once`,\n \"adopt or dismiss each lesson once\",\n );\n for (const ref of refs) {\n const l = state.lessons.find((x) => x.id === ref);\n if (!l)\n fail(\n \"invalid-input\",\n `no lesson \"${ref}\"`,\n `raised lessons: ${\n state.lessons\n .filter((x) => x.status === \"raised\")\n .map((x) => x.id)\n .join(\", \") || \"(none)\"\n }`,\n );\n if (l.status !== \"raised\")\n fail(\n \"invalid-input\",\n `lesson \"${ref}\" is already ${l.status}`,\n \"only raised lessons can be adopted or dismissed\",\n );\n }\n const retire: unknown = input[\"retire\"] ?? [];\n if (\n !Array.isArray(retire) ||\n !retire.every((x) => typeof x === \"string\") ||\n retire.some((x, i) => retire.indexOf(x) !== i)\n )\n fail(\n \"invalid-input\",\n `${ceremony}.retire must be a list of distinct agreement texts`,\n `e.g. { \"retire\": [\"${RETIRE_EXAMPLE[ceremony] ?? \"review in a fresh worker\"}\"] }; each agreement once`,\n );\n return {\n lessons: newLessons,\n adopt: adopt as Adopt[],\n dismiss: dismiss as string[],\n retire: retire as string[],\n };\n}\n\n/**\n * Creates the new lessons as adopted, adopts and dismisses the referenced ones, retires agreements\n * and applies `agreement` changes; every other change kind goes to `applyChange` when given.\n */\nexport function applyLessonInput(\n state: WorkflowState,\n parsed: LessonInput,\n by: string,\n now: string,\n applyChange?: (s: WorkflowState, change: LessonChange) => WorkflowState | void,\n): LessonOutcome {\n let s = state;\n const created: string[] = [];\n const adopted: string[] = [];\n const agreements: string[] = [];\n const change = (c: LessonChange | undefined) => {\n if (!c) return;\n if (c.kind === \"agreement\") {\n s = applyAgreement(s, c, by, now);\n agreements.push(c.text);\n } else if (applyChange) {\n s = applyChange(s, c) ?? s;\n }\n };\n for (const l of parsed.lessons) {\n const id = `L${s.lessons.length + 1}`;\n const lesson: Lesson = {\n id,\n at: now,\n text: l.text,\n scope: l.scope,\n status: \"adopted\",\n from: l.from ?? by,\n };\n if (l.item !== undefined) lesson.item = l.item;\n if (l.suggestedChange) lesson.suggestedChange = l.suggestedChange;\n s = { ...s, lessons: [...s.lessons, lesson] };\n created.push(id);\n adopted.push(id);\n change(l.suggestedChange);\n }\n for (const a of parsed.adopt) {\n s = {\n ...s,\n lessons: s.lessons.map((x) =>\n x.id === a.id\n ? {\n ...x,\n status: \"adopted\" as const,\n ...(a.suggestedChange ? { suggestedChange: a.suggestedChange } : {}),\n }\n : x,\n ),\n };\n adopted.push(a.id);\n change(a.suggestedChange ?? s.lessons.find((x) => x.id === a.id)?.suggestedChange);\n }\n for (const d of parsed.dismiss)\n s = {\n ...s,\n lessons: s.lessons.map((x) => (x.id === d ? { ...x, status: \"dismissed\" as const } : x)),\n };\n for (const text of parsed.retire) s = retireAgreement(s, text, by, now);\n return {\n state: s,\n created,\n adopted,\n dismissed: parsed.dismiss,\n agreements,\n retired: parsed.retire,\n };\n}\n"]}
@@ -1,2 +0,0 @@
1
- import {b as b$1,a}from'./chunk-NDCQTRIV.mjs';import {u}from'./chunk-6P3OKXSK.mjs';import {b}from'./chunk-2FRRD6A3.mjs';var L=["policy","skill","memory","spec","review"],v={retro:"review in a fresh worker",phaseRetrospective:"qa reads the srs"},w=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function $(n,i,d){let g=i.lessons??[];(!Array.isArray(g)||!g.every(s=>w(s)&&typeof s.text=="string"&&s.text.trim()!==""&&L.includes(s.scope)))&&b("invalid-input",`${d}.lessons entries need a text and a scope`,`scope is one of: ${L.join(", ")}`);let m=g,t=["human",...Object.keys(n.roles)];for(let s of m)s.from!==void 0&&(typeof s.from!="string"||!t.includes(s.from))&&b("invalid-input",`lesson from ${JSON.stringify(s.from)} is not a role`,`from is "human" or one of the roles: ${Object.keys(n.roles).join(", ")||"(none)"}`),s.item!==void 0&&(typeof s.item!="string"&&b("invalid-input","lesson item must be an item id","name an item with addItem first"),u(n,s.item));let f=i.adopt??[],a=i.dismiss??[];(!Array.isArray(f)||!f.every(s=>w(s)&&typeof s.id=="string")||!Array.isArray(a)||!a.every(s=>typeof s=="string"))&&b("invalid-input",`${d}.adopt must be [{ id, suggestedChange? }] and dismiss a string[]`,'e.g. { "adopt": [{ "id": "L1" }], "dismiss": ["L2"] }');let p=[...f.map(s=>s.id),...a],l=p.find((s,o)=>p.indexOf(s)!==o);l!==void 0&&b("invalid-input",`lesson "${l}" is referenced more than once`,"adopt or dismiss each lesson once");for(let s of p){let o=n.lessons.find(c=>c.id===s);o||b("invalid-input",`no lesson "${s}"`,`raised lessons: ${n.lessons.filter(c=>c.status==="raised").map(c=>c.id).join(", ")||"(none)"}`),o.status!=="raised"&&b("invalid-input",`lesson "${s}" is already ${o.status}`,"only raised lessons can be adopted or dismissed");}let e=i.retire??[];return (!Array.isArray(e)||!e.every(s=>typeof s=="string")||e.some((s,o)=>e.indexOf(s)!==o))&&b("invalid-input",`${d}.retire must be a list of distinct agreement texts`,`e.g. { "retire": ["${v[d]??"review in a fresh worker"}"] }; each agreement once`),{lessons:m,adopt:f,dismiss:a,retire:e}}function x(n,i,d,g,m){let t=n,f=[],a$1=[],p=[],l=e=>{e&&(e.kind==="agreement"?(t=a(t,e,d,g),p.push(e.text)):m&&(t=m(t,e)??t));};for(let e of i.lessons){let s=`L${t.lessons.length+1}`,o={id:s,at:g,text:e.text,scope:e.scope,status:"adopted",from:e.from??d};e.item!==void 0&&(o.item=e.item),e.suggestedChange&&(o.suggestedChange=e.suggestedChange),t={...t,lessons:[...t.lessons,o]},f.push(s),a$1.push(s),l(e.suggestedChange);}for(let e of i.adopt)t={...t,lessons:t.lessons.map(s=>s.id===e.id?{...s,status:"adopted",...e.suggestedChange?{suggestedChange:e.suggestedChange}:{}}:s)},a$1.push(e.id),l(e.suggestedChange??t.lessons.find(s=>s.id===e.id)?.suggestedChange);for(let e of i.dismiss)t={...t,lessons:t.lessons.map(s=>s.id===e?{...s,status:"dismissed"}:s)};for(let e of i.retire)t=b$1(t,e,d,g);return {state:t,created:f,adopted:a$1,dismissed:i.dismiss,agreements:p,retired:i.retire}}export{$ as a,x as b};//# sourceMappingURL=chunk-FTS75UIU.mjs.map
2
- //# sourceMappingURL=chunk-FTS75UIU.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lessons.ts"],"names":["LESSON_SCOPES","RETIRE_EXAMPLE","isObj","x","parseLessonInput","state","input","ceremony","lessons","l","fail","newLessons","roleIds","getItem","adopt","dismiss","a","d","refs","dupe","r","i","ref","retire","applyLessonInput","parsed","by","now","applyChange","s","created","adopted","agreements","change","c","applyAgreement","id","lesson","text","retireAgreement"],"mappings":"wHAKA,IAAMA,CAAAA,CAAmC,CAAC,QAAA,CAAU,OAAA,CAAS,QAAA,CAAU,MAAA,CAAQ,QAAQ,CAAA,CACjFC,CAAAA,CAAmD,CACvD,KAAA,CAAO,0BAAA,CACP,mBAAoB,kBACtB,CAAA,CACMC,CAAAA,CAASC,CAAAA,EACb,OAAOA,CAAAA,EAAM,QAAA,EAAYA,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E,OAAA,CAAQ,GAAA,CAAK1B,CAAAA,EACtBA,CAAAA,CAAE,EAAA,GAAOa,CAAAA,CAAE,EAAA,CACP,CACE,GAAGb,CAAAA,CACH,MAAA,CAAQ,SAAA,CACR,GAAIa,CAAAA,CAAE,eAAA,CAAkB,CAAE,gBAAiBA,CAAAA,CAAE,eAAgB,CAAA,CAAI,EACnE,CAAA,CACAb,CACN,CACF,EACA4B,GAAAA,CAAQ,IAAA,CAAKf,CAAAA,CAAE,EAAE,CAAA,CACjBiB,CAAAA,CAAOjB,CAAAA,CAAE,eAAA,EAAmBa,CAAAA,CAAE,OAAA,CAAQ,IAAA,CAAM1B,CAAAA,EAAMA,CAAAA,CAAE,EAAA,GAAOa,CAAAA,CAAE,EAAE,GAAG,eAAe,CAAA,CAEnF,IAAA,IAAWC,CAAAA,IAAKQ,CAAAA,CAAO,OAAA,CACrBI,CAAAA,CAAI,CACF,GAAGA,CAAAA,CACH,OAAA,CAASA,CAAAA,CAAE,OAAA,CAAQ,GAAA,CAAK1B,CAAAA,EAAOA,CAAAA,CAAE,EAAA,GAAOc,EAAI,CAAE,GAAGd,CAAAA,CAAG,MAAA,CAAQ,WAAqB,CAAA,CAAIA,CAAE,CACzF,EACF,IAAA,IAAWmC,CAAAA,IAAQb,CAAAA,CAAO,MAAA,CAAQI,CAAAA,CAAIU,GAAAA,CAAgBV,CAAAA,CAAGS,CAAAA,CAAMZ,EAAIC,CAAG,CAAA,CACtE,OAAO,CACL,KAAA,CAAOE,CAAAA,CACP,OAAA,CAAAC,CAAAA,CACA,QAAAC,GAAAA,CACA,SAAA,CAAWN,CAAAA,CAAO,OAAA,CAClB,UAAA,CAAAO,CAAAA,CACA,OAAA,CAASP,CAAAA,CAAO,MAClB,CACF","file":"chunk-FTS75UIU.mjs","sourcesContent":["import { applyAgreement, retireAgreement } from \"./agreements.ts\";\nimport { fail } from \"./errors.ts\";\nimport { getItem } from \"./items.ts\";\nimport type { Lesson, LessonChange, WorkflowState } from \"./types.ts\";\n\nconst LESSON_SCOPES: readonly string[] = [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"];\nconst RETIRE_EXAMPLE: Readonly<Record<string, string>> = {\n retro: \"review in a fresh worker\",\n phaseRetrospective: \"qa reads the srs\",\n};\nconst isObj = (x: unknown): x is Record<string, unknown> =>\n typeof x === \"object\" && x !== null && !Array.isArray(x);\n\nexport interface NewLesson {\n text: string;\n scope: Lesson[\"scope\"];\n from?: string;\n item?: string;\n suggestedChange?: LessonChange;\n}\nexport interface Adopt {\n id: string;\n suggestedChange?: LessonChange;\n}\nexport interface LessonInput {\n lessons: NewLesson[];\n adopt: Adopt[];\n dismiss: string[];\n retire: string[];\n}\nexport interface LessonOutcome {\n state: WorkflowState;\n /** ids of the lessons created by this input */\n created: string[];\n /** created ids first, then the adopted refs */\n adopted: string[];\n dismissed: string[];\n /** texts of the agreements added */\n agreements: string[];\n retired: string[];\n}\n\n/** Validates the lesson keys of a retrospective-style ceremony input; every failure names the ceremony. */\nexport function parseLessonInput(\n state: WorkflowState,\n input: Record<string, unknown>,\n ceremony: string,\n): LessonInput {\n const lessons = input[\"lessons\"] ?? [];\n if (\n !Array.isArray(lessons) ||\n !lessons.every(\n (l) =>\n isObj(l) &&\n typeof l[\"text\"] === \"string\" &&\n l[\"text\"].trim() !== \"\" &&\n LESSON_SCOPES.includes(l[\"scope\"] as string),\n )\n )\n fail(\n \"invalid-input\",\n `${ceremony}.lessons entries need a text and a scope`,\n `scope is one of: ${LESSON_SCOPES.join(\", \")}`,\n );\n const newLessons = lessons as NewLesson[];\n const roleIds = [\"human\", ...Object.keys(state.roles)];\n for (const l of newLessons) {\n if (l.from !== undefined && (typeof l.from !== \"string\" || !roleIds.includes(l.from)))\n fail(\n \"invalid-input\",\n `lesson from ${JSON.stringify(l.from)} is not a role`,\n `from is \"human\" or one of the roles: ${Object.keys(state.roles).join(\", \") || \"(none)\"}`,\n );\n if (l.item !== undefined) {\n if (typeof l.item !== \"string\")\n fail(\"invalid-input\", \"lesson item must be an item id\", \"name an item with addItem first\");\n getItem(state, l.item);\n }\n }\n const adopt = input[\"adopt\"] ?? [];\n const dismiss = input[\"dismiss\"] ?? [];\n if (\n !Array.isArray(adopt) ||\n !adopt.every((a) => isObj(a) && typeof a[\"id\"] === \"string\") ||\n !Array.isArray(dismiss) ||\n !dismiss.every((d) => typeof d === \"string\")\n )\n fail(\n \"invalid-input\",\n `${ceremony}.adopt must be [{ id, suggestedChange? }] and dismiss a string[]`,\n 'e.g. { \"adopt\": [{ \"id\": \"L1\" }], \"dismiss\": [\"L2\"] }',\n );\n const refs = [...(adopt as Adopt[]).map((a) => a.id), ...(dismiss as string[])];\n const dupe = refs.find((r, i) => refs.indexOf(r) !== i);\n if (dupe !== undefined)\n fail(\n \"invalid-input\",\n `lesson \"${dupe}\" is referenced more than once`,\n \"adopt or dismiss each lesson once\",\n );\n for (const ref of refs) {\n const l = state.lessons.find((x) => x.id === ref);\n if (!l)\n fail(\n \"invalid-input\",\n `no lesson \"${ref}\"`,\n `raised lessons: ${\n state.lessons\n .filter((x) => x.status === \"raised\")\n .map((x) => x.id)\n .join(\", \") || \"(none)\"\n }`,\n );\n if (l.status !== \"raised\")\n fail(\n \"invalid-input\",\n `lesson \"${ref}\" is already ${l.status}`,\n \"only raised lessons can be adopted or dismissed\",\n );\n }\n const retire: unknown = input[\"retire\"] ?? [];\n if (\n !Array.isArray(retire) ||\n !retire.every((x) => typeof x === \"string\") ||\n retire.some((x, i) => retire.indexOf(x) !== i)\n )\n fail(\n \"invalid-input\",\n `${ceremony}.retire must be a list of distinct agreement texts`,\n `e.g. { \"retire\": [\"${RETIRE_EXAMPLE[ceremony] ?? \"review in a fresh worker\"}\"] }; each agreement once`,\n );\n return {\n lessons: newLessons,\n adopt: adopt as Adopt[],\n dismiss: dismiss as string[],\n retire: retire as string[],\n };\n}\n\n/**\n * Creates the new lessons as adopted, adopts and dismisses the referenced ones, retires agreements\n * and applies `agreement` changes; every other change kind goes to `applyChange` when given.\n */\nexport function applyLessonInput(\n state: WorkflowState,\n parsed: LessonInput,\n by: string,\n now: string,\n applyChange?: (s: WorkflowState, change: LessonChange) => WorkflowState | void,\n): LessonOutcome {\n let s = state;\n const created: string[] = [];\n const adopted: string[] = [];\n const agreements: string[] = [];\n const change = (c: LessonChange | undefined) => {\n if (!c) return;\n if (c.kind === \"agreement\") {\n s = applyAgreement(s, c, by, now);\n agreements.push(c.text);\n } else if (applyChange) {\n s = applyChange(s, c) ?? s;\n }\n };\n for (const l of parsed.lessons) {\n const id = `L${s.lessons.length + 1}`;\n const lesson: Lesson = {\n id,\n at: now,\n text: l.text,\n scope: l.scope,\n status: \"adopted\",\n from: l.from ?? by,\n };\n if (l.item !== undefined) lesson.item = l.item;\n if (l.suggestedChange) lesson.suggestedChange = l.suggestedChange;\n s = { ...s, lessons: [...s.lessons, lesson] };\n created.push(id);\n adopted.push(id);\n change(l.suggestedChange);\n }\n for (const a of parsed.adopt) {\n s = {\n ...s,\n lessons: s.lessons.map((x) =>\n x.id === a.id\n ? {\n ...x,\n status: \"adopted\" as const,\n ...(a.suggestedChange ? { suggestedChange: a.suggestedChange } : {}),\n }\n : x,\n ),\n };\n adopted.push(a.id);\n change(a.suggestedChange ?? s.lessons.find((x) => x.id === a.id)?.suggestedChange);\n }\n for (const d of parsed.dismiss)\n s = {\n ...s,\n lessons: s.lessons.map((x) => (x.id === d ? { ...x, status: \"dismissed\" as const } : x)),\n };\n for (const text of parsed.retire) s = retireAgreement(s, text, by, now);\n return {\n state: s,\n created,\n adopted,\n dismissed: parsed.dismiss,\n agreements,\n retired: parsed.retire,\n };\n}\n"]}
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkEACZBAP3_cjs=require('./chunk-EACZBAP3.cjs'),chunkS3BXVHO7_cjs=require('./chunk-S3BXVHO7.cjs');var f=t=>t.agreements.length===0?"(none)":t.agreements.map(e=>`"${e}"`).join(", ");function a(t,e,n){return chunkS3BXVHO7_cjs.b("invalid-input",`no working agreement ${JSON.stringify(e)} to ${n}`,`current agreements: ${f(t)}; name one of them exactly`)}function g(t,e,n,i){if(e.replaces===e.text)return t;let r=t;return e.replaces!==void 0&&((typeof e.replaces!="string"||!r.agreements.includes(e.replaces))&&a(r,e.replaces,"replace"),r={...r,agreements:r.agreements.filter(o=>o!==e.replaces)},r=chunkEACZBAP3_cjs.c(r,"agreement.retired",n,{text:e.replaces,replacedBy:e.text},i)),r.agreements.includes(e.text)||(r={...r,agreements:[...r.agreements,e.text]}),r}function u(t,e,n,i){(typeof e!="string"||!t.agreements.includes(e))&&a(t,e,"retire");let r={...t,agreements:t.agreements.filter(o=>o!==e)};return chunkEACZBAP3_cjs.c(r,"agreement.retired",n,{text:e,replacedBy:null},i)}exports.a=g;exports.b=u;//# sourceMappingURL=chunk-HCRVWMG4.cjs.map
2
- //# sourceMappingURL=chunk-HCRVWMG4.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/agreements.ts"],"names":["listed","s","a","absent","text","what","fail","applyAgreement","state","change","by","now","appendEvent","retireAgreement"],"mappings":"qHAIA,IAAMA,EAAUC,CAAAA,EACdA,CAAAA,CAAE,WAAW,MAAA,GAAW,CAAA,CAAI,SAAWA,CAAAA,CAAE,UAAA,CAAW,GAAA,CAAKC,CAAAA,EAAM,IAAIA,CAAC,CAAA,CAAA,CAAG,EAAE,IAAA,CAAK,IAAI,EAEpF,SAASC,CAAAA,CAAOF,CAAAA,CAAkBG,CAAAA,CAAeC,EAAqB,CACpE,OAAOC,oBACL,eAAA,CACA,CAAA,qBAAA,EAAwB,KAAK,SAAA,CAAUF,CAAI,CAAC,CAAA,IAAA,EAAOC,CAAI,GACvD,CAAA,oBAAA,EAAuBL,CAAAA,CAAOC,CAAC,CAAC,CAAA,0BAAA,CAClC,CACF,CAGO,SAASM,CAAAA,CACdC,CAAAA,CACAC,EACAC,CAAAA,CACAC,CAAAA,CACe,CACf,GAAIF,CAAAA,CAAO,WAAaA,CAAAA,CAAO,IAAA,CAAM,OAAOD,CAA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Content":["import { fail } from \"./errors.ts\";\nimport { appendEvent } from \"./state.ts\";\nimport type { WorkflowState } from \"./types.ts\";\n\nconst listed = (s: WorkflowState) =>\n s.agreements.length === 0 ? \"(none)\" : s.agreements.map((a) => `\"${a}\"`).join(\", \");\n\nfunction absent(s: WorkflowState, text: unknown, what: string): never {\n return fail(\n \"invalid-input\",\n `no working agreement ${JSON.stringify(text)} to ${what}`,\n `current agreements: ${listed(s)}; name one of them exactly`,\n );\n}\n\n/** Adds an agreement (idempotent); with `replaces`, retires that one in the same step. */\nexport function applyAgreement(\n state: WorkflowState,\n change: { text: string; replaces?: string },\n by: string,\n now: string,\n): WorkflowState {\n if (change.replaces === change.text) return state;\n let s = state;\n if (change.replaces !== undefined) {\n if (typeof change.replaces !== \"string\" || !s.agreements.includes(change.replaces))\n absent(s, change.replaces, \"replace\");\n s = { ...s, agreements: s.agreements.filter((a) => a !== change.replaces) };\n s = appendEvent(\n s,\n \"agreement.retired\",\n by,\n { text: change.replaces, replacedBy: change.text },\n now,\n );\n }\n if (!s.agreements.includes(change.text)) s = { ...s, agreements: [...s.agreements, change.text] };\n return s;\n}\n\n/** Removes an agreement and records why it left (replacedBy null). */\nexport function retireAgreement(\n state: WorkflowState,\n text: string,\n by: string,\n now: string,\n): WorkflowState {\n if (typeof text !== \"string\" || !state.agreements.includes(text)) absent(state, text, \"retire\");\n const s = { ...state, agreements: state.agreements.filter((a) => a !== text) };\n return appendEvent(s, \"agreement.retired\", by, { text, replacedBy: null }, now);\n}\n"]}
@@ -1,2 +0,0 @@
1
- //# sourceMappingURL=chunk-KIQOUUEZ.mjs.map
2
- //# sourceMappingURL=chunk-KIQOUUEZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/schema/generated.ts","../src/schema/validate.ts","../src/schema/index.ts"],"names":["CORE_DEFINITIONS","SCRUM_DEFINITIONS","KANBAN_DEFINITIONS","WATERFALL_DEFINITIONS","INVESTIGATION_DEFINITIONS","EXPERIMENTATION_DEFINITIONS","DEFS","kindOf","v","isType","t","show","s","esc","key","same","a","b","err","path","keyword","message","expected","found","resolve","ref","root","fail","name","def","rank","errors","branchPath","own","e","collapse","branches","first","candidate","consts","c","validate","schema","value","walk","out","types","items","i","obj","prop","at","known","best","failed","branch","merged","assertValid","what","more","DRAFT_07","document","definitions","workflowStateSchema","roleSchema","newItemSchema","itemPatchSchema","handoffSchema","scrumConfigSchema","kanbanConfigSchema","waterfallConfigSchema","investigationConfigSchema","experimentationConfigSchema"],"mappings":"qCAIO,IAAMA,CAAAA,CAA+C,CAC1D,UAAA,CAAY,CACV,KAAM,QAAA,CACN,UAAA,CAAY,CACV,IAAA,CAAM,CACJ,IAAA,CAAM,QACR,CAAA,CACA,IAAA,CAAM,CACJ,IAAA,CAAM,QACR,CAAA,CACA,KAAA,CAAO,CACL,IAAA,CAAM,QACR,CAAA,CACA,QAAA,CAAU,CACR,IAAA,CAAM,QACR,CAAA,CACA,SAAA,CAAW,CACT,IAAA,CAAM,QACR,CAAA,CACA,UAAA,CAAY,CACV,IAAA,CAAM,QACR,CAAA,CACA,SAAA,CAAW,CACT,IAAA,CAAM,QACR,CAAA,CACA,QAAS,CACP,IAAA,CAAM,QACR,CAAA,CACA,SAAU,CACR,IAAA,CAAM,SACR,CACF,EACA,QAAA,CAAU,CACR,MAAA,CACA,MAAA,CACA,QACA,UAAA,CACA,WAAA,CACA,YAAA,CACA,WAAA,CACA,SACF,CAAA,CACA,oBAAA,CAAsB,KACxB,CAAA,CACA,SAAU,CACR,IAAA,CAAM,QAAA,CACN,UAAA,CAAY,CACV,KAAA,CAAO,CACL,IAAA,CAAM,QACR,CAAA,CACA,OAAA,CAAS,CACP,IAAA,CAAM,QACR,CAAA,CACA,EAAA,CAAI,CACF,IAAA,CAAM,QACR,CAAA,CACA,UAAA,CAAY,CACV,IAAA,CAAM,QACN,KAAA,CAAO,CACL,IAAA,CAAM,QACR,CACF,CAAA,CACA,YAAA,CAAc,CACZ,IAAA,CAAM,SACN,oBAA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4BAAA,EAA+BrB,CAAAA,CAAM,IAAI,CAAA,CAAA,EAAIA,CAAAA,CAAM,OAAO,CAAA,EAAGsB,CAAI,CAAA,CAAA,CACxE,CAAA,IAAA,EAAOD,CAAI,CAAA,IAAA,EAAOrB,EAAM,IAAI,CAAA,WAAA,EAAcA,CAAAA,CAAM,QAAQ,CAAA,QAAA,EAAWA,CAAAA,CAAM,KAAK,CAAA,CAChF,EACF,CCzMO,IAAMuB,CAAAA,CAAW,0CAExB,SAASC,CAAAA,CAASjC,CAAAA,CAAckC,CAAAA,CAA6D,CAC3F,OAAO,CAAE,OAAA,CAASF,CAAAA,CAAU,IAAA,CAAM,iBAAiBhC,CAAI,CAAA,CAAA,CAAI,WAAA,CAAAkC,CAAY,CACzE,CAGO,IAAMC,CAAAA,CAAsBF,CAAAA,CAAS,gBAAiB7D,CAAgB,CAAA,CAEhEgE,CAAAA,CAAaH,CAAAA,CAAS,OAAQ7D,CAAgB,CAAA,CAE9CiE,CAAAA,CAAgBJ,CAAAA,CAAS,UAAW7D,CAAgB,CAAA,CAEpDkE,CAAAA,CAAkBL,CAAAA,CAAS,YAAa7D,CAAgB,CAAA,CAExDmE,CAAAA,CAAgBN,CAAAA,CAAS,UAAW7D,CAAgB,CAAA,CAEpDoE,CAAAA,CAAoBP,CAAAA,CAAS,cAAe5D,CAAiB,CAAA,CAC7DoE,CAAAA,CAAqBR,CAAAA,CAAS,eAAgB3D,CAAkB,CAAA,CAChEoE,CAAAA,CAAwBT,CAAAA,CAAS,kBAAmB1D,CAAqB,CAAA,CACzEoE,CAAAA,CAA4BV,CAAAA,CAAS,sBAAuBzD,CAAyB,CAAA,CACrFoE,CAAAA,CAA8BX,CAAAA,CACzC,wBACAxD,CACF","file":"chunk-KLWZEXZU.mjs","sourcesContent":["// GENERATED by scripts/gen-schema.mjs from src/types.ts and methodology config.ts files.\n// Do not edit. Run `pnpm schema:gen`; `pnpm schema:check` fails the build when this file is stale.\nimport type { JsonSchema } from \"./types.ts\";\n\nexport const CORE_DEFINITIONS: Record<string, JsonSchema> = {\n Accounting: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n role: {\n type: \"string\",\n },\n model: {\n type: \"string\",\n },\n tokensIn: {\n type: \"number\",\n },\n tokensOut: {\n type: \"number\",\n },\n durationMs: {\n type: \"number\",\n },\n startedAt: {\n type: \"string\",\n },\n endedAt: {\n type: \"string\",\n },\n estimate: {\n type: \"boolean\",\n },\n },\n required: [\n \"item\",\n \"role\",\n \"model\",\n \"tokensIn\",\n \"tokensOut\",\n \"durationMs\",\n \"startedAt\",\n \"endedAt\",\n ],\n additionalProperties: false,\n },\n Baseline: {\n type: \"object\",\n properties: {\n phase: {\n type: \"string\",\n },\n version: {\n type: \"number\",\n },\n at: {\n type: \"string\",\n },\n approvedBy: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n itemSnapshot: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/WorkItem\",\n },\n },\n },\n required: [\"phase\", \"version\", \"at\", \"approvedBy\", \"itemSnapshot\"],\n additionalProperties: false,\n },\n BeliefUpdate: {\n type: \"object\",\n properties: {\n result: {\n type: \"string\",\n },\n assessments: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n hypothesis: {\n type: \"string\",\n },\n assessment: {\n type: \"string\",\n enum: [\"supported\", \"refuted\", \"uncertain\"],\n },\n reason: {\n type: \"string\",\n },\n },\n required: [\"hypothesis\", \"assessment\", \"reason\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"result\", \"assessments\"],\n additionalProperties: false,\n },\n Blocker: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n owner: {\n type: \"string\",\n },\n raisedAt: {\n type: \"string\",\n },\n clearedAt: {\n type: \"string\",\n },\n },\n required: [\"id\", \"reason\", \"owner\", \"raisedAt\"],\n additionalProperties: false,\n },\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n Capability: {\n type: \"string\",\n enum: [\n \"order-backlog\",\n \"define-acceptance\",\n \"facilitate\",\n \"deliver\",\n \"review\",\n \"verify\",\n \"approve-gate\",\n \"manage-flow\",\n \"control-change\",\n \"escalate\",\n ],\n },\n ClassOfService: {\n type: \"string\",\n enum: [\"expedite\", \"fixed-date\", \"standard\", \"intangible\"],\n },\n Event: {\n type: \"object\",\n properties: {\n seq: {\n type: \"number\",\n },\n at: {\n type: \"string\",\n },\n type: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n payload: {},\n },\n required: [\"seq\", \"at\", \"type\", \"by\", \"payload\"],\n additionalProperties: false,\n },\n Evidence: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\", \"by\", \"at\"],\n additionalProperties: false,\n },\n Experiment: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n procedureRef: {\n type: \"string\",\n },\n predictions: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n hypothesis: {\n type: \"string\",\n },\n prediction: {\n type: \"string\",\n },\n },\n required: [\"hypothesis\", \"prediction\"],\n additionalProperties: false,\n },\n },\n replayOf: {\n type: \"string\",\n },\n },\n required: [\"id\", \"procedureRef\", \"predictions\"],\n additionalProperties: false,\n },\n ExperimentCandidate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n item: {\n type: \"string\",\n },\n author: {\n type: \"string\",\n },\n status: {\n type: \"string\",\n enum: [\n \"pending\",\n \"ready\",\n \"running\",\n \"submitted\",\n \"validated\",\n \"failed\",\n \"timed-out\",\n \"cancelled\",\n ],\n },\n workspace: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n score: {\n type: \"number\",\n },\n spent: {\n $ref: \"#/definitions/Spent\",\n },\n validation: {\n type: \"object\",\n properties: {\n sha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n passed: {\n type: \"boolean\",\n },\n reproducible: {\n type: \"boolean\",\n },\n evidence: {\n type: \"string\",\n },\n },\n required: [\"sha\", \"harness\", \"by\", \"passed\", \"reproducible\", \"evidence\"],\n additionalProperties: false,\n },\n reason: {\n type: \"string\",\n },\n command: {\n type: \"string\",\n },\n log: {\n type: \"string\",\n },\n terminalLog: {\n type: \"string\",\n },\n },\n required: [\"id\", \"item\", \"author\", \"status\", \"spent\"],\n additionalProperties: false,\n },\n ExperimentationState: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n enum: [\"running\", \"selected\", \"integrating\", \"integrated\", \"stopped\"],\n },\n baseSha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n candidates: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/ExperimentCandidate\",\n },\n },\n selected: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n integration: {\n type: \"object\",\n properties: {\n selectedSha: {\n type: \"string\",\n },\n targetSha: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n validation: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n sha: {\n type: \"string\",\n },\n harness: {\n type: \"string\",\n },\n evidence: {\n type: \"string\",\n },\n passed: {\n type: \"boolean\",\n },\n },\n required: [\"by\", \"sha\", \"harness\", \"evidence\", \"passed\"],\n additionalProperties: false,\n },\n },\n required: [\"selectedSha\", \"targetSha\", \"sha\", \"by\"],\n additionalProperties: false,\n },\n released: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n overhead: {\n $ref: \"#/definitions/Spent\",\n },\n },\n required: [\"status\", \"baseSha\", \"harness\", \"candidates\", \"released\", \"overhead\"],\n additionalProperties: false,\n },\n Gate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n requires: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n onFail: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"block\",\n },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"return-to\",\n },\n stage: {\n type: \"string\",\n },\n },\n required: [\"action\", \"stage\"],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [\"id\", \"requires\", \"evidence\", \"onFail\"],\n additionalProperties: false,\n },\n GateRequirement: {\n anyOf: [\n {\n type: \"string\",\n const: \"human\",\n },\n {\n type: \"object\",\n properties: {\n capability: {\n type: \"string\",\n },\n },\n required: [\"capability\"],\n additionalProperties: false,\n },\n ],\n },\n Handoff: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n role: {\n type: \"string\",\n },\n produced: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\"],\n additionalProperties: false,\n },\n },\n notes: {\n type: \"string\",\n },\n do_not: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n open_questions: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n verdict: {\n $ref: \"#/definitions/Verdict\",\n },\n follow_ups: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/NewItem\",\n },\n },\n lessons: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n text: {\n type: \"string\",\n },\n scope: {\n type: \"string\",\n enum: [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"],\n },\n },\n required: [\"text\", \"scope\"],\n additionalProperties: false,\n },\n },\n },\n required: [\"item\", \"role\", \"produced\", \"notes\", \"do_not\", \"open_questions\"],\n additionalProperties: false,\n },\n Hypothesis: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n claim: {\n type: \"string\",\n },\n falsifiedBy: {\n type: \"string\",\n },\n },\n required: [\"id\", \"claim\", \"falsifiedBy\"],\n additionalProperties: false,\n },\n ImpactAnalysis: {\n type: \"object\",\n properties: {\n summary: {\n type: \"string\",\n },\n reopen: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n weight: {\n type: \"number\",\n },\n },\n required: [\"summary\", \"reopen\", \"weight\"],\n additionalProperties: false,\n },\n InvestigationConclusion: {\n type: \"object\",\n properties: {\n outcome: {\n type: \"string\",\n enum: [\"resolved\", \"inconclusive\"],\n },\n summary: {\n type: \"string\",\n },\n supportedHypothesis: {\n type: \"string\",\n },\n evidenceRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n by: {\n type: \"string\",\n },\n },\n required: [\"outcome\", \"summary\", \"evidenceRefs\", \"by\"],\n additionalProperties: false,\n },\n InvestigationRound: {\n type: \"object\",\n properties: {\n hypotheses: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Hypothesis\",\n },\n },\n experiment: {\n $ref: \"#/definitions/Experiment\",\n },\n item: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n result: {\n $ref: \"#/definitions/Observation\",\n },\n update: {\n $ref: \"#/definitions/BeliefUpdate\",\n },\n },\n required: [\"hypotheses\", \"experiment\", \"item\", \"by\"],\n additionalProperties: false,\n },\n InvestigationState: {\n type: \"object\",\n properties: {\n item: {\n type: \"string\",\n },\n phase: {\n type: \"string\",\n enum: [\n \"hypotheses\",\n \"preregister\",\n \"observe\",\n \"update-belief\",\n \"conclusion\",\n \"review\",\n \"closed\",\n ],\n },\n hypotheses: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Hypothesis\",\n },\n },\n singleHypothesisRationale: {\n type: \"string\",\n },\n rounds: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/InvestigationRound\",\n },\n },\n conclusion: {\n $ref: \"#/definitions/InvestigationConclusion\",\n },\n outcome: {\n type: \"string\",\n enum: [\"resolved\", \"inconclusive\", \"stopped\"],\n },\n stopReason: {\n type: \"string\",\n },\n contributors: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n reviewHistory: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n approve: {\n type: \"boolean\",\n },\n next: {\n type: \"string\",\n enum: [\"round\", \"conclusion\"],\n },\n replayRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"by\", \"reason\", \"approve\", \"replayRefs\"],\n additionalProperties: false,\n },\n },\n review: {\n type: \"object\",\n properties: {\n by: {\n type: \"string\",\n },\n reason: {\n type: \"string\",\n },\n replayRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"by\", \"reason\", \"replayRefs\"],\n additionalProperties: false,\n },\n },\n required: [\"item\", \"phase\", \"hypotheses\", \"rounds\", \"contributors\"],\n additionalProperties: false,\n },\n ItemPatch: {\n type: \"object\",\n properties: {\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n title: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n },\n additionalProperties: false,\n },\n ItemStatus: {\n type: \"string\",\n enum: [\"todo\", \"in_progress\", \"blocked\", \"review\", \"awaiting_human\", \"done\", \"dropped\"],\n },\n ItemType: {\n type: \"string\",\n enum: [\"epic\", \"story\", \"task\", \"bug\", \"change-request\", \"deliverable\", \"question\"],\n },\n Iteration: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n goal: {\n type: \"string\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n spent: {\n $ref: \"#/definitions/Spent\",\n },\n startedAt: {\n type: \"string\",\n },\n endedAt: {\n type: \"string\",\n },\n committed: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n carryover: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n outcome: {\n type: \"string\",\n enum: [\"completed\", \"cancelled\"],\n },\n closing: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"goal\", \"budget\", \"spent\", \"startedAt\", \"committed\", \"carryover\"],\n additionalProperties: false,\n },\n Lesson: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n text: {\n type: \"string\",\n },\n scope: {\n type: \"string\",\n enum: [\"policy\", \"skill\", \"memory\", \"spec\", \"review\"],\n },\n status: {\n type: \"string\",\n enum: [\"raised\", \"adopted\", \"dismissed\"],\n },\n from: {\n type: \"string\",\n },\n item: {\n type: \"string\",\n },\n suggestedChange: {\n $ref: \"#/definitions/LessonChange\",\n },\n },\n required: [\"id\", \"at\", \"text\", \"scope\", \"status\"],\n additionalProperties: false,\n },\n LessonChange: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"agreement\",\n },\n text: {\n type: \"string\",\n },\n replaces: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"text\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dod\",\n },\n policy: {\n $ref: \"#/definitions/Policy\",\n },\n },\n required: [\"kind\", \"policy\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"backlog\",\n },\n item: {\n $ref: \"#/definitions/NewItem\",\n },\n },\n required: [\"kind\", \"item\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"skill\",\n },\n note: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"note\"],\n additionalProperties: false,\n },\n ],\n },\n MethodologyName: {\n type: \"string\",\n enum: [\"scrum\", \"kanban\", \"waterfall\", \"investigation\", \"experimentation\"],\n },\n ModelTier: {\n type: \"string\",\n enum: [\"small\", \"medium\", \"large\"],\n },\n NewItem: {\n type: \"object\",\n additionalProperties: false,\n properties: {\n stage: {\n type: \"string\",\n },\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n id: {\n type: \"string\",\n },\n title: {\n type: \"string\",\n },\n },\n required: [\"id\", \"title\"],\n },\n Observation: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n valid: {\n type: \"boolean\",\n },\n summary: {\n type: \"string\",\n },\n provenanceRefs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"id\", \"valid\", \"summary\", \"provenanceRefs\"],\n additionalProperties: false,\n },\n PendingHuman: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n kind: {\n type: \"string\",\n enum: [\"gate\", \"decision\"],\n },\n item: {\n type: \"string\",\n },\n gate: {\n type: \"string\",\n },\n question: {\n type: \"string\",\n },\n raisedAt: {\n type: \"string\",\n },\n },\n required: [\"id\", \"kind\", \"question\", \"raisedAt\"],\n additionalProperties: false,\n },\n Phase: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n deliverables: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n status: {\n type: \"string\",\n enum: [\"pending\", \"open\", \"baselined\", \"reopened\"],\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n produced: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Produced\",\n },\n },\n },\n required: [\"id\", \"name\", \"deliverables\", \"gate\", \"status\"],\n additionalProperties: false,\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n Produced: {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n },\n ref: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n at: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"ref\", \"by\", \"at\"],\n additionalProperties: false,\n },\n Role: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n modelTier: {\n $ref: \"#/definitions/ModelTier\",\n },\n resourceClass: {\n type: \"string\",\n },\n maxConcurrent: {\n type: \"number\",\n },\n capabilities: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Capability\",\n },\n },\n canApprove: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n inputs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n outputs: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n do_not: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n constraints: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\n \"id\",\n \"name\",\n \"modelTier\",\n \"capabilities\",\n \"canApprove\",\n \"inputs\",\n \"outputs\",\n \"do_not\",\n ],\n additionalProperties: false,\n },\n Spent: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n required: [\"tokens\", \"turns\", \"wallclockMs\"],\n additionalProperties: false,\n },\n Stage: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n wipLimit: {\n type: \"number\",\n },\n entryPolicy: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n exitPolicy: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n commitmentPoint: {\n type: \"boolean\",\n },\n deliveryPoint: {\n type: \"boolean\",\n },\n review: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"name\", \"entryPolicy\", \"exitPolicy\"],\n additionalProperties: false,\n },\n Transition: {\n type: \"object\",\n properties: {\n from: {\n type: \"object\",\n properties: {\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n },\n required: [\"stage\", \"status\"],\n additionalProperties: false,\n },\n to: {\n type: \"object\",\n properties: {\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n },\n required: [\"stage\", \"status\"],\n additionalProperties: false,\n },\n at: {\n type: \"string\",\n },\n by: {\n type: \"string\",\n },\n },\n required: [\"from\", \"to\", \"at\", \"by\"],\n additionalProperties: false,\n },\n Verdict: {\n type: \"string\",\n enum: [\"done\", \"blocked\", \"needs-review\", \"rework\", \"escalate\"],\n },\n WorkItem: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n type: {\n $ref: \"#/definitions/ItemType\",\n },\n title: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n dependsOn: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n priority: {\n type: \"number\",\n },\n weight: {\n type: \"number\",\n },\n deadline: {\n type: \"string\",\n },\n classOfService: {\n $ref: \"#/definitions/ClassOfService\",\n },\n stage: {\n type: \"string\",\n },\n status: {\n $ref: \"#/definitions/ItemStatus\",\n },\n role: {\n type: \"string\",\n },\n parent: {\n type: \"string\",\n },\n acceptance: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Evidence\",\n },\n },\n blockers: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Blocker\",\n },\n },\n transitions: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Transition\",\n },\n },\n iteration: {\n type: \"string\",\n },\n traces: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n tags: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n affects: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n phase: {\n type: \"string\",\n },\n impactAnalysis: {\n $ref: \"#/definitions/ImpactAnalysis\",\n },\n },\n required: [\n \"id\",\n \"type\",\n \"title\",\n \"dependsOn\",\n \"stage\",\n \"status\",\n \"acceptance\",\n \"evidence\",\n \"blockers\",\n \"transitions\",\n ],\n additionalProperties: false,\n },\n WorkflowState: {\n type: \"object\",\n properties: {\n version: {\n type: \"number\",\n const: 1,\n },\n methodology: {\n $ref: \"#/definitions/MethodologyName\",\n },\n config: {},\n investigation: {\n $ref: \"#/definitions/InvestigationState\",\n },\n experimentation: {\n $ref: \"#/definitions/ExperimentationState\",\n },\n items: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/WorkItem\",\n },\n },\n stages: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Stage\",\n },\n },\n roles: {\n type: \"object\",\n additionalProperties: {\n $ref: \"#/definitions/Role\",\n },\n },\n iterations: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Iteration\",\n },\n },\n phases: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Phase\",\n },\n },\n baseline: {\n $ref: \"#/definitions/Baseline\",\n },\n baselines: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Baseline\",\n },\n },\n events: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Event\",\n },\n },\n accounting: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Accounting\",\n },\n },\n pending: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/PendingHuman\",\n },\n },\n lessons: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Lesson\",\n },\n },\n agreements: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\n \"version\",\n \"methodology\",\n \"config\",\n \"items\",\n \"stages\",\n \"roles\",\n \"iterations\",\n \"events\",\n \"accounting\",\n \"pending\",\n \"lessons\",\n \"agreements\",\n ],\n additionalProperties: false,\n },\n};\n\nexport const SCRUM_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n EstimateMode: {\n type: \"string\",\n enum: [\"per-weight\", \"per-call\"],\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n ScrumConfig: {\n type: \"object\",\n properties: {\n sprintBudget: {\n $ref: \"#/definitions/Budget\",\n },\n productGoal: {\n type: \"string\",\n },\n definitionOfDone: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n refinementSharePct: {\n type: \"number\",\n },\n allowMidSprintAdd: {\n type: \"string\",\n enum: [\"never\", \"po-only\", \"any\"],\n },\n inProgressWipLimit: {\n type: \"number\",\n },\n autoClose: {\n type: \"boolean\",\n },\n estimateMode: {\n $ref: \"#/definitions/EstimateMode\",\n },\n fallbackTokensPerWeight: {\n type: \"number\",\n },\n },\n required: [\n \"sprintBudget\",\n \"productGoal\",\n \"definitionOfDone\",\n \"refinementSharePct\",\n \"allowMidSprintAdd\",\n ],\n additionalProperties: false,\n },\n};\n\nexport const KANBAN_DEFINITIONS: Record<string, JsonSchema> = {\n ClassConfig: {\n type: \"object\",\n properties: {\n wipBypass: {\n type: \"number\",\n },\n sle: {\n $ref: \"#/definitions/ServiceLevel\",\n },\n },\n additionalProperties: false,\n },\n KanbanColumn: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n wipLimit: {\n type: \"number\",\n },\n policies: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/Policy\",\n },\n },\n commitmentPoint: {\n type: \"boolean\",\n },\n deliveryPoint: {\n type: \"boolean\",\n },\n review: {\n type: \"boolean\",\n },\n },\n required: [\"id\", \"name\", \"policies\"],\n additionalProperties: false,\n },\n KanbanConfig: {\n type: \"object\",\n properties: {\n columns: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/KanbanColumn\",\n },\n },\n classesOfService: {\n type: \"object\",\n properties: {\n expedite: {\n $ref: \"#/definitions/ClassConfig\",\n },\n \"fixed-date\": {\n $ref: \"#/definitions/ClassConfig\",\n },\n standard: {\n $ref: \"#/definitions/ClassConfig\",\n },\n intangible: {\n $ref: \"#/definitions/ClassConfig\",\n },\n },\n additionalProperties: false,\n },\n fairness: {\n type: \"object\",\n properties: {\n aging: {\n type: \"boolean\",\n },\n maxDeferralRounds: {\n type: \"number\",\n },\n },\n required: [\"aging\", \"maxDeferralRounds\"],\n additionalProperties: false,\n },\n cadences: {\n type: \"object\",\n properties: {\n replenishment: {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"delivery-planning\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"service-delivery-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"operations-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"risk-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n \"strategy-review\": {\n type: \"object\",\n properties: {\n everyTurns: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n },\n additionalProperties: false,\n },\n throughputWindowMs: {\n type: \"number\",\n },\n maxExpedite: {\n type: \"number\",\n },\n },\n required: [\n \"columns\",\n \"classesOfService\",\n \"fairness\",\n \"cadences\",\n \"throughputWindowMs\",\n \"maxExpedite\",\n ],\n additionalProperties: false,\n },\n Policy: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"evidence\",\n },\n evidenceKind: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"evidenceKind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"acceptance-written\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"estimate-present\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"no-open-blockers\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"dependencies-done\",\n },\n },\n required: [\"kind\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n kind: {\n type: \"string\",\n const: \"custom\",\n },\n id: {\n type: \"string\",\n },\n description: {\n type: \"string\",\n },\n },\n required: [\"kind\", \"id\", \"description\"],\n additionalProperties: false,\n },\n ],\n },\n ServiceLevel: {\n type: \"object\",\n properties: {\n percentile: {\n type: \"number\",\n },\n targetMs: {\n type: \"number\",\n },\n },\n required: [\"percentile\", \"targetMs\"],\n additionalProperties: false,\n },\n};\n\nexport const WATERFALL_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n Gate: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n requires: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n evidence: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n onFail: {\n anyOf: [\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"block\",\n },\n },\n required: [\"action\"],\n additionalProperties: false,\n },\n {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n const: \"return-to\",\n },\n stage: {\n type: \"string\",\n },\n },\n required: [\"action\", \"stage\"],\n additionalProperties: false,\n },\n ],\n },\n },\n required: [\"id\", \"requires\", \"evidence\", \"onFail\"],\n additionalProperties: false,\n },\n GateRequirement: {\n anyOf: [\n {\n type: \"string\",\n const: \"human\",\n },\n {\n type: \"object\",\n properties: {\n capability: {\n type: \"string\",\n },\n },\n required: [\"capability\"],\n additionalProperties: false,\n },\n ],\n },\n WaterfallConfig: {\n type: \"object\",\n properties: {\n phases: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/WaterfallPhaseConfig\",\n },\n },\n changeControl: {\n type: \"object\",\n properties: {\n requiresImpactAnalysis: {\n type: \"boolean\",\n },\n approvers: {\n type: \"array\",\n items: {\n $ref: \"#/definitions/GateRequirement\",\n },\n },\n },\n required: [\"requiresImpactAnalysis\", \"approvers\"],\n additionalProperties: false,\n },\n traceability: {\n type: \"object\",\n properties: {\n from: {\n type: \"string\",\n },\n to: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n },\n required: [\"from\", \"to\"],\n additionalProperties: false,\n },\n humanGates: {\n anyOf: [\n {\n type: \"string\",\n const: \"all\",\n },\n {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n ],\n },\n fallbackTokensPerWeight: {\n type: \"number\",\n },\n },\n required: [\"phases\", \"changeControl\", \"traceability\", \"humanGates\"],\n additionalProperties: false,\n },\n WaterfallPhaseConfig: {\n type: \"object\",\n properties: {\n id: {\n type: \"string\",\n },\n name: {\n type: \"string\",\n },\n deliverables: {\n type: \"array\",\n items: {\n type: \"string\",\n },\n },\n gate: {\n $ref: \"#/definitions/Gate\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n deliverBy: {\n type: \"string\",\n },\n },\n required: [\"id\", \"name\", \"deliverables\", \"gate\"],\n additionalProperties: false,\n },\n};\n\nexport const INVESTIGATION_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n InvestigationConfig: {\n type: \"object\",\n properties: {\n question: {\n type: \"string\",\n },\n maxRounds: {\n type: \"number\",\n },\n budget: {\n $ref: \"#/definitions/Budget\",\n },\n },\n required: [\"question\", \"maxRounds\", \"budget\"],\n additionalProperties: false,\n },\n};\n\nexport const EXPERIMENTATION_DEFINITIONS: Record<string, JsonSchema> = {\n Budget: {\n type: \"object\",\n properties: {\n tokens: {\n type: \"number\",\n },\n turns: {\n type: \"number\",\n },\n wallclockMs: {\n type: \"number\",\n },\n },\n additionalProperties: false,\n },\n ExperimentationConfig: {\n type: \"object\",\n properties: {\n objective: {\n type: \"string\",\n },\n direction: {\n type: \"string\",\n enum: [\"minimize\", \"maximize\"],\n },\n tieBreak: {\n type: \"string\",\n const: \"candidate-id\",\n },\n concurrencyCap: {\n type: \"number\",\n },\n maxCandidates: {\n type: \"number\",\n },\n candidateBudget: {\n $ref: \"#/definitions/Budget\",\n },\n totalBudget: {\n $ref: \"#/definitions/Budget\",\n },\n },\n required: [\n \"objective\",\n \"direction\",\n \"tieBreak\",\n \"concurrencyCap\",\n \"maxCandidates\",\n \"candidateBudget\",\n \"totalBudget\",\n ],\n additionalProperties: false,\n },\n};\n","import { fail } from \"../errors.ts\";\nimport type { JsonSchema, SchemaError } from \"./types.ts\";\n\nconst DEFS = \"#/definitions/\";\n\nfunction kindOf(v: unknown): string {\n if (v === null) return \"null\";\n if (Array.isArray(v)) return \"array\";\n return typeof v;\n}\nfunction isType(t: string, v: unknown): boolean {\n if (t === \"integer\") return typeof v === \"number\" && Number.isInteger(v);\n return kindOf(v) === t;\n}\nfunction show(v: unknown): string {\n const s = JSON.stringify(v);\n if (s === undefined) return String(v);\n return s.length > 60 ? `${s.slice(0, 57)}...` : s;\n}\n/** JSON-pointer escaping for one key. */\nfunction esc(key: string): string {\n return key.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction same(a: unknown, b: unknown): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n}\nfunction err(\n path: string,\n keyword: string,\n message: string,\n expected: string,\n found: string,\n): SchemaError {\n return { path: path === \"\" ? \"/\" : path, keyword, message, expected, found };\n}\n\nfunction resolve(ref: string, root: JsonSchema): JsonSchema {\n if (!ref.startsWith(DEFS))\n fail(\n \"invalid-input\",\n `schema $ref ${JSON.stringify(ref)} is not #/definitions/<name>`,\n \"regenerate the schema with pnpm schema:gen\",\n );\n const name = ref.slice(DEFS.length);\n const def =\n root.definitions && Object.hasOwn(root.definitions, name) ? root.definitions[name] : undefined;\n if (!def)\n fail(\n \"invalid-input\",\n `schema $ref ${JSON.stringify(ref)} names no definition`,\n \"regenerate the schema with pnpm schema:gen\",\n );\n return def;\n}\n\n/**\n * Misfit of one anyOf branch (lower is a better fit): a `type` error at the branch's own path (the value is the\n * wrong kind entirely) weighs 1000, a `const` mismatch (a discriminator) 100, anything else 1.\n */\nfunction rank(errors: SchemaError[], branchPath: string): number {\n const own = branchPath === \"\" ? \"/\" : branchPath;\n return errors.reduce(\n (n, e) => n + (e.keyword === \"type\" && e.path === own ? 1000 : e.keyword === \"const\" ? 100 : 1),\n 0,\n );\n}\n\n/** When every failed branch has a `const` error at one pointer (the discriminator), report that once as an enum. */\nfunction collapse(branches: SchemaError[][]): SchemaError | undefined {\n const first = branches[0]?.filter((e) => e.keyword === \"const\") ?? [];\n for (const candidate of first) {\n const consts = branches.map((b) =>\n b.find((e) => e.keyword === \"const\" && e.path === candidate.path),\n );\n if (consts.some((c) => c === undefined)) continue;\n const expected = [...new Set(consts.map((c) => c?.expected))].join(\" | \");\n return {\n path: candidate.path,\n keyword: \"enum\",\n message: `expected one of ${expected}`,\n expected,\n found: candidate.found,\n };\n }\n return undefined;\n}\n\n/** Validate `value` against `schema` (a document: `$ref`s resolve against its `definitions`). Returns every error found. */\nexport function validate(schema: JsonSchema, value: unknown): SchemaError[] {\n return walk(schema, value, schema, \"\");\n}\n\nfunction walk(schema: JsonSchema, value: unknown, root: JsonSchema, path: string): SchemaError[] {\n if (schema.$ref !== undefined) return walk(resolve(schema.$ref, root), value, root, path);\n const out: SchemaError[] = [];\n if (schema.type !== undefined) {\n const types = Array.isArray(schema.type) ? schema.type : [schema.type];\n if (!types.some((t) => isType(t, value))) {\n const expected = types.join(\" | \");\n return [\n err(path, \"type\", `expected ${expected}, got ${kindOf(value)}`, expected, show(value)),\n ];\n }\n }\n if (schema.const !== undefined && !same(value, schema.const))\n out.push(err(path, \"const\", `expected ${show(schema.const)}`, show(schema.const), show(value)));\n if (schema.enum !== undefined && !schema.enum.some((e) => same(e, value))) {\n const expected = schema.enum.map(show).join(\" | \");\n out.push(err(path, \"enum\", `expected one of ${expected}`, expected, show(value)));\n }\n if (typeof value === \"number\") {\n if (schema.minimum !== undefined && value < schema.minimum)\n out.push(\n err(path, \"minimum\", `expected >= ${schema.minimum}`, `>= ${schema.minimum}`, show(value)),\n );\n if (schema.maximum !== undefined && value > schema.maximum)\n out.push(\n err(path, \"maximum\", `expected <= ${schema.maximum}`, `<= ${schema.maximum}`, show(value)),\n );\n }\n if (typeof value === \"string\") {\n if (schema.minLength !== undefined && value.length < schema.minLength)\n out.push(\n err(\n path,\n \"minLength\",\n `expected at least ${schema.minLength} characters`,\n `length >= ${schema.minLength}`,\n show(value),\n ),\n );\n if (schema.pattern !== undefined && !new RegExp(schema.pattern, \"u\").test(value))\n out.push(\n err(\n path,\n \"pattern\",\n `expected to match /${schema.pattern}/`,\n `/${schema.pattern}/`,\n show(value),\n ),\n );\n }\n if (Array.isArray(value) && schema.items !== undefined) {\n const items = schema.items;\n value.forEach((v, i) => out.push(...walk(items, v, root, `${path}/${i}`)));\n }\n if (kindOf(value) === \"object\") {\n const obj = value as Record<string, unknown>;\n for (const [key, v] of Object.entries(obj)) {\n const prop =\n schema.properties && Object.hasOwn(schema.properties, key)\n ? schema.properties[key]\n : undefined;\n const at = `${path}/${esc(key)}`;\n if (prop) out.push(...walk(prop, v, root, at));\n else if (schema.additionalProperties === false) {\n const known = Object.keys(schema.properties ?? {}).join(\", \");\n out.push(\n err(\n at,\n \"additionalProperties\",\n `unknown property ${JSON.stringify(key)}`,\n known ? `one of ${known}` : \"no properties\",\n key,\n ),\n );\n } else if (typeof schema.additionalProperties === \"object\")\n out.push(...walk(schema.additionalProperties, v, root, at));\n }\n for (const key of schema.required ?? [])\n if (!Object.hasOwn(obj, key))\n out.push(\n err(\n `${path}/${esc(key)}`,\n \"required\",\n `missing required property ${JSON.stringify(key)}`,\n \"present\",\n \"absent\",\n ),\n );\n }\n if (schema.anyOf !== undefined) {\n let best: SchemaError[] | undefined;\n const failed: SchemaError[][] = [];\n for (const branch of schema.anyOf) {\n const errors = walk(branch, value, root, path);\n if (errors.length === 0) {\n best = [];\n break;\n }\n failed.push(errors);\n if (best === undefined || rank(errors, path) < rank(best, path)) best = errors;\n }\n const merged = best && best.length > 0 ? collapse(failed) : undefined;\n if (merged) out.push(merged);\n else if (best) out.push(...best);\n }\n return out;\n}\n\n/** Throw WorkflowError(\"invalid-input\") describing the first problem when `value` does not match `schema`. */\nexport function assertValid(schema: JsonSchema, value: unknown, what: string): void {\n const errors = validate(schema, value);\n const first = errors[0];\n if (!first) return;\n const more = errors.length > 1 ? ` (+${errors.length - 1} more)` : \"\";\n fail(\n \"invalid-input\",\n `${what} does not match its schema: ${first.path} ${first.message}${more}`,\n `fix ${what} at ${first.path}: expected ${first.expected}, found ${first.found}`,\n );\n}\n","import {\n CORE_DEFINITIONS,\n KANBAN_DEFINITIONS,\n SCRUM_DEFINITIONS,\n WATERFALL_DEFINITIONS,\n INVESTIGATION_DEFINITIONS,\n EXPERIMENTATION_DEFINITIONS,\n} from \"./generated.ts\";\nimport type { JsonSchema, JsonSchemaDocument } from \"./types.ts\";\n\nexport const DRAFT_07 = \"http://json-schema.org/draft-07/schema#\";\n\nfunction document(name: string, definitions: Record<string, JsonSchema>): JsonSchemaDocument {\n return { $schema: DRAFT_07, $ref: `#/definitions/${name}`, definitions };\n}\n\n/** `.workflow/state.json` */\nexport const workflowStateSchema = document(\"WorkflowState\", CORE_DEFINITIONS);\n/** a role manifest (`.workflow/roles/*.json`, `exwf role add`) */\nexport const roleSchema = document(\"Role\", CORE_DEFINITIONS);\n/** `exwf add <item.json>` */\nexport const newItemSchema = document(\"NewItem\", CORE_DEFINITIONS);\n/** `exwf edit <id> <patch.json>` */\nexport const itemPatchSchema = document(\"ItemPatch\", CORE_DEFINITIONS);\n/** `exwf complete <id> <handoff.json>` */\nexport const handoffSchema = document(\"Handoff\", CORE_DEFINITIONS);\n/** `exwf init scrum --config` / the scrum-master policy.json */\nexport const scrumConfigSchema = document(\"ScrumConfig\", SCRUM_DEFINITIONS);\nexport const kanbanConfigSchema = document(\"KanbanConfig\", KANBAN_DEFINITIONS);\nexport const waterfallConfigSchema = document(\"WaterfallConfig\", WATERFALL_DEFINITIONS);\nexport const investigationConfigSchema = document(\"InvestigationConfig\", INVESTIGATION_DEFINITIONS);\nexport const experimentationConfigSchema = document(\n \"ExperimentationConfig\",\n EXPERIMENTATION_DEFINITIONS,\n);\n\nexport { validate, assertValid } from \"./validate.ts\";\nexport type { JsonSchema, JsonSchemaDocument, SchemaError } from \"./types.ts\";\n"]}
@@ -1,2 +0,0 @@
1
- import {c}from'./chunk-6P3OKXSK.mjs';import {b}from'./chunk-2FRRD6A3.mjs';var f=t=>t.agreements.length===0?"(none)":t.agreements.map(e=>`"${e}"`).join(", ");function a(t,e,n){return b("invalid-input",`no working agreement ${JSON.stringify(e)} to ${n}`,`current agreements: ${f(t)}; name one of them exactly`)}function g(t,e,n,i){if(e.replaces===e.text)return t;let r=t;return e.replaces!==void 0&&((typeof e.replaces!="string"||!r.agreements.includes(e.replaces))&&a(r,e.replaces,"replace"),r={...r,agreements:r.agreements.filter(o=>o!==e.replaces)},r=c(r,"agreement.retired",n,{text:e.replaces,replacedBy:e.text},i)),r.agreements.includes(e.text)||(r={...r,agreements:[...r.agreements,e.text]}),r}function u(t,e,n,i){(typeof e!="string"||!t.agreements.includes(e))&&a(t,e,"retire");let r={...t,agreements:t.agreements.filter(o=>o!==e)};return c(r,"agreement.retired",n,{text:e,replacedBy:null},i)}export{g as a,u as b};//# sourceMappingURL=chunk-NDCQTRIV.mjs.map
2
- //# sourceMappingURL=chunk-NDCQTRIV.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/agreements.ts"],"names":["listed","s","a","absent","text","what","fail","applyAgreement","state","change","by","now","appendEvent","retireAgreement"],"mappings":"0EAIA,IAAMA,EAAUC,CAAAA,EACdA,CAAAA,CAAE,WAAW,MAAA,GAAW,CAAA,CAAI,SAAWA,CAAAA,CAAE,UAAA,CAAW,GAAA,CAAKC,CAAAA,EAAM,IAAIA,CAAC,CAAA,CAAA,CAAG,EAAE,IAAA,CAAK,IAAI,EAEpF,SAASC,CAAAA,CAAOF,CAAAA,CAAkBG,CAAAA,CAAeC,EAAqB,CACpE,OAAOC,EACL,eAAA,CACA,CAAA,qBAAA,EAAwB,KAAK,SAAA,CAAUF,CAAI,CAAC,CAAA,IAAA,EAAOC,CAAI,GACvD,CAAA,oBAAA,EAAuBL,CAAAA,CAAOC,CAAC,CAAC,CAAA,0BAAA,CAClC,CACF,CAGO,SAASM,CAAAA,CACdC,CAAAA,CACAC,EACAC,CAAAA,CACAC,CAAAA,CACe,CACf,GAAIF,CAAAA,CAA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O,CAAG,CAChF","file":"chunk-NDCQTRIV.mjs","sourcesContent":["import { fail } from \"./errors.ts\";\nimport { appendEvent } from \"./state.ts\";\nimport type { WorkflowState } from \"./types.ts\";\n\nconst listed = (s: WorkflowState) =>\n s.agreements.length === 0 ? \"(none)\" : s.agreements.map((a) => `\"${a}\"`).join(\", \");\n\nfunction absent(s: WorkflowState, text: unknown, what: string): never {\n return fail(\n \"invalid-input\",\n `no working agreement ${JSON.stringify(text)} to ${what}`,\n `current agreements: ${listed(s)}; name one of them exactly`,\n );\n}\n\n/** Adds an agreement (idempotent); with `replaces`, retires that one in the same step. */\nexport function applyAgreement(\n state: WorkflowState,\n change: { text: string; replaces?: string },\n by: string,\n now: string,\n): WorkflowState {\n if (change.replaces === change.text) return state;\n let s = state;\n if (change.replaces !== undefined) {\n if (typeof change.replaces !== \"string\" || !s.agreements.includes(change.replaces))\n absent(s, change.replaces, \"replace\");\n s = { ...s, agreements: s.agreements.filter((a) => a !== change.replaces) };\n s = appendEvent(\n s,\n \"agreement.retired\",\n by,\n { text: change.replaces, replacedBy: change.text },\n now,\n );\n }\n if (!s.agreements.includes(change.text)) s = { ...s, agreements: [...s.agreements, change.text] };\n return s;\n}\n\n/** Removes an agreement and records why it left (replacedBy null). */\nexport function retireAgreement(\n state: WorkflowState,\n text: string,\n by: string,\n now: string,\n): WorkflowState {\n if (typeof text !== \"string\" || !state.agreements.includes(text)) absent(state, text, \"retire\");\n const s = { ...state, agreements: state.agreements.filter((a) => a !== text) };\n return appendEvent(s, \"agreement.retired\", by, { text, replacedBy: null }, now);\n}\n"]}
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkU23FUYPD_cjs=require('./chunk-U23FUYPD.cjs'),chunk7FS6KWTG_cjs=require('./chunk-7FS6KWTG.cjs'),chunkRL27372B_cjs=require('./chunk-RL27372B.cjs'),chunkYJQ5YJ7S_cjs=require('./chunk-YJQ5YJ7S.cjs'),chunkTS66RAJR_cjs=require('./chunk-TS66RAJR.cjs'),chunkSVGTSPZF_cjs=require('./chunk-SVGTSPZF.cjs'),chunkAD4Z3JBL_cjs=require('./chunk-AD4Z3JBL.cjs'),chunkEACZBAP3_cjs=require('./chunk-EACZBAP3.cjs'),chunkC2IYMWE6_cjs=require('./chunk-C2IYMWE6.cjs'),chunkS3BXVHO7_cjs=require('./chunk-S3BXVHO7.cjs'),promises=require('fs/promises'),w=require('path');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var w__default=/*#__PURE__*/_interopDefault(w);var $={scrum:chunkRL27372B_cjs.l,kanban:chunkYJQ5YJ7S_cjs.I,waterfall:chunkTS66RAJR_cjs.N,investigation:chunkSVGTSPZF_cjs.b,experimentation:chunkAD4Z3JBL_cjs.h},p=["exwf init <scrum|kanban|waterfall|investigation|experimentation> --config <file> [--roles <file>]","exwf add <item.json> [--by who] exwf edit <id> <patch.json> [--by who]","exwf next [--max n] [--fallback-tokens-per-weight n]","exwf complete <id> <handoff.json> --tokens-in n --tokens-out n --duration-ms n --model m [--estimate] [--role r]","exwf account <item> [--line n] [--tokens-in n] [--tokens-out n] [--duration-ms n] [--model m] [--by who]","exwf ceremony <name> [input.json] [--by who]","exwf decide <pendingId> approve|reject [--by who] [--note text]","exwf config set <patch.json> [--by who] exwf unblock <item> [--blocker id] [--note text] [--by who]","exwf status | board | metrics | pending | lessons","exwf validate <action.json> exwf role add <manifest.json> | role list"],rt=new Set(["estimate"]);function nt(l){let t=[],u={};for(let i=0;i<l.length;i++){let v=l[i];if(v.startsWith("--")){let n=v.slice(2);if(rt.has(n)){u[n]="true";continue}let f=l[i+1];(f===void 0||f.startsWith("--"))&&chunkS3BXVHO7_cjs.b("invalid-input",`--${n} needs a value`,`pass --${n} <text>`),u[n]=f,i++;}else t.push(v);}return {positional:t,flags:u}}async function x(l){try{return JSON.parse(await promises.readFile(l,"utf8"))}catch(t){return chunkS3BXVHO7_cjs.b("invalid-input",`cannot read JSON from ${l}: ${t.message}`,"check the path and that the file is valid JSON")}}function h(l){let t=Object.hasOwn($,l.methodology)?$[l.methodology]:void 0;return t||chunkS3BXVHO7_cjs.b("config-invalid",`methodology "${l.methodology}" is not available in this build`,`available: ${Object.keys($).join(", ")}`),t()}function y(l,t){let u=Number(l[t]);return Number.isFinite(u)||chunkS3BXVHO7_cjs.b("invalid-input",`--${t} must be a number (got ${JSON.stringify(l[t])})`,`pass --${t} <n>`),u}var lt=new Set(["init","add","edit","next","complete","account","ceremony","decide","unblock"]);async function At(l,t){try{let[u,i]=nt(l).positional;return u!==void 0&&(lt.has(u)||u==="role"&&i==="add"||u==="config"&&i==="set")?await chunkU23FUYPD_cjs.c(t,()=>ot(l,t)):await ot(l,t)}catch(u){if(u instanceof chunkS3BXVHO7_cjs.a)return {exit:1,out:{ok:false,error:u.toJSON()}};throw u}}async function ot(l,t){let{positional:u,flags:i}=nt(l),[v,...n]=u,f=i.by??"human",d=new Date().toISOString();switch(v){case "init":{let[e]=n,o=e&&Object.hasOwn($,e)?$[e]:void 0;if(!o||!i.config)return {exit:2,out:{ok:false,usage:p}};try{await promises.stat(chunkU23FUYPD_cjs.b(t)),chunkS3BXVHO7_cjs.b("invalid-input",`${chunkU23FUYPD_cjs.b(t)} already exists`,"delete .workflow/state.json to start over");}catch(c){if(c instanceof chunkS3BXVHO7_cjs.a||c.code!=="ENOENT")throw c}let a=await x(w__default.default.resolve(t,i.config)),s=i.roles?await x(w__default.default.resolve(t,i.roles)):void 0;if(s!==void 0){Array.isArray(s)||chunkS3BXVHO7_cjs.b("invalid-input",`roles file ${i.roles} must contain an array of role manifests`,"wrap the manifests in [ ... ]");for(let c of s)chunkC2IYMWE6_cjs.b(chunkC2IYMWE6_cjs.e,c,`roles file ${i.roles}`);}let r=chunkEACZBAP3_cjs.X(s?{methodology:o(),config:a,roles:s,by:f,now:d}:{methodology:o(),config:a,by:f,now:d});return await chunkU23FUYPD_cjs.d(t,r.state),{exit:0,out:{ok:true,warnings:r.warnings,state:{methodology:r.state.methodology,stages:r.state.stages.map(c=>c.id),roles:Object.keys(r.state.roles)}}}}case "add":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=await x(w__default.default.resolve(t,n[0]));chunkC2IYMWE6_cjs.b(chunkC2IYMWE6_cjs.f,o,`item file ${n[0]}`);let a=chunkEACZBAP3_cjs.W(e,h(e),{type:"item.add",by:f,payload:{item:o}},s=>chunkEACZBAP3_cjs.v(s,o,f,d));return await chunkU23FUYPD_cjs.d(t,a.state),{exit:0,out:{ok:true,warnings:a.warnings,item:chunkEACZBAP3_cjs.u(a.state,o.id)}}}case "edit":{if(!n[0]||!n[1])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=n[0],a=await x(w__default.default.resolve(t,n[1]));chunkC2IYMWE6_cjs.b(chunkC2IYMWE6_cjs.g,a,`patch file ${n[1]}`);let s=chunkEACZBAP3_cjs.W(e,h(e),{type:"item.edit",by:f,payload:{id:o,patch:a}},r=>chunkEACZBAP3_cjs.w(r,o,a,f,d));return await chunkU23FUYPD_cjs.d(t,s.state),{exit:0,out:{ok:true,warnings:s.warnings,item:chunkEACZBAP3_cjs.u(s.state,o)}}}case "next":{let e=await chunkU23FUYPD_cjs.e(t),o={now:d};i.max&&(o.max=y(i,"max")),i["fallback-tokens-per-weight"]&&(o.fallbackTokensPerWeight=y(i,"fallback-tokens-per-weight"));let a=chunk7FS6KWTG_cjs.c(e,h(e),o);for(let s of a.briefs)await chunkU23FUYPD_cjs.f(t,s);return await chunkU23FUYPD_cjs.d(t,a.state),{exit:0,out:{ok:true,reason:a.reason??null,skipped:a.skipped,briefs:a.briefs}}}case "complete":{if(!n[0]||!n[1])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=await x(w__default.default.resolve(t,n[1]));chunkC2IYMWE6_cjs.b(chunkC2IYMWE6_cjs.h,o,`handoff file ${n[1]}`),o.item!==n[0]&&chunkS3BXVHO7_cjs.b("handoff-invalid",`handoff.item "${o.item}" differs from the command's item "${n[0]}"`,"make them match");let a=i.role??o.role,s=y(i,"duration-ms"),r={item:n[0],role:a,model:i.model??"",tokensIn:y(i,"tokens-in"),tokensOut:y(i,"tokens-out"),durationMs:s,startedAt:new Date(Date.parse(d)-s).toISOString(),endedAt:d};i.estimate==="true"&&(r.estimate=true);let c=chunk7FS6KWTG_cjs.d(e,h(e),{...o,role:a},r,d);return await chunkU23FUYPD_cjs.g(t,o,c.state.events.length),await chunkU23FUYPD_cjs.d(t,c.state),{exit:0,out:{ok:true,warnings:c.warnings,item:chunkEACZBAP3_cjs.u(c.state,n[0])}}}case "account":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o={};i["tokens-in"]!==void 0&&(o.tokensIn=y(i,"tokens-in")),i["tokens-out"]!==void 0&&(o.tokensOut=y(i,"tokens-out")),i["duration-ms"]!==void 0&&(o.durationMs=y(i,"duration-ms")),i.model!==void 0&&(o.model=i.model);let a=i.line!==void 0?y(i,"line"):void 0,s=chunk7FS6KWTG_cjs.e(e,n[0],o,i.by??"human",d,a);await chunkU23FUYPD_cjs.d(t,s);let r=chunkEACZBAP3_cjs.d(s),c=r.payload.line;return {exit:0,out:{ok:true,line:s.accounting.filter(A=>A.item===n[0])[c-1],event:r}}}case "ceremony":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=h(e),a=Object.hasOwn(o.ceremonies,n[0])?o.ceremonies[n[0]]:void 0;a||chunkS3BXVHO7_cjs.b("unknown-ceremony",`"${n[0]}" is not a ${o.name} ceremony`,`available: ${Object.keys(o.ceremonies).join(", ")}`);let s=n[1]?await x(w__default.default.resolve(t,n[1])):{},r=a(e,{...s,by:f,now:d});return await chunkU23FUYPD_cjs.d(t,r.state),{exit:0,out:{ok:true,warnings:r.warnings,lastEvent:chunkEACZBAP3_cjs.d(r.state)}}}case "config":{if(n[0]!=="set"||!n[1])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=await x(w__default.default.resolve(t,n[1])),a=chunkEACZBAP3_cjs.Y(e,h(e),o,f,d);return await chunkU23FUYPD_cjs.d(t,a.state),{exit:0,out:{ok:true,warnings:a.warnings,changed:chunkEACZBAP3_cjs.d(a.state).payload.changed,config:a.state.config}}}case "unblock":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e=n[0],o=await chunkU23FUYPD_cjs.e(t),a=chunkEACZBAP3_cjs.u(o,e).blockers.filter(O=>!O.clearedAt).map(O=>O.id);a.length===0&&chunkS3BXVHO7_cjs.b("invalid-input",`item ${e} has no open blocker`,"nothing to clear; check exwf board");let s=i.blocker!==void 0?[i.blocker]:a,r=i.note,c=chunkEACZBAP3_cjs.W(o,h(o),{type:"blocker.clear",by:f,payload:{id:e,blockers:s,note:r??null}},O=>s.reduce((A,at)=>chunkEACZBAP3_cjs.A(A,e,at,f,d,r),O));return await chunkU23FUYPD_cjs.d(t,c.state),{exit:0,out:{ok:true,warnings:c.warnings,item:chunkEACZBAP3_cjs.u(c.state,e)}}}case "decide":{if(!n[0]||n[1]!=="approve"&&n[1]!=="reject")return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=e.pending.find(s=>s.id===n[0]),a=chunkEACZBAP3_cjs.J(e,n[0],n[1],f,i.note??"",d,h(e));return await chunkU23FUYPD_cjs.d(t,a),{exit:0,out:{ok:true,item:o?.item?chunkEACZBAP3_cjs.u(a,o.item):null}}}case "status":{let e=await chunkU23FUYPD_cjs.e(t),o=h(e),a={todo:0,in_progress:0,blocked:0,review:0,awaiting_human:0,done:0,dropped:0};for(let s of Object.values(e.items))a[s.status]+=1;return {exit:0,out:{ok:true,methodology:e.methodology,openIteration:chunkEACZBAP3_cjs.P(e)??null,counts:a,pending:e.pending,openQuestions:chunk7FS6KWTG_cjs.b(e),lastEvent:chunkEACZBAP3_cjs.d(e),report:o.report?o.report(e):null}}}case "board":{let e=await chunkU23FUYPD_cjs.e(t);return {exit:0,out:{ok:true,columns:e.stages.map(a=>({stage:a.id,wipLimit:a.wipLimit??null,items:Object.values(e.items).filter(s=>s.stage===a.id&&s.status!=="dropped").map(s=>({id:s.id,title:s.title,status:s.status,role:s.role??null,age:s.transitions.length?Date.parse(d)-Date.parse(s.transitions[s.transitions.length-1].at):null}))}))}}}case "metrics":{let e=await chunkU23FUYPD_cjs.e(t);return {exit:0,out:{ok:true,metrics:h(e).metrics(e)}}}case "pending":return {exit:0,out:{ok:true,pending:(await chunkU23FUYPD_cjs.e(t)).pending}};case "lessons":return {exit:0,out:{ok:true,lessons:(await chunkU23FUYPD_cjs.e(t)).lessons}};case "validate":{if(!n[0])return {exit:2,out:{ok:false,usage:p}};let e=await chunkU23FUYPD_cjs.e(t),o=await x(w__default.default.resolve(t,n[0]));return {exit:0,out:{ok:true,violations:chunkEACZBAP3_cjs.V(e,h(e),o)}}}case "role":{let e=await chunkU23FUYPD_cjs.e(t);if(n[0]==="list")return {exit:0,out:{ok:true,roles:Object.keys(e.roles),detail:e.roles}};if(n[0]==="add"&&n[1]){let o=await x(w__default.default.resolve(t,n[1]));chunkC2IYMWE6_cjs.b(chunkC2IYMWE6_cjs.e,o,`role manifest ${n[1]}`);let a=chunkEACZBAP3_cjs.f(e,o,f,d);return await chunkU23FUYPD_cjs.d(t,a),{exit:0,out:{ok:true,roles:Object.keys(a.roles)}}}return {exit:2,out:{ok:false,usage:p}}}default:return {exit:2,out:{ok:false,usage:p}}}}exports.a=p;exports.b=nt;exports.c=At;//# sourceMappingURL=chunk-PMUGU5UJ.cjs.map
2
- //# sourceMappingURL=chunk-PMUGU5UJ.cjs.map