@unbrained/pm-cli 2026.8.18 → 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 +35 -2
- package/dist/cli/error-guidance.js +3 -2
- package/dist/cli/help-content.js +32 -13
- package/dist/cli/help-json-payload.d.ts +15 -0
- package/dist/cli/help-json-payload.js +101 -23
- package/dist/cli/main.js +6 -2
- package/dist/cli/register-list-query.js +18 -13
- package/dist/cli/register-mutation.js +8 -8
- package/dist/cli/register-operations.js +6 -6
- 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-UYCLQVL2.js → chunk-2RDVGYWE.js} +12 -12
- package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-4GB2LTOQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.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-K3EN3LK2.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.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-5UZZAJKR.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-XJPAW63D.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-DSOSB2XQ.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-QUR6QL2C.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-325UXIO7.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-5L7M4AI7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-6AHG2YW7.js} +44 -44
- package/dist/cli-bundle/focused-chunks/chunk-AZBACT5T.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-BLJCGGID.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-FUREQLQN.js +18 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-G3C5ERXG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-GXWQBE3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JWKEDZJI.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-KYZ6JGPL.js +155 -0
- package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-M32HFIQB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-OM65KHGF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-Q47EX4DI.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.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-UGSS4F5X.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-Z3PLWSGM.js +2 -0
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -1
- 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 +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 -4
- 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/errors.d.ts +2 -0
- package/dist/core/shared/errors.js +2 -2
- 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 +53 -0
- package/dist/sdk/agent/refusal-closure.js +134 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +27 -1
- package/dist/sdk/agent/refusal-reachability.js +26 -2
- package/dist/sdk/agent-capability-contracts.d.ts +13 -0
- package/dist/sdk/agent-capability-contracts.js +101 -9
- package/dist/sdk/cli-contracts/command-aliases.js +18 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
- package/dist/sdk/cli-contracts/commander-types.js +5 -4
- 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 +7 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +84 -8
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +72 -0
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +340 -0
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +83 -2
- package/dist/sdk/cli-contracts/grammar-contracts.js +618 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
- package/dist/sdk/cli-contracts/runtime-contracts.js +47 -13
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
- package/dist/sdk/cli-contracts/tool-schema.js +7 -2
- package/dist/sdk/cli-contracts.d.ts +4 -3
- package/dist/sdk/cli-contracts.js +6 -5
- package/dist/sdk/context-intent-contracts.d.ts +2 -2
- package/dist/sdk/context-intent-contracts.js +22 -7
- package/dist/sdk/contracts.d.ts +3 -0
- package/dist/sdk/contracts.js +5 -2
- package/dist/sdk/core.d.ts +1 -1
- package/dist/sdk/core.js +3 -3
- package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
- package/dist/sdk/flag-invocation-contracts.js +218 -9
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +206 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +244 -40
- package/dist/sdk/index.d.ts +11 -7
- package/dist/sdk/index.js +10 -6
- 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/output-projection.d.ts +2 -0
- package/dist/sdk/output-projection.js +11 -5
- package/dist/sdk/query/get.d.ts +1 -1
- package/dist/sdk/query/get.js +34 -49
- package/dist/sdk/query/list.d.ts +7 -21
- package/dist/sdk/query/list.js +44 -44
- 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 +3 -2
- package/dist/sdk/query/search-contracts.js +30 -85
- package/dist/sdk/query/search.d.ts +15 -0
- package/dist/sdk/query/search.js +32 -6
- package/dist/sdk/read-output/continuation.d.ts +1 -1
- package/dist/sdk/read-output/continuation.js +7 -24
- package/dist/sdk/read-output-contracts.js +55 -6
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +47 -18
- 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 +25 -17
- package/dist/sdk/similarity.d.ts +13 -0
- package/dist/sdk/similarity.js +32 -6
- package/dist/sdk/workspace-snapshot.d.ts +2 -0
- package/dist/sdk/workspace-snapshot.js +10 -2
- package/docs/COMMANDS.md +29 -5
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
- package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +114 -0
- package/docs/SDK.md +16 -2
- package/docs/SDK_CONTEXT_INTEGRITY.md +45 -0
- package/docs/TESTING.md +14 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
- package/docs/performance/sdk-entrypoint-import-costs.md +14 -21
- package/marketplace.json +2 -2
- package/package.json +9 -7
- 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/scripts/generate-agent-capability-surfaces.mjs +20 -14
- package/sdk/public-surface.json +950 -24
- package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
- package/dist/cli-bundle/chunks/chunk-GNFAFIJI.js +0 -77
- package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
- package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
- package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +0 -3
- package/dist/cli-bundle/chunks/register-list-query-I23LALEE.js +0 -11
- package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-3TKWMNKF.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-5AF3ZBNB.js +0 -155
- package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
package/dist/sdk/query/get.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
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
|
+
import { renderPmCommand } from "../command-line.js";
|
|
10
11
|
import { recordContextUsageTouches } from "../context-usage.js";
|
|
11
12
|
import { buildItemChildrenRollup, } from "../item-children.js";
|
|
12
13
|
import { buildItemSchedule, } from "../item-schedule.js";
|
|
@@ -14,7 +15,8 @@ import { getItemAt } from "../history-read.js";
|
|
|
14
15
|
import { parseIntegerLimit } from "./parsers.js";
|
|
15
16
|
import { runList } from "./list.js";
|
|
16
17
|
import { registerOutputMaterialFieldGroups } from "../output-projection.js";
|
|
17
|
-
|
|
18
|
+
import { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
|
|
19
|
+
export { GET_DEPTH_VALUES, listGetProjectionFields, } from "./projection-contracts.js";
|
|
18
20
|
const AUTOMATIC_CHILD_ROLLUP_TYPES = new Set([
|
|
19
21
|
"epic",
|
|
20
22
|
"feature",
|
|
@@ -142,52 +144,24 @@ function parseGetFields(raw) {
|
|
|
142
144
|
function normalizeGetField(field) {
|
|
143
145
|
return field.startsWith("item.") ? field.slice("item.".length) : field;
|
|
144
146
|
}
|
|
145
|
-
function validateGetFields(fields, runtimeMetadataKeys) {
|
|
147
|
+
function validateGetFields(fields, runtimeMetadataKeys, id) {
|
|
146
148
|
if (fields === null) {
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
...runtimeMetadataKeys,
|
|
152
|
-
"notes_count",
|
|
153
|
-
"tests_count",
|
|
154
|
-
"collection_counts",
|
|
155
|
-
]);
|
|
156
|
-
const allowedRootFields = new Set([
|
|
157
|
-
"body",
|
|
158
|
-
"linked",
|
|
159
|
-
"claim_state",
|
|
160
|
-
"children",
|
|
161
|
-
"schedule",
|
|
162
|
-
]);
|
|
163
|
-
const allowedLinkedFields = new Set([
|
|
164
|
-
"linked.files",
|
|
165
|
-
"linked.tests",
|
|
166
|
-
"linked.docs",
|
|
167
|
-
]);
|
|
168
|
-
const allowedClaimStateFields = new Set([
|
|
169
|
-
"claim_state.claimed",
|
|
170
|
-
"claim_state.assignee",
|
|
171
|
-
"claim_state.last_claim",
|
|
172
|
-
"claim_state.last_release",
|
|
173
|
-
]);
|
|
174
|
-
const allowedScheduleFields = new Set([
|
|
175
|
-
"schedule.deadline",
|
|
176
|
-
"schedule.start_at",
|
|
177
|
-
"schedule.end_at",
|
|
178
|
-
"schedule.location",
|
|
179
|
-
"schedule.reminders",
|
|
180
|
-
"schedule.events",
|
|
181
|
-
]);
|
|
151
|
+
const allowedValues = listGetProjectionFields(runtimeMetadataKeys);
|
|
152
|
+
const allowed = new Set(allowedValues);
|
|
182
153
|
const unknown = fields.filter((field) => {
|
|
183
154
|
const normalized = normalizeGetField(field);
|
|
184
|
-
return (!
|
|
185
|
-
!
|
|
186
|
-
!allowedLinkedFields.has(normalized) &&
|
|
187
|
-
!allowedClaimStateFields.has(normalized) &&
|
|
188
|
-
!allowedScheduleFields.has(normalized));
|
|
155
|
+
return (!allowed.has(field) &&
|
|
156
|
+
!allowed.has(normalized));
|
|
189
157
|
});
|
|
190
158
|
if (unknown.length > 0) {
|
|
159
|
+
const suggestedRetryArguments = [
|
|
160
|
+
"get",
|
|
161
|
+
id,
|
|
162
|
+
"--fields",
|
|
163
|
+
"id,title,status",
|
|
164
|
+
];
|
|
191
165
|
throw new PmCliError(`Unknown get --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
|
|
192
166
|
code: "unknown_field_projection",
|
|
193
167
|
examples: [
|
|
@@ -195,6 +169,11 @@ function validateGetFields(fields, runtimeMetadataKeys) {
|
|
|
195
169
|
"pm get <id> --fields id,title,claim_state",
|
|
196
170
|
"pm get <id> --fields id,title,body,linked.files",
|
|
197
171
|
],
|
|
172
|
+
recovery: {
|
|
173
|
+
allowed_values: allowedValues,
|
|
174
|
+
suggested_retry: renderPmCommand(suggestedRetryArguments),
|
|
175
|
+
suggested_retry_args: suggestedRetryArguments,
|
|
176
|
+
},
|
|
198
177
|
});
|
|
199
178
|
}
|
|
200
179
|
}
|
|
@@ -256,10 +235,16 @@ function fieldsIncludeRoot(fields, name) {
|
|
|
256
235
|
return normalized === name || normalized.startsWith(`${name}.`);
|
|
257
236
|
});
|
|
258
237
|
}
|
|
259
|
-
function resolveGetProjection(options) {
|
|
238
|
+
function resolveGetProjection(options, id) {
|
|
260
239
|
if (options.full &&
|
|
261
240
|
(options.fields !== undefined || options.depth !== undefined)) {
|
|
262
|
-
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
|
+
});
|
|
263
248
|
}
|
|
264
249
|
if (options.tree !== true && options.treeDepth !== undefined) {
|
|
265
250
|
throw new PmCliError("Get --tree-depth requires --tree", EXIT_CODE.USAGE);
|
|
@@ -309,9 +294,9 @@ async function loadGetItemContext(id, global, at) {
|
|
|
309
294
|
body: loaded.document.body,
|
|
310
295
|
};
|
|
311
296
|
}
|
|
312
|
-
function validateGetProjectionFields(fields, settings, historical) {
|
|
297
|
+
function validateGetProjectionFields(fields, settings, historical, id) {
|
|
313
298
|
const runtimeMetadataKeys = resolveRuntimeFieldRegistry(settings.schema).definitions.map((field) => field.metadata_key);
|
|
314
|
-
validateGetFields(fields, runtimeMetadataKeys);
|
|
299
|
+
validateGetFields(fields, runtimeMetadataKeys, id);
|
|
315
300
|
if (historical && fieldsIncludeRoot(fields ?? [], "children")) {
|
|
316
301
|
throw new PmCliError("Get --at cannot project children because workspace-level historical relationships are not yet indexed.", EXIT_CODE.USAGE);
|
|
317
302
|
}
|
|
@@ -395,9 +380,9 @@ async function buildGetTree(context, options, treeDepth, global) {
|
|
|
395
380
|
}
|
|
396
381
|
/** Implements run get for the public runtime surface of this module. */
|
|
397
382
|
export async function runGet(id, global, options = {}) {
|
|
398
|
-
const projection = resolveGetProjection(options);
|
|
383
|
+
const projection = resolveGetProjection(options, id);
|
|
399
384
|
const context = await loadGetItemContext(id, global, options.at);
|
|
400
|
-
validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined);
|
|
385
|
+
validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined, context.locatedId);
|
|
401
386
|
const includeBody = shouldIncludeGetField({ ...projection, field: "body" });
|
|
402
387
|
const includeLinked = shouldIncludeGetField({
|
|
403
388
|
...projection,
|
|
@@ -463,4 +448,4 @@ export const _testOnlyGetCommand = {
|
|
|
463
448
|
shouldAutoIncludeGetChildren,
|
|
464
449
|
};
|
|
465
450
|
//# sourceMappingURL=get.js.map
|
|
466
|
-
//# 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,16 +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
|
-
]);
|
|
511
|
+
const allowedValues = listListProjectionFields(runtimeMetadataKeys);
|
|
512
|
+
const allowed = new Set(allowedValues.map((field) => normalizeProjectionField(field)));
|
|
536
513
|
const unknown = projection.fields.filter((field) => !allowed.has(normalizeProjectionField(field)));
|
|
537
514
|
if (unknown.length > 0) {
|
|
538
515
|
throw new PmCliError(`Unknown list --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
|
|
@@ -542,6 +519,17 @@ function validateListProjectionFields(projection, runtimeMetadataKeys) {
|
|
|
542
519
|
"pm list --fields id,title,parent,priority --limit 10",
|
|
543
520
|
"pm list-all --fields id,title,body --limit 5",
|
|
544
521
|
],
|
|
522
|
+
recovery: {
|
|
523
|
+
allowed_values: allowedValues,
|
|
524
|
+
suggested_retry: `pm ${invokedCommand} --fields id,title,status --limit 10`,
|
|
525
|
+
suggested_retry_args: [
|
|
526
|
+
invokedCommand,
|
|
527
|
+
"--fields",
|
|
528
|
+
"id,title,status",
|
|
529
|
+
"--limit",
|
|
530
|
+
"10",
|
|
531
|
+
],
|
|
532
|
+
},
|
|
545
533
|
});
|
|
546
534
|
}
|
|
547
535
|
}
|
|
@@ -909,8 +897,9 @@ async function resolveListRuntimeContext(options, global) {
|
|
|
909
897
|
const settings = await readSettings(pmRoot);
|
|
910
898
|
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
911
899
|
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
912
|
-
const
|
|
913
|
-
|
|
900
|
+
const invokedCommand = options.projectionCommand ?? "list";
|
|
901
|
+
const projection = parseProjectionConfig(options, invokedCommand);
|
|
902
|
+
validateListProjectionFields(projection, runtimeMetadataKeysForProjection(runtimeFieldRegistry.definitions), invokedCommand);
|
|
914
903
|
return {
|
|
915
904
|
pmRoot,
|
|
916
905
|
settings,
|
|
@@ -1021,7 +1010,18 @@ async function tryLoadIndexedListPage(params) {
|
|
|
1021
1010
|
"stream",
|
|
1022
1011
|
"includeBody",
|
|
1023
1012
|
"excludeTerminal",
|
|
1013
|
+
"dependencyBlocked",
|
|
1024
1014
|
"noTruncate",
|
|
1015
|
+
"projectionCommand",
|
|
1016
|
+
"truncate",
|
|
1017
|
+
"notes",
|
|
1018
|
+
"learnings",
|
|
1019
|
+
"files",
|
|
1020
|
+
"docs",
|
|
1021
|
+
"tests",
|
|
1022
|
+
"comments",
|
|
1023
|
+
"deps",
|
|
1024
|
+
"linkedCommand",
|
|
1025
1025
|
]);
|
|
1026
1026
|
const projectionNeedsHeavyData = [
|
|
1027
1027
|
runtime.projection.mode === "full",
|
|
@@ -1243,4 +1243,4 @@ export const _testOnly = {
|
|
|
1243
1243
|
withTreeMetadata,
|
|
1244
1244
|
};
|
|
1245
1245
|
//# sourceMappingURL=list.js.map
|
|
1246
|
-
//# 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[];
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/query/projection-contracts
|
|
3
|
+
*
|
|
4
|
+
* Declares dependency-light projection vocabularies for list, get, and search
|
|
5
|
+
* so contract-only SDK imports do not initialize query runtimes or storage.
|
|
6
|
+
*/
|
|
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]="5bb71ec1-7eb1-558e-a965-acd779570c2e")}catch(e){}}();
|
|
9
|
+
import { ITEM_METADATA_KEY_ORDER } from "../../core/shared/item-metadata-contract.js";
|
|
10
|
+
/** Stable field order for the compact list projection. */
|
|
11
|
+
export const DEFAULT_COMPACT_LIST_FIELDS = [
|
|
12
|
+
"id",
|
|
13
|
+
"title",
|
|
14
|
+
"status",
|
|
15
|
+
"type",
|
|
16
|
+
"priority",
|
|
17
|
+
"parent",
|
|
18
|
+
"updated_at",
|
|
19
|
+
];
|
|
20
|
+
/** Stable field order for the agent-optimized brief list projection. */
|
|
21
|
+
export const BRIEF_LIST_FIELDS = ["id", "status", "type", "title"];
|
|
22
|
+
/** Machine-readable default projection contract for every list command. */
|
|
23
|
+
export const LIST_COMMAND_DEFAULT_PROJECTIONS = {
|
|
24
|
+
list: "brief",
|
|
25
|
+
"list-all": "full",
|
|
26
|
+
"list-draft": "full",
|
|
27
|
+
"list-open": "brief",
|
|
28
|
+
"list-in-progress": "brief",
|
|
29
|
+
"list-blocked": "brief",
|
|
30
|
+
"list-closed": "full",
|
|
31
|
+
"list-canceled": "full",
|
|
32
|
+
};
|
|
33
|
+
const TREE_METADATA_FIELDS = [
|
|
34
|
+
"tree_depth",
|
|
35
|
+
"tree_parent",
|
|
36
|
+
"tree_children",
|
|
37
|
+
"tree_title",
|
|
38
|
+
];
|
|
39
|
+
/** Return every accepted list projection selector for core and runtime metadata. */
|
|
40
|
+
export function listListProjectionFields(runtimeMetadataKeys = []) {
|
|
41
|
+
return [
|
|
42
|
+
...new Set([
|
|
43
|
+
...ITEM_METADATA_KEY_ORDER,
|
|
44
|
+
"body",
|
|
45
|
+
...TREE_METADATA_FIELDS,
|
|
46
|
+
...runtimeMetadataKeys,
|
|
47
|
+
]),
|
|
48
|
+
]
|
|
49
|
+
.flatMap((field) => [field, `item.${field}`])
|
|
50
|
+
.sort();
|
|
51
|
+
}
|
|
52
|
+
/** Canonical get depth values. The CLI also accepts full as an alias for deep. */
|
|
53
|
+
export const GET_DEPTH_VALUES = ["brief", "standard", "deep"];
|
|
54
|
+
const GET_ROOT_PROJECTION_FIELDS = [
|
|
55
|
+
"body",
|
|
56
|
+
"linked",
|
|
57
|
+
"claim_state",
|
|
58
|
+
"children",
|
|
59
|
+
"schedule",
|
|
60
|
+
];
|
|
61
|
+
const GET_LINKED_PROJECTION_FIELDS = [
|
|
62
|
+
"linked.files",
|
|
63
|
+
"linked.tests",
|
|
64
|
+
"linked.docs",
|
|
65
|
+
];
|
|
66
|
+
const GET_CLAIM_STATE_PROJECTION_FIELDS = [
|
|
67
|
+
"claim_state.claimed",
|
|
68
|
+
"claim_state.assignee",
|
|
69
|
+
"claim_state.last_claim",
|
|
70
|
+
"claim_state.last_release",
|
|
71
|
+
];
|
|
72
|
+
const GET_SCHEDULE_PROJECTION_FIELDS = [
|
|
73
|
+
"schedule.deadline",
|
|
74
|
+
"schedule.start_at",
|
|
75
|
+
"schedule.end_at",
|
|
76
|
+
"schedule.location",
|
|
77
|
+
"schedule.reminders",
|
|
78
|
+
"schedule.events",
|
|
79
|
+
];
|
|
80
|
+
/** Return every accepted get projection selector for core and runtime metadata. */
|
|
81
|
+
export function listGetProjectionFields(runtimeMetadataKeys = []) {
|
|
82
|
+
const itemFields = [
|
|
83
|
+
...new Set([
|
|
84
|
+
...ITEM_METADATA_KEY_ORDER,
|
|
85
|
+
...runtimeMetadataKeys,
|
|
86
|
+
"notes_count",
|
|
87
|
+
"tests_count",
|
|
88
|
+
"collection_counts",
|
|
89
|
+
]),
|
|
90
|
+
];
|
|
91
|
+
return [
|
|
92
|
+
...itemFields.flatMap((field) => [field, `item.${field}`]),
|
|
93
|
+
...GET_ROOT_PROJECTION_FIELDS,
|
|
94
|
+
...GET_LINKED_PROJECTION_FIELDS,
|
|
95
|
+
...GET_CLAIM_STATE_PROJECTION_FIELDS,
|
|
96
|
+
...GET_SCHEDULE_PROJECTION_FIELDS,
|
|
97
|
+
].sort();
|
|
98
|
+
}
|
|
99
|
+
/** Stable field order for compact search results. */
|
|
100
|
+
export const DEFAULT_COMPACT_SEARCH_FIELDS = [
|
|
101
|
+
"id",
|
|
102
|
+
"title",
|
|
103
|
+
"status",
|
|
104
|
+
"type",
|
|
105
|
+
"priority",
|
|
106
|
+
"updated_at",
|
|
107
|
+
"score",
|
|
108
|
+
"matched_fields",
|
|
109
|
+
];
|
|
110
|
+
/** Search-result fields that live beside the nested item projection. */
|
|
111
|
+
export const SEARCH_HIT_FIELD_KEYS = [
|
|
112
|
+
"score",
|
|
113
|
+
"matched_fields",
|
|
114
|
+
"highlights",
|
|
115
|
+
];
|
|
116
|
+
/** Core item fields accepted by explicit search projections. */
|
|
117
|
+
export const SEARCH_ITEM_FIELD_KEYS = [
|
|
118
|
+
"id",
|
|
119
|
+
"title",
|
|
120
|
+
"description",
|
|
121
|
+
"type",
|
|
122
|
+
"status",
|
|
123
|
+
"priority",
|
|
124
|
+
"tags",
|
|
125
|
+
"created_at",
|
|
126
|
+
"updated_at",
|
|
127
|
+
"deadline",
|
|
128
|
+
"assignee",
|
|
129
|
+
"author",
|
|
130
|
+
"estimated_minutes",
|
|
131
|
+
"acceptance_criteria",
|
|
132
|
+
"dependencies",
|
|
133
|
+
"comments",
|
|
134
|
+
"notes",
|
|
135
|
+
"learnings",
|
|
136
|
+
"reminders",
|
|
137
|
+
"events",
|
|
138
|
+
"files",
|
|
139
|
+
"tests",
|
|
140
|
+
"docs",
|
|
141
|
+
"close_reason",
|
|
142
|
+
"parent",
|
|
143
|
+
"reviewer",
|
|
144
|
+
"risk",
|
|
145
|
+
"confidence",
|
|
146
|
+
"sprint",
|
|
147
|
+
"release",
|
|
148
|
+
"blocked_by",
|
|
149
|
+
"blocked_reason",
|
|
150
|
+
"reporter",
|
|
151
|
+
"severity",
|
|
152
|
+
"environment",
|
|
153
|
+
"repro_steps",
|
|
154
|
+
"resolution",
|
|
155
|
+
"expected_result",
|
|
156
|
+
"actual_result",
|
|
157
|
+
"affected_version",
|
|
158
|
+
"fixed_version",
|
|
159
|
+
"component",
|
|
160
|
+
"regression",
|
|
161
|
+
"customer_impact",
|
|
162
|
+
"definition_of_ready",
|
|
163
|
+
"order",
|
|
164
|
+
"rank",
|
|
165
|
+
"goal",
|
|
166
|
+
"objective",
|
|
167
|
+
"value",
|
|
168
|
+
"impact",
|
|
169
|
+
"outcome",
|
|
170
|
+
"why_now",
|
|
171
|
+
"plan",
|
|
172
|
+
];
|
|
173
|
+
/** Return every accepted search projection selector for core and runtime metadata. */
|
|
174
|
+
export function listSearchProjectionFields(runtimeMetadataKeys = []) {
|
|
175
|
+
const runtimeKeys = [...new Set(runtimeMetadataKeys)];
|
|
176
|
+
return [
|
|
177
|
+
...SEARCH_HIT_FIELD_KEYS,
|
|
178
|
+
...SEARCH_ITEM_FIELD_KEYS,
|
|
179
|
+
...SEARCH_ITEM_FIELD_KEYS.map((field) => `item.${field}`),
|
|
180
|
+
...runtimeKeys,
|
|
181
|
+
...runtimeKeys.map((field) => `item.${field}`),
|
|
182
|
+
].sort();
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=projection-contracts.js.map
|
|
185
|
+
//# debugId=5bb71ec1-7eb1-558e-a965-acd779570c2e
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RuntimeFieldRegistry } from "../../core/schema/runtime-schema.js";
|
|
2
2
|
import type { SharedItemFilterOptions } from "./item-filter-options.js";
|
|
3
3
|
import type { SearchMode } from "./search-rendering.js";
|
|
4
|
+
export { DEFAULT_COMPACT_SEARCH_FIELDS, SEARCH_HIT_FIELD_KEYS, SEARCH_ITEM_FIELD_KEYS, listSearchProjectionFields, } from "./projection-contracts.js";
|
|
4
5
|
/** Documents the search options payload exchanged by command, SDK, and package integrations. */
|
|
5
6
|
export interface SearchOptions extends SharedItemFilterOptions {
|
|
6
7
|
/** Value that configures or reports mode for this contract. */
|
|
@@ -60,9 +61,9 @@ export declare function normalizeSearchPhrase(value: string): string;
|
|
|
60
61
|
/** Parse an optional deadline filter. */
|
|
61
62
|
export declare function parseSearchDeadline(raw: string | undefined, fieldLabel: string): string | undefined;
|
|
62
63
|
/** Resolve mutually exclusive compact, full, or explicit-field projection. */
|
|
63
|
-
export declare function parseSearchProjection(options: SearchOptions): SearchProjectionConfig;
|
|
64
|
+
export declare function parseSearchProjection(options: SearchOptions, query?: string): SearchProjectionConfig;
|
|
64
65
|
/** Validate explicit projection fields against core and runtime metadata. */
|
|
65
|
-
export declare function validateSearchProjectionFields(projection: SearchProjectionConfig, runtimeFieldRegistry: RuntimeFieldRegistry): void;
|
|
66
|
+
export declare function validateSearchProjectionFields(projection: SearchProjectionConfig, runtimeFieldRegistry: RuntimeFieldRegistry, query?: string): void;
|
|
66
67
|
/** Parse a non-empty normalized query into lexical tokens. */
|
|
67
68
|
export declare function parseSearchTokens(query: string): string[];
|
|
68
69
|
/** Documents the search tuning payload exchanged by command, SDK, and package integrations. */
|