ai-cli-mcp 2.3.0 → 2.3.1
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/settings.local.json +2 -1
- package/dist/__tests__/e2e.test.js +232 -0
- package/dist/__tests__/edge-cases.test.js +135 -0
- package/dist/__tests__/error-cases.test.js +291 -0
- package/dist/__tests__/mocks.js +32 -0
- package/dist/__tests__/model-alias.test.js +36 -0
- package/dist/__tests__/process-management.test.js +630 -0
- package/dist/__tests__/server.test.js +681 -0
- package/dist/__tests__/setup.js +11 -0
- package/dist/__tests__/utils/claude-mock.js +80 -0
- package/dist/__tests__/utils/mcp-client.js +104 -0
- package/dist/__tests__/utils/persistent-mock.js +25 -0
- package/dist/__tests__/utils/test-helpers.js +11 -0
- package/dist/__tests__/validation.test.js +235 -0
- package/dist/__tests__/version-print.test.js +69 -0
- package/dist/__tests__/wait.test.js +229 -0
- package/dist/parsers.js +68 -0
- package/dist/server.js +774 -0
- package/package.json +1 -1
- package/src/__tests__/e2e.test.ts +16 -24
- package/src/__tests__/error-cases.test.ts +8 -17
- package/src/__tests__/process-management.test.ts +22 -24
- package/src/__tests__/validation.test.ts +58 -36
- package/src/server.ts +6 -2
- package/data/rooms/refactor-haiku-alias-main/messages.jsonl +0 -5
- package/data/rooms/refactor-haiku-alias-main/presence.json +0 -20
- package/data/rooms.json +0 -10
- package/hello.txt +0 -3
- package/implementation-log.md +0 -110
- package/implementation-plan.md +0 -189
- package/investigation-report.md +0 -135
- package/quality-score.json +0 -47
- package/refactoring-requirements.md +0 -25
- package/review-report.md +0 -132
- package/test-results.md +0 -119
- package/xx.txt +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
// Mock Claude CLI responses
|
|
3
|
+
export const mockClaudeResponse = (stdout, stderr = '', exitCode = 0) => {
|
|
4
|
+
return {
|
|
5
|
+
stdout: { on: vi.fn((event, cb) => event === 'data' && cb(stdout)) },
|
|
6
|
+
stderr: { on: vi.fn((event, cb) => event === 'data' && cb(stderr)) },
|
|
7
|
+
on: vi.fn((event, cb) => {
|
|
8
|
+
if (event === 'exit')
|
|
9
|
+
setTimeout(() => cb(exitCode), 10);
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
// Mock MCP request builder
|
|
14
|
+
export const createMCPRequest = (tool, args, id = 1) => ({
|
|
15
|
+
jsonrpc: '2.0',
|
|
16
|
+
method: 'tools/call',
|
|
17
|
+
params: {
|
|
18
|
+
name: tool,
|
|
19
|
+
arguments: args,
|
|
20
|
+
},
|
|
21
|
+
id,
|
|
22
|
+
});
|
|
23
|
+
// Mock file system operations
|
|
24
|
+
export const setupTestEnvironment = () => {
|
|
25
|
+
const testFiles = new Map();
|
|
26
|
+
return {
|
|
27
|
+
writeFile: (path, content) => testFiles.set(path, content),
|
|
28
|
+
readFile: (path) => testFiles.get(path),
|
|
29
|
+
exists: (path) => testFiles.has(path),
|
|
30
|
+
cleanup: () => testFiles.clear(),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
// Test the model alias resolution logic directly
|
|
3
|
+
describe('Model Alias Resolution', () => {
|
|
4
|
+
// Define the same MODEL_ALIASES as in server.ts
|
|
5
|
+
const MODEL_ALIASES = {
|
|
6
|
+
'haiku': 'claude-3-5-haiku-20241022'
|
|
7
|
+
};
|
|
8
|
+
// Replicate the resolveModelAlias function
|
|
9
|
+
function resolveModelAlias(model) {
|
|
10
|
+
return MODEL_ALIASES[model] || model;
|
|
11
|
+
}
|
|
12
|
+
it('should resolve haiku alias to full model name', () => {
|
|
13
|
+
expect(resolveModelAlias('haiku')).toBe('claude-3-5-haiku-20241022');
|
|
14
|
+
});
|
|
15
|
+
it('should pass through non-alias model names unchanged', () => {
|
|
16
|
+
expect(resolveModelAlias('sonnet')).toBe('sonnet');
|
|
17
|
+
expect(resolveModelAlias('opus')).toBe('opus');
|
|
18
|
+
expect(resolveModelAlias('claude-3-opus-20240229')).toBe('claude-3-opus-20240229');
|
|
19
|
+
});
|
|
20
|
+
it('should pass through empty strings', () => {
|
|
21
|
+
expect(resolveModelAlias('')).toBe('');
|
|
22
|
+
});
|
|
23
|
+
it('should be case-sensitive', () => {
|
|
24
|
+
// Should not resolve uppercase version
|
|
25
|
+
expect(resolveModelAlias('Haiku')).toBe('Haiku');
|
|
26
|
+
expect(resolveModelAlias('HAIKU')).toBe('HAIKU');
|
|
27
|
+
});
|
|
28
|
+
it('should handle undefined input gracefully', () => {
|
|
29
|
+
// TypeScript would normally prevent this, but testing for runtime safety
|
|
30
|
+
expect(resolveModelAlias(undefined)).toBe(undefined);
|
|
31
|
+
});
|
|
32
|
+
it('should handle null input gracefully', () => {
|
|
33
|
+
// TypeScript would normally prevent this, but testing for runtime safety
|
|
34
|
+
expect(resolveModelAlias(null)).toBe(null);
|
|
35
|
+
});
|
|
36
|
+
});
|