@unbrained/pm-cli 2026.5.18 → 2026.5.24
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 +60 -0
- package/README.md +2 -1
- package/dist/cli/commander-usage.js +16 -2
- package/dist/cli/commander-usage.js.map +1 -1
- package/dist/cli/commands/annotation-command.d.ts +49 -0
- package/dist/cli/commands/annotation-command.js +135 -0
- package/dist/cli/commands/annotation-command.js.map +1 -0
- package/dist/cli/commands/append.js +3 -7
- package/dist/cli/commands/append.js.map +1 -1
- package/dist/cli/commands/calendar.js +3 -6
- package/dist/cli/commands/calendar.js.map +1 -1
- package/dist/cli/commands/claim.js +12 -22
- package/dist/cli/commands/claim.js.map +1 -1
- package/dist/cli/commands/close.js +61 -9
- package/dist/cli/commands/close.js.map +1 -1
- package/dist/cli/commands/comments.d.ts +5 -0
- package/dist/cli/commands/comments.js +27 -117
- package/dist/cli/commands/comments.js.map +1 -1
- package/dist/cli/commands/completion.js +102 -15
- package/dist/cli/commands/completion.js.map +1 -1
- package/dist/cli/commands/context.js +4 -10
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contracts.js +168 -36
- package/dist/cli/commands/contracts.js.map +1 -1
- package/dist/cli/commands/create.js +49 -44
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/commands/dedupe-audit.js +7 -4
- package/dist/cli/commands/dedupe-audit.js.map +1 -1
- package/dist/cli/commands/delete.d.ts +3 -0
- package/dist/cli/commands/delete.js +9 -8
- package/dist/cli/commands/delete.js.map +1 -1
- package/dist/cli/commands/docs.d.ts +1 -0
- package/dist/cli/commands/docs.js +4 -8
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/event-validation-messages.d.ts +3 -0
- package/dist/cli/commands/event-validation-messages.js +44 -0
- package/dist/cli/commands/event-validation-messages.js.map +1 -0
- package/dist/cli/commands/extension.d.ts +1 -0
- package/dist/cli/commands/extension.js +138 -21
- package/dist/cli/commands/extension.js.map +1 -1
- package/dist/cli/commands/files.js +6 -13
- package/dist/cli/commands/files.js.map +1 -1
- package/dist/cli/commands/gc.js +17 -4
- package/dist/cli/commands/gc.js.map +1 -1
- package/dist/cli/commands/get.d.ts +3 -2
- package/dist/cli/commands/get.js +50 -8
- package/dist/cli/commands/get.js.map +1 -1
- package/dist/cli/commands/health.d.ts +10 -0
- package/dist/cli/commands/health.js +254 -75
- package/dist/cli/commands/health.js.map +1 -1
- package/dist/cli/commands/history-redact.d.ts +8 -0
- package/dist/cli/commands/history-redact.js +14 -97
- package/dist/cli/commands/history-redact.js.map +1 -1
- package/dist/cli/commands/history-repair.d.ts +33 -0
- package/dist/cli/commands/history-repair.js +166 -0
- package/dist/cli/commands/history-repair.js.map +1 -0
- package/dist/cli/commands/history.d.ts +4 -4
- package/dist/cli/commands/history.js +10 -88
- package/dist/cli/commands/history.js.map +1 -1
- package/dist/cli/commands/index.d.ts +3 -1
- package/dist/cli/commands/index.js +5 -3
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +28 -0
- package/dist/cli/commands/init.js +23 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/learnings.js +20 -119
- package/dist/cli/commands/learnings.js.map +1 -1
- package/dist/cli/commands/linked-test-entry.d.ts +3 -0
- package/dist/cli/commands/linked-test-entry.js +62 -0
- package/dist/cli/commands/linked-test-entry.js.map +1 -0
- package/dist/cli/commands/list.js +32 -22
- package/dist/cli/commands/list.js.map +1 -1
- package/dist/cli/commands/notes.js +20 -119
- package/dist/cli/commands/notes.js.map +1 -1
- package/dist/cli/commands/plan.d.ts +3 -0
- package/dist/cli/commands/plan.js +184 -22
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/restore.js +7 -50
- package/dist/cli/commands/restore.js.map +1 -1
- package/dist/cli/commands/schema.d.ts +31 -0
- package/dist/cli/commands/schema.js +98 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/search.js +151 -40
- package/dist/cli/commands/search.js.map +1 -1
- package/dist/cli/commands/templates.d.ts +4 -0
- package/dist/cli/commands/templates.js +89 -17
- package/dist/cli/commands/templates.js.map +1 -1
- package/dist/cli/commands/test-all.js +4 -8
- package/dist/cli/commands/test-all.js.map +1 -1
- package/dist/cli/commands/test.d.ts +1 -0
- package/dist/cli/commands/test.js +7 -10
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/update-many.js +4 -8
- package/dist/cli/commands/update-many.js.map +1 -1
- package/dist/cli/commands/update.js +109 -51
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/commands/validate.d.ts +3 -1
- package/dist/cli/commands/validate.js +23 -71
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/error-guidance.js +96 -6
- package/dist/cli/error-guidance.js.map +1 -1
- package/dist/cli/extension-command-help.d.ts +0 -1
- package/dist/cli/extension-command-help.js +2 -13
- package/dist/cli/extension-command-help.js.map +1 -1
- package/dist/cli/extension-command-options.d.ts +1 -0
- package/dist/cli/extension-command-options.js +106 -7
- package/dist/cli/extension-command-options.js.map +1 -1
- package/dist/cli/help-content.d.ts +0 -1
- package/dist/cli/help-content.js +13 -9
- package/dist/cli/help-content.js.map +1 -1
- package/dist/cli/help-json-payload.d.ts +1 -0
- package/dist/cli/help-json-payload.js +33 -3
- package/dist/cli/help-json-payload.js.map +1 -1
- package/dist/cli/main.js +35 -29
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/register-list-query.d.ts +1 -1
- package/dist/cli/register-list-query.js +40 -17
- package/dist/cli/register-list-query.js.map +1 -1
- package/dist/cli/register-mutation.d.ts +1 -1
- package/dist/cli/register-mutation.js +232 -64
- package/dist/cli/register-mutation.js.map +1 -1
- package/dist/cli/register-operations.js +16 -11
- package/dist/cli/register-operations.js.map +1 -1
- package/dist/cli/register-setup.js +26 -14
- package/dist/cli/register-setup.js.map +1 -1
- package/dist/cli/registration-helpers.d.ts +0 -2
- package/dist/cli/registration-helpers.js +13 -40
- package/dist/cli/registration-helpers.js.map +1 -1
- package/dist/cli.js +23 -3
- package/dist/cli.js.map +1 -1
- package/dist/core/extensions/index.d.ts +0 -1
- package/dist/core/extensions/index.js +2 -14
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.js +3 -9
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/fs/path-utils.d.ts +1 -0
- package/dist/core/fs/path-utils.js +12 -0
- package/dist/core/fs/path-utils.js.map +1 -0
- package/dist/core/history/drift-scan.d.ts +11 -0
- package/dist/core/history/drift-scan.js +67 -0
- package/dist/core/history/drift-scan.js.map +1 -0
- package/dist/core/history/replay.d.ts +82 -0
- package/dist/core/history/replay.js +249 -0
- package/dist/core/history/replay.js.map +1 -0
- package/dist/core/item/item-format.js +11 -8
- package/dist/core/item/item-format.js.map +1 -1
- package/dist/core/item/item-type-definition.d.ts +52 -0
- package/dist/core/item/item-type-definition.js +123 -0
- package/dist/core/item/item-type-definition.js.map +1 -0
- package/dist/core/item/parse.js +3 -2
- package/dist/core/item/parse.js.map +1 -1
- package/dist/core/item/priority.d.ts +23 -0
- package/dist/core/item/priority.js +55 -0
- package/dist/core/item/priority.js.map +1 -0
- package/dist/core/item/status.d.ts +14 -1
- package/dist/core/item/status.js +22 -2
- package/dist/core/item/status.js.map +1 -1
- package/dist/core/item/toon-decode.d.ts +19 -0
- package/dist/core/item/toon-decode.js +69 -0
- package/dist/core/item/toon-decode.js.map +1 -0
- package/dist/core/item/type-registry.js +13 -84
- package/dist/core/item/type-registry.js.map +1 -1
- package/dist/core/packages/manifest.js +3 -9
- package/dist/core/packages/manifest.js.map +1 -1
- package/dist/core/schema/item-types-file.d.ts +85 -0
- package/dist/core/schema/item-types-file.js +243 -0
- package/dist/core/schema/item-types-file.js.map +1 -0
- package/dist/core/schema/runtime-schema.d.ts +2 -1
- package/dist/core/schema/runtime-schema.js +11 -9
- package/dist/core/schema/runtime-schema.js.map +1 -1
- package/dist/core/search/semantic-defaults.js +3 -3
- package/dist/core/search/semantic-defaults.js.map +1 -1
- package/dist/core/shared/author.d.ts +1 -0
- package/dist/core/shared/author.js +9 -0
- package/dist/core/shared/author.js.map +1 -0
- package/dist/core/shared/lazy-module.d.ts +1 -0
- package/dist/core/shared/lazy-module.js +11 -0
- package/dist/core/shared/lazy-module.js.map +1 -0
- package/dist/core/shared/option-alias-visibility.d.ts +44 -0
- package/dist/core/shared/option-alias-visibility.js +76 -0
- package/dist/core/shared/option-alias-visibility.js.map +1 -0
- package/dist/core/shared/text-normalization.d.ts +0 -1
- package/dist/core/shared/text-normalization.js +2 -5
- package/dist/core/shared/text-normalization.js.map +1 -1
- package/dist/core/store/item-store.d.ts +2 -0
- package/dist/core/store/item-store.js +70 -39
- package/dist/core/store/item-store.js.map +1 -1
- package/dist/core/store/settings-validator.d.ts +106 -0
- package/dist/core/store/settings-validator.js +279 -0
- package/dist/core/store/settings-validator.js.map +1 -0
- package/dist/core/store/settings.js +6 -343
- package/dist/core/store/settings.js.map +1 -1
- package/dist/core/telemetry/runtime.js +5 -3
- package/dist/core/telemetry/runtime.js.map +1 -1
- package/dist/mcp/server.js +64 -13
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/cli-contracts.d.ts +9 -2
- package/dist/sdk/cli-contracts.js +204 -13
- package/dist/sdk/cli-contracts.js.map +1 -1
- package/dist/sdk/runtime.d.ts +25 -1
- package/dist/sdk/runtime.js +46 -3
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js +10 -2
- package/dist/types.js.map +1 -1
- package/docs/AGENT_GUIDE.md +7 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/COMMANDS.md +39 -6
- package/docs/CONFIGURATION.md +1 -1
- package/docs/RELEASING.md +11 -7
- package/docs/SDK.md +11 -2
- package/package.json +12 -11
- package/packages/pm-calendar/README.md +3 -1
- package/packages/pm-calendar/extensions/calendar/index.js +21 -2
- package/packages/pm-calendar/extensions/calendar/index.ts +21 -2
- package/packages/pm-search-advanced/README.md +8 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.js +74 -0
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +74 -0
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.js +67 -9
- package/packages/pm-search-advanced/extensions/search-advanced/runtime.ts +67 -9
- package/packages/pm-templates/extensions/templates/runtime.js +11 -202
- package/packages/pm-templates/extensions/templates/runtime.ts +38 -230
- package/dist/core/output/command-aware.d.ts +0 -1
- package/dist/core/output/command-aware.js +0 -397
- package/dist/core/output/command-aware.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="478936e5-660a-5f89-b15d-93b37468c7ed")}catch(e){}}();
|
|
3
3
|
import { EXIT_CODE, SETTINGS_DEFAULTS } from "../../core/shared/constants.js";
|
|
4
4
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
5
5
|
import { activateExtensions, getActiveExtensionRegistrations, loadExtensions, } from "../../core/extensions/index.js";
|
|
@@ -8,7 +8,7 @@ import { commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTyp
|
|
|
8
8
|
import { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../../core/schema/runtime-schema.js";
|
|
9
9
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
10
10
|
import { readSettings } from "../../core/store/settings.js";
|
|
11
|
-
import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMMENTS_AUDIT_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DEDUPE_AUDIT_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NORMALIZE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, } from "../../sdk/cli-contracts.js";
|
|
11
|
+
import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, COMMENTS_AUDIT_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DEDUPE_AUDIT_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NORMALIZE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, } from "../../sdk/cli-contracts.js";
|
|
12
12
|
const LIST_COMMAND_NAMES = new Set([
|
|
13
13
|
"list",
|
|
14
14
|
"list-all",
|
|
@@ -57,6 +57,27 @@ const PACKAGE_OWNED_COMMANDS = new Set([
|
|
|
57
57
|
"test-runs stop",
|
|
58
58
|
"test-runs resume",
|
|
59
59
|
]);
|
|
60
|
+
const PACKAGE_OWNED_COMMAND_INSTALL_HINTS = new Map([
|
|
61
|
+
["cal", "calendar"],
|
|
62
|
+
["calendar", "calendar"],
|
|
63
|
+
["comments-audit", "governance-audit"],
|
|
64
|
+
["completion", "guide-shell"],
|
|
65
|
+
["completion-tags", "guide-shell"],
|
|
66
|
+
["dedupe-audit", "governance-audit"],
|
|
67
|
+
["guide", "guide-shell"],
|
|
68
|
+
["normalize", "governance-audit"],
|
|
69
|
+
["reindex", "search-advanced"],
|
|
70
|
+
["templates", "templates"],
|
|
71
|
+
["templates list", "templates"],
|
|
72
|
+
["templates save", "templates"],
|
|
73
|
+
["templates show", "templates"],
|
|
74
|
+
["test-runs", "linked-test-adapters"],
|
|
75
|
+
["test-runs list", "linked-test-adapters"],
|
|
76
|
+
["test-runs status", "linked-test-adapters"],
|
|
77
|
+
["test-runs logs", "linked-test-adapters"],
|
|
78
|
+
["test-runs stop", "linked-test-adapters"],
|
|
79
|
+
["test-runs resume", "linked-test-adapters"],
|
|
80
|
+
]);
|
|
60
81
|
const CANONICAL_COMMAND_ALIASES = [
|
|
61
82
|
{
|
|
62
83
|
canonical: "context",
|
|
@@ -90,11 +111,18 @@ function actionDescriptorMatchesSelectedCommand(descriptor, selectedCommand) {
|
|
|
90
111
|
if (descriptor.command_path === null) {
|
|
91
112
|
return false;
|
|
92
113
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
114
|
+
return splitCommandPathAliases(descriptor.command_path).some((commandPath) => {
|
|
115
|
+
if (commandPath === selectedCommand) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
return commandPath.startsWith(`${selectedCommand} `);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function splitCommandPathAliases(commandPath) {
|
|
122
|
+
return commandPath
|
|
123
|
+
.split("|")
|
|
124
|
+
.map((entry) => normalizeCommandPath(entry))
|
|
125
|
+
.filter((entry) => entry.length > 0);
|
|
98
126
|
}
|
|
99
127
|
function resolveScopedCommandsFromActionDescriptors(descriptors, commandCatalog) {
|
|
100
128
|
const commandSet = new Set(commandCatalog);
|
|
@@ -103,18 +131,19 @@ function resolveScopedCommandsFromActionDescriptors(descriptors, commandCatalog)
|
|
|
103
131
|
if (!descriptor.command_path) {
|
|
104
132
|
continue;
|
|
105
133
|
}
|
|
106
|
-
const commandPath
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
for (let end = tokens.length; end > 0; end -= 1) {
|
|
112
|
-
const candidate = tokens.slice(0, end).join(" ");
|
|
113
|
-
if (!commandSet.has(candidate)) {
|
|
134
|
+
for (const commandPath of splitCommandPathAliases(descriptor.command_path)) {
|
|
135
|
+
const tokens = commandPath.split(" ").filter((entry) => entry.length > 0);
|
|
136
|
+
if (tokens.length === 0) {
|
|
114
137
|
continue;
|
|
115
138
|
}
|
|
116
|
-
|
|
117
|
-
|
|
139
|
+
for (let end = tokens.length; end > 0; end -= 1) {
|
|
140
|
+
const candidate = tokens.slice(0, end).join(" ");
|
|
141
|
+
if (!commandSet.has(candidate)) {
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
scoped.add(candidate);
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
118
147
|
}
|
|
119
148
|
}
|
|
120
149
|
return [...scoped].sort((left, right) => left.localeCompare(right));
|
|
@@ -224,6 +253,28 @@ function toExtensionFlagContract(definition) {
|
|
|
224
253
|
if (normalizedShort && normalizedLong) {
|
|
225
254
|
contract.short = normalizedShort;
|
|
226
255
|
}
|
|
256
|
+
const description = toOptionalTrimmedString(definition.description);
|
|
257
|
+
if (description) {
|
|
258
|
+
contract.description = description;
|
|
259
|
+
}
|
|
260
|
+
if (definition.required === true) {
|
|
261
|
+
contract.required = true;
|
|
262
|
+
}
|
|
263
|
+
if (definition.repeatable === true) {
|
|
264
|
+
contract.repeatable = true;
|
|
265
|
+
}
|
|
266
|
+
const valueName = toOptionalTrimmedString(definition.value_name);
|
|
267
|
+
if (valueName) {
|
|
268
|
+
contract.value_name = valueName;
|
|
269
|
+
}
|
|
270
|
+
const rawValueType = [
|
|
271
|
+
toOptionalTrimmedString(definition.value_type),
|
|
272
|
+
toOptionalTrimmedString(definition.type),
|
|
273
|
+
valueName ? "string" : null,
|
|
274
|
+
].find((candidate) => candidate === "string" || candidate === "number" || candidate === "boolean");
|
|
275
|
+
if (rawValueType) {
|
|
276
|
+
contract.value_type = rawValueType;
|
|
277
|
+
}
|
|
227
278
|
return contract;
|
|
228
279
|
}
|
|
229
280
|
function collectExtensionFlagContractsByCommand(registrations) {
|
|
@@ -363,6 +414,10 @@ function extensionSchemaPropertyNameFromFlag(flag) {
|
|
|
363
414
|
return cleaned.length > 0 ? cleaned : null;
|
|
364
415
|
}
|
|
365
416
|
function buildExtensionActionSchemaBranch(contract) {
|
|
417
|
+
const commands = contract.command
|
|
418
|
+
.split("|")
|
|
419
|
+
.map((command) => command.trim())
|
|
420
|
+
.filter((command) => command.length > 0);
|
|
366
421
|
const properties = {
|
|
367
422
|
action: {
|
|
368
423
|
type: "string",
|
|
@@ -398,11 +453,16 @@ function buildExtensionActionSchemaBranch(contract) {
|
|
|
398
453
|
if (!propertyName || properties[propertyName] !== undefined) {
|
|
399
454
|
continue;
|
|
400
455
|
}
|
|
401
|
-
const
|
|
456
|
+
const valueType = flag.value_type ?? "boolean";
|
|
457
|
+
const schemaType = valueType === "boolean" ? "boolean" : valueType === "number" ? ["number", "string"] : "string";
|
|
402
458
|
properties[propertyName] = {
|
|
403
|
-
type:
|
|
404
|
-
|
|
459
|
+
type: flag.repeatable ? "array" : schemaType,
|
|
460
|
+
...(flag.repeatable ? { items: { type: schemaType } } : {}),
|
|
461
|
+
description: flag.description ?? `Extension option '${flag.flag}' for action '${contract.action}'.`,
|
|
405
462
|
};
|
|
463
|
+
if (flag.required === true) {
|
|
464
|
+
required.push(propertyName);
|
|
465
|
+
}
|
|
406
466
|
}
|
|
407
467
|
return {
|
|
408
468
|
type: "object",
|
|
@@ -410,9 +470,57 @@ function buildExtensionActionSchemaBranch(contract) {
|
|
|
410
470
|
required,
|
|
411
471
|
additionalProperties: true,
|
|
412
472
|
"x-extension-source": contract.source,
|
|
413
|
-
"x-extension-command": contract.command,
|
|
473
|
+
"x-extension-command": commands[0] ?? contract.command,
|
|
474
|
+
"x-extension-commands": commands,
|
|
414
475
|
};
|
|
415
476
|
}
|
|
477
|
+
function mergeExtensionFlagContract(existing, incoming) {
|
|
478
|
+
existing.description ??= incoming.description;
|
|
479
|
+
existing.value_name ??= incoming.value_name;
|
|
480
|
+
existing.value_type ??= incoming.value_type;
|
|
481
|
+
if (incoming.required === true) {
|
|
482
|
+
existing.required = true;
|
|
483
|
+
}
|
|
484
|
+
if (incoming.repeatable === true) {
|
|
485
|
+
existing.repeatable = true;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
function mergeExtensionContractsByAction(contracts) {
|
|
489
|
+
const byAction = new Map();
|
|
490
|
+
for (const contract of contracts) {
|
|
491
|
+
const existing = byAction.get(contract.action);
|
|
492
|
+
if (!existing) {
|
|
493
|
+
byAction.set(contract.action, {
|
|
494
|
+
...contract,
|
|
495
|
+
flags: [...contract.flags],
|
|
496
|
+
examples: [...contract.examples],
|
|
497
|
+
failure_hints: [...contract.failure_hints],
|
|
498
|
+
});
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
existing.command = [...new Set([existing.command, contract.command])]
|
|
502
|
+
.sort((left, right) => left.localeCompare(right))
|
|
503
|
+
.join("|");
|
|
504
|
+
existing.arguments = existing.arguments.length >= contract.arguments.length ? existing.arguments : contract.arguments;
|
|
505
|
+
const flagKeys = new Set(existing.flags.map((flag) => `${flag.flag}|${flag.short ?? ""}`));
|
|
506
|
+
for (const flag of contract.flags) {
|
|
507
|
+
const key = `${flag.flag}|${flag.short ?? ""}`;
|
|
508
|
+
if (!flagKeys.has(key)) {
|
|
509
|
+
flagKeys.add(key);
|
|
510
|
+
existing.flags.push(flag);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
const existingFlag = existing.flags.find((candidate) => `${candidate.flag}|${candidate.short ?? ""}` === key);
|
|
514
|
+
if (existingFlag) {
|
|
515
|
+
mergeExtensionFlagContract(existingFlag, flag);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
existing.examples = [...new Set([...existing.examples, ...contract.examples])];
|
|
520
|
+
existing.failure_hints = [...new Set([...existing.failure_hints, ...contract.failure_hints])];
|
|
521
|
+
}
|
|
522
|
+
return [...byAction.values()].sort((left, right) => left.action.localeCompare(right.action));
|
|
523
|
+
}
|
|
416
524
|
async function resolveRuntimeExtensionActionProbe(global) {
|
|
417
525
|
const defaultPolicyState = {
|
|
418
526
|
mode: SETTINGS_DEFAULTS.extensions.policy.mode,
|
|
@@ -425,6 +533,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
|
|
|
425
533
|
disabledReason: "extensions_disabled",
|
|
426
534
|
commandDefinitions: [],
|
|
427
535
|
flagRegistrations: [],
|
|
536
|
+
registrations: null,
|
|
428
537
|
policyState: defaultPolicyState,
|
|
429
538
|
};
|
|
430
539
|
}
|
|
@@ -435,6 +544,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
|
|
|
435
544
|
disabledReason: null,
|
|
436
545
|
commandDefinitions: [],
|
|
437
546
|
flagRegistrations: [],
|
|
547
|
+
registrations: null,
|
|
438
548
|
policyState: defaultPolicyState,
|
|
439
549
|
};
|
|
440
550
|
}
|
|
@@ -456,6 +566,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
|
|
|
456
566
|
disabledReason: null,
|
|
457
567
|
commandDefinitions: activationResult.registrations.commands,
|
|
458
568
|
flagRegistrations: activationResult.registrations.flags,
|
|
569
|
+
registrations: activationResult.registrations,
|
|
459
570
|
policyState: {
|
|
460
571
|
mode: loadResult.policy.mode,
|
|
461
572
|
trust_mode: loadResult.policy.trust_mode,
|
|
@@ -469,6 +580,7 @@ async function resolveRuntimeExtensionActionProbe(global) {
|
|
|
469
580
|
disabledReason: "extension_runtime_probe_failed",
|
|
470
581
|
commandDefinitions: [],
|
|
471
582
|
flagRegistrations: [],
|
|
583
|
+
registrations: null,
|
|
472
584
|
policyState: defaultPolicyState,
|
|
473
585
|
};
|
|
474
586
|
}
|
|
@@ -513,10 +625,10 @@ function resolveActionAvailability(descriptor, runtimeProbe) {
|
|
|
513
625
|
cli_exposed: descriptor.command_path !== null,
|
|
514
626
|
};
|
|
515
627
|
}
|
|
516
|
-
const
|
|
517
|
-
?
|
|
518
|
-
:
|
|
519
|
-
const extensionCommandAvailable = commandPath
|
|
628
|
+
const commandPaths = descriptor.command_path
|
|
629
|
+
? splitCommandPathAliases(descriptor.command_path)
|
|
630
|
+
: [];
|
|
631
|
+
const extensionCommandAvailable = commandPaths.some((commandPath) => runtimeProbe.handlers.has(commandPath));
|
|
520
632
|
const invocable = runtimeProbe.disabledReason === null && extensionCommandAvailable;
|
|
521
633
|
return {
|
|
522
634
|
action: descriptor.action,
|
|
@@ -599,6 +711,12 @@ function resolveCoreCommandFlags(command) {
|
|
|
599
711
|
if (command === "history-redact") {
|
|
600
712
|
return HISTORY_REDACT_FLAG_CONTRACTS;
|
|
601
713
|
}
|
|
714
|
+
if (command === "history-repair") {
|
|
715
|
+
return HISTORY_REPAIR_FLAG_CONTRACTS;
|
|
716
|
+
}
|
|
717
|
+
if (command === "schema") {
|
|
718
|
+
return SCHEMA_FLAG_CONTRACTS;
|
|
719
|
+
}
|
|
602
720
|
if (command === "plan") {
|
|
603
721
|
return PLAN_FLAG_CONTRACTS;
|
|
604
722
|
}
|
|
@@ -941,15 +1059,16 @@ export async function runContracts(options, global) {
|
|
|
941
1059
|
catch {
|
|
942
1060
|
settings = structuredClone(SETTINGS_DEFAULTS);
|
|
943
1061
|
}
|
|
944
|
-
const
|
|
1062
|
+
const runtimeProbe = await resolveRuntimeExtensionActionProbe(global);
|
|
1063
|
+
const typeRegistry = resolveItemTypeRegistry(settings, runtimeProbe.registrations ?? getActiveExtensionRegistrations());
|
|
945
1064
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
946
1065
|
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
947
1066
|
const runtimeFieldFlagMap = buildRuntimeFieldFlagContracts(runtimeFieldRegistry);
|
|
948
1067
|
const createRequiredOptionContracts = buildCreateRequiredOptionContracts(typeRegistry);
|
|
949
|
-
const runtimeProbe = await resolveRuntimeExtensionActionProbe(global);
|
|
950
1068
|
const extensionContracts = collectExtensionCommandContracts(runtimeProbe);
|
|
1069
|
+
const mergedExtensionContracts = mergeExtensionContractsByAction(extensionContracts);
|
|
951
1070
|
const extensionFlagMap = collectExtensionFlagContractsByCommand(runtimeProbe.flagRegistrations);
|
|
952
|
-
const actionDescriptors = collectActionContractDescriptors(
|
|
1071
|
+
const actionDescriptors = collectActionContractDescriptors(mergedExtensionContracts);
|
|
953
1072
|
const actionNames = new Set(actionDescriptors.map((entry) => entry.action));
|
|
954
1073
|
if (selectedAction && !actionNames.has(selectedAction)) {
|
|
955
1074
|
throw new PmCliError(`Unknown action: "${options.action}".`, EXIT_CODE.USAGE);
|
|
@@ -957,7 +1076,7 @@ export async function runContracts(options, global) {
|
|
|
957
1076
|
const commandCatalog = [
|
|
958
1077
|
...new Set([
|
|
959
1078
|
...PM_CORE_COMMAND_NAMES.filter((entry) => !PACKAGE_OWNED_COMMANDS.has(entry)),
|
|
960
|
-
...
|
|
1079
|
+
...mergedExtensionContracts.flatMap((entry) => entry.command.split("|")),
|
|
961
1080
|
]),
|
|
962
1081
|
]
|
|
963
1082
|
.map((entry) => normalizeCommandPath(entry))
|
|
@@ -965,6 +1084,16 @@ export async function runContracts(options, global) {
|
|
|
965
1084
|
.sort((left, right) => left.localeCompare(right));
|
|
966
1085
|
const commandNames = new Set(commandCatalog);
|
|
967
1086
|
if (selectedCommand && !commandNames.has(selectedCommand)) {
|
|
1087
|
+
const packageHint = PACKAGE_OWNED_COMMAND_INSTALL_HINTS.get(selectedCommand);
|
|
1088
|
+
if (packageHint) {
|
|
1089
|
+
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, {
|
|
1090
|
+
examples: [`pm install ${packageHint} --project`, `pm contracts --command ${selectedCommand} --flags-only --json`],
|
|
1091
|
+
nextSteps: [`Install the optional package first: pm install ${packageHint} --project`],
|
|
1092
|
+
recovery: {
|
|
1093
|
+
suggested_retry: `pm install ${packageHint} --project`,
|
|
1094
|
+
},
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
968
1097
|
throw new PmCliError(`Unknown command: "${options.command}".`, EXIT_CODE.USAGE);
|
|
969
1098
|
}
|
|
970
1099
|
const commandScopedDescriptors = selectedCommand
|
|
@@ -991,7 +1120,7 @@ export async function runContracts(options, global) {
|
|
|
991
1120
|
return typeof actionConst === "string" ? actionConst : null;
|
|
992
1121
|
})
|
|
993
1122
|
.filter((entry) => entry !== null));
|
|
994
|
-
const extensionBranches =
|
|
1123
|
+
const extensionBranches = mergedExtensionContracts
|
|
995
1124
|
.filter((contract) => !schemaActionSet.has(contract.action))
|
|
996
1125
|
.map((contract) => buildExtensionActionSchemaBranch(contract));
|
|
997
1126
|
const mergedSchema = extensionBranches.length > 0
|
|
@@ -1035,6 +1164,7 @@ export async function runContracts(options, global) {
|
|
|
1035
1164
|
: selectedAction
|
|
1036
1165
|
? extensionContracts.filter((entry) => outputCommands.includes(normalizeCommandPath(entry.command)))
|
|
1037
1166
|
: extensionContracts;
|
|
1167
|
+
const includeRuntimeContractSections = !(flagsOnly && !fullOutput);
|
|
1038
1168
|
const result = {
|
|
1039
1169
|
schema_version: typeof mergedSchema["x-schema-version"] === "string"
|
|
1040
1170
|
? mergedSchema["x-schema-version"]
|
|
@@ -1052,7 +1182,9 @@ export async function runContracts(options, global) {
|
|
|
1052
1182
|
command_scoped: selectedCommand !== undefined,
|
|
1053
1183
|
},
|
|
1054
1184
|
commands: outputCommands,
|
|
1055
|
-
|
|
1185
|
+
};
|
|
1186
|
+
if (includeRuntimeContractSections) {
|
|
1187
|
+
result.runtime_schema = {
|
|
1056
1188
|
statuses: statusRegistry.definitions.map((definition) => definition.id),
|
|
1057
1189
|
open_status: statusRegistry.open_status,
|
|
1058
1190
|
close_status: statusRegistry.close_status,
|
|
@@ -1064,8 +1196,8 @@ export async function runContracts(options, global) {
|
|
|
1064
1196
|
...new Set(definitions.map((definition) => `--${definition.cli_flag}`)),
|
|
1065
1197
|
].sort((left, right) => left.localeCompare(right)),
|
|
1066
1198
|
])),
|
|
1067
|
-
}
|
|
1068
|
-
extension_contracts
|
|
1199
|
+
};
|
|
1200
|
+
result.extension_contracts = {
|
|
1069
1201
|
capabilities: [...PM_EXTENSION_CAPABILITY_CONTRACTS],
|
|
1070
1202
|
services: [...PM_EXTENSION_SERVICE_NAME_CONTRACTS],
|
|
1071
1203
|
policy_modes: [...PM_EXTENSION_POLICY_MODE_CONTRACTS],
|
|
@@ -1078,8 +1210,8 @@ export async function runContracts(options, global) {
|
|
|
1078
1210
|
previous: ["v1"],
|
|
1079
1211
|
breaking_strategy: "versioned_breaking",
|
|
1080
1212
|
},
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1083
1215
|
if (!flagsOnly) {
|
|
1084
1216
|
result.actions = actions;
|
|
1085
1217
|
result.action_availability = actionAvailability;
|
|
@@ -1114,4 +1246,4 @@ export async function runContracts(options, global) {
|
|
|
1114
1246
|
return result;
|
|
1115
1247
|
}
|
|
1116
1248
|
//# sourceMappingURL=contracts.js.map
|
|
1117
|
-
//# debugId=
|
|
1249
|
+
//# debugId=478936e5-660a-5f89-b15d-93b37468c7ed
|