@unbrained/pm-cli 2026.9.12 → 2026.9.13
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/command-namespaces.js +1 -1
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +151 -151
- package/dist/cli-bundle/chunks/{chunk-2JAY4LFI.js → chunk-3DWX3CKN.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-6KHYW3FH.js +235 -0
- package/dist/cli-bundle/chunks/chunk-AKTBOX6U.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-X6POOZKD.js → chunk-GBK5MV6N.js} +29 -29
- package/dist/cli-bundle/chunks/{chunk-I6VQUHK6.js → chunk-GQQR6JAL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3ZJDGTYC.js → chunk-KM4XVZR7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TAGDYARO.js → chunk-LA44JECQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-67H4PKQ5.js → chunk-XEZOGC3P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YU75JRTW.js → chunk-XM7RWQLM.js} +43 -43
- package/dist/cli-bundle/chunks/{chunk-GKY655T7.js → chunk-YDSV4QIQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7KF6HCRC.js → chunk-YQTJACN5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7H33WPDF.js → chunk-ZZI7IHMM.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-KEZPDR6X.js → register-list-query-WMJTBWNW.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-HEXA3ZDM.js → register-mutation-EXGOXP3D.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-TEZT65JF.js → register-operations-2H4CDRGU.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-IIL74WUG.js → register-setup-NYBWGPOS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BIOWOU6S.js → chunk-7JR6M2JR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PERRTPIY.js → chunk-B6JAANOH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KK7KSXUP.js → chunk-DSJYL4VP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2BQ4JSJQ.js → chunk-F66QJWI4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LWJBBM6X.js → chunk-FBCLVOBE.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IURELABV.js → chunk-FPNI4U2B.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5PSYV3AT.js → chunk-KP3N6PVZ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MFVABYEU.js → chunk-LQ67C7ZO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TTRB47KM.js → chunk-OENAWWP4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7EKXAUKF.js → chunk-SDQCJF4H.js} +53 -53
- package/dist/cli-bundle/focused-chunks/{chunk-YNBACVQ2.js → chunk-TUHRUFID.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EIXGDI77.js → chunk-V7PSTKHD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SDQOOL34.js → chunk-XCCM7P7V.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YUXBHIUV.js +20 -0
- package/dist/cli-bundle/focused-chunks/{chunk-5CRND7UA.js → chunk-ZAMG7HBB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZF5PXK6A.js +2 -0
- package/dist/cli-bundle/main.js +20 -20
- 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 +28 -28
- 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 +42 -42
- 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 +6 -6
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/telemetry/consent.d.ts +1 -1
- package/dist/core/telemetry/consent.js +2 -2
- package/dist/core/telemetry/policy.d.ts +10 -0
- package/dist/core/telemetry/policy.js +2 -0
- package/dist/core/telemetry/runtime.d.ts +11 -9
- package/dist/core/telemetry/runtime.js +3 -3
- package/dist/sdk/agent/command-suggestions.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +1 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
- package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
- package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
- package/dist/sdk/completion.js +1 -1
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/telemetry.d.ts +5 -0
- package/dist/sdk/telemetry.js +1 -1
- package/docs/CLI_GRAMMAR.md +31 -0
- package/docs/COMMAND_NAMESPACES.md +7 -4
- package/docs/CONFIGURATION.md +13 -2
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +4 -4
- package/docs/generated/AGENT_COMMAND_SURFACE.md +10 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +11 -1
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +2 -2
- 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/extensions/guide-shell/index.ts +13 -26
- 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/dist/cli-bundle/chunks/chunk-DEGRLB6Y.js +0 -235
- package/dist/cli-bundle/chunks/chunk-PTX2JRFR.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-GAKFECOQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-VWMP6W7Y.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]="17b52e35-0115-5736-adf5-5adaa8c40cad")}catch(e2){}})();import{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,renderPmCommandAliasMigrationHint,resolvePmCommandAlias}from"./cli-contracts/command-aliases.js";import{resolveSubcommandFlagContractsForCommand}from"./cli-contracts/flag-contracts.js";import{levenshteinDistanceWithinLimit}from"../core/shared/levenshtein.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{findPmNamespacedCommand}from"./cli-contracts/command-aliases.js";import{normalizeItemAddressInvocation}from"./agent/item-addressing.js";import{BOOTSTRAP_BOOLEAN_FLAGS,GLOBAL_VALUE_CONSUMING_FLAGS,consumesBootstrapValue,findBootstrapCommandTokenIndex as findContractBootstrapCommandTokenIndex,isInlineGlobalValueToken,parseBootstrapCommandName as parseContractBootstrapCommandName}from"./cli-contracts/bootstrap-command-scanner.js";const OUTPUT_VALUE_FLAGS=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]);function consumeBootstrapGlobalToken(argv,index,state){const token=argv[index];if(BOOTSTRAP_BOOLEAN_FLAGS.has(token)){state.booleanFlags.add(token);return 1}const equalsIndex=token.indexOf("=");const canonicalFlag=equalsIndex>0?token.slice(0,equalsIndex):token;if(!GLOBAL_VALUE_CONSUMING_FLAGS.has(canonicalFlag))return 1;const inlineValue=equalsIndex>0?token.slice(equalsIndex+1):void 0;const consumesValue=inlineValue===void 0&&consumesBootstrapValue(canonicalFlag,argv[index+1]);const value=inlineValue??(consumesValue?argv[index+1]:void 0);if(canonicalFlag==="--author"){state.author=value??""}else if(typeof value==="string"&&value.length>0){const target=OUTPUT_VALUE_FLAGS.has(canonicalFlag)?state.outputValues:state.pathValues;target.set(canonicalFlag,value)}return consumesValue?2:1}function parseBootstrapGlobalOptions(argv){const state={booleanFlags:new Set,outputValues:new Map,pathValues:new Map};let index=0;while(index<argv.length){if(argv[index]==="--")break;index+=consumeBootstrapGlobalToken(argv,index,state)}return{path:state.pathValues.get("--pm-path")??state.pathValues.get("--path"),noExtensions:state.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(parseBootstrapCommandPathName(argv)??""),noPager:state.booleanFlags.has("--no-pager"),json:state.booleanFlags.has("--json"),quiet:state.booleanFlags.has("--quiet"),lean:state.booleanFlags.has("--lean"),tokenAccounting:state.booleanFlags.has("--token-accounting"),...state.booleanFlags.has("--output-row-contract")?{outputRowContract:true}:{},...state.outputValues.get("--output-include")===void 0?{}:{outputInclude:state.outputValues.get("--output-include")},...state.outputValues.get("--output-limit")===void 0?{}:{outputLimit:state.outputValues.get("--output-limit")},...state.outputValues.get("--output-budget")===void 0?{}:{outputBudget:state.outputValues.get("--output-budget")},...state.outputValues.get("--output-format")==="toon"||state.outputValues.get("--output-format")==="json"?{outputFormat:state.outputValues.get("--output-format")}:{},...state.outputValues.get("--output-session")===void 0?{}:{outputSession:state.outputValues.get("--output-session")},...state.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:state.outputValues.get("--output-cursor")},...state.author===""?{authorMissingValue:true}:state.author!==void 0?{author:state.author}:{}}}function stripGlobalBootstrapTokens(argv){const remaining=[];let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){break}if(BOOTSTRAP_BOOLEAN_FLAGS.has(token)||token==="--profile"||token==="--id-only"||token==="--full-changed-fields"||token==="--explain"){index+=1;continue}if(GLOBAL_VALUE_CONSUMING_FLAGS.has(token)){index+=consumesBootstrapValue(token,argv[index+1])?2:1;continue}if(isInlineGlobalValueToken(token)){index+=1;continue}remaining.push(token);index+=1}return remaining}function parseBootstrapHelpRequest(argv){const stripped=stripGlobalBootstrapTokens(argv);const first=stripped[0]?.trim().toLowerCase();if(first==="help"){const commandPathTokens2=[];for(let index=1;index<stripped.length;index+=1){const token=stripped[index];if(token.startsWith("-")){break}commandPathTokens2.push(token.trim().toLowerCase())}return{requested:true,commandPathTokens:commandPathTokens2}}const helpFlagIndex=stripped.findIndex(token=>token==="--help"||token==="-h");if(helpFlagIndex<0){return{requested:false,commandPathTokens:[]}}const commandPathTokens=[];for(const token of stripped){if(token.startsWith("-")){break}commandPathTokens.push(token.trim().toLowerCase())}return{requested:true,commandPathTokens}}function findBootstrapCommandTokenIndex(argv){return findContractBootstrapCommandTokenIndex(argv)}function parseBootstrapCommandName(argv){return parseContractBootstrapCommandName(argv)}function shouldDisablePagerForInvocation(argv,bootstrapGlobal){if(bootstrapGlobal.noPager){return true}if(process.stdout.isTTY===true){return false}const helpRequest=parseBootstrapHelpRequest(argv);return helpRequest.requested}function applyBootstrapPagerPolicy(argv){const pagerEnvironmentKeys=["PAGER","MANPAGER","GIT_PAGER","LESS"];const previousValues=pagerEnvironmentKeys.map(key=>process.env[key]);const restore=()=>{for(const[index,key]of pagerEnvironmentKeys.entries()){const value=previousValues[index];if(value===void 0){delete process.env[key]}else{process.env[key]=value}}};const bootstrapGlobal=parseBootstrapGlobalOptions(argv);if(!shouldDisablePagerForInvocation(argv,bootstrapGlobal)){return restore}process.env.PAGER="cat";process.env.MANPAGER="cat";process.env.GIT_PAGER="cat";if(typeof process.env.LESS!=="string"||process.env.LESS.trim().length===0){process.env.LESS="FRX"}return restore}const EXTENSION_ACTION_SYNTAX_TOKENS=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function normalizeLegacyExtensionActionSyntax(argv){const extensionIndex=findBootstrapCommandTokenIndex(argv);if(extensionIndex===void 0||argv[extensionIndex]!=="extension"){return[...argv]}const actionToken=argv[extensionIndex+1];if(!actionToken||actionToken.startsWith("-")){return[...argv]}if(!EXTENSION_ACTION_SYNTAX_TOKENS.has(actionToken)){return[...argv]}if(argv.includes("--help")||argv.includes("-h")){return[...argv]}const forcedActionFlag=`--${actionToken}`;if(argv.includes(forcedActionFlag)){return[...argv]}return[...argv.slice(0,extensionIndex+1),forcedActionFlag,...argv.slice(extensionIndex+2)]}const CLI_EXECUTABLE_ALIASES=new Set(["pm","pm-cli"]);function stripLeadingExecutableAlias(argv,trace){const index=findBootstrapCommandTokenIndex(argv);if(index===void 0){return argv}const token=argv[index];if(!CLI_EXECUTABLE_ALIASES.has(token.trim().toLowerCase())){return argv}trace.push({from:token,to:[],reason:"executable_alias",confidence:"high"});return[...argv.slice(0,index),...argv.slice(index+1)]}function rewriteCommandAlias(argv,trace){let index=findBootstrapCommandTokenIndex(argv);if(index!==void 0&&argv[index]==="help"){const offset=findBootstrapCommandTokenIndex(argv.slice(index+1));index=offset===void 0?void 0:index+1+offset}if(index===void 0){return argv}const token=argv[index];const canonical=EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];if(!canonical){return argv}const canonicalTokens=canonical.split(" ");const rewritten=[...argv.slice(0,index),...canonicalTokens,...argv.slice(index+1)];trace.push({from:token,to:canonicalTokens,reason:"command_alias",confidence:"high"});return rewritten}function normalizeFlagKeyToken(raw){const withoutPrefix=raw.replace(/^--?/,"");return withoutPrefix.replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function toComparableFlagKey(raw){return normalizeFlagKeyToken(raw).replace(/-/g,"")}function markUnambiguousFlag(map,key,canonicalFlag){const existing=map.get(key);if(existing===void 0){map.set(key,canonicalFlag);return}if(existing!==canonicalFlag){map.set(key,null)}}function collectLongFlagCandidates(contract){const candidates=[];const pushLongFlag=value=>{if(typeof value!=="string"){return}if(!value.startsWith("--")){return}candidates.push(value)};pushLongFlag(contract.flag);for(const alias of contract.aliases??[]){pushLongFlag(alias)}return candidates}function buildFlagLookup(commandName,contractsOverride){const contracts=contractsOverride??resolveSubcommandFlagContractsForCommand(commandName);const canonicalByNormalized=new Map;const canonicalByCompact=new Map;const canonicalComparablesMap=new Map;const listCanonicalFlags=new Set;for(const contract of contracts){const longCandidates=collectLongFlagCandidates(contract);if(longCandidates.length===0){continue}const canonicalFlag=`--${normalizeFlagKeyToken(longCandidates[0])}`;for(const candidate of longCandidates){markUnambiguousFlag(canonicalByNormalized,normalizeFlagKeyToken(candidate),canonicalFlag);markUnambiguousFlag(canonicalByCompact,toComparableFlagKey(candidate),canonicalFlag)}const comparable=toComparableFlagKey(canonicalFlag);if(!canonicalComparablesMap.has(canonicalFlag)){canonicalComparablesMap.set(canonicalFlag,comparable)}if(contract.list===true){listCanonicalFlags.add(canonicalFlag)}}return{canonicalByNormalized,canonicalByCompact,canonicalComparables:[...canonicalComparablesMap.entries()].map(([canonicalFlag,comparable])=>({canonicalFlag,comparable})),listCanonicalFlags}}function resolveCanonicalFlag(rawKey,lookup){const normalizedKey=normalizeFlagKeyToken(rawKey);const direct=lookup.canonicalByNormalized.get(normalizedKey);if(typeof direct==="string"){return{flag:direct,reason:"flag_alias",confidence:"high"}}const comparableKey=normalizedKey.replace(/-/g,"");const compactMatch=lookup.canonicalByCompact.get(comparableKey);if(typeof compactMatch==="string"){return{flag:compactMatch,reason:"flag_alias",confidence:"high"}}const maxDistance=comparableKey.length>=8?2:1;let bestDistance=Number.POSITIVE_INFINITY;let bestFlag;let tied=false;for(const candidate of lookup.canonicalComparables){const distance=levenshteinDistanceWithinLimit(comparableKey,candidate.comparable,maxDistance);if(distance===null){continue}if(distance<bestDistance){bestDistance=distance;bestFlag=candidate.canonicalFlag;tied=false;continue}if(distance===bestDistance&&bestFlag!==candidate.canonicalFlag){tied=true}}if(!bestFlag||tied||!Number.isFinite(bestDistance)||bestDistance<=0){return null}return{flag:bestFlag,reason:"flag_typo",confidence:bestDistance>=2?"medium":"high"}}function listAliasPluralKeys(normalizedKey){const candidates=[`${normalizedKey}s`];if(normalizedKey.endsWith("y")&&normalizedKey.length>1){candidates.push(`${normalizedKey.slice(0,-1)}ies`)}return candidates}function parseBareKeyValueToken(token,preserve=false){if(preserve||token.includes("://")){return null}const match=token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!match){return null}const key=match[1];const value=match[3];if(value.length===0){return null}return{key,value}}function normalizeLongOptionToken(token,lookup,preserve=false){if(preserve||!token.startsWith("--")){return{tokens:[token]}}const equalsIndex=token.indexOf("=");const key=equalsIndex>=0?token.slice(0,equalsIndex):token;const inlineValue=equalsIndex>=0?token.slice(equalsIndex+1):void 0;const resolution=resolveCanonicalFlag(key,lookup);if(!resolution){return{tokens:[token]}}const normalizedToken=inlineValue===void 0?resolution.flag:`${resolution.flag}=${inlineValue}`;if(normalizedToken===token){return{tokens:[token]}}return{tokens:[normalizedToken],event:{from:token,to:[normalizedToken],reason:resolution.reason,confidence:resolution.confidence}}}function collectBootstrapPathValueIndices(argv){const indices=new Set;let expectsValue=false;for(let index=0;index<argv.length;index+=1){if(expectsValue){indices.add(index);expectsValue=false;continue}const token=argv[index];expectsValue=token==="--path"||token==="--pm-path"}return indices}function splitCanonicalListToken(token){if(!token.startsWith("--")){return null}const equalsIndex=token.indexOf("=");if(equalsIndex<0){return{flag:token}}return{flag:token.slice(0,equalsIndex),inlineValue:token.slice(equalsIndex+1)}}function copyValueConsumingFlag(argv,index,result){result.push(argv[index]);const next=argv[index+1];if(typeof next==="string"&&next!=="--"){result.push(next);return index+2}return index+1}function readListFlagOccurrence(argv,index,parsed,multiValueListFlags){if(parsed.inlineValue!==void 0){return{originalTokens:[argv[index]],value:parsed.inlineValue,consumed:1}}const values=[];let valueIndex=index+1;while(valueIndex<argv.length&&argv[valueIndex]!=="--"&&!argv[valueIndex].startsWith("-")&&(values.length===0||multiValueListFlags.has(parsed.flag))){values.push(argv[valueIndex]);valueIndex+=1}const consumed=values.length===0?1:1+values.length;return{originalTokens:argv.slice(index,index+consumed),value:values.length===0?void 0:values.join(","),consumed}}function recordListFlagOccurrence(slots,result,flag,occurrence){const existing=slots.get(flag);if(existing){existing.values.push(occurrence.value);existing.occurrences+=1;return}slots.set(flag,{outputIndex:result.length,originalTokens:occurrence.originalTokens,values:[occurrence.value],occurrences:1});result.push(null)}function buildListFlagCoalescingSplices(slots,multiValueListFlags){const events=[];const splices=[];for(const[flag,slot]of slots){const shouldMerge=slot.occurrences>=2||multiValueListFlags.has(flag)&&slot.originalTokens.length>2;if(!shouldMerge){splices.push({outputIndex:slot.outputIndex,tokens:slot.originalTokens});continue}const mergedToken=`${flag}=${slot.values.join(",")}`;splices.push({outputIndex:slot.outputIndex,tokens:[mergedToken]});events.push({from:`${flag} (x${slot.occurrences})`,to:[mergedToken],reason:"list_merge",confidence:"high"})}return{events,splices}}function applyListFlagSplices(result,splices){splices.sort((a,b)=>b.outputIndex-a.outputIndex);for(const splice of splices){result.splice(splice.outputIndex,1,...splice.tokens)}}function coalesceRepeatedListFlags(argv,listFlags,valueConsumingFlags=new Set,multiValueListFlags=new Set){if(listFlags.size===0){return{argv:[...argv],events:[]}}const result=[];const slots=new Map;let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){result.push(...argv.slice(index));break}if(valueConsumingFlags.has(token)){index=copyValueConsumingFlag(argv,index,result);continue}const parsed=splitCanonicalListToken(token);if(!parsed||!listFlags.has(parsed.flag)){result.push(token);index+=1;continue}const occurrence=readListFlagOccurrence(argv,index,parsed,multiValueListFlags);if(occurrence.value===void 0){result.push(token);index+=occurrence.consumed;continue}recordListFlagOccurrence(slots,result,parsed.flag,{originalTokens:occurrence.originalTokens,value:occurrence.value});index+=occurrence.consumed}const{events,splices}=buildListFlagCoalescingSplices(slots,multiValueListFlags);applyListFlagSplices(result,splices);return{argv:result,events}}const LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function isLinkedTestTwoTokenValuePosition(commandName,emittedTokens){if(commandName!=="test"||emittedTokens.length<2){return false}const key=emittedTokens[emittedTokens.length-1];const flag=emittedTokens[emittedTokens.length-2];const keys=LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);return keys!==void 0&&keys.has(key)}function shouldPreserveBareKeyValueToken(commandName,emittedTokens){return commandName==="search"||isLinkedTestTwoTokenValuePosition(commandName,emittedTokens)}function mergeLinkedTestTwoTokenEntries(argv,commandName,trace){if(commandName!=="test"){return argv}const result=[];let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){result.push(...argv.slice(index));return result}const keys=LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);const key=keys?argv[index+1]:void 0;if(!keys||typeof key!=="string"||!keys.has(key)){result.push(token);index+=1;continue}let runEnd=index+2;while(runEnd<argv.length&&!argv[runEnd].startsWith("-")){runEnd+=1}if(runEnd-(index+2)!==1){result.push(token);index+=1;continue}const value=argv[index+2];const mergedValue=`${key}=${value}`;result.push(token,mergedValue);trace.push({from:`${token} ${key} ${value}`,to:[token,mergedValue],reason:"bare_key_value",confidence:"high"});index+=3}return result}function normalizeBootstrapTokens(argv,lookup,commandName,trace){const normalizedArgv=[];const pathValueIndices=collectBootstrapPathValueIndices(argv);for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--"){normalizedArgv.push(...argv.slice(index));break}const preserveCurrentToken=pathValueIndices.has(index);const previous=normalizedArgv[normalizedArgv.length-1];if(token.startsWith("--")){const normalizedToken=normalizeLongOptionToken(token,lookup,preserveCurrentToken);normalizedArgv.push(...normalizedToken.tokens);if(normalizedToken.event)trace.push(normalizedToken.event);continue}const bareKeyValue=parseBareKeyValueToken(token,preserveCurrentToken);if(bareKeyValue&&!(typeof previous==="string"&&previous.startsWith("-"))&&!shouldPreserveBareKeyValueToken(commandName,normalizedArgv)){const resolution=resolveCanonicalFlag(bareKeyValue.key,lookup);if(resolution){const replacement=[resolution.flag,bareKeyValue.value];normalizedArgv.push(...replacement);trace.push({from:token,to:replacement,reason:"bare_key_value",confidence:resolution.confidence});continue}}normalizedArgv.push(token)}return normalizedArgv}function bindAttestationVerification(argv){for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--")break;if(token==="--verify"){const value=argv[index+1];if(value===void 0||value==="--")throw new PmCliError("history attest --verify requires a bundle file.",EXIT_CODE.USAGE);argv.splice(index,2,`--verify=${value}`)}else if(GLOBAL_VALUE_CONSUMING_FLAGS.has(token)||token==="--output"||token==="--hash-algorithm"){index+=1}}}function normalizeBootstrapInvocation(argv){const trace=[];const executableNormalized=stripLeadingExecutableAlias(argv,trace);const legacyNormalized=normalizeLegacyExtensionActionSyntax(executableNormalized);if(legacyNormalized.length!==executableNormalized.length||legacyNormalized.some((token,index)=>token!==executableNormalized[index])){trace.push({from:executableNormalized.join(" "),to:[...legacyNormalized],reason:"legacy_extension_action",confidence:"high"})}const aliasNormalized=rewriteCommandAlias(legacyNormalized,trace);const itemAddress=normalizeItemAddressInvocation(aliasNormalized);if(itemAddress.conflict){throw new PmCliError("Provide the item id either positionally or with --id, not both.",EXIT_CODE.USAGE)}if(itemAddress.changed){trace.push({from:`--id ${itemAddress.itemId}`,to:[itemAddress.itemId],reason:"item_id_alias",confidence:"high"})}const commandName=parseBootstrapCommandName(itemAddress.argv);const commandPathName=parseBootstrapCommandPathName(itemAddress.argv);const lookup=buildFlagLookup(commandPathName??commandName);const normalizedArgv=normalizeBootstrapTokens(itemAddress.argv,lookup,commandName,trace);const linkedTestNormalized=mergeLinkedTestTwoTokenEntries(normalizedArgv,commandName,trace);const coalesced=coalesceRepeatedListFlags(linkedTestNormalized,lookup.listCanonicalFlags,GLOBAL_VALUE_CONSUMING_FLAGS,commandName==="create"?new Set(["--tags"]):new Set);for(const event of coalesced.events){trace.push(event)}if(commandPathName==="history attest")bindAttestationVerification(coalesced.argv);return{argv:coalesced.argv,commandName,trace}}function parseBootstrapCommandPathName(argv){const stripped=stripGlobalBootstrapTokens(argv);const first=stripped[0]?.trim().toLowerCase();const second=stripped[1]?.trim().toLowerCase();const namespaced=findPmNamespacedCommand(stripped);if(namespaced)return namespaced.canonical;if((first==="extension"||first==="package"||first==="packages")&&typeof second==="string"&&second.length>0&&!second.startsWith("-")){return`${first} ${second}`}return first}function parseBootstrapTypeValue(argv){for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--"){break}if(token==="--type"){const candidate=argv[index+1];if(typeof candidate==="string"&&candidate.trim().length>0){return candidate.trim()}continue}if(token.startsWith("--type=")){const candidate=token.slice("--type=".length).trim();if(candidate.length>0){return candidate}}}return void 0}const _testOnly={buildFlagLookup,collectBootstrapPathValueIndices,collectLongFlagCandidates,markUnambiguousFlag,normalizeLongOptionToken,resolveCanonicalFlag};export{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,_testOnly,applyBootstrapPagerPolicy,coalesceRepeatedListFlags,findBootstrapCommandTokenIndex,listAliasPluralKeys,mergeLinkedTestTwoTokenEntries,normalizeBootstrapInvocation,normalizeLegacyExtensionActionSyntax,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,stripGlobalBootstrapTokens};
|
|
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]="8ef3b254-0494-57bc-8bbf-8ee58eb7d152")}catch(e2){}})();import{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,renderPmCommandAliasMigrationHint,resolvePmCommandAlias}from"./cli-contracts/command-aliases.js";import{resolveSubcommandFlagContractsForCommand}from"./cli-contracts/flag-contracts.js";import{levenshteinDistanceWithinLimit}from"../core/shared/levenshtein.js";import{EXIT_CODE}from"../core/shared/constants.js";import{PmCliError}from"../core/shared/errors.js";import{findPmNamespacedCommand,resolvePmCommandOperation}from"./cli-contracts/command-aliases.js";import{normalizeItemAddressInvocation}from"./agent/item-addressing.js";import{BOOTSTRAP_BOOLEAN_FLAGS,GLOBAL_VALUE_CONSUMING_FLAGS,consumesBootstrapValue,findBootstrapCommandTokenIndex as findContractBootstrapCommandTokenIndex,isInlineGlobalValueToken,parseBootstrapCommandName as parseContractBootstrapCommandName}from"./cli-contracts/bootstrap-command-scanner.js";const OUTPUT_VALUE_FLAGS=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]);function consumeBootstrapGlobalToken(argv,index,state){const token=argv[index];if(BOOTSTRAP_BOOLEAN_FLAGS.has(token)){state.booleanFlags.add(token);return 1}const equalsIndex=token.indexOf("=");const canonicalFlag=equalsIndex>0?token.slice(0,equalsIndex):token;if(!GLOBAL_VALUE_CONSUMING_FLAGS.has(canonicalFlag))return 1;const inlineValue=equalsIndex>0?token.slice(equalsIndex+1):void 0;const consumesValue=inlineValue===void 0&&consumesBootstrapValue(canonicalFlag,argv[index+1]);const value=inlineValue??(consumesValue?argv[index+1]:void 0);if(canonicalFlag==="--author"){state.author=value??""}else if(typeof value==="string"&&value.length>0){const target=OUTPUT_VALUE_FLAGS.has(canonicalFlag)?state.outputValues:state.pathValues;target.set(canonicalFlag,value)}return consumesValue?2:1}function parseBootstrapGlobalOptions(argv){const state={booleanFlags:new Set,outputValues:new Map,pathValues:new Map};let index=0;while(index<argv.length){if(argv[index]==="--")break;index+=consumeBootstrapGlobalToken(argv,index,state)}return{path:state.pathValues.get("--pm-path")??state.pathValues.get("--path"),noExtensions:state.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(parseBootstrapCommandPathName(argv)??""),noPager:state.booleanFlags.has("--no-pager"),json:state.booleanFlags.has("--json"),quiet:state.booleanFlags.has("--quiet"),lean:state.booleanFlags.has("--lean"),tokenAccounting:state.booleanFlags.has("--token-accounting"),...state.booleanFlags.has("--output-row-contract")?{outputRowContract:true}:{},...state.outputValues.get("--output-include")===void 0?{}:{outputInclude:state.outputValues.get("--output-include")},...state.outputValues.get("--output-limit")===void 0?{}:{outputLimit:state.outputValues.get("--output-limit")},...state.outputValues.get("--output-budget")===void 0?{}:{outputBudget:state.outputValues.get("--output-budget")},...state.outputValues.get("--output-format")==="toon"||state.outputValues.get("--output-format")==="json"?{outputFormat:state.outputValues.get("--output-format")}:{},...state.outputValues.get("--output-session")===void 0?{}:{outputSession:state.outputValues.get("--output-session")},...state.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:state.outputValues.get("--output-cursor")},...state.author===""?{authorMissingValue:true}:state.author!==void 0?{author:state.author}:{}}}function stripGlobalBootstrapTokens(argv){const remaining=[];let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){break}if(BOOTSTRAP_BOOLEAN_FLAGS.has(token)||token==="--profile"||token==="--id-only"||token==="--full-changed-fields"||token==="--explain"){index+=1;continue}if(GLOBAL_VALUE_CONSUMING_FLAGS.has(token)){index+=consumesBootstrapValue(token,argv[index+1])?2:1;continue}if(isInlineGlobalValueToken(token)){index+=1;continue}remaining.push(token);index+=1}return remaining}function parseBootstrapHelpRequest(argv){const stripped=stripGlobalBootstrapTokens(argv);const first=stripped[0]?.trim().toLowerCase();if(first==="help"){const commandPathTokens2=[];for(let index=1;index<stripped.length;index+=1){const token=stripped[index];if(token.startsWith("-")){break}commandPathTokens2.push(token.trim().toLowerCase())}return{requested:true,commandPathTokens:commandPathTokens2}}const helpFlagIndex=stripped.findIndex(token=>token==="--help"||token==="-h");if(helpFlagIndex<0){return{requested:false,commandPathTokens:[]}}const commandPathTokens=[];for(const token of stripped){if(token.startsWith("-")){break}commandPathTokens.push(token.trim().toLowerCase())}return{requested:true,commandPathTokens}}function findBootstrapCommandTokenIndex(argv){return findContractBootstrapCommandTokenIndex(argv)}function parseBootstrapCommandName(argv){return parseContractBootstrapCommandName(argv)}function shouldDisablePagerForInvocation(argv,bootstrapGlobal){if(bootstrapGlobal.noPager){return true}if(process.stdout.isTTY===true){return false}const helpRequest=parseBootstrapHelpRequest(argv);return helpRequest.requested}function applyBootstrapPagerPolicy(argv){const pagerEnvironmentKeys=["PAGER","MANPAGER","GIT_PAGER","LESS"];const previousValues=pagerEnvironmentKeys.map(key=>process.env[key]);const restore=()=>{for(const[index,key]of pagerEnvironmentKeys.entries()){const value=previousValues[index];if(value===void 0){delete process.env[key]}else{process.env[key]=value}}};const bootstrapGlobal=parseBootstrapGlobalOptions(argv);if(!shouldDisablePagerForInvocation(argv,bootstrapGlobal)){return restore}process.env.PAGER="cat";process.env.MANPAGER="cat";process.env.GIT_PAGER="cat";if(typeof process.env.LESS!=="string"||process.env.LESS.trim().length===0){process.env.LESS="FRX"}return restore}const EXTENSION_ACTION_SYNTAX_TOKENS=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function normalizeLegacyExtensionActionSyntax(argv){const extensionIndex=findBootstrapCommandTokenIndex(argv);if(extensionIndex===void 0||argv[extensionIndex]!=="extension"){return[...argv]}const actionToken=argv[extensionIndex+1];if(!actionToken||actionToken.startsWith("-")){return[...argv]}if(!EXTENSION_ACTION_SYNTAX_TOKENS.has(actionToken)){return[...argv]}if(argv.includes("--help")||argv.includes("-h")){return[...argv]}const forcedActionFlag=`--${actionToken}`;if(argv.includes(forcedActionFlag)){return[...argv]}return[...argv.slice(0,extensionIndex+1),forcedActionFlag,...argv.slice(extensionIndex+2)]}const CLI_EXECUTABLE_ALIASES=new Set(["pm","pm-cli"]);function stripLeadingExecutableAlias(argv,trace){const index=findBootstrapCommandTokenIndex(argv);if(index===void 0){return argv}const token=argv[index];if(!CLI_EXECUTABLE_ALIASES.has(token.trim().toLowerCase())){return argv}trace.push({from:token,to:[],reason:"executable_alias",confidence:"high"});return[...argv.slice(0,index),...argv.slice(index+1)]}function rewriteCommandAlias(argv,trace){let index=findBootstrapCommandTokenIndex(argv);if(index!==void 0&&argv[index]==="help"){const offset=findBootstrapCommandTokenIndex(argv.slice(index+1));index=offset===void 0?void 0:index+1+offset}if(index===void 0){return argv}const token=argv[index];const canonical=EXECUTABLE_COMMAND_ALIASES[token.trim().toLowerCase()];if(!canonical){return argv}const canonicalTokens=canonical.split(" ");const rewritten=[...argv.slice(0,index),...canonicalTokens,...argv.slice(index+1)];trace.push({from:token,to:canonicalTokens,reason:"command_alias",confidence:"high"});return rewritten}function normalizeFlagKeyToken(raw){const withoutPrefix=raw.replace(/^--?/,"");return withoutPrefix.replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function toComparableFlagKey(raw){return normalizeFlagKeyToken(raw).replace(/-/g,"")}function markUnambiguousFlag(map,key,canonicalFlag){const existing=map.get(key);if(existing===void 0){map.set(key,canonicalFlag);return}if(existing!==canonicalFlag){map.set(key,null)}}function collectLongFlagCandidates(contract){const candidates=[];const pushLongFlag=value=>{if(typeof value!=="string"){return}if(!value.startsWith("--")){return}candidates.push(value)};pushLongFlag(contract.flag);for(const alias of contract.aliases??[]){pushLongFlag(alias)}return candidates}function buildFlagLookup(commandName,contractsOverride){const contracts=contractsOverride??resolveSubcommandFlagContractsForCommand(commandName);const canonicalByNormalized=new Map;const canonicalByCompact=new Map;const canonicalComparablesMap=new Map;const listCanonicalFlags=new Set;for(const contract of contracts){const longCandidates=collectLongFlagCandidates(contract);if(longCandidates.length===0){continue}const canonicalFlag=`--${normalizeFlagKeyToken(longCandidates[0])}`;for(const candidate of longCandidates){markUnambiguousFlag(canonicalByNormalized,normalizeFlagKeyToken(candidate),canonicalFlag);markUnambiguousFlag(canonicalByCompact,toComparableFlagKey(candidate),canonicalFlag)}const comparable=toComparableFlagKey(canonicalFlag);if(!canonicalComparablesMap.has(canonicalFlag)){canonicalComparablesMap.set(canonicalFlag,comparable)}if(contract.list===true){listCanonicalFlags.add(canonicalFlag)}}return{canonicalByNormalized,canonicalByCompact,canonicalComparables:[...canonicalComparablesMap.entries()].map(([canonicalFlag,comparable])=>({canonicalFlag,comparable})),listCanonicalFlags}}function resolveCanonicalFlag(rawKey,lookup){const normalizedKey=normalizeFlagKeyToken(rawKey);const direct=lookup.canonicalByNormalized.get(normalizedKey);if(typeof direct==="string"){return{flag:direct,reason:"flag_alias",confidence:"high"}}const comparableKey=normalizedKey.replace(/-/g,"");const compactMatch=lookup.canonicalByCompact.get(comparableKey);if(typeof compactMatch==="string"){return{flag:compactMatch,reason:"flag_alias",confidence:"high"}}const maxDistance=comparableKey.length>=8?2:1;let bestDistance=Number.POSITIVE_INFINITY;let bestFlag;let tied=false;for(const candidate of lookup.canonicalComparables){const distance=levenshteinDistanceWithinLimit(comparableKey,candidate.comparable,maxDistance);if(distance===null){continue}if(distance<bestDistance){bestDistance=distance;bestFlag=candidate.canonicalFlag;tied=false;continue}if(distance===bestDistance&&bestFlag!==candidate.canonicalFlag){tied=true}}if(!bestFlag||tied||!Number.isFinite(bestDistance)||bestDistance<=0){return null}return{flag:bestFlag,reason:"flag_typo",confidence:bestDistance>=2?"medium":"high"}}function listAliasPluralKeys(normalizedKey){const candidates=[`${normalizedKey}s`];if(normalizedKey.endsWith("y")&&normalizedKey.length>1){candidates.push(`${normalizedKey.slice(0,-1)}ies`)}return candidates}function parseBareKeyValueToken(token,preserve=false){if(preserve||token.includes("://")){return null}const match=token.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!match){return null}const key=match[1];const value=match[3];if(value.length===0){return null}return{key,value}}function normalizeLongOptionToken(token,lookup,preserve=false){if(preserve||!token.startsWith("--")){return{tokens:[token]}}const equalsIndex=token.indexOf("=");const key=equalsIndex>=0?token.slice(0,equalsIndex):token;const inlineValue=equalsIndex>=0?token.slice(equalsIndex+1):void 0;const resolution=resolveCanonicalFlag(key,lookup);if(!resolution){return{tokens:[token]}}const normalizedToken=inlineValue===void 0?resolution.flag:`${resolution.flag}=${inlineValue}`;if(normalizedToken===token){return{tokens:[token]}}return{tokens:[normalizedToken],event:{from:token,to:[normalizedToken],reason:resolution.reason,confidence:resolution.confidence}}}function collectBootstrapPathValueIndices(argv){const indices=new Set;let expectsValue=false;for(let index=0;index<argv.length;index+=1){if(expectsValue){indices.add(index);expectsValue=false;continue}const token=argv[index];expectsValue=token==="--path"||token==="--pm-path"}return indices}function splitCanonicalListToken(token){if(!token.startsWith("--")){return null}const equalsIndex=token.indexOf("=");if(equalsIndex<0){return{flag:token}}return{flag:token.slice(0,equalsIndex),inlineValue:token.slice(equalsIndex+1)}}function copyValueConsumingFlag(argv,index,result){result.push(argv[index]);const next=argv[index+1];if(typeof next==="string"&&next!=="--"){result.push(next);return index+2}return index+1}function readListFlagOccurrence(argv,index,parsed,multiValueListFlags){if(parsed.inlineValue!==void 0){return{originalTokens:[argv[index]],value:parsed.inlineValue,consumed:1}}const values=[];let valueIndex=index+1;while(valueIndex<argv.length&&argv[valueIndex]!=="--"&&!argv[valueIndex].startsWith("-")&&(values.length===0||multiValueListFlags.has(parsed.flag))){values.push(argv[valueIndex]);valueIndex+=1}const consumed=values.length===0?1:1+values.length;return{originalTokens:argv.slice(index,index+consumed),value:values.length===0?void 0:values.join(","),consumed}}function recordListFlagOccurrence(slots,result,flag,occurrence){const existing=slots.get(flag);if(existing){existing.values.push(occurrence.value);existing.occurrences+=1;return}slots.set(flag,{outputIndex:result.length,originalTokens:occurrence.originalTokens,values:[occurrence.value],occurrences:1});result.push(null)}function buildListFlagCoalescingSplices(slots,multiValueListFlags){const events=[];const splices=[];for(const[flag,slot]of slots){const shouldMerge=slot.occurrences>=2||multiValueListFlags.has(flag)&&slot.originalTokens.length>2;if(!shouldMerge){splices.push({outputIndex:slot.outputIndex,tokens:slot.originalTokens});continue}const mergedToken=`${flag}=${slot.values.join(",")}`;splices.push({outputIndex:slot.outputIndex,tokens:[mergedToken]});events.push({from:`${flag} (x${slot.occurrences})`,to:[mergedToken],reason:"list_merge",confidence:"high"})}return{events,splices}}function applyListFlagSplices(result,splices){splices.sort((a,b)=>b.outputIndex-a.outputIndex);for(const splice of splices){result.splice(splice.outputIndex,1,...splice.tokens)}}function coalesceRepeatedListFlags(argv,listFlags,valueConsumingFlags=new Set,multiValueListFlags=new Set){if(listFlags.size===0){return{argv:[...argv],events:[]}}const result=[];const slots=new Map;let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){result.push(...argv.slice(index));break}if(valueConsumingFlags.has(token)){index=copyValueConsumingFlag(argv,index,result);continue}const parsed=splitCanonicalListToken(token);if(!parsed||!listFlags.has(parsed.flag)){result.push(token);index+=1;continue}const occurrence=readListFlagOccurrence(argv,index,parsed,multiValueListFlags);if(occurrence.value===void 0){result.push(token);index+=occurrence.consumed;continue}recordListFlagOccurrence(slots,result,parsed.flag,{originalTokens:occurrence.originalTokens,value:occurrence.value});index+=occurrence.consumed}const{events,splices}=buildListFlagCoalescingSplices(slots,multiValueListFlags);applyListFlagSplices(result,splices);return{argv:result,events}}const LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function isLinkedTestTwoTokenValuePosition(commandName,emittedTokens){if(commandName!=="test"||emittedTokens.length<2){return false}const key=emittedTokens[emittedTokens.length-1];const flag=emittedTokens[emittedTokens.length-2];const keys=LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(flag);return keys!==void 0&&keys.has(key)}function shouldPreserveBareKeyValueToken(commandName,emittedTokens){return commandName==="search"||isLinkedTestTwoTokenValuePosition(commandName,emittedTokens)}function mergeLinkedTestTwoTokenEntries(argv,commandName,trace){if(commandName!=="test"){return argv}const result=[];let index=0;while(index<argv.length){const token=argv[index];if(token==="--"){result.push(...argv.slice(index));return result}const keys=LINKED_TEST_TWO_TOKEN_KEYS_BY_FLAG.get(token);const key=keys?argv[index+1]:void 0;if(!keys||typeof key!=="string"||!keys.has(key)){result.push(token);index+=1;continue}let runEnd=index+2;while(runEnd<argv.length&&!argv[runEnd].startsWith("-")){runEnd+=1}if(runEnd-(index+2)!==1){result.push(token);index+=1;continue}const value=argv[index+2];const mergedValue=`${key}=${value}`;result.push(token,mergedValue);trace.push({from:`${token} ${key} ${value}`,to:[token,mergedValue],reason:"bare_key_value",confidence:"high"});index+=3}return result}function normalizeBootstrapTokens(argv,lookup,commandName,trace){const normalizedArgv=[];const pathValueIndices=collectBootstrapPathValueIndices(argv);for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--"){normalizedArgv.push(...argv.slice(index));break}const preserveCurrentToken=pathValueIndices.has(index);const previous=normalizedArgv[normalizedArgv.length-1];if(token.startsWith("--")){const normalizedToken=normalizeLongOptionToken(token,lookup,preserveCurrentToken);normalizedArgv.push(...normalizedToken.tokens);if(normalizedToken.event)trace.push(normalizedToken.event);continue}const bareKeyValue=parseBareKeyValueToken(token,preserveCurrentToken);if(bareKeyValue&&!(typeof previous==="string"&&previous.startsWith("-"))&&!shouldPreserveBareKeyValueToken(commandName,normalizedArgv)){const resolution=resolveCanonicalFlag(bareKeyValue.key,lookup);if(resolution){const replacement=[resolution.flag,bareKeyValue.value];normalizedArgv.push(...replacement);trace.push({from:token,to:replacement,reason:"bare_key_value",confidence:resolution.confidence});continue}}normalizedArgv.push(token)}return normalizedArgv}function bindAttestationVerification(argv){for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--")break;if(token==="--verify"){const value=argv[index+1];if(value===void 0||value==="--")throw new PmCliError("history attest --verify requires a bundle file.",EXIT_CODE.USAGE);argv.splice(index,2,`--verify=${value}`)}else if(GLOBAL_VALUE_CONSUMING_FLAGS.has(token)||token==="--output"||token==="--hash-algorithm"){index+=1}}}function normalizeBootstrapInvocation(argv){const trace=[];const executableNormalized=stripLeadingExecutableAlias(argv,trace);const legacyNormalized=normalizeLegacyExtensionActionSyntax(executableNormalized);if(legacyNormalized.length!==executableNormalized.length||legacyNormalized.some((token,index)=>token!==executableNormalized[index])){trace.push({from:executableNormalized.join(" "),to:[...legacyNormalized],reason:"legacy_extension_action",confidence:"high"})}const aliasNormalized=rewriteCommandAlias(legacyNormalized,trace);const itemAddress=normalizeItemAddressInvocation(aliasNormalized);if(itemAddress.conflict){throw new PmCliError("Provide the item id either positionally or with --id, not both.",EXIT_CODE.USAGE)}if(itemAddress.changed){trace.push({from:`--id ${itemAddress.itemId}`,to:[itemAddress.itemId],reason:"item_id_alias",confidence:"high"})}const commandName=parseBootstrapCommandName(itemAddress.argv);const commandPathName=parseBootstrapCommandPathName(itemAddress.argv);const operationName=resolvePmCommandOperation(commandPathName??commandName??"");const lookup=buildFlagLookup(commandPathName??commandName);const normalizedArgv=normalizeBootstrapTokens(itemAddress.argv,lookup,operationName,trace);const linkedTestNormalized=mergeLinkedTestTwoTokenEntries(normalizedArgv,operationName,trace);const coalesced=coalesceRepeatedListFlags(linkedTestNormalized,lookup.listCanonicalFlags,GLOBAL_VALUE_CONSUMING_FLAGS,commandName==="create"?new Set(["--tags"]):new Set);for(const event of coalesced.events){trace.push(event)}if(commandPathName==="history attest")bindAttestationVerification(coalesced.argv);return{argv:coalesced.argv,commandName,trace}}function parseBootstrapCommandPathName(argv){const stripped=stripGlobalBootstrapTokens(argv);const first=stripped[0]?.trim().toLowerCase();const second=stripped[1]?.trim().toLowerCase();const namespaced=findPmNamespacedCommand(stripped);if(namespaced)return namespaced.canonical;if((first==="extension"||first==="package"||first==="packages")&&typeof second==="string"&&second.length>0&&!second.startsWith("-")){return`${first} ${second}`}return first}function parseBootstrapTypeValue(argv){for(let index=0;index<argv.length;index+=1){const token=argv[index];if(token==="--"){break}if(token==="--type"){const candidate=argv[index+1];if(typeof candidate==="string"&&candidate.trim().length>0){return candidate.trim()}continue}if(token.startsWith("--type=")){const candidate=token.slice("--type=".length).trim();if(candidate.length>0){return candidate}}}return void 0}const _testOnly={buildFlagLookup,collectBootstrapPathValueIndices,collectLongFlagCandidates,markUnambiguousFlag,normalizeLongOptionToken,resolveCanonicalFlag};export{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,_testOnly,applyBootstrapPagerPolicy,coalesceRepeatedListFlags,findBootstrapCommandTokenIndex,listAliasPluralKeys,mergeLinkedTestTwoTokenEntries,normalizeBootstrapInvocation,normalizeLegacyExtensionActionSyntax,parseBootstrapCommandName,parseBootstrapGlobalOptions,parseBootstrapHelpRequest,parseBootstrapTypeValue,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,stripGlobalBootstrapTokens};
|
|
2
2
|
//# sourceMappingURL=cli-bootstrap.js.map
|
|
@@ -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]="f9a3ff17-949b-55e0-a2ec-18870aa52197")}catch(e2){}})();const PM_HISTORY_COMMAND_ALIASES=[["history-redact","history redact"],["history-repair","history repair"],["history-compact","history compact"],["activity","history activity"],["restore","history restore"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-tqel"}));const PM_CONTEXT_OPS_COMMAND_ALIASES=[...["next","focus"].map(alias=>({alias,canonical:`context ${alias}`,owner:"pm-kcs4"})),...["stats","health","validate","gc","telemetry","eval","test-all"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-6apl"})),...["normalize","reindex"].map(alias=>({alias,canonical:`ops ${alias}`,owner:"pm-3i9q8g"})),{alias:"events",canonical:"history events",owner:"pm-3i9q8g"}].map(entry=>({...entry,canonical_argv:entry.canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap"}));const PM_BULK_LIFECYCLE_COMMAND_ALIASES=[["update-many","update many"],["close-many","close many"],["delete","close delete"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-ik19"}));const PM_RELOCATED_COMMAND_ALIASES=[...PM_CONTEXT_OPS_COMMAND_ALIASES,...PM_BULK_LIFECYCLE_COMMAND_ALIASES,...[...["comments","notes","learnings","files","docs","deps","append","test"].map(facet=>[facet,`item ${facet}`,"pm-yql1"]),["test-runs-worker","item test worker","pm-lp4j"],...["statuses","tags","types"].map(facet=>[`completion-${facet}`,`completion ${facet}`,"pm-szdc"]),["copy","item copy","pm-m6g87m"],["merge","workspace merge","pm-m6g87m"],["duplicates","item duplicates","pm-fmy9ih"],["dedupe-audit","item duplicates audit","pm-fmy9ih"],["dedupe-merge","item duplicates merge","pm-fmy9ih"],["comments-audit","item audit-comments","pm-fmy9ih"],["search-advanced","search advanced","pm-wfskfn"]].map(([alias,canonical,owner])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:true,registration:"bootstrap",owner}))];const PM_NAMESPACED_COMMAND_ALIASES=[{alias:"history-attest",canonical:"history attest",canonical_argv:["history","attest"],lifecycle:"permanent",hidden:true,registration:"commander",owner:"pm-3z0k"},...PM_HISTORY_COMMAND_ALIASES,...PM_RELOCATED_COMMAND_ALIASES,...["discover","lookup"].map(action=>({alias:`files ${action}`,canonical:`item files ${action}`,canonical_argv:["item","files",action],lifecycle:"permanent",hidden:true,registration:"bootstrap",owner:"pm-yql1"}))];function findPmNamespacedCommand(tokens){let matched;for(const alias of PM_NAMESPACED_COMMAND_ALIASES){if(alias.canonical_argv.length<=(matched?.canonical_argv.length??0))continue;if(alias.canonical_argv.every((token,index)=>token===(index===0&&tokens[index]==="ctx"?"context":tokens[index])))matched=alias}return matched}function resolvePmCommandOperation(command){const normalized=command.trim().replace(/\s+/gu," ");return PM_NAMESPACED_COMMAND_ALIASES.find(alias=>alias.canonical===normalized.replace(/^ctx /u,"context "))?.alias??normalized}function resolvePmHistoryOperation(command){return resolvePmCommandOperation(command)}const PM_COMMAND_ALIAS_CONTRACTS=[...PM_NAMESPACED_COMMAND_ALIASES,...[["start-task","claim","--start"],["pause-task","release","--pause"],["close-task","close","--release-assignment"]].map(([alias,canonical,flag])=>({alias,canonical,canonical_argv:[canonical,flag],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-eq4x"})),{alias:"tests",canonical:"item test",canonical_argv:["item","test"],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-u4t9gp"},...[["fetch","get"],["read","get"],["show","get"],["view","get"],["comment","comments"],["note","notes"],["learning","learnings"]].map(([alias,canonical])=>({alias,canonical:["comments","notes","learnings"].includes(canonical)?`item ${canonical}`:canonical,canonical_argv:["comments","notes","learnings"].includes(canonical)?["item",canonical]:[canonical],lifecycle:"permanent",hidden:false,registration:"bootstrap",owner:"pm-pbyu"})),...[["extension list","extension catalog"],["extension scaffold","extension init"],["package list","package catalog"],["package scaffold","package init"],["packages list","packages catalog"],["packages scaffold","packages init"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"permanent",hidden:false,registration:"commander",owner:"pm-ya7x55"})),{alias:"list-all",canonical:"list",canonical_argv:["list","--all"],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"},...[["list-draft","draft"],["list-open","open"],["list-in-progress","in_progress"],["list-blocked","blocked"],["list-closed","closed"],["list-canceled","canceled"]].map(([alias,status])=>({alias,canonical:"list",canonical_argv:["list","--status",status],lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-pfqi"})),...[["extension","package"],["install","package install"],["upgrade","package upgrade"]].map(([alias,canonical])=>({alias,canonical,canonical_argv:canonical.split(" "),lifecycle:"deprecated",hidden:true,registration:"commander",owner:"pm-tnud"}))];const EXECUTABLE_COMMAND_ALIASES=Object.fromEntries(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.registration==="bootstrap").map(contract=>[contract.alias,contract.canonical]));function resolvePmCommandAlias(alias){const normalized=alias.trim().toLowerCase();return PM_COMMAND_ALIAS_CONTRACTS.find(contract=>contract.alias===normalized)}function renderPmCommandAliasMigrationHint(contract){return`Deprecated command \`${contract.alias}\`; use \`pm ${contract.canonical_argv.join(" ")}\`.`}export{EXECUTABLE_COMMAND_ALIASES,PM_BULK_LIFECYCLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,PM_CONTEXT_OPS_COMMAND_ALIASES,PM_HISTORY_COMMAND_ALIASES,PM_NAMESPACED_COMMAND_ALIASES,PM_RELOCATED_COMMAND_ALIASES,findPmNamespacedCommand,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,resolvePmCommandOperation,resolvePmHistoryOperation};
|
|
2
2
|
//# sourceMappingURL=command-aliases.js.map
|
|
@@ -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]="f4306e3f-d76d-55e2-a156-e7430a04e520")}catch(e2){}})();import{resolvePmHistoryOperation}from"./command-aliases.js";import{normalizeUniqueStringList}from"./string-lists.js";import{RESERVED_EXTENSION_HOST_FLAGS}from"../../core/extensions/reserved-host-flags.js";import{PM_POSITIONAL_ACTION_CONTRACTS}from"./grammar-contracts.js";function normalizeFlagAliasKey(flag){if(!flag.startsWith("--")){return flag}return`--${flag.slice(2).replaceAll("_","-")}`}function withFlagAliasMetadata(flagContracts){const aliasesByCanonical=new Map;for(const contract of flagContracts){const canonical=normalizeFlagAliasKey(contract.flag);const bucket=aliasesByCanonical.get(canonical)??new Set;if(contract.flag!==canonical){bucket.add(contract.flag)}for(const alias of contract.aliases??[]){if(alias!==canonical){bucket.add(alias)}}aliasesByCanonical.set(canonical,bucket)}return flagContracts.map(contract=>{const canonical=normalizeFlagAliasKey(contract.flag);if(contract.flag!==canonical){return contract}const aliases=normalizeUniqueStringList([...contract.aliases??[],...aliasesByCanonical.get(canonical)]).filter(alias=>alias!==canonical);if(aliases.length===0){return contract}return{...contract,aliases}})}function compactFlagAliasContracts(flagContracts){const withAliases=withFlagAliasMetadata(flagContracts);const canonicalFlags=new Set(withAliases.map(contract=>contract.flag));return withAliases.filter(contract=>{const canonical=normalizeFlagAliasKey(contract.flag);return contract.flag===canonical||!canonicalFlags.has(canonical)})}const SUBCOMMAND_GLOBAL_FLAG_CONTRACTS=RESERVED_EXTENSION_HOST_FLAGS.map(definition=>({flag:definition.flag,reservation_scope:"inherited",...definition.aliases?{aliases:[...definition.aliases]}:{},...definition.value_name?{value_name:definition.value_name}:{}}));const GLOBAL_FLAG_CONTRACTS=[...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}];const GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}];const MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:true},{flag:"--limit"},{flag:"--offset"}];const LIST_FILTER_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:true},{flag:"--all",value_type:"boolean"},{flag:"--type",list:true},{flag:"--tag",aliases:["--tags"],list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:true},{flag:"--assignee",list:true},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:true},{flag:"--release",list:true},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:true},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"]));const AGGREGATE_FLAG_CONTRACTS=[{flag:"--group-by",list:true},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:true},{flag:"--type",list:true},{flag:"--tag",list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:true},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:true},{flag:"--release",list:true}];const COMMENTS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function withCursorSemantics(contracts,presentationFlags){return contracts.map(contract=>presentationFlags.has(contract.flag)?{...contract,cursor_semantics:"presentation"}:contract)}const NOTES_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const LEARNINGS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const FILES_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--scope"},{flag:"--limit"},{flag:"--offset"},{flag:"--no-truncate"},{flag:"--strict-read"},{flag:"--explain"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const DOCS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}];const MERGE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}];const HISTORY_REDACT_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_REPAIR_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS=[{flag:"--event",repeatable:true},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}];const HISTORY_COMPACT_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:true},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_ATTEST_FLAG_CONTRACTS=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}];const SCHEMA_FLAG_CONTRACTS=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}];const PROFILE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}];const PLAN_FLAG_CONTRACTS=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:true},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:true},{flag:"--note",repeatable:true},{flag:"--learning",repeatable:true},{flag:"--reminder",repeatable:true},{flag:"--event",repeatable:true},{flag:"--type-option",aliases:["--type_option"],repeatable:true},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth"},{flag:"--field"},{flag:"--fields",list:true},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const INIT_FLAG_CONTRACTS=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}];const CONFIG_FLAG_CONTRACTS=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}];const EXTENSION_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}];const EXTENSION_SCOPE_FLAG_CONTRACTS=[{flag:"--project"},{flag:"--local"},{flag:"--global"}];const EXTENSION_INIT_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--capability"}];const PACKAGE_FLAG_CONTRACTS=[...EXTENSION_FLAG_CONTRACTS,{flag:"--declarative"}];const PACKAGE_INIT_FLAG_CONTRACTS=[...EXTENSION_INIT_FLAG_CONTRACTS,{flag:"--declarative"}];const EXTENSION_INSTALL_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const EXTENSION_UNINSTALL_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_EXPLORE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_DESCRIBE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--markdown"},{flag:"--output"}];const EXTENSION_ADOPT_ALL_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_ACTIVATE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_DEACTIVATE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_MIGRATE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--dry-run"}];const EXTENSION_MANAGE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--runtime-probe"},{flag:"--fix-managed-state"}];const EXTENSION_RELOAD_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--watch"}];const EXTENSION_DOCTOR_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}];const EXTENSION_CATALOG_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--fields",list:true}];const EXTENSION_ADOPT_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const INSTALL_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const UPGRADE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}];const REINDEX_FLAG_CONTRACTS=[{flag:"--mode"},{flag:"--progress"}];const CLOSE_FLAG_CONTRACTS=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}];const CLOSE_MANY_FLAG_CONTRACTS=[{flag:"--filter-status",list:true},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}];const APPEND_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const CLAIM_FLAG_CONTRACTS=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}];const RESTORE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const DELETE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const RELEASE_FLAG_CONTRACTS=[{flag:"--pause",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const START_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const PAUSE_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const CLOSE_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}];const SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}];const MEET_FLAG_CONTRACTS=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS];const EVENT_FLAG_CONTRACTS=MEET_FLAG_CONTRACTS;const REMIND_FLAG_CONTRACTS=[{flag:"--at"},{flag:"--text"},...SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS];const TEST_FLAG_CONTRACTS=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:true},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"},{flag:"--measure",list:true},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const TEST_ALL_FLAG_CONTRACTS=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"}];const TELEMETRY_FLAG_CONTRACTS=[{flag:"--limit"}];const TEST_RUNS_FLAG_CONTRACTS=[{flag:"--status"},{flag:"--limit"},{flag:"--stream"},{flag:"--tail"},{flag:"--force"},{flag:"--author"}];const GC_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--scope"}];const STATS_FLAG_CONTRACTS=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}];const DUPLICATES_FLAG_CONTRACTS=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:true,list:true},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}];const HEALTH_FLAG_CONTRACTS=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}];const VALIDATE_FLAG_CONTRACTS=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}];const ASSURANCE_FLAG_CONTRACTS=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}];const ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}];const ITEM_PORTFOLIO_FLAG_CONTRACTS=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}];const ITEM_CONTENT_METADATA_FLAG_CONTRACTS=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}];const CREATE_FLAG_CONTRACTS=[{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS,...ITEM_PORTFOLIO_FLAG_CONTRACTS,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}];const ITEM_MUTATE_FLAG_CONTRACTS=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}];const ITEM_COMPLETE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:true},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:true},{flag:"--doc",value_name:"value",repeatable:true},{flag:"--test",value_name:"value",repeatable:true},{flag:"--comment",value_name:"value",repeatable:true},{flag:"--note",value_name:"value",repeatable:true},{flag:"--learning",value_name:"value",repeatable:true},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}];const ITEM_REOPEN_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}];const COPY_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}];const FOCUS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}];const UPDATE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...ITEM_CONTENT_METADATA_FLAG_CONTRACTS,...ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS,{flag:"--fixed_version"},...ITEM_PORTFOLIO_FLAG_CONTRACTS,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}];const UPDATE_MANY_FLAG_CONTRACTS=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:true},{flag:"--filter-type",list:true},{flag:"--filter-tag",list:true},{flag:"--filter-priority",list:true},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:true},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:true},{flag:"--filter-release",list:true},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...ITEM_CONTENT_METADATA_FLAG_CONTRACTS,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const CALENDAR_FLAG_CONTRACTS=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--format"}];const ACTIVITY_FLAG_CONTRACTS=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--stream"}];const EVENTS_FLAG_CONTRACTS=[{flag:"--since"},{flag:"--type",repeatable:true},{flag:"--author",repeatable:true},{flag:"--item",repeatable:true},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}];const CONTEXT_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth"},{flag:"--fields",list:true},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"]));const GET_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth"},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:true},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}];const GUIDE_FLAG_CONTRACTS=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}];const DEPS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:true}];const GRAPH_FLAG_CONTRACTS=[{flag:"--kind",list:true},{flag:"--max-depth"},{flag:"--limit"},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths"},{flag:"--sample"},{flag:"--exempt-isolate",list:true},{flag:"--exempt-isolate-type",list:true},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}];const EVAL_FLAG_CONTRACTS=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}];const WORKSPACE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}];const WORKSPACE_POSITION_FLAG_CONTRACTS=[];const NEXT_FLAG_CONTRACTS=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}];const SEARCH_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:true},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:true},{flag:"--type",list:true},{flag:"--tag",aliases:["--tags"],list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:true},{flag:"--sprint",list:true},{flag:"--release",list:true},{flag:"--parent"},...GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"]));const CONTRACTS_FLAG_CONTRACTS=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}];const COMPLETION_FLAG_CONTRACTS=[{flag:"--eager-tags"}];function toUniqueFlagContracts(contracts){const seen=new Set;const unique=[];for(const contract of contracts){const aliasKey=(contract.aliases??[]).join(",");const key=`${contract.flag}|${contract.short??""}|${aliasKey}`;if(seen.has(key)){continue}seen.add(key);unique.push(contract)}return unique}function withSubcommandGlobalFlags(contracts){const byCanonicalFlag=new Map;for(const contract of[...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,...contracts]){const canonicalFlag=normalizeFlagAliasKey(contract.flag);const prior=byCanonicalFlag.get(canonicalFlag);const{aliases:declaredAliases,...contractWithoutAliases}=contract;const aliases=normalizeUniqueStringList([...declaredAliases??[],...contract.flag===canonicalFlag?[]:[contract.flag]]).filter(alias=>alias!==canonicalFlag);const normalizedContract={...contractWithoutAliases,flag:canonicalFlag,...aliases.length>0?{aliases}:{}};const mergedAliases=normalizeUniqueStringList([...prior?.aliases??[],...normalizedContract.aliases??[]]);byCanonicalFlag.set(canonicalFlag,prior===void 0?normalizedContract:{...prior,...normalizedContract,...mergedAliases.length>0?{aliases:mergedAliases}:{}})}return withFlagAliasMetadata([...byCanonicalFlag.values()])}const FIXED_STATUS_LIST_COMMAND_ALIASES=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"];const FIXED_STATUS_LIST_FLAG_CONTRACTS=LIST_FILTER_FLAG_CONTRACTS.filter(contract=>contract.flag!=="--status"&&contract.flag!=="--all");function indexCliFlagContracts(contracts){const index=new Map;for(const contract of contracts){for(const spelling of[contract.flag,...contract.aliases??[]]){const matches=index.get(spelling)??[];matches.push(contract);index.set(spelling,matches)}}return index}const PLAN_FLAG_CONTRACT_INDEX=indexCliFlagContracts(PLAN_FLAG_CONTRACTS);const ASSURANCE_FLAG_CONTRACT_INDEX=indexCliFlagContracts(ASSURANCE_FLAG_CONTRACTS);const POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT=new Map([["assurance",ASSURANCE_FLAG_CONTRACT_INDEX],["plan",PLAN_FLAG_CONTRACT_INDEX],["workspace",indexCliFlagContracts(WORKSPACE_POSITION_FLAG_CONTRACTS)],["workspace snapshot",indexCliFlagContracts(WORKSPACE_FLAG_CONTRACTS)]]);function resolvePmPositionalActionFlagContracts(actions=PM_POSITIONAL_ACTION_CONTRACTS){return actions.map(({command,parent,accepted_flags:acceptedFlags})=>{const parentFlagIndex=POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT.get(parent);if(!parentFlagIndex){throw new Error(`Positional action ${command} has no flag-contract index for ${parent}.`)}const selected=acceptedFlags.map(acceptedFlag=>{const matches=parentFlagIndex.get(acceptedFlag)??[];if(matches.length!==1){throw new Error(`Positional action ${command} accepted flag ${acceptedFlag} does not resolve to exactly one ${parent} flag contract.`)}return matches[0]});return[command,selected]})}const PM_POSITIONAL_ACTION_FLAG_CONTRACTS=resolvePmPositionalActionFlagContracts();const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND=new Map([["list",LIST_FILTER_FLAG_CONTRACTS],["list-all",LIST_FILTER_FLAG_CONTRACTS],...FIXED_STATUS_LIST_COMMAND_ALIASES.map(command=>[command,FIXED_STATUS_LIST_FLAG_CONTRACTS]),["templates",CREATE_FLAG_CONTRACTS],["cal",CALENDAR_FLAG_CONTRACTS],["ctx",CONTEXT_FLAG_CONTRACTS],["test-runs-worker",TEST_RUNS_FLAG_CONTRACTS],["init",INIT_FLAG_CONTRACTS],["config",CONFIG_FLAG_CONTRACTS],["extension",EXTENSION_FLAG_CONTRACTS],["package",PACKAGE_FLAG_CONTRACTS],["packages",PACKAGE_FLAG_CONTRACTS],["install",INSTALL_FLAG_CONTRACTS],["upgrade",UPGRADE_FLAG_CONTRACTS],["create",CREATE_FLAG_CONTRACTS],["item",[]],["item mutate",ITEM_MUTATE_FLAG_CONTRACTS],["item complete",ITEM_COMPLETE_FLAG_CONTRACTS],["item reopen",ITEM_REOPEN_FLAG_CONTRACTS],["copy",COPY_FLAG_CONTRACTS],["focus",FOCUS_FLAG_CONTRACTS],["aggregate",AGGREGATE_FLAG_CONTRACTS],["calendar",CALENDAR_FLAG_CONTRACTS],["context",CONTEXT_FLAG_CONTRACTS],["get",GET_FLAG_CONTRACTS],["guide",GUIDE_FLAG_CONTRACTS],["search",SEARCH_FLAG_CONTRACTS],["next",NEXT_FLAG_CONTRACTS],["eval",EVAL_FLAG_CONTRACTS],["workspace",WORKSPACE_FLAG_CONTRACTS],["workspace position",WORKSPACE_POSITION_FLAG_CONTRACTS],["workspace snapshot",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot create",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot list",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot inspect",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot restore",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot delete",WORKSPACE_FLAG_CONTRACTS],["history",HISTORY_FLAG_CONTRACTS],["history-redact",HISTORY_REDACT_FLAG_CONTRACTS],["history-repair",HISTORY_REPAIR_FLAG_CONTRACTS],["history-author-acknowledge",HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS],["history-compact",HISTORY_COMPACT_FLAG_CONTRACTS],["history-attest",HISTORY_ATTEST_FLAG_CONTRACTS],["merge",MERGE_FLAG_CONTRACTS],["schema",SCHEMA_FLAG_CONTRACTS],["profile",PROFILE_FLAG_CONTRACTS],["plan",PLAN_FLAG_CONTRACTS],["activity",ACTIVITY_FLAG_CONTRACTS],["events",EVENTS_FLAG_CONTRACTS],["restore",RESTORE_FLAG_CONTRACTS],["update",UPDATE_FLAG_CONTRACTS],["update-many",UPDATE_MANY_FLAG_CONTRACTS],["close",CLOSE_FLAG_CONTRACTS],["close-many",CLOSE_MANY_FLAG_CONTRACTS],["delete",DELETE_FLAG_CONTRACTS],["append",APPEND_FLAG_CONTRACTS],["comments",COMMENTS_FLAG_CONTRACTS],["notes",NOTES_FLAG_CONTRACTS],["learnings",LEARNINGS_FLAG_CONTRACTS],["files",FILES_FLAG_CONTRACTS],["docs",DOCS_FLAG_CONTRACTS],["deps",DEPS_FLAG_CONTRACTS],["graph",GRAPH_FLAG_CONTRACTS],["test",TEST_FLAG_CONTRACTS],["test-all",TEST_ALL_FLAG_CONTRACTS],["telemetry",TELEMETRY_FLAG_CONTRACTS],["health",HEALTH_FLAG_CONTRACTS],["assurance",ASSURANCE_FLAG_CONTRACTS],...PM_POSITIONAL_ACTION_FLAG_CONTRACTS,["validate",VALIDATE_FLAG_CONTRACTS],["gc",GC_FLAG_CONTRACTS],["stats",STATS_FLAG_CONTRACTS],["duplicates",DUPLICATES_FLAG_CONTRACTS],["contracts",CONTRACTS_FLAG_CONTRACTS],["completion",COMPLETION_FLAG_CONTRACTS],["claim",CLAIM_FLAG_CONTRACTS],["release",RELEASE_FLAG_CONTRACTS],["start-task",START_TASK_FLAG_CONTRACTS],["pause-task",PAUSE_TASK_FLAG_CONTRACTS],["close-task",CLOSE_TASK_FLAG_CONTRACTS],["meet",MEET_FLAG_CONTRACTS],["event",EVENT_FLAG_CONTRACTS],["remind",REMIND_FLAG_CONTRACTS]]);const EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND=new Map([["install",EXTENSION_INSTALL_FLAG_CONTRACTS],["uninstall",EXTENSION_UNINSTALL_FLAG_CONTRACTS],["explore",EXTENSION_EXPLORE_FLAG_CONTRACTS],["manage",EXTENSION_MANAGE_FLAG_CONTRACTS],["describe",EXTENSION_DESCRIBE_FLAG_CONTRACTS],["reload",EXTENSION_RELOAD_FLAG_CONTRACTS],["doctor",EXTENSION_DOCTOR_FLAG_CONTRACTS],["catalog",EXTENSION_CATALOG_FLAG_CONTRACTS],["list",EXTENSION_CATALOG_FLAG_CONTRACTS],["adopt",EXTENSION_ADOPT_FLAG_CONTRACTS],["adopt-all",EXTENSION_ADOPT_ALL_FLAG_CONTRACTS],["activate",EXTENSION_ACTIVATE_FLAG_CONTRACTS],["deactivate",EXTENSION_DEACTIVATE_FLAG_CONTRACTS],["migrate",EXTENSION_MIGRATE_FLAG_CONTRACTS]]);function normalizeCommandNameForContracts(commandName){if(typeof commandName!=="string"){return""}return resolvePmHistoryOperation(commandName.trim().toLowerCase())}function hasSubcommandFlagContractsForCommand(commandName){const normalized=normalizeCommandNameForContracts(commandName);if(SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND.has(normalized)){return true}const[rootCommand,lifecycleSubcommand,...extraParts]=normalized.split(/\s+/);return(rootCommand==="extension"||rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand!==void 0&&extraParts.length===0&&(lifecycleSubcommand==="init"||lifecycleSubcommand==="scaffold"||EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND.has(lifecycleSubcommand))}function resolveExtensionLifecycleFlagContracts(rootCommand,lifecycleSubcommand){if(lifecycleSubcommand==="init"||lifecycleSubcommand==="scaffold"){return rootCommand==="extension"?EXTENSION_INIT_FLAG_CONTRACTS:PACKAGE_INIT_FLAG_CONTRACTS}return EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND.get(lifecycleSubcommand)??[]}function resolveSubcommandFlagContractsForCommand(commandName){const normalized=normalizeCommandNameForContracts(commandName);if(normalized.length===0){return withSubcommandGlobalFlags([])}const[rootCommand,lifecycleSubcommand,...extraParts]=normalized.split(/\s+/);if((rootCommand==="extension"||rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand!==void 0&&extraParts.length===0){if((rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand==="upgrade"){return withSubcommandGlobalFlags(UPGRADE_FLAG_CONTRACTS)}return withSubcommandGlobalFlags(resolveExtensionLifecycleFlagContracts(rootCommand,lifecycleSubcommand))}const contracts=SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND.get(normalized)??[];return withSubcommandGlobalFlags(contracts)}function toCompletionFlagString(flagContracts,includeGlobal=true){const aliasAwareContracts=withFlagAliasMetadata(flagContracts);const scoped=aliasAwareContracts.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value));const all=includeGlobal?[...scoped,...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value))]:scoped;return normalizeUniqueStringList(all).join(" ")}export{ACTIVITY_FLAG_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIG_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DELETE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_ATTEST_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,LEARNINGS_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_POSITIONAL_ACTION_FLAG_CONTRACTS,PROFILE_FLAG_CONTRACTS,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESTORE_FLAG_CONTRACTS,SCHEMA_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,TELEMETRY_FLAG_CONTRACTS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,WORKSPACE_POSITION_FLAG_CONTRACTS,compactFlagAliasContracts,hasSubcommandFlagContractsForCommand,resolvePmPositionalActionFlagContracts,resolveSubcommandFlagContractsForCommand,toCompletionFlagString,toUniqueFlagContracts,withFlagAliasMetadata};
|
|
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]="b649c6ff-2a51-564c-a4e7-beca2b6e193f")}catch(e2){}})();import{resolvePmHistoryOperation}from"./command-aliases.js";import{normalizeUniqueStringList}from"./string-lists.js";import{RESERVED_EXTENSION_HOST_FLAGS}from"../../core/extensions/reserved-host-flags.js";import{PM_POSITIONAL_ACTION_CONTRACTS}from"./grammar-contracts.js";function normalizeFlagAliasKey(flag){if(!flag.startsWith("--")){return flag}return`--${flag.slice(2).replaceAll("_","-")}`}function withFlagAliasMetadata(flagContracts){const aliasesByCanonical=new Map;for(const contract of flagContracts){const canonical=normalizeFlagAliasKey(contract.flag);const bucket=aliasesByCanonical.get(canonical)??new Set;if(contract.flag!==canonical){bucket.add(contract.flag)}for(const alias of contract.aliases??[]){if(alias!==canonical){bucket.add(alias)}}aliasesByCanonical.set(canonical,bucket)}return flagContracts.map(contract=>{const canonical=normalizeFlagAliasKey(contract.flag);if(contract.flag!==canonical){return contract}const aliases=normalizeUniqueStringList([...contract.aliases??[],...aliasesByCanonical.get(canonical)]).filter(alias=>alias!==canonical);if(aliases.length===0){return contract}return{...contract,aliases}})}function compactFlagAliasContracts(flagContracts){const withAliases=withFlagAliasMetadata(flagContracts);const canonicalFlags=new Set(withAliases.map(contract=>contract.flag));return withAliases.filter(contract=>{const canonical=normalizeFlagAliasKey(contract.flag);return contract.flag===canonical||!canonicalFlags.has(canonical)})}const SUBCOMMAND_GLOBAL_FLAG_CONTRACTS=RESERVED_EXTENSION_HOST_FLAGS.map(definition=>({flag:definition.flag,reservation_scope:"inherited",...definition.aliases?{aliases:[...definition.aliases]}:{},...definition.value_name?{value_name:definition.value_name}:{}}));const GLOBAL_FLAG_CONTRACTS=[...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,{flag:"--version",value_type:"boolean",reservation_scope:"root_only"},{flag:"--all",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help to every command."},{flag:"--explain",value_type:"boolean",reservation_scope:"root_only",description:"Expand root help with command guidance."}];const GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--has-notes"},{flag:"--no-notes"},{flag:"--has-learnings"},{flag:"--no-learnings"},{flag:"--has-files"},{flag:"--no-files"},{flag:"--filter-files-missing"},{flag:"--has-docs"},{flag:"--no-docs"},{flag:"--filter-docs-missing"},{flag:"--has-tests"},{flag:"--no-tests"},{flag:"--has-comments"},{flag:"--no-comments"},{flag:"--has-deps"},{flag:"--no-deps"},{flag:"--has-body"},{flag:"--empty-body"},{flag:"--has-linked-command"},{flag:"--no-linked-command"}];const MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS=[{flag:"--filter-reviewer-missing"},{flag:"--filter-risk-missing"},{flag:"--filter-confidence-missing"},{flag:"--filter-sprint-missing"},{flag:"--filter-release-missing"},{flag:"--filter-has-notes"},{flag:"--filter-no-notes"},{flag:"--filter-has-learnings"},{flag:"--filter-no-learnings"},{flag:"--filter-has-files"},{flag:"--filter-no-files"},{flag:"--filter-has-docs"},{flag:"--filter-no-docs"},{flag:"--filter-has-tests"},{flag:"--filter-no-tests"},{flag:"--filter-has-comments"},{flag:"--filter-no-comments"},{flag:"--filter-has-deps"},{flag:"--filter-no-deps"},{flag:"--filter-has-body"},{flag:"--filter-empty-body"},{flag:"--filter-has-linked-command"},{flag:"--filter-no-linked-command"},{flag:"--ids",list:true},{flag:"--limit"},{flag:"--offset"}];const LIST_FILTER_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--status",list:true},{flag:"--all",value_type:"boolean"},{flag:"--type",list:true},{flag:"--tag",aliases:["--tags"],list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--today"},{flag:"--recent"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--ids",list:true},{flag:"--assignee",list:true},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:true},{flag:"--release",list:true},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--limit"},{flag:"--offset"},{flag:"--after"},{flag:"--no-truncate"},{flag:"--compact"},{flag:"--brief"},{flag:"--full"},{flag:"--fields",list:true},{flag:"--sort"},{flag:"--order"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--include-body"},{flag:"--strict-read"},{flag:"--format"},{flag:"--stream"}],new Set(["--limit","--token-budget","--offset","--after","--no-truncate","--compact","--brief","--full","--fields","--include-body","--strict-read"]));const AGGREGATE_FLAG_CONTRACTS=[{flag:"--group-by",list:true},{flag:"--set-mode"},{flag:"--limit"},{flag:"--after"},{flag:"--count"},{flag:"--completion"},{flag:"--sum"},{flag:"--avg"},{flag:"--include-unparented"},{flag:"--include_unparented"},{flag:"--status",list:true},{flag:"--type",list:true},{flag:"--tag",list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--assignee",list:true},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--parent"},{flag:"--sprint",list:true},{flag:"--release",list:true}];const COMMENTS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--comment","--body","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];function withCursorSemantics(contracts,presentationFlags){return contracts.map(contract=>presentationFlags.has(contract.flag)?{...contract,cursor_semantics:"presentation"}:contract)}const NOTES_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--note","--text"]},{flag:"--add-json"},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--since"},{flag:"--event-type"},{flag:"--include-meta"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const LEARNINGS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add",aliases:["--learning","--text"]},{flag:"--stdin"},{flag:"--file"},{flag:"--edit"},{flag:"--delete"},{flag:"--limit"},{flag:"--full-history"},{flag:"--if-absent",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const FILES_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--append-stable"},{flag:"--validate-paths"},{flag:"--scope"},{flag:"--limit"},{flag:"--offset"},{flag:"--no-truncate"},{flag:"--strict-read"},{flag:"--explain"},{flag:"--lines",value_name:"start:end"},{flag:"--decision-depth",value_name:"n",value_type:"number"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const DOCS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-glob"},{flag:"--remove"},{flag:"--migrate"},{flag:"--note"},{flag:"--list"},{flag:"--validate-paths"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--limit"},{flag:"--compact"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--diff"},{flag:"--field"},{flag:"--verify"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--format"}];const MERGE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--message"},{flag:"--force"},{flag:"--include-reconciled"},{flag:"--output"},{flag:"--item-path"},{flag:"--prefer"}];const HISTORY_REDACT_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--literal"},{flag:"--regex"},{flag:"--replacement"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_REPAIR_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--all"},{flag:"--dry-run"},{flag:"--normalize-provenance"},{flag:"--salvage-tail",value_type:"boolean"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS=[{flag:"--event",repeatable:true},{flag:"--all-actionable"},{flag:"--dry-run"},{flag:"--plan-fingerprint"},{flag:"--limit",value_type:"number"},{flag:"--attributed-author",aliases:["--attributed_author"]},{flag:"--reviewer"},{flag:"--reason"}];const HISTORY_COMPACT_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--before"},{flag:"--ids",list:true},{flag:"--all-over",value_type:"number"},{flag:"--closed"},{flag:"--all-streams"},{flag:"--min-entries",value_type:"number"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const HISTORY_ATTEST_FLAG_CONTRACTS=[{flag:"--verify",value_name:"file",value_type:"string"},{flag:"--output",value_name:"file",value_type:"string"},{flag:"--hash-algorithm",value_name:"name",value_type:"string"}];const SCHEMA_FLAG_CONTRACTS=[{flag:"--definition",value_name:"json"},{flag:"--policy",value_name:"id"},{flag:"--message",value_name:"value"},{flag:"--description"},{flag:"--default-status",aliases:["--default_status"]},{flag:"--folder"},{flag:"--alias"},{flag:"--role"},{flag:"--order"},{flag:"--type"},{flag:"--commands"},{flag:"--cli-flag"},{flag:"--required"},{flag:"--required-on-create"},{flag:"--no-allow-unset"},{flag:"--required-types"},{flag:"--infer"},{flag:"--min-count"},{flag:"--apply",value_type:"boolean"},{flag:"--to"},{flag:"--migration-id",aliases:["--migration_id"]},{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}];const PROFILE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--author"},{flag:"--force"}];const PLAN_FLAG_CONTRACTS=[{flag:"--title"},{flag:"--description"},{flag:"--scope"},{flag:"--parent"},{flag:"--related"},{flag:"--blocks"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--harness"},{flag:"--mode"},{flag:"--resume-context",aliases:["--resume_context"]},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--priority"},{flag:"--status",short:"-s"},{flag:"--create-mode",aliases:["--create_mode"]},{flag:"--deadline"},{flag:"--estimate",aliases:["--estimated-minutes","--estimated_minutes"]},{flag:"--acceptance-criteria",aliases:["--acceptance_criteria","--ac"],repeatable:true},{flag:"--definition-of-ready",aliases:["--definition_of_ready"]},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now",aliases:["--why_now"]},{flag:"--assignee"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps",aliases:["--repro_steps"]},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--affected-version",aliases:["--affected_version"]},{flag:"--fixed-version",aliases:["--fixed_version"]},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact",aliases:["--customer_impact"]},{flag:"--comment",repeatable:true},{flag:"--note",repeatable:true},{flag:"--learning",repeatable:true},{flag:"--reminder",repeatable:true},{flag:"--event",repeatable:true},{flag:"--type-option",aliases:["--type_option"],repeatable:true},{flag:"--body"},{flag:"--claim"},{flag:"--from-search",aliases:["--from_search"]},{flag:"--template"},{flag:"--step-title",aliases:["--step_title"]},{flag:"--step"},{flag:"--step-body",aliases:["--step_body"]},{flag:"--step-owner",aliases:["--step_owner"]},{flag:"--step-status",aliases:["--step_status"]},{flag:"--step-evidence",aliases:["--step_evidence"]},{flag:"--step-blocked-reason",aliases:["--step_blocked_reason"]},{flag:"--step-replacement",aliases:["--step_replacement"]},{flag:"--depends-on",aliases:["--depends_on"]},{flag:"--link"},{flag:"--link-kind",aliases:["--link_kind"]},{flag:"--link-note",aliases:["--link_note"]},{flag:"--promote-to-item-dep",aliases:["--promote_to_item_dep"]},{flag:"--allow-multiple-active",aliases:["--allow_multiple_active"]},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--decision-text",aliases:["--decision_text","--decision"]},{flag:"--decision-rationale",aliases:["--decision_rationale"]},{flag:"--decision-evidence",aliases:["--decision_evidence"]},{flag:"--discovery-text",aliases:["--discovery_text","--discovery"]},{flag:"--validation-text",aliases:["--validation_text","--validation"]},{flag:"--validation-command",aliases:["--validation_command"]},{flag:"--validation-expected",aliases:["--validation_expected"]},{flag:"--depth"},{flag:"--field"},{flag:"--fields",list:true},{flag:"--steps"},{flag:"--materialize-type",aliases:["--materialize_type"]},{flag:"--materialize-parent",aliases:["--materialize_parent"]},{flag:"--materialize-tags",aliases:["--materialize_tags"]},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const INIT_FLAG_CONTRACTS=[{flag:"--id-prefix",aliases:["--prefix"]},{flag:"--preset"},{flag:"--type-preset"},{flag:"--defaults",short:"-y",aliases:["--yes"]},{flag:"--author"},{flag:"--agent-guidance"},{flag:"--with-packages"},{flag:"--no-merge-fence"},{flag:"--workspace"},{flag:"--force"},{flag:"--verbose"}];const CONFIG_FLAG_CONTRACTS=[{flag:"--value",value_name:"value"},{flag:"--criterion"},{flag:"--clear-criteria"},{flag:"--format"},{flag:"--policy"},{flag:"--default-depth"},{flag:"--activity-limit"},{flag:"--stale-threshold-days"},{flag:"--section-hierarchy"},{flag:"--section-activity"},{flag:"--section-progress"},{flag:"--section-blockers"},{flag:"--section-files"},{flag:"--section-workload"},{flag:"--section-staleness"},{flag:"--section-tests"}];const EXTENSION_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--init"},{flag:"--scaffold"},{flag:"--capability"},{flag:"--install"},{flag:"--uninstall"},{flag:"--explore"},{flag:"--list"},{flag:"--manage"},{flag:"--describe"},{flag:"--markdown"},{flag:"--output"},{flag:"--reload"},{flag:"--watch"},{flag:"--doctor"},{flag:"--catalog"},{flag:"--adopt"},{flag:"--adopt-all"},{flag:"--activate"},{flag:"--deactivate"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"},{flag:"--detail"},{flag:"--trace"},{flag:"--runtime-probe"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}];const EXTENSION_SCOPE_FLAG_CONTRACTS=[{flag:"--project"},{flag:"--local"},{flag:"--global"}];const EXTENSION_INIT_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--capability"}];const PACKAGE_FLAG_CONTRACTS=[...EXTENSION_FLAG_CONTRACTS,{flag:"--declarative"}];const PACKAGE_INIT_FLAG_CONTRACTS=[...EXTENSION_INIT_FLAG_CONTRACTS,{flag:"--declarative"}];const EXTENSION_INSTALL_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const EXTENSION_UNINSTALL_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_EXPLORE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_DESCRIBE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--markdown"},{flag:"--output"}];const EXTENSION_ADOPT_ALL_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_ACTIVATE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_DEACTIVATE_FLAG_CONTRACTS=EXTENSION_SCOPE_FLAG_CONTRACTS;const EXTENSION_MIGRATE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--dry-run"}];const EXTENSION_MANAGE_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--runtime-probe"},{flag:"--fix-managed-state"}];const EXTENSION_RELOAD_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--watch"}];const EXTENSION_DOCTOR_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--detail"},{flag:"--trace"},{flag:"--fix-managed-state"},{flag:"--isolated"},{flag:"--ignore-global"},{flag:"--strict-exit"},{flag:"--fail-on-warn"}];const EXTENSION_CATALOG_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--fields",list:true}];const EXTENSION_ADOPT_FLAG_CONTRACTS=[...EXTENSION_SCOPE_FLAG_CONTRACTS,{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const INSTALL_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--gh"},{flag:"--github"},{flag:"--ref"}];const UPGRADE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--cli-only"},{flag:"--packages-only"},{flag:"--project"},{flag:"--local"},{flag:"--global"},{flag:"--repair"},{flag:"--tag"},{flag:"--package-name"}];const REINDEX_FLAG_CONTRACTS=[{flag:"--mode"},{flag:"--progress"}];const CLOSE_FLAG_CONTRACTS=[{flag:"--release-assignment",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--reason",value_name:"value"},{flag:"--close-reason",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--duplicate-of",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",aliases:["--expected_result","--expected"],value_name:"value"},{flag:"--actual-result",aliases:["--actual_result","--actual"],value_name:"value"},{flag:"--force",value_type:"boolean"}];const CLOSE_MANY_FLAG_CONTRACTS=[{flag:"--filter-status",list:true},{flag:"--filter-type"},{flag:"--filter-tag"},{flag:"--filter-priority"},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee"},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint"},{flag:"--filter-release"},...MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--reason"},{flag:"--completed-at"},{flag:"--resolution"},{flag:"--expected-result",aliases:["--expected_result","--expected"]},{flag:"--actual-result",aliases:["--actual_result","--actual"]},{flag:"--validate-close"},{flag:"--author"},{flag:"--message"},{flag:"--force"},{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"}];const APPEND_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--body",short:"-b"},{flag:"--text"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const CLAIM_FLAG_CONTRACTS=[{flag:"--start",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"},{flag:"--if-available"},{flag:"--next"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee-filter"},{flag:"--parent"},{flag:"--sprint"},{flag:"--release"},{flag:"--max-attempts"},{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--explain-ranking",aliases:["--explain_ranking"]}];const RESTORE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const DELETE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--dry-run"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const RELEASE_FLAG_CONTRACTS=[{flag:"--pause",value_type:"boolean"},{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const START_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const PAUSE_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--force"}];const CLOSE_TASK_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--author",aliases:["--assignee"]},{flag:"--message"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--force"}];const SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS=[{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--tags"},{flag:"--priority"},{flag:"--body"},{flag:"--description"},{flag:"--author"},{flag:"--message"}];const MEET_FLAG_CONTRACTS=[{flag:"--start"},{flag:"--duration"},{flag:"--end"},{flag:"--location"},{flag:"--timezone"},{flag:"--all-day"},...SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS];const EVENT_FLAG_CONTRACTS=MEET_FLAG_CONTRACTS;const REMIND_FLAG_CONTRACTS=[{flag:"--at"},{flag:"--text"},...SCHEDULING_SHORTCUT_COMMON_FLAG_CONTRACTS];const TEST_FLAG_CONTRACTS=[{flag:"--list"},{flag:"--id",value_name:"item-id"},{flag:"--add"},{flag:"--add-json"},{flag:"--remove"},{flag:"--remove-index",repeatable:true},{flag:"--run"},{flag:"--match"},{flag:"--only-index"},{flag:"--only-last"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--acknowledge-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"},{flag:"--measure",list:true},{flag:"--metric-below"},{flag:"--metric-diff"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const TEST_ALL_FLAG_CONTRACTS=[{flag:"--status"},{flag:"--limit"},{flag:"--offset"},{flag:"--background"},{flag:"--timeout"},{flag:"--progress"},{flag:"--env-set"},{flag:"--env-clear"},{flag:"--shared-host-safe"},{flag:"--pm-context"},{flag:"--override-linked-pm-context"},{flag:"--workspace-context"},{flag:"--override-linked-workspace-context"},{flag:"--allow-untrusted-linked-tests"},{flag:"--fail-on-context-mismatch"},{flag:"--fail-on-skipped"},{flag:"--fail-on-empty-test-run"},{flag:"--require-assertions-for-pm"},{flag:"--check-context"},{flag:"--auto-pm-context"}];const TELEMETRY_FLAG_CONTRACTS=[{flag:"--limit"}];const TEST_RUNS_FLAG_CONTRACTS=[{flag:"--status"},{flag:"--limit"},{flag:"--stream"},{flag:"--tail"},{flag:"--force"},{flag:"--author"}];const GC_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--scope"}];const STATS_FLAG_CONTRACTS=[{flag:"--include-empty"},{flag:"--storage"},{flag:"--metadata-coverage"},{flag:"--field-utilization"},{flag:"--by-assignee"},{flag:"--by-tag"},{flag:"--by-priority"},{flag:"--tag-prefix"},{flag:"--analytics"}];const DUPLICATES_FLAG_CONTRACTS=[{flag:"--exhaustive",value_type:"boolean"},{flag:"--status",repeatable:true,list:true},{flag:"--since"},{flag:"--threshold"},{flag:"--limit"}];const HEALTH_FLAG_CONTRACTS=[{flag:"--strict-directories"},{flag:"--require-merge-drivers"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--check-only"},{flag:"--check-telemetry"},{flag:"--no-refresh"},{flag:"--refresh-vectors"},{flag:"--verbose-stale-items"},{flag:"--verbose-author-events"},{flag:"--brief"},{flag:"--summary"},{flag:"--skip-vectors"},{flag:"--skip-integrity"},{flag:"--skip-drift"},{flag:"--full"}];const VALIDATE_FLAG_CONTRACTS=[{flag:"--check-completeness",value_type:"boolean"},{flag:"--check-metadata"},{flag:"--metadata-profile"},{flag:"--check-resolution"},{flag:"--check-lifecycle"},{flag:"--check-stale-blockers"},{flag:"--dependency-cycle-severity"},{flag:"--parent-cycle-severity"},{flag:"--check-files"},{flag:"--scan-mode"},{flag:"--include-pm-internals"},{flag:"--verbose-file-lists"},{flag:"--verbose-diagnostics"},{flag:"--all-affected-ids"},{flag:"--strict-exit"},{flag:"--fail-on-warn"},{flag:"--fix-hints"},{flag:"--auto-fix"},{flag:"--dry-run"},{flag:"--fix-scope"},{flag:"--prune-missing"},{flag:"--check-history-drift"},{flag:"--check-command-references"},{flag:"--check-storage-integrity"},{flag:"--counts"},{flag:"--full"}];const ASSURANCE_FLAG_CONTRACTS=[{flag:"--definition",value_name:"json"},{flag:"--trigger",value_name:"value"},{flag:"--tree",value_name:"value"},{flag:"--gate",value_name:"id"},{flag:"--limit",value_name:"number"},{flag:"--dry-run"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--owner",value_name:"item-id"},{flag:"--apply",value_type:"boolean"},{flag:"--enforcement",value_name:"level"}];const ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS=[{flag:"--assignee"},{flag:"--parent"},{flag:"--allow-missing-parent"},{flag:"--allow-unresolved-deps"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--blocked-by"},{flag:"--blocked-reason"},{flag:"--unblock-note"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--actual-result"},{flag:"--affected-version"},{flag:"--fixed-version"}];const ITEM_PORTFOLIO_FLAG_CONTRACTS=[{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"}];const ITEM_CONTENT_METADATA_FLAG_CONTRACTS=[{short:"-p",flag:"--priority"},{flag:"--type"},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--add-tags",aliases:["--add_tags"]},{flag:"--remove-tags",aliases:["--remove_tags"]},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--add-ac",aliases:["--add_ac"]},{flag:"--remove-ac",aliases:["--remove_ac"]}];const CREATE_FLAG_CONTRACTS=[{flag:"--stdin-json"},{short:"-t",flag:"--title"},{flag:"--id"},{short:"-d",flag:"--description"},{flag:"--type"},{flag:"--template"},{flag:"--create-mode"},{flag:"--create_mode"},{flag:"--schedule-preset"},{flag:"--schedule_preset"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},{flag:"--completed_at"},{short:"-p",flag:"--priority"},{flag:"--tags",aliases:["--tag"],list:true},{flag:"--add-tags",aliases:["--add_tags"]},{short:"-b",flag:"--body"},{flag:"--body-file"},{flag:"--deadline"},{flag:"--estimate"},{flag:"--estimated-minutes"},{flag:"--estimated_minutes"},{flag:"--acceptance-criteria"},{flag:"--acceptance_criteria"},{flag:"--ac"},{flag:"--author"},{flag:"--message"},...ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS,...ITEM_PORTFOLIO_FLAG_CONTRACTS,{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--fixed_version"},{flag:"--dep"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--reminder"},{flag:"--event"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--allow-duplicate",value_type:"boolean"}];const ITEM_MUTATE_FLAG_CONTRACTS=[{flag:"--transaction-id",value_name:"value"},{flag:"--stdin-json"},{flag:"--dry-run"},{flag:"--create-compensation",value_name:"mode"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--author",value_name:"value"}];const ITEM_COMPLETE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--transaction-id",value_name:"value",required:true},{flag:"--reason",value_name:"value"},{flag:"--file",value_name:"value",repeatable:true},{flag:"--doc",value_name:"value",repeatable:true},{flag:"--test",value_name:"value",repeatable:true},{flag:"--comment",value_name:"value",repeatable:true},{flag:"--note",value_name:"value",repeatable:true},{flag:"--learning",value_name:"value",repeatable:true},{flag:"--resolution",value_name:"value"},{flag:"--expected-result",value_name:"value"},{flag:"--actual-result",value_name:"value"},{flag:"--completed-at",value_name:"value"},{flag:"--validate-close",value_name:"off|warn|strict"},{flag:"--lock-ttl-seconds",value_name:"n"},{flag:"--lock-wait-ms",value_name:"n"},{flag:"--dry-run"},{flag:"--force"},{flag:"--author",value_name:"value"}];const ITEM_REOPEN_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--status",value_name:"open|in_progress"},{flag:"--message",value_name:"value"},{flag:"--force"},{flag:"--author",value_name:"value"}];const COPY_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--title",value_name:"value"},{flag:"--author",value_name:"value"},{flag:"--message",value_name:"value"},{flag:"--allow-duplicate",value_type:"boolean"}];const FOCUS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--clear"}];const UPDATE_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--stdin-json"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},{flag:"--body-file"},{short:"-s",flag:"--status"},{flag:"--close-reason"},{flag:"--close_reason"},{flag:"--completed-at"},...ITEM_CONTENT_METADATA_FLAG_CONTRACTS,...ITEM_OWNERSHIP_AND_ISSUE_FLAG_CONTRACTS,{flag:"--fixed_version"},...ITEM_PORTFOLIO_FLAG_CONTRACTS,{flag:"--author"},{flag:"--message"},{flag:"--blocked_by"},{flag:"--blocked_reason"},{flag:"--unblock_note"},{flag:"--repro_steps"},{flag:"--expected_result"},{flag:"--actual_result"},{flag:"--expected"},{flag:"--actual"},{flag:"--affected_version"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file",aliases:["--linked-file"]},{flag:"--test",aliases:["--linked-test"]},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--field"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--force"}];const UPDATE_MANY_FLAG_CONTRACTS=[{flag:"--status",short:"-s"},{flag:"--assignee"},{flag:"--parent"},{flag:"--blocked-by",aliases:["--blocked_by"]},{flag:"--blocked-reason",aliases:["--blocked_reason"]},{flag:"--unblock-note",aliases:["--unblock_note"]},{flag:"--filter-status",list:true},{flag:"--filter-type",list:true},{flag:"--filter-tag",list:true},{flag:"--filter-priority",list:true},{flag:"--filter-deadline-before"},{flag:"--filter-deadline-after"},{flag:"--filter-updated-after"},{flag:"--filter-updated-before"},{flag:"--filter-created-after"},{flag:"--filter-created-before"},{flag:"--filter-assignee",list:true},{flag:"--filter-assignee-filter"},{flag:"--filter-assignee_filter"},{flag:"--filter-parent"},{flag:"--filter-sprint",list:true},{flag:"--filter-release",list:true},{flag:"--filter-ac-missing"},{flag:"--filter-estimates-missing",aliases:["--filter-estimate-missing"]},{flag:"--filter-resolution-missing"},{flag:"--filter-metadata-missing"},...MANY_GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS,{flag:"--dry-run"},{flag:"--rollback"},{flag:"--no-checkpoint"},{short:"-t",flag:"--title"},{short:"-d",flag:"--description"},{short:"-b",flag:"--body"},...ITEM_CONTENT_METADATA_FLAG_CONTRACTS,{flag:"--definition-of-ready"},{flag:"--definition_of_ready"},{flag:"--order"},{flag:"--rank"},{flag:"--goal"},{flag:"--objective"},{flag:"--value"},{flag:"--impact"},{flag:"--outcome"},{flag:"--why-now"},{flag:"--why_now"},{flag:"--reviewer"},{flag:"--risk"},{flag:"--confidence"},{flag:"--sprint"},{flag:"--release"},{flag:"--reporter"},{flag:"--severity"},{flag:"--environment"},{flag:"--repro-steps"},{flag:"--repro_steps"},{flag:"--resolution"},{flag:"--expected-result"},{flag:"--expected_result"},{flag:"--expected"},{flag:"--actual-result"},{flag:"--actual_result"},{flag:"--actual"},{flag:"--affected-version"},{flag:"--affected_version"},{flag:"--fixed-version"},{flag:"--fixed_version"},{flag:"--component"},{flag:"--regression"},{flag:"--customer-impact"},{flag:"--customer_impact"},{flag:"--allow-unresolved-deps"},{flag:"--dep"},{flag:"--dep-remove"},{flag:"--dep_remove"},{flag:"--replace-deps"},{flag:"--replace-tests"},{flag:"--replace-files"},{flag:"--replace-docs"},{flag:"--comment"},{flag:"--note"},{flag:"--learning"},{flag:"--file"},{flag:"--test"},{flag:"--doc"},{flag:"--reminder"},{flag:"--event"},{flag:"--type-option"},{flag:"--type_option"},{flag:"--unset"},{flag:"--clear-deps"},{flag:"--clear-comments"},{flag:"--clear-notes"},{flag:"--clear-learnings"},{flag:"--clear-files"},{flag:"--clear-tests"},{flag:"--clear-docs"},{flag:"--clear-reminders"},{flag:"--clear-events"},{flag:"--clear-type-options"},{flag:"--author"},{flag:"--message"},{flag:"--force"}];const CALENDAR_FLAG_CONTRACTS=[{flag:"--view"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--full-period"},{flag:"--full_period"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--status"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--include"},{flag:"--recurrence-lookahead-days"},{flag:"--recurrence-lookback-days"},{flag:"--occurrence-limit"},{flag:"--limit"},{flag:"--format"}];const ACTIVITY_FLAG_CONTRACTS=[{flag:"--id"},{flag:"--op"},{flag:"--author"},{flag:"--from"},{flag:"--to"},{flag:"--limit"},{flag:"--unbounded"},{flag:"--compact"},{flag:"--raw"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--stream"}];const EVENTS_FLAG_CONTRACTS=[{flag:"--since"},{flag:"--type",repeatable:true},{flag:"--author",repeatable:true},{flag:"--item",repeatable:true},{flag:"--limit",value_type:"number"},{flag:"--cursor-mode",value_name:"batch|row"},{flag:"--full"},{flag:"--provenance"},{flag:"--provenance-summary"},{flag:"--harness",repeatable:true},{flag:"--agent-instance",repeatable:true},{flag:"--provenance-filter",repeatable:true},{flag:"--follow"},{flag:"--interval-ms",value_type:"number"}];const CONTEXT_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--date"},{flag:"--from"},{flag:"--to"},{flag:"--past"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit",aliases:["--max-items"]},{flag:"--after"},{flag:"--format"},{flag:"--depth"},{flag:"--fields",list:true},{flag:"--section"},{flag:"--activity-limit"},{flag:"--stale-threshold"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--no-extension-health"},{flag:"--no-tags"}],new Set(["--limit","--after","--format","--fields","--section","--activity-limit","--stale-threshold","--explain-ranking","--explain_ranking","--no-extension-health","--no-tags"]));const GET_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--depth"},{flag:"--full",value_type:"boolean"},{flag:"--fields",list:true},{flag:"--at"},{flag:"--tree"},{flag:"--tree-depth"},{flag:"--tree_depth"},{flag:"--format"}];const GUIDE_FLAG_CONTRACTS=[{flag:"--list"},{flag:"--format"},{flag:"--depth"}];const DEPS_FLAG_CONTRACTS=[{flag:"--id",value_name:"item-id"},{flag:"--format"},{flag:"--max-depth"},{flag:"--collapse"},{flag:"--summary"},{flag:"--full"},{flag:"--node-limit"},{flag:"--edge-limit"},{flag:"--token-budget"},{flag:"--cursor"},{flag:"--direction"},{flag:"--kind",list:true}];const GRAPH_FLAG_CONTRACTS=[{flag:"--kind",list:true},{flag:"--max-depth"},{flag:"--limit"},{flag:"--after"},{flag:"--direction"},{flag:"--max-paths"},{flag:"--sample"},{flag:"--exempt-isolate",list:true},{flag:"--exempt-isolate-type",list:true},{flag:"--save-baseline"},{flag:"--rebuild"},{flag:"--clear"},{flag:"--summary"},{flag:"--full"}];const EVAL_FLAG_CONTRACTS=[{flag:"--mode"},{flag:"--k"},{flag:"--fail-under"},{flag:"--queries"},{flag:"--format"}];const WORKSPACE_FLAG_CONTRACTS=[{flag:"--dry-run"},{flag:"--force"},{flag:"--author"},{flag:"--message"}];const WORKSPACE_POSITION_FLAG_CONTRACTS=[];const NEXT_FLAG_CONTRACTS=[{flag:"--include-decisions"},{flag:"--include-gates"},{flag:"--include-containers"},{flag:"--for",value_name:"intent"},{flag:"--type"},{flag:"--tag"},{flag:"--priority"},{flag:"--assignee"},{flag:"--assignee-filter"},{flag:"--assignee_filter"},{flag:"--sprint"},{flag:"--release"},{flag:"--parent"},{flag:"--limit"},{flag:"--blocked-limit"},{flag:"--blocked_limit"},{flag:"--ready-only"},{flag:"--ready_only"},{flag:"--format"},{flag:"--explain-ranking"},{flag:"--explain_ranking"},{flag:"--token-budget",aliases:["--token_budget"]}];const SEARCH_FLAG_CONTRACTS=withCursorSemantics([{flag:"--for",value_name:"intent"},{flag:"--token-budget",aliases:["--token_budget"]},{flag:"--mode"},{flag:"--semantic"},{flag:"--hybrid"},{flag:"--match-mode"},{flag:"--min-score"},{flag:"--count"},{flag:"--semantic-weight"},{flag:"--include-linked"},{flag:"--title-exact"},{flag:"--phrase-exact"},{flag:"--highlight"},{flag:"--compact"},{flag:"--full"},{flag:"--fields",list:true},{flag:"--format"},{flag:"--limit"},{flag:"--after"},{flag:"--status",list:true},{flag:"--type",list:true},{flag:"--tag",aliases:["--tags"],list:true},{flag:"--priority",list:true},{flag:"--deadline-before"},{flag:"--deadline-after"},{flag:"--updated-after"},{flag:"--updated-before"},{flag:"--created-after"},{flag:"--created-before"},{flag:"--assignee",list:true},{flag:"--sprint",list:true},{flag:"--release",list:true},{flag:"--parent"},...GOVERNANCE_AND_CONTENT_FILTER_FLAG_CONTRACTS],new Set(["--highlight","--compact","--full","--fields","--format","--limit","--token-budget","--after"]));const CONTRACTS_FLAG_CONTRACTS=[{flag:"--action"},{flag:"--command"},{flag:"--summary"},{flag:"--schema-only"},{flag:"--flags-only"},{flag:"--availability-only"},{flag:"--runtime-only"},{flag:"--active-only"},{flag:"--full"}];const COMPLETION_FLAG_CONTRACTS=[{flag:"--eager-tags"}];function toUniqueFlagContracts(contracts){const seen=new Set;const unique=[];for(const contract of contracts){const aliasKey=(contract.aliases??[]).join(",");const key=`${contract.flag}|${contract.short??""}|${aliasKey}`;if(seen.has(key)){continue}seen.add(key);unique.push(contract)}return unique}function withSubcommandGlobalFlags(contracts){const byCanonicalFlag=new Map;for(const contract of[...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,...contracts]){const canonicalFlag=normalizeFlagAliasKey(contract.flag);const prior=byCanonicalFlag.get(canonicalFlag);const{aliases:declaredAliases,...contractWithoutAliases}=contract;const aliases=normalizeUniqueStringList([...declaredAliases??[],...contract.flag===canonicalFlag?[]:[contract.flag]]).filter(alias=>alias!==canonicalFlag);const normalizedContract={...contractWithoutAliases,flag:canonicalFlag,...aliases.length>0?{aliases}:{}};const mergedAliases=normalizeUniqueStringList([...prior?.aliases??[],...normalizedContract.aliases??[]]);byCanonicalFlag.set(canonicalFlag,prior===void 0?normalizedContract:{...prior,...normalizedContract,...mergedAliases.length>0?{aliases:mergedAliases}:{}})}return withFlagAliasMetadata([...byCanonicalFlag.values()])}const FIXED_STATUS_LIST_COMMAND_ALIASES=["list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"];const FIXED_STATUS_LIST_FLAG_CONTRACTS=LIST_FILTER_FLAG_CONTRACTS.filter(contract=>contract.flag!=="--status"&&contract.flag!=="--all");function indexCliFlagContracts(contracts){const index=new Map;for(const contract of contracts){for(const spelling of[contract.flag,...contract.aliases??[]]){const matches=index.get(spelling)??[];matches.push(contract);index.set(spelling,matches)}}return index}const PLAN_FLAG_CONTRACT_INDEX=indexCliFlagContracts(PLAN_FLAG_CONTRACTS);const ASSURANCE_FLAG_CONTRACT_INDEX=indexCliFlagContracts(ASSURANCE_FLAG_CONTRACTS);const POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT=new Map([["assurance",ASSURANCE_FLAG_CONTRACT_INDEX],["plan",PLAN_FLAG_CONTRACT_INDEX],["workspace",indexCliFlagContracts(WORKSPACE_POSITION_FLAG_CONTRACTS)],["workspace snapshot",indexCliFlagContracts(WORKSPACE_FLAG_CONTRACTS)]]);function resolvePmPositionalActionFlagContracts(actions=PM_POSITIONAL_ACTION_CONTRACTS){return actions.map(({command,parent,accepted_flags:acceptedFlags})=>{const parentFlagIndex=POSITIONAL_ACTION_FLAG_INDEX_BY_PARENT.get(parent);if(!parentFlagIndex){throw new Error(`Positional action ${command} has no flag-contract index for ${parent}.`)}const selected=acceptedFlags.map(acceptedFlag=>{const matches=parentFlagIndex.get(acceptedFlag)??[];if(matches.length!==1){throw new Error(`Positional action ${command} accepted flag ${acceptedFlag} does not resolve to exactly one ${parent} flag contract.`)}return matches[0]});return[command,selected]})}const PM_POSITIONAL_ACTION_FLAG_CONTRACTS=resolvePmPositionalActionFlagContracts();const SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND=new Map([["list",LIST_FILTER_FLAG_CONTRACTS],["list-all",LIST_FILTER_FLAG_CONTRACTS],...FIXED_STATUS_LIST_COMMAND_ALIASES.map(command=>[command,FIXED_STATUS_LIST_FLAG_CONTRACTS]),["templates",CREATE_FLAG_CONTRACTS],["cal",CALENDAR_FLAG_CONTRACTS],["ctx",CONTEXT_FLAG_CONTRACTS],["test-runs-worker",[]],["init",INIT_FLAG_CONTRACTS],["config",CONFIG_FLAG_CONTRACTS],["extension",EXTENSION_FLAG_CONTRACTS],["package",PACKAGE_FLAG_CONTRACTS],["packages",PACKAGE_FLAG_CONTRACTS],["install",INSTALL_FLAG_CONTRACTS],["upgrade",UPGRADE_FLAG_CONTRACTS],["create",CREATE_FLAG_CONTRACTS],["item",[]],["item mutate",ITEM_MUTATE_FLAG_CONTRACTS],["item complete",ITEM_COMPLETE_FLAG_CONTRACTS],["item reopen",ITEM_REOPEN_FLAG_CONTRACTS],["copy",COPY_FLAG_CONTRACTS],["focus",FOCUS_FLAG_CONTRACTS],["aggregate",AGGREGATE_FLAG_CONTRACTS],["calendar",CALENDAR_FLAG_CONTRACTS],["context",CONTEXT_FLAG_CONTRACTS],["get",GET_FLAG_CONTRACTS],["guide",GUIDE_FLAG_CONTRACTS],["search",SEARCH_FLAG_CONTRACTS],["next",NEXT_FLAG_CONTRACTS],["eval",EVAL_FLAG_CONTRACTS],["workspace",WORKSPACE_FLAG_CONTRACTS],["workspace position",WORKSPACE_POSITION_FLAG_CONTRACTS],["workspace snapshot",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot create",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot list",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot inspect",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot restore",WORKSPACE_FLAG_CONTRACTS],["workspace snapshot delete",WORKSPACE_FLAG_CONTRACTS],["history",HISTORY_FLAG_CONTRACTS],["history-redact",HISTORY_REDACT_FLAG_CONTRACTS],["history-repair",HISTORY_REPAIR_FLAG_CONTRACTS],["history-author-acknowledge",HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS],["history-compact",HISTORY_COMPACT_FLAG_CONTRACTS],["history-attest",HISTORY_ATTEST_FLAG_CONTRACTS],["merge",MERGE_FLAG_CONTRACTS],["schema",SCHEMA_FLAG_CONTRACTS],["profile",PROFILE_FLAG_CONTRACTS],["plan",PLAN_FLAG_CONTRACTS],["activity",ACTIVITY_FLAG_CONTRACTS],["events",EVENTS_FLAG_CONTRACTS],["restore",RESTORE_FLAG_CONTRACTS],["update",UPDATE_FLAG_CONTRACTS],["update-many",UPDATE_MANY_FLAG_CONTRACTS],["close",CLOSE_FLAG_CONTRACTS],["close-many",CLOSE_MANY_FLAG_CONTRACTS],["delete",DELETE_FLAG_CONTRACTS],["append",APPEND_FLAG_CONTRACTS],["comments",COMMENTS_FLAG_CONTRACTS],["notes",NOTES_FLAG_CONTRACTS],["learnings",LEARNINGS_FLAG_CONTRACTS],["files",FILES_FLAG_CONTRACTS],["docs",DOCS_FLAG_CONTRACTS],["deps",DEPS_FLAG_CONTRACTS],["graph",GRAPH_FLAG_CONTRACTS],["test",TEST_FLAG_CONTRACTS],["test-all",TEST_ALL_FLAG_CONTRACTS],["telemetry",TELEMETRY_FLAG_CONTRACTS],["health",HEALTH_FLAG_CONTRACTS],["assurance",ASSURANCE_FLAG_CONTRACTS],...PM_POSITIONAL_ACTION_FLAG_CONTRACTS,["validate",VALIDATE_FLAG_CONTRACTS],["gc",GC_FLAG_CONTRACTS],["stats",STATS_FLAG_CONTRACTS],["duplicates",DUPLICATES_FLAG_CONTRACTS],["contracts",CONTRACTS_FLAG_CONTRACTS],["completion",COMPLETION_FLAG_CONTRACTS],["claim",CLAIM_FLAG_CONTRACTS],["release",RELEASE_FLAG_CONTRACTS],["start-task",START_TASK_FLAG_CONTRACTS],["pause-task",PAUSE_TASK_FLAG_CONTRACTS],["close-task",CLOSE_TASK_FLAG_CONTRACTS],["meet",MEET_FLAG_CONTRACTS],["event",EVENT_FLAG_CONTRACTS],["remind",REMIND_FLAG_CONTRACTS]]);const EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND=new Map([["install",EXTENSION_INSTALL_FLAG_CONTRACTS],["uninstall",EXTENSION_UNINSTALL_FLAG_CONTRACTS],["explore",EXTENSION_EXPLORE_FLAG_CONTRACTS],["manage",EXTENSION_MANAGE_FLAG_CONTRACTS],["describe",EXTENSION_DESCRIBE_FLAG_CONTRACTS],["reload",EXTENSION_RELOAD_FLAG_CONTRACTS],["doctor",EXTENSION_DOCTOR_FLAG_CONTRACTS],["catalog",EXTENSION_CATALOG_FLAG_CONTRACTS],["list",EXTENSION_CATALOG_FLAG_CONTRACTS],["adopt",EXTENSION_ADOPT_FLAG_CONTRACTS],["adopt-all",EXTENSION_ADOPT_ALL_FLAG_CONTRACTS],["activate",EXTENSION_ACTIVATE_FLAG_CONTRACTS],["deactivate",EXTENSION_DEACTIVATE_FLAG_CONTRACTS],["migrate",EXTENSION_MIGRATE_FLAG_CONTRACTS]]);function normalizeCommandNameForContracts(commandName){if(typeof commandName!=="string"){return""}return resolvePmHistoryOperation(commandName.trim().toLowerCase())}function hasSubcommandFlagContractsForCommand(commandName){const normalized=normalizeCommandNameForContracts(commandName);if(SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND.has(normalized)){return true}const[rootCommand,lifecycleSubcommand,...extraParts]=normalized.split(/\s+/);return(rootCommand==="extension"||rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand!==void 0&&extraParts.length===0&&(lifecycleSubcommand==="init"||lifecycleSubcommand==="scaffold"||EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND.has(lifecycleSubcommand))}function resolveExtensionLifecycleFlagContracts(rootCommand,lifecycleSubcommand){if(lifecycleSubcommand==="init"||lifecycleSubcommand==="scaffold"){return rootCommand==="extension"?EXTENSION_INIT_FLAG_CONTRACTS:PACKAGE_INIT_FLAG_CONTRACTS}return EXTENSION_LIFECYCLE_FLAG_CONTRACTS_BY_SUBCOMMAND.get(lifecycleSubcommand)??[]}function resolveSubcommandFlagContractsForCommand(commandName){const normalized=normalizeCommandNameForContracts(commandName);if(normalized.length===0){return withSubcommandGlobalFlags([])}const[rootCommand,lifecycleSubcommand,...extraParts]=normalized.split(/\s+/);if((rootCommand==="extension"||rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand!==void 0&&extraParts.length===0){if((rootCommand==="package"||rootCommand==="packages")&&lifecycleSubcommand==="upgrade"){return withSubcommandGlobalFlags(UPGRADE_FLAG_CONTRACTS)}return withSubcommandGlobalFlags(resolveExtensionLifecycleFlagContracts(rootCommand,lifecycleSubcommand))}const contracts=SUBCOMMAND_FLAG_CONTRACTS_BY_COMMAND.get(normalized)??[];return withSubcommandGlobalFlags(contracts)}function toCompletionFlagString(flagContracts,includeGlobal=true){const aliasAwareContracts=withFlagAliasMetadata(flagContracts);const scoped=aliasAwareContracts.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value));const all=includeGlobal?[...scoped,...SUBCOMMAND_GLOBAL_FLAG_CONTRACTS.flatMap(entry=>[entry.short,entry.flag,...entry.aliases??[]]).filter(value=>Boolean(value))]:scoped;return normalizeUniqueStringList(all).join(" ")}export{ACTIVITY_FLAG_CONTRACTS,AGGREGATE_FLAG_CONTRACTS,APPEND_FLAG_CONTRACTS,ASSURANCE_FLAG_CONTRACTS,CALENDAR_FLAG_CONTRACTS,CLAIM_FLAG_CONTRACTS,CLOSE_FLAG_CONTRACTS,CLOSE_MANY_FLAG_CONTRACTS,CLOSE_TASK_FLAG_CONTRACTS,COMMENTS_FLAG_CONTRACTS,COMPLETION_FLAG_CONTRACTS,CONFIG_FLAG_CONTRACTS,CONTEXT_FLAG_CONTRACTS,CONTRACTS_FLAG_CONTRACTS,COPY_FLAG_CONTRACTS,CREATE_FLAG_CONTRACTS,DELETE_FLAG_CONTRACTS,DEPS_FLAG_CONTRACTS,DOCS_FLAG_CONTRACTS,DUPLICATES_FLAG_CONTRACTS,EVAL_FLAG_CONTRACTS,EVENTS_FLAG_CONTRACTS,EVENT_FLAG_CONTRACTS,EXTENSION_ACTIVATE_FLAG_CONTRACTS,EXTENSION_ADOPT_ALL_FLAG_CONTRACTS,EXTENSION_ADOPT_FLAG_CONTRACTS,EXTENSION_CATALOG_FLAG_CONTRACTS,EXTENSION_DEACTIVATE_FLAG_CONTRACTS,EXTENSION_DESCRIBE_FLAG_CONTRACTS,EXTENSION_DOCTOR_FLAG_CONTRACTS,EXTENSION_EXPLORE_FLAG_CONTRACTS,EXTENSION_FLAG_CONTRACTS,EXTENSION_INIT_FLAG_CONTRACTS,EXTENSION_INSTALL_FLAG_CONTRACTS,EXTENSION_MANAGE_FLAG_CONTRACTS,EXTENSION_MIGRATE_FLAG_CONTRACTS,EXTENSION_RELOAD_FLAG_CONTRACTS,EXTENSION_SCOPE_FLAG_CONTRACTS,EXTENSION_UNINSTALL_FLAG_CONTRACTS,FILES_FLAG_CONTRACTS,FOCUS_FLAG_CONTRACTS,GC_FLAG_CONTRACTS,GET_FLAG_CONTRACTS,GLOBAL_FLAG_CONTRACTS,GRAPH_FLAG_CONTRACTS,GUIDE_FLAG_CONTRACTS,HEALTH_FLAG_CONTRACTS,HISTORY_ATTEST_FLAG_CONTRACTS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS,HISTORY_COMPACT_FLAG_CONTRACTS,HISTORY_FLAG_CONTRACTS,HISTORY_REDACT_FLAG_CONTRACTS,HISTORY_REPAIR_FLAG_CONTRACTS,INIT_FLAG_CONTRACTS,INSTALL_FLAG_CONTRACTS,ITEM_COMPLETE_FLAG_CONTRACTS,ITEM_MUTATE_FLAG_CONTRACTS,ITEM_REOPEN_FLAG_CONTRACTS,LEARNINGS_FLAG_CONTRACTS,LIST_FILTER_FLAG_CONTRACTS,MEET_FLAG_CONTRACTS,MERGE_FLAG_CONTRACTS,NEXT_FLAG_CONTRACTS,NOTES_FLAG_CONTRACTS,PACKAGE_FLAG_CONTRACTS,PACKAGE_INIT_FLAG_CONTRACTS,PAUSE_TASK_FLAG_CONTRACTS,PLAN_FLAG_CONTRACTS,PM_POSITIONAL_ACTION_FLAG_CONTRACTS,PROFILE_FLAG_CONTRACTS,REINDEX_FLAG_CONTRACTS,RELEASE_FLAG_CONTRACTS,REMIND_FLAG_CONTRACTS,RESTORE_FLAG_CONTRACTS,SCHEMA_FLAG_CONTRACTS,SEARCH_FLAG_CONTRACTS,START_TASK_FLAG_CONTRACTS,STATS_FLAG_CONTRACTS,SUBCOMMAND_GLOBAL_FLAG_CONTRACTS,TELEMETRY_FLAG_CONTRACTS,TEST_ALL_FLAG_CONTRACTS,TEST_FLAG_CONTRACTS,TEST_RUNS_FLAG_CONTRACTS,UPDATE_FLAG_CONTRACTS,UPDATE_MANY_FLAG_CONTRACTS,UPGRADE_FLAG_CONTRACTS,VALIDATE_FLAG_CONTRACTS,WORKSPACE_FLAG_CONTRACTS,WORKSPACE_POSITION_FLAG_CONTRACTS,compactFlagAliasContracts,hasSubcommandFlagContractsForCommand,resolvePmPositionalActionFlagContracts,resolveSubcommandFlagContractsForCommand,toCompletionFlagString,toUniqueFlagContracts,withFlagAliasMetadata};
|
|
2
2
|
//# sourceMappingURL=flag-contracts.js.map
|
|
@@ -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]="3bb9b0da-78ce-5793-96e2-2de27b8f18fa")}catch(e2){}})();import{hasSubcommandFlagContractsForCommand,resolveSubcommandFlagContractsForCommand}from"./flag-contracts.js";import{PM_COMMAND_CAPABILITY_CONTRACTS}from"../agent-capability-contracts.js";import{PM_NAMESPACED_COMMAND_ALIASES,resolvePmCommandOperation}from"./command-aliases.js";import{enrichCliFlagInvocationContracts}from"../flag-invocation-contracts.js";let cachedPmFlagLexicon;const FULL_PROJECTION_CONCEPT_BY_COMMAND=Object.freeze({list:"list-item-projection","list-all":"list-item-projection","list-draft":"list-item-projection","list-open":"list-item-projection","list-in-progress":"list-item-projection","list-blocked":"list-item-projection","list-closed":"list-item-projection","list-canceled":"list-item-projection",get:"get-item-projection",graph:"graph-detail-projection",search:"search-result-projection",history:"history-entry-projection",events:"mutation-event-projection",activity:"activity-entry-projection",deps:"dependency-graph-projection",health:"health-diagnostic-projection",validate:"validation-diagnostic-projection",contracts:"contract-catalog-projection"});function resolvePmFlagSemanticConcept(command,flag){if(flag==="--limit")return"result-row-limit";if(flag==="--node-limit")return"graph-node-limit";if(flag==="--edge-limit")return"graph-edge-limit";if(flag==="--output-limit")return"rendered-output-row-limit";if(flag==="--output-budget")return"rendered-output-byte-budget";if(flag==="--token-budget")return"context-intent-token-budget";if(flag==="--full"){const concept=FULL_PROJECTION_CONCEPT_BY_COMMAND[resolvePmCommandOperation(command)];if(concept===void 0){throw new Error(`Command ${command} exposes --full without a registered projection concept.`)}return concept}if(flag!=="--file")return flag.slice(2);if(["create","update","update-many"].includes(resolvePmCommandOperation(command)))return"linked-file-path";if(["comments","notes","learnings"].includes(resolvePmCommandOperation(command)))return"entry-file-input";return"plan-definition-file"}function listPmFlagLexicon(){if(cachedPmFlagLexicon!==void 0)return cachedPmFlagLexicon;const commandContracts=PM_COMMAND_CAPABILITY_CONTRACTS.filter(({command})=>hasSubcommandFlagContractsForCommand(command));const provisionalEntries=commandContracts.flatMap(({command,family})=>enrichCliFlagInvocationContracts(command,resolveSubcommandFlagContractsForCommand(command)).map(contract=>({command,family,concept:resolvePmFlagSemanticConcept(command,contract.flag),flag:contract.flag,aliases:Object.freeze([...contract.aliases??[]]),value_kind:contract.repeatable?"list":contract.flag==="--limit"?"number":contract.value_type})));const compatibilityAliasFlags=new Set(provisionalEntries.flatMap(entry=>entry.aliases.map(alias=>`${entry.command}:${alias}`)));const canonicalEntries=provisionalEntries.filter(entry=>!compatibilityAliasFlags.has(`${entry.command}:${entry.flag}`));const kindsByConcept=new Map;for(const entry of canonicalEntries){const kinds=kindsByConcept.get(entry.concept)??new Set;kinds.add(entry.value_kind);kindsByConcept.set(entry.concept,kinds)}cachedPmFlagLexicon=Object.freeze(canonicalEntries.map(entry=>Object.freeze({...entry,concept:kindsByConcept.get(entry.concept)?.size===1?entry.concept:`${entry.concept}@${entry.command}`})));return cachedPmFlagLexicon}function listPmFlagSpellingInventory(){return Object.freeze(listPmFlagLexicon().map(entry=>Object.freeze({command:entry.command,canonical_flag:entry.flag,accepted_spellings:Object.freeze([...new Set([entry.flag,...entry.aliases])].sort())})))}const LEGACY_COMMAND_FLAG_BUDGET_MAXIMUMS=Object.freeze({init:30,item:20,config:36,extension:54,package:55,packages:55,install:27,upgrade:29,create:100,copy:24,focus:22,list:86,"list-all":86,"list-draft":84,"list-open":84,"list-in-progress":84,"list-blocked":84,"list-closed":84,"list-canceled":84,aggregate:40,context:45,ctx:45,get:30,graph:34,search:78,duplicates:25,eval:25,next:38,history:35,events:33,"history-attest":23,"history-redact":27,"history-repair":27,"history-compact":30,"history-author-acknowledge":28,merge:27,schema:43,profile:22,activity:35,restore:23,update:105,"update-many":146,close:32,"close-many":72,delete:24,append:25,comments:31,notes:35,learnings:31,files:39,docs:30,deps:32,plan:109,test:53,"test-all":40,telemetry:21,stats:29,health:36,validate:46,assurance:30,gc:22,workspace:23,contracts:29,claim:39,release:24,"start-task":23,"pause-task":23,"close-task":24,meet:33,event:33,remind:29,"test-runs-worker":20});const PM_COMMAND_FLAG_BUDGET_MAXIMUMS=Object.freeze({...LEGACY_COMMAND_FLAG_BUDGET_MAXIMUMS,...Object.fromEntries(PM_NAMESPACED_COMMAND_ALIASES.flatMap(({alias,canonical})=>{const maximum=LEGACY_COMMAND_FLAG_BUDGET_MAXIMUMS[alias];return maximum===void 0?[]:[[canonical,maximum]]}))});function listPmCommandFlagBudgets(){const currentByCommand=new Map(Object.keys(PM_COMMAND_FLAG_BUDGET_MAXIMUMS).map(command=>[command,0]));for(const{command}of listPmFlagLexicon()){currentByCommand.set(command,Number(currentByCommand.get(command))+1)}return Object.freeze(Object.entries(PM_COMMAND_FLAG_BUDGET_MAXIMUMS).map(([command,maximum])=>Object.freeze({command,current:Number(currentByCommand.get(command)),maximum})))}function appendAliasCollisionFindings(entries,canonicalOwners,findings){for(const entry of entries){for(const alias of entry.aliases){const owner=canonicalOwners.get(`${entry.command}:${alias}`);if(owner===void 0||owner.flag===entry.flag)continue;findings.push({code:"alias_collision",command:entry.command,detail:`${alias} aliases ${entry.flag} but is canonical for ${owner.flag}.`})}}}function appendBudgetFindings(counts,budgets,findings){const budgetedCommands=new Set(budgets.map(({command})=>command));for(const command of counts.keys()){if(budgetedCommands.has(command))continue;findings.push({code:"missing_budget",command,detail:`${command} has canonical flags but no persisted budget.`})}for(const budget of budgets){const actual=counts.get(budget.command)??0;if(actual===0){findings.push({code:"stale_budget",command:budget.command,detail:`${budget.command} has a persisted budget but no canonical flags.`})}if(actual<=budget.maximum)continue;findings.push({code:"budget_exceeded",command:budget.command,detail:`${actual} canonical flags exceed the ratcheted maximum ${budget.maximum}.`})}}function appendSpellingCompatibilityFindings(entries,baseline,findings){const current=new Map(entries.map(entry=>[`${entry.command}:${entry.flag}`,entry]));for(const historical of baseline){const key=`${historical.command}:${historical.canonical_flag}`;const entry=current.get(key);if(!entry){findings.push({code:"removed_canonical_spelling",command:historical.command,detail:`${historical.canonical_flag} disappeared from the executable spelling inventory.`});continue}const accepted=new Set([entry.flag,...entry.aliases]);for(const spelling of historical.accepted_spellings){if(accepted.has(spelling))continue;findings.push({code:"removed_compatibility_spelling",command:historical.command,detail:`${spelling} no longer resolves to ${historical.canonical_flag}.`})}}}function verifyPmFlagLexicon(entries=listPmFlagLexicon(),budgets=listPmCommandFlagBudgets(),baseline=[]){const findings=[];const canonicalOwners=new Map;const conceptKinds=new Map;const conceptSpellings=new Map;const counts=new Map;for(const entry of entries){const commandFlag=`${entry.command}:${entry.flag}`;if(canonicalOwners.has(commandFlag)){findings.push({code:"duplicate_canonical_flag",command:entry.command,detail:`${entry.flag} has more than one canonical row.`})}else{canonicalOwners.set(commandFlag,entry)}counts.set(entry.command,(counts.get(entry.command)??0)+1);const priorKind=conceptKinds.get(entry.concept);if(priorKind!==void 0&&priorKind!==entry.value_kind){findings.push({code:"inconsistent_concept_kind",command:entry.command,detail:`${entry.concept} uses both ${priorKind} and ${entry.value_kind}.`})}else{conceptKinds.set(entry.concept,entry.value_kind)}const priorSpelling=conceptSpellings.get(entry.concept);if(priorSpelling!==void 0&&priorSpelling!==entry.flag){findings.push({code:"semantic_spelling_collision",command:entry.command,detail:`${entry.concept} is canonicalized by both ${priorSpelling} and ${entry.flag}.`})}else{conceptSpellings.set(entry.concept,entry.flag)}}appendAliasCollisionFindings(entries,canonicalOwners,findings);appendBudgetFindings(counts,budgets,findings);appendSpellingCompatibilityFindings(entries,baseline,findings);findings.sort((left,right)=>left.command.localeCompare(right.command)||left.code.localeCompare(right.code)||left.detail.localeCompare(right.detail));return{ok:findings.length===0,entry_count:entries.length,budget_count:budgets.length,concept_count:new Set(entries.map(({concept})=>concept)).size,baseline_entry_count:baseline.length,findings}}function renderPmFlagLexiconMarkdown(){const lexicon=listPmFlagLexicon();const budgets=listPmCommandFlagBudgets();const familyByCommand=new Map(budgets.map(({command})=>[command,"unknown"]));for(const{command,family}of lexicon)familyByCommand.set(command,family);const rows=budgets.map(({command,current,maximum})=>{const family=familyByCommand.get(command);return`| \`${command}\` | ${family} | ${current} | ${maximum} |`});return["# Generated flag lexicon budgets","","This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not consume canonical budget.","","| Command | Capability family | Canonical flags | Maximum |","| --- | --- | ---: | ---: |",...rows,""].join("\n")}export{listPmCommandFlagBudgets,listPmFlagLexicon,listPmFlagSpellingInventory,renderPmFlagLexiconMarkdown,resolvePmFlagSemanticConcept,verifyPmFlagLexicon};
|
|
2
2
|
//# sourceMappingURL=flag-lexicon-contracts.js.map
|