@unbrained/pm-cli 2026.9.30 → 2026.10.2
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 +20 -0
- package/dist/cli/error-guidance.d.ts +5 -0
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-list-query.d.ts +8 -5
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli/register-structured-mutation.d.ts +2 -0
- package/dist/cli/register-structured-mutation.js +1 -1
- package/dist/cli/runtime/projection-retry.d.ts +9 -0
- package/dist/cli/runtime/projection-retry.js +2 -0
- package/dist/cli/runtime/selection.d.ts +5 -1
- package/dist/cli/runtime/selection.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +157 -157
- package/dist/cli-bundle/chunks/{chunk-EGAIIWI3.js → chunk-7FUEQOYG.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-7NL3A2BY.js +2 -0
- package/dist/cli-bundle/chunks/chunk-CZLAWXDR.js +8 -0
- package/dist/cli-bundle/chunks/chunk-HY6M34B4.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-O23CQ5T4.js → chunk-MTJMOI4I.js} +14 -14
- package/dist/cli-bundle/chunks/chunk-R4TUD355.js +6 -0
- package/dist/cli-bundle/chunks/chunk-R7ULWMBG.js +238 -0
- package/dist/cli-bundle/chunks/chunk-SV7CZEVV.js +20 -0
- package/dist/cli-bundle/chunks/chunk-TRYXVQ7W.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-BTCE36JS.js → chunk-WP6NRH72.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XRN3JYNN.js → chunk-XOUBIF6Z.js} +38 -38
- package/dist/cli-bundle/chunks/chunk-Z2GYDSAO.js +3 -0
- package/dist/cli-bundle/chunks/{chunk-6YEET7XI.js → chunk-ZI7F3FVE.js} +47 -47
- package/dist/cli-bundle/chunks/{register-list-query-SYNBVMNG.js → register-list-query-R4PHNB7W.js} +6 -6
- package/dist/cli-bundle/chunks/register-mutation-PDDAUDYV.js +20 -0
- package/dist/cli-bundle/chunks/{register-operations-7FCJUC4Z.js → register-operations-A5HJT46K.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-YTWW2KL5.js → register-setup-EZ2F25JI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MOUCTR72.js → chunk-3BIYG72P.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-T4PZJQG4.js → chunk-4FFPGNCJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AKB3JN57.js → chunk-BLCTBSGT.js} +45 -45
- package/dist/cli-bundle/focused-chunks/{chunk-XUCXRZZZ.js → chunk-DBD4W4QP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KZULQIAG.js → chunk-E754JDLY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-4AORVUT4.js → chunk-EJN7DY3B.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-OMBDUJWZ.js → chunk-FKK2HI3S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-GBD4EN6S.js +12 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZJ3CLTV4.js → chunk-GMYUNHST.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-IR4UXLRP.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-RIJQQOEZ.js → chunk-UTRSM3ZK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EVMH4SKN.js → chunk-VVWYI2X7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-WCY6HRZO.js +30 -0
- package/dist/cli-bundle/focused-chunks/{chunk-XB5Q2P7Z.js → chunk-XRSCIYHR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YC32ZSLS.js +165 -0
- package/dist/cli-bundle/focused-chunks/{chunk-IQBFYQF2.js → chunk-ZIXFMIUL.js} +2 -2
- package/dist/cli-bundle/main.js +22 -22
- 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 +2 -2
- 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 +48 -48
- 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 +7 -7
- package/dist/core/fs/fs-utils.d.ts +11 -0
- package/dist/core/fs/fs-utils.js +2 -2
- package/dist/core/shared/errors.d.ts +9 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/core/store/settings.d.ts +15 -5
- package/dist/core/store/settings.js +3 -3
- package/dist/core/telemetry/runtime.js +3 -3
- package/dist/mcp/server.js +1 -1
- package/dist/sdk/agent/closed-domain-contracts.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
- package/dist/sdk/item-transaction.d.ts +11 -0
- package/dist/sdk/item-transaction.js +1 -1
- package/dist/sdk/merge/install.d.ts +2 -2
- package/dist/sdk/merge/install.js +1 -1
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/query/context.d.ts +2 -0
- package/dist/sdk/query/context.js +1 -1
- package/dist/sdk/query/get.d.ts +19 -15
- package/dist/sdk/query/get.js +1 -1
- package/dist/sdk/query/list.js +1 -1
- package/dist/sdk/query/search-contracts.js +1 -1
- package/dist/sdk/query/search-pagination.d.ts +4 -0
- package/dist/sdk/query/search-pagination.js +1 -1
- package/dist/sdk/query/search.js +1 -1
- package/dist/sdk/read-output/options.d.ts +14 -0
- package/dist/sdk/read-output/options.js +2 -0
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +1 -1
- package/dist/sdk/runtime-primitives.d.ts +2 -2
- package/dist/sdk/runtime-primitives.js +1 -1
- package/dist/sdk/runtime.js +1 -1
- package/dist/sdk/workspace-transaction.d.ts +2 -0
- package/dist/sdk/workspace-transaction.js +2 -2
- package/docs/BOUNDED_CONTEXT_READS.md +10 -7
- package/docs/COMMANDS.md +1 -1
- package/docs/MERGE_SAFETY.md +12 -6
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +27 -0
- package/docs/SDK.md +98 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +2 -2
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +2 -2
- package/plugins/pm-codex/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-6XTJLOKW.js +0 -3
- package/dist/cli-bundle/chunks/chunk-A6NDNRCK.js +0 -6
- package/dist/cli-bundle/chunks/chunk-BNAT4EYR.js +0 -20
- package/dist/cli-bundle/chunks/chunk-BX4LEJX4.js +0 -8
- package/dist/cli-bundle/chunks/chunk-FYTXVVZG.js +0 -2
- package/dist/cli-bundle/chunks/chunk-UIAH7UFK.js +0 -238
- package/dist/cli-bundle/chunks/chunk-USTAFHIM.js +0 -2
- package/dist/cli-bundle/chunks/chunk-YM342ELM.js +0 -3
- package/dist/cli-bundle/chunks/register-mutation-4GSUK23D.js +0 -20
- package/dist/cli-bundle/focused-chunks/chunk-3CAZ7Z4R.js +0 -30
- package/dist/cli-bundle/focused-chunks/chunk-EFD4ATS7.js +0 -12
- package/dist/cli-bundle/focused-chunks/chunk-IDB6E3ZV.js +0 -165
- package/dist/cli-bundle/focused-chunks/chunk-UPOMLSW7.js +0 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(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]="
|
|
1
|
+
!(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]="19b15a00-6395-566f-9b09-4aeb4084c10c")}catch(e2){}})();import{createStdinTokenResolver,EXIT_CODE,PmCliError,readSettings,resolveAuthor,resolvePmRoot}from"../sdk/runtime-primitives.js";import{buildItemCompletionMutations,commitItemCompletion,commitItemMutations,previewItemMutations}from"../sdk/item-transaction.js";import{runReopen}from"../sdk/lifecycle/reopen.js";import{parseAtomicMutationControls,resolveItemMutationDocument}from"../sdk/structured-mutations.js";import{collect,getGlobalOptions,invalidateSearchCachesForMutation,printResult}from"./registration-helpers.js";async function runItemReopenAction(id,reason,options,command){const globalOptions=getGlobalOptions(command);const result=await runReopen(id,reason,{status:typeof options.status==="string"?options.status:void 0,author:typeof options.author==="string"?options.author:globalOptions.author,message:typeof options.message==="string"?options.message:void 0,force:options.force===true},globalOptions);await invalidateSearchCachesForMutation(globalOptions,result);printResult(result,globalOptions)}async function runItemMutateAction(options,command){const globalOptions=getGlobalOptions(command);const input=await createStdinTokenResolver().resolveValue("-","--stdin-json");if(input===void 0||input.trim().length===0){throw new PmCliError("pm item mutate requires a non-empty JSON batch on stdin.",EXIT_CODE.USAGE)}const transactionId=typeof options.transactionId==="string"?options.transactionId.trim():"";if(transactionId.length===0){throw new PmCliError("pm item mutate requires --transaction-id <value>.",EXIT_CODE.USAGE)}const pmRoot=resolvePmRoot(process.cwd(),globalOptions.path);const settings=await readSettings(pmRoot);const resolved=resolveItemMutationDocument(input,{transactionId,idPrefix:settings.id_prefix});const{mutations,references}=resolved;const controls=parseAtomicMutationControls(options);const author=resolveAuthor(typeof options.author==="string"?options.author:globalOptions.author,settings.author_default);if(options.dryRun===true){const validation=await previewItemMutations({pmRoot,transactionId,author,mutations});printResult({transaction_id:transactionId,dry_run:true,validation,mutation_count:mutations.length,mutations,references},globalOptions);return}const result=await commitItemMutations({pmRoot,transactionId,author,mutations,...controls});printResult({...result,mutation_count:mutations.length,references},globalOptions)}function resolveCompletionReason(positionalReason,optionReason){if(typeof positionalReason==="string"&&positionalReason.trim().length>0){return positionalReason.trim()}return typeof optionReason==="string"?optionReason.trim():""}async function runItemCompleteAction(id,positionalReason,options,command){const globalOptions=getGlobalOptions(command);const transactionId=typeof options.transactionId==="string"?options.transactionId.trim():"";if(transactionId.length===0){throw new PmCliError("pm item complete requires --transaction-id <value>.",EXIT_CODE.USAGE)}const reason=resolveCompletionReason(positionalReason,options.reason);if(reason.length===0){throw new PmCliError("pm item complete requires a close reason.",EXIT_CODE.USAGE)}const evidenceKeys=["file","doc","test","comment","note","learning"];const evidence=Object.fromEntries(evidenceKeys.filter(key=>options[key]!==void 0).map(key=>[key,options[key]]));const force=options.force===true;const{lockTtlSeconds,lockWaitMs}=parseAtomicMutationControls(options);const closeOptions={...typeof options.resolution==="string"?{resolution:options.resolution}:{},...typeof options.expectedResult==="string"?{expectedResult:options.expectedResult}:{},...typeof options.actualResult==="string"?{actualResult:options.actualResult}:{},...typeof options.completedAt==="string"?{completedAt:options.completedAt}:{},...typeof options.validateClose==="string"?{validateClose:options.validateClose}:{},...force?{force:true}:{}};const completion={id,reason,...Object.keys(evidence).length===0?{}:{evidence},...Object.keys(closeOptions).length===0?{}:{closeOptions},...force?{releaseOptions:{force:true}}:{}};const pmRoot=resolvePmRoot(process.cwd(),globalOptions.path);const author=resolveAuthor(typeof options.author==="string"?options.author:globalOptions.author,(await readSettings(pmRoot)).author_default);if(options.dryRun===true){const mutations=buildItemCompletionMutations(completion);const validation=await previewItemMutations({pmRoot,transactionId,author,mutations});printResult({transaction_id:transactionId,dry_run:true,validation,mutation_count:mutations.length,mutations},globalOptions);return}const result=await commitItemCompletion({pmRoot,transactionId,author,...completion,lockTtlSeconds,lockWaitMs});printResult({...result,mutation_count:Object.keys(result.results).length},globalOptions)}function registerStructuredMutationCommands(program){const itemCommand=program.commands.find(command=>command.name()==="item")??program.command("item").description("Run item lifecycle operations.");itemCommand.command("reopen <id> <reason>").option("--status <value>","Active target status: open or in_progress").option("--message <value>","Human-readable recurrence history message").option("--force","Override ownership or stale-lock conflicts").option("--author <value>","Mutation author").description("Reopen terminal work with recurrence evidence.").action(runItemReopenAction);itemCommand.command("mutate").requiredOption("--transaction-id <value>","Stable idempotency key used to resume an interrupted batch").option("--stdin-json","Read the JSON mutation array from stdin",true).option("--dry-run","Validate and preview the batch without writing").option("--create-compensation <mode>","Created-item compensation policy: close or delete","close").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--author <value>","Mutation author").description("Apply SDK-backed mutations atomically.").action(runItemMutateAction);itemCommand.command("complete <id> [reason]").requiredOption("--transaction-id <value>","Stable idempotency key for the composed completion").option("--reason <value>","Close reason when omitted positionally").option("--file <value>","Linked file evidence",collect).option("--doc <value>","Linked documentation evidence",collect).option("--test <value>","Linked test evidence",collect).option("--comment <value>","Evidence comment",collect).option("--note <value>","Completion note",collect).option("--learning <value>","Durable completion learning",collect).option("--resolution <value>","Structured resolution evidence").option("--expected-result <value>","Expected result evidence").option("--actual-result <value>","Actual result evidence").option("--completed-at <value>","Actual completion time").option("--validate-close <mode>","Close validation: off, warn, or strict").option("--lock-ttl-seconds <n>","Workspace transaction lock lifetime in seconds").option("--lock-wait-ms <n>","Maximum time to wait for the workspace transaction lock").option("--dry-run","Validate and preview completion without writing").option("--force","Override lifecycle and ownership conflicts").option("--author <value>","Completion author").description("Close with evidence and release the claim.").action(runItemCompleteAction)}const structuredMutationTestOnly={runItemCompleteAction,runItemMutateAction,runItemReopenAction};export{registerStructuredMutationCommands,structuredMutationTestOnly};
|
|
2
2
|
//# sourceMappingURL=register-structured-mutation.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module cli/runtime/projection-retry
|
|
3
|
+
*
|
|
4
|
+
* Repairs read projections as minimal edits to the original invocation, keeping
|
|
5
|
+
* tracker scope, operands, output encoding and unrelated controls intact.
|
|
6
|
+
*/
|
|
7
|
+
import type { PmCliErrorRecoveryPayload } from "../../sdk/runtime-primitives.js";
|
|
8
|
+
/** Preserve the original read invocation when correcting known projection refusals. */
|
|
9
|
+
export declare function repairProjectionRecovery(argv: readonly string[], code: string | undefined, recovery: PmCliErrorRecoveryPayload | undefined): PmCliErrorRecoveryPayload | undefined;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!(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]="bdbd1281-8294-5bda-8053-f9fff4c34bf3")}catch(e2){}})();import{parseBootstrapCommandName}from"../../sdk/cli-bootstrap.js";import{LIST_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS}from"../../sdk/cli-contracts/commander-types.js";import{GLOBAL_FLAG_CONTRACTS,resolveSubcommandFlagContractsForCommand}from"../../sdk/cli-contracts/flag-contracts.js";import{renderPmCommand}from"../argv-utils.js";const VALUE_PROJECTION_FLAGS=new Set(["--fields","--depth","--for","--token-budget"]);const BOOLEAN_PROJECTION_FLAGS=new Set(["--full","--brief","--compact"]);function consumesFlagValue(contract,valueFlags){return Boolean(contract.flag==="--pm-path"||contract.value_name||contract.list||contract.value_type==="number"||contract.value_type==="string"||valueFlags.has(contract.flag))}function projectionOptionIndices(argv){const contracts=resolveSubcommandFlagContractsForCommand(parseBootstrapCommandName([...argv]));const valueFlags=new Set([...LIST_COMMANDER_STRING_OPTION_CONTRACTS,...SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,...CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS].flatMap(contract=>contract.keys.map(key=>`--${key.replace(/[A-Z]/g,letter=>`-${letter.toLowerCase()}`)}`)));const canonical=new Map([...GLOBAL_FLAG_CONTRACTS,...contracts].flatMap(contract=>[contract.flag,...contract.aliases??[]].map(flag=>[flag,contract.flag])));const known=new Map([...GLOBAL_FLAG_CONTRACTS,...contracts].flatMap(contract=>[contract.flag,...contract.aliases??[]].map(flag=>[flag,consumesFlagValue(contract,valueFlags)])));for(const flag of VALUE_PROJECTION_FLAGS)known.set(flag,true);for(const flag of BOOLEAN_PROJECTION_FLAGS)known.set(flag,false);const options=new Map;for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--")break;if(!token.startsWith("-"))continue;const flag=token.split("=")[0];if(!known.has(flag)&&!token.includes("="))return void 0;options.set(index,canonical.get(flag)??flag);if(known.get(flag)&&!token.includes("="))index+=1}return options}function withoutProjectionFlags(argv,options,flags){const removed=new Set;for(const[index,flag]of options){if(!flags.has(flag))continue;removed.add(index);if(VALUE_PROJECTION_FLAGS.has(flag)&&!argv[index].includes("="))removed.add(index+1)}return argv.filter((_,index)=>!removed.has(index))}function withProjectionFlags(argv,additions,position){argv.splice(position,0,...additions);return argv}function selectProjectionRetryMode(options,suggested){const fallback=suggested.find(token=>BOOLEAN_PROJECTION_FLAGS.has(token));if(fallback===void 0)return void 0;const selected=[...new Set(options.values())].filter(flag=>BOOLEAN_PROJECTION_FLAGS.has(flag));return selected.length===1?selected[0]:fallback}function repairProjectionRecovery(argv,code,recovery){if(!recovery||!["unknown_field_projection","projection_options_mutually_exclusive"].includes(code??""))return recovery;const suggested=recovery.suggested_retry_args;const ambiguous={...recovery,suggested_retry:void 0,suggested_retry_args:void 0};if(!suggested)return ambiguous;const options=projectionOptionIndices(argv);if(!options)return ambiguous;let corrected;if(code==="unknown_field_projection"){const fieldIndex=suggested.indexOf("--fields");if(fieldIndex<0||suggested[fieldIndex+1]===void 0)return ambiguous;const position=[...options].find(([_,flag])=>flag==="--fields")?.[0]??-1;if(position<0)return ambiguous;corrected=withProjectionFlags(withoutProjectionFlags(argv,options,new Set(["--fields"])),["--fields",suggested[fieldIndex+1]],position)}else{const mode=selectProjectionRetryMode(options,suggested);if(mode===void 0)return ambiguous;const flags=new Set([...VALUE_PROJECTION_FLAGS,...BOOLEAN_PROJECTION_FLAGS]);const position=[...options].find(([_,flag])=>flags.has(flag))?.[0]??-1;if(position<0)return ambiguous;corrected=withProjectionFlags(withoutProjectionFlags(argv,options,flags),[mode],position)}return{...recovery,suggested_retry:renderPmCommand(corrected),suggested_retry_args:corrected}}export{repairProjectionRecovery};
|
|
2
|
+
//# sourceMappingURL=projection-retry.js.map
|
|
@@ -6,6 +6,10 @@ import { Command } from "commander";
|
|
|
6
6
|
import { normalizeBootstrapInvocation } from "../bootstrap-args.js";
|
|
7
7
|
/** Recognize the read-only package inventory before extension bootstrap. */
|
|
8
8
|
declare function isStaticExtensionInventoryInvocation(invocationArgv: string[]): boolean;
|
|
9
|
+
/** Protect literal preview candidates in the item namespace until the real parser settles the selected action; host-owned global grammar also captures the tracker roots. */
|
|
10
|
+
declare function resolveStructuredMutationPreviewInvocation(invocationArgv: string[]): {
|
|
11
|
+
path: string | undefined;
|
|
12
|
+
} | undefined;
|
|
9
13
|
/** Core read command names used to select the list/query registration family. */
|
|
10
14
|
declare const LIST_QUERY_COMMAND_NAMES: Set<string>;
|
|
11
15
|
/** Registration-family switches computed from one CLI invocation. */
|
|
@@ -28,4 +32,4 @@ declare function shouldRegisterDynamicExtensionPaths(_rootProgram: Command, invo
|
|
|
28
32
|
declare function shouldRegisterRuntimeSchemaFlags(invocationArgv: string[]): boolean;
|
|
29
33
|
/** Refuse unknown flags with correction guidance while requiring an explicit retry for mutations. */
|
|
30
34
|
declare function enforceExplicitRetryForFlagTypos(bootstrapInvocation: ReturnType<typeof normalizeBootstrapInvocation>): void;
|
|
31
|
-
export { CoreCommandRegistrationSelection, LIST_QUERY_COMMAND_NAMES, enforceExplicitRetryForFlagTypos, invocationRequestsVersion, isStaticExtensionInventoryInvocation, resolveCoreCommandRegistrationSelection, shouldAttachRichHelpTextForInvocation, shouldRegisterDynamicExtensionPaths, shouldRegisterRuntimeSchemaFlags };
|
|
35
|
+
export { CoreCommandRegistrationSelection, LIST_QUERY_COMMAND_NAMES, enforceExplicitRetryForFlagTypos, invocationRequestsVersion, isStaticExtensionInventoryInvocation, resolveStructuredMutationPreviewInvocation, resolveCoreCommandRegistrationSelection, shouldAttachRichHelpTextForInvocation, shouldRegisterDynamicExtensionPaths, shouldRegisterRuntimeSchemaFlags };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!(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]="
|
|
1
|
+
!(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]="47557320-4bb4-5120-82db-a0b98af6ccf3")}catch(e2){}})();import{Command}from"commander";import{PM_RELOCATED_COMMAND_ALIASES,findPmNamespacedCommand}from"../../sdk/cli-contracts/command-aliases.js";import{GLOBAL_FLAG_CONTRACTS}from"../../sdk/cli-contracts/flag-contracts.js";import{EXIT_CODE,PmCliError}from"../../sdk/runtime-primitives.js";import{redactSensitiveCommandArgs,renderPmCommand}from"../argv-utils.js";import{parseBootstrapCommandName,parseBootstrapHelpRequest,stripGlobalBootstrapTokens}from"../bootstrap-args.js";import{isFullHelpDiscovery}from"../help-content.js";const VERSION_FLAG_TOKENS=new Set(["--version","-V"]);function isStaticExtensionInventoryInvocation(invocationArgv){const tokens=stripGlobalBootstrapTokens(invocationArgv);return["package","packages","extension"].includes(tokens[0]??"")&&tokens[1]==="inventory"}function resolveStructuredMutationPreviewInvocation(invocationArgv){const tokens=stripGlobalBootstrapTokens(invocationArgv);if(tokens[0]!=="item"||!invocationArgv.includes("--dry-run"))return void 0;const probe=new Command().configureOutput({writeErr:()=>{}}).exitOverride();const registered=new Set;for(const contract of GLOBAL_FLAG_CONTRACTS){for(const flag of[contract.flag,contract.short,...contract.aliases??[]]){if(flag===void 0||registered.has(flag))continue;registered.add(flag);const takesValue=contract.value_name!==void 0||contract.flag==="--pm-path";probe.option(`${flag}${takesValue?" <value>":""}`)}}try{probe.parseOptions(invocationArgv)}catch{}const options=probe.opts();return{path:options.pmPath??options.path}}const SETUP_COMMAND_NAMES=new Set(["config","extension","init","install","package","packages","templates","upgrade"]);const LIST_QUERY_COMMAND_NAMES=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]);const MUTATION_COMMAND_NAMES=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]);const OPERATION_COMMAND_NAMES=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]);const MUTATING_OPERATION_COMMAND_NAMES=new Set(["claim","close-task","pause-task","release","start-task","test"]);const REGISTER_ALL_CORE_COMMAND_FAMILIES={setup:true,listQuery:true,mutation:true,operation:true};const RUNTIME_SCHEMA_FLAG_BOOTSTRAP_COMMANDS=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function invocationRequestsVersion(invocationArgv){return invocationArgv.some(token=>VERSION_FLAG_TOKENS.has(token))}function resolveCoreCommandRegistrationSelection(invocationArgv){if(invocationRequestsVersion(invocationArgv)){return{setup:false,listQuery:false,mutation:false,operation:false}}if(invocationArgv.length===0||parseBootstrapHelpRequest(invocationArgv).requested){return REGISTER_ALL_CORE_COMMAND_FAMILIES}const commandName=parseBootstrapCommandName(invocationArgv);if(!commandName){return REGISTER_ALL_CORE_COMMAND_FAMILIES}const normalizedCommand=commandName.trim().toLowerCase();const commandTokens=stripGlobalBootstrapTokens(invocationArgv);const semanticCommand=findPmNamespacedCommand(commandTokens)?.alias;if(PM_RELOCATED_COMMAND_ALIASES.some(alias=>alias.alias===semanticCommand)){return{...REGISTER_ALL_CORE_COMMAND_FAMILIES,targetCommandName:semanticCommand}}if(SETUP_COMMAND_NAMES.has(normalizedCommand)){return{setup:true,listQuery:false,mutation:false,operation:false,targetCommandName:normalizedCommand}}if(LIST_QUERY_COMMAND_NAMES.has(normalizedCommand)){return{setup:false,listQuery:true,mutation:false,operation:false,targetCommandName:normalizedCommand}}if(MUTATION_COMMAND_NAMES.has(normalizedCommand)){return{setup:false,listQuery:false,mutation:true,operation:false,targetCommandName:normalizedCommand}}if(OPERATION_COMMAND_NAMES.has(normalizedCommand)){return{setup:false,listQuery:false,mutation:false,operation:true,targetCommandName:normalizedCommand}}return REGISTER_ALL_CORE_COMMAND_FAMILIES}function shouldAttachRichHelpTextForInvocation(invocationArgv){return invocationArgv.length===0||parseBootstrapHelpRequest(invocationArgv).requested||invocationArgv.includes("--explain")&&parseBootstrapCommandName(invocationArgv)===void 0}function shouldRegisterDynamicExtensionPaths(_rootProgram,invocationArgv){if(isStaticExtensionInventoryInvocation(invocationArgv)){return false}if(invocationRequestsVersion(invocationArgv)){return false}if(isFullHelpDiscovery(invocationArgv)){return true}const helpRequest=parseBootstrapHelpRequest(invocationArgv);if(helpRequest.requested){return true}const commandName=parseBootstrapCommandName(invocationArgv);if(!commandName){return false}return true}function shouldRegisterRuntimeSchemaFlags(invocationArgv){if(invocationRequestsVersion(invocationArgv)){return false}const commandName=parseBootstrapCommandName(invocationArgv);if(!commandName){return false}return RUNTIME_SCHEMA_FLAG_BOOTSTRAP_COMMANDS.has(commandName)}function redactSensitiveFlagTypo(params){const rawTypoToken=String(params.rawFrom??"");const rawTypoEqualsIndex=rawTypoToken.indexOf("=");const rawTypoFlag=rawTypoEqualsIndex>=0?rawTypoToken.slice(0,rawTypoEqualsIndex):rawTypoToken;const sensitiveCanonicalFlag=params.normalizedTokens.map(token=>{const equalsIndex=token.indexOf("=");return equalsIndex>=0?token.slice(0,equalsIndex):token}).find(token=>token==="--literal"||token==="--regex"||token==="--replacement");const typoNormalizedArgv=sensitiveCanonicalFlag?params.argv.map(token=>{const equalsIndex=token.indexOf("=");const flag=equalsIndex>=0?token.slice(0,equalsIndex):token;return flag===rawTypoFlag?equalsIndex>=0?`${sensitiveCanonicalFlag}${token.slice(equalsIndex)}`:sensitiveCanonicalFlag:token}):params.argv;const safeArgv=redactSensitiveCommandArgs(typoNormalizedArgv);const safeTypoDisplay=sensitiveCanonicalFlag&&rawTypoEqualsIndex>=0?`${rawTypoFlag}=[redacted]`:rawTypoToken;const safeNormalizedDisplay=sensitiveCanonicalFlag&¶ms.normalizedDisplay.includes("=")?`${sensitiveCanonicalFlag}=[redacted]`:params.normalizedDisplay;return{argv:safeArgv,normalizedDisplay:safeNormalizedDisplay,sourceDisplay:safeTypoDisplay}}function enforceExplicitRetryForFlagTypos(bootstrapInvocation){const commandName=bootstrapInvocation.commandName;if(!commandName){return}const typoEvent=bootstrapInvocation.trace.find(entry=>entry.reason==="flag_typo");if(!typoEvent){return}const normalizedTokens=Array.isArray(typoEvent.to)?typoEvent.to:[String(typoEvent.to??"")].filter(entry=>entry.length>0);const normalizedDisplay=normalizedTokens.length>0?normalizedTokens.join(" "):"the canonical flag";const mutatingCommand=MUTATION_COMMAND_NAMES.has(commandName)||MUTATING_OPERATION_COMMAND_NAMES.has(commandName);const code=mutatingCommand?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry";const commandScope=mutatingCommand?"mutating option":"option";const safeTypo=redactSensitiveFlagTypo({argv:bootstrapInvocation.argv,normalizedDisplay,normalizedTokens,rawFrom:typoEvent.from});throw new PmCliError(`Refusing to auto-correct ${commandScope} ${safeTypo.sourceDisplay} to ${safeTypo.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,EXIT_CODE.USAGE,{code,examples:[renderPmCommand(safeTypo.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:safeTypo.argv,suggested_retry:renderPmCommand(safeTypo.argv)}})}export{LIST_QUERY_COMMAND_NAMES,enforceExplicitRetryForFlagTypos,invocationRequestsVersion,isStaticExtensionInventoryInvocation,resolveCoreCommandRegistrationSelection,resolveStructuredMutationPreviewInvocation,shouldAttachRichHelpTextForInvocation,shouldRegisterDynamicExtensionPaths,shouldRegisterRuntimeSchemaFlags};
|
|
2
2
|
//# sourceMappingURL=selection.js.map
|