Sangeetha-Grantha

Metadata Value
Status Active
Version 1.1.0
Last Updated 2026-09-10
Author Sangeetha Grantha Team
Document Type Design reference

Commit Guardrails and Workflow Enforcement System


[!NOTE] Design/reference material: this page may include proposals or earlier implementation assumptions. Use current feature map for implemented behavior and current operating steps.


Executive Summary

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:

Technology Stack: Rust-based CLI tool (sangita-cli) integrated with Git hooks (commit-msg, pre-commit)


1. Feature Requirements

1.1 User Goals

Primary Users: All developers working on the codebase.

User Stories:

1.2 Functional Requirements

1.2.1 Documentation Reference Enforcement

Requirement: All commits must be against a unique reference entry in the application_documentation folder.

Details:

1.2.2 Single Reference Per Commit Session

Requirement: Commits must be logically grouped - a developer cannot commit changes that reference multiple documentation entries simultaneously.

Details:

1.2.3 Pre-commit & Developer Experience

Requirement: Validation must run automatically via Git hooks and be available as a manual check command.

Details:

1.2.4 IDE Integration

Requirement: The system must integrate seamlessly with popular IDEs without requiring special configuration.

Details:

1.2.5 Sensitive Data Protection

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:


2. Technical Architecture

2.1 System Components

2.1.1 Rust CLI Tool Extension (sangita-cli)

The logic resides in tools/sangita-cli/src/commands/commit.rs. It is responsible for:

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.

2.1.2 Git Hooks

2.2 Commit Message Format

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.

3. Workflow Examples

3.1 Standard Feature Development Workflow

  1. Developer creates/updates feature documentation: application_documentation/01-requirements/features/my-feature.md
  2. Developer makes code changes and stages them (git add ...).
  3. Developer commits with reference: git commit -m "Implement feature X ... Ref: ..."
  4. Hook validates commit automatically:
    • ✅ Reference exists and is valid -> Commit proceeds.

3.2 Invalid Commit (Missing Reference)

  1. Developer commits without reference: git commit -m "Fix bug in API"
  2. Hook rejects commit:
    • Error displayed: “Commit message must include a reference to application_documentation”.
  3. Developer fixes and retries using git commit --amend or correcting the message.

3.3 Manual Validation

Developers can validate messages manually before committing using the CLI tool. (See tools/sangita-cli/README.md for command usage).


4. Success Metrics


5. Risks and Mitigations

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.

6. Implementation Details

6.1 Implementation Status

Status: Implemented (2026-01-05)
Location: tools/sangita-cli/src/commands/commit.rs
Version: 0.2.0

6.2 Commands

The following commands are available:

6.3 Technical Details

Dependencies:

Key Features:

Sensitive Data Patterns Detected:

Error Handling:

6.4 Usage Examples

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

6.5 Integration

The hooks integrate seamlessly with:

No special configuration required beyond running cargo run -- commit install-hooks once.


7. References


Section index · Documentation home · Feature status