@unbrained/pm-cli 2026.9.25 → 2026.9.26
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/.agents/skills/README.md +1 -0
- package/.agents/skills/pm-developer/SKILL.md +3 -0
- package/.agents/skills/pm-test-audit/LICENSE.txt +21 -0
- package/.agents/skills/pm-test-audit/SKILL.md +103 -0
- package/.agents/skills/pm-test-audit/references/AUDIT.md +54 -0
- package/.agents/skills/pm-test-audit/references/CAMPAIGN.md +47 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +12 -1
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli/schema/registration.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +111 -111
- package/dist/cli-bundle/chunks/{chunk-YDIGMRLZ.js → chunk-4ODHIX7N.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5AP67ZXH.js → chunk-FOTXRNY6.js} +39 -39
- package/dist/cli-bundle/chunks/{chunk-GAU55CWI.js → chunk-GRWPZR7F.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-3IB4THWX.js → chunk-HTHTX6E6.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-JDHWZYZU.js → chunk-IYN4MJ2C.js} +73 -73
- package/dist/cli-bundle/chunks/{chunk-YABJDOOX.js → chunk-MJWKR7YA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GOWZEBTH.js → chunk-QQD3VRMZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-COFQCKF4.js → chunk-SZQCHJI4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-P7ZSJOWH.js → chunk-TC74K7SS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-445ARBKY.js → chunk-TYJXMT3Q.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-25KTCTBL.js → chunk-U55RYT3I.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CZ3VJJEA.js → chunk-VMO4P5MX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-IZ7ZVTDE.js → register-list-query-426QTRET.js} +4 -4
- package/dist/cli-bundle/chunks/{register-mutation-IPAZTFDZ.js → register-mutation-FLI3HHMP.js} +4 -4
- package/dist/cli-bundle/chunks/{register-operations-APN33LNI.js → register-operations-TP7ZG4MK.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HPHIKG5U.js → register-setup-574SIVQZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-25BBHWMH.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KRIHJH5U.js → chunk-H3BI4EDO.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-HNHMK5JI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IXNNMP2R.js → chunk-XVBWZTU2.js} +11 -11
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +20 -20
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +45 -45
- 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 +8 -8
- package/dist/core/search/embedding-batches.d.ts +47 -15
- package/dist/core/search/embedding-batches.js +1 -1
- package/dist/core/search/eval-thresholds.d.ts +14 -0
- package/dist/core/search/eval-thresholds.js +2 -0
- package/dist/core/search/eval.d.ts +4 -1
- package/dist/core/search/eval.js +1 -1
- package/dist/core/search/http-client.d.ts +7 -0
- package/dist/core/search/http-client.js +1 -1
- package/dist/sdk/eval.d.ts +19 -17
- package/dist/sdk/eval.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/governance/reindex.d.ts +4 -1
- package/dist/sdk/governance/reindex.js +2 -2
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query.d.ts +3 -0
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/runtime/schema-preview.d.ts +2 -0
- package/dist/sdk/runtime/schema-preview.js +2 -0
- package/dist/sdk/runtime/schema.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +2 -1
- package/dist/sdk/runtime-primitives.js +1 -1
- package/docs/README.md +1 -0
- package/docs/RELEASING.md +5 -1
- package/docs/SEARCH_QUALITY.md +116 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- 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/package.json +1 -1
- 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/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-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-V2X37U6J.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Y2M4QLAA.js +0 -20
package/.agents/skills/README.md
CHANGED
|
@@ -24,6 +24,7 @@ it. `docs/COMMANDS.md` is ~29k tokens and `docs/SDK.md` is ~45k.
|
|
|
24
24
|
| Skill | Use when |
|
|
25
25
|
| --------------------------------- | ------------------------------------------------------ |
|
|
26
26
|
| [`pm-developer`](pm-developer/SKILL.md) | Changing code, docs, tests, or release gates |
|
|
27
|
+
| [`pm-test-audit`](pm-test-audit/SKILL.md) | Writing, reviewing, or auditing tests and their regression value |
|
|
27
28
|
| [`pm-user`](pm-user/SKILL.md) | Intake, triage, prioritization, planning, reporting |
|
|
28
29
|
| [`pm-extensions`](pm-extensions/SKILL.md) | Package and extension lifecycle and authoring |
|
|
29
30
|
| [`pm-sdk`](pm-sdk/SKILL.md) | Integrations, embedding, and domain packs on the SDK |
|
|
@@ -106,6 +106,9 @@ Always read the `omission_receipt` before treating a result as complete. See
|
|
|
106
106
|
|
|
107
107
|
## Verification Defaults
|
|
108
108
|
|
|
109
|
+
For test authoring, review, or cleanup, apply [pm-test-audit](../pm-test-audit/SKILL.md)
|
|
110
|
+
to preserve independent contracts while removing low-value duplication.
|
|
111
|
+
|
|
109
112
|
```bash
|
|
110
113
|
pnpm build
|
|
111
114
|
node scripts/run-tests.mjs test -- <targets>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenClaw Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pm-test-audit
|
|
3
|
+
description: Use when writing, changing, reviewing, or auditing pm-cli tests. Checks regression value, duplicate coverage, implementation coupling, and test-only production seams while preserving SDK contracts, sandbox isolation, and exact coverage gates.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Repository development with Node.js, pnpm, and the checkout-built pm CLI.
|
|
6
|
+
metadata:
|
|
7
|
+
owner: unbrained
|
|
8
|
+
domain: pm-cli
|
|
9
|
+
scope: test-quality
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# pm Test Audit
|
|
13
|
+
|
|
14
|
+
Tracker: [pm-xvibt6](../../pm/tasks/pm-xvibt6.toon).
|
|
15
|
+
Adapted from OpenClaw's [test-audit skill](https://github.com/openclaw/openclaw/blob/e0d80000067d224e93af6107ed093a21e046879f/.agents/skills/test-audit/SKILL.md);
|
|
16
|
+
upstream copyright and terms are in [LICENSE.txt](LICENSE.txt).
|
|
17
|
+
|
|
18
|
+
Use alongside [pm-developer](../pm-developer/SKILL.md). Project management is
|
|
19
|
+
context management: retain why a test exists, its contract owner, and the
|
|
20
|
+
regression evidence so the next audit need not rediscover them.
|
|
21
|
+
|
|
22
|
+
## Choose the Scope
|
|
23
|
+
|
|
24
|
+
- **Authoring:** apply the four questions below before adding or changing tests.
|
|
25
|
+
- **Audit:** read [audit evidence](references/AUDIT.md) before proposing removals.
|
|
26
|
+
- **Campaign:** also read [campaign procedure](references/CAMPAIGN.md) for a broad sweep.
|
|
27
|
+
|
|
28
|
+
Do not expand a focused request into a repository-wide deletion campaign.
|
|
29
|
+
|
|
30
|
+
## Four Questions Before Editing
|
|
31
|
+
|
|
32
|
+
1. What observable behavior, invariant, or independent contract does this prove?
|
|
33
|
+
2. What credible regression makes it fail? For a bug fix, demonstrate the intended
|
|
34
|
+
failure before the fix and success afterward with the same test and harness.
|
|
35
|
+
3. Why does existing coverage not catch it? Choose one primary owner at the
|
|
36
|
+
strongest useful boundary. An additional layer needs a distinct risk, such as
|
|
37
|
+
CLI parsing, MCP transport, persistence, or package installation. Extend a
|
|
38
|
+
table or shared fixture when the behavior and setup are already covered.
|
|
39
|
+
4. Does it demand a production export, flag, wrapper, or injection hook solely
|
|
40
|
+
to observe private details? Prefer exercising the real boundary. Published
|
|
41
|
+
`@unbrained/pm-cli/sdk/testing` helpers are public contracts, not automatically
|
|
42
|
+
disposable test-only seams.
|
|
43
|
+
|
|
44
|
+
Domain semantics belong in the SDK; thin CLI/MCP adapters need their own transport
|
|
45
|
+
proof, not copies of every SDK case. Read complete tests and production owners
|
|
46
|
+
before editing, plus relevant callers, neighboring tests, history, and scoped
|
|
47
|
+
`AGENTS.md`. Inspect actual dependency types in `node_modules`; do not guess APIs.
|
|
48
|
+
|
|
49
|
+
## Verification and Safety
|
|
50
|
+
|
|
51
|
+
Follow [Testing](../../../docs/TESTING.md) for the affected surface. Use the
|
|
52
|
+
repository runner, which isolates tracker roots and builds the checkout:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
node scripts/run-tests.mjs test -- <target>
|
|
56
|
+
node scripts/run-tests.mjs coverage
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- Never run tests against the real `.agents/pm`. Manual dogfood uses a temporary
|
|
60
|
+
workspace outside this checkout and its ancestor workspaces, with both
|
|
61
|
+
`PM_PATH` and `PM_GLOBAL_PATH` isolated. Clean up only directories you created.
|
|
62
|
+
- Do not edit source while a runner or build owns it. Negative controls and
|
|
63
|
+
pre-fix comparisons belong in an isolated copy/worktree with temporary
|
|
64
|
+
`PM_PATH` and `PM_GLOBAL_PATH` set for every direct stateful CLI command,
|
|
65
|
+
including linked-test metadata commands. A nested worktree alone does not
|
|
66
|
+
isolate tracker discovery. Keep these test roots separate from intentional
|
|
67
|
+
repository tracking below. Change the intended condition; unrelated setup
|
|
68
|
+
failures do not establish regression sensitivity.
|
|
69
|
+
- Keep canonical full-source coverage at **100/100/100/100**. Do not shrink the
|
|
70
|
+
denominator, add ignore directives, lower gates, or duplicate assertions to
|
|
71
|
+
recover a number. Restore meaningful behavioral proof when coverage drops.
|
|
72
|
+
- Mocks may isolate external boundaries; they must not implement the behavior
|
|
73
|
+
being tested. Use real temporary persistence when proving writes or recovery.
|
|
74
|
+
- Run relevant functional, integration, package, performance, and acceptance
|
|
75
|
+
gates according to the changed contract. A focused green run is not a full
|
|
76
|
+
suite result. [Quality evidence](../../../docs/QUALITY_EVIDENCE.md) defines the
|
|
77
|
+
bounded mutation gate; do not describe it as whole-repository mutation proof.
|
|
78
|
+
- Preserve static quality, docstring, security, release, and public-surface gates.
|
|
79
|
+
This skill does not grant exceptions to repository coding rules.
|
|
80
|
+
|
|
81
|
+
## PM Evidence and Handoff
|
|
82
|
+
|
|
83
|
+
Bootstrap and orient using root `AGENTS.md`; search all statuses before creating
|
|
84
|
+
work. Read the selected item's full metadata and history, follow omission
|
|
85
|
+
receipts, then claim/start only items actually being edited. Keep investigation
|
|
86
|
+
read-only until there is a justified change. Use typed relationships for real
|
|
87
|
+
ownership, dependencies, or verification; never manufacture graph depth.
|
|
88
|
+
|
|
89
|
+
Link files, docs, and sandbox-safe test commands through `pm`. Record retained
|
|
90
|
+
contracts, removed duplication, pre-fix failure and post-fix proof, commands and
|
|
91
|
+
results, and limitations. Reuse canonical follow-up items for product defects;
|
|
92
|
+
never delete a failing regression merely to make the suite green. Close with
|
|
93
|
+
structured evidence and release the claim, or return paused work to an appropriate
|
|
94
|
+
non-active state. Delivery and review follow the user's authorized scope and
|
|
95
|
+
[review loop](../../../docs/PR_REVIEW_LOOP.md).
|
|
96
|
+
|
|
97
|
+
For current command flags use command-specific help/contracts. Optional deeper
|
|
98
|
+
workflow guidance is available after installing guide-shell:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pm package install guide-shell --project
|
|
102
|
+
pm guide workflows --depth brief
|
|
103
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Evidence Before Removing a Test
|
|
2
|
+
|
|
3
|
+
Start with read-only discovery. Test count, runtime, coverage percentage, or a
|
|
4
|
+
suspicious name is a lead, not proof that a test is low-value.
|
|
5
|
+
|
|
6
|
+
## Candidates to Investigate
|
|
7
|
+
|
|
8
|
+
- Assertion-free probes, self-comparisons, or expected values calculated by the
|
|
9
|
+
same implementation under test.
|
|
10
|
+
- Copied export/manifest inventories or source-text checks without an independent
|
|
11
|
+
compatibility, packaging, security, or architecture contract.
|
|
12
|
+
- Private predicate, mock-call-shape, and wiring assertions that repeat stronger
|
|
13
|
+
observable behavior coverage.
|
|
14
|
+
- Identical scenarios across SDK, CLI, MCP, and packages without distinct
|
|
15
|
+
boundary failure modes; prefer a named keeper over another copy.
|
|
16
|
+
- Fixtures that pre-seed the receipt, ordering, admission, or callback result the
|
|
17
|
+
production owner should produce; persistence tests that never write anything.
|
|
18
|
+
- Tests that assert a flag was forwarded but never prove its promised behavior.
|
|
19
|
+
- Test-only production exports, globals, wrappers, dead branches, or injected
|
|
20
|
+
switches with no supported consumer contract.
|
|
21
|
+
- Negative controls that fail at an unrelated guard, and names claiming behavior
|
|
22
|
+
that their assertions never observe.
|
|
23
|
+
|
|
24
|
+
Read the complete test and production owner, trace non-test callers and relevant
|
|
25
|
+
callees, and inspect overlapping tests, CI routing, history, and configuration.
|
|
26
|
+
Do not assume no in-repo caller means a published SDK export is unused.
|
|
27
|
+
|
|
28
|
+
## Reasons to Retain
|
|
29
|
+
|
|
30
|
+
Keep independent public SDK, protocol, configuration, migration, storage,
|
|
31
|
+
security, platform, default, package/release, and generated cross-language
|
|
32
|
+
contracts. Observable ordering can be a contract. Static inspection can be the
|
|
33
|
+
cheapest independent architectural guard; ask whether it survives harmless
|
|
34
|
+
identifier refactoring. Slowness and use of mocks are not deletion criteria on
|
|
35
|
+
their own. A previously failing retained test may expose a product defect.
|
|
36
|
+
|
|
37
|
+
## Candidate Ledger
|
|
38
|
+
|
|
39
|
+
For each candidate, record:
|
|
40
|
+
|
|
41
|
+
| Evidence | Required detail |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Identity | Exact path and test/table row; production owner and callers |
|
|
44
|
+
| Failure | Credible regression the assertion can detect |
|
|
45
|
+
| Contract | Independent external obligation, or why none exists |
|
|
46
|
+
| Overlap | Named keeper and distinct behavior it still proves |
|
|
47
|
+
| Seam | Production change deletion would permit, or none |
|
|
48
|
+
| Decision | Retain, repair, consolidate, or delete, with rationale |
|
|
49
|
+
| Verification | Exact command, negative control where appropriate, and result |
|
|
50
|
+
|
|
51
|
+
Establish the keeper before removing duplicates. Remove private obsolete seams
|
|
52
|
+
only after caller and public-contract checks. Prefer simpler production code,
|
|
53
|
+
but do not use net lines deleted as a success quota. Avoid trivial one-use
|
|
54
|
+
wrappers or test helpers that merely mirror the implementation.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Broad Test Audit Campaign
|
|
2
|
+
|
|
3
|
+
Use only for an authorized broad sweep. Adapted from the upstream
|
|
4
|
+
[campaign procedure](https://github.com/openclaw/openclaw/blob/e0d80000067d224e93af6107ed093a21e046879f/.agents/skills/test-audit/CAMPAIGN.md).
|
|
5
|
+
|
|
6
|
+
1. **Pin a baseline.** Record the commit, test inventory, full-suite outcomes,
|
|
7
|
+
coverage, and existing failures in the canonical pm item. Baseline failures
|
|
8
|
+
are investigations, not permission to discard tests. Check all-status lineage
|
|
9
|
+
before creating follow-ups.
|
|
10
|
+
2. **Partition by owner.** Include SDK domains, CLI/MCP adapters, packages,
|
|
11
|
+
release scripts, plugins, and shared harnesses within the requested scope.
|
|
12
|
+
Assign each test one lane. If delegation is authorized, use read-only
|
|
13
|
+
discovery lanes first and a single integration owner for shared harnesses.
|
|
14
|
+
3. **Build the ledger.** Apply [audit evidence](AUDIT.md) to every declaration in
|
|
15
|
+
scope; distinguish table rows with different contracts. Mark retain, repair,
|
|
16
|
+
consolidate, or delete. Record uncovered/unread inventory explicitly instead
|
|
17
|
+
of claiming a complete sweep.
|
|
18
|
+
4. **Consolidate with proof.** Name and strengthen the keeper first. Preserve
|
|
19
|
+
real SDK behavior and distinct CLI/MCP serialization, error, lifecycle,
|
|
20
|
+
persistence, package, and release guarantees. A fake external service can be
|
|
21
|
+
useful; a mock implementing the production algorithm proves nothing.
|
|
22
|
+
5. **Integrate coherently.** Serialize shared build/harness edits, remove only
|
|
23
|
+
obsolete private seams, and update routing/inventory when required. Preserve
|
|
24
|
+
the canonical coverage denominator and every mandatory gate. Do not weaken
|
|
25
|
+
caps, thresholds, documentation requirements, or lint rules to pass.
|
|
26
|
+
6. **Check preservation independently.** Revisit each removed contract against
|
|
27
|
+
the keeper and current production boundary. Use targeted mutations or pre-fix
|
|
28
|
+
controls in an isolated copy with temporary `PM_PATH` and `PM_GLOBAL_PATH`
|
|
29
|
+
for every direct stateful CLI command to establish meaningful failure. Record exact
|
|
30
|
+
changed bytes, failure reason, restoration, and passing rerun. Never mutate
|
|
31
|
+
the working tree under a running test command.
|
|
32
|
+
7. **Handle product defects explicitly.** Track a real defect separately within
|
|
33
|
+
the coherent delivery, with failing-before/passing-after proof and the
|
|
34
|
+
repository's structured defect evidence. Reuse existing lineage; do not hide
|
|
35
|
+
unrelated repairs inside mass test deletion.
|
|
36
|
+
8. **Reconcile and verify.** Incorporate upstream changes without force-pushing
|
|
37
|
+
shared history. Reassess newly introduced contracts rather than blindly
|
|
38
|
+
preserving deletions. Run focused tests, full suite/coverage, static quality,
|
|
39
|
+
and affected acceptance/package/performance gates on the integrated tree.
|
|
40
|
+
9. **Hand off honestly.** Report baseline and final counts, covered lanes, named
|
|
41
|
+
keepers, production seams removed, regressions demonstrated, full commands,
|
|
42
|
+
results, and remaining risks. A review inventory is not a correctness
|
|
43
|
+
certificate. Follow the authorized PR workflow; unavailable reviewers are
|
|
44
|
+
unavailable evidence, not approval.
|
|
45
|
+
|
|
46
|
+
Update pm files/docs/tests/comments and durable learnings as evidence accrues.
|
|
47
|
+
Close only implemented work with structured results and release ownership.
|
|
@@ -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.26"
|
|
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.26",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "unbrained",
|
|
19
19
|
"url": "https://github.com/unbraind/pm-cli"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.9.26 - 2026-09-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Refuse unsupported schema dry-run flags before mutation ([pm-s74dca](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-s74dca.toon))
|
|
8
|
+
- Releases from the default branch are supported with analyzer evidence ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
|
|
9
|
+
|
|
10
|
+
### Other
|
|
11
|
+
|
|
12
|
+
- Adapt OpenClaw test-audit skill to pm SDK and repository test governance ([pm-xvibt6](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/tasks/pm-xvibt6.toon))
|
|
13
|
+
- Bound embedding requests, enforce retrieval floors, and protect schema previews ([pm-g0b88h](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/changesets/pm-g0b88h.toon))
|
|
14
|
+
|
|
3
15
|
## 2026.9.25 - 2026-09-25
|
|
4
16
|
|
|
5
17
|
### Fixed
|
|
@@ -350,7 +362,6 @@
|
|
|
350
362
|
- Metadata index rebuilds and mutations repeatedly scan an unindexed FTS identity column ([pm-gtw5zh](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-gtw5zh.toon))
|
|
351
363
|
- Read sessions emit invalid continuation identities from workspace activity rows ([pm-s8ybl9](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-s8ybl9.toon))
|
|
352
364
|
- Scale fixtures silently omit unregistered Story items from metadata reads ([pm-fx80w2](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-fx80w2.toon))
|
|
353
|
-
- Releases from the default branch are supported with analyzer evidence ([pm-u1baah](https://github.com/unbraind/pm-cli/blob/main/.agents/pm/issues/pm-u1baah.toon))
|
|
354
365
|
|
|
355
366
|
### Other
|
|
356
367
|
|
|
@@ -1,10 +1,10 @@
|
|
|
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]="507df40e-86e4-532b-8e84-3c5a3baad385")}catch(e2){}})();import{EXIT_CODE,PmCliError,readSettings,renderRowsAsCsv,renderRowsAsTable,resolvePmRoot}from"../sdk/runtime-primitives.js";import{renderPmCommandAliasMigrationHint,resolvePmCommandAlias}from"../sdk/cli-contracts.js";import{EVAL_QUERY_SET_SCHEMA_ID}from"../sdk/eval.js";import{applyContextIntentProjection}from"../sdk/context-intent-contracts.js";import{renderPmClosedDomainHelp}from"../sdk/agent/closed-domain-contracts.js";import{serializeNdjsonRows,serializeNdjsonStream}from"../sdk/output.js";import{listMutationEvents,subscribeMutationEventBatches,subscribeMutationEvents}from"../sdk/mutation-events.js";import{registerHistoryActivityCommand}from"./register-history-activity.js";import{registerHistoryMaintenanceCommands}from"./register-history-maintenance.js";import{runAggregate}from"./commands/query/aggregate.js";import{renderContextMarkdown,runContext,resolveContextOutputFormat}from"./commands/query/context.js";import{runEval}from"./commands/query/eval.js";import{runGet}from"./commands/query/get.js";import{runGraph}from"./commands/query/graph.js";import{runHistory}from"./commands/history/history.js";import{runList}from"./commands/query/list.js";import{LIST_COMMAND_DEFAULT_PROJECTIONS}from"../sdk/query/list.js";import{renderNextMarkdown,runNext,resolveNextOutputFormat}from"./commands/query/next.js";import{runSearch}from"./commands/query/search.js";import{addHiddenOption,collect,getGlobalOptions,normalizeAggregateOptions,normalizeContextOptions,normalizeListOptions,normalizeNextOptions,normalizeSearchKeywordsInput,normalizeSearchOptions,printError,printListJsonStream,printResult,setActiveCommandResult,writeStdout}from"./registration-helpers.js";function shouldRegisterListQueryCommand(commandName,commandFilter){if(!commandFilter||commandFilter.size===0){return true}if(commandName==="context"){return commandFilter.has("context")||commandFilter.has("ctx")}return commandFilter.has(commandName)}function parseListFormat(rawFormat){if(rawFormat===void 0){return void 0}if(typeof rawFormat!=="string"){throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized==="csv"||normalized==="table"||normalized==="json"||normalized==="ndjson"||normalized==="toon"){return normalized}throw new PmCliError("List --format must be one of csv|table|json|ndjson|toon",EXIT_CODE.USAGE)}function resolveReadCommandOutputFormat(commandLabel,rawFormat,globalOptions,allowNdjson=false){if(rawFormat===void 0){return globalOptions}if(typeof rawFormat!=="string"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}const normalized=rawFormat.trim().toLowerCase();if(normalized!=="json"&&(normalized!=="ndjson"||!allowNdjson)&&normalized!=="toon"){throw new PmCliError(`${commandLabel} --format must be one of ${allowNdjson?"json|ndjson|toon":"json|toon"}`,EXIT_CODE.USAGE)}if(globalOptions.json===true&&normalized==="toon"){throw new PmCliError(`${commandLabel} cannot combine --json with --format toon`,EXIT_CODE.USAGE)}return{...globalOptions,json:normalized==="json"||normalized==="ndjson"}}function applyDefaultListProjection(listOptions,commandName){if(LIST_COMMAND_DEFAULT_PROJECTIONS[commandName]==="brief"&&listOptions.includeBody!==true&&listOptions.compact!==true&&listOptions.brief!==true&&listOptions.full!==true&&listOptions.fields===void 0){listOptions.brief=true}}function registerContentAndGovernanceFilters(command){command.option("--has-notes","Show only items that have notes").option("--has-learnings","Show only items that have learnings").option("--has-files","Show only items that have linked files").option("--has-docs","Show only items that have linked docs").option("--has-tests","Show only items that have linked tests").option("--has-comments","Show only items that have comments").option("--has-deps","Show only items that have dependencies").option("--has-body","Show only items that have a non-empty body").option("--has-linked-command","Show only items whose linked tests carry a runnable command").option("--no-notes","Show only items that have no notes").option("--no-learnings","Show only items that have no learnings").option("--no-files","Show only items that have no linked files").option("--filter-files-missing","Alias for --no-files").option("--no-docs","Show only items that have no linked docs").option("--filter-docs-missing","Alias for --no-docs").option("--no-tests","Show only items that have no linked tests").option("--no-comments","Show only items that have no comments").option("--no-deps","Show only items that have no dependencies").option("--empty-body","Show only items with an empty body").option("--no-linked-command","Show only items whose linked tests carry no runnable command").option("--filter-reviewer-missing","Show only items missing reviewer").option("--filter-risk-missing","Show only items missing risk").option("--filter-confidence-missing","Show only items missing confidence").option("--filter-sprint-missing","Show only items missing sprint").option("--filter-release-missing","Show only items missing release")}const CANONICAL_LIST_STATUS_VARIANTS={draft:{name:"list-draft",dependencyBlocked:false},open:{name:"list-open",dependencyBlocked:false},in_progress:{name:"list-in-progress",dependencyBlocked:false},blocked:{name:"list-blocked",dependencyBlocked:true},closed:{name:"list-closed",dependencyBlocked:false},canceled:{name:"list-canceled",dependencyBlocked:false}};function resolveRegisteredListOutputContext(options,globalOptions){const streamMode=options.stream===true;const listFormat=parseListFormat(options.format);const tabular=listFormat==="csv"||listFormat==="table";const effectiveGlobal=listFormat==="json"||listFormat==="ndjson"||listFormat==="toon"?resolveReadCommandOutputFormat("List",options.format,globalOptions,true):globalOptions;if(streamMode&&!effectiveGlobal.json){throw new PmCliError("--stream requires --json output mode.",EXIT_CODE.USAGE)}if((tabular||listFormat==="ndjson")&&streamMode){throw new PmCliError("--format csv|table|ndjson cannot be combined with --stream.",EXIT_CODE.USAGE)}return{streamMode,listFormat,effectiveGlobal}}function renderRegisteredListResult(commandName,result,output){if(output.listFormat==="csv"||output.listFormat==="table"){setActiveCommandResult(result);const rows=result.items;const rendered=output.listFormat==="csv"?renderRowsAsCsv(rows):renderRowsAsTable(rows);if(!output.effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
|
|
2
2
|
`)}}else if(output.listFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows(result.items);if(!output.effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
|
|
3
3
|
`)}}else if(output.streamMode){printListJsonStream(commandName,result,output.effectiveGlobal)}else{printResult(result,output.effectiveGlobal)}}async function runRegisteredListCommand(params){const parsedGlobalOptions=getGlobalOptions(params.actionCommand);const globalOptions=params.aliasContract?{...parsedGlobalOptions,command:params.aliasContract.canonical}:parsedGlobalOptions;const startedAt=Date.now();if(params.aliasContract?.lifecycle==="deprecated"){const deprecationHints=await readSettings(resolvePmRoot(process.cwd(),globalOptions.path)).then(settings=>settings.ux.deprecation_hints);if(deprecationHints){printError(renderPmCommandAliasMigrationHint(params.aliasContract))}}const intentOptions=applyContextIntentProjection("list",params.options);const listOptions=normalizeListOptions(intentOptions);const selection=resolveRegisteredListSelection(params,listOptions);const{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}=selection;applyDefaultListProjection(listOptions,effectiveName);Object.assign(listOptions,{projectionCommand:effectiveName});if(effectiveExcludeTerminal)listOptions.excludeTerminal=true;listOptions.dependencyBlocked=effectiveDependencyBlocked;const output=resolveRegisteredListOutputContext(intentOptions,globalOptions);const result=await runList(effectiveDependencyBlocked?void 0:effectiveStatus,listOptions,globalOptions);renderRegisteredListResult("list",result,output);if(globalOptions.profile){printError(`profile:command=list took_ms=${Date.now()-startedAt}`)}}function resolveRegisteredListSelection(params,listOptions){let effectiveName=params.name;let effectiveStatus=params.status;let effectiveDependencyBlocked=params.dependencyBlocked===true;let effectiveExcludeTerminal=params.excludeTerminal===true;const requestedStatus=listOptions.status?.trim().toLowerCase();const requestedVariant=params.name==="list"&&requestedStatus!==void 0?CANONICAL_LIST_STATUS_VARIANTS[requestedStatus]:void 0;if(params.name==="list"){if(params.options.all===true||requestedStatus==="all"){effectiveName="list-all";effectiveExcludeTerminal=false;listOptions.status=void 0}else if(requestedStatus!==void 0&&requestedVariant!==void 0){effectiveName=requestedVariant.name;effectiveStatus=requestedStatus;effectiveDependencyBlocked=requestedVariant.dependencyBlocked;effectiveExcludeTerminal=false;listOptions.status=void 0}}if(effectiveName==="list-open"||effectiveName==="list-in-progress"){listOptions.lifecycleBucket=effectiveName==="list-open"?"open":"in_progress";effectiveStatus=void 0}return{effectiveName,effectiveStatus,effectiveDependencyBlocked,effectiveExcludeTerminal}}function registerListCommand(program,descriptor){const{name,description,status,excludeTerminal,allowStatusFilter,dependencyBlocked,aliasContract}=descriptor;const command=program.command(name,{hidden:aliasContract?.hidden===true}).description(description);if(allowStatusFilter){command.option("--status <value>","Filter by status (repeatable or comma-separated; matches any; all selects every status)",collect)}if(name==="list"){command.option("--all","Include every lifecycle status")}command.option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("list","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--type <value>","Filter by item type (repeatable or comma-separated; matches any)",collect).option("--tag <value>","Filter by tag (repeatable or comma-separated; matches any)",collect).option("--priority <value>","Filter by priority (repeatable or comma-separated; matches any)",collect).option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--today","Filter to items updated since local midnight today").option("--recent","Filter to items updated in the last 7 days").option("--updated-after <value>","Updated since ISO timestamp or signed relative (-2h/-7d for past); use last-window ISO").option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--ids <value>","Filter by explicit item IDs (comma-separated or repeatable)").option("--assignee <value>","Filter by assignee",collect).option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--parent <value>","Filter by parent item ID").option("--sprint <value>","Filter by sprint",collect).option("--release <value>","Filter by release",collect).option("--filter-ac-missing","Show only items missing acceptance_criteria").option("--filter-estimates-missing","Show only items missing estimated_minutes").option("--filter-resolution-missing","Show only terminal items missing resolution").option("--filter-metadata-missing","Show only items missing any tracked metadata (AC, estimate, or resolution)").option("--limit <n>","Alias for --output-limit; --output-budget may cap rows").option("--offset <n>","Skip the first n matching rows before limit is applied").option("--after <cursor>","Continue after an opaque next_cursor from a previous list response").option("--no-truncate","Return every matched row after the explicit status and field filters").option("--include-body","Include item body in each returned list row").option("--strict-read","Fail closed if any item document or item directory cannot be read").option("--compact","Render compact list projection fields (mutually exclusive with --brief/--full/--fields)").option("--brief","Ultra-compact output: id, status, type, title only (agent-optimized, mutually exclusive with --compact/--full/--fields)").option("--full","Render full list projection fields (mutually exclusive with --compact/--brief/--fields)").option("--fields <value>",`Render custom comma-separated list fields (mutually exclusive with --compact/--brief/--full). ${renderPmClosedDomainHelp(name,"--fields")}`).option("--sort <value>","Sort field: priority|deadline|updated_at|created_at|title|parent (aliases: updated, created)").option("--order <value>","Sort order: asc|desc (requires --sort)").option("--tree","Render rows in parent/child tree order").option("--tree-depth <n>","Maximum recursion depth with --tree (0 keeps root rows only)").option("--format <value>","Output render mode: csv|table (human export) or json|ndjson|toon (machine output override)").option("--stream","Emit line-delimited JSON rows (requires --json)");registerContentAndGovernanceFilters(command);command.action(async(options,actionCommand)=>{await runRegisteredListCommand({name,status,excludeTerminal,dependencyBlocked,options,actionCommand,aliasContract})});addHiddenOption(command,"--tags <value>","Alias for --tag");addHiddenOption(command,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(command,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(command,"--token_budget <n>","Alias for --token-budget");addHiddenOption(command,"--filter-estimate-missing","Alias for --filter-estimates-missing")}async function runAggregateAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runAggregate(normalizeAggregateOptions(options),globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=aggregate took_ms=${Date.now()-startedAt}`)}}async function runContextAction(options,actionCommand){const globalOptions=getGlobalOptions(actionCommand);const startedAt=Date.now();const normalized=normalizeContextOptions(applyContextIntentProjection("context",options));const result=await runContext(normalized,globalOptions);const outputFormat=resolveContextOutputFormat(normalized,globalOptions);if(outputFormat==="markdown"){if(!globalOptions.quiet){writeStdout(`${renderContextMarkdown(result)}
|
|
4
4
|
`)}}else if(outputFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows([...result.high_level,...result.low_level,...result.blocked_fallback]);if(!globalOptions.quiet&&rendered.length>0){writeStdout(`${rendered}
|
|
5
5
|
`)}}else{printResult(result,{...globalOptions,json:outputFormat==="json"})}if(globalOptions.profile){printError(`profile:command=context took_ms=${Date.now()-startedAt}`)}}async function runNextAction(options,actionCommand){const globalOptions=getGlobalOptions(actionCommand);const startedAt=Date.now();const nextOptions=normalizeNextOptions(applyContextIntentProjection("next",options));const result=await runNext(nextOptions,globalOptions);const outputFormat=resolveNextOutputFormat(nextOptions,globalOptions);if(outputFormat==="markdown"){if(!globalOptions.quiet){writeStdout(`${renderNextMarkdown(result)}
|
|
6
6
|
`)}}else{printResult(result,{...globalOptions,json:outputFormat==="json"})}if(globalOptions.profile){printError(`profile:command=next took_ms=${Date.now()-startedAt}`)}}async function runSearchAction(keywords,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const query=normalizeSearchKeywordsInput(keywords);const intentOptions=applyContextIntentProjection("search",options,[query]);const searchOptions=normalizeSearchOptions(intentOptions);const result=await runSearch(query,searchOptions,globalOptions);const outputFormat=typeof intentOptions.format==="string"?intentOptions.format.trim().toLowerCase():void 0;const effectiveGlobal=resolveReadCommandOutputFormat("Search",intentOptions.format,globalOptions,true);if(outputFormat==="ndjson"){setActiveCommandResult(result);const rendered=serializeNdjsonRows(result.items);if(!effectiveGlobal.quiet&&rendered.length>0){writeStdout(`${rendered}
|
|
7
|
-
`)}}else{printResult(result,effectiveGlobal)}if(globalOptions.profile){printError(`profile:command=search took_ms=${Date.now()-startedAt}`)}}async function runEvalAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runEval({mode:typeof options.mode==="string"?options.mode:void 0,k:typeof options.k==="string"?options.k:void 0,failUnder:typeof options.failUnder==="string"?options.failUnder:void 0,queries:typeof options.queries==="string"?options.queries:void 0,format:typeof options.format==="string"?options.format:void 0},globalOptions);printResult(result,resolveReadCommandOutputFormat("Eval",options.format,globalOptions));if(globalOptions.profile){printError(`profile:command=eval took_ms=${Date.now()-startedAt}`)}if(!result.passed){throw new PmCliError(
|
|
7
|
+
`)}}else{printResult(result,effectiveGlobal)}if(globalOptions.profile){printError(`profile:command=search took_ms=${Date.now()-startedAt}`)}}async function runEvalAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runEval({mode:typeof options.mode==="string"?options.mode:void 0,k:typeof options.k==="string"?options.k:void 0,failUnder:typeof options.failUnder==="string"?options.failUnder:void 0,queries:typeof options.queries==="string"?options.queries:void 0,format:typeof options.format==="string"?options.format:void 0},globalOptions);printResult(result,resolveReadCommandOutputFormat("Eval",options.format,globalOptions));if(globalOptions.profile){printError(`profile:command=eval took_ms=${Date.now()-startedAt}`)}if(!result.passed){throw new PmCliError("Eval gate failed: one or more aggregate or per-query thresholds were not met; inspect the metric report",EXIT_CODE.GENERIC_FAILURE)}}async function runGetAction(id,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const intentOptions=applyContextIntentProjection("get",options,[id]);const result=await runGet(id,globalOptions,{depth:typeof intentOptions.depth==="string"?intentOptions.depth:void 0,fields:typeof intentOptions.fields==="string"?intentOptions.fields:void 0,full:Boolean(intentOptions.full),tree:intentOptions.tree===true,treeDepth:typeof intentOptions.treeDepth==="string"?intentOptions.treeDepth:typeof intentOptions.tree_depth==="string"?intentOptions.tree_depth:void 0,at:typeof intentOptions.at==="string"?intentOptions.at:void 0});printResult(result,resolveReadCommandOutputFormat("Get",intentOptions.format,globalOptions));if(globalOptions.profile){printError(`profile:command=get took_ms=${Date.now()-startedAt}`)}}async function runHistoryAction(id,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();if([options.compact,options.raw,options.full,options.provenance].filter(value=>value===true).length>1){throw new PmCliError("History projection options are mutually exclusive. Use --compact, --provenance, or --full.",EXIT_CODE.USAGE)}const field=typeof options.field==="string"?options.field:void 0;const strictExit=Boolean(options.strictExit)||Boolean(options.failOnWarn);if(strictExit&&!options.verify){throw new PmCliError("--strict-exit requires --verify (it gates on the verification result).",EXIT_CODE.USAGE)}const result=await runHistory(id,{limit:typeof options.limit==="string"?options.limit:void 0,compact:options.full===true||options.provenance===true?false:true,provenance:options.provenance===true,provenanceSummary:options.provenanceSummary===true,harness:readRepeatableStringOption(options,"harness"),agentInstance:readRepeatableStringOption(options,"agentInstance"),provenanceFilter:readRepeatableStringOption(options,"provenanceFilter"),diff:Boolean(options.diff)||field!==void 0,field,verify:Boolean(options.verify)},globalOptions);printResult(result,resolveReadCommandOutputFormat("History",options.format,globalOptions));if(strictExit&&result.verification&&!result.verification.ok){process.exitCode=EXIT_CODE.GENERIC_FAILURE}if(globalOptions.profile){printError(`profile:command=history took_ms=${Date.now()-startedAt}`)}}function readRepeatableStringOption(options,key){const value=options[key];return Array.isArray(value)?value:void 0}function buildMutationEventOptions(options,pmRoot){const harness=readRepeatableStringOption(options,"harness");const agentInstance=readRepeatableStringOption(options,"agentInstance");const provenanceFilter=readRepeatableStringOption(options,"provenanceFilter");const rawCursorMode=typeof options.cursorMode==="string"?options.cursorMode:void 0;if(rawCursorMode!==void 0&&rawCursorMode!=="batch"&&rawCursorMode!=="row"){throw new PmCliError("Events --cursor-mode must be batch or row.",EXIT_CODE.USAGE,{code:"invalid_event_cursor_mode"})}const cursorMode=rawCursorMode;return{pmRoot,since:typeof options.since==="string"?options.since:void 0,type:readRepeatableStringOption(options,"type"),author:readRepeatableStringOption(options,"author"),item:readRepeatableStringOption(options,"item"),limit:typeof options.limit==="string"?Number(options.limit):void 0,full:options.full===true,...options.provenance===true?{provenance:true}:{},...options.provenanceSummary===true?{provenanceSummary:true}:{},...harness===void 0?{}:{harness},...agentInstance===void 0?{}:{agentInstance},...provenanceFilter===void 0?{}:{provenanceFilter},cursorMode}}async function followMutationEvents(eventOptions,options,quiet){if(options.provenanceSummary===true){throw new PmCliError("Events --provenance-summary is bounded to one page and cannot be combined with --follow.",EXIT_CODE.USAGE)}const intervalMs=typeof options.intervalMs==="string"?Number(options.intervalMs):void 0;if(eventOptions.cursorMode==="row"){for await(const event of subscribeMutationEvents({...eventOptions,intervalMs})){if(!quiet){writeStdout(`${JSON.stringify(event)}
|
|
8
8
|
`)}}return}for await(const page of subscribeMutationEventBatches({...eventOptions,intervalMs})){if(!quiet){writeStdout(`${serializeNdjsonStream(page.events,{count:page.count,has_more:page.has_more,next_cursor:page.next_cursor??null,source:page.source,heartbeat:page.count===0})}
|
|
9
9
|
`)}}}function renderMutationEventPage(page){if(page.cursor_mode==="row"){return serializeNdjsonRows(page.events)}return serializeNdjsonStream(page.events,{count:page.count,has_more:page.has_more,next_cursor:page.next_cursor??null,source:page.source,...page.provenance_summary===void 0?{}:{provenance_summary:page.provenance_summary}})}async function runEventsAction(options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const eventOptions=buildMutationEventOptions(options,globalOptions.path);if(options.follow===true){await followMutationEvents(eventOptions,options,globalOptions.quiet===true);return}const page=await listMutationEvents(eventOptions);setActiveCommandResult(page);if(globalOptions.json){printResult(page,globalOptions);if(globalOptions.profile){printError(`profile:command=events took_ms=${Date.now()-startedAt}`)}return}const rendered=renderMutationEventPage(page);if(!globalOptions.quiet&&rendered.length>0){writeStdout(`${rendered}
|
|
10
10
|
`)}if(globalOptions.profile){printError(`profile:command=events took_ms=${Date.now()-startedAt}`)}}async function runGraphAction(subcommand,id,target,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const result=await runGraph(subcommand,id,target,{...Array.isArray(options.kind)?{kind:options.kind}:{},maxDepth:typeof options.maxDepth==="string"?options.maxDepth:void 0,limit:typeof options.limit==="string"?options.limit:void 0,after:typeof options.after==="string"?options.after:void 0,direction:typeof options.direction==="string"?options.direction:void 0,maxPaths:typeof options.maxPaths==="string"?options.maxPaths:void 0,sample:typeof options.sample==="string"?options.sample:void 0,...Array.isArray(options.exemptIsolate)?{exemptIsolate:options.exemptIsolate}:{},...Array.isArray(options.exemptIsolateType)?{exemptIsolateType:options.exemptIsolateType}:{},saveBaseline:options.saveBaseline===true,rebuild:options.rebuild===true,clear:options.clear===true,summary:options.summary===true,full:options.full===true},globalOptions);printResult(result,globalOptions);if(globalOptions.profile){printError(`profile:command=graph took_ms=${Date.now()-startedAt}`)}}function registerListQueryCommands(program,options){const commandFilter=options?.commandFilter;const shouldRegister=commandName=>shouldRegisterListQueryCommand(commandName,commandFilter);const listCommandDescriptors=[{name:"list",description:"List active items with optional lifecycle-status and project filters.",excludeTerminal:true,allowStatusFilter:true},{name:"list-all",description:"List all items with optional filters.",excludeTerminal:false,allowStatusFilter:true},{name:"list-draft",description:"List draft items with optional filters.",status:"draft"},{name:"list-open",description:"List open items with optional filters.",status:"open",excludeTerminal:false,allowStatusFilter:false},{name:"list-in-progress",description:"List in-progress items with optional filters.",status:"in_progress",excludeTerminal:false,allowStatusFilter:false},{name:"list-blocked",description:"List blocked items (blocked status or open blocked_by dependencies, matching pm next) with optional filters.",dependencyBlocked:true,excludeTerminal:false,allowStatusFilter:false},{name:"list-closed",description:"List closed items with optional filters.",status:"closed"},{name:"list-canceled",description:"List canceled items with optional filters.",status:"canceled"}];for(const descriptor of listCommandDescriptors){if(shouldRegister(descriptor.name)){const aliasContract=resolvePmCommandAlias(descriptor.name);registerListCommand(program,{...descriptor,...aliasContract?.registration==="commander"?{aliasContract}:{}})}}if(shouldRegister("aggregate")){const aggregateCommand=program.command("aggregate").description("Group item counts and numeric measures.").option("--set-mode <value>","Set grouping: element (default)|tuple").option("--limit <value>","Group page size (default: 50)").option("--after <value>","Continue with next_after cursor").option("--group-by <value>","Fields: parent,type,priority,status,assignee,tags,sprint,release (comma-separated)").option("--count","Counts (default)").option("--completion","Status counts and completion_pct").option("--sum <field>","Group numeric sum").option("--avg <field>","Group numeric average").option("--include-unparented","Keep unparented group").option("--status <value>","Item status").option("--type <value>","Item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Latest deadline (ISO/date or relative)").option("--deadline-after <value>","Earliest deadline (ISO/date or relative)").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Assignee presence: assigned|unassigned").option("--parent <value>","Parent ID").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release");addHiddenOption(aggregateCommand,"--include_unparented","Alias for --include-unparented");addHiddenOption(aggregateCommand,"--assignee_filter <value>","Alias for --assignee-filter");aggregateCommand.action(runAggregateAction)}if(shouldRegister("context")){const contextCommand=program.command("context").alias("ctx").description("Show a token-efficient project context snapshot for next-work decisions.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("context","--for")}`).option("--date <value>","Anchor date/time for agenda window calculations (ISO/date string or relative)").option("--from <value>","Agenda lower bound (ISO/date string or relative)").option("--to <value>","Agenda upper bound (ISO/date string or relative)").option("--past","Include past agenda entries in bounded windows").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--assignee <value>","Filter by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <id>","Scope the snapshot to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit focus and agenda rows per section").option("--after <cursor>","Continue ranked focus after a next_cursor from a previous context response").option("--format <value>","Context output format override: markdown|toon|json|ndjson").option("--depth <value>","Context depth: brief|standard|deep|full (full = every section, no per-section cap)").option("--section <value...>","Include specific sections (repeatable; overrides --depth)").option("--fields <value>","Project focus rows to a comma-separated field subset (e.g. id,title,priority)").option("--activity-limit <n>","Limit recent activity entries (default: settings or 10)").option("--stale-threshold <value>","Staleness cutoff in days (e.g. 7 or 7d; default: settings or 7)").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked candidate ids").option("--token-budget <n>","Maximum estimated tokens spent on ranked focus rows").option("--no-extension-health","Omit the installed extension health summary").option("--no-tags","Omit tag arrays from context focus rows");addHiddenOption(contextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(contextCommand,"--max-items <n>","Alias for --limit");addHiddenOption(contextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(contextCommand,"--token_budget <n>","Alias for --token-budget");contextCommand.action(runContextAction)}if(shouldRegister("next")){const nextCommand=program.command("next").description("Recommend the next actionable (unblocked, ready) work item with rationale + blocked companion.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("next","--for")}`).option("--type <value>","Filter candidate items by type").option("--tag <value>","Filter candidate items by tag").option("--priority <value>","Filter candidate items by priority").option("--assignee <value>","Filter candidate items by assignee").option("--assignee-filter <value>","Filter assignee presence: assigned|unassigned").option("--sprint <value>","Filter candidate items by sprint").option("--release <value>","Filter candidate items by release").option("--parent <id>","Scope to one item's subtree (the item plus all descendants)").option("--limit <n>","Limit ready rows (default: 5; non-positive falls back to default)").option("--blocked-limit <n>","Limit blocked rows (default: same as --limit)").option("--ready-only","Omit the blocked companion list").option("--include-decisions","Include human-gated Decision items in the claimable ready queue").option("--include-gates","Include outcome gates in the ready queue").option("--include-containers","Include containers with unfinished descendants in the ready queue").option("--format <value>","Next output format override: markdown|toon|json").option("--explain-ranking","Include the scorer model, per-signal contributions, and ranked ready ids").option("--token-budget <n>","Maximum estimated tokens spent on the ranked ready queue");addHiddenOption(nextCommand,"--assignee_filter <value>","Alias for --assignee-filter");addHiddenOption(nextCommand,"--blocked_limit <n>","Alias for --blocked-limit");addHiddenOption(nextCommand,"--ready_only","Alias for --ready-only");addHiddenOption(nextCommand,"--explain_ranking","Alias for --explain-ranking");addHiddenOption(nextCommand,"--token_budget <n>","Alias for --token-budget");nextCommand.action(runNextAction)}if(shouldRegister("search")){const searchCommand=program.command("search").argument("<keywords...>","Keyword query tokens").description("Search items with keyword, semantic, or hybrid retrieval. Inline field:value tokens (tag:/status:/type:/priority:) in the query are parsed as filters, e.g. 'auth tag:area:search status:open'.").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("search","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--mode <value>","Search mode: keyword|semantic|hybrid (default: auto)").option("--semantic","Shorthand for --mode semantic").option("--hybrid","Shorthand for --mode hybrid").option("--match-mode <value>","Token match mode: and|or|exact (default: or with all-terms ranking bonus; and = hard-require every token; exact = exact phrase)").option("--min-score <value>","Per-query minimum score threshold (finite number >= 0); overrides settings search.score_threshold for this query only").option("--count","Return only the count of matching items (post-filter/threshold, pre-limit); skips hit rows").option("--semantic-weight <value>","Override hybrid semantic weight for this query (0..1); invalid values fall back to settings").option("--include-linked","Include linked files, docs, and tests in the searchable corpus").option("--title-exact","Require exact normalized title match for the full query string").option("--phrase-exact","Require exact normalized phrase match in searchable text").option("--highlight","Emit per-field matched-text snippets (wrapped in \xAB\u2026\xBB) on each hit; off by default").option("--status <value>","Filter by status before query (all, open/closed/canceled aliases, or configured status id; CSV)").option("--type <value>","Filter by item type").option("--tag <value>","Filter by tag").option("--priority <value>","Filter by priority").option("--deadline-before <value>","Filter by deadline upper bound (ISO/date string or relative)").option("--deadline-after <value>","Filter by deadline lower bound (ISO/date string or relative)").option("--updated-after <value>",'Filter by updated_at lower bound: ISO timestamp or signed relative (e.g. "-2h"/"-7d" for the past)').option("--updated-before <value>","Filter by updated_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-after <value>","Filter by created_at lower bound: ISO timestamp or signed relative (-2h/+1d)").option("--created-before <value>","Filter by created_at upper bound: ISO timestamp or signed relative (-2h/+1d)").option("--assignee <value>","Filter by assignee").option("--sprint <value>","Filter by sprint").option("--release <value>","Filter by release").option("--parent <value>","Filter by parent item ID").option("--compact","Render compact search hits (default; mutually exclusive with --full/--fields)").option("--full","Render full search hits with nested item payloads (mutually exclusive with --compact/--fields)").option("--fields <value>",`Render custom comma-separated search hit fields (mutually exclusive with --compact/--full). ${renderPmClosedDomainHelp("search","--fields")}`).option("--format <value>","Search output format override: json|ndjson|toon").option("--limit <n>","Limit returned item count").option("--after <cursor>","Continue after an opaque next_cursor from a previous search response");registerContentAndGovernanceFilters(searchCommand);searchCommand.action(runSearchAction);addHiddenOption(searchCommand,"--tags <value>","Alias for --tag");addHiddenOption(searchCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("eval")){program.command("eval").description("Evaluate search relevance against a curated golden-query set: reports nDCG@k, MRR@k, precision@k, and recall@k per query plus the macro average. Use --fail-under as a CI gate.").option("--mode <value>","Default retrieval mode for queries without their own: keyword|semantic|hybrid (default: keyword)").option("--k <n>","Metric cutoff @k (positive integer; default: 10)").option("--fail-under <value>","Exit non-zero when aggregate nDCG@k falls below this threshold (0..1); CI gate").option("--queries <path>",`Query JSON (${EVAL_QUERY_SET_SCHEMA_ID}); default: search/eval-queries.json; errors show an example`).option("--format <value>","Eval output format override: json|toon").action(runEvalAction)}if(shouldRegister("get")){const getCommand=program.command("get").argument("<id>","Item id").option("--for <intent>",`Apply a declared context intent projection. ${renderPmClosedDomainHelp("get","--for")}`).option("--token-budget <n>","Override the selected intent's maximum estimated output tokens").option("--depth <value>","Detail depth: brief|standard|deep|full (full aliases deep; default: standard)").option("--full","Explicit full item read; equivalent to --depth deep (mutually exclusive with --depth/--fields)").option("--fields <value>",`Render custom comma-separated item metadata fields. ${renderPmClosedDomainHelp("get","--fields")}`).option("--tree","Include descendants rooted at the requested item").option("--tree-depth <n>","Maximum subtree depth for --tree descendants").option("--at <version-or-timestamp>","Reconstruct a verified historical item state without mutating it").option("--format <value>","Get output format override: json|toon").description("Show item details by ID.").action(runGetAction);addHiddenOption(getCommand,"--tree_depth <n>","Alias for --tree-depth");addHiddenOption(getCommand,"--token_budget <n>","Alias for --token-budget")}if(shouldRegister("history")){const historyCommand=program.command("history").enablePositionalOptions().argument("<id>","Item id").option("--limit <n>","Latest n entries").option("--compact","Index, time, op, author, patch count, fields").option("--full","Full entries with JSON Patches").option("--provenance","Authors and provenance; no patches").option("--provenance-summary","Count provenance completeness").option("--harness <value>","Recorded/resolved harness (repeatable)",collect).option("--agent-instance <value>","Agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Exact provenance match (repeatable)",collect).option("--diff","Before/after field diffs").option("--field <name>","Filter changed field; implies --diff").option("--verify","Verify full chain and replay").option("--strict-exit","With --verify, fail on integrity errors").option("--fail-on-warn","Alias for --strict-exit").option("--format <value>","Output: json|toon").description("Show item history entries.").action(runHistoryAction);registerHistoryMaintenanceCommands(historyCommand,true);registerHistoryActivityCommand(historyCommand.command("activity"))}if(shouldRegister("events")){program.command("events").option("--since <cursor-or-timestamp>","Resume strictly after a durable cursor, or include events from an ISO timestamp").option("--type <value>","Filter by mutation operation (repeatable or comma-separated)",collect).option("--author <value>","Filter by mutation author (repeatable or comma-separated)",collect).option("--item <value>","Filter by item or workspace stream id (repeatable or comma-separated)",collect).option("--limit <n>","Return at most 1,000 events (default: 100)").option("--cursor-mode <mode>","Cursor framing: batch emits one terminal trailer (default); row preserves one cursor per event").option("--full","Include each complete authoritative history entry").option("--provenance","Include patch-free author, harness, instance, and extensible provenance").option("--provenance-summary","Include bounded provenance completeness counts").option("--harness <value>","Filter by recorded or vocabulary-resolved harness (repeatable)",collect).option("--agent-instance <value>","Filter by privacy-safe agent instance (repeatable)",collect).option("--provenance-filter <dimension=value>","Filter by an exact declared provenance value (repeatable)",collect).option("--follow","Continue emitting committed events as newline-delimited JSON").option("--interval-ms <n>","Empty-read delay while following (minimum: 10ms; default: 250ms)").description("Emit cursor-resumable committed mutation facts as newline-delimited JSON.").action(runEventsAction)}if(shouldRegister("activity")){registerHistoryActivityCommand(program.command("activity",{hidden:true}))}if(shouldRegister("graph")){program.command("graph").argument("<subcommand>","Graph query (ancestors, descendants, predecessors, successors, paths, impact, analyze, audit, communities, redundancy, dominators, slack, centrality, articulation, plan, index)").argument("[id]","Root item id (traversals, paths, impact, and dominators)").argument("[target]","Target item id (paths only)").option("--kind <value>","Restrict traversal to registered relationship kinds (repeatable or comma-separated)",collect).option("--max-depth <value>","Maximum traversal depth (non-negative integer)").option("--limit <value>","Maximum returned rows per bounded collection").option("--after <value>","Resume a traversal after this previously returned node id").option("--direction <value>","Edge orientation for paths/impact (outgoing, incoming, or both)").option("--max-paths <value>","Maximum enumerated paths (paths only)").option("--sample <value>","Maximum evidence sample entries per audit finding (audit only)").option("--exempt-isolate <value>","Item ids treated as explicitly valid isolates by the audit (repeatable or comma-separated)",collect).option("--exempt-isolate-type <value>","Item types whose active isolates are policy-valid for the audit (repeatable or comma-separated)",collect).option("--save-baseline","Persist the audit census as the change-since-baseline comparison point (audit only)").option("--rebuild","Rebuild and warm the durable graph index (index only)").option("--clear","Delete the durable graph index (index only)").option("--summary","Return counts-first envelopes without row collections").option("--full","Return the complete graph row projection").description("Bounded workspace relationship-graph queries, analytics, and governance audit.").action(runGraphAction)}}const _testOnlyRegisterListQuery={resolveReadCommandOutputFormat,parseListFormat};export{_testOnlyRegisterListQuery,registerListQueryCommands};
|
|
@@ -1,4 +1,4 @@
|
|
|
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]="19c403ea-a458-5118-992c-1c68e83c702d")}catch(e2){}})();import{stringArrayOption}from"../option-values.js";import{WORKFLOW_POLICY_ACTIONS}from"../../sdk/cli-contracts/enum-contracts.js";import{EXIT_CODE,PmCliError,assertSchemaPreviewSupported,createUnknownSubcommandError}from"../../sdk/runtime-primitives.js";import*as schemaModule from"../commands/workspace/schema.js";import{looksLikeSchemaSubcommandTypo,parseSchemaOrderOption}from"../schema-registration-helpers.js";import{addHiddenOption,collect,formatHookWarnings,getGlobalOptions,printError,printResult,readOptionString,writeStdout}from"../registration-helpers.js";function dispatchSchemaMigration(schema,inputs){const kind=inputs.normalizedSubcommand;if(kind!=="rename-type"&&kind!=="rename-field"&&kind!=="remap-status"){return null}return schema.runSchemaEvolutionMigration({kind,from:inputs.typeName,to:readOptionString(inputs.options,"to"),...kind==="rename-field"&&typeof inputs.options.type==="string"?{type:inputs.options.type}:{}},{migrationId:readOptionString(inputs.options,"migrationId")??readOptionString(inputs.options,"migration_id"),dryRun:inputs.options.dryRun===true,author:inputs.author,force:inputs.force},inputs.globalOptions)}function dispatchSchemaReadRemoveOrPreset(schema,inputs){const{normalizedSubcommand,typeName,globalOptions,author,force}=inputs;switch(normalizedSubcommand){case"list":return schema.runSchemaList(globalOptions);case"show":return schema.runSchemaShow(typeName,globalOptions);case"show-status":return schema.runSchemaShowStatus(typeName,globalOptions);case"list-fields":return schema.runSchemaListFields(globalOptions);case"show-field":return schema.runSchemaShowField(typeName,globalOptions);case"remove-type":return schema.runSchemaRemoveType(typeName,{author,force},globalOptions);case"remove-field":return schema.runSchemaRemoveField(typeName,{author,force},globalOptions);case"remove-status":return schema.runSchemaRemoveStatus(typeName,{author,force},globalOptions);case"apply-preset":return schema.runSchemaApplyPreset(typeName,{author,force},globalOptions);default:return null}}async function dispatchSchemaSubcommand(schema,inputs){const{normalizedSubcommand,typeName,options,globalOptions}=inputs;const{author,force,description}=inputs;const migration=dispatchSchemaMigration(schema,inputs);if(migration)return migration;const readRemoveOrPreset=dispatchSchemaReadRemoveOrPreset(schema,inputs);if(readRemoveOrPreset)return readRemoveOrPreset;switch(normalizedSubcommand){case"add-field":return schema.runSchemaAddField(typeName,{type:typeof options.type==="string"?options.type:void 0,commands:inputs.commands,description,cliFlag:typeof options.cliFlag==="string"?options.cliFlag:void 0,alias:inputs.aliases,required:Boolean(options.required),requiredOnCreate:Boolean(options.requiredOnCreate),allowUnset:options.allowUnset!==false,requiredTypes:inputs.requiredTypes,author,force},globalOptions);case"add-status":return schema.runSchemaAddStatus(typeName,{role:inputs.roles,alias:inputs.aliases,description,order:inputs.order,author,force},globalOptions);default:if(options.infer===true){return schema.runSchemaInferTypes({minCount:inputs.minCount,apply:Boolean(options.apply),author,force},globalOptions)}return schema.runSchemaAddType(typeName,{description,defaultStatus:inputs.defaultStatus,folder:typeof options.folder==="string"?options.folder:void 0,alias:inputs.aliases,author,force},globalOptions)}}function renderSchemaResultHuman(schema,result){if("migration_id"in result){writeStdout(`${schema.formatSchemaEvolutionMigrationHuman(result)}
|
|
2
2
|
`);return}switch(result.action){case"list":writeStdout(`${schema.formatSchemaListHuman(result)}
|
|
3
3
|
`);return;case"show":writeStdout(`${schema.formatSchemaShowHuman(result)}
|
|
4
4
|
`);return;case"show-status":writeStdout(`${schema.formatSchemaShowStatusHuman(result)}
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
`);break;case"add-status":writeStdout(`${schema.formatSchemaAddStatusHuman(result)}
|
|
13
13
|
`);break;case"remove-status":writeStdout(`${schema.formatSchemaRemoveStatusHuman(result)}
|
|
14
14
|
`);break;default:writeStdout(`${schema.formatSchemaAddTypeHuman(result)}
|
|
15
|
-
`);break}if(result.warnings.length>0){printError(`schema ${result.action} warnings: ${formatHookWarnings(result.warnings)}`)}}function splitCollectedCommaList(raw){if(!Array.isArray(raw)){return void 0}return raw.flatMap(value=>value.split(",")).map(value=>value.trim()).filter(value=>value.length>0)}async function runSchemaAction(subcommand,name,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const{SCHEMA_SUBCOMMANDS}=schemaModule;let normalizedSubcommand=(subcommand??"").trim().toLowerCase();let typeName=name;assertSchemaSubcommandPresent(normalizedSubcommand,SCHEMA_SUBCOMMANDS);if(!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)&&typeName===void 0&&!looksLikeSchemaSubcommandTypo(subcommand)){typeName=subcommand;normalizedSubcommand="add-type"}if(!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)){throw createUnknownSubcommandError({command_path:"schema",token:normalizedSubcommand,allowed:SCHEMA_SUBCOMMANDS})}const policyAction=WORKFLOW_POLICY_ACTIONS.find(action=>action===normalizedSubcommand);if(policyAction){printResult(await schemaModule.runWorkflowPolicyAction(policyAction,name,{definition:options.definition,policy:readOptionString(options,"policy"),message:readOptionString(options,"message"),author:readOptionString(options,"author"),dryRun:options.dryRun===true},globalOptions),globalOptions)}else{const result=await dispatchSchemaSubcommand(schemaModule,{normalizedSubcommand,typeName,options,aliases:stringArrayOption(options.alias),roles:stringArrayOption(options.role),commands:splitCollectedCommaList(options.commands),requiredTypes:splitCollectedCommaList(options.requiredTypes),defaultStatus:readOptionString(options,"defaultStatus")??readOptionString(options,"default_status"),order:parseSchemaOrderOption(options.order),minCount:parseSchemaOrderOption(options.minCount),author:readOptionString(options,"author"),force:Boolean(options.force),description:readOptionString(options,"description"),globalOptions});if(globalOptions.json===true||globalOptions.defaultOutputFormat==="json"){printResult(result,globalOptions)}else if(!globalOptions.quiet){renderSchemaResultHuman(schemaModule,result)}}if(globalOptions.profile){printError(`profile:command=schema took_ms=${Date.now()-startedAt}`)}}function assertSchemaSubcommandPresent(normalizedSubcommand,allowed){if(normalizedSubcommand){return}throw new PmCliError(`pm schema requires a subcommand. Allowed: ${allowed.join(", ")}`,EXIT_CODE.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}function registerSchemaCommand(program){const schemaCommand=program.command("schema").option("--definition <json>","Policy or proposed fields JSON").option("--policy <id>","Policy id for policy-approve").option("--message <text>","Audit rationale for a policy mutation").argument("[subcommand]","Required; schema verb (list/show, add/remove, rename/remap, policy-*), or custom type shorthand").argument("[name]","Definition/source name or item id; policy-mode: advise|refuse").option("--description <text>","Type, status, or field description").option("--default-status <status>","Default status for this type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",collect).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",collect).option("--order <n>","Display/sort order for a custom status").optionsGroup("Field options (add-field):").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Field commands (repeatable/csv): create, update, update_many, list, search, calendar, context",collect).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",collect).optionsGroup("Type inference and migration options:").option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Preview
|
|
15
|
+
`);break}if(result.warnings.length>0){printError(`schema ${result.action} warnings: ${formatHookWarnings(result.warnings)}`)}}function splitCollectedCommaList(raw){if(!Array.isArray(raw)){return void 0}return raw.flatMap(value=>value.split(",")).map(value=>value.trim()).filter(value=>value.length>0)}async function runSchemaAction(subcommand,name,options,command){const globalOptions=getGlobalOptions(command);const startedAt=Date.now();const{SCHEMA_SUBCOMMANDS}=schemaModule;let normalizedSubcommand=(subcommand??"").trim().toLowerCase();let typeName=name;assertSchemaSubcommandPresent(normalizedSubcommand,SCHEMA_SUBCOMMANDS);if(!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)&&typeName===void 0&&!looksLikeSchemaSubcommandTypo(subcommand)){typeName=subcommand;normalizedSubcommand="add-type"}if(!SCHEMA_SUBCOMMANDS.includes(normalizedSubcommand)){throw createUnknownSubcommandError({command_path:"schema",token:normalizedSubcommand,allowed:SCHEMA_SUBCOMMANDS})}const policyAction=WORKFLOW_POLICY_ACTIONS.find(action=>action===normalizedSubcommand);assertSchemaPreviewSupported(normalizedSubcommand,options.dryRun===true);if(policyAction){printResult(await schemaModule.runWorkflowPolicyAction(policyAction,name,{definition:options.definition,policy:readOptionString(options,"policy"),message:readOptionString(options,"message"),author:readOptionString(options,"author"),dryRun:options.dryRun===true},globalOptions),globalOptions)}else{const result=await dispatchSchemaSubcommand(schemaModule,{normalizedSubcommand,typeName,options,aliases:stringArrayOption(options.alias),roles:stringArrayOption(options.role),commands:splitCollectedCommaList(options.commands),requiredTypes:splitCollectedCommaList(options.requiredTypes),defaultStatus:readOptionString(options,"defaultStatus")??readOptionString(options,"default_status"),order:parseSchemaOrderOption(options.order),minCount:parseSchemaOrderOption(options.minCount),author:readOptionString(options,"author"),force:Boolean(options.force),description:readOptionString(options,"description"),globalOptions});if(globalOptions.json===true||globalOptions.defaultOutputFormat==="json"){printResult(result,globalOptions)}else if(!globalOptions.quiet){renderSchemaResultHuman(schemaModule,result)}}if(globalOptions.profile){printError(`profile:command=schema took_ms=${Date.now()-startedAt}`)}}function assertSchemaSubcommandPresent(normalizedSubcommand,allowed){if(normalizedSubcommand){return}throw new PmCliError(`pm schema requires a subcommand. Allowed: ${allowed.join(", ")}`,EXIT_CODE.USAGE,{code:"missing_required_argument",examples:["pm schema list","pm schema show Task","pm schema show-status open",'pm schema add-type Spike --description "Time-boxed investigation" --default-status open',"pm schema remove-type Spike","pm schema add-status review --role active --alias in_review","pm schema remove-status review","pm schema add-field severity_level --type string --commands create,update","pm schema list-fields","pm schema apply-preset agile","pm schema add-type --infer --min-count 10","pm schema rename-type Spike --to Experiment --migration-id spike-v2 --dry-run","pm schema rename-field severity --to impact --migration-id severity-v2","pm schema remap-status review --to verifying --migration-id review-v2"]})}function registerSchemaCommand(program){const schemaCommand=program.command("schema").option("--definition <json>","Policy or proposed fields JSON").option("--policy <id>","Policy id for policy-approve").option("--message <text>","Audit rationale for a policy mutation").argument("[subcommand]","Required; schema verb (list/show, add/remove, rename/remap, policy-*), or custom type shorthand").argument("[name]","Definition/source name or item id; policy-mode: advise|refuse").option("--description <text>","Type, status, or field description").option("--default-status <status>","Default status for this type").option("--folder <dir>","Storage folder for items of this custom type").option("--alias <name>","Alias for the custom type, status, or field flag (repeatable, csv-friendly)",collect).option("--role <value>","Lifecycle role for a custom status (repeatable): draft, active, blocked, terminal, terminal_done, terminal_canceled, default_open, default_close, default_cancel",collect).option("--order <n>","Display/sort order for a custom status").optionsGroup("Field options (add-field):").option("--type <type>","Value type for a custom field (add-field): string, number, boolean, string_array, array, object").option("--commands <list>","Field commands (repeatable/csv): create, update, update_many, list, search, calendar, context",collect).option("--cli-flag <flag>","Override the auto-derived CLI flag for a custom field (add-field)").option("--required","Mark a custom field as always required (add-field)").option("--required-on-create","Mark a custom field as required at create time (add-field)").option("--no-allow-unset","Disallow clearing a custom field via --unset (add-field)").option("--required-types <list>","Restrict a custom field's requirement to specific item types (add-field; repeatable, comma-friendly)",collect).optionsGroup("Type inference and migration options:").option("--infer","Infer custom item types from title-prefix conventions (add-type; preview unless --apply)").option("--min-count <n>","Minimum items sharing a prefix for add-type --infer (default 10)").option("--apply","Register inferred types (add-type --infer); without it the command previews only").option("--to <name>","Target definition name for rename/remap migrations").option("--migration-id <id>","Stable idempotency key for a resumable schema migration").option("--dry-run","Preview rename/remap migrations and workflow-policy actions without writes").option("--author <value>","Mutation author").option("--force","Force ownership/lock override").description("Manage types, statuses, fields, presets, and workflow policies.");addHiddenOption(schemaCommand,"--default_status <status>","Alias for --default-status",false);addHiddenOption(schemaCommand,"--migration_id <id>","Alias for --migration-id",false);schemaCommand.action(runSchemaAction)}export{registerSchemaCommand};
|
|
16
16
|
//# sourceMappingURL=registration.js.map
|