Production-grade workflow orchestration and composition engine for building autonomous agents and CI/CD pipelines
npm install @affectively/orchestratorFlexible, production-grade CI/CD workflows for linting, testing, and code cleanup. Designed to support any repository structure—monorepo or single package, works with Bun and pnpm.
✅ Package Manager Agnostic - Auto-detects bun.lock or pnpm-lock.yaml
✅ Monorepo & Non-Monorepo Support - Works with Nx, Turborepo, or single packages
✅ Flexible Project Detection - Adapts to Angular, Next.js, React Native, etc.
✅ Intelligent Caching - Smart cache keys for dependencies and build artifacts
✅ Fail-Fast Testing - Tests per-project sequentially to isolate failures
✅ Type-Safety First - TypeScript validation before linting
✅ Accessibility Compliance - WCAG 2.1 AA standards built-in
✅ Zero Configuration - Works out of the box with sensible defaults
``bash`
git submodule add https://github.com/your-org/workflows.git .workflows
git config -f .gitmodules submodule.workflows.shallow true
git submodule update --init --recursive
Copy workflows to .github/workflows/:
`bash`
cp .workflows/github-actions/*.yml .github/workflows/
Or link them:
`bash`In .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
include:
- uses: ./.workflows/github-actions/lint.yml
Reference workflows for autonomous agent execution:
`bash`Example: Run code quality check
bun scripts/execute-workflow.ts code-quality-check
The workflows automatically detect your repository structure:
1. bun.lock → Use Bun as package manager
2. pnpm-lock.yaml → Use pnpm as package manager
3. package-lock.json → Fall back to npm
4. yarn.lock → Fall back to yarn
- Nx - Detects nx.jsonturbo.json
- Turborepo - Detects pnpm-workspace.yaml
- pnpm workspaces - Detects package.json
- Single package - Uses root
Automated CI/CD workflows triggered by GitHub events:
- ci.yml - Main CI pipeline (lint, type-check, test on every push/PR)
- lint.yml - ESLint + Prettier checks
- type-check.yml - TypeScript validation
- test.yml - Jest/Vitest unit testing
- code-quality.yml - Full quality check with auto-fix
- cleanup.yml - Manual workflow for fixing all issues
Documentation-based workflows for autonomous agent execution:
- code-quality-check.md - Type checking, linting, formatting
- fix-all-tests-workflow.md - Systematically fix all failing tests
- clean-all.md - Complete cleanup of all code quality issues
- build-and-fix.md - Build all projects and fix errors
Create .env or configure in your repo:
`bashPackage manager (auto-detected if not set)
PACKAGE_MANAGER=bun
$3
#### ESLint Configuration
Place at repo root:
`json
// .eslintrc.json
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/no-explicit-any": "error"
}
}
`#### TypeScript Configuration
Place at repo root:
`json
// tsconfig.json
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true
}
}
`Usage Examples
$3
`bash
Lint only changed files
bunx eslint --ext .ts,.tsx src/Type-check
bun run type-checkRun tests
bun test
`$3
Push to trigger automatic workflows:
`bash
git add .
git commit -m "feat: new feature"
git push origin main
`$3
Trigger from GitHub UI:
1. Go to Actions tab
2. Select workflow
3. Click Run workflow
4. Choose branch and options
Scripts
Utility scripts for local development and CI/CD:
$3
Automatically detects repository structure:
`bash
bun scripts/detect-repo-type.ts
Output: { packageManager: 'bun', isMonorepo: true, buildSystem: 'nx' }
`$3
Flexible linting with file detection:
`bash
Lint all files
bun scripts/run-linter.ts --allLint changed files only
bun scripts/run-linter.ts --changedFix issues
bun scripts/run-linter.ts --fix
`$3
Smart test runner:
`bash
Run all tests
bun scripts/run-tests.ts --allRun changed tests
bun scripts/run-tests.ts --changedRun specific project
bun scripts/run-tests.ts --project web-appRun with coverage
bun scripts/run-tests.ts --coverage
`$3
Systematically fix failing tests:
`bash
bun scripts/fix-all-tests.ts
Runs each project sequentially until all pass
`$3
Analyze TypeScript errors:
`bash
Show all errors
bun scripts/type-check-analyze.tsShow only fixable errors
bun scripts/type-check-analyze.ts --fixableShow specific error code
bun scripts/type-check-analyze.ts --code TS2307
`Supported Technologies
$3
- Bun 1.0+
- pnpm 8+
- npm (fallback)
- Yarn (fallback)$3
- Nx 18+
- Turborepo 1.13+
- pnpm workspaces
- Single package repos$3
- Next.js 14+
- React 18+
- React Native 0.72+
- Angular 17+
- Vue 3+
- SvelteKit
- Node.js backends$3
- TypeScript (strict mode)
- JavaScript (ES2020+)
- JSX/TSX$3
- Jest 29+
- Vitest 1+
- Bun:testCI/CD Integration
$3
Workflows run on:
- Push to
main, develop, staging
- Pull requests
- Manual workflow dispatch
- Scheduled (cron jobs)$3
Adapt workflows for:
- GitLab CI - Convert
.yml to .gitlab-ci.yml
- CircleCI - Use equivalent config format
- Jenkins - Use pipeline syntax
- Azure Pipelines - Use YAML formatPerformance Optimization
$3
- Node Modules - Cache based on lock files
- Build Artifacts - Cache
.next, .nx/cache, etc.
- TypeScript Cache - Cache incremental compilation$3
- Tests run per-project for fail-fast
- Multiple workflows run concurrently
- Shared cache prevents duplicate work
$3
- Skip expensive checks on documentation-only changes
- Use
continue-on-error for non-blocking checks
- Run full suite only on main branchTroubleshooting
$3
"Package manager not detected"
`bash
Ensure lock file exists
bun install # Creates bun.lock
or
pnpm install # Creates pnpm-lock.yaml
`"Cannot find project configuration"
`bash
For Nx: ensure nx.json exists
For Turborepo: ensure turbo.json exists
For pnpm: ensure pnpm-workspace.yaml exists
`"Tests fail in CI but pass locally"
- Check Node/Bun versions match
- Verify environment variables
- Check for cache issues: clear and rebuild
"Workflows run too slow"
- Enable caching (enabled by default)
- Run only changed files:
--changed` flagContributions welcome! Areas:
- New workflow templates
- Platform support (GitLab, CircleCI, etc.)
- Documentation improvements
- Performance optimizations
- Bug reports and fixes
MIT License - See LICENSE file
- Bun Documentation
- pnpm Documentation
- Nx Documentation
- GitHub Actions Documentation
- ESLint Configuration
- TypeScript Compiler Options
- AFFECTIVELY - Reference implementation
- Other open-source templates
---
Questions? Open an issue or discussion in the repository.