@unbrained/pm-cli 2026.8.20 → 2026.8.22
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 +38 -0
- package/dist/cli/error-guidance.d.ts +29 -4
- package/dist/cli/error-guidance.js +43 -43
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +40 -7
- package/dist/cli-bundle/bundle-manifest.json +150 -150
- package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BWX4SK46.js} +58 -58
- package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +13 -0
- package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +200 -0
- package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-MYYI3ZOA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-MZTZQTMS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-QI2CT3IX.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-U6GQ4VMV.js} +47 -47
- package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-VMMIL3SI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-YBPJAOQQ.js} +3 -3
- package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-HZKBQNWW.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-HTKEEGRD.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-6EMRWJJY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-QK4OTOXN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-2ARQGDDW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-2AZT5WXZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-2POVTNLY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-6S2MO3Q3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-A2BC5PQL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-D6RBZEJJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E2EWYPY6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-GMYPD4FX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-MB37AYN6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-PH2OXXVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-PMGJUFNQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-R6SR45XU.js +50 -0
- package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +8 -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 +2 -2
- package/dist/cli-bundle/sdk-core.js +40 -40
- 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 +32 -32
- 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 +5 -5
- package/dist/core/extensions/extension-hook-runtime.js +22 -20
- package/dist/core/extensions/extension-types.d.ts +8 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +7 -3
- package/dist/core/extensions/service-ownership.d.ts +8 -0
- package/dist/core/extensions/service-ownership.js +20 -0
- package/dist/core/item/id.js +20 -5
- package/dist/core/item/item-format.js +27 -2
- package/dist/core/shared/errors.d.ts +20 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-store.js +6 -91
- package/dist/core/store/tracker-preflight.d.ts +7 -0
- package/dist/core/store/tracker-preflight.js +142 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
- package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
- package/dist/sdk/annotations.js +6 -7
- package/dist/sdk/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +2 -2
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
- package/dist/sdk/cli-contracts/agent-output-contracts.js +324 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/config.d.ts +5 -0
- package/dist/sdk/config.js +5 -5
- package/dist/sdk/context-intent-runtime.js +7 -4
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/dependencies.js +5 -7
- package/dist/sdk/dependency-flag-validation.d.ts +1 -1
- package/dist/sdk/dependency-flag-validation.js +10 -4
- package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
- package/dist/sdk/environment/tracker-preflight.js +10 -0
- package/dist/sdk/eval.js +5 -7
- package/dist/sdk/extension/install-sources.d.ts +1 -1
- package/dist/sdk/extension/install-sources.js +6 -3
- package/dist/sdk/extension/output-ownership.d.ts +1 -0
- package/dist/sdk/extension/output-ownership.js +3 -2
- package/dist/sdk/files.js +6 -10
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +75 -15
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +81 -8
- package/dist/sdk/governance/assurance.d.ts +36 -2
- package/dist/sdk/governance/assurance.js +184 -10
- package/dist/sdk/governance/gc.js +5 -6
- package/dist/sdk/governance/health.d.ts +3 -0
- package/dist/sdk/governance/health.js +42 -11
- package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
- package/dist/sdk/governance/hierarchy-validation.js +109 -0
- package/dist/sdk/governance/reindex.js +5 -6
- package/dist/sdk/governance/validate.d.ts +2 -9
- package/dist/sdk/governance/validate.js +51 -109
- package/dist/sdk/graph/assembly.d.ts +6 -1
- package/dist/sdk/graph/assembly.js +16 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +8 -2
- package/dist/sdk/graph/governance.d.ts +7 -5
- package/dist/sdk/graph/governance.js +76 -16
- package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
- package/dist/sdk/graph/hierarchy-integrity.js +311 -0
- package/dist/sdk/graph/index.d.ts +2 -1
- package/dist/sdk/graph/index.js +3 -2
- package/dist/sdk/graph/remediation.js +32 -2
- package/dist/sdk/graph/run.d.ts +31 -2
- package/dist/sdk/graph/run.js +83 -36
- package/dist/sdk/graph/traversal.js +14 -5
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
- package/dist/sdk/history-compact.js +6 -9
- package/dist/sdk/history-read.js +5 -7
- package/dist/sdk/history-redact.js +5 -6
- package/dist/sdk/history-repair.js +6 -9
- package/dist/sdk/improvement-ledger.js +7 -10
- package/dist/sdk/index.d.ts +4 -2
- package/dist/sdk/index.js +5 -3
- package/dist/sdk/item-children.js +21 -8
- package/dist/sdk/lifecycle/append.d.ts +0 -5
- package/dist/sdk/lifecycle/append.js +5 -6
- package/dist/sdk/lifecycle/claim.d.ts +0 -5
- package/dist/sdk/lifecycle/claim.js +6 -9
- package/dist/sdk/lifecycle/close-many.d.ts +0 -5
- package/dist/sdk/lifecycle/close-many.js +5 -6
- package/dist/sdk/lifecycle/close.d.ts +0 -5
- package/dist/sdk/lifecycle/close.js +5 -6
- package/dist/sdk/lifecycle/copy.d.ts +0 -5
- package/dist/sdk/lifecycle/copy.js +5 -6
- package/dist/sdk/lifecycle/create.d.ts +0 -5
- package/dist/sdk/lifecycle/create.js +127 -102
- package/dist/sdk/lifecycle/delete.js +5 -6
- package/dist/sdk/lifecycle/focus.d.ts +0 -5
- package/dist/sdk/lifecycle/focus.js +5 -6
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.d.ts +15 -0
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
- package/dist/sdk/lifecycle/plan.d.ts +0 -5
- package/dist/sdk/lifecycle/plan.js +5 -6
- package/dist/sdk/lifecycle/restore.js +5 -6
- package/dist/sdk/lifecycle/update-many.d.ts +0 -5
- package/dist/sdk/lifecycle/update-many.js +5 -6
- package/dist/sdk/lifecycle/update.d.ts +2 -5
- package/dist/sdk/lifecycle/update.js +211 -84
- package/dist/sdk/linked-artifacts.js +6 -7
- package/dist/sdk/merge/install.js +5 -6
- package/dist/sdk/mutation-events.js +5 -7
- package/dist/sdk/package-import-adapters.js +6 -8
- package/dist/sdk/profile.js +6 -7
- package/dist/sdk/query/activity.js +5 -6
- package/dist/sdk/query/calendar.js +5 -6
- package/dist/sdk/query/complete-list.d.ts +3 -3
- package/dist/sdk/query/complete-list.js +46 -3
- package/dist/sdk/query/get.d.ts +0 -5
- package/dist/sdk/query/get.js +5 -6
- package/dist/sdk/query/history.d.ts +0 -5
- package/dist/sdk/query/history.js +5 -6
- package/dist/sdk/query/list.d.ts +4 -3
- package/dist/sdk/query/list.js +92 -54
- package/dist/sdk/query/search.js +5 -7
- package/dist/sdk/read-output-contracts.d.ts +5 -1
- package/dist/sdk/read-output-contracts.js +87 -22
- package/dist/sdk/relationship-context.js +3 -4
- package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
- package/dist/sdk/relationship-kinds/contract.js +13 -13
- package/dist/sdk/relationships.d.ts +1 -1
- package/dist/sdk/relationships.js +27 -2
- package/dist/sdk/runtime.d.ts +3 -2
- package/dist/sdk/runtime.js +3 -2
- package/dist/sdk/schema-migration.js +6 -7
- package/dist/sdk/schema.js +5 -6
- package/dist/sdk/stats.js +5 -8
- package/dist/sdk/templates.js +5 -6
- package/dist/sdk/test/batch.js +15 -9
- package/dist/sdk/test/execution.js +12 -5
- package/dist/sdk/test/runs.js +5 -7
- package/dist/types.d.ts +11 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_UX_CONTRACTS.md +24 -1
- package/docs/COMMANDS.md +29 -14
- package/docs/DEPENDENCY_KIND_CONTRACT.md +40 -1
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +98 -0
- package/docs/EXTENSIONS.md +2 -1
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +9 -2
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
- package/docs/RELATIONSHIP_GRAPH.md +97 -12
- package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
- package/docs/TESTING.md +15 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +848 -56
- package/dist/cli-bundle/chunks/chunk-2RDVGYWE.js +0 -13
- package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +0 -35
- package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +0 -197
- package/dist/cli-bundle/focused-chunks/chunk-6AHG2YW7.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-GXWQBE3T.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-JWKEDZJI.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RIHDMCUM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +0 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
(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]="87454a57-b62e-560a-b66f-3c15d4a95cc2")}catch{}})();var X=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],st=2,at=Object.freeze({migration:"schema",validation:"schema"}),to=Object.freeze({version:st,capabilities:[...X],legacy_aliases:{...at}}),ge=["off","warn","enforce"],ye=["off","warn","enforce"],he=["none","restricted","strict"],no=["block","warn"],be=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore","services.assuranceprovider"],Ee=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function Oe(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(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]="13c65470-8f5f-59ca-acb5-50c926c68870")}catch{}})();var ct=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],ro=ct,io=["draft","open","in_progress","blocked","closed","canceled"],so=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],ao=["string","number","boolean","string_array","array","object"],co=["create","update","update_many","list","search","calendar","context"],uo=["allow","warn","reject"],lo=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],fo=["project","global"],_o=["low","medium","high","critical"],po=["low","medium","high","critical"],mo=["low","medium","high"];var go=["minimal","default","strict","custom"],yo=["none","warn","strict"],ho=["progressive","strict"],bo=["off","warn","strict"],Eo=["off","warn","strict"];var Oo=["daily","weekly","monthly","yearly"],ut=["mon","tue","wed","thu","fri","sat","sun"];function Ao(e){return ut.indexOf(e)}var So=["draft","research","review","approved","executing","paused","completed","superseded"],wo=["pending","in_progress","completed","blocked","skipped","superseded"],To=["codex","claude-code","cursor","generic"],xo=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],ko=["brief","standard","deep","full"],Io=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];(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]="27c5eac3-4580-5f6f-8ae9-b04d0281766d")}catch{}})();var Ae=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],dt=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","design","external_ref","definition_of_ready","order",...Ae,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],lt=dt;(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]="70cce114-b8a7-5770-ae42-eec473515709")}catch{}})();var ft=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),_t=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),vo=".agents/pm",Do="settings.json";var pt=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],mt=["decisions","events","reminders","milestones","meetings","plans"],Mo=[...pt,...mt],Uo={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},gt={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},yt=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],W={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function Se(e){return e?[...e]:void 0}var Po={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},ux:{deprecation_hints:!0},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...yt],lifecycle_closure_like_blocked_reason_patterns:[...W.blocked_reason],lifecycle_closure_like_resolution_patterns:[...W.resolution],lifecycle_closure_like_actual_result_patterns:[...W.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...gt.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:ft.map(e=>({...e,aliases:Se(e.aliases),roles:Se(e.roles)})),fields:[],workflow:{..._t},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:Oe()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},Lo={metadata:{},body:""},g={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5,NO_EFFECT:6,PARTIAL_EFFECT:7},jo=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",init_gitignore_unwritable:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(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]="922e2e27-1499-5466-98e4-322d0d742e40")}catch{}})();var _=class extends Error{exitCode;code;context;constructor(t,n,o={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=o,this.code=o.code}};(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]="9afc5057-afcd-5d6c-a4c1-c2883640fc50")}catch{}})();var U=[...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:[t],lifecycle:"permanent",hidden:!1,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([e,t])=>({alias:e,canonical:t,canonical_argv:t.split(" "),lifecycle:"permanent",hidden:!1,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([e,t])=>({alias:e,canonical:"list",canonical_argv:["list","--status",t],lifecycle:"deprecated",hidden:!0,registration:"commander",owner:"pm-pfqi"}))],Go=Object.fromEntries(U.filter(e=>e.registration==="bootstrap").map(e=>[e.alias,e.canonical]));function $o(e){let t=e.trim().toLowerCase();return U.find(n=>n.alias===t)}function Ko(e){return`Deprecated command \`${e.alias}\`; use \`pm ${e.canonical_argv.join(" ")}\`.`}(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]="8b8b6b8e-5061-5da4-a369-eca379c0090b")}catch{}})();var ht=[...X],bt=[...Ee],Et=[...ge],Xo=[...ye],Wo=[...he],Ot=[...be],P=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","assurance","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],Jo=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],At=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],St=["reopen"],we={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."},L=Object.freeze(P.flatMap(e=>e in we?[]:e==="extension"||e==="package"?[...At.map(t=>`${e}-${t}`),e]:e==="item"?St.map(t=>`item-${t}`):[e])),wt=Object.freeze(U.filter(e=>e.lifecycle==="deprecated"&&e.registration==="commander"&&L.includes(e.alias)).map(e=>e.alias)),Qo=Object.freeze(L.filter(e=>!wt.includes(e)));function Ho(e=P,t=L,n=we){let o=new Set(t),r=new Set(e);return{missing_cli_actions:e.filter(i=>!o.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]===void 0),waived_cli_actions:e.filter(i=>!o.has(i)&&!t.some(s=>s.startsWith(`${i}-`))&&n[i]!==void 0),stale_waivers:Object.keys(n).filter(i=>!r.has(i)||o.has(i)||t.some(s=>s.startsWith(`${i}-`)))}}function Zo(e){return L.includes(e)}function er(e){return ht.includes(e)}function tr(e){return bt.includes(e)}function nr(e){return Et.includes(e)}function or(e){return Ot.includes(e)}(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]="810d42b5-98f4-57a7-bdd9-2dfa1b2b1c03")}catch{}})();var Tt=new Set(["applied_bound","completeness","budget_retention_policy","continuation_contract","continuation_kind","continuation_path","filters","omission_receipt","output_budget_truncation","projection","read_output","read_session","row_contract","sorting"]);function T(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Te(e,t){let n=e;for(let o of t.split("."))if(Array.isArray(n)){if(!/^\d+$/u.test(o))return;n=n[Number(o)]}else{if(!T(n))return;n=n[o]}return n}function J(e,t,n){let o=t.split("."),r=(i,s)=>{if(s===o.length)return n;let a=o[s];if(Array.isArray(i)){let c=Number(a),d=[...i];return d[c]=r(i[c],s+1),d}let l=i;return{...l,[a]:r(l[a],s+1)}};return r(e,0)}function xe(e,t,n){let o=k(e).find(i=>i.path===t);if(!o)return e;let r=Array.isArray(o.value)?o.value.slice(n):Object.fromEntries(Object.entries(o.value).slice(n));return J(e,t,r)}function j(e){let t=e.row_contract;return T(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function xt(e){let t=e.row_contract;return T(t)&&Array.isArray(t.continuation_row_keys)?t.continuation_row_keys.filter(n=>typeof n=="string"&&n.trim().length>0):j(e)}function x(e){return j(e).flatMap(t=>{let n=Te(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function k(e){return xt(e).flatMap(t=>{let n=Te(e,t);return Array.isArray(n)||T(n)?[{path:t,value:n}]:[]})}function V(e){let t=x(e),n=new Set(t.map(r=>r.path)),o=(r,i)=>{if(Array.isArray(r)){n.has(i)||t.push({path:i,value:r}),r.forEach((s,a)=>o(s,`${i}.${a}`));return}if(T(r))for(let[s,a]of Object.entries(r))i.length===0&&Tt.has(s)||o(a,i.length===0?s:`${i}.${s}`)};return o(e,""),t}function F(e){return x(e).reduce((t,n)=>t+(Array.isArray(n.value)?n.value.length:Object.keys(n.value).length),0)}function C(e,t){let n=e;for(let o of x(n)){let r=Array.isArray(o.value)?o.value.map((i,s)=>t(i,o.path,s)):Object.fromEntries(Object.entries(o.value).map(([i,s],a)=>[i,t(s,o.path,a)]));n=J(n,o.path,r)}return n}function ke(e,t){let n=e,o=!1;for(let r of x(n)){let i=Array.isArray(r.value)?r.value:Object.entries(r.value);if(i.length<=t)continue;o=!0;let s=Array.isArray(r.value)?i.slice(0,t):Object.fromEntries(i.slice(0,t));n=J(n,r.path,s)}return{result:n,truncated: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]="642f6dec-c0b2-5377-a401-dfa4f8ef6a2a")}catch{}})();var Q=256,H=1e4,kt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/u,It=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/u,Rt=new Set(["version","id","token_budget","spent_tokens","seen_item_ids"]),Nt=[{valid:e=>e.version===1,reason:"version must equal 1."},{valid:e=>typeof e.id=="string"&&kt.test(e.id),reason:"id must be 1-64 portable identifier characters."},{valid:e=>Number.isSafeInteger(e.token_budget)&&e.token_budget>=Q,reason:`token_budget must be a safe integer of at least ${Q}.`},{valid:e=>Number.isSafeInteger(e.spent_tokens)&&e.spent_tokens>=0&&e.spent_tokens<=e.token_budget,reason:"spent_tokens must be a non-negative safe integer no larger than token_budget."},{valid:e=>Array.isArray(e.seen_item_ids)&&e.seen_item_ids.length<=H&&e.seen_item_ids.every(t=>typeof t=="string"&&It.test(t)),reason:`seen_item_ids must contain at most ${H} portable item identifiers.`}];function G(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function B(e){throw new _(`--output-session ${e}`,g.USAGE,{code:"invalid_read_output_session",field:"outputSession"})}function $(e){if(e===void 0)return;let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch{B("must be a valid JSON object.")}G(t)||B("must be a JSON object.");let n=Object.keys(t).filter(i=>!Rt.has(i));n.length>0&&B(`contains unknown field "${n.sort()[0]}".`);let o=Nt.find(i=>!i.valid(t));o!==void 0&&B(o.reason);let r=[...new Set(t.seen_item_ids)].sort();return{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:r}}function Ie(e){if(G(e))return typeof e.id=="string"?e.id:typeof e.item_id=="string"?e.item_id:G(e.item)&&typeof e.item.id=="string"?e.item.id:void 0}function Ct(e){let t=new Set,n=0;for(let o of x(e)){let r=Array.isArray(o.value)?o.value:Object.values(o.value);for(let i of r){if(!G(i))continue;if(typeof i.context_ref=="string"){n+=1;continue}let s=Ie(i);s!==void 0&&t.add(s)}}return{deliveredIds:t,suppressedRepeatCount:n}}function Re(e,t){let n=new Set(t.seen_item_ids);return C(e,o=>{let r=Ie(o);return r!==void 0&&n.has(r)?{id:r,context_ref:`session:${t.id}:${r}`}:o})}function Z(e,t){let{deliveredIds:n,suppressedRepeatCount:o}=Ct(e),r=new Set(t.seen_item_ids),i=[...n].filter(y=>!r.has(y)).sort(),s=i.slice(0,H-t.seen_item_ids.length),a=[...t.seen_item_ids,...s].sort(),l=i.length-s.length,c={contract_version:1,id:t.id,measurement_scope:"complete_read_envelope",estimator:"ceil(utf8_bytes / 4)",token_budget:t.token_budget,spent_before_tokens:t.spent_tokens,spent_this_call_tokens:0,charged_this_call_tokens:0,spent_total_tokens:t.spent_tokens,remaining_tokens:t.token_budget-t.spent_tokens,exhausted:!1,seen_before_count:t.seen_item_ids.length,new_item_count:n.size,...l===0?{}:{seen_item_overflow_count:l},suppressed_repeat_count:o,reference_format:"session:<session-id>:<item-id>",restore_reference_with:"pm get <item-id> --brief",next_state:{version:1,id:t.id,token_budget:t.token_budget,spent_tokens:t.spent_tokens,seen_item_ids:a}},d={...e,read_session:c},u=y=>{c.spent_this_call_tokens=y,c.charged_this_call_tokens=Math.min(t.token_budget-t.spent_tokens,y),c.spent_total_tokens=Math.min(t.token_budget,t.spent_tokens+c.charged_this_call_tokens),c.remaining_tokens=Math.max(0,t.token_budget-c.spent_total_tokens),c.exhausted=c.remaining_tokens<Q,c.next_state.spent_tokens=c.spent_total_tokens},f=0,p=0;for(let y=0;y<8;y+=1){u(f);let O=Math.ceil(Buffer.byteLength(JSON.stringify(d),"utf8")/4);if(O===f)return d;p=Math.max(p,O),f=O}return u(p),d}function Ne(e){return Math.max(0,e.token_budget-e.spent_tokens)}(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]="b3f5a4bc-d853-530e-8f5e-d682d8b93c9d")}catch{}})();var vt=["full","compact","brief","summary","counts"],lr=["mutation","read","discovery","governance"],Ce=["error","warning","validation_summary","recovery_bundle"],Dt=["full","omit_explanation","limit_collections","compact_recovery","action_only"],Mt=new Set(["append","claim","close","close-many","close-task","comments","config","copy","create","delete","docs","event","files","focus","history-author-acknowledge","history-compact","history-redact","history-repair","init","item","learnings","meet","notes","pause-task","release","remind","restore","schema","start-task","update","update-many"]),Ut=new Set(["contracts","extension","help","install","package","packages","profile","upgrade"]),Pt=new Set(["gc","health","merge","stats","telemetry","test","test-all","validate"]),Lt={mutation:2e3,read:4e3,discovery:3e3,governance:6e3},jt=3,Vt=2,Ft=192,Bt={error:{text:768,json:2e3},warning:{text:768,json:2e3},validation_summary:{text:1500,json:3e3},recovery_bundle:{text:768,json:2e3}},Gt=Ce.map(e=>({diagnostic_class:e,default_max_estimated_tokens_by_format:Bt[e],minimum_max_estimated_tokens:Ft,degradation_ladder:Dt,corrective_action_paths:["required","recovery.suggested_retry","recovery.suggested_retry_args","recovery.next_best_command","next_steps[0]"],token_estimate:"ceil(utf8_bytes / 4)"})),$t=new Map(Gt.map(e=>[e.diagnostic_class,e]));function Kt(e){let[t=""]=e.trim().split(/\s+/u);return Mt.has(t)?"mutation":Ut.has(t)?"discovery":Pt.has(t)?"governance":"read"}function ve(e,t=Kt(e)){let n=e.trim().replace(/\s+/gu," ");if(n.length===0)throw new TypeError("command must be a non-empty command path");let o=Lt[t];return zt({command:n,budget_class:t,default_max_estimated_tokens:o,default_max_estimated_tokens_by_format:{toon:o,json:Math.ceil(o*jt/Vt)},degradation_ladder:vt,allows_unbounded_opt_out:!0,token_estimate:"ceil(utf8_bytes / 4)"})}function zt(e){if(!Number.isSafeInteger(e.default_max_estimated_tokens)||e.default_max_estimated_tokens<=0)throw new RangeError("default_max_estimated_tokens must be a positive safe integer");for(let[t,n]of Object.entries(e.default_max_estimated_tokens_by_format))if(!Number.isSafeInteger(n)||n<=0)throw new RangeError(`default_max_estimated_tokens_by_format.${t} must be a positive safe integer`);return e}var qt=P.map(e=>ve(e)),Yt=new Map(qt.map(e=>[e.command,e]));function De(e,t={}){let n=e.trim().replace(/\s+/gu," "),[o]=n.split(" "),r=Yt.get(o);return r?{...r,command:n}:t.generateFallback?ve(n):null}function ee(e){return Math.ceil(Math.max(0,e)/4)}function Me(e){let t=$t.get(e);if(t===void 0)throw new TypeError(`diagnosticClass must be one of: ${Ce.join(", ")}`);return t}function E(e){return ee(Buffer.byteLength(JSON.stringify(e,null,2),"utf8"))}function Xt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function te(e){if(!Xt(e))return;let t={};for(let n of["suggested_retry","suggested_retry_args","next_best_command","allowed_values","candidate_commands","missing","missing_required_fields","option_scope","retry_after_ms"]){let o=e[n];Array.isArray(o)?t[n]=o.slice(0,3):o!==void 0&&(t[n]=o)}return Object.keys(t).length>0?t:void 0}function Wt(e,t){return typeof e!="string"||e.length<=t?e:`${e.slice(0,Math.max(1,t-3))}...`}function I(e,t){if(Buffer.byteLength(e,"utf8")<=t)return e;let n="...",o=Array.from(e),r=0,i=o.length;for(;r<i;){let s=Math.ceil((r+i)/2),a=`${o.slice(0,s).join("")}${n}`;Buffer.byteLength(a,"utf8")<=t?r=s:i=s-1}return`${o.slice(0,r).join("")}${n}`}function Ue(e){let t={};for(let n of["code","required","recovery","next_steps","exit_code","type","title","detail","why","examples"])Object.hasOwn(e,n)&&e[n]!==void 0&&(t[n]=e[n]);for(let[n,o]of Object.entries(e))n!=="__proto__"&&!Object.hasOwn(t,n)&&(t[n]=o);return t}var Jt=new Set(["limit_collections","compact_recovery","action_only"]),Qt=new Set(["compact_recovery","action_only"]);function Ht(e){let t={code:typeof e.code=="string"?e.code:"diagnostic",required:Wt(e.required,160)??"Inspect the diagnostic code and retry with corrected input."},n=te(e.recovery);return n!==void 0?t.recovery=n:Array.isArray(e.next_steps)&&(t.next_steps=e.next_steps.slice(0,1)),e.exit_code!==void 0&&(t.exit_code=e.exit_code),e.type!==void 0&&(t.type=e.type),t}function Zt(e,t){let n=structuredClone(e);if(t!=="full"&&(delete n.why,delete n.examples),Jt.has(t))for(let[o,r]of Object.entries(n))Array.isArray(r)&&(n[o]=r.slice(0,3));if(Qt.has(t)){let o=te(n.recovery);o?n.recovery=o:delete n.recovery}return t!=="action_only"?Ue(n):Ht(n)}function R(e,t){let n={...e,diagnostic_output:{...t,estimated_tokens:0}};for(let o=0;o<4;o+=1){let r=E(n),i=n.diagnostic_output;if(i.estimated_tokens===r)break;i.estimated_tokens=r}return n}function en(e,t,n){let o=R(e,t);for(let i of["recovery","exit_code"])E(o)<=n||e[i]===void 0||(delete e[i],o=R(e,t));let r=40;for(;E(o)>n&&r>4;)r-=4,e.code=I(String(e.code),r),e.required=I(String(e.required),r),o=R(e,t);return o}function tn(e,t){let n=e.diagnostic_output,{estimated_tokens:o,...r}=n,i=r.omitted_fields.slice(0,8).map(u=>I(u,32)),s={...r,omitted_fields:i,...r.omitted_fields.length>i.length?{omitted_fields_overflow_count:r.omitted_fields.length-i.length}:{}},a=te(e.recovery),l=a&&E(a)<=48?a:void 0,c={code:I(String(e.code),320),required:I(String(e.required),320),...l?{recovery:l}:{},...e.exit_code!==void 0?{exit_code:e.exit_code}:{}},d=R(c,s);for(;E(d)>t&&s.omitted_fields.length>0;)s.omitted_fields.pop(),s.omitted_fields_overflow_count=r.omitted_fields.length-s.omitted_fields.length,d=R(c,s);return d=en(c,s,t),d}function fr(e,t={}){let n=e,o=t.diagnosticClass??"error",r=Me(o),i=t.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.json,a=E(n),l=Object.keys(n);if(a<=s)return Ue(structuredClone(n));let c;for(let[d,u]of r.degradation_ladder.entries()){let f=Zt(n,u),p=l.filter(O=>!Object.hasOwn(f,O)),y=R(f,{diagnostic_class:o,format:"json",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,truncated:d>0,degradation_steps:r.degradation_ladder.slice(0,d+1),omitted_fields:p});if(c=y,E(y)<=s)break}return E(c)>s&&(c=tn(c,s)),c}function _r(e,t,n={}){let o=n.diagnosticClass??"error",r=Me(o),i=n.maxEstimatedTokens;if(i!==void 0&&(!Number.isSafeInteger(i)||i<r.minimum_max_estimated_tokens))throw new RangeError(`maxEstimatedTokens must be a safe integer >= ${r.minimum_max_estimated_tokens}`);let s=i??r.default_max_estimated_tokens_by_format.text,a=ee(Buffer.byteLength(e,"utf8")),l=a>s,c=`What is required:
|
|
2
|
+
`,d=`
|
|
3
|
+
|
|
4
|
+
Diagnostic output exceeded its declared ${s}-token ceiling; rerun with structured JSON for the bounded recovery envelope.`,u=t.trim()||"Inspect the diagnostic code and retry with corrected input.",f=Math.max(1,s*4-Buffer.byteLength(`${c}${d}`,"utf8")),p=l?`${c}${I(u,f)}${d}`:e;return{output:p,diagnostic_output:{diagnostic_class:o,format:"text",budget:s,budget_source:i===void 0?"default":"explicit",original_estimated_tokens:a,estimated_tokens:ee(Buffer.byteLength(p,"utf8")),truncated:l,degradation_steps:l?[...r.degradation_ladder]:["full"],omitted_fields:l?["explanation","collections"]:[]}}}import{createHash as Jn}from"node:crypto";import nn from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83232698-197a-5aef-be7c-aa37f3c56822")}catch{}})();function on(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function rn(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=K(r))}return n}function K(e){let t=on(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>K(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return K(o)}return rn(e)}function z(e){return JSON.stringify(K(e))}function Pe(e,t,n,o){for(let r=0;r<t.length;r+=1)if(!n.has(r)&&o(e,t[r]))return n.add(r),!0;return!1}function sn(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function an(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function cn(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],o=new Set;for(let r of e)if(!Pe(r,n,o,v))return!1;return!0}function un(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],o=new Set;for(let[r,i]of e.entries())if(!Pe([r,i],n,o,([a,l],[c,d])=>v(a,c)&&v(l,d)))return!1;return!0}function dn(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,o)=>v(n,t[o]))}function ln(e,t){let n=Object.keys(e).sort((r,i)=>r.localeCompare(i)),o=Object.keys(t).sort((r,i)=>r.localeCompare(i));if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1){let i=n[r];if(i!==o[r]||!v(e[i],t[i]))return!1}return!0}var fn=[sn,an,cn,un,dn];function v(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of fn){let o=n(e,t);if(o!==void 0)return o}return ln(e,t)}function gr(e){return nn.createHash("sha256").update(e,"utf8").digest("hex")}function yr(e,t){let n={};for(let r of t){let i=e[r];i!==void 0&&(n[r]=i)}let o=Object.keys(e).filter(r=>!t.includes(r)).sort((r,i)=>r.localeCompare(i));for(let r of o){let i=e[r];i!==void 0&&(n[r]=i)}return n}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="737ac274-c165-5d1a-8b8e-cb5d57a81c46")}catch{}})();var _n=8,pn=64;function oe(e){return Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4)}function mn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ne(e,t){return typeof e=="string"?e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>ne(n,t)):mn(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,ne(o,t)])):e}function A(e,t){let n=t.estimated_tokens;for(let o=0;o<_n;o+=1){t.estimated_tokens=n;let r=oe(e);if(r===n)return;n=r}t.estimated_tokens=n}function gn(e,t,n,o){for(let r=0;r<pn;r+=1){if(A(e,t),t.estimated_tokens<=n)return;let i=V(e).filter(a=>(Array.isArray(a.value)?a.value.length:Object.keys(a.value).length)>Math.max(1,o.get(a.path)??0)).map(a=>({collection:a,length:Array.isArray(a.value)?a.value.length:Object.keys(a.value).length})).sort((a,l)=>l.length-a.length||a.collection.path.localeCompare(l.collection.path))[0]?.collection;if(!i)return;let s=Math.max(1,o.get(i.path)??0);if(Array.isArray(i.value))i.value.splice(-Math.min(i.value.length-s,Math.max(1,Math.ceil(i.value.length/2))));else{let a=Object.keys(i.value);for(let l of a.slice(-Math.min(a.length-s,Math.max(1,Math.ceil(a.length/2)))))delete i.value[l]}t.rows_compacted=!0,t.compacted_row_paths=[...new Set([...t.compacted_row_paths??[],i.path])].sort((a,l)=>a.localeCompare(l)),e.has_more=!0,e.truncated=!0,typeof e.count=="number"&&(e.count=F(e))}}function Le(e,t,n,o=new Map){let r={compacted:!1},i=ne(e,r);return t.strings_compacted=r.compacted,i.read_output=t,gn(i,t,n,o),A(i,t),i}import{createHash as yn}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d3329fac-693d-566c-a30a-43f8fb37938f")}catch{}})();var re=1,Ve=4096,hn=/^[A-Za-z0-9_-]+$/;function je(e){return e.replace(/^--/u,"").replace(/[-_]([a-z0-9])/gu,(t,n)=>n.toUpperCase())}function Tr(e,t){let n=new Set;for(let o of t)if(o.cursor_semantics==="presentation"){n.add(je(o.flag));for(let r of o.aliases??[])n.add(je(r))}return Object.fromEntries(Object.entries(e).filter(([o])=>!n.has(o)))}function xr(e,t){return yn("sha256").update(e).update("\0").update(z(t)).digest("hex").slice(0,24)}function ie(e,t,n,o){return Buffer.from(JSON.stringify({version:re,fingerprint:e,after_id:t,...n===void 0?{}:{after_index:n},...o===void 0?{}:{snapshot:o}})).toString("base64url")}function S(e){return new _(e,g.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]})}function bn(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version===re&&typeof t.fingerprint=="string"&&typeof t.after_id=="string"&&t.after_id.length>0&&(t.after_index===void 0||Number.isSafeInteger(t.after_index)&&t.after_index>=0)&&(t.snapshot===void 0||typeof t.snapshot=="string"&&t.snapshot.length>0)}function se(e){if(typeof e!="string")throw S("Query cursor is malformed.");let t=e.trim();if(t.length===0||t.length>Ve||!hn.test(t))throw S("Query cursor is malformed.");let n;try{n=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw S("Query cursor is malformed.")}if(!bn(n))throw S("Query cursor version or payload is unsupported.");return n}function ae(e,t){let n=se(e);if(n.fingerprint!==t)throw S(`Query cursor does not match the current filters, sort, or query (${n.fingerprint} != ${t}).`);return{after_id:n.after_id,...n.after_index===void 0?{}:{after_index:n.after_index},...n.snapshot===void 0?{}:{snapshot:n.snapshot}}}function kr(e,t){return ae(e,t).after_id}function En(e,t,n,o){if(t===void 0)return 0;let r=ae(t,n),i=e.findIndex(s=>o(s)===r.after_id);if(i<0){if(r.after_index!==void 0)return Math.min(r.after_index,e.length);throw S(`Query cursor item ${r.after_id} is no longer present in this result set.`)}return i+1}function Ir(e,t){if(t.cursor!==void 0&&ae(t.cursor,t.fingerprint).snapshot!==t.snapshot)throw S("Query cursor does not match the requested snapshot.");let n=En(e,t.cursor,t.fingerprint,t.readId),o=e.slice(n,n+t.limit),r=o.length>0&&n+o.length<e.length,i=o.at(-1);return{rows:o,has_more:r,...r&&i!==void 0?{next_cursor:ie(t.fingerprint,t.readId(i),n+o.length-1,t.snapshot)}:{}}}var Rr=Object.freeze({version:re,max_length:Ve});(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]="a1272c1f-c03e-580c-8c44-6b3ddeedd240")}catch{}})();var w=["include","amount","cost","encoding"],Ye=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate","duplicates","package-catalog","package-manage","comments-audit","assurance"],Xe=["canonical","legacy","intent","default"],D={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},ce=Symbol.for("pm.readOutputInvocationProvenance"),Vr=Object.freeze(w.map(e=>D[e])),Fr=Object.freeze(["--output-session","--output-cursor","--output-row-contract"]),We={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{},duplicates:{amount:["--limit"]},"package-catalog":{},"package-manage":{},"comments-audit":{},assurance:{}},Je=new Set(["--collapse","--fields","--section"]),fe=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--collapse":"--collapse retains dependency grouping semantics; --output-include does not replace it.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--no-truncate":"--no-truncate is a compatibility alias; prefer --output-limit unbounded.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding.","--unbounded":"--unbounded is a compatibility alias; prefer --output-limit unbounded."});function _e(e){return e.slice(2).replaceAll("-","_")}function On(e,t){let n=fe[e];if(n!==void 0)return n;let o=t==="include"?Je.has(e)?"<csv>":_e(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${D[t]} ${o}.`}function An(e){let t=We[e],n=Object.freeze(Object.fromEntries(w.map(o=>[o,Object.freeze({dimension:o,canonical_option:D[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,semantics:fe[r]===void 0?"replacement":"behavior_preserving",migration_hint:On(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:Xe,budget_retention_policy:e==="assurance"?"verdict_priority":"ordered_prefix"})}var Sn=Object.freeze(Ye.map(An)),wn=new Map(Sn.map(e=>[e.command,e]));function M(e,t={}){let n=e.trim().toLowerCase().replaceAll(/\s+/gu," "),r=n==="package catalog"||n==="packages catalog"||n==="package-catalog"||(n==="package"||n==="packages"||n==="extension")&&(t.catalog===!0||t.target==="catalog"||t.action==="catalog")?"package-catalog":n==="package manage"||n==="package-manage"?"package-manage":n.split(" ")[0],i=r.startsWith("list-")?"list":r==="ctx"?"context":r;return Ye.includes(i)?i:void 0}var Tn=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format","outputSession","output_session","outputCursor","output_cursor","outputRowContract","output_row_contract"],xn={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"],"package-catalog":["activate","adopt","adoptAll","deactivate","doctor","init","install","manage","migrate","reload","scaffold","uninstall"]};function kn(e){return Tn.some(t=>e[t]!==void 0)}var In=[{keys:["outputInclude","output_include"],valid:e=>q(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||N(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>e==="unbounded"||N(e)!==void 0,message:"--output-budget must be a positive integer or unbounded."},{keys:["outputFormat","output_format"],valid:e=>e==="toon"||e==="json",message:"--output-format must be toon or json."},{keys:["outputSession","output_session"],valid:e=>($(e),!0),message:"--output-session must be a valid session-state object."},{keys:["outputCursor","output_cursor"],valid:e=>typeof e=="string"&&e.trim().length>0,message:"--output-cursor requires a non-empty continuation cursor."}];function Br(e,t){if(!kn(t))return;let n=M(e,t);if(!n)throw new _(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,g.USAGE);if((xn[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new _(`Universal output controls cannot be combined with a ${n} mutation.`,g.USAGE);for(let o of In){let r=o.keys.map(i=>t[i]).find(i=>i!==void 0);if(r!==void 0&&!o.valid(r))throw new _(o.message,g.USAGE)}}function Qe(e){let t=M(e);return t?new Map((We[t].include??[]).filter(n=>!Je.has(n)&&fe[n]===void 0).map(n=>[_e(n),He(n)])):new Map}function Rn(e,t,n){let o=q(t)??[],r=Qe(e),i=[],s=[],a=n,l=a[ce],c=new Set(l?.canonical_include_modes??[]),d=new Set(l?.explicit_legacy_aliases??[]);for(let u of o){let f=r.get(u);if(f===void 0){i.push(u);continue}let p=`--${u.replaceAll("_","-")}`;et(Ze(n,p))&&d.add(p),n[f]=!0,s.push(u),c.add(u)}return s.length>0&&(a[ce]={canonical_include_modes:[...c],explicit_legacy_aliases:[...d],...l?.cli_invocation_observed===!0?{cli_invocation_observed:!0}:{}}),{selectors:i,modes:s}}function Gr(e,t){let n=t.outputInclude??t.output_include;if(n===void 0)return;let{selectors:o,modes:r}=Rn(e,n,t);if(r.length===0)return;let i=o.length>0?o.join(","):void 0;t.outputInclude=i,Object.hasOwn(t,"output_include")&&(t.output_include=i)}function He(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ze(e,t){let n=He(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function et(e){return e!==void 0&&e!==!1&&e!==null}function q(e){let n=(Array.isArray(e)?e:[e]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function N(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function Nn(e,t,n,o){for(let r of e.legacy_aliases){if(o(r.flag))continue;let i=Ze(t,r.flag),s={value:i,flag:r.flag};if(et(i)&&n(s))return s}}function Fe(e,t){let n=q(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:q(t.value)??[_e(t.flag)]}}function Be(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=N(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=N(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function Ge(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=N(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=N(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function $e(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function Cn(e,t,n){if(!e)return!1;let o=new Set(e.explicit_legacy_aliases);if(e.cli_invocation_observed===!0)return!o.has(n);let r=new Set(e.canonical_include_modes.map(i=>`--${i.replaceAll("_","-")}`));return t==="include"&&r.has(n)&&!o.has(n)}function vn(e,t,n){return e.trim().toLowerCase().replaceAll(/\s+/gu," ").split(" ")[0]==="list-all"||t.amount?.flag==="--no-truncate"||t.include?.flag==="--full"||n?.canonical_include_modes.includes("full")===!0}function Dn(e,t){return w.flatMap(n=>e[n]?.source==="canonical"||n==="include"&&(t?.canonical_include_modes.length??0)>0?[D[n]]:[])}function tt(e,t){let n=M(e,t);if(!n)return;let o=wn.get(n),r=t[ce],i={include:m=>Fe(void 0,m),amount:m=>Be(void 0,m),cost:m=>Ge(void 0,m),encoding:m=>$e(void 0,m)},s=Object.fromEntries(w.map(m=>[m,Nn(o.dimensions[m],t,b=>i[m](b)!==void 0,b=>Cn(r,m,b))])),a=w.flatMap(m=>{let b=s[m];return b?[b.flag]:[]}),l=w.flatMap(m=>{let b=s[m];return b?[o.dimensions[m].legacy_aliases.find(it=>it.flag===b.flag).migration_hint]:[]}),c=$e(t.outputFormat??t.output_format,s.encoding),d=Fe(t.outputInclude??t.output_include,s.include),u=Be(t.outputLimit??t.output_limit,s.amount),f=Ge(t.outputBudget??t.output_budget,s.cost),p=vn(e,s,r),y=De(e,{generateFallback:!0}),O=c?.value==="json"||t.resolvedOutputFormat==="json"?"json":"toon",me=f??(p?{source:"intent",value:"unbounded"}:{source:"default",value:y.default_max_estimated_tokens_by_format[O]});return{command:n,include:d,amount:u,cost:me,encoding:c,canonical_options_used:Dn({include:d,amount:u,cost:me,encoding:c},r),legacy_aliases_used:a,migration_hints:l,precedence:Xe}}function h(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var pe=new Set(["applied_bound","applied_limit","completeness","continuation_kind","continuation_path","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","budget_retention_policy","row_contract","sorting","total","truncated"]),Mn=["collection_counts","notes_count","tests_count"];function nt(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function Un(e){let t=h(e.item)?e.item:{},n=[...new Set([...Object.keys(t),...Mn.filter(r=>Object.hasOwn(t,r))])].sort((r,i)=>r.localeCompare(i)),o=Object.keys(e).filter(r=>r!=="item"&&r!=="read_output"&&!pe.has(r)).sort((r,i)=>r.localeCompare(i));return{item:t,itemFields:n,sections:o,valid:[...n,"item",...n.map(r=>`item.${r}`),...o]}}function Pn(e,t){let n=Un(e),o=t.filter(u=>!n.valid.includes(u));if(o.length>0)throw new _(`Unknown --output-include selector(s) for get: ${o.join(", ")}. Valid selectors: ${n.valid.join(", ")}.`,g.USAGE);let r=t.includes("item"),i=t.flatMap(u=>u.startsWith("item.")?[u.slice(5)]:n.itemFields.includes(u)?[u]:[]).filter((u,f,p)=>p.indexOf(u)===f);if(r&&i.length>0)throw new _("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.",g.USAGE);let s=new Set(t.filter(u=>n.sections.includes(u))),a=Object.fromEntries(Object.entries(e).filter(([u])=>pe.has(u)||s.has(u)));r?a.item=n.item:i.length>0&&(a.item=nt(n.item,i));let l=[...r?[]:i.length>0?n.itemFields.filter(u=>!i.includes(u)).map(u=>({name:`item.${u}`,restore_with:`--output-include item.${u}`})):[{name:"item",restore_with:"--output-include item"}],...n.sections.filter(u=>!s.has(u)).map(u=>({name:u,restore_with:`--output-include ${u}`}))],d=[...h(a.omission_receipt)&&Array.isArray(a.omission_receipt.omitted_field_groups)?a.omission_receipt.omitted_field_groups:[],...l];return a.omission_receipt={has_omissions:d.length>0,omitted_field_group_count:d.length,omitted_field_groups:d},a}function Ke(e){let t=0;return C({...e},n=>(h(n)&&Object.keys(n).length>0&&(t+=1),n)),t}function Ln(e,t,n,o){if(Ke(t)===0||Ke(n)>0)return;let r=[...Qe(e).keys()],i=r.length>0?` Declared ${e} projection modes: ${r.join(", ")}.`:` The ${e} surface declares no projection modes; name row fields instead.`;throw new _(`Unknown --output-include selector(s) for ${e}: ${o.join(", ")}. No selector matched any returned row field.${i}`,g.USAGE)}function jn(e,t,n){if(e==="get")return Pn(t,n);let o=j(t),r=n.flatMap(s=>o.flatMap(a=>s.startsWith(`${a}.`)?[s.slice(a.length+1)]:[])),i=n.some(s=>Object.hasOwn(t,s.split(".")[0])&&!o.some(a=>s.startsWith(`${a}.`)));if(o.length>0&&(!i||r.length>0)){let s={...t},a=r.length>0?r:n,l=C(s,c=>h(c)?nt(c,a):c);return Ln(e,t,l,a),l}return Object.fromEntries(Object.entries(t).filter(([s])=>n.some(a=>a.split(".")[0]===s)||pe.has(s)))}function Vn(e,t){if(t==="unbounded")return e;let{result:n,truncated:o}=ke(e,t);return o&&(n.has_more=!0,n.truncated=!0,typeof n.count=="number"&&(n.count=F(n)),n.applied_bound={kind:"output_limit",source:"explicit",value:t}),n}function Fn(e){return w.filter(t=>e[t]!==void 0&&e[t]?.source!=="default"||e.canonical_options_used.includes(D[t]))}function Y(e,t,n){let o=Z(e,t);for(let r=0;r<8;r+=1){let i=n.estimated_tokens,s=o.read_session.spent_this_call_tokens;A(o,n),o=Z(o,t);let a=o.read_session.spent_this_call_tokens;if(n.estimated_tokens===i&&a===s)return o}return o}function $r(e,t){if(!h(e.read_output))return e;let n=e.read_output,o=$(t.outputSession??t.output_session);return o===void 0?(A(e,n),e):Y(e,o,n)}function Bn(e,t){if(e!=="validate")return t;let n=h(t.projection)?t.projection:void 0;if(!(Array.isArray(n?.declared_field_groups)?n.declared_field_groups:[]).some(u=>h(u)&&u.name==="diagnostic_rows"))return t;let r=[...new Set(V(t).map(({path:u})=>u).filter(u=>/^checks\.\d+\.details\./u.test(u)))],i=r.filter(u=>!r.some(f=>f!==u&&u.startsWith(`${f}.`)));if(i.length===0)return t;let s=h(t.row_contract)?t.row_contract:{},a=Array.isArray(s.row_keys)?s.row_keys.filter(u=>typeof u=="string"):[],l=Array.isArray(s.continuation_row_keys)?s.continuation_row_keys.filter(u=>typeof u=="string"):[],c=a.length>0?a:i,d=[...new Set(i)];return JSON.stringify(c)===JSON.stringify(a)&&JSON.stringify(d)===JSON.stringify(l)?t:{...t,row_contract:{...s,row_keys:c,continuation_row_keys:d,jq_selector:typeof s.jq_selector=="string"?s.jq_selector:".checks[].details"}}}function Gn(e,t,n,o){let r={...e};return t.include?.source==="canonical"&&(r=jn(t.command,r,t.include.value)),t.command==="assurance"&&(r=ze(r)),r=qe(r,t.command,o),t.amount?.source==="canonical"&&(r=Vn(r,t.amount.value)),n===void 0?r:Re(r,n)}function $n(e,t){return[...e.cost!==void 0&&e.cost.value!=="unbounded"&&(e.cost.source==="canonical"||e.cost.source==="default")?[{source:e.cost.source,tokens:e.cost.value}]:[],...t===void 0?[]:[{source:"session",tokens:Ne(t)}]].sort((o,r)=>o.tokens-r.tokens)[0]}function ot(e){let t=e.canonical_options_used;return t&&t.length>0?{canonical_options_used:t}:{}}function Kn(e,t,n,o,r){let i={contract_version:1,command:e.command,requested_dimensions:t,...o.source==="default"?{budget_source:o.source,budget_tokens:o.tokens}:{},precedence:e.precedence,...ot(e),legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0,...n===void 0?{omitted_result_estimated_tokens:r}:{}},s={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Unbounded",recovery:{outputBudget:"unbounded"}},read_output:i},a=n===void 0?s:Y(s,n,i);if(n===void 0&&A(a,i),n!==void 0&&i.estimated_tokens>o.tokens)throw new _("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.",g.USAGE);return a}function zn(e,t,n){if(t!==void 0)return!1;let o=e.canonical_options_used.length;return e.cost?.value==="unbounded"?o===(e.cost.source==="canonical"?1:0):e.cost?.source==="legacy"&&o===0?!0:o===0&&(e.cost===void 0||oe(n)<=e.cost.value)}function qn(e,t,n,o,r,i){if(!n.rows_compacted)return;let s=t.amount?.value==="unbounded"?["amount"]:[],a=new Map(k(e).map(d=>[d.path,Array.isArray(d.value)?d.value.length:Object.keys(d.value).length])),l=[...i.entries()].flatMap(([d,u])=>{let f=a.get(d);if(f>=u.rows)return[];let p=u.baseOffset+f;return[{path:d,cursor:de({command:t.command,path:d,offset:p,total_rows:u.totalRows,fingerprint:u.fingerprint}),retained_rows:f,remaining_rows:u.totalRows-p,total_rows:u.totalRows}]}),c=l[0];c&&typeof e.next_cursor!="string"&&(e.next_cursor=c.cursor),e.continuation_kind=r?"producer_cursor":c?"output_cursor":"none",e.output_budget_truncation={reason:"output_budget_reached",budget_source:o.source,budget_tokens:o.tokens,overridden_dimensions:s,compacted_row_paths:n.compacted_row_paths,continuation_cursor_rebased:r,continuation_available:l.length>0,recovery_budget_multiplier:1,continuations:l,restore_with:c?"Use recovery binding.":"Increase --output-budget because no declared row collection can be continued.",recovery:c?{cursor:c.cursor,cli:"--output-cursor",sdk:"outputCursor",mcp:"outputCursor"}:{cli:"--output-budget 1200",sdk:{outputBudget:1200},mcp:{outputBudget:1200}}}}function Yn(e,t,n,o){if(typeof n!="string"||!Array.isArray(e.items))return!1;let r=e.items.length;if(r===0||r>=t)return!1;let i;try{i=se(n)}catch{return!1}let s=i.after_index;if(s===void 0)return!1;let a=e.items.at(-1);if(Object.prototype.toString.call(a)!=="[object Object]")return!1;let l=Reflect.get(a,"id");if(typeof l!="string"||l.length===0)return!1;let c=o?s-(t-r):s+r;return c<0?!1:(e.next_cursor=ie(i.fingerprint,l,c,i.snapshot),typeof e.applied_limit=="number"&&(e.applied_limit=r),!0)}function Xn(e,t,n){let o=new Map(k(e).map(i=>{let s=Array.isArray(i.value)?i.value.length:Object.keys(i.value).length,a=t?.path===i.path;return[i.path,{rows:s,totalRows:a?t.total_rows:s,baseOffset:a?t.offset:0,fingerprint:a?t.fingerprint:ue(i.path,i.value)}]})),r=typeof e.next_cursor=="string";return{collectionsBeforeBudget:o,originalItemCount:Array.isArray(e.items)?e.items.length:0,cursorContinuesExistingPage:r,cursorSource:r?e.next_cursor:n.after}}function Wn(e,t,n,o,r,i){let s=t.command==="assurance"&&Array.isArray(e.assertions)?e.assertions.filter(c=>h(c)&&c.verdict!=="pass").length:0,a=Le(e,n,o.tokens,s>0?new Map([["assertions",s]]):new Map),l=Yn(a,i.originalItemCount,i.cursorSource,i.cursorContinuesExistingPage);return qn(a,t,n,o,l,i.collectionsBeforeBudget),r!==void 0&&(a=Y(a,r,n)),a}function Kr(e,t,n){let o=tt(e,t);if(!o)return n;let r=$(t.outputSession??t.output_session),i=t.outputCursor??t.output_cursor,s=typeof i=="string"?le(i):void 0,a=Fn(o);if(s===void 0&&zn(o,r,n))return n;let l=Bn(o.command,n),c=$n(o,r),d=Gn(l,o,r,s),u=Xn(d,s,t),f={contract_version:1,command:o.command,requested_dimensions:a,...c?.source==="default"?{budget_source:c.source,budget_tokens:c.tokens}:{},precedence:o.precedence,...ot(o),legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};return d.read_output=f,d=r===void 0?d:Y(d,r,f),A(d,f),c!==void 0&&f.estimated_tokens>c.tokens&&(d=Wn(d,o,f,c,r,u)),c!==void 0&&f.estimated_tokens>c.tokens?Kn(o,a,r,c,f.estimated_tokens):d}function zr(e){return h(e)&&h(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function qr(e,t){let n=tt(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1c73c31e-6246-5730-8c8a-d3ba7c9ec112")}catch{}})();var Qn=4096;function rt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ue(e,t){return Jn("sha256").update(z({path:e,value:t})).digest("base64url").slice(0,16)}function de(e){return Buffer.from(JSON.stringify({v:1,c:e.command,p:e.path,o:e.offset,n:e.total_rows,f:e.fingerprint}),"utf8").toString("base64url")}function le(e){if(e.length>Qn)throw new _("The read-output continuation cursor is malformed or unsupported.",g.USAGE,{code:"read_output_cursor_invalid"});let t;try{t=JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{t=null}if(!rt(t)||t.v!==1||M(String(t.c??""))!==t.c||typeof t.p!="string"||t.p.length===0||!Number.isSafeInteger(t.o)||t.o<0||!Number.isSafeInteger(t.n)||t.n<1||typeof t.f!="string"||t.f.length===0)throw new _("The read-output continuation cursor is malformed or unsupported.",g.USAGE,{code:"read_output_cursor_invalid"});return{version:1,command:t.c,path:t.p,offset:t.o,total_rows:t.n,fingerprint:t.f}}function ze(e){if(!Array.isArray(e.assertions))return e;let t=n=>!rt(n)||n.verdict==="pass"?4:n.verdict==="retired"?3:n.enforcement==="block"?0:n.enforcement==="warn"?1:2;return{...e,assertions:e.assertions.map((n,o)=>({row:n,index:o})).sort((n,o)=>t(n.row)-t(o.row)||n.index-o.index).map(({row:n})=>n),budget_retention_policy:"verdict_priority"}}function qe(e,t,n){if(!n)return e;if(n.command!==t)throw new _(`The read-output cursor belongs to ${n.command}, not ${t}.`,g.USAGE,{code:"read_output_cursor_command_mismatch"});let o=k(e).find(i=>i.path===n.path),r=o?Array.isArray(o.value)?o.value.length:Object.keys(o.value).length:0;if(!o||r!==n.total_rows||n.offset>r||ue(n.path,o.value)!==n.fingerprint)throw new _("The read-output continuation no longer matches the declared row collection; restart the bounded read.",g.USAGE,{code:"read_output_cursor_stale"});return xe(e,n.path,n.offset)}(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]="f6e82c93-54e8-53a7-94df-10a573aae933")}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]="08ee7e43-8811-57ed-8bfe-0345ee5d3308")}catch{}})();var Hn=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields"},{flag:"--output-limit",value_name:"count"},{flag:"--output-budget",value_name:"tokens"},{flag:"--output-format",value_name:"toon|json"},{flag:"--output-session",value_name:"state"},{flag:"--output-cursor",value_name:"cursor"},{flag:"--output-row-contract"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"]},{flag:"--no-extensions"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"}]),ri=new Set(Hn.flatMap(e=>[e.flag,...e.aliases??[]]));export{X as a,st as b,at as c,to as d,ge as e,ye as f,he as g,no as h,be as i,Ee as j,Oe as k,ct as l,ro as m,io as n,so as o,ao as p,co as q,uo as r,lo as s,fo as t,_o as u,po as v,mo as w,go as x,yo as y,ho as z,bo as A,Eo as B,Oo as C,ut as D,Ao as E,So as F,wo as G,To as H,xo as I,ko as J,Io as K,lt as L,ft as M,_t as N,vo as O,Do as P,pt as Q,Mo as R,Uo as S,gt as T,yt as U,W as V,Po as W,Lo as X,g as Y,_ as Z,Hn as _,ri as $,z as aa,v as ba,gr as ca,yr as da,U as ea,Go as fa,$o as ga,Ko as ha,ht as ia,bt as ja,Et as ka,Xo as la,Wo as ma,Ot as na,P as oa,Jo as pa,At as qa,St as ra,we as sa,L as ta,wt as ua,Qo as va,Ho as wa,Zo as xa,er as ya,tr as za,nr as Aa,or as Ba,H as Ca,$ as Da,Re as Ea,Z as Fa,Ne as Ga,vt as Ha,lr as Ia,Ce as Ja,Dt as Ka,Gt as La,Kt as Ma,ve as Na,zt as Oa,qt as Pa,De as Qa,ee as Ra,Me as Sa,fr as Ta,_r as Ua,de as Va,le as Wa,Tr as Xa,xr as Ya,ie as Za,se as _a,ae as $a,kr as ab,En as bb,Ir as cb,Rr as db,w as eb,Ye as fb,Vr as gb,Fr as hb,Sn as ib,M as jb,Br as kb,Qe as lb,Rn as mb,Gr as nb,tt as ob,$r as pb,Kr as qb,zr as rb,qr as sb};
|
|
5
|
+
//# sourceMappingURL=chunk-C4S4A4JJ.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as x}from"./chunk-
|
|
1
|
+
import{c as x}from"./chunk-2POVTNLY.js";import{Ka as a,Ma as w,q as m,x as T}from"./chunk-3LKU6PTJ.js";import{L as v,Y as f,Z as u,o as _,p as b,q as E}from"./chunk-C4S4A4JJ.js";import C from"node:fs/promises";import p 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]="6fc24a7c-a359-51fd-a432-4c8037d10e9e")}catch{}})();var z=["extensions","docs","examples","assets","prompts"],R=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function q(e){return z.includes(e)}function G(e,t){if(t==null)return[];let r=Array.isArray(t)?t:[t],n=[];for(let i of r){if(typeof i!="string"||i.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);n.push(i.trim())}return[...new Set(n)].sort((i,o)=>i.localeCompare(o))}function J(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},r=e;for(let[n,i]of Object.entries(r)){if(!q(n))continue;let o=G(n,i);o.length>0&&(t[n]=o)}return t}function c(e,t){let r=e[t];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0);return t.length>0?[...new Set(t)].sort((r,n)=>r.localeCompare(n)):void 0}function I(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(r).some(n=>typeof n=="string")?r:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={image:c(t,"image"),video:c(t,"video")};return Object.values(r).some(n=>typeof n=="string")?r:void 0}function Y(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,r={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:K(t.links),media:V(t.media),tags:S(t.tags)};return Object.values(r).some(n=>n!==void 0)?r:void 0}async function B(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let r;try{r=JSON.parse(await C.readFile(t,"utf8"))}catch(d){throw new u(`Failed to parse package manifest at "${t}": ${String(d)}`,f.USAGE)}if(typeof r!="object"||r===null||Array.isArray(r))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let n=r,i=n.pm,o=i!=null,s=typeof i=="object"&&i!==null&&!Array.isArray(i)?i:{};return{source:o?"pm":"convention",package_json_path:t,package_name:typeof n.name=="string"?n.name:void 0,package_version:typeof n.version=="string"?n.version:void 0,package_private:n.private===!0,package_description:typeof n.description=="string"?n.description:void 0,package_keywords:S(n.keywords),package_homepage:typeof n.homepage=="string"?n.homepage:void 0,package_repository_url:I(n.repository),package_bugs_url:I(n.bugs),aliases:S(s.aliases),resources:J(i),catalog:Y(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),r=[];for(let n of t){if(!n.isDirectory())continue;let i=p.join(e,n.name);await m(p.join(i,"manifest.json"))&&r.push(i)}return r.sort((n,i)=>n.localeCompare(i))}async function _e(e){if(await m(p.join(e,"manifest.json")))return[e];let r=(await B(e)).resources.extensions??[],n=new Set;for(let i of r){if(i.includes("*")||i.startsWith("!"))throw new u(`Package extension entry "${i}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,i);if(!T(e,o))throw new u(`Package extension entry "${i}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let s of await j(o))n.add(s)}if(r.length===0)for(let i of R.extensions)for(let o of await j(p.join(e,i)))n.add(o);return[...n].sort((i,o)=>i.localeCompare(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]="48c3e62a-8085-5215-a692-4c03792022ce")}catch{}})();var D=1,A=6,$=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function k(e){return"#".repeat(e)}function F(e){if(!e.includes("`"))return`\`${e}\``;let t=0,r=0;for(let o of e)r=o==="`"?r+1:0,t=Math.max(t,r);let n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}function W(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map(F).join(", ")}`}function H(e,t,r){let n=[`${k(t)} ${e}`,""];return r.length===0?(n.push("_None._",""),n):(n.push(...r.map(i=>`- ${F(i)}`),""),n)}function X(e,t,r){return e===0&&!r?[]:[`${k(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function Ee(e,t={}){let r=t.headingLevel??2;if(!Number.isInteger(r)||r<D||r>A)throw new RangeError(`headingLevel must be an integer in [${D}, ${A}], received ${String(t.headingLevel)}`);let n=Math.min(r+1,A),i=t.includeEmpty===!0,o=t.title??"Extension surfaces",s=[`${k(r)} ${o}`,""];(i||e.capabilities.length>0)&&s.push(W(e.capabilities),"");for(let[l,y]of $){let g=e[l]??[];g.length===0&&!i||s.push(...H(y,n,g))}return s.push(...X(e.preflight_overrides,n,i)),!(e.preflight_overrides>0||$.some(([l])=>(e[l]?.length??0)>0))&&!i&&s.push("_This extension registers no surfaces._",""),`${s.join(`
|
|
2
2
|
`).trimEnd()}
|
|
3
3
|
`}(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]="e3f016bb-8add-5765-bb1a-a7b22423f8d1")}catch{}})();var Q=["agile","ops","research"],Z={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function ke(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${Q.join(", ")}.`)}function ve(e){return Z[e].map(t=>x(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]="2b5a573e-1e36-58b9-b93b-4a4088f71e9a")}catch{}})();var ee=new Set(b),te=new Set(E),N=new Set([...v.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),ne=["create","update"];function P(e){if(typeof e!="string")return"";let t=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return t.startsWith("--")?t.slice(2):t}function O(e){return e.replaceAll("_","-")}function re(e,t){let r=new Set;for(let n of e){let i=P(n);i.length>0&&i!==t&&r.add(i)}return[...r].sort((n,i)=>n.localeCompare(i))}function ie(e){let t=new Set;for(let r of e??[]){let n=r.trim();n.length>0&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function oe(e){let t=new Set,r=[];for(let n of e??[]){let i=n.trim().toLowerCase();if(i.length!==0){if(!te.has(i))throw new Error(`Invalid field command "${n}". Allowed: ${E.join(", ")}.`);t.has(i)||(t.add(i),r.push(i))}}return e===void 0||r.length===0?[...ne]:r}function je(e){let t=a(e.key);if(t.length===0)throw new Error("Field key must not be empty.");if(N.has(t))throw new Error(`Cannot define custom field "${t}": custom schema field "${t}" collides with built-in item metadata "${t}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...N].sort((g,U)=>g.localeCompare(U)).join(", ")}.`);let r=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!ee.has(r))throw new Error(`Invalid field type "${e.type}". Allowed: ${b.join(", ")}.`);let n=r,i=oe(e.commands),o=P(e.cliFlag),s=o.length>0&&o!==O(t)?o:void 0,d=s??O(t),l=re(e.aliases??[],d),y=e.description?.trim();return{key:t,type:n,commands:i,description:y&&y.length>0?y:void 0,cliFlag:s,cliAliases:l,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:ie(e.requiredTypes)}}function se(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function ae(e){let t=se(e);if(!t)return[];let r=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.key!="string"||i.key.trim().length===0||r.push(i)}return r}function Ce(e){if(e==null||e.trim().length===0)return{fields:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:ae(t)}}function De(e){return`${JSON.stringify({fields:e.fields},null,2)}
|
|
4
4
|
`}function $e(e,t){let r=e.fields.find(s=>a(s.key)===t.key),n=r!==void 0,i=e.fields.filter(s=>a(s.key)!==t.key),o={...r,key:t.key,type:t.type,commands:[...t.commands]};return L(o,"description",t.description),L(o,"cli_flag",t.cliFlag),t.cliAliases.length>0?o.cli_aliases=[...t.cliAliases]:delete o.cli_aliases,M(o,"required",t.required),M(o,"required_on_create",t.requiredOnCreate),t.allowUnset===!1?o.allow_unset=!1:delete o.allow_unset,t.requiredTypes.length>0?o.required_types=[...t.requiredTypes]:delete o.required_types,i.push(o),i.sort((s,d)=>a(s.key).localeCompare(a(d.key))),{file:{fields:i},definition:o,replaced:n}}function Fe(e,t){let r=a(t);if(r.length===0)throw new Error("Field key must not be empty.");let n=[],i=e.fields.filter(o=>a(o.key)===r?(n.push(o),!1):!0);return n.length===0?{file:{fields:i},removed:!1}:{file:{fields:i},removed:!0,definition:n[0]}}function L(e,t,r){let n=e;r!==void 0&&r.length>0?n[t]=r:delete n[t]}function M(e,t,r){let n=e;r?n[t]=!0:delete n[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]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}catch{}})();var de=new Set(_),h=new Set(w.map(e=>a(e.id)).filter(e=>e.length>0));function le(e){let t=new Set;for(let r of e){let n=a(r);n.length>0&&t.add(n)}return[...t].sort((r,n)=>r.localeCompare(n))}function Ue(e){let t=a(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(h.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let r;if(e.roles!==void 0){r=[];let s=new Set;for(let d of e.roles){let l=typeof d=="string"?d.trim().toLowerCase():"";if(l.length!==0){if(!de.has(l))throw new Error(`Invalid status role "${d}". Allowed roles: ${_.join(", ")}.`);s.has(l)||(s.add(l),r.push(l))}}}let n=e.aliases===void 0?void 0:le(e.aliases).filter(s=>s!==t),i=e.description?.trim(),o=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:r,aliases:n,description:i&&i.length>0?i:void 0,order:o}}function ce(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function fe(e){let t=ce(e);if(!t)return[];let r=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.id!="string"||i.id.trim().length===0||r.push(i)}return r}function ze(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:fe(t)}}function Re(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
|
|
5
5
|
`}function qe(e,t,r){let n=e.statuses.slice(),i=n.findIndex(d=>a(d.id)===t.id),o=i>=0?n[i]:r,s={...o,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),i>=0?n[i]=s:n.push(s),{file:{statuses:n},definition:s,replaced:o!==void 0}}function Ge(e,t){let r=a(t);if(r.length===0)throw new Error("Status id must not be empty.");if(h.has(r))throw new Error(`Cannot remove built-in status "${r}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n=e.statuses.slice(),i=n.findIndex(s=>a(s.id)===r);if(i<0)return{file:{statuses:n},removed:!1};let[o]=n.splice(i,1);return{file:{statuses:n},removed:!0,definition:o}}function Je(e,t){let r=[e.id,...e.aliases??[]];for(let n of r){let i=a(n);if(i.length===0)continue;let o=t.get(i);if(o!==void 0&&o!==e.id)throw new Error(`Status token "${i}" already belongs to status "${o}". Choose a different id/alias to avoid shadowing it.`)}}export{z as a,R as b,B as c,_e as d,Q as e,Z as f,ke as g,ve as h,je as i,Ce as j,De as k,$e as l,Fe as m,h as n,Ue as o,ze as p,Re as q,qe as r,Ge as s,Je as t,Ee as u};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-D6RBZEJJ.js.map
|