* Add contributing section for jan * Update CONTRIBUTING.md Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
1.4 KiB
1.4 KiB
Contributing to Jan Core
← Back to Main Contributing Guide
TypeScript SDK providing extension system, APIs, and type definitions for all Jan components.
Key Directories
/src/browser- Core APIs (events, extensions, file system)/src/browser/extensions- Built-in extensions (assistant, inference, conversational)/src/types- TypeScript type definitions/src/test- Testing utilities
Development
Key Principles
- Platform Agnostic - Works everywhere (browser, Node.js)
- Extension-Based - New features = new extensions
- Type Everything - TypeScript required
- Event-Driven - Components communicate via events
Building & Testing
# Build the SDK
yarn build
# Run tests
yarn test
# Watch mode
yarn test:watch
Event System
// Emit events
events.emit('model:loaded', { modelId: 'llama-3' })
// Listen for events
events.on('model:loaded', (data) => {
console.log('Model loaded:', data.modelId)
})
Testing
describe('MyFeature', () => {
it('should do something', () => {
const result = doSomething()
expect(result).toBe('expected')
})
})
Best Practices
- Keep it simple
- Use TypeScript fully (no
any) - Write tests for critical features
- Follow existing patterns
- Export new modules in index files
Dependencies
- TypeScript - Type safety
- Rolldown - Bundling
- Vitest - Testing