Split InstanceShell2 into focused shell modules (drawer chrome/resize, session context/cache, sidebar, right panel tabs/components) to improve maintainability while preserving behavior.
2.4 KiB
2.4 KiB
AGENT NOTES
Styling Guidelines
- Reuse the existing token & utility layers before introducing new CSS variables or custom properties. Extend
src/styles/tokens.css/src/styles/utilities.cssif a shared pattern is needed. - Keep aggregate entry files (e.g.,
src/styles/controls.css,messaging.css,panels.css) lean—they should only@importfeature-specific subfiles located insidesrc/styles/{components|messaging|panels}. - When adding new component styles, place them beside their peers in the scoped subdirectory (e.g.,
src/styles/messaging/new-part.css) and import them from the corresponding aggregator file. - Prefer smaller, focused style files (≈150 lines or less) over large monoliths. Split by component or feature area if a file grows beyond that size.
- Co-locate reusable UI patterns (buttons, selectors, dropdowns, etc.) under
src/styles/components/and avoid redefining the same utility classes elsewhere. - Document any new styling conventions or directory additions in this file so future changes remain consistent.
Coding Principles
- Favor KISS by keeping modules narrowly scoped and limiting public APIs to what callers actually need.
- Uphold DRY: share helpers via dedicated modules before copy/pasting logic across stores, components, or scripts.
- Enforce single responsibility; split large files when concerns diverge (state, actions, API, events, etc.).
- Prefer composable primitives (signals, hooks, utilities) over deep inheritance or implicit global state.
- When adding platform integrations (SSE, IPC, SDK), isolate them in thin adapters that surface typed events/actions.
File Length Guidelines (Highlight Only)
We track file size as a refactoring signal. When you touch or create files, highlight oversized files so the team can plan refactors when time permits.
- Source files: warn after ~500 lines; target limit ~800 lines
- Test files: highlight after ~1000 lines
Behavior for agents:
- Do not refactor solely to satisfy these thresholds.
- When a change touches a file that exceeds the warning/limit, mention it in your final response and include the file path and approximate line count.
- When creating new files, aim to stay under the thresholds unless there's a clear reason.
Tooling Preferences
- Use the
edittool for modifying existing files; prefer it over other editing methods. - Use the
writetool only when creating new files from scratch.