Complete guide to setting up a development environment for Shep AI CLI.
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Runtime |
| pnpm | 8+ | Package management |
| Git | 2.30+ | Version control |
Install pnpm: npm install -g pnpm
| Tool | Purpose |
|---|---|
| VS Code | IDE with TypeScript support |
| SQLite Browser | Database inspection |
| Playwright VS Code Extension | E2E test debugging |
| HTTPie/curl | API testing |
git clone https://github.com/shep-ai/cli.git
cd cli
pnpm install
This installs all dependencies including dev dependencies.
# Run type check
pnpm typecheck
# Run tests
pnpm test
# Build
pnpm build
# Start Storybook (design system)
pnpm dev:storybook
cli/
├── packages/core/src/
│ ├── domain/ # Business logic (no deps)
│ │ ├── entities/
│ │ ├── value-objects/
│ │ └── services/
│ ├── application/ # Use cases and ports
│ │ ├── use-cases/
│ │ ├── ports/
│ │ └── services/
│ └── infrastructure/ # External implementations
│ ├── repositories/
│ ├── agents/
│ ├── persistence/
│ └── services/
├── src/
│ └── presentation/ # UI layers
│ ├── cli/ # Commander-based CLI
│ ├── tui/ # @inquirer/prompts interactive wizards
│ └── web/ # Next.js + shadcn/ui
│ ├── app/ # Next.js App Router
│ ├── components/
│ │ ├── ui/ # shadcn/ui components
│ │ └── ... # Feature components
│ └── stories/ # Storybook stories
├── tests/
│ ├── unit/ # Vitest unit tests
│ ├── integration/ # Vitest integration tests
│ └── e2e/ # Playwright e2e tests
├── docs/ # Documentation
├── scripts/ # Build/dev scripts
├── .storybook/ # Storybook config
└── dist/ # Build output
Recommended extensions:
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-vscode.vscode-typescript-next"
]
}
Settings (.vscode/settings.json):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.preferences.importModuleSpecifier": "relative"
}
Debug configuration (.vscode/launch.json):
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug CLI",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/src/presentation/cli/index.ts",
"runtimeArgs": ["-r", "ts-node/register"],
"console": "integratedTerminal"
},
{
"name": "Debug Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/vitest",
"args": ["run", "--reporter=verbose"],
"console": "integratedTerminal"
}
]
}
# Run CLI directly (ts-node)
pnpm dev:cli
# Start Web UI (Next.js)
pnpm dev:web
# Start Storybook (Design System)
pnpm dev:storybook
# Link package globally
pnpm link --global
# Now 'shep' command is available
shep --help
# Unlink when done
pnpm unlink --global @shepai/cli
Development database location: ~/.shep/repos/...
Database migrations run automatically via the user_version pragma when the CLI bootstraps. To inspect the database manually:
# Using sqlite3 CLI
sqlite3 ~/.shep/repos/<encoded-path>/data
# Common queries
.tables
SELECT * FROM features;
This project uses Test-Driven Development. See tdd-guide.md for the full TDD workflow.
# TDD watch mode (recommended for development)
pnpm test:watch
# All tests
pnpm test
# Unit tests only
pnpm test:unit
# Integration tests only
pnpm test:int
# E2E tests (Playwright)
pnpm test:e2e
# Specific file
pnpm test:single tests/unit/domain/entities/feature.test.ts
Tests use in-memory SQLite:
// tests/helpers/db.ts
export function createTestDatabase(): Database {
return new Database(':memory:');
}
# Via environment variable
DEBUG=shep:* pnpm dev:cli
# Or specific modules
DEBUG=shep:agents:* pnpm dev:cli
# Enable deployment service logging (dev server start/stop, port detection)
DEBUG=1 pnpm dev:cli
For web UI client-side debug logging, add to src/presentation/web/.env.local:
NEXT_PUBLIC_DEBUG=1
// Add to agent config
{
"agents": {
"logging": {
"level": "debug",
"includeMessages": true,
"includePayloads": true
}
}
}
# Using sqlite3 CLI
sqlite3 ~/.shep/repos/<encoded-path>/data
# Common queries
.tables
SELECT * FROM features;
SELECT * FROM tasks WHERE feature_id = 'xxx';
# Check version
node --version
# Use nvm to switch
nvm use 20
# Clean install
rm -rf node_modules
pnpm install
# Rebuild
pnpm build
Check for:
# Rebuild native modules
pnpm rebuild better-sqlite3
# Install browsers
pnpm exec playwright install
# Run with debug
pnpm test:e2e --debug
Update when:
Related docs: