@unbrained/pm-cli 2026.8.8 → 2026.8.10
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 +59 -0
- package/dist/cli/commander-usage.js +17 -12
- package/dist/cli/help-json-payload.js +51 -16
- package/dist/cli/main.js +7 -6
- package/dist/cli-bundle/bundle-manifest.json +162 -162
- package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +30 -0
- package/dist/cli-bundle/chunks/{chunk-2ZMXX3Q6.js → chunk-EBO7OUUE.js} +70 -70
- package/dist/cli-bundle/chunks/{chunk-NUXRRNAB.js → chunk-ETML5C6H.js} +48 -48
- package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +194 -0
- package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +5 -0
- package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-ALDHXLPS.js → chunk-S4EITGLA.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +13 -0
- package/dist/cli-bundle/chunks/{chunk-CBLA33YK.js → chunk-TRWXF476.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-WFZAMJHZ.js → register-list-query-OJ6ZXKV4.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-SOKKOTHQ.js → register-mutation-DKI7QC7O.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-2HL5ZHMK.js → register-setup-S3KT2LTH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ANTMGYLI.js → chunk-2COZ67XT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2EXI2DKR.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-YSAHYUXX.js → chunk-34SX654S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-75774JWP.js +6 -0
- package/dist/cli-bundle/focused-chunks/chunk-7UN6BHHO.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TCSAPH33.js → chunk-CHIBMEZR.js} +6 -6
- package/dist/cli-bundle/focused-chunks/chunk-DZGAHZZV.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +153 -0
- package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IW43E4XL.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-JMVA4HKR.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-PL2EYDJK.js → chunk-KR5RVXLQ.js} +31 -29
- package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-M6RPIXKC.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +38 -38
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +1 -1
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/diagnostics/remediation.js +19 -9
- package/dist/core/fs/fs-utils.d.ts +10 -0
- package/dist/core/fs/fs-utils.js +16 -4
- package/dist/core/history/history.js +13 -4
- package/dist/core/item/actionability.d.ts +7 -1
- package/dist/core/item/actionability.js +71 -15
- package/dist/core/item/item-format.js +3 -32
- package/dist/core/schema/fields-file.d.ts +1 -2
- package/dist/core/schema/fields-file.js +4 -11
- package/dist/core/schema/runtime-schema.js +3 -10
- package/dist/core/schema/status-defs-file.d.ts +1 -2
- package/dist/core/schema/status-defs-file.js +4 -32
- package/dist/core/schema/status-token.d.ts +2 -0
- package/dist/core/schema/status-token.js +32 -0
- package/dist/core/schema/type-workflows.d.ts +1 -2
- package/dist/core/schema/type-workflows.js +4 -11
- package/dist/core/shared/author.d.ts +25 -0
- package/dist/core/shared/author.js +128 -10
- package/dist/core/shared/errors.d.ts +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/text-normalization.d.ts +1 -1
- package/dist/core/shared/text-normalization.js +2 -2
- package/dist/sdk/actionability.d.ts +1 -1
- package/dist/sdk/actionability.js +3 -3
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +52 -0
- package/dist/sdk/agent/command-suggestions.d.ts +4 -0
- package/dist/sdk/agent/command-suggestions.js +67 -0
- package/dist/sdk/agent/create-option-policy.d.ts +12 -0
- package/dist/sdk/agent/create-option-policy.js +32 -0
- package/dist/sdk/agent/item-addressing.d.ts +19 -0
- package/dist/sdk/agent/item-addressing.js +208 -0
- package/dist/sdk/cli-bootstrap.d.ts +1 -1
- package/dist/sdk/cli-bootstrap.js +20 -5
- package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
- package/dist/sdk/cli-contracts/flag-contracts.js +62 -21
- package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +8 -0
- package/dist/sdk/cli-contracts/runtime-contracts.js +20 -3
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +19 -4
- package/dist/sdk/cli-contracts/tool-schema.js +17 -4
- package/dist/sdk/context-intent-runtime.js +8 -5
- package/dist/sdk/context-signal-store.d.ts +34 -0
- package/dist/sdk/context-signal-store.js +24 -2
- package/dist/sdk/core-governance.d.ts +1 -1
- package/dist/sdk/core-governance.js +3 -3
- package/dist/sdk/dependencies.d.ts +2 -0
- package/dist/sdk/dependencies.js +7 -6
- package/dist/sdk/dependency-flag-validation.d.ts +15 -1
- package/dist/sdk/dependency-flag-validation.js +54 -2
- package/dist/sdk/extension/bundled-catalog.js +19 -6
- package/dist/sdk/generated-error-code-catalog.js +110 -2
- package/dist/sdk/governance/health.js +38 -12
- package/dist/sdk/governance/provenance-health.d.ts +39 -0
- package/dist/sdk/governance/provenance-health.js +185 -0
- package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
- package/dist/sdk/governance/validate-item-reader.js +18 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +25 -11
- package/dist/sdk/governance.d.ts +1 -0
- package/dist/sdk/governance.js +3 -2
- package/dist/sdk/graph/assembly.d.ts +4 -0
- package/dist/sdk/graph/assembly.js +22 -2
- package/dist/sdk/graph/run.d.ts +2 -0
- package/dist/sdk/graph/run.js +3 -2
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +6 -2
- package/dist/sdk/lifecycle/close.js +27 -19
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +66 -19
- package/dist/sdk/lifecycle/plan.js +6 -3
- package/dist/sdk/lifecycle/update-many.js +39 -27
- package/dist/sdk/lifecycle/update.d.ts +6 -1
- package/dist/sdk/lifecycle/update.js +51 -28
- package/dist/sdk/merge/driver.d.ts +2 -1
- package/dist/sdk/merge/driver.js +7 -4
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +4 -0
- package/dist/sdk/merge/install.js +29 -17
- package/dist/sdk/merge/receipts.d.ts +17 -1
- package/dist/sdk/merge/receipts.js +112 -20
- package/dist/sdk/merge/reconcile.js +21 -4
- package/dist/sdk/merge/three-way.d.ts +6 -2
- package/dist/sdk/merge/three-way.js +24 -10
- package/dist/sdk/output-projection.js +24 -4
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +7 -4
- package/dist/sdk/query/get.d.ts +11 -0
- package/dist/sdk/query/get.js +37 -3
- package/dist/sdk/query/light-metadata.d.ts +3 -0
- package/dist/sdk/query/light-metadata.js +19 -0
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +23 -4
- package/dist/sdk/relationship-kinds/contract.d.ts +48 -0
- package/dist/sdk/relationship-kinds/contract.js +22 -0
- package/dist/sdk/relationships.d.ts +6 -41
- package/dist/sdk/relationships.js +12 -126
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +4 -1
- package/dist/sdk/runtime.js +8 -3
- package/dist/sdk/schema-migration.js +7 -9
- package/dist/sdk/similarity-scoring.d.ts +1 -2
- package/dist/sdk/similarity-scoring.js +4 -16
- package/dist/sdk/similarity.d.ts +5 -0
- package/dist/sdk/similarity.js +40 -10
- package/dist/sdk/structured-mutations.js +5 -2
- package/dist/sdk/test/linked-command-detection.d.ts +2 -7
- package/dist/sdk/test/linked-command-detection.js +22 -9
- package/dist/sdk/workspace-snapshot.d.ts +4 -0
- package/dist/sdk/workspace-snapshot.js +24 -11
- package/docs/AGENT_GUIDE.md +5 -2
- package/docs/COMMANDS.md +27 -6
- package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
- package/docs/ITEM_READ_PROJECTIONS.md +26 -0
- package/docs/MERGE_SAFETY.md +17 -8
- package/docs/README.md +2 -5
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
- package/docs/RELATIONSHIP_GRAPH.md +1 -1
- package/docs/SDK.md +33 -8
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +36 -2
- package/docs/SDK_CONTEXT.md +97 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +33 -3
- package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
- package/docs/agent-task-token-baseline.json +2 -2
- package/marketplace.json +2 -2
- package/package.json +5 -4
- 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 +415 -43
- package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +0 -5
- package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +0 -2
- package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +0 -26
- package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +0 -13
- package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +0 -194
- package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5FLBTZJQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-DMKOMTTY.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-F5B3HBEZ.js +0 -5
- package/dist/cli-bundle/focused-chunks/chunk-FI6DWU2M.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-FNOKJG6N.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-FPDYXZBK.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-GWI6YIKJ.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-HCUC62AB.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-HGNKPSCB.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +0 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm validate 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]="b5b7e497-f067-5504-9ffa-fd177997c518")}catch(e){}}();
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import { realpathSync } from "node:fs";
|
|
10
10
|
import { execFile } from "node:child_process";
|
|
@@ -23,7 +23,6 @@ import { PmCliError } from "../../core/shared/errors.js";
|
|
|
23
23
|
import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
|
|
24
24
|
import { nowIso } from "../../core/shared/time.js";
|
|
25
25
|
import { CURRENT_ITEM_FORMAT_VERSION, effectiveItemFormatVersion, scanItemFormatVersions, } from "../../core/item/item-format-version.js";
|
|
26
|
-
import { listAllItemMetadataWithBody } from "../../core/store/item-store.js";
|
|
27
26
|
import { getSettingsPath, resolvePmRoot } from "../../core/store/paths.js";
|
|
28
27
|
import { readSettings } from "../../core/store/settings.js";
|
|
29
28
|
import { partitionFixesByGrant, planCloseReasonBackfillFixes, planEstimateBackfillFixes, planResolutionBackfillFixes, planStaleLinkPruneFixes, planTerminalParentFixes, resolveGrantedFixScopes, toFixOutputRow, } from "../../core/validate/fix-planning.js";
|
|
@@ -35,7 +34,7 @@ import { buildMissingLinkedPathRows, summarizeMissingLinkedPathRows, } from "../
|
|
|
35
34
|
import { assertProjectionModeChoice, } from "../output-projection.js";
|
|
36
35
|
import { collectDanglingDependencyReferences } from "../graph/assembly.js";
|
|
37
36
|
import { auditMergeAttributeFence, auditMergeDriverConfiguration, findGitWorkspaceRoot, resolveProjectMergeTypeFolders, } from "../merge/install.js";
|
|
38
|
-
import { listMergeReceipts } from "../merge/receipts.js";
|
|
37
|
+
import { listMergeReceipts, partitionMergeReceipts, } from "../merge/receipts.js";
|
|
39
38
|
import { scanStorageIntegrity } from "./storage-integrity.js";
|
|
40
39
|
import { scanTrackedRuntimeCache } from "./tracked-runtime-cache.js";
|
|
41
40
|
import { scanHistoryAuthorAttribution } from "../author-attribution.js";
|
|
@@ -43,6 +42,7 @@ import { createRelationshipKindRegistry, } from "../relationships.js";
|
|
|
43
42
|
import { runDocs } from "../docs.js";
|
|
44
43
|
import { runFiles } from "../files.js";
|
|
45
44
|
import { extractReferencedPmItemIdsFromCommand } from "../test/linked-command-detection.js";
|
|
45
|
+
import { readValidateItems, } from "./validate-item-reader.js";
|
|
46
46
|
const FILE_SCAN_DIRECTORIES = ["src", "tests", "docs"];
|
|
47
47
|
const FILE_SCAN_ROOT_FILES = [
|
|
48
48
|
"README.md",
|
|
@@ -2100,9 +2100,13 @@ async function buildStorageIntegrityCheck(pmRoot, items, typeToFolder, settings)
|
|
|
2100
2100
|
}
|
|
2101
2101
|
const pendingMergeReceipts = gitWorkspaceRoot === null
|
|
2102
2102
|
? []
|
|
2103
|
-
: await listMergeReceipts(gitWorkspaceRoot
|
|
2104
|
-
|
|
2105
|
-
|
|
2103
|
+
: await listMergeReceipts(gitWorkspaceRoot, {
|
|
2104
|
+
includeLossless: true,
|
|
2105
|
+
pmRoot,
|
|
2106
|
+
});
|
|
2107
|
+
const { pendingDecisions: pendingMergeDecisions, lossless: losslessMergeReceipts, } = partitionMergeReceipts(pendingMergeReceipts);
|
|
2108
|
+
if (pendingMergeDecisions.length > 0) {
|
|
2109
|
+
warnings.push(`validate_merge_decisions_unreviewed:${pendingMergeDecisions.length}`);
|
|
2106
2110
|
}
|
|
2107
2111
|
return {
|
|
2108
2112
|
check: {
|
|
@@ -2115,9 +2119,13 @@ async function buildStorageIntegrityCheck(pmRoot, items, typeToFolder, settings)
|
|
|
2115
2119
|
...scan,
|
|
2116
2120
|
merge_fence: fenceAudit,
|
|
2117
2121
|
merge_driver_configuration: mergeDriverAudit,
|
|
2118
|
-
pending_merge_decision_count:
|
|
2122
|
+
pending_merge_decision_count: pendingMergeDecisions.length,
|
|
2119
2123
|
pending_merge_decision_items: [
|
|
2120
|
-
...new Set(
|
|
2124
|
+
...new Set(pendingMergeDecisions.map((receipt) => receipt.item_id)),
|
|
2125
|
+
].sort((left, right) => left.localeCompare(right)),
|
|
2126
|
+
lossless_merge_receipt_count: losslessMergeReceipts.length,
|
|
2127
|
+
lossless_merge_receipt_items: [
|
|
2128
|
+
...new Set(losslessMergeReceipts.map((receipt) => receipt.item_id)),
|
|
2121
2129
|
].sort((left, right) => left.localeCompare(right)),
|
|
2122
2130
|
tracked_runtime_cache: {
|
|
2123
2131
|
tracker_relative_root: trackedRuntimeCache.tracker_relative_root,
|
|
@@ -2257,9 +2265,15 @@ export async function runValidate(options, global, services = {}) {
|
|
|
2257
2265
|
const settings = await readSettings(pmRoot);
|
|
2258
2266
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
2259
2267
|
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
2260
|
-
const itemReadWarnings = [];
|
|
2261
|
-
const items = await listAllItemMetadataWithBody(pmRoot, settings.item_format, typeRegistry.type_to_folder, itemReadWarnings, settings.schema);
|
|
2262
2268
|
const requestedChecks = resolveRequestedChecks(options);
|
|
2269
|
+
const itemReadWarnings = [];
|
|
2270
|
+
const items = await readValidateItems({
|
|
2271
|
+
includeBody: requestedChecks.has("history_drift"),
|
|
2272
|
+
pmRoot,
|
|
2273
|
+
settings,
|
|
2274
|
+
typeToFolder: typeRegistry.type_to_folder,
|
|
2275
|
+
warnings: itemReadWarnings,
|
|
2276
|
+
});
|
|
2263
2277
|
if (requestedChecks.has("history_drift")) {
|
|
2264
2278
|
const authorAttribution = await scanHistoryAuthorAttribution(pmRoot);
|
|
2265
2279
|
if (authorAttribution.actionable_unknown_event_count > 0) {
|
|
@@ -2332,4 +2346,4 @@ export async function runValidate(options, global, services = {}) {
|
|
|
2332
2346
|
}
|
|
2333
2347
|
/* c8 ignore stop */
|
|
2334
2348
|
//# sourceMappingURL=validate.js.map
|
|
2335
|
-
//# debugId=
|
|
2349
|
+
//# debugId=b5b7e497-f067-5504-9ffa-fd177997c518
|
package/dist/sdk/governance.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export { runUpgrade, type UpgradeCliResult, type UpgradeCommandOptions, type Upg
|
|
|
12
12
|
export * from "./governance/validate.js";
|
|
13
13
|
export * from "./author-attribution.js";
|
|
14
14
|
export * from "./mutation-guard.js";
|
|
15
|
+
export * from "./governance/provenance-health.js";
|
|
15
16
|
export * from "./similarity.js";
|
package/dist/sdk/governance.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides validation, health, integrity, and mutation-policy primitives.
|
|
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]="8e8c2de1-7bff-57c6-8e71-9c27e9e76eaa")}catch(e){}}();
|
|
8
8
|
export * from "./governance/gc.js";
|
|
9
9
|
export * from "./governance/health.js";
|
|
10
10
|
export { runReindex, } from "./governance/reindex.js";
|
|
@@ -14,6 +14,7 @@ export { runUpgrade, } from "./governance/upgrade.js";
|
|
|
14
14
|
export * from "./governance/validate.js";
|
|
15
15
|
export * from "./author-attribution.js";
|
|
16
16
|
export * from "./mutation-guard.js";
|
|
17
|
+
export * from "./governance/provenance-health.js";
|
|
17
18
|
export * from "./similarity.js";
|
|
18
19
|
//# sourceMappingURL=governance.js.map
|
|
19
|
-
//# debugId=
|
|
20
|
+
//# debugId=8e8c2de1-7bff-57c6-8e71-9c27e9e76eaa
|
|
@@ -127,7 +127,11 @@ export interface WorkspaceRelationshipAssembly {
|
|
|
127
127
|
dangling: DanglingDependencyReferenceSummary;
|
|
128
128
|
/** Raw same-identity duplicated dependency rows found before graph dedup. */
|
|
129
129
|
duplicateRows: DuplicateDependencyRow[];
|
|
130
|
+
/** Raw legacy alias rows grouped by accepted spelling before graph canonicalization. */
|
|
131
|
+
legacyAliasCounts: Record<string, number>;
|
|
130
132
|
}
|
|
133
|
+
/** Count raw dependency rows that use a registered compatibility alias instead of its canonical kind. */
|
|
134
|
+
export declare function collectLegacyDependencyAliasCounts(items: readonly DependencyReferenceHolder[], registry?: RelationshipKindRegistry): Record<string, number>;
|
|
131
135
|
/**
|
|
132
136
|
* Build the shared workspace relationship graph including missing placeholder
|
|
133
137
|
* nodes. One assembly serves every bounded query in an invocation — dependency
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!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]="
|
|
2
|
+
!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]="62ec8e0e-658e-5a32-b458-439d5ffd1229")}catch(e){}}();
|
|
3
3
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
4
4
|
import { RelationshipGraph, createRelationshipKindRegistry, } from "../relationships.js";
|
|
5
5
|
import { isExternalDependencySourceKind } from "../dependency-provenance.js";
|
|
@@ -191,6 +191,25 @@ export function collectExternalDependencyTargetIds(items) {
|
|
|
191
191
|
}
|
|
192
192
|
return [...targets.values()].sort((left, right) => left.localeCompare(right));
|
|
193
193
|
}
|
|
194
|
+
/** Count raw dependency rows that use a registered compatibility alias instead of its canonical kind. */
|
|
195
|
+
export function collectLegacyDependencyAliasCounts(items, registry = resolveWorkspaceRelationshipKindRegistry()) {
|
|
196
|
+
const counts = {};
|
|
197
|
+
for (const item of items) {
|
|
198
|
+
for (const dependency of item.dependencies ?? []) {
|
|
199
|
+
if (typeof dependency !== "object" || dependency === null)
|
|
200
|
+
continue;
|
|
201
|
+
const rawKind = dependency.kind;
|
|
202
|
+
if (typeof rawKind !== "string")
|
|
203
|
+
continue;
|
|
204
|
+
const normalized = rawKind.trim().toLowerCase().replaceAll("-", "_");
|
|
205
|
+
const definition = registry.resolve(rawKind);
|
|
206
|
+
if (definition && normalized !== definition.kind) {
|
|
207
|
+
counts[normalized] = (counts[normalized] ?? 0) + 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return Object.fromEntries(Object.entries(counts).sort(([left], [right]) => left.localeCompare(right)));
|
|
212
|
+
}
|
|
194
213
|
/**
|
|
195
214
|
* Build the shared workspace relationship graph including missing placeholder
|
|
196
215
|
* nodes. One assembly serves every bounded query in an invocation — dependency
|
|
@@ -277,7 +296,8 @@ export function assembleWorkspaceRelationshipGraph(items, isTerminal, registry)
|
|
|
277
296
|
missingIdSet: new Set(missingIds.map((id) => id.toLowerCase())),
|
|
278
297
|
dangling,
|
|
279
298
|
duplicateRows: collectDuplicateDependencyRows(safeItems, isTerminal),
|
|
299
|
+
legacyAliasCounts: collectLegacyDependencyAliasCounts(safeItems, relationshipRegistry),
|
|
280
300
|
};
|
|
281
301
|
}
|
|
282
302
|
//# sourceMappingURL=assembly.js.map
|
|
283
|
-
//# debugId=
|
|
303
|
+
//# debugId=62ec8e0e-658e-5a32-b458-439d5ffd1229
|
package/dist/sdk/graph/run.d.ts
CHANGED
|
@@ -194,6 +194,8 @@ export interface GraphAuditResult {
|
|
|
194
194
|
affected_subjects_by_code: Record<string, number>;
|
|
195
195
|
/** Structural coverage metrics computed during the audit. */
|
|
196
196
|
profile: RelationshipAuditReport["profile"];
|
|
197
|
+
/** Stored legacy relationship aliases grouped by spelling; canonical graph counts remain in profile. */
|
|
198
|
+
legacy_alias_counts?: Record<string, number>;
|
|
197
199
|
/** Ordered findings with bounded evidence samples; absent with summary. */
|
|
198
200
|
findings?: RelationshipAuditReport["findings"];
|
|
199
201
|
/** Signed change since the persisted census baseline; absent when no baseline exists. */
|
package/dist/sdk/graph/run.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* queries in long-lived hosts are answered from the memoized snapshot.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
!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]="
|
|
14
|
+
!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]="ba8e7432-539e-55d3-b105-689db55d26b2")}catch(e){}}();
|
|
15
15
|
import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
|
|
16
16
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
17
17
|
import { isTerminalStatus } from "../../core/item/status.js";
|
|
@@ -291,6 +291,7 @@ function runGraphAudit(invocation, isTerminal) {
|
|
|
291
291
|
affected_subjects_by_severity: affectedBySeverity,
|
|
292
292
|
affected_subjects_by_code: affectedByCode,
|
|
293
293
|
profile: report.profile,
|
|
294
|
+
legacy_alias_counts: invocation.assembly.legacyAliasCounts,
|
|
294
295
|
...(invocation.summary ? {} : { findings: report.findings }),
|
|
295
296
|
};
|
|
296
297
|
}
|
|
@@ -713,4 +714,4 @@ export async function runGraph(subcommandRaw, id, target, options, global) {
|
|
|
713
714
|
return attachGraphProjection(value, invocation.summary, "result_rows");
|
|
714
715
|
}
|
|
715
716
|
//# sourceMappingURL=run.js.map
|
|
716
|
-
//# debugId=
|
|
717
|
+
//# debugId=ba8e7432-539e-55d3-b105-689db55d26b2
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export { SNAPSHOT_SCHEMA, createWorkspaceSnapshot, deleteWorkspaceSnapshot, insp
|
|
|
17
17
|
export { flushTelemetryQueue } from "./telemetry-flush.js";
|
|
18
18
|
export { EXECUTABLE_COMMAND_ALIASES, applyBootstrapPagerPolicy, coalesceRepeatedListFlags, listAliasPluralKeys, mergeLinkedTestTwoTokenEntries, normalizeBootstrapInvocation, normalizeLegacyExtensionActionSyntax, parseBootstrapCommandName, parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapTypeValue, stripGlobalBootstrapTokens, type BootstrapGlobalOptions, type BootstrapHelpRequest, type BootstrapInvocationNormalizationResult, type BootstrapNormalizationEvent, } from "./cli-bootstrap.js";
|
|
19
19
|
export { quoteCommandArg, quoteWindowsCommandArg, renderPmCommand, } from "./command-line.js";
|
|
20
|
+
export * from "./agent/command-recovery.js";
|
|
21
|
+
export * from "./agent/command-suggestions.js";
|
|
22
|
+
export * from "./agent/item-addressing.js";
|
|
23
|
+
export * from "./agent/create-option-policy.js";
|
|
20
24
|
export { runGc, type GcCheckpointsSummary, type GcLocksSummary, } from "./governance/gc.js";
|
|
21
25
|
export { _testOnlyHealthCommand, runHealth, type HealthCheck, } from "./governance/health.js";
|
|
22
26
|
export { _testOnlyValidateCommand, projectValidateCounts, runValidate, type ValidateCheck, type ValidateCountsFixesSummary, type ValidateCountsResult, type ValidateFixesSummary, type ValidateMutationServices, } from "./governance/validate.js";
|
package/dist/sdk/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Index.
|
|
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]="99d427a5-1f09-5ca4-8c1f-8b9d54bfd2f2")}catch(e){}}();
|
|
8
8
|
export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
|
|
9
9
|
export * from "./agent-session-context.js";
|
|
10
10
|
export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
|
|
@@ -18,6 +18,10 @@ export { SNAPSHOT_SCHEMA, createWorkspaceSnapshot, deleteWorkspaceSnapshot, insp
|
|
|
18
18
|
export { flushTelemetryQueue } from "./telemetry-flush.js";
|
|
19
19
|
export { EXECUTABLE_COMMAND_ALIASES, applyBootstrapPagerPolicy, coalesceRepeatedListFlags, listAliasPluralKeys, mergeLinkedTestTwoTokenEntries, normalizeBootstrapInvocation, normalizeLegacyExtensionActionSyntax, parseBootstrapCommandName, parseBootstrapGlobalOptions, parseBootstrapHelpRequest, parseBootstrapTypeValue, stripGlobalBootstrapTokens, } from "./cli-bootstrap.js";
|
|
20
20
|
export { quoteCommandArg, quoteWindowsCommandArg, renderPmCommand, } from "./command-line.js";
|
|
21
|
+
export * from "./agent/command-recovery.js";
|
|
22
|
+
export * from "./agent/command-suggestions.js";
|
|
23
|
+
export * from "./agent/item-addressing.js";
|
|
24
|
+
export * from "./agent/create-option-policy.js";
|
|
21
25
|
export { runGc, } from "./governance/gc.js";
|
|
22
26
|
export { _testOnlyHealthCommand, runHealth, } from "./governance/health.js";
|
|
23
27
|
export { _testOnlyValidateCommand, projectValidateCounts, runValidate, } from "./governance/validate.js";
|
|
@@ -141,4 +145,4 @@ export * from "./governance.js";
|
|
|
141
145
|
export * from "./query.js";
|
|
142
146
|
export * from "./testing.js";
|
|
143
147
|
//# sourceMappingURL=index.js.map
|
|
144
|
-
//# debugId=
|
|
148
|
+
//# debugId=99d427a5-1f09-5ca4-8c1f-8b9d54bfd2f2
|
|
@@ -4,9 +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]="
|
|
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]="83affe54-a56c-5d84-b6b0-9634d4238ff5")}catch(e){}}();
|
|
8
8
|
import { pathExists, toItemRecord, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, resolveIsoOrRelative, shouldCompletePlanOnClose, getActiveExtensionRegistrations, } from "../runtime-primitives.js";
|
|
9
|
-
import { collectBlockedByIds } from "../actionability.js";
|
|
9
|
+
import { collectBlockedByIds, indexBlockedByIds } from "../actionability.js";
|
|
10
10
|
import { applyTerminalOrderingPolicy, requireTerminalReason, } from "../lifecycle-policy.js";
|
|
11
11
|
import { renderPmCommand } from "../command-line.js";
|
|
12
12
|
const CLOSE_VALIDATION_FIELDS = [
|
|
@@ -40,7 +40,7 @@ function findMissingCloseValidationFields(itemMetadata) {
|
|
|
40
40
|
for (const field of CLOSE_VALIDATION_FIELDS) {
|
|
41
41
|
const rawValue = itemMetadata[field.key];
|
|
42
42
|
if (typeof rawValue !== "string" || rawValue.trim().length === 0) {
|
|
43
|
-
missing.push(field
|
|
43
|
+
missing.push(field);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return missing;
|
|
@@ -137,14 +137,19 @@ function findActiveChildIds(items, parentId, statusRegistry) {
|
|
|
137
137
|
.sort((left, right) => left.localeCompare(right));
|
|
138
138
|
}
|
|
139
139
|
function findAutoUnblockCandidates(items, closedId, statusRegistry) {
|
|
140
|
-
const itemsById = new Map(items.map((item) => [item.id, item]));
|
|
140
|
+
const itemsById = new Map(items.map((item) => [item.id.trim().toLowerCase(), item]));
|
|
141
|
+
const blockerIdsByItem = indexBlockedByIds(items);
|
|
142
|
+
const normalizedClosedId = closedId.trim().toLowerCase();
|
|
141
143
|
const blockedStatuses = statusRegistry.blocked_statuses;
|
|
142
144
|
return items
|
|
143
145
|
.filter((item) => blockedStatuses.has(item.status))
|
|
144
|
-
.map((item) => ({
|
|
145
|
-
|
|
146
|
+
.map((item) => ({
|
|
147
|
+
item,
|
|
148
|
+
blockerIds: blockerIdsByItem.get(item.id.trim().toLowerCase()),
|
|
149
|
+
}))
|
|
150
|
+
.filter(({ blockerIds }) => blockerIds.includes(normalizedClosedId))
|
|
146
151
|
.filter(({ blockerIds }) => blockerIds.every((blockerId) => {
|
|
147
|
-
if (blockerId ===
|
|
152
|
+
if (blockerId === normalizedClosedId) {
|
|
148
153
|
return true;
|
|
149
154
|
}
|
|
150
155
|
const blocker = itemsById.get(blockerId);
|
|
@@ -171,7 +176,7 @@ async function autoUnblockResolvedDependents(pmRoot, settings, items, closedId,
|
|
|
171
176
|
const dependencies = document.metadata.dependencies ?? [];
|
|
172
177
|
/* c8 ignore stop */
|
|
173
178
|
const remainingDependencies = dependencies.filter((dependency) => {
|
|
174
|
-
const dependencyId = dependency.id.trim();
|
|
179
|
+
const dependencyId = dependency.id.trim().toLowerCase();
|
|
175
180
|
return (dependency.kind !== "blocked_by" ||
|
|
176
181
|
!candidate.blocker_ids.includes(dependencyId));
|
|
177
182
|
});
|
|
@@ -254,32 +259,34 @@ function applyDuplicateCloseMetadata(metadata, duplicateOf) {
|
|
|
254
259
|
}
|
|
255
260
|
return duplicateFallbackFields;
|
|
256
261
|
}
|
|
257
|
-
function collectCloseValidationWarnings(metadata, validateCloseMode, activeChildIds,
|
|
262
|
+
function collectCloseValidationWarnings(metadata, validateCloseMode, activeChildIds, pmRoot) {
|
|
258
263
|
const warnings = [];
|
|
259
264
|
if (validateCloseMode !== "off") {
|
|
260
265
|
const missingFields = findMissingCloseValidationFields(metadata);
|
|
261
266
|
if (missingFields.length > 0) {
|
|
267
|
+
const missingLabels = missingFields.map((field) => field.label);
|
|
262
268
|
if (validateCloseMode === "strict") {
|
|
263
|
-
const missingFlags = missingFields.map((field) => `--${field.replaceAll("_", "-")}`);
|
|
264
|
-
const
|
|
265
|
-
"
|
|
269
|
+
const missingFlags = missingFields.map((field) => `--${field.key.replaceAll("_", "-")}`);
|
|
270
|
+
const updateTokens = [
|
|
271
|
+
"--pm-path",
|
|
272
|
+
pmRoot,
|
|
273
|
+
"update",
|
|
266
274
|
metadata.id,
|
|
267
|
-
closeReason ?? "<reason>",
|
|
268
275
|
...missingFlags.flatMap((flag) => [flag, "<value>"]),
|
|
269
276
|
];
|
|
270
|
-
throw new PmCliError(`Cannot close item ${metadata.id}: missing ${
|
|
277
|
+
throw new PmCliError(`Cannot close item ${metadata.id}: missing ${missingLabels.join(", ")}. Populate fields or use --validate-close warn.`, EXIT_CODE.USAGE, {
|
|
271
278
|
code: "close_validation_missing_fields",
|
|
272
279
|
recovery: {
|
|
273
280
|
missing: missingFlags,
|
|
274
|
-
suggested_retry: renderPmCommand(
|
|
281
|
+
suggested_retry: renderPmCommand(updateTokens),
|
|
275
282
|
},
|
|
276
283
|
nextSteps: [
|
|
277
|
-
"
|
|
284
|
+
"Run the suggested pm update, then retry the original pm close invocation.",
|
|
278
285
|
"Use --validate-close warn only when governance permits an evidenced exception.",
|
|
279
286
|
],
|
|
280
287
|
});
|
|
281
288
|
}
|
|
282
|
-
warnings.push(`close_validation_missing_fields:${metadata.id}:${
|
|
289
|
+
warnings.push(`close_validation_missing_fields:${metadata.id}:${missingLabels.join(",")}`);
|
|
283
290
|
}
|
|
284
291
|
if (activeChildIds.length > 0) {
|
|
285
292
|
if (validateCloseMode === "strict") {
|
|
@@ -315,7 +322,7 @@ function mutateCloseMetadata(metadata, context) {
|
|
|
315
322
|
}
|
|
316
323
|
const inlineChangedFields = applyInlineCloseFields(metadata, context.options);
|
|
317
324
|
const duplicateFallbackFields = applyDuplicateCloseMetadata(metadata, context.duplicateOf);
|
|
318
|
-
const mutationWarnings = collectCloseValidationWarnings(metadata, context.validateCloseMode, context.activeChildIds, context.
|
|
325
|
+
const mutationWarnings = collectCloseValidationWarnings(metadata, context.validateCloseMode, context.activeChildIds, context.pmRoot);
|
|
319
326
|
metadata.status = context.statusRegistry.close_status;
|
|
320
327
|
metadata.closed_at = context.closedAt;
|
|
321
328
|
const shouldWriteCompletedAt = context.options.completedAt !== undefined ||
|
|
@@ -423,6 +430,7 @@ export async function closeItem(id, closeReasonText, options, global) {
|
|
|
423
430
|
force: options.force,
|
|
424
431
|
mutate(document) {
|
|
425
432
|
return mutateCloseMetadata(document.metadata, {
|
|
433
|
+
pmRoot,
|
|
426
434
|
statusRegistry,
|
|
427
435
|
force: options.force,
|
|
428
436
|
options,
|
|
@@ -450,4 +458,4 @@ export function runClose(id, closeReasonText, options, global) {
|
|
|
450
458
|
return closeItem(id, closeReasonText, options, global);
|
|
451
459
|
}
|
|
452
460
|
//# sourceMappingURL=close.js.map
|
|
453
|
-
//# debugId=
|
|
461
|
+
//# debugId=83affe54-a56c-5d84-b6b0-9634d4238ff5
|
|
@@ -34,6 +34,8 @@ export interface CreateCommandOptions extends MutationMetadataCommandOptions, Sh
|
|
|
34
34
|
body?: string;
|
|
35
35
|
/** Value that configures or reports allow missing parent for this contract. */
|
|
36
36
|
allowMissingParent?: boolean;
|
|
37
|
+
/** Explicitly permit unresolved local dependency targets with warning receipts. */
|
|
38
|
+
allowUnresolvedDeps?: boolean;
|
|
37
39
|
/** Value that configures or reports template for this contract. */
|
|
38
40
|
template?: string;
|
|
39
41
|
/** Creates mode using the validated operation inputs. */
|
|
@@ -4,7 +4,7 @@
|
|
|
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]="
|
|
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]="ffa56c1a-d98c-566a-81c5-4ad5608aa26c")}catch(e){}}();
|
|
8
8
|
import { pathExists, 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, 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, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
9
|
import { requireTerminalReasonWithRecovery } from "../lifecycle-policy.js";
|
|
10
10
|
import { evaluateSimilarityGovernance, similarityAdvisoryWarnings, } from "../similarity.js";
|
|
@@ -17,8 +17,10 @@ import { parseLinkedTestAssertionEqualsMap, parseLinkedTestAssertionGteMap, pars
|
|
|
17
17
|
import { looksLikeStructuredLinkedTestEntry, normalizeStructuredLinkedTestEntry, } from "../test/entry.js";
|
|
18
18
|
import { COMMON_UNSET_FIELD_DEFINITIONS_AFTER_AUTHOR, COMMON_UNSET_FIELD_DEFINITIONS_BEFORE_AUTHOR, parseCommandUnsetTargets, resolveRuntimeUnsetFieldDefinition, } from "./shared-unset-fields.js";
|
|
19
19
|
import { ensureEnumValue } from "./recurrence-parsers.js";
|
|
20
|
-
import { assertDependencyEdgesAllowed, assertValidBareDependencyFlagValue, } from "../dependency-flag-validation.js";
|
|
20
|
+
import { assertDependencyEdgesAllowed, assertDependencyTargetsResolvable, assertValidBareDependencyFlagValue, } from "../dependency-flag-validation.js";
|
|
21
21
|
import { normalizeDependencySeedId, normalizeDependencySourceKind, } from "../dependency-provenance.js";
|
|
22
|
+
import { resolveCanonicalRelationshipKind } from "../relationships.js";
|
|
23
|
+
import { supportsCreateExplicitEmpty } from "../agent/create-option-policy.js";
|
|
22
24
|
import { parseEventEntries, parseReminderEntries, parseTypeOptionEntries, } from "./repeatable-metadata-parsers.js";
|
|
23
25
|
import { DEPENDENCY_KIND_VALUES, ISSUE_SEVERITY_VALUES, RISK_VALUES, SCOPE_VALUES, } from "../../types/index.js";
|
|
24
26
|
const CREATE_MODE_VALUES = ["strict", "progressive"];
|
|
@@ -188,17 +190,10 @@ function parseDependencies(raw, nowValue, prefix, fallbackAuthor) {
|
|
|
188
190
|
});
|
|
189
191
|
return { values, explicitEmpty: false };
|
|
190
192
|
}
|
|
191
|
-
const DEPENDENCY_KIND_INPUT_ALIASES = {
|
|
192
|
-
"blocked-by": "blocked_by",
|
|
193
|
-
depends_on: "blocked_by",
|
|
194
|
-
"depends-on": "blocked_by",
|
|
195
|
-
};
|
|
196
193
|
function normalizeDependencyKindInput(raw) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const alias = DEPENDENCY_KIND_INPUT_ALIASES[raw.toLowerCase()];
|
|
201
|
-
return alias ?? raw;
|
|
194
|
+
return typeof raw === "string"
|
|
195
|
+
? (resolveCanonicalRelationshipKind(raw) ?? raw.trim())
|
|
196
|
+
: raw;
|
|
202
197
|
}
|
|
203
198
|
function looksLikeStructuredEntry(raw, keys) {
|
|
204
199
|
if (raw.startsWith("```") || raw.includes("\n")) {
|
|
@@ -521,7 +516,7 @@ function assertNoStrictRequiredOptionClears(requiredOptions, createMode, clearOp
|
|
|
521
516
|
if (createMode !== "strict") {
|
|
522
517
|
return;
|
|
523
518
|
}
|
|
524
|
-
const strictRequiredClears = requiredOptions.filter((required) => clearOptionKeys.has(required));
|
|
519
|
+
const strictRequiredClears = requiredOptions.filter((required) => clearOptionKeys.has(required) && !supportsCreateExplicitEmpty(required));
|
|
525
520
|
if (strictRequiredClears.length === 0) {
|
|
526
521
|
return;
|
|
527
522
|
}
|
|
@@ -619,6 +614,10 @@ function requireCreateOptionByType(typeDefinition, options, createMode, clearOpt
|
|
|
619
614
|
if (optionKey === "status" && typeDefinition.default_status !== undefined) {
|
|
620
615
|
return true;
|
|
621
616
|
}
|
|
617
|
+
if (clearOptionKeys.has(optionKey) &&
|
|
618
|
+
supportsCreateExplicitEmpty(optionKey)) {
|
|
619
|
+
return true;
|
|
620
|
+
}
|
|
622
621
|
return hasCreateOptionValue(optionLookup, optionKey);
|
|
623
622
|
};
|
|
624
623
|
const missingRequiredOptions = policyState.required.filter((required) => !satisfiesRequiredOption(required));
|
|
@@ -1036,6 +1035,7 @@ function collectTemplateCustomTypeOptions(typeDefinition, resolvedOptions) {
|
|
|
1036
1035
|
/** Resolve the target item type and creation mode for `pm create`: merge any `--template` options, apply the governance default-type fallback, map a near-miss `--type` to its canonical synonym (never blocking), and derive the schedule preset and effective create mode. Returns the (possibly template-merged) options alongside the resolved type definition, canonical type name, schedule preset, and create mode. */
|
|
1037
1036
|
async function resolveCreateTypeSelection(options, global, pmRoot, settings, typeRegistry) {
|
|
1038
1037
|
let resolvedOptions = options;
|
|
1038
|
+
const warnings = [];
|
|
1039
1039
|
if (resolvedOptions.template !== undefined) {
|
|
1040
1040
|
const templateName = resolvedOptions.template.trim();
|
|
1041
1041
|
if (templateName.length === 0) {
|
|
@@ -1062,7 +1062,7 @@ async function resolveCreateTypeSelection(options, global, pmRoot, settings, typ
|
|
|
1062
1062
|
? resolveTypeName(synonymCanonical, typeRegistry)
|
|
1063
1063
|
: undefined;
|
|
1064
1064
|
if (synonymResolved) {
|
|
1065
|
-
|
|
1065
|
+
warnings.push(`type_coercion:${resolvedOptions.type.trim()}:${synonymResolved}`);
|
|
1066
1066
|
resolvedOptions.type = synonymResolved;
|
|
1067
1067
|
resolvedTypeName = synonymResolved;
|
|
1068
1068
|
}
|
|
@@ -1095,7 +1095,14 @@ async function resolveCreateTypeSelection(options, global, pmRoot, settings, typ
|
|
|
1095
1095
|
throw new PmCliError(`--schedule-preset ${schedulePreset} is only supported for Reminder, Meeting, or Event types`, EXIT_CODE.USAGE);
|
|
1096
1096
|
}
|
|
1097
1097
|
const createMode = resolveEffectiveCreateMode(resolvedOptions.createMode, schedulePreset, settings.governance.create_mode_default);
|
|
1098
|
-
return {
|
|
1098
|
+
return {
|
|
1099
|
+
resolvedOptions,
|
|
1100
|
+
typeDefinition,
|
|
1101
|
+
type,
|
|
1102
|
+
schedulePreset,
|
|
1103
|
+
createMode,
|
|
1104
|
+
warnings,
|
|
1105
|
+
};
|
|
1099
1106
|
}
|
|
1100
1107
|
/** Seed the explicit-unset and clear-option key sets from the parsed `--unset` targets, then fold in each enabled `--clear-<collection>` flag: it marks the collection's item-metadata key as explicitly unset and its option key as cleared, and rejects combining a clear flag with its own value flag. Returns the augmented sets used downstream for required-flag relaxation and history messaging. */
|
|
1101
1108
|
function collectCreateClearTargets(resolvedOptions, unsetTargets) {
|
|
@@ -1316,11 +1323,31 @@ function assertNoCreateFieldUnsetConflicts(registeredItemFieldValues, runtimeCre
|
|
|
1316
1323
|
}
|
|
1317
1324
|
/** Throw the aggregated `missing_required_option` error when a type's required create options and/or required type-option keys were not all supplied in one invocation. Builds a type-aware valid example and staged-onboarding next steps (a strict-mode invocation also carries a compact recovery envelope). A no-op when nothing is missing. */
|
|
1318
1325
|
function assertNoMissingRequiredCreateOptions(params) {
|
|
1319
|
-
const { combinedMissingFlags, typeDefinition, missingRequiredCreateFlags, missingRequiredTypeOptionKeys, openStatus, type, createMode, } = params;
|
|
1326
|
+
const { combinedMissingFlags, typeDefinition, missingRequiredCreateFlags, missingRequiredTypeOptionKeys, openStatus, type, createMode, missingRequiredRuntimeFields, } = params;
|
|
1320
1327
|
if (combinedMissingFlags.length === 0) {
|
|
1321
1328
|
return;
|
|
1322
1329
|
}
|
|
1323
|
-
const
|
|
1330
|
+
const runtimeFieldSyntax = missingRequiredRuntimeFields.map((field) => {
|
|
1331
|
+
const placeholder = field.type === "boolean"
|
|
1332
|
+
? "<true|false>"
|
|
1333
|
+
: field.type === "array"
|
|
1334
|
+
? "<json-array>"
|
|
1335
|
+
: field.type === "object"
|
|
1336
|
+
? "<json-object>"
|
|
1337
|
+
: field.type === "number"
|
|
1338
|
+
? "<number>"
|
|
1339
|
+
: field.type === "string_array" || field.repeatable
|
|
1340
|
+
? "<value>"
|
|
1341
|
+
: "<string>";
|
|
1342
|
+
return {
|
|
1343
|
+
example: `--${field.cli_flag} ${placeholder}`,
|
|
1344
|
+
description: `--${field.cli_flag} maps to ${field.metadata_key} (${field.type}${field.repeatable ? ", repeatable" : ""})`,
|
|
1345
|
+
};
|
|
1346
|
+
});
|
|
1347
|
+
const nextValidExample = [
|
|
1348
|
+
buildTypeSpecificCreateExample(typeDefinition, missingRequiredCreateFlags, missingRequiredTypeOptionKeys, openStatus),
|
|
1349
|
+
...runtimeFieldSyntax.map((field) => field.example),
|
|
1350
|
+
].join(" ");
|
|
1324
1351
|
const nextSteps = [
|
|
1325
1352
|
`Run "pm create --help --type ${type}" for type-aware required option guidance.`,
|
|
1326
1353
|
];
|
|
@@ -1335,6 +1362,9 @@ function assertNoMissingRequiredCreateOptions(params) {
|
|
|
1335
1362
|
nextSteps.push('For minimal scheduling inputs, try "--schedule-preset lightweight".');
|
|
1336
1363
|
}
|
|
1337
1364
|
}
|
|
1365
|
+
if (runtimeFieldSyntax.length > 0) {
|
|
1366
|
+
nextSteps.push(`Required custom field formats: ${runtimeFieldSyntax.map((field) => field.description).join("; ")}.`);
|
|
1367
|
+
}
|
|
1338
1368
|
const errorMessage = combinedMissingFlags.length === 1
|
|
1339
1369
|
? `Missing required option ${combinedMissingFlags[0]} for type "${type}"`
|
|
1340
1370
|
: `Missing required options ${combinedMissingFlags.join(", ")} for type "${type}"`;
|
|
@@ -1559,6 +1589,8 @@ export async function runCreate(options, global) {
|
|
|
1559
1589
|
const extensionFieldNames = collectRegisteredItemFieldNames(extensionRegistrations);
|
|
1560
1590
|
const registeredItemFieldValues = parseRegisteredItemFieldAssignments(resolvedOptions.field, extensionRegistrations);
|
|
1561
1591
|
const runtimeCreateFieldValues = collectRuntimeCreateFieldValues(resolvedOptions, runtimeFieldRegistry, type);
|
|
1592
|
+
const missingRequiredRuntimeFlagSet = new Set(runtimeCreateFieldValues.missing_required_flags);
|
|
1593
|
+
const missingRequiredRuntimeFields = runtimeFieldRegistry.definitions.filter((field) => missingRequiredRuntimeFlagSet.has(`--${field.cli_flag}`));
|
|
1562
1594
|
assertNoCreateFieldUnsetConflicts(registeredItemFieldValues, runtimeCreateFieldValues, unsetTargets);
|
|
1563
1595
|
const missingRequiredTypeOptionKeys = collectMissingRequiredTypeOptionKeys(validatedTypeOptions.errors, type);
|
|
1564
1596
|
const missingRequiredTypeOptionFlags = missingRequiredTypeOptionKeys.map((key) => `--type-option ${key}=<value>`);
|
|
@@ -1578,6 +1610,7 @@ export async function runCreate(options, global) {
|
|
|
1578
1610
|
openStatus: statusRegistry.open_status,
|
|
1579
1611
|
type,
|
|
1580
1612
|
createMode,
|
|
1613
|
+
missingRequiredRuntimeFields,
|
|
1581
1614
|
});
|
|
1582
1615
|
assertNoInvalidTypeOptions(validatedTypeOptions.errors, type, typeDefinition, statusRegistry);
|
|
1583
1616
|
const id = await resolveCreateItemId({
|
|
@@ -1625,7 +1658,10 @@ export async function runCreate(options, global) {
|
|
|
1625
1658
|
? "warn"
|
|
1626
1659
|
: settings.validation.parent_reference;
|
|
1627
1660
|
const sprintReleasePolicy = settings.validation.sprint_release_format;
|
|
1628
|
-
const validationWarnings =
|
|
1661
|
+
const validationWarnings = [
|
|
1662
|
+
...typeSelection.warnings,
|
|
1663
|
+
...collectCreateScheduleWarnings(type, id, deadline, reminders.values, events.values),
|
|
1664
|
+
];
|
|
1629
1665
|
const parentValidation = await resolveCreateParentWithWarnings({
|
|
1630
1666
|
itemId: id,
|
|
1631
1667
|
parent,
|
|
@@ -1657,6 +1693,14 @@ export async function runCreate(options, global) {
|
|
|
1657
1693
|
});
|
|
1658
1694
|
const dependencyValues = blockedByResolution.dependencyValues;
|
|
1659
1695
|
assertDependencyEdgesAllowed(id, dependencyValues);
|
|
1696
|
+
validationWarnings.push(...(await assertDependencyTargetsResolvable({
|
|
1697
|
+
pmRoot,
|
|
1698
|
+
dependencies: dependencyValues,
|
|
1699
|
+
idPrefix: settings.id_prefix,
|
|
1700
|
+
itemFormat: settings.item_format,
|
|
1701
|
+
typeToFolder: typeRegistry.type_to_folder,
|
|
1702
|
+
allowUnresolved: resolvedOptions.allowUnresolvedDeps,
|
|
1703
|
+
})));
|
|
1660
1704
|
status = blockedByResolution.status;
|
|
1661
1705
|
const blockedReason = resolveUnsettableOptionalString(unsetKeys, "blocked_reason", resolvedOptions.blockedReason);
|
|
1662
1706
|
const unblockNote = resolveUnsettableOptionalString(unsetKeys, "unblock_note", resolvedOptions.unblockNote);
|
|
@@ -1794,6 +1838,9 @@ export async function runCreate(options, global) {
|
|
|
1794
1838
|
allowDuplicate: resolvedOptions.allowDuplicate,
|
|
1795
1839
|
});
|
|
1796
1840
|
const outputItem = structuredClone(itemMetadata);
|
|
1841
|
+
if (createMode === "strict" && explicitUnsets.has("dependencies")) {
|
|
1842
|
+
outputItem.dependencies = [];
|
|
1843
|
+
}
|
|
1797
1844
|
// GH-216: nudge agents toward the underutilized in_progress state instead of
|
|
1798
1845
|
// jumping open -> closed. Only surfaces for workable types created in the open
|
|
1799
1846
|
// status when the workflow defines a distinct in_progress status to move to.
|
|
@@ -1841,4 +1888,4 @@ export const _testOnlyCreateCommand = {
|
|
|
1841
1888
|
typeOptionExampleValue,
|
|
1842
1889
|
};
|
|
1843
1890
|
//# sourceMappingURL=create.js.map
|
|
1844
|
-
//# debugId=
|
|
1891
|
+
//# debugId=ffa56c1a-d98c-566a-81c5-4ad5608aa26c
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm plan 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]="dc87393e-61e3-5d43-a756-d5f156faf29e")}catch(e){}}();
|
|
8
8
|
import { pathExists, getActiveExtensionRegistrations, isTerminalStatus, resolveItemTypeRegistry, resolveRuntimeStatusRegistry, resolveTypeName, EXIT_CODE, PmCliError, splitCommaList, nowIso, locateItem, mutateItem, readLocatedItem, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, isTerminalPlanMode, } from "../runtime-primitives.js";
|
|
9
9
|
import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
|
|
10
10
|
import { runCreate, } from "./create.js";
|
|
@@ -522,7 +522,10 @@ function nextActionsFor(planId, plan) {
|
|
|
522
522
|
tips.push(`pm plan approve ${planId} --message "ready to execute"`);
|
|
523
523
|
}
|
|
524
524
|
if (plan.steps_summary.completed === plan.steps_summary.total &&
|
|
525
|
-
plan.steps_summary.total > 0
|
|
525
|
+
plan.steps_summary.total > 0 &&
|
|
526
|
+
!isTerminalPlanMode(plan.mode) &&
|
|
527
|
+
plan.status !== "closed" &&
|
|
528
|
+
plan.status !== "canceled") {
|
|
526
529
|
tips.push(`pm close ${planId} "plan complete"`);
|
|
527
530
|
}
|
|
528
531
|
return tips;
|
|
@@ -1579,4 +1582,4 @@ export const _testOnlyPlanCommand = {
|
|
|
1579
1582
|
changedPlanMetadataFields,
|
|
1580
1583
|
};
|
|
1581
1584
|
//# sourceMappingURL=plan.js.map
|
|
1582
|
-
//# debugId=
|
|
1585
|
+
//# debugId=dc87393e-61e3-5d43-a756-d5f156faf29e
|