@unbrained/pm-cli 2026.9.10 → 2026.9.11
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 +31 -11
- package/dist/cli/command-namespaces.d.ts +2 -2
- package/dist/cli/command-namespaces.js +1 -1
- package/dist/cli/extension-command-help.js +3 -3
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.js +2 -2
- package/dist/cli/register-history-maintenance.js +2 -1
- package/dist/cli/register-list-query.js +2 -2
- package/dist/cli-bundle/bundle-manifest.json +147 -155
- package/dist/cli-bundle/chunks/{chunk-EOCKPCEY.js → chunk-BN5QVWNY.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-DAWH7TGV.js +3 -0
- package/dist/cli-bundle/chunks/chunk-FBY6PEIR.js +20 -0
- package/dist/cli-bundle/chunks/chunk-IRUNFLLG.js +2 -0
- package/dist/cli-bundle/chunks/chunk-JMQKJ7CJ.js +8 -0
- package/dist/cli-bundle/chunks/{chunk-I6XT3DLQ.js → chunk-QER6OSOP.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-RJQSCK74.js +6 -0
- package/dist/cli-bundle/chunks/chunk-RJZFAXBW.js +235 -0
- package/dist/cli-bundle/chunks/{chunk-MACGGTLQ.js → chunk-SGAKQIGQ.js} +29 -29
- package/dist/cli-bundle/chunks/{chunk-NKOYVKFM.js → chunk-TDKWJQD7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4SFBH77G.js → chunk-TFVKBJJ4.js} +164 -150
- package/dist/cli-bundle/chunks/{chunk-PYUITRSV.js → chunk-VFKBNGF6.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-CUIW7SSE.js → register-list-query-U6MY437C.js} +6 -6
- package/dist/cli-bundle/chunks/{register-mutation-5F5CYUWZ.js → register-mutation-HAPHD4S7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-XIZPLPQY.js → register-operations-EHWIZW3X.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-JVGPCAIL.js → register-setup-BZYL3HBL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZJHYQOTM.js → chunk-3JVTLBCW.js} +4 -4
- package/dist/cli-bundle/focused-chunks/chunk-6JF66HAG.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-SL5YVVPV.js → chunk-7WISPJRZ.js} +53 -52
- package/dist/cli-bundle/focused-chunks/chunk-BEQAW7OT.js +12 -0
- package/dist/cli-bundle/focused-chunks/{chunk-CRY5MHEI.js → chunk-DZ3ATEFS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FHUARRMA.js → chunk-FJDEFA64.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7N5MRONP.js → chunk-GKUF7TM5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-U5SHHU7E.js → chunk-HM6JS6Q3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-M74YW332.js +164 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZDNAWWQI.js → chunk-MOT32PR2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ONDKO4EL.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M36SF4GE.js → chunk-TGMSSI3Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-TWE3GPQM.js +30 -0
- package/dist/cli-bundle/focused-chunks/chunk-UJCQXUD2.js +8 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ZAWAL2CG.js → chunk-VS6MR2HT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5YU75QLV.js → chunk-YOPNRWSX.js} +2 -2
- package/dist/cli-bundle/main.js +21 -21
- 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 +37 -37
- 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 +10 -10
- package/dist/core/history/digest.d.ts +12 -0
- package/dist/core/history/digest.js +2 -0
- package/dist/core/history/drift-scan.js +1 -1
- package/dist/core/history/history.d.ts +5 -3
- package/dist/core/history/history.js +2 -2
- package/dist/core/history/replay.d.ts +3 -2
- package/dist/core/history/replay.js +1 -1
- package/dist/core/telemetry/runtime.d.ts +1 -0
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/sdk/agent/command-recovery.js +1 -1
- package/dist/sdk/agent/item-addressing.js +1 -1
- package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
- package/dist/sdk/agent-capability-contracts.js +1 -1
- package/dist/sdk/cli-bootstrap.d.ts +2 -1
- package/dist/sdk/cli-bootstrap.js +1 -1
- package/dist/sdk/cli-contracts/command-aliases.d.ts +2 -0
- package/dist/sdk/cli-contracts/command-aliases.js +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
- 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/cli-contracts/tool-schema.d.ts +2 -2
- package/dist/sdk/cli-contracts/tool-schema.js +1 -1
- package/dist/sdk/cli-contracts.d.ts +1 -1
- package/dist/sdk/cli-contracts.js +1 -1
- package/dist/sdk/completion.d.ts +2 -0
- package/dist/sdk/completion.js +26 -14
- package/dist/sdk/contracts.d.ts +1 -0
- package/dist/sdk/contracts.js +1 -1
- package/dist/sdk/governance.d.ts +3 -0
- package/dist/sdk/governance.js +1 -1
- package/dist/sdk/history/attestation-command.d.ts +22 -0
- package/dist/sdk/history/attestation-command.js +3 -0
- package/dist/sdk/history/attestation-contract.d.ts +103 -0
- package/dist/sdk/history/attestation-contract.js +2 -0
- package/dist/sdk/history/attestation-scan.d.ts +16 -0
- package/dist/sdk/history/attestation-scan.js +2 -0
- package/dist/sdk/history/attestation.d.ts +8 -0
- package/dist/sdk/history/attestation.js +2 -0
- package/dist/sdk/history/salvage.js +1 -1
- package/dist/sdk/history-compact.js +1 -1
- package/dist/sdk/history-read.js +1 -1
- package/dist/sdk/history-redact.js +1 -1
- package/dist/sdk/history-repair.js +1 -1
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/dist/sdk/read-output-budget.d.ts +4 -10
- package/dist/sdk/read-output-budget.js +1 -1
- package/dist/sdk/read-output-contracts.d.ts +1 -1
- package/dist/sdk/read-output-contracts.js +1 -1
- package/dist/sdk/read-output-session.d.ts +1 -1
- package/dist/sdk/read-output-session.js +1 -1
- package/dist/sdk/runtime-input.js +1 -1
- package/dist/sdk/runtime.d.ts +3 -0
- package/dist/sdk/runtime.js +1 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.js +1 -1
- package/docs/CLI_GRAMMAR.md +23 -0
- package/docs/HISTORY_ATTESTATION.md +164 -0
- package/docs/README.md +1 -0
- package/docs/READ_OUTPUT_CONTRACTS.md +13 -0
- package/docs/generated/AGENT_CAPABILITY_ROUTING.md +4 -4
- package/docs/generated/AGENT_COMMAND_SURFACE.md +5 -0
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +5 -0
- package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -4
- package/marketplace.json +2 -2
- package/package.json +4 -4
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/README.md +9 -7
- package/packages/pm-governance-audit/extensions/governance-audit/index.ts +6 -3
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +7 -19
- 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/README.md +9 -5
- package/packages/pm-search-advanced/extensions/search-advanced/index.ts +3 -2
- 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-74RGSPLL.js +0 -2
- package/dist/cli-bundle/chunks/chunk-7WIHZI2M.js +0 -5
- package/dist/cli-bundle/chunks/chunk-GLQMKUGP.js +0 -2
- package/dist/cli-bundle/chunks/chunk-P6BEYAON.js +0 -8
- package/dist/cli-bundle/chunks/chunk-TSWEX72T.js +0 -20
- package/dist/cli-bundle/chunks/chunk-YKQTETJI.js +0 -235
- package/dist/cli-bundle/focused-chunks/chunk-26O2WB73.js +0 -10
- package/dist/cli-bundle/focused-chunks/chunk-B2CMFYRZ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-F6WKFXBT.js +0 -8
- package/dist/cli-bundle/focused-chunks/chunk-OROZM37I.js +0 -177
- package/dist/cli-bundle/focused-chunks/chunk-PNGYYQY7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-TPOL4TWE.js +0 -9
- package/dist/cli-bundle/focused-chunks/chunk-XSMA2W6Q.js +0 -12
|
@@ -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]="41d33f0e-f925-54da-a75d-52a73dd76f38")}catch(e2){}})();import{PLAN_SUBCOMMANDS}from"../lifecycle/plan.js";import{PROFILE_SUBCOMMANDS}from"../profile.js";import{SCHEMA_SUBCOMMANDS}from"../schema.js";import{GRAPH_SUBCOMMAND_VALUES,MERGE_SUBCOMMAND_VALUES}from"../cli-contracts/enum-contracts.js";import{PM_COMMAND_DESTINATION_CONTRACTS,PM_COMMAND_POSITIONAL_CONTRACTS,PM_POSITIONAL_ACTION_CONTRACTS}from"../cli-contracts/grammar-contracts.js";import{resolveSubcommandFlagContractsForCommand}from"../cli-contracts/flag-contracts.js";import{resolvePmCommandOperation}from"../cli-contracts/command-aliases.js";const REJECTED_ACTION="not-a-declared-action";function positionalPlaceholder(command,slot){if(command.startsWith("assurance ")&&slot.name==="kind"){return"measurement"}switch(slot.value_kind){case"integer":return"1";case"item_id":return"pm-domain";case"action":throw new Error(`Cannot synthesize a preceding action value for positional slot ${slot.name}.`);default:return"example"}}function probeSlug(value){return value.replaceAll(/[^a-z0-9]+/gu,"-").replaceAll(/^-|-$/gu,"")}function listPmRequiredArgumentRefusalContracts(contracts=PM_COMMAND_POSITIONAL_CONTRACTS.filter(contract=>PM_COMMAND_DESTINATION_CONTRACTS.some(destination=>destination.command===contract.command&&destination.disposition!=="package_owned"))){const rootProbeSlugs=new Set(contracts.filter(({command})=>!command.includes(" ")).map(({command})=>probeSlug(command)));return contracts.flatMap(contract=>contract.slots.flatMap((slot,index)=>{if(!slot.required)return[];const commandArguments=contract.command.split(" ");const commandSlug=probeSlug(contract.command);const commandProbeId=commandArguments.length>1&&rootProbeSlugs.has(commandSlug)?commandArguments.map(probeSlug).join("--"):commandSlug;const requiredFlagArguments=resolveSubcommandFlagContractsForCommand(contract.command).flatMap(flagContract=>flagContract.required?[flagContract.flag,...flagContract.value_name?["example"]:[]]:[]);const isVirtualAction=PM_POSITIONAL_ACTION_CONTRACTS.some(actionContract=>actionContract.command===contract.command);return[{probe_id:`required-argument-${commandProbeId}-${probeSlug(slot.name)}`,command:contract.command,refusal_args:[...commandArguments,...contract.slots.slice(0,index).map(priorSlot=>positionalPlaceholder(contract.command,priorSlot)),...requiredFlagArguments],recovery_args:[...commandArguments,"--help"],error_code:isVirtualAction&&!contract.command.startsWith("assurance ")?"invalid_argument_value":/^extension (?:activate|adopt|deactivate|uninstall)$/u.test(contract.command)?"missing_lifecycle_target":"missing_required_argument",missing_argument:slot.name,missing_argument_index:index}]})).sort((left,right)=>left.probe_id.localeCompare(right.probe_id))}function positionalActionValues(command){switch(resolvePmCommandOperation(command)){case"assurance":case"workspace snapshot":return PM_POSITIONAL_ACTION_CONTRACTS.filter(({parent})=>parent===command).map(({action})=>action);case"graph":return GRAPH_SUBCOMMAND_VALUES;case"merge":return MERGE_SUBCOMMAND_VALUES;case"plan":return PLAN_SUBCOMMANDS;case"profile":return PROFILE_SUBCOMMANDS;case"schema":return SCHEMA_SUBCOMMANDS;default:throw new Error(`Required positional action family ${command} has no authoritative value domain.`)}}function listPmSubcommandRefusalContracts(contracts=PM_COMMAND_POSITIONAL_CONTRACTS){return contracts.filter(({slots})=>slots[0]?.required===true&&slots[0].value_kind==="action").map(({command})=>{const commandArguments=command.split(" ");return{probe_id:`unknown-subcommand-${probeSlug(command)}`,command,refusal_args:[...commandArguments,REJECTED_ACTION],recovery_args:[...commandArguments,"--help"],error_code:"unknown_subcommand",rejected_value:REJECTED_ACTION,allowed_values:[...positionalActionValues(command)].sort()}}).sort((left,right)=>left.probe_id.localeCompare(right.probe_id))}function sameValues(left,right){const sortedRight=[...right].sort();return left.length===right.length&&[...left].sort().every((value,index)=>value===sortedRight[index])}function scoreGrammarRefusalObservation(contract,observation){if(!observation){return[{code:"refusal_probe_missing",probe_id:contract.probe_id,detail:`${contract.probe_id} has no runtime observation.`}]}const findings=[];if(observation.error_code!==contract.error_code){findings.push({code:"refusal_error_code_mismatch",probe_id:contract.probe_id,detail:`${contract.probe_id} emitted ${observation.error_code||"<none>"}; expected ${contract.error_code}.`})}if(observation.exit_code!==2){findings.push({code:"refusal_exit_code_mismatch",probe_id:contract.probe_id,detail:`${contract.probe_id} exited ${observation.exit_code}; expected usage exit 2.`})}if("allowed_values"in contract&&!sameValues(observation.allowed_values,contract.allowed_values)){findings.push({code:"refusal_allowed_values_mismatch",probe_id:contract.probe_id,detail:`${contract.probe_id} did not expose its complete action domain.`})}if(!observation.recovery_succeeded){findings.push({code:"refusal_recovery_failed",probe_id:contract.probe_id,detail:`${contract.probe_id} help recovery did not succeed.`})}if(observation.refusal_mutated_state){findings.push({code:"refusal_mutated_state",probe_id:contract.probe_id,detail:`${contract.probe_id} changed tracker state while refusing input${observation.mutated_paths?.length?`: ${observation.mutated_paths.join(", ")}`:"."}`})}return findings}function scorePmGrammarRefusalClosure(contracts,observations){const contractsById=new Map(contracts.map(contract=>[contract.probe_id,contract]));const observationsById=new Map(observations.map(observation=>[observation.probe_id,observation]));const findings=[...contracts.flatMap(contract=>scoreGrammarRefusalObservation(contract,observationsById.get(contract.probe_id))),...observations.filter(observation=>!contractsById.has(observation.probe_id)).map(observation=>({code:"unexpected_refusal_probe",probe_id:observation.probe_id,detail:`${observation.probe_id} has no declared grammar refusal contract.`}))];findings.sort((left,right)=>left.probe_id.localeCompare(right.probe_id)||left.code.localeCompare(right.code));const failedProbeIds=new Set(findings.map(({probe_id:probeId})=>probeId));return{ok:findings.length===0,probe_count:contracts.length,closed_probe_count:contracts.filter(({probe_id:probeId})=>!failedProbeIds.has(probeId)).length,findings}}export{listPmRequiredArgumentRefusalContracts,listPmSubcommandRefusalContracts,scorePmGrammarRefusalClosure};
|
|
2
2
|
//# sourceMappingURL=refusal-corpus-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]="498f7dad-b360-5494-ab5e-7ed5cd319207")}catch(e2){}})();import{PM_CORE_COMMAND_NAMES}from"./cli-contracts/enum-contracts.js";import{PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,resolvePmCommandOperation}from"./cli-contracts/command-aliases.js";const CORE_COMMANDS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate"]);const STANDARD_COMMANDS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]);const COMMANDS_BY_FAMILY=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])});const EXTENSION_COMMANDS=new Set(["extension","install","package","packages","upgrade"]);function resolvePmCommandCapabilityFamily(command){const normalized=resolvePmCommandOperation(command.trim().toLowerCase());if(normalized==="ops")return"quality";for(const[family,commands]of Object.entries(COMMANDS_BY_FAMILY)){if(commands.has(normalized))return family}return EXTENSION_COMMANDS.has(normalized)?"extensions":"internal"}const PM_COMMAND_CAPABILITY_CONTRACTS=Object.freeze([...PM_CORE_COMMAND_NAMES.flatMap(command=>command==="item"?["item-reopen"]:[command,...PM_NAMESPACED_COMMAND_ALIASES.filter(alias=>alias.alias===command).map(alias=>alias.canonical)]).map(command=>({command,tier:CORE_COMMANDS.has(resolvePmCommandOperation(command))?"core":STANDARD_COMMANDS.has(resolvePmCommandOperation(command))?"standard":"full",family:resolvePmCommandCapabilityFamily(command)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"}]);const PM_COMMAND_VISIBILITY_CONTRACTS=PM_COMMAND_CAPABILITY_CONTRACTS;const PM_CORE_HELP_BUDGET=Object.freeze({max_lines:50,max_utf8_bytes:6e3});const PM_CORE_HELP_OPTION_FLAGS=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function measurePmCoreHelp(text){const lines=text===""?0:text.split(/\r?\n/).length;const utf8Bytes=Buffer.byteLength(text,"utf8");return{lines,utf8_bytes:utf8Bytes,within_budget:lines<=PM_CORE_HELP_BUDGET.max_lines&&utf8Bytes<=PM_CORE_HELP_BUDGET.max_utf8_bytes}}const TIER_ORDER={core:0,standard:1,full:2,internal:3};const COMMAND_TIER_BY_NAME=new Map(PM_COMMAND_VISIBILITY_CONTRACTS.map(({command,tier})=>[command,tier]));function resolvePmCommandVisibilityTier(command,extensionTier="standard"){return COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase())??extensionTier}function listPmCommandsForTier(tier){return listPmCommandsForTierFromContracts(tier,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForTierFromContracts(tier,contracts){const maximum=TIER_ORDER[tier];return contracts.filter(entry=>entry.tier!=="internal"&&TIER_ORDER[entry.tier]<=maximum).map(entry=>entry.command)}function listPmCommandsForFamily(family){return listPmCommandsForFamilyFromContracts(family,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForFamilyFromContracts(family,contracts){return contracts.filter(entry=>entry.family===family).map(entry=>entry.command)}const CAPABILITY_FAMILY_ORDER=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"];const CAPABILITY_ROUTING_EXCLUDED_ALIASES=new Set([...PM_COMMAND_ALIAS_CONTRACTS.filter(alias=>alias.hidden).map(alias=>alias.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function listPmCommandCapabilityGroups(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){return CAPABILITY_FAMILY_ORDER.map(family=>({family,commands:listPmCommandsForFamilyFromContracts(family,contracts).filter(command=>contracts.find(entry=>entry.command===command)?.tier!=="internal"&&!CAPABILITY_ROUTING_EXCLUDED_ALIASES.has(command))})).filter(({commands})=>commands.length>0)}const PM_MCP_TOOL_COMMAND_CONTRACTS=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function listPmMcpToolsForProfile(availableTools,profile){return listPmMcpToolsForProfileFromContracts(availableTools,profile,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmMcpToolsForProfileFromContracts(availableTools,profile,contracts){if(profile==="full")return[...availableTools];const visibleCommands=new Set(listPmCommandsForTierFromContracts(profile,contracts));return availableTools.filter(tool=>{const command=PM_MCP_TOOL_COMMAND_CONTRACTS[tool];return command!==void 0&&visibleCommands.has(command)})}const PM_MCP_RESOURCE_CONTRACTS=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]);const PM_MCP_PROMPT_CONTRACTS=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:true},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:false}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:true}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:true},{name:"evidence",description:"Exact verification and outcome evidence.",required:true}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function renderPmCommandVisibilityMarkdown(){return renderPmCommandVisibilityMarkdownFromContracts(PM_COMMAND_CAPABILITY_CONTRACTS)}function renderPmCommandVisibilityMarkdownFromContracts(contracts){const rows=contracts.map(({command,tier,family})=>`| \`${command}\` | ${tier} | ${family} |`);return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...rows,""].join("\n")}function renderPmCapabilityRoutingMarkdown(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){const rows=listPmCommandCapabilityGroups(contracts).map(({family,commands})=>`| ${family} | ${commands.map(command=>`\`${command}\``).join(", ")} |`);return["# Generated agent capability routing","","Tracker: `pm-kxci8x`.","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Capability family | Commands |","| --- | --- |",...rows,""].join("\n")}export{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CORE_HELP_BUDGET,PM_CORE_HELP_OPTION_FLAGS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandCapabilityGroups,listPmCommandsForFamily,listPmCommandsForFamilyFromContracts,listPmCommandsForTier,listPmCommandsForTierFromContracts,listPmMcpToolsForProfile,listPmMcpToolsForProfileFromContracts,measurePmCoreHelp,renderPmCapabilityRoutingMarkdown,renderPmCommandVisibilityMarkdown,renderPmCommandVisibilityMarkdownFromContracts,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier};
|
|
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]="6d931940-2d41-557a-8913-875848774ed0")}catch(e2){}})();import{PM_CORE_COMMAND_NAMES}from"./cli-contracts/enum-contracts.js";import{PM_COMMAND_ALIAS_CONTRACTS,PM_NAMESPACED_COMMAND_ALIASES,resolvePmCommandOperation}from"./cli-contracts/command-aliases.js";const CORE_COMMANDS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate"]);const STANDARD_COMMANDS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]);const COMMANDS_BY_FAMILY=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])});const EXTENSION_COMMANDS=new Set(["extension","install","package","packages","upgrade"]);function resolvePmCommandCapabilityFamily(command){const normalized=resolvePmCommandOperation(command.trim().toLowerCase());if(normalized==="ops")return"quality";for(const[family,commands]of Object.entries(COMMANDS_BY_FAMILY)){if(commands.has(normalized))return family}return EXTENSION_COMMANDS.has(normalized)?"extensions":"internal"}const PM_COMMAND_CAPABILITY_CONTRACTS=Object.freeze([...PM_CORE_COMMAND_NAMES.flatMap(command=>command==="item"?["item-reopen"]:[command,...PM_NAMESPACED_COMMAND_ALIASES.filter(alias=>alias.alias===command).map(alias=>alias.canonical)]).map(command=>({command,tier:CORE_COMMANDS.has(resolvePmCommandOperation(command))?"core":STANDARD_COMMANDS.has(resolvePmCommandOperation(command))?"standard":"full",family:resolvePmCommandCapabilityFamily(command)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"}]);const PM_COMMAND_VISIBILITY_CONTRACTS=PM_COMMAND_CAPABILITY_CONTRACTS;const PM_CORE_HELP_BUDGET=Object.freeze({max_lines:50,max_utf8_bytes:6e3});const PM_CORE_HELP_OPTION_FLAGS=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function measurePmCoreHelp(text){const lines=text===""?0:text.split(/\r?\n/).length;const utf8Bytes=Buffer.byteLength(text,"utf8");return{lines,utf8_bytes:utf8Bytes,within_budget:lines<=PM_CORE_HELP_BUDGET.max_lines&&utf8Bytes<=PM_CORE_HELP_BUDGET.max_utf8_bytes}}const TIER_ORDER={core:0,standard:1,full:2,internal:3};const COMMAND_TIER_BY_NAME=new Map(PM_COMMAND_VISIBILITY_CONTRACTS.map(({command,tier})=>[command,tier]));function resolvePmCommandVisibilityTier(command,extensionTier="standard"){return COMMAND_TIER_BY_NAME.get(command.trim().toLowerCase())??extensionTier}function listPmCommandsForTier(tier){return listPmCommandsForTierFromContracts(tier,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForTierFromContracts(tier,contracts){const maximum=TIER_ORDER[tier];return contracts.filter(entry=>entry.tier!=="internal"&&TIER_ORDER[entry.tier]<=maximum).map(entry=>entry.command)}function listPmCommandsForFamily(family){return listPmCommandsForFamilyFromContracts(family,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmCommandsForFamilyFromContracts(family,contracts){return contracts.filter(entry=>entry.family===family).map(entry=>entry.command)}const CAPABILITY_FAMILY_ORDER=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"];const CAPABILITY_ROUTING_EXCLUDED_ALIASES=new Set([...PM_COMMAND_ALIAS_CONTRACTS.filter(alias=>alias.hidden).map(alias=>alias.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function listPmCommandCapabilityGroups(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){return CAPABILITY_FAMILY_ORDER.map(family=>({family,commands:listPmCommandsForFamilyFromContracts(family,contracts).filter(command=>contracts.find(entry=>entry.command===command)?.tier!=="internal"&&!CAPABILITY_ROUTING_EXCLUDED_ALIASES.has(command))})).filter(({commands})=>commands.length>0)}const PM_MCP_TOOL_COMMAND_CONTRACTS=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function listPmMcpToolsForProfile(availableTools,profile){return listPmMcpToolsForProfileFromContracts(availableTools,profile,PM_COMMAND_CAPABILITY_CONTRACTS)}function listPmMcpToolsForProfileFromContracts(availableTools,profile,contracts){if(profile==="full")return[...availableTools];const visibleCommands=new Set(listPmCommandsForTierFromContracts(profile,contracts));return availableTools.filter(tool=>{const command=PM_MCP_TOOL_COMMAND_CONTRACTS[tool];return command!==void 0&&visibleCommands.has(command)})}const PM_MCP_RESOURCE_CONTRACTS=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]);const PM_MCP_PROMPT_CONTRACTS=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:true},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:false}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:true}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:true},{name:"evidence",description:"Exact verification and outcome evidence.",required:true}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function renderPmCommandVisibilityMarkdown(){return renderPmCommandVisibilityMarkdownFromContracts(PM_COMMAND_CAPABILITY_CONTRACTS)}function renderPmCommandVisibilityMarkdownFromContracts(contracts){const rows=contracts.map(({command,tier,family})=>`| \`${command}\` | ${tier} | ${family} |`);return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...rows,""].join("\n")}function renderPmCapabilityRoutingMarkdown(contracts=PM_COMMAND_CAPABILITY_CONTRACTS){const rows=listPmCommandCapabilityGroups(contracts).map(({family,commands})=>`| ${family} | ${commands.map(command=>`\`${command}\``).join(", ")} |`);return["# Generated agent capability routing","","Tracker: `pm-kxci8x`.","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Capability family | Commands |","| --- | --- |",...rows,""].join("\n")}export{PM_COMMAND_CAPABILITY_CONTRACTS,PM_COMMAND_VISIBILITY_CONTRACTS,PM_CORE_HELP_BUDGET,PM_CORE_HELP_OPTION_FLAGS,PM_MCP_PROMPT_CONTRACTS,PM_MCP_RESOURCE_CONTRACTS,PM_MCP_TOOL_COMMAND_CONTRACTS,listPmCommandCapabilityGroups,listPmCommandsForFamily,listPmCommandsForFamilyFromContracts,listPmCommandsForTier,listPmCommandsForTierFromContracts,listPmMcpToolsForProfile,listPmMcpToolsForProfileFromContracts,measurePmCoreHelp,renderPmCapabilityRoutingMarkdown,renderPmCommandVisibilityMarkdown,renderPmCommandVisibilityMarkdownFromContracts,resolvePmCommandCapabilityFamily,resolvePmCommandVisibilityTier};
|
|
2
2
|
//# sourceMappingURL=agent-capability-contracts.js.map
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides public bootstrap argument normalization for embedded CLI hosts.
|
|
5
5
|
*/
|
|
6
|
-
import { EXECUTABLE_COMMAND_ALIASES, PM_COMMAND_ALIAS_CONTRACTS, renderPmCommandAliasMigrationHint, resolvePmCommandAlias, type
|
|
6
|
+
import { EXECUTABLE_COMMAND_ALIASES, PM_COMMAND_ALIAS_CONTRACTS, renderPmCommandAliasMigrationHint, resolvePmCommandAlias, type PmCommandAliasContract, type PmCommandAliasLifecycle, type PmCommandAliasRegistration } from "./cli-contracts/command-aliases.js";
|
|
7
|
+
import { type CliFlagContract } from "./cli-contracts/flag-contracts.js";
|
|
7
8
|
export { EXECUTABLE_COMMAND_ALIASES, PM_COMMAND_ALIAS_CONTRACTS, renderPmCommandAliasMigrationHint, resolvePmCommandAlias, type PmCommandAliasContract, type PmCommandAliasLifecycle, type PmCommandAliasRegistration, };
|
|
8
9
|
/** Documents the bootstrap global options payload exchanged by command, SDK, and package integrations. */
|
|
9
10
|
export interface BootstrapGlobalOptions {
|
|
@@ -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]="c07ec39c-9ec9-5e62-aed5-d5b6910fd18a")}catch(e2){}})();import{EXECUTABLE_COMMAND_ALIASES,PM_COMMAND_ALIAS_CONTRACTS,renderPmCommandAliasMigrationHint,resolvePmCommandAlias,resolveSubcommandFlagContractsForCommand}from"./cli-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{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"),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 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)}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 commandPath=`${first} ${second}`;if(resolvePmCommandOperation(commandPath)!==commandPath)return commandPath;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]="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};
|
|
2
2
|
//# sourceMappingURL=cli-bootstrap.js.map
|
|
@@ -36,6 +36,8 @@ export declare const PM_BULK_LIFECYCLE_COMMAND_ALIASES: readonly PmCommandAliasC
|
|
|
36
36
|
export declare const PM_RELOCATED_COMMAND_ALIASES: readonly PmCommandAliasContract[];
|
|
37
37
|
/** Native noun-verb paths whose stable operation identities survive grammar consolidation. */
|
|
38
38
|
export declare const PM_NAMESPACED_COMMAND_ALIASES: readonly PmCommandAliasContract[];
|
|
39
|
+
/** Find the longest declared command prefix without consuming flags or positional operands. */
|
|
40
|
+
export declare function findPmNamespacedCommand(tokens: readonly string[]): PmCommandAliasContract | undefined;
|
|
39
41
|
/** Resolve a native command leaf to its stable SDK operation without changing unknown paths. */
|
|
40
42
|
export declare function resolvePmCommandOperation(command: string): string;
|
|
41
43
|
/** Compatibility entrypoint for hosts that adopted namespace resolution with history. */
|
|
@@ -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]="e2f961be-3b2e-520d-8e27-bcc1b450b44d")}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,...[["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];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:"test",canonical_argv:["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,canonical_argv:[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
|
|
@@ -24,7 +24,7 @@ export declare const PM_EXTENSION_POLICY_SURFACE_CONTRACTS: readonly ["commands.
|
|
|
24
24
|
/** Restricts pm extension policy surface contract values accepted by command, SDK, and storage contracts. */
|
|
25
25
|
export type PmExtensionPolicySurfaceContract = (typeof PM_EXTENSION_POLICY_SURFACE_CONTRACTS)[number];
|
|
26
26
|
/** Public contract for pm core command names, shared by SDK and presentation-layer consumers. */
|
|
27
|
-
export declare const PM_CORE_COMMAND_NAMES: readonly ["init", "config", "extension", "package", "packages", "install", "upgrade", "create", "item", "copy", "focus", "list", "list-all", "list-draft", "list-open", "list-in-progress", "list-blocked", "list-closed", "list-canceled", "aggregate", "context", "ctx", "get", "graph", "search", "duplicates", "eval", "next", "history", "events", "history-redact", "history-repair", "history-compact", "history-author-acknowledge", "merge", "schema", "profile", "activity", "restore", "update", "update-many", "close", "close-many", "delete", "append", "comments", "notes", "learnings", "files", "docs", "deps", "plan", "test", "test-all", "telemetry", "stats", "health", "validate", "assurance", "gc", "workspace", "contracts", "claim", "release", "start-task", "pause-task", "close-task", "meet", "event", "remind", "help"];
|
|
27
|
+
export declare const PM_CORE_COMMAND_NAMES: readonly ["init", "config", "extension", "package", "packages", "install", "upgrade", "create", "item", "copy", "focus", "list", "list-all", "list-draft", "list-open", "list-in-progress", "list-blocked", "list-closed", "list-canceled", "aggregate", "context", "ctx", "get", "graph", "search", "duplicates", "eval", "next", "history", "events", "history-redact", "history-repair", "history-compact", "history-attest", "history-author-acknowledge", "merge", "schema", "profile", "activity", "restore", "update", "update-many", "close", "close-many", "delete", "append", "comments", "notes", "learnings", "files", "docs", "deps", "plan", "test", "test-all", "telemetry", "stats", "health", "validate", "assurance", "gc", "workspace", "contracts", "claim", "release", "start-task", "pause-task", "close-task", "meet", "event", "remind", "help"];
|
|
28
28
|
/** Supported values accepted by the graph subcommand contract across CLI, SDK, and MCP surfaces. */
|
|
29
29
|
export declare const GRAPH_SUBCOMMAND_VALUES: readonly ["ancestors", "descendants", "predecessors", "successors", "paths", "impact", "analyze", "audit", "communities", "redundancy", "dominators", "slack", "centrality", "articulation", "plan", "index"];
|
|
30
30
|
/** Restricts graph subcommand values accepted by command, SDK, and MCP contracts. */
|
|
@@ -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]="1dd71b26-fc38-5304-9156-f32b57cc1cc0")}catch(e2){}})();import{KNOWN_EXTENSION_CAPABILITIES,KNOWN_EXTENSION_POLICY_MODES,KNOWN_EXTENSION_POLICY_SURFACES,KNOWN_EXTENSION_SANDBOX_PROFILES,KNOWN_EXTENSION_SERVICE_NAMES,KNOWN_EXTENSION_TRUST_MODES}from"../../core/extensions/extension-types.js";import{WORKFLOW_POLICY_ACTIONS}from"../../core/policy/workflow-policy.js";import{PM_COMMAND_ALIAS_CONTRACTS}from"./command-aliases.js";const PM_EXTENSION_CAPABILITY_CONTRACTS=[...KNOWN_EXTENSION_CAPABILITIES];const PM_EXTENSION_SERVICE_NAME_CONTRACTS=[...KNOWN_EXTENSION_SERVICE_NAMES];const PM_EXTENSION_POLICY_MODE_CONTRACTS=[...KNOWN_EXTENSION_POLICY_MODES];const PM_EXTENSION_TRUST_MODE_CONTRACTS=[...KNOWN_EXTENSION_TRUST_MODES];const PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS=[...KNOWN_EXTENSION_SANDBOX_PROFILES];const PM_EXTENSION_POLICY_SURFACE_CONTRACTS=[...KNOWN_EXTENSION_POLICY_SURFACES];const PM_CORE_COMMAND_NAMES=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-attest","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","assurance","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"];const GRAPH_SUBCOMMAND_VALUES=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"];const MERGE_SUBCOMMAND_VALUES=["install","reconcile","report","driver"];const PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"];const PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS=["upgrade"];const PM_ITEM_ACTION_SUBCOMMANDS=["reopen"];const PM_CLI_ONLY_TOOL_ACTION_WAIVERS={help:"Commander help rendering has no SDK operation result.",packages:"The plural package alias only renders package-oriented help."};const PM_TOOL_ACTIONS=Object.freeze(PM_CORE_COMMAND_NAMES.flatMap(command=>{if(command in PM_CLI_ONLY_TOOL_ACTION_WAIVERS)return[];if(command==="extension"||command==="package"){return[...PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS.map(subcommand=>`${command}-${subcommand}`),...command==="package"?PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS.map(subcommand=>`package-${subcommand}`):[],command]}if(command==="item"){return PM_ITEM_ACTION_SUBCOMMANDS.map(subcommand=>`item-${subcommand}`)}return[command]}));const PM_DEPRECATED_TOOL_ACTIONS=Object.freeze(PM_COMMAND_ALIAS_CONTRACTS.filter(contract=>contract.lifecycle==="deprecated"&&contract.registration==="commander"&&PM_TOOL_ACTIONS.includes(contract.alias)).map(contract=>contract.alias));const PM_DISCOVERABLE_TOOL_ACTIONS=Object.freeze(PM_TOOL_ACTIONS.filter(action=>!PM_DEPRECATED_TOOL_ACTIONS.includes(action)));function analyzePmToolActionParity(cliCommands=PM_CORE_COMMAND_NAMES,toolActions=PM_TOOL_ACTIONS,waivers=PM_CLI_ONLY_TOOL_ACTION_WAIVERS){const toolActionSet=new Set(toolActions);const cliCommandSet=new Set(cliCommands);return{missing_cli_actions:cliCommands.filter(command=>!toolActionSet.has(command)&&!toolActions.some(action=>action.startsWith(`${command}-`))&&waivers[command]===void 0),waived_cli_actions:cliCommands.filter(command=>!toolActionSet.has(command)&&!toolActions.some(action=>action.startsWith(`${command}-`))&&waivers[command]!==void 0),stale_waivers:Object.keys(waivers).filter(command=>!cliCommandSet.has(command)||toolActionSet.has(command)||toolActions.some(action=>action.startsWith(`${command}-`)))}}function isPmToolAction(value){return PM_TOOL_ACTIONS.includes(value)}function isPmExtensionCapabilityContract(value){return PM_EXTENSION_CAPABILITY_CONTRACTS.includes(value)}function isPmExtensionServiceNameContract(value){return PM_EXTENSION_SERVICE_NAME_CONTRACTS.includes(value)}function isPmExtensionPolicyModeContract(value){return PM_EXTENSION_POLICY_MODE_CONTRACTS.includes(value)}function isPmExtensionPolicySurfaceContract(value){return PM_EXTENSION_POLICY_SURFACE_CONTRACTS.includes(value)}export{GRAPH_SUBCOMMAND_VALUES,MERGE_SUBCOMMAND_VALUES,PM_CLI_ONLY_TOOL_ACTION_WAIVERS,PM_CORE_COMMAND_NAMES,PM_DEPRECATED_TOOL_ACTIONS,PM_DISCOVERABLE_TOOL_ACTIONS,PM_EXTENSION_CAPABILITY_CONTRACTS,PM_EXTENSION_PACKAGE_ACTION_SUBCOMMANDS,PM_EXTENSION_POLICY_MODE_CONTRACTS,PM_EXTENSION_POLICY_SURFACE_CONTRACTS,PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS,PM_EXTENSION_SERVICE_NAME_CONTRACTS,PM_EXTENSION_TRUST_MODE_CONTRACTS,PM_ITEM_ACTION_SUBCOMMANDS,PM_PACKAGE_ONLY_ACTION_SUBCOMMANDS,PM_TOOL_ACTIONS,WORKFLOW_POLICY_ACTIONS,analyzePmToolActionParity,isPmExtensionCapabilityContract,isPmExtensionPolicyModeContract,isPmExtensionPolicySurfaceContract,isPmExtensionServiceNameContract,isPmToolAction};
|
|
2
2
|
//# sourceMappingURL=enum-contracts.js.map
|
|
@@ -75,6 +75,8 @@ export declare const HISTORY_REPAIR_FLAG_CONTRACTS: CliFlagContract[];
|
|
|
75
75
|
export declare const HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS: CliFlagContract[];
|
|
76
76
|
/** Public contract for history compact flag contracts, shared by SDK and presentation-layer consumers. */
|
|
77
77
|
export declare const HISTORY_COMPACT_FLAG_CONTRACTS: CliFlagContract[];
|
|
78
|
+
/** Detached proof export and read-only comparison options. */
|
|
79
|
+
export declare const HISTORY_ATTEST_FLAG_CONTRACTS: CliFlagContract[];
|
|
78
80
|
/** Public contract for schema flag contracts, shared by SDK and presentation-layer consumers. */
|
|
79
81
|
export declare const SCHEMA_FLAG_CONTRACTS: CliFlagContract[];
|
|
80
82
|
/** Flags accepted by the `pm profile` command (list/show/apply subcommands). */
|