strray-ai 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/opencode.json +0 -2
  2. package/package.json +2 -1
  3. package/scripts/postinstall.cjs +53 -0
  4. package/src/__tests__/agents/architect.test.ts +108 -0
  5. package/src/__tests__/agents/bug-triage-specialist.test.ts +246 -0
  6. package/src/__tests__/agents/code-reviewer.test.ts +242 -0
  7. package/src/__tests__/agents/enforcer.test.ts +179 -0
  8. package/src/__tests__/agents/index.test.ts +135 -0
  9. package/src/__tests__/agents/orchestrator.test.ts +228 -0
  10. package/src/__tests__/agents/refactorer.test.ts +248 -0
  11. package/src/__tests__/agents/security-auditor.test.ts +234 -0
  12. package/src/__tests__/agents/test-architect.test.ts +256 -0
  13. package/src/__tests__/agents/types.test.ts +210 -0
  14. package/src/__tests__/framework-enforcement-integration.test.ts +252 -0
  15. package/src/__tests__/framework-logger-persistence.test.ts +156 -0
  16. package/src/__tests__/integration/codex-enforcement-e2e.test.ts +195 -0
  17. package/src/__tests__/integration/codex-enforcement.test.ts +237 -0
  18. package/src/__tests__/integration/commit-batching-enforcement-integration.test.ts +343 -0
  19. package/src/__tests__/integration/context-providers-integration.test.ts +302 -0
  20. package/src/__tests__/integration/delegation-system.test.ts +263 -0
  21. package/src/__tests__/integration/e2e-framework-integration.test.ts +1524 -0
  22. package/src/__tests__/integration/framework-init.test.ts +327 -0
  23. package/src/__tests__/integration/json-codex-integration.test.ts +332 -0
  24. package/src/__tests__/integration/oh-my-opencode-integration.test.ts +240 -0
  25. package/src/__tests__/integration/orchestration-e2e.test.ts +176 -0
  26. package/src/__tests__/integration/orchestrator/basic-orchestrator.test.ts +53 -0
  27. package/src/__tests__/integration/orchestrator/concurrent-execution.test.ts +64 -0
  28. package/src/__tests__/integration/orchestrator/dependency-handling.test.ts +78 -0
  29. package/src/__tests__/integration/orchestrator-integration.test.ts.disabled +1279 -0
  30. package/src/__tests__/integration/postprocessor-integration.test.ts +64 -0
  31. package/src/__tests__/integration/security/security-integration.test.ts +160 -0
  32. package/src/__tests__/integration/server.test.ts +187 -0
  33. package/src/__tests__/integration/session-cleanup-validation.test.ts +612 -0
  34. package/src/__tests__/integration/session-lifecycle.test.ts +450 -0
  35. package/src/__tests__/integration/session-management.test.ts +168 -0
  36. package/src/__tests__/integration/session-monitoring-integration.test.ts +644 -0
  37. package/src/__tests__/integration/session-state-sharing.test.ts +601 -0
  38. package/src/__tests__/performance/enterprise-performance-tests.ts +1030 -0
  39. package/src/__tests__/performance/performance-system.test.ts +408 -0
  40. package/src/__tests__/plugins/marketplace-service.test.ts +1542 -0
  41. package/src/__tests__/plugins/marketplace-service.test.ts.disabled +1516 -0
  42. package/src/__tests__/postprocessor/escalation/EscalationEngine.test.ts +205 -0
  43. package/src/__tests__/postprocessor/success/SuccessHandler.test.ts +258 -0
  44. package/src/__tests__/setup.ts +220 -0
  45. package/src/__tests__/test-integration.ts +2 -0
  46. package/src/__tests__/test-processor.ts +1 -0
  47. package/src/__tests__/unit/agent-delegator.test.ts +949 -0
  48. package/src/__tests__/unit/analytics.test.ts +192 -0
  49. package/src/__tests__/unit/ast-code-parser.test.ts +342 -0
  50. package/src/__tests__/unit/benchmark.test.ts +201 -0
  51. package/src/__tests__/unit/blocked-test.test.ts +8 -0
  52. package/src/__tests__/unit/boot-orchestrator.test.ts +182 -0
  53. package/src/__tests__/unit/codebase-context-analyzer.test.ts +375 -0
  54. package/src/__tests__/unit/codex-injector.test.ts +282 -0
  55. package/src/__tests__/unit/codex-parser.test.ts +296 -0
  56. package/src/__tests__/unit/context-loader.test.ts +723 -0
  57. package/src/__tests__/unit/dependency-graph-builder.test.ts +531 -0
  58. package/src/__tests__/unit/monitoring.test.ts +115 -0
  59. package/src/__tests__/unit/orchestrator.test.ts +212 -0
  60. package/src/__tests__/unit/processor-activation.test.ts +878 -0
  61. package/src/__tests__/unit/rule-enforcer.test.ts +363 -0
  62. package/src/__tests__/unit/security/security-auditor.test.ts +226 -0
  63. package/src/__tests__/unit/security/security-hardener.test.ts +404 -0
  64. package/src/__tests__/unit/security/security-headers.test.ts +255 -0
  65. package/src/__tests__/unit/session-coordination-validator.test.ts +184 -0
  66. package/src/__tests__/unit/session-health-monitoring.test.ts +161 -0
  67. package/src/__tests__/unit/session-migration-logic.test.ts +153 -0
  68. package/src/__tests__/unit/session-migration-validator.test.ts +130 -0
  69. package/src/__tests__/unit/session-security-validator.test.ts +87 -0
  70. package/src/__tests__/unit/state-manager-persistence.test.ts +301 -0
  71. package/src/__tests__/unit/state-manager.test.ts +205 -0
  72. package/src/__tests__/utils/mock-framework.ts +392 -0
  73. package/src/__tests__/utils/mock-server.ts +72 -0
  74. package/src/__tests__/utils/test-data.ts +130 -0
  75. package/src/__tests__/utils/test-helpers.ts +640 -0
  76. package/src/__tests__/utils/test-utils.ts +241 -0
