| Metadata | Value |
|---|---|
| Status | Active |
| Version | 1.1.0 |
| Last Updated | 2026-09-10 |
| Author | Sangeetha Grantha Team |
| Document Type | Design reference |
[!NOTE] Design/reference material: this page may include proposals or earlier implementation assumptions. Use current feature map for implemented behavior and current operating steps.
This document defines the requirements for a Commit Guardrails and Workflow Enforcement System that ensures all code changes are properly documented, logically grouped, and traceable to specific feature requests, bug fixes, or change requests. The system leverages Rust’s capabilities to create robust, fast, and cross-platform tooling that integrates seamlessly with Git hooks and modern IDEs.
Key Objectives:
application_documentationTechnology Stack: Rust-based CLI tool (sangita-cli) integrated with Git hooks (commit-msg, pre-commit)
Primary Users: All developers working on the codebase.
User Stories:
Requirement: All commits must be against a unique reference entry in the application_documentation folder.
Details:
application_documentation/.Ref: application_documentation/01-requirements/features/my-feature.md or relative paths.Requirement: Commits must be logically grouped - a developer cannot commit changes that reference multiple documentation entries simultaneously.
Details:
Ref: tags if strict 1:1 mapping is enforced.Requirement: Validation must run automatically via Git hooks and be available as a manual check command.
Details:
commit-msg hook validates commit message format and reference.sangita-cli commit check to validate before committing.Requirement: The system must integrate seamlessly with popular IDEs without requiring special configuration.
Details:
Requirement: The system must detect and mask/strip specific API keys and sensitive tokens (e.g., SG_GEMINI_API_KEY) from files being committed.
Details:
******) and require the user to stage the safe version.sangita-cli)The logic resides in tools/sangita-cli/src/commands/commit.rs. It is responsible for:
application_documentation/.Implementation Status: ✅ Implemented (2026-01-05)
See tools/sangita-cli/README.md for usage instructions and tools/sangita-cli/src/commands/commit.rs for implementation details.
commit-msg Hook: Triggered when a commit message is being finalized. Blocks the commit if validation fails.pre-commit Hook: Responsible for scanning staged files for sensitive data (API keys) and other content checks before the commit message editor is even invoked.Standard Format:
<subject line>
Ref: application_documentation/01-requirements/features/my-feature.md
<optional body>
Examples:
Feature Implementation:
Implement graph explorer API endpoints
Ref: application_documentation/01-requirements/features/graph-explorer.md
- Add GET /v1/graph/entities endpoint
- Add GET /v1/graph/neighborhood endpoint
Bug Fix:
Fix raga validation in krithi editor
Ref: application_documentation/01-requirements/features/ragamalika-validation.md
Resolves issue where raga validation was not checking for valid raga IDs.
application_documentation/01-requirements/features/my-feature.mdgit add ...).git commit -m "Implement feature X ... Ref: ..."git commit -m "Fix bug in API"git commit --amend or correcting the message.Developers can validate messages manually before committing using the CLI tool.
(See tools/sangita-cli/README.md for command usage).
| Risk | Impact | Mitigation |
|---|---|---|
| Developers find hooks disruptive | High | Make hooks fast, provide clear error messages. |
| False positives | High | Graceful handling of edge cases (merges, rebases). |
| IDE compatibility issues | Medium | Use standard Git hooks which are universally supported. |
✅ Status: Implemented (2026-01-05)
Location: tools/sangita-cli/src/commands/commit.rs
Version: 0.2.0
The following commands are available:
cargo run -- commit check [--message <msg>] - Validate commit message formatcargo run -- commit scan-sensitive - Scan staged files for sensitive datacargo run -- commit install-hooks - Install Git hookscargo run -- commit uninstall-hooks - Remove Git hooksDependencies:
regex = "1.11.1" - For pattern matching in commit messages and sensitive data detectionKey Features:
Ref: or ref:)Sensitive Data Patterns Detected:
api[_-]?key, apikey, SG_GEMINI_API_KEYsecret, password, tokenAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEYError Handling:
Valid Commit:
git commit -m "Implement feature X
Ref: application_documentation/01-requirements/features/my-feature.md
- Added new endpoint
- Updated tests"
Invalid Commit (will be rejected):
git commit -m "Fix bug"
# Error: Commit message must include a reference to application_documentation
Manual Validation:
echo "My commit message
Ref: application_documentation/01-requirements/features/my-feature.md" | \
cargo run -- commit check
The hooks integrate seamlessly with:
No special configuration required beyond running cargo run -- commit install-hooks once.