This package is the TypeScript SDK for the Factory Droid CLI. Public exports live in src/index.ts; treat that file as the public API contract. Core layers are src/query.ts, src/session.ts, src/client.ts, src/protocol.ts, and src/transport.ts. Runtime schemas live under src/schemas/. Unit tests are in tests/, runnable usage samples are in examples/, and public documentation lives in docs/.
npm run build— build the package intodist/withtsupnpm run typecheck— run TypeScript checks for the librarynpm run typecheck:examples— typecheck the example scriptsnpm test— run the Vitest suitenpm run lint— lintsrc/andtests/npm run format:check— verify Prettier formatting
Before finishing a change, run the smallest relevant checks first, then full validation if the public API or docs/examples changed.
Use TypeScript with ESM imports and the existing project style. Follow Prettier formatting and ESLint rules; do not hand-format against them. Match nearby naming patterns: exported types/interfaces use PascalCase, functions and variables use camelCase, and example filenames use kebab-case like multi-turn-session.ts.
Vitest is the test runner. Add or update tests in tests/ whenever changing exported behavior, message conversion, schemas, or session/client flows. Keep tests focused and descriptive; mirror source names when practical, for example session.test.ts for src/session.ts. For example changes, also run npm run typecheck:examples.
Follow the recent commit style: feat: ..., docs: ..., refactor: .... Keep commit messages concise and user-facing. PRs should explain what changed, why it changed, and note any API, docs, or example updates. Link relevant issues when available.
Prefer updating docs/ and examples/ over expanding this file. Verify every documented feature against current exports and tests before publishing. Keep examples runnable with npx tsx examples/<file>.ts, and keep AGENTS.md concise, durable, and repo-specific.