@lumenflow/mcp 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/bin.d.ts +16 -0
  2. package/dist/bin.d.ts.map +1 -0
  3. package/dist/bin.js.map +1 -0
  4. package/dist/cli-runner.d.ts +58 -0
  5. package/dist/cli-runner.d.ts.map +1 -0
  6. package/dist/cli-runner.js +164 -0
  7. package/dist/cli-runner.js.map +1 -0
  8. package/dist/index.d.ts +37 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/mcp-constants.d.ts +177 -0
  12. package/dist/mcp-constants.d.ts.map +1 -0
  13. package/dist/mcp-constants.js +197 -0
  14. package/dist/mcp-constants.js.map +1 -0
  15. package/dist/resources.d.ts +53 -0
  16. package/dist/resources.d.ts.map +1 -0
  17. package/dist/resources.js +131 -0
  18. package/dist/resources.js.map +1 -0
  19. package/dist/runtime-cache.d.ts +7 -0
  20. package/dist/runtime-cache.d.ts.map +1 -0
  21. package/dist/runtime-cache.js +28 -0
  22. package/dist/runtime-cache.js.map +1 -0
  23. package/dist/runtime-tool-resolver.constants.d.ts +26 -0
  24. package/dist/runtime-tool-resolver.constants.d.ts.map +1 -0
  25. package/dist/runtime-tool-resolver.constants.js +36 -0
  26. package/dist/runtime-tool-resolver.constants.js.map +1 -0
  27. package/dist/runtime-tool-resolver.d.ts +5 -0
  28. package/dist/runtime-tool-resolver.d.ts.map +1 -0
  29. package/dist/runtime-tool-resolver.js +2030 -0
  30. package/dist/runtime-tool-resolver.js.map +1 -0
  31. package/dist/server.d.ts +58 -0
  32. package/dist/server.d.ts.map +1 -0
  33. package/dist/server.js +212 -0
  34. package/dist/server.js.map +1 -0
  35. package/dist/tools/agent-tools.d.ts +18 -0
  36. package/dist/tools/agent-tools.d.ts.map +1 -0
  37. package/dist/tools/agent-tools.js +235 -0
  38. package/dist/tools/agent-tools.js.map +1 -0
  39. package/dist/tools/context-tools.d.ts +13 -0
  40. package/dist/tools/context-tools.d.ts.map +1 -0
  41. package/dist/tools/context-tools.js +58 -0
  42. package/dist/tools/context-tools.js.map +1 -0
  43. package/dist/tools/flow-tools.d.ts +22 -0
  44. package/dist/tools/flow-tools.d.ts.map +1 -0
  45. package/dist/tools/flow-tools.js +130 -0
  46. package/dist/tools/flow-tools.js.map +1 -0
  47. package/dist/tools/initiative-tools.d.ts +34 -0
  48. package/dist/tools/initiative-tools.d.ts.map +1 -0
  49. package/dist/tools/initiative-tools.js +420 -0
  50. package/dist/tools/initiative-tools.js.map +1 -0
  51. package/dist/tools/memory-tools.d.ts +58 -0
  52. package/dist/tools/memory-tools.d.ts.map +1 -0
  53. package/dist/tools/memory-tools.js +523 -0
  54. package/dist/tools/memory-tools.js.map +1 -0
  55. package/dist/tools/orchestration-tools.d.ts +18 -0
  56. package/dist/tools/orchestration-tools.d.ts.map +1 -0
  57. package/dist/tools/orchestration-tools.js +202 -0
  58. package/dist/tools/orchestration-tools.js.map +1 -0
  59. package/dist/tools/parity-tools.d.ts +138 -0
  60. package/dist/tools/parity-tools.d.ts.map +1 -0
  61. package/dist/tools/parity-tools.js +1690 -0
  62. package/dist/tools/parity-tools.js.map +1 -0
  63. package/dist/tools/runtime-task-constants.d.ts +19 -0
  64. package/dist/tools/runtime-task-constants.d.ts.map +1 -0
  65. package/dist/tools/runtime-task-constants.js +21 -0
  66. package/dist/tools/runtime-task-constants.js.map +1 -0
  67. package/dist/tools/runtime-task-tools.d.ts +10 -0
  68. package/dist/tools/runtime-task-tools.d.ts.map +1 -0
  69. package/dist/tools/runtime-task-tools.js +116 -0
  70. package/dist/tools/runtime-task-tools.js.map +1 -0
  71. package/dist/tools/setup-tools.d.ts +34 -0
  72. package/dist/tools/setup-tools.d.ts.map +1 -0
  73. package/dist/tools/setup-tools.js +254 -0
  74. package/dist/tools/setup-tools.js.map +1 -0
  75. package/dist/tools/validation-tools.d.ts +26 -0
  76. package/dist/tools/validation-tools.d.ts.map +1 -0
  77. package/dist/tools/validation-tools.js +180 -0
  78. package/dist/tools/validation-tools.js.map +1 -0
  79. package/dist/tools/wu-tools.d.ts +101 -0
  80. package/dist/tools/wu-tools.d.ts.map +1 -0
  81. package/dist/tools/wu-tools.js +964 -0
  82. package/dist/tools/wu-tools.js.map +1 -0
  83. package/dist/tools-shared.d.ts +257 -0
  84. package/dist/tools-shared.d.ts.map +1 -0
  85. package/dist/tools-shared.js +410 -0
  86. package/dist/tools-shared.js.map +1 -0
  87. package/dist/tools.d.ts +99 -0
  88. package/dist/tools.d.ts.map +1 -0
  89. package/dist/tools.js +253 -0
  90. package/dist/tools.js.map +1 -0
  91. package/dist/worktree-enforcement.d.ts +32 -0
  92. package/dist/worktree-enforcement.d.ts.map +1 -0
  93. package/dist/worktree-enforcement.js +154 -0
  94. package/dist/worktree-enforcement.js.map +1 -0
  95. package/package.json +5 -5
