@unbrained/pm-cli 2026.5.10 → 2026.5.12

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 (172) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +3 -116
  3. package/CHANGELOG.md +14 -0
  4. package/PRD.md +11 -11
  5. package/README.md +20 -2
  6. package/dist/cli/argv-utils.d.ts +5 -0
  7. package/dist/cli/argv-utils.js +34 -0
  8. package/dist/cli/argv-utils.js.map +1 -0
  9. package/dist/cli/bootstrap-args.d.ts +15 -0
  10. package/dist/cli/bootstrap-args.js +211 -0
  11. package/dist/cli/bootstrap-args.js.map +1 -1
  12. package/dist/cli/commander-usage.js +109 -3
  13. package/dist/cli/commander-usage.js.map +1 -1
  14. package/dist/cli/commands/completion.js +7 -3
  15. package/dist/cli/commands/completion.js.map +1 -1
  16. package/dist/cli/commands/contracts.d.ts +19 -0
  17. package/dist/cli/commands/contracts.js +40 -2
  18. package/dist/cli/commands/contracts.js.map +1 -1
  19. package/dist/cli/commands/create.js +112 -51
  20. package/dist/cli/commands/create.js.map +1 -1
  21. package/dist/cli/commands/docs.js +9 -2
  22. package/dist/cli/commands/docs.js.map +1 -1
  23. package/dist/cli/commands/extension.d.ts +12 -3
  24. package/dist/cli/commands/extension.js +421 -69
  25. package/dist/cli/commands/extension.js.map +1 -1
  26. package/dist/cli/commands/files.js +9 -2
  27. package/dist/cli/commands/files.js.map +1 -1
  28. package/dist/cli/commands/index.d.ts +1 -0
  29. package/dist/cli/commands/index.js +1 -0
  30. package/dist/cli/commands/index.js.map +1 -1
  31. package/dist/cli/commands/init.d.ts +2 -0
  32. package/dist/cli/commands/init.js +21 -1
  33. package/dist/cli/commands/init.js.map +1 -1
  34. package/dist/cli/commands/metadata-normalizers.d.ts +4 -0
  35. package/dist/cli/commands/metadata-normalizers.js +37 -0
  36. package/dist/cli/commands/metadata-normalizers.js.map +1 -0
  37. package/dist/cli/commands/reindex.js +173 -135
  38. package/dist/cli/commands/reindex.js.map +1 -1
  39. package/dist/cli/commands/search.js +16 -6
  40. package/dist/cli/commands/search.js.map +1 -1
  41. package/dist/cli/commands/test.js +23 -8
  42. package/dist/cli/commands/test.js.map +1 -1
  43. package/dist/cli/commands/update.js +70 -39
  44. package/dist/cli/commands/update.js.map +1 -1
  45. package/dist/cli/commands/upgrade.d.ts +63 -0
  46. package/dist/cli/commands/upgrade.js +260 -0
  47. package/dist/cli/commands/upgrade.js.map +1 -0
  48. package/dist/cli/error-guidance.d.ts +9 -1
  49. package/dist/cli/error-guidance.js +147 -6
  50. package/dist/cli/error-guidance.js.map +1 -1
  51. package/dist/cli/guide-topics.js +18 -16
  52. package/dist/cli/guide-topics.js.map +1 -1
  53. package/dist/cli/help-content.js +42 -2
  54. package/dist/cli/help-content.js.map +1 -1
  55. package/dist/cli/help-json-payload.js +11 -1
  56. package/dist/cli/help-json-payload.js.map +1 -1
  57. package/dist/cli/main.js +69 -6
  58. package/dist/cli/main.js.map +1 -1
  59. package/dist/cli/register-setup.js +174 -82
  60. package/dist/cli/register-setup.js.map +1 -1
  61. package/dist/cli/telemetry-flush.d.ts +2 -0
  62. package/dist/cli/telemetry-flush.js +4 -0
  63. package/dist/cli/telemetry-flush.js.map +1 -0
  64. package/dist/cli.js +1 -2
  65. package/dist/cli.js.map +1 -1
  66. package/dist/core/extensions/extension-types.d.ts +72 -0
  67. package/dist/core/extensions/extension-types.js +24 -0
  68. package/dist/core/extensions/extension-types.js.map +1 -1
  69. package/dist/core/extensions/loader.d.ts +1 -0
  70. package/dist/core/extensions/loader.js +766 -7
  71. package/dist/core/extensions/loader.js.map +1 -1
  72. package/dist/core/lock/lock.js +2 -0
  73. package/dist/core/lock/lock.js.map +1 -1
  74. package/dist/core/packages/manifest.d.ts +13 -0
  75. package/dist/core/packages/manifest.js +139 -0
  76. package/dist/core/packages/manifest.js.map +1 -0
  77. package/dist/core/sentry/instrument.d.ts +15 -0
  78. package/dist/core/sentry/instrument.js +35 -3
  79. package/dist/core/sentry/instrument.js.map +1 -1
  80. package/dist/core/shared/constants.js +20 -0
  81. package/dist/core/shared/constants.js.map +1 -1
  82. package/dist/core/shared/errors.d.ts +8 -0
  83. package/dist/core/shared/errors.js.map +1 -1
  84. package/dist/core/shared/levenshtein.d.ts +1 -0
  85. package/dist/core/shared/levenshtein.js +37 -0
  86. package/dist/core/shared/levenshtein.js.map +1 -0
  87. package/dist/core/store/paths.js +34 -1
  88. package/dist/core/store/paths.js.map +1 -1
  89. package/dist/core/store/settings.js +210 -1
  90. package/dist/core/store/settings.js.map +1 -1
  91. package/dist/core/telemetry/runtime.d.ts +1 -0
  92. package/dist/core/telemetry/runtime.js +102 -3
  93. package/dist/core/telemetry/runtime.js.map +1 -1
  94. package/dist/mcp/server.js +11 -2
  95. package/dist/mcp/server.js.map +1 -1
  96. package/dist/sdk/cli-contracts.d.ts +38 -17
  97. package/dist/sdk/cli-contracts.js +387 -35
  98. package/dist/sdk/cli-contracts.js.map +1 -1
  99. package/dist/sdk/index.d.ts +13 -1
  100. package/dist/sdk/index.js +9 -1
  101. package/dist/sdk/index.js.map +1 -1
  102. package/dist/types.d.ts +41 -0
  103. package/dist/types.js.map +1 -1
  104. package/docs/ARCHITECTURE.md +1 -1
  105. package/docs/CLAUDE_CODE_PLUGIN.md +39 -0
  106. package/docs/COMMANDS.md +14 -1
  107. package/docs/EXTENSIONS.md +782 -12
  108. package/docs/MIGRATION_CLI_SIMPLIFICATION.md +64 -0
  109. package/docs/QUICKSTART.md +10 -2
  110. package/docs/README.md +4 -6
  111. package/docs/SDK.md +445 -0
  112. package/docs/examples/ci/github-actions-pm-extension-gate.yml +53 -0
  113. package/docs/examples/ci/gitlab-ci-pm-extension-gate.yml +41 -0
  114. package/docs/examples/ci/jenkins-pm-extension-gate.Jenkinsfile +45 -0
  115. package/docs/examples/policy-restricted-extension/README.md +74 -0
  116. package/docs/examples/policy-restricted-extension/index.js +21 -0
  117. package/docs/examples/policy-restricted-extension/manifest.json +21 -0
  118. package/docs/examples/policy-restricted-extension/package.json +8 -0
  119. package/docs/examples/sdk-app-embedding/README.md +39 -0
  120. package/docs/examples/sdk-app-embedding/package.json +9 -0
  121. package/docs/examples/sdk-app-embedding/run-embedded-pm.mjs +61 -0
  122. package/docs/examples/sdk-contract-consumer/README.md +57 -0
  123. package/docs/examples/sdk-contract-consumer/inspect-contracts.mjs +47 -0
  124. package/docs/examples/sdk-contract-consumer/package.json +10 -0
  125. package/docs/examples/starter-extension/README.md +57 -42
  126. package/docs/examples/starter-extension/manifest.json +15 -0
  127. package/marketplace.json +3 -3
  128. package/package.json +5 -23
  129. package/packages/pm-beads/README.md +10 -0
  130. package/{.agents/pm → packages/pm-beads}/extensions/beads/index.js +24 -9
  131. package/packages/pm-beads/extensions/beads/index.ts +131 -0
  132. package/packages/pm-beads/package.json +17 -0
  133. package/packages/pm-todos/README.md +11 -0
  134. package/{.agents/pm → packages/pm-todos}/extensions/todos/index.js +24 -9
  135. package/packages/pm-todos/extensions/todos/index.ts +149 -0
  136. package/{.agents/pm → packages/pm-todos}/extensions/todos/runtime.js +1 -1
  137. package/{.agents/pm → packages/pm-todos}/extensions/todos/runtime.ts +1 -1
  138. package/packages/pm-todos/package.json +17 -0
  139. package/plugins/pm-cli-claude/.claude-plugin/plugin.json +2 -2
  140. package/plugins/pm-cli-claude/README.md +54 -14
  141. package/plugins/pm-cli-claude/agents/pm-delivery-chain.md +88 -0
  142. package/plugins/pm-cli-claude/agents/pm-triage-agent.md +83 -0
  143. package/plugins/pm-cli-claude/agents/pm-verification-agent.md +88 -0
  144. package/plugins/pm-cli-claude/hooks/session-start.mjs +35 -21
  145. package/.agents/pm/extensions/.managed-extensions.json +0 -42
  146. package/.agents/skills/HARNESS_COMPATIBILITY.md +0 -45
  147. package/.agents/skills/README.md +0 -21
  148. package/.agents/skills/pm-developer/SKILL.md +0 -73
  149. package/.agents/skills/pm-developer/references/COMMAND_PLAYBOOK.md +0 -48
  150. package/.agents/skills/pm-developer/references/PROMPTS.md +0 -17
  151. package/.agents/skills/pm-extensions/SKILL.md +0 -57
  152. package/.agents/skills/pm-extensions/references/LIFECYCLE.md +0 -40
  153. package/.agents/skills/pm-extensions/references/TROUBLESHOOTING.md +0 -25
  154. package/.agents/skills/pm-sdk/SKILL.md +0 -50
  155. package/.agents/skills/pm-sdk/references/INTEGRATION_CHECKLIST.md +0 -31
  156. package/.agents/skills/pm-sdk/references/PROMPTS.md +0 -13
  157. package/.agents/skills/pm-user/SKILL.md +0 -59
  158. package/.agents/skills/pm-user/references/PROMPTS.md +0 -17
  159. package/.agents/skills/pm-user/references/WORKFLOWS.md +0 -35
  160. package/.pi/README.md +0 -26
  161. package/.pi/extensions/pm-cli/index.js +0 -147
  162. package/.pi/prompts/pm-workflow.md +0 -5
  163. package/.pi/skills/pm-native/SKILL.md +0 -40
  164. package/.pi/skills/pm-release/SKILL.md +0 -35
  165. package/dist/pi/native.d.ts +0 -5
  166. package/dist/pi/native.js +0 -183
  167. package/dist/pi/native.js.map +0 -1
  168. package/docs/PI_PACKAGE.md +0 -56
  169. /package/{.agents/pm → packages/pm-beads}/extensions/beads/manifest.json +0 -0
  170. /package/{.agents/pm → packages/pm-beads}/extensions/beads/runtime.js +0 -0
  171. /package/{.agents/pm → packages/pm-beads}/extensions/beads/runtime.ts +0 -0
  172. /package/{.agents/pm → packages/pm-todos}/extensions/todos/manifest.json +0 -0