package/opencode.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "$schema": "https://opencode.ai/config.json",
3
3
  "mcp": {
4
- // Disable problematic default MCP servers
5
4
  "context7": { "enabled": false },
6
5
  "global-everything": { "enabled": false },
7
6
  "global-filesystem": { "enabled": false },
8
7
  "global-git": { "enabled": false },
9
8
  "global-sqlite": { "enabled": false },
10
9
  "grep_app": { "enabled": false },
11
- // Enable our custom StrRay MCP servers
12
10
  "orchestrator": {
13
11
  "type": "local",
14
12
  "command": ["node", "dist/plugin/mcps/orchestrator.server.js"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strray-ai",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "⚡ StringRay ⚡: Bulletproof AI orchestration with systematic error prevention. Zero dead ends. Ship clean, tested, optimized code — every time.",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin/index.js",
@@ -123,6 +123,7 @@
123
123
  "dist/processors",
124
124
  "dist/state",
125
125
  "dist/utils",
126
+ "src/__tests__",
126
127
  "README.md",
127
128
  "LICENSE"
128
129
  ],
@@ -428,6 +428,59 @@ function configureStrRayPlugin() {
428
428
  }
429
429
  }
430
430
 
431
+ // Update paths in test files
432
+ console.log("Checking test files for path updates...");
433
+ const testDir = path.join(process.cwd(), "node_modules", "strray-ai", "src", "__tests__");
434
+ if (fs.existsSync(testDir)) {
435
+ console.log("Test files found, updating paths...");
436
+ let testFilesUpdated = 0;
437
+
438
+ function processTestFile(filePath) {
439
+ try {
440
+ let content = fs.readFileSync(filePath, "utf-8");
441
+ let updated = false;
442
+
443
+ // Convert dist/plugin paths to node_modules/strray-ai/dist/plugin paths
444
+ if (content.includes('./dist/plugin/')) {
445
+ content = content.replace(/'\.\/dist\/plugin\//g, "'./node_modules/strray-ai/dist/plugin/");
446
+ content = content.replace(/"\.\/dist\/plugin\//g, '"./node_modules/strray-ai/dist/plugin/');
447
+ updated = true;
448
+ }
449
+
450
+ if (updated) {
451
+ fs.writeFileSync(filePath, content);
452
+ testFilesUpdated++;
453
+ console.log(`✅ Updated test file: ${path.relative(process.cwd(), filePath)}`);
454
+ }
455
+ } catch (error) {
456
+ console.warn(`Warning: Could not update test file ${filePath}:`, error.message);
457
+ }
458
+ }
459
+
460
+ function processDirectory(dirPath) {
461
+ const items = fs.readdirSync(dirPath);
462
+ for (const item of items) {
463
+ const fullPath = path.join(dirPath, item);
464
+ const stat = fs.statSync(fullPath);
465
+ if (stat.isDirectory()) {
466
+ processDirectory(fullPath);
467
+ } else if (item.endsWith('.ts') || item.endsWith('.js')) {
468
+ processTestFile(fullPath);
469
+ }
470
+ }
471
+ }
472
+
473
+ processDirectory(testDir);
474
+
475
+ if (testFilesUpdated > 0) {
476
+ console.log(`✅ Updated ${testFilesUpdated} test files with consumer paths`);
477
+ } else {
478
+ console.log("ℹ️ No test file path updates needed");
479
+ }
480
+ } else {
481
+ console.log("ℹ️ Test files not found (this is normal for some installations)");
482
+ }
483
+
431
484
  // All configuration paths are now updated for consumer usage
432
485
 
433
486
  console.log('🎉 StrRay plugin installation complete!');
@@ -0,0 +1,108 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { architect } from "../../agents/architect.js";
3
+ import type { AgentConfig } from "../../agents/types.js";
4
+
5
+ describe("Architect Agent Configuration", () => {
6
+ it("should be a valid AgentConfig object", () => {
7
+ const config: AgentConfig = architect;
8
+ expect(config).toBeDefined();
9
+ });
10
+
11
+ describe("Basic Configuration", () => {
12
+ it("should have correct name and model", () => {
13
+ expect(architect.name).toBe("architect");
14
+ expect(architect.model).toBe("opencode/grok-code");
15
+ });
16
+
17
+ it("should be configured as subagent mode", () => {
18
+ expect(architect.mode).toBe("subagent");
19
+ });
20
+
21
+ it("should have low temperature for consistent design decisions", () => {
22
+ expect(architect.temperature).toBe(0.1);
23
+ });
24
+ });
25
+
26
+ describe("Core Responsibilities", () => {
27
+ it("should define 4 core responsibilities", () => {
28
+ const system = architect.system;
29
+ expect(system).toContain("State Management");
30
+ expect(system).toContain("Delegation System");
31
+ expect(system).toContain("System Design");
32
+ expect(system).toContain("Dependency Mapping");
33
+ });
34
+
35
+ it("should specify state management focus", () => {
36
+ const system = architect.system;
37
+ expect(system).toContain("Maintain global state");
38
+ expect(system).toContain("prevent state duplication");
39
+ });
40
+
41
+ it("should include delegation intelligence", () => {
42
+ const system = architect.system;
43
+ expect(system).toContain("Analyze task complexity");
44
+ expect(system).toContain("route to appropriate specialized agents");
45
+ });
46
+ });
47
+
48
+ describe("Key Facilities", () => {
49
+ it("should specify architectural facilities", () => {
50
+ const system = architect.system;
51
+ expect(system).toContain("Global State Coordinator");
52
+ expect(system).toContain("Complexity Analysis Engine");
53
+ expect(system).toContain("Delegation System");
54
+ expect(system).toContain("state synchronization");
55
+ });
56
+
57
+ it("should define processor pipeline", () => {
58
+ const system = architect.system;
59
+ expect(system).toContain("Processor Pipeline");
60
+ expect(system).toContain("stateValidation");
61
+ expect(system).toContain("dependencyMapping");
62
+ expect(system).toContain("architectureReview");
63
+ expect(system).toContain("delegationOptimization");
64
+ });
65
+ });
66
+
67
+ describe("Architectural Principles", () => {
68
+ it("should follow shared global state principle", () => {
69
+ const system = architect.system;
70
+ expect(system).toContain("shared global state where possible");
71
+ expect(system).toContain("single source of truth");
72
+ });
73
+
74
+ it("should implement SOLID principles", () => {
75
+ const system = architect.system;
76
+ expect(system).toContain("SOLID principles");
77
+ expect(system).toContain("clean architecture");
78
+ });
79
+
80
+ it("should reference Universal Development Codex", () => {
81
+ const system = architect.system;
82
+ expect(system).toContain("Universal Development Codex v1.2.25");
83
+ });
84
+ });
85
+
86
+ describe("Tools Configuration", () => {
87
+ it("should have architecture-specific tools", () => {
88
+ expect(architect.tools?.include).toContain("read");
89
+ expect(architect.tools?.include).toContain("grep");
90
+ expect(architect.tools?.include).toContain("lsp_*");
91
+ expect(architect.tools?.include).toContain("run_terminal_cmd");
92
+ expect(architect.tools?.include).toContain("background_task");
93
+ expect(architect.tools?.include).toContain("lsp_goto_definition");
94
+ expect(architect.tools?.include).toContain("lsp_find_references");
95
+ });
96
+ });
97
+
98
+ describe("Integration Points", () => {
99
+ it("should define architectural integration points", () => {
100
+ const system = architect.system;
101
+ expect(system).toContain("Integration Points");
102
+ expect(system).toContain("State Manager");
103
+ expect(system).toContain("Delegation System");
104
+ expect(system).toContain("Boot Orchestrator");
105
+ expect(system).toContain("Monitoring System");
106
+ });
107
+ });
108
+ });
@@ -0,0 +1,246 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { bugTriageSpecialist } from "../../agents/bug-triage-specialist.js";
3
+ import type { AgentConfig } from "../../agents/types.js";
4
+
5
+ describe("Bug Triage Specialist Agent Configuration", () => {
6
+ it("should be a valid AgentConfig object", () => {
7
+ const config: AgentConfig = bugTriageSpecialist;
8
+ expect(config).toBeDefined();
9
+ });
10
+
11
+ describe("Basic Configuration", () => {
12
+ it("should have correct name and model", () => {
13
+ expect(bugTriageSpecialist.name).toBe("bug-triage-specialist");
14
+ expect(bugTriageSpecialist.model).toBe("opencode/grok-code");
15
+ });
16
+
17
+ it("should be configured as subagent mode", () => {
18
+ expect(bugTriageSpecialist.mode).toBe("subagent");
19
+ });
20
+
21
+ it("should have low temperature for consistent triage decisions", () => {
22
+ expect(bugTriageSpecialist.temperature).toBe(0.1);
23
+ });
24
+ });
25
+
26
+ describe("Description and System Prompt", () => {
27
+ it("should have appropriate bug triage description", () => {
28
+ expect(bugTriageSpecialist.description).toContain(
29
+ "StringRay Framework bug triage specialist",
30
+ );
31
+ expect(bugTriageSpecialist.description).toContain(
32
+ "systematic error investigation",
33
+ );
34
+ expect(bugTriageSpecialist.description).toContain("surgical fixes");
35
+ });
36
+
37
+ it("should have comprehensive bug triage specialist system prompt", () => {
38
+ const system = bugTriageSpecialist.system;
39
+ expect(system).toContain("StringRay Bug Triage Specialist");
40
+ expect(system).toContain("systematic error investigation");
41
+ expect(system).toContain("surgical code fixes");
42
+ });
43
+ });
44
+
45
+ describe("Core Responsibilities", () => {
46
+ it("should define 5 core bug triage responsibilities", () => {
47
+ const system = bugTriageSpecialist.system;
48
+ expect(system).toContain("Error Investigation");
49
+ expect(system).toContain("Surgical Fixes");
50
+ expect(system).toContain("Impact Assessment");
51
+ expect(system).toContain("Recovery Strategy");
52
+ expect(system).toContain("Performance Optimization");
53
+ });
54
+
55
+ it("should specify systematic error investigation", () => {
56
+ const system = bugTriageSpecialist.system;
57
+ expect(system).toContain("systematic root cause analysis");
58
+ expect(system).toContain("comprehensive investigation depth");
59
+ });
60
+
61
+ it("should specify surgical fixes approach", () => {
62
+ const system = bugTriageSpecialist.system;
63
+ expect(system).toContain("precise, targeted fixes");
64
+ expect(system).toContain("root causes");
65
+ expect(system).toContain("without side effects");
66
+ });
67
+
68
+ it("should include impact assessment", () => {
69
+ const system = bugTriageSpecialist.system;
70
+ expect(system).toContain("error severity");
71
+ expect(system).toContain("system-wide impact");
72
+ });
73
+
74
+ it("should specify recovery strategy development", () => {
75
+ const system = bugTriageSpecialist.system;
76
+ expect(system).toContain("graceful error recovery mechanisms");
77
+ });
78
+
79
+ it("should include performance optimization", () => {
80
+ const system = bugTriageSpecialist.system;
81
+ expect(system).toContain("performance bottlenecks");
82
+ });
83
+ });
84
+
85
+ describe("Key Facilities", () => {
86
+ it("should specify systematic investigation facilities", () => {
87
+ const system = bugTriageSpecialist.system;
88
+ expect(system).toContain("Systematic investigation");
89
+ expect(system).toContain("30-second root cause timeout");
90
+ });
91
+
92
+ it("should include error boundary layers", () => {
93
+ const system = bugTriageSpecialist.system;
94
+ expect(system).toContain("Error boundary layers");
95
+ expect(system).toContain("3 levels");
96
+ expect(system).toContain("circuit breaker patterns");
97
+ });
98
+
99
+ it("should specify performance profiling", () => {
100
+ const system = bugTriageSpecialist.system;
101
+ expect(system).toContain("Performance profiling");
102
+ expect(system).toContain("triage efficiency tracking");
103
+ });
104
+
105
+ it("should include bottleneck detection", () => {
106
+ const system = bugTriageSpecialist.system;
107
+ expect(system).toContain("Bottleneck detection");
108
+ expect(system).toContain("resource usage monitoring");
109
+ });
110
+
111
+ it("should define bug triage processor pipeline", () => {
112
+ const system = bugTriageSpecialist.system;
113
+ expect(system).toContain("Processor pipeline");
114
+ expect(system).toContain("error-analysis");
115
+ expect(system).toContain("root-cause-investigation");
116
+ expect(system).toContain("fix-validation");
117
+ expect(system).toContain("impact-assessment");
118
+ });
119
+ });
120
+
121
+ describe("Investigation Process", () => {
122
+ it("should define 5-phase investigation process", () => {
123
+ const system = bugTriageSpecialist.system;
124
+ expect(system).toContain("Investigation Process");
125
+ expect(system).toContain("Error Classification");
126
+ expect(system).toContain("Root Cause Analysis");
127
+ expect(system).toContain("Impact Assessment");
128
+ expect(system).toContain("Surgical Fix Development");
129
+ expect(system).toContain("Validation & Testing");
130
+ });
131
+
132
+ it("should specify error classification", () => {
133
+ const system = bugTriageSpecialist.system;
134
+ expect(system).toContain("severity");
135
+ expect(system).toContain("critical, high, medium, low");
136
+ });
137
+
138
+ it("should include root cause analysis", () => {
139
+ const system = bugTriageSpecialist.system;
140
+ expect(system).toContain("underlying causes");
141
+ expect(system).toContain("symptoms");
142
+ });
143
+
144
+ it("should specify impact assessment", () => {
145
+ const system = bugTriageSpecialist.system;
146
+ expect(system).toContain("system-wide effects");
147
+ expect(system).toContain("dependencies");
148
+ });
149
+
150
+ it("should specify surgical fix development", () => {
151
+ const system = bugTriageSpecialist.system;
152
+ expect(system).toContain("targeted fixes");
153
+ expect(system).toContain("minimal changes");
154
+ });
155
+
156
+ it("should include validation and testing", () => {
157
+ const system = bugTriageSpecialist.system;
158
+ expect(system).toContain("resolve issues");
159
+ expect(system).toContain("introducing new problems");
160
+ });
161
+ });
162
+
163
+ describe("Bug Triage Guidelines", () => {
164
+ it("should emphasize systematic investigation", () => {
165
+ const system = bugTriageSpecialist.system;
166
+ expect(system).toContain("systematic investigation");
167
+ expect(system).toContain("never guess");
168
+ });
169
+
170
+ it("should specify surgical fixes", () => {
171
+ const system = bugTriageSpecialist.system;
172
+ expect(system).toContain("surgical fixes");
173
+ expect(system).toContain("change only what's necessary");
174
+ });
175
+
176
+ it("should require thorough validation", () => {
177
+ const system = bugTriageSpecialist.system;
178
+ expect(system).toContain("Validate fixes thoroughly");
179
+ expect(system).toContain("deployment");
180
+ });
181
+
182
+ it("should maintain error boundary integrity", () => {
183
+ const system = bugTriageSpecialist.system;
184
+ expect(system).toContain("error boundary integrity");
185
+ });
186
+
187
+ it("should specify documentation requirements", () => {
188
+ const system = bugTriageSpecialist.system;
189
+ expect(system).toContain("detailed fix documentation");
190
+ });
191
+ });
192
+
193
+ describe("Integration Points", () => {
194
+ it("should define comprehensive bug triage integration points", () => {
195
+ const system = bugTriageSpecialist.system;
196
+ expect(system).toContain("Integration Points");
197
+ expect(system).toContain("Error monitoring");
198
+ expect(system).toContain("Performance tracking");
199
+ expect(system).toContain("Code analysis");
200
+ expect(system).toContain("Automated testing");
201
+ });
202
+ });
203
+
204
+ describe("Tools Configuration", () => {
205
+ it("should have comprehensive bug triage tools", () => {
206
+ expect(bugTriageSpecialist.tools?.include).toContain("read");
207
+ expect(bugTriageSpecialist.tools?.include).toContain("grep");
208
+ expect(bugTriageSpecialist.tools?.include).toContain("lsp_*");
209
+ expect(bugTriageSpecialist.tools?.include).toContain("run_terminal_cmd");
210
+ expect(bugTriageSpecialist.tools?.include).toContain("ast_grep_search");
211
+ expect(bugTriageSpecialist.tools?.include).toContain("ast_grep_replace");
212
+ expect(bugTriageSpecialist.tools?.include).toContain("lsp_diagnostics");
213
+ expect(bugTriageSpecialist.tools?.include).toContain("lsp_code_actions");
214
+ });
215
+
216
+ it("should have 8 bug triage-specific tools", () => {
217
+ expect(bugTriageSpecialist.tools?.include).toHaveLength(8);
218
+ });
219
+ });
220
+
221
+ describe("Permissions Configuration", () => {
222
+ it("should allow edit operations", () => {
223
+ expect(bugTriageSpecialist.permission?.edit).toBe("allow");
224
+ });
225
+
226
+ it("should have bug triage tool permissions", () => {
227
+ const bashPerms = bugTriageSpecialist.permission?.bash;
228
+ expect(bashPerms).toBeDefined();
229
+ expect(typeof bashPerms).toBe("object");
230
+
231
+ expect((bashPerms as any)?.git).toBe("allow");
232
+ expect((bashPerms as any)?.npm).toBe("allow");
233
+ expect((bashPerms as any)?.bun).toBe("allow");
234
+ expect((bashPerms as any)?.test).toBe("allow");
235
+ });
236
+ });
237
+
238
+ describe("Bug Triage Goal", () => {
239
+ it("should define clear bug elimination goal", () => {
240
+ const system = bugTriageSpecialist.system;
241
+ expect(system).toContain("eliminate bugs");
242
+ expect(system).toContain("systematic investigation");
243
+ expect(system).toContain("strengthen system reliability");
244
+ });
245
+ });
246
+ });
@@ -0,0 +1,242 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { codeReviewer } from "../../agents/code-reviewer.js";
3
+ import type { AgentConfig } from "../../agents/types.js";
4
+
5
+ describe("Code Reviewer Agent Configuration", () => {
6
+ it("should be a valid AgentConfig object", () => {
7
+ const config: AgentConfig = codeReviewer;
8
+ expect(config).toBeDefined();
9
+ });
10
+
11
+ describe("Basic Configuration", () => {
12
+ it("should have correct name and model", () => {
13
+ expect(codeReviewer.name).toBe("code-reviewer");
14
+ expect(codeReviewer.model).toBe("opencode/grok-code");
15
+ });
16
+
17
+ it("should be configured as subagent mode", () => {
18
+ expect(codeReviewer.mode).toBe("subagent");
19
+ });
20
+
21
+ it("should have low temperature for consistent review standards", () => {
22
+ expect(codeReviewer.temperature).toBe(0.1);
23
+ });
24
+ });
25
+
26
+ describe("Description and System Prompt", () => {
27
+ it("should have appropriate code review description", () => {
28
+ expect(codeReviewer.description).toContain(
29
+ "StringRay Framework code reviewer",
30
+ );
31
+ expect(codeReviewer.description).toContain("monitoring");
32
+ expect(codeReviewer.description).toContain("analytics");
33
+ expect(codeReviewer.description).toContain("quality assurance");
34
+ });
35
+
36
+ it("should have comprehensive code reviewer system prompt", () => {
37
+ const system = codeReviewer.system;
38
+ expect(system).toContain("StringRay Code Reviewer");
39
+ expect(system).toContain("code quality assurance");
40
+ expect(system).toContain("monitoring");
41
+ expect(system).toContain("comprehensive analysis");
42
+ });
43
+ });
44
+
45
+ describe("Core Responsibilities", () => {
46
+ it("should define 5 core code review responsibilities", () => {
47
+ const system = codeReviewer.system;
48
+ expect(system).toContain("Code Quality Assessment");
49
+ expect(system).toContain("Monitoring & Analytics");
50
+ expect(system).toContain("Best Practice Validation");
51
+ expect(system).toContain("Security Review");
52
+ expect(system).toContain("Performance Impact Analysis");
53
+ });
54
+
55
+ it("should reference Universal Development Codex", () => {
56
+ const system = codeReviewer.system;
57
+ expect(system).toContain("Universal Development Codex v1.2.25");
58
+ });
59
+
60
+ it("should specify monitoring and analytics capabilities", () => {
61
+ const system = codeReviewer.system;
62
+ expect(system).toContain("review throughput");
63
+ expect(system).toContain("quality scores");
64
+ expect(system).toContain("performance patterns");
65
+ });
66
+
67
+ it("should include security review responsibilities", () => {
68
+ const system = codeReviewer.system;
69
+ expect(system).toContain("security vulnerabilities");
70
+ expect(system).toContain("compliance issues");
71
+ });
72
+
73
+ it("should specify performance impact analysis", () => {
74
+ const system = codeReviewer.system;
75
+ expect(system).toContain("performance implications");
76
+ });
77
+ });
78
+
79
+ describe("Key Facilities", () => {
80
+ it("should specify monitoring facilities", () => {
81
+ const system = codeReviewer.system;
82
+ expect(system).toContain("Real-time monitoring");
83
+ expect(system).toContain("review_throughput");
84
+ expect(system).toContain("quality_score_trends");
85
+ expect(system).toContain("false_positive_rate");
86
+ });
87
+
88
+ it("should include analytics engine capabilities", () => {
89
+ const system = codeReviewer.system;
90
+ expect(system).toContain("Analytics engine");
91
+ expect(system).toContain("performance patterns");
92
+ expect(system).toContain("predictive models");
93
+ expect(system).toContain("defect detection");
94
+ });
95
+
96
+ it("should define review processor pipeline", () => {
97
+ const system = codeReviewer.system;
98
+ expect(system).toContain("Processor pipeline");
99
+ expect(system).toContain("quality-assessment");
100
+ expect(system).toContain("compliance-validation");
101
+ expect(system).toContain("security-review");
102
+ expect(system).toContain("performance-impact");
103
+ });
104
+
105
+ it("should specify alert thresholds", () => {
106
+ const system = codeReviewer.system;
107
+ expect(system).toContain("Alert thresholds");
108
+ expect(system).toContain("20s response time");
109
+ expect(system).toContain("2% error rate");
110
+ expect(system).toContain("200MB memory usage");
111
+ });
112
+ });
113
+
114
+ describe("Review Process", () => {
115
+ it("should define 5-phase review process", () => {
116
+ const system = codeReviewer.system;
117
+ expect(system).toContain("Review Process");
118
+ expect(system).toContain("Static Analysis");
119
+ expect(system).toContain("Security Scanning");
120
+ expect(system).toContain("Performance Review");
121
+ expect(system).toContain("Architecture Validation");
122
+ expect(system).toContain("Documentation Review");
123
+ });
124
+
125
+ it("should specify static analysis phase", () => {
126
+ const system = codeReviewer.system;
127
+ expect(system).toContain("Automated code quality checks");
128
+ expect(system).toContain("linting");
129
+ });
130
+
131
+ it("should include security scanning", () => {
132
+ const system = codeReviewer.system;
133
+ expect(system).toContain("Vulnerability detection");
134
+ expect(system).toContain("security best practice validation");
135
+ });
136
+
137
+ it("should specify performance review", () => {
138
+ const system = codeReviewer.system;
139
+ expect(system).toContain("Impact assessment");
140
+ expect(system).toContain("system performance");
141
+ expect(system).toContain("scalability");
142
+ });
143
+
144
+ it("should include architecture validation", () => {
145
+ const system = codeReviewer.system;
146
+ expect(system).toContain("design principles");
147
+ expect(system).toContain("patterns");
148
+ });
149
+
150
+ it("should specify documentation review", () => {
151
+ const system = codeReviewer.system;
152
+ expect(system).toContain("code documentation");
153
+ expect(system).toContain("maintainability");
154
+ });
155
+ });
156
+
157
+ describe("Review Guidelines", () => {
158
+ it("should reference all 43 codex terms validation", () => {
159
+ const system = codeReviewer.system;
160
+ expect(system).toContain("all 43 codex terms");
161
+ });
162
+
163
+ it("should prioritize correctness over style", () => {
164
+ const system = codeReviewer.system;
165
+ expect(system).toContain("correctness over style");
166
+ });
167
+
168
+ it("should provide actionable feedback", () => {
169
+ const system = codeReviewer.system;
170
+ expect(system).toContain("actionable feedback");
171
+ expect(system).toContain("specific recommendations");
172
+ });
173
+
174
+ it("should consider multiple quality dimensions", () => {
175
+ const system = codeReviewer.system;
176
+ expect(system).toContain("performance");
177
+ expect(system).toContain("security");
178
+ expect(system).toContain("maintainability");
179
+ });
180
+
181
+ it("should use data-driven insights", () => {
182
+ const system = codeReviewer.system;
183
+ expect(system).toContain("data-driven insights");
184
+ expect(system).toContain("monitoring and analytics");
185
+ });
186
+ });
187
+
188
+ describe("Integration Points", () => {
189
+ it("should define comprehensive code review integration points", () => {
190
+ const system = codeReviewer.system;
191
+ expect(system).toContain("Integration Points");
192
+ expect(system).toContain("Code analysis and LSP integration");
193
+ expect(system).toContain("Security scanning");
194
+ expect(system).toContain("Performance monitoring");
195
+ expect(system).toContain("Automated testing");
196
+ expect(system).toContain("Documentation generation");
197
+ });
198
+ });
199
+
200
+ describe("Tools Configuration", () => {
201
+ it("should have comprehensive code analysis tools", () => {
202
+ expect(codeReviewer.tools?.include).toContain("read");
203
+ expect(codeReviewer.tools?.include).toContain("grep");
204
+ expect(codeReviewer.tools?.include).toContain("lsp_*");
205
+ expect(codeReviewer.tools?.include).toContain("run_terminal_cmd");
206
+ expect(codeReviewer.tools?.include).toContain("lsp_diagnostics");
207
+ expect(codeReviewer.tools?.include).toContain("lsp_code_actions");
208
+ expect(codeReviewer.tools?.include).toContain("lsp_code_action_resolve");
209
+ });
210
+
211
+ it("should have 7 code review-specific tools", () => {
212
+ expect(codeReviewer.tools?.include).toHaveLength(7);
213
+ });
214
+ });
215
+
216
+ describe("Permissions Configuration", () => {
217
+ it("should allow edit operations", () => {
218
+ expect(codeReviewer.permission?.edit).toBe("allow");
219
+ });
220
+
221
+ it("should have code quality tool permissions", () => {
222
+ const bashPerms = codeReviewer.permission?.bash;
223
+ expect(bashPerms).toBeDefined();
224
+ expect(typeof bashPerms).toBe("object");
225
+
226
+ expect((bashPerms as any)?.git).toBe("allow");
227
+ expect((bashPerms as any)?.npm).toBe("allow");
228
+ expect((bashPerms as any)?.bun).toBe("allow");
229
+ expect((bashPerms as any)?.eslint).toBe("allow");
230
+ expect((bashPerms as any)?.prettier).toBe("allow");
231
+ });
232
+ });
233
+
234
+ describe("Code Quality Goal", () => {
235
+ it("should define clear code quality maintenance goal", () => {
236
+ const system = codeReviewer.system;
237
+ expect(system).toContain("highest standards of code quality");
238
+ expect(system).toContain("actionable insights");
239
+ expect(system).toContain("continuous improvement");
240
+ });
241
+ });
242
+ });