|
| 1 | +# EasyChat Agent Guide |
| 2 | + |
| 3 | +This file is the root instruction file for agents working in this repository. |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +These instructions apply to the entire repository unless a deeper `AGENTS.md` overrides them. |
| 8 | + |
| 9 | +## First Read |
| 10 | + |
| 11 | +Before making non-trivial changes, read the following files under `.rules/` and treat them as repository rules: |
| 12 | + |
| 13 | +1. `.rules/project-development-guide.md` |
| 14 | +2. `.rules/i18n-architecture-rules.md` |
| 15 | +3. `.rules/unit-test-principles.md` |
| 16 | +4. `.rules/custom.md` |
| 17 | +5. `.rules/superpower.md` |
| 18 | + |
| 19 | +If there is any conflict: |
| 20 | + |
| 21 | +1. Current code behavior |
| 22 | +2. `AGENTS.md` |
| 23 | +3. `.rules/project-development-guide.md` |
| 24 | +4. Other `.rules/*` |
| 25 | + |
| 26 | +Do not ignore the rule documents just because this file exists. This file is an entry point and execution summary, not a replacement for `.rules/`. |
| 27 | + |
| 28 | +## Hard Constraints |
| 29 | + |
| 30 | +- Do not proactively read files under `mydoc/`. |
| 31 | +- Do not use git worktree and do not use worktree-related skills. |
| 32 | +- Do not use subagents. |
| 33 | +- If a superpower workflow requires writing a spec or plan, create the spec or plan when needed, but do not commit those documents unless the user explicitly asks for it. |
| 34 | +- Do not revert user changes that are unrelated to the current task. |
| 35 | + |
| 36 | +## Project Overview |
| 37 | + |
| 38 | +EasyChat is a Chrome Side Panel extension for comparing multiple AI assistants side by side. |
| 39 | + |
| 40 | +Current stack: |
| 41 | + |
| 42 | +- Chrome Extension Manifest V3 |
| 43 | +- React 19 |
| 44 | +- TypeScript |
| 45 | +- Vite |
| 46 | +- Tailwind CSS v4 plus SCSS |
| 47 | +- Vitest and React Testing Library |
| 48 | + |
| 49 | +Key entry points: |
| 50 | + |
| 51 | +- `src/entry/sidepanel/main.tsx` |
| 52 | +- `src/entry/sidepanel/App.tsx` |
| 53 | +- `src/entry/background/service-worker.ts` |
| 54 | +- `public/manifest.json` |
| 55 | + |
| 56 | +## Code Placement Rules |
| 57 | + |
| 58 | +Keep logic in the correct layer instead of pushing business behavior into React components. |
| 59 | + |
| 60 | +- `src/components`: UI rendering and local interaction only |
| 61 | +- `src/store`: app state, reducer, selectors, provider, persistence orchestration |
| 62 | +- `src/features`: domain services and business rules |
| 63 | +- `src/bots`: bot adapters, clients, parsers, registry |
| 64 | +- `src/bots/definitions`: runtime bot metadata and default model definitions |
| 65 | +- `src/i18n`: translation catalogs, provider, translation helpers |
| 66 | +- `src/types`: shared domain types |
| 67 | + |
| 68 | +When changing behavior, prefer the lowest stable layer that owns the behavior. |
| 69 | + |
| 70 | +## Product And State Invariants |
| 71 | + |
| 72 | +Preserve these repository-level invariants unless the user explicitly requests a behavior change: |
| 73 | + |
| 74 | +- The app compares multiple bots in parallel in the side panel. |
| 75 | +- History snapshots are read-only. |
| 76 | +- Bot capabilities are accessed through adapter classes, not directly from UI code. |
| 77 | +- UI must not directly implement provider/network protocol logic. |
| 78 | +- Visible bot panels are derived from layout rules rather than blindly rendering every active bot. |
| 79 | + |
| 80 | +If you suspect an older design note conflicts with the current code, prefer current code behavior and `.rules/project-development-guide.md`. |
| 81 | + |
| 82 | +## I18n Rules |
| 83 | + |
| 84 | +All user-visible copy must follow the shared i18n architecture. |
| 85 | + |
| 86 | +- Use `src/i18n/messages/*` as the source of truth for user-facing copy. |
| 87 | +- In React components, use `useI18n()`. |
| 88 | +- In non-React code, use shared translator helpers from `src/i18n`. |
| 89 | +- Do not hardcode locale branching or import locale dictionaries directly in feature or adapter code. |
| 90 | +- When adding a new message key, update both `en-US` and `zh-CN` in the same change. |
| 91 | + |
| 92 | +## Testing Rules |
| 93 | + |
| 94 | +Only add or keep tests that protect core product contracts. |
| 95 | + |
| 96 | +- Prefer tests for reducers, selectors, services, parsers, clients, and adapter behavior. |
| 97 | +- Use component tests only for real user interaction contracts. |
| 98 | +- Avoid tests that mainly lock down copy, markup shape, demo data, or incidental defaults. |
| 99 | +- Prefer factories and focused fixtures over runtime seed data. |
| 100 | + |
| 101 | +When a change affects core behavior, run the narrowest useful tests first, then broader verification if needed. |
| 102 | + |
| 103 | +## Verification Commands |
| 104 | + |
| 105 | +Use the existing npm scripts for verification: |
| 106 | + |
| 107 | +- `npm run test` |
| 108 | +- `npm run lint` |
| 109 | +- `npm run build` |
| 110 | + |
| 111 | +Choose the smallest command set that gives meaningful confidence for the change. For broad or risky changes, prefer running all relevant checks before finishing. |
| 112 | + |
| 113 | +## Working Style |
| 114 | + |
| 115 | +- Keep changes aligned with existing repository patterns. |
| 116 | +- Make minimal, targeted edits unless the user asked for refactoring. |
| 117 | +- Prefer clear, maintainable code over clever shortcuts. |
| 118 | +- Document assumptions in your response when you had to infer intent from context. |
0 commit comments