hyouji
v0.0.14
Published
Hyouji (表示) — A command-line tool for organizing and displaying GitHub labels with clarity and harmony.
Maintainers
Readme
Hyouji(表示) GitHub Label Manager
article
https://levelup.gitconnected.com/create-github-labels-from-terminal-158d4868fab
https://github.com/koji/Hyouji/blob/main/blog/article.md
A simple CLI tool to create/delete labels with GitHub Labels API. Now available as a global npm package with persistent configuration storage.
article
https://levelup.gitconnected.com/create-github-labels-from-terminal-158d4868fab

https://github.com/user-attachments/assets/739f185a-1bd0-411b-8947-dd4600c452c8
Labels API
https://docs.github.com/en/rest/reference/issues#labels
label data format
// label format
{
"id": 3218144327,
"node_id": "MDU6TGFiZWwzMjE4MTQ0MzI3",
"url": "https://api.github.com/repos/koji/frontend-tools/labels/wontfix",
"name": "wontfix",
"color": "ffffff",
"default": true,
"description": "This will not be worked on"
}Installation
Install globally via npm:
npm install -g hyoujiOr use with npx (no installation required):
npx hyoujiFeatures
This tool provides the following functionality:
- Create a single label on a specific repo
- Create multiple labels on a specific repo
- Delete a single label from a specific repo
- Delete all labels from a specific repo
- Import labels from JSON or YAML file
- Display your saved settings - View your stored GitHub configuration
- Persistent configuration - Save your GitHub token and username for future use
Usage
After installation, run the tool from anywhere:
hyoujiFirst Time Setup
On your first run, you'll be prompted to enter:
- GitHub Personal Token - Generate one here with
reposcope - GitHub Username - Your GitHub account name
These credentials will be securely saved and reused for future sessions.
Menu Options
- Create a single label on a specific repo
- Create multiple labels on a specific repo
- Delete a single label from a specific repo
- Delete all labels from a specific repo
- Import labels from JSON or YAML file
- Generate sample JSON - Create a sample JSON file with predefined labels
- Generate sample YAML - Create a sample YAML file with predefined labels
- Display your settings - View your saved configuration
- Exit
Settings Management
The tool now includes persistent configuration storage with enhanced security:
- Automatic saving: Your GitHub token and username are saved after first use
- Settings display: Use option 6 to view your current configuration
- Secure storage: Configuration is stored in
~/.config/github-label-manager/config.json - Token encryption: Your personal token is automatically encrypted using machine-specific keys
- Automatic migration: Existing plain text configurations are automatically upgraded to encrypted format
- Token security: Your personal token is never displayed in plain text, only an obfuscated preview is shown
Security Features
Token Encryption:
- All GitHub personal tokens are automatically encrypted before being saved to disk
- Encryption uses machine-specific keys derived from your system information
- Existing plain text configurations are automatically migrated to encrypted format on first run
- Even if someone gains access to your configuration file, the token remains protected
Privacy Protection:
- Tokens are never displayed in plain text in the interface
- Only an obfuscated preview (e.g.,
ghp_****...****3456) is shown in settings - The settings display shows whether your token is encrypted or in plain text format
If you want to create/delete a single label, you need to type the followings.
create
- label name
- label color (technically optional)
- label description (technically optional)
delete
- label name
In terms of multiple labels, this script is using label.js to define name, color and description. The format is very simple.
If you want to put your own labels, you will need to modify label.js file.
module.exports = Object.freeze([
{
name: "Type: Bug Fix",
color: "FF8A65",
description: "Fix features that are not working",
},
{
name: "Type: Enhancement",
color: "64B5F7",
description: "Add new features",
},Quick Start
Install the package globally:
# npm npm install -g hyouji # pnpm pnpm install -g hyouji # yarn yarn global add hyouji # bun bun install -g hyoujiRun the tool:
hyoujiOn first run, enter your GitHub credentials when prompted
Select your desired operation from the menu
Follow the prompts to manage your repository labels
Example Usage
# Run the tool
hyouji
# Or run without installing
npx hyoujiDevelopment
If you want to contribute or run from source:
git clone https://github.com/koji/hyouji.git
cd hyouji
npm install
npm run build
npm startYou can use pnpm, yarn or bun.
File Import Support
The "Import labels from JSON or YAML file" option allows you to import multiple labels from external files. Both JSON and YAML formats are supported.
Supported File Formats
- JSON files (
.jsonextension) - YAML files (
.yamlor.ymlextension)
Label Structure
Both formats support the same label structure:
name(required): The label namecolor(optional): Hex color code without the#symboldescription(optional): Label description
JSON Example
[
{
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
},
{
"name": "enhancement",
"color": "a2eeef",
"description": "New feature or request"
},
{
"name": "documentation",
"color": "0075ca",
"description": "Improvements or additions to documentation"
}
]YAML Example
# Sample YAML file for importing GitHub labels
- name: 'bug'
color: 'd73a4a'
description: "Something isn't working"
- name: 'enhancement'
color: 'a2eeef'
description: 'New feature or request'
- name: 'documentation'
color: '0075ca'
description: 'Improvements or additions to documentation'
# Labels with minimal configuration (name only)
- name: 'good first issue'
color: '7057ff'
description: 'Good for newcomers'
# Labels without description (optional field)
- name: 'wontfix'
color: 'ffffff'
# Labels without color (will use GitHub default)
- name: 'question'
description: 'Further information is requested'Sample Files
You can find complete example files in the examples/ directory:
examples/labels.json- Basic label examples in JSON formatexamples/labels.yaml- Basic label examples in YAML formatexamples/project-labels.json- Project management labels in JSON formatexamples/project-labels.yaml- Project management labels in YAML format
Generate Sample Files
The tool can generate sample files for you:
- Generate sample JSON - Creates
hyouji.jsonwith predefined labels - Generate sample YAML - Creates
hyouji.yamlwith predefined labels
Both generated files contain the same predefined labels and can be used as starting points for your own label configurations.
Predefined Labels
The "Create multiple labels" option uses predefined labels from src/constant.ts. These include common labels for project management:
{
name: 'Type: Bug Fix',
color: 'FF8A65',
description: 'Fix features that are not working',
},
{
name: 'Type: Enhancement',
color: '64B5F7',
description: 'Add new features',
},
// ... and many moreConfiguration
Configuration File Location
Your settings are stored in:
- Primary:
~/.config/github-label-manager/config.json - Fallback:
~/.github-label-manager-config.json
Viewing Your Settings
Use the "Display your settings" menu option to:
- See your configuration file path
- View your stored GitHub username
- Check if a token is saved (without revealing the actual token)
- See when your configuration was last updated
Clearing Configuration
If you need to reset your configuration, you can:
- Delete the configuration file manually
- The tool will prompt for new credentials on the next run
Troubleshooting
Invalid Token Error
If you see authentication errors:
- Check that your token has the correct
reposcope - Verify the token hasn't expired
- The tool will automatically prompt for a new token if validation fails
Permission Issues
If you encounter file permission errors:
- Ensure you have write access to your home directory
- The tool will attempt to use fallback locations if needed
Requirements
- Node.js 20 or higher
- GitHub Personal Access Token with
reposcope
https://user-images.githubusercontent.com/474225/130368605-b5c6410f-53f6-4ef0-b321-8950edeebf7d.mov
