@unbrained/pm-cli 2026.8.19 → 2026.8.20
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 +19 -0
- package/dist/cli/register-list-query.js +12 -10
- package/dist/cli/register-structured-mutation.d.ts +2 -0
- package/dist/cli/register-structured-mutation.js +29 -6
- package/dist/cli-bundle/bundle-manifest.json +151 -143
- package/dist/cli-bundle/chunks/{chunk-4THEB6PD.js → chunk-2RDVGYWE.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-BHYMXLAE.js → chunk-4GB2LTOQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TOXJM4WA.js → chunk-7BRF2BX2.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-BLVQHFSY.js +35 -0
- package/dist/cli-bundle/chunks/chunk-CU25EQVV.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-4NRRH7AM.js → chunk-K3EN3LK2.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OIOKV6NO.js → chunk-L4LGPBJU.js} +49 -49
- package/dist/cli-bundle/chunks/chunk-RS3IV2R6.js +197 -0
- package/dist/cli-bundle/chunks/chunk-TSMWLCHS.js +3 -0
- package/dist/cli-bundle/chunks/chunk-US2ZQW2M.js +77 -0
- package/dist/cli-bundle/chunks/{chunk-QXSH7BLM.js → chunk-XYDDWBZN.js} +2 -2
- package/dist/cli-bundle/chunks/register-list-query-JSAQCVOC.js +11 -0
- package/dist/cli-bundle/chunks/{register-mutation-AUWVCW4M.js → register-mutation-XJPAW63D.js} +20 -20
- package/dist/cli-bundle/chunks/{register-operations-PZQPHXW5.js → register-operations-DSOSB2XQ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-I4LUHGVW.js → register-setup-QUR6QL2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-DKPLYW3L.js → chunk-325UXIO7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EF6ZS5GH.js → chunk-6AHG2YW7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MCZXYZAF.js → chunk-AZBACT5T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VXDSU5MC.js → chunk-BLJCGGID.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-US7VEYZG.js → chunk-G3C5ERXG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZBIQQYMI.js → chunk-GXWQBE3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JDOMQ7VQ.js → chunk-JWKEDZJI.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ESISGDAY.js → chunk-M32HFIQB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EXBCLIBU.js → chunk-OM65KHGF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BJRYFVSH.js → chunk-RIHDMCUM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-T4ZFY7ZJ.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-TDR5OGG3.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODHQEECS.js → chunk-UGSS4F5X.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
- package/dist/cli-bundle/main.js +2 -2
- 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 +41 -41
- 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 +31 -31
- 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/output/mutation-projection.js +26 -2
- package/dist/core/shared/constants.d.ts +1 -5
- package/dist/core/shared/constants.js +3 -81
- package/dist/core/shared/item-metadata-contract.d.ts +14 -0
- package/dist/core/shared/item-metadata-contract.js +90 -0
- package/dist/core/store/item-store.d.ts +60 -0
- package/dist/core/store/item-store.js +22 -5
- package/dist/sdk/agent/closed-domain-contracts.d.ts +25 -0
- package/dist/sdk/agent/closed-domain-contracts.js +140 -0
- package/dist/sdk/agent/refusal-closure.d.ts +13 -1
- package/dist/sdk/agent/refusal-closure.js +45 -3
- package/dist/sdk/agent/refusal-reachability.d.ts +26 -0
- package/dist/sdk/agent/refusal-reachability.js +26 -2
- package/dist/sdk/agent-capability-contracts.js +6 -11
- package/dist/sdk/cli-contracts/completeness.js +8 -2
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -2
- package/dist/sdk/cli-contracts/enum-contracts.js +16 -6
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +11 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +19 -2
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +105 -5
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +5 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +7 -3
- package/dist/sdk/cli-contracts/tool-schema.js +7 -2
- package/dist/sdk/cli-contracts.d.ts +2 -2
- package/dist/sdk/cli-contracts.js +4 -4
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +3 -2
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +112 -40
- package/dist/sdk/index.d.ts +5 -3
- package/dist/sdk/index.js +6 -4
- package/dist/sdk/init-agent-guidance.d.ts +5 -3
- package/dist/sdk/init-agent-guidance.js +69 -9
- package/dist/sdk/lifecycle/mcp-actions.d.ts +18 -0
- package/dist/sdk/lifecycle/mcp-actions.js +52 -0
- package/dist/sdk/lifecycle/reopen.d.ts +44 -0
- package/dist/sdk/lifecycle/reopen.js +69 -0
- package/dist/sdk/lifecycle/update.d.ts +31 -0
- package/dist/sdk/lifecycle/update.js +95 -13
- package/dist/sdk/query/get.d.ts +1 -1
- package/dist/sdk/query/get.js +18 -52
- package/dist/sdk/query/list.d.ts +7 -21
- package/dist/sdk/query/list.js +35 -49
- package/dist/sdk/query/projection-contracts.d.ts +33 -0
- package/dist/sdk/query/projection-contracts.js +185 -0
- package/dist/sdk/query/search-contracts.d.ts +2 -1
- package/dist/sdk/query/search-contracts.js +18 -87
- package/dist/sdk/query/search.d.ts +15 -0
- package/dist/sdk/query/search.js +31 -5
- package/dist/sdk/runtime-primitives.d.ts +1 -1
- package/dist/sdk/runtime-primitives.js +3 -3
- package/dist/sdk/runtime.d.ts +6 -0
- package/dist/sdk/runtime.js +18 -14
- package/dist/sdk/similarity.d.ts +13 -0
- package/dist/sdk/similarity.js +32 -6
- package/docs/COMMANDS.md +13 -1
- package/docs/README.md +1 -0
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
- package/docs/SDK.md +10 -2
- package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
- package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
- package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
- package/marketplace.json +2 -2
- package/package.json +5 -5
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +387 -25
- package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +0 -197
- package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +0 -35
- package/dist/cli-bundle/chunks/chunk-OI4XI562.js +0 -5
- package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
- package/dist/cli-bundle/chunks/chunk-YBMRWW4E.js +0 -77
- package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +0 -11
- package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-PRHY2IMX.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +0 -2
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Implements the pm update command surface and its agent-facing runtime behavior.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
8
|
-
import { pathExists, COMMON_MUTATION_COMMAND_OPTION_KEYS, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, normalizeItemId, toItemRecord, buildInvalidTypeError, assertParentReferenceIsNotSelf, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, applyAcceptanceCriteriaMutations, applyTagRemovals, assertNoUnknownCsvKeys, createStdinTokenResolver, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, splitAcceptanceCriteria, resolvePriority, normalizeStatusInput, isTerminalStatus, collectRuntimeUpdateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, describeAllowedTransitions, evaluateTransition, resolveTypeWorkflows, EXIT_CODE, PmCliError, stableValueEquals, resolveIsoOrRelative, getActiveExtensionRegistrations, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, buildItemNotFoundError, listAllItemMetadataLight, locateItem,
|
|
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]="3ab4f16d-ce37-546e-a2f6-0495fd1967c7")}catch(e){}}();
|
|
8
|
+
import { pathExists, COMMON_MUTATION_COMMAND_OPTION_KEYS, canonicalizeCommandOptionKey, commandOptionFlagLabel, resolveItemTypeRegistry, resolveCommandOptionPolicyState, resolveTypeDefinition, resolveTypeName, validateTypeOptions, normalizeItemId, toItemRecord, buildInvalidTypeError, assertParentReferenceIsNotSelf, normalizeParentReferenceValue, validateMissingParentReference, validateSprintOrReleaseValue, applyAcceptanceCriteriaMutations, applyTagRemovals, assertNoUnknownCsvKeys, createStdinTokenResolver, looksLikeGenericKeyValueEntry, mergeAdditiveTags, parseCsvKv, parseOptionalNonNegativeInteger, parseOptionalNumber, parseTags, splitAcceptanceCriteria, resolvePriority, normalizeStatusInput, isTerminalStatus, collectRuntimeUpdateFieldValues, resolveItemTypesFilePath, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, describeAllowedTransitions, evaluateTransition, resolveTypeWorkflows, EXIT_CODE, PmCliError, stableValueEquals, resolveIsoOrRelative, getActiveExtensionRegistrations, collectRegisteredItemFieldNames, applyRegisteredItemFieldDefaultsAndValidation, parseRegisteredItemFieldAssignments, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
|
+
import { mutateItemWithHistoryContextResolver } from "../../core/store/item-store.js";
|
|
9
10
|
import { runClose } from "./close.js";
|
|
10
11
|
import { normalizeRiskInput, normalizeSeverityInput, parseConfidenceInput, parseRegressionInput, } from "./metadata-normalizers.js";
|
|
11
12
|
import { applyLegacyNoneCollectionNormalizers, createLegacyNoneCollectionNormalizers, assertNoLegacyNoneToken, assertNoLegacyNoneTokens, isLegacyNoneToken, } from "./legacy-none-tokens.js";
|
|
@@ -1214,8 +1215,8 @@ function applyStatusMutation(document, context, statusInput, previousStatusNorma
|
|
|
1214
1215
|
changedFields.push("closed_at", "completed_at");
|
|
1215
1216
|
return;
|
|
1216
1217
|
}
|
|
1217
|
-
if (status
|
|
1218
|
-
previousStatusNormalized
|
|
1218
|
+
if (!isTerminalStatus(status, context.statusRegistry) &&
|
|
1219
|
+
isTerminalStatus(previousStatusNormalized, context.statusRegistry) &&
|
|
1219
1220
|
document.metadata.closed_at !== undefined) {
|
|
1220
1221
|
delete document.metadata.closed_at;
|
|
1221
1222
|
changedFields.push("closed_at");
|
|
@@ -1254,8 +1255,8 @@ function applyCloseReasonMutations(document, context, previousStatusNormalized,
|
|
|
1254
1255
|
return;
|
|
1255
1256
|
}
|
|
1256
1257
|
if (context.options.status !== undefined &&
|
|
1257
|
-
previousStatusNormalized
|
|
1258
|
-
document.metadata.status
|
|
1258
|
+
isTerminalStatus(previousStatusNormalized, context.statusRegistry) &&
|
|
1259
|
+
!isTerminalStatus(document.metadata.status, context.statusRegistry) &&
|
|
1259
1260
|
document.metadata.close_reason !== undefined) {
|
|
1260
1261
|
delete document.metadata.close_reason;
|
|
1261
1262
|
changedFields.push("close_reason");
|
|
@@ -1700,7 +1701,7 @@ function mutateUpdateDocument(document, context) {
|
|
|
1700
1701
|
return { changedFields: actualChangedFields, warnings };
|
|
1701
1702
|
}
|
|
1702
1703
|
/** Implements run update for the public runtime surface of this module. */
|
|
1703
|
-
|
|
1704
|
+
async function runUpdateWithContext(id, options, global, execution = {}) {
|
|
1704
1705
|
options = await resolveStdinUpdateOptions(options);
|
|
1705
1706
|
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
1706
1707
|
await assertUpdateTrackerInitialized(pmRoot);
|
|
@@ -1820,23 +1821,32 @@ export async function runUpdate(id, options, global) {
|
|
|
1820
1821
|
let graphBeforeUpdate = fieldFlags.dep || fieldFlags.depRemove || fieldFlags.blockedBy
|
|
1821
1822
|
? await listAllItemMetadataLight(pmRoot, settings.item_format, typeRegistry.type_to_folder, undefined, settings.schema)
|
|
1822
1823
|
: undefined;
|
|
1823
|
-
|
|
1824
|
+
let lifecycleTransition;
|
|
1825
|
+
let recurrenceHistoryContext;
|
|
1826
|
+
const result = await mutateItemWithHistoryContextResolver({
|
|
1824
1827
|
pmRoot,
|
|
1825
1828
|
settings,
|
|
1826
1829
|
typeToFolder: typeRegistry.type_to_folder,
|
|
1827
1830
|
id,
|
|
1828
|
-
op: options
|
|
1829
|
-
options.ownershipDependencyBypass === true
|
|
1830
|
-
? "update_ownership_bypass"
|
|
1831
|
-
: "update",
|
|
1831
|
+
op: resolveUpdateHistoryOperation(options, execution),
|
|
1832
1832
|
author,
|
|
1833
1833
|
message: options.message,
|
|
1834
|
+
resolveHistoryContext: () => recurrenceHistoryContext,
|
|
1834
1835
|
force: options.force,
|
|
1835
1836
|
bypassAssigneeConflict: options.ownershipMetadataBypass === true ||
|
|
1836
1837
|
options.ownershipDependencyBypass === true,
|
|
1837
1838
|
extensionFieldNames,
|
|
1838
1839
|
skipNoop: true,
|
|
1839
1840
|
mutate(document) {
|
|
1841
|
+
lifecycleTransition = prepareRecurrenceTransition({
|
|
1842
|
+
document,
|
|
1843
|
+
recurrenceReason: execution.recurrenceReason,
|
|
1844
|
+
requestedStatus: options.status,
|
|
1845
|
+
statusRegistry,
|
|
1846
|
+
});
|
|
1847
|
+
recurrenceHistoryContext = lifecycleTransition
|
|
1848
|
+
? { recurrence: lifecycleTransition }
|
|
1849
|
+
: undefined;
|
|
1840
1850
|
graphBeforeUpdate = graphBeforeUpdate?.map((item) => item.id === document.metadata.id
|
|
1841
1851
|
? structuredClone(document.metadata)
|
|
1842
1852
|
: item);
|
|
@@ -1880,8 +1890,80 @@ export async function runUpdate(id, options, global) {
|
|
|
1880
1890
|
...orderingCycleWarnings,
|
|
1881
1891
|
...result.warnings,
|
|
1882
1892
|
],
|
|
1893
|
+
...(lifecycleTransition === undefined
|
|
1894
|
+
? {}
|
|
1895
|
+
: { lifecycle_transition: lifecycleTransition }),
|
|
1883
1896
|
};
|
|
1884
1897
|
}
|
|
1898
|
+
/** Resolve the immutable operation name for ordinary, bypass, and recurrence updates. */
|
|
1899
|
+
function resolveUpdateHistoryOperation(options, execution) {
|
|
1900
|
+
if (options.ownershipMetadataBypass === true ||
|
|
1901
|
+
options.ownershipDependencyBypass === true) {
|
|
1902
|
+
return "update_ownership_bypass";
|
|
1903
|
+
}
|
|
1904
|
+
return execution.recurrenceReason === undefined ? "update" : "reopen";
|
|
1905
|
+
}
|
|
1906
|
+
/** Validate and capture a terminal-to-active recurrence while the item lock is held. */
|
|
1907
|
+
function prepareRecurrenceTransition(params) {
|
|
1908
|
+
if (params.recurrenceReason === undefined) {
|
|
1909
|
+
return undefined;
|
|
1910
|
+
}
|
|
1911
|
+
const fromStatus = normalizeStatusInput(params.document.metadata.status, params.statusRegistry) ?? params.document.metadata.status;
|
|
1912
|
+
if (!isTerminalStatus(fromStatus, params.statusRegistry)) {
|
|
1913
|
+
throw new PmCliError(`Item ${params.document.metadata.id} is already active with status ${fromStatus}; recurrence transitions require a terminal item.`, EXIT_CODE.CONFLICT, {
|
|
1914
|
+
code: "item_already_active",
|
|
1915
|
+
reason: "recurrence_requires_terminal_item",
|
|
1916
|
+
required: "Use item reopen only for a terminal item whose work has recurred.",
|
|
1917
|
+
why: "Appending a recurrence event to active work would corrupt lifecycle history.",
|
|
1918
|
+
recovery: {
|
|
1919
|
+
suggested_retry: `pm get ${params.document.metadata.id} --full`,
|
|
1920
|
+
suggested_retry_args: ["get", params.document.metadata.id, "--full"],
|
|
1921
|
+
},
|
|
1922
|
+
nextSteps: [
|
|
1923
|
+
`Inspect the active item with: pm get ${params.document.metadata.id} --full`,
|
|
1924
|
+
`Continue the existing work with: pm update ${params.document.metadata.id} ...`,
|
|
1925
|
+
],
|
|
1926
|
+
});
|
|
1927
|
+
}
|
|
1928
|
+
const requestedStatus = params.requestedStatus ?? params.statusRegistry.open_status;
|
|
1929
|
+
const toStatus = normalizeStatusInput(requestedStatus, params.statusRegistry) ??
|
|
1930
|
+
requestedStatus;
|
|
1931
|
+
const metadata = toItemRecord(params.document.metadata);
|
|
1932
|
+
const previousTerminal = Object.fromEntries([
|
|
1933
|
+
"close_reason",
|
|
1934
|
+
"resolution",
|
|
1935
|
+
"expected_result",
|
|
1936
|
+
"actual_result",
|
|
1937
|
+
"fixed_version",
|
|
1938
|
+
].flatMap((key) => {
|
|
1939
|
+
const value = metadata[key];
|
|
1940
|
+
return typeof value === "string" ? [[key, value]] : [];
|
|
1941
|
+
}));
|
|
1942
|
+
return {
|
|
1943
|
+
reason: params.recurrenceReason,
|
|
1944
|
+
from_status: fromStatus,
|
|
1945
|
+
to_status: toStatus,
|
|
1946
|
+
previous_terminal: previousTerminal,
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
/** Implements run update for the public runtime surface of this module. */
|
|
1950
|
+
export async function runUpdate(id, options, global) {
|
|
1951
|
+
return runUpdateWithContext(id, options, global);
|
|
1952
|
+
}
|
|
1953
|
+
/** Execute a recurrence transition through the exact atomic update pipeline. */
|
|
1954
|
+
export async function runReopenUpdate(id, options, global, recurrenceReason) {
|
|
1955
|
+
const result = await runUpdateWithContext(id, options, global, {
|
|
1956
|
+
recurrenceReason,
|
|
1957
|
+
});
|
|
1958
|
+
if (result.lifecycle_transition === undefined) {
|
|
1959
|
+
throw new PmCliError(`Item ${id} did not produce the required recurrence receipt.`, EXIT_CODE.GENERIC_FAILURE, {
|
|
1960
|
+
code: "reopen_receipt_missing",
|
|
1961
|
+
reason: "recurrence_transition_not_recorded",
|
|
1962
|
+
required: "A successful reopen must return the terminal-to-active lifecycle transition recorded in immutable history.",
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
return { ...result, lifecycle_transition: result.lifecycle_transition };
|
|
1966
|
+
}
|
|
1885
1967
|
/* c8 ignore stop */
|
|
1886
1968
|
/** Public contract for test only update command, shared by SDK and presentation-layer consumers. */
|
|
1887
1969
|
export const _testOnlyUpdateCommand = {
|
|
@@ -1900,4 +1982,4 @@ export const _testOnlyUpdateCommand = {
|
|
|
1900
1982
|
resolveRuntimeUnsetDefinition: (token, registry) => resolveRuntimeUnsetFieldDefinition(token, "update", registry),
|
|
1901
1983
|
};
|
|
1902
1984
|
//# sourceMappingURL=update.js.map
|
|
1903
|
-
//# debugId=
|
|
1985
|
+
//# debugId=3ab4f16d-ce37-546e-a2f6-0495fd1967c7
|
package/dist/sdk/query/get.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { type GlobalOptions } from "../runtime-primitives.js";
|
|
|
7
7
|
import { type ChildRollupContext } from "../item-children.js";
|
|
8
8
|
import { type ItemScheduleContext } from "../item-schedule.js";
|
|
9
9
|
import type { ItemMetadata, LinkedDoc, LinkedFile, LinkedTest } from "../../types/index.js";
|
|
10
|
+
export { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
|
|
10
11
|
interface ClaimHistoryContext {
|
|
11
12
|
ts: string;
|
|
12
13
|
author: string;
|
|
@@ -92,4 +93,3 @@ export declare function runGet(id: string, global: GlobalOptions, options?: GetO
|
|
|
92
93
|
export declare const _testOnlyGetCommand: {
|
|
93
94
|
shouldAutoIncludeGetChildren: typeof shouldAutoIncludeGetChildren;
|
|
94
95
|
};
|
|
95
|
-
export {};
|
package/dist/sdk/query/get.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Implements the SDK-owned item query shared by every surface.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
8
|
-
import { pathExists, getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE,
|
|
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]="16d0a1cf-467d-5041-ab36-e2a9033a9342")}catch(e){}}();
|
|
8
|
+
import { pathExists, getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
|
|
9
9
|
import { readHistoryEntries } from "../history-read.js";
|
|
10
10
|
import { renderPmCommand } from "../command-line.js";
|
|
11
11
|
import { recordContextUsageTouches } from "../context-usage.js";
|
|
@@ -15,7 +15,8 @@ import { getItemAt } from "../history-read.js";
|
|
|
15
15
|
import { parseIntegerLimit } from "./parsers.js";
|
|
16
16
|
import { runList } from "./list.js";
|
|
17
17
|
import { registerOutputMaterialFieldGroups } from "../output-projection.js";
|
|
18
|
-
|
|
18
|
+
import { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
|
|
19
|
+
export { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
|
|
19
20
|
const AUTOMATIC_CHILD_ROLLUP_TYPES = new Set([
|
|
20
21
|
"epic",
|
|
21
22
|
"feature",
|
|
@@ -147,53 +148,12 @@ function validateGetFields(fields, runtimeMetadataKeys, id) {
|
|
|
147
148
|
if (fields === null) {
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
...runtimeMetadataKeys,
|
|
153
|
-
"notes_count",
|
|
154
|
-
"tests_count",
|
|
155
|
-
"collection_counts",
|
|
156
|
-
]);
|
|
157
|
-
const allowedRootFields = new Set([
|
|
158
|
-
"body",
|
|
159
|
-
"linked",
|
|
160
|
-
"claim_state",
|
|
161
|
-
"children",
|
|
162
|
-
"schedule",
|
|
163
|
-
]);
|
|
164
|
-
const allowedLinkedFields = new Set([
|
|
165
|
-
"linked.files",
|
|
166
|
-
"linked.tests",
|
|
167
|
-
"linked.docs",
|
|
168
|
-
]);
|
|
169
|
-
const allowedClaimStateFields = new Set([
|
|
170
|
-
"claim_state.claimed",
|
|
171
|
-
"claim_state.assignee",
|
|
172
|
-
"claim_state.last_claim",
|
|
173
|
-
"claim_state.last_release",
|
|
174
|
-
]);
|
|
175
|
-
const allowedScheduleFields = new Set([
|
|
176
|
-
"schedule.deadline",
|
|
177
|
-
"schedule.start_at",
|
|
178
|
-
"schedule.end_at",
|
|
179
|
-
"schedule.location",
|
|
180
|
-
"schedule.reminders",
|
|
181
|
-
"schedule.events",
|
|
182
|
-
]);
|
|
183
|
-
const allowedValues = [
|
|
184
|
-
...[...itemFields].flatMap((field) => [field, `item.${field}`]),
|
|
185
|
-
...allowedRootFields,
|
|
186
|
-
...allowedLinkedFields,
|
|
187
|
-
...allowedClaimStateFields,
|
|
188
|
-
...allowedScheduleFields,
|
|
189
|
-
].sort();
|
|
151
|
+
const allowedValues = listGetProjectionFields(runtimeMetadataKeys);
|
|
152
|
+
const allowed = new Set(allowedValues);
|
|
190
153
|
const unknown = fields.filter((field) => {
|
|
191
154
|
const normalized = normalizeGetField(field);
|
|
192
|
-
return (!
|
|
193
|
-
!
|
|
194
|
-
!allowedLinkedFields.has(normalized) &&
|
|
195
|
-
!allowedClaimStateFields.has(normalized) &&
|
|
196
|
-
!allowedScheduleFields.has(normalized));
|
|
155
|
+
return (!allowed.has(field) &&
|
|
156
|
+
!allowed.has(normalized));
|
|
197
157
|
});
|
|
198
158
|
if (unknown.length > 0) {
|
|
199
159
|
const suggestedRetryArguments = [
|
|
@@ -275,10 +235,16 @@ function fieldsIncludeRoot(fields, name) {
|
|
|
275
235
|
return normalized === name || normalized.startsWith(`${name}.`);
|
|
276
236
|
});
|
|
277
237
|
}
|
|
278
|
-
function resolveGetProjection(options) {
|
|
238
|
+
function resolveGetProjection(options, id) {
|
|
279
239
|
if (options.full &&
|
|
280
240
|
(options.fields !== undefined || options.depth !== undefined)) {
|
|
281
|
-
throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.", EXIT_CODE.USAGE
|
|
241
|
+
throw new PmCliError("Get projection options are mutually exclusive; remove the extra projection flag and retry.", EXIT_CODE.USAGE, {
|
|
242
|
+
code: "projection_options_mutually_exclusive",
|
|
243
|
+
recovery: {
|
|
244
|
+
suggested_retry: renderPmCommand(["get", id, "--full"]),
|
|
245
|
+
suggested_retry_args: ["get", id, "--full"],
|
|
246
|
+
},
|
|
247
|
+
});
|
|
282
248
|
}
|
|
283
249
|
if (options.tree !== true && options.treeDepth !== undefined) {
|
|
284
250
|
throw new PmCliError("Get --tree-depth requires --tree", EXIT_CODE.USAGE);
|
|
@@ -414,7 +380,7 @@ async function buildGetTree(context, options, treeDepth, global) {
|
|
|
414
380
|
}
|
|
415
381
|
/** Implements run get for the public runtime surface of this module. */
|
|
416
382
|
export async function runGet(id, global, options = {}) {
|
|
417
|
-
const projection = resolveGetProjection(options);
|
|
383
|
+
const projection = resolveGetProjection(options, id);
|
|
418
384
|
const context = await loadGetItemContext(id, global, options.at);
|
|
419
385
|
validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined, context.locatedId);
|
|
420
386
|
const includeBody = shouldIncludeGetField({ ...projection, field: "body" });
|
|
@@ -482,4 +448,4 @@ export const _testOnlyGetCommand = {
|
|
|
482
448
|
shouldAutoIncludeGetChildren,
|
|
483
449
|
};
|
|
484
450
|
//# sourceMappingURL=get.js.map
|
|
485
|
-
//# debugId=
|
|
451
|
+
//# debugId=16d0a1cf-467d-5041-ab36-e2a9033a9342
|
package/dist/sdk/query/list.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { type RuntimeStatusRegistry } from "../../core/schema/runtime-schema.js"
|
|
|
5
5
|
import type { GlobalOptions } from "../../core/shared/command-types.js";
|
|
6
6
|
import type { ItemMetadata, ItemStatus } from "../../types/index.js";
|
|
7
7
|
import type { SharedItemFilterOptions } from "./item-filter-options.js";
|
|
8
|
+
import { type ListCommandName, type ListProjectionMode } from "./projection-contracts.js";
|
|
9
|
+
export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, type ListCommandName, type ListProjectionMode, } from "./projection-contracts.js";
|
|
8
10
|
/** Documents the list options payload exchanged by command, SDK, and package integrations. */
|
|
9
11
|
export interface ListOptions extends SharedItemFilterOptions {
|
|
10
12
|
/** Value that configures or reports ids for this contract. */
|
|
@@ -62,6 +64,10 @@ export interface ListOptions extends SharedItemFilterOptions {
|
|
|
62
64
|
/** Value that configures or reports filter metadata missing for this contract. */
|
|
63
65
|
filterMetadataMissing?: boolean;
|
|
64
66
|
}
|
|
67
|
+
/** Adapter-only list context that never expands the public SDK options contract. */
|
|
68
|
+
interface ListRuntimeOptions extends ListOptions {
|
|
69
|
+
projectionCommand?: ListCommandName;
|
|
70
|
+
}
|
|
65
71
|
/** Extract the missing-metadata selection filters from list/update-many options. */
|
|
66
72
|
export declare const resolveMissingMetadataFilters: (options: {
|
|
67
73
|
filterAcMissing?: boolean;
|
|
@@ -114,8 +120,6 @@ export interface ListProjectedItemCore {
|
|
|
114
120
|
export type ListProjectedItem = ListProjectedItemCore & Record<string, unknown>;
|
|
115
121
|
/** Honest union of item shapes returned by the list engine. */
|
|
116
122
|
export type ListResultItem = ListedItem | ListTreeItem | ListProjectedItem;
|
|
117
|
-
/** Stable projection names emitted by list envelopes and command contracts. */
|
|
118
|
-
export type ListProjectionMode = "full" | "compact" | "brief" | "fields";
|
|
119
123
|
interface ListProjectionConfig {
|
|
120
124
|
mode: ListProjectionMode;
|
|
121
125
|
fields: string[];
|
|
@@ -128,23 +132,6 @@ export type ListSortField = (typeof LIST_SORT_FIELDS)[number];
|
|
|
128
132
|
export declare const LIST_SORT_ORDER_VALUES: readonly ["asc", "desc"];
|
|
129
133
|
/** Restricts list sort order values accepted by command, SDK, and storage contracts. */
|
|
130
134
|
export type ListSortOrder = (typeof LIST_SORT_ORDER_VALUES)[number];
|
|
131
|
-
/** Stable field order for the compact list projection. */
|
|
132
|
-
export declare const DEFAULT_COMPACT_LIST_FIELDS: readonly ["id", "title", "status", "type", "priority", "parent", "updated_at"];
|
|
133
|
-
/** Stable field order for the agent-optimized brief list projection. */
|
|
134
|
-
export declare const BRIEF_LIST_FIELDS: readonly ["id", "status", "type", "title"];
|
|
135
|
-
/** Machine-readable default projection contract for every list command. */
|
|
136
|
-
export declare const LIST_COMMAND_DEFAULT_PROJECTIONS: {
|
|
137
|
-
readonly list: "brief";
|
|
138
|
-
readonly "list-all": "full";
|
|
139
|
-
readonly "list-draft": "full";
|
|
140
|
-
readonly "list-open": "brief";
|
|
141
|
-
readonly "list-in-progress": "brief";
|
|
142
|
-
readonly "list-blocked": "brief";
|
|
143
|
-
readonly "list-closed": "full";
|
|
144
|
-
readonly "list-canceled": "full";
|
|
145
|
-
};
|
|
146
|
-
/** Command names whose output defaults are described by the list projection contract. */
|
|
147
|
-
export type ListCommandName = keyof typeof LIST_COMMAND_DEFAULT_PROJECTIONS;
|
|
148
135
|
interface ListResultBase {
|
|
149
136
|
items: ListResultItem[];
|
|
150
137
|
count: number;
|
|
@@ -244,7 +231,7 @@ declare function resolveListUpdatedAfter(options: ListOptions): string | undefin
|
|
|
244
231
|
declare function parseIdsFilter(raw: unknown): Set<string> | undefined;
|
|
245
232
|
declare function parseOffset(raw: string | undefined): number | undefined;
|
|
246
233
|
declare function parseFieldSelectors(raw: string | undefined): string[] | undefined;
|
|
247
|
-
declare function parseProjectionConfig(options:
|
|
234
|
+
declare function parseProjectionConfig(options: ListRuntimeOptions, invokedCommand?: ListCommandName): ListProjectionConfig;
|
|
248
235
|
declare function normalizeProjectionField(field: string): string;
|
|
249
236
|
declare function parseSortField(raw: string | undefined): ListSortField | undefined;
|
|
250
237
|
declare function parseSortOrder(raw: string | undefined): ListSortOrder | undefined;
|
|
@@ -309,4 +296,3 @@ export declare const _testOnly: {
|
|
|
309
296
|
trimNonEmpty: typeof trimNonEmpty;
|
|
310
297
|
withTreeMetadata: typeof withTreeMetadata;
|
|
311
298
|
};
|
|
312
|
-
export {};
|
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]="67c5ff91-1c04-5506-ae5b-32f6552f1d07")}catch(e){}}();
|
|
8
8
|
import { pathExists } from "../../core/fs/fs-utils.js";
|
|
9
9
|
import { getActiveExtensionRegistrations, hasActiveOnReadHooks, } from "../../core/extensions/index.js";
|
|
10
10
|
import { toItemRecord } from "../../core/item/item-record.js";
|
|
@@ -18,7 +18,7 @@ import { collectRuntimeFilterValues, matchesRuntimeFilters, } from "../../core/s
|
|
|
18
18
|
import { hasMissingMetadataFilter, itemMatchesMissingMetadata, lifecycleClassifierFromStatusRegistry, } from "../../core/governance/metadata-coverage.js";
|
|
19
19
|
import { contentFiltersNeedBody, contentFiltersNeedCollections, hasContentFieldFilter, itemMatchesContentFilters, } from "../../core/governance/content-fields.js";
|
|
20
20
|
import { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../../core/schema/runtime-schema.js";
|
|
21
|
-
import { EXIT_CODE
|
|
21
|
+
import { EXIT_CODE } from "../../core/shared/constants.js";
|
|
22
22
|
import { PmCliError } from "../../core/shared/errors.js";
|
|
23
23
|
import { compareTimestampStrings, matchesTimestampFilters, nowIso, resolveIsoOrRelative, } from "../../core/shared/time.js";
|
|
24
24
|
import { listAllItemMetadata, listAllItemMetadataLight, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
|
|
@@ -28,6 +28,8 @@ import { getSettingsPath, 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
30
|
import { createQueryFingerprint, encodeQueryCursor, resolveQueryCursorStart, selectCursorSemanticOptions, } from "../pagination.js";
|
|
31
|
+
import { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, listListProjectionFields, } from "./projection-contracts.js";
|
|
32
|
+
export { BRIEF_LIST_FIELDS, DEFAULT_COMPACT_LIST_FIELDS, LIST_COMMAND_DEFAULT_PROJECTIONS, listListProjectionFields, } from "./projection-contracts.js";
|
|
31
33
|
/** Extract the missing-metadata selection filters from list/update-many options. */
|
|
32
34
|
export const resolveMissingMetadataFilters = (options) => {
|
|
33
35
|
return {
|
|
@@ -134,35 +136,6 @@ export const LIST_SORT_FIELDS = [
|
|
|
134
136
|
];
|
|
135
137
|
/** Supported values accepted by the list sort order contract. */
|
|
136
138
|
export const LIST_SORT_ORDER_VALUES = ["asc", "desc"];
|
|
137
|
-
/** Stable field order for the compact list projection. */
|
|
138
|
-
export const DEFAULT_COMPACT_LIST_FIELDS = [
|
|
139
|
-
"id",
|
|
140
|
-
"title",
|
|
141
|
-
"status",
|
|
142
|
-
"type",
|
|
143
|
-
"priority",
|
|
144
|
-
"parent",
|
|
145
|
-
"updated_at",
|
|
146
|
-
];
|
|
147
|
-
/** Stable field order for the agent-optimized brief list projection. */
|
|
148
|
-
export const BRIEF_LIST_FIELDS = ["id", "status", "type", "title"];
|
|
149
|
-
/** Machine-readable default projection contract for every list command. */
|
|
150
|
-
export const LIST_COMMAND_DEFAULT_PROJECTIONS = {
|
|
151
|
-
list: "brief",
|
|
152
|
-
"list-all": "full",
|
|
153
|
-
"list-draft": "full",
|
|
154
|
-
"list-open": "brief",
|
|
155
|
-
"list-in-progress": "brief",
|
|
156
|
-
"list-blocked": "brief",
|
|
157
|
-
"list-closed": "full",
|
|
158
|
-
"list-canceled": "full",
|
|
159
|
-
};
|
|
160
|
-
const TREE_METADATA_FIELDS = [
|
|
161
|
-
"tree_depth",
|
|
162
|
-
"tree_parent",
|
|
163
|
-
"tree_children",
|
|
164
|
-
"tree_title",
|
|
165
|
-
];
|
|
166
139
|
// A projection that selects any heavy collection field (or `--full`, which returns
|
|
167
140
|
// items verbatim) must load the full metadata; everything else takes the light path.
|
|
168
141
|
// Sourced from the single HEAVY_METADATA_KEYS definition in the cache layer so the
|
|
@@ -479,7 +452,7 @@ function parseFieldSelectors(raw) {
|
|
|
479
452
|
}
|
|
480
453
|
return [...new Set(selectors)];
|
|
481
454
|
}
|
|
482
|
-
function parseProjectionConfig(options) {
|
|
455
|
+
function parseProjectionConfig(options, invokedCommand = options.projectionCommand ?? "list") {
|
|
483
456
|
const compactRequested = options.compact === true;
|
|
484
457
|
const briefRequested = options.brief === true;
|
|
485
458
|
const fullRequested = options.full === true;
|
|
@@ -489,7 +462,13 @@ function parseProjectionConfig(options) {
|
|
|
489
462
|
Number(fullRequested) +
|
|
490
463
|
Number(fieldSelectors !== undefined);
|
|
491
464
|
if (enabledModes > 1) {
|
|
492
|
-
throw new PmCliError("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.", EXIT_CODE.USAGE
|
|
465
|
+
throw new PmCliError("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.", EXIT_CODE.USAGE, {
|
|
466
|
+
code: "projection_options_mutually_exclusive",
|
|
467
|
+
recovery: {
|
|
468
|
+
suggested_retry: `pm ${invokedCommand} --brief`,
|
|
469
|
+
suggested_retry_args: [invokedCommand, "--brief"],
|
|
470
|
+
},
|
|
471
|
+
});
|
|
493
472
|
}
|
|
494
473
|
if (fullRequested) {
|
|
495
474
|
return {
|
|
@@ -512,7 +491,9 @@ function parseProjectionConfig(options) {
|
|
|
512
491
|
if (fieldSelectors) {
|
|
513
492
|
return {
|
|
514
493
|
mode: "fields",
|
|
515
|
-
fields:
|
|
494
|
+
fields: [
|
|
495
|
+
...new Set(fieldSelectors.map((field) => normalizeProjectionField(field))),
|
|
496
|
+
],
|
|
516
497
|
};
|
|
517
498
|
}
|
|
518
499
|
return {
|
|
@@ -523,19 +504,12 @@ function parseProjectionConfig(options) {
|
|
|
523
504
|
function normalizeProjectionField(field) {
|
|
524
505
|
return field.startsWith("item.") ? field.slice("item.".length) : field;
|
|
525
506
|
}
|
|
526
|
-
function validateListProjectionFields(projection, runtimeMetadataKeys) {
|
|
507
|
+
function validateListProjectionFields(projection, runtimeMetadataKeys, invokedCommand) {
|
|
527
508
|
if (projection.mode !== "fields") {
|
|
528
509
|
return;
|
|
529
510
|
}
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
"body",
|
|
533
|
-
...TREE_METADATA_FIELDS,
|
|
534
|
-
...runtimeMetadataKeys,
|
|
535
|
-
]);
|
|
536
|
-
const allowedValues = [...allowed]
|
|
537
|
-
.flatMap((field) => [field, `item.${field}`])
|
|
538
|
-
.sort();
|
|
511
|
+
const allowedValues = listListProjectionFields(runtimeMetadataKeys);
|
|
512
|
+
const allowed = new Set(allowedValues.map((field) => normalizeProjectionField(field)));
|
|
539
513
|
const unknown = projection.fields.filter((field) => !allowed.has(normalizeProjectionField(field)));
|
|
540
514
|
if (unknown.length > 0) {
|
|
541
515
|
throw new PmCliError(`Unknown list --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
|
|
@@ -547,9 +521,9 @@ function validateListProjectionFields(projection, runtimeMetadataKeys) {
|
|
|
547
521
|
],
|
|
548
522
|
recovery: {
|
|
549
523
|
allowed_values: allowedValues,
|
|
550
|
-
suggested_retry:
|
|
524
|
+
suggested_retry: `pm ${invokedCommand} --fields id,title,status --limit 10`,
|
|
551
525
|
suggested_retry_args: [
|
|
552
|
-
|
|
526
|
+
invokedCommand,
|
|
553
527
|
"--fields",
|
|
554
528
|
"id,title,status",
|
|
555
529
|
"--limit",
|
|
@@ -923,8 +897,9 @@ async function resolveListRuntimeContext(options, global) {
|
|
|
923
897
|
const settings = await readSettings(pmRoot);
|
|
924
898
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
925
899
|
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
926
|
-
const
|
|
927
|
-
|
|
900
|
+
const invokedCommand = options.projectionCommand ?? "list";
|
|
901
|
+
const projection = parseProjectionConfig(options, invokedCommand);
|
|
902
|
+
validateListProjectionFields(projection, runtimeMetadataKeysForProjection(runtimeFieldRegistry.definitions), invokedCommand);
|
|
928
903
|
return {
|
|
929
904
|
pmRoot,
|
|
930
905
|
settings,
|
|
@@ -1035,7 +1010,18 @@ async function tryLoadIndexedListPage(params) {
|
|
|
1035
1010
|
"stream",
|
|
1036
1011
|
"includeBody",
|
|
1037
1012
|
"excludeTerminal",
|
|
1013
|
+
"dependencyBlocked",
|
|
1038
1014
|
"noTruncate",
|
|
1015
|
+
"projectionCommand",
|
|
1016
|
+
"truncate",
|
|
1017
|
+
"notes",
|
|
1018
|
+
"learnings",
|
|
1019
|
+
"files",
|
|
1020
|
+
"docs",
|
|
1021
|
+
"tests",
|
|
1022
|
+
"comments",
|
|
1023
|
+
"deps",
|
|
1024
|
+
"linkedCommand",
|
|
1039
1025
|
]);
|
|
1040
1026
|
const projectionNeedsHeavyData = [
|
|
1041
1027
|
runtime.projection.mode === "full",
|
|
@@ -1257,4 +1243,4 @@ export const _testOnly = {
|
|
|
1257
1243
|
withTreeMetadata,
|
|
1258
1244
|
};
|
|
1259
1245
|
//# sourceMappingURL=list.js.map
|
|
1260
|
-
//# debugId=
|
|
1246
|
+
//# debugId=67c5ff91-1c04-5506-ae5b-32f6552f1d07
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Stable projection names emitted by list envelopes and command contracts. */
|
|
2
|
+
export type ListProjectionMode = "full" | "compact" | "brief" | "fields";
|
|
3
|
+
/** Stable field order for the compact list projection. */
|
|
4
|
+
export declare const DEFAULT_COMPACT_LIST_FIELDS: readonly ["id", "title", "status", "type", "priority", "parent", "updated_at"];
|
|
5
|
+
/** Stable field order for the agent-optimized brief list projection. */
|
|
6
|
+
export declare const BRIEF_LIST_FIELDS: readonly ["id", "status", "type", "title"];
|
|
7
|
+
/** Machine-readable default projection contract for every list command. */
|
|
8
|
+
export declare const LIST_COMMAND_DEFAULT_PROJECTIONS: {
|
|
9
|
+
readonly list: "brief";
|
|
10
|
+
readonly "list-all": "full";
|
|
11
|
+
readonly "list-draft": "full";
|
|
12
|
+
readonly "list-open": "brief";
|
|
13
|
+
readonly "list-in-progress": "brief";
|
|
14
|
+
readonly "list-blocked": "brief";
|
|
15
|
+
readonly "list-closed": "full";
|
|
16
|
+
readonly "list-canceled": "full";
|
|
17
|
+
};
|
|
18
|
+
/** Command names whose output defaults are described by the list projection contract. */
|
|
19
|
+
export type ListCommandName = keyof typeof LIST_COMMAND_DEFAULT_PROJECTIONS;
|
|
20
|
+
/** Return every accepted list projection selector for core and runtime metadata. */
|
|
21
|
+
export declare function listListProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
|
|
22
|
+
/** Canonical get depth values. The CLI also accepts full as an alias for deep. */
|
|
23
|
+
export declare const GET_DEPTH_VALUES: readonly ["brief", "standard", "deep"];
|
|
24
|
+
/** Return every accepted get projection selector for core and runtime metadata. */
|
|
25
|
+
export declare function listGetProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
|
|
26
|
+
/** Stable field order for compact search results. */
|
|
27
|
+
export declare const DEFAULT_COMPACT_SEARCH_FIELDS: readonly ["id", "title", "status", "type", "priority", "updated_at", "score", "matched_fields"];
|
|
28
|
+
/** Search-result fields that live beside the nested item projection. */
|
|
29
|
+
export declare const SEARCH_HIT_FIELD_KEYS: readonly ["score", "matched_fields", "highlights"];
|
|
30
|
+
/** Core item fields accepted by explicit search projections. */
|
|
31
|
+
export declare const SEARCH_ITEM_FIELD_KEYS: readonly ["id", "title", "description", "type", "status", "priority", "tags", "created_at", "updated_at", "deadline", "assignee", "author", "estimated_minutes", "acceptance_criteria", "dependencies", "comments", "notes", "learnings", "reminders", "events", "files", "tests", "docs", "close_reason", "parent", "reviewer", "risk", "confidence", "sprint", "release", "blocked_by", "blocked_reason", "reporter", "severity", "environment", "repro_steps", "resolution", "expected_result", "actual_result", "affected_version", "fixed_version", "component", "regression", "customer_impact", "definition_of_ready", "order", "rank", "goal", "objective", "value", "impact", "outcome", "why_now", "plan"];
|
|
32
|
+
/** Return every accepted search projection selector for core and runtime metadata. */
|
|
33
|
+
export declare function listSearchProjectionFields(runtimeMetadataKeys?: Iterable<string>): string[];
|