You're updating this CLI in response to upstream API changes in @photon-ai/dashboard-api. The API type contract arrives as a version bump of that dependency (in package.json/bun.lock). Your job: make bun run check pass.
- Use Bun exclusively — never Node, npm, pnpm, yarn
- Never hand-edit API types — they come from the
@photon-ai/dashboard-apidependency; update them by bumping its version - Never add forbidden dependencies: axios, chalk, zod, jest, vitest, ts-node, ws, express, dotenv, ioredis, pg, better-sqlite3
- Every command must use
getApi()from~/lib/api.ts+ Eden treaty pattern — never rawfetch() - Destructure Eden responses as
{ data, error, status }— check error before using data - Handle 401 by throwing
SessionExpiredError(caught centrally inhandleTopLevelError) - Never delete or rewrite snapshot files without justification in PR body under "## Snapshot changes"
- One PR = one upstream version bump — don't bundle refactors
- Never modify files in
.github/workflows/orscripts/agent-flow/
- Match the style in
src/commands/projects.ts: same option ordering (--api-host, -t/--token, --json), same error handling - New DTOs go in
src/lib/types.ts, cast at the API boundary - Prefer adding fields to existing DTOs over creating parallel types
- All user-facing output uses
c.dim(),c.success(),c.error()from~/lib/output.ts - Comments only when intent isn't obvious from the code
- Splitting the
ProjectDTO into one type per command - Adding try/catch around every
getApi()call (handled centrally insrc/index.ts#handleTopLevelError) - Using
console.log(JSON.stringify(...))instead of the output helpers - Replacing
picocolorswithchalk - Using
node:fsinstead ofBun.file - Adding
dotenv(Bun auto-loads .env) - Importing from
@elysiajs/edendirectly instead of usinggetApi()
- Read
UPSTREAM_DIFF.md(committed at the root of your branch) - Run
bun install && bun run check. Note what breaks. - Update DTOs in
src/lib/types.tsif the API surface changed - Update command files in
src/commands/to match new routes - Update or add tests in
tests/to cover changes - Run
bun run checkuntil green - If you can't make it green within 20 iterations, create
AGENT_NOTES.mdexplaining where you got stuck
- Package manager:
bunonly - Test runner:
bun test - Type check:
tsc --noEmit - Build:
bun run build - Aggregate:
bun run check(runs typecheck + test + build)