card-forge 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- card_forge-0.0.1.dist-info/METADATA +312 -0
- card_forge-0.0.1.dist-info/RECORD +11 -0
- card_forge-0.0.1.dist-info/WHEEL +5 -0
- card_forge-0.0.1.dist-info/entry_points.txt +2 -0
- card_forge-0.0.1.dist-info/licenses/LICENSE +21 -0
- card_forge-0.0.1.dist-info/top_level.txt +1 -0
- forge/_version.py +1 -0
- forge/cli.py +473 -0
- forge/constant.py +101 -0
- forge/helper.py +784 -0
- forge/models.py +199 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: card-forge
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Modern CLI tool for AI character card management - extract, repositorize, and rebuild character cards
|
|
5
|
+
Author-email: "Nya Foundation Team (k3scat)" <k3scat@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Nya-Foundation/card-forge
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/Nya-Foundation/card-forge/issues
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.13
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: pillow>=11.3.0
|
|
20
|
+
Requires-Dist: pydantic>=2.11.9
|
|
21
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Card Forge 🔨
|
|
25
|
+
|
|
26
|
+
> **[中文版README](README_zh.md) | [English README](README.md)**
|
|
27
|
+
|
|
28
|
+
**Modern CLI tool for AI character card management** - Extract, repositorize, and rebuild character cards with ease!
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
32
|
+
║ ║
|
|
33
|
+
║ ██████╗ █████╗ ██████╗ ██████╗ ███████╗ ██████╗ ██████╗ ██████╗ ███████╗║
|
|
34
|
+
║ ██╔════╝██╔══██╗██╔══██╗██╔══██╗ ██╔════╝██╔═══██╗██╔══██╗██╔════╝ ██╔════╝║
|
|
35
|
+
║ ██║ ███████║██████╔╝██║ ██║ █████╗ ██║ ██║██████╔╝██║ ███╗█████╗ ║
|
|
36
|
+
║ ██║ ██╔══██║██╔══██╗██║ ██║ ██╔══╝ ██║ ██║██╔══██╗██║ ██║██╔══╝ ║
|
|
37
|
+
║ ╚██████╗██║ ██║██║ ██║██████╔╝ ██║ ╚██████╔╝██║ ██║╚██████╔╝███████╗║
|
|
38
|
+
║ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝║
|
|
39
|
+
║ ║
|
|
40
|
+
║ 🔨 AI Character Card Management Tool 🔨 ║
|
|
41
|
+
║ ║
|
|
42
|
+
╚═══════════════════════════════════════════════════════════════════════════════╝
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 🚀 Features
|
|
46
|
+
|
|
47
|
+
- **📤 Extract**: Get character data from PNG files to JSON
|
|
48
|
+
- **📁 Repositorize**: Convert cards to version-control friendly file structures
|
|
49
|
+
- **🔨 Rebuild**: Reconstruct cards from repositories
|
|
50
|
+
- **✅ Validate**: Check card integrity and specification compliance
|
|
51
|
+
- **📊 Analyze**: Get detailed character card information
|
|
52
|
+
- **🎨 Modern CLI**: Beautiful interface with helpful commands
|
|
53
|
+
|
|
54
|
+
## 🔧 Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Install with uv (recommended)
|
|
58
|
+
uv add card-forge
|
|
59
|
+
|
|
60
|
+
# Or with pip
|
|
61
|
+
pip install card-forge
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 🎯 Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Extract character data from a PNG file
|
|
68
|
+
card-forge extract character.png
|
|
69
|
+
|
|
70
|
+
# Convert a character card to a repository structure
|
|
71
|
+
card-forge repo character.png
|
|
72
|
+
|
|
73
|
+
# Rebuild a character card from repository
|
|
74
|
+
card-forge build my_character/
|
|
75
|
+
|
|
76
|
+
# Validate a character card
|
|
77
|
+
card-forge validate character.png
|
|
78
|
+
|
|
79
|
+
# Get detailed information about a character
|
|
80
|
+
card-forge info character.png
|
|
81
|
+
|
|
82
|
+
# Generate default configuration file
|
|
83
|
+
card-forge init-config
|
|
84
|
+
|
|
85
|
+
# Show version information
|
|
86
|
+
card-forge --version
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 📋 Commands
|
|
90
|
+
|
|
91
|
+
### `extract` - Extract card data to JSON
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
card-forge extract card.png # Extract to character_name.json
|
|
95
|
+
card-forge extract card.png -o mychar.json # Custom output filename
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `repo` - Convert to repository structure
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
card-forge repo card.png # From PNG file
|
|
102
|
+
card-forge repo character.json # From JSON file
|
|
103
|
+
card-forge repo card.png -c custom_config.yaml # Custom configuration
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Creates a clean, organized directory structure:
|
|
107
|
+
```
|
|
108
|
+
character_name/
|
|
109
|
+
├── _metadata.yaml # Card metadata (spec, version)
|
|
110
|
+
└── data/
|
|
111
|
+
├── _metadata.yaml # Remaining character data
|
|
112
|
+
├── description.md # Character description
|
|
113
|
+
├── personality.md # Personality traits
|
|
114
|
+
├── scenario.md # Scenario description
|
|
115
|
+
├── system_prompt.md # System instructions
|
|
116
|
+
├── first_message.md # First message
|
|
117
|
+
├── example_messages.md # Example dialogue
|
|
118
|
+
├── creator_notes.md # Creator notes
|
|
119
|
+
├── alternate_greetings/ # Alternative greetings
|
|
120
|
+
│ ├── 1.txt
|
|
121
|
+
│ └── 2.txt
|
|
122
|
+
├── group_only_greetings/ # Group chat greetings
|
|
123
|
+
│ └── 1.txt
|
|
124
|
+
├── creator_notes_multilingual/ # Multi-language notes
|
|
125
|
+
│ ├── en.md
|
|
126
|
+
│ └── es.md
|
|
127
|
+
├── assets/ # Character assets
|
|
128
|
+
│ ├── main_icon.yaml
|
|
129
|
+
│ └── background_image.yaml
|
|
130
|
+
├── extensions/ # Extensions and scripts
|
|
131
|
+
│ ├── _metadata.yaml
|
|
132
|
+
│ ├── TavernHelper_scripts/
|
|
133
|
+
│ │ └── script_name.yaml
|
|
134
|
+
│ └── regex_scripts/
|
|
135
|
+
│ └── script_name.yaml
|
|
136
|
+
└── character_book/ # Lorebook entries
|
|
137
|
+
├── _metadata.yaml
|
|
138
|
+
└── entries/
|
|
139
|
+
├── 1-location.yaml
|
|
140
|
+
└── 2-character.yaml
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `build` - Rebuild from repository
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
card-forge build my_character/ # Rebuild to JSON
|
|
147
|
+
card-forge build my_character/ -f png # Rebuild to PNG
|
|
148
|
+
card-forge build my_character/ -o rebuilt # Custom output name
|
|
149
|
+
card-forge build my_character/ -f png -b base.png # Custom base image
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `validate` - Check card integrity
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
card-forge validate character.png # Validate PNG
|
|
156
|
+
card-forge validate character.json # Validate JSON
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `info` - Detailed character analysis
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
card-forge info character.png # Show detailed information
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `init-config` - Generate configuration file
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
card-forge init-config # Generate config.yaml
|
|
169
|
+
card-forge init-config -o custom.yaml # Custom filename
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Example output:
|
|
173
|
+
```
|
|
174
|
+
🎭 CHARACTER: Alice Wonderland
|
|
175
|
+
================================================================================
|
|
176
|
+
👤 Creator: CardMaker
|
|
177
|
+
🏷️ Tags: fantasy, adventure, curious
|
|
178
|
+
📝 Version: 1.0
|
|
179
|
+
🔧 Spec: chara_card_v3 v3.0
|
|
180
|
+
|
|
181
|
+
📋 CONTENT OVERVIEW:
|
|
182
|
+
• Description: 1,250 characters
|
|
183
|
+
• Personality: 890 characters
|
|
184
|
+
• Scenario: 1,100 characters
|
|
185
|
+
• Alternate greetings: 3
|
|
186
|
+
• Group-only greetings: 1
|
|
187
|
+
|
|
188
|
+
📚 LOREBOOK:
|
|
189
|
+
• Name: Wonderland Guide
|
|
190
|
+
• Entries: 12
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 🛠️ Development Workflow
|
|
194
|
+
|
|
195
|
+
### 1. Extract and Explore
|
|
196
|
+
```bash
|
|
197
|
+
# Extract a character card to see its structure
|
|
198
|
+
card-forge extract my_card.png
|
|
199
|
+
card-forge info my_card.png
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 2. Convert to Repository
|
|
203
|
+
```bash
|
|
204
|
+
# Create editable file structure
|
|
205
|
+
card-forge repo my_card.png
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 3. Edit Files
|
|
209
|
+
Edit the individual files in your favorite editor:
|
|
210
|
+
- Modify `description.md` for character description
|
|
211
|
+
- Update `personality.md` for personality traits
|
|
212
|
+
- Add alternate greetings in `alternate_greetings/`
|
|
213
|
+
- Edit lorebook entries in `character_book/entries/`
|
|
214
|
+
|
|
215
|
+
### 4. Rebuild and Test
|
|
216
|
+
```bash
|
|
217
|
+
# Rebuild to verify changes
|
|
218
|
+
card-forge build my_character/
|
|
219
|
+
card-forge validate my_character_rebuilt.json
|
|
220
|
+
|
|
221
|
+
# Create final PNG
|
|
222
|
+
card-forge build my_character/ -f png
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## 🔄 Use Cases
|
|
226
|
+
|
|
227
|
+
### Version Control for Character Development
|
|
228
|
+
```bash
|
|
229
|
+
# Initial setup
|
|
230
|
+
card-forge repo character.png
|
|
231
|
+
git init character_name
|
|
232
|
+
cd character_name
|
|
233
|
+
git add .
|
|
234
|
+
git commit -m "Initial character import"
|
|
235
|
+
|
|
236
|
+
# Make changes to files...
|
|
237
|
+
git commit -am "Updated personality traits"
|
|
238
|
+
|
|
239
|
+
# Rebuild for distribution
|
|
240
|
+
card-forge build . -f png
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Collaborative Character Creation
|
|
244
|
+
```bash
|
|
245
|
+
# Split work among team members
|
|
246
|
+
card-forge repo base_character.png
|
|
247
|
+
|
|
248
|
+
# Person A works on personality.md
|
|
249
|
+
# Person B works on lorebook entries
|
|
250
|
+
# Person C works on greetings
|
|
251
|
+
|
|
252
|
+
# Merge changes and rebuild
|
|
253
|
+
card-forge build character/ -f png
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Character Analysis and Debugging
|
|
257
|
+
```bash
|
|
258
|
+
# Quick analysis
|
|
259
|
+
card-forge info problematic_card.png
|
|
260
|
+
|
|
261
|
+
# Deep validation
|
|
262
|
+
card-forge validate character.png
|
|
263
|
+
card-forge extract character.png
|
|
264
|
+
card-forge repo character.json
|
|
265
|
+
card-forge build character/
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 🎮 Compatibility
|
|
269
|
+
|
|
270
|
+
- ✅ **SillyTavern**: Full compatibility
|
|
271
|
+
- ✅ **RisuAI**: Full compatibility
|
|
272
|
+
- ✅ **Character Card V3**: Complete specification support
|
|
273
|
+
- ✅ **Legacy formats**: Backward compatible
|
|
274
|
+
|
|
275
|
+
## 📦 API Usage
|
|
276
|
+
|
|
277
|
+
For programmatic use:
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
from forge.helper import extract_card_data, repositorize, rebuild_card
|
|
281
|
+
|
|
282
|
+
# Extract character card from PNG
|
|
283
|
+
card = extract_card_data("character.png")
|
|
284
|
+
|
|
285
|
+
# Convert to repository structure
|
|
286
|
+
repo_path = repositorize(card)
|
|
287
|
+
|
|
288
|
+
# Edit files in the repository...
|
|
289
|
+
|
|
290
|
+
# Rebuild the card
|
|
291
|
+
rebuilt_card = rebuild_card(repo_path)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## ⚙️ Configuration
|
|
295
|
+
|
|
296
|
+
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.
|
|
297
|
+
|
|
298
|
+
## 🤝 Contributing
|
|
299
|
+
|
|
300
|
+
1. Fork the repository
|
|
301
|
+
2. Create a feature branch
|
|
302
|
+
3. Make your changes
|
|
303
|
+
4. Add tests for new functionality
|
|
304
|
+
5. Submit a pull request
|
|
305
|
+
|
|
306
|
+
## 📄 License
|
|
307
|
+
|
|
308
|
+
MIT License - see LICENSE file for details.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
**Card Forge** - Making character card management simple, organized, and version-control friendly! 🎭✨
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
card_forge-0.0.1.dist-info/licenses/LICENSE,sha256=bhOMRTFZk4E0cuMGzforv8O2iAhZXSEWqrVUFCerj30,1070
|
|
2
|
+
forge/_version.py,sha256=sXLh7g3KC4QCFxcZGBTpG2scR7hmmBsMjq6LqRptkRg,22
|
|
3
|
+
forge/cli.py,sha256=z_xkFzcmgWGP0FlXknuHXN4xx8VLxVn8j3ZJxqji8Y4,17584
|
|
4
|
+
forge/constant.py,sha256=23WAZuvzHA1QH8w99IyEMptpZ1xgOVAauTGKZWv8QBM,3468
|
|
5
|
+
forge/helper.py,sha256=o6isZ5ilBf3SuXBU6Yfi4Yi5Enxl3HV2Ubv8hwONsQU,24753
|
|
6
|
+
forge/models.py,sha256=lTbNbdfEMyKK4YYVG9hAz1mnmCCbbjWCb02bM8ZRhHw,7471
|
|
7
|
+
card_forge-0.0.1.dist-info/METADATA,sha256=12tGOuOsiylOHkR9Kd-C4FhSxgxTCZ5r_M5XWFsZCy4,10434
|
|
8
|
+
card_forge-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
card_forge-0.0.1.dist-info/entry_points.txt,sha256=1yp7ipr6qLZxZtlqERzUjtgWNFi2aFvlUl0jFu6r6n0,46
|
|
10
|
+
card_forge-0.0.1.dist-info/top_level.txt,sha256=sDbe4KjRUBYyB4IABQOjHzoomNKH_4KwOv5fPPrv4ME,6
|
|
11
|
+
card_forge-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nya Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
forge
|
forge/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.1"
|