Skip to content

Commit c9e036f

Browse files
committed
chore: initialize AGENTS.md's
1 parent 93e1ba5 commit c9e036f

File tree

5 files changed

+189
-0
lines changed

5 files changed

+189
-0
lines changed

AGENTS.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,87 @@ agcp status # Show proxy status
3333
agcp doctor # Diagnose configuration
3434
```
3535

36+
## Git Workflow
37+
38+
### Commit Message Format
39+
40+
Use Conventional Commits:
41+
42+
```text
43+
<type>(<scope>): <summary>
44+
```
45+
46+
- `type`: required
47+
- `scope`: optional but preferred (module/area like `tui`, `cloudcode`, `server`, `docs`)
48+
- `summary`: imperative mood, lower-case start, no trailing period, ideally <= 72 chars
49+
50+
Examples:
51+
52+
- `feat(tui): show popup when Gemini access is disabled`
53+
- `fix(cloudcode): map disabled-account 403 to clear error`
54+
- `docs(agents): add git workflow conventions`
55+
56+
### Allowed Commit Types
57+
58+
- `feat`: new user-facing behavior
59+
- `fix`: bug fix
60+
- `refactor`: internal code change without behavior change
61+
- `perf`: performance improvement
62+
- `test`: add or update tests
63+
- `docs`: documentation-only changes
64+
- `chore`: maintenance, tooling, cleanup
65+
- `ci`: CI pipeline/workflow changes
66+
- `build`: build system/dependency changes
67+
- `style`: formatting-only (no logic change)
68+
- `revert`: revert a prior commit
69+
70+
For breaking changes, use `!`:
71+
72+
- `feat(api)!: rename responses endpoint fields`
73+
74+
And include a `BREAKING CHANGE:` footer in the commit body.
75+
76+
### Branch Naming
77+
78+
Use short descriptive names:
79+
80+
- `feat/<short-topic>`
81+
- `fix/<short-topic>`
82+
- `chore/<short-topic>`
83+
- `docs/<short-topic>`
84+
85+
Examples:
86+
87+
- `feat/tui-runtime-warning-popup`
88+
- `fix/gemini-disabled-403-mapping`
89+
90+
### Commit Hygiene
91+
92+
- Keep one logical change per commit.
93+
- Run verification before commit:
94+
- `cargo fmt`
95+
- `cargo clippy -- -D warnings`
96+
- `cargo test`
97+
- Do not commit secrets, tokens, local config, or logs.
98+
- Do not amend/rewrite history unless explicitly requested.
99+
100+
### Pull Requests
101+
102+
Use this PR structure:
103+
104+
```markdown
105+
## Summary
106+
- What changed
107+
- Why it changed
108+
109+
## Verification
110+
- cargo fmt
111+
- cargo clippy -- -D warnings
112+
- cargo test
113+
```
114+
115+
Prefer small PRs with clear scope and explicit verification output.
116+
36117
## Architecture
37118

38119
```

src/AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AGENTS.md (src)
2+
3+
Scope: applies to everything under `src/`.
4+
5+
Start by reading the repository root `AGENTS.md`. This file adds source-tree specific rules.
6+
7+
## Source Rules
8+
9+
- Follow existing import order: `std` -> external crates -> `crate::*`.
10+
- Preserve existing error flow (`crate::error::{Error, Result}`) instead of ad-hoc error types.
11+
- Keep hot paths allocation-aware and prefer existing helpers/utilities.
12+
- Keep tracing structured (`request_id`, `model`, `status`, etc.) and avoid free-form log noise.
13+
- Any behavior change must include/adjust tests in the touched module.
14+
15+
## Verification by Area
16+
17+
- `src/server.rs` or request handlers changed:
18+
- `cargo test server::tests --bin agcp`
19+
- `src/cloudcode/*` changed:
20+
- `cargo test cloudcode:: --bin agcp`
21+
- `src/tui/*` changed:
22+
- `cargo test tui::app::tests --bin agcp`
23+
- `src/format/*` changed:
24+
- `cargo test format:: --bin agcp`
25+
26+
Before final handoff, run:
27+
28+
- `cargo fmt`
29+
- `cargo clippy -- -D warnings`
30+
- `cargo test`

src/cloudcode/AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AGENTS.md (src/cloudcode)
2+
3+
Scope: applies to `src/cloudcode/`.
4+
5+
Read `AGENTS.md` and `src/AGENTS.md` first.
6+
7+
## Cloud Code Client Rules
8+
9+
- Keep endpoint failover order stable unless explicitly required:
10+
- `daily-cloudcode-pa.googleapis.com`
11+
- `cloudcode-pa.googleapis.com`
12+
- Keep retry/backoff behavior coherent with existing constants and shared rate-limit helpers.
13+
- Avoid returning raw upstream provider payloads when a clear mapped error is possible.
14+
- New error mapping must include a regression test with representative upstream payload text.
15+
- Preserve request budget behavior (`MAX_WAIT_BEFORE_ERROR_MS`) and capacity retry limits.
16+
17+
## Streaming / SSE
18+
19+
- Keep SSE parser behavior compatible with existing event contracts.
20+
- Do not change event ordering or stop semantics without tests proving compatibility.
21+
22+
## Required Checks for This Area
23+
24+
- `cargo test cloudcode::client::tests --bin agcp`
25+
- `cargo test cloudcode::rate_limit::tests --bin agcp`
26+
- `cargo test cloudcode::sse::tests --bin agcp`

src/format/AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AGENTS.md (src/format)
2+
3+
Scope: applies to `src/format/`.
4+
5+
Read `AGENTS.md` and `src/AGENTS.md` first.
6+
7+
## Conversion Rules
8+
9+
- Keep Anthropic compatibility as the external contract.
10+
- When adding/changing fields, update both directions where relevant:
11+
- `to_google.rs`
12+
- `to_anthropic.rs`
13+
- OpenAI/Responses adapters when impacted.
14+
- Do not silently drop meaningful fields without an explicit reason and tests.
15+
- Preserve stop reasons, usage accounting, and tool-call semantics.
16+
17+
## Schema and Tooling Rules
18+
19+
- Keep schema sanitation deterministic and minimal.
20+
- Preserve existing behavior for tool signatures and thinking blocks.
21+
22+
## Required Checks for This Area
23+
24+
- `cargo test format::to_google::tests --bin agcp`
25+
- `cargo test format::to_anthropic::tests --bin agcp`
26+
- `cargo test format::openai_convert::tests --bin agcp`

src/tui/AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AGENTS.md (src/tui)
2+
3+
Scope: applies to `src/tui/`.
4+
5+
Read `AGENTS.md` and `src/AGENTS.md` first.
6+
7+
## TUI State and Rendering Rules
8+
9+
- Keep app state transitions in `app.rs`; keep view modules render-focused.
10+
- For modal/popup UX:
11+
- Add explicit `App` state.
12+
- Block unrelated key handling while popup is visible.
13+
- Support dismissal via `Enter` and `Esc`.
14+
- Maintain overlay precedence intentionally (help/popup/startup warnings ordering).
15+
- For log-driven warnings, normalize comparisons (case-insensitive) and test with realistic log lines.
16+
- Keep terminal-size handling and layout guards intact.
17+
18+
## Interaction Rules
19+
20+
- Mouse hit-testing should use cached rects already maintained in `App`.
21+
- Any new keyboard shortcut must not conflict with existing tab-local keybindings.
22+
23+
## Required Checks for This Area
24+
25+
- `cargo test tui::app::tests --bin agcp`
26+
- `cargo clippy -- -D warnings`

0 commit comments

Comments
 (0)