@gotza02/sequential-thinking 2026.1.16 → 2026.1.18
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/README.md +9 -2
- package/dist/graph.js +6 -1
- package/dist/graph.test.js +46 -0
- package/dist/index.js +1 -1
- package/dist/lib.js +4 -3
- package/dist/server.test.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ Add this to your `claude_desktop_config.json`:
|
|
|
101
101
|
"command": "npx",
|
|
102
102
|
"args": [
|
|
103
103
|
"-y",
|
|
104
|
-
"@
|
|
104
|
+
"@gotza02/sequential-thinking"
|
|
105
105
|
]
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -112,7 +112,7 @@ Add this to your `claude_desktop_config.json`:
|
|
|
112
112
|
|
|
113
113
|
For quick installation, click one of the installation buttons below...
|
|
114
114
|
|
|
115
|
-
[](https://insiders.vscode.dev/redirect/mcp/install?name=sequentialthinking&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%
|
|
115
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=sequentialthinking&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40gotza02%2Fsequential-thinking%22%5D%7D)
|
|
116
116
|
|
|
117
117
|
## Building
|
|
118
118
|
|
|
@@ -127,6 +127,13 @@ npm run build
|
|
|
127
127
|
npm test
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
## Recent Updates (v2026.1.18)
|
|
131
|
+
|
|
132
|
+
- **Bug Fixes**:
|
|
133
|
+
- Fixed an issue where commented-out imports were incorrectly parsed by the graph analyzer.
|
|
134
|
+
- Resolved a branching logic issue where branch IDs could collide.
|
|
135
|
+
- Fixed version mismatch between package.json and server instance.
|
|
136
|
+
|
|
130
137
|
## License
|
|
131
138
|
|
|
132
139
|
This MCP server is licensed under the MIT License.
|
package/dist/graph.js
CHANGED
|
@@ -45,7 +45,12 @@ export class ProjectKnowledgeGraph {
|
|
|
45
45
|
}
|
|
46
46
|
async parseFile(filePath) {
|
|
47
47
|
try {
|
|
48
|
-
|
|
48
|
+
let content = await fs.readFile(filePath, 'utf-8');
|
|
49
|
+
// Remove comments before parsing imports
|
|
50
|
+
// 1. Remove block comments /* ... */
|
|
51
|
+
content = content.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
52
|
+
// 2. Remove line comments // ...
|
|
53
|
+
content = content.replace(/\/\/.*$/gm, '');
|
|
49
54
|
const importRegex = /import\s+(?:[\w\s{},*]+from\s+)?['"]([^'"]+)['"]/g;
|
|
50
55
|
const dynamicImportRegex = /import\(['"]([^'"]+)['"]\)/g;
|
|
51
56
|
const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
+
import { ProjectKnowledgeGraph } from './graph.js';
|
|
3
|
+
import * as fs from 'fs/promises';
|
|
4
|
+
vi.mock('fs/promises');
|
|
5
|
+
describe('ProjectKnowledgeGraph', () => {
|
|
6
|
+
let graph;
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
graph = new ProjectKnowledgeGraph();
|
|
9
|
+
vi.resetAllMocks();
|
|
10
|
+
});
|
|
11
|
+
it('should ignore imports in comments', async () => {
|
|
12
|
+
const mockFiles = ['/app/index.ts', '/app/utils.ts', '/app/oldUtils.ts'];
|
|
13
|
+
const mockContentIndex = `
|
|
14
|
+
import { something } from './utils';
|
|
15
|
+
// import { oldThing } from './oldUtils';
|
|
16
|
+
/* import { other } from './other' */
|
|
17
|
+
`;
|
|
18
|
+
const mockContentUtils = 'export const something = 1;';
|
|
19
|
+
fs.readdir.mockResolvedValue([
|
|
20
|
+
{ name: 'index.ts', isDirectory: () => false },
|
|
21
|
+
{ name: 'utils.ts', isDirectory: () => false },
|
|
22
|
+
{ name: 'oldUtils.ts', isDirectory: () => false }
|
|
23
|
+
]);
|
|
24
|
+
fs.readFile.mockImplementation(async (path) => {
|
|
25
|
+
if (path.includes('index.ts'))
|
|
26
|
+
return mockContentIndex;
|
|
27
|
+
return '';
|
|
28
|
+
});
|
|
29
|
+
// Mock resolvePath behavior indirectly by mocking existing files check in graph.build logic
|
|
30
|
+
// But since graph.ts uses fs.readdir recursively, we need to mock that structure.
|
|
31
|
+
// For simplicity in this unit test, we'll mock 'getAllFiles' if it were public,
|
|
32
|
+
// but since it's private, we have to mock fs structure carefully or rely on the implementation.
|
|
33
|
+
// Let's rely on the fact that build calls getAllFiles which calls readdir.
|
|
34
|
+
// We need to ensure 'utils.ts' and 'oldUtils.ts' resolution is tested.
|
|
35
|
+
// Actually, since we mock readFile, the file existence check in resolvePath uses "this.nodes.has".
|
|
36
|
+
// "this.nodes" is populated by getAllFiles.
|
|
37
|
+
// So we need getAllFiles to return both index.ts and utils.ts.
|
|
38
|
+
// And NOT oldUtils.ts so we can see if it tries to resolve it?
|
|
39
|
+
// Actually, if it tries to resolve 'oldUtils', it might fail if not in nodes.
|
|
40
|
+
// But the bug is that it SHOULD NOT even try to resolve 'oldUtils' because it's commented out.
|
|
41
|
+
await graph.build('/app');
|
|
42
|
+
const relationships = graph.getRelationships('/app/index.ts');
|
|
43
|
+
expect(relationships?.imports).toContain('utils.ts');
|
|
44
|
+
expect(relationships?.imports).not.toContain('oldUtils.ts');
|
|
45
|
+
});
|
|
46
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ProjectKnowledgeGraph } from './graph.js';
|
|
|
10
10
|
const execAsync = promisify(exec);
|
|
11
11
|
const server = new McpServer({
|
|
12
12
|
name: "sequential-thinking-server",
|
|
13
|
-
version: "
|
|
13
|
+
version: "2026.1.18",
|
|
14
14
|
});
|
|
15
15
|
const thinkingServer = new SequentialThinkingServer();
|
|
16
16
|
const knowledgeGraph = new ProjectKnowledgeGraph();
|
package/dist/lib.js
CHANGED
|
@@ -59,10 +59,11 @@ export class SequentialThinkingServer {
|
|
|
59
59
|
}
|
|
60
60
|
this.thoughtHistory.push(input);
|
|
61
61
|
if (input.branchFromThought && input.branchId) {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const branchKey = `${input.branchFromThought}-${input.branchId}`;
|
|
63
|
+
if (!this.branches[branchKey]) {
|
|
64
|
+
this.branches[branchKey] = [];
|
|
64
65
|
}
|
|
65
|
-
this.branches[
|
|
66
|
+
this.branches[branchKey].push(input);
|
|
66
67
|
}
|
|
67
68
|
if (!this.disableThoughtLogging) {
|
|
68
69
|
const formattedThought = this.formatThought(input);
|
package/dist/server.test.js
CHANGED
|
@@ -39,7 +39,7 @@ describe('SequentialThinkingServer', () => {
|
|
|
39
39
|
};
|
|
40
40
|
const result1 = server.processThought(branch1Input);
|
|
41
41
|
const content1 = JSON.parse(result1.content[0].text);
|
|
42
|
-
expect(content1.branches).toContain("branch-A");
|
|
42
|
+
expect(content1.branches).toContain("1-branch-A");
|
|
43
43
|
// Branch 2
|
|
44
44
|
const branch2Input = {
|
|
45
45
|
thought: "Alternative B",
|
|
@@ -52,7 +52,7 @@ describe('SequentialThinkingServer', () => {
|
|
|
52
52
|
};
|
|
53
53
|
const result2 = server.processThought(branch2Input);
|
|
54
54
|
const content2 = JSON.parse(result2.content[0].text);
|
|
55
|
-
expect(content2.branches).toContain("branch-B");
|
|
55
|
+
expect(content2.branches).toContain("1-branch-B");
|
|
56
56
|
expect(content2.branches.length).toBe(2);
|
|
57
57
|
});
|
|
58
58
|
it('should handle evaluation with scores', () => {
|