@rigour-labs/mcp 5.2.8 → 5.3.0

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.
@@ -1,48 +0,0 @@
1
- import { describe, expect, it, vi } from 'vitest';
2
- import { handleCheckDeep } from './deep-handlers.js';
3
- describe('handleCheckDeep privacy routing', () => {
4
- const baseReport = {
5
- status: 'PASS',
6
- summary: { 'ast-analysis': 'PASS' },
7
- failures: [],
8
- stats: {
9
- duration_ms: 10,
10
- score: 100,
11
- ai_health_score: 100,
12
- structural_score: 100,
13
- deep: { enabled: true, tier: 'lite', model: 'Qwen2.5-Coder-0.5B', total_ms: 1000 },
14
- },
15
- };
16
- it('reports local execution by default', async () => {
17
- const run = vi.fn().mockResolvedValue(baseReport);
18
- const runner = { run };
19
- const result = await handleCheckDeep(runner, '/repo', {}, {});
20
- expect(run).toHaveBeenCalledWith('/repo', undefined, {
21
- enabled: true,
22
- pro: false,
23
- apiKey: undefined,
24
- provider: 'local',
25
- apiBaseUrl: undefined,
26
- modelName: undefined,
27
- });
28
- expect(result.content[0].text).toContain('Local sidecar/model execution');
29
- });
30
- it('respects provider=local even when apiKey exists', async () => {
31
- const run = vi.fn().mockResolvedValue(baseReport);
32
- const runner = { run };
33
- const result = await handleCheckDeep(runner, '/repo', {}, {
34
- apiKey: 'sk-test',
35
- provider: 'local',
36
- });
37
- expect(run).toHaveBeenCalledWith('/repo', undefined, {
38
- enabled: true,
39
- pro: false,
40
- apiKey: 'sk-test',
41
- provider: 'local',
42
- apiBaseUrl: undefined,
43
- modelName: undefined,
44
- });
45
- expect(result.content[0].text).toContain('Local sidecar/model execution');
46
- expect(result.content[0].text).not.toContain('Code context may be sent');
47
- });
48
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- import fs from 'fs-extra';
2
- import os from 'os';
3
- import path from 'path';
4
- import { afterEach, beforeEach, describe, expect, it } from 'vitest';
5
- import { handleMcpGetSettings, handleMcpSetSettings } from './mcp-settings-handler.js';
6
- describe('mcp settings handlers', () => {
7
- let testDir;
8
- beforeEach(async () => {
9
- testDir = await fs.mkdtemp(path.join(os.tmpdir(), 'rigour-mcp-settings-'));
10
- await fs.ensureDir(path.join(testDir, '.rigour'));
11
- });
12
- afterEach(async () => {
13
- await fs.remove(testDir);
14
- });
15
- it('returns default settings when file is missing', async () => {
16
- const result = await handleMcpGetSettings(testDir);
17
- const parsed = JSON.parse(result.content[0].text);
18
- expect(parsed.deep_default_mode).toBe('off');
19
- });
20
- it('persists deep_default_mode through set/get', async () => {
21
- const setResult = await handleMcpSetSettings(testDir, { deep_default_mode: 'quick' });
22
- expect(setResult.isError).toBeUndefined();
23
- const getResult = await handleMcpGetSettings(testDir);
24
- const parsed = JSON.parse(getResult.content[0].text);
25
- expect(parsed.deep_default_mode).toBe('quick');
26
- });
27
- it('rejects invalid deep_default_mode', async () => {
28
- const result = await handleMcpSetSettings(testDir, { deep_default_mode: 'invalid' });
29
- expect(result.isError).toBe(true);
30
- });
31
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,108 +0,0 @@
1
- import { describe, expect, it, vi } from 'vitest';
2
- import { handleCheck } from './quality-handlers.js';
3
- describe('handleCheck deep routing', () => {
4
- const baseReport = {
5
- status: 'PASS',
6
- summary: { 'ast-analysis': 'PASS' },
7
- failures: [],
8
- stats: {
9
- duration_ms: 10,
10
- score: 100,
11
- ai_health_score: 100,
12
- structural_score: 100,
13
- },
14
- };
15
- it('runs standard check by default', async () => {
16
- const run = vi.fn().mockResolvedValue(baseReport);
17
- const runner = { run };
18
- await handleCheck(runner, '/repo');
19
- expect(run).toHaveBeenCalledWith('/repo', undefined, undefined);
20
- });
21
- it('maps quick deep mode and file scope', async () => {
22
- const run = vi.fn().mockResolvedValue({
23
- ...baseReport,
24
- stats: {
25
- ...baseReport.stats,
26
- deep: { enabled: true, tier: 'lite', model: 'Qwen2.5-Coder-0.5B' },
27
- },
28
- });
29
- const runner = { run };
30
- const result = await handleCheck(runner, '/repo', {
31
- deep: 'quick',
32
- files: ['src/a.ts', 'src/b.ts'],
33
- });
34
- expect(run).toHaveBeenCalledWith('/repo', ['src/a.ts', 'src/b.ts'], {
35
- enabled: true,
36
- pro: false,
37
- apiKey: undefined,
38
- provider: 'local',
39
- apiBaseUrl: undefined,
40
- modelName: undefined,
41
- });
42
- expect(result.content[0].text).toContain('Deep: quick');
43
- expect(result.content[0].text).toContain('Execution: local');
44
- expect(result.content[0].text).toContain('Code remains on this machine');
45
- });
46
- it('maps full deep mode with cloud provider', async () => {
47
- const run = vi.fn().mockResolvedValue({
48
- ...baseReport,
49
- stats: {
50
- ...baseReport.stats,
51
- deep: { enabled: true, tier: 'cloud', model: 'claude-sonnet' },
52
- },
53
- });
54
- const runner = { run };
55
- await handleCheck(runner, '/repo', {
56
- deep: 'full',
57
- pro: true,
58
- apiKey: 'sk-test',
59
- provider: 'openai',
60
- modelName: 'gpt-4o-mini',
61
- apiBaseUrl: 'https://example.com/v1',
62
- });
63
- expect(run).toHaveBeenCalledWith('/repo', undefined, {
64
- enabled: true,
65
- pro: true,
66
- apiKey: 'sk-test',
67
- provider: 'openai',
68
- apiBaseUrl: 'https://example.com/v1',
69
- modelName: 'gpt-4o-mini',
70
- });
71
- });
72
- it('treats full deep mode as pro even when pro flag is omitted', async () => {
73
- const run = vi.fn().mockResolvedValue(baseReport);
74
- const runner = { run };
75
- await handleCheck(runner, '/repo', {
76
- deep: 'full',
77
- apiKey: 'sk-test',
78
- provider: 'openai',
79
- });
80
- expect(run).toHaveBeenCalledWith('/repo', undefined, {
81
- enabled: true,
82
- pro: true,
83
- apiKey: 'sk-test',
84
- provider: 'openai',
85
- apiBaseUrl: undefined,
86
- modelName: undefined,
87
- });
88
- });
89
- it('forces local execution when provider=local even if apiKey is present', async () => {
90
- const run = vi.fn().mockResolvedValue(baseReport);
91
- const runner = { run };
92
- const result = await handleCheck(runner, '/repo', {
93
- deep: 'full',
94
- apiKey: 'sk-test',
95
- provider: 'local',
96
- });
97
- expect(run).toHaveBeenCalledWith('/repo', undefined, {
98
- enabled: true,
99
- pro: true,
100
- apiKey: 'sk-test',
101
- provider: 'local',
102
- apiBaseUrl: undefined,
103
- modelName: undefined,
104
- });
105
- expect(result.content[0].text).toContain('Execution: local');
106
- expect(result.content[0].text).toContain('Code remains on this machine');
107
- });
108
- });