@unbrained/pm-cli 2026.8.9 → 2026.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +40 -0
- package/dist/cli/commander-usage.js +17 -12
- package/dist/cli/help-json-payload.js +51 -16
- package/dist/cli/main.js +7 -6
- package/dist/cli-bundle/bundle-manifest.json +165 -165
- package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +30 -0
- package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-EBO7OUUE.js} +57 -57
- package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ETML5C6H.js} +48 -48
- package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +194 -0
- package/dist/cli-bundle/chunks/{chunk-PYO5GZU6.js → chunk-JZSNADRR.js} +5 -5
- package/dist/cli-bundle/chunks/{chunk-EF43KODO.js → chunk-MENWVGJW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5JO6R4BS.js → chunk-S4EITGLA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-2DTCZXSD.js → chunk-TIGKWVLA.js} +9 -9
- package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-TRWXF476.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +2 -0
- package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-OJ6ZXKV4.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-FC3XLVIK.js → register-mutation-DKI7QC7O.js} +2 -2
- package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-S3KT2LTH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2COZ67XT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-2EXI2DKR.js +4 -0
- package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-34SX654S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-75774JWP.js +6 -0
- package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-7UN6BHHO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VRXJSGIT.js → chunk-CHIBMEZR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-DZGAHZZV.js +3 -0
- package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +153 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZG54B4XG.js → chunk-GHTN2ILR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-IW43E4XL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-JMVA4HKR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C3GCHDSQ.js → chunk-KR5RVXLQ.js} +31 -31
- package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +16 -0
- package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-M6RPIXKC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +18 -0
- package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-U46GQJNY.js → chunk-RKWSCYYN.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +38 -38
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +1 -1
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +2 -2
- package/dist/core/diagnostics/remediation.js +9 -9
- package/dist/core/fs/fs-utils.d.ts +10 -0
- package/dist/core/fs/fs-utils.js +16 -4
- package/dist/core/item/item-format.js +3 -32
- package/dist/core/schema/fields-file.d.ts +1 -2
- package/dist/core/schema/fields-file.js +4 -11
- package/dist/core/schema/runtime-schema.js +3 -10
- package/dist/core/schema/status-defs-file.d.ts +1 -2
- package/dist/core/schema/status-defs-file.js +4 -32
- package/dist/core/schema/status-token.d.ts +2 -0
- package/dist/core/schema/status-token.js +32 -0
- package/dist/core/schema/type-workflows.d.ts +1 -2
- package/dist/core/schema/type-workflows.js +4 -11
- package/dist/core/shared/author.d.ts +1 -1
- package/dist/core/shared/author.js +21 -8
- package/dist/core/shared/errors.d.ts +4 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/core/shared/text-normalization.d.ts +1 -1
- package/dist/core/shared/text-normalization.js +2 -2
- package/dist/sdk/agent/command-recovery.d.ts +4 -0
- package/dist/sdk/agent/command-recovery.js +52 -0
- package/dist/sdk/agent/command-suggestions.d.ts +4 -0
- package/dist/sdk/agent/command-suggestions.js +67 -0
- package/dist/sdk/agent/create-option-policy.d.ts +12 -0
- package/dist/sdk/agent/create-option-policy.js +32 -0
- package/dist/sdk/agent/item-addressing.d.ts +19 -0
- package/dist/sdk/agent/item-addressing.js +208 -0
- package/dist/sdk/cli-bootstrap.d.ts +1 -1
- package/dist/sdk/cli-bootstrap.js +20 -5
- package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
- package/dist/sdk/cli-contracts/flag-contracts.js +62 -21
- package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
- package/dist/sdk/cli-contracts/runtime-contracts.js +5 -3
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
- package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
- package/dist/sdk/cli-contracts/tool-parameter-tables.js +19 -4
- package/dist/sdk/cli-contracts/tool-schema.js +17 -4
- package/dist/sdk/context-intent-runtime.js +8 -5
- package/dist/sdk/context-signal-store.d.ts +34 -0
- package/dist/sdk/context-signal-store.js +24 -2
- package/dist/sdk/dependency-flag-validation.d.ts +15 -1
- package/dist/sdk/dependency-flag-validation.js +54 -2
- package/dist/sdk/generated-error-code-catalog.js +74 -2
- package/dist/sdk/governance/health.js +14 -7
- package/dist/sdk/governance/provenance-health.d.ts +13 -0
- package/dist/sdk/governance/provenance-health.js +63 -17
- package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
- package/dist/sdk/governance/validate-item-reader.js +18 -0
- package/dist/sdk/governance/validate.d.ts +2 -2
- package/dist/sdk/governance/validate.js +15 -6
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/index.js +6 -2
- package/dist/sdk/lifecycle/close.js +17 -14
- package/dist/sdk/lifecycle/create.d.ts +2 -0
- package/dist/sdk/lifecycle/create.js +62 -9
- package/dist/sdk/lifecycle/update-many.js +39 -27
- package/dist/sdk/lifecycle/update.d.ts +6 -1
- package/dist/sdk/lifecycle/update.js +47 -10
- package/dist/sdk/merge/index.d.ts +1 -1
- package/dist/sdk/merge/index.js +3 -3
- package/dist/sdk/merge/install.d.ts +4 -0
- package/dist/sdk/merge/install.js +28 -16
- package/dist/sdk/merge/receipts.d.ts +3 -0
- package/dist/sdk/merge/receipts.js +81 -17
- package/dist/sdk/output-projection.js +24 -4
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +7 -4
- package/dist/sdk/query/light-metadata.d.ts +3 -0
- package/dist/sdk/query/light-metadata.js +19 -0
- package/dist/sdk/runtime.d.ts +4 -1
- package/dist/sdk/runtime.js +8 -3
- package/dist/sdk/schema-migration.js +7 -9
- package/dist/sdk/similarity-scoring.d.ts +1 -2
- package/dist/sdk/similarity-scoring.js +4 -16
- package/dist/sdk/workspace-snapshot.d.ts +4 -0
- package/dist/sdk/workspace-snapshot.js +24 -11
- package/docs/AGENT_GUIDE.md +3 -1
- package/docs/COMMANDS.md +8 -5
- package/docs/MERGE_SAFETY.md +7 -5
- package/docs/README.md +2 -5
- package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
- package/docs/SDK.md +33 -8
- package/docs/SDK_AGENT_SESSION_CONTEXT.md +3 -2
- package/docs/SDK_CONTEXT.md +97 -0
- package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
- package/docs/agent-task-token-baseline.json +2 -2
- package/marketplace.json +2 -2
- package/package.json +5 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/sdk/public-surface.json +194 -26
- package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
- package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
- package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
- package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
- package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
- package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
- package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
- package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
- package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
- package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Fields File.
|
|
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]="575b0c3a-9ce1-504f-a24e-d8854e898f17")}catch(e){}}();
|
|
8
8
|
import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, } from "../../types/index.js";
|
|
9
9
|
import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
|
|
10
|
+
import { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
|
|
11
|
+
export { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
|
|
10
12
|
/**
|
|
11
13
|
* Pure logic for the `pm schema add-field` / `pm schema remove-field` commands
|
|
12
14
|
* and the `list-fields` / `show-field` inspectors. The CLI command file
|
|
@@ -52,15 +54,6 @@ export const BUILTIN_FIELD_KEYS = new Set([
|
|
|
52
54
|
]);
|
|
53
55
|
/** The default commands a field is wired onto when `--commands` is omitted, matching the runtime default in runtime-schema.ts (normalizeRuntimeFieldDefinition). */
|
|
54
56
|
const DEFAULT_FIELD_COMMANDS = ["create", "update"];
|
|
55
|
-
/** Normalizes a field key using the same rule as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
56
|
-
export function normalizeFieldKey(value) {
|
|
57
|
-
return typeof value === "string"
|
|
58
|
-
? value
|
|
59
|
-
.trim()
|
|
60
|
-
.toLowerCase()
|
|
61
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
62
|
-
: "";
|
|
63
|
-
}
|
|
64
57
|
/** Normalizes a CLI flag token: strip a leading `--`, lowercase, and collapse whitespace/underscore runs to a single hyphen (matches normalizeCliToken in runtime-schema.ts). */
|
|
65
58
|
function normalizeCliToken(value) {
|
|
66
59
|
if (typeof value !== "string") {
|
|
@@ -293,4 +286,4 @@ function applyBooleanFlag(definition, key, value) {
|
|
|
293
286
|
}
|
|
294
287
|
}
|
|
295
288
|
//# sourceMappingURL=fields-file.js.map
|
|
296
|
-
//# debugId=
|
|
289
|
+
//# debugId=575b0c3a-9ce1-504f-a24e-d8854e898f17
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Runtime Schema.
|
|
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]="a9ff482a-f9f9-5e35-88d0-240db815ec08")}catch(e){}}();
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { pathExists, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
|
|
10
10
|
import { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION, } from "../shared/constants.js";
|
|
11
11
|
import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, RUNTIME_STATUS_ROLE_VALUES, RUNTIME_UNKNOWN_FIELD_POLICY_VALUES, STATUS_VALUES, } from "../../types/index.js";
|
|
12
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
12
13
|
/** Fallback runtime schema file paths used when callers do not provide an override. */
|
|
13
14
|
export const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS = Object.freeze({
|
|
14
15
|
types: "schema/types.json",
|
|
@@ -39,14 +40,6 @@ function normalizeStringList(values) {
|
|
|
39
40
|
.filter((value) => value.length > 0)),
|
|
40
41
|
].sort((left, right) => left.localeCompare(right));
|
|
41
42
|
}
|
|
42
|
-
function normalizeStatusToken(value) {
|
|
43
|
-
return typeof value === "string"
|
|
44
|
-
? value
|
|
45
|
-
.trim()
|
|
46
|
-
.toLowerCase()
|
|
47
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
48
|
-
: "";
|
|
49
|
-
}
|
|
50
43
|
function normalizeStatusId(value) {
|
|
51
44
|
if (typeof value !== "string" || value.length === 0) {
|
|
52
45
|
return undefined;
|
|
@@ -698,4 +691,4 @@ export function statusIsTerminal(status, registry) {
|
|
|
698
691
|
return registry.terminal_statuses.has(normalized);
|
|
699
692
|
}
|
|
700
693
|
//# sourceMappingURL=runtime-schema.js.map
|
|
701
|
-
//# debugId=
|
|
694
|
+
//# debugId=a9ff482a-f9f9-5e35-88d0-240db815ec08
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RuntimeStatusDefinition, RuntimeStatusRole } from "../../types/index.js";
|
|
2
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
2
3
|
export type { RuntimeStatusDefinition, RuntimeStatusRole, } from "../../types/index.js";
|
|
3
4
|
/** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
|
|
4
5
|
export declare const BUILTIN_STATUS_IDS: ReadonlySet<string>;
|
|
@@ -51,8 +52,6 @@ export interface RemoveStatusDefResult {
|
|
|
51
52
|
/** The removed definition, when one matched the requested id. */
|
|
52
53
|
definition?: RuntimeStatusDefinition;
|
|
53
54
|
}
|
|
54
|
-
/** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
55
|
-
export declare function normalizeStatusToken(value: unknown): string;
|
|
56
55
|
/**
|
|
57
56
|
* Validates and normalizes raw add-status CLI input. Throws a plain Error with a
|
|
58
57
|
* stable message when the id is missing/empty or a role is not one of
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Status Defs File.
|
|
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]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}catch(e){}}();
|
|
8
8
|
import { RUNTIME_STATUS_ROLE_VALUES } from "../../types/index.js";
|
|
9
9
|
import { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from "./runtime-schema.js";
|
|
10
|
-
import {
|
|
10
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
11
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
11
12
|
/**
|
|
12
13
|
* Pure logic for the `pm schema add-status` / `pm schema remove-status`
|
|
13
14
|
* commands. The CLI command file (schema.ts) owns IO/governance; everything
|
|
@@ -20,37 +21,8 @@ import { evictOldestMemoEntries } from "../shared/memo.js";
|
|
|
20
21
|
* into the persisted file.
|
|
21
22
|
*/
|
|
22
23
|
const RUNTIME_STATUS_ROLE_SET = new Set(RUNTIME_STATUS_ROLE_VALUES);
|
|
23
|
-
/**
|
|
24
|
-
* Memo for {@link normalizeStatusToken}. Status ranking inside sort comparators
|
|
25
|
-
* normalizes the same handful of status strings O(n log n) times per corpus scan, and
|
|
26
|
-
* the trim/lowercase/regex pipeline shows up in list/next/context profiles. The cap
|
|
27
|
-
* bounds memory in long-lived hosts against unbounded arbitrary inputs; half-eviction keeps the
|
|
28
|
-
* newest-inserted half when the cap is hit. Declared before
|
|
29
|
-
* BUILTIN_STATUS_IDS, whose module-level initializer already normalizes tokens.
|
|
30
|
-
*/
|
|
31
|
-
const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
|
|
32
|
-
const statusTokenMemo = new Map();
|
|
33
24
|
/** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
|
|
34
25
|
export const BUILTIN_STATUS_IDS = new Set(DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition) => normalizeStatusToken(definition.id)).filter((id) => id.length > 0));
|
|
35
|
-
/** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
|
|
36
|
-
export function normalizeStatusToken(value) {
|
|
37
|
-
if (typeof value !== "string") {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
const memoized = statusTokenMemo.get(value);
|
|
41
|
-
if (memoized !== undefined) {
|
|
42
|
-
return memoized;
|
|
43
|
-
}
|
|
44
|
-
const normalized = value
|
|
45
|
-
.trim()
|
|
46
|
-
.toLowerCase()
|
|
47
|
-
.replaceAll(/[\s-]+/g, "_");
|
|
48
|
-
if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
|
|
49
|
-
evictOldestMemoEntries(statusTokenMemo);
|
|
50
|
-
}
|
|
51
|
-
statusTokenMemo.set(value, normalized);
|
|
52
|
-
return normalized;
|
|
53
|
-
}
|
|
54
26
|
function dedupeTokens(values) {
|
|
55
27
|
const seen = new Set();
|
|
56
28
|
for (const value of values) {
|
|
@@ -250,4 +222,4 @@ export function assertStatusTokensAvailable(input, resolvedAliasToId) {
|
|
|
250
222
|
}
|
|
251
223
|
}
|
|
252
224
|
//# sourceMappingURL=status-defs-file.js.map
|
|
253
|
-
//# debugId=
|
|
225
|
+
//# debugId=3eac0218-43c9-5bd2-8eaf-589d02d2c8ad
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/schema/status-token
|
|
3
|
+
*
|
|
4
|
+
* Owns the canonical bounded status-token normalization primitive used by
|
|
5
|
+
* schema files, runtime registries, workflows, and package-facing SDK helpers.
|
|
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]="d6056922-237d-525a-b354-687493a4e123")}catch(e){}}();
|
|
9
|
+
import { evictOldestMemoEntries } from "../shared/memo.js";
|
|
10
|
+
const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
|
|
11
|
+
const statusTokenMemo = new Map();
|
|
12
|
+
/** Lowercase a status token and collapse whitespace or hyphen runs to one underscore. */
|
|
13
|
+
export function normalizeStatusToken(value) {
|
|
14
|
+
if (typeof value !== "string") {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const memoized = statusTokenMemo.get(value);
|
|
18
|
+
if (memoized !== undefined) {
|
|
19
|
+
return memoized;
|
|
20
|
+
}
|
|
21
|
+
const normalized = value
|
|
22
|
+
.trim()
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replaceAll(/[\s-]+/g, "_");
|
|
25
|
+
if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
|
|
26
|
+
evictOldestMemoEntries(statusTokenMemo);
|
|
27
|
+
}
|
|
28
|
+
statusTokenMemo.set(value, normalized);
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=status-token.js.map
|
|
32
|
+
//# debugId=d6056922-237d-525a-b354-687493a4e123
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Resolves configurable schema, fields, statuses, and workflows for Type Workflows.
|
|
5
5
|
*/
|
|
6
6
|
import type { RuntimeSchemaSettings } from "../../types/index.js";
|
|
7
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
7
8
|
/**
|
|
8
9
|
* Per-type allowed-transition support (governance.workflow_enforcement).
|
|
9
10
|
*
|
|
@@ -51,8 +52,6 @@ export interface EvaluateTransitionResult {
|
|
|
51
52
|
/** Allowed [from, to] pairs for the matched type (normalized ids). Empty when the type is unrestricted. */
|
|
52
53
|
allowedTransitions: [string, string][];
|
|
53
54
|
}
|
|
54
|
-
/** Normalize a status token the same way runtime-schema statuses are normalized. */
|
|
55
|
-
export declare function normalizeStatusToken(value: unknown): string;
|
|
56
55
|
/**
|
|
57
56
|
* Normalize the raw type_workflows from a runtime schema into a deduped,
|
|
58
57
|
* lower-cased-type list with normalized status tokens.
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/** Normalize a status token the same way runtime-schema statuses are normalized. */
|
|
2
1
|
|
|
3
|
-
!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]="
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
? value
|
|
7
|
-
.trim()
|
|
8
|
-
.toLowerCase()
|
|
9
|
-
.replaceAll(/[\s-]+/g, "_")
|
|
10
|
-
: "";
|
|
11
|
-
}
|
|
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]="c4e316a0-823d-5722-9e15-6d741ae44f1b")}catch(e){}}();
|
|
3
|
+
import { normalizeStatusToken } from "./status-token.js";
|
|
4
|
+
export { normalizeStatusToken } from "./status-token.js";
|
|
12
5
|
function normalizeTypeName(value) {
|
|
13
6
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
14
7
|
}
|
|
@@ -109,4 +102,4 @@ export function describeAllowedTransitions(allowedTransitions) {
|
|
|
109
102
|
.join(", ");
|
|
110
103
|
}
|
|
111
104
|
//# sourceMappingURL=type-workflows.js.map
|
|
112
|
-
//# debugId=
|
|
105
|
+
//# debugId=c4e316a0-823d-5722-9e15-6d741ae44f1b
|
|
@@ -24,7 +24,7 @@ export type AgentProvenanceAbsenceReason = "harness_unavailable" | "resolver_fai
|
|
|
24
24
|
/** Machine-readable resolution outcome for one provenance dimension. */
|
|
25
25
|
export interface AgentProvenanceOutcome {
|
|
26
26
|
/** Whether the dimension resolved without retaining private source material. */
|
|
27
|
-
status: "resolved" | "unavailable" | "failed";
|
|
27
|
+
status: "resolved" | "unavailable" | "not_configured" | "failed";
|
|
28
28
|
/** Stable bounded reason for absent or rejected values. */
|
|
29
29
|
reason?: AgentProvenanceAbsenceReason;
|
|
30
30
|
/** Resolver name when a bounded local resolver was attempted. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides shared primitives and utilities for Author.
|
|
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]="6c075a14-1a65-59c7-a9c6-af348e30f821")}catch(e){}}();
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import fs from "node:fs";
|
|
@@ -241,7 +241,10 @@ const AGENT_ROLE_VALUES = new Set([
|
|
|
241
241
|
function normalizeProvenanceValue(dimension, value) {
|
|
242
242
|
if (dimension !== "role" || value === undefined)
|
|
243
243
|
return value;
|
|
244
|
-
const normalized = value
|
|
244
|
+
const normalized = value
|
|
245
|
+
.trim()
|
|
246
|
+
.toLowerCase()
|
|
247
|
+
.replaceAll(/[_\s]+/gu, "-");
|
|
245
248
|
return AGENT_ROLE_VALUES.has(normalized) ? normalized : undefined;
|
|
246
249
|
}
|
|
247
250
|
function boundedProvenanceValue(provenance, dimension) {
|
|
@@ -310,13 +313,23 @@ function resolveProvenanceProbe(dimension, signals, env, descriptor) {
|
|
|
310
313
|
}
|
|
311
314
|
if (resolver === "ai_agent_version") {
|
|
312
315
|
const value = nonBlank(env.AI_AGENT);
|
|
313
|
-
if (!value
|
|
316
|
+
if (!value ||
|
|
317
|
+
!descriptor ||
|
|
318
|
+
!literalSignalMatches(value, descriptor.harness)) {
|
|
314
319
|
return undefined;
|
|
320
|
+
}
|
|
315
321
|
const match = /(?:^|[@/\s])v?(\d+\.\d+(?:\.\d+)?(?:[-+][A-Za-z0-9.-]+)?)$/u.exec(value);
|
|
316
322
|
return match?.[1]?.slice(0, 256);
|
|
317
323
|
}
|
|
318
324
|
return undefined;
|
|
319
325
|
}
|
|
326
|
+
function provenanceResolverHasInput(resolver, descriptor, env) {
|
|
327
|
+
if (resolver === "ai_agent_version") {
|
|
328
|
+
const value = nonBlank(env.AI_AGENT);
|
|
329
|
+
return (value !== undefined && literalSignalMatches(value, descriptor.harness));
|
|
330
|
+
}
|
|
331
|
+
return nonBlank(env.CLAUDE_CODE_SESSION_ID) !== undefined;
|
|
332
|
+
}
|
|
320
333
|
function effectiveHarnessDetectionSignals(signals) {
|
|
321
334
|
if (signals)
|
|
322
335
|
return signals;
|
|
@@ -522,9 +535,7 @@ function resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEn
|
|
|
522
535
|
};
|
|
523
536
|
}
|
|
524
537
|
if (resolver) {
|
|
525
|
-
const resolverHasInput = resolver
|
|
526
|
-
? nonBlank(env.AI_AGENT) !== undefined
|
|
527
|
-
: nonBlank(env.CLAUDE_CODE_SESSION_ID) !== undefined;
|
|
538
|
+
const resolverHasInput = provenanceResolverHasInput(resolver, descriptor, env);
|
|
528
539
|
const status = resolverHasInput && probesEnabled ? "failed" : "unavailable";
|
|
529
540
|
const reason = !resolverHasInput
|
|
530
541
|
? "harness_unavailable"
|
|
@@ -534,7 +545,9 @@ function resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEn
|
|
|
534
545
|
return { status, reason, resolver, rule_version: "v1" };
|
|
535
546
|
}
|
|
536
547
|
return {
|
|
537
|
-
status:
|
|
548
|
+
status: descriptor?.provenance_unavailable_dimensions.includes(dimension)
|
|
549
|
+
? "unavailable"
|
|
550
|
+
: "not_configured",
|
|
538
551
|
reason: descriptor?.provenance_unavailable_dimensions.includes(dimension)
|
|
539
552
|
? "harness_unavailable"
|
|
540
553
|
: "resolver_not_configured",
|
|
@@ -680,4 +693,4 @@ export function resolveAuthor(candidate, fallback) {
|
|
|
680
693
|
return identity.author;
|
|
681
694
|
}
|
|
682
695
|
//# sourceMappingURL=author.js.map
|
|
683
|
-
//# debugId=
|
|
696
|
+
//# debugId=6c075a14-1a65-59c7-a9c6-af348e30f821
|
|
@@ -60,6 +60,10 @@ export interface PmCliErrorContext {
|
|
|
60
60
|
examples?: string[];
|
|
61
61
|
/** Value that configures or reports next steps for this contract. */
|
|
62
62
|
nextSteps?: string[];
|
|
63
|
+
/** Exact selectors that could not be matched by a lossless removal. */
|
|
64
|
+
unmatched?: string[];
|
|
65
|
+
/** Local dependency targets that could not be resolved before mutation. */
|
|
66
|
+
unresolved_targets?: string[];
|
|
63
67
|
/** Available history bounds for a failed point-in-time read or restore target. */
|
|
64
68
|
valid_range?: {
|
|
65
69
|
/** Earliest available one-based version, or null for an empty stream. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Implements the exported pm cli error runtime abstraction for core/shared/errors.ts. */
|
|
2
2
|
|
|
3
|
-
!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]="
|
|
3
|
+
!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]="31191ce6-fb17-5b76-aa3d-3c3773cd85e0")}catch(e){}}();
|
|
4
4
|
export class PmCliError extends Error {
|
|
5
5
|
/** Value that configures or reports exit code for this contract. */
|
|
6
6
|
exitCode;
|
|
@@ -18,4 +18,4 @@ export class PmCliError extends Error {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
//# sourceMappingURL=errors.js.map
|
|
21
|
-
//# debugId=
|
|
21
|
+
//# debugId=31191ce6-fb17-5b76-aa3d-3c3773cd85e0
|
|
@@ -8,4 +8,4 @@ export declare function normalizeLowercaseWhitespace(value: string): string;
|
|
|
8
8
|
/** Implements tokenize alpha numeric for the public runtime surface of this module. */
|
|
9
9
|
export declare function tokenizeAlphaNumeric(value: string): string[];
|
|
10
10
|
/** Implements jaccard similarity for the public runtime surface of this module. */
|
|
11
|
-
export declare function jaccardSimilarity(leftTokens: string[], rightTokens: string[]): number;
|
|
11
|
+
export declare function jaccardSimilarity(leftTokens: readonly string[], rightTokens: readonly string[]): number;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/** Normalizes text to lowercase whitespace-collapsed form for stable matching and comparison. */
|
|
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]="3ad30a32-0f83-5473-b0a3-349e271d8378")}catch(e){}}();
|
|
9
9
|
export function normalizeLowercaseWhitespace(value) {
|
|
10
10
|
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
11
11
|
}
|
|
@@ -36,4 +36,4 @@ export function jaccardSimilarity(leftTokens, rightTokens) {
|
|
|
36
36
|
return intersection / union;
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=text-normalization.js.map
|
|
39
|
-
//# debugId=
|
|
39
|
+
//# debugId=3ad30a32-0f83-5473-b0a3-349e271d8378
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Resolve the truthful placeholder for a missing flag from its contract. */
|
|
2
|
+
export declare function resolveMissingOptionPlaceholder(commandName: string, missingLabel: string): string | null | undefined;
|
|
3
|
+
/** Preserve an attempted argv vector and insert each missing option before `--`. */
|
|
4
|
+
export declare function renderMissingOptionRetry(invocationArgv: string[], commandName: string, missingLabels: string[]): string | undefined;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/command-recovery
|
|
3
|
+
*
|
|
4
|
+
* Builds executable recovery commands from tokenized argv and declared CLI
|
|
5
|
+
* flag domains. Display labels are normalized back to real flag tokens and
|
|
6
|
+
* supplied arguments are preserved byte-for-token.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!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]="ab87f46c-c9b4-51d1-a712-fbce7c79fca9")}catch(e){}}();
|
|
10
|
+
import { renderPmCommand } from "../command-line.js";
|
|
11
|
+
import { resolveSubcommandFlagContractsForCommand } from "../cli-contracts.js";
|
|
12
|
+
function normalizeMissingFlag(label) {
|
|
13
|
+
const match = label.trim().match(/--[a-z0-9][a-z0-9_-]*/i);
|
|
14
|
+
return match?.[0]?.replaceAll("_", "-").toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
/** Resolve the truthful placeholder for a missing flag from its contract. */
|
|
17
|
+
export function resolveMissingOptionPlaceholder(commandName, missingLabel) {
|
|
18
|
+
const flag = normalizeMissingFlag(missingLabel);
|
|
19
|
+
if (!flag)
|
|
20
|
+
return undefined;
|
|
21
|
+
const contract = resolveSubcommandFlagContractsForCommand(commandName).find((entry) => entry.flag === flag || entry.aliases?.includes(flag));
|
|
22
|
+
if (!contract)
|
|
23
|
+
return "<value>";
|
|
24
|
+
if (contract.value_type === "boolean") {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return `<${contract.value_name ?? "value"}>`;
|
|
28
|
+
}
|
|
29
|
+
/** Preserve an attempted argv vector and insert each missing option before `--`. */
|
|
30
|
+
export function renderMissingOptionRetry(invocationArgv, commandName, missingLabels) {
|
|
31
|
+
const retry = [...invocationArgv];
|
|
32
|
+
const terminatorIndex = retry.indexOf("--");
|
|
33
|
+
let insertionIndex = terminatorIndex < 0 ? retry.length : terminatorIndex;
|
|
34
|
+
for (const label of missingLabels) {
|
|
35
|
+
const flag = normalizeMissingFlag(label);
|
|
36
|
+
if (!flag ||
|
|
37
|
+
retry
|
|
38
|
+
.slice(0, insertionIndex)
|
|
39
|
+
.some((token) => token === flag || token.startsWith(`${flag}=`))) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const placeholder = resolveMissingOptionPlaceholder(commandName, flag);
|
|
43
|
+
const recoveredOption = placeholder ? [flag, placeholder] : [flag];
|
|
44
|
+
retry.splice(insertionIndex, 0, ...recoveredOption);
|
|
45
|
+
insertionIndex += recoveredOption.length;
|
|
46
|
+
}
|
|
47
|
+
return retry.length === invocationArgv.length
|
|
48
|
+
? undefined
|
|
49
|
+
: renderPmCommand(retry);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=command-recovery.js.map
|
|
52
|
+
//# debugId=ab87f46c-c9b4-51d1-a712-fbce7c79fca9
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Score one command path for a guessed command token; lower is better. */
|
|
2
|
+
export declare function scoreCommandPathMatch(commandPath: string, queryToken: string): number;
|
|
3
|
+
/** Rank available command paths for one guessed token. */
|
|
4
|
+
export declare function rankCommandPaths(commandPaths: string[], queryToken: string): string[];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/command-suggestions
|
|
3
|
+
*
|
|
4
|
+
* Provides deterministic, agent-oriented command suggestion ranking. Semantic
|
|
5
|
+
* verb aliases rank first, bounded edit distance second, and substring matches
|
|
6
|
+
* last so `log` never prefers `catalog` over item history commands.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!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]="71e5a870-f62f-5252-b4e9-e1a42e36009f")}catch(e){}}();
|
|
10
|
+
import { levenshteinDistanceWithinLimit } from "../../core/shared/levenshtein.js";
|
|
11
|
+
const COMMAND_SYNONYMS = {
|
|
12
|
+
add: ["create", "append"],
|
|
13
|
+
fetch: ["get"],
|
|
14
|
+
inspect: ["get", "health"],
|
|
15
|
+
log: ["history", "comments", "notes"],
|
|
16
|
+
ls: ["list"],
|
|
17
|
+
pause: ["release"],
|
|
18
|
+
read: ["get"],
|
|
19
|
+
remove: ["delete"],
|
|
20
|
+
rm: ["delete"],
|
|
21
|
+
show: ["get"],
|
|
22
|
+
};
|
|
23
|
+
/** Score one command path for a guessed command token; lower is better. */
|
|
24
|
+
export function scoreCommandPathMatch(commandPath, queryToken) {
|
|
25
|
+
const normalizedPath = commandPath.trim().toLowerCase();
|
|
26
|
+
const normalizedToken = queryToken.trim().toLowerCase();
|
|
27
|
+
if (normalizedToken.length === 0)
|
|
28
|
+
return Number.POSITIVE_INFINITY;
|
|
29
|
+
const segments = normalizedPath.split(" ");
|
|
30
|
+
const semanticIndex = COMMAND_SYNONYMS[normalizedToken]?.indexOf(normalizedPath);
|
|
31
|
+
if (semanticIndex !== undefined && semanticIndex >= 0)
|
|
32
|
+
return semanticIndex;
|
|
33
|
+
if (normalizedPath === normalizedToken)
|
|
34
|
+
return 10;
|
|
35
|
+
if (segments.includes(normalizedToken))
|
|
36
|
+
return 11;
|
|
37
|
+
if (segments.some((segment) => segment.startsWith(normalizedToken)))
|
|
38
|
+
return 12;
|
|
39
|
+
const maxDistance = normalizedToken.length >= 5 ? 2 : 1;
|
|
40
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
41
|
+
for (const segment of segments) {
|
|
42
|
+
const distance = levenshteinDistanceWithinLimit(segment, normalizedToken, maxDistance);
|
|
43
|
+
if (distance !== null)
|
|
44
|
+
bestDistance = Math.min(bestDistance, distance);
|
|
45
|
+
}
|
|
46
|
+
if (Number.isFinite(bestDistance))
|
|
47
|
+
return 20 + bestDistance;
|
|
48
|
+
if (normalizedPath.includes(normalizedToken))
|
|
49
|
+
return 30;
|
|
50
|
+
return Number.POSITIVE_INFINITY;
|
|
51
|
+
}
|
|
52
|
+
/** Rank available command paths for one guessed token. */
|
|
53
|
+
export function rankCommandPaths(commandPaths, queryToken) {
|
|
54
|
+
return commandPaths
|
|
55
|
+
.map((path) => ({ path, score: scoreCommandPathMatch(path, queryToken) }))
|
|
56
|
+
.filter((entry) => Number.isFinite(entry.score))
|
|
57
|
+
.sort((left, right) => {
|
|
58
|
+
if (left.score !== right.score)
|
|
59
|
+
return left.score - right.score;
|
|
60
|
+
if (left.path === right.path)
|
|
61
|
+
return 0;
|
|
62
|
+
return left.path < right.path ? -1 : 1;
|
|
63
|
+
})
|
|
64
|
+
.map((entry) => entry.path);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=command-suggestions.js.map
|
|
67
|
+
//# debugId=71e5a870-f62f-5252-b4e9-e1a42e36009f
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/create-option-policy
|
|
3
|
+
*
|
|
4
|
+
* Defines explicit-empty assertions for repeatable create options. A strict
|
|
5
|
+
* schema can require that an agent considers a collection without forcing it
|
|
6
|
+
* to invent an entry: the corresponding `--clear-*` flag is an auditable,
|
|
7
|
+
* truthful answer that the collection is intentionally empty.
|
|
8
|
+
*/
|
|
9
|
+
/** Return the explicit-empty flag for a repeatable create option. */
|
|
10
|
+
export declare function resolveCreateExplicitEmptyFlag(optionKey: string): string | undefined;
|
|
11
|
+
/** Return whether a create option can be satisfied by an explicit empty set. */
|
|
12
|
+
export declare function supportsCreateExplicitEmpty(optionKey: string): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/create-option-policy
|
|
3
|
+
*
|
|
4
|
+
* Defines explicit-empty assertions for repeatable create options. A strict
|
|
5
|
+
* schema can require that an agent considers a collection without forcing it
|
|
6
|
+
* to invent an entry: the corresponding `--clear-*` flag is an auditable,
|
|
7
|
+
* truthful answer that the collection is intentionally empty.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="002f45a2-edc3-5aa0-9af8-d9b1dfecc097")}catch(e){}}();
|
|
11
|
+
const CREATE_REPEATABLE_CLEAR_FLAGS = {
|
|
12
|
+
comment: "--clear-comments",
|
|
13
|
+
dep: "--clear-deps",
|
|
14
|
+
doc: "--clear-docs",
|
|
15
|
+
event: "--clear-events",
|
|
16
|
+
file: "--clear-files",
|
|
17
|
+
learning: "--clear-learnings",
|
|
18
|
+
note: "--clear-notes",
|
|
19
|
+
reminder: "--clear-reminders",
|
|
20
|
+
test: "--clear-tests",
|
|
21
|
+
typeOption: "--clear-type-options",
|
|
22
|
+
};
|
|
23
|
+
/** Return the explicit-empty flag for a repeatable create option. */
|
|
24
|
+
export function resolveCreateExplicitEmptyFlag(optionKey) {
|
|
25
|
+
return CREATE_REPEATABLE_CLEAR_FLAGS[optionKey];
|
|
26
|
+
}
|
|
27
|
+
/** Return whether a create option can be satisfied by an explicit empty set. */
|
|
28
|
+
export function supportsCreateExplicitEmpty(optionKey) {
|
|
29
|
+
return resolveCreateExplicitEmptyFlag(optionKey) !== undefined;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=create-option-policy.js.map
|
|
32
|
+
//# debugId=002f45a2-edc3-5aa0-9af8-d9b1dfecc097
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Result of normalizing one item-addressed invocation. */
|
|
2
|
+
export interface ItemAddressInvocationResult {
|
|
3
|
+
/** Canonical argv with an `--id` value moved into positional-id location. */
|
|
4
|
+
argv: string[];
|
|
5
|
+
/** Whether argv changed. */
|
|
6
|
+
changed: boolean;
|
|
7
|
+
/** Whether both positional and named item ids were supplied. */
|
|
8
|
+
conflict: boolean;
|
|
9
|
+
/** Resolved named item id when one was present. */
|
|
10
|
+
itemId?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Return whether a command participates in the shared item-id alias contract. */
|
|
13
|
+
export declare function supportsItemIdAlias(commandName: string | undefined): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Normalize `pm <command> --id <value>` to the command's positional id form.
|
|
16
|
+
* The transformation is lossless for every other argument and reports a
|
|
17
|
+
* conflict instead of guessing when both forms are present.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeItemAddressInvocation(argv: string[]): ItemAddressInvocationResult;
|