@@ -1,40 +0,0 @@
1
- # Extension Lifecycle Recipes
2
-
3
- ## Inspect Current State
4
-
5
- ```bash
6
- pm extension explore --project
7
- pm extension manage --detail summary
8
- pm extension doctor --detail deep
9
- ```
10
-
11
- ## Install and Activate
12
-
13
- ```bash
14
- pm extension install <target> --project
15
- pm extension activate <target> --project
16
- pm extension doctor --detail summary
17
- ```
18
-
19
- ## Adopt Existing Extensions
20
-
21
- ```bash
22
- pm extension adopt <name> --project
23
- pm extension adopt-all --project
24
- pm extension manage --detail summary
25
- ```
26
-
27
- ## Deactivate / Uninstall
28
-
29
- ```bash
30
- pm extension deactivate <target> --project
31
- pm extension uninstall <target> --project
32
- pm extension doctor --detail deep
33
- ```
34
-
35
- ## Contract Checks
36
-
37
- ```bash
38
- pm contracts --runtime-only --availability-only
39
- pm contracts --command extension --flags-only
40
- ```
@@ -1,25 +0,0 @@
1
- # Extension Troubleshooting
2
-
3
- ## Common Diagnostic Sequence
4
-
5
- 1. `pm extension explore --project`
6
- 2. `pm extension manage --detail summary`
7
- 3. `pm extension doctor --detail deep --trace`
8
- 4. `pm contracts --runtime-only --availability-only`
9
-
10
- ## Symptoms and Checks
11
-
12
- - **Command not visible**
13
- - Confirm extension is managed and active.
14
- - Confirm capability includes `commands`.
15
- - Check `pm contracts` action availability.
16
-
17
- - **Schema mismatch**
18
- - Confirm capability includes `schema`.
19
- - Re-run doctor with `--detail deep --trace`.
20
- - Validate runtime-only contracts output.
21
-
22
- - **Unexpected behavior after updates**
23
- - Check registration precedence with manage/doctor.
24
- - Run with `--no-extensions` to isolate core behavior.
25
- - Re-activate extension after fixing manifest or entry path.
@@ -1,50 +0,0 @@
1
- ---
2
- name: pm-sdk
3
- description: Implements pm-cli integrations using @unbrained/pm-cli/sdk and runtime contracts. Use when authoring extensions, wrappers, or automation that must stay aligned with command/action schema changes.
4
- license: MIT
5
- compatibility: Requires Node.js and access to pm contracts output for runtime parity checks.
6
- metadata:
7
- owner: unbrained
8
- domain: pm-cli
9
- scope: sdk-integration
10
- ---
11
-
12
- # pm SDK Skill
13
-
14
- Use this skill when integrating against `@unbrained/pm-cli/sdk` or validating external wrappers.
15
-
16
- ## Quick Start
17
-
18
- ```bash
19
- pm guide sdk
20
- pm contracts --schema-only
21
- pm contracts --runtime-only --availability-only
22
- pm contracts --command <command> --flags-only
23
- ```
24
-
25
- ## Integration Workflow
26
-
27
- 1. Capture current runtime schema and command contracts.
28
- 2. Map integration payload fields to contract keys.
29
- 3. Implement with SDK exports (no internal `src/core/...` imports).
30
- 4. Validate command/action availability in runtime-only mode.
31
- 5. Add regression tests for schema-bound behavior.
32
-
33
- ## Workflow Prompts
34
-
35
- ### Prompt: Build New Integration
36
-
37
- `Implement <integration> using @unbrained/pm-cli/sdk and pm contracts output as the source of truth. Add tests that fail when required command/action fields drift.`
38
-
39
- ### Prompt: Contract Drift Investigation
40
-
41
- `Compare integration assumptions with current pm contracts output, identify drift, and patch mapping logic and tests to restore parity.`
42
-
43
- ### Prompt: Extension Authoring
44
-
45
- `Author extension registration using defineExtension and declared capabilities only, then verify activation and command availability with pm contracts.`
46
-
47
- ## Progressive Disclosure References
48
-
49
- - [Integration checklist](references/INTEGRATION_CHECKLIST.md)
50
- - [SDK prompt templates](references/PROMPTS.md)
@@ -1,31 +0,0 @@
1
- # SDK Integration Checklist
2
-
3
- ## Contract Capture
4
-
5
- ```bash
6
- pm contracts --schema-only --json
7
- pm contracts --runtime-only --availability-only --json
8
- pm contracts --command <command> --flags-only --json
9
- ```
10
-
11
- ## Implementation Rules
12
-
13
- - Use `@unbrained/pm-cli/sdk` exports only.
14
- - Do not import internal runtime modules from `src/core/...`.
15
- - Keep action/flag mappings derived from `pm contracts` outputs.
16
- - Handle extension-unavailable states through availability metadata.
17
-
18
- ## Validation
19
-
20
- ```bash
21
- pnpm build
22
- node scripts/run-tests.mjs test -- <targeted sdk/integration tests>
23
- node scripts/run-tests.mjs coverage
24
- ```
25
-
26
- ## Release Readiness
27
-
28
- ```bash
29
- node scripts/release/docs-skills-gate.mjs
30
- node scripts/release/run-gates.mjs --telemetry-mode best-effort
31
- ```
@@ -1,13 +0,0 @@
1
- # SDK Prompt Templates
2
-
3
- ## Runtime Contract Mapping
4
-
5
- `Map this integration request to pm contracts output first, then generate implementation steps keyed to command flags and action schema fields.`
6
-
7
- ## Extension Capability Design
8
-
9
- `Design extension capabilities for <feature> using defineExtension. Include only needed capabilities and provide a verification command list for activation and contracts checks.`
10
-
11
- ## Wrapper Parity Check
12
-
13
- `Audit wrapper action/command mapping parity against current pm contracts output and report any missing or stale fields with patch recommendations.`
@@ -1,59 +0,0 @@
1
- ---
2
- name: pm-user
3
- description: Guides user- and operator-facing pm-cli workflows for planning, triage, prioritization, and task lifecycle management with minimal token usage. Use when routing requests into pm items without implementing code changes.
4
- license: MIT
5
- compatibility: Works in terminal-based agent harnesses that execute pm CLI commands.
6
- metadata:
7
- owner: unbrained
8
- domain: pm-cli
9
- scope: operator-workflow
10
- ---
11
-
12
- # pm User Skill
13
-
14
- Use this skill for planning and coordination work where the main output is clean tracker state.
15
-
16
- ## Quick Start
17
-
18
- ```bash
19
- pm guide quickstart
20
- pm context --limit 10
21
- pm search "<request keywords>" --limit 10
22
- pm list-open --limit 20
23
- pm list-in-progress --limit 20
24
- ```
25
-
26
- ## Primary Use Cases
27
-
28
- - Intake a new request and decide whether an item already exists.
29
- - Create parent lineage (`Epic` -> `Feature` -> `Task`) for net-new scope.
30
- - Prioritize and schedule work with deterministic metadata.
31
- - Maintain clear ownership and handoff notes.
32
-
33
- ## Workflow Prompts
34
-
35
- ### Prompt: New Request Triage
36
-
37
- `Triage this request using pm only. Reuse an existing item if relevant; otherwise create canonical parent lineage and a scoped child item with duplicate-check evidence.`
38
-
39
- ### Prompt: Prioritization Sweep
40
-
41
- `Review open and in-progress items, normalize priority/status metadata, and leave append-only notes explaining why any prioritization changed.`
42
-
43
- ### Prompt: Handoff Preparation
44
-
45
- `Prepare handoff for <ID>: summarize state in comments, ensure linked files/tests/docs are complete, and release claim when ready.`
46
-
47
- ## Deterministic Metadata Commands
48
-
49
- ```bash
50
- pm update <ID> --description "..." --ac "..." --estimate 60
51
- pm update <ID> --deadline +2d --priority 1 --status open
52
- pm comments <ID> "Decision log: <why this status/priority>"
53
- pm notes <ID> --add "Context for next owner."
54
- ```
55
-
56
- ## Progressive Disclosure References
57
-
58
- - [Triage and planning workflows](references/WORKFLOWS.md)
59
- - [Operator prompt templates](references/PROMPTS.md)
@@ -1,17 +0,0 @@
1
- # Operator Prompt Templates
2
-
3
- ## Triage
4
-
5
- `Find the canonical pm item for this request. Show duplicate-check commands, then either reuse and update the item or create parent lineage + child item with explicit rationale.`
6
-
7
- ## Schedule
8
-
9
- `Apply deterministic scheduling metadata (status, priority, estimate, deadline) to <ID> and leave a comment explaining the prioritization decision.`
10
-
11
- ## Handoff
12
-
13
- `Prepare <ID> for handoff: append current state, blockers, and next actions; release the claim when handoff is complete.`
14
-
15
- ## Closure Readiness
16
-
17
- `Validate whether <ID> is close-ready by checking acceptance criteria, linked files/tests/docs, and latest verification evidence.`
@@ -1,35 +0,0 @@
1
- # User and Operator Workflows
2
-
3
- ## Intake Workflow
4
-
5
- 1. Query current context:
6
-
7
- ```bash
8
- pm context --limit 10
9
- pm search "<keywords>" --limit 10
10
- pm list-open --limit 20
11
- pm list-in-progress --limit 20
12
- ```
13
-
14
- 2. If existing item matches, reuse and update it.
15
- 3. If no match exists, create parent lineage then child item.
16
- 4. Add duplicate-check evidence in comments at creation time.
17
-
18
- ## Claim and Ownership Workflow
19
-
20
- ```bash
21
- pm claim <ID>
22
- pm update <ID> --status in_progress --message "Start work"
23
- pm comments <ID> "Owner update: <state>"
24
- pm release <ID>
25
- ```
26
-
27
- ## Audit-Friendly Collaboration
28
-
29
- For non-owner append-only collaboration:
30
-
31
- ```bash
32
- pm comments <ID> --add "audit comment" --allow-audit-comment
33
- pm notes <ID> --add "audit note" --allow-audit-comment
34
- pm update <ID> --dep "id=<id>,kind=related,author=<author>,created_at=now" --allow-audit-dep-update
35
- ```
package/.pi/README.md DELETED
@@ -1,26 +0,0 @@
1
- # pm CLI Pi Package
2
-
3
- This directory is the installable Pi package payload for `@unbrained/pm-cli`.
4
-
5
- Install from npm after publish:
6
-
7
- ```bash
8
- pi install npm:@unbrained/pm-cli
9
- ```
10
-
11
- For local development from a checkout:
12
-
13
- ```bash
14
- pnpm build
15
- pi install -l .
16
- # or one-shot
17
- pi -e .
18
- ```
19
-
20
- Resources exposed by `package.json`:
21
-
22
- - `.pi/extensions/pm-cli/index.js` — native Pi extension registering the `pm` tool and slash commands.
23
- - `.pi/skills/*` — Pi skills for native pm workflows and release validation.
24
- - `.pi/prompts/*` — prompt templates for pm-tracked work.
25
-
26
- The extension imports the built package from `dist/`, so run `pnpm build` before local install or before publishing.
@@ -1,147 +0,0 @@
1
- import { PM_TOOL_ACTIONS } from "../../../dist/sdk/cli-contracts.js";
2
- import { runNativePmAction } from "../../../dist/pi/native.js";
3
-
4
- const PM_PI_TOOL_PARAMETERS_SCHEMA = {
5
- type: "object",
6
- additionalProperties: true,
7
- required: ["action"],
8
- description: "Parameters for the native pm Pi tool. Extra properties are forwarded to the selected pm action.",
9
- properties: {
10
- action: {
11
- type: "string",
12
- description: "pm action to execute, for example context, search, get, create, update, files, docs, test, validate, or close-task.",
13
- },
14
- id: { type: "string", description: "pm item id for item-scoped actions." },
15
- text: { type: "string", description: "Text payload for comment-like actions or close reasons." },
16
- title: { type: "string", description: "Title for create actions." },
17
- description: { type: "string", description: "Description for create/update actions." },
18
- query: { type: "string", description: "Search query text." },
19
- limit: { type: "string", description: "Result limit. Numeric strings are accepted." },
20
- author: { type: "string", description: "Explicit pm author for mutations." },
21
- path: { type: "string", description: "pm data path override or linked file path, depending on action." },
22
- scope: { type: "string", description: "Link scope such as project." },
23
- command: { type: "string", description: "Linked test command or shell completion target, depending on action." },
24
- options: {
25
- type: "object",
26
- additionalProperties: true,
27
- description: "Advanced command options object forwarded to the selected pm action.",
28
- },
29
- },
30
- };
31
-
32
- function contentText(result) {
33
- if (typeof result === "string") return result;
34
- return JSON.stringify(result, null, 2);
35
- }
36
-
37
- function errorDetails(error) {
38
- return {
39
- message: error instanceof Error ? error.message : String(error),
40
- code: typeof error?.exitCode === "number" ? error.exitCode : 1,
41
- };
42
- }
43
-
44
- export function createPmToolDefinition() {
45
- return {
46
- name: "pm",
47
- label: "pm",
48
- description:
49
- "Use pm natively from Pi without shelling out to the pm CLI. Supports pm project context, search, lifecycle mutations, links, tests, validation, extension management, templates, calendar, and audit workflows.",
50
- promptSnippet: "Run native pm project-management operations without bash or the pm CLI.",
51
- promptGuidelines: [
52
- "Use the pm tool instead of bash pm commands for project-management operations when this tool is available.",
53
- "Use pm action=context/list-open/list-in-progress/search before creating new work items.",
54
- "For mutations, set author explicitly and link changed files/tests/docs through pm actions before closing work.",
55
- ],
56
- parameters: PM_PI_TOOL_PARAMETERS_SCHEMA,
57
- async execute(_toolCallId, params, _signal, onUpdate, ctx) {
58
- onUpdate?.({ content: [{ type: "text", text: `Running native pm action: ${params.action}` }] });
59
- try {
60
- const result = await runNativePmAction({ cwd: ctx?.cwd, ...params });
61
- return {
62
- content: [{ type: "text", text: contentText(result) }],
63
- details: { ok: true, action: params.action, result, native: true },
64
- };
65
- } catch (error) {
66
- const details = errorDetails(error);
67
- throw new Error(`pm ${params.action ?? "action"} failed: ${details.message}`);
68
- }
69
- },
70
- };
71
- }
72
-
73
- export function registerPmCommands(pi) {
74
- pi.registerCommand("pm-context", {
75
- description: "Show pm context snapshot using the native pm integration",
76
- handler: async (args, ctx) => {
77
- const limit = args?.trim() || "10";
78
- const result = await runNativePmAction({ cwd: ctx.cwd, action: "context", limit, json: false });
79
- ctx.ui.notify(contentText(result), "info");
80
- },
81
- });
82
-
83
- pi.registerCommand("pm-start", {
84
- description: "Start/claim a pm item: /pm-start <id>",
85
- handler: async (args, ctx) => {
86
- const id = args?.trim();
87
- if (!id) return ctx.ui.notify("Usage: /pm-start <id>", "error");
88
- const result = await runNativePmAction({ cwd: ctx.cwd, action: "start-task", id, author: "pi-agent" });
89
- ctx.ui.notify(contentText(result), "success");
90
- },
91
- });
92
-
93
- pi.registerCommand("pm-close", {
94
- description: "Close and release a pm item: /pm-close <id> <reason>",
95
- handler: async (args, ctx) => {
96
- const [id, ...reasonParts] = (args ?? "").trim().split(/\s+/);
97
- const reason = reasonParts.join(" ");
98
- if (!id || !reason) return ctx.ui.notify("Usage: /pm-close <id> <reason>", "error");
99
- const result = await runNativePmAction({ cwd: ctx.cwd, action: "close-task", id, text: reason, author: "pi-agent", validateClose: "warn" });
100
- ctx.ui.notify(contentText(result), "success");
101
- },
102
- });
103
-
104
- pi.registerCommand("pm-actions", {
105
- description: "List native pm tool actions",
106
- handler: async (_args, ctx) => {
107
- ctx.ui.notify(PM_TOOL_ACTIONS.join(", "), "info");
108
- },
109
- });
110
- }
111
-
112
- function patchPmToolParametersInProviderPayload(payload) {
113
- if (!payload || typeof payload !== "object" || !Array.isArray(payload.tools)) {
114
- return undefined;
115
- }
116
- let changed = false;
117
- const tools = payload.tools.map((tool) => {
118
- if (!tool || typeof tool !== "object") {
119
- return tool;
120
- }
121
- if (tool.name === "pm") {
122
- const parameters = tool.parameters;
123
- if (!parameters || parameters.type !== "object") {
124
- changed = true;
125
- return { ...tool, parameters: PM_PI_TOOL_PARAMETERS_SCHEMA };
126
- }
127
- }
128
- if (tool.function?.name === "pm") {
129
- const parameters = tool.function.parameters;
130
- if (!parameters || parameters.type !== "object") {
131
- changed = true;
132
- return { ...tool, function: { ...tool.function, parameters: PM_PI_TOOL_PARAMETERS_SCHEMA } };
133
- }
134
- }
135
- return tool;
136
- });
137
- return changed ? { ...payload, tools } : undefined;
138
- }
139
-
140
- export default function pmCliPiExtension(pi) {
141
- pi.registerTool(createPmToolDefinition());
142
- pi.on("before_provider_request", (event) => patchPmToolParametersInProviderPayload(event.payload));
143
- registerPmCommands(pi);
144
- pi.on("session_start", async (_event, ctx) => {
145
- ctx.ui.setStatus?.("pm", "pm native");
146
- });
147
- }
@@ -1,5 +0,0 @@
1
- ---
2
- description: Start a pm-tracked implementation workflow using the native pm Pi tool.
3
- ---
4
-
5
- Use the native `pm` tool to orient, find an existing relevant item, claim it, link evidence, verify, and close/release only after acceptance criteria are met. Do not run `pm` via bash when the native tool is available.
@@ -1,40 +0,0 @@
1
- ---
2
- name: pm-native
3
- description: Native pm integration for Pi. Use when planning, claiming, updating, linking files/tests/docs, validating, or closing pm CLI work through the Pi pm tool instead of shelling out to the pm CLI.
4
- license: MIT
5
- compatibility: Pi coding-agent with the @unbrained/pm-cli Pi package installed.
6
- metadata:
7
- owner: unbrained
8
- domain: pm-cli
9
- scope: pi-native
10
- ---
11
-
12
- # pm Native for Pi
13
-
14
- Use the `pm` tool for project-management operations. Do not run `pm ...` through bash when the native tool is available.
15
-
16
- ## Required Loop
17
-
18
- 1. Orient before creating work:
19
- - `pm` action `context` with `limit: 10`
20
- - `pm` action `search` with relevant keywords
21
- - `pm` action `list-open` and `list-in-progress`
22
- 2. Claim work with action `claim` or `start-task`.
23
- 3. Mutate with explicit `author`.
24
- 4. Link evidence:
25
- - action `files` with `add`
26
- - action `docs` with `add`
27
- - action `test` with sandbox-safe commands
28
- 5. Verify with action `test`, `validate`, and project test commands when appropriate.
29
- 6. Close with action `close-task` or `close`, then release if needed.
30
-
31
- ## Common Tool Calls
32
-
33
- - Context: `{ "action": "context", "limit": 10 }`
34
- - Search: `{ "action": "search", "query": "pi native extension", "limit": 10 }`
35
- - Claim: `{ "action": "claim", "id": "pm-1234", "author": "pi-agent" }`
36
- - Link file: `{ "action": "files", "id": "pm-1234", "add": ["path=src/file.ts,scope=project,note=implementation"], "author": "pi-agent" }`
37
- - Add comment: `{ "action": "comments", "id": "pm-1234", "add": ["Evidence: build and tests passed"], "author": "pi-agent" }`
38
- - Close: `{ "action": "close-task", "id": "pm-1234", "text": "All acceptance criteria met", "author": "pi-agent", "validateClose": "warn" }`
39
-
40
- Use `pm guide` topics through action `guide` for deeper command docs.
@@ -1,35 +0,0 @@
1
- ---
2
- name: pm-release
3
- description: Release-readiness workflow for pm projects in Pi. Use when running final validation, coverage, package checks, GitHub checks, and closure evidence through the native pm integration.
4
- license: MIT
5
- compatibility: Pi coding-agent with the @unbrained/pm-cli Pi package installed.
6
- metadata:
7
- owner: unbrained
8
- domain: pm-cli
9
- scope: release
10
- ---
11
-
12
- # pm Release Workflow for Pi
13
-
14
- Use the native `pm` tool for tracker state and linked evidence. Use shell only for non-pm project build/test commands.
15
-
16
- ## Release Checklist
17
-
18
- 1. `pm` action `context` with `depth: "standard"`.
19
- 2. Run linked tests with `pm` action `test` and `run: true` for active work items.
20
- 3. Run validation with `pm` action `validate`, usually `checkResolution: true`, `checkHistoryDrift: true`, and relevant file checks.
21
- 4. Run package install/discovery smoke for Pi packages:
22
- - local: `pi install -l .` or `pi -e .`
23
- - npm after publish: `pi install npm:@unbrained/pm-cli`
24
- 5. Use `gh` only to inspect GitHub checks after pushing.
25
- 6. Add a `comments` evidence entry with exact command summaries.
26
- 7. Close/release the pm item with `close-task` once acceptance criteria are met.
27
-
28
- ## Evidence Format
29
-
30
- Record:
31
- - Changed package resources (`pi.extensions`, `pi.skills`, `pi.prompts`)
32
- - Native pm tool smoke result
33
- - Build/test/coverage result
34
- - Pi install smoke result
35
- - GitHub checks status
@@ -1,5 +0,0 @@
1
- import type { GlobalOptions } from "../core/shared/command-types.js";
2
- export type NativePmArgs = Record<string, unknown>;
3
- export declare function nativeGlobalOptions(args: NativePmArgs): GlobalOptions;
4
- export declare function nativeCommandOptions(args: NativePmArgs): Record<string, unknown>;
5
- export declare function runNativePmAction(args: NativePmArgs): Promise<unknown>;