Thank you for your interest in contributing to Blade Agent SDK! This document provides guidelines and standards for contributing to this project.
The published package is distributed through npm, but this repository uses pnpm for local dependency installation, testing, build, and release automation.
This project enforces strict TypeScript configuration. All contributions must adhere to these rules:
Using any is strictly prohibited. This rule is enforced at both compile-time and lint-time.
// ❌ Bad
function process(data: any) { ... }
const result: any = fetchData();
let value; // implicit any
// ✅ Good
function process(data: unknown) { ... }
function process<T>(data: T) { ... }
const result: ResponseType = fetchData();
let value: string;Alternatives to any:
Instead of any |
Use |
|---|---|
| Unknown input type | unknown |
| Generic data | <T> generics |
| Object with unknown keys | Record<string, unknown> |
| JSON data | JsonValue from types/common.ts |
| Function parameters | Specific types or generics |
Always handle potential undefined and null values explicitly:
// ❌ Bad
const name = user.profile.name;
// ✅ Good
const name = user?.profile?.name ?? 'Anonymous';Run linting before submitting:
pnpm run lintFix auto-fixable issues:
pnpm run lint:fixEnsure your code passes type checking:
pnpm run type-checkgit clone https://github.com/YOUR_USERNAME/blade-agent-sdk.git
cd blade-agent-sdk
pnpm installgit checkout -b feature/your-feature-name- Write clean, typed code
- Follow existing code style and patterns
- Add tests for new functionality
pnpm testpnpm run type-check
pnpm run lintWrite clear, descriptive commit messages:
git commit -m "feat: add new feature description"
git push origin feature/your-feature-nameOpen a PR against the main branch with:
- Clear description of changes
- Reference to related issues
- Screenshots/examples if applicable
Before submitting a PR, ensure:
- Code compiles without errors (
pnpm run type-check) - All tests pass (
pnpm test) - Linting passes (
pnpm run lint) - No
anytypes introduced - New features have tests
- Documentation updated if needed
All PRs require review before merging. Reviewers will check:
- Type Safety: No
any, proper typing throughout - Code Quality: Clean, readable, maintainable code
- Tests: Adequate test coverage
- Documentation: Clear comments where necessary
If you have questions, please open an issue or discussion on GitHub.