@unbrained/pm-cli 2026.8.9 → 2026.8.11
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 +142 -80
- package/dist/cli/commander-usage.js +94 -17
- package/dist/cli/error-guidance.d.ts +10 -0
- package/dist/cli/error-guidance.js +76 -25
- package/dist/cli/help-json-payload.js +51 -16
- package/dist/cli/main.js +11 -6
- package/dist/cli/register-assurance.d.ts +8 -0
- package/dist/cli/register-assurance.js +52 -0
- package/dist/cli/register-files-lookup.js +14 -3
- package/dist/cli/register-mutation.js +30 -9
- package/dist/cli/register-operations.js +16 -11
- package/dist/cli-bundle/bundle-manifest.json +163 -163
- package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-2OOU2AFH.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +33 -0
- package/dist/cli-bundle/chunks/chunk-A2SJGHSI.js +3 -0
- package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +13 -0
- package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +194 -0
- package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +2 -0
- package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-WMEZHCFI.js} +66 -60
- package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ZU34C3LH.js} +48 -48
- package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +5 -0
- package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-HAUXVUPY.js} +8 -8
- package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-NOCOOWQY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-23FTGO3W.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2DL3MRTD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-4H5IA6AV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-55BIB6DV.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +8 -0
- package/dist/cli-bundle/focused-chunks/chunk-BKPIY34S.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +31 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-E3KCL7AY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +153 -0
- package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-J5EKAIVD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-TL5M2PAY.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-UDAZWT25.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +17 -0
- package/dist/cli-bundle/main.js +13 -13
- 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 +41 -39
- 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 +1 -1
- 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 +2 -2
- package/dist/core/diagnostics/remediation.js +9 -9
- package/dist/core/fs/fs-utils.d.ts +10 -0
- package/dist/core/fs/fs-utils.js +16 -4
- package/dist/core/item/item-format.js +3 -32
- package/dist/core/schema/fields-file.d.ts +1 -2
- package/dist/core/schema/fields-file.js +4 -11
- package/dist/core/schema/runtime-schema.js +3 -10
- package/dist/core/schema/status-defs-file.d.ts +1 -2
- package/dist/core/schema/status-defs-file.js +4 -32
- package/dist/core/schema/status-token.d.ts +2 -0
- package/dist/core/schema/status-token.js +32 -0
- package/dist/core/schema/type-workflows.d.ts +1 -2
- package/dist/core/schema/type-workflows.js +4 -11
- package/dist/core/session/session-state.d.ts +47 -0
- package/dist/core/session/session-state.js +207 -6
- package/dist/core/shared/author.d.ts +8 -2
- package/dist/core/shared/author.js +85 -52
- package/dist/core/shared/errors.d.ts +12 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/text-normalization.d.ts +1 -1
- package/dist/core/shared/text-normalization.js +2 -2
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +52 -0
- package/dist/sdk/agent/command-suggestions.d.ts +4 -0
- package/dist/sdk/agent/command-suggestions.js +67 -0
- package/dist/sdk/agent/create-option-policy.d.ts +12 -0
- package/dist/sdk/agent/create-option-policy.js +32 -0
- package/dist/sdk/agent/item-addressing.d.ts +19 -0
- package/dist/sdk/agent/item-addressing.js +208 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
- package/dist/sdk/agent/refusal-reachability.js +72 -0
- package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
- package/dist/sdk/agent/subcommand-recovery.js +84 -0
- package/dist/sdk/cli-bootstrap.d.ts +9 -1
- package/dist/sdk/cli-bootstrap.js +25 -10
- package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
- package/dist/sdk/cli-contracts/completeness.js +13 -3
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +77 -21
- package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +6 -3
- package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +513 -0
- package/dist/sdk/cli-contracts/schemas/assurance-definition.js +251 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +96 -4
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +49 -6
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/completion.js +9 -3
- package/dist/sdk/config.js +9 -3
- package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
- package/dist/sdk/context/semantic-session-attribution.js +83 -0
- package/dist/sdk/context-intent-runtime.js +8 -5
- package/dist/sdk/context-signal-store.d.ts +34 -0
- package/dist/sdk/context-signal-store.js +24 -2
- package/dist/sdk/core-governance.d.ts +3 -1
- package/dist/sdk/core-governance.js +5 -3
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +2 -2
- package/dist/sdk/dependency-flag-validation.d.ts +15 -1
- package/dist/sdk/dependency-flag-validation.js +54 -2
- package/dist/sdk/error-code-catalog.d.ts +13 -0
- package/dist/sdk/error-code-catalog.js +35 -2
- package/dist/sdk/extension.js +18 -17
- package/dist/sdk/files.d.ts +11 -0
- package/dist/sdk/files.js +82 -24
- package/dist/sdk/generated-error-code-catalog.js +104 -13
- package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
- package/dist/sdk/governance/assurance-action-contracts.js +5 -0
- package/dist/sdk/governance/assurance-action.d.ts +70 -0
- package/dist/sdk/governance/assurance-action.js +198 -0
- package/dist/sdk/governance/assurance-limits.d.ts +7 -0
- package/dist/sdk/governance/assurance-limits.js +11 -0
- package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
- package/dist/sdk/governance/assurance-runtime.js +131 -0
- package/dist/sdk/governance/assurance.d.ts +432 -0
- package/dist/sdk/governance/assurance.js +689 -0
- package/dist/sdk/governance/health.js +14 -7
- package/dist/sdk/governance/provenance-health.d.ts +13 -0
- package/dist/sdk/governance/provenance-health.js +63 -17
- package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
- package/dist/sdk/governance/validate-item-reader.js +18 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +15 -6
- package/dist/sdk/graph/run.js +8 -3
- package/dist/sdk/index.d.ts +10 -1
- package/dist/sdk/index.js +12 -3
- package/dist/sdk/lifecycle/claim.js +18 -3
- package/dist/sdk/lifecycle/close.js +17 -14
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +62 -9
- package/dist/sdk/lifecycle/focus.js +13 -3
- package/dist/sdk/lifecycle/plan.js +8 -3
- package/dist/sdk/lifecycle/update-many.js +39 -27
- package/dist/sdk/lifecycle/update.d.ts +6 -1
- package/dist/sdk/lifecycle/update.js +47 -10
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +4 -0
- package/dist/sdk/merge/install.js +28 -16
- package/dist/sdk/merge/receipts.d.ts +3 -0
- package/dist/sdk/merge/receipts.js +81 -17
- package/dist/sdk/output-projection.js +24 -4
- package/dist/sdk/provenance.d.ts +38 -0
- package/dist/sdk/provenance.js +64 -2
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +24 -10
- package/dist/sdk/query/light-metadata.d.ts +3 -0
- package/dist/sdk/query/light-metadata.js +19 -0
- package/dist/sdk/runtime-extended-actions.js +22 -5
- package/dist/sdk/runtime-primitives.d.ts +2 -0
- package/dist/sdk/runtime-primitives.js +4 -2
- package/dist/sdk/runtime.d.ts +8 -1
- package/dist/sdk/runtime.js +37 -28
- package/dist/sdk/schema-migration.js +7 -9
- package/dist/sdk/similarity-scoring.d.ts +1 -2
- package/dist/sdk/similarity-scoring.js +4 -16
- package/dist/sdk/telemetry.js +7 -4
- package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
- package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
- package/dist/sdk/traceability/source-traceability.d.ts +102 -0
- package/dist/sdk/traceability/source-traceability.js +293 -0
- package/dist/sdk/workspace-snapshot.d.ts +4 -0
- package/dist/sdk/workspace-snapshot.js +24 -11
- package/dist/types.d.ts +8 -2
- package/dist/types.js +2 -2
- package/docs/AGENT_GUIDE.md +3 -1
- package/docs/ASSURANCE.md +132 -0
- package/docs/COMMANDS.md +8 -5
- package/docs/MERGE_SAFETY.md +7 -5
- package/docs/README.md +3 -5
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
- package/docs/RELEASING.md +9 -5
- package/docs/SDK.md +44 -8
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +43 -6
- package/docs/SDK_CONTEXT.md +97 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
- package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
- package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
- package/docs/TESTING.md +12 -9
- package/docs/agent-task-token-baseline.json +2 -2
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
- package/marketplace.json +2 -2
- package/package.json +7 -6
- 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/extensions/templates/index.ts +9 -3
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +1028 -48
- package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +0 -13
- package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +0 -3
- package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
- package/dist/cli-bundle/chunks/chunk-EF43KODO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
- package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
- package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +0 -5
- package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-C3GCHDSQ.js +0 -31
- package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VRXJSGIT.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +0 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as de,c as Ge,d as ue,f as qe,g as je,h as Ve}from"./chunk-IUNRVDAI.js";import{A as He,B as Be,C as Le,F as Ue,G as Y,H as Z,I as Q,P as ee,Q as te,S as oe,T as ie,U as ne,V as ae,ka as Pt,la as Ht,ma as Nt,na as $t,oa as Bt,pa as Lt,qa as Ut,ra as Gt,sa as qt,ta as re,v as Ee,va as le,w as X,wa as se,x as Fe,y as Me,z as Pe}from"./chunk-WMEZHCFI.js";import"./chunk-A2SJGHSI.js";import"./chunk-ZXOC6HG5.js";import"./chunk-QWRRFYK3.js";import{$ as W,Db as Ne,Gb as $e,R as _e,U as xe,_a as Oe,sa as Ce,ta as De,va as Re,wa as Ie,xa as Te}from"./chunk-2RA2YTHJ.js";import{$ as vt,A as K,M as it,N as nt,O as at,P as rt,Q as lt,R as st,S as dt,T as ut,U as ct,V as pt,W as ft,X as mt,Y as yt,Z as gt,_ as ht,aa as bt,ba as wt,ca as kt,da as St,ea as At,fa as _t,ga as xt,ha as Ct,ia as Dt,ja as Rt,ka as It,la as Tt,ma as Et,na as Ot,oa as Ft,pa as Mt}from"./chunk-ZU34C3LH.js";import{R as Se,i as j}from"./chunk-DSKYD4LG.js";import"./chunk-WYRZZ5ZE.js";import{B as c,D as f,Ig as ot,Ii as q,Li as we,Pd as B,Pk as ke,Qa as O,Tg as U,Xf as L,Zk as F,a as he,aa as E,bl as m,el as d,fa as ve,fl as l,gl as _,hl as M,kl as V,li as G,ll as z,mi as be,ml as J,ng as D,nl as Ae,rf as b,tf as p,uf as h,yl as w}from"./chunk-HC3GM6YY.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]="8bc9436f-c101-583d-ae42-02d51b5eb027")}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]="d79c73c8-07a5-5a39-aca5-4058264684d6")}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]="f439176a-7297-5235-b96a-3e393af8602b")}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]="51b91e68-4bd6-521d-926e-e3b03f4b4956")}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]="e8b566c3-db93-54d7-a917-38bf317cb575")}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]="d9bb2d77-9ea1-51f9-a186-a2c222a6fbb3")}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]="41658a2a-e730-5c0c-9783-70b30ee9b2fc")}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]="890d56e2-d85f-5d29-90b3-1d832210ea09")}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]="2fa91bad-9a89-5c42-8b0f-dbcd2728c563")}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]="13a390ed-dac6-51bc-aeee-17f601e73282")}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]="c916e9b2-d840-585e-b7e2-120b677c7498")}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]="f3dbfd7a-f028-5927-b62d-2f078389f06d")}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]="49eb11f2-6d0e-59e6-9b7d-3a1515229879")}catch{}})();var P={};he(P,{PROFILE_SUBCOMMANDS:()=>Pt,formatProfileApplyHuman:()=>qt,formatProfileLintHuman:()=>Gt,formatProfileListHuman:()=>Lt,formatProfileShowHuman:()=>Ut,runProfileApply:()=>Bt,runProfileLint:()=>$t,runProfileList:()=>Ht,runProfileShow:()=>Nt});(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]="faf8a076-fe77-5017-b570-a49e7031ee0d")}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]="bb095de1-0784-5659-9d73-91fd0a033c7d")}catch{}})();var H={};he(H,{SCHEMA_SUBCOMMANDS:()=>rt,_testOnlySchemaCommand:()=>Mt,buildInvalidTypeHint:()=>ot,ensureTypeFolderScaffold:()=>dt,formatSchemaAddFieldHuman:()=>Rt,formatSchemaAddStatusHuman:()=>At,formatSchemaAddTypeHuman:()=>kt,formatSchemaApplyPresetHuman:()=>Ot,formatSchemaEvolutionMigrationHuman:()=>at,formatSchemaInferTypesHuman:()=>Ft,formatSchemaListFieldsHuman:()=>Tt,formatSchemaListHuman:()=>xt,formatSchemaRemoveFieldHuman:()=>It,formatSchemaRemoveStatusHuman:()=>_t,formatSchemaRemoveTypeHuman:()=>St,formatSchemaShowFieldHuman:()=>Et,formatSchemaShowHuman:()=>Ct,formatSchemaShowStatusHuman:()=>Dt,planSchemaEvolutionMigration:()=>it,runSchemaAddField:()=>yt,runSchemaAddStatus:()=>ut,runSchemaAddType:()=>lt,runSchemaApplyPreset:()=>bt,runSchemaEvolutionMigration:()=>nt,runSchemaInferTypes:()=>wt,runSchemaList:()=>pt,runSchemaListFields:()=>ht,runSchemaRemoveField:()=>gt,runSchemaRemoveStatus:()=>ct,runSchemaRemoveType:()=>st,runSchemaShow:()=>ft,runSchemaShowField:()=>vt,runSchemaShowStatus:()=>mt});(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]="926afd8a-6d7c-503f-a82f-0ef1f4d66c85")}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]="8052e529-7849-58b1-8ff2-94be44af3ca9")}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]="e6b32b75-4618-5270-a79a-8564e97c7f3b")}catch{}})();async function ce(t){t.description==="-"&&(t.description=await D().resolveValue("-","--description")??"")}(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]="94fe3b7b-3aeb-5a31-a3a5-d85ae7e1ac83")}catch{}})();async function jt(t,e){let o=m(e),i=await D().resolveValue("-","--stdin-json");if(i===void 0||i.trim().length===0)throw new f("pm item mutate requires a non-empty JSON batch on stdin.",c.USAGE);let n=typeof t.transactionId=="string"?t.transactionId.trim():"";if(n.length===0)throw new f("pm item mutate requires --transaction-id <value>.",c.USAGE);let r=O(process.cwd(),o.path),a=await U(r),s=Ge(i,{transactionId:n,idPrefix:a.id_prefix}),{mutations:u,references:y}=s,v=de(t);if(t.dryRun===!0){p({transaction_id:n,dry_run:!0,mutation_count:u.length,mutations:u,references:y},o);return}let k=await qe({pmRoot:r,transactionId:n,author:B(typeof t.author=="string"?t.author:o.author,a.author_default),mutations:u,...v});p({...k,mutation_count:u.length,references:y},o)}function Vt(t,e){return typeof t=="string"&&t.trim().length>0?t.trim():typeof e=="string"?e.trim():""}async function zt(t,e,o,i){let n=m(i),r=typeof o.transactionId=="string"?o.transactionId.trim():"";if(r.length===0)throw new f("pm item complete requires --transaction-id <value>.",c.USAGE);let a=Vt(e,o.reason);if(a.length===0)throw new f("pm item complete requires a close reason.",c.USAGE);let u=Object.fromEntries(["file","doc","test","comment","note","learning"].filter(A=>o[A]!==void 0).map(A=>[A,o[A]])),y=o.force===!0,{lockTtlSeconds:v,lockWaitMs:k}=de(o),g={...typeof o.resolution=="string"?{resolution:o.resolution}:{},...typeof o.expectedResult=="string"?{expectedResult:o.expectedResult}:{},...typeof o.actualResult=="string"?{actualResult:o.actualResult}:{},...typeof o.completedAt=="string"?{completedAt:o.completedAt}:{},...typeof o.validateClose=="string"?{validateClose:o.validateClose}:{},...y?{force:!0}:{}},R={id:t,reason:a,...Object.keys(u).length===0?{}:{evidence:u},...Object.keys(g).length===0?{}:{closeOptions:g},...y?{releaseOptions:{force:!0}}:{}};if(o.dryRun===!0){let A=je(R);p({transaction_id:r,dry_run:!0,mutation_count:A.length,mutations:A},n);return}let S=O(process.cwd(),n.path),I=await Ve({pmRoot:S,transactionId:r,author:B(typeof o.author=="string"?o.author:n.author,(await U(S)).author_default),...R,lockTtlSeconds:v,lockWaitMs:k});p({...I,mutation_count:Object.keys(I.results).length},n)}function ze(t){let e=t.commands.find(o=>o.name()==="item")??t.command("item").description("Run item lifecycle and mutation operations.");e.command("mutate").requiredOption("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch").option("--stdin-json","Read the JSON mutation array from stdin",!0).option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply create/update/close/release mutations atomically through the public pm SDK.").action(jt),e.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",d).option("--doc <value>","Linked documentation evidence",d).option("--test <value>","Linked test evidence",d).option("--comment <value>","Evidence comment",d).option("--note <value>","Completion note",d).option("--learning <value>","Durable completion learning",d).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Record evidence, close the item, and release its claim atomically.").action(zt)}(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]="50a7ce23-2abf-5240-b426-b73cb704e329")}catch{}})();async function Jt(t,e){let o=m(e),i=Array.isArray(t.event)?t.event:[],n=_e(i,t.allActionable===!0),r=await xe(O(process.cwd(),o.path),{events:n.events,all_actionable:n.all_actionable,attributed_author:l(t,"attributedAuthor"),reviewer:l(t,"reviewer"),reason:l(t,"reason")});p(r,o)}function Je(t){t.command("history-author-acknowledge").option("--event <item-id:line>","Unknown-author event coordinate (repeatable)",d).option("--all-actionable","Select all actionable events").requiredOption("--attributed-author <value>","Reviewed principal attribution").requiredOption("--reviewer <value>","Disposition reviewer").requiredOption("--reason <value>","Review evidence").description("Append audited dispositions for immutable unknown-author events.").action(Jt)}(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]="d436d524-7827-5ca7-8542-dd579813fae1")}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]="2d8a7e66-16e7-552f-b6d8-4cfbfb519a30")}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]="6bbab815-17b8-5f27-8842-41d6132488b2")}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]="8166a37c-7673-5ad4-a042-28ca34d65aa4")}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]="0977d72e-6e4d-5ece-bfaf-eb24a4e9982c")}catch{}})();function Kt(t,e){let o=typeof e.edit=="number"?e.edit:void 0,i=typeof e.delete=="number"?e.delete:void 0,n=l(e,"add")??l(e,"body")??l(e,"comment"),r=typeof t=="string"?t:void 0,a=e.stdin===!0,s=l(e,"file");if(+(n!==void 0)+ +(r!==void 0)+Number(a)+ +(s!==void 0)>1)throw n!==void 0&&r!==void 0&&!a&&s===void 0?new f("Specify comment text either as positional [text] or with --add, not both",c.USAGE):new f("Specify comment text with exactly one source: positional [text], --add, --stdin, or --file",c.USAGE);let y=n??r;return{add:y,readFromStdin:a,readFromFile:s,editIndex:o,deleteIndex:i,isMutation:typeof y=="string"||a||s!==void 0||o!==void 0||i!==void 0}}function Ke(t,e,o){let i=l(o,"add"),n=typeof e=="string"?e:void 0;if(i!==void 0&&n!==void 0)throw new f(`Specify ${t} text either as positional [text] or with --add, not both`,c.USAGE);return i??n}async function Wt(t,e,o,i){let n=m(i),r=Date.now(),a=Kt(e,o),s=await Me(t,{add:a.add,stdin:a.readFromStdin,file:a.readFromFile,edit:a.editIndex,delete:a.deleteIndex,limit:l(o,"limit"),fullHistory:o.fullHistory===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);a.isMutation&&await w(n,s),pe("comments",s,n,r)}async function Xt(t,e,o,i){let n=m(i),r=Date.now(),a=Ke("note",e,o),s=await He(t,{add:a,addJson:l(o,"addJson"),stdin:o.stdin===!0,file:l(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:l(o,"limit"),since:l(o,"since"),eventType:l(o,"eventType"),includeMeta:o.includeMeta===!0,fullHistory:o.fullHistory===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||typeof o.addJson=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await w(n,s),pe("notes",s,n,r)}async function Yt(t,e,o,i){let n=m(i),r=Date.now(),a=Ke("learning",e,o),s=await Pe(t,{add:a,stdin:o.stdin===!0,file:l(o,"file"),edit:typeof o.edit=="number"?o.edit:void 0,delete:typeof o.delete=="number"?o.delete:void 0,limit:l(o,"limit"),fullHistory:o.fullHistory===!0,author:l(o,"author"),message:l(o,"message"),ownershipAppendBypass:o.ownershipAppendBypass===!0,force:!!o.force},n);(typeof a=="string"||o.stdin===!0||typeof o.file=="string"||typeof o.edit=="number"||typeof o.delete=="number")&&await w(n,s),pe("learnings",s,n,r)}function pe(t,e,o,i){p(e,o),o.profile&&h(`profile:command=${t} took_ms=${Date.now()-i}`)}function We(t,e){let o=t.command("comments").argument("<id>","Item id").argument("[text]","Optional comment text shorthand (equivalent to --add)").option("--add <text>","Add one comment entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read comment text from stdin (supports multiline markdown)").option("--file <path>","Read comment text from file (supports multiline markdown)").option("--edit <index>","Replace the comment at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the comment at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n comments").option("--full-history","Return the complete post-mutation comment history instead of a bounded receipt").option("--author [value]","Comment author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete comments for an item.").action(Wt);_(o,"--body <text>","Alias for --add",!1),_(o,"--comment <text>","Alias for --add",!1),t.command("notes").argument("<id>","Item id").argument("[text]","Optional note text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add a text note (- reads stdin)").option("--add-json <json>","Append a merge-safe JSON event").option("--stdin","Read note text from stdin").option("--file <path>","Read note text from a UTF-8 file").option("--edit <index>","Replace a 1-based note using the selected text input",e("--edit")).option("--delete <index>","Delete the note at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n notes").option("--since <timestamp>","Filter JSON events from this ISO time").option("--event-type <value>","Filter JSON events by top-level type").option("--include-meta","Include count and truncation metadata").option("--full-history","Return the complete post-mutation note history instead of a bounded receipt").option("--author [value]","Author; defaults to PM_AUTHOR/settings").option("--message <value>","History message").option("--force","Force ownership override").description("Manage merge-safe text notes and JSON context events.").action(Xt),t.command("learnings").argument("<id>","Item id").argument("[text]","Optional learning text shorthand (equivalent to --add; use - for stdin)").option("--add <text>","Add one learning entry (plain text fallback, text=<value>, markdown pairs, or - for stdin; CSV-like key fragments are preserved as plain text unless text is explicit)").option("--stdin","Read learning text from stdin (supports multiline markdown)").option("--file <path>","Read learning text from file (supports multiline markdown)").option("--edit <index>","Replace the learning at 1-based <index> (replacement text from positional [text], --add, --stdin, or --file)",e("--edit")).option("--delete <index>","Delete the learning at 1-based <index>",e("--delete")).option("--limit <n>","Return only latest n learnings").option("--full-history","Return the complete post-mutation learning history instead of a bounded receipt").option("--author [value]","Learning author (optional; falls back to PM_AUTHOR/settings)").option("--message <value>","History message").option("--force","Force ownership override").description("List, add, edit, or delete learnings for an item.").action(Yt)}(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]="452f6689-f5bd-5398-915b-52ce7e2fd55e")}catch{}})();function fe(t,e){return o=>{let i=Number(o);if(!Number.isInteger(i)||i<e)throw new f(`${t} must be an integer greater than or equal to ${e}.`,c.USAGE);return i}}async function Zt(t,e,o){let i=m(o);if(e.scope!==void 0&&e.scope!=="project"&&e.scope!=="global")throw new f("--scope must be either project or global.",c.USAGE);let n=await Ie({paths:t,scope:e.scope,limit:typeof e.limit=="number"?e.limit:void 0,offset:typeof e.offset=="number"?e.offset:void 0,noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:typeof e.lines=="string"?De(e.lines):void 0,decisionDepth:typeof e.decisionDepth=="number"?e.decisionDepth:void 0},i);p(n,i)}function Xe(t){t.command("lookup").argument("<paths...>","Project-relative or absolute source paths").option("--scope <scope>","Restrict links to project or global scope").option("--limit <n>","Maximum referencing items to return",fe("--limit",1)).option("--offset <n>","Number of referencing items to skip",fe("--offset",0)).option("--no-truncate","Return every referencing item").option("--strict-read","Fail when any authoritative item cannot be read").option("--explain","Include ranked source-to-work rationale").option("--lines <start:end>","Attribute an inclusive source line range").option("--decision-depth <n>","Maximum governing-decision relationship depth",fe("--decision-depth",1)).description("Find and explain pm items that govern requested source paths.").action(Zt)}(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]="af464386-4cc8-5110-b0b6-9f63224baa8e")}catch{}})();var Qt=["add-","apply-","list-","remove-","show-"],eo=new Set(["field","fields","help","status","statuses","type","types"]);function me(t){let e=t.trim().toLowerCase();return e.length===0?!1:eo.has(e)||Qt.some(o=>e.startsWith(o))}function $(t){if(t!=null){if(typeof t=="number"){if(!Number.isInteger(t))throw new f("--order must be a finite integer.",c.USAGE);return t}if(typeof t=="string"){if(t.trim().length===0)return;let e=Number(t);if(!Number.isInteger(e))throw new f("--order must be a finite integer.",c.USAGE);return e}throw new f("--order must be a finite integer.",c.USAGE)}}(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]="6c7d647c-e489-51e3-b84b-5b62b4114033")}catch{}})();var to=new Set(ve.map(t=>t.toLowerCase())),oo=new Set(ke.map(t=>t==="estimate"?"estimatedMinutes":t));function io(t,e){let o=e.normalizedSubcommand;return o!=="rename-type"&&o!=="rename-field"&&o!=="remap-status"?null:t.runSchemaEvolutionMigration({kind:o,from:e.typeName,to:l(e.options,"to"),...o==="rename-field"&&typeof e.options.type=="string"?{type:e.options.type}:{}},{migrationId:l(e.options,"migrationId")??l(e.options,"migration_id"),dryRun:e.options.dryRun===!0,author:e.author,force:e.force},e.globalOptions)}function no(t,e){let{normalizedSubcommand:o,typeName:i,globalOptions:n,author:r,force:a}=e;switch(o){case"list":return t.runSchemaList(n);case"show":return t.runSchemaShow(i,n);case"show-status":return t.runSchemaShowStatus(i,n);case"list-fields":return t.runSchemaListFields(n);case"show-field":return t.runSchemaShowField(i,n);case"remove-type":return t.runSchemaRemoveType(i,{author:r,force:a},n);case"remove-field":return t.runSchemaRemoveField(i,{author:r,force:a},n);case"remove-status":return t.runSchemaRemoveStatus(i,{author:r,force:a},n);case"apply-preset":return t.runSchemaApplyPreset(i,{author:r,force:a},n);default:return null}}async function ao(t,e){let{normalizedSubcommand:o,typeName:i,options:n,globalOptions:r}=e,{author:a,force:s,description:u}=e,y=io(t,e);if(y)return y;let v=no(t,e);if(v)return v;switch(o){case"add-field":return t.runSchemaAddField(i,{type:typeof n.type=="string"?n.type:void 0,commands:e.commands,description:u,cliFlag:typeof n.cliFlag=="string"?n.cliFlag:void 0,alias:e.aliases,required:!!n.required,requiredOnCreate:!!n.requiredOnCreate,allowUnset:n.allowUnset!==!1,requiredTypes:e.requiredTypes,author:a,force:s},r);case"add-status":return t.runSchemaAddStatus(i,{role:e.roles,alias:e.aliases,description:u,order:e.order,author:a,force:s},r);default:return n.infer===!0?t.runSchemaInferTypes({minCount:e.minCount,apply:!!n.apply,author:a,force:s},r):t.runSchemaAddType(i,{description:u,defaultStatus:e.defaultStatus,folder:typeof n.folder=="string"?n.folder:void 0,alias:e.aliases,author:a,force:s},r)}}function ro(t,e){if("migration_id"in e){b(`${t.formatSchemaEvolutionMigrationHuman(e)}
|
|
2
|
+
`);return}switch(e.action){case"list":b(`${t.formatSchemaListHuman(e)}
|
|
3
|
+
`);return;case"show":b(`${t.formatSchemaShowHuman(e)}
|
|
4
|
+
`);return;case"show-status":b(`${t.formatSchemaShowStatusHuman(e)}
|
|
5
|
+
`);return;case"list-fields":b(`${t.formatSchemaListFieldsHuman(e)}
|
|
6
|
+
`);return;case"show-field":b(`${t.formatSchemaShowFieldHuman(e)}
|
|
7
|
+
`);return;case"remove-type":b(`${t.formatSchemaRemoveTypeHuman(e)}
|
|
8
|
+
`);break;case"remove-field":b(`${t.formatSchemaRemoveFieldHuman(e)}
|
|
9
|
+
`);break;case"apply-preset":b(`${t.formatSchemaApplyPresetHuman(e)}
|
|
10
|
+
`);break;case"infer-types":b(`${t.formatSchemaInferTypesHuman(e)}
|
|
11
|
+
`);break;case"add-field":b(`${t.formatSchemaAddFieldHuman(e)}
|
|
12
|
+
`);break;case"add-status":b(`${t.formatSchemaAddStatusHuman(e)}
|
|
13
|
+
`);break;case"remove-status":b(`${t.formatSchemaRemoveStatusHuman(e)}
|
|
14
|
+
`);break;default:b(`${t.formatSchemaAddTypeHuman(e)}
|
|
15
|
+
`);break}e.warnings.length>0&&h(`schema ${e.action} warnings: ${V(e.warnings)}`)}async function lo(t,e,o,i,n){switch(e){case"list":return t.runProfileList();case"show":return t.runProfileShow(o);case"lint":return t.runProfileLint(o);default:return t.runProfileApply(o,{dryRun:i.dryRun===!0,author:typeof i.author=="string"?i.author:void 0,force:i.force===!0},n)}}function so(t,e){switch(e.action){case"list":b(`${t.formatProfileListHuman(e)}
|
|
16
|
+
`);return;case"show":b(`${t.formatProfileShowHuman(e)}
|
|
17
|
+
`);return;case"lint":b(`${t.formatProfileLintHuman(e)}
|
|
18
|
+
`);return;default:b(`${t.formatProfileApplyHuman(e)}
|
|
19
|
+
`),e.warnings.length>0&&h(`profile apply warnings: ${V(e.warnings)}`);break}}function uo(t){return e=>{let o=Number(e);if(!Number.isInteger(o)||o<1)throw new f(`${t} must be a positive integer (1-based index).`,c.USAGE);return o}}function Ye(t,e){t.option("--filter-has-notes",`Select only items that have notes before ${e}`).option("--filter-no-notes",`Select only items that have no notes before ${e}`).option("--filter-has-learnings",`Select only items that have learnings before ${e}`).option("--filter-no-learnings",`Select only items that have no learnings before ${e}`).option("--filter-has-files",`Select only items that have linked files before ${e}`).option("--filter-no-files",`Select only items that have no linked files before ${e}`).option("--filter-has-docs",`Select only items that have linked docs before ${e}`).option("--filter-no-docs",`Select only items that have no linked docs before ${e}`).option("--filter-has-tests",`Select only items that have linked tests before ${e}`).option("--filter-no-tests",`Select only items that have no linked tests before ${e}`).option("--filter-has-comments",`Select only items that have comments before ${e}`).option("--filter-no-comments",`Select only items that have no comments before ${e}`).option("--filter-has-deps",`Select only items that have dependencies before ${e}`).option("--filter-no-deps",`Select only items that have no dependencies before ${e}`).option("--filter-has-body",`Select only items that have a non-empty body before ${e}`).option("--filter-empty-body",`Select only items with an empty body before ${e}`).option("--filter-has-linked-command",`Select only items whose linked tests carry a runnable command before ${e}`).option("--filter-no-linked-command",`Select only items whose linked tests carry no runnable command before ${e}`).option("--filter-reviewer-missing",`Select only items missing reviewer before ${e}`).option("--filter-risk-missing",`Select only items missing risk before ${e}`).option("--filter-confidence-missing",`Select only items missing confidence before ${e}`).option("--filter-sprint-missing",`Select only items missing sprint before ${e}`).option("--filter-release-missing",`Select only items missing release before ${e}`)}var co=[["filterHasNotes","filterNoNotes","--filter-has-notes","--filter-no-notes"],["filterHasLearnings","filterNoLearnings","--filter-has-learnings","--filter-no-learnings"],["filterHasFiles","filterNoFiles","--filter-has-files","--filter-no-files"],["filterHasDocs","filterNoDocs","--filter-has-docs","--filter-no-docs"],["filterHasTests","filterNoTests","--filter-has-tests","--filter-no-tests"],["filterHasComments","filterNoComments","--filter-has-comments","--filter-no-comments"],["filterHasDeps","filterNoDeps","--filter-has-deps","--filter-no-deps"],["filterHasBody","filterEmptyBody","--filter-has-body","--filter-empty-body"],["filterHasLinkedCommand","filterNoLinkedCommand","--filter-has-linked-command","--filter-no-linked-command"]];function et(t){let e=o=>t[o]===!0?!0:void 0;for(let[o,i,n,r]of co)if(t[o]===!0&&t[i]===!0)throw new f(`Cannot combine ${n} with ${r} for the same field.`,c.USAGE);return{filterReviewerMissing:e("filterReviewerMissing"),filterRiskMissing:e("filterRiskMissing"),filterConfidenceMissing:e("filterConfidenceMissing"),filterSprintMissing:e("filterSprintMissing"),filterReleaseMissing:e("filterReleaseMissing"),hasNotes:e("filterHasNotes"),hasLearnings:e("filterHasLearnings"),hasFiles:e("filterHasFiles"),hasDocs:e("filterHasDocs"),hasTests:e("filterHasTests"),hasComments:e("filterHasComments"),hasDeps:e("filterHasDeps"),hasBody:e("filterHasBody"),hasLinkedCommand:e("filterHasLinkedCommand"),noNotes:e("filterNoNotes"),noLearnings:e("filterNoLearnings"),noFiles:e("filterNoFiles"),noDocs:e("filterNoDocs"),noTests:e("filterNoTests"),noComments:e("filterNoComments"),noDeps:e("filterNoDeps"),emptyBody:e("filterEmptyBody"),noLinkedCommand:e("filterNoLinkedCommand")}}function ye(t,e){for(let o of e){let i=[],n=t.args,r=a=>(t.args!==n&&(i.length=0,n=t.args),i.push(a),i);o.required?t.requiredOption(o.option,o.description):o.repeatable?t.option(o.option,o.description,r):t.option(o.option,o.description);for(let a of o.aliasOptions??[])G(o.option,a.option)?_(t,a.option,a.description,o.repeatable===!0,o.repeatable?r:void 0):o.repeatable?t.option(a.option,a.description,r):t.option(a.option,a.description)}}function po(t){let e=o=>typeof t[o]=="string"?t[o]:void 0;return{type:e("filterType"),tag:e("filterTag"),priority:e("filterPriority"),deadlineBefore:e("filterDeadlineBefore"),deadlineAfter:e("filterDeadlineAfter"),updatedAfter:e("filterUpdatedAfter"),updatedBefore:e("filterUpdatedBefore"),createdAfter:e("filterCreatedAfter"),createdBefore:e("filterCreatedBefore"),ids:e("ids"),assignee:e("filterAssignee"),assigneeFilter:e("filterAssigneeFilter")??e("filterAssignee_filter"),parent:e("filterParent"),sprint:e("filterSprint"),release:e("filterRelease"),filterAcMissing:t.filterAcMissing===!0?!0:void 0,filterEstimatesMissing:t.filterEstimatesMissing===!0||t.filterEstimateMissing===!0?!0:void 0,filterResolutionMissing:t.filterResolutionMissing===!0?!0:void 0,filterMetadataMissing:t.filterMetadataMissing===!0?!0:void 0,...et(t),limit:e("limit"),offset:e("offset"),includeBody:!0}}function T(...t){for(let e of t)if(typeof e=="string")return e}function ge(t){if(Array.isArray(t))return t;if(typeof t=="string")return[t]}function fo(t,e,o){return typeof e=="string"&&e.length>0?{positionalType:t,positionalTitle:e}:typeof t!="string"||t.length===0?{positionalType:void 0,positionalTitle:void 0}:typeof o.title=="string"&&o.title.trim().length>0&&o.type===void 0?{positionalType:t,positionalTitle:void 0}:{positionalType:void 0,positionalTitle:t}}function mo(t,e,o){if(t!==void 0||typeof e!="string"||e.length===0||o.title!==void 0||o.type!==void 0||!to.has(e.trim().toLowerCase()))return;let i=e.trim();throw new f(`pm create needs a title \u2014 "${i}" looks like an item type, not a title. Use either: pm create ${i} "<title>" or pm create "<title>" --type ${i}.`,c.USAGE,{code:"create_positional_type_without_title",why:'Without this guard the single positional is used as the title and the type defaults to Task \u2014 so the command would silently create a Task literally titled "'+i+'".',examples:[`pm create ${i} "Wire up SSO for the agent harness"`,`pm create "Wire up SSO for the agent harness" --type ${i}`],nextSteps:[`Re-run with both type and title: pm create ${i} "<title>"`]})}var yo=["body","description","dep","depRemove","comment","note","learning","file","test","doc","reminder","event","typeOption","field"];function tt(t){let e=yo.filter(o=>{let i=t[o];return i==="-"||Array.isArray(i)&&i.includes("-")}).map(o=>`--${o.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}`);if(e.length>0)throw new f(`--stdin-json cannot be combined with other stdin consumers: ${e.join(", ")}`,c.USAGE)}async function go(t,e,o,i){let n=m(i),r=Date.now();if(o.stdinJson===!0){tt(o);let y=await D().resolveValue("-","--stdin-json");o=ue(y??"","create",o)}let a=fo(t,e,o);mo(a.positionalType,a.positionalTitle,o),typeof a.positionalType=="string"&&a.positionalType.length>0&&o.type===void 0&&(o.type=a.positionalType),typeof a.positionalTitle=="string"&&a.positionalTitle.length>0&&o.title===void 0&&(o.title=a.positionalTitle),await ce(o),typeof o.bodyFile=="string"&&(o.body=await L(o.bodyFile,o.body!==void 0?String(o.body):void 0),delete o.bodyFile);let s=z(o,{requireType:!1}),u=await Ne(s,n);await w(n,u),p(u,n),n.profile&&h(`profile:command=create took_ms=${Date.now()-r}`)}function ho(t){return{type:l(t,"filterType"),tag:l(t,"filterTag"),priority:l(t,"filterPriority"),deadlineBefore:l(t,"filterDeadlineBefore"),deadlineAfter:l(t,"filterDeadlineAfter"),updatedAfter:l(t,"filterUpdatedAfter"),updatedBefore:l(t,"filterUpdatedBefore"),createdAfter:l(t,"filterCreatedAfter"),createdBefore:l(t,"filterCreatedBefore"),ids:l(t,"ids"),assignee:l(t,"filterAssignee"),assigneeFilter:T(t.filterAssigneeFilter,t.filterAssignee_filter),parent:l(t,"filterParent"),sprint:l(t,"filterSprint"),release:l(t,"filterRelease"),...et(t),limit:l(t,"limit"),offset:l(t,"offset")}}async function vo(t,e){let o=m(e),i=Date.now(),n=await Fe({status:l(t,"filterStatus"),list:ho(t),reason:l(t,"reason"),completedAt:l(t,"completedAt"),resolution:l(t,"resolution"),expectedResult:T(t.expectedResult,t.expected_result,t.expected),actualResult:T(t.actualResult,t.actual_result,t.actual),validateClose:t.validateClose===!0?"warn":l(t,"validateClose"),author:l(t,"author"),message:l(t,"message"),force:!!t.force,dryRun:t.dryRun===!0?!0:void 0,rollback:l(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await w(o,n),p(n,o),o.profile&&h(`profile:command=close-many took_ms=${Date.now()-i}`)}async function bo(t,e){let o=m(e),i=Date.now(),n=await Be({status:l(t,"filterStatus"),list:po(t),update:J(Ae(t)),dryRun:t.dryRun===!0?!0:void 0,rollback:l(t,"rollback"),checkpoint:t.checkpoint===!1?!1:void 0},o);await w(o,n),p(await F("update-many",[],t,o,n),o),o.profile&&h(`profile:command=update-many took_ms=${Date.now()-i}`)}async function wo(t,e,o,i){let n=m(i),r=Date.now(),a=typeof o.reason=="string"&&o.reason.trim().length>0&&o.reason||typeof o.closeReason=="string"&&o.closeReason.trim().length>0&&o.closeReason||void 0,s=typeof e=="string"&&e.length>0?e:a,u=await Oe(t,s,{author:l(o,"author"),message:l(o,"message"),validateClose:o.validateClose===!0?"warn":l(o,"validateClose"),force:!!o.force,duplicateOf:l(o,"duplicateOf"),completedAt:l(o,"completedAt"),resolution:l(o,"resolution"),expectedResult:T(o.expectedResult,o.expected_result,o.expected),actualResult:T(o.actualResult,o.actual_result,o.actual)},n);await w(n,u),p(u,n),n.profile&&h(`profile:command=close took_ms=${Date.now()-r}`)}function ko(t){let e={...t},o=[["blocked_by","blockedBy"],["resume_context","resumeContext"],["from_search","fromSearch"],["step_title","stepTitle"],["step_body","stepBody"],["step_owner","stepOwner"],["step_status","stepStatus"],["step_evidence","stepEvidence"],["step_blocked_reason","stepBlockedReason"],["step_replacement","stepReplacement"],["depends_on","dependsOn"],["link_kind","linkKind"],["link_note","linkNote"],["promote_to_item_dep","promoteToItemDep"],["allow_multiple_active","allowMultipleActive"],["decision_text","decisionText"],["decision_rationale","decisionRationale"],["decision_evidence","decisionEvidence"],["discovery_text","discoveryText"],["validation_text","validationText"],["validation_command","validationCommand"],["validation_expected","validationExpected"],["materialize_type","materializeType"],["materialize_parent","materializeParent"],["materialize_tags","materializeTags"]];for(let[n,r]of o)e[n]!==void 0&&e[r]===void 0&&(e[r]=e[n]);let i=z(e,{requireType:!1});return i.blockedBy=e.blockedBy,i}function So(t,e){if(!t)throw new f(`pm plan requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:['pm plan create --title "Refactor lock retry"',"pm plan show pm-a1b2 --depth standard",'pm plan add-step pm-a1b2 --step-title "Read lock.ts"']});if(e.includes(t))return;throw E({command_path:"plan",token:t,allowed:e,examples:t==="list"||t==="ls"?["pm list --type Plan","pm list-all --type Plan"]:void 0,retry_command:t==="list"||t==="ls"?"pm list --type Plan":void 0})}function Ao(t,e){if(t!=="reorder-step"||typeof e!="string")return;let o=Number.parseInt(e,10);if(!Number.isFinite(o))throw new f(`reorder-step requires an integer new order, got "${e}"`,c.USAGE);return o}async function _o(t,e,o,i,n,r){let a=m(r),s=Date.now(),u=(t??"").trim().toLowerCase();So(u,Le);let y=ko(n),v=Ao(u,i),k=u==="create"&&typeof e=="string"&&e.length>0&&y.title===void 0?void 0:e;k===void 0&&typeof e=="string"&&e.length>0&&(y.title=e);let g=await Ue({subcommand:u,id:k,stepRef:o,reorderTo:v,options:y,global:a});await w(a,g),p(g,a),a.profile&&h(`profile:command=plan took_ms=${Date.now()-s}`)}function Ze(t,e){if(typeof t=="string"){if(!/^\d+$/.test(t.trim()))throw new f(`history-compact ${e} must be a non-negative integer.`,c.USAGE);return Number.parseInt(t,10)}}async function xo(t,e,o){if(t!==void 0)throw new f("merge reconcile takes no positional arguments.",c.USAGE);let i=await ae({dryRun:e.dryRun===!0,force:e.force===!0,message:typeof e.message=="string"?e.message:void 0,author:o.author},o);p(i,o),i.ok||(process.exitCode=c.GENERIC_FAILURE)}async function Co(t,e,o,i,n,r){if(t===void 0||e===void 0||o===void 0||i===void 0)throw new f("merge driver requires <artifact> <base> <ours> <theirs> (git supplies %O %A %B). Example: pm merge driver history %O %A %B",c.USAGE);let a=await te({artifact:t,basePath:e,oursPath:o,theirsPath:i,outputPath:typeof n.output=="string"?n.output:void 0,itemPath:typeof n.itemPath=="string"?n.itemPath:void 0,prefer:typeof n.prefer=="string"?n.prefer:void 0},r);p(a,r),a.ok||(process.exitCode=c.GENERIC_FAILURE)}async function Do(t,e,o,i,n,r,a){let s=m(a),u=Date.now();switch(t.trim().toLowerCase()){case"install":{if(e!==void 0)throw new f("merge install takes no positional arguments.",c.USAGE);let v=await K({dryRun:r.dryRun===!0},s);p(v,s);break}case"reconcile":await xo(e,r,s);break;case"report":{if(e!==void 0)throw new f("merge report takes no positional arguments.",c.USAGE);p(await W({includeReconciled:r.includeReconciled===!0}),s);break}case"driver":await Co(e,o,i,n,r,s);break;default:throw E({command_path:"merge",token:t,allowed:["install","reconcile","report","driver"],display_name:"merge"})}s.profile&&h(`profile:command=merge took_ms=${Date.now()-u}`)}async function Ro(t,e,o){let i=m(o),n=Date.now(),r=typeof e.ids=="string"?be(e.ids):void 0,a=Ze(e.allOver,"--all-over"),s=Ze(e.minEntries,"--min-entries");if(e.closed===!0&&e.allStreams===!0)throw new f("history-compact: --closed and --all-streams are mutually exclusive; pick one lifecycle scope.",c.USAGE);let u=e.closed===!0?"closed":e.allStreams===!0?"all-streams":void 0;if((r!==void 0||a!==void 0||u!==void 0)&&typeof e.before=="string")throw new f("history-compact: --before applies only in single-id mode (bulk mode always compacts full streams).",c.USAGE);if(le(t,{ids:r,allOver:a,scope:u}),t===void 0){let v=await se({ids:r,scope:u,allOver:a,minEntries:s,dryRun:e.dryRun===!0,author:l(e,"author"),message:l(e,"message"),force:!!e.force},i);p(v,i),v.totals.items_errored>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let v=await re(t,{before:l(e,"before"),dryRun:e.dryRun===!0,author:l(e,"author"),message:l(e,"message"),force:!!e.force},i);p(v,i)}i.profile&&h(`profile:command=history-compact took_ms=${Date.now()-n}`)}function Qe(t){if(Array.isArray(t))return t.flatMap(e=>e.split(",")).map(e=>e.trim()).filter(e=>e.length>0)}async function Io(t,e,o,i){let n=m(i),r=Date.now(),{SCHEMA_SUBCOMMANDS:a}=H,s=(t??"").trim().toLowerCase(),u=e;if(To(s,a),!a.includes(s)&&u===void 0&&!me(s)&&(u=t,s="add-type"),!a.includes(s))throw E({command_path:"schema",token:s,allowed:a});let y=await ao(H,{normalizedSubcommand:s,typeName:u,options:o,aliases:ge(o.alias),roles:ge(o.role),commands:Qe(o.commands),requiredTypes:Qe(o.requiredTypes),defaultStatus:T(o.defaultStatus,o.default_status),order:$(o.order),minCount:$(o.minCount),author:l(o,"author"),force:!!o.force,description:l(o,"description"),globalOptions:n});n.json===!0||n.defaultOutputFormat==="json"?p(y,n):n.quiet||ro(H,y),n.profile&&h(`profile:command=schema took_ms=${Date.now()-r}`)}function To(t,e){if(!t)throw new f(`pm schema requires a subcommand. Allowed: ${e.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}async function Eo(t,e,o){let i=m(o),n=Date.now(),r=await Y(t,{title:l(e,"title"),author:l(e,"author"),message:l(e,"message"),allowDuplicate:e.allowDuplicate===!0},i);await w(i,r),p(r,i),i.profile&&h(`profile:command=copy took_ms=${Date.now()-n}`)}async function Oo(t,e,o){let i=m(o),n=Date.now(),r=await Q(t,{clear:e.clear===!0},i);p(r,i),i.profile&&h(`profile:command=focus took_ms=${Date.now()-n}`)}async function Fo(t,e,o){let i=m(o),n=Date.now();if(e.stdinJson===!0){tt(e);let a=await D().resolveValue("-","--stdin-json");e=ue(a??"","update",e)}await ce(e),typeof e.bodyFile=="string"&&(e.body=await L(e.bodyFile,e.body!==void 0?String(e.body):void 0),delete e.bodyFile);let r=await $e(t,J(e),i);await w(i,r),p(await F("update",[t],e,i,r),i),i.profile&&h(`profile:command=update took_ms=${Date.now()-n}`)}async function Mo(t,e,o){let i=m(o),n=Date.now(),r=await Z(t,{author:l(e,"author"),message:l(e,"message"),force:!!e.force,dryRun:e.dryRun===!0},i);r.dry_run!==!0&&await w(i,r),p(r,i),i.profile&&h(`profile:command=delete took_ms=${Date.now()-n}`)}function Po(t,e){let o=l(e,"body"),i=l(e,"text"),n=typeof t=="string"?t:void 0;if([o,i,n].filter(s=>s!==void 0).length>1)throw new f("Specify append text with exactly one source: positional [text], --body, or --text",c.USAGE);let a=o??i??n;if(a===void 0)throw new f("Missing append text. Provide it as positional [text], --body <value>, or --text <value> (use - for stdin).",c.USAGE);return a}async function Ho(t,e,o,i){let n=m(i),r=Date.now(),a=await Ee(t,{body:Po(e,o),author:l(o,"author"),message:l(o,"message"),force:!!o.force},n);await w(n,a),p(a,n),n.profile&&h(`profile:command=append took_ms=${Date.now()-r}`)}async function No(t,e,o,i){let n=m(i),r=Date.now(),a=await X(t,e,{author:l(o,"author"),message:l(o,"message"),force:!!o.force},n);await w(n,a),p(a,n),n.profile&&h(`profile:command=restore took_ms=${Date.now()-r}`)}async function $o(t,e,o,i){let n=m(i),r=Date.now(),{PROFILE_SUBCOMMANDS:a}=P,s=(t??"").trim().toLowerCase();if(!s)throw new f(`pm profile requires a subcommand. Allowed: ${a.join(", ")}`,c.USAGE,{code:"missing_required_argument",examples:["pm profile list","pm profile show agile","pm profile apply agile --dry-run","pm profile lint agile"]});if(!a.includes(s))throw E({command_path:"profile",token:s,allowed:a});let u=await lo(P,s,e,o,n);n.json===!0||n.defaultOutputFormat==="json"?p(u,n):n.quiet||so(P,u),u.action==="lint"&&!u.ok&&(process.exitCode=c.GENERIC_FAILURE),n.profile&&h(`profile:command=profile took_ms=${Date.now()-r}`)}function C(t,e){return ge(t[e])??[]}async function Bo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),s=C(e,"remove"),u=C(e,"migrate"),y=await Re(t,{add:r,addGlob:a,remove:s,migrate:u,note:l(e,"note"),list:!!e.list,appendStable:!!e.appendStable,validatePaths:!!e.validatePaths,author:l(e,"author"),message:l(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||s.length>0||u.length>0)&&await w(i,y),p(await F("files",[t],e,i,y),i),i.profile&&h(`profile:command=files took_ms=${Date.now()-n}`)}async function Lo(t,e,o){let i=m(o),n=Date.now(),r={...o.optsWithGlobals(),...e},a=await Te(t,{apply:!!r.apply,note:l(r,"note"),appendStable:!!r.appendStable,author:l(r,"author"),message:l(r,"message"),force:!!r.force},i);a.changed&&await w(i,a),p(a,i),i.profile&&h(`profile:command=files.discover took_ms=${Date.now()-n}`)}async function Uo(t,e,o){let i=m(o),n=Date.now(),r=C(e,"add"),a=C(e,"addGlob"),s=C(e,"remove"),u=C(e,"migrate"),y=await Ce(t,{add:r,addGlob:a,remove:s,migrate:u,note:l(e,"note"),list:!!e.list,validatePaths:!!e.validatePaths,author:l(e,"author"),message:l(e,"message"),force:!!e.force},i);(r.length>0||a.length>0||s.length>0||u.length>0)&&await w(i,y),p(await F("docs",[t],e,i,y),i),i.profile&&h(`profile:command=docs took_ms=${Date.now()-n}`)}async function Go(t,e,o){let i=m(o),n=Date.now(),r=await Se(t,{format:e.format,maxDepth:l(e,"maxDepth"),collapse:e.collapse,summary:e.summary===!0,full:e.full===!0,nodeLimit:l(e,"nodeLimit"),edgeLimit:l(e,"edgeLimit"),tokenBudget:l(e,"tokenBudget"),cursor:l(e,"cursor"),direction:l(e,"direction"),...Array.isArray(e.kind)?{kind:e.kind}:{}},i);p(r,i),i.profile&&h(`profile:command=deps took_ms=${Date.now()-n}`)}function Hn(t,e={}){let o=t.command("create").argument("[typeOrTitle]",'Item title, or item type when a title follows (e.g. `pm create task "Fix bug"`)').argument("[title]","Item title when the first argument is an item type").description("Create a new project management item.");if(ye(o,q),o.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--allow-duplicate","Explicitly create even when strict similarity governance finds likely duplicates").action(go),e.targetCommandName==="create")return;t.command("copy").argument("<id>","Source item id").option("--title <value>","Optional title override for the copied item").option("--author <value>","Mutation author").option("--message <value>","History message").option("--allow-duplicate","Explicitly copy even when strict similarity governance finds likely duplicates").description("Copy an item into a new item id while resetting lifecycle fields.").action(Eo),t.command("focus").argument("[id]","Item id to focus (omit to show current focus)").option("--clear","Clear the focused item").description("Set/clear/show the session focused item that new items default --parent to.").action(Oo);let i=t.command("update").argument("<id>","Item id").description("Update item fields and metadata.");ye(i,we),i.option("--stdin-json","Read a full item JSON document from stdin; explicit flags override document values").option("--body-file <path>","Load the item markdown body from a file (mutually exclusive with --body)").option("--replace-deps","Atomically replace dependency entries with the provided --dep values").option("--replace-tests","Atomically replace linked test entries with the provided --test values").option("--replace-files","Atomically replace linked file entries with the provided --file values").option("--replace-docs","Atomically replace linked doc entries with the provided --doc values").option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--force","Force ownership override"),i.action(Fo),ze(t);let n=t.command("update-many").description("Bulk-update matched items with dry-run plans and rollback checkpoints.").option("--filter-status <value>","Filter by status before applying updates").option("--filter-type <value>","Filter by item type before applying updates").option("--filter-tag <value>","Filter by tag before applying updates").option("--filter-priority <value>","Filter by priority before applying updates").option("--filter-deadline-before <value>","Filter by deadline upper bound before applying updates").option("--filter-deadline-after <value>","Filter by deadline lower bound before applying updates").option("--filter-updated-after <value>","Filter by updated_at lower bound before applying updates (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before applying updates (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before applying updates (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before applying updates (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before applying updates").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before applying updates").option("--filter-parent <value>","Filter by parent item ID before applying updates").option("--filter-sprint <value>","Filter by sprint before applying updates").option("--filter-release <value>","Filter by release before applying updates").option("--filter-ac-missing","Select only items missing acceptance_criteria (bulk backfill)").option("--filter-estimates-missing","Select only items missing estimated_minutes (bulk backfill)").option("--filter-resolution-missing","Select only terminal items missing resolution (bulk backfill)").option("--filter-metadata-missing","Select only items missing any tracked metadata (AC, estimate, or resolution)");Ye(n,"applying updates"),n.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--dry-run","Preview per-item diffs and checkpoint intent without mutating").option("--rollback <value>","Rollback a prior update-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode").option("--title, -t <value>","Set title").option("--description, -d <value>","Set description").option("--body, -b <value>","Set body (allow empty string)").option("--status, -s <value>","Set status (use close command for closed)").option("--priority, -p <value>","Set priority").option("--type <value>","Set type").option("--tags <value>","Set comma-separated tags (replaces existing). Use --add-tags / --remove-tags to mutate additively.").option("--add-tags <value>","Add tags additively without replacing existing (repeatable; CSV accepted)",d).option("--remove-tags <value>","Remove tags from the existing list (repeatable; CSV accepted)",d).option("--deadline <value>","Set deadline (ISO/date string or relative)").option("--estimate, --estimated-minutes <value>","Set estimated minutes").option("--acceptance-criteria <value>","Set acceptance criteria").option("--ac <value>","Alias for --acceptance-criteria").option("--add-ac <value>","Add one semicolon-free acceptance criterion without replacing the existing list (repeatable)",d).option("--remove-ac <value>","Remove one semicolon-free acceptance criterion by exact text match (repeatable)",d).option("--definition-of-ready <value>","Set definition of ready").option("--order <value>","Set planning order/rank integer").option("--rank <value>","Alias for --order").option("--goal <value>","Set goal identifier").option("--objective <value>","Set objective identifier").option("--value <value>","Set business value summary").option("--impact <value>","Set business impact summary").option("--outcome <value>","Set expected outcome summary").option("--why-now <value>","Set why-now rationale").option("--assignee <value>","Set assignee").option("--parent <value>","Set parent item ID").option("--reviewer <value>","Set reviewer").option("--risk <value>","Set risk level").option("--confidence <value>","Set confidence level").option("--sprint <value>","Set sprint identifier").option("--release <value>","Set release identifier").option("--blocked-by <value>","Set blocked-by item ID or reason").option("--blocked-reason <value>","Set blocked reason").option("--unblock-note <value>","Set unblock rationale note").option("--reporter <value>","Set issue reporter").option("--severity <value>","Set issue severity").option("--environment <value>","Set issue environment context").option("--repro-steps <value>","Set issue reproduction steps").option("--resolution <value>","Set issue resolution summary").option("--expected-result <value>","Set issue expected behavior").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set issue observed behavior").option("--actual <value>","Short alias for --actual-result").option("--affected-version <value>","Set affected version identifier").option("--fixed-version <value>","Set fixed version identifier").option("--component <value>","Set issue component ownership").option("--regression [value]","Set regression marker; bare flag means true, or pass true|false|1|0").option("--customer-impact <value>","Set customer impact summary").option("--dep <value>","Add dependency entry id=<id>,kind=<kind>,author=<author>,created_at=<timestamp>",d).option("--dep-remove <value>","Remove dependency entries by id/kind/author/timestamp signature",d).option("--replace-deps","Atomically replace dependency entries with provided --dep values").option("--replace-tests","Atomically replace linked tests with provided --test values").option("--replace-files","Atomically replace linked files with provided --file values").option("--replace-docs","Atomically replace linked docs with provided --doc values").option("--comment <value>","Add comment seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--note <value>","Add note seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--learning <value>","Add learning seed author=<value>,created_at=<iso|now>,text=<value>",d).option("--file <value>","Add linked file path=<value>,scope=<project|global>,note=<text>",d).option("--test <value>","Add linked test command=<value>,path=<value>,scope=<project|global>",d).option("--doc <value>","Add linked doc path=<value>,scope=<project|global>,note=<text>",d).option("--reminder <value>","Add reminder entry at=<iso|relative>|date=<iso|relative>,text=<text>|title=<text>",d).option("--event <value>","Add event entry start=<iso|relative>,end=<iso|relative>,recur_*",d).option("--type-option <value>","Set type options key=value (repeatable)",d).option("--unset <field>","Clear scalar metadata field by name (repeatable)",d).option("--clear-deps","Clear dependency entries").option("--clear-comments","Clear comments").option("--clear-notes","Clear notes").option("--clear-learnings","Clear learnings").option("--clear-files","Clear linked files").option("--clear-tests","Clear linked tests").option("--clear-docs","Clear linked docs").option("--clear-reminders","Clear reminders").option("--clear-events","Clear events").option("--clear-type-options","Clear type options").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override"),M(n,[["--filter-assignee_filter <value>","Alias for --filter-assignee-filter"],["--estimated_minutes <value>","Alias for --estimated-minutes"],["--acceptance_criteria <value>","Alias for --acceptance-criteria"],["--definition_of_ready <value>","Alias for --definition-of-ready"],["--why_now <value>","Alias for --why-now"],["--blocked_by <value>","Alias for --blocked-by"],["--blocked_reason <value>","Alias for --blocked-reason"],["--unblock_note <value>","Alias for --unblock-note"],["--repro_steps <value>","Alias for --repro-steps"],["--expected_result <value>","Alias for --expected-result"],["--actual_result <value>","Alias for --actual-result"],["--affected_version <value>","Alias for --affected-version"],["--fixed_version <value>","Alias for --fixed-version"],["--customer_impact <value>","Alias for --customer-impact"],["--filter-estimate-missing","Alias for --filter-estimates-missing"]],!1),M(n,[["--dep_remove <value>","Alias for --dep-remove"],["--type_option <value>","Alias for --type-option"],["--add_tags <value>","Alias for --add-tags"],["--remove_tags <value>","Alias for --remove-tags"],["--add_ac <value>","Alias for --add-ac"],["--remove_ac <value>","Alias for --remove-ac"]],!0),n.action(bo);let r=t.command("close").argument("<id>","Item id").argument("[text]","Close reason text (alias: --reason)").option("-r, --reason <value>","Close reason text (alias for positional <text>)").option("--close-reason <value>","Close reason text (alias for positional <text>)").option("--completed-at <value>","Actual completion timestamp (ISO or relative), distinct from tracker close time").option("-d, --duplicate-of <id>","Close as a duplicate of the canonical item id and auto-fill duplicate closure metadata").option("--author <value>","Mutation author").option("-m, --message <value>","History message").option("--validate-close [mode]",'Validate closure metadata before close: "off", "warn", or "strict" (default: settings governance preset)').option("--resolution <value>","Set the closure resolution summary inline (same field --validate-close strict checks; previously required a prior pm update)").option("--expected-result <value>","Set the expected-result note inline (closure validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Set the actual-result note inline (closure validation field)").option("--actual <value>","Short alias for --actual-result").option("--force","Force ownership override").description("Close an item. Close reason requirement follows governance.require_close_reason.");_(r,"--expected_result <value>","Alias for --expected-result",!1),_(r,"--actual_result <value>","Alias for --actual-result",!1),r.action(wo);let a=t.command("close-many").description("Bulk-close matched items with a shared reason and full runClose semantics (dry-run + rollback checkpoint).").option("--filter-status <value>","Filter by status before closing").option("--filter-type <value>","Filter by item type before closing").option("--filter-tag <value>","Filter by tag before closing").option("--filter-priority <value>","Filter by priority before closing").option("--filter-deadline-before <value>","Filter by deadline upper bound before closing").option("--filter-deadline-after <value>","Filter by deadline lower bound before closing").option("--filter-updated-after <value>","Filter by updated_at lower bound before closing (ISO/relative)").option("--filter-updated-before <value>","Filter by updated_at upper bound before closing (ISO/relative)").option("--filter-created-after <value>","Filter by created_at lower bound before closing (ISO/relative)").option("--filter-created-before <value>","Filter by created_at upper bound before closing (ISO/relative)").option("--filter-assignee <value>","Filter by assignee before closing").option("--filter-assignee-filter <value>","Filter assignee presence: assigned|unassigned before closing").option("--filter-parent <value>","Filter by parent item ID before closing").option("--filter-sprint <value>","Filter by sprint before closing").option("--filter-release <value>","Filter by release before closing");Ye(a,"closing"),a.option("--ids <value>","Restrict to an explicit comma-separated ID allowlist (intersected with other filters)").option("--limit <n>","Limit matched item count before apply/preview").option("--offset <n>","Skip first n matched rows before apply/preview").option("--reason <value>","Shared close reason applied to matched items (required when governance.require_close_reason is enabled)").option("--completed-at <value>","Actual completion timestamp (ISO or relative) applied to every matched item").option("--resolution <value>","Shared closure resolution applied to every matched item (closure-validation field)").option("--expected-result <value>","Shared expected-result note (closure-validation field)").option("--expected <value>","Short alias for --expected-result").option("--actual-result <value>","Shared actual-result note (closure-validation field)").option("--actual <value>","Short alias for --actual-result").option("--validate-close [mode]",'Validate closure metadata per item: "off", "warn", or "strict" (default: settings governance preset)').option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Re-close already-terminal matches and override ownership").option("--dry-run","Preview matched items + per-item skip/active-child plan without mutating").option("--rollback <value>","Rollback a prior close-many checkpoint ID").option("--no-checkpoint","Disable checkpoint creation during apply mode"),_(a,"--filter-assignee_filter <value>","Alias for --filter-assignee-filter",!1),_(a,"--expected_result <value>","Alias for --expected-result",!1),_(a,"--actual_result <value>","Alias for --actual-result",!1),a.action(vo),t.command("delete").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").option("--dry-run","Preview the item file that would be deleted without mutating").description("Delete an item and record the change in history.").action(Mo),t.command("append").argument("<id>","Item id").argument("[text]","Body text; same as --body (- reads stdin)").option("--body <value>","Text to append to body (or - for stdin)").option("--text <value>","Alias for --body").option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override").description("Append text to an item's body. For concurrent writes, use pm notes.").action(Ho),t.command("restore").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(No);let s=t.command("plan").description("Agent-optimized Plan item workflow: create, manage steps, link dependencies, approve, and materialize.").argument("[subcommand]","Plan subcommand: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize").argument("[id]","Plan id (required for non-create subcommands); for create this may be the positional title").argument("[stepRef]","Step reference: stable id (plan-step-001) or order integer").argument("[reorderTo]","New order integer for reorder-step").option("--title <value>","Plan title").option("--description <value>","Plan description").option("--scope <value>","Short scope statement of the target change or investigation").option("--parent <value>","Parent pm item id").option("--related <value>","Related pm item ids (repeatable, csv-friendly)",d).option("--blocks <value>","Pm item ids this plan blocks (repeatable, csv-friendly)",d).option("--blocked-by <value>","Pm item ids that block this plan (repeatable, csv-friendly)",d).option("--harness <value>","Plan harness provenance: codex|claude-code|cursor|generic").option("--mode <value>","Plan mode: draft|research|review|approved|executing|paused|completed|superseded").option("--resume-context <value>","Compact context summary for a future stateless agent").option("--tags <value>","Comma-separated tags").option("--priority <value>","Priority 0-4").option("--body <value>","Plan item body").option("--claim","Claim the plan on create for the author").option("--from-search <value>","Record the search query that led to plan creation").option("--template <value>","Seed plan steps from a built-in template: bug-investigation|feature-implementation|refactoring-sprint").option("--step-title <value>","Step title for add-step / update-step").option("--step <value>","Step title (repeatable on create: each --step appends an ordered step; elsewhere a single value aliases --step-title)",d).option("--step-body <value>","Step body text").option("--step-owner <value>","Step owner").option("--step-status <value>","Step status: pending|in_progress|completed|blocked|skipped|superseded").option("--step-evidence <value>","Step evidence text (used by update-step/complete-step)").option("--step-blocked-reason <value>","Step blocked reason (required when blocking)").option("--step-replacement <value>","Replacement reference for a superseded step").option("--depends-on <value>","Pm item ids the step depends on (repeatable, csv-friendly)",d).option("--link <value>","Pm item id to link (repeatable, csv-friendly)",d).option("--link-kind <value>","Link kind: related|blocks|blocked_by|depends_on|discovered_from|implements|verifies|supersedes").option("--link-note <value>","Optional note for the link").option("--promote-to-item-dep","Also add the linked id as a top-level item dependency when linking").option("--allow-multiple-active","Allow multiple steps to be in_progress at once").option("--file <value>","Step linked file path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--test <value>","Step linked test command=<value>[,path=<value>,note=<text>] (repeatable)",d).option("--doc <value>","Step linked doc path=<value>[,scope=project|global,note=<text>] (repeatable)",d).option("--decision-text <value>","Decision log entry text").option("--decision <value>","Alias for --decision-text").option("--decision-rationale <value>","Decision log entry rationale").option("--decision-evidence <value>","Decision log entry evidence").option("--discovery-text <value>","Discovery log entry text").option("--discovery <value>","Alias for --discovery-text").option("--validation-text <value>","Validation log entry text").option("--validation <value>","Alias for --validation-text").option("--validation-command <value>","Validation log entry command").option("--validation-expected <value>","Validation log entry expected outcome").option("--depth <value>","Show depth: brief|standard|deep (default: brief)").option("--fields <value>","Comma-separated field projection for show output").option("--steps <value>","Comma-separated step ids/orders for materialize").option("--materialize-type <value>","Item type for materialized steps (default: Task)").option("--materialize-parent <value>","Parent item id for materialized children (default: the plan)").option("--materialize-tags <value>","Comma-separated tags for materialized children").option("--field <name=value>","Custom field value forwarded to every materialized child (repeatable)",d).option("--author <value>","Mutation author").option("--message <value>","Mutation message").option("--force","Force ownership override");ye(s,q.filter(k=>oo.has(k.target))),M(s,[["--resume_context <value>","Alias for --resume-context"],["--from_search <value>","Alias for --from-search"],["--step_title <value>","Alias for --step-title"],["--step_body <value>","Alias for --step-body"],["--step_owner <value>","Alias for --step-owner"],["--step_status <value>","Alias for --step-status"],["--step_evidence <value>","Alias for --step-evidence"],["--step_blocked_reason <value>","Alias for --step-blocked-reason"],["--step_replacement <value>","Alias for --step-replacement"],["--link_kind <value>","Alias for --link-kind"],["--link_note <value>","Alias for --link-note"],["--promote_to_item_dep","Alias for --promote-to-item-dep"],["--allow_multiple_active","Alias for --allow-multiple-active"],["--decision_text <value>","Alias for --decision-text"],["--decision_rationale <value>","Alias for --decision-rationale"],["--decision_evidence <value>","Alias for --decision-evidence"],["--discovery_text <value>","Alias for --discovery-text"],["--validation_text <value>","Alias for --validation-text"],["--validation_command <value>","Alias for --validation-command"],["--validation_expected <value>","Alias for --validation-expected"],["--materialize_type <value>","Alias for --materialize-type"],["--materialize_parent <value>","Alias for --materialize-parent"],["--materialize_tags <value>","Alias for --materialize-tags"]],!1),M(s,[["--blocked_by <value>","Alias for --blocked-by"],["--depends_on <value>","Alias for --depends-on"]],!0),s.action(_o),t.command("history-redact").argument("<id>","Item id").option("--literal <value>","Literal string to redact (repeatable)",d).option("--regex <value>","Regex pattern to redact (repeatable; accepts /pattern/flags or raw pattern)",d).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(k,g,R)=>{let S=m(R),I=Date.now(),A=Array.isArray(g.literal)?g.literal:void 0,N=Array.isArray(g.regex)?g.regex:void 0,x=await j(k,{literal:A,regex:N,replacement:typeof g.replacement=="string"?g.replacement:void 0,dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force},S);x.changed&&!x.dry_run&&await w(S,x),p(x,S),S.profile&&h(`profile:command=history-redact took_ms=${Date.now()-I}`)}),t.command("history-repair").argument("[id]","Item id (omit with --all)").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("--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(k,g,R)=>{let S=m(R),I=Date.now(),A=g.all===!0;ie(k,A);let N={dryRun:g.dryRun===!0,author:typeof g.author=="string"?g.author:void 0,message:typeof g.message=="string"?g.message:void 0,force:!!g.force};if(A){let x=await ne(N,S);p(x,S),x.totals.failed>0&&(process.exitCode=c.GENERIC_FAILURE)}else{let x=await oe(k,N,S);p(x,S)}S.profile&&h(`profile:command=history-repair took_ms=${Date.now()-I}`)}),Je(t),t.command("history-compact").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: compact an explicit comma-separated list of item ids").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(Ro),t.command("merge").argument("<subcommand>","Merge subcommand: install, reconcile, report, driver").argument("[artifact]",`driver only: artifact class to merge (${ee.join(", ")})`).argument("[base]","driver only: common-ancestor file path (git %O)").argument("[ours]","driver only: current-branch file path (git %A)").argument("[theirs]","driver only: other-branch file path (git %B)").option("--dry-run","install/reconcile: preview changes without writing").option("--message <text>","reconcile only: audit message recorded on repaired history streams").option("--force","reconcile only: permit the underlying audited history ownership override").option("--include-reconciled","report only: include clone-local receipts already recorded in history").option("--output <path>","driver only: write the merged content to this path instead of the ours path").option("--item-path <path>","driver only: original repository-relative path supplied by git as %P").option("--prefer <side>","driver only: side that wins unresolvable conflicts (ours|theirs; default ours)").description("Install merge drivers, reconcile or report post-merge history, or run a field-aware driver.").action(Do);let u=t.command("schema").argument("[subcommand]","Schema subcommand: list, show, show-status, add/remove type/status/field, rename-type, rename-field, remap-status, or a custom item type name shorthand").argument("[name]","Definition name, or source name for rename/remap migrations").option("--description <text>","Human description for the custom item type, status, or field").option("--default-status <status>","Default status hint recorded for the custom item type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",d).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",d).option("--order <n>","Display/sort order for a custom status").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Commands a custom field is wired onto (add-field; repeatable, comma-friendly): create, update, update_many, list, search, calendar, context",d).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",d).option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Plan a schema migration without writing schema, items, or history").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Inspect and manage config-driven runtime schema (types, statuses, fields, presets).");_(u,"--default_status <status>","Alias for --default-status",!1),_(u,"--migration_id <id>","Alias for --migration-id",!1),u.action(Io),t.command("profile").argument("[subcommand]","Profile subcommand: list, show, apply, or lint").argument("[name]","Profile name for show/apply/lint: agile, ops, or research").option("--dry-run","Preview the apply diff without writing any files (apply)").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("List, show, apply, and lint project profiles \u2014 archetype bundles of item types, statuses, fields, workflows, config, templates, and recommended packages.").action($o),We(t,uo);let v=t.command("files").description("Manage files linked to an item.");v.argument("<id>","Item id").option("--add <value>","Add linked file entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked file entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked file by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked file paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked files without mutating").option("--append-stable","Preserve existing linked-file order and append new links without full-array resorting").option("--validate-paths","Validate linked file paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").action(Bo),v.command("discover").argument("<id>","Item id").option("--apply","Add discovered missing files to the item").option("--note <value>","Note to attach to discovered file links").option("--append-stable","Preserve existing linked-file order and append discovered links without full-array resorting").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Discover existing file paths referenced in item text and optionally link missing files.").action(Lo),Xe(v),t.command("docs").argument("<id>","Item id").option("--add <value>","Add linked doc entry (CSV/markdown pairs or - for stdin)",d).option("--add-glob <value>","Add linked doc entries from a glob (plain glob or pattern=<glob>,scope=<scope>,note=<text>; repeatable)",d).option("--remove <value>","Remove linked doc by path only (path=<value>, path:<value>, plain path, or - for stdin); does not accept note=/scope= \u2014 record removal context with --message",d).option("--migrate <value>","Migrate linked doc paths in-place (from=<prefix>,to=<prefix>; repeatable)",d).option("--note <value>","Note attached to every link added by --add/--add-glob in this invocation (embedded note= wins)").option("--list","List linked docs without mutating").option("--validate-paths","Validate linked doc paths for existence and file shape").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force ownership override").description("Manage docs linked to an item.").action(Uo),t.command("deps").argument("<id>","Item id").option("--format <value>","Output format (tree, graph, or context)","tree").option("--max-depth <value>","Maximum dependency traversal depth (0 keeps only the root)").option("--collapse <value>","Collapse mode (none or repeated)","none").option("--summary","Return counts only without full tree/graph payload").option("--full","Return the complete dependency row projection").option("--node-limit <value>","Maximum nodes in context output").option("--edge-limit <value>","Maximum edges and missing-reference rows in context output").option("--token-budget <value>","Maximum estimated tokens in context output").option("--cursor <value>","Continue an equivalent context query").option("--direction <value>","Context traversal direction (outgoing, incoming, or both)").option("--kind <value>","Restrict context traversal to registered relationship kinds (repeatable or comma-separated)",d).description("Show dependency relationships for an item.").action(Go)}export{me as looksLikeSchemaSubcommandTypo,uo as parsePositiveIntOption,$ as parseSchemaOrderOption,ye as registerCommanderOptionContracts,Hn as registerMutationCommands};
|
|
20
|
+
//# sourceMappingURL=register-mutation-7Y5U7ABT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./chunk-QWRRFYK3.js";import{$c as se,Ba as N,Da as V,Ea as $,Fa as U,Gb as x,Ib as q,Jb as J,Jc as te,Kb as G,Kc as ne,Lb as z,Mc as ae,Qb as W,Ra as B,Rb as Y,Sa as H,Sb as K,Sc as oe,Ta as S,Tb as X,Tc as ie,Ub as Q,Uc as re,Vc as E,Wb as Z,_a as j,aa as L,qc as ee}from"./chunk-2RA2YTHJ.js";import"./chunk-ZU34C3LH.js";import"./chunk-DSKYD4LG.js";import"./chunk-WYRZZ5ZE.js";import{B as m,D as h,Pd as O,Qa as _,Tg as D,Wc as R,Zk as P,aa as I,bl as c,el as b,fl as s,gl as w,il as M,jl as F,tc as C,tf as l,uf as d,yl as p}from"./chunk-HC3GM6YY.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]="13159f49-7756-58b8-ac32-7ddd571e7d09")}catch{}})();var le=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"]]),pe=new Set(["higher","lower","target"]),ye=[...le.keys()].sort((e,t)=>e.localeCompare(t)).join(", ");function ge(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"&&pe.has(t)}function ce(e){if(e===void 0)return{};let t;try{t=JSON.parse(e)}catch(n){throw new h(`--analytics must be valid JSON: ${String(n)}`,m.USAGE)}if(t===null||typeof t!="object"||Array.isArray(t))throw new h("--analytics must be a JSON object.",m.USAGE);for(let[n,a]of Object.entries(t)){let o=le.get(n);if(!ge(o,a))throw new h(o===void 0?`Unknown --analytics field "${n}". Accepted fields: ${ye}.`:`--analytics field "${n}" must be ${o.replace("_"," ")}.`,m.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]="eee25545-a7e9-54be-abc0-dbccc9b41e74")}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]="b0095f00-00bd-5b28-933c-b63a1711a73d")}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]="99355d20-090b-503e-8079-b858291938e3")}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]="35276f20-abc5-54e2-8251-35971f1fcb4f")}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]="8fa4af33-ba9f-5a19-a359-c64143287b5d")}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]="52c4154e-2761-5230-942c-6ac5e83a830c")}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]="c3fceb32-e0b9-5690-8653-4c699f865c0f")}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]="1e42a508-5568-522f-843d-61febc0bad27")}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]="43769e60-ed80-521d-9375-c28ee5b0ac06")}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]="3f1deb3b-e341-533a-a349-eca48f347600")}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]="91a42861-f8cb-575b-8596-53870f6275c6")}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]="c85956ff-383f-5482-96a9-0ef38949859c")}catch{}})();var de=(e,t)=>N(e,t,{runUpdate:(n,a,o)=>x(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]="1adbac08-0950-55be-82bf-cc4dc7b6ad18")}catch{}})();async function he(e,t,n,a,o){let i=c(o),r=e==="run",u=e==="verdicts",f=await U({action:e,...r||u?{}:{kind:t},id:r||u?n??t:n,definition:s(a,"definition"),trigger:s(a,"trigger"),tree:s(a,"tree"),gate:s(a,"gate"),limit:s(a,"limit"),dry_run:a.dryRun===!0,fullChangedFields:i.fullChangedFields,idOnly:i.idOnly,author:s(a,"author"),message:s(a,"message")},i);l(f,i),typeof f=="object"&&f!==null&&"exit_code"in f&&f.exit_code===1&&(process.exitCode=1)}function ue(e){e.command("assurance").argument("<action>",`Action: ${V.join(", ")}`).argument("[kind]",`Declaration kind: ${$.join(", ")}; for run this may be the gate id`).argument("[id]","Declaration or gate id").description("Declare and evaluate SDK-owned project assurance contracts.").option("--definition <json>","JSON declaration for put").option("--trigger <value>","Gate lifecycle trigger").option("--tree <value>","Commit, tree, or snapshot identity being judged").option("--gate <id>","Filter verdict history by gate id").option("--limit <number>","Maximum newest verdicts returned").option("--dry-run","Evaluate a gate without appending a verdict").option("--author <value>","Mutation author override").option("--message <value>","Audited mutation rationale").action(he)}(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]="8bd1cf90-5ac8-5470-903d-b9b61d62bb85")}catch{}})();function be(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 I({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 we(e){return{addValues:Array.isArray(e.add)?e.add:[],addJsonValues:Array.isArray(e.addJson)?e.addJson:[],removeValues:Array.isArray(e.remove)?e.remove:[]}}function ke(e,t){if(e.background===!0){if(e.run!==!0)throw new h("--background requires --run",m.USAGE);if(t.addValues.length>0||t.addJsonValues.length>0||t.removeValues.length>0)throw new h("--background does not support --add/--add-json/--remove; update linked tests first, then run in background",m.USAGE)}}async function ve(e,t,n,a){let o=await E({kind:"test",commandArgs:M(e,{...t,add:a.addValues,addJson:a.addJsonValues,remove:a.removeValues}),targetId:e,author:typeof t.author=="string"?t.author:void 0,noExtensions:n.noExtensions===!0},n);l(o,n)}function xe(e,t){return{add:t.addValues,addJson:t.addJsonValues,remove:t.removeValues,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,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}}async function Ae(e,t,n,a){let o=await oe(e,xe(t,a),n);(a.addValues.length>0||a.addJsonValues.length>0||a.removeValues.length>0||t.run===!0)&&await p(n,o),l(o,n),(o.run_results.some(i=>i.status==="failed")||o.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED)}async function _e(e,t,n){let a=c(n),o=Date.now(),i=we(t);ke(t,i),t.background===!0?await ve(e,t,a,i):await Ae(e,t,a,i),a.profile&&d(`profile:command=test took_ms=${Date.now()-o}`)}function A(e){let t=s(e,"author"),n=s(e,"assignee");if(t!==void 0&&n!==void 0&&t!==n)throw new h("Lifecycle ownership received conflicting --author and --assignee values; use one actor value for both aliases.",m.USAGE,{code:"conflicting_lifecycle_owner",examples:["pm claim pm-123","pm start-task pm-123","pm release pm-123"]});return{author:t??n,message:s(e,"message")}}async function De(e,t){let n=c(t),a=Date.now();if(e.background===!0){let r=await E({kind:"test-all",commandArgs:F(e),statusFilter:s(e,"status"),noExtensions:n.noExtensions===!0},n);l(r,n),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`);return}let i=await ie({status:s(e,"status"),limit:s(e,"limit"),offset:s(e,"offset"),timeout:s(e,"timeout"),progress:!!e.progress,envSet:Array.isArray(e.envSet)?e.envSet:[],envClear:Array.isArray(e.envClear)?e.envClear:[],sharedHostSafe:!!e.sharedHostSafe,pmContext:s(e,"pmContext"),overrideLinkedPmContext:!!e.overrideLinkedPmContext,failOnContextMismatch:!!e.failOnContextMismatch,failOnSkipped:!!e.failOnSkipped,failOnEmptyTestRun:!!e.failOnEmptyTestRun,requireAssertionsForPm:!!e.requireAssertionsForPm,checkContext:!!e.checkContext,autoPmContext:!!e.autoPmContext},n);await p(n,{ids:i.results.map(r=>r.id)}),l(i,n),(i.failed>0||i.fail_on_skipped_triggered===!0)&&(process.exitCode=m.DEPENDENCY_FAILED),n.profile&&d(`profile:command=test-all took_ms=${Date.now()-a}`)}async function Se(e,t,n,a){let o=c(a),i=Date.now(),r=await ae({subcommand:be(e,t),limit:s(n,"limit")},o);l(r,o),o.profile&&d(`profile:command=telemetry took_ms=${Date.now()-i}`)}async function Ie(e,t){let n=c(t),a=Date.now(),o=ce(s(e,"analytics")),i=await te(n,{storage:e.storage===!0,metadataCoverage:e.metadataCoverage===!0,byAssignee:e.byAssignee===!0,byTag:e.byTag===!0,byPriority:e.byPriority===!0,tagPrefix:s(e,"tagPrefix"),fieldUtilization:e.fieldUtilization===!0,...o});i.recorded_observations?.some(r=>r.changed)===!0&&await p(n,{ids:i.recorded_observations?.flatMap(r=>r.observation.item_id?[r.observation.item_id]:[])}),l(i,n),n.profile&&d(`profile:command=stats took_ms=${Date.now()-a}`)}async function Ce(e,t){let n=c(t),a=Date.now(),o=s(e,"threshold"),i=s(e,"limit"),r=await ne(n,{status:Array.isArray(e.status)&&e.status.length>0?e.status:void 0,since:s(e,"since"),...o===void 0?{}:{threshold:Number(o)},...i===void 0?{}:{limit:Number(i)}});l(r,n),n.profile&&d(`profile:command=duplicates took_ms=${Date.now()-a}`)}async function Re(e,t){let n=c(t),a=Date.now(),o=await L(n,{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,skipVectors:!!e.skipVectors,skipIntegrity:!!e.skipIntegrity,skipDrift:!!e.skipDrift,full:!!e.full});l(o,n),(e.strictExit||e.failOnWarn)&&!o.ok&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"health_findings",error_category:"validation",command_resolution:"health_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=health took_ms=${Date.now()-a}`)}async function Be(e,t){let n=c(t),a=Date.now(),o=await de({checkMetadata:!!e.checkMetadata,metadataProfile:s(e,"metadataProfile"),checkResolution:!!e.checkResolution,checkLifecycle:!!e.checkLifecycle,checkStaleBlockers:!!e.checkStaleBlockers,dependencyCycleSeverity:s(e,"dependencyCycleSeverity"),parentCycleSeverity:s(e,"parentCycleSeverity"),checkFiles:!!e.checkFiles,checkCommandReferences:!!e.checkCommandReferences,scanMode:s(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)&&(C({...o,exit_code:m.GENERIC_FAILURE,error_code:"validation_findings",error_category:"validation",command_resolution:"validation_findings",resolution_stage:"execute"}),process.exitCode=m.GENERIC_FAILURE),n.profile&&d(`profile:command=validate took_ms=${Date.now()-a}`)}async function Ee(e,t){let n=c(t),a=Date.now(),o=await q(n,{dryRun:e.dryRun===!0,scope:Array.isArray(e.scope)?e.scope:[]});l(o,n),n.profile&&d(`profile:command=gc took_ms=${Date.now()-a}`)}async function Te(e,t,n,a){let o=c(a),i=_(process.cwd(),o.path),r=e.trim().toLowerCase();if(!["create","list","inspect","restore","delete"].includes(r))throw I({command_path:"workspace snapshot",token:e,allowed:["create","list","inspect","restore","delete"],display_name:"workspace snapshot",token_kind:"action",examples:["pm workspace snapshot create before-migration","pm workspace snapshot restore before-migration"]});if(r==="list"){l(await K(i),o);return}if(r==="create"){l(await W(i,t===void 0?{}:{name:t}),o);return}if(t===void 0)throw new h(`pm workspace snapshot ${r} requires a snapshot name or fingerprint`,m.USAGE);if(r==="inspect"){l(await Y(i,t),o);return}if(r==="restore"){if(n.dryRun===!0){l(await X(i,t),o);return}let u=await D(i);l(await Q(i,t,{force:n.force===!0,author:O(s(n,"author"),u.author_default),message:s(n,"message"),lockTtlSeconds:u.locks.ttl_seconds,lockWaitMs:u.locks.wait_ms}),o);return}l(await Z(i,t),o)}async function Oe(e,t){let n=c(t),a=Date.now(),o=await ee({action:s(e,"action"),command:s(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&&d(`profile:command=contracts took_ms=${Date.now()-a}`)}async function Pe(e,t,n){let a=c(n),o=Date.now(),i={...A(t),ifAvailable:t.ifAvailable===!0,maxAttempts:t.maxAttempts};Me(e,t.next===!0);let r=t.next===!0?await H(!!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,tokenBudget:t.tokenBudget??t.token_budget,explainRanking:t.explainRanking===!0||t.explain_ranking===!0}):await B(e,!!t.force,a,i);await p(a,r),l(r,a),a.profile&&d(`profile:command=claim took_ms=${Date.now()-o}`)}function Me(e,t){if(!t&&!e)throw new h("Specify an item id or pass --next",m.USAGE);if(t&&e)throw new h("Specify either an item id or --next, not both",m.USAGE)}async function Fe(e,t,n){let a=c(n),o=Date.now(),i=await S(e,!!t.force,a,{...A(t),ownershipReleaseBypass:t.ownershipReleaseBypass===!0});await p(a,i),l(await P("release",[e],t,a,i),a),a.profile&&d(`profile:command=release took_ms=${Date.now()-o}`)}async function Le(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await D(i),u=R(r.schema),f=re(u),g=!!t.force,k=A(t),v=await B(e,g,a,k);await p(a,v);let T=await x(e,{...k,status:f,force:g},a);await p(a,T),l({id:e,action:"start_task",claim:v,update:T},a),a.profile&&d(`profile:command=start-task took_ms=${Date.now()-o}`)}async function Ne(e,t,n){let a=c(n),o=Date.now(),i=_(process.cwd(),a.path),r=await D(i),u=R(r.schema),f=!!t.force,g=A(t),k=await x(e,{...g,status:u.open_status,force:f},a);await p(a,k);let v=await S(e,f,a,g);await p(a,v),l({id:e,action:"pause_task",update:k,release:v},a),a.profile&&d(`profile:command=pause-task took_ms=${Date.now()-o}`)}async function Ve(e,t,n,a){let o=c(a),i=Date.now(),r=!!n.force,u=A(n),f=await j(e,t,{...u,validateClose:s(n,"validateClose"),force:r},o);await p(o,f);let g=await S(e,r,o,u);await p(o,g),l({id:e,action:"close_task",close:f,release:g},o),o.profile&&d(`profile:command=close-task took_ms=${Date.now()-i}`)}function me(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)",b).option("--env-clear <value>","Clear environment variable(s) for linked-test runs (NAME, repeatable)",b).option("--shared-host-safe","Apply additive shared-host-safe runtime defaults for linked-test runs").option("--pm-context <mode>","PM linked-test context mode: schema|tracker|auto (default: schema)").option("--override-linked-pm-context","Force run-level --pm-context to override per-linked-test pm_context_mode metadata").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 Vt(e){ue(e);let t=e.command("test").argument("<id>","Item id").option("--add <value>","Add linked test entry (CSV/markdown pairs or - for stdin)",b).option("--add-json <value>","Add linked test entry from JSON object/array (or - for stdin)",b).option("--remove <value>","Remove linked test entry by command/path (command=<value>, path=<value>, markdown pairs, plain value, or - for stdin)",b).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");me(t).option("--measure <value>","Record name=value[,unit=...][,threshold=...] evidence; repeatable",b).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(_e);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");me(n).action(De),e.command("test-runs-worker",{hidden:!0}).argument("<runId>","Background run id").description("Internal background worker command.").action(async(f,g,k)=>{let v=c(k);await se(f,v)}),e.command("telemetry").argument("[namespaceOrSubcommand]","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(Se),e.command("duplicates").description("Find existing duplicate clusters across all statuses without creating an item.").option("--status <value>","Lifecycle status to include (repeatable or comma-separated)",b,[]).option("--since <value>","Only inspect items created at or after this time").option("--threshold <value>","Minimum similarity score from 0 through 1").option("--limit <n>","Maximum duplicate clusters to return").action(Ce),e.command("stats").description("Show project tracker statistics.").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(Ie),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 (advisory telemetry warnings are excluded; see warnings[])").option("--fail-on-warn","Alias for --strict-exit").action(Re),e.command("validate").description("Run standalone metadata, resolution, lifecycle, files, linked-command reference, and history drift validation checks.").option("--check-metadata","Run metadata completeness checks").option("--metadata-profile <value>","Select metadata validation profile for --check-metadata (core|strict|custom)").option("--check-resolution","Run closed-item resolution metadata checks").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 validate diagnostic ID lists instead of compact summaries").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 the safe, deterministic subset of fix-hint remediations (field backfills) automatically").option("--dry-run","Preview planned --auto-fix/--prune-missing fixes without applying them").option("--fix-scope <scope>","Grant --auto-fix scopes (metadata, resolution, lifecycle; comma-separated or repeatable). Default: metadata, resolution; lifecycle must be named explicitly",b).option("--prune-missing","Remove stale linked-file/doc LINKS whose paths classified as deleted (never touches 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(Be),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",b).description("Delete optional cache artifacts by default (including expired lock debris) and show a summary.").action(Ee),e.command("workspace").description("Manage portable workspace-level SDK primitives.").command("snapshot").argument("<action>","Snapshot action: create, list, inspect, restore, delete").argument("[target]","Optional name for create; name or fingerprint otherwise").description("Create, inspect, list, restore, or delete 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(Te),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(Oe);let a=e.command("claim").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 silently when the item is already claimed by another author (returns 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("--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(Pe);w(a,"--assignee <value>","Alias for --author on lifecycle ownership commands"),w(a,"--token_budget <n>","Alias for --token-budget"),w(a,"--explain_ranking","Alias for --explain-ranking");let o=e.command("release").argument("<id>","Item id").option("--author <value>","Mutation author").option("--message <value>","History message").option("--force","Force release override").description("Release an item's active claim.").action(Fe);w(o,"--assignee <value>","Alias for --author on lifecycle ownership commands");let i=e.command("start-task").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(Le);w(i,"--assignee <value>","Alias for --author on lifecycle ownership commands");let r=e.command("pause-task").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(Ne);w(r,"--assignee <value>","Alias for --author on lifecycle ownership commands");let u=e.command("close-task").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(Ve);w(u,"--assignee <value>","Alias for --author on lifecycle ownership commands"),$e(e)}function y(e){return typeof e=="string"?e:void 0}function fe(e){return{parent:y(e.parent),allowMissingParent:e.allowMissingParent===!0?!0:void 0,tags:y(e.tags),priority:y(e.priority),body:y(e.body),description:y(e.description),author:y(e.author),message:y(e.message)}}function $e(e){for(let{name:t,describe:n}of[{name:"meet",describe:"Shortcut: create a Meeting with a start time and duration."},{name:"event",describe:"Shortcut: create an Event with a start time and duration."}])e.command(t).argument("<title>","Item title").option("--start <when>","Start time (ISO, 'now', or relative like +1h/+2d); defaults to now").option("--duration <span>","Duration from start (relative like 1h/2d); defaults to 1h when --end is omitted").option("--end <when>","End time (ISO or relative); overrides --duration").option("--location <value>","Location").option("--timezone <value>","IANA timezone (for example America/New_York)").option("--all-day","Mark as an all-day event").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description(n).action(async(a,o,i)=>{let r=c(i),u=Date.now(),g=await(t==="meet"?J:G)(a,{...fe(o),start:y(o.start),duration:y(o.duration),end:y(o.end),location:y(o.location),timezone:y(o.timezone),allDay:o.allDay===!0?!0:void 0},r);await p(r,g),l(g,r),r.profile&&d(`profile:command=${t} took_ms=${Date.now()-u}`)});e.command("remind").argument("<title>","Item title").option("--at <when>","Reminder time (ISO, 'now', or relative like +2d); defaults to +1d").option("--text <value>","Reminder text; defaults to the title").option("--parent <id>","Parent item id").option("--allow-missing-parent","Permit a parent id that does not exist yet").option("--tags <list>","Comma-separated tags").option("--priority <value>","Priority").option("--body <text>","Body/markdown content").option("--description <text>","Short description").option("--author <value>","Mutation author").option("--message <value>","History message").description("Shortcut: create a Reminder from a single point in time.").action(async(t,n,a)=>{let o=c(a),i=Date.now(),r=await z(t,{...fe(n),at:y(n.at),text:y(n.text)},o);await p(o,r),l(r,o),o.profile&&d(`profile:command=remind took_ms=${Date.now()-i}`)})}export{Vt as registerOperationCommands,Me as requireClaimTarget};
|
|
2
|
+
//# sourceMappingURL=register-operations-EQX3DLAZ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R,f as O}from"./chunk-5JO6R4BS.js";import{Ia as C,Ma as j,Oa as T,va as I,ya as U}from"./chunk-GMX5YOI3.js";import"./chunk-WYRZZ5ZE.js";import{A as d,C as b,Uk as v,Xk as E,gf as S,if as _,jf as y}from"./chunk-5KN4DZYV.js";import A from"node:fs/promises";import L 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]="054789eb-fabe-5042-8166-19961f30ebf1")}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]="3e4ba524-10cf-58e7-81ea-f48f30ca1250")}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]="defd826a-ac9b-54e4-b2a3-00d022090a10")}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]="4344c493-be53-584f-b25d-4b41bfee5079")}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]="08f5b31f-c756-577c-94e8-7b4268ba12ab")}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]="59c52ff5-9763-5244-bed3-146a547c3551")}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]="d498a64c-9680-52a9-981d-4ce86949784d")}catch{}})();var z={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 H(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(i=>typeof i=="string"):[],a=[...new Set(o.map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))];if(a.length>1)throw new b(`Multiple scaffold capabilities cannot be combined yet: ${a.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return a[0]}function G(e,t,o="extension"){let a={...e};t!==void 0&&(a[z[t]]=!0);let i=(...c)=>c.some(r=>a[r]===!0),n=(...c)=>{for(let r of c)if(typeof a[r]=="string")return a[r]};return{init:i("init"),scaffold:i("scaffold"),install:i("install"),uninstall:i("uninstall"),explore:i("explore","list"),manage:i("manage"),describe:i("describe"),markdown:i("markdown"),reload:i("reload"),doctor:i("doctor"),catalog:i("catalog"),adopt:i("adopt"),adoptAll:i("adoptAll","adopt_all","adopt-all"),activate:i("activate"),deactivate:i("deactivate"),migrate:i("migrate"),project:i("project"),local:i("local"),global:i("global"),gh:n("gh"),github:n("github"),ref:n("ref"),capability:H(e),declarative:i("declarative"),fields:n("fields"),detail:n("detail"),output:n("output"),trace:i("trace"),watch:i("watch"),runtimeProbe:i("runtimeProbe","runtime_probe","runtime-probe"),fixManagedState:i("fixManagedState","fix_managed_state","fix-managed-state"),isolated:i("isolated"),ignoreGlobal:i("ignoreGlobal","ignore_global","ignore-global"),strictExit:i("strictExit","strict_exit","strict-exit"),failOnWarn:i("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:i("dryRun","dry_run","dry-run"),vocabulary:o}}async function N(e){let t=(await A.readdir(process.cwd())).filter(a=>!a.startsWith(".")).sort((a,i)=>a.localeCompare(i)),o=[...e].sort((a,i)=>a.localeCompare(i));return t.length===o.length&&t.every((a,i)=>a===o[i])}async function q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await N(t)?["*"]:t}function P(e,t,o){let a=e.markdown===!0;if(o!==void 0&&o==="")throw new b("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!a)throw new b("--output is only supported with --markdown describe output.",d.USAGE);if(a){if(t.json)throw new b("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new b("--markdown is only supported by the describe action.",d.USAGE)}}async function B(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=L.resolve(e.outputPath);await A.mkdir(L.dirname(o),{recursive:!0}),await A.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&S(t)}}function K(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let a=e.details!==null&&typeof e.details=="object"?e.details:{},i=a.summary!==null&&typeof a.summary=="object"?a.summary:null,n=i&&typeof i.status=="string"?i.status:void 0;(e.warnings.length>0||n!==void 0&&n!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function p(e,t,o,a,i="extension"){let n=v(o),c=Date.now(),r=G(t,a,i),s=(typeof r.output=="string"?r.output:void 0)?.trim();P(r,n,s);let m=await C(e,r,n);r.markdown===!0?await B({result:m,vocabulary:i,outputPath:s,globalOptions:n}):_(m,n),K(m,r),m.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function V(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function X(e){return e instanceof b?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function F(e,t,o,a){let i=await q(e);if(i===void 0||i.length<=1){await p(i?.[0],t,o,"install",a);return}let n=v(o),c=Date.now(),r=G(t,"install",a);if(P(r,n,void 0),[r.gh,r.github].some(g=>typeof g=="string"&&g.trim().length>0))throw new b("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 s=[],m=[],w=d.GENERIC_FAILURE;for(let g of i)try{let h=await C(g,r,n),f=V(h),x=Array.isArray(h.warnings)?h.warnings:[];m.push(...x);let D=h.ok===!0;s.push({target:g,ok:D,extension:f.extension,source:f.source,destination_path:f.destination_path,activated:f.activated,settings_changed:f.settings_changed,command_paths:f.command_paths,action_paths:f.action_paths,runtime_activation_status:f.runtime_activation_status,activation_diagnostics:f.activation_diagnostics,command_discovery:f.command_discovery,verification:f.verification,warnings:x,...D?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(h){let f=X(h),x=f.exit_code;typeof x=="number"&&w===d.GENERIC_FAILURE&&x!==d.GENERIC_FAILURE&&(w=x),s.push({target:g,ok:!1,error:f})}let k=s.filter(g=>g.ok!==!0).length,M={ok:k===0,action:"install",scope:r.global===!0?"global":"project",installed_count:s.length-k,failed_count:k,targets:s,warnings:[...new Set(m)].sort((g,h)=>g.localeCompare(h))};_(M,n),k>0&&(process.exitCode=w),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function Y(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function $(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function u(e,t){return t==="package"?$(e):Y(e)}function W(e,t){let o=t==="package"?"package":"extension",a=t==="package"?"packages":"extensions",i=t,n=e.command(i).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source/name or scaffold target path (for --init/--scaffold)`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>",`Capability the --init starter targets (${I.join("|")}; default commands)`,E).option("--install",`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source`).option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${a} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${a} with update-check metadata`).option("--describe",`Map every surface a loaded ${o} registers (optionally one by name)`).option("--markdown","Render describe output as a Markdown reference document (describe only)").option("--output <path>","Write describe Markdown to a file (requires --markdown)").option("--reload",`Reload ${a} with cache-busted module imports`).option("--watch","Use watch mode with --reload").option("--doctor",`Run consolidated ${o} diagnostics (summary/deep modes)`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt an existing unmanaged ${o} into managed metadata`).option("--adopt-all",`Adopt all unmanaged ${a} into managed metadata`).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 ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} 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 operations for project or global scope. Backward-compatible with extension packages.":"Manage extension lifecycle operations for project or global scope.").action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,void 0,t)});t==="package"&&(n.alias("packages"),n.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=n.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${I.join("|")}; default commands)`,E).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)"),u(c,t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"init",t)}),u(n.command("install").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(r,l,s)=>{await F(r,s.optsWithGlobals(),s,t)}),u(n.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"uninstall",t)}),u(n.command("explore").description(`List discovered ${a} in selected scope.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"explore",t)}),u(n.command("manage").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).description(`List managed ${a} with update-check metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"manage",t)}),u(n.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(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"describe",t)}),u(n.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${a} with cache-busted module imports.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"reload",t)}),u(n.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 ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} 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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"doctor",t)}),u(n.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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"catalog",t)}),u(n.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(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"adopt",t)}),u(n.command("adopt-all").description(`Adopt all unmanaged ${a} into managed metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"adopt-all",t)}),u(n.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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"migrate",t)}),u(n.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"activate",t)}),u(n.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"deactivate",t)})}async function J(e,t,o){let a=v(o),i=Date.now(),n=await T(e,a,{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}),r=t.verbose===!0||a.json===!0;_(r?n:j(n),a),a.profile&&y(`profile:command=init took_ms=${Date.now()-i}`)}function Q(e,t,o,a){let n=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:n?"project":e??"project",resolvedAction:n?e:t??"list",resolvedKey:n?t:o,resolvedValue:n?o:a}}function Z(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 ee(e,t,o,a,i,n){let c=v(n),r=Date.now(),{resolvedScope:l,resolvedAction:s,resolvedKey:m,resolvedValue:w}=Q(e,t,o,a),k=await O(l,s,m,Z(i),c,typeof w=="string"?w:void 0);_(k,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-r}`)}var ve={normalizeExtensionOptions:G};function Ee(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,a)=>{await J(t,o,a)}),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)",E).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; 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,a,i,n,c)=>{await ee(t,o,a,i,n,c)}),W(e,"extension"),W(e,"package"),$(e.command("install").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,a)=>{await F(t,a.optsWithGlobals(),a,"package")}),$(e.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").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").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages.")).action(async(t,o,a)=>{let i=v(a),n=Date.now(),c=await R(t,a.opts(),i);_(c,i),c.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=upgrade took_ms=${Date.now()-n}`)})}export{ve as _testOnlyRegisterSetup,Ee as registerSetupCommands};
|
|
2
|
-
//# sourceMappingURL=register-setup-
|
|
1
|
+
import{a as R,f as O}from"./chunk-A2SJGHSI.js";import{Aa as U,Ka as C,Oa as j,Qa as T,xa as I}from"./chunk-ZU34C3LH.js";import"./chunk-WYRZZ5ZE.js";import{B as d,D as b,bl as v,el as E,rf as S,tf as _,uf as y}from"./chunk-HC3GM6YY.js";import A from"node:fs/promises";import L 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]="054789eb-fabe-5042-8166-19961f30ebf1")}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]="3e4ba524-10cf-58e7-81ea-f48f30ca1250")}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]="defd826a-ac9b-54e4-b2a3-00d022090a10")}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]="4344c493-be53-584f-b25d-4b41bfee5079")}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]="08f5b31f-c756-577c-94e8-7b4268ba12ab")}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]="59c52ff5-9763-5244-bed3-146a547c3551")}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]="d498a64c-9680-52a9-981d-4ce86949784d")}catch{}})();var z={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 H(e){let t=e.capability,o=typeof t=="string"?[t]:Array.isArray(t)?t.filter(i=>typeof i=="string"):[],a=[...new Set(o.map(i=>i.trim().toLowerCase()).filter(i=>i.length>0))];if(a.length>1)throw new b(`Multiple scaffold capabilities cannot be combined yet: ${a.join(", ")}. Choose one capability per scaffold.`,d.USAGE);return a[0]}function G(e,t,o="extension"){let a={...e};t!==void 0&&(a[z[t]]=!0);let i=(...c)=>c.some(r=>a[r]===!0),n=(...c)=>{for(let r of c)if(typeof a[r]=="string")return a[r]};return{init:i("init"),scaffold:i("scaffold"),install:i("install"),uninstall:i("uninstall"),explore:i("explore","list"),manage:i("manage"),describe:i("describe"),markdown:i("markdown"),reload:i("reload"),doctor:i("doctor"),catalog:i("catalog"),adopt:i("adopt"),adoptAll:i("adoptAll","adopt_all","adopt-all"),activate:i("activate"),deactivate:i("deactivate"),migrate:i("migrate"),project:i("project"),local:i("local"),global:i("global"),gh:n("gh"),github:n("github"),ref:n("ref"),capability:H(e),declarative:i("declarative"),fields:n("fields"),detail:n("detail"),output:n("output"),trace:i("trace"),watch:i("watch"),runtimeProbe:i("runtimeProbe","runtime_probe","runtime-probe"),fixManagedState:i("fixManagedState","fix_managed_state","fix-managed-state"),isolated:i("isolated"),ignoreGlobal:i("ignoreGlobal","ignore_global","ignore-global"),strictExit:i("strictExit","strict_exit","strict-exit"),failOnWarn:i("failOnWarn","fail_on_warn","fail-on-warn"),dryRun:i("dryRun","dry_run","dry-run"),vocabulary:o}}async function N(e){let t=(await A.readdir(process.cwd())).filter(a=>!a.startsWith(".")).sort((a,i)=>a.localeCompare(i)),o=[...e].sort((a,i)=>a.localeCompare(i));return t.length===o.length&&t.every((a,i)=>a===o[i])}async function q(e){let t=(e??[]).map(o=>o.trim()).filter(o=>o.length>0);return t.length<=1?t.length===0?void 0:t:await N(t)?["*"]:t}function P(e,t,o){let a=e.markdown===!0;if(o!==void 0&&o==="")throw new b("--output requires a non-empty file path.",d.USAGE);if(o!==void 0&&!a)throw new b("--output is only supported with --markdown describe output.",d.USAGE);if(a){if(t.json)throw new b("Cannot combine --json with --markdown.",d.USAGE);if(e.describe!==!0)throw new b("--markdown is only supported by the describe action.",d.USAGE)}}async function B(e){let t=U(e.result.details,e.vocabulary);if(e.outputPath!==void 0){let o=L.resolve(e.outputPath);await A.mkdir(L.dirname(o),{recursive:!0}),await A.writeFile(o,t,"utf8")}if(!e.globalOptions.quiet){for(let o of e.result.warnings)y(`warning: ${o}`);e.outputPath===void 0&&S(t)}}function K(e,t){let o=!!t.strictExit||!!t.failOnWarn;if(e.action!=="doctor"||!o)return;let a=e.details!==null&&typeof e.details=="object"?e.details:{},i=a.summary!==null&&typeof a.summary=="object"?a.summary:null,n=i&&typeof i.status=="string"?i.status:void 0;(e.warnings.length>0||n!==void 0&&n!=="ok")&&(process.exitCode=d.GENERIC_FAILURE)}async function p(e,t,o,a,i="extension"){let n=v(o),c=Date.now(),r=G(t,a,i),s=(typeof r.output=="string"?r.output:void 0)?.trim();P(r,n,s);let m=await C(e,r,n);r.markdown===!0?await B({result:m,vocabulary:i,outputPath:s,globalOptions:n}):_(m,n),K(m,r),m.ok===!1&&(process.exitCode=d.GENERIC_FAILURE),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function V(e){return e.details!==null&&typeof e.details=="object"?e.details:{}}function X(e){return e instanceof b?{message:e.message,exit_code:e.exitCode,...e.context}:{message:e instanceof Error?e.message:String(e),exit_code:d.GENERIC_FAILURE}}async function F(e,t,o,a){let i=await q(e);if(i===void 0||i.length<=1){await p(i?.[0],t,o,"install",a);return}let n=v(o),c=Date.now(),r=G(t,"install",a);if(P(r,n,void 0),[r.gh,r.github].some(g=>typeof g=="string"&&g.trim().length>0))throw new b("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 s=[],m=[],w=d.GENERIC_FAILURE;for(let g of i)try{let h=await C(g,r,n),f=V(h),x=Array.isArray(h.warnings)?h.warnings:[];m.push(...x);let D=h.ok===!0;s.push({target:g,ok:D,extension:f.extension,source:f.source,destination_path:f.destination_path,activated:f.activated,settings_changed:f.settings_changed,command_paths:f.command_paths,action_paths:f.action_paths,runtime_activation_status:f.runtime_activation_status,activation_diagnostics:f.activation_diagnostics,command_discovery:f.command_discovery,verification:f.verification,warnings:x,...D?{}:{error:{message:"Extension install returned ok=false without throwing an error.",exit_code:d.GENERIC_FAILURE,code:"extension_install_soft_failed"}}})}catch(h){let f=X(h),x=f.exit_code;typeof x=="number"&&w===d.GENERIC_FAILURE&&x!==d.GENERIC_FAILURE&&(w=x),s.push({target:g,ok:!1,error:f})}let k=s.filter(g=>g.ok!==!0).length,M={ok:k===0,action:"install",scope:r.global===!0?"global":"project",installed_count:s.length-k,failed_count:k,targets:s,warnings:[...new Set(m)].sort((g,h)=>g.localeCompare(h))};_(M,n),k>0&&(process.exitCode=w),n.profile&&y(`profile:command=extension took_ms=${Date.now()-c}`)}function Y(e){return e.option("--project","Use project extension scope (default)").option("--local","Alias for --project").option("--global","Use global extension scope")}function $(e){return e.option("--project","Use project package scope (default)").option("--local","Alias for --project").option("--global","Use global package scope")}function u(e,t){return t==="package"?$(e):Y(e)}function W(e,t){let o=t==="package"?"package":"extension",a=t==="package"?"packages":"extensions",i=t,n=e.command(i).argument("[target]",`${o[0].toUpperCase()}${o.slice(1)} source/name or scaffold target path (for --init/--scaffold)`).option("--init",`Generate a starter ${o} scaffold at target path`).option("--scaffold","Alias for --init").option("--capability <kind>",`Capability the --init starter targets (${I.join("|")}; default commands)`,E).option("--install",`Install ${o} from local path, bundled alias, npm: source, wildcard, or GitHub source`).option("--uninstall",`Uninstall an installed ${o}`).option("--explore",`List discovered ${a} in selected scope`).option("--list","Alias for --explore").option("--manage",`List managed ${a} with update-check metadata`).option("--describe",`Map every surface a loaded ${o} registers (optionally one by name)`).option("--markdown","Render describe output as a Markdown reference document (describe only)").option("--output <path>","Write describe Markdown to a file (requires --markdown)").option("--reload",`Reload ${a} with cache-busted module imports`).option("--watch","Use watch mode with --reload").option("--doctor",`Run consolidated ${o} diagnostics (summary/deep modes)`).option("--catalog",`List bundled first-party ${o} catalog metadata`).option("--adopt",`Adopt an existing unmanaged ${o} into managed metadata`).option("--adopt-all",`Adopt all unmanaged ${a} into managed metadata`).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 ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} 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 operations for project or global scope. Backward-compatible with extension packages.":"Manage extension lifecycle operations for project or global scope.").action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,void 0,t)});t==="package"&&(n.alias("packages"),n.option("--declarative","Scaffold the composeExtension blueprint starter (any capability)"));let c=n.command("init").alias("scaffold").argument("<target>","Scaffold target directory path").option("--capability <kind>",`Capability the starter targets (${I.join("|")}; default commands)`,E).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)"),u(c,t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"init",t)}),u(n.command("install").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(r,l,s)=>{await F(r,s.optsWithGlobals(),s,t)}),u(n.command("uninstall").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Uninstall an installed ${o}.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"uninstall",t)}),u(n.command("explore").description(`List discovered ${a} in selected scope.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"explore",t)}),u(n.command("manage").option("--runtime-probe","Opt-in runtime activation probe for manage output parity").option("--fix-managed-state",`Adopt unmanaged ${a} before diagnostics/update checks`).description(`List managed ${a} with update-check metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"manage",t)}),u(n.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(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"describe",t)}),u(n.command("reload").option("--watch","Use watch mode for repeated reload checks").description(`Reload ${a} with cache-busted module imports.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"reload",t)}),u(n.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 ${a} before diagnostics/update checks`).option("--isolated",`Run doctor against project-scope ${a} 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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"doctor",t)}),u(n.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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"catalog",t)}),u(n.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(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"adopt",t)}),u(n.command("adopt-all").description(`Adopt all unmanaged ${a} into managed metadata.`),t).action(async(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"adopt-all",t)}),u(n.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(r,l)=>{await p(void 0,l.optsWithGlobals(),l,"migrate",t)}),u(n.command("activate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Activate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"activate",t)}),u(n.command("deactivate").argument("<target>",`${o[0].toUpperCase()}${o.slice(1)} name`).description(`Deactivate a ${o} in selected scope settings.`),t).action(async(r,l,s)=>{await p(r,s.optsWithGlobals(),s,"deactivate",t)})}async function J(e,t,o){let a=v(o),i=Date.now(),n=await T(e,a,{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}),r=t.verbose===!0||a.json===!0;_(r?n:j(n),a),a.profile&&y(`profile:command=init took_ms=${Date.now()-i}`)}function Q(e,t,o,a){let n=e!==void 0&&new Set(["get","set","list","export"]).has(e);return{resolvedScope:n?"project":e??"project",resolvedAction:n?e:t??"list",resolvedKey:n?t:o,resolvedValue:n?o:a}}function Z(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 ee(e,t,o,a,i,n){let c=v(n),r=Date.now(),{resolvedScope:l,resolvedAction:s,resolvedKey:m,resolvedValue:w}=Q(e,t,o,a),k=await O(l,s,m,Z(i),c,typeof w=="string"?w:void 0);_(k,c),c.profile&&y(`profile:command=config took_ms=${Date.now()-r}`)}var ve={normalizeExtensionOptions:G};function Ee(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,a)=>{await J(t,o,a)}),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)",E).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; 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,a,i,n,c)=>{await ee(t,o,a,i,n,c)}),W(e,"extension"),W(e,"package"),$(e.command("install").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,a)=>{await F(t,a.optsWithGlobals(),a,"package")}),$(e.command("upgrade").argument("[target]","Optional managed package name/source to upgrade; omit to upgrade pm CLI and all managed packages").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").description("Upgrade the pm CLI/SDK and refresh managed installable pm packages.")).action(async(t,o,a)=>{let i=v(a),n=Date.now(),c=await R(t,a.opts(),i);_(c,i),c.ok||(process.exitCode=d.GENERIC_FAILURE),i.profile&&y(`profile:command=upgrade took_ms=${Date.now()-n}`)})}export{ve as _testOnlyRegisterSetup,Ee as registerSetupCommands};
|
|
2
|
+
//# sourceMappingURL=register-setup-NOCOOWQY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$a as st,Aa as Z,Ca as tt,Ka as et,L as V,M as S,Ma as rt,Q as W,Ra as nt,Sa as ot,Za as it,bb as P,cb as D,fa as Y,ga as X,ha as J,k as z,n as C,na as p,qa as K,sa as _,ua as d,va as L,za as Q}from"./chunk-2VVP5RAA.js";import{D as M,J as G,M as B,N as q,P as j,p as k,q as H,r as m}from"./chunk-NL57J7BZ.js";import{Y as c,Z as l}from"./chunk-ZG54B4XG.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]="47c087c2-124a-58b7-a5c9-09403235f4a2")}catch{}})();function yt(t,e){let n=-1;return t.forEach((r,o)=>{let i=Date.parse(r.ts);if(!Number.isFinite(i))throw new l(`History for this item contains invalid timestamp at entry ${o+1}.`,c.GENERIC_FAILURE);i<=e&&(n=o)}),n}function wt(t){let e=t[0]?.ts??null,n=t.at(-1)?.ts??null,r={code:"history_target_out_of_range",required:"Choose a target within the available item history.",why:"Point-in-time reads and restores can only reconstruct recorded versions.",examples:[],nextSteps:["Run pm history <id> to inspect available versions and timestamps."],valid_range:{first_version:null,last_version:null,first_timestamp:e,last_timestamp:n}};return n!==null&&(r.examples=["1",String(t.length),n],r.valid_range.first_version=1,r.valid_range.last_version=t.length),{guidance:r,lastTimestamp:n}}function pt(t,e){let n={};if(e instanceof Error&&e.message.trim().length>0&&(n.reason=e.message.trim()),typeof e!="object"||e===null)return n;let r=e;if(typeof r.index=="number"&&Number.isInteger(r.index)&&r.index>=0&&(n.patchIndex=r.index),typeof r.operation=="object"&&r.operation!==null){let o=r.operation;Object.assign(n,Object.fromEntries(["op","path","from"].flatMap(i=>{let s=o[i];return typeof s=="string"?[[i,s]]:[]})))}if(n.patchIndex!==void 0){let o=t[n.patchIndex];o&&(n.op??=o.op,n.path??=o.path,n.from??=o.from)}return n}function Mt(t,e,n={}){let r=t.trim(),o=n.errorSubject??"history",i=o==="restore"?"Restore":"History",{guidance:s,lastTimestamp:a}=wt(e);if(!r)throw new l(`Missing ${o} target. Use a timestamp or version number.`,c.USAGE,s);if(/^\d+$/.test(r)){let u=Number(r);if(!Number.isSafeInteger(u)||u<1||u>e.length)throw new l(`${i} version must be between 1 and ${e.length} for this item.`,c.USAGE,s);return{kind:"version",raw:r,historyIndex:u-1}}let h=Date.parse(r);if(!Number.isFinite(h))throw new l(`Invalid ${o} target "${t}". Use a positive version number or ISO timestamp.`,c.USAGE,s);let f=yt(e,h);if(f<0||n.allowFutureTimestamp!==!0&&h>Date.parse(a))throw new l(o==="restore"?`No history entries exist at or before timestamp ${r}.`:`No history entry exists at timestamp ${r}.`,c.USAGE,s);return{kind:"timestamp",raw:r,historyIndex:f}}function A(t,e,n,r){let o=Q(t,e);if(o.ok)return o.document;let i=pt(e,o.error),s=[`history_op=${r}`,i.patchIndex===void 0?null:`patch_index=${i.patchIndex}`,i.op?`op=${i.op}`:null,i.path?`path=${i.path}`:null,i.from?`from=${i.from}`:null].filter(a=>a!==null);throw new l(`Failed to apply history patch at entry ${n} (${s.join(", ")}). ${i.reason??String(o.error)}`,c.GENERIC_FAILURE)}function Gt(t,e){let n=structuredClone(_);for(let r=0;r<=e;r+=1){let o=t[r];if(!o)throw new l(`History target entry ${r+1} does not exist.`,c.USAGE);if(d(n)!==o.before_hash)throw new l(`History hash mismatch before replay at entry ${r+1}.`,c.GENERIC_FAILURE);if(n=A(n,o.patch,r+1,o.op),d(n)!==o.after_hash)throw new l(`History hash mismatch after replay at entry ${r+1}.`,c.GENERIC_FAILURE)}return n}function Bt(t,e){if(Object.keys(t.metadata).length>0)return t;throw new l(`History target ${e.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,c.USAGE)}import U from"node:fs/promises";import gt from"node:fs/promises";(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]="a2ec9f1a-aae2-59d5-8c9a-7acd8bf5a7a2")}catch{}})();function It(t){if(!t.itemDocument)return[];let e=t.itemDocument.metadata?.assignee?.trim();if(!e||e===t.author||t.force)return[];let n=et(t.settings);if(n.ownership_enforcement==="strict")throw new l(`Item ${t.subjectId} is assigned to ${e}. Use --force to override.`,c.CONFLICT);return n.ownership_enforcement==="warn"?[`ownership_warning:assignee_conflict:${t.subjectId}:${e}`]:[]}async function _t(t){let e=await H(t.subject.historyPath);if(e!==t.historyRawBeforeLock)throw new l(`History for ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);let n=await P(t.pmRoot,t.subject.id,t.settings.id_prefix,t.settings.item_format,t.typeRegistry.type_to_folder),r=n?await D(n,{schema:t.settings.schema}):null;if((r?.raw??null)!==(t.currentItemRawBeforeLock??null))throw new l(`Item ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);return{historyRawUnderLock:e,locatedUnderLock:n,loadedItemUnderLock:r}}async function Zt(t){let e=t.writeHistoryRaw??m;try{await e(t.historyPath,t.nextHistoryRaw),await p(t.historyPath)}catch(n){try{t.historyRawUnderLock===null?await gt.rm(t.historyPath,{force:!0}):await e(t.historyPath,t.historyRawUnderLock),await p(t.historyPath)}catch(r){throw new AggregateError([n,r],`History rewrite failed and rollback also failed: ${String(n)}`)}throw n}}async function at(t){let e=[...It({itemDocument:t.itemDocument,subjectId:t.subject.id,author:t.author,force:t.force,settings:t.settings})],n=await W(t.pmRoot,t.subject.id,t.settings.locks.ttl_seconds,t.author,!!t.force,t.settings.governance.force_required_for_stale_lock,t.settings.locks.wait_ms);try{let r=await _t({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItemRawBeforeLock,operation:t.operation});return await t.applyRewrite(r),t.applyPostRewrite&&e.push(...await t.applyPostRewrite(r)),e}finally{await n()}}(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]="cd2a27ec-0f12-591d-ab34-529ddda05063")}catch{}})();function ct(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}function xt(t){let e=[];for(let n of t)e.includes(n)||e.push(n);return e.includes("g")||e.push("g"),e.join("")}function bt(t){let e=t.trim();if(e.length===0)throw new l("history-redact --regex requires a non-empty pattern.",c.USAGE);let n=e,r="g";if(e.startsWith("/")&&e.length>1){let o=e.lastIndexOf("/");o>0&&(n=e.slice(1,o),r=xt(e.slice(o+1)))}if(n.length===0)throw new l("history-redact --regex cannot use an empty pattern.",c.USAGE);try{new RegExp(n,r)}catch{throw new l("Invalid --regex value; provide a valid JavaScript regular expression.",c.USAGE)}return{kind:"regex",source:n,flags:r}}function Rt(t,e){let n=[...new Set(ct(t).map(i=>i.trim()))].filter(i=>i.length>0).map(i=>({kind:"literal",value:i})),r=[...new Set(ct(e).map(i=>i.trim()))].filter(i=>i.length>0).map(bt),o=[...n,...r];if(o.length===0)throw new l("history-redact requires at least one matcher via --literal or --regex.",c.USAGE,{code:"missing_required_argument",required:"Provide --literal <value> and/or --regex <pattern>.",examples:['pm history-redact pm-a1b2 --literal "[redacted_path_prefix]/private"','pm history-redact pm-a1b2 --regex "/192\\\\.168\\\\.[0-9.]+/g" --replacement "[scrubbed_ip]"']});return o}function Et(t,e,n){if(e.length===0)return{value:t,replacements:0};let r=0,o=0;for(;r<=t.length;){let i=t.indexOf(e,r);if(i===-1)break;o+=1,r=i+Math.max(1,e.length)}return o===0?{value:t,replacements:0}:{value:t.split(e).join(n),replacements:o}}function vt(t,e,n){let r=new RegExp(e.source,e.flags),o=[...t.matchAll(r)];return o.length===0?{value:t,replacements:0}:{value:t.replace(r,n),replacements:o.length}}function lt(t,e,n){let r=t,o=0;for(let i of e){let s=i.kind==="literal"?Et(r,i.value,n):vt(r,i,n);r=s.value,o+=s.replacements}return{value:r,replacements:o}}function F(t,e,n){if(typeof t=="string")return lt(t,e,n);if(Array.isArray(t)){let r=0;return{value:t.map(i=>{let s=F(i,e,n);return r+=s.replacements,s.value}),replacements:r}}if(typeof t=="object"&&t!==null){let r=0,o={};for(let[i,s]of Object.entries(t)){let a=F(s,e,n);r+=a.replacements,o[i]=a.value}return{value:o,replacements:r}}return{value:t,replacements:0}}function kt(t){let e=structuredClone(_),n=0,r=0;for(let o=0;o<t.length;o+=1){let i=t[o];d(e)!==i.before_hash&&(n+=1),e=A(e,i.patch,o+1,i.op),d(e)!==i.after_hash&&(r+=1)}return{hashMismatchesBefore:n,hashMismatchesAfter:r,finalDocument:e}}function Ht(t,e,n){let r=0,o=!1,i=t.message;if(typeof t.message=="string"){let a=lt(t.message,e,n);i=a.value,r+=a.replacements,a.replacements>0&&(o=!0)}let s=t.patch.map(a=>{if(!Object.prototype.hasOwnProperty.call(a,"value"))return a;let h=F(a.value,e,n);return r+=h.replacements,h.replacements>0?(o=!0,{...a,value:h.value}):a});return{entry:{...t,message:i,patch:s},replacements:r,changed:o}}function Pt(t,e,n){let r=structuredClone(_),o=0,i=0,s=[];for(let a=0;a<t.length;a+=1){let h=Ht(t[a],e,n);i+=h.replacements,h.changed&&(o+=1);let f=d(r);r=A(r,h.entry.patch,a+1,h.entry.op);let u=d(r);s.push({...h.entry,before_hash:f,after_hash:u})}return{entries:s,finalDocument:r,entriesChanged:o,replacements:i}}function Dt(t){return Object.keys(t.metadata).length>0}async function At(t,e){let n=t.located?.itemPath??null;if(!t.located)return{raw:null,path:n,document:null};let r=await D(t.located,{schema:e.schema});return{raw:r.raw,path:n,document:r.document}}function Tt(t){if(!Dt(t.finalDocument))return{raw:null,path:null,document:null};let e=X(L(t.finalDocument),{schema:t.settings.schema});if(e.metadata.id!==t.subject.id)throw new l("history-redact would change the item id; narrow your patterns.",c.USAGE);return{document:e,path:q(t.pmRoot,e.metadata.type,t.subject.id,"toon",t.typeToFolder),raw:Y(e,{format:"toon",schema:t.settings.schema})}}function $t(t,e){return typeof t.message=="string"&&t.message.trim().length>0?t.message:`history-redact replaced ${e.replacements} match(es) across ${e.entriesChanged} entr${e.entriesChanged===1?"y":"ies"}.`}function jt(t){let e=[...t.rewritten.entries];if(t.dryRun||!t.changed)return{rewrittenEntries:e,auditEntryAdded:!1};let n=t.nextItemDocument??L(t.rewritten.finalDocument);return e.push(K({nowIso:S(),author:t.author,op:"history_redact",before:n,after:n,message:t.message})),{rewrittenEntries:e,auditEntryAdded:!0}}async function Ct(t){let e=[];return at({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItem.raw,operation:"history-redact",author:t.author,force:t.force,itemDocument:t.currentItem.document,applyRewrite:async({historyRawUnderLock:n})=>{let r=await it(t.pmRoot,t.author),o=new Set;t.currentItem.path&&o.add(t.currentItem.path),t.nextItem.path&&o.add(t.nextItem.path);let i=new Map;t.currentItem.path&&t.currentItem.raw!==null&&i.set(t.currentItem.path,t.currentItem.raw);let s=()=>{};try{try{t.nextItem.path&&t.nextItem.raw!==null&&t.nextItem.raw!==t.currentItem.raw&&await m(t.nextItem.path,t.nextItem.raw),t.currentItem.path&&(!t.nextItem.path||t.nextItem.path!==t.currentItem.path)&&await U.rm(t.currentItem.path,{force:!0}),await m(t.subject.historyPath,tt(t.rewrittenEntries))}catch(h){try{await St(t.subject.historyPath,n,o,i)}finally{await p(t.subject.historyPath)}throw h}await p(t.subject.historyPath);let a=t.nextItem.path??t.currentItem.path;a&&(e=await st({pmRoot:t.pmRoot,preferredFormat:t.settings.item_format,typeToFolder:t.typeRegistry.type_to_folder,schema:t.settings.schema,itemPath:a,...t.currentItem.path?{previousItemPath:t.currentItem.path}:{},document:t.nextItem.document}))}finally{await r().catch(a=>{s=()=>{throw a}})}s()},applyPostRewrite:async()=>[...e,...await Lt(t.subject.historyPath,[t.nextItem.path,t.currentItem.path])]})}async function St(t,e,n,r){e===null?await U.rm(t,{force:!0}):await m(t,e);for(let o of n){let i=r.get(o);i===void 0?await U.rm(o,{force:!0}):await m(o,i)}}async function Lt(t,e){let n=[],r=new Set(e.filter(o=>o!==null));for(let o of r)n.push(...await C({path:o,scope:"project",op:"history_redact"}));return n.push(...await C({path:t,scope:"project",op:"history_redact:history"})),n}async function Ut(t,e,n,r){let o=await P(t,e,n.id_prefix,n.item_format,r);if(o)return{id:o.id,historyPath:j(t,o.id),located:o};let i=ot(e,n.id_prefix),s=nt(e),a=i===s?[i]:[i,s];for(let h of a){let f=j(t,h);if(await k(f))return{id:h,historyPath:f,located:null}}throw new l(`Item ${e} not found`,c.NOT_FOUND)}async function xe(t,e,n){let r=G(process.cwd(),n.path);if(!await k(B(r)))throw new l(`Tracker is not initialized at ${r}. Run pm init first.`,c.NOT_FOUND);let o=await rt(r),i=M(o,z()),s=e.replacement??"",a=s.length===0,h=a?"[redacted]":s,f=Rt(e.literal,e.regex),u=await Ut(r,t,o,i.type_to_folder);if(!await k(u.historyPath))throw new l(`No history stream exists for ${u.id}.`,c.NOT_FOUND);let ht=await H(u.historyPath),x=await J(u.historyPath,u.id);if(x.length===0)throw new l(`No history entries exist for ${u.id}; nothing to redact.`,c.USAGE);let b=kt(x),y=Pt(x,f,h),T=b.hashMismatchesBefore+b.hashMismatchesAfter,$=!!e.dryRun,R=y.replacements>0,E=[];T>0&&E.push(`history_redact_preexisting_hash_mismatches:${T}`),R||E.push("history_redact_no_matches");let g=await At(u,o),w=Tt({pmRoot:r,subject:u,settings:o,typeToFolder:i.type_to_folder,finalDocument:y.finalDocument}),ut=(g.path??null)!==(w.path??null)||(g.raw??null)!==(w.raw??null),N=V(e.author,o.author_default),ft=$t(e,y),{rewrittenEntries:O,auditEntryAdded:dt}=jt({rewritten:y,dryRun:$,changed:R,nextItemDocument:w.document,author:N,message:ft}),v=Z(O);if(!v.ok)throw new l(`history-redact produced an invalid rewritten chain (${v.errors.join(", ")}).`,c.GENERIC_FAILURE);return!$&&R&&E.push(...await Ct({pmRoot:r,subject:u,settings:o,typeRegistry:i,historyRawBeforeLock:ht,currentItem:g,nextItem:w,author:N,force:e.force,rewrittenEntries:O})),{id:u.id,dry_run:$,changed:R,patterns:{literal_count:f.filter(I=>I.kind==="literal").length,regex_count:f.filter(I=>I.kind==="regex").length,total_count:f.length,replacement_is_default:a},history:{path:u.historyPath,entries_scanned:x.length,entries_changed:y.entriesChanged,replacements:y.replacements,hash_mismatches_before:b.hashMismatchesBefore,hash_mismatches_after:b.hashMismatchesAfter,preexisting_hash_mismatches:T,audit_entry_added:dt,verify_ok:v.ok,verify_errors:v.errors},item:{existed_before:g.path!==null,exists_after:w.path!==null,path_before:g.path,path_after:w.path,changed:ut},warnings:[...new Set(E)].sort((I,mt)=>I.localeCompare(mt)),generated_at:S()}}export{Mt as a,A as b,Gt as c,Bt as d,Zt as e,at as f,Ut as g,xe as h};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{Aa as _,Ca as d,Da as L,Ha as Q,Ia as Z,Ka as tt,Sa as et,T as V,U as S,Ua as rt,Y as W,Za as nt,_a as ot,fb as it,hb as st,jb as P,k as z,kb as D,n as C,na as Y,oa as X,pa as J,va as p,ya as K}from"./chunk-ERAAFLPS.js";import{E as M,K as G,N as B,O as q,Q as j,p as k,r as H,s as m}from"./chunk-KDH5OX3D.js";import{Y as c,Z as l}from"./chunk-D4PIWE6D.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]="47c087c2-124a-58b7-a5c9-09403235f4a2")}catch{}})();function yt(t,e){let n=-1;return t.forEach((r,o)=>{let i=Date.parse(r.ts);if(!Number.isFinite(i))throw new l(`History for this item contains invalid timestamp at entry ${o+1}.`,c.GENERIC_FAILURE);i<=e&&(n=o)}),n}function wt(t){let e=t[0]?.ts??null,n=t.at(-1)?.ts??null,r={code:"history_target_out_of_range",required:"Choose a target within the available item history.",why:"Point-in-time reads and restores can only reconstruct recorded versions.",examples:[],nextSteps:["Run pm history <id> to inspect available versions and timestamps."],valid_range:{first_version:null,last_version:null,first_timestamp:e,last_timestamp:n}};return n!==null&&(r.examples=["1",String(t.length),n],r.valid_range.first_version=1,r.valid_range.last_version=t.length),{guidance:r,lastTimestamp:n}}function pt(t,e){let n={};if(e instanceof Error&&e.message.trim().length>0&&(n.reason=e.message.trim()),typeof e!="object"||e===null)return n;let r=e;if(typeof r.index=="number"&&Number.isInteger(r.index)&&r.index>=0&&(n.patchIndex=r.index),typeof r.operation=="object"&&r.operation!==null){let o=r.operation;Object.assign(n,Object.fromEntries(["op","path","from"].flatMap(i=>{let s=o[i];return typeof s=="string"?[[i,s]]:[]})))}if(n.patchIndex!==void 0){let o=t[n.patchIndex];o&&(n.op??=o.op,n.path??=o.path,n.from??=o.from)}return n}function Mt(t,e,n={}){let r=t.trim(),o=n.errorSubject??"history",i=o==="restore"?"Restore":"History",{guidance:s,lastTimestamp:a}=wt(e);if(!r)throw new l(`Missing ${o} target. Use a timestamp or version number.`,c.USAGE,s);if(/^\d+$/.test(r)){let u=Number(r);if(!Number.isSafeInteger(u)||u<1||u>e.length)throw new l(`${i} version must be between 1 and ${e.length} for this item.`,c.USAGE,s);return{kind:"version",raw:r,historyIndex:u-1}}let h=Date.parse(r);if(!Number.isFinite(h))throw new l(`Invalid ${o} target "${t}". Use a positive version number or ISO timestamp.`,c.USAGE,s);let f=yt(e,h);if(f<0||n.allowFutureTimestamp!==!0&&h>Date.parse(a))throw new l(o==="restore"?`No history entries exist at or before timestamp ${r}.`:`No history entry exists at timestamp ${r}.`,c.USAGE,s);return{kind:"timestamp",raw:r,historyIndex:f}}function A(t,e,n,r){let o=Q(t,e);if(o.ok)return o.document;let i=pt(e,o.error),s=[`history_op=${r}`,i.patchIndex===void 0?null:`patch_index=${i.patchIndex}`,i.op?`op=${i.op}`:null,i.path?`path=${i.path}`:null,i.from?`from=${i.from}`:null].filter(a=>a!==null);throw new l(`Failed to apply history patch at entry ${n} (${s.join(", ")}). ${i.reason??String(o.error)}`,c.GENERIC_FAILURE)}function Gt(t,e){let n=structuredClone(_);for(let r=0;r<=e;r+=1){let o=t[r];if(!o)throw new l(`History target entry ${r+1} does not exist.`,c.USAGE);if(d(n)!==o.before_hash)throw new l(`History hash mismatch before replay at entry ${r+1}.`,c.GENERIC_FAILURE);if(n=A(n,o.patch,r+1,o.op),d(n)!==o.after_hash)throw new l(`History hash mismatch after replay at entry ${r+1}.`,c.GENERIC_FAILURE)}return n}function Bt(t,e){if(Object.keys(t.metadata).length>0)return t;throw new l(`History target ${e.raw} resolves to a deleted state; choose a version or timestamp where the item exists.`,c.USAGE)}import U from"node:fs/promises";import gt from"node:fs/promises";(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]="a2ec9f1a-aae2-59d5-8c9a-7acd8bf5a7a2")}catch{}})();function It(t){if(!t.itemDocument)return[];let e=t.itemDocument.metadata?.assignee?.trim();if(!e||e===t.author||t.force)return[];let n=et(t.settings);if(n.ownership_enforcement==="strict")throw new l(`Item ${t.subjectId} is assigned to ${e}. Use --force to override.`,c.CONFLICT);return n.ownership_enforcement==="warn"?[`ownership_warning:assignee_conflict:${t.subjectId}:${e}`]:[]}async function _t(t){let e=await H(t.subject.historyPath);if(e!==t.historyRawBeforeLock)throw new l(`History for ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);let n=await P(t.pmRoot,t.subject.id,t.settings.id_prefix,t.settings.item_format,t.typeRegistry.type_to_folder),r=n?await D(n,{schema:t.settings.schema}):null;if((r?.raw??null)!==(t.currentItemRawBeforeLock??null))throw new l(`Item ${t.subject.id} changed while waiting for lock; retry ${t.operation}.`,c.CONFLICT);return{historyRawUnderLock:e,locatedUnderLock:n,loadedItemUnderLock:r}}async function Zt(t){let e=t.writeHistoryRaw??m;try{await e(t.historyPath,t.nextHistoryRaw),await p(t.historyPath)}catch(n){try{t.historyRawUnderLock===null?await gt.rm(t.historyPath,{force:!0}):await e(t.historyPath,t.historyRawUnderLock),await p(t.historyPath)}catch(r){throw new AggregateError([n,r],`History rewrite failed and rollback also failed: ${String(n)}`)}throw n}}async function at(t){let e=[...It({itemDocument:t.itemDocument,subjectId:t.subject.id,author:t.author,force:t.force,settings:t.settings})],n=await W(t.pmRoot,t.subject.id,t.settings.locks.ttl_seconds,t.author,!!t.force,t.settings.governance.force_required_for_stale_lock,t.settings.locks.wait_ms);try{let r=await _t({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItemRawBeforeLock,operation:t.operation});return await t.applyRewrite(r),t.applyPostRewrite&&e.push(...await t.applyPostRewrite(r)),e}finally{await n()}}(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]="cd2a27ec-0f12-591d-ab34-529ddda05063")}catch{}})();function ct(t){return Array.isArray(t)?t:typeof t=="string"?[t]:[]}function xt(t){let e=[];for(let n of t)e.includes(n)||e.push(n);return e.includes("g")||e.push("g"),e.join("")}function bt(t){let e=t.trim();if(e.length===0)throw new l("history-redact --regex requires a non-empty pattern.",c.USAGE);let n=e,r="g";if(e.startsWith("/")&&e.length>1){let o=e.lastIndexOf("/");o>0&&(n=e.slice(1,o),r=xt(e.slice(o+1)))}if(n.length===0)throw new l("history-redact --regex cannot use an empty pattern.",c.USAGE);try{new RegExp(n,r)}catch{throw new l("Invalid --regex value; provide a valid JavaScript regular expression.",c.USAGE)}return{kind:"regex",source:n,flags:r}}function Rt(t,e){let n=[...new Set(ct(t).map(i=>i.trim()))].filter(i=>i.length>0).map(i=>({kind:"literal",value:i})),r=[...new Set(ct(e).map(i=>i.trim()))].filter(i=>i.length>0).map(bt),o=[...n,...r];if(o.length===0)throw new l("history-redact requires at least one matcher via --literal or --regex.",c.USAGE,{code:"missing_required_argument",required:"Provide --literal <value> and/or --regex <pattern>.",examples:['pm history-redact pm-a1b2 --literal "[redacted_path_prefix]/private"','pm history-redact pm-a1b2 --regex "/192\\\\.168\\\\.[0-9.]+/g" --replacement "[scrubbed_ip]"']});return o}function Et(t,e,n){if(e.length===0)return{value:t,replacements:0};let r=0,o=0;for(;r<=t.length;){let i=t.indexOf(e,r);if(i===-1)break;o+=1,r=i+Math.max(1,e.length)}return o===0?{value:t,replacements:0}:{value:t.split(e).join(n),replacements:o}}function vt(t,e,n){let r=new RegExp(e.source,e.flags),o=[...t.matchAll(r)];return o.length===0?{value:t,replacements:0}:{value:t.replace(r,n),replacements:o.length}}function lt(t,e,n){let r=t,o=0;for(let i of e){let s=i.kind==="literal"?Et(r,i.value,n):vt(r,i,n);r=s.value,o+=s.replacements}return{value:r,replacements:o}}function F(t,e,n){if(typeof t=="string")return lt(t,e,n);if(Array.isArray(t)){let r=0;return{value:t.map(i=>{let s=F(i,e,n);return r+=s.replacements,s.value}),replacements:r}}if(typeof t=="object"&&t!==null){let r=0,o={};for(let[i,s]of Object.entries(t)){let a=F(s,e,n);r+=a.replacements,o[i]=a.value}return{value:o,replacements:r}}return{value:t,replacements:0}}function kt(t){let e=structuredClone(_),n=0,r=0;for(let o=0;o<t.length;o+=1){let i=t[o];d(e)!==i.before_hash&&(n+=1),e=A(e,i.patch,o+1,i.op),d(e)!==i.after_hash&&(r+=1)}return{hashMismatchesBefore:n,hashMismatchesAfter:r,finalDocument:e}}function Ht(t,e,n){let r=0,o=!1,i=t.message;if(typeof t.message=="string"){let a=lt(t.message,e,n);i=a.value,r+=a.replacements,a.replacements>0&&(o=!0)}let s=t.patch.map(a=>{if(!Object.prototype.hasOwnProperty.call(a,"value"))return a;let h=F(a.value,e,n);return r+=h.replacements,h.replacements>0?(o=!0,{...a,value:h.value}):a});return{entry:{...t,message:i,patch:s},replacements:r,changed:o}}function Pt(t,e,n){let r=structuredClone(_),o=0,i=0,s=[];for(let a=0;a<t.length;a+=1){let h=Ht(t[a],e,n);i+=h.replacements,h.changed&&(o+=1);let f=d(r);r=A(r,h.entry.patch,a+1,h.entry.op);let u=d(r);s.push({...h.entry,before_hash:f,after_hash:u})}return{entries:s,finalDocument:r,entriesChanged:o,replacements:i}}function Dt(t){return Object.keys(t.metadata).length>0}async function At(t,e){let n=t.located?.itemPath??null;if(!t.located)return{raw:null,path:n,document:null};let r=await D(t.located,{schema:e.schema});return{raw:r.raw,path:n,document:r.document}}function Tt(t){if(!Dt(t.finalDocument))return{raw:null,path:null,document:null};let e=X(L(t.finalDocument),{schema:t.settings.schema});if(e.metadata.id!==t.subject.id)throw new l("history-redact would change the item id; narrow your patterns.",c.USAGE);return{document:e,path:q(t.pmRoot,e.metadata.type,t.subject.id,"toon",t.typeToFolder),raw:Y(e,{format:"toon",schema:t.settings.schema})}}function $t(t,e){return typeof t.message=="string"&&t.message.trim().length>0?t.message:`history-redact replaced ${e.replacements} match(es) across ${e.entriesChanged} entr${e.entriesChanged===1?"y":"ies"}.`}function jt(t){let e=[...t.rewritten.entries];if(t.dryRun||!t.changed)return{rewrittenEntries:e,auditEntryAdded:!1};let n=t.nextItemDocument??L(t.rewritten.finalDocument);return e.push(K({nowIso:S(),author:t.author,op:"history_redact",before:n,after:n,message:t.message})),{rewrittenEntries:e,auditEntryAdded:!0}}async function Ct(t){let e=[];return at({pmRoot:t.pmRoot,subject:t.subject,settings:t.settings,typeRegistry:t.typeRegistry,historyRawBeforeLock:t.historyRawBeforeLock,currentItemRawBeforeLock:t.currentItem.raw,operation:"history-redact",author:t.author,force:t.force,itemDocument:t.currentItem.document,applyRewrite:async({historyRawUnderLock:n})=>{let r=await it(t.pmRoot,t.author),o=new Set;t.currentItem.path&&o.add(t.currentItem.path),t.nextItem.path&&o.add(t.nextItem.path);let i=new Map;t.currentItem.path&&t.currentItem.raw!==null&&i.set(t.currentItem.path,t.currentItem.raw);let s=()=>{};try{try{t.nextItem.path&&t.nextItem.raw!==null&&t.nextItem.raw!==t.currentItem.raw&&await m(t.nextItem.path,t.nextItem.raw),t.currentItem.path&&(!t.nextItem.path||t.nextItem.path!==t.currentItem.path)&&await U.rm(t.currentItem.path,{force:!0}),await m(t.subject.historyPath,tt(t.rewrittenEntries))}catch(h){try{await St(t.subject.historyPath,n,o,i)}finally{await p(t.subject.historyPath)}throw h}await p(t.subject.historyPath);let a=t.nextItem.path??t.currentItem.path;a&&(e=await st({pmRoot:t.pmRoot,preferredFormat:t.settings.item_format,typeToFolder:t.typeRegistry.type_to_folder,schema:t.settings.schema,itemPath:a,...t.currentItem.path?{previousItemPath:t.currentItem.path}:{},document:t.nextItem.document}))}finally{await r().catch(a=>{s=()=>{throw a}})}s()},applyPostRewrite:async()=>[...e,...await Lt(t.subject.historyPath,[t.nextItem.path,t.currentItem.path])]})}async function St(t,e,n,r){e===null?await U.rm(t,{force:!0}):await m(t,e);for(let o of n){let i=r.get(o);i===void 0?await U.rm(o,{force:!0}):await m(o,i)}}async function Lt(t,e){let n=[],r=new Set(e.filter(o=>o!==null));for(let o of r)n.push(...await C({path:o,scope:"project",op:"history_redact"}));return n.push(...await C({path:t,scope:"project",op:"history_redact:history"})),n}async function Ut(t,e,n,r){let o=await P(t,e,n.id_prefix,n.item_format,r);if(o)return{id:o.id,historyPath:j(t,o.id),located:o};let i=ot(e,n.id_prefix),s=nt(e),a=i===s?[i]:[i,s];for(let h of a){let f=j(t,h);if(await k(f))return{id:h,historyPath:f,located:null}}throw new l(`Item ${e} not found`,c.NOT_FOUND)}async function xe(t,e,n){let r=G(process.cwd(),n.path);if(!await k(B(r)))throw new l(`Tracker is not initialized at ${r}. Run pm init first.`,c.NOT_FOUND);let o=await rt(r),i=M(o,z()),s=e.replacement??"",a=s.length===0,h=a?"[redacted]":s,f=Rt(e.literal,e.regex),u=await Ut(r,t,o,i.type_to_folder);if(!await k(u.historyPath))throw new l(`No history stream exists for ${u.id}.`,c.NOT_FOUND);let ht=await H(u.historyPath),x=await J(u.historyPath,u.id);if(x.length===0)throw new l(`No history entries exist for ${u.id}; nothing to redact.`,c.USAGE);let b=kt(x),y=Pt(x,f,h),T=b.hashMismatchesBefore+b.hashMismatchesAfter,$=!!e.dryRun,R=y.replacements>0,E=[];T>0&&E.push(`history_redact_preexisting_hash_mismatches:${T}`),R||E.push("history_redact_no_matches");let g=await At(u,o),w=Tt({pmRoot:r,subject:u,settings:o,typeToFolder:i.type_to_folder,finalDocument:y.finalDocument}),ut=(g.path??null)!==(w.path??null)||(g.raw??null)!==(w.raw??null),N=V(e.author,o.author_default),ft=$t(e,y),{rewrittenEntries:O,auditEntryAdded:dt}=jt({rewritten:y,dryRun:$,changed:R,nextItemDocument:w.document,author:N,message:ft}),v=Z(O);if(!v.ok)throw new l(`history-redact produced an invalid rewritten chain (${v.errors.join(", ")}).`,c.GENERIC_FAILURE);return!$&&R&&E.push(...await Ct({pmRoot:r,subject:u,settings:o,typeRegistry:i,historyRawBeforeLock:ht,currentItem:g,nextItem:w,author:N,force:e.force,rewrittenEntries:O})),{id:u.id,dry_run:$,changed:R,patterns:{literal_count:f.filter(I=>I.kind==="literal").length,regex_count:f.filter(I=>I.kind==="regex").length,total_count:f.length,replacement_is_default:a},history:{path:u.historyPath,entries_scanned:x.length,entries_changed:y.entriesChanged,replacements:y.replacements,hash_mismatches_before:b.hashMismatchesBefore,hash_mismatches_after:b.hashMismatchesAfter,preexisting_hash_mismatches:T,audit_entry_added:dt,verify_ok:v.ok,verify_errors:v.errors},item:{existed_before:g.path!==null,exists_after:w.path!==null,path_before:g.path,path_after:w.path,changed:ut},warnings:[...new Set(E)].sort((I,mt)=>I.localeCompare(mt)),generated_at:S()}}export{Mt as a,A as b,Gt as c,Bt as d,Zt as e,at as f,Ut as g,xe as h};
|
|
2
|
+
//# sourceMappingURL=chunk-23FTGO3W.js.map
|