roguelike-cli 1.2.6 → 1.3.0
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.
- package/README.md +154 -208
- package/dist/ai/claude.js +53 -42
- package/dist/interactive/commands.js +383 -181
- package/dist/interactive/startup.js +6 -3
- package/dist/storage/nodeConfig.js +35 -1
- package/dist/storage/profile.js +276 -0
- package/package.json +1 -1
- package/src/ai/claude.ts +60 -43
- package/src/interactive/commands.ts +470 -187
- package/src/interactive/startup.ts +6 -3
- package/src/storage/nodeConfig.ts +48 -2
- package/src/storage/profile.ts +281 -0
package/README.md
CHANGED
|
@@ -19,35 +19,20 @@
|
|
|
19
19
|
|
|
20
20
|
## What is this?
|
|
21
21
|
|
|
22
|
-
**A
|
|
22
|
+
**A gamified task manager where every task is a folder and every project is a dungeon.**
|
|
23
23
|
|
|
24
|
-
Instead of flat text files, your tasks become a **file system tree**. Nested tasks = nested folders.
|
|
24
|
+
Instead of flat text files, your tasks become a **file system tree**. Nested tasks = nested folders. Complete tasks to earn XP, level up, and unlock achievements.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
25
27
|
|
|
26
28
|
- **Navigate** your todos like directories (`cd`, `ls`, `tree`)
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
29
|
+
- **Track progress** with XP, levels, and streaks
|
|
30
|
+
- **Earn achievements** for completing tasks
|
|
31
|
+
- **Mark milestones** as boss fights (3x XP)
|
|
32
|
+
- **Set deadlines** with human-readable dates
|
|
33
|
+
- **Generate visualizations** - trees, block diagrams, dungeon maps
|
|
30
34
|
- Let **AI help** you structure complex projects
|
|
31
35
|
|
|
32
|
-
## Why folders?
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
project/
|
|
36
|
-
├── phase-1-research/
|
|
37
|
-
│ ├── market-analysis/
|
|
38
|
-
│ │ └── competitors.xlsx <- attach files directly
|
|
39
|
-
│ └── user-interviews/
|
|
40
|
-
├── phase-2-development/
|
|
41
|
-
│ ├── backend-api/
|
|
42
|
-
│ ├── frontend-ui/
|
|
43
|
-
│ └── database-schema/
|
|
44
|
-
└── phase-3-launch/
|
|
45
|
-
├── marketing/
|
|
46
|
-
└── deployment/
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Your file manager becomes your task manager. Git tracks your progress. AI generates the structure.
|
|
50
|
-
|
|
51
36
|
## Install
|
|
52
37
|
|
|
53
38
|
```bash
|
|
@@ -55,234 +40,186 @@ npm i -g roguelike-cli
|
|
|
55
40
|
rlc
|
|
56
41
|
```
|
|
57
42
|
|
|
58
|
-
##
|
|
43
|
+
## Quick Start
|
|
59
44
|
|
|
60
45
|
```
|
|
61
|
-
> todo launch
|
|
46
|
+
> todo launch startup
|
|
62
47
|
|
|
63
|
-
├── Research
|
|
48
|
+
├── Research [BOSS]
|
|
64
49
|
│ ├── Market analysis
|
|
65
|
-
│ ├── Competitor research
|
|
66
50
|
│ └── User interviews
|
|
67
51
|
├── Development
|
|
68
|
-
│ ├──
|
|
69
|
-
│ ├── Backend API
|
|
52
|
+
│ ├── Backend API [DUE: +7d]
|
|
70
53
|
│ └── Frontend UI
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
│ └── Press release
|
|
74
|
-
└── Growth
|
|
75
|
-
├── Metrics tracking
|
|
76
|
-
└── User feedback
|
|
77
|
-
|
|
78
|
-
[Type "save" to create folder launch-my-startup/]
|
|
79
|
-
> save
|
|
80
|
-
Created todo folder: launch-my-startup/
|
|
81
|
-
|
|
82
|
-
> cd launch-my-startup
|
|
83
|
-
> tree
|
|
84
|
-
├── research/
|
|
85
|
-
│ ├── market-analysis/
|
|
86
|
-
│ ├── competitor-research/
|
|
87
|
-
│ └── user-interviews/
|
|
88
|
-
├── development/
|
|
89
|
-
│ ├── mvp-features/
|
|
90
|
-
│ ├── backend-api/
|
|
91
|
-
│ └── frontend-ui/
|
|
92
|
-
├── launch/
|
|
93
|
-
│ ├── marketing-campaign/
|
|
94
|
-
│ └── press-release/
|
|
95
|
-
└── growth/
|
|
96
|
-
├── metrics-tracking/
|
|
97
|
-
└── user-feedback/
|
|
98
|
-
```
|
|
54
|
+
└── Launch [MILESTONE]
|
|
55
|
+
└── Marketing campaign
|
|
99
56
|
|
|
100
|
-
|
|
57
|
+
[Type "save" to create folder launch-startup/]
|
|
58
|
+
> save
|
|
59
|
+
Created todo folder: launch-startup/
|
|
101
60
|
|
|
102
|
-
|
|
61
|
+
> cd launch-startup/research
|
|
62
|
+
> done
|
|
103
63
|
|
|
104
|
-
|
|
64
|
+
=== TASK COMPLETED ===
|
|
105
65
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
│ ├── Setup CI/CD
|
|
110
|
-
│ └── Configure environment
|
|
111
|
-
├── Phase 2: Development
|
|
112
|
-
│ ├── Backend API
|
|
113
|
-
│ └── Frontend UI
|
|
114
|
-
└── Phase 3: Deploy
|
|
115
|
-
```
|
|
66
|
+
Tasks completed: 3
|
|
67
|
+
Bosses defeated: 1
|
|
68
|
+
+45 XP
|
|
116
69
|
|
|
117
|
-
|
|
70
|
+
*** LEVEL UP! ***
|
|
71
|
+
You are now level 2!
|
|
118
72
|
|
|
73
|
+
=== NEW ACHIEVEMENTS ===
|
|
74
|
+
[x] First Blood: Complete your first task
|
|
75
|
+
[x] Boss Slayer: Complete a boss task
|
|
119
76
|
```
|
|
120
|
-
> schema kubernetes cluster
|
|
121
77
|
|
|
122
|
-
|
|
123
|
-
│ Kubernetes Cluster │
|
|
124
|
-
│ │
|
|
125
|
-
│ ┌──────────────┐ ┌──────────────┐ │
|
|
126
|
-
│ │ postgres │ │ redis │ │
|
|
127
|
-
│ │ │ │ │ │
|
|
128
|
-
│ │ primary-pod │ │ cache-pod-1 │ │
|
|
129
|
-
│ │ replica-pod │ │ cache-pod-2 │ │
|
|
130
|
-
│ └──────┬───────┘ └──────┬───────┘ │
|
|
131
|
-
│ └──────────┬───────────┘ │
|
|
132
|
-
│ ▼ │
|
|
133
|
-
│ ┌───────────────┐ │
|
|
134
|
-
│ │ worker-nodes │ │
|
|
135
|
-
│ └───────────────┘ │
|
|
136
|
-
└─────────────────────────────────────────────────────────────┘
|
|
137
|
-
```
|
|
78
|
+
## Commands
|
|
138
79
|
|
|
139
|
-
###
|
|
80
|
+
### Navigation
|
|
140
81
|
|
|
141
|
-
|
|
82
|
+
| Command | Description |
|
|
83
|
+
|---------|-------------|
|
|
84
|
+
| `ls` | List tasks (shows status) |
|
|
85
|
+
| `tree` | Task tree with deadlines |
|
|
86
|
+
| `tree -A` | Include files |
|
|
87
|
+
| `tree --depth=N` | Limit depth |
|
|
88
|
+
| `cd <task>` | Enter task |
|
|
89
|
+
| `..`, `...` | Go up 1 or 2 levels |
|
|
90
|
+
| `pwd` | Current path |
|
|
91
|
+
| `open` | Open in Finder |
|
|
142
92
|
|
|
143
|
-
|
|
144
|
-
> map
|
|
93
|
+
### Task Management
|
|
145
94
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
█████████+███████████████████+██████████
|
|
155
|
-
█ █ █
|
|
156
|
-
█ [Launch] █ [Growth] █
|
|
157
|
-
█ * Marketing █ * Metrics █
|
|
158
|
-
█ * Press ──────+───* Feedback █
|
|
159
|
-
█ @ BOSS: Ship it! █ █
|
|
160
|
-
█ █ █
|
|
161
|
-
████████████████████████████████████████
|
|
162
|
-
|
|
163
|
-
Legend: * Task @ Milestone + Door █ Wall
|
|
164
|
-
```
|
|
95
|
+
| Command | Description |
|
|
96
|
+
|---------|-------------|
|
|
97
|
+
| `done` | Complete task (recursive, earns XP) |
|
|
98
|
+
| `deadline <date>` | Set deadline |
|
|
99
|
+
| `boss` | Toggle boss status (3x XP) |
|
|
100
|
+
| `block [reason]` | Mark as blocked |
|
|
101
|
+
| `unblock` | Remove blocked status |
|
|
102
|
+
| `status` | Show task details |
|
|
165
103
|
|
|
166
|
-
|
|
104
|
+
### Gamification
|
|
167
105
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
106
|
+
| Command | Description |
|
|
107
|
+
|---------|-------------|
|
|
108
|
+
| `stats` | XP, level, streaks |
|
|
109
|
+
| `achievements` | Achievement list |
|
|
110
|
+
| `map` | Dungeon map view |
|
|
111
|
+
| `map --ai` | AI-generated dungeon |
|
|
173
112
|
|
|
174
|
-
|
|
113
|
+
### File Operations
|
|
175
114
|
|
|
176
115
|
| Command | Description |
|
|
177
116
|
|---------|-------------|
|
|
178
|
-
| `ls` | List tasks and files |
|
|
179
|
-
| `tree` | Show task tree |
|
|
180
|
-
| `tree -A` | Include files |
|
|
181
|
-
| `map` | Dungeon map view |
|
|
182
|
-
| `cd <task>` | Enter task |
|
|
183
|
-
| `..` | Go back |
|
|
184
117
|
| `mkdir <name>` | Create task |
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `v`, `version` | Show version |
|
|
118
|
+
| `cp <src> <dst>` | Copy |
|
|
119
|
+
| `mv <src> <dst>` | Move/rename |
|
|
120
|
+
| `rm <name>` | Delete file |
|
|
121
|
+
| `rm -rf <name>` | Delete folder |
|
|
190
122
|
|
|
191
|
-
|
|
123
|
+
### AI Generation
|
|
192
124
|
|
|
193
|
-
|
|
125
|
+
| Command | Description |
|
|
126
|
+
|---------|-------------|
|
|
127
|
+
| `<description>` | AI generates preview |
|
|
128
|
+
| `save` | Save pending schema |
|
|
129
|
+
| `cancel` | Discard |
|
|
130
|
+
|
|
131
|
+
## Deadlines
|
|
194
132
|
|
|
195
133
|
```
|
|
196
|
-
>
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
│ └── Preheat oven
|
|
201
|
-
├── Mix
|
|
202
|
-
│ ├── Cream butter + sugar
|
|
203
|
-
│ └── Add flour
|
|
204
|
-
├── Bake (8-10 min)
|
|
205
|
-
└── Cool & store
|
|
206
|
-
|
|
207
|
-
> add deadline tomorrow for Bake
|
|
208
|
-
> add blocker "buy flour" for Mix
|
|
209
|
-
> shorter
|
|
210
|
-
> more detailed
|
|
211
|
-
> save
|
|
134
|
+
> deadline today # Due today
|
|
135
|
+
> deadline tomorrow # Due tomorrow
|
|
136
|
+
> deadline +3d # Due in 3 days
|
|
137
|
+
> deadline Jan 15 # Due on date
|
|
212
138
|
```
|
|
213
139
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
## Examples
|
|
217
|
-
|
|
218
|
-
### Software Project
|
|
140
|
+
Tree shows deadlines:
|
|
219
141
|
|
|
220
142
|
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
│ ├── Create wireframes
|
|
226
|
-
│ └── Tech stack decision
|
|
227
|
-
├── Backend
|
|
228
|
-
│ ├── Database schema
|
|
229
|
-
│ ├── API endpoints
|
|
230
|
-
│ ├── Authentication
|
|
231
|
-
│ └── Payment integration
|
|
232
|
-
├── Frontend
|
|
233
|
-
│ ├── Components library
|
|
234
|
-
│ ├── Pages
|
|
235
|
-
│ └── State management
|
|
236
|
-
├── DevOps
|
|
237
|
-
│ ├── CI/CD pipeline
|
|
238
|
-
│ ├── Staging environment
|
|
239
|
-
│ └── Production deployment
|
|
240
|
-
└── Launch
|
|
241
|
-
├── Beta testing
|
|
242
|
-
├── Marketing site
|
|
243
|
-
└── Product Hunt launch
|
|
143
|
+
├── Backend API/ [BOSS] [3d left]
|
|
144
|
+
│ ├── Database/ [DONE]
|
|
145
|
+
│ └── Endpoints/ [OVERDUE 2d]
|
|
146
|
+
└── Frontend/ [tomorrow]
|
|
244
147
|
```
|
|
245
148
|
|
|
246
|
-
|
|
149
|
+
## XP System
|
|
150
|
+
|
|
151
|
+
- Base XP: 10 per task
|
|
152
|
+
- Depth bonus: +5 XP per nesting level
|
|
153
|
+
- Boss multiplier: 3x XP
|
|
154
|
+
|
|
155
|
+
| Level | XP Required |
|
|
156
|
+
|-------|-------------|
|
|
157
|
+
| 1 | 0 |
|
|
158
|
+
| 2 | 100 |
|
|
159
|
+
| 3 | 150 |
|
|
160
|
+
| 5 | 337 |
|
|
161
|
+
| 10 | 3,844 |
|
|
162
|
+
|
|
163
|
+
## Achievements
|
|
164
|
+
|
|
165
|
+
| Achievement | Description |
|
|
166
|
+
|-------------|-------------|
|
|
167
|
+
| First Blood | Complete first task |
|
|
168
|
+
| Getting Started | Complete 10 tasks |
|
|
169
|
+
| Productive | Complete 50 tasks |
|
|
170
|
+
| Centurion | Complete 100 tasks |
|
|
171
|
+
| Deep Diver | Complete task at depth 5+ |
|
|
172
|
+
| Boss Slayer | Complete a boss task |
|
|
173
|
+
| Boss Hunter | Defeat 5 bosses |
|
|
174
|
+
| Speedrunner | Complete task same day |
|
|
175
|
+
| On a Roll | 3 day streak |
|
|
176
|
+
| Streak Master | 7 day streak |
|
|
177
|
+
| Unstoppable | 30 day streak |
|
|
178
|
+
| Adventurer | Reach level 5 |
|
|
179
|
+
| Veteran | Reach level 10 |
|
|
180
|
+
| Legend | Reach level 25 |
|
|
181
|
+
|
|
182
|
+
## Dungeon Map
|
|
247
183
|
|
|
248
184
|
```
|
|
249
|
-
>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
185
|
+
> map
|
|
186
|
+
|
|
187
|
+
###########################################
|
|
188
|
+
# # #
|
|
189
|
+
# [Research] # [Development] #
|
|
190
|
+
# * Market +---* Backend #
|
|
191
|
+
# x Users # @ Deploy BOSS #
|
|
192
|
+
# # #
|
|
193
|
+
##########+############+##################
|
|
194
|
+
| |
|
|
195
|
+
##########+############+##################
|
|
196
|
+
# #
|
|
197
|
+
# [Launch] #
|
|
198
|
+
# * Marketing #
|
|
199
|
+
# @ SHIP IT! [BOSS] #
|
|
200
|
+
# #
|
|
201
|
+
###########################################
|
|
202
|
+
|
|
203
|
+
Legend: * Task x Done @ Boss ! Blocked + Door
|
|
267
204
|
```
|
|
268
205
|
|
|
269
|
-
|
|
206
|
+
Use `map --ai` for creative AI-generated layouts.
|
|
207
|
+
|
|
208
|
+
## Block Diagrams
|
|
270
209
|
|
|
271
210
|
```
|
|
272
|
-
> schema
|
|
211
|
+
> schema kubernetes cluster
|
|
273
212
|
|
|
274
213
|
┌─────────────────────────────────────────────────────────────┐
|
|
275
|
-
│
|
|
276
|
-
│
|
|
277
|
-
│ ┌──────────────────┐ ┌──────────────────┐
|
|
278
|
-
│ │
|
|
279
|
-
│ └────────┬─────────┘
|
|
280
|
-
│ │
|
|
281
|
-
│
|
|
282
|
-
│ │
|
|
283
|
-
│ │
|
|
284
|
-
│ └─────────────────┘ └────────────┘ │ Replica) │ │
|
|
285
|
-
│ └────────────────┘ │
|
|
214
|
+
│ Kubernetes Cluster │
|
|
215
|
+
│ │
|
|
216
|
+
│ ┌──────────────────┐ ┌──────────────────┐ │
|
|
217
|
+
│ │ Control Plane │ │ Worker Nodes │ │
|
|
218
|
+
│ └────────┬─────────┘ └────────┬─────────┘ │
|
|
219
|
+
│ └──────────┬───────────────┘ │
|
|
220
|
+
│ ┌──────────────────┐│┌──────────────────┐ │
|
|
221
|
+
│ │ PostgreSQL │││ Redis │ │
|
|
222
|
+
│ └──────────────────┘│└──────────────────┘ │
|
|
286
223
|
└─────────────────────────────────────────────────────────────┘
|
|
287
224
|
```
|
|
288
225
|
|
|
@@ -291,6 +228,15 @@ AI understands context and refines until you're happy.
|
|
|
291
228
|
```
|
|
292
229
|
> tree | pbcopy # macOS
|
|
293
230
|
> tree | clip # Windows
|
|
231
|
+
> ls | copy # Alternative
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Configuration
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
> init # Setup wizard
|
|
238
|
+
> config # Show settings
|
|
239
|
+
> config:apiKey=sk-... # Set API key
|
|
294
240
|
```
|
|
295
241
|
|
|
296
242
|
## Website
|
package/dist/ai/claude.js
CHANGED
|
@@ -4,53 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateSchemaWithAI = generateSchemaWithAI;
|
|
7
|
+
exports.generateDungeonMapWithAI = generateDungeonMapWithAI;
|
|
7
8
|
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
|
|
8
9
|
const SYSTEM_PROMPT = `You are a schema generator. Based on user input, generate EITHER:
|
|
9
10
|
|
|
10
11
|
1. **BLOCK DIAGRAM** - when user mentions: "schema", "architecture", "infrastructure", "diagram", "system"
|
|
11
|
-
Use box-drawing to create visual blocks with connections
|
|
12
|
-
|
|
13
|
-
Example:
|
|
14
|
-
\`\`\`
|
|
15
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
16
|
-
│ Kubernetes Cluster │
|
|
17
|
-
│ │
|
|
18
|
-
│ ┌──────────────────┐ ┌──────────────────┐ │
|
|
19
|
-
│ │ Control Plane │ │ Worker Nodes │ │
|
|
20
|
-
│ │ │◄────►│ │ │
|
|
21
|
-
│ │ - API Server │ │ - Node Pool 1 │ │
|
|
22
|
-
│ │ - Scheduler │ │ - Node Pool 2 │ │
|
|
23
|
-
│ │ - etcd │ │ - GPU Pool │ │
|
|
24
|
-
│ └────────┬─────────┘ └────────┬─────────┘ │
|
|
25
|
-
│ │ │ │
|
|
26
|
-
│ └──────────┬───────────────┘ │
|
|
27
|
-
│ │ │
|
|
28
|
-
│ ┌──────────────────┐│┌──────────────────┐ │
|
|
29
|
-
│ │ PostgreSQL │││ Redis │ │
|
|
30
|
-
│ └──────────────────┘│└──────────────────┘ │
|
|
31
|
-
└─────────────────────────────────────────────────────────────┘
|
|
32
|
-
\`\`\`
|
|
12
|
+
Use box-drawing to create visual blocks with connections.
|
|
33
13
|
|
|
34
14
|
2. **TREE STRUCTURE** - when user mentions: "todo", "tasks", "list", "steps", "plan"
|
|
35
|
-
Use tree format:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
\`\`\`
|
|
39
|
-
├── Phase 1: Setup
|
|
40
|
-
│ ├── Create repository
|
|
41
|
-
│ ├── Setup CI/CD
|
|
42
|
-
│ └── Configure environment
|
|
43
|
-
├── Phase 2: Development
|
|
44
|
-
│ ├── Backend API
|
|
45
|
-
│ └── Frontend UI
|
|
46
|
-
└── Phase 3: Deploy
|
|
47
|
-
\`\`\`
|
|
15
|
+
Use tree format with metadata tags:
|
|
16
|
+
- [BOSS] or [MILESTONE] for major milestones
|
|
17
|
+
- [DUE: date] for deadlines (today, tomorrow, +3d, Jan 15)
|
|
48
18
|
|
|
49
19
|
Rules:
|
|
50
20
|
1. Extract a short title for filename
|
|
51
|
-
2. If user says "schema" or "architecture" -
|
|
21
|
+
2. If user says "schema" or "architecture" - use BLOCK DIAGRAM format
|
|
52
22
|
3. If user says "todo" or "tasks" - use TREE format
|
|
53
23
|
4. Keep context from previous messages
|
|
24
|
+
5. For todos: add [BOSS] tags for major milestones, suggest deadlines
|
|
54
25
|
|
|
55
26
|
Respond with JSON:
|
|
56
27
|
{
|
|
@@ -58,6 +29,21 @@ Respond with JSON:
|
|
|
58
29
|
"format": "block" or "tree",
|
|
59
30
|
"content": "the actual ASCII art schema here"
|
|
60
31
|
}`;
|
|
32
|
+
const DUNGEON_MAP_PROMPT = `You are a dungeon map generator for a roguelike task manager.
|
|
33
|
+
Given a tree structure of tasks, create an ASCII dungeon map where:
|
|
34
|
+
- Each major task group is a ROOM
|
|
35
|
+
- Sub-tasks are items inside rooms (marked with *)
|
|
36
|
+
- Boss/milestone tasks [BOSS] are marked with @ symbol
|
|
37
|
+
- Completed tasks [DONE] are marked with x
|
|
38
|
+
- Blocked tasks [BLOCKED] are marked with !
|
|
39
|
+
- Rooms are connected by corridors (|, +, -)
|
|
40
|
+
- Use # for walls
|
|
41
|
+
- Use + for doors between rooms
|
|
42
|
+
- Be creative with room shapes and layouts
|
|
43
|
+
- Include a legend at the bottom
|
|
44
|
+
|
|
45
|
+
Create a creative, interesting dungeon layout for the given tasks.
|
|
46
|
+
Output ONLY the ASCII map, no JSON wrapper.`;
|
|
61
47
|
async function generateSchemaWithAI(input, config, signal, history) {
|
|
62
48
|
if (!config.apiKey) {
|
|
63
49
|
throw new Error('API key not set. Use config:apiKey=<key> to set it.');
|
|
@@ -65,20 +51,17 @@ async function generateSchemaWithAI(input, config, signal, history) {
|
|
|
65
51
|
const client = new sdk_1.default({
|
|
66
52
|
apiKey: config.apiKey,
|
|
67
53
|
});
|
|
68
|
-
// Build messages from history or just the current input
|
|
69
54
|
const messages = [];
|
|
70
55
|
if (history && history.length > 0) {
|
|
71
|
-
|
|
72
|
-
for (const msg of history.slice(0, -1)) { // exclude the last one (current input)
|
|
56
|
+
for (const msg of history.slice(0, -1)) {
|
|
73
57
|
messages.push({
|
|
74
58
|
role: msg.role,
|
|
75
59
|
content: msg.role === 'assistant'
|
|
76
|
-
?
|
|
60
|
+
? 'Previous schema generated:\n' + msg.content
|
|
77
61
|
: msg.content
|
|
78
62
|
});
|
|
79
63
|
}
|
|
80
64
|
}
|
|
81
|
-
// Add current user input
|
|
82
65
|
messages.push({
|
|
83
66
|
role: 'user',
|
|
84
67
|
content: input
|
|
@@ -101,7 +84,6 @@ async function generateSchemaWithAI(input, config, signal, history) {
|
|
|
101
84
|
return null;
|
|
102
85
|
}
|
|
103
86
|
const parsed = JSON.parse(jsonMatch[0]);
|
|
104
|
-
// AI now returns ready content
|
|
105
87
|
const schemaContent = parsed.content || '';
|
|
106
88
|
return {
|
|
107
89
|
title: parsed.title || 'schema',
|
|
@@ -114,3 +96,32 @@ async function generateSchemaWithAI(input, config, signal, history) {
|
|
|
114
96
|
return null;
|
|
115
97
|
}
|
|
116
98
|
}
|
|
99
|
+
async function generateDungeonMapWithAI(treeContent, config, signal) {
|
|
100
|
+
if (!config.apiKey) {
|
|
101
|
+
throw new Error('API key not set. Use config:apiKey=<key> to set it.');
|
|
102
|
+
}
|
|
103
|
+
const client = new sdk_1.default({
|
|
104
|
+
apiKey: config.apiKey,
|
|
105
|
+
});
|
|
106
|
+
try {
|
|
107
|
+
const model = config.model || 'claude-sonnet-4-20250514';
|
|
108
|
+
const message = await client.messages.create({
|
|
109
|
+
model: model,
|
|
110
|
+
max_tokens: 2000,
|
|
111
|
+
system: DUNGEON_MAP_PROMPT,
|
|
112
|
+
messages: [{
|
|
113
|
+
role: 'user',
|
|
114
|
+
content: 'Generate a dungeon map for this task tree:\n\n' + treeContent
|
|
115
|
+
}],
|
|
116
|
+
});
|
|
117
|
+
const content = message.content[0];
|
|
118
|
+
if (content.type !== 'text') {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return content.text.trim();
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
console.error('AI Error:', error.message);
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
}
|