@testmuai/kane-cli 0.6.9 → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-TZ554O4U.js +8 -0
- package/dist/{ChromeProfilePicker-FSZB4SZR.js → ChromeProfilePicker-54CAJDUF.js} +1 -1
- package/dist/{CliFeedbackPrompt-WNMDCIHZ.js → CliFeedbackPrompt-TCAH4AHL.js} +1 -1
- package/dist/{CliUploadProgress-H4265KXU.js → CliUploadProgress-UURZ63VQ.js} +1 -1
- package/dist/{ConfigView-XCUZ44SP.js → ConfigView-5QGB7MUS.js} +1 -1
- package/dist/EvidenceViewOffer-SSAM4RRP.js +2 -0
- package/dist/{FolderPicker-S2XVCPYN.js → FolderPicker-Y5MAYFIJ.js} +1 -1
- package/dist/{HelpView-OPKRGNNM.js → HelpView-S3GJGSCE.js} +1 -1
- package/dist/{InfoBox-TW2PGJK5.js → InfoBox-LYTNNMVJ.js} +1 -1
- package/dist/{LinksBox-66M7XP5Y.js → LinksBox-5MSEKNSV.js} +1 -1
- package/dist/{ProfilesView-T2CFQPR5.js → ProfilesView-LTHE5UIO.js} +1 -1
- package/dist/{ProjectPicker-7ALN52CY.js → ProjectPicker-XMXIGHSE.js} +1 -1
- package/dist/{SaveSessionPrompt-HM3F6QML.js → SaveSessionPrompt-VQDEA4WA.js} +1 -1
- package/dist/SingleShotApp-A6PCNPLM.js +2 -0
- package/dist/{SummaryBox-BQZEGOIV.js → SummaryBox-WWF3G263.js} +1 -1
- package/dist/TestMdRunView-MQ7ZPFN2.js +2 -0
- package/dist/{WhoamiView-722MBPSG.js → WhoamiView-PDURYP7E.js} +1 -1
- package/dist/auth-I4RB4KO3.js +2 -0
- package/dist/bind-QJT726NE.js +6 -0
- package/dist/bootstrap-566PPFCC.js +2 -0
- package/dist/{bridge-V4FF5QPK.js → bridge-QCMEOQDD.js} +1 -1
- package/dist/{changelog-KMYZW5MI.js → changelog-OKYH4F7I.js} +1 -1
- package/dist/{chat-committer-MWZ4JQMM.js → chat-committer-OS7ULZMH.js} +1 -1
- package/dist/chat-controller-QLORQWJZ.js +2 -0
- package/dist/{chunk-LRA3V5GY.js → chunk-2WKX3RMA.js} +1 -1
- package/dist/chunk-2XMJ6YAE.js +2 -0
- package/dist/{chunk-FVM7TWKT.js → chunk-3AZTXJY4.js} +1 -1
- package/dist/{chunk-SHAA6FOD.js → chunk-3RZ63RBO.js} +1 -1
- package/dist/{chunk-U5QTE3WX.js → chunk-4CJ55EUY.js} +1 -1
- package/dist/{chunk-T4WZWKIU.js → chunk-54IB6CXK.js} +2 -2
- package/dist/chunk-54VQ46U2.js +14 -0
- package/dist/chunk-55Y65VPA.js +347 -0
- package/dist/chunk-5EOX4MEY.js +2 -0
- package/dist/{chunk-L4JIMNKW.js → chunk-6HYW5RFX.js} +1 -1
- package/dist/{chunk-L3HG5ONB.js → chunk-6W6AIDLJ.js} +1 -1
- package/dist/chunk-73OQDAXF.js +3 -0
- package/dist/{chunk-LEA6IHXC.js → chunk-7E24OCGX.js} +1 -1
- package/dist/{chunk-DKERZJYF.js → chunk-7MRBMDZ5.js} +1 -1
- package/dist/{chunk-345PY4SZ.js → chunk-7NLQ3QQD.js} +1 -1
- package/dist/chunk-7YPK6EDR.js +4 -0
- package/dist/chunk-BKM2LWU2.js +3 -0
- package/dist/{chunk-YY6WPFMT.js → chunk-DSOA6L73.js} +3 -3
- package/dist/{chunk-ZA4GR5R7.js → chunk-EAUUULJQ.js} +1 -1
- package/dist/chunk-EV3EHXEI.js +4 -0
- package/dist/chunk-F7WKDMX7.js +47 -0
- package/dist/{chunk-7Z64BL5D.js → chunk-FCHTL74E.js} +1 -1
- package/dist/chunk-FHKDTM5L.js +6 -0
- package/dist/{chunk-OSALXGD4.js → chunk-FMR2KPSK.js} +1 -1
- package/dist/{chunk-RGDQMKNJ.js → chunk-FRBYGSGJ.js} +1 -1
- package/dist/{chunk-GBYH35H5.js → chunk-FSB3FTIQ.js} +1 -1
- package/dist/{chunk-JHAGEBKE.js → chunk-GIMTSDNC.js} +1 -1
- package/dist/{chunk-FT4G3QGO.js → chunk-GLA6QL3T.js} +1 -1
- package/dist/chunk-H2W2UNTN.js +6 -0
- package/dist/{chunk-7BCZLDNX.js → chunk-HLRLP6TQ.js} +1 -1
- package/dist/{chunk-4FH2KFRT.js → chunk-HMM5FJJO.js} +1 -1
- package/dist/{chunk-TACPTX64.js → chunk-HOQEMPMQ.js} +2 -2
- package/dist/{chunk-MXLXKHW4.js → chunk-ICGHBZFZ.js} +1 -1
- package/dist/{chunk-TFVMSEIA.js → chunk-IQODWB32.js} +1 -1
- package/dist/{chunk-MBXWXBDM.js → chunk-J2KSZUOO.js} +1 -1
- package/dist/chunk-J44RN3FB.js +2 -0
- package/dist/{chunk-O4HWPV67.js → chunk-JXKRO2ZJ.js} +2 -2
- package/dist/{chunk-K5JGCJ2K.js → chunk-K7USHLVZ.js} +4 -4
- package/dist/{chunk-QZJID3OZ.js → chunk-KHJXOFDM.js} +1 -1
- package/dist/chunk-KHQHVSZ6.js +5 -0
- package/dist/{chunk-IWBPV3VS.js → chunk-KSZ72BSC.js} +1 -1
- package/dist/{chunk-QTHITA73.js → chunk-KXUSG5ZI.js} +1 -1
- package/dist/{chunk-DPOES6G3.js → chunk-LHDNJJGE.js} +1 -1
- package/dist/{chunk-P4SE6YON.js → chunk-M5PJQ5Y3.js} +1 -1
- package/dist/{chunk-QM3XF5TW.js → chunk-MFOH7EYR.js} +1 -1
- package/dist/{chunk-EWLLPUP4.js → chunk-MJBCBQC2.js} +1 -1
- package/dist/chunk-MMPFU2YC.js +2 -0
- package/dist/{chunk-RQM3DUSB.js → chunk-MR7CX5VT.js} +1 -1
- package/dist/{chunk-GNNMHYWE.js → chunk-MRP54NCJ.js} +1 -1
- package/dist/chunk-MTNUZEO7.js +12 -0
- package/dist/{chunk-RLICAFFQ.js → chunk-NJAHRITS.js} +1 -1
- package/dist/{chunk-OV2W7KBC.js → chunk-NTGYFYBP.js} +1 -1
- package/dist/{chunk-LMMOR7CR.js → chunk-NTNAHN25.js} +1 -1
- package/dist/{chunk-EASTDHNW.js → chunk-NUQ423YE.js} +1 -1
- package/dist/{chunk-U6TLLYRG.js → chunk-OGWC3J3C.js} +1 -1
- package/dist/chunk-OIYGGEUL.js +6 -0
- package/dist/{chunk-T2ULEJK7.js → chunk-POYZ6SAI.js} +2 -2
- package/dist/chunk-Q2F5QB2W.js +2 -0
- package/dist/{chunk-3YI4QRXF.js → chunk-QJIJC3KC.js} +1 -1
- package/dist/{chunk-G6F2BOFT.js → chunk-RFJAYURU.js} +1 -1
- package/dist/chunk-RGJIRS3B.js +2 -0
- package/dist/{chunk-CLYG26XV.js → chunk-RZJVQUBA.js} +35 -35
- package/dist/{chunk-QB4IOM3X.js → chunk-SURF5Z7Y.js} +1 -1
- package/dist/chunk-TDPWFYTJ.js +2 -0
- package/dist/chunk-V3UE6RJP.js +2 -0
- package/dist/chunk-VOHQA2SP.js +2 -0
- package/dist/{chunk-FFHBQK5N.js → chunk-XSKLH2MC.js} +2 -2
- package/dist/{chunk-OAEZKYYQ.js → chunk-XWSAKVEY.js} +2 -2
- package/dist/{chunk-F42YVALT.js → chunk-XXMNUJX4.js} +1 -1
- package/dist/{chunk-QZNUTCSD.js → chunk-XZRIQ3GF.js} +1 -1
- package/dist/chunk-Y5RNCJAN.js +19 -0
- package/dist/chunk-YSSTGJ7O.js +7 -0
- package/dist/chunk-Z2JSEL3I.js +4 -0
- package/dist/{chunk-R65HNFRB.js → chunk-ZNHXIRCM.js} +9 -9
- package/dist/{chunk-AU7WQ2O5.js → chunk-ZP4S5WGW.js} +1 -1
- package/dist/{chunk-NIKA2V6B.js → chunk-ZPCU6546.js} +1 -1
- package/dist/{config-Z4OS3HEE.js → config-QISRENF5.js} +1 -1
- package/dist/{cover-cmd-L2HSVDLH.js → cover-cmd-SV3I23UM.js} +1 -1
- package/dist/{credentials-TNEVAUHI.js → credentials-OGLK7MPV.js} +1 -1
- package/dist/docx-convert-ZBVQO2LG.js +2 -0
- package/dist/{dossier-ZHSHATVU.js → dossier-KJSJPWOW.js} +1 -1
- package/dist/{evidence-MA3LDBWG.js → evidence-HDD7T7DX.js} +1 -1
- package/dist/evolve-cmd-UE2BIMXK.js +2 -0
- package/dist/exit-manager-MXUD7GQ7.js +2 -0
- package/dist/{explain-VTRHEVUQ.js → explain-EBVIUS2X.js} +1 -1
- package/dist/{explain-cmd-E366QTAD.js → explain-cmd-DBUTPZHA.js} +1 -1
- package/dist/{explain-cmd-327F6ESA.js → explain-cmd-NWIYH5MI.js} +1 -1
- package/dist/extract-bind-6MQYKN3G.js +8 -0
- package/dist/{extract-cmd-LFVMG6UE.js → extract-cmd-2RUIWFZG.js} +1 -1
- package/dist/{gaps-cmd-IAEXXESW.js → gaps-cmd-CKCHH3HQ.js} +1 -1
- package/dist/{generate-headless-TYQRYQKJ.js → generate-headless-TUA3HGRX.js} +2 -2
- package/dist/index.js +67 -65
- package/dist/ingest-FIIO67ZN.js +2 -0
- package/dist/ingest-cmd-CRMY46YC.js +7 -0
- package/dist/interactive-bind-53FCRK34.js +10 -0
- package/dist/{lifecycle-cmd-KZOC4WDW.js → lifecycle-cmd-32LG364Q.js} +1 -1
- package/dist/{list-cmd-6X5U46RD.js → list-cmd-UTZ2PQUK.js} +1 -1
- package/dist/list-commands-F53ZNYOZ.js +2 -0
- package/dist/{logical-ids-RFGWBVML.js → logical-ids-I7B3VJEH.js} +1 -1
- package/dist/login-flow-D7KBR7XR.js +2 -0
- package/dist/{maintenance-cmd-UJG4LPWD.js → maintenance-cmd-BZAGSYGI.js} +1 -1
- package/dist/pdf-convert-S7VYE6AV.js +2 -0
- package/dist/{persist-recorded-session-RAL7UCQT.js → persist-recorded-session-5ZFS5SMZ.js} +1 -1
- package/dist/pipeline-MX3ZR5B3.js +2 -0
- package/dist/readmodel-S5RAQH3F.js +2 -0
- package/dist/reconcile-cmd-4377PWF5.js +2 -0
- package/dist/{recording-banner-MBR3Q7VD.js → recording-banner-ZZUF2MGT.js} +1 -1
- package/dist/{require-project-folder-KE7XOOFN.js → require-project-folder-NQBZFUPF.js} +1 -1
- package/dist/{revert-FRXNIP5R.js → revert-RQJE56HF.js} +1 -1
- package/dist/{review-cmd-XVWPSWU2.js → review-cmd-7LXGYHHQ.js} +1 -1
- package/dist/run-2AIQUJ55.js +2 -0
- package/dist/run-YH5SCBYD.js +2 -0
- package/dist/{run-test-md-ZCAWNP35.js → run-test-md-XOSCYVSS.js} +2 -2
- package/dist/{sessions-cmd-STHKGDX4.js → sessions-cmd-DTQYDZNT.js} +1 -1
- package/dist/{skill-installer-H5DPJJFW.js → skill-installer-VYIIWAK7.js} +1 -1
- package/dist/{spawner-C6B5J73J.js → spawner-7KXVKAD5.js} +1 -1
- package/dist/store-id-EOSGEKVK.js +2 -0
- package/dist/tcg-generate-U6OCCS2E.js +2 -0
- package/dist/testmd-actions-RPALXRZK.js +2 -0
- package/dist/token-refresh-S7CYBZTE.js +2 -0
- package/dist/{validate-basic-VBPGGHES.js → validate-basic-LP3S5PK7.js} +1 -1
- package/dist/{version-check-YPRCQJ7E.js → version-check-XP62HWLJ.js} +1 -1
- package/dist/{view-cmd-G4PGJRQH.js → view-cmd-GQBFCPDL.js} +1 -1
- package/dist/walk-session-YIKHE6PT.js +2 -0
- package/package.json +10 -6
- package/dist/ChatSurface-B2QJYKV4.js +0 -8
- package/dist/EvidenceViewOffer-5TJCRM2T.js +0 -2
- package/dist/SingleShotApp-YQYS6HTB.js +0 -2
- package/dist/TestMdRunView-7CL3PM3J.js +0 -2
- package/dist/bind-HNI5LCNK.js +0 -6
- package/dist/chat-controller-YX5A7R52.js +0 -2
- package/dist/chunk-2Z5MSC23.js +0 -12
- package/dist/chunk-4BAL4OGF.js +0 -7
- package/dist/chunk-4CKZAGBD.js +0 -2
- package/dist/chunk-4GXOBABK.js +0 -4
- package/dist/chunk-E4EHWO3J.js +0 -4
- package/dist/chunk-FXPPQL4D.js +0 -6
- package/dist/chunk-GLS46X7N.js +0 -5
- package/dist/chunk-M5JQXOCE.js +0 -12
- package/dist/chunk-RHNKYNNZ.js +0 -6
- package/dist/chunk-SORKKW7B.js +0 -6
- package/dist/chunk-VCYVSKPM.js +0 -2
- package/dist/chunk-VXLOEM2U.js +0 -347
- package/dist/chunk-XTO236AL.js +0 -14
- package/dist/chunk-XWIN3S7O.js +0 -4
- package/dist/evolve-cmd-DTW4EOXM.js +0 -2
- package/dist/exit-manager-VCSIUYBR.js +0 -2
- package/dist/extract-bind-DZLG4GUE.js +0 -5
- package/dist/ingest-CBQAXVH6.js +0 -2
- package/dist/ingest-cmd-JN6PLDE3.js +0 -3
- package/dist/interactive-bind-QEBWUJCN.js +0 -7
- package/dist/list-commands-BU2MSYRH.js +0 -2
- package/dist/login-flow-4L62GWLT.js +0 -2
- package/dist/pdf-convert-KYXI4FU4.js +0 -2
- package/dist/pipeline-PLI5WQKX.js +0 -2
- package/dist/readmodel-V3DVL6NP.js +0 -2
- package/dist/reconcile-cmd-UXY36ROJ.js +0 -2
- package/dist/run-5DQSL5KH.js +0 -2
- package/dist/run-B7BRNC3X.js +0 -2
- package/dist/tcg-generate-DIMZXAV3.js +0 -2
- package/dist/testmd-actions-X6XCV53D.js +0 -2
- package/dist/token-refresh-7PAPCMQK.js +0 -2
- package/dist/walk-session-GWOP27TX.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as re,b as oe}from"./chunk-SHAA6FOD.js";import{a as x,b as J,d as ie}from"./chunk-GRB66C5S.js";import"./chunk-RN4OSVTG.js";import{a as X,b as Z,c as ee,d as te,e as ne,f as se}from"./chunk-FCMLIK7P.js";import{e as Q,f as L}from"./chunk-CJJXT5DO.js";import{a as I,b as W,c as M,d as K}from"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import{e as Y}from"./chunk-EHN5HTUD.js";import{a as V}from"./chunk-L5LI2JF4.js";import{a as B}from"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import{d as R,e as U}from"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{basename as j}from"path";import{statSync as Re}from"fs";function ye(e,t){return e.length===0?"not_run":ee(e,t).verified?"proven":Z(e,t).some(n=>n.verdict==="failed")?"failing":"blocked"}function ce(e,t){let s=null;for(let{cid:p}of e.byLabel(R.TEST))for(let o of e.execHistory(p))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let n=X[t],r=se(e),c=te(r).aspects[t],i={},d={},l=0,f=0,a=0;for(let p of r.usecases){let o=[];for(let y of p.acceptance_criteria){let u=y.executions??[],_=ye(u,n);o.push(_),_==="failing"?l++:_==="blocked"?f++:_==="not_run"&&a++;let A=[],b;if(_==="failing"){let $=null;for(let P of y.covered_by){let w=e.execHistory(P).map(k=>({verdict:String(k.per_ac?.find(E=>E.ac_ref===y.id)?.verdict??k.verdict),oracle_mode:String(k.oracle_mode),ts:String(k.started_at),execution_id:String(k.execution_id)})).filter(k=>n.counted_verdicts.includes(k.verdict)&&n.accepted_oracle_modes.includes(k.oracle_mode)),O=w[w.length-1];O?.verdict==="failed"&&(A.push(P),(!$||O.ts>$.ts)&&($={ts:O.ts,execution_id:O.execution_id}))}b=$?.execution_id}else _==="blocked"&&(b=u[u.length-1]?.execution_id);i[y.id]={state:_,viaTests:A,...b?{executionId:b}:{}}}let m=o.some(y=>y!=="not_run"),g=c.usecases[p.id],h=m?g.status==="covered"?"proven":g.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";d[p.id]={pct:g.pct,status:h}}return{aspect:t,pct:c.summary.coverage_pct,acs_proven:c.summary.acs_verified,failing:l,blocked:f,not_run:a,latest_run:s,perUc:d,perAc:i,config:{...n,source:"graph_execution_facts",denominator:"current_live_acs"}}}var be=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],_e={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},G={high:0,med:1,low:2};function q(e,t){let s=/^(.*?)(\d+)$/.exec(e),n=/^(.*?)(\d+)$/.exec(t);return s&&n&&s[1]===n[1]?Number(s[2])-Number(n[2]):e<t?-1:e>t?1:0}function F(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function de(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function $e(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(n?.title??n?.text??"")}function ae(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:de($e(e,t),8)}}function ke(e,t){let s=e.resolve(t);if(!s)return null;let n=e.tipOf(s.cid);if(!I(e,n))return null;let r=e.nodeLabel.get(n);if(r===R.USECASE)return n;if(r===R.AC)return M(e,n);if(r===R.TEST){let c=e.edgesFrom(n).find(d=>d.type===U.VERIFIES&&I(e,d.dst));if(c)return M(e,c.dst);let i=e.edgesFrom(n).find(d=>d.type===U.AUTOMATES&&I(e,d.dst));if(i){let d=e.edgesFrom(i.dst).find(l=>l.type===U.BELONGS_TO&&I(e,l.dst));return d?d.dst:null}}return null}function N(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function xe(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return n==="high"||n==="med"||n==="low"?n:"med"}function pe(e,t,s,n,r){let c=r.servePaths??new Map,i=e.byLabel(R.USECASE).filter(({cid:o})=>I(e,o)),d=new Map(i.map(o=>[o.cid,o])),l=new Map(i.map(({cid:o})=>[o,[]])),f=[];for(let o of t){if(o.stage!=="design")continue;let m={...o,...ae(e,o.ref)},g=ke(e,o.ref),h=g?l.get(g):void 0;h&&N(o)!=="other"?h.push(m):f.push(m)}let a=new Map(i.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(R.AC)){if(!I(e,o))continue;let m=M(e,o),g=m?a.get(m):void 0;if(!g)continue;g.total++;let h=W(e,o);if(h&&g.designed++,!n)continue;let y=e.nameOf.get(o)??o,u=n.perAc[y];if(!u)continue;let{id:_,title:A}=ae(e,y),b={ref:e.displayNameOf(o)??o,id:_,title:A,risk:xe(e,y),stage:"cover"},$=l.get(m);u.state==="failing"?$.push({...b,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",via_tests:u.viaTests,...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{},...r.testFiles?{viaFiles:u.viaTests.map(P=>r.testFiles.get(P)??null)}:{}}):u.state==="blocked"?$.push({...b,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{}}):u.state==="not_run"&&h&&$.push({...b,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let p=[];for(let{cid:o,content:m}of i){let g=e.displayNameOf(o)??o,h=e.nameOf.get(o)??o,y=s.perUc[g]??{pct:0,status:"undesigned",staleAcs:0},u=n?n.perUc[h]??{pct:0,status:"not_run"}:null,_=n!==null&&(u===null||u.status==="not_run"),A=a.get(o),b=l.get(o)??[],$=new Set(b.filter(v=>N(v)==="needs-refresh").map(v=>v.ref)),P=b.some(v=>N(v)==="needs-tests"&&$.has(v.ref)),w=[];for(let v of be){let T=b.filter(S=>N(S)===v);if(v==="needs-tests"&&(T=T.filter(S=>!$.has(S.ref))),T.length===0)continue;T.sort((S,H)=>(G[S.risk]??3)-(G[H.risk]??3)||q(S.ref,H.ref));let ve=v==="failing"||v==="blocked"||T.length<=2||new Set(T.map(S=>S.ready_command)).size>1;w.push({key:v,label:_e[v],...v==="needs-refresh"?{suffix:"source moved since these were designed"}:{},alsoNeedsTests:v==="needs-refresh"&&P,rows:T,...ve?{}:{rosterCommand:T[0].ready_command}})}let O=w.some(v=>v.key==="failing"),k=w.some(v=>v.key==="blocked"),E=y.pct===100&&(n===null||u?.pct===100)&&w.length===0,me=u!==null&&u.pct>0,he=O?"\u2717":k?"\u23F8":E?"\u2714":y.pct===0&&!me?"\u2716":"\u25D0";p.push({slug:g,title:String(m.title??""),risk:String(m.risk??""),des:y,prov:u,provAbsent:_,acTotal:A.total,acDesigned:A.designed,mark:he,collapse:E,groups:w})}return p.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.slug,m.slug)),f.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.ref,m.ref)),{stage:r.stage,aspect:r.aspect,top:r.top,dc:s,pa:n,ucs:p,other:f}}function C(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function z(e){return e===100?"\u2714":e>0?"\u25D0":"\u2716"}function D(e,t){return e==="all"||t.stage===e}function fe(e,t){let{dc:s,pa:n}=e,r=Math.max(80,Math.min(t.width,120)),c=l=>t.color?`\x1B[2m${l}\x1B[22m`:l,i=[];if(n){i.push(`coverage \u2014 designed \xD7 proven \xB7 live graph \xB7 aspect ${n.aspect}`),i.push("");let l=s.ucs_needing_scenarios;i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests`+(l>0?` \xB7 scenario debt: ${l} UC${l>1?"s":""}`:""));let f=[n.failing>0?`${n.failing} failing`:null,n.blocked>0?`${n.blocked} blocked`:null,n.not_run>0?`${n.not_run} not yet run`:null].filter(Boolean);i.push(` proven ${z(n.pct)} ${C(n.pct,10)} ${String(n.pct).padStart(3)}% \u2014 ${n.acs_proven} proven by execution`+(f.length?` \xB7 ${f.join(" \xB7 ")}`:""))}else i.push("AC design completeness \u2014 live graph (what design owes; execution proof not shown)"),i.push(""),i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests \xB7 ${s.usecases_complete} UCs complete`),s.ucs_needing_scenarios>0&&i.push(` scenario debt: ${s.ucs_needing_scenarios} use-case${s.ucs_needing_scenarios>1?"s":""} need scenarios`),i.push(" proven \u2014 no runs recorded yet \xB7 run tests, then re-run");i.push("");let d=!1;for(let l of e.ucs){if(i.push(we(l,n!==null,r)),l.collapse)continue;let f=e.top??1/0;for(let a of l.groups){let p=a.rows.filter(h=>D(e.stage,h));if(p.length===0)continue;if(d=!0,f<=0){i.push(c(` \u2026 +${p.length} more ${a.label}`));continue}let o=p.slice(0,f),m=p.length-o.length;if(f-=o.length,(a.key==="needs-scenarios"||a.key==="happy-only")&&o.length===1&&o[0].ref===l.slug){i.push(` ${a.label}${a.key==="needs-scenarios"?" \u2014 design from scratch":""}`),i.push(c(` \u2192 ${o[0].ready_command}`));continue}let g=(a.suffix?` \u2014 ${a.suffix}`:"")+(a.alsoNeedsTests?" \u2014 also needs tests":"");if(i.push(` ${a.label} (${p.length})${g}`),a.rosterCommand&&a.key!=="failing"&&a.key!=="blocked")Se(i,o,r),i.push(c(` \u2192 ${a.rosterCommand}`));else for(let h of o)Te(i,h,a.key,c);m>0&&i.push(c(` \u2026 +${m} more ${a.label}`))}}return!d&&e.ucs.every(l=>l.groups.every(f=>f.rows.filter(a=>D(e.stage,a)).length===0))&&i.push(" nothing owed \u2014 design and execution are square"),i.push(""),i.push(c(" metric: live verifies edges \xB7 high \xD73 \xB7 staleness shown, not discounted")),n?i.push(c(` proven: graph execution facts \xB7 latest run ${n.latest_run?.started_at??"\u2014"} \xB7 ${n.aspect} formula verbatim`)):i.push(c(" proof: no runs recorded yet \u2014 run tests, then re-run")),i}function we(e,t,s){let n=F(e.slug);if(!t){let l=e.acTotal===0?"no scenarios yet":e.collapse||e.des.status==="complete"?`${e.acTotal} ACs \xB7 complete`:e.des.staleAcs>0?`${e.acTotal} ACs \xB7 ${e.des.staleAcs} stale`:`${e.acTotal} ACs \xB7 ${e.acTotal-e.acDesigned} unverified`,f=` ${e.mark} ${C(e.des.pct,10)} ${String(e.des.pct).padStart(3)}% ${n} `,a=Math.max(0,s-f.length-l.length-2);return`${f}${le(e.title,a).padEnd(a)} ${l}`}let r=e.provAbsent?"prov \xB7 not run":`prov ${C(e.prov?.pct??0,8)} ${String(e.prov?.pct??0).padStart(3)}%`,c=`des ${C(e.des.pct,8)} ${String(e.des.pct).padStart(3)}% \xB7 ${r}`,i=` ${e.mark} ${n} `,d=Math.max(0,s-i.length-c.length-2);return`${i}${le(e.title,d).padEnd(d)} ${c}`}function le(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}function Te(e,t,s,n){let r=F(t.id??t.ref);if(s==="failing"){let c=(t.via_tests??[]).map((d,l)=>`${F(d)}${t.viaFiles?.[l]?` ${t.viaFiles[l]}`:""}`).join(", ");e.push(` \u2717 ${r} ${t.title} \u2014 failed${c?` \xB7 via ${c}`:""}`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why it failed)`));let i=(t.viaFiles??[]).filter(d=>d!==null);i.length===1?e.push(n(` re-run after fixing: kane-cli testmd run ${i[0]} (heals on failure \u2014 fix the app first, or the test may re-author)`)):i.length>1&&e.push(n(" re-run after fixing: kane-cli testrun run (heals on failure \u2014 fix the app first, or the tests may re-author)"));return}if(s==="blocked"){e.push(` \u23F8 ${r} ${t.title} \u2014 (blocked \u2014 see why)`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why)`));return}e.push(` ${r} ${t.title} \u2014 ${t.why}`),e.push(n(` \u2192 ${t.ready_command}`))}function Se(e,t,s){let n=t.map(c=>`${F(c.id??c.ref)} ${de(c.title,4)}`),r=" ";for(let c of n){let i=r.trim().length?" \xB7 ":"";r.length+i.length+c.length>s&&r.trim().length?(e.push(r),r=" "+c):r+=i+c}r.trim().length&&e.push(r)}function ge(e){let{dc:t,pa:s}=e,n=r=>e.top!==void 0?r.slice(0,e.top):r;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(r=>({id:/^sha256:/.test(r.slug)?null:r.slug,title:r.title,risk:r.risk,design_completeness:{pct:r.des.pct,status:r.des.status},stale_acs:r.des.staleAcs,...s?{proven:r.prov??{pct:0,status:"not_run"}}:{},pending:n(r.groups.flatMap(c=>c.rows).filter(c=>D(e.stage,c))).map(ue)})),other:e.other.filter(r=>D(e.stage,r)).map(ue)}}function ue(e){let{servePath:t,viaFiles:s,meta:n,...r}=e;return{...r}}async function Ae(e){let t=await Q(e);return t.length===0?null:t.map(s=>({p:s,m:Re(s).mtimeMs})).sort((s,n)=>n.m-s.m)[0].p}async function Qe(e,t=ie(),s=process.cwd()){if(e.flat)return Ie(e,t,s);let n=e.stage??"all";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=e.aspect??"lenient";if(r!=="lenient"&&r!=="strict")return x(t,`--aspect must be lenient | strict, got '${r}'`),2;if(e.from)return x(t,"the tree reads the live graph \u2014 for a specific run's view use: kane-cli cover --from <pack> (legacy worklist: add --flat)"),2;let c=J(s,t);if(!c)return 2;let i=B(c),d=ne(i),l=ce(i,r),f=await K(i,"design"),a=new Map;if(l)for(let g of Object.values(l.perAc)){if(!g.executionId||a.has(g.executionId))continue;let h=await L(g.executionId,s);h&&a.set(g.executionId,h)}let p=new Map;for(let[g,h]of oe(re(s)))h.length===1&&p.set(g,j(h[0]));let o=pe(i,f,d,l,{stage:n,top:e.top,aspect:r,servePaths:a,testFiles:p});if(e.json)return t.out(JSON.stringify(ge(o),null,2)),0;if(d.usecases_complete==="0/0")return t.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let m=t.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let g of fe(o,{width:m,color:t.isTTY}))t.out(g);return 0}async function Ie(e,t,s){let n=e.stage??"design";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=J(s,t);if(!r)return 2;let c,i;if(n!=="design"){let a=e.from?await L(e.from,s):await Ae(s);if(!a)return x(t,e.from?`no evidence pack at '${e.from}'`:`--stage ${n} needs an evidence pack \u2014 run a test first, or pass --from <pack> (live view: drop --flat)`),2;let p=await Y(a,"coverage/usecases.yaml");if(p==null)return x(t,`${j(a)} carries no coverage/usecases.yaml \u2014 re-run the tests to produce a coverage-bearing pack`),2;let o=V(p);if(!o||!Array.isArray(o.usecases))return x(t,`${j(a)}: coverage/usecases.yaml is not a usecases document`),2;c=o,i=j(a)}let d=B(r),l=await K(d,n,void 0,c),f=l.length;if(e.top!==void 0&&(l=l.slice(0,e.top)),e.json){let a=l.map(p=>Pe(d,p));return t.out(JSON.stringify({stage:n,...i?{pack:i}:{},total:f,rows:a},null,2)),0}return t.out(`gaps \u2014 stage ${n}${i?` \xB7 pack ${i}`:""} (${l.length}${l.length<f?` of ${f}`:""})`),l.length===0&&t.out(" nothing owed \u2014 design and execution are square"),l.forEach((a,p)=>{t.out(` ${String(p+1).padStart(2)}. [${a.risk}] ${a.tag} ${a.ref} \u2014 ${a.why}`),t.out(` \u2192 ${a.ready_command}`)}),0}function Pe(e,t){let s=e.resolve(t.ref),n=s?e.tipOf(s.cid):null,r=n?e.getNode(n)?.content:null;return{...t,id:n?e.displayNameOf(n)??e.displayNameOf(s.cid):null,title:String(r?.title??r?.text??"")}}export{Qe as gapsCommand};
|
|
2
|
+
import{a as x,b as J,d as ie}from"./chunk-GRB66C5S.js";import{a as re,b as oe}from"./chunk-3RZ63RBO.js";import"./chunk-RN4OSVTG.js";import{a as X,b as Z,c as ee,d as te,e as ne,f as se}from"./chunk-FCMLIK7P.js";import{e as Q,f as L}from"./chunk-CJJXT5DO.js";import{a as I,b as W,c as M,d as K}from"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import{e as Y}from"./chunk-EHN5HTUD.js";import{a as V}from"./chunk-L5LI2JF4.js";import{a as B}from"./chunk-7E24OCGX.js";import"./chunk-FRBYGSGJ.js";import"./chunk-6W6AIDLJ.js";import"./chunk-6HYW5RFX.js";import"./chunk-J2KSZUOO.js";import{d as R,e as U}from"./chunk-5YPBPZUR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";import{basename as j}from"path";import{statSync as Re}from"fs";function ye(e,t){return e.length===0?"not_run":ee(e,t).verified?"proven":Z(e,t).some(n=>n.verdict==="failed")?"failing":"blocked"}function ce(e,t){let s=null;for(let{cid:p}of e.byLabel(R.TEST))for(let o of e.execHistory(p))(!s||String(o.started_at)>s.started_at)&&(s={execution_id:String(o.execution_id),started_at:String(o.started_at)});if(!s)return null;let n=X[t],r=se(e),c=te(r).aspects[t],i={},d={},l=0,f=0,a=0;for(let p of r.usecases){let o=[];for(let y of p.acceptance_criteria){let u=y.executions??[],_=ye(u,n);o.push(_),_==="failing"?l++:_==="blocked"?f++:_==="not_run"&&a++;let A=[],b;if(_==="failing"){let $=null;for(let P of y.covered_by){let w=e.execHistory(P).map(k=>({verdict:String(k.per_ac?.find(E=>E.ac_ref===y.id)?.verdict??k.verdict),oracle_mode:String(k.oracle_mode),ts:String(k.started_at),execution_id:String(k.execution_id)})).filter(k=>n.counted_verdicts.includes(k.verdict)&&n.accepted_oracle_modes.includes(k.oracle_mode)),O=w[w.length-1];O?.verdict==="failed"&&(A.push(P),(!$||O.ts>$.ts)&&($={ts:O.ts,execution_id:O.execution_id}))}b=$?.execution_id}else _==="blocked"&&(b=u[u.length-1]?.execution_id);i[y.id]={state:_,viaTests:A,...b?{executionId:b}:{}}}let m=o.some(y=>y!=="not_run"),g=c.usecases[p.id],h=m?g.status==="covered"?"proven":g.status==="partial"?"partial":o.includes("failing")?"failing":o.includes("blocked")?"blocked":"not_run":"not_run";d[p.id]={pct:g.pct,status:h}}return{aspect:t,pct:c.summary.coverage_pct,acs_proven:c.summary.acs_verified,failing:l,blocked:f,not_run:a,latest_run:s,perUc:d,perAc:i,config:{...n,source:"graph_execution_facts",denominator:"current_live_acs"}}}var be=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],_e={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},G={high:0,med:1,low:2};function q(e,t){let s=/^(.*?)(\d+)$/.exec(e),n=/^(.*?)(\d+)$/.exec(t);return s&&n&&s[1]===n[1]?Number(s[2])-Number(n[2]):e<t?-1:e>t?1:0}function F(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function de(e,t=5){let s=e.trim().split(/\s+/);return s.slice(0,t).join(" ")+(s.length>t?"\u2026":"")}function $e(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content:null;return String(n?.title??n?.text??"")}function ae(e,t){let s=e.resolve(t);return{id:s?e.displayNameOf(e.tipOf(s.cid))??e.displayNameOf(s.cid):null,title:de($e(e,t),8)}}function ke(e,t){let s=e.resolve(t);if(!s)return null;let n=e.tipOf(s.cid);if(!I(e,n))return null;let r=e.nodeLabel.get(n);if(r===R.USECASE)return n;if(r===R.AC)return M(e,n);if(r===R.TEST){let c=e.edgesFrom(n).find(d=>d.type===U.VERIFIES&&I(e,d.dst));if(c)return M(e,c.dst);let i=e.edgesFrom(n).find(d=>d.type===U.AUTOMATES&&I(e,d.dst));if(i){let d=e.edgesFrom(i.dst).find(l=>l.type===U.BELONGS_TO&&I(e,l.dst));return d?d.dst:null}}return null}function N(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function xe(e,t){let s=e.resolve(t),n=s?e.getNode(e.tipOf(s.cid))?.content.risk:null;return n==="high"||n==="med"||n==="low"?n:"med"}function pe(e,t,s,n,r){let c=r.servePaths??new Map,i=e.byLabel(R.USECASE).filter(({cid:o})=>I(e,o)),d=new Map(i.map(o=>[o.cid,o])),l=new Map(i.map(({cid:o})=>[o,[]])),f=[];for(let o of t){if(o.stage!=="design")continue;let m={...o,...ae(e,o.ref)},g=ke(e,o.ref),h=g?l.get(g):void 0;h&&N(o)!=="other"?h.push(m):f.push(m)}let a=new Map(i.map(({cid:o})=>[o,{total:0,designed:0}]));for(let{cid:o}of e.byLabel(R.AC)){if(!I(e,o))continue;let m=M(e,o),g=m?a.get(m):void 0;if(!g)continue;g.total++;let h=W(e,o);if(h&&g.designed++,!n)continue;let y=e.nameOf.get(o)??o,u=n.perAc[y];if(!u)continue;let{id:_,title:A}=ae(e,y),b={ref:e.displayNameOf(o)??o,id:_,title:A,risk:xe(e,y),stage:"cover"},$=l.get(m);u.state==="failing"?$.push({...b,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",via_tests:u.viaTests,...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{},...r.testFiles?{viaFiles:u.viaTests.map(P=>r.testFiles.get(P)??null)}:{}}):u.state==="blocked"?$.push({...b,kind:"execution-blocked",tag:"reuse-candidate",why:"the formula could count no run \u2014 broken/skipped or an unaccepted oracle",ready_command:u.executionId&&c.has(u.executionId)?`kane-cli evidence serve ${c.get(u.executionId)}`:"kane-cli testrun run",...u.executionId?{execution_id:u.executionId}:{},...u.executionId&&c.has(u.executionId)?{servePath:c.get(u.executionId)}:{}}):u.state==="not_run"&&h&&$.push({...b,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let p=[];for(let{cid:o,content:m}of i){let g=e.displayNameOf(o)??o,h=e.nameOf.get(o)??o,y=s.perUc[g]??{pct:0,status:"undesigned",staleAcs:0},u=n?n.perUc[h]??{pct:0,status:"not_run"}:null,_=n!==null&&(u===null||u.status==="not_run"),A=a.get(o),b=l.get(o)??[],$=new Set(b.filter(v=>N(v)==="needs-refresh").map(v=>v.ref)),P=b.some(v=>N(v)==="needs-tests"&&$.has(v.ref)),w=[];for(let v of be){let T=b.filter(S=>N(S)===v);if(v==="needs-tests"&&(T=T.filter(S=>!$.has(S.ref))),T.length===0)continue;T.sort((S,H)=>(G[S.risk]??3)-(G[H.risk]??3)||q(S.ref,H.ref));let ve=v==="failing"||v==="blocked"||T.length<=2||new Set(T.map(S=>S.ready_command)).size>1;w.push({key:v,label:_e[v],...v==="needs-refresh"?{suffix:"source moved since these were designed"}:{},alsoNeedsTests:v==="needs-refresh"&&P,rows:T,...ve?{}:{rosterCommand:T[0].ready_command}})}let O=w.some(v=>v.key==="failing"),k=w.some(v=>v.key==="blocked"),E=y.pct===100&&(n===null||u?.pct===100)&&w.length===0,me=u!==null&&u.pct>0,he=O?"\u2717":k?"\u23F8":E?"\u2714":y.pct===0&&!me?"\u2716":"\u25D0";p.push({slug:g,title:String(m.title??""),risk:String(m.risk??""),des:y,prov:u,provAbsent:_,acTotal:A.total,acDesigned:A.designed,mark:he,collapse:E,groups:w})}return p.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.slug,m.slug)),f.sort((o,m)=>(G[o.risk]??3)-(G[m.risk]??3)||q(o.ref,m.ref)),{stage:r.stage,aspect:r.aspect,top:r.top,dc:s,pa:n,ucs:p,other:f}}function C(e,t){let s=Math.round(e/100*t);return"\u2588".repeat(s)+"\u2591".repeat(t-s)}function z(e){return e===100?"\u2714":e>0?"\u25D0":"\u2716"}function D(e,t){return e==="all"||t.stage===e}function fe(e,t){let{dc:s,pa:n}=e,r=Math.max(80,Math.min(t.width,120)),c=l=>t.color?`\x1B[2m${l}\x1B[22m`:l,i=[];if(n){i.push(`coverage \u2014 designed \xD7 proven \xB7 live graph \xB7 aspect ${n.aspect}`),i.push("");let l=s.ucs_needing_scenarios;i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests`+(l>0?` \xB7 scenario debt: ${l} UC${l>1?"s":""}`:""));let f=[n.failing>0?`${n.failing} failing`:null,n.blocked>0?`${n.blocked} blocked`:null,n.not_run>0?`${n.not_run} not yet run`:null].filter(Boolean);i.push(` proven ${z(n.pct)} ${C(n.pct,10)} ${String(n.pct).padStart(3)}% \u2014 ${n.acs_proven} proven by execution`+(f.length?` \xB7 ${f.join(" \xB7 ")}`:""))}else i.push("AC design completeness \u2014 live graph (what design owes; execution proof not shown)"),i.push(""),i.push(` designed ${z(s.pct)} ${C(s.pct,10)} ${String(s.pct).padStart(3)}% \u2014 ${s.acs_designed} ACs have verifying tests \xB7 ${s.usecases_complete} UCs complete`),s.ucs_needing_scenarios>0&&i.push(` scenario debt: ${s.ucs_needing_scenarios} use-case${s.ucs_needing_scenarios>1?"s":""} need scenarios`),i.push(" proven \u2014 no runs recorded yet \xB7 run tests, then re-run");i.push("");let d=!1;for(let l of e.ucs){if(i.push(we(l,n!==null,r)),l.collapse)continue;let f=e.top??1/0;for(let a of l.groups){let p=a.rows.filter(h=>D(e.stage,h));if(p.length===0)continue;if(d=!0,f<=0){i.push(c(` \u2026 +${p.length} more ${a.label}`));continue}let o=p.slice(0,f),m=p.length-o.length;if(f-=o.length,(a.key==="needs-scenarios"||a.key==="happy-only")&&o.length===1&&o[0].ref===l.slug){i.push(` ${a.label}${a.key==="needs-scenarios"?" \u2014 design from scratch":""}`),i.push(c(` \u2192 ${o[0].ready_command}`));continue}let g=(a.suffix?` \u2014 ${a.suffix}`:"")+(a.alsoNeedsTests?" \u2014 also needs tests":"");if(i.push(` ${a.label} (${p.length})${g}`),a.rosterCommand&&a.key!=="failing"&&a.key!=="blocked")Se(i,o,r),i.push(c(` \u2192 ${a.rosterCommand}`));else for(let h of o)Te(i,h,a.key,c);m>0&&i.push(c(` \u2026 +${m} more ${a.label}`))}}return!d&&e.ucs.every(l=>l.groups.every(f=>f.rows.filter(a=>D(e.stage,a)).length===0))&&i.push(" nothing owed \u2014 design and execution are square"),i.push(""),i.push(c(" metric: live verifies edges \xB7 high \xD73 \xB7 staleness shown, not discounted")),n?i.push(c(` proven: graph execution facts \xB7 latest run ${n.latest_run?.started_at??"\u2014"} \xB7 ${n.aspect} formula verbatim`)):i.push(c(" proof: no runs recorded yet \u2014 run tests, then re-run")),i}function we(e,t,s){let n=F(e.slug);if(!t){let l=e.acTotal===0?"no scenarios yet":e.collapse||e.des.status==="complete"?`${e.acTotal} ACs \xB7 complete`:e.des.staleAcs>0?`${e.acTotal} ACs \xB7 ${e.des.staleAcs} stale`:`${e.acTotal} ACs \xB7 ${e.acTotal-e.acDesigned} unverified`,f=` ${e.mark} ${C(e.des.pct,10)} ${String(e.des.pct).padStart(3)}% ${n} `,a=Math.max(0,s-f.length-l.length-2);return`${f}${le(e.title,a).padEnd(a)} ${l}`}let r=e.provAbsent?"prov \xB7 not run":`prov ${C(e.prov?.pct??0,8)} ${String(e.prov?.pct??0).padStart(3)}%`,c=`des ${C(e.des.pct,8)} ${String(e.des.pct).padStart(3)}% \xB7 ${r}`,i=` ${e.mark} ${n} `,d=Math.max(0,s-i.length-c.length-2);return`${i}${le(e.title,d).padEnd(d)} ${c}`}function le(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}function Te(e,t,s,n){let r=F(t.id??t.ref);if(s==="failing"){let c=(t.via_tests??[]).map((d,l)=>`${F(d)}${t.viaFiles?.[l]?` ${t.viaFiles[l]}`:""}`).join(", ");e.push(` \u2717 ${r} ${t.title} \u2014 failed${c?` \xB7 via ${c}`:""}`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why it failed)`));let i=(t.viaFiles??[]).filter(d=>d!==null);i.length===1?e.push(n(` re-run after fixing: kane-cli testmd run ${i[0]} (heals on failure \u2014 fix the app first, or the test may re-author)`)):i.length>1&&e.push(n(" re-run after fixing: kane-cli testrun run (heals on failure \u2014 fix the app first, or the tests may re-author)"));return}if(s==="blocked"){e.push(` \u23F8 ${r} ${t.title} \u2014 (blocked \u2014 see why)`),t.servePath&&e.push(n(` \u2192 kane-cli evidence serve ${t.servePath} (see why)`));return}e.push(` ${r} ${t.title} \u2014 ${t.why}`),e.push(n(` \u2192 ${t.ready_command}`))}function Se(e,t,s){let n=t.map(c=>`${F(c.id??c.ref)} ${de(c.title,4)}`),r=" ";for(let c of n){let i=r.trim().length?" \xB7 ":"";r.length+i.length+c.length>s&&r.trim().length?(e.push(r),r=" "+c):r+=i+c}r.trim().length&&e.push(r)}function ge(e){let{dc:t,pa:s}=e,n=r=>e.top!==void 0?r.slice(0,e.top):r;return{stage:e.stage,rollup_version:1,design_completeness:{pct:t.pct,acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},...s?{proven:{aspect:s.aspect,pct:s.pct,acs_proven:s.acs_proven,failing:s.failing,blocked:s.blocked,not_run:s.not_run,latest_run:s.latest_run,config:s.config}}:{},usecases:e.ucs.map(r=>({id:/^sha256:/.test(r.slug)?null:r.slug,title:r.title,risk:r.risk,design_completeness:{pct:r.des.pct,status:r.des.status},stale_acs:r.des.staleAcs,...s?{proven:r.prov??{pct:0,status:"not_run"}}:{},pending:n(r.groups.flatMap(c=>c.rows).filter(c=>D(e.stage,c))).map(ue)})),other:e.other.filter(r=>D(e.stage,r)).map(ue)}}function ue(e){let{servePath:t,viaFiles:s,meta:n,...r}=e;return{...r}}async function Ae(e){let t=await Q(e);return t.length===0?null:t.map(s=>({p:s,m:Re(s).mtimeMs})).sort((s,n)=>n.m-s.m)[0].p}async function Qe(e,t=ie(),s=process.cwd()){if(e.flat)return Ie(e,t,s);let n=e.stage??"all";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=e.aspect??"lenient";if(r!=="lenient"&&r!=="strict")return x(t,`--aspect must be lenient | strict, got '${r}'`),2;if(e.from)return x(t,"the tree reads the live graph \u2014 for a specific run's view use: kane-cli cover --from <pack> (legacy worklist: add --flat)"),2;let c=J(s,t);if(!c)return 2;let i=B(c),d=ne(i),l=ce(i,r),f=await K(i,"design"),a=new Map;if(l)for(let g of Object.values(l.perAc)){if(!g.executionId||a.has(g.executionId))continue;let h=await L(g.executionId,s);h&&a.set(g.executionId,h)}let p=new Map;for(let[g,h]of oe(re(s)))h.length===1&&p.set(g,j(h[0]));let o=pe(i,f,d,l,{stage:n,top:e.top,aspect:r,servePaths:a,testFiles:p});if(e.json)return t.out(JSON.stringify(ge(o),null,2)),0;if(d.usecases_complete==="0/0")return t.out("nothing to measure yet \u2014 no live use-cases in the graph"),0;let m=t.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let g of fe(o,{width:m,color:t.isTTY}))t.out(g);return 0}async function Ie(e,t,s){let n=e.stage??"design";if(n!=="design"&&n!=="cover"&&n!=="all")return x(t,`--stage must be design | cover | all, got '${n}'`),2;if(e.top!==void 0&&(!Number.isInteger(e.top)||e.top<1))return x(t,"--top must be a positive integer"),2;let r=J(s,t);if(!r)return 2;let c,i;if(n!=="design"){let a=e.from?await L(e.from,s):await Ae(s);if(!a)return x(t,e.from?`no evidence pack at '${e.from}'`:`--stage ${n} needs an evidence pack \u2014 run a test first, or pass --from <pack> (live view: drop --flat)`),2;let p=await Y(a,"coverage/usecases.yaml");if(p==null)return x(t,`${j(a)} carries no coverage/usecases.yaml \u2014 re-run the tests to produce a coverage-bearing pack`),2;let o=V(p);if(!o||!Array.isArray(o.usecases))return x(t,`${j(a)}: coverage/usecases.yaml is not a usecases document`),2;c=o,i=j(a)}let d=B(r),l=await K(d,n,void 0,c),f=l.length;if(e.top!==void 0&&(l=l.slice(0,e.top)),e.json){let a=l.map(p=>Pe(d,p));return t.out(JSON.stringify({stage:n,...i?{pack:i}:{},total:f,rows:a},null,2)),0}return t.out(`gaps \u2014 stage ${n}${i?` \xB7 pack ${i}`:""} (${l.length}${l.length<f?` of ${f}`:""})`),l.length===0&&t.out(" nothing owed \u2014 design and execution are square"),l.forEach((a,p)=>{t.out(` ${String(p+1).padStart(2)}. [${a.risk}] ${a.tag} ${a.ref} \u2014 ${a.why}`),t.out(` \u2192 ${a.ready_command}`)}),0}function Pe(e,t){let s=e.resolve(t.ref),n=s?e.tipOf(s.cid):null,r=n?e.getNode(n)?.content:null;return{...t,id:n?e.displayNameOf(n)??e.displayNameOf(s.cid):null,title:String(r?.title??r?.text??"")}}export{Qe as gapsCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-
|
|
2
|
+
import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p as F,r as z,s as C,t as _,u as O,v as K}from"./chunk-ZP4S5WGW.js";import{b as k}from"./chunk-NJAHRITS.js";import{d as J}from"./chunk-MJBCBQC2.js";import{c as E}from"./chunk-ZNHXIRCM.js";import"./chunk-YSSTGJ7O.js";import"./chunk-TDPWFYTJ.js";import{a as q}from"./chunk-3AZTXJY4.js";import"./chunk-XZRIQ3GF.js";import"./chunk-4CJ55EUY.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import{m as x,n as A}from"./chunk-Y5RNCJAN.js";import"./chunk-5EOX4MEY.js";import{h as H}from"./chunk-POYZ6SAI.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as R}from"./chunk-KHJXOFDM.js";import"./chunk-VE3SUJMA.js";import{a as j}from"./chunk-LHDNJJGE.js";import"./chunk-MMPFU2YC.js";import"./chunk-UR6MHSHU.js";import{join as se}from"path";async function V(t){let e=t.projectId,n=t.folderId,r=null;if(!e&&t.autoResolve){let l=await t.resolver.resolve();if(!l)throw new $("unauthorized; run `kane-cli login`");let u=await H({creds:t.autoResolve.creds,config:t.autoResolve.config,profile:t.autoResolve.profile,env:t.autoResolve.envName,tmsCreds:{username:l.username,access_key:l.access_key},isLocal:!1,log:t.log});u.status==="ok"&&(e=u.projectId,n=n??u.folderId,u.autoDefaulted&&(r={projectId:u.autoDefaulted.projectId,projectName:u.autoDefaulted.projectName,folderId:u.autoDefaulted.folderId,folderName:u.autoDefaulted.folderName}))}return{baseUrl:`${t.env.testGeneratorBaseUrl}/test-generator/api/v2`,tmsBaseUrl:t.env.tmsBaseUrl,authResolver:t.resolver,projectId:e,folderId:n,suiteName:t.suiteName,autoDefaulted:r,log:t.log}}function Z(t){return t.reduce((e,n)=>e+(n.test_cases?.length??0),0)}var y=class{constructor(e=n=>process.stdout.write(n)){this.write=e}emit(e){this.write(JSON.stringify(e)+`
|
|
3
3
|
`)}onStart(e){this.emit({type:"generate_start",request_id:e.requestId,objective_chars:e.objectiveChars,scenario_limit:e.scenarioLimit,per_scenario_limit:e.perScenarioLimit,is_refine:e.isRefine})}onUpload(e){this.emit({type:"generate_upload",file:e.file,index:e.index,total:e.total,status:e.status})}onThinking(e){this.emit({type:"generate_thinking",took_ms:e.tookMs})}onProgress(e){this.emit({type:"generate_progress",pct:e})}onSnapshot(e){this.emit({type:"generate_snapshot",scenario_count:e.scenarios.length,case_count:Z(e.scenarios),scenarios:e.scenarios})}onClarification(e){this.emit({type:"generate_clarification",text:e})}onChat(e){this.emit({type:"generate_chat",text:e})}onError(e){this.emit({type:"error",message:e})}onSaveResult(e){this.emit({type:"generate_save_result",suite_dir:e.suiteDir,saved:e.saved,fell_back:e.fellBack,...e.warning?{warning:e.warning}:{}})}onDone(e){this.emit({type:"generate_done",request_id:e.requestId,status:e.status,scenario_count:e.scenarioCount,case_count:e.caseCount,refine_hint:e.refineHint,save_hint:e.saveHint,...e.suiteDir?{suite_dir:e.suiteDir}:{}})}onUpdateAvailable(e){this.emit({type:"update_available",current:e.current,latest:e.latest,severity:e.severity})}},S=class{constructor(e=n=>process.stdout.write(n)){this.write=e}onStart(e){let n=e.isRefine?"Refining":"Generating";this.write(`${n} (request ${e.requestId})\u2026
|
|
4
4
|
`)}onUpload(e){e.status==="uploading"&&this.write(` uploading ${e.file} (${e.index}/${e.total})
|
|
5
5
|
`)}onThinking(e){let n=e.tookMs?` (${Math.round(e.tookMs/1e3)}s)`:"";this.write(` thinking${n}
|
|
@@ -16,6 +16,6 @@ import{a as T,f as P,g as $,h as G,j as N,k as M,l as B,m as I,n as L,o as U,p a
|
|
|
16
16
|
`),this.write(` Save: ${e.saveHint}
|
|
17
17
|
`),e.suiteDir&&this.write(` Saved: ${e.suiteDir}
|
|
18
18
|
`)}onUpdateAvailable(e){this.write(`(update available: ${e.current} \u2192 ${e.latest})
|
|
19
|
-
`)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-
|
|
19
|
+
`)}};import{createHash as ee}from"crypto";function te(t){return ee("sha1").update(JSON.stringify({t:t.title,p:t.preconditions,m:t.manual_steps})).digest("hex")}function re(t){let e=[];for(let n of t.scenarios)for(let r of n.test_cases??[])I(r)&&r.manual_steps!=null&&e.push(r);return e}async function ne(t,e,n){let r=new Array(t.length),l=0,u=Array.from({length:Math.min(e,t.length)},async()=>{for(;;){let d=l++;if(d>=t.length)return;try{r[d]={ok:!0,value:await n(t[d])}}catch{r[d]={ok:!1}}}});return await Promise.all(u),r}async function Y(t,e,n){let r=re(t),l=n.run??(async(c,s)=>{let m=await n.resolveAuth(),o=U({objective:c,model:n.model,sessionId:n.sessionId,auth:m});return F(o,n.spawnOpts,s)}),u=r.map(te),d=[...new Set(u)],g=new Map;d.forEach(c=>{g.set(c,r[u.indexOf(c)])});let p=d.map(c=>g.get(c)),v=await ne(p,n.concurrency??3,c=>l(L(c))),i=new Map;d.forEach((c,s)=>{let m=v[s];m.ok&&i.set(c,m.value)});let f=new Map;r.forEach((c,s)=>{f.set(c.id,i.get(u[s]))});let a=0;for(let c of t.scenarios)for(let s of c.test_cases??[])I(s)&&!f.get(s.id)&&a++;let w=c=>{let s=f.get(c.id);return s?N(s,c):M(c)};return{...await B(t,e,{suiteName:n.suiteName,redirectBareCwd:!1},w),fellBack:a}}function Pe(t,e){let n=!!t.agent||!!t.refine||!!t.save||!e,r=t.agent?"agent":"plain";return{headless:n,mode:r}}function $e(t){return t.refine&&t.save?{error:"use --refine or --save, not both"}:t.save?t.objective?{error:"--save takes no objective; use --refine to add to a request"}:t.req?{op:"save"}:{error:"--save requires --req <id>"}:t.refine?t.req?t.objective?t.out?{error:"--out is only valid with --save"}:{op:"refine"}:{error:"--refine needs a refinement objective"}:{error:"--refine requires --req <id>"}:t.req?{error:"--req requires --refine or --save"}:t.out?{error:"--out is only valid with --save"}:t.objective?{op:"new"}:{error:"provide an objective, or use --refine/--save with --req"}}function ie(){return se(process.cwd(),".testmuai","tests")}function Ge(t){if(typeof t!="string")return;let e=t.split(",").map(n=>n.trim()).filter(Boolean);return e.length?e:void 0}var X="tcg-generate-headless";function Q(t){return{refineHint:`kane-cli generate "<refinement>" --refine --req ${t}`,saveHint:`kane-cli generate --save --req ${t}`}}function W(t){return t.scenarios.reduce((e,n)=>e+(n.test_cases?.length??0),0)}function oe(t){return t==="completed"?0:t==="stopped"?3:1}async function Ne(t,e){let n=e.write??(i=>process.stdout.write(i)),r=e.sink??(e.mode==="agent"?new y(n):new S(n)),l,u,d=null;try{let i=await e.makeClient();l=i.client,u=i.conn,d=i.autoDefaulted}catch(i){return r.onError(i.message),2}if(e.mode==="agent"&&d){let{buildAutoDefaultedNdjson:i}=await import("./require-project-folder-NQBZFUPF.js");n(i(d))}try{let i=await(e.checkUpdate??J)();i&&r.onUpdateAvailable(i)}catch{}let g=t.reqId??null;x(X,()=>{g&&l.cancel(g).catch(()=>{})});let p=process.cwd(),v={validate:e.validate??z,upload:e.upload??O,buildMappings:K,onUpload:i=>r.onUpload(i)};try{if(t.op==="save"){let s;try{s=(await l.attach(t.reqId)).state}catch(D){return r.onError(D.message),2}g=s.requestId,r.onSnapshot(s);let m=t.outDir??ie(),o=await e.materialize(s,m,t.suiteName);r.onSaveResult({suiteDir:o.suiteDir,saved:o.paths.length,fellBack:o.fellBack,warning:o.warning});let h=Q(s.requestId);return r.onDone({requestId:s.requestId,status:"completed",scenarioCount:s.scenarios.length,caseCount:W(s),refineHint:h.refineHint,saveHint:h.saveHint,suiteDir:o.suiteDir}),0}let i=t.op==="refine",f,a;if(i){let s;try{s=await l.attach(t.reqId)}catch(o){return r.onError(o.message),2}if(a=s.state,g=a.requestId,a.error)return r.onError(a.error),2;let m;try{m=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:a.scenarios,isRefine:!0,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of m.warnings)process.stderr.write(`warning: ${o}
|
|
20
20
|
`);r.onStart({requestId:a.requestId,objectiveChars:m.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!0});try{await l.chat(t.reqId,m.promptText,{mappings:m.mappings,attachments:m.attachments})}catch(o){return r.onError(o.message),2}f=s.events}else{let s;try{s=await _({promptText:t.objective,filePaths:t.files??[],cwd:p,scenarios:[],isRefine:!1,conn:u,deps:v})}catch(o){if(o instanceof C){for(let h of o.errors)r.onError(h);return 2}return r.onError(o.message),2}for(let o of s.warnings)process.stderr.write(`warning: ${o}
|
|
21
21
|
`);let m;try{m=await l.start({prompt:s.promptText,attachments:s.attachments,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,memoryEnhancement:t.memory})}catch(o){return r.onError(o.message),2}a=m.state,g=a.requestId,r.onStart({requestId:a.requestId,objectiveChars:s.promptText.length,scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit,isRefine:!1}),f=m.events}let w="";for await(let s of f){switch(a=P(a,s),s.type){case"thinking_done":r.onThinking({tookMs:s.tookMs});break;case"progress":r.onProgress(s.pct);break;case"clarification":r.onClarification(s.text);break;case"chat":r.onChat(s.text);break;case"error":r.onError(s.message);break;case"done":w=s.status;break;default:break}if(s.type==="done"||s.type!=="thinking"&&a.status&&T(a.status))break}r.onSnapshot(a);let b=w||a.status||"completed",c=Q(a.requestId);return r.onDone({requestId:a.requestId,status:b,scenarioCount:a.scenarios.length,caseCount:W(a),refineHint:c.refineHint,saveHint:c.saveHint,suiteDir:void 0}),oe(b)}finally{A(X)}}var ae=()=>{};async function Me(t){let e=new j,n=new q,r=e.getActiveProfile()??"default",l=t.env??e.getDefaultEnv()??"prod",u=R(l),d=new E;t.name&&d.setSessionName(t.name);let g=n.load().model,p=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}}),f=await V({resolver:i.resolver,env:u,log:ae,projectId:t.projectId,folderId:t.folderId,autoResolve:t.projectId?void 0:{creds:e,config:n,profile:r,envName:l}});return{client:G(f),conn:f,autoDefaulted:f.autoDefaulted??null}},v=async()=>{let i=await k({creds:e,env:l,usernameFlag:t.username,accessKeyFlag:t.accessKey,log:()=>{}});return i.basicAuth?{username:i.basicAuth.username,access_key:i.basicAuth.access_key}:i.token?{auth:{type:"bearer",token:i.token}}:{}};return{mode:t.mode,makeClient:p,materialize:(i,f,a)=>Y(i,f,{model:g,sessionId:d.sessionId,resolveAuth:v,spawnOpts:{environment:l},suiteName:a})}}export{Me as buildHeadlessDeps,Pe as decideGenerateMode,ie as defaultOutDir,Ge as parseFilesFlag,$e as resolveGenerateOp,Ne as runGenerateHeadless};
|