Thanks for helping improve GhostAPI. This project aims to be small, safe, local-first, and useful for developers and AI coding agents.
Requirements:
- Node.js 20 or newer
- npm
Install dependencies from the lockfile:
npm ciRun the local development server:
npm run devOpen:
http://localhost:8080/dashboard
npm run typecheck
npm run lint
npm test
npm run test:coverage
npm run build
npm run devUse these before opening a pull request:
npm run typecheck
npm run lint
npm test
npm run test:coverage
npm run buildTests are written with Vitest and must stay local-only. Do not add tests that call real Stripe, Twilio, Resend, GitHub, OpenAI, or any other external API.
Current test areas include:
- Secret masking
- Provider detection
- Cache key stability
- State save/read/list/delete
- Provider error formatting
- Prompt construction and JSON repair
- Proxy flow integration
- Dashboard/SSE event formatting
Shared fixtures live in test/fixtures/.
- TypeScript strict mode.
- ESM modules.
- Prefer functions and simple objects over classes.
- Keep modules small and direct.
- Avoid
any; useunknownand narrow values where possible. - Add comments only where behavior is not obvious.
- Keep user-facing errors actionable.
- Do not introduce network calls to real provider APIs by default.
GhostAPI intentionally keeps native adapters limited. For the MVP, native adapters are:
- Stripe
- Twilio
- Resend
- GitHub
- Discord
- OpenAI
- Generic fallback
Before adding a new native adapter, ask whether generic fallback plus prompt hints is enough. Native adapters should be reserved for providers where contract-specific behavior, validation, or error formatting is clearly worth maintaining.
If a native adapter is justified:
- Read
docs/providers/authoring-packs.md. - Add one built-in pack under
src/providers/packs/. - Register it in
src/providers/registry.tswithout changing generic fallback. - Add deterministic conformance fixtures and provider regression tests.
- Do not import network, filesystem, environment, or state-store capabilities into the pack.
- Update README provider coverage and the versioned capability manifest.
Most services should use generic fallback. To improve generic behavior:
- Add or refine lightweight inference in
src/ai/genericInference.ts. - Keep labels best-effort, such as
generic:shopify-like. - Do not add provider-specific validation or error formats for generic services.
- Add tests in
test/genericInference.test.ts. - Update README coverage if the change affects documented behavior.
- The change is scoped and explained clearly.
npm run typecheckpasses.npm testpasses.npm run buildpasses.- New behavior has tests when practical.
- No real external API calls were added by default.
- Secrets are not logged, cached, sent to LLM prompts, or exposed in dashboard payloads.
- README or examples are updated when user-facing behavior changes.
- Use a human Git author for commits. Do not commit as
OpenCode <opencode@localhost>. - Add
Assisted-by: OpenCodeonly when AI assistance was substantial and materially affected the change. - Use pull requests and squash merge for changes to
main. - Use focused Conventional Commit titles such as
fix(egress): reject unsupported allow hostsordocs(readme): clarify provider coverage. - Preferred scopes are
provider,policy,egress,sanitizer,dashboard,mcp,hosted,release, anddocs. - Do not combine unrelated security, feature, and documentation work into one commit.
See PROVENANCE.md for the project authorship statement.