@unbrained/pm-cli 2026.9.10 → 2026.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +31 -11
- package/dist/cli/command-namespaces.d.ts +2 -2
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/extension-command-help.js +3 -3
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-history-maintenance.js +2 -1
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +147 -155
- package/dist/cli-bundle/chunks/{chunk-EOCKPCEY.js → chunk-BN5QVWNY.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DAWH7TGV.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FBY6PEIR.js +20 -0
- package/dist/cli-bundle/chunks/chunk-IRUNFLLG.js +2 -0
- package/dist/cli-bundle/chunks/chunk-JMQKJ7CJ.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-I6XT3DLQ.js → chunk-QER6OSOP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-RJQSCK74.js +6 -0
- package/dist/cli-bundle/chunks/chunk-RJZFAXBW.js +235 -0
- package/dist/cli-bundle/chunks/{chunk-MACGGTLQ.js → chunk-SGAKQIGQ.js} +29 -29
- package/dist/cli-bundle/chunks/{chunk-NKOYVKFM.js → chunk-TDKWJQD7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4SFBH77G.js → chunk-TFVKBJJ4.js} +164 -150
- package/dist/cli-bundle/chunks/{chunk-PYUITRSV.js → chunk-VFKBNGF6.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-CUIW7SSE.js → register-list-query-U6MY437C.js} +6 -6
- package/dist/cli-bundle/chunks/{register-mutation-5F5CYUWZ.js → register-mutation-HAPHD4S7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-XIZPLPQY.js → register-operations-EHWIZW3X.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-JVGPCAIL.js → register-setup-BZYL3HBL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZJHYQOTM.js → chunk-3JVTLBCW.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-6JF66HAG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SL5YVVPV.js → chunk-7WISPJRZ.js} +53 -52
- package/dist/cli-bundle/focused-chunks/chunk-BEQAW7OT.js +12 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CRY5MHEI.js → chunk-DZ3ATEFS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FHUARRMA.js → chunk-FJDEFA64.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7N5MRONP.js → chunk-GKUF7TM5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U5SHHU7E.js → chunk-HM6JS6Q3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-M74YW332.js +164 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZDNAWWQI.js → chunk-MOT32PR2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ONDKO4EL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M36SF4GE.js → chunk-TGMSSI3Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-TWE3GPQM.js +30 -0
- package/dist/cli-bundle/focused-chunks/chunk-UJCQXUD2.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZAWAL2CG.js → chunk-VS6MR2HT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5YU75QLV.js → chunk-YOPNRWSX.js} +2 -2
- package/dist/cli-bundle/main.js +21 -21
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +37 -37
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +42 -42
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +10 -10
- package/dist/core/history/digest.d.ts +12 -0
- package/dist/core/history/digest.js +2 -0
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/history.d.ts +5 -3
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/replay.d.ts +3 -2
- package/dist/core/history/replay.js +1 -1
- package/dist/core/telemetry/runtime.d.ts +1 -0
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +2 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.d.ts +2 -0
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/completion.d.ts +2 -0
- package/dist/sdk/completion.js +26 -14
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/governance.d.ts +3 -0
- package/dist/sdk/governance.js +1 -1
- package/dist/sdk/history/attestation-command.d.ts +22 -0
- package/dist/sdk/history/attestation-command.js +3 -0
- package/dist/sdk/history/attestation-contract.d.ts +103 -0
- package/dist/sdk/history/attestation-contract.js +2 -0
- package/dist/sdk/history/attestation-scan.d.ts +16 -0
- package/dist/sdk/history/attestation-scan.js +2 -0
- package/dist/sdk/history/attestation.d.ts +8 -0
- package/dist/sdk/history/attestation.js +2 -0
- package/dist/sdk/history/salvage.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/read-output-budget.d.ts +4 -10
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-session.d.ts +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.d.ts +3 -0
- package/dist/sdk/runtime.js +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.js +1 -1
- package/docs/CLI_GRAMMAR.md +23 -0
- package/docs/HISTORY_ATTESTATION.md +164 -0
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +13 -0
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +4 -4
- package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +5 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -4
- package/marketplace.json +2 -2
- package/package.json +4 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/README.md +9 -7
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +6 -3
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +7 -19
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/README.md +9 -5
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +3 -2
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-74RGSPLL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7WIHZI2M.js +0 -5
- package/dist/cli-bundle/chunks/chunk-GLQMKUGP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-P6BEYAON.js +0 -8
- package/dist/cli-bundle/chunks/chunk-TSWEX72T.js +0 -20
- package/dist/cli-bundle/chunks/chunk-YKQTETJI.js +0 -235
- package/dist/cli-bundle/focused-chunks/chunk-26O2WB73.js +0 -10
- package/dist/cli-bundle/focused-chunks/chunk-B2CMFYRZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-F6WKFXBT.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-OROZM37I.js +0 -177
- package/dist/cli-bundle/focused-chunks/chunk-PNGYYQY7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TPOL4TWE.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-XSMA2W6Q.js +0 -12
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Official marketplace for pm CLI — native git-based project management for Claude Code and AI coding agents.",
|
|
9
|
-
"version": "2026.9.
|
|
9
|
+
"version": "2026.9.11"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "pm-claude",
|
|
14
14
|
"source": "./plugins/pm-claude",
|
|
15
15
|
"description": "Native pm CLI integration for Claude Code — 28 MCP tools, 5 workflow skills, 14 slash commands, 4 subagents, hybrid TUI task tracking, session context injection, and coordination subagents for git-based project management without leaving Claude Code.",
|
|
16
|
-
"version": "2026.9.
|
|
16
|
+
"version": "2026.9.11",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "unbrained",
|
|
19
19
|
"url": "https://github.com/unbraind/pm-cli"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.9.11 - 2026-09-11
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Portable integrity attestation: compare recorded history with independently retained proof bundles ([pm-3z0k](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/features/pm-3z0k.toon))
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- The history integrity chain hard-codes SHA-256 with no algorithm identifier, so the proof it produces has no migration path across the decades it claims to cover ([pm-bbk8we](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-bbk8we.toon))
|
|
12
|
+
- Optional undefined result fields silently drop telemetry completion events ([pm-rqaqfp](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-rqaqfp.toon))
|
|
13
|
+
- GH-1229: preserve bounded HTTP process-tree cleanup when POSIX liveness returns EPERM ([pm-qn9zxu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-qn9zxu.toon))
|
|
14
|
+
|
|
15
|
+
### Other
|
|
16
|
+
|
|
17
|
+
- Refresh jscpd 5.2 and MCP Apps 2 development contracts ([pm-qs5iiq](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-qs5iiq.toon))
|
|
18
|
+
- Register advanced retrieval as a search facet ([pm-wfskfn](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-wfskfn.toon))
|
|
19
|
+
- Consolidate duplicate governance under item operations ([pm-fmy9ih](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-fmy9ih.toon))
|
|
20
|
+
- Declare item copy and workspace merge command destinations ([pm-m6g87m](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-m6g87m.toon))
|
|
21
|
+
- Refresh Sentry 10.74 with history attestation consumer verification ([pm-2us1yv](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-2us1yv.toon))
|
|
22
|
+
|
|
3
23
|
## 2026.9.10 - 2026-09-10
|
|
4
24
|
|
|
5
25
|
### Changed
|
|
@@ -160,29 +180,29 @@
|
|
|
160
180
|
|
|
161
181
|
### Fixed
|
|
162
182
|
|
|
183
|
+
- A read whose result was omitted for budget still records those items as served and included, so the usage-affinity signal learns from context the agent never received ([pm-wv47pf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wv47pf.toon))
|
|
184
|
+
- Shape-qualified scale baselines drifted from current CLI/SDK output contracts and supported runtime ([pm-r8yytk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-r8yytk.toon))
|
|
163
185
|
- Context recency is computed from updated_at, so every governance write the project mandates erases the freshness signal it ranks on ([pm-07pt16](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-07pt16.toon))
|
|
164
186
|
|
|
165
187
|
### Security
|
|
166
188
|
|
|
167
189
|
- OSSF Scorecard alert \#29: qs denial-of-service advisories in the MCP Apps development dependency tree ([pm-mlpn91](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-mlpn91.toon))
|
|
168
190
|
|
|
191
|
+
### Other
|
|
192
|
+
|
|
193
|
+
- Refresh compatible 2026-09-01 jscpd 5.1.1 tooling ([pm-ur4swu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-ur4swu.toon))
|
|
194
|
+
- Refresh Sentry 10.73 and TypeScript-ESLint 8.69 with exact coverage ([pm-92tp12](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-92tp12.toon))
|
|
195
|
+
|
|
169
196
|
## 2026.9.2 - 2026-09-02
|
|
170
197
|
|
|
171
198
|
### Fixed
|
|
172
199
|
|
|
173
|
-
- A read whose result was omitted for budget still records those items as served and included, so the usage-affinity signal learns from context the agent never received ([pm-wv47pf](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-wv47pf.toon))
|
|
174
|
-
- Shape-qualified scale baselines drifted from current CLI/SDK output contracts and supported runtime ([pm-r8yytk](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-r8yytk.toon))
|
|
175
200
|
- GH-1174: Windows Node 24 receipt traversal negative control must fail closed portably ([pm-r97901](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-r97901.toon))
|
|
176
201
|
|
|
177
202
|
### Security
|
|
178
203
|
|
|
179
204
|
- GH-1173: make merge-receipt evidence diagnostics source-stable and record-addressable ([pm-dn8rwl](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-dn8rwl.toon))
|
|
180
205
|
|
|
181
|
-
### Other
|
|
182
|
-
|
|
183
|
-
- Refresh compatible 2026-09-01 jscpd 5.1.1 tooling ([pm-ur4swu](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-ur4swu.toon))
|
|
184
|
-
- Refresh Sentry 10.73 and TypeScript-ESLint 8.69 with exact coverage ([pm-92tp12](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-92tp12.toon))
|
|
185
|
-
|
|
186
206
|
## 2026.9.1 - 2026-09-01
|
|
187
207
|
|
|
188
208
|
### Added
|
|
@@ -197,6 +217,10 @@
|
|
|
197
217
|
- GH-1104: health must not certify pending lossless merge receipts as reconciled ([pm-baksix](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-baksix.toon))
|
|
198
218
|
- GH-1135: item_hash_version 2 still masks writer hash divergence as corruption ([pm-2qahia](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-2qahia.toon))
|
|
199
219
|
|
|
220
|
+
### Security
|
|
221
|
+
|
|
222
|
+
- Refresh compatible GitHub Actions and tsx tooling dependencies ([pm-k47gdd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-k47gdd.toon))
|
|
223
|
+
|
|
200
224
|
### Other
|
|
201
225
|
|
|
202
226
|
- Document the measured canonical agent cold-start across docs and generated guidance ([pm-ka6d](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-ka6d.toon))
|
|
@@ -216,10 +240,6 @@
|
|
|
216
240
|
- The local preflight token-budget gate is red on a workstation and green in hosted CI for the same commit again, because the earlier remediation closed the one ambient channel that had bitten instead of closing the fixture's environment ([pm-4o7tlx](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-4o7tlx.toon))
|
|
217
241
|
- The bounded legacy MCP compatibility set stops one revision short of the spec's own legacy boundary, so every current host is refused at initialize and the dual-era guarantee is unmet ([pm-edywqn](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-edywqn.toon))
|
|
218
242
|
|
|
219
|
-
### Security
|
|
220
|
-
|
|
221
|
-
- Refresh compatible GitHub Actions and tsx tooling dependencies ([pm-k47gdd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/chores/pm-k47gdd.toon))
|
|
222
|
-
|
|
223
243
|
### Deprecated
|
|
224
244
|
|
|
225
245
|
- The project's own agent-facing documentation and skills instruct deprecated command spellings, so the alias-usage signal that decides when a spelling can be retired is manufactured by the instructions rather than observed from callers ([pm-q2n4vd](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-q2n4vd.toon))
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* actual node preserves its parser, action closure, flags, and nested verbs.
|
|
6
6
|
*/
|
|
7
7
|
import type { Command } from "commander";
|
|
8
|
-
/**
|
|
9
|
-
export declare function installCommandNamespaces(program: Command): void;
|
|
8
|
+
/** Relocate existing handlers; the early pass moves only parents needed by package facets. */
|
|
9
|
+
export declare function installCommandNamespaces(program: Command, parentsOnly?: boolean): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(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]="
|
|
1
|
+
!(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]="9914cd35-65dc-58f4-8a4d-69cd5d7c6849")}catch(e2){}})();import{PM_RELOCATED_COMMAND_ALIASES}from"../sdk/cli-contracts/command-aliases.js";function installCommandNamespaces(program,parentsOnly=false){if(!program.commands.some(command=>command.name()==="ops"))program.command("ops").description("Discover workspace diagnostics and maintenance operations.");for(const{alias,canonical,canonical_argv:tokens}of PM_RELOCATED_COMMAND_ALIASES){if(parentsOnly&&!PM_RELOCATED_COMMAND_ALIASES.some(entry=>entry.canonical.startsWith(`${canonical} `)))continue;const sourceIndex=program.commands.findIndex(command=>command.name()===alias);if(sourceIndex<0)continue;const source=program.commands[sourceIndex];let parent=program;for(const noun of tokens.slice(0,-1)){if(parent!==program)parent.enablePositionalOptions();parent=parent.commands.find(command=>command.name()===noun)??parent.command(noun).description(`Discover ${noun} operations.`)}const verb=tokens[tokens.length-1];if(parent.commands.some(command=>command.name()===verb)){throw new Error(`Cannot install canonical command ${canonical}: destination already exists.`)}program.commands.splice(sourceIndex,1);source.name(verb);parent.enablePositionalOptions();parent.addCommand(source)}}export{installCommandNamespaces};
|
|
2
2
|
//# sourceMappingURL=command-namespaces.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
!(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]="
|
|
1
|
+
!(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]="cd9e5ba1-3a9b-5891-8617-9922574872fe")}catch(e2){}})();import{Option}from"commander";import{PM_RELOCATED_COMMAND_ALIASES}from"../sdk/cli-contracts/command-aliases.js";function normalizeExtensionCommandPath(commandPath){return commandPath.trim().toLowerCase().split(/\s+/).filter(part=>part.length>0).join(" ")}function buildCanonicalExtensionAliases(handlers,definitions){const aliases=new Map;for(const handler of handlers){const alias=normalizeExtensionCommandPath(handler.command);for(const definition of definitions){if(definition.layer!==handler.layer||definition.name!==handler.name){continue}const canonical=normalizeExtensionCommandPath(definition.command);const parts=canonical.split(" ");const action=parts.at(-1);const suffix=parts.slice(1).join(" ");const expectedAlias=suffix?`${parts[0]}-${action} ${suffix}`:`${parts[0]}-${action}`;if(action&&alias===expectedAlias){aliases.set(alias,canonical);break}}}return aliases}function extensionFlagTakesValueForInvocation(invocationArgv,commandName,normalizedMissing,descriptors){if(!commandName||!normalizedMissing){return void 0}let descriptor;let matchedTokenCount=0;for(const[index,token]of invocationArgv.entries()){if(token!==commandName){continue}const commandTokens=invocationArgv.slice(index);for(const[path,candidate]of descriptors.entries()){const pathTokens=path.split(" ");if(pathTokens.length>matchedTokenCount&&pathTokens.every((pathToken,pathIndex)=>commandTokens[pathIndex]===pathToken)){descriptor=candidate;matchedTokenCount=pathTokens.length}}}const flag=descriptor?.flags.find(candidate=>candidate.long===normalizedMissing||candidate.short===normalizedMissing);if(!flag){return void 0}return resolveExtensionFlagArity(flag).takesValue}function toNonEmptyFlagString(value){if(typeof value!=="string"){return null}const trimmed=value.trim();return trimmed.length>0?trimmed:null}function toOptionalBoolean(value){return typeof value==="boolean"?value:void 0}function resolveExtensionFlagArity(definition){const valueType=toNonEmptyFlagString(definition.value_type)??toNonEmptyFlagString(definition.type);const declaredValueName=toNonEmptyFlagString(definition.value_name);const takesValue=valueType!=="boolean"&&(declaredValueName!==null||valueType!==null||toOptionalBoolean(definition.required)===true||toOptionalBoolean(definition.list)===true);return{takesValue,valueName:takesValue?declaredValueName??"value":null}}function formatDynamicExtensionFlagHelpLine(definition){const visible=toOptionalBoolean(definition.visible);if(visible===false){return null}const longName=toNonEmptyFlagString(definition.long);if(!longName||!longName.startsWith("--")||longName.length<3){return null}const shortName=toNonEmptyFlagString(definition.short);const shortPrefix=shortName&&shortName.startsWith("-")&&!shortName.startsWith("--")?`${shortName}, `:"";const valueName=toNonEmptyFlagString(definition.value_name);const valueSuffix=valueName?` <${valueName}>`:"";const description=toNonEmptyFlagString(definition.description)??"Extension-provided option.";const markers=[];if(toOptionalBoolean(definition.required)===true){markers.push("required")}if(toOptionalBoolean(definition.enabled)===false){markers.push("disabled")}const markerSuffix=markers.length>0?` [${markers.join(", ")}]`:"";return`${shortPrefix}${longName}${valueSuffix} ${description}${markerSuffix}`}function buildDynamicExtensionFlagHelp(definitions){const lines=[...new Set(definitions.map(formatDynamicExtensionFlagHelpLine).filter(line=>line!==null))].sort((left,right)=>left.localeCompare(right));if(lines.length===0){return null}return`
|
|
2
2
|
Extension-provided flags:
|
|
3
|
-
${lines.join("\n ")}`}function collectDynamicExtensionFlagHelpByCommand(registrations){const grouped=new Map;for(const registration of registrations){const commandPath=normalizeExtensionCommandPath(registration.target_command);if(commandPath.length===0){continue}const existing=grouped.get(commandPath)??[];existing.push(...registration.flags);grouped.set(commandPath,existing)}const entries=[...grouped.entries()].sort(([left],[right])=>left.localeCompare(right));const helpByCommand=new Map;for(const[commandPath,definitions]of entries){const helpText=buildDynamicExtensionFlagHelp(definitions);if(!helpText){continue}helpByCommand.set(commandPath,helpText)}return helpByCommand}function normalizeExtensionCommandAction(commandPath,action){if(typeof action!=="string"||action.trim().length===0){return commandPath.replace(/\s+/g,"-")}return action.trim().toLowerCase()}function normalizeExtensionCommandStringList(values){if(!Array.isArray(values)){return[]}const normalized=[];const seen=new Set;for(const value of values){if(typeof value!=="string"){continue}const trimmed=value.trim();if(trimmed.length===0||seen.has(trimmed)){continue}seen.add(trimmed);normalized.push(trimmed)}return normalized}function normalizeExtensionCommandArguments(values){if(!Array.isArray(values)){return[]}return values.map(value=>{const name=typeof value.name==="string"?value.name.trim():"";if(name.length===0){return null}const normalized={name,required:value.required===true,variadic:value.variadic===true};if(typeof value.description==="string"&&value.description.trim().length>0){normalized.description=value.description.trim()}return normalized}).filter(entry=>entry!==null)}function collectExtensionDefinitionsByCommand(commandDefinitions){const definitionsByCommand=new Map;for(const definition of commandDefinitions){const commandPath=normalizeExtensionCommandPath(definition.command);if(commandPath.length===0){continue}const description=typeof definition.description==="string"&&definition.description.trim().length>0?definition.description.trim():void 0;const intent=typeof definition.intent==="string"&&definition.intent.trim().length>0?definition.intent.trim():void 0;definitionsByCommand.set(commandPath,{command:commandPath,action:normalizeExtensionCommandAction(commandPath,definition.action),description,intent,examples:normalizeExtensionCommandStringList(definition.examples),failure_hints:normalizeExtensionCommandStringList(definition.failure_hints),arguments:normalizeExtensionCommandArguments(definition.arguments),flags:[],tier:definition.tier??"standard",family:definition.family??"extensions",source:{layer:definition.layer,name:definition.name,package:definition.source_package}})}return definitionsByCommand}function collectExtensionFlagsByCommand(flagRegistrations){const flagsByCommand=new Map;for(const registration of flagRegistrations){const commandPath=normalizeExtensionCommandPath(registration.target_command);if(commandPath.length===0){continue}const existing=flagsByCommand.get(commandPath)??[];existing.push(...registration.flags);flagsByCommand.set(commandPath,existing)}return flagsByCommand}function collectExtensionHelpCommandSet(commandHandlers,definitionsByCommand,flagsByCommand){const commandSet=new Set;for(const commandPath of commandHandlers){const normalized=normalizeExtensionCommandPath(commandPath);if(normalized.length>0){commandSet.add(normalized)}}for(const commandPath of definitionsByCommand.keys()){commandSet.add(commandPath)}for(const commandPath of flagsByCommand.keys()){commandSet.add(commandPath)}return commandSet}function resolveFlattenedAliasDescriptor(commandPath,definitionsByCommand,canonicalAliases){const canonical=canonicalAliases.get(commandPath);return canonical?definitionsByCommand.get(canonical):void 0}function collectExtensionCommandHelpDescriptors(commandHandlers,commandDefinitions,flagRegistrations,canonicalAliases=new Map){const definitionsByCommand=collectExtensionDefinitionsByCommand(commandDefinitions);const flagsByCommand=collectExtensionFlagsByCommand(flagRegistrations);const commandSet=collectExtensionHelpCommandSet(commandHandlers,definitionsByCommand,flagsByCommand);const descriptors=new Map;const sortedCommands=[...commandSet].sort((left,right)=>left.localeCompare(right));for(const commandPath of sortedCommands){const definition=resolveFlattenedAliasDescriptor(commandPath,definitionsByCommand,canonicalAliases)??definitionsByCommand.get(commandPath);const flags=flagsByCommand.get(commandPath)??(definition?flagsByCommand.get(definition.command):void 0)??[];if(definition){descriptors.set(commandPath,{...definition,command:commandPath,flags});continue}descriptors.set(commandPath,{command:commandPath,action:normalizeExtensionCommandAction(commandPath,void 0),examples:[],failure_hints:[],arguments:[],flags,tier:"standard",family:"extensions"})}return descriptors}function buildExtensionArgumentToken(argument){const variadicSuffix=argument.variadic?"...":"";if(argument.required){return`<${argument.name}${variadicSuffix}>`}return`[${argument.name}${variadicSuffix}]`}function applyDynamicExtensionArguments(command,descriptor){for(const argument of descriptor.arguments){command.argument(buildExtensionArgumentToken(argument),argument.description??"Extension argument.")}}function normalizeDynamicExtensionOptionNames(definition){const visible=toOptionalBoolean(definition.visible);if(visible===false){return null}const longName=toNonEmptyFlagString(definition.long);const shortName=toNonEmptyFlagString(definition.short);const normalizedShort=shortName&&shortName.startsWith("-")&&!shortName.startsWith("--")?shortName:null;const normalizedLong=longName&&longName.startsWith("--")&&longName.length>2?longName:null;const optionNames=[normalizedShort,normalizedLong].filter(entry=>entry!==null);return optionNames.length>0?optionNames:null}function formatDynamicExtensionOptionFlags(definition){const optionNames=normalizeDynamicExtensionOptionNames(definition);if(!optionNames){return null}const{valueName}=resolveExtensionFlagArity(definition);const optionValueSuffix=valueName?` <${valueName}>`:"";return`${optionNames.join(", ")}${optionValueSuffix}`}function formatDynamicExtensionParseOptionFlags(definition){const optionNames=normalizeDynamicExtensionOptionNames(definition);if(!optionNames){return null}const{valueName}=resolveExtensionFlagArity(definition);const valueSuffix=valueName?` <${valueName}>`:"";return`${optionNames.join(", ")}${valueSuffix}`}function formatDynamicExtensionOptionDescription(definition){const description=toNonEmptyFlagString(definition.description)??"Extension-provided option.";const markers=[];if(toOptionalBoolean(definition.required)===true){markers.push("required")}if(toOptionalBoolean(definition.enabled)===false){markers.push("disabled")}const markerSuffix=markers.length>0?` [${markers.join(", ")}]`:"";return`${description}${markerSuffix}`}function commandAlreadyHasOption(command,definition){const longName=toNonEmptyFlagString(definition.long);const shortName=toNonEmptyFlagString(definition.short);return command.options.some(option=>{const optionWithNames=option;return longName!==null&&optionWithNames.long===longName||shortName!==null&&optionWithNames.short===shortName})}function applyDynamicExtensionFlagOptions(command,definitions){for(const definition of definitions){if(commandAlreadyHasOption(command,definition)){continue}const flags=formatDynamicExtensionParseOptionFlags(definition);if(!flags){continue}const description=formatDynamicExtensionOptionDescription(definition);if(definition.list!==true){command.option
|
|
3
|
+
${lines.join("\n ")}`}function collectDynamicExtensionFlagHelpByCommand(registrations){const grouped=new Map;for(const registration of registrations){const commandPath=normalizeExtensionCommandPath(registration.target_command);if(commandPath.length===0){continue}const existing=grouped.get(commandPath)??[];existing.push(...registration.flags);grouped.set(commandPath,existing)}const entries=[...grouped.entries()].sort(([left],[right])=>left.localeCompare(right));const helpByCommand=new Map;for(const[commandPath,definitions]of entries){const helpText=buildDynamicExtensionFlagHelp(definitions);if(!helpText){continue}helpByCommand.set(commandPath,helpText)}return helpByCommand}function normalizeExtensionCommandAction(commandPath,action){if(typeof action!=="string"||action.trim().length===0){return commandPath.replace(/\s+/g,"-")}return action.trim().toLowerCase()}function normalizeExtensionCommandStringList(values){if(!Array.isArray(values)){return[]}const normalized=[];const seen=new Set;for(const value of values){if(typeof value!=="string"){continue}const trimmed=value.trim();if(trimmed.length===0||seen.has(trimmed)){continue}seen.add(trimmed);normalized.push(trimmed)}return normalized}function normalizeExtensionCommandArguments(values){if(!Array.isArray(values)){return[]}return values.map(value=>{const name=typeof value.name==="string"?value.name.trim():"";if(name.length===0){return null}const normalized={name,required:value.required===true,variadic:value.variadic===true};if(typeof value.description==="string"&&value.description.trim().length>0){normalized.description=value.description.trim()}return normalized}).filter(entry=>entry!==null)}function collectExtensionDefinitionsByCommand(commandDefinitions){const definitionsByCommand=new Map;for(const definition of commandDefinitions){const commandPath=normalizeExtensionCommandPath(definition.command);if(commandPath.length===0){continue}const description=typeof definition.description==="string"&&definition.description.trim().length>0?definition.description.trim():void 0;const intent=typeof definition.intent==="string"&&definition.intent.trim().length>0?definition.intent.trim():void 0;definitionsByCommand.set(commandPath,{command:commandPath,action:normalizeExtensionCommandAction(commandPath,definition.action),description,intent,examples:normalizeExtensionCommandStringList(definition.examples),failure_hints:normalizeExtensionCommandStringList(definition.failure_hints),arguments:normalizeExtensionCommandArguments(definition.arguments),flags:[],tier:definition.tier??"standard",family:definition.family??"extensions",source:{layer:definition.layer,name:definition.name,package:definition.source_package}})}return definitionsByCommand}function collectExtensionFlagsByCommand(flagRegistrations){const flagsByCommand=new Map;for(const registration of flagRegistrations){const commandPath=normalizeExtensionCommandPath(registration.target_command);if(commandPath.length===0){continue}const existing=flagsByCommand.get(commandPath)??[];existing.push(...registration.flags);flagsByCommand.set(commandPath,existing)}return flagsByCommand}function collectExtensionHelpCommandSet(commandHandlers,definitionsByCommand,flagsByCommand){const commandSet=new Set;for(const commandPath of commandHandlers){const normalized=normalizeExtensionCommandPath(commandPath);if(normalized.length>0){commandSet.add(normalized)}}for(const commandPath of definitionsByCommand.keys()){commandSet.add(commandPath)}for(const commandPath of flagsByCommand.keys()){commandSet.add(commandPath)}return commandSet}function resolveFlattenedAliasDescriptor(commandPath,definitionsByCommand,canonicalAliases){const canonical=canonicalAliases.get(commandPath);return canonical?definitionsByCommand.get(canonical):void 0}function collectExtensionCommandHelpDescriptors(commandHandlers,commandDefinitions,flagRegistrations,canonicalAliases=new Map){const definitionsByCommand=collectExtensionDefinitionsByCommand(commandDefinitions);const flagsByCommand=collectExtensionFlagsByCommand(flagRegistrations);const commandSet=collectExtensionHelpCommandSet(commandHandlers,definitionsByCommand,flagsByCommand);const descriptors=new Map;const sortedCommands=[...commandSet].sort((left,right)=>left.localeCompare(right));for(const commandPath of sortedCommands){const definition=resolveFlattenedAliasDescriptor(commandPath,definitionsByCommand,canonicalAliases)??definitionsByCommand.get(commandPath);const flags=flagsByCommand.get(commandPath)??(definition?flagsByCommand.get(definition.command):void 0)??[];if(definition){descriptors.set(commandPath,{...definition,command:commandPath,flags});continue}descriptors.set(commandPath,{command:commandPath,action:normalizeExtensionCommandAction(commandPath,void 0),examples:[],failure_hints:[],arguments:[],flags,tier:"standard",family:"extensions"})}return descriptors}function buildExtensionArgumentToken(argument){const variadicSuffix=argument.variadic?"...":"";if(argument.required){return`<${argument.name}${variadicSuffix}>`}return`[${argument.name}${variadicSuffix}]`}function applyDynamicExtensionArguments(command,descriptor){for(const argument of descriptor.arguments){command.argument(buildExtensionArgumentToken(argument),argument.description??"Extension argument.")}}function normalizeDynamicExtensionOptionNames(definition){const visible=toOptionalBoolean(definition.visible);if(visible===false){return null}const longName=toNonEmptyFlagString(definition.long);const shortName=toNonEmptyFlagString(definition.short);const normalizedShort=shortName&&shortName.startsWith("-")&&!shortName.startsWith("--")?shortName:null;const normalizedLong=longName&&longName.startsWith("--")&&longName.length>2?longName:null;const optionNames=[normalizedShort,normalizedLong].filter(entry=>entry!==null);return optionNames.length>0?optionNames:null}function formatDynamicExtensionOptionFlags(definition){const optionNames=normalizeDynamicExtensionOptionNames(definition);if(!optionNames){return null}const{valueName}=resolveExtensionFlagArity(definition);const optionValueSuffix=valueName?` <${valueName}>`:"";return`${optionNames.join(", ")}${optionValueSuffix}`}function formatDynamicExtensionParseOptionFlags(definition){const optionNames=normalizeDynamicExtensionOptionNames(definition);if(!optionNames){return null}const{valueName}=resolveExtensionFlagArity(definition);const valueSuffix=valueName?` <${valueName}>`:"";return`${optionNames.join(", ")}${valueSuffix}`}function formatDynamicExtensionOptionDescription(definition){const description=toNonEmptyFlagString(definition.description)??"Extension-provided option.";const markers=[];if(toOptionalBoolean(definition.required)===true){markers.push("required")}if(toOptionalBoolean(definition.enabled)===false){markers.push("disabled")}const markerSuffix=markers.length>0?` [${markers.join(", ")}]`:"";return`${description}${markerSuffix}`}function commandAlreadyHasOption(command,definition){const longName=toNonEmptyFlagString(definition.long);const shortName=toNonEmptyFlagString(definition.short);return command.options.some(option=>{const optionWithNames=option;return longName!==null&&optionWithNames.long===longName||shortName!==null&&optionWithNames.short===shortName})}function applyDynamicExtensionFlagOptions(command,definitions){for(const definition of definitions){if(commandAlreadyHasOption(command,definition)){continue}const flags=formatDynamicExtensionParseOptionFlags(definition);if(!flags){continue}const description=formatDynamicExtensionOptionDescription(definition);const option=new Option(flags,description);option.negate=false;if(definition.list!==true){command.addOption(option);continue}command.addOption(option.argParser((value,previous=[])=>[...Array.isArray(previous)?previous:[previous],value]))}}function buildResidualDynamicExtensionFlagHelp(command,definitions){return buildDynamicExtensionFlagHelp(definitions.filter(definition=>!commandAlreadyHasOption(command,definition)))}function buildDynamicExtensionHelpOptionSummary(definition){const flags=formatDynamicExtensionOptionFlags(definition);if(!flags){return null}const longName=toNonEmptyFlagString(definition.long);const shortName=toNonEmptyFlagString(definition.short);const normalizedLong=longName&&longName.startsWith("--")&&longName.length>2?longName:null;const normalizedShort=shortName&&shortName.startsWith("-")&&!shortName.startsWith("--")?shortName:null;const{takesValue,valueName}=resolveExtensionFlagArity(definition);const required=toOptionalBoolean(definition.required)===true;return{flags,long:normalizedLong,short:normalizedShort,description:formatDynamicExtensionOptionDescription(definition),takes_value:takesValue,value_required:takesValue,value_name:valueName,variadic:false,required,aliases:[],alias_for:null}}function buildDynamicExtensionHelpOptionSummaries(descriptor){if(!descriptor){return[]}const summaries=[];const seen=new Set;for(const definition of descriptor.flags){const summary=buildDynamicExtensionHelpOptionSummary(definition);if(!summary||seen.has(summary.flags)){continue}seen.add(summary.flags);summaries.push(summary)}return summaries}function mergeHelpOptionSummaries(base,extension){if(extension.length===0){return base}const merged=[...base];const seen=new Set(base.map(entry=>entry.flags));for(const entry of extension){if(seen.has(entry.flags)){continue}seen.add(entry.flags);merged.push(entry)}return merged}function buildDynamicExtensionCommandMetadataHelp(descriptor){const lines=[];if(descriptor.intent){lines.push(`Intent: ${descriptor.intent}`)}if(descriptor.action){lines.push(`Action contract: ${descriptor.action}`)}if(descriptor.examples.length>0){lines.push("Examples:");for(const example of descriptor.examples){lines.push(` - ${example}`)}}if(descriptor.failure_hints.length>0){lines.push("Common failure hints:");for(const hint of descriptor.failure_hints){lines.push(` - ${hint}`)}}if(lines.length===0){return null}return`
|
|
4
4
|
Extension command metadata:
|
|
5
|
-
${lines.join("\n ")}`}function commandAliases(command){const commandRecord=command;if(typeof commandRecord.aliases==="function"){return commandRecord.aliases().map(value=>value.trim().toLowerCase()).filter(value=>value.length>0)}if(typeof commandRecord.alias==="function"){const alias=commandRecord.alias();if(typeof alias==="string"&&alias.trim().length>0){return[alias.trim().toLowerCase()]}}if(Array.isArray(commandRecord._aliases)){return commandRecord._aliases.map(value=>value.trim().toLowerCase()).filter(value=>value.length>0)}return[]}function findDirectChildCommand(parent,name){const normalizedTarget=name.trim().toLowerCase();return parent.commands.find(entry=>{if(entry.name().trim().toLowerCase()===normalizedTarget){return true}return commandAliases(entry).includes(normalizedTarget)})??null}function findCommandByPath(root,pathParts){let current=root;for(const part of pathParts){const next=findDirectChildCommand(current,part);if(!next){return null}current=next}return current}const extensionCreatedCommands=new WeakSet;function ensureCommandPath(root,pathParts){if(pathParts.length===0){return null}let current=root;for(let index=0;index<pathParts.length;index+=1){const part=pathParts[index];const existing=findDirectChildCommand(current,part);if(existing){current=existing;continue}const created=current.command(part);extensionCreatedCommands.add(created);if(index<pathParts.length-1){created.description("Extension-provided command group.");created.action(()=>{created.help()})}else{created.description("Extension-provided command path.")}current=created}return current}function findExtensionCommandPathCollision(root,pathParts){let current=root;const traversed=[];for(const part of pathParts){const existing=findDirectChildCommand(current,part);if(!existing){return null}traversed.push(part);if(!extensionCreatedCommands.has(existing)){return{core_path:traversed.join(" "),extension_path:pathParts.join(" ")}}current=existing}return null}function buildExtensionCommandCollisionWarning(root,commandPath,aliases,descriptor){const pathParts=commandPath.split(" ").filter(part=>part.length>0);const collision=findExtensionCommandPathCollision(root,pathParts);if(!collision||collision.core_path===commandPath&&!aliases.has(commandPath)){return null}const extensionOwner=descriptor?.source?.package??descriptor?.source?.name??"unknown-extension";return`extension_command_collision:${collision.extension_path}:core_owner=pm-cli:${collision.core_path}:extension_owner=${extensionOwner}`}function collectSafeExtensionCommandPaths(root,commandHandlers,descriptors,aliases,onCollision){return[...new Set([...commandHandlers,...descriptors.keys()])].filter(commandPath=>commandPath.trim().length>0).sort((left,right)=>left.localeCompare(right)).filter(commandPath=>{const warning=buildExtensionCommandCollisionWarning(root,commandPath,aliases,descriptors.get(commandPath));if(!warning)return true;onCollision(warning);return false})}function reportExtensionCommandCollision(activationWarnings,report,warning){activationWarnings.push(warning);report(`[pm] warning: ${warning}; core command preserved. Rename or namespace the extension command alias.`)}export{applyDynamicExtensionArguments,applyDynamicExtensionFlagOptions,buildCanonicalExtensionAliases,buildDynamicExtensionCommandMetadataHelp,buildDynamicExtensionHelpOptionSummaries,buildExtensionCommandCollisionWarning,buildResidualDynamicExtensionFlagHelp,collectDynamicExtensionFlagHelpByCommand,collectExtensionCommandHelpDescriptors,collectSafeExtensionCommandPaths,commandAliases,ensureCommandPath,extensionFlagTakesValueForInvocation,findCommandByPath,findDirectChildCommand,findExtensionCommandPathCollision,mergeHelpOptionSummaries,normalizeExtensionCommandPath,reportExtensionCommandCollision,resolveExtensionFlagArity};
|
|
5
|
+
${lines.join("\n ")}`}function commandAliases(command){const commandRecord=command;if(typeof commandRecord.aliases==="function"){return commandRecord.aliases().map(value=>value.trim().toLowerCase()).filter(value=>value.length>0)}if(typeof commandRecord.alias==="function"){const alias=commandRecord.alias();if(typeof alias==="string"&&alias.trim().length>0){return[alias.trim().toLowerCase()]}}if(Array.isArray(commandRecord._aliases)){return commandRecord._aliases.map(value=>value.trim().toLowerCase()).filter(value=>value.length>0)}return[]}function findDirectChildCommand(parent,name){const normalizedTarget=name.trim().toLowerCase();return parent.commands.find(entry=>{if(entry.name().trim().toLowerCase()===normalizedTarget){return true}return commandAliases(entry).includes(normalizedTarget)})??null}function findCommandByPath(root,pathParts){let current=root;for(const part of pathParts){const next=findDirectChildCommand(current,part);if(!next){return null}current=next}return current}const extensionCreatedCommands=new WeakSet;function ensureCommandPath(root,pathParts){if(pathParts.length===0){return null}let current=root;for(let index=0;index<pathParts.length;index+=1){const part=pathParts[index];if(index>0&&PM_RELOCATED_COMMAND_ALIASES.some(entry=>entry.canonical===pathParts.join(" ")))current.enablePositionalOptions();const existing=findDirectChildCommand(current,part);if(existing){current=existing;continue}const created=current.command(part);extensionCreatedCommands.add(created);if(index<pathParts.length-1){created.description("Extension-provided command group.");created.action(()=>{created.help()})}else{created.description("Extension-provided command path.")}current=created}return current}function findExtensionCommandPathCollision(root,pathParts){let current=root;const traversed=[];for(const part of pathParts){const existing=findDirectChildCommand(current,part);if(!existing){return null}traversed.push(part);if(!extensionCreatedCommands.has(existing)){return{core_path:traversed.join(" "),extension_path:pathParts.join(" ")}}current=existing}return null}function buildExtensionCommandCollisionWarning(root,commandPath,aliases,descriptor){const pathParts=commandPath.split(" ").filter(part=>part.length>0);const collision=findExtensionCommandPathCollision(root,pathParts);const declaredFacet=PM_RELOCATED_COMMAND_ALIASES.some(alias=>alias.canonical===commandPath&&alias.alias===descriptor?.action);if(!collision||collision.core_path===commandPath&&!aliases.has(commandPath)||declaredFacet&&!aliases.has(commandPath)){return null}const extensionOwner=descriptor?.source?.package??descriptor?.source?.name??"unknown-extension";return`extension_command_collision:${collision.extension_path}:core_owner=pm-cli:${collision.core_path}:extension_owner=${extensionOwner}`}function collectSafeExtensionCommandPaths(root,commandHandlers,descriptors,aliases,onCollision){return[...new Set([...commandHandlers,...descriptors.keys()])].filter(commandPath=>commandPath.trim().length>0).sort((left,right)=>left.localeCompare(right)).filter(commandPath=>{const warning=buildExtensionCommandCollisionWarning(root,commandPath,aliases,descriptors.get(commandPath));if(!warning)return true;onCollision(warning);return false})}function reportExtensionCommandCollision(activationWarnings,report,warning){activationWarnings.push(warning);report(`[pm] warning: ${warning}; core command preserved. Rename or namespace the extension command alias.`)}export{applyDynamicExtensionArguments,applyDynamicExtensionFlagOptions,buildCanonicalExtensionAliases,buildDynamicExtensionCommandMetadataHelp,buildDynamicExtensionHelpOptionSummaries,buildExtensionCommandCollisionWarning,buildResidualDynamicExtensionFlagHelp,collectDynamicExtensionFlagHelpByCommand,collectExtensionCommandHelpDescriptors,collectSafeExtensionCommandPaths,commandAliases,ensureCommandPath,extensionFlagTakesValueForInvocation,findCommandByPath,findDirectChildCommand,findExtensionCommandPathCollision,mergeHelpOptionSummaries,normalizeExtensionCommandPath,reportExtensionCommandCollision,resolveExtensionFlagArity};
|
|
6
6
|
//# sourceMappingURL=extension-command-help.js.map
|
package/dist/cli/main.d.ts
CHANGED
|
@@ -92,7 +92,9 @@ declare function handleGenericRunPmCliError(params: {
|
|
|
92
92
|
commandResolution: TelemetryCommandResolution;
|
|
93
93
|
}>;
|
|
94
94
|
}): Promise<void>;
|
|
95
|
+
/** Separate handler options from global controls, then validate and coerce contributed flags against the command's declared schema. */
|
|
95
96
|
declare function extractCommandScopedOptions(command: Command, commandArgs: string[], extensionFlagDefinitions?: LooseCommandFlagDefinition[]): Record<string, unknown>;
|
|
97
|
+
/** Join contributed flags by stable operation identity so canonical and compatibility command paths share the same schema. */
|
|
96
98
|
declare function collectExtensionFlagDefinitionsForCommand(registrations: ReturnType<typeof createEmptyExtensionRegistrationRegistry>, commandPath: string): FlagDefinition[];
|
|
97
99
|
declare function collectExtensionFlagDefinitionsForInvocation(registrations: ReturnType<typeof createEmptyExtensionRegistrationRegistry>, commandPath: string, commandArgs: string[]): FlagDefinition[];
|
|
98
100
|
/**
|
|
@@ -134,7 +136,9 @@ declare function hasGlobalExtensionContributions(contributions: NonNullable<Exte
|
|
|
134
136
|
/** Resolve an exact activation verdict from declared commands and contributions. */
|
|
135
137
|
declare function resolveStaticExtensionActivationDecision(extension: ExtensionDiscoveryResult["effective"][number], probe: RuntimeExtensionActivationProbe): boolean | undefined;
|
|
136
138
|
declare function extensionNeedsActivationForProbe(extension: ExtensionDiscoveryResult["effective"][number], probe: RuntimeExtensionActivationProbe): boolean;
|
|
139
|
+
/** Decide whether installed providers must activate for a targeted invocation or complete command discovery. */
|
|
137
140
|
declare function discoveryNeedsActivationForProbe(discovery: ExtensionDiscoveryResult, probe: RuntimeExtensionActivationProbe): boolean;
|
|
141
|
+
/** Build a deterministic activation scope; completion and unconstrained discovery include every installed command provider. */
|
|
138
142
|
declare function buildRuntimeExtensionActivationScope(probe: RuntimeExtensionActivationProbe): string;
|
|
139
143
|
declare function buildRuntimeExtensionFilterForProbe(probe: RuntimeExtensionActivationProbe): ((extension: ExtensionDiscoveryResult["effective"][number]) => boolean) | undefined;
|
|
140
144
|
declare function buildBootstrapActivationProbe(invocationArgv: string[]): RuntimeExtensionActivationProbe;
|