@codexa/cli 9.0.3 → 9.0.5

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.
@@ -0,0 +1,100 @@
1
+ /**
2
+ * v9.3: Tests for AGENT_SECTIONS filtering (P3.1 — Context Intelligence)
3
+ */
4
+ import { describe, it, expect } from "bun:test";
5
+ import { AGENT_SECTIONS } from "./utils";
6
+
7
+ describe("AGENT_SECTIONS (P3.1 — Context Intelligence)", () => {
8
+ it("testing-unit gets focused sections without PRODUTO or STACK", () => {
9
+ const sections = AGENT_SECTIONS["testing-unit"];
10
+ expect(sections).toBeDefined();
11
+ expect(sections).toContain("STANDARDS");
12
+ expect(sections).toContain("DECISOES");
13
+ expect(sections).toContain("ALERTAS");
14
+ expect(sections).toContain("PATTERNS");
15
+ expect(sections).toContain("UTILITIES");
16
+ expect(sections).toContain("HINTS");
17
+ expect(sections).not.toContain("PRODUTO");
18
+ expect(sections).not.toContain("STACK");
19
+ expect(sections).not.toContain("ARQUITETURA");
20
+ });
21
+
22
+ it("deep-explore gets minimal sections", () => {
23
+ const sections = AGENT_SECTIONS["deep-explore"];
24
+ expect(sections).toBeDefined();
25
+ expect(sections).toHaveLength(2);
26
+ expect(sections).toContain("STACK");
27
+ expect(sections).toContain("ARQUITETURA");
28
+ expect(sections).not.toContain("HINTS");
29
+ });
30
+
31
+ it("security-specialist gets security-relevant sections", () => {
32
+ const sections = AGENT_SECTIONS["security-specialist"];
33
+ expect(sections).toBeDefined();
34
+ expect(sections).toContain("STANDARDS");
35
+ expect(sections).toContain("DECISOES");
36
+ expect(sections).toContain("ALERTAS");
37
+ expect(sections).toContain("STACK");
38
+ expect(sections).toContain("HINTS");
39
+ expect(sections).not.toContain("PATTERNS");
40
+ expect(sections).not.toContain("UTILITIES");
41
+ });
42
+
43
+ it("expert-code-reviewer gets review-relevant sections", () => {
44
+ const sections = AGENT_SECTIONS["expert-code-reviewer"];
45
+ expect(sections).toBeDefined();
46
+ expect(sections).toContain("STANDARDS");
47
+ expect(sections).toContain("DECISOES");
48
+ expect(sections).toContain("ARQUITETURA");
49
+ expect(sections).toContain("UTILITIES");
50
+ expect(sections).toContain("ALERTAS");
51
+ expect(sections).toContain("HINTS");
52
+ expect(sections).not.toContain("PRODUTO");
53
+ });
54
+
55
+ it("unknown agent types are not in the map (get all sections)", () => {
56
+ expect(AGENT_SECTIONS["frontend-next"]).toBeUndefined();
57
+ expect(AGENT_SECTIONS["database-postgres"]).toBeUndefined();
58
+ expect(AGENT_SECTIONS["backend-javascript"]).toBeUndefined();
59
+ expect(AGENT_SECTIONS["general-purpose"]).toBeUndefined();
60
+ });
61
+
62
+ it("filtering logic: known agent filters sections", () => {
63
+ const allSections = [
64
+ { name: "PRODUTO", content: "...", priority: 7 },
65
+ { name: "STANDARDS", content: "...", priority: 1 },
66
+ { name: "ALERTAS", content: "...", priority: 2 },
67
+ { name: "STACK", content: "...", priority: 11 },
68
+ { name: "ARQUITETURA", content: "...", priority: 3 },
69
+ { name: "DECISOES", content: "...", priority: 4 },
70
+ { name: "PATTERNS", content: "...", priority: 9 },
71
+ ];
72
+
73
+ const agentType = "deep-explore";
74
+ const allowed = AGENT_SECTIONS[agentType];
75
+ const filtered = allowed
76
+ ? allSections.filter(s => allowed.includes(s.name))
77
+ : allSections;
78
+
79
+ expect(filtered).toHaveLength(2);
80
+ expect(filtered.map(s => s.name)).toContain("STACK");
81
+ expect(filtered.map(s => s.name)).toContain("ARQUITETURA");
82
+ expect(filtered.map(s => s.name)).not.toContain("PRODUTO");
83
+ expect(filtered.map(s => s.name)).not.toContain("STANDARDS");
84
+ });
85
+
86
+ it("filtering logic: unknown agent keeps all sections", () => {
87
+ const allSections = [
88
+ { name: "PRODUTO", content: "...", priority: 7 },
89
+ { name: "STANDARDS", content: "...", priority: 1 },
90
+ ];
91
+
92
+ const agentType = "frontend-next"; // not in AGENT_SECTIONS
93
+ const allowed = AGENT_SECTIONS[agentType];
94
+ const filtered = allowed
95
+ ? allSections.filter(s => allowed.includes(s.name))
96
+ : allSections;
97
+
98
+ expect(filtered).toHaveLength(2); // All kept
99
+ });
100
+ });