Thank you for your interest in DemoForge! This document covers the development workflow, code standards, and contribution process for this monorepo.
- Monorepo Structure
- Development Setup
- Building and Testing
- Adding a New Package
- Code Style
- Commit Guidelines
- Submitting a Pull Request
DemoForge uses npm workspaces for its monorepo. All packages share a single package.json at the root and are built together with TypeScript project references.
demo-forge/
├── package.json # Root: workspaces, shared scripts
├── tsconfig.json # Shared TS config with path aliases
├── eslint.config.mjs # ESLint flat config
├── vitest.config.ts # Vitest test runner config
├── .prettierrc # Prettier formatting
├── packages/
│ ├── core/ # @demoforge/core — types, schemas, config, LLM, explorer
│ ├── browser/ # @demoforge/browser — Playwright abstraction
│ ├── cli/ # @demoforge/cli — CLI commands
│ ├── renderer/ # @demoforge/renderer — replay, capture, effects, TTS
│ ├── site/ # @demoforge/site — static site generator
│ └── test-utils/ # @demoforge/test-utils — mock LLM server, fixtures
├── test/ # E2E tests, mock web app, fixtures
├── examples/ # Example demo scripts
└── dist/ # Build output
cli ──► core, browser, renderer, site
renderer ──► core, browser
site ──► core, renderer
browser ──► core
core ──► (none)
test-utils ──► (none, dev-only)
- Node.js 20+ (LTS)
- npm 9+
- ffmpeg (for renderer tests)
- Playwright browsers (
npx playwright install)
# Clone the repository
git clone https://github.com/your-org/demo-forge.git
cd demo-forge
# Install all dependencies
npm install
# Build all packages
npm run build
# Run the full test suite
npm test
# Start TypeScript watch mode
npm run watch# Build all packages
npm run build
# Build a single package
tsc --build packages/core
# Watch mode (rebuilds on changes)
npm run watchThe root build script orchestrates all packages via explicit tsc --build paths. Packages must be built in dependency order: core → browser → cli, renderer → site.
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests for a specific package
npx vitest run packages/core
# Run with coverage
npx vitest run --coverageTests are organized per-package under packages/*/src/*.test.ts. E2E tests live in test/e2e/.
# Lint all packages
npm run lint
# Auto-fix lint issues
npm run lint:fix
# Format all files
npm run format
# Check formatting without changes
npm run format:checkmkdir packages/new-pkg{
"name": "@demoforge/new-pkg",
"version": "1.0.0",
"private": true,
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": "./dist/index.js"
},
"scripts": {
"build": "tsc --build",
"watch": "tsc --build --watch"
},
"dependencies": {
"@demoforge/core": "^1.0.0"
},
"devDependencies": {
"@types/node": "^20.11.0",
"typescript": "^5.3.0"
}
}{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"paths": {
"@demoforge/core": ["../../packages/core/src/index.ts"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.test.ts", "dist"]
}echo 'export * from "./module.js";' > packages/new-pkg/src/index.ts- Add the package to
workspacesin rootpackage.json(if not usingpackages/*) - Add the package to
buildandwatchscripts in rootpackage.json - Add the package to
tsconfig.jsonproject references - Add path aliases for
@demoforge/new-pkgin roottsconfig.json - Add resolve aliases in
vitest.config.ts
npm run build
npm testDemoForge uses Prettier for formatting and ESLint for linting. The configuration is at the root level and applies to all packages.
- Semicolons: always
- Trailing commas: es5
- Single quotes
- 100 character line width
- 2-space indentation
- Strict mode enabled (
"strict": true) - ES2022 target
- Node16 module resolution
- No implicit any (
"noImplicitAny": true) - Strict null checks (
"strictNullChecks": true)
- Classes: PascalCase (
BrowserSession,CapturePipeline) - Functions: camelCase (
loadConfig,validateDemoScript) - Interfaces: PascalCase (
Config,DemoScript) - Types: PascalCase (
DemoStep,NarrationMode) - Constants: UPPER_SNAKE_CASE (
DEFAULT_LLM,CONFIG_FILENAMES) - Private fields: leading underscore (
this._logger) - Exports: named exports preferred over default exports
- Node.js built-in modules
- Third-party packages
- Relative imports (
../,./) @demoforge/*scoped packages
Within each group, sort alphabetically.
DemoForge uses conventional commits:
<type>(<scope>): <subject>
<body>
<footer>
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation changes |
test |
Adding or updating tests |
refactor |
Code refactoring |
chore |
Build/tooling changes |
ci |
CI configuration changes |
feat(cli): add heal command for selector repair
fix(renderer): fix global timeout not checking between steps
docs(readme): add CLI reference section
test(core): add 25 seed hook tests
refactor(browser): extract selector resolution to helper
chore(deps): update vitest to 1.2.0
-
Create a feature branch from
main:git checkout main git pull git checkout -b feat/my-feature
-
Make your changes, following the code style guidelines above.
-
Write tests for new functionality. Run the full test suite:
npm test -
Build and verify no TypeScript errors:
npm run build
-
Lint and format:
npm run lint:fix npm run format
- Tests pass (
npm test) - Build succeeds (
npm run build) - Linting passes (
npm run lint) - Documentation updated (README, package READMEs)
- Commit messages follow conventional commits
- PR title and description are clear and descriptive
## Summary
Brief description of the changes.
## Changes
- Added/modified `<file>`: `<description>`
- Added/modified `<file>`: `<description>`
## Testing
- [ ] `npm test` passes
- [ ] `npm run build` succeeds
- [ ] Manual testing steps (if applicable)
## Related Issues
Closes #<issue-number># Start TypeScript watch mode in a terminal
npm run watch
# In another terminal, run tests
npm run test:watch# Build only core package
tsc --build packages/core
# Run tests for core only
npx vitest run packages/core
# Open a package in VS Code
code packages/coreTypeScript path alias resolution failing:
Make sure tsconfig.json in the root has the correct paths entries and that tsc --build is run after any path changes.
Tests failing with module not found:
Run npm run build to ensure all packages are compiled. Vitest resolves @demoforge/* imports to dist/ files.
Playwright browser not found:
Run npx playwright install chromium to install the required browser.
- Open an issue on GitHub for bugs or feature requests
- Check existing issues before opening a new one
- Join the discussion in pull requests