xonecas.io
64875
Mc

mini-coder / commit c5ce2be

docs: add testing strategy to AGENTS.md

xonecas2026-04-04 c5ce2beb5c19a0fbc49d9a8609cba20b4105810d parent da86847

1 file changed

AGENTS.md+43−0
@@ -4,3 +4,46 @@
44 - **TDD**: write tests first, then implement. Tests validate the spec's defined behaviors.
55 - Use Conventional Commits formatting for commit messages.
66 - Before committing code changes, review the diff with the user and get approval for the commit.
7+
8+## Testing strategy
9+
10+We test our logic at the boundaries. Never test dependencies (pi-ai, cel-tui, bun:sqlite).
11+
12+**Tools** (`shell`, `edit`, `readImage`):
13+
14+- `edit`: exact-text match/replace, multi-match failure, missing text failure, new file creation, line ending preservation, UTF-8 handling.
15+- `shell`: output truncation logic (head + tail with marker), exit code passthrough.
16+- `readImage`: base64 encoding, mime type detection, unsupported format rejection, missing file handling.
17+- Pure functions with clear inputs/outputs.
18+
19+**Session persistence** (`session.ts`):
20+
21+- CRUD operations against a real bun:sqlite in-memory database. No mocks.
22+- Turn numbering: user message gets MAX+1, subsequent messages share the turn.
23+- Undo: deletes correct turn, leaves others intact.
24+- Fork: copies all messages, new session id, preserves turn order.
25+- Cumulative stats computation from message history.
26+
27+**System prompt construction** (`prompt.ts`):
28+
29+- Assembly order: base + AGENTS.md + skills + plugins + footer.
30+- Git line formatting: branch, dirty counts, ahead/behind, omission rules.
31+- Skills catalog XML generation.
32+- Conditional readImage exclusion from prompt text.
33+
34+**Community standards discovery** (`skills.ts`, AGENTS.md loading):
35+
36+- Skill discovery: scan paths, SKILL.md parsing, frontmatter extraction, name collision resolution.
37+- AGENTS.md discovery: walk to scan root, ordering, `~/.agents/` inclusion.
38+- Use temp directories with controlled file trees.
39+
40+**Agent loop** (`agent.ts`):
41+
42+- Use pi-ai's `faux` provider for end-to-end loop tests.
43+- Verify: tool calls are executed, messages are appended in correct order, turns are numbered, interrupt preserves partial response, context limit triggers compaction.
44+
45+**Input parsing**:
46+
47+- `/skill:name rest of message` → skill body + "rest of message".
48+- `/command` detection and routing.
49+- Image path detection (entire input is an image path that exists and has a valid extension).