LobeHub CLI Toolbox - AI-powered command-line tools including lobe-commit (ChatGPT Git commits with Gitmoji), lobe-i18n (automated internationalization), and lobe-label (GitHub label management)
AI CLI Toolbox containing multiple command-line tools powered by ChatGPT/LangChain for enhancing git commit and i18n workflow efficiency.
@lobehub/commit-cli)AI-powered Git commit message generator using ChatGPT with Gitmoji formatting.
@lobehub/i18n-cli)Automated internationalization tool leveraging ChatGPT for translation workflows.
@lobehub/label-cli)GitHub issue label management - copy labels from template repositories.
@lobehub/cli-ui - UI components for CLI applications@lobehub/cli-shebang - Shebang handling utilitiesnpm install -g @lobehub/commit-cli
Requirement: Node.js ā„ 18
| Command | Flag | Purpose |
|---|---|---|
| Interactive commit | --hook |
Generate message via prompts |
| AI generation | -a, --ai |
Use ChatGPT for auto-generation |
| Configuration | -o, --option |
Setup preferences |
| Git hook setup | -i, --init |
Initialize as commit hook |
| Remove hook | -r, --remove |
Uninstall commit hook |
| List types | -l, --list |
Display supported commit types |
| Version | -V, --version |
Show installed version |
| Help | -h, --help |
Display basic options |
# Stage files and generate commit
git add <files>
lobe-commit
# Or use the short alias
lobe
# Set up as git hook
lobe-commit --init
git commit # Triggers workflow automatically
Access settings via:
lobe-commit --option
Key Settings:
| Option | Type | Default | Description |
|---|---|---|---|
includeWhy |
boolean | false | Explain change motivations |
messageTemplate |
string | "$msg" | Custom message format |
oneLineCommit |
boolean | false | Single-line output |
useFullGitmoji |
boolean | false | Full emoji specification |
Create .lobecommitignore to exclude files from analysis:
# Lock files
package-lock.json
yarn.lock
pnpm-lock.yaml
# Build artifacts
dist/
build/
# Minified files
*.min.js
*.min.css
Default filters include: lock files, binaries, build artifacts, minified files.
Use placeholders for customization:
# Link to issue number
"$msg (#123)"
# Add scope prefix
"[frontend] $msg"
AI Mode: ChatGPT generates complete conventional commit messages with Gitmoji
Editor Mode: Interactive prompts guide selection of:
| Variable | Required | Purpose |
|---|---|---|
OPENAI_API_KEY |
Yes (AI mode) | OpenAI authentication |
GITHUB_TOKEN |
No | Private repo issue linking |
npm install -g @lobehub/i18n-cli
Requirement: Node.js ā„ 18
| Command | Purpose |
|---|---|
lobe-i18n |
Translate locale/JSON files |
lobe-i18n locale |
Same as above |
lobe-i18n md |
Translate Markdown files |
lobe-i18n lint |
Validate translation accuracy |
lobe-i18n --with-md |
Run locale and markdown translation together |
lobe-i18n -o |
Interactive configuration setup |
lobe-i18n -c ./config.js |
Use custom configuration file |
Run interactive setup:
lobe-i18n -o
Or create config file manually (supports cosmiconfig):
package.json (under i18n property).i18nrc, .i18nrc.json, .i18nrc.yaml.i18nrc.js, .i18nrc.cjsconst { defineConfig } = require('@lobehub/i18n-cli');
module.exports = defineConfig({
// Required
entry: 'locales/en_US.json',
entryLocale: 'en_US',
output: 'locales',
outputLocales: ['zh_CN', 'ja_JP', 'ko_KR'],
// Optional
modelName: 'gpt-3.5-turbo',
keyStyle: 'nested', // 'nested', 'flat', or 'auto'
reference: 'Technical documentation context',
saveImmediately: true,
temperature: 0,
topP: 1,
concurrency: 5,
splitToken: 2000,
experimental: {
jsonMode: true
}
});
Required:
| Property | Type | Description |
|---|---|---|
entry |
string | Source file/folder path |
entryLocale |
string | Reference language identifier |
output |
string | Destination directory |
outputLocales |
string[] | Target language array |
Optional:
| Property | Type | Default | Description |
|---|---|---|---|
modelName |
string | gpt-3.5-turbo |
AI model selection |
keyStyle |
string | auto |
Key resolution style |
reference |
string | - | Context for translations |
saveImmediately |
boolean | false | Persist after each chunk |
temperature |
number | 0 | Sampling parameter |
topP |
number | 1 | Nucleus sampling threshold |
concurrency |
number | 5 | Parallel request limit |
splitToken |
number | - | Token split threshold |
module.exports = defineConfig({
// Entry/Output
entry: 'docs/**/*.md',
entryLocale: 'en_US',
entryExtension: '.md',
outputLocales: ['zh_CN', 'ja_JP'],
outputExtensions: (locale) => `.${locale}.md`,
// Processing
mode: 'mdast', // 'string' or 'mdast'
translateCode: false,
includeMatter: false,
exclude: ['node_modules/**', 'dist/**']
});
Flat Structure:
locales/
āāā en_US.json
āāā zh_CN.json
āāā ja_JP.json
Configuration: entry: "locales/en_US.json"
Tree Structure:
locales/
āāā en_US/
ā āāā common.json
ā āāā header.json
āāā zh_CN/
āāā ja_JP/
Configuration: entry: "locales/en_US"
| Variable | Required | Purpose |
|---|---|---|
OPENAI_API_KEY |
Yes | OpenAI authentication token |
OPENAI_PROXY_URL |
No | API proxy endpoint |
Default proxy: https://api.openai.com/v1
npm install -g @lobehub/label-cli
Requirement: Node.js ā„ 18
| Option | Short | Purpose |
|---|---|---|
--config |
-o |
Initialize configuration |
--target |
-t |
Destination repository |
--source |
-s |
Source repository |
Default source: canisminor1990/canisminor-template
# Copy from default template to target
lobe-label -t lobehub/chat
# Copy from custom source to target
lobe-label -t lobehub/chat -s lobehub/commit
# Configure settings
lobe-label --config
# Initial setup
npm install -g @lobehub/commit-cli
# Configure OpenAI
lobe-commit --option
# Enter your OPENAI_API_KEY
# Set up as git hook
lobe-commit --init
# Normal git workflow
git add .
git commit
# AI generates: ⨠feat(auth): add OAuth2 login support
# Install
npm install -g @lobehub/i18n-cli
# Create config
cat > .i18nrc.json << 'EOF'
{
"entry": "locales/en_US.json",
"entryLocale": "en_US",
"output": "locales",
"outputLocales": ["zh_CN", "ja_JP", "ko_KR", "de_DE"],
"modelName": "gpt-4",
"concurrency": 3
}
EOF
# Set API key
export OPENAI_API_KEY=sk-...
# Run translation
lobe-i18n
# Translate markdown docs too
lobe-i18n md
# Validate translations
lobe-i18n lint
# Install
npm install -g @lobehub/label-cli
# Copy labels from template to new repo
lobe-label -t myorg/new-project
# Copy labels from existing repo to another
lobe-label -s lobehub/lobe-chat -t myorg/new-project
# Install all tools
npm install -g @lobehub/commit-cli @lobehub/i18n-cli @lobehub/label-cli
# Initialize new project
mkdir my-project && cd my-project
git init
# Set up commit hooks
lobe-commit --init
# Configure i18n
lobe-i18n -o
# Copy labels from template
lobe-label -t myorg/my-project
For building your own CLI tools, use @lobehub/cli-ui:
import { Header, Panel, Spinner } from '@lobehub/cli-ui';
import { render } from 'ink';
// React-based terminal UI
render(
<Panel>
<Header title="My CLI Tool" />
<Spinner text="Processing..." />
</Panel>
);
# Clone repository
git clone https://github.com/lobehub/lobe-cli-toolbox.git
cd lobe-cli-toolbox
# Install dependencies (bun recommended)
bun install
# Work on specific package
cd packages/lobe-commit
bun dev
# Or use pnpm
pnpm install
pnpm dev
Rename configuration file:
mv .opencommitignore .lobecommitignore
Most settings transfer directly.
"OPENAI_API_KEY not found"
export OPENAI_API_KEY=sk-your-key-here
# Or configure via tool
lobe-commit --option
lobe-i18n -o
"Rate limit exceeded"
gpt-3.5-turbo instead of gpt-4"Token limit exceeded"
splitToken if neededGit hook not triggering
# Reinstall hook
lobe-commit --remove
lobe-commit --init
Custom API endpoint
export OPENAI_PROXY_URL=https://your-proxy.com/v1