@unbrained/pm-cli 2026.8.5 → 2026.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +44 -0
- package/dist/cli/main.js +14 -37
- package/dist/cli/register-operations.js +11 -2
- package/dist/cli/register-setup.d.ts +1 -1
- package/dist/cli/register-setup.js +46 -20
- package/dist/cli/stats-analytics-json.d.ts +9 -0
- package/dist/cli/stats-analytics-json.js +69 -0
- package/dist/cli-bundle/bundle-manifest.json +403 -403
- package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-PMXJEU3F.js → chunk-2AXF3VSK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-MHK6LIWE.js → chunk-2XS43CCV.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +8 -0
- package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-45G53IU4.js → chunk-4MTI7XOV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7C4PTJG6.js → chunk-6BX5UDCN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4YUBDMQM.js → chunk-6QPO7KLR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HWRRMBJO.js → chunk-7MXHZHSQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3FTILRJ2.js → chunk-7ZPMJW4U.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2WFXWAYX.js → chunk-AGYNSNCI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-43HQQI6S.js → chunk-B4KLBBMN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VCKLFEUN.js → chunk-CALJHNBL.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-CSI3WS5I.js → chunk-CFIGP5LY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-V3EUXXOF.js → chunk-CS6MRHG7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YSO3YFZ4.js → chunk-CUGNQQKH.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
- package/dist/cli-bundle/chunks/{chunk-BXQLRKWF.js → chunk-H5Y5YE6A.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-54FNT7U2.js → chunk-H5Y6UV6E.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UP7DTVMD.js → chunk-H7KGWPDF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-E2RKBKWB.js → chunk-HFSD77TQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-V3774P7D.js → chunk-HX2GTA6L.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UZBWIUYD.js → chunk-J2IEKAVR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-HNFD72UK.js → chunk-K44PYFXH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5ZBOIPGP.js → chunk-K4KGEEBT.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
- package/dist/cli-bundle/chunks/{chunk-OMXVBQ2N.js → chunk-KL6IEBV2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7A5OT5J2.js → chunk-KWQZDZSS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-M72BKL5Q.js → chunk-KZ4X3DGU.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-VN5VITU3.js → chunk-ME2JJ4LA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-A62CYISG.js → chunk-NG6OXIBR.js} +8 -8
- package/dist/cli-bundle/chunks/{chunk-42E7YPLG.js → chunk-NYIGHWQY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RKAVWO3O.js → chunk-NZ75GNSA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DXDREUXT.js → chunk-PCJWJNC2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZYHOB3SN.js → chunk-PD3225AM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OTHLDSFP.js → chunk-PDEGKG7P.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
- package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +56 -0
- package/dist/cli-bundle/chunks/{chunk-L3AZOELJ.js → chunk-TPKN3S7S.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LKDGK44W.js → chunk-TPXAXTCO.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-R546TPDE.js → chunk-UQLZQVFW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BPELKUQD.js → chunk-VT3Z5G7D.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-4VN6GS4U.js → chunk-WSJEIGJF.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UN66FZRO.js → chunk-WYNUU7ZW.js} +49 -46
- package/dist/cli-bundle/chunks/{chunk-NY4T3JWN.js → chunk-YGPNCCXZ.js} +2 -2
- package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
- package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
- package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
- package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
- package/dist/cli-bundle/chunks/{create-XLKTXTUF.js → create-I5DVV4YG.js} +2 -2
- package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
- package/dist/cli-bundle/chunks/{deps-ITTY3GIC.js → deps-S7UBCECS.js} +2 -2
- package/dist/cli-bundle/chunks/{docs-W4OSRTYR.js → docs-ZZNVBBYO.js} +2 -2
- package/dist/cli-bundle/chunks/{files-EOK4AZI4.js → files-27C337VT.js} +2 -2
- package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
- package/dist/cli-bundle/chunks/{history-compact-7UGTMLL3.js → history-compact-HJQK67CZ.js} +2 -2
- package/dist/cli-bundle/chunks/{history-redact-4DZRMD6Z.js → history-redact-PWC6PDWA.js} +2 -2
- package/dist/cli-bundle/chunks/{history-repair-UPOSZW5R.js → history-repair-N3CY4WBF.js} +2 -2
- package/dist/cli-bundle/chunks/{learnings-GMRNCBS3.js → learnings-4FH23XDT.js} +2 -2
- package/dist/cli-bundle/chunks/{profile-2MUUMHRE.js → profile-5Y5XXH5N.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-LR3SQ5ZF.js → register-list-query-FJZCJ67O.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-SUOHFVWM.js → register-mutation-YGYPW3BL.js} +3 -3
- package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
- package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +2 -0
- package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
- package/dist/cli-bundle/chunks/{schema-FJ4EA3XF.js → schema-EQGKBYXJ.js} +2 -2
- package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
- package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MJ7HWSFK.js → chunk-2ECLECMK.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-A7BJ5SS6.js → chunk-3K4XV2BF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PIMMYG7Q.js → chunk-4EX25PXM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-WVIVUWVL.js → chunk-CIXVQPB7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FGKY4MBE.js → chunk-DQ6FKGL3.js} +10 -10
- package/dist/cli-bundle/focused-chunks/{chunk-QVHKCI4T.js → chunk-HNL6IFGS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-G6ETT4QK.js → chunk-MHMTKV5V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7J5TUBUJ.js → chunk-MOTJFQ3F.js} +22 -22
- package/dist/cli-bundle/focused-chunks/{chunk-UIL2M2NA.js → chunk-NBJKQP4S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RUR5I3TK.js → chunk-QHRTT7WT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-B7LJWAZE.js → chunk-R2LEMEV5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SV3O7TSH.js → chunk-RPNYG5MO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-TIKDBG4D.js +29 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IPWSFADF.js → chunk-VZFU2R4M.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WEM2E2PE.js → chunk-YZEZAPJK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +29 -28
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +1 -1
- 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 +1 -1
- package/dist/core/extensions/activation-summary.d.ts +4 -0
- package/dist/core/extensions/activation-summary.js +5 -2
- package/dist/core/extensions/contribution-inventory.d.ts +1 -0
- package/dist/core/extensions/contribution-inventory.js +35 -2
- package/dist/core/extensions/extension-hook-runtime.js +5 -3
- package/dist/core/extensions/extension-types.d.ts +18 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +5 -13
- package/dist/core/extensions/preflight-ownership.d.ts +5 -0
- package/dist/core/extensions/preflight-ownership.js +42 -0
- package/dist/core/extensions/reserved-host-flags.js +3 -2
- package/dist/core/history/workspace-history.d.ts +22 -2
- package/dist/core/history/workspace-history.js +60 -36
- package/dist/core/output/output.d.ts +2 -0
- package/dist/core/output/output.js +3 -2
- package/dist/core/shared/command-types.d.ts +2 -0
- package/dist/core/shared/command-types.js +2 -2
- package/dist/mcp/tool-definitions.js +6 -2
- package/dist/sdk/author-attribution.js +23 -7
- package/dist/sdk/cli-bootstrap.d.ts +2 -0
- package/dist/sdk/cli-bootstrap.js +7 -2
- package/dist/sdk/cli-contracts/completeness.js +51 -4
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
- package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +16 -9
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
- package/dist/sdk/cli-contracts/tool-schema.js +18 -2
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- package/dist/sdk/cli-program.js +3 -2
- package/dist/sdk/completion.js +5 -2
- package/dist/sdk/compose.d.ts +2 -2
- package/dist/sdk/compose.js +7 -2
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +2 -2
- package/dist/sdk/core.d.ts +3 -1
- package/dist/sdk/core.js +4 -3
- package/dist/sdk/define.d.ts +3 -1
- package/dist/sdk/define.js +3 -8
- package/dist/sdk/extension/install-sources.d.ts +43 -5
- package/dist/sdk/extension/install-sources.js +36 -2
- package/dist/sdk/extension/migrations.d.ts +114 -0
- package/dist/sdk/extension/migrations.js +175 -0
- package/dist/sdk/extension/scaffold.js +14 -9
- package/dist/sdk/extension/source-resolution.d.ts +50 -0
- package/dist/sdk/extension/source-resolution.js +66 -0
- package/dist/sdk/extension.d.ts +5 -1
- package/dist/sdk/extension.js +31 -35
- package/dist/sdk/generated-error-code-catalog.js +112 -2
- package/dist/sdk/governance/health.js +11 -2
- package/dist/sdk/history-analytics.d.ts +141 -0
- package/dist/sdk/history-analytics.js +283 -0
- package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
- package/dist/sdk/improvement-ledger-validation.js +63 -0
- package/dist/sdk/improvement-ledger.d.ts +139 -0
- package/dist/sdk/improvement-ledger.js +261 -0
- package/dist/sdk/index.d.ts +11 -3
- package/dist/sdk/index.js +12 -4
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/merge/install.js +10 -2
- package/dist/sdk/package-migrations.d.ts +10 -0
- package/dist/sdk/package-migrations.js +21 -0
- package/dist/sdk/read-output-budget.js +24 -22
- package/dist/sdk/read-output-contracts.d.ts +10 -2
- package/dist/sdk/read-output-contracts.js +124 -65
- package/dist/sdk/read-output-rows.d.ts +29 -0
- package/dist/sdk/read-output-rows.js +100 -0
- package/dist/sdk/read-output-session.d.ts +69 -0
- package/dist/sdk/read-output-session.js +200 -0
- package/dist/sdk/runtime-input.d.ts +2 -0
- package/dist/sdk/runtime-input.js +14 -2
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime-stats-options.d.ts +9 -0
- package/dist/sdk/runtime-stats-options.js +38 -0
- package/dist/sdk/runtime.d.ts +3 -0
- package/dist/sdk/runtime.js +10 -27
- package/dist/sdk/stats.d.ts +40 -0
- package/dist/sdk/stats.js +112 -29
- package/docs/COMMANDS.md +9 -0
- package/docs/EXTENSIONS.md +2 -2
- package/docs/EXTENSION_LIFECYCLE.md +46 -0
- package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
- package/docs/README.md +2 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
- package/docs/RELEASING.md +33 -20
- package/docs/SDK.md +31 -3
- package/marketplace.json +2 -2
- package/package.json +5 -5
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +566 -815
- package/dist/cli-bundle/chunks/append-VXXGOXSG.js +0 -2
- package/dist/cli-bundle/chunks/chunk-6MSQJOTG.js +0 -13
- package/dist/cli-bundle/chunks/chunk-EGJ4JTUG.js +0 -55
- package/dist/cli-bundle/chunks/chunk-FPBQHMFT.js +0 -8
- package/dist/cli-bundle/chunks/chunk-GE4KCSZP.js +0 -164
- package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +0 -2
- package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +0 -8
- package/dist/cli-bundle/chunks/chunk-Q35VBGOQ.js +0 -5
- package/dist/cli-bundle/chunks/chunk-SSF4PIUR.js +0 -2
- package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +0 -20
- package/dist/cli-bundle/chunks/chunk-XCEZYMNI.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YEWNL576.js +0 -2
- package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +0 -2
- package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +0 -2
- package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +0 -2
- package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +0 -2
- package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +0 -2
- package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +0 -2
- package/dist/cli-bundle/chunks/register-setup-O6AYP6NP.js +0 -2
- package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +0 -2
- package/dist/cli-bundle/chunks/update-YHV52CSS.js +0 -2
- package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-BIMTMOS7.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-GJ2TG2CW.js +0 -28
- package/dist/cli-bundle/focused-chunks/chunk-N5XU5UVK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VLYOEYML.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +0 -2
package/dist/sdk/stats.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm stats command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!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]="
|
|
7
|
+
!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]="a4de53c1-bb22-591f-a064-142c642a2443")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { getActiveExtensionRegistrations, runActiveOnReadHooks, } from "../core/extensions/index.js";
|
|
@@ -21,6 +21,9 @@ import { nowIso } from "../core/shared/time.js";
|
|
|
21
21
|
import { listAllItemMetadataLight, listAllItemMetadataWithBody, } from "../core/store/item-store.js";
|
|
22
22
|
import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
|
|
23
23
|
import { readSettings } from "../core/store/settings.js";
|
|
24
|
+
import { recordImprovementObservation, readImprovementLedger, } from "./improvement-ledger.js";
|
|
25
|
+
import { projectFleetAttributionAnalytics, projectProvenanceCoverageAnalytics, readHistoryAnalyticsWindow, } from "./history-analytics.js";
|
|
26
|
+
import { parseTestRunMeasurements } from "./test/measurements.js";
|
|
24
27
|
function zeroByType(itemTypes) {
|
|
25
28
|
return itemTypes.reduce((acc, value) => {
|
|
26
29
|
acc[value] = 0;
|
|
@@ -73,6 +76,88 @@ export const _testOnly = {
|
|
|
73
76
|
countNonEmptyLines,
|
|
74
77
|
readHistoryStreamContents,
|
|
75
78
|
};
|
|
79
|
+
async function recordStatsObservations(global, options) {
|
|
80
|
+
const recorded = [];
|
|
81
|
+
const observedAt = nowIso();
|
|
82
|
+
for (const measurement of parseTestRunMeasurements(options.observe, observedAt)) {
|
|
83
|
+
recorded.push(await recordImprovementObservation({
|
|
84
|
+
metric: measurement.name,
|
|
85
|
+
value: measurement.value,
|
|
86
|
+
direction: options.direction,
|
|
87
|
+
unit: measurement.unit,
|
|
88
|
+
threshold: measurement.threshold,
|
|
89
|
+
source: options.measurementSource,
|
|
90
|
+
itemId: options.measurementItem,
|
|
91
|
+
revision: options.measurementRevision,
|
|
92
|
+
observedAt,
|
|
93
|
+
author: options.author,
|
|
94
|
+
message: options.message,
|
|
95
|
+
}, global));
|
|
96
|
+
}
|
|
97
|
+
return recorded;
|
|
98
|
+
}
|
|
99
|
+
function requestedBreakdowns(items, options, classifier) {
|
|
100
|
+
const breakdowns = {};
|
|
101
|
+
if (options.byAssignee) {
|
|
102
|
+
breakdowns.assignee = groupItemsByDimension(items, "assignee", classifier);
|
|
103
|
+
}
|
|
104
|
+
if (options.byTag) {
|
|
105
|
+
breakdowns.tag = groupItemsByDimension(items, "tag", classifier, {
|
|
106
|
+
tagPrefix: options.tagPrefix,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (options.byPriority) {
|
|
110
|
+
breakdowns.priority = groupItemsByDimension(items, "priority", classifier);
|
|
111
|
+
}
|
|
112
|
+
return breakdowns;
|
|
113
|
+
}
|
|
114
|
+
async function requestedHistoryAnalytics(pmRoot, items, settings, terminalStatuses, options) {
|
|
115
|
+
const historyOptions = {
|
|
116
|
+
since: options.since,
|
|
117
|
+
eventLimit: options.eventLimit,
|
|
118
|
+
minimumSample: options.minimumSample,
|
|
119
|
+
};
|
|
120
|
+
const sharedWindow = options.provenanceCoverage || options.fleetAttribution
|
|
121
|
+
? await readHistoryAnalyticsWindow(pmRoot, historyOptions)
|
|
122
|
+
: undefined;
|
|
123
|
+
return {
|
|
124
|
+
provenanceCoverage: options.provenanceCoverage && sharedWindow
|
|
125
|
+
? projectProvenanceCoverageAnalytics(sharedWindow, settings.agent_identity?.harness_signals, historyOptions)
|
|
126
|
+
: undefined,
|
|
127
|
+
fleetAttribution: options.fleetAttribution && sharedWindow
|
|
128
|
+
? projectFleetAttributionAnalytics(sharedWindow, items, terminalStatuses, historyOptions)
|
|
129
|
+
: undefined,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function assembleStatsResult(totals, byType, byStatus, optional) {
|
|
133
|
+
const hasBreakdowns = Object.keys(optional.breakdowns).length > 0;
|
|
134
|
+
return {
|
|
135
|
+
totals,
|
|
136
|
+
by_type: byType,
|
|
137
|
+
by_status: byStatus,
|
|
138
|
+
...(optional.metadataCoverage
|
|
139
|
+
? { metadata_coverage: optional.metadataCoverage }
|
|
140
|
+
: {}),
|
|
141
|
+
...(hasBreakdowns ? { breakdowns: optional.breakdowns } : {}),
|
|
142
|
+
...(optional.storage ? { storage: optional.storage } : {}),
|
|
143
|
+
...(optional.fieldUtilization
|
|
144
|
+
? { field_utilization: optional.fieldUtilization }
|
|
145
|
+
: {}),
|
|
146
|
+
...(optional.improvementLedger
|
|
147
|
+
? { improvement_ledger: optional.improvementLedger }
|
|
148
|
+
: {}),
|
|
149
|
+
...(optional.recordedObservations.length > 0
|
|
150
|
+
? { recorded_observations: optional.recordedObservations }
|
|
151
|
+
: {}),
|
|
152
|
+
...(optional.provenanceCoverage
|
|
153
|
+
? { provenance_coverage: optional.provenanceCoverage }
|
|
154
|
+
: {}),
|
|
155
|
+
...(optional.fleetAttribution
|
|
156
|
+
? { fleet_attribution: optional.fleetAttribution }
|
|
157
|
+
: {}),
|
|
158
|
+
generated_at: nowIso(),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
76
161
|
/** Implements run stats for the public runtime surface of this module. */
|
|
77
162
|
export async function runStats(global, options = {}) {
|
|
78
163
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
@@ -80,6 +165,7 @@ export async function runStats(global, options = {}) {
|
|
|
80
165
|
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
81
166
|
}
|
|
82
167
|
const settings = await readSettings(pmRoot);
|
|
168
|
+
const recordedObservations = await recordStatsObservations(global, options);
|
|
83
169
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
84
170
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
85
171
|
// Field utilization needs the heavy collections (notes/learnings/files/docs/
|
|
@@ -116,36 +202,33 @@ export async function runStats(global, options = {}) {
|
|
|
116
202
|
const metadataCoverage = options.metadataCoverage
|
|
117
203
|
? computeMetadataCoverage(items, classifier)
|
|
118
204
|
: undefined;
|
|
119
|
-
const breakdowns =
|
|
120
|
-
if (options.byAssignee) {
|
|
121
|
-
breakdowns.assignee = groupItemsByDimension(items, "assignee", classifier);
|
|
122
|
-
}
|
|
123
|
-
if (options.byTag) {
|
|
124
|
-
breakdowns.tag = groupItemsByDimension(items, "tag", classifier, {
|
|
125
|
-
tagPrefix: options.tagPrefix,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
if (options.byPriority) {
|
|
129
|
-
breakdowns.priority = groupItemsByDimension(items, "priority", classifier);
|
|
130
|
-
}
|
|
131
|
-
const hasBreakdowns = Object.keys(breakdowns).length > 0;
|
|
205
|
+
const breakdowns = requestedBreakdowns(items, options, classifier);
|
|
132
206
|
const fieldUtilization = options.fieldUtilization
|
|
133
207
|
? computeContentFieldUtilization(items)
|
|
134
208
|
: undefined;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
209
|
+
const improvementLedger = options.measurements === true || recordedObservations.length > 0
|
|
210
|
+
? await readImprovementLedger({
|
|
211
|
+
pmRoot,
|
|
212
|
+
metric: options.metric,
|
|
213
|
+
itemId: options.measurementItem,
|
|
214
|
+
limit: options.measurementLimit,
|
|
215
|
+
})
|
|
216
|
+
: undefined;
|
|
217
|
+
const { provenanceCoverage, fleetAttribution } = await requestedHistoryAnalytics(pmRoot, items, settings, statusRegistry.terminal_statuses, options);
|
|
218
|
+
return assembleStatsResult({
|
|
219
|
+
items: items.length,
|
|
220
|
+
history_streams: streams.length,
|
|
221
|
+
history_entries: historyEntries,
|
|
222
|
+
}, byType, byStatus, {
|
|
223
|
+
metadataCoverage,
|
|
224
|
+
breakdowns,
|
|
225
|
+
storage,
|
|
226
|
+
fieldUtilization,
|
|
227
|
+
improvementLedger,
|
|
228
|
+
recordedObservations,
|
|
229
|
+
provenanceCoverage,
|
|
230
|
+
fleetAttribution,
|
|
231
|
+
});
|
|
149
232
|
}
|
|
150
233
|
//# sourceMappingURL=stats.js.map
|
|
151
|
-
//# debugId=
|
|
234
|
+
//# debugId=a4de53c1-bb22-591f-a064-142c642a2443
|
package/docs/COMMANDS.md
CHANGED
|
@@ -82,6 +82,8 @@ pm install npm:@scope/pm-package --project
|
|
|
82
82
|
pm package describe --project # by-name surface map of every loaded package
|
|
83
83
|
pm package describe my-package --markdown --output docs/my-package-reference.md
|
|
84
84
|
pm package doctor --project --detail summary
|
|
85
|
+
pm package migrate --project --dry-run --json
|
|
86
|
+
pm package migrate --project --json
|
|
85
87
|
pm upgrade --dry-run
|
|
86
88
|
pm upgrade --packages-only
|
|
87
89
|
pm upgrade --cli-only --repair
|
|
@@ -89,6 +91,13 @@ pm upgrade --cli-only --repair
|
|
|
89
91
|
|
|
90
92
|
`pm install` and `pm package` are the preferred package-first workflow. `pm package` and `pm extension` bare invocations default to `--explore` so agents can list installed packages without remembering an action flag. `pm install '*'`, shell-expanded `pm install *`, and `pm install all` install bundled first-party packages. `pm extension` remains as a compatibility command for direct extension lifecycle operations.
|
|
91
93
|
Install output includes a light `verification` summary with target tracker root, activation state, registered commands/actions/item types, and an `ok|degraded` health verdict. Runtime activation failure sets the command result and process exit status to failure; inspect `activation_diagnostics` and `command_discovery.next_steps` for the exact recovery path.
|
|
94
|
+
Bare install names use bundled aliases before installed npm packages. Every
|
|
95
|
+
install result reports `source_resolution`; when both candidates exist it marks
|
|
96
|
+
the choice ambiguous and provides explicit bare and `npm:` retry commands.
|
|
97
|
+
`package migrate` plans or applies active migration registrations and writes
|
|
98
|
+
durable workspace-history receipts; a successful migration is skipped on later
|
|
99
|
+
processes, while a failed migration remains retryable. `extension migrate` is
|
|
100
|
+
the compatibility spelling.
|
|
92
101
|
When package-owned commands are unavailable, usage guidance includes an install-ready retry (for example `pm install calendar`, `pm install search-advanced`, `pm install governance-audit`, or `pm install guide-shell`).
|
|
93
102
|
|
|
94
103
|
## Triage
|
package/docs/EXTENSIONS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Packages and Extensions
|
|
2
2
|
|
|
3
|
-
Extension flags declared with `list: true` accumulate repeated long/short alias occurrences and comma-separated values into one array. Dynamic commands preserve flag-like variadic content after `--`, and package handlers can use the public `suppressHostOutput()` protocol when they already emitted streaming, binary, or pre-rendered output. Declarative blueprints are also checked for reserved item-field collisions during SDK lint/preflight and harness activation, so a package cannot pass author-time validation and then fail only when users create or update items. Local archive installation, command ownership, and MCP custom-field diagnostics are tracked by [pm-lw6acw](../.agents/pm/issues/pm-lw6acw.toon), [pm-6z0wzf](../.agents/pm/issues/pm-6z0wzf.toon), and [pm-yfdav2](../.agents/pm/issues/pm-yfdav2.toon). Transactional mutation guards, host-bound command test SDKs, and installed custom-type lifecycle parity are tracked by [pm-hx23u5](../.agents/pm/issues/pm-hx23u5.toon), [pm-wx2lr5](../.agents/pm/issues/pm-wx2lr5.toon), and [pm-scga6k](../.agents/pm/issues/pm-scga6k.toon).
|
|
3
|
+
Extension flags declared with `list: true` accumulate repeated long/short alias occurrences and comma-separated values into one array. Dynamic commands preserve flag-like variadic content after `--`, and package handlers can use the public `suppressHostOutput()` protocol when they already emitted streaming, binary, or pre-rendered output. Declarative blueprints are also checked for reserved item-field collisions during SDK lint/preflight and harness activation, so a package cannot pass author-time validation and then fail only when users create or update items. Local archive installation, command ownership, and MCP custom-field diagnostics are tracked by [pm-lw6acw](../.agents/pm/issues/pm-lw6acw.toon), [pm-6z0wzf](../.agents/pm/issues/pm-6z0wzf.toon), and [pm-yfdav2](../.agents/pm/issues/pm-yfdav2.toon). Transactional mutation guards, host-bound command test SDKs, and installed custom-type lifecycle parity are tracked by [pm-hx23u5](../.agents/pm/issues/pm-hx23u5.toon), [pm-wx2lr5](../.agents/pm/issues/pm-wx2lr5.toon), and [pm-scga6k](../.agents/pm/issues/pm-scga6k.toon). Durable migration application, explicit source resolution, and composable preflight ownership are covered in [Extension Lifecycle Contracts](EXTENSION_LIFECYCLE.md).
|
|
4
4
|
|
|
5
5
|
Packages add optional `pm` workflows without changing the core CLI. A package can ship one or more runtime extensions plus metadata such as docs and examples. Prefer the package-first commands in new docs and automation:
|
|
6
6
|
|
|
@@ -38,7 +38,7 @@ pm install calendar --project
|
|
|
38
38
|
pm install search-advanced --project
|
|
39
39
|
pm install kanban --project
|
|
40
40
|
```
|
|
41
|
-
`pm install '*'`, `pm install all`, and shell-expanded `pm install *` are normalized to the same bundled install-all request. First-party package aliases come from each package manifest, with a fallback derived from the `packages/pm-*` directory name.
|
|
41
|
+
`pm install '*'`, `pm install all`, and shell-expanded `pm install *` are normalized to the same bundled install-all request. First-party package aliases come from each package manifest, with a fallback derived from the `packages/pm-*` directory name. A bare bundled alias that also names an installed npm package reports both explicit choices in `source_resolution`; see [Extension Lifecycle Contracts](EXTENSION_LIFECYCLE.md).
|
|
42
42
|
|
|
43
43
|
External registry packages are installed by exact package name. If `npm:<name>` returns a registry 404, JSON error output includes `fallback_candidates` and `next_best_command`; unpublished first-party packages fall back to `pm install --project github.com/unbraind/<name>`. Install results include package-owned `command_paths`, `action_paths`, `contributions`, `command_discovery`, and a light `verification` block covering the target tracker, activation status, registered commands/actions/item types, and health verdict. Agents should consume those fields instead of guessing from the package name or immediately spending another invocation on doctor. A successful activation persists the versioned contribution inventory in `.managed-extensions.json`; subsequent discovery can enumerate command handlers, hooks, parser/renderer targets, schema names, and the other registered surfaces without importing the package module. A failed runtime activation returns `ok: false`, `activated: false`, a non-zero CLI exit, and actionable diagnostics; missing SDK resolution adds an explicit dependency recovery step. Local installs are containment-safe when the extension destination is nested inside the source checkout: pm stages the package outside the source and prunes the destination, `.agents`, `node_modules`, and install-backup directories before copying, so reinstalling cannot recursively copy tracker history, host dependencies, or prior backups.
|
|
44
44
|
Local `.tgz` and `.tar.gz` npm archives are inspected and extracted in an isolated temporary directory without invoking a shell. Archives must contain one `package/package.json` root, regular files/directories only, and bounded entry and expanded-byte totals. Absolute paths, traversal, alternate roots, links, device entries, oversized entries, and decompression-ratio abuse fail before installation. The managed source remains the original archive path, so reload and upgrade provenance do not point at a temporary extraction directory.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Extension Lifecycle Contracts
|
|
2
|
+
|
|
3
|
+
Tracked by [pm-ig5cfe](../.agents/pm/issues/pm-ig5cfe.toon),
|
|
4
|
+
[pm-495lkc](../.agents/pm/issues/pm-495lkc.toon), and
|
|
5
|
+
[pm-miy5k6](../.agents/pm/issues/pm-miy5k6.toon).
|
|
6
|
+
|
|
7
|
+
## Explicit Install-Source Identity
|
|
8
|
+
|
|
9
|
+
A bare target may name both a bundled alias and an already-installed npm
|
|
10
|
+
package. pm preserves the bundled-first compatibility rule but never hides the
|
|
11
|
+
choice. Install results include `source_resolution` with the selected source,
|
|
12
|
+
an `ambiguous` indicator, every matching candidate, and an explicit command for
|
|
13
|
+
each. Use `pm install npm:<package>` to force npm identity or the reported bare
|
|
14
|
+
alias command to force the bundled package. Install-all results carry the same
|
|
15
|
+
receipt on every package row.
|
|
16
|
+
|
|
17
|
+
## Durable Extension Migrations
|
|
18
|
+
|
|
19
|
+
Active packages register schema migrations through `api.registerMigration`.
|
|
20
|
+
Runtime preflight applies runnable migrations, and operators can plan or apply
|
|
21
|
+
the same registrations explicitly:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pm package migrate --project --dry-run --json
|
|
25
|
+
pm package migrate --project --json
|
|
26
|
+
pm health --check-only --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`pm extension migrate` is the compatibility spelling. The SDK exposes
|
|
30
|
+
`runExtensionMigrations`, `PmClient.packageMigrate`, and the one-shot
|
|
31
|
+
`packageMigrate`/`extensionMigrate` helpers. Dry-run never invokes package code
|
|
32
|
+
or writes state. Apply records deterministic per-migration receipts in
|
|
33
|
+
`.agents/pm/extension-migrations.json` through workspace history. Successful
|
|
34
|
+
migrations become idempotent `skipped` rows in later processes. Failures retain
|
|
35
|
+
their error for health diagnostics and are retried on the next apply. Project
|
|
36
|
+
scope includes active project and global packages because both affect that
|
|
37
|
+
workspace; `--global` restricts execution to global registrations.
|
|
38
|
+
|
|
39
|
+
## Scoped Preflight Ownership
|
|
40
|
+
|
|
41
|
+
`definePreflightOverride` and `api.registerPreflight` accept
|
|
42
|
+
`{ commands, run }`. Command paths are normalized, disjoint registrations
|
|
43
|
+
compose without warnings, and runtime invokes only the matching owner. Empty or
|
|
44
|
+
omitted command ownership retains the legacy global behavior and collides with
|
|
45
|
+
every other override. Activation summaries and persisted contribution
|
|
46
|
+
inventories expose `preflight_ownership` for static doctor and tooling output.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Improvement Ledger and History Analytics
|
|
2
|
+
|
|
3
|
+
Tracker references: [pm-chahyq](../.agents/pm/features/pm-chahyq.toon), [pm-1wiugq](../.agents/pm/issues/pm-1wiugq.toon), [pm-gw6uyq](../.agents/pm/features/pm-gw6uyq.toon)
|
|
4
|
+
|
|
5
|
+
`pm` treats project management as context management. Improvement observations and fleet analytics therefore remain attached to authoritative project context: observations are audited workspace state, while provenance and outcome analytics are bounded projections of immutable history.
|
|
6
|
+
|
|
7
|
+
## Agent Quick Context
|
|
8
|
+
|
|
9
|
+
- Record quantitative evidence with `pm stats --analytics '{...}'`; do not hand-edit `.agents/pm/improvement-ledger.json`.
|
|
10
|
+
- Request ledger and history projections through the single typed `--analytics` JSON object. This keeps the agent-facing command contract bounded while the SDK and MCP retain their fully typed fields.
|
|
11
|
+
- Ledger reads are newest-first and bounded; trends still use every matching retained observation.
|
|
12
|
+
- Use an explicit metric direction. `lower` is the default; `target` requires a threshold and measures convergence toward it.
|
|
13
|
+
- Use `provenanceCoverage` to find declared-but-inert or undeclared provenance dimensions.
|
|
14
|
+
- Use `fleetAttribution` for observational comparisons only. It must never authorize, assign, route, rank, or evaluate an individual agent.
|
|
15
|
+
- Bound history work with `since`, `eventLimit`, and `minimumSample`.
|
|
16
|
+
|
|
17
|
+
## Audited improvement observations
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pm stats \
|
|
21
|
+
--analytics "$(jq -cn --arg revision "$(git rev-parse HEAD)" '{
|
|
22
|
+
observe: ["quality.coverage.lines=100,unit=percent,threshold=100"],
|
|
23
|
+
direction: "higher",
|
|
24
|
+
measurementSource: "pnpm coverage",
|
|
25
|
+
measurementItem: "pm-example",
|
|
26
|
+
measurementRevision: $revision,
|
|
27
|
+
measurements: true
|
|
28
|
+
}')" \
|
|
29
|
+
--json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each observation records a content identity, metric, finite value, direction, timestamp, revision provenance, author, and optional unit, threshold, source, and owning item. When no revision is supplied, `pm` uses Git HEAD when available and otherwise records an explicit `unversioned` marker.
|
|
33
|
+
|
|
34
|
+
Retries are idempotent by revision, metric, source, and owner. Reusing that key with different numeric or metric-contract data fails with a conflict instead of silently rewriting history. A metric keeps one direction, unit, and—when target-directed—target threshold throughout its series.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pm stats --analytics '{"measurements":true,"metric":"quality.coverage.lines","measurementLimit":20}'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `improvement_ledger` result contains:
|
|
41
|
+
|
|
42
|
+
- `observations`: a bounded newest-first page;
|
|
43
|
+
- `total` and `truncated`: the complete match count and omission state;
|
|
44
|
+
- `trends`: baseline, latest, delta, improvement state, and sample count per metric;
|
|
45
|
+
- `source: audited_workspace_singleton`: the state provenance receipt.
|
|
46
|
+
|
|
47
|
+
The singleton is written through the workspace lock and `_workspace` hash-chained audit stream. Compaction may reduce historical patches, but it does not remove current ledger state.
|
|
48
|
+
|
|
49
|
+
## Provenance coverage
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pm stats --analytics '{"provenanceCoverage":true,"since":"-30d","eventLimit":10000,"minimumSample":5}' --json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This projection compares configured harness signal descriptors with observed immutable history. It reports descriptor coverage, observed/unavailable/legacy-missing values, inert dimensions with sufficient explicit samples, undeclared dimensions, and stable warning codes. The live corpus is the positive control; deliberately missing descriptors and unavailable values provide negative controls in tests.
|
|
56
|
+
|
|
57
|
+
## Fleet attribution
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pm stats --analytics '{"fleetAttribution":true,"since":"-30d","eventLimit":10000,"minimumSample":5}' --json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Fleet attribution groups bounded events by harness, model, and author source. Each group reports state and annotation events, terminal transitions, reopens, and issues linked with `discovered_from` to closed work. Rates remain `null` until the close denominator reaches `minimum_sample`.
|
|
64
|
+
|
|
65
|
+
The result always includes `policy: observational_only_not_for_authorization_or_routing`. Missing dimensions are `unavailable`, small denominators are `insufficient`, and a `window` receipt states the lower bound, consumed event count, truncation, and continuation cursor.
|
|
66
|
+
|
|
67
|
+
## SDK
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import {
|
|
71
|
+
readImprovementLedger,
|
|
72
|
+
recordImprovementObservation,
|
|
73
|
+
runFleetAttributionAnalytics,
|
|
74
|
+
runProvenanceCoverageAnalytics,
|
|
75
|
+
} from "@unbrained/pm-cli/sdk";
|
|
76
|
+
|
|
77
|
+
await recordImprovementObservation(
|
|
78
|
+
{
|
|
79
|
+
metric: "quality.coverage.lines",
|
|
80
|
+
value: 100,
|
|
81
|
+
direction: "higher",
|
|
82
|
+
unit: "percent",
|
|
83
|
+
revision: process.env.GIT_COMMIT,
|
|
84
|
+
},
|
|
85
|
+
{ path: ".agents/pm" },
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
const ledger = await readImprovementLedger({
|
|
89
|
+
pmRoot: ".agents/pm",
|
|
90
|
+
metric: "quality.coverage.lines",
|
|
91
|
+
limit: 20,
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`PmClient.stats()` exposes the combined typed contract. The lower-level functions support packages that need one primitive without constructing a command transport. MCP uses the same action schema; its direction field is named `improvementDirection` to avoid collision with dependency-graph traversal direction. The CLI deliberately folds the new analytics fields into one validated `--analytics` object so its help and contract surface stay within the enforced agent-token budget.
|
|
96
|
+
|
|
97
|
+
## Safety and interpretation
|
|
98
|
+
|
|
99
|
+
- Treat observations as evidence, not a universal objective function. Record the producing gate and owning item so context survives.
|
|
100
|
+
- Compare like-for-like metric contracts; a changed unit, direction, or target should use a new metric name.
|
|
101
|
+
- Do not infer causality from attribution. The projection describes recorded history and relationship links only.
|
|
102
|
+
- A truncated window is incomplete evidence. Resume or increase the bound before publishing conclusions.
|
|
103
|
+
- Keep credentials, private payloads, host identifiers, and customer data out of metric names, sources, messages, and item links.
|
|
@@ -213,19 +213,19 @@ metadata as a continuation negative control. The checked-in report is
|
|
|
213
213
|
|
|
214
214
|
| Intent | 2-item tokens / budget | 2,243-item tokens / budget | Current-scale rows | Degradation |
|
|
215
215
|
| ------ | ---------------------- | -------------------------- | ------------------ | ----------- |
|
|
216
|
-
| `context:orient` |
|
|
216
|
+
| `context:orient` | 735 / 2,400 | 1,028 / 2,400 | 3 | bounded sections |
|
|
217
217
|
| `get:inspect` | 401 / 3,200 | 415 / 3,200 | item envelope | standard item |
|
|
218
|
-
| `list:triage` |
|
|
218
|
+
| `list:triage` | 443 / 3,200 | 3,189 / 3,200 | 69 | budget-derived rows |
|
|
219
219
|
| `next:execute` | 395 / 1,200 | 1,171 / 1,200 | 14 | budget-derived rows |
|
|
220
|
-
| `search:discover` |
|
|
220
|
+
| `search:discover` | 350 / 1,800 | 1,761 / 1,800 | 27 | budget-derived rows |
|
|
221
221
|
|
|
222
222
|
Whole-answer cursor cost is measured against the unprojected single call for
|
|
223
223
|
the identical ordered row set:
|
|
224
224
|
|
|
225
225
|
| Family | Rows | Pages | Optimized bytes/row | Optimized walk | Repeated-metadata control | Unbounded call | Walk / unbounded |
|
|
226
226
|
| ------ | ---- | ----- | ------------------- | -------------- | ------------------------- | -------------- | ---------------- |
|
|
227
|
-
| `list:triage` | 1,998 |
|
|
228
|
-
| `search:discover` | 1,998 |
|
|
227
|
+
| `list:triage` | 1,998 | 31 | 172.93 | 345,519 B | 387,489 B | 1,558,741 B | 0.2217 |
|
|
228
|
+
| `search:discover` | 1,998 | 66 | 202.50 | 404,591 B | 470,046 B | 1,681,847 B | 0.2406 |
|
|
229
229
|
|
|
230
230
|
These are corpus-generated figures, not live tracker payloads. The generated
|
|
231
231
|
corpus contains 2,243 items; the `status:all` query intentionally excludes 245
|
package/docs/README.md
CHANGED
|
@@ -53,12 +53,14 @@ pm guide release --json
|
|
|
53
53
|
- [Agent Provenance ADR Amendment](AGENT_PROVENANCE_ADR.md) - extensible model, effort, role, and host provenance with privacy and compatibility boundaries.
|
|
54
54
|
- [SDK Agent Session and Episode Context](SDK_AGENT_SESSION_CONTEXT.md) - inherited role/topic context, cross-process episode identity, and deterministic history grouping.
|
|
55
55
|
- [SDK Context Coordination](SDK_CONTEXT_COORDINATION.md) - durable mutation events, bounded duplicate governance, and scale-safe package primitives.
|
|
56
|
+
- [Improvement Ledger and History Analytics](IMPROVEMENT_ANALYTICS.md) - audited quantitative observations, live provenance coverage, and bounded observational fleet outcomes.
|
|
56
57
|
- [SDK Evidence Traceability and Integrity](SDK_EVIDENCE_TRACEABILITY.md) - reverse source-to-item lookup, atomic evidence replacement, no-op history, linked-test collision classification, and telemetry drain receipts.
|
|
57
58
|
- [SDK Context Integrity Primitives](SDK_CONTEXT_INTEGRITY_PRIMITIVES.md) - batch duplicate discovery, structured errors, Plan evidence/lifecycle, sparse settings, tombstones, linked-test output, relocation diagnostics, and scoped output services.
|
|
58
59
|
- [Reproducible Workspaces and Snapshots](REPRODUCIBLE_WORKSPACES.md) - deterministic SDK recipes and content-addressed authoritative tracker restore points.
|
|
59
60
|
- [Portable Corpus Shapes](CORPUS_SHAPES.md) - versioned SDK populations for realistic benchmarks, evaluations, and package tests.
|
|
60
61
|
- [Agent UX Contracts](AGENT_UX_CONTRACTS.md) - ordering-cycle advisories, graph count units, collision safety, compact context, ownership wording, and recovery behavior.
|
|
61
62
|
- [Packages and Extensions](EXTENSIONS.md) - package install workflows, runtime extension lifecycle, and API reference.
|
|
63
|
+
- [Extension Lifecycle Contracts](EXTENSION_LIFECYCLE.md) - source identity, durable migrations, and scoped preflight ownership.
|
|
62
64
|
- [Extension Author Contracts](EXTENSION_AUTHOR_CONTRACTS.md) - the stability guarantees and contract surface package authors build against.
|
|
63
65
|
- [SDK](SDK.md) - public import surfaces and typed authoring examples.
|
|
64
66
|
- [Multi-Branch Merge Safety](MERGE_SAFETY.md) - semantic tracker merge drivers, post-merge integrity gates, delete/modify policy, and recovery-receipt retention.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Universal Read Output Contracts
|
|
2
2
|
|
|
3
|
-
Tracker references: [pm-hb7ug8](../.agents/pm/features/pm-hb7ug8.toon)
|
|
3
|
+
Tracker references: [pm-hb7ug8](../.agents/pm/features/pm-hb7ug8.toon), [pm-cxr0jb](../.agents/pm/features/pm-cxr0jb.toon), [pm-hid9g1](../.agents/pm/features/pm-hid9g1.toon), and [pm-sb0tns](../.agents/pm/issues/pm-sb0tns.toon).
|
|
4
4
|
|
|
5
5
|
## Agent Quick Context
|
|
6
6
|
|
|
@@ -15,6 +15,58 @@ Every built-in read surface uses four output dimensions: what to include, how mu
|
|
|
15
15
|
|
|
16
16
|
The contract covers `list`, `context`, `search`, `get`, `next`, `health`, `deps`, `graph`, `history`, `activity`, `validate`, `events`, `contracts`, `comments`, `notes`, `files`, `docs`, `stats`, and `aggregate`, including list aliases and `ctx`.
|
|
17
17
|
|
|
18
|
+
Row shaping follows each envelope's `row_contract.row_keys`, including
|
|
19
|
+
dot-delimited nested arrays and object maps such as `graph.nodes`. Include,
|
|
20
|
+
amount, repeat suppression, and cost compaction therefore operate on the same
|
|
21
|
+
machine-declared rows; they do not rely on command-specific top-level keys.
|
|
22
|
+
|
|
23
|
+
## Cross-Call Context Sessions
|
|
24
|
+
|
|
25
|
+
`--output-session <json>` / `outputSession` composes the four per-call
|
|
26
|
+
dimensions across a request group. The caller supplies versioned state and
|
|
27
|
+
passes the returned `read_session.next_state` to the next read:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"version": 1,
|
|
32
|
+
"id": "orientation",
|
|
33
|
+
"token_budget": 4000,
|
|
34
|
+
"spent_tokens": 0,
|
|
35
|
+
"seen_item_ids": []
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The session ceiling and an explicit `--output-budget` both bind; the smaller
|
|
40
|
+
remaining allowance wins. Rows for item facts already present in the caller's
|
|
41
|
+
context become `{ "id": "pm-a1b2", "context_ref":
|
|
42
|
+
"session:orientation:pm-a1b2" }` instead of repeating prose. References retain
|
|
43
|
+
stable item identity and can be restored with `pm get <item-id> --brief` when
|
|
44
|
+
the prior context is unavailable. The receipt reports estimated and charged
|
|
45
|
+
tokens separately when the remaining group allowance is smaller than the
|
|
46
|
+
minimum control envelope, plus the accumulated spend, remaining capacity,
|
|
47
|
+
newly served items, and suppressed repeats.
|
|
48
|
+
|
|
49
|
+
Session state is deliberately caller-carried: CLI processes, SDK clients, MCP
|
|
50
|
+
hosts, and packages share the same deterministic primitive without a hidden
|
|
51
|
+
daemon or mutable cache. Validation rejects unknown fields, invalid identifiers,
|
|
52
|
+
unsupported schema versions, unsafe integers, and spend beyond the declared
|
|
53
|
+
ceiling before a read executes.
|
|
54
|
+
|
|
55
|
+
The mandatory orientation calibration runs `context`, `list`, `search`, `get`,
|
|
56
|
+
and `next` against both a two-item tracker and a 2,243-item tracker. Its
|
|
57
|
+
cross-call ceilings are strict: complete serialized bytes and cumulative spend
|
|
58
|
+
may only shrink, while repeat suppression may only hold or improve. The gate
|
|
59
|
+
also fixes the expected unique-fact shape:
|
|
60
|
+
|
|
61
|
+
| Tracker tier | Group spend / budget | Seen items | Suppressed repeats | Delivered bytes |
|
|
62
|
+
| ------------ | -------------------- | ---------- | ------------------ | --------------- |
|
|
63
|
+
| 2 items | 3,663 / 20,000 | 2 | 3 | 14,646 |
|
|
64
|
+
| 2,243 items | 9,999 / 20,000 | 106 | 7 | 39,985 |
|
|
65
|
+
|
|
66
|
+
These are deterministic synthetic-corpus measurements from
|
|
67
|
+
`scripts/release/context-intent-calibration.json`; they contain no hosted
|
|
68
|
+
tracker content.
|
|
69
|
+
|
|
18
70
|
## Precedence and Compatibility
|
|
19
71
|
|
|
20
72
|
Resolution is deterministic: canonical controls win over command-local compatibility options, which win over intent defaults, which win over command defaults. Existing options such as `--fields`, `--limit`, `--token-budget`, `--format`, `--brief`, and `--full` remain accepted. Contract output marks them as hidden compatibility aliases and supplies a migration hint; traversal, cursor, side-effect, and streaming controls instead receive an explicit behavior-preservation hint because a static output control cannot replace their semantics. Callers that omit the canonical controls receive the byte-identical established result.
|
|
@@ -41,6 +93,13 @@ const result = await pm.list({
|
|
|
41
93
|
outputInclude: "id,title,status",
|
|
42
94
|
outputLimit: 10,
|
|
43
95
|
outputBudget: 800,
|
|
96
|
+
outputSession: {
|
|
97
|
+
version: 1,
|
|
98
|
+
id: "orientation",
|
|
99
|
+
token_budget: 4000,
|
|
100
|
+
spent_tokens: 0,
|
|
101
|
+
seen_item_ids: [],
|
|
102
|
+
},
|
|
44
103
|
});
|
|
45
104
|
```
|
|
46
105
|
|
package/docs/RELEASING.md
CHANGED
|
@@ -20,7 +20,8 @@ Tracked documentation work: [pm-u9d0](../.agents/pm/epics/pm-u9d0.toon),
|
|
|
20
20
|
[pm-4s24d2](../.agents/pm/issues/pm-4s24d2.toon),
|
|
21
21
|
[pm-39cqqx](../.agents/pm/tasks/pm-39cqqx.toon), stable peer compatibility
|
|
22
22
|
[pm-csuce0](../.agents/pm/issues/pm-csuce0.toon), and artifact budgets
|
|
23
|
-
[pm-998juj](../.agents/pm/tasks/pm-998juj.toon)
|
|
23
|
+
[pm-998juj](../.agents/pm/tasks/pm-998juj.toon), plus exact-tag recovery
|
|
24
|
+
[pm-lwnifd](../.agents/pm/issues/pm-lwnifd.toon).
|
|
24
25
|
|
|
25
26
|
## Version Policy
|
|
26
27
|
|
|
@@ -232,11 +233,14 @@ git push origin v<version>
|
|
|
232
233
|
`.github/workflows/release.yml` runs on `v*.*.*` tags and handles:
|
|
233
234
|
|
|
234
235
|
- full-history checkout
|
|
235
|
-
- manual `workflow_dispatch` by tag for recovery
|
|
236
|
+
- manual `workflow_dispatch` by tag for recovery. An authenticated exact-version probe keeps already-published access recovery on the reviewed dispatch-time `main` source; when the immutable tag exists but npm publication never completed, recovery checks out that exact tagged source and retains the original version guard
|
|
236
237
|
- pnpm install with frozen lockfile
|
|
237
238
|
- version policy and tag guard
|
|
238
239
|
- secret scan
|
|
239
|
-
- build, typecheck, test, and coverage
|
|
240
|
+
- build, clone-local merge-driver installation, typecheck, test, and coverage
|
|
241
|
+
- generated changelog verification and `pm-changelog` installation before the
|
|
242
|
+
tracker-bearing static gate, so a clean checkout does not misclassify the
|
|
243
|
+
managed extension's linked files as missing
|
|
240
244
|
- static quality gate (shared complexity, duplication, dead/orphan module, file/folder hygiene, source/exported docstring coverage profile)
|
|
241
245
|
- temporary-project compatibility gate against latest published tracker data
|
|
242
246
|
- reliability threshold gate (Sentry severity threshold, bounded to a recent-activity window via `--sentry-window-days` (default `14`, `0` = unbounded) so a stale benign unresolved issue cannot block every scheduled release; `--telemetry-mode` gate policy: `off` | `best-effort` | `required`). Scheduled `auto-release.yml` failures open/update an `Auto Release blocked` GitHub issue so blocked daily releases are never silently skipped.
|
|
@@ -248,7 +252,10 @@ git push origin v<version>
|
|
|
248
252
|
- `npm publish --access public --provenance --tag latest`, skipped on retry
|
|
249
253
|
only when the exact version is anonymously visible from a fresh npm cache.
|
|
250
254
|
If the package is public but the target version is absent, the workflow
|
|
251
|
-
publishes immediately without attempting a package-access mutation.
|
|
255
|
+
publishes immediately without attempting a package-access mutation. A
|
|
256
|
+
dispatch may do so only when its source-selection preflight pinned the
|
|
257
|
+
checkout to the requested immutable tag; reviewed-main recovery continues
|
|
258
|
+
to refuse publication of a missing target. Only
|
|
252
259
|
when neither the target nor package metadata is anonymously visible does the
|
|
253
260
|
same-tag recovery path attempt to restore public package access, because a
|
|
254
261
|
hidden version can also return 404 to authenticated metadata reads. After a
|
|
@@ -272,7 +279,7 @@ git push origin v<version>
|
|
|
272
279
|
`scripts/release/verify-installed-agent-session.mjs`. Separate npm and Bun
|
|
273
280
|
install roots must contain the resolved executable, then each drives the
|
|
274
281
|
cold-start `init -> context -> create -> claim -> annotate -> files -> close
|
|
275
|
-
|
|
282
|
+
-> validate -> get -> context` loop. The structured report identifies the
|
|
276
283
|
failing step and records per-step output ceilings and estimated token cost.
|
|
277
284
|
- GitHub Release creation
|
|
278
285
|
- GitHub Release metadata verification through the same local verification script
|
|
@@ -312,25 +319,31 @@ Use the npm registry package for maintainer global updates. Do not use `npm inst
|
|
|
312
319
|
ordinal recovery version. Rerun `.github/workflows/release.yml` with
|
|
313
320
|
`workflow_dispatch` and `tag=v<version>` (or close the current bot-created
|
|
314
321
|
blocker once to trigger the guarded exact-run recovery). The workflow skips
|
|
315
|
-
duplicate npm publication for an anonymously visible version
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
immutable
|
|
322
|
+
duplicate npm publication for an anonymously visible version. Before
|
|
323
|
+
installing or running gates, dispatch performs an authenticated exact-version
|
|
324
|
+
probe. An
|
|
325
|
+
existing version keeps the reviewed dispatch-time `main` source and cannot
|
|
326
|
+
be republished. A definitive missing-version response pins the checkout to
|
|
327
|
+
the existing immutable tag, reapplies the version guard, installs the managed
|
|
328
|
+
changelog extension before tracker measurement, and permits first publication
|
|
329
|
+
only from that exact tagged source. Other registry failures stop before
|
|
330
|
+
source selection or publication.
|
|
321
331
|
- If an immutable published package contains a defect that cannot be repaired
|
|
322
332
|
by rerunning the same tag workflow, document the incident and ship the code
|
|
323
333
|
fix in the next UTC day's release.
|
|
324
|
-
- A manual exact-tag `workflow_dispatch` recovery
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
334
|
+
- A manual exact-tag `workflow_dispatch` recovery uses isolated anonymous
|
|
335
|
+
registry probes before any account-level access mutation. A visible package
|
|
336
|
+
with a missing target version proceeds directly to exact-tag publication, so
|
|
337
|
+
a publish-capable automation token is not required to change package access.
|
|
338
|
+
Access recovery is reserved for the ambiguous case where neither the package
|
|
339
|
+
nor target version is anonymously visible. An already-visible immutable
|
|
340
|
+
version is still verified and never republished. Recovery starts from the
|
|
328
341
|
dispatch-time commit SHA and fails unless the dispatch ref is the repository
|
|
329
|
-
default branch (`main`)
|
|
330
|
-
version
|
|
331
|
-
the
|
|
332
|
-
|
|
333
|
-
|
|
342
|
+
default branch (`main`). It remains on that reviewed source when the exact
|
|
343
|
+
npm version exists. When the version is definitively absent, it switches to
|
|
344
|
+
the resolved commit behind `RELEASE_TAG`, requires `package.json` to match the
|
|
345
|
+
tag, installs the clone-local merge driver and managed changelog extension,
|
|
346
|
+
and may publish that exact source after every gate passes.
|
|
334
347
|
- Record failure evidence and remediation in the release `pm` item.
|
|
335
348
|
|
|
336
349
|
### Silent skip debugging
|