Skip to main content

A code validation tool for enforcing access control on code modifications

Project description

TuMee CodeGuard

A powerful file change detection tool that identifies, tracks, and validates code modifications with a focus on respecting designated "guarded" regions across multiple programming languages.

Package Name: tumee-codeguard Command: codeguard

Installation

Prerequisites

  • Python 3.10 or higher
  • Git (for version control integration)

Setup

On macOS/Linux

# Make the install script executable
chmod +x install.sh

# Run the installation script
./install.sh

On Windows

# Run the installation script
install.bat

Usage

Running CodeGuard

On macOS/Linux

# Run CodeGuard
./run_codeguard.sh [command] [options]

# For example, to get help
./run_codeguard.sh --help

# To get effective permissions for a file
./run_codeguard.sh acl /path/to/file

On Windows

# Run CodeGuard
run_codeguard.bat [command] [options]

# For example, to get help
run_codeguard.bat --help

# To get effective permissions for a file
run_codeguard.bat acl C:\path\to\file

Commands

  • acl - Get effective permissions for a file or directory
  • batch-acl - Get permissions for multiple paths in a batch
  • aiattributes - Manage directory-level guard annotations via .ai-attributes files
  • list-guarded-directories - List directories with guard annotations
  • verify - Compare two files directly
  • verify-disk - Compare modified file against current version on disk
  • verify-git - Compare against last checked-in version in git
  • verify-revision - Compare against specific revision
  • scan - Batch operations on directories
  • install-hook - Install git pre-commit hook
  • serve - Start MCP server

Examples

Managing Directory-Level Guard Annotations

# Create or update an .ai-attributes file
./run_codeguard.sh aiattributes create --directory ./src --rule "*.py:AI-RO" --description "*.py:Python files are AI read-only"

# List rules from .ai-attributes files
./run_codeguard.sh aiattributes list --directory ./src --recursive

# Validate .ai-attributes files
./run_codeguard.sh aiattributes validate --directory ./src --recursive

Getting Access Control Information

# Get effective permissions for a file
./run_codeguard.sh acl ./src/main.py --verbose

# Get permissions for multiple paths in a batch
./run_codeguard.sh batch-acl ./src/main.py ./src/utils.py ./src/config.py

# List directories with guard annotations
./run_codeguard.sh list-guarded-directories --directory ./src

Code Validation

# Compare two files directly
./run_codeguard.sh verify --original ./original.py --modified ./modified.py

# Compare against the last checked-in version in git
./run_codeguard.sh verify-git --file ./src/main.py

# Compare against a specific revision
./run_codeguard.sh verify-revision --file ./src/main.py --from-revision HEAD~3

Guard Annotation System

CodeGuard supports a standardized guard notation that works across programming languages:

@GUARD:WHO-PERMISSION

Where:

  • @GUARD: The prefix that identifies this as a guard directive
  • WHO: Indicates who the rule applies to (AI for AI systems, HU for human developers, ALL for both)
  • PERMISSION: Specifies the permission level (RO for read-only, ED for editable with reason, FX for fixed/unchangeable)

Examples

# @GUARD:AI-RO This is an AI read-only section
def sensitive_function():
    pass

# @GUARD:HU-ED Humans can edit this section with good reason
def editable_function():
    pass

"""
@GUARD:ALL-FX
This section is fixed for everyone
"""

Directory-Level Guard System

CodeGuard supports directory-level guard annotations through .ai-attributes files:

# All files in this directory are AI read-only
* @GUARD:AI-RO

# All Python files in this directory and subdirectories are fixed
**/*.py @GUARD:ALL-FX

# Test files in the tests directory can be edited
tests/* @GUARD:ALL-ED

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tumee_codeguard-0.2.3.tar.gz (86.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tumee_codeguard-0.2.3-py3-none-any.whl (93.4 kB view details)

Uploaded Python 3

File details

Details for the file tumee_codeguard-0.2.3.tar.gz.

File metadata

  • Download URL: tumee_codeguard-0.2.3.tar.gz
  • Upload date:
  • Size: 86.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for tumee_codeguard-0.2.3.tar.gz
Algorithm Hash digest
SHA256 e8568ddeb8cc7e2d1471f5d43ac40c2b422d18b5f833811750ca52676f87bc7a
MD5 7a3d82692b3fd8a9e7d57cc2c4fe80c0
BLAKE2b-256 3ebbca16a4e757ed28a10f88c4c19558eb4105a193badcce6d32bbe3ee61159e

See more details on using hashes here.

File details

Details for the file tumee_codeguard-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tumee_codeguard-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 40ac53c7e35fb594f798752ff10435a0abd8a0c54fed3acd757248f8a1fad429
MD5 1f39071bb500bb1359e644bc7beb14c1
BLAKE2b-256 09de998526fa20f25f7fd4ecdc8b182770c606ad620655f64fa09e99957ffb43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page