@testmuai/kane-cli 0.4.7 → 0.4.9
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/{ChromeProfilePicker-HZP2G3K4.js → ChromeProfilePicker-BOTCHMXH.js} +1 -1
- package/dist/{CliFeedbackPrompt-FTEA5JNK.js → CliFeedbackPrompt-BV4VVYOY.js} +1 -1
- package/dist/{CliUploadProgress-3OPVLWXH.js → CliUploadProgress-Y4H43W5T.js} +1 -1
- package/dist/{ConfigView-NMRRHEMR.js → ConfigView-JPBD47MS.js} +1 -1
- package/dist/FolderPicker-M4RFRBYV.js +2 -0
- package/dist/{HelpView-RIRNOKNM.js → HelpView-ZZYE2TKZ.js} +1 -1
- package/dist/{InfoBox-AXNZSJME.js → InfoBox-3ZLQZGUE.js} +1 -1
- package/dist/{LinksBox-PYJZFOAG.js → LinksBox-UYMOQGSW.js} +1 -1
- package/dist/{ProfilesView-BVR2IFBT.js → ProfilesView-YUMYSOZ4.js} +1 -1
- package/dist/{ProjectPicker-3FZJ4RK3.js → ProjectPicker-CJVGBY42.js} +1 -1
- package/dist/{SaveSessionPrompt-INCEUNPR.js → SaveSessionPrompt-DFVUWTOK.js} +1 -1
- package/dist/SingleShotApp-IOEEYVGJ.js +2 -0
- package/dist/{SummaryBox-FMDQB4GN.js → SummaryBox-3VIRYWQA.js} +1 -1
- package/dist/TestMdRunView-MRSDDMSF.js +2 -0
- package/dist/{WhoamiView-JLEFXOHP.js → WhoamiView-GMM4V7ZV.js} +1 -1
- package/dist/{changelog-O5IX7XHA.js → changelog-FNJ4P2IF.js} +1 -1
- package/dist/{chunk-YVYIWAPJ.js → chunk-2J3VB6DW.js} +1 -1
- package/dist/{chunk-DPWUXRRO.js → chunk-3UCNDPTN.js} +1 -1
- package/dist/{chunk-GRFHOT5X.js → chunk-42WWGBRK.js} +1 -1
- package/dist/{chunk-ZHQVKKQZ.js → chunk-6PBX7QI7.js} +2 -2
- package/dist/chunk-7N5H4KTV.js +5 -0
- package/dist/{chunk-KWGOSWHO.js → chunk-7NTOV5DV.js} +1 -1
- package/dist/{chunk-QLSRT65Q.js → chunk-AH36DUIX.js} +1 -1
- package/dist/{chunk-YIZ6D6YX.js → chunk-CLRWPXDJ.js} +1 -1
- package/dist/{chunk-6F5KNQEY.js → chunk-CY4HAOSP.js} +1 -1
- package/dist/{chunk-ACIVGK3W.js → chunk-DKGNV3VP.js} +1 -1
- package/dist/{chunk-SX3MRVIA.js → chunk-DXJ5FL25.js} +1 -1
- package/dist/{chunk-AVEPDV55.js → chunk-FN6ZRV4C.js} +1 -1
- package/dist/{chunk-HFRJE27Y.js → chunk-FTMJTGT4.js} +1 -1
- package/dist/{chunk-7DJANARQ.js → chunk-GBTPZGJB.js} +1 -1
- package/dist/{chunk-2TAGK72D.js → chunk-HPJP7NES.js} +1 -1
- package/dist/{chunk-5QBGINQ5.js → chunk-HYOST7EA.js} +1 -1
- package/dist/{chunk-OXHG2VIS.js → chunk-IO3PBDKN.js} +1 -1
- package/dist/{chunk-5W225L2A.js → chunk-JBOXYLDH.js} +1 -1
- package/dist/{chunk-Y7Q7OG2K.js → chunk-JHSSBES2.js} +1 -1
- package/dist/{chunk-PI6BJEFB.js → chunk-JO3QZB6D.js} +2 -2
- package/dist/{chunk-4DRZNE2I.js → chunk-JQXARCVE.js} +1 -1
- package/dist/{chunk-PGKK7FRX.js → chunk-KLVCLGHX.js} +1 -1
- package/dist/{chunk-JSHGADRY.js → chunk-LJDFBQFR.js} +1 -1
- package/dist/{chunk-JPJFIOL7.js → chunk-LZUTY7XS.js} +1 -1
- package/dist/{chunk-JFSBM4Z2.js → chunk-MUZCEGJD.js} +1 -1
- package/dist/chunk-QMAHNXS6.js +8 -0
- package/dist/{chunk-WJRZKLUW.js → chunk-QW5G7TX3.js} +3 -3
- package/dist/{chunk-XBL2ZPYQ.js → chunk-RJFHOZG6.js} +1 -1
- package/dist/{chunk-YTWM34XC.js → chunk-SEU6OXMD.js} +1 -1
- package/dist/{chunk-VVPV3NA5.js → chunk-UJDIXFEE.js} +1 -1
- package/dist/{chunk-2H3DN3F5.js → chunk-UVBE3JJV.js} +1 -1
- package/dist/{chunk-KHDW3N76.js → chunk-VSJAOEBB.js} +1 -1
- package/dist/{chunk-467Q6LTP.js → chunk-WEPNJVBA.js} +1 -1
- package/dist/{chunk-V7ONIYZZ.js → chunk-WKJY6TRR.js} +1 -1
- package/dist/chunk-XA7UFTB7.js +27 -0
- package/dist/{chunk-NXAP7EWY.js → chunk-YK63DTUC.js} +2 -2
- package/dist/{generate-headless-J2Z5B3A5.js → generate-headless-ZRRQT56R.js} +2 -2
- package/dist/index.js +33 -33
- package/dist/{list-commands-UD7CKE46.js → list-commands-M3JL6XBB.js} +1 -1
- package/dist/login-flow-DOAIDKIV.js +2 -0
- package/dist/{persist-recorded-session-W44GRYTY.js → persist-recorded-session-3I4KMEXA.js} +1 -1
- package/dist/{recording-banner-I7W76JOM.js → recording-banner-P6EKDS2Y.js} +1 -1
- package/dist/{require-project-folder-R746X2BU.js → require-project-folder-SEMMD3EG.js} +1 -1
- package/dist/{run-test-md-NZ32YJC7.js → run-test-md-PXG4RFDI.js} +3 -3
- package/dist/{skill-installer-GXQ6LRHC.js → skill-installer-SU52XOIT.js} +1 -1
- package/dist/tcg-generate-5T6S2E7L.js +2 -0
- package/dist/testmd-actions-N7VS4FS6.js +2 -0
- package/dist/token-refresh-LSHPT46T.js +2 -0
- package/dist/{validate-basic-SYV4FFMJ.js → validate-basic-EKSOPOMF.js} +1 -1
- package/dist/{version-check-6EDCR423.js → version-check-4K4JHG7B.js} +1 -1
- package/package.json +6 -6
- package/dist/FolderPicker-3YHJUXE3.js +0 -2
- package/dist/SingleShotApp-QDTII55J.js +0 -2
- package/dist/TestMdRunView-FTWVR2DR.js +0 -2
- package/dist/chunk-DTFX3TMY.js +0 -27
- package/dist/chunk-PGBUS6CL.js +0 -8
- package/dist/chunk-RJW244F2.js +0 -5
- package/dist/login-flow-MCDTID4T.js +0 -2
- package/dist/tcg-generate-74IGNDXD.js +0 -2
- package/dist/testmd-actions-52KGXWZI.js +0 -2
- package/dist/token-refresh-4XAFVTGR.js +0 -2
|
@@ -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-JQXARCVE.js";import{d as J}from"./chunk-VSJAOEBB.js";import{b as k}from"./chunk-FTMJTGT4.js";import{c as E}from"./chunk-DXJ5FL25.js";import"./chunk-L5LI2JF4.js";import{a as q}from"./chunk-QMAHNXS6.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-7N5H4KTV.js";import{d as x,e as A}from"./chunk-LOIRZFV3.js";import{g as H}from"./chunk-LJDFBQFR.js";import"./chunk-LPUQ4HWQ.js";import"./chunk-NLCCBXXV.js";import"./chunk-VE3SUJMA.js";import"./chunk-FN6ZRV4C.js";import{a as j}from"./chunk-LZUTY7XS.js";import"./chunk-RJFHOZG6.js";import{a as R}from"./chunk-HPJP7NES.js";import"./chunk-RZ4F3BHX.js";import"./chunk-3UCNDPTN.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-SEMMD3EG.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};
|