@unbrained/pm-cli 2026.9.22 → 2026.9.25
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/AGENTS.md +6 -20
- package/CHANGELOG.md +43 -0
- package/dist/cli/error-guidance.d.ts +9 -0
- package/dist/cli/error-guidance.js +1 -1
- package/dist/cli/help-content.js +1 -1
- package/dist/cli-bundle/bundle-manifest.json +144 -144
- package/dist/cli-bundle/chunks/{chunk-BJBBOUYQ.js → chunk-25KTCTBL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UDNYAMCM.js → chunk-3IB4THWX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3OFFMS2N.js → chunk-445ARBKY.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SBTT42A4.js → chunk-5AP67ZXH.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-JSW33Q6R.js → chunk-COFQCKF4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4XOV7Q5R.js → chunk-CZ3VJJEA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZSPZJOMK.js → chunk-GAU55CWI.js} +28 -28
- package/dist/cli-bundle/chunks/{chunk-ML42DLI3.js → chunk-GOWZEBTH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CM57QHVK.js → chunk-JDHWZYZU.js} +73 -73
- package/dist/cli-bundle/chunks/{chunk-GFTN5OS4.js → chunk-P7ZSJOWH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-AVWHZUNC.js → chunk-YABJDOOX.js} +63 -62
- package/dist/cli-bundle/chunks/{chunk-D2OV2UBV.js → chunk-YDIGMRLZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-VOS5CBX4.js → register-list-query-IZ7ZVTDE.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-LWZH6UFJ.js → register-mutation-IPAZTFDZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-YJK4DNFZ.js → register-operations-APN33LNI.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-Q3CYF67Q.js → register-setup-HPHIKG5U.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CASXNCNQ.js → chunk-ABA3KRPY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XR5EBU3B.js → chunk-HQPTDJLF.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PRMQTT7X.js → chunk-IXNNMP2R.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-KRIHJH5U.js +75 -0
- package/dist/cli-bundle/focused-chunks/{chunk-QFEDRPPI.js → chunk-MK5AKKHK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LH24XUPJ.js → chunk-NRHTXBTI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-URH727T5.js → chunk-NVVB2HJC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TSI73EEM.js → chunk-O7MIBEMK.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V2NARGRH.js → chunk-OY3VHCTX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UT7VS4X2.js → chunk-PMPFLA6X.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FKYUTTFL.js → chunk-Q355NPLH.js} +28 -28
- package/dist/cli-bundle/focused-chunks/{chunk-JCD5YESL.js → chunk-TLF6N56J.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MXESHALQ.js → chunk-UIFVIE5F.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IOL25GKH.js → chunk-V2X37U6J.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AO5FR7PN.js → chunk-XKH2FC5D.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UAU4DJSR.js → chunk-Y2M4QLAA.js} +2 -2
- package/dist/cli-bundle/main.js +22 -22
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +30 -45
- 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 +58 -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 +9 -10
- package/dist/core/policy/workflow-policy-store.js +1 -1
- package/dist/core/shared/errors.d.ts +13 -0
- package/dist/core/shared/errors.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.d.ts +11 -11
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/completion/bash.js +1 -1
- package/dist/sdk/governance/health.d.ts +1 -1
- package/dist/sdk/governance/health.js +1 -1
- package/dist/sdk/init-agent-guidance.d.ts +2 -1
- package/dist/sdk/init-agent-guidance.js +2 -2
- package/dist/sdk/merge/install.js +2 -2
- package/dist/sdk/merge/worktree-config.d.ts +9 -0
- package/dist/sdk/merge/worktree-config.js +2 -0
- package/dist/sdk/pagination.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/docs/AGENT_RECOVERY_AND_GUIDANCE.md +49 -0
- package/docs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.md +2 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +18 -7
- package/docs/CODEX_PLUGIN.md +5 -12
- package/docs/DEFECT_RECURRENCE.md +8 -1
- package/docs/DEPENDENCY_KIND_CONTRACT.md +27 -0
- package/docs/MERGE_SAFETY.md +28 -5
- package/docs/QUALITY_EVIDENCE.md +70 -0
- package/docs/README.md +1 -0
- package/docs/RELEASE_RELIABILITY.md +70 -0
- package/docs/RELEASING.md +4 -0
- package/docs/TESTING.md +25 -0
- package/docs/VALIDATION_PORTABILITY.md +20 -11
- package/marketplace.json +2 -2
- package/package.json +12 -6
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/README.md +6 -5
- package/plugins/pm-claude/hooks/hooks.json +1 -1
- package/plugins/pm-claude/hooks/session-start.mjs +9 -6
- package/plugins/pm-claude/package.json +9 -0
- package/plugins/pm-claude/scripts/plugin-runtime.mjs +84 -0
- package/plugins/pm-claude/scripts/pm-mcp-server.mjs +39 -96
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.mcp.json +0 -3
- package/plugins/pm-codex/README.md +1 -1
- package/plugins/pm-codex/package.json +9 -0
- package/plugins/pm-codex/scripts/plugin-runtime.mjs +84 -0
- package/plugins/pm-codex/scripts/pm-mcp-server.mjs +38 -99
- package/dist/cli-bundle/focused-chunks/chunk-QYN77MQP.js +0 -59
|
@@ -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]="05666dcc-3273-5416-b6b4-54b4ff1368be")}catch(e2){}})();import fs from"node:fs/promises";import path from"node:path";import{renderPmCommand}from"../shared/command-line.js";import{canonicalizeCommandOptionKey,commandOptionFlagLabel}from"../item/type-registry.js";import{isUtf8}from"node:buffer";import{isFileMissingError}from"../fs/fs-utils.js";import{appendWorkspaceAuditEvent}from"../history/workspace-history.js";import{verifyHistoryChain}from"../history/replay.js";import{PmCliError}from"../shared/errors.js";import{EXIT_CODE}from"../shared/constants.js";import{getHistoryPath}from"../store/paths.js";import{evaluateWorkflowPolicies,parseWorkflowPolicyDocument,workflowPolicyApplies}from"./workflow-policy.js";const MAX_WORKFLOW_POLICY_BYTES=1048576;const MAX_WORKFLOW_APPROVAL_HISTORY_BYTES=4194304;async function readBoundedPolicyFile(file,maxBytes){let ancestor=path.dirname(file);while(ancestor!==path.parse(file).root){const stats=await fs.stat(ancestor).catch(error=>{if(isFileMissingError(error))return null;throw error});if(stats!==null){if(!stats.isDirectory())throw new PmCliError("Workflow policy storage ancestor must be a directory.",EXIT_CODE.CONFLICT,{code:"workflow_policy_input_unreadable",nextSteps:["Restore the policy or approval history directory before retrying."]});break}ancestor=path.dirname(ancestor)}const handle=await fs.open(file,"r").catch(error=>{if(isFileMissingError(error))return null;throw error});if(handle===null)return null;try{const size=(await handle.stat()).size;const buffer=Buffer.alloc(Math.min(maxBytes,size)+1);let offset=0;while(offset<buffer.length){const read=await handle.read(buffer,offset,buffer.length-offset,offset);if(read.bytesRead===0)break;offset+=read.bytesRead}if(offset===buffer.length||!isUtf8(buffer.subarray(0,offset))){throw new PmCliError("Workflow policy input exceeds its byte bound or is not valid UTF-8.",EXIT_CODE.CONFLICT,{code:"workflow_policy_input_unreadable",nextSteps:["Inspect the policy and approval history; reduce the declaration or use verified history compaction before retrying."]})}return buffer.toString("utf8",0,offset)}finally{await handle.close()}}function decodeWorkflowPolicyDocument(raw){if(raw===null)return{version:1,enforcement:"advise",policies:[]};let value;try{value=JSON.parse(raw)}catch{throw new PmCliError("schema/policies.json must contain valid JSON.",EXIT_CODE.CONFLICT,{code:"workflow_policy_registry_invalid",nextSteps:["Restore valid policy JSON before retrying the mutation."]})}return parseWorkflowPolicyDocument(value)}async function readWorkflowPolicies(pmRoot){return decodeWorkflowPolicyDocument(await readBoundedPolicyFile(path.join(pmRoot,"schema","policies.json"),MAX_WORKFLOW_POLICY_BYTES))}async function readWorkflowApprovals(pmRoot,id){const raw=await readBoundedPolicyFile(getHistoryPath(pmRoot,id),MAX_WORKFLOW_APPROVAL_HISTORY_BYTES);if(raw===null)return[];let entries;try{entries=raw.split(/\r?\n/).filter(line=>line.trim()).map(line=>JSON.parse(line));if(!verifyHistoryChain(entries).ok)throw new Error("invalid chain")}catch{throw new PmCliError("Approval evidence requires a valid item history chain.",EXIT_CODE.CONFLICT,{code:"workflow_policy_approval_history_invalid",nextSteps:[`Run pm history ${id} --verify before recording or using an approval.`]})}return entries.flatMap(entry=>{const approval=entry.context?.workflow_approval;if(entry.op!=="policy_approve"||entry.record_hash_version!==1||typeof entry.record_hash!=="string"||typeof approval!=="object"||approval===null)return[];const record=approval;if(typeof record.policy_fingerprint!=="string"||typeof record.content_fingerprint!=="string")return[];return[{policy_fingerprint:record.policy_fingerprint,content_fingerprint:record.content_fingerprint,author:entry.author}]})}async function evaluateWorkspacePolicies(pmRoot,document,input){const needsApproval=input.before?.status!==input.after?.status&&document.policies.some(policy=>policy.rule.kind==="approval"&&workflowPolicyApplies(policy,input));const id=input.before?.id??input.after?.id;const approvals=needsApproval&&typeof id==="string"?await readWorkflowApprovals(pmRoot,id):[];return evaluateWorkflowPolicies(document,{...input,approvals})}async function enforceWorkflowMutation(params){const document=await readWorkflowPolicies(params.pmRoot);const result=await evaluateWorkspacePolicies(params.pmRoot,document,{operation:params.operation,author:params.author,before:params.before?{...params.before.metadata,body:params.before.body}:null,after:params.after?{...params.after.metadata,body:params.after.body}:null});if(result.allowed)return result;const refused=result.decisions.filter(decision=>!decision.satisfied&&decision.effect==="refuse");if(!params.dryRun){try{await appendWorkspaceAuditEvent({pmRoot:params.pmRoot,op:"policy_refused",author:params.author,context:{item_id:params.after?.metadata.id??params.before?.metadata.id,operation:params.operation,workflow_policies:result.decisions},message:"Workflow policy refused a proposed item mutation.",lockTtlSeconds:params.settings.locks.ttl_seconds,lockWaitMs:params.settings.locks.wait_ms})}catch(cause){const error=new PmCliError("Workflow policy refusal could not be recorded in workspace history.",EXIT_CODE.CONFLICT,{code:"workflow_policy_audit_failed",nextSteps:["Resolve workspace-history lock or storage failures, then retry the refused mutation; no item changes were written."]});error.cause=cause;throw error}}const violations=refused.slice(0,3).map(decision=>({policy_id:decision.policy_id,rule:decision.rule,description:document.policies.find(policy=>policy.id===decision.policy_id).description,missing_fields:decision.missing_fields}));const missing=[...new Set(violations.flatMap(decision=>decision.missing_fields))];const summary=violations.map(decision=>`${decision.policy_id} (${decision.rule})`).join(", ");const remaining=refused.length>3?` and ${refused.length-3} more`:"";const itemId=params.after?.metadata.id??params.before.metadata.id;const fieldSteps=missing.map(field=>{if(params.before===null)return`Supply ${field} in the original ${params.operation} request, then retry; the item was not created.`;const option=canonicalizeCommandOptionKey("update",field);return option===void 0?`Supply ${field} using its declared SDK or package mutation contract, then retry.`:renderPmCommand(["update",itemId,commandOptionFlagLabel("update",option),`<${field}>`,"--pm-path",path.resolve(params.pmRoot)])});throw new PmCliError(`Workflow policy refused ${params.operation}: ${summary}${remaining}.${missing.length?` Missing: ${missing.join(", ")}.`:""}`,EXIT_CODE.CONFLICT,{code:"workflow_policy_refused",reason:violations.map(decision=>decision.policy_id).join(","),policy_violations:violations,policy_violation_count:refused.length,required:missing.length?`Supply missing fields: ${missing.join(", ")}, then retry the refused mutation.`:"Satisfy the declared workflow policy before retrying.",why:violations.map(decision=>decision.description).filter(Boolean).join(" ")||void 0,recovery:{missing_required_fields:missing},nextSteps:[...fieldSteps,...new Set(refused.slice(0,3).filter(decision=>decision.missing_fields.length===0).map(decision=>decision.remediation)),...refused.length>3?[`Inspect all policies with pm schema policies before retrying ${params.operation}.`]:[]]})}export{MAX_WORKFLOW_APPROVAL_HISTORY_BYTES,MAX_WORKFLOW_POLICY_BYTES,decodeWorkflowPolicyDocument,enforceWorkflowMutation,evaluateWorkspacePolicies,readWorkflowApprovals,readWorkflowPolicies};
|
|
2
2
|
//# sourceMappingURL=workflow-policy-store.js.map
|
|
@@ -66,6 +66,19 @@ export interface PmCliErrorContext {
|
|
|
66
66
|
/** Durable version before deletion, or null when compaction lost the mapping. */
|
|
67
67
|
last_materialized_version: number | null;
|
|
68
68
|
};
|
|
69
|
+
/** Bounded policy violations explaining a refused mutation without item values. */
|
|
70
|
+
policy_violations?: Array<{
|
|
71
|
+
/** Stable declaration that refused the mutation. */
|
|
72
|
+
policy_id: string;
|
|
73
|
+
/** Requirement kind evaluated by the policy engine. */
|
|
74
|
+
rule: string;
|
|
75
|
+
/** Workspace-authored rationale, when declared. */
|
|
76
|
+
description?: string;
|
|
77
|
+
/** Required metadata paths absent from the proposed record. */
|
|
78
|
+
missing_fields: string[];
|
|
79
|
+
}>;
|
|
80
|
+
/** Total violations before the diagnostic's three-policy ceiling. */
|
|
81
|
+
policy_violation_count?: number;
|
|
69
82
|
/** Exact filesystem path of the unreadable item document. */
|
|
70
83
|
item_path?: string;
|
|
71
84
|
/** Tracker-relative documents claiming the same item identity. */
|
|
@@ -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]="c3a7c240-7575-5db7-98fa-9dd010c9ff7d")}catch(e2){}})();class PmCliError extends Error{exitCode;code;context;constructor(message,exitCode,context={}){super(message);this.name="PmCliError";this.exitCode=exitCode;this.context=context;this.code=context.code}}export{PmCliError};
|
|
2
2
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module sdk/cli-contracts/commander-types
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Maps Commander option aliases to SDK fields and preserves precedence when normalizing CLI input.
|
|
5
5
|
*/
|
|
6
6
|
/** Describes aliases accepted by Commander option registration contracts. */
|
|
7
7
|
export interface CommanderOptionAliasContract {
|
|
8
|
-
/**
|
|
8
|
+
/** Canonical SDK option key receiving the selected alias value. */
|
|
9
9
|
target: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Commander option keys in precedence order; the first matching value wins. */
|
|
11
11
|
keys: readonly string[];
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** Declares Commander registration syntax and how its parsed values map to SDK options. */
|
|
14
14
|
export interface CommanderOptionRegistrationContract extends CommanderOptionAliasContract {
|
|
15
|
-
/**
|
|
15
|
+
/** Commander flag syntax, including short aliases and argument placeholders. */
|
|
16
16
|
option: string;
|
|
17
|
-
/**
|
|
17
|
+
/** Human-readable flag help displayed by Commander. */
|
|
18
18
|
description: string;
|
|
19
|
-
/**
|
|
19
|
+
/** Whether Commander requires this option to be supplied. */
|
|
20
20
|
required?: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/** Whether repeated occurrences accumulate values instead of replacing the previous value. */
|
|
22
22
|
repeatable?: boolean;
|
|
23
23
|
/** Inputs that customize the alias operation. */
|
|
24
24
|
aliasOptions?: Array<{
|
|
@@ -38,9 +38,9 @@ export declare const CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS: CommanderOptionA
|
|
|
38
38
|
export declare const NEXT_COMMANDER_STRING_OPTION_CONTRACTS: CommanderOptionAliasContract[];
|
|
39
39
|
/** Public contract for activity commander string option contracts, shared by SDK and presentation-layer consumers. */
|
|
40
40
|
export declare const ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS: CommanderOptionAliasContract[];
|
|
41
|
-
/**
|
|
41
|
+
/** Return the first string-valued alias in declared precedence order, including an explicitly empty string. */
|
|
42
42
|
export declare function readFirstStringFromCommanderOptions(options: Record<string, unknown>, contract: CommanderOptionAliasContract): string | undefined;
|
|
43
|
-
/**
|
|
43
|
+
/** Return the first own alias property, preserving explicitly undefined values and ignoring inherited properties. */
|
|
44
44
|
export declare function readFirstValueFromCommanderOptions(options: Record<string, unknown>, contract: CommanderOptionAliasContract): unknown;
|
|
45
|
-
/**
|
|
45
|
+
/** Concatenate string entries from all array-valued aliases in declaration order; return undefined when none remain. */
|
|
46
46
|
export declare function readStringArrayFromCommanderOptions(options: Record<string, unknown>, contract: CommanderOptionAliasContract): string[] | undefined;
|
|
@@ -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]="497e2b9b-39e8-57c6-a040-3bf8cbac0324")}catch(e2){}})();const LIST_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"status",keys:["status"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag","tags"]},{target:"priority",keys:["priority"]},{target:"deadlineBefore",keys:["deadlineBefore"]},{target:"deadlineAfter",keys:["deadlineAfter"]},{target:"updatedAfter",keys:["updatedAfter"]},{target:"updatedBefore",keys:["updatedBefore"]},{target:"createdAfter",keys:["createdAfter"]},{target:"createdBefore",keys:["createdBefore"]},{target:"ids",keys:["ids"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"parent",keys:["parent"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"limit",keys:["limit"]},{target:"offset",keys:["offset"]},{target:"after",keys:["after"]},{target:"fields",keys:["fields"]},{target:"sort",keys:["sort"]},{target:"order",keys:["order"]},{target:"treeDepth",keys:["treeDepth","tree_depth"]}];const SEARCH_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"mode",keys:["mode"]},{target:"matchMode",keys:["matchMode","match_mode"]},{target:"minScore",keys:["minScore","min_score"]},{target:"semanticWeight",keys:["semanticWeight","semantic_weight"]},{target:"status",keys:["status"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag","tags"]},{target:"priority",keys:["priority"]},{target:"deadlineBefore",keys:["deadlineBefore"]},{target:"deadlineAfter",keys:["deadlineAfter"]},{target:"updatedAfter",keys:["updatedAfter"]},{target:"updatedBefore",keys:["updatedBefore"]},{target:"createdAfter",keys:["createdAfter"]},{target:"createdBefore",keys:["createdBefore"]},{target:"assignee",keys:["assignee"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"fields",keys:["fields"]},{target:"limit",keys:["limit"]},{target:"after",keys:["after"]}];const CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"view",keys:["view"]},{target:"date",keys:["date"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"limit",keys:["limit"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"status",keys:["status"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"include",keys:["include"]},{target:"recurrenceLookaheadDays",keys:["recurrenceLookaheadDays","recurrence_lookahead_days"]},{target:"recurrenceLookbackDays",keys:["recurrenceLookbackDays","recurrence_lookback_days"]},{target:"occurrenceLimit",keys:["occurrenceLimit","occurrence_limit"]},{target:"format",keys:["format"]}];const CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"date",keys:["date"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"limit",keys:["limit","maxItems","max_items"]},{target:"after",keys:["after"]},{target:"format",keys:["format"]},{target:"depth",keys:["depth"]},{target:"fields",keys:["fields"]},{target:"activityLimit",keys:["activityLimit","activity_limit"]},{target:"staleThreshold",keys:["staleThreshold","stale_threshold"]},{target:"tokenBudget",keys:["tokenBudget","token_budget"]}];const NEXT_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"type",keys:["type"]},{target:"tag",keys:["tag"]},{target:"priority",keys:["priority"]},{target:"assignee",keys:["assignee"]},{target:"assigneeFilter",keys:["assigneeFilter","assignee_filter"]},{target:"sprint",keys:["sprint"]},{target:"release",keys:["release"]},{target:"parent",keys:["parent"]},{target:"limit",keys:["limit"]},{target:"blockedLimit",keys:["blockedLimit","blocked_limit"]},{target:"format",keys:["format"]},{target:"tokenBudget",keys:["tokenBudget","token_budget"]}];const ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS=[{target:"id",keys:["id"]},{target:"op",keys:["op"]},{target:"author",keys:["author"]},{target:"from",keys:["from"]},{target:"to",keys:["to"]},{target:"limit",keys:["limit"]}];function readFirstStringFromCommanderOptions(options,contract){for(const key of contract.keys){const candidate=options[key];if(typeof candidate==="string"){return candidate}}return void 0}function readFirstValueFromCommanderOptions(options,contract){for(const key of contract.keys){if(Object.hasOwn(options,key)){return options[key]}}return void 0}function readStringArrayFromCommanderOptions(options,contract){const values=[];for(const key of contract.keys){const candidate=options[key];if(Array.isArray(candidate)){values.push(...candidate.filter(value=>typeof value==="string"))}}return values.length>0?values:void 0}export{ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS,CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS,CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS,LIST_COMMANDER_STRING_OPTION_CONTRACTS,NEXT_COMMANDER_STRING_OPTION_CONTRACTS,SEARCH_COMMANDER_STRING_OPTION_CONTRACTS,readFirstStringFromCommanderOptions,readFirstValueFromCommanderOptions,readStringArrayFromCommanderOptions};
|
|
2
2
|
//# sourceMappingURL=commander-types.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]="2c4ca878-fa53-55b5-9cae-9fc6d7a3f0a7")}catch(e2){}})();import{PM_NAMESPACED_COMMAND_ALIASES}from"../cli-contracts.js";import{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,shellDoubleQuote}from"./shared.js";function renderBashDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return[`_pm_completion_${kind}_choices() {`," local now ttl cache_ts resolved",' now="$(date +%s 2>/dev/null || echo 0)"',` ttl="\${${ttlVar}:-120}"`,` cache_ts="\${${cacheTsVar}:-0}"`,` if [[ -n "\${${cacheVar}:-}" && "$now" -ne 0 && $((now - cache_ts)) -lt "$ttl" ]]; then`,` printf '%s\\n' "$${cacheVar}"`," return 0"," fi",` resolved="$(pm ${command} 2>/dev/null)"`,' if [[ -z "$resolved" ]]; then',` resolved="${escapedFallback}"`," fi",` ${cacheVar}="$resolved"`,` ${cacheTsVar}="$now"`,` printf '%s\\n' "$${cacheVar}"`,"}"]}function generateBashScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const namespaceLeaves=completionNamespaceLeaves(runtime);const cmds=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeValues=completionTypeValues(itemTypes,runtime);const statusValues=completionStatusValues(runtime);const tagValues=joinCompletionValues(tags);const listFlags=mergeFlagStrings(LIST_FLAGS,runtime.command_flags?.list);const createFlags=mergeFlagStrings(CREATE_FLAGS,runtime.command_flags?.create);const updateFlags=mergeFlagStrings(UPDATE_FLAGS,runtime.command_flags?.update);const updateManyFlags=mergeFlagStrings(UPDATE_MANY_FLAGS,runtime.command_flags?.["update-many"]);const searchFlags=mergeFlagStrings(SEARCH_FLAGS,runtime.command_flags?.search);const calendarFlags=mergeFlagStrings(CALENDAR_FLAGS,runtime.command_flags?.calendar);const contextFlags=mergeFlagStrings(CONTEXT_FLAGS,runtime.command_flags?.context);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const matchWords=values=>`_pm_completion_add_matches "${shellDoubleQuote(values)}"`;return["# bash completion for pm",`# Source this file or add 'eval "$(pm completion bash)"' to ~/.bashrc`,"",...useDynamicTypeExpansion?[...renderBashDynamicChoiceResolver("type","completion-types",typeValues),""]:[],...renderBashDynamicChoiceResolver("status","completion-statuses",statusValues),"","# Treat choices as data: no eval, compgen expansion, or filename globbing.","_pm_completion_add_matches() {"," local line value quoted"," local -a values"," while IFS= read -r line; do",' read -r -a values <<< "$line"',' for value in "${values[@]}"; do',' [[ "$value" == "$cur"* ]] || continue',' case "$value" in'," *[!a-zA-Z0-9_.,:/@%+=-]*)"," quoted=${value//\\'/\\'\\\\\\'\\'}",` COMPREPLY+=("'$quoted'")`," ;;",' *) COMPREPLY+=("$value") ;;'," esac"," done",' done <<< "$1"',"}","","_pm_completion() {"," local cur prev words cword"," COMPREPLY=()"," # Refuse ambiguous shell quoting before _init_completion can dequote it.",' case "${COMP_WORDS[COMP_CWORD]}" in',` *"'"*|*'"'*|*'\`'*|*'\\'*) return 0 ;;`," esac"," _init_completion 2>/dev/null || {",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"'," cword=$COMP_CWORD"," }",""," if [[ $cword -eq 1 ]]; then",` ${matchWords(cmds)}`," return 0"," fi","",' if [[ "$prev" == "--type" ]]; then',useDynamicTypeExpansion?' _pm_completion_add_matches "$(_pm_completion_type_choices)"':` ${matchWords(typeValues)}`," return 0"," fi","",' if [[ "$prev" == "--status" ]]; then',' _pm_completion_add_matches "$(_pm_completion_status_choices)"'," return 0"," fi","",...useEagerTagExpansion?[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',` ${matchWords(tagValues)}`," return 0"," fi"]:[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," local now ttl cache_ts tag_values",' now="$(date +%s 2>/dev/null || echo 0)"',' ttl="${PM_COMPLETION_TAG_TTL:-120}"',' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',' tag_values="$(pm completion-tags 2>/dev/null)"',' PM_COMPLETION_TAG_CACHE="$tag_values"',' PM_COMPLETION_TAG_CACHE_TS="$now"'," fi",' _pm_completion_add_matches "$tag_values"'," return 0"," fi"],"",' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," COMPREPLY=()"," return 0"," fi","",' local cmd="" command_path="" word_index=1 word'," while (( word_index < cword )); do",' word="${COMP_WORDS[word_index]}"',' case "${word//_/-}" in',` ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;`,` ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;`," --) break ;;"," esac",' if [[ -z "$cmd" ]]; then',' cmd="$word"',' [[ "$cmd" == "ctx" ]] && cmd="context"',' command_path="$cmd"',` case "$cmd" in ${NAMESPACE_NOUNS.join("|")}) ;; *) break ;; esac`," else",' case "$command_path $word" in',...PM_NAMESPACED_COMMAND_ALIASES.map(entry=>` "${entry.canonical}") cmd="${entry.alias}"; command_path="${entry.canonical}" ;;`)," *) break ;;"," esac",` case "$command_path" in ${NAMESPACE_PREFIXES.map(prefix=>`"${prefix}"`).join("|")}) ;; *) (( word_index++ )); break ;; esac`," fi"," (( word_index++ ))"," done",' case "$cmd" in',...HISTORY_OPERATION_FLAGS.flatMap(entry=>[` ${entry.alias})`,` ${matchWords(entry.flags)}`," return 0"," ;;"])," list)",` ${matchWords(listFlags)}`," ;;"," aggregate)",` ${matchWords(AGGREGATE_FLAGS)}`," ;;"," duplicates)",` ${matchWords(DUPLICATES_FLAGS)}`," ;;"," create)",` ${matchWords(createFlags)}`," ;;"," copy)",` ${matchWords(COPY_FLAGS)}`," ;;"," focus)",` ${matchWords(FOCUS_FLAGS)}`," ;;"," update)",` ${matchWords(updateFlags)}`," if [[ $word_index -eq $cword ]]; then",` ${matchWords(namespaceLeaves.update)}`," fi"," ;;"," update-many)",` ${matchWords(updateManyFlags)}`," ;;"," calendar|cal)",` ${matchWords(calendarFlags)}`," ;;"," context|ctx)",` ${matchWords(contextFlags)}`," if [[ $word_index -eq $cword ]]; then",` ${matchWords(namespaceLeaves.context)}`," fi"," ;;"," ops)",` ${matchWords(`${GLOBAL_FLAGS} ${namespaceLeaves.ops}`)}`," ;;"," next)",` ${matchWords(NEXT_FLAGS)}`," ;;"," guide)",` ${matchWords(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)}`," ;;"," search)",` ${matchWords(searchFlags)}`," ;;"," reindex)",` ${matchWords("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," init)",` ${matchWords(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," config)",` ${matchWords("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," extension)",` ${matchWords(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)}`," ;;"," package|packages)",` ${matchWords(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)}`," ;;"," comments)",` ${matchWords("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," notes)",` ${matchWords("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," learnings)",` ${matchWords("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," files)",` ${matchWords("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," docs)",` ${matchWords("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," append)",` ${matchWords(APPEND_FLAGS)}`," ;;"," deps)",` ${matchWords(DEPS_FLAGS)}`," ;;"," graph)",` ${matchWords(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)}`," ;;"," test)",` ${matchWords("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," test-all)",` ${matchWords("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," test-runs)",` ${matchWords("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," validate)",` ${matchWords("--check-completeness --check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," health)",` ${matchWords(HEALTH_FLAGS)}`," ;;"," history)"," if [[ $word_index -eq $cword ]]; then",` ${matchWords(`${HISTORY_FLAGS} ${HISTORY_LEAVES}`)}`," else",` ${matchWords(HISTORY_FLAGS)}`," fi"," ;;"," events)",` ${matchWords(EVENTS_FLAGS)}`," ;;"," history-author-acknowledge)",` ${matchWords(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," get)",` ${matchWords(GET_FLAGS)}`," ;;"," schema)",' if [[ "$prev" == "policy-mode" ]]; then',` ${matchWords("advise refuse")}`," return"," fi",` ${matchWords(`${SCHEMA_SUBCOMMAND_CHOICES} --definition --policy --message --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," profile)",` ${matchWords("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," plan)",` ${matchWords(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)}`," ;;"," contracts)",` ${matchWords(CONTRACTS_FLAGS)}`," ;;"," gc)",` ${matchWords("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," stats)",` ${matchWords(STATS_FLAGS)}`," ;;"," close-task)",` ${matchWords(CLOSE_TASK_MUTATION_FLAGS)}`," ;;"," close)",` ${matchWords(CLOSE_MUTATION_FLAGS)}`,' if [[ "$cmd" == "close" && $word_index -eq $cword ]]; then',` ${matchWords(namespaceLeaves.close)}`," fi"," ;;"," close-many)",` ${matchWords(CLOSE_MANY_FLAGS)}`," ;;"," release)",` ${matchWords(RELEASE_MUTATION_FLAGS)}`," ;;"," delete)",` ${matchWords(DELETE_MUTATION_FLAGS)}`," ;;"," claim)",` ${matchWords(CLAIM_MUTATION_FLAGS)}`," ;;"," start-task|pause-task)",` ${matchWords(MUTATION_FLAGS)}`," ;;"," meet|event)",` ${matchWords(MEET_FLAGS)}`," ;;"," remind)",` ${matchWords(REMIND_FLAGS)}`," ;;"," completion)",` ${matchWords(COMPLETION_SHELL_CHOICES)}`," ;;"," templates)",` ${matchWords("save list show")}`," ;;"," *)",` ${matchWords(GLOBAL_FLAGS)}`," ;;"," esac"," if [[ $word_index -eq $cword ]]; then",' case "$command_path" in',...Object.entries(namespaceLeaves).filter(([prefix])=>["item","workspace","search"].includes(prefix.split(" ")[0])).map(([prefix,leaves])=>` "${prefix}") ${matchWords(leaves)} ;;`)," esac"," fi",' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',` ${matchWords("--text")}`," fi"," return 0","}","","complete -F _pm_completion pm"].join("\n")}export{generateBashScript};
|
|
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]="2dba61cf-0757-5b46-b86c-e5b7a1c733ae")}catch(e2){}})();import{PM_NAMESPACED_COMMAND_ALIASES}from"../cli-contracts.js";import{AGGREGATE_FLAGS,ALL_COMMANDS,APPEND_FLAGS,CALENDAR_FLAGS,CLAIM_MUTATION_FLAGS,CLOSE_MANY_FLAGS,CLOSE_MUTATION_FLAGS,CLOSE_TASK_MUTATION_FLAGS,COMPLETION_SHELL_CHOICES,CONTEXT_FLAGS,CONTRACTS_FLAGS,COPY_FLAGS,CREATE_FLAGS,DELETE_MUTATION_FLAGS,DEPS_FLAGS,DUPLICATES_FLAGS,EVENTS_FLAGS,EXTENSION_LIFECYCLE_ACTIONS,EXTENSION_LIFECYCLE_FLAGS,FOCUS_FLAGS,GET_FLAGS,GLOBAL_COMPLETION_INLINE_PATTERNS,GLOBAL_COMPLETION_SWITCH_PATTERNS,GLOBAL_COMPLETION_VALUE_PATTERNS,GLOBAL_FLAGS,GRAPH_FLAGS,GUIDE_FLAGS,GUIDE_TOPIC_CHOICES,HEALTH_FLAGS,HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS,HISTORY_FLAGS,HISTORY_LEAVES,HISTORY_OPERATION_FLAGS,INIT_FLAGS,LIST_FLAGS,MEET_FLAGS,MUTATION_FLAGS,NAMESPACE_NOUNS,NAMESPACE_PREFIXES,NEXT_FLAGS,PACKAGE_LIFECYCLE_ACTIONS,PACKAGE_LIFECYCLE_FLAGS,PLAN_FLAGS,PLAN_SUBCOMMANDS_LIST,RELEASE_MUTATION_FLAGS,REMIND_FLAGS,SCHEMA_SUBCOMMAND_CHOICES,SEARCH_FLAGS,STATS_FLAGS,UPDATE_FLAGS,UPDATE_MANY_FLAGS,UPGRADE_FLAGS,completionNamespaceLeaves,completionStatusValues,completionTypeValues,joinCompletionValues,mergeFlagStrings,shellDoubleQuote}from"./shared.js";function renderBashDynamicChoiceResolver(kind,command,fallback){const envKind=kind.toUpperCase();const cacheVar=`PM_COMPLETION_${envKind}_CACHE`;const cacheTsVar=`PM_COMPLETION_${envKind}_CACHE_TS`;const ttlVar=`PM_COMPLETION_${envKind}_TTL`;const escapedFallback=shellDoubleQuote(fallback);return[`_pm_completion_${kind}_choices() {`," local now ttl cache_ts resolved",' now="$(date +%s 2>/dev/null || echo 0)"',` ttl="\${${ttlVar}:-120}"`,` cache_ts="\${${cacheTsVar}:-0}"`,` if [[ -n "\${${cacheVar}:-}" && "$now" -ne 0 && $((now - cache_ts)) -lt "$ttl" ]]; then`,` printf '%s\\n' "$${cacheVar}"`," return 0"," fi",` resolved="$(pm ${command} 2>/dev/null)"`,' if [[ -z "$resolved" ]]; then',` resolved="${escapedFallback}"`," fi",` ${cacheVar}="$resolved"`,` ${cacheTsVar}="$now"`,` printf '%s\\n' "$${cacheVar}"`,"}"]}function generateBashScript(itemTypes=[],tags=[],eagerTagExpansion=false,runtime={}){const namespaceLeaves=completionNamespaceLeaves(runtime);const cmds=ALL_COMMANDS.join(" ");const useDynamicTypeExpansion=itemTypes.length===0;const typeValues=completionTypeValues(itemTypes,runtime);const statusValues=completionStatusValues(runtime);const tagValues=joinCompletionValues(tags);const listFlags=mergeFlagStrings(LIST_FLAGS,runtime.command_flags?.list);const createFlags=mergeFlagStrings(CREATE_FLAGS,runtime.command_flags?.create);const updateFlags=mergeFlagStrings(UPDATE_FLAGS,runtime.command_flags?.update);const updateManyFlags=mergeFlagStrings(UPDATE_MANY_FLAGS,runtime.command_flags?.["update-many"]);const searchFlags=mergeFlagStrings(SEARCH_FLAGS,runtime.command_flags?.search);const calendarFlags=mergeFlagStrings(CALENDAR_FLAGS,runtime.command_flags?.calendar);const contextFlags=mergeFlagStrings(CONTEXT_FLAGS,runtime.command_flags?.context);const useEagerTagExpansion=eagerTagExpansion||tags.length>0;const matchWords=values=>`_pm_completion_add_matches "${shellDoubleQuote(values)}"`;return["# bash completion for pm",`# Source this file or add 'eval "$(pm completion bash)"' to ~/.bashrc`,"",...useDynamicTypeExpansion?[...renderBashDynamicChoiceResolver("type","completion-types",typeValues),""]:[],...renderBashDynamicChoiceResolver("status","completion-statuses",statusValues),"","# Treat choices as data: no eval, compgen expansion, or filename globbing.","_pm_completion_add_matches() {"," local line value quoted parse_char parse_index"," local -a values"," while IFS= read -r line; do",' read -r -a values <<< "$line"',' for value in "${values[@]}"; do',' [[ "$value" == "$cur"* ]] || continue',' case "$quote_mode" in'," single)"," quoted=${value//\\'/\\'\\\\\\'\\'}",` COMPREPLY+=("$quoted'")`," ;;"," double)"," quoted="," for (( parse_index=0; parse_index<${#value}; parse_index++ )); do",' parse_char="${value:parse_index:1}"',' case "$parse_char" in'," '\"'|'\\'|'$'|'`') quoted=\"${quoted}\\\\${parse_char}\" ;;",` '!') quoted="\${quoted}\\"'!'\\"" ;;`,' *) quoted="${quoted}${parse_char}" ;;'," esac"," done",' COMPREPLY+=("$quoted\\"")'," ;;"," *)",' case "$value" in'," *[!a-zA-Z0-9_.,:/@%+=-]*)"," quoted=${value//\\'/\\'\\\\\\'\\'}",` COMPREPLY+=("'$quoted'")`," ;;",' *) COMPREPLY+=("$value") ;;'," esac"," ;;"," esac"," done",' done <<< "$1"',"}","","_pm_completion() {"," local cur prev words cword raw_prefix quote_mode parse_char next_char parse_index quote_start escaped"," COMPREPLY=()",' raw_prefix="${COMP_WORDS[COMP_CWORD]}"'," _init_completion 2>/dev/null || {",' cur="${COMP_WORDS[COMP_CWORD]}"',' prev="${COMP_WORDS[COMP_CWORD-1]}"'," cword=$COMP_CWORD"," }"," # Decode only the current Readline word. Never evaluate or expand it."," quote_mode=plain escaped=0 quote_start=0 cur="," for (( parse_index=0; parse_index<${#raw_prefix}; parse_index++ )); do",' parse_char="${raw_prefix:parse_index:1}"',' if (( escaped )); then cur="${cur}${parse_char}"; escaped=0; continue; fi',' case "$quote_mode" in'," single)",' if [[ "$parse_char" == "\'" ]]; then quote_mode=plain; else cur="${cur}${parse_char}"; fi'," ;;"," double)",' case "$parse_char" in',` '"') quote_mode=plain ;;`," '\\')",' next_char="${raw_prefix:parse_index+1:1}"',' case "$next_char" in'," '\"'|'\\'|'$'|'`') escaped=1 ;;",' *) cur="${cur}\\\\" ;;'," esac"," ;;"," '`') return 0 ;;",' *) cur="${cur}${parse_char}" ;;'," esac"," ;;"," *)",' case "$parse_char" in',` "'") quote_mode=single; quote_start=$parse_index ;;`,` '"') quote_mode=double; quote_start=$parse_index ;;`," '\\') escaped=1 ;;"," '`') return 0 ;;",' *) cur="${cur}${parse_char}" ;;'," esac"," ;;"," esac"," done"," # A mixed quoted segment has a different replacement span; keep it conservative.",' [[ "$quote_mode" != plain && $quote_start -ne 0 ]] && return 0',""," if [[ $cword -eq 1 ]]; then",` ${matchWords(cmds)}`," return 0"," fi","",' if [[ "$prev" == "--type" ]]; then',useDynamicTypeExpansion?' _pm_completion_add_matches "$(_pm_completion_type_choices)"':` ${matchWords(typeValues)}`," return 0"," fi","",' if [[ "$prev" == "--status" ]]; then',' _pm_completion_add_matches "$(_pm_completion_status_choices)"'," return 0"," fi","",...useEagerTagExpansion?[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then',` ${matchWords(tagValues)}`," return 0"," fi"]:[' if [[ ( "$prev" == "--tag" || "$prev" == "--tags" ) && ! ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," local now ttl cache_ts tag_values",' now="$(date +%s 2>/dev/null || echo 0)"',' ttl="${PM_COMPLETION_TAG_TTL:-120}"',' cache_ts="${PM_COMPLETION_TAG_CACHE_TS:-0}"',' tag_values="${PM_COMPLETION_TAG_CACHE:-}"',' if [[ -z "$tag_values" || "$now" -eq 0 || $((now - cache_ts)) -ge "$ttl" ]]; then',' tag_values="$(pm completion-tags 2>/dev/null)"',' PM_COMPLETION_TAG_CACHE="$tag_values"',' PM_COMPLETION_TAG_CACHE_TS="$now"'," fi",' _pm_completion_add_matches "$tag_values"'," return 0"," fi"],"",' if [[ "$prev" == "--tag" && ( ( "${COMP_WORDS[1]}" == "package" || "${COMP_WORDS[1]}" == "packages" ) && "${COMP_WORDS[2]}" == "upgrade" ) ]]; then'," COMPREPLY=()"," return 0"," fi","",' local cmd="" command_path="" word_index=1 word'," while (( word_index < cword )); do",' word="${COMP_WORDS[word_index]}"',' case "${word//_/-}" in',` ${GLOBAL_COMPLETION_VALUE_PATTERNS}) (( word_index += 2 )); continue ;;`,` ${GLOBAL_COMPLETION_INLINE_PATTERNS}|${GLOBAL_COMPLETION_SWITCH_PATTERNS}) (( word_index++ )); continue ;;`," --) break ;;"," esac",' if [[ -z "$cmd" ]]; then',' cmd="$word"',' [[ "$cmd" == "ctx" ]] && cmd="context"',' command_path="$cmd"',` case "$cmd" in ${NAMESPACE_NOUNS.join("|")}) ;; *) break ;; esac`," else",' case "$command_path $word" in',...PM_NAMESPACED_COMMAND_ALIASES.map(entry=>` "${entry.canonical}") cmd="${entry.alias}"; command_path="${entry.canonical}" ;;`)," *) break ;;"," esac",` case "$command_path" in ${NAMESPACE_PREFIXES.map(prefix=>`"${prefix}"`).join("|")}) ;; *) (( word_index++ )); break ;; esac`," fi"," (( word_index++ ))"," done",' case "$cmd" in',...HISTORY_OPERATION_FLAGS.flatMap(entry=>[` ${entry.alias})`,` ${matchWords(entry.flags)}`," return 0"," ;;"])," list)",` ${matchWords(listFlags)}`," ;;"," aggregate)",` ${matchWords(AGGREGATE_FLAGS)}`," ;;"," duplicates)",` ${matchWords(DUPLICATES_FLAGS)}`," ;;"," create)",` ${matchWords(createFlags)}`," ;;"," copy)",` ${matchWords(COPY_FLAGS)}`," ;;"," focus)",` ${matchWords(FOCUS_FLAGS)}`," ;;"," update)",` ${matchWords(updateFlags)}`," if [[ $word_index -eq $cword ]]; then",` ${matchWords(namespaceLeaves.update)}`," fi"," ;;"," update-many)",` ${matchWords(updateManyFlags)}`," ;;"," calendar|cal)",` ${matchWords(calendarFlags)}`," ;;"," context|ctx)",` ${matchWords(contextFlags)}`," if [[ $word_index -eq $cword ]]; then",` ${matchWords(namespaceLeaves.context)}`," fi"," ;;"," ops)",` ${matchWords(`${GLOBAL_FLAGS} ${namespaceLeaves.ops}`)}`," ;;"," next)",` ${matchWords(NEXT_FLAGS)}`," ;;"," guide)",` ${matchWords(`${GUIDE_FLAGS} ${GUIDE_TOPIC_CHOICES}`)}`," ;;"," search)",` ${matchWords(searchFlags)}`," ;;"," reindex)",` ${matchWords("--mode --progress --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," init)",` ${matchWords(`${INIT_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," config)",` ${matchWords("--criterion --clear-criteria --format --policy --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," extension)",` ${matchWords(`${EXTENSION_LIFECYCLE_ACTIONS} ${EXTENSION_LIFECYCLE_FLAGS}`)}`," ;;"," package|packages)",` ${matchWords(`${PACKAGE_LIFECYCLE_ACTIONS} ${PACKAGE_LIFECYCLE_FLAGS} ${UPGRADE_FLAGS}`)}`," ;;"," comments)",` ${matchWords("--add --body --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," notes)",` ${matchWords("--add --add-json --stdin --file --edit --delete --limit --since --event-type --include-meta --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," learnings)",` ${matchWords("--add --stdin --file --edit --delete --limit --full-history --if-absent --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," files)",` ${matchWords("discover lookup --add --add-glob --remove --migrate --list --apply --note --append-stable --validate-paths --scope --limit --offset --no-truncate --strict-read --explain --lines --decision-depth --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," docs)",` ${matchWords("--add --add-glob --remove --migrate --note --validate-paths --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," append)",` ${matchWords(APPEND_FLAGS)}`," ;;"," deps)",` ${matchWords(DEPS_FLAGS)}`," ;;"," graph)",` ${matchWords(`ancestors descendants predecessors successors paths impact analyze audit communities redundancy dominators slack centrality articulation plan index ${GRAPH_FLAGS}`)}`," ;;"," test)",` ${matchWords("--add --add-json --remove --remove-index --list --run --match --only-index --only-last --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," test-all)",` ${matchWords("--status --limit --offset --background --timeout --progress --env-set --env-clear --shared-host-safe --pm-context --override-linked-pm-context --fail-on-context-mismatch --fail-on-skipped --fail-on-empty-test-run --require-assertions-for-pm --check-context --auto-pm-context --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," test-runs)",` ${matchWords("list status logs stop resume --status --limit --stream --tail --force --author --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," validate)",` ${matchWords("--check-completeness --check-metadata --metadata-profile --check-resolution --check-lifecycle --check-stale-blockers --dependency-cycle-severity --parent-cycle-severity --check-files --scan-mode --include-pm-internals --verbose-file-lists --verbose-diagnostics --all-affected-ids --strict-exit --fail-on-warn --fix-hints --auto-fix --dry-run --fix-scope --prune-missing --check-history-drift --check-command-references --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," health)",` ${matchWords(HEALTH_FLAGS)}`," ;;"," history)"," if [[ $word_index -eq $cword ]]; then",` ${matchWords(`${HISTORY_FLAGS} ${HISTORY_LEAVES}`)}`," else",` ${matchWords(HISTORY_FLAGS)}`," fi"," ;;"," events)",` ${matchWords(EVENTS_FLAGS)}`," ;;"," history-author-acknowledge)",` ${matchWords(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," get)",` ${matchWords(GET_FLAGS)}`," ;;"," schema)",' if [[ "$prev" == "policy-mode" ]]; then',` ${matchWords("advise refuse")}`," return"," fi",` ${matchWords(`${SCHEMA_SUBCOMMAND_CHOICES} --definition --policy --message --description --default-status --folder --alias --role --order --type --commands --cli-flag --required --required-on-create --no-allow-unset --required-types --infer --min-count --apply --to --migration-id --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)}`," ;;"," profile)",` ${matchWords("list show apply lint agile ops research --dry-run --author --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," plan)",` ${matchWords(`${PLAN_SUBCOMMANDS_LIST} ${PLAN_FLAGS}`)}`," ;;"," contracts)",` ${matchWords(CONTRACTS_FLAGS)}`," ;;"," gc)",` ${matchWords("--dry-run --scope --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")}`," ;;"," stats)",` ${matchWords(STATS_FLAGS)}`," ;;"," close-task)",` ${matchWords(CLOSE_TASK_MUTATION_FLAGS)}`," ;;"," close)",` ${matchWords(CLOSE_MUTATION_FLAGS)}`,' if [[ "$cmd" == "close" && $word_index -eq $cword ]]; then',` ${matchWords(namespaceLeaves.close)}`," fi"," ;;"," close-many)",` ${matchWords(CLOSE_MANY_FLAGS)}`," ;;"," release)",` ${matchWords(RELEASE_MUTATION_FLAGS)}`," ;;"," delete)",` ${matchWords(DELETE_MUTATION_FLAGS)}`," ;;"," claim)",` ${matchWords(CLAIM_MUTATION_FLAGS)}`," ;;"," start-task|pause-task)",` ${matchWords(MUTATION_FLAGS)}`," ;;"," meet|event)",` ${matchWords(MEET_FLAGS)}`," ;;"," remind)",` ${matchWords(REMIND_FLAGS)}`," ;;"," completion)",` ${matchWords(COMPLETION_SHELL_CHOICES)}`," ;;"," templates)",` ${matchWords("save list show")}`," ;;"," *)",` ${matchWords(GLOBAL_FLAGS)}`," ;;"," esac"," if [[ $word_index -eq $cword ]]; then",' case "$command_path" in',...Object.entries(namespaceLeaves).filter(([prefix])=>["item","workspace","search"].includes(prefix.split(" ")[0])).map(([prefix,leaves])=>` "${prefix}") ${matchWords(leaves)} ;;`)," esac"," fi",' if [[ "$cmd" == "comments" || "$cmd" == "notes" || "$cmd" == "learnings" ]]; then',` ${matchWords("--text")}`," fi"," return 0","}","","complete -F _pm_completion pm"].join("\n")}export{generateBashScript};
|
|
2
2
|
//# sourceMappingURL=bash.js.map
|
|
@@ -231,7 +231,7 @@ declare function buildHealthFindings(params: {
|
|
|
231
231
|
requireMergeDrivers: boolean;
|
|
232
232
|
}): HealthFinding[];
|
|
233
233
|
declare function projectHealthResult(result: HealthResult, options: RunHealthOptions, summaryMode: boolean): HealthResult;
|
|
234
|
-
/**
|
|
234
|
+
/** Inspect tracker integrity and runtime configuration, keeping optional guidance and telemetry failures diagnostic. */
|
|
235
235
|
export declare function runHealth(global: GlobalOptions, options?: RunHealthOptions): Promise<HealthResult>;
|
|
236
236
|
/** Public contract for test only health command, shared by SDK and presentation-layer consumers. */
|
|
237
237
|
export declare const _testOnlyHealthCommand: {
|