Skip to content

Feature Request: Add environment variable support for custom GitHub repository configuration #247

@dobachi

Description

@dobachi

Summary

Allow users to configure the CLI to use custom GitHub forks of claude-code-templates by setting environment variables, enabling organizations and individuals to maintain their own component repositories.

Use Case

  1. Enterprise/Organization Use: Companies can maintain private forks with custom agents, commands, and MCPs tailored to their workflows
  2. Community Extensions: Contributors can test their components before submitting PRs
  3. Regional Customization: Enable localized or specialized component collections
  4. Development/Testing: Easier testing of new components during development

Proposed Solution

Add support for the following environment variables:

Variable Description Default
CCT_REPO_OWNER GitHub owner/organization davila7
CCT_REPO_NAME Repository name claude-code-templates
CCT_REPO_BRANCH Branch name main
CCT_COMPONENTS_PATH Path to components directory cli-tool/components

Example Usage

# Install agent from custom fork
CCT_REPO_OWNER=myorg CCT_REPO_BRANCH=develop npx claude-code-templates --agent my-custom-agent

# Use organization's private components
export CCT_REPO_OWNER=my-company
export CCT_REPO_NAME=claude-code-templates-enterprise
npx claude-code-templates --agent security-auditor

Scope and Limitations

This implementation is GitHub-specific. The CLI uses:

  • raw.githubusercontent.com - For downloading component files
  • api.github.com - For listing directory contents (discovering available components)

Support for other Git platforms (GitLab, Bitbucket, self-hosted) would require additional work due to different API endpoints.

Implementation

I have a working implementation ready in my fork:

Files Modified

File Changes
src/file-operations.js Add GITHUB_CONFIG with env var support
src/index.js Add buildGitHubUrl and buildGitHubApiUrl helpers, update all installIndividual* functions
src/sdk/global-agent-manager.js Same configuration pattern

Key Points

  • Replaced all hardcoded GitHub URLs with configurable values
  • Added helper functions for consistent URL generation
  • Full backward compatibility (defaults to current behavior)
  • No breaking changes to existing API
  • Simple implementation using only environment variables

Next Steps

I will submit a PR referencing this issue once it's created. Thank you for considering this feature!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions