burnrate 0.1.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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +507 -0
  3. package/dist/cli/format.d.ts +13 -0
  4. package/dist/cli/format.js +319 -0
  5. package/dist/cli/index.d.ts +7 -0
  6. package/dist/cli/index.js +1121 -0
  7. package/dist/cli/setup.d.ts +8 -0
  8. package/dist/cli/setup.js +143 -0
  9. package/dist/core/async-engine.d.ts +411 -0
  10. package/dist/core/async-engine.js +2274 -0
  11. package/dist/core/async-worldgen.d.ts +19 -0
  12. package/dist/core/async-worldgen.js +221 -0
  13. package/dist/core/engine.d.ts +154 -0
  14. package/dist/core/engine.js +1104 -0
  15. package/dist/core/pathfinding.d.ts +38 -0
  16. package/dist/core/pathfinding.js +146 -0
  17. package/dist/core/types.d.ts +489 -0
  18. package/dist/core/types.js +359 -0
  19. package/dist/core/worldgen.d.ts +22 -0
  20. package/dist/core/worldgen.js +292 -0
  21. package/dist/db/database.d.ts +83 -0
  22. package/dist/db/database.js +829 -0
  23. package/dist/db/turso-database.d.ts +177 -0
  24. package/dist/db/turso-database.js +1586 -0
  25. package/dist/mcp/server.d.ts +7 -0
  26. package/dist/mcp/server.js +1877 -0
  27. package/dist/server/api.d.ts +8 -0
  28. package/dist/server/api.js +1234 -0
  29. package/dist/server/async-tick-server.d.ts +5 -0
  30. package/dist/server/async-tick-server.js +63 -0
  31. package/dist/server/errors.d.ts +78 -0
  32. package/dist/server/errors.js +156 -0
  33. package/dist/server/rate-limit.d.ts +22 -0
  34. package/dist/server/rate-limit.js +134 -0
  35. package/dist/server/tick-server.d.ts +9 -0
  36. package/dist/server/tick-server.js +114 -0
  37. package/dist/server/validation.d.ts +194 -0
  38. package/dist/server/validation.js +114 -0
  39. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 burnrate-cc
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.
package/README.md ADDED
@@ -0,0 +1,507 @@
1
+ # BURNRATE
2
+
3
+ **A logistics war MMO for Claude Code.**
4
+
5
+ *The front doesn't feed itself.*
6
+
7
+ ---
8
+
9
+ Hold territory by keeping it supplied. Every zone burns Supply Units each tick. When the supply stops, the zone falls. The best generals still lose if they can't feed the front.
10
+
11
+ - **MCP-native**: Play entirely through Claude Code's MCP integration
12
+ - **Multiplayer**: Compete and collaborate on shared servers
13
+ - **AI-collaborative**: Claude is your operations advisor
14
+ - **Operator advantage**: No grinding, no twitch—just better systems
15
+
16
+ ## The Metagame
17
+
18
+ What if using Claude well *was* the actual game?
19
+
20
+ BURNRATE is designed for automation. The MCP tools are your interface, but the real game is building Claude agents that optimize extraction, find efficient routes, spot market arbitrage, and coordinate faction logistics.
21
+
22
+ The players who learn to work WITH Claude—analyzing intel, optimizing routes, building automation—win. Skills transfer directly to real work.
23
+
24
+ **Play between tasks.** Check supply lines between deploys. Run convoys during CI builds. Strategy in the margins.
25
+
26
+ ---
27
+
28
+ ## Architecture
29
+
30
+ ```
31
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌──────────┐
32
+ │ Claude Code │────▶│ MCP Server │────▶│ Game API │────▶│ Turso │
33
+ │ (Player) │◀────│ (Local) │◀────│ (Hosted) │◀────│ Database │
34
+ └─────────────┘ └─────────────┘ └─────────────┘ └──────────┘
35
+ ```
36
+
37
+ - **Claude Code** - Your terminal and AI advisor
38
+ - **MCP Server** - Runs locally, provides tools/resources/prompts
39
+ - **Game API** - Hosted server running the game simulation
40
+ - **Turso** - Distributed SQLite database for persistence
41
+
42
+ ## Quick Start
43
+
44
+ ### Option A: Automated Setup (Recommended)
45
+
46
+ ```bash
47
+ npx burnrate setup
48
+ ```
49
+
50
+ This will:
51
+ - Ask for the game server URL (defaults to `https://api.burnrate.cc`)
52
+ - Optionally validate your API key
53
+ - Write your Claude Code MCP settings automatically
54
+ - Verify the connection
55
+
56
+ Restart Claude Code after setup, then ask Claude to join:
57
+
58
+ ```
59
+ Use burnrate_join to create a character named "YourName"
60
+ ```
61
+
62
+ ### Option B: Manual Setup
63
+
64
+ 1. Clone and build:
65
+ ```bash
66
+ mkdir ~/burnrate && cd ~/burnrate
67
+ git clone https://github.com/burnrate-cc/burnrate.git .
68
+ npm install && npm run build
69
+ ```
70
+
71
+ 2. Add to your Claude Code MCP settings (`~/.claude/settings.json`):
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "burnrate": {
76
+ "command": "node",
77
+ "args": ["/Users/YOU/burnrate/dist/mcp/server.js"],
78
+ "env": {
79
+ "BURNRATE_API_URL": "https://api.burnrate.cc"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ 3. Restart Claude Code and join:
87
+ ```
88
+ Use burnrate_join to create a character named "YourName"
89
+ ```
90
+
91
+ You'll receive an API key. **Save it!** Then add `"BURNRATE_API_KEY": "your-key-here"` to your env config and restart Claude Code.
92
+
93
+ ### Start Playing
94
+
95
+ ```
96
+ Use burnrate_status to see my inventory and location
97
+ Use burnrate_view to see the world map
98
+ Use burnrate_routes to see where I can travel
99
+ ```
100
+
101
+ New players start with a 5-step tutorial that teaches core mechanics. Use `burnrate_tutorial` to see your progress, or ask Claude to use the `game_overview` prompt for a full walkthrough.
102
+
103
+ ## Core Concepts
104
+
105
+ ### The Burn
106
+ Every controlled zone consumes **Supply Units (SU)** each tick. If supply runs out, the zone collapses and becomes neutral. Winners are the factions that keep their zones fed while starving enemies.
107
+
108
+ ### Credits
109
+ Credits are the in-game currency. You start with 1000 and earn more through contracts and trading. Spend them on:
110
+ - Extraction (5 credits per raw resource unit)
111
+ - Licenses (500-2000 credits)
112
+ - Hiring units from other players
113
+ - Posting contract rewards
114
+
115
+ ### Resources
116
+ ```
117
+ T0 (Raw) → T1 (Processed) → T2 (Strategic) → SU
118
+ ore, fuel, metal, chemicals, ammo, medkits, Supply Units
119
+ grain, fiber rations, textiles parts, comms
120
+ ```
121
+
122
+ ### Zones
123
+ - **Hubs** - Safe starting areas, marketplaces
124
+ - **Fields** - Extract raw resources (T0)
125
+ - **Factories** - Convert resources, produce units
126
+ - **Junctions** - Crossroads, no burn
127
+ - **Fronts** - Contested territory, high burn
128
+ - **Strongholds** - Victory objectives, highest burn
129
+
130
+ ### Intel Decay
131
+ Intelligence gathered through scanning decays over time:
132
+ - **Fresh** (<10 ticks) - Full accuracy
133
+ - **Stale** (10-50 ticks) - Reduced signal quality, some data obscured
134
+ - **Expired** (>50 ticks) - Unreliable, most data unavailable
135
+
136
+ ### Reputation
137
+
138
+ Reputation unlocks licenses and earns you titles. Earn it through gameplay:
139
+
140
+ | Action | Rep Change |
141
+ |--------|------------|
142
+ | Deliver a shipment | +5 |
143
+ | Complete a contract | +10 |
144
+ | Deliver supply to zone | +2 |
145
+ | Capture a zone | +25 |
146
+ | Shipment intercepted | -10 |
147
+ | Fail a contract | -20 |
148
+
149
+ ### Zone Efficiency
150
+ Well-supplied zones gain battlefield bonuses. Supply states:
151
+
152
+ | State | Condition | Effects |
153
+ |-------|-----------|---------|
154
+ | Fortified | 100% supply + 50-tick streak | +50% raid resist, +50% capture defense, +10% production |
155
+ | Supplied | 100% supply | Baseline |
156
+ | Strained | 50-99% supply | -25% raid resist, -25% capture defense |
157
+ | Critical | 1-49% supply | -50% raid resist, -75% capture defense |
158
+ | Collapsed | 0% supply | No defense — zone becomes capturable |
159
+
160
+ **Stockpiles** boost zone defense further:
161
+ - **Medkits**: Deposit to zone → boosts escort strength in combat (up to +50%). Decays 1 per 10 ticks.
162
+ - **Comms**: Deposit to zone → degrades enemy scan quality (up to -50%). Decays 1 per 20 ticks.
163
+
164
+ Compliance streaks (consecutive ticks at 100% supply) grant additional bonuses at 50, 200, and 500 ticks.
165
+
166
+ ### Seasons
167
+ The game runs in seasons (4 weeks each). Earn points through:
168
+ - Controlling zones (100 pts/zone/week)
169
+ - Completing shipments (10 pts each)
170
+ - Fulfilling contracts (25 pts each)
171
+ - Delivering supplies (1 pt per SU)
172
+ - Winning combat (50 pts per victory)
173
+ - Gaining reputation (2 pts per rep point)
174
+
175
+ **Season reset**: When a season ends, scores are archived. Zones reset to neutral, inventories reset to 500 credits, reputation halves. Accounts, licenses, and faction identities persist.
176
+
177
+ ### Doctrines
178
+ Factions can create strategy documents stored server-side. Officers and founders write doctrines to coordinate members — convoy rules, zone defense protocols, market strategies. Visible to all faction members.
179
+
180
+ ### Advanced Market Orders
181
+ Beyond basic buy/sell orders, higher tiers unlock automation:
182
+ - **Conditional Orders** (Operator+) — Trigger when a resource price crosses a threshold. "Buy ore if price drops below 10."
183
+ - **Time-Weighted Orders** (Command) — Drip-feed large orders across ticks to avoid moving the market. "Sell 1000 metal over 50 ticks."
184
+
185
+ ### Webhooks
186
+ Operator+ players can register HTTPS webhooks to receive real-time notifications for game events — shipment arrivals, zone collapses, combat results. Webhooks auto-disable after 5 consecutive failures.
187
+
188
+ ### Data Export & Batch Operations
189
+ - **Export** (`burnrate_export`) — Bulk download of all your game data: player info, units, shipments, contracts, intel, and event history.
190
+ - **Batch** (`burnrate_batch`) — Execute up to 10 game actions in a single call. Each action is still individually rate-limited.
191
+
192
+ ### Faction Analytics
193
+ - **Analytics** (Operator+, officer+) — Member activity, zone control summary, and resource flow tracking from audit logs.
194
+ - **Audit Logs** (Command) — Full history of all faction member actions for accountability and coordination.
195
+
196
+ ## MCP Tools Reference
197
+
198
+ ### Status & Navigation
199
+ | Tool | Description |
200
+ |------|-------------|
201
+ | `burnrate_status` | Your current status, inventory, location |
202
+ | `burnrate_view` | World map or specific zone details |
203
+ | `burnrate_routes` | Available routes from location |
204
+ | `burnrate_travel` | Move to an adjacent zone |
205
+
206
+ ### Economy
207
+ | Tool | Description |
208
+ |------|-------------|
209
+ | `burnrate_extract` | Gather raw resources at Fields (5cr/unit) |
210
+ | `burnrate_produce` | Convert resources at Factories |
211
+ | `burnrate_ship` | Send cargo along a route |
212
+ | `burnrate_shipments` | View active shipments |
213
+ | `burnrate_market_buy` | Place buy order |
214
+ | `burnrate_market_sell` | Place sell order |
215
+ | `burnrate_market_view` | View market orders |
216
+
217
+ ### Military
218
+ | Tool | Description |
219
+ |------|-------------|
220
+ | `burnrate_units` | List your military units |
221
+ | `burnrate_units_escort` | Assign escort to protect shipment |
222
+ | `burnrate_units_raider` | Deploy raider to interdict route |
223
+ | `burnrate_units_sell` | List unit for sale |
224
+ | `burnrate_hire` | Purchase a unit |
225
+
226
+ ### Intelligence
227
+ | Tool | Description |
228
+ |------|-------------|
229
+ | `burnrate_scan` | Gather intel on zone/route |
230
+ | `burnrate_intel` | View your intel with freshness |
231
+ | `burnrate_intel_target` | Get intel on specific target |
232
+
233
+ ### Territory
234
+ | Tool | Description |
235
+ |------|-------------|
236
+ | `burnrate_supply` | Deposit Supply Units to zone |
237
+ | `burnrate_capture` | Capture neutral/collapsed zone |
238
+ | `burnrate_stockpile` | Deposit medkits/comms to zone stockpile |
239
+ | `burnrate_zone_efficiency` | View zone bonuses (raid resistance, production, etc.) |
240
+
241
+ ### Factions
242
+ | Tool | Description |
243
+ |------|-------------|
244
+ | `burnrate_factions` | List all factions |
245
+ | `burnrate_faction_create` | Create new faction |
246
+ | `burnrate_faction_join` | Join existing faction |
247
+ | `burnrate_faction_leave` | Leave current faction |
248
+ | `burnrate_faction_details` | Your faction info |
249
+ | `burnrate_faction_intel` | Shared faction intelligence |
250
+ | `burnrate_faction_promote` | Promote member to officer |
251
+ | `burnrate_faction_demote` | Demote officer to member |
252
+ | `burnrate_faction_kick` | Remove member from faction |
253
+ | `burnrate_faction_transfer` | Transfer leadership |
254
+ | `burnrate_treasury_deposit` | Add resources to treasury |
255
+ | `burnrate_treasury_withdraw` | Take resources from treasury |
256
+
257
+ ### Contracts
258
+ | Tool | Description |
259
+ |------|-------------|
260
+ | `burnrate_contracts` | View available contracts |
261
+ | `burnrate_contracts_mine` | Your posted/accepted contracts |
262
+ | `burnrate_contract_create` | Post a new contract |
263
+ | `burnrate_contract_accept` | Accept a contract |
264
+ | `burnrate_contract_complete` | Complete and claim reward |
265
+ | `burnrate_contract_cancel` | Cancel unaccepted contract |
266
+
267
+ ### Progression
268
+ | Tool | Description |
269
+ |------|-------------|
270
+ | `burnrate_reputation` | Your reputation score and title |
271
+ | `burnrate_licenses` | License status and requirements |
272
+ | `burnrate_license_unlock` | Unlock freight or convoy license |
273
+ | `burnrate_events` | Your event history |
274
+ | `burnrate_tutorial` | View tutorial progress and current step |
275
+ | `burnrate_tutorial_complete` | Complete a tutorial step and receive rewards |
276
+
277
+ ### Seasons & Leaderboards
278
+ | Tool | Description |
279
+ |------|-------------|
280
+ | `burnrate_season` | Current season info |
281
+ | `burnrate_leaderboard` | Season rankings |
282
+ | `burnrate_season_score` | Your season score |
283
+
284
+ ### Doctrines
285
+ | Tool | Description |
286
+ |------|-------------|
287
+ | `burnrate_doctrines` | View faction strategy documents |
288
+ | `burnrate_doctrine_create` | Create a new doctrine (officer+) |
289
+ | `burnrate_doctrine_update` | Update an existing doctrine (officer+) |
290
+ | `burnrate_doctrine_delete` | Delete a doctrine (officer+) |
291
+
292
+ ### Advanced Market Orders
293
+ | Tool | Description |
294
+ |------|-------------|
295
+ | `burnrate_market_conditional` | Conditional order — triggers on price threshold (Operator+) |
296
+ | `burnrate_market_twap` | Time-weighted order — drip-feeds quantity per tick (Command) |
297
+
298
+ ### Webhooks & Automation
299
+ | Tool | Description |
300
+ |------|-------------|
301
+ | `burnrate_webhooks` | List your registered webhooks |
302
+ | `burnrate_webhook_register` | Register a webhook for game events (Operator+) |
303
+ | `burnrate_webhook_delete` | Delete a webhook |
304
+ | `burnrate_export` | Export all your game data |
305
+ | `burnrate_batch` | Execute multiple actions in one call (max 10) |
306
+
307
+ ### Faction Analytics
308
+ | Tool | Description |
309
+ |------|-------------|
310
+ | `burnrate_faction_analytics` | Member activity, zone control, resource flows (Operator+) |
311
+ | `burnrate_faction_audit` | Full audit logs of faction actions (Command) |
312
+
313
+ ### Account
314
+ | Tool | Description |
315
+ |------|-------------|
316
+ | `burnrate_subscription` | View your subscription tier and limits |
317
+
318
+ ## MCP Resources
319
+
320
+ Access these as read-only data sources:
321
+
322
+ | Resource URI | Description |
323
+ |--------------|-------------|
324
+ | `burnrate://status` | Player status and inventory |
325
+ | `burnrate://world` | World state (tick, season) |
326
+ | `burnrate://zones` | All zones with controllers |
327
+ | `burnrate://routes` | Routes from current location |
328
+ | `burnrate://shipments` | Active shipments |
329
+ | `burnrate://units` | Military units |
330
+ | `burnrate://market` | Current market orders |
331
+ | `burnrate://contracts` | Available contracts |
332
+ | `burnrate://intel` | Intel reports with freshness |
333
+ | `burnrate://faction` | Faction details |
334
+ | `burnrate://leaderboard` | Season rankings |
335
+ | `burnrate://reputation` | Reputation progress |
336
+ | `burnrate://licenses` | License status |
337
+
338
+ ## Building Your Edge
339
+
340
+ The game provides basic tools. Your competitive advantage comes from what you build on top.
341
+
342
+ ### MCP Prompts (Starting Points)
343
+
344
+ These built-in prompts are intentionally simple—templates to get you started:
345
+
346
+ | Prompt | What it does |
347
+ |--------|--------------|
348
+ | `situation_analysis` | Pulls your status, shipments, units, and intel; asks Claude to suggest priorities |
349
+ | `route_planning` | Gathers route and zone data; asks for safe/profitable route recommendations |
350
+ | `threat_assessment` | Filters intel for a target; asks for threat level analysis |
351
+ | `trade_opportunities` | Pulls market orders; asks for arbitrage opportunities |
352
+ | `mission_briefing` | Provides context for a mission type; asks for execution plan |
353
+ | `faction_strategy` | Gathers faction and territory data; asks for strategic recommendations |
354
+ | `season_progress` | Pulls leaderboard and score; asks how to climb rankings |
355
+ | `game_overview` | Teaches game mechanics to new players; walks through getting started |
356
+
357
+ These prompts do basic data gathering and ask Claude for analysis. They're meant to be **outgrown**. The real game is building better versions.
358
+
359
+ ### Ideas for Custom Tools
360
+
361
+ - **Pathfinder** - Only direct routes are shown. Build multi-hop optimization.
362
+ - **Market Scanner** - Spot arbitrage opportunities across zones, track price history.
363
+ - **Supply Chain Optimizer** - Automate extraction → production → delivery pipelines.
364
+ - **Intel Aggregator** - Track zone states over time, predict collapses before they happen.
365
+ - **Risk Analyzer** - Model raider activity patterns, calculate route safety scores.
366
+ - **Faction Coordinator** - Orchestrate multi-player logistics, assign zones to members.
367
+ - **Contract Optimizer** - Find contracts that align with routes you're already running.
368
+
369
+ ## Production Recipes
370
+
371
+ ### Resources
372
+ | Output | Inputs | Purpose |
373
+ |--------|--------|---------|
374
+ | metal | 2 ore + 1 fuel | Units, parts, ammo, comms |
375
+ | chemicals | 1 ore + 2 fuel | Rations, textiles, ammo, comms |
376
+ | rations | 3 grain + 1 fuel | Escorts, Supply Units |
377
+ | textiles | 2 fiber + 1 chemicals | Medkits, parts |
378
+ | ammo | 1 metal + 1 chemicals | Supply Units |
379
+ | medkits | 1 chemicals + 1 textiles | Zone stockpile (combat bonus) |
380
+ | parts | 1 metal + 1 textiles | Units, Supply Units, comms |
381
+ | comms | 1 metal + 1 chemicals + 1 parts | Raiders, zone stockpile (intel defense) |
382
+
383
+ ### Units
384
+ | Unit | Inputs | Stats | Role |
385
+ |------|--------|-------|------|
386
+ | escort | 2 metal + 1 parts + 1 rations | str:10, maint:5/tick | Protect shipments |
387
+ | raider | 2 metal + 2 parts + 1 comms | str:15, maint:8/tick | Interdict routes |
388
+
389
+ ### Supply Units
390
+ | Output | Inputs |
391
+ |--------|--------|
392
+ | 1 SU | 2 rations + 1 fuel + 1 parts + 1 ammo |
393
+
394
+ ## Progression
395
+
396
+ ### Shipment Licenses
397
+
398
+ | License | Rep Required | Cost | Capacity |
399
+ |---------|--------------|------|----------|
400
+ | Courier | 0 | Free | Small cargo |
401
+ | Freight | 50 | 500cr | Medium cargo |
402
+ | Convoy | 200 | 2000cr | Heavy armored |
403
+
404
+ ### Reputation Titles
405
+
406
+ | Reputation | Title |
407
+ |------------|-------|
408
+ | 0+ | Unknown |
409
+ | 25+ | Novice |
410
+ | 75+ | Runner |
411
+ | 150+ | Hauler |
412
+ | 300+ | Veteran |
413
+ | 500+ | Elite |
414
+ | 750+ | Master |
415
+ | 1000 | Legend |
416
+
417
+ ### Subscription Tiers
418
+
419
+ All players get the same core gameplay. Paid tiers unlock collaboration, analytics, and discovery.
420
+
421
+ | Feature | Freelance | Operator | Command |
422
+ |---------|-----------|----------|---------|
423
+ | **Gameplay** |
424
+ | Actions/day | 200 | 250 | 300 |
425
+ | Market orders | 5 | 10 | 20 |
426
+ | Active contracts | 3 | 10 | 25 |
427
+ | **Analytics** |
428
+ | Event history | 200 | 10,000 | 100,000 |
429
+ | Market analytics | - | Basic | Advanced |
430
+ | **Factions** |
431
+ | Join factions | ✓ | ✓ | ✓ |
432
+ | Create factions | ✓ | ✓ | ✓ |
433
+ | Faction analytics | - | ✓ | ✓ |
434
+ | Audit logs | - | - | ✓ |
435
+ | **Templates** |
436
+ | Browse community templates | ✓ | ✓ | ✓ |
437
+ | One-click import | - | ✓ | ✓ |
438
+ | Publish templates | - | ✓ | ✓ |
439
+ | Featured placement | - | - | ✓ |
440
+ | **Market** |
441
+ | Basic orders | ✓ | ✓ | ✓ |
442
+ | Conditional orders | - | ✓ | ✓ |
443
+ | Time-weighted orders | - | - | ✓ |
444
+
445
+ ## Self-Hosting (Optional)
446
+
447
+ Most players connect to the official server. Run your own if you want to:
448
+
449
+ - **Test strategies** without affecting your main account
450
+ - **Develop custom tools** with fast ticks (1 second instead of 10 minutes)
451
+ - **Host a private server** for your group
452
+ - **Contribute** to the game's development
453
+
454
+ ### Running Locally
455
+
456
+ ```bash
457
+ # Build
458
+ npm run build
459
+
460
+ # Start API server (default port 3000)
461
+ npm run server
462
+
463
+ # Start with fast ticks for testing (1 second)
464
+ npm run server:fast
465
+
466
+ # Initialize the world (first time only)
467
+ curl -X POST http://localhost:3000/admin/init-world -H "X-Admin-Key: your-admin-key"
468
+ ```
469
+
470
+ ### Environment Variables
471
+
472
+ ```bash
473
+ # API Server
474
+ PORT=3000 # Server port
475
+ TURSO_URL=file:game.db # Database (local file or Turso URL)
476
+ TURSO_AUTH_TOKEN= # Turso auth token (for remote DB)
477
+ TICK_INTERVAL=600000 # Tick interval in ms (10 min default)
478
+ ADMIN_KEY=your-secret # Admin API key
479
+ ALLOWED_ORIGINS= # Comma-separated CORS origins (empty = allow all)
480
+
481
+ # MCP Server (point to your local server)
482
+ BURNRATE_API_URL=http://localhost:3000
483
+ BURNRATE_API_KEY=your-api-key
484
+ ```
485
+
486
+ ### Admin Dashboard
487
+
488
+ Monitor your server with the admin API (requires `ADMIN_KEY`):
489
+
490
+ ```bash
491
+ # Server overview: player counts, zone health, faction summary
492
+ curl -H "X-Admin-Key: your-secret" http://localhost:3000/admin/dashboard
493
+
494
+ # Player list (sortable by reputation, credits, activity, name)
495
+ curl -H "X-Admin-Key: your-secret" http://localhost:3000/admin/players?sort=activity
496
+
497
+ # Recent game events
498
+ curl -H "X-Admin-Key: your-secret" http://localhost:3000/admin/activity?limit=50
499
+ ```
500
+
501
+ ## License
502
+
503
+ MIT
504
+
505
+ ---
506
+
507
+ **BURNRATE** | A Claude Code game
@@ -0,0 +1,13 @@
1
+ /**
2
+ * BURNRATE CLI Formatting
3
+ * Terminal-native visual output
4
+ */
5
+ import { GameDatabase } from '../db/database.js';
6
+ import { Zone, Player, Shipment, GameEvent } from '../core/types.js';
7
+ export declare function formatView(db: GameDatabase, player: Player): string;
8
+ export declare function formatZone(db: GameDatabase, zone: Zone): string;
9
+ export declare function formatRoutes(db: GameDatabase, fromZoneId: string): string;
10
+ export declare function formatMarket(db: GameDatabase, zoneId: string, resource?: string): string;
11
+ export declare function formatShipments(shipments: Shipment[]): string;
12
+ export declare function formatEvents(events: GameEvent[]): string;
13
+ export declare function formatHelp(): string;