@unbrained/pm-cli 2026.11.2 → 2026.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/cli/error-guidance.d.ts +23 -35
- package/dist/cli/error-guidance.js +4 -3
- package/dist/cli/expected-revisions.d.ts +55 -0
- package/dist/cli/expected-revisions.js +2 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/runtime/field-route-retry.d.ts +15 -0
- package/dist/cli/runtime/field-route-retry.js +2 -0
- package/dist/cli/runtime/invocation-options.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-3A4NVHYS.js → chunk-2GW662DP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-3OXQGGRD.js +115 -0
- package/dist/cli-bundle/chunks/chunk-5BVZ32G7.js +2 -0
- package/dist/cli-bundle/chunks/chunk-5S6RT5LX.js +9 -0
- package/dist/cli-bundle/chunks/chunk-5Z6LWFDL.js +31 -0
- package/dist/cli-bundle/chunks/{chunk-RGHLQGEX.js → chunk-6T2V3UIK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JRXD7SIL.js → chunk-7PGNAHNW.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7RCI7AAA.js +20 -0
- package/dist/cli-bundle/chunks/chunk-AQ5UHHQS.js +2 -0
- package/dist/cli-bundle/chunks/chunk-BK2XAQVC.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ABFFRQRO.js → chunk-BRIPGUAO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-BWAXA6S4.js +6 -0
- package/dist/cli-bundle/chunks/{chunk-HOGKWJU5.js → chunk-CERNIZLB.js} +66 -66
- package/dist/cli-bundle/chunks/chunk-DSCFJTHB.js +122 -0
- package/dist/cli-bundle/chunks/{chunk-VEOFWE32.js → chunk-L4BKTPJ6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NGRPD3ZO.js → chunk-NPEDFOVQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-J3JM36EH.js → chunk-O4ZLEN4T.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-533L6D2N.js → chunk-ODMJ3HIB.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-KJLGBLR3.js → chunk-QN7VCOUU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-QQHMNUZT.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-D52QQ7LP.js → chunk-RSAN2YUU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SRDO2NJU.js +2 -0
- package/dist/cli-bundle/chunks/chunk-T56MB6SF.js +2 -0
- package/dist/cli-bundle/chunks/chunk-TX2W6G37.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-GK2CHAT3.js → chunk-UJMQP2HP.js} +2 -2
- package/dist/cli-bundle/chunks/{indexed-receipt-blobs-IEJ2QOW3.js → indexed-receipt-blobs-I6RQGD6Y.js} +2 -2
- package/dist/cli-bundle/chunks/item-revision-UAZOBP2Q.js +2 -0
- package/dist/cli-bundle/chunks/item-transaction-N5F4LXYV.js +2 -0
- package/dist/cli-bundle/chunks/mutation-admission-QZQI2NN5.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-NZTK3AXA.js → register-list-query-P3NOKQUA.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-2OFAMOVH.js → register-mutation-A6I5K5N6.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-SPKB3TNM.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-ZZRHJ4IS.js +2 -0
- package/dist/cli-bundle/chunks/{settlement-hook-UTCEZBFT.js → settlement-hook-JHXLUBEN.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-VLI4OBVX.js → stage-L3T725DS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NGNO54M.js +44 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PCCZ72C3.js → chunk-A2246ZM7.js} +54 -54
- package/dist/cli-bundle/focused-chunks/chunk-B6U44WPW.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-BAW3DGQO.js +91 -0
- package/dist/cli-bundle/focused-chunks/chunk-BHNY3KPJ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-745IDMTD.js → chunk-C7UX2ZI3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CBG67HUP.js +23 -0
- package/dist/cli-bundle/focused-chunks/{chunk-NJFMG3IK.js → chunk-CO2DNPH7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-CXTDEQ3N.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-FEPE2CE4.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FFO7RBLN.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QNXXOFLQ.js → chunk-FXFDVM5O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QVFE5LIX.js → chunk-G6ERMFJ5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MQVBWFJF.js → chunk-IDAYTYNN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-J3YOATXR.js +80 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3UD6F2KQ.js → chunk-J6FDCAMH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-J7M52SCZ.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-JQS7TYQ6.js +12 -0
- package/dist/cli-bundle/focused-chunks/chunk-MEJKELWC.js +26 -0
- package/dist/cli-bundle/focused-chunks/chunk-PMKR4MJI.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-PNPYQDHU.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Q4OIRSKL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-I4Z2SCV5.js → chunk-QEVJ3Y67.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-Q23K6WLV.js → chunk-SDLIUZEL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-TFYTTDAK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-W3CSX6GI.js +3 -0
- package/dist/cli-bundle/focused-chunks/{chunk-B6OOKKOX.js → chunk-Y5GOUUYJ.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{indexed-receipt-blobs-FT3KF6VJ.js → indexed-receipt-blobs-7XGVHYAO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/item-revision-L6GVT42D.js +2 -0
- package/dist/cli-bundle/focused-chunks/item-transaction-GYGP264N.js +2 -0
- package/dist/cli-bundle/focused-chunks/mutation-admission-UWTH56OD.js +2 -0
- package/dist/cli-bundle/focused-chunks/{settlement-hook-KMIBD4F2.js → settlement-hook-H56537UV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-6B3O2GZ6.js → stage-WRSNJ7VI.js} +2 -2
- package/dist/cli-bundle/main.js +30 -29
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +5 -5
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +11 -11
- package/dist/core/config/positional-value.d.ts +1 -1
- package/dist/core/config/positional-value.js +1 -1
- package/dist/core/extensions/extension-hook-runtime.js +1 -1
- package/dist/core/extensions/item-fields.d.ts +1 -1
- package/dist/core/extensions/item-fields.js +1 -1
- package/dist/core/extensions/reserved-host-flags.js +1 -1
- package/dist/core/history/history-rewrite.js +1 -1
- package/dist/core/schema/runtime-field-values.d.ts +30 -0
- package/dist/core/schema/runtime-field-values.js +1 -1
- package/dist/core/sentry/helpers.js +1 -1
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/shared/command-types.d.ts +7 -0
- package/dist/core/shared/error-details.d.ts +98 -0
- package/dist/core/shared/error-details.js +2 -0
- package/dist/core/shared/errors.d.ts +37 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/item-mutation-precondition.d.ts +70 -6
- package/dist/core/store/item-mutation-precondition.js +1 -1
- package/dist/core/store/item-store.js +1 -1
- package/dist/core/store/settings-validator.js +1 -1
- package/dist/core/store/settings.js +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
- package/dist/sdk/cli-contracts/completeness.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +11 -0
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-program.js +1 -1
- package/dist/sdk/config.d.ts +1 -1
- package/dist/sdk/config.js +1 -1
- package/dist/sdk/environment/project-runtime-compatibility.js +1 -1
- package/dist/sdk/errors.d.ts +6 -2
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/governance/validate.js +1 -1
- package/dist/sdk/history/salvage.js +3 -3
- package/dist/sdk/history-compact.d.ts +7 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-repair.d.ts +2 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/index.d.ts +4 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/lifecycle/checkpoint-rollback.d.ts +10 -2
- package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
- package/dist/sdk/lifecycle/claim.js +1 -1
- package/dist/sdk/lifecycle/close-many.d.ts +11 -2
- package/dist/sdk/lifecycle/close-many.js +1 -1
- package/dist/sdk/lifecycle/close.d.ts +15 -0
- package/dist/sdk/lifecycle/close.js +1 -1
- package/dist/sdk/lifecycle/core-field-recovery.d.ts +26 -0
- package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
- package/dist/sdk/lifecycle/create.js +1 -1
- package/dist/sdk/lifecycle/item-revision.d.ts +162 -0
- package/dist/sdk/lifecycle/item-revision.js +2 -0
- package/dist/sdk/lifecycle/restore.js +1 -1
- package/dist/sdk/lifecycle/start-blockers.d.ts +52 -0
- package/dist/sdk/lifecycle/start-blockers.js +2 -0
- package/dist/sdk/lifecycle/task-composition.d.ts +11 -0
- package/dist/sdk/lifecycle/task-composition.js +1 -1
- package/dist/sdk/lifecycle/update-many.d.ts +11 -2
- package/dist/sdk/lifecycle/update-many.js +1 -1
- package/dist/sdk/lifecycle/update.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/declared-blockers.d.ts +16 -0
- package/dist/sdk/query/declared-blockers.js +2 -0
- package/dist/sdk/query/get.d.ts +7 -0
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/projection-contracts.js +1 -1
- package/dist/sdk/runtime-input.d.ts +12 -0
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.d.ts +11 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/structured-mutations.js +1 -1
- package/dist/sdk/test/batch.js +2 -2
- package/dist/sdk/test/entry.d.ts +5 -0
- package/dist/sdk/test/entry.js +2 -2
- package/dist/sdk/test/execution.d.ts +1 -2
- package/dist/sdk/test/execution.js +2 -2
- package/dist/sdk/test/linked-command-detection.d.ts +10 -0
- package/dist/sdk/test/linked-command-detection.js +1 -1
- package/dist/sdk/test/update.d.ts +2 -0
- package/dist/sdk/test/update.js +1 -1
- package/dist/sdk/workspace-transaction.d.ts +17 -6
- package/dist/sdk/workspace-transaction.js +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js +1 -1
- package/docs/COMMANDS.md +91 -0
- package/docs/CONFIGURATION.md +1 -0
- package/docs/EXTENSIONS.md +2 -2
- package/docs/LINKED_TEST_EDITS.md +38 -5
- package/docs/SDK.md +185 -1
- package/docs/agent-task-token-baseline.json +1 -1
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +111 -111
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +15 -3
- package/marketplace.json +1 -1
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-3ZQQVJT2.js +0 -20
- package/dist/cli-bundle/chunks/chunk-4HW253W2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-4OELCF3O.js +0 -2
- package/dist/cli-bundle/chunks/chunk-BFZUJ5QP.js +0 -115
- package/dist/cli-bundle/chunks/chunk-DAZFCSDV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-EN27ZQSV.js +0 -2
- package/dist/cli-bundle/chunks/chunk-K46GDAKX.js +0 -6
- package/dist/cli-bundle/chunks/chunk-OJR2YGXF.js +0 -31
- package/dist/cli-bundle/chunks/chunk-QHHFXNSQ.js +0 -3
- package/dist/cli-bundle/chunks/chunk-ZNWDYDFF.js +0 -129
- package/dist/cli-bundle/chunks/item-transaction-JHPBH6N7.js +0 -2
- package/dist/cli-bundle/chunks/mutation-admission-QUNQZCZ5.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-RFMM5KZ6.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-6B6Q7M5L.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4NVPDZLX.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-4UUE3YXZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5UDDRPYR.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-AK2CI2GI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-EJJWOFP5.js +0 -91
- package/dist/cli-bundle/focused-chunks/chunk-FUGYXUUL.js +0 -80
- package/dist/cli-bundle/focused-chunks/chunk-HMXVTWIV.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-JLN5CFYM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-K4FMZB4Y.js +0 -23
- package/dist/cli-bundle/focused-chunks/chunk-PF553UVP.js +0 -44
- package/dist/cli-bundle/focused-chunks/chunk-RUCG6UWN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SGWYNU7T.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TGS5RXBY.js +0 -26
- package/dist/cli-bundle/focused-chunks/chunk-WD43E7RU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YM4AMP7H.js +0 -2
- package/dist/cli-bundle/focused-chunks/item-transaction-F4SN7TXJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/mutation-admission-7R2FXJ5O.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as li,n as pi,p as mi}from"./chunk-ODMJ3HIB.js";import{Vb as Ct}from"./chunk-5S6RT5LX.js";import{Aa as Za,Ba as ae,Ca as Me,Cb as si,Da as Qa,Db as hn,Ea as se,N as Ca,Va as ti,Wa as ni,Xa as $e,Xc as ci,Ya as ai,Za as ii,ca as Se,kb as ri,qb as oi,tb as Tt,ub as Ot,wa as Ya,xa as Re,xb as Pe,ya as at,za as Xa}from"./chunk-DSCFJTHB.js";import{Ai as Ha,Bc as Ce,Ci as fn,Da as xa,Di as Ka,Ea as Sa,Ei as Va,Fa as W,Fi as xe,G as ka,Gb as T,Li as ei,Na as F,Oa as Ea,Od as I,Oi as fe,Pa as $a,Pd as V,Qa as Ia,Qd as Ga,Qe as ee,Rb as Oa,Rd as K,Sd as Q,Tc as un,Uc as Fa,Ud as Ja,Ui as A,Vc as $t,Vi as Ee,Wd as nt,Xc as be,Yd as At,Zc as ke,ad as Ma,cc as ve,cd as It,d as xt,db as H,dd as Ua,e as ya,ea as Et,ed as za,ej as Ue,f as cn,fa as pn,fb as Aa,g as dn,ga as mn,gb as oe,h as ln,j as _a,jc as Ra,k as wa,kc as Pa,kf as qa,n as va,nc as Na,oc as Da,od as J,pf as q,rf as Wa,ub as Ta,wc as ja,x as ba,yc as La,zd as B,zi as Ba}from"./chunk-3OXQGGRD.js";import{f as di}from"./chunk-RSAN2YUU.js";import{A as h,C as u,E as k,F as St,G as we,H as M,K as ue,a as fa,d as kt,m as ha,t as on,v as ga,y as sn}from"./chunk-O4ZLEN4T.js";import{mkdir as Rs,readFile as Ps}from"node:fs/promises";import fi from"node:path";import{createHash as Ns}from"node:crypto";(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]="24a18484-0b8b-55d7-aa23-08a23b8d78ce")}catch{}})();var gn=class extends Error{constructor(t="Workspace transaction interrupted"){super(t),this.name="WorkspaceTransactionInterruptedError"}},hi="sdk-workspace-transaction",gi=/^[a-zA-Z0-9._-]+$/,yi=30,_i=3e3;function bn(e,t){if(typeof e!="string")throw new TypeError(`${t} must be a string`);let n=e.trim();if(!n||!gi.test(n))throw new TypeError(`${t} must match [a-zA-Z0-9._-]+`);return n}function yn(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 kn(e){return{pmRoot:yn(e.pmRoot,"Transaction pmRoot"),transactionId:bn(e.transactionId,"Transaction id"),author:yn(e.author,"Transaction author")}}function Pt(e,t,n){let a=e??t;if(!Number.isInteger(a)||a<=0)throw new TypeError(`${n} must be a positive integer`);return a}function wi(e,t){return fi.join(e,"transactions","sdk",`${t}.json`)}async function ce(e,t){t.updatedAt=T();let n=wi(e,t.transactionId);await Rs(fi.dirname(n),{recursive:!0}),await ue(n,`${JSON.stringify(t,null,2)}
|
|
2
2
|
`)}function Ds(e){return Number.isInteger(e.attempt)&&typeof e.author=="string"&&typeof e.createdAt=="string"&&typeof e.updatedAt=="string"&&js(e)}function js(e){let t=e.abandonment;return t===void 0?e.schemaVersion===1&&e.status!=="abandoned":e.schemaVersion!==2||t===null||typeof t!="object"||e.status==="committed"?!1:typeof t.reason=="string"&&t.reason.trim().length>0&&typeof t.author=="string"&&t.author.trim().length>0&&(t.supersededBy===void 0||typeof t.supersededBy=="string"&&gi.test(t.supersededBy)&&t.supersededBy!==e.transactionId)}function Ne(e){return Object.assign(Object.create(null),e)}function vi(e,t){try{let n=JSON.stringify(e,(a,i)=>{if(typeof i=="number"&&!Number.isFinite(i))throw new TypeError(`${t} contains a non-finite number`);if(i===void 0||typeof i=="function"||typeof i=="symbol")throw new TypeError(`${t} contains a non-JSON value`);return i});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:vi(e,t)}function wn(e,t,n,a){let i=_n(n,a);i===void 0?delete e[t]:e[t]=i}function ui(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function vn(e,t){return Array.isArray(e)&&new Set(e).size===e.length&&e.every(n=>typeof n=="string"&&t.includes(n))}function Ls(e,t){if(!vn(e.startedStepIds,t)||!vn(e.completedStepIds,t)||!ui(e.results)||!ui(e.compensationData))return!1;let n=e.startedStepIds,a=new Set(n),i=e.completedStepIds,r=new Set(i);return Object.keys(e.compensationData).some(o=>!a.has(o))||Object.keys(e.results).some(o=>!r.has(o))?!1:e.status==="committed"?t.every(o=>r.has(o)):!["compensated","abandoned"].includes(e.status??"")||r.size===0&&a.size===0}function Rt(e,t){return new u(`Workspace transaction ${e} journal is invalid (${t})`,h.CONFLICT,{code:"transaction_journal_invalid",required:"A valid durable journal is required before transaction recovery can continue.",why:"Corrupt journal data cannot establish which steps applied or still require compensation.",nextSteps:["Preserve the journal and inspect its integrity or restore a verified backup before retrying.","Do not switch to a new transaction id to bypass an unreadable journal; previously applied work may remain."]})}function bi(e){return new u(`Workspace transaction ${e} journal does not match the supplied plan`,h.CONFLICT,{code:"transaction_plan_mismatch",required:"Replay the original plan or safely abandon the interrupted transaction before replacing it.",why:"A journal records the plan it is resuming; applying a different plan under the same id could skip or duplicate steps.",nextSteps:["Re-run with the original document to resume or replay it.","For item batches use client.itemTransactions.status(transactionId), then client.itemTransactions.abandon(transactionId, { reason }) before committing a changed plan with a new transactionId.","Run pm ops gc --scope transactions --dry-run to inspect retention; active and explicitly abandoned journals remain protected."]})}function Fs(e,t,n){return n===void 0||e.abandonment!==void 0||e.status==="compensated"||t.length===n.length&&t.every((a,i)=>a===n[i])}function Ms(e,t,n){let a;try{a=JSON.parse(e)}catch{throw Rt(t,"invalid JSON")}if(!a||typeof a!="object"||Array.isArray(a))throw Rt(t,"expected an object");let i=a;if(!((i.schemaVersion===1||i.schemaVersion===2)&&i.transactionId===t))throw Rt(t,"schema version or transaction id does not match the journal file");let r=i.stepIds;if(!Array.isArray(r)||!vn(r,r)||!Ls(i,r)||!Ds(i)||typeof i.status!="string"||!["applying","compensating","compensated","committed","abandoned"].includes(i.status))throw Rt(t,"invalid lifecycle, metadata, status or step ids");if(!Fs(i,r,n))throw bi(t);return{...i,results:Ne(i.results),compensationData:Ne(i.compensationData)}}async function Us(e,t,n,a,i){let r=i,o=r!==void 0;if(r?.status==="compensating"&&await xn(e,r),r===void 0||r.status==="compensated"){let s=T();r={schemaVersion:1,transactionId:t,author:n,status:"applying",attempt:(r?.attempt??0)+1,createdAt:r?.createdAt??s,updatedAt:s,stepIds:a,startedStepIds:[],completedStepIds:[],results:Ne(),compensationData:Ne(),...e.recoveryData===void 0?{}:{recoveryData:vi(e.recoveryData,"Transaction recovery data")}},await ce(e.pmRoot,r),await he(e,r,"prepared")}return{journal:r,recovered:o}}async function zs(e,t,n){try{await Gs(t,e.steps),await ce(e.pmRoot,t);let a=new Set(t.completedStepIds),i=new Set(t.startedStepIds);for(let r of e.steps){if(a.has(r.id))continue;let o=await r.inspect(),s=_n(o.result,`Step ${r.id} result`);if(o.state!=="applied"){let c=await r.prepareCompensation?.();wn(t.compensationData,r.id,c,`Step ${r.id} compensation data`),i.add(r.id),t.startedStepIds=e.steps.map(l=>l.id).filter(l=>i.has(l)),await ce(e.pmRoot,t);let d=await r.apply();s=_n(d,`Step ${r.id} result`)}await he(e,t,"step_applied",r.id),a.add(r.id),t.completedStepIds=e.steps.map(c=>c.id).filter(c=>a.has(c)),wn(t.results,r.id,s,`Step ${r.id} result`),await ce(e.pmRoot,t),await he(e,t,"step_recorded",r.id)}return await he(e,t,"committing"),t.status="committed",await ce(e.pmRoot,t),await he(e,t,"committed"),{transactionId:t.transactionId,status:"committed",recovered:n,results:Ne(t.results)}}catch(a){if(a instanceof gn||t.status==="committed")throw a;try{await xn(e,t)}catch(i){throw new AggregateError([a,i],`Workspace transaction failed and compensation failed: ${String(i)}`,{cause:i})}throw a}}async function Nt(e,t,n){try{return Ms(await Ps(wi(e,t),"utf8"),t,n)}catch(a){if(a!==null&&typeof a=="object"&&"code"in a&&we(a))return;throw a}}async function he(e,t,n,a){await e.onTransition?.({transactionId:t.transactionId,attempt:t.attempt,transition:n,...a===void 0?{}:{stepId:a}})}async function Gs(e,t){let n=new Set,a=Ne();for(let i of t){let r=await i.inspect();r.state==="applied"&&(n.add(i.id),wn(a,i.id,r.result,`Step ${i.id} result`))}e.results=a,e.completedStepIds=t.map(i=>i.id).filter(i=>n.has(i))}async function xn(e,t){t.status="compensating",await ce(e.pmRoot,t),await he(e,t,"compensating");let n=new Set(t.completedStepIds),a=new Set(t.startedStepIds);for(let i of[...e.steps].reverse()){if(!a.has(i.id)&&!n.has(i.id))continue;let r;try{let o=(await i.inspect()).state;r=a.has(i.id)&&(o==="applied"||o==="pending"&&i.compensatePending===!0)}catch{r=a.has(i.id)}r&&(await he(e,t,"step_compensating",i.id),await i.compensate(t.compensationData[i.id])),n.delete(i.id),a.delete(i.id),t.completedStepIds=e.steps.map(o=>o.id).filter(o=>n.has(o)),t.startedStepIds=e.steps.map(o=>o.id).filter(o=>a.has(o)),delete t.results[i.id],delete t.compensationData[i.id],await ce(e.pmRoot,t),await he(e,t,"step_compensated",i.id)}t.status="compensated",await ce(e.pmRoot,t),await he(e,t,"compensated")}async function ki(e){let{pmRoot:t,transactionId:n,author:a}=kn(e),i=Pt(e.lockTtlSeconds,yi,"Transaction lock TTL"),r=Pt(e.lockWaitMs,_i,"Transaction lock wait"),o=[...e.steps];if(o.length===0)throw new TypeError("Workspace transaction requires at least one step");let s=o.map(l=>{let p=bn(l.id,"Transaction step id");if(p!==l.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:a,steps:o,lockTtlSeconds:i,lockWaitMs:r},d=await ee(t,hi,i,a,!1,!1,r);try{let l=await Nt(t,n,s);if(l?.status==="abandoned"||l?.abandonment!==void 0)throw xi(l);let p=l!==void 0;if(l?.status==="committed")return{transactionId:n,status:"committed",recovered:!0,results:Ne(l.results)};let m=await Us(c,n,a,s,l);return await zs(c,m.journal,p||m.recovered)}finally{await d()}}function xi(e){let t=e.status!=="abandoned",n=e.abandonment.supersededBy,a=n===void 0?`Retry abandonment without supersededBy to finish retirement of ${JSON.stringify(e.transactionId)}.`:`Retry abandonment with supersededBy ${JSON.stringify(n)} to finish retirement of ${JSON.stringify(e.transactionId)}.`;return new u(t?`Transaction ${e.transactionId} retirement is incomplete`:`Transaction ${e.transactionId} has been abandoned`,h.CONFLICT,{code:"transaction_abandoned",required:t?a:"Use a new transactionId for the replacement plan.",why:t?"Forward replay is fenced, but the recorded retirement has not finished. Preserve its replacement identity.":"An explicitly retired transaction identity cannot be resumed.",...t?{retirement:{state:"pending",superseded_by:n??null},nextSteps:[a]}:{}})}async function Nu(e,t){let n=kn({pmRoot:e,transactionId:t,author:"reader"});return Nt(n.pmRoot,n.transactionId)}function Js(e){return Ns("sha256").update(JSON.stringify(e.stepIds)).digest("hex")}async function Du(e){let t=kn(e),n=yn(e.reason,"Abandonment reason"),a=e.supersededBy===void 0?void 0:bn(e.supersededBy,"Replacement transaction id");if(a===t.transactionId)throw new TypeError("Replacement transaction id must differ from the abandoned id");let i=Pt(e.lockTtlSeconds,yi,"Transaction lock TTL"),r=Pt(e.lockWaitMs,_i,"Transaction lock wait"),o=await ee(t.pmRoot,hi,i,t.author,!1,!1,r);try{let s=await Nt(t.pmRoot,t.transactionId);if(s===void 0)throw new u(`Transaction ${t.transactionId} was not found`,h.NOT_FOUND);if(s.status==="committed")throw new u(`Transaction ${t.transactionId} is committed and cannot be abandoned`,h.CONFLICT,{code:"transaction_committed",required:"Plan a separate explicit corrective mutation.",why:"Recovery cannot silently undo committed work."});if(s.abandonment!==void 0&&s.abandonment.supersededBy!==a)throw xi(s);if(s.status==="abandoned")return s;let c=e.resolveSteps(structuredClone(s));if(JSON.stringify(c.map(d=>d.id))!==JSON.stringify(s.stepIds))throw bi(t.transactionId);if(s.abandonment===void 0){if(a!==void 0&&await Nt(t.pmRoot,a)!==void 0)throw new u(`Replacement transaction ${a} already exists`,h.CONFLICT);s.schemaVersion=2,s.abandonment={reason:n,author:t.author,...a===void 0?{}:{supersededBy:a}},await ce(t.pmRoot,s)}return s.status!=="compensated"&&await xn({...e,...t,steps:c},s),await qs(s,t.pmRoot,i,r),s.status="abandoned",await ce(t.pmRoot,s),s}finally{await o()}}async function qs(e,t,n,a){let i=Js(e);if((await Wa(Ha(t),Ba)).some(o=>o.op==="transaction_abandon"&&o.context?.transaction_id===e.transactionId&&o.context?.attempt===e.attempt&&o.context?.plan_digest===i))return;let r=e.abandonment;await Ka({pmRoot:t,author:r.author,lockTtlSeconds:n,lockWaitMs:a,op:"transaction_abandon",message:r.reason,context:{transaction_id:e.transactionId,attempt:e.attempt,plan_digest:i,...r.supersededBy===void 0?{}:{superseded_by:r.supersededBy}}})}import Ws from"node:fs/promises";import Bs 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]="7be00b26-4a56-5399-94f6-f2f67cc5c1e6")}catch{}})();function Sn(e){return Bs.join(e,"extension-migrations.json")}function Si(e,t){let n=e.definition.id;return typeof n=="string"&&n.trim().length>0?n.trim():`migration-${String(t+1).padStart(3,"0")}`}function Ei(e,t){return`${e.layer}:${e.name}:${t}`}async function Hs(e){let t=Sn(e);if(!await k(t))return{version:1,updated_at:"",entries:[]};let n=JSON.parse(await Ws.readFile(t,"utf8"));return{version:1,updated_at:typeof n.updated_at=="string"?n.updated_at:"",entries:Array.isArray(n.entries)?n.entries.filter(a=>typeof a?.key=="string"&&(a.status==="applied"||a.status==="failed")):[]}}async function Ks(e,t){let n=await Hs(e),a=new Map(n.entries.map(i=>[i.key,i]));return t.forEach((i,r)=>{let o=Si(i,r),s=a.get(Ei(i,o));s&&(i.definition.status=s.status,s.status==="failed"?i.definition.reason=s.error:(delete i.definition.reason,delete i.definition.error,delete i.definition.message))}),n}async function Vs(e){let t=await Ks(e.pmRoot,e.migrations),n=new Map(t.entries.map(l=>[l.key,l])),a=[],i=!1,r=e.migrations.map((l,p)=>({migration:l,index:p})).filter(({migration:l})=>e.scope===void 0||l.layer===e.scope);for(let{migration:l,index:p}of r){let m=Si(l,p),y=Ei(l,m),g=n.get(y),_=String(l.definition.status??"pending").toLowerCase(),f=g?.status??(_==="applied"||_==="failed"?_:"pending");if(f==="applied"){a.push({key:y,layer:l.layer,extension:l.name,id:m,before:f,outcome:"skipped"});continue}if(e.dryRun===!0){a.push({key:y,layer:l.layer,extension:l.name,id:m,before:f,outcome:"pending"});continue}let w=l.runtime_definition?.run??l.definition.run;if(typeof w!="function"){a.push({key:y,layer:l.layer,extension:l.name,id:m,before:f,outcome:"pending"});continue}let v=new Date().toISOString();try{await Promise.resolve(w({id:m,command:"migration",layer:l.layer,extension:l.name,pm_root:e.pmRoot,status:f}));let E={key:y,layer:l.layer,extension:l.name,id:m,status:"applied",attempted_at:v};n.set(y,E),l.definition.status="applied",delete l.definition.reason,delete l.definition.error,delete l.definition.message,a.push({key:y,layer:l.layer,extension:l.name,id:m,before:f,outcome:"applied"}),i=!0}catch(E){let S=E instanceof Error?E.message:String(E),C={key:y,layer:l.layer,extension:l.name,id:m,status:"failed",attempted_at:v,error:S};n.set(y,C),l.definition.status="failed",l.definition.reason=S,a.push({key:y,layer:l.layer,extension:l.name,id:m,before:f,outcome:"failed",error:S}),i=!0}}if(i){let l=await A(e.pmRoot),p={version:1,updated_at:new Date().toISOString(),entries:[...n.values()].sort((m,y)=>m.key.localeCompare(y.key))};await xe({pmRoot:e.pmRoot,filePath:Sn(e.pmRoot),raw:`${JSON.stringify(p,null,2)}
|
|
3
3
|
`,op:"extension_migrations_apply",author:e.author,lockTtlSeconds:l.locks.ttl_seconds,lockWaitMs:l.locks.wait_ms})}let o=a.filter(l=>l.outcome==="pending").length,s=a.filter(l=>l.outcome==="applied").length,c=a.filter(l=>l.outcome==="skipped").length,d=a.filter(l=>l.outcome==="failed").length;return{ok:d===0,dry_run:e.dryRun===!0,state_path:Sn(e.pmRoot),total:a.length,pending_count:o,applied_count:s,skipped_count:c,failed_count:d,migrations:a}}async function $i(e){let t=await A(e.resolvedRoots.settings_root),n=await be({pmRoot:e.resolvedRoots.pm_root,settings:t,cwd:process.cwd(),noExtensions:e.global.noExtensions===!0}),a=await ke(n);e.warnings.push(...n.warnings,...a.warnings);let i=await Vs({pmRoot:e.resolvedRoots.pm_root,migrations:a.registrations.migrations,author:typeof e.global.author=="string"&&e.global.author.trim().length>0?e.global.author.trim():"pm-extension-migration",dryRun:e.options.dryRun===!0,...e.scope==="global"?{scope:"global"}:{}});return e.withResult({migration:i,load_failure_count:n.failed.length,activation_failure_count:a.failed.length},i.ok)}(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]="184c43e0-a543-5b0b-ac09-9139ba5ded6a")}catch{}})();var Ys=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function ze(e,t={}){let n=new Set;t.extensionName!==void 0&&n.add(It(t.extensionName));for(let f of t.extensionNames??[])n.add(It(f));let a=f=>n.size===0||n.has(It(f)),i=(f,w)=>Ii(f.filter(v=>a(v.name)).map(w)),r=(f,w)=>Ii(f.filter(v=>a(v.name)).flatMap(w)),{registrations:o,commands:s,parsers:c,preflight:d,services:l,renderers:p,hooks:m}=e,y=r(o.relationship_kinds??[],f=>f.definitions.map(w=>w.kind)),g=p.overrides.filter(f=>a(f.name)&&((f.commands?.length??0)>0||f.resultDiscriminator!==void 0)).map(f=>({format:f.format,commands:[...f.commands??[]],result_discriminator:f.resultDiscriminator!==void 0})).sort((f,w)=>f.format.localeCompare(w.format)),_=i(o.assurance_providers??[],f=>f.definition.id);return{capabilities:Ua(e,t),commands:i(o.commands,f=>f.command),command_overrides:i(s.overrides,f=>f.command),command_handlers:i(s.handlers,f=>f.command),hooks:Ys.filter(([f])=>m[f].some(w=>a(w.name))).map(([,f])=>f),flag_commands:i(o.flags,f=>f.target_command),item_types:r(o.item_types,f=>f.types.map(w=>w.name)),item_fields:r(o.item_fields,f=>f.fields.map(w=>w.name)),...y.length>0?{relationship_kinds:y}:{},migrations:r(o.migrations,f=>typeof f.definition.id=="string"?[f.definition.id]:[]),profiles:i(o.profiles,f=>f.profile.name),importers:i(o.importers,f=>f.importer),exporters:i(o.exporters,f=>f.exporter),search_providers:i(o.search_providers,f=>f.definition.name),vector_store_adapters:i(o.vector_store_adapters,f=>f.definition.name),..._.length>0?{assurance_providers:_}:{},parser_overrides:i(c.overrides,f=>f.command),service_overrides:i(l.overrides,f=>f.service),renderer_overrides:i(p.overrides,f=>f.format),...g.length>0?{renderer_ownership:g}:{},preflight_overrides:d.overrides.filter(f=>a(f.name)).length,preflight_ownership:d.overrides.filter(f=>a(f.name)).map(f=>({commands:[...f.commands??[]]}))}}function Ii(e){return[...new Set(e)].sort((t,n)=>t.localeCompare(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]="caa9f916-c7ce-5e74-a00b-dd0fc6a41b5d")}catch{}})();var it={type:"string",minLength:1,maxLength:128,pattern:"\\S"},Dt={type:"array",minItems:1,maxItems:cn,items:it},Ai={...Dt,items:{...it,pattern:"^(?!(?:.*\\.)?(?:__proto__|constructor|prototype)(?:\\.|$))[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*){0,7}$"}},Xs={type:"object",additionalProperties:!1,required:["id","rule"],properties:{id:{type:"string",minLength:1,maxLength:128,pattern:"^[a-zA-Z0-9][a-zA-Z0-9._-]*$"},description:{type:"string",minLength:1,maxLength:500,pattern:"\\S"},effect:{enum:["advise","warn","refuse"]},subject:{type:"object",additionalProperties:!1,properties:{...Object.fromEntries(["types","tags","statuses","operations","parents"].map(e=>[e,Dt])),dependency:{type:"object",additionalProperties:!1,required:["kind"],properties:{kind:it,id:it}}}},rule:{oneOf:[{type:"object",additionalProperties:!1,required:["kind","fields"],properties:{kind:{const:"require_fields"},fields:Ai}},{type:"object",additionalProperties:!1,required:["kind","authors"],properties:{kind:{const:"authors"},authors:Dt}},...["field_writers","approval"].map(e=>({type:"object",additionalProperties:!1,required:["kind","fields","authors"],properties:{kind:{const:e},fields:Ai,authors:Dt}})),{type:"object",additionalProperties:!1,required:["kind","allowed"],properties:{kind:{const:"transition"},allowed:{type:"array",maxItems:cn,items:{type:"array",minItems:2,maxItems:2,items:it}}}}]}}},Hu={$schema:"https://json-schema.org/draft/2020-12/schema",title:"pm workflow policy registry",type:"object",additionalProperties:!1,required:["version","policies"],properties:{version:{const:1},enforcement:{enum:["advise","refuse"],default:"advise"},policies:{type:"array",maxItems:ya,items:Xs}}};(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]="808f3bb5-cca5-5f9c-b557-7923c79ae6ce")}catch{}})();async function Xu(e,t,n,a){let i=await $e(e).catch(()=>null);return i===null?{check:{name:"completeness",status:"error",ok:!1,details:{policy_registry_readable:!1,policy_registry_path:"schema/policies.json",remediation_hint:"Repair schema/policies.json, then rerun pm validate."}},warnings:["validate_completeness_policy_registry_unreadable"]}:Ti(i,t,n,a)}function Zs(e,t,n){return e===0?"undeclared":t===0?"empty":n===0?"inapplicable":n===t?"covered":"partial"}function Ti(e,t,n=5,a=!1){let i=[],r=new Map,o=e.policies.filter(f=>f.rule.kind==="require_fields"),s=o.filter(f=>f.subject?.operations===void 0),c=new Set,d=0,l=0,p=0,m=0,y=0,g=va(e);for(let f of t){let w=g({operation:"",author:"",before:f,after:f,completeness_only:!0});d+=+(w.decisions.length>0),l+=w.decisions.length,w.decisions.forEach(S=>c.add(S.policy_id));let v=w.decisions.filter(S=>!S.satisfied);if(v.length===0)continue;m+=1;let E=r.get(f.type)??{items:0,violations:0,missing_fields:0};E.items+=1;for(let S of v)p+=1,E.violations+=1,E.missing_fields+=S.missing_fields.length,S.effect==="refuse"&&(y+=1),i.length<n&&i.push({id:f.id,type:f.type,status:f.status,decision:S});r.set(f.type,E)}let _=a||y>0?"error":p>0?"warn":"ok";return{check:{name:"completeness",status:_,ok:_==="ok",details:{scope:"operation_independent_require_fields",declared_requirement_count:o.length,state_requirement_count:s.length,applicable_requirement_count:c.size,requirement_application_count:l,governed_items:d,ungoverned_items:t.length-d,contract_status:Zs(o.length,t.length,d),applied_policy_ids:[...c].sort().slice(0,Math.max(0,n)),applied_policy_ids_truncated:c.size>Math.max(0,n),checked_items:t.length,incomplete_items:m,violation_count:p,refused_violations:y,missing_by_type:Object.fromEntries(r),violations:i,violations_truncated:i.length<p,enforcement:e.enforcement}},warnings:[...p>0?[`validate_completeness_missing_fields:${p}`]:[],...a?["validate_completeness_source_incomplete"]:[]]}}import Qs 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]="0c3bed4d-4a17-5004-a1c5-65f6acec2a9b")}catch{}})();function ec(){return{version:1,enforcement:"advise",policies:[...[["Epic",["goal","objective","body"]],["Story",["description","value","acceptance_criteria"]],["Decision",["body","resolution"]],["Feature",["acceptance_criteria","expected_result"]],["Task",["description"]],["Issue",["repro_steps","expected_result"]],["Chore",["description"]]].map(([e,t])=>({id:`completeness-${e.toLowerCase()}`,effect:"advise",description:`Evidence expected when ${e} work reaches completion.`,subject:{types:[e],statuses:["closed"]},rule:{kind:"require_fields",fields:[...t]}})),{id:"completeness-resolution",effect:"advise",subject:{statuses:["closed"]},rule:{kind:"require_fields",fields:["resolution","expected_result","actual_result"]}}]}}function Ri(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{throw new u("Policy definition must be valid JSON.",h.USAGE)}if(typeof t!="object"||t===null||Array.isArray(t))throw new u("Policy definition must be an object.",h.USAGE);return t}async function tc(e,t){let n=F(process.cwd(),e.path);await Ue(n);let a=await A(n);return{pmRoot:n,settings:a,author:q(t,a.author_default)}}function Oi(e,t,n,a){if(e==="policy-mode")return ln({...n,enforcement:t});let i=n.policies.filter(s=>s.id!==t);if(e==="policy-remove")return{...n,policies:i};let r=dn(a.definition),o=ln({...n,policies:[...i,r].sort((s,c)=>s.id.localeCompare(c.id))});if(Buffer.byteLength(`${JSON.stringify(o,null,2)}
|
|
4
4
|
`)>ti)throw new u("Policy registry exceeds its byte ceiling.",h.USAGE);return o}async function Ci(e,t,n,a){if(n.dryRun)return{policy_result:!0,action:e,changed:!1,result:Oi(e,t,await $e(a.pmRoot),n)};let i=await Va({pmRoot:a.pmRoot,filePath:Qs.join(a.pmRoot,"schema","policies.json"),op:`schema:${e}`,author:a.author,message:n.message,lockTtlSeconds:a.settings.locks.ttl_seconds,lockWaitMs:a.settings.locks.wait_ms,mutate(r){let o=Oi(e,t,ni(r),n);return{raw:`${JSON.stringify(o,null,2)}
|
|
@@ -67,4 +67,4 @@ Agent guidance check
|
|
|
67
67
|
`),X.write(`Telemetry helps improve reliability and can be disabled anytime via pm config.
|
|
68
68
|
`);let c=t?"Y/n":"y/N",d=await n.question(`Enable telemetry for this project? [${c}] `),l=_s(d,t);return X.write(`
|
|
69
69
|
`),{prefix:i,preset:s,telemetry_enabled:l}}finally{n.close()}}function lu(e){return{presetFromOption:la(e.preset),useDefaults:e.defaults===!0,authorFromOption:fs(e.author),installBundledPackages:e.withPackages===!0,agentGuidanceMode:ys(e.agentGuidance),typePreset:us(e.typePreset)}}function pu(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 mu(e,t,n,a){if(t.length===0||n)return;let i=a.discovery==="ancestor";throw new u(`${i?`No tracker exists in ${a.requested_cwd}; pm init found an ancestor tracker at ${a.tracker_root}. `:""}Refusing to update existing tracker settings at ${e} without --force.`,h.USAGE,{code:"init_existing_settings_requires_force",type:"urn:pm-cli:error:init_existing_settings_requires_force",required:`--force for ${t.join(", ")}`,why:i?"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:a.tracker_root,requested_path:a.requested_cwd,suggested_path:a.suggested_current_tracker_root,examples:["pm init --yes","pm init ./sandbox-pm --yes",...i?['pm init <name> --yes --pm-path "$PWD/.agents/pm"']:[],"pm init acme --yes --force"],nextSteps:[...i?['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 uu(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&&(pa(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 fu(e){let t=await A(e.pmRoot);e.warnings.push(`already_exists:${e.settingsPath}`);let n=pu({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption});return mu(e.settingsPath,n,e.options.force===!0,e.target),uu({settings:t,normalizedPrefix:e.normalizedPrefix,prefixArg:e.prefixArg,presetFromOption:e.normalizedOptions.presetFromOption,authorFromOption:e.normalizedOptions.authorFromOption,warnings:e.warnings})&&await Ee(e.pmRoot,t),{settings:t,normalizedPrefix:e.normalizedPrefix,chosenPreset:e.normalizedOptions.presetFromOption,wizardUsed:!1}}async function hu(e){let t=e.normalizedPrefix,n=e.normalizedOptions.presetFromOption,a,i=!1;if(e.normalizedOptions.presetFromOption===void 0&&!e.normalizedOptions.useDefaults&&process.stdin.isTTY===!0&&process.stdout.isTTY===!0){let c=await Ss(t,sn.telemetry.enabled);t=c.prefix,n=c.preset,a=c.telemetry_enabled,i=!0}let r=n??"minimal",o=su();o.id_prefix=t,pa(o,r);let s=qa()?.trim()||void 0;return o.author_default=e.normalizedOptions.authorFromOption??s??"",a!==void 0&&(o.telemetry.enabled=a,o.telemetry.first_run_prompt_completed=!0),await Ee(e.pmRoot,o),{settings:o,normalizedPrefix:t,chosenPreset:n,wizardUsed:i}}async function ds(e){return e.settingsExists?await fu(e):await hu({pmRoot:e.pmRoot,normalizedPrefix:e.normalizedPrefix,normalizedOptions:e.normalizedOptions})}async function gu(e){let t=await cs({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 Ee(e.pmRoot,e.settings),{...t.summary,next_steps:t.next_steps}}async function yu(e,t){let n=[],a=[],i=await Ja(e,t.schema);for(let r of i.created_paths)n.push(r),a.push(...await B({path:r,scope:"project",op:"init:runtime_schema_file"}));return{createdDirs:n,warnings:a}}async function _u(e){if(e.typePreset===void 0)return;let t=await vs(e.pmRoot,e.settings,e.typePreset);return e.warnings.push(`registered_type_preset:${e.typePreset}`),e.warnings.push(...await B({path:t.file,scope:"project",op:"init:type_preset"})),t}async function wu(e){let t=W(e.settings,J()).folders.filter(a=>!on.includes(a)),n=await xs(e.pmRoot,t);e.createdDirs.push(...n.createdDirs),e.warnings.push(...n.warnings)}function vu(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 bu(e,t,n,a){if(!e)return;let i=await ta("all",{install:!0,project:!0},{...t,path:n});a.push(...i.warnings);let r=ws(i),o=r.packages.filter(s=>!s.ok).map(s=>s.alias);if(!r.installed_all||o.length>0)throw new u(`pm init --with-packages did not install all bundled packages successfully${o.length>0?`: ${o.join(", ")}`:"."}`,h.GENERIC_FAILURE);return r}function Es(e){let t=a=>oe([...e.target.mode==="workspace-discovery"?[]:["--pm-path",e.target.tracker_root],...a]),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 a of e.agentGuidanceNextSteps){let i=e.target.mode==="workspace-discovery"?a:a.replace(/\bpm (?=[a-z])/g,()=>`${t([])} `);n.includes(i)||n.push(i)}return n}async function $s(e,t,n,a=mi){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 i=await a({pmRoot:e,workspaceRoot:t});i.gitattributes.changed&&n.push(`updated:merge_fence:${i.gitattributes.path}`)}catch(i){if(!(i instanceof u))throw i;n.push(`merge_fence_skipped:install_failed:${i.context.code??"pm_error"}:${i.message}:run pm merge install after resolving the Git repository error`)}}async function ku(e,t,n,a){if(e==null||n==="status")return;let i=await di(e,{pmRoot:t});i.changed&&a.push(`updated:gitignore:${i.path}`)}async function ov(e,t,n={}){let a=t[ru],i=typeof a=="string"?a:process.cwd(),r=hs(i,t,e,n.workspace),o=r.pmRoot;e=gs(r.prefixArg,n.idPrefix);let s=lu(n);await ks(o,r.target.mode==="tracker-path",n.force===!0);let c=[],d=[],l=j.join(o,"settings.json"),p=await k(l),m;p&&(m=await ds({pmRoot:o,settingsPath:l,settingsExists:p,normalizedPrefix:Se(e),prefixArg:e,options:n,normalizedOptions:s,warnings:d,target:r.target}));let y=await xs(o,on);c.push(...y.createdDirs),d.push(...y.warnings),m??=await ds({pmRoot:o,settingsPath:l,settingsExists:p,normalizedPrefix:Se(e),prefixArg:e,options:n,normalizedOptions:s,warnings:d,target:r.target});let{settings:g}=m,_=vu(r.target),f=await li(_??j.dirname(o)),w=_??f,v=await gu({pmRoot:o,cwd:w??i,agentGuidanceMode:s.agentGuidanceMode,settings:g,warnings:d}),E=await yu(o,g);c.push(...E.createdDirs),d.push(...E.warnings);let S=await _u({pmRoot:o,settings:g,typePreset:s.typePreset,warnings:d});S&&(g=await A(o)),await wu({pmRoot:o,settings:g,createdDirs:c,warnings:d}),await ku(w,o,s.agentGuidanceMode,d),!p&&n.mergeFence!==!1&&s.agentGuidanceMode!=="status"&&await $s(o,f,d);let C=await bu(s.installBundledPackages,t,o,d),ne=Es({installBundledPackages:s.installBundledPackages,registeredTypePreset:S,agentGuidanceNextSteps:v.next_steps,target:r.target});return{ok:!0,path:o,target:r.target,settings:g,created_dirs:c,warnings:d,governance_preset:g.governance.preset,wizard_used:m.wizardUsed,...S?{registered_type_preset:S}:{},...C?{installed_packages:C}:{},next_steps:ne,agent_guidance:v}}export{gn as a,kn as b,ki as c,Nu as d,Js as e,Du as f,Sn as g,Hs as h,Ks as i,Vs as j,$i as k,Ul as l,ze as m,zi as n,qe as o,We as p,Gi as q,Fi as r,Ge as s,Je as t,Mi as u,Xs as v,Hu as w,Xu as x,Ti as y,ec as z,hf as A,Ki as B,Zi as C,Mc as D,Uc as E,yy as F,vy as G,by as H,yt as I,ky as J,xy as K,Sy as L,Ey as M,$y as N,Iy as O,Ay as P,Ty as Q,Oy as R,Cy as S,Ry as T,Py as U,Ny as V,Dy as W,jy as X,Ly as Y,Fy as Z,My as _,Uy as $,zy as aa,Gy as ba,Jy as ca,qy as da,Wy as ea,By as fa,Z as ga,b as ha,Cn as ia,ad as ja,le as ka,Lt as la,zc as ma,rt as na,Ft as oa,ur as pa,kr as qa,qn as ra,Dr as sa,dg as ta,ro as ua,cp as va,yo as wa,_o as xa,Yn as ya,Hr as za,Dl as Aa,xp as Ba,Vr as Ca,ta as Da,Yo as Ea,Nw as Fa,cs as Ga,ru as Ha,iv as Ia,rv as Ja,ov as Ka};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-6T2V3UIK.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as k,c as I,d as A,e as _,k as T,m as C}from"./chunk-
|
|
1
|
+
import{a as k,c as I,d as A,e as _,k as T,m as C}from"./chunk-BWAXA6S4.js";import{lb as b,mb as v,nb as R}from"./chunk-7RCI7AAA.js";import{Fc as w,kc as f,nc as g,oc as a}from"./chunk-5S6RT5LX.js";import{Xc as H,Y as D}from"./chunk-DSCFJTHB.js";import{Ph as x,Sh as m,Th as y,td as E}from"./chunk-3OXQGGRD.js";import{A as c,C as p}from"./chunk-O4ZLEN4T.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="631e56aa-4d7e-58b6-bbea-a0d320716b82")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="0bcdd63c-5fd3-585d-a6c5-9393029ef864")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="4dce4f19-071c-54a8-be0d-5975d9e3b34b")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f330a0c5-a967-5383-9c27-efa4a39e0f0d")}catch{}})();(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="a178bd8b-fc53-5633-84d5-621b61930581")}catch{}})();function O(t,e){if(typeof t!="string")return;let o=Number.parseInt(t,10);if(!/^\d+$/.test(t.trim())||!Number.isSafeInteger(o))throw new p(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return o}async function S(t,e,o){let r=f(o),n=Date.now(),i=await D(a(e,"ids")),l=i===void 0?void 0:H(i),d=O(e.allOver,"--all-over"),u=O(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new p("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let s=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((l!==void 0||d!==void 0||s!==void 0)&&typeof e.before=="string")throw new p("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(I(t,{ids:l,allOver:d,scope:s}),t!==void 0&&u!==void 0)throw new p("history-compact: --min-entries applies only in bulk mode (single-id mode compacts the named stream).",c.USAGE);if(t===void 0){let h=await A({ids:l,scope:s,allOver:d,minEntries:u,dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r),h.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let h=await k(t,{before:a(e,"before"),dryRun:e.dryRun===!0,author:a(e,"author"),message:a(e,"message"),force:!!e.force},r);m(h,r)}r.profile&&y(`profile:command=history-compact took_ms=${Date.now()-n}`)}async function N(t,e,o,r){let n=f(r),i=Date.now(),l=await C(t,e,{author:a(o,"author"),message:a(o,"message"),force:!!o.force},n);await w(n,l),m(l,n),n.profile&&y(`profile:command=restore took_ms=${Date.now()-i}`)}async function B(t,e){let o=f(e),r=await T({verify:a(t,"verify"),output:a(t,"output"),hashAlgorithm:a(t,"hashAlgorithm")},o);"format"in r?(E(r),o.quiet||x(`${JSON.stringify(r,null,2)}
|
|
2
2
|
`)):m(r,o),"ok"in r&&!r.ok&&(process.exitCode=c.GENERIC_FAILURE)}function Z(t,e){t.command(e?"attest":"history-attest",{hidden:!e}).summary("Export or verify history proof.").option("--verify <file>","Compare retained streams with a detached JSON proof").option("--output <file>","Create a proof file and return a compact receipt").option("--hash-algorithm <name>","Bundle digest algorithm: sha256 (default) or sha512").description("Export exact-byte history commitments, or verify an independently retained proof without tracker writes.").action(B),t.command("restore",{hidden:!e}).summary("Restore a version.").argument("<id>","Item id").argument("<target>","Restore target timestamp or version number").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership/lock override").description("Restore an item to an earlier timestamp or version.").action(N),t.command(e?"redact":"history-redact",{hidden:!e}).summary("Redact sensitive values.").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",g).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",g).option("--replacement <value>",'Replacement string (default: "[redacted]")').option("--dry-run","Preview redaction impact without writing item/history files").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the redaction marker entry").option("--force","Force ownership/lock override").description("Redact sensitive literals/patterns from an item history stream and recompute hashes.").action(async(o,r,n)=>{let i=f(n),l=Date.now(),d=Array.isArray(r.literal)?r.literal:void 0,u=Array.isArray(r.regex)?r.regex:void 0,s=await _(o,{literal:d,regex:u,replacement:a(r,"replacement"),dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force},i);s.changed&&!s.dry_run&&await w(i,s),m(s,i),i.profile&&y(`profile:command=history-redact took_ms=${Date.now()-l}`)}),t.command(e?"repair":"history-repair",{hidden:!e}).summary("Repair drift.").argument("[id]","Item id (omit with --all)").option("--salvage-tail","Recover invalid tail; requires verified prefix").option("--all","Scan every stream for drift and repair each drifted stream in one audited pass").option("--dry-run","Preview the re-anchor impact without writing the history file").option("--normalize-provenance","Remove invalid provenance; return aggregate-only evidence").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the repair marker entry").option("--force","Force ownership/lock override").description("Re-anchor a drifted item history chain (recompute hashes, reconcile with the on-disk item) and record an audit marker. Use --all to repair every drifted stream.").action(async(o,r,n)=>{let i=f(n),l=Date.now(),d=r.all===!0;v(o,d);let u={dryRun:r.dryRun===!0,author:a(r,"author"),message:a(r,"message"),force:!!r.force,normalizeProvenance:r.normalizeProvenance===!0,salvageTail:r.salvageTail===!0};if(d){let s=await R(u,i);m(s,i),s.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let s=await b(o,u,i);m(s,i)}i.profile&&y(`profile:command=history-repair took_ms=${Date.now()-l}`)}),t.command(e?"compact":"history-compact",{hidden:!e}).summary("Compact streams.").argument("[id]","Item id (omit when using a bulk selector)").option("--before <value>","Compact entries strictly before this version number or ISO timestamp (single-id mode only)").option("--ids <value>","Bulk IDs: comma/newline text, - stdin, or @path file").option("--all-over <n>","Bulk: compact every stream with more than N entries").option("--closed","Bulk: compact only closed (terminal) items' streams").option("--all-streams","Bulk: compact every history stream regardless of lifecycle state").option("--min-entries <n>","Bulk: skip streams with at most N entries (already compact; default 3)").option("--dry-run","Preview compaction impact without writing the history file").option("--author <value>","Mutation author").option("--message <value>","Audit history message for the compaction marker entry").option("--force","Force ownership/lock override").description("Compact item history streams into a synthetic baseline plus retained tail entries. Pass an item id for one stream, or a bulk selector (--ids/--all-over/--closed/--all-streams) to compact many.").action(S)}export{Z as a};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-7PGNAHNW.js.map
|