@unbrained/pm-cli 2026.8.21 → 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 +16 -0
- package/dist/cli/error-guidance.d.ts +9 -4
- package/dist/cli/error-guidance.js +16 -15
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +40 -7
- package/dist/cli-bundle/bundle-manifest.json +153 -153
- package/dist/cli-bundle/chunks/{chunk-BKYB45NQ.js → chunk-BWX4SK46.js} +48 -48
- 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-LARJJ3RK.js → chunk-MYYI3ZOA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BUNIEJNE.js → chunk-MZTZQTMS.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-LOVTQ52Z.js → chunk-QI2CT3IX.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-SMWXHMVB.js +35 -0
- package/dist/cli-bundle/chunks/{chunk-N3DSV4CH.js → chunk-U6GQ4VMV.js} +6 -6
- package/dist/cli-bundle/chunks/{chunk-3AFAUHUE.js → chunk-VMMIL3SI.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-WG4STC36.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-JSLOFXGA.js → chunk-YBPJAOQQ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-F57EWDEF.js → register-list-query-HZKBQNWW.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-7IY2D5KO.js → register-mutation-HTKEEGRD.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-FALL3YTU.js → register-operations-6EMRWJJY.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-HXU7IZZD.js → register-setup-QK4OTOXN.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FJ22HNRP.js → chunk-2ARQGDDW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CKKQSJNN.js → chunk-2AZT5WXZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-F4YEW5I2.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-FH6DYED3.js → chunk-6S2MO3Q3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UZE7XUZK.js → chunk-A2BC5PQL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-C4S4A4JJ.js +5 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KDNG7TKQ.js → chunk-D6RBZEJJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-E2EWYPY6.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-4ERLO7QD.js → chunk-GMYPD4FX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-L5LDSRO2.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZOSEELYJ.js → chunk-MB37AYN6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MCOR37QK.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2NIY5NKG.js → chunk-PH2OXXVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YKBKIEAJ.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 +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- 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/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/generated/generated-error-code-catalog-part-1.js +38 -14
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +14 -2
- package/dist/sdk/governance/health.d.ts +3 -0
- package/dist/sdk/governance/health.js +39 -7
- package/dist/sdk/governance/hierarchy-validation.d.ts +29 -0
- package/dist/sdk/governance/hierarchy-validation.js +109 -0
- package/dist/sdk/governance/validate.d.ts +1 -7
- package/dist/sdk/governance/validate.js +47 -99
- 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.js +46 -2
- 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 +80 -31
- 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/index.d.ts +2 -2
- package/dist/sdk/index.js +3 -3
- package/dist/sdk/item-children.js +21 -8
- package/dist/sdk/lifecycle/create.js +125 -96
- 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/update.d.ts +2 -0
- package/dist/sdk/lifecycle/update.js +171 -83
- package/dist/sdk/query/complete-list.d.ts +3 -3
- package/dist/sdk/query/complete-list.js +46 -3
- package/dist/sdk/query/list.d.ts +4 -3
- package/dist/sdk/query/list.js +89 -49
- 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/relationships.js +17 -10
- package/dist/sdk/runtime.d.ts +3 -2
- package/dist/sdk/runtime.js +3 -2
- package/dist/sdk/test/batch.js +13 -5
- package/dist/sdk/test/execution.js +10 -2
- package/dist/types.d.ts +11 -0
- package/dist/types.js +2 -2
- package/docs/AGENT_UX_CONTRACTS.md +20 -4
- package/docs/COMMANDS.md +29 -14
- package/docs/DEPENDENCY_KIND_CONTRACT.md +31 -3
- 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/RELATIONSHIP_GRAPH.md +6 -3
- 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 +593 -35
- package/dist/cli-bundle/chunks/chunk-2MA6ZQVZ.js +0 -197
- package/dist/cli-bundle/chunks/chunk-7VHZS727.js +0 -5
- package/dist/cli-bundle/chunks/chunk-OCLPLFAY.js +0 -35
- package/dist/cli-bundle/chunks/chunk-S4IRYKBU.js +0 -13
- package/dist/cli-bundle/focused-chunks/chunk-7WZRLCYF.js +0 -50
- package/dist/cli-bundle/focused-chunks/chunk-EEFKYMDR.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-F2A56DHV.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-FV5ACOK7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JEAVFOWM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-NJ63LOP6.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-NXRTQ7HI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TJ7EMJ46.js +0 -4
package/dist/sdk/query/list.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the pm list 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]="93e8c187-e198-50fc-bf2c-7dae2ea42219")}catch(e){}}();
|
|
8
8
|
import { assertInitializedTracker } from "../environment/tracker-preflight.js";
|
|
9
9
|
import { getActiveExtensionRegistrations, hasActiveOnReadHooks, } from "../../core/extensions/index.js";
|
|
10
10
|
import { toItemRecord } from "../../core/item/item-record.js";
|
|
@@ -27,6 +27,8 @@ import { queryItemMetadataIndex } from "../../core/store/item-metadata-query-ind
|
|
|
27
27
|
import { resolvePmRoot } from "../../core/store/paths.js";
|
|
28
28
|
import { readSettings } from "../../core/store/settings.js";
|
|
29
29
|
import { LIST_FILTER_FLAG_CONTRACTS } from "../cli-contracts/flag-contracts.js";
|
|
30
|
+
import { resolveWorkspaceRelationshipKindRegistry } from "../graph/assembly.js";
|
|
31
|
+
import { collectHierarchyRelations, indexHierarchyRelations, } from "../graph/hierarchy-integrity.js";
|
|
30
32
|
import { createQueryFingerprint, encodeQueryCursor, resolveQueryCursorStart, selectCursorSemanticOptions, } from "../pagination.js";
|
|
31
33
|
import { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, listListProjectionFields, } from "./projection-contracts.js";
|
|
32
34
|
export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, } from "./projection-contracts.js";
|
|
@@ -640,7 +642,9 @@ function resolveListFilterSet(status, options, typeRegistry, statusRegistry) {
|
|
|
640
642
|
parentFilter: options.parent?.trim(),
|
|
641
643
|
treeEnabled: options.tree === true,
|
|
642
644
|
sprintFilter: parseStringFilterSet(options.sprint, { label: "--sprint" }),
|
|
643
|
-
releaseFilter: parseStringFilterSet(options.release, {
|
|
645
|
+
releaseFilter: parseStringFilterSet(options.release, {
|
|
646
|
+
label: "--release",
|
|
647
|
+
}),
|
|
644
648
|
missingMetadataFilters,
|
|
645
649
|
missingMetadataActive: hasMissingMetadataFilter(missingMetadataFilters),
|
|
646
650
|
lifecycleClassifier: lifecycleClassifierFromStatusRegistry(statusRegistry),
|
|
@@ -648,12 +652,6 @@ function resolveListFilterSet(status, options, typeRegistry, statusRegistry) {
|
|
|
648
652
|
contentFiltersActive: hasContentFieldFilter(contentFieldFilters),
|
|
649
653
|
};
|
|
650
654
|
}
|
|
651
|
-
function matchesListScalarFilters(item, filters, statusRegistry) {
|
|
652
|
-
return (matchesListIdentityFilters(item, filters, statusRegistry) &&
|
|
653
|
-
matchesListDateFilters(item, filters) &&
|
|
654
|
-
matchesListAssigneeFilterSet(item, filters) &&
|
|
655
|
-
matchesListScopeFilters(item, filters));
|
|
656
|
-
}
|
|
657
655
|
function matchesListIdentityFilters(item, filters, statusRegistry) {
|
|
658
656
|
if (filters.idsFilter && !filters.idsFilter.has(item.id))
|
|
659
657
|
return false;
|
|
@@ -681,10 +679,17 @@ function matchesListAssigneeFilterSet(item, filters) {
|
|
|
681
679
|
return (filters.assigneeFilter === undefined ||
|
|
682
680
|
(item.assignee !== undefined && filters.assigneeFilter.has(item.assignee)));
|
|
683
681
|
}
|
|
684
|
-
function matchesListScopeFilters(item, filters) {
|
|
682
|
+
function matchesListScopeFilters(item, filters, parentsByChild) {
|
|
683
|
+
const scalarParent = item.parent?.trim().toLowerCase();
|
|
684
|
+
const logicalParentIds = [
|
|
685
|
+
...new Set([
|
|
686
|
+
...(parentsByChild?.get(item.id.trim().toLowerCase()) ?? []),
|
|
687
|
+
...(scalarParent ? [scalarParent] : []),
|
|
688
|
+
]),
|
|
689
|
+
];
|
|
685
690
|
if (filters.parentFilter !== undefined &&
|
|
686
691
|
!filters.treeEnabled &&
|
|
687
|
-
|
|
692
|
+
!logicalParentIds.includes(filters.parentFilter.trim().toLowerCase()))
|
|
688
693
|
return false;
|
|
689
694
|
if (filters.sprintFilter !== undefined &&
|
|
690
695
|
(item.sprint === undefined || !filters.sprintFilter.has(item.sprint)))
|
|
@@ -692,8 +697,11 @@ function matchesListScopeFilters(item, filters) {
|
|
|
692
697
|
return (filters.releaseFilter === undefined ||
|
|
693
698
|
(item.release !== undefined && filters.releaseFilter.has(item.release)));
|
|
694
699
|
}
|
|
695
|
-
function matchesListFilterSet(item, filters, statusRegistry, runtimeFieldFilters) {
|
|
696
|
-
if (!
|
|
700
|
+
function matchesListFilterSet(item, filters, statusRegistry, runtimeFieldFilters, parentsByChild) {
|
|
701
|
+
if (!matchesListIdentityFilters(item, filters, statusRegistry) ||
|
|
702
|
+
!matchesListDateFilters(item, filters) ||
|
|
703
|
+
!matchesListAssigneeFilterSet(item, filters) ||
|
|
704
|
+
!matchesListScopeFilters(item, filters, parentsByChild)) {
|
|
697
705
|
return false;
|
|
698
706
|
}
|
|
699
707
|
if (filters.missingMetadataActive &&
|
|
@@ -709,9 +717,9 @@ function matchesListFilterSet(item, filters, statusRegistry, runtimeFieldFilters
|
|
|
709
717
|
}
|
|
710
718
|
return true;
|
|
711
719
|
}
|
|
712
|
-
function applyFilters(items, status, options, typeRegistry, statusRegistry, runtimeFieldFilters) {
|
|
720
|
+
function applyFilters(items, status, options, typeRegistry, statusRegistry, runtimeFieldFilters, parentsByChild) {
|
|
713
721
|
const filters = resolveListFilterSet(status, options, typeRegistry, statusRegistry);
|
|
714
|
-
return items.filter((item) => matchesListFilterSet(item, filters, statusRegistry, runtimeFieldFilters));
|
|
722
|
+
return items.filter((item) => matchesListFilterSet(item, filters, statusRegistry, runtimeFieldFilters, parentsByChild));
|
|
715
723
|
}
|
|
716
724
|
function trimNonEmpty(value) {
|
|
717
725
|
if (typeof value !== "string") {
|
|
@@ -720,10 +728,12 @@ function trimNonEmpty(value) {
|
|
|
720
728
|
const trimmed = value.trim();
|
|
721
729
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
722
730
|
}
|
|
723
|
-
function withTreeMetadata(item, depth, childCount) {
|
|
731
|
+
function withTreeMetadata(item, depth, childCount, parentId) {
|
|
724
732
|
const itemRecord = toItemRecord(item);
|
|
725
733
|
const title = typeof itemRecord.title === "string" ? itemRecord.title : "";
|
|
726
|
-
const parent =
|
|
734
|
+
const parent = parentId ??
|
|
735
|
+
trimNonEmpty(typeof itemRecord.parent === "string" ? itemRecord.parent : undefined) ??
|
|
736
|
+
null;
|
|
727
737
|
return {
|
|
728
738
|
...item,
|
|
729
739
|
tree_depth: depth,
|
|
@@ -732,47 +742,73 @@ function withTreeMetadata(item, depth, childCount) {
|
|
|
732
742
|
tree_title: `${" ".repeat(depth)}${title}`,
|
|
733
743
|
};
|
|
734
744
|
}
|
|
735
|
-
function
|
|
745
|
+
function buildListTreeIndexes(sortedItems, hierarchyIndexes) {
|
|
736
746
|
const byId = new Map();
|
|
737
747
|
const childrenByParent = new Map();
|
|
738
748
|
for (const item of sortedItems) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
else {
|
|
749
|
-
childrenByParent.set(parentId, [item]);
|
|
749
|
+
const itemId = item.id.trim().toLowerCase();
|
|
750
|
+
byId.set(itemId, item);
|
|
751
|
+
const parentIds = hierarchyIndexes
|
|
752
|
+
? (hierarchyIndexes.parents_by_child.get(itemId) ?? [])
|
|
753
|
+
: [trimNonEmpty(item.parent)?.toLowerCase()].filter((value) => value !== undefined);
|
|
754
|
+
for (const parentId of parentIds) {
|
|
755
|
+
const children = childrenByParent.get(parentId) ?? [];
|
|
756
|
+
children.push(item);
|
|
757
|
+
childrenByParent.set(parentId, children);
|
|
750
758
|
}
|
|
751
759
|
}
|
|
752
|
-
|
|
753
|
-
|
|
760
|
+
return { byId, childrenByParent };
|
|
761
|
+
}
|
|
762
|
+
function resolveListTreeRoots(sortedItems, parentRoot, byId, childrenByParent, hierarchyIndexes) {
|
|
763
|
+
return parentRoot
|
|
764
|
+
? [...(childrenByParent.get(parentRoot.toLowerCase()) ?? [])]
|
|
754
765
|
: sortedItems.filter((item) => {
|
|
755
|
-
const
|
|
756
|
-
|
|
766
|
+
const parentIds = hierarchyIndexes
|
|
767
|
+
? (hierarchyIndexes.parents_by_child.get(item.id.trim().toLowerCase()) ?? [])
|
|
768
|
+
: [trimNonEmpty(item.parent)?.toLowerCase()].filter((value) => value !== undefined);
|
|
769
|
+
return parentIds.every((parentId) => !byId.has(parentId));
|
|
757
770
|
});
|
|
771
|
+
}
|
|
772
|
+
function orderItemsAsTree(sortedItems, parentRoot, maxDepth, hierarchyIndexes, completeItems = sortedItems) {
|
|
773
|
+
const { byId, childrenByParent } = buildListTreeIndexes(sortedItems, hierarchyIndexes);
|
|
774
|
+
const roots = resolveListTreeRoots(sortedItems, parentRoot, byId, childrenByParent, hierarchyIndexes);
|
|
758
775
|
const ordered = [];
|
|
759
776
|
const visited = new Set();
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
777
|
+
const canonicalIdByLowercase = new Map(completeItems.map((item) => [item.id.trim().toLowerCase(), item.id.trim()]));
|
|
778
|
+
const pending = [...roots].reverse().map((node) => ({
|
|
779
|
+
node,
|
|
780
|
+
depth: 0,
|
|
781
|
+
parentId: parentRoot === undefined
|
|
782
|
+
? undefined
|
|
783
|
+
: (canonicalIdByLowercase.get(parentRoot.trim().toLowerCase()) ??
|
|
784
|
+
parentRoot.trim()),
|
|
785
|
+
}));
|
|
786
|
+
while (pending.length > 0) {
|
|
787
|
+
const { node, depth, parentId } = pending.pop();
|
|
788
|
+
const nodeId = node.id.trim().toLowerCase();
|
|
789
|
+
if (visited.has(nodeId))
|
|
790
|
+
continue;
|
|
791
|
+
visited.add(nodeId);
|
|
792
|
+
const children = childrenByParent.get(nodeId) ?? [];
|
|
793
|
+
ordered.push(withTreeMetadata(node, depth, children.length, parentId));
|
|
794
|
+
if (maxDepth !== undefined && depth >= maxDepth)
|
|
795
|
+
continue;
|
|
796
|
+
for (const child of [...children].reverse()) {
|
|
797
|
+
pending.push({
|
|
798
|
+
node: child,
|
|
799
|
+
depth: depth + 1,
|
|
800
|
+
parentId: canonicalIdByLowercase.get(nodeId),
|
|
801
|
+
});
|
|
769
802
|
}
|
|
770
|
-
|
|
771
|
-
|
|
803
|
+
}
|
|
804
|
+
if (parentRoot === undefined && maxDepth === undefined) {
|
|
805
|
+
for (const item of sortedItems) {
|
|
806
|
+
const itemId = item.id.trim().toLowerCase();
|
|
807
|
+
if (visited.has(itemId))
|
|
808
|
+
continue;
|
|
809
|
+
visited.add(itemId);
|
|
810
|
+
ordered.push(withTreeMetadata(item, 0, childrenByParent.get(itemId)?.length ?? 0));
|
|
772
811
|
}
|
|
773
|
-
};
|
|
774
|
-
for (const root of roots) {
|
|
775
|
-
pushNode(root, 0);
|
|
776
812
|
}
|
|
777
813
|
return ordered;
|
|
778
814
|
}
|
|
@@ -1136,8 +1172,12 @@ export async function runList(status, options, global) {
|
|
|
1136
1172
|
let page = indexedPage;
|
|
1137
1173
|
if (!page) {
|
|
1138
1174
|
const items = await loadListItems(options, runtime, listWarnings);
|
|
1175
|
+
const needsHierarchyIndexes = ordering.treeEnabled || trimNonEmpty(options.parent) !== undefined;
|
|
1176
|
+
const hierarchyIndexes = needsHierarchyIndexes
|
|
1177
|
+
? indexHierarchyRelations(collectHierarchyRelations(items, resolveWorkspaceRelationshipKindRegistry()))
|
|
1178
|
+
: undefined;
|
|
1139
1179
|
appendUnknownTagWarning(items, options.tag, listWarnings);
|
|
1140
|
-
const filtered = applyFilters(items, statusSelection.resolvedStatus, statusSelection.effectiveOptions, runtime.typeRegistry, runtime.statusRegistry, runtime.runtimeFieldFilters);
|
|
1180
|
+
const filtered = applyFilters(items, statusSelection.resolvedStatus, statusSelection.effectiveOptions, runtime.typeRegistry, runtime.statusRegistry, runtime.runtimeFieldFilters, hierarchyIndexes?.parents_by_child);
|
|
1141
1181
|
// Edge-aware blocked selection (GH-578): classify against the complete
|
|
1142
1182
|
// loaded corpus so terminal blocker targets count as satisfied, then narrow
|
|
1143
1183
|
// the already-filtered rows to the shared blocked set.
|
|
@@ -1149,7 +1189,7 @@ export async function runList(status, options, global) {
|
|
|
1149
1189
|
: filtered;
|
|
1150
1190
|
const sorted = sortItems(scoped, ordering.sortField, ordering.sortOrder, runtime.statusRegistry);
|
|
1151
1191
|
const ordered = ordering.treeEnabled
|
|
1152
|
-
? orderItemsAsTree(sorted, ordering.parentRoot, ordering.treeDepth)
|
|
1192
|
+
? orderItemsAsTree(sorted, ordering.parentRoot, ordering.treeDepth, hierarchyIndexes, items)
|
|
1153
1193
|
: sorted;
|
|
1154
1194
|
page = pageAndProjectListItems(ordered, options, runtime.projection, ordering.treeEnabled, buildListCursorFingerprint(statusSelection.filtersStatus, options, ordering));
|
|
1155
1195
|
}
|
|
@@ -1241,4 +1281,4 @@ export const _testOnly = {
|
|
|
1241
1281
|
withTreeMetadata,
|
|
1242
1282
|
};
|
|
1243
1283
|
//# sourceMappingURL=list.js.map
|
|
1244
|
-
//# debugId=
|
|
1284
|
+
//# debugId=93e8c187-e198-50fc-bf2c-7dae2ea42219
|
|
@@ -5,7 +5,7 @@ export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "
|
|
|
5
5
|
/** One member of the universal read-output dimension set. */
|
|
6
6
|
export type PmReadOutputDimension = (typeof PM_READ_OUTPUT_DIMENSIONS)[number];
|
|
7
7
|
/** Built-in command roots whose primary operation is a read. */
|
|
8
|
-
export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-catalog", "package-manage", "comments-audit", "assurance"];
|
|
8
|
+
export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "duplicates", "package-catalog", "package-manage", "comments-audit", "assurance"];
|
|
9
9
|
/** Built-in read command supported by the universal output contract. */
|
|
10
10
|
export type PmReadOutputSurface = (typeof PM_READ_OUTPUT_SURFACES)[number];
|
|
11
11
|
/** Canonical output controls accepted by every built-in read action. */
|
|
@@ -81,6 +81,8 @@ export interface PmResolvedReadOutputDimensions {
|
|
|
81
81
|
cost?: PmResolvedReadOutputDimension<number | "unbounded">;
|
|
82
82
|
/** Requested static encoding or a retained legacy streaming behavior. */
|
|
83
83
|
encoding?: PmResolvedReadOutputDimension<"json" | "toon" | "stream">;
|
|
84
|
+
/** Canonical CLI options observed on the invocation. */
|
|
85
|
+
canonical_options_used?: string[];
|
|
84
86
|
/** Compatibility flags observed on the invocation. */
|
|
85
87
|
legacy_aliases_used: string[];
|
|
86
88
|
/** One-line migration instructions for observed compatibility flags. */
|
|
@@ -102,6 +104,8 @@ export interface PmReadOutputReceipt {
|
|
|
102
104
|
budget_tokens?: number;
|
|
103
105
|
/** Deterministic precedence used during resolution. */
|
|
104
106
|
precedence: readonly ["canonical", "legacy", "intent", "default"];
|
|
107
|
+
/** Canonical CLI options observed on the invocation. */
|
|
108
|
+
canonical_options_used?: string[];
|
|
105
109
|
/** Compatibility options observed on the invocation. */
|
|
106
110
|
legacy_aliases_used: string[];
|
|
107
111
|
/** One-line migration instructions for compatibility options. */
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* surface without coupling package authors to command-specific option names.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!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
|
+
!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]="a1272c1f-c03e-580c-8c44-6b3ddeedd240")}catch(e){}}();
|
|
9
9
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
10
10
|
import { PmCliError } from "../core/shared/errors.js";
|
|
11
11
|
import { compactReadOutputToBudget, estimateReadOutputTokens, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
|
|
@@ -43,6 +43,7 @@ export const PM_READ_OUTPUT_SURFACES = [
|
|
|
43
43
|
"docs",
|
|
44
44
|
"stats",
|
|
45
45
|
"aggregate",
|
|
46
|
+
"duplicates",
|
|
46
47
|
"package-catalog",
|
|
47
48
|
"package-manage",
|
|
48
49
|
"comments-audit",
|
|
@@ -60,6 +61,7 @@ const CANONICAL_OPTIONS = {
|
|
|
60
61
|
cost: "--output-budget",
|
|
61
62
|
encoding: "--output-format",
|
|
62
63
|
};
|
|
64
|
+
const READ_OUTPUT_INVOCATION_PROVENANCE = Symbol.for("pm.readOutputInvocationProvenance");
|
|
63
65
|
/** Canonical CLI flags that opt a read invocation into universal output shaping. */
|
|
64
66
|
export const PM_READ_OUTPUT_OPTION_FLAGS = Object.freeze(PM_READ_OUTPUT_DIMENSIONS.map((dimension) => CANONICAL_OPTIONS[dimension]));
|
|
65
67
|
/** Canonical control that composes the four per-call dimensions across reads. */
|
|
@@ -136,6 +138,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
|
|
|
136
138
|
docs: {},
|
|
137
139
|
stats: {},
|
|
138
140
|
aggregate: {},
|
|
141
|
+
duplicates: { amount: ["--limit"] },
|
|
139
142
|
"package-catalog": {},
|
|
140
143
|
"package-manage": {},
|
|
141
144
|
"comments-audit": {},
|
|
@@ -363,14 +366,32 @@ export function applyReadOutputIncludeModes(command, includeValue, commandOption
|
|
|
363
366
|
const modeOptions = readOutputIncludeModeOptions(command);
|
|
364
367
|
const selectors = [];
|
|
365
368
|
const modes = [];
|
|
369
|
+
const optionsWithProvenance = commandOptions;
|
|
370
|
+
const existingProvenance = optionsWithProvenance[READ_OUTPUT_INVOCATION_PROVENANCE];
|
|
371
|
+
const canonicalModes = new Set(existingProvenance?.canonical_include_modes ?? []);
|
|
372
|
+
const explicitLegacyAliases = new Set(existingProvenance?.explicit_legacy_aliases ?? []);
|
|
366
373
|
for (const token of requested) {
|
|
367
374
|
const option = modeOptions.get(token);
|
|
368
375
|
if (option === undefined) {
|
|
369
376
|
selectors.push(token);
|
|
370
377
|
continue;
|
|
371
378
|
}
|
|
379
|
+
const legacyFlag = `--${token.replaceAll("_", "-")}`;
|
|
380
|
+
if (isRequestedOption(readOption(commandOptions, legacyFlag))) {
|
|
381
|
+
explicitLegacyAliases.add(legacyFlag);
|
|
382
|
+
}
|
|
372
383
|
commandOptions[option] = true;
|
|
373
384
|
modes.push(token);
|
|
385
|
+
canonicalModes.add(token);
|
|
386
|
+
}
|
|
387
|
+
if (modes.length > 0) {
|
|
388
|
+
optionsWithProvenance[READ_OUTPUT_INVOCATION_PROVENANCE] = {
|
|
389
|
+
canonical_include_modes: [...canonicalModes],
|
|
390
|
+
explicit_legacy_aliases: [...explicitLegacyAliases],
|
|
391
|
+
...(existingProvenance?.cli_invocation_observed === true
|
|
392
|
+
? { cli_invocation_observed: true }
|
|
393
|
+
: {}),
|
|
394
|
+
};
|
|
374
395
|
}
|
|
375
396
|
return { selectors, modes };
|
|
376
397
|
}
|
|
@@ -430,8 +451,10 @@ function positiveInteger(value) {
|
|
|
430
451
|
: Number.NaN;
|
|
431
452
|
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : undefined;
|
|
432
453
|
}
|
|
433
|
-
function resolveLegacyDimension(contract, options, usable) {
|
|
454
|
+
function resolveLegacyDimension(contract, options, usable, ignore) {
|
|
434
455
|
for (const alias of contract.legacy_aliases) {
|
|
456
|
+
if (ignore(alias.flag))
|
|
457
|
+
continue;
|
|
435
458
|
const value = readOption(options, alias.flag);
|
|
436
459
|
const candidate = { value, flag: alias.flag };
|
|
437
460
|
if (isRequestedOption(value) && usable(candidate))
|
|
@@ -496,12 +519,43 @@ function resolveEncodingValue(canonical, legacy) {
|
|
|
496
519
|
? { source: "legacy", value: legacy.value }
|
|
497
520
|
: undefined;
|
|
498
521
|
}
|
|
522
|
+
function shouldIgnoreReadOutputLegacyAlias(provenance, dimension, flag) {
|
|
523
|
+
if (!provenance)
|
|
524
|
+
return false;
|
|
525
|
+
const explicitLegacyAliases = new Set(provenance.explicit_legacy_aliases);
|
|
526
|
+
if (provenance.cli_invocation_observed === true) {
|
|
527
|
+
return !explicitLegacyAliases.has(flag);
|
|
528
|
+
}
|
|
529
|
+
const forwardedIncludeAliases = new Set(provenance.canonical_include_modes.map((mode) => `--${mode.replaceAll("_", "-")}`));
|
|
530
|
+
return (dimension === "include" &&
|
|
531
|
+
forwardedIncludeAliases.has(flag) &&
|
|
532
|
+
!explicitLegacyAliases.has(flag));
|
|
533
|
+
}
|
|
534
|
+
function hasCompleteReadOutputIntent(command, legacyByDimension, provenance) {
|
|
535
|
+
const root = command
|
|
536
|
+
.trim()
|
|
537
|
+
.toLowerCase()
|
|
538
|
+
.replaceAll(/\s+/gu, " ")
|
|
539
|
+
.split(" ")[0];
|
|
540
|
+
return (root === "list-all" ||
|
|
541
|
+
legacyByDimension.amount?.flag === "--no-truncate" ||
|
|
542
|
+
legacyByDimension.include?.flag === "--full" ||
|
|
543
|
+
provenance?.canonical_include_modes.includes("full") === true);
|
|
544
|
+
}
|
|
545
|
+
function canonicalReadOutputOptionsUsed(resolvedByDimension, provenance) {
|
|
546
|
+
return PM_READ_OUTPUT_DIMENSIONS.flatMap((dimension) => resolvedByDimension[dimension]?.source === "canonical" ||
|
|
547
|
+
(dimension === "include" &&
|
|
548
|
+
(provenance?.canonical_include_modes.length ?? 0) > 0)
|
|
549
|
+
? [CANONICAL_OPTIONS[dimension]]
|
|
550
|
+
: []);
|
|
551
|
+
}
|
|
499
552
|
/** Resolve canonical and compatibility controls into the universal dimension set. */
|
|
500
553
|
export function resolveReadOutputDimensions(command, options) {
|
|
501
554
|
const normalizedCommand = resolveReadOutputSurface(command, options);
|
|
502
555
|
if (!normalizedCommand)
|
|
503
556
|
return undefined;
|
|
504
557
|
const contract = SURFACE_CONTRACT_BY_COMMAND.get(normalizedCommand);
|
|
558
|
+
const invocationProvenance = options[READ_OUTPUT_INVOCATION_PROVENANCE];
|
|
505
559
|
const legacyResolvers = {
|
|
506
560
|
include: (candidate) => resolveIncludeValue(undefined, candidate),
|
|
507
561
|
amount: (candidate) => resolveAmountValue(undefined, candidate),
|
|
@@ -510,7 +564,7 @@ export function resolveReadOutputDimensions(command, options) {
|
|
|
510
564
|
};
|
|
511
565
|
const legacyByDimension = Object.fromEntries(PM_READ_OUTPUT_DIMENSIONS.map((dimension) => [
|
|
512
566
|
dimension,
|
|
513
|
-
resolveLegacyDimension(contract.dimensions[dimension], options, (candidate) => legacyResolvers[dimension](candidate) !== undefined),
|
|
567
|
+
resolveLegacyDimension(contract.dimensions[dimension], options, (candidate) => legacyResolvers[dimension](candidate) !== undefined, (flag) => shouldIgnoreReadOutputLegacyAlias(invocationProvenance, dimension, flag)),
|
|
514
568
|
]));
|
|
515
569
|
const legacyAliasesUsed = PM_READ_OUTPUT_DIMENSIONS.flatMap((dimension) => {
|
|
516
570
|
const resolved = legacyByDimension[dimension];
|
|
@@ -524,29 +578,31 @@ export function resolveReadOutputDimensions(command, options) {
|
|
|
524
578
|
return [alias.migration_hint];
|
|
525
579
|
});
|
|
526
580
|
const encoding = resolveEncodingValue(options.outputFormat ?? options.output_format, legacyByDimension.encoding);
|
|
581
|
+
const include = resolveIncludeValue(options.outputInclude ?? options.output_include, legacyByDimension.include);
|
|
582
|
+
const amount = resolveAmountValue(options.outputLimit ?? options.output_limit, legacyByDimension.amount);
|
|
527
583
|
const explicitCost = resolveCostValue(options.outputBudget ?? options.output_budget, legacyByDimension.cost);
|
|
528
|
-
const completeResultIntent = command
|
|
529
|
-
"list-all" ||
|
|
530
|
-
legacyByDimension.amount?.flag === "--no-truncate" ||
|
|
531
|
-
legacyByDimension.include?.flag === "--full";
|
|
584
|
+
const completeResultIntent = hasCompleteReadOutputIntent(command, legacyByDimension, invocationProvenance);
|
|
532
585
|
const budget = resolvePmCommandOutputBudget(command, {
|
|
533
586
|
generateFallback: true,
|
|
534
587
|
});
|
|
535
588
|
const resolvedOutputFormat = encoding?.value === "json" || options.resolvedOutputFormat === "json"
|
|
536
589
|
? "json"
|
|
537
590
|
: "toon";
|
|
591
|
+
const cost = explicitCost ??
|
|
592
|
+
(completeResultIntent
|
|
593
|
+
? { source: "intent", value: "unbounded" }
|
|
594
|
+
: {
|
|
595
|
+
source: "default",
|
|
596
|
+
value: budget.default_max_estimated_tokens_by_format[resolvedOutputFormat],
|
|
597
|
+
});
|
|
598
|
+
const resolvedByDimension = { include, amount, cost, encoding };
|
|
538
599
|
return {
|
|
539
600
|
command: normalizedCommand,
|
|
540
|
-
include
|
|
541
|
-
amount
|
|
542
|
-
cost
|
|
543
|
-
(completeResultIntent
|
|
544
|
-
? { source: "intent", value: "unbounded" }
|
|
545
|
-
: {
|
|
546
|
-
source: "default",
|
|
547
|
-
value: budget.default_max_estimated_tokens_by_format[resolvedOutputFormat],
|
|
548
|
-
}),
|
|
601
|
+
include,
|
|
602
|
+
amount,
|
|
603
|
+
cost,
|
|
549
604
|
encoding,
|
|
605
|
+
canonical_options_used: canonicalReadOutputOptionsUsed(resolvedByDimension, invocationProvenance),
|
|
550
606
|
legacy_aliases_used: legacyAliasesUsed,
|
|
551
607
|
migration_hints: migrationHints,
|
|
552
608
|
precedence: READ_OUTPUT_PRECEDENCE,
|
|
@@ -732,8 +788,9 @@ function applyAmountBound(result, amount) {
|
|
|
732
788
|
return bounded;
|
|
733
789
|
}
|
|
734
790
|
function requestedDimensions(resolved) {
|
|
735
|
-
return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => resolved[dimension] !== undefined &&
|
|
736
|
-
resolved[dimension]?.source !== "default")
|
|
791
|
+
return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => (resolved[dimension] !== undefined &&
|
|
792
|
+
resolved[dimension]?.source !== "default") ||
|
|
793
|
+
resolved.canonical_options_used.includes(CANONICAL_OPTIONS[dimension]));
|
|
737
794
|
}
|
|
738
795
|
/** Stabilize the per-call and cross-call receipts in one complete envelope. */
|
|
739
796
|
function attachReadOutputSessionContracts(result, state, receipt) {
|
|
@@ -847,6 +904,12 @@ function resolveBindingReadOutputBudget(resolved, session) {
|
|
|
847
904
|
];
|
|
848
905
|
return budgets.sort((left, right) => left.tokens - right.tokens)[0];
|
|
849
906
|
}
|
|
907
|
+
function canonicalReadOutputReceiptFields(resolved) {
|
|
908
|
+
const canonicalOptions = resolved.canonical_options_used;
|
|
909
|
+
return canonicalOptions && canonicalOptions.length > 0
|
|
910
|
+
? { canonical_options_used: canonicalOptions }
|
|
911
|
+
: {};
|
|
912
|
+
}
|
|
850
913
|
/** Build the smallest truthful omission envelope or reject an exhausted session. */
|
|
851
914
|
function omitReadOutputForBudget(resolved, requested, session, bindingBudget, omittedResultEstimatedTokens) {
|
|
852
915
|
const minimalReceipt = {
|
|
@@ -860,6 +923,7 @@ function omitReadOutputForBudget(resolved, requested, session, bindingBudget, om
|
|
|
860
923
|
}
|
|
861
924
|
: {}),
|
|
862
925
|
precedence: resolved.precedence,
|
|
926
|
+
...canonicalReadOutputReceiptFields(resolved),
|
|
863
927
|
legacy_aliases_used: [],
|
|
864
928
|
migration_hints: [],
|
|
865
929
|
estimated_tokens: 0,
|
|
@@ -893,10 +957,10 @@ function omitReadOutputForBudget(resolved, requested, session, bindingBudget, om
|
|
|
893
957
|
return boundedOmission;
|
|
894
958
|
}
|
|
895
959
|
/** Decide whether shaping would add no value to an already-bounded result. */
|
|
896
|
-
function canReturnReadOutputUnchanged(resolved,
|
|
960
|
+
function canReturnReadOutputUnchanged(resolved, session, result) {
|
|
897
961
|
if (session !== undefined)
|
|
898
962
|
return false;
|
|
899
|
-
const canonicalRequestedCount =
|
|
963
|
+
const canonicalRequestedCount = resolved.canonical_options_used.length;
|
|
900
964
|
if (resolved.cost?.value === "unbounded") {
|
|
901
965
|
return (canonicalRequestedCount === (resolved.cost.source === "canonical" ? 1 : 0));
|
|
902
966
|
}
|
|
@@ -1077,7 +1141,7 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1077
1141
|
: undefined;
|
|
1078
1142
|
const requested = requestedDimensions(resolved);
|
|
1079
1143
|
if (cursor === undefined &&
|
|
1080
|
-
canReturnReadOutputUnchanged(resolved,
|
|
1144
|
+
canReturnReadOutputUnchanged(resolved, session, result)) {
|
|
1081
1145
|
return result;
|
|
1082
1146
|
}
|
|
1083
1147
|
const continuationReadyResult = attachValidateDiagnosticRowContract(resolved.command, result);
|
|
@@ -1095,6 +1159,7 @@ export function applyReadOutputDimensions(command, options, result) {
|
|
|
1095
1159
|
}
|
|
1096
1160
|
: {}),
|
|
1097
1161
|
precedence: resolved.precedence,
|
|
1162
|
+
...canonicalReadOutputReceiptFields(resolved),
|
|
1098
1163
|
legacy_aliases_used: resolved.legacy_aliases_used,
|
|
1099
1164
|
migration_hints: resolved.migration_hints,
|
|
1100
1165
|
estimated_tokens: 0,
|
|
@@ -1134,4 +1199,4 @@ export function resolveReadOutputEncoding(command, options) {
|
|
|
1134
1199
|
: undefined;
|
|
1135
1200
|
}
|
|
1136
1201
|
//# sourceMappingURL=read-output-contracts.js.map
|
|
1137
|
-
//# debugId=
|
|
1202
|
+
//# debugId=a1272c1f-c03e-580c-8c44-6b3ddeedd240
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* packet for agents, custom tools, and presentation-layer adapters.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
!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
|
+
!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]="afdba960-ae43-52be-b21d-282dac1f22ff")}catch(e){}}();
|
|
9
9
|
import { createQueryFingerprint, encodeQueryCursor, resolveQueryCursorStart, } from "./pagination.js";
|
|
10
10
|
import { createRelationshipKindRegistry, } from "./relationships.js";
|
|
11
11
|
/** Deterministic priority used when one node matches several semantic families. */
|
|
@@ -37,8 +37,7 @@ function explainDirectEdge(edge, node, registry) {
|
|
|
37
37
|
return node === before ? "prerequisite" : "dependent";
|
|
38
38
|
}
|
|
39
39
|
if (definition?.hierarchy) {
|
|
40
|
-
|
|
41
|
-
const sourceIsParent = (definition.hierarchyDirection ?? "source_parent") === "source_parent";
|
|
40
|
+
const sourceIsParent = definition.hierarchyDirection === "source_parent";
|
|
42
41
|
const parent = sourceIsParent ? edge.source : edge.target;
|
|
43
42
|
return node === parent ? "ancestor" : "descendant";
|
|
44
43
|
}
|
|
@@ -283,4 +282,4 @@ export function buildRelationshipContext(graph, rootId, details, options = {}) {
|
|
|
283
282
|
};
|
|
284
283
|
}
|
|
285
284
|
//# sourceMappingURL=relationship-context.js.map
|
|
286
|
-
//# debugId=
|
|
285
|
+
//# debugId=afdba960-ae43-52be-b21d-282dac1f22ff
|
|
@@ -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]="d7d44fba-603b-5ef2-8490-51112b929433")}catch(e){}}();
|
|
3
3
|
import { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
|
|
4
4
|
export { BUILTIN_RELATIONSHIP_KINDS, } from "./relationship-kinds/contract.js";
|
|
5
5
|
function normalizeKind(kind) {
|
|
@@ -105,6 +105,17 @@ function assertRelationshipKindPayload(definition, kind) {
|
|
|
105
105
|
definition.aliases.some((alias) => typeof alias !== "string")))
|
|
106
106
|
throw new TypeError(`Invalid relationship aliases for ${kind}`);
|
|
107
107
|
}
|
|
108
|
+
function resolveRelationshipTraversal(definition) {
|
|
109
|
+
if (definition.traversal)
|
|
110
|
+
return definition.traversal;
|
|
111
|
+
// Dual-family extension kinds use ordering precedence, matching relationship
|
|
112
|
+
// context role classification. Explicit traversal always remains authoritative.
|
|
113
|
+
if (definition.ordering)
|
|
114
|
+
return "ordering";
|
|
115
|
+
if (definition.hierarchy)
|
|
116
|
+
return "hierarchy";
|
|
117
|
+
return definition.direction === "undirected" ? "association" : "semantic";
|
|
118
|
+
}
|
|
108
119
|
/** Mutable registry with immutable snapshots and collision-safe extension registration. */
|
|
109
120
|
export class RelationshipKindRegistry {
|
|
110
121
|
#definitions = new Map();
|
|
@@ -139,15 +150,11 @@ export class RelationshipKindRegistry {
|
|
|
139
150
|
const normalized = Object.freeze({
|
|
140
151
|
...definition,
|
|
141
152
|
kind,
|
|
142
|
-
traversal: definition
|
|
143
|
-
(definition.hierarchy
|
|
144
|
-
? "hierarchy"
|
|
145
|
-
: definition.ordering
|
|
146
|
-
? "ordering"
|
|
147
|
-
: definition.direction === "undirected"
|
|
148
|
-
? "association"
|
|
149
|
-
: "semantic"),
|
|
153
|
+
traversal: resolveRelationshipTraversal(definition),
|
|
150
154
|
hierarchy: definition.hierarchy ?? false,
|
|
155
|
+
hierarchyDirection: definition.hierarchy
|
|
156
|
+
? (definition.hierarchyDirection ?? "source_parent")
|
|
157
|
+
: undefined,
|
|
151
158
|
inverse,
|
|
152
159
|
aliases: Object.freeze(aliases),
|
|
153
160
|
payloadSchema: definition.payloadSchema
|
|
@@ -570,4 +577,4 @@ export function dependencyToRelationship(source, dependency, registry = defaultR
|
|
|
570
577
|
};
|
|
571
578
|
}
|
|
572
579
|
//# sourceMappingURL=relationships.js.map
|
|
573
|
-
//# debugId=
|
|
580
|
+
//# debugId=d7d44fba-603b-5ef2-8490-51112b929433
|
package/dist/sdk/runtime.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, type EnsurePmGitignoreResult, } from "./workspace.js";
|
|
7
7
|
export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
|
|
8
8
|
export type { FlagDefinition } from "../core/extensions/loader.js";
|
|
9
|
+
export * from "./cli-contracts/agent-output-contracts.js";
|
|
9
10
|
import { EXIT_CODE } from "../core/shared/constants.js";
|
|
10
11
|
import type { ItemMetadata } from "../types/index.js";
|
|
11
12
|
import { type PmCompleteListOptions, type PmCompleteListResult } from "./query/complete-list.js";
|
|
@@ -155,7 +156,7 @@ export declare class PmClient {
|
|
|
155
156
|
/** Return project tracker statistics with the same sections as `pm stats`. */
|
|
156
157
|
stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options): ReadPromise<StatsResult, Options>;
|
|
157
158
|
/** Discover existing duplicate clusters without mutating tracker state. */
|
|
158
|
-
duplicates(options?:
|
|
159
|
+
duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options): ReadPromise<DuplicatesResult, Options>;
|
|
159
160
|
/** List, add, edit, or delete item comments. */
|
|
160
161
|
comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options): ReadPromise<CommentsResult, Options>;
|
|
161
162
|
/** List or append private item notes. */
|
|
@@ -371,7 +372,7 @@ export declare function aggregate<Options extends ReadOptions<AggregateOptions>
|
|
|
371
372
|
/** Return project tracker statistics with the same sections as `pm stats` without constructing a reusable client. */
|
|
372
373
|
export declare function stats<Options extends ReadOptions<StatsCommandOptions> = StatsCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<StatsResult, Options>;
|
|
373
374
|
/** Discover duplicate clusters without constructing a reusable client. */
|
|
374
|
-
export declare function duplicates(options?:
|
|
375
|
+
export declare function duplicates<Options extends ReadOptions<DuplicatesCommandOptions> = DuplicatesCommandOptions>(options?: Options, clientOptions?: PmClientOptions): ReadPromise<DuplicatesResult, Options>;
|
|
375
376
|
/** List, add, edit, or delete item comments without constructing a reusable client. */
|
|
376
377
|
export declare function comments<Options extends ReadOptions<CommentsCommandOptions> = CommentsCommandOptions>(id: string, options?: Options, clientOptions?: PmClientOptions): ReadPromise<CommentsResult, Options>;
|
|
377
378
|
/** List or append private item notes without constructing a reusable client. */
|
package/dist/sdk/runtime.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Defines public SDK APIs and package-author helpers for Runtime.
|
|
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]="a27b9b88-a8de-5e38-ab7f-dfcc61d1fad6")}catch(e){}}();
|
|
8
8
|
export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
|
|
9
9
|
export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
|
|
10
|
+
export * from "./cli-contracts/agent-output-contracts.js";
|
|
10
11
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
11
12
|
import path from "node:path";
|
|
12
13
|
import { createEmptyExtensionCommandRegistry, createEmptyExtensionHookRegistry, createEmptyExtensionParserRegistry, createEmptyExtensionPreflightRegistry, createEmptyExtensionRegistrationRegistry, createEmptyExtensionRendererRegistry, createEmptyExtensionServiceRegistry, } from "../core/extensions/extension-registries.js";
|
|
@@ -1944,4 +1945,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
|
|
|
1944
1945
|
}
|
|
1945
1946
|
}
|
|
1946
1947
|
//# sourceMappingURL=runtime.js.map
|
|
1947
|
-
//# debugId=
|
|
1948
|
+
//# debugId=a27b9b88-a8de-5e38-ab7f-dfcc61d1fad6
|