Step-by-step guide to test Agent Patterns locally.
- Node.js 18+ installed
- pnpm 8+ installed (
npm install -g pnpm)
# From the root directory
pnpm installThis installs dependencies for all packages, patterns, and apps in the monorepo.
# Build the core package (needed by patterns)
cd packages/core
pnpm build
cd ../..# Run all tests
pnpm test
# Run tests in watch mode
pnpm test --watch
# Run tests with coverage
pnpm test:coverage# Check TypeScript across entire monorepo
pnpm typecheck# Lint all code
pnpm lintThe interactive playground to test all patterns:
cd apps/playground
pnpm devThen open http://localhost:3000
What to test:
- Navigate between different patterns
- Verify each pattern renders correctly
- Check code preview updates
- Test responsive design
The documentation site:
cd apps/docs
pnpm devThen open http://localhost:3000
What to test:
- All pages load correctly
- Links work
- Code examples are readable
cd apps/examples/sales-dashboard
pnpm devThen open http://localhost:3000
What to test:
- All metrics display correctly
- Charts render properly
- Data table shows data
- Insights list displays
cd apps/examples/customer-support
pnpm devThen open http://localhost:3000
What to test:
- Form submission works
- Thinking indicator shows during processing
- Ticket table displays
- Detail card shows information
cd packages/cli
pnpm build
cd ../..Create a test directory to avoid affecting your main project:
# Create a test directory
mkdir /tmp/agent-patterns-test
cd /tmp/agent-patterns-test
# Initialize (this should create app/patterns/ and theme.config.ts)
node /Users/harsh.rajmathur/Desktop/agent-patterns/packages/cli/dist/index.js init
# Add a pattern
node /Users/harsh.rajmathur/Desktop/agent-patterns/packages/cli/dist/index.js add metric-card
# Verify files were copied
ls -la app/patterns/metric-card/
# Update patterns
node /Users/harsh.rajmathur/Desktop/agent-patterns/packages/cli/dist/index.js updateNote: Once published, you'd use npx agent-patterns instead of the node command.
Create a simple test file:
# Create test file
cat > test-pattern.tsx << 'EOF'
import { MetricCard } from "./patterns/metric-card/component"
export default function Test() {
return (
<MetricCard
label="Test Revenue"
value={1000}
trend={{ value: 20, label: "vs last month", direction: "up" }}
/>
)
}
EOF# Create schema test
node -e "
const { metricCardSchema } = require('./patterns/metric-card/schema.ts');
const result = metricCardSchema.safeParse({
label: 'Revenue',
value: 1000
});
console.log('Valid:', result.success);
"Create a test script to run everything:
# Create test-all.sh
cat > test-all.sh << 'EOF'
#!/bin/bash
echo "🔍 Type checking..."
pnpm typecheck || exit 1
echo "✅ Linting..."
pnpm lint || exit 1
echo "🧪 Running tests..."
pnpm test || exit 1
echo "🏗️ Building..."
pnpm build || exit 1
echo "✅ All checks passed!"
EOF
chmod +x test-all.sh
./test-all.shSolution: Build the core package first:
cd packages/core && pnpm build && cd ../..Solution: Make sure you've run pnpm install from the root, and the app's next.config.js includes the package in transpilePackages.
Solution:
- Ensure all packages are built:
pnpm build - Check that
tsconfig.jsonextendstsconfig.base.json - Run
pnpm typecheckto see all errors
Solution:
- Check
tailwind.config.tsincludes pattern paths - Verify
globals.csshas Tailwind directives - Restart the dev server
Before committing, verify:
-
pnpm typecheck- 0 errors -
pnpm lint- 0 warnings -
pnpm test- All tests pass -
pnpm build- All packages build successfully - Playground runs and all patterns display
- Docs site loads correctly
- Example apps run without errors
- CLI tool works (init, add, update)
- Make changes to a pattern or package
- Build if needed:
cd packages/core && pnpm build - Test the change:
pnpm test - Run the app:
cd apps/playground && pnpm dev - Verify in browser
- Type check:
pnpm typecheck - Commit when all checks pass
All Next.js apps support hot reload:
- Make changes to components
- Save the file
- Browser automatically refreshes
For package changes:
- Rebuild the package:
cd packages/core && pnpm build - Restart the app if needed