Skip to content

Commit e822378

Browse files
authored
docs: unified agent instructions (#1564)
Consolidate AI assistant instructions into a single, concise AGENTS.md file that serves both Claude, GitHub Copilot and Codex.
1 parent 57086d1 commit e822378

File tree

2 files changed

+188
-0
lines changed

2 files changed

+188
-0
lines changed

AGENTS.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
## Project Overview
2+
3+
Devolutions Gateway is a relay server.
4+
The project is a polyglot monorepo containing:
5+
- **Rust workspace**: gateway service, agent service, jetsocat CLI tool, and dedicated testsuite
6+
- **TypeScript/Angular pnpm workspace**: web UI with multiple packages and apps
7+
- **C# desktop agent**: Windows-specific agent implementation
8+
- **PowerShell module**: management and configuration tools
9+
10+
## Guidelines
11+
12+
### Rust (Required before submitting)
13+
```bash
14+
cargo +nightly fmt --all
15+
cargo clippy --workspace --tests -- -D warnings
16+
cargo test --workspace
17+
```
18+
- Pedantic Clippy lints are enabled; THINK before suppressing.
19+
- Use `#[expect(clippy::<lint_name>, reason = "<explain why>")]` with clear reasoning.
20+
- Tests go in `testsuite/tests/`, helpers in `testsuite/src/`.
21+
- Consider `proptest` for property-based testing, `rstest` for parameterized tests.
22+
23+
### TypeScript/JavaScript (webapp/)
24+
```bash
25+
pnpm install
26+
pnpm fmt:write
27+
pnpm lint
28+
pnpm test
29+
```
30+
31+
### PowerShell
32+
```bash
33+
powershell/build.ps1
34+
powershell/run-tests.ps1
35+
```
36+
37+
### C#/.NET
38+
Follow standard .NET conventions.
39+
40+
## Git Workflow
41+
42+
### Branch Naming
43+
Use one of these formats:
44+
- **Jira ticket**: `DGW-338` (ticket ID as branch name) with optional description (e.g.: `DGW-338-websocket-compression-support`)
45+
- **GitHub issue**: Follow standard format (e.g., `fix/123-description`)
46+
47+
### Pull Request Guidelines
48+
49+
#### PR Title (Conventional Commits)
50+
Format: `<type>(<scope>): <description>`
51+
52+
**Scopes** (what appears in CHANGELOG.md):
53+
- `dgw` - Devolutions Gateway service
54+
- `agent` - Devolutions Agent service and artifacts
55+
- `jetsocat` - Jetsocat CLI tool
56+
- `webapp` - Devolutions Gateway standalone frontend ONLY
57+
58+
**Library scopes** (excluded from changelog):
59+
- `dotnet-*` - .NET libraries (e.g., `dotnet-utils`)
60+
- `ts-*` - TypeScript libraries (e.g., `ts-client`)
61+
- `*deps*`, `*openapi*`, `*npm*` - Dependency updates
62+
63+
**Types**:
64+
- `feat:` New feature
65+
- `fix:` Bug fix
66+
- `docs:` Documentation only
67+
- `style:` Code style (formatting, semicolons, etc)
68+
- `refactor:` Code restructuring without behavior change
69+
- `perf:` Performance improvements
70+
- `test:` Adding missing tests
71+
- `build:` Build system or dependencies
72+
- `ci:` CI configuration
73+
- `chore:` Maintenance tasks
74+
75+
#### PR Body
76+
- User-oriented description (what users gain/notice)
77+
- Can include technical context for developers
78+
- Avoid internal implementation details
79+
- Focus on impact and benefits
80+
- This text appears in the changelog for feat/fix/perf
81+
82+
#### PR Footer
83+
Always include issue reference:
84+
```
85+
Issue: DGW-123 (Jira ticket)
86+
Issue: #456 (GitHub issue)
87+
```
88+
89+
#### Implementation Details
90+
Add a **separate comment** after PR creation with:
91+
- Technical implementation details
92+
- Design decisions and trade-offs
93+
- Testing approach
94+
- Breaking changes or migration notes
95+
- Any context helpful for reviewers
96+
97+
#### Example PR
98+
```
99+
Title: feat(dgw): add WebSocket compression support
100+
101+
Body:
102+
Adds support for per-message deflate compression on WebSocket connections,
103+
reducing bandwidth usage by up to 70% for typical JSON payloads. This
104+
significantly improves performance for users on limited bandwidth connections.
105+
106+
Issue: DGW-338
107+
```
108+
109+
Then add comment:
110+
```
111+
Implementation notes:
112+
- Uses permessage-deflate extension (RFC 7692)
113+
- Configurable compression level (1-9, default: 6)
114+
- Memory pool for deflate contexts to avoid allocations
115+
- Benchmarks show 15% CPU increase for 70% bandwidth reduction
116+
```
117+
118+
#### Example PR (Library - not in changelog)
119+
```
120+
Title: fix(ts-client): handle reconnection timeout properly
121+
122+
Body:
123+
Fixes an issue where the TypeScript client library would not properly
124+
handle reconnection timeouts, causing infinite connection attempts.
125+
126+
Issue: DGW-422
127+
```
128+
129+
## Code Style
130+
131+
### Rust
132+
Follow the [IronRDP style guide](https://github.com/Devolutions/IronRDP/blob/master/STYLE.md).
133+
These guidelines summarize the key points for this project.
134+
135+
#### Errors
136+
- **Return types**: Use `crate_name::Result` (e.g., `anyhow::Result`), not bare `Result`.
137+
Exception: when type alias is clear (e.g., `ConnectionResult`).
138+
139+
- **Error messages**: lowercase, no punctuation, one sentence.
140+
-`"invalid X.509 certificate"`
141+
-`"Invalid X.509 certificate."`
142+
143+
#### Logging (not errors!)
144+
- **Log messages**: Capital first letter, no period.
145+
-`info!("Connect to RDP host");`
146+
-`info!("connect to RDP host.");`
147+
148+
- Use structured fields: `info!(%server_addr, "Looked up server address");`
149+
- Name fields consistently: use `error` not `e` for errors.
150+
151+
#### Comments
152+
- **Inline comments**: Full sentences with capital and period.
153+
-`// Install a very strict rule to ensure tests are limited.`
154+
-`// make sure tests can't do just anything`
155+
- Exception: brief tags (`// VER`, `// RSV`) don't need periods.
156+
157+
- **Size calculations**: Comment each field
158+
```rust
159+
const FIXED_PART_SIZE: usize =
160+
1 /* Version */ +
161+
1 /* Endianness */ +
162+
2 /* CommonHeaderLength */ +
163+
4 /* Filler */;
164+
```
165+
166+
- **Invariants**:
167+
- Define with `// INVARIANT: …`
168+
- Loop invariants: before the loop
169+
- Field invariants: in doc comments
170+
- Function output invariants: in function doc comments
171+
- When referencing in `#[expect(...)]`: don't use `INVARIANT:` prefix
172+
173+
- **Markdown**: For prose paragraphs, use one sentence per line in `.md` files.
174+
175+
### TypeScript/JavaScript
176+
Follow Angular style guide for components.
177+
178+
### PowerShell
179+
Follow standard PowerShell conventions.
180+
181+
## Additional Resources
182+
- Main README: `README.md`
183+
- Changelog: `CHANGELOG.md`
184+
- Style guide: `STYLE.md`
185+
- Web app: `webapp/README.md`
186+
- Configuration: `config_schema.json`
187+
- Cookbook: `docs/COOKBOOK.md`

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)