@mytechtoday/augment-extensions 1.4.0 → 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/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 +14 -2
- package/cli/dist/commands/agent.d.ts +0 -37
- package/cli/dist/commands/agent.d.ts.map +0 -1
- package/cli/dist/commands/agent.js +0 -222
- package/cli/dist/commands/agent.js.map +0 -1
- package/cli/dist/commands/beads.d.ts +0 -64
- package/cli/dist/commands/beads.d.ts.map +0 -1
- package/cli/dist/commands/beads.js +0 -377
- package/cli/dist/commands/beads.js.map +0 -1
- package/cli/dist/commands/change.d.ts +0 -54
- package/cli/dist/commands/change.d.ts.map +0 -1
- package/cli/dist/commands/change.js +0 -243
- package/cli/dist/commands/change.js.map +0 -1
- package/cli/dist/commands/clean.d.ts +0 -15
- package/cli/dist/commands/clean.d.ts.map +0 -1
- package/cli/dist/commands/clean.js +0 -63
- package/cli/dist/commands/clean.js.map +0 -1
- package/cli/dist/commands/clone.d.ts +0 -15
- package/cli/dist/commands/clone.d.ts.map +0 -1
- package/cli/dist/commands/clone.js +0 -49
- package/cli/dist/commands/clone.js.map +0 -1
- package/cli/dist/commands/config.d.ts +0 -33
- package/cli/dist/commands/config.d.ts.map +0 -1
- package/cli/dist/commands/config.js +0 -166
- package/cli/dist/commands/config.js.map +0 -1
- package/cli/dist/commands/context.d.ts +0 -38
- package/cli/dist/commands/context.d.ts.map +0 -1
- package/cli/dist/commands/context.js +0 -205
- package/cli/dist/commands/context.js.map +0 -1
- package/cli/dist/commands/create.d.ts +0 -18
- package/cli/dist/commands/create.d.ts.map +0 -1
- package/cli/dist/commands/create.js +0 -178
- package/cli/dist/commands/create.js.map +0 -1
- package/cli/dist/commands/diff.d.ts +0 -19
- package/cli/dist/commands/diff.d.ts.map +0 -1
- package/cli/dist/commands/diff.js +0 -104
- package/cli/dist/commands/diff.js.map +0 -1
- package/cli/dist/commands/doctor.d.ts +0 -14
- package/cli/dist/commands/doctor.d.ts.map +0 -1
- package/cli/dist/commands/doctor.js +0 -62
- package/cli/dist/commands/doctor.js.map +0 -1
- package/cli/dist/commands/export.d.ts +0 -28
- package/cli/dist/commands/export.d.ts.map +0 -1
- package/cli/dist/commands/export.js +0 -135
- package/cli/dist/commands/export.js.map +0 -1
- package/cli/dist/commands/import.d.ts +0 -23
- package/cli/dist/commands/import.d.ts.map +0 -1
- package/cli/dist/commands/import.js +0 -118
- package/cli/dist/commands/import.js.map +0 -1
- package/cli/dist/commands/prompt.d.ts +0 -45
- package/cli/dist/commands/prompt.d.ts.map +0 -1
- package/cli/dist/commands/prompt.js +0 -223
- package/cli/dist/commands/prompt.js.map +0 -1
- package/cli/dist/commands/spec.d.ts +0 -57
- package/cli/dist/commands/spec.d.ts.map +0 -1
- package/cli/dist/commands/spec.js +0 -279
- package/cli/dist/commands/spec.js.map +0 -1
- package/cli/dist/commands/stats.d.ts +0 -18
- package/cli/dist/commands/stats.d.ts.map +0 -1
- package/cli/dist/commands/stats.js +0 -85
- package/cli/dist/commands/stats.js.map +0 -1
- package/cli/dist/commands/task.d.ts +0 -65
- package/cli/dist/commands/task.d.ts.map +0 -1
- package/cli/dist/commands/task.js +0 -282
- package/cli/dist/commands/task.js.map +0 -1
- package/cli/dist/commands/template.d.ts +0 -17
- package/cli/dist/commands/template.d.ts.map +0 -1
- package/cli/dist/commands/template.js +0 -55
- package/cli/dist/commands/template.js.map +0 -1
- package/cli/dist/utils/agent-config.d.ts +0 -129
- package/cli/dist/utils/agent-config.d.ts.map +0 -1
- package/cli/dist/utils/agent-config.js +0 -297
- package/cli/dist/utils/agent-config.js.map +0 -1
- package/cli/dist/utils/beads-graph.d.ts +0 -17
- package/cli/dist/utils/beads-graph.d.ts.map +0 -1
- package/cli/dist/utils/beads-graph.js +0 -150
- package/cli/dist/utils/beads-graph.js.map +0 -1
- package/cli/dist/utils/beads-integration.d.ts +0 -112
- package/cli/dist/utils/beads-integration.d.ts.map +0 -1
- package/cli/dist/utils/beads-integration.js +0 -312
- package/cli/dist/utils/beads-integration.js.map +0 -1
- package/cli/dist/utils/beads-reporter.d.ts +0 -17
- package/cli/dist/utils/beads-reporter.d.ts.map +0 -1
- package/cli/dist/utils/beads-reporter.js +0 -160
- package/cli/dist/utils/beads-reporter.js.map +0 -1
- package/cli/dist/utils/cache-manager.d.ts +0 -55
- package/cli/dist/utils/cache-manager.d.ts.map +0 -1
- package/cli/dist/utils/cache-manager.js +0 -150
- package/cli/dist/utils/cache-manager.js.map +0 -1
- package/cli/dist/utils/change-manager.d.ts +0 -70
- package/cli/dist/utils/change-manager.d.ts.map +0 -1
- package/cli/dist/utils/change-manager.js +0 -412
- package/cli/dist/utils/change-manager.js.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.d.ts +0 -66
- package/cli/dist/utils/config-manager-enhanced.d.ts.map +0 -1
- package/cli/dist/utils/config-manager-enhanced.js +0 -77
- package/cli/dist/utils/config-manager-enhanced.js.map +0 -1
- package/cli/dist/utils/context-manager.d.ts +0 -96
- package/cli/dist/utils/context-manager.d.ts.map +0 -1
- package/cli/dist/utils/context-manager.js +0 -258
- package/cli/dist/utils/context-manager.js.map +0 -1
- package/cli/dist/utils/diff-engine.d.ts +0 -78
- package/cli/dist/utils/diff-engine.d.ts.map +0 -1
- package/cli/dist/utils/diff-engine.js +0 -233
- package/cli/dist/utils/diff-engine.js.map +0 -1
- package/cli/dist/utils/export-system.d.ts +0 -101
- package/cli/dist/utils/export-system.d.ts.map +0 -1
- package/cli/dist/utils/export-system.js +0 -289
- package/cli/dist/utils/export-system.js.map +0 -1
- package/cli/dist/utils/health-checker.d.ts +0 -66
- package/cli/dist/utils/health-checker.d.ts.map +0 -1
- package/cli/dist/utils/health-checker.js +0 -285
- package/cli/dist/utils/health-checker.js.map +0 -1
- package/cli/dist/utils/import-system.d.ts +0 -74
- package/cli/dist/utils/import-system.d.ts.map +0 -1
- package/cli/dist/utils/import-system.js +0 -317
- package/cli/dist/utils/import-system.js.map +0 -1
- package/cli/dist/utils/module-cloner.d.ts +0 -40
- package/cli/dist/utils/module-cloner.d.ts.map +0 -1
- package/cli/dist/utils/module-cloner.js +0 -136
- package/cli/dist/utils/module-cloner.js.map +0 -1
- package/cli/dist/utils/prompt-manager.d.ts +0 -90
- package/cli/dist/utils/prompt-manager.d.ts.map +0 -1
- package/cli/dist/utils/prompt-manager.js +0 -302
- package/cli/dist/utils/prompt-manager.js.map +0 -1
- package/cli/dist/utils/spec-manager.d.ts +0 -65
- package/cli/dist/utils/spec-manager.d.ts.map +0 -1
- package/cli/dist/utils/spec-manager.js +0 -329
- package/cli/dist/utils/spec-manager.js.map +0 -1
- package/cli/dist/utils/stats-collector.d.ts +0 -74
- package/cli/dist/utils/stats-collector.d.ts.map +0 -1
- package/cli/dist/utils/stats-collector.js +0 -164
- package/cli/dist/utils/stats-collector.js.map +0 -1
- package/cli/dist/utils/template-engine.d.ts +0 -47
- package/cli/dist/utils/template-engine.d.ts.map +0 -1
- package/cli/dist/utils/template-engine.js +0 -204
- package/cli/dist/utils/template-engine.js.map +0 -1
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Benchmarks for C Coding Standards
|
|
3
|
+
* Tests critical paths: rule loading, configuration parsing, prompt generation
|
|
4
|
+
* Target: <100ms response time for prompt generation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from 'fs/promises';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import { ConfigurationManager } from '../../src/config-manager';
|
|
10
|
+
import { RuleRegistry } from '../../src/registry';
|
|
11
|
+
import { PromptGenerator } from '../../src/prompt-generator';
|
|
12
|
+
import { RuleEvaluator } from '../../src/rule-evaluator';
|
|
13
|
+
import { Configuration } from '../../src/types';
|
|
14
|
+
|
|
15
|
+
describe('Performance Benchmarks', () => {
|
|
16
|
+
let tempDir: string;
|
|
17
|
+
let rulesPath: string;
|
|
18
|
+
let configPath: string;
|
|
19
|
+
|
|
20
|
+
beforeAll(async () => {
|
|
21
|
+
tempDir = path.join(__dirname, '../fixtures/temp-perf');
|
|
22
|
+
rulesPath = path.join(tempDir, 'rules');
|
|
23
|
+
configPath = tempDir;
|
|
24
|
+
|
|
25
|
+
await fs.mkdir(path.join(rulesPath, 'universal'), { recursive: true });
|
|
26
|
+
await fs.mkdir(path.join(rulesPath, 'categories'), { recursive: true });
|
|
27
|
+
await fs.mkdir(path.join(configPath, '.augment'), { recursive: true });
|
|
28
|
+
|
|
29
|
+
// Create comprehensive test data
|
|
30
|
+
await createBenchmarkData();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterAll(async () => {
|
|
34
|
+
try {
|
|
35
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
36
|
+
} catch (error) {
|
|
37
|
+
// Ignore cleanup errors
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
async function createBenchmarkData() {
|
|
42
|
+
// Create 6 universal rules
|
|
43
|
+
const universalRules = [
|
|
44
|
+
'naming', 'memory-safety', 'error-handling',
|
|
45
|
+
'documentation', 'header-guards', 'const-correctness'
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
for (const ruleName of universalRules) {
|
|
49
|
+
const rule = `# Rule: ${ruleName}
|
|
50
|
+
|
|
51
|
+
## Metadata
|
|
52
|
+
- **ID**: universal-${ruleName}
|
|
53
|
+
- **Category**: universal
|
|
54
|
+
- **Severity**: ERROR
|
|
55
|
+
|
|
56
|
+
## Description
|
|
57
|
+
Universal rule for ${ruleName}.
|
|
58
|
+
|
|
59
|
+
## Examples
|
|
60
|
+
|
|
61
|
+
### Good Example
|
|
62
|
+
\`\`\`c
|
|
63
|
+
// Good code
|
|
64
|
+
\`\`\`
|
|
65
|
+
`;
|
|
66
|
+
await fs.writeFile(
|
|
67
|
+
path.join(rulesPath, `universal/${ruleName}.md`),
|
|
68
|
+
rule
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Create category-specific rules (7 categories)
|
|
73
|
+
const categories = [
|
|
74
|
+
'systems', 'embedded', 'kernel', 'drivers',
|
|
75
|
+
'realtime', 'networking', 'legacy'
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
for (const category of categories) {
|
|
79
|
+
const rule = `# Rule: ${category} specific
|
|
80
|
+
|
|
81
|
+
## Metadata
|
|
82
|
+
- **ID**: ${category}-rule
|
|
83
|
+
- **Category**: ${category}
|
|
84
|
+
- **Severity**: ERROR
|
|
85
|
+
|
|
86
|
+
## Description
|
|
87
|
+
Category-specific rule for ${category}.
|
|
88
|
+
`;
|
|
89
|
+
await fs.writeFile(
|
|
90
|
+
path.join(rulesPath, `categories/${category}.md`),
|
|
91
|
+
rule
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Create configuration
|
|
96
|
+
const config: Configuration = {
|
|
97
|
+
c_standards: {
|
|
98
|
+
version: '1.0.0',
|
|
99
|
+
categories: categories,
|
|
100
|
+
c_standard: 'c11',
|
|
101
|
+
universal_rules: {
|
|
102
|
+
naming: 'enabled',
|
|
103
|
+
memory_safety: 'enabled',
|
|
104
|
+
error_handling: 'enabled',
|
|
105
|
+
documentation: 'enabled',
|
|
106
|
+
header_guards: 'enabled',
|
|
107
|
+
const_correctness: 'enabled'
|
|
108
|
+
},
|
|
109
|
+
category_overrides: {},
|
|
110
|
+
static_analysis: {
|
|
111
|
+
clang_tidy: true,
|
|
112
|
+
cppcheck: true,
|
|
113
|
+
valgrind: false
|
|
114
|
+
},
|
|
115
|
+
custom_rules: {
|
|
116
|
+
enabled: false,
|
|
117
|
+
path: ''
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
await fs.writeFile(
|
|
123
|
+
path.join(configPath, '.augment/c-standards.json'),
|
|
124
|
+
JSON.stringify(config, null, 2)
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
describe('Configuration Loading Performance', () => {
|
|
129
|
+
it('should load configuration in <50ms', async () => {
|
|
130
|
+
const configManager = new ConfigurationManager(configPath);
|
|
131
|
+
|
|
132
|
+
const startTime = performance.now();
|
|
133
|
+
await configManager.load();
|
|
134
|
+
const endTime = performance.now();
|
|
135
|
+
|
|
136
|
+
const duration = endTime - startTime;
|
|
137
|
+
console.log(`Configuration loading: ${duration.toFixed(2)}ms`);
|
|
138
|
+
|
|
139
|
+
expect(duration).toBeLessThan(50);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should parse JSON configuration in <20ms', async () => {
|
|
143
|
+
const configPath = path.join(tempDir, '.augment/c-standards.json');
|
|
144
|
+
|
|
145
|
+
const startTime = performance.now();
|
|
146
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
147
|
+
JSON.parse(content);
|
|
148
|
+
const endTime = performance.now();
|
|
149
|
+
|
|
150
|
+
const duration = endTime - startTime;
|
|
151
|
+
console.log(`JSON parsing: ${duration.toFixed(2)}ms`);
|
|
152
|
+
|
|
153
|
+
expect(duration).toBeLessThan(20);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should validate configuration in <30ms', async () => {
|
|
157
|
+
const configManager = new ConfigurationManager(configPath);
|
|
158
|
+
await configManager.load();
|
|
159
|
+
const config = configManager.getConfiguration();
|
|
160
|
+
|
|
161
|
+
const startTime = performance.now();
|
|
162
|
+
configManager.validateConfiguration(config);
|
|
163
|
+
const endTime = performance.now();
|
|
164
|
+
|
|
165
|
+
const duration = endTime - startTime;
|
|
166
|
+
console.log(`Configuration validation: ${duration.toFixed(2)}ms`);
|
|
167
|
+
|
|
168
|
+
expect(duration).toBeLessThan(30);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe('Rule Loading Performance', () => {
|
|
173
|
+
it('should load all rules in <100ms', async () => {
|
|
174
|
+
const registry = new RuleRegistry(rulesPath);
|
|
175
|
+
|
|
176
|
+
const startTime = performance.now();
|
|
177
|
+
await registry.loadRules();
|
|
178
|
+
const endTime = performance.now();
|
|
179
|
+
|
|
180
|
+
const duration = endTime - startTime;
|
|
181
|
+
const ruleCount = registry.getAllRules().length;
|
|
182
|
+
console.log(`Rule loading: ${duration.toFixed(2)}ms (${ruleCount} rules)`);
|
|
183
|
+
|
|
184
|
+
expect(duration).toBeLessThan(100);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should parse individual rule in <10ms', async () => {
|
|
188
|
+
const registry = new RuleRegistry(rulesPath);
|
|
189
|
+
await registry.loadRules();
|
|
190
|
+
|
|
191
|
+
const startTime = performance.now();
|
|
192
|
+
registry.getRule('universal-naming');
|
|
193
|
+
const endTime = performance.now();
|
|
194
|
+
|
|
195
|
+
const duration = endTime - startTime;
|
|
196
|
+
console.log(`Rule retrieval: ${duration.toFixed(2)}ms`);
|
|
197
|
+
|
|
198
|
+
expect(duration).toBeLessThan(10);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should query rules by category in <20ms', async () => {
|
|
202
|
+
const registry = new RuleRegistry(rulesPath);
|
|
203
|
+
await registry.loadRules();
|
|
204
|
+
|
|
205
|
+
const startTime = performance.now();
|
|
206
|
+
registry.getRulesByCategory('embedded');
|
|
207
|
+
const endTime = performance.now();
|
|
208
|
+
|
|
209
|
+
const duration = endTime - startTime;
|
|
210
|
+
console.log(`Category query: ${duration.toFixed(2)}ms`);
|
|
211
|
+
|
|
212
|
+
expect(duration).toBeLessThan(20);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should use cache effectively', async () => {
|
|
216
|
+
const registry = new RuleRegistry(rulesPath);
|
|
217
|
+
await registry.loadRules();
|
|
218
|
+
|
|
219
|
+
// First query (uncached)
|
|
220
|
+
const start1 = performance.now();
|
|
221
|
+
registry.getRulesByCategory('embedded');
|
|
222
|
+
const end1 = performance.now();
|
|
223
|
+
const duration1 = end1 - start1;
|
|
224
|
+
|
|
225
|
+
// Second query (cached)
|
|
226
|
+
const start2 = performance.now();
|
|
227
|
+
registry.getRulesByCategory('embedded');
|
|
228
|
+
const end2 = performance.now();
|
|
229
|
+
const duration2 = end2 - start2;
|
|
230
|
+
|
|
231
|
+
console.log(`Uncached query: ${duration1.toFixed(2)}ms, Cached query: ${duration2.toFixed(2)}ms`);
|
|
232
|
+
|
|
233
|
+
expect(duration2).toBeLessThan(duration1);
|
|
234
|
+
expect(duration2).toBeLessThan(5); // Cached should be very fast
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('Prompt Generation Performance', () => {
|
|
239
|
+
it('should generate prompt in <100ms (TARGET)', async () => {
|
|
240
|
+
const configManager = new ConfigurationManager(configPath);
|
|
241
|
+
await configManager.load();
|
|
242
|
+
|
|
243
|
+
const registry = new RuleRegistry(rulesPath);
|
|
244
|
+
await registry.loadRules();
|
|
245
|
+
|
|
246
|
+
const generator = new PromptGenerator(registry, configManager);
|
|
247
|
+
|
|
248
|
+
const startTime = performance.now();
|
|
249
|
+
await generator.generatePrompt({
|
|
250
|
+
filePath: '/project/embedded/sensor.c',
|
|
251
|
+
codeContext: 'volatile uint32_t* reg;'
|
|
252
|
+
});
|
|
253
|
+
const endTime = performance.now();
|
|
254
|
+
|
|
255
|
+
const duration = endTime - startTime;
|
|
256
|
+
console.log(`Prompt generation: ${duration.toFixed(2)}ms`);
|
|
257
|
+
|
|
258
|
+
expect(duration).toBeLessThan(100);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('should detect category in <5ms', async () => {
|
|
262
|
+
const configManager = new ConfigurationManager(configPath);
|
|
263
|
+
await configManager.load();
|
|
264
|
+
|
|
265
|
+
const registry = new RuleRegistry(rulesPath);
|
|
266
|
+
await registry.loadRules();
|
|
267
|
+
|
|
268
|
+
const generator = new PromptGenerator(registry, configManager);
|
|
269
|
+
|
|
270
|
+
const startTime = performance.now();
|
|
271
|
+
generator.detectCategory('/project/embedded/sensor.c');
|
|
272
|
+
const endTime = performance.now();
|
|
273
|
+
|
|
274
|
+
const duration = endTime - startTime;
|
|
275
|
+
console.log(`Category detection: ${duration.toFixed(2)}ms`);
|
|
276
|
+
|
|
277
|
+
expect(duration).toBeLessThan(5);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('should use prompt cache effectively', async () => {
|
|
281
|
+
const configManager = new ConfigurationManager(configPath);
|
|
282
|
+
await configManager.load();
|
|
283
|
+
|
|
284
|
+
const registry = new RuleRegistry(rulesPath);
|
|
285
|
+
await registry.loadRules();
|
|
286
|
+
|
|
287
|
+
const generator = new PromptGenerator(registry, configManager);
|
|
288
|
+
|
|
289
|
+
const context = {
|
|
290
|
+
filePath: '/project/src/main.c',
|
|
291
|
+
codeContext: 'int main() { return 0; }'
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// First generation (uncached)
|
|
295
|
+
const start1 = performance.now();
|
|
296
|
+
await generator.generatePrompt(context);
|
|
297
|
+
const end1 = performance.now();
|
|
298
|
+
const duration1 = end1 - start1;
|
|
299
|
+
|
|
300
|
+
// Second generation (cached)
|
|
301
|
+
const start2 = performance.now();
|
|
302
|
+
await generator.generatePrompt(context);
|
|
303
|
+
const end2 = performance.now();
|
|
304
|
+
const duration2 = end2 - start2;
|
|
305
|
+
|
|
306
|
+
console.log(`Uncached prompt: ${duration1.toFixed(2)}ms, Cached prompt: ${duration2.toFixed(2)}ms`);
|
|
307
|
+
|
|
308
|
+
expect(duration2).toBeLessThan(duration1);
|
|
309
|
+
expect(duration2).toBeLessThan(10);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
describe('Rule Evaluation Performance', () => {
|
|
314
|
+
it('should evaluate code in <200ms', async () => {
|
|
315
|
+
const configManager = new ConfigurationManager(configPath);
|
|
316
|
+
await configManager.load();
|
|
317
|
+
|
|
318
|
+
const registry = new RuleRegistry(rulesPath);
|
|
319
|
+
await registry.loadRules();
|
|
320
|
+
|
|
321
|
+
const evaluator = new RuleEvaluator(registry, configManager);
|
|
322
|
+
|
|
323
|
+
const code = `
|
|
324
|
+
int myFunction() {
|
|
325
|
+
int* ptr = malloc(sizeof(int));
|
|
326
|
+
*ptr = 5;
|
|
327
|
+
return *ptr;
|
|
328
|
+
}
|
|
329
|
+
`;
|
|
330
|
+
|
|
331
|
+
const startTime = performance.now();
|
|
332
|
+
await evaluator.evaluate(code, {
|
|
333
|
+
filePath: '/project/src/main.c',
|
|
334
|
+
rules: ['universal-naming', 'universal-memory-safety']
|
|
335
|
+
});
|
|
336
|
+
const endTime = performance.now();
|
|
337
|
+
|
|
338
|
+
const duration = endTime - startTime;
|
|
339
|
+
console.log(`Code evaluation: ${duration.toFixed(2)}ms`);
|
|
340
|
+
|
|
341
|
+
expect(duration).toBeLessThan(200);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it('should evaluate batch of files efficiently', async () => {
|
|
345
|
+
const configManager = new ConfigurationManager(configPath);
|
|
346
|
+
await configManager.load();
|
|
347
|
+
|
|
348
|
+
const registry = new RuleRegistry(rulesPath);
|
|
349
|
+
await registry.loadRules();
|
|
350
|
+
|
|
351
|
+
const evaluator = new RuleEvaluator(registry, configManager);
|
|
352
|
+
|
|
353
|
+
const files = Array.from({ length: 10 }, (_, i) => ({
|
|
354
|
+
path: `/project/src/file${i}.c`,
|
|
355
|
+
content: 'int my_function() { return 0; }'
|
|
356
|
+
}));
|
|
357
|
+
|
|
358
|
+
const startTime = performance.now();
|
|
359
|
+
await evaluator.evaluateBatch(files, {
|
|
360
|
+
rules: ['universal-naming']
|
|
361
|
+
});
|
|
362
|
+
const endTime = performance.now();
|
|
363
|
+
|
|
364
|
+
const duration = endTime - startTime;
|
|
365
|
+
const avgPerFile = duration / files.length;
|
|
366
|
+
console.log(`Batch evaluation: ${duration.toFixed(2)}ms (${avgPerFile.toFixed(2)}ms per file)`);
|
|
367
|
+
|
|
368
|
+
expect(avgPerFile).toBeLessThan(50);
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
describe('Overall System Performance', () => {
|
|
373
|
+
it('should complete full workflow in <300ms', async () => {
|
|
374
|
+
const startTime = performance.now();
|
|
375
|
+
|
|
376
|
+
// Load configuration
|
|
377
|
+
const configManager = new ConfigurationManager(configPath);
|
|
378
|
+
await configManager.load();
|
|
379
|
+
|
|
380
|
+
// Load rules
|
|
381
|
+
const registry = new RuleRegistry(rulesPath);
|
|
382
|
+
await registry.loadRules();
|
|
383
|
+
|
|
384
|
+
// Generate prompt
|
|
385
|
+
const generator = new PromptGenerator(registry, configManager);
|
|
386
|
+
await generator.generatePrompt({
|
|
387
|
+
filePath: '/project/embedded/sensor.c',
|
|
388
|
+
codeContext: 'volatile uint32_t* reg;'
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
// Evaluate code
|
|
392
|
+
const evaluator = new RuleEvaluator(registry, configManager);
|
|
393
|
+
await evaluator.evaluate('int my_function() { return 0; }', {
|
|
394
|
+
filePath: '/project/src/main.c',
|
|
395
|
+
rules: ['universal-naming']
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
const endTime = performance.now();
|
|
399
|
+
const duration = endTime - startTime;
|
|
400
|
+
|
|
401
|
+
console.log(`Full workflow: ${duration.toFixed(2)}ms`);
|
|
402
|
+
|
|
403
|
+
expect(duration).toBeLessThan(300);
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
|