roguelike-cli 1.2.6 → 1.3.1
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 +156 -208
- package/dist/ai/claude.js +53 -42
- package/dist/interactive/commands.js +514 -181
- package/dist/interactive/startup.js +6 -3
- package/dist/storage/nodeConfig.js +35 -1
- package/dist/storage/profile.js +323 -0
- package/package.json +1 -1
- package/src/ai/claude.ts +60 -43
- package/src/interactive/commands.ts +620 -187
- package/src/interactive/startup.ts +6 -3
- package/src/storage/nodeConfig.ts +48 -2
- package/src/storage/profile.ts +346 -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,188 @@ 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
|
+
| `undo` | Undo last done (restores XP) |
|
|
99
|
+
| `deadline <date>` | Set deadline |
|
|
100
|
+
| `boss` | Toggle boss status (3x XP) |
|
|
101
|
+
| `block [node]` | Block by task or text reason |
|
|
102
|
+
| `unblock` | Remove blocked status |
|
|
103
|
+
| `status` | Show task details |
|
|
104
|
+
| `check` | Show overdue/upcoming deadlines |
|
|
165
105
|
|
|
166
|
-
|
|
106
|
+
### Gamification
|
|
167
107
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| `stats` | XP, level, streaks |
|
|
111
|
+
| `achievements` | Achievement list |
|
|
112
|
+
| `map` | Dungeon map view |
|
|
113
|
+
| `map --ai` | AI-generated dungeon |
|
|
173
114
|
|
|
174
|
-
|
|
115
|
+
### File Operations
|
|
175
116
|
|
|
176
117
|
| Command | Description |
|
|
177
118
|
|---------|-------------|
|
|
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
119
|
| `mkdir <name>` | Create task |
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
187
|
-
| `
|
|
188
|
-
| `
|
|
189
|
-
| `v`, `version` | Show version |
|
|
120
|
+
| `cp <src> <dst>` | Copy |
|
|
121
|
+
| `mv <src> <dst>` | Move/rename |
|
|
122
|
+
| `rm <name>` | Delete file |
|
|
123
|
+
| `rm -rf <name>` | Delete folder |
|
|
190
124
|
|
|
191
|
-
|
|
125
|
+
### AI Generation
|
|
192
126
|
|
|
193
|
-
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---------|-------------|
|
|
129
|
+
| `<description>` | AI generates preview |
|
|
130
|
+
| `save` | Save pending schema |
|
|
131
|
+
| `cancel` | Discard |
|
|
132
|
+
|
|
133
|
+
## Deadlines
|
|
194
134
|
|
|
195
135
|
```
|
|
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
|
|
136
|
+
> deadline today # Due today
|
|
137
|
+
> deadline tomorrow # Due tomorrow
|
|
138
|
+
> deadline +3d # Due in 3 days
|
|
139
|
+
> deadline Jan 15 # Due on date
|
|
212
140
|
```
|
|
213
141
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
## Examples
|
|
217
|
-
|
|
218
|
-
### Software Project
|
|
142
|
+
Tree shows deadlines:
|
|
219
143
|
|
|
220
144
|
```
|
|
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
|
|
145
|
+
├── Backend API/ [BOSS] [3d left]
|
|
146
|
+
│ ├── Database/ [DONE]
|
|
147
|
+
│ └── Endpoints/ [OVERDUE 2d]
|
|
148
|
+
└── Frontend/ [tomorrow]
|
|
244
149
|
```
|
|
245
150
|
|
|
246
|
-
|
|
151
|
+
## XP System
|
|
152
|
+
|
|
153
|
+
- Base XP: 10 per task
|
|
154
|
+
- Depth bonus: +5 XP per nesting level
|
|
155
|
+
- Boss multiplier: 3x XP
|
|
156
|
+
|
|
157
|
+
| Level | XP Required |
|
|
158
|
+
|-------|-------------|
|
|
159
|
+
| 1 | 0 |
|
|
160
|
+
| 2 | 100 |
|
|
161
|
+
| 3 | 150 |
|
|
162
|
+
| 5 | 337 |
|
|
163
|
+
| 10 | 3,844 |
|
|
164
|
+
|
|
165
|
+
## Achievements
|
|
166
|
+
|
|
167
|
+
| Achievement | Description |
|
|
168
|
+
|-------------|-------------|
|
|
169
|
+
| First Blood | Complete first task |
|
|
170
|
+
| Getting Started | Complete 10 tasks |
|
|
171
|
+
| Productive | Complete 50 tasks |
|
|
172
|
+
| Centurion | Complete 100 tasks |
|
|
173
|
+
| Deep Diver | Complete task at depth 5+ |
|
|
174
|
+
| Boss Slayer | Complete a boss task |
|
|
175
|
+
| Boss Hunter | Defeat 5 bosses |
|
|
176
|
+
| Speedrunner | Complete task same day |
|
|
177
|
+
| On a Roll | 3 day streak |
|
|
178
|
+
| Streak Master | 7 day streak |
|
|
179
|
+
| Unstoppable | 30 day streak |
|
|
180
|
+
| Adventurer | Reach level 5 |
|
|
181
|
+
| Veteran | Reach level 10 |
|
|
182
|
+
| Legend | Reach level 25 |
|
|
183
|
+
|
|
184
|
+
## Dungeon Map
|
|
247
185
|
|
|
248
186
|
```
|
|
249
|
-
>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
187
|
+
> map
|
|
188
|
+
|
|
189
|
+
###########################################
|
|
190
|
+
# # #
|
|
191
|
+
# [Research] # [Development] #
|
|
192
|
+
# * Market +---* Backend #
|
|
193
|
+
# x Users # @ Deploy BOSS #
|
|
194
|
+
# # #
|
|
195
|
+
##########+############+##################
|
|
196
|
+
| |
|
|
197
|
+
##########+############+##################
|
|
198
|
+
# #
|
|
199
|
+
# [Launch] #
|
|
200
|
+
# * Marketing #
|
|
201
|
+
# @ SHIP IT! [BOSS] #
|
|
202
|
+
# #
|
|
203
|
+
###########################################
|
|
204
|
+
|
|
205
|
+
Legend: * Task x Done @ Boss ! Blocked + Door
|
|
267
206
|
```
|
|
268
207
|
|
|
269
|
-
|
|
208
|
+
Use `map --ai` for creative AI-generated layouts.
|
|
209
|
+
|
|
210
|
+
## Block Diagrams
|
|
270
211
|
|
|
271
212
|
```
|
|
272
|
-
> schema
|
|
213
|
+
> schema kubernetes cluster
|
|
273
214
|
|
|
274
215
|
┌─────────────────────────────────────────────────────────────┐
|
|
275
|
-
│
|
|
276
|
-
│
|
|
277
|
-
│ ┌──────────────────┐ ┌──────────────────┐
|
|
278
|
-
│ │
|
|
279
|
-
│ └────────┬─────────┘
|
|
280
|
-
│ │
|
|
281
|
-
│
|
|
282
|
-
│ │
|
|
283
|
-
│ │
|
|
284
|
-
│ └─────────────────┘ └────────────┘ │ Replica) │ │
|
|
285
|
-
│ └────────────────┘ │
|
|
216
|
+
│ Kubernetes Cluster │
|
|
217
|
+
│ │
|
|
218
|
+
│ ┌──────────────────┐ ┌──────────────────┐ │
|
|
219
|
+
│ │ Control Plane │ │ Worker Nodes │ │
|
|
220
|
+
│ └────────┬─────────┘ └────────┬─────────┘ │
|
|
221
|
+
│ └──────────┬───────────────┘ │
|
|
222
|
+
│ ┌──────────────────┐│┌──────────────────┐ │
|
|
223
|
+
│ │ PostgreSQL │││ Redis │ │
|
|
224
|
+
│ └──────────────────┘│└──────────────────┘ │
|
|
286
225
|
└─────────────────────────────────────────────────────────────┘
|
|
287
226
|
```
|
|
288
227
|
|
|
@@ -291,6 +230,15 @@ AI understands context and refines until you're happy.
|
|
|
291
230
|
```
|
|
292
231
|
> tree | pbcopy # macOS
|
|
293
232
|
> tree | clip # Windows
|
|
233
|
+
> ls | copy # Alternative
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
> init # Setup wizard
|
|
240
|
+
> config # Show settings
|
|
241
|
+
> config:apiKey=sk-... # Set API key
|
|
294
242
|
```
|
|
295
243
|
|
|
296
244
|
## 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
|
+
}
|