Test environment for agent-swarm-kit with build pipeline, testing framework and Rollup bundling.
Demonstrates capabilities:
├── build/ # Build output
├── scripts/
│ ├── docs.mjs # Documentation generator
│ └── repl.mjs # REPL script
├── src/
│ ├── config/
│ │ ├── openai.ts # OpenAI configuration
│ │ └── setup.ts # System setup
│ ├── logic/
│ │ ├── agent/ # Sales agent
│ │ ├── completion/ # OpenAI completion
│ │ ├── enum/ # Type definitions
│ │ ├── swarm/ # Root swarm
│ │ └── tools/ # Add to basket tool
│ └── index.ts # Entry point
├── test/
│ ├── config/
│ │ └── setup.mjs # Test setup
│ ├── spec/
│ │ └── add_to_basket.spec.mjs # Test specs
│ └── index.mjs # Test runner
├── rollup.config.mjs # Rollup configuration
└── tsconfig.json # TypeScript config
# Install dependencies
bun install
# Run tests
bun run test
# Development mode
bun run dev
# Production build
bun run build
# REPL for testing
bun run scripts/repl.mjs
Create a .env
file:
OPENAI_API_KEY=your_openai_api_key
NODE_ENV=development
// test/spec/add_to_basket.spec.mjs
export default async function testAddToBasket() {
const result = await addToBasket({
params: { title: "Test Product" }
});
assert(result.success === true);
assert(result.message.includes("added successfully"));
}
# All tests
bun run test
# Specific test
bun run test test/spec/add_to_basket.spec.mjs
# With verbose output
bun run test --verbose
# Hot reload
bun run dev
# Optimized bundle
bun run build
# Output in build/ directory
ls build/
// rollup.config.mjs
export default {
input: 'src/index.ts',
output: {
dir: 'build',
format: 'es'
},
plugins: [
typescript(),
resolve(),
commonjs()
]
};
Ideal for:
# .github/workflows/test.yml
name: Test
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: bun install
- run: bun run test
- run: bun run build