Skip to content

Commit 0bd6bd3

Browse files
committed
feat: add review command for pre-PR implementation validation
- Add comprehensive review command to built-in commands - Supports reviewing against GitHub issues, Slack comments, and GitHub comments - Includes workflow for analyzing code changes against requirements - Provides confidence scoring and actionable recommendations - Add comprehensive test coverage for the new command
1 parent e84008a commit 0bd6bd3

File tree

2 files changed

+549
-5
lines changed

2 files changed

+549
-5
lines changed

src/services/command/__tests__/built-in-commands.spec.ts

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ describe("Built-in Commands", () => {
55
it("should return all built-in commands", async () => {
66
const commands = await getBuiltInCommands()
77

8-
expect(commands).toHaveLength(1)
9-
expect(commands.map((cmd) => cmd.name)).toEqual(expect.arrayContaining(["init"]))
8+
expect(commands).toHaveLength(2)
9+
expect(commands.map((cmd) => cmd.name)).toEqual(expect.arrayContaining(["init", "review"]))
1010

1111
// Verify all commands have required properties
1212
commands.forEach((command) => {
@@ -31,6 +31,15 @@ describe("Built-in Commands", () => {
3131
expect(initCommand!.description).toBe(
3232
"Analyze codebase and create concise AGENTS.md files for AI assistants",
3333
)
34+
35+
const reviewCommand = commands.find((cmd) => cmd.name === "review")
36+
expect(reviewCommand).toBeDefined()
37+
expect(reviewCommand!.content).toContain("Review implementation changes")
38+
expect(reviewCommand!.content).toContain("github issue")
39+
expect(reviewCommand!.description).toBe(
40+
"Review implementation changes against original requirements before creating a pull request",
41+
)
42+
expect(reviewCommand!.argumentHint).toBe("[context]")
3443
})
3544
})
3645

@@ -48,6 +57,20 @@ describe("Built-in Commands", () => {
4857
)
4958
})
5059

60+
it("should return review command by name", async () => {
61+
const reviewCommand = await getBuiltInCommand("review")
62+
63+
expect(reviewCommand).toBeDefined()
64+
expect(reviewCommand!.name).toBe("review")
65+
expect(reviewCommand!.source).toBe("built-in")
66+
expect(reviewCommand!.filePath).toBe("<built-in:review>")
67+
expect(reviewCommand!.content).toContain("Review implementation changes")
68+
expect(reviewCommand!.description).toBe(
69+
"Review implementation changes against original requirements before creating a pull request",
70+
)
71+
expect(reviewCommand!.argumentHint).toBe("[context]")
72+
})
73+
5174
it("should return undefined for non-existent command", async () => {
5275
const nonExistentCommand = await getBuiltInCommand("non-existent")
5376
expect(nonExistentCommand).toBeUndefined()
@@ -63,10 +86,10 @@ describe("Built-in Commands", () => {
6386
it("should return all built-in command names", async () => {
6487
const names = await getBuiltInCommandNames()
6588

66-
expect(names).toHaveLength(1)
67-
expect(names).toEqual(expect.arrayContaining(["init"]))
89+
expect(names).toHaveLength(2)
90+
expect(names).toEqual(expect.arrayContaining(["init", "review"]))
6891
// Order doesn't matter since it's based on filesystem order
69-
expect(names.sort()).toEqual(["init"])
92+
expect(names.sort()).toEqual(["init", "review"])
7093
})
7194

7295
it("should return array of strings", async () => {
@@ -99,5 +122,29 @@ describe("Built-in Commands", () => {
99122
expect(content).toContain("rules-ask")
100123
expect(content).toContain("rules-architect")
101124
})
125+
126+
it("review command should have comprehensive content", async () => {
127+
const command = await getBuiltInCommand("review")
128+
const content = command!.content
129+
130+
// Should contain key sections
131+
expect(content).toContain("Review implementation changes against original requirements")
132+
expect(content).toContain("Parse Command Arguments")
133+
expect(content).toContain("Initialize Review Process")
134+
expect(content).toContain("Gather Context Information")
135+
expect(content).toContain("Generate Comprehensive Diff")
136+
expect(content).toContain("Analyze Implementation Against Requirements")
137+
138+
// Should mention important concepts
139+
expect(content).toContain("github issue")
140+
expect(content).toContain("slack comment")
141+
expect(content).toContain("github comment")
142+
expect(content).toContain("git diff")
143+
expect(content).toContain("Requirement Coverage")
144+
expect(content).toContain("Code Quality")
145+
expect(content).toContain("Security Considerations")
146+
expect(content).toContain("Confidence Score")
147+
expect(content).toContain("attempt_completion")
148+
})
102149
})
103150
})

0 commit comments

Comments
 (0)