@corbat-tech/coding-standards-mcp 1.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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +371 -0
  3. package/assets/demo.gif +0 -0
  4. package/dist/agent.d.ts +53 -0
  5. package/dist/agent.d.ts.map +1 -0
  6. package/dist/agent.js +629 -0
  7. package/dist/agent.js.map +1 -0
  8. package/dist/cli/init.d.ts +3 -0
  9. package/dist/cli/init.d.ts.map +1 -0
  10. package/dist/cli/init.js +651 -0
  11. package/dist/cli/init.js.map +1 -0
  12. package/dist/config.d.ts +73 -0
  13. package/dist/config.d.ts.map +1 -0
  14. package/dist/config.js +105 -0
  15. package/dist/config.js.map +1 -0
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +73 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/profiles.d.ts +39 -0
  21. package/dist/profiles.d.ts.map +1 -0
  22. package/dist/profiles.js +526 -0
  23. package/dist/profiles.js.map +1 -0
  24. package/dist/prompts-legacy.d.ts +25 -0
  25. package/dist/prompts-legacy.d.ts.map +1 -0
  26. package/dist/prompts-legacy.js +600 -0
  27. package/dist/prompts-legacy.js.map +1 -0
  28. package/dist/prompts-v2.d.ts +30 -0
  29. package/dist/prompts-v2.d.ts.map +1 -0
  30. package/dist/prompts-v2.js +310 -0
  31. package/dist/prompts-v2.js.map +1 -0
  32. package/dist/prompts.d.ts +30 -0
  33. package/dist/prompts.d.ts.map +1 -0
  34. package/dist/prompts.js +310 -0
  35. package/dist/prompts.js.map +1 -0
  36. package/dist/resources.d.ts +18 -0
  37. package/dist/resources.d.ts.map +1 -0
  38. package/dist/resources.js +95 -0
  39. package/dist/resources.js.map +1 -0
  40. package/dist/tools-legacy.d.ts +196 -0
  41. package/dist/tools-legacy.d.ts.map +1 -0
  42. package/dist/tools-legacy.js +1230 -0
  43. package/dist/tools-legacy.js.map +1 -0
  44. package/dist/tools-v2.d.ts +92 -0
  45. package/dist/tools-v2.d.ts.map +1 -0
  46. package/dist/tools-v2.js +410 -0
  47. package/dist/tools-v2.js.map +1 -0
  48. package/dist/tools.d.ts +92 -0
  49. package/dist/tools.d.ts.map +1 -0
  50. package/dist/tools.js +410 -0
  51. package/dist/tools.js.map +1 -0
  52. package/dist/types.d.ts +3054 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +515 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/utils/index.d.ts +6 -0
  57. package/dist/utils/index.d.ts.map +1 -0
  58. package/dist/utils/index.js +5 -0
  59. package/dist/utils/index.js.map +1 -0
  60. package/dist/utils/retry.d.ts +44 -0
  61. package/dist/utils/retry.d.ts.map +1 -0
  62. package/dist/utils/retry.js +74 -0
  63. package/dist/utils/retry.js.map +1 -0
  64. package/package.json +79 -0
  65. package/profiles/README.md +199 -0
  66. package/profiles/custom/.gitkeep +2 -0
  67. package/profiles/templates/_template.yaml +159 -0
  68. package/profiles/templates/angular.yaml +494 -0
  69. package/profiles/templates/java-spring-backend.yaml +512 -0
  70. package/profiles/templates/minimal.yaml +102 -0
  71. package/profiles/templates/nodejs.yaml +338 -0
  72. package/profiles/templates/python.yaml +340 -0
  73. package/profiles/templates/react.yaml +331 -0
  74. package/profiles/templates/vue.yaml +598 -0
  75. package/standards/architecture/ddd.md +173 -0
  76. package/standards/architecture/hexagonal.md +97 -0
  77. package/standards/cicd/github-actions.md +567 -0
  78. package/standards/clean-code/naming.md +175 -0
  79. package/standards/clean-code/principles.md +179 -0
  80. package/standards/containerization/dockerfile.md +419 -0
  81. package/standards/database/selection-guide.md +443 -0
  82. package/standards/documentation/guidelines.md +189 -0
  83. package/standards/event-driven/domain-events.md +527 -0
  84. package/standards/kubernetes/deployment.md +518 -0
  85. package/standards/observability/guidelines.md +665 -0
  86. package/standards/project-setup/initialization-checklist.md +650 -0
  87. package/standards/spring-boot/best-practices.md +598 -0
  88. package/standards/testing/guidelines.md +559 -0
  89. package/standards/workflow/llm-development-workflow.md +542 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Corbat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,371 @@
