@unbrained/pm-cli 2026.5.30 → 2026.5.31
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/CHANGELOG.md +25 -0
- package/dist/cli/commands/calendar.js +81 -9
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/create.js +34 -4
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/extension/install-sources.d.ts +2 -0
- package/dist/cli/commands/extension/install-sources.js +11 -4
- package/dist/cli/commands/extension/install-sources.js.map +1 -1
- package/dist/cli/commands/reindex.js +3 -3
- package/dist/cli/commands/reindex.js.map +1 -1
- package/dist/cli/commands/search.d.ts +17 -0
- package/dist/cli/commands/search.js +40 -10
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/register-list-query.js +9 -11
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.js +20 -22
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +32 -25
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +6 -8
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.js +6 -3
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli/search-refresh.d.ts +2 -0
- package/dist/cli/search-refresh.js +13 -0
- package/dist/cli/search-refresh.js.map +1 -0
- package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +17 -0
- package/dist/cli-bundle/chunks/activity-OWYSUZOY.js.map +7 -0
- package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js +209 -0
- package/dist/cli-bundle/chunks/aggregate-ADUOSFRO.js.map +7 -0
- package/dist/cli-bundle/chunks/append-JD2DETU7.js +73 -0
- package/dist/cli-bundle/chunks/append-JD2DETU7.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
- package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3M73P3G6.js +1636 -0
- package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +189 -0
- package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-5HSEP75M.js +330 -0
- package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js +1770 -0
- package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js +552 -0
- package/dist/cli-bundle/chunks/chunk-6YCV7WSL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js +202 -0
- package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js +157 -0
- package/dist/cli-bundle/chunks/chunk-A7E7PUVX.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js +90 -0
- package/dist/cli-bundle/chunks/chunk-AKOOMO3T.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js +950 -0
- package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js +79 -0
- package/dist/cli-bundle/chunks/chunk-CEFIVZPG.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js +349 -0
- package/dist/cli-bundle/chunks/chunk-D7AOMPRH.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
- package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +47 -0
- package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +56 -0
- package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js +435 -0
- package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-G57E5D7T.js +185 -0
- package/dist/cli-bundle/chunks/chunk-G57E5D7T.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js +3621 -0
- package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js +233 -0
- package/dist/cli-bundle/chunks/chunk-JFWUHHS2.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js +1861 -0
- package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js +648 -0
- package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-KBQY3YG5.js} +28 -70
- package/dist/cli-bundle/chunks/chunk-KBQY3YG5.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js +185 -0
- package/dist/cli-bundle/chunks/chunk-L2FXEKDB.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js +189 -0
- package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js +5153 -0
- package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js +1345 -0
- package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js +341 -0
- package/dist/cli-bundle/chunks/chunk-NGN7UV5K.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
- package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js +2929 -0
- package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +7 -0
- package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-P53TN6IA.js} +22 -30
- package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js +176 -0
- package/dist/cli-bundle/chunks/chunk-PVNQLCIS.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js +1680 -0
- package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
- package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js +60 -0
- package/dist/cli-bundle/chunks/chunk-SEXQN4KL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js +362 -0
- package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +141 -0
- package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js +632 -0
- package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js +252 -0
- package/dist/cli-bundle/chunks/chunk-WJ2NAC37.js.map +7 -0
- package/dist/cli-bundle/chunks/claim-EE4TKKCV.js +133 -0
- package/dist/cli-bundle/chunks/claim-EE4TKKCV.js.map +7 -0
- package/dist/cli-bundle/chunks/close-XY4CSAYF.js +14 -0
- package/dist/cli-bundle/chunks/close-XY4CSAYF.js.map +7 -0
- package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js +104 -0
- package/dist/cli-bundle/chunks/comments-AAKJQ6LW.js.map +7 -0
- package/dist/cli-bundle/chunks/config-V3FZOKLI.js +1577 -0
- package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +7 -0
- package/dist/cli-bundle/chunks/context-RZ5QPNJB.js +1458 -0
- package/dist/cli-bundle/chunks/context-RZ5QPNJB.js.map +7 -0
- package/dist/cli-bundle/chunks/contracts-YLMH33VU.js +1245 -0
- package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +7 -0
- package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +28 -0
- package/dist/cli-bundle/chunks/create-PZVHRIZQ.js.map +7 -0
- package/dist/cli-bundle/chunks/delete-RHCTEORS.js +59 -0
- package/dist/cli-bundle/chunks/delete-RHCTEORS.js.map +7 -0
- package/dist/cli-bundle/chunks/deps-MZYCMLAO.js +229 -0
- package/dist/cli-bundle/chunks/deps-MZYCMLAO.js.map +7 -0
- package/dist/cli-bundle/chunks/docs-FXXUCZYU.js +35 -0
- package/dist/cli-bundle/chunks/docs-FXXUCZYU.js.map +7 -0
- package/dist/cli-bundle/chunks/extension-B4WL7BQU.js +25 -0
- package/dist/cli-bundle/chunks/extension-B4WL7BQU.js.map +7 -0
- package/dist/cli-bundle/chunks/files-WVOX67PE.js +286 -0
- package/dist/cli-bundle/chunks/files-WVOX67PE.js.map +7 -0
- package/dist/cli-bundle/chunks/gc-JWNF66EC.js +181 -0
- package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +7 -0
- package/dist/cli-bundle/chunks/get-LTK3HOCQ.js +198 -0
- package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +7 -0
- package/dist/cli-bundle/chunks/health-TCWL55KM.js +1233 -0
- package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +7 -0
- package/dist/cli-bundle/chunks/history-A2JUDXUE.js +21 -0
- package/dist/cli-bundle/chunks/history-A2JUDXUE.js.map +7 -0
- package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +20 -0
- package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js.map +7 -0
- package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js +198 -0
- package/dist/cli-bundle/chunks/history-repair-ZWSTDRH2.js.map +7 -0
- package/dist/cli-bundle/chunks/init-M2WUB4YH.js +16 -0
- package/dist/cli-bundle/chunks/init-M2WUB4YH.js.map +7 -0
- package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js +48 -0
- package/dist/cli-bundle/chunks/learnings-NXTWE3FR.js.map +7 -0
- package/dist/cli-bundle/chunks/list-OGWQPC26.js +20 -0
- package/dist/cli-bundle/chunks/list-OGWQPC26.js.map +7 -0
- package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js +48 -0
- package/dist/cli-bundle/chunks/notes-DFS5ZGOO.js.map +7 -0
- package/dist/cli-bundle/chunks/plan-67AB2PLM.js +1175 -0
- package/dist/cli-bundle/chunks/plan-67AB2PLM.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-UP3VRUFS.js} +24 -15
- package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-YWSBF545.js} +38 -28
- package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-3BDTGSDH.js} +49 -30
- package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +7 -0
- package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-V56GDRUS.js} +21 -12
- package/dist/cli-bundle/chunks/register-setup-V56GDRUS.js.map +7 -0
- package/dist/cli-bundle/chunks/restore-MB2ISME7.js +18 -0
- package/dist/cli-bundle/chunks/restore-MB2ISME7.js.map +7 -0
- package/dist/cli-bundle/chunks/schema-Q622KC46.js +119 -0
- package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +7 -0
- package/dist/cli-bundle/chunks/search-HENBL456.js +1135 -0
- package/dist/cli-bundle/chunks/search-HENBL456.js.map +7 -0
- package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +124 -0
- package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +7 -0
- package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +32 -0
- package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js.map +7 -0
- package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js +332 -0
- package/dist/cli-bundle/chunks/test-all-G2AZOHXI.js.map +7 -0
- package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js +939 -0
- package/dist/cli-bundle/chunks/test-runs-GX5HTPSF.js.map +7 -0
- package/dist/cli-bundle/chunks/update-H6SCWNMA.js +22 -0
- package/dist/cli-bundle/chunks/update-H6SCWNMA.js.map +7 -0
- package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js +676 -0
- package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +7 -0
- package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js +271 -0
- package/dist/cli-bundle/chunks/upgrade-H5HHM5UV.js.map +7 -0
- package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js +1110 -0
- package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +7 -0
- package/dist/cli-bundle/main.js +146 -90
- package/dist/cli-bundle/main.js.map +4 -4
- package/dist/core/item/item-type-definition.js +6 -2
- package/dist/core/item/item-type-definition.js.map +1 -1
- package/dist/core/item/type-registry.d.ts +4 -0
- package/dist/core/item/type-registry.js +10 -2
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/search/background-refresh.d.ts +53 -0
- package/dist/core/search/background-refresh.js +286 -0
- package/dist/core/search/background-refresh.js.map +1 -0
- package/dist/core/search/cache.d.ts +20 -1
- package/dist/core/search/cache.js +33 -4
- package/dist/core/search/cache.js.map +1 -1
- package/dist/core/search/vector-stores.js +7 -3
- package/dist/core/search/vector-stores.js.map +1 -1
- package/dist/core/shared/constants.d.ts +2 -2
- package/dist/core/shared/constants.js +2 -3
- package/dist/core/shared/constants.js.map +1 -1
- package/dist/core/store/item-format-migration.js +25 -15
- package/dist/core/store/item-format-migration.js.map +1 -1
- package/dist/core/store/settings-validator.js +6 -2
- package/dist/core/store/settings-validator.js.map +1 -1
- package/dist/core/telemetry/runtime.d.ts +10 -0
- package/dist/core/telemetry/runtime.js +86 -2
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
- package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
- package/dist/sdk/cli-contracts.js +26 -5
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/docs/RELEASING.md +1 -1
- package/package.json +1 -2
- package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
- package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
- package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
- package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
- package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
- package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
- package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
|
@@ -0,0 +1,1245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
3
|
+
ACTIVITY_FLAG_CONTRACTS,
|
|
4
|
+
AGGREGATE_FLAG_CONTRACTS,
|
|
5
|
+
APPEND_FLAG_CONTRACTS,
|
|
6
|
+
CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
7
|
+
CALENDAR_FLAG_CONTRACTS,
|
|
8
|
+
CLAIM_FLAG_CONTRACTS,
|
|
9
|
+
CLOSE_FLAG_CONTRACTS,
|
|
10
|
+
CLOSE_TASK_FLAG_CONTRACTS,
|
|
11
|
+
COMMENTS_AUDIT_FLAG_CONTRACTS,
|
|
12
|
+
COMMENTS_FLAG_CONTRACTS,
|
|
13
|
+
COMPLETION_FLAG_CONTRACTS,
|
|
14
|
+
CONFIG_FLAG_CONTRACTS,
|
|
15
|
+
CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
16
|
+
CONTEXT_FLAG_CONTRACTS,
|
|
17
|
+
CONTRACTS_FLAG_CONTRACTS,
|
|
18
|
+
CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
|
|
19
|
+
CREATE_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
20
|
+
CREATE_FLAG_CONTRACTS,
|
|
21
|
+
DEDUPE_AUDIT_FLAG_CONTRACTS,
|
|
22
|
+
DELETE_FLAG_CONTRACTS,
|
|
23
|
+
DEPS_FLAG_CONTRACTS,
|
|
24
|
+
DOCS_FLAG_CONTRACTS,
|
|
25
|
+
EXTENSION_FLAG_CONTRACTS,
|
|
26
|
+
FILES_FLAG_CONTRACTS,
|
|
27
|
+
GC_FLAG_CONTRACTS,
|
|
28
|
+
GET_FLAG_CONTRACTS,
|
|
29
|
+
GLOBAL_FLAG_CONTRACTS,
|
|
30
|
+
GUIDE_FLAG_CONTRACTS,
|
|
31
|
+
HEALTH_FLAG_CONTRACTS,
|
|
32
|
+
HISTORY_FLAG_CONTRACTS,
|
|
33
|
+
HISTORY_REDACT_FLAG_CONTRACTS,
|
|
34
|
+
HISTORY_REPAIR_FLAG_CONTRACTS,
|
|
35
|
+
INIT_FLAG_CONTRACTS,
|
|
36
|
+
INSTALL_FLAG_CONTRACTS,
|
|
37
|
+
LEARNINGS_FLAG_CONTRACTS,
|
|
38
|
+
LIST_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
39
|
+
LIST_FILTER_FLAG_CONTRACTS,
|
|
40
|
+
NORMALIZE_FLAG_CONTRACTS,
|
|
41
|
+
NOTES_FLAG_CONTRACTS,
|
|
42
|
+
PAUSE_TASK_FLAG_CONTRACTS,
|
|
43
|
+
PLAN_FLAG_CONTRACTS,
|
|
44
|
+
PM_CORE_COMMAND_NAMES,
|
|
45
|
+
PM_EXTENSION_CAPABILITY_CONTRACTS,
|
|
46
|
+
PM_EXTENSION_POLICY_MODE_CONTRACTS,
|
|
47
|
+
PM_EXTENSION_POLICY_SURFACE_CONTRACTS,
|
|
48
|
+
PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,
|
|
49
|
+
PM_EXTENSION_SERVICE_NAME_CONTRACTS,
|
|
50
|
+
PM_EXTENSION_TRUST_MODE_CONTRACTS,
|
|
51
|
+
PM_TOOL_ACTIONS,
|
|
52
|
+
PM_TOOL_PARAMETERS_SCHEMA,
|
|
53
|
+
REINDEX_FLAG_CONTRACTS,
|
|
54
|
+
RELEASE_FLAG_CONTRACTS,
|
|
55
|
+
RESTORE_FLAG_CONTRACTS,
|
|
56
|
+
SCHEMA_FLAG_CONTRACTS,
|
|
57
|
+
SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
58
|
+
SEARCH_FLAG_CONTRACTS,
|
|
59
|
+
START_TASK_FLAG_CONTRACTS,
|
|
60
|
+
TEST_ALL_FLAG_CONTRACTS,
|
|
61
|
+
TEST_FLAG_CONTRACTS,
|
|
62
|
+
TEST_RUNS_FLAG_CONTRACTS,
|
|
63
|
+
UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
|
|
64
|
+
UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
65
|
+
UPDATE_FLAG_CONTRACTS,
|
|
66
|
+
UPDATE_MANY_FLAG_CONTRACTS,
|
|
67
|
+
UPGRADE_FLAG_CONTRACTS,
|
|
68
|
+
VALIDATE_FLAG_CONTRACTS,
|
|
69
|
+
compactFlagAliasContracts
|
|
70
|
+
} from "./chunk-GN7IJPCD.js";
|
|
71
|
+
import {
|
|
72
|
+
commandOptionFlagLabel,
|
|
73
|
+
resolveCommandOptionPolicyState,
|
|
74
|
+
resolveItemTypeRegistry
|
|
75
|
+
} from "./chunk-WDPXDQFG.js";
|
|
76
|
+
import {
|
|
77
|
+
EXIT_CODE,
|
|
78
|
+
PmCliError,
|
|
79
|
+
SETTINGS_DEFAULTS,
|
|
80
|
+
activateExtensions,
|
|
81
|
+
getActiveExtensionRegistrations,
|
|
82
|
+
getSettingsPath,
|
|
83
|
+
loadExtensions,
|
|
84
|
+
pathExists,
|
|
85
|
+
readSettings,
|
|
86
|
+
resolvePmRoot,
|
|
87
|
+
resolveRuntimeFieldRegistry,
|
|
88
|
+
resolveRuntimeStatusRegistry
|
|
89
|
+
} from "./chunk-LSXGH6NE.js";
|
|
90
|
+
|
|
91
|
+
// dist/cli/commands/contracts.js
|
|
92
|
+
!(function() {
|
|
93
|
+
try {
|
|
94
|
+
var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
|
|
95
|
+
n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "478936e5-660a-5f89-b15d-93b37468c7ed");
|
|
96
|
+
} catch (e2) {
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
var LIST_COMMAND_NAMES = /* @__PURE__ */ new Set([
|
|
100
|
+
"list",
|
|
101
|
+
"list-all",
|
|
102
|
+
"list-draft",
|
|
103
|
+
"list-open",
|
|
104
|
+
"list-in-progress",
|
|
105
|
+
"list-blocked",
|
|
106
|
+
"list-closed",
|
|
107
|
+
"list-canceled"
|
|
108
|
+
]);
|
|
109
|
+
var PACKAGE_OWNED_ACTIONS = /* @__PURE__ */ new Set([
|
|
110
|
+
"calendar",
|
|
111
|
+
"dedupe-audit",
|
|
112
|
+
"guide",
|
|
113
|
+
"reindex",
|
|
114
|
+
"normalize",
|
|
115
|
+
"comments-audit",
|
|
116
|
+
"completion",
|
|
117
|
+
"test-runs-list",
|
|
118
|
+
"test-runs-status",
|
|
119
|
+
"test-runs-logs",
|
|
120
|
+
"test-runs-stop",
|
|
121
|
+
"test-runs-resume",
|
|
122
|
+
"templates-list",
|
|
123
|
+
"templates-save",
|
|
124
|
+
"templates-show"
|
|
125
|
+
]);
|
|
126
|
+
var PACKAGE_OWNED_COMMANDS = /* @__PURE__ */ new Set([
|
|
127
|
+
"cal",
|
|
128
|
+
"calendar",
|
|
129
|
+
"comments-audit",
|
|
130
|
+
"completion",
|
|
131
|
+
"completion-tags",
|
|
132
|
+
"dedupe-audit",
|
|
133
|
+
"guide",
|
|
134
|
+
"normalize",
|
|
135
|
+
"reindex",
|
|
136
|
+
"templates",
|
|
137
|
+
"templates list",
|
|
138
|
+
"templates save",
|
|
139
|
+
"templates show",
|
|
140
|
+
"test-runs",
|
|
141
|
+
"test-runs list",
|
|
142
|
+
"test-runs status",
|
|
143
|
+
"test-runs logs",
|
|
144
|
+
"test-runs stop",
|
|
145
|
+
"test-runs resume"
|
|
146
|
+
]);
|
|
147
|
+
var PACKAGE_OWNED_COMMAND_INSTALL_HINTS = /* @__PURE__ */ new Map([
|
|
148
|
+
["cal", "calendar"],
|
|
149
|
+
["calendar", "calendar"],
|
|
150
|
+
["comments-audit", "governance-audit"],
|
|
151
|
+
["completion", "guide-shell"],
|
|
152
|
+
["completion-tags", "guide-shell"],
|
|
153
|
+
["dedupe-audit", "governance-audit"],
|
|
154
|
+
["guide", "guide-shell"],
|
|
155
|
+
["normalize", "governance-audit"],
|
|
156
|
+
["reindex", "search-advanced"],
|
|
157
|
+
["templates", "templates"],
|
|
158
|
+
["templates list", "templates"],
|
|
159
|
+
["templates save", "templates"],
|
|
160
|
+
["templates show", "templates"],
|
|
161
|
+
["test-runs", "linked-test-adapters"],
|
|
162
|
+
["test-runs list", "linked-test-adapters"],
|
|
163
|
+
["test-runs status", "linked-test-adapters"],
|
|
164
|
+
["test-runs logs", "linked-test-adapters"],
|
|
165
|
+
["test-runs stop", "linked-test-adapters"],
|
|
166
|
+
["test-runs resume", "linked-test-adapters"]
|
|
167
|
+
]);
|
|
168
|
+
var CANONICAL_COMMAND_ALIASES = [
|
|
169
|
+
{
|
|
170
|
+
canonical: "context",
|
|
171
|
+
aliases: ["ctx"]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
canonical: "package",
|
|
175
|
+
aliases: ["extension", "packages", "install"]
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
var COMMAND_ALIAS_TO_CANONICAL = new Map(CANONICAL_COMMAND_ALIASES.flatMap((entry) => entry.aliases.map((alias) => [alias, entry.canonical])));
|
|
179
|
+
function resolveActionCommandPath(action) {
|
|
180
|
+
if (PM_CORE_COMMAND_NAMES.includes(action)) {
|
|
181
|
+
return normalizeCommandPath(action);
|
|
182
|
+
}
|
|
183
|
+
if (action.startsWith("extension-")) {
|
|
184
|
+
return normalizeCommandPath(`extension ${action.slice("extension-".length)}`);
|
|
185
|
+
}
|
|
186
|
+
if (action.startsWith("package-")) {
|
|
187
|
+
return normalizeCommandPath(`package ${action.slice("package-".length)}`);
|
|
188
|
+
}
|
|
189
|
+
if (action.startsWith("test-runs-")) {
|
|
190
|
+
return normalizeCommandPath(`test-runs ${action.slice("test-runs-".length)}`);
|
|
191
|
+
}
|
|
192
|
+
if (action.startsWith("templates-")) {
|
|
193
|
+
return normalizeCommandPath(`templates ${action.slice("templates-".length)}`);
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
function actionDescriptorMatchesSelectedCommand(descriptor, selectedCommand) {
|
|
198
|
+
if (descriptor.command_path === null) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return splitCommandPathAliases(descriptor.command_path).some((commandPath) => {
|
|
202
|
+
if (commandPath === selectedCommand) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
return commandPath.startsWith(`${selectedCommand} `);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function splitCommandPathAliases(commandPath) {
|
|
209
|
+
return commandPath.split("|").map((entry) => normalizeCommandPath(entry)).filter((entry) => entry.length > 0);
|
|
210
|
+
}
|
|
211
|
+
function resolveScopedCommandsFromActionDescriptors(descriptors, commandCatalog) {
|
|
212
|
+
const commandSet = new Set(commandCatalog);
|
|
213
|
+
const scoped = /* @__PURE__ */ new Set();
|
|
214
|
+
for (const descriptor of descriptors) {
|
|
215
|
+
if (!descriptor.command_path) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
for (const commandPath of splitCommandPathAliases(descriptor.command_path)) {
|
|
219
|
+
const tokens = commandPath.split(" ").filter((entry) => entry.length > 0);
|
|
220
|
+
if (tokens.length === 0) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
for (let end = tokens.length; end > 0; end -= 1) {
|
|
224
|
+
const candidate = tokens.slice(0, end).join(" ");
|
|
225
|
+
if (!commandSet.has(candidate)) {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
scoped.add(candidate);
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return [...scoped].sort((left, right) => left.localeCompare(right));
|
|
234
|
+
}
|
|
235
|
+
function normalizeToken(value) {
|
|
236
|
+
if (typeof value !== "string") {
|
|
237
|
+
return void 0;
|
|
238
|
+
}
|
|
239
|
+
const trimmed = value.trim().toLowerCase();
|
|
240
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
241
|
+
}
|
|
242
|
+
function extractActionBranches(schema) {
|
|
243
|
+
const oneOf = schema.oneOf;
|
|
244
|
+
if (!Array.isArray(oneOf)) {
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
return oneOf.filter((entry) => typeof entry === "object" && entry !== null);
|
|
248
|
+
}
|
|
249
|
+
function filterSchemaByAction(schema, action) {
|
|
250
|
+
if (!action) {
|
|
251
|
+
return { ...schema };
|
|
252
|
+
}
|
|
253
|
+
const branches = extractActionBranches(schema);
|
|
254
|
+
const filtered = branches.filter((entry) => {
|
|
255
|
+
const properties = entry.properties;
|
|
256
|
+
if (typeof properties !== "object" || properties === null) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
const actionProperty = properties.action;
|
|
260
|
+
if (typeof actionProperty !== "object" || actionProperty === null) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return actionProperty.const === action;
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
...schema,
|
|
267
|
+
oneOf: filtered
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function filterSchemaByActions(schema, actions) {
|
|
271
|
+
const branches = extractActionBranches(schema);
|
|
272
|
+
const filtered = branches.filter((entry) => {
|
|
273
|
+
const properties = entry.properties;
|
|
274
|
+
if (typeof properties !== "object" || properties === null) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
const actionProperty = properties.action;
|
|
278
|
+
if (typeof actionProperty !== "object" || actionProperty === null) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
const actionConst = actionProperty.const;
|
|
282
|
+
return typeof actionConst === "string" && actions.has(actionConst);
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
...schema,
|
|
286
|
+
oneOf: filtered
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function normalizeCommandPath(value) {
|
|
290
|
+
return value.trim().toLowerCase().split(/\s+/).filter((entry) => entry.length > 0).join(" ");
|
|
291
|
+
}
|
|
292
|
+
function normalizeActionNameFromCommand(commandPath) {
|
|
293
|
+
return commandPath.replace(/\s+/g, "-");
|
|
294
|
+
}
|
|
295
|
+
function toOptionalTrimmedString(value) {
|
|
296
|
+
if (typeof value !== "string") {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
const trimmed = value.trim();
|
|
300
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
301
|
+
}
|
|
302
|
+
function normalizeStringList(values) {
|
|
303
|
+
if (!Array.isArray(values)) {
|
|
304
|
+
return [];
|
|
305
|
+
}
|
|
306
|
+
const normalized = [];
|
|
307
|
+
const seen = /* @__PURE__ */ new Set();
|
|
308
|
+
for (const value of values) {
|
|
309
|
+
const trimmed = toOptionalTrimmedString(value);
|
|
310
|
+
if (!trimmed || seen.has(trimmed)) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
seen.add(trimmed);
|
|
314
|
+
normalized.push(trimmed);
|
|
315
|
+
}
|
|
316
|
+
return normalized;
|
|
317
|
+
}
|
|
318
|
+
function toExtensionFlagContract(definition) {
|
|
319
|
+
const longName = toOptionalTrimmedString(definition.long);
|
|
320
|
+
const shortName = toOptionalTrimmedString(definition.short);
|
|
321
|
+
const normalizedLong = longName && longName.startsWith("--") && longName.length > 2 ? longName : null;
|
|
322
|
+
const normalizedShort = shortName && shortName.startsWith("-") && !shortName.startsWith("--") ? shortName : null;
|
|
323
|
+
const flag = normalizedLong ?? normalizedShort;
|
|
324
|
+
if (!flag) {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
const contract = { flag };
|
|
328
|
+
if (normalizedShort && normalizedLong) {
|
|
329
|
+
contract.short = normalizedShort;
|
|
330
|
+
}
|
|
331
|
+
const description = toOptionalTrimmedString(definition.description);
|
|
332
|
+
if (description) {
|
|
333
|
+
contract.description = description;
|
|
334
|
+
}
|
|
335
|
+
if (definition.required === true) {
|
|
336
|
+
contract.required = true;
|
|
337
|
+
}
|
|
338
|
+
if (definition.repeatable === true) {
|
|
339
|
+
contract.repeatable = true;
|
|
340
|
+
}
|
|
341
|
+
const valueName = toOptionalTrimmedString(definition.value_name);
|
|
342
|
+
if (valueName) {
|
|
343
|
+
contract.value_name = valueName;
|
|
344
|
+
}
|
|
345
|
+
const rawValueType = [
|
|
346
|
+
toOptionalTrimmedString(definition.value_type),
|
|
347
|
+
toOptionalTrimmedString(definition.type),
|
|
348
|
+
valueName ? "string" : null
|
|
349
|
+
].find((candidate) => candidate === "string" || candidate === "number" || candidate === "boolean");
|
|
350
|
+
if (rawValueType) {
|
|
351
|
+
contract.value_type = rawValueType;
|
|
352
|
+
}
|
|
353
|
+
return contract;
|
|
354
|
+
}
|
|
355
|
+
function collectExtensionFlagContractsByCommand(registrations) {
|
|
356
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
357
|
+
for (const registration of registrations) {
|
|
358
|
+
const commandPath = normalizeCommandPath(registration.target_command);
|
|
359
|
+
if (commandPath.length === 0) {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const bucket = grouped.get(commandPath) ?? {
|
|
363
|
+
flags: [],
|
|
364
|
+
sources: [],
|
|
365
|
+
dedupe: /* @__PURE__ */ new Set(),
|
|
366
|
+
sourceDedupe: /* @__PURE__ */ new Set()
|
|
367
|
+
};
|
|
368
|
+
const sourceKey = `${registration.layer}:${registration.name}`;
|
|
369
|
+
if (!bucket.sourceDedupe.has(sourceKey)) {
|
|
370
|
+
bucket.sourceDedupe.add(sourceKey);
|
|
371
|
+
bucket.sources.push({
|
|
372
|
+
layer: registration.layer,
|
|
373
|
+
name: registration.name
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
for (const definition of registration.flags) {
|
|
377
|
+
const contract = toExtensionFlagContract(definition);
|
|
378
|
+
if (!contract) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
const key = `${contract.flag}|${contract.short ?? ""}`;
|
|
382
|
+
if (bucket.dedupe.has(key)) {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
bucket.dedupe.add(key);
|
|
386
|
+
bucket.flags.push(contract);
|
|
387
|
+
}
|
|
388
|
+
grouped.set(commandPath, bucket);
|
|
389
|
+
}
|
|
390
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
391
|
+
for (const [commandPath, bucket] of grouped.entries()) {
|
|
392
|
+
normalized.set(commandPath, {
|
|
393
|
+
flags: bucket.flags,
|
|
394
|
+
sources: bucket.sources.sort((left, right) => {
|
|
395
|
+
const layerOrder = left.layer.localeCompare(right.layer);
|
|
396
|
+
if (layerOrder !== 0) {
|
|
397
|
+
return layerOrder;
|
|
398
|
+
}
|
|
399
|
+
return (left.name ?? "").localeCompare(right.name ?? "");
|
|
400
|
+
})
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return normalized;
|
|
404
|
+
}
|
|
405
|
+
function collectExtensionCommandContracts(runtimeProbe) {
|
|
406
|
+
const flagsByCommand = collectExtensionFlagContractsByCommand(runtimeProbe.flagRegistrations);
|
|
407
|
+
const definitionsByCommand = /* @__PURE__ */ new Map();
|
|
408
|
+
for (const definition of runtimeProbe.commandDefinitions) {
|
|
409
|
+
const command = normalizeCommandPath(definition.command);
|
|
410
|
+
if (command.length === 0) {
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
const action = toOptionalTrimmedString(definition.action) ?? normalizeActionNameFromCommand(command);
|
|
414
|
+
const args = Array.isArray(definition.arguments) ? definition.arguments.map((argument) => {
|
|
415
|
+
const name = toOptionalTrimmedString(argument.name);
|
|
416
|
+
if (!name) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
name,
|
|
421
|
+
required: argument.required === true,
|
|
422
|
+
variadic: argument.variadic === true,
|
|
423
|
+
description: toOptionalTrimmedString(argument.description)
|
|
424
|
+
};
|
|
425
|
+
}).filter((argument) => argument !== null) : [];
|
|
426
|
+
definitionsByCommand.set(command, {
|
|
427
|
+
command,
|
|
428
|
+
action,
|
|
429
|
+
source: {
|
|
430
|
+
layer: definition.layer,
|
|
431
|
+
name: definition.name
|
|
432
|
+
},
|
|
433
|
+
description: toOptionalTrimmedString(definition.description),
|
|
434
|
+
intent: toOptionalTrimmedString(definition.intent),
|
|
435
|
+
arguments: args,
|
|
436
|
+
flags: flagsByCommand.get(command)?.flags ?? [],
|
|
437
|
+
examples: normalizeStringList(definition.examples),
|
|
438
|
+
failure_hints: normalizeStringList(definition.failure_hints)
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
const extensionCommands = /* @__PURE__ */ new Set();
|
|
442
|
+
for (const command of runtimeProbe.handlers) {
|
|
443
|
+
extensionCommands.add(normalizeCommandPath(command));
|
|
444
|
+
}
|
|
445
|
+
for (const command of definitionsByCommand.keys()) {
|
|
446
|
+
extensionCommands.add(command);
|
|
447
|
+
}
|
|
448
|
+
for (const command of flagsByCommand.keys()) {
|
|
449
|
+
extensionCommands.add(command);
|
|
450
|
+
}
|
|
451
|
+
const contracts = [];
|
|
452
|
+
for (const command of [...extensionCommands].sort((left, right) => left.localeCompare(right))) {
|
|
453
|
+
const definition = definitionsByCommand.get(command);
|
|
454
|
+
if (definition) {
|
|
455
|
+
contracts.push({
|
|
456
|
+
...definition,
|
|
457
|
+
flags: definition.flags.length > 0 ? definition.flags : flagsByCommand.get(command)?.flags ?? []
|
|
458
|
+
});
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
contracts.push({
|
|
462
|
+
command,
|
|
463
|
+
action: normalizeActionNameFromCommand(command),
|
|
464
|
+
source: null,
|
|
465
|
+
description: null,
|
|
466
|
+
intent: null,
|
|
467
|
+
arguments: [],
|
|
468
|
+
flags: flagsByCommand.get(command)?.flags ?? [],
|
|
469
|
+
examples: [],
|
|
470
|
+
failure_hints: []
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
return contracts;
|
|
474
|
+
}
|
|
475
|
+
function extensionSchemaPropertyNameFromFlag(flag) {
|
|
476
|
+
const normalized = flag.flag.replace(/^-+/, "").trim();
|
|
477
|
+
if (normalized.length === 0) {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
const camelCased = normalized.replace(/-([a-z0-9])/g, (_match, char) => char.toUpperCase());
|
|
481
|
+
const cleaned = camelCased.replace(/[^a-zA-Z0-9]/g, "");
|
|
482
|
+
return cleaned.length > 0 ? cleaned : null;
|
|
483
|
+
}
|
|
484
|
+
function buildExtensionActionSchemaBranch(contract) {
|
|
485
|
+
const commands = contract.command.split("|").map((command) => command.trim()).filter((command) => command.length > 0);
|
|
486
|
+
const properties = {
|
|
487
|
+
action: {
|
|
488
|
+
type: "string",
|
|
489
|
+
const: contract.action,
|
|
490
|
+
description: contract.intent ?? contract.description ?? `Invoke extension command '${contract.command}'.`
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
const required = ["action"];
|
|
494
|
+
for (const argument of contract.arguments) {
|
|
495
|
+
if (argument.variadic) {
|
|
496
|
+
properties[argument.name] = {
|
|
497
|
+
type: "array",
|
|
498
|
+
items: { type: "string" },
|
|
499
|
+
description: argument.description ?? `Variadic argument '${argument.name}' for extension action '${contract.action}'.`
|
|
500
|
+
};
|
|
501
|
+
} else {
|
|
502
|
+
properties[argument.name] = {
|
|
503
|
+
type: "string",
|
|
504
|
+
description: argument.description ?? `Argument '${argument.name}' for extension action '${contract.action}'.`
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
if (argument.required) {
|
|
508
|
+
required.push(argument.name);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
for (const flag of contract.flags) {
|
|
512
|
+
const propertyName = extensionSchemaPropertyNameFromFlag(flag);
|
|
513
|
+
if (!propertyName || properties[propertyName] !== void 0) {
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
const valueType = flag.value_type ?? "boolean";
|
|
517
|
+
const schemaType = valueType === "boolean" ? "boolean" : valueType === "number" ? ["number", "string"] : "string";
|
|
518
|
+
properties[propertyName] = {
|
|
519
|
+
type: flag.repeatable ? "array" : schemaType,
|
|
520
|
+
...flag.repeatable ? { items: { type: schemaType } } : {},
|
|
521
|
+
description: flag.description ?? `Extension option '${flag.flag}' for action '${contract.action}'.`
|
|
522
|
+
};
|
|
523
|
+
if (flag.required === true) {
|
|
524
|
+
required.push(propertyName);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return {
|
|
528
|
+
type: "object",
|
|
529
|
+
properties,
|
|
530
|
+
required,
|
|
531
|
+
additionalProperties: true,
|
|
532
|
+
"x-extension-source": contract.source,
|
|
533
|
+
"x-extension-command": commands[0] ?? contract.command,
|
|
534
|
+
"x-extension-commands": commands
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function mergeExtensionFlagContract(existing, incoming) {
|
|
538
|
+
existing.description ??= incoming.description;
|
|
539
|
+
existing.value_name ??= incoming.value_name;
|
|
540
|
+
existing.value_type ??= incoming.value_type;
|
|
541
|
+
if (incoming.required === true) {
|
|
542
|
+
existing.required = true;
|
|
543
|
+
}
|
|
544
|
+
if (incoming.repeatable === true) {
|
|
545
|
+
existing.repeatable = true;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
function mergeExtensionContractsByAction(contracts) {
|
|
549
|
+
const byAction = /* @__PURE__ */ new Map();
|
|
550
|
+
for (const contract of contracts) {
|
|
551
|
+
const existing = byAction.get(contract.action);
|
|
552
|
+
if (!existing) {
|
|
553
|
+
byAction.set(contract.action, {
|
|
554
|
+
...contract,
|
|
555
|
+
flags: [...contract.flags],
|
|
556
|
+
examples: [...contract.examples],
|
|
557
|
+
failure_hints: [...contract.failure_hints]
|
|
558
|
+
});
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
existing.command = [.../* @__PURE__ */ new Set([existing.command, contract.command])].sort((left, right) => left.localeCompare(right)).join("|");
|
|
562
|
+
existing.arguments = existing.arguments.length >= contract.arguments.length ? existing.arguments : contract.arguments;
|
|
563
|
+
const flagKeys = new Set(existing.flags.map((flag) => `${flag.flag}|${flag.short ?? ""}`));
|
|
564
|
+
for (const flag of contract.flags) {
|
|
565
|
+
const key = `${flag.flag}|${flag.short ?? ""}`;
|
|
566
|
+
if (!flagKeys.has(key)) {
|
|
567
|
+
flagKeys.add(key);
|
|
568
|
+
existing.flags.push(flag);
|
|
569
|
+
} else {
|
|
570
|
+
const existingFlag = existing.flags.find((candidate) => `${candidate.flag}|${candidate.short ?? ""}` === key);
|
|
571
|
+
if (existingFlag) {
|
|
572
|
+
mergeExtensionFlagContract(existingFlag, flag);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
existing.examples = [.../* @__PURE__ */ new Set([...existing.examples, ...contract.examples])];
|
|
577
|
+
existing.failure_hints = [.../* @__PURE__ */ new Set([...existing.failure_hints, ...contract.failure_hints])];
|
|
578
|
+
}
|
|
579
|
+
return [...byAction.values()].sort((left, right) => left.action.localeCompare(right.action));
|
|
580
|
+
}
|
|
581
|
+
async function resolveRuntimeExtensionActionProbe(global2) {
|
|
582
|
+
const defaultPolicyState = {
|
|
583
|
+
mode: SETTINGS_DEFAULTS.extensions.policy.mode,
|
|
584
|
+
trust_mode: SETTINGS_DEFAULTS.extensions.policy.trust_mode,
|
|
585
|
+
default_sandbox_profile: SETTINGS_DEFAULTS.extensions.policy.default_sandbox_profile
|
|
586
|
+
};
|
|
587
|
+
if (global2.noExtensions) {
|
|
588
|
+
return {
|
|
589
|
+
handlers: /* @__PURE__ */ new Set(),
|
|
590
|
+
disabledReason: "extensions_disabled",
|
|
591
|
+
commandDefinitions: [],
|
|
592
|
+
flagRegistrations: [],
|
|
593
|
+
registrations: null,
|
|
594
|
+
policyState: defaultPolicyState
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
const pmRoot = resolvePmRoot(process.cwd(), global2.path);
|
|
598
|
+
if (!await pathExists(getSettingsPath(pmRoot))) {
|
|
599
|
+
return {
|
|
600
|
+
handlers: /* @__PURE__ */ new Set(),
|
|
601
|
+
disabledReason: null,
|
|
602
|
+
commandDefinitions: [],
|
|
603
|
+
flagRegistrations: [],
|
|
604
|
+
registrations: null,
|
|
605
|
+
policyState: defaultPolicyState
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
try {
|
|
609
|
+
const settings = await readSettings(pmRoot);
|
|
610
|
+
const loadResult = await loadExtensions({
|
|
611
|
+
pmRoot,
|
|
612
|
+
settings,
|
|
613
|
+
cwd: process.cwd(),
|
|
614
|
+
noExtensions: false
|
|
615
|
+
});
|
|
616
|
+
const activationResult = await activateExtensions({
|
|
617
|
+
...loadResult,
|
|
618
|
+
loaded: loadResult.loaded
|
|
619
|
+
});
|
|
620
|
+
const handlers = new Set(activationResult.commands.handlers.map((entry) => normalizeCommandPath(entry.command)));
|
|
621
|
+
return {
|
|
622
|
+
handlers,
|
|
623
|
+
disabledReason: null,
|
|
624
|
+
commandDefinitions: activationResult.registrations.commands,
|
|
625
|
+
flagRegistrations: activationResult.registrations.flags,
|
|
626
|
+
registrations: activationResult.registrations,
|
|
627
|
+
policyState: {
|
|
628
|
+
mode: loadResult.policy.mode,
|
|
629
|
+
trust_mode: loadResult.policy.trust_mode,
|
|
630
|
+
default_sandbox_profile: loadResult.policy.default_sandbox_profile
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
} catch {
|
|
634
|
+
return {
|
|
635
|
+
handlers: /* @__PURE__ */ new Set(),
|
|
636
|
+
disabledReason: "extension_runtime_probe_failed",
|
|
637
|
+
commandDefinitions: [],
|
|
638
|
+
flagRegistrations: [],
|
|
639
|
+
registrations: null,
|
|
640
|
+
policyState: defaultPolicyState
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
function collectActionContractDescriptors(extensionContracts) {
|
|
645
|
+
const descriptors = /* @__PURE__ */ new Map();
|
|
646
|
+
for (const action of PM_TOOL_ACTIONS) {
|
|
647
|
+
if (PACKAGE_OWNED_ACTIONS.has(action)) {
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
const commandPath = resolveActionCommandPath(action);
|
|
651
|
+
descriptors.set(action, {
|
|
652
|
+
action,
|
|
653
|
+
provider: "core",
|
|
654
|
+
requires_extension: false,
|
|
655
|
+
command_path: commandPath
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
for (const contract of extensionContracts) {
|
|
659
|
+
if (descriptors.has(contract.action)) {
|
|
660
|
+
continue;
|
|
661
|
+
}
|
|
662
|
+
descriptors.set(contract.action, {
|
|
663
|
+
action: contract.action,
|
|
664
|
+
provider: "extension",
|
|
665
|
+
requires_extension: true,
|
|
666
|
+
command_path: normalizeCommandPath(contract.command)
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
return [...descriptors.values()].sort((left, right) => (left.action ?? "").localeCompare(right.action ?? ""));
|
|
670
|
+
}
|
|
671
|
+
function resolveActionAvailability(descriptor, runtimeProbe) {
|
|
672
|
+
if (descriptor.provider === "core" && !descriptor.requires_extension) {
|
|
673
|
+
return {
|
|
674
|
+
action: descriptor.action,
|
|
675
|
+
invocable: true,
|
|
676
|
+
available: true,
|
|
677
|
+
requires_extension: false,
|
|
678
|
+
provider: "core",
|
|
679
|
+
disabled_reason: null,
|
|
680
|
+
command_path: descriptor.command_path,
|
|
681
|
+
cli_exposed: descriptor.command_path !== null
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
const commandPaths = descriptor.command_path ? splitCommandPathAliases(descriptor.command_path) : [];
|
|
685
|
+
const extensionCommandAvailable = commandPaths.some((commandPath) => runtimeProbe.handlers.has(commandPath));
|
|
686
|
+
const invocable = runtimeProbe.disabledReason === null && extensionCommandAvailable;
|
|
687
|
+
return {
|
|
688
|
+
action: descriptor.action,
|
|
689
|
+
invocable,
|
|
690
|
+
available: invocable,
|
|
691
|
+
requires_extension: true,
|
|
692
|
+
provider: "extension",
|
|
693
|
+
disabled_reason: invocable ? null : runtimeProbe.disabledReason ?? "extension_command_not_registered",
|
|
694
|
+
command_path: descriptor.command_path,
|
|
695
|
+
cli_exposed: extensionCommandAvailable,
|
|
696
|
+
policy_state: {
|
|
697
|
+
mode: runtimeProbe.policyState.mode,
|
|
698
|
+
trust_mode: runtimeProbe.policyState.trust_mode,
|
|
699
|
+
default_sandbox_profile: runtimeProbe.policyState.default_sandbox_profile
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function resolveCoreCommandFlags(command) {
|
|
704
|
+
if (command === "init") {
|
|
705
|
+
return INIT_FLAG_CONTRACTS;
|
|
706
|
+
}
|
|
707
|
+
if (command === "config") {
|
|
708
|
+
return CONFIG_FLAG_CONTRACTS;
|
|
709
|
+
}
|
|
710
|
+
if (command === "extension" || command === "package" || command === "packages") {
|
|
711
|
+
return EXTENSION_FLAG_CONTRACTS;
|
|
712
|
+
}
|
|
713
|
+
if (command === "install") {
|
|
714
|
+
return INSTALL_FLAG_CONTRACTS;
|
|
715
|
+
}
|
|
716
|
+
if (command === "create") {
|
|
717
|
+
return CREATE_FLAG_CONTRACTS;
|
|
718
|
+
}
|
|
719
|
+
if (command === "update") {
|
|
720
|
+
return UPDATE_FLAG_CONTRACTS;
|
|
721
|
+
}
|
|
722
|
+
if (command === "update-many") {
|
|
723
|
+
return UPDATE_MANY_FLAG_CONTRACTS;
|
|
724
|
+
}
|
|
725
|
+
if (command === "upgrade") {
|
|
726
|
+
return UPGRADE_FLAG_CONTRACTS;
|
|
727
|
+
}
|
|
728
|
+
if (command === "normalize") {
|
|
729
|
+
return NORMALIZE_FLAG_CONTRACTS;
|
|
730
|
+
}
|
|
731
|
+
if (command === "calendar" || command === "cal") {
|
|
732
|
+
return CALENDAR_FLAG_CONTRACTS;
|
|
733
|
+
}
|
|
734
|
+
if (command === "context" || command === "ctx") {
|
|
735
|
+
return CONTEXT_FLAG_CONTRACTS;
|
|
736
|
+
}
|
|
737
|
+
if (command === "get") {
|
|
738
|
+
return GET_FLAG_CONTRACTS;
|
|
739
|
+
}
|
|
740
|
+
if (command === "search") {
|
|
741
|
+
return SEARCH_FLAG_CONTRACTS;
|
|
742
|
+
}
|
|
743
|
+
if (command === "aggregate") {
|
|
744
|
+
return AGGREGATE_FLAG_CONTRACTS;
|
|
745
|
+
}
|
|
746
|
+
if (command === "dedupe-audit") {
|
|
747
|
+
return DEDUPE_AUDIT_FLAG_CONTRACTS;
|
|
748
|
+
}
|
|
749
|
+
if (command === "deps") {
|
|
750
|
+
return DEPS_FLAG_CONTRACTS;
|
|
751
|
+
}
|
|
752
|
+
if (command === "guide") {
|
|
753
|
+
return GUIDE_FLAG_CONTRACTS;
|
|
754
|
+
}
|
|
755
|
+
if (command === "reindex") {
|
|
756
|
+
return REINDEX_FLAG_CONTRACTS;
|
|
757
|
+
}
|
|
758
|
+
if (command === "history") {
|
|
759
|
+
return HISTORY_FLAG_CONTRACTS;
|
|
760
|
+
}
|
|
761
|
+
if (command === "history-redact") {
|
|
762
|
+
return HISTORY_REDACT_FLAG_CONTRACTS;
|
|
763
|
+
}
|
|
764
|
+
if (command === "history-repair") {
|
|
765
|
+
return HISTORY_REPAIR_FLAG_CONTRACTS;
|
|
766
|
+
}
|
|
767
|
+
if (command === "schema") {
|
|
768
|
+
return SCHEMA_FLAG_CONTRACTS;
|
|
769
|
+
}
|
|
770
|
+
if (command === "plan") {
|
|
771
|
+
return PLAN_FLAG_CONTRACTS;
|
|
772
|
+
}
|
|
773
|
+
if (command === "restore") {
|
|
774
|
+
return RESTORE_FLAG_CONTRACTS;
|
|
775
|
+
}
|
|
776
|
+
if (command === "delete") {
|
|
777
|
+
return DELETE_FLAG_CONTRACTS;
|
|
778
|
+
}
|
|
779
|
+
if (command === "close") {
|
|
780
|
+
return CLOSE_FLAG_CONTRACTS;
|
|
781
|
+
}
|
|
782
|
+
if (command === "append") {
|
|
783
|
+
return APPEND_FLAG_CONTRACTS;
|
|
784
|
+
}
|
|
785
|
+
if (command === "claim") {
|
|
786
|
+
return CLAIM_FLAG_CONTRACTS;
|
|
787
|
+
}
|
|
788
|
+
if (command === "release") {
|
|
789
|
+
return RELEASE_FLAG_CONTRACTS;
|
|
790
|
+
}
|
|
791
|
+
if (command === "start-task") {
|
|
792
|
+
return START_TASK_FLAG_CONTRACTS;
|
|
793
|
+
}
|
|
794
|
+
if (command === "pause-task") {
|
|
795
|
+
return PAUSE_TASK_FLAG_CONTRACTS;
|
|
796
|
+
}
|
|
797
|
+
if (command === "close-task") {
|
|
798
|
+
return CLOSE_TASK_FLAG_CONTRACTS;
|
|
799
|
+
}
|
|
800
|
+
if (command === "comments") {
|
|
801
|
+
return COMMENTS_FLAG_CONTRACTS;
|
|
802
|
+
}
|
|
803
|
+
if (command === "notes") {
|
|
804
|
+
return NOTES_FLAG_CONTRACTS;
|
|
805
|
+
}
|
|
806
|
+
if (command === "learnings") {
|
|
807
|
+
return LEARNINGS_FLAG_CONTRACTS;
|
|
808
|
+
}
|
|
809
|
+
if (command === "files") {
|
|
810
|
+
return FILES_FLAG_CONTRACTS;
|
|
811
|
+
}
|
|
812
|
+
if (command === "docs") {
|
|
813
|
+
return DOCS_FLAG_CONTRACTS;
|
|
814
|
+
}
|
|
815
|
+
if (command === "test") {
|
|
816
|
+
return TEST_FLAG_CONTRACTS;
|
|
817
|
+
}
|
|
818
|
+
if (command === "test-all") {
|
|
819
|
+
return TEST_ALL_FLAG_CONTRACTS;
|
|
820
|
+
}
|
|
821
|
+
if (command === "test-runs") {
|
|
822
|
+
return TEST_RUNS_FLAG_CONTRACTS;
|
|
823
|
+
}
|
|
824
|
+
if (command === "gc") {
|
|
825
|
+
return GC_FLAG_CONTRACTS;
|
|
826
|
+
}
|
|
827
|
+
if (command === "validate") {
|
|
828
|
+
return VALIDATE_FLAG_CONTRACTS;
|
|
829
|
+
}
|
|
830
|
+
if (command === "comments-audit") {
|
|
831
|
+
return COMMENTS_AUDIT_FLAG_CONTRACTS;
|
|
832
|
+
}
|
|
833
|
+
if (command === "health") {
|
|
834
|
+
return HEALTH_FLAG_CONTRACTS;
|
|
835
|
+
}
|
|
836
|
+
if (command === "contracts") {
|
|
837
|
+
return CONTRACTS_FLAG_CONTRACTS;
|
|
838
|
+
}
|
|
839
|
+
if (command === "completion") {
|
|
840
|
+
return COMPLETION_FLAG_CONTRACTS;
|
|
841
|
+
}
|
|
842
|
+
if (command === "activity") {
|
|
843
|
+
return ACTIVITY_FLAG_CONTRACTS;
|
|
844
|
+
}
|
|
845
|
+
if (LIST_COMMAND_NAMES.has(command)) {
|
|
846
|
+
return LIST_FILTER_FLAG_CONTRACTS;
|
|
847
|
+
}
|
|
848
|
+
return GLOBAL_FLAG_CONTRACTS;
|
|
849
|
+
}
|
|
850
|
+
function normalizeCommandForRuntimeFieldFlags(command) {
|
|
851
|
+
if (LIST_COMMAND_NAMES.has(command)) {
|
|
852
|
+
return "list";
|
|
853
|
+
}
|
|
854
|
+
if (command === "cal") {
|
|
855
|
+
return "calendar";
|
|
856
|
+
}
|
|
857
|
+
if (command === "ctx") {
|
|
858
|
+
return "context";
|
|
859
|
+
}
|
|
860
|
+
if (command === "update-many") {
|
|
861
|
+
return "update";
|
|
862
|
+
}
|
|
863
|
+
return command;
|
|
864
|
+
}
|
|
865
|
+
function toRuntimeLongFlagToken(token) {
|
|
866
|
+
const trimmed = token.trim();
|
|
867
|
+
if (!trimmed) {
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
if (trimmed.startsWith("--")) {
|
|
871
|
+
return trimmed;
|
|
872
|
+
}
|
|
873
|
+
if (trimmed.startsWith("-")) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
return `--${trimmed}`;
|
|
877
|
+
}
|
|
878
|
+
function toRuntimeShortFlagToken(token) {
|
|
879
|
+
const trimmed = token.trim();
|
|
880
|
+
if (!trimmed) {
|
|
881
|
+
return null;
|
|
882
|
+
}
|
|
883
|
+
if (trimmed.startsWith("--")) {
|
|
884
|
+
return null;
|
|
885
|
+
}
|
|
886
|
+
if (trimmed.startsWith("-")) {
|
|
887
|
+
return trimmed;
|
|
888
|
+
}
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
function buildRuntimeFieldFlagContracts(fieldRegistry) {
|
|
892
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
893
|
+
for (const definition of fieldRegistry.definitions) {
|
|
894
|
+
const primaryFlag = toRuntimeLongFlagToken(definition.cli_flag);
|
|
895
|
+
if (!primaryFlag) {
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
const shortAlias = definition.cli_aliases.map((alias) => toRuntimeShortFlagToken(alias)).find((alias) => alias !== null);
|
|
899
|
+
const longAliases = definition.cli_aliases.map((alias) => toRuntimeLongFlagToken(alias)).filter((alias) => alias !== null && alias !== primaryFlag);
|
|
900
|
+
for (const command of definition.commands) {
|
|
901
|
+
const bucket = buckets.get(command) ?? {
|
|
902
|
+
flags: [],
|
|
903
|
+
seen: /* @__PURE__ */ new Set()
|
|
904
|
+
};
|
|
905
|
+
const primaryContract = shortAlias ? { flag: primaryFlag, short: shortAlias } : { flag: primaryFlag };
|
|
906
|
+
const primaryKey = `${primaryContract.flag}|${primaryContract.short ?? ""}`;
|
|
907
|
+
if (!bucket.seen.has(primaryKey)) {
|
|
908
|
+
bucket.seen.add(primaryKey);
|
|
909
|
+
bucket.flags.push(primaryContract);
|
|
910
|
+
}
|
|
911
|
+
for (const alias of longAliases) {
|
|
912
|
+
const key = `${alias}|`;
|
|
913
|
+
if (bucket.seen.has(key)) {
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
bucket.seen.add(key);
|
|
917
|
+
bucket.flags.push({ flag: alias });
|
|
918
|
+
}
|
|
919
|
+
buckets.set(command, bucket);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
const result = /* @__PURE__ */ new Map();
|
|
923
|
+
for (const [command, bucket] of buckets.entries()) {
|
|
924
|
+
result.set(command, compactFlagAliasContracts(bucket.flags));
|
|
925
|
+
}
|
|
926
|
+
return result;
|
|
927
|
+
}
|
|
928
|
+
function mergeFlagContracts(primary, secondary) {
|
|
929
|
+
const merged = [];
|
|
930
|
+
const seen = /* @__PURE__ */ new Set();
|
|
931
|
+
for (const contract of [...primary, ...secondary]) {
|
|
932
|
+
const key = `${contract.flag}|${contract.short ?? ""}`;
|
|
933
|
+
if (seen.has(key)) {
|
|
934
|
+
continue;
|
|
935
|
+
}
|
|
936
|
+
seen.add(key);
|
|
937
|
+
merged.push(contract);
|
|
938
|
+
}
|
|
939
|
+
return compactFlagAliasContracts(merged);
|
|
940
|
+
}
|
|
941
|
+
function buildCommandFlagSurface(commands, extensionFlagMap, runtimeFieldFlagMap) {
|
|
942
|
+
return commands.map((command) => {
|
|
943
|
+
const isCoreCommand = PM_CORE_COMMAND_NAMES.includes(command) && !PACKAGE_OWNED_COMMANDS.has(command);
|
|
944
|
+
const coreFlags = isCoreCommand ? resolveCoreCommandFlags(command) : [];
|
|
945
|
+
const runtimeFlags = runtimeFieldFlagMap.get(normalizeCommandForRuntimeFieldFlags(command)) ?? [];
|
|
946
|
+
const extensionFlags = extensionFlagMap.get(command);
|
|
947
|
+
const coreWithRuntime = mergeFlagContracts(coreFlags, runtimeFlags);
|
|
948
|
+
const flags = mergeFlagContracts(coreWithRuntime, extensionFlags?.flags ?? []);
|
|
949
|
+
const provider = coreFlags.length > 0 && (extensionFlags?.flags.length ?? 0) > 0 ? "mixed" : isCoreCommand ? "core" : "extension";
|
|
950
|
+
return {
|
|
951
|
+
command,
|
|
952
|
+
flags,
|
|
953
|
+
provider,
|
|
954
|
+
extension_sources: extensionFlags?.sources
|
|
955
|
+
};
|
|
956
|
+
}).sort((left, right) => left.command.localeCompare(right.command));
|
|
957
|
+
}
|
|
958
|
+
function compactCommandAliasSurface(commands) {
|
|
959
|
+
const commandSet = new Set(commands);
|
|
960
|
+
const result = [];
|
|
961
|
+
for (const command of commands) {
|
|
962
|
+
const canonical = COMMAND_ALIAS_TO_CANONICAL.get(command);
|
|
963
|
+
if (canonical && commandSet.has(canonical)) {
|
|
964
|
+
continue;
|
|
965
|
+
}
|
|
966
|
+
result.push(command);
|
|
967
|
+
}
|
|
968
|
+
return result;
|
|
969
|
+
}
|
|
970
|
+
function buildCommandAliasSurface(commands) {
|
|
971
|
+
const commandSet = new Set(commands);
|
|
972
|
+
return CANONICAL_COMMAND_ALIASES.map((entry) => ({
|
|
973
|
+
canonical: entry.canonical,
|
|
974
|
+
aliases: entry.aliases.filter((alias) => commandSet.has(alias))
|
|
975
|
+
})).filter((entry) => commandSet.has(entry.canonical) && entry.aliases.length > 0);
|
|
976
|
+
}
|
|
977
|
+
function buildCommanderAliasSurface() {
|
|
978
|
+
return {
|
|
979
|
+
create_string_options: CREATE_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
980
|
+
create_repeatable_options: CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
|
|
981
|
+
update_string_options: UPDATE_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
982
|
+
update_repeatable_options: UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS,
|
|
983
|
+
list_string_options: LIST_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
984
|
+
search_string_options: SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
985
|
+
calendar_string_options: CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
986
|
+
context_string_options: CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,
|
|
987
|
+
activity_string_options: ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function resolveCreateRequiredOptionContract(typeDefinition, createMode) {
|
|
991
|
+
const baseRequiredOptions = /* @__PURE__ */ new Set(["title", "type"]);
|
|
992
|
+
if (createMode === "strict") {
|
|
993
|
+
for (const field of typeDefinition.required_create_fields) {
|
|
994
|
+
baseRequiredOptions.add(field);
|
|
995
|
+
}
|
|
996
|
+
for (const field of typeDefinition.required_create_repeatables) {
|
|
997
|
+
baseRequiredOptions.add(field);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
const policyState = resolveCommandOptionPolicyState(typeDefinition, "create", baseRequiredOptions);
|
|
1001
|
+
const requiredOptionKeys = [...new Set(policyState.required)].sort((left, right) => left.localeCompare(right));
|
|
1002
|
+
const requiredFlags = [
|
|
1003
|
+
...new Set(requiredOptionKeys.map((option) => commandOptionFlagLabel("create", option)))
|
|
1004
|
+
].sort((left, right) => left.localeCompare(right));
|
|
1005
|
+
const requiredTypeOptions = [
|
|
1006
|
+
...new Set(typeDefinition.options.filter((option) => option.required === true).map((option) => option.key))
|
|
1007
|
+
].sort((left, right) => left.localeCompare(right));
|
|
1008
|
+
return {
|
|
1009
|
+
required_option_keys: requiredOptionKeys,
|
|
1010
|
+
required_flags: requiredFlags,
|
|
1011
|
+
required_type_options: requiredTypeOptions,
|
|
1012
|
+
policy_errors: [...new Set(policyState.errors)].sort((left, right) => left.localeCompare(right))
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
function buildCreateRequiredOptionContracts(typeRegistry) {
|
|
1016
|
+
const byTypeStrict = {};
|
|
1017
|
+
const byTypeProgressive = {};
|
|
1018
|
+
for (const typeName of [...typeRegistry.types].sort((left, right) => left.localeCompare(right))) {
|
|
1019
|
+
const typeDefinition = typeRegistry.by_type[typeName];
|
|
1020
|
+
byTypeStrict[typeName] = resolveCreateRequiredOptionContract(typeDefinition, "strict");
|
|
1021
|
+
byTypeProgressive[typeName] = resolveCreateRequiredOptionContract(typeDefinition, "progressive");
|
|
1022
|
+
}
|
|
1023
|
+
return {
|
|
1024
|
+
default_create_mode: "strict",
|
|
1025
|
+
by_create_mode: {
|
|
1026
|
+
strict: {
|
|
1027
|
+
by_type: byTypeStrict
|
|
1028
|
+
},
|
|
1029
|
+
progressive: {
|
|
1030
|
+
by_type: byTypeProgressive
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
function attachCreateRequiredOptionContracts(schema, metadata) {
|
|
1036
|
+
const branches = extractActionBranches(schema);
|
|
1037
|
+
if (branches.length === 0) {
|
|
1038
|
+
return schema;
|
|
1039
|
+
}
|
|
1040
|
+
let touched = false;
|
|
1041
|
+
const enrichedBranches = branches.map((branch) => {
|
|
1042
|
+
const properties = branch.properties;
|
|
1043
|
+
if (typeof properties !== "object" || properties === null) {
|
|
1044
|
+
return branch;
|
|
1045
|
+
}
|
|
1046
|
+
const actionProperty = properties.action;
|
|
1047
|
+
if (typeof actionProperty !== "object" || actionProperty === null) {
|
|
1048
|
+
return branch;
|
|
1049
|
+
}
|
|
1050
|
+
if (actionProperty.const !== "create") {
|
|
1051
|
+
return branch;
|
|
1052
|
+
}
|
|
1053
|
+
touched = true;
|
|
1054
|
+
return {
|
|
1055
|
+
...branch,
|
|
1056
|
+
"x-create-required-options": metadata
|
|
1057
|
+
};
|
|
1058
|
+
});
|
|
1059
|
+
if (!touched) {
|
|
1060
|
+
return schema;
|
|
1061
|
+
}
|
|
1062
|
+
return {
|
|
1063
|
+
...schema,
|
|
1064
|
+
oneOf: enrichedBranches
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
async function runContracts(options, global2) {
|
|
1068
|
+
const selectedAction = normalizeToken(options.action);
|
|
1069
|
+
const selectedCommand = normalizeToken(options.command);
|
|
1070
|
+
const schemaOnly = options.schemaOnly === true;
|
|
1071
|
+
const flagsOnly = options.flagsOnly === true;
|
|
1072
|
+
const availabilityOnly = options.availabilityOnly === true;
|
|
1073
|
+
const runtimeOnly = options.runtimeOnly === true;
|
|
1074
|
+
const fullOutput = options.full === true;
|
|
1075
|
+
const unfilteredDefaultBriefMode = !fullOutput && !schemaOnly && !flagsOnly && !availabilityOnly && !selectedAction && !selectedCommand;
|
|
1076
|
+
const omitUnfilteredSchema = unfilteredDefaultBriefMode;
|
|
1077
|
+
const omitUnfilteredCommandFlags = unfilteredDefaultBriefMode;
|
|
1078
|
+
const omitUnfilteredCommanderAliases = unfilteredDefaultBriefMode;
|
|
1079
|
+
const projectionFlagsEnabled = [
|
|
1080
|
+
schemaOnly,
|
|
1081
|
+
flagsOnly,
|
|
1082
|
+
availabilityOnly
|
|
1083
|
+
].filter((value) => value).length;
|
|
1084
|
+
if (projectionFlagsEnabled > 1) {
|
|
1085
|
+
throw new PmCliError("Choose only one projection flag: --schema-only, --flags-only, or --availability-only.", EXIT_CODE.USAGE);
|
|
1086
|
+
}
|
|
1087
|
+
const pmRoot = resolvePmRoot(process.cwd(), global2.path);
|
|
1088
|
+
let settings = structuredClone(SETTINGS_DEFAULTS);
|
|
1089
|
+
try {
|
|
1090
|
+
settings = await readSettings(pmRoot);
|
|
1091
|
+
} catch {
|
|
1092
|
+
settings = structuredClone(SETTINGS_DEFAULTS);
|
|
1093
|
+
}
|
|
1094
|
+
const runtimeProbe = await resolveRuntimeExtensionActionProbe(global2);
|
|
1095
|
+
const typeRegistry = resolveItemTypeRegistry(settings, runtimeProbe.registrations ?? getActiveExtensionRegistrations());
|
|
1096
|
+
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
1097
|
+
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
1098
|
+
const runtimeFieldFlagMap = buildRuntimeFieldFlagContracts(runtimeFieldRegistry);
|
|
1099
|
+
const createRequiredOptionContracts = buildCreateRequiredOptionContracts(typeRegistry);
|
|
1100
|
+
const extensionContracts = collectExtensionCommandContracts(runtimeProbe);
|
|
1101
|
+
const mergedExtensionContracts = mergeExtensionContractsByAction(extensionContracts);
|
|
1102
|
+
const extensionFlagMap = collectExtensionFlagContractsByCommand(runtimeProbe.flagRegistrations);
|
|
1103
|
+
const actionDescriptors = collectActionContractDescriptors(mergedExtensionContracts);
|
|
1104
|
+
const actionNames = new Set(actionDescriptors.map((entry) => entry.action));
|
|
1105
|
+
if (selectedAction && !actionNames.has(selectedAction)) {
|
|
1106
|
+
throw new PmCliError(`Unknown action: "${options.action}".`, EXIT_CODE.USAGE);
|
|
1107
|
+
}
|
|
1108
|
+
const commandCatalog = [
|
|
1109
|
+
.../* @__PURE__ */ new Set([
|
|
1110
|
+
...PM_CORE_COMMAND_NAMES.filter((entry) => !PACKAGE_OWNED_COMMANDS.has(entry)),
|
|
1111
|
+
...mergedExtensionContracts.flatMap((entry) => entry.command.split("|"))
|
|
1112
|
+
])
|
|
1113
|
+
].map((entry) => normalizeCommandPath(entry)).filter((entry) => entry.length > 0).sort((left, right) => left.localeCompare(right));
|
|
1114
|
+
const commandNames = new Set(commandCatalog);
|
|
1115
|
+
if (selectedCommand && !commandNames.has(selectedCommand)) {
|
|
1116
|
+
const packageHint = PACKAGE_OWNED_COMMAND_INSTALL_HINTS.get(selectedCommand);
|
|
1117
|
+
if (packageHint) {
|
|
1118
|
+
throw new PmCliError(`Unknown command: "${options.command}". Command "${selectedCommand}" is provided by the optional "${packageHint}" package. Run "pm install ${packageHint} --project" and retry.`, EXIT_CODE.USAGE, {
|
|
1119
|
+
examples: [`pm install ${packageHint} --project`, `pm contracts --command ${selectedCommand} --flags-only --json`],
|
|
1120
|
+
nextSteps: [`Install the optional package first: pm install ${packageHint} --project`],
|
|
1121
|
+
recovery: {
|
|
1122
|
+
suggested_retry: `pm install ${packageHint} --project`
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
throw new PmCliError(`Unknown command: "${options.command}".`, EXIT_CODE.USAGE);
|
|
1127
|
+
}
|
|
1128
|
+
const commandScopedDescriptors = selectedCommand ? actionDescriptors.filter((descriptor) => actionDescriptorMatchesSelectedCommand(descriptor, selectedCommand)) : actionDescriptors;
|
|
1129
|
+
if (selectedCommand && selectedAction && !commandScopedDescriptors.some((descriptor) => descriptor.action === selectedAction)) {
|
|
1130
|
+
throw new PmCliError(`Action "${options.action}" is not mapped to command "${options.command}" in contracts output.`, EXIT_CODE.USAGE);
|
|
1131
|
+
}
|
|
1132
|
+
const schema = PM_TOOL_PARAMETERS_SCHEMA;
|
|
1133
|
+
const schemaBranches = extractActionBranches(schema);
|
|
1134
|
+
const schemaActionSet = new Set(schemaBranches.map((entry) => {
|
|
1135
|
+
const properties = entry.properties;
|
|
1136
|
+
if (typeof properties !== "object" || properties === null) {
|
|
1137
|
+
return null;
|
|
1138
|
+
}
|
|
1139
|
+
const actionProperty = properties.action;
|
|
1140
|
+
if (typeof actionProperty !== "object" || actionProperty === null) {
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
const actionConst = actionProperty.const;
|
|
1144
|
+
return typeof actionConst === "string" ? actionConst : null;
|
|
1145
|
+
}).filter((entry) => entry !== null));
|
|
1146
|
+
const extensionBranches = mergedExtensionContracts.filter((contract) => !schemaActionSet.has(contract.action)).map((contract) => buildExtensionActionSchemaBranch(contract));
|
|
1147
|
+
const mergedSchema = extensionBranches.length > 0 ? {
|
|
1148
|
+
...schema,
|
|
1149
|
+
oneOf: [...schemaBranches, ...extensionBranches]
|
|
1150
|
+
} : schema;
|
|
1151
|
+
const scopedActionDescriptors = selectedAction ? commandScopedDescriptors.filter((descriptor) => descriptor.action === selectedAction) : commandScopedDescriptors;
|
|
1152
|
+
const allActionAvailability = scopedActionDescriptors.map((descriptor) => resolveActionAvailability(descriptor, runtimeProbe));
|
|
1153
|
+
const actionAvailability = runtimeOnly && !selectedAction ? allActionAvailability.filter((entry) => entry.invocable) : allActionAvailability;
|
|
1154
|
+
const actions = actionAvailability.map((entry) => entry.action);
|
|
1155
|
+
const descriptorActionSet = new Set(actionDescriptors.map((descriptor) => descriptor.action));
|
|
1156
|
+
let filteredSchema = selectedAction ? filterSchemaByAction(mergedSchema, selectedAction) : selectedCommand ? filterSchemaByActions(mergedSchema, new Set(scopedActionDescriptors.map((descriptor) => descriptor.action))) : filterSchemaByActions(mergedSchema, descriptorActionSet);
|
|
1157
|
+
if (runtimeOnly && !selectedAction) {
|
|
1158
|
+
filteredSchema = filterSchemaByActions(filteredSchema, new Set(actions));
|
|
1159
|
+
}
|
|
1160
|
+
const includeSchemaSurface = !flagsOnly && !availabilityOnly;
|
|
1161
|
+
if (includeSchemaSurface) {
|
|
1162
|
+
filteredSchema = attachCreateRequiredOptionContracts(filteredSchema, createRequiredOptionContracts);
|
|
1163
|
+
}
|
|
1164
|
+
const commands = selectedCommand !== void 0 ? [selectedCommand] : selectedAction ? resolveScopedCommandsFromActionDescriptors(scopedActionDescriptors, commandCatalog) : commandCatalog;
|
|
1165
|
+
const outputCommands = flagsOnly && selectedCommand === void 0 && selectedAction === void 0 ? compactCommandAliasSurface(commands) : commands;
|
|
1166
|
+
const commandAliases = buildCommandAliasSurface(commands);
|
|
1167
|
+
const extensionCommandContracts = selectedCommand ? extensionContracts.filter((entry) => entry.command === selectedCommand) : selectedAction ? extensionContracts.filter((entry) => outputCommands.includes(normalizeCommandPath(entry.command))) : extensionContracts;
|
|
1168
|
+
const includeRuntimeContractSections = !(flagsOnly && !fullOutput);
|
|
1169
|
+
const result = {
|
|
1170
|
+
schema_version: typeof mergedSchema["x-schema-version"] === "string" ? mergedSchema["x-schema-version"] : null,
|
|
1171
|
+
schema_id: typeof mergedSchema.$id === "string" ? mergedSchema.$id : null,
|
|
1172
|
+
selected: {
|
|
1173
|
+
action: selectedAction ?? null,
|
|
1174
|
+
command: selectedCommand ?? null,
|
|
1175
|
+
schema_only: schemaOnly,
|
|
1176
|
+
flags_only: flagsOnly,
|
|
1177
|
+
availability_only: availabilityOnly,
|
|
1178
|
+
runtime_only: runtimeOnly,
|
|
1179
|
+
command_scoped: selectedCommand !== void 0
|
|
1180
|
+
},
|
|
1181
|
+
commands: outputCommands
|
|
1182
|
+
};
|
|
1183
|
+
if (includeRuntimeContractSections) {
|
|
1184
|
+
result.runtime_schema = {
|
|
1185
|
+
statuses: statusRegistry.definitions.map((definition) => definition.id),
|
|
1186
|
+
open_status: statusRegistry.open_status,
|
|
1187
|
+
close_status: statusRegistry.close_status,
|
|
1188
|
+
canceled_status: statusRegistry.canceled_status,
|
|
1189
|
+
types: [...typeRegistry.types],
|
|
1190
|
+
fields_by_command: Object.fromEntries([...runtimeFieldRegistry.command_to_fields.entries()].map(([command, definitions]) => [
|
|
1191
|
+
command,
|
|
1192
|
+
[
|
|
1193
|
+
...new Set(definitions.map((definition) => `--${definition.cli_flag}`))
|
|
1194
|
+
].sort((left, right) => left.localeCompare(right))
|
|
1195
|
+
]))
|
|
1196
|
+
};
|
|
1197
|
+
result.extension_contracts = {
|
|
1198
|
+
capabilities: [...PM_EXTENSION_CAPABILITY_CONTRACTS],
|
|
1199
|
+
services: [...PM_EXTENSION_SERVICE_NAME_CONTRACTS],
|
|
1200
|
+
policy_modes: [...PM_EXTENSION_POLICY_MODE_CONTRACTS],
|
|
1201
|
+
policy_surfaces: [...PM_EXTENSION_POLICY_SURFACE_CONTRACTS],
|
|
1202
|
+
trust_modes: [...PM_EXTENSION_TRUST_MODE_CONTRACTS],
|
|
1203
|
+
sandbox_profiles: [...PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS],
|
|
1204
|
+
manifest_versions: [1, 2],
|
|
1205
|
+
compatibility: {
|
|
1206
|
+
current: "v2",
|
|
1207
|
+
previous: ["v1"],
|
|
1208
|
+
breaking_strategy: "versioned_breaking"
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
if (!flagsOnly) {
|
|
1213
|
+
result.actions = actions;
|
|
1214
|
+
result.action_availability = actionAvailability;
|
|
1215
|
+
}
|
|
1216
|
+
if (includeSchemaSurface && !omitUnfilteredSchema) {
|
|
1217
|
+
result.schema = filteredSchema;
|
|
1218
|
+
result.extension_commands = extensionCommandContracts;
|
|
1219
|
+
} else if (includeSchemaSurface && omitUnfilteredSchema) {
|
|
1220
|
+
result.schema_omitted_reason = "unfiltered_default_brief";
|
|
1221
|
+
result.extension_commands = extensionCommandContracts;
|
|
1222
|
+
}
|
|
1223
|
+
if (!schemaOnly && !availabilityOnly) {
|
|
1224
|
+
if (!omitUnfilteredCommandFlags) {
|
|
1225
|
+
result.command_flags = buildCommandFlagSurface(outputCommands, extensionFlagMap, runtimeFieldFlagMap);
|
|
1226
|
+
} else {
|
|
1227
|
+
result.command_flags_omitted_reason = "unfiltered_default_brief";
|
|
1228
|
+
}
|
|
1229
|
+
if (commandAliases.length > 0) {
|
|
1230
|
+
result.command_aliases = commandAliases;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
if (!schemaOnly && !flagsOnly && !availabilityOnly) {
|
|
1234
|
+
if (!omitUnfilteredCommanderAliases) {
|
|
1235
|
+
result.commander_aliases = buildCommanderAliasSurface();
|
|
1236
|
+
} else {
|
|
1237
|
+
result.commander_aliases_omitted_reason = "unfiltered_default_brief";
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
return result;
|
|
1241
|
+
}
|
|
1242
|
+
export {
|
|
1243
|
+
runContracts
|
|
1244
|
+
};
|
|
1245
|
+
//# sourceMappingURL=contracts-YLMH33VU.js.map
|