@smartkomm/plexus-cli 0.1.340 → 0.1.342
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 -1
- package/dist/spec.snapshot.json +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -11467,6 +11467,7 @@ plexus-cli --env prod jobs list --status running # nothing unexpectedly in
|
|
|
11467
11467
|
- Command reference: \`plexus-cli jobs list --help\`, \`plexus-cli platform workers reap --help\`,
|
|
11468
11468
|
\`plexus-cli platform imports cleanup-orphaned --help\`.
|
|
11469
11469
|
`,"references/worker-ops/set-import-default-unit.md":"# Set the default unit of an import source\n\n**When to use:** a unit that an import source uses as its default unit has to\ngo, or imported records should attach to another unit by default.\n`org unit delete` refuses the default unit of an import source\n(`[unit/importSourceDefault]`). Point the source at another unit first.\n\n## Prerequisites\n- **Auth:** a platform operator's token with `_platform.config.manage`. A\n school's own token is refused, because the import source belongs to the operator.\n- **Env:** a writing run needs `--env <local|staging|prod>` on the command line,\n and `--allow-prod` against production.\n- You need the source key (`imports status --tenant <slug>`, column `config`)\n and the new unit's config key (`org tree`, column `key`).\n\n## Steps\n\n```bash\n# Plan: shows the current default and the new one, and writes nothing\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key>\n# Write\nplexus-cli --env prod --allow-prod platform imports source set-default-unit <source> --unit <unit-key> --confirm\n```\n\n## Verify\nRun the plan again. It reports `unchanged`, with the new unit as the default.\n\n## Idempotency / gotchas\n- The unit must be one the source already knows by key (every unit of the\n tenant at the time the source was set up). Otherwise the command refuses with\n `[import-source/unitUnknown]` and lists the keys the source knows.\n- Deleting any other unit removes it from the source's key list automatically.\n Only the default unit blocks a delete.\n- The tenant config names the default unit by key: `source.defaultUnitKey`\n (the order of `foundation.units` means nothing). `config export` writes the\n current default there, so an apply from a fresh export keeps it. **An apply\n from an export taken before this change names the old default and sets it\n back**; its plan shows an update on `source`. Export again after setting the\n default, or set `source.defaultUnitKey` in the scratch export by hand.\n- `config apply` refuses a source without `defaultUnitKey`\n (`[import/defaultUnitMissing]`) or with a key that is not in\n `foundation.units` (`[import/defaultUnitUnknown]`). There is no fallback to\n the first unit. An export taken before this change carries no key: add it before\n the apply.\n\n## Related\n- [Edit a school's organisation structure](../organization/edit-org-structure.md)\n- [Debug a stuck/failed import or worker job](./debug-worker-jobs.md)\n"};var wp="0742c30a369495cb9d51207e67e15f677a4f3a351c717421946c5b2e30d513be",Cw=T_;var VY=new Set(["ENOENT","ENOTDIR","EISDIR","EACCES","EPERM"]);function BY(e){return typeof e=="object"&&e!==null&&"code"in e?e.code:void 0}s(BY,"codeOf");function R_(e){return e instanceof Error?e.message:String(e)}s(R_,"messageOf");function Dw(e,t){try{return Ne(e)}catch(n){throw VY.has(BY(n))?new g(`${t}: ${e} is not readable (${R_(n)})`,{cause:n}):n}}s(Dw,"readBytesFile");function Fw(e,t){return Dw(e,t).toString("utf8")}s(Fw,"readTextFile");function ri(e,t){try{return JSON.parse(e)}catch(n){throw new g(`${t} is no JSON (${R_(n)})`,{cause:n})}}s(ri,"parseJsonText");function Be(e,t){return ri(Fw(e,t),`${t}: ${e}`)}s(Be,"readJsonFile");var Lw=class extends Ae{static{s(this,"AgentToolsCommand")}static paths=[["agent","tools"]];static usage=E.Usage({category:"Agents",description:"Show the shared platform/CLI agent tool schemas and skill revision."});async execute(){return this.print({skillHash:wp,tools:od}),0}},Mw=class extends Ae{static{s(this,"AgentInvokeCommand")}static paths=[["agent","invoke"]];static usage=E.Usage({category:"Agents",description:"Invoke a shared agent tool; pipe its JSON input on stdin."});tool=f.String("--tool",{required:!0,description:"plexus|plexus_skill|plexus_workspace"});async execute(){if("isTTY"in this.context.stdin&&this.context.stdin.isTTY===!0)throw new g("plexus: pipe the tool's JSON input on stdin.");let t=ri(await Pw(this.context.stdin),"stdin"),n=await this.context.executePlexusAgentTool(this.tool,t);return this.print(n),0}},$_=[Lw,Mw];var qw=[{key:"fixture_test",email:"test@example.com",firstName:"Test",lastName:"Bewerber"}],Dfe=new Set(qw.map(e=>e.key));var Ge=["de","en"];function sa(e,t){return Ge.every(n=>e[n]===t[n])}s(sa,"sameText");function Lt(e){if(e===null||typeof e!="object"||Array.isArray(e))return"not-localized";let t=e;return Object.keys(t).some(r=>!Ge.includes(r))?"not-localized":Ge.filter(r=>{let i=t[r];return typeof i!="string"||i.trim()===""})}s(Lt,"missingLocales");function co(e){let t=Lt(e);return t!=="not-localized"&&t.length===0}s(co,"isLocalizedText");function sd(e,t){let n={};for(let r of Ge){let i=e.map(o=>o[r]);n[r]=i.every(o=>typeof o=="string"&&o.trim()!=="")?t(i,r):""}return n}s(sd,"composeTexts");function kp(e){return e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}s(kp,"slugify");var E_="tenant";function I_(e){if(e.length===0||kp(e)!==e)return"must be lowercase a-z/0-9 words joined by single dashes";if(e===E_)return`"${E_}" is reserved for the tenant-wide scope`}s(I_,"unitSlugError");var UY=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function dr(e,t){return`${e}-${t}`}s(dr,"runStorageKey");function O_(e,t){typeof t!="string"&&de("CONFLICT",{de:`[run/keyNotServed] Das Deployment liefert f\xFCr ein Schuljahr von \u201E${e}\u201C keinen Schl\xFCssel \u2014 es l\xE4uft ein \xE4lteres Release als die CLI. Nach dem n\xE4chsten Release erneut versuchen.`,en:`[run/keyNotServed] The deployment provides no key for a school year of "${e}" \u2014 it runs an older release than the CLI. Try again after the next release.`});let n=`${e}-`;return(!t.startsWith(n)||t.length===n.length)&&de("CONFLICT",{de:`[run/foreignKey] Der Schl\xFCssel \u201E${t}\u201C des Schuljahrs liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${n}<key>\u201C).`,en:`[run/foreignKey] The key "${t}" of the school year is not under the program "${e}" (expected: "${n}<key>").`}),t.slice(n.length)}s(O_,"bareRunKey");function bp(e){let t=[],n=new Map;return e.forEach((r,i)=>{let o=Lt(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.runs[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?t.push({code:"run/nameMissing",index:i,message:{de:`[run/nameMissing] ${l}: jedes Schuljahr braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[run/nameMissing] ${l}: every run needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&t.push({code:"run/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){t.push({code:"run/keyMissing",index:i,message:{de:`[run/keyMissing] ${l}: jedes Schuljahr braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[run/keyMissing] ${l}: every run needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!UY.test(d)){t.push({code:"run/keyInvalid",index:i,message:{de:`[run/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[run/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=n.get(d);if(c!==void 0){t.push({code:"run/duplicateKey",index:i,message:{de:`[run/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.runs[${c}] verwendet`,en:`[run/duplicateKey] ${l}: key "${d}" is already used by program.runs[${c}]`}});return}n.set(d,i)}),t}s(bp,"runSpecIssues");var GY="-stufe-",zY=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Kw(e){return`${e}${GY}`}s(Kw,"stageKeyPrefix");function aa(e,t){return`${Kw(e)}${t}`}s(aa,"stageStorageKey");function N_(e,t){let n=Kw(e);return t.startsWith(n)&&t.length>n.length}s(N_,"isUnderProgram");function ii(e,t){let n=Kw(e);return N_(e,t)||de("CONFLICT",{de:`[stage/foreignKey] Der Stufenschl\xFCssel \u201E${t}\u201C liegt nicht unter dem Programm \u201E${e}\u201C (erwartet: \u201E${n}<key>\u201C). F\xFChren Sie die Stufe in bundle.yaml unter einem neuen Schl\xFCssel auf; der n\xE4chste Apply archiviert diese Zeile (hinter der Archivsperre) und legt die Stufe mit dem neuen Schl\xFCssel an.`,en:`[stage/foreignKey] The level key "${t}" is not under the program "${e}" (expected: "${n}<key>"). List the level in bundle.yaml under a new key; the next apply archives this row (behind the archive lock) and creates the level with the new key.`}),t.slice(n.length)}s(ii,"bareStageKey");function vp(e){let t=[],n=new Map;return e.forEach((r,i)=>{let o=Lt(r.name),a=o!=="not-localized"&&!o.includes("de")?r.name.de:void 0,l=`program.stages[${i}]${a!==void 0?` ("${a}")`:""}`;o==="not-localized"||o.length===2?t.push({code:"stage/nameMissing",index:i,message:{de:`[stage/nameMissing] ${l}: jede Klassenstufe braucht einen \`name\` auf Deutsch und Englisch (\`{ de, en }\`)`,en:`[stage/nameMissing] ${l}: every stage needs a \`name\` in German and English (\`{ de, en }\`)`}}):o.length>0&&t.push({code:"stage/nameUntranslated",index:i,message:{de:`[i18n/missingTranslation] ${l}.name fehlt in: ${o.join(", ")} \u2014 jeder angezeigte Text braucht Deutsch und Englisch.`,en:`[i18n/missingTranslation] ${l}.name is missing in: ${o.join(", ")} \u2014 every displayed text needs German and English.`}});let d=r.key;if(d==null||d===""){t.push({code:"stage/keyMissing",index:i,message:{de:`[stage/keyMissing] ${l}: jede Klassenstufe braucht einen stabilen \`key\` \u2014 der Name dient nur der Anzeige`,en:`[stage/keyMissing] ${l}: every stage needs a stable \`key\` \u2014 the name is display only`}});return}if(typeof d!="string"||!zY.test(d)){t.push({code:"stage/keyInvalid",index:i,message:{de:`[stage/keyInvalid] ${l}: der Schl\xFCssel ${JSON.stringify(d)} muss ein kleingeschriebener Slug sein (a-z, 0-9, einzelnes \u201E-\u201C)`,en:`[stage/keyInvalid] ${l}: key ${JSON.stringify(d)} must be a lowercase slug string (a-z, 0-9, single "-")`}});return}let c=n.get(d);if(c!==void 0){t.push({code:"stage/duplicateKey",index:i,message:{de:`[stage/duplicateKey] ${l}: der Schl\xFCssel \u201E${d}\u201C wird bereits von program.stages[${c}] verwendet`,en:`[stage/duplicateKey] ${l}: key "${d}" is already used by program.stages[${c}]`}});return}n.set(d,i)}),t}s(vp,"stageSpecIssues");function __(e){return{de:e.de.trim(),en:e.en.trim()}}s(__,"trimmedText");function WY(e,t){let n=[];return e.de!==t.de&&n.push(`"${e.de}" \u2192 "${t.de}"`),e.en!==t.en&&n.push(`en "${e.en}" \u2192 "${t.en}"`),n.join(", ")}s(WY,"describeNameChange");function xp(e,t,n){if(e===null)return t.length>0&&C("planStageReconcile: stages exist but the offer has no program key"),n.map((a,l)=>({op:"insert",key:a.key,name:__(a.name),...a.gradeLevel!==void 0?{gradeLevel:a.gradeLevel}:{},sequence:l+1}));let r=new Map(t.map(a=>[a.key,a])),i=new Set,o=[];n.forEach(({name:a,...l},d)=>{let c={...l,name:__(a)},u=aa(e,c.key);i.add(u);let p=d+1,h=r.get(u);if(h===void 0){o.push({op:"insert",key:c.key,name:c.name,...c.gradeLevel!==void 0?{gradeLevel:c.gradeLevel}:{},sequence:p});return}let y={};sa(h.name,c.name)||(y.name=[h.name,c.name]);let b=h.gradeLevel??null,k=c.gradeLevel??null;b!==k&&(y.gradeLevel=[b,k]),h.sequence!==p&&(y.sequence=[h.sequence,p]),(Object.keys(y).length>0||h.archived)&&o.push({op:"update",key:c.key,stageId:h.stageId,name:c.name,changes:y,unarchive:h.archived})});for(let a of[...t].sort((l,d)=>l.sequence-d.sequence))a.archived||i.has(a.key)||o.push({op:"archive",key:N_(e,a.key)?ii(e,a.key):a.key,stageId:a.stageId,name:a.name});return o}s(xp,"planStageReconcile");function Sp(e){switch(e.op){case"insert":return`+stage ${e.key} (${e.name.de})`;case"archive":{let t=e.occupancy,n=[...t&&t.activeApplications>0?[`REFUSED: ${t.activeApplications} active application(s) \u2014 [stage/hasActiveApplications]`]:[],...t&&t.openLeads>0?[`${t.openLeads} open lead(s)`]:[]];return`-stage ${e.key} (${e.name.de})${n.length>0?` \u2014 ${n.join("; ")}`:""}`}case"update":{let t=[];if(e.unarchive&&t.push("restored"),e.changes.name&&t.push(WY(e.changes.name[0],e.changes.name[1])),e.changes.gradeLevel){let[n,r]=e.changes.gradeLevel;t.push(`grade ${n??"\u2013"} \u2192 ${r??"\u2013"}`)}return e.changes.sequence&&t.push(`position ${e.changes.sequence[0]} \u2192 ${e.changes.sequence[1]}`),`~stage ${e.key} (${t.join(", ")})`}}}s(Sp,"describeStageStep");function Ap(e,t){return t.startsWith(e)&&t.length>e.length?t.slice(e.length):void 0}s(Ap,"bareUnder");function C_(e,t,n,r){let i=e.flatMap(y=>y.angebote).find(y=>y.offerKey===t);if(i===void 0){let y=e.flatMap(b=>b.angebote.map(k=>k.offerKey));throw new g(`applications start-test: no offer "${t}" (offers: ${y.join(", ")||"none"})`)}if(i.programKey===void 0)throw new g("applications start-test: the deployment does not serve the offer's program key \u2014 it runs an older release than the CLI; try again after the next release");let o=i.programKey;if(o===null)throw new g(`applications start-test: ${t} has no program yet \u2014 no level to start on`);let a=aa(o,""),l=dr(o,""),d=s(y=>Ap(a,y)??"(no bundle key)","stageLabel"),c=s(y=>Ap(l,y)??"(no bundle key)","runLabel"),u=i.stages.find(y=>y.stageKey===aa(o,r)||y.stageId===r);if(u===void 0){let y=i.stages.map(v=>`${d(v.stageKey)} (${v.stageId})`).join(", "),b=Ap(a,r),k=b!==void 0&&i.stages.some(v=>v.stageKey===r)?` \u2014 "${r}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no level "${r}" in ${t}${k} \u2014 name it by its bundle key or id: ${y}`)}let p=d(u.stageKey),h=u.runs.find(y=>y.runKey===dr(o,n)||y.runId===n);if(h===void 0){let y=u.runs.map(v=>`${c(v.runKey)} (${v.runId})`).join(", "),b=Ap(l,n),k=b!==void 0&&u.runs.some(v=>v.runKey===n)?` \u2014 "${n}" is the stored key; the export names it "${b}"`:"";throw new g(`applications start-test: no school year "${n}" for level ${p}${k} \u2014 name it by its bundle key or id: ${y}`)}if(!h.isOpen)throw new g(`applications start-test: school year ${c(h.runKey)} is closed for level ${p}`);return{programRunId:h.runId,programStageId:u.stageId}}s(C_,"resolveStartTarget");function YY(e){return e.kind==="named"?e.name:`(${e.standIn??e.fallback})`}s(YY,"applicantText");function D_(e){return e.map(t=>({id:t.application._id,status:t.deletedAt?`${t.application.status} (gel\xF6scht)`:t.application.status,state:t.currentProcessStateId??"",applicant:YY(t.applicantName),test:t.application.testMode===!0?"test":""}))}s(D_,"applicationRows");var P_=qw.map(e=>e.email);function F_(e,t,n,r){if(n===void 0&&r===void 0)throw new g("applications start-test: name the applicant \u2014 --party <partyId> or --applicant <email>");if(n!==void 0&&r!==void 0)throw new g("applications start-test: --party or --applicant, not both");if(Ow(e,t)&&(r===void 0||!P_.includes(r.trim().toLowerCase())))throw new g(`applications start-test: on prod only for the test account ${P_.join(", ")} (--applicant) \u2014 never a real family's`)}s(F_,"assertStartApplicant");function L_(e){let t={};for(let{address:n,...r}of e.entries)t[n]=r;return{applicationId:e.applicationId,store:t}}s(L_,"processStoreJson");function HY(e){switch(e.kind){case"form":return`form ${e.formInstanceId} (${e.state})`;case"document":return e.file===null?`document ${e.slotKey} (leer)`:`document ${e.slotKey} \xB7 v${e.file.versionNumber} ${e.file.filename??e.file.artifactId}`;case"contract":return`contract ${e.contractId} \xB7 ${e.revision===null?"keine Fassung":`Fassung ${e.revision.snapshotNumber}`} \xB7 ${e.contractStatus}`;case"contracts":return e.contracts.map(t=>`${t.partKey}: contract ${t.contractId} \xB7 ${t.revision===null?"keine Fassung":`Fassung ${t.revision.snapshotNumber}`} \xB7 ${t.contractStatus}`).join("; ")}}s(HY,"refText");function JY(e){return e.state!=="present"?e.reason?.de??"":e.ref!==void 0?HY(e.ref):JSON.stringify(e.value)}s(JY,"holds");function M_(e){return e.entries.map(t=>({address:t.address,state:t.state,holds:JY(t),producer:t.producer?.label??"",written:t.writtenAt===void 0?"":new Date(t.writtenAt).toISOString()}))}s(M_,"storeRows");function Tp(e){let t={},n={};for(let r of e){let i=r.indexOf("=");if(i<=0)throw new g(`Expected key=value, got '${r}'.`);let o=r.slice(0,i);if(Object.hasOwn(n,o))throw new g(`'${o}' is given twice.`);let a=r.slice(i+1);n[o]=a;try{t[o]=JSON.parse(a)}catch{t[o]=a}}return{values:t,raw:n}}s(Tp,"parseKv");var jw="started",Rp="submitted",$p="submitted",q_="load-scenario:";var K_="(Bewerbung)";function j_(e){return{nodeId:K_,actions:e.map(t=>({id:t.id,label:{de:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`,en:`${t.label??t.id}${t.count===void 0?"":` (${t.count})`}`},...t.disabledReason===void 0?{}:{disabledReason:t.disabledReason}}))}}s(j_,"sharedAsList");function V_(e){return e.disabledReason===void 0?"":e.disabledCount===void 0?e.disabledReason:`${e.disabledReason} (${e.disabledCount})`}s(V_,"disabledText");function B_(e){return e.flatMap(({nodeId:t,actions:n})=>n.map(r=>({node:t,action:r.id,label:r.label.de,disabled:V_(r)})))}s(B_,"actionRows");function U_(e,t,n=[]){let r=e.filter(({actions:d})=>d.some(c=>c.id===t));if(r.length===0){let d=[...new Set(e.flatMap(({actions:c})=>c.map(u=>u.id)))];throw new g(`test-actions run: no current node offers "${t}" (offered: ${d.join(", ")||"nothing"})`)}if(r.length>1)throw new g(`test-actions run: "${t}" is offered by ${r.map(d=>d.nodeId).join(", ")} \u2014 pass --node`);let{nodeId:i,actions:o}=r[0],a=o.find(d=>d.id===t);if(a.disabledReason!==void 0)throw new g(`test-actions run: "${t}" on ${i} is disabled: ${V_(a)}`);if(i!==K_)return i;let l=n[0];if(l===void 0)throw new g(`test-actions run: "${t}" needs a current node \u2014 the application has none`);return l}s(U_,"nodeOfferingAction");function G_(e,t,n){if(e.startsWith(q_)){if(Object.hasOwn(n,"autoSubmit"))throw new g(`test-actions run: ${e}: a scenario's autoSubmit is set by --auto-submit / --no-auto-submit, not --param`);return{autoSubmit:t,...n}}return Object.keys(n).length===0?void 0:{...n}}s(G_,"runParams");var QY=/^[0-9a-hjkmnp-tv-z]{31,37}$/;function te(e,t){if(!QY.test(e))throw new g(`"${e}" is not a ${t} id \u2014 a Convex id is 31\u201337 characters of 0-9 and a-z without i, l, o, u.`);return e}s(te,"parseDocumentId");async function ZY(e,t){let n=await e.query(S.workflow.getInstance,{applicationId:t});if(n===null)throw new g(`test-actions: application ${t} has no workflow instance`);return n.instance.currentNodeIds}s(ZY,"currentNodeIds");function XY(e,t){switch(t){case"notTestApplication":return`${e} is not a test application`;case"completed":case"aborted":case"deleted":return`${e} is ${t} \u2014 test actions run only on an active application`;case"missingPermission":return"the caller lacks bewerbungsmanagement.testActions.run"}}s(XY,"refusalText");async function Ep(e,t,n){let r=await e.query(S.workflow.listSharedTestActions,{applicationId:t});if(!r.permitted)throw new g(`test-actions: not permitted \u2014 ${XY(t,r.reason)}`);let i=[];for(let o of n){let a=await e.query(S.workflow.listTestActions,{applicationId:t,nodeId:o});if(a===null)throw new g(`test-actions: node "${o}" is not in this application's workflow (or it has no instance)`);i.push({nodeId:o,actions:a})}return[...i,j_(r.actions)]}s(Ep,"actionsOf");async function z_(e,t,n){return n!==void 0?[n]:await ZY(e,t)}s(z_,"nodesOf");var Vw=class extends P{static{s(this,"TestActionsListCommand")}static paths=[["test-actions","list"]];static usage=E.Usage({category:"Admission",description:"List the test-mode actions of the application's current node(s) (scenarios, auto-fill-files, submit, \u2026) and the application-wide ones"});application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});async execute(){let t=te(this.application,"application"),n=await this.caller(),r=await Ep(n,t,await z_(n,t,this.node));return this.print(r,B_,["node","action","label","disabled"]),0}},Bw=class extends P{static{s(this,"TestActionsRunCommand")}application=f.String("--application",{required:!0,description:"Application id (a test application)"});node=f.String("--node",{description:"Node id (default: the application's current nodes)"});static paths=[["test-actions","run"]];static usage=E.Usage({category:"Admission",description:"Run one test-mode action; a scenario (load-scenario:<id>) also submits unless --no-auto-submit"});action=f.String("--action",{required:!0,description:"Action id, e.g. load-scenario:standard, auto-fill-files, submit-form"});autoSubmit=f.Boolean("--auto-submit",!0,{description:"Scenario only: stub the file fields and submit after loading (default on; --no-auto-submit only loads)"});param=f.Array("--param",{description:"Action parameter key=value (repeatable; the value is JSON where it parses, else text), e.g. --param confirmed=true for an action that asks a question first (its `confirm` in `test-actions list`)"});async execute(){let t=G_(this.action,this.autoSubmit,Tp(this.param??[]).values),n=te(this.application,"application"),r=await this.caller(),i=await z_(r,n,this.node),o=U_(await Ep(r,n,i),this.action,i);return await r.mutation(S.workflow.runTestAction,{applicationId:n,nodeId:o,actionId:this.action,...t===void 0?{}:{params:t}}),this.print({ran:this.action,on:o},a=>[{key:"ran",value:a.ran},{key:"on",value:a.on},{key:"next",value:"test-actions list \u2014 file fills and the submit after them run asynchronously"}]),0}},W_=[Vw,Bw];var _r=/^[a-z][A-Za-z0-9]*$/;function Uw(e){return typeof e=="string"&&_r.test(e)}s(Uw,"isNodeId");function la(e,t){Uw(e)||C(`[graph/nodeIdFormat] "${e}" cannot name a node: a node id is ${_r.source}.`);let n=new Set(t);if(!n.has(e))return e;let r=2;for(;n.has(`${e}${r}`);)r++;return`${e}${r}`}s(la,"makeNodeId");var fo="$env";function ce(e){if(e.scope==="env")return`${fo}.${e.key}`;let t=`$${e.scope}.${e.owner}.${e.key}`;return e.path===void 0?t:`${t}.${e.path}`}s(ce,"formatAddress");var uo=/^[a-z][a-zA-Z0-9_]*$/,eH=/^[A-Za-z_][A-Za-z0-9_]*$/;function Jo(e){return typeof e=="string"&&e.split(".").every(t=>eH.test(t))}s(Jo,"isPath");function Si(e){if(!e.startsWith("$"))return null;let t=e.slice(1).split("."),[n,...r]=t;switch(n){case"env":{let i=r.join(".");return r.length>0&&Jo(i)?{scope:"env",key:i}:null}case"node":case"task":{let[i,o,...a]=r;return i===void 0||o===void 0||!uo.test(o)||(n==="node"?!_r.test(i):!uo.test(i))?null:tH({scope:n,owner:i,key:o},a)}default:return null}}s(Si,"tryParseAddress");function tH(e,t){if(t.length===0)return e;let n=t.join(".");return Jo(n)?{...e,path:n}:null}s(tH,"withPath");function ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=t.scope==="env"?["scope","key"]:["scope","owner","key","path"];if(Object.keys(t).some(r=>!n.includes(r))||t.path!==void 0&&!Jo(t.path))return!1;switch(t.scope){case"env":return Jo(t.key);case"node":return typeof t.owner=="string"&&_r.test(t.owner)&&typeof t.key=="string"&&uo.test(t.key);case"task":return typeof t.owner=="string"&&uo.test(t.owner)&&typeof t.key=="string"&&uo.test(t.key);default:return!1}}s(ke,"isAddress");var po={offer:{key:"string",title:"string"},unit:{key:"string",name:"string"},stage:{key:"string",name:"string",gradeLevel:"number"},run:{key:"string",name:"string",startDate:"date"},applicant:{language:"enum",channel:"enum"}},da=Object.keys(po);function mo(e){return Object.hasOwn(po,e)}s(mo,"isEnvKey");var Gw=["self-service","staff"];function Y_(e,t){return{kind:"fixed",values:e,labels:t}}s(Y_,"fixedSet");var Ip={of:"applicant.language",withoutValue:"de"},Ai={"offer.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Angebot",en:"Offer"}},"offer.title":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Titel des Angebots",en:"Offer title"},nameLanguage:Ip},"unit.key":{valueSet:{kind:"live"},nullable:!1,label:{de:"Einheit",en:"Unit"}},"unit.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Einheit",en:"Unit name"},nameLanguage:Ip},"stage.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Klassenstufe (Schl\xFCssel)",en:"Grade (key)"},cohortBound:!0},"stage.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name der Klassenstufe",en:"Grade name"},cohortBound:!0,nameLanguage:Ip},"stage.gradeLevel":{valueSet:{kind:"open"},nullable:!0,absent:{de:"Die Stufe hat keine Klassenstufe (Kindergarten).",en:"The stage has no grade level (Kindergarten)."},label:{de:"Klassenstufe",en:"Grade level"},cohortBound:!0},"run.key":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Schuljahr",en:"School year"},cohortBound:!0},"run.name":{valueSet:{kind:"unstable"},nullable:!1,label:{de:"Name des Schuljahrs",en:"School year name"},cohortBound:!0,nameLanguage:Ip},"run.startDate":{valueSet:{kind:"open"},nullable:!0,absent:{de:"F\xFCr das Schuljahr ist kein Beginn erfasst.",en:"The school year has no start date."},label:{de:"Beginn des Schuljahrs",en:"School year start"},cohortBound:!0},"applicant.language":{valueSet:Y_(Ge,{de:{de:"Deutsch",en:"German"},en:{de:"Englisch",en:"English"}}),nullable:!0,absent:{de:"Die Bewerbung hat kein Bewerberkonto (intern angelegt).",en:"The application has no applicant account (started by staff)."},label:{de:"Bewerbersprache",en:"Applicant language"}},"applicant.channel":{valueSet:Y_(Gw,{staff:{de:"intern",en:"in-house"},"self-service":{de:"online (Familie)",en:"online (family)"}}),nullable:!1,label:{de:"Eingangsweg",en:"Intake channel"}}},Op={types:po,fields:Ai},_p=da.flatMap(e=>Object.keys(po[e]).map(t=>`${e}.${t}`));function cr(e){return Object.hasOwn(Ai,e)}s(cr,"isEnvLeaf");function Np(e){return`${fo}.${e}`}s(Np,"envIdentifier");function Qo(e){let t=Ai[e],[n,r]=e.split("."),i=po[n][r];i===void 0&&C(`[env] leaf "${e}" has no type`);let o=t.valueSet;return{leaf:e,type:i,label:t.label,nullable:t.nullable,...t.absent===void 0?{}:{absent:t.absent},...t.nameLanguage===void 0?{}:{nameLanguage:t.nameLanguage},...t.cohortBound===void 0?{}:{cohortBound:t.cohortBound},...o.kind==="fixed"?{enumOptions:o.values.map(a=>{let l=o.labels[a];return l===void 0&&C(`[env] "${e}" names the value "${a}" without a label`),{value:a,label:l}})}:{}}}s(Qo,"envLeaf");var H_="staffInput";var nH=["boolean"],ad=/^[a-z][A-Za-z0-9]*$/;function Pp(e){return e.staffInputs??[]}s(Pp,"staffInputsOf");function Cp(e){return`${H_}.${e}`}s(Cp,"staffInputLeaf");function J_(e){return`${fo}.${Cp(e)}`}s(J_,"staffInputIdentifier");function rH(e){let t=`${H_}.`;return e.startsWith(t)?e.slice(t.length):null}s(rH,"staffInputKeyOfLeaf");function ca(e,t){let n=rH(t);return n===null?void 0:Pp(e).find(r=>r.key===n)}s(ca,"declaredStaffInput");function Q_(e){return[...Pp(e).map(t=>({leaf:Cp(t.key),type:t.type,label:t.label,valueSet:{kind:"open"},nullable:!1,cohortBound:!1})),..._p.map(t=>{let n=Qo(t);return{leaf:t,type:n.type,label:n.label,valueSet:Ai[t].valueSet,nullable:n.nullable,cohortBound:n.cohortBound===!0}})]}s(Q_,"envLeavesFor");function Z_(e){return Q_(e).filter(t=>!t.cohortBound)}s(Z_,"conditionEnvLeaves");function X_(e){return tN(Z_(e))}s(X_,"envConditionSchemaFor");function iH(e){return Q_(e).map(t=>t.leaf==="stage.key"?{...t,valueSet:{kind:"open"}}:t)}s(iH,"offerConditionEnvLeaves");function eN(e){return tN(iH(e))}s(eN,"offerConditionSchemaFor");function tN(e){let t={},n={};for(let{leaf:r,type:i,valueSet:o,nullable:a}of e){let[l="",d=""]=r.split(".");t[l]={...t[l]??{},[d]:i},n[r]={valueSet:o,nullable:a}}return{types:t,fields:n}}s(tN,"schemaOfLeaves");function nN(e){let t=e.staffInputs;if(t===void 0)return[];if(!Array.isArray(t))return[{path:"staffInputs",reason:{de:"[staffInput/shape] graph.staffInputs muss eine Liste sein.",en:"[staffInput/shape] graph.staffInputs must be a list."}}];let n=[],r=new Set;return t.forEach((i,o)=>{let a=`staffInputs[${o}]`,l=i;if(l===null||typeof l!="object"||typeof l.key!="string"){n.push({path:a,reason:{de:"[staffInput/shape] Eine interne Angabe braucht key, type und label ({ de, en }).",en:"[staffInput/shape] An internal entry needs key, type and label ({ de, en })."}});return}let d={de:`Interne Angabe "${l.key}"`,en:`Internal entry "${l.key}"`};ad.test(l.key)||n.push({path:`${a}.key`,reason:{de:`[staffInput/keyFormat] ${d.de}: Schl\xFCssel beginnt mit einem Kleinbuchstaben und enth\xE4lt nur Buchstaben und Ziffern.`,en:`[staffInput/keyFormat] ${d.en}: the key starts with a lowercase letter and contains only letters and digits.`}}),r.has(l.key)&&n.push({path:`${a}.key`,reason:{de:`[staffInput/duplicateKey] ${d.de}: Schl\xFCssel ist doppelt vergeben.`,en:`[staffInput/duplicateKey] ${d.en}: the key is used twice.`}}),r.add(l.key),nH.includes(l.type)||n.push({path:`${a}.type`,reason:{de:`[staffInput/unknownType] ${d.de}: Typ "${String(l.type)}" \u2014 erlaubt ist nur "boolean" (K\xE4stchen).`,en:`[staffInput/unknownType] ${d.en}: type "${String(l.type)}" \u2014 only "boolean" (checkbox) is allowed.`}});let c=Lt(l.label);c==="not-localized"?n.push({path:`${a}.label`,reason:{de:`[staffInput/shape] ${d.de}: label muss { de, en } sein.`,en:`[staffInput/shape] ${d.en}: label must be { de, en }.`}}):c.length>0&&n.push({path:`${a}.label`,reason:{de:`[i18n/missingTranslation] ${d.de}: Beschriftung fehlt in ${c.join(", ")}.`,en:`[i18n/missingTranslation] ${d.en}: label is missing in ${c.join(", ")}.`}})}),n}s(nN,"staffInputIssues");function Mt(e,t){if(e instanceof $e)return new $e(t(e.message),{cause:e});if(e instanceof g)return new g(t(e.message),{cause:e});let n=lr(e);if(n!==null&&(n.message.de!==""||n.message.en!=="")){let r=e.data,i=typeof r=="string"?t(r):{...r,message:{de:n.message.de===""?"":t(n.message.de),en:n.message.en===""?"":t(n.message.en)}},o=new Ft(i);return o.cause=e,o}return new Error(t(zl(e)),{cause:e})}s(Mt,"withContext");var nk={required:!0,description:"Offer slug (its offerKey)"},zw=class extends P{static{s(this,"ApplicationsListCommand")}static paths=[["applications","list"]];static usage=E.Usage({category:"Admission",description:"List an offer's applications (id, status, board state, applicant, test)"});offer=f.String("--offer",nk);testOnly=f.Boolean("--test-only",!1,{description:"Only test applications"});async execute(){let t=await this.caller(),n=await t.query(S.admission.listForAngebot,{client:this.requireTenant(t),offerKey:this.offer}),r=D_(n).filter(i=>!this.testOnly||i.test==="test");return this.print(r,i=>i,["id","status","state","applicant","test"]),0}},Ww=class extends P{static{s(this,"ApplicationsCountsCommand")}static paths=[["applications","counts"]];static usage=E.Usage({category:"Admission",description:"Count an offer's applications per list"});offer=f.String("--offer",nk);async execute(){let t=await this.caller(),n=await t.query(S.admission.getCountsByListForAngebot,{client:this.requireTenant(t),offerKey:this.offer});return this.print(n,r=>[...Object.entries(r.counts).map(([i,o])=>({list:i,count:String(o)})),{list:"total",count:String(r.total)}],["list","count"]),0}},Yw=class extends P{static{s(this,"ApplicationsShowCommand")}static paths=[["applications","show"]];static usage=E.Usage({category:"Admission",description:"One application: status, test flag, offer, current workflow nodes"});application=f.String({required:!0});async execute(){let t=await this.caller(),n=te(this.application,"application"),r=await t.query(S.admission.get,{applicationId:n});if(r===null)throw new g(`applications show: no application ${n} (or not visible to you)`);let i=await t.query(S.workflow.getInstance,{applicationId:n});return this.print({application:r,currentNodes:i?.instance.currentNodeIds??[]},o=>[{key:"id",value:n},{key:"status",value:o.application.status},{key:"test",value:o.application.testMode?"ja":"nein"},{key:"offer",value:o.application.offerId},{key:"current nodes",value:o.currentNodes.join(", ")}]),0}},Hw=class extends P{static{s(this,"ApplicationsStoreCommand")}static paths=[["applications","store"]];static usage=E.Usage({category:"Admission",description:"One application's process store: every address of its pinned graph, resolved (present / pending / absent)",details:"Staff only (applications.manage). --json prints one object keyed by the canonical address ($node\u2026, $task\u2026, $env\u2026). Values are shown whatever their audience \u2014 never hand the output to the family. Recipe: playbooks/applications/inspect-process-store.md."});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.processStoreView.get,{applicationId:te(this.application,"application")});return this.print(L_(n),()=>M_(n),["address","state","holds","producer","written"]),0}},Jw=class extends P{static{s(this,"ApplicationsStartTestCommand")}static paths=[["applications","start-test"]];static usage=E.Usage({category:"Admission",description:"Start a TEST application for an applicant (school year and level by key or id) and show what test mode offers next",details:"Always test mode. --applicant names the account by its login address (on prod only the tenant's test account); --party names the applicant party directly. Without --version it runs on the live generation, like the cockpit."});offer=f.String("--offer",nk);run=f.String("--run",{required:!0,description:"School year: its bundle key as offer export shows it (program.runs[].key) or id \u2014 never its name"});stage=f.String("--stage",{required:!0,description:"Level: its bundle key as offer export shows it (program.stages[].key) or id \u2014 never its name"});party=f.String("--party",{description:"Applicant party id"});applicant=f.String("--applicant",{description:"Applicant account login address (e.g. the test account test@example.com)"});version=f.String("--version",{description:"Offer version id to test (default: the live generation)"});staffInput=f.Array("--staff-input",{description:"A staff input the offer declares, as key=true|false \u2014 repeat it once per input; a staff start must set every one"});proxy=f.Boolean("--proxy",{description:"Start in Stellvertretung (--proxy) or not (--no-proxy); left out, the tenant's default applies, as in the cockpit"});async execute(){let t=await this.caller();F_(this.resolvedTarget(),this.prodUrls(),this.party,this.applicant);let n=this.requireTenant(t),r=C_(await t.query(S.admission.listAdmissionTree,{client:n}),this.offer,this.run,this.stage),i=this.party===void 0?void 0:te(this.party,"party");if(this.applicant!==void 0){let d=await t.query(S.applicants.partyByEmail,{client:n,email:this.applicant});if(d===null)throw new g(`applications start-test: no applicant account ${this.applicant} at this school (create it in the cockpit first)`);i=d}let o=await t.mutation(S.admission.staffStartApplicationForParty,{client:n,offerKey:this.offer,partyId:i,programRunId:r.programRunId,programStageId:r.programStageId,...this.proxy===void 0?{}:{startInProxy:this.proxy},staffInputs:iN(this.staffInput??[]),testMode:!0,...this.version===void 0?{}:{offerVersionId:te(this.version,"offer version")}}),a,l;try{let d=await t.query(S.workflow.getInstance,{applicationId:o.applicationId});if(d===null)throw new Error("the started application has no workflow instance");a=d.instance.currentNodeIds,l=(await Ep(t,o.applicationId,a)).flatMap(c=>c.actions.map(u=>u.id))}catch(d){throw Mt(d,c=>`applications start-test: started ${o.applicationId}, but reading its state failed: ${c}`)}return this.print({applicationId:o.applicationId,currentNodes:a,testActions:l},d=>[{key:"application",value:d.applicationId},{key:"current nodes",value:d.currentNodes.join(", ")},{key:"test actions",value:d.testActions.join(", ")},{key:"next",value:`test-actions run --application ${d.applicationId} --action <id>`}]),0}},Qw=class extends P{static{s(this,"ApplicationsDiscardTestCommand")}static paths=[["applications","discard-test"]];static usage=E.Usage({category:"Admission",description:"Discard a TEST application (the server refuses a real one), or with --all-test every expired one of the school",details:"With an id: discards that test application. With --all-test --older-than <N>d: lists the school's test applications whose last activity is older than N days (N \u2265 14) and that are not kept as a demo \u2014 a dry run unless --confirm; --confirm discards each expired one the server re-checks, the rest are reported with the reason. Recipe: playbooks/applications/expire-test-applications.md.",examples:[["Dry run","plexus-cli --env prod --tenant <t> applications discard-test --all-test --older-than 14d --dry-run"],["Discard","plexus-cli --env prod --tenant <t> --allow-prod applications discard-test --all-test --older-than 14d --confirm"]]});application=f.String({required:!1});allTest=f.Boolean("--all-test",!1,{description:"Every expired test application of the school instead of one id"});olderThan=f.String("--older-than",{description:"With --all-test: days without activity, as <N>d (N \u2265 14)"});dryRun=f.Boolean("--dry-run",!1,{description:"With --all-test: list only (the default)"});confirm=f.Boolean("--confirm",!1,{description:"With --all-test: discard (else the dry run)"});async execute(){if(!this.allTest){if(this.application===void 0)throw new g("applications discard-test: name an application id, or use --all-test --older-than <N>d");if(this.olderThan!==void 0||this.dryRun||this.confirm)throw new g("applications discard-test: --older-than, --dry-run and --confirm belong to --all-test");return await(await this.caller()).mutation(S.admission.discardTest,{applicationId:te(this.application,"application")}),this.print({discarded:this.application},u=>[{key:"discarded",value:u.discarded}]),0}if(this.application!==void 0)throw new g("applications discard-test: --all-test takes no application id");if(this.olderThan===void 0)throw new g("applications discard-test --all-test: --older-than <N>d is required");if(this.dryRun&&this.confirm)throw new g("applications discard-test: --dry-run and --confirm exclude each other");let t=oH(this.olderThan),n=await this.caller(),r=this.requireTenant(n),i=[],o=null;for(;;){let c=await n.query(S.admission.testTtlPlan,{client:r,olderThanDays:t,cursor:o});if(i.push(...c.rows),c.isDone)break;o=c.continueCursor}let a=i.map(c=>({...c,result:c.verdict!=="expired"?"kept":c.block!==null?"blocked":this.confirm?"pending":"would discard"})),l=i.filter(c=>c.verdict==="expired"&&c.protectedDemo).map(c=>c.applicationId);if(this.confirm&&l.length>0)throw new g(`applications discard-test --all-test: protected demo application(s) in the discard set, nothing discarded: ${l.join(", ")}`);let d=0;if(this.confirm)for(let c of a.filter(u=>u.result==="pending"))try{await n.mutation(S.admission.discardExpiredTest,{applicationId:c.applicationId,olderThanDays:t}),c.result="discarded"}catch(u){d++,c.result=`failed: ${u instanceof Error?u.message:String(u)}`}return this.print({olderThanDays:t,confirm:this.confirm,rows:a},c=>c.rows.map(u=>({id:u.applicationId,lastActivity:new Date(u.lastActivityAt).toISOString().slice(0,10),verdict:u.verdict,block:u.block??"",result:u.result})),["id","lastActivity","verdict","block","result"]),d>0?1:0}};function oH(e){let t=/^(\d+)d$/.exec(e.trim());if(t===null)throw new g(`--older-than "${e}": expected <N>d, e.g. 14d`);return Number(t[1])}s(oH,"parseDays");var Zw=class extends P{static{s(this,"ApplicationsSetKeepDemoCommand")}static paths=[["applications","set-keep-demo"]];static usage=E.Usage({category:"Admission",description:"Mark a TEST application \u201EDemo behalten\u201C (never expires, never discarded), or clear the mark with --off"});application=f.String({required:!0});off=f.Boolean("--off",!1,{description:"Clear the mark"});async execute(){return await(await this.caller()).mutation(S.admission.setKeepAsDemo,{applicationId:te(this.application,"application"),keep:!this.off}),this.print({application:this.application,keepAsDemo:!this.off},n=>[{key:"application",value:n.application},{key:"keep as demo",value:n.keepAsDemo?"ja":"nein"}]),0}},Xw=class extends P{static{s(this,"ApplicationsStaffInputListCommand")}static paths=[["applications","staff-input","list"]];static usage=E.Usage({category:"Admission",description:"An application's internal inputs (set at the start): value, and why one can no longer be corrected"});application=f.String({required:!0});async execute(){let n=await(await this.caller()).query(S.admission.staffInputsOfApplication,{applicationId:te(this.application,"application")});return this.print(n,r=>r.map(i=>({key:i.key,label:i.label.de,value:String(i.value),correctable:i.block===null?"ja":i.block.de})),["key","label","value","correctable"]),0}},ek=class extends P{static{s(this,"ApplicationsStaffInputSetCommand")}static paths=[["applications","staff-input","set"]];static usage=E.Usage({category:"Admission",description:"Correct one internal input of an application, with a reason \u2014 refused once a node that reads it was entered",examples:[["Untick \u201EKind von Mitarbeitenden\u201C",'plexus-cli --env prod --tenant <t> --allow-prod applications staff-input set <id> --input staffApplication=false --reason "falsch angehakt"']]});application=f.String({required:!0});input=f.String("--input",{required:!0,description:"key=true|false"});reason=f.String("--reason",{required:!0,description:"Why \u2014 recorded on the application's activity feed"});async execute(){let t=await this.caller(),[{key:n,value:r}]=iN([this.input]);return await t.mutation(S.admission.correctStaffInput,{applicationId:te(this.application,"application"),key:n,value:r,reason:this.reason}),this.print({application:this.application,key:n,value:r},i=>[{key:"application",value:i.application},{key:i.key,value:String(i.value)}]),0}},tk=class extends P{static{s(this,"ApplicationsPurgeCommand")}static paths=[["platform","applications","purge"]];static usage=E.Usage({category:"Admission",description:"Hard-delete one real application staff started for a colleague and already deleted (plan unless --confirm). Needs _platform.config.manage.",details:"Refused unless all hold: a real application (a test one goes with `applications discard-test`), soft-deleted by staff, started by staff, its applicant an internal staff member of the school (also a switched-off one) whose person existed before, no data about anyone else (only empty drafts the form opened), nothing committed yet, and no contract, signing process, payment or Engage push. Deletes the application and every row it created; the staff member's person stays. Afterwards the responsible person can be deactivated.",examples:[["Plan","plexus-cli --env prod --tenant <slug> platform applications purge <applicationId>"],["Apply","plexus-cli --env prod --tenant <slug> --allow-prod platform applications purge <applicationId> --confirm"]]});application=f.String({required:!0});confirm=f.Boolean("--confirm",!1,{description:"Delete for good (without it, only the checks run)."});async execute(){let t=await this.caller(),n=await t.mutation(S.admission.purgeDeletedStaffApplication,{tenantSlug:this.requireTenant(t),applicationId:te(this.application,"application"),dryRun:!this.confirm});if(this.json)return this.print(n),0;let r=this.context.stdout;return r.write(`${n.applied?"Deleted":"Would delete"} application ${n.applicationId} `),r.write(`(applicant ${n.applicantPartyId}, soft-deleted ${new Date(n.deletedAt).toISOString()})
|
|
11470
|
+
`),n.applicantGone&&r.write(`The applicant's party no longer exists \u2014 the staff check was not run.
|
|
11470
11471
|
`),n.applied?(r.write(`Rows deleted: ${n.deleted}${n.continuing?" so far \u2014 the purge goes on in scheduled steps":""}
|
|
11471
11472
|
`),0):(r.write(`Dry run \u2014 every check passed; re-run with --confirm to delete.
|
|
11472
11473
|
`),0)}},rN=[zw,Ww,Yw,Hw,Jw,Qw,tk,Zw,Xw,ek];function iN(e){return e.map(t=>{let[n="",r,...i]=t.split("=");if(!ad.test(n)||r!=="true"&&r!=="false"||i.length>0)throw new g(`--staff-input "${t}": expected key=true or key=false`);return{key:n,value:r==="true"}})}s(iN,"parseStaffInputs");var tn="contractGenerator",Zo="documentTemplate";function ld(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return(t.kind==="generator"||t.kind==="package")&&typeof t.key=="string"&&t.key.length>0&&(t.revision===void 0||typeof t.revision=="number"&&Number.isInteger(t.revision)&&t.revision>0)&&n.every(r=>r==="kind"||r==="key"||r==="revision")}s(ld,"isGeneratorRef");function oN(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(oN,"literalOf");function Ti(e){let t=oN(e,tn);return ld(t)?t:null}s(Ti,"generatorRefOfNode");function Nr(e){let t=oN(e,Zo);return typeof t=="string"&&t.length>0?t:null}s(Nr,"documentTemplateKeyOfNode");function sN(e){return`${e.kind}:${e.key}${e.revision===void 0?"":`@${e.revision}`}`}s(sN,"generatorRefLabel");var sH=["formExports","generatorStamp"];function aN(e,t,n){let r=e.inputs?.[tn];(r?.kind!=="literal"||!ld(r.value))&&C(`applyGeneratorStamp: the node names no generator in inputs.${tn} \u2014 a stamp derives from it`),n.freezeRevision&&t.revision!==void 0&&(e.inputs[tn]={kind:"literal",value:{...r.value,revision:t.revision}}),e.generatorStamp={inputSchema:t.inputSchema,parties:t.parties,schemaDigest:t.schemaDigest,...t.parts===void 0?{}:{parts:t.parts},...t.coverLetter===void 0?{}:{coverLetter:t.coverLetter}}}s(aN,"applyGeneratorStamp");var aH=["reads"];function ua(e){if(e===null||typeof e!="object")return e;let t={...e};return Array.isArray(t.nodes)&&(t.nodes=t.nodes.map(n=>{if(n===null||typeof n!="object")return n;let r={...n};for(let i of sH)delete r[i];for(let i of aH)Array.isArray(r[i])&&r[i].length===0&&delete r[i];return r})),t}s(ua,"comparableWorkflowGraph");var dd={id:{de:"die Identit\xE4t ist der Slug des Angebots (bundle.yaml slugs.manifest)",en:"the identity is the offer's slug (bundle.yaml slugs.manifest)"},label:{de:"der Titel steht in bundle.yaml `label`",en:"the title is bundle.yaml `label`"},version:{de:"die Revision z\xE4hlt die Datenbank",en:"the database counts the revision"},applicantMode:{de:"von nichts gelesen",en:"read by nothing"},signatureLevel:{de:"von nichts gelesen",en:"read by nothing"},roleInstances:{de:"die Rollen kommen aus den Formular-Effekten",en:"roles come from the form effects"},leistungen:{de:"von nichts gelesen",en:"read by nothing"},capacity:{de:"die Kapazit\xE4t geh\xF6rt der Kohorte (program.runs[].capacities)",en:"capacity belongs to the cohort (program.runs[].capacities)"},progressLayoutId:{de:"von nichts gelesen",en:"read by nothing"},bewerbungsfenster:{de:"die Kohorte besitzt die \xD6ffnung (isOpen / applicationOpensAt)",en:"the cohort owns opening (isOpen / applicationOpensAt)"},selection:{de:"die Reihenfolge ist der Eingang `waitlistOrder` des Wartelistenknotens (automatisches Nachr\xFCcken gibt es nicht mehr; Freigabe-Strategie und Stichtag las nichts)",en:"the order is the waitlist node's input `waitlistOrder` (automatic promotion is gone; release strategy and deadline were read by nothing)"},progressLayout:{de:"das Fortschrittslayout geh\xF6rt zum Workflow: den Block nach workflow.json `progressLayout` verschieben (ohne Workflow l\xF6schen)",en:"the progress layout belongs to the workflow: move the block to workflow.json `progressLayout` (without a workflow: delete it)"}};function Dp(e){return e===null||typeof e!="object"||Array.isArray(e)?["manifest: data must be an object"]:Object.keys(e).map(t=>{let n=dd[t];return n!==void 0?`manifest: \`${t}\` is no longer part of manifest.json (${n.en}). Delete the line.`:`manifest: unknown key \`${t}\` \u2014 manifest.json carries no key.`})}s(Dp,"manifestIssues");function lH(e){let t=[],n=e.buses;if(!Array.isArray(n))return t;let r=n.find(i=>!!i&&typeof i=="object"&&i.key==="process");if(!r||!Array.isArray(r.states))return t;for(let i of r.states){if(!i||typeof i!="object")continue;let o=i;if(o.terminal!==!0&&(!o.external||typeof o.external!="object")){let a=typeof o.id=="string"?o.id:"?";t.push(`progressLayout: progress state '${a}' is non-terminal but declares no 'external' block (applicant-facing copy) \u2014 resolveStatusPresentation would throw at runtime`)}}return t}s(lH,"validateProgressLayoutExternalCopy");function lN(e){if(e===null||typeof e!="object")return["progressLayout: the full layout object is required"];let t=e.buses;return!Array.isArray(t)||!t.some(n=>!!n&&typeof n=="object"&&n.key==="process")?["progressLayout: the layout must declare the `process` bus"]:lH(e)}s(lN,"progressLayoutIssues");var dN=new Set(["nodes","assignmentRules","channels","processStore","staffInputs"]);var dH=new Set(["sections","effects","outcomes","testScenarios","env","views"]),Fp={id:{de:"der Schl\xFCssel des Formulars ist sein Slug",en:"the form's key is its slug"},label:{de:"der Name steht in der Formularzeile (createSmartForm.label)",en:"the name is the form row's (createSmartForm.label)"},outcomeIds:{de:"die Ergebnisse sind die ids von outcomes[]",en:"the outcomes are the ids of outcomes[]"},schoolSlug:{de:"von nichts gelesen",en:"read by nothing"}};function cN(e,t){if(e===null||typeof e!="object"||Array.isArray(e))return[{de:`${t}: die Formulardefinition muss ein Objekt sein.`,en:`${t}: the form definition must be an object.`}];let n=[];for(let i of Object.keys(e)){if(dH.has(i))continue;let o=Fp[i];n.push(o!==void 0?{de:`${t}: \`${i}\` geh\xF6rt nicht mehr zur Formulardefinition (${o.de}). Die Zeile l\xF6schen.`,en:`${t}: \`${i}\` is no longer part of the form definition (${o.en}). Delete the line.`}:{de:`${t}: unbekannter Schl\xFCssel \`${i}\`.`,en:`${t}: unknown key \`${i}\`.`})}let r=e;for(let i of["sections","effects","outcomes"])Array.isArray(r[i])||n.push({de:`${t}: \`${i}\` muss eine Liste sein.`,en:`${t}: \`${i}\` must be a list.`});return n}s(cN,"smartFormDefinitionShapeIssues");var Nn=["granted","rejected","waitlisted","other"];function ho(e){return typeof e=="string"&&Nn.includes(e)}s(ho,"isOutcomeSemantic");var ur=["arrival","manual"],uN={arrival:{de:"Nach Eingang",en:"By arrival"},manual:{de:"Von Hand sortiert",en:"Sorted by hand"}};function cH(e,t){let n=e.inputs?.[t];return n?.kind==="literal"?n.value:void 0}s(cH,"literal");function rk(e){let t=cH(e,"waitlistOrder");return ur.includes(t)?{waitlistOrder:t}:null}s(rk,"waitlistPolicyOrNull");var vt="responsible",ik="team:";function Lp(e){return`${ik}${e}`}s(Lp,"teamSlot");function Mp(e){return e.startsWith(ik)?e.slice(ik.length):null}s(Mp,"teamKeyOfSlot");function fN(e){return e.kind==="responsible"?vt:Lp(e.groupKey)}s(fN,"slotIdOf");function qp(e){if(e===vt)return{kind:"responsible"};let t=Mp(e);return t===null||t.length===0?null:{kind:"team",groupKey:t}}s(qp,"slotOfId");var ok="review",sk="checkField",pN="reviewed",ak="reviewing",Kp=["rejected","waitlisted"];function lk(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(lk,"isObject");var uH=new Set(["decision",ok]),mN={approved:"granted",accepted:"granted",admitted:"granted",direkt:"granted",rejected:"rejected",absage:"rejected",declined:"rejected",waitlisted:"waitlisted",warteliste:"waitlisted"};function dk(e){return Object.hasOwn(mN,e)?mN[e]:void 0}s(dk,"legacySemanticOfId");function fH(e){return e===ok?Nn.filter(t=>!Kp.includes(t)):Nn}s(fH,"allowedSemanticsFor");var pH="other";function hN(e){return lk(e)&&uH.has(String(e.type))&&Array.isArray(e.outcomes)?e.outcomes:[]}s(hN,"outcomesOf");function gN(e){return(e?.nodes??[]).some(t=>hN(t).some(n=>lk(n)&&!("semantic"in n)))}s(gN,"needsOutcomeSemantics");function yN(e,t={}){let n=[],r=[],i=[],o=e.nodes.map(a=>{let l=hN(a);if(l.length===0)return a;let d=a,c=String(d.id),u=String(d.type),p=fH(u),h=!1,y=l.map(b=>{if(!lk(b))return b;let k=String(b.id);if("semantic"in b)return ho(b.semantic)||i.push({nodeId:c,outcomeId:k,value:String(b.semantic)}),b;let v=`${c}.${k}`,A=Object.hasOwn(t,v)?t[v]:void 0;if(A!==void 0)return p.includes(A)?(n.push({nodeId:c,outcomeId:k,semantic:A,source:"answer"}),h=!0,{...b,semantic:A}):(r.push({nodeId:c,nodeType:u,outcomeId:k,allowed:p,answer:A}),b);let T=dk(k),I=T??pH;return p.includes(I)?(n.push({nodeId:c,outcomeId:k,semantic:I,source:T===void 0?"formerDefault":"legacyTable"}),h=!0,{...b,semantic:I}):(r.push({nodeId:c,nodeType:u,outcomeId:k,allowed:p}),b)});return h?{...d,outcomes:y}:a});return n.length===0?{graph:e,written:n,refused:r,invalid:i}:{graph:{...e,nodes:o},written:n,refused:r,invalid:i}}s(yN,"addOutcomeSemantics");var Gn="bewerbungOffen";function Xo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Xo,"isObject");var ck=["event","effect"];function wN(e){return Xo(e)&&e.type==="eventTrigger"}s(wN,"isTrigger");function kN(e){let t=Xo(e.inputs)?e.inputs:{};return"outcomes"in e||ck.some(n=>n in e||n in t)}s(kN,"oldShape");function bN(e){return(e?.nodes??[]).some(t=>wN(t)&&kN(t))}s(bN,"needsEventTriggerStartMove");function mH(e){let t=String(e.id),r=(Array.isArray(e.outcomes)?e.outcomes:[]).map(l=>Xo(l)?l.id:void 0);if("outcomes"in e&&!(r.length===1&&r[0]===Gn))return{unmoved:{nodeId:t,reason:"outcomesNotStart"}};let i=Object.keys(Xo(e.next)?e.next:{});if(!(i.length===1&&i[0]===Gn))return{unmoved:{nodeId:t,reason:"nextNotStart"}};let o=Xo(e.inputs)?{...e.inputs}:{};for(let l of ck){let d=o[l];if(Xo(d)&&d.kind==="binding")return{unmoved:{nodeId:t,reason:"bindingCell"}}}let a={...e};delete a.outcomes;for(let l of ck)delete a[l],delete o[l];return Xo(e.inputs)&&(Object.keys(o).length>0?a.inputs=o:delete a.inputs),{node:a}}s(mH,"moveNode");function vN(e){let t=[],n=[],r=e.nodes.map(i=>{if(!wN(i)||!kN(i))return i;let o=mH(i);return"unmoved"in o?(n.push(o.unmoved),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s(vN,"moveEventTriggerStart");function cd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(cd,"isObject");var xN={waitlistOrder:"arrival"};function SN(e){return!cd(e)||e.type!=="waitlist"?!1:!("waitlistOrder"in(cd(e.inputs)?e.inputs:{}))}s(SN,"lacksPolicy");function hH(e){return(e?.nodes??[]).some(SN)}s(hH,"needsWaitlistPolicyMove");function uk(e){return cd(e)&&ur.includes(e.waitlistOrder)}s(uk,"isWaitlistPolicy");function gH(e){if(e===void 0)return{policy:xN,stated:!1};if(!cd(e))return"malformed";let t=e.waitlistOrder;return t!==void 0&&!ur.includes(t)?"malformed":{policy:{waitlistOrder:t??xN.waitlistOrder},stated:t!==void 0}}s(gH,"policyOfSelection");function AN(e,t,n={}){let r=[],i=[];if(!hH(e))return{graph:e,moved:r,refused:i};let o=gH(t),a=e.nodes.map(l=>{if(!SN(l))return l;let d=l,c=String(d.id),u=cd(d.inputs)?{...d.inputs}:{},p=Object.hasOwn(n,c)?n[c]:void 0,h,y;if(p!==void 0)h=p,y="answer";else{if(o==="malformed")return i.push({nodeId:c,reason:"selectionMalformed"}),l;h=o.policy,y=o.stated?"manifest":"formerDefault"}return u.waitlistOrder={kind:"literal",value:h.waitlistOrder},r.push({nodeId:c,policy:h,source:y}),{...d,inputs:u}});return r.length===0?{graph:e,moved:r,refused:i}:{graph:{...e,nodes:a},moved:r,refused:i}}s(AN,"moveWaitlistPolicyToInputs");function es(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(es,"isObject");var yH=[tn,Zo],wH=["inputSchema","parties","schemaDigest","parts"];function TN(e){return es(e)&&e.type==="governedDocument"&&("resolver"in e||es(e.template)&&("key"in e.template||"cockpitFields"in e.template))}s(TN,"oldShape");function RN(e){return(e?.nodes??[]).some(TN)}s(RN,"needsGeneratorInputMove");function kH(e){let t=es(e.inputs)?{...e.inputs}:{},n={...e},r;if("resolver"in e){let i=e.resolver;if(!es(i))return{unmoved:"resolverNotObject"};if(tn in t)return{unmoved:"generatorInputExists"};if(typeof i.key!="string"||i.key.length===0)return{unmoved:"pinWithoutKey"};if(i.kind!=="generator"&&i.kind!=="package")return{unmoved:"pinWithoutKind"};if(i.revision!==void 0&&!(typeof i.revision=="number"&&Number.isInteger(i.revision)&&i.revision>0))return{unmoved:"pinRevisionInvalid"};if((es(i.inputSchema)&&Array.isArray(i.inputSchema.fields)?i.inputSchema.fields:[]).find(d=>es(d)&&yH.includes(String(d.key)))!==void 0)return{unmoved:"stampDeclaresReservedKey"};t[tn]={kind:"literal",value:{kind:i.kind,key:i.key,...i.revision===void 0?{}:{revision:i.revision}}};let l=Object.fromEntries(wH.filter(d=>d in i).map(d=>[d,i[d]]));Object.keys(l).length>0&&(n.generatorStamp=l),r=i.cockpitFields,delete n.resolver}if(es(e.template)&&("key"in e.template||"cockpitFields"in e.template)){let{key:i,cockpitFields:o,...a}=e.template;if("key"in e.template){if(Zo in t)return{unmoved:"templateInputExists"};if(typeof i!="string"||i.length===0)return{unmoved:"templateKeyInvalid"};t[Zo]={kind:"literal",value:i}}if(o!==void 0){if(r!==void 0)return{unmoved:"cockpitFieldsTwice"};r=o}n.template=a}if(r!==void 0){if("cockpitFields"in e)return{unmoved:"cockpitFieldsExist"};n.cockpitFields=r}return n.inputs=t,{node:n}}s(kH,"moveNode");function $N(e){let t=[],n=[],r=e.nodes.map(i=>{if(!TN(i))return i;let o=kH(i);return"unmoved"in o?(n.push({nodeId:String(i.id),reason:o.unmoved}),i):(t.push(String(i.id)),o.node)});return t.length===0?{graph:e,moved:t,unmoved:n}:{graph:{...e,nodes:r},moved:t,unmoved:n}}s($N,"moveGeneratorPinsToInputs");var EN=/^\d{4}-\d{2}-\d{2}$/;function Pr(e,t){return{de:e,en:t}}s(Pr,"issue");function ts(e){if(typeof e!="object"||e===null)return Pr("keine Reduktion","not a reduction");let t=e;if(t.kind==="none")return Object.keys(t).length===1?null:Pr('\u201Ekeine Reduktion" tr\xE4gt keine weiteren Angaben','"no reduction" carries no further details');if(t.kind!=="amount")return Pr(`unbekannte Art ${JSON.stringify(t.kind)}`,`unknown kind ${JSON.stringify(t.kind)}`);let{amount:n,activeFrom:r,activeTo:i}=t;return typeof n!="number"||!Number.isFinite(n)||n<=0?Pr("der Betrag muss gr\xF6\xDFer als 0 \u20AC sein","the amount must be greater than \u20AC0"):Number.isInteger(Number((n*100).toFixed(6)))?typeof r!="string"||!EN.test(r)?Pr("der Beginn fehlt (JJJJ-MM-TT)","the start is missing (YYYY-MM-DD)"):typeof i!="string"||!EN.test(i)?Pr("das Ende fehlt (JJJJ-MM-TT)","the end is missing (YYYY-MM-DD)"):i<r?Pr("das Ende liegt vor dem Beginn","the end is before the start"):t.floorTotal!==void 0&&(typeof t.floorTotal!="number"||!Number.isSafeInteger(t.floorTotal)||t.floorTotal<0)?Pr("die Untergrenze muss ein nichtnegativer Centbetrag sein","the floor must be a non-negative amount in cents"):t.pricePeriod!==void 0&&!["month","year","once","unit"].includes(String(t.pricePeriod))?Pr("ung\xFCltige Preisperiode","invalid price period"):Object.keys(t).some(o=>!["kind","amount","activeFrom","activeTo","floorTotal","pricePeriod"].includes(o))?Pr("unbekannte Angaben","unknown details"):null:Pr("der Betrag hat mehr als zwei Nachkommastellen","the amount has more than two decimal places")}s(ts,"reductionShapeIssue");function go(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.itemKey=="string"&&t.itemKey.length>0&&Array.isArray(t.grantKeys)&&t.grantKeys.every(n=>typeof n=="string"&&n.length>0)&&(t.reduction===void 0||ts(t.reduction)===null&&t.reduction.kind==="amount")}s(go,"isPricedItemValue");var fa=["freetext","recommendation","choice","pricedItem","record","reduction"],pa=[...fa,"appointment"];function ON(e){return typeof e=="string"&&pa.includes(e)}s(ON,"isTaskResultKind");function ma(e){return typeof e=="string"&&fa.includes(e)}s(ma,"isRecordedTaskResultKind");function ha(e){return ma(e.kind)}s(ha,"isRecordedTaskResult");var jp=["number","boolean","enum","text","person","assignment"];function fk(e){return typeof e=="string"&&jp.includes(e)}s(fk,"isRecordFieldType");function _N(e){return e==="number"||e==="boolean"||e==="enum"}s(_N,"isSuggestibleFieldType");var pk=["form","siblingRank"],Vp=500;function bH(e){switch(e.type){case"number":case"boolean":case"enum":return e.type;case"text":return"string";case"person":return e.multiple===!0?"staffUserList":"staffUser";case"assignment":return"taskAssignment"}}s(bH,"recordFieldValueType");var Ri={freetext:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Freitext",en:"Free text"}},recommendation:{choiceValueType:"enum",valueType:null,textValueType:"string",label:{de:"Empfehlung",en:"Recommendation"}},choice:{choiceValueType:"enum",valueType:"enum",textValueType:"string",label:{de:"Auswahl",en:"Choice"}},pricedItem:{choiceValueType:"enum",valueType:"pricedItem",textValueType:"string",label:{de:"Preisposition",en:"Priced item"}},reduction:{choiceValueType:null,valueType:"reduction",textValueType:"string",label:{de:"Reduktion",en:"Reduction"}},record:{choiceValueType:null,valueType:null,textValueType:"string",label:{de:"Erfassung",en:"Record"}},appointment:{choiceValueType:null,valueType:null,textValueType:null,label:{de:"Termin",en:"Appointment"}}};function mk(e){return(e.kind==="freetext"||e.kind==="recommendation"||e.kind==="choice")&&e.writes===void 0}s(mk,"isProseResult");function Bp(e){return e.kind==="record"?(e.fields??[]).filter(t=>typeof t.writes=="string"&&t.writes.length>0&&fk(t.type)).map(t=>({key:t.writes,valueType:bH(t),field:t})):vH(e)}s(Bp,"draftResultStoreWrites");function vH(e){let t=Ri[e.kind].valueType;return e.writes===void 0||t===null?[]:[{key:e.writes,valueType:t}]}s(vH,"singleStoreWrite");var IN="team:";function ga(e){if(e==="all")return{kind:"all"};if(e==="external"||e.length===0)return null;if(e.startsWith(IN)){let t=e.slice(IN.length);return t.length===0?null:{kind:"team",groupKey:t}}return{kind:"channel",channelKey:e}}s(ga,"parseTaskResultChat");var Ye={unknownKind:"[taskResult/unknownKind]",onApproval:"[taskResult/onApproval]",unknownField:"[taskResult/unknownField]",choiceOptions:"[taskResult/choiceOptions]",textRequiredOnFreetext:"[taskResult/textRequiredOnFreetext]",chatMissing:"[taskResult/chatMissing]",chatExternal:"[taskResult/chatExternal]",chatUnknownChannel:"[taskResult/chatUnknownChannel]",appointmentMissingTitle:"[taskResult/appointmentMissingTitle]",pricedItemMissingItem:"[taskResult/pricedItemMissingItem]",pricedItemUnknownItem:"[taskResult/pricedItemUnknownItem]",pricedItemNotInProgram:"[taskResult/pricedItemNotInProgram]",pricedItemOfferWithoutProgram:"[taskResult/pricedItemOfferWithoutProgram]",itemOnNonPricedItem:"[taskResult/itemOnNonPricedItem]",writesOnProse:"[taskResult/writesOnProse]",labelMissing:"[taskResult/labelMissing]",appointmentInvalidDuration:"[taskResult/appointmentInvalidDuration]",recordFields:"[taskResult/recordFields]",fieldsOnNonRecord:"[taskResult/fieldsOnNonRecord]",recordSuggest:"[taskResult/recordSuggest]",recordText:"[taskResult/recordText]",recordPerson:"[taskResult/recordPerson]",recordAssignment:"[taskResult/recordAssignment]",reductionPrices:"[taskResult/reductionPrices]"};var xH=new Set(["if","else","in","true","false","null"]),SH=new Set(["==","!=","<=",">=","&&","||"]);function AH(e){return e>="0"&&e<="9"}s(AH,"isDigit");function TH(e){return/[a-zA-Z_$]/.test(e)}s(TH,"isIdentStart");function RH(e){return/[a-zA-Z0-9_.$]/.test(e)}s(RH,"isIdentCont");function $H(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n);if(r===" "||r===" "||r===`
|
|
@@ -11995,7 +11996,7 @@ ${n.length} unusable ${o}:
|
|
|
11995
11996
|
`),r.length>0&&this.context.stdout.write(` ${r.length} linkable \u2014 plexus-cli platform users relink-auth <email>
|
|
11996
11997
|
`),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>
|
|
11997
11998
|
`)}else this.context.stdout.write(`No unusable identities.
|
|
11998
|
-
`);return n.length>0?1:0}},TE=class extends Rr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=E.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.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 Cz(e,t){if(e===t)throw new g("Pass exactly one of --on or --off.");return e}s(Cz,"requireOnOff");var Dz=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,sf,wE,kE,bE,vE,xE,SE,AE,TE];function Fz(e){return e.de??e.en??Object.values(e)[0]??""}s(Fz,"titleDe");function Dte(e){return{id:e._id,kind:e.kind,status:e.status,title:Fz(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Dte,"row");var Fte=["id","kind","status","title","assignee","group","outcome"],EE=class extends P{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=E.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.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:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Dte),Fte),0}},IE=class extends P{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=E.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.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:te(this.workItemId,"work item")});if(r===null)throw new g(`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:Fz(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}},OE=class extends P{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=E.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.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:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},_E=class extends P{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=E.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.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:te(this.workItemId,"work item"),...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}},NE=class extends P{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=E.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.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:te(this.workItemId,"work item"),...this.user?{userId:te(this.user,"user")}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},Lz=[EE,IE,OE,_E,NE];var Tl=[...$_,...J0,...oM,...cq,...mq,...dq,...Kq,...Wq,...zq,...Nz,...Dz,..._z,...fG,...wG,...SG,...C0,...Fq,...kz,...A_,...rN,...k0,...Jq,...Hq,...Xq,...nK,...Cq,...bq,...Lz,...SB,...fU,...cG,...pU,...rz,...cz,...AG,...PG,...FG,...KG,...VG,...pz,...Az,...W_];for(let e of Tl){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:KI(e.usage.category,t.join(" "))})}var Mz="0.1.340";function PE(){return Tl.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=FI[zo(n)];return{path:n,effect:vi(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(PE,"plexusCommandCatalog");import js from"node:path";function Lte(e){let t=mt()?.workspaceRoot??process.cwd(),n=js.resolve(t,e),r=js.relative(t,n);if(js.isAbsolute(e)||r===".."||r.startsWith(`..${js.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Lte,"workspacePath");function Mte(e){let{absolute:t,relative:n}=Lte(e.path??".");if(e.operation==="list"){if(!Re(t))return{files:[]};let r=[],i=s(o=>{for(let a of Wr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=js.join(o,a.name);if(a.isDirectory()?i(l):r.push(js.relative(t,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ne(t);if(r.length>10*1024*1024)throw new g("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 g("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 g("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new g("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 g("plexus: the edited file exceeds 10 MB.");return Qe(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 g("plexus: file content is missing or too large.");return zt(js.dirname(t),{recursive:!0}),Qe(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Gs(t),{path:n,removed:!0};throw new g("plexus: unknown workspace operation.")}s(Mte,"plexusWorkspace");function qz(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=od[n];if(!o||!Object.hasOwn(od,n))throw new g("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new g("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 g("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(Cw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Cw[i.path],skillHash:wp}}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 g("plexus: invalid workspace input.");return Mte(i)},"executePlexusAgentTool")}s(qz,"createPlexusAgentToolExecutor");var qte=["--env","--tenant"];function Kz(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}let o=qte.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?t.push(i):i!==o?n.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(n.push({name:o,value:a}),r++):t.push(i)}return{rest:t,given:n}}s(Kz,"splitGlobalOptions");function jz(e,t){let n=Wy(e)==="offline";if(n&&vi(e)==="read")return t.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11999
|
+
`);return n.length>0?1:0}},TE=class extends Rr{static{s(this,"UsersRelinkAuthCommand")}static paths=[["platform","users","relink-auth"],["users","relink-auth"]];static usage=E.Usage({category:"Users",description:"Relink a user's identity row to its live Better Auth account (heals an orphan)."});email=f.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 Cz(e,t){if(e===t)throw new g("Pass exactly one of --on or --off.");return e}s(Cz,"requireOnOff");var Dz=[lE,dE,cE,uE,fE,pE,mE,hE,gE,yE,sf,wE,kE,bE,vE,xE,SE,AE,TE];function Fz(e){return e.de??e.en??Object.values(e)[0]??""}s(Fz,"titleDe");function Dte(e){return{id:e._id,kind:e.kind,status:e.status,title:Fz(e.title).slice(0,50),assignee:e.assigneeUserId??"",group:e.queueGroupId??"",outcome:e.outcome??""}}s(Dte,"row");var Fte=["id","kind","status","title","assignee","group","outcome"],EE=class extends P{static{s(this,"WorkItemsListCommand")}static paths=[["work-items","list"]];static usage=E.Usage({category:"Work-Items",description:"List work-items for the active tenant (filter by --mine/--application/--group)."});mine=f.Boolean("--mine",!1,{description:"Only items assigned to me."});application=f.String("--application",{description:"Filter by application id."});group=f.String("--group",{description:"Filter by team (permission-group) id."});assignee=f.String("--assignee",{description:"Filter by assignee users._id."});openOnly=f.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:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{},...this.openOnly?{openOnly:!0}:{}});return this.print(r,i=>i.map(Dte),Fte),0}},IE=class extends P{static{s(this,"WorkItemsShowCommand")}static paths=[["work-items","show"]];static usage=E.Usage({category:"Work-Items",description:"Show one work-item by id."});workItemId=f.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:te(this.workItemId,"work item")});if(r===null)throw new g(`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:Fz(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}},OE=class extends P{static{s(this,"WorkItemsCreateCommand")}static paths=[["work-items","create"]];static usage=E.Usage({category:"Work-Items",description:"Create a manual task work-item."});title=f.String("--title",{required:!0,description:"Task title."});description=f.String("--description",{description:"Task description."});application=f.String("--application",{description:"Link to an application id."});group=f.String("--group",{description:"Team (permission-group) id whose queue holds the task."});assignee=f.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:te(this.application,"application")}:{},...this.group?{queueGroupId:te(this.group,"permission group")}:{},...this.assignee?{assigneeUserId:te(this.assignee,"user")}:{}});return this.print({workItemId:r.workItemId},i=>[{field:"workItemId",value:i.workItemId}]),0}},_E=class extends P{static{s(this,"WorkItemsCompleteCommand")}static paths=[["work-items","complete"]];static usage=E.Usage({category:"Work-Items",description:"Complete a work-item (optionally with an outcome)."});workItemId=f.String({required:!0,name:"workItemId"});outcome=f.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:te(this.workItemId,"work item"),...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}},NE=class extends P{static{s(this,"WorkItemsAssignCommand")}static paths=[["work-items","assign"]];static usage=E.Usage({category:"Work-Items",description:"Assign a work-item to a user (omit --user to unassign)."});workItemId=f.String({required:!0,name:"workItemId"});user=f.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:te(this.workItemId,"work item"),...this.user?{userId:te(this.user,"user")}:{}});return this.print({workItemId:r.workItemId,assignee:this.user??"(cleared)"},i=>[{field:"workItemId",value:i.workItemId},{field:"assignee",value:i.assignee}]),0}},Lz=[EE,IE,OE,_E,NE];var Tl=[...$_,...J0,...oM,...cq,...mq,...dq,...Kq,...Wq,...zq,...Nz,...Dz,..._z,...fG,...wG,...SG,...C0,...Fq,...kz,...A_,...rN,...k0,...Jq,...Hq,...Xq,...nK,...Cq,...bq,...Lz,...SB,...fU,...cG,...pU,...rz,...cz,...AG,...PG,...FG,...KG,...VG,...pz,...Az,...W_];for(let e of Tl){let t=e.paths?.[0];t===void 0||!Object.hasOwn(e,"usage")||e.usage===void 0||(e.usage={...e.usage,category:KI(e.usage.category,t.join(" "))})}var Mz="0.1.342";function PE(){return Tl.flatMap(e=>(e.paths??[]).map(t=>{let n=t.join(" "),r=FI[zo(n)];return{path:n,effect:vi(n),host:r===void 0?"shared":"terminal",...r===void 0?{}:{reason:r}}})).sort((e,t)=>e.path.localeCompare(t.path))}s(PE,"plexusCommandCatalog");import js from"node:path";function Lte(e){let t=mt()?.workspaceRoot??process.cwd(),n=js.resolve(t,e),r=js.relative(t,n);if(js.isAbsolute(e)||r===".."||r.startsWith(`..${js.sep}`))throw new g("plexus: use a relative path inside the current workspace.");return{absolute:n,relative:r}}s(Lte,"workspacePath");function Mte(e){let{absolute:t,relative:n}=Lte(e.path??".");if(e.operation==="list"){if(!Re(t))return{files:[]};let r=[],i=s(o=>{for(let a of Wr(o,{withFileTypes:!0})){if(a.isSymbolicLink())throw new g("plexus: workspace symlinks are not supported.");let l=js.join(o,a.name);if(a.isDirectory()?i(l):r.push(js.relative(t,l)),r.length>200)throw new g("plexus: the workspace contains too many files. List a subdirectory.")}},"visit");return i(t),{files:r.sort()}}if(!n)throw new g("plexus: name a workspace file.");if(["read","search","edit"].includes(e.operation)){let r=Ne(t);if(r.length>10*1024*1024)throw new g("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 g("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 g("plexus: edit needs oldText and replacement content.");let o=i.indexOf(e.oldText);if(o<0||o!==i.lastIndexOf(e.oldText))throw new g("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 g("plexus: the edited file exceeds 10 MB.");return Qe(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 g("plexus: file content is missing or too large.");return zt(js.dirname(t),{recursive:!0}),Qe(t,e.content,"utf8"),{path:n,sizeBytes:Buffer.byteLength(e.content)}}if(e.operation==="remove")return Gs(t),{path:n,removed:!0};throw new g("plexus: unknown workspace operation.")}s(Mte,"plexusWorkspace");function qz(e){return s(async function(n,r){if(!r||typeof r!="object"||Array.isArray(r))throw new g("plexus: tool input must be an object.");let i=r,o=od[n];if(!o||!Object.hasOwn(od,n))throw new g("plexus: unknown agent tool.");if(Object.keys(i).some(a=>!Object.hasOwn(o.inputSchema.properties,a)))throw new g("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 g("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(Cw,i.path))throw new g("plexus: unknown skill reference. Start with SKILL.md.");return{path:i.path,content:Cw[i.path],skillHash:wp}}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 g("plexus: invalid workspace input.");return Mte(i)},"executePlexusAgentTool")}s(qz,"createPlexusAgentToolExecutor");var qte=["--env","--tenant"];function Kz(e){let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(i==="--"){t.push(...e.slice(r));break}let o=qte.find(l=>i===l||i.startsWith(`${l}=`)),a=e[r+1];o===void 0?t.push(i):i!==o?n.push({name:o,value:i.slice(o.length+1)}):a!==void 0&&!a.startsWith("-")?(n.push({name:o,value:a}),r++):t.push(i)}return{rest:t,given:n}}s(Kz,"splitGlobalOptions");function jz(e,t){let n=Wy(e)==="offline";if(n&&vi(e)==="read")return t.map(i=>`plexus-cli: ${i.name} ${i.value} has no effect: \`${e}\` runs offline (this CLI's own files, no deployment).
|
|
11999
12000
|
`);let r=[...new Set(t.map(i=>i.name))].join(", ");throw new g(n?`\`${e}\` does not take ${r}: it never targets a chosen deployment \u2014 drop the option.`:`\`${e}\` does not take ${r}.`)}s(jz,"globalOptionNotes");var wy=qz({inspectCommand:Bz,executeCommand:Uz});function ky(){let e=new Hs({binaryLabel:"Plexus CLI",binaryName:"plexus-cli",binaryVersion:Mz});e.register(Ll.HelpCommand),e.register(Ll.VersionCommand);for(let r of Tl)e.register(r);function t(r,i){try{return{command:e.process(r,i),notes:[]}}catch(o){let{rest:a,given:l}=Kz(r);if(l.length===0)throw o;let d;try{d=e.process(a,i)}catch{throw o}if(!Tl.some(u=>d instanceof u))return{command:d,notes:[]};let c=d.path.join(" ");if(!PE().some(u=>u.path===c))throw o;return{command:d,notes:jz(c,l)}}}s(t,"resolve");async function n(r,i){let o=i.stderr??process.stderr,a;try{a=t(r,i)}catch(l){return o.write(e.error(l,{colored:!1})),2}for(let l of a.notes)o.write(l);return Vte(a.command,o),e.run(a.command,i)}return s(n,"run"),{process(r,i){return t(r,i).command},run:n,async runExit(r,i){process.exitCode=await n(r,i)}}}s(ky,"createPlexusCli");function Vte(e,t){let n=e.path.join(" "),r=e.constructor.paths?.[0]?.join(" ");r!==void 0&&n!==r&&Bl[n]===r&&ft(t,n,r),n in Bl&&vi(n)==="confirm"&&!Ul(e)&&t.write(`plexus-cli: \`${Bl[n]}\` only prints its plan without --confirm \u2014 nothing was changed.
|
|
12000
12001
|
`)}s(Vte,"noteRetiredPath");function Bz(e){let t=ky().process(El(e),{executePlexusAgentTool:wy}),n=t.path.join(" ");if(n.startsWith("agent "))throw new Error("plexus: nested agent transports are not allowed.");let r=PE().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"?Oh(sl(al),i.fn??"",i.kind):void 0,a=jf(n,{confirm:Ul(t),callKind:o});return{...r,writes:a}}s(Bz,"inspectPlexusCommand");async function Uz(e,t){if(t)return KE(t,()=>Uz(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=ky();if(mt()){let l=Bz(e.argv);if(l.host==="terminal")throw new Error(`plexus: this command requires a local machine. ${l.reason??""}`)}return{exitCode:await i.run(El(e.argv),{executePlexusAgentTool:wy,stdin:jte.from(e.stdin===void 0?[]:[e.stdin]),stdout:new Vz({write(l,d,c){n+=String(l),c()}}),stderr:new Vz({write(l,d,c){r+=String(l),c()}})}),stdout:n,stderr:r}}s(Uz,"executePlexusCommand");ME();GE({source:Bte.join(import.meta.dirname,"skill")});ky().runExit(El(process.argv.slice(2)),{executePlexusAgentTool:wy});
|
|
12001
12002
|
//# sourceMappingURL=cli.mjs.map
|