cli-profile-manager
v0.1.2
Published
Save, share, and load CLI profiles - a marketplace for Claude Code and GitHub CLI configurations
Readme
CLI Profile Manager
A marketplace for saving, sharing, and loading CLI configuration profiles — supports Claude Code and GitHub Copilot CLI.
What is this?
CLI Profile Manager (cpm) lets you:
- Save your CLI configuration as a shareable profile
- Load profiles to switch between configurations
- Browse a marketplace of community-created profiles
- Share your profiles with others
Every command accepts a --provider flag to target either Claude Code or GitHub Copilot.
Installation
npm install -g cli-profile-managerRequires Node.js 18+.
Quick Start
# Save your current Claude Code config as a profile
cpm save my-setup --provider claude
# Save your current GitHub Copilot config as a profile
cpm save my-copilot-setup --provider github
# Browse the marketplace
cpm list --provider claude
cpm list --provider github
# Install a profile from the marketplace
cpm install author/senior-developer --provider claude
# Load a locally saved profile
cpm load my-setup --provider claudeProviders
Claude Code (--provider claude)
Profiles snapshot your .claude folder and include:
| Item | Description |
|---|---|
| CLAUDE.md | Custom instructions |
| commands/ | Custom slash commands |
| hooks/ | Event hooks |
| skills/ | Custom skills |
| mcp.json & mcp_servers/ | MCP server configurations |
| plugins/ | User-authored plugins |
| agents/ | Custom agents |
Profiles are stored locally in ~/.cli-profiles/claude/ and installed to the .claude directory in your current working directory (repo root).
GitHub Copilot (--provider github)
Profiles capture GitHub Copilot customizations and include:
| Item | Description |
|---|---|
| copilot-instructions.md | Custom Copilot instructions |
| skills/ | Custom skills |
| agents/ | Custom agents |
Profiles are stored locally in ~/.cli-profiles/github/. When loaded, a profile is installed to .github in your current working directory (repo root).
Sensitive files (credentials, API keys) are excluded from all profiles by default.
Commands
All commands accept -p, --provider <claude|github>. Defaults to claude if omitted.
Local Profile Management
cpm save <name> [--provider <p>] [--description "desc"] [--tags "tag1,tag2"]
cpm load <name> [--provider <p>] [--backup] [--force]
cpm local [--provider <p>]
cpm info <name> [--provider <p>]
cpm delete <name> [--provider <p>] [--force]Marketplace
cpm list [--provider <p>] [--category <cat>] [--refresh]
cpm search <query> [--provider <p>]
cpm install author/profile-name [--provider <p>] [--backup] [--force]
cpm info author/profile-name [--provider <p>]Publishing
cpm publish <name> [--provider <p>]
cpm repo owner/repo-nameConfiguration
cpm configExample Workflows
Switch Between Claude Code Personas
cpm save work-reviewer --provider claude --tags "work,code-review"
cpm save docs-writer --provider claude --tags "work,documentation"
cpm load work-reviewer --provider claude
# ... do code reviews ...
cpm load docs-writer --provider claude
# ... write documentation ...Manage GitHub Copilot Profiles Per Project
# Snapshot your current .github/ copilot config
cpm save frontend-team --provider github --description "Frontend team Copilot setup"
# Install the profile into this project
cpm load frontend-team --provider github
# → installs to .github/frontend-team/
# Share it with the team
cpm publish frontend-team --provider githubShare Team Configurations
# Claude Code
cpm save team-standards --provider claude --description "Our team's Claude configuration"
cpm publish team-standards --provider claude
# GitHub Copilot
cpm save team-copilot --provider github --description "Our team's Copilot setup"
cpm publish team-copilot --provider github
# Team members install it
cpm install yourname/team-standards --provider claude
cpm install yourname/team-copilot --provider githubProfile Storage
Saved profiles live in ~/.cli-profiles/:
~/.cli-profiles/
├── config.json
├── claude/ # Claude Code profiles
│ ├── my-setup/
│ │ ├── profile.json
│ │ ├── CLAUDE.md
│ │ ├── commands/
│ │ └── hooks/
│ └── .cache/
│ └── claude-marketplace-index.json
└── github/ # GitHub Copilot profiles
├── my-copilot-setup/
│ ├── profile.json
│ ├── copilot-instructions.md
│ ├── skills/
│ └── agents/
└── .cache/
└── github-marketplace-index.jsonInstall Targets
cpm and the auto-install script (install-profile.mjs) target different directories:
| Tool | Target | Example |
|---|---|---|
| cpm (all commands) | Current working directory (repo root) | <cwd>/.claude, <cwd>/.github |
| install-profile.mjs | Home directory (global) | ~/.claude, ~/.copilot |
Why? The auto-install script is designed for one-time global setup (Codespaces, devcontainers, CI). cpm operates on the repo you're currently working in, which means profiles work correctly in git worktrees and per-project setups.
If the target directory doesn't exist when you run cpm install or cpm load, it will be created automatically.
When a Claude Code profile is loaded or installed:
<cwd>/
└── .claude/
├── CLAUDE.md
├── commands/
├── skills/
└── hooks/When a GitHub Copilot profile is loaded or installed:
<cwd>/
└── .github/
├── copilot-instructions.md
├── skills/
└── agents/Marketplace Repository Structure
cli-profile-manager/
├── profiles/
│ ├── claude/ # Claude Code marketplace profiles
│ │ ├── index.json
│ │ └── author/profile-name/
│ │ ├── profile.json
│ │ └── ...
│ └── github/ # GitHub Copilot marketplace profiles
│ ├── index.json
│ └── author/profile-name/
│ ├── profile.json
│ ├── copilot-instructions.md
│ ├── skills/
│ └── agents/
└── README.mdContributing Profiles
- Save your profile:
cpm save my-awesome-profile --provider <claude|github> - Publish it:
cpm publish my-awesome-profile --provider <claude|github>
A pull request will be opened automatically against the marketplace repository for review.
See CONTRIBUTING.md for detailed guidelines.
Custom Marketplace
Host your own marketplace (e.g., for your company):
- Fork this repository
- Add profiles to
profiles/claude/and/orprofiles/github/ - Update the relevant
index.json - Point users to your repo:
cpm repo your-org/your-marketplace
Auto-Install in Codespaces / Devcontainers
Install Claude Code and a marketplace profile automatically with a single postCreateCommand.
Setup
Add to your .devcontainer/devcontainer.json:
// Claude Code profile
"postCreateCommand": "curl -fsSL https://raw.githubusercontent.com/brrichards/cli-profile-manager/main/scripts/install-profile.mjs -o /tmp/install-profile.mjs && node /tmp/install-profile.mjs marketplace devtools claude && rm -f /tmp/install-profile.mjs"
// GitHub Copilot profile
"postCreateCommand": "curl -fsSL https://raw.githubusercontent.com/brrichards/cli-profile-manager/main/scripts/install-profile.mjs -o /tmp/install-profile.mjs && node /tmp/install-profile.mjs myorg frontend-team github && rm -f /tmp/install-profile.mjs"Replace <author> <profile> with your desired profile. The third argument selects the provider (claude or github, defaults to claude).
How It Works
The install script always installs to the global home directory (~/.claude or ~/.copilot). To override the target directory, use the CLAUDE_HOME or GITHUB_HOME environment variables.
The install script runs three steps:
- Installs Claude Code CLI via
npm install -g @anthropic-ai/claude-code(skipped if already present) - Fetches the profile manifest (
profile.json) from GitHub raw content for the requested author/profile - Maps marketplace files into the CLI's native config structure:
Claude Code (profiles/claude/<author>/<profile>/):
| Marketplace Path | Installed To |
|---|---|
| CLAUDE.md | <claude-dir>/CLAUDE.md (appended) |
| commands/<name>.md | <claude-dir>/commands/<name>.md |
| skills/<name>/SKILL.md | <claude-dir>/skills/<name>/SKILL.md |
| agents/<name>.md | <claude-dir>/agents/<name>.md |
| hooks/<name>.md | <claude-dir>/hooks/<name>.md |
GitHub Copilot (profiles/github/<author>/<profile>/):
| Marketplace Path | Installed To |
|---|---|
| copilot-instructions.md | <github-dir>/<profile>/copilot-instructions.md |
| skills/<name>/SKILL.md | <github-dir>/<profile>/skills/<name>/SKILL.md |
| agents/<name>.md | <github-dir>/<profile>/agents/<name>.md |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| PROVIDER | claude | Provider to install (claude or github) |
| SKIP_CLAUDE_INSTALL | 0 | Skip Claude Code CLI install (Claude only) |
| PROFILE_BRANCH | main | Branch to fetch profiles from |
| CLAUDE_HOME | ~/.claude | Override the Claude config directory |
| GITHUB_HOME | ~/.copilot | Override the .github directory (GitHub only) |
Prerequisites
- Node.js 18+ (uses built-in
fetch,fs, andpath) postCreateCommandruns once on container creation and on full rebuild, but not on stop/start.
Authentication
How cpm publish Authenticates
When you run cpm publish, authentication happens in two stages:
- Git Credential Manager —
cpmfirst tries to read an existing GitHub token from your local git credential store (git credential fill). If you already have credentials stored (e.g., fromgh auth loginor a PAT), this works automatically. - OAuth Device Flow — If no stored credentials are found,
cpmfalls back to GitHub's OAuth device flow. It displays a URL and a one-time code, you authorize in your browser, andcpmreceives a token. No manual PAT creation needed.
Why This Matters in Codespaces
GitHub Codespaces automatically provides a GITHUB_TOKEN, but this token is scoped to the current repository only. Publishing a profile requires:
- Forking the marketplace repo (
brrichards/cli-profile-manager) - Pushing a branch to that fork
- Opening a pull request back to the upstream repo
The Codespace's repo-scoped token cannot perform any of these operations on a different repository. To work around this, cpm publish bypasses local git entirely and uses the GitHub Git Data API to create commits and branches directly via authenticated API calls. This requires a token with public_repo scope, which is obtained through the OAuth device flow.
This design also benefits users outside Codespaces — no need to configure SSH keys or manually create PATs. The device flow handles everything.
Source Structure
cli-profile-manager/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── commands/ # Thin command wrappers
│ ├── types/ # Interfaces and factory
│ ├── providers/
│ │ ├── claude/ # Claude Code provider
│ │ └── github/ # GitHub Copilot provider
│ └── utils/ # Shared utilities (config, auth)
├── dist/ # Compiled output
└── profiles/ # Marketplace profilesLicense
MIT License - see LICENSE for details.
