@corbat-tech/coding-standards-mcp 1.0.3 → 2.0.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 +233 -337
- 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/analysis/code-analyzer.d.ts +44 -0
- package/dist/analysis/code-analyzer.d.ts.map +1 -0
- package/dist/analysis/code-analyzer.js +528 -0
- package/dist/analysis/code-analyzer.js.map +1 -0
- 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 +239 -108
- 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 +143 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +229 -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 +233 -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 +12 -0
- package/dist/tools/handlers/index.d.ts.map +1 -0
- package/dist/tools/handlers/index.js +12 -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 +15 -0
- package/dist/tools/handlers/validate.d.ts.map +1 -0
- package/dist/tools/handlers/validate.js +71 -0
- package/dist/tools/handlers/validate.js.map +1 -0
- package/dist/tools/handlers/verify.d.ts +38 -0
- package/dist/tools/handlers/verify.d.ts.map +1 -0
- package/dist/tools/handlers/verify.js +172 -0
- package/dist/tools/handlers/verify.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 +75 -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 +141 -71
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +92 -40
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- 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
package/dist/prompts.js
CHANGED
|
@@ -79,7 +79,7 @@ async function handleImplementPrompt(args) {
|
|
|
79
79
|
if (!profile)
|
|
80
80
|
return null;
|
|
81
81
|
// Get guardrails
|
|
82
|
-
const guardrails = getGuardrails(taskType, projectConfig);
|
|
82
|
+
const guardrails = await getGuardrails(taskType, projectConfig);
|
|
83
83
|
const projectRules = getProjectRules(taskType, projectConfig);
|
|
84
84
|
// Build prompt
|
|
85
85
|
const lines = [
|
package/dist/prompts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,qHAAqH;QACvH,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,qEAAqE;gBAClF,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,iDAAiD;gBAC9D,QAAQ,EAAE,KAAK;aAChB;SACF;KACF;IACD;QACE,IAAI,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F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions.
|
|
3
|
+
*
|
|
4
|
+
* This file contains ONLY the tool definitions (name, description, inputSchema).
|
|
5
|
+
* Handler logic is in separate files under handlers/.
|
|
6
|
+
*
|
|
7
|
+
* Design principles:
|
|
8
|
+
* - One primary tool (get_context) that does everything
|
|
9
|
+
* - Supporting tools for specific use cases
|
|
10
|
+
* - Names are short and intuitive
|
|
11
|
+
* - Descriptions are optimized for LLM understanding
|
|
12
|
+
*/
|
|
13
|
+
export declare const tools: ({
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: "object";
|
|
18
|
+
properties: {
|
|
19
|
+
task: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
project_dir: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
code?: undefined;
|
|
28
|
+
task_type?: undefined;
|
|
29
|
+
tests?: undefined;
|
|
30
|
+
interfaces?: undefined;
|
|
31
|
+
query?: undefined;
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object";
|
|
40
|
+
properties: {
|
|
41
|
+
code: {
|
|
42
|
+
type: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
task_type: {
|
|
46
|
+
type: string;
|
|
47
|
+
enum: string[];
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
task?: undefined;
|
|
51
|
+
project_dir?: undefined;
|
|
52
|
+
tests?: undefined;
|
|
53
|
+
interfaces?: undefined;
|
|
54
|
+
query?: undefined;
|
|
55
|
+
};
|
|
56
|
+
required: string[];
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object";
|
|
63
|
+
properties: {
|
|
64
|
+
code: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
tests: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
interfaces: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
task_type: {
|
|
77
|
+
type: string;
|
|
78
|
+
enum: string[];
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
task?: undefined;
|
|
82
|
+
project_dir?: undefined;
|
|
83
|
+
query?: undefined;
|
|
84
|
+
};
|
|
85
|
+
required: string[];
|
|
86
|
+
};
|
|
87
|
+
} | {
|
|
88
|
+
name: string;
|
|
89
|
+
description: string;
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object";
|
|
92
|
+
properties: {
|
|
93
|
+
query: {
|
|
94
|
+
type: string;
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
task?: undefined;
|
|
98
|
+
project_dir?: undefined;
|
|
99
|
+
code?: undefined;
|
|
100
|
+
task_type?: undefined;
|
|
101
|
+
tests?: undefined;
|
|
102
|
+
interfaces?: undefined;
|
|
103
|
+
};
|
|
104
|
+
required: string[];
|
|
105
|
+
};
|
|
106
|
+
} | {
|
|
107
|
+
name: string;
|
|
108
|
+
description: string;
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: "object";
|
|
111
|
+
properties: {
|
|
112
|
+
task?: undefined;
|
|
113
|
+
project_dir?: undefined;
|
|
114
|
+
code?: undefined;
|
|
115
|
+
task_type?: undefined;
|
|
116
|
+
tests?: undefined;
|
|
117
|
+
interfaces?: undefined;
|
|
118
|
+
query?: undefined;
|
|
119
|
+
};
|
|
120
|
+
required?: undefined;
|
|
121
|
+
};
|
|
122
|
+
} | {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: "object";
|
|
127
|
+
properties: {
|
|
128
|
+
project_dir: {
|
|
129
|
+
type: string;
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
task?: undefined;
|
|
133
|
+
code?: undefined;
|
|
134
|
+
task_type?: undefined;
|
|
135
|
+
tests?: undefined;
|
|
136
|
+
interfaces?: undefined;
|
|
137
|
+
query?: undefined;
|
|
138
|
+
};
|
|
139
|
+
required: string[];
|
|
140
|
+
};
|
|
141
|
+
})[];
|
|
142
|
+
export type ToolName = 'get_context' | 'validate' | 'verify' | 'search' | 'profiles' | 'health' | 'init';
|
|
143
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6NjB,CAAC;AAGF,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions.
|
|
3
|
+
*
|
|
4
|
+
* This file contains ONLY the tool definitions (name, description, inputSchema).
|
|
5
|
+
* Handler logic is in separate files under handlers/.
|
|
6
|
+
*
|
|
7
|
+
* Design principles:
|
|
8
|
+
* - One primary tool (get_context) that does everything
|
|
9
|
+
* - Supporting tools for specific use cases
|
|
10
|
+
* - Names are short and intuitive
|
|
11
|
+
* - Descriptions are optimized for LLM understanding
|
|
12
|
+
*/
|
|
13
|
+
export const tools = [
|
|
14
|
+
// PRIMARY TOOL - Everything in one call
|
|
15
|
+
{
|
|
16
|
+
name: 'get_context',
|
|
17
|
+
description: `Returns coding standards, guardrails, and workflow for implementing a task.
|
|
18
|
+
|
|
19
|
+
WHEN TO USE:
|
|
20
|
+
- ALWAYS call this FIRST before writing any code
|
|
21
|
+
- When starting a new feature, bugfix, or refactor
|
|
22
|
+
- When unsure about project conventions
|
|
23
|
+
|
|
24
|
+
RETURNS:
|
|
25
|
+
- Detected stack (Java/Python/TypeScript/Go/Rust/etc)
|
|
26
|
+
- Task type classification (feature/bugfix/refactor/test/security/performance)
|
|
27
|
+
- MUST rules (mandatory guidelines)
|
|
28
|
+
- AVOID rules (anti-patterns to prevent)
|
|
29
|
+
- Code quality thresholds (max lines, coverage %)
|
|
30
|
+
- Naming conventions (classes, methods, files)
|
|
31
|
+
- Recommended TDD workflow
|
|
32
|
+
|
|
33
|
+
EXAMPLE: get_context({ task: "Create payment service", project_dir: "/path/to/project" })`,
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
task: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'What you\'re implementing (e.g., "Create payment service", "Fix login bug")',
|
|
40
|
+
},
|
|
41
|
+
project_dir: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Project directory for auto-detection of stack and .corbat.json config (optional)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: ['task'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
// VALIDATE - Real code analysis
|
|
50
|
+
{
|
|
51
|
+
name: 'validate',
|
|
52
|
+
description: `Analyze code against coding standards with REAL code analysis.
|
|
53
|
+
|
|
54
|
+
WHEN TO USE:
|
|
55
|
+
- After writing code, to check for issues
|
|
56
|
+
- During iterative development
|
|
57
|
+
- Before calling verify for final approval
|
|
58
|
+
|
|
59
|
+
PERFORMS REAL ANALYSIS:
|
|
60
|
+
- Detects anti-patterns (empty catch, hardcoded secrets, etc.)
|
|
61
|
+
- Measures method/class lengths
|
|
62
|
+
- Checks for interfaces and tests
|
|
63
|
+
- Calculates quality score
|
|
64
|
+
|
|
65
|
+
RETURNS:
|
|
66
|
+
- Score (0-100)
|
|
67
|
+
- CRITICAL issues (must fix)
|
|
68
|
+
- WARNINGS (should fix)
|
|
69
|
+
- Metrics (lines, methods, tests, etc.)
|
|
70
|
+
- PASSED/NEEDS WORK verdict
|
|
71
|
+
|
|
72
|
+
EXAMPLE: validate({ code: "public class UserService { ... }", task_type: "feature" })`,
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
code: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'The code to validate',
|
|
79
|
+
},
|
|
80
|
+
task_type: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
enum: ['feature', 'bugfix', 'refactor', 'test', 'security', 'performance'],
|
|
83
|
+
description: 'Type of task for context-aware validation (optional)',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
required: ['code'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// VERIFY - Gate before presenting code to user (NEW in v2.0)
|
|
90
|
+
{
|
|
91
|
+
name: 'verify',
|
|
92
|
+
description: `REQUIRED: Verify generated code before presenting to user.
|
|
93
|
+
|
|
94
|
+
WHEN TO USE:
|
|
95
|
+
- ALWAYS call this AFTER generating code
|
|
96
|
+
- BEFORE presenting code to the user
|
|
97
|
+
- This is the final quality gate
|
|
98
|
+
|
|
99
|
+
WHAT IT CHECKS:
|
|
100
|
+
- Tests are provided (TDD compliance)
|
|
101
|
+
- Interfaces exist (DI compliance)
|
|
102
|
+
- No critical code issues
|
|
103
|
+
- Quality score >= 50
|
|
104
|
+
|
|
105
|
+
RETURNS:
|
|
106
|
+
- PASS: Code meets standards, present to user
|
|
107
|
+
- FAIL: Issues to fix, iterate and verify again
|
|
108
|
+
|
|
109
|
+
WORKFLOW:
|
|
110
|
+
1. Generate code following get_context guidelines
|
|
111
|
+
2. Call verify({ code, tests, interfaces })
|
|
112
|
+
3. If FAIL: fix issues and call verify again
|
|
113
|
+
4. If PASS: present code to user
|
|
114
|
+
|
|
115
|
+
EXAMPLE: verify({ code: "class UserServiceImpl...", tests: "describe('UserService')...", interfaces: "interface UserService..." })`,
|
|
116
|
+
inputSchema: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
code: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'All implementation code',
|
|
122
|
+
},
|
|
123
|
+
tests: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
description: 'All test code (REQUIRED for TDD compliance)',
|
|
126
|
+
},
|
|
127
|
+
interfaces: {
|
|
128
|
+
type: 'string',
|
|
129
|
+
description: 'All interfaces and type definitions',
|
|
130
|
+
},
|
|
131
|
+
task_type: {
|
|
132
|
+
type: 'string',
|
|
133
|
+
enum: ['feature', 'bugfix', 'refactor', 'test', 'security', 'performance'],
|
|
134
|
+
description: 'Type of task for context-aware verification',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
required: ['code'],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
// SEARCH - Find specific topics in documentation
|
|
141
|
+
{
|
|
142
|
+
name: 'search',
|
|
143
|
+
description: `Search standards documentation for specific topics.
|
|
144
|
+
|
|
145
|
+
WHEN TO USE:
|
|
146
|
+
- Looking for specific technology guidance (kafka, docker, kubernetes)
|
|
147
|
+
- Need detailed information on a pattern or practice
|
|
148
|
+
- Exploring available standards
|
|
149
|
+
|
|
150
|
+
EXAMPLE QUERIES: "kafka", "testing", "docker", "logging", "metrics", "archunit", "flyway"
|
|
151
|
+
|
|
152
|
+
RETURNS: Up to 5 matching results with excerpts from documentation.`,
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: {
|
|
156
|
+
query: {
|
|
157
|
+
type: 'string',
|
|
158
|
+
description: 'Search query (e.g., "kafka", "testing", "docker")',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
required: ['query'],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
// PROFILES - List available profiles
|
|
165
|
+
{
|
|
166
|
+
name: 'profiles',
|
|
167
|
+
description: `List all available coding standards profiles.
|
|
168
|
+
|
|
169
|
+
RETURNS: List of profiles with ID and description. Profiles include:
|
|
170
|
+
- java-spring-backend: Enterprise Java with Hexagonal Architecture
|
|
171
|
+
- nodejs: Node.js/TypeScript with Clean Architecture
|
|
172
|
+
- react, vue, angular: Frontend frameworks
|
|
173
|
+
- python: FastAPI/Django
|
|
174
|
+
- go, rust: Systems programming
|
|
175
|
+
- And more...
|
|
176
|
+
|
|
177
|
+
Use profile ID in .corbat.json or get_context will auto-detect.`,
|
|
178
|
+
inputSchema: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
// HEALTH - Server status
|
|
184
|
+
{
|
|
185
|
+
name: 'health',
|
|
186
|
+
description: `Check server status, loaded profiles, and usage metrics.
|
|
187
|
+
|
|
188
|
+
RETURNS:
|
|
189
|
+
- Server status (OK/ERROR)
|
|
190
|
+
- Version
|
|
191
|
+
- Load time
|
|
192
|
+
- Profiles loaded
|
|
193
|
+
- Standards documents count
|
|
194
|
+
- Usage metrics (tool calls, most used profile)`,
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
// INIT - Generate .corbat.json
|
|
201
|
+
{
|
|
202
|
+
name: 'init',
|
|
203
|
+
description: `Generate a .corbat.json configuration file for a project.
|
|
204
|
+
|
|
205
|
+
WHEN TO USE:
|
|
206
|
+
- Setting up Corbat for a new project
|
|
207
|
+
- Want to customize coding standards for a project
|
|
208
|
+
- Need to see available profiles and options
|
|
209
|
+
|
|
210
|
+
Analyzes the project directory and suggests optimal configuration based on detected stack.
|
|
211
|
+
|
|
212
|
+
RETURNS:
|
|
213
|
+
- Detected stack information
|
|
214
|
+
- Suggested .corbat.json content
|
|
215
|
+
- Available profiles list
|
|
216
|
+
- Setup instructions`,
|
|
217
|
+
inputSchema: {
|
|
218
|
+
type: 'object',
|
|
219
|
+
properties: {
|
|
220
|
+
project_dir: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
description: 'Project directory to analyze',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
required: ['project_dir'],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,wCAAwC;IACxC;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE;;;;;;;;;;;;;;;;0FAgByE;QACtF,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,6EAA6E;iBAC3F;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kFAAkF;iBAChG;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IAED,gCAAgC;IAChC;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;sFAoBqE;QAClF,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sBAAsB;iBACpC;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,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ACE,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE;;;;;;;;gDAQ+B;QAC5C,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE;SACf;KACF;IAED,+BAA+B;IAC/B;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE;;;;;;;;;;;;;qBAaI;QACjB,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler for the get_context tool.
|
|
3
|
+
* Returns complete coding standards context for a task.
|
|
4
|
+
*/
|
|
5
|
+
export declare function handleGetContext(args: Record<string, unknown>): Promise<{
|
|
6
|
+
content: Array<{
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
isError?: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=get-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-context.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/get-context.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,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,CAmPhF"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { classifyTaskType, detectProjectStack, getGuardrails, getProjectRules, loadProjectConfig, } from '../../agent.js';
|
|
2
|
+
import { config } from '../../config.js';
|
|
3
|
+
import { getProfile, listProfiles } from '../../profiles.js';
|
|
4
|
+
import { GetContextSchema } from '../schemas.js';
|
|
5
|
+
/**
|
|
6
|
+
* Handler for the get_context tool.
|
|
7
|
+
* Returns complete coding standards context for a task.
|
|
8
|
+
*/
|
|
9
|
+
export async function handleGetContext(args) {
|
|
10
|
+
const { task, project_dir } = GetContextSchema.parse(args);
|
|
11
|
+
// Classify task type
|
|
12
|
+
const taskType = classifyTaskType(task);
|
|
13
|
+
// Auto-detect project stack if directory provided
|
|
14
|
+
let detectedStack = null;
|
|
15
|
+
let projectConfig = null;
|
|
16
|
+
if (project_dir) {
|
|
17
|
+
detectedStack = await detectProjectStack(project_dir);
|
|
18
|
+
projectConfig = await loadProjectConfig(project_dir);
|
|
19
|
+
}
|
|
20
|
+
// Determine profile (priority: project config > detected > default)
|
|
21
|
+
const profileId = projectConfig?.profile || detectedStack?.suggestedProfile || config.defaultProfile;
|
|
22
|
+
const profile = await getProfile(profileId);
|
|
23
|
+
if (!profile) {
|
|
24
|
+
const availableProfiles = await listProfiles();
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
text: `Profile "${profileId}" not found.\n\nAvailable profiles:\n${availableProfiles.map((p) => `- ${p.id}`).join('\n')}\n\nRun \`corbat-init\` in your project to create a custom profile.`,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
isError: true,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Get guardrails and rules
|
|
36
|
+
const guardrails = await getGuardrails(taskType, projectConfig);
|
|
37
|
+
const projectRules = getProjectRules(taskType, projectConfig);
|
|
38
|
+
// Build concise, scannable output
|
|
39
|
+
const lines = [`# Context for: ${task}`, '', '---', ''];
|
|
40
|
+
// Stack Detection (concise)
|
|
41
|
+
if (detectedStack) {
|
|
42
|
+
const stackParts = [detectedStack.language];
|
|
43
|
+
if (detectedStack.framework)
|
|
44
|
+
stackParts.push(detectedStack.framework);
|
|
45
|
+
if (detectedStack.buildTool)
|
|
46
|
+
stackParts.push(detectedStack.buildTool);
|
|
47
|
+
lines.push(`**Stack:** ${stackParts.join(' · ')}`);
|
|
48
|
+
}
|
|
49
|
+
lines.push(`**Task type:** ${taskType.toUpperCase()}`);
|
|
50
|
+
lines.push(`**Profile:** ${profileId}`);
|
|
51
|
+
lines.push('');
|
|
52
|
+
// Guardrails (essential, concise)
|
|
53
|
+
lines.push('---', '', '## Guardrails', '');
|
|
54
|
+
lines.push('**MUST:**');
|
|
55
|
+
for (const rule of guardrails.mandatory.slice(0, 5)) {
|
|
56
|
+
lines.push(`- ${rule}`);
|
|
57
|
+
}
|
|
58
|
+
lines.push('');
|
|
59
|
+
lines.push('**AVOID:**');
|
|
60
|
+
for (const rule of guardrails.avoid.slice(0, 4)) {
|
|
61
|
+
lines.push(`- ${rule}`);
|
|
62
|
+
}
|
|
63
|
+
lines.push('');
|
|
64
|
+
// Project-specific rules (if any)
|
|
65
|
+
if (projectRules.length > 0) {
|
|
66
|
+
lines.push('**PROJECT RULES:**');
|
|
67
|
+
for (const rule of projectRules) {
|
|
68
|
+
lines.push(`- ${rule}`);
|
|
69
|
+
}
|
|
70
|
+
lines.push('');
|
|
71
|
+
}
|
|
72
|
+
// Quick Reference (most important settings)
|
|
73
|
+
lines.push('---', '', '## Quick Reference', '');
|
|
74
|
+
if (profile.codeQuality) {
|
|
75
|
+
lines.push(`- Max method lines: ${profile.codeQuality.maxMethodLines}`);
|
|
76
|
+
lines.push(`- Max class lines: ${profile.codeQuality.maxClassLines}`);
|
|
77
|
+
lines.push(`- Min test coverage: ${profile.codeQuality.minimumTestCoverage}%`);
|
|
78
|
+
}
|
|
79
|
+
if (profile.architecture) {
|
|
80
|
+
lines.push(`- Architecture: ${profile.architecture.type}`);
|
|
81
|
+
}
|
|
82
|
+
if (profile.ddd?.enabled) {
|
|
83
|
+
lines.push('- DDD: Enabled');
|
|
84
|
+
}
|
|
85
|
+
if (profile.testing) {
|
|
86
|
+
lines.push(`- Testing: ${profile.testing.framework || 'standard'}`);
|
|
87
|
+
}
|
|
88
|
+
lines.push('');
|
|
89
|
+
// Naming conventions (concise)
|
|
90
|
+
if (profile.naming) {
|
|
91
|
+
lines.push('---', '', '## Naming', '');
|
|
92
|
+
const naming = profile.naming;
|
|
93
|
+
if (naming.general && typeof naming.general === 'object') {
|
|
94
|
+
for (const [key, value] of Object.entries(naming.general)) {
|
|
95
|
+
lines.push(`- **${key}:** ${value}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (naming.suffixes && typeof naming.suffixes === 'object') {
|
|
99
|
+
lines.push('');
|
|
100
|
+
lines.push('**Suffixes:**');
|
|
101
|
+
for (const [key, value] of Object.entries(naming.suffixes)) {
|
|
102
|
+
lines.push(`- ${key}: \`${value}\``);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
lines.push('');
|
|
106
|
+
}
|
|
107
|
+
// Workflow reminder (brief)
|
|
108
|
+
lines.push('---', '', '## Workflow', '');
|
|
109
|
+
lines.push('```');
|
|
110
|
+
lines.push('1. CLARIFY → Ask if unclear');
|
|
111
|
+
lines.push('2. PLAN → Task checklist');
|
|
112
|
+
lines.push('3. BUILD → TDD: Test → Code → Refactor');
|
|
113
|
+
lines.push('4. VERIFY → Tests pass, linter clean');
|
|
114
|
+
lines.push('5. REVIEW → Self-check as expert');
|
|
115
|
+
lines.push('```');
|
|
116
|
+
lines.push('');
|
|
117
|
+
// === STRATEGY 1: CHECKPOINT VERIFICATION ===
|
|
118
|
+
lines.push('---', '', '## MANDATORY CHECKPOINT', '');
|
|
119
|
+
lines.push(`
|
|
120
|
+
⚠️ **BEFORE writing ANY code**, respond with this JSON:
|
|
121
|
+
|
|
122
|
+
\`\`\`json
|
|
123
|
+
{
|
|
124
|
+
"checkpoint": {
|
|
125
|
+
"task_understood": true,
|
|
126
|
+
"clarifications_needed": [],
|
|
127
|
+
"approach": "Brief description of implementation approach"
|
|
128
|
+
},
|
|
129
|
+
"architecture": {
|
|
130
|
+
"layers_affected": ["domain", "application", "infrastructure"],
|
|
131
|
+
"interfaces_to_create": ["InterfaceName1", "InterfaceName2"],
|
|
132
|
+
"classes_to_create": ["ClassName1", "ClassName2"]
|
|
133
|
+
},
|
|
134
|
+
"tdd_plan": {
|
|
135
|
+
"tests_to_write": [
|
|
136
|
+
"should_do_X_when_Y",
|
|
137
|
+
"should_fail_when_Z",
|
|
138
|
+
"should_handle_edge_case"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"quality_commitments": {
|
|
142
|
+
"max_method_lines": 20,
|
|
143
|
+
"max_class_lines": 200,
|
|
144
|
+
"dependency_injection": true,
|
|
145
|
+
"custom_errors": true,
|
|
146
|
+
"test_coverage_target": 80
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
\`\`\`
|
|
150
|
+
|
|
151
|
+
**Only proceed to code generation after completing this checkpoint.**
|
|
152
|
+
`);
|
|
153
|
+
// === STRATEGY 4: CONTRACTUAL RESPONSE FORMAT ===
|
|
154
|
+
lines.push('---', '', '## REQUIRED RESPONSE STRUCTURE', '');
|
|
155
|
+
lines.push(`
|
|
156
|
+
Structure your response in this **exact order**:
|
|
157
|
+
|
|
158
|
+
### 1. CHECKPOINT
|
|
159
|
+
Complete the checkpoint JSON above first.
|
|
160
|
+
|
|
161
|
+
### 2. INTERFACES / TYPES
|
|
162
|
+
\`\`\`
|
|
163
|
+
// Define ALL interfaces and types FIRST
|
|
164
|
+
interface ServiceName { ... }
|
|
165
|
+
type ResultType = { ... }
|
|
166
|
+
\`\`\`
|
|
167
|
+
|
|
168
|
+
### 3. TESTS
|
|
169
|
+
\`\`\`
|
|
170
|
+
// Write tests BEFORE implementation (TDD)
|
|
171
|
+
describe('ServiceName', () => {
|
|
172
|
+
it('should do X when Y', () => { ... });
|
|
173
|
+
it('should fail when Z', () => { ... });
|
|
174
|
+
});
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
### 4. IMPLEMENTATION
|
|
178
|
+
\`\`\`
|
|
179
|
+
// NOW implement to make tests pass
|
|
180
|
+
class ServiceNameImpl implements ServiceName { ... }
|
|
181
|
+
\`\`\`
|
|
182
|
+
|
|
183
|
+
### 5. SELF-REVIEW
|
|
184
|
+
Complete the self-review JSON below.
|
|
185
|
+
|
|
186
|
+
⚠️ **Code not following this structure will not meet quality standards.**
|
|
187
|
+
`);
|
|
188
|
+
// === STRATEGY 3: MANDATORY SELF-REVIEW ===
|
|
189
|
+
lines.push('---', '', '## MANDATORY SELF-REVIEW', '');
|
|
190
|
+
lines.push(`
|
|
191
|
+
After generating code, perform a self-review and report:
|
|
192
|
+
|
|
193
|
+
\`\`\`json
|
|
194
|
+
{
|
|
195
|
+
"self_review": {
|
|
196
|
+
"methods_over_20_lines": 0,
|
|
197
|
+
"classes_over_200_lines": 0,
|
|
198
|
+
"interfaces_created": 3,
|
|
199
|
+
"tests_written": 5,
|
|
200
|
+
"custom_errors_defined": 2,
|
|
201
|
+
"dependency_injection_used": true,
|
|
202
|
+
"hardcoded_values": 0,
|
|
203
|
+
"todos_or_fixmes": 0
|
|
204
|
+
},
|
|
205
|
+
"quality_score": "8/10",
|
|
206
|
+
"confidence": "high",
|
|
207
|
+
"improvements_if_more_time": [
|
|
208
|
+
"Add more edge case tests",
|
|
209
|
+
"Extract validation logic to separate class"
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
**If quality_score < 7, iterate and improve before presenting the code.**
|
|
215
|
+
`);
|
|
216
|
+
// === VERIFY TOOL REMINDER ===
|
|
217
|
+
lines.push('---', '', '## FINAL STEP', '');
|
|
218
|
+
lines.push(`
|
|
219
|
+
After completing all code, call the \`verify\` tool with your generated code:
|
|
220
|
+
|
|
221
|
+
\`\`\`
|
|
222
|
+
verify({
|
|
223
|
+
code: "// all implementation code",
|
|
224
|
+
tests: "// all test code",
|
|
225
|
+
interfaces: "// all interfaces"
|
|
226
|
+
})
|
|
227
|
+
\`\`\`
|
|
228
|
+
|
|
229
|
+
Only present code to user after verify returns **PASS**.
|
|
230
|
+
`);
|
|
231
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=get-context.js.map
|