2025-11-25 12:44:31 +01:00
# Repository Guidelines
2025-11-25 06:14:48 +01:00
2025-11-25 12:44:31 +01:00
## Project Structure & Module Organization
2025-12-05 19:04:09 +00:00
- Source code: `src/` (CLI wiring in `src/cli` , commands in `src/commands` , web provider in `src/provider-web.ts` , infra in `src/infra` , media pipeline in `src/media` ).
- Tests: colocated `*.test.ts` .
2025-12-05 17:50:02 +00:00
- Docs: `docs/` (images, queue, Pi config). Built output lives in `dist/` .
2025-11-25 12:44:31 +01:00
## Build, Test, and Development Commands
- Install deps: `pnpm install`
2025-12-05 17:22:53 +00:00
- Run CLI in dev: `pnpm clawdis ...` (tsx entry) or `pnpm dev` for `src/index.ts` .
2025-11-25 12:44:31 +01:00
- Type-check/build: `pnpm build` (tsc)
- Lint/format: `pnpm lint` (biome check), `pnpm format` (biome format)
- Tests: `pnpm test` (vitest); coverage: `pnpm test:coverage`
## Coding Style & Naming Conventions
- Language: TypeScript (ESM). Prefer strict typing; avoid `any` .
- Formatting/linting via Biome; run `pnpm lint` before commits.
- Keep files concise; extract helpers instead of “V2” copies. Use existing patterns for CLI options and dependency injection via `createDefaultDeps` .
2025-12-06 23:59:08 +01:00
- Keep every file ≤ 500 LOC; refactor or split before exceeding and check frequently.
2025-11-25 12:44:31 +01:00
## Testing Guidelines
- Framework: Vitest with V8 coverage thresholds (70% lines/branches/functions/statements).
- Naming: match source names with `*.test.ts` ; e2e in `*.e2e.test.ts` .
- Run `pnpm test` (or `pnpm test:coverage` ) before pushing when you touch logic.
2025-11-28 08:13:59 +01:00
- Pure test additions/fixes generally do **not** need a changelog entry unless they alter user-facing behavior or the user asks for one.
2025-11-25 12:44:31 +01:00
## Commit & Pull Request Guidelines
- Follow concise, action-oriented commit messages (e.g., `CLI: add verbose flag to send` ).
- Group related changes; avoid bundling unrelated refactors.
- PRs should summarize scope, note testing performed, and mention any user-facing changes or new flags.
## Security & Configuration Tips
2025-12-05 19:04:09 +00:00
- Web provider stores creds at `~/.clawdis/credentials/` ; rerun `clawdis login` if logged out.
- Pi/Tau sessions live under `~/.clawdis/sessions/` by default; the base directory is not configurable.
2025-11-25 12:44:31 +01:00
## Agent-Specific Notes
2025-12-06 23:21:25 +00:00
- Relay is managed by launchctl (label `com.steipete.clawdis` ). After code changes restart with `launchctl kickstart -k gui/$UID/com.steipete.clawdis` and verify via `launchctl list | grep clawdis` . Use tmux only if you spin up a temporary relay yourself and clean it up afterward.
2025-11-25 12:45:14 +01:00
- Also read the shared guardrails at `~/Projects/oracle/AGENTS.md` and `~/Projects/agent-scripts/AGENTS.MD` before making changes; align with any cross-repo rules noted there.
2025-12-05 17:22:53 +00:00
- When asked to open a “session” file, open the Pi/Tau session logs under `~/.tau/agent/sessions/clawdis/*.jsonl` (newest unless a specific ID is given), not the default `sessions.json` .
2025-12-06 01:15:42 +01:00
- Menubar dimming + restart flow mirrors Trimmy: use `scripts/restart-mac.sh` (kills all Clawdis variants, runs `swift build` , packages, relaunches). Icon dimming depends on MenuBarExtraAccess wiring in AppMain; keep `appearsDisabled` updates intact when touching the status item.
2025-12-02 06:52:56 +00:00
## Exclamation Mark Escaping Workaround
2025-12-05 17:22:53 +00:00
The Claude Code Bash tool escapes `!` to `\\!` in command arguments. When using `clawdis send` with messages containing exclamation marks, use heredoc syntax:
2025-12-02 06:52:56 +00:00
```bash
2025-12-05 17:22:53 +00:00
# WRONG - will send "Hello\\!" with backslash
2025-12-05 19:04:09 +00:00
clawdis send --to "+1234" --message 'Hello!'
2025-12-02 06:52:56 +00:00
# CORRECT - use heredoc to avoid escaping
2025-12-05 19:04:09 +00:00
clawdis send --to "+1234" --message "$(cat < < 'EOF'
2025-12-02 06:52:56 +00:00
Hello!
EOF
)"
```
2025-12-05 17:22:53 +00:00
This is a Claude Code quirk, not a clawdis bug.