Thank you for your interest in contributing to the .do open-source AI platform! This guide will help you understand our development workflow, CI/CD processes, and contribution standards.
- Getting Started
- Development Workflow
- CI/CD Pipelines
- Code Quality Standards
- Publishing Packages
- Branch Protection
- Troubleshooting
- Node.js: 20.x or later (we test on 18, 20, and 22)
- pnpm: 9.x or later
- Git: Latest version
Clone the repository and install dependencies:
git clone https://github.com/dot-do/ai.git
cd ai
pnpm installai/
├── packages/ # npm packages (@dotdo/* scoped)
│ ├── sdk.do/ # Core SDK with $ proxy
│ ├── cli.do/ # CLI interface
│ ├── mcp.do/ # MCP server
│ ├── graphdl/ # Semantic graphs
│ ├── mdxld/ # Linked data in MDX
│ ├── schema.org.ai/ # Schema.org types
│ ├── gs1.org.ai/ # GS1 supply chain
│ └── soc.org.ai/ # O*NET occupations
├── sdks/ # SDK implementations
├── sites/ # Documentation sites
├── apps/ # Applications
└── .github/
└── workflows/ # CI/CD pipelines
git checkout -b feature/your-feature-name
# or
git checkout -b fix/bug-descriptionBranch naming conventions:
feature/*- New featuresfix/*- Bug fixesdocs/*- Documentation changesrefactor/*- Code refactoringtest/*- Test additions/changeschore/*- Maintenance tasks
Edit files, add tests, and update documentation as needed.
Before committing, run all quality checks:
# Run individual checks
pnpm lint # ESLint
pnpm format # Prettier (auto-fix)
pnpm format:check # Prettier (check only)
pnpm typecheck # TypeScript
pnpm test # Tests
pnpm build # Build all packages
# Or run everything at once
pnpm ci # Runs all checksWe follow conventional commits:
git add .
git commit -m "feat: add new feature"
git commit -m "fix: resolve bug in db module"
git commit -m "docs: update SDK documentation"
git commit -m "test: add tests for ai.generate"Commit message format:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
git push origin feature/your-feature-nameThen create a PR on GitHub:
- Go to https://github.com/dot-do/ai/pulls
- Click "New pull request"
- Select your branch
- Fill in PR template
- Submit for review
Our CI/CD pipelines automatically run on every pull request and push to main. All checks must pass before merging.
Triggers: Push to main, Pull Requests
Jobs:
-
Lint - Runs ESLint and Prettier checks
- Validates code style and formatting
- Must pass for PR approval
-
Type Check - Runs TypeScript compiler
- Ensures type safety across all packages
- Catches type errors early
-
Test - Runs test suite on Node.js 18, 20, and 22
- Matrix testing across Node versions
- Uploads coverage to Codecov
- Enforces 50% minimum coverage threshold
-
Build - Builds all packages
- Verifies no build errors
- Uploads build artifacts
- Tests package bundling
Triggers: Push to main, Pull Requests
Jobs:
- ESLint - JavaScript/TypeScript linting
- Prettier - Code formatting validation
- TypeScript - Type checking
- Markdown - Markdown file linting
- Spell Check - Spelling validation using typos
Triggers: Push to main, Pull Requests, Weekly schedule (Sundays)
Jobs:
- npm Audit - Scans for vulnerable dependencies
- CodeQL - Advanced code security analysis
- Dependency Review - Reviews dependency changes in PRs
Triggers: Manual workflow dispatch, GitHub Releases
Purpose: Publish packages to npm
See Publishing Packages section below.
We use ESLint to enforce code quality:
pnpm lint # Check for issues
pnpm lint:fix # Auto-fix issuesRules:
- No unused variables
- No console.log (use proper logging)
- Consistent naming conventions
- No any types (use proper TypeScript types)
Code formatting is handled by Prettier:
pnpm format # Auto-format all files
pnpm format:check # Check formatting (CI uses this)Configuration:
- 160 character line width
- Single quotes
- No semicolons
- 2 space indentation
- ES5 trailing commas
All code must be properly typed:
pnpm typecheck # Run type checkingBest practices:
- Use explicit types for public APIs
- Avoid
any- useunknownor proper types - Export types from packages
- Use type guards for runtime checks
Write tests for all new features and bug fixes:
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test:coverage # Generate coverage reportRequirements:
- Minimum 50% code coverage (enforced by CI)
- Unit tests for all functions
- Integration tests for workflows
- E2E tests for CLI commands
Test structure:
import { describe, it, expect } from 'vitest'
describe('Feature name', () => {
it('should do something', () => {
expect(result).toBe(expected)
})
})Publishing requires an npm token with publish permissions:
- Generate token at npmjs.com
- Create "Automation" token
- Add to GitHub: Settings → Secrets → Actions → New repository secret
- Name:
NPM_TOKEN
Option 1: Manual Trigger (Recommended)
- Go to Actions → Publish to npm
- Click "Run workflow"
- Enter version (e.g.,
1.0.0-beta.1) - Select dist-tag:
beta- Beta releases (default)latest- Stable releasesnext- Next/RC releasescanary- Canary/nightly releases
- Click "Run workflow"
Option 2: GitHub Release
- Create a new release on GitHub
- Tag format:
v1.0.0 - Publish release
- Workflow automatically publishes to npm
Follow Semantic Versioning:
- Major (1.0.0): Breaking changes
- Minor (0.1.0): New features (backwards compatible)
- Patch (0.0.1): Bug fixes
Pre-release tags:
1.0.0-beta.1- Beta releases1.0.0-rc.1- Release candidates1.0.0-canary.1- Canary/nightly builds
The workflow automatically:
- ✅ Installs dependencies
- ✅ Builds all packages
- ✅ Runs test suite
- ✅ Updates package versions (if manual trigger)
- ✅ Publishes to npm with provenance
- ✅ Creates GitHub release with notes
- ✅ Tags commit with version
The main branch is protected with the following rules:
All PRs must pass these checks before merging:
- ✅
lint / ESLint - ✅
lint / Prettier - ✅
lint / TypeScript - ✅
ci / Test - ✅
ci / Build
- ✅ Require pull request reviews (1 approval)
- ✅ Require status checks to pass
- ✅ Require branches to be up to date
- ✅ Require conversation resolution
- ✅ No force pushes
- ✅ No branch deletions
- ✅ No bypassing (even for admins)
For repository admins:
- Go to Settings → Branches → Branch protection rules
- Click "Add rule"
- Branch name pattern:
main - Enable settings above
- Save changes
Via GitHub CLI:
gh api repos/dot-do/ai/branches/main/protection \
--method PUT \
--field required_status_checks[strict]=true \
--field required_status_checks[contexts][]=lint \
--field required_status_checks[contexts][]=test \
--field required_status_checks[contexts][]=build \
--field required_pull_request_reviews[required_approving_review_count]=1 \
--field enforce_admins=true \
--field required_conversation_resolution[enabled]=true"command not found" errors:
- Verify
package.jsonhas the required scripts - Check pnpm installation:
pnpm --version
TypeScript errors:
- Run
pnpm typechecklocally to see full errors - Ensure all packages are built:
pnpm build
Test failures:
- Run tests locally:
pnpm test - Check Node.js version:
node --version - Clear cache:
pnpm store prune
Linting errors:
- Auto-fix:
pnpm lint:fix - Format:
pnpm format - Check
.eslintrc.jsonfor rules
Authentication errors:
- Verify
NPM_TOKENsecret is set correctly - Check token permissions on npmjs.com
- Generate new token if needed
Package name conflicts:
- Ensure packages are scoped:
@dotdo/* - Check package names on npmjs.com
- Update
package.jsonname field
Permission errors:
- Verify you're a maintainer of the
@dotdoscope - Contact @nathanclevenger for access
If coverage drops below 50%:
- Add tests for new code
- Run coverage report:
pnpm test:coverage - Check
coverage/directory for details - Focus on untested branches and functions
Vulnerable dependencies:
- Check Dependabot alerts
- Update dependencies:
pnpm update - Review security advisory details
CodeQL alerts:
- Review alert details on GitHub
- Fix security issues promptly
- Add suppression only if false positive
- Issues: github.com/dot-do/ai/issues
- Discussions: github.com/dot-do/ai/discussions
- Maintainer: @nathanclevenger
Be respectful, inclusive, and professional. We're all here to build great software together.
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to .do Business-as-Code! 🎉