@unbrained/pm-cli 2026.11.25 → 2026.11.26
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/.claude-plugin/marketplace.json +1 -1
- package/dist/cli/commander-usage.js +9 -9
- package/dist/cli/error-guidance.js +5 -5
- package/dist/cli/help-content.js +4 -4
- package/dist/cli/register-setup.js +1 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-LPW7S5KA.js → chunk-5AAIRHNE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-5BPDT7G2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7EPYCU7U.js → chunk-5FY2VHRF.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-YIGBEY7K.js → chunk-7F3UFYZA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-B2GM6KOM.js +2 -0
- package/dist/cli-bundle/chunks/chunk-BITDGTAX.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-L6VS7F3R.js → chunk-CBBKXTJG.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DUJSME77.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-OWK2JL4I.js → chunk-DYL2N3OC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GBVF2ZB3.js → chunk-FWBR3OW7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OS5W4ZG2.js → chunk-GQXK4KKH.js} +31 -31
- package/dist/cli-bundle/chunks/{chunk-FHLOGAGA.js → chunk-HOLQZ56F.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-HTGN24XM.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-K34FR5CO.js → chunk-IGW3RVJC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FVY7U3SU.js → chunk-KCRRTJ4X.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DF6A7C32.js → chunk-KES4VHU4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CZEMEPPQ.js → chunk-LNZKNVMT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-MNFCJNQA.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-CONBVY2O.js → chunk-NDS4MXZX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BVJMVU4Z.js → chunk-PQSEEVOA.js} +6 -6
- package/dist/cli-bundle/chunks/chunk-QMM46SJM.js +4 -0
- package/dist/cli-bundle/chunks/chunk-RFK3ERYX.js +2 -0
- package/dist/cli-bundle/chunks/chunk-T3GJPXIZ.js +69 -0
- package/dist/cli-bundle/chunks/{chunk-CNUFU454.js → chunk-WZOJSHJT.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-C4KIZQHW.js → chunk-XRCE4QNL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SCIPT7WF.js → chunk-ZDL45VTB.js} +2 -2
- package/dist/cli-bundle/chunks/{field-option-collisions-QE65APSD.js → field-option-collisions-CGRJEAPQ.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-INDHJV6X.js → item-revision-FGDR5NSF.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-C3KAMEYO.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-actor-KU7BMLUN.js → mutation-actor-HGG47KXV.js} +2 -2
- package/dist/cli-bundle/chunks/{mutation-admission-3OMCTQD4.js → mutation-admission-LLHIRY6O.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-3GV3LBOT.js → register-list-query-EKSCZWEZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-GZLF47SX.js → register-mutation-ZIAOKKUJ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-PBJZGCAL.js → register-operations-ECVBZ5FM.js} +2 -2
- package/dist/cli-bundle/chunks/register-setup-3QYD5H4H.js +2 -0
- package/dist/cli-bundle/chunks/{stage-3WIZBD4N.js → stage-RSCSUYEJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VU2PH4PF.js → chunk-3BR5NWQI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BOIMP2AR.js → chunk-3GQRWIT5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-X4EWD6TL.js → chunk-AAB3ZR7Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C3FEDTSD.js → chunk-AVLB4L7M.js} +26 -26
- package/dist/cli-bundle/focused-chunks/{chunk-5RBC4WSE.js → chunk-FQWKESMI.js} +58 -59
- package/dist/cli-bundle/focused-chunks/{chunk-BYQK5DGH.js → chunk-FW5Q26HA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GQBWI4KA.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TQIKDFOD.js → chunk-IWEGGRRD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZLRRII55.js → chunk-JUG3BAZZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KEZ4VXYD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XKLBTDJ7.js → chunk-NSFS3VWP.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-TRL4JDWX.js → chunk-NXUFVQ33.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YYEWIKNI.js → chunk-QNWNUQSJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-QSRXF6XS.js +15 -0
- package/dist/cli-bundle/focused-chunks/{chunk-WVA5KOXF.js → chunk-R6QFPHWW.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-PKX2EHE3.js → chunk-RDELKGLS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3Y5PTQ2F.js → chunk-RFJ3MEFP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SXC2EO3E.js → chunk-RMJKVQYE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UWWAVXG4.js → chunk-TNVLDU7Z.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-UA2JNKMY.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-7SSGTGZO.js → chunk-VV2QF5IE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MB56Y4M6.js → chunk-WHHFPATO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JOKRDFMQ.js → chunk-YNRW2FWB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4LQL4EO6.js → chunk-YSZZSV6M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{field-option-collisions-5ROXGUME.js → field-option-collisions-WV6GPYYP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-KYMSQVZE.js → item-revision-RPTXN7WW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-I4HLVHEJ.js → item-transaction-A6MVNPT7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-actor-GGOQKAE6.js → mutation-actor-6ZVW6OME.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-OS36ZCMH.js → mutation-admission-2DA4CINP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-4ZFWJUKO.js → stage-RG3PKST7.js} +2 -2
- package/dist/cli-bundle/main.js +26 -26
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +4 -4
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +63 -63
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +11 -11
- package/dist/core/reproducibility/context.d.ts +2 -0
- package/dist/core/reproducibility/context.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +17 -0
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/completion/shared.d.ts +1 -1
- package/dist/sdk/completion/shared.js +1 -1
- package/dist/sdk/extension/bundled-catalog.js +1 -1
- package/dist/sdk/extension/install-sources.js +5 -5
- package/dist/sdk/extension/listing-fields.d.ts +15 -0
- package/dist/sdk/extension/listing-fields.js +2 -0
- package/dist/sdk/extension/managed-update-status.js +1 -1
- package/dist/sdk/extension/npm-spec.d.ts +18 -0
- package/dist/sdk/extension/npm-spec.js +2 -0
- package/dist/sdk/extension/static-inventory.d.ts +53 -1
- package/dist/sdk/extension/static-inventory.js +1 -1
- package/dist/sdk/extension/update-check.js +1 -1
- package/dist/sdk/extension/update-observations.js +3 -0
- package/dist/sdk/extension/upgrade-hints.js +2 -0
- package/dist/sdk/extension.d.ts +2 -0
- package/dist/sdk/extension.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/upgrade.d.ts +7 -2
- package/dist/sdk/governance/upgrade.js +2 -2
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/context.d.ts +20 -7
- package/dist/sdk/query/context.js +4 -2
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/testing.d.ts +20 -2
- package/docs/COMMANDS.md +19 -1
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +6 -0
- package/docs/EXTENSION_LIFECYCLE.md +72 -2
- package/docs/SDK.md +21 -2
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-4FZH5BTV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-GZI7ZAB7.js +0 -2
- package/dist/cli-bundle/chunks/chunk-LOX3VY4T.js +0 -2
- package/dist/cli-bundle/chunks/chunk-VA4T37Q4.js +0 -70
- package/dist/cli-bundle/chunks/chunk-WQOEVGLQ.js +0 -2
- package/dist/cli-bundle/chunks/chunk-XHCIOLJP.js +0 -3
- package/dist/cli-bundle/chunks/chunk-XKWJONAO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-ZBOQEZ2H.js +0 -33
- package/dist/cli-bundle/chunks/chunk-ZLICQPRG.js +0 -3
- package/dist/cli-bundle/chunks/item-transaction-LCKK4XXB.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-ZLJEF6NZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-A4R57E4K.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-IAOKVKWW.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VMYVN36N.js +0 -13
- package/dist/cli-bundle/focused-chunks/chunk-WL2R7T5G.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{B as U,R as v}from"./chunk-OCKKIECS.js";import{A as m,z as p}from"./chunk-NGFDPEP7.js";import Oe from"node:crypto";function xe(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function Ce(e){let t=Object.keys(e).sort(),n={};for(let r of t){let o=e[r];o!==void 0&&(n[r]=$(o))}return n}function $(e){let t=xe(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(r=>$(r));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let r=n.toJSON();if(r!==e)return $(r)}return Ce(e)}function _(e){return JSON.stringify($(e))}function j(e,t,n,r){for(let o=0;o<t.length;o+=1)if(!n.has(o)&&r(e,t[o]))return n.add(o),!0;return!1}function Me(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Te(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Re(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],r=new Set;for(let o of e)if(!j(o,n,r,E))return!1;return!0}function De(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],r=new Set;for(let[o,i]of e.entries())if(!j([o,i],n,r,([a,c],[u,l])=>E(a,u)&&E(c,l)))return!1;return!0}function Ie(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>E(n,t[r]))}function Ne(e,t){let n=Object.keys(e).sort((o,i)=>o.localeCompare(i)),r=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1){let i=n[o];if(i!==r[o]||!E(e[i],t[i]))return!1}return!0}var ke=[Me,Te,Re,De,Ie];function E(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of ke){let r=n(e,t);if(r!==void 0)return r}return Ne(e,t)}function an(e){return Oe.createHash("sha256").update(e,"utf8").digest("hex")}function cn(e,t){let n={};for(let o of t){let i=e[o];i!==void 0&&(n[o]=i)}let r=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of r){let i=e[o];i!==void 0&&(n[o]=i)}return n}var Le=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),Pe=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),Fe=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),Ue=[...Pe,...Fe,...["init","config","schema","profile"].map(e=>({alias:e,canonical:`workspace ${e}`,canonical_argv:["workspace",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],C=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...Le,...Ue,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function ln(e){let t;for(let n of C)n.canonical_argv.length<=(t?.canonical_argv.length??0)||n.canonical_argv.every((r,o)=>r===(o===0&&e[o]==="ctx"?"context":e[o]))&&(t=n);return t}function ve(e){let t=e.trim().replace(/\s+/gu," ");return C.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function dn(e){return ve(e)}var z=[...C,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[t],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","package catalog"],["packages scaffold","package init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],fn=Object.fromEntries(z.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function pn(e){let t=e.trim().toLowerCase();return z.find(n=>n.alias===t)}function mn(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.join(" ")}\`.`}import je from"node:crypto";import{AsyncLocalStorage as ze}from"node:async_hooks";var q=new ze,H=1024;function W(){let e=q.getStore();if(e===void 0)return;let t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function _n(e){let t=q.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>H)throw new Error(`Reproducible token length must be an integer between 0 and ${H}`);let n="";for(;n.length<e;){let r=je.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(let o of r)if(n+=(o%36).toString(36),n.length===e)break}return n}var He=/^([+-]?)(\d+)([hdwm])$/i,qe=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,We=/^(\d{4})(\d{2})(\d{2})$/,Ve=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Be=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Ge=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Ze=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function wn(){return W()??new Date().toISOString()}function On(e){return Number.isFinite(Date.parse(e))}function R(e){let t=Ze.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;let[,n,r,o,i,s,a,c,u]=t,[l,d,f,g,h,y]=[n,r,o,i,s,a].map(Number);return d>=1&&d<=12&&f>=1&&f<=D(l,d-1)&&g<=23&&h<=59&&y<=59&&(c===void 0||Number(c)<=23)&&(u===void 0||Number(u)<=59)}function xn(e){let t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return R(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}var Ke=1e4,b=new Map;function V(e){let t=b.get(e);if(t!==void 0)return t;let n=Date.parse(e);return b.size>=Ke&&U(b),b.set(e,n),n}function A(e,t){let n=V(e),r=V(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t)}function Cn(e,t){return!(t.deadlineBefore&&(!e.deadline||A(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||A(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&A(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&A(e.updated_at,t.updatedBefore)>0||t.createdAfter&&A(e.created_at,t.createdAfter)<0||t.createdBefore&&A(e.created_at,t.createdBefore)>0)}function M(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function T(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";let t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function Xe(e,t,n){n&&n!==t&&(e.includes(n)||e.push(n))}function Ye(e){let t=[],n=u=>Xe(t,e,u),r=We.exec(e);if(r){let[,u,l,d]=r;n(`${u}-${l}-${d}`)}let o=Ve.exec(e);if(o){let[,u,l,d,f,g,h,y,be]=o,we=h?`:${h}`:"";n(`${u}-${l}-${d}T${f}:${g}${we}${M(y)}${T(be)}`)}let i=Be.exec(e);if(i){let[,u,l,d,f,g,h]=i,y=f?`:${f}`:"";n(`${u}T${l}:${d}${y}${M(g)}${T(h)}`)}let s=Ge.exec(e);if(s){let[,u,l,d,f,g,h]=s,y=f?`:${f}`:"";n(`${u}T${l}:${d}${y}${M(g)}${T(h)}`)}let a=10,c=e.slice(0,a);if(Qe(c)){let u=a;for(;u<e.length&&et(e[u]);)u+=1;u<e.length&&n(`${c}T${e.slice(u)}`)}return t}function Je(e){let t=Date.parse(e);if(Number.isFinite(t))return t;for(let n of Ye(e)){let r=Date.parse(n);if(Number.isFinite(r))return r}return Number.NaN}function Qe(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){let n=e[t];if(t===4||t===7){if(n!=="-")return!1;continue}let r=n.charCodeAt(0);if(r<48||r>57)return!1}return!0}function et(e){return e?e===" "||e===" "||e===`
|
|
2
|
-
`||e==="\r"||e==="\f"||e==="\v":!1}function D(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}var tt=["January","February","March","April","May","June","July","August","September","October","November","December"],nt=/^(\d{4})-(\d{2})-(\d{2})/,rt=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function ot(e,t,n){let r=nt.exec(t)??rt.exec(t);if(!r)return;let o=Number.parseInt(r[1],10),i=Number.parseInt(r[2],10),s=Number.parseInt(r[3],10),a=n?.trim()||"deadline";if(i<1||i>12)throw new m(`Invalid ${a} value "${e}". Month "${r[2]}" is out of range \u2014 use a month between 01 and 12.`,p.USAGE,{field:a,value:e});let c=D(o,i-1);if(s<1||s>c)throw new m(`Invalid ${a} value "${e}". ${tt[i-1]} ${o} has ${c} days, so day "${r[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,p.USAGE,{field:a,value:e})}function it(e,t){let n=new Date(e.getTime()),r=n.getUTCDate(),o=n.getUTCMonth()+t,i=n.getUTCFullYear()+Math.floor(o/12),s=(o%12+12)%12,a=Math.min(r,D(i,s));return n.setUTCFullYear(i,s,a),n}function Mn(e,t=new Date,n="deadline"){let r=e.trim();if(r.toLowerCase()==="now")return t.toISOString();let o=He.exec(r);if(o){let s=o[1]==="-"?-1:1,a=Number.parseInt(o[2],10)*s,c=o[3].toLowerCase();if(c==="m")return it(t,a).toISOString();let u=c==="h"?3600*1e3:c==="d"?1440*60*1e3:10080*60*1e3;return new Date(t.getTime()+a*u).toISOString()}ot(e,r,n);let i=Je(r);if(!Number.isFinite(i)){let s=n.trim().length>0?n.trim():"deadline",a=qe.test(r)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new m(`Invalid ${s} value "${e}". ${a}`,p.USAGE,{field:s,value:e})}return new Date(i).toISOString()}import{AsyncLocalStorage as ht}from"node:async_hooks";var st="PM_COMMAND_SHELL",at=new Map([["posix","posix"],["sh","posix"],["bash","posix"],["zsh","posix"],["cmd","cmd"],["cmd.exe","cmd"],["powershell","powershell"],["pwsh","powershell"]]),G=(e=process.platform,t=process.env)=>{let n=t[st]?.trim().toLowerCase(),r=n===void 0?void 0:at.get(n);return r!==void 0?r:e==="win32"?"cmd":"posix"},Z=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},B=new Set(["(",")","!","^",'"',"<",">","&","|"]),K=e=>{let t="";for(let n=0;n<e.length;n+=1){let r=e[n];if(B.has(r)){t+=`^${r}`;continue}t+=r,r==="%"&&!B.has(e.charAt(n+1))&&(t+="^")}return t},ct=/["%]/u,ut=/\r\n|[\r\n]/gu,lt=e=>{let t=e.replace(ut," "),n=Z(t);return ct.test(t)?K(n):n},dt=/['\u2018\u2019\u201A\u201B]/gu,X=e=>e.replace(dt,"$&$&"),ft=e=>`'${X(e)}'`,pt={posix:/^(?!=)[A-Za-z0-9._:/@=-]+$/u,cmd:/^[A-Za-z0-9._:/\\@=-]+$/u,powershell:/^(?!--$)[A-Za-z0-9._:/\\=-][A-Za-z0-9._:/\\@=-]*$/u},mt=(e,t=process.platform,n)=>{let r=n??G(t);return pt[r].test(e)?e:r==="cmd"?lt(e):r==="powershell"?ft(e):gt(e)},gt=e=>e.includes("!")?`'${e.replaceAll("'","'\\''")}'`:`"${e.replace(/(["\\$`])/g,"\\$1")}"`,Rn=(e,t=process.platform,n)=>{let r=n??G(t),o=e.map(i=>mt(i,t,r)).join(" ");return o.length>0?`pm ${o}`:"pm"};var te="[redacted]",yt=/%\^?40/giu,N=/@|%\^?40/iu;function ne(e,t=e.length){let n=-1;for(let r of e.matchAll(yt)){if(r.index>t)break;n=r.index}return n}function _t(e,t){if(/[\t\n\r]/u.test(e)||!/(?:^|[^A-Za-z0-9+.-])(?:https?|wss?|ftp)$/iu.test(e.slice(0,t)))return!1;let n=t+1;for(;e[n]==="/"||e[n]==="\\";)n+=1;let r=e.indexOf("/",n)-n;if(r<0)return!1;let o=n+r;return!/[:@%]/u.test(e.slice(n,o))&&!/[:%]|[/\\][/\\]/u.test(e.slice(o))}function re(e){let t=Math.max(e.lastIndexOf("@"),ne(e)),n=e.indexOf(":");if(t<0||n<0||n>t)return;let r=n+1;for(;r<t&&r<n+3&&(e[r]==="/"||e[r]==="\\");)r+=1;return r===t||_t(e,n)?void 0:[r,t]}function k(e){let t=re(e);return t?`${e.slice(0,t[0])}${te}${e.slice(t[1])}`:e}function oe(e){return k(e)}var ie=["author","assignee","claim_principal"];function Pn(e){let t={...e};for(let n of ie)typeof t[n]=="string"&&(t[n]=oe(t[n]));return t}function se(e,t){if(!(typeof e!="string"||re(e.trim())===void 0))throw new m(`${t} must not carry URL credentials: an identity is a name, never a credential.`,p.USAGE,{code:"invalid_argument_value",field:t,required:`Set ${t} to a plain name such as agent-a, with no URL userinfo (no user, password or token before the host).`,nextSteps:[`Rerun with ${t} set to a plain name.`],url_credentials_rejected:{source:t}})}function Fn(e,t){return se(e,t),e}var St=[["comments","author"],["notes","author"],["learnings","author"],["dependencies","author"],["plan_decisions","author"],["plan_discoveries","author"],["plan_steps","owner"],["tests","provenance","author"],["tests","updated_by"]],At=4;function I(e,t,n=0){if(typeof e=="string"){se(e,t);return}if(!(n>=At||typeof e!="object"||e===null))for(let r of Object.values(e))I(r,t,n+1)}function Et(e,t){let n=e;for(let r of t){if(typeof n!="object"||n===null||Array.isArray(n))return;n=n[r]}return n}function ae(e){let t=e;for(let n of ie)I(t[n],n);for(let[n,...r]of St){let o=t[n];Array.isArray(o)&&o.forEach((i,s)=>{I(Et(i,r),`${n}[${s}].${r.join(".")}`)})}}function Un(e){return typeof e=="string"?oe(e):e}var $t=6;var bt={carried:!1,fragments:new Set,fragmentLength:$t,shortSpellings:[]},wt=new ht;function Ot(e){let t=e.toLowerCase();if(t.length===e.length)return t;let n="";for(let r of e){let o=r.toLowerCase();n+=o.length===r.length?o:r}return n}function xt(e,t){let n=Ot(e),r=new Uint8Array(e.length),o=!1,i=t.fragmentLength;for(let a=0;a+i<=n.length;a+=1)t.fragments.has(n.slice(a,a+i))&&(r.fill(1,a,a+i),o=!0);for(let a of t.shortSpellings)for(let c=n.indexOf(a);c>=0;c=n.indexOf(a,c+1))r.fill(1,c,c+a.length),o=!0;if(!o)return e;let s="";for(let a=0;a<e.length;a+=1)r[a]?(a===0||!r[a-1])&&(s+=te):s+=e[a];return s}var Ct=16,ce=512,Mt=/^(?:(?:[A-Za-z0-9-]+\.)+[A-Za-z0-9-]+|localhost):\d+$/iu,Tt=260,Rt={'"':'"',"'":"'","`":"`","<":">","(":")","[":"]"},Dt=new Set(["http","https","ws","wss","ftp","file"]);function Y(e,t=!1){let n=Ft(e);if(n<0)return;let r=F(e,n);if(n-r<2)return;let o=Rt[e[r-1]??""],i=Dt.has(e.slice(r,n).toLowerCase()),s=n+1;for(;s<e.length&&(e[s]==="/"||e[s]==="\\");)s+=1;if(s===e.length)return{kind:"pending",closer:o,special:i};let a=L(e.slice(s),o);if(a.startsWith("[")||i&&/[/\\?#]/u.test(a)||P(a,o)>=0)return;let c=Ut(a,t);return c===void 0?void 0:{kind:c,closer:o,special:i}}var It=new Set([")","]"]),Nt="'\\''",kt="'\\\\''";function L(e,t){return t==="'"?J(e.replaceAll(kt,"_____").replaceAll(Nt,"____")):t==='"'?J(e):e}function ue(e,t){let n=t;for(;e[n]==="\\";)n+=1;return n}function Lt(e,t,n){let r=(n-t)%2===1;if(e[n]==='"')return r?n:-1;if(e[n]!=="^")return-1;if(e[n+1]==='"')return r?n+1:-1;let o=ue(e,n+1);return e[o]==='"'&&(o-n-1)%2===1?o:-1}function J(e){let t=[],n=0;for(let r=e.indexOf("\\");r>=0;r=e.indexOf("\\",r)){let o=ue(e,r),i=Lt(e,r,o);i>=0&&(t.push(e.slice(n,r),"_".repeat(i+1-r)),n=i+1),r=i>=0?i+1:o}return n===0?e:`${t.join("")}${e.slice(n)}`}function P(e,t){if(t===void 0)return-1;if(!It.has(t))return Pt(e,t);let n=e.length;for(;n>0&&/[.,;:!?*_~`]/u.test(e[n-1]);)n-=1;return n>0&&e[n-1]===t?n-1:-1}function Pt(e,t){for(let n=e.indexOf(t);n>=0;n=e.indexOf(t,n+1)){if(t==="'"&&e[n+1]==="'"){n+=1;continue}let r=0;for(;n-r>0&&e[n-r-1]==="\\";)r+=1;if(r%2===0)return n}return-1}function Ft(e){let t=-1;for(let n=e.length-2;n>=0;n-=1){if(e[n]!==":"||e[n+1]!=="/"&&e[n+1]!=="\\")continue;let r=F(e,n);if(r===0||/[=?&#"'`(<[{,]/u.test(e[r-1]))return n;t=n}return t}function F(e,t){let n=t;for(;n>0&&/[A-Za-z0-9+.-]/u.test(e[n-1]);)n-=1;return n}function Ut(e,t){return e.includes(":")?!t&&e.length<=Tt&&Mt.test(e)?void 0:"user":N.test(e)?void 0:"label"}function vt(e,t,n,r=-1){let o=Math.min(e.length,t+ce),i=t,s=r,a=n.kind==="user",c=!1;for(let u=0;u<Ct&&i<o;u+=1){let l=le(e,i,o);if(l===void 0)break;let d=Ht(e.slice(l[0],Math.min(l[1],o+3)),o-l[0],n);if(d.startsUrl)break;jt(d,a,c)&&(s=l[1]);let f=/[\t\r\n]/u.test(e[l[1]]??"");if(a||=d.colon||d.trailingColon&&f,c||=d.trailingColon,d.endsAuthority)break;i=l[1]}return s}function jt(e,t,n){return e.separator?t||e.colonBeforeSeparator||n&&(e.hasPath||e.closedByOpener):!1}function le(e,t,n){let r=t;for(;r<n&&/\s/u.test(e[r]);)r+=1;if(r===n)return;let o=r;for(;o<e.length&&!/\s/u.test(e[o]);)o+=1;return[r,o]}function Q(e){let t=e.indexOf(":");return t>=0&&t<e.length-1&&!zt.test(e)}var zt=/^\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[AaPp][Mm])?[.,;:!?)]*$/u;function Ht(e,t,n){let r=L(e,n.closer),o=n.special?r.search(/[/\\?#]/u):-1,i=o<0?r:r.slice(0,o),s=P(i,n.closer),a=r.search(/:[/\\]/u),c=s<0?i:i.slice(0,s),u=Math.min(c.length,t)-1,l=u<0?-1:Math.max(c.lastIndexOf("@",u),ne(c,u));return{startsUrl:a>=0&&s<0&&qt(r.slice(0,a+1)),separator:l>=0,colonBeforeSeparator:l>0&&(Q(c.slice(0,l))||c[l-1]===":"),colon:Q(c),trailingColon:c.endsWith(":"),hasPath:s<0&&l>=0&&/[/\\]/u.test(r.slice(l+1)),closedByOpener:s>=0,endsAuthority:o>=0||s>=0}}function qt(e){let t=F(e,e.length-1);return t<e.length-2&&/[A-Za-z]/u.test(e[t])&&(t===0||t===1&&/["'`(<[]/u.test(e[0]))}function Wt(e,t,n){let r=Y(t,/[\t\r\n]/u.test(e.charAt(n)));if(r?.kind!=="pending")return r===void 0?void 0:{opening:r,from:n,seed:-1,final:!1};let o=le(e,n,Math.min(e.length,n+ce));if(o===void 0)return;let i=L(e.slice(o[0],o[1]),r.closer),s=/^[/\\]*/u.exec(i)[0],a=i.slice(s.length),c=r.special?a.split(/[/\\?#]/u,1)[0]:a,u=P(c,r.closer),l=`${s}${u<0?c:c.slice(0,u)}`,d=N.test(l),f=d?{...r,kind:"user"}:Y(`${t}${l}`);if(f===void 0||f.kind==="pending")return;let g=d?o[1]:-1;return{opening:f,from:o[1],seed:g,final:l.length<i.length}}function Vt(e){if(!/:[/\\]/u.test(e))return e;let t=/\S+/gu,n="",r=0;for(let o=t.exec(e);o!==null;o=t.exec(e)){let i=Wt(e,o[0],o.index+o[0].length);if(i===void 0)continue;let s=i.final?i.seed:vt(e,i.from,i.opening,i.seed);s!==-1&&(n+=`${e.slice(r,o.index)}${k(e.slice(o.index,s))}`,r=s,t.lastIndex=s)}return r===0?e:`${n}${e.slice(r)}`}function vn(e){let t=wt.getStore()??bt,n=ee(e);return t.carried?ee(xt(n,t)):n}function ee(e){return N.test(e)?Vt(e).replaceAll(/\S+/gu,k):e}function Bt(e){let t=e.trim();return t.startsWith("-")&&!t.startsWith("--")}var de=/[\s|,=<>[\]]/u;function Gt(e){let t=e.trim();if(Bt(t))return t.length===2&&!de.test(t[1])?void 0:"is not a short flag: a short flag is one dash and one character";let n=t.replace(/^--/u,"");if(n.length===0)return"is empty";if(n.startsWith("-"))return"starts with three dashes";if(n.endsWith("-")||n.includes("--"))return"has an empty segment between hyphens, which the option parser cannot turn into an option key";let r=de.exec(n)?.[0];if(r!==void 0)return/\s/u.test(r)?"contains whitespace, which the option parser reads as a break between two flags":`contains ${JSON.stringify(r)}, which the option parser reads as ${r==="|"||r===","?"a break between two flags":r==="="?"the start of an attached value":"a value placeholder"}`}var Zt=new Set(["-h","help"]);function fe(e){let t=e.trim();return Gt(t)===void 0&&!Zt.has(t.replace(/^--/u,""))}var Kt=16;function w(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[n,...r]=t;return`${n}${r.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function Kn(e,t,n=new Set,r){if(he(e,t,r))return;let o=ye(e,t,n,r),i=O(e);return[w(e.cli_flag),...i].find(a=>!o.has(a)&&ge(a,i,o))}function ge(e,t,n){for(let r of t){if(r===e)break;if(n.has(r))return!1}return!0}function he(e,t,n){return t.definitions.some(r=>r!==e&&r.metadata_key===e.metadata_key&&(n===void 0||r.commands.includes(n)))}function ye(e,t,n,r){return new Set([...n,...t.definitions.filter(o=>o!==e&&(r===void 0||o.commands.includes(r))).flatMap(o=>O(o))])}function _e(e){return e.replace(/^-+/u,"").startsWith("no-")}function Xt(e){return e.startsWith("-")?e:`--${e}`}function Xn(e,t,n,r){if(he(e,t,r))return;let o=ye(e,t,n.options,r),i=O(e);return[e.cli_flag,...e.cli_aliases].find(s=>{if(!fe(s))return!1;let a=Se(s);return _e(s)||n.flags.has(Xt(s))||o.has(a)?!1:ge(a,i,o)})}function Se(e){return e.replace(/^-+/u,"").replace(/^no-/u,"").split("-").reduce((t,n)=>`${t}${n.charAt(0).toUpperCase()}${n.slice(1)}`)}function O(e){return[...new Set([v(e),w(e.key),w(e.cli_flag),...e.cli_aliases.map(t=>w(t)),...[e.cli_flag,...e.cli_aliases].filter(t=>!_e(t)).map(t=>Se(t))])]}function Ae(e,t){for(let n of O(t)){if(!Object.hasOwn(e,n))continue;let r=e[n];if(r!==void 0)return r}}function Ee(e){return Array.isArray(e)?e.flatMap(t=>Ee(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function pe(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let n=e.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1}throw new m(`${t} must be one of true|false|1|0|yes|no`,p.USAGE)}function me(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let n=typeof e=="string"?e.trim():String(e),r=Number(n);if(!Number.isFinite(r))throw new m(`${t} must be a number`,p.USAGE);return r}function Yt(e,t,n){let r=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(n==="array"&&Array.isArray(r)||n==="object"&&typeof r=="object"&&r!==null&&!Array.isArray(r))return r;throw new m(`${t} must be valid JSON ${n}`,p.USAGE)}function Jt(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function Qt(e,t,n){if(t.const!==void 0&&_(e)!==_(t.const))return`${n} must equal ${_(t.const)}`;if(t.enum!==void 0&&!t.enum.some(r=>_(r)===_(e)))return`${n} must be one of ${t.enum.map(r=>_(r)).join("|")}`;if(!Jt(e,t.type))return`${n} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${n} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!R(e))return`${n} must be an RFC 3339 date-time`}}function en(e,t,n,r){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${n} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=x(i,t.items,`${n}[${o}]`,r+1);if(s)return s}}}function tn(e,t,n,r){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${n}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${n}.${i} is not allowed`;continue}let c=x(s,a,`${n}.${i}`,r+1);if(c)return c}}function x(e,t,n,r=0){if(r>Kt)return`${n} value schema exceeds maximum depth`;let o=Qt(e,t,n);if(o)return o;let i=en(e,t,n,r);if(i)return i;let s=tn(e,t,n,r);if(s)return s;if(!t.one_of)return;let a=0;for(let c of t.one_of)if(x(e,c,n,r+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${n} must match exactly one configured schema variant`}function S(e,t,n){if(!e.value_schema||t===void 0)return t;let r=x(t,e.value_schema,n);if(r)throw new m(r,p.USAGE);return t}function nn(e,t,n,r){let o=r==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return S(e,Yt(o,n,e.type),n)}function $e(e,t,n,r="option"){let o=n??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return nn(e,t,o,r);if(e.repeatable||e.type==="string_array"){let s=Ee(t);return e.type==="number"?S(e,s.map(a=>me(a,o)),o):e.type==="boolean"?S(e,s.map(a=>pe(a,o)),o):S(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?S(e,me(i,o),o):e.type==="boolean"?S(e,pe(i,o),o):S(e,typeof i=="string"?i:String(i),o)}function rn(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(n=>n.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Yn(e,t,n){let r={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Ae(e,i);if(s===void 0){rn(i,n)&&o.push(`--${i.cli_flag}`);continue}r[i.metadata_key]=$e(i,s)}return{values:r,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Jn(e,t,n=["update"]){let r={},o=(n??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Ae(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),r[s.metadata_key]=$e(s,a)))}return ae(r),r}var on=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields",extension_command_availability:"read_output"},{flag:"--output-limit",value_name:"count",extension_command_availability:"read_output"},{flag:"--output-budget",value_name:"tokens",extension_command_availability:"read_output"},{flag:"--output-format",value_name:"toon|json"},{flag:"--output-session",value_name:"state",extension_command_availability:"read_output"},{flag:"--output-cursor",value_name:"cursor",extension_command_availability:"read_output"},{flag:"--output-row-contract",extension_command_availability:"read_output"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"],discovery_value_name:"path"},{flag:"--no-extensions",extension_command_availability:"never"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"},{flag:"--expect-hash",value_name:"revision"}]),er=new Set(on.flatMap(e=>[e.flag,...e.aliases??[]]));export{on as a,er as b,_ as c,E as d,an as e,cn as f,Le as g,Pe as h,Fe as i,Ue as j,C as k,ln as l,ve as m,dn as n,z as o,fn as p,pn as q,mn as r,_n as s,wn as t,On as u,R as v,xn as w,A as x,Cn as y,Mn as z,mt as A,Rn as B,te as C,k as D,oe as E,Pn as F,se as G,Fn as H,ae as I,Un as J,vn as K,Bt as L,Gt as M,Kn as N,Xt as O,Xn as P,Se as Q,O as R,Ae as S,$e as T,rn as U,Yn as V,Jn as W};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{B as v,R as j}from"./chunk-OCKKIECS.js";import{A as m,z as p}from"./chunk-NGFDPEP7.js";import Oe from"node:crypto";function xe(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function Ce(e){let t=Object.keys(e).sort(),n={};for(let r of t){let o=e[r];o!==void 0&&(n[r]=$(o))}return n}function $(e){let t=xe(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(r=>$(r));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let r=n.toJSON();if(r!==e)return $(r)}return Ce(e)}function _(e){return JSON.stringify($(e))}function z(e,t,n,r){for(let o=0;o<t.length;o+=1)if(!n.has(o)&&r(e,t[o]))return n.add(o),!0;return!1}function Me(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function Te(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Re(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],r=new Set;for(let o of e)if(!z(o,n,r,E))return!1;return!0}function De(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],r=new Set;for(let[o,i]of e.entries())if(!z([o,i],n,r,([a,c],[u,l])=>E(a,u)&&E(c,l)))return!1;return!0}function Ie(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>E(n,t[r]))}function Ne(e,t){let n=Object.keys(e).sort((o,i)=>o.localeCompare(i)),r=Object.keys(t).sort((o,i)=>o.localeCompare(i));if(n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1){let i=n[o];if(i!==r[o]||!E(e[i],t[i]))return!1}return!0}var ke=[Me,Te,Re,De,Ie];function E(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of ke){let r=n(e,t);if(r!==void 0)return r}return Ne(e,t)}function an(e){return Oe.createHash("sha256").update(e,"utf8").digest("hex")}function cn(e,t){let n={};for(let o of t){let i=e[o];i!==void 0&&(n[o]=i)}let r=Object.keys(e).filter(o=>!t.includes(o)).sort((o,i)=>o.localeCompare(i));for(let o of r){let i=e[o];i!==void 0&&(n[o]=i)}return n}var Le=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-tqel"})),Pe=[...["next","focus"].map(e=>({alias:e,canonical:`context ${e}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-6apl"})),...["normalize","reindex"].map(e=>({alias:e,canonical:`ops ${e}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(e=>({...e,canonical_argv:e.canonical.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap"})),Fe=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-ik19"})),Ue=[...Pe,...Fe,...["init","config","schema","profile"].map(e=>({alias:e,canonical:`workspace ${e}`,canonical_argv:["workspace",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-npr3"})),...[...["comments","notes","learnings","files","docs","deps","append","test"].map(e=>[e,`item ${e}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(e=>[`completion-${e}`,`completion ${e}`,"pm-szdc"]),["history-author-acknowledge","history acknowledge","pm-djyvbk"],["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"],...["meet","event","remind"].map(e=>[e,`calendar ${e}`,"pm-o3fh"])].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:n}))],C=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:!0,registration:"commander",owner:"pm-3z0k"},...Le,...Ue,...["discover","lookup"].map(e=>({alias:`files ${e}`,canonical:`item files ${e}`,canonical_argv:["item","files",e],lifecycle:"permanent",hidden:!0,registration:"bootstrap",owner:"pm-yql1"}))];function ln(e){let t;for(let n of C)n.canonical_argv.length<=(t?.canonical_argv.length??0)||n.canonical_argv.every((r,o)=>r===(o===0&&e[o]==="ctx"?"context":e[o]))&&(t=n);return t}function ve(e){let t=e.trim().replace(/\s+/gu," ");return C.find(n=>n.canonical===t.replace(/^ctx /u,"context "))?.alias??t}function dn(e){return ve(e)}var H=[...C,...[["ctx","context"],["packages","package"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-pbyu"})),...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([e,t,n])=>({alias:e,canonical:t,canonical_argv:[t,n],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:["comments","notes","learnings"].includes(t)?`item ${t}`:t,canonical_argv:["comments","notes","learnings"].includes(t)?["item",t]:[t],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension scaffold","extension init"],["package scaffold","package init"],["packages scaffold","package init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),...[["extension list","package inventory"],["package list","package inventory"],["packages list","package inventory"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-gh1777"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-tnud"}))],fn=Object.fromEntries(H.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function pn(e){let t=e.trim().toLowerCase();return H.find(n=>n.alias===t)}function mn(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.join(" ")}\`.`}import je from"node:crypto";import{AsyncLocalStorage as ze}from"node:async_hooks";var M=new ze,q=1024;function _n(){return M.getStore()!==void 0}function W(){let e=M.getStore();if(e===void 0)return;let t=new Date(Date.parse(e.clock)+e.clockReads*e.tickMs).toISOString();return e.clockReads+=1,t}function Sn(e){let t=M.getStore();if(t===void 0)return;if(!Number.isSafeInteger(e)||e<0||e>q)throw new Error(`Reproducible token length must be an integer between 0 and ${q}`);let n="";for(;n.length<e;){let r=je.createHash("sha256").update(`${t.seed}\0${t.tokenReads}`).digest();t.tokenReads+=1;for(let o of r)if(n+=(o%36).toString(36),n.length===e)break}return n}var He=/^([+-]?)(\d+)([hdwm])$/i,qe=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,We=/^(\d{4})(\d{2})(\d{2})$/,Ve=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Be=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Ge=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,Ze=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function On(){return W()??new Date().toISOString()}function xn(e){return Number.isFinite(Date.parse(e))}function D(e){let t=Ze.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;let[,n,r,o,i,s,a,c,u]=t,[l,d,f,g,h,y]=[n,r,o,i,s,a].map(Number);return d>=1&&d<=12&&f>=1&&f<=I(l,d-1)&&g<=23&&h<=59&&y<=59&&(c===void 0||Number(c)<=23)&&(u===void 0||Number(u)<=59)}function Cn(e){let t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return D(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}var Ke=1e4,b=new Map;function V(e){let t=b.get(e);if(t!==void 0)return t;let n=Date.parse(e);return b.size>=Ke&&v(b),b.set(e,n),n}function A(e,t){let n=V(e),r=V(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t)}function Mn(e,t){return!(t.deadlineBefore&&(!e.deadline||A(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||A(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&A(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&A(e.updated_at,t.updatedBefore)>0||t.createdAfter&&A(e.created_at,t.createdAfter)<0||t.createdBefore&&A(e.created_at,t.createdBefore)>0)}function T(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function R(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";let t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function Xe(e,t,n){n&&n!==t&&(e.includes(n)||e.push(n))}function Ye(e){let t=[],n=u=>Xe(t,e,u),r=We.exec(e);if(r){let[,u,l,d]=r;n(`${u}-${l}-${d}`)}let o=Ve.exec(e);if(o){let[,u,l,d,f,g,h,y,be]=o,we=h?`:${h}`:"";n(`${u}-${l}-${d}T${f}:${g}${we}${T(y)}${R(be)}`)}let i=Be.exec(e);if(i){let[,u,l,d,f,g,h]=i,y=f?`:${f}`:"";n(`${u}T${l}:${d}${y}${T(g)}${R(h)}`)}let s=Ge.exec(e);if(s){let[,u,l,d,f,g,h]=s,y=f?`:${f}`:"";n(`${u}T${l}:${d}${y}${T(g)}${R(h)}`)}let a=10,c=e.slice(0,a);if(Qe(c)){let u=a;for(;u<e.length&&et(e[u]);)u+=1;u<e.length&&n(`${c}T${e.slice(u)}`)}return t}function Je(e){let t=Date.parse(e);if(Number.isFinite(t))return t;for(let n of Ye(e)){let r=Date.parse(n);if(Number.isFinite(r))return r}return Number.NaN}function Qe(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){let n=e[t];if(t===4||t===7){if(n!=="-")return!1;continue}let r=n.charCodeAt(0);if(r<48||r>57)return!1}return!0}function et(e){return e?e===" "||e===" "||e===`
|
|
2
|
+
`||e==="\r"||e==="\f"||e==="\v":!1}function I(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}var tt=["January","February","March","April","May","June","July","August","September","October","November","December"],nt=/^(\d{4})-(\d{2})-(\d{2})/,rt=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function ot(e,t,n){let r=nt.exec(t)??rt.exec(t);if(!r)return;let o=Number.parseInt(r[1],10),i=Number.parseInt(r[2],10),s=Number.parseInt(r[3],10),a=n?.trim()||"deadline";if(i<1||i>12)throw new m(`Invalid ${a} value "${e}". Month "${r[2]}" is out of range \u2014 use a month between 01 and 12.`,p.USAGE,{field:a,value:e});let c=I(o,i-1);if(s<1||s>c)throw new m(`Invalid ${a} value "${e}". ${tt[i-1]} ${o} has ${c} days, so day "${r[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,p.USAGE,{field:a,value:e})}function it(e,t){let n=new Date(e.getTime()),r=n.getUTCDate(),o=n.getUTCMonth()+t,i=n.getUTCFullYear()+Math.floor(o/12),s=(o%12+12)%12,a=Math.min(r,I(i,s));return n.setUTCFullYear(i,s,a),n}function Tn(e,t=new Date,n="deadline"){let r=e.trim();if(r.toLowerCase()==="now")return t.toISOString();let o=He.exec(r);if(o){let s=o[1]==="-"?-1:1,a=Number.parseInt(o[2],10)*s,c=o[3].toLowerCase();if(c==="m")return it(t,a).toISOString();let u=c==="h"?3600*1e3:c==="d"?1440*60*1e3:10080*60*1e3;return new Date(t.getTime()+a*u).toISOString()}ot(e,r,n);let i=Je(r);if(!Number.isFinite(i)){let s=n.trim().length>0?n.trim():"deadline",a=qe.test(r)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new m(`Invalid ${s} value "${e}". ${a}`,p.USAGE,{field:s,value:e})}return new Date(i).toISOString()}import{AsyncLocalStorage as ht}from"node:async_hooks";var st="PM_COMMAND_SHELL",at=new Map([["posix","posix"],["sh","posix"],["bash","posix"],["zsh","posix"],["cmd","cmd"],["cmd.exe","cmd"],["powershell","powershell"],["pwsh","powershell"]]),G=(e=process.platform,t=process.env)=>{let n=t[st]?.trim().toLowerCase(),r=n===void 0?void 0:at.get(n);return r!==void 0?r:e==="win32"?"cmd":"posix"},Z=e=>{let t='"',n=0;for(let r of e){if(r==="\\"){n+=1;continue}t+="\\".repeat(r==='"'?n*2+1:n),t+=r,n=0}return`${t}${"\\".repeat(n*2)}"`},B=new Set(["(",")","!","^",'"',"<",">","&","|"]),K=e=>{let t="";for(let n=0;n<e.length;n+=1){let r=e[n];if(B.has(r)){t+=`^${r}`;continue}t+=r,r==="%"&&!B.has(e.charAt(n+1))&&(t+="^")}return t},ct=/["%]/u,ut=/\r\n|[\r\n]/gu,lt=e=>{let t=e.replace(ut," "),n=Z(t);return ct.test(t)?K(n):n},dt=/['\u2018\u2019\u201A\u201B]/gu,X=e=>e.replace(dt,"$&$&"),ft=e=>`'${X(e)}'`,pt={posix:/^(?!=)[A-Za-z0-9._:/@=-]+$/u,cmd:/^[A-Za-z0-9._:/\\@=-]+$/u,powershell:/^(?!--$)[A-Za-z0-9._:/\\=-][A-Za-z0-9._:/\\@=-]*$/u},mt=(e,t=process.platform,n)=>{let r=n??G(t);return pt[r].test(e)?e:r==="cmd"?lt(e):r==="powershell"?ft(e):gt(e)},gt=e=>e.includes("!")?`'${e.replaceAll("'","'\\''")}'`:`"${e.replace(/(["\\$`])/g,"\\$1")}"`,Dn=(e,t=process.platform,n)=>{let r=n??G(t),o=e.map(i=>mt(i,t,r)).join(" ");return o.length>0?`pm ${o}`:"pm"};var te="[redacted]",yt=/%\^?40/giu,k=/@|%\^?40/iu;function ne(e,t=e.length){let n=-1;for(let r of e.matchAll(yt)){if(r.index>t)break;n=r.index}return n}function _t(e,t){if(/[\t\n\r]/u.test(e)||!/(?:^|[^A-Za-z0-9+.-])(?:https?|wss?|ftp)$/iu.test(e.slice(0,t)))return!1;let n=t+1;for(;e[n]==="/"||e[n]==="\\";)n+=1;let r=e.indexOf("/",n)-n;if(r<0)return!1;let o=n+r;return!/[:@%]/u.test(e.slice(n,o))&&!/[:%]|[/\\][/\\]/u.test(e.slice(o))}function re(e){let t=Math.max(e.lastIndexOf("@"),ne(e)),n=e.indexOf(":");if(t<0||n<0||n>t)return;let r=n+1;for(;r<t&&r<n+3&&(e[r]==="/"||e[r]==="\\");)r+=1;return r===t||_t(e,n)?void 0:[r,t]}function L(e){let t=re(e);return t?`${e.slice(0,t[0])}${te}${e.slice(t[1])}`:e}function oe(e){return L(e)}var ie=["author","assignee","claim_principal"];function Fn(e){let t={...e};for(let n of ie)typeof t[n]=="string"&&(t[n]=oe(t[n]));return t}function se(e,t){if(!(typeof e!="string"||re(e.trim())===void 0))throw new m(`${t} must not carry URL credentials: an identity is a name, never a credential.`,p.USAGE,{code:"invalid_argument_value",field:t,required:`Set ${t} to a plain name such as agent-a, with no URL userinfo (no user, password or token before the host).`,nextSteps:[`Rerun with ${t} set to a plain name.`],url_credentials_rejected:{source:t}})}function Un(e,t){return se(e,t),e}var St=[["comments","author"],["notes","author"],["learnings","author"],["dependencies","author"],["plan_decisions","author"],["plan_discoveries","author"],["plan_steps","owner"],["tests","provenance","author"],["tests","updated_by"]],At=4;function N(e,t,n=0){if(typeof e=="string"){se(e,t);return}if(!(n>=At||typeof e!="object"||e===null))for(let r of Object.values(e))N(r,t,n+1)}function Et(e,t){let n=e;for(let r of t){if(typeof n!="object"||n===null||Array.isArray(n))return;n=n[r]}return n}function ae(e){let t=e;for(let n of ie)N(t[n],n);for(let[n,...r]of St){let o=t[n];Array.isArray(o)&&o.forEach((i,s)=>{N(Et(i,r),`${n}[${s}].${r.join(".")}`)})}}function vn(e){return typeof e=="string"?oe(e):e}var $t=6;var bt={carried:!1,fragments:new Set,fragmentLength:$t,shortSpellings:[]},wt=new ht;function Ot(e){let t=e.toLowerCase();if(t.length===e.length)return t;let n="";for(let r of e){let o=r.toLowerCase();n+=o.length===r.length?o:r}return n}function xt(e,t){let n=Ot(e),r=new Uint8Array(e.length),o=!1,i=t.fragmentLength;for(let a=0;a+i<=n.length;a+=1)t.fragments.has(n.slice(a,a+i))&&(r.fill(1,a,a+i),o=!0);for(let a of t.shortSpellings)for(let c=n.indexOf(a);c>=0;c=n.indexOf(a,c+1))r.fill(1,c,c+a.length),o=!0;if(!o)return e;let s="";for(let a=0;a<e.length;a+=1)r[a]?(a===0||!r[a-1])&&(s+=te):s+=e[a];return s}var Ct=16,ce=512,Mt=/^(?:(?:[A-Za-z0-9-]+\.)+[A-Za-z0-9-]+|localhost):\d+$/iu,Tt=260,Rt={'"':'"',"'":"'","`":"`","<":">","(":")","[":"]"},Dt=new Set(["http","https","ws","wss","ftp","file"]);function Y(e,t=!1){let n=Ft(e);if(n<0)return;let r=U(e,n);if(n-r<2)return;let o=Rt[e[r-1]??""],i=Dt.has(e.slice(r,n).toLowerCase()),s=n+1;for(;s<e.length&&(e[s]==="/"||e[s]==="\\");)s+=1;if(s===e.length)return{kind:"pending",closer:o,special:i};let a=P(e.slice(s),o);if(a.startsWith("[")||i&&/[/\\?#]/u.test(a)||F(a,o)>=0)return;let c=Ut(a,t);return c===void 0?void 0:{kind:c,closer:o,special:i}}var It=new Set([")","]"]),Nt="'\\''",kt="'\\\\''";function P(e,t){return t==="'"?J(e.replaceAll(kt,"_____").replaceAll(Nt,"____")):t==='"'?J(e):e}function ue(e,t){let n=t;for(;e[n]==="\\";)n+=1;return n}function Lt(e,t,n){let r=(n-t)%2===1;if(e[n]==='"')return r?n:-1;if(e[n]!=="^")return-1;if(e[n+1]==='"')return r?n+1:-1;let o=ue(e,n+1);return e[o]==='"'&&(o-n-1)%2===1?o:-1}function J(e){let t=[],n=0;for(let r=e.indexOf("\\");r>=0;r=e.indexOf("\\",r)){let o=ue(e,r),i=Lt(e,r,o);i>=0&&(t.push(e.slice(n,r),"_".repeat(i+1-r)),n=i+1),r=i>=0?i+1:o}return n===0?e:`${t.join("")}${e.slice(n)}`}function F(e,t){if(t===void 0)return-1;if(!It.has(t))return Pt(e,t);let n=e.length;for(;n>0&&/[.,;:!?*_~`]/u.test(e[n-1]);)n-=1;return n>0&&e[n-1]===t?n-1:-1}function Pt(e,t){for(let n=e.indexOf(t);n>=0;n=e.indexOf(t,n+1)){if(t==="'"&&e[n+1]==="'"){n+=1;continue}let r=0;for(;n-r>0&&e[n-r-1]==="\\";)r+=1;if(r%2===0)return n}return-1}function Ft(e){let t=-1;for(let n=e.length-2;n>=0;n-=1){if(e[n]!==":"||e[n+1]!=="/"&&e[n+1]!=="\\")continue;let r=U(e,n);if(r===0||/[=?&#"'`(<[{,]/u.test(e[r-1]))return n;t=n}return t}function U(e,t){let n=t;for(;n>0&&/[A-Za-z0-9+.-]/u.test(e[n-1]);)n-=1;return n}function Ut(e,t){return e.includes(":")?!t&&e.length<=Tt&&Mt.test(e)?void 0:"user":k.test(e)?void 0:"label"}function vt(e,t,n,r=-1){let o=Math.min(e.length,t+ce),i=t,s=r,a=n.kind==="user",c=!1;for(let u=0;u<Ct&&i<o;u+=1){let l=le(e,i,o);if(l===void 0)break;let d=Ht(e.slice(l[0],Math.min(l[1],o+3)),o-l[0],n);if(d.startsUrl)break;jt(d,a,c)&&(s=l[1]);let f=/[\t\r\n]/u.test(e[l[1]]??"");if(a||=d.colon||d.trailingColon&&f,c||=d.trailingColon,d.endsAuthority)break;i=l[1]}return s}function jt(e,t,n){return e.separator?t||e.colonBeforeSeparator||n&&(e.hasPath||e.closedByOpener):!1}function le(e,t,n){let r=t;for(;r<n&&/\s/u.test(e[r]);)r+=1;if(r===n)return;let o=r;for(;o<e.length&&!/\s/u.test(e[o]);)o+=1;return[r,o]}function Q(e){let t=e.indexOf(":");return t>=0&&t<e.length-1&&!zt.test(e)}var zt=/^\d{1,2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[AaPp][Mm])?[.,;:!?)]*$/u;function Ht(e,t,n){let r=P(e,n.closer),o=n.special?r.search(/[/\\?#]/u):-1,i=o<0?r:r.slice(0,o),s=F(i,n.closer),a=r.search(/:[/\\]/u),c=s<0?i:i.slice(0,s),u=Math.min(c.length,t)-1,l=u<0?-1:Math.max(c.lastIndexOf("@",u),ne(c,u));return{startsUrl:a>=0&&s<0&&qt(r.slice(0,a+1)),separator:l>=0,colonBeforeSeparator:l>0&&(Q(c.slice(0,l))||c[l-1]===":"),colon:Q(c),trailingColon:c.endsWith(":"),hasPath:s<0&&l>=0&&/[/\\]/u.test(r.slice(l+1)),closedByOpener:s>=0,endsAuthority:o>=0||s>=0}}function qt(e){let t=U(e,e.length-1);return t<e.length-2&&/[A-Za-z]/u.test(e[t])&&(t===0||t===1&&/["'`(<[]/u.test(e[0]))}function Wt(e,t,n){let r=Y(t,/[\t\r\n]/u.test(e.charAt(n)));if(r?.kind!=="pending")return r===void 0?void 0:{opening:r,from:n,seed:-1,final:!1};let o=le(e,n,Math.min(e.length,n+ce));if(o===void 0)return;let i=P(e.slice(o[0],o[1]),r.closer),s=/^[/\\]*/u.exec(i)[0],a=i.slice(s.length),c=r.special?a.split(/[/\\?#]/u,1)[0]:a,u=F(c,r.closer),l=`${s}${u<0?c:c.slice(0,u)}`,d=k.test(l),f=d?{...r,kind:"user"}:Y(`${t}${l}`);if(f===void 0||f.kind==="pending")return;let g=d?o[1]:-1;return{opening:f,from:o[1],seed:g,final:l.length<i.length}}function Vt(e){if(!/:[/\\]/u.test(e))return e;let t=/\S+/gu,n="",r=0;for(let o=t.exec(e);o!==null;o=t.exec(e)){let i=Wt(e,o[0],o.index+o[0].length);if(i===void 0)continue;let s=i.final?i.seed:vt(e,i.from,i.opening,i.seed);s!==-1&&(n+=`${e.slice(r,o.index)}${L(e.slice(o.index,s))}`,r=s,t.lastIndex=s)}return r===0?e:`${n}${e.slice(r)}`}function jn(e){let t=wt.getStore()??bt,n=ee(e);return t.carried?ee(xt(n,t)):n}function ee(e){return k.test(e)?Vt(e).replaceAll(/\S+/gu,L):e}function Bt(e){let t=e.trim();return t.startsWith("-")&&!t.startsWith("--")}var de=/[\s|,=<>[\]]/u;function Gt(e){let t=e.trim();if(Bt(t))return t.length===2&&!de.test(t[1])?void 0:"is not a short flag: a short flag is one dash and one character";let n=t.replace(/^--/u,"");if(n.length===0)return"is empty";if(n.startsWith("-"))return"starts with three dashes";if(n.endsWith("-")||n.includes("--"))return"has an empty segment between hyphens, which the option parser cannot turn into an option key";let r=de.exec(n)?.[0];if(r!==void 0)return/\s/u.test(r)?"contains whitespace, which the option parser reads as a break between two flags":`contains ${JSON.stringify(r)}, which the option parser reads as ${r==="|"||r===","?"a break between two flags":r==="="?"the start of an attached value":"a value placeholder"}`}var Zt=new Set(["-h","help"]);function fe(e){let t=e.trim();return Gt(t)===void 0&&!Zt.has(t.replace(/^--/u,""))}var Kt=16;function w(e){let t=e.trim().replaceAll(/[^A-Za-z0-9]+/g," ").split(/\s+/).filter(o=>o.length>0).map(o=>o.toLowerCase());if(t.length===0)return e;let[n,...r]=t;return`${n}${r.map(o=>`${o.slice(0,1).toUpperCase()}${o.slice(1)}`).join("")}`}function Xn(e,t,n=new Set,r){if(he(e,t,r))return;let o=ye(e,t,n,r),i=O(e);return[w(e.cli_flag),...i].find(a=>!o.has(a)&&ge(a,i,o))}function ge(e,t,n){for(let r of t){if(r===e)break;if(n.has(r))return!1}return!0}function he(e,t,n){return t.definitions.some(r=>r!==e&&r.metadata_key===e.metadata_key&&(n===void 0||r.commands.includes(n)))}function ye(e,t,n,r){return new Set([...n,...t.definitions.filter(o=>o!==e&&(r===void 0||o.commands.includes(r))).flatMap(o=>O(o))])}function _e(e){return e.replace(/^-+/u,"").startsWith("no-")}function Xt(e){return e.startsWith("-")?e:`--${e}`}function Yn(e,t,n,r){if(he(e,t,r))return;let o=ye(e,t,n.options,r),i=O(e);return[e.cli_flag,...e.cli_aliases].find(s=>{if(!fe(s))return!1;let a=Se(s);return _e(s)||n.flags.has(Xt(s))||o.has(a)?!1:ge(a,i,o)})}function Se(e){return e.replace(/^-+/u,"").replace(/^no-/u,"").split("-").reduce((t,n)=>`${t}${n.charAt(0).toUpperCase()}${n.slice(1)}`)}function O(e){return[...new Set([j(e),w(e.key),w(e.cli_flag),...e.cli_aliases.map(t=>w(t)),...[e.cli_flag,...e.cli_aliases].filter(t=>!_e(t)).map(t=>Se(t))])]}function Ae(e,t){for(let n of O(t)){if(!Object.hasOwn(e,n))continue;let r=e[n];if(r!==void 0)return r}}function Ee(e){return Array.isArray(e)?e.flatMap(t=>Ee(t)).map(t=>t.trim()).filter(t=>t.length>0):typeof e=="string"?e.split(/[,\n|]/).map(t=>t.trim()).filter(t=>t.length>0):e==null?[]:[String(e).trim()].filter(t=>t.length>0)}function pe(e,t){if(typeof e=="boolean")return e;if(typeof e=="number"){if(e===1)return!0;if(e===0)return!1}if(typeof e=="string"){let n=e.trim().toLowerCase();if(n==="true"||n==="1"||n==="yes")return!0;if(n==="false"||n==="0"||n==="no")return!1}throw new m(`${t} must be one of true|false|1|0|yes|no`,p.USAGE)}function me(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;let n=typeof e=="string"?e.trim():String(e),r=Number(n);if(!Number.isFinite(r))throw new m(`${t} must be a number`,p.USAGE);return r}function Yt(e,t,n){let r=typeof e=="string"?(()=>{try{return JSON.parse(e)}catch{return}})():e;if(n==="array"&&Array.isArray(r)||n==="object"&&typeof r=="object"&&r!==null&&!Array.isArray(r))return r;throw new m(`${t} must be valid JSON ${n}`,p.USAGE)}function Jt(e,t){return t===void 0?!0:t==="array"?Array.isArray(e):t==="object"?typeof e=="object"&&e!==null&&!Array.isArray(e):typeof e===t}function Qt(e,t,n){if(t.const!==void 0&&_(e)!==_(t.const))return`${n} must equal ${_(t.const)}`;if(t.enum!==void 0&&!t.enum.some(r=>_(r)===_(e)))return`${n} must be one of ${t.enum.map(r=>_(r)).join("|")}`;if(!Jt(e,t.type))return`${n} must match configured type ${String(t.type)}`;if(typeof e=="string"){if(t.min_length!==void 0&&e.length<t.min_length)return`${n} must contain at least ${t.min_length} characters`;if(t.format==="date-time"&&!D(e))return`${n} must be an RFC 3339 date-time`}}function en(e,t,n,r){if(Array.isArray(e)){if(t.min_items!==void 0&&e.length<t.min_items)return`${n} must contain at least ${t.min_items} items`;if(t.items)for(let[o,i]of e.entries()){let s=x(i,t.items,`${n}[${o}]`,r+1);if(s)return s}}}function tn(e,t,n,r){if(typeof e!="object"||e===null||Array.isArray(e))return;let o=e;for(let i of t.required??[])if(!Object.hasOwn(o,i))return`${n}.${i} is required`;for(let[i,s]of Object.entries(o)){let a=t.properties?.[i];if(!a){if(t.additional_properties===!1)return`${n}.${i} is not allowed`;continue}let c=x(s,a,`${n}.${i}`,r+1);if(c)return c}}function x(e,t,n,r=0){if(r>Kt)return`${n} value schema exceeds maximum depth`;let o=Qt(e,t,n);if(o)return o;let i=en(e,t,n,r);if(i)return i;let s=tn(e,t,n,r);if(s)return s;if(!t.one_of)return;let a=0;for(let c of t.one_of)if(x(e,c,n,r+1)===void 0&&(a+=1,a>1))break;return a===1?void 0:`${n} must match exactly one configured schema variant`}function S(e,t,n){if(!e.value_schema||t===void 0)return t;let r=x(t,e.value_schema,n);if(r)throw new m(r,p.USAGE);return t}function nn(e,t,n,r){let o=r==="option"&&Array.isArray(t)?t[t.length-1]:t;if(o!==void 0)return S(e,Yt(o,n,e.type),n)}function $e(e,t,n,r="option"){let o=n??`--${e.cli_flag}`;if(e.type==="array"||e.type==="object")return nn(e,t,o,r);if(e.repeatable||e.type==="string_array"){let s=Ee(t);return e.type==="number"?S(e,s.map(a=>me(a,o)),o):e.type==="boolean"?S(e,s.map(a=>pe(a,o)),o):S(e,s,o)}let i=Array.isArray(t)?t[t.length-1]:t;if(i!==void 0)return e.type==="number"?S(e,me(i,o),o):e.type==="boolean"?S(e,pe(i,o),o):S(e,typeof i=="string"?i:String(i),o)}function rn(e,t){return!e.required&&!e.required_on_create?!1:e.required_types.length===0?!0:t?e.required_types.map(n=>n.toLowerCase()).includes(t.trim().toLowerCase()):!1}function Jn(e,t,n){let r={},o=[];for(let i of t.command_to_fields.get("create")??[]){let s=Ae(e,i);if(s===void 0){rn(i,n)&&o.push(`--${i.cli_flag}`);continue}r[i.metadata_key]=$e(i,s)}return{values:r,missing_required_flags:[...new Set(o)].sort((i,s)=>i.localeCompare(s))}}function Qn(e,t,n=["update"]){let r={},o=(n??["update"]).flatMap(s=>t.command_to_fields.get(s)??[]),i=new Set;for(let s of o){let a=Ae(e,s);a!==void 0&&(i.has(s.metadata_key)||(i.add(s.metadata_key),r[s.metadata_key]=$e(s,a)))}return ae(r),r}var on=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields",extension_command_availability:"read_output"},{flag:"--output-limit",value_name:"count",extension_command_availability:"read_output"},{flag:"--output-budget",value_name:"tokens",extension_command_availability:"read_output"},{flag:"--output-format",value_name:"toon|json"},{flag:"--output-session",value_name:"state",extension_command_availability:"read_output"},{flag:"--output-cursor",value_name:"cursor",extension_command_availability:"read_output"},{flag:"--output-row-contract",extension_command_availability:"read_output"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"],discovery_value_name:"path"},{flag:"--no-extensions",extension_command_availability:"never"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"},{flag:"--expect-hash",value_name:"revision"}]),tr=new Set(on.flatMap(e=>[e.flag,...e.aliases??[]]));export{on as a,tr as b,_ as c,E as d,an as e,cn as f,Le as g,Pe as h,Fe as i,Ue as j,C as k,ln as l,ve as m,dn as n,H as o,fn as p,pn as q,mn as r,_n as s,Sn as t,On as u,xn as v,D as w,Cn as x,A as y,Mn as z,Tn as A,mt as B,Dn as C,te as D,L as E,oe as F,Fn as G,se as H,Un as I,ae as J,vn as K,jn as L,Bt as M,Gt as N,Xn as O,Xt as P,Yn as Q,Se as R,O as S,Ae as T,$e as U,rn as V,Jn as W,Qn as X};
|
|
3
|
+
//# sourceMappingURL=chunk-R6QFPHWW.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as A,j as g,k as fe,l as pe,m as me}from"./chunk-
|
|
1
|
+
import{f as A,j as g,k as fe,l as pe,m as me}from"./chunk-3GQRWIT5.js";import{a as h,b as le,c as ce,d as ue,g as he,i as ge,j as _e,k as ke}from"./chunk-RMJKVQYE.js";import{_ as ye,a as ee,b as te}from"./chunk-TNVLDU7Z.js";import{c as y,f as se,g as ie,i as ae}from"./chunk-RFJ3MEFP.js";import{B as ne,F as re,gb as oe}from"./chunk-GQBWI4KA.js";import{E,Xa as Z,Ya as L,Za as F,_a as $,h as x}from"./chunk-NSFS3VWP.js";import{b as Q,m as C}from"./chunk-R6QFPHWW.js";import{C as k,H as de,a as H,z as J}from"./chunk-OCKKIECS.js";import{A as p,a as U,e as V,f as G,g as X,i as Y,z as f}from"./chunk-NGFDPEP7.js";var Kt=U,Wt=V,Bt=Y,Ut=G,Vt=X;function we(e,t,n,r){let o=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),s=n.has(o);return{long:t,...r?{short:r}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:s?"string":"boolean",...s?{value_name:e.value_name??"value"}:{}}}function be(e,t=[]){let n=new Set(t.flatMap(o=>o.keys)),r=[];for(let o of ne(e.map(s=>({...s})))){r.push(we(o,o.flag,n,o.short));for(let s of o.aliases??[])r.push(we(o,s,n))}return r}var Gt=be(re,ee),Xt=be(oe,te);var w=["agile","ops","research"],R={agile:{name:"agile",title:"Agile delivery",summary:"Story/Spike delivery with a review stage, story points, and acceptance ownership.",types:A.agile,statuses:[{id:"review",roles:["active"],aliases:["in-review"],description:"Work is implementation-complete and awaiting peer review."}],fields:[{key:"story_points",type:"number",commands:["create","update","list"],description:"Relative estimation size for a story or spike.",aliases:["points"]},{key:"acceptance_owner",type:"string",commands:["create","update","list"],description:"Stakeholder accountable for accepting the delivered story.",aliases:["acceptor"]}],workflows:[{type:"Story",allowed_transitions:[["open","in_progress"],["in_progress","review"],["review","in_progress"],["review","closed"],["in_progress","blocked"],["blocked","in_progress"]]}],config:[{key:"search_provider",value:"bm25",summary:"Offline BM25 lexical search works without an embedding service."},{key:"search_max_results",value:"20",summary:"Sprint-sized result cap for quick triage."}],templates:[{name:"story",options:{type:"Story",priority:"2",tags:"story",acceptanceCriteria:"Story delivers the stated user outcome with tests and docs updated.",body:`## As a
|
|
2
2
|
|
|
3
3
|
## I want
|
|
4
4
|
|
|
@@ -23,4 +23,4 @@ import{f as A,j as g,k as fe,l as pe,m as me}from"./chunk-BOIMP2AR.js";import{a
|
|
|
23
23
|
|
|
24
24
|
## Conclusion
|
|
25
25
|
`}}],packages:[{spec:"search-advanced",reason:"Semantic retrieval over experiments and findings."},{spec:"templates",reason:"Consistent experiment and hypothesis scaffolds."},{spec:"beads",reason:"Import structured prior work into the tracker."}]}};function ze(e){if(e===void 0)return;let t=m(e);if(t.length===0)throw new Error("Profile name must not be empty.");if(w.includes(t))return t;throw new Error(`Invalid profile "${e}". Allowed: ${w.join(", ")}.`)}function Jt(e){let t=ze(e);if(t===void 0)throw new Error(`Profile name is required. Allowed: ${w.join(", ")}.`);return R[t]}function Qt(){return w.map(e=>R[e])}function m(e){return e.trim().toLowerCase().replaceAll("-","_")}function ve(e){return e.map(t=>t.definition.name).join(", ")}function Ke(e=[]){let t=w.map(s=>({definition:R[s],source:"builtin"})),n=new Set(w.map(s=>m(s))),r=new Set(n),o=[];for(let s of e){let i=m(s.profile.name);if(n.has(i)){o.push(`Extension "${s.name}" profile "${s.profile.name}" uses a name reserved by a built-in archetype and was ignored.`);continue}if(r.has(i)){o.push(`Profile "${s.profile.name}" from extension "${s.name}" duplicates an already-registered profile and was ignored.`);continue}r.add(i),t.push({definition:s.profile,source:"extension",package:s.name})}return{profiles:t,warnings:o}}function Zt(e,t=[]){let{profiles:n,warnings:r}=Ke(t);if(typeof e!="string"||e.trim().length===0)throw new Error(`Profile name is required. Allowed: ${ve(n)}.`);let o=m(e),s=n.find(i=>m(i.definition.name)===o);if(s===void 0)throw new Error(`Invalid profile "${e}". Allowed: ${ve(n)}.`);return{resolved:s,warnings:r}}function We(e){return{types:e.types.length,statuses:e.statuses.length,fields:e.fields.length,workflows:e.workflows.length,config:e.config.length,templates:e.templates.length,packages:e.packages.length}}function on(e){return{name:e.name,title:e.title,summary:e.summary,composition:We(e),types:e.types.map(t=>D(()=>y(t).name,()=>String(t.name??""))),statuses:e.statuses.map(t=>D(()=>g(t).id,()=>String(t.id??""))),fields:e.fields.map(t=>D(()=>h(t).key,()=>String(t.key??""))),workflows:e.workflows.map(t=>t.type),config:e.config.map(t=>`${t.key}=${t.value}`),templates:e.templates.map(t=>t.name),packages:e.packages.map(t=>({spec:t.spec,reason:t.reason}))}}function D(e,t){try{return e()}catch{return t()}}var Be=[{key:"context_default_depth",path:"context.default_depth",kind:"string",choices:J,summary:"Default context depth."},{key:"context_activity_limit",path:"context.activity_limit",kind:"integer",min:1,max:Number.MAX_SAFE_INTEGER,decimal_only:!0,summary:"Default context activity row limit; positive decimal integer."},{key:"context_stale_threshold_days",path:"context.stale_threshold_days",kind:"integer",min:1,max:Number.MAX_SAFE_INTEGER,decimal_only:!0,summary:"Days before context marks an item stale; positive decimal integer."},...["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"].map(e=>({key:`context_sections_${e}`,path:`context.sections.${e}`,kind:"boolean",summary:`Include ${e} in default context output.`})),{key:"context_next_ranking_policy",path:"context.next_ranking_policy",kind:"string",choices:["priority_floor","weighted"],summary:"Ready-queue order for pm next with the built-in scorer: priority_floor (resume in-progress work, then priority tiers, relevance within a tier) or weighted (blended relevance order). An extension context_relevance scorer keeps its own order."},{key:"search_provider",path:"search.provider",kind:"string",summary:"Search embedding provider name (e.g. openai, ollama, or an extension provider)."},{key:"search_default_mode",path:"search.default_mode",kind:"string",choices:["auto","keyword","semantic","hybrid"],summary:"Mode a bare pm search runs in: auto (hybrid when semantic search is explicitly configured and runnable, else keyword), or a pinned keyword, semantic, or hybrid."},{key:"search_mutation_refresh_policy",path:"search.mutation_refresh_policy",kind:"string",choices:["cache_only","semantic_configured","semantic_auto"],summary:"Mutation-time search refresh policy: cache_only, semantic_configured, or semantic_auto."},{key:"search_query_expansion_enabled",path:"search.query_expansion.enabled",kind:"boolean",summary:"Enable or disable query expansion for semantic/hybrid search."},{key:"search_query_expansion_provider",path:"search.query_expansion.provider",kind:"string",summary:"Query expansion provider name (built-in openai/ollama or extension provider)."},{key:"search_rerank_enabled",path:"search.rerank.enabled",kind:"boolean",summary:"Enable or disable post-retrieval reranking for hybrid search."},{key:"search_rerank_model",path:"search.rerank.model",kind:"string",summary:"Rerank model name override used by built-in providers."},{key:"search_rerank_top_k",path:"search.rerank.top_k",kind:"integer",min:1,summary:"Number of top hybrid candidates to rerank when rerank is enabled."},{key:"search_embedding_model",path:"search.embedding_model",kind:"string",summary:"Default embedding model name (overrides provider-specific model when set)."},{key:"search_embedding_corpus_max_characters",path:"search.embedding_corpus_max_characters",kind:"integer",min:1,summary:"Maximum semantic corpus characters per item before truncation."},{key:"search_embedding_batch_size",path:"search.embedding_batch_size",kind:"integer",min:1,summary:"Number of items embedded per request batch."},{key:"search_embedding_timeout_ms",path:"search.embedding_timeout_ms",kind:"integer",min:1,summary:"Per-request embedding timeout in milliseconds."},{key:"search_score_threshold",path:"search.score_threshold",kind:"number",summary:"Minimum score for a hit to be returned (0 keeps all matches)."},{key:"search_hybrid_semantic_weight",path:"search.hybrid_semantic_weight",kind:"ratio",summary:"Hybrid mode semantic weight in [0, 1] (1-weight goes to keyword)."},{key:"search_max_results",path:"search.max_results",kind:"integer",min:1,summary:"Default upper bound on search hits when --limit is not supplied."},{key:"search_bm25_k1",path:"search.bm25.k1",kind:"number",min:0,summary:"Offline BM25 term-frequency saturation (k1); higher saturates repeated terms slower (default 1.2)."},{key:"search_bm25_b",path:"search.bm25.b",kind:"ratio",summary:"Offline BM25 document-length normalization (b) in [0, 1]; 0 disables, 1 fully normalizes (default 0.75)."},{key:"openai_base_url",path:"providers.openai.base_url",kind:"string",summary:"OpenAI-compatible API base URL (LM Studio/vLLM also use this)."},{key:"openai_api_key",path:"providers.openai.api_key",kind:"string",summary:"OpenAI-compatible API key."},{key:"openai_model",path:"providers.openai.model",kind:"string",summary:"OpenAI-compatible embedding model name."},{key:"ollama_base_url",path:"providers.ollama.base_url",kind:"string",summary:"Ollama API base URL (typically http://localhost:11434)."},{key:"ollama_model",path:"providers.ollama.model",kind:"string",summary:"Ollama embedding model name (e.g. nomic-embed-text)."},{key:"vector_store_adapter",path:"vector_store.adapter",kind:"string",summary:"Vector store adapter name (lancedb, qdrant, or an extension adapter)."},{key:"vector_store_collection_name",path:"vector_store.collection_name",kind:"string",non_empty:!0,summary:"Vector collection/table name shared by Qdrant and LanceDB adapters."},{key:"qdrant_url",path:"vector_store.qdrant.url",kind:"string",summary:"Qdrant HTTP API URL."},{key:"qdrant_api_key",path:"vector_store.qdrant.api_key",kind:"string",summary:"Qdrant API key (empty if running unauthenticated)."},{key:"lancedb_path",path:"vector_store.lancedb.path",kind:"string",summary:"LanceDB storage path (relative to pm root or absolute)."},{key:"id_prefix",path:"id_prefix",kind:"string",non_empty:!0,summary:'Prefix for generated item IDs (e.g. "pm" produces pm-xxxx).'},{key:"author_default",path:"author_default",kind:"string",non_empty:!0,summary:"Default author recorded on mutations when --author is not supplied."},{key:"agent_identity_probes_enabled",path:"agent_identity.probes_enabled",kind:"boolean",summary:"Allow privacy-bounded local harness provenance probes; no network or subprocess access is permitted."},{key:"mutation_guard_require_attributed_author",path:"mutation_guard.require_attributed_author",kind:"boolean",summary:"Reject mutations whose effective author resolves to unknown."},{key:"mutation_guard_secret_guard",path:"mutation_guard.secret_guard",kind:"string",choices:["off","advise","block"],summary:"Detect credential-shaped mutation content: off, advise, or block."},{key:"mutation_guard_stale_in_progress_hours",path:"mutation_guard.stale_in_progress_hours",kind:"integer",min:1,summary:"Age threshold for unclaimed in-progress work surfaced by health."},{key:"governance_duplicate_detection_mode",path:"governance.duplicate_detection_mode",kind:"string",choices:["off","advisory","strict"],summary:"Create/copy duplicate governance: off, advisory, or strict explicit-bypass enforcement."},{key:"governance_duplicate_detection_threshold",path:"governance.duplicate_detection_threshold",kind:"ratio",summary:"Minimum shared similarity score in [0, 1] for create/copy duplicate governance."},{key:"governance_duplicate_detection_limit",path:"governance.duplicate_detection_limit",kind:"integer",min:0,max:20,summary:"Maximum likely duplicates returned by create/copy governance (0-20)."},{key:"output_default_format",path:"output.default_format",kind:"string",choices:["toon","json"],summary:"Default output format for commands that support it: toon or json."},{key:"ux_deprecation_hints",path:"ux.deprecation_hints",kind:"boolean",summary:"Emit one stderr migration hint for deprecated command aliases."},{key:"locks_ttl_seconds",path:"locks.ttl_seconds",kind:"integer",min:1,summary:"Claim/lock time-to-live in seconds before a stale lock can be reclaimed."},{key:"locks_wait_ms",path:"locks.wait_ms",kind:"integer",min:0,summary:"Wait budget in milliseconds before a contended lock fails with lock_conflict; item-store mutations, restore and the hierarchy lock treat it as a no-progress window that each observed owner handoff restarts (120 s total cap), other locks as a fixed total; 0 fails fast. PM_LOCK_WAIT_MS overrides per invocation."},{key:"ids_token_length",path:"ids.token_length",kind:"integer",min:4,max:12,summary:"Random base36 token length for newly minted item ids (4-12, default 4). Raise it to shrink cross-branch id collision odds in concurrent multi-agent workflows (pm-pibw)."},{key:"checkpoints_retention_days",path:"checkpoints.retention_days",kind:"integer",min:1,summary:"Age in days above which pm gc --scope checkpoints prunes bulk-mutation rollback checkpoints."},{key:"schema_unknown_field_policy",path:"schema.unknown_field_policy",kind:"string",choices:["allow","warn","reject"],summary:"How item I/O handles metadata keys not in the field registry: allow, warn, or reject."},{key:"history_compact_policy_enabled",path:"history.compact_policy.enabled",kind:"boolean",summary:"Enable the history-compaction advisory: pm health warns on over-threshold streams."},{key:"history_compact_policy_max_entries",path:"history.compact_policy.max_entries",kind:"integer",min:1,summary:"Entry count above which a history stream is flagged (and the default pm history-compact --all-over threshold)."},{key:"history_compact_policy_trigger",path:"history.compact_policy.trigger",kind:"string",choices:["health_warn","auto"],summary:"History-compaction policy intent: health_warn (advisory only) or auto (scheduled sweeps expected)."}],Ue=new Map(Be.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function N(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return Ue.get(t)}function Ve(e,t){let n=t.trim().toLowerCase();return n==="true"||n==="1"||n==="yes"||n==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:n==="false"||n==="0"||n==="no"||n==="off"?{ok:!0,parsed:{descriptor:e,value:!1}}:{ok:!1,error:{message:`Config set ${e.key} requires a boolean value (true|false), got "${t}"`}}}function Ge(e,t,n){return e.key==="context_default_depth"&&(n=n.toLowerCase()),e.non_empty===!0&&n.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(n)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function Se(e,t){let n=[e.min===void 0?"":`minimum ${e.min}`,e.max===void 0?"":`maximum ${e.max}`].filter(Boolean).join(", ");return{message:`Config set ${e.key} requires non-empty decimal integer digits${n?` (${n})`:""}, got "${t}"`}}function Xe(e,t,n){if(e.decimal_only&&!/^\d+$/u.test(n))return{ok:!1,error:Se(e,t)};if(n.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let r=Number(n);return Number.isFinite(r)?{ok:!0,value:r}:{ok:!1,error:e.decimal_only?Se(e,t):{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function Ye(e,t,n){return!Number.isInteger(n)||n<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires an integer >= ${e.min}, got "${t}" (the runtime silently ignores 0 here and falls back to the default)`}}:e.max!==void 0&&n>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function He(e,t,n){return n<0||n>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function Je(e,t,n){return e.min!==void 0&&n<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:n}}}function I(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let n=t.trim();if(e.kind==="boolean")return Ve(e,t);if(e.kind==="string")return Ge(e,t,n);let r=Xe(e,t,n);return r.ok?e.kind==="integer"?Ye(e,t,r.value):e.kind==="ratio"?He(e,t,r.value):Je(e,t,r.value):{ok:!1,error:r.error}}function Oe(e,t){let n=t.path.split("."),r=e;for(let o of n){if(typeof r!="object"||r===null)return null;let s=Object.getOwnPropertyDescriptor(r,o);if(!s||!Object.hasOwn(s,"value"))return null;r=s.value}return typeof r=="string"||typeof r=="number"||typeof r=="boolean"?r:null}function ln(e,t,n){let r=t.path.split(".");if(r.some(a=>a.length===0||["__proto__","constructor","prototype"].includes(a)))throw new Error("Unsafe settings path");let o=e;for(let a=0;a<r.length-1;a+=1){let u=r[a],c=Object.getOwnPropertyDescriptor(o,u)?.value;if(typeof c!="object"||c===null||Array.isArray(c)){let l={};Object.defineProperty(o,u,{value:l,writable:!0,enumerable:!0,configurable:!0}),o=l}else o=c}let s=r[r.length-1];return Object.getOwnPropertyDescriptor(o,s)?.value===n?!1:(Object.defineProperty(o,s,{value:n,writable:!0,enumerable:!0,configurable:!0}),!0)}var bn=["profile","types","statuses","fields","workflows","config","templates","packages"],vn=["profile_name_empty","profile_name_not_normalized","profile_title_empty","profile_summary_empty","type_invalid","type_duplicate","status_invalid","status_duplicate","field_invalid","field_duplicate","field_mcp_input_collision","field_option_collision","field_flag_invalid","workflow_type_empty","workflow_type_unknown","workflow_duplicate_type","workflow_transition_malformed","workflow_status_unknown","config_key_unknown","config_value_invalid","config_duplicate","template_type_unknown","package_spec_empty"],Qe=new Set(de.flatMap(e=>[k(e.id),...(e.aliases??[]).map(t=>k(t))]).filter(e=>e.length>0)),xe=new Set(H.map(e=>e.toLowerCase()));function Ze(e,t){e.name.trim().length===0?t.push({severity:"error",code:"profile_name_empty",dimension:"profile",message:"Profile name must not be empty; profile resolution requires a non-blank name."}):e.name!==m(e.name)&&t.push({severity:"warning",code:"profile_name_not_normalized",dimension:"profile",target:e.name,message:`Profile name "${e.name}" is not in canonical form; resolution folds it to "${m(e.name)}" (lowercase, hyphens as underscores).`}),e.title.trim().length===0&&t.push({severity:"warning",code:"profile_title_empty",dimension:"profile",message:"Profile title is empty; list and show surfaces will render a blank title."}),e.summary.trim().length===0&&t.push({severity:"warning",code:"profile_summary_empty",dimension:"profile",message:"Profile summary is empty; list and show surfaces will render a blank archetype description."})}function et(e,t){let n=new Set,r=new Set;for(let[o,s]of e.types.entries()){let i;try{i=y(s).name}catch(u){t.push({severity:"error",code:"type_invalid",dimension:"types",target:typeof s.name=="string"?s.name:`#${o}`,message:E(u)});continue}let a=i.toLowerCase();if(r.has(a)){t.push({severity:"error",code:"type_duplicate",dimension:"types",target:i,message:`Item type "${i}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(a),n.add(a)}return n}function tt(e,t){let n=new Set,r=new Set;for(let[o,s]of e.statuses.entries()){let i;try{i=g(s)}catch(a){t.push({severity:"error",code:"status_invalid",dimension:"statuses",target:typeof s.id=="string"?s.id:`#${o}`,message:E(a)});continue}if(r.has(i.id)){t.push({severity:"error",code:"status_duplicate",dimension:"statuses",target:i.id,message:`Status "${i.id}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}r.add(i.id),n.add(i.id);for(let a of i.aliases??[])n.add(k(a))}return n}function nt(e,t){let n=new Set;for(let[r,o]of e.fields.entries()){let s,i;try{i=h(o),s=i.key}catch(l){t.push({severity:"error",code:"field_invalid",dimension:"fields",target:typeof o.key=="string"?o.key:`#${r}`,message:E(l)});continue}if(n.has(s)){t.push({severity:"error",code:"field_duplicate",dimension:"fields",target:s,message:`Field "${s}" is declared more than once; the later definition silently overwrites the earlier upsert.`});continue}n.add(s);let a=ge(i);a.length>0&&t.push({severity:"error",code:"field_flag_invalid",dimension:"fields",target:s,message:`Field "${s}" declares a flag that is not one option spelling: ${a.map(_e).join("; ")}. Pass one spelling per alias.`});let u=he(i);u.length>0&&t.push({severity:"error",code:"field_option_collision",dimension:"fields",target:s,message:`Field "${s}" would disable a built-in option: ${u.map(ke).join("; ")}. Rename the field or narrow its commands.`});let c=ye(s);c&&t.push({severity:"warning",code:"field_mcp_input_collision",dimension:"fields",target:s,message:`Field "${s}" collides with canonical MCP property "${c.property}" owned by ${c.owner}; callers must pass the custom value through ${c.nested_path}.`})}}function rt(e,t,n,r){let o=new Set;for(let[s,i]of e.workflows.entries()){let a=i.type.trim().toLowerCase();if(a.length===0){r.push({severity:"error",code:"workflow_type_empty",dimension:"workflows",target:`#${s}`,message:"Workflow has an empty type; the workflow resolver drops entries without a type."});continue}let u=o.has(a);o.add(a),u?r.push({severity:"warning",code:"workflow_duplicate_type",dimension:"workflows",target:i.type,message:`Workflow type "${i.type}" is declared more than once; the later transition set wins.`}):!xe.has(a)&&!t.has(a)&&r.push({severity:"warning",code:"workflow_type_unknown",dimension:"workflows",target:i.type,message:`Workflow governs type "${i.type}" which is neither a built-in type nor declared by this profile; it has no effect unless that type already exists.`});let c=new Set;for(let l of i.allowed_transitions){let d=k(l[0]),B=k(l[1]);if(d.length===0||B.length===0){r.push({severity:"error",code:"workflow_transition_malformed",dimension:"workflows",target:i.type,message:`Workflow "${i.type}" has a transition with an empty status; the workflow resolver silently drops it.`});continue}for(let _ of[d,B])Qe.has(_)||n.has(_)||c.has(_)||(c.add(_),r.push({severity:"warning",code:"workflow_status_unknown",dimension:"workflows",target:_,message:`Workflow "${i.type}" references status "${_}" which is neither a built-in status nor declared by this profile; transitions to or from it are unreachable.`}))}}}function ot(e,t){let n=new Set;for(let r of e.config){let o=N(r.key);if(o===void 0){t.push({severity:"error",code:"config_key_unknown",dimension:"config",target:r.key,message:`Config knob "${r.key}" is not a recognized setting; apply rejects it with a usage error.`});continue}n.has(o.key)?t.push({severity:"error",code:"config_duplicate",dimension:"config",target:o.key,message:`Config knob "${o.key}" is set more than once; the later value silently overwrites the earlier one.`}):n.add(o.key);let s=I(o,r.value);s.ok||t.push({severity:"error",code:"config_value_invalid",dimension:"config",target:r.key,message:s.error.message})}}function st(e,t,n){for(let r of e.templates){let o=r.options.type;if(typeof o!="string"||o.trim().length===0)continue;let s=o.trim().toLowerCase();!xe.has(s)&&!t.has(s)&&n.push({severity:"warning",code:"template_type_unknown",dimension:"templates",target:r.name,message:`Template "${r.name}" creates type "${o}" which is neither a built-in type nor declared by this profile.`})}}function it(e,t){for(let[n,r]of e.packages.entries())r.spec.trim().length===0&&t.push({severity:"warning",code:"package_spec_empty",dimension:"packages",target:`#${n}`,message:"Package recommendation has an empty spec; it cannot be surfaced as an install hint."})}function Sn(e){let t=[];Ze(e,t);let n=et(e,t),r=tt(e,t);nt(e,t),rt(e,n,r,t),ot(e,t),st(e,n,t),it(e,t);let o=t.filter(i=>i.severity==="error").length,s=t.length-o;return{profile:e.name,ok:o===0,findings:t,errorCount:o,warningCount:s}}function M(e,t,n,r,o){let s=e,i=[];for(let a of t){let u=r(s),c=o(s,a),l=r(c.file);s=c.file;let d=u===l?"unchanged":c.replaced?"update":"add";i.push({key:n(a),status:d})}return{file:s,changes:i,changed:i.some(a=>a.status!=="unchanged")}}function Ee(e){return JSON.stringify(e.map(t=>t.join("\0")).sort())}function at(e,t){let n=e.map(o=>({...o})),r=[];for(let o of t){let s=n.findIndex(a=>a.type===o.type),i={type:o.type,allowed_transitions:o.allowed_transitions};s<0?(n.push(i),r.push({type:o.type,status:"add"})):Ee(n[s].allowed_transitions)===Ee(o.allowed_transitions)?r.push({type:o.type,status:"unchanged"}):(n[s]=i,r.push({type:o.type,status:"update"}))}return{changes:r,result:n,changed:r.some(o=>o.status!=="unchanged")}}function lt(e,t){let n=[];for(let r of e.config){let o=N(r.key);if(o===void 0)throw new Error(`Profile "${e.name}" references unknown config key "${r.key}".`);let s=I(o,r.value);if(!s.ok)throw new Error(`Profile "${e.name}" config ${r.key}: ${s.error.message}`);let i=Oe(t,o),a=i===null?"add":i===s.parsed.value?"unchanged":"update";n.push({key:o.key,path:o.path,value:s.parsed.value,status:a})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function $e(e){let t=Object.entries(e).sort(([n],[r])=>n.localeCompare(r));return JSON.stringify(t)}function ct(e,t){let n=[];for(let r of e.templates){let o=t.get(r.name),s;o===void 0?s="add":$e(o)===$e(r.options)?s="unchanged":s="update",n.push({name:r.name,options:r.options,status:s})}return{changes:n,changed:n.some(r=>r.status!=="unchanged")}}function Nn(e,t){let n=M(se(t.typesRaw),e.types,l=>y(l).name,ae,(l,d)=>ie(l,y(d))),r=M(fe(t.statusesRaw),e.statuses,l=>g(l).id,pe,(l,d)=>me(l,g(d))),o=M(le(t.fieldsRaw),e.fields,l=>h(l).key,ce,(l,d)=>ue(l,h(d))),s=at(t.workflows,e.workflows),i=lt(e,t.settings),a=ct(e,t.templates),u=e.packages.map(l=>({spec:l.spec,reason:l.reason,status:t.installedPackages.has(l.spec)?"installed":"recommended"})),c=n.changed||r.changed||o.changed||s.changed||i.changed||a.changed;return{profile:{name:e.name,title:e.title,summary:e.summary},types:n,statuses:r,fields:o,workflows:s,config:i,templates:a,packages:u,changed:c}}import{isDeepStrictEqual as ut}from"node:util";var dt=new Set(["__proto__","prototype","constructor"]),Ce=Symbol("looseOptionOccurrences");function b(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(n,r)=>r.toUpperCase())}function j(e){return dt.has(e)}function Le(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return Z(t)}function Fe(e){let t=[],n=x(e.long)??"",r=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let o=b(n.slice(2));o.length>0&&!j(o)&&t.push(o)}if(r.startsWith("-")&&!r.startsWith("--")){let o=b(r.slice(1));o.length>0&&!j(o)&&t.push(o)}return[...new Set(t)]}function S(e){let t=x(e.long)??"";if(t.startsWith("--")){let n=b(t.slice(2));if(n.length>0&&!j(n))return n}return Fe(e)[0]??null}function O(e){let t=x(e.long)??"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function ft(e,t){return[...(t.definitions??e).map(r=>O(r)).filter(r=>r!==null),...t.inheritedFlags??[]]}function pt(e,t,n,r){let o=r.length>0?` Expected one of: ${[...new Set(r)].join(", ")}.`:"";throw new p(`Unknown option '${e}' for extension command '${n}'.${o}`,f.USAGE,{code:"unknown_option",flag:t,required:`Use a flag the command accepts; run pm contracts --command ${n} --flags-only --json to list them.`})}function mt(e,t){throw new p(`Option '${e}' is disabled for extension command '${t}'.`,f.USAGE,{code:"extension_option_disabled",flag:e,required:`Remove ${e}; the command declares it with enabled: false.`,why:"A disabled declaration keeps the flag in the contract while refusing every value for it.",examples:[`pm ${t} --help`],nextSteps:[`Run pm contracts --command ${t} --flags-only --json to list the flags this command accepts.`]})}function yt(e,t,n,r){let o=L(e),s=o.value_arity==="none"?n:o.value_arity==="optional"?`${n} [${o.value_name}]`:`${n} <${o.value_name}>`;throw new p(`Missing required option '${n}' for extension command '${r}'.`,f.USAGE,{code:"missing_required_option",flag:n,field:t,required:`Pass ${s}.`,why:"The command declares this flag as required, so pm refuses the invocation before the extension handler runs.",examples:[`pm ${r} ${s}`],nextSteps:[`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`],recovery:{missing:[n]}})}function ht(e){return typeof e=="string"||e==null?e:String(e)}function gt(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function Re(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var _t={string:ht,number:gt,boolean:Re};function v(e,t){return Array.isArray(e)?e.map(n=>v(n,t)):_t[t](e)}function P(e,t,n){let r=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(o=>o!=null&&o!==""):F(e);return t?r.map(o=>v(o,t)):r}function kt(e,t){return P(t,null,e.repeatable===!0).length>0}function wt(e,t,n,r){return n?P(e,t,r):t?v(e,t):e}function bt(e,t,n){let r=Me(e,t);return r.length===0?n:r.map(o=>o.value)}function De(e){return L(e).value_arity==="none"}function z(e,t,n,r,o){let s=O(e),i=o?` for extension command '${o}'`:"",a=n===!0?"no value":JSON.stringify(n);throw new p(`Option '${s}'${i} expects ${r}; received ${a}.`,f.USAGE,{code:"extension_flag_value_invalid",flag:s,required:`Pass ${s} ${t==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${t} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${t} value for ${s}.`,`Run pm ${o??"<command>"} --help to review the declared flag contract.`]})}function K(e,t){return e.value_validation==="strict"&&t!=="string"}function Me(e,t){let n=e[Ce];if(!n)return[];let r=new Set(t);return n.filter(o=>r.has(o.key))}function vt(e,t,n,r){if(De(e))for(let o of Me(n,t)){if(o.attached!==!0)continue;let s=e.list===!0&&e.repeatable!==!0?F(o.value):[o.value];for(let i of s){let a=$(v(i,"boolean"),"boolean");a!==null&&z(e,"boolean",i,a.expected,r)}}}function St(e,t,n,r,o){let s=Array.isArray(n)?n.flat(1/0):[n],i=r?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(let a of i)if(typeof a=="string"&&a.trim().length===0){let u=$(a,t);z(e,t,a,u.expected,o)}}function W(e,t,n,r){if(!K(e,n))return t;let o=n==="boolean"&&De(e),s=i=>{let a=$(i,n);return a===null?i:o&&typeof i=="string"?!0:z(e,n,i,a.expected,r)};return Array.isArray(t)?t.map(s):s(t)}function Ot(e,t,n,r){for(let o of n)if(!(o===t||!Object.hasOwn(e,o))){if(Object.hasOwn(e,t)){if(r){let s=e[t],i=e[o];e[t]=[...Array.isArray(s)?s:[s],...Array.isArray(i)?i:[i]].filter(a=>a!=null)}delete e[o];continue}e[t]=e[o],delete e[o]}}function je(e,t,n=e,r){if(t.length===0)return e;let o=Object.create(null);for(let[i,a]of Object.entries(e))o[i]=a;let s=new Set(t.map(i=>S(i)).filter(i=>i!==null));for(let i of t){let a=S(i);if(a){let u=Fe(i).filter(c=>c===a||!s.has(c));xt(o,i,a,u,n,r)}}return o}function xt(e,t,n,r,o,s){let i=t.list===!0,a=Le(t);a&&!i&&Et(e,t,n,r,a,s),Ot(e,n,r,i);let u=t.repeatable===!0;if(!Object.hasOwn(e,n)){t.default!==void 0&&(e[n]=wt(t.default,a,i,u));return}if(a==="boolean"&&K(t,a)&&vt(t,r,o,s),i){e[n]=$t(t,r,o,e[n],a,u,s);return}a&&(e[n]=W(t,v(e[n],a),a,s))}function Et(e,t,n,r,o,s){for(let i of r)i!==n&&Object.hasOwn(e,i)&&W(t,v(e[i],o),o,s)}function $t(e,t,n,r,o,s,i){let a=bt(n,t,r);o&&K(e,o)&&St(e,o,a,s,i);let u=P(a,o,s);return o?W(e,u,o,i):u}function Rn(e){return S(e)}function Ae(e){return e.trim().toLowerCase().split(/\s+/u).filter(t=>t.length>0).join(" ")}function Dn(e,t){let n=Ae(t);if(n.length===0)return[];let r=C(n);return e.flags.filter(o=>C(Ae(o.target_command))===r).flatMap(o=>[...o.flags])}function At(e,t,n,r){let o=O(e),[s,i]=n;throw new p(`Options '${s}' and '${i}' both set ${o} for extension command '${r}' with different values.`,f.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${o} once, under the handler key '${t}'.`,why:`'${s}' and '${i}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${i}' and pass one value as '${t}'.`,`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`]})}function Mn(e,t,n,r={}){if(t.length===0)return e;let o=t.map(l=>l.repeatable===!0&&l.list!==!0?{...l,list:!0}:l),s=Ct(o),i=Rt(e,s,n),a=new Set([...s.long.values()].map(({handlerKey:l})=>l)),u=Object.create(null),c=Object.create(null);for(let[l,d]of Object.entries(i))a.has(l)?u[l]=d:d===void 0||r.undeclaredKeys==="pass"||It(l)?c[l]=d:pt(l,Tt(l),n,ft(o,{}));return Pe(u,o,n),Object.assign(c,je(u,o,qe(u,s),n))}function qe(e,t){let n=new Set([...t.long.values()].map(({handlerKey:s})=>s)),r=Object.entries(e).filter(([s])=>n.has(s)).flatMap(([s,i])=>(Array.isArray(i)?i.flat(1/0):[i]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),o=Object.create(null);return Object.defineProperty(o,Ce,{value:r}),o}function Pe(e,t,n){for(let r of t){let o=S(r);if(o===null)continue;let s=O(r),i=e[o],a=Object.hasOwn(e,o);r.enabled===!1&&a&&mt(s,n);let u=a&&(r.list!==!0||kt(r,i));r.required===!0&&r.enabled!==!1&&!u&&yt(r,o,s,n),r.list!==!0&&Array.isArray(i)&&Nt(s,n)}}function Nt(e,t){throw new p(`Option '${e}' for extension command '${t}' takes one value; received an array.`,f.USAGE,{code:"extension_flag_value_invalid",flag:e,required:`Pass one value for ${e}, or ask the package to declare it with list: true or repeatable: true.`,why:"The flag is not declared list or repeatable, so pm refuses an array before the extension handler runs instead of handing it a value of the wrong shape.",nextSteps:[`Run pm contracts --command ${t} --flags-only --json to read each flag's value contract.`]})}var Ne=new Set([...[...Q].flatMap(e=>{let t=e.replace(/^--/u,"");return[t,...t.startsWith("no-")?[t.slice(3)]:[]].flatMap(r=>[b(r),r.replaceAll("-","_")])}),"force","subcommand","inputResponses","requestState"]);function It(e){return Ne.has(e)||Ne.has(b(e.replace(/^-{1,2}/u,"")))}function Tt(e){return`--${e.replace(/^-+/u,"").replace(/([a-z0-9])([A-Z])/gu,"$1-$2").replaceAll("_","-").toLowerCase()}`}function Ct(e){let t={long:new Map,short:new Map},n=(r,o,s)=>{o.length>0&&!r.has(o)&&r.set(o,s)};for(let r of e){let o=S(r);if(o===null)continue;let s={handlerKey:o,definition:r};n(t.long,o,s);let i=typeof r.short=="string"?r.short.trim():"";i.startsWith("-")&&!i.startsWith("--")&&n(t.short,i.slice(1),s)}return t}function q(e,t){return e.long.get(t)??e.short.get(t.replace(/^-(?!-)/u,""))??e.long.get(b(t.replace(/^-{1,2}/u,"")))}function Lt(e,t,n,r){let o=/^(?:--)?no-(.+)$/u.exec(t)?.[1];if(o===void 0||q(e,t)!==void 0)return{spelling:t,value:n};let s=q(e,o);return s===void 0||Le(s.definition)!=="boolean"?{spelling:t,value:n}:(s.definition.list===!0||s.definition.repeatable===!0)&&Array.isArray(n)?{spelling:o,value:n.flat(1/0).map(i=>Ie(t,s.definition,i,r))}:s.definition.list===!0&&n!==void 0?{spelling:o,value:Ie(t,s.definition,n,r)}:{spelling:o,value:n===void 0?n:T(t,s.definition,n,r)}}function Ie(e,t,n,r){let o=s=>s.trim().length===0?s:String(T(e,t,s.trim(),r));return n==null?n:typeof n!="string"?T(e,t,n,r):n.trim().length===0?n:t.repeatable===!0||!n.includes(",")?T(e,t,n,r):n.split(",").map(o).join(",")}function T(e,t,n,r){let o=Re(n);return typeof o=="boolean"?!o:Ft(e,t,n,r)}function Ft(e,t,n,r){let o=O(t);throw new p(`Option '${e}' for extension command '${r}' negates ${o} and expects true, false, 1, or 0; received ${JSON.stringify(n)}.`,f.USAGE,{code:"extension_flag_value_invalid",flag:o,required:`Pass ${o} as true or false, or '${e}' as true.`,why:`'${e}' is the negated spelling of the boolean ${o}, so only a boolean value can be inverted before the extension handler runs.`,nextSteps:[`Run pm contracts --command ${r} --flags-only --json to read each flag's value contract.`]})}function Rt(e,t,n){let r=Object.create(null),o=new Map;for(let[s,i]of Object.entries(e)){let{spelling:a,value:u}=Lt(t,s,i,n),c=q(t,a);if(c===void 0)r[a]=u;else if(u!==void 0){let l=o.get(c.handlerKey);l===void 0?(o.set(c.handlerKey,a),r[c.handlerKey]=u):ut(Te(c.definition,c.handlerKey,r[c.handlerKey],t,n),Te(c.definition,c.handlerKey,u,t,n))||At(c.definition,c.handlerKey,[l,a],n)}}return r}function Te(e,t,n,r,o){let s={[t]:n};return Pe(s,[e],o),je(s,[e],qe(s,r),o)[t]}export{Kt as a,Wt as b,Bt as c,Ut as d,Vt as e,be as f,Gt as g,Xt as h,w as i,R as j,ze as k,Jt as l,Qt as m,Ke as n,Zt as o,We as p,on as q,Be as r,N as s,I as t,Oe as u,ln as v,bn as w,vn as x,Sn as y,Nn as z,Rn as A,Dn as B,Mn as C};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-RDELKGLS.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{H as Mt,I as $t,j as Le}from"./chunk-
|
|
1
|
+
import{H as Mt,I as $t,j as Le}from"./chunk-VV2QF5IE.js";import{f as kt,h as Xn,k as ke,l as Nt,m as er,o as Ne,r as Me,s as U,t as $e}from"./chunk-WHHFPATO.js";import{$ as qn,A as w,C as ae,D as X,E as S,Eb as Ct,F as jn,Fb as Re,Gc as Oe,Lc as It,O as Vn,P as St,Q as xt,Sc as Kn,Tb as Ie,Ub as Rt,Y as ce,Z as ee,Zc as Zn,_ as Tt,a as Et,ae as Qn,cb as Ce,da as Hn,dc as ve,hd as Jn,je as Ot,ne as te,rd as vt,re as Lt}from"./chunk-NSFS3VWP.js";import{C as Yn,F as Wn,L as At,T as bt,U as Gn,d as ue,u as P}from"./chunk-R6QFPHWW.js";import{C as de,E as Bn,a as se}from"./chunk-OCKKIECS.js";import{A as m,C as J,E as Q,F as T,I as C,K as be,t as wt,z as f}from"./chunk-NGFDPEP7.js";var Pe=new WeakSet,Pt=new WeakMap,nr=new WeakSet;function rr(e){return nr.add(e),e}function Dt(e){return nr.has(e)}function le(e){Pe.add(e);for(let[t,n]of Object.entries(e)){if(!Array.isArray(n))continue;let r=[...n];Reflect.set(e,t,r),Pe.add(r)}return e}function or(e,t){return Pe.has(e)||t!==void 0&&Pt.get(e)?.has(t)===!0}function ps(e,t){let n=new Set(t);Pt.set(e,n);for(let r of n){let o=Reflect.get(e,r);if(!Array.isArray(o))continue;let i=[...o];Reflect.set(e,r,i),Pe.add(i)}return e}function ir(e,t){if(Dt(e)&&rr(t),or(e))return le(t);let n=Pt.get(e);return n?ps(t,n):t}function wm(e){return or(e)?"sdk":"cli"}function tr(e,t){return e==="cli"?`--${t}`:t.replace(/-([a-z])/gu,(n,r)=>r.toUpperCase())}function fe(e){return`Pass unset: ["${e}"] to clear it`}function De(e,t,n=""){return e==="cli"?`--${t} must not be empty${n}`:`${tr("sdk",t)} must not be empty. ${fe(t)}, or omit ${tr("sdk",t)}.`}var M="-",ar=/^[A-Za-z0-9_.-]+$/u,zt=new Set(["actual_result","body","cmd","command","customer_impact","description","environment","expected_result","impact","location","message","note","outcome","repro_steps","resolution","text","title","unblock_note","value","why_now"]);function cr(e,t){if(e.startsWith("```")||e.includes(`
|
|
2
2
|
`))return!0;let n=t.map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");return new RegExp(`^(?:[-*+]\\s+)?(?:${n})\\s*[:=]`,"i").test(e)}function ur(e){let t=e.trim();if(t==="")return[];let r=(Es(t)??t.split(",")).map(o=>o.trim()).filter(Boolean).map(o=>o.toLowerCase());return Array.from(new Set(r)).sort((o,i)=>o.localeCompare(i))}function dr(e){if(!Array.isArray(e)||e.length===0)return[];let t=[];for(let n of e)if(typeof n=="string")for(let r of ur(n))t.push(r);return Array.from(new Set(t)).sort((n,r)=>n.localeCompare(r))}function lr(e){return Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.trim().toLowerCase()).filter(Boolean):[]}function _s(e){return typeof e!="string"?[]:e.split(";").map(t=>t.trim()).filter(Boolean)}function hs(e,t,n){let r=e.map(s=>s.trim()).filter(Boolean);for(let s of t??[]){let a=s.trim();if(a.includes(";"))throw new m('Acceptance criteria added with --add-ac cannot contain ";" because semicolons delimit stored criteria',f.USAGE,{code:"acceptance_criteria_semicolon_forbidden",required:"Pass one semicolon-free criterion per --add-ac value",why:"A semicolon inside one criterion would be re-read as multiple criteria",nextSteps:["Split the text into repeated --add-ac values, or replace the semicolon with punctuation that is not the storage delimiter"]});a.length>0&&!r.includes(a)&&r.push(a)}let o=[],i=r;for(let s of n??[]){let a=s.trim();if(a.length!==0){if(!i.includes(a)){o.push(a);continue}i=i.filter(c=>c!==a)}}return{criteria:i,unmatchedRemovals:o}}function gs(e,t){let n=lr(e);if(!t||t.length===0)return Array.from(new Set(n)).sort((o,i)=>o.localeCompare(i));let r=new Set(n);for(let o of dr(t))r.add(o);return Array.from(r).sort((o,i)=>o.localeCompare(i))}function ys(e,t){let n=Array.from(new Set(lr(e))).sort((o,i)=>o.localeCompare(i));if(!t||t.length===0)return n;let r=new Set(dr(t));return r.size===0?n:n.filter(o=>!r.has(o))}function Es(e){if(!e.startsWith("["))return null;let t;try{t=JSON.parse(e)}catch{return null}return t.map(r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):"").filter(r=>r.length>0)}function Ut(e){return e.replace(/\r\n/g,`
|
|
3
3
|
`)}function fr(e){let t=Ut(e).trim();if(!t.startsWith("```"))return e;let n=t.split(`
|
|
4
4
|
`);return n.length<2||n.at(-1)?.trim()!=="```"?e:n.slice(1,-1).join(`
|
|
@@ -24,4 +24,4 @@ ${s}`;continue}return null}return r}function hr(e,t){let n=fr(e).trim();if(!n)th
|
|
|
24
24
|
`)){let r=n.trim();if(r.length!==0)try{let o=JSON.parse(r);o&&typeof o=="object"&&typeof o.endpoint=="string"&&o.endpoint.trim().length>0&&"payload"in o&&typeof o.attempts=="number"&&Number.isFinite(o.attempts)&&((typeof o.id!="string"||o.id.length===0)&&(o.id=sm(o)),t.push(o))}catch{}}return t}function am(e,t){if(typeof e.enqueued_at!="string"||e.enqueued_at.trim().length===0)return!1;let n=Date.parse(e.enqueued_at);return Number.isNaN(n)?!1:n<t}function Un(e,t){let n=cs(t),r=[],o=0;for(let i of e){if(JSON.stringify(i).length>Yi||am(i,n)||i.attempts>=Wi){o+=1;continue}r.push(i)}if(r.length>Ui){let i=r.length-Ui;return o+=i,{entries:r.slice(i),prunedCount:o}}return{entries:r,prunedCount:o}}async function cm(e,t){let n=t.map(o=>JSON.stringify(o)).join(`
|
|
25
25
|
`),r=n.length>0?`${n}
|
|
26
26
|
`:"";for(let o=0;;o+=1)try{await C(_t(e),r,{createParentDirectories:!G(process.env[W])});return}catch(i){let s=Gi[o];if(s===void 0||!ds(i))throw i;await ls(s)}}async function qi(e,t,n,r){return Ae(async()=>{let o=await T(_t(e)),i=o===null?[]:zn(o),s=[];for(let c of i){if(n.has(c.id))continue;let u=r.get(c.id);s.push(u?{...c,attempts:u.attempts,next_attempt_after:u.next_attempt_after}:c)}let{entries:a}=Un(s,t);return await cm(e,a),a.length},e)}async function um(e,t){let n=await T(_t(e));if(n===null||n.trim().length===0){await mt(e,{pending_otel_spans:0},null);return}let r=zn(n),{entries:o,prunedCount:i}=Un(r,t),s=o.filter(y=>Dn(y.next_attempt_after)).slice(0,Lf);if(s.length===0){let y=i>0?await qi(e,t,new Set,new Map):o.length;await mt(e,{pending_otel_spans:y},null);return}let a=P(),c=new Set,u=new Map,d=0,l;await Promise.all(s.map(async y=>{try{let g=await os(y.endpoint,{"content-type":"application/json"},JSON.stringify(y.payload));if(g<200||g>=300)throw new Error(`local_otel_export_http_${g}`);c.add(y.id),d+=1}catch(g){l=g instanceof Error?Mn(ut(g.message),"redacted"):"local_otel_export_failed";let _=y.attempts+1;u.set(y.id,{attempts:_,next_attempt_after:ss(_)})}}));let p=await qi(e,t,c,u),h={pending_otel_spans:p,last_otel_attempt_at:a};d>0&&(h.last_otel_success_at=a),l!==void 0?(h.last_otel_failure_at=a,h.last_otel_failure_error=l):p===0&&(h.last_otel_failure_at=void 0,h.last_otel_failure_error=void 0),await mt(e,h,null)}async function dm(e,t,n){try{await pm(e,t,n)}catch{}try{await um(e,n)}catch{}}async function lm(e,t=Uf,n=b().endpoint){try{let r=Zf(e),o=await bf(r,{withFileTypes:!0}),i=Date.now(),s=new Set([xe("events.jsonl",n),xe("state.json",n)]),a=c=>{if(!s.has(c))return/^\.events(?:\.[a-f0-9]{16})?\.jsonl\.\d+\.\d+\.[a-f0-9]+\.tmp$/.test(c)?i-Math.max(0,t):/^(?:events\.[a-f0-9]{16}\.jsonl|state\.[a-f0-9]{16}\.json)$/.test(c)?i-Ff:void 0};await Promise.all(o.map(async c=>{let u=c.isFile()?a(c.name):void 0;if(u===void 0)return;let d=A.join(r,c.name);(await Bi(d)).mtimeMs<u&&await Pn(d,{force:!0})}))}catch{}}async function Ae(e,t=ce(process.cwd()),n=5e3){let r=ji.catch(()=>{}).then(()=>Qn(async()=>{let o=await ve(t,"telemetry-queue",60,"telemetry",!1,!1,n,{createParentDirectories:!G(process.env[W])});try{return ke(t),await e()}finally{await o()}}));return ji=r.catch(()=>{}),r}async function gt(e,t=b().endpoint){let n=await T(pt(e,t));return n===null||n.trim().length===0?[]:is(n)}async function Nn(e,t,n,r=b().endpoint){return Ae(async()=>{let o=await gt(e,r),{entries:i}=ht(o,n),s=i.filter(a=>!t.has(a.event.event_id));return await us(e,s,r),s},e)}async function fm(e,t,n,r,o=b().endpoint){return Ae(async()=>{let i=await gt(e,o),{entries:s}=ht(i,r),a=s.map(c=>{if(!t.has(c.event.event_id))return c;let u=c.attempts+1;return{...c,attempts:u,last_attempt_at:n,next_attempt_after:ss(u)}});return await us(e,a,o),a},e)}function mm(e,t){return t===null?e:ct(e)}async function pm(e,t,n){let r=b().endpoint;await lm(e,void 0,r);let o=(r??t).trim(),i=mm(o,r),s=_=>mt(e,_,r);if(o.length===0)return;let a=await T(pt(e,r));if(a===null||a.trim().length===0){await s({endpoint:i,queue_entries:0});return}let c=is(a);if(c.length===0){await s({endpoint:i,queue_entries:0});return}let{entries:u,prunedCount:d}=ht(c,n);if(u.length===0){let _=await Nn(e,new Set,n,r);await s({endpoint:i,queue_entries:_.length});return}let l=u.filter(_=>as(_)).slice(0,Nf);if(l.length===0){let _=d>0?await Nn(e,new Set,n,r):u;await s({endpoint:i,queue_entries:_.length});return}let p=new Set(l.map(_=>_.event.event_id)),h=P(),y={"content-type":"application/json"},g=process.env.PM_TELEMETRY_INGEST_KEY?.trim();g&&(y["x-pm-telemetry-key"]=g);try{let _=await os(o,y,JSON.stringify({schema_version:kf,events:l.map(E=>E.event)}));if(_<200||_>=300)throw new Error(`telemetry_flush_http_${_}`)}catch(_){let E=await fm(e,p,h,n,r),R=_ instanceof Error?Mn(ut(_.message),"redacted"):"telemetry_flush_failed";await s({endpoint:i,queue_entries:E.length,last_attempted_flush_at:h,last_failed_flush_at:h,last_failed_flush_error:R});return}try{let _=await Nn(e,p,n,r);await s({endpoint:i,queue_entries:_.length,last_attempted_flush_at:h,last_successful_flush_at:h,last_failed_flush_at:void 0,last_failed_flush_error:void 0})}catch(_){let E=_ instanceof Error?Mn(ut(_.message),"redacted"):"telemetry_flush_failed",R=await gt(e,r).catch(()=>u);await s({endpoint:i,queue_entries:R.length,last_attempted_flush_at:h,last_failed_flush_at:h,last_failed_flush_error:E})}}async function _m(e){let t=Ji(e);G(process.env[W])||await kn(A.dirname(t),{recursive:!0});try{return await kn(t),!0}catch(n){if(typeof n!="object"||n===null||!("code"in n)||n.code!=="EEXIST")throw n}try{let n=await Bi(t);return Date.now()-n.mtimeMs<jf?!1:(await Pn(t,{recursive:!0,force:!0}),await kn(t),!0)}catch{return!1}}function hm(e){try{Af(e,{recursive:!0,force:!0})}catch{}}function gm(e){hm(Jf(e))}async function ym(e,t,n){let r=await _m(e);if(gm(e),!r)return!1;try{await dm(e,t,n)}finally{try{await Pn(Ji(e),{recursive:!0,force:!0})}catch{}}return!0}async function Hi(e,t){let n=new Set;try{let{entries:r}=ht(await gt(e),t);for(let o of r.filter(as))n.add(`event:${o.event.event_id}`)}catch{}try{let r=await T(_t(e));if(r!==null)for(let o of Un(zn(r),t).entries)Dn(o.next_attempt_after)&&n.add(`span:${o.id}`)}catch{}return n}async function Ny(e=ce(process.cwd())){if(!Te().telemetry_disabled)try{await Nt(e,async()=>{let t=G(process.env[W]),n=!0;for(;n;){if(!(await U(e)).telemetry.enabled)return;let o=await Ae(()=>om(e),e);if(!o)return;let i=t?await Hi(e,o.retentionDays):new Set;if(!await ym(e,o.endpoint,o.retentionDays)||!t)return;let a=await Hi(e,o.retentionDays);n=a.size>0&&(a.size!==i.size||[...a].some(c=>!i.has(c)))}},()=>G(process.env[W]))}catch{}}export{fn as a,$d as b,U_ as c,F_ as d,j_ as e,V_ as f,q_ as g,H_ as h,B_ as i,Ud as j,Vd as k,qd as l,Hd as m,Yu as n,Dt as o,or as p,wm as q,tr as r,De as s,cr as t,ur as u,_s as v,hs as w,gs as x,ys as y,bm as z,hr as A,bs as B,Cm as C,Cs as D,Rm as E,me as F,Is as G,Ue as H,Im as I,vs as J,ze as K,vm as L,Fe as M,Ls as N,ks as O,Ip as P,qo as Q,vp as R,Op as S,Je as T,Lp as U,Qu as V,Zp as W,ed as X,nd as Y,od as Z,id as _,Qp as $,ld as aa,e_ as ba,fd as ca,md as da,un as ea,_d as fa,dn as ga,hd as ha,h_ as ia,yd as ja,Zo as ka,Ed as la,wd as ma,xd as na,Td as oa,R_ as pa,Cd as qa,N_ as ra,Od as sa,kd as ta,Ns as ua,Fd as va,jd as wa,tt as xa,fl as ya,zm as za,jt as Aa,wr as Ba,qt as Ca,Ys as Da,Ws as Ea,jm as Fa,Sr as Ga,ne as Ha,Ht as Ia,Yt as Ja,wn as Ka,_h as La,Sn as Ma,st as Na,_i as Oa,at as Pa,xn as Qa,Tn as Ra,An as Sa,bn as Ta,Si as Ua,xi as Va,Ph as Wa,Rn as Xa,xe as Ya,Zl as Za,ct as _a,Uh as $a,Te as ab,rg as bb,og as cb,uu as db,Ro as eb,Au as fb,yo as gb,bu as hb,Qm as ib,Iu as jb,vu as kb,Xm as lb,rn as mb,vo as nb,Io as ob,ku as pb,Nu as qb,Oo as rb,fp as sb,mp as tb,$o as ub,Po as vb,Do as wb,pp as xb,Fo as yb,Fu as zb,jo as Ab,_p as Bb,hp as Cb,gp as Db,Vo as Eb,yp as Fb,Vu as Gb,qu as Hb,Hu as Ib,rf as Jb,cf as Kb,df as Lb,lf as Mb,wf as Nb,Sf as Ob,kf as Pb,Wi as Qb,Ae as Rb,Ny as Sb};
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-RFJ3MEFP.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{E as k,
|
|
1
|
+
import{E as k,nb as E}from"./chunk-GQBWI4KA.js";import{M as c,N as C,R as S,S as T}from"./chunk-R6QFPHWW.js";import{C as r,I as w,Q as h,e as p,f as u}from"./chunk-OCKKIECS.js";import{A as _,m as a,z as g}from"./chunk-NGFDPEP7.js";var q=new Set(p),j=new Set(u),d=new Set([...a.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),U=["create","update"];function I(e){if(typeof e!="string")return"";let n=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return n.startsWith("--")?n.slice(2):n}function v(e){return e.replaceAll("_","-")}function z(e,n){let i=new Set;for(let t of e){let o=I(t);o.length>0&&o!==n&&i.add(o)}return[...i].sort((t,o)=>t.localeCompare(o))}function P(e){let n=new Set;for(let i of e??[]){let t=i.trim();t.length>0&&n.add(t)}return[...n].sort((i,t)=>i.localeCompare(t))}function Y(e){let n=new Set,i=[];for(let t of e??[]){let o=t.trim().toLowerCase();if(o.length!==0){if(!j.has(o))throw new Error(`Invalid field command "${t}". Allowed: ${u.join(", ")}.`);n.has(o)||(n.add(o),i.push(o))}}return e===void 0||i.length===0?[...U]:i}function oe(e){let n=r(e.key);if(n.length===0)throw new Error("Field key must not be empty.");if(n.includes(","))throw new Error(`Field key "${n}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(d.has(n))throw new Error(`Cannot define custom field "${n}": custom schema field "${n}" collides with built-in item metadata "${n}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...d].sort((N,R)=>N.localeCompare(R)).join(", ")}.`);let i=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!q.has(i))throw new Error(`Invalid field type "${e.type}". Allowed: ${p.join(", ")}.`);let t=i,o=Y(e.commands),l=I(e.cliFlag),s=l.length>0&&l!==v(n)?l:void 0,f=s??v(n),b=z(e.aliases??[],f),m=e.description?.trim();return{key:n,type:t,commands:o,description:m&&m.length>0?m:void 0,cliFlag:s,cliAliases:b,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:P(e.requiredTypes)}}function B(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let n=e;if(Array.isArray(n.fields))return n.fields;if(Array.isArray(n.definitions))return n.definitions}function K(e){let n=B(e);if(!n)return[];let i=[];for(let t of n){if(typeof t!="object"||t===null||Array.isArray(t))continue;let o=t;typeof o.key!="string"||o.key.trim().length===0||i.push(o)}return i}function le(e){if(e==null||e.trim().length===0)return{fields:[]};let n;try{n=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:K(n)}}function se(e){return`${JSON.stringify({fields:e.fields},null,2)}
|
|
2
2
|
`}function re(e,n){let i=e.fields.find(s=>r(s.key)===n.key),t=i!==void 0,o=e.fields.filter(s=>r(s.key)!==n.key),l={...i,key:n.key,type:n.type,commands:[...n.commands]};return O(l,"description",n.description),O(l,"cli_flag",n.cliFlag),n.cliAliases.length>0?l.cli_aliases=[...n.cliAliases]:delete l.cli_aliases,x(l,"required",n.required),x(l,"required_on_create",n.requiredOnCreate),n.allowUnset===!1?l.allow_unset=!1:delete l.allow_unset,n.requiredTypes.length>0?l.required_types=[...n.requiredTypes]:delete l.required_types,o.push(l),o.sort((s,f)=>r(s.key).localeCompare(r(f.key))),{file:{fields:o},definition:l,replaced:t}}function ae(e,n){let i=r(n);if(i.length===0)throw new Error("Field key must not be empty.");let t=[],o=e.fields.filter(l=>r(l.key)===i?(t.push(l),!1):!0);return t.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:t[0]}}function O(e,n,i){let t=e;i!==void 0&&i.length>0?t[n]=i:delete t[n]}function x(e,n,i){let t=e;i?t[n]=!0:delete t[n]}function $(e){return e.trim().toLowerCase().replace(/^-+/u,"")}function L(e){let n=$(e),i=T({key:n,cli_flag:n,cli_aliases:[]});return[...new Set([...i,S(n)])]}var G=new Set(a.filter(e=>!d.has(e))),J={flag:"--help",short:"-h"},D=new Map;function V(e){let n=D.get(e);if(n===void 0){let i=new Map,t=new Map;for(let o of[...E(e),...k,J]){for(let l of[o.flag,...o.aliases??[]].flatMap(L))i.has(l)||i.set(l,o.flag);o.short!==void 0&&!t.has(o.short)&&t.set(o.short,o.flag)}n={long:i,short:t},D.set(e,n)}return n}function H(e,n){return c(e)?n.short.get(e.trim()):L(e).map(i=>n.long.get(i)).find(i=>i!==void 0)}function F(e){let n=[];for(let i of e){let t=[...new Set([i.cli_flag,...i.cli_aliases,i.key].map(o=>c(o)?o.trim():$(o)))];for(let o of i.commands)n.push(...W(i.key,t,o.replaceAll("_","-")))}return n.sort((i,t)=>i.field.localeCompare(t.field)||i.command.localeCompare(t.command)||i.option.localeCompare(t.option))}function W(e,n,i){let t=V(i),o=new Map;for(let l of n){if(G.has(e)&&l.replaceAll("-","_")===e)continue;let s=H(l,t);s===void 0||o.has(s)||o.set(s,{field:e,command:i,field_flag:c(l)?l:`--${l.replaceAll("_","-")}`,option:s})}return[...o.values()]}function X(e){return F([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases,commands:e.commands}])}function A(e){return e.flatMap(n=>[...new Set([n.cli_flag,...n.cli_aliases])].flatMap(i=>{let t=C(i);return t===void 0?[]:[{field:n.key,spelling:i,reason:t}]}))}function Q(e){return A([{key:e.key,cli_flag:e.cliFlag??e.key.replaceAll("_","-"),cli_aliases:e.cliAliases}])}function Z(e){return`${JSON.stringify(e.spelling)} ${e.reason}`}function ee(e){return`${e.field_flag} shadows built-in ${e.option} on pm ${e.command}`}function ye(e,n){let i=h(e).definitions,t=F(i),o=A(i),l=o.length===0?{details:{},warnings:[]}:{details:{schema_field_flag_invalid_count:o.length,schema_field_flag_invalid:o.slice(0,n),schema_field_flag_invalid_truncated:o.length>n,schema_field_flag_invalid_fix_hint:"Re-register the field with one flag and one spelling per alias: pm schema add-field <key> --cli-flag <flag> --alias <alias>. A short alias is one dash and one character. Edit a field defined inline in settings.json there."},warnings:[`validate_schema_field_flag_invalid:${o.length}`]};return t.length===0?l:{details:{...l.details,schema_field_option_collision_count:t.length,schema_field_option_collisions:t.slice(0,n),schema_field_option_collisions_truncated:t.length>n,schema_field_option_collision_fix_hint:"Rename a file-backed field without losing item values: pm schema rename-field <key> --to <new-key>. For a colliding flag, alias or command list, re-register the same key: pm schema add-field <key> --cli-flag <flag> --commands <commands>. Edit a field defined inline in settings.json there."},warnings:[...l.warnings,`validate_schema_field_option_collision:${t.length}`]}}function Fe(e){y(e.key,Q(e)),M(e.key,e.commands,X(e))}function Ae(e){let n=[e.cli_flag,...Array.isArray(e.cli_aliases)?e.cli_aliases:[]].filter(t=>typeof t=="string");y(e.key,n.filter(t=>w(t).length===0).map(t=>({field:e.key,spelling:t,reason:"is empty"})));let i=h({fields:[e]}).definitions;y(e.key,A(i)),M(e.key,i.flatMap(t=>t.commands),F(i))}function y(e,n){if(n.length!==0)throw new _(`Cannot define custom field "${e}": flag ${n.map(Z).join("; ")}. The command it is registered for could not register it as one option.`,g.USAGE,{code:"schema_field_flag_invalid",field:e,flag:n[0].spelling,required:"Each custom field flag and alias must be one option spelling: a long name without spaces, pipes, commas, '=' or brackets, or a short flag of one dash and one character.",nextSteps:[`Pass one spelling per --alias, for example pm schema add-field ${e} --alias <first> --alias <second>.`]})}function M(e,n,i){if(i.length===0)return;let t={key:e,commands:n},o=new Set(i.map(s=>s.command)),l=t.commands.filter(s=>!o.has(s.replaceAll("_","-")));throw new _(`Cannot define custom field "${t.key}": ${i.map(ee).join("; ")}. The built-in option would stop working for that command.`,g.USAGE,{code:"schema_field_option_collision",field:t.key,flag:i[0].option,required:"A custom field's key, flag and aliases must differ from every built-in option of each command it is registered for.",nextSteps:[`Rename the field with a project-specific prefix, for example pm schema add-field project_${t.key}.`,...l.length>0?[`Or register "${t.key}" only where its option is free: --commands ${l.join(",")}.`]:[]]})}export{oe as a,le as b,se as c,re as d,ae as e,F as f,X as g,A as h,Q as i,Z as j,ee as k,ye as l,Fe as m,Ae as n};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-RMJKVQYE.js.map
|