Skip to content

Commit e95c6b2

Browse files
committed
chore(claude): Add constraints and context for claude code review
1 parent 48ce54f commit e95c6b2

File tree

2 files changed

+89
-17
lines changed

2 files changed

+89
-17
lines changed

.github/claude-review-guide.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Claude Review Guide — appium-desktop-driver
2+
3+
## Project Context
4+
5+
This is a **Windows desktop UI automation Appium driver** (`NovaWindows`). It bridges WebDriver protocol to Windows UI Automation (UIA3) via a persistent PowerShell process. An MCP server layered on top exposes tools for AI agent use.
6+
7+
Key stack: TypeScript, Node.js, Appium BaseDriver, PowerShell, koffi FFI (user32.dll), WebdriverIO (MCP client).
8+
9+
---
10+
11+
## Severity Format
12+
13+
Use this format for findings:
14+
15+
```
16+
[BLOCKER] — Must be fixed before merge. Security or correctness issue.
17+
[HIGH] — Significant bug or reliability issue; should be fixed.
18+
[MEDIUM] — Non-critical issue worth addressing.
19+
[LOW] — Minor style, naming, or improvement suggestion.
20+
[INFO] — Observation or question, no action required.
21+
```
22+
23+
---
24+
25+
## Security Checklist
26+
27+
### PowerShell Injection
28+
- [ ] User-supplied strings (capability values, element attributes, script arguments) are **never** interpolated raw into PowerShell strings
29+
- [ ] `executeScript` payloads that build PS commands use proper escaping or parameterized construction
30+
- [ ] Capability values used in pre/postrun scripts are validated and sanitized
31+
32+
### FFI / native bindings
33+
- [ ] `user32.dll` calls in `lib/winapi/user32.ts` validate coordinate ranges and handle types before passing to native
34+
- [ ] koffi struct definitions match actual Windows API signatures
35+
36+
### Secrets & credentials
37+
- [ ] No API keys, tokens, or passwords in source code or test fixtures
38+
- [ ] Capability values for app launch do not log sensitive data
39+
40+
---
41+
42+
## Testing Standards
43+
44+
- Unit tests live in `test/` and use **Vitest**
45+
- New utility functions in `lib/` should have corresponding unit tests
46+
- PowerShell condition builders (`lib/powershell/conditions.ts`, `converter.ts`) and XPath evaluator (`lib/xpath/`) are well-covered — changes here need tests
47+
- E2E tests require a real Windows environment; don't flag missing E2E coverage for pure logic changes
48+
49+
---
50+
51+
## Architecture Rules
52+
53+
### Session lifecycle
54+
- `createSession()` must start the PowerShell process cleanly
55+
- `deleteSession()` must kill the PS process and clear all session state (element cache, capabilities)
56+
- Any async work initiated during session must be awaited or cancelled on teardown
57+
58+
### Element handles
59+
- Element IDs are ephemeral — they map to live UIA3 elements that can become stale
60+
- Code that caches element references must handle `ElementNotFound` / stale element gracefully
61+
62+
### Command routing
63+
- All new driver commands must be exported from `lib/commands/index.ts` and follow the existing mixin pattern
64+
- MCP tools in `lib/mcp/tools/` must map cleanly to existing driver commands — avoid duplicating logic
65+
66+
### Error handling
67+
- Driver errors must be wrapped in Appium error classes (e.g., `NoSuchElementError`, `InvalidArgumentError`)
68+
- Raw PowerShell stderr should not be surfaced verbatim to the WebDriver client
69+
- MCP tool errors should return structured error responses, not throw
70+
71+
---
72+
73+
## Code Style
74+
75+
- TypeScript strict mode is on — no `any` unless unavoidable and justified
76+
- Prefer `async/await` over raw Promise chains
77+
- `@/` path alias resolves to `lib/` — use it for imports within the library
78+
- Avoid adding unnecessary abstraction layers for single-use logic
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
name: Claude Code Review
22

33
on:
4-
pull_request:
5-
types: [opened, synchronize, ready_for_review, reopened]
6-
# Optional: Only run on specific file changes
7-
# paths:
8-
# - "src/**/*.ts"
9-
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
4+
issue_comment:
5+
types: [created]
126

137
jobs:
148
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
9+
# Only run when an owner/member comments "/review" on a PR
10+
if: |
11+
github.event.issue.pull_request != null &&
12+
contains(github.event.comment.body, '/review') &&
13+
(
14+
github.event.comment.author_association == 'OWNER' ||
15+
github.event.comment.author_association == 'MEMBER'
16+
)
2017
2118
runs-on: ubuntu-latest
2219
permissions:
@@ -38,7 +35,4 @@ jobs:
3835
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3936
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
4037
plugins: 'code-review@claude-code-plugins'
41-
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42-
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43-
# or https://code.claude.com/docs/en/cli-reference for available options
44-
38+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.issue.number }}'

0 commit comments

Comments
 (0)