@unbrained/pm-cli 2026.10.7 → 2026.10.8
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 +2 -2
- package/CHANGELOG.md +15 -0
- package/dist/cli-bundle/bundle-manifest.json +152 -152
- package/dist/cli-bundle/chunks/chunk-34L2BS2Z.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FOLSEOJ2.js +20 -0
- package/dist/cli-bundle/chunks/{chunk-A4QWRU7D.js → chunk-HFCIAXLP.js} +5 -5
- package/dist/cli-bundle/chunks/chunk-JDTBPW4Y.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-TG3IOQUG.js → chunk-K6E2FFUT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VU77O6HC.js → chunk-L7U5FSZ5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-N2PFAWVV.js → chunk-MJVRF67I.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-GJ2OJKRM.js → chunk-OG66KEOF.js} +79 -79
- package/dist/cli-bundle/chunks/{chunk-MOXX7D3F.js → chunk-RCFZ6H2Y.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TNU56MZI.js +8 -0
- package/dist/cli-bundle/chunks/chunk-UGFN5NJ2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-TON7H63A.js → chunk-ZBVAZ7XX.js} +53 -52
- package/dist/cli-bundle/chunks/{chunk-DWH555SN.js → chunk-ZHIMZ65M.js} +16 -16
- package/dist/cli-bundle/chunks/{register-list-query-CBJELTDX.js → register-list-query-PYVSPGPV.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-JRH6EGSE.js → register-mutation-WXP3YLIN.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-WL25C3NP.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-PFKYNEQI.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-2KSPGWLH.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PBNQZV33.js → chunk-6TKAFFEB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EPOCI7ZX.js → chunk-A3W6HFFO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2YICTWWA.js → chunk-BDT5EALU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3BKRCR57.js → chunk-DRHJOG5X.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XIGFEA3W.js → chunk-EOUORVJA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-F2ME5MJY.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QY4Z23QC.js → chunk-L3CZNKZE.js} +11 -11
- package/dist/cli-bundle/focused-chunks/{chunk-QEYEDXRI.js → chunk-LZQGEVKT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FWWFCLDM.js → chunk-MW2TQHZ3.js} +60 -59
- package/dist/cli-bundle/focused-chunks/{chunk-HMG5F5EC.js → chunk-OLCJ2PJS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SIR5RFJX.js → chunk-OSKXYRYZ.js} +27 -27
- package/dist/cli-bundle/focused-chunks/{chunk-NRSA5ZB2.js → chunk-PBPPIGUL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7X3QD5V4.js → chunk-PEBOVLEG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4FKCHJGV.js → chunk-V3EPBB6V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3NSZ5C4A.js → chunk-XT7JAVHI.js} +2 -2
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +2 -2
- 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 +51 -50
- 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 +4 -4
- package/dist/core/extensions/item-fields.d.ts +6 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/fs/fs-utils.d.ts +19 -4
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/lock/lock.d.ts +9 -2
- package/dist/core/lock/lock.js +2 -2
- package/dist/core/store/settings.js +2 -2
- package/dist/core/telemetry/runtime.d.ts +1 -1
- package/dist/core/telemetry/runtime.js +4 -4
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/health.js +2 -2
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/merge/abandoned-receipts.js +1 -1
- package/dist/sdk/merge/driver.js +1 -1
- package/dist/sdk/merge/install.js +3 -2
- package/dist/sdk/merge/receipt-operation.d.ts +5 -5
- package/dist/sdk/merge/receipt-operation.js +1 -1
- package/dist/sdk/merge/receipts.d.ts +1 -1
- package/dist/sdk/merge/receipts.js +3 -3
- package/dist/sdk/merge/worktree-config.d.ts +2 -0
- package/dist/sdk/merge/worktree-config.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/docs/BUILD_AND_RELEASE_ACCEPTANCE.md +36 -100
- package/docs/MERGE_SAFETY.md +61 -6
- package/docs/PACKED_FIRST_RUN.md +26 -42
- package/docs/README.md +1 -0
- package/docs/SDK_AUDITED_MUTATIONS.md +18 -0
- package/docs/SDK_STORAGE_LIFECYCLE.md +35 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
- package/marketplace.json +2 -2
- 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 +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +2 -2
- package/dist/cli-bundle/chunks/chunk-754AV3DC.js +0 -8
- package/dist/cli-bundle/chunks/chunk-CEM35QB2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-CMIU2NDK.js +0 -20
- package/dist/cli-bundle/chunks/chunk-GSQK3VUT.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WUOFG4JY.js +0 -3
- package/dist/cli-bundle/chunks/register-operations-FYV7CUBF.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-M5VO6JUH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3RJ4VK7U.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-H5VREEUE.js +0 -20
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{$c as v,Jf as $,Wc as I,Xc as C,Yc as L,Zc as A,_c as w,cd as M,cf as D,df as F,dh as B,eh as k,g as P,h as m,hf as V,hl as y,j as S,k as N,na as p,pa as h,vb as _}from"./chunk-GJ2OJKRM.js";import{Command as Q}from"commander";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="089f4ea0-a211-5e3e-87d3-c5693de8918d")}catch{}})();function Ue(e){return new Q().name("pm").description("Universal, flexible, extensible, agent-optimized project management CLI for any project or programming language.").version(e).showHelpAfterError(!1).allowExcessArguments(!1).allowUnknownOption(!1).configureOutput({writeOut:t=>{$(t)},writeErr:()=>{}}).option("--json","Output JSON instead of TOON; mutations emit a flat receipt with top-level id/status/changed_field_count while reads use documented entity or collection envelopes").option("--lean","Omit null and empty containers from JSON output").option("--token-accounting","Attach a bounded per-section token-cost receipt to command output").option("--output-include <fields>","Retain comma-separated fields or sections in read output").option("--output-limit <count>","Bound rows in read output").option("--output-budget <tokens|unbounded>","Bound estimated tokens in read output or explicitly disable the default ceiling").option("--output-format <toon|json>","Select the result encoding for reads and mutations").option("--output-session <state>","Carry a JSON session budget and served-item ledger across read calls").option("--output-cursor <cursor>","Resume a budget-compacted declared row collection").option("--output-row-contract","Include row selectors, encoding metadata, and read-output receipts").option("--quiet","Suppress stdout output").option("--no-changed-fields","Omit the changed_fields array from mutation output (keeps changed_field_count)").option("--full-changed-fields","Restore the legacy full mutation envelope and changed_fields array").option("--id-only","Print only id and status for single-item mutation output").option("--pm-path <dir>","Explicit tracker storage path for this command (preferred over --path)").option("--path <dir>","Backward-compatible alias for --pm-path; this is the tracker storage path, not a workspace cwd").option("--no-extensions","Disable extension loading").option("--no-pager","Disable pager integration for help and long output").option("--explain","Render extended rationale and examples in help output").option("--all","Reveal every public command and compatibility alias").option("--profile","Print deterministic timing diagnostics").option("--author <id>","Override mutation author for this invocation").exitOverride()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be9abae1-85ae-5a68-96bc-c738218ace5e")}catch{}})();function Ke(e){return e instanceof h||e instanceof Error?e.message:"Unknown failure"}function ee(e){if(typeof e!="object"||e===null||!("exitCode"in e))return;let t=e.exitCode;return typeof t=="number"&&Number.isFinite(t)?t:void 0}function te(e){let t=Math.trunc(e);return t>p.SUCCESS?t:p.GENERIC_FAILURE}function Ye(e){return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("commander.")}function Xe(e,t){if(e instanceof Error)return e;let o=new Error(t),n=ee(e);return n!==void 0&&(o.exitCode=te(n)),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8efedca0-725e-520f-ad06-825a0cccddaa")}catch{}})();var R=new Set(["append","claim","close","close-task","comments","copy","delete","deps","docs","files","focus","get","history","history-compact","history-redact","history-repair","learnings","notes","pause-task","release","restore","start-task","test","update"]),z=new Map([["files","discover"],["item","complete"]]),ne=new Map([["append",1],["close",1],["close-task",1],["comments",1],["item complete",1],["learnings",1],["notes",1],["restore",1]]);function G(e){let t=m(e?.trim().toLowerCase()??"");return R.has(t)||z.has(t)}function oe(e,t,o){let n=R.has(o)?t+1:void 0,i=w(e.slice(t+1));if(i===void 0)return n;let s=t+1+i,a=`${o} ${e[s]}`,r=m(a);return r===a?o==="item"&&e[s]==="complete"?s+1:n:G(r)?O(e,s,r):void 0}function O(e,t,o){if(["history","context","ctx","update","close","item"].includes(o))return oe(e,t,o);let n=z.get(o);if(n===void 0)return t+1;let i=e[t+1]?.toLowerCase()===n;return t+(i?2:1)}function ie(e){let t=new Map;for(let o of y(e))for(let n of[o.flag,o.short,...o.aliases??[]])n&&t.set(n,o);return t}function se(e){let t=[];for(let o=0;o<e.length;o+=1){let n=e[o];if(n==="--")break;n==="--id"?(t.push({index:o,consumed:2,value:e[o+1]}),o+=1):n.startsWith("--id=")&&t.push({index:o,consumed:1,value:n.slice(5)})}return t}function re(e,t,o){if(e.indexOf("=")>=0||t===void 0||t.startsWith("-"))return!1;let n=o.get(e);return n!==void 0&&n.value_type!=="boolean"}function ae(e,t,o,n,i){let s=0;for(let a=t;a<e.length;a+=1){let r=e[a];if(r==="--")break;if(r==="--id"){a+=1;continue}if(!r.startsWith("--id=")){if(!r.startsWith("-")){if(a<n)return!0;s+=1;continue}re(r,e[a+1],i)&&(a+=1)}}return s>(ne.get(m(o))??0)}function U(e){let t=w(e),o=t===void 0?void 0:e[t]?.toLowerCase();if(o!=="context"&&o!=="ctx"&&!G(o))return{argv:[...e],changed:!1,conflict:!1};let n=O(e,t,o);if(n===void 0)return{argv:[...e],changed:!1,conflict:!1};let i=n>t+1?`${m(e.slice(t,n-1).join(" "))} ${e[n-1]}`:o,s=ie(i),a=se(e),r=a[0];if(!r||!r.value?.trim())return{argv:[...e],changed:!1,conflict:!1};if(a.length>1||ae(e,n,i,r.index,s))return{argv:[...e],changed:!1,conflict:!0,itemId:r.value};let l=[...e.slice(0,r.index),...e.slice(r.index+r.consumed)],c=w(l),u=O(l,c,o);return l.splice(u,0,r.value),{argv:l,changed:!0,conflict:!1,itemId:r.value}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f05cec18-5e48-5151-8ada-577c9df5885d")}catch{}})();var le=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),ce=new Set(["toon","json"]);function ue(e,t,o){let n=e[t];if(C.has(n))return o.booleanFlags.add(n),1;let i=n.indexOf("="),s=i>0?n.slice(0,i):n;if(!I.has(s))return 1;let a=i>0?n.slice(i+1):void 0,r=a===void 0&&A(s,e[t+1]),l=a??(r?e[t+1]:void 0);return s==="--author"?o.author=l??"":typeof l=="string"&&l.length>0&&(le.has(s)?o.outputValues:o.pathValues).set(s,l),r?2:1}function de(e){let t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map},o=0;for(;o<e.length&&e[o]!=="--";)o+=ue(e,o,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(X(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:t.booleanFlags.has("--json")?t.outputValues.get("--output-format")!=="toon":t.outputValues.get("--output-format")==="json",quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...ce.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function q(e){let t=[],o=0;for(;o<e.length;){let n=e[o];if(n==="--")break;if(C.has(n)||n==="--profile"||n==="--id-only"||n==="--full-changed-fields"||n==="--explain"){o+=1;continue}if(I.has(n)){o+=A(n,e[o+1])?2:1;continue}if(L(n)){o+=1;continue}t.push(n),o+=1}return t}function fe(e){let t=q(e);if(t[0]?.trim().toLowerCase()==="help"){let n=[];for(let i=1;i<t.length;i+=1){let s=t[i];if(s.startsWith("-"))break;n.push(s.trim().toLowerCase())}return{requested:!0,commandPathTokens:n}}if(t.findIndex(n=>n==="--help"||n==="-h")<0)return{requested:!1,commandPathTokens:[]};let o=[];for(let n of t){if(n.startsWith("-"))break;o.push(n.trim().toLowerCase())}return{requested:!0,commandPathTokens:o}}function T(e){return w(e)}function pe(e){return v(e)}function me(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:fe(e).requested}function dt(e){let t=["PAGER","MANPAGER","GIT_PAGER","LESS"],o=t.map(s=>process.env[s]),n=()=>{for(let[s,a]of t.entries()){let r=o[s];r===void 0?delete process.env[a]:process.env[a]=r}},i=de(e);return me(e,i)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),n}var he=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ge(e){let t=T(e);if(t===void 0||e[t]!=="extension")return[...e];let o=e[t+1];if(!o||o.startsWith("-"))return[...e];if(!he.has(o))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];let n=`--${o}`;return e.includes(n)?[...e]:[...e.slice(0,t+1),n,...e.slice(t+2)]}var be=new Set(["pm","pm-cli"]);function ye(e,t){let o=T(e);if(o===void 0)return e;let n=e[o];return be.has(n.trim().toLowerCase())?(t.push({from:n,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,o),...e.slice(o+1)]):e}function we(e,t){let o=T(e);if(o!==void 0&&e[o]==="help"){let r=T(e.slice(o+1));o=r===void 0?void 0:o+1+r}if(o===void 0)return e;let n=e[o],i=N[n.trim().toLowerCase()];if(!i)return e;let s=i.split(" "),a=[...e.slice(0,o),...s,...e.slice(o+1)];return t.push({from:n,to:s,reason:"command_alias",confidence:"high"}),a}function E(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function W(e){return E(e).replace(/-/g,"")}function j(e,t,o){let n=e.get(t);if(n===void 0){e.set(t,o);return}n!==o&&e.set(t,null)}function Ie(e){let t=[],o=n=>{typeof n=="string"&&n.startsWith("--")&&t.push(n)};o(e.flag);for(let n of e.aliases??[])o(n);return t}function _e(e,t){let o=t??y(e),n=new Map,i=new Map,s=new Map,a=new Set;for(let r of o){let l=Ie(r);if(l.length===0)continue;let c=`--${E(l[0])}`;for(let f of l)j(n,E(f),c),j(i,W(f),c);let u=W(c);s.has(c)||s.set(c,u),r.list===!0&&a.add(c)}return{canonicalByNormalized:n,canonicalByCompact:i,canonicalComparables:[...s.entries()].map(([r,l])=>({canonicalFlag:r,comparable:l})),listCanonicalFlags:a}}function K(e,t){let o=E(e),n=t.canonicalByNormalized.get(o);if(typeof n=="string")return{flag:n,reason:"flag_alias",confidence:"high"};let i=o.replace(/-/g,""),s=t.canonicalByCompact.get(i);if(typeof s=="string")return{flag:s,reason:"flag_alias",confidence:"high"};let a=i.length>=8?2:1,r=Number.POSITIVE_INFINITY,l,c=!1;for(let u of t.canonicalComparables){let f=_(i,u.comparable,a);if(f!==null){if(f<r){r=f,l=u.canonicalFlag,c=!1;continue}f===r&&l!==u.canonicalFlag&&(c=!0)}}return!l||c||!Number.isFinite(r)||r<=0?null:{flag:l,reason:"flag_typo",confidence:r>=2?"medium":"high"}}function ft(e){let t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function Ce(e,t=!1){if(t||e.includes("://"))return null;let o=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!o)return null;let n=o[1],i=o[3];return i.length===0?null:{key:n,value:i}}function ve(e,t,o=!1){if(o||!e.startsWith("--"))return{tokens:[e]};let n=e.indexOf("="),i=n>=0?e.slice(0,n):e,s=n>=0?e.slice(n+1):void 0,a=K(i,t);if(!a)return{tokens:[e]};let r=s===void 0?a.flag:`${a.flag}=${s}`;return r===e?{tokens:[e]}:{tokens:[r],event:{from:e,to:[r],reason:a.reason,confidence:a.confidence}}}function ke(e){let t=new Set,o=!1;for(let n=0;n<e.length;n+=1){if(o){t.add(n),o=!1;continue}let i=e[n];o=i==="--path"||i==="--pm-path"}return t}function Te(e){if(!e.startsWith("--"))return null;let t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function Ee(e,t,o){o.push(e[t]);let n=e[t+1];return typeof n=="string"&&n!=="--"?(o.push(n),t+2):t+1}function xe(e,t,o,n){if(o.inlineValue!==void 0)return{originalTokens:[e[t]],value:o.inlineValue,consumed:1};let i=[],s=t+1;for(;s<e.length&&e[s]!=="--"&&!e[s].startsWith("-")&&(i.length===0||n.has(o.flag));)i.push(e[s]),s+=1;let a=i.length===0?1:1+i.length;return{originalTokens:e.slice(t,t+a),value:i.length===0?void 0:i.join(","),consumed:a}}function Se(e,t,o,n){let i=e.get(o);if(i){i.values.push(n.value),i.occurrences+=1;return}e.set(o,{outputIndex:t.length,originalTokens:n.originalTokens,values:[n.value],occurrences:1}),t.push(null)}function Ae(e,t){let o=[],n=[];for(let[i,s]of e){if(!(s.occurrences>=2||t.has(i)&&s.originalTokens.length>2)){n.push({outputIndex:s.outputIndex,tokens:s.originalTokens});continue}let a=`${i}=${s.values.join(",")}`;n.push({outputIndex:s.outputIndex,tokens:[a]}),o.push({from:`${i} (x${s.occurrences})`,to:[a],reason:"list_merge",confidence:"high"})}return{events:o,splices:n}}function Oe(e,t){t.sort((o,n)=>n.outputIndex-o.outputIndex);for(let o of t)e.splice(o.outputIndex,1,...o.tokens)}function Pe(e,t,o=new Set,n=new Set){if(t.size===0)return{argv:[...e],events:[]};let i=[],s=new Map,a=0;for(;a<e.length;){let c=e[a];if(c==="--"){i.push(...e.slice(a));break}if(o.has(c)){a=Ee(e,a,i);continue}let u=Te(c);if(!u||!t.has(u.flag)){i.push(c),a+=1;continue}let f=xe(e,a,u,n);if(f.value===void 0){i.push(c),a+=f.consumed;continue}Se(s,i,u.flag,{originalTokens:f.originalTokens,value:f.value}),a+=f.consumed}let{events:r,splices:l}=Ae(s,n);return Oe(i,l),{argv:i,events:r}}var Y=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function Ne(e,t){if(e!=="test"||t.length<2)return!1;let o=t[t.length-1],n=t[t.length-2],i=Y.get(n);return i!==void 0&&i.has(o)}function Le(e,t,o){if(t!=="test")return e;let n=[],i=0;for(;i<e.length;){let s=e[i];if(s==="--")return n.push(...e.slice(i)),n;let a=Y.get(s),r=a?e[i+1]:void 0;if(!a||typeof r!="string"||!a.has(r)){n.push(s),i+=1;continue}let l=i+2;for(;l<e.length&&!e[l].startsWith("-");)l+=1;if(l-(i+2)!==1){n.push(s),i+=1;continue}let c=e[i+2],u=`${r}=${c}`;n.push(s,u),o.push({from:`${s} ${r} ${c}`,to:[s,u],reason:"bare_key_value",confidence:"high"}),i+=3}return n}function Me(e,t,o,n){let i=[],s=ke(e);for(let a=0;a<e.length;a+=1){let r=e[a];if(r==="--"){i.push(...e.slice(a));break}let l=s.has(a),c=i[i.length-1];if(r.startsWith("--")){let b=ve(r,t,l);i.push(...b.tokens),b.event&&n.push(b.event);continue}let u=Ce(r,l);if(!u||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(o)||Ne(o,i)){i.push(r);continue}let f=K(u.key,t);if(!f){i.push(r);continue}let g=u.value.startsWith("-")?[`${f.flag}=${u.value}`]:[f.flag,u.value];i.push(...g),n.push({from:r,to:g,reason:"bare_key_value",confidence:f.confidence})}return i}function De(e){for(let t=0;t<e.length;t+=1){let o=e[t];if(o==="--")break;if(o==="--verify"){let n=e[t+1];if(n===void 0||n==="--")throw new h("history attest --verify requires a bundle file.",p.USAGE);e.splice(t,2,`--verify=${n}`)}else(I.has(o)||o==="--output"||o==="--hash-algorithm")&&(t+=1)}}function Fe(e,t){if(!e.some(n=>n==="--help"||n==="-h"))return;let o=new Set(y(t).flatMap(n=>[n.flag,...n.aliases??[],...n.short===void 0?[]:[n.short]]));for(let n=0;n<e.length;n+=1){let i=e[n];if(i==="--")break;i!=="--help"&&i!=="-h"||o.has(e[n-1])&&!C.has(e[n-1])&&(e[n-1]=i)}}function pt(e){let t=[],o=ye(e,t),n=ge(o);(n.length!==o.length||n.some((b,J)=>b!==o[J]))&&t.push({from:o.join(" "),to:[...n],reason:"legacy_extension_action",confidence:"high"});let i=we(n,t),s=U(i);if(s.conflict)throw new h("Provide the item id either positionally or with --id, not both.",p.USAGE);s.changed&&t.push({from:`--id ${s.itemId}`,to:[s.itemId],reason:"item_id_alias",confidence:"high"});let a=pe(s.argv),r=X(s.argv),l=m(r??a??""),c=_e(r??a),u=Me(s.argv,c,l,t),f=Le(u,l,t),g=Pe(f,c.listCanonicalFlags,I,a==="create"?new Set(["--tags"]):new Set);for(let b of g.events)t.push(b);return Fe(g.argv,r??a),r==="history attest"&&De(g.argv),{argv:g.argv,commandName:a,trace:t}}function X(e){let t=q(e),o=t[0]?.trim().toLowerCase(),n=t[1]?.trim().toLowerCase(),i=P(t);return i?i.canonical:(o==="extension"||o==="package"||o==="packages")&&typeof n=="string"&&n.length>0&&!n.startsWith("-")?`${o} ${n}`:o}function mt(e){for(let t=0;t<e.length;t+=1){let o=e[t];if(o==="--")break;if(o==="--type"){let n=e[t+1];if(typeof n=="string"&&n.trim().length>0)return n.trim();continue}if(o.startsWith("--type=")){let n=o.slice(7).trim();if(n.length>0)return n}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fb625cd9-f8a8-56cf-88ab-abef64051497")}catch{}})();function wt(e){if(e===void 0)return()=>{};let t=e.trim();if(t.length===0)throw new h("--author requires a non-empty value.",p.USAGE,{code:"missing_required_argument",nextSteps:["Pass an explicit author identifier with --author <id>."]});let o=B();k(t);let n=!1;return()=>{n||(n=!0,o===void 0?k(void 0):k(o))}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d0e60f7e-e0a8-5ef4-9af7-4a1f102ccb7d")}catch{}})();var d=Object.freeze({clock:"PM_CLOCK",tickMs:"PM_CLOCK_TICK_MS",seed:"PM_SEED"});function x(e,t,o,n){return new h(e,p.USAGE,{code:"invalid_reproducible_process_environment",reason:t,field:o,required:`${d.clock} and ${d.seed}; ${d.tickMs} is optional`,nextSteps:[`Set ${d.clock} to an ISO-8601 instant with Z or a numeric UTC offset and ${d.seed} to a non-empty reproducibility seed.`,`Optionally set ${d.tickMs} to a non-negative integer; it defaults to 1.`,"Unset all three variables to retain normal wall-clock and cryptographic-random behavior."],recovery:{recovery_mode:"compact",provided_fields:n,missing_required_fields:t==="incomplete"?[d.clock,d.seed].filter(i=>!n.includes(i)):void 0}})}function Ve(e){let t=e[d.clock],o=e[d.tickMs],n=e[d.seed],i=[[d.clock,t],[d.tickMs,o],[d.seed,n]].filter(a=>a[1]!==void 0).map(([a])=>a);if(i.length===0)return;if(t===void 0||n===void 0)throw x("Reproducible process execution requires PM_CLOCK and PM_SEED together.","incomplete",t===void 0?d.clock:d.seed,i);if(n.trim().length===0)throw x(`${d.seed} must not be empty.`,"invalid_value",d.seed,i);if(!V(t))throw x(`${d.clock} must be a valid ISO-8601 instant with Z or a numeric UTC offset.`,"invalid_value",d.clock,i);let s=o===void 0?1:Number(o);if(o?.trim().length===0||!Number.isSafeInteger(s)||s<0)throw x(`${d.tickMs} must be a non-negative integer.`,"invalid_value",d.tickMs,i);return D({clock:t,seed:n,tickMs:s})}function $e(e){let t=Ve(e);return t===void 0?o=>o():F(t)}async function Tt(e,t){return $e(e)(t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d5c48881-420f-5673-8696-e770db353cfc")}catch{}})();function Z(e){return e.trim().match(/--[a-z0-9][a-z0-9_-]*/i)?.[0]?.replaceAll("_","-").toLowerCase()}function Ot(e){if(!(!Array.isArray(e)||e.length===0))return v(e)}function Be(e,t){let o=Z(t);if(!o)return;let n=y(e).find(i=>i.flag===o||i.aliases?.includes(o));return n?n.value_type==="boolean"?null:`<${n.value_name??"value"}>`:"<value>"}function Pt(e,t,o){let n=[...e],i=n.indexOf("--"),s=i<0?n.length:i;for(let a of o){let r=Z(a);if(!r||n.slice(0,s).some(u=>u===r||u.startsWith(`${r}=`)))continue;let l=Be(t,r),c=l?[r,l]:[r];n.splice(s,0,...c),s+=c.length}return n.length===e.length?void 0:M(n)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bd9a8d3b-bc6f-5309-a3fb-7e5f41ef9dab")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a48c9a1f-b959-54a4-a27f-4f662ae7fd31")}catch{}})();var Re={add:["create","append"],fetch:["get"],inspect:["get","health"],log:["history","comments","notes"],ls:["list"],pause:["release"],read:["get"],remove:["delete"],rm:["delete"],show:["get"],start:["start-task"]};function H(e,t){let o=e.trim().toLowerCase(),n=t.trim().toLowerCase();if(n.length===0)return Number.POSITIVE_INFINITY;let i=o.split(" "),s=Re[n]?.indexOf(m(o));if(s!==void 0&&s>=0)return s;if(o===n)return 10;if(i.includes(n))return 11;if(i.some(l=>l.startsWith(n)))return 12;let a=n.length>=5?2:1,r=Number.POSITIVE_INFINITY;for(let l of i){let c=_(l,n,a);c!==null&&(r=Math.min(r,c))}return Number.isFinite(r)?20+r:o.includes(n)?30:Number.POSITIVE_INFINITY}function $t(e,t){return e.map(o=>({path:o,score:H(o,t)})).filter(o=>Number.isFinite(o.score)).sort((o,n)=>o.score!==n.score?o.score-n.score:o.path===n.path?0:o.path<n.path?-1:1).map(o=>o.path)}function Bt(e,t,o){let n=new Set(t),i=S.filter(r=>r.lifecycle==="deprecated").slice().sort((r,l)=>l.alias.length-r.alias.length),s=[],a=e.flatMap(r=>{let l=i.find(u=>r===u.alias||r.startsWith(`${u.alias} `)),c=r;if(l){let u=r.slice(l.alias.length);if(!n.has(`${l.canonical}${u}`))return[];c=`${l.canonical_argv.join(" ")}${u}`}return o!==void 0&&H(r,o)<10&&s.push(c),[c]});return[...new Set(s.length>0?s:a)]}export{Ue as a,Ke as b,ee as c,te as d,Ye as e,Xe as f,G as g,U as h,de as i,q as j,fe as k,T as l,pe as m,dt as n,ge as o,ft as p,Pe as q,Le as r,pt as s,mt as t,wt as u,d as v,Ve as w,$e as x,Tt as y,Ot as z,Be as A,Pt as B,H as C,$t as D,Bt as E};
|
|
2
|
-
//# sourceMappingURL=chunk-GSQK3VUT.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$a as ce,Ja as le}from"./chunk-TON7H63A.js";import{Dc as O,In as se,J as X,Ma as I,Qf as re,Ua as P,Va as J,ab as b,bm as k,cb as Z,cd as te,db as x,hg as ne,hm as R,ic as ee,na as s,pa as l,pi as ae,ri as w,x as G,yl as ie,ym as oe}from"./chunk-GJ2OJKRM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="544840da-22f5-5734-81ec-e12c5612545c")}catch{}})();var Ue=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function _e(e){let t=e?.trim();if(!t||t==="__proto__"||t.length>128)throw new Error("A legacy author must contain 1-128 characters.");return t}function ze(e){let t=e?.trim().toLowerCase();if(!t||!Ue.test(t))throw new Error("A canonical harness must be a lowercase dash-separated namespace.");return t}function je(e){return Object.fromEntries(Object.entries(e).sort(([t],[r])=>t.localeCompare(r)))}function Fe(e,t){let r=new Set;for(let n of(e??[]).slice(0,1e4)){let i=n.trim().slice(0,128);i.length===0||i.startsWith("harness:")||Object.hasOwn(t,i)||r.add(i)}return r.size}function Me(e,t){let r=_e(t.legacy_author),n=ze(t.canonical_harness);if(r===n||r===`harness:${n}`||r.startsWith("harness:"))throw new Error(`The legacy author "${r}" is already canonical and must not be aliased.`);return e[r]===n?!1:(e[r]=n,!0)}function Ve(e,t){if(t.operation==="add")return Me(e,t);if(t.operation==="remove"){let n=_e(t.legacy_author);return Object.hasOwn(e,n)?(delete e[n],!0):!1}if(t.operation==="clear"){let n=Object.keys(e).length>0;for(let i of Object.keys(e))delete e[i];return n}let r=t.operation;throw new Error(`Unsupported vocabulary operation: ${String(r)}`)}function T(e){return{version:e?.version??1,alias_count:Object.keys(e?.aliases??{}).length}}function de(e,t){let r=e?.version??1,n={...e?.aliases},i=Ve(n,t),a={version:i?r+1:r,aliases:je(n)};return{vocabulary:a,preview:{operation:t.operation,changed:i,version_before:r,version_after:a.version,alias_count:Object.keys(a.aliases).length,residual_author_count:Fe(t.observed_authors,a.aliases)}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="78e92b9c-f3da-594e-8158-00409222308f")}catch{}})();var ue=new Set(["item_format"]),fe=new Set(["definition_of_done","metadata_required_fields","lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"]),Ke=new Set(["history_missing_stream_policy","sprint_release_format_policy","parent_reference_policy","metadata_validation_profile","governance_preset","governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default","governance_require_close_reason","governance_create_default_type","governance_workflow_enforcement","governance_parent_reference_policy","governance_metadata_validation_profile","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking","agent_identity_vocabulary"]),Ye=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock","test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),Be={off:"disabled",on:"enabled",true:"enabled",false:"disabled",enabled:"enabled",disabled:"disabled"};function We(e){let t=e.trim().toLowerCase().replaceAll("-","_");if(ue.has(t)||fe.has(t)||Ke.has(t)||t==="context")return t}function He(e){let t=e.trim().toLowerCase();return Be[t]??e}function ge(e,t){let r=We(e);return r===void 0?{routable:!1,reason:`Unknown config key "${e}" cannot route a positional value.`}:r==="context"?{routable:!1,reason:"Config set context does not accept a positional value. Use --default-depth, --activity-limit, --stale-threshold-days, or --section-<name> flags."}:ue.has(r)?{routable:!0,flag:"format",value:t}:fe.has(r)?{routable:!0,flag:"criterion",values:[t]}:{routable:!0,flag:"policy",value:Ye.has(r)?He(t):t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2ae4f6da-17c5-5024-89a2-bb0a4be9a683")}catch{}})();var C=[{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:"Bounded jittered wait in milliseconds before a contended item mutation fails with lock_conflict; 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)."}],Qe=new Map(C.flatMap(e=>[[e.key,e],[e.path.toLowerCase().replaceAll("-","_"),e]]));function me(e){if(typeof e!="string")return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length!==0)return Qe.get(t)}function Xe(e,t){let r=t.trim().toLowerCase();return r==="true"||r==="1"||r==="yes"||r==="on"?{ok:!0,parsed:{descriptor:e,value:!0}}:r==="false"||r==="0"||r==="no"||r==="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 Je(e,t,r){return e.non_empty===!0&&r.length===0?{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}}:e.choices&&!e.choices.includes(r)?{ok:!1,error:{message:`Config set ${e.key} must be one of ${e.choices.join("|")}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function Ze(e,t,r){if(r.length===0)return{ok:!1,error:{message:`Config set ${e.key} requires a non-empty value`}};let n=Number(r);return Number.isFinite(n)?{ok:!0,value:n}:{ok:!1,error:{message:`Config set ${e.key} requires a finite number, got "${t}"`}}}function xe(e,t,r){return!Number.isInteger(r)||r<0?{ok:!1,error:{message:`Config set ${e.key} requires a non-negative integer, got "${t}"`}}:e.min!==void 0&&r<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&&r>e.max?{ok:!1,error:{message:`Config set ${e.key} requires an integer <= ${e.max}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function et(e,t,r){return r<0||r>1?{ok:!1,error:{message:`Config set ${e.key} requires a number in [0, 1], got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function tt(e,t,r){return e.min!==void 0&&r<e.min?{ok:!1,error:{message:`Config set ${e.key} requires a number >= ${e.min}, got "${t}"`}}:{ok:!0,parsed:{descriptor:e,value:r}}}function pe(e,t){if(typeof t!="string")return{ok:!1,error:{message:`Config set ${e.key} requires a string value`}};let r=t.trim();if(e.kind==="boolean")return Xe(e,t);if(e.kind==="string")return Je(e,t,r);let n=Ze(e,t,r);return n.ok?e.kind==="integer"?xe(e,t,n.value):e.kind==="ratio"?et(e,t,n.value):tt(e,t,n.value):{ok:!1,error:n.error}}function N(e,t){let r=t.path.split("."),n=e;for(let i of r){if(typeof n!="object"||n===null)return null;let a=Object.getOwnPropertyDescriptor(n,i);if(!a||!Object.hasOwn(a,"value"))return null;n=a.value}return typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:null}function ye(e,t,r){let n=t.path.split(".");if(n.some(o=>o.length===0||["__proto__","constructor","prototype"].includes(o)))throw new Error("Unsafe settings path");let i=e;for(let o=0;o<n.length-1;o+=1){let d=n[o],c=Object.getOwnPropertyDescriptor(i,d)?.value;if(typeof c!="object"||c===null||Array.isArray(c)){let _={};Object.defineProperty(i,d,{value:_,writable:!0,enumerable:!0,configurable:!0}),i=_}else i=c}let a=n[n.length-1];return Object.getOwnPropertyDescriptor(i,a)?.value===r?!1:(Object.defineProperty(i,a,{value:r,writable:!0,enumerable:!0,configurable:!0}),!0)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d9b6f2ba-2c5e-52ea-891d-53124601fb89")}catch{}})();var he=["project","global"],p={definition_of_done:["definition-of-done","definition_of_done"],item_format:["item-format","item_format"],history_missing_stream_policy:["history-missing-stream-policy","history_missing_stream_policy"],sprint_release_format_policy:["sprint-release-format-policy","sprint_release_format_policy"],parent_reference_policy:["parent-reference-policy","parent_reference_policy"],metadata_validation_profile:["metadata-validation-profile","metadata_validation_profile"],metadata_required_fields:["metadata-required-fields","metadata_required_fields"],lifecycle_stale_blocker_reason_patterns:["lifecycle-stale-blocker-reason-patterns","lifecycle_stale_blocker_reason_patterns"],lifecycle_closure_like_blocked_reason_patterns:["lifecycle-closure-like-blocked-reason-patterns","lifecycle_closure_like_blocked_reason_patterns"],lifecycle_closure_like_resolution_patterns:["lifecycle-closure-like-resolution-patterns","lifecycle_closure_like_resolution_patterns"],lifecycle_closure_like_actual_result_patterns:["lifecycle-closure-like-actual-result-patterns","lifecycle_closure_like_actual_result_patterns"],governance_preset:["governance-preset","governance_preset"],governance_ownership_enforcement:["governance-ownership-enforcement","governance_ownership_enforcement"],governance_create_mode_default:["governance-create-mode-default","governance_create_mode_default"],governance_close_validation_default:["governance-close-validation-default","governance_close_validation_default"],governance_require_close_reason:["governance-require-close-reason","governance_require_close_reason"],governance_create_default_type:["governance-create-default-type","governance_create_default_type"],governance_workflow_enforcement:["governance-workflow-enforcement","governance_workflow_enforcement"],governance_parent_reference_policy:["governance-parent-reference-policy","governance_parent_reference_policy"],governance_metadata_validation_profile:["governance-metadata-validation-profile","governance_metadata_validation_profile"],governance_force_required_for_stale_lock:["governance-force-required-for-stale-lock","governance_force_required_for_stale_lock"],test_result_tracking:["test-result-tracking","test_result_tracking"],untrusted_linked_test_execution:["untrusted-linked-test-execution","untrusted_linked_test_execution"],telemetry_tracking:["telemetry-tracking","telemetry_tracking"],agent_identity_vocabulary:["agent-identity-vocabulary","agent_identity_vocabulary"],context:["context"]},rt=Object.keys(p).map(e=>p[e][0]),nt=Object.fromEntries(Object.keys(p).flatMap(e=>p[e].map(t=>[t,e]))),at={definition_of_done:"Definition of Done criteria list.",item_format:"Default item file format.",history_missing_stream_policy:"Missing history stream handling policy.",sprint_release_format_policy:"Sprint/release format validation policy.",parent_reference_policy:"Parent reference validation policy.",metadata_validation_profile:"Validate metadata profile policy (core|strict|custom).",metadata_required_fields:"Validate custom metadata required-fields list.",lifecycle_stale_blocker_reason_patterns:"Validate lifecycle stale-blocker reason substring patterns (criteria list).",lifecycle_closure_like_blocked_reason_patterns:"Validate lifecycle closure-like blocked_reason substring patterns (criteria list).",lifecycle_closure_like_resolution_patterns:"Validate lifecycle closure-like resolution substring patterns (criteria list).",lifecycle_closure_like_actual_result_patterns:"Validate lifecycle closure-like actual_result substring patterns (criteria list).",governance_preset:"Governance preset policy (minimal|default|strict|custom).",governance_ownership_enforcement:"Governance ownership enforcement policy (none|warn|strict).",governance_create_mode_default:"Governance default create mode (progressive|strict).",governance_close_validation_default:"Governance default close validation mode (off|warn|strict).",governance_require_close_reason:"Governance close-reason requirement policy (enabled|disabled).",governance_create_default_type:"Governance default item type for `pm create` when --type is omitted.",governance_workflow_enforcement:"Governance per-type transition enforcement mode (off|warn|strict).",governance_parent_reference_policy:"Governance parent reference policy (warn|strict_error).",governance_metadata_validation_profile:"Governance metadata validation profile (core|strict|custom).",governance_force_required_for_stale_lock:"Governance stale-lock force policy (enabled|disabled).",test_result_tracking:"Item-level linked test result persistence policy.",untrusted_linked_test_execution:"Permit an explicit per-run override for commands not trusted by this clone.",telemetry_tracking:"Telemetry usage reporting policy.",agent_identity_vocabulary:"Versioned exact legacy-author interpretation vocabulary (summary only).",context:"Context command settings (depth, section toggles, limits)."},it=["lifecycle_stale_blocker_reason_patterns","lifecycle_closure_like_blocked_reason_patterns","lifecycle_closure_like_resolution_patterns","lifecycle_closure_like_actual_result_patterns"],ot=new Set(["metadata_required_fields",...it]),st=new Set(["test_result_tracking","untrusted_linked_test_execution","telemetry_tracking"]),lt=new Set(["governance_require_close_reason","governance_force_required_for_stale_lock"]),ct=new Set(["governance_ownership_enforcement","governance_create_mode_default","governance_close_validation_default"]),_t=new Set(["governance_parent_reference_policy","governance_metadata_validation_profile","governance_workflow_enforcement"]),dt=new Set(["governance_preset","governance_create_default_type"]),be=e=>ot.has(e),ut=e=>ct.has(e),ft=e=>_t.has(e),gt=e=>dt.has(e);function $(e){return e==="definition_of_done"||be(e)}function ke(e){if(he.includes(e))return e;throw new l(`Invalid config scope "${e}". Allowed: ${he.join(", ")}`,s.USAGE)}function Ce(e){if(e==="get"||e==="set"||e==="list"||e==="export")return e;throw ie({command_path:"config",token:e.trim()||"<empty>",allowed:["export","get","list","set"],token_kind:"action"})}function Ee(e){let t=nt[e];if(t)return t;let r=C.map(n=>n.key).join(", ");throw new l(`Invalid config key "${e}". Supported: ${rt.join(", ")} (underscore variants also accepted). Nested leaf settings: ${r}.`,s.USAGE)}function Ae(e,t){let r=[...new Set((e??[]).map(n=>n.trim()).filter(n=>n.length>0))].sort((n,i)=>n.localeCompare(i));if(t){if(r.length>0)throw new l("Config set definition-of-done cannot combine --clear-criteria with --criterion values",s.USAGE);return[]}if(r.length===0)throw new l("Config set definition-of-done requires at least one non-empty --criterion value (or --clear-criteria to clear)",s.USAGE);return r}function Se(e){let t=e?.trim().toLowerCase();if(t==="toon")return"toon";throw t==="json_markdown"?new l("Config set item-format no longer accepts json_markdown. Markdown item files are legacy read/migration input only.",s.USAGE):new l("Config set item-format requires --format toon",s.USAGE)}function z(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="auto_create"||t==="strict_error")return t;throw new l("Config set history-missing-stream-policy requires --policy with one of: auto_create, strict_error",s.USAGE)}function qe(e){return j(e,"test-result-tracking")}function j(e,t){let r=e?.trim().toLowerCase().replaceAll("-","_");if(r==="enabled"||r==="disabled")return r;throw new l(`Config set ${t} requires --policy with one of: enabled, disabled`,s.USAGE)}function F(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set telemetry-tracking requires --policy with one of: enabled, disabled",s.USAGE)}function E(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="core"||t==="strict"||t==="custom")return t;throw new l("Config set metadata-validation-profile requires --policy with one of: core, strict, custom",s.USAGE)}function M(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="minimal"||t==="default"||t==="strict"||t==="custom")return t;throw new l("Config set governance-preset requires --policy with one of: minimal, default, strict, custom",s.USAGE)}function V(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="none"||t==="warn"||t==="strict")return t;throw new l("Config set governance-ownership-enforcement requires --policy with one of: none, warn, strict",s.USAGE)}function K(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="progressive"||t==="strict")return t;throw new l("Config set governance-create-mode-default requires --policy with one of: progressive, strict",s.USAGE)}function Y(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new l("Config set governance-close-validation-default requires --policy with one of: off, warn, strict",s.USAGE)}function B(e){let t=typeof e=="string"?e.trim().toLowerCase().replaceAll("-","_"):void 0;if(t==="off"||t==="warn"||t==="strict")return t;if(t==="none"||t==="disabled")return"off";throw new l("Config set governance-workflow-enforcement requires one of: off, warn, strict",s.USAGE)}function W(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-force-required-for-stale-lock requires --policy with one of: enabled, disabled",s.USAGE)}function H(e){let t=e?.trim().toLowerCase().replaceAll("-","_");if(t==="enabled"||t==="disabled")return t;throw new l("Config set governance-require-close-reason requires --policy with one of: enabled, disabled",s.USAGE)}var mt={test_result_tracking:"test-result-tracking",untrusted_linked_test_execution:"untrusted-linked-test-execution"};function D(e,t){let r=mt[e];if(r)return j(t,r);switch(e){case"history_missing_stream_policy":return z(t);case"sprint_release_format_policy":return R(t);case"parent_reference_policy":case"governance_parent_reference_policy":return k(t);case"metadata_validation_profile":case"governance_metadata_validation_profile":return E(t);case"governance_preset":return M(t);case"governance_ownership_enforcement":return V(t);case"governance_create_mode_default":return K(t);case"governance_close_validation_default":return Y(t);case"governance_require_close_reason":return H(t);case"governance_workflow_enforcement":return B(t);case"governance_force_required_for_stale_lock":return W(t);case"telemetry_tracking":return F(t);default:return t.trim().toLowerCase().replaceAll("-","_")}}var ve={author:"author",acceptance_criteria:"acceptance_criteria","acceptance-criteria":"acceptance_criteria",estimated_minutes:"estimated_minutes","estimated-minutes":"estimated_minutes",estimate:"estimated_minutes",close_reason:"close_reason","close-reason":"close_reason",reviewer:"reviewer",risk:"risk",confidence:"confidence",sprint:"sprint",release:"release"},pt=["author","acceptance_criteria","estimated_minutes","close_reason","reviewer","risk","confidence","sprint","release"];function Ge(e,t){let r=[...new Set((e??[]).map(a=>a.trim()).filter(a=>a.length>0))];if(t){if(r.length>0)throw new l("Config set metadata-required-fields cannot combine --clear-criteria with --criterion values",s.USAGE);return[]}if(r.length===0)throw new l("Config set metadata-required-fields requires at least one --criterion value (or --clear-criteria to clear)",s.USAGE);let n=r.map(a=>a.toLowerCase().replaceAll("-","_")),i=n.filter(a=>ve[a]===void 0);if(i.length>0)throw new l(`Config set metadata-required-fields received unsupported values: ${i.join(", ")}. Supported values: ${pt.join(", ")}`,s.USAGE);return[...new Set(n.map(a=>ve[a]))].sort((a,o)=>a.localeCompare(o))}function yt(e,t,r){let n=[...new Set((t??[]).map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))].sort((i,a)=>i.localeCompare(a));if(r){if(n.length>0)throw new l(`Config set ${p[e][0]} cannot combine --clear-criteria with --criterion values`,s.USAGE);return[]}if(n.length===0)throw new l(`Config set ${p[e][0]} requires at least one --criterion value (or --clear-criteria to clear)`,s.USAGE);return n}function Ie(e){return[...new Set(e)].sort((t,r)=>t.localeCompare(r))}function ht(e,t){if(e==="list"||e==="export"){if(typeof t=="string"&&t.trim().length>0)throw new l(`Config action "${e}" does not accept <key>`,s.USAGE);return}if(typeof t!="string"||t.trim().length===0)throw new l(`Config action "${e}" requires <key>`,s.USAGE);return Ee(t)}function Pe(e){if(!e)throw new l("Config action requires <key>",s.USAGE)}var vt={definition_of_done:e=>[...e.workflow.definition_of_done],item_format:e=>e.item_format,history_missing_stream_policy:e=>e.history.missing_stream,sprint_release_format_policy:e=>e.validation.sprint_release_format,parent_reference_policy:e=>e.validation.parent_reference,metadata_validation_profile:e=>e.validation.metadata_profile,metadata_required_fields:e=>[...e.validation.metadata_required_fields],lifecycle_stale_blocker_reason_patterns:e=>[...e.validation.lifecycle_stale_blocker_reason_patterns],lifecycle_closure_like_blocked_reason_patterns:e=>[...e.validation.lifecycle_closure_like_blocked_reason_patterns],lifecycle_closure_like_resolution_patterns:e=>[...e.validation.lifecycle_closure_like_resolution_patterns],lifecycle_closure_like_actual_result_patterns:e=>[...e.validation.lifecycle_closure_like_actual_result_patterns],governance_preset:e=>e.governance.preset,governance_ownership_enforcement:e=>e.governance.ownership_enforcement,governance_create_mode_default:e=>e.governance.create_mode_default,governance_close_validation_default:e=>e.governance.close_validation_default,governance_require_close_reason:e=>e.governance.require_close_reason?"enabled":"disabled",governance_create_default_type:e=>e.governance.create_default_type??"",governance_workflow_enforcement:e=>e.governance.workflow_enforcement??"off",governance_parent_reference_policy:e=>e.governance.parent_reference,governance_metadata_validation_profile:e=>e.governance.metadata_profile,governance_force_required_for_stale_lock:e=>e.governance.force_required_for_stale_lock?"enabled":"disabled",test_result_tracking:e=>e.testing.record_results_to_items?"enabled":"disabled",untrusted_linked_test_execution:e=>e.testing.allow_untrusted_linked_tests?"enabled":"disabled",telemetry_tracking:e=>e.telemetry.enabled?"enabled":"disabled",agent_identity_vocabulary:e=>T(e.agent_identity?.identity_vocabulary),context:e=>({default_depth:e.context.default_depth,activity_limit:e.context.activity_limit,stale_threshold_days:e.context.stale_threshold_days,sections:{...e.context.sections}})};function Q(e,t){return vt[t](e)}function g(e,t){return t.length===0?e:{...e,warnings:t}}async function wt(e,t){let r=process.cwd(),n=e==="project"?b(r,t.path):Z(r),i=x(n);return e==="project"&&await re(n),{pmRoot:n,settingsPath:i}}function bt(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t==="true"||t==="enabled"||t==="on"||t==="1")return!0;if(t==="false"||t==="disabled"||t==="off"||t==="0")return!1;throw new l(`Context section toggle must be true|false|enabled|disabled, got "${e}"`,s.USAGE)}function we(e,t){let r=e.trim(),n=Number(r);if(/^\d+$/u.test(r)&&Number.isSafeInteger(n)&&n>0)return n;throw new l(`Context ${t} must be a positive integer`,s.USAGE)}async function kt(e,t,r,n,i){let a=!1,o=e.context;if(t.defaultDepth!==void 0){let c=t.defaultDepth.trim().toLowerCase();if(!I.includes(c))throw new l(`Context --default-depth must be one of ${I.join("|")}`,s.USAGE);o.default_depth!==c&&(o.default_depth=c,a=!0)}if(t.activityLimit!==void 0){let c=we(t.activityLimit,"--activity-limit");o.activity_limit!==c&&(o.activity_limit=c,a=!0)}if(t.staleThresholdDays!==void 0){let c=we(t.staleThresholdDays,"--stale-threshold-days");o.stale_threshold_days!==c&&(o.stale_threshold_days=c,a=!0)}let d=[["hierarchy",t.sectionHierarchy],["activity",t.sectionActivity],["progress",t.sectionProgress],["blockers",t.sectionBlockers],["files",t.sectionFiles],["workload",t.sectionWorkload],["staleness",t.sectionStaleness],["tests",t.sectionTests]];for(let[c,_]of d){let m=bt(_);if(m!==void 0){let y=c;o.sections[y]!==m&&(o.sections[y]=m,a=!0)}}return a&&await w(r.pmRoot,e,"config:set:context"),g({scope:n,key:"context",context_settings:{default_depth:o.default_depth,activity_limit:o.activity_limit,stale_threshold_days:o.stale_threshold_days,sections:{...o.sections}},settings_path:r.settingsPath,changed:a},i)}function Ct(e,t,r){if(r.value!==void 0&&r.value!==t)throw new l(`Config set ${e} received both positional value "${t}" and --value "${r.value}". Pass only one.`,s.USAGE);return{...r,value:t}}function Oe(e,t,r,n,i,a){if(i===void 0)return a;if(e!=="set")throw new l(`Config action "${e}" does not accept a positional value. Only "set" takes <value>.`,s.USAGE);if(typeof t!="string"||t.trim().length===0)throw new l('Config action "set" requires <key> before a positional <value>.',s.USAGE);if(n)return Ct(t,i,a);Pe(r);let o=ge(r,i);if(!o.routable)throw new l(o.reason,s.USAGE);if(o.flag==="criterion"){if(a.criterion!==void 0&&a.criterion.length>0)throw new l(`Config set ${t} received both positional value "${i}" and --criterion. Pass criteria via --criterion only when supplying more than one value.`,s.USAGE);return{...a,criterion:o.values}}if(o.flag==="format")return{...a,format:o.value};if(a.policy!==void 0&&D(r,a.policy)!==D(r,o.value))throw new l(`Config set ${t} received both positional value "${i}" and --policy "${a.policy}". Pass only one.`,s.USAGE);return{...a,policy:o.value}}function Et(e){let t=Object.keys(p).map(n=>({key:n,aliases:p[n],value_kind:n==="context"||n==="agent_identity_vocabulary"?"object":$(n)?"string_array":"enum",set_flags:n==="context"?["--default-depth","--activity-limit","--stale-threshold-days","--section-<name>"]:n==="agent_identity_vocabulary"?["--policy","--value","--criterion"]:$(n)?["--criterion","--clear-criteria"]:n==="item_format"?["--format"]:["--policy"],summary:at[n],value:Q(e.settings,n)})),r=C.map(n=>({key:n.key,canonical_key:n.key.replaceAll("_","-"),path:n.path,kind:n.kind,value:N(e.settings,n),summary:n.summary,...n.choices?{choices:[...n.choices]}:{},...n.min===void 0?{}:{min:n.min},...n.max===void 0?{}:{max:n.max}}));return g({scope:e.scope,keys:t,nested_settings:r,count:t.length,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function At(e){let t=Object.fromEntries(Object.keys(p).map(r=>[r,Q(e.settings,r)]));return g({scope:e.scope,values:t,settings_path:e.target.settingsPath,changed:!1},e.warnings)}function St(e,t){let r=Q(e.settings,t),n={scope:e.scope,key:t,settings_path:e.target.settingsPath,changed:!1};return t==="item_format"?g({...n,format:e.settings.item_format,has_explicit_item_format:e.metadata.has_explicit_item_format},e.warnings):t==="context"?g({...n,context_settings:r},e.warnings):t==="agent_identity_vocabulary"?g({...n,identity_vocabulary:r},e.warnings):Array.isArray(r)?g({...n,criteria:r},e.warnings):g({...n,policy:r},e.warnings)}async function qt(e,t,r,n){if(t==="get"){let d=N(e.settings,r);return g({scope:e.scope,key:r.key,nested_setting:{key:r.key,path:r.path,kind:r.kind,value:d},settings_path:e.target.settingsPath,changed:!1},e.warnings)}let i=n.value;if(typeof i!="string")throw new l(`Config set ${r.key} requires a value. Pass it positionally (\`pm config ${e.scope} set ${r.key} <value>\`) or via --value.`,s.USAGE);let a=pe(r,i);if(!a.ok)throw new l(a.error.message,s.USAGE);let o=ye(e.settings,r,a.parsed.value);return o&&await w(e.target.pmRoot,e.settings,`config:set:${r.path}`),g({scope:e.scope,key:r.key,nested_setting:{key:r.key,path:r.path,kind:r.kind,value:a.parsed.value},settings_path:e.target.settingsPath,changed:o},e.warnings)}async function u(e,t,r){t&&await w(e.target.pmRoot,e.settings,r)}function L(e,t,r){return e!==r||t!==r}function f(e,t,r,n){return g({scope:e.scope,key:t,policy:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}function U(e,t,r,n){return g({scope:e.scope,key:t,criteria:r,settings_path:e.target.settingsPath,changed:n},e.warnings)}async function Gt(e,t){let r=Se(t.format),n=e.settings.item_format!==r||!e.metadata.has_explicit_item_format,i;if(n){let a=P(e.settings,O()),o=await se(e.target.pmRoot,r,"config:set:item_format:migrate",a.type_to_folder,e.settings.schema);i={target_format:o.target_format,scanned:o.scanned,migrated:o.migrated,removed:o.removed,warnings:o.warnings},e.settings.item_format=r,await w(e.target.pmRoot,e.settings,"config:set:item_format")}return g({scope:e.scope,key:"item_format",format:e.settings.item_format,has_explicit_item_format:!0,migration:i,settings_path:e.target.settingsPath,changed:n},e.warnings)}async function It(e,t,r){if(t==="history_missing_stream_policy"){let a=z(r.policy),o=e.settings.history.missing_stream!==a;return e.settings.history.missing_stream=a,await u(e,o,"config:set:history_missing_stream_policy"),f(e,t,e.settings.history.missing_stream,o)}if(t==="sprint_release_format_policy"){let a=R(r.policy),o=e.settings.validation.sprint_release_format!==a;return e.settings.validation.sprint_release_format=a,await u(e,o,"config:set:sprint_release_format_policy"),f(e,t,e.settings.validation.sprint_release_format,o)}if(t==="parent_reference_policy"){let a=k(r.policy),o=e.settings.validation.parent_reference!==a||e.settings.governance.preset!=="custom"||e.settings.governance.parent_reference!==a;return e.settings.validation.parent_reference=a,e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,await u(e,o,"config:set:parent_reference_policy"),f(e,t,e.settings.validation.parent_reference,o)}let n=E(r.policy),i=e.settings.validation.metadata_profile!==n||e.settings.governance.preset!=="custom"||e.settings.governance.metadata_profile!==n;return e.settings.validation.metadata_profile=n,e.settings.governance.preset="custom",e.settings.governance.metadata_profile=n,await u(e,i,"config:set:metadata_validation_profile"),f(e,t,e.settings.validation.metadata_profile,i)}async function Pt(e,t,r){if(t==="metadata_required_fields"){let o=Ge(r.criterion,r.clearCriteria),d=o.length!==e.settings.validation.metadata_required_fields.length||o.some((c,_)=>c!==e.settings.validation.metadata_required_fields[_]);return e.settings.validation.metadata_required_fields=o,await u(e,d,"config:set:metadata_required_fields"),U(e,t,[...e.settings.validation.metadata_required_fields],d)}let n={lifecycle_stale_blocker_reason_patterns:e.settings.validation.lifecycle_stale_blocker_reason_patterns,lifecycle_closure_like_blocked_reason_patterns:e.settings.validation.lifecycle_closure_like_blocked_reason_patterns,lifecycle_closure_like_resolution_patterns:e.settings.validation.lifecycle_closure_like_resolution_patterns,lifecycle_closure_like_actual_result_patterns:e.settings.validation.lifecycle_closure_like_actual_result_patterns}[t],i=yt(t,r.criterion,r.clearCriteria),a=i.length!==n.length||i.some((o,d)=>o!==n[d]);return n.splice(0,n.length,...i),await u(e,a,`config:set:${t}`),U(e,t,[...n],a)}async function Ot(e,t,r){if(t==="governance_preset"){let c=M(r.policy),_=e.settings.governance.preset!==c;return e.settings.governance.preset=c,await u(e,_,"config:set:governance_preset"),f(e,t,e.settings.governance.preset,_)}let n=typeof r.policy=="string",i=n?r.policy.trim():"";if(n&&i.length===0){let c=e.settings.governance.create_default_type!==void 0;return delete e.settings.governance.create_default_type,await u(e,c,"config:set:governance_create_default_type"),f(e,t,e.settings.governance.create_default_type??"",c)}if(i.length===0)throw new l('Config set governance-create-default-type requires an item type value (or an empty value "" to clear it)',s.USAGE);let a=P(e.settings,O()),o=J(i,a);if(!o)throw new l(oe(i,a.types,ne(e.target.pmRoot,e.settings.schema)),s.USAGE);let d=e.settings.governance.create_default_type!==o;return e.settings.governance.create_default_type=o,await u(e,d,"config:set:governance_create_default_type"),f(e,t,e.settings.governance.create_default_type,d)}async function Rt(e,t,r){if(t==="governance_ownership_enforcement"){let a=V(r.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.ownership_enforcement!==a;return e.settings.governance.preset="custom",e.settings.governance.ownership_enforcement=a,await u(e,o,"config:set:governance_ownership_enforcement"),f(e,t,e.settings.governance.ownership_enforcement,o)}if(t==="governance_create_mode_default"){let a=K(r.policy),o=e.settings.governance.preset!=="custom"||e.settings.governance.create_mode_default!==a;return e.settings.governance.preset="custom",e.settings.governance.create_mode_default=a,await u(e,o,"config:set:governance_create_mode_default"),f(e,t,e.settings.governance.create_mode_default,o)}let n=Y(r.policy),i=e.settings.governance.preset!=="custom"||e.settings.governance.close_validation_default!==n;return e.settings.governance.preset="custom",e.settings.governance.close_validation_default=n,await u(e,i,"config:set:governance_close_validation_default"),f(e,t,e.settings.governance.close_validation_default,i)}async function Tt(e,t,r){if(t==="governance_parent_reference_policy"){let a=k(r.policy),o=e.settings.governance.preset!=="custom"||L(e.settings.governance.parent_reference,e.settings.validation.parent_reference,a);return e.settings.governance.preset="custom",e.settings.governance.parent_reference=a,e.settings.validation.parent_reference=a,await u(e,o,"config:set:governance_parent_reference_policy"),f(e,t,e.settings.governance.parent_reference,o)}if(t==="governance_metadata_validation_profile"){let a=E(r.policy),o=e.settings.governance.preset!=="custom"||L(e.settings.governance.metadata_profile,e.settings.validation.metadata_profile,a);return e.settings.governance.preset="custom",e.settings.governance.metadata_profile=a,e.settings.validation.metadata_profile=a,await u(e,o,"config:set:governance_metadata_validation_profile"),f(e,t,e.settings.governance.metadata_profile,o)}let n=B(r.policy),i=(e.settings.governance.workflow_enforcement??"off")!==n;return e.settings.governance.workflow_enforcement=n,await u(e,i,"config:set:governance_workflow_enforcement"),f(e,t,e.settings.governance.workflow_enforcement,i)}async function Nt(e,t,r){if(t==="governance_require_close_reason"){let a=H(r.policy)==="enabled",o=e.settings.governance.require_close_reason!==a;return e.settings.governance.require_close_reason=a,await u(e,o,"config:set:governance_require_close_reason"),f(e,t,e.settings.governance.require_close_reason?"enabled":"disabled",o)}let n=W(r.policy)==="enabled",i=e.settings.governance.preset!=="custom"||e.settings.governance.force_required_for_stale_lock!==n;return e.settings.governance.preset="custom",e.settings.governance.force_required_for_stale_lock=n,await u(e,i,"config:set:governance_force_required_for_stale_lock"),f(e,t,e.settings.governance.force_required_for_stale_lock?"enabled":"disabled",i)}async function $t(e,t,r){if(t==="test_result_tracking"){let a=qe(r.policy)==="enabled",o=e.settings.testing.record_results_to_items!==a;return e.settings.testing.record_results_to_items=a,await u(e,o,"config:set:test_result_tracking"),f(e,t,e.settings.testing.record_results_to_items?"enabled":"disabled",o)}if(t==="untrusted_linked_test_execution"){let a=j(r.policy,"untrusted-linked-test-execution")==="enabled",o=e.settings.testing.allow_untrusted_linked_tests!==a;return e.settings.testing.allow_untrusted_linked_tests=a,await u(e,o,"config:set:untrusted_linked_test_execution"),f(e,t,e.settings.testing.allow_untrusted_linked_tests?"enabled":"disabled",o)}let n=F(r.policy)==="enabled",i=e.settings.telemetry.enabled!==n||!e.settings.telemetry.first_run_prompt_completed;return e.settings.telemetry.enabled=n,e.settings.telemetry.first_run_prompt_completed=!0,await u(e,i,"config:set:telemetry_tracking"),f(e,t,e.settings.telemetry.enabled?"enabled":"disabled",i)}async function Dt(e,t,r){let n=Ae(r.criterion,r.clearCriteria),i=n.length!==e.settings.workflow.definition_of_done.length||n.some((a,o)=>a!==e.settings.workflow.definition_of_done[o]);return e.settings.workflow.definition_of_done=n,await u(e,i,"config:set:definition_of_done"),U(e,t,[...e.settings.workflow.definition_of_done],i)}function Lt(e){let t=e?.trim().toLowerCase().replaceAll("_","-"),r=t?.startsWith("preview-")===!0,n=r?t.slice(8):t;if(n==="add"||n==="remove"||n==="clear")return{operation:n,dryRun:r};throw new l("Config set agent-identity-vocabulary requires --policy add|remove|clear|preview-add|preview-remove|preview-clear",s.USAGE)}function Ut(e,t){if(e==="add"){let r=t?.lastIndexOf("=")??-1;if(r<=0||r===t.length-1)throw new l('Config set agent-identity-vocabulary --policy add requires --value "<legacy-author>=<canonical-harness>"',s.USAGE);return{legacy_author:t.slice(0,r),canonical_harness:t.slice(r+1)}}if(e==="remove"){if(t===void 0)throw new l("Config set agent-identity-vocabulary --policy remove requires --value <legacy-author>",s.USAGE);return{legacy_author:t}}if(t!==void 0)throw new l("Config set agent-identity-vocabulary --policy clear does not accept --value",s.USAGE);return{}}async function zt(e,t){let{operation:r,dryRun:n}=Lt(t.policy),i=Ut(r,t.value),a;try{a=de(e.settings.agent_identity?.identity_vocabulary,{operation:r,...i,observed_authors:t.criterion})}catch(o){throw new l(o.message,s.USAGE)}return a.preview.changed&&!n&&(e.settings.agent_identity={...e.settings.agent_identity,identity_vocabulary:a.vocabulary},await u(e,!0,`config:set:agent_identity.identity_vocabulary:${r}:v${a.preview.version_after}`)),g({scope:e.scope,key:"agent_identity_vocabulary",identity_vocabulary:T(n?e.settings.agent_identity?.identity_vocabulary:a.vocabulary),vocabulary_mutation:a.preview,settings_path:e.target.settingsPath,changed:a.preview.changed&&!n},e.warnings)}async function jt(e,t,r){if(r.clearCriteria===!0&&!$(t))throw new l("--clear-criteria is only supported with config set criteria-list keys",s.USAGE);return t==="item_format"?Gt(e,r):t==="context"?kt(e.settings,r,e.target,e.scope,e.warnings):t==="agent_identity_vocabulary"?zt(e,r):t==="definition_of_done"?Dt(e,t,r):be(t)?Pt(e,t,r):st.has(t)?$t(e,t,r):lt.has(t)?Nt(e,t,r):ut(t)?Rt(e,t,r):ft(t)?Tt(e,t,r):gt(t)?Ot(e,t,r):It(e,t,r)}async function Cr(e,t,r,n,i,a){let o=ke(e),d=Ce(t),c=d==="get"||d==="set"?me(r):void 0,_=c?void 0:ht(d,r),m=Oe(d,r,_,c,a,n),y=await wt(o,i),{settings:h,metadata:De,warnings:Le}=await ae(y.pmRoot),v={scope:o,target:y,settings:h,metadata:De,warnings:Ie(Le)};return c?qt(v,d,c,m):d==="list"?Et(v):d==="export"?At(v):(Pe(_),d==="get"?St(v,_):jt(v,_,m))}var Er={hasGovernanceValidationMirrorChange:L,applyPositionalValue:Oe,normalizeAction:Ce,normalizeCriteria:Ae,normalizeGovernanceCloseValidationDefault:Y,normalizeGovernanceCreateModeDefault:K,normalizeGovernanceForceRequiredForStaleLockPolicy:W,normalizeGovernanceOwnershipEnforcement:V,normalizeGovernancePreset:M,normalizeGovernanceRequireCloseReasonPolicy:H,normalizeGovernanceWorkflowEnforcement:B,normalizeHistoryMissingStreamPolicy:z,normalizeItemFormat:Se,normalizeKey:Ee,normalizeMetadataRequiredFields:Ge,normalizePolicyForConflict:D,normalizeScope:ke,normalizeTelemetryTrackingPolicy:F,normalizeTestResultTrackingPolicy:qe,normalizeValidateMetadataProfile:E,normalizeWarnings:Ie};import{execFile as Ft}from"node:child_process";import Mt from"node:path";import{promisify as Vt}from"node:util";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7fe99df0-8454-5667-9205-0b861ba212d1")}catch{}})();var Kt=Vt(Ft),Te="@unbrained/pm-cli",Yt="latest",Bt={global:["--global"],project:[]};function Re(e){let t=e.project===!0||e.local===!0||e.scope==="project",r=e.global===!0||e.scope==="global";if(t&&r)throw new l('Options "--project/--local" and "--global" are mutually exclusive.',s.USAGE);return r?"global":"project"}function S(e){return e.trim().toLowerCase()}function Ne(e,t){let r=S(t);return[e.name,e.directory,e.source.input,e.source.location,e.source.package,e.source.repository,e.source.owner&&e.source.repo?`${e.source.owner}/${e.source.repo}`:void 0].some(n=>typeof n=="string"&&S(n)===r)}function Wt(e,t){let r=b(process.cwd(),t.path),n=ee(r,process.cwd());return{selected_root:e==="global"?n.global:n.project}}async function Ht(e,t,r){try{let n=await Kt(e,t,{cwd:r?.cwd,encoding:"utf8"});return{stdout:n.stdout,stderr:n.stderr}}catch(n){let i=typeof n=="object"&&n!==null&&"stderr"in n?String(n.stderr??""):"",a=i.trim().length>0?i.trim():n instanceof Error?n.message:String(n);throw new l(`Command failed: ${e} ${t.join(" ")}
|
|
2
|
-
${a}`,s.GENERIC_FAILURE)}}function q(e){return typeof e.tag=="string"&&e.tag.trim().length>0?e.tag.trim():Yt}function A(e){return typeof e.packageName=="string"&&e.packageName.trim().length>0?e.packageName.trim():Te}async function Qt(e,t){let r=e.commandRunner??Ht,n=A(e),i=q(e),a=`${n}@${i}`,o=["npm","install","-g",a];e.repair===!0&&o.push("--force");let d=X(import.meta.url,["../../.."]),c={requested:!0,status:"planned",package:n,target:a,command:o,before_version:d,...n===Te?{migration_guidance:["Calendar scheduling commands are package-owned. If calendar is absent, run pm package install calendar --project; use pm calendar meet, pm calendar event, or pm calendar remind."]}:{},repair:e.repair===!0};if(t)return c;try{await r(o[0],o.slice(1));let _=await r("pm",["--version"]);return{...c,status:"updated",after_version:_.stdout.trim()||void 0}}catch(_){return{...c,status:"failed",error:_ instanceof Error?_.message:String(_)}}}function Xt(e){return Mt.isAbsolute(e)||e.startsWith(".")||e.startsWith("..")||e.startsWith("file:")}function Jt(e,t){if(e.kind==="npm"){let r=e.input.startsWith("npm:")?e.input.slice(4).trim():e.input.trim();return!Xt(r)&&e.package&&e.package.trim().length>0?`npm:${e.package.trim()}@${t}`:e.input.startsWith("npm:")?e.input:`npm:${e.input}`}return e.input}async function Zt(e,t){let r=Jt(e,t);return e.kind!=="local"||await G(r)?r:await G(e.location)?e.location:r}function xt(e,t,r,n){let i=["pm","package","install",t,r==="global"?"--global":"--project"];return e.kind==="github"&&n&&n.trim().length>0&&i.push("--ref",n.trim()),i}async function $e(e,t){let r=Wt(e,t);return(await le(r.selected_root)).state.entries.filter(n=>n.scope===e)}async function er(e,t,r){let n=await $e(e,t);return n.find(i=>Ne(i,r.name))??n.find(i=>S(i.directory)===S(r.directory))}async function tr(e,t,r,n,i){let a=q(t),o=await Zt(e.source,a),d=xt(e.source,o,n,e.source.ref),c={name:e.name,directory:e.directory,scope:n,source:e.source,status:"planned",command:d,previous_version:e.manifest_version};if(i)return c;try{await ce(o,{install:!0,project:n==="project",global:n==="global",ref:e.source.kind==="github"?e.source.ref:void 0},r);let _=await er(n,r,e);return{...c,status:"updated",installed_version:_?.manifest_version}}catch(_){return{...c,status:"failed",error:_ instanceof Error?_.message:String(_)}}}function rr(e,t,r,n){let i=[r?e.status:void 0,...t.map(a=>a.status)].filter(a=>typeof a=="string");return{requested_cli:r,requested_packages:n,planned:i.filter(a=>a==="planned").length,updated:i.filter(a=>a==="updated").length,skipped:i.filter(a=>a==="skipped").length,failed:i.filter(a=>a==="failed").length}}async function Rr(e,t,r){let n=typeof e=="string"&&e.trim().length>0?e.trim():void 0;if(t.cliOnly===!0&&t.packagesOnly===!0){let h=["package","upgrade",...n?[n]:[],"--packages-only","--dry-run",...Bt[Re(t)]];throw new l('Options "--cli-only" and "--packages-only" are mutually exclusive.',s.USAGE,{code:"package_upgrade_modes_mutually_exclusive",recovery:{suggested_retry:te(h),suggested_retry_args:h}})}let i=Re(t),a=t.dryRun===!0;if(t.cliOnly===!0&&n)throw new l('A package target cannot be used with "--cli-only".',s.USAGE);let o=!(t.packagesOnly===!0||n),d=t.cliOnly!==!0,c=o?await Qt(t,a):{requested:!1,status:"skipped",package:A(t),target:`${A(t)}@${q(t)}`,command:["npm","install","-g",`${A(t)}@${q(t)}`],repair:t.repair===!0,reason:"not_requested"},_=d?await $e(i,r):[];if(n&&(_=_.filter(h=>Ne(h,n)),_.length===0))throw new l(`Managed package "${n}" was not found in ${i} scope.`,s.NOT_FOUND);let m=[];for(let h of _)m.push(await tr(h,t,r,i,a));let y=rr(c,m,o,d);return{ok:y.failed===0,action:"upgrade",dry_run:a,scope:i,target:n,cli:c,packages:m,summary:y}}export{me as a,pe as b,N as c,ye as d,T as e,de as f,Cr as g,Er as h,Rr as i};
|
|
3
|
-
//# sourceMappingURL=chunk-WUOFG4JY.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./chunk-SGFQQXFD.js";import{$c as W,Gd as ee,Jd as te,Pb as F,Qd as ne,Rd as ae,Sd as I,Uc as q,Yc as $,Yd as oe,Zc as G,_c as H,ad as J,bd as j,dd as C,ed as B,fc as V,fd as z,ga as R,gd as Y,hd as K,id as X,kd as Q,lc as N,ld as Z,oc as U,tb as M}from"./chunk-DWH555SN.js";import"./chunk-TON7H63A.js";import"./chunk-CMIU2NDK.js";import"./chunk-DEZPZOQ7.js";import{Gc as x,Mf as l,Nf as u,No as O,Ro as c,Uo as f,Vo as r,Wo as g,Yo as P,Zo as L,ab as v,ih as E,l as S,m as T,mp as y,na as d,pa as m,qi as A,yl as _}from"./chunk-GJ2OJKRM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c3d9f24a-7089-5d60-ab12-93d03b86da80")}catch{}})();var ie=new Map([["measurements","boolean"],["metric","string"],["measurementLimit","number"],["observe","string_array"],["direction","direction"],["measurementSource","string"],["measurementItem","string"],["measurementRevision","string"],["author","string"],["message","string"],["provenanceCoverage","boolean"],["fleetAttribution","boolean"],["since","string"],["eventLimit","number"],["minimumSample","number"]]),be=new Set(["higher","lower","target"]),we=[...ie.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function ve(e,t){return e==="boolean"?typeof t=="boolean":e==="string"?typeof t=="string":e==="number"?typeof t=="number":e==="string_array"?Array.isArray(t)&&t.every(n=>typeof n=="string"):e==="direction"&&be.has(t)}function re(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new m(`--analytics must be valid JSON: ${String(n)}`,d.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new m("--analytics must be a JSON object.",d.USAGE);for(let[n,a]of Object.entries(t)){let o=ie.get(n);if(!ve(o,a))throw new m(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${we}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,d.USAGE)}return t}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dcd8c925-34ee-5faa-9132-1be43961c749")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="29db968f-30ad-5f3c-bf95-e33be18614c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="524ade8e-33d6-5353-b01d-c7baddc956e8")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="02e10fe1-c111-5c09-8dbe-a67f2b97f0d0")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3d4a8db3-8a53-50b4-a96c-1affff2207a3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d008ca8f-41bf-54fb-9b56-bc1d4af9f226")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="de197522-9007-5e21-8f9c-06cbf63707d1")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5e0162a-bbf1-50fe-8912-a820de155e90")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9ee008b9-3751-5794-8d01-1f6d3123d6cd")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b6fa277d-ccf2-5413-95d5-0790283203d5")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2d59e10e-c85b-542a-8859-b20a08e809fa")}catch{}})();var se=(e,t)=>V(e,t,{runUpdate:(n,a,o)=>q(n,a,o)});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3952425a-adce-59dd-84b6-97ac571eaa73")}catch{}})();async function xe(e,t,n,a,o){let i=c(o),s=e==="run",p=e==="verdicts",b=e==="presets"||e==="apply",w=e==="promote",h=await N({action:e,...s||p||b||w?{}:{kind:t},id:s||p||w?n??t:n,preset:b?n??t:void 0,definition:r(a,"definition"),trigger:r(a,"trigger"),tree:r(a,"tree"),gate:r(a,"gate"),limit:r(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:r(a,"author"),message:r(a,"message"),owner:r(a,"owner"),apply:a.apply===!0,enforcement:r(a,"enforcement")},i);l(h,i),typeof h=="object"&&h!==null&&"exit_code"in h&&h.exit_code===1&&(process.exitCode=1)}function le(e){e.command("assurance").argument("<action>","Action; inspect `pm contracts --command assurance`").argument("[kind]","Declaration kind or run gate id").argument("[id]","Declaration/gate id").description("Manage SDK-owned assurance contracts.").option("--definition <json>","Put declaration JSON").option("--trigger <value>","Gate trigger").option("--tree <value>","Revision identity").option("--gate <id>","Verdict gate filter").option("--limit <number>","Verdict limit").option("--dry-run","Evaluate without recording").option("--author <value>","Mutation author").option("--message <value>","Mutation rationale").option("--owner <item-id>","Preset/derivation owner").option("--apply","Persist derived proposals").option("--enforcement <level>","Promote to warn or block").action(xe)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83eb6904-cf04-5c83-8281-0b8b8bb04d48")}catch{}})();function Ae(e,t){let n=e?.trim().toLowerCase(),a=t?.trim().toLowerCase();if(n===void 0||n.length===0)return a;if(n==="local-analytics")return a&&a.length>0?a:"status";if(a!==void 0&&a.length>0)throw _({command_path:"telemetry",token:`${e} ${t}`,allowed:["status","flush","stats","clear","local-analytics"],token_kind:"path",examples:["pm telemetry stats --limit 10","pm telemetry local-analytics status --json"]});return n}function _e(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[],removeIndexValues:Array.isArray(e.removeIndex)?e.removeIndex:[]}}function ue(e,t){if(e.background===!0){if(e.run!==!0)throw new m("--background requires --run",d.USAGE);if(e.acknowledgeLinkedTests===!0)throw new m("--background cannot be combined with --acknowledge-linked-tests; acknowledgement is a non-executing foreground operation",d.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0||t.removeIndexValues.length>0)throw new m("--background does not support --add/--add-json/--remove/--remove-index; update linked tests first, then run in background",d.USAGE)}}async function Ce(e,t,n,a){let o=await I({kind:"test",commandArgs:P(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues,removeIndex:a.removeIndexValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function me(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,removeIndex:t.removeIndexValues,list:!!e.list,run:!!e.run,match:typeof e.match=="string"?e.match:void 0,onlyIndex:typeof e.onlyIndex=="string"||typeof e.onlyIndex=="number"?e.onlyIndex:void 0,onlyLast:!!e.onlyLast,timeout:typeof e.timeout=="string"?e.timeout:void 0,progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:typeof e.pmContext=="string"?e.pmContext:void 0,overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:typeof e.workspaceContext=="string"?e.workspaceContext:void 0,overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,acknowledgeLinkedTests:!!e.acknowledgeLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext,author:typeof e.author=="string"?e.author:void 0,message:typeof e.message=="string"?e.message:void 0,force:!!e.force,measure:Array.isArray(e.measure)?e.measure:[],metricBelow:typeof e.metricBelow=="string"?e.metricBelow:void 0,metricDiff:typeof e.metricDiff=="string"?e.metricDiff:void 0}}var Mt={buildRunTestOptions:me,buildRunTestAllOptions:fe,runWorkspacePositionAction:pe,validateBackgroundTestOptions:ue};async function Ie(e,t,n,a){let o=await ne(e,me(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0||a.removeIndexValues.length>0)&&await y(n,o),l(o,n),(o.run_results.some(i=>i.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=d.DEPENDENCY_FAILED)}async function De(e,t,n){let a=c(n),o=Date.now(),i=_e(t);ue(t,i),t.background===!0?await Ce(e,t,a,i):await Ie(e,t,a,i),a.profile&&u(`profile:command=test took_ms=${Date.now()-o}`)}function k(e){let t=r(e,"author"),n=r(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new m("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",d.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm claim pm-123 --start","pm release pm-123"]});return{author:t??n,message:r(e,"message")}}async function Se(e,t){let n=c(t),a=Date.now();if(e.background===!0){let i=await I({kind:"test-all",commandArgs:L(e),statusFilter:r(e,"status"),noExtensions:n.noExtensions===!0},n);l(i,n),n.profile&&u(`profile:command=test-all took_ms=${Date.now()-a}`);return}let o=await ae(fe(e),n);await y(n,{ids:o.results.map(i=>i.id)}),l(o,n),(o.failed>0||o.fail_on_skipped_triggered===!0)&&(process.exitCode=d.DEPENDENCY_FAILED),n.profile&&u(`profile:command=test-all took_ms=${Date.now()-a}`)}function fe(e){return{status:r(e,"status"),limit:r(e,"limit"),offset:r(e,"offset"),timeout:r(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:r(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,workspaceContext:r(e,"workspaceContext"),overrideLinkedWorkspaceContext:!!e.overrideLinkedWorkspaceContext,allowUntrustedLinkedTests:!!e.allowUntrustedLinkedTests,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext}}async function Te(e,t,n,a){let o=c(a),i=Date.now(),s=await te({subcommand:Ae(e,t),limit:r(n,"limit")},o);l(s,o),o.profile&&u(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function Ee(e,t){let n=c(t),a=Date.now(),o=re(r(e,"analytics")),i=await ee(n,{includeEmpty:e.includeEmpty===!0,storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:r(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});i.recorded_observations?.some(s=>s.changed)===!0&&await y(n,{ids:i.recorded_observations?.flatMap(s=>s.observation.item_id?[s.observation.item_id]:[])}),l(i,n),n.profile&&u(`profile:command=stats took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=r(e,"threshold"),i=r(e,"limit"),s=await M(n,{...e.exhaustive===!0?{exhaustive:!0}:{},status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:r(e,"since"),...o===void 0?{}:{threshold:Number(o)},...i===void 0?{}:{limit:Number(i)}});l(s,n),n.profile&&u(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Oe(e,t){let n=c(t),a=Date.now(),o=!!e.strictExit||!!e.failOnWarn,i=await F(n,{strictExit:o,strictDirectories:!!e.strictDirectories,requireMergeDrivers:!!e.requireMergeDrivers,checkOnly:!!e.checkOnly,checkTelemetry:!!e.checkTelemetry,noRefresh:!!e.noRefresh,refreshVectors:!!e.refreshVectors,verboseStaleItems:!!e.verboseStaleItems,verboseAuthorEvents:!!e.verboseAuthorEvents,brief:!!e.brief,summary:!!e.summary||o,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(i,n),o&&!i.ok&&(x({...i,exit_code:d.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=d.GENERIC_FAILURE),n.profile&&u(`profile:command=health took_ms=${Date.now()-a}`)}async function Pe(e,t){let n=c(t),a=Date.now(),o=await se({checkMetadata:!!e.checkMetadata,metadataProfile:r(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkCompleteness:!!e.checkCompleteness,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:r(e,"dependencyCycleSeverity"),parentCycleSeverity:r(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:r(e,"scanMode"),includePmInternals:!!e.includePmInternals,verboseFileLists:!!e.verboseFileLists,verboseDiagnostics:!!e.verboseDiagnostics,allAffectedIds:!!e.allAffectedIds,checkHistoryDrift:!!e.checkHistoryDrift,checkStorageIntegrity:!!e.checkStorageIntegrity,fixHints:!!e.fixHints,autoFix:!!e.autoFix,dryRun:!!e.dryRun,fixScope:Array.isArray(e.fixScope)?e.fixScope:void 0,pruneMissing:!!e.pruneMissing,counts:!!e.counts,full:!!e.full},n);l(o,n),(e.strictExit||e.failOnWarn)&&(o.has_warnings||!o.ok)&&(x({...o,exit_code:d.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=d.GENERIC_FAILURE),n.profile&&u(`profile:command=validate took_ms=${Date.now()-a}`)}async function Le(e,t){let n=c(t),a=Date.now(),o=await U(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&u(`profile:command=gc took_ms=${Date.now()-a}`)}async function Me(e,t,n,a){let o=c(a),i=v(process.cwd(),o.path),s=e.trim().toLowerCase();if(!C.some(p=>p===s))throw _({command_path:"workspace snapshot",token:e,allowed:C,display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(s==="list"){l(await Y(i),o);return}if(s==="create"){l(await B(i,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new m(`pm workspace snapshot ${s} requires a snapshot name or fingerprint`,d.USAGE);if(s==="inspect"){l(await z(i,t),o);return}if(s==="restore"){if(n.dryRun===!0){l(await K(i,t),o);return}let p=await A(i);l(await X(i,t,{force:n.force===!0,author:E(r(n,"author"),p.author_default),message:r(n,"message"),lockTtlSeconds:p.locks.ttl_seconds,lockWaitMs:p.locks.wait_ms}),o);return}l(await Q(i,t),o)}async function pe(e,t){let n=c(t);l(await Z(n),n)}async function Fe(e,t){let n=c(t),a=Date.now(),o=await R({action:r(e,"action"),command:r(e,"command"),summary:!!e.summary,schemaOnly:!!e.schemaOnly,flagsOnly:!!e.flagsOnly,availabilityOnly:!!e.availabilityOnly,runtimeOnly:!!e.runtimeOnly||!!e.activeOnly,full:!!e.full},n);l(o,n),n.profile&&u(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Ve(e,t,n){if(t.start===!0){ce(e,!1),await ye(e,t,n);return}let a=c(n),o=Date.now(),i={...k(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};ce(e,t.next===!0);let s=t.next===!0?await G(!!t.force,a,i,{type:typeof t.type=="string"?t.type:void 0,tag:typeof t.tag=="string"?t.tag:void 0,priority:t.priority,assigneeFilter:typeof t.assigneeFilter=="string"?t.assigneeFilter:void 0,parent:typeof t.parent=="string"?t.parent:void 0,sprint:typeof t.sprint=="string"?t.sprint:void 0,release:typeof t.release=="string"?t.release:void 0,includeDecisions:t.includeDecisions===!0,includeGates:t.includeGates===!0,includeContainers:t.includeContainers===!0,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await $(e,!!t.force,a,i);await y(a,s),l(s,a),a.profile&&u(`profile:command=claim took_ms=${Date.now()-o}`)}function ce(e,t){if(!t&&!e)throw new m("Specify an item id or pass --next",d.USAGE);if(t&&e)throw new m("Specify either an item id or --next, not both",d.USAGE)}async function Ne(e,t,n){if(t.pause===!0){await ge(e,t,n);return}let a=c(n),o=Date.now(),i=await H(e,!!t.force,a,{...k(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await y(a,i),l(await O("release",[e],t,a,i),a),a.profile&&u(`profile:command=release took_ms=${Date.now()-o}`)}async function D(e){let t=c(e),n=S(e.name());!n||t.json||t.quiet||(await A(v(process.cwd(),t.path))).ux?.deprecation_hints&&u(T(n))}async function ye(e,t,n){await D(n);let a=c(n),o=Date.now(),i=await W(e,{...k(t),force:!!t.force,next:t.next===!0,ifAvailable:t.ifAvailable===!0},a);await y(a,i.update),l(i,a),a.profile&&u(`profile:command=start-task took_ms=${Date.now()-o}`)}async function ge(e,t,n){await D(n);let a=c(n),o=Date.now(),i=await J(e,{...k(t),force:!!t.force},a);await y(a,i.release),l(i,a),a.profile&&u(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Ue(e,t,n,a){await D(a);let o=c(a),i=Date.now(),s=await j(e,t,{...k(n),validateClose:r(n,"validateClose"),force:!!n.force},o);await y(o,s.release),l(s,o),o.profile&&u(`profile:command=close-task took_ms=${Date.now()-i}`)}function de(e){return e.option("--background","Run linked tests in managed background mode").option("--timeout <seconds>","Default run timeout in seconds").option("--progress","Emit linked-test progress to stderr (always shown in TTY, opt-in for non-TTY)").option("--env-set <value>","Set environment variable(s) for linked-test runs (KEY=VALUE, repeatable)",f).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",f).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM test context: schema|tracker|auto|none (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").option("--workspace-context <mode>","Source-workspace mode: source|isolated|snapshot (default: source)").option("--override-linked-workspace-context","Force run-level --workspace-context over per-linked-test metadata").option("--allow-untrusted-linked-tests","Execute untrusted linked commands when project policy also permits it").option("--fail-on-context-mismatch","Fail linked PM commands when context item counts differ").option("--fail-on-skipped","Treat skipped linked tests as dependency failures").option("--fail-on-empty-test-run","Treat successful linked-test commands that report zero executed tests as failures").option("--require-assertions-for-pm","Require assertion metadata for linked PM command tests").option("--check-context","Preflight linked PM command context diagnostics before executing commands").option("--auto-pm-context","Auto-remediate PM tracker-read context mismatches by routing those linked commands through tracker context")}function Ft(e){le(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add verified isolated test (CSV/markdown or stdin)",f).option("--add-json <value>","Add verified isolated test (JSON object/array or stdin)",f).option("--remove <value>","Remove linked test entry by exact command/path (command=<value> and path=<value> preserve commas and equals signs; or - for stdin)",f).option("--remove-index <n>","Remove the 1-based linked-test index from --list order (repeatable)",f).option("--list","List linked tests without mutating").option("--run","Run linked test commands").option("--match <value>","Run only linked tests whose command/path contains this substring").option("--only-index <n>","Run only the 1-based linked-test index from --list order").option("--only-last","Run only the most recently added linked test");t.option("--acknowledge-linked-tests","Trust the item's current linked commands in this clone without executing them"),de(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",f).option("--metric-below <value>","Return evidence below name=value").option("--metric-diff <name>","Diff the latest two values").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage tests linked to an item and optionally run them.").action(De);let n=e.command("test-all").description("Run linked tests across matching items.").option("--status <value>","Filter items by status before running tests").option("--limit <n>","Limit matching items before running linked tests").option("--offset <n>","Skip matching items before running linked tests");de(n).action(Se),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(w,h,he)=>{let ke=c(he);await oe(w,ke)}),e.command("telemetry").argument("[namespace-or-subcommand]","Telemetry subcommand: status, flush, stats, clear (default: status)").argument("[subcommand]","Compatibility alias target for local-analytics: status, flush, stats, clear").option("--limit <n>","Maximum command groups returned by telemetry stats").description("Inspect and manage local telemetry queue/runtime state.").action(Te),e.command("duplicates").description("Find duplicate clusters across all statuses.").option("--status <value>","Statuses (repeatable or comma-separated)",f,[]).option("--since <value>","Created at or after this time").option("--threshold <value>","Minimum similarity (0-1)").option("--limit <n>","Maximum clusters").option("--exhaustive","Score all pairs within the safety bound").action(Re),e.command("stats").description("Show project tracker statistics.").option("--include-empty","Restore zero-count registered item-type and lifecycle-status buckets").option("--storage","Include aggregate history-stream storage metrics (total streams/lines/bytes, largest + deepest streams, oldest/newest entries)").option("--metadata-coverage","Include metadata coverage % (acceptance_criteria, estimated_minutes, resolution, tags, parent) overall and by type").option("--by-assignee","Include a lifecycle-bucketed item breakdown grouped by assignee").option("--by-tag","Include a lifecycle-bucketed item breakdown grouped by tag").option("--by-priority","Include a lifecycle-bucketed item breakdown grouped by priority").option("--tag-prefix <value>","With --by-tag: only count tags starting with this prefix (e.g. domain:)").option("--field-utilization","Report content-field utilization rates (notes/learnings/files/docs/tests/comments/deps/body) for governance analysis").option("--analytics <json>","Improvement ledger/history analytics JSON").action(Ee),e.command("health").description("Show project tracker health checks.").option("--strict-directories","Treat optional item-type directories as required failures").option("--require-merge-drivers","Treat absent clone-local merge drivers as a required health failure").option("--check-only","Run read-only health diagnostics without refreshing vectors").option("--check-telemetry","Probe telemetry endpoint health and include network diagnostics").option("--no-refresh","Disable automatic vector refresh attempts during health checks").option("--refresh-vectors","Explicitly enable vector refresh attempts during health checks").option("--verbose-stale-items","Include full stale vectorization ID lists in health output").option("--verbose-author-events","Include every actionable unknown-author event coordinate for review or disposition").option("--brief","Emit compact health details for low-token agent checks").option("--summary","Emit one-line-style health status with check names and warning count").option("--skip-vectors","Skip vectorization check for a faster run").option("--skip-integrity","Skip item/history file integrity check for a faster run").option("--skip-drift","Skip history drift hash check for a faster run").option("--full","Run all checks including slow integrity, drift, and vectorization checks").option("--strict-exit","Return non-zero exit when health is not ok and default to actionable summary output; use --full for complete details").option("--fail-on-warn","Alias for --strict-exit").action(Oe),e.command("validate").description("Validate metadata, lifecycle policies, files, command references, and history.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Metadata profile (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").option("--check-completeness","Check declarative lifecycle field requirements").option("--check-lifecycle","Run active-item lifecycle governance drift checks").option("--check-stale-blockers","Include stale blocker-pattern diagnostics in lifecycle checks").option("--dependency-cycle-severity <value>","Set dependency-cycle warning policy for lifecycle checks (off|warn|error)").option("--parent-cycle-severity <value>","Set parent-hierarchy cycle warning policy for lifecycle checks (off|warn|error)").option("--check-files","Run linked-file and orphaned-file checks").option("--check-command-references","Run linked-command PM-ID reference checks").option("--scan-mode <value>","Select file candidate scan mode for --check-files (default|tracked-all|tracked-all-strict)").option("--include-pm-internals","Include PM storage internals in tracked-all candidate scans").option("--verbose-file-lists","Include full file-path lists for validate --check-files details").option("--verbose-diagnostics","Include full diagnostic ID lists").option("--all-affected-ids","Emit complete missing_* affected-ID lists with no truncation (implied by --json)").option("--strict-exit","Return non-zero exit when validation warnings are present").option("--fail-on-warn","Alias for --strict-exit").option("--fix-hints","Add a machine-executable fix_hints[] of pm commands to each failing check's details").option("--auto-fix","Apply safe, deterministic field backfills").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, estimates, timestamps, lifecycle; comma-separated or repeatable). Default: metadata, resolution; other scopes require explicit opt-in",f).option("--prune-missing","Remove deleted-path file/doc links; preserves real files").option("--check-history-drift","Run item/history hash drift checks").option("--check-storage-integrity","Run the post-merge storage-integrity check (unreadable items, history conflict markers, resurrected deletes, unparseable config/schema)").option("--counts","Keep validation counts and totals while omitting per-item diagnostic arrays").option("--full","Return the complete validation diagnostic projection").action(Pe),e.command("gc").option("--dry-run","Preview cleanup targets without deleting files; without this flag, pm gc deletes matched artifacts").option("--scope <value>","Limit cleanup to one or more scopes (comma-separated or repeatable): index, embeddings, runtime, locks, checkpoints, transactions",f).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Le);let a=e.command("workspace").description("Inspect workspace state and snapshots.");a.command("position").description("Show merge and history readiness.").action(pe),a.command("snapshot").argument("<action>","Action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Manage content-addressed tracker snapshots.").option("--dry-run","Preview restore file, item, stream, and history-entry impact without mutating state").option("--force","Explicitly confirm a whole-workspace snapshot restore").option("--author <value>","Actor recorded on the restore audit event").option("--message <value>","Human-readable restore rationale").action(Me),e.command("contracts").description("Show machine-readable command and schema contracts for agents.").option("--action <value>","Filter tool schema branches to a specific action").option("--command <value>","Scope contracts output to one CLI command (narrow-by-default)").option("--summary","Return one command+intent row per top-level command for cheap agent bootstrap").option("--schema-only","Return schema-focused output only").option("--flags-only","Return command flag contracts only").option("--availability-only","Return action availability surface only").option("--runtime-only","Include only actions invocable in the current runtime").option("--active-only","Alias for --runtime-only").option("--full","Include full schema and command-flag surfaces (large; default brief output omits heavy sections for unfiltered queries)").action(Fe);let o=e.command("claim").option("--start","Claim and start an explicit item").argument("[id]","Item id (omit with --next)").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force claim override").option("--if-available","Skip another author's claim (skipped=true)").option("--next","Atomically claim the next caller-available actionable item").option("--type <value>","Filter --next candidates by type").option("--tag <value>","Filter --next candidates by tag").option("--priority <value>","Filter --next candidates by priority").option("--assignee-filter <value>","Filter --next candidates: assigned|unassigned").option("--parent <id>","Scope --next candidates to a subtree").option("--sprint <value>","Filter --next candidates by sprint").option("--release <value>","Filter --next candidates by release").option("--max-attempts <n>","Bound the --next candidate walk (default 10; maximum 100)").option("--include-decisions","Allow --next to claim human-gated Decision items").option("--include-gates","Allow --next to claim outcome gates").option("--include-containers","Allow --next to claim containers with unfinished descendants").option("--token-budget <n>","Bound the estimated tokens used to rank --next candidates").option("--explain-ranking","Include ranking provenance for --next selection").description("Claim an item for active work.").action(Ve);g(o,"--assignee <value>","Alias for --author on lifecycle ownership commands"),g(o,"--token_budget <n>","Alias for --token-budget"),g(o,"--explain_ranking","Alias for --explain-ranking");let i=e.command("release").option("--pause","Use open status").argument("<id>","Item id").option("--author <value>","Author").option("--message <value>","Message").option("--force","Override ownership").description("Release ownership.").action(Ne);g(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let s=e.command("start-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: claim an item and move it to in_progress.").action(ye);g(s,"--assignee <value>","Alias for --author on lifecycle ownership commands");let p=e.command("pause-task",{hidden:!0}).argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override when required").description("Lifecycle alias: move an item to open and release its claim.").action(ge);g(p,"--assignee <value>","Alias for --author on lifecycle ownership commands");let b=e.command("close-task",{hidden:!0}).argument("<id>","Item id").argument("[reason]","Close reason text").option("--author <value>","Mutation author").option("--message <value>","History message").option("--validate-close <value>","Close-time validation mode: off|warn|strict").option("--force","Force ownership or terminal override when required").description("Lifecycle alias: close an item and release assignment metadata.").action(Ue);g(b,"--assignee <value>","Alias for --author on lifecycle ownership commands")}export{Mt as _testOnlyRegisterOperations,Ft as registerOperationCommands,ce as requireClaimTarget};
|
|
2
|
-
//# sourceMappingURL=register-operations-FYV7CUBF.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as P}from"./chunk-VU77O6HC.js";import{g as j,i as T}from"./chunk-WUOFG4JY.js";import{$a as I,Pa as R,Sa as U,eb as O,gb as L}from"./chunk-TON7H63A.js";import"./chunk-DEZPZOQ7.js";import{Jf as D,Mf as w,Nf as y,Ro as b,Uo as v,ab as E,l as $,m as G,na as d,pa as h,qi as S}from"./chunk-GJ2OJKRM.js";import C from"node:fs/promises";import W from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="26ea7f42-d5f7-5ada-afd9-389dadc4d138")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0e08e0-f6e7-59c4-ac96-9f47b172727a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d975120a-964e-5b19-ae10-8ba011ba9bf8")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="108609fa-51fc-5bd0-ac54-de2ad14a66c6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b36466e6-5574-5509-909a-e8599f11664c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5e1e242-6864-5a72-adb9-0eda4c65a0c3")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8d53e460-6a3a-5588-b1d2-0078424ff8a6")}catch{}})();var M={extension:"extension",package:void 0};async function _(e,t){if(!e)return;let o=$(e),i=b(t);await S(E(process.cwd(),i.path)).then(a=>a.ux.deprecation_hints)&&y(G(o))}var V={init:"init",install:"install",uninstall:"uninstall",explore:"explore",manage:"manage",describe:"describe",reload:"reload",doctor:"doctor",catalog:"catalog",adopt:"adopt","adopt-all":"adoptAll",activate:"activate",deactivate:"deactivate",migrate:"migrate"};function X(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(a=>typeof a=="string"):[],i=[...new Set(o.map(a=>a.trim().toLowerCase()).filter(a=>a.length>0))];if(i.length>1)throw new h(`Multiple scaffold capabilities cannot be combined yet: ${i.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return i[0]}function A(e,t,o="extension"){let i={...e};t!==void 0&&(i[V[t]]=!0);let a=(...c)=>c.some(s=>i[s]===!0),r=(...c)=>{for(let s of c)if(typeof i[s]=="string")return i[s]};return{init:a("init"),scaffold:a("scaffold"),install:a("install"),uninstall:a("uninstall"),explore:a("explore","list"),manage:a("manage"),describe:a("describe"),markdown:a("markdown"),reload:a("reload"),doctor:a("doctor"),catalog:a("catalog"),adopt:a("adopt"),adoptAll:a("adoptAll","adopt_all","adopt-all"),activate:a("activate"),deactivate:a("deactivate"),migrate:a("migrate"),project:a("project"),local:a("local"),global:a("global"),gh:r("gh"),github:r("github"),ref:r("ref"),capability:X(e),declarative:a("declarative"),fields:r("fields"),detail:r("detail"),output:r("output"),trace:a("trace"),watch:a("watch"),runtimeProbe:a("runtimeProbe","runtime_probe","runtime-probe"),offline:a("offline"),fixManagedState:a("fixManagedState","fix_managed_state","fix-managed-state"),isolated:a("isolated"),ignoreGlobal:a("ignoreGlobal","ignore_global","ignore-global"),strictExit:a("strictExit","strict_exit","strict-exit"),failOnWarn:a("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:a("dryRun","dry_run","dry-run"),vocabulary:o}}async function Y(e){let t=(await C.readdir(process.cwd())).filter(i=>!i.startsWith(".")).sort((i,a)=>i.localeCompare(a)),o=[...e].sort((i,a)=>i.localeCompare(a));return t.length===o.length&&t.every((i,a)=>i===o[a])}async function J(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await Y(t)?["*"]:t}function H(e,t,o){let i=e.markdown===!0;if(o!==void 0&&o==="")throw new h("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!i)throw new h("--output is only supported with --markdown describe output.",d.USAGE);if(i){if(t.json)throw new h("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new h("--markdown is only supported by the describe action.",d.USAGE)}}async function Q(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=W.resolve(e.outputPath);await C.mkdir(W.dirname(o),{recursive:!0}),await C.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&D(t)}}function Z(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let i=e.details!==null&&typeof e.details=="object"?e.details:{},a=i.summary!==null&&typeof i.summary=="object"?i.summary:null,r=a&&typeof a.status=="string"?a.status:void 0;(e.warnings.length>0||r!==void 0&&r!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function g(e,t,o,i,a="extension"){let r=b(o),c=Date.now(),s=a==="extension"?"package":a;await _(M[a],o);let n=A(t,i,s),l=(typeof n.output=="string"?n.output:void 0)?.trim();H(n,r,l);let f=await I(e,n,r);n.markdown===!0?await Q({result:f,vocabulary:s,outputPath:l,globalOptions:r}):w(f,r),Z(f,n),f.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),r.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function ee(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function te(e){return e instanceof h?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function oe(e,t,o){let i=[],a=[],r=d.GENERIC_FAILURE;for(let c of e)try{let s=await I(c,t,o),n=ee(s),l=Array.isArray(s.warnings)?s.warnings:[];a.push(...l);let f=s.ok===!0;i.push({target:c,ok:f,extension:n.extension,source:n.source,install_plan:n.install_plan,dry_run:n.dry_run,destination_path:n.destination_path,activated:n.activated,settings_changed:n.settings_changed,command_paths:n.command_paths,action_paths:n.action_paths,runtime_activation_status:n.runtime_activation_status,activation_diagnostics:n.activation_diagnostics,command_discovery:n.command_discovery,verification:n.verification,warnings:l,...f?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(s){let n=te(s),l=n.exit_code;typeof l=="number"&&r===d.GENERIC_FAILURE&&l!==d.GENERIC_FAILURE&&(r=l),i.push({target:c,ok:!1,error:n})}return{rows:i,warnings:a,failureExitCode:r}}async function z(e,t,o,i){let a=i==="extension"?"package":i;await _(M[i],o);let r=await J(e);if(r===void 0||r.length<=1){await g(r?.[0],t,o,"install",a);return}let c=b(o),s=Date.now(),n=A(t,"install",a);if(H(n,c,void 0),[n.gh,n.github].some(k=>typeof k=="string"&&k.trim().length>0))throw new h("Multiple install targets cannot be combined with --gh/--github. Install one GitHub source per command, or pass multiple explicit local, bundled, or npm: targets.",d.USAGE,{code:"multi_target_github_install_ambiguous",required:"Use exactly one positional target with --gh/--github, or omit --gh/--github when installing multiple targets.",examples:["pm install --gh owner/repo","pm install npm:pm-guide-shell pm-todos"]});let{rows:l,warnings:f,failureExitCode:m}=await oe(r,n,c),u=l.filter(k=>k.ok!==!0).length,K={ok:u===0,action:"install",scope:n.global===!0?"global":"project",installed_count:n.dryRun===!0?0:l.length-u,...n.dryRun===!0?{dry_run:!0,planned_count:l.length-u}:{},failed_count:u,targets:l,warnings:[...new Set(f)].sort((k,B)=>k.localeCompare(B))};w(K,c),u>0&&(process.exitCode=m),c.profile&&y(`profile:command=extension took_ms=${Date.now()-s}`)}function ae(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function x(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function p(e,t){return t==="package"?x(e):ae(e)}function N(e){return e.option("--dry-run","Plan CLI/package upgrades without running npm or reinstalling packages").option("--cli-only","Upgrade only the pm CLI/SDK npm package").option("--packages-only","Upgrade only managed pm packages").option("--repair","Force npm global reinstall when upgrading the pm CLI/SDK").option("--tag <value>","npm dist-tag/version for CLI and registry package upgrades").option("--package-name <value>","Override the CLI package name for self-upgrade testing")}async function q(e,t,o){let i=b(t),a=Date.now();o&&await _("upgrade",t);let r=await T(e,t.optsWithGlobals(),i);w(r,i),r.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=package-upgrade took_ms=${Date.now()-a}`)}function F(e,t){let o=t==="package"?"package":"extension",i=t==="package"?"packages":"extensions",a=t,r=e.command(a,{hidden:t==="extension"}).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source, name, or scaffold path`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>","Starter capability for --init (default: commands)",v).option("--install",`Install a ${o} source`).option("--dry-run","Preview install without writes or activation").option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${i} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${i} and updates`).option("--offline","Skip remote freshness checks during manage").option("--describe",`Show surfaces registered by a loaded ${o}`).option("--markdown","Render describe as Markdown").option("--output <path>","Write Markdown to a file").option("--reload",`Reload ${i} without import cache`).option("--watch","Use watch mode with --reload").option("--doctor",`Run ${o} diagnostics`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt unmanaged ${o}`).option("--adopt-all",`Adopt all unmanaged ${i}`).option("--activate",`Activate a ${o} in selected scope settings`).option("--deactivate",`Deactivate a ${o} in selected scope settings`).option("--project",`Use project ${o} scope (default)`).option("--local","Alias for --project").option("--global",`Use global ${o} scope`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").option("--detail <mode>",`${o[0].toUpperCase()}${o.slice(1)} diagnostics detail mode (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(t==="package"?"Manage package lifecycle in project or global scope.":"Manage extension lifecycle in project or global scope.").action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,void 0,t)});t==="package"&&(r.alias("packages"),r.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=r.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${R.join("|")}; default commands)`,v).description(t==="package"?"Generate a starter package scaffold with package metadata, manifest, and entrypoint.":"Generate a starter extension scaffold with manifest and entrypoint.");t==="package"&&c.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"),p(c,t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"init",t)}),p(r.command("install").option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]",`${o[0].toUpperCase()}${o.slice(1)} source (local path, bundled alias, npm: source, wildcard, or GitHub source)`).option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description(`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source.`),t).action(async(s,n,l)=>{await z(s,l.optsWithGlobals(),l,t)}),p(r.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"uninstall",t)}),p(r.command("explore").description(`List discovered ${i} in selected scope.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"explore",t)}),p(r.command("inventory").argument("[name]",`${o[0].toUpperCase()}${o.slice(1)} name or directory to inspect`).description(`Read configured ${o} install and enablement state without activating extension code.`),t).action(async(s,n,l)=>{let f=b(l),m=l.optsWithGlobals();if(m.global===!0&&(m.project===!0||m.local===!0))throw new h("--global and --project/--local are mutually exclusive.",d.USAGE);let u=await P({pmRoot:E(process.cwd(),f.path),scope:m.global===!0?"global":"project",name:s});w(u,f),u.complete||(process.exitCode=d.GENERIC_FAILURE)}),p(r.command("manage").option("--offline","Skip remote freshness checks and report unknown update availability").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).description(`List managed ${i} with update-check metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"manage",t)}),p(r.command("describe").argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} name to describe (omit for every loaded ${o})`).option("--markdown","Render the surface map as a Markdown reference document instead of toon/json").option("--output <path>","Write Markdown output to a file (requires --markdown)").description(`Map every surface a loaded ${o} registers (commands, hooks, item types, providers, overrides, ...).`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"describe",t)}),p(r.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${i} with cache-busted module imports.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"reload",t)}),p(r.command("doctor").option("--detail <mode>",`Detail mode for ${o} diagnostics (summary|deep)`).option("--trace","Include actionable registration traces in doctor deep diagnostics").option("--fix-managed-state",`Adopt unmanaged ${i} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${i} only, ignoring global registrations`).option("--ignore-global","Alias for --isolated").option("--strict-exit","Return non-zero exit when doctor warnings are present (ok=false)").option("--fail-on-warn","Alias for --strict-exit (doctor)").description(`Run consolidated ${o} diagnostics (summary/deep modes).`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"doctor",t)}),p(r.command("catalog").alias("list").option("--fields <value>","Render compact comma-separated catalog fields, for example: alias,installed,install_command").description(`List bundled first-party ${o} catalog metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"catalog",t)}),p(r.command("adopt").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).option("--gh <owner/repo[/path]>",`GitHub provenance shorthand for adopted ${o}`).option("--github <owner/repo[/path]>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub shorthand source").description(`Adopt an existing unmanaged ${o} into managed metadata.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"adopt",t)}),p(r.command("adopt-all").description(`Adopt all unmanaged ${i} into managed metadata.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"adopt-all",t)}),p(r.command("migrate").option("--dry-run","Plan active migrations without invoking extension code").description(`Plan or apply active ${o} migrations with durable receipts.`),t).action(async(s,n)=>{await g(void 0,n.optsWithGlobals(),n,"migrate",t)}),p(r.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"activate",t)}),p(r.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(s,n,l)=>{await g(s,l.optsWithGlobals(),l,"deactivate",t)}),t==="package"&&N(x(r.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(s,n,l)=>{await q(s,l,!1)})}async function ie(e,t,o){let i=b(o),a=Date.now(),r=await L(e,i,{idPrefix:typeof t.idPrefix=="string"?t.idPrefix:void 0,preset:typeof t.preset=="string"?t.preset:void 0,defaults:t.defaults===!0||t.yes===!0,author:typeof t.author=="string"?t.author:void 0,agentGuidance:typeof t.agentGuidance=="string"?t.agentGuidance:void 0,typePreset:typeof t.typePreset=="string"?t.typePreset:void 0,withPackages:t.withPackages===!0,mergeFence:t.mergeFence!==!1,force:t.force===!0,workspace:typeof t.workspace=="string"?t.workspace:void 0}),c=t.verbose===!0||i.json===!0;w(c?r:O(r,!0),i),i.profile&&y(`profile:command=init took_ms=${Date.now()-a}`)}function ne(e,t,o,i){let a=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:a?"project":e??"project",resolvedAction:a?e:t??"list",resolvedKey:a?t:o,resolvedValue:a?o:i}}function re(e){return{criterion:Array.isArray(e.criterion)?e.criterion:[],format:typeof e.format=="string"?e.format:void 0,policy:typeof e.policy=="string"?e.policy:void 0,value:typeof e.value=="string"?e.value:void 0,clearCriteria:e.clearCriteria===!0,defaultDepth:typeof e.defaultDepth=="string"?e.defaultDepth:void 0,activityLimit:typeof e.activityLimit=="string"?e.activityLimit:void 0,staleThresholdDays:typeof e.staleThresholdDays=="string"?e.staleThresholdDays:void 0,sectionHierarchy:typeof e.sectionHierarchy=="string"?e.sectionHierarchy:void 0,sectionActivity:typeof e.sectionActivity=="string"?e.sectionActivity:void 0,sectionProgress:typeof e.sectionProgress=="string"?e.sectionProgress:void 0,sectionBlockers:typeof e.sectionBlockers=="string"?e.sectionBlockers:void 0,sectionFiles:typeof e.sectionFiles=="string"?e.sectionFiles:void 0,sectionWorkload:typeof e.sectionWorkload=="string"?e.sectionWorkload:void 0,sectionStaleness:typeof e.sectionStaleness=="string"?e.sectionStaleness:void 0,sectionTests:typeof e.sectionTests=="string"?e.sectionTests:void 0}}async function se(e,t,o,i,a,r){let c=b(r),s=Date.now(),{resolvedScope:n,resolvedAction:l,resolvedKey:f,resolvedValue:m}=ne(e,t,o,i),u=await j(n,l,f,re(a),c,typeof m=="string"?m:void 0);w(u,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-s}`)}var Re={normalizeExtensionOptions:A};function Ue(e){e.command("init").argument("[prefix-or-path]","Optional id prefix, or path-like tracker target such as ./pm-sandbox").option("--prefix, --id-prefix <value>","Set the item ID prefix (alias for the positional prefix)").option("--preset <value>","Governance preset for new setups: minimal|default|strict").option("--defaults","Use non-interactive setup defaults without opening the wizard").option("-y, --yes","Alias for --defaults (non-interactive setup)").option("--author <value>","Set the default mutation author for this project").option("--agent-guidance <mode>","Agent guidance mode: ask|add|skip|status").option("--type-preset <name>","Register domain item types during init: agile|ops|research").option("--with-packages","Install all bundled first-party packages during initialization").option("--no-merge-fence","Skip automatic merge-driver installation for a fresh Git-backed tracker").option("--workspace <dir>","Initialize repository-local tracker storage at <dir>/.agents/pm").option("--force","Allow initializing tracker files directly in a directory that looks like a workspace root").option("--verbose","Include the full resolved settings tree in the output (default output is a concise summary)").description("Initialize pm storage and defaults for the current workspace or a path-like tracker target.").action(async(t,o,i)=>{await ie(t,o,i)}),e.command("config").argument("[scope]","Config scope: project|global, or action shorthand list|export|get|set for project scope").argument("[action]","Config action: get|set|list|export").argument("[key]","Config key for get|set; use `pm config project list` for the complete typed inventory, including mutation-guard-* policies").argument("[value]",'Optional value for set: routed to the right typed flag by key (e.g. config set telemetry-tracking off, config set item-format toon, config set definition-of-done "Tests pass"). Equivalent to --policy/--format/--criterion. context keys still require --default-depth/--section-* flags.').option("--criterion <text>","Criteria value for definition-of-done, metadata-required-fields, or lifecycle pattern keys (repeatable for set)",v).option("--clear-criteria","Clear criteria-list keys for config set operations").option("--format <value>","Item format for item-format key: toon").option("--policy <value>","Policy key values: history-missing-stream-policy=auto_create|strict_error; sprint-release-format-policy=warn|strict_error; parent-reference-policy=warn|strict_error; governance-preset=minimal|default|strict|custom; governance-ownership-enforcement=none|warn|strict; governance-create-mode-default=progressive|strict; governance-close-validation-default=off|warn|strict; governance-require-close-reason=enabled|disabled; governance-parent-reference-policy=warn|strict_error; governance-metadata-validation-profile=core|strict|custom; governance-force-required-for-stale-lock=enabled|disabled; governance-duplicate-detection-mode=off|advisory|strict; test-result-tracking=enabled|disabled; untrusted-linked-test-execution=enabled|disabled; telemetry-tracking=enabled|disabled").option("--value <value>","Typed nested setting value. Mutation guards: require-attributed-author=true|false, secret-guard=off|advise|block, stale-in-progress-hours=integer>=1. Kebab-case is preferred; underscore aliases remain accepted.").option("--default-depth <value>","Context default depth: brief|standard|deep").option("--activity-limit <n>","Context default activity limit").option("--stale-threshold-days <n>","Context staleness cutoff in days").option("--section-hierarchy <value>","Enable/disable context hierarchy section (true|false)").option("--section-activity <value>","Enable/disable context activity section (true|false)").option("--section-progress <value>","Enable/disable context progress section (true|false)").option("--section-blockers <value>","Enable/disable context blockers section (true|false)").option("--section-files <value>","Enable/disable context files section (true|false)").option("--section-workload <value>","Enable/disable context workload section (true|false)").option("--section-staleness <value>","Enable/disable context staleness section (true|false)").option("--section-tests <value>","Enable/disable context tests section (true|false)").description("Read or update pm settings for the current workspace or global profile.").action(async(t,o,i,a,r,c)=>{await se(t,o,i,a,r,c)}),F(e,"extension"),F(e,"package"),x(e.command("install",{hidden:!0}).option("--dry-run","Resolve sources and estimate copying without destination writes or activation").argument("[targets...]","Package source (local path, bundled alias, npm: source, wildcard, or GitHub source)").option("--gh <github-source>","Install from GitHub shorthand source (owner/repo[/path])").option("--github <github-source>","Alias for --gh").option("--ref <ref>","Git ref/branch/tag for GitHub install sources").description("Install a pm package into the project package scope by default.")).action(async(t,o,i)=>{await _("install",i),await z(t,i.optsWithGlobals(),i,"package")}),N(x(e.command("upgrade",{hidden:!0}).argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages."))).action(async(t,o,i)=>{await q(t,i,!0)})}export{Re as _testOnlyRegisterSetup,Ue as registerSetupCommands};
|
|
2
|
-
//# sourceMappingURL=register-setup-M5VO6JUH.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$ as y,O as V,P as W,Q as K,Qb as Y,R as G,aa as _,q as C,r as x,s as $,sa as J,t as P,u as q,va as H}from"./chunk-QY4Z23QC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c6a57e5a-91ba-5c4e-afbc-772fd2f7a9bb")}catch{}})();var k=new Set(W),D=Object.freeze({get size(){return k.size},has(e){return k.has(e)},entries(){return k.entries()},keys(){return k.keys()},values(){return k.values()},forEach(e,t){k.forEach(r=>e.call(t,r,r,D))},[Symbol.iterator](){return k.values()}});function X(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function B(e){return typeof e!="string"?null:V(e)}function de(e){try{return structuredClone(e)}catch{return e}}function ue(e){let t=e.trim(),r=t.indexOf("=");if(r<=0)throw new _(`--field entries must use name=value syntax, received: ${e}`,y.USAGE);let s=t.slice(0,r).trim(),n=t.slice(r+1);return{key:s,value:n}}function ce(e){return`--${e.replaceAll("_","-")}`}function fe(e,t,r){try{let s=JSON.parse(e);if(r==="array"&&Array.isArray(s)||r==="object"&&typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}throw new _(`--field ${t}=... must be valid JSON ${r}`,y.USAGE)}function me(e,t,r){if(t==="string")return r;if(t==="number"){let s=r.trim();if(s.length===0)throw new _(`--field ${e}=... must be a number`,y.USAGE);let n=Number(s);if(!Number.isFinite(n))throw new _(`--field ${e}=... must be a number`,y.USAGE);return n}if(t==="boolean"){let s=r.trim().toLowerCase();if(s==="true"||s==="1"||s==="yes")return!0;if(s==="false"||s==="0"||s==="no")return!1;throw new _(`--field ${e}=... must be one of true|false|1|0|yes|no`,y.USAGE)}return t==="string_array"?r.split(/[\n,|]/u).map(s=>s.trim()).filter(s=>s.length>0):fe(r,e,t)}function U(e){let t=new Map;if(!e)return t;for(let r of e.item_fields)for(let s of r.fields){let n=X(s.name),i=B(s.type);if(!n||!i)continue;let a=t.get(n);if(a&&a.type!==i)throw new _(`Extension item field "${n}" is declared with conflicting types: ${a.type}, ${i}`,y.USAGE,{code:"extension_item_field_type_conflict",nextSteps:["Make every active extension declaration for this field use the same type."]});t.set(n,{name:n,type:i})}return t}function Z(e){if(D.has(e))throw new _(`Extension item field "${e}" collides with built-in item metadata "${e}"; rename the extension field with an extension-specific prefix. Reserved fields: ${[...D].sort((t,r)=>t.localeCompare(r)).join(", ")}.`,y.USAGE,{code:"extension_item_field_reserved",nextSteps:["Rename the extension item field, preferably with an extension-specific prefix."]})}function Ze(e){return[...U(e).keys()].sort((t,r)=>t.localeCompare(r))}function Qe(e,t){if(!e||e.length===0)return{};let r=U(t),s={};for(let n of e){let{key:i,value:a}=ue(n),l=r.get(i);if(!l){if(D.has(i)){let d=ce(i);throw new _(`--field ${i} is a core item field, not an extension field`,y.USAGE,{code:"core_item_field_requires_dedicated_flag",field:i,recovery:{provided_fields:[i],suggested_flags:[d]},nextSteps:[`Set the core field with its dedicated flag: pm update <id> ${d} <value>`,`When closing an item, pm close <id> also accepts ${d} <value>.`]})}let o=[...r.keys()].sort((d,c)=>d.localeCompare(c));throw new _(`--field ${i} is not declared by an active extension item-field registration`,y.USAGE,{code:"extension_item_field_unknown",recovery:{provided_fields:o},nextSteps:o.length>0?[`Use one of the declared fields: ${o.join(", ")}`]:["Activate an extension that calls registerItemFields before setting extension fields."]})}Z(l.name),s[l.name]=me(l.name,l.type,a)}return s}function ye(e,t){return t==="string"?typeof e=="string":t==="number"?typeof e=="number"&&Number.isFinite(e):t==="boolean"?typeof e=="boolean":t==="array"?Array.isArray(e):t==="string_array"?Array.isArray(e)&&e.every(r=>typeof r=="string"):typeof e=="object"&&e!==null&&!Array.isArray(e)}function _e(e,t){return!t||t.length===0?!0:t.some(r=>Object.is(r,e))}function et(e,t,r={}){if(t){U(t);for(let s of t.item_fields)for(let n of s.fields){let i=X(n.name);if(!i)continue;Z(i),!(i in e)&&!r.skipDefaultFields?.has(i)&&Object.prototype.hasOwnProperty.call(n,"default")&&(e[i]=de(n.default));let a=e[i];if(a===void 0)continue;let l=B(n.type);if(l&&!ye(a,l))throw new TypeError(`Item field "${i}" must be of type ${l}`);let o=Array.isArray(n.values)?n.values:void 0;if(!_e(a,o))throw new TypeError(`Item field "${i}" must match one of the configured allowed values`)}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2075887b-6d4b-582f-9da2-bab13198f9a5")}catch{}})();var pe=2e3,z=new Map;function S(e){if(typeof e!="string")return"";let t=z.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return z.size>=pe&&Y(z),z.set(e,r),r}import ee from"node:path";import{link as we,mkdir as he,mkdtemp as ge,rm as Se,writeFile as Ae}from"node:fs/promises";import N from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="71c2fed9-81e1-5723-8e34-e6327c07a130")}catch{}})();async function Q(e,t){let r=N.dirname(e);await he(r,{recursive:!0});let s=await ge(N.join(r,".pm-seed-")),n=N.join(s,"value");try{await Ae(n,t,"utf8");try{return await we(n,e),!0}catch(i){if(i.code==="EEXIST")return!1;throw i}}finally{await Se(s,{recursive:!0,force:!0})}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e07b1b6-1757-54dd-8833-9d3f984ccf79")}catch{}})();var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),se=G,L=K,be=["create","update"],Ee=new Set(x),ke=new Set($),Fe=new Set(P),ve=new Set(q),Te=new Set(["string","number","boolean","array","object"]),Ie=16;function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var De=[e=>e.type===void 0||typeof e.type=="string"&&Te.has(e.type),e=>!Object.hasOwn(e,"const")||O(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>O(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||ne(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function O(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(s=>O(s,t)):Object.values(e).every(s=>O(s,t));return t.delete(e),r}function R(e,t=0,r=new Set){if(!ne(e)||t>Ie||r.has(e))return;r.add(e);let s=e,n=s.type,i=s.enum,a=s.one_of,l=s.properties,o=s.items,d=s.required,c=s.min_length,u=s.min_items,w=s.format,g=s.additional_properties;if(!De.every(f=>f(s))){r.delete(e);return}let A=l===void 0?void 0:Object.fromEntries(Object.entries(l).map(([f,F])=>[f,R(F,t+1,r)])),b=o===void 0?void 0:R(o,t+1,r),E=a===void 0?void 0:a.map(f=>R(f,t+1,r));if([...Object.values(A??{}),...o===void 0?[]:[b],...E??[]].some(f=>f===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:n,const:Object.hasOwn(s,"const")?s.const:void 0,enum:i,min_length:c,min_items:u,format:w,properties:A,required:d===void 0?void 0:[...new Set(d)],additional_properties:g,items:b,one_of:E}).filter(([,f])=>f!==void 0))}function T(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,s)=>r.localeCompare(s))}function m(e){if(typeof e!="string"||e.length===0)return;let t=S(e);return t.length>0?t:void 0}function ze(e){return e.startsWith("--")?e.slice(2):e}function te(e){return typeof e=="string"?ze(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function ie(e){return e.replaceAll("_","-")}function Re(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(n=>n.length>0).map(n=>n.toLowerCase());if(t.length===0)return e;let[r,...s]=t;return`${r}${s.map(n=>`${n.slice(0,1).toUpperCase()}${n.slice(1)}`).join("")}`}function M(e,t){let r=m(e.id);if(!r)return null;let s=[...new Set(T(e.aliases).map(S).filter(l=>l.length>0))].sort((l,o)=>l.localeCompare(o)),n=T(e.roles).filter(l=>Ee.has(l)),i=e.description?.trim(),a=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:s,roles:n,description:i&&i.length>0?i:void 0,order:a}}function Oe(e){return{draft_status:m(e?.draft_status),open_status:m(e?.open_status),in_progress_status:m(e?.in_progress_status),blocked_status:m(e?.blocked_status),close_status:m(e?.close_status),canceled_status:m(e?.canceled_status)}}function oe(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=S(t[0]),s=S(t[1]);r.length===0||s.length===0||e.pairs.some(n=>n[0]===r&&n[1]===s)||e.pairs.push([r,s])}function Ue(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let s of e.allowed_transitions)oe(r,s);return{typeKey:t.toLowerCase(),record:r}}function Ne(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let s of e){let n=Ue(s);if(n===null)continue;let i=t.get(n.typeKey)??n.record;i.denyAll||=n.record.denyAll;for(let a of n.record.pairs)oe(i,a);t.set(n.typeKey,i)}let r=[];for(let s of t.values())(s.pairs.length>0||s.denyAll)&&r.push({type:s.type,allowed_transitions:s.pairs});return r.sort((s,n)=>s.type.localeCompare(n.type)),r.length>0?r:void 0}function ae(e){let t=S(e.key??"");if(!t)return null;let r=S(e.metadata_key??e.front_matter_key??t),s=te(e.cli_flag??ie(t));if(!s)return null;let n=T(e.cli_aliases).map(u=>te(u)).filter(u=>u.length>0&&u!==s),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",a=ke.has(i)?i:"string",l=(()=>{let u=T(e.commands).filter(w=>Fe.has(w));return u.length>0?u:[...be]})(),o=e.description?.trim(),d=T(e.required_types),c=e.value_schema===void 0?void 0:R(e.value_schema);return e.value_schema!==void 0&&c===void 0?null:{key:t,metadata_key:r,cli_flag:s,cli_aliases:n,description:o&&o.length>0?o:void 0,type:a,commands:l,repeatable:[e.repeatable===!0,a==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:c}}function Me(e){let t=new Map;for(let[s,n]of e.entries()){let i=M(n,s);i&&t.set(i.id,i)}let r=re([...t.values()]);return r.length>0?r:re(L.map((s,n)=>M(s,n)).filter(s=>s!==null))}function re(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Le(e){let t=new Map;for(let r of e??[]){let s=ae(r);s&&t.set(s.key,s)}return[...t.values()].sort((r,s)=>r.key.localeCompare(s.key))}function je(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ce(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==ie(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function xe(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return ve.has(t)?t:"allow"}function I(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:L,s=Me(r),n=Le(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:s.map(je),fields:n.map(Ce),workflow:{...se,...Oe(e?.workflow)},type_workflows:Ne(e?.type_workflows),unknown_field_policy:xe(e?.unknown_field_policy)}}function $e(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Pe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function qe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function We(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function Ke(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function h(e,t,r){let s=t?.trim()||r;return ee.isAbsolute(s)?s:ee.join(e,s)}function mt(e,t){return h(e,t.files.types,p.types)}async function yt(e,t){let r=I(t),s=[{path:h(e,r.files.types,p.types),seed:{definitions:[]}},{path:h(e,r.files.statuses,p.statuses),seed:{statuses:L}},{path:h(e,r.files.fields,p.fields),seed:{fields:[]}},{path:h(e,r.files.workflows,p.workflows),seed:{workflow:se}}],n=[];for(let i of s)await J(i.path)||await Q(i.path,`${JSON.stringify(i.seed,null,2)}
|
|
2
|
-
`)&&n.push(i.path);return{created_paths:n}}async function _t(e,t){let r=I(t),s=[],n=h(e,r.files.types,p.types),i=h(e,r.files.statuses,p.statuses),a=h(e,r.files.fields,p.fields),l=h(e,r.files.workflows,p.workflows),o,d,c,u,w,g=async(F,le)=>{let j=await H(F);if(j!==null)return $e(j,le,s)},A=await g(n,"runtime_schema_types_invalid_json");A!==void 0&&(o=Pe(A),o===void 0&&s.push("runtime_schema_types_invalid_shape"));let b=await g(i,"runtime_schema_statuses_invalid_json");b!==void 0&&(d=qe(b),d===void 0&&s.push("runtime_schema_statuses_invalid_shape"));let E=await g(a,"runtime_schema_fields_invalid_json");E!==void 0&&(c=Ve(E),c===void 0&&s.push("runtime_schema_fields_invalid_shape"));let f=await g(l,"runtime_schema_workflows_invalid_json");return f!==void 0&&(u=We(f),u===void 0&&s.push("runtime_schema_workflows_invalid_shape"),w=Ke(f)),{schema:I({...r,statuses:[...r.statuses,...d??[]],fields:[...r.fields,...c??[]],workflow:{...r.workflow,...u},type_workflows:[...r.type_workflows??[],...w??[]]}),type_definitions_from_file:o,warnings:s,created_paths:[]}}function v(e,t,r,s=!1){let n=r.map(a=>m(a)).filter(a=>typeof a=="string").find(a=>e.some(l=>l.id===a));if(s&&n!==void 0)return n;let i=e.find(a=>a.roles.includes(t));return i!==void 0?i.id:n??e[0]?.id}function Ge(e){let t=new Map,r=new Map;for(let s of e){r.set(s.id,s),t.set(s.id,s.id),t.set(s.id.replaceAll("_","-"),s.id),t.set(s.id.replaceAll("_"," "),s.id);for(let n of s.aliases)t.set(n,s.id),t.set(n.replaceAll("_","-"),s.id),t.set(n.replaceAll("_"," "),s.id)}return{aliasToId:t,byId:r}}function Je(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let s=new Set(r.roles);(s.has("terminal")||s.has("terminal_done")||s.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),s.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),s.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),s.has("active")&&t.activeStatuses.add(r.id),s.has("blocked")&&t.blockedStatuses.add(r.id),s.has("draft")&&t.draftStatuses.add(r.id)}return t}function pt(e){let t=I(e),r=t.statuses.map((f,F)=>M(f,F)).filter(f=>f!==null),{aliasToId:s,byId:n}=Ge(r),{activeStatuses:i,blockedStatuses:a,draftStatuses:l,terminalCanceledStatuses:o,terminalDoneStatuses:d,terminalStatuses:c}=Je(r),u=t.workflow,w=m(u.open_status)??v(r,"default_open",["open","in_progress",C[0]]),g=m(u.in_progress_status)??v(r,"active",["in_progress","in-progress",w],!0),A=m(u.blocked_status)??v(r,"blocked",["blocked"]),b=m(u.close_status)??v(r,"default_close",["closed","done","complete"]),E=m(u.canceled_status)??v(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:n,alias_to_id:s,terminal_statuses:c,terminal_done_statuses:d,terminal_canceled_statuses:o,active_statuses:i,blocked_statuses:a,draft_statuses:l,open_status:w,in_progress_status:g,blocked_status:A,close_status:b,canceled_status:E}}function He(e,t){let r=S(e);if(r)return t.alias_to_id.get(r)}function wt(e){let t=I(e),r=new Map,s=t.fields.map(o=>ae(o)).filter(o=>o!==null);for(let o of s)r.set(o.key,o);let n=[...r.values()].sort((o,d)=>o.key.localeCompare(d.key)),i=new Map,a=new Map,l=new Map;for(let o of n){i.set(o.key,o),a.set(o.cli_flag,o);for(let d of o.cli_aliases)a.set(d,o);for(let d of o.commands){let c=l.get(d)??[];c.push(o),l.set(d,c)}}for(let[o,d]of l.entries())d.sort((c,u)=>c.key.localeCompare(u.key)),l.set(o,d);return{definitions:n,by_key:i,by_cli_token:a,command_to_fields:l}}function ht(e){return Re(e.key)}function gt(e,t){let r=He(e,t);return r?t.terminal_statuses.has(r):!1}export{D as a,Ze as b,Qe as c,et as d,S as e,Q as f,p as g,L as h,I as i,h as j,mt as k,yt as l,_t as m,pt as n,He as o,wt as p,ht as q,gt as r};
|
|
3
|
-
//# sourceMappingURL=chunk-3RJ4VK7U.js.map
|