This file contains guidelines and commands for agentic coding agents working on the Dev Containers CLI repository.
npm run compile- Compile the project (clean + compile-dev)npm run compile-prod- Production build with optimizationsnpm run compile-dev- Development buildnpm run compile-watch- Watch mode for developmentnpm run watch- Alias for compile-watchnpm run package- Create distributable package
npm run type-check- Run TypeScript compiler type checkingnpm run type-check-watch- Type checking in watch mode
npm run lint- Run ESLint with max-warnings 0npm run precommit- Run hygiene checks (formatting, lint, etc.)
npm test- Run all testsnpm run test-matrix- Run tests with matrix optionsnpm run test-container-features- Run container features tests onlynpm run test-container-features-cli- Run CLI features tests onlynpm run test-container-templates- Run container templates tests only
Single test execution:
# Run a specific test file
env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/cli.test.ts
# Run a specific test within a file
env TS_NODE_PROJECT=src/test/tsconfig.json mocha -r ts-node/register --exit src/test/cli.test.ts -g "test name"npm run clean- Clean all build artifactsnpm run clean-dist- Clean dist foldernpm run clean-built- Clean built folder
- Use TypeScript 5.8+ with strict mode
- Project references architecture with separate packages:
spec-common- Shared utilitiesspec-configuration- Configuration handlingspec-node- Node.js specific implementationsspec-shutdown- Docker/shutdown utilitiesspec-utils- General utilities
- Group imports: standard library → third-party → local modules
- Use
import * asfor modules with exports - Prefer named imports over default exports
- Keep import statements at file top after license header
- Tab size: 4, convert tabs to spaces: false (preserves tabs)
- Semicolons: always required
- Brace placement: same line for functions and control blocks
- Binary operators: spaces before and after
- Function calls: no spaces inside parentheses
- Template strings: no spaces inside braces
- TypeScript ESLint parser with stylistic plugin
- Key rules enforced:
- No unused variables or imports
- Curly braces required for control structures
- Strict equality checks (
===) required - No async promise executors
- No var declarations (use const/let)
- No debugger statements
- Consistent member delimiter style (semicolons)
- Files: PascalCase for classes/exports, kebab-case for utilities
- Classes/Interfaces: PascalCase (e.g.,
DevContainerConfig) - Functions/Methods: camelCase, descriptive verbs for actions
- Variables: camelCase, avoid abbreviations
- Constants: UPPER_SNAKE_CASE for top-level constants
- Types: PascalCase for type aliases, camelCase for type parameters
- Use custom
ContainerErrorclass fromsrc/spec-common/errors.ts - Always provide meaningful error messages with context
- Use try-catch blocks for async operations with proper error propagation
- Include error codes and stack traces when appropriate
- Validate inputs early and fail fast
- License Header: Include Microsoft copyright header in all .ts files
- Module Structure: Export classes/functions at module level, not inside objects
- File Size: Keep files focused and reasonably sized (<500 lines when possible)
- Dependencies: Check existing codebase before adding new npm packages
- Use Mocha with Chai assertions
- Test files end with
.test.ts - Organize tests with describe/it blocks
- Use
this.timeout('120s')for integration tests - Mock external dependencies in unit tests
- Clean up test artifacts in afterEach hooks
- Use JSDoc comments for public APIs
- Include parameter types and return types
- Document complex logic with inline comments when necessary
- Update CHANGELOG.md for significant changes
- Feature branches for new development
- Ensure all lint/type checks pass before commits
- Include tests for new functionality
- Update documentation as needed
/src/spec-*- Core specification modules/src/test/- Test files and test utilities/docs/- Documentationdevcontainer.js- Main CLI entry pointpackage.json- Project configuration and scripts.eslintrc.js- ESLint configurationtsconfig*.json- TypeScript project configurations
- Node.js version requirement: ^16.13.0 || >=18.0.0
- This is a Microsoft project with MIT license
- CLI is part of the Development Containers Specification
- Maintains backward compatibility when possible
- Uses esbuild for fast compilation