@evolith/smart-cli 0.0.2-beta → 1.1.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.
- package/README.es.md +51 -15
- package/README.md +51 -15
- package/dist/app.module.js +2 -2
- package/dist/app.module.js.map +1 -1
- package/dist/app.module.spec.d.ts +1 -0
- package/dist/app.module.spec.js +305 -0
- package/dist/app.module.spec.js.map +1 -0
- package/dist/application/ports/webhook-notifier.port.d.ts +4 -0
- package/dist/application/ports/webhook-notifier.port.js +3 -0
- package/dist/application/ports/webhook-notifier.port.js.map +1 -0
- package/dist/application/services/index.d.ts +1 -0
- package/dist/application/services/index.js +28 -2
- package/dist/application/services/index.js.map +1 -1
- package/dist/application/services/initialize-project.spec.d.ts +1 -0
- package/dist/application/services/initialize-project.spec.js +211 -0
- package/dist/application/services/initialize-project.spec.js.map +1 -0
- package/dist/application/use-cases/evaluate-gate.use-case.d.ts +20 -0
- package/dist/application/use-cases/evaluate-gate.use-case.js +72 -0
- package/dist/application/use-cases/evaluate-gate.use-case.js.map +1 -0
- package/dist/application/use-cases/validate-satellite.use-case.d.ts +1 -0
- package/dist/application/use-cases/validate-satellite.use-case.js +7 -3
- package/dist/application/use-cases/validate-satellite.use-case.js.map +1 -1
- package/dist/commands/adr/adr.command.d.ts +2 -0
- package/dist/commands/adr/adr.command.js +36 -14
- package/dist/commands/adr/adr.command.js.map +1 -1
- package/dist/commands/adr/adr.command.spec.d.ts +1 -0
- package/dist/commands/adr/adr.command.spec.js +409 -0
- package/dist/commands/adr/adr.command.spec.js.map +1 -0
- package/dist/commands/architecture/scaffold.command.d.ts +1 -0
- package/dist/commands/architecture/scaffold.command.js +23 -1
- package/dist/commands/architecture/scaffold.command.js.map +1 -1
- package/dist/commands/architecture/scaffold.command.spec.d.ts +1 -0
- package/dist/commands/architecture/scaffold.command.spec.js +207 -0
- package/dist/commands/architecture/scaffold.command.spec.js.map +1 -0
- package/dist/commands/completion/completion.command.spec.d.ts +1 -0
- package/dist/commands/completion/completion.command.spec.js +240 -0
- package/dist/commands/completion/completion.command.spec.js.map +1 -0
- package/dist/commands/docs/docs.command.spec.d.ts +1 -0
- package/dist/commands/docs/docs.command.spec.js +87 -0
- package/dist/commands/docs/docs.command.spec.js.map +1 -0
- package/dist/commands/drift/drift.command.spec.d.ts +1 -0
- package/dist/commands/drift/drift.command.spec.js +327 -0
- package/dist/commands/drift/drift.command.spec.js.map +1 -0
- package/dist/commands/gate/gate.command.d.ts +23 -0
- package/dist/commands/gate/gate.command.js +210 -0
- package/dist/commands/gate/gate.command.js.map +1 -0
- package/dist/commands/history/history.command.spec.d.ts +1 -0
- package/dist/commands/history/history.command.spec.js +392 -0
- package/dist/commands/history/history.command.spec.js.map +1 -0
- package/dist/commands/init/agents.command.spec.js +398 -0
- package/dist/commands/init/agents.command.spec.js.map +1 -1
- package/dist/commands/init/init.command.spec.d.ts +1 -0
- package/dist/commands/init/init.command.spec.js +272 -0
- package/dist/commands/init/init.command.spec.js.map +1 -0
- package/dist/commands/init/upgrade.command.spec.d.ts +1 -0
- package/dist/commands/init/upgrade.command.spec.js +378 -0
- package/dist/commands/init/upgrade.command.spec.js.map +1 -0
- package/dist/commands/mcp/mcp-serve.command.spec.d.ts +1 -0
- package/dist/commands/mcp/mcp-serve.command.spec.js +58 -0
- package/dist/commands/mcp/mcp-serve.command.spec.js.map +1 -0
- package/dist/commands/sdlc/gate-status.command.d.ts +3 -1
- package/dist/commands/sdlc/gate-status.command.js +78 -3
- package/dist/commands/sdlc/gate-status.command.js.map +1 -1
- package/dist/commands/sdlc/gate-status.command.spec.d.ts +1 -0
- package/dist/commands/sdlc/gate-status.command.spec.js +302 -0
- package/dist/commands/sdlc/gate-status.command.spec.js.map +1 -0
- package/dist/commands/sdlc/generate-domain.command.d.ts +2 -0
- package/dist/commands/sdlc/generate-domain.command.js +123 -12
- package/dist/commands/sdlc/generate-domain.command.js.map +1 -1
- package/dist/commands/sdlc/generate-domain.command.spec.d.ts +1 -0
- package/dist/commands/sdlc/generate-domain.command.spec.js +121 -0
- package/dist/commands/sdlc/generate-domain.command.spec.js.map +1 -0
- package/dist/commands/sdlc/handoff.command.js +2 -2
- package/dist/commands/sdlc/handoff.command.js.map +1 -1
- package/dist/commands/sdlc/handoff.command.spec.d.ts +1 -0
- package/dist/commands/sdlc/handoff.command.spec.js +395 -0
- package/dist/commands/sdlc/handoff.command.spec.js.map +1 -0
- package/dist/commands/sdlc/sdlc.command.js +40 -6
- package/dist/commands/sdlc/sdlc.command.js.map +1 -1
- package/dist/commands/sdlc/sdlc.command.spec.d.ts +1 -0
- package/dist/commands/sdlc/sdlc.command.spec.js +79 -0
- package/dist/commands/sdlc/sdlc.command.spec.js.map +1 -0
- package/dist/commands/standards/standards.command.spec.d.ts +1 -0
- package/dist/commands/standards/standards.command.spec.js +311 -0
- package/dist/commands/standards/standards.command.spec.js.map +1 -0
- package/dist/commands/validate/validate.command.d.ts +2 -0
- package/dist/commands/validate/validate.command.js +16 -2
- package/dist/commands/validate/validate.command.js.map +1 -1
- package/dist/commands/validate/validate.command.spec.d.ts +1 -0
- package/dist/commands/validate/validate.command.spec.js +368 -0
- package/dist/commands/validate/validate.command.spec.js.map +1 -0
- package/dist/core/abstractions/interfaces.d.ts +1 -0
- package/dist/core/abstractions/interfaces.js.map +1 -1
- package/dist/core/abstractions/providers/config-parser.provider.spec.d.ts +1 -0
- package/dist/core/abstractions/providers/config-parser.provider.spec.js +18 -0
- package/dist/core/abstractions/providers/config-parser.provider.spec.js.map +1 -0
- package/dist/core/abstractions/providers/logger.provider.spec.d.ts +1 -0
- package/dist/core/abstractions/providers/logger.provider.spec.js +212 -0
- package/dist/core/abstractions/providers/logger.provider.spec.js.map +1 -0
- package/dist/core/abstractions/providers/mock-filesystem.provider.d.ts +1 -0
- package/dist/core/abstractions/providers/mock-filesystem.provider.js +4 -0
- package/dist/core/abstractions/providers/mock-filesystem.provider.js.map +1 -1
- package/dist/core/abstractions/providers/mock-filesystem.provider.spec.d.ts +1 -0
- package/dist/core/abstractions/providers/mock-filesystem.provider.spec.js +56 -0
- package/dist/core/abstractions/providers/mock-filesystem.provider.spec.js.map +1 -0
- package/dist/core/abstractions/providers/node-filesystem.provider.d.ts +1 -0
- package/dist/core/abstractions/providers/node-filesystem.provider.js +4 -0
- package/dist/core/abstractions/providers/node-filesystem.provider.js.map +1 -1
- package/dist/core/architecture/nx-workspace.strategy.d.ts +3 -0
- package/dist/core/architecture/nx-workspace.strategy.js +35 -6
- package/dist/core/architecture/nx-workspace.strategy.js.map +1 -1
- package/dist/core/architecture/nx-workspace.strategy.spec.d.ts +1 -0
- package/dist/core/architecture/nx-workspace.strategy.spec.js +187 -0
- package/dist/core/architecture/nx-workspace.strategy.spec.js.map +1 -0
- package/dist/core/architecture/workspace-manager.strategy.d.ts +1 -0
- package/dist/core/di/container.spec.js +164 -0
- package/dist/core/di/container.spec.js.map +1 -1
- package/dist/core/generators/hexagonal-scaffolder.d.ts +6 -0
- package/dist/core/generators/hexagonal-scaffolder.js +260 -0
- package/dist/core/generators/hexagonal-scaffolder.js.map +1 -0
- package/dist/core/generators/hexagonal-scaffolder.spec.d.ts +1 -0
- package/dist/core/generators/hexagonal-scaffolder.spec.js +164 -0
- package/dist/core/generators/hexagonal-scaffolder.spec.js.map +1 -0
- package/dist/core/generators/mermaid-class-parser.d.ts +38 -0
- package/dist/core/generators/mermaid-class-parser.js +183 -0
- package/dist/core/generators/mermaid-class-parser.js.map +1 -0
- package/dist/core/generators/mermaid-class-parser.spec.d.ts +1 -0
- package/dist/core/generators/mermaid-class-parser.spec.js +148 -0
- package/dist/core/generators/mermaid-class-parser.spec.js.map +1 -0
- package/dist/core/mcp/metrics.service.spec.d.ts +1 -0
- package/dist/core/mcp/metrics.service.spec.js +159 -0
- package/dist/core/mcp/metrics.service.spec.js.map +1 -0
- package/dist/core/mcp/prompts/index.js +36 -0
- package/dist/core/mcp/prompts/index.js.map +1 -1
- package/dist/core/mcp/prompts/index.spec.d.ts +1 -0
- package/dist/core/mcp/prompts/index.spec.js +150 -0
- package/dist/core/mcp/prompts/index.spec.js.map +1 -0
- package/dist/core/mcp/resources/index.js +16 -0
- package/dist/core/mcp/resources/index.js.map +1 -1
- package/dist/core/mcp/resources/index.spec.d.ts +1 -0
- package/dist/core/mcp/resources/index.spec.js +212 -0
- package/dist/core/mcp/resources/index.spec.js.map +1 -0
- package/dist/core/mcp/server.d.ts +4 -1
- package/dist/core/mcp/server.js +250 -25
- package/dist/core/mcp/server.js.map +1 -1
- package/dist/core/mcp/server.spec.d.ts +1 -0
- package/dist/core/mcp/server.spec.js +579 -0
- package/dist/core/mcp/server.spec.js.map +1 -0
- package/dist/core/mcp/tools/agent.spec.d.ts +1 -0
- package/dist/core/mcp/tools/agent.spec.js +171 -0
- package/dist/core/mcp/tools/agent.spec.js.map +1 -0
- package/dist/core/mcp/tools/architecture.d.ts +2 -0
- package/dist/core/mcp/tools/architecture.js +68 -0
- package/dist/core/mcp/tools/architecture.js.map +1 -1
- package/dist/core/mcp/tools/architecture.spec.d.ts +1 -0
- package/dist/core/mcp/tools/architecture.spec.js +145 -0
- package/dist/core/mcp/tools/architecture.spec.js.map +1 -0
- package/dist/core/mcp/tools/gate.d.ts +1 -0
- package/dist/core/mcp/tools/gate.js +68 -0
- package/dist/core/mcp/tools/gate.js.map +1 -0
- package/dist/core/mcp/tools/moscow.d.ts +30 -0
- package/dist/core/mcp/tools/moscow.js +113 -0
- package/dist/core/mcp/tools/moscow.js.map +1 -0
- package/dist/core/mcp/tools/moscow.spec.d.ts +1 -0
- package/dist/core/mcp/tools/moscow.spec.js +209 -0
- package/dist/core/mcp/tools/moscow.spec.js.map +1 -0
- package/dist/core/mcp/tools/sdlc.js +2 -1
- package/dist/core/mcp/tools/sdlc.js.map +1 -1
- package/dist/core/mcp/tools/sdlc.spec.d.ts +1 -0
- package/dist/core/mcp/tools/sdlc.spec.js +170 -0
- package/dist/core/mcp/tools/sdlc.spec.js.map +1 -0
- package/dist/core/mcp/tools/validate.spec.d.ts +1 -0
- package/dist/core/mcp/tools/validate.spec.js +130 -0
- package/dist/core/mcp/tools/validate.spec.js.map +1 -0
- package/dist/core/mcp/watcher.service.spec.js +109 -8
- package/dist/core/mcp/watcher.service.spec.js.map +1 -1
- package/dist/core/metrics/dora-calculator.d.ts +18 -0
- package/dist/core/metrics/dora-calculator.js +146 -0
- package/dist/core/metrics/dora-calculator.js.map +1 -0
- package/dist/core/metrics/dora-calculator.spec.d.ts +1 -0
- package/dist/core/metrics/dora-calculator.spec.js +164 -0
- package/dist/core/metrics/dora-calculator.spec.js.map +1 -0
- package/dist/core/metrics/git-log-reader.d.ts +14 -0
- package/dist/core/metrics/git-log-reader.js +39 -0
- package/dist/core/metrics/git-log-reader.js.map +1 -0
- package/dist/core/metrics/git-log-reader.spec.d.ts +1 -0
- package/dist/core/metrics/git-log-reader.spec.js +108 -0
- package/dist/core/metrics/git-log-reader.spec.js.map +1 -0
- package/dist/core/observability/command-watcher.spec.d.ts +1 -0
- package/dist/core/observability/command-watcher.spec.js +123 -0
- package/dist/core/observability/command-watcher.spec.js.map +1 -0
- package/dist/core/observability/error-reporter.spec.d.ts +1 -0
- package/dist/core/observability/error-reporter.spec.js +291 -0
- package/dist/core/observability/error-reporter.spec.js.map +1 -0
- package/dist/core/observability/index.d.ts +1 -0
- package/dist/core/observability/index.js +3 -1
- package/dist/core/observability/index.js.map +1 -1
- package/dist/core/observability/structured-logger.spec.d.ts +1 -0
- package/dist/core/observability/structured-logger.spec.js +197 -0
- package/dist/core/observability/structured-logger.spec.js.map +1 -0
- package/dist/core/observability/timing.spec.d.ts +1 -0
- package/dist/core/observability/timing.spec.js +216 -0
- package/dist/core/observability/timing.spec.js.map +1 -0
- package/dist/core/observability/tool-usage-telemetry.service.d.ts +46 -0
- package/dist/core/observability/tool-usage-telemetry.service.js +181 -0
- package/dist/core/observability/tool-usage-telemetry.service.js.map +1 -0
- package/dist/core/services/command-history.service.d.ts +1 -0
- package/dist/core/services/command-history.service.js +4 -0
- package/dist/core/services/command-history.service.js.map +1 -1
- package/dist/core/services/command-history.service.spec.js +217 -126
- package/dist/core/services/command-history.service.spec.js.map +1 -1
- package/dist/core/upgrade/satellite-upgrade.service.spec.js +212 -132
- package/dist/core/upgrade/satellite-upgrade.service.spec.js.map +1 -1
- package/dist/core/validators/deep-architecture-analyzer.d.ts +58 -0
- package/dist/core/validators/deep-architecture-analyzer.js +333 -0
- package/dist/core/validators/deep-architecture-analyzer.js.map +1 -0
- package/dist/core/validators/deep-architecture-analyzer.spec.d.ts +1 -0
- package/dist/core/validators/deep-architecture-analyzer.spec.js +186 -0
- package/dist/core/validators/deep-architecture-analyzer.spec.js.map +1 -0
- package/dist/core/validators/evaluators/evaluator.interface.d.ts +14 -0
- package/dist/core/validators/evaluators/evaluator.interface.js +3 -0
- package/dist/core/validators/evaluators/evaluator.interface.js.map +1 -0
- package/dist/core/validators/evaluators/native-evaluator.d.ts +31 -0
- package/dist/core/validators/evaluators/native-evaluator.js +461 -0
- package/dist/core/validators/evaluators/native-evaluator.js.map +1 -0
- package/dist/core/validators/evaluators/opa-evaluator.d.ts +20 -0
- package/dist/core/validators/evaluators/opa-evaluator.js +249 -0
- package/dist/core/validators/evaluators/opa-evaluator.js.map +1 -0
- package/dist/core/validators/phase-gate-validator.service.d.ts +4 -0
- package/dist/core/validators/phase-gate-validator.service.js +76 -9
- package/dist/core/validators/phase-gate-validator.service.js.map +1 -1
- package/dist/core/validators/rule-evaluation-engine.d.ts +34 -0
- package/dist/core/validators/rule-evaluation-engine.js +187 -0
- package/dist/core/validators/rule-evaluation-engine.js.map +1 -0
- package/dist/core/validators/rule-evaluation-engine.spec.d.ts +1 -0
- package/dist/core/validators/rule-evaluation-engine.spec.js +243 -0
- package/dist/core/validators/rule-evaluation-engine.spec.js.map +1 -0
- package/dist/core/validators/ruleset-validator-architecture.spec.js +2 -2
- package/dist/core/validators/ruleset-validator-architecture.spec.js.map +1 -1
- package/dist/core/validators/ruleset-validator.service.d.ts +2 -0
- package/dist/core/validators/ruleset-validator.service.js +36 -11
- package/dist/core/validators/ruleset-validator.service.js.map +1 -1
- package/dist/core/validators/ruleset-validator.service.spec.js +347 -0
- package/dist/core/validators/ruleset-validator.service.spec.js.map +1 -1
- package/dist/domain/gate-evidence.d.ts +59 -0
- package/dist/domain/gate-evidence.js +38 -0
- package/dist/domain/gate-evidence.js.map +1 -0
- package/dist/domain/services/adr.service.d.ts +2 -2
- package/dist/domain/services/adr.service.js +12 -8
- package/dist/domain/services/adr.service.js.map +1 -1
- package/dist/domain/services/index.d.ts +1 -0
- package/dist/domain/services/index.js +3 -1
- package/dist/domain/services/index.js.map +1 -1
- package/dist/domain/services/moscow-prioritization.service.d.ts +44 -0
- package/dist/domain/services/moscow-prioritization.service.js +213 -0
- package/dist/domain/services/moscow-prioritization.service.js.map +1 -0
- package/dist/domain/services/moscow-prioritization.service.spec.d.ts +1 -0
- package/dist/domain/services/moscow-prioritization.service.spec.js +285 -0
- package/dist/domain/services/moscow-prioritization.service.spec.js.map +1 -0
- package/dist/domain/services/standards.service.spec.js +461 -1
- package/dist/domain/services/standards.service.spec.js.map +1 -1
- package/dist/infrastructure/adapters/webhook.adapter.d.ts +5 -0
- package/dist/infrastructure/adapters/webhook.adapter.js +19 -0
- package/dist/infrastructure/adapters/webhook.adapter.js.map +1 -0
- package/dist/infrastructure/cli/command-executor.spec.d.ts +1 -0
- package/dist/infrastructure/cli/command-executor.spec.js +149 -0
- package/dist/infrastructure/cli/command-executor.spec.js.map +1 -0
- package/dist/infrastructure/cli/providers/providers.spec.d.ts +1 -0
- package/dist/infrastructure/cli/providers/providers.spec.js +251 -0
- package/dist/infrastructure/cli/providers/providers.spec.js.map +1 -0
- package/package.json +23 -5
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
jest.mock('../tools/tool-utils', () => ({
|
|
5
|
+
getFileSystem: jest.fn(),
|
|
6
|
+
getContainer: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
const tool_utils_1 = require("../tools/tool-utils");
|
|
9
|
+
const mockFileSystem = {
|
|
10
|
+
exists: jest.fn(),
|
|
11
|
+
readdir: jest.fn(),
|
|
12
|
+
readdirNames: jest.fn(),
|
|
13
|
+
readJson: jest.fn(),
|
|
14
|
+
readFile: jest.fn(),
|
|
15
|
+
existsSync: jest.fn(),
|
|
16
|
+
stat: jest.fn(),
|
|
17
|
+
};
|
|
18
|
+
const mockConfigParser = {
|
|
19
|
+
parse: jest.fn(),
|
|
20
|
+
};
|
|
21
|
+
describe('MCP Resources', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
jest.clearAllMocks();
|
|
24
|
+
tool_utils_1.getFileSystem.mockReturnValue(mockFileSystem);
|
|
25
|
+
tool_utils_1.getContainer.mockReturnValue({
|
|
26
|
+
createConfigParser: jest.fn().mockReturnValue(mockConfigParser),
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe('listResources', () => {
|
|
30
|
+
it('should return list of available resources', async () => {
|
|
31
|
+
const result = await (0, index_1.listResources)();
|
|
32
|
+
expect(result.resources).toBeDefined();
|
|
33
|
+
expect(Array.isArray(result.resources)).toBe(true);
|
|
34
|
+
expect(result.resources.length).toBeGreaterThan(0);
|
|
35
|
+
});
|
|
36
|
+
it('should include rulesets resource', async () => {
|
|
37
|
+
const result = await (0, index_1.listResources)();
|
|
38
|
+
const rulesetsResource = result.resources.find((r) => r.uri === 'evolith://rulesets');
|
|
39
|
+
expect(rulesetsResource).toBeDefined();
|
|
40
|
+
expect(rulesetsResource?.name).toBe('Rulesets');
|
|
41
|
+
});
|
|
42
|
+
it('should include phase-gates resource', async () => {
|
|
43
|
+
const result = await (0, index_1.listResources)();
|
|
44
|
+
const phaseGatesResource = result.resources.find((r) => r.uri === 'evolith://phase-gates');
|
|
45
|
+
expect(phaseGatesResource).toBeDefined();
|
|
46
|
+
});
|
|
47
|
+
it('should include agents resource', async () => {
|
|
48
|
+
const result = await (0, index_1.listResources)();
|
|
49
|
+
const agentsResource = result.resources.find((r) => r.uri === 'evolith://agents');
|
|
50
|
+
expect(agentsResource).toBeDefined();
|
|
51
|
+
});
|
|
52
|
+
it('should include governance version resource', async () => {
|
|
53
|
+
const result = await (0, index_1.listResources)();
|
|
54
|
+
const versionResource = result.resources.find((r) => r.uri === 'evolith://governance/version');
|
|
55
|
+
expect(versionResource).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
it('should include core version resource', async () => {
|
|
58
|
+
const result = await (0, index_1.listResources)();
|
|
59
|
+
const coreVersionResource = result.resources.find((r) => r.uri === 'evolith://core/version');
|
|
60
|
+
expect(coreVersionResource).toBeDefined();
|
|
61
|
+
});
|
|
62
|
+
it('should include repository config resource', async () => {
|
|
63
|
+
const result = await (0, index_1.listResources)();
|
|
64
|
+
const configResource = result.resources.find((r) => r.uri === 'evolith://repository/config');
|
|
65
|
+
expect(configResource).toBeDefined();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('readResource', () => {
|
|
69
|
+
describe('evolith://rulesets', () => {
|
|
70
|
+
it('should return empty list when rulesets directory not found', async () => {
|
|
71
|
+
mockFileSystem.existsSync.mockReturnValue(false);
|
|
72
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://rulesets' });
|
|
73
|
+
expect(result.error).toBeDefined();
|
|
74
|
+
expect(result.rulesets).toEqual([]);
|
|
75
|
+
});
|
|
76
|
+
it('should return list of rulesets when directory exists', async () => {
|
|
77
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
78
|
+
mockFileSystem.readdir.mockResolvedValue([
|
|
79
|
+
{ name: 'governance', isDirectory: () => true },
|
|
80
|
+
{ name: 'acl', isDirectory: () => true },
|
|
81
|
+
]);
|
|
82
|
+
mockFileSystem.readdirNames
|
|
83
|
+
.mockResolvedValueOnce(['open-core-boundary.rules.json'])
|
|
84
|
+
.mockResolvedValueOnce(['anti-corruption-layer.rules.json']);
|
|
85
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://rulesets' });
|
|
86
|
+
expect(result.rulesets.length).toBeGreaterThan(0);
|
|
87
|
+
expect(result.count).toBe(result.rulesets.length);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe('evolith://phase-gates', () => {
|
|
91
|
+
it('should return phase gate definitions', async () => {
|
|
92
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://phase-gates' });
|
|
93
|
+
expect(result.phaseGates).toBeDefined();
|
|
94
|
+
expect(result.phaseGates.length).toBe(5);
|
|
95
|
+
expect(result.phaseGates[0].phase).toBe('phase-0');
|
|
96
|
+
expect(result.phaseGates[0].name).toBe('Foundation');
|
|
97
|
+
});
|
|
98
|
+
it('should include all 5 phases', async () => {
|
|
99
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://phase-gates' });
|
|
100
|
+
const phases = result.phaseGates.map((g) => g.phase);
|
|
101
|
+
expect(phases).toContain('phase-0');
|
|
102
|
+
expect(phases).toContain('phase-1');
|
|
103
|
+
expect(phases).toContain('phase-2');
|
|
104
|
+
expect(phases).toContain('phase-3');
|
|
105
|
+
expect(phases).toContain('phase-4');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
describe('evolith://agents', () => {
|
|
109
|
+
it('should return empty list when agents directory not found', async () => {
|
|
110
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
111
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://agents' });
|
|
112
|
+
expect(result.agents).toEqual([]);
|
|
113
|
+
});
|
|
114
|
+
it('should return list of agents when directory exists', async () => {
|
|
115
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
116
|
+
mockFileSystem.readdirNames.mockResolvedValue(['agent-1', 'agent-2']);
|
|
117
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://agents' });
|
|
118
|
+
expect(result.agents).toEqual(['agent-1', 'agent-2']);
|
|
119
|
+
expect(result.count).toBe(2);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
describe('evolith://governance/version', () => {
|
|
123
|
+
it('should return governance version', async () => {
|
|
124
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://governance/version' });
|
|
125
|
+
expect(result.version).toBe('1.0.0');
|
|
126
|
+
expect(result.schema).toBe('governance');
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
describe('evolith://core/version', () => {
|
|
130
|
+
it('should return core version', async () => {
|
|
131
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://core/version' });
|
|
132
|
+
expect(result.version).toBe('1.0.0');
|
|
133
|
+
expect(result.schema).toBe('core');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('evolith://repository/config', () => {
|
|
137
|
+
it('should return error when evolith.yaml not found', async () => {
|
|
138
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
139
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://repository/config' });
|
|
140
|
+
expect(result.error).toBe('evolith.yaml not found');
|
|
141
|
+
});
|
|
142
|
+
it('should return parsed config when evolith.yaml exists', async () => {
|
|
143
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
144
|
+
mockFileSystem.readFile.mockResolvedValue('name: test\ncoreRef: 1.0.0');
|
|
145
|
+
mockConfigParser.parse.mockReturnValue({ name: 'test', coreRef: '1.0.0' });
|
|
146
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://repository/config' });
|
|
147
|
+
expect(result.name).toBe('test');
|
|
148
|
+
expect(result.coreRef).toBe('1.0.0');
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
describe('evolith://ruleset/{name}', () => {
|
|
152
|
+
it('should return ruleset content when found', async () => {
|
|
153
|
+
mockFileSystem.existsSync.mockReturnValue(true);
|
|
154
|
+
mockFileSystem.readJson.mockResolvedValue({ rules: [{ id: 'R-01' }] });
|
|
155
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://ruleset/governance/open-core-boundary' });
|
|
156
|
+
expect(result.rules).toBeDefined();
|
|
157
|
+
});
|
|
158
|
+
it('should return error when ruleset not found', async () => {
|
|
159
|
+
mockFileSystem.existsSync.mockReturnValue(false);
|
|
160
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
161
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://ruleset/nonexistent' });
|
|
162
|
+
expect(result.error).toBe('Ruleset not found: nonexistent');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('evolith://agent/{name}', () => {
|
|
166
|
+
it('should return agent content when found', async () => {
|
|
167
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
168
|
+
mockFileSystem.readJson.mockResolvedValue({ agent: { name: 'test-agent' } });
|
|
169
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://agent/test-agent' });
|
|
170
|
+
expect(result.agent.name).toBe('test-agent');
|
|
171
|
+
});
|
|
172
|
+
it('should return error when agent not found', async () => {
|
|
173
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
174
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://agent/nonexistent' });
|
|
175
|
+
expect(result.error).toBe('Agent not found: nonexistent');
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe('evolith://open-core/artifacts', () => {
|
|
179
|
+
it('should return open-core boundary rules when found', async () => {
|
|
180
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
181
|
+
mockFileSystem.readJson.mockResolvedValue({ rules: [] });
|
|
182
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://open-core/artifacts' });
|
|
183
|
+
expect(result.rules).toBeDefined();
|
|
184
|
+
});
|
|
185
|
+
it('should return error when rules not found', async () => {
|
|
186
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
187
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://open-core/artifacts' });
|
|
188
|
+
expect(result.error).toBe('Open-Core Boundary rules not found');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
describe('evolith://acl/rules', () => {
|
|
192
|
+
it('should return ACL rules when found', async () => {
|
|
193
|
+
mockFileSystem.exists.mockResolvedValue(true);
|
|
194
|
+
mockFileSystem.readJson.mockResolvedValue({ rules: [{ id: 'ACL-01' }] });
|
|
195
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://acl/rules' });
|
|
196
|
+
expect(result.rules).toBeDefined();
|
|
197
|
+
});
|
|
198
|
+
it('should return error when ACL rules not found', async () => {
|
|
199
|
+
mockFileSystem.exists.mockResolvedValue(false);
|
|
200
|
+
const result = await (0, index_1.readResource)({ uri: 'evolith://acl/rules' });
|
|
201
|
+
expect(result.error).toBe('ACL rules not found');
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
describe('unknown URI', () => {
|
|
205
|
+
it('should throw error for unknown resource URI', async () => {
|
|
206
|
+
await expect((0, index_1.readResource)({ uri: 'evolith://unknown' }))
|
|
207
|
+
.rejects.toThrow('Unknown resource URI: evolith://unknown');
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../src/core/mcp/resources/index.spec.ts"],"names":[],"mappings":";;AAAA,mCAAsD;AAEtD,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;IACxB,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE;CACxB,CAAC,CAAC,CAAC;AAEJ,oDAAkE;AAElE,MAAM,cAAc,GAAG;IACrB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;IACjB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;IAClB,YAAY,EAAE,IAAI,CAAC,EAAE,EAAE;IACvB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;IACnB,QAAQ,EA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C,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAC9C,CAAC,CAAC,CAAC;YAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;gBAC5D,cAAc,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAE/C,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAY,EAAC,EAAE,GAAG,EAAE,qBAAqB,EAAE,CAAC,CAAC;gBAElE,MAAM,CAAE,MAAc,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;YAC3B,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;gBAC3D,MAAM,MAAM,CAAC,IAAA,oBAAY,EAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAC;qBACrD,OAAO,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -7,13 +7,16 @@ export interface McpServerOptions {
|
|
|
7
7
|
apiKey?: string;
|
|
8
8
|
port?: number;
|
|
9
9
|
transport?: McpTransport;
|
|
10
|
+
stdin?: import('node:stream').Readable;
|
|
11
|
+
stdout?: import('node:stream').Writable;
|
|
10
12
|
}
|
|
11
13
|
declare class DirectMcpServer {
|
|
12
14
|
private transport;
|
|
13
15
|
private readonly logger;
|
|
14
16
|
private rulesetValidator;
|
|
15
17
|
private metricsService;
|
|
16
|
-
|
|
18
|
+
private readonly transportType;
|
|
19
|
+
constructor(transportType?: McpTransport, port?: number, apiKey?: string, rulesetValidator?: RulesetValidatorService, metricsService?: McpMetricsService, stdin?: import('node:stream').Readable, stdout?: import('node:stream').Writable);
|
|
17
20
|
start(): Promise<void>;
|
|
18
21
|
stop(): Promise<void>;
|
|
19
22
|
private handleMessage;
|
package/dist/core/mcp/server.js
CHANGED
|
@@ -35,12 +35,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.startMcpServer = startMcpServer;
|
|
37
37
|
const common_1 = require("@nestjs/common");
|
|
38
|
+
const http = __importStar(require("node:http"));
|
|
38
39
|
const ruleset_validator_service_1 = require("../validators/ruleset-validator.service");
|
|
39
40
|
const validate_1 = require("./tools/validate");
|
|
40
41
|
const agent_1 = require("./tools/agent");
|
|
41
42
|
const architecture_1 = require("./tools/architecture");
|
|
42
43
|
const sdlc_1 = require("./tools/sdlc");
|
|
44
|
+
const moscow_1 = require("./tools/moscow");
|
|
45
|
+
const gate_1 = require("./tools/gate");
|
|
43
46
|
const metrics_service_1 = require("./metrics.service");
|
|
47
|
+
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
44
48
|
class MinimalStdioTransport {
|
|
45
49
|
constructor(stdin, stdout) {
|
|
46
50
|
this.readBuffer = '';
|
|
@@ -48,12 +52,7 @@ class MinimalStdioTransport {
|
|
|
48
52
|
this.stdout = stdout || process.stdout;
|
|
49
53
|
this.readBuffer = '';
|
|
50
54
|
this.started = false;
|
|
51
|
-
|
|
52
|
-
async start() {
|
|
53
|
-
if (this.started)
|
|
54
|
-
return;
|
|
55
|
-
this.started = true;
|
|
56
|
-
this.stdin.on('data', (chunk) => {
|
|
55
|
+
this.handleData = (chunk) => {
|
|
57
56
|
this.readBuffer += chunk.toString();
|
|
58
57
|
let newlineIndex;
|
|
59
58
|
while ((newlineIndex = this.readBuffer.indexOf('\n')) !== -1) {
|
|
@@ -66,26 +65,43 @@ class MinimalStdioTransport {
|
|
|
66
65
|
this.onmessage(message);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
catch
|
|
68
|
+
catch {
|
|
70
69
|
if (this.onerror) {
|
|
71
70
|
this.onerror(new Error(`Invalid JSON: ${line}`));
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
}
|
|
77
|
-
this.
|
|
75
|
+
};
|
|
76
|
+
this.handleEnd = () => {
|
|
78
77
|
if (this.onclose) {
|
|
79
78
|
this.onclose();
|
|
80
79
|
}
|
|
81
|
-
}
|
|
82
|
-
this.
|
|
80
|
+
};
|
|
81
|
+
this.handleError = (err) => {
|
|
83
82
|
if (this.onerror) {
|
|
84
83
|
this.onerror(err);
|
|
85
84
|
}
|
|
86
|
-
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async start() {
|
|
88
|
+
if (this.started)
|
|
89
|
+
return;
|
|
90
|
+
this.started = true;
|
|
91
|
+
this.stdin.on('data', this.handleData);
|
|
92
|
+
this.stdin.on('end', this.handleEnd);
|
|
93
|
+
this.stdin.on('error', this.handleError);
|
|
87
94
|
}
|
|
88
95
|
async close() {
|
|
96
|
+
if (!this.started)
|
|
97
|
+
return;
|
|
98
|
+
this.stdin.off('data', this.handleData);
|
|
99
|
+
this.stdin.off('end', this.handleEnd);
|
|
100
|
+
this.stdin.off('error', this.handleError);
|
|
101
|
+
this.onmessage = undefined;
|
|
102
|
+
this.onerror = undefined;
|
|
103
|
+
this.onclose = undefined;
|
|
104
|
+
this.readBuffer = '';
|
|
89
105
|
this.started = false;
|
|
90
106
|
}
|
|
91
107
|
async send(message) {
|
|
@@ -100,12 +116,108 @@ class MinimalStdioTransport {
|
|
|
100
116
|
});
|
|
101
117
|
}
|
|
102
118
|
}
|
|
119
|
+
class McpHttpTransportWrapper {
|
|
120
|
+
constructor(port, apiKey) {
|
|
121
|
+
this.server = null;
|
|
122
|
+
this.logger = new common_1.Logger(McpHttpTransportWrapper.name);
|
|
123
|
+
this.started = false;
|
|
124
|
+
this.port = port;
|
|
125
|
+
this.apiKey = apiKey;
|
|
126
|
+
this.mcpTransport = new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
127
|
+
sessionIdGenerator: () => Math.random().toString(36).substring(2, 10)
|
|
128
|
+
});
|
|
129
|
+
this.mcpTransport.onerror = (error) => {
|
|
130
|
+
if (this.onerror)
|
|
131
|
+
this.onerror(error);
|
|
132
|
+
};
|
|
133
|
+
this.mcpTransport.onclose = () => {
|
|
134
|
+
if (this.onclose)
|
|
135
|
+
this.onclose();
|
|
136
|
+
};
|
|
137
|
+
this.mcpTransport.onmessage = (message) => {
|
|
138
|
+
if (this.onmessage)
|
|
139
|
+
this.onmessage(message);
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async start() {
|
|
143
|
+
if (this.started)
|
|
144
|
+
return;
|
|
145
|
+
this.started = true;
|
|
146
|
+
this.server = http.createServer((req, res) => {
|
|
147
|
+
this.handleRequest(req, res);
|
|
148
|
+
});
|
|
149
|
+
this.server.on('error', (error) => {
|
|
150
|
+
this.logger.error(`HTTP server error: ${error.message}`);
|
|
151
|
+
if (this.onerror) {
|
|
152
|
+
this.onerror(error);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
this.server.on('close', () => {
|
|
156
|
+
if (this.onclose) {
|
|
157
|
+
this.onclose();
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
await new Promise((resolve, reject) => {
|
|
161
|
+
this.server.listen(this.port, '127.0.0.1', () => {
|
|
162
|
+
this.logger.log(`Evolith MCP HTTP server listening on http://127.0.0.1:${this.port}`);
|
|
163
|
+
resolve();
|
|
164
|
+
});
|
|
165
|
+
this.server.on('error', reject);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async close() {
|
|
169
|
+
this.started = false;
|
|
170
|
+
await this.mcpTransport.close();
|
|
171
|
+
if (this.server) {
|
|
172
|
+
await new Promise((resolve) => {
|
|
173
|
+
this.server.close(() => resolve());
|
|
174
|
+
});
|
|
175
|
+
this.server = null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async send(message) {
|
|
179
|
+
await this.mcpTransport.send(message);
|
|
180
|
+
}
|
|
181
|
+
handleRequest(req, res) {
|
|
182
|
+
const url = new URL(req.url || '/', `http://127.0.0.1:${this.port}`);
|
|
183
|
+
if (!this.validateAuth(req, res)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (req.method === 'GET' && url.pathname === '/health') {
|
|
187
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
188
|
+
res.end(JSON.stringify({ status: 'ok', transport: 'http', protocol: 'mcp' }));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
this.mcpTransport.handleRequest(req, res).catch((err) => {
|
|
192
|
+
this.logger.error(`MCP Transport error: ${err.message}`);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
validateAuth(req, res) {
|
|
196
|
+
if (!this.apiKey)
|
|
197
|
+
return true;
|
|
198
|
+
const authHeader = req.headers.authorization || '';
|
|
199
|
+
const bearerToken = authHeader.startsWith('Bearer ') ? authHeader.slice(7) : '';
|
|
200
|
+
const apiKeyHeader = req.headers['x-api-key'];
|
|
201
|
+
if (bearerToken !== this.apiKey && apiKeyHeader !== this.apiKey) {
|
|
202
|
+
res.writeHead(401, { 'Content-Type': 'application/json' });
|
|
203
|
+
res.end(JSON.stringify({ error: 'Unauthorized', message: 'Invalid or missing API key' }));
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
103
209
|
class DirectMcpServer {
|
|
104
|
-
constructor(rulesetValidator, metricsService) {
|
|
210
|
+
constructor(transportType = 'stdio', port = 49100, apiKey, rulesetValidator, metricsService, stdin, stdout) {
|
|
105
211
|
this.logger = new common_1.Logger(DirectMcpServer.name);
|
|
106
|
-
this.
|
|
212
|
+
this.transportType = transportType;
|
|
107
213
|
this.rulesetValidator = rulesetValidator || new ruleset_validator_service_1.RulesetValidatorService();
|
|
108
214
|
this.metricsService = metricsService || new metrics_service_1.McpMetricsService();
|
|
215
|
+
if (transportType === 'http') {
|
|
216
|
+
this.transport = new McpHttpTransportWrapper(port, apiKey);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
this.transport = new MinimalStdioTransport(stdin, stdout);
|
|
220
|
+
}
|
|
109
221
|
}
|
|
110
222
|
async start() {
|
|
111
223
|
const transport = this.transport;
|
|
@@ -115,8 +227,11 @@ class DirectMcpServer {
|
|
|
115
227
|
transport.onerror = (error) => {
|
|
116
228
|
this.logger.error(`Transport error: ${error.message}`);
|
|
117
229
|
};
|
|
230
|
+
transport.onclose = () => {
|
|
231
|
+
this.logger.log('Transport closed');
|
|
232
|
+
};
|
|
118
233
|
await transport.start();
|
|
119
|
-
this.logger.log(
|
|
234
|
+
this.logger.log(`Evolith MCP Server started on ${this.transportType}`);
|
|
120
235
|
}
|
|
121
236
|
async stop() {
|
|
122
237
|
await this.transport.close();
|
|
@@ -178,7 +293,11 @@ class DirectMcpServer {
|
|
|
178
293
|
message: error instanceof Error ? error.message : String(error),
|
|
179
294
|
},
|
|
180
295
|
};
|
|
181
|
-
|
|
296
|
+
try {
|
|
297
|
+
await this.transport.send(errorResponse);
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
}
|
|
182
301
|
}
|
|
183
302
|
}
|
|
184
303
|
async dispatchRequest(method, params) {
|
|
@@ -216,6 +335,23 @@ class DirectMcpServer {
|
|
|
216
335
|
required: ['path'],
|
|
217
336
|
},
|
|
218
337
|
},
|
|
338
|
+
{
|
|
339
|
+
name: 'evolith-gate-evaluate',
|
|
340
|
+
description: 'Evaluate a specific SDLC phase gate',
|
|
341
|
+
inputSchema: {
|
|
342
|
+
type: 'object',
|
|
343
|
+
properties: {
|
|
344
|
+
phase: { type: 'string', description: 'Phase identifier (discovery, design, construction, qa, release)' },
|
|
345
|
+
projectPath: { type: 'string', description: 'Path to the repository to validate' },
|
|
346
|
+
rulesetRef: { type: 'string', description: 'Optional ruleset reference' },
|
|
347
|
+
evidenceMode: { type: 'string', description: 'full or summary', default: 'full' },
|
|
348
|
+
evaluatedBy: { type: 'string', description: 'human, agent, or ci', default: 'agent' },
|
|
349
|
+
initiative: { type: 'string', description: 'Optional initiative context' },
|
|
350
|
+
tenant: { type: 'string', description: 'Optional tenant context' },
|
|
351
|
+
},
|
|
352
|
+
required: ['phase', 'projectPath'],
|
|
353
|
+
},
|
|
354
|
+
},
|
|
219
355
|
{
|
|
220
356
|
name: 'evolith-agent-install',
|
|
221
357
|
description: 'Install a new Evolith agent',
|
|
@@ -277,12 +413,13 @@ class DirectMcpServer {
|
|
|
277
413
|
},
|
|
278
414
|
{
|
|
279
415
|
name: 'evolith-architecture-validate',
|
|
280
|
-
description: 'Validate repository architecture against F1/F2/F3 rules',
|
|
416
|
+
description: 'Validate repository architecture against F1/F2/F3 rules. Use deep=true for import graph analysis, layer violations, and coupling metrics.',
|
|
281
417
|
inputSchema: {
|
|
282
418
|
type: 'object',
|
|
283
419
|
properties: {
|
|
284
420
|
path: { type: 'string' },
|
|
285
421
|
level: { type: 'string', description: 'F1, F2, or F3' },
|
|
422
|
+
deep: { type: 'boolean', description: 'Enable deep static analysis (import graph, layer violations, coupling metrics)', default: false },
|
|
286
423
|
},
|
|
287
424
|
required: ['path'],
|
|
288
425
|
},
|
|
@@ -344,6 +481,93 @@ class DirectMcpServer {
|
|
|
344
481
|
properties: {},
|
|
345
482
|
},
|
|
346
483
|
},
|
|
484
|
+
{
|
|
485
|
+
name: 'evolith-moscow-create',
|
|
486
|
+
description: 'Create a new MoSCoW prioritization analysis for a phase',
|
|
487
|
+
inputSchema: {
|
|
488
|
+
type: 'object',
|
|
489
|
+
properties: {
|
|
490
|
+
path: { type: 'string', description: 'Path to the repository' },
|
|
491
|
+
phase: { type: 'string', description: 'Phase identifier (e.g., phase-0)', default: 'phase-0' },
|
|
492
|
+
items: { type: 'array', description: 'Array of MoSCoW items with description, priority, category, rationale' },
|
|
493
|
+
},
|
|
494
|
+
required: ['path', 'items'],
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'evolith-moscow-load',
|
|
499
|
+
description: 'Load an existing MoSCoW analysis for a phase',
|
|
500
|
+
inputSchema: {
|
|
501
|
+
type: 'object',
|
|
502
|
+
properties: {
|
|
503
|
+
path: { type: 'string' },
|
|
504
|
+
phase: { type: 'string', default: 'phase-0' },
|
|
505
|
+
},
|
|
506
|
+
required: ['path'],
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: 'evolith-moscow-update',
|
|
511
|
+
description: 'Update an item in a MoSCoW analysis',
|
|
512
|
+
inputSchema: {
|
|
513
|
+
type: 'object',
|
|
514
|
+
properties: {
|
|
515
|
+
path: { type: 'string' },
|
|
516
|
+
phase: { type: 'string', default: 'phase-0' },
|
|
517
|
+
itemId: { type: 'string' },
|
|
518
|
+
updates: { type: 'object' },
|
|
519
|
+
},
|
|
520
|
+
required: ['path', 'itemId'],
|
|
521
|
+
},
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
name: 'evolith-moscow-remove',
|
|
525
|
+
description: 'Remove an item from a MoSCoW analysis',
|
|
526
|
+
inputSchema: {
|
|
527
|
+
type: 'object',
|
|
528
|
+
properties: {
|
|
529
|
+
path: { type: 'string' },
|
|
530
|
+
phase: { type: 'string', default: 'phase-0' },
|
|
531
|
+
itemId: { type: 'string' },
|
|
532
|
+
},
|
|
533
|
+
required: ['path', 'itemId'],
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
name: 'evolith-moscow-list',
|
|
538
|
+
description: 'List all MoSCoW analyses for a repository',
|
|
539
|
+
inputSchema: {
|
|
540
|
+
type: 'object',
|
|
541
|
+
properties: {
|
|
542
|
+
path: { type: 'string' },
|
|
543
|
+
},
|
|
544
|
+
required: ['path'],
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: 'evolith-moscow-validate',
|
|
549
|
+
description: 'Validate a MoSCoW analysis for correctness',
|
|
550
|
+
inputSchema: {
|
|
551
|
+
type: 'object',
|
|
552
|
+
properties: {
|
|
553
|
+
path: { type: 'string' },
|
|
554
|
+
phase: { type: 'string', default: 'phase-0' },
|
|
555
|
+
},
|
|
556
|
+
required: ['path'],
|
|
557
|
+
},
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
name: 'evolith-moscow-report',
|
|
561
|
+
description: 'Generate a markdown report from a MoSCoW analysis',
|
|
562
|
+
inputSchema: {
|
|
563
|
+
type: 'object',
|
|
564
|
+
properties: {
|
|
565
|
+
path: { type: 'string' },
|
|
566
|
+
phase: { type: 'string', default: 'phase-0' },
|
|
567
|
+
},
|
|
568
|
+
required: ['path'],
|
|
569
|
+
},
|
|
570
|
+
},
|
|
347
571
|
],
|
|
348
572
|
};
|
|
349
573
|
}
|
|
@@ -356,6 +580,9 @@ class DirectMcpServer {
|
|
|
356
580
|
if (name === 'evolith-validate') {
|
|
357
581
|
result = await (0, validate_1.handleValidateTool)(args, this.rulesetValidator);
|
|
358
582
|
}
|
|
583
|
+
else if (name === 'evolith-gate-evaluate') {
|
|
584
|
+
result = await (0, gate_1.handleGateEvaluateTool)(args);
|
|
585
|
+
}
|
|
359
586
|
else if (name.startsWith('evolith-agent')) {
|
|
360
587
|
result = await (0, agent_1.handleAgentTools)(name, args);
|
|
361
588
|
}
|
|
@@ -371,6 +598,9 @@ class DirectMcpServer {
|
|
|
371
598
|
else if (name === 'evolith-metrics') {
|
|
372
599
|
result = this.metricsService.getMetrics();
|
|
373
600
|
}
|
|
601
|
+
else if (name.startsWith('evolith-moscow')) {
|
|
602
|
+
result = await (0, moscow_1.handleMoscowTools)(name, args);
|
|
603
|
+
}
|
|
374
604
|
else {
|
|
375
605
|
throw new Error(`Unknown tool: ${name}`);
|
|
376
606
|
}
|
|
@@ -453,15 +683,10 @@ class DirectMcpServer {
|
|
|
453
683
|
return getPrompt(params);
|
|
454
684
|
}
|
|
455
685
|
}
|
|
456
|
-
function validateApiKey(apiKey, validKey) {
|
|
457
|
-
if (!validKey)
|
|
458
|
-
return true;
|
|
459
|
-
if (!apiKey)
|
|
460
|
-
return false;
|
|
461
|
-
return apiKey === validKey;
|
|
462
|
-
}
|
|
463
686
|
async function startMcpServer(options = {}) {
|
|
464
|
-
const
|
|
687
|
+
const transport = options.transport || 'stdio';
|
|
688
|
+
const port = options.port || 49100;
|
|
689
|
+
const server = new DirectMcpServer(transport, port, options.apiKey, options.rulesetValidator, options.metricsService, options.stdin, options.stdout);
|
|
465
690
|
await server.start();
|
|
466
691
|
return server;
|
|
467
692
|
}
|