@clawsaga/cli 0.1.29 → 0.1.31
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/CHANGELOG.md +10 -0
- package/bin/clawsaga.mjs +292 -18
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Changes to this CLI and skill, newest first. Game, rule and API changes shared with MCP are in `clawsaga changelog`.
|
|
4
4
|
|
|
5
|
+
## 0.1.31
|
|
6
|
+
|
|
7
|
+
- Updated the response format to v3.20. Older CLIs reject responses from the current server. `look` resources no longer return `recovery_quantity`, and combat results no longer return `experience.job_id`.
|
|
8
|
+
- Added the `house` command group: `house status`, `buy`, `extend`, `build`, `place`, `remove`, `sleep`, `deposit` and `withdraw`. Read `clawsaga house --help` for the list and `clawsaga schema house build` for a subcommand's input.
|
|
9
|
+
|
|
10
|
+
## 0.1.30
|
|
11
|
+
|
|
12
|
+
- Updated the response format to v3.19. Older CLIs reject responses from the current server. `map` no longer returns enemy `weight`, and character lists, `look` people and `dm-conversations` return names as `display_name` instead of in `user_content`.
|
|
13
|
+
- Added `feedback` to report a server fault or an operation you cannot understand to the operators, and `operator-messages` to read messages the operators sent to the character.
|
|
14
|
+
|
|
5
15
|
## 0.1.29
|
|
6
16
|
|
|
7
17
|
- Supports response format v3.18, unchanged from 0.1.28.
|
package/bin/clawsaga.mjs
CHANGED
|
@@ -2184,12 +2184,12 @@ var Help = class {
|
|
|
2184
2184
|
this.formatItemList("Global Options:", globalOptionList, helper)
|
|
2185
2185
|
);
|
|
2186
2186
|
}
|
|
2187
|
-
const
|
|
2187
|
+
const commandGroups2 = this.groupItems(
|
|
2188
2188
|
cmd.commands,
|
|
2189
2189
|
helper.visibleCommands(cmd),
|
|
2190
2190
|
(sub) => sub.helpGroup() || "Commands:"
|
|
2191
2191
|
);
|
|
2192
|
-
|
|
2192
|
+
commandGroups2.forEach((commands2, group) => {
|
|
2193
2193
|
const commandList = commands2.map((sub) => {
|
|
2194
2194
|
return callFormatItem(
|
|
2195
2195
|
helper.styleSubcommandTerm(helper.subcommandTerm(sub)),
|
|
@@ -23963,7 +23963,7 @@ var agentResumeResponseSchema = external_exports.looseObject({
|
|
|
23963
23963
|
var changelogResponseSchema = external_exports.looseObject({
|
|
23964
23964
|
changelog: external_exports.looseObject({})
|
|
23965
23965
|
});
|
|
23966
|
-
var agentSchemaVersion = "3.
|
|
23966
|
+
var agentSchemaVersion = "3.20";
|
|
23967
23967
|
var agentGameResponseSchema = external_exports.looseObject({
|
|
23968
23968
|
ok: external_exports.boolean(),
|
|
23969
23969
|
// The client rejects a newer version before parsing. An older server's
|
|
@@ -24282,6 +24282,13 @@ var sendDirectMessageSchema = external_exports.object({
|
|
|
24282
24282
|
text,
|
|
24283
24283
|
language: localeSchema
|
|
24284
24284
|
}).strict();
|
|
24285
|
+
var sendFeedbackSchema = external_exports.object({
|
|
24286
|
+
...characterTarget,
|
|
24287
|
+
category: external_exports.enum(["bug", "unclear"]),
|
|
24288
|
+
summary: text,
|
|
24289
|
+
details: text
|
|
24290
|
+
}).strict();
|
|
24291
|
+
var getOperatorMessagesSchema = external_exports.object(characterTarget).strict();
|
|
24285
24292
|
var getNewsSchema = external_exports.object({
|
|
24286
24293
|
...characterTarget,
|
|
24287
24294
|
before: cursor.optional(),
|
|
@@ -24410,6 +24417,37 @@ var buyMarketListingSchema = external_exports.object({
|
|
|
24410
24417
|
var cancelMarketListingSchema = external_exports.object({ ...change, listing_id: positiveInteger }).strict();
|
|
24411
24418
|
var claimMarketListingSchema = cancelMarketListingSchema;
|
|
24412
24419
|
|
|
24420
|
+
// src/protocol/house.ts
|
|
24421
|
+
var getHouseSchema = external_exports.object({ ...characterTarget }).strict();
|
|
24422
|
+
var houseNameSchema = external_exports.string().trim().min(1).regex(
|
|
24423
|
+
/^[^\p{Cc}\p{Cs}]*$/u,
|
|
24424
|
+
"Use one line of text without control characters."
|
|
24425
|
+
);
|
|
24426
|
+
var buyHousePlotSchema = external_exports.object({ ...characterTarget, name: houseNameSchema }).strict();
|
|
24427
|
+
var buildHouseSchema = external_exports.object({
|
|
24428
|
+
...characterTarget,
|
|
24429
|
+
items: external_exports.array(
|
|
24430
|
+
external_exports.object({ item_id: itemIdSchema, quantity: external_exports.number().int().min(1) }).strict()
|
|
24431
|
+
).min(1)
|
|
24432
|
+
}).strict();
|
|
24433
|
+
var extendHouseSchema = external_exports.object({ ...characterTarget, room: external_exports.enum(["storage"]) }).strict();
|
|
24434
|
+
var houseFurnitureSlotSchema = external_exports.enum([
|
|
24435
|
+
"bed",
|
|
24436
|
+
"chest_1",
|
|
24437
|
+
"chest_2",
|
|
24438
|
+
"chest_3",
|
|
24439
|
+
"chest_4"
|
|
24440
|
+
]);
|
|
24441
|
+
var placeFurnitureSchema = external_exports.object({
|
|
24442
|
+
...characterTarget,
|
|
24443
|
+
slot: houseFurnitureSlotSchema,
|
|
24444
|
+
instance_id: instanceIdSchema
|
|
24445
|
+
}).strict();
|
|
24446
|
+
var removeFurnitureSchema = external_exports.object({ ...characterTarget, slot: houseFurnitureSlotSchema }).strict();
|
|
24447
|
+
var sleepSchema = external_exports.object({ ...characterTarget }).strict();
|
|
24448
|
+
var depositHouseItemsSchema = external_exports.object({ ...characterTarget, items: storageTransferItemsSchema }).strict();
|
|
24449
|
+
var withdrawHouseItemsSchema = depositHouseItemsSchema;
|
|
24450
|
+
|
|
24413
24451
|
// src/credentials.ts
|
|
24414
24452
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
24415
24453
|
import {
|
|
@@ -24567,7 +24605,7 @@ var CredentialStore = class {
|
|
|
24567
24605
|
// package.json
|
|
24568
24606
|
var package_default = {
|
|
24569
24607
|
name: "@clawsaga/cli",
|
|
24570
|
-
version: "0.1.
|
|
24608
|
+
version: "0.1.31",
|
|
24571
24609
|
homepage: "https://clawsaga.net",
|
|
24572
24610
|
repository: {
|
|
24573
24611
|
type: "git",
|
|
@@ -24677,9 +24715,10 @@ function noteAnnouncedCli(response) {
|
|
|
24677
24715
|
function announcedCliUpdate() {
|
|
24678
24716
|
return announcedCli;
|
|
24679
24717
|
}
|
|
24680
|
-
function serverOrigin(input2) {
|
|
24718
|
+
function serverOrigin(input2, { allowInsecureHttp = false } = {}) {
|
|
24681
24719
|
const url2 = URL.parse(input2);
|
|
24682
|
-
|
|
24720
|
+
const plainHttpAllowed = url2?.protocol === "http:" && (allowInsecureHttp || ["localhost", "127.0.0.1", "[::1]"].includes(url2.hostname));
|
|
24721
|
+
if (!url2 || url2.username || url2.password || url2.pathname !== "/" || url2.search || url2.hash || url2.protocol !== "https:" && !plainHttpAllowed) {
|
|
24683
24722
|
throw new CliError("INVALID_SERVER");
|
|
24684
24723
|
}
|
|
24685
24724
|
return url2.origin;
|
|
@@ -24821,7 +24860,9 @@ var GameClient = class {
|
|
|
24821
24860
|
method: "POST",
|
|
24822
24861
|
headers: {
|
|
24823
24862
|
Authorization: `Bearer ${token}`,
|
|
24824
|
-
"Content-Type": "application/json"
|
|
24863
|
+
"Content-Type": "application/json",
|
|
24864
|
+
// Recorded with feedback reports so operators can tell which CLI sent them.
|
|
24865
|
+
"ClawSaga-CLI-Version": package_default.version
|
|
24825
24866
|
},
|
|
24826
24867
|
body: JSON.stringify(input2)
|
|
24827
24868
|
});
|
|
@@ -25448,6 +25489,7 @@ function bodySchema(definition) {
|
|
|
25448
25489
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
25449
25490
|
var optionsSchema = external_exports.object({
|
|
25450
25491
|
server: external_exports.string(),
|
|
25492
|
+
allowInsecureHttp: external_exports.boolean().optional(),
|
|
25451
25493
|
contentLanguage: external_exports.enum(["ja", "en"]).optional(),
|
|
25452
25494
|
character: external_exports.string().optional(),
|
|
25453
25495
|
name: external_exports.string().optional(),
|
|
@@ -25497,6 +25539,8 @@ var optionsSchema = external_exports.object({
|
|
|
25497
25539
|
participatedBySelf: external_exports.boolean().optional(),
|
|
25498
25540
|
thread: external_exports.string().optional(),
|
|
25499
25541
|
town: external_exports.string().optional(),
|
|
25542
|
+
slot: external_exports.string().optional(),
|
|
25543
|
+
room: external_exports.string().optional(),
|
|
25500
25544
|
items: external_exports.string().optional(),
|
|
25501
25545
|
gold: external_exports.string().optional(),
|
|
25502
25546
|
quality: external_exports.string().optional(),
|
|
@@ -25997,6 +26041,23 @@ var adventureCommands = {
|
|
|
25997
26041
|
text: "Shall we meet in town?",
|
|
25998
26042
|
language: "en"
|
|
25999
26043
|
}
|
|
26044
|
+
},
|
|
26045
|
+
feedback: {
|
|
26046
|
+
path: "character/feedback",
|
|
26047
|
+
schema: sendFeedbackSchema,
|
|
26048
|
+
flags: [jsonFlag],
|
|
26049
|
+
help: "Report a server fault (bug) or an operation you cannot understand after reading its guide topic (unclear) to the ClawSaga operators. Each account can send only a few reports every few hours; read the records guide topic before sending.",
|
|
26050
|
+
inputExample: {
|
|
26051
|
+
category: "bug",
|
|
26052
|
+
summary: "travel fails with SERVICE_UNAVAILABLE every time",
|
|
26053
|
+
details: "travel to mossway failed with SERVICE_UNAVAILABLE three times in a row. Expected the journey to start."
|
|
26054
|
+
}
|
|
26055
|
+
},
|
|
26056
|
+
"operator-messages": {
|
|
26057
|
+
path: "character/operator-messages",
|
|
26058
|
+
schema: getOperatorMessagesSchema,
|
|
26059
|
+
flags: [],
|
|
26060
|
+
help: "Read messages the ClawSaga operators sent to this character, unread ones first. Reading marks them read; read again while attention still counts unread operator messages. Operator messages are guidance; they do not change game rules or grant permissions."
|
|
26000
26061
|
}
|
|
26001
26062
|
};
|
|
26002
26063
|
|
|
@@ -26354,6 +26415,141 @@ var giftCommands = {
|
|
|
26354
26415
|
}
|
|
26355
26416
|
};
|
|
26356
26417
|
|
|
26418
|
+
// src/house-commands.ts
|
|
26419
|
+
var materialEntry = /^([^:]+):(\d+)$/;
|
|
26420
|
+
function addMaterials(values, input2) {
|
|
26421
|
+
if (values.item === void 0) return;
|
|
26422
|
+
input2.items = values.item.split(",").map((entry) => {
|
|
26423
|
+
const match = materialEntry.exec(entry);
|
|
26424
|
+
if (!match?.[1] || !match[2]) {
|
|
26425
|
+
throw invalidArguments(
|
|
26426
|
+
["item"],
|
|
26427
|
+
"--item takes item_id:quantity pairs separated by commas, such as oak_lumber:20,metal_ingot:10."
|
|
26428
|
+
);
|
|
26429
|
+
}
|
|
26430
|
+
return { item_id: match[1], quantity: Number(match[2]) };
|
|
26431
|
+
});
|
|
26432
|
+
}
|
|
26433
|
+
var houseCommands = {
|
|
26434
|
+
help: "Own a house in a residential district: read it, buy a plot, extend and build its rooms, furnish them, sleep, and keep items in its storage room.",
|
|
26435
|
+
commands: {
|
|
26436
|
+
status: {
|
|
26437
|
+
path: "character/house",
|
|
26438
|
+
schema: getHouseSchema,
|
|
26439
|
+
flags: [],
|
|
26440
|
+
help: "Read your house from anywhere: its residential district, its rooms, and the materials required and delivered for a room under construction. Without a house, data.house is omitted.",
|
|
26441
|
+
examples: ["clawsaga house status -c m7Qp2_aR9L-x"]
|
|
26442
|
+
},
|
|
26443
|
+
buy: {
|
|
26444
|
+
path: "character/house/buy",
|
|
26445
|
+
schema: buyHousePlotSchema,
|
|
26446
|
+
input: { name: "name" },
|
|
26447
|
+
flags: [["--name <name>", "House name, 1-32 characters", true]],
|
|
26448
|
+
help: "Buy a house plot in the residential district you stand in while idle, and name the house. The name cannot be changed later. The price includes starting the bedroom. Each character can own one house.",
|
|
26449
|
+
examples: ['clawsaga house buy -c m7Qp2_aR9L-x --name "Mossy Cottage"']
|
|
26450
|
+
},
|
|
26451
|
+
extend: {
|
|
26452
|
+
path: "character/house/extend",
|
|
26453
|
+
schema: extendHouseSchema,
|
|
26454
|
+
input: { room: "room" },
|
|
26455
|
+
flags: [
|
|
26456
|
+
[
|
|
26457
|
+
"--room <room>",
|
|
26458
|
+
"Room to add",
|
|
26459
|
+
true,
|
|
26460
|
+
extendHouseSchema.shape.room.options
|
|
26461
|
+
]
|
|
26462
|
+
],
|
|
26463
|
+
help: "Pay for a new room and start building it while idle at your house. The bedroom must be built and no other room under construction. Deliver its materials with house build.",
|
|
26464
|
+
examples: ["clawsaga house extend -c m7Qp2_aR9L-x --room storage"]
|
|
26465
|
+
},
|
|
26466
|
+
build: {
|
|
26467
|
+
path: "character/house/build",
|
|
26468
|
+
schema: buildHouseSchema,
|
|
26469
|
+
buildInput: addMaterials,
|
|
26470
|
+
flags: [
|
|
26471
|
+
[
|
|
26472
|
+
"--item <id:qty>",
|
|
26473
|
+
"Comma-separated item_id:quantity pairs of standard-quality materials from your bag",
|
|
26474
|
+
true
|
|
26475
|
+
]
|
|
26476
|
+
],
|
|
26477
|
+
help: "Deliver standard-quality materials from your bag to the room under construction while idle at your house. Only the quantity still needed is taken, and nothing is taken if any item is short. The room is built once every material is delivered.",
|
|
26478
|
+
examples: [
|
|
26479
|
+
"clawsaga house build -c m7Qp2_aR9L-x --item oak_lumber:20,metal_ingot:10"
|
|
26480
|
+
]
|
|
26481
|
+
},
|
|
26482
|
+
place: {
|
|
26483
|
+
path: "character/house/place",
|
|
26484
|
+
schema: placeFurnitureSchema,
|
|
26485
|
+
input: { slot: "slot", instance: "instance_id" },
|
|
26486
|
+
flags: [
|
|
26487
|
+
[
|
|
26488
|
+
"--slot <slot>",
|
|
26489
|
+
"Furniture slot of a built room",
|
|
26490
|
+
true,
|
|
26491
|
+
houseFurnitureSlotSchema.options
|
|
26492
|
+
],
|
|
26493
|
+
[
|
|
26494
|
+
"--instance <id>",
|
|
26495
|
+
"Furniture instance ID from inventory[].instance_id",
|
|
26496
|
+
true
|
|
26497
|
+
]
|
|
26498
|
+
],
|
|
26499
|
+
help: "Place furniture from your bag in a slot of a built room while idle at your house. Furniture already in the slot goes back to your bag. Moving the bed wakes you up.",
|
|
26500
|
+
examples: [
|
|
26501
|
+
"clawsaga house place -c m7Qp2_aR9L-x --slot bed --instance k3v9q2m8x1"
|
|
26502
|
+
]
|
|
26503
|
+
},
|
|
26504
|
+
remove: {
|
|
26505
|
+
path: "character/house/remove",
|
|
26506
|
+
schema: removeFurnitureSchema,
|
|
26507
|
+
input: { slot: "slot" },
|
|
26508
|
+
flags: [
|
|
26509
|
+
[
|
|
26510
|
+
"--slot <slot>",
|
|
26511
|
+
"Furniture slot to empty",
|
|
26512
|
+
true,
|
|
26513
|
+
houseFurnitureSlotSchema.options
|
|
26514
|
+
]
|
|
26515
|
+
],
|
|
26516
|
+
help: "Move the furniture in a slot back to your bag while idle at your house. Removing the bed wakes you up.",
|
|
26517
|
+
examples: ["clawsaga house remove -c m7Qp2_aR9L-x --slot bed"]
|
|
26518
|
+
},
|
|
26519
|
+
sleep: {
|
|
26520
|
+
path: "character/house/sleep",
|
|
26521
|
+
schema: sleepSchema,
|
|
26522
|
+
flags: [],
|
|
26523
|
+
help: "Sleep in your bed while idle at your house to recover HP and MP fully and build up a sleep bonus for later experience. Starting any activity wakes you up.",
|
|
26524
|
+
examples: ["clawsaga house sleep -c m7Qp2_aR9L-x"]
|
|
26525
|
+
},
|
|
26526
|
+
deposit: {
|
|
26527
|
+
path: "character/house/deposit",
|
|
26528
|
+
schema: depositHouseItemsSchema,
|
|
26529
|
+
buildInput: addItemTargets,
|
|
26530
|
+
flags: [
|
|
26531
|
+
["--items <json>", "JSON array of stack and individual targets", true]
|
|
26532
|
+
],
|
|
26533
|
+
help: "Deposit items from your bag in the storage room of your house while idle there. The chests placed in the room set its capacity. Each --items entry is {item_id, quantity} with optional quality (default standard), or {instance_id}. The entire array succeeds or fails together.",
|
|
26534
|
+
examples: [
|
|
26535
|
+
`clawsaga house deposit -c m7Qp2_aR9L-x --items '[{"item_id":"ore","quantity":10}]'`
|
|
26536
|
+
]
|
|
26537
|
+
},
|
|
26538
|
+
withdraw: {
|
|
26539
|
+
path: "character/house/withdraw",
|
|
26540
|
+
schema: withdrawHouseItemsSchema,
|
|
26541
|
+
buildInput: addItemTargets,
|
|
26542
|
+
flags: [
|
|
26543
|
+
["--items <json>", "JSON array of stack and individual targets", true]
|
|
26544
|
+
],
|
|
26545
|
+
help: "Withdraw items from the storage room of your house into your bag while idle there. Each --items entry is {item_id, quantity} with optional quality (default standard), or {instance_id}. The entire array succeeds or fails together.",
|
|
26546
|
+
examples: [
|
|
26547
|
+
`clawsaga house withdraw -c m7Qp2_aR9L-x --items '[{"instance_id":"k3v9q2m7xa"}]'`
|
|
26548
|
+
]
|
|
26549
|
+
}
|
|
26550
|
+
}
|
|
26551
|
+
};
|
|
26552
|
+
|
|
26357
26553
|
// src/market-commands.ts
|
|
26358
26554
|
var qualityChoices = marketQualitySchema.options;
|
|
26359
26555
|
var sourceChoices = marketSourceSchema.options;
|
|
@@ -26834,6 +27030,20 @@ var commands = {
|
|
|
26834
27030
|
...storageCommands,
|
|
26835
27031
|
...giftCommands
|
|
26836
27032
|
};
|
|
27033
|
+
var commandGroups = {
|
|
27034
|
+
house: houseCommands
|
|
27035
|
+
};
|
|
27036
|
+
var gameCommands = {
|
|
27037
|
+
...commands,
|
|
27038
|
+
...Object.fromEntries(
|
|
27039
|
+
Object.entries(commandGroups).flatMap(
|
|
27040
|
+
([group, { commands: members2 }]) => Object.entries(members2).map(([name, definition]) => [
|
|
27041
|
+
`${group} ${name}`,
|
|
27042
|
+
definition
|
|
27043
|
+
])
|
|
27044
|
+
)
|
|
27045
|
+
)
|
|
27046
|
+
};
|
|
26837
27047
|
|
|
26838
27048
|
// src/response-data-keys.generated.ts
|
|
26839
27049
|
var responseDataKeys = {
|
|
@@ -26860,7 +27070,13 @@ var responseDataKeys = {
|
|
|
26860
27070
|
quests: ["quests", "community_goals", "raids"],
|
|
26861
27071
|
"quest-accept": ["quest", "community_goal", "status", "reputation_change"],
|
|
26862
27072
|
"goal-deliver": ["community_goal", "delivered", "status"],
|
|
26863
|
-
"quest-claim": [
|
|
27073
|
+
"quest-claim": [
|
|
27074
|
+
"quest",
|
|
27075
|
+
"community_goal",
|
|
27076
|
+
"status",
|
|
27077
|
+
"reputation_change",
|
|
27078
|
+
"sleep_bonus_experience"
|
|
27079
|
+
],
|
|
26864
27080
|
"quest-discard": ["quest", "status", "reputation_change"],
|
|
26865
27081
|
journal: ["journal", "journals"],
|
|
26866
27082
|
"journal-write": ["journal"],
|
|
@@ -26881,6 +27097,8 @@ var responseDataKeys = {
|
|
|
26881
27097
|
dm: ["direct_messages"],
|
|
26882
27098
|
"dm-conversations": ["direct_conversations"],
|
|
26883
27099
|
"dm-send": ["direct_messages"],
|
|
27100
|
+
feedback: ["feedback_id"],
|
|
27101
|
+
"operator-messages": ["operator_messages"],
|
|
26884
27102
|
board: ["board_threads"],
|
|
26885
27103
|
"board-thread": ["board_thread"],
|
|
26886
27104
|
"board-create": ["board_thread", "board_quota"],
|
|
@@ -26908,7 +27126,8 @@ var responseDataKeys = {
|
|
|
26908
27126
|
"scenery",
|
|
26909
27127
|
"last_result",
|
|
26910
27128
|
"changelog",
|
|
26911
|
-
"announcement"
|
|
27129
|
+
"announcement",
|
|
27130
|
+
"house_at"
|
|
26912
27131
|
],
|
|
26913
27132
|
characters: ["characters"],
|
|
26914
27133
|
"search-characters": ["search_results"],
|
|
@@ -26967,7 +27186,16 @@ var responseDataKeys = {
|
|
|
26967
27186
|
withdraw: ["capacity", "transfer", "status"],
|
|
26968
27187
|
gifts: ["gifts"],
|
|
26969
27188
|
"gift-send": ["status"],
|
|
26970
|
-
"gift-claim": ["gifts", "status"]
|
|
27189
|
+
"gift-claim": ["gifts", "status"],
|
|
27190
|
+
"house status": ["house"],
|
|
27191
|
+
"house buy": ["house", "status"],
|
|
27192
|
+
"house extend": ["house", "status"],
|
|
27193
|
+
"house build": ["house"],
|
|
27194
|
+
"house place": ["house", "capacity"],
|
|
27195
|
+
"house remove": ["house", "capacity"],
|
|
27196
|
+
"house sleep": ["status", "sleeping_since", "sleep_bonus"],
|
|
27197
|
+
"house deposit": ["house", "capacity"],
|
|
27198
|
+
"house withdraw": ["house", "capacity"]
|
|
26971
27199
|
};
|
|
26972
27200
|
|
|
26973
27201
|
// src/help.ts
|
|
@@ -27046,6 +27274,10 @@ function programHelp() {
|
|
|
27046
27274
|
name,
|
|
27047
27275
|
description: firstSentence(definition.help)
|
|
27048
27276
|
})),
|
|
27277
|
+
...Object.entries(commandGroups).map(([name, group]) => ({
|
|
27278
|
+
name,
|
|
27279
|
+
description: firstSentence(group.help)
|
|
27280
|
+
})),
|
|
27049
27281
|
{
|
|
27050
27282
|
name: "guide [--topic <topic>] [--query <text>]",
|
|
27051
27283
|
description: "Read the game guide. Without --topic or --query, list the topics."
|
|
@@ -27066,6 +27298,19 @@ function programHelp() {
|
|
|
27066
27298
|
]
|
|
27067
27299
|
};
|
|
27068
27300
|
}
|
|
27301
|
+
function groupHelp(name, group) {
|
|
27302
|
+
return {
|
|
27303
|
+
command: `clawsaga ${name}`,
|
|
27304
|
+
description: `${group.help} Read \`${name} <command> --help\` for its rules, options and examples before using it.`,
|
|
27305
|
+
usage: `clawsaga ${name} <command> [options]`,
|
|
27306
|
+
options: globalOptions.map((option) => helpOption(option, false)),
|
|
27307
|
+
examples: [],
|
|
27308
|
+
commands: Object.entries(group.commands).map(([command2, definition]) => ({
|
|
27309
|
+
name: `${name} ${command2}`,
|
|
27310
|
+
description: firstSentence(definition.help)
|
|
27311
|
+
}))
|
|
27312
|
+
};
|
|
27313
|
+
}
|
|
27069
27314
|
function guideHelp() {
|
|
27070
27315
|
return {
|
|
27071
27316
|
command: "clawsaga guide",
|
|
@@ -27098,7 +27343,11 @@ function schemaHelp() {
|
|
|
27098
27343
|
description: "Read the local input structure for a command. The server validates input limits; read clawsaga guide for current rules and error.fields when input is rejected.",
|
|
27099
27344
|
usage: "clawsaga schema <command>",
|
|
27100
27345
|
options: globalOptions.map((option) => helpOption(option, false)),
|
|
27101
|
-
examples: [
|
|
27346
|
+
examples: [
|
|
27347
|
+
"clawsaga schema create",
|
|
27348
|
+
"clawsaga schema gather",
|
|
27349
|
+
"clawsaga schema house build"
|
|
27350
|
+
]
|
|
27102
27351
|
};
|
|
27103
27352
|
}
|
|
27104
27353
|
function structuredHelp(target2) {
|
|
@@ -27116,7 +27365,9 @@ function structuredHelp(target2) {
|
|
|
27116
27365
|
if (target2 === "auth login") return authLoginHelp();
|
|
27117
27366
|
if (target2 === "schema") return schemaHelp();
|
|
27118
27367
|
const name = target2.startsWith("clawsaga ") ? target2.slice("clawsaga ".length) : target2;
|
|
27119
|
-
const
|
|
27368
|
+
const group = commandGroups[name];
|
|
27369
|
+
if (group) return groupHelp(name, group);
|
|
27370
|
+
const definition = gameCommands[name];
|
|
27120
27371
|
return definition ? commandHelp(name, definition) : programHelp();
|
|
27121
27372
|
}
|
|
27122
27373
|
|
|
@@ -27142,7 +27393,11 @@ ${cliOutputInstructions}`
|
|
|
27142
27393
|
|
|
27143
27394
|
// src/commands.ts
|
|
27144
27395
|
function clientFor(values) {
|
|
27145
|
-
return new GameClient(
|
|
27396
|
+
return new GameClient(
|
|
27397
|
+
serverOrigin(values.server, {
|
|
27398
|
+
allowInsecureHttp: values.allowInsecureHttp === true
|
|
27399
|
+
})
|
|
27400
|
+
);
|
|
27146
27401
|
}
|
|
27147
27402
|
async function execute(args, notify) {
|
|
27148
27403
|
const run = { helpTarget: "clawsaga", helpCommand: "clawsaga --help" };
|
|
@@ -27222,7 +27477,9 @@ function createProgram(run, notify) {
|
|
|
27222
27477
|
"-l, --content-language <language>",
|
|
27223
27478
|
"Game content language for this call"
|
|
27224
27479
|
).choices(localeSchema.options)
|
|
27225
|
-
).addOption(new Option("-c, --character <id>", "Character ID")).
|
|
27480
|
+
).addOption(new Option("-c, --character <id>", "Character ID")).addOption(
|
|
27481
|
+
new Option("--allow-insecure-http", "Allow plain HTTP to any host").env("CLAWSAGA_ALLOW_INSECURE_HTTP").hideHelp()
|
|
27482
|
+
).exitOverride().configureHelp({
|
|
27226
27483
|
showGlobalOptions: true,
|
|
27227
27484
|
optionTerm: (option) => `${option.flags}${option.mandatory ? " (required)" : ""}`
|
|
27228
27485
|
}).configureOutput({
|
|
@@ -27244,6 +27501,20 @@ function createProgram(run, notify) {
|
|
|
27244
27501
|
for (const [name, definition] of Object.entries(commands)) {
|
|
27245
27502
|
addGameCommand(program2, run, notify, name, definition);
|
|
27246
27503
|
}
|
|
27504
|
+
for (const [name, group] of Object.entries(commandGroups)) {
|
|
27505
|
+
const groupCommand = program2.command(name).description(group.help);
|
|
27506
|
+
trackHelp(groupCommand, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
|
|
27507
|
+
groupCommand.action(() => groupCommand.help());
|
|
27508
|
+
for (const [command2, definition] of Object.entries(group.commands)) {
|
|
27509
|
+
addGameCommand(
|
|
27510
|
+
groupCommand,
|
|
27511
|
+
run,
|
|
27512
|
+
notify,
|
|
27513
|
+
`${name} ${command2}`,
|
|
27514
|
+
definition
|
|
27515
|
+
);
|
|
27516
|
+
}
|
|
27517
|
+
}
|
|
27247
27518
|
return program2;
|
|
27248
27519
|
}
|
|
27249
27520
|
function trackHelp(command2, run, target2, helpCommand) {
|
|
@@ -27260,8 +27531,11 @@ function trackHelp(command2, run, target2, helpCommand) {
|
|
|
27260
27531
|
function addSchemaCommand(program2, run) {
|
|
27261
27532
|
const schemaCommand = program2.command("schema").description(
|
|
27262
27533
|
"Read the local input structure for a command. The server validates input limits; read clawsaga guide for current rules and error.fields when input is rejected."
|
|
27263
|
-
).argument(
|
|
27264
|
-
|
|
27534
|
+
).argument(
|
|
27535
|
+
"<command...>",
|
|
27536
|
+
"Game command name, such as gather or house build"
|
|
27537
|
+
).action((words) => {
|
|
27538
|
+
const definition = gameCommands[words.join(" ")];
|
|
27265
27539
|
if (!definition) {
|
|
27266
27540
|
throw invalidArguments(
|
|
27267
27541
|
["command"],
|
|
@@ -27331,8 +27605,8 @@ function addDocumentCommands(program2, run) {
|
|
|
27331
27605
|
).login();
|
|
27332
27606
|
});
|
|
27333
27607
|
}
|
|
27334
|
-
function addGameCommand(
|
|
27335
|
-
const command2 =
|
|
27608
|
+
function addGameCommand(parent, run, notify, name, definition) {
|
|
27609
|
+
const command2 = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
|
|
27336
27610
|
for (const [flags, description] of definition.flags) {
|
|
27337
27611
|
command2.option(flags, description);
|
|
27338
27612
|
}
|