@smartkomm/plexus-cli 0.1.47 → 0.1.49
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/cli.mjs +2 -2
- package/dist/spec.snapshot.json +1 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -10455,7 +10455,7 @@ A task with --result closes only by recording it: freetext (text, always require
|
|
|
10455
10455
|
`),0)}},sS=class extends Qe{static{s(this,"PackageArchiveCommand")}static paths=[["generator","package","archive"]];static usage=T.Usage({category:"Contracts",description:"Archive a contract package \u2014 it creates no new contracts; its key stays taken",examples:[["Archive","$0 --env staging --tenant <slug> generator package archive <package-id>"]]});id=p.String({required:!0,name:"package-id"});async execute(){let{caller:t,client:n}=await this.loadContext();return await t.mutation(S.contractPackages.archive,{client:n,id:this.id}),this.print({archived:this.id}),0}},Pq="The file names the package and each part's generator by KEY: { key, name {de,en}, description {de,en}, inputSchema, parts [{ partKey, generator, position, optional, defaults, fixedValues }], source (the package code's .ts file, relative to the file, or null), scenarios [{ key, input, expected? }] }. A sealed revision equal to the file is left alone; otherwise the open draft \u2014 or a copy of the current revision \u2014 takes the file. A scenario without `expected` is evaluated on the draft and its output written into the file; apply then stops UNSEALED for review, and the next run seals.",aS=class extends Qe{static{s(this,"PackagePlanCommand")}static paths=[["generator","package","plan"]];static usage=T.Usage({category:"Contracts",description:"Compare a package file with the environment: create, same or revise (no write)",details:Pq,examples:[["Plan","$0 --env staging --tenant <slug> generator package plan --file ./package.json"]]});file=p.String("--file",{required:!0,description:"The package file (JSON)"});async execute(){let{caller:t,client:n}=await this.loadContext();return this.print(Lm((await Fm(t,n,Qx(this.file))).rows)),0}},lS=class extends Qe{static{s(this,"PackageApplyCommand")}static paths=[["generator","package","apply"]];static usage=T.Usage({category:"Contracts",description:"Create or revise a contract package from a file and seal it once its scenarios are reviewed",details:`${Pq} Exit code 1 while the run stopped for review.`,examples:[["First run: draft + scenario outputs into the file","$0 --env staging --tenant <slug> generator package apply --file ./package.json"],["After reviewing the file: seal","$0 --env staging --tenant <slug> generator package apply --file ./package.json"]]});file=p.String("--file",{required:!0,description:"The package file (JSON); reviewed scenario outputs are written into it"});async execute(){let{caller:t,client:n}=await this.loadContext(),r=await Oq(t,n,Qx(this.file));return this.print(r,i=>[...Lm(i.rows),{step:"result",target:i.revisionId??"\u2014",action:i.sealed?"sealed":"NOT sealed",detail:i.sealed?"":"review the written expected outputs, then run apply again"}]),r.sealed?0:1}};async function Mm(e){return await e.query(S.contractInputKeys.list,{})}s(Mm,"registry");var Dc="The registry is platform-wide (one vocabulary for every tenant) and needs a platform operator (_platform.config.manage). Every field a generator declares must be registered before the generator can be sealed. Entries are immutable: a key keeps its label, description and value type; a wrong one is deprecated and replaced by a new key.",dS=class extends C{static{s(this,"InputKeyListCommand")}static paths=[["platform","generator","input-key","list"],["generator","input-key","list"]];static usage=T.Usage({category:"Contracts",description:"List the contract input registry",details:Dc,examples:[["List","$0 --env staging generator input-key list"]]});async execute(){return this.print(await Mm(await this.caller()),t=>t.map(n=>({key:n.key,type:n.valueKind==="entity"?`entity:${n.entityKind}`:String(n.scalarType),label:n.label.de,deprecated:n.deprecatedAt===void 0?"":"yes"}))),0}},cS=class extends C{static{s(this,"InputKeyCreateCommand")}static paths=[["platform","generator","input-key","create"],["generator","input-key","create"]];static usage=T.Usage({category:"Contracts",description:"Register one contract input key (camelCase; an entity key ends in PartyId or LegalEntityId)",details:Dc,examples:[["A date",`$0 --env staging generator input-key create --key childBirthDate --label Geburtsdatum --label-en 'Date of birth' --description 'Geburtsdatum des Kindes' --description-en "The child's date of birth" --scalar date`],["A party reference","$0 --env staging generator input-key create --key payerPartyId --label Zahler --label-en Payer --description 'Wer zahlt' --description-en 'Who pays' --entity party"]]});key=p.String("--key",{required:!0,description:"camelCase key"});label=p.String("--label",{required:!0,description:"German label"});labelEn=p.String("--label-en",{required:!0,description:"English label"});description=p.String("--description",{required:!0,description:"German description"});descriptionEn=p.String("--description-en",{required:!0,description:"English description"});scalar=p.String("--scalar",{description:"Value type: string|number|boolean|date|enum|address"});entity=p.String("--entity",{description:"Entity reference: party|legalEntity"});async execute(){let t=Dm(this.scalar,this.entity),r=await(await this.caller()).mutation(S.contractInputKeys.create,{key:this.key,label:{de:this.label,en:this.labelEn},description:{de:this.description,en:this.descriptionEn},value:t});return this.print({id:r,key:this.key}),0}},uS=class extends C{static{s(this,"InputKeyDeprecateCommand")}static paths=[["platform","generator","input-key","deprecate"],["generator","input-key","deprecate"]];static usage=T.Usage({category:"Contracts",description:"Deprecate a contract input key by key \u2014 no new draft may use it; sealed revisions keep working",details:Dc,examples:[["Deprecate","$0 --env staging generator input-key deprecate --key childBirthDate"]]});key=p.String("--key",{required:!0,description:"The registered key"});async execute(){let t=await this.caller(),n=Rq(await Mm(t),this.key);return await t.mutation(S.contractInputKeys.deprecate,{id:n.id}),this.print({deprecated:this.key,alreadyDeprecated:n.deprecatedAt!==void 0}),0}},_q='The file is a JSON array of { key, label {de,en}, description {de,en}, value: { valueKind: "scalar", scalarType } | { valueKind: "entity", entityKind } }.',fS=class extends C{static{s(this,"InputKeyPlanCommand")}static paths=[["platform","generator","input-key","plan"],["generator","input-key","plan"]];static usage=T.Usage({category:"Contracts",description:"Compare an input-key file with the registry: create, same, differs, deprecated (no write)",details:`${Dc} ${_q}`,examples:[["Plan","$0 --env staging generator input-key plan --file ./input-keys.json"]]});file=p.String("--file",{required:!0,description:"The input-key file (JSON array)"});async execute(){let t=Yx(JSON.parse(await Kn(this.file,"utf8"))),n=Hx(t,await Mm(await this.caller()));return this.print(Lm(n)),n.some(Jx)?1:0}},pS=class extends C{static{s(this,"InputKeyApplyCommand")}static paths=[["platform","generator","input-key","apply"],["generator","input-key","apply"]];static usage=T.Usage({category:"Contracts",description:"Register every key of a file that is missing; refuse the whole file when one differs or is deprecated",details:`${Dc} ${_q} Nothing is written while any row differs from the registry or names a deprecated key.`,examples:[["Apply","$0 --env staging generator input-key apply --file ./input-keys.json"]]});file=p.String("--file",{required:!0,description:"The input-key file (JSON array)"});async execute(){let t=Yx(JSON.parse(await Kn(this.file,"utf8"))),n=await this.caller(),r=Hx(t,await Mm(n)),i=r.filter(Jx);if(i.length>0){for(let o of i)this.context.stderr.write(` \u2716 ${o.key}: ${o.detail}
|
|
10456
10456
|
`);return this.context.stderr.write(` \u2192 nothing registered (fix the file or choose new keys)
|
|
10457
10457
|
`),1}for(let[o,a]of t.entries())r[o]?.action==="create"&&await n.mutation(S.contractInputKeys.create,a);return this.print(Lm(r)),0}},Nq=[Xx,eS,tS,nS,rS,iS,oS,sS,aS,lS,dS,cS,uS,fS,pS];var qm=s(e=>new Date(e).toISOString().slice(0,10),"isoDay");function Km(e,t){return e.map(n=>({application:n.applicationId,classification:n.deleted?`${n.classification} (gel\xF6scht)`:n.classification,ended:qm(n.endedAt),due:qm(n.dueAt),test:n.testMode?"test":"",action:t}))}s(Km,"retentionRows");async function jm(e,t){return await e.query(S.retention.planDue,{client:t})}s(jm,"planRetention");async function Cq(e,t,n){let r=await jm(e,t);if(r.length!==n)throw new Error(`retention apply: ${r.length} Anmeldungen sind jetzt f\xE4llig, erwartet waren ${n} \u2014 nichts gel\xF6scht. Erst \`retention plan\` erneut lesen, dann mit der neuen Zahl best\xE4tigen.`);let i=[];for(let o of r){try{await e.mutation(S.retention.eraseDue,{client:t,applicationId:o.applicationId})}catch(a){throw new Error(`retention apply: ${o.applicationId} nicht gel\xF6scht (${a instanceof Error?a.message:String(a)}); davor gel\xF6scht: ${i.length} von ${r.length}${i.length===0?"":` (${i.map(l=>l.applicationId).join(", ")})`}.`,{cause:a})}i.push(o)}return i}s(Cq,"applyRetention");var Q3=50;function Bm(e,t){return e.map(n=>({party:n.partyId,name:`${n.name??"(ohne Namen)"}${n.deleted?" (gel\xF6scht)":""}`,due:n.deadline===null?"\u2014":qm(n.deadline),test:n.testMode?"test":"",action:n.blockedReason===null?t:`blocked: ${n.blockedReason.de}`}))}s(Bm,"partyRetentionRows");async function Um(e,t){let n=[],r=null;for(;;){let i=await e.query(S.partyRetention.planDue,{client:t,paginationOpts:{cursor:r,numItems:Q3}});for(let o of i.page){let a=await e.query(S.partyRetention.checkDue,{client:t,partyId:o.partyId});n.push({...o,testMode:a.testMode,blockedReason:o.blockedReason??a.blockedReason})}if(i.isDone)break;r=i.continueCursor}return n}s(Um,"planPartyRetention");async function Dq(e,t,n){let r=await Um(e,t),i=r.filter(a=>a.blockedReason===null);if(i.length!==n)throw new Error(`retention parties apply: ${i.length} Personen sind jetzt l\xF6schbar, erwartet waren ${n} \u2014 nichts gel\xF6scht. Erst \`retention parties plan\` erneut lesen, dann mit der neuen Zahl best\xE4tigen.`);let o=[];for(let a of i){try{await e.mutation(S.partyRetention.eraseDue,{client:t,partyId:a.partyId})}catch(l){throw new Error(`retention parties apply: ${a.partyId} nicht gel\xF6scht (${l instanceof Error?l.message:String(l)}); davor gel\xF6scht: ${o.length} von ${i.length}${o.length===0?"":` (${o.map(d=>d.partyId).join(", ")})`}.`,{cause:l})}o.push(a)}return r}s(Dq,"applyPartyRetention");var mS=["application","classification","ended","due","test","action"],hS=class extends C{static{s(this,"RetentionPlanCommand")}static paths=[["retention","plan"]];static usage=T.Usage({category:"Admission",description:"Read-only: the tenant's applications whose retention period has ended (what `retention apply --confirm` would erase)."});async execute(){let t=await this.caller(),n=await jm(t,this.requireTenant(t));return this.print(n,r=>Km(r,"would-erase"),mS),0}},gS=class extends C{static{s(this,"RetentionApplyCommand")}static paths=[["retention","apply"]];static usage=T.Usage({category:"Admission",description:"Erase (DSGVO redaction) every application of the tenant whose retention period has ended. Dry run unless --confirm; --confirm needs --expect <n>, the count `retention plan` showed."});confirm=p.Boolean("--confirm",!1,{description:"Actually erase (default: dry run)"});expect=p.String("--expect",{description:"With --confirm: how many applications you reviewed in `retention plan`; a different count erases nothing"});async execute(){let t=await this.caller(),n=this.requireTenant(t);if(!this.confirm)return this.print(await jm(t,n),r=>Km(r,"would-erase"),mS),0;if(this.expect===void 0||!/^\d+$/.test(this.expect))throw new Error("retention apply --confirm: --expect <n> fehlt \u2014 die Zahl der Anmeldungen, die `retention plan` gezeigt hat.");return this.print(await Cq(t,n,Number(this.expect)),r=>Km(r,"erased"),mS),0}},yS=["party","name","due","test","action"],wS=class extends C{static{s(this,"RetentionPartiesPlanCommand")}static paths=[["retention","parties","plan"]];static usage=T.Usage({category:"Stammdaten",description:"Read-only: the tenant's persons past its deletion rule, each with whether the hard delete may run (what `retention parties apply --confirm` would delete; blocked ones are skipped)."});async execute(){let t=await this.caller(),n=await Um(t,this.requireTenant(t));return this.print(n,r=>Bm(r,"would-erase"),yS),0}},kS=class extends C{static{s(this,"RetentionPartiesApplyCommand")}static paths=[["retention","parties","apply"]];static usage=T.Usage({category:"Stammdaten",description:"Hard-delete (with history and files) every person past the tenant's deletion rule that nothing blocks. Dry run unless --confirm; --confirm needs --expect <n>, the would-erase count `retention parties plan` showed."});confirm=p.Boolean("--confirm",!1,{description:"Actually delete (default: dry run)"});expect=p.String("--expect",{description:"With --confirm: how many deletable persons you reviewed in `retention parties plan`; a different count deletes nothing"});async execute(){let t=await this.caller(),n=this.requireTenant(t);if(!this.confirm)return this.print(await Um(t,n),r=>Bm(r,"would-erase"),yS),0;if(this.expect===void 0||!/^\d+$/.test(this.expect))throw new Error("retention parties apply --confirm: --expect <n> fehlt \u2014 die Zahl der l\xF6schbaren Personen, die `retention parties plan` gezeigt hat.");return this.print(await Dq(t,n,Number(this.expect)),r=>Bm(r,"erased"),yS),0}},Fq=[hS,gS,wS,kS];import{loadavg as c5}from"node:os";var Fc={add:{budgetMs:3e4},addFinance:{budgetMs:6e4},lean:{budgetMs:12e4,selects:{applicants:"none",finance:"none"}},financeCases:{budgetMs:18e4,selects:{applicants:"none",finance:"cases"}},financeFull:{budgetMs:3e5,selects:{applicants:"none",finance:"full"}},minimal:{budgetMs:45e4,selects:{applicants:"minimal",finance:"none"}},full:{budgetMs:6e5,selects:{applicants:"full",finance:"full"}}};function Lq(e){if(e.only)return null;for(let[t,n]of Object.entries(Fc))if(n.selects?.applicants===e.applicants&&n.selects.finance===e.finance)return t;return null}s(Lq,"seedShapeOf");var Mq={fullSeedMs:Fc.full.budgetMs,applicantCallsMs:4e4,driveWaitMs:75e3};var Kq=6e5,bS="drive:",Z3="driveWait:";function X3(e){return{drive:`${bS}${e}`,wait:`${Z3}${e}`}}s(X3,"driveTimingKeys");function jq(e){let t=e.perPhaseMs??{},n=[],r=s((o,a,l)=>{a>l&&n.push({over:a/l,line:`${o} ${qq(a)} > budget ${qq(l)}`})},"check");if(e.shape!==null){let o=Fc[e.shape].budgetMs;e.shape==="add"&&(o*=Math.max(1,e.addedCases??1)),e.shape==="addFinance"&&(o+=Fc.add.budgetMs*(e.addedCases??0)),r(`${e.shape} seed`,e.elapsedMs,o)}let i=0;for(let[o,a]of Object.entries(t)){if(!o.startsWith(bS))continue;let l=o.slice(bS.length),d=t[X3(l).wait]??0;i+=d,r(`applicant ${l}: own calls`,a-d,Mq.applicantCallsMs)}return e.shape==="full"&&r("drive waits on scheduled work",i,Mq.driveWaitMs),n.sort((o,a)=>a.over-o.over).map(o=>o.line)}s(jq,"seedBudgetBreaches");var qq=s(e=>`${(e/1e3).toFixed(1)} s`,"seconds");var vS=["none","cases","full"],Bq="finance";function Uq(e){return vS.includes(e)}s(Uq,"isFinanceShowcase");function xS(e){return e.financeShowcase!==void 0?e.financeShowcase:e.applicantKeys!==void 0&&e.applicantKeys.length>0?"none":"full"}s(xS,"resolveFinanceShowcase");async function SS(e){let t=e.now??Date.now,n=e.sleep??(d=>new Promise(c=>setTimeout(c,d))),r=e.maxConsecutiveFailures??5,i=`seed run ${e.runId}`,o=s(d=>`${Math.round(d/1e3)}s`,"seconds"),a=0,l="";for(;;){let d;try{d=e.poll(),a=0}catch(c){if(a++,a>=r){let u=c instanceof Error?c.message:String(c);throw new Error(`could not read the status of ${i} ${a} times in a row (it may still be running); last error: ${u}`,{cause:c})}}if(d===null)throw new Error(`${i} not found in seed_runs.`);if(d!==void 0){if(d.phase&&d.phase!==l&&(l=d.phase,e.onPhase(d.phase,d.elapsedMs)),d.status==="completed")return d;if(d.status==="failed")throw new Error(`${i} FAILED in phase "${d.phase??"?"}" after ${o(d.elapsedMs)} \u2014 ${d.error??"no error recorded"}`);if(d.status==="unknown")throw new Error(`${i} has no status (phase "${d.phase??"?"}").`);if(!d.live)throw new Error(`${i} is no longer live: its owner died in phase "${d.phase??"?"}" after ${o(d.elapsedMs)}. Rebuild explicitly (pnpm seed / pnpm seed:lean).`)}if(t()>=e.deadline){let c=e.budgetMs===void 0?"":` after ${o(e.budgetMs)}`;throw new Error(`timed out${c} waiting for ${i} (phase "${l||"?"}"; it may still be running \u2014 poll init/seed:seedStatus).`)}await n(e.pollMs)}}s(SS,"pollSeedRun");import{spawnSync as e5}from"node:child_process";import{closeSync as AS,ftruncateSync as t5,mkdirSync as n5,openSync as r5,readFileSync as i5,writeSync as o5}from"node:fs";import{homedir as s5}from"node:os";import Vq from"node:path";var a5=2;function Gq(e=process.env){let t=e.PLEXUS_SEED_SLOTS;if(t===void 0||t==="")return a5;if(!/^[1-9][0-9]*$/.test(t))throw new Error(`PLEXUS_SEED_SLOTS must be a positive integer, got '${t}'.`);return Number.parseInt(t,10)}s(Gq,"seedSlotCount");function zq(){return Vq.join(s5(),".cache","plexus","seed-slots")}s(zq,"seedSlotDir");function l5(e,t){return Vq.join(e,`slot-${t}.lock`)}s(l5,"slotFile");function d5(e){n5(e.dir,{recursive:!0});let t=[];for(let n=0;n<e.slots;n++){let r=l5(e.dir,n),i=r5(r,"a+"),o=e5("flock",["--nonblock","--exclusive","3"],{stdio:["ignore","ignore","pipe",i],encoding:"utf8"});if(o.error)throw AS(i),new Error(`seed slot: cannot run flock(1) \u2014 ${o.error.message}`);if(o.status===0){t5(i,0),o5(i,`${e.holder}
|
|
10458
|
-
`);let a=!1;return{index:n,release:s(()=>{a||(a=!0,AS(i))},"release")}}if(AS(i),o.status!==1)throw new Error(`seed slot: flock ${r} exited ${o.status} \u2014 ${(o.stderr??"").trim()}`);t.push(i5(r,"utf8").trim()||"unknown holder")}return{busy:t}}s(d5,"tryAcquireSeedSlot");async function Wq(e){let t=e.now??Date.now,n=e.sleep??(i=>new Promise(o=>setTimeout(o,i))),r="";for(;;){let i=d5(e);if("index"in i)return i;let o=`${i.busy.length} in use: ${i.busy.join(", ")}`;if(t()>=e.deadline)throw new Error(`no seed slot became free before the timeout (${o})`);let a=`waiting for a seed slot (${o})`;a!==r&&(e.onWait(a),r=a),await n(e.pollMs)}}s(Wq,"acquireSeedSlot");function Jq(){let e=process.cwd();for(;;){if(Ae(G.join(e,"convex")))return e;let t=G.dirname(e);if(t===e)throw new Error("plexus seed: no Convex project found above the current directory \u2014 run this from inside the worktree (e.g. the app/ dir).");e=t}}s(Jq,"findConvexProjectDir");function u5(e,t,n=!1,r){let i=["convex","run",e];t!==void 0&&i.push(t),n&&i.push("--push");let o=ZN("npx",i,{cwd:Jq(),encoding:"utf8",stdio:["ignore","pipe","pipe"],...r===void 0?{}:{timeout:r,killSignal:"SIGTERM"}});if(r!==void 0&&o.error?.code==="ETIMEDOUT"){let c=n?`functions push (convex run ${e} --push)`:`convex run ${e}`;throw new Error(`${c} did not finish within ${r/1e3}s (--push-timeout); nothing was seeded.`)}if(o.status!==0){let c=(o.stderr??"").trim();throw new Error(c||`convex run ${e} exited ${o.status}`)}let a=(o.stdout??"").trim();try{return JSON.parse(a)}catch{}let l=a.indexOf("{"),d=a.lastIndexOf("}");if(l<0||d<l)throw new Error(`convex run ${e}: no JSON in output:
|
|
10458
|
+
`);let a=!1;return{index:n,release:s(()=>{a||(a=!0,AS(i))},"release")}}if(AS(i),o.status!==1)throw new Error(`seed slot: flock ${r} exited ${o.status} \u2014 ${(o.stderr??"").trim()}`);t.push(i5(r,"utf8").trim()||"unknown holder")}return{busy:t}}s(d5,"tryAcquireSeedSlot");async function Wq(e){let t=e.now??Date.now,n=e.sleep??(i=>new Promise(o=>setTimeout(o,i))),r="";for(;;){let i=d5(e);if("index"in i)return i;let o=`${i.busy.length} in use: ${i.busy.join(", ")}`;if(t()>=e.deadline)throw new Error(`no seed slot became free before the timeout (${o})`);let a=`waiting for a seed slot (${o})`;a!==r&&(e.onWait(a),r=a),await n(e.pollMs)}}s(Wq,"acquireSeedSlot");function Jq(){let e=process.cwd();for(;;){if(Ae(G.join(e,"convex")))return e;let t=G.dirname(e);if(t===e)throw new Error("plexus seed: no Convex project found above the current directory \u2014 run this from inside the worktree (e.g. the app/ dir).");e=t}}s(Jq,"findConvexProjectDir");function u5(e,t,n=!1,r){let i=["convex","run",e];t!==void 0&&i.push(t),n&&i.push("--push","--typecheck","disable");let o=ZN("npx",i,{cwd:Jq(),encoding:"utf8",stdio:["ignore","pipe","pipe"],...r===void 0?{}:{timeout:r,killSignal:"SIGTERM"}});if(r!==void 0&&o.error?.code==="ETIMEDOUT"){let c=n?`functions push (convex run ${e} --push)`:`convex run ${e}`;throw new Error(`${c} did not finish within ${r/1e3}s (--push-timeout); nothing was seeded.`)}if(o.status!==0){let c=(o.stderr??"").trim();throw new Error(c||`convex run ${e} exited ${o.status}`)}let a=(o.stdout??"").trim();try{return JSON.parse(a)}catch{}let l=a.indexOf("{"),d=a.lastIndexOf("}");if(l<0||d<l)throw new Error(`convex run ${e}: no JSON in output:
|
|
10459
10459
|
${a}`);return JSON.parse(a.slice(l,d+1))}s(u5,"convexRun");function ES(){return c5().map(e=>e.toFixed(2)).join(" ")}s(ES,"loadAverage");var f5={convexRun:u5,now:Date.now,sleep:s(e=>new Promise(t=>setTimeout(t,e)),"sleep"),slotDir:zq,worktree:s(()=>G.basename(G.dirname(Jq())),"worktree")},Yq=Kq/1e3,TS=s((e,t)=>{if(!/^[1-9]\d*$/.test(t.trim()))throw new Error(`${e} takes a positive whole number of seconds, got '${t}'.`);return Number.parseInt(t,10)},"secondsOption"),Hq=s(e=>(e??"").split(",").map(t=>t.trim()).filter(t=>t.length>0),"splitList"),$S=class extends Se{static{s(this,"SeedCommand")}static paths=[["seed"]];static usage=T.Usage({category:"Operations",description:"Kick off the destructive local reseed and poll its run marker to completion.",details:`Which shape to seed for a task, what each costs and its budget: docs/engineering/seed-index.md.
|
|
10460
10460
|
|
|
10461
10461
|
Fires init/seed:kickoffSeed (returns immediately, holds a run-lock) and polls init/seed:seedStatus, printing live phase progress. Exit 0 on completed, 1 on failed. The client disconnect can no longer masquerade as a failure \u2014 the seed_runs marker is the only source of truth. Runs \`convex run\` in the current worktree (admin key), so invoke it from the app dir.
|
|
@@ -10524,6 +10524,6 @@ ${n.length} unusable ${o}:
|
|
|
10524
10524
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
10525
10525
|
`),i.length>0&&this.context.stdout.write(` ${i.length} without any login account \u2014 plexus-cli platform users provision --tenant <slug> --email <email> --name <name>
|
|
10526
10526
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
10527
|
-
`);return n.length>0?1:0}},UA=class extends nr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function SK(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(SK,"requireOnOff");var AK=[TA,$A,RA,IA,OA,PA,_A,NA,CA,DA,Lc,FA,LA,MA,qA,KA,jA,BA,UA];function EK(e){return e.de??e.en??Object.values(e)[0]??""}s(EK,"titleDe");function J5(e){return{id:e._id,kind:e.kind,status:e.status,title:EK(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(J5,"row");var Q5=["id","kind","status","title","assignee","group","outcome"],zA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(J5),Q5),0}},WA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:EK(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},YA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},HA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},JA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},TK=[zA,WA,YA,HA,JA];var Mc=[...O$,...v_,...C_,...VN,...UN,...gC,...SC,...xC,...vK,...AK,...bK,...Sq,...s_,...fC,...dK,...R$,...eR,...r_,...TC,...EC,...IC,...OC,...cC,...JN,...TK,...S0,...lM,...vq,...dM,...Qq,...oK,...Aq,...Nq,...Fq,...lK,...pK,...z$];for(let e of Mc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:QE(e.usage.category,t.join(" "))})}var $K="0.1.47";function RK(){return Mc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=WE[eo(n)];return{path:n,effect:to(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(RK,"plexusCommandCatalog");import Vo from"node:path";function Z5(e){let t=st()?.workspaceRoot??process.cwd(),n=Vo.resolve(t,e),r=Vo.relative(t,n);if(Vo.isAbsolute(e)||r===".."||r.startsWith(`..${Vo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Z5,"workspacePath");function X5(e){let{absolute:t,relative:n}=Z5(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of vr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Vo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Vo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return lt(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Ot(Vo.dirname(t),{recursive:!0}),lt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Yo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(X5,"plexusWorkspace");function IK(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Ua[n];if(!o||!Object.hasOwn(Ua,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(hg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:hg[i.path],skillHash:Nu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return X5(i)},"executePlexusAgentTool")}s(IK,"createPlexusAgentToolExecutor");var eh=IK({inspectCommand:PK,executeCommand:_K});function th(){let e=new Zo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:$K});e.register(Ta.HelpCommand),e.register(Ta.VersionCommand);for(let n of Mc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return nQ(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(th,"createPlexusCli");function nQ(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Pa[n]===r&&it(t,n,r),n in Pa&&to(n)==="confirm"&&!_a(e)&&t.write(`plexus-cli: \`${Pa[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
10527
|
+
`);return n.length>0?1:0}},UA=class extends nr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=T.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=p.String({required:!0});async execute(){let n=await(await this.caller()).mutation(S.platformAdmin.relinkAuthAccount,{email:this.email}),r=n.changed?`Relinked ${this.email} to live auth account ${n.authId}.`:`${this.email} already linked to the live auth account (no change).`;return this.report(n,r),0}};function SK(e,t){if(e===t)throw new Error("Pass exactly one of --on or --off.");return e}s(SK,"requireOnOff");var AK=[TA,$A,RA,IA,OA,PA,_A,NA,CA,DA,Lc,FA,LA,MA,qA,KA,jA,BA,UA];function EK(e){return e.de??e.en??Object.values(e)[0]??""}s(EK,"titleDe");function J5(e){return{id:e._id,kind:e.kind,status:e.status,title:EK(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(J5,"row");var Q5=["id","kind","status","title","assignee","group","outcome"],zA=class extends C{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=T.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=p.Boolean("--mine",!1,{description:"Only items assigned to me."});application=p.String("--application",{description:"Filter by application id."});group=p.String("--group",{description:"Filter by team (permission-group) id."});assignee=p.String("--assignee",{description:"Filter by assignee users._id."});openOnly=p.Boolean("--open-only",!1,{description:"Only open items."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.list,{client:n,...this.mine?{mine:!0}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(J5),Q5),0}},WA=class extends C{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=T.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=p.String({required:!0,name:"workItemId"});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.query(S.workItems.get,{client:n,workItemId:this.workItemId});if(r===null)throw new Error(`work-item ${this.workItemId} not found in tenant ${n}.`);return this.print(r,i=>[{field:"id",value:i._id},{field:"kind",value:i.kind},{field:"status",value:i.status},{field:"title",value:EK(i.title)},{field:"assignee",value:i.assigneeUserId??""},{field:"group",value:i.queueGroupId??""},{field:"application",value:i.applicationId??""},{field:"node",value:i.nodeId??""},{field:"outcome",value:i.outcome??""}]),0}},YA=class extends C{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=T.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=p.String("--title",{required:!0,description:"Task title."});description=p.String("--description",{description:"Task description."});application=p.String("--application",{description:"Link to an application id."});group=p.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=p.String("--assignee",{description:"Assignee users._id."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.createManual,{client:n,title:this.title,...this.description?{description:this.description}:{},...this.application?{applicationId:this.application}:{},...this.group?{queueGroupId:this.group}:{},...this.assignee?{assigneeUserId:this.assignee}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},HA=class extends C{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=T.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=p.String({required:!0,name:"workItemId"});outcome=p.String("--outcome",{description:"Outcome id to record."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.complete,{client:n,workItemId:this.workItemId,...this.outcome?{outcome:this.outcome}:{}});return this.print({workItemId:r.workItemId,status:"done"},i=>[{field:"workItemId",value:i.workItemId},{field:"status",value:i.status}]),0}},JA=class extends C{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=T.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=p.String({required:!0,name:"workItemId"});user=p.String("--user",{description:"Assignee users._id (omit to clear)."});async execute(){let t=await this.caller(),n=this.requireTenant(t),r=await t.mutation(S.workItems.assign,{client:n,workItemId:this.workItemId,...this.user?{userId:this.user}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},TK=[zA,WA,YA,HA,JA];var Mc=[...O$,...v_,...C_,...VN,...UN,...gC,...SC,...xC,...vK,...AK,...bK,...Sq,...s_,...fC,...dK,...R$,...eR,...r_,...TC,...EC,...IC,...OC,...cC,...JN,...TK,...S0,...lM,...vq,...dM,...Qq,...oK,...Aq,...Nq,...Fq,...lK,...pK,...z$];for(let e of Mc){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:QE(e.usage.category,t.join(" "))})}var $K="0.1.49";function RK(){return Mc.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=WE[eo(n)];return{path:n,effect:to(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(RK,"plexusCommandCatalog");import Vo from"node:path";function Z5(e){let t=st()?.workspaceRoot??process.cwd(),n=Vo.resolve(t,e),r=Vo.relative(t,n);if(Vo.isAbsolute(e)||r===".."||r.startsWith(`..${Vo.sep}`))throw new Error("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Z5,"workspacePath");function X5(e){let{absolute:t,relative:n}=Z5(e.path??".");if(e.operation==="list"){if(!Ae(t))return{files:[]};let r=[],i=s(o=>{for(let a of vr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new Error("plexus: workspace symlinks are not supported.");let l=Vo.join(o,a.name);if(a.isDirectory()?i(l):r.push(Vo.relative(t,l)),r.length>200)throw new Error("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new Error("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=ye(t);if(r.length>10*1024*1024)throw new Error("plexus: the workspace file exceeds 10 MB.");let i=new TextDecoder("utf-8",{fatal:!0}).decode(r);if(e.operation==="read"){let l=e.offset??0,d=e.maxChars??8e3,c=i.slice(l,l+d);return{path:n,content:c,...l||c.length<i.length?{offset:l,nextOffset:l+c.length<i.length?l+c.length:null,totalCharacters:i.length}:{}}}if(e.operation==="search"){if(!e.query)throw new Error("plexus: search needs a nonempty query.");let l=[],d=e.offset??0;for(;l.length<10;){let c=i.indexOf(e.query,d);if(c<0)break;l.push({offset:c,text:i.slice(Math.max(0,c-160),c+e.query.length+240)}),d=c+e.query.length}return{path:n,matches:l,nextOffset:l.length===10?d:null}}if(!e.oldText||typeof e.content!="string")throw new Error("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new Error("plexus: oldText must match exactly once. Read the current file and choose unique context.");let a=i.slice(0,o)+e.content+i.slice(o+e.oldText.length);if(Buffer.byteLength(a)>10*1024*1024)throw new Error("plexus: the edited file exceeds 10 MB.");return lt(t,a,"utf8"),{path:n,sizeBytes:Buffer.byteLength(a)}}if(e.operation==="write"){if(typeof e.content!="string"||Buffer.byteLength(e.content)>1e6)throw new Error("plexus: file content is missing or too large.");return Ot(Vo.dirname(t),{recursive:!0}),lt(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Yo(t),{path:n,removed:!0};throw new Error("plexus: unknown workspace operation.")}s(X5,"plexusWorkspace");function IK(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new Error("plexus: tool input must be an object.");let i=r,o=Ua[n];if(!o||!Object.hasOwn(Ua,n))throw new Error("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new Error("plexus: unexpected tool argument.");if(n==="plexus"){if(!Array.isArray(i.argv)||i.argv.some(a=>typeof a!="string")||i.stdin!==void 0&&typeof i.stdin!="string")throw new Error("plexus: invalid command input.");return e.inspectCommand(i.argv),e.executeCommand({argv:i.argv,...i.stdin===void 0?{}:{stdin:i.stdin}})}if(n==="plexus_skill"){if(typeof i.path!="string"||i.path.length>240||!Object.hasOwn(hg,i.path))throw new Error("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:hg[i.path],skillHash:Nu}}if(typeof i.operation!="string"||!["list","read","search","edit","write","remove"].includes(i.operation)||i.path!==void 0&&(typeof i.path!="string"||i.path.length>500)||i.content!==void 0&&(typeof i.content!="string"||i.content.length>1e6)||i.oldText!==void 0&&(typeof i.oldText!="string"||i.oldText.length>1e6)||i.query!==void 0&&(typeof i.query!="string"||!i.query.length||i.query.length>1e3)||i.offset!==void 0&&(typeof i.offset!="number"||!Number.isSafeInteger(i.offset)||i.offset<0)||i.maxChars!==void 0&&(typeof i.maxChars!="number"||!Number.isSafeInteger(i.maxChars)||i.maxChars<1||i.maxChars>24e3))throw new Error("plexus: invalid workspace input.");return X5(i)},"executePlexusAgentTool")}s(IK,"createPlexusAgentToolExecutor");var eh=IK({inspectCommand:PK,executeCommand:_K});function th(){let e=new Zo({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:$K});e.register(Ta.HelpCommand),e.register(Ta.VersionCommand);for(let n of Mc)e.register(n);async function t(n,r){let i;try{i=e.process(n,r)}catch(o){return(r.stderr??process.stderr).write(e.error(o,{colored:!1})),2}return nQ(i,r.stderr??process.stderr),e.run(i,r)}return s(t,"run"),{process(n,r){return e.process(n,r)},run:t,async runExit(n,r){process.exitCode=await t(n,r)}}}s(th,"createPlexusCli");function nQ(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Pa[n]===r&&it(t,n,r),n in Pa&&to(n)==="confirm"&&!_a(e)&&t.write(`plexus-cli: \`${Pa[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
10528
10528
|
`)}s(nQ,"noteRetiredPath");function PK(e){let t=th().process(ya(e),{executePlexusAgentTool:eh}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=RK().find(l=>l.path===n);if(!r){if(n===""||n==="--help"||n==="--version")return{path:n,writes:!1,host:"shared"};throw new Error(`plexus: command ${n} has no host classification.`)}let i=t,o=r.effect==="callKind"?wp(Js(Qs),i.fn??"",i.kind):void 0,a=bu(n,{confirm:_a(t),callKind:o});return{...r,writes:a}}s(PK,"inspectPlexusCommand");async function _K(e,t){if(t)return XA(t,()=>_K(e));if(!Array.isArray(e.argv)||e.argv.length===0||e.argv.length>128||e.argv.some(l=>typeof l!="string"||l.length>128e3)||(e.stdin?.length??0)>1e6)throw new Error("plexus: invalid command invocation.");let n="",r="",i=th();if(st()){let l=PK(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(ya(e.argv),{executePlexusAgentTool:eh,stdin:tQ.from(e.stdin===void 0?[]:[e.stdin]),stdout:new OK({write(l,d,c){n+=String(l),c()}}),stderr:new OK({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(_K,"executePlexusCommand");iE({source:rQ.join(import.meta.dirname,"skill")});th().runExit(ya(process.argv.slice(2)),{executePlexusAgentTool:eh});
|
|
10529
10529
|
//# sourceMappingURL=cli.mjs.map
|