@testmuai/kane-cli 0.6.4 → 0.6.6
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/bin/kane-cli.cjs +91 -0
- package/bin/resolve-runtime.cjs +45 -0
- package/dist/{ChatSurface-VXYU6KFW.js → ChatSurface-LV3KW6WN.js} +1 -1
- package/dist/{ChromeProfilePicker-QWTM7DK6.js → ChromeProfilePicker-6PLUQ5TW.js} +1 -1
- package/dist/{CliFeedbackPrompt-6NVWMONO.js → CliFeedbackPrompt-I4F56IVK.js} +1 -1
- package/dist/{CliUploadProgress-2YRQLECI.js → CliUploadProgress-ULRSPKY3.js} +1 -1
- package/dist/{ConfigView-I4R5M7BO.js → ConfigView-7NMYALEA.js} +1 -1
- package/dist/{EvidenceViewOffer-54GEARRX.js → EvidenceViewOffer-KQKPTMXA.js} +1 -1
- package/dist/{FolderPicker-5VWBYTAK.js → FolderPicker-4IOVDO2P.js} +1 -1
- package/dist/{HelpView-OJZW4XWX.js → HelpView-SHMVMHNU.js} +1 -1
- package/dist/{InfoBox-TGELGCBR.js → InfoBox-W2LZVGQS.js} +1 -1
- package/dist/{LinksBox-B5EBRY26.js → LinksBox-ZS25VTBY.js} +1 -1
- package/dist/{ProfilesView-3SJRIBHQ.js → ProfilesView-XBBRIQ3U.js} +1 -1
- package/dist/{ProjectPicker-72HKMBEY.js → ProjectPicker-AUN47FXS.js} +1 -1
- package/dist/{SaveSessionPrompt-CK5SGNRO.js → SaveSessionPrompt-Z2K225VN.js} +1 -1
- package/dist/SingleShotApp-M7R5PW4X.js +2 -0
- package/dist/{SummaryBox-ABB7ST26.js → SummaryBox-4T545XRB.js} +1 -1
- package/dist/TestMdRunView-JXRXMACE.js +2 -0
- package/dist/{WhoamiView-OF354UGC.js → WhoamiView-GCVD35EX.js} +1 -1
- package/dist/{bind-BWILBZGR.js → bind-JLMT57Q3.js} +2 -2
- package/dist/{bridge-LNDJS3HH.js → bridge-PDJEOSAJ.js} +1 -1
- package/dist/{changelog-BWCEZQ23.js → changelog-D65HWZDM.js} +1 -1
- package/dist/{chunk-AXABTFCD.js → chunk-24OFJ7SE.js} +1 -1
- package/dist/{chunk-UZSG54OY.js → chunk-24VYAMMK.js} +1 -1
- package/dist/{chunk-6LRKYF67.js → chunk-262ES67I.js} +2 -2
- package/dist/{chunk-64QURIT6.js → chunk-2BWRAY3Y.js} +1 -1
- package/dist/{chunk-2K4XOHVK.js → chunk-2WO7G2HO.js} +1 -1
- package/dist/{chunk-BYUARJE7.js → chunk-32GP7KTM.js} +1 -1
- package/dist/{chunk-IRRGSC7B.js → chunk-3Z3UIW5H.js} +1 -1
- package/dist/{chunk-QNNBNIR7.js → chunk-4A6BLXQN.js} +2 -2
- package/dist/{chunk-ACEODVSC.js → chunk-4R2HOA7J.js} +1 -1
- package/dist/{chunk-XUJ5EPVW.js → chunk-4SXD6XWV.js} +1 -1
- package/dist/{chunk-ADOXYGZE.js → chunk-5JJ245FW.js} +1 -1
- package/dist/{chunk-OB6CKLEL.js → chunk-6CZIEK6B.js} +1 -1
- package/dist/{chunk-POI6DCP6.js → chunk-6NIV7AVZ.js} +1 -1
- package/dist/chunk-6SGPN76K.js +2 -0
- package/dist/{chunk-I2JUBAPU.js → chunk-6XHAXAL2.js} +1 -1
- package/dist/{chunk-DNOBOZPO.js → chunk-AKHUNBQS.js} +1 -1
- package/dist/{chunk-IOTJZTHX.js → chunk-BLSZ4H5W.js} +12 -12
- package/dist/{chunk-5KSB5MOF.js → chunk-BV5QKFMJ.js} +1 -1
- package/dist/{chunk-4MUHS3UL.js → chunk-C42WWO7Y.js} +1 -1
- package/dist/chunk-D7L6UW5Z.js +7 -0
- package/dist/{chunk-MVF4KRHA.js → chunk-EOLQUB4Q.js} +1 -1
- package/dist/{chunk-PYB2EXRE.js → chunk-EWTX7HSU.js} +2 -2
- package/dist/chunk-GLS46X7N.js +5 -0
- package/dist/{chunk-YI4XULHR.js → chunk-HA5GE57Z.js} +15 -15
- package/dist/{chunk-YMSN25DX.js → chunk-HWA7WD44.js} +1 -1
- package/dist/{chunk-3HEPW6SN.js → chunk-JF7Q2I45.js} +1 -1
- package/dist/{chunk-QZI43UNV.js → chunk-JTEY32TL.js} +1 -1
- package/dist/{chunk-HNE4TDOZ.js → chunk-JU5KRCKD.js} +4 -4
- package/dist/{chunk-ANIVHX3P.js → chunk-JV356AYH.js} +1 -1
- package/dist/{chunk-MK2G7VIF.js → chunk-KI2DVQSA.js} +1 -1
- package/dist/{chunk-DXK55KGR.js → chunk-KNCHEM6A.js} +1 -1
- package/dist/{chunk-CT2I5KUM.js → chunk-KYHXDJN4.js} +1 -1
- package/dist/{chunk-652FEDL4.js → chunk-L26LU6TU.js} +2 -2
- package/dist/{chunk-3WJJ43MT.js → chunk-LABIRPOT.js} +1 -1
- package/dist/{chunk-IXVR66NS.js → chunk-LEQ2B3PR.js} +1 -1
- package/dist/{chunk-WE57PD6K.js → chunk-LLS47HUA.js} +1 -1
- package/dist/{chunk-OLXOZJ7X.js → chunk-LURGFJEE.js} +1 -1
- package/dist/{chunk-5CTMOJG4.js → chunk-MSPZOEFB.js} +1 -1
- package/dist/{chunk-PICCLJSO.js → chunk-MY32TBBR.js} +1 -1
- package/dist/{chunk-STH6I3UB.js → chunk-N6DO2LBH.js} +1 -1
- package/dist/{chunk-O66EU5UV.js → chunk-OFEOWKM3.js} +1 -1
- package/dist/{chunk-BOO7YXAV.js → chunk-P4HW2NTZ.js} +1 -1
- package/dist/{chunk-CY5NDMO7.js → chunk-RIMJDJWY.js} +1 -1
- package/dist/{chunk-ZQP3MCZW.js → chunk-RV2NXHIC.js} +1 -1
- package/dist/{chunk-WT3SMSY5.js → chunk-S2C62SDY.js} +1 -1
- package/dist/{chunk-FV4LLU3T.js → chunk-UZJ7MRBV.js} +1 -1
- package/dist/{chunk-W36P7S5W.js → chunk-VBCE4U4B.js} +1 -1
- package/dist/{chunk-CLTANA4L.js → chunk-WJGBXJT4.js} +2 -2
- package/dist/{chunk-BNN6ZDJW.js → chunk-WWH7CW5R.js} +1 -1
- package/dist/{chunk-WFEGGQJ4.js → chunk-XQL53VB7.js} +1 -1
- package/dist/{config-OJF53CHL.js → config-6PAZZ7CR.js} +1 -1
- package/dist/{credentials-NLJHSVBY.js → credentials-BJCIWQWA.js} +1 -1
- package/dist/{evidence-UPOFW3XC.js → evidence-7VE5EGEF.js} +1 -1
- package/dist/{evolve-cmd-MVALOB3G.js → evolve-cmd-RUGUWKAG.js} +1 -1
- package/dist/{extract-bind-SSTKQGTV.js → extract-bind-YS7C4KZ3.js} +2 -2
- package/dist/{extract-cmd-GO4UV7ER.js → extract-cmd-Z4PMDIMZ.js} +1 -1
- package/dist/{generate-headless-2HYMSVN5.js → generate-headless-IWY32HC4.js} +2 -2
- package/dist/index.js +12 -12
- package/dist/{interactive-bind-Q5TQFQ6N.js → interactive-bind-ZIIJDRBU.js} +2 -2
- package/dist/{list-commands-6WDXAECV.js → list-commands-SSXJQGE7.js} +1 -1
- package/dist/login-flow-HRS6YACY.js +2 -0
- package/dist/{persist-recorded-session-KHIMN4A3.js → persist-recorded-session-3AOYZJT2.js} +1 -1
- package/dist/{pipeline-2HRAWT5U.js → pipeline-IZSODNCC.js} +1 -1
- package/dist/{reconcile-cmd-DH4VV6PG.js → reconcile-cmd-6HVZJFG3.js} +1 -1
- package/dist/{recording-banner-SADVYNEP.js → recording-banner-KKEUWS3N.js} +1 -1
- package/dist/{require-project-folder-LP7V26IU.js → require-project-folder-NPTKR2AW.js} +1 -1
- package/dist/{run-RT2VMPTQ.js → run-2A7M7EJK.js} +1 -1
- package/dist/{run-XAZMT7WO.js → run-6AFY35QW.js} +1 -1
- package/dist/{run-test-md-ATB2HZRG.js → run-test-md-QNC6KDMN.js} +2 -2
- package/dist/{skill-installer-DE2LSSKU.js → skill-installer-ULFNSE6X.js} +1 -1
- package/dist/{spawner-GOTVIFR5.js → spawner-DWONVIPI.js} +1 -1
- package/dist/tcg-generate-IHHPRVNG.js +2 -0
- package/dist/{testmd-actions-RYQHBX4K.js → testmd-actions-S3ZNOZEK.js} +1 -1
- package/dist/token-refresh-CFVOA62N.js +2 -0
- package/dist/{validate-basic-6BQ2L7TT.js → validate-basic-4OLDKIA2.js} +1 -1
- package/dist/{version-check-YW3FUWDH.js → version-check-UL4S6R4N.js} +1 -1
- package/dist/{walk-session-O4TMVORI.js → walk-session-N3BP57HK.js} +1 -1
- package/package.json +15 -7
- package/bin/kane-cli.js +0 -2
- package/dist/SingleShotApp-AJBIWW74.js +0 -2
- package/dist/TestMdRunView-5PMLLLFT.js +0 -2
- package/dist/chunk-E3BO7OVR.js +0 -7
- package/dist/chunk-HJGUEZLW.js +0 -2
- package/dist/chunk-IJPFAWBH.js +0 -5
- package/dist/login-flow-XQMJFC4H.js +0 -2
- package/dist/tcg-generate-7PUXJ5R4.js +0 -2
- package/dist/token-refresh-F5KRV7ER.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B,b as V,c as se}from"./chunk-
|
|
2
|
+
import{a as B,b as V,c as se}from"./chunk-EWTX7HSU.js";import{a as j,b as N}from"./chunk-32GP7KTM.js";import{a as ne,b as oe}from"./chunk-2YQ6TW77.js";import{a as C,b as Y,e as M,f as te,m as re}from"./chunk-RKWJG3WW.js";import{a as L}from"./chunk-VBCE4U4B.js";import{a as ee}from"./chunk-WAOCHXJ5.js";import{a as Z}from"./chunk-MY32TBBR.js";import{a as A}from"./chunk-RZ4F3BHX.js";import{a as H}from"./chunk-AKHUNBQS.js";import{a as O}from"./chunk-P4HW2NTZ.js";import{y as h}from"./chunk-6SGPN76K.js";import{a as F}from"./chunk-HCBYKLMW.js";import{a as k,b as g,i as Q}from"./chunk-C44QQJR4.js";import{a as X}from"./chunk-6YGTRKDT.js";import{e as v}from"./chunk-UR6MHSHU.js";var D=v(X(),1);import{existsSync as P,readFileSync as Je,rmSync as pe,unlinkSync as Ke}from"fs";import{resolve as G}from"path";import{promises as ie,realpathSync as ke}from"fs";import{homedir as be}from"os";import{join as q,parse as Te,relative as ae,resolve as ce}from"path";var le=new Set(["node_modules",".git","dist","build",".next",".venv","venv","target","__pycache__"]),R=class extends Error{constructor(s){super(`refusing to scan '${s}'. Run from your project root, or pass --root <dir>.`);this.cwd=s;this.name="HomeRefusedError"}};function ue(e){try{return ke(ce(e))}catch{return ce(e)}}function Ee(e){let r=ue(e),s=ue(be()),n=Te(r).root;if(process.platform==="win32"){let o=t=>t.toLowerCase();return o(r)===o(s)||o(r)===o(n)}return r===s||r===n}async function U(e){if(Ee(e.root))throw new R(e.root);let r=e.maxEntries??5e4,s=e.maxResults??5e3,n=new Set(e.ignore??[]),o=[],t=0,i=0,c=!1,f,l=[e.root];for(;l.length>0&&!c;){let a=l.shift(),m;try{m=await ie.readdir(a,{withFileTypes:!0})}catch{continue}i++;for(let b of m){if(t++,t>r){c=!0,f="max_entries";break}let w=b.name,E=q(a,w);if(b.isDirectory()){if(le.has(w)||w.startsWith(".")||w.startsWith("output-")||n.has(w))continue;l.push(E)}else if(b.isFile()&&w.endsWith("_test.md")&&(o.push({path:E,relPath:ae(e.root,E),source:"cwd"}),o.length>=s)){c=!0,f="max_results";break}}e.onProgress?.(i,o.length)}if(!c){let m=[{dir:q(e.root,".testmuai","tests"),depth:0}];for(;m.length>0&&!c;){let{dir:b,depth:w}=m.shift(),E;try{E=await ie.readdir(b,{withFileTypes:!0})}catch{continue}i++;for(let u of E){if(t++,t>r){c=!0,f="max_entries";break}let x=u.name,y=q(b,x);if(u.isDirectory()){if(w>=20||x.startsWith(".")||x.startsWith("output-")||le.has(x))continue;m.push({dir:y,depth:w+1})}else if(u.isFile()&&x.endsWith("_test.md")&&(o.push({path:y,relPath:ae(e.root,y),source:"tests-dir"}),o.length>=s)){c=!0,f="max_results";break}}}}return{results:o,aborted:c,abortReason:f,dirsScanned:i}}import{readFileSync as Se}from"fs";function W(e){try{return re(e,Se(e,"utf8")).global.tags??[]}catch{return[]}}import{mkdirSync as ve,writeFileSync as Re}from"fs";import{join as Pe}from"path";function de(e,r){return`Basic ${Buffer.from(`${e}:${r}`).toString("base64")}`}async function Me(e){let r=ne({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId,codeExport:{enabled:!0,language:e.language,skipValidation:e.skipValidation}}),s=await A(r.url,{method:"POST",headers:{"content-type":"application/json",authorization:de(e.auth.username,e.auth.access_key)},body:JSON.stringify(r.body)});if(!s.ok)throw new Error(`code-export trigger failed: ${s.status} ${await s.text()}`);e.log("info","CODE_EXPORT_TRIGGERED","Code export triggered",{testcase_id:e.testcaseId})}async function De(e){let r=oe({tmsBaseUrl:e.tmsBaseUrl,testcaseId:e.testcaseId}),s=e.pollIntervalMs??5e3,n=e.timeoutMs??3e5,o=Date.now()+n;for(;Date.now()<o;){let t=await A(r,{headers:{authorization:de(e.auth.username,e.auth.access_key),accept:"application/json"}});if(!t.ok){await new Promise(l=>setTimeout(l,s));continue}let c=(await t.json()).data?.find(l=>l.code_name==="kane-cli-trigger");if(!c){await new Promise(l=>setTimeout(l,s));continue}let f=(c.status??"").toLowerCase();if(f==="in progress"||f==="in_progress"||f==="pending"){await new Promise(l=>setTimeout(l,s));continue}if(!c.url||c.url.length===0)throw new Error(`code-export status=${c.status} but no files returned`);ve(e.outDir,{recursive:!0});for(let l of c.url){let a=Pe(e.outDir,l.file_name),m=await A(l.file_url);if(!m.ok){e.log("warn","CODE_EXPORT_FILE_FAILED","Failed to download file",{file_name:l.file_name,status:m.status});continue}let b=await m.text();Re(a,b,"utf-8")}return e.log("info","CODE_EXPORT_DOWNLOADED","Code export saved",{out_dir:e.outDir,file_count:c.url.length}),e.outDir}throw new Error("code-export polling timed out")}async function fe(e){return await Me(e),await De(e)}var T=v(X(),1);import{existsSync as $e,readFileSync as Ce}from"fs";var p=v(F(),1);function Ie(e){B(e);let r=M(e);if(!$e(r))return null;try{return JSON.parse(Ce(r,"utf8"))}catch{return{}}}function Fe(e){return e===null?"never_run":e.testcase_id?"synced":"local_only"}function Oe(e){return e==="synced"?"\u2601":e==="local_only"?"\u25A3":"\u25CB"}function Ae(e){return e==="tests-dir"?"\u2726":" "}function Le(e,r){return r==="all"?!0:r==="synced"?e.status==="synced":r==="local"?e.status==="local_only":r==="never_run"?e.status==="never_run":r==="cli"?e.source==="tests-dir":r==="hand"?e.source==="cwd":!0}var z=["all","synced","local","never_run","cli","hand"];function Be(e){let r=z.indexOf(e);return z[(r+1)%z.length]}function me({root:e,currentOrgId:r,onSelect:s,onCancel:n}){let[o,t]=(0,T.useState)([]),[i,c]=(0,T.useState)(null),[f,l]=(0,T.useState)(!0),[a,m]=(0,T.useState)("all");(0,T.useEffect)(()=>{(async()=>{try{let u=await U({root:e}),x=[];for(let y of u.results){let K=Ie(y.path);K?.org_id!==void 0&&K.org_id!==r||x.push({path:y.path,relPath:y.relPath,name:C(y.path),status:Fe(K),source:y.source,tags:W(y.path)})}t(x),l(!1)}catch(u){u instanceof R,c(u.message),l(!1)}})()},[e,r]);let b=(0,T.useMemo)(()=>o.filter(u=>Le(u,a)).map(u=>({id:u.path,label:`${Oe(u.status)} ${Ae(u.source)} ${u.relPath}${u.tags.length>0?` [${u.tags.join(", ")}]`:""}`})),[o,a]),w=(0,T.useMemo)(()=>Ne(a,o),[a,o]);if(i)return(0,p.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.red,paddingX:2,paddingY:1,children:[(0,p.jsx)(g,{color:h.red,bold:!0,children:"testmd"}),(0,p.jsx)(k,{marginTop:1,children:(0,p.jsx)(g,{color:h.red,children:i})})]});let E=a==="all"?"all":je(a);return(0,p.jsx)(Z,{title:`testmd \xB7 filter: ${E}`,items:b,loading:f,itemNoun:"tests",onSelect:u=>{let x=o.find(y=>y.path===u.id);x&&s(x)},onCancel:n,onTab:()=>m(u=>Be(u)),extraHint:"cycle filter",footer:w})}function je(e){return e==="synced"?"synced (\u2601)":e==="local"?"local (\u25A3)":e==="never_run"?"never run (\u25CB)":e==="cli"?"cli-generated (\u2726)":e==="hand"?"hand-written":"all"}function Ne(e,r){let s={synced:r.filter(o=>o.status==="synced").length,local:r.filter(o=>o.status==="local_only").length,never:r.filter(o=>o.status==="never_run").length,cli:r.filter(o=>o.source==="tests-dir").length,hand:r.filter(o=>o.source==="cwd").length},n=o=>o?h.orange:h.dim;return(0,p.jsxs)(k,{flexDirection:"column",children:[(0,p.jsx)(g,{color:h.dim,children:"legend:"}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(e==="synced"),children:` \u2601 synced (${s.synced}) `}),(0,p.jsx)(g,{color:n(e==="local"),children:`\u25A3 local (${s.local}) `}),(0,p.jsx)(g,{color:n(e==="never_run"),children:`\u25CB never run (${s.never})`})]}),(0,p.jsxs)(k,{children:[(0,p.jsx)(g,{color:n(e==="cli"),children:` \u2726 cli-generated (${s.cli}) `}),(0,p.jsx)(g,{color:n(e==="hand"),children:` hand-written (${s.hand})`})]})]})}var I=v(X(),1);import{existsSync as Ue,readFileSync as We}from"fs";var d=v(F(),1);function ge({path:e,relPath:r,onAction:s,onBack:n,onView:o}){let[t,i]=(0,I.useState)(null),[c,f]=(0,I.useState)(!1);(0,I.useEffect)(()=>{let a=M(e);if(Ue(a))try{i(JSON.parse(We(a,"utf8")))}catch{i(null)}},[e]),Q((a,m)=>{if(m.escape){if(c){f(!1);return}n();return}if(c){a==="y"||a==="Y"?(f(!1),s("delete")):(a==="n"||a==="N")&&f(!1);return}a==="r"&&s("run"),a==="e"&&t?.testcase_id&&s("export"),a==="d"&&f(!0),a==="v"&&o&&o()});let l=({k:a,v:m})=>m?(0,d.jsxs)(g,{children:[(0,d.jsx)(g,{color:h.dim,children:a.padEnd(14)}),m]}):null;return(0,d.jsxs)(k,{flexDirection:"column",borderStyle:"round",borderColor:h.orange,paddingX:2,paddingY:1,children:[(0,d.jsx)(g,{color:h.orange,bold:!0,children:r}),(0,d.jsx)(k,{marginTop:1,flexDirection:"column",children:t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(l,{k:"test_id",v:t.test_id}),(0,d.jsx)(l,{k:"testcase_id",v:t.testcase_id}),(0,d.jsx)(l,{k:"project_id",v:t.project_id}),(0,d.jsx)(l,{k:"folder_id",v:t.folder_id}),(0,d.jsx)(l,{k:"org_id",v:t.org_id}),(0,d.jsx)(l,{k:"session_name",v:t.session_name}),(0,d.jsx)(l,{k:"commit_id",v:t.commit_id})]}):(0,d.jsx)(g,{color:h.dim,children:"(never run \u2014 no meta.json)"})}),c?(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(g,{color:h.red,bold:!0,children:["Delete ",r," and its output dir? [y/n]"]})}):(0,d.jsx)(k,{marginTop:1,children:(0,d.jsxs)(g,{color:h.dim,children:["[r] run [e] export",t?.testcase_id?"":" (need testcase_id)"," [d] delete",o?" [v] view":""," [Esc] back"]})})]})}function $(e){B(e);let r=M(e);if(!P(r))return null;try{return JSON.parse(Je(r,"utf8"))}catch{return null}}function he(e,r){return!e||e.org_id===void 0?!0:e.org_id===r}function J(e,r){return he(e,r)?null:(process.stderr.write(`error: this test belongs to org ${e.org_id}; you are logged in as org ${r}.
|
|
3
3
|
Switch profiles with \`kane-cli profiles switch\` to act on it.
|
|
4
4
|
`),2)}async function Ut(e={}){let r=!!process.stdin.isTTY&&!e.json,s=new O,n=new L;await V({isInteractive:r,creds:s,config:n});let o=s.getDefaultEnv()??"prod";try{let t=await N({creds:s,env:o,log:()=>{}});return t.resolvedCreds?.org_id===void 0?(process.stderr.write("error: TMS did not return an org_id. Run `kane-cli login` again.\n"),{ok:!1,code:2}):{ok:!0,orgId:String(t.resolvedCreds.org_id)}}catch(t){if(t instanceof j)return process.stderr.write("error: not authenticated. Run `kane-cli login` first.\n"),{ok:!1,code:2};throw t}}async function Wt(e,r){if(process.stdin.isTTY&&!e.json)return await Ye(r,e.root);let s=e.root??process.cwd(),n;try{n=await U({root:s,ignore:e.ignore})}catch(o){if(o instanceof R)return process.stderr.write(`error: ${o.message}
|
|
5
5
|
`),2;throw o}for(let o of n.results){let t=$(o.path);if(!he(t,r))continue;let i={path:o.relPath.startsWith(".")?o.relPath:`./${o.relPath}`,name:C(o.path),has_meta:t!==null,source:o.source,synced:!!t?.testcase_id,tags:W(o.path)};t&&(t.test_id&&(i.test_id=t.test_id),t.testcase_id&&(i.testcase_id=t.testcase_id),t.org_id&&(i.org_id=t.org_id),t.project_id&&(i.project_id=t.project_id),t.folder_id&&(i.folder_id=t.folder_id)),process.stdout.write(JSON.stringify(i)+`
|
|
6
6
|
`)}return n.aborted&&process.stderr.write(`warn: walk aborted (${n.abortReason}). Pass --root or --ignore to narrow.
|
|
7
|
-
`),0}var _e=-1001,ye=-1002,we=-1003,_={action:null,path:null};function Xe(e,r){return _.action=e,_.path=r,e==="run"?_e:e==="export"?ye:we}function He({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(me,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(ge,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Xe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Ye(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:c}=n(D.default.createElement(He,{root:s,currentOrgId:e,onComplete:f=>{i(),t(f)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>t(0)).catch(()=>t(0))});if(o===_e&&_.path){let{runTestMdFile:t}=await import("./run-test-md-
|
|
7
|
+
`),0}var _e=-1001,ye=-1002,we=-1003,_={action:null,path:null};function Xe(e,r){return _.action=e,_.path=r,e==="run"?_e:e==="export"?ye:we}function He({root:e,currentOrgId:r,onComplete:s}){let[n,o]=D.default.useState({kind:"list"});return D.default.useEffect(()=>{n.kind==="exiting"&&s(n.code)},[n,s]),n.kind==="list"?D.default.createElement(me,{root:e,currentOrgId:r,onSelect:t=>o({kind:"inspect",path:t.path,relPath:t.relPath}),onCancel:()=>o({kind:"exiting",code:0})}):n.kind==="inspect"?D.default.createElement(ge,{path:n.path,relPath:n.relPath,onAction:async t=>{o({kind:"exiting",code:Xe(t,n.path)})},onBack:()=>o({kind:"list"})}):null}async function Ye(e,r){let s=r??process.cwd(),{render:n}=await import("./build-JIKYOZUH.js"),o=await new Promise(t=>{let{unmount:i,waitUntilExit:c}=n(D.default.createElement(He,{root:s,currentOrgId:e,onComplete:f=>{i(),t(f)}}),{stdout:process.stderr,exitOnCtrlC:!0});c().then(()=>t(0)).catch(()=>t(0))});if(o===_e&&_.path){let{runTestMdFile:t}=await import("./run-test-md-QNC6KDMN.js"),i=await t(_.path,{});return _.action=null,_.path=null,i}if(o===ye&&_.path){let t=await qe(_.path,{},e);return _.action=null,_.path=null,t}if(o===we&&_.path){let t=await Ve(_.path,!0,e);return _.action=null,_.path=null,t}return o}async function Jt(e,r){let s=G(e);if(!P(s))return process.stderr.write(`error: file not found: ${s}
|
|
8
8
|
`),2;let n=$(s),o=J(n,r);if(o!==null)return o;let t={path:s,name:C(s),has_meta:n!==null};return n&&(n.commit_id&&(t.commit_id=n.commit_id),n.test_id&&(t.test_id=n.test_id),n.testcase_id&&(t.testcase_id=n.testcase_id),n.project_id&&(t.project_id=n.project_id),n.folder_id&&(t.folder_id=n.folder_id),n.org_id&&(t.org_id=n.org_id),n.session_name&&(t.session_name=n.session_name)),process.stdout.write(JSON.stringify(t)+`
|
|
9
9
|
`),0}async function Ve(e,r,s){let n=G(e);if(!P(n))return process.stderr.write(`error: file not found: ${n}
|
|
10
10
|
`),2;let o=$(n),t=J(o,s);if(t!==null)return t;if(!r)return process.stderr.write(`error: refusing to delete without --yes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ue}from"./chunk-KHU7C6EE.js";import{a as Me,b as Ge}from"./chunk-3C5GMAM4.js";import{a as me,b as Te,c as Oe,d as Ie,g as Ne,h as je}from"./chunk-
|
|
2
|
+
import{a as Ue}from"./chunk-KHU7C6EE.js";import{a as Me,b as Ge}from"./chunk-3C5GMAM4.js";import{a as me,b as Te,c as Oe,d as Ie,g as Ne,h as je}from"./chunk-KNCHEM6A.js";import{a as qe,b as Fe,g as Be,h as Pe}from"./chunk-FXPPQL4D.js";import{a as Ae}from"./chunk-RE3BZVGE.js";import{b as Re,c as De}from"./chunk-WIA7TPK3.js";import{c as Ce}from"./chunk-6GTOYTCQ.js";import{a as Le}from"./chunk-6AYUSR7X.js";import{b as _e,c as be,d as ye,e as ee,f as J,g as re,h as ve,i as le}from"./chunk-FJTWJ243.js";import{a as de}from"./chunk-L5LI2JF4.js";import{a as Y}from"./chunk-MCQXRJGH.js";import{a as xe,b as ue}from"./chunk-ZZLR3O5A.js";import{e as $e,g as Ee}from"./chunk-ZG2V2ODK.js";import{d as S,e as E,f as we,g as Se,h as ke}from"./chunk-5YPBPZUR.js";import{mkdirSync as Et,appendFileSync as Rt}from"fs";import{randomBytes as Dt}from"crypto";import{join as ct}from"path";import{existsSync as ge,readFileSync as pe,readdirSync as dt}from"fs";import{join as te}from"path";var ze=`
|
|
3
3
|
version: 1
|
|
4
4
|
techniques:
|
|
5
5
|
- id: eqp
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{y as m}from"./chunk-6SGPN76K.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a as u,b as a,j as g}from"./chunk-C44QQJR4.js";import{a as b}from"./chunk-6YGTRKDT.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(u,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(u,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(a,{color:m.orange,children:[t.label,":"]}),(0,r.jsx)(a,{color:m.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as getEnvironment};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{a as CredentialsManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-
|
|
2
|
+
import{$ as fa,A as J,B as K,C as L,D as M,E as N,F as O,G as P,H as Q,L as R,M as S,N as T,O as U,P as V,Q as W,R as X,S as Y,T as Z,U as _,V as $,W as aa,X as ba,Y as ca,Z as da,_ as ea,a,aa as ga,b,ba as ha,c,ca as ia,d,e,f,g,h,i,j,k as t,l as u,m as v,n as w,o as x,p as y,q as z,r as A,s as B,t as C,u as D,v as E,w as F,x as G,y as H,z as I}from"./chunk-4A6BLXQN.js";import{a as n,b as o,c as p,e as q,f as r,g as s}from"./chunk-CJJXT5DO.js";import"./chunk-FJTWJ243.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import{a as k,b as l,c as m}from"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-AKHUNBQS.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";export{P as EvidenceSession,C as appendExecutionPointer,M as assembleExecutionEnv,i as buildEnvironment,j as buildEvidenceRunConfig,g as buildExternalId,z as buildLogsMetaYaml,y as buildResultYaml,t as buildRunYaml,O as createCdpBrowserCapture,u as createRunningPack,v as createRunningPackRoot,H as declareLogsFromDir,J as diagnostics,x as discardPack,ba as ensureAuteurExecution,N as fetchCdpBrowserString,L as finalizeEvidencePack,U as finalizeInlineEvidence,K as finalizeMemberTestLogs,da as flattenAuteurLeafIds,ca as flattenAuteurLeaves,T as inlineEvidenceBlock,q as listPacks,p as newExecutionId,h as normalizeOs,S as noteInlineSpawn,$ as offerEvidenceView,o as packPath,I as packTestLogsDir,V as parseRange,D as readExecutionPointers,ia as readPackLeafIds,ha as readPackLeaves,s as recoverStore,fa as remapReplayActionIds,r as resolvePack,ga as resolveReplayResultSteps,F as rollupTestStatus,aa as runEvidenceMerge,_ as runEvidenceServe,E as runEvidenceValidate,Q as runStartupRecovery,l as sealPack,w as sealPackById,Z as serveHint,d as shortHash,c as slugify,W as startEvidenceLocalServer,R as startInlineEvidence,n as storeDir,m as sweepStore,ea as synthesizeSkippedTail,f as testIdForInline,e as testIdForTestmd,k as validatePack,a as verdictFromResultCode,X as viewerBaseFor,Y as viewerUrlFor,b as worstOf,G as worstResultCode,B as writeLogsMeta,A as writeResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g}from"./chunk-JV356AYH.js";import"./chunk-3C5GMAM4.js";import"./chunk-GRB66C5S.js";import"./chunk-JFAFKHDX.js";import"./chunk-QPZRHAYK.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as D,e as h}from"./chunk-
|
|
2
|
+
import{d as D,e as h}from"./chunk-4R2HOA7J.js";import"./chunk-K5JGCJ2K.js";import"./chunk-KNCHEM6A.js";import"./chunk-FXPPQL4D.js";import"./chunk-RE3BZVGE.js";import"./chunk-6PS65QFF.js";import"./chunk-JFAFKHDX.js";import"./chunk-WIA7TPK3.js";import"./chunk-QPZRHAYK.js";import"./chunk-6GTOYTCQ.js";import{c as A}from"./chunk-YKTYVJBN.js";import"./chunk-6AYUSR7X.js";import"./chunk-427OQS2N.js";import{a as y}from"./chunk-LURGFJEE.js";import{d as C}from"./chunk-KYHXDJN4.js";import{c as E}from"./chunk-RN4OSVTG.js";import{a as P}from"./chunk-BC7UVJJB.js";import"./chunk-2PQXEEVY.js";import"./chunk-MCQXRJGH.js";import"./chunk-74RUSHIB.js";import"./chunk-ZZLR3O5A.js";import"./chunk-ZG2V2ODK.js";import"./chunk-5YPBPZUR.js";import"./chunk-6SGPN76K.js";import"./chunk-UR6MHSHU.js";async function j(n){let[{render:o},e,{QuestionBatchPrompt:i}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),c=e.default??e;return new Promise(t=>{let p=o(c.createElement(i,{questions:n,onSubmit:a=>{p.unmount(),t(a)}}))})}async function F(n,o){let[{render:e},i,{ReviewChecklist:c}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),t=i.default??i;return new Promise(p=>{let a=e(t.createElement(c,{items:n.map(u=>{let s=o.get(u.temp_ref);return{uc:u,dedupWith:s&&!s.archived?s.cid:void 0,archivedMatch:s?.archived?{cid:s.cid,reason:s.reason}:void 0}}),onSubmit:u=>{a.unmount(),p(u)}}))})}async function G(n){let{createInterface:o}=await import("readline/promises"),e=o({input:process.stdin,output:process.stdout});try{let i=await e.question(`${n} [y/N] `);return/^y(es)?$/i.test(i.trim())}finally{e.close()}}async function O(n){let o=await C(),e=P(process.cwd()),i=await A(o);if(!i.ok)return process.stderr.write((i.message??"error: turn-endpoint preflight failed")+`
|
|
3
3
|
`),2;let c=async()=>i;if(n.plan)return h(n,{contextDir:e,agent:y,preflightTurn:c,ask:j,review:F,confirmStale:G,out:l=>process.stdout.write(l+`
|
|
4
4
|
`),progress:l=>process.stderr.write(l+`
|
|
5
|
-
`),isTTY:E(),auth:o});let[{render:t},p,{ScrollbackProvider:a},{ChatSurface:u},{ScrollbackTap:s},{makeChatController:r},{setInkExit:w},x]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-
|
|
5
|
+
`),isTTY:E(),auth:o});let[{render:t},p,{ScrollbackProvider:a},{ChatSurface:u},{ScrollbackTap:s},{makeChatController:r},{setInkExit:w},x]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-LV3KW6WN.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-VAC57IEV.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-ADJJTDUT.js"),import("./descriptor-EHK3DRCZ.js"),import("./explain-VFIZTHFN.js"),import("./readmodel-XOGOELUP.js")])]),[{commitChatTurn:I},{topologyDescriptor:M},{explain:V},{openGraph:k}]=x,v=p.default??p,m=r({commitChatTurn:I,descriptor:M(),contextDir:e,refreshGraph:()=>k(e),graph:k(e),explain:V,by:{kind:"human",id:"owner"},dedupFlags:l=>D(l,k(e))}),T={current:null},S=0,b=null,f=!1,N=()=>{if(S+=1,S>=2){try{g.unmount()}catch{}process.exit(130)}m.requestPause(),b=setTimeout(()=>{f||(f=!0,(async()=>{m.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await T.current?.flush();try{g.unmount()}catch{}process.exit(130)})())},5e3)},g=t(v.createElement(a,null,v.createElement(s,{into:T}),v.createElement(u,{controller:m,verb:"extract",onCtrlC:N})),{exitOnCtrlC:!1});w(()=>g.unmount()),m.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let l=h(n,{contextDir:e,agent:y,preflightTurn:c,ask:d=>m.ask(d),review:async d=>new Map(d.map(R=>[R.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:d=>m.note(d),progress:()=>{},isTTY:E(),auth:o,chat:m});return l.finally(()=>{f=!0}),await l}finally{f=!0,b&&clearTimeout(b),await T.current?.flush();try{g.unmount()}catch{}}}async function U(n){let o=await C(),{makeHeadlessIO:e,resolveEncoding:i,guardedChannels:c}=await import("./headless-io-PWW6YKH2.js"),t=e(i(n.mode),"extract"),{makeInterruptGuard:p}=await import("./interrupt-guard-UREUWNRL.js"),a=p(y,r=>t.out(r)),s=c(t,()=>a.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let r=await h(n,{contextDir:P(process.cwd()),agent:a.agent,preflightTurn:()=>A(o),ask:async()=>[],review:async w=>new Map(w.map(x=>[x.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:s.out,emit:s.emit,progress:t.progress,isTTY:!1,auth:o});return a.interrupted()&&r!==3?(t.out("interrupted \u2014 no session saved"),t.done(130)):t.done(r)}catch(r){return t.event({type:"error",message:`error: extract failed: ${r instanceof Error?r.message:String(r)}`}),t.out(`error: extract failed: ${r instanceof Error?r.message:String(r)}`),t.out("hint: per-run trace logs live under .context/logs/ (extract-*.log)"),t.done(1)}finally{a.dispose()}}export{U as bindExtractHeadless,O as bindExtractInteractive};
|
|
@@ -3,4 +3,4 @@ import{a as s}from"./chunk-BC7UVJJB.js";import"./chunk-UR6MHSHU.js";import{exist
|
|
|
3
3
|
`),2;let n=async(r,t)=>{if(process.stderr.write(r+`
|
|
4
4
|
`),e.mode!=="agent")return 2;let{makeHeadlessIO:a,agentRefusal:c}=await import("./headless-io-PWW6YKH2.js");return c(a("ndjson","extract"),r,t)};if(e.apply)return n("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:r}=await import("./headless-io-PWW6YKH2.js"),t=r(e,"extract");if(t)return n(t)}if(!d(s(process.cwd())))return n("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
5
5
|
`),2;let i=e.mode??"interactive";if(i==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
6
|
-
`),2;let{bindExtractInteractive:r}=await import("./extract-bind-
|
|
6
|
+
`),2;let{bindExtractInteractive:r}=await import("./extract-bind-YS7C4KZ3.js");return r(e)}let{bindExtractHeadless:o}=await import("./extract-bind-YS7C4KZ3.js");return o({...e,mode:i})}export{l as extractCommand};
|
|
@@ -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-JU5KRCKD.js";import{b as k}from"./chunk-32GP7KTM.js";import{d as J}from"./chunk-JTEY32TL.js";import{c as E}from"./chunk-6XHAXAL2.js";import"./chunk-D7L6UW5Z.js";import{a as q}from"./chunk-VBCE4U4B.js";import"./chunk-EOLQUB4Q.js";import"./chunk-C42WWO7Y.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-L5LI2JF4.js";import{e as x,f as A}from"./chunk-M5JQXOCE.js";import{h as H}from"./chunk-2BWRAY3Y.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import{a as R}from"./chunk-AKHUNBQS.js";import"./chunk-VE3SUJMA.js";import{a as j}from"./chunk-P4HW2NTZ.js";import"./chunk-6SGPN76K.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-NPTKR2AW.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};
|