@corbat-tech/coding-standards-mcp 1.0.2 → 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.md +170 -269
- package/assets/demo.gif +0 -0
- package/assets/demo.tape +63 -0
- package/dist/agent.d.ts +5 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +95 -217
- package/dist/agent.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/config.d.ts +15 -26
- package/dist/config.d.ts.map +1 -1
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +112 -0
- package/dist/errors.js.map +1 -0
- package/dist/guardrails.d.ts +35 -0
- package/dist/guardrails.d.ts.map +1 -0
- package/dist/guardrails.js +303 -0
- package/dist/guardrails.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +36 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +63 -0
- package/dist/logger.js.map +1 -0
- package/dist/metrics.d.ts +40 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +97 -0
- package/dist/metrics.js.map +1 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +240 -109
- package/dist/profiles.js.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/prompts.js.map +1 -1
- package/dist/tools/definitions.d.ts +104 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +171 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/handlers/get-context.d.ts +12 -0
- package/dist/tools/handlers/get-context.d.ts.map +1 -0
- package/dist/tools/handlers/get-context.js +118 -0
- package/dist/tools/handlers/get-context.js.map +1 -0
- package/dist/tools/handlers/health.d.ts +11 -0
- package/dist/tools/handlers/health.d.ts.map +1 -0
- package/dist/tools/handlers/health.js +57 -0
- package/dist/tools/handlers/health.js.map +1 -0
- package/dist/tools/handlers/index.d.ts +11 -0
- package/dist/tools/handlers/index.d.ts.map +1 -0
- package/dist/tools/handlers/index.js +11 -0
- package/dist/tools/handlers/index.js.map +1 -0
- package/dist/tools/handlers/init.d.ts +12 -0
- package/dist/tools/handlers/init.d.ts.map +1 -0
- package/dist/tools/handlers/init.js +102 -0
- package/dist/tools/handlers/init.js.map +1 -0
- package/dist/tools/handlers/profiles.d.ts +11 -0
- package/dist/tools/handlers/profiles.d.ts.map +1 -0
- package/dist/tools/handlers/profiles.js +25 -0
- package/dist/tools/handlers/profiles.js.map +1 -0
- package/dist/tools/handlers/search.d.ts +12 -0
- package/dist/tools/handlers/search.d.ts.map +1 -0
- package/dist/tools/handlers/search.js +58 -0
- package/dist/tools/handlers/search.js.map +1 -0
- package/dist/tools/handlers/validate.d.ts +12 -0
- package/dist/tools/handlers/validate.d.ts.map +1 -0
- package/dist/tools/handlers/validate.js +76 -0
- package/dist/tools/handlers/validate.js.map +1 -0
- package/dist/tools/index.d.ts +22 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +72 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schemas.d.ts +29 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +20 -0
- package/dist/tools/schemas.js.map +1 -0
- package/dist/tools.js +2 -2
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +417 -2588
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +99 -47
- package/dist/types.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/retry.d.ts.map +1 -1
- package/dist/utils/retry.js +3 -2
- package/dist/utils/retry.js.map +1 -1
- package/package.json +10 -9
- package/profiles/examples/microservice-kafka.yaml +122 -0
- package/profiles/examples/startup-fast.yaml +67 -0
- package/profiles/examples/strict-enterprise.yaml +62 -0
- package/profiles/templates/angular.yaml +614 -0
- package/profiles/templates/csharp-dotnet.yaml +529 -0
- package/profiles/templates/flutter.yaml +547 -0
- package/profiles/templates/go.yaml +1276 -0
- package/profiles/templates/java-spring-backend.yaml +326 -0
- package/profiles/templates/kotlin-spring.yaml +417 -0
- package/profiles/templates/nextjs.yaml +536 -0
- package/profiles/templates/nodejs.yaml +594 -0
- package/profiles/templates/python.yaml +546 -0
- package/profiles/templates/react.yaml +456 -0
- package/profiles/templates/rust.yaml +508 -0
- package/profiles/templates/vue.yaml +483 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { config } from '../../config.js';
|
|
2
|
+
import { getMetrics } from '../../metrics.js';
|
|
3
|
+
import { listProfiles, loadStandards } from '../../profiles.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handler for the health tool.
|
|
6
|
+
* Returns server status, loaded configuration, and usage metrics.
|
|
7
|
+
*/
|
|
8
|
+
export async function handleHealth() {
|
|
9
|
+
const startTime = Date.now();
|
|
10
|
+
try {
|
|
11
|
+
const profiles = await listProfiles();
|
|
12
|
+
const standards = await loadStandards();
|
|
13
|
+
const loadTimeMs = Date.now() - startTime;
|
|
14
|
+
const metrics = getMetrics();
|
|
15
|
+
const lines = [
|
|
16
|
+
'# Corbat MCP Health',
|
|
17
|
+
'',
|
|
18
|
+
'**Status:** OK',
|
|
19
|
+
`**Version:** ${config.serverVersion}`,
|
|
20
|
+
`**Uptime:** ${metrics.uptimeFormatted}`,
|
|
21
|
+
`**Load time:** ${loadTimeMs}ms`,
|
|
22
|
+
'',
|
|
23
|
+
'## Resources',
|
|
24
|
+
'',
|
|
25
|
+
`- **Profiles:** ${profiles.length}`,
|
|
26
|
+
`- **Standards:** ${standards.length} documents`,
|
|
27
|
+
`- **Default profile:** ${config.defaultProfile}`,
|
|
28
|
+
'',
|
|
29
|
+
];
|
|
30
|
+
// Only show metrics section if there have been calls
|
|
31
|
+
if (metrics.totalToolCalls > 0) {
|
|
32
|
+
lines.push('## Metrics', '');
|
|
33
|
+
lines.push(`- **Total tool calls:** ${metrics.totalToolCalls}`);
|
|
34
|
+
if (metrics.mostUsedTool) {
|
|
35
|
+
lines.push(`- **Most used tool:** ${metrics.mostUsedTool}`);
|
|
36
|
+
}
|
|
37
|
+
if (metrics.mostUsedProfile) {
|
|
38
|
+
lines.push(`- **Most used profile:** ${metrics.mostUsedProfile}`);
|
|
39
|
+
}
|
|
40
|
+
if (metrics.mostCommonTaskType) {
|
|
41
|
+
lines.push(`- **Most common task:** ${metrics.mostCommonTaskType}`);
|
|
42
|
+
}
|
|
43
|
+
if (metrics.errors > 0) {
|
|
44
|
+
lines.push(`- **Errors:** ${metrics.errors}`);
|
|
45
|
+
}
|
|
46
|
+
lines.push('');
|
|
47
|
+
}
|
|
48
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
52
|
+
return {
|
|
53
|
+
content: [{ type: 'text', text: `# Corbat MCP Health\n\n**Status:** ERROR\n**Error:** ${errorMessage}` }],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/tools/handlers/health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;QACtC,MAAM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,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wDAAwD,YAAY,EAAE,EAAE,CAAC;SAC1G,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handlers index.
|
|
3
|
+
* Re-exports all handlers for centralized access.
|
|
4
|
+
*/
|
|
5
|
+
export { handleGetContext } from './get-context.js';
|
|
6
|
+
export { handleHealth } from './health.js';
|
|
7
|
+
export { handleInit } from './init.js';
|
|
8
|
+
export { handleProfiles } from './profiles.js';
|
|
9
|
+
export { handleSearch } from './search.js';
|
|
10
|
+
export { handleValidate } from './validate.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handlers index.
|
|
3
|
+
* Re-exports all handlers for centralized access.
|
|
4
|
+
*/
|
|
5
|
+
export { handleGetContext } from './get-context.js';
|
|
6
|
+
export { handleHealth } from './health.js';
|
|
7
|
+
export { handleInit } from './init.js';
|
|
8
|
+
export { handleProfiles } from './profiles.js';
|
|
9
|
+
export { handleSearch } from './search.js';
|
|
10
|
+
export { handleValidate } from './validate.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/handlers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for the init tool.
|
|
3
|
+
* Analyzes project and generates suggested .corbat.json configuration.
|
|
4
|
+
*/
|
|
5
|
+
export declare function handleInit(args: Record<string, unknown>): Promise<{
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/init.ts"],"names":[],"mappings":"AAiEA;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAiDhF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { detectProjectStack } from '../../agent.js';
|
|
2
|
+
import { listProfiles } from '../../profiles.js';
|
|
3
|
+
import { InitSchema } from '../schemas.js';
|
|
4
|
+
/**
|
|
5
|
+
* Generate suggested .corbat.json configuration based on detected stack.
|
|
6
|
+
*/
|
|
7
|
+
function generateSuggestedConfig(stack) {
|
|
8
|
+
if (!stack) {
|
|
9
|
+
return {
|
|
10
|
+
profile: 'minimal',
|
|
11
|
+
autoInject: true,
|
|
12
|
+
rules: {
|
|
13
|
+
always: ['Follow project coding conventions'],
|
|
14
|
+
onNewFile: ['Add appropriate file header comments'],
|
|
15
|
+
onTest: ['Follow AAA pattern (Arrange-Act-Assert)'],
|
|
16
|
+
onRefactor: ['Ensure tests pass before and after refactoring'],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const config = {
|
|
21
|
+
profile: stack.suggestedProfile,
|
|
22
|
+
autoInject: true,
|
|
23
|
+
};
|
|
24
|
+
// Add language-specific rules
|
|
25
|
+
const rules = {
|
|
26
|
+
always: [],
|
|
27
|
+
onNewFile: [],
|
|
28
|
+
onTest: [],
|
|
29
|
+
onRefactor: [],
|
|
30
|
+
};
|
|
31
|
+
if (stack.language === 'Java') {
|
|
32
|
+
rules.always.push('Use constructor injection for dependencies');
|
|
33
|
+
rules.onNewFile.push('Add Javadoc for public classes and methods');
|
|
34
|
+
rules.onTest.push('Use @DisplayName for readable test names');
|
|
35
|
+
}
|
|
36
|
+
else if (stack.language === 'TypeScript' || stack.language === 'JavaScript') {
|
|
37
|
+
rules.always.push('Use strict TypeScript configuration');
|
|
38
|
+
rules.onNewFile.push('Export types alongside implementations');
|
|
39
|
+
rules.onTest.push('Mock external dependencies');
|
|
40
|
+
}
|
|
41
|
+
else if (stack.language === 'Python') {
|
|
42
|
+
rules.always.push('Use type hints for function signatures');
|
|
43
|
+
rules.onNewFile.push('Add module docstring');
|
|
44
|
+
rules.onTest.push('Use pytest fixtures for setup');
|
|
45
|
+
}
|
|
46
|
+
else if (stack.language === 'Go') {
|
|
47
|
+
rules.always.push('Follow effective Go guidelines');
|
|
48
|
+
rules.onNewFile.push('Add package documentation');
|
|
49
|
+
rules.onTest.push('Use table-driven tests');
|
|
50
|
+
}
|
|
51
|
+
if (rules.always.length > 0 || rules.onNewFile.length > 0) {
|
|
52
|
+
config.rules = rules;
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handler for the init tool.
|
|
58
|
+
* Analyzes project and generates suggested .corbat.json configuration.
|
|
59
|
+
*/
|
|
60
|
+
export async function handleInit(args) {
|
|
61
|
+
const { project_dir } = InitSchema.parse(args);
|
|
62
|
+
// Detect project stack
|
|
63
|
+
const stack = await detectProjectStack(project_dir);
|
|
64
|
+
// Get available profiles
|
|
65
|
+
const profiles = await listProfiles();
|
|
66
|
+
const profileIds = profiles.map((p) => p.id);
|
|
67
|
+
// Generate suggested config
|
|
68
|
+
const suggestedConfig = generateSuggestedConfig(stack);
|
|
69
|
+
const lines = ['# Corbat MCP Configuration', '', '## Detected Stack', ''];
|
|
70
|
+
if (stack) {
|
|
71
|
+
lines.push(`- **Language:** ${stack.language}`);
|
|
72
|
+
if (stack.framework) {
|
|
73
|
+
lines.push(`- **Framework:** ${stack.framework}`);
|
|
74
|
+
}
|
|
75
|
+
if (stack.buildTool) {
|
|
76
|
+
lines.push(`- **Build Tool:** ${stack.buildTool}`);
|
|
77
|
+
}
|
|
78
|
+
lines.push(`- **Suggested Profile:** ${stack.suggestedProfile}`);
|
|
79
|
+
lines.push(`- **Confidence:** ${stack.confidence}`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
lines.push('Could not auto-detect stack. Using minimal profile.');
|
|
83
|
+
}
|
|
84
|
+
lines.push('', '## Suggested .corbat.json', '');
|
|
85
|
+
lines.push('```json');
|
|
86
|
+
lines.push(JSON.stringify(suggestedConfig, null, 2));
|
|
87
|
+
lines.push('```');
|
|
88
|
+
lines.push('', '## How to Use', '');
|
|
89
|
+
lines.push(`1. Save the above JSON to \`${project_dir}/.corbat.json\``);
|
|
90
|
+
lines.push('2. Customize rules and profile as needed');
|
|
91
|
+
lines.push('3. Run `get_context` to get standards for your tasks');
|
|
92
|
+
lines.push('', '## Available Profiles', '');
|
|
93
|
+
for (const id of profileIds.slice(0, 10)) {
|
|
94
|
+
const isSelected = id === suggestedConfig.profile ? ' **(selected)**' : '';
|
|
95
|
+
lines.push(`- ${id}${isSelected}`);
|
|
96
|
+
}
|
|
97
|
+
if (profileIds.length > 10) {
|
|
98
|
+
lines.push(`- ... and ${profileIds.length - 10} more`);
|
|
99
|
+
}
|
|
100
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/tools/handlers/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,SAAS,uBAAuB,CAC9B,KAIQ;IAER,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,IAAI;YAChB,KAAK,EAAE;gBACL,MAAM,EAAE,CAAC,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IACrC,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,aAAa,UAAU,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/profiles.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAsBlG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { config } from '../../config.js';
|
|
2
|
+
import { listProfiles } from '../../profiles.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handler for the profiles tool.
|
|
5
|
+
* Lists all available coding standards profiles.
|
|
6
|
+
*/
|
|
7
|
+
export async function handleProfiles() {
|
|
8
|
+
const profiles = await listProfiles();
|
|
9
|
+
if (profiles.length === 0) {
|
|
10
|
+
return {
|
|
11
|
+
content: [{ type: 'text', text: 'No profiles found. Run `corbat-init` to create one.' }],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const lines = ['# Available Profiles', ''];
|
|
15
|
+
for (const { id, profile } of profiles) {
|
|
16
|
+
const isDefault = id === config.defaultProfile ? ' (default)' : '';
|
|
17
|
+
lines.push(`**${id}**${isDefault}`);
|
|
18
|
+
lines.push(`${profile.description || 'No description'}`);
|
|
19
|
+
lines.push('');
|
|
20
|
+
}
|
|
21
|
+
lines.push('---', '');
|
|
22
|
+
lines.push('Use with: `get_context` tool or specify profile in `.corbat.json`');
|
|
23
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/tools/handlers/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;IAEtC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qDAAqD,EAAE,CAAC;SACzF,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAE3C,KAAK,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG,EAAE,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,SAAS,EAAE,CAAC,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,IAAI,gBAAgB,EAAE,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtB,KAAK,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAEhF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for the search tool.
|
|
3
|
+
* Searches standards documentation for specific topics.
|
|
4
|
+
*/
|
|
5
|
+
export declare function handleSearch(args: Record<string, unknown>): Promise<{
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA2DhF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { loadStandards } from '../../profiles.js';
|
|
2
|
+
import { SearchSchema } from '../schemas.js';
|
|
3
|
+
/**
|
|
4
|
+
* Handler for the search tool.
|
|
5
|
+
* Searches standards documentation for specific topics.
|
|
6
|
+
*/
|
|
7
|
+
export async function handleSearch(args) {
|
|
8
|
+
const { query } = SearchSchema.parse(args);
|
|
9
|
+
if (!query.trim()) {
|
|
10
|
+
return {
|
|
11
|
+
content: [{ type: 'text', text: 'Please provide a search query.' }],
|
|
12
|
+
isError: true,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const standards = await loadStandards();
|
|
16
|
+
const queryLower = query.toLowerCase();
|
|
17
|
+
const results = [];
|
|
18
|
+
for (const standard of standards) {
|
|
19
|
+
const contentLower = standard.content.toLowerCase();
|
|
20
|
+
if (contentLower.includes(queryLower)) {
|
|
21
|
+
// Find the relevant section
|
|
22
|
+
const lines = standard.content.split('\n');
|
|
23
|
+
let excerpt = '';
|
|
24
|
+
for (let i = 0; i < lines.length; i++) {
|
|
25
|
+
if (lines[i].toLowerCase().includes(queryLower)) {
|
|
26
|
+
// Get context around match
|
|
27
|
+
const start = Math.max(0, i - 2);
|
|
28
|
+
const end = Math.min(lines.length, i + 5);
|
|
29
|
+
excerpt = lines.slice(start, end).join('\n');
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
results.push({
|
|
34
|
+
name: standard.name,
|
|
35
|
+
category: standard.category,
|
|
36
|
+
excerpt: excerpt.slice(0, 500),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (results.length === 0) {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `No results for "${query}".\n\nTry: testing, kafka, docker, kubernetes, logging, metrics, archunit, flyway`,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const output = [`# Results for "${query}"`, ''];
|
|
51
|
+
for (const result of results.slice(0, 5)) {
|
|
52
|
+
output.push(`## ${result.name}`, '');
|
|
53
|
+
output.push(result.excerpt, '');
|
|
54
|
+
output.push('---', '');
|
|
55
|
+
}
|
|
56
|
+
return { content: [{ type: 'text', text: output.join('\n') }] };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/tools/handlers/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,E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are function handleValidate(args: Record<string, unknown>): Promise<{
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/validate.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA2EhF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getGuardrails } from '../../agent.js';
|
|
2
|
+
import { config } from '../../config.js';
|
|
3
|
+
import { getProfile } from '../../profiles.js';
|
|
4
|
+
import { ValidateSchema } from '../schemas.js';
|
|
5
|
+
/**
|
|
6
|
+
* Handler for the validate tool.
|
|
7
|
+
* Returns validation criteria for code against standards.
|
|
8
|
+
*/
|
|
9
|
+
export async function handleValidate(args) {
|
|
10
|
+
const { code, task_type } = ValidateSchema.parse(args);
|
|
11
|
+
const profileId = config.defaultProfile;
|
|
12
|
+
const profile = await getProfile(profileId);
|
|
13
|
+
if (!profile) {
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: 'text', text: `Profile not found: ${profileId}` }],
|
|
16
|
+
isError: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const guardrails = task_type ? await getGuardrails(task_type, null) : null;
|
|
20
|
+
const lines = [
|
|
21
|
+
'# Code Validation',
|
|
22
|
+
'',
|
|
23
|
+
'## Code',
|
|
24
|
+
'```',
|
|
25
|
+
code.slice(0, 2000) + (code.length > 2000 ? '\n...(truncated)' : ''),
|
|
26
|
+
'```',
|
|
27
|
+
'',
|
|
28
|
+
'---',
|
|
29
|
+
'',
|
|
30
|
+
'## Validation Criteria',
|
|
31
|
+
'',
|
|
32
|
+
];
|
|
33
|
+
// Code quality thresholds
|
|
34
|
+
if (profile.codeQuality) {
|
|
35
|
+
lines.push('**Thresholds:**');
|
|
36
|
+
lines.push(`- Max method lines: ${profile.codeQuality.maxMethodLines}`);
|
|
37
|
+
lines.push(`- Max class lines: ${profile.codeQuality.maxClassLines}`);
|
|
38
|
+
lines.push(`- Max parameters: ${profile.codeQuality.maxMethodParameters}`);
|
|
39
|
+
lines.push(`- Min coverage: ${profile.codeQuality.minimumTestCoverage}%`);
|
|
40
|
+
lines.push('');
|
|
41
|
+
}
|
|
42
|
+
// Guardrails if task type specified
|
|
43
|
+
if (guardrails) {
|
|
44
|
+
lines.push(`**${task_type?.toUpperCase()} Guardrails:**`);
|
|
45
|
+
lines.push('');
|
|
46
|
+
lines.push('Must:');
|
|
47
|
+
for (const rule of guardrails.mandatory.slice(0, 4)) {
|
|
48
|
+
lines.push(`- ${rule}`);
|
|
49
|
+
}
|
|
50
|
+
lines.push('');
|
|
51
|
+
lines.push('Avoid:');
|
|
52
|
+
for (const rule of guardrails.avoid.slice(0, 3)) {
|
|
53
|
+
lines.push(`- ${rule}`);
|
|
54
|
+
}
|
|
55
|
+
lines.push('');
|
|
56
|
+
}
|
|
57
|
+
// Naming conventions
|
|
58
|
+
if (profile.naming) {
|
|
59
|
+
lines.push('**Naming:**');
|
|
60
|
+
const naming = profile.naming;
|
|
61
|
+
if (naming.general && typeof naming.general === 'object') {
|
|
62
|
+
for (const [key, value] of Object.entries(naming.general)) {
|
|
63
|
+
lines.push(`- ${key}: ${value}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
lines.push('');
|
|
67
|
+
}
|
|
68
|
+
lines.push('---', '');
|
|
69
|
+
lines.push('## Review Checklist', '');
|
|
70
|
+
lines.push('Analyze the code and report:', '');
|
|
71
|
+
lines.push('1. **CRITICAL** - Must fix (bugs, security, violations)');
|
|
72
|
+
lines.push('2. **WARNINGS** - Should fix (style, best practices)');
|
|
73
|
+
lines.push('3. **Score** - Compliance 0-100 with justification');
|
|
74
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/tools/handlers/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA6B;IAE7B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvD,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sBAAsB,SAAS,EAAE,EAAE,CAAC;YACpE,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE3E,MAAM,KAAK,GAAa;QACtB,mBAAmB;QACnB,EAAE;QACF,SAAS;QACT,KAAK;QACL,IA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,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools module index.
|
|
3
|
+
*
|
|
4
|
+
* This module provides:
|
|
5
|
+
* - Tool definitions (name, description, inputSchema)
|
|
6
|
+
* - Tool handlers (business logic)
|
|
7
|
+
* - handleToolCall dispatcher
|
|
8
|
+
*/
|
|
9
|
+
export type { ToolName } from './definitions.js';
|
|
10
|
+
export { tools } from './definitions.js';
|
|
11
|
+
export * from './schemas.js';
|
|
12
|
+
/**
|
|
13
|
+
* Handle tool calls by dispatching to the appropriate handler.
|
|
14
|
+
*/
|
|
15
|
+
export declare function handleToolCall(name: string, args: Record<string, unknown>): Promise<{
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: 'text';
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
isError?: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,cAAc,CAAC;AAE7B;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA0DhF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools module index.
|
|
3
|
+
*
|
|
4
|
+
* This module provides:
|
|
5
|
+
* - Tool definitions (name, description, inputSchema)
|
|
6
|
+
* - Tool handlers (business logic)
|
|
7
|
+
* - handleToolCall dispatcher
|
|
8
|
+
*/
|
|
9
|
+
import { logger } from '../logger.js';
|
|
10
|
+
import { recordError, recordToolCall } from '../metrics.js';
|
|
11
|
+
import { handleGetContext, handleHealth, handleInit, handleProfiles, handleSearch, handleValidate, } from './handlers/index.js';
|
|
12
|
+
// Re-export definitions and schemas
|
|
13
|
+
export { tools } from './definitions.js';
|
|
14
|
+
export * from './schemas.js';
|
|
15
|
+
/**
|
|
16
|
+
* Handle tool calls by dispatching to the appropriate handler.
|
|
17
|
+
*/
|
|
18
|
+
export async function handleToolCall(name, args) {
|
|
19
|
+
const toolName = name;
|
|
20
|
+
// Record metrics
|
|
21
|
+
recordToolCall(name);
|
|
22
|
+
logger.debug('Tool call received', { tool: name, args });
|
|
23
|
+
try {
|
|
24
|
+
let result;
|
|
25
|
+
switch (toolName) {
|
|
26
|
+
case 'get_context':
|
|
27
|
+
result = await handleGetContext(args);
|
|
28
|
+
break;
|
|
29
|
+
case 'validate':
|
|
30
|
+
result = await handleValidate(args);
|
|
31
|
+
break;
|
|
32
|
+
case 'search':
|
|
33
|
+
result = await handleSearch(args);
|
|
34
|
+
break;
|
|
35
|
+
case 'profiles':
|
|
36
|
+
result = await handleProfiles();
|
|
37
|
+
break;
|
|
38
|
+
case 'health':
|
|
39
|
+
result = await handleHealth();
|
|
40
|
+
break;
|
|
41
|
+
case 'init':
|
|
42
|
+
result = await handleInit(args);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
recordError();
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: `Unknown tool: ${name}. Available: get_context, validate, search, profiles, health, init`,
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
isError: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (result.isError) {
|
|
57
|
+
recordError();
|
|
58
|
+
logger.warn('Tool returned error', { tool: name });
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
recordError();
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
logger.error('Tool call failed', { tool: name, error: message });
|
|
66
|
+
return {
|
|
67
|
+
content: [{ type: 'text', text: `Error: ${message}` }],
|
|
68
|
+
isError: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,oCAAoC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,cAAc,CAAC;AAE7B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,IAA6B;IAE7B,MAAM,QAAQ,GAAG,IAAgB,CAAC;IAElC,iBAAiB;IACjB,cAAc,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAEzD,IAAI,CAAC;QACH,IAAI,MAA6E,CAAC;QAElF,QAAQ,QAAQ,EAAE,CAAC;YACjB,KAAK,aAAa;gBAChB,MAAM,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACtC,MAAM;YACR,KAAK,UAAU;gBACb,MAAM,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+1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for tool input validation.
|
|
4
|
+
* Centralized schemas used by handlers.
|
|
5
|
+
*/
|
|
6
|
+
export declare const GetContextSchema: z.ZodObject<{
|
|
7
|
+
task: z.ZodString;
|
|
8
|
+
project_dir: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const ValidateSchema: z.ZodObject<{
|
|
11
|
+
code: z.ZodString;
|
|
12
|
+
task_type: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
feature: "feature";
|
|
14
|
+
bugfix: "bugfix";
|
|
15
|
+
refactor: "refactor";
|
|
16
|
+
test: "test";
|
|
17
|
+
}>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const SearchSchema: z.ZodObject<{
|
|
20
|
+
query: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const InitSchema: z.ZodObject<{
|
|
23
|
+
project_dir: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type GetContextInput = z.infer<typeof GetContextSchema>;
|
|
26
|
+
export type ValidateInput = z.infer<typeof ValidateSchema>;
|
|
27
|
+
export type SearchInput = z.infer<typeof SearchSchema>;
|
|
28
|
+
export type InitInput = z.infer<typeof InitSchema>;
|
|
29
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AAEH,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,YAAY;;iBAEvB,CAAC;AAEH,eAAO,MAAM,UAAU;;iBAErB,CAAC;AAGH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for tool input validation.
|
|
4
|
+
* Centralized schemas used by handlers.
|
|
5
|
+
*/
|
|
6
|
+
export const GetContextSchema = z.object({
|
|
7
|
+
task: z.string().min(1, 'Task description is required'),
|
|
8
|
+
project_dir: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
export const ValidateSchema = z.object({
|
|
11
|
+
code: z.string().min(1, 'Code is required'),
|
|
12
|
+
task_type: z.enum(['feature', 'bugfix', 'refactor', 'test']).optional(),
|
|
13
|
+
});
|
|
14
|
+
export const SearchSchema = z.object({
|
|
15
|
+
query: z.string().min(1, 'Search query is required'),
|
|
16
|
+
});
|
|
17
|
+
export const InitSchema = z.object({
|
|
18
|
+
project_dir: z.string().min(1, 'Project directory is required'),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/tools/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CACxE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;CACrD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;CAChE,CAAC,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -151,7 +151,7 @@ async function handleGetContext(args) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
// Get guardrails and rules
|
|
154
|
-
const guardrails = getGuardrails(taskType, projectConfig);
|
|
154
|
+
const guardrails = await getGuardrails(taskType, projectConfig);
|
|
155
155
|
const projectRules = getProjectRules(taskType, projectConfig);
|
|
156
156
|
// Build concise, scannable output
|
|
157
157
|
const lines = [`# Context for: ${task}`, '', '---', ''];
|
|
@@ -246,7 +246,7 @@ async function handleValidate(args) {
|
|
|
246
246
|
isError: true,
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
const guardrails = task_type ? getGuardrails(task_type, null) : null;
|
|
249
|
+
const guardrails = task_type ? await getGuardrails(task_type, null) : null;
|
|
250
250
|
const lines = [
|
|
251
251
|
'# Code Validation',
|
|
252
252
|
'',
|