@unbrained/pm-cli 2026.8.20 → 2026.8.22
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 +38 -0
- package/dist/cli/error-guidance.d.ts +29 -4
- package/dist/cli/error-guidance.js +43 -43
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +40 -7
- package/dist/cli-bundle/bundle-manifest.json +150 -150
- package/dist/cli-bundle/chunks/{chunk-L4LGPBJU.js → chunk-BWX4SK46.js} +58 -58
- package/dist/cli-bundle/chunks/chunk-EMWDM5FI.js +13 -0
- package/dist/cli-bundle/chunks/chunk-HYG6LRL4.js +200 -0
- package/dist/cli-bundle/chunks/{chunk-TSMWLCHS.js → chunk-MYYI3ZOA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4GB2LTOQ.js → chunk-MZTZQTMS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7BRF2BX2.js → chunk-QI2CT3IX.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-US2ZQW2M.js → chunk-U6GQ4VMV.js} +47 -47
- package/dist/cli-bundle/chunks/{chunk-K3EN3LK2.js → chunk-VMMIL3SI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-XYDDWBZN.js → chunk-YBPJAOQQ.js} +3 -3
- package/dist/cli-bundle/chunks/{register-list-query-JSAQCVOC.js → register-list-query-HZKBQNWW.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-XJPAW63D.js → register-mutation-HTKEEGRD.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-DSOSB2XQ.js → register-operations-6EMRWJJY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-QUR6QL2C.js → register-setup-QK4OTOXN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TDR5OGG3.js → chunk-2ARQGDDW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AZBACT5T.js → chunk-2AZT5WXZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-M32HFIQB.js → chunk-2POVTNLY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-3LKU6PTJ.js +4 -0
- package/dist/cli-bundle/focused-chunks/chunk-5SHSBMX2.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-UGSS4F5X.js → chunk-6S2MO3Q3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5L7M4AI7.js → chunk-A2BC5PQL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-OM65KHGF.js → chunk-D6RBZEJJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E2EWYPY6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-G3C5ERXG.js → chunk-GMYPD4FX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BLJCGGID.js → chunk-MB37AYN6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-FUREQLQN.js → chunk-PH2OXXVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-325UXIO7.js → chunk-PMGJUFNQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-R6SR45XU.js +50 -0
- package/dist/cli-bundle/focused-chunks/chunk-WZE4LIPW.js +8 -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 +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/extensions/extension-hook-runtime.js +22 -20
- package/dist/core/extensions/extension-types.d.ts +8 -1
- package/dist/core/extensions/extension-types.js +2 -2
- package/dist/core/extensions/loader.js +7 -3
- package/dist/core/extensions/service-ownership.d.ts +8 -0
- package/dist/core/extensions/service-ownership.js +20 -0
- package/dist/core/item/id.js +20 -5
- package/dist/core/item/item-format.js +27 -2
- package/dist/core/shared/errors.d.ts +20 -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/refusal-reachability.d.ts +1 -1
- 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/authoring.d.ts +1 -1
- package/dist/sdk/authoring.js +2 -2
- package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +77 -0
- package/dist/sdk/cli-contracts/agent-output-contracts.js +324 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +3 -3
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +3 -3
- 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/extension/install-sources.d.ts +1 -1
- package/dist/sdk/extension/install-sources.js +6 -3
- package/dist/sdk/extension/output-ownership.d.ts +1 -0
- package/dist/sdk/extension/output-ownership.js +3 -2
- package/dist/sdk/files.js +6 -10
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +75 -15
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +81 -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.d.ts +3 -0
- package/dist/sdk/governance/health.js +42 -11
- package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
- package/dist/sdk/governance/hierarchy-validation.js +109 -0
- package/dist/sdk/governance/reindex.js +5 -6
- package/dist/sdk/governance/validate.d.ts +2 -9
- package/dist/sdk/governance/validate.js +51 -109
- package/dist/sdk/graph/assembly.d.ts +6 -1
- package/dist/sdk/graph/assembly.js +16 -22
- package/dist/sdk/graph/governance-contracts.d.ts +1 -1
- package/dist/sdk/graph/governance-contracts.js +8 -2
- package/dist/sdk/graph/governance.d.ts +7 -5
- package/dist/sdk/graph/governance.js +76 -16
- package/dist/sdk/graph/hierarchy-integrity.d.ts +94 -0
- package/dist/sdk/graph/hierarchy-integrity.js +311 -0
- package/dist/sdk/graph/index.d.ts +2 -1
- package/dist/sdk/graph/index.js +3 -2
- package/dist/sdk/graph/remediation.js +32 -2
- package/dist/sdk/graph/run.d.ts +31 -2
- package/dist/sdk/graph/run.js +83 -36
- package/dist/sdk/graph/traversal.js +14 -5
- package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +8 -0
- package/dist/sdk/graph/workspace-relationship-kind-registry.js +28 -0
- 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 +4 -2
- package/dist/sdk/index.js +5 -3
- package/dist/sdk/item-children.js +21 -8
- 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 +127 -102
- 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/hierarchy-mutation-lock.d.ts +15 -0
- package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +25 -0
- 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 +2 -5
- package/dist/sdk/lifecycle/update.js +211 -84
- 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/complete-list.d.ts +3 -3
- package/dist/sdk/query/complete-list.js +46 -3
- 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.d.ts +4 -3
- package/dist/sdk/query/list.js +92 -54
- package/dist/sdk/query/search.js +5 -7
- package/dist/sdk/read-output-contracts.d.ts +5 -1
- package/dist/sdk/read-output-contracts.js +87 -22
- package/dist/sdk/relationship-context.js +3 -4
- 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 +27 -2
- package/dist/sdk/runtime.d.ts +3 -2
- package/dist/sdk/runtime.js +3 -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 +15 -9
- package/dist/sdk/test/execution.js +12 -5
- package/dist/sdk/test/runs.js +5 -7
- package/dist/types.d.ts +11 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_UX_CONTRACTS.md +24 -1
- package/docs/COMMANDS.md +29 -14
- package/docs/DEPENDENCY_KIND_CONTRACT.md +40 -1
- package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +98 -0
- package/docs/EXTENSIONS.md +2 -1
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +9 -2
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +37 -0
- package/docs/RELATIONSHIP_GRAPH.md +97 -12
- package/docs/SDK_PRIMITIVE_INVENTORY.md +15 -1
- package/docs/TESTING.md +15 -0
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +848 -56
- 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-GXWQBE3T.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-JWKEDZJI.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +0 -2
- 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
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
* projection contract.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!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]="
|
|
10
|
+
!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]="4b4d4bb6-8a17-5544-a18c-ad3fc49a759e")}catch(e){}}();
|
|
11
11
|
import { isTerminalStatus } from "../core/item/status.js";
|
|
12
12
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
13
13
|
import { PmCliError } from "../core/shared/errors.js";
|
|
14
|
+
import { resolveWorkspaceRelationshipKindRegistry } from "./graph/assembly.js";
|
|
15
|
+
import { collectHierarchyRelations, indexHierarchyRelations, } from "./graph/hierarchy-integrity.js";
|
|
14
16
|
/** Maximum corpus rows inspected by one child projection. */
|
|
15
17
|
export const MAX_CHILD_PROJECTION_ITEMS = 1_000_000;
|
|
16
18
|
/** Default number of child summaries retained inline. */
|
|
@@ -25,8 +27,7 @@ export function buildItemChildrenRollup(parentId, corpus, statusRegistry, sample
|
|
|
25
27
|
}
|
|
26
28
|
const normalizedParentId = parentId.trim().toLowerCase();
|
|
27
29
|
const byStatus = {};
|
|
28
|
-
const
|
|
29
|
-
let active = 0;
|
|
30
|
+
const candidates = [];
|
|
30
31
|
let scanned = 0;
|
|
31
32
|
for (const candidate of corpus) {
|
|
32
33
|
scanned += 1;
|
|
@@ -40,11 +41,23 @@ export function buildItemChildrenRollup(parentId, corpus, statusRegistry, sample
|
|
|
40
41
|
],
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
candidates.push(candidate);
|
|
45
|
+
}
|
|
46
|
+
const itemById = new Map(candidates.map((candidate) => [
|
|
47
|
+
candidate.id.trim().toLowerCase(),
|
|
48
|
+
candidate,
|
|
49
|
+
]));
|
|
50
|
+
const hierarchyIndexes = indexHierarchyRelations(collectHierarchyRelations(candidates, resolveWorkspaceRelationshipKindRegistry()));
|
|
51
|
+
const childIds = new Set(hierarchyIndexes.children_by_parent.get(normalizedParentId) ?? []);
|
|
52
|
+
for (const candidate of candidates) {
|
|
53
|
+
if (candidate.parent?.trim().toLowerCase() === normalizedParentId) {
|
|
54
|
+
childIds.add(candidate.id.trim().toLowerCase());
|
|
45
55
|
}
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
}
|
|
57
|
+
const children = [...childIds].map((childId) => itemById.get(childId));
|
|
58
|
+
let active = 0;
|
|
59
|
+
for (const child of children) {
|
|
60
|
+
const status = child.status.trim().toLowerCase();
|
|
48
61
|
byStatus[status] = (byStatus[status] ?? 0) + 1;
|
|
49
62
|
if (!isTerminalStatus(status, statusRegistry)) {
|
|
50
63
|
active += 1;
|
|
@@ -75,4 +88,4 @@ export function buildItemChildrenRollup(parentId, corpus, statusRegistry, sample
|
|
|
75
88
|
};
|
|
76
89
|
}
|
|
77
90
|
//# sourceMappingURL=item-children.js.map
|
|
78
|
-
//# debugId=
|
|
91
|
+
//# debugId=4b4d4bb6-8a17-5544-a18c-ad3fc49a759e
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module cli/commands/append
|
|
3
|
-
*
|
|
4
|
-
* Implements the pm append command surface and its agent-facing runtime behavior.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
/** Documents the append command options payload exchanged by command, SDK, and package integrations. */
|
|
8
3
|
export interface AppendCommandOptions {
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm append 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 {
|
|
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]="73184370-6517-533e-90db-536893402616")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { EXIT_CODE, PmCliError, resolveAuthor, toItemRecord, createStdinTokenResolver, mutateItem, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
9
10
|
/** Implements run append for the public runtime surface of this module. */
|
|
10
11
|
export async function runAppend(id, options, global) {
|
|
11
12
|
if (options.body === undefined) {
|
|
@@ -13,9 +14,7 @@ export async function runAppend(id, options, global) {
|
|
|
13
14
|
}
|
|
14
15
|
const stdinResolver = createStdinTokenResolver();
|
|
15
16
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
16
|
-
|
|
17
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
18
|
-
}
|
|
17
|
+
await assertInitializedTracker(pmRoot);
|
|
19
18
|
const settings = await readSettings(pmRoot);
|
|
20
19
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
21
20
|
// options.body is guaranteed defined by the guard above, so resolveValue returns a defined string.
|
|
@@ -52,4 +51,4 @@ export async function runAppend(id, options, global) {
|
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
53
|
//# sourceMappingURL=append.js.map
|
|
55
|
-
//# debugId=
|
|
54
|
+
//# debugId=73184370-6517-533e-90db-536893402616
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module cli/commands/claim
|
|
3
|
-
*
|
|
4
|
-
* Implements the pm claim command surface and its agent-facing runtime behavior.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
import { type NextRecommendation, type NextOptions } from "../query/next.js";
|
|
8
3
|
/** Stable warning/error code for an exhausted atomic next-work walk. */
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm claim 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 {
|
|
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]="1a61bf25-e320-5adc-8f5a-a427bc89af1a")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { resolveRuntimeStatusRegistry, statusIsTerminal, EXIT_CODE, PmCliError, toItemRecord, mutateItem, resolvePmRoot, readSettings, resolveAuthor, resolveClaimPrincipal, } from "../runtime-primitives.js";
|
|
9
10
|
import { wrapOwnershipConflict } from "../annotations.js";
|
|
10
11
|
import { describeItemOwnershipConflict } from "../ownership-source.js";
|
|
11
12
|
import { runNext, } from "../query/next.js";
|
|
@@ -26,9 +27,7 @@ export function isAlreadyClaimedError(error) {
|
|
|
26
27
|
/** Implements run claim for the public runtime surface of this module. */
|
|
27
28
|
export async function runClaim(id, force, global, options = {}) {
|
|
28
29
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
29
|
-
|
|
30
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
31
|
-
}
|
|
30
|
+
await assertInitializedTracker(pmRoot);
|
|
32
31
|
const settings = await readSettings(pmRoot);
|
|
33
32
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
34
33
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
@@ -184,9 +183,7 @@ export async function claimNextFromRecommendations(recommendations, force, globa
|
|
|
184
183
|
/** Implements run release for the public runtime surface of this module. */
|
|
185
184
|
export async function runRelease(id, force, global, options = {}) {
|
|
186
185
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
187
|
-
|
|
188
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
189
|
-
}
|
|
186
|
+
await assertInitializedTracker(pmRoot);
|
|
190
187
|
const settings = await readSettings(pmRoot);
|
|
191
188
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
192
189
|
const claimPrincipal = resolveClaimPrincipal(author);
|
|
@@ -237,4 +234,4 @@ export async function runRelease(id, force, global, options = {}) {
|
|
|
237
234
|
};
|
|
238
235
|
}
|
|
239
236
|
//# sourceMappingURL=claim.js.map
|
|
240
|
-
//# debugId=
|
|
237
|
+
//# debugId=1a61bf25-e320-5adc-8f5a-a427bc89af1a
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module cli/commands/close-many
|
|
3
|
-
*
|
|
4
|
-
* Implements the pm close many command surface and its agent-facing runtime behavior.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions, readSettings } from "../runtime-primitives.js";
|
|
7
2
|
import { type ListOptions } from "../query/list.js";
|
|
8
3
|
import { type PmCommandEffectReceipt } from "../cli-contracts/command-exit-contracts.js";
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm close many 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 {
|
|
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]="a7113374-b169-5f92-9c20-075a47520440")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, toErrorMessage, resolveAuthor, nowIso, listAllItemMetadataLight, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
|
|
9
10
|
import { runClose } from "./close.js";
|
|
10
11
|
import { hasListFilters } from "../query/list-filter-shared.js";
|
|
11
12
|
import { runList } from "../query/list.js";
|
|
@@ -336,9 +337,7 @@ async function resolveCloseManyCheckpointInfo(params) {
|
|
|
336
337
|
/** Implements run close many for the public runtime surface of this module. */
|
|
337
338
|
export async function runCloseMany(options, global) {
|
|
338
339
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
339
|
-
|
|
340
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
341
|
-
}
|
|
340
|
+
await assertInitializedTracker(pmRoot);
|
|
342
341
|
const settings = await readSettings(pmRoot);
|
|
343
342
|
const dryRun = options.dryRun === true;
|
|
344
343
|
const rollbackId = resolveCloseManyRollbackId(options);
|
|
@@ -428,4 +427,4 @@ export const _testOnly = {
|
|
|
428
427
|
resolveReason,
|
|
429
428
|
};
|
|
430
429
|
//# sourceMappingURL=close-many.js.map
|
|
431
|
-
//# debugId=
|
|
430
|
+
//# debugId=a7113374-b169-5f92-9c20-075a47520440
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module sdk/lifecycle/close
|
|
3
|
-
*
|
|
4
|
-
* Implements the pm close command surface and its agent-facing runtime behavior.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
import { collectBlockedByIds } from "../actionability.js";
|
|
8
3
|
import { type CloseOperationOptions, type CloseOperationResult } from "../lifecycle-policy.js";
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm close 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 {
|
|
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]="781b5118-7b07-53c7-802f-c889cb797a96")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { toItemRecord, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, resolveIsoOrRelative, shouldCompletePlanOnClose, getActiveExtensionRegistrations, } from "../runtime-primitives.js";
|
|
9
10
|
import { collectBlockedByIds, indexBlockedByIds } from "../actionability.js";
|
|
10
11
|
import { applyTerminalOrderingPolicy, requireTerminalReason, } from "../lifecycle-policy.js";
|
|
11
12
|
import { renderPmCommand } from "../command-line.js";
|
|
@@ -367,9 +368,7 @@ export const _testOnlyCloseCommand = {
|
|
|
367
368
|
/** Close one item through the SDK-owned lifecycle transaction and policy. */
|
|
368
369
|
export async function closeItem(id, closeReasonText, options, global) {
|
|
369
370
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
370
|
-
|
|
371
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
372
|
-
}
|
|
371
|
+
await assertInitializedTracker(pmRoot);
|
|
373
372
|
const settings = await readSettings(pmRoot);
|
|
374
373
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
375
374
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
@@ -458,4 +457,4 @@ export function runClose(id, closeReasonText, options, global) {
|
|
|
458
457
|
return closeItem(id, closeReasonText, options, global);
|
|
459
458
|
}
|
|
460
459
|
//# sourceMappingURL=close.js.map
|
|
461
|
-
//# debugId=
|
|
460
|
+
//# debugId=781b5118-7b07-53c7-802f-c889cb797a96
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module sdk/lifecycle/copy
|
|
3
|
-
*
|
|
4
|
-
* Implements the SDK-owned copy lifecycle operation shared by every surface.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
import { type SimilarityAdvisory } from "../similarity.js";
|
|
8
3
|
import type { ItemMetadata } from "../../types/index.js";
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the SDK-owned copy lifecycle operation shared by every surface.
|
|
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 {
|
|
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]="b59e8e54-f9e0-5cdb-bc59-6dcbf67f278d")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { removeFileIfExists, writeFileAtomic, appendHistoryEntry, createHistoryEntry, generateItemId, canonicalDocument, serializeItemDocument, acquireLock, getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveOnWriteHooks, collectRegisteredItemFieldNames, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, nowIso, PmCliError, resolveItemTypeRegistry, buildItemNotFoundError, locateItem, readLocatedItem, getHistoryPath, getItemPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
10
|
import { evaluateSimilarityGovernance, similarityAdvisoryWarnings, } from "../similarity.js";
|
|
10
11
|
import { acquireItemMetadataDerivedIndexLock, refreshItemMetadataDerivedIndex, } from "../item-metadata-index.js";
|
|
11
12
|
function buildChangedFields(itemMetadata, body) {
|
|
@@ -29,9 +30,7 @@ function buildCopyMessage(sourceId, message) {
|
|
|
29
30
|
/** Implements run copy for the public runtime surface of this module. */
|
|
30
31
|
export async function runCopy(sourceId, options, global) {
|
|
31
32
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
32
|
-
|
|
33
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
34
|
-
}
|
|
33
|
+
await assertInitializedTracker(pmRoot);
|
|
35
34
|
const settings = await readSettings(pmRoot);
|
|
36
35
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
37
36
|
const located = await locateItem(pmRoot, sourceId, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
|
|
@@ -211,4 +210,4 @@ export async function runCopy(sourceId, options, global) {
|
|
|
211
210
|
};
|
|
212
211
|
}
|
|
213
212
|
//# sourceMappingURL=copy.js.map
|
|
214
|
-
//# debugId=
|
|
213
|
+
//# debugId=b59e8e54-f9e0-5cdb-bc59-6dcbf67f278d
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module sdk/lifecycle/create
|
|
3
|
-
*
|
|
4
|
-
* Implements the pm create command surface and its agent-facing runtime behavior.
|
|
5
|
-
*/
|
|
6
1
|
import { type ResolvedItemTypeDefinition, type RuntimeFieldRegistry, type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
import { type SimilarityAdvisory } from "../similarity.js";
|
|
8
3
|
import { type LifecycleTransitionSuggestion } from "./lifecycle-transitions.js";
|
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* Implements the pm create 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 {
|
|
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]="4dff80ab-acfc-5f81-a546-3f19629d97be")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { removeFileIfExists, writeFileAtomic, appendHistoryEntry, createHistoryEntry, generateItemId, normalizeItemId, canonicalDocument, normalizeItemMetadata, serializeItemDocument, assertParentReferenceIsNotSelf, isPlaceholderReferenceToken, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, assertNoUnknownCsvKeys, createStdinTokenResolver, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, resolvePriority, getFocusedItem, normalizeStatusInput, isTerminalStatus, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, acquireLock, printError, buildInvalidTypeError, resolveTypeSynonym, collectRuntimeCreateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, PmCliError, nowIso, resolveIsoOrRelative, getActiveExtensionRegistrations, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnWriteHooks, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, listAllItemMetadataLight, locateItem, createMutationGuardSdk, getHistoryPath, getItemPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
10
|
import { requireTerminalReasonWithRecovery } from "../lifecycle-policy.js";
|
|
10
11
|
import { evaluateSimilarityGovernance, similarityAdvisoryWarnings, } from "../similarity.js";
|
|
11
12
|
import { acquireItemMetadataDerivedIndexLock, refreshItemMetadataDerivedIndex, } from "../item-metadata-index.js";
|
|
12
13
|
import { collectNewOrderingCycleWarnings } from "../graph/mutation-advisory.js";
|
|
14
|
+
import { assertHierarchyMutationAllowed } from "../graph/hierarchy-integrity.js";
|
|
15
|
+
import { resolveWorkspaceRelationshipKindRegistry } from "../graph/assembly.js";
|
|
16
|
+
import { acquireHierarchyMutationLock } from "./hierarchy-mutation-lock.js";
|
|
13
17
|
import { normalizeRiskInput, normalizeSeverityInput, parseConfidenceInput, parseRegressionInput, } from "./metadata-normalizers.js";
|
|
14
18
|
import { applyLegacyNoneCollectionNormalizers, createLegacyNoneCollectionNormalizers, assertNoLegacyNoneToken, assertNoLegacyNoneTokens, isLegacyNoneToken, } from "./legacy-none-tokens.js";
|
|
15
19
|
import { suggestNextLifecycleTransition, } from "./lifecycle-transitions.js";
|
|
@@ -837,12 +841,7 @@ async function loadCreateTemplateOptionsFromRuntime(templateName, global, pmRoot
|
|
|
837
841
|
return readTemplateOptionsFromRuntimeResult(handlerResult.result, templateName);
|
|
838
842
|
}
|
|
839
843
|
function ensureInitHasRun(pmRoot) {
|
|
840
|
-
return
|
|
841
|
-
/* c8 ignore next -- init guard failures are covered by top-level create command tests. */
|
|
842
|
-
if (!exists) {
|
|
843
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
844
|
-
}
|
|
845
|
-
});
|
|
844
|
+
return assertInitializedTracker(pmRoot);
|
|
846
845
|
}
|
|
847
846
|
/**
|
|
848
847
|
* Resolve an optional string item-metadata field for {@link runCreate}: yields
|
|
@@ -1444,114 +1443,140 @@ async function writeCreatedItem(params) {
|
|
|
1444
1443
|
const { pmRoot, type, id, settings, typeRegistry, author, extensionFieldNames, afterDocument, beforeDocument, historyMessage, changedFields, nowValue, similarityCandidate, allowDuplicate, } = params;
|
|
1445
1444
|
const itemPath = getItemPath(pmRoot, type, id, settings.item_format, typeRegistry.type_to_folder);
|
|
1446
1445
|
const historyPath = getHistoryPath(pmRoot, id);
|
|
1447
|
-
const
|
|
1446
|
+
const relationshipRegistry = resolveWorkspaceRelationshipKindRegistry();
|
|
1447
|
+
const hierarchyMutationRequired = afterDocument.metadata.parent !== undefined ||
|
|
1448
|
+
(afterDocument.metadata.dependencies ?? []).some((dependency) => relationshipRegistry.resolve(dependency.kind)?.hierarchy);
|
|
1449
|
+
const hierarchyLockRelease = await acquireHierarchyMutationLock({
|
|
1450
|
+
pmRoot,
|
|
1451
|
+
author,
|
|
1452
|
+
ttlSeconds: settings.locks.ttl_seconds,
|
|
1453
|
+
waitMs: settings.locks.wait_ms,
|
|
1454
|
+
required: hierarchyMutationRequired,
|
|
1455
|
+
});
|
|
1456
|
+
let hierarchyLockHeld = hierarchyMutationRequired;
|
|
1448
1457
|
let hookWarnings = [];
|
|
1449
1458
|
try {
|
|
1450
|
-
const
|
|
1451
|
-
afterDocument.metadata.dependencies.length > 0
|
|
1452
|
-
? await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)
|
|
1453
|
-
: undefined;
|
|
1454
|
-
const existing = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
|
|
1455
|
-
if (existing) {
|
|
1456
|
-
throw new PmCliError(`Item "${id}" already exists`, EXIT_CODE.CONFLICT);
|
|
1457
|
-
}
|
|
1458
|
-
await runActiveBeforeMutationHooks({
|
|
1459
|
-
pm_root: pmRoot,
|
|
1460
|
-
operation: "create",
|
|
1461
|
-
before: null,
|
|
1462
|
-
after: afterDocument,
|
|
1463
|
-
changed_fields: changedFields,
|
|
1464
|
-
sdk: createMutationGuardSdk({
|
|
1465
|
-
pmRoot,
|
|
1466
|
-
settings,
|
|
1467
|
-
typeToFolder: typeRegistry.type_to_folder,
|
|
1468
|
-
}),
|
|
1469
|
-
});
|
|
1470
|
-
const releaseDerivedIndexLock = await acquireItemMetadataDerivedIndexLock(pmRoot, author, {
|
|
1471
|
-
required: settings.governance.duplicate_detection_mode === "strict" &&
|
|
1472
|
-
allowDuplicate !== true,
|
|
1473
|
-
});
|
|
1474
|
-
let derivedIndexWarnings = [];
|
|
1459
|
+
const lockRelease = await acquireLock(pmRoot, id, settings.locks.ttl_seconds, author, false, settings.governance.force_required_for_stale_lock, settings.locks.wait_ms);
|
|
1475
1460
|
try {
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1461
|
+
const graphBeforeCreate = afterDocument.metadata.parent !== undefined ||
|
|
1462
|
+
(afterDocument.metadata.dependencies !== undefined &&
|
|
1463
|
+
afterDocument.metadata.dependencies.length > 0)
|
|
1464
|
+
? await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)
|
|
1465
|
+
: undefined;
|
|
1466
|
+
const existing = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
|
|
1467
|
+
if (existing) {
|
|
1468
|
+
throw new PmCliError(`Item "${id}" already exists`, EXIT_CODE.CONFLICT);
|
|
1469
|
+
}
|
|
1470
|
+
if (graphBeforeCreate) {
|
|
1471
|
+
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
1472
|
+
assertHierarchyMutationAllowed(graphBeforeCreate, [...graphBeforeCreate, afterDocument.metadata], id, (status) => isTerminalStatus(status, statusRegistry), relationshipRegistry);
|
|
1473
|
+
}
|
|
1474
|
+
await runActiveBeforeMutationHooks({
|
|
1475
|
+
pm_root: pmRoot,
|
|
1476
|
+
operation: "create",
|
|
1477
|
+
before: null,
|
|
1478
|
+
after: afterDocument,
|
|
1479
|
+
changed_fields: changedFields,
|
|
1480
|
+
sdk: createMutationGuardSdk({
|
|
1479
1481
|
pmRoot,
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1482
|
+
settings,
|
|
1483
|
+
typeToFolder: typeRegistry.type_to_folder,
|
|
1484
|
+
}),
|
|
1485
|
+
});
|
|
1486
|
+
const releaseDerivedIndexLock = await acquireItemMetadataDerivedIndexLock(pmRoot, author, {
|
|
1487
|
+
required: settings.governance.duplicate_detection_mode === "strict" &&
|
|
1488
|
+
allowDuplicate !== true,
|
|
1489
|
+
});
|
|
1490
|
+
let derivedIndexWarnings = [];
|
|
1491
|
+
try {
|
|
1492
|
+
if (settings.governance.duplicate_detection_mode === "strict" &&
|
|
1493
|
+
allowDuplicate !== true) {
|
|
1494
|
+
await evaluateSimilarityGovernance(similarityCandidate, {
|
|
1495
|
+
pmRoot,
|
|
1496
|
+
mode: "strict",
|
|
1497
|
+
threshold: settings.governance.duplicate_detection_threshold,
|
|
1498
|
+
limit: settings.governance.duplicate_detection_limit,
|
|
1499
|
+
allowDuplicate: false,
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
await writeFileAtomic(itemPath, serializeItemDocument(afterDocument, {
|
|
1503
|
+
format: settings.item_format,
|
|
1504
|
+
schema: settings.schema,
|
|
1505
|
+
extensionFieldNames,
|
|
1506
|
+
}));
|
|
1507
|
+
try {
|
|
1508
|
+
const entry = createHistoryEntry({
|
|
1509
|
+
nowIso: nowValue,
|
|
1510
|
+
author,
|
|
1511
|
+
op: "create",
|
|
1512
|
+
before: beforeDocument,
|
|
1513
|
+
after: afterDocument,
|
|
1514
|
+
message: historyMessage,
|
|
1515
|
+
});
|
|
1516
|
+
await appendHistoryEntry(historyPath, entry);
|
|
1517
|
+
}
|
|
1518
|
+
catch (error) {
|
|
1519
|
+
await removeFileIfExists(itemPath);
|
|
1520
|
+
throw error;
|
|
1521
|
+
}
|
|
1522
|
+
if (hierarchyLockHeld) {
|
|
1523
|
+
await hierarchyLockRelease();
|
|
1524
|
+
hierarchyLockHeld = false;
|
|
1525
|
+
}
|
|
1526
|
+
derivedIndexWarnings = await refreshItemMetadataDerivedIndex({
|
|
1527
|
+
pmRoot,
|
|
1528
|
+
preferredFormat: settings.item_format,
|
|
1529
|
+
typeToFolder: typeRegistry.type_to_folder,
|
|
1530
|
+
schema: settings.schema,
|
|
1531
|
+
itemPath,
|
|
1532
|
+
document: afterDocument,
|
|
1484
1533
|
});
|
|
1485
1534
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1535
|
+
finally {
|
|
1536
|
+
await releaseDerivedIndexLock();
|
|
1537
|
+
}
|
|
1538
|
+
hookWarnings = [
|
|
1539
|
+
...(graphBeforeCreate
|
|
1540
|
+
? collectNewOrderingCycleWarnings(graphBeforeCreate, [...graphBeforeCreate, afterDocument.metadata], id)
|
|
1541
|
+
: []),
|
|
1542
|
+
...derivedIndexWarnings,
|
|
1543
|
+
...(await runActiveOnWriteHooks({
|
|
1544
|
+
path: itemPath,
|
|
1545
|
+
scope: "project",
|
|
1495
1546
|
op: "create",
|
|
1547
|
+
item_id: afterDocument.metadata.id,
|
|
1548
|
+
item_type: afterDocument.metadata.type,
|
|
1496
1549
|
before: beforeDocument,
|
|
1497
1550
|
after: afterDocument,
|
|
1498
|
-
|
|
1499
|
-
})
|
|
1500
|
-
await
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1551
|
+
changed_fields: changedFields,
|
|
1552
|
+
})),
|
|
1553
|
+
...(await runActiveOnWriteHooks({
|
|
1554
|
+
path: historyPath,
|
|
1555
|
+
scope: "project",
|
|
1556
|
+
op: "create:history",
|
|
1557
|
+
item_id: afterDocument.metadata.id,
|
|
1558
|
+
item_type: afterDocument.metadata.type,
|
|
1559
|
+
before: beforeDocument,
|
|
1560
|
+
after: afterDocument,
|
|
1561
|
+
changed_fields: changedFields,
|
|
1562
|
+
})),
|
|
1563
|
+
];
|
|
1564
|
+
recordAfterCommandAffectedItem({
|
|
1565
|
+
id: afterDocument.metadata.id,
|
|
1566
|
+
op: "create",
|
|
1567
|
+
item_type: afterDocument.metadata.type,
|
|
1568
|
+
status: afterDocument.metadata.status,
|
|
1569
|
+
current: projectAfterCommandItemSnapshot(afterDocument.metadata, changedFields),
|
|
1570
|
+
changed_fields: changedFields,
|
|
1513
1571
|
});
|
|
1514
1572
|
}
|
|
1515
1573
|
finally {
|
|
1516
|
-
await
|
|
1574
|
+
await lockRelease();
|
|
1517
1575
|
}
|
|
1518
|
-
hookWarnings = [
|
|
1519
|
-
...(graphBeforeCreate
|
|
1520
|
-
? collectNewOrderingCycleWarnings(graphBeforeCreate, [...graphBeforeCreate, afterDocument.metadata], id)
|
|
1521
|
-
: []),
|
|
1522
|
-
...derivedIndexWarnings,
|
|
1523
|
-
...(await runActiveOnWriteHooks({
|
|
1524
|
-
path: itemPath,
|
|
1525
|
-
scope: "project",
|
|
1526
|
-
op: "create",
|
|
1527
|
-
item_id: afterDocument.metadata.id,
|
|
1528
|
-
item_type: afterDocument.metadata.type,
|
|
1529
|
-
before: beforeDocument,
|
|
1530
|
-
after: afterDocument,
|
|
1531
|
-
changed_fields: changedFields,
|
|
1532
|
-
})),
|
|
1533
|
-
...(await runActiveOnWriteHooks({
|
|
1534
|
-
path: historyPath,
|
|
1535
|
-
scope: "project",
|
|
1536
|
-
op: "create:history",
|
|
1537
|
-
item_id: afterDocument.metadata.id,
|
|
1538
|
-
item_type: afterDocument.metadata.type,
|
|
1539
|
-
before: beforeDocument,
|
|
1540
|
-
after: afterDocument,
|
|
1541
|
-
changed_fields: changedFields,
|
|
1542
|
-
})),
|
|
1543
|
-
];
|
|
1544
|
-
recordAfterCommandAffectedItem({
|
|
1545
|
-
id: afterDocument.metadata.id,
|
|
1546
|
-
op: "create",
|
|
1547
|
-
item_type: afterDocument.metadata.type,
|
|
1548
|
-
status: afterDocument.metadata.status,
|
|
1549
|
-
current: projectAfterCommandItemSnapshot(afterDocument.metadata, changedFields),
|
|
1550
|
-
changed_fields: changedFields,
|
|
1551
|
-
});
|
|
1552
1576
|
}
|
|
1553
1577
|
finally {
|
|
1554
|
-
|
|
1578
|
+
if (hierarchyLockHeld)
|
|
1579
|
+
await hierarchyLockRelease();
|
|
1555
1580
|
}
|
|
1556
1581
|
return hookWarnings;
|
|
1557
1582
|
}
|
|
@@ -1890,4 +1915,4 @@ export const _testOnlyCreateCommand = {
|
|
|
1890
1915
|
typeOptionExampleValue,
|
|
1891
1916
|
};
|
|
1892
1917
|
//# sourceMappingURL=create.js.map
|
|
1893
|
-
//# debugId=
|
|
1918
|
+
//# debugId=4dff80ab-acfc-5f81-a546-3f19629d97be
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* Implements the SDK-owned delete lifecycle operation shared by every surface.
|
|
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]="7819b53c-b0e4-50b0-a670-f80b36765085")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
8
9
|
import path from "node:path";
|
|
9
|
-
import {
|
|
10
|
+
import { toItemRecord, deleteItem, getHistoryPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
10
11
|
/** Implements run delete for the public runtime surface of this module. */
|
|
11
12
|
export async function runDelete(id, options, global) {
|
|
12
13
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
13
|
-
|
|
14
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
15
|
-
}
|
|
14
|
+
await assertInitializedTracker(pmRoot);
|
|
16
15
|
const settings = await readSettings(pmRoot);
|
|
17
16
|
const author = resolveAuthor(options.author, settings.author_default);
|
|
18
17
|
const result = await deleteItem({
|
|
@@ -44,4 +43,4 @@ export async function runDelete(id, options, global) {
|
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
//# sourceMappingURL=delete.js.map
|
|
47
|
-
//# debugId=
|
|
46
|
+
//# debugId=7819b53c-b0e4-50b0-a670-f80b36765085
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module sdk/lifecycle/focus
|
|
3
|
-
*
|
|
4
|
-
* Implements the SDK-owned focus lifecycle operation shared by every surface.
|
|
5
|
-
*/
|
|
6
1
|
import { type GlobalOptions } from "../runtime-primitives.js";
|
|
7
2
|
/** Documents the focus options payload exchanged by command, SDK, and package integrations. */
|
|
8
3
|
export interface FocusOptions {
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* Implements the SDK-owned focus lifecycle operation shared by every surface.
|
|
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 {
|
|
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]="a5ddb139-9780-50e0-87a5-621913cb0de4")}catch(e){}}();
|
|
8
|
+
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
|
+
import { getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, EXIT_CODE, PmCliError, clearFocusedItem, getFocusedItem, setFocusedItem, buildItemNotFoundError, locateItem, readLocatedItem, resolvePmRoot, readSettings, resolveAuthor, resolveClaimPrincipal, } from "../runtime-primitives.js";
|
|
9
10
|
import { recordFocusSemanticAttribution } from "../context/semantic-session-attribution.js";
|
|
10
11
|
async function ensureInitialized(pmRoot) {
|
|
11
|
-
|
|
12
|
-
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
13
|
-
}
|
|
12
|
+
await assertInitializedTracker(pmRoot);
|
|
14
13
|
}
|
|
15
14
|
/** Implements run focus for the public runtime surface of this module. */
|
|
16
15
|
export async function runFocus(id, options, global) {
|
|
@@ -90,4 +89,4 @@ function nonEmptyTitleOrNull(title) {
|
|
|
90
89
|
return title.trim().length > 0 ? title : null;
|
|
91
90
|
}
|
|
92
91
|
//# sourceMappingURL=focus.js.map
|
|
93
|
-
//# debugId=
|
|
92
|
+
//# debugId=a5ddb139-9780-50e0-87a5-621913cb0de4
|