@codemcp/workflows-core 3.1.16
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/.turbo/turbo-build.log +4 -0
- package/LICENSE +674 -0
- package/dist/config-manager.d.ts +24 -0
- package/dist/config-manager.js +68 -0
- package/dist/config-manager.js.map +1 -0
- package/dist/conversation-manager.d.ts +97 -0
- package/dist/conversation-manager.js +367 -0
- package/dist/conversation-manager.js.map +1 -0
- package/dist/database.d.ts +73 -0
- package/dist/database.js +500 -0
- package/dist/database.js.map +1 -0
- package/dist/file-detection-manager.d.ts +53 -0
- package/dist/file-detection-manager.js +221 -0
- package/dist/file-detection-manager.js.map +1 -0
- package/dist/git-manager.d.ts +14 -0
- package/dist/git-manager.js +59 -0
- package/dist/git-manager.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/instruction-generator.d.ts +69 -0
- package/dist/instruction-generator.js +133 -0
- package/dist/instruction-generator.js.map +1 -0
- package/dist/interaction-logger.d.ts +37 -0
- package/dist/interaction-logger.js +87 -0
- package/dist/interaction-logger.js.map +1 -0
- package/dist/logger.d.ts +64 -0
- package/dist/logger.js +283 -0
- package/dist/logger.js.map +1 -0
- package/dist/path-validation-utils.d.ts +51 -0
- package/dist/path-validation-utils.js +202 -0
- package/dist/path-validation-utils.js.map +1 -0
- package/dist/plan-manager.d.ts +65 -0
- package/dist/plan-manager.js +256 -0
- package/dist/plan-manager.js.map +1 -0
- package/dist/project-docs-manager.d.ts +119 -0
- package/dist/project-docs-manager.js +357 -0
- package/dist/project-docs-manager.js.map +1 -0
- package/dist/state-machine-loader.d.ts +60 -0
- package/dist/state-machine-loader.js +235 -0
- package/dist/state-machine-loader.js.map +1 -0
- package/dist/state-machine-types.d.ts +58 -0
- package/dist/state-machine-types.js +7 -0
- package/dist/state-machine-types.js.map +1 -0
- package/dist/state-machine.d.ts +52 -0
- package/dist/state-machine.js +256 -0
- package/dist/state-machine.js.map +1 -0
- package/dist/system-prompt-generator.d.ts +17 -0
- package/dist/system-prompt-generator.js +113 -0
- package/dist/system-prompt-generator.js.map +1 -0
- package/dist/template-manager.d.ts +61 -0
- package/dist/template-manager.js +229 -0
- package/dist/template-manager.js.map +1 -0
- package/dist/transition-engine.d.ts +70 -0
- package/dist/transition-engine.js +240 -0
- package/dist/transition-engine.js.map +1 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-manager.d.ts +89 -0
- package/dist/workflow-manager.js +466 -0
- package/dist/workflow-manager.js.map +1 -0
- package/package.json +27 -0
- package/src/config-manager.ts +96 -0
- package/src/conversation-manager.ts +492 -0
- package/src/database.ts +685 -0
- package/src/file-detection-manager.ts +302 -0
- package/src/git-manager.ts +64 -0
- package/src/index.ts +28 -0
- package/src/instruction-generator.ts +210 -0
- package/src/interaction-logger.ts +109 -0
- package/src/logger.ts +353 -0
- package/src/path-validation-utils.ts +261 -0
- package/src/plan-manager.ts +323 -0
- package/src/project-docs-manager.ts +522 -0
- package/src/state-machine-loader.ts +308 -0
- package/src/state-machine-types.ts +72 -0
- package/src/state-machine.ts +370 -0
- package/src/system-prompt-generator.ts +122 -0
- package/src/template-manager.ts +321 -0
- package/src/transition-engine.ts +386 -0
- package/src/types.ts +60 -0
- package/src/workflow-manager.ts +601 -0
- package/test/unit/conversation-manager.test.ts +179 -0
- package/test/unit/custom-workflow-loading.test.ts +174 -0
- package/test/unit/directory-linking-and-extensions.test.ts +338 -0
- package/test/unit/file-linking-integration.test.ts +256 -0
- package/test/unit/git-commit-integration.test.ts +91 -0
- package/test/unit/git-manager.test.ts +86 -0
- package/test/unit/install-workflow.test.ts +138 -0
- package/test/unit/instruction-generator.test.ts +247 -0
- package/test/unit/list-workflows-filtering.test.ts +68 -0
- package/test/unit/none-template-functionality.test.ts +224 -0
- package/test/unit/project-docs-manager.test.ts +337 -0
- package/test/unit/state-machine-loader.test.ts +234 -0
- package/test/unit/template-manager.test.ts +217 -0
- package/test/unit/validate-workflow-name.test.ts +150 -0
- package/test/unit/workflow-domain-filtering.test.ts +75 -0
- package/test/unit/workflow-enum-generation.test.ts +92 -0
- package/test/unit/workflow-manager-enhanced-path-resolution.test.ts +369 -0
- package/test/unit/workflow-manager-path-resolution.test.ts +150 -0
- package/test/unit/workflow-migration.test.ts +155 -0
- package/test/unit/workflow-override-by-name.test.ts +116 -0
- package/test/unit/workflow-prioritization.test.ts +38 -0
- package/test/unit/workflow-validation.test.ts +303 -0
- package/test/utils/e2e-test-setup.ts +453 -0
- package/test/utils/run-server-in-dir.sh +27 -0
- package/test/utils/temp-files.ts +308 -0
- package/test/utils/test-access.ts +79 -0
- package/test/utils/test-helpers.ts +286 -0
- package/test/utils/test-setup.ts +78 -0
- package/tsconfig.build.json +21 -0
- package/tsconfig.json +8 -0
- package/vitest.config.ts +18 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
/**
|
2
|
+
* Interaction Logger module
|
3
|
+
*
|
4
|
+
* Handles logging of tool interactions to the database for auditing and debugging.
|
5
|
+
*/
|
6
|
+
import { createLogger } from './logger.js';
|
7
|
+
const logger = createLogger('InteractionLogger');
|
8
|
+
/**
|
9
|
+
* Handles logging of tool interactions to the database
|
10
|
+
*/
|
11
|
+
export class InteractionLogger {
|
12
|
+
database;
|
13
|
+
/**
|
14
|
+
* Create a new InteractionLogger
|
15
|
+
*
|
16
|
+
* @param database - Database instance to use for logging
|
17
|
+
*/
|
18
|
+
constructor(database) {
|
19
|
+
this.database = database;
|
20
|
+
logger.debug('InteractionLogger initialized');
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Log an interaction with a tool
|
24
|
+
*
|
25
|
+
* @param conversationId - ID of the conversation
|
26
|
+
* @param toolName - Name of the tool that was called
|
27
|
+
* @param inputParams - Input parameters to the tool (will be stringified)
|
28
|
+
* @param responseData - Response data from the tool (will be stringified)
|
29
|
+
* @param currentPhase - Current development phase
|
30
|
+
* @returns Promise that resolves when the log is saved
|
31
|
+
*/
|
32
|
+
async logInteraction(conversationId, toolName, inputParams, responseData, currentPhase) {
|
33
|
+
logger.debug('Logging interaction', {
|
34
|
+
conversationId,
|
35
|
+
toolName,
|
36
|
+
currentPhase,
|
37
|
+
});
|
38
|
+
try {
|
39
|
+
const timestamp = new Date().toISOString();
|
40
|
+
const log = {
|
41
|
+
conversationId,
|
42
|
+
toolName,
|
43
|
+
inputParams: JSON.stringify(inputParams),
|
44
|
+
responseData: JSON.stringify(responseData),
|
45
|
+
currentPhase,
|
46
|
+
timestamp,
|
47
|
+
};
|
48
|
+
await this.database.logInteraction(log);
|
49
|
+
logger.info('Interaction logged successfully', {
|
50
|
+
conversationId,
|
51
|
+
toolName,
|
52
|
+
timestamp,
|
53
|
+
});
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
logger.error('Failed to log interaction', error, {
|
57
|
+
conversationId,
|
58
|
+
toolName,
|
59
|
+
});
|
60
|
+
// Don't throw the error - logging should not break the main flow
|
61
|
+
}
|
62
|
+
}
|
63
|
+
/**
|
64
|
+
* Get all interactions for a specific conversation
|
65
|
+
*
|
66
|
+
* @param conversationId - ID of the conversation to get logs for
|
67
|
+
* @returns Promise that resolves to an array of interaction logs
|
68
|
+
*/
|
69
|
+
async getInteractionsByConversationId(conversationId) {
|
70
|
+
logger.debug('Getting interactions by conversation ID', { conversationId });
|
71
|
+
try {
|
72
|
+
const logs = await this.database.getInteractionsByConversationId(conversationId);
|
73
|
+
logger.info('Retrieved interaction logs', {
|
74
|
+
conversationId,
|
75
|
+
count: logs.length,
|
76
|
+
});
|
77
|
+
return logs;
|
78
|
+
}
|
79
|
+
catch (error) {
|
80
|
+
logger.error('Failed to get interaction logs', error, {
|
81
|
+
conversationId,
|
82
|
+
});
|
83
|
+
throw error;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
//# sourceMappingURL=interaction-logger.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":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OAKG;IACH,KAAK,CAAC,+BAA+B,CACnC,cAAsB;QAEtB,MAAM,CAAC,KAAK,CAAC,yCAAyC,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;QAE5E,IAAI,CAAC;YACH,MAAM,IAAI,GACR,MAAM,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,cAAc,CAAC,CAAC;YAEtE,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE;gBACxC,cAAc;gBACd,KAAK,EAAE,IAAI,CAAC,MAAM;aACnB,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAc,EAAE;gBAC7D,cAAc;aACf,CAAC,CAAC;YACH,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/dist/logger.d.ts
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* Logging utility for Vibe Feature MCP Server
|
3
|
+
*
|
4
|
+
* Provides structured logging with proper MCP compliance:
|
5
|
+
* - Uses stderr for all local logging (MCP requirement)
|
6
|
+
* - Supports MCP log message notifications to client
|
7
|
+
* - Provides structured logging with proper levels:
|
8
|
+
* - debug: Tracing and detailed execution flow
|
9
|
+
* - info: Success operations and important milestones
|
10
|
+
* - warn: Expected errors and recoverable issues
|
11
|
+
* - error: Caught but unexpected errors
|
12
|
+
*/
|
13
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
14
|
+
export declare enum LogLevel {
|
15
|
+
DEBUG = 0,
|
16
|
+
INFO = 1,
|
17
|
+
WARN = 2,
|
18
|
+
ERROR = 3,
|
19
|
+
SILENT = 4
|
20
|
+
}
|
21
|
+
export interface LogContext {
|
22
|
+
component?: string;
|
23
|
+
conversationId?: string;
|
24
|
+
phase?: string;
|
25
|
+
operation?: string;
|
26
|
+
[key: string]: unknown;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Set the MCP server instance for log notifications
|
30
|
+
*/
|
31
|
+
export declare function setMcpServerForLogging(server: McpServer): void;
|
32
|
+
/**
|
33
|
+
* Set the logging level from MCP client request
|
34
|
+
*/
|
35
|
+
export declare function setMcpLoggingLevel(level: string): void;
|
36
|
+
declare class Logger {
|
37
|
+
private component;
|
38
|
+
private explicitLogLevel?;
|
39
|
+
constructor(component: string, logLevel?: LogLevel);
|
40
|
+
private getCurrentLogLevel;
|
41
|
+
private getLogLevelFromEnv;
|
42
|
+
private shouldLog;
|
43
|
+
private formatMessage;
|
44
|
+
/**
|
45
|
+
* Send log message to MCP client if server is available and level is appropriate
|
46
|
+
*/
|
47
|
+
private sendMcpLogMessage;
|
48
|
+
debug(message: string, context?: LogContext): void;
|
49
|
+
info(message: string, context?: LogContext): void;
|
50
|
+
/**
|
51
|
+
* Send enhanced MCP notifications with better formatting for important events
|
52
|
+
*/
|
53
|
+
private sendEnhancedMcpNotification;
|
54
|
+
/**
|
55
|
+
* Capitalize phase name for display
|
56
|
+
*/
|
57
|
+
private capitalizePhase;
|
58
|
+
warn(message: string, context?: LogContext): void;
|
59
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
60
|
+
child(childComponent: string): Logger;
|
61
|
+
}
|
62
|
+
export declare function createLogger(component: string, logLevel?: LogLevel): Logger;
|
63
|
+
export declare const logger: Logger;
|
64
|
+
export {};
|
package/dist/logger.js
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
/**
|
2
|
+
* Logging utility for Vibe Feature MCP Server
|
3
|
+
*
|
4
|
+
* Provides structured logging with proper MCP compliance:
|
5
|
+
* - Uses stderr for all local logging (MCP requirement)
|
6
|
+
* - Supports MCP log message notifications to client
|
7
|
+
* - Provides structured logging with proper levels:
|
8
|
+
* - debug: Tracing and detailed execution flow
|
9
|
+
* - info: Success operations and important milestones
|
10
|
+
* - warn: Expected errors and recoverable issues
|
11
|
+
* - error: Caught but unexpected errors
|
12
|
+
*/
|
13
|
+
export var LogLevel;
|
14
|
+
(function (LogLevel) {
|
15
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
16
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
17
|
+
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
18
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
19
|
+
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
20
|
+
})(LogLevel || (LogLevel = {}));
|
21
|
+
// Global MCP server reference for log notifications
|
22
|
+
let mcpServerInstance = null;
|
23
|
+
// Unified logging level - can be set by MCP client or environment
|
24
|
+
let currentLoggingLevel = null;
|
25
|
+
// Test mode detection function to check at runtime
|
26
|
+
function isTestMode() {
|
27
|
+
// Check explicit environment variables
|
28
|
+
if (process.env.NODE_ENV === 'test' || process.env.VITEST === 'true') {
|
29
|
+
return true;
|
30
|
+
}
|
31
|
+
// Check if running in a temporary directory (common for tests)
|
32
|
+
const cwd = process.cwd();
|
33
|
+
if (cwd.includes('/tmp/') || cwd.includes('temp') || cwd.includes('test-')) {
|
34
|
+
return true;
|
35
|
+
}
|
36
|
+
// Check if LOG_LEVEL is explicitly set to ERROR
|
37
|
+
if (process.env.LOG_LEVEL === 'ERROR') {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Set the MCP server instance for log notifications
|
44
|
+
*/
|
45
|
+
export function setMcpServerForLogging(server) {
|
46
|
+
mcpServerInstance = server;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Set the logging level from MCP client request
|
50
|
+
*/
|
51
|
+
export function setMcpLoggingLevel(level) {
|
52
|
+
// Map MCP levels to our internal levels
|
53
|
+
const levelMap = {
|
54
|
+
debug: LogLevel.DEBUG,
|
55
|
+
info: LogLevel.INFO,
|
56
|
+
notice: LogLevel.INFO,
|
57
|
+
warning: LogLevel.WARN,
|
58
|
+
error: LogLevel.ERROR,
|
59
|
+
critical: LogLevel.ERROR,
|
60
|
+
alert: LogLevel.ERROR,
|
61
|
+
emergency: LogLevel.ERROR,
|
62
|
+
};
|
63
|
+
currentLoggingLevel = levelMap[level] ?? LogLevel.INFO;
|
64
|
+
}
|
65
|
+
class Logger {
|
66
|
+
component;
|
67
|
+
explicitLogLevel;
|
68
|
+
constructor(component, logLevel) {
|
69
|
+
this.component = component;
|
70
|
+
this.explicitLogLevel = logLevel;
|
71
|
+
}
|
72
|
+
getCurrentLogLevel() {
|
73
|
+
// Check environment variable first (allows SILENT to override test mode)
|
74
|
+
const envLevel = this.getLogLevelFromEnv();
|
75
|
+
if (envLevel === LogLevel.SILENT) {
|
76
|
+
return LogLevel.SILENT;
|
77
|
+
}
|
78
|
+
// Force ERROR level in test environments (unless SILENT)
|
79
|
+
if (isTestMode()) {
|
80
|
+
return LogLevel.ERROR;
|
81
|
+
}
|
82
|
+
// Use MCP-set level if available (takes precedence)
|
83
|
+
if (currentLoggingLevel !== null) {
|
84
|
+
return currentLoggingLevel;
|
85
|
+
}
|
86
|
+
// Use environment variable level
|
87
|
+
if (envLevel !== null) {
|
88
|
+
return envLevel;
|
89
|
+
}
|
90
|
+
// If explicit log level was provided, use it
|
91
|
+
if (this.explicitLogLevel !== undefined) {
|
92
|
+
return this.explicitLogLevel;
|
93
|
+
}
|
94
|
+
// Default to INFO
|
95
|
+
return LogLevel.INFO;
|
96
|
+
}
|
97
|
+
getLogLevelFromEnv() {
|
98
|
+
const envLevel = process.env.LOG_LEVEL?.toUpperCase();
|
99
|
+
switch (envLevel) {
|
100
|
+
case 'DEBUG':
|
101
|
+
return LogLevel.DEBUG;
|
102
|
+
case 'INFO':
|
103
|
+
return LogLevel.INFO;
|
104
|
+
case 'WARN':
|
105
|
+
return LogLevel.WARN;
|
106
|
+
case 'ERROR':
|
107
|
+
return LogLevel.ERROR;
|
108
|
+
case 'SILENT':
|
109
|
+
return LogLevel.SILENT;
|
110
|
+
default:
|
111
|
+
return null;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
shouldLog(level) {
|
115
|
+
return level >= this.getCurrentLogLevel();
|
116
|
+
}
|
117
|
+
formatMessage(level, message, context) {
|
118
|
+
const timestamp = new Date().toISOString();
|
119
|
+
const contextStr = context ? ` ${JSON.stringify(context)}` : '';
|
120
|
+
return `[${timestamp}] ${level.toUpperCase()} [${this.component}] ${message}${contextStr}`;
|
121
|
+
}
|
122
|
+
/**
|
123
|
+
* Send log message to MCP client if server is available and level is appropriate
|
124
|
+
*/
|
125
|
+
async sendMcpLogMessage(level, message, context) {
|
126
|
+
if (mcpServerInstance) {
|
127
|
+
try {
|
128
|
+
// Safely serialize context to avoid JSON issues
|
129
|
+
let logData = message;
|
130
|
+
if (context) {
|
131
|
+
try {
|
132
|
+
const contextStr = JSON.stringify(context, null, 0);
|
133
|
+
logData = `${message} ${contextStr}`;
|
134
|
+
}
|
135
|
+
catch (_error) {
|
136
|
+
// If JSON serialization fails, just use the message
|
137
|
+
logData = `${message} [context serialization failed]`;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
await mcpServerInstance.server.notification({
|
141
|
+
method: 'notifications/message',
|
142
|
+
params: {
|
143
|
+
level,
|
144
|
+
logger: this.component,
|
145
|
+
data: logData,
|
146
|
+
},
|
147
|
+
});
|
148
|
+
}
|
149
|
+
catch (error) {
|
150
|
+
// Fallback to stderr if MCP notification fails
|
151
|
+
// Don't use this.error to avoid infinite recursion
|
152
|
+
if (!isTestMode()) {
|
153
|
+
process.stderr.write(`[MCP-LOG-ERROR] Failed to send log notification: ${error}\n`);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
debug(message, context) {
|
159
|
+
if (this.shouldLog(LogLevel.DEBUG)) {
|
160
|
+
const formattedMessage = this.formatMessage('debug', message, context);
|
161
|
+
// Always log to stderr for MCP compliance
|
162
|
+
process.stderr.write(formattedMessage + '\n');
|
163
|
+
// Also send to MCP client if available (only for debug level)
|
164
|
+
this.sendMcpLogMessage('debug', message, context).catch(() => {
|
165
|
+
// Ignore MCP notification errors for debug messages
|
166
|
+
});
|
167
|
+
}
|
168
|
+
}
|
169
|
+
info(message, context) {
|
170
|
+
if (this.shouldLog(LogLevel.INFO)) {
|
171
|
+
const formattedMessage = this.formatMessage('info', message, context);
|
172
|
+
// Always log to stderr for MCP compliance
|
173
|
+
process.stderr.write(formattedMessage + '\n');
|
174
|
+
// Send enhanced notifications for important events
|
175
|
+
this.sendEnhancedMcpNotification('info', message, context).catch(() => {
|
176
|
+
// Ignore MCP notification errors for info messages
|
177
|
+
});
|
178
|
+
}
|
179
|
+
}
|
180
|
+
/**
|
181
|
+
* Send enhanced MCP notifications with better formatting for important events
|
182
|
+
*/
|
183
|
+
async sendEnhancedMcpNotification(level, message, context) {
|
184
|
+
if (mcpServerInstance) {
|
185
|
+
try {
|
186
|
+
let enhancedMessage = message;
|
187
|
+
let notificationLevel = level;
|
188
|
+
// Enhance phase transition messages
|
189
|
+
if (context &&
|
190
|
+
(context.from || context.to) &&
|
191
|
+
message.includes('transition')) {
|
192
|
+
const from = context.from
|
193
|
+
? this.capitalizePhase(context.from)
|
194
|
+
: '';
|
195
|
+
const to = context.to
|
196
|
+
? this.capitalizePhase(context.to)
|
197
|
+
: '';
|
198
|
+
if (from && to) {
|
199
|
+
enhancedMessage = `Phase Transition: ${from} → ${to}`;
|
200
|
+
notificationLevel = 'info';
|
201
|
+
}
|
202
|
+
}
|
203
|
+
// Enhance initialization messages
|
204
|
+
if (message.includes('initialized successfully')) {
|
205
|
+
enhancedMessage = '🚀 Vibe Feature MCP Server Ready';
|
206
|
+
notificationLevel = 'info';
|
207
|
+
}
|
208
|
+
// Safely serialize context to avoid JSON issues
|
209
|
+
let logData = enhancedMessage;
|
210
|
+
if (context) {
|
211
|
+
try {
|
212
|
+
const contextStr = JSON.stringify(context, null, 0);
|
213
|
+
logData = `${enhancedMessage} ${contextStr}`;
|
214
|
+
}
|
215
|
+
catch (_error) {
|
216
|
+
// If JSON serialization fails, just use the message
|
217
|
+
logData = `${enhancedMessage} [context serialization failed]`;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
// Use the underlying server's notification method
|
221
|
+
await mcpServerInstance.server.notification({
|
222
|
+
method: 'notifications/message',
|
223
|
+
params: {
|
224
|
+
level: notificationLevel,
|
225
|
+
logger: this.component,
|
226
|
+
data: logData,
|
227
|
+
},
|
228
|
+
});
|
229
|
+
}
|
230
|
+
catch (error) {
|
231
|
+
// Fallback to stderr if MCP notification fails
|
232
|
+
// Don't use this.error to avoid infinite recursion
|
233
|
+
if (!isTestMode()) {
|
234
|
+
process.stderr.write(`[MCP-LOG-ERROR] Failed to send log notification: ${error}\n`);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
}
|
239
|
+
/**
|
240
|
+
* Capitalize phase name for display
|
241
|
+
*/
|
242
|
+
capitalizePhase(phase) {
|
243
|
+
return phase
|
244
|
+
.split('_')
|
245
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
246
|
+
.join(' ');
|
247
|
+
}
|
248
|
+
warn(message, context) {
|
249
|
+
if (this.shouldLog(LogLevel.WARN)) {
|
250
|
+
const formattedMessage = this.formatMessage('warn', message, context);
|
251
|
+
// Always log to stderr for MCP compliance
|
252
|
+
process.stderr.write(formattedMessage + '\n');
|
253
|
+
// Also send to MCP client if available
|
254
|
+
this.sendEnhancedMcpNotification('warning', message, context).catch(() => {
|
255
|
+
// Ignore MCP notification errors for warn messages
|
256
|
+
});
|
257
|
+
}
|
258
|
+
}
|
259
|
+
error(message, error, context) {
|
260
|
+
if (this.shouldLog(LogLevel.ERROR)) {
|
261
|
+
const errorContext = error
|
262
|
+
? { ...context, error: error.message, stack: error.stack }
|
263
|
+
: context;
|
264
|
+
const formattedMessage = this.formatMessage('error', message, errorContext);
|
265
|
+
// Always log to stderr for MCP compliance
|
266
|
+
process.stderr.write(formattedMessage + '\n');
|
267
|
+
// Also send to MCP client if available
|
268
|
+
this.sendEnhancedMcpNotification('error', message, errorContext).catch(() => {
|
269
|
+
// Ignore MCP notification errors for error messages
|
270
|
+
});
|
271
|
+
}
|
272
|
+
}
|
273
|
+
child(childComponent) {
|
274
|
+
return new Logger(`${this.component}:${childComponent}`, this.explicitLogLevel);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
// Factory function to create loggers
|
278
|
+
export function createLogger(component, logLevel) {
|
279
|
+
return new Logger(component, logLevel);
|
280
|
+
}
|
281
|
+
// Default logger for the main application
|
282
|
+
export const logger = createLogger('VibeFeatureMCP');
|
283
|
+
//# sourceMappingURL=logger.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,yCAAS,CAAA;IACT,uCAAQ,CAAA;IACR,uCAAQ,CAAA;IACR,yCAAS,CAAA;IACT,2CAAU,CAAA;AACZ,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAUD,oDAAoD;AACpD,IAAI,iBAAiB,GAAqB,IAAI,CAAC;AAE/C,kEAAkE;AAClE,IAAI,mBAAmB,GAAoB,IAAI,CAAC;AAEhD,mDAAmD;AACnD,SAAS,UAAU;IACjB,uCAAuC;IACvC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+DAA+D;IAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gDAAgD;IAChD,IAAI,OAAO,CAAC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C9C,uCAAuC;YACvC,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,KAAK,CACpE,GAAG,EAAE;gBACH,oDAAoD;YACtD,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAsB;QAC1B,OAAO,IAAI,MAAM,CACf,GAAG,IAAI,CAAC,SAAS,IAAI,cAAc,EAAE,EACrC,IAAI,CAAC,gBAAgB,CACtB,CAAC;IACJ,CAAC;CACF;AAED,qCAAqC;AACrC,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,QAAmB;IACjE,OAAO,IAAI,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC"}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* Path Validation Utilities
|
3
|
+
*
|
4
|
+
* Provides utilities for validating file paths, resolving relative paths,
|
5
|
+
* and ensuring security constraints for the file linking functionality.
|
6
|
+
*/
|
7
|
+
export interface PathValidationResult {
|
8
|
+
isValid: boolean;
|
9
|
+
resolvedPath?: string;
|
10
|
+
error?: string;
|
11
|
+
}
|
12
|
+
export declare class PathValidationUtils {
|
13
|
+
/**
|
14
|
+
* Validate if a string is a known template name
|
15
|
+
*/
|
16
|
+
static isTemplateName(value: string, availableTemplates: string[]): boolean;
|
17
|
+
/**
|
18
|
+
* Validate and resolve a file path
|
19
|
+
*/
|
20
|
+
static validateFilePath(filePath: string, projectPath: string): Promise<PathValidationResult>;
|
21
|
+
/**
|
22
|
+
* Validate and resolve a file or directory path
|
23
|
+
*/
|
24
|
+
static validateFileOrDirectoryPath(filePath: string, projectPath: string): Promise<PathValidationResult>;
|
25
|
+
/**
|
26
|
+
* Resolve a file path to absolute, handling various formats
|
27
|
+
*/
|
28
|
+
static resolvePath(filePath: string, projectPath: string): string;
|
29
|
+
/**
|
30
|
+
* Check if a resolved path is within safe boundaries
|
31
|
+
* Prevents directory traversal attacks
|
32
|
+
*/
|
33
|
+
static isPathSafe(resolvedPath: string, projectPath: string): boolean;
|
34
|
+
/**
|
35
|
+
* Validate parameter as either template name or file path
|
36
|
+
*/
|
37
|
+
static validateParameter(value: string, availableTemplates: string[], projectPath: string): Promise<{
|
38
|
+
isTemplate: boolean;
|
39
|
+
isFilePath: boolean;
|
40
|
+
resolvedPath?: string;
|
41
|
+
error?: string;
|
42
|
+
}>;
|
43
|
+
/**
|
44
|
+
* Get common file patterns for documentation
|
45
|
+
*/
|
46
|
+
static getCommonDocumentationPatterns(): {
|
47
|
+
architecture: string[];
|
48
|
+
requirements: string[];
|
49
|
+
design: string[];
|
50
|
+
};
|
51
|
+
}
|