@unbrained/pm-cli 2026.9.22 → 2026.9.25

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.
Files changed (107) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +6 -20
  3. package/CHANGELOG.md +43 -0
  4. package/dist/cli/error-guidance.d.ts +9 -0
  5. package/dist/cli/error-guidance.js +1 -1
  6. package/dist/cli/help-content.js +1 -1
  7. package/dist/cli-bundle/bundle-manifest.json +144 -144
  8. package/dist/cli-bundle/chunks/{chunk-BJBBOUYQ.js → chunk-25KTCTBL.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-UDNYAMCM.js → chunk-3IB4THWX.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-3OFFMS2N.js → chunk-445ARBKY.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-SBTT42A4.js → chunk-5AP67ZXH.js} +3 -3
  12. package/dist/cli-bundle/chunks/{chunk-JSW33Q6R.js → chunk-COFQCKF4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-4XOV7Q5R.js → chunk-CZ3VJJEA.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-ZSPZJOMK.js → chunk-GAU55CWI.js} +28 -28
  15. package/dist/cli-bundle/chunks/{chunk-ML42DLI3.js → chunk-GOWZEBTH.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-CM57QHVK.js → chunk-JDHWZYZU.js} +73 -73
  17. package/dist/cli-bundle/chunks/{chunk-GFTN5OS4.js → chunk-P7ZSJOWH.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-AVWHZUNC.js → chunk-YABJDOOX.js} +63 -62
  19. package/dist/cli-bundle/chunks/{chunk-D2OV2UBV.js → chunk-YDIGMRLZ.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-list-query-VOS5CBX4.js → register-list-query-IZ7ZVTDE.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-mutation-LWZH6UFJ.js → register-mutation-IPAZTFDZ.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-operations-YJK4DNFZ.js → register-operations-APN33LNI.js} +2 -2
  23. package/dist/cli-bundle/chunks/{register-setup-Q3CYF67Q.js → register-setup-HPHIKG5U.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-CASXNCNQ.js → chunk-ABA3KRPY.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-XR5EBU3B.js → chunk-HQPTDJLF.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/{chunk-PRMQTT7X.js → chunk-IXNNMP2R.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-KRIHJH5U.js +75 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-QFEDRPPI.js → chunk-MK5AKKHK.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-LH24XUPJ.js → chunk-NRHTXBTI.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-URH727T5.js → chunk-NVVB2HJC.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-TSI73EEM.js → chunk-O7MIBEMK.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-V2NARGRH.js → chunk-OY3VHCTX.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-UT7VS4X2.js → chunk-PMPFLA6X.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-FKYUTTFL.js → chunk-Q355NPLH.js} +28 -28
  35. package/dist/cli-bundle/focused-chunks/{chunk-JCD5YESL.js → chunk-TLF6N56J.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-MXESHALQ.js → chunk-UIFVIE5F.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-IOL25GKH.js → chunk-V2X37U6J.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-AO5FR7PN.js → chunk-XKH2FC5D.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-UAU4DJSR.js → chunk-Y2M4QLAA.js} +2 -2
  40. package/dist/cli-bundle/main.js +22 -22
  41. package/dist/cli-bundle/sdk-authoring.js +1 -1
  42. package/dist/cli-bundle/sdk-contracts.js +1 -1
  43. package/dist/cli-bundle/sdk-core.js +30 -45
  44. package/dist/cli-bundle/sdk-governance.js +1 -1
  45. package/dist/cli-bundle/sdk-graph.js +1 -1
  46. package/dist/cli-bundle/sdk-merge.js +58 -42
  47. package/dist/cli-bundle/sdk-query.js +1 -1
  48. package/dist/cli-bundle/sdk-runtime.js +1 -1
  49. package/dist/cli-bundle/sdk-testing.js +1 -1
  50. package/dist/cli-bundle/sdk.js +9 -10
  51. package/dist/core/policy/workflow-policy-store.js +1 -1
  52. package/dist/core/shared/errors.d.ts +13 -0
  53. package/dist/core/shared/errors.js +1 -1
  54. package/dist/sdk/cli-contracts/commander-types.d.ts +11 -11
  55. package/dist/sdk/cli-contracts/commander-types.js +1 -1
  56. package/dist/sdk/completion/bash.js +1 -1
  57. package/dist/sdk/governance/health.d.ts +1 -1
  58. package/dist/sdk/governance/health.js +1 -1
  59. package/dist/sdk/init-agent-guidance.d.ts +2 -1
  60. package/dist/sdk/init-agent-guidance.js +2 -2
  61. package/dist/sdk/merge/install.js +2 -2
  62. package/dist/sdk/merge/worktree-config.d.ts +9 -0
  63. package/dist/sdk/merge/worktree-config.js +2 -0
  64. package/dist/sdk/pagination.js +1 -1
  65. package/dist/sdk/public-surface.json +1 -1
  66. package/docs/AGENT_RECOVERY_AND_GUIDANCE.md +49 -0
  67. package/docs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.md +2 -0
  68. package/docs/CLAUDE_CODE_PLUGIN.md +18 -7
  69. package/docs/CODEX_PLUGIN.md +5 -12
  70. package/docs/DEFECT_RECURRENCE.md +8 -1
  71. package/docs/DEPENDENCY_KIND_CONTRACT.md +27 -0
  72. package/docs/MERGE_SAFETY.md +28 -5
  73. package/docs/QUALITY_EVIDENCE.md +70 -0
  74. package/docs/README.md +1 -0
  75. package/docs/RELEASE_RELIABILITY.md +70 -0
  76. package/docs/RELEASING.md +4 -0
  77. package/docs/TESTING.md +25 -0
  78. package/docs/VALIDATION_PORTABILITY.md +20 -11
  79. package/marketplace.json +2 -2
  80. package/package.json +12 -6
  81. package/packages/pm-beads/package.json +1 -1
  82. package/packages/pm-calendar/package.json +1 -1
  83. package/packages/pm-command-kit/package.json +1 -1
  84. package/packages/pm-digital-twin/package.json +1 -1
  85. package/packages/pm-governance-audit/package.json +1 -1
  86. package/packages/pm-guide-shell/package.json +1 -1
  87. package/packages/pm-kanban/package.json +1 -1
  88. package/packages/pm-lifecycle-hooks/package.json +1 -1
  89. package/packages/pm-linked-test-adapters/package.json +1 -1
  90. package/packages/pm-search-advanced/package.json +1 -1
  91. package/packages/pm-templates/package.json +1 -1
  92. package/packages/pm-todos/package.json +1 -1
  93. package/packages/pm-vcs/package.json +1 -1
  94. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  95. package/plugins/pm-claude/README.md +6 -5
  96. package/plugins/pm-claude/hooks/hooks.json +1 -1
  97. package/plugins/pm-claude/hooks/session-start.mjs +9 -6
  98. package/plugins/pm-claude/package.json +9 -0
  99. package/plugins/pm-claude/scripts/plugin-runtime.mjs +84 -0
  100. package/plugins/pm-claude/scripts/pm-mcp-server.mjs +39 -96
  101. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  102. package/plugins/pm-codex/.mcp.json +0 -3
  103. package/plugins/pm-codex/README.md +1 -1
  104. package/plugins/pm-codex/package.json +9 -0
  105. package/plugins/pm-codex/scripts/plugin-runtime.mjs +84 -0
  106. package/plugins/pm-codex/scripts/pm-mcp-server.mjs +38 -99
  107. package/dist/cli-bundle/focused-chunks/chunk-QYN77MQP.js +0 -59
@@ -1,112 +1,51 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * This file is auto-generated by scripts/gen-plugin-mcp-wrappers.mjs.
4
- * Do not edit directly.
3
+ * Cached-plugin MCP launcher, copied verbatim into Claude and Codex plugins.
4
+ * The server runs from an exact-version package, never from an npm tag.
5
5
  */
6
6
  import { spawn } from "node:child_process";
7
- import { access } from "node:fs/promises";
7
+ import { access, readFile } from "node:fs/promises";
8
8
  import path from "node:path";
9
- import { fileURLToPath, pathToFileURL } from "node:url";
9
+ import { fileURLToPath } from "node:url";
10
+ import { resolvePluginRuntime } from "./plugin-runtime.mjs";
10
11
 
11
- async function canRead(target) {
12
- try {
13
- await access(target);
14
- return true;
15
- } catch {
16
- return false;
17
- }
18
- }
12
+ const here = path.dirname(fileURLToPath(import.meta.url));
19
13
 
20
- function hasImportProtocol(target) {
21
- if (/^[A-Za-z]:[\\/]/.test(target)) {
22
- return false;
14
+ /** Return an explicit local server path or this plugin's matching checkout build. */
15
+ async function localServer() {
16
+ const override = process.env.PM_CLI_MCP_SERVER;
17
+ if (override) {
18
+ const target = override.startsWith("file:") ? fileURLToPath(override) : path.resolve(override);
19
+ await access(target);
20
+ return target;
23
21
  }
22
+ const repoRoot = path.resolve(here, "..", "..", "..");
23
+ const pluginRoot = path.resolve(here, "..");
24
+ const candidate = path.join(repoRoot, "dist", "mcp", "server.js");
24
25
  try {
25
- return new URL(target).protocol.length > 0;
26
+ const [repo, plugin] = await Promise.all([
27
+ readFile(path.join(repoRoot, "package.json"), "utf8").then(JSON.parse),
28
+ readFile(path.join(pluginRoot, "package.json"), "utf8").then(JSON.parse),
29
+ ]);
30
+ if (repo.name !== "@unbrained/pm-cli" || repo.version !== plugin.version ||
31
+ plugin.dependencies?.[repo.name] !== repo.version) return null;
32
+ await access(candidate);
33
+ return candidate;
26
34
  } catch {
27
- return false;
28
- }
29
- }
30
-
31
- function isMissingLaunchModule(error) {
32
- return typeof error === "object" && error !== null && error.code === "ERR_MODULE_NOT_FOUND";
33
- }
34
-
35
- async function importLaunchModule(target) {
36
- try {
37
- return await import(target);
38
- } catch (error) {
39
- if (isMissingLaunchModule(error)) {
40
- return null;
41
- }
42
- throw error;
43
- }
44
- }
45
-
46
- async function locateRepoServer() {
47
- let cursor = path.dirname(fileURLToPath(import.meta.url));
48
- for (let depth = 0; depth < 10; depth += 1) {
49
- const candidate = path.join(cursor, "dist", "mcp", "server.js");
50
- if (await canRead(candidate)) {
51
- return candidate;
52
- }
53
- const parent = path.dirname(cursor);
54
- if (parent === cursor) {
55
- return null;
56
- }
57
- cursor = parent;
35
+ return null;
58
36
  }
59
- return null;
60
37
  }
61
38
 
62
- async function launchServer(target) {
63
- if (!target) {
64
- return false;
65
- }
66
- if (hasImportProtocol(target)) {
67
- let url;
68
- try {
69
- url = new URL(target);
70
- } catch {
71
- return false;
72
- }
73
- if (url.protocol === "file:") {
74
- let filePath;
75
- try {
76
- filePath = fileURLToPath(url);
77
- } catch {
78
- return false;
79
- }
80
- if (!(await canRead(filePath))) {
81
- return false;
82
- }
83
- }
84
- const server = await importLaunchModule(target);
85
- if (!server) {
86
- return false;
87
- }
88
- server.startMcpServer();
89
- return true;
90
- }
91
- if (!(await canRead(target))) {
92
- return false;
93
- }
94
- const server = await importLaunchModule(pathToFileURL(path.resolve(target)).href);
95
- if (!server) {
96
- return false;
97
- }
98
- server.startMcpServer();
99
- return true;
100
- }
101
-
102
- if (!(await launchServer(process.env.PM_CLI_MCP_SERVER)) && !(await launchServer(await locateRepoServer()))) {
103
- const npxCommand = process.platform === "win32" ? "npx.cmd" : "npx";
104
- const child = spawn(npxCommand, ["-y", "--package=@unbrained/pm-cli@latest", "pm-mcp"], { stdio: "inherit", env: process.env });
105
- child.on("exit", (code, signal) => {
106
- if (signal) {
107
- process.kill(process.pid, signal);
108
- return;
109
- }
110
- process.exit(code ?? 1);
111
- });
112
- }
39
+ const server = (await localServer()) ?? (await resolvePluginRuntime()).server;
40
+ const child = spawn(process.execPath, [server], { stdio: "inherit", env: process.env });
41
+ child.on("error", (error) => {
42
+ console.error(`pm-mcp plugin runtime failed: ${error.message}`);
43
+ process.exitCode = 1;
44
+ });
45
+ child.on("exit", (code, signal) => {
46
+ if (signal) {
47
+ process.kill(process.pid, signal);
48
+ } else {
49
+ process.exitCode = code ?? 1;
50
+ }
51
+ });