Developer Guide
Welcome to the noidea developer documentation. This section provides information for contributors and developers who want to understand or extend noidea's functionality.
Project Architecture
noidea is written in Go and organized into several key components:
- cmd: Command-line interface and entry points
- internal: Core functionality modules
- scripts: Git hooks and installation scripts
noidea/
├── cmd/ # Commands implementation
│ ├── root.go # Base command and CLI setup
│ ├── suggest.go # Commit suggestion command
│ ├── moai.go # Feedback command
│ └── ...
├── internal/ # Internal packages
│ ├── config/ # Configuration handling
│ ├── feedback/ # Feedback generation
│ ├── git/ # Git operations
│ ├── history/ # Commit history analysis
│ ├── moai/ # Moai face and local feedback
│ ├── personality/ # AI personality system
│ └── secure/ # Secure API key storage
├── scripts/ # Installation and Git hooks
└── docs/ # Documentation
Key Components
Command Layer
The cmd
package uses the Cobra library to implement the CLI commands. Each command is defined in its own file.
Internal Packages
- config: Handles reading/writing configuration from files and environment
- feedback: Generates AI-powered feedback through different providers
- git: Manages Git operations like getting diffs and commit history
- history: Analyzes commit patterns and statistics
- moai: Manages Moai faces and local feedback generation
- personality: Handles the AI personality system and templates
- secure: Manages secure storage of API keys
Getting Started with Development
-
Clone the repository:
-
Install dependencies:
-
Build the project:
-
Run tests:
Development Workflow
-
Create a feature branch:
-
Make your changes and test them:
-
Formatting and Linting:
The project uses Git hooks to automatically format and lint your code when committing:
- Pre-commit hook: Automatically runs go mod tidy
, formats code, organizes imports, and lints
- Pre-push hook: Runs tests before allowing a push to remote
- Commit your changes: The pre-commit hook will automatically:
- Format code with goimports and gofmt
- Organize imports consistently
- Run linters to catch common issues
-
Add formatted files to your commit
-
Push your changes:
The pre-push hook will run tests to ensure nothing breaks -
Submit a pull request:
- Ensure all tests pass
- Update documentation if needed
- Follow the code style of the project
Useful Make Commands
# Set up Git hooks (if not already set up)
make setup-hooks
# Format code manually
make format
# Run linters on project files
make script-lint
# Run tests
make test
# Build the project
make build
Documentation
Documentation is built using MkDocs with the Material theme.
To preview the documentation locally:
# Install mkdocs and the material theme
pip install mkdocs mkdocs-material
# Serve the documentation locally
mkdocs serve
More Developer Resources
- Architecture - Detailed architecture documentation
- Contributing - How to contribute to noidea