|
1 | | -# Tsarr - TypeScript SDK for Servarr APIs |
| 1 | +# Tsarr Contributor Notes |
2 | 2 |
|
3 | | -## Project Overview |
4 | | -Type-safe TypeScript SDK for Servarr APIs (Radarr, Sonarr, etc.) generated from Swagger/OpenAPI specs. Optimized for Bun runtime and Infrastructure-as-Code workflows. |
| 3 | +## What This Repo Is |
| 4 | +- Tsarr is a TypeScript SDK and CLI for the Servarr ecosystem: Radarr, Sonarr, Lidarr, Readarr, Prowlarr, and Bazarr. |
| 5 | +- The published package targets Node.js (`>=18.20.8`), while Bun is used for local development, build, generation, and tests. |
| 6 | +- This repo already ships generated clients, handwritten wrappers, a CLI, packaging assets, and user-facing docs. Do not treat core features as "future work". |
5 | 7 |
|
6 | | -## Key Commands |
7 | | -- `bun install` - Install dependencies |
8 | | -- `bun run dev` - Run development server |
9 | | -- `bun run build` - Build the project |
10 | | -- `bun run lint` - Check code quality |
11 | | -- `bun run lint:fix` - Fix linting issues |
12 | | -- `bun run format` - Format code |
13 | | -- `bun run typecheck` - Type check without emitting |
| 8 | +## Read First |
| 9 | +- `README.md` for product overview, install paths, and developer commands. |
| 10 | +- `docs/cli.md` for CLI behavior and supported command patterns. |
| 11 | +- `docs/usage.md` for SDK usage examples. |
| 12 | +- `docs/distribution.md` and `packaging/` for release and packaging workflows. |
14 | 13 |
|
15 | | -## Architecture |
16 | | -- **Runtime**: Bun (leverages native fetch API) |
17 | | -- **Structure**: Modular design (separate modules per Servarr app) |
18 | | -- **Generation**: Uses swagger-typescript-api for type-safe clients |
19 | | -- **Target**: Tree-shakable, lightweight SDK for IaC environments |
| 14 | +## Core Commands |
| 15 | +- `bun install` - install dependencies |
| 16 | +- `bun test` - run tests |
| 17 | +- `bun run build` - regenerate clients/types and build the package |
| 18 | +- `bun run generate` - regenerate all OpenAPI-derived clients |
| 19 | +- `bun run refresh:specs` - refresh local OpenAPI specs |
| 20 | +- `bun run typecheck` - run TypeScript checks |
| 21 | +- `bun run lint` - run Biome checks |
| 22 | +- `bun run cli -- --help` - inspect the CLI locally |
20 | 23 |
|
21 | | -## Development Notes |
22 | | -- Source code in `src/` directory |
23 | | -- Generated APIs live in `src/generated/<service>/`, with hand-written wrappers in `src/clients/<service>.ts` |
24 | | -- Uses Biome for linting/formatting instead of ESLint/Prettier |
25 | | -- Use conventional prefixes for commit messages and PR titles: `feat:`, `fix:`, or `chore:` |
26 | | -- CI pipeline runs on all pushes and PRs |
27 | | -- Renovate handles dependency updates weekly |
| 24 | +## Repo Map |
| 25 | +- `src/cli/` - CLI entrypoint, shared command framework, output formatting, config, prompts |
| 26 | +- `src/clients/` - handwritten service wrappers exposed as public SDK entrypoints |
| 27 | +- `src/generated/` - generated OpenAPI clients and types for each service |
| 28 | +- `src/core/` - shared config validation, error types, and HTTP helpers |
| 29 | +- `scripts/` - code generation, spec refresh, type export, and packaging automation |
| 30 | +- `specs/` - local OpenAPI inputs used by generation |
| 31 | +- `tests/` - unit, CLI, and integration coverage |
| 32 | +- `examples/` - runnable SDK examples |
28 | 33 |
|
29 | | -## Future Implementation |
30 | | -- Swagger file collection from Servarr instances |
31 | | -- Code generation scripts using `swagger-typescript-api` |
32 | | -- Modular API clients for each Servarr app |
33 | | -- Integration with PrepArr/CodeArr sidecar project |
| 34 | +## Generation Rules |
| 35 | +- Generated code lives under `src/generated/`. Prefer changing generator inputs or scripts over editing generated files by hand. |
| 36 | +- Client generation uses `@hey-api/openapi-ts`, not `swagger-typescript-api`. |
| 37 | +- `scripts/generate.ts` includes Bazarr-specific spec normalization. Preserve that behavior when touching generation. |
| 38 | +- If you change API surface area, keep generated code, handwritten wrappers, exports, and docs aligned. |
| 39 | + |
| 40 | +## Editing Guidance |
| 41 | +- Most product logic changes belong in `src/cli/`, `src/clients/`, `src/core/`, or `scripts/`. |
| 42 | +- Keep CLI docs and smoke tests in sync when you add or rename commands. |
| 43 | +- Treat `README.md` and `docs/` as user-facing sources of truth. Keep this file short and operational. |
| 44 | +- There is no development server in this repo. The `dev` script runs the library entrypoint and is not an app server workflow. |
| 45 | + |
| 46 | +## Quality Bar |
| 47 | +- Use Biome for formatting and linting. |
| 48 | +- Prefer adding or updating tests when changing command definitions, output behavior, config handling, or client wrappers. |
| 49 | +- Preserve modular exports for per-service imports such as `tsarr/radarr` and `tsarr/radarr/types`. |
0 commit comments