@unbrained/pm-cli 2026.8.20 → 2026.8.21
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 +22 -0
- package/dist/cli/error-guidance.d.ts +20 -0
- package/dist/cli/error-guidance.js +29 -30
- package/dist/cli-bundle/bundle-manifest.json +151 -151
- package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +197 -0
- package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-3AFAUHUE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7VHZS727.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BKYB45NQ.js} +68 -68
- package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-BUNIEJNE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-JSLOFXGA.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-LARJJ3RK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-LOVTQ52Z.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-N3DSV4CH.js} +47 -47
- package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +35 -0
- package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +13 -0
- package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-F57EWDEF.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-7IY2D5KO.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-FALL3YTU.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-HXU7IZZD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-2NIY5NKG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-4ERLO7QD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +50 -0
- package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-CKKQSJNN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-GXWQBE3T.js → chunk-F2A56DHV.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-F4YEW5I2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-FH6DYED3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-FJ22HNRP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-Q47EX4DI.js → chunk-JEAVFOWM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-KDNG7TKQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +155 -0
- package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-JWKEDZJI.js → chunk-TJ7EMJ46.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-UZE7XUZK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-YKBKIEAJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-ZOSEELYJ.js} +2 -2
- package/dist/cli-bundle/main.js +12 -12
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -2
- package/dist/cli-bundle/sdk-core.js +40 -40
- 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 +32 -32
- 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 +5 -5
- package/dist/core/shared/errors.d.ts +16 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/store/item-store.js +6 -91
- package/dist/core/store/tracker-preflight.d.ts +7 -0
- package/dist/core/store/tracker-preflight.js +142 -0
- package/dist/sdk/agent/tracker-preflight-contracts.d.ts +63 -0
- package/dist/sdk/agent/tracker-preflight-contracts.js +127 -0
- package/dist/sdk/annotations.js +6 -7
- package/dist/sdk/config.d.ts +5 -0
- package/dist/sdk/config.js +5 -5
- package/dist/sdk/context-intent-runtime.js +7 -4
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/dependencies.js +5 -7
- package/dist/sdk/dependency-flag-validation.d.ts +1 -1
- package/dist/sdk/dependency-flag-validation.js +10 -4
- package/dist/sdk/environment/tracker-preflight.d.ts +6 -0
- package/dist/sdk/environment/tracker-preflight.js +10 -0
- package/dist/sdk/eval.js +5 -7
- package/dist/sdk/files.js +6 -10
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +39 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +69 -8
- package/dist/sdk/governance/assurance.d.ts +36 -2
- package/dist/sdk/governance/assurance.js +184 -10
- package/dist/sdk/governance/gc.js +5 -6
- package/dist/sdk/governance/health.js +5 -6
- package/dist/sdk/governance/reindex.js +5 -6
- package/dist/sdk/governance/validate.d.ts +1 -2
- package/dist/sdk/governance/validate.js +6 -12
- package/dist/sdk/graph/governance.d.ts +7 -5
- package/dist/sdk/graph/governance.js +32 -16
- package/dist/sdk/graph/run.js +5 -7
- package/dist/sdk/graph/traversal.js +14 -5
- package/dist/sdk/history-compact.js +6 -9
- package/dist/sdk/history-read.js +5 -7
- package/dist/sdk/history-redact.js +5 -6
- package/dist/sdk/history-repair.js +6 -9
- package/dist/sdk/improvement-ledger.js +7 -10
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +4 -2
- package/dist/sdk/lifecycle/append.d.ts +0 -5
- package/dist/sdk/lifecycle/append.js +5 -6
- package/dist/sdk/lifecycle/claim.d.ts +0 -5
- package/dist/sdk/lifecycle/claim.js +6 -9
- package/dist/sdk/lifecycle/close-many.d.ts +0 -5
- package/dist/sdk/lifecycle/close-many.js +5 -6
- package/dist/sdk/lifecycle/close.d.ts +0 -5
- package/dist/sdk/lifecycle/close.js +5 -6
- package/dist/sdk/lifecycle/copy.d.ts +0 -5
- package/dist/sdk/lifecycle/copy.js +5 -6
- package/dist/sdk/lifecycle/create.d.ts +0 -5
- package/dist/sdk/lifecycle/create.js +5 -9
- package/dist/sdk/lifecycle/delete.js +5 -6
- package/dist/sdk/lifecycle/focus.d.ts +0 -5
- package/dist/sdk/lifecycle/focus.js +5 -6
- package/dist/sdk/lifecycle/plan.d.ts +0 -5
- package/dist/sdk/lifecycle/plan.js +5 -6
- package/dist/sdk/lifecycle/restore.js +5 -6
- package/dist/sdk/lifecycle/update-many.d.ts +0 -5
- package/dist/sdk/lifecycle/update-many.js +5 -6
- package/dist/sdk/lifecycle/update.d.ts +0 -5
- package/dist/sdk/lifecycle/update.js +48 -9
- package/dist/sdk/linked-artifacts.js +6 -7
- package/dist/sdk/merge/install.js +5 -6
- package/dist/sdk/mutation-events.js +5 -7
- package/dist/sdk/package-import-adapters.js +6 -8
- package/dist/sdk/profile.js +6 -7
- package/dist/sdk/query/activity.js +5 -6
- package/dist/sdk/query/calendar.js +5 -6
- package/dist/sdk/query/get.d.ts +0 -5
- package/dist/sdk/query/get.js +5 -6
- package/dist/sdk/query/history.d.ts +0 -5
- package/dist/sdk/query/history.js +5 -6
- package/dist/sdk/query/list.js +5 -7
- package/dist/sdk/query/search.js +5 -7
- package/dist/sdk/relationship-kinds/contract.d.ts +8 -0
- package/dist/sdk/relationship-kinds/contract.js +13 -13
- package/dist/sdk/relationships.d.ts +1 -1
- package/dist/sdk/relationships.js +20 -2
- package/dist/sdk/schema-migration.js +6 -7
- package/dist/sdk/schema.js +5 -6
- package/dist/sdk/stats.js +5 -8
- package/dist/sdk/templates.js +5 -6
- package/dist/sdk/test/batch.js +5 -7
- package/dist/sdk/test/execution.js +4 -5
- package/dist/sdk/test/runs.js +5 -7
- package/docs/AGENT_UX_CONTRACTS.md +8 -1
- package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -1
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
- package/docs/RELATIONSHIP_GRAPH.md +92 -10
- package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
- 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-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +255 -21
- package/dist/cli-bundle/chunks/chunk-2RDVGYWE.js +0 -13
- package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +0 -35
- package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +0 -5
- package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +0 -197
- package/dist/cli-bundle/focused-chunks/chunk-6AHG2YW7.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-RIHDMCUM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Implements the exported pm cli error runtime abstraction for core/shared/errors.ts. */
|
|
2
2
|
|
|
3
|
-
!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]="
|
|
3
|
+
!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]="e8873345-5824-5832-9fa3-79719ddc6b58")}catch(e){}}();
|
|
4
4
|
export class PmCliError extends Error {
|
|
5
5
|
/** Value that configures or reports exit code for this contract. */
|
|
6
6
|
exitCode;
|
|
@@ -18,4 +18,4 @@ export class PmCliError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=errors.js.map
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=e8873345-5824-5832-9fa3-79719ddc6b58
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Reads and writes tracker storage with format-aware helpers for Item Store.
|
|
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]="f49b5141-f348-5954-a87e-8fd957593113")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import { getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnReadHooks, runActiveBeforeMutationHooks, runActiveOnWriteHooks, runActiveServiceOverride, } from "../extensions/index.js";
|
|
@@ -22,6 +22,7 @@ import { normalizeItemId, normalizeRawItemId } from "../item/id.js";
|
|
|
22
22
|
import { acquireItemMetadataDerivedIndexLock, listAllDocumentCandidatesCached, listAllDocumentsCached, listAllDocumentsCachedLight, refreshItemMetadataDerivedIndex, } from "./item-metadata-cache.js";
|
|
23
23
|
import { getHistoryPath, getItemPath, ITEM_FILE_EXTENSIONS } from "./paths.js";
|
|
24
24
|
import { resolveGovernanceKnobs } from "./settings.js";
|
|
25
|
+
import { assertReadableTrackerRoot } from "./tracker-preflight.js";
|
|
25
26
|
import { resolveClaimPrincipal } from "../shared/author.js";
|
|
26
27
|
import { nowIso } from "../shared/time.js";
|
|
27
28
|
async function fileExists(targetPath) {
|
|
@@ -60,92 +61,6 @@ function resolveItemFormatSearchOrder(preferredFormat) {
|
|
|
60
61
|
}
|
|
61
62
|
return ["toon", "json_markdown"];
|
|
62
63
|
}
|
|
63
|
-
function trackerRootNotDirectoryError(pmRoot) {
|
|
64
|
-
return new PmCliError(`Tracker root is not a directory at ${pmRoot}.`, EXIT_CODE.USAGE, {
|
|
65
|
-
code: "tracker_root_not_directory",
|
|
66
|
-
reason: "not_a_directory",
|
|
67
|
-
nextSteps: [
|
|
68
|
-
"Pass the tracker directory itself, usually <workspace>/.agents/pm.",
|
|
69
|
-
],
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function trackerRootUnreadableError(pmRoot) {
|
|
73
|
-
return new PmCliError(`Tracker root is not readable at ${pmRoot}.`, EXIT_CODE.GENERIC_FAILURE, {
|
|
74
|
-
code: "tracker_root_unreadable",
|
|
75
|
-
reason: "unreadable",
|
|
76
|
-
nextSteps: [
|
|
77
|
-
"Grant read and directory-search permission to the tracker root, then retry the SDK read.",
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async function assertMissingMetadataRootAncestors(pmRoot) {
|
|
82
|
-
const filesystemRoot = path.parse(path.resolve(pmRoot)).root;
|
|
83
|
-
let ancestor = path.dirname(path.resolve(pmRoot));
|
|
84
|
-
while (ancestor !== filesystemRoot) {
|
|
85
|
-
let ancestorStats;
|
|
86
|
-
try {
|
|
87
|
-
ancestorStats = await fs.stat(ancestor);
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
if (isErrno(error, "ENOTDIR")) {
|
|
91
|
-
throw trackerRootNotDirectoryError(pmRoot);
|
|
92
|
-
}
|
|
93
|
-
if (!isErrno(error, "ENOENT")) {
|
|
94
|
-
throw error;
|
|
95
|
-
}
|
|
96
|
-
ancestor = path.dirname(ancestor);
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (!ancestorStats.isDirectory()) {
|
|
100
|
-
throw trackerRootNotDirectoryError(pmRoot);
|
|
101
|
-
}
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/** Require metadata enumeration to start from a real directory so an invalid source cannot masquerade as an empty tracker. */
|
|
106
|
-
async function assertItemMetadataRoot(pmRoot) {
|
|
107
|
-
let stats;
|
|
108
|
-
try {
|
|
109
|
-
stats = await fs.stat(pmRoot);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
if (isErrno(error, "ENOENT")) {
|
|
113
|
-
await assertMissingMetadataRootAncestors(pmRoot);
|
|
114
|
-
throw new PmCliError(`Tracker root does not exist at ${pmRoot}.`, EXIT_CODE.NOT_FOUND, {
|
|
115
|
-
code: "tracker_root_missing",
|
|
116
|
-
reason: "missing",
|
|
117
|
-
nextSteps: [
|
|
118
|
-
"Confirm the tracker root path and retry the SDK read.",
|
|
119
|
-
"Initialize a tracker before enumerating its item metadata.",
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
if (isErrno(error, "ENOTDIR")) {
|
|
124
|
-
throw trackerRootNotDirectoryError(pmRoot);
|
|
125
|
-
}
|
|
126
|
-
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
127
|
-
throw trackerRootUnreadableError(pmRoot);
|
|
128
|
-
}
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
if (!stats.isDirectory()) {
|
|
132
|
-
throw trackerRootNotDirectoryError(pmRoot);
|
|
133
|
-
}
|
|
134
|
-
if (process.platform !== "win32" &&
|
|
135
|
-
((stats.mode & 0o444) === 0 || (stats.mode & 0o111) === 0)) {
|
|
136
|
-
throw trackerRootUnreadableError(pmRoot);
|
|
137
|
-
}
|
|
138
|
-
try {
|
|
139
|
-
const directory = await fs.opendir(pmRoot);
|
|
140
|
-
await directory.close();
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
144
|
-
throw trackerRootUnreadableError(pmRoot);
|
|
145
|
-
}
|
|
146
|
-
throw error;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
64
|
/** Implements locate item for the public runtime surface of this module. */
|
|
150
65
|
export async function locateItem(pmRoot, rawId, idPrefix = "pm-", preferredFormat, typeToFolder = TYPE_TO_FOLDER) {
|
|
151
66
|
const normalizedId = normalizeItemId(rawId, idPrefix);
|
|
@@ -189,7 +104,7 @@ export async function readLocatedItem(item, options = {}) {
|
|
|
189
104
|
}
|
|
190
105
|
/** Implements list all item metadata for the public runtime surface of this module. */
|
|
191
106
|
export async function listAllItemMetadata(pmRoot, preferredFormat, typeToFolder = TYPE_TO_FOLDER, warnings, schema) {
|
|
192
|
-
await
|
|
107
|
+
await assertReadableTrackerRoot(pmRoot);
|
|
193
108
|
const documents = await listAllDocumentsCached(pmRoot, preferredFormat, typeToFolder, warnings, schema);
|
|
194
109
|
return documents.map((document) => document.metadata);
|
|
195
110
|
}
|
|
@@ -200,13 +115,13 @@ export async function listAllItemMetadata(pmRoot, preferredFormat, typeToFolder
|
|
|
200
115
|
* read just the light scalar/small fields — see {@link listAllDocumentsCachedLight}.
|
|
201
116
|
*/
|
|
202
117
|
export async function listAllItemMetadataLight(pmRoot, preferredFormat, typeToFolder = TYPE_TO_FOLDER, warnings, schema) {
|
|
203
|
-
await
|
|
118
|
+
await assertReadableTrackerRoot(pmRoot);
|
|
204
119
|
const documents = await listAllDocumentsCachedLight(pmRoot, preferredFormat, typeToFolder, warnings, schema);
|
|
205
120
|
return documents.map((document) => document.metadata);
|
|
206
121
|
}
|
|
207
122
|
/** List item metadata with bodies, optionally bypassing the derived-index fast path when an integrity workflow must re-read authoritative files. */
|
|
208
123
|
export async function listAllItemMetadataWithBody(pmRoot, preferredFormat, typeToFolder = TYPE_TO_FOLDER, warnings, schema, options = {}) {
|
|
209
|
-
await
|
|
124
|
+
await assertReadableTrackerRoot(pmRoot);
|
|
210
125
|
const candidates = await listAllDocumentCandidatesCached(pmRoot, preferredFormat, typeToFolder, warnings, schema, {
|
|
211
126
|
includeBody: true,
|
|
212
127
|
forceSourceScan: options.forceSourceScan,
|
|
@@ -727,4 +642,4 @@ export async function deleteItem(params) {
|
|
|
727
642
|
}
|
|
728
643
|
}
|
|
729
644
|
//# sourceMappingURL=item-store.js.map
|
|
730
|
-
//# debugId=
|
|
645
|
+
//# debugId=f49b5141-f348-5954-a87e-8fd957593113
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type PmCliErrorRecoveryPayload } from "../shared/errors.js";
|
|
2
|
+
/** Build the non-interactive, tokenized retry that initializes a selected tracker root. */
|
|
3
|
+
export declare function buildTrackerInitializationRecovery(pmRoot: string): PmCliErrorRecoveryPayload;
|
|
4
|
+
/** Require a tracker root to be a readable directory without requiring initialized settings. */
|
|
5
|
+
export declare function assertReadableTrackerRoot(pmRoot: string): Promise<void>;
|
|
6
|
+
/** Require the selected tracker root and its settings marker before an SDK command reads or mutates project state. */
|
|
7
|
+
export declare function assertInitializedTracker(pmRoot: string): Promise<void>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/store/tracker-preflight
|
|
3
|
+
*
|
|
4
|
+
* Owns the filesystem preflight shared by tracker-reading SDK primitives.
|
|
5
|
+
*/
|
|
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]="8b0efe32-43f5-51ed-b1d5-5c26a3ae5bf0")}catch(e){}}();
|
|
8
|
+
import fs from "node:fs/promises";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { EXIT_CODE } from "../shared/constants.js";
|
|
11
|
+
import { PmCliError, } from "../shared/errors.js";
|
|
12
|
+
import { pathExists } from "../fs/fs-utils.js";
|
|
13
|
+
import { getSettingsPath } from "./paths.js";
|
|
14
|
+
function isErrno(error, code) {
|
|
15
|
+
return (typeof error === "object" &&
|
|
16
|
+
error !== null &&
|
|
17
|
+
"code" in error &&
|
|
18
|
+
error.code === code);
|
|
19
|
+
}
|
|
20
|
+
/** Build the non-interactive, tokenized retry that initializes a selected tracker root. */
|
|
21
|
+
export function buildTrackerInitializationRecovery(pmRoot) {
|
|
22
|
+
const suggestedRetryArguments = [
|
|
23
|
+
"--pm-path",
|
|
24
|
+
pmRoot,
|
|
25
|
+
"init",
|
|
26
|
+
"--defaults",
|
|
27
|
+
"--agent-guidance",
|
|
28
|
+
"skip",
|
|
29
|
+
];
|
|
30
|
+
return {
|
|
31
|
+
suggested_retry: `pm ${suggestedRetryArguments
|
|
32
|
+
.map((argument) => `'${argument.replaceAll("'", `'"'"'`)}'`)
|
|
33
|
+
.join(" ")}`,
|
|
34
|
+
suggested_retry_args: suggestedRetryArguments,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function trackerRootNotDirectoryError(pmRoot) {
|
|
38
|
+
return new PmCliError(`Tracker root is not a directory at ${pmRoot}.`, EXIT_CODE.USAGE, {
|
|
39
|
+
code: "tracker_root_not_directory",
|
|
40
|
+
reason: "not_a_directory",
|
|
41
|
+
resolved_path: pmRoot,
|
|
42
|
+
nextSteps: [
|
|
43
|
+
"Pass a tracker directory, usually <workspace>/.agents/pm, rather than a file path.",
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function trackerRootUnreadableError(pmRoot) {
|
|
48
|
+
return new PmCliError(`Tracker root is not readable at ${pmRoot}.`, EXIT_CODE.GENERIC_FAILURE, {
|
|
49
|
+
code: "tracker_root_unreadable",
|
|
50
|
+
reason: "unreadable",
|
|
51
|
+
resolved_path: pmRoot,
|
|
52
|
+
nextSteps: [
|
|
53
|
+
"Grant read and directory-search permission to the tracker root, then retry.",
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async function assertMissingRootAncestors(pmRoot) {
|
|
58
|
+
const resolvedRoot = path.resolve(pmRoot);
|
|
59
|
+
const filesystemRoot = path.parse(resolvedRoot).root;
|
|
60
|
+
let ancestor = path.dirname(resolvedRoot);
|
|
61
|
+
while (ancestor !== filesystemRoot) {
|
|
62
|
+
let ancestorStats;
|
|
63
|
+
try {
|
|
64
|
+
ancestorStats = await fs.stat(ancestor);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (isErrno(error, "ENOTDIR")) {
|
|
68
|
+
throw trackerRootNotDirectoryError(pmRoot);
|
|
69
|
+
}
|
|
70
|
+
if (!isErrno(error, "ENOENT")) {
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
ancestor = path.dirname(ancestor);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (!ancestorStats.isDirectory()) {
|
|
77
|
+
throw trackerRootNotDirectoryError(pmRoot);
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Require a tracker root to be a readable directory without requiring initialized settings. */
|
|
83
|
+
export async function assertReadableTrackerRoot(pmRoot) {
|
|
84
|
+
let stats;
|
|
85
|
+
try {
|
|
86
|
+
stats = await fs.stat(pmRoot);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if (isErrno(error, "ENOENT")) {
|
|
90
|
+
await assertMissingRootAncestors(pmRoot);
|
|
91
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Tracker root does not exist. Run pm init first.`, EXIT_CODE.NOT_FOUND, {
|
|
92
|
+
code: "tracker_root_missing",
|
|
93
|
+
reason: "missing",
|
|
94
|
+
resolved_path: pmRoot,
|
|
95
|
+
nextSteps: [
|
|
96
|
+
"Confirm the tracker root path or initialize it with the emitted retry.",
|
|
97
|
+
],
|
|
98
|
+
recovery: buildTrackerInitializationRecovery(pmRoot),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (isErrno(error, "ENOTDIR")) {
|
|
102
|
+
throw trackerRootNotDirectoryError(pmRoot);
|
|
103
|
+
}
|
|
104
|
+
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
105
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
106
|
+
}
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
if (!stats.isDirectory()) {
|
|
110
|
+
throw trackerRootNotDirectoryError(pmRoot);
|
|
111
|
+
}
|
|
112
|
+
if (process.platform !== "win32" &&
|
|
113
|
+
((stats.mode & 0o444) === 0 || (stats.mode & 0o111) === 0)) {
|
|
114
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const directory = await fs.opendir(pmRoot);
|
|
118
|
+
await directory.close();
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (isErrno(error, "EACCES") || isErrno(error, "EPERM")) {
|
|
122
|
+
throw trackerRootUnreadableError(pmRoot);
|
|
123
|
+
}
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Require the selected tracker root and its settings marker before an SDK command reads or mutates project state. */
|
|
128
|
+
export async function assertInitializedTracker(pmRoot) {
|
|
129
|
+
await assertReadableTrackerRoot(pmRoot);
|
|
130
|
+
if (await pathExists(getSettingsPath(pmRoot))) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND, {
|
|
134
|
+
code: "tracker_not_initialized",
|
|
135
|
+
reason: "settings_missing",
|
|
136
|
+
resolved_path: pmRoot,
|
|
137
|
+
nextSteps: ["Initialize the selected tracker root with the emitted retry."],
|
|
138
|
+
recovery: buildTrackerInitializationRecovery(pmRoot),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=tracker-preflight.js.map
|
|
142
|
+
//# debugId=8b0efe32-43f5-51ed-b1d5-5c26a3ae5bf0
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/agent/tracker-preflight-contracts
|
|
3
|
+
*
|
|
4
|
+
* Declares and scores executable recovery for tracker filesystem preflight failures.
|
|
5
|
+
*/
|
|
6
|
+
/** Filesystem states distinguished by the shared tracker preflight. */
|
|
7
|
+
export type PmTrackerPreflightFailureKind = "missing_root" | "settings_missing" | "not_directory" | "unreadable_root";
|
|
8
|
+
/** Recovery behavior that is safe for a tracker preflight failure. */
|
|
9
|
+
export type PmTrackerPreflightRecoveryKind = "initialize" | "select_directory" | "repair_permissions";
|
|
10
|
+
/** Static refusal and recovery obligation for one tracker filesystem state. */
|
|
11
|
+
export interface PmTrackerPreflightRecoveryContract {
|
|
12
|
+
/** Stable probe identifier used by repository gates and evidence. */
|
|
13
|
+
probe_id: string;
|
|
14
|
+
/** Filesystem state created by the executable probe. */
|
|
15
|
+
failure_kind: PmTrackerPreflightFailureKind;
|
|
16
|
+
/** Stable structured error code required from CLI and SDK transports. */
|
|
17
|
+
expected_error_code: string;
|
|
18
|
+
/** Process exit code required from the CLI transport. */
|
|
19
|
+
expected_exit_code: 1 | 2 | 3;
|
|
20
|
+
/** Safe recovery behavior for this filesystem state. */
|
|
21
|
+
recovery_kind: PmTrackerPreflightRecoveryKind;
|
|
22
|
+
}
|
|
23
|
+
/** Runtime evidence captured from one executable tracker preflight probe. */
|
|
24
|
+
export interface PmTrackerPreflightRecoveryObservation {
|
|
25
|
+
/** Stable probe identifier from the corresponding contract. */
|
|
26
|
+
probe_id: string;
|
|
27
|
+
/** Structured error code emitted by the refusal. */
|
|
28
|
+
error_code: string;
|
|
29
|
+
/** Process exit code emitted by the refusal. */
|
|
30
|
+
exit_code: number;
|
|
31
|
+
/** Recovery behavior exercised by the probe driver. */
|
|
32
|
+
recovery_kind: PmTrackerPreflightRecoveryKind;
|
|
33
|
+
/** Tokenized retry emitted by the refusal, or an empty list when no deterministic retry is safe. */
|
|
34
|
+
suggested_retry_args: string[];
|
|
35
|
+
/** Whether the emitted retry or safe alternate-root retry executed successfully. */
|
|
36
|
+
retry_succeeded: boolean;
|
|
37
|
+
/** Whether a file-path refusal incorrectly recommended tracker initialization. */
|
|
38
|
+
unsafe_init_recommended: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Actionable failure emitted by the tracker preflight closure scorer. */
|
|
41
|
+
export interface PmTrackerPreflightRecoveryFinding {
|
|
42
|
+
/** Stable finding code for automation and ratchets. */
|
|
43
|
+
code: "missing_probe" | "error_code_mismatch" | "exit_code_mismatch" | "recovery_kind_mismatch" | "missing_init_recovery" | "unsafe_init_recovery" | "retry_failed";
|
|
44
|
+
/** Probe that failed its recovery obligation. */
|
|
45
|
+
probe_id: string;
|
|
46
|
+
/** Human-readable explanation of the failed obligation. */
|
|
47
|
+
detail: string;
|
|
48
|
+
}
|
|
49
|
+
/** Aggregate executable-closure report for the tracker preflight corpus. */
|
|
50
|
+
export interface PmTrackerPreflightRecoveryReport {
|
|
51
|
+
/** Whether every declared probe met its refusal and recovery contract. */
|
|
52
|
+
ok: boolean;
|
|
53
|
+
/** Number of declared tracker preflight probes. */
|
|
54
|
+
probe_count: number;
|
|
55
|
+
/** Number of probes with no findings. */
|
|
56
|
+
closed_probe_count: number;
|
|
57
|
+
/** Deterministically ordered failed obligations. */
|
|
58
|
+
findings: PmTrackerPreflightRecoveryFinding[];
|
|
59
|
+
}
|
|
60
|
+
/** Return defensive copies of every core tracker preflight recovery contract. */
|
|
61
|
+
export declare function listTrackerPreflightRecoveryContracts(): PmTrackerPreflightRecoveryContract[];
|
|
62
|
+
/** Score runtime observations against the complete tracker preflight recovery corpus. */
|
|
63
|
+
export declare function scoreTrackerPreflightRecoveryClosure(observations: readonly PmTrackerPreflightRecoveryObservation[]): PmTrackerPreflightRecoveryReport;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/agent/tracker-preflight-contracts
|
|
3
|
+
*
|
|
4
|
+
* Declares and scores executable recovery for tracker filesystem preflight failures.
|
|
5
|
+
*/
|
|
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]="941a11a9-f756-56b3-9dc1-8afd78bc9328")}catch(e){}}();
|
|
8
|
+
const TRACKER_PREFLIGHT_RECOVERY_CONTRACTS = [
|
|
9
|
+
{
|
|
10
|
+
probe_id: "tracker-root-missing",
|
|
11
|
+
failure_kind: "missing_root",
|
|
12
|
+
expected_error_code: "tracker_root_missing",
|
|
13
|
+
expected_exit_code: 3,
|
|
14
|
+
recovery_kind: "initialize",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
probe_id: "tracker-root-settings-missing",
|
|
18
|
+
failure_kind: "settings_missing",
|
|
19
|
+
expected_error_code: "tracker_not_initialized",
|
|
20
|
+
expected_exit_code: 3,
|
|
21
|
+
recovery_kind: "initialize",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
probe_id: "tracker-root-not-directory",
|
|
25
|
+
failure_kind: "not_directory",
|
|
26
|
+
expected_error_code: "tracker_root_not_directory",
|
|
27
|
+
expected_exit_code: 2,
|
|
28
|
+
recovery_kind: "select_directory",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
probe_id: "tracker-root-unreadable",
|
|
32
|
+
failure_kind: "unreadable_root",
|
|
33
|
+
expected_error_code: "tracker_root_unreadable",
|
|
34
|
+
expected_exit_code: 1,
|
|
35
|
+
recovery_kind: "repair_permissions",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
/** Return defensive copies of every core tracker preflight recovery contract. */
|
|
39
|
+
export function listTrackerPreflightRecoveryContracts() {
|
|
40
|
+
return TRACKER_PREFLIGHT_RECOVERY_CONTRACTS.map((contract) => ({
|
|
41
|
+
...contract,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
function findTrackerPreflightObservationFindings(contract, observation) {
|
|
45
|
+
const findings = [];
|
|
46
|
+
if (observation.error_code !== contract.expected_error_code) {
|
|
47
|
+
findings.push({
|
|
48
|
+
code: "error_code_mismatch",
|
|
49
|
+
probe_id: contract.probe_id,
|
|
50
|
+
detail: `Expected ${contract.expected_error_code}, received ${observation.error_code}.`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (observation.exit_code !== contract.expected_exit_code) {
|
|
54
|
+
findings.push({
|
|
55
|
+
code: "exit_code_mismatch",
|
|
56
|
+
probe_id: contract.probe_id,
|
|
57
|
+
detail: `Expected exit ${contract.expected_exit_code}, received ${observation.exit_code}.`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (observation.recovery_kind !== contract.recovery_kind) {
|
|
61
|
+
findings.push({
|
|
62
|
+
code: "recovery_kind_mismatch",
|
|
63
|
+
probe_id: contract.probe_id,
|
|
64
|
+
detail: `Expected ${contract.recovery_kind}, received ${observation.recovery_kind}.`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const initIndex = observation.suggested_retry_args.indexOf("init");
|
|
68
|
+
const validInitCommand = initIndex === 0 ||
|
|
69
|
+
(initIndex === 2 &&
|
|
70
|
+
observation.suggested_retry_args[0] === "--pm-path" &&
|
|
71
|
+
observation.suggested_retry_args[1]?.length > 0);
|
|
72
|
+
if (contract.recovery_kind === "initialize" && !validInitCommand) {
|
|
73
|
+
findings.push({
|
|
74
|
+
code: "missing_init_recovery",
|
|
75
|
+
probe_id: contract.probe_id,
|
|
76
|
+
detail: "Missing and uninitialized roots must emit a tokenized init retry.",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (observation.unsafe_init_recommended ||
|
|
80
|
+
(contract.recovery_kind !== "initialize" &&
|
|
81
|
+
observation.suggested_retry_args.includes("init"))) {
|
|
82
|
+
findings.push({
|
|
83
|
+
code: "unsafe_init_recovery",
|
|
84
|
+
probe_id: contract.probe_id,
|
|
85
|
+
detail: "A tracker root that cannot be initialized safely must not recommend initialization.",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (!observation.retry_succeeded) {
|
|
89
|
+
findings.push({
|
|
90
|
+
code: "retry_failed",
|
|
91
|
+
probe_id: contract.probe_id,
|
|
92
|
+
detail: "The emitted retry or safe alternate-root recovery did not execute successfully.",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return findings;
|
|
96
|
+
}
|
|
97
|
+
/** Score runtime observations against the complete tracker preflight recovery corpus. */
|
|
98
|
+
export function scoreTrackerPreflightRecoveryClosure(observations) {
|
|
99
|
+
const observationsByProbe = new Map(observations.map((observation) => [observation.probe_id, observation]));
|
|
100
|
+
const findings = [];
|
|
101
|
+
let closedProbeCount = 0;
|
|
102
|
+
for (const contract of TRACKER_PREFLIGHT_RECOVERY_CONTRACTS) {
|
|
103
|
+
const observation = observationsByProbe.get(contract.probe_id);
|
|
104
|
+
if (observation === undefined) {
|
|
105
|
+
findings.push({
|
|
106
|
+
code: "missing_probe",
|
|
107
|
+
probe_id: contract.probe_id,
|
|
108
|
+
detail: "No runtime observation was supplied for this contract.",
|
|
109
|
+
});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const observationFindings = findTrackerPreflightObservationFindings(contract, observation);
|
|
113
|
+
findings.push(...observationFindings);
|
|
114
|
+
if (observationFindings.length === 0)
|
|
115
|
+
closedProbeCount += 1;
|
|
116
|
+
}
|
|
117
|
+
findings.sort((left, right) => left.probe_id.localeCompare(right.probe_id) ||
|
|
118
|
+
left.code.localeCompare(right.code));
|
|
119
|
+
return {
|
|
120
|
+
ok: findings.length === 0,
|
|
121
|
+
probe_count: TRACKER_PREFLIGHT_RECOVERY_CONTRACTS.length,
|
|
122
|
+
closed_probe_count: closedProbeCount,
|
|
123
|
+
findings,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=tracker-preflight-contracts.js.map
|
|
127
|
+
//# debugId=941a11a9-f756-56b3-9dc1-8afd78bc9328
|
package/dist/sdk/annotations.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Implements the pm annotation command 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]="eac75dc5-80b4-50d2-b615-4f96edca7346")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
8
9
|
import { readFile } from "node:fs/promises";
|
|
9
|
-
import { isFileAbsentError
|
|
10
|
+
import { isFileAbsentError } from "../core/fs/fs-utils.js";
|
|
10
11
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
11
12
|
import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
|
|
12
13
|
import { createStdinTokenResolver, parseCsvKv } from "../core/item/parse.js";
|
|
@@ -16,7 +17,7 @@ import { parseLimit } from "../core/shared/numeric-parsers.js";
|
|
|
16
17
|
import { nowIso } from "../core/shared/time.js";
|
|
17
18
|
import { resolveAuthor } from "../core/shared/author.js";
|
|
18
19
|
import { locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
|
|
19
|
-
import {
|
|
20
|
+
import { resolvePmRoot } from "../core/store/paths.js";
|
|
20
21
|
import { readSettings } from "../core/store/settings.js";
|
|
21
22
|
/** Map transport-level `full` onto the SDK annotation history option. */
|
|
22
23
|
export function normalizeAnnotationTransportOptions(options) {
|
|
@@ -215,9 +216,7 @@ function assertAnnotationMessageHasTextSource(config, options) {
|
|
|
215
216
|
export async function runAnnotationCommand(id, options, global, config) {
|
|
216
217
|
assertAnnotationMessageHasTextSource(config, options);
|
|
217
218
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
218
|
-
|
|
219
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
220
|
-
}
|
|
219
|
+
await assertInitializedTracker(pmRoot);
|
|
221
220
|
const settings = await readSettings(pmRoot);
|
|
222
221
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
223
222
|
const limit = parseLimit(options.limit);
|
|
@@ -399,4 +398,4 @@ function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMet
|
|
|
399
398
|
};
|
|
400
399
|
}
|
|
401
400
|
//# sourceMappingURL=annotations.js.map
|
|
402
|
-
//# debugId=
|
|
401
|
+
//# debugId=eac75dc5-80b4-50d2-b615-4f96edca7346
|
package/dist/sdk/config.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/config
|
|
3
|
+
*
|
|
4
|
+
* Implements the pm config command surface and its agent-facing runtime behavior.
|
|
5
|
+
*/
|
|
1
6
|
import { type ConfigKey } from "../core/config/positional-value.js";
|
|
2
7
|
import { type NestedSettingDescriptor } from "../core/config/nested-settings.js";
|
|
3
8
|
import type { GlobalOptions } from "../core/shared/command-types.js";
|
package/dist/sdk/config.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* Implements the pm config 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]="
|
|
8
|
-
import { pathExists } from "../core/fs/fs-utils.js";
|
|
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]="5918331a-46e9-5699-b85d-89f49a27d341")}catch(e){}}();
|
|
9
8
|
import { resolveConfigPositionalValue, } from "../core/config/positional-value.js";
|
|
10
9
|
import { NESTED_SETTING_DESCRIPTORS, parseNestedSettingValue, readNestedSettingValue, resolveNestedSettingDescriptor, writeNestedSettingValue, } from "../core/config/nested-settings.js";
|
|
11
10
|
import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
|
|
@@ -17,6 +16,7 @@ import { resolveItemTypesFilePath } from "../core/schema/runtime-schema.js";
|
|
|
17
16
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
18
17
|
import { PmCliError } from "../core/shared/errors.js";
|
|
19
18
|
import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
|
|
19
|
+
import { assertInitializedTracker } from "./environment/tracker-preflight.js";
|
|
20
20
|
import { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
|
|
21
21
|
import { getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../core/store/paths.js";
|
|
22
22
|
import { readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
|
|
@@ -503,8 +503,8 @@ async function resolveSettingsTarget(scope, global) {
|
|
|
503
503
|
? resolvePmRoot(cwd, global.path)
|
|
504
504
|
: resolveGlobalPmRoot(cwd);
|
|
505
505
|
const settingsPath = getSettingsPath(pmRoot);
|
|
506
|
-
if (scope === "project"
|
|
507
|
-
|
|
506
|
+
if (scope === "project") {
|
|
507
|
+
await assertInitializedTracker(pmRoot);
|
|
508
508
|
}
|
|
509
509
|
return { pmRoot, settingsPath };
|
|
510
510
|
}
|
|
@@ -1097,4 +1097,4 @@ export const _testOnlyConfigCommand = {
|
|
|
1097
1097
|
normalizeWarnings,
|
|
1098
1098
|
};
|
|
1099
1099
|
//# sourceMappingURL=config.js.map
|
|
1100
|
-
//# debugId=
|
|
1100
|
+
//# debugId=5918331a-46e9-5699-b85d-89f49a27d341
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* SDK entrypoint.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
!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]="
|
|
9
|
+
!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]="1a7548f2-93a0-5dfc-9d9a-c5aef4656c7c")}catch(e){}}();
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { isFileAbsentError } from "../core/fs/fs-utils.js";
|
|
13
|
+
import { assertReadableTrackerRoot } from "./environment/tracker-preflight.js";
|
|
13
14
|
import { runWithContextIntentContracts, } from "./context-intent-contracts.js";
|
|
14
15
|
/** Conventional workspace declaration file relative to the tracker root. */
|
|
15
16
|
export const PM_CONTEXT_INTENTS_FILE = "context-intents.json";
|
|
@@ -59,11 +60,13 @@ export async function readWorkspaceContextIntentContracts(pmRoot) {
|
|
|
59
60
|
catch (error) {
|
|
60
61
|
// Absent declarations are the norm. `ENOTDIR` counts as absent too: when
|
|
61
62
|
// the tracker root is a regular file the declaration cannot exist, and the
|
|
62
|
-
// authoritative root guard downstream owns that refusal
|
|
63
|
-
//
|
|
63
|
+
// authoritative root guard downstream owns that refusal. Other read
|
|
64
|
+
// failures first pass through the same root guard so permissions failures
|
|
65
|
+
// cannot pre-empt it with an unclassified runtime fault.
|
|
64
66
|
if (isFileAbsentError(error)) {
|
|
65
67
|
return [];
|
|
66
68
|
}
|
|
69
|
+
await assertReadableTrackerRoot(pmRoot);
|
|
67
70
|
throw error;
|
|
68
71
|
}
|
|
69
72
|
let parsed;
|
|
@@ -110,4 +113,4 @@ export async function runWithDiscoveredContextIntentContracts(options, run) {
|
|
|
110
113
|
return await runWithContextIntentContracts(layers, run);
|
|
111
114
|
}
|
|
112
115
|
//# sourceMappingURL=context-intent-runtime.js.map
|
|
113
|
-
//# debugId=
|
|
116
|
+
//# debugId=1a7548f2-93a0-5dfc-9d9a-c5aef4656c7c
|
package/dist/sdk/contracts.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export * from "./output-contracts.js";
|
|
|
16
16
|
export * from "./read-output-contracts.js";
|
|
17
17
|
export * from "./agent/refusal-closure.js";
|
|
18
18
|
export * from "./agent/closed-domain-contracts.js";
|
|
19
|
+
export * from "./agent/tracker-preflight-contracts.js";
|
|
19
20
|
export type { PmReadOutputSessionReceipt, PmReadOutputSessionState, } from "./read-output-session.js";
|
package/dist/sdk/contracts.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Exposes command and action contract data without loading SDK runtime code.
|
|
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]="8bdc03e5-c5cd-5842-b438-cf7bc79863f0")}catch(e){}}();
|
|
8
8
|
export * from "./cli-contracts.js";
|
|
9
9
|
export * from "./cli-contracts/grammar-contracts.js";
|
|
10
10
|
export * from "./cli-contracts/command-exit-contracts.js";
|
|
@@ -18,5 +18,6 @@ export * from "./output-contracts.js";
|
|
|
18
18
|
export * from "./read-output-contracts.js";
|
|
19
19
|
export * from "./agent/refusal-closure.js";
|
|
20
20
|
export * from "./agent/closed-domain-contracts.js";
|
|
21
|
+
export * from "./agent/tracker-preflight-contracts.js";
|
|
21
22
|
//# sourceMappingURL=contracts.js.map
|
|
22
|
-
//# debugId=
|
|
23
|
+
//# debugId=8bdc03e5-c5cd-5842-b438-cf7bc79863f0
|