Skip to content

CodeInputCorp/cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Input CLI

Advanced CODEOWNERS file management and analysis toolkit

license Tests Build

codeinput is a powerful CLI tool for parsing, analyzing, and managing CODEOWNERS files across your repositories. It provides advanced querying capabilities, ownership analysis, and tag-based file organization.

Table of Contents

Features

CodeOwners

  • Advanced Parsing: Parse CODEOWNERS files recursively across directory structures
  • Ownership Analysis: Analyze file ownership patterns and generate detailed reports
  • Tag Support: Organize and query files using custom tags in CODEOWNERS
  • High Performance: Efficient caching and parallel processing for large repositories
  • Flexible Filtering: Filter files by owners, tags, or ownership status
  • Multiple Output Formats: Support for text, JSON, and binary output formats

Installation

Pre-built Binaries

Latest Release: 0.0.1-beta

Installation Instructions

  1. Download the appropriate binary for your platform
  2. Rename the downloaded file to ci (Linux/macOS) or ci.exe (Windows)
  3. Move the binary to your PATH: mv ci /usr/local/bin/ (Linux/macOS)
  4. Make it executable: chmod +x /usr/local/bin/ci (Linux/macOS)

What's New in 0.0.1-beta

codeinput - 0.0.1-beta

From Cargo

You can install the CLI using Cargo. Rust Toolchain required.

cargo install ci

From Source

git clone https://github.com/CodeInputCorp/cli.git
cd cli
cargo build --release --bin ci
sudo cp target/release/ci /usr/local/bin/

Quick Start

  1. Parse your CODEOWNERS files to build the cache:

    ci codeowners parse
  2. List all files with their owners:

    ci codeowners list-files
  3. Find files owned by a specific team:

    ci codeowners list-files --owners @frontend-team
  4. Inspect ownership of a specific file:

    ci codeowners inspect src/main.rs

Commands

CodeOwners

Parse CODEOWNERS

Build a cache of parsed CODEOWNERS files for fast querying:

ci codeowners parse [PATH] [OPTIONS]

Options:

  • --cache-file <FILE>: Custom cache file location (default: .codeowners.cache)
  • --format <FORMAT>: Cache format - bincode or json (default: bincode)

Examples:

# Parse current directory
ci codeowners parse

# Parse specific directory with JSON cache
ci codeowners parse ./my-repo --format json

# Use custom cache location
ci codeowners parse --cache-file .custom-cache

List Files

Find and list files with their owners based on filter criteria:

ci codeowners list-files [PATH] [OPTIONS]

Options:

  • --tags <LIST>: Filter by tags (comma-separated)
  • --owners <LIST>: Filter by owners (comma-separated)
  • --unowned: Show only unowned files
  • --show-all: Show all files including unowned/untagged
  • --format <FORMAT>: Output format - text, json, or bincode

Examples:

# List all owned files
ci codeowners list-files

# Find files with specific tags
ci codeowners list-files --tags security critical

# Find files owned by multiple teams
ci codeowners list-files --owners @backend-team @devops

# Show unowned files
ci codeowners list-files --unowned

# Output as JSON
ci codeowners list-files --format json

List Owners

Display aggregated owner statistics and file associations:

ci codeowners list-owners [PATH] [OPTIONS]

Options:

  • --format <FORMAT>: Output format - text, json, or bincode

Examples:

# Show all owners with file counts
ci codeowners list-owners

# Get owner data as JSON
ci codeowners list-owners --format json

List Tags

Analyze tag usage across CODEOWNERS files:

ci codeowners list-tags [PATH] [OPTIONS]

Options:

  • --format <FORMAT>: Output format - text, json, or bincode

Examples:

# Show all tags with usage statistics
ci codeowners list-tags

# Export tag data as JSON
ci codeowners list-tags --format json

Inspect Files

Get detailed ownership and tag information for a specific file:

ci codeowners inspect <FILE_PATH> [OPTIONS]

Options:

  • --repo <PATH>: Repository path (default: current directory)
  • --format <FORMAT>: Output format - text, json, or bincode

Examples:

# Inspect a specific file
ci codeowners inspect src/main.rs

# Inspect with different repo path
ci codeowners inspect src/main.rs --repo /path/to/repo

# Get inspection data as JSON
ci codeowners inspect src/main.rs --format json

Configuration

View current configuration settings:

ci config

Shell Completion

Generate shell completion scripts:

# For bash
ci completion bash > /etc/bash_completion.d/codeinput

# For zsh
ci completion zsh > ~/.zsh/completions/_codeinput

# For fish
ci completion fish > ~/.config/fish/completions/codeinput.fish

CODEOWNERS Format

The tool supports two approaches for defining code ownership:

1. Traditional CODEOWNERS Files

Standard CODEOWNERS syntax with additional tag support:

# Standard ownership
*.rs @rust-team
/docs/ @documentation-team

# With tags for categorization
*.security.rs @security-team #security #critical
/api/ @backend-team #api #core

# Multiple owners and tags
*.config @devops @security-team #config #infrastructure #security

# Special patterns
* @default-team #general

Pattern Matching Rules:

  • /path/to/dir/ - Matches all files and subdirectories recursively (GitHub compatible)
  • /path/to/dir/* - Matches direct files in the directory only
  • /path/to/dir/** - Matches all files and subdirectories recursively (explicit)
  • *.ext - Matches files with specific extension
  • pattern - Relative path matching

Priority Rules:

  1. Closest CODEOWNERS file: Files in subdirectories take precedence over parent directories
  2. Last match wins: Later entries in the same CODEOWNERS file override earlier ones
  3. Inline declarations: Per-file inline ownership

2. Inline Per-File Ownership

For fine-grained control, declare ownership directly within individual files using the !!!CODEOWNERS marker:

Rust Example:

// !!!CODEOWNERS @security-team @alice #security #critical
use std::crypto;

fn encrypt_data() {
    // sensitive crypto code
}

JavaScript/TypeScript Example:

// !!!CODEOWNERS @frontend-team #ui #components
export const Button = () => {
  return <button>Click me</button>;
};

HTML Example:

<!-- !!!CODEOWNERS @design-team #ui #templates -->
<div class="hero-section">
  <h1>Welcome</h1>
</div>

CSS Example:

/* !!!CODEOWNERS @design-team #styles #branding */
.brand-colors {
  --primary: #007bff;
  --secondary: #6c757d;
}

Inline Format Rules:

  • Must appear within the first 50 lines of the file
  • Can be used in any comment style (//, #, /**/, <!-- -->)
  • Takes highest priority over all CODEOWNERS file patterns
  • Supports same owner and tag syntax as CODEOWNERS files
  • Only one inline declaration per file (first one found is used)

Supported Owner Types:

  • Users: @username
  • Teams: @org/team-name
  • Email: user@example.com

Tag Format:

  • Tags start with # and appear after owners
  • Multiple tags are supported: #tag1 #tag2 #tag3
  • Tags can contain letters, numbers, hyphens, and underscores
  • Comments after tags are ignored (e.g., #tag1 # this is a comment)

How to Contribute

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Code Input CLI

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages