@mytechtoday/augment-extensions 1.3.1 → 1.5.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 +105 -6
- package/augment-extensions/coding-standards/c/CHANGELOG.md +55 -0
- package/augment-extensions/coding-standards/c/LICENSE +22 -0
- package/augment-extensions/coding-standards/c/README.md +167 -0
- package/augment-extensions/coding-standards/c/config/defaults.json +26 -0
- package/augment-extensions/coding-standards/c/config/examples/embedded.yaml +25 -0
- package/augment-extensions/coding-standards/c/config/examples/systems.json +31 -0
- package/augment-extensions/coding-standards/c/config/schema.json +244 -0
- package/augment-extensions/coding-standards/c/docs/API.md +613 -0
- package/augment-extensions/coding-standards/c/docs/CONFIGURATION.md +259 -0
- package/augment-extensions/coding-standards/c/docs/USER_GUIDE.md +567 -0
- package/augment-extensions/coding-standards/c/examples/drivers/Makefile +33 -0
- package/augment-extensions/coding-standards/c/examples/drivers/README.md +192 -0
- package/augment-extensions/coding-standards/c/examples/drivers/dma-example.c +224 -0
- package/augment-extensions/coding-standards/c/examples/drivers/example.dts +64 -0
- package/augment-extensions/coding-standards/c/examples/drivers/platform-driver.c +174 -0
- package/augment-extensions/coding-standards/c/examples/embedded/README.md +167 -0
- package/augment-extensions/coding-standards/c/examples/embedded/gpio-control.c +172 -0
- package/augment-extensions/coding-standards/c/examples/embedded/timer-isr.c +198 -0
- package/augment-extensions/coding-standards/c/examples/embedded/uart-communication.c +212 -0
- package/augment-extensions/coding-standards/c/examples/kernel/Makefile +82 -0
- package/augment-extensions/coding-standards/c/examples/kernel/README.md +168 -0
- package/augment-extensions/coding-standards/c/examples/kernel/char-device.c +198 -0
- package/augment-extensions/coding-standards/c/examples/kernel/proc-file.c +131 -0
- package/augment-extensions/coding-standards/c/examples/kernel/simple-module.c +111 -0
- package/augment-extensions/coding-standards/c/examples/legacy/Makefile +62 -0
- package/augment-extensions/coding-standards/c/examples/legacy/README.md +255 -0
- package/augment-extensions/coding-standards/c/examples/legacy/c89-to-c11-migration.c +268 -0
- package/augment-extensions/coding-standards/c/examples/legacy/compatibility-layer.c +239 -0
- package/augment-extensions/coding-standards/c/examples/networking/Makefile +35 -0
- package/augment-extensions/coding-standards/c/examples/networking/README.md +207 -0
- package/augment-extensions/coding-standards/c/examples/networking/protocol-parser.c +270 -0
- package/augment-extensions/coding-standards/c/examples/networking/tcp-server.c +197 -0
- package/augment-extensions/coding-standards/c/examples/networking/udp-multicast.c +220 -0
- package/augment-extensions/coding-standards/c/examples/realtime/Makefile +53 -0
- package/augment-extensions/coding-standards/c/examples/realtime/README.md +199 -0
- package/augment-extensions/coding-standards/c/examples/realtime/deadline-monitoring.c +260 -0
- package/augment-extensions/coding-standards/c/examples/realtime/priority-scheduling.c +258 -0
- package/augment-extensions/coding-standards/c/examples/systems/Makefile +34 -0
- package/augment-extensions/coding-standards/c/examples/systems/README.md +123 -0
- package/augment-extensions/coding-standards/c/examples/systems/ipc-pipes.c +181 -0
- package/augment-extensions/coding-standards/c/examples/systems/process-management.c +153 -0
- package/augment-extensions/coding-standards/c/examples/systems/signal-handling.c +162 -0
- package/augment-extensions/coding-standards/c/module.json +149 -0
- package/augment-extensions/coding-standards/c/rules/categories/drivers.md +635 -0
- package/augment-extensions/coding-standards/c/rules/categories/embedded.md +510 -0
- package/augment-extensions/coding-standards/c/rules/categories/kernel.md +653 -0
- package/augment-extensions/coding-standards/c/rules/categories/legacy.md +526 -0
- package/augment-extensions/coding-standards/c/rules/categories/networking.md +735 -0
- package/augment-extensions/coding-standards/c/rules/categories/realtime.md +631 -0
- package/augment-extensions/coding-standards/c/rules/categories/systems.md +586 -0
- package/augment-extensions/coding-standards/c/rules/universal/const-correctness.md +275 -0
- package/augment-extensions/coding-standards/c/rules/universal/documentation.md +251 -0
- package/augment-extensions/coding-standards/c/rules/universal/error-handling.md +250 -0
- package/augment-extensions/coding-standards/c/rules/universal/header-guards.md +254 -0
- package/augment-extensions/coding-standards/c/rules/universal/memory-safety.md +233 -0
- package/augment-extensions/coding-standards/c/rules/universal/naming.md +146 -0
- package/augment-extensions/coding-standards/c/src/conflict-detector.ts +461 -0
- package/augment-extensions/coding-standards/c/src/prompt-generator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-evaluator.ts +307 -0
- package/augment-extensions/coding-standards/c/src/rule-override.ts +427 -0
- package/augment-extensions/coding-standards/c/src/template-engine.ts +217 -0
- package/augment-extensions/coding-standards/c/templates/prompts/drivers.txt +191 -0
- package/augment-extensions/coding-standards/c/templates/prompts/embedded.txt +164 -0
- package/augment-extensions/coding-standards/c/templates/prompts/kernel.txt +175 -0
- package/augment-extensions/coding-standards/c/templates/prompts/legacy.txt +280 -0
- package/augment-extensions/coding-standards/c/templates/prompts/networking.txt +259 -0
- package/augment-extensions/coding-standards/c/templates/prompts/realtime.txt +219 -0
- package/augment-extensions/coding-standards/c/templates/prompts/systems.txt +147 -0
- package/augment-extensions/coding-standards/c/tests/integration/category-specific.test.ts +356 -0
- package/augment-extensions/coding-standards/c/tests/integration/end-to-end-workflow.test.ts +377 -0
- package/augment-extensions/coding-standards/c/tests/performance/benchmarks.test.ts +407 -0
- package/augment-extensions/coding-standards/c/tests/unit/config-manager.test.ts +345 -0
- package/augment-extensions/coding-standards/c/tests/unit/conflict-detector.test.ts +294 -0
- package/augment-extensions/coding-standards/c/tests/unit/prompt-generator.test.ts +174 -0
- package/augment-extensions/coding-standards/c/tests/unit/registry.test.ts +313 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-evaluator.test.ts +318 -0
- package/augment-extensions/coding-standards/c/tests/unit/rule-override.test.ts +326 -0
- package/augment-extensions/coding-standards/c/tests/unit/template-engine.test.ts +314 -0
- package/augment-extensions/coding-standards/go/CHARACTER-COUNT-REPORT.md +135 -0
- package/augment-extensions/coding-standards/go/PHASE1-COMPLETION.md +146 -0
- package/augment-extensions/coding-standards/go/PHASE4-COMPLETION.md +184 -0
- package/augment-extensions/coding-standards/go/README.md +200 -0
- package/augment-extensions/coding-standards/go/VALIDATION-CHECKLIST.md +154 -0
- package/augment-extensions/coding-standards/go/config/examples/example-cli.json +15 -0
- package/augment-extensions/coding-standards/go/config/examples/example-microservices.json +21 -0
- package/augment-extensions/coding-standards/go/config/examples/example-multi-category.yaml +24 -0
- package/augment-extensions/coding-standards/go/config/examples/example-web.json +15 -0
- package/augment-extensions/coding-standards/go/config/schema.json +110 -0
- package/augment-extensions/coding-standards/go/docs/CATEGORIES.md +221 -0
- package/augment-extensions/coding-standards/go/docs/CONFIGURATION.md +198 -0
- package/augment-extensions/coding-standards/go/docs/TROUBLESHOOTING.md +285 -0
- package/augment-extensions/coding-standards/go/examples/cli/cobra-app.go +287 -0
- package/augment-extensions/coding-standards/go/examples/cloud-native-app.go +217 -0
- package/augment-extensions/coding-standards/go/examples/devops-tool.go +250 -0
- package/augment-extensions/coding-standards/go/examples/distributed-system.go +247 -0
- package/augment-extensions/coding-standards/go/examples/microservices/grpc-service.go +253 -0
- package/augment-extensions/coding-standards/go/examples/rest-api.go +270 -0
- package/augment-extensions/coding-standards/go/examples/web/http-server.go +224 -0
- package/augment-extensions/coding-standards/go/module.json +139 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/api-versioning.md +149 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rate-limiting.md +209 -0
- package/augment-extensions/coding-standards/go/rules/categories/api-development/rest-api-design.md +183 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/cloud-config.md +193 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/health-checks.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/cloud-native/kubernetes.md +180 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/automation.md +179 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/ci-cd-integration.md +147 -0
- package/augment-extensions/coding-standards/go/rules/categories/devops-tooling/infrastructure-as-code.md +231 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/caching.md +150 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/consensus.md +187 -0
- package/augment-extensions/coding-standards/go/rules/categories/distributed-systems/event-sourcing.md +246 -0
- package/augment-extensions/coding-standards/go/rules/cli/command-parsing.md +264 -0
- package/augment-extensions/coding-standards/go/rules/cli/configuration.md +268 -0
- package/augment-extensions/coding-standards/go/rules/cli/cross-platform.md +324 -0
- package/augment-extensions/coding-standards/go/rules/microservices/distributed-tracing.md +253 -0
- package/augment-extensions/coding-standards/go/rules/microservices/grpc.md +257 -0
- package/augment-extensions/coding-standards/go/rules/microservices/metrics.md +278 -0
- package/augment-extensions/coding-standards/go/rules/microservices/service-discovery.md +249 -0
- package/augment-extensions/coding-standards/go/rules/universal/code-organization.md +221 -0
- package/augment-extensions/coding-standards/go/rules/universal/documentation.md +269 -0
- package/augment-extensions/coding-standards/go/rules/universal/performance.md +323 -0
- package/augment-extensions/coding-standards/go/rules/universal/testing.md +162 -0
- package/augment-extensions/coding-standards/go/rules/web/graceful-shutdown.md +249 -0
- package/augment-extensions/coding-standards/go/rules/web/http-handlers.md +164 -0
- package/augment-extensions/coding-standards/go/rules/web/middleware.md +234 -0
- package/augment-extensions/coding-standards/go/rules/web/routing.md +251 -0
- package/augment-extensions/coding-standards/go/templates/prompts/api.md +160 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cli.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/cloud-native.md +121 -0
- package/augment-extensions/coding-standards/go/templates/prompts/devops.md +146 -0
- package/augment-extensions/coding-standards/go/templates/prompts/distributed.md +133 -0
- package/augment-extensions/coding-standards/go/templates/prompts/microservices.md +225 -0
- package/augment-extensions/coding-standards/go/templates/prompts/web.md +181 -0
- package/augment-extensions/coding-standards/go/tests/integration/module-integration.test.ts +164 -0
- package/augment-extensions/coding-standards/go/tests/unit/category-selection.test.ts +147 -0
- package/augment-extensions/coding-standards/go/tests/unit/module-structure.test.ts +154 -0
- package/augment-extensions/coding-standards/go/tests/validate-character-count.ps1 +13 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.ps1 +148 -0
- package/augment-extensions/coding-standards/go/tests/validate-examples.sh +135 -0
- package/cli/dist/analysis/ast-parser.d.ts +47 -0
- package/cli/dist/analysis/ast-parser.d.ts.map +1 -0
- package/cli/dist/analysis/ast-parser.js +161 -0
- package/cli/dist/analysis/ast-parser.js.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts +27 -0
- package/cli/dist/analysis/complexity-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/complexity-analyzer.js +189 -0
- package/cli/dist/analysis/complexity-analyzer.js.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts +23 -0
- package/cli/dist/analysis/dependency-analyzer.d.ts.map +1 -0
- package/cli/dist/analysis/dependency-analyzer.js +237 -0
- package/cli/dist/analysis/dependency-analyzer.js.map +1 -0
- package/cli/dist/analysis/index.d.ts +9 -0
- package/cli/dist/analysis/index.d.ts.map +1 -0
- package/cli/dist/analysis/index.js +25 -0
- package/cli/dist/analysis/index.js.map +1 -0
- package/cli/dist/analysis/security-scanner.d.ts +11 -0
- package/cli/dist/analysis/security-scanner.d.ts.map +1 -0
- package/cli/dist/analysis/security-scanner.js +294 -0
- package/cli/dist/analysis/security-scanner.js.map +1 -0
- package/cli/dist/analysis/types.d.ts +151 -0
- package/cli/dist/analysis/types.d.ts.map +1 -0
- package/cli/dist/analysis/types.js +6 -0
- package/cli/dist/analysis/types.js.map +1 -0
- package/cli/dist/cli.js +24 -0
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/code-analysis.d.ts +11 -0
- package/cli/dist/commands/code-analysis.d.ts.map +1 -0
- package/cli/dist/commands/code-analysis.js +412 -0
- package/cli/dist/commands/code-analysis.js.map +1 -0
- package/modules.md +99 -3
- package/package.json +21 -2
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
# C Coding Standards - API Documentation
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
1. [ConfigurationManager](#configurationmanager)
|
|
6
|
+
2. [RuleRegistry](#ruleregistry)
|
|
7
|
+
3. [PromptGenerator](#promptgenerator)
|
|
8
|
+
4. [RuleEvaluator](#ruleevaluator)
|
|
9
|
+
5. [TemplateEngine](#templateengine)
|
|
10
|
+
6. [ConflictDetector](#conflictdetector)
|
|
11
|
+
7. [RuleOverrideSystem](#ruleoverridesystem)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ConfigurationManager
|
|
16
|
+
|
|
17
|
+
Manages configuration loading, validation, and hot-reload functionality.
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
constructor(projectRoot: string)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Parameters:**
|
|
26
|
+
- `projectRoot` - Root directory of the project
|
|
27
|
+
|
|
28
|
+
### Methods
|
|
29
|
+
|
|
30
|
+
#### load()
|
|
31
|
+
|
|
32
|
+
Loads configuration from `.augment/c-standards.json` or `.augment/c-standards.yaml`.
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
async load(): Promise<Configuration>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Returns:** Promise resolving to the loaded configuration
|
|
39
|
+
|
|
40
|
+
**Throws:** Error if configuration is invalid or cannot be parsed
|
|
41
|
+
|
|
42
|
+
**Example:**
|
|
43
|
+
```typescript
|
|
44
|
+
const configManager = new ConfigurationManager('/project/root');
|
|
45
|
+
const config = await configManager.load();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### validateConfiguration()
|
|
49
|
+
|
|
50
|
+
Validates a configuration object against the schema.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
validateConfiguration(config: Configuration): ValidationResult
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Parameters:**
|
|
57
|
+
- `config` - Configuration object to validate
|
|
58
|
+
|
|
59
|
+
**Returns:** Validation result with `valid` boolean and `errors`/`warnings` arrays
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
62
|
+
```typescript
|
|
63
|
+
const result = configManager.validateConfiguration(config);
|
|
64
|
+
if (!result.valid) {
|
|
65
|
+
console.error('Validation errors:', result.errors);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### getConfiguration()
|
|
70
|
+
|
|
71
|
+
Returns the currently loaded configuration.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
getConfiguration(): Configuration
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Returns:** Current configuration
|
|
78
|
+
|
|
79
|
+
**Throws:** Error if configuration not loaded
|
|
80
|
+
|
|
81
|
+
#### isRuleEnabled()
|
|
82
|
+
|
|
83
|
+
Checks if a specific rule is enabled.
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
isRuleEnabled(ruleId: string): boolean
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
- `ruleId` - ID of the rule to check
|
|
91
|
+
|
|
92
|
+
**Returns:** `true` if rule is enabled, `false` otherwise
|
|
93
|
+
|
|
94
|
+
#### getRuleSeverity()
|
|
95
|
+
|
|
96
|
+
Gets the severity level of a rule.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
getRuleSeverity(ruleId: string): 'ERROR' | 'WARNING'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Parameters:**
|
|
103
|
+
- `ruleId` - ID of the rule
|
|
104
|
+
|
|
105
|
+
**Returns:** Severity level ('ERROR' or 'WARNING')
|
|
106
|
+
|
|
107
|
+
#### reload()
|
|
108
|
+
|
|
109
|
+
Reloads configuration from disk and notifies watchers.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
async reload(): Promise<void>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
```typescript
|
|
117
|
+
await configManager.reload();
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### watch()
|
|
121
|
+
|
|
122
|
+
Registers a callback to be notified when configuration changes.
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
watch(callback: (config: Configuration) => void): void
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Parameters:**
|
|
129
|
+
- `callback` - Function to call when configuration changes
|
|
130
|
+
|
|
131
|
+
**Example:**
|
|
132
|
+
```typescript
|
|
133
|
+
configManager.watch((config) => {
|
|
134
|
+
console.log('Configuration updated:', config);
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### dispose()
|
|
139
|
+
|
|
140
|
+
Cleans up resources and file watchers.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
dispose(): void
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## RuleRegistry
|
|
149
|
+
|
|
150
|
+
Manages rule loading, indexing, and querying.
|
|
151
|
+
|
|
152
|
+
### Constructor
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
constructor(rulesPath: string)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Parameters:**
|
|
159
|
+
- `rulesPath` - Path to the rules directory
|
|
160
|
+
|
|
161
|
+
### Methods
|
|
162
|
+
|
|
163
|
+
#### loadRules()
|
|
164
|
+
|
|
165
|
+
Loads all rules from the rules directory.
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
async loadRules(): Promise<void>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Example:**
|
|
172
|
+
```typescript
|
|
173
|
+
const registry = new RuleRegistry('/path/to/rules');
|
|
174
|
+
await registry.loadRules();
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### getRule()
|
|
178
|
+
|
|
179
|
+
Retrieves a rule by its ID.
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
getRule(ruleId: string): Rule | undefined
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Parameters:**
|
|
186
|
+
- `ruleId` - ID of the rule to retrieve
|
|
187
|
+
|
|
188
|
+
**Returns:** Rule object or `undefined` if not found
|
|
189
|
+
|
|
190
|
+
**Example:**
|
|
191
|
+
```typescript
|
|
192
|
+
const rule = registry.getRule('universal-naming');
|
|
193
|
+
if (rule) {
|
|
194
|
+
console.log('Rule:', rule.name);
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### getRulesByCategory()
|
|
199
|
+
|
|
200
|
+
Gets all rules for a specific category.
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
getRulesByCategory(category: string): Rule[]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**Parameters:**
|
|
207
|
+
- `category` - Category name (e.g., 'systems', 'embedded', 'kernel')
|
|
208
|
+
|
|
209
|
+
**Returns:** Array of rules in the category
|
|
210
|
+
|
|
211
|
+
**Example:**
|
|
212
|
+
```typescript
|
|
213
|
+
const embeddedRules = registry.getRulesByCategory('embedded');
|
|
214
|
+
console.log(`Found ${embeddedRules.length} embedded rules`);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
#### getRulesBySeverity()
|
|
218
|
+
|
|
219
|
+
Gets all rules with a specific severity level.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
getRulesBySeverity(severity: 'ERROR' | 'WARNING'): Rule[]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Parameters:**
|
|
226
|
+
- `severity` - Severity level to filter by
|
|
227
|
+
|
|
228
|
+
**Returns:** Array of rules with the specified severity
|
|
229
|
+
|
|
230
|
+
#### getActiveRules()
|
|
231
|
+
|
|
232
|
+
Gets all currently enabled rules.
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
getActiveRules(): Rule[]
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Returns:** Array of enabled rules
|
|
239
|
+
|
|
240
|
+
#### queryRules()
|
|
241
|
+
|
|
242
|
+
Queries rules with multiple filters.
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
queryRules(filters: {
|
|
246
|
+
category?: string;
|
|
247
|
+
severity?: 'ERROR' | 'WARNING';
|
|
248
|
+
enabled?: boolean;
|
|
249
|
+
search?: string;
|
|
250
|
+
}): Rule[]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Parameters:**
|
|
254
|
+
- `filters` - Object containing filter criteria
|
|
255
|
+
|
|
256
|
+
**Returns:** Array of rules matching all filters
|
|
257
|
+
|
|
258
|
+
**Example:**
|
|
259
|
+
```typescript
|
|
260
|
+
const results = registry.queryRules({
|
|
261
|
+
category: 'embedded',
|
|
262
|
+
severity: 'ERROR',
|
|
263
|
+
enabled: true
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### setRuleEnabled()
|
|
268
|
+
|
|
269
|
+
Enables or disables a rule.
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
setRuleEnabled(ruleId: string, enabled: boolean): void
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Parameters:**
|
|
276
|
+
- `ruleId` - ID of the rule
|
|
277
|
+
- `enabled` - Whether to enable or disable the rule
|
|
278
|
+
|
|
279
|
+
#### clearCache()
|
|
280
|
+
|
|
281
|
+
Clears all cached query results.
|
|
282
|
+
|
|
283
|
+
```typescript
|
|
284
|
+
clearCache(): void
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### getAllRules()
|
|
288
|
+
|
|
289
|
+
Gets all loaded rules.
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
getAllRules(): Rule[]
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Returns:** Array of all rules
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## PromptGenerator
|
|
300
|
+
|
|
301
|
+
Generates AI prompts with context-aware rule information.
|
|
302
|
+
|
|
303
|
+
### Constructor
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
constructor(registry: RuleRegistry, configManager: ConfigurationManager)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Parameters:**
|
|
310
|
+
- `registry` - RuleRegistry instance
|
|
311
|
+
- `configManager` - ConfigurationManager instance
|
|
312
|
+
|
|
313
|
+
### Methods
|
|
314
|
+
|
|
315
|
+
#### generatePrompt()
|
|
316
|
+
|
|
317
|
+
Generates an AI prompt for code analysis.
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
async generatePrompt(context: {
|
|
321
|
+
filePath: string;
|
|
322
|
+
codeContext: string;
|
|
323
|
+
category?: string;
|
|
324
|
+
template?: string;
|
|
325
|
+
}): Promise<string>
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Parameters:**
|
|
329
|
+
- `context.filePath` - Path to the file being analyzed
|
|
330
|
+
- `context.codeContext` - Code snippet for context
|
|
331
|
+
- `context.category` - Optional category override
|
|
332
|
+
- `context.template` - Optional custom template
|
|
333
|
+
|
|
334
|
+
**Returns:** Promise resolving to the generated prompt
|
|
335
|
+
|
|
336
|
+
**Example:**
|
|
337
|
+
```typescript
|
|
338
|
+
const generator = new PromptGenerator(registry, configManager);
|
|
339
|
+
const prompt = await generator.generatePrompt({
|
|
340
|
+
filePath: '/project/embedded/sensor.c',
|
|
341
|
+
codeContext: 'volatile uint32_t* reg;'
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
#### detectCategory()
|
|
346
|
+
|
|
347
|
+
Detects the category from a file path.
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
detectCategory(filePath: string): string[]
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
**Parameters:**
|
|
354
|
+
- `filePath` - Path to analyze
|
|
355
|
+
|
|
356
|
+
**Returns:** Array of detected categories
|
|
357
|
+
|
|
358
|
+
**Example:**
|
|
359
|
+
```typescript
|
|
360
|
+
const categories = generator.detectCategory('/project/kernel/scheduler.c');
|
|
361
|
+
// Returns: ['kernel']
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## RuleEvaluator
|
|
367
|
+
|
|
368
|
+
Evaluates code against rules and reports violations.
|
|
369
|
+
|
|
370
|
+
### Constructor
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
constructor(registry: RuleRegistry, configManager: ConfigurationManager)
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Methods
|
|
377
|
+
|
|
378
|
+
#### evaluate()
|
|
379
|
+
|
|
380
|
+
Evaluates code against specified rules.
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
async evaluate(code: string, options: {
|
|
384
|
+
filePath: string;
|
|
385
|
+
rules: string[];
|
|
386
|
+
minSeverity?: 'ERROR' | 'WARNING';
|
|
387
|
+
}): Promise<Violation[]>
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**Parameters:**
|
|
391
|
+
- `code` - Code to evaluate
|
|
392
|
+
- `options.filePath` - Path to the file
|
|
393
|
+
- `options.rules` - Array of rule IDs to apply
|
|
394
|
+
- `options.minSeverity` - Optional minimum severity filter
|
|
395
|
+
|
|
396
|
+
**Returns:** Promise resolving to array of violations
|
|
397
|
+
|
|
398
|
+
**Example:**
|
|
399
|
+
```typescript
|
|
400
|
+
const evaluator = new RuleEvaluator(registry, configManager);
|
|
401
|
+
const violations = await evaluator.evaluate(code, {
|
|
402
|
+
filePath: '/project/src/main.c',
|
|
403
|
+
rules: ['universal-naming', 'universal-memory-safety']
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
#### applyRule()
|
|
408
|
+
|
|
409
|
+
Applies a single rule to code.
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
async applyRule(code: string, rule: Rule): Promise<Violation[]>
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
#### evaluateBatch()
|
|
416
|
+
|
|
417
|
+
Evaluates multiple files in batch.
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
async evaluateBatch(files: Array<{
|
|
421
|
+
path: string;
|
|
422
|
+
content: string;
|
|
423
|
+
}>, options: {
|
|
424
|
+
rules: string[];
|
|
425
|
+
}): Promise<Array<{
|
|
426
|
+
filePath: string;
|
|
427
|
+
violations: Violation[];
|
|
428
|
+
}>>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
#### generateReport()
|
|
432
|
+
|
|
433
|
+
Generates a formatted report of violations.
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
generateReport(violations: Violation[], options: {
|
|
437
|
+
format: 'text' | 'json';
|
|
438
|
+
includeSummary?: boolean;
|
|
439
|
+
}): string
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**Example:**
|
|
443
|
+
```typescript
|
|
444
|
+
const report = evaluator.generateReport(violations, {
|
|
445
|
+
format: 'json',
|
|
446
|
+
includeSummary: true
|
|
447
|
+
});
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## TemplateEngine
|
|
453
|
+
|
|
454
|
+
Renders templates with variable substitution and conditionals.
|
|
455
|
+
|
|
456
|
+
### Methods
|
|
457
|
+
|
|
458
|
+
#### render()
|
|
459
|
+
|
|
460
|
+
Renders a template with context data.
|
|
461
|
+
|
|
462
|
+
```typescript
|
|
463
|
+
render(template: string, context: Record<string, any>): string
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Example:**
|
|
467
|
+
```typescript
|
|
468
|
+
const engine = new TemplateEngine();
|
|
469
|
+
const result = engine.render('Hello {name}!', { name: 'World' });
|
|
470
|
+
// Returns: "Hello World!"
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
#### validate()
|
|
474
|
+
|
|
475
|
+
Validates template syntax.
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
validate(template: string): { valid: boolean; errors: string[] }
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### parse()
|
|
482
|
+
|
|
483
|
+
Parses template into AST.
|
|
484
|
+
|
|
485
|
+
```typescript
|
|
486
|
+
parse(template: string): TemplateAST
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
#### registerHelper()
|
|
490
|
+
|
|
491
|
+
Registers a custom helper function.
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
registerHelper(name: string, fn: Function): void
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Example:**
|
|
498
|
+
```typescript
|
|
499
|
+
engine.registerHelper('uppercase', (value: string) => value.toUpperCase());
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
## ConflictDetector
|
|
505
|
+
|
|
506
|
+
Detects and analyzes rule conflicts.
|
|
507
|
+
|
|
508
|
+
### Constructor
|
|
509
|
+
|
|
510
|
+
```typescript
|
|
511
|
+
constructor(registry: RuleRegistry)
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Methods
|
|
515
|
+
|
|
516
|
+
#### detectConflicts()
|
|
517
|
+
|
|
518
|
+
Detects all rule conflicts.
|
|
519
|
+
|
|
520
|
+
```typescript
|
|
521
|
+
async detectConflicts(): Promise<Conflict[]>
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
#### detectConflictsForRules()
|
|
525
|
+
|
|
526
|
+
Detects conflicts for specific rules.
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
async detectConflictsForRules(ruleIds: string[]): Promise<Conflict[]>
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### suggestResolution()
|
|
533
|
+
|
|
534
|
+
Suggests resolutions for a conflict.
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
suggestResolution(conflict: Conflict): Resolution[]
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
#### analyzeConflictSeverity()
|
|
541
|
+
|
|
542
|
+
Analyzes the severity of a conflict.
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
analyzeConflictSeverity(conflict: Conflict): 'HIGH' | 'MEDIUM' | 'LOW'
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## RuleOverrideSystem
|
|
551
|
+
|
|
552
|
+
Manages rule overrides and customizations.
|
|
553
|
+
|
|
554
|
+
### Constructor
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
constructor(registry: RuleRegistry, configManager: ConfigurationManager)
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### Methods
|
|
561
|
+
|
|
562
|
+
#### applyOverride()
|
|
563
|
+
|
|
564
|
+
Applies an override to a rule.
|
|
565
|
+
|
|
566
|
+
```typescript
|
|
567
|
+
applyOverride(ruleId: string, override: {
|
|
568
|
+
severity?: 'ERROR' | 'WARNING';
|
|
569
|
+
enabled?: boolean;
|
|
570
|
+
}): void
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Example:**
|
|
574
|
+
```typescript
|
|
575
|
+
const overrideSystem = new RuleOverrideSystem(registry, configManager);
|
|
576
|
+
overrideSystem.applyOverride('universal-naming', {
|
|
577
|
+
severity: 'WARNING'
|
|
578
|
+
});
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
#### removeOverride()
|
|
582
|
+
|
|
583
|
+
Removes an override and restores original values.
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
removeOverride(ruleId: string): void
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
#### getAllOverrides()
|
|
590
|
+
|
|
591
|
+
Gets all active overrides.
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
getAllOverrides(): Record<string, Override>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
#### exportOverrides()
|
|
598
|
+
|
|
599
|
+
Exports overrides to JSON or YAML.
|
|
600
|
+
|
|
601
|
+
```typescript
|
|
602
|
+
exportOverrides(format: 'json' | 'yaml'): string
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### importOverrides()
|
|
606
|
+
|
|
607
|
+
Imports overrides from JSON or YAML.
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
importOverrides(data: string, format: 'json' | 'yaml'): void
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
|