|
| 1 | +# Cloud Harness |
| 2 | + |
| 3 | +Cloud Harness provides software infrastructure and tools for neuroscience data computing and analysis in a monorepo. |
| 4 | + |
| 5 | +## Repository Layout |
| 6 | + |
| 7 | +- `applications/` — Cloud Harness custom server applications |
| 8 | +- `client/` — generated client API |
| 9 | +- `deployment/` — deployment-related scripts and files |
| 10 | +- `deployment-configuration/` — deployment customization files |
| 11 | +- `infrastructure/` — infrastructure utilities |
| 12 | +- `libraries/` — Cloud Harness shared libraries |
| 13 | +- `docs/` — developer documentation |
| 14 | +- `tools/` — Cloud Harness CLI and other tools |
| 15 | +- `test/` — test utilities and test code |
| 16 | + |
| 17 | +Before working on a task, identify which application/component is in scope and read any `CLAUDE.md` inside that subtree. |
| 18 | + |
| 19 | +## Environment Setup |
| 20 | + |
| 21 | +- **Conda environment**: `ch` (Python 3.12+) — activate with `conda activate ch` |
| 22 | +- **Frontend package manager**: Yarn — **never** use npm |
| 23 | +- **Backend package manager**: pip — only inside the conda environment |
| 24 | + |
| 25 | +Always activate `conda activate ch` before any backend command. |
| 26 | + |
| 27 | +## Development Principles |
| 28 | + |
| 29 | +- Configuration lives in `values.yaml` files and is injected via Helm templates and Kubernetes manifests. Never hardcode configuration in application code or templates. |
| 30 | +- Structured configuration can be injected via resources processed by Helm templates and loaded as ConfigMaps automatically (e.g. `applications/accounts/deploy/resources/realm.json`). |
| 31 | +- The Cloud Harness configuration API is defined as an [OpenAPI spec](libraries/models/api/openapi.yaml). Run `harness-generate models` after changing the spec. |
| 32 | + |
| 33 | +## Code Style |
| 34 | + |
| 35 | +- Keep architecture lean — avoid unnecessary layers and abstractions. |
| 36 | +- Use **utils** for stateless pure functions that don't touch external data sources or the ORM. |
| 37 | +- Use **helpers** for pieces of business logic; keep them stateless when possible. |
| 38 | +- Use **services** for business workflows and cross-model coordination. |
| 39 | +- Keep model logic close to the model when it represents domain rules or invariants. |
| 40 | +- Handle exceptions only at the highest level; let lower layers raise. Never catch in helpers or services unless adding context and re-raising. |
| 41 | +- Cover critical logic with unit tests, especially helpers and services. Use mocks to isolate units. |
| 42 | +- Prefer model classes for helpers and services. Use typed dicts for structured data not covered by schema classes. Use plain dicts only for genuinely unstructured data. Avoid returning tuples. |
| 43 | +- Bubble exceptions up to where they can be handled. Avoid return-value error signalling. Wrap library and untyped exceptions in custom exceptions with clear meaning. |
| 44 | + |
| 45 | +## Important Constraints |
| 46 | + |
| 47 | +- **Never** create README or documentation files unless explicitly requested. |
| 48 | +- **Never** start development servers — assume they are already running. |
| 49 | +- **Always** ask before opening a browser. |
| 50 | +- **Frontend**: Yarn only. **Backend**: pip inside the `ch` conda environment only. |
| 51 | + |
| 52 | + |
| 53 | +# Using Cloudharness CLI Tools |
| 54 | + |
| 55 | +## Environment |
| 56 | +- Activate `conda activate ch` before any backend command. |
| 57 | +- Run `sh install.sh` to install cli tools |
| 58 | + |
| 59 | +## Key Scripts |
| 60 | + |
| 61 | +- `harness-generate` — generate code |
| 62 | +- `harness-deployment` — generate deployment files (Helm charts, CI/CD files, etc.) |
| 63 | +- `harness-application` — generate application code (e.g. Django apps) |
| 64 | +- `harness-migrate` — migration helper |
| 65 | +- `ch_cli_tools` — Python package for deployment and other tools |
| 66 | +- `tests/` — unit test utilities |
0 commit comments