@unbrained/pm-cli 2026.9.9 → 2026.9.10

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.
Files changed (124) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +17 -0
  3. package/dist/cli/command-namespaces.d.ts +9 -0
  4. package/dist/cli/command-namespaces.js +2 -0
  5. package/dist/cli/help-content.js +1 -1
  6. package/dist/cli/help-json-payload.d.ts +5 -1
  7. package/dist/cli/help-json-payload.js +2 -2
  8. package/dist/cli/main.d.ts +1 -0
  9. package/dist/cli/main.js +3 -3
  10. package/dist/cli/register-mutation.js +2 -2
  11. package/dist/cli/register-operations.d.ts +0 -5
  12. package/dist/cli/register-operations.js +1 -1
  13. package/dist/cli-bundle/bundle-manifest.json +154 -154
  14. package/dist/cli-bundle/chunks/chunk-4SFBH77G.js +2233 -0
  15. package/dist/cli-bundle/chunks/{chunk-4VL5P22L.js → chunk-74RGSPLL.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-WQKMSFBV.js → chunk-7WIHZI2M.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-L5RCDKQ2.js → chunk-EOCKPCEY.js} +2 -2
  18. package/dist/cli-bundle/chunks/chunk-GLQMKUGP.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-OHNLSGGV.js → chunk-I6XT3DLQ.js} +2 -2
  20. package/dist/cli-bundle/chunks/chunk-MACGGTLQ.js +29 -0
  21. package/dist/cli-bundle/chunks/{chunk-ECBLPN7B.js → chunk-NKOYVKFM.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-Z3XVXUVF.js → chunk-P6BEYAON.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-3IPRM75M.js → chunk-PYUITRSV.js} +2 -2
  24. package/dist/cli-bundle/chunks/chunk-T3AMFUCN.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-D3YVILJJ.js → chunk-TSWEX72T.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-J6ERHBV2.js → chunk-YKQTETJI.js} +71 -71
  27. package/dist/cli-bundle/chunks/{register-list-query-UIHRCS6D.js → register-list-query-CUIW7SSE.js} +2 -2
  28. package/dist/cli-bundle/chunks/register-mutation-5F5CYUWZ.js +20 -0
  29. package/dist/cli-bundle/chunks/register-operations-XIZPLPQY.js +2 -0
  30. package/dist/cli-bundle/chunks/{register-setup-PERI45EM.js → register-setup-JVGPCAIL.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-OQUGRHKV.js → chunk-26O2WB73.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-5YU75QLV.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-QQQ4SAUO.js → chunk-7N5MRONP.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-B2CMFYRZ.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-PNKIANFZ.js → chunk-CRY5MHEI.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-YCDQ2N23.js → chunk-F6WKFXBT.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-BUCJUZVG.js → chunk-FHUARRMA.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-5FHTCOHS.js → chunk-M36SF4GE.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-TTYXF5YD.js → chunk-OROZM37I.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-XNR3DM6J.js → chunk-PNGYYQY7.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-ZTCE4UO6.js → chunk-SL5YVVPV.js} +3 -3
  42. package/dist/cli-bundle/focused-chunks/{chunk-XSS3APUF.js → chunk-TPOL4TWE.js} +5 -5
  43. package/dist/cli-bundle/focused-chunks/{chunk-7PC4R5QB.js → chunk-U5SHHU7E.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/{chunk-2WSBXIGF.js → chunk-XSMA2W6Q.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-ZAWAL2CG.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-7N6DOREF.js → chunk-ZDNAWWQI.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-YJUXGS57.js → chunk-ZJHYQOTM.js} +2 -2
  48. package/dist/cli-bundle/main.js +26 -26
  49. package/dist/cli-bundle/sdk-authoring.js +1 -1
  50. package/dist/cli-bundle/sdk-contracts.js +2 -2
  51. package/dist/cli-bundle/sdk-core.js +37 -37
  52. package/dist/cli-bundle/sdk-governance.js +1 -1
  53. package/dist/cli-bundle/sdk-graph.js +1 -1
  54. package/dist/cli-bundle/sdk-merge.js +42 -42
  55. package/dist/cli-bundle/sdk-query.js +1 -1
  56. package/dist/cli-bundle/sdk-runtime.js +1 -1
  57. package/dist/cli-bundle/sdk-testing.js +1 -1
  58. package/dist/cli-bundle/sdk.js +10 -10
  59. package/dist/sdk/agent/item-addressing.js +1 -1
  60. package/dist/sdk/agent-capability-contracts.js +1 -1
  61. package/dist/sdk/cli-bootstrap.js +1 -1
  62. package/dist/sdk/cli-contracts/command-aliases.d.ts +11 -1
  63. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  64. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  65. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  66. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  67. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +4 -1
  68. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  69. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -3
  70. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  71. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +2 -0
  72. package/dist/sdk/cli-contracts.d.ts +1 -1
  73. package/dist/sdk/cli-contracts.js +1 -1
  74. package/dist/sdk/completion.js +359 -346
  75. package/dist/sdk/index.d.ts +2 -1
  76. package/dist/sdk/index.js +1 -1
  77. package/dist/sdk/lifecycle/claim.js +1 -1
  78. package/dist/sdk/lifecycle/lifecycle-transitions.d.ts +1 -1
  79. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
  80. package/dist/sdk/lifecycle/mcp-actions.js +1 -1
  81. package/dist/sdk/lifecycle/task-composition.d.ts +17 -0
  82. package/dist/sdk/lifecycle/task-composition.js +2 -0
  83. package/dist/sdk/public-surface.json +1 -1
  84. package/dist/sdk/query/workspace-contracts.d.ts +3 -0
  85. package/dist/sdk/query/workspace-contracts.js +2 -0
  86. package/dist/sdk/runtime-input.js +1 -1
  87. package/dist/sdk/runtime.d.ts +69 -9
  88. package/dist/sdk/runtime.js +1 -1
  89. package/docs/COMMANDS.md +26 -24
  90. package/docs/COMMAND_NAMESPACES.md +65 -0
  91. package/docs/LIFECYCLE_COMMANDS.md +77 -0
  92. package/docs/README.md +2 -0
  93. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +6 -6
  94. package/docs/generated/AGENT_COMMAND_SURFACE.md +19 -0
  95. package/docs/generated/FLAG_LEXICON_BUDGETS.md +21 -3
  96. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +2 -2
  97. package/marketplace.json +2 -2
  98. package/package.json +1 -1
  99. package/packages/pm-beads/package.json +1 -1
  100. package/packages/pm-calendar/package.json +1 -1
  101. package/packages/pm-command-kit/package.json +1 -1
  102. package/packages/pm-digital-twin/package.json +1 -1
  103. package/packages/pm-governance-audit/README.md +4 -2
  104. package/packages/pm-governance-audit/package.json +1 -1
  105. package/packages/pm-guide-shell/package.json +1 -1
  106. package/packages/pm-kanban/package.json +1 -1
  107. package/packages/pm-lifecycle-hooks/package.json +1 -1
  108. package/packages/pm-linked-test-adapters/package.json +1 -1
  109. package/packages/pm-search-advanced/README.md +6 -4
  110. package/packages/pm-search-advanced/package.json +1 -1
  111. package/packages/pm-templates/package.json +1 -1
  112. package/packages/pm-todos/package.json +1 -1
  113. package/packages/pm-vcs/package.json +1 -1
  114. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  115. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  116. package/dist/cli-bundle/chunks/chunk-AAFBV3U3.js +0 -29
  117. package/dist/cli-bundle/chunks/chunk-JUNJ5EKI.js +0 -2
  118. package/dist/cli-bundle/chunks/chunk-NSAPNEYH.js +0 -2
  119. package/dist/cli-bundle/chunks/chunk-XZ6T7YPP.js +0 -2217
  120. package/dist/cli-bundle/chunks/register-mutation-WHWMGRVX.js +0 -20
  121. package/dist/cli-bundle/chunks/register-operations-64YZYTC5.js +0 -2
  122. package/dist/cli-bundle/focused-chunks/chunk-2W4XIYOB.js +0 -2
  123. package/dist/cli-bundle/focused-chunks/chunk-FE3BABLJ.js +0 -2
  124. package/dist/cli-bundle/focused-chunks/chunk-IWITF53W.js +0 -2
@@ -1,4 +1,4 @@
1
- import{$f as Bo,Ac as Do,Bc as jo,C as cn,Cj as Ee,Dj as Tt,E as _o,Ej as Ot,Ge as Mo,H as ln,Hd as I,Hj as Re,I as f,Id as X,Jd as Lo,K as m,Kd as Y,Kf as At,Lc as B,Ld as oe,Le as H,Lf as Uo,Me as Q,Mf as mn,Mi as Ko,Mj as rr,Mk as ir,N as wo,Nb as Io,Nd as Fo,Nf as zo,Ni as Ce,Nj as gn,Ob as Ao,Od as nt,Of as fn,Oi as ot,Pi as Vo,Pn as Ct,Qd as $t,Qf as Jo,Qi as Yo,Rf as qo,Ri as ie,Si as ze,Ti as Xo,Ua as ko,Uc as K,Uf as Wo,Ui as le,Va as xo,Wa as U,Wb as To,X as T,Xb as Oo,Zb as Co,bj as ae,cb as P,db as So,df as Go,e as ho,eb as Eo,ef as It,ej as A,fb as $o,fj as xe,i as k,ia as vo,j as bt,k as re,ka as bo,kj as Zo,l as W,la as V,lj as Qo,m as fe,mj as Se,nc as un,ni as hn,nj as er,o as go,oc as Ro,oj as tr,pa as ce,pc as Po,pi as Ho,qc as St,qi as Ue,r as kt,rj as nr,sc as ve,uc as be,ui as ke,va as xt,wa as dn,wb as Ge,xa as pn,xc as No,xj as or,y as yo,zc as Et}from"./chunk-J6ERHBV2.js";import{mkdir as js,readFile as Ls}from"node:fs/promises";import pr 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]="4d7f490a-03a3-512c-ba3c-b19fcc9a1270")}catch{}})();var yn=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},Fs="sdk-workspace-transaction",Ms=/^[a-zA-Z0-9._-]+$/,Gs=30,Us=3e3;function ar(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!Ms.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function sr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function cr(e,t,n){let o=e??t;if(!Number.isInteger(o)||o<=0)throw new TypeError(`${n} must be a positive integer`);return o}function ur(e,t){return pr.join(e,"transactions","sdk",`${t}.json`)}async function $e(e,t){t.updatedAt=T();let n=ur(e,t.transactionId);await js(pr.dirname(n),{recursive:!0}),await fe(n,`${JSON.stringify(t,null,2)}
1
+ import{$a as U,$b as To,Aa as xt,Ba as dn,Bb as Ge,Ca as pn,Cc as No,Cj as or,D as yo,Ec as Et,Fc as Do,Gc as jo,H as cn,Hj as Ee,Ij as Tt,J as _o,Jj as Ot,Le as Mo,M as ln,Md as I,Mj as Re,N as f,Nd as X,Od as Lo,P as m,Pd as Y,Pf as At,Qc as B,Qd as oe,Qe as H,Qf as Uo,Re as Q,Rf as mn,Ri as Ko,Rj as rr,Rk as ir,S as wo,Sb as Io,Sd as Fo,Sf as zo,Si as Ce,Sj as gn,Tb as Ao,Td as nt,Tf as fn,Ti as ot,Ui as Vo,Un as Ct,Vd as $t,Vf as Jo,Vi as Yo,Wf as qo,Wi as ie,Xi as ze,Yi as Xo,Za as ko,Zc as K,Zf as Wo,Zi as le,_a as xo,aa as T,ac as Oo,cc as Co,eg as Bo,gj as ae,hb as P,ib as So,if as Go,j as ho,jb as Eo,jf as It,jj as A,kb as $o,kj as xe,n as k,na as vo,o as bt,p as re,pa as bo,pj as Zo,q as W,qa as V,qj as Qo,r as fe,rj as Se,sc as un,si as hn,sj as er,t as go,tc as Ro,tj as tr,ua as ce,uc as Po,ui as Ho,vc as St,vi as Ue,w as kt,wj as nr,xc as ve,zc as be,zi as ke}from"./chunk-YKQTETJI.js";import{mkdir as js,readFile as Ls}from"node:fs/promises";import pr 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]="4d7f490a-03a3-512c-ba3c-b19fcc9a1270")}catch{}})();var yn=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},Fs="sdk-workspace-transaction",Ms=/^[a-zA-Z0-9._-]+$/,Gs=30,Us=3e3;function ar(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!Ms.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function sr(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n)throw new TypeError(`${t} must be non-empty`);return n}function cr(e,t,n){let o=e??t;if(!Number.isInteger(o)||o<=0)throw new TypeError(`${n} must be a positive integer`);return o}function ur(e,t){return pr.join(e,"transactions","sdk",`${t}.json`)}async function $e(e,t){t.updatedAt=T();let n=ur(e,t.transactionId);await js(pr.dirname(n),{recursive:!0}),await fe(n,`${JSON.stringify(t,null,2)}
2
2
  `)}function zs(e){return Number.isInteger(e.attempt)&&typeof e.author=="string"&&typeof e.createdAt=="string"&&typeof e.updatedAt=="string"}function Pe(e){return Object.assign(Object.create(null),e)}function Js(e,t){try{let n=JSON.stringify(e,(o,r)=>{if(typeof r=="number"&&!Number.isFinite(r))throw new TypeError(`${t} contains a non-finite number`);if(r===void 0||typeof r=="function"||typeof r=="symbol")throw new TypeError(`${t} contains a non-JSON value`);return r});return JSON.parse(n)}catch(n){throw new TypeError(`${t} must be JSON serializable`,{cause:n})}}function _n(e,t){return e===void 0?void 0:Js(e,t)}function wn(e,t,n,o){let r=_n(n,o);r===void 0?delete e[t]:e[t]=r}function lr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function dr(e,t){return Array.isArray(e)&&new Set(e).size===e.length&&e.every(n=>typeof n=="string"&&t.includes(n))}function qs(e,t){if(!dr(e.startedStepIds,t)||!dr(e.completedStepIds,t)||!lr(e.results)||!lr(e.compensationData))return!1;let n=e.startedStepIds,o=new Set(n),r=e.completedStepIds,i=new Set(r);return Object.keys(e.compensationData).some(a=>!o.has(a))||Object.keys(e.results).some(a=>!i.has(a))?!1:e.status==="committed"?t.every(a=>i.has(a)):e.status!=="compensated"||i.size===0&&o.size===0}function Ws(e,t,n){let o;try{o=JSON.parse(e)}catch{throw new TypeError(`Workspace transaction ${t} journal is invalid JSON`)}if(!o||typeof o!="object"||Array.isArray(o))throw new TypeError(`Workspace transaction ${t} journal is invalid`);let r=o,i=r.schemaVersion===1&&r.transactionId===t,a=Array.isArray(r.stepIds)&&r.stepIds.length===n.length&&r.stepIds.every((d,p)=>d===n[p]),s=qs(r,n),c=zs(r),l=["applying","compensating","compensated","committed"].includes(String(r.status));if(!i||!a||!s||!c||!l)throw new TypeError(`Workspace transaction ${t} journal does not match the supplied plan`);return{...r,results:Pe(r.results),compensationData:Pe(r.compensationData)}}async function Bs(e,t,n,o,r){let i=r,a=i!==void 0;if(i?.status==="compensating"&&await mr(e,i),i===void 0||i.status==="compensated"){let s=T();i={schemaVersion:1,transactionId:t,author:n,status:"applying",attempt:(i?.attempt??0)+1,createdAt:i?.createdAt??s,updatedAt:s,stepIds:o,startedStepIds:[],completedStepIds:[],results:Pe(),compensationData:Pe()},await $e(e.pmRoot,i),await he(e,i,"prepared")}return{journal:i,recovered:a}}async function Hs(e,t,n){try{await Vs(t,e.steps),await $e(e.pmRoot,t);let o=new Set(t.completedStepIds),r=new Set(t.startedStepIds);for(let i of e.steps){if(o.has(i.id))continue;let a=await i.inspect(),s=_n(a.result,`Step ${i.id} result`);if(a.state!=="applied"){let c=await i.prepareCompensation?.();wn(t.compensationData,i.id,c,`Step ${i.id} compensation data`),r.add(i.id),t.startedStepIds=e.steps.map(d=>d.id).filter(d=>r.has(d)),await $e(e.pmRoot,t);let l=await i.apply();s=_n(l,`Step ${i.id} result`)}await he(e,t,"step_applied",i.id),o.add(i.id),t.completedStepIds=e.steps.map(c=>c.id).filter(c=>o.has(c)),wn(t.results,i.id,s,`Step ${i.id} result`),await $e(e.pmRoot,t),await he(e,t,"step_recorded",i.id)}return await he(e,t,"committing"),t.status="committed",await $e(e.pmRoot,t),await he(e,t,"committed"),{transactionId:t.transactionId,status:"committed",recovered:n,results:Pe(t.results)}}catch(o){if(o instanceof yn||t.status==="committed")throw o;try{await mr(e,t)}catch(r){throw new AggregateError([o,r],`Workspace transaction failed and compensation failed: ${String(r)}`,{cause:r})}throw o}}async function Ks(e,t,n){try{return Ws(await Ls(ur(e,t),"utf8"),t,n)}catch(o){if(o!==null&&typeof o=="object"&&"code"in o&&re(o))return;throw o}}async function he(e,t,n,o){await e.onTransition?.({transactionId:t.transactionId,attempt:t.attempt,transition:n,...o===void 0?{}:{stepId:o}})}async function Vs(e,t){let n=new Set,o=Pe();for(let r of t){let i=await r.inspect();i.state==="applied"&&(n.add(r.id),wn(o,r.id,i.result,`Step ${r.id} result`))}e.results=o,e.completedStepIds=t.map(r=>r.id).filter(r=>n.has(r))}async function mr(e,t){t.status="compensating",await $e(e.pmRoot,t),await he(e,t,"compensating");let n=new Set(t.completedStepIds),o=new Set(t.startedStepIds);for(let r of[...e.steps].reverse()){if(!o.has(r.id)&&!n.has(r.id))continue;let i;try{i=o.has(r.id)&&(await r.inspect()).state==="applied"}catch{i=o.has(r.id)}i&&(await he(e,t,"step_compensating",r.id),await r.compensate(t.compensationData[r.id])),n.delete(r.id),o.delete(r.id),t.completedStepIds=e.steps.map(a=>a.id).filter(a=>n.has(a)),t.startedStepIds=e.steps.map(a=>a.id).filter(a=>o.has(a)),delete t.results[r.id],delete t.compensationData[r.id],await $e(e.pmRoot,t),await he(e,t,"step_compensated",r.id)}t.status="compensated",await $e(e.pmRoot,t),await he(e,t,"compensated")}async function fr(e){let t=sr(e.pmRoot,"Transaction pmRoot"),n=ar(e.transactionId,"Transaction id"),o=sr(e.author,"Transaction author"),r=cr(e.lockTtlSeconds,Gs,"Transaction lock TTL"),i=cr(e.lockWaitMs,Us,"Transaction lock wait"),a=[...e.steps];if(a.length===0)throw new TypeError("Workspace transaction requires at least one step");let s=a.map(d=>{let p=ar(d.id,"Transaction step id");if(p!==d.id)throw new TypeError("Transaction step id must not contain surrounding whitespace");return p});if(new Set(s).size!==s.length)throw new TypeError("Workspace transaction step ids must be unique");let c={...e,pmRoot:t,transactionId:n,author:o,steps:a,lockTtlSeconds:r,lockWaitMs:i},l=await Q(t,Fs,r,o,!1,!1,i);try{let d=await Ks(t,n,s),p=d!==void 0;if(d?.status==="committed")return{transactionId:n,status:"committed",recovered:!0,results:Pe(d.results)};let u=await Bs(c,n,o,s,d);return await Hs(c,u.journal,p||u.recovered)}finally{await l()}}import{readFile as Ys,writeFile as Xs}from"node:fs/promises";import rt 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]="5b131b40-e139-5a7d-a6ef-633fe2cbee64")}catch{}})();var gr="# pm-cli:runtime-cache:start",vn="# pm-cli:runtime-cache:end",yr=".agents/pm",Zs=["runtime/","search/","locks/","transactions/","checkpoints/"],Qs=["search/eval-queries.json"];async function hr(e){try{return await e()}catch(t){throw t instanceof Error&&"code"in t&&typeof t.code=="string"&&["EACCES","EPERM","EROFS"].includes(t.code)?new m("The workspace .gitignore is not writable.",f.GENERIC_FAILURE,{code:"init_gitignore_unwritable",reason:t.code.toLowerCase(),required:"Grant the current user read and write access to the workspace .gitignore before initialization.",why:"pm init must publish its managed runtime-cache ignore fence without replacing unrelated entries.",nextSteps:["Grant read and write access to the workspace .gitignore and rerun pm init.","If the workspace is intentionally read-only, initialize pm in a writable workspace or clone."]}):t}}function _r(e){return e.replaceAll("\\","/").replace(/^\.\/+/,"").replace(/\/+$/,"")}function bn(e){let t=e.replaceAll("\\","/");return rt.isAbsolute(e)||t===".."||t.startsWith("../")}function ec(e=yr){let t=_r(e);return[gr,...Zs.map(n=>n==="search/"?`${t}/${n}*`:`${t}/${n}`),...Qs.map(n=>`!${t}/${n}`),vn].join(`
3
3
  `)}async function wr(e,t={}){let n=rt.join(e,".gitignore"),o=yr;if(t.pmRoot!==void 0){let d=_r(rt.relative(rt.resolve(e),rt.resolve(t.pmRoot)));if(bn(d))return{path:n,changed:!1};d.length>0&&(o=d)}let r="";try{r=await hr(()=>Ys(n,"utf8"))}catch(d){if(!(d instanceof Error&&"code"in d&&re(d)))throw d}let i=r.indexOf(gr),a=r.indexOf(vn),c=(i>=0&&a>=i?`${r.slice(0,i)}${r.slice(a+vn.length)}`:r).trimEnd(),l=`${c.length>0?`${c}
4
4
 
@@ -76,4 +76,4 @@ Agent guidance check
76
76
  `),Z.write(`Telemetry helps improve reliability and can be disabled anytime via pm config.
77
77
  `);let c=t?"Y/n":"y/N",l=await n.question(`Enable telemetry for this project? [${c}] `),d=ks(l,t);return Z.write(`
78
78
  `),{prefix:r,preset:s,telemetry_enabled:d}}finally{n.close()}}function xm(e){return{presetFromOption:po(e.preset),useDefaults:e.defaults===!0,authorFromOption:_s(e.author),installBundledPackages:e.withPackages===!0,agentGuidanceMode:bs(e.agentGuidance),typePreset:ys(e.typePreset)}}function Sm(e){let t=[];return e.prefixArg!==void 0&&e.settings.id_prefix!==e.normalizedPrefix&&t.push("id_prefix"),e.presetFromOption!==void 0&&e.settings.governance.preset!==e.presetFromOption&&t.push("governance_preset"),e.authorFromOption!==void 0&&e.settings.author_default!==e.authorFromOption&&t.push("author_default"),t}function Em(e,t,n,o){if(t.length===0||n)return;let r=o.discovery==="ancestor";throw new m(`${r?`No tracker exists in ${o.requested_cwd}; pm init found an ancestor tracker at ${o.tracker_root}. `:""}Refusing to update existing tracker settings at ${e} without --force.`,f.USAGE,{code:"init_existing_settings_requires_force",type:"urn:pm-cli:error:init_existing_settings_requires_force",required:`--force for ${t.join(", ")}`,why:r?"Ancestor discovery is useful for normal commands, but init must make the selected existing workspace explicit before changing its identity or policy settings.":"pm init is safe to rerun, but changing id prefix, governance preset, or default author on an existing tracker can corrupt long-lived project context when an agent meant to initialize a sandbox path.",resolved_path:o.tracker_root,requested_path:o.requested_cwd,suggested_path:o.suggested_current_tracker_root,examples:["pm init --yes","pm init ./sandbox-pm --yes",...r?['pm init <name> --yes --pm-path "$PWD/.agents/pm"']:[],"pm init acme --yes --force"],nextSteps:[...r?['To create a new tracker in the current directory, rerun with --pm-path "$PWD/.agents/pm".']:[],"If you meant to initialize a sandbox tracker, pass a path-like positional such as ./sandbox-pm or /tmp/pm-test.","If you intentionally want to rewrite this existing tracker's init-managed settings, rerun with --force."]})}function $m(e){let t=!1;return e.prefixArg!==void 0&&e.settings.id_prefix!==e.normalizedPrefix&&(e.settings.id_prefix=e.normalizedPrefix,e.warnings.push(`updated:id_prefix:${e.normalizedPrefix}`),t=!0),e.presetFromOption!==void 0&&e.settings.governance.preset!==e.presetFromOption&&(uo(e.settings,e.presetFromOption),e.warnings.push(`updated:governance_preset:${e.presetFromOption}`),t=!0),e.authorFromOption!==void 0&&e.settings.author_default!==e.authorFromOption&&(e.settings.author_default=e.authorFromOption,e.warnings.push(`updated:author_default:${e.authorFromOption}`),t=!0),t}async function Im(e){let t=await A(e.pmRoot);e.warnings.push(`already_exists:${e.settingsPath}`);let n=Sm({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption});return Em(e.settingsPath,n,e.options.force===!0,e.target),$m({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption,warnings:e.warnings})&&await xe(e.pmRoot,t),{settings:t,normalizedPrefix:e.normalizedPrefix,chosenPreset:e.normalizedOptions.presetFromOption,wizardUsed:!1}}async function Am(e){let t=e.normalizedPrefix,n=e.normalizedOptions.presetFromOption,o,r=!1;if(e.normalizedOptions.presetFromOption===void 0&&!e.normalizedOptions.useDefaults&&process.stdin.isTTY===!0&&process.stdout.isTTY===!0){let c=await As(t,ln.telemetry.enabled);t=c.prefix,n=c.preset,o=c.telemetry_enabled,r=!0}let i=n??"minimal",a=vm();a.id_prefix=t,uo(a,i);let s=Mo()?.trim()||void 0;return a.author_default=e.normalizedOptions.authorFromOption??s??"",o!==void 0&&(a.telemetry.enabled=o,a.telemetry.first_run_prompt_completed=!0),await xe(e.pmRoot,a),{settings:a,normalizedPrefix:t,chosenPreset:n,wizardUsed:r}}async function ms(e){return e.settingsExists?await Im(e):await Am({pmRoot:e.pmRoot,normalizedPrefix:e.normalizedPrefix,normalizedOptions:e.normalizedOptions})}async function Tm(e){let t=await us({pm_root:e.pmRoot,cwd:e.cwd,mode:e.agentGuidanceMode,interactive:process.stdin.isTTY===!0&&process.stdout.isTTY===!0,settings:e.settings});return e.warnings.push(...t.warnings),t.settings_changed&&await xe(e.pmRoot,e.settings),{...t.summary,next_steps:t.next_steps}}async function Om(e,t){let n=[],o=[],r=await Fo(e,t.schema);for(let i of r.created_paths)n.push(i),o.push(...await K({path:i,scope:"project",op:"init:runtime_schema_file"}));return{createdDirs:n,warnings:o}}async function Cm(e){if(e.typePreset===void 0)return;let t=await Ss(e.pmRoot,e.settings,e.typePreset);return e.warnings.push(`registered_type_preset:${e.typePreset}`),e.warnings.push(...await K({path:t.file,scope:"project",op:"init:type_preset"})),t}async function Rm(e){let n=U(e.settings,B()).folders.filter(r=>!cn.includes(r)),o=await Is(e.pmRoot,n);e.createdDirs.push(...o.createdDirs),e.warnings.push(...o.warnings)}function Pm(e){let t=j.resolve(e.tracker_root),n=j.dirname(t);return j.basename(t)==="pm"&&j.basename(n)===".agents"?j.dirname(n):e.workspace_root}async function Nm(e,t,n,o){if(!e)return;let r=await oo("all",{install:!0,project:!0},{...t,path:n});o.push(...r.warnings);let i=xs(r),a=i.packages.filter(s=>!s.ok).map(s=>s.alias);if(!i.installed_all||a.length>0)throw new m(`pm init --with-packages did not install all bundled packages successfully${a.length>0?`: ${a.join(", ")}`:"."}`,f.GENERIC_FAILURE);return i}function Ts(e){let t=o=>It([...e.target.mode==="workspace-discovery"?[]:["--pm-path",e.target.tracker_root],...o]),n=[`Create your first item: ${t(["create","--type","Task","--title","<title>"])}`,`List active items: ${t(["list"])}`,`Get agent-friendly project context: ${t(["context"])}`];e.installBundledPackages?n.push(`Explore newly-available commands: ${t(["cal"])}, ${t(["templates"])}, ${t(["guide"])}`):(n.push(`Add optional packages for richer workflows: ${t(["install","calendar","--project"])}, ${t(["install","templates","--project"])}, ${t(["install","guide-shell","--project"])}`),n.push(`Or install everything bundled: ${t(["init","--with-packages"])} (idempotent on re-run)`)),e.registeredTypePreset&&n.push(`Inspect registered preset types: ${t(["schema","list"])}, ${t(["schema","show",e.registeredTypePreset.registered[0]??e.registeredTypePreset.updated[0]])}`),n.push("Supported agent harnesses are attributed automatically; use --author or PM_AUTHOR only when an explicit identity override is required.");for(let o of e.agentGuidanceNextSteps){let r=e.target.mode==="workspace-discovery"?o:o.replace(/\bpm (?=[a-z])/g,()=>`${t([])} `);n.includes(r)||n.push(r)}return n}async function Os(e,t,n,o=An){if(t===null){n.push("merge_fence_skipped:not_git_repository:run pm merge install after moving the tracker into a Git repository");return}try{let r=await o({pmRoot:e,workspaceRoot:t});r.gitattributes.changed&&n.push(`updated:merge_fence:${r.gitattributes.path}`)}catch(r){if(!(r instanceof m))throw r;n.push(`merge_fence_skipped:install_failed:${r.context.code??"pm_error"}:${r.message}:run pm merge install after resolving the Git repository error`)}}async function Dm(e,t,n,o){if(e==null||n==="status")return;let r=await wr(e,{pmRoot:t});r.changed&&o.push(`updated:gitignore:${r.path}`)}async function wv(e,t,n={}){let o=t[_m],r=typeof o=="string"?o:process.cwd(),i=ws(r,t,e,n.workspace),a=i.pmRoot;e=vs(i.prefixArg,n.idPrefix);let s=xm(n);await $s(a,i.target.mode==="tracker-path",n.force===!0);let c=[],l=[],d=j.join(a,"settings.json"),p=await k(d),u;p&&(u=await ms({pmRoot:a,settingsPath:d,settingsExists:p,normalizedPrefix:ke(e),prefixArg:e,options:n,normalizedOptions:s,warnings:l,target:i.target}));let h=await Is(a,cn);c.push(...h.createdDirs),l.push(...h.warnings),u??=await ms({pmRoot:a,settingsPath:d,settingsExists:p,normalizedPrefix:ke(e),prefixArg:e,options:n,normalizedOptions:s,warnings:l,target:i.target});let{settings:y}=u,_=Pm(i.target),g=await En(_??j.dirname(a)),w=_??g,v=await Tm({pmRoot:a,cwd:w??r,agentGuidanceMode:s.agentGuidanceMode,settings:y,warnings:l}),x=await Om(a,y);c.push(...x.createdDirs),l.push(...x.warnings);let E=await Cm({pmRoot:a,settings:y,typePreset:s.typePreset,warnings:l});E&&(y=await A(a)),await Rm({pmRoot:a,settings:y,createdDirs:c,warnings:l}),await Dm(w,a,s.agentGuidanceMode,l),!p&&n.mergeFence!==!1&&s.agentGuidanceMode!=="status"&&await Os(a,g,l);let C=await Nm(s.installBundledPackages,t,a,l),G=Ts({installBundledPackages:s.installBundledPackages,registeredTypePreset:E,agentGuidanceNextSteps:v.next_steps,target:i.target});return{ok:!0,path:a,target:i.target,settings:y,created_dirs:c,warnings:l,governance_preset:y.governance.preset,wizard_used:u.wizardUsed,...E?{registered_type_preset:E}:{},...C?{installed_packages:C}:{},next_steps:G,agent_guidance:v}}export{yn as a,fr as b,gr as c,vn as d,Zs as e,ec as f,wr as g,Je as h,nc as i,oc as j,br as k,Rt as l,Er as m,qe as n,xn as o,cc as p,En as q,In as r,Or as s,yf as t,_f as u,Cr as v,wf as w,An as x,qr as y,He as z,Ke as A,Wr as B,Ur as C,We as D,Be as E,zr as F,Qc as G,dc as H,kf as I,$f as J,Pr as K,uc as L,Jf as M,Xr as N,ti as O,Xc as P,Zc as Q,tg as R,og as S,rg as T,ct as U,ig as V,ag as W,sg as X,cg as Y,lg as Z,dg as _,pg as $,ug as aa,mg as ba,fg as ca,hg as da,gg as ea,yg as fa,_g as ga,wg as ha,vg as ia,bg as ja,kg as ka,xg as la,Sg as ma,Eg as na,$g as oa,Ig as pa,Ag as qa,Tg as ra,b as sa,_e as ta,Mt as ua,gl as va,dt as wa,Gt as xa,Ei as ya,Ni as za,Vn as Aa,Ki as Ba,qy as Ca,Sp as Da,ka as Ea,xa as Fa,Ea as Ga,Yn as Ha,rp as Ia,ip as Ja,ap as Ka,Xi as La,la as Ma,yp as Na,Np as Oa,pa as Pa,oo as Qa,Qa as Ra,Hw as Sa,us as Ta,_m as Ua,yv as Va,_v as Wa,wv as Xa};
79
- //# sourceMappingURL=chunk-OHNLSGGV.js.map
79
+ //# sourceMappingURL=chunk-I6XT3DLQ.js.map