0xray 2.1.4 → 2.2.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/dist/CHANGELOG.md +31 -0
- package/dist/cli/commands/govern.d.ts +29 -0
- package/dist/cli/commands/govern.js +152 -0
- package/dist/cli/index.js +29 -216
- package/dist/core/framework-logger.js +30 -1
- package/dist/delegation/index.d.ts +1 -2
- package/dist/delegation/index.js +1 -2
- package/dist/enforcement/enforcer-tools.js +1 -1
- package/dist/execution/proposal-applier.d.ts +1 -9
- package/dist/execution/proposal-applier.js +18 -173
- package/dist/governance/codex-policy.service.d.ts +7 -25
- package/dist/governance/codex-policy.service.js +8 -26
- package/dist/governance/governance-core.d.ts +22 -28
- package/dist/governance/governance-core.js +31 -101
- package/dist/governance/governance-service.d.ts +1 -0
- package/dist/governance/governance-service.js +67 -4
- package/dist/governance/governance-types.d.ts +5 -2
- package/dist/inference/index.d.ts +3 -4
- package/dist/inference/inference-accumulator.js +1 -1
- package/dist/inference/inference-cycle.d.ts +12 -18
- package/dist/inference/inference-cycle.js +120 -335
- package/dist/integrations/base/index.d.ts +0 -1
- package/dist/integrations/base/index.js +0 -2
- package/dist/integrations/grok/hooks/pre-tool-use.js +4 -18
- package/dist/integrations/hermes-agent/bridge.mjs +9 -0
- package/dist/mcps/config/server-config-registry.js +1 -1
- package/dist/mcps/governance.server.js +3 -4
- package/dist/mcps/knowledge-skills/api-design.server.js +10 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +10 -0
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +10 -0
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +10 -0
- package/dist/mcps/knowledge-skills/code-review.server.js +10 -0
- package/dist/mcps/knowledge-skills/content-creator.server.js +10 -0
- package/dist/mcps/knowledge-skills/database-design.server.js +10 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +10 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js +10 -0
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +10 -0
- package/dist/mcps/knowledge-skills/log-monitor.server.js +10 -0
- package/dist/mcps/knowledge-skills/mobile-development.server.js +10 -0
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +10 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +10 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js +10 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +10 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js +10 -0
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +10 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.d.ts +4 -0
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +33 -14
- package/dist/mcps/knowledge-skills/strategist.server.js +10 -0
- package/dist/mcps/knowledge-skills/tech-writer.server.js +10 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +10 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +10 -0
- package/dist/metrics/agent-metrics.d.ts +2 -1
- package/dist/nucleus/govern-http.d.ts +59 -0
- package/dist/nucleus/govern-http.js +172 -0
- package/dist/nucleus/index.d.ts +14 -0
- package/dist/nucleus/index.js +9 -0
- package/dist/nucleus/kernel.d.ts +51 -0
- package/dist/nucleus/kernel.js +62 -0
- package/dist/nucleus/plugin-registry.d.ts +104 -0
- package/dist/nucleus/plugin-registry.js +147 -0
- package/dist/orchestrator/orchestrator.d.ts +0 -1
- package/dist/orchestrator/orchestrator.js +0 -21
- package/dist/postprocessor/PostProcessor.d.ts +13 -1
- package/dist/postprocessor/PostProcessor.js +41 -1
- package/dist/postprocessor/autofix/AutoFixEngine.d.ts +0 -8
- package/dist/postprocessor/autofix/AutoFixEngine.js +0 -54
- package/dist/postprocessor/metamorphosis/MetamorphosisEngine.d.ts +25 -0
- package/dist/postprocessor/metamorphosis/MetamorphosisEngine.js +10 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.d.ts +68 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.js +371 -0
- package/dist/skills/orchestrator/SKILL.md +1 -1
- package/dist/state/index.d.ts +0 -2
- package/package.json +4 -3
- package/scripts/node/universal-version-manager.js +2 -2
- package/src/mcps/config/__tests__/server-config-registry.test.ts +6 -15
- package/src/mcps/config/server-config-registry.ts +1 -1
- package/src/mcps/governance.server.ts +3 -5
- package/src/mcps/knowledge-skills/api-design.server.ts +9 -0
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +9 -0
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +9 -0
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +9 -0
- package/src/mcps/knowledge-skills/code-review.server.ts +9 -0
- package/src/mcps/knowledge-skills/content-creator.server.ts +9 -0
- package/src/mcps/knowledge-skills/database-design.server.ts +9 -0
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +9 -0
- package/src/mcps/knowledge-skills/git-workflow.server.ts +9 -0
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +9 -0
- package/src/mcps/knowledge-skills/log-monitor.server.ts +9 -0
- package/src/mcps/knowledge-skills/mobile-development.server.ts +9 -0
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +9 -0
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +9 -0
- package/src/mcps/knowledge-skills/project-analysis.server.ts +9 -0
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +9 -0
- package/src/mcps/knowledge-skills/security-audit.server.ts +9 -0
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +9 -0
- package/src/mcps/knowledge-skills/session-management.server.ts +1 -0
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +44 -29
- package/src/mcps/knowledge-skills/strategist.server.ts +9 -0
- package/src/mcps/knowledge-skills/tech-writer.server.ts +9 -0
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +9 -0
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +9 -0
- package/src/skills/orchestrator/SKILL.md +1 -1
- package/.opencode/agents/testing-best-practices.yml +0 -12
- package/dist/analytics/consent-manager.d.ts +0 -93
- package/dist/analytics/consent-manager.js +0 -258
- package/dist/analytics/simple-pattern-analyzer.d.ts +0 -80
- package/dist/analytics/simple-pattern-analyzer.js +0 -297
- package/dist/cli/commands/analytics-disable.d.ts +0 -9
- package/dist/cli/commands/analytics-disable.js +0 -72
- package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
- package/dist/cli/commands/analytics-enable-action.js +0 -82
- package/dist/cli/commands/analytics-preview.d.ts +0 -9
- package/dist/cli/commands/analytics-preview.js +0 -106
- package/dist/cli/commands/analytics-status.d.ts +0 -9
- package/dist/cli/commands/analytics-status.js +0 -68
- package/dist/cli/server.d.ts +0 -1
- package/dist/cli/server.js +0 -147
- package/dist/core/errors.d.ts +0 -3
- package/dist/core/errors.js +0 -10
- package/dist/core/logging-config.d.ts +0 -11
- package/dist/core/logging-config.js +0 -43
- package/dist/core/trace-context.d.ts +0 -12
- package/dist/core/trace-context.js +0 -33
- package/dist/delegation/voting-coordinator.d.ts +0 -49
- package/dist/delegation/voting-coordinator.js +0 -375
- package/dist/enforcement/test-auto-healing.d.ts +0 -83
- package/dist/enforcement/test-auto-healing.js +0 -325
- package/dist/integrations/base/ExampleIntegration.d.ts +0 -47
- package/dist/integrations/base/ExampleIntegration.js +0 -181
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +0 -34
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +0 -831
- package/dist/mcps/orchestrator.server.d.ts +0 -10
- package/dist/mcps/orchestrator.server.js +0 -19
- package/dist/orchestrator/self-direction-activation.d.ts +0 -109
- package/dist/orchestrator/self-direction-activation.js +0 -245
- package/dist/orchestrator/universal-librarian-consultation.d.ts +0 -98
- package/dist/orchestrator/universal-librarian-consultation.js +0 -216
- package/dist/orchestrator/universal-registry-bridge.d.ts +0 -85
- package/dist/orchestrator/universal-registry-bridge.js +0 -247
- package/dist/performance/performance-budget-enforcer.d.ts +0 -158
- package/dist/performance/performance-budget-enforcer.js +0 -434
- package/dist/performance/performance-regression-tester.d.ts +0 -108
- package/dist/performance/performance-regression-tester.js +0 -342
- package/dist/skills/testing-best-practices/SKILL.md +0 -37
- package/dist/state/context-providers.d.ts +0 -4
- package/dist/state/context-providers.js +0 -1
- package/dist/state/state-types.d.ts +0 -5
- package/dist/state/state-types.js +0 -1
- package/dist/utils/batch-operations.d.ts +0 -25
- package/dist/utils/batch-operations.js +0 -292
- package/dist/utils/test-template-generator.d.ts +0 -25
- package/dist/utils/test-template-generator.js +0 -178
- package/dist/utils/token-manager.d.ts +0 -48
- package/dist/utils/token-manager.js +0 -163
- package/src/mcps/knowledge-skills/testing-best-practices.server.test.ts +0 -136
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +0 -1183
- package/src/mcps/orchestrator.server.ts +0 -34
- package/src/opencode/agents/testing-best-practices.yml +0 -12
- package/src/skills/testing-best-practices/SKILL.md +0 -37
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Regression Testing
|
|
3
|
-
*
|
|
4
|
-
* Automated testing system that detects performance regressions and
|
|
5
|
-
* enforces performance budget compliance in CI/CD pipelines.
|
|
6
|
-
*
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
* @since 2026-01-08
|
|
9
|
-
*/
|
|
10
|
-
import { performance } from "perf_hooks";
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
13
|
-
import { PerformanceBudgetEnforcer, PERFORMANCE_BUDGET, } from "./performance-budget-enforcer.js";
|
|
14
|
-
/**
|
|
15
|
-
* Performance regression testing system
|
|
16
|
-
*/
|
|
17
|
-
export class PerformanceRegressionTester {
|
|
18
|
-
baselines = new Map();
|
|
19
|
-
results = [];
|
|
20
|
-
budgetEnforcer;
|
|
21
|
-
constructor(budgetEnforcer) {
|
|
22
|
-
this.budgetEnforcer = budgetEnforcer || new PerformanceBudgetEnforcer();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Load performance baselines from file
|
|
26
|
-
*/
|
|
27
|
-
loadBaselines(baselineFile) {
|
|
28
|
-
try {
|
|
29
|
-
if (fs.existsSync(baselineFile)) {
|
|
30
|
-
const data = fs.readFileSync(baselineFile, "utf8");
|
|
31
|
-
const baselines = JSON.parse(data);
|
|
32
|
-
this.baselines = new Map(Object.entries(baselines));
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
// No existing baselines found, will use defaults
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
frameworkLogger.log("performance-regression-tester", "baseline-load-failed", "error", { file: baselineFile, error });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Save performance baselines to file
|
|
44
|
-
*/
|
|
45
|
-
saveBaselines(baselineFile) {
|
|
46
|
-
try {
|
|
47
|
-
const baselines = Object.fromEntries(this.baselines);
|
|
48
|
-
fs.writeFileSync(baselineFile, JSON.stringify(baselines, null, 2));
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
frameworkLogger.log("performance-regression-tester", "baseline-save-failed", "error", { file: baselineFile, error });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Run a single performance regression test
|
|
56
|
-
*/
|
|
57
|
-
async runRegressionTest(test) {
|
|
58
|
-
const startTime = performance.now();
|
|
59
|
-
try {
|
|
60
|
-
// Set timeout for the test
|
|
61
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
62
|
-
setTimeout(() => reject(new Error(`Test timeout after ${test.timeout}ms`)), test.timeout);
|
|
63
|
-
});
|
|
64
|
-
const testPromise = Promise.resolve(test.testFunction());
|
|
65
|
-
await Promise.race([testPromise, timeoutPromise]);
|
|
66
|
-
const duration = performance.now() - startTime;
|
|
67
|
-
const baseline = this.baselines.get(test.name);
|
|
68
|
-
let deviation = 0;
|
|
69
|
-
let status = "pass";
|
|
70
|
-
if (baseline) {
|
|
71
|
-
deviation =
|
|
72
|
-
((duration - baseline.averageDuration) / baseline.averageDuration) *
|
|
73
|
-
100;
|
|
74
|
-
if (Math.abs(deviation) > test.tolerance) {
|
|
75
|
-
if (Math.abs(deviation) > test.tolerance * 2) {
|
|
76
|
-
status = "fail";
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
status = "warning";
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// No baseline, create one
|
|
85
|
-
deviation = 0;
|
|
86
|
-
status = "pass";
|
|
87
|
-
}
|
|
88
|
-
const expectedDuration = baseline
|
|
89
|
-
? baseline.averageDuration
|
|
90
|
-
: test.expectedDuration || duration;
|
|
91
|
-
const result = {
|
|
92
|
-
testName: test.name,
|
|
93
|
-
duration,
|
|
94
|
-
expectedDuration,
|
|
95
|
-
deviation,
|
|
96
|
-
status,
|
|
97
|
-
timestamp: Date.now(),
|
|
98
|
-
};
|
|
99
|
-
this.results.push(result);
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
const duration = performance.now() - startTime;
|
|
104
|
-
const result = {
|
|
105
|
-
testName: test.name,
|
|
106
|
-
duration,
|
|
107
|
-
deviation: 0,
|
|
108
|
-
status: "fail",
|
|
109
|
-
error: error instanceof Error ? error.message : String(error),
|
|
110
|
-
timestamp: Date.now(),
|
|
111
|
-
};
|
|
112
|
-
this.results.push(result);
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Run a complete regression test suite
|
|
118
|
-
*/
|
|
119
|
-
async runTestSuite(suite) {
|
|
120
|
-
// Load baselines
|
|
121
|
-
this.loadBaselines(suite.baselineFile);
|
|
122
|
-
const suiteStartTime = performance.now();
|
|
123
|
-
const results = [];
|
|
124
|
-
// Run all tests
|
|
125
|
-
for (const test of suite.tests) {
|
|
126
|
-
const result = await this.runRegressionTest(test);
|
|
127
|
-
results.push(result);
|
|
128
|
-
const statusIcon = result.status === "pass"
|
|
129
|
-
? "✅"
|
|
130
|
-
: result.status === "warning"
|
|
131
|
-
? "⚠️"
|
|
132
|
-
: "❌";
|
|
133
|
-
const durationStr = result.duration.toFixed(2);
|
|
134
|
-
const deviationStr = result.deviation.toFixed(2);
|
|
135
|
-
const expectedStr = result.expectedDuration
|
|
136
|
-
? result.expectedDuration.toFixed(2)
|
|
137
|
-
: "N/A";
|
|
138
|
-
if (result.error) {
|
|
139
|
-
frameworkLogger.log("performance-regression-tester", "test-failed", "error", { testName: result.testName, error: result.error });
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
// Update baselines with new results
|
|
143
|
-
this.updateBaselines(results);
|
|
144
|
-
// Generate performance budget report
|
|
145
|
-
let budgetReport;
|
|
146
|
-
try {
|
|
147
|
-
budgetReport = await this.budgetEnforcer.generatePerformanceReport();
|
|
148
|
-
}
|
|
149
|
-
catch (error) {
|
|
150
|
-
frameworkLogger.log("performance-regression-tester", "budget-report-failed", "error", { error });
|
|
151
|
-
}
|
|
152
|
-
const suiteDuration = performance.now() - suiteStartTime;
|
|
153
|
-
const summary = this.generateSummary(results, suiteDuration);
|
|
154
|
-
// Display summary
|
|
155
|
-
// Test failure count - kept as console.log for CI visibility
|
|
156
|
-
if (budgetReport) {
|
|
157
|
-
if (budgetReport.violations.length > 0) {
|
|
158
|
-
budgetReport.violations.forEach((v) => { });
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
// Save updated baselines
|
|
162
|
-
this.saveBaselines(suite.baselineFile);
|
|
163
|
-
// Check if suite should fail
|
|
164
|
-
const shouldFail = suite.failOnRegression &&
|
|
165
|
-
(summary.failed > 0 ||
|
|
166
|
-
(budgetReport && budgetReport.overallStatus === "fail"));
|
|
167
|
-
if (shouldFail) {
|
|
168
|
-
throw new Error("Performance regression test suite failed");
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
frameworkLogger.log("performance-regression-tester", "suite-passed", "info", { message: "Performance regression test suite passed" });
|
|
172
|
-
}
|
|
173
|
-
const result = {
|
|
174
|
-
results,
|
|
175
|
-
summary,
|
|
176
|
-
success: !shouldFail,
|
|
177
|
-
};
|
|
178
|
-
if (budgetReport) {
|
|
179
|
-
result.budgetReport = budgetReport;
|
|
180
|
-
}
|
|
181
|
-
return result;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Update baselines with new test results
|
|
185
|
-
*/
|
|
186
|
-
updateBaselines(results) {
|
|
187
|
-
for (const result of results) {
|
|
188
|
-
if (result.status === "pass" || result.status === "warning") {
|
|
189
|
-
const existing = this.baselines.get(result.testName);
|
|
190
|
-
if (existing) {
|
|
191
|
-
// Update rolling average
|
|
192
|
-
const newCount = existing.sampleCount + 1;
|
|
193
|
-
const newAverage = (existing.averageDuration * existing.sampleCount +
|
|
194
|
-
result.duration) /
|
|
195
|
-
newCount;
|
|
196
|
-
// Update standard deviation (simplified)
|
|
197
|
-
const variance = Math.pow(result.duration - existing.averageDuration, 2);
|
|
198
|
-
const newStdDev = Math.sqrt((existing.standardDeviation *
|
|
199
|
-
existing.standardDeviation *
|
|
200
|
-
existing.sampleCount +
|
|
201
|
-
variance) /
|
|
202
|
-
newCount);
|
|
203
|
-
this.baselines.set(result.testName, {
|
|
204
|
-
...existing,
|
|
205
|
-
averageDuration: newAverage,
|
|
206
|
-
standardDeviation: newStdDev,
|
|
207
|
-
sampleCount: newCount,
|
|
208
|
-
lastUpdated: Date.now(),
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
// Create new baseline
|
|
213
|
-
this.baselines.set(result.testName, {
|
|
214
|
-
testName: result.testName,
|
|
215
|
-
averageDuration: result.duration,
|
|
216
|
-
standardDeviation: 0,
|
|
217
|
-
sampleCount: 1,
|
|
218
|
-
lastUpdated: Date.now(),
|
|
219
|
-
tolerance: 10, // Default 10% tolerance
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Generate test suite summary
|
|
227
|
-
*/
|
|
228
|
-
generateSummary(results, suiteDuration) {
|
|
229
|
-
const passed = results.filter((r) => r.status === "pass").length;
|
|
230
|
-
const warnings = results.filter((r) => r.status === "warning").length;
|
|
231
|
-
const failed = results.filter((r) => r.status === "fail").length;
|
|
232
|
-
const deviations = results.map((r) => Math.abs(r.deviation));
|
|
233
|
-
const averageDeviation = deviations.length > 0
|
|
234
|
-
? deviations.reduce((a, b) => a + b, 0) / deviations.length
|
|
235
|
-
: 0;
|
|
236
|
-
const maxDeviation = deviations.length > 0 ? Math.max(...deviations) : 0;
|
|
237
|
-
return {
|
|
238
|
-
totalTests: results.length,
|
|
239
|
-
passed,
|
|
240
|
-
warnings,
|
|
241
|
-
failed,
|
|
242
|
-
averageDeviation,
|
|
243
|
-
maxDeviation,
|
|
244
|
-
duration: suiteDuration,
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Create default performance regression test suite
|
|
249
|
-
*/
|
|
250
|
-
createDefaultTestSuite() {
|
|
251
|
-
const tests = [
|
|
252
|
-
{
|
|
253
|
-
name: "bundle-size-analysis",
|
|
254
|
-
description: "Analyze bundle size against performance budget",
|
|
255
|
-
testFunction: async () => {
|
|
256
|
-
await this.budgetEnforcer.analyzeBundleSize();
|
|
257
|
-
},
|
|
258
|
-
timeout: 10000,
|
|
259
|
-
tolerance: 5,
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
name: "module-import-performance",
|
|
263
|
-
description: "Measure core module import performance",
|
|
264
|
-
testFunction: async () => {
|
|
265
|
-
const start = performance.now();
|
|
266
|
-
await import("../core/index");
|
|
267
|
-
const duration = performance.now() - start;
|
|
268
|
-
if (duration > PERFORMANCE_BUDGET.runtime.startupTime) {
|
|
269
|
-
throw new Error(`Import time ${duration.toFixed(2)}ms exceeds budget of ${PERFORMANCE_BUDGET.runtime.startupTime}ms`);
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
timeout: 5000,
|
|
273
|
-
tolerance: 10,
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
name: "memory-usage-check",
|
|
277
|
-
description: "Verify memory usage stays within budget",
|
|
278
|
-
testFunction: () => {
|
|
279
|
-
const memUsage = process.memoryUsage();
|
|
280
|
-
if (memUsage.heapUsed > PERFORMANCE_BUDGET.runtime.memoryUsage) {
|
|
281
|
-
throw new Error(`Heap usage ${(memUsage.heapUsed / 1024 / 1024).toFixed(2)}MB exceeds budget of ${(PERFORMANCE_BUDGET.runtime.memoryUsage / 1024 / 1024).toFixed(2)}MB`);
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
timeout: 1000,
|
|
285
|
-
tolerance: 5,
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
name: "test-execution-performance",
|
|
289
|
-
description: "Measure simple test execution time",
|
|
290
|
-
testFunction: async () => {
|
|
291
|
-
const start = performance.now();
|
|
292
|
-
// Simple test operation instead of running npm test
|
|
293
|
-
const testArray = Array.from({ length: 1000 }, (_, i) => i * i);
|
|
294
|
-
const result = testArray.reduce((sum, val) => sum + val, 0);
|
|
295
|
-
if (result < 0)
|
|
296
|
-
throw new Error("Unexpected result"); // Never happens
|
|
297
|
-
const duration = performance.now() - start;
|
|
298
|
-
// Just ensure the operation completes in reasonable time
|
|
299
|
-
if (duration > 100) {
|
|
300
|
-
throw new Error(`Test operation ${duration.toFixed(2)}ms too slow`);
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
timeout: 5000,
|
|
304
|
-
tolerance: 20,
|
|
305
|
-
},
|
|
306
|
-
];
|
|
307
|
-
return {
|
|
308
|
-
name: "0xRay Performance Regression Suite",
|
|
309
|
-
description: "Comprehensive performance regression tests for 0xRay Framework",
|
|
310
|
-
tests,
|
|
311
|
-
baselineFile: "./performance-baselines.json",
|
|
312
|
-
failOnRegression: true,
|
|
313
|
-
warningThreshold: 10,
|
|
314
|
-
failureThreshold: 20,
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Export test results for analysis
|
|
319
|
-
*/
|
|
320
|
-
exportResults() {
|
|
321
|
-
const summary = {
|
|
322
|
-
totalTests: this.results.length,
|
|
323
|
-
passRate: this.results.length > 0
|
|
324
|
-
? (this.results.filter((r) => r.status === "pass").length /
|
|
325
|
-
this.results.length) *
|
|
326
|
-
100
|
|
327
|
-
: 0,
|
|
328
|
-
averageDeviation: this.results.length > 0
|
|
329
|
-
? this.results.reduce((sum, r) => sum + Math.abs(r.deviation), 0) /
|
|
330
|
-
this.results.length
|
|
331
|
-
: 0,
|
|
332
|
-
regressionDetected: this.results.some((r) => r.status === "fail"),
|
|
333
|
-
};
|
|
334
|
-
return {
|
|
335
|
-
results: this.results,
|
|
336
|
-
baselines: Object.fromEntries(this.baselines),
|
|
337
|
-
summary,
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
// Export singleton instance
|
|
342
|
-
export const performanceRegressionTester = new PerformanceRegressionTester();
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
source: framework
|
|
3
|
-
name: testing-best-practices
|
|
4
|
-
description: Testing best practices and quality assurance
|
|
5
|
-
author: StrRay Framework
|
|
6
|
-
version: 1.0.0
|
|
7
|
-
schema_version: "1.0"
|
|
8
|
-
tags: [testing, testing, best, practices]
|
|
9
|
-
capabilities:
|
|
10
|
-
- write_unit_tests
|
|
11
|
-
- write_integration_tests
|
|
12
|
-
- analyze_coverage
|
|
13
|
-
dependencies: []
|
|
14
|
-
|
|
15
|
-
mcp:
|
|
16
|
-
testing-best-practices:
|
|
17
|
-
command: node
|
|
18
|
-
args: [node_modules/0xray/dist/mcps/knowledge-skills/testing-best-practices.server.js]
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
# Testing Best Practices Skill
|
|
22
|
-
|
|
23
|
-
Testing best practices and quality assurance.
|
|
24
|
-
|
|
25
|
-
## Tools Available
|
|
26
|
-
|
|
27
|
-
- **testing_practices**: Testing practices
|
|
28
|
-
- **quality_assurance**: Quality assurance
|
|
29
|
-
- **best_practices**: Best practices
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
This skill provides testing capabilities for testing best practices functionality.
|
|
34
|
-
|
|
35
|
-
## Integration
|
|
36
|
-
|
|
37
|
-
Activated when testing capabilities are requested through the skills system.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface ReplacementOperation {
|
|
2
|
-
pattern: string;
|
|
3
|
-
replacement: string;
|
|
4
|
-
isRegex?: boolean;
|
|
5
|
-
caseSensitive?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface BatchResult {
|
|
8
|
-
success: boolean;
|
|
9
|
-
filesModified: number;
|
|
10
|
-
errors: Array<{
|
|
11
|
-
file: string;
|
|
12
|
-
error: string;
|
|
13
|
-
}>;
|
|
14
|
-
duration: number;
|
|
15
|
-
}
|
|
16
|
-
export interface FileOperation {
|
|
17
|
-
filePath: string;
|
|
18
|
-
operation: "replace" | "append" | "prepend" | "delete";
|
|
19
|
-
content?: string;
|
|
20
|
-
pattern?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare function batchReplace(files: string[], operations: ReplacementOperation[]): Promise<BatchResult>;
|
|
23
|
-
export declare function batchFileOperations(operations: FileOperation[]): Promise<BatchResult>;
|
|
24
|
-
export declare function findFilesWithPattern(directory: string, pattern: string, extensions?: string[]): string[];
|
|
25
|
-
export declare function bulkRename(directory: string, oldName: string, newName: string, extensions?: string[]): Promise<BatchResult>;
|