|
| 1 | +# ST Card Import — CLI Orchestrator |
| 2 | + |
| 3 | +Import SillyTavern character card files (PNG / CharX / ZIP) into the VibeApp system. Extracts apps from the card's character book and generates VibeApp code + mod scenario. |
| 4 | + |
| 5 | +## Parameter Parsing |
| 6 | + |
| 7 | +- `$ARGUMENTS` format: `{FilePath}` |
| 8 | +- `FilePath`: path to a `.png`, `.charx`, or `.zip` file containing a SillyTavern character card |
| 9 | + |
| 10 | +If `$ARGUMENTS` is empty, ask the user for the file path. |
| 11 | + |
| 12 | +## Execution Protocol |
| 13 | + |
| 14 | +### 1. Extract Card Data |
| 15 | + |
| 16 | +Run the extraction script: |
| 17 | + |
| 18 | +```bash |
| 19 | +python3 .claude/scripts/extract-card.py "{FilePath}" |
| 20 | +``` |
| 21 | + |
| 22 | +Capture the JSON output. If extraction fails, report the error and stop. |
| 23 | + |
| 24 | +### 2. Analyze & Present Results |
| 25 | + |
| 26 | +Parse the extraction output JSON. Display a structured summary to the user: |
| 27 | + |
| 28 | +``` |
| 29 | +Card: {source} ({source_type}) |
| 30 | +Character: {character.name} |
| 31 | + Description: {first 100 chars of character.description}... |
| 32 | +
|
| 33 | +Apps Found ({count}): |
| 34 | + 1. [{comment}] — keywords: {keywords} | format: {format} | tags: {tag_names} |
| 35 | + 2. ... |
| 36 | +
|
| 37 | +Lore Entries: {count} |
| 38 | +Regex Scripts: {count} |
| 39 | +``` |
| 40 | + |
| 41 | +### 3. User Selection |
| 42 | + |
| 43 | +Ask the user which apps to generate using AskUserQuestion: |
| 44 | +- Option 1: Generate all apps (recommended) |
| 45 | +- Option 2: Select specific apps |
| 46 | +- Option 3: Skip app generation (mod only) |
| 47 | + |
| 48 | +If the user selects specific apps, present a multi-select list of extracted apps. |
| 49 | + |
| 50 | +### 4. Generate Apps via Vibe Workflow |
| 51 | + |
| 52 | +For each selected app, derive a VibeApp requirement from the card data: |
| 53 | + |
| 54 | +#### 4.1 App Name Derivation |
| 55 | + |
| 56 | +Convert the app's `comment` field to PascalCase for the VibeApp name: |
| 57 | +- `"live stream"` → `LiveStream` |
| 58 | +- `"social-feed"` → `SocialFeed` |
| 59 | +- `"music app"` → `MusicApp` |
| 60 | +- Chinese names: translate to English PascalCase |
| 61 | + |
| 62 | +#### 4.2 Requirement Generation |
| 63 | + |
| 64 | +Build a comprehensive requirement description from the extracted data: |
| 65 | + |
| 66 | +``` |
| 67 | +A {format}-based app that provides {functional description based on keywords and tags}. |
| 68 | +
|
| 69 | +UI Features: |
| 70 | +{For each tag: describe the UI element it represents} |
| 71 | +
|
| 72 | +Data Resources: |
| 73 | +{For each resource list: describe what data it manages} |
| 74 | +
|
| 75 | +Content Format: {format type — xml tags / bracket notation / prose} |
| 76 | +
|
| 77 | +Regex Scripts (for reference): |
| 78 | +{List relevant scripts that transform this app's output} |
| 79 | +``` |
| 80 | + |
| 81 | +#### 4.3 Execute Vibe Workflow |
| 82 | + |
| 83 | +For each app, execute the `/vibe` command: |
| 84 | + |
| 85 | +``` |
| 86 | +/vibe {PascalCaseAppName} {GeneratedRequirement} |
| 87 | +``` |
| 88 | + |
| 89 | +Process apps **sequentially** — each vibe workflow must complete before starting the next. |
| 90 | + |
| 91 | +**Important**: Before starting each app, check if a VibeApp with that name already exists at `src/pages/{AppName}/`. If it does, ask the user whether to: |
| 92 | +- Skip this app |
| 93 | +- Overwrite (delete existing and regenerate) |
| 94 | +- Use change mode (modify existing app) |
| 95 | + |
| 96 | +### 5. Completion Report |
| 97 | + |
| 98 | +``` |
| 99 | +═══════════════════════════════════════ |
| 100 | + ST Card Import Complete |
| 101 | +═══════════════════════════════════════ |
| 102 | + Source: {filename} ({source_type}) |
| 103 | + Character: {character.name} |
| 104 | +
|
| 105 | + Apps Generated ({count}): |
| 106 | + • {AppName1} → http://localhost:3000/{app-name-1} |
| 107 | + • {AppName2} → http://localhost:3000/{app-name-2} |
| 108 | +═══════════════════════════════════════ |
| 109 | +``` |
| 110 | + |
| 111 | +## Error Handling |
| 112 | + |
| 113 | +- If extraction fails: report error, suggest checking file format |
| 114 | +- If a vibe workflow fails for one app: log error, continue with remaining apps |
| 115 | + |
| 116 | +## Notes |
| 117 | + |
| 118 | +- The extraction script handles both PNG (ccv3/chara tEXt chunks) and CharX/ZIP (card.json) formats |
| 119 | +- Apps are identified by character book entries containing `<rule S>` in their content |
| 120 | +- The vibe workflow handles all code generation, architecture, and integration |
| 121 | +- Lore entries are preserved as reference data but not directly used in app generation |
0 commit comments