Crates.io | ci |
lib.rs | ci |
version | 0.0.3 |
created_at | 2017-06-15 02:54:30.6469+00 |
updated_at | 2025-06-23 14:40:29.794549+00 |
description | A powerful CLI tool for parsing, analyzing, and managing CODEOWNERS files. Provides advanced querying capabilities, ownership analysis, and tag-based file organization. |
homepage | |
repository | https://github.com/CodeInputCorp/cli |
max_upload_size | |
id | 19018 |
size | 81,894 |
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
Latest Release: 0.0.1-beta
ci
(Linux/macOS) or ci.exe
(Windows)mv ci /usr/local/bin/
(Linux/macOS)chmod +x /usr/local/bin/ci
(Linux/macOS)codeinput - 0.0.1-beta
You can install the CLI using Cargo. Rust Toolchain required.
cargo install ci
git clone https://github.com/CodeInputCorp/cli.git
cd cli
cargo build --release --bin ci
sudo cp target/release/ci /usr/local/bin/
Parse your CODEOWNERS files to build the cache:
ci codeowners parse
List all files with their owners:
ci codeowners list-files
Find files owned by a specific team:
ci codeowners list-files --owners @frontend-team
Inspect ownership of a specific file:
ci codeowners inspect src/main.rs
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
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
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
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
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
View current configuration settings:
ci config
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
The tool supports two approaches for defining code ownership:
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 extensionpattern
- Relative path matchingPriority Rules:
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:
//
, #
, /**/
, <!-- -->
)Supported Owner Types:
@username
@org/team-name
user@example.com
Tag Format:
#
and appear after owners#tag1 #tag2 #tag3
#tag1 # this is a comment
)We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.