Skip to content

Commit b0bb6c7

Browse files
committed
chore: fix HookEngine typings and add CI workflow
1 parent 4fe5e0a commit b0bb6c7

File tree

4 files changed

+95
-225
lines changed

4 files changed

+95
-225
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Setup Node.js and pnpm
18+
uses: ./.github/actions/setup-node-pnpm
19+
- name: Run linter
20+
run: pnpm lint
21+
22+
type-check:
23+
name: Type Check
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
- name: Setup Node.js and pnpm
29+
uses: ./.github/actions/setup-node-pnpm
30+
- name: Check TypeScript types
31+
run: pnpm check-types
32+
33+
test:
34+
name: Test
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v4
39+
- name: Setup Node.js and pnpm
40+
uses: ./.github/actions/setup-node-pnpm
41+
- name: Run tests
42+
run: pnpm test
43+
44+
build:
45+
name: Build
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
- name: Setup Node.js and pnpm
51+
uses: ./.github/actions/setup-node-pnpm
52+
- name: Build project
53+
run: pnpm build
54+
55+
format-check:
56+
name: Format Check
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Checkout code
60+
uses: actions/checkout@v4
61+
- name: Setup Node.js and pnpm
62+
uses: ./.github/actions/setup-node-pnpm
63+
- name: Check code formatting
64+
run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore || (echo "Code formatting check failed. Run 'pnpm format' to fix." && exit 1)
65+

Architecture.md

Lines changed: 0 additions & 169 deletions
This file was deleted.

src/core/hooks/HookEngine.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Task } from "../task/Task"
2-
import type { ToolUse, ToolName } from "../../shared/tools"
2+
import type { ToolUse } from "../../shared/tools"
3+
import type { ToolName } from "@roo-code/types"
34
import { OrchestrationDataModel, type ActiveIntent } from "../orchestration/OrchestrationDataModel"
45
import * as vscode from "vscode"
56
import * as path from "path"
@@ -111,8 +112,9 @@ export class HookEngine {
111112

112113
// Load intent details (for authorization prompt + scope checks)
113114
if (!activeIntent) {
114-
activeIntent = await this.dataModel.getIntent(activeIntentId)
115-
if (activeIntent) {
115+
const loadedIntent = await this.dataModel.getIntent(activeIntentId)
116+
if (loadedIntent) {
117+
activeIntent = loadedIntent
116118
;(task as any).activeIntent = activeIntent
117119
}
118120
}

src/core/tools/__tests__/selectActiveIntentTool.spec.ts

Lines changed: 25 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,11 @@ describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => {
111111
)
112112

113113
// Execute: Call select_active_intent
114-
const toolUse: ToolUse<"select_active_intent"> = {
115-
type: "tool_use",
116-
id: "tool-1",
117-
name: "select_active_intent",
118-
params: { intent_id: "INT-001" },
119-
}
120-
121-
await selectActiveIntentTool.execute(
122-
{ intent_id: "INT-001" },
123-
mockTask,
124-
{
125-
askApproval: vi.fn(),
126-
handleError: mockHandleError,
127-
pushToolResult: mockPushToolResult,
128-
},
129-
)
114+
await selectActiveIntentTool.execute({ intent_id: "INT-001" }, mockTask, {
115+
askApproval: vi.fn(),
116+
handleError: mockHandleError,
117+
pushToolResult: mockPushToolResult,
118+
})
130119

131120
// Verify: pushToolResult was called with XML context
132121
expect(mockPushToolResult).toHaveBeenCalledTimes(1)
@@ -178,15 +167,11 @@ describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => {
178167
await fs.writeFile(tracePath, "", "utf-8")
179168

180169
// Execute
181-
await selectActiveIntentTool.execute(
182-
{ intent_id: "INT-002" },
183-
mockTask,
184-
{
185-
askApproval: vi.fn(),
186-
handleError: mockHandleError,
187-
pushToolResult: mockPushToolResult,
188-
},
189-
)
170+
await selectActiveIntentTool.execute({ intent_id: "INT-002" }, mockTask, {
171+
askApproval: vi.fn(),
172+
handleError: mockHandleError,
173+
pushToolResult: mockPushToolResult,
174+
})
190175

191176
// Verify: XML contains "No recent changes" message
192177
const contextXml = mockPushToolResult.mock.calls[0][0]
@@ -261,15 +246,11 @@ describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => {
261246
)
262247

263248
// Execute: Select INT-001
264-
await selectActiveIntentTool.execute(
265-
{ intent_id: "INT-001" },
266-
mockTask,
267-
{
268-
askApproval: vi.fn(),
269-
handleError: mockHandleError,
270-
pushToolResult: mockPushToolResult,
271-
},
272-
)
249+
await selectActiveIntentTool.execute({ intent_id: "INT-001" }, mockTask, {
250+
askApproval: vi.fn(),
251+
handleError: mockHandleError,
252+
pushToolResult: mockPushToolResult,
253+
})
273254

274255
// Verify: Only INT-001 trace entry is included
275256
const contextXml = mockPushToolResult.mock.calls[0][0]
@@ -285,15 +266,11 @@ describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => {
285266
await fs.writeFile(intentsPath, intentsYaml, "utf-8")
286267

287268
// Execute
288-
await selectActiveIntentTool.execute(
289-
{ intent_id: "INT-999" },
290-
mockTask,
291-
{
292-
askApproval: vi.fn(),
293-
handleError: mockHandleError,
294-
pushToolResult: mockPushToolResult,
295-
},
296-
)
269+
await selectActiveIntentTool.execute({ intent_id: "INT-999" }, mockTask, {
270+
askApproval: vi.fn(),
271+
handleError: mockHandleError,
272+
pushToolResult: mockPushToolResult,
273+
})
297274

298275
// Verify: Error was returned
299276
expect(mockPushToolResult).toHaveBeenCalled()
@@ -304,20 +281,15 @@ describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => {
304281

305282
it("should handle missing intent_id parameter", async () => {
306283
// Execute without intent_id
307-
await selectActiveIntentTool.execute(
308-
{ intent_id: "" },
309-
mockTask,
310-
{
311-
askApproval: vi.fn(),
312-
handleError: mockHandleError,
313-
pushToolResult: mockPushToolResult,
314-
},
315-
)
284+
await selectActiveIntentTool.execute({ intent_id: "" }, mockTask, {
285+
askApproval: vi.fn(),
286+
handleError: mockHandleError,
287+
pushToolResult: mockPushToolResult,
288+
})
316289

317290
// Verify: Missing parameter error
318291
expect(mockSayAndCreateMissingParamError).toHaveBeenCalledWith("select_active_intent", "intent_id")
319292
expect(mockTask.consecutiveMistakeCount).toBeGreaterThan(0)
320293
})
321294
})
322295
})
323-

0 commit comments

Comments
 (0)