1
+ <div align="center">
2
+
3
+ # CORBAT
4
+
5
+ ### Stop repeating yourself. Start coding.
6
+
7
+ **Your architecture rules, TDD workflow, and SOLID principles — injected automatically into every AI response.**
8
+
9
+ [![CI](https://github.com/corbat-tech/corbat-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/corbat-tech/corbat-mcp/actions/workflows/ci.yml)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
11
+ [![MCP](https://img.shields.io/badge/MCP-1.0-blue.svg)](https://modelcontextprotocol.io/)
12
+
13
+ </div>
14
+
15
+ <p align="center">
16
+ <img src="assets/demo.gif" alt="CORBAT Demo" width="800">
17
+ </p>
18
+
19
+ ---
20
+
21
+ ## The Problem
22
+
23
+ Every time you ask AI to write code, you repeat the same instructions:
24
+
25
+ ```
26
+ "Create a payment service. Use hexagonal architecture. Follow TDD.
27
+ Apply SOLID. Use our naming conventions. Ensure 80% coverage..."
28
+ ```
29
+
30
+ **This is tedious, error-prone, and inconsistent.**
31
+
32
+ ## The Solution
33
+
34
+ Define your standards once. Corbat injects them automatically.
35
+
36
+ ```
37
+ You: "Create a payment service"
38
+
39
+ Corbat: ✓ Detected Java/Spring project
40
+ ✓ Applied hexagonal architecture
41
+ ✓ Enforced TDD workflow
42
+ ✓ Injected SOLID principles
43
+ ✓ Set 80%+ coverage requirement
44
+ ```
45
+
46
+ **One prompt. Full compliance.**
47
+
48
+ ---
49
+
50
+ ## Why Corbat vs Alternatives?
51
+
52
+ | Feature | Corbat | Linters (ESLint, etc.) | Manual prompts |
53
+ |---------|:------:|:----------------------:|:--------------:|
54
+ | Enforces **before** code is written | ✅ | ❌ | ❌ |
55
+ | Architecture patterns (hexagonal, DDD) | ✅ | ❌ | ⚠️ |
56
+ | TDD workflow enforcement | ✅ | ❌ | ⚠️ |
57
+ | Task-specific guardrails | ✅ | ❌ | ❌ |
58
+ | Auto-detects your stack | ✅ | ❌ | ❌ |
59
+ | Zero repetition | ✅ | ✅ | ❌ |
60
+
61
+ **Linters catch errors after the fact. Corbat prevents them.**
62
+
63
+ ---
64
+
65
+ ## Quick Start
66
+
67
+ **Step 1** — Clone and build:
68
+ ```bash
69
+ git clone https://github.com/corbat-tech/corbat-mcp.git
70
+ cd corbat-mcp && npm install && npm run build
71
+ ```
72
+
73
+ **Step 2** — Connect to Claude:
74
+
75
+ <table>
76
+ <tr>
77
+ <td><b>Claude Code</b></td>
78
+ <td>
79
+
80
+ ```bash
81
+ claude mcp add corbat node /absolute/path/to/corbat-mcp/dist/index.js
82
+ ```
83
+
84
+ </td>
85
+ </tr>
86
+ <tr>
87
+ <td><b>Claude Desktop</b></td>
88
+ <td>
89
+
90
+ Edit `~/.config/Claude/claude_desktop_config.json`:
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "corbat": {
95
+ "command": "node",
96
+ "args": ["/absolute/path/to/corbat-mcp/dist/index.js"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ </td>
103
+ </tr>
104
+ </table>
105
+
106
+ **Step 3** — Use it:
107
+ ```
108
+ "Create a user service"
109
+ ```
110
+
111
+ Corbat auto-detects your stack and applies all standards. **That's it.**
112
+
113
+ ---
114
+
115
+ ## What You Get
116
+
117
+ When you ask Claude to create code, Corbat injects this context automatically:
118
+
119
+ ```markdown
120
+ # Task: Create payment service
121
+
122
+ ## Detected
123
+ - Stack: Java 21 · Spring Boot 3 · Maven
124
+ - Task type: FEATURE
125
+ - Profile: java-spring-backend
126
+
127
+ ## Guardrails
128
+
129
+ ### MUST
130
+ ✓ Write tests BEFORE implementation (TDD)
131
+ ✓ Use hexagonal architecture (domain/application/infrastructure)
132
+ ✓ Apply SOLID principles
133
+ ✓ Ensure 80%+ test coverage
134
+ ✓ Validate all inputs
135
+ ✓ Document public APIs
136
+
137
+ ### AVOID
138
+ ✗ God classes (>200 lines) or god methods (>20 lines)
139
+ ✗ Hard-coded configuration values
140
+ ✗ Mixing business logic with infrastructure
141
+ ✗ Circular dependencies between layers
142
+
143
+ ## Workflow
144
+ 1. CLARIFY → Confirm requirements
145
+ 2. PLAN → Create task checklist
146
+ 3. BUILD → TDD cycle: Red → Green → Refactor
147
+ 4. VERIFY → Tests pass, linter clean
148
+ 5. REVIEW → Self-check against standards
149
+
150
+ ## Naming Conventions
151
+ - Classes: PascalCase (PaymentService)
152
+ - Methods: camelCase (processPayment)
153
+ - Constants: SCREAMING_SNAKE_CASE
154
+ - Packages: lowercase (com.example.payment)
155
+ ```
156
+
157
+ **Claude now generates code that follows ALL your standards.**
158
+
159
+ ---
160
+
161
+ ## Task-Specific Guardrails
162
+
163
+ Corbat adapts its rules based on what you're doing:
164
+
165
+ <table>
166
+ <tr>
167
+ <th>Task</th>
168
+ <th>MUST</th>
169
+ <th>AVOID</th>
170
+ </tr>
171
+ <tr>
172
+ <td><b>Feature</b></td>
173
+ <td>TDD, 80%+ coverage, SOLID, hexagonal</td>
174
+ <td>God classes, coupled layers</td>
175
+ </tr>
176
+ <tr>
177
+ <td><b>Bugfix</b></td>
178
+ <td>Failing test first, minimal changes</td>
179
+ <td>Refactoring, adding features</td>
180
+ </tr>
181
+ <tr>
182
+ <td><b>Refactor</b></td>
183
+ <td>Tests pass before AND after, incremental</td>
184
+ <td>Behavior changes, big bang</td>
185
+ </tr>
186
+ <tr>
187
+ <td><b>Test</b></td>
188
+ <td>AAA pattern, one assertion, descriptive names</td>
189
+ <td>Implementation details, flaky tests</td>
190
+ </tr>
191
+ </table>
192
+
193
+ ---
194
+
195
+ ## Compatibility
196
+
197
+ | Client | Status |
198
+ |--------|:------:|
199
+ | Claude Code (CLI) | ✅ Tested |
200
+ | Claude Desktop | ✅ Tested |
201
+ | Cursor | ⚠️ Experimental |
202
+ | Windsurf | ⚠️ Experimental |
203
+ | Other MCP clients | ✅ Standard protocol |
204
+
205
+ ---
206
+
207
+ ## Built-in Profiles
208
+
209
+ | Profile | Best for | Architecture |
210
+ |---------|----------|--------------|
211
+ | `java-spring-backend` | Enterprise Java | Hexagonal + DDD |
212
+ | `nodejs` | Node.js/TypeScript APIs | Clean Architecture |
213
+ | `python` | Python/FastAPI | Clean Architecture |
214
+ | `react` | React applications | Feature-based |
215
+ | `angular` | Angular 19+ applications | Feature-based + Signals |
216
+ | `vue` | Vue 3.5+ applications | Feature-based + Composition |
217
+ | `minimal` | MVPs, prototypes | Basic standards |
218
+
219
+ **Auto-detection**: Corbat reads `pom.xml`, `package.json`, `requirements.txt`, etc. to select the right profile.
220
+
221
+ ---
222
+
223
+ ## Customize (Optional)
224
+
225
+ ### Option A: Interactive generator
226
+ ```bash
227
+ npx /path/to/corbat-mcp/dist/cli/init.js
228
+ ```
229
+
230
+ ### Option B: Manual config
231
+
232
+ Create `.corbat.json` in your project root:
233
+
234
+ ```json
235
+ {
236
+ "profile": "nodejs",
237
+ "rules": {
238
+ "always": [
239
+ "Use TypeScript strict mode",
240
+ "Prefer functional programming"
241
+ ],
242
+ "never": [
243
+ "Use any type"
244
+ ]
245
+ }
246
+ }
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Available Tools
252
+
253
+ | Tool | Purpose |
254
+ |------|---------|
255
+ | `get_context` | **Primary** — Returns all standards for your task |
256
+ | `validate` | Check code against standards |
257
+ | `search` | Search standards documentation |
258
+ | `profiles` | List available profiles |
259
+ | `health` | Server status check |
260
+
261
+ ## Available Prompts
262
+
263
+ | Prompt | Purpose |
264
+ |--------|---------|
265
+ | `implement` | Guided implementation with TDD workflow |
266
+ | `review` | Expert code review (architecture, SOLID, security) |
267
+
268
+ ---
269
+
270
+ ## How It Works
271
+
272
+ ```
273
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
274
+ │ Your Prompt │────▶│ Corbat │────▶│ Claude + Rules │
275
+ │ │ │ │ │ │
276
+ │ "Create user │ │ 1. Detect stack │ │ Generates code │
277
+ │ service" │ │ 2. Classify task│ │ following ALL │
278
+ │ │ │ 3. Load profile │ │ your standards │
279
+ │ │ │ 4. Inject rules │ │ │
280
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Included Documentation
286
+
287
+ Corbat comes with 15 standards documents you can search:
288
+
289
+ - **Architecture**: Hexagonal, DDD, Clean Architecture
290
+ - **Code Quality**: SOLID, Clean Code, Naming Conventions
291
+ - **Testing**: TDD, Unit/Integration/E2E guidelines
292
+ - **DevOps**: Docker, Kubernetes, CI/CD
293
+ - **Observability**: Logging, Metrics, Tracing
294
+
295
+ Use `search` tool: *"search kafka"* → Returns event-driven architecture guidelines.
296
+
297
+ ---
298
+
299
+ ## Troubleshooting
300
+
301
+ <details>
302
+ <summary><b>Claude can't find corbat</b></summary>
303
+
304
+ 1. Use **absolute path** in config (not relative)
305
+ 2. Verify: `ls /your/path/to/corbat-mcp/dist/index.js`
306
+ 3. Check `node` is in PATH: `which node`
307
+ 4. Restart Claude completely
308
+ 5. Check Claude's MCP logs
309
+
310
+ </details>
311
+
312
+ <details>
313
+ <summary><b>Wrong stack detected</b></summary>
314
+
315
+ Override with `.corbat.json`:
316
+ ```json
317
+ { "profile": "nodejs" }
318
+ ```
319
+
320
+ Or specify in prompt: *"...using profile nodejs"*
321
+
322
+ </details>
323
+
324
+ <details>
325
+ <summary><b>Standards not being applied</b></summary>
326
+
327
+ 1. Check if `.corbat.json` exists in project root
328
+ 2. Verify profile exists in `profiles/templates/`
329
+ 3. Try explicit: *"Use corbat get_context for: your task"*
330
+
331
+ </details>
332
+
333
+ <details>
334
+ <summary><b>Permission errors (macOS/Linux)</b></summary>
335
+
336
+ ```bash
337
+ chmod +x /path/to/corbat-mcp/dist/index.js
338
+ which node # Use this absolute path in config
339
+ ```
340
+
341
+ </details>
342
+
343
+ ---
344
+
345
+ ## Project Quality
346
+
347
+ | Metric | Value |
348
+ |--------|-------|
349
+ | Test coverage | 80%+ |
350
+ | Tests passing | 78 |
351
+ | TypeScript | Strict mode |
352
+ | Linting | Biome |
353
+ | Architecture validation | dependency-cruiser |
354
+
355
+ ---
356
+
357
+ ## Links
358
+
359
+ - [Full Documentation](docs/full-documentation.md)
360
+ - [Model Context Protocol](https://modelcontextprotocol.io/)
361
+ - [Report Issues](https://github.com/corbat-tech/corbat-mcp/issues)
362
+
363
+ ---
364
+
365
+ <div align="center">
366
+
367
+ **Define once. Apply everywhere. Ship faster.**
368
+
369
+ [Get Started](#quick-start) · [Documentation](docs/full-documentation.md) · [Report Bug](https://github.com/corbat-tech/corbat-mcp/issues)
370
+
371
+ </div>
Binary file
@@ -0,0 +1,53 @@
1
+ import { type DetectedStack, type Guardrails, type ProjectConfig, type TaskType } from './types.js';
2
+ /**
3
+ * Load project configuration from .corbat.json
4
+ */
5
+ export declare function loadProjectConfig(projectDir: string): Promise<ProjectConfig | null>;
6
+ /**
7
+ * Detect project stack from file system.
8
+ */
9
+ export declare function detectProjectStack(projectDir: string): Promise<DetectedStack | null>;
10
+ /**
11
+ * Get guardrails for a specific task type.
12
+ */
13
+ export declare function getGuardrails(taskType: TaskType, projectConfig?: ProjectConfig | null): Guardrails;
14
+ /**
15
+ * Get project rules (always rules + task-specific rules).
16
+ */
17
+ export declare function getProjectRules(taskType: TaskType, projectConfig?: ProjectConfig | null): string[];
18
+ /**
19
+ * Classify task type from description.
20
+ */
21
+ export declare function classifyTaskType(description: string): TaskType;
22
+ /**
23
+ * Technical decision templates by category.
24
+ */
25
+ export declare const TECHNICAL_DECISIONS: Record<string, {
26
+ options: Array<{
27
+ name: string;
28
+ description: string;
29
+ pros: string[];
30
+ cons: string[];
31
+ useWhen: string[];
32
+ }>;
33
+ defaultRecommendation: string;
34
+ }>;
35
+ /**
36
+ * Get a technical decision recommendation.
37
+ */
38
+ export declare function getTechnicalDecision(category: string, _context: string, projectConfig?: ProjectConfig | null): {
39
+ options: Array<{
40
+ name: string;
41
+ description: string;
42
+ pros: string[];
43
+ cons: string[];
44
+ useWhen: string[];
45
+ }>;
46
+ recommendation: string;
47
+ reasoning: string;
48
+ } | null;
49
+ /**
50
+ * Format guardrails as markdown.
51
+ */
52
+ export declare function formatGuardrailsAsMarkdown(guardrails: Guardrails): string;
53
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAgQpB;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAWzF;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA6E1F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,UAAU,CAalG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GAAG,MAAM,EAAE,CAkBlG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAuF9D;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,MAAM,EACN;IACE,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAoIF,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,GACnC;IACD,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAsBP;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAyBzE"}