clawcity 2.2.4 → 2.2.5
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/package.json +9 -2
- package/test/formatters.cli.mjs +0 -103
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawcity",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "CLI
|
|
3
|
+
"version": "2.2.5",
|
|
4
|
+
"description": "Agent-first CLI for ClawCity gameplay, tournaments, and public game APIs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"clawcity": "dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
10
14
|
"scripts": {
|
|
11
15
|
"build": "tsc",
|
|
12
16
|
"dev": "tsc --watch",
|
|
@@ -27,6 +31,9 @@
|
|
|
27
31
|
"type": "git",
|
|
28
32
|
"url": "https://github.com/marcel-heinz/clawcity.app"
|
|
29
33
|
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/marcel-heinz/clawcity.app/issues"
|
|
36
|
+
},
|
|
30
37
|
"homepage": "https://www.clawcity.app",
|
|
31
38
|
"dependencies": {
|
|
32
39
|
"dotenv": "^16.4.0",
|
package/test/formatters.cli.mjs
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import {
|
|
4
|
-
extractMarketOrderId,
|
|
5
|
-
formatGatherResultLine,
|
|
6
|
-
formatMarketPricesLines,
|
|
7
|
-
formatOracleLines,
|
|
8
|
-
formatRecipesLines,
|
|
9
|
-
} from '../dist/lib/formatters.js';
|
|
10
|
-
|
|
11
|
-
test('formatGatherResultLine handles zero-resource gathers cleanly', () => {
|
|
12
|
-
const line = formatGatherResultLine({
|
|
13
|
-
gathered: { gold: 0, wood: 0, food: 0, stone: 0 },
|
|
14
|
-
stamina: { efficiency: 100 },
|
|
15
|
-
tile_status: 'market',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
assert.equal(line, 'Gathered: none | Efficiency: 100% | Tile: market');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('extractMarketOrderId supports nested response shape', () => {
|
|
22
|
-
const id = extractMarketOrderId({
|
|
23
|
-
order: { id: 'abc-123' },
|
|
24
|
-
message: 'created',
|
|
25
|
-
});
|
|
26
|
-
assert.equal(id, 'abc-123');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('formatMarketPricesLines parses stats and pair rates', () => {
|
|
30
|
-
const lines = formatMarketPricesLines({
|
|
31
|
-
stats: {
|
|
32
|
-
open_orders: 4,
|
|
33
|
-
transactions_24h: 9,
|
|
34
|
-
active_trading_pairs: 2,
|
|
35
|
-
},
|
|
36
|
-
pairs: [
|
|
37
|
-
{
|
|
38
|
-
offer_resource: 'wood',
|
|
39
|
-
request_resource: 'stone',
|
|
40
|
-
order_count: 2,
|
|
41
|
-
total_offer_available: 100,
|
|
42
|
-
best_rate: 1.25,
|
|
43
|
-
avg_rate: 1.4,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
assert.equal(lines[0], 'Open orders: 4 | 24h transactions: 9 | Active pairs: 2');
|
|
49
|
-
assert.match(lines[1], /wood->stone/);
|
|
50
|
-
assert.match(lines[1], /best:1\.25/);
|
|
51
|
-
assert.match(lines[1], /avg:1\.40/);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('formatRecipesLines supports craftable + shop payload', () => {
|
|
55
|
-
const lines = formatRecipesLines({
|
|
56
|
-
craftable: [
|
|
57
|
-
{
|
|
58
|
-
id: 'wooden_pickaxe',
|
|
59
|
-
recipe: { wood: 40, stone: 10 },
|
|
60
|
-
effects: ['+25% gathering on mountain'],
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
shop: [
|
|
64
|
-
{
|
|
65
|
-
id: 'rations',
|
|
66
|
-
price: 20,
|
|
67
|
-
effects: ['+25 food'],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
assert.equal(lines[0], 'Craftable items:');
|
|
73
|
-
assert.match(lines[1], /wooden_pickaxe: 40w\+10s/);
|
|
74
|
-
assert.equal(lines[2], 'Shop items:');
|
|
75
|
-
assert.match(lines[3], /rations: 20 gold/);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('formatOracleLines shows outcome progress and step list', () => {
|
|
79
|
-
const lines = formatOracleLines({
|
|
80
|
-
contract: {
|
|
81
|
-
completed_outcomes: 2,
|
|
82
|
-
total_outcomes: 6,
|
|
83
|
-
},
|
|
84
|
-
oracle: {
|
|
85
|
-
title: 'The Oracle of ClawCity',
|
|
86
|
-
narrative: 'A short story.',
|
|
87
|
-
tournament_objective: 'Master Gatherer: total gathered.',
|
|
88
|
-
starter_prompt: 'You are an autonomous competitor.',
|
|
89
|
-
},
|
|
90
|
-
next_steps: [
|
|
91
|
-
{
|
|
92
|
-
title: 'Leave Spawn',
|
|
93
|
-
command: 'clawcity move forest',
|
|
94
|
-
expected: 'Reach forest terrain.',
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
assert.equal(lines[0], 'The Oracle of ClawCity | Outcomes: 2/6');
|
|
100
|
-
assert.equal(lines[1], 'A short story.');
|
|
101
|
-
assert.match(lines[3], /Next steps:/);
|
|
102
|
-
assert.match(lines[4], /1\. Leave Spawn/);
|
|
103
|
-
});
|