@rigour-labs/mcp 2.22.0 → 3.0.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/src/smoke.test.ts DELETED
@@ -1,7 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- describe('MCP Smoke Test', () => {
4
- it('should pass', async () => {
5
- expect(true).toBe(true);
6
- });
7
- });
@@ -1,158 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
- import fs from 'fs-extra';
3
- import path from 'path';
4
- import os from 'os';
5
-
6
- // Integration-style tests for rigour_run_supervised
7
- // These test the exported functionality indirectly since MCP server is complex to mock
8
-
9
- describe('rigour_run_supervised', () => {
10
- let testDir: string;
11
-
12
- beforeEach(async () => {
13
- testDir = path.join(os.tmpdir(), `rigour-test-${Date.now()}`);
14
- await fs.ensureDir(testDir);
15
-
16
- // Create a minimal rigour.yml
17
- await fs.writeFile(path.join(testDir, 'rigour.yml'), `
18
- version: 1
19
- preset: api
20
- gates:
21
- max_file_lines: 500
22
- forbid_todos: true
23
- required_files: []
24
- ignore: []
25
- `);
26
-
27
- // Create .rigour directory for events
28
- await fs.ensureDir(path.join(testDir, '.rigour'));
29
- });
30
-
31
- afterEach(async () => {
32
- await fs.remove(testDir);
33
- });
34
-
35
- it('should have correct tool schema', () => {
36
- // Verify the tool schema includes all required fields
37
- const expectedProperties = ['cwd', 'command', 'maxRetries', 'dryRun'];
38
- const requiredProperties = ['cwd', 'command'];
39
-
40
- // This is a schema validation test - in real MCP, the server validates this
41
- expect(expectedProperties).toContain('dryRun');
42
- expect(requiredProperties).not.toContain('dryRun'); // dryRun should be optional
43
- });
44
-
45
- it('should log supervisor_started event', async () => {
46
- // Simulate what the handler does
47
- const eventsPath = path.join(testDir, '.rigour', 'events.jsonl');
48
-
49
- const event = {
50
- id: 'test-id',
51
- timestamp: new Date().toISOString(),
52
- type: 'supervisor_started',
53
- requestId: 'req-123',
54
- command: 'echo "test"',
55
- maxRetries: 3,
56
- dryRun: true
57
- };
58
-
59
- await fs.appendFile(eventsPath, JSON.stringify(event) + '\n');
60
-
61
- const content = await fs.readFile(eventsPath, 'utf-8');
62
- const logged = JSON.parse(content.trim());
63
-
64
- expect(logged.type).toBe('supervisor_started');
65
- expect(logged.dryRun).toBe(true);
66
- expect(logged.maxRetries).toBe(3);
67
- });
68
-
69
- it('should log supervisor_iteration events', async () => {
70
- const eventsPath = path.join(testDir, '.rigour', 'events.jsonl');
71
-
72
- // Simulate iteration logging
73
- const iterations = [
74
- { iteration: 1, status: 'FAIL', failures: 2 },
75
- { iteration: 2, status: 'FAIL', failures: 1 },
76
- { iteration: 3, status: 'PASS', failures: 0 },
77
- ];
78
-
79
- for (const iter of iterations) {
80
- const event = {
81
- id: `iter-${iter.iteration}`,
82
- timestamp: new Date().toISOString(),
83
- type: 'supervisor_iteration',
84
- requestId: 'req-123',
85
- ...iter
86
- };
87
- await fs.appendFile(eventsPath, JSON.stringify(event) + '\n');
88
- }
89
-
90
- const content = await fs.readFile(eventsPath, 'utf-8');
91
- const lines = content.trim().split('\n').map(l => JSON.parse(l));
92
-
93
- expect(lines.length).toBe(3);
94
- expect(lines[0].iteration).toBe(1);
95
- expect(lines[2].status).toBe('PASS');
96
- });
97
-
98
- it('should log supervisor_completed event with final status', async () => {
99
- const eventsPath = path.join(testDir, '.rigour', 'events.jsonl');
100
-
101
- const event = {
102
- id: 'completed-1',
103
- timestamp: new Date().toISOString(),
104
- type: 'supervisor_completed',
105
- requestId: 'req-123',
106
- finalStatus: 'PASS',
107
- totalIterations: 2
108
- };
109
-
110
- await fs.appendFile(eventsPath, JSON.stringify(event) + '\n');
111
-
112
- const content = await fs.readFile(eventsPath, 'utf-8');
113
- const logged = JSON.parse(content.trim());
114
-
115
- expect(logged.type).toBe('supervisor_completed');
116
- expect(logged.finalStatus).toBe('PASS');
117
- expect(logged.totalIterations).toBe(2);
118
- });
119
-
120
- it('should track iteration history correctly', () => {
121
- const iterations: { iteration: number; status: string; failures: number }[] = [];
122
-
123
- // Simulate the supervisor loop
124
- iterations.push({ iteration: 1, status: 'FAIL', failures: 3 });
125
- iterations.push({ iteration: 2, status: 'FAIL', failures: 1 });
126
- iterations.push({ iteration: 3, status: 'PASS', failures: 0 });
127
-
128
- const summary = iterations.map(i => ` ${i.iteration}. ${i.status} (${i.failures} failures)`).join('\n');
129
-
130
- expect(summary).toContain('1. FAIL (3 failures)');
131
- expect(summary).toContain('3. PASS (0 failures)');
132
- expect(iterations.length).toBe(3);
133
- });
134
-
135
- it('should generate fix packet for failures', () => {
136
- const failures = [
137
- { id: 'max_lines', title: 'File too long', details: 'src/index.ts has 600 lines', files: ['src/index.ts'], hint: 'Split into modules' },
138
- { id: 'forbid_todos', title: 'TODO found', details: 'Found TODO comment', files: ['src/utils.ts'] },
139
- ];
140
-
141
- const fixPacket = failures.map((f, i) => {
142
- let text = `FIX TASK ${i + 1}: [${f.id.toUpperCase()}] ${f.title}\n`;
143
- text += ` - CONTEXT: ${f.details}\n`;
144
- if (f.files && f.files.length > 0) {
145
- text += ` - TARGET FILES: ${f.files.join(', ')}\n`;
146
- }
147
- if ((f as any).hint) {
148
- text += ` - REFACTORING GUIDANCE: ${(f as any).hint}\n`;
149
- }
150
- return text;
151
- }).join('\n---\n');
152
-
153
- expect(fixPacket).toContain('[MAX_LINES]');
154
- expect(fixPacket).toContain('[FORBID_TODOS]');
155
- expect(fixPacket).toContain('Split into modules');
156
- expect(fixPacket).toContain('src/index.ts');
157
- });
158
- });
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": [
8
- "src/**/*"
9
- ]
10
- }