bobs-workshop 0.3.3 → 3.1.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/LICENSE +2 -2
- package/README.md +199 -210
- package/bin/bobs-workshop.js +109 -0
- package/config/agents.json +27 -0
- package/dist/plugins/bobs-workshop.js +34 -0
- package/dist/tools/background-agent/cancel.d.ts +3 -0
- package/dist/tools/background-agent/cancel.d.ts.map +1 -0
- package/dist/tools/background-agent/cancel.js +52 -0
- package/dist/tools/background-agent/concurrency.d.ts +15 -0
- package/dist/tools/background-agent/concurrency.d.ts.map +1 -0
- package/dist/tools/background-agent/concurrency.js +61 -0
- package/dist/tools/background-agent/index.d.ts +8 -0
- package/dist/tools/background-agent/index.d.ts.map +1 -0
- package/dist/tools/background-agent/index.js +7 -0
- package/dist/tools/background-agent/launch.d.ts +6 -0
- package/dist/tools/background-agent/launch.d.ts.map +1 -0
- package/dist/tools/background-agent/launch.js +33 -0
- package/dist/tools/background-agent/list.d.ts +7 -0
- package/dist/tools/background-agent/list.d.ts.map +1 -0
- package/dist/tools/background-agent/list.js +40 -0
- package/dist/tools/background-agent/manager.d.ts +29 -0
- package/dist/tools/background-agent/manager.d.ts.map +1 -0
- package/dist/tools/background-agent/manager.js +388 -0
- package/dist/tools/background-agent/output.d.ts +3 -0
- package/dist/tools/background-agent/output.d.ts.map +1 -0
- package/dist/tools/background-agent/output.js +41 -0
- package/dist/tools/background-agent/types.d.ts +46 -0
- package/dist/tools/background-agent/types.d.ts.map +1 -0
- package/dist/tools/background-agent/types.js +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/manual/index.d.ts +3 -0
- package/dist/tools/manual/index.d.ts.map +1 -0
- package/dist/tools/manual/index.js +2 -0
- package/dist/tools/manual/manual-update.d.ts +4 -0
- package/dist/tools/manual/manual-update.d.ts.map +1 -0
- package/dist/tools/manual/manual-update.js +190 -0
- package/dist/tools/manual/verify-manual.d.ts +4 -0
- package/dist/tools/manual/verify-manual.d.ts.map +1 -0
- package/dist/tools/manual/verify-manual.js +51 -0
- package/package.json +34 -66
- package/postinstall.js +193 -0
- package/src/agents/alice.md +466 -0
- package/src/agents/bob-rev.md +493 -0
- package/src/agents/bob-send.md +277 -0
- package/src/agents/bob.md +442 -0
- package/src/agents/trace.md +451 -0
- package/src/plugins/bobs-workshop.ts +45 -0
- package/src/skills/api-patterns/SKILL.md +376 -0
- package/src/skills/architecture/SKILL.md +271 -0
- package/src/skills/bobs-workshop/performance/icon.svg +3 -0
- package/src/skills/brainstorming/SKILL.md +210 -0
- package/src/skills/clean-code/SKILL.md +151 -0
- package/src/skills/code-review-checklist/SKILL.md +220 -0
- package/src/skills/database-design/SKILL.md +271 -0
- package/src/skills/exploration/SKILL.md +257 -0
- package/src/skills/frontend-ui-ux/SKILL.md +78 -0
- package/src/skills/git-master/SKILL.md +1105 -0
- package/src/skills/performance/SKILL.md +144 -0
- package/src/skills/performance/icon.svg +3 -0
- package/src/skills/plan-writing/SKILL.md +225 -0
- package/src/skills/security/SKILL.md +410 -0
- package/src/skills/simplification/SKILL.md +238 -0
- package/src/skills/systematic-debugging/SKILL.md +175 -0
- package/src/skills/testing-patterns/SKILL.md +305 -0
- package/src/skills/verification/SKILL.md +286 -0
- package/src/tools/background-agent/cancel.ts +67 -0
- package/src/tools/background-agent/concurrency.ts +71 -0
- package/src/tools/background-agent/index.ts +7 -0
- package/src/tools/background-agent/launch.ts +39 -0
- package/src/tools/background-agent/list.ts +50 -0
- package/src/tools/background-agent/manager.ts +466 -0
- package/src/tools/background-agent/output.ts +57 -0
- package/src/tools/background-agent/types.ts +55 -0
- package/src/tools/index.ts +8 -0
- package/src/tools/manual/index.ts +2 -0
- package/src/tools/manual/manual-update.ts +197 -0
- package/src/tools/manual/verify-manual.ts +60 -0
- package/uninstall.js +64 -0
- package/Claude.md +0 -162
- package/bin/bobs-mcp-server.js +0 -11
- package/bin/bobs-mcp.js +0 -130
- package/dist/api/taskLogger.js +0 -106
- package/dist/api/taskLogger.js.map +0 -1
- package/dist/cli/checker.js +0 -401
- package/dist/cli/checker.js.map +0 -1
- package/dist/cli/cleanup.js +0 -131
- package/dist/cli/cleanup.js.map +0 -1
- package/dist/cli/debug.js +0 -157
- package/dist/cli/debug.js.map +0 -1
- package/dist/cli/health.js +0 -97
- package/dist/cli/health.js.map +0 -1
- package/dist/cli/setup.js +0 -81
- package/dist/cli/setup.js.map +0 -1
- package/dist/cli/workshop.js +0 -42
- package/dist/cli/workshop.js.map +0 -1
- package/dist/dashboard/server.js +0 -1203
- package/dist/dashboard/server.js.map +0 -1
- package/dist/index.js +0 -960
- package/dist/index.js.map +0 -1
- package/dist/prompts/architect.js +0 -221
- package/dist/prompts/architect.js.map +0 -1
- package/dist/prompts/debugger.js +0 -257
- package/dist/prompts/debugger.js.map +0 -1
- package/dist/prompts/engineer.js +0 -249
- package/dist/prompts/engineer.js.map +0 -1
- package/dist/prompts/orchestrator.js +0 -304
- package/dist/prompts/orchestrator.js.map +0 -1
- package/dist/prompts/reviewer.js +0 -289
- package/dist/prompts/reviewer.js.map +0 -1
- package/dist/services/activitySummarizer.js +0 -388
- package/dist/services/activitySummarizer.js.map +0 -1
- package/dist/services/changeValidator.js +0 -396
- package/dist/services/changeValidator.js.map +0 -1
- package/dist/services/claudeOrchestrator.js +0 -343
- package/dist/services/claudeOrchestrator.js.map +0 -1
- package/dist/services/fileMonitor.js +0 -250
- package/dist/services/fileMonitor.js.map +0 -1
- package/dist/services/implementationSummarizer.js +0 -306
- package/dist/services/implementationSummarizer.js.map +0 -1
- package/dist/services/liveMonitor.js +0 -315
- package/dist/services/liveMonitor.js.map +0 -1
- package/dist/services/mcpAuditLogger.js +0 -104
- package/dist/services/mcpAuditLogger.js.map +0 -1
- package/dist/services/mcpLogger.js +0 -223
- package/dist/services/mcpLogger.js.map +0 -1
- package/dist/services/tmuxManager.js +0 -541
- package/dist/services/tmuxManager.js.map +0 -1
- package/dist/tools/approvalTools.js +0 -244
- package/dist/tools/approvalTools.js.map +0 -1
- package/dist/tools/autoDebugger.js +0 -147
- package/dist/tools/autoDebugger.js.map +0 -1
- package/dist/tools/cleanupService.js +0 -221
- package/dist/tools/cleanupService.js.map +0 -1
- package/dist/tools/dashboardTools.js +0 -342
- package/dist/tools/dashboardTools.js.map +0 -1
- package/dist/tools/developmentNudges.js +0 -336
- package/dist/tools/developmentNudges.js.map +0 -1
- package/dist/tools/gitTools.js +0 -741
- package/dist/tools/gitTools.js.map +0 -1
- package/dist/tools/orchestratorTools.js +0 -832
- package/dist/tools/orchestratorTools.js.map +0 -1
- package/dist/tools/searchCache.js +0 -64
- package/dist/tools/searchCache.js.map +0 -1
- package/dist/tools/searchTools.js +0 -1107
- package/dist/tools/searchTools.js.map +0 -1
- package/dist/tools/semgrep-patterns.js +0 -296
- package/dist/tools/semgrep-patterns.js.map +0 -1
- package/dist/tools/specTools.js +0 -332
- package/dist/tools/specTools.js.map +0 -1
- package/dist/tools/structural/__tests__/orchestrator.test.js +0 -61
- package/dist/tools/structural/__tests__/orchestrator.test.js.map +0 -1
- package/dist/tools/structural/cache.js +0 -226
- package/dist/tools/structural/cache.js.map +0 -1
- package/dist/tools/structural/engines/python/index.js +0 -118
- package/dist/tools/structural/engines/python/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js +0 -97
- package/dist/tools/structural/engines/typescript/__tests__/typescript-engine.test.js.map +0 -1
- package/dist/tools/structural/engines/typescript/analyzer.js +0 -433
- package/dist/tools/structural/engines/typescript/analyzer.js.map +0 -1
- package/dist/tools/structural/engines/typescript/index.js +0 -381
- package/dist/tools/structural/engines/typescript/index.js.map +0 -1
- package/dist/tools/structural/engines/typescript/utils.js +0 -279
- package/dist/tools/structural/engines/typescript/utils.js.map +0 -1
- package/dist/tools/structural/index.js +0 -248
- package/dist/tools/structural/index.js.map +0 -1
- package/dist/tools/structural/types.js +0 -18
- package/dist/tools/structural/types.js.map +0 -1
- package/dist/tools/tmuxTools.js +0 -100
- package/dist/tools/tmuxTools.js.map +0 -1
- package/dist/tools/workRecorder.js +0 -215
- package/dist/tools/workRecorder.js.map +0 -1
- package/dist/tools/worktreeTools.js +0 -705
- package/dist/tools/worktreeTools.js.map +0 -1
- package/dist/utils/__tests__/integration.test.js +0 -57
- package/dist/utils/__tests__/integration.test.js.map +0 -1
- package/dist/utils/__tests__/serverDetection.test.js +0 -151
- package/dist/utils/__tests__/serverDetection.test.js.map +0 -1
- package/dist/utils/errorHandling.js +0 -336
- package/dist/utils/errorHandling.js.map +0 -1
- package/dist/utils/processManager.js +0 -172
- package/dist/utils/processManager.js.map +0 -1
- package/dist/utils/reliability.js +0 -263
- package/dist/utils/reliability.js.map +0 -1
- package/dist/utils/responseFormatter.js +0 -250
- package/dist/utils/responseFormatter.js.map +0 -1
- package/dist/utils/serverDetection.js +0 -133
- package/dist/utils/serverDetection.js.map +0 -1
- package/dist/utils/specMigration.js +0 -105
- package/dist/utils/specMigration.js.map +0 -1
- package/dist/validation/schemas.js +0 -299
- package/dist/validation/schemas.js.map +0 -1
- package/public/.well-known/mcp/manifest.json +0 -473
- package/public/index.html +0 -3157
- package/public/index.html.backup +0 -2805
- package/public/index.html.backup2 +0 -1292
- package/scripts/cleanup-system-logs.ts +0 -121
- package/scripts/init-workspace.js +0 -63
- package/scripts/install-search-tools.js +0 -116
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/tools/structural/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAc,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA4BlE,MAAM,OAAO,YAAY;IAYv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CAAC;QAE1F,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACjC,MAAM,YAAY,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAM,CAAC;AACV,CAAC"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { ErrorCode, AnalysisError } from "../../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Python Structural Search Engine (Stub Implementation)
|
|
4
|
-
*
|
|
5
|
-
* This is a placeholder for the Python structural search engine.
|
|
6
|
-
* Full implementation will use libcst for AST parsing and analysis.
|
|
7
|
-
*
|
|
8
|
-
* Planned features:
|
|
9
|
-
* - Find references and definitions in Python code
|
|
10
|
-
* - Analyze dependencies (import statements)
|
|
11
|
-
* - Detect circular dependencies
|
|
12
|
-
* - Find unused exports
|
|
13
|
-
* - Call graph analysis
|
|
14
|
-
*/
|
|
15
|
-
export class PythonEngine {
|
|
16
|
-
/**
|
|
17
|
-
* Find all references to a symbol
|
|
18
|
-
* @throws {AnalysisError} Not implemented
|
|
19
|
-
*/
|
|
20
|
-
async findReferences(symbolName, scope, options) {
|
|
21
|
-
throw new AnalysisError({
|
|
22
|
-
code: ErrorCode.PARSE_ERROR,
|
|
23
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
24
|
-
details: {
|
|
25
|
-
symbolName,
|
|
26
|
-
file: scope,
|
|
27
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Find the definition of a symbol
|
|
33
|
-
* @throws {AnalysisError} Not implemented
|
|
34
|
-
*/
|
|
35
|
-
async findDefinition(symbolName, scope, options) {
|
|
36
|
-
throw new AnalysisError({
|
|
37
|
-
code: ErrorCode.PARSE_ERROR,
|
|
38
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
39
|
-
details: {
|
|
40
|
-
symbolName,
|
|
41
|
-
file: scope,
|
|
42
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get dependencies of a file or symbol
|
|
48
|
-
* @throws {AnalysisError} Not implemented
|
|
49
|
-
*/
|
|
50
|
-
async getDependencies(target, options) {
|
|
51
|
-
throw new AnalysisError({
|
|
52
|
-
code: ErrorCode.PARSE_ERROR,
|
|
53
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
54
|
-
details: {
|
|
55
|
-
file: target,
|
|
56
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get dependency graph
|
|
62
|
-
* @throws {AnalysisError} Not implemented
|
|
63
|
-
*/
|
|
64
|
-
async getDependencyGraph(filePath, depth = 2) {
|
|
65
|
-
throw new AnalysisError({
|
|
66
|
-
code: ErrorCode.PARSE_ERROR,
|
|
67
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
68
|
-
details: {
|
|
69
|
-
file: filePath,
|
|
70
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Find architectural issues
|
|
76
|
-
* @throws {AnalysisError} Not implemented
|
|
77
|
-
*/
|
|
78
|
-
async findArchitecturalIssues(scope) {
|
|
79
|
-
throw new AnalysisError({
|
|
80
|
-
code: ErrorCode.PARSE_ERROR,
|
|
81
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
82
|
-
details: {
|
|
83
|
-
file: scope,
|
|
84
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Find unused exports
|
|
90
|
-
* @throws {AnalysisError} Not implemented
|
|
91
|
-
*/
|
|
92
|
-
async findUnusedExports(scope) {
|
|
93
|
-
throw new AnalysisError({
|
|
94
|
-
code: ErrorCode.PARSE_ERROR,
|
|
95
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
96
|
-
details: {
|
|
97
|
-
file: scope,
|
|
98
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get refactor impact
|
|
104
|
-
* @throws {AnalysisError} Not implemented
|
|
105
|
-
*/
|
|
106
|
-
async getRefactorImpact(symbol, scope) {
|
|
107
|
-
throw new AnalysisError({
|
|
108
|
-
code: ErrorCode.PARSE_ERROR,
|
|
109
|
-
message: "Python structural search is not yet implemented. This feature is planned for Phase 2.",
|
|
110
|
-
details: {
|
|
111
|
-
symbolName: symbol,
|
|
112
|
-
file: scope,
|
|
113
|
-
suggestion: "Use lexical or semantic search modes for Python files, or contribute to the Python engine implementation!"
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tools/structural/engines/python/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,SAAS,EACT,aAAa,EACd,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO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EAAE,uFAAuF;YAChG,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK;gBACX,UAAU,EAAE,2GAA2G;aACxH;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACnC,MAAM,IAAI,aAAa,CAAC;YACtB,IAAI,EAAE,SAAS,CAAC,WAAW;YAC3B,OAAO,EAAE,uFAAuF;YAChG,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK;gBACX,UAAU,EAAE,2GAA2G;aACxH;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CAAC,MAAc,EAAE,KAAa;QACnD,MAAM,IAAI,aAAa,CAAC;YACtB,IAAI,EAAE,SAAS,CAAC,WAAW;YAC3B,OAAO,EAAE,uFAAuF;YAChG,OAAO,EAAE;gBACP,UAAU,EAAE,MAAM;gBAClB,IAAI,EAAE,KAAK;gBACX,UAAU,EAAE,2GAA2G;aACxH;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { TypeScriptEngine } from '../index.js';
|
|
2
|
-
import { describe, it, expect, beforeEach } from '@jest/globals';
|
|
3
|
-
describe('TypeScriptEngine', () => {
|
|
4
|
-
let engine;
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
engine = new TypeScriptEngine();
|
|
7
|
-
});
|
|
8
|
-
describe('findReferences', () => {
|
|
9
|
-
it('should find references to a symbol', async () => {
|
|
10
|
-
// This is a placeholder test - in production, you'd use a test fixture
|
|
11
|
-
const results = await engine.findReferences('TypeScriptEngine', __dirname, { maxResults: 10 });
|
|
12
|
-
expect(Array.isArray(results)).toBe(true);
|
|
13
|
-
}, 30000); // 30 second timeout for AST parsing
|
|
14
|
-
it('should respect maxResults limit', async () => {
|
|
15
|
-
const results = await engine.findReferences('TypeScriptEngine', __dirname, { maxResults: 5 });
|
|
16
|
-
expect(results.length).toBeLessThanOrEqual(5);
|
|
17
|
-
}, 30000);
|
|
18
|
-
it('should handle non-existent symbols gracefully', async () => {
|
|
19
|
-
const results = await engine.findReferences('NonExistentSymbolXYZ123', __dirname, { maxResults: 10 });
|
|
20
|
-
expect(Array.isArray(results)).toBe(true);
|
|
21
|
-
expect(results.length).toBe(0);
|
|
22
|
-
}, 30000);
|
|
23
|
-
});
|
|
24
|
-
describe('findDefinition', () => {
|
|
25
|
-
it('should find definition of a symbol', async () => {
|
|
26
|
-
const result = await engine.findDefinition('TypeScriptEngine', __dirname);
|
|
27
|
-
// Result can be null if symbol not found in scope
|
|
28
|
-
expect(result === null || typeof result === 'object').toBe(true);
|
|
29
|
-
}, 30000);
|
|
30
|
-
it('should return null for non-existent symbols', async () => {
|
|
31
|
-
const result = await engine.findDefinition('NonExistentSymbolXYZ123', __dirname);
|
|
32
|
-
expect(result).toBeNull();
|
|
33
|
-
}, 30000);
|
|
34
|
-
});
|
|
35
|
-
describe('getDependencies', () => {
|
|
36
|
-
it('should get dependencies for a file', async () => {
|
|
37
|
-
const results = await engine.getDependencies(__filename, { maxResults: 20 });
|
|
38
|
-
expect(Array.isArray(results)).toBe(true);
|
|
39
|
-
}, 30000);
|
|
40
|
-
it('should return import information', async () => {
|
|
41
|
-
const results = await engine.getDependencies(__filename, { maxResults: 20 });
|
|
42
|
-
if (results.length > 0) {
|
|
43
|
-
expect(results[0]).toHaveProperty('file');
|
|
44
|
-
expect(results[0]).toHaveProperty('symbol');
|
|
45
|
-
expect(results[0]).toHaveProperty('kind');
|
|
46
|
-
}
|
|
47
|
-
}, 30000);
|
|
48
|
-
});
|
|
49
|
-
describe('findArchitecturalIssues', () => {
|
|
50
|
-
it('should return an array of issues', async () => {
|
|
51
|
-
const issues = await engine.findArchitecturalIssues(__dirname);
|
|
52
|
-
expect(Array.isArray(issues)).toBe(true);
|
|
53
|
-
}, 30000);
|
|
54
|
-
it('should identify circular dependencies if present', async () => {
|
|
55
|
-
const issues = await engine.findArchitecturalIssues(__dirname);
|
|
56
|
-
// Issues array can be empty if no problems found
|
|
57
|
-
issues.forEach(issue => {
|
|
58
|
-
expect(issue).toHaveProperty('type');
|
|
59
|
-
expect(issue).toHaveProperty('severity');
|
|
60
|
-
expect(issue).toHaveProperty('message');
|
|
61
|
-
expect(issue).toHaveProperty('location');
|
|
62
|
-
});
|
|
63
|
-
}, 30000);
|
|
64
|
-
});
|
|
65
|
-
describe('findUnusedExports', () => {
|
|
66
|
-
it('should return an array of unused exports', async () => {
|
|
67
|
-
const unused = await engine.findUnusedExports(__dirname);
|
|
68
|
-
expect(Array.isArray(unused)).toBe(true);
|
|
69
|
-
}, 30000);
|
|
70
|
-
it('should include symbol name and location', async () => {
|
|
71
|
-
const unused = await engine.findUnusedExports(__dirname);
|
|
72
|
-
unused.forEach(item => {
|
|
73
|
-
expect(item).toHaveProperty('name');
|
|
74
|
-
expect(item).toHaveProperty('kind');
|
|
75
|
-
expect(item).toHaveProperty('location');
|
|
76
|
-
expect(item).toHaveProperty('exportedFrom');
|
|
77
|
-
});
|
|
78
|
-
}, 30000);
|
|
79
|
-
});
|
|
80
|
-
describe('getRefactorImpact', () => {
|
|
81
|
-
it('should calculate refactor impact', async () => {
|
|
82
|
-
const impact = await engine.getRefactorImpact('TypeScriptEngine', __dirname);
|
|
83
|
-
expect(impact).toHaveProperty('symbol');
|
|
84
|
-
expect(impact).toHaveProperty('referenceCount');
|
|
85
|
-
expect(impact).toHaveProperty('affectedFiles');
|
|
86
|
-
expect(impact).toHaveProperty('testFiles');
|
|
87
|
-
expect(Array.isArray(impact.affectedFiles)).toBe(true);
|
|
88
|
-
expect(Array.isArray(impact.testFiles)).toBe(true);
|
|
89
|
-
}, 30000);
|
|
90
|
-
it('should return zero references for non-existent symbol', async () => {
|
|
91
|
-
const impact = await engine.getRefactorImpact('NonExistentSymbolXYZ123', __dirname);
|
|
92
|
-
expect(impact.referenceCount).toBe(0);
|
|
93
|
-
expect(impact.affectedFiles.length).toBe(0);
|
|
94
|
-
}, 30000);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
//# sourceMappingURL=typescript-engine.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-engine.test.js","sourceRoot":"","sources":["../../../../../../src/tools/structural/engines/typescript/__tests__/typescript-engine.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEjE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,MAAwB,CAAC;IAE7B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;YAClD,uEAAuE;YACvE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;YAC/F,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,oCAAoC;QAE/C,EAAE,CAAC,iCAAiC,EAAE,KAAK,IAAI,EAAE;YAC/C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9F,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAChD,CAAC,EAAE,KAAK,CAAC,CAAC;QAEV,EAAE,CAAC,+CAA+C,EAAE,KAA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AAkB,EAAE,SAAS,CAAC,CAAC;YAC7E,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;YAChD,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;YAC/C,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC,EAAE,KAAK,CAAC,CAAC;QAEV,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAC;YACpF,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
import { Node, SyntaxKind, ts } from "ts-morph";
|
|
2
|
-
import { nodeToLocation, getSymbolKind, getTypeString, positionToOffset } from "./utils.js";
|
|
3
|
-
export function extractSymbolInfo(node, includePrivate = false, includeDefinition = false) {
|
|
4
|
-
const symbol = node.getSymbol();
|
|
5
|
-
if (!symbol)
|
|
6
|
-
return null;
|
|
7
|
-
const name = symbol.getName();
|
|
8
|
-
if (!includePrivate && name.startsWith("_"))
|
|
9
|
-
return null;
|
|
10
|
-
const kind = getSymbolKind(node);
|
|
11
|
-
const type = node.getType();
|
|
12
|
-
const modifiers = [];
|
|
13
|
-
if (Node.isModifierable(node)) {
|
|
14
|
-
if (node.hasModifier(SyntaxKind.PublicKeyword))
|
|
15
|
-
modifiers.push("public");
|
|
16
|
-
if (node.hasModifier(SyntaxKind.PrivateKeyword))
|
|
17
|
-
modifiers.push("private");
|
|
18
|
-
if (node.hasModifier(SyntaxKind.ProtectedKeyword))
|
|
19
|
-
modifiers.push("protected");
|
|
20
|
-
if (node.hasModifier(SyntaxKind.StaticKeyword))
|
|
21
|
-
modifiers.push("static");
|
|
22
|
-
if (node.hasModifier(SyntaxKind.AsyncKeyword))
|
|
23
|
-
modifiers.push("async");
|
|
24
|
-
if (node.hasModifier(SyntaxKind.ReadonlyKeyword))
|
|
25
|
-
modifiers.push("readonly");
|
|
26
|
-
if (node.hasModifier(SyntaxKind.AbstractKeyword))
|
|
27
|
-
modifiers.push("abstract");
|
|
28
|
-
}
|
|
29
|
-
const documentation = symbol.getJsDocTags().map(tag => `@${tag.getName()}${tag.getText() ? ` ${tag.getText()}` : ""}`).join("\n");
|
|
30
|
-
const location = nodeToLocation(node);
|
|
31
|
-
let definition;
|
|
32
|
-
if (includeDefinition) {
|
|
33
|
-
definition = getSymbolDefinition(symbol);
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
name,
|
|
37
|
-
kind,
|
|
38
|
-
type: getTypeString(type),
|
|
39
|
-
location: {
|
|
40
|
-
file: location.file,
|
|
41
|
-
line: location.position.line
|
|
42
|
-
},
|
|
43
|
-
documentation: documentation || undefined,
|
|
44
|
-
modifiers: modifiers.length > 0 ? modifiers : undefined,
|
|
45
|
-
relationships: extractRelationships(node),
|
|
46
|
-
definition
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function extractRelationships(node) {
|
|
50
|
-
const relationships = {};
|
|
51
|
-
if (Node.isClassDeclaration(node) || Node.isInterfaceDeclaration(node)) {
|
|
52
|
-
const heritage = node.getHeritageClauses();
|
|
53
|
-
const extendsClause = heritage.find(h => h.getToken() === SyntaxKind.ExtendsKeyword);
|
|
54
|
-
if (extendsClause) {
|
|
55
|
-
const extendsNodes = extendsClause.getTypeNodes();
|
|
56
|
-
if (extendsNodes.length > 0) {
|
|
57
|
-
relationships.extends = extendsNodes.map(expr => ({
|
|
58
|
-
name: expr.getText(),
|
|
59
|
-
kind: "class"
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (Node.isClassDeclaration(node)) {
|
|
64
|
-
const implementsNodes = node.getImplements() || [];
|
|
65
|
-
if (implementsNodes.length > 0) {
|
|
66
|
-
relationships.implements = implementsNodes.map(expr => ({
|
|
67
|
-
name: expr.getText(),
|
|
68
|
-
kind: "interface"
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return Object.keys(relationships).length > 0 ? relationships : undefined;
|
|
74
|
-
}
|
|
75
|
-
function getSymbolDefinition(symbol) {
|
|
76
|
-
const declarations = symbol.getDeclarations();
|
|
77
|
-
if (declarations.length === 0) {
|
|
78
|
-
// Try to get the aliased symbol if this is an alias
|
|
79
|
-
const aliasedSymbol = symbol.getAliasedSymbol();
|
|
80
|
-
if (aliasedSymbol && aliasedSymbol !== symbol) {
|
|
81
|
-
return getSymbolDefinition(aliasedSymbol);
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
// Sort declarations by preference
|
|
86
|
-
const sortedDeclarations = declarations.slice().sort((a, b) => {
|
|
87
|
-
const aFile = a.getSourceFile().getFilePath();
|
|
88
|
-
const bFile = b.getSourceFile().getFilePath();
|
|
89
|
-
// 1. Prefer non-.d.ts files (actual source)
|
|
90
|
-
const aIsDts = aFile.endsWith('.d.ts');
|
|
91
|
-
const bIsDts = bFile.endsWith('.d.ts');
|
|
92
|
-
if (aIsDts !== bIsDts) {
|
|
93
|
-
return aIsDts ? 1 : -1;
|
|
94
|
-
}
|
|
95
|
-
// 2. If both are .d.ts, prefer node_modules over @types
|
|
96
|
-
const aIsNodeModules = aFile.includes('node_modules') && !aFile.includes('node_modules/@types');
|
|
97
|
-
const bIsNodeModules = bFile.includes('node_modules') && !bFile.includes('node_modules/@types');
|
|
98
|
-
if (aIsNodeModules !== bIsNodeModules) {
|
|
99
|
-
return aIsNodeModules ? -1 : 1;
|
|
100
|
-
}
|
|
101
|
-
// 3. Prefer shorter paths (closer to root)
|
|
102
|
-
return aFile.length - bFile.length;
|
|
103
|
-
});
|
|
104
|
-
const primaryDeclaration = sortedDeclarations[0];
|
|
105
|
-
const sourceFile = primaryDeclaration.getSourceFile();
|
|
106
|
-
const startPos = sourceFile.getLineAndColumnAtPos(primaryDeclaration.getStart());
|
|
107
|
-
return {
|
|
108
|
-
file: sourceFile.getFilePath(),
|
|
109
|
-
line: startPos.line - 1 // Convert to 0-based indexing
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
export function analyzeSourceFile(sourceFile, analysisType, depth = 2, includePrivate = false, includeDefinition = false) {
|
|
113
|
-
const symbols = [];
|
|
114
|
-
const imports = [];
|
|
115
|
-
const exports = [];
|
|
116
|
-
if (analysisType === "symbols" || analysisType === "all") {
|
|
117
|
-
sourceFile.forEachDescendant(node => {
|
|
118
|
-
if (isDeclarationNode(node)) {
|
|
119
|
-
const symbolInfo = extractSymbolInfo(node, includePrivate, includeDefinition);
|
|
120
|
-
if (symbolInfo) {
|
|
121
|
-
symbols.push(symbolInfo);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (analysisType === "dependencies" || analysisType === "all") {
|
|
127
|
-
sourceFile.getImportDeclarations().forEach(importDecl => {
|
|
128
|
-
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
129
|
-
const namedImports = importDecl.getNamedImports().map(ni => ni.getName());
|
|
130
|
-
const defaultImport = importDecl.getDefaultImport()?.getText();
|
|
131
|
-
const namespaceImport = importDecl.getNamespaceImport()?.getText();
|
|
132
|
-
const allImports = [
|
|
133
|
-
...(defaultImport ? [defaultImport] : []),
|
|
134
|
-
...(namespaceImport ? [namespaceImport] : []),
|
|
135
|
-
...namedImports
|
|
136
|
-
];
|
|
137
|
-
if (allImports.length > 0) {
|
|
138
|
-
imports.push({
|
|
139
|
-
moduleSpecifier,
|
|
140
|
-
symbols: allImports,
|
|
141
|
-
isTypeOnly: importDecl.isTypeOnly()
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
sourceFile.getExportDeclarations().forEach(exportDecl => {
|
|
146
|
-
const namedExports = exportDecl.getNamedExports().map(ne => ne.getName());
|
|
147
|
-
exports.push(...namedExports);
|
|
148
|
-
});
|
|
149
|
-
sourceFile.getExportedDeclarations().forEach((declarations, name) => {
|
|
150
|
-
exports.push(name);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
const diagnostics = sourceFile.getPreEmitDiagnostics().map(diag => ({
|
|
154
|
-
message: diag.getMessageText().toString(),
|
|
155
|
-
severity: getDiagnosticSeverity(diag.getCategory()),
|
|
156
|
-
code: diag.getCode()?.toString()
|
|
157
|
-
}));
|
|
158
|
-
return {
|
|
159
|
-
symbols,
|
|
160
|
-
diagnostics,
|
|
161
|
-
imports,
|
|
162
|
-
exports
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function isDeclarationNode(node) {
|
|
166
|
-
return Node.isClassDeclaration(node) ||
|
|
167
|
-
Node.isInterfaceDeclaration(node) ||
|
|
168
|
-
Node.isFunctionDeclaration(node) ||
|
|
169
|
-
Node.isVariableDeclaration(node) ||
|
|
170
|
-
Node.isTypeAliasDeclaration(node) ||
|
|
171
|
-
Node.isEnumDeclaration(node) ||
|
|
172
|
-
Node.isMethodDeclaration(node) ||
|
|
173
|
-
Node.isPropertyDeclaration(node) ||
|
|
174
|
-
Node.isGetAccessorDeclaration(node) ||
|
|
175
|
-
Node.isSetAccessorDeclaration(node);
|
|
176
|
-
}
|
|
177
|
-
function getDiagnosticSeverity(category) {
|
|
178
|
-
switch (category) {
|
|
179
|
-
case ts.DiagnosticCategory.Error:
|
|
180
|
-
return "error";
|
|
181
|
-
case ts.DiagnosticCategory.Warning:
|
|
182
|
-
return "warning";
|
|
183
|
-
default:
|
|
184
|
-
return "info";
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
export function findSymbolAtPosition(sourceFile, position) {
|
|
188
|
-
const offset = positionToOffset(sourceFile, position);
|
|
189
|
-
return sourceFile.getDescendantAtPos(offset);
|
|
190
|
-
}
|
|
191
|
-
export function findSymbolOnLine(sourceFile, line, maxSearchAttempts = 3) {
|
|
192
|
-
const lines = sourceFile.getFullText().split("\n");
|
|
193
|
-
// Try the specified line first, then expand search
|
|
194
|
-
for (let attempt = 0; attempt < maxSearchAttempts; attempt++) {
|
|
195
|
-
const searchLines = [];
|
|
196
|
-
if (attempt === 0) {
|
|
197
|
-
// First attempt: only the specified line
|
|
198
|
-
searchLines.push(line);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// Subsequent attempts: expand radius
|
|
202
|
-
for (let offset = -attempt; offset <= attempt; offset++) {
|
|
203
|
-
const searchLine = line + offset;
|
|
204
|
-
if (searchLine >= 0 && searchLine < lines.length && !searchLines.includes(searchLine)) {
|
|
205
|
-
searchLines.push(searchLine);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
for (const searchLine of searchLines) {
|
|
210
|
-
const lineText = lines[searchLine];
|
|
211
|
-
if (!lineText || lineText.trim().length === 0)
|
|
212
|
-
continue;
|
|
213
|
-
// Find all identifiers on this line by looking for word characters
|
|
214
|
-
const identifierMatches = Array.from(lineText.matchAll(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g));
|
|
215
|
-
for (const match of identifierMatches) {
|
|
216
|
-
if (match.index !== undefined) {
|
|
217
|
-
const position = { line: searchLine, character: match.index };
|
|
218
|
-
const node = findSymbolAtPosition(sourceFile, position);
|
|
219
|
-
if (node && node.getSymbol()) {
|
|
220
|
-
return node;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
export function getTypeHierarchy(node, direction, maxDepth = 5) {
|
|
229
|
-
const hierarchy = [];
|
|
230
|
-
const visited = new Set();
|
|
231
|
-
function processType(type, depth) {
|
|
232
|
-
if (depth > maxDepth)
|
|
233
|
-
return;
|
|
234
|
-
const symbol = type.getSymbol();
|
|
235
|
-
if (!symbol)
|
|
236
|
-
return;
|
|
237
|
-
const name = symbol.getName();
|
|
238
|
-
if (visited.has(name))
|
|
239
|
-
return;
|
|
240
|
-
visited.add(name);
|
|
241
|
-
const declarations = symbol.getDeclarations();
|
|
242
|
-
if (declarations.length === 0)
|
|
243
|
-
return;
|
|
244
|
-
const declaration = declarations[0];
|
|
245
|
-
const typeInfo = {
|
|
246
|
-
name,
|
|
247
|
-
kind: getTypeKind(declaration),
|
|
248
|
-
location: nodeToLocation(declaration),
|
|
249
|
-
generics: getGenericParameters(declaration)
|
|
250
|
-
};
|
|
251
|
-
hierarchy.push(typeInfo);
|
|
252
|
-
if (direction === "ancestors" || direction === "both") {
|
|
253
|
-
const baseTypes = type.getBaseTypes();
|
|
254
|
-
baseTypes.forEach(baseType => processType(baseType, depth + 1));
|
|
255
|
-
}
|
|
256
|
-
if (direction === "descendants" || direction === "both") {
|
|
257
|
-
// Finding descendants requires project-wide analysis
|
|
258
|
-
// This would need to be implemented by searching all files
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
const type = node.getType();
|
|
262
|
-
processType(type, 0);
|
|
263
|
-
return hierarchy;
|
|
264
|
-
}
|
|
265
|
-
function getTypeKind(node) {
|
|
266
|
-
if (Node.isClassDeclaration(node))
|
|
267
|
-
return "class";
|
|
268
|
-
if (Node.isInterfaceDeclaration(node))
|
|
269
|
-
return "interface";
|
|
270
|
-
if (Node.isEnumDeclaration(node))
|
|
271
|
-
return "enum";
|
|
272
|
-
return "type";
|
|
273
|
-
}
|
|
274
|
-
function getGenericParameters(node) {
|
|
275
|
-
if (!Node.isTypeParametered(node))
|
|
276
|
-
return undefined;
|
|
277
|
-
const params = node.getTypeParameters();
|
|
278
|
-
if (params.length === 0)
|
|
279
|
-
return undefined;
|
|
280
|
-
return params.map(p => p.getName());
|
|
281
|
-
}
|
|
282
|
-
export function extractMembers(node) {
|
|
283
|
-
const members = [];
|
|
284
|
-
if (Node.isClassDeclaration(node) || Node.isInterfaceDeclaration(node)) {
|
|
285
|
-
const type = node.getType();
|
|
286
|
-
const properties = type.getProperties();
|
|
287
|
-
properties.forEach(prop => {
|
|
288
|
-
const propDecl = prop.getValueDeclaration();
|
|
289
|
-
if (!propDecl)
|
|
290
|
-
return;
|
|
291
|
-
let kind = "property";
|
|
292
|
-
let visibility = "public";
|
|
293
|
-
let isStatic = false;
|
|
294
|
-
if (Node.isMethodDeclaration(propDecl)) {
|
|
295
|
-
kind = "method";
|
|
296
|
-
}
|
|
297
|
-
else if (Node.isGetAccessorDeclaration(propDecl)) {
|
|
298
|
-
kind = "getter";
|
|
299
|
-
}
|
|
300
|
-
else if (Node.isSetAccessorDeclaration(propDecl)) {
|
|
301
|
-
kind = "setter";
|
|
302
|
-
}
|
|
303
|
-
if (Node.isModifierable(propDecl)) {
|
|
304
|
-
if (propDecl.hasModifier(SyntaxKind.PrivateKeyword))
|
|
305
|
-
visibility = "private";
|
|
306
|
-
else if (propDecl.hasModifier(SyntaxKind.ProtectedKeyword))
|
|
307
|
-
visibility = "protected";
|
|
308
|
-
isStatic = propDecl.hasModifier(SyntaxKind.StaticKeyword);
|
|
309
|
-
}
|
|
310
|
-
members.push({
|
|
311
|
-
name: prop.getName(),
|
|
312
|
-
kind,
|
|
313
|
-
visibility,
|
|
314
|
-
type: getTypeString(prop.getTypeAtLocation(propDecl)),
|
|
315
|
-
static: isStatic
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
return members;
|
|
320
|
-
}
|
|
321
|
-
export function analyzeSymbolDeclaration(node, maxTypeLength = Number.MAX_SAFE_INTEGER) {
|
|
322
|
-
const symbol = node.getSymbol();
|
|
323
|
-
if (!symbol)
|
|
324
|
-
return null;
|
|
325
|
-
const name = symbol.getName();
|
|
326
|
-
const kind = getSymbolKind(node);
|
|
327
|
-
const type = node.getType();
|
|
328
|
-
const location = nodeToLocation(node);
|
|
329
|
-
const result = {
|
|
330
|
-
name,
|
|
331
|
-
kind,
|
|
332
|
-
type: getTypeString(type, maxTypeLength),
|
|
333
|
-
location
|
|
334
|
-
};
|
|
335
|
-
// Extract function/method parameters
|
|
336
|
-
if (Node.isFunctionDeclaration(node) || Node.isMethodDeclaration(node) || Node.isArrowFunction(node)) {
|
|
337
|
-
const params = node.getParameters();
|
|
338
|
-
result.parameters = params.map(param => ({
|
|
339
|
-
name: param.getName(),
|
|
340
|
-
type: getTypeString(param.getType(), maxTypeLength),
|
|
341
|
-
optional: param.hasQuestionToken(),
|
|
342
|
-
defaultValue: param.getInitializer()?.getText()
|
|
343
|
-
}));
|
|
344
|
-
const returnType = node.getReturnType();
|
|
345
|
-
result.returnType = getTypeString(returnType, maxTypeLength);
|
|
346
|
-
result.signature = node.getText();
|
|
347
|
-
}
|
|
348
|
-
// Extract class/interface members
|
|
349
|
-
if (Node.isClassDeclaration(node) || Node.isInterfaceDeclaration(node)) {
|
|
350
|
-
result.members = [];
|
|
351
|
-
// Get properties
|
|
352
|
-
node.getProperties().forEach(prop => {
|
|
353
|
-
const propType = prop.getType();
|
|
354
|
-
result.members.push({
|
|
355
|
-
name: prop.getName(),
|
|
356
|
-
type: getTypeString(propType, maxTypeLength),
|
|
357
|
-
kind: "property",
|
|
358
|
-
visibility: getVisibility(prop),
|
|
359
|
-
static: prop.hasModifier(SyntaxKind.StaticKeyword),
|
|
360
|
-
optional: prop.hasQuestionToken()
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
// Get methods
|
|
364
|
-
node.getMethods().forEach(method => {
|
|
365
|
-
const methodType = method.getType();
|
|
366
|
-
const isStatic = Node.isMethodDeclaration(method) ? method.hasModifier(SyntaxKind.StaticKeyword) : false;
|
|
367
|
-
result.members.push({
|
|
368
|
-
name: method.getName(),
|
|
369
|
-
type: getTypeString(methodType, maxTypeLength),
|
|
370
|
-
kind: "method",
|
|
371
|
-
visibility: getVisibility(method),
|
|
372
|
-
static: isStatic,
|
|
373
|
-
optional: false
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
// Get getters/setters
|
|
377
|
-
node.getGetAccessors().forEach(getter => {
|
|
378
|
-
const getterType = getter.getType();
|
|
379
|
-
result.members.push({
|
|
380
|
-
name: getter.getName(),
|
|
381
|
-
type: getTypeString(getterType, maxTypeLength),
|
|
382
|
-
kind: "getter",
|
|
383
|
-
visibility: getVisibility(getter),
|
|
384
|
-
static: getter.hasModifier(SyntaxKind.StaticKeyword),
|
|
385
|
-
optional: false
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
node.getSetAccessors().forEach(setter => {
|
|
389
|
-
const setterType = setter.getType();
|
|
390
|
-
result.members.push({
|
|
391
|
-
name: setter.getName(),
|
|
392
|
-
type: getTypeString(setterType, maxTypeLength),
|
|
393
|
-
kind: "setter",
|
|
394
|
-
visibility: getVisibility(setter),
|
|
395
|
-
static: setter.hasModifier(SyntaxKind.StaticKeyword),
|
|
396
|
-
optional: false
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
// Extract generics
|
|
401
|
-
if (Node.isTypeParametered(node)) {
|
|
402
|
-
const typeParams = node.getTypeParameters();
|
|
403
|
-
if (typeParams.length > 0) {
|
|
404
|
-
result.generics = typeParams.map(tp => tp.getName());
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
// Extract enum members
|
|
408
|
-
if (Node.isEnumDeclaration(node)) {
|
|
409
|
-
result.members = node.getMembers().map(member => ({
|
|
410
|
-
name: member.getName(),
|
|
411
|
-
type: getTypeString(member.getType(), maxTypeLength),
|
|
412
|
-
kind: "property",
|
|
413
|
-
visibility: "public",
|
|
414
|
-
static: false,
|
|
415
|
-
optional: false
|
|
416
|
-
}));
|
|
417
|
-
}
|
|
418
|
-
// Extract type alias details
|
|
419
|
-
if (Node.isTypeAliasDeclaration(node)) {
|
|
420
|
-
result.signature = node.getText();
|
|
421
|
-
}
|
|
422
|
-
return result;
|
|
423
|
-
}
|
|
424
|
-
function getVisibility(node) {
|
|
425
|
-
if (Node.isModifierable(node)) {
|
|
426
|
-
if (node.hasModifier(SyntaxKind.PrivateKeyword))
|
|
427
|
-
return "private";
|
|
428
|
-
if (node.hasModifier(SyntaxKind.ProtectedKeyword))
|
|
429
|
-
return "protected";
|
|
430
|
-
}
|
|
431
|
-
return "public";
|
|
432
|
-
}
|
|
433
|
-
//# sourceMappingURL=analyzer.js.map
|