🚀 CoCode - Repository Analysis and SWE Automation Tool
Here are some common CoCode command examples to get you started:
# Basic repository analysis
cocode repox convert --output-filename cocode_test.txt
# Analyze external project
cocode repox convert ../pipelex-cookbook/ --output-filename pipelex-cookbook.txt
# Extract examples with specific Python rule
cocode repox convert ../pipelex-cookbook/ --output-filename "pipelex-cookbook-examples.txt" \
--path-pattern "examples" --python-rule integral --include-pattern "*.py"
# Extract Python imports from tools directory
cocode repox convert ../pipelex/ --output-filename "pipelex-tools-imports.txt" \
--path-pattern "tools" --python-rule imports --output-style import_list \
--include-pattern "*.py"
# Analyze test interfaces
cocode repox convert ../pipelex/ --output-filename "pipelex-tests.txt" \
--path-pattern "tests" --python-rule interface --include-pattern "*.py"
# Extract cursor rules
cocode repox convert ../pipelex/ --output-filename "pipelex-cursor-rules.txt" \
--path-pattern ".cursor/rules" --include-pattern "*.mdc"
# Extract documentation
cocode repox convert ../pipelex/ --output-filename "pipelex-docs.txt" \
--path-pattern "docs" --include-pattern "*.md"
# Tree structure only
cocode repox convert ../pipelex/ --output-filename "pipelex-docs-tree.txt" \
--path-pattern "docs" --include-pattern "*.md" --output-style tree
# Flat documentation with exclusions
cocode repox convert ../pipelex/ --output-filename "pipelex-docs.txt" \
--path-pattern "docs" --include-pattern "*.md" \
--exclude-pattern "contributing.md" --exclude-pattern "CODE_OF_CONDUCT.md" \
--exclude-pattern "changelog.md" --exclude-pattern "license.md" \
--output-style flat
# SWE analysis: Extract fundamentals from local repo
cocode swe from-repo extract_fundamentals ../pipelex/ \
--path-pattern "docs" --include-pattern "*.md" \
--output-filename "fundamentals.json"
# SWE analysis: Extract fundamentals from GitHub repo
cocode swe from-repo extract_fundamentals requests/requests \
--path-pattern "docs" --include-pattern "*.md" \
--output-filename "requests-fundamentals.json"
# SWE analysis: Extract onboarding documentation from local repo
cocode swe from-repo extract_onboarding_documentation ../pipelex/ \
--path-pattern "docs" --include-pattern "*.md" \
--output-filename "docs-structured.json"
# SWE analysis: Extract onboarding documentation from GitHub repo with full URL
cocode swe from-repo extract_onboarding_documentation https://github.com/psf/black \
--path-pattern "docs" --include-pattern "*.md" \
--output-filename "black-docs-structured.json"
# SWE analysis: Comprehensive documentation extraction
cocode swe from-repo extract_onboarding_documentation ../pipelex/ \
--include-pattern "*.md" --include-pattern "*.mdc" \
--include-pattern "Makefile" --include-pattern "mkdocs.yml" \
--include-pattern "pyproject.toml" --include-pattern ".env.example" \
--output-filename "docs-structured.json"
# SWE analysis: Extract features recap from file
cocode swe from-file extract_features_recap ./results/pipelex-docs.txt \
--output-filename "pipelex-features-recap.md"
# SWE analysis: Generate changelog from git diff (local repo)
cocode swe from-repo-diff write_changelog v0.2.4 ../pipelex-cookbook/ \
--output-filename "changelog.md"
# SWE analysis: Generate changelog from GitHub repo
cocode swe from-repo-diff write_changelog v2.0.0 requests/requests \
--output-filename "requests-changelog.md"
# GitHub operations
cocode github auth # Check authentication status
cocode github repo-info pipelex/cocode # Get repository information
cocode github check-branch pipelex/cocode main # Check if branch exists
cocode github list-branches pipelex/cocode --limit 10 # List branches
cocode github sync-labels pipelex/cocode ./labels.json # Sync labelsCoCode provides powerful tools for repository analysis and Software Engineering automation through a command-line interface. It can convert repository structures to text files and perform AI-powered analysis using configurable pipelines.
CoCode supports analyzing both local repositories and GitHub repositories directly. You can specify GitHub repositories in several formats:
- Short format:
owner/repo(e.g.,microsoft/vscode) - Full HTTPS URL:
https://github.com/owner/repo - SSH URL:
git@github.com:owner/repo.git - Branch-specific:
owner/repo@branchor full URLs with/tree/branch
Features:
- Smart Caching: Repositories are cached locally for faster subsequent analysis
- Authentication: Supports GitHub Personal Access Tokens (PAT) and GitHub CLI authentication
- Private Repositories: Access private repositories with proper authentication
- Shallow Cloning: Fast cloning with minimal history for analysis purposes
- Branch Support: Analyze specific branches or tags
Authentication Setup:
# Option 1: Set environment variable
export GITHUB_PAT=your_personal_access_token
# Option 2: Use GitHub CLI (recommended)
gh auth login
# Verify authentication
cocode github auth# Validate your setup
cocode validateConvert repository structure and contents to text files for analysis.
Basic Usage:
# Analyze current directory
cocode repox convert
# Specify output file
cocode repox convert --output-filename my-repo.txt
# Analyze external repository
cocode repox convert ../my-project/ --output-filename project-analysis.txtAdvanced Filtering:
# Filter by file patterns
cocode repox convert --include-pattern "*.py" --python-rule interface
# Extract Python imports from specific directory
cocode repox convert ../pipelex/ \
--output-filename "pipelex-tools-imports.txt" \
--path-pattern "tools" \
--python-rule imports \
--output-style import_list \
--include-pattern "*.py"
# Analyze documentation with filtering
cocode repox convert ../project/ \
--output-filename "docs.txt" \
--path-pattern "docs" \
--include-pattern "*.md" \
--exclude-pattern "contributing.md" \
--exclude-pattern "changelog.md" \
--output-style flatOptions:
--output-dir, -o: Output directory (use 'stdout' for console)--output-filename, -n: Output filename--exclude-pattern, -i: Patterns to ignore (gitignore format)--include-pattern, -r: Patterns files must match (glob)--path-pattern, -pp: Regex pattern for path filtering--python-rule, -p: Python processing rule--output-style, -s: Output format
Perform Software Engineering analysis on repositories using AI pipelines. Supports both local repositories and GitHub repositories.
Local Repository Examples:
# Extract fundamentals from documentation
cocode swe from-repo extract_fundamentals ../pipelex/ \
--path-pattern "docs" \
--include-pattern "*.md" \
--output-filename "fundamentals.json"
# Extract comprehensive documentation structure
cocode swe from-repo extract_onboarding_documentation ../pipelex/ \
--include-pattern "*.md" \
--include-pattern "*.mdc" \
--include-pattern "Makefile" \
--include-pattern "mkdocs.yml" \
--include-pattern "pyproject.toml" \
--include-pattern ".env.example" \
--output-filename "docs-structured.json"
# Dry run to test pipeline
cocode swe from-repo extract_fundamentals . --dryGitHub Repository Examples:
# Analyze public GitHub repository (short format)
cocode swe from-repo extract_fundamentals requests/requests \
--output-filename "requests-fundamentals.txt"
# Analyze with full GitHub URL
cocode swe from-repo extract_onboarding_documentation https://github.com/psf/black \
--output-filename "black-onboarding.txt"
# Analyze specific branch
cocode swe from-repo extract_coding_standards pallets/click@main \
--output-filename "click-standards.txt"
# Focus on documentation from GitHub repo
cocode swe from-repo extract_fundamentals pytest-dev/pytest \
--path-pattern "doc" --include-pattern "*.rst" --include-pattern "*.md" \
--output-filename "pytest-docs-analysis.txt"Process SWE analysis from existing text files.
# Extract features recap from documentation
cocode swe from-file extract_features_recap ./results/docs.txt \
--output-filename "features-recap.md"Analyze git diffs using AI pipelines.
# Generate changelog from git diff
cocode swe from-repo-diff write_changelog v0.2.4 ../project/ \
--output-filename "changelog.md"
# With ignore patterns
cocode swe from-repo-diff write_changelog v1.0.0 . \
--exclude-patterns "*.log" \
--exclude-patterns "temp/" \
--output-filename "CHANGELOG.md"This command generates documentation update suggestions based on the differences detected in the git repository.
Usage:
cocode swe doc-updateExamples:
cocode swe doc-update --helpSystematically proofread documentation against actual codebase to find inconsistencies that could break user code or cause major confusion.
Usage:
# Proofread docs directory against current repository
cocode swe doc-proofread
# Specify custom documentation directory
cocode swe doc-proofread --doc-dir documentation
# Proofread external project documentation
cocode swe doc-proofread ../my-project/ --doc-dir docs --output-filename my-project-issues
# Focus on specific file patterns in codebase analysis
cocode swe doc-proofread --include-pattern "*.py" --include-pattern "*.ts"
# Exclude certain patterns from codebase analysis
cocode swe doc-proofread --exclude-pattern "test_*" --exclude-pattern "*.md"Options:
repo_path: Repository path to analyze (default: current directory)--doc-dir, -d: Directory containing documentation files (default: "docs")--output-dir, -o: Output directory (default: "results")--output-filename, -n: Output filename (default: "doc-proofread-report")--include-pattern, -r: Include patterns for codebase analysis (can be repeated)--exclude-pattern, -i: Ignore patterns for codebase analysis (can be repeated)
Output Format: The command generates a markdown report with the following structure for each inconsistency:
- Doc file path: Path to the documentation file with issues
- Issue: Description of the inconsistency found
- Related files: Code files that are relevant to the issue
- Suggested fix: Specific actionable solution
The tool focuses on critical issues that would break user code, such as:
- Wrong function/class signatures
- Required parameters marked as optional (or vice versa)
- Incorrect examples that would fail
- Wrong import paths
- Critical type mismatches
Manage GitHub repositories, branches, and labels.
Subcommands:
Check GitHub authentication status and display rate limit information.
cocode github authGet detailed information about a GitHub repository.
# Using owner/repo format
cocode github repo-info pipelex/cocode
# Using repository ID
cocode github repo-info 123456789Check if a specific branch exists in a repository.
cocode github check-branch pipelex/cocode main
cocode github check-branch pipelex/cocode feature-branchList branches in a repository with optional limit.
# List first 10 branches (default)
cocode github list-branches pipelex/cocode
# List first 20 branches
cocode github list-branches pipelex/cocode --limit 20Synchronize issue labels from a JSON file to a repository.
# Dry run to preview changes
cocode github sync-labels pipelex/cocode ./labels.json --dry-run
# Sync labels, keeping existing ones
cocode github sync-labels pipelex/cocode ./labels.json
# Sync labels and delete extras not in JSON file
cocode github sync-labels pipelex/cocode ./labels.json --delete-extraLabel JSON Format:
[
{
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
},
{
"name": "enhancement",
"color": "a2eeef",
"description": "New feature or request"
}
]Options:
--dry-run: Preview changes without making them--delete-extra: Remove labels not in the JSON file--limit: Maximum number of items to display (for list commands)
Validate setup and pipelines.
# Validate configuration and pipelines
cocode validation validate
# Run dry validation without full setup
cocode validation dry-run
# Check configuration only
cocode validation check-config
# Backward compatibility (deprecated)
cocode validateDisplay comprehensive help and examples.
cocode --helpinterface: Extract class/function signatures, docstrings, and public APIsimports: Extract only import statements and public symbolsintegral: Include complete Python code (default)
repo_map: Tree structure + file contents (default)flat: File contents only, no tree structureimport_list: Formatted import statements (for imports rule)tree: Directory structure only
# Analyze test files
cocode repox --path-pattern "tests" --include-pattern "*.py"
# Focus on specific modules
cocode repox --path-pattern "src/core" --python-rule interface
# Extract all Python interfaces
cocode repox --include-pattern "*.py" --python-rule interface# Extract documentation
cocode repox --path-pattern "docs" --include-pattern "*.md"
# Analyze README files
cocode repox --include-pattern "README*" --include-pattern "*.md"
# Get project structure only
cocode repox --output-style tree# Analyze configuration
cocode repox --include-pattern "*.toml" --include-pattern "*.yaml" --include-pattern "*.json"
# Extract cursor rules
cocode repox --path-pattern ".cursor/rules" --include-pattern "*.mdc"- Output directory defaults to config value (typically
./results/) - Use
--output-dir stdoutto print to console instead of file - Use
cocode validateto check configuration and pipelines - Configuration files are loaded from
pipelex_libraries/directory
For GitHub commands, authentication is handled via the GITHUB_TOKEN environment variable or PyGithub's default authentication methods:
- Environment Variable: Set
GITHUB_TOKENin your.envfile or environment - GitHub CLI: If you have
ghCLI installed and authenticated - Personal Access Token: Create at https://github.com/settings/tokens
# Check authentication status
cocode github auth- Validate Setup: Run
cocode validateto ensure everything is configured correctly - Basic Analysis: Try
cocode repoxto analyze your current directory - Explore Pipelines: Use
cocode swe-from-repo --dryto test SWE pipelines - Get Help: Use
cocode --helpfor command overview and<command> --helpfor specific options
# Generate comprehensive repo analysis
cocode repox --output-filename "full-analysis.txt"
# Documentation-focused analysis
cocode repox --path-pattern "docs" --include-pattern "*.md" \
--output-filename "documentation.txt" --output-style flat# Extract interfaces for review
cocode repox --include-pattern "*.py" --python-rule interface \
--output-filename "interfaces.txt"
# Get import dependencies
cocode repox --python-rule imports --output-style import_list \
--output-filename "dependencies.txt"# Extract project fundamentals
cocode swe-from-repo extract_fundamentals . \
--include-pattern "*.md" --output-filename "project-overview.json"
# Generate feature summary
cocode swe-from-file extract_features_recap ./results/documentation.txt \
--output-filename "features-summary.md"For more information on specific commands, use cocode <command> --help.