Files
TORCH/CONTRIBUTING.md
T
Claude 639ad6877d chore: code quality, CI/CD, and DX improvements
Phase 3 — Code Quality:
- Deduplicate nowUnix() in lock-ops.mjs (import from utils.mjs)
- Promote ESLint no-unused-vars to error, fix all 46 violations
- Remove dead code: unused imports, variables, and catch bindings
- Add /* global marked */ for CDN-loaded library in dashboard

Phase 4 — CI/CD:
- Add Node.js version matrix (22, 23) to CI workflow
- Add npm audit security scan step to CI
- Add innerHTML usage check to CI pipeline
- Enable Dependabot for npm and GitHub Actions dependencies
- Create PR template

Phase 5 — Developer Experience:
- Create .env.example documenting all environment variables
- Expand CONTRIBUTING.md with commit conventions, agent/prompt
  creation guide, architecture overview, and test integrity
- Add system architecture diagram with Mermaid (docs/architecture/)

https://claude.ai/code/session_01GfwUNbgeMgXreFDbsNQMsS
2026-02-19 21:03:30 +00:00

113 lines
2.6 KiB
Markdown

# Contributing to TORCH
Thank you for your interest in contributing to TORCH!
## Prerequisites
- Node.js (v22+)
- npm
## Setup
1. Clone the repository.
2. Install dependencies:
```bash
npm install
```
3. Copy the environment template (optional):
```bash
cp .env.example .env
```
## Development Workflow
### Building
This project requires a build step for distribution artifacts (dashboard, landing page, tarball).
```bash
npm run build
```
### Testing
Run the full test suite:
```bash
npm test
```
For faster feedback on lock-backend unit tests:
```bash
npm run test:unit:lock-backend
```
For integration/resilience tests:
```bash
npm run test:extended-main
```
### Linting
Ensure your code follows the project's style guidelines:
```bash
npm run lint
```
ESLint is configured with `no-unused-vars` as an error. Prefix intentionally unused parameters with `_` (e.g., `_err`, `_unused`).
## Commit Conventions
This project uses [Conventional Commits](https://www.conventionalcommits.org/):
```
feat(scope): add new feature
fix(scope): fix a bug
chore(scope): maintenance task
docs(scope): documentation update
test(scope): add or fix tests
```
Common scopes: `dashboard`, `scheduler`, `lock-ops`, `memory`, `ci`, `tests`, `security`.
## Adding a New Agent Prompt
Agent prompts live in `src/prompts/daily/` and `src/prompts/weekly/`. To add a new agent:
1. Create a markdown file following the naming convention: `<agent-name>.md`
2. Add the agent to the roster in `src/prompts/roster.json`
3. Run `npm run validate:scheduler` to verify roster/prompt consistency
See existing prompts for the expected format.
## Architecture Overview
- **Core library:** `src/lib.mjs` — CLI command dispatch
- **Lock operations:** `src/lock-ops.mjs` — Nostr relay publish/query with health tracking
- **Dashboard:** `dashboard/` — Static web UI served by `src/dashboard.mjs`
- **Memory subsystem:** `src/services/memory/` — Event ingestion, retrieval, pruning
- **Scheduler:** `scripts/agent/run-scheduler-cycle.mjs` — Orchestrates agent runs
For detailed architecture docs, see `docs/lib-overview.md` and `docs/lock-ops-overview.md`.
## Test Integrity
When modifying tests, follow the test integrity protocol in `CLAUDE.md`. Tests are behavioral specifications — never weaken assertions to make them pass.
## Pull Requests
- Keep PR titles short (under 70 characters)
- Include a summary of changes and test plan in the description
- Ensure `npm run lint` and `npm test` pass before submitting
- Reference related issues where applicable
## Reporting Issues
If you encounter bugs or have feature requests, please open an issue on GitHub.