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.1.16.tar.gz (81.9 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.1.16-py3-none-any.whl (75.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tumee_codeguard-0.1.16.tar.gz
  • Upload date:
  • Size: 81.9 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.1.16.tar.gz
Algorithm Hash digest
SHA256 cb9daa511a9f7dc45723cedaceb8ef9dd277981f16709165570f7b264e6d1347
MD5 b23549f629c8ce159d0adcb7d718b718
BLAKE2b-256 7ee8e52b0fe9bcf48b9926cadcb9d4750a11963b5d6c1fed4c2316fcdef3d190

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tumee_codeguard-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 7bad385e96d4e749a10d3167648a2db83fdcbcb221b01eeee313a8ceb955b496
MD5 d44542a1f28f2aabdcf0206560d71ce5
BLAKE2b-256 bf739ac52dd5638d296cf330c8fd0a32a93e724dbc70f7570fdfc6761fcdf751

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