package/dist/bin.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file bin.ts
4
+ * @description CLI entry point for @lumenflow/mcp
5
+ *
6
+ * WU-1412: MCP server runs via npx @lumenflow/mcp over stdio
7
+ *
8
+ * Usage:
9
+ * npx @lumenflow/mcp
10
+ *
11
+ * Environment variables:
12
+ * LUMENFLOW_PROJECT_ROOT - Project root directory
13
+ * LUMENFLOW_MCP_LOG_LEVEL - Log level (debug, info, warn, error)
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAGA;;;;;;;;;;;;GAYG"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,iCAAiC;AACjC,yCAAyC;AACzC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAiB,MAAM,aAAa,CAAC;AAE7D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D,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACtB,GAAG,CACD,2CAA2C,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAC9F,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;IAEvD,mBAAmB;IACnB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC;AAED,WAAW;AACX,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,GAAG,CAAC,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * CLI runner options
3
+ */
4
+ export interface CliRunnerOptions {
5
+ /** Working directory for command execution (defaults to process.cwd()) */
6
+ projectRoot?: string;
7
+ /** Command timeout in milliseconds (defaults to 120000 = 2 minutes) */
8
+ timeout?: number;
9
+ /** Additional environment variables */
10
+ env?: Record<string, string>;
11
+ }
12
+ /**
13
+ * CLI runner result
14
+ */
15
+ export interface CliRunnerResult {
16
+ /** Whether the command succeeded (exit code 0) */
17
+ success: boolean;
18
+ /** Standard output */
19
+ stdout: string;
20
+ /** Standard error output */
21
+ stderr: string;
22
+ /** Exit code (if available) */
23
+ exitCode?: number;
24
+ /** Error object (if command failed) */
25
+ error?: {
26
+ message: string;
27
+ code?: string | number;
28
+ };
29
+ }
30
+ /**
31
+ * Build ordered command candidates (canonical first, then compatibility aliases).
32
+ */
33
+ export declare function getCommandCandidates(command: string): string[];
34
+ /**
35
+ * Execute a LumenFlow CLI command
36
+ *
37
+ * @param command - CLI command to execute (e.g., 'wu:status', 'wu:claim', 'gates')
38
+ * @param args - Command arguments
39
+ * @param options - Execution options
40
+ * @returns Command execution result
41
+ *
42
+ * @example
43
+ * // Get WU status
44
+ * const result = await runCliCommand('wu:status', ['--id', 'WU-1412', '--json']);
45
+ *
46
+ * @example
47
+ * // Run gates
48
+ * const result = await runCliCommand('gates', ['--docs-only']);
49
+ */
50
+ export declare function runCliCommand(command: string, args?: string[], options?: CliRunnerOptions): Promise<CliRunnerResult>;
51
+ /**
52
+ * Parse JSON output from a CLI command
53
+ *
54
+ * @param result - CLI runner result
55
+ * @returns Parsed JSON data or null if parsing fails
56
+ */
57
+ export declare function parseJsonOutput<T>(result: CliRunnerResult): T | null;
58
+ //# sourceMappingURL=cli-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-runner.d.ts","sourceRoot":"","sources":["../src/cli-runner.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB,CAAC;CACH;AAwBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAQ9D;AAwED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA6B1B;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,eAAe,GAAG,CAAC,GAAG,IAAI,CAUpE"}
@@ -0,0 +1,164 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ /**
4
+ * @file cli-runner.ts
5
+ * @description CLI runner utility for shelling out to LumenFlow CLI commands
6
+ *
7
+ * WU-1412: MCP server uses CLI shell-out for write operations (wu_create, wu_claim, wu_done, gates_run)
8
+ * Read operations use @lumenflow/core directly for better performance and type safety.
9
+ *
10
+ * This module provides a safe, consistent way to execute CLI commands with:
11
+ * - Timeout support
12
+ * - Project root configuration
13
+ * - Proper error handling
14
+ * - Structured output
15
+ */
16
+ import { execFile } from 'node:child_process';
17
+ import { promisify } from 'node:util';
18
+ const execFileAsync = promisify(execFile);
19
+ /**
20
+ * Default timeout for CLI commands (2 minutes)
21
+ */
22
+ const DEFAULT_TIMEOUT_MS = 120000;
23
+ /**
24
+ * Canonical-first command fallback matrix.
25
+ *
26
+ * When a canonical command is unavailable in a target project (missing script),
27
+ * retry with compatibility aliases to preserve low-cost backwards compatibility.
28
+ */
29
+ const COMMAND_FALLBACKS = {
30
+ 'agent:session-end': ['agent:session:end'],
31
+ 'initiative:bulk-assign': ['initiative:bulk-assign-wus'],
32
+ lumenflow: ['lumenflow:init', 'lumenflow-init'],
33
+ gates: ['lumenflow:gates', 'lumenflow-gates'],
34
+ validate: ['lumenflow:validate', 'lumenflow-validate'],
35
+ 'lumenflow:release': ['release'],
36
+ 'docs:sync': ['lumenflow:docs-sync', 'lumenflow-docs-sync'],
37
+ 'sync:templates': ['lumenflow:sync-templates', 'lumenflow-sync-templates'],
38
+ };
39
+ /**
40
+ * Build ordered command candidates (canonical first, then compatibility aliases).
41
+ */
42
+ export function getCommandCandidates(command) {
43
+ const seen = new Set();
44
+ const ordered = [command, ...(COMMAND_FALLBACKS[command] || [])];
45
+ return ordered.filter((candidate) => {
46
+ if (seen.has(candidate))
47
+ return false;
48
+ seen.add(candidate);
49
+ return true;
50
+ });
51
+ }
52
+ /**
53
+ * Returns true when the command failed because the script/command wasn't found.
54
+ */
55
+ function isMissingCommandFailure(result) {
56
+ const detail = `${result.stderr}\n${result.error?.message || ''}`;
57
+ return (/ERR_PNPM_NO_SCRIPT/i.test(detail) ||
58
+ /Command\s+["'][^"']+["']\s+not\s+found/i.test(detail) ||
59
+ /Unknown command/i.test(detail) ||
60
+ /No matching command found/i.test(detail));
61
+ }
62
+ /**
63
+ * Execute a single pnpm command without fallback behavior.
64
+ */
65
+ async function runSingleCommand(command, args = [], options = {}) {
66
+ const projectRoot = options.projectRoot || process.cwd();
67
+ const timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
68
+ // Use pnpm to run the command
69
+ const pnpmPath = 'pnpm';
70
+ const pnpmArgs = [command, ...args];
71
+ try {
72
+ const { stdout, stderr } = await execFileAsync(pnpmPath, pnpmArgs, {
73
+ cwd: projectRoot,
74
+ timeout,
75
+ env: {
76
+ ...process.env,
77
+ ...options.env,
78
+ // Ensure we're in non-interactive mode
79
+ CI: 'true',
80
+ // Pass through project root
81
+ LUMENFLOW_PROJECT_ROOT: projectRoot,
82
+ },
83
+ maxBuffer: 10 * 1024 * 1024, // 10MB buffer
84
+ });
85
+ return {
86
+ success: true,
87
+ stdout: stdout.trim(),
88
+ stderr: stderr.trim(),
89
+ exitCode: 0,
90
+ };
91
+ }
92
+ catch (err) {
93
+ const error = err;
94
+ return {
95
+ success: false,
96
+ stdout: error.stdout?.trim() || '',
97
+ stderr: error.stderr?.trim() || '',
98
+ exitCode: typeof error.code === 'number' ? error.code : 1,
99
+ error: {
100
+ message: error.message,
101
+ code: error.code,
102
+ },
103
+ };
104
+ }
105
+ }
106
+ /**
107
+ * Execute a LumenFlow CLI command
108
+ *
109
+ * @param command - CLI command to execute (e.g., 'wu:status', 'wu:claim', 'gates')
110
+ * @param args - Command arguments
111
+ * @param options - Execution options
112
+ * @returns Command execution result
113
+ *
114
+ * @example
115
+ * // Get WU status
116
+ * const result = await runCliCommand('wu:status', ['--id', 'WU-1412', '--json']);
117
+ *
118
+ * @example
119
+ * // Run gates
120
+ * const result = await runCliCommand('gates', ['--docs-only']);
121
+ */
122
+ export async function runCliCommand(command, args = [], options = {}) {
123
+ const candidates = getCommandCandidates(command);
124
+ let lastFailure = null;
125
+ for (let i = 0; i < candidates.length; i++) {
126
+ const candidate = candidates[i];
127
+ if (!candidate)
128
+ continue;
129
+ const result = await runSingleCommand(candidate, args, options);
130
+ if (result.success) {
131
+ return result;
132
+ }
133
+ lastFailure = result;
134
+ const hasFallbackRemaining = i < candidates.length - 1;
135
+ if (!hasFallbackRemaining || !isMissingCommandFailure(result)) {
136
+ return result;
137
+ }
138
+ }
139
+ return (lastFailure || {
140
+ success: false,
141
+ stdout: '',
142
+ stderr: 'Command execution failed',
143
+ exitCode: 1,
144
+ error: { message: 'Command execution failed' },
145
+ });
146
+ }
147
+ /**
148
+ * Parse JSON output from a CLI command
149
+ *
150
+ * @param result - CLI runner result
151
+ * @returns Parsed JSON data or null if parsing fails
152
+ */
153
+ export function parseJsonOutput(result) {
154
+ if (!result.success || !result.stdout) {
155
+ return null;
156
+ }
157
+ try {
158
+ return JSON.parse(result.stdout);
159
+ }
160
+ catch {
161
+ return null;
162
+ }
163
+ }
164
+ //# sourceMappingURL=cli-runner.js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,CAAC,oBAAoB,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9D,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO,CACL,WAAW,IAAI;QACb,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,0BAA0B;QAClC,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,EAAE,OAAO,EAAE,0BAA0B,EAAE;KAC/C,CACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAI,MAAuB;IACxD,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAM,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @lumenflow/mcp - MCP stdio server for LumenFlow workflow framework
3
+ * @module @lumenflow/mcp
4
+ *
5
+ * WU-1412: Provides MCP server with LumenFlow tools and resources.
6
+ *
7
+ * Tools:
8
+ * - context_get: Get current LumenFlow context
9
+ * - wu_list: List all Work Units
10
+ * - wu_status: Get WU status
11
+ * - wu_create: Create a new WU
12
+ * - wu_claim: Claim a WU
13
+ * - wu_done: Complete a WU
14
+ * - gates_run: Run quality gates
15
+ *
16
+ * Resources:
17
+ * - lumenflow://context: Current context
18
+ * - lumenflow://wu/{id}: WU by ID
19
+ * - lumenflow://backlog: Current backlog
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { createMcpServer } from '@lumenflow/mcp';
24
+ *
25
+ * const server = createMcpServer({
26
+ * projectRoot: '/path/to/project',
27
+ * logLevel: 'info',
28
+ * });
29
+ *
30
+ * await server.start();
31
+ * ```
32
+ */
33
+ export { createMcpServer, type McpServer, type McpServerConfig, type LogLevel } from './server.js';
34
+ export { allTools, contextGetTool, wuListTool, wuStatusTool, wuCreateTool, wuClaimTool, wuDoneTool, gatesRunTool, type ToolDefinition, type ToolResult, } from './tools.js';
35
+ export { allResources, staticResources, resourceTemplates, contextResource, wuResource, backlogResource, type ResourceDefinition, type ResourceResult, } from './resources.js';
36
+ export { runCliCommand, parseJsonOutput, type CliRunnerOptions, type CliRunnerResult, } from './cli-runner.js';
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGnG,OAAO,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,SAAS;AACT,OAAO,EAAE,eAAe,EAAuD,MAAM,aAAa,CAAC;AAEnG,QAAQ;AACR,OAAO,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,GAGb,MAAM,YAAY,CAAC;AAEpB,YAAY;AACZ,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,eAAe,GAGhB,MAAM,gBAAgB,CAAC;AAExB,aAAa;AACb,OAAO,EACL,aAAa,EACb,eAAe,GAGhB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * @file mcp-constants.ts
3
+ * @description Typed source-of-truth constants for MCP governed literal families.
4
+ *
5
+ * Governed families:
6
+ * 1. CLI command names — canonical map of all commands dispatched via runCliCommand/executeViaPack
7
+ * 2. Cross-boundary metadata keys — keys used in ExecutionContext.metadata across modules
8
+ *
9
+ * Scoping rule: CLI flags are governed in tools-shared.ts (CliArgs). Only flags
10
+ * appearing in 3 or more tool definitions are centralized there. Tool-local flags
11
+ * (< 3 uses) remain as local string literals.
12
+ *
13
+ * WU-1851: Initial governance module.
14
+ */
15
+ /**
16
+ * Canonical CLI command name constants.
17
+ *
18
+ * Every string passed to `runCliCommand()`, `executeViaPack()`, or used in
19
+ * `fallback.command` MUST reference a value from this object.
20
+ *
21
+ * Organized by domain to match tool file groupings.
22
+ */
23
+ export declare const CliCommands: {
24
+ readonly WU_STATUS: "wu:status";
25
+ readonly WU_CREATE: "wu:create";
26
+ readonly WU_CLAIM: "wu:claim";
27
+ readonly WU_SANDBOX: "wu:sandbox";
28
+ readonly WU_DONE: "wu:done";
29
+ readonly WU_BLOCK: "wu:block";
30
+ readonly WU_UNBLOCK: "wu:unblock";
31
+ readonly WU_EDIT: "wu:edit";
32
+ readonly WU_RELEASE: "wu:release";
33
+ readonly WU_RECOVER: "wu:recover";
34
+ readonly WU_REPAIR: "wu:repair";
35
+ readonly WU_DEPS: "wu:deps";
36
+ readonly WU_PREP: "wu:prep";
37
+ readonly WU_PREFLIGHT: "wu:preflight";
38
+ readonly WU_PRUNE: "wu:prune";
39
+ readonly WU_DELETE: "wu:delete";
40
+ readonly WU_CLEANUP: "wu:cleanup";
41
+ readonly WU_BRIEF: "wu:brief";
42
+ readonly WU_DELEGATE: "wu:delegate";
43
+ readonly WU_VALIDATE: "wu:validate";
44
+ readonly WU_INFER_LANE: "wu:infer-lane";
45
+ readonly WU_UNLOCK_LANE: "wu:unlock-lane";
46
+ readonly WU_PROTO: "wu:proto";
47
+ readonly WU_LIST: "wu:list";
48
+ readonly GATES: "gates";
49
+ readonly STATE_BOOTSTRAP: "state:bootstrap";
50
+ readonly STATE_CLEANUP: "state:cleanup";
51
+ readonly STATE_DOCTOR: "state:doctor";
52
+ readonly BACKLOG_PRUNE: "backlog:prune";
53
+ readonly DOCS_SYNC: "docs:sync";
54
+ readonly SYNC_TEMPLATES: "sync:templates";
55
+ readonly LUMENFLOW: "lumenflow";
56
+ readonly LANE_HEALTH: "lane:health";
57
+ readonly LANE_SUGGEST: "lane:suggest";
58
+ readonly SIGNAL_CLEANUP: "signal:cleanup";
59
+ readonly CONFIG_SET: "config:set";
60
+ readonly CONFIG_GET: "config:get";
61
+ readonly CLOUD_CONNECT: "cloud:connect";
62
+ readonly ONBOARD: "onboard";
63
+ readonly LUMENFLOW_ONBOARD: "lumenflow-onboard";
64
+ readonly WORKSPACE_INIT: "workspace:init";
65
+ readonly FILE_READ: "file:read";
66
+ readonly FILE_WRITE: "file:write";
67
+ readonly FILE_EDIT: "file:edit";
68
+ readonly FILE_DELETE: "file:delete";
69
+ readonly GIT_STATUS: "git:status";
70
+ readonly GIT_DIFF: "git:diff";
71
+ readonly GIT_LOG: "git:log";
72
+ readonly GIT_BRANCH: "git:branch";
73
+ readonly INIT_PLAN: "init:plan";
74
+ readonly PLAN_CREATE: "plan:create";
75
+ readonly PLAN_EDIT: "plan:edit";
76
+ readonly PLAN_LINK: "plan:link";
77
+ readonly PLAN_PROMOTE: "plan:promote";
78
+ readonly LUMENFLOW_DOCTOR: "lumenflow:doctor";
79
+ readonly LUMENFLOW_INTEGRATE: "lumenflow:integrate";
80
+ readonly LUMENFLOW_UPGRADE: "lumenflow:upgrade";
81
+ readonly LUMENFLOW_RELEASE: "lumenflow:release";
82
+ readonly LUMENFLOW_VALIDATE: "lumenflow:validate";
83
+ readonly VALIDATE: "validate";
84
+ readonly VALIDATE_AGENT_SKILLS: "validate:agent-skills";
85
+ readonly VALIDATE_AGENT_SYNC: "validate:agent-sync";
86
+ readonly VALIDATE_BACKLOG_SYNC: "validate:backlog-sync";
87
+ readonly VALIDATE_SKILLS_SPEC: "validate:skills-spec";
88
+ readonly INITIATIVE_LIST: "initiative:list";
89
+ readonly INITIATIVE_STATUS: "initiative:status";
90
+ readonly INITIATIVE_CREATE: "initiative:create";
91
+ readonly INITIATIVE_EDIT: "initiative:edit";
92
+ readonly INITIATIVE_ADD_WU: "initiative:add-wu";
93
+ readonly INITIATIVE_REMOVE_WU: "initiative:remove-wu";
94
+ readonly INITIATIVE_BULK_ASSIGN: "initiative:bulk-assign";
95
+ readonly INITIATIVE_PLAN: "initiative:plan";
96
+ readonly ORCHESTRATE_INITIATIVE: "orchestrate:initiative";
97
+ readonly ORCHESTRATE_INIT_STATUS: "orchestrate:init-status";
98
+ readonly ORCHESTRATE_MONITOR: "orchestrate:monitor";
99
+ readonly DELEGATION_LIST: "delegation:list";
100
+ readonly AGENT_SESSION: "agent:session";
101
+ readonly AGENT_SESSION_END: "agent:session-end";
102
+ readonly AGENT_LOG_ISSUE: "agent:log-issue";
103
+ readonly AGENT_ISSUES_QUERY: "agent:issues-query";
104
+ readonly MEM_INIT: "mem:init";
105
+ readonly MEM_START: "mem:start";
106
+ readonly MEM_READY: "mem:ready";
107
+ readonly MEM_CHECKPOINT: "mem:checkpoint";
108
+ readonly MEM_CLEANUP: "mem:cleanup";
109
+ readonly MEM_CONTEXT: "mem:context";
110
+ readonly MEM_CREATE: "mem:create";
111
+ readonly MEM_DELETE: "mem:delete";
112
+ readonly MEM_EXPORT: "mem:export";
113
+ readonly MEM_INBOX: "mem:inbox";
114
+ readonly MEM_SIGNAL: "mem:signal";
115
+ readonly MEM_SUMMARIZE: "mem:summarize";
116
+ readonly MEM_TRIAGE: "mem:triage";
117
+ readonly MEM_RECOVER: "mem:recover";
118
+ readonly CONTEXT_GET: "context:get";
119
+ readonly FLOW_BOTTLENECKS: "flow:bottlenecks";
120
+ readonly FLOW_REPORT: "flow:report";
121
+ readonly METRICS_SNAPSHOT: "metrics:snapshot";
122
+ readonly LUMENFLOW_METRICS: "lumenflow:metrics";
123
+ readonly METRICS: "metrics";
124
+ };
125
+ export type CliCommandName = (typeof CliCommands)[keyof typeof CliCommands];
126
+ /**
127
+ * Metadata key constants used in ExecutionContext.metadata across MCP modules.
128
+ * These cross module boundaries and must be consistent.
129
+ */
130
+ export declare const MetadataKeys: {
131
+ readonly PROJECT_ROOT: "project_root";
132
+ readonly INVOCATION_MODE: "invocation_mode";
133
+ };
134
+ export type MetadataKey = (typeof MetadataKeys)[keyof typeof MetadataKeys];
135
+ /**
136
+ * Environment variables used by MCP runtime execution policy.
137
+ */
138
+ export declare const McpEnvironmentVariables: {
139
+ readonly MIGRATION_COMPAT_MODE: "LUMENFLOW_MCP_MIGRATION_COMPAT_MODE";
140
+ };
141
+ /**
142
+ * Compatibility modes for executeViaPack migration fallback behavior.
143
+ *
144
+ * - compat: allow temporary CLI fallback for migration-only reasons
145
+ * - strict: fail closed when runtime cannot serve migration-only tools
146
+ */
147
+ export declare const MigrationCompatModes: {
148
+ readonly COMPAT: "compat";
149
+ readonly STRICT: "strict";
150
+ };
151
+ export type MigrationCompatMode = (typeof MigrationCompatModes)[keyof typeof MigrationCompatModes];
152
+ /**
153
+ * Canonical migration fallback error codes used by executeViaPack guardrails.
154
+ */
155
+ export declare const MigrationFallbackErrorCodes: {
156
+ readonly DISABLED: "MCP_MIGRATION_FALLBACK_DISABLED";
157
+ readonly EXECUTION_FAILED: "MCP_MIGRATION_FALLBACK_ERROR";
158
+ };
159
+ export type MigrationFallbackErrorCode = (typeof MigrationFallbackErrorCodes)[keyof typeof MigrationFallbackErrorCodes];
160
+ /**
161
+ * Structured reasons for migration fallback attempts.
162
+ */
163
+ export declare const MigrationFallbackReasons: {
164
+ readonly RUNTIME_INIT_FAILED: "runtime_init_failed";
165
+ readonly RUNTIME_TOOL_NOT_FOUND: "runtime_tool_not_found";
166
+ };
167
+ export type MigrationFallbackReason = (typeof MigrationFallbackReasons)[keyof typeof MigrationFallbackReasons];
168
+ /**
169
+ * Structured outcomes for migration fallback telemetry events.
170
+ */
171
+ export declare const MigrationFallbackOutcomes: {
172
+ readonly SUCCEEDED: "succeeded";
173
+ readonly FAILED: "failed";
174
+ readonly BLOCKED: "blocked";
175
+ };
176
+ export type MigrationFallbackOutcome = (typeof MigrationFallbackOutcomes)[keyof typeof MigrationFallbackOutcomes];
177
+ //# sourceMappingURL=mcp-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-constants.d.ts","sourceRoot":"","sources":["../src/mcp-constants.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAMH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkId,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAM5E;;;GAGG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAM3E;;GAEG;AACH,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;CAGvB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAA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