@gonzui/csheet-cli
v1.5.1
Published
A CLI tool to save and manage cheatsheets for commands and tools locally
Readme
cheatsheet-cli (cs)
A CLI tool for managing command and tool cheatsheets locally.
Installation
npm install -g @gonzui/csheet-cliCommands
| Command | Description |
|---------|-------------|
| cs | Interactive mode: incremental search + view (fzf-style) |
| cs add <name> | Add a cheatsheet (opens $EDITOR, defaults to vim) |
| cs add <name> --file <path> | Add from an existing file |
| cs add <name> --stdin | Add from stdin (e.g. tldr tar \| cs add tar-tips --stdin) |
| cs add <name> --tag <tags> | Add with comma-separated tags |
| cs gen <name> <topic> | Generate a cheatsheet with Claude AI (requires ANTHROPIC_API_KEY) |
| cs refine <name> | Restructure a sheet into clean Markdown with Claude AI |
| cs list | List all cheatsheets |
| cs list --tag <tag> | List cheatsheets filtered by tag |
| cs show <name> | Display cheatsheet content (with Markdown rendering) |
| cs show <name> --raw | Display raw Markdown |
| cs copy <name> | Copy a code block to the clipboard (interactive if multiple) |
| cs copy <name> <index> | Copy the Nth code block to the clipboard |
| cs copy <name> --all | Copy the entire sheet content to the clipboard |
| cs search <keyword> | Search by filename and content |
| cs search --tag <tag> | Search by tag (combinable with a keyword) |
| cs edit <name> | Edit a cheatsheet |
| cs rm <name> | Delete a cheatsheet (with confirmation) |
| cs rm <name> --force | Delete without confirmation |
| cs rename <old> <new> | Rename a cheatsheet |
| cs rename <old> <new> -f | Rename and overwrite if new name exists |
| cs export <name> | Export to current directory |
| cs export <name> --out <path> | Export to specified path |
| cs mcp | Start an MCP server for AI agents (Claude Code, Claude Desktop, etc.) |
| cs config [key] [value] | Show or set configuration (editor, dir) |
| cs completion <shell> | Output shell completion script (zsh / bash) |
Usage Examples
Add a new cheatsheet
# Open editor to create new cheatsheet
cs add git-commands
# Add from existing file
cs add docker-tips --file ~/notes/docker.md
# Add from stdin without opening an editor
tldr tar | cs add tar-tips --stdin
# Add with tags
cs add git-commands --tag git,vcsGenerate and refine with AI
cs gen and cs refine call the Claude API directly, so they need an API key (unlike cs mcp, which is free to run). Set the ANTHROPIC_API_KEY environment variable first.
# Generate a cheatsheet from a topic
cs gen jq-basics jq basics --tag json
# Turn messy piped-in notes into a clean cheatsheet
history | tail -50 | cs add docker-notes --stdin
cs refine docker-notes
# Preview the refined result without saving
cs refine docker-notes --dry-runView cheatsheets
# List all cheatsheets
cs list
# List only cheatsheets with a tag
cs list --tag git
# Show with Markdown rendering
cs show git-commands
# Show raw Markdown
cs show git-commands --rawCopy to clipboard
# Copy a code block (prompts for selection if there are multiple)
cs copy git-commands
# Copy the 2nd code block directly
cs copy git-commands 2
# Copy the entire sheet
cs copy git-commands --allSearch
# Search by name or content — content matches show the matching lines grep-style
cs search commit
# Fuzzy name matching also works ("gitcmd" finds "git-commands")
cs search gitcmd
# Search by tag
cs search --tag git
# Combine keyword and tag
cs search commit --tag gitInteractive mode
Run cs with no arguments to pick a sheet with fzf-style incremental search (substring + fuzzy) and view it immediately.
csEdit and delete
# Edit in $EDITOR
cs edit git-commands
# Delete with confirmation
cs rm old-cheatsheet
# Delete without confirmation
cs rm old-cheatsheet --forceExport
# Export to current directory
cs export git-commands
# Export to specific path
cs export git-commands --out ~/backup/MCP Server (AI integration)
cs mcp starts an MCP server over stdio, turning your local cheatsheets into a knowledge base for AI agents. No API key needed — the connecting AI agent does the work.
# Register with Claude Code
claude mcp add cheatsheet -- cs mcpClaude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"cheatsheet": { "command": "cs", "args": ["mcp"] }
}
}Once connected, the agent can:
| MCP Tool | Description |
|----------|-------------|
| search_cheatsheets | Search your sheets by keyword and/or tag |
| get_cheatsheet | Read the full Markdown content of a sheet |
| list_cheatsheets | List all sheets with tags |
| add_cheatsheet | Save new knowledge as a cheatsheet (with tags) |
So you can ask Claude things like "check my cheatsheets for the deploy procedure" or "save this jq one-liner collection as a cheatsheet".
Features
- MCP Server: Expose your cheatsheets to AI agents with
cs mcp - AI Generation: Create cheatsheets from a topic with
cs gen, or clean up messy notes withcs refine(Claude API) - Markdown Rendering: Syntax highlighting for code blocks, formatted tables, colored headings
- Interactive Mode: Run
cswith no arguments for fzf-style incremental search - Full-text Search: Search by name and content, with grep-style matching lines and fuzzy name matching
- Tags: Organize and filter cheatsheets with tags
- Clipboard Copy: Copy code blocks straight to the clipboard with
cs copy - Pipe-friendly: Register sheets from stdin with
cs add --stdin - Editor Integration: Uses
$EDITORenvironment variable (defaults to vim) - Configurable: Change the editor and data directory with
cs config - Shell Completion: Tab completion for commands and sheet names (
cs completion zsh|bash)
Samples
Sample cheatsheets are available in the sample/ directory:
sample/
├── en/ # English
│ ├── cc-skills.md # Claude Code skills
│ ├── cs-help.md # This CLI help
│ ├── tmux.md # tmux commands
│ └── vim.md # Vim commands
└── ja/ # Japanese
├── cc-skills.md
├── cs-help.md
├── tmux.md
└── vim.mdAdd samples to your cheatsheets
# Add English samples
cs add vim --file sample/en/vim.md
cs add tmux --file sample/en/tmux.md
cs add cc-skills --file sample/en/cc-skills.md
cs add cs-help --file sample/en/cs-help.md
# Add Japanese samples
cs add vim --file sample/ja/vim.md
cs add tmux --file sample/ja/tmux.md
cs add cc-skills --file sample/ja/cc-skills.md
cs add cs-help --file sample/ja/cs-help.mdConfiguration
# Show all settings
cs config
# Use VS Code as the editor (takes precedence over $EDITOR)
cs config editor "code --wait"
# Move the data directory (e.g. into Dropbox for syncing)
cs config dir ~/Dropbox/cheatsheets
# Remove a setting
cs config editor --unsetThe config file itself always lives at ~/.config/cheatsheet-cli/config.json. Changing dir does not move existing sheets — copy them over manually.
Shell completion
# zsh: add to ~/.zshrc (after compinit)
eval "$(cs completion zsh)"
# bash: add to ~/.bashrc
eval "$(cs completion bash)"Completes subcommands and cheatsheet names (e.g. cs show g<Tab>).
Data Storage
Cheatsheets are stored in ~/.config/cheatsheet-cli/:
~/.config/cheatsheet-cli/
├── data.json # Metadata
└── sheets/ # Markdown files
└── {name}.mdNaming Rules
Cheatsheet names can only contain:
- Alphanumeric characters (a-z, A-Z, 0-9)
- Hyphens (-)
- Underscores (_)
Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Watch mode
npm run test:watchLicense
MIT
