@eddacraft/anvil-runtime 0.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/LICENSE +14 -0
- package/dist/cache/cache-key.d.ts +45 -0
- package/dist/cache/cache-key.d.ts.map +1 -0
- package/dist/cache/cache-key.js +135 -0
- package/dist/cache/index.d.ts +27 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +38 -0
- package/dist/cache/providers/file-cache.d.ts +63 -0
- package/dist/cache/providers/file-cache.d.ts.map +1 -0
- package/dist/cache/providers/file-cache.js +369 -0
- package/dist/cache/providers/memory-cache.d.ts +52 -0
- package/dist/cache/providers/memory-cache.d.ts.map +1 -0
- package/dist/cache/providers/memory-cache.js +197 -0
- package/dist/cache/providers/null-cache.d.ts +26 -0
- package/dist/cache/providers/null-cache.d.ts.map +1 -0
- package/dist/cache/providers/null-cache.js +50 -0
- package/dist/cache/types.d.ts +114 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +4 -0
- package/dist/concurrency/agent.d.ts +137 -0
- package/dist/concurrency/agent.d.ts.map +1 -0
- package/dist/concurrency/agent.js +440 -0
- package/dist/concurrency/atomic.d.ts +93 -0
- package/dist/concurrency/atomic.d.ts.map +1 -0
- package/dist/concurrency/atomic.js +281 -0
- package/dist/concurrency/git-agent.d.ts +114 -0
- package/dist/concurrency/git-agent.d.ts.map +1 -0
- package/dist/concurrency/git-agent.js +313 -0
- package/dist/concurrency/index.d.ts +95 -0
- package/dist/concurrency/index.d.ts.map +1 -0
- package/dist/concurrency/index.js +127 -0
- package/dist/concurrency/lock-manager.d.ts +170 -0
- package/dist/concurrency/lock-manager.d.ts.map +1 -0
- package/dist/concurrency/lock-manager.js +525 -0
- package/dist/concurrency/queue-manager.d.ts +166 -0
- package/dist/concurrency/queue-manager.d.ts.map +1 -0
- package/dist/concurrency/queue-manager.js +442 -0
- package/dist/concurrency/types.d.ts +382 -0
- package/dist/concurrency/types.d.ts.map +1 -0
- package/dist/concurrency/types.js +204 -0
- package/dist/export/constraint-collector.d.ts +175 -0
- package/dist/export/constraint-collector.d.ts.map +1 -0
- package/dist/export/constraint-collector.js +203 -0
- package/dist/export/formatters/llms-txt-formatter.d.ts +89 -0
- package/dist/export/formatters/llms-txt-formatter.d.ts.map +1 -0
- package/dist/export/formatters/llms-txt-formatter.js +249 -0
- package/dist/export/formatters/mcp-resource-formatter.d.ts +186 -0
- package/dist/export/formatters/mcp-resource-formatter.d.ts.map +1 -0
- package/dist/export/formatters/mcp-resource-formatter.js +139 -0
- package/dist/export/formatters/prompt-formatter.d.ts +83 -0
- package/dist/export/formatters/prompt-formatter.d.ts.map +1 -0
- package/dist/export/formatters/prompt-formatter.js +256 -0
- package/dist/export/index.d.ts +10 -0
- package/dist/export/index.d.ts.map +1 -0
- package/dist/export/index.js +9 -0
- package/dist/gate/check.interface.d.ts +15 -0
- package/dist/gate/check.interface.d.ts.map +1 -0
- package/dist/gate/check.interface.js +18 -0
- package/dist/gate/checks/antipattern.check.d.ts +27 -0
- package/dist/gate/checks/antipattern.check.d.ts.map +1 -0
- package/dist/gate/checks/antipattern.check.js +140 -0
- package/dist/gate/checks/architecture/circular-detector.d.ts +33 -0
- package/dist/gate/checks/architecture/circular-detector.d.ts.map +1 -0
- package/dist/gate/checks/architecture/circular-detector.js +71 -0
- package/dist/gate/checks/architecture/dependency-analyzer.d.ts +81 -0
- package/dist/gate/checks/architecture/dependency-analyzer.d.ts.map +1 -0
- package/dist/gate/checks/architecture/dependency-analyzer.js +136 -0
- package/dist/gate/checks/architecture/layer-validator.d.ts +75 -0
- package/dist/gate/checks/architecture/layer-validator.d.ts.map +1 -0
- package/dist/gate/checks/architecture/layer-validator.js +193 -0
- package/dist/gate/checks/architecture.check.d.ts +56 -0
- package/dist/gate/checks/architecture.check.d.ts.map +1 -0
- package/dist/gate/checks/architecture.check.js +394 -0
- package/dist/gate/checks/command-safety.check.d.ts +12 -0
- package/dist/gate/checks/command-safety.check.d.ts.map +1 -0
- package/dist/gate/checks/command-safety.check.js +230 -0
- package/dist/gate/checks/coverage.check.d.ts +9 -0
- package/dist/gate/checks/coverage.check.d.ts.map +1 -0
- package/dist/gate/checks/coverage.check.js +81 -0
- package/dist/gate/checks/dependency.check.d.ts +17 -0
- package/dist/gate/checks/dependency.check.d.ts.map +1 -0
- package/dist/gate/checks/dependency.check.js +342 -0
- package/dist/gate/checks/eslint.check.d.ts +14 -0
- package/dist/gate/checks/eslint.check.d.ts.map +1 -0
- package/dist/gate/checks/eslint.check.js +79 -0
- package/dist/gate/checks/policy.check.d.ts +78 -0
- package/dist/gate/checks/policy.check.d.ts.map +1 -0
- package/dist/gate/checks/policy.check.js +457 -0
- package/dist/gate/checks/secret/entropy-detector.d.ts +44 -0
- package/dist/gate/checks/secret/entropy-detector.d.ts.map +1 -0
- package/dist/gate/checks/secret/entropy-detector.js +76 -0
- package/dist/gate/checks/secret/git-scanner.d.ts +36 -0
- package/dist/gate/checks/secret/git-scanner.d.ts.map +1 -0
- package/dist/gate/checks/secret/git-scanner.js +90 -0
- package/dist/gate/checks/secret/secret-patterns.d.ts +42 -0
- package/dist/gate/checks/secret/secret-patterns.d.ts.map +1 -0
- package/dist/gate/checks/secret/secret-patterns.js +137 -0
- package/dist/gate/checks/secret.check.d.ts +56 -0
- package/dist/gate/checks/secret.check.d.ts.map +1 -0
- package/dist/gate/checks/secret.check.js +245 -0
- package/dist/gate/config/command-safety-config.d.ts +5 -0
- package/dist/gate/config/command-safety-config.d.ts.map +1 -0
- package/dist/gate/config/command-safety-config.js +69 -0
- package/dist/gate/config/index.d.ts +2 -0
- package/dist/gate/config/index.d.ts.map +1 -0
- package/dist/gate/config/index.js +1 -0
- package/dist/gate/formatters/command-safety-formatter.d.ts +10 -0
- package/dist/gate/formatters/command-safety-formatter.d.ts.map +1 -0
- package/dist/gate/formatters/command-safety-formatter.js +64 -0
- package/dist/gate/formatters/index.d.ts +2 -0
- package/dist/gate/formatters/index.d.ts.map +1 -0
- package/dist/gate/formatters/index.js +1 -0
- package/dist/gate/gate-config.d.ts +44 -0
- package/dist/gate/gate-config.d.ts.map +1 -0
- package/dist/gate/gate-config.js +334 -0
- package/dist/gate/gate-runner.d.ts +160 -0
- package/dist/gate/gate-runner.d.ts.map +1 -0
- package/dist/gate/gate-runner.js +531 -0
- package/dist/gate/index.d.ts +20 -0
- package/dist/gate/index.d.ts.map +1 -0
- package/dist/gate/index.js +14 -0
- package/dist/gate/parsers/command-parser.d.ts +18 -0
- package/dist/gate/parsers/command-parser.d.ts.map +1 -0
- package/dist/gate/parsers/command-parser.js +363 -0
- package/dist/gate/parsers/index.d.ts +2 -0
- package/dist/gate/parsers/index.d.ts.map +1 -0
- package/dist/gate/parsers/index.js +1 -0
- package/dist/gate/policy/index.d.ts +12 -0
- package/dist/gate/policy/index.d.ts.map +1 -0
- package/dist/gate/policy/index.js +10 -0
- package/dist/gate/rules/default-filesystem-rules.d.ts +3 -0
- package/dist/gate/rules/default-filesystem-rules.d.ts.map +1 -0
- package/dist/gate/rules/default-filesystem-rules.js +201 -0
- package/dist/gate/rules/default-git-rules.d.ts +3 -0
- package/dist/gate/rules/default-git-rules.d.ts.map +1 -0
- package/dist/gate/rules/default-git-rules.js +192 -0
- package/dist/gate/rules/index.d.ts +5 -0
- package/dist/gate/rules/index.d.ts.map +1 -0
- package/dist/gate/rules/index.js +3 -0
- package/dist/gate/rules/rule-matcher.d.ts +27 -0
- package/dist/gate/rules/rule-matcher.d.ts.map +1 -0
- package/dist/gate/rules/rule-matcher.js +228 -0
- package/dist/gate/rules/types.d.ts +250 -0
- package/dist/gate/rules/types.d.ts.map +1 -0
- package/dist/gate/rules/types.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/types/gate.types.d.ts +42 -0
- package/dist/types/gate.types.d.ts.map +1 -0
- package/dist/types/gate.types.js +94 -0
- package/dist/watch/debouncer.d.ts +90 -0
- package/dist/watch/debouncer.d.ts.map +1 -0
- package/dist/watch/debouncer.js +135 -0
- package/dist/watch/file-watcher.d.ts +73 -0
- package/dist/watch/file-watcher.d.ts.map +1 -0
- package/dist/watch/file-watcher.js +121 -0
- package/dist/watch/git-status.d.ts +98 -0
- package/dist/watch/git-status.d.ts.map +1 -0
- package/dist/watch/git-status.js +266 -0
- package/dist/watch/index.d.ts +16 -0
- package/dist/watch/index.d.ts.map +1 -0
- package/dist/watch/index.js +15 -0
- package/dist/watch/orchestrator.d.ts +113 -0
- package/dist/watch/orchestrator.d.ts.map +1 -0
- package/dist/watch/orchestrator.js +409 -0
- package/dist/watch/types.d.ts +190 -0
- package/dist/watch/types.d.ts.map +1 -0
- package/dist/watch/types.js +76 -0
- package/package.json +60 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* llms.txt Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats Anvil constraints as llms.txt markdown for AI tool consumption.
|
|
5
|
+
*
|
|
6
|
+
* llms.txt is an emerging community standard for providing AI-readable
|
|
7
|
+
* documentation and constraints. See: https://mintlify.com/blog/simplifying-docs-with-llms-txt
|
|
8
|
+
*
|
|
9
|
+
* @module export/formatters/llms-txt-formatter
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// llms.txt Formatter
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Formats constraints as llms.txt markdown
|
|
16
|
+
*/
|
|
17
|
+
export class LlmsTxtFormatter {
|
|
18
|
+
options;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.options = {
|
|
21
|
+
includeMetadata: true,
|
|
22
|
+
includeBoundaries: true,
|
|
23
|
+
includeAntiPatterns: true,
|
|
24
|
+
includeConventions: true,
|
|
25
|
+
includeLayers: true,
|
|
26
|
+
includeSuppressions: true,
|
|
27
|
+
...options,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Format constraints as llms.txt markdown
|
|
32
|
+
*
|
|
33
|
+
* @param constraints - Constraints to format
|
|
34
|
+
* @returns llms.txt markdown string
|
|
35
|
+
*/
|
|
36
|
+
format(constraints) {
|
|
37
|
+
const sections = [];
|
|
38
|
+
// Title
|
|
39
|
+
sections.push('# Anvil Architecture Constraints\n');
|
|
40
|
+
// Metadata
|
|
41
|
+
if (this.options.includeMetadata) {
|
|
42
|
+
sections.push(this.formatMetadata(constraints));
|
|
43
|
+
}
|
|
44
|
+
// Architecture boundaries
|
|
45
|
+
if (this.options.includeBoundaries && constraints.boundaries.length > 0) {
|
|
46
|
+
sections.push(this.formatBoundaries(constraints));
|
|
47
|
+
}
|
|
48
|
+
// Layer definitions
|
|
49
|
+
if (this.options.includeLayers && constraints.layers.length > 0) {
|
|
50
|
+
sections.push(this.formatLayers(constraints));
|
|
51
|
+
}
|
|
52
|
+
// Anti-patterns
|
|
53
|
+
if (this.options.includeAntiPatterns && constraints.antiPatterns.length > 0) {
|
|
54
|
+
sections.push(this.formatAntiPatterns(constraints));
|
|
55
|
+
}
|
|
56
|
+
// Conventions
|
|
57
|
+
if (this.options.includeConventions && constraints.conventions.length > 0) {
|
|
58
|
+
sections.push(this.formatConventions(constraints));
|
|
59
|
+
}
|
|
60
|
+
// Suppressions
|
|
61
|
+
if (this.options.includeSuppressions && constraints.suppressions.length > 0) {
|
|
62
|
+
sections.push(this.formatSuppressions(constraints));
|
|
63
|
+
}
|
|
64
|
+
return sections.join('\n');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Format metadata section
|
|
68
|
+
*/
|
|
69
|
+
formatMetadata(constraints) {
|
|
70
|
+
const lines = [
|
|
71
|
+
'> **Generated:** ' + new Date(constraints.metadata.collectedAt).toLocaleString(),
|
|
72
|
+
'> **Workspace:** ' + constraints.metadata.workspaceRoot,
|
|
73
|
+
'> **Has Baseline:** ' + (constraints.metadata.hasBaseline ? 'Yes' : 'No'),
|
|
74
|
+
'',
|
|
75
|
+
];
|
|
76
|
+
return lines.join('\n');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Format architecture boundaries section
|
|
80
|
+
*/
|
|
81
|
+
formatBoundaries(constraints) {
|
|
82
|
+
const lines = ['## Boundary Rules\n'];
|
|
83
|
+
lines.push('These architectural boundaries must be respected. Violations will be flagged as warnings or errors.\n');
|
|
84
|
+
for (const boundary of constraints.boundaries) {
|
|
85
|
+
const severityEmoji = this.getSeverityEmoji(boundary.severity);
|
|
86
|
+
lines.push(`- ${severityEmoji} **${boundary.name}**`);
|
|
87
|
+
lines.push(` - From: \`${boundary.from}\``);
|
|
88
|
+
lines.push(` - To: \`${boundary.to}\``);
|
|
89
|
+
lines.push(` - Rule: ${boundary.message}`);
|
|
90
|
+
lines.push('');
|
|
91
|
+
}
|
|
92
|
+
return lines.join('\n');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Format layer definitions section
|
|
96
|
+
*/
|
|
97
|
+
formatLayers(constraints) {
|
|
98
|
+
const lines = ['## Layer Definitions\n'];
|
|
99
|
+
lines.push('The codebase is organised into architectural layers. Each layer has specific responsibilities and dependencies.\n');
|
|
100
|
+
for (const layer of constraints.layers) {
|
|
101
|
+
lines.push(`### ${layer.name}\n`);
|
|
102
|
+
if (layer.description) {
|
|
103
|
+
lines.push(`${layer.description}\n`);
|
|
104
|
+
}
|
|
105
|
+
lines.push('**Patterns:**');
|
|
106
|
+
for (const pattern of layer.patterns) {
|
|
107
|
+
lines.push(`- \`${pattern}\``);
|
|
108
|
+
}
|
|
109
|
+
lines.push('');
|
|
110
|
+
if (layer.dependsOn.length > 0) {
|
|
111
|
+
lines.push('**Can depend on:**');
|
|
112
|
+
for (const dep of layer.dependsOn) {
|
|
113
|
+
lines.push(`- ${dep}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
lines.push('**Dependencies:** None (leaf layer)');
|
|
118
|
+
}
|
|
119
|
+
lines.push('');
|
|
120
|
+
}
|
|
121
|
+
return lines.join('\n');
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Format anti-patterns section
|
|
125
|
+
*/
|
|
126
|
+
formatAntiPatterns(constraints) {
|
|
127
|
+
const lines = ['## Anti-patterns (Blocked)\n'];
|
|
128
|
+
lines.push('These code patterns are considered anti-patterns and should be avoided. ' +
|
|
129
|
+
'Anvil will flag them during code review.\n');
|
|
130
|
+
// Group by category
|
|
131
|
+
const byCategory = new Map();
|
|
132
|
+
for (const pattern of constraints.antiPatterns) {
|
|
133
|
+
const category = pattern.category;
|
|
134
|
+
if (!byCategory.has(category)) {
|
|
135
|
+
byCategory.set(category, []);
|
|
136
|
+
}
|
|
137
|
+
byCategory.get(category).push(pattern);
|
|
138
|
+
}
|
|
139
|
+
// Format each category
|
|
140
|
+
for (const [category, patterns] of byCategory) {
|
|
141
|
+
lines.push(`### ${this.formatCategoryName(category)}\n`);
|
|
142
|
+
for (const pattern of patterns) {
|
|
143
|
+
const severityEmoji = this.getSeverityEmoji(pattern.severity);
|
|
144
|
+
lines.push(`#### ${severityEmoji} ${pattern.name} (\`${pattern.id}\`)\n`);
|
|
145
|
+
lines.push(`**Why it's problematic:** ${pattern.explanation}\n`);
|
|
146
|
+
lines.push(`**What to do instead:** ${pattern.suggestion}\n`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return lines.join('\n');
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Format conventions section
|
|
153
|
+
*/
|
|
154
|
+
formatConventions(constraints) {
|
|
155
|
+
const lines = ['## Conventions\n'];
|
|
156
|
+
lines.push('These conventions should be followed throughout the codebase for consistency and maintainability.\n');
|
|
157
|
+
for (const convention of constraints.conventions) {
|
|
158
|
+
lines.push(`### ${this.formatCategoryName(convention.category)}\n`);
|
|
159
|
+
lines.push(`${convention.description}\n`);
|
|
160
|
+
if (convention.examples && convention.examples.length > 0) {
|
|
161
|
+
lines.push('**Examples:**');
|
|
162
|
+
for (const example of convention.examples) {
|
|
163
|
+
lines.push(`- ${example}`);
|
|
164
|
+
}
|
|
165
|
+
lines.push('');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return lines.join('\n');
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Format active suppressions section
|
|
172
|
+
*/
|
|
173
|
+
formatSuppressions(constraints) {
|
|
174
|
+
const lines = ['## Active Suppressions\n'];
|
|
175
|
+
lines.push('These patterns are intentionally suppressed in specific locations. ' +
|
|
176
|
+
'Do not flag or attempt to fix these.\n');
|
|
177
|
+
// Group by pattern ID
|
|
178
|
+
const byPattern = new Map();
|
|
179
|
+
for (const suppression of constraints.suppressions) {
|
|
180
|
+
if (!byPattern.has(suppression.patternId)) {
|
|
181
|
+
byPattern.set(suppression.patternId, []);
|
|
182
|
+
}
|
|
183
|
+
byPattern.get(suppression.patternId).push(suppression);
|
|
184
|
+
}
|
|
185
|
+
for (const [patternId, suppressions] of byPattern) {
|
|
186
|
+
lines.push(`### \`${patternId}\`\n`);
|
|
187
|
+
for (const suppression of suppressions) {
|
|
188
|
+
lines.push(`- **\`${suppression.file}\`** (${suppression.scope})`);
|
|
189
|
+
lines.push(` - Reason: ${suppression.reason}`);
|
|
190
|
+
if (suppression.expiresAt) {
|
|
191
|
+
const expiresDate = new Date(suppression.expiresAt);
|
|
192
|
+
const expiresValue = Number.isNaN(expiresDate.getTime())
|
|
193
|
+
? String(suppression.expiresAt)
|
|
194
|
+
: expiresDate.toISOString().slice(0, 10);
|
|
195
|
+
lines.push(` - Expires: ${expiresValue}`);
|
|
196
|
+
}
|
|
197
|
+
lines.push('');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return lines.join('\n');
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Get emoji for severity level
|
|
204
|
+
*/
|
|
205
|
+
getSeverityEmoji(severity) {
|
|
206
|
+
switch (severity) {
|
|
207
|
+
case 'error':
|
|
208
|
+
return '🚫';
|
|
209
|
+
case 'warning':
|
|
210
|
+
return '⚠️';
|
|
211
|
+
case 'info':
|
|
212
|
+
return 'ℹ️';
|
|
213
|
+
default:
|
|
214
|
+
return '•';
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Format category name for display
|
|
219
|
+
*/
|
|
220
|
+
formatCategoryName(category) {
|
|
221
|
+
return category
|
|
222
|
+
.split('-')
|
|
223
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
224
|
+
.join(' ');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// =============================================================================
|
|
228
|
+
// Convenience Functions
|
|
229
|
+
// =============================================================================
|
|
230
|
+
/**
|
|
231
|
+
* Format constraints as llms.txt with default options
|
|
232
|
+
*
|
|
233
|
+
* @param constraints - Constraints to format
|
|
234
|
+
* @returns llms.txt markdown string
|
|
235
|
+
*/
|
|
236
|
+
export function formatAsLlmsTxt(constraints) {
|
|
237
|
+
const formatter = new LlmsTxtFormatter();
|
|
238
|
+
return formatter.format(constraints);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Format constraints as llms.txt without metadata
|
|
242
|
+
*
|
|
243
|
+
* @param constraints - Constraints to format
|
|
244
|
+
* @returns llms.txt markdown string
|
|
245
|
+
*/
|
|
246
|
+
export function formatAsLlmsTxtWithoutMetadata(constraints) {
|
|
247
|
+
const formatter = new LlmsTxtFormatter({ includeMetadata: false });
|
|
248
|
+
return formatter.format(constraints);
|
|
249
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats Anvil constraints as Model Context Protocol (MCP) compatible resources.
|
|
5
|
+
*
|
|
6
|
+
* MCP is a protocol for exposing contextual information to AI models during generation.
|
|
7
|
+
* See: https://modelcontextprotocol.io/
|
|
8
|
+
*
|
|
9
|
+
* @module export/formatters/mcp-resource-formatter
|
|
10
|
+
*/
|
|
11
|
+
import type { Constraints } from '../constraint-collector.js';
|
|
12
|
+
/**
|
|
13
|
+
* MCP resource representation of constraints
|
|
14
|
+
*/
|
|
15
|
+
export interface McpResource {
|
|
16
|
+
/** Resource URI (e.g., anvil://constraints) */
|
|
17
|
+
uri: string;
|
|
18
|
+
/** Resource name */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Resource description */
|
|
21
|
+
description: string;
|
|
22
|
+
/** MIME type */
|
|
23
|
+
mimeType: string;
|
|
24
|
+
/** Resource contents */
|
|
25
|
+
contents: McpResourceContents;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Contents of an MCP resource
|
|
29
|
+
*/
|
|
30
|
+
export interface McpResourceContents {
|
|
31
|
+
/** Architecture boundaries */
|
|
32
|
+
boundaries?: McpBoundary[];
|
|
33
|
+
/** Layer definitions */
|
|
34
|
+
layers?: McpLayer[];
|
|
35
|
+
/** Anti-pattern rules */
|
|
36
|
+
antiPatterns?: McpAntiPattern[];
|
|
37
|
+
/** Project conventions */
|
|
38
|
+
conventions?: McpConvention[];
|
|
39
|
+
/** Active suppression policies */
|
|
40
|
+
suppressions?: McpSuppression[];
|
|
41
|
+
/** Metadata */
|
|
42
|
+
metadata: {
|
|
43
|
+
/** When resource was generated */
|
|
44
|
+
generatedAt: string;
|
|
45
|
+
/** Workspace root */
|
|
46
|
+
workspaceRoot: string;
|
|
47
|
+
/** Whether baseline exists */
|
|
48
|
+
hasBaseline: boolean;
|
|
49
|
+
/** Schema version */
|
|
50
|
+
version: string;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* MCP representation of a boundary
|
|
55
|
+
*/
|
|
56
|
+
export interface McpBoundary {
|
|
57
|
+
/** Boundary identifier */
|
|
58
|
+
id: string;
|
|
59
|
+
/** Boundary name */
|
|
60
|
+
name: string;
|
|
61
|
+
/** Source layer */
|
|
62
|
+
from: string;
|
|
63
|
+
/** Target layer */
|
|
64
|
+
to: string;
|
|
65
|
+
/** Violation message */
|
|
66
|
+
message: string;
|
|
67
|
+
/** Severity level */
|
|
68
|
+
severity: 'error' | 'warning' | 'info';
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* MCP representation of a layer
|
|
72
|
+
*/
|
|
73
|
+
export interface McpLayer {
|
|
74
|
+
/** Layer name */
|
|
75
|
+
name: string;
|
|
76
|
+
/** File patterns */
|
|
77
|
+
patterns: string[];
|
|
78
|
+
/** Dependencies */
|
|
79
|
+
dependsOn: string[];
|
|
80
|
+
/** Description */
|
|
81
|
+
description?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* MCP representation of an anti-pattern
|
|
85
|
+
*/
|
|
86
|
+
export interface McpAntiPattern {
|
|
87
|
+
/** Pattern ID */
|
|
88
|
+
id: string;
|
|
89
|
+
/** Pattern name */
|
|
90
|
+
name: string;
|
|
91
|
+
/** Pattern category */
|
|
92
|
+
category: string;
|
|
93
|
+
/** Why it's problematic */
|
|
94
|
+
explanation: string;
|
|
95
|
+
/** What to do instead */
|
|
96
|
+
suggestion: string;
|
|
97
|
+
/** Severity level */
|
|
98
|
+
severity: 'error' | 'warning' | 'info';
|
|
99
|
+
/** Whether enabled */
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* MCP representation of a convention
|
|
104
|
+
*/
|
|
105
|
+
export interface McpConvention {
|
|
106
|
+
/** Convention category */
|
|
107
|
+
category: string;
|
|
108
|
+
/** Description */
|
|
109
|
+
description: string;
|
|
110
|
+
/** Examples */
|
|
111
|
+
examples?: string[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* MCP representation of a suppression
|
|
115
|
+
*/
|
|
116
|
+
export interface McpSuppression {
|
|
117
|
+
/** Pattern ID being suppressed */
|
|
118
|
+
patternId: string;
|
|
119
|
+
/** File path */
|
|
120
|
+
file: string;
|
|
121
|
+
/** Suppression scope */
|
|
122
|
+
scope: string;
|
|
123
|
+
/** Reason for suppression */
|
|
124
|
+
reason: string;
|
|
125
|
+
/** Expiry date */
|
|
126
|
+
expiresAt?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Configuration for MCP resource formatting
|
|
130
|
+
*/
|
|
131
|
+
export interface McpResourceFormatterOptions {
|
|
132
|
+
/** Base URI for resources */
|
|
133
|
+
baseUri?: string;
|
|
134
|
+
/** Include boundaries */
|
|
135
|
+
includeBoundaries?: boolean;
|
|
136
|
+
/** Include layers */
|
|
137
|
+
includeLayers?: boolean;
|
|
138
|
+
/** Include anti-patterns */
|
|
139
|
+
includeAntiPatterns?: boolean;
|
|
140
|
+
/** Include conventions */
|
|
141
|
+
includeConventions?: boolean;
|
|
142
|
+
/** Include active suppressions */
|
|
143
|
+
includeSuppressions?: boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Formats constraints as MCP-compatible resources
|
|
147
|
+
*/
|
|
148
|
+
export declare class McpResourceFormatter {
|
|
149
|
+
private readonly options;
|
|
150
|
+
constructor(options?: McpResourceFormatterOptions);
|
|
151
|
+
/**
|
|
152
|
+
* Format constraints as MCP resource
|
|
153
|
+
*
|
|
154
|
+
* @param constraints - Constraints to format
|
|
155
|
+
* @returns MCP resource object
|
|
156
|
+
*/
|
|
157
|
+
format(constraints: Constraints): McpResource;
|
|
158
|
+
/**
|
|
159
|
+
* Format constraints as JSON string
|
|
160
|
+
*
|
|
161
|
+
* @param constraints - Constraints to format
|
|
162
|
+
* @param pretty - Whether to pretty-print JSON
|
|
163
|
+
* @returns JSON string
|
|
164
|
+
*/
|
|
165
|
+
formatAsJson(constraints: Constraints, pretty?: boolean): string;
|
|
166
|
+
/**
|
|
167
|
+
* Format resource contents
|
|
168
|
+
*/
|
|
169
|
+
private formatContents;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Format constraints as MCP resource with default options
|
|
173
|
+
*
|
|
174
|
+
* @param constraints - Constraints to format
|
|
175
|
+
* @returns MCP resource object
|
|
176
|
+
*/
|
|
177
|
+
export declare function formatAsMcpResource(constraints: Constraints): McpResource;
|
|
178
|
+
/**
|
|
179
|
+
* Format constraints as MCP resource JSON
|
|
180
|
+
*
|
|
181
|
+
* @param constraints - Constraints to format
|
|
182
|
+
* @param pretty - Whether to pretty-print JSON
|
|
183
|
+
* @returns JSON string
|
|
184
|
+
*/
|
|
185
|
+
export declare function formatAsMcpResourceJson(constraints: Constraints, pretty?: boolean): string;
|
|
186
|
+
//# sourceMappingURL=mcp-resource-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-resource-formatter.d.ts","sourceRoot":"","sources":["../../../src/export/formatters/mcp-resource-formatter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats Anvil constraints as Model Context Protocol (MCP) compatible resources.
|
|
5
|
+
*
|
|
6
|
+
* MCP is a protocol for exposing contextual information to AI models during generation.
|
|
7
|
+
* See: https://modelcontextprotocol.io/
|
|
8
|
+
*
|
|
9
|
+
* @module export/formatters/mcp-resource-formatter
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// MCP Resource Formatter
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Formats constraints as MCP-compatible resources
|
|
16
|
+
*/
|
|
17
|
+
export class McpResourceFormatter {
|
|
18
|
+
options;
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this.options = {
|
|
21
|
+
baseUri: 'anvil://constraints',
|
|
22
|
+
includeBoundaries: true,
|
|
23
|
+
includeLayers: true,
|
|
24
|
+
includeAntiPatterns: true,
|
|
25
|
+
includeConventions: true,
|
|
26
|
+
includeSuppressions: true,
|
|
27
|
+
...options,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Format constraints as MCP resource
|
|
32
|
+
*
|
|
33
|
+
* @param constraints - Constraints to format
|
|
34
|
+
* @returns MCP resource object
|
|
35
|
+
*/
|
|
36
|
+
format(constraints) {
|
|
37
|
+
return {
|
|
38
|
+
uri: this.options.baseUri,
|
|
39
|
+
name: 'Anvil Architecture Constraints',
|
|
40
|
+
description: 'Architecture rules, anti-patterns, and conventions for this codebase',
|
|
41
|
+
mimeType: 'application/json',
|
|
42
|
+
contents: this.formatContents(constraints),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Format constraints as JSON string
|
|
47
|
+
*
|
|
48
|
+
* @param constraints - Constraints to format
|
|
49
|
+
* @param pretty - Whether to pretty-print JSON
|
|
50
|
+
* @returns JSON string
|
|
51
|
+
*/
|
|
52
|
+
formatAsJson(constraints, pretty = true) {
|
|
53
|
+
const resource = this.format(constraints);
|
|
54
|
+
return JSON.stringify(resource, null, pretty ? 2 : 0);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Format resource contents
|
|
58
|
+
*/
|
|
59
|
+
formatContents(constraints) {
|
|
60
|
+
const contents = {
|
|
61
|
+
metadata: {
|
|
62
|
+
generatedAt: new Date().toISOString(),
|
|
63
|
+
workspaceRoot: constraints.metadata.workspaceRoot,
|
|
64
|
+
hasBaseline: constraints.metadata.hasBaseline,
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
if (this.options.includeBoundaries && constraints.boundaries.length > 0) {
|
|
69
|
+
contents.boundaries = constraints.boundaries.map((boundary, index) => ({
|
|
70
|
+
id: `boundary-${index + 1}`,
|
|
71
|
+
name: boundary.name,
|
|
72
|
+
from: boundary.from,
|
|
73
|
+
to: boundary.to,
|
|
74
|
+
message: boundary.message,
|
|
75
|
+
severity: boundary.severity,
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
if (this.options.includeLayers && constraints.layers.length > 0) {
|
|
79
|
+
contents.layers = constraints.layers.map((layer) => ({
|
|
80
|
+
name: layer.name,
|
|
81
|
+
patterns: layer.patterns,
|
|
82
|
+
dependsOn: layer.dependsOn,
|
|
83
|
+
description: layer.description,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
if (this.options.includeAntiPatterns && constraints.antiPatterns.length > 0) {
|
|
87
|
+
contents.antiPatterns = constraints.antiPatterns.map((pattern) => ({
|
|
88
|
+
id: pattern.id,
|
|
89
|
+
name: pattern.name,
|
|
90
|
+
category: pattern.category,
|
|
91
|
+
explanation: pattern.explanation,
|
|
92
|
+
suggestion: pattern.suggestion,
|
|
93
|
+
severity: pattern.severity,
|
|
94
|
+
enabled: pattern.enabled,
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
if (this.options.includeConventions && constraints.conventions.length > 0) {
|
|
98
|
+
contents.conventions = constraints.conventions.map((convention) => ({
|
|
99
|
+
category: convention.category,
|
|
100
|
+
description: convention.description,
|
|
101
|
+
examples: convention.examples,
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
if (this.options.includeSuppressions && constraints.suppressions.length > 0) {
|
|
105
|
+
contents.suppressions = constraints.suppressions.map((suppression) => ({
|
|
106
|
+
patternId: suppression.patternId,
|
|
107
|
+
file: suppression.file,
|
|
108
|
+
scope: suppression.scope,
|
|
109
|
+
reason: suppression.reason,
|
|
110
|
+
expiresAt: suppression.expiresAt,
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
return contents;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// =============================================================================
|
|
117
|
+
// Convenience Functions
|
|
118
|
+
// =============================================================================
|
|
119
|
+
/**
|
|
120
|
+
* Format constraints as MCP resource with default options
|
|
121
|
+
*
|
|
122
|
+
* @param constraints - Constraints to format
|
|
123
|
+
* @returns MCP resource object
|
|
124
|
+
*/
|
|
125
|
+
export function formatAsMcpResource(constraints) {
|
|
126
|
+
const formatter = new McpResourceFormatter();
|
|
127
|
+
return formatter.format(constraints);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Format constraints as MCP resource JSON
|
|
131
|
+
*
|
|
132
|
+
* @param constraints - Constraints to format
|
|
133
|
+
* @param pretty - Whether to pretty-print JSON
|
|
134
|
+
* @returns JSON string
|
|
135
|
+
*/
|
|
136
|
+
export function formatAsMcpResourceJson(constraints, pretty = true) {
|
|
137
|
+
const formatter = new McpResourceFormatter();
|
|
138
|
+
return formatter.formatAsJson(constraints, pretty);
|
|
139
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Fragment Formatter
|
|
3
|
+
*
|
|
4
|
+
* Formats Anvil constraints as copy-paste system prompt text for manual
|
|
5
|
+
* AI tool configuration. Optimised for Claude, ChatGPT, and similar tools.
|
|
6
|
+
*
|
|
7
|
+
* @module export/formatters/prompt-formatter
|
|
8
|
+
*/
|
|
9
|
+
import type { Constraints } from '../constraint-collector.js';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for prompt formatting
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptFormatterOptions {
|
|
14
|
+
/** Include boundaries section */
|
|
15
|
+
includeBoundaries?: boolean;
|
|
16
|
+
/** Include layers section */
|
|
17
|
+
includeLayers?: boolean;
|
|
18
|
+
/** Include anti-patterns section */
|
|
19
|
+
includeAntiPatterns?: boolean;
|
|
20
|
+
/** Include conventions section */
|
|
21
|
+
includeConventions?: boolean;
|
|
22
|
+
/** Include active suppressions section */
|
|
23
|
+
includeSuppressions?: boolean;
|
|
24
|
+
/** Use concise format (shorter, less detail) */
|
|
25
|
+
concise?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Formats constraints as system prompt text
|
|
29
|
+
*/
|
|
30
|
+
export declare class PromptFormatter {
|
|
31
|
+
private readonly options;
|
|
32
|
+
constructor(options?: PromptFormatterOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Format constraints as prompt text
|
|
35
|
+
*
|
|
36
|
+
* @param constraints - Constraints to format
|
|
37
|
+
* @returns System prompt text
|
|
38
|
+
*/
|
|
39
|
+
format(constraints: Constraints): string;
|
|
40
|
+
/**
|
|
41
|
+
* Format opening instruction
|
|
42
|
+
*/
|
|
43
|
+
private formatOpening;
|
|
44
|
+
/**
|
|
45
|
+
* Format architecture boundaries section
|
|
46
|
+
*/
|
|
47
|
+
private formatBoundaries;
|
|
48
|
+
/**
|
|
49
|
+
* Format layer definitions section
|
|
50
|
+
*/
|
|
51
|
+
private formatLayers;
|
|
52
|
+
/**
|
|
53
|
+
* Format anti-patterns section
|
|
54
|
+
*/
|
|
55
|
+
private formatAntiPatterns;
|
|
56
|
+
/**
|
|
57
|
+
* Format conventions section
|
|
58
|
+
*/
|
|
59
|
+
private formatConventions;
|
|
60
|
+
/**
|
|
61
|
+
* Format active suppressions section
|
|
62
|
+
*/
|
|
63
|
+
private formatSuppressions;
|
|
64
|
+
/**
|
|
65
|
+
* Format category name for display
|
|
66
|
+
*/
|
|
67
|
+
private formatCategoryName;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Format constraints as prompt fragment with default options
|
|
71
|
+
*
|
|
72
|
+
* @param constraints - Constraints to format
|
|
73
|
+
* @returns Prompt text
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatAsPrompt(constraints: Constraints): string;
|
|
76
|
+
/**
|
|
77
|
+
* Format constraints as concise prompt fragment
|
|
78
|
+
*
|
|
79
|
+
* @param constraints - Constraints to format
|
|
80
|
+
* @returns Concise prompt text
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatAsConcisePrompt(constraints: Constraints): string;
|
|
83
|
+
//# sourceMappingURL=prompt-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-formatter.d.ts","sourceRoot":"","sources":["../../../src/export/formatters/prompt-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM9D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,6BAA6B;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kCAAkC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;gBAE/C,OAAO,GAAE,sBAA2B;IAYhD;;;;;OAKG;IACH,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM;IAkCxC;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwBxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAiCpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsC1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA0C1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAM3B;AAMD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAG/D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAGtE"}
|