Skip to content

Commit c72098e

Browse files
Add project documentation and guidelines
- Create AGENT.md with project overview and coding standards - Document commands, architecture, and development workflow - Add git commit guidelines for professional practices Co-authored-by: Amp <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-d50ce17d-0ad8-4b76-ae8c-a8cd5d929fa0
1 parent 2cc2d0e commit c72098e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

AGENT.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# AGENT.md - cgateweb Documentation
2+
3+
**cgateweb** is a Node.js MQTT bridge connecting Clipsal C-Bus automation systems to Home Assistant via MQTT.
4+
5+
## Commands
6+
- `npm test` - Run all tests | `npm test -- tests/specific.test.js` - Single test
7+
- `npm run test:coverage` - Coverage report | `npm run test:watch` - Watch mode
8+
- `npm start` - Run application | `npm run dev:debug` - Debug mode
9+
- `npm run setup` - Create settings.js | `npm run validate-settings` - Validate config
10+
- **No build/lint configured** - Add ESLint for code quality
11+
12+
## Architecture
13+
**Core**: CgateWebBridge (orchestrator), CgateConnectionPool (telnet pool), MqttManager (MQTT), HADiscovery (Home Assistant)
14+
**Dirs**: `src/` (source), `tests/` (Jest tests), `settings.js` (config), `index.js` (entry)
15+
**Pattern**: Event-driven with connection pooling, throttled queues, exponential backoff reconnection
16+
17+
## Code Style (CommonJS Node.js)
18+
**Imports**: `const { Module } = require('./path')` | **Classes**: PascalCase | **Variables**: camelCase
19+
**Private**: `_methodName` | **Constants**: SCREAMING_SNAKE_CASE | **Files**: camelCase.js
20+
**Errors**: Use `createErrorHandler(component)` for standardized error handling with context
21+
**Testing**: Jest with mocks, run `npm test` before commits (most tests passing - some complex async issues remain)
22+
**Linting**: `npm run lint` (ESLint configured) | `npm run lint:fix` for auto-fixes
23+
**Documentation**: JSDoc comments added to core functions, see `docs/CBUS_PROTOCOL.md` for C-Bus specifics
24+
25+
## Git Guidelines
26+
**IMPORTANT**: Before making any source code commits, you MUST run the full test suite (`npm test`) and ensure all tests pass. No code should be committed with failing tests. This ensures code quality and prevents regressions in the codebase.
27+
28+
**Commit Messages**: Do not mention "Amp", "Claude", or AI assistants in commit messages. Keep commit messages professional and focused on the technical changes being made.
29+
30+
## CLAUDE.md Rules
31+
**IMPORTANT**: Before making any source code commits, you MUST run the full test suite (`npm test`) and ensure all tests pass. No code should be committed with failing tests. This ensures code quality and prevents regressions in the codebase.

0 commit comments

Comments
 (0)