Modern CLI tool for AI character card management - extract, repositorize, and rebuild character cards
Project description
Card Forge ๐จ
Modern CLI tool for AI character card management - Extract, repositorize, and rebuild character cards with ease!
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโ โโโโโโ โโโโโโโ โโโโโโโ โโโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโ โโโโโโโโโ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโ
โ โโโ โโโโโโโโโโโโโโโโโโโ โโโ โโโโโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโโ โ
โ โโโ โโโโโโโโโโโโโโโโโโโ โโโ โโโโโโ โโโ โโโโโโโโโโโโโโ โโโโโโโโโ โ
โ โโโโโโโโโโโ โโโโโโ โโโโโโโโโโโ โโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโ โโโโโโ โโโโโโโโโโ โโโ โโโโโโโ โโโ โโโ โโโโโโโ โโโโโโโโโ
โ โ
โ ๐จ AI Character Card Management Tool ๐จ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Features
- ๐ค Extract: Get character data from PNG files to JSON
- ๐ Repositorize: Convert cards to version-control friendly file structures
- ๐จ Rebuild: Reconstruct cards from repositories
- โ Validate: Check card integrity and specification compliance
- ๐ Analyze: Get detailed character card information
- ๐จ Modern CLI: Beautiful interface with helpful commands
๐ง Installation
# Install with uv (recommended)
uv add card-forge
# Or with pip
pip install card-forge
๐ฏ Quick Start
# Extract character data from a PNG file
card-forge extract character.png
# Convert a character card to a repository structure
card-forge repo character.png
# Rebuild a character card from repository
card-forge build my_character/
# Validate a character card
card-forge validate character.png
# Get detailed information about a character
card-forge info character.png
# Generate default configuration file
card-forge init-config
# Show version information
card-forge --version
๐ Commands
extract - Extract card data to JSON
card-forge extract card.png # Extract to character_name.json
card-forge extract card.png -o mychar.json # Custom output filename
repo - Convert to repository structure
card-forge repo card.png # From PNG file
card-forge repo character.json # From JSON file
card-forge repo card.png -c custom_config.yaml # Custom configuration
Creates a clean, organized directory structure:
character_name/
โโโ _metadata.yaml # Card metadata (spec, version)
โโโ data/
โโโ _metadata.yaml # Remaining character data
โโโ description.md # Character description
โโโ personality.md # Personality traits
โโโ scenario.md # Scenario description
โโโ system_prompt.md # System instructions
โโโ first_message.md # First message
โโโ example_messages.md # Example dialogue
โโโ creator_notes.md # Creator notes
โโโ alternate_greetings/ # Alternative greetings
โ โโโ 001.md
โ โโโ 0012.md
โโโ group_only_greetings/ # Group chat greetings
โ โโโ 0011.md
โโโ creator_notes_multilingual/ # Multi-language notes
โ โโโ en.md
โ โโโ es.md
โโโ assets/ # Character assets
โ โโโ main_icon.yaml
โ โโโ background_image.yaml
โโโ extensions/ # Extensions and scripts
โ โโโ _metadata.yaml
โ โโโ TavernHelper_scripts/
โ โ โโโ 001_script_name.yaml
โ โโโ regex_scripts/
โ โโโ 001_script_name.yaml
โโโ character_book/ # Lorebook entries
โโโ _metadata.yaml
โโโ entries/
โโโ 001_location.yaml
โโโ 002_character.yaml
build - Rebuild from repository
card-forge build my_character/ # Rebuild to JSON
card-forge build my_character/ -f png # Rebuild to PNG
card-forge build my_character/ -o rebuilt # Custom output name
card-forge build my_character/ -f png -b base.png # Custom base image
validate - Check card integrity
card-forge validate character.png # Validate PNG
card-forge validate character.json # Validate JSON
info - Detailed character analysis
card-forge info character.png # Show detailed information
init-config - Generate configuration file
card-forge init-config # Generate config.yaml
card-forge init-config -o custom.yaml # Custom filename
Example output:
๐ญ CHARACTER: Alice Wonderland
================================================================================
๐ค Creator: CardMaker
๐ท๏ธ Tags: fantasy, adventure, curious
๐ Version: 1.0
๐ง Spec: chara_card_v3 v3.0
๐ CONTENT OVERVIEW:
โข Description: 1,250 characters
โข Personality: 890 characters
โข Scenario: 1,100 characters
โข Alternate greetings: 3
โข Group-only greetings: 1
๐ LOREBOOK:
โข Name: Wonderland Guide
โข Entries: 12
๐ ๏ธ Development Workflow
1. Extract and Explore
# Extract a character card to see its structure
card-forge extract my_card.png
card-forge info my_card.png
2. Convert to Repository
# Create editable file structure
card-forge repo my_card.png
3. Edit Files
Edit the individual files in your favorite editor:
- Modify
description.mdfor character description - Update
personality.mdfor personality traits - Add alternate greetings in
alternate_greetings/ - Edit lorebook entries in
character_book/entries/
4. Rebuild and Test
# Rebuild to verify changes
card-forge build my_character/
card-forge validate my_character_rebuilt.json
# Create final PNG
card-forge build my_character/ -f png
๐ Use Cases
Version Control for Character Development
# Initial setup
card-forge repo character.png
git init character_name
cd character_name
git add .
git commit -m "Initial character import"
# Make changes to files...
git commit -am "Updated personality traits"
# Rebuild for distribution
card-forge build . -f png
Collaborative Character Creation
# Split work among team members
card-forge repo base_character.png
# Person A works on personality.md
# Person B works on lorebook entries
# Person C works on greetings
# Merge changes and rebuild
card-forge build character/ -f png
Character Analysis and Debugging
# Quick analysis
card-forge info problematic_card.png
# Deep validation
card-forge validate character.png
card-forge extract character.png
card-forge repo character.json
card-forge build character/
๐ฎ Compatibility
- โ SillyTavern: Full compatibility
- โ RisuAI: Full compatibility
- โ Character Card V3: Complete specification support
- โ Legacy formats: Backward compatible
๐ฆ API Usage
For programmatic use:
from forge.helper import extract_card_data, repositorize, rebuild_card
# Extract character card from PNG
card = extract_card_data("character.png")
# Convert to repository structure
repo_path = repositorize(card)
# Edit files in the repository...
# Rebuild the card
rebuilt_card = rebuild_card(repo_path)
โ๏ธ Configuration
The tool uses config.yaml for customization. The default configuration works great for most use cases, but you can customize field handling, file patterns, and repository structure as needed.
๐ ๏ธ Customizing Repositorization Behavior
Card Forge uses a flexible configuration system that lets you control exactly how character data gets organized into files and directories. Here's how to customize it:
Field Types and Options
Each field in your character card can be configured with different types and behaviors:
repositorize:
fields:
field_name:
enabled: true/false # Whether to process this field
type: string|array|dict|nested # How to handle the data
filename: "custom.md" # For string types
file_pattern: "{template}" # For arrays and dicts
value_type: string|dict # Type of values in arrays/dicts
Template Variables
Card Forge supports powerful template variables for dynamic file naming:
Basic Variables:
{idx}- Array index (auto-padded with zeros){key}- Dictionary key name
Dot Notation (for complex data):
{value.name}- Access nested properties{value.id}_{value.title}- Combine multiple properties
Configuration Examples
1. Custom Array Patterns
# Default: alternate_greetings/001.md, 002.md, 003.md
alternate_greetings:
enabled: true
type: array
file_pattern: "greeting_{idx}.md"
value_type: string
# Result: alternate_greetings/greeting_001.md, greeting_002.md
2. Complex Object Arrays
# For arrays of objects like assets or scripts
assets:
enabled: true
type: array
file_pattern: "{name}_{type}.yaml" # Uses object properties
value_type: dict
# Result: assets/portrait_icon.yaml, background_image.yaml
3. Multilingual Content
# Dictionary with language codes as keys
creator_notes_multilingual:
enabled: true
type: dict
file_pattern: "notes_{key}.md" # key = language code
value_type: string
# Result: creator_notes_multilingual/notes_en.md, notes_es.md
4. Nested Field Configuration
extensions:
enabled: true
type: nested
fields:
regex_scripts:
enabled: true
type: array
file_pattern: "{idx}_{scriptName}.yaml" # Uses script's name property
value_type: dict
5. Disabling Fields
# Keep some fields in metadata instead of separate files
tags:
enabled: false # Will remain in _metadata.yaml
type: array
value_type: string
source:
enabled: false # Keep URLs in metadata for easier management
type: array
value_type: string
Custom Configuration Workflow
-
Generate default config:
card-forge init-config -o my_config.yaml
-
Customize field handling:
# Example: Change how greetings are organized alternate_greetings: enabled: true type: array file_pattern: "alt_greeting_{idx}.txt" value_type: string
-
Use custom config:
card-forge repo character.png -c my_config.yaml card-forge build character/ -c my_config.yaml
Advanced Examples
Organize scripts by functionality:
extensions:
enabled: true
type: nested
fields:
regex_scripts:
enabled: true
type: array
file_pattern: "{idx}_{scriptName}_{id}.yaml"
value_type: dict
Lorebook entries with meaningful names:
character_book:
enabled: true
type: nested
fields:
entries:
enabled: true
type: array
file_pattern: "{id}_{comment}.yaml" # Uses entry ID and comment
value_type: dict
Custom string field organization:
# Group all text content in a 'content' subdirectory
description:
enabled: true
type: string
filename: "content/character_description.md"
personality:
enabled: true
type: string
filename: "content/personality_traits.md"
The configuration system is designed to be intuitive yet powerful - you can keep the defaults for quick workflows, or customize everything for complex projects with specific organization needs.
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
๐ License
MIT License - see LICENSE file for details.
Card Forge - Making character card management simple, organized, and version-control friendly! ๐ญโจ
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file card_forge-0.1.1.tar.gz.
File metadata
- Download URL: card_forge-0.1.1.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
322982958d68531baf469d2f2835705a3523f2656f30cf3de230c67aad72a09b
|
|
| MD5 |
f52c175dd539df9c7c6a726c5c3aab21
|
|
| BLAKE2b-256 |
76376903ad984939c1e8921349f0ad63b29a6b42dd045681aa46d35dedb0da4f
|
Provenance
The following attestation bundles were made for card_forge-0.1.1.tar.gz:
Publisher:
publish.yml on Nya-Foundation/card-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
card_forge-0.1.1.tar.gz -
Subject digest:
322982958d68531baf469d2f2835705a3523f2656f30cf3de230c67aad72a09b - Sigstore transparency entry: 583947595
- Sigstore integration time:
-
Permalink:
Nya-Foundation/card-forge@a187ef2c27d0c0c3448531623460f70689c105c0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Nya-Foundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a187ef2c27d0c0c3448531623460f70689c105c0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file card_forge-0.1.1-py3-none-any.whl.
File metadata
- Download URL: card_forge-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ed3c905688c9ed4b7dd02c6ee5b8c0259016ae03b817202f4f5a1f9e1c4821f
|
|
| MD5 |
6af269448bf0af601eed09b9970f5654
|
|
| BLAKE2b-256 |
94ee94003eb57cedc2e09928ce49e5e5c12bb526c72193d222061b05957176c2
|
Provenance
The following attestation bundles were made for card_forge-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Nya-Foundation/card-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
card_forge-0.1.1-py3-none-any.whl -
Subject digest:
6ed3c905688c9ed4b7dd02c6ee5b8c0259016ae03b817202f4f5a1f9e1c4821f - Sigstore transparency entry: 583947597
- Sigstore integration time:
-
Permalink:
Nya-Foundation/card-forge@a187ef2c27d0c0c3448531623460f70689c105c0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Nya-Foundation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a187ef2c27d0c0c3448531623460f70689c105c0 -
Trigger Event:
push
-
Statement type: