Thank you for your interest in contributing to azd-app! This document provides guidelines for contributing to the project.
Before contributing, ensure you have the following installed:
- Go: 1.26.1 or later
- Node.js: 20.0.0 or later
- npm: 10.0.0 or later
- PowerShell: 7.4 or later (recommended: 7.5.4 for full compatibility)
- TypeScript: 5.9.3 (installed via npm when building dashboard)
- Azure Developer CLI (azd): Latest version
You can verify your versions:
go version # Should be 1.26.1+
node --version # Should be v20.0.0+
npm --version # Should be 10.0.0+
pwsh --version # Should be 7.4+ or 7.5.4
tsc --version # Should be 5.9.3 (after npm install in dashboard/)
azd version # Should be latest- Fork the repository and clone your fork
- Set up your development environment based on the component you're working on:
# Navigate to CLI directory
cd cli
# Install Go dependencies
go mod download
# Install dashboard dependencies
cd dashboard
npm install
cd ..
# Build the extension
go build -o bin/app.exe ./src/cmd/appNote: If you encounter an error like "Operation did not complete successfully because the file contains a virus or potentially unwanted software", you need to exclude
go.exefrom Windows Defender or your antivirus software. This is a common false positive when Go builds executables. See Windows Defender exclusions for instructions.
-
Install locally for testing:
cd cli # First time setup: Add the local registry source (one-time) azd extension source add -n app -t file -l "<path-to-repo>/registry.json" # Example: azd extension source add -n app -t file -l "C:\code\azd-app\registry.json" # Install the extension from the local registry azd extension install jongio.azd.app --source app --force # Verify installation azd app version
After the initial setup, you can rebuild and reinstall with:
# Build and install extension mage build # or azd x build # Verify installation azd app version
-
Development workflow with watch mode:
# For active development, use watch mode to auto-rebuild on file changes azd x watch
For the best development experience, add these settings to your .vscode/settings.json:
{
"go.lintFlags": ["--fast"],
"go.lintTool": "golangci-lint",
"go.vetOnSave": "package",
"gopls": {
"analyses": {
"nilness": true,
"shadow": true,
"ST1003": true,
"unusedparams": true,
"unusedwrite": true,
"useany": true
},
"staticcheck": true
}
}These settings enable:
- nilness: Catch potential nil pointer dereferences
- shadow: Find variable shadowing issues
- ST1003: Check for proper naming conventions
- unusedparams: Detect unused function parameters
- unusedwrite: Identify writes to variables that are never read
- useany: Suggest using
anyinstead ofinterface{} - staticcheck: Enable comprehensive static analysis
git checkout -b feature/your-feature-name- Follow Go code conventions
- Run
mage fmtto format your code - Add tests for new functionality
- Update documentation as needed
# Build and install for testing
azd x build --skip-install=false
# Or use watch mode during active development
azd x watch
# Test the extension
azd app <your-command>
# Run unit tests (legacy - use azd x build instead)
go test ./...
go test -cover ./...git add .
git commit -m "feat: add support for X"Follow Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changestest:Adding or updating testsrefactor:Code refactoringchore:Maintenance tasks
git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
- Follow Effective Go
- Use
gofmtfor formatting - Run
golangci-lint runbefore committing - Keep functions small and focused
- Add comments for exported functions
- Write tests for new functionality
- Aim for 80% code coverage minimum
- Use table-driven tests where appropriate
- Mock external dependencies (file system, exec.Command)
- Update README.md for user-facing changes
- Add/update docs/ files for new features
- Document non-obvious code with comments
- Update CHANGELOG.md for notable changes
cli/
├── src/
│ ├── cmd/app/commands/ # CLI command implementations
│ └── internal/
│ ├── azure/ # Azure integration (credentials, logs)
│ ├── config/ # Configuration loading
│ ├── dashboard/ # Web dashboard server
│ ├── detector/ # Project detection logic
│ ├── docker/ # Docker/container support
│ ├── executor/ # Process execution
│ ├── healthcheck/ # Service health monitoring
│ ├── installer/ # Dependency installation
│ ├── logging/ # Structured logging
│ ├── monitor/ # Service state monitoring
│ ├── notifications/ # Desktop notifications
│ ├── orchestrator/ # Service lifecycle orchestration
│ ├── portmanager/ # Port allocation
│ ├── runner/ # Project execution
│ ├── service/ # Service management core
│ └── workspace/ # Workspace utilities
├── dashboard/ # React dashboard (Vite)
├── tests/projects/ # Test fixture projects
└── magefile.go # Build tasks (mage)
web/ # Astro documentation site
-
Create a new file in
src/cmd/app/commands/(e.g.,your_command.go) -
Implement the command following the existing patterns (see
run.go,reqs.go, etc.) -
Register the command in
src/cmd/app/commands/root.go:rootCmd.AddCommand(newYourCommand())
-
Add tests in
src/cmd/app/commands/your_command_test.go -
Update documentation
- Add detection logic in
src/internal/detector/ - Add installation logic in
src/internal/installer/ - Create test project in
tests/projects/package-managers/ - Add unit tests
- Update documentation
Use the test projects in tests/projects/ for integration testing:
cd tests/projects/package-managers/node/test-npm-project
azd app install
azd app runCreate new test projects with minimal dependencies for faster testing.
Before submitting a PR, ensure:
- All tests pass:
mage test(orgo test ./...) - Code coverage is maintained:
mage testcoverage - Linter passes:
mage lint - Code is formatted:
mage fmt - Documentation is updated
- Commit messages follow Conventional Commits
Recommended: Run mage preflight to execute all quality checks at once.
The documentation website uses automated screenshot capture for visual consistency, but these must be run manually (they are not part of CI/CD).
To update screenshots of the documentation website pages:
cd web
pnpm install
pnpm run dev # Start the dev server in another terminal
npx playwright test --update-snapshots --project=chromiumThis captures screenshots of key pages in light/dark mode and at various viewport sizes.
To capture screenshots of the azd app dashboard for marketing purposes:
cd web
npx tsx scripts/capture-screenshots.tsThis script:
- Starts the demo project with
azd app run - Waits for services to be ready
- Captures screenshots of different dashboard views
- Saves optimized images to
web/public/screenshots/
Note: Dashboard screenshots require a working azd-app binary in cli/bin/.
- Update documentation with details of changes
- Update CHANGELOG.md with notable changes
- Ensure all tests pass and coverage meets requirements
- Request review from maintainers
- Address review feedback
- Once approved, maintainer will merge
When reviewing code:
- Check for test coverage
- Verify error handling
- Ensure documentation is clear
- Look for edge cases
- Confirm code follows Go conventions
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Check existing issues and documentation first
By contributing, you agree that your contributions will be licensed under the MIT License.