rentline-sandbox 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ Rentline Sandbox SDK License Agreement
2
+ Version 1.0 — May 2026
3
+
4
+ Copyright (c) 2026 ChainSettle Inc. All rights reserved.
5
+
6
+ 1. Permission of Use
7
+ Permission is granted to use this SDK solely for integration with Rentline Sandbox
8
+ APIs and services provided by ChainSettle Inc. and its affiliates.
9
+
10
+ 2. Restrictions
11
+ You may not:
12
+
13
+ - Copy, fork, or redistribute this software or any derivative work.
14
+ - Use the SDK to build, host, or offer a competing service.
15
+ - Modify, reverse engineer, or decompile the SDK, except as required for legitimate
16
+ integration purposes.
17
+ - Re-host, rebrand, or re-publish this SDK (including on GitHub, npm, PyPI, or any
18
+ equivalent platform) without prior written consent from ChainSettle Inc.
19
+
20
+ 3. Ownership and Intellectual Property
21
+ This license does not grant ownership rights or any implied license. ChainSettle Inc.
22
+ retains all intellectual property rights in this software, including source code,
23
+ binaries, documentation, and related assets.
24
+
25
+ 4. Enforcement
26
+ Unauthorized use, redistribution, or publication of this software may result in
27
+ immediate termination of access and legal action under applicable copyright and
28
+ intellectual property laws.
29
+
30
+ 5. Commercial or Enterprise Use
31
+ For commercial licensing, redistribution rights, or enterprise use, please contact:
32
+ legal@chainsettle.com
33
+
34
+ © 2026 ChainSettle Inc. All Rights Reserved.
package/README.md ADDED
@@ -0,0 +1,287 @@
1
+ # rentline-sandbox
2
+
3
+ CLI and MCP server for the [Rentline Sandbox](https://sandbox.rentline.xyz) — a turn-based real estate investment simulation game engine.
4
+
5
+ Players compete over tokenised properties using mortgages, Fed rate cycles, macro events, property condition grades (A–F), PACE liens, and investor tiers. Playable by humans via the CLI, or fully autonomously by AI agents via the MCP server.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g rentline-sandbox
13
+ ```
14
+
15
+ Two binaries are installed:
16
+ - `sandbox` — human CLI
17
+ - `sandbox-mcp` — MCP server for AI agents (stdio JSON-RPC)
18
+
19
+ Requires Node.js ≥ 18.
20
+
21
+ ---
22
+
23
+ ## Authentication
24
+
25
+ ### Browser login (recommended)
26
+ ```bash
27
+ sandbox auth login
28
+ # Opens sandbox.rentline.xyz/cli-auth in your browser
29
+ # Sign in, copy the generated sb_ key, paste it back
30
+ ```
31
+
32
+ ### Direct key
33
+ ```bash
34
+ sandbox auth login --key sb_xxxx --url https://sandbox-api.rentline.xyz
35
+ ```
36
+
37
+ ### Check status
38
+ ```bash
39
+ sandbox auth whoami # shows key prefix, API URL, and connectivity
40
+ sandbox auth logout # remove saved credentials
41
+ ```
42
+
43
+ Credentials are saved to `~/.rentline-sandbox/credentials.json` and used automatically by all CLI commands.
44
+
45
+ ---
46
+
47
+ ## CLI usage
48
+
49
+ ### Game management
50
+ ```bash
51
+ sandbox game list
52
+ sandbox game get <game-id>
53
+ sandbox game create --name "Test" --display-name "Alice"
54
+ sandbox game create --preset standard --name "Quick Match" --display-name "Alice"
55
+ sandbox game join <game-id> --invite <code> --display-name "Bob"
56
+ sandbox game ready <game-id>
57
+ sandbox game advance <game-id>
58
+ sandbox game feed <game-id> [--turn 3] [--limit 50]
59
+ sandbox game leaderboard <game-id>
60
+ sandbox game fed <game-id>
61
+ sandbox game add-bot <game-id> --name "AggroBot" --strategy aggressive
62
+ sandbox game autonomous start <game-id> --delay 30
63
+ sandbox game autonomous stop <game-id>
64
+ ```
65
+
66
+ ### Trading
67
+ ```bash
68
+ sandbox trade buy <game-id> --property <id> --tokens 0.5
69
+ sandbox trade sell <game-id> --property <id> --tokens 0.5
70
+ ```
71
+
72
+ ### Portfolio and debt
73
+ ```bash
74
+ sandbox portfolio <game-id> <player-id>
75
+ sandbox debt <game-id> <player-id>
76
+ ```
77
+
78
+ ### Mortgage
79
+ ```bash
80
+ sandbox mortgage buy <game-id> --property <id> --tokens 0.5
81
+ sandbox mortgage refi <game-id> --property <id> [--cash-out 5000]
82
+ sandbox mortgage heloc <game-id> --property <id> --draw 5000
83
+ sandbox mortgage repay <game-id> --property <id> --amount 2000
84
+ sandbox mortgage prepay <game-id> --property <id> --amount 10000 [--type first_lien]
85
+ sandbox mortgage improve <game-id> --property <id> --grade B
86
+ sandbox mortgage pace <game-id> --property <id> --grade C
87
+ sandbox mortgage list <game-id> <player-id>
88
+ ```
89
+
90
+ ### Admin
91
+ ```bash
92
+ sandbox admin properties list
93
+ sandbox admin properties sync
94
+ sandbox admin mint <game-id> <player-id> --amount 50000
95
+ ```
96
+
97
+ ---
98
+
99
+ ## MCP server setup
100
+
101
+ The `sandbox-mcp` command runs an MCP server over stdio JSON-RPC. Configure it once in your AI client.
102
+
103
+ ### OpenCode (`opencode.json`)
104
+ ```json
105
+ {
106
+ "$schema": "https://opencode.ai/config.json",
107
+ "mcp": {
108
+ "rentline-sandbox": {
109
+ "type": "local",
110
+ "command": ["sandbox-mcp"],
111
+ "enabled": true,
112
+ "environment": {
113
+ "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz",
114
+ "SANDBOX_API_KEY": "sb_your_key_here"
115
+ }
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### Claude Desktop (`claude_desktop_config.json`)
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "rentline-sandbox": {
126
+ "command": "sandbox-mcp",
127
+ "env": {
128
+ "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz",
129
+ "SANDBOX_API_KEY": "sb_your_key_here"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ### Cursor / Windsurf
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "rentline-sandbox": {
141
+ "command": "sandbox-mcp",
142
+ "env": {
143
+ "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz",
144
+ "SANDBOX_API_KEY": "sb_your_key_here"
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ---
152
+
153
+ ## MCP tools (35 total)
154
+
155
+ ### Game management
156
+ | Tool | Description |
157
+ |---|---|
158
+ | `list_games` | All open game rooms |
159
+ | `get_game` | Full game state: players, properties, turn, Fed rate, settings |
160
+ | `create_game` | Create with full config + optional bots array |
161
+ | `create_game_from_preset` | One-call presets: `quick` `standard` `leveraged` `distressed` `long_run` |
162
+ | `join_game` | Join with invite code |
163
+ | `mark_ready` | Toggle ready state |
164
+ | `advance_turn` | Run all engine phases (host only) |
165
+ | `get_feed` | Event stream: Fed, macro, rent, price moves, debt service, turn summary |
166
+ | `add_bot` | Add LLM bot (strategies: `aggressive` `conservative` `balanced` `momentum` `income` `value_add`) |
167
+ | `remove_bot` | Remove bot from lobby |
168
+ | `start_autonomous` | Enable auto-advance (advances on all-ready or turn deadline) |
169
+ | `stop_autonomous` | Pause auto-advance |
170
+ | `set_delegate` | Agent delegation for idle human players |
171
+ | `spectate` | Public game snapshot (no auth) |
172
+
173
+ ### Market & Intel
174
+ | Tool | Description |
175
+ |---|---|
176
+ | `list_properties` | Active pool properties with grades |
177
+ | `get_market_summary` | Live cap rates, price deltas, grade, vacancy, mechanics lien status |
178
+ | `get_fed_history` | FOMC decision log |
179
+ | `get_player_actions` | Transaction timeline for a player |
180
+
181
+ ### Trading
182
+ | Tool | Description |
183
+ |---|---|
184
+ | `buy_tokens` | All-cash purchase at current market price |
185
+ | `sell_tokens` | Sell (proceeds service mechanics lien → first lien → HELOC/PACE before cash) |
186
+
187
+ ### Debt
188
+ | Tool | Description |
189
+ |---|---|
190
+ | `originate_mortgage` | Leveraged buy (tier-adjusted LTV and rate auto-applied) |
191
+ | `refi_mortgage` | Rate-and-term or cash-out refi |
192
+ | `heloc_draw` | Draw from HELOC |
193
+ | `heloc_repay` | Repay HELOC balance |
194
+ | `prepay_principal` | Partial/full prepayment (first_lien, heloc, pace, mechanics_lien) |
195
+ | `improve_property` | Cash-funded grade upgrade (cost = steps × 8% × price) |
196
+ | `originate_pace_lien` | Financed grade upgrade — no down payment (rate = base + 1.5%) |
197
+ | `get_debt` | All active mortgages: balance, rate, LTV, arrears |
198
+
199
+ ### Portfolio
200
+ | Tool | Description |
201
+ |---|---|
202
+ | `get_portfolio` | Holdings with grade, P&L, annualised yield, turns held, investor tier |
203
+ | `get_leaderboard` | Game leaderboard or global all-time rankings |
204
+
205
+ ---
206
+
207
+ ## Game mechanics summary
208
+
209
+ ### Turn phases (in order)
210
+ 1. **Fed meeting** — hike/cut/hold; `FED_WARNING` fires 1 turn before; ARMs reprice immediately
211
+ 2. **Macro events** — rate macros activate after 1-turn warning; active macros tick down
212
+ 3. **Rent collect** — proportional to tokens held; grade multipliers applied; vacancy blocks
213
+ 4. **Random events** — vacancy, lease renewal, capex, appreciation/depreciation (all grade-adjusted)
214
+ 5. **Market move** — applies price drift
215
+ 6. **Debt service** — collect payments; forced sale after 1 grace turn
216
+ 7. **Distribute** — credits rent; emits `TURN_SUMMARY` event
217
+
218
+ ### Property grades (A → F)
219
+ Grade affects rent multiplier, appreciation probability, capex risk, and vacancy rate. Upgrade mid-game with `improve_property` (cash) or `originate_pace_lien` (financed). The `GENTRIFICATION` macro can upgrade D/F properties automatically.
220
+
221
+ ### Investor tiers
222
+ Computed live from NAV — automatically applied to every mortgage origination and refi:
223
+
224
+ | Tier | Min NAV | LTV bonus | Rate discount |
225
+ |---|---|---|---|
226
+ | Retail | $0 | +0% | 0 bps |
227
+ | Accredited | $100k | +5% | −25 bps |
228
+ | Professional | $500k | +10% | −50 bps |
229
+ | Institutional | $2.5M | +15% | −75 bps |
230
+ | Developer | $25M | +20% | −100 bps |
231
+
232
+ ### NAV formula
233
+ ```
234
+ NAV = cash + Σ(tokens × price) − Σ(active mortgage balances) − judgment_balance
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Configuration
240
+
241
+ | Env var | Description |
242
+ |---|---|
243
+ | `SANDBOX_API_URL` | API base URL (default: `https://sandbox-api.rentline.xyz`) |
244
+ | `SANDBOX_API_KEY` | Your `sb_` key (MCP server only — CLI uses credentials file) |
245
+
246
+ ---
247
+
248
+ ## Development
249
+
250
+ ```bash
251
+ npm install
252
+ npm run build # compile TypeScript → dist/
253
+ npm run dev # watch mode
254
+ node dist/index.js game list # test without npm link
255
+ ```
256
+
257
+ ### Project structure
258
+ ```
259
+ src/
260
+ index.ts CLI entry point
261
+ server.ts MCP server (35 tools, stdio JSON-RPC)
262
+ tools.ts Tool definitions + input schemas
263
+ client.ts Typed HTTP client
264
+ config.ts Credential persistence
265
+ commands/ auth, game, trade, mortgage, admin
266
+ dist/ Compiled output
267
+ SKILL.md MCP skill manifest
268
+ llms.txt Condensed reference for LLM context windows
269
+ ```
270
+
271
+ ### Adding a new tool
272
+ 1. Add a `ToolDef` in `src/tools.ts`
273
+ 2. Add a `case` in the `switch` in `src/server.ts`
274
+ 3. Add the client method in `src/client.ts`
275
+ 4. `npm run build`
276
+
277
+ ---
278
+
279
+ ## Links
280
+
281
+ - Web app: [sandbox.rentline.xyz](https://sandbox.rentline.xyz)
282
+ - API docs: [sandbox-api.rentline.xyz/docs](https://sandbox-api.rentline.xyz/docs)
283
+ - Get an API key: [sandbox.rentline.xyz/cli-auth](https://sandbox.rentline.xyz/cli-auth)
284
+ - Source: [github.com/BrandynHamilton/rentline-sandbox](https://github.com/BrandynHamilton/rentline-sandbox)
285
+
286
+
287
+ ---
package/SKILL.md ADDED
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: rentline-sandbox
3
+ description: |
4
+ Rentline Sandbox is a turn-based real estate investment simulation game engine.
5
+ Players compete over tokenised properties using simulated tUSDC, with mortgages,
6
+ Fed rate cycles, macro events, property condition grades (A-F), PACE liens, and
7
+ investor tiers reflecting real market dynamics. Use these tools to play, observe,
8
+ and analyse games.
9
+ TRIGGERS: sandbox game, real estate simulation, property tokens, buy property tokens,
10
+ sell property tokens, originate mortgage, HELOC, cash-out refi, game leaderboard,
11
+ advance turn, Fed rate, macro event, recession event, portfolio NAV, debt service,
12
+ ARM rate, game feed, turn event, leveraged real estate, property investment game,
13
+ PACE lien, property grade, improve property, value add, investor tier
14
+ license: SEE LICENSE IN LICENSE
15
+ compatibility: opencode
16
+ ---
17
+
18
+ # Rentline Sandbox
19
+
20
+ Turn-based real estate investment simulation — multiplayer, AI-agent-ready.
21
+
22
+ ## Setup
23
+
24
+ Get an API key at **sandbox.rentline.xyz/cli-auth**, then configure your client:
25
+
26
+ **OpenCode** (`opencode.json`):
27
+ ```json
28
+ {
29
+ "$schema": "https://opencode.ai/config.json",
30
+ "mcp": {
31
+ "rentline-sandbox": {
32
+ "type": "local",
33
+ "command": ["sandbox-mcp"],
34
+ "enabled": true,
35
+ "environment": {
36
+ "SANDBOX_API_KEY": "sb_your_key_here",
37
+ "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz"
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ **Claude Desktop** (`claude_desktop_config.json`):
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "rentline-sandbox": {
49
+ "command": "sandbox-mcp",
50
+ "env": {
51
+ "SANDBOX_API_KEY": "sb_your_key_here",
52
+ "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ **Cursor / Windsurf**:
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "rentline-sandbox": {
64
+ "command": "sandbox-mcp",
65
+ "env": { "SANDBOX_API_KEY": "sb_your_key_here", "SANDBOX_API_URL": "https://sandbox-api.rentline.xyz" }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ **CLI login** (saves credentials locally):
72
+ ```bash
73
+ sandbox auth login # browser OAuth via sandbox.rentline.xyz/cli-auth
74
+ sandbox auth login --key sb_xxx # direct key
75
+ sandbox auth whoami # verify
76
+ ```
77
+
78
+ ## CLI usage
79
+
80
+ ```bash
81
+ sandbox game list
82
+ sandbox game create --name "Test" --display-name "Alice"
83
+ sandbox game create --preset standard --name "Quick Match" --display-name "Alice"
84
+ sandbox game join <id> --invite A3F7K9Z2 --name "Bob"
85
+ sandbox game advance <id>
86
+ sandbox game feed <id> --limit 20
87
+ sandbox game leaderboard <id>
88
+ sandbox game fed <id>
89
+ sandbox game add-bot <id> --name "AggroBot" --strategy value_add
90
+ sandbox game autonomous start <id> --delay 30
91
+
92
+ sandbox trade buy <game-id> --property <id> --tokens 0.5
93
+ sandbox trade sell <game-id> --property <id> --tokens 0.5
94
+
95
+ sandbox portfolio <game-id> <player-id>
96
+ sandbox debt <game-id> <player-id>
97
+
98
+ sandbox mortgage buy <game-id> --property <id> --tokens 0.5
99
+ sandbox mortgage refi <game-id> --property <id> --cash-out 5000
100
+ sandbox mortgage heloc <game-id> --property <id> --draw 5000
101
+ sandbox mortgage repay <game-id> --property <id> --amount 2000
102
+ sandbox mortgage prepay <game-id> --property <id> --amount 10000
103
+ sandbox mortgage improve <game-id> --property <id> --grade B
104
+ sandbox mortgage pace <game-id> --property <id> --grade C
105
+ sandbox mortgage list <game-id> <player-id>
106
+
107
+ sandbox admin properties list
108
+ sandbox admin properties sync
109
+ sandbox admin mint <game-id> <player-id> --amount 50000
110
+ ```
111
+
112
+ ## Tool reference (35 tools)
113
+
114
+ ### Game management
115
+ | Tool | Description |
116
+ |---|---|
117
+ | `list_games` | List open game rooms |
118
+ | `get_game` | Full game state: players, properties, turn, Fed rate, config |
119
+ | `create_game` | Create a game with full mortgage/Fed/grade config + optional bots |
120
+ | `create_game_from_preset` | One-call presets: quick, standard, leveraged, distressed, long_run |
121
+ | `join_game` | Join via invite code, get player_id |
122
+ | `mark_ready` | Toggle ready for next turn |
123
+ | `advance_turn` | Host: run all 7 engine phases |
124
+ | `get_feed` | Turn event stream: Fed, macro, rent, price moves, debt service, turn summary |
125
+ | `add_bot` | Add LLM bot (strategies: aggressive, conservative, balanced, momentum, income, value_add) |
126
+ | `remove_bot` | Remove bot from lobby |
127
+ | `start_autonomous` | Enable auto-advance (all-ready or deadline triggers) |
128
+ | `stop_autonomous` | Pause auto-advance |
129
+ | `set_delegate` | Agent delegation for idle human players |
130
+ | `spectate` | Public game snapshot (no auth) |
131
+
132
+ ### Market & Intel
133
+ | Tool | Description |
134
+ |---|---|
135
+ | `list_properties` | Active pool properties with grades |
136
+ | `get_market_summary` | Live cap rates, price deltas, grade, vacancy, mechanics lien status |
137
+ | `get_fed_history` | FOMC decision log |
138
+ | `get_player_actions` | Transaction timeline for a player |
139
+
140
+ ### Trading
141
+ | Tool | Description |
142
+ |---|---|
143
+ | `buy_tokens` | All-cash purchase at current market price |
144
+ | `sell_tokens` | Sell (proceeds service mechanics lien → first lien → HELOC/PACE before cash) |
145
+
146
+ ### Debt
147
+ | Tool | Description |
148
+ |---|---|
149
+ | `originate_mortgage` | Leveraged buy (tier-adjusted LTV and rate auto-applied) |
150
+ | `refi_mortgage` | Rate-and-term or cash-out refi |
151
+ | `heloc_draw` | Draw from HELOC |
152
+ | `heloc_repay` | Repay HELOC balance |
153
+ | `prepay_principal` | Partial/full prepayment (first_lien, heloc, pace, mechanics_lien) |
154
+ | `improve_property` | Cash-funded grade upgrade (cost = steps × 8% × price) |
155
+ | `originate_pace_lien` | Financed grade upgrade — no down payment (rate = base + 1.5%) |
156
+ | `get_debt` | All mortgages: balances, rates, LTV, arrears |
157
+
158
+ ### Portfolio
159
+ | Tool | Description |
160
+ |---|---|
161
+ | `get_portfolio` | Holdings with grade, P&L, annualised yield, turns held, investor tier |
162
+ | `get_leaderboard` | Game or global leaderboard ranked by NAV |
163
+
164
+ ## Game mechanics
165
+
166
+ ### Turn phases (in order)
167
+ 1. **Fed meeting** — hike/cut/hold; `FED_WARNING` fires 1 turn before; ARMs reprice immediately
168
+ 2. **Macro events** — rate macros activate after 1-turn warning; active macros tick down
169
+ 3. **Rent collect** — proportional to tokens; grade multipliers applied; vacancy blocks
170
+ 4. **Random events** — vacancy, lease renewal, capex, appreciation/depreciation (grade-adjusted)
171
+ 5. **Market move** — applies price drift
172
+ 6. **Debt service** — collect payments; forced sale after 1 grace turn
173
+ 7. **Distribute** — credits rent; emits `TURN_SUMMARY` event
174
+
175
+ ### Property grades (A → F)
176
+ Grade affects rent multiplier, appreciation probability, capex risk, vacancy rate.
177
+ Upgrade via `improve_property` (cash) or `originate_pace_lien` (financed, no down payment).
178
+
179
+ ### Investor tiers (live from NAV, auto-applied to mortgage terms)
180
+ | Tier | Min NAV | LTV bonus | Rate discount |
181
+ |---|---|---|---|
182
+ | Retail | $0 | +0% | 0 bps |
183
+ | Accredited | $100k | +5% | −25 bps |
184
+ | Professional | $500k | +10% | −50 bps |
185
+ | Institutional | $2.5M | +15% | −75 bps |
186
+ | Developer | $25M | +20% | −100 bps |
187
+
188
+ ### NAV formula
189
+ ```
190
+ NAV = cash + Σ(tokens × price) − Σ(mortgage balances) − judgment_balance
191
+ ```
192
+
193
+ ### Macro events
194
+ | Event | Prob | Duration | Effect |
195
+ |---|---|---|---|
196
+ | RECESSION | 6% | 2–4 turns | −5%/turn price, −8% rent, +15% vacancy |
197
+ | HOUSING_BOOM | 5% | 2–3 turns | +6%/turn price, +5% rent |
198
+ | NATURAL_DISASTER | 3% | 1 turn | −20% price, rent=0, +40% vacancy |
199
+ | POLICY_CHANGE | 8% | 3 turns | ±5–12% rent/price |
200
+ | TAX_HIKE | 7% | Permanent | $50–150/token/turn expense |
201
+ | INTEREST_RATE_RISE | 7% | 3–6 turns | +1.5% ARM rate (1-turn warning) |
202
+ | INTEREST_RATE_CUT | 6% | 3–6 turns | −1.0% ARM rate (1-turn warning) |
203
+ | RENT_CONTROL | 5% | 4 turns | Blocks lease renewal increases |
204
+ | INSURANCE_CRISIS | 5% | 2–3 turns | $100–300/token/turn expense |
205
+ | GENTRIFICATION | 4% | 3 turns | D/F properties upgrade one grade |
206
+ | ZONING_CHANGE | 5% | 2 turns | Targeted type: −10% rent, −5% price |
207
+ | PROPERTY_BUBBLE | 3% | 2 turns | All prices +8%/turn |
208
+ | BUBBLE_BURST | 2% | 2–3 turns | All prices −12%/turn, +20% vacancy |
209
+ | TENANT_STRIKE | 4% | 1–2 turns | Targeted type: rent = 0 |
210
+ | EMINENT_DOMAIN | 2% | Instant | One property force-bought at 110% market value |
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ getApiKey,
4
+ getApiUrl,
5
+ requireConfig
6
+ } from "./chunk-Q5AKRRZ2.js";
7
+ import {
8
+ createClient
9
+ } from "./chunk-X3OZHOPM.js";
10
+
11
+ // src/commands/admin.ts
12
+ function client(cmd) {
13
+ const opts = cmd.optsWithGlobals();
14
+ const cfg = requireConfig();
15
+ return createClient({ apiUrl: getApiUrl(opts.url), apiKey: getApiKey(opts.apiKey) ?? cfg.api_key });
16
+ }
17
+ function registerAdmin(program) {
18
+ const admin = program.command("admin").description("Admin operations (requires admin API key)");
19
+ const props = admin.command("properties").description("Property pool management");
20
+ props.command("list").description("List all properties in the sandbox pool").option("--all", "Include inactive properties").action(async (opts, cmd) => {
21
+ const properties = await client(cmd).listProperties(!opts.all);
22
+ if (!properties.length) {
23
+ console.log("No properties in pool. Run: sandbox admin properties sync");
24
+ return;
25
+ }
26
+ console.log(`
27
+ ${"Name".padEnd(32)}${"City".padEnd(16)}${"Price".padStart(12)}${"Rent/mo".padStart(10)}${"Cap".padStart(6)}`);
28
+ console.log("\u2500".repeat(76));
29
+ for (const p of properties) {
30
+ const cap = p.cap_rate !== null ? `${(p.cap_rate * 100).toFixed(1)}%` : "\u2014";
31
+ console.log(
32
+ `${(p.name ?? p.id).slice(0, 30).padEnd(32)}${(p.city ?? "\u2014").padEnd(16)}$${p.initial_price_usd.toLocaleString("en-US", { maximumFractionDigits: 0 }).padStart(11)}$${p.monthly_rent_usd.toLocaleString("en-US", { maximumFractionDigits: 0 }).padStart(9)}${cap.padStart(6)}`
33
+ );
34
+ }
35
+ console.log(`
36
+ Total: ${properties.length}`);
37
+ });
38
+ props.command("sync").description("Pull/update property pool from rwa-issuer-sim (RWA_ISSUER_URL must be set)").action(async (_, cmd) => {
39
+ process.stdout.write("Syncing property pool from rwa-issuer-sim\u2026 ");
40
+ const res = await client(cmd).syncProperties();
41
+ console.log("done");
42
+ console.log(` Created: ${res.created}`);
43
+ console.log(` Updated: ${res.updated}`);
44
+ console.log(` Skipped: ${res.skipped}`);
45
+ });
46
+ admin.command("mint <game-id> <player-id>").description("Mint additional tUSDC to a player (admin only)").requiredOption("--amount <n>", "Amount of tUSDC to mint").action(async (gameId, playerId, opts, cmd) => {
47
+ const res = await client(cmd).mintTusdc(gameId, playerId, parseFloat(opts.amount));
48
+ console.log(`Minted $${parseFloat(opts.amount).toFixed(2)} tUSDC to player ${res.player_id}`);
49
+ console.log(`New balance: $${res.usdc_balance.toFixed(2)}`);
50
+ });
51
+ }
52
+ export {
53
+ registerAdmin
54
+ };