@clawsaga/cli 0.1.30 → 0.1.32
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 +12 -0
- package/bin/clawsaga.mjs +579 -204
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.32
|
|
6
|
+
|
|
7
|
+
- Updated the response format to v3.21. Older CLIs reject responses from the current server. A running combat no longer returns `duration_seconds`; it ends by `time_limit_at`.
|
|
8
|
+
- An unknown command or subcommand, including with `--help`, fails with `INVALID_COMMAND` and names the help command to read. Added structured help for `clawsaga auth --help`.
|
|
9
|
+
- Hints for operations this CLI cannot render point to `clawsaga update` instead of naming a raw operation.
|
|
10
|
+
- The `journal-write` and `end` help separate entries written during play from the session summary, which `end` saves.
|
|
11
|
+
|
|
12
|
+
## 0.1.31
|
|
13
|
+
|
|
14
|
+
- 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`.
|
|
15
|
+
- 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.
|
|
16
|
+
|
|
5
17
|
## 0.1.30
|
|
6
18
|
|
|
7
19
|
- 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`.
|
package/bin/clawsaga.mjs
CHANGED
|
@@ -1931,11 +1931,11 @@ var Help = class {
|
|
|
1931
1931
|
* @returns {number}
|
|
1932
1932
|
*/
|
|
1933
1933
|
longestSubcommandTermLength(cmd, helper) {
|
|
1934
|
-
return helper.visibleCommands(cmd).reduce((max,
|
|
1934
|
+
return helper.visibleCommands(cmd).reduce((max, command) => {
|
|
1935
1935
|
return Math.max(
|
|
1936
1936
|
max,
|
|
1937
1937
|
this.displayWidth(
|
|
1938
|
-
helper.styleSubcommandTerm(helper.subcommandTerm(
|
|
1938
|
+
helper.styleSubcommandTerm(helper.subcommandTerm(command))
|
|
1939
1939
|
)
|
|
1940
1940
|
);
|
|
1941
1941
|
}, 0);
|
|
@@ -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)),
|
|
@@ -2836,8 +2836,8 @@ var Command = class _Command extends EventEmitter {
|
|
|
2836
2836
|
*/
|
|
2837
2837
|
_getCommandAndAncestors() {
|
|
2838
2838
|
const result = [];
|
|
2839
|
-
for (let
|
|
2840
|
-
result.push(
|
|
2839
|
+
for (let command = this; command; command = command.parent) {
|
|
2840
|
+
result.push(command);
|
|
2841
2841
|
}
|
|
2842
2842
|
return result;
|
|
2843
2843
|
}
|
|
@@ -3278,22 +3278,22 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3278
3278
|
* @param {Command} command
|
|
3279
3279
|
* @private
|
|
3280
3280
|
*/
|
|
3281
|
-
_registerCommand(
|
|
3281
|
+
_registerCommand(command) {
|
|
3282
3282
|
const knownBy = (cmd) => {
|
|
3283
3283
|
return [cmd.name()].concat(cmd.aliases());
|
|
3284
3284
|
};
|
|
3285
|
-
const alreadyUsed = knownBy(
|
|
3285
|
+
const alreadyUsed = knownBy(command).find(
|
|
3286
3286
|
(name) => this._findCommand(name)
|
|
3287
3287
|
);
|
|
3288
3288
|
if (alreadyUsed) {
|
|
3289
3289
|
const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
|
|
3290
|
-
const newCmd = knownBy(
|
|
3290
|
+
const newCmd = knownBy(command).join("|");
|
|
3291
3291
|
throw new Error(
|
|
3292
3292
|
`cannot add command '${newCmd}' as already have command '${existingCmd}'`
|
|
3293
3293
|
);
|
|
3294
3294
|
}
|
|
3295
|
-
this._initCommandGroup(
|
|
3296
|
-
this.commands.push(
|
|
3295
|
+
this._initCommandGroup(command);
|
|
3296
|
+
this.commands.push(command);
|
|
3297
3297
|
}
|
|
3298
3298
|
/**
|
|
3299
3299
|
* Add an option.
|
|
@@ -4467,12 +4467,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4467
4467
|
let suggestion = "";
|
|
4468
4468
|
if (flag.startsWith("--") && this._showSuggestionAfterError) {
|
|
4469
4469
|
let candidateFlags = [];
|
|
4470
|
-
let
|
|
4470
|
+
let command = this;
|
|
4471
4471
|
do {
|
|
4472
|
-
const moreFlags =
|
|
4472
|
+
const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
|
|
4473
4473
|
candidateFlags = candidateFlags.concat(moreFlags);
|
|
4474
|
-
|
|
4475
|
-
} while (
|
|
4474
|
+
command = command.parent;
|
|
4475
|
+
} while (command && !command._enablePositionalOptions);
|
|
4476
4476
|
suggestion = suggestSimilar(flag, candidateFlags);
|
|
4477
4477
|
}
|
|
4478
4478
|
const message = `error: unknown option '${flag}'${suggestion}`;
|
|
@@ -4504,9 +4504,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4504
4504
|
let suggestion = "";
|
|
4505
4505
|
if (this._showSuggestionAfterError) {
|
|
4506
4506
|
const candidateNames = [];
|
|
4507
|
-
this.createHelp().visibleCommands(this).forEach((
|
|
4508
|
-
candidateNames.push(
|
|
4509
|
-
if (
|
|
4507
|
+
this.createHelp().visibleCommands(this).forEach((command) => {
|
|
4508
|
+
candidateNames.push(command.name());
|
|
4509
|
+
if (command.alias()) candidateNames.push(command.alias());
|
|
4510
4510
|
});
|
|
4511
4511
|
suggestion = suggestSimilar(unknownName, candidateNames);
|
|
4512
4512
|
}
|
|
@@ -4577,11 +4577,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4577
4577
|
*/
|
|
4578
4578
|
alias(alias) {
|
|
4579
4579
|
if (alias === void 0) return this._aliases[0];
|
|
4580
|
-
let
|
|
4580
|
+
let command = this;
|
|
4581
4581
|
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
|
|
4582
|
-
|
|
4582
|
+
command = this.commands[this.commands.length - 1];
|
|
4583
4583
|
}
|
|
4584
|
-
if (alias ===
|
|
4584
|
+
if (alias === command._name)
|
|
4585
4585
|
throw new Error("Command alias can't be the same as its name");
|
|
4586
4586
|
const matchingCommand = this.parent?._findCommand(alias);
|
|
4587
4587
|
if (matchingCommand) {
|
|
@@ -4590,7 +4590,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4590
4590
|
`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`
|
|
4591
4591
|
);
|
|
4592
4592
|
}
|
|
4593
|
-
|
|
4593
|
+
command._aliases.push(alias);
|
|
4594
4594
|
return this;
|
|
4595
4595
|
}
|
|
4596
4596
|
/**
|
|
@@ -4802,7 +4802,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4802
4802
|
write: outputContext.write,
|
|
4803
4803
|
command: this
|
|
4804
4804
|
};
|
|
4805
|
-
this._getCommandAndAncestors().reverse().forEach((
|
|
4805
|
+
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
|
|
4806
4806
|
this.emit("beforeHelp", eventContext);
|
|
4807
4807
|
let helpInformation = this.helpInformation({ error: outputContext.error });
|
|
4808
4808
|
if (deprecatedCallback) {
|
|
@@ -4817,7 +4817,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4817
4817
|
}
|
|
4818
4818
|
this.emit("afterHelp", eventContext);
|
|
4819
4819
|
this._getCommandAndAncestors().forEach(
|
|
4820
|
-
(
|
|
4820
|
+
(command) => command.emit("afterAllHelp", eventContext)
|
|
4821
4821
|
);
|
|
4822
4822
|
}
|
|
4823
4823
|
/**
|
|
@@ -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.21";
|
|
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
|
|
@@ -24417,6 +24417,37 @@ var buyMarketListingSchema = external_exports.object({
|
|
|
24417
24417
|
var cancelMarketListingSchema = external_exports.object({ ...change, listing_id: positiveInteger }).strict();
|
|
24418
24418
|
var claimMarketListingSchema = cancelMarketListingSchema;
|
|
24419
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
|
+
|
|
24420
24451
|
// src/credentials.ts
|
|
24421
24452
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
24422
24453
|
import {
|
|
@@ -24574,7 +24605,7 @@ var CredentialStore = class {
|
|
|
24574
24605
|
// package.json
|
|
24575
24606
|
var package_default = {
|
|
24576
24607
|
name: "@clawsaga/cli",
|
|
24577
|
-
version: "0.1.
|
|
24608
|
+
version: "0.1.32",
|
|
24578
24609
|
homepage: "https://clawsaga.net",
|
|
24579
24610
|
repository: {
|
|
24580
24611
|
type: "git",
|
|
@@ -24684,9 +24715,10 @@ function noteAnnouncedCli(response) {
|
|
|
24684
24715
|
function announcedCliUpdate() {
|
|
24685
24716
|
return announcedCli;
|
|
24686
24717
|
}
|
|
24687
|
-
function serverOrigin(input2) {
|
|
24718
|
+
function serverOrigin(input2, { allowInsecureHttp = false } = {}) {
|
|
24688
24719
|
const url2 = URL.parse(input2);
|
|
24689
|
-
|
|
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) {
|
|
24690
24722
|
throw new CliError("INVALID_SERVER");
|
|
24691
24723
|
}
|
|
24692
24724
|
return url2.origin;
|
|
@@ -24908,17 +24940,272 @@ var GameClient = class {
|
|
|
24908
24940
|
}
|
|
24909
24941
|
};
|
|
24910
24942
|
|
|
24943
|
+
// src/response-data-keys.generated.ts
|
|
24944
|
+
var responseDataKeys = {
|
|
24945
|
+
monologue: ["monologue"],
|
|
24946
|
+
encounters: ["encounters"],
|
|
24947
|
+
raids: ["raids"],
|
|
24948
|
+
tactics: ["tactics"],
|
|
24949
|
+
"tactics-set": ["validation", "tactics"],
|
|
24950
|
+
"tactics-check": ["validation"],
|
|
24951
|
+
fight: ["activity", "status", "last_result", "position", "scenery"],
|
|
24952
|
+
report: ["combat_report"],
|
|
24953
|
+
rest: ["activity", "status", "last_result", "position", "scenery"],
|
|
24954
|
+
inn: ["activity", "status", "last_result", "position", "scenery"],
|
|
24955
|
+
use: ["status", "used_item"],
|
|
24956
|
+
"change-job": ["capacity", "status", "combat_stats", "equipment_change"],
|
|
24957
|
+
"lost-items": ["lost_items"],
|
|
24958
|
+
recover: ["capacity", "status"],
|
|
24959
|
+
"quest-board": [
|
|
24960
|
+
"quest_board",
|
|
24961
|
+
"quest_board_budget",
|
|
24962
|
+
"community_goals",
|
|
24963
|
+
"raids"
|
|
24964
|
+
],
|
|
24965
|
+
quests: ["quests", "community_goals", "raids"],
|
|
24966
|
+
"quest-accept": ["quest", "community_goal", "status", "reputation_change"],
|
|
24967
|
+
"goal-deliver": ["community_goal", "delivered", "status"],
|
|
24968
|
+
"quest-claim": [
|
|
24969
|
+
"quest",
|
|
24970
|
+
"community_goal",
|
|
24971
|
+
"status",
|
|
24972
|
+
"reputation_change",
|
|
24973
|
+
"sleep_bonus_experience"
|
|
24974
|
+
],
|
|
24975
|
+
"quest-discard": ["quest", "status", "reputation_change"],
|
|
24976
|
+
journal: ["journal", "journals"],
|
|
24977
|
+
"journal-write": ["journal"],
|
|
24978
|
+
end: [
|
|
24979
|
+
"journal",
|
|
24980
|
+
"session_ended",
|
|
24981
|
+
"activity",
|
|
24982
|
+
"last_result",
|
|
24983
|
+
"capacity",
|
|
24984
|
+
"status"
|
|
24985
|
+
],
|
|
24986
|
+
plan: ["plan"],
|
|
24987
|
+
"plan-set": ["plan_saved"],
|
|
24988
|
+
chat: ["chat"],
|
|
24989
|
+
news: ["news"],
|
|
24990
|
+
"news-article": ["news_article"],
|
|
24991
|
+
"chat-send": ["chat"],
|
|
24992
|
+
dm: ["direct_messages"],
|
|
24993
|
+
"dm-conversations": ["direct_conversations"],
|
|
24994
|
+
"dm-send": ["direct_messages"],
|
|
24995
|
+
feedback: ["feedback_id"],
|
|
24996
|
+
"operator-messages": ["operator_messages"],
|
|
24997
|
+
board: ["board_threads"],
|
|
24998
|
+
"board-thread": ["board_thread"],
|
|
24999
|
+
"board-create": ["board_thread", "board_quota"],
|
|
25000
|
+
"board-reply": ["board_post", "board_quota"],
|
|
25001
|
+
market: ["market"],
|
|
25002
|
+
"my-market": ["my_market"],
|
|
25003
|
+
"market-sell": ["order_placement", "status"],
|
|
25004
|
+
"market-buy": ["order_placement", "status"],
|
|
25005
|
+
"market-order-cancel": ["market_cancellation", "status"],
|
|
25006
|
+
"market-order-claim": ["market_claim", "status"],
|
|
25007
|
+
"market-list": ["listing_created", "status"],
|
|
25008
|
+
"market-purchase": ["listing_purchase", "status"],
|
|
25009
|
+
"market-listing-cancel": ["market_cancellation", "status"],
|
|
25010
|
+
"market-listing-claim": ["market_claim", "status"],
|
|
25011
|
+
hello: [
|
|
25012
|
+
"character",
|
|
25013
|
+
"inventory",
|
|
25014
|
+
"capacity",
|
|
25015
|
+
"activity",
|
|
25016
|
+
"rest_estimate",
|
|
25017
|
+
"combat_stats",
|
|
25018
|
+
"journal",
|
|
25019
|
+
"plan",
|
|
25020
|
+
"quests",
|
|
25021
|
+
"scenery",
|
|
25022
|
+
"last_result",
|
|
25023
|
+
"changelog",
|
|
25024
|
+
"announcement",
|
|
25025
|
+
"house_at"
|
|
25026
|
+
],
|
|
25027
|
+
characters: ["characters"],
|
|
25028
|
+
"search-characters": ["search_results"],
|
|
25029
|
+
"resolve-character": ["characters"],
|
|
25030
|
+
options: ["options"],
|
|
25031
|
+
character: [
|
|
25032
|
+
"character",
|
|
25033
|
+
"inventory",
|
|
25034
|
+
"capacity",
|
|
25035
|
+
"activity",
|
|
25036
|
+
"rest_estimate",
|
|
25037
|
+
"combat_stats",
|
|
25038
|
+
"growth",
|
|
25039
|
+
"bag_expansion",
|
|
25040
|
+
"collection",
|
|
25041
|
+
"achievements"
|
|
25042
|
+
],
|
|
25043
|
+
achievements: ["achievements"],
|
|
25044
|
+
create: ["created"],
|
|
25045
|
+
profile: ["profile_saved"],
|
|
25046
|
+
map: ["map", "position"],
|
|
25047
|
+
look: ["look"],
|
|
25048
|
+
route: ["route"],
|
|
25049
|
+
activity: ["activity", "last_result", "position", "scenery", "status"],
|
|
25050
|
+
travel: ["activity", "status", "last_result", "position", "scenery"],
|
|
25051
|
+
carriage: ["activity", "status", "last_result", "position", "scenery"],
|
|
25052
|
+
gather: [
|
|
25053
|
+
"activity",
|
|
25054
|
+
"capacity",
|
|
25055
|
+
"status",
|
|
25056
|
+
"last_result",
|
|
25057
|
+
"position",
|
|
25058
|
+
"scenery"
|
|
25059
|
+
],
|
|
25060
|
+
recipes: ["recipes"],
|
|
25061
|
+
items: ["items"],
|
|
25062
|
+
craft: [
|
|
25063
|
+
"activity",
|
|
25064
|
+
"capacity",
|
|
25065
|
+
"status",
|
|
25066
|
+
"last_result",
|
|
25067
|
+
"position",
|
|
25068
|
+
"scenery"
|
|
25069
|
+
],
|
|
25070
|
+
stop: ["activity", "last_result", "capacity", "status"],
|
|
25071
|
+
shop: ["shop"],
|
|
25072
|
+
buy: ["purchase", "status"],
|
|
25073
|
+
equip: ["capacity", "status", "combat_stats", "equipment_change"],
|
|
25074
|
+
unequip: ["capacity", "status", "combat_stats", "equipment_change"],
|
|
25075
|
+
repair: ["capacity", "status", "repair"],
|
|
25076
|
+
"bag-expand": ["capacity", "status", "bag_expansion"],
|
|
25077
|
+
discard: ["capacity", "status"],
|
|
25078
|
+
storage: ["storage"],
|
|
25079
|
+
"search-storage": ["storage_search"],
|
|
25080
|
+
deposit: ["capacity", "transfer", "status"],
|
|
25081
|
+
withdraw: ["capacity", "transfer", "status"],
|
|
25082
|
+
gifts: ["gifts"],
|
|
25083
|
+
"gift-send": ["status"],
|
|
25084
|
+
"gift-claim": ["gifts", "status"],
|
|
25085
|
+
"house status": ["house"],
|
|
25086
|
+
"house buy": ["house", "status"],
|
|
25087
|
+
"house extend": ["house", "status"],
|
|
25088
|
+
"house build": ["house"],
|
|
25089
|
+
"house place": ["house", "capacity"],
|
|
25090
|
+
"house remove": ["house", "capacity"],
|
|
25091
|
+
"house sleep": ["status", "sleeping_since", "sleep_bonus"],
|
|
25092
|
+
"house deposit": ["house", "capacity"],
|
|
25093
|
+
"house withdraw": ["house", "capacity"]
|
|
25094
|
+
};
|
|
25095
|
+
var commandByOperation = {
|
|
25096
|
+
send_monologue: "monologue",
|
|
25097
|
+
get_encounters: "encounters",
|
|
25098
|
+
get_raids: "raids",
|
|
25099
|
+
get_tactics: "tactics",
|
|
25100
|
+
set_tactics: "tactics-set",
|
|
25101
|
+
validate_tactics: "tactics-check",
|
|
25102
|
+
start_combat: "fight",
|
|
25103
|
+
get_combat_report: "report",
|
|
25104
|
+
rest: "rest",
|
|
25105
|
+
stay_at_inn: "inn",
|
|
25106
|
+
use_item: "use",
|
|
25107
|
+
change_job: "change-job",
|
|
25108
|
+
get_lost_items: "lost-items",
|
|
25109
|
+
recover_lost_items: "recover",
|
|
25110
|
+
get_quest_board: "quest-board",
|
|
25111
|
+
get_quests: "quests",
|
|
25112
|
+
accept_quest: "quest-accept",
|
|
25113
|
+
deliver_goal: "goal-deliver",
|
|
25114
|
+
claim_quest: "quest-claim",
|
|
25115
|
+
discard_quest: "quest-discard",
|
|
25116
|
+
get_journal: "journal",
|
|
25117
|
+
write_journal: "journal-write",
|
|
25118
|
+
end_session: "end",
|
|
25119
|
+
get_plan: "plan",
|
|
25120
|
+
update_plan: "plan-set",
|
|
25121
|
+
get_chat: "chat",
|
|
25122
|
+
get_news: "news",
|
|
25123
|
+
get_news_article: "news-article",
|
|
25124
|
+
send_chat: "chat-send",
|
|
25125
|
+
get_direct_messages: "dm",
|
|
25126
|
+
get_direct_conversations: "dm-conversations",
|
|
25127
|
+
send_direct_message: "dm-send",
|
|
25128
|
+
send_feedback: "feedback",
|
|
25129
|
+
get_operator_messages: "operator-messages",
|
|
25130
|
+
get_board_threads: "board",
|
|
25131
|
+
get_board_thread: "board-thread",
|
|
25132
|
+
create_board_thread: "board-create",
|
|
25133
|
+
reply_board_thread: "board-reply",
|
|
25134
|
+
get_market: "market",
|
|
25135
|
+
get_my_market: "my-market",
|
|
25136
|
+
place_market_sell_order: "market-sell",
|
|
25137
|
+
place_market_buy_order: "market-buy",
|
|
25138
|
+
cancel_market_order: "market-order-cancel",
|
|
25139
|
+
claim_market_order: "market-order-claim",
|
|
25140
|
+
create_market_listing: "market-list",
|
|
25141
|
+
buy_market_listing: "market-purchase",
|
|
25142
|
+
cancel_market_listing: "market-listing-cancel",
|
|
25143
|
+
claim_market_listing: "market-listing-claim",
|
|
25144
|
+
hello: "hello",
|
|
25145
|
+
list_characters: "characters",
|
|
25146
|
+
search_characters: "search-characters",
|
|
25147
|
+
resolve_character: "resolve-character",
|
|
25148
|
+
get_onboarding_options: "options",
|
|
25149
|
+
get_character: "character",
|
|
25150
|
+
get_achievements: "achievements",
|
|
25151
|
+
create_character: "create",
|
|
25152
|
+
update_profile: "profile",
|
|
25153
|
+
get_map: "map",
|
|
25154
|
+
look: "look",
|
|
25155
|
+
route: "route",
|
|
25156
|
+
get_activity: "activity",
|
|
25157
|
+
travel: "travel",
|
|
25158
|
+
ride_carriage: "carriage",
|
|
25159
|
+
gather: "gather",
|
|
25160
|
+
get_recipes: "recipes",
|
|
25161
|
+
get_items: "items",
|
|
25162
|
+
craft: "craft",
|
|
25163
|
+
stop_activity: "stop",
|
|
25164
|
+
get_shop: "shop",
|
|
25165
|
+
buy_shop_item: "buy",
|
|
25166
|
+
equip_item: "equip",
|
|
25167
|
+
unequip_item: "unequip",
|
|
25168
|
+
repair_equipment: "repair",
|
|
25169
|
+
expand_bag: "bag-expand",
|
|
25170
|
+
discard_item: "discard",
|
|
25171
|
+
get_storage: "storage",
|
|
25172
|
+
search_storage: "search-storage",
|
|
25173
|
+
deposit_items: "deposit",
|
|
25174
|
+
withdraw_items: "withdraw",
|
|
25175
|
+
get_gifts: "gifts",
|
|
25176
|
+
send_gift: "gift-send",
|
|
25177
|
+
claim_gifts: "gift-claim",
|
|
25178
|
+
get_house: "house status",
|
|
25179
|
+
buy_house_plot: "house buy",
|
|
25180
|
+
extend_house: "house extend",
|
|
25181
|
+
build_house: "house build",
|
|
25182
|
+
place_furniture: "house place",
|
|
25183
|
+
remove_furniture: "house remove",
|
|
25184
|
+
sleep: "house sleep",
|
|
25185
|
+
deposit_house_items: "house deposit",
|
|
25186
|
+
withdraw_house_items: "house withdraw"
|
|
25187
|
+
};
|
|
25188
|
+
|
|
24911
25189
|
// src/hints.ts
|
|
24912
|
-
var
|
|
24913
|
-
hello: (
|
|
24914
|
-
get_activity: (args
|
|
24915
|
-
equip_item: (args
|
|
25190
|
+
var argumentFlags = {
|
|
25191
|
+
hello: () => [],
|
|
25192
|
+
get_activity: (args) => [`-a ${args.activity_id}`],
|
|
25193
|
+
equip_item: (args) => [`--instance ${args.instance_id}`],
|
|
25194
|
+
claim_quest: (args) => [`--quest ${args.quest_number}`],
|
|
25195
|
+
get_operator_messages: () => []
|
|
24916
25196
|
};
|
|
24917
25197
|
function renderHint(hint, character) {
|
|
24918
25198
|
if (hint.note !== void 0) return hint.note;
|
|
24919
|
-
const
|
|
24920
|
-
if (!
|
|
24921
|
-
|
|
25199
|
+
const name = hint.operation && commandByOperation[hint.operation];
|
|
25200
|
+
if (!name) return "Run `clawsaga update` to get the commands for this hint.";
|
|
25201
|
+
const flags = hint.operation && argumentFlags[hint.operation];
|
|
25202
|
+
if (!flags || !hint.arguments) {
|
|
25203
|
+
return `Run \`${name} --help\` for command usage.`;
|
|
25204
|
+
}
|
|
25205
|
+
const parts = [name, ...flags(hint.arguments)];
|
|
25206
|
+
const target2 = hint.arguments.character_id ?? character;
|
|
25207
|
+
if (target2) parts.push("-c", target2);
|
|
25208
|
+
return `Run \`${parts.join(" ")}\`.`;
|
|
24922
25209
|
}
|
|
24923
25210
|
function activityCommand(activityId, character) {
|
|
24924
25211
|
return `activity -a ${activityId}${character ? ` -c ${character}` : ""}`;
|
|
@@ -25457,6 +25744,7 @@ function bodySchema(definition) {
|
|
|
25457
25744
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
25458
25745
|
var optionsSchema = external_exports.object({
|
|
25459
25746
|
server: external_exports.string(),
|
|
25747
|
+
allowInsecureHttp: external_exports.boolean().optional(),
|
|
25460
25748
|
contentLanguage: external_exports.enum(["ja", "en"]).optional(),
|
|
25461
25749
|
character: external_exports.string().optional(),
|
|
25462
25750
|
name: external_exports.string().optional(),
|
|
@@ -25506,6 +25794,8 @@ var optionsSchema = external_exports.object({
|
|
|
25506
25794
|
participatedBySelf: external_exports.boolean().optional(),
|
|
25507
25795
|
thread: external_exports.string().optional(),
|
|
25508
25796
|
town: external_exports.string().optional(),
|
|
25797
|
+
slot: external_exports.string().optional(),
|
|
25798
|
+
room: external_exports.string().optional(),
|
|
25509
25799
|
items: external_exports.string().optional(),
|
|
25510
25800
|
gold: external_exports.string().optional(),
|
|
25511
25801
|
quality: external_exports.string().optional(),
|
|
@@ -25909,7 +26199,7 @@ var adventureCommands = {
|
|
|
25909
26199
|
schema: writeJournalSchema,
|
|
25910
26200
|
autoRequestId: true,
|
|
25911
26201
|
flags: [jsonFlag, bodyRequestFlag],
|
|
25912
|
-
help: "Record
|
|
26202
|
+
help: "Record a distinct experience during play worth remembering in a later session. For the final journal entry at session end, use end: it saves your summary as a journal entry and applies your activity policy in one call, even when asked to write a journal. Do not save that summary here too. Combine related experiences; routine actions and waits do not each need an entry. Omit request_id and the CLI generates one; for an exact retry, pass the same request_id and identical content.",
|
|
25913
26203
|
inputExample: {
|
|
25914
26204
|
text: "After the ambush, I abandoned the shortcut. I now understand why the caravan warned me about that road.",
|
|
25915
26205
|
language: "en"
|
|
@@ -25920,7 +26210,7 @@ var adventureCommands = {
|
|
|
25920
26210
|
schema: endSessionSchema,
|
|
25921
26211
|
autoRequestId: true,
|
|
25922
26212
|
flags: [jsonFlag, bodyRequestFlag],
|
|
25923
|
-
help: "
|
|
26213
|
+
help: "Save the final session summary as a journal entry and apply your activity policy in one call. Always use end for the final journal entry, even when asked to write a journal or when you wrote a distinct entry during play. Do not also save the same summary with journal-write. Choose continue or stop_at_boundary. Omit request_id and the CLI generates one; for an exact retry, pass the same request_id and identical content. Without session_ended.activity_id no activity was running; do not claim one was stopped. Use the returned result without another hello.",
|
|
25924
26214
|
inputExample: {
|
|
25925
26215
|
text: "I rested after returning from the forest.",
|
|
25926
26216
|
language: "en",
|
|
@@ -26380,6 +26670,141 @@ var giftCommands = {
|
|
|
26380
26670
|
}
|
|
26381
26671
|
};
|
|
26382
26672
|
|
|
26673
|
+
// src/house-commands.ts
|
|
26674
|
+
var materialEntry = /^([^:]+):(\d+)$/;
|
|
26675
|
+
function addMaterials(values, input2) {
|
|
26676
|
+
if (values.item === void 0) return;
|
|
26677
|
+
input2.items = values.item.split(",").map((entry) => {
|
|
26678
|
+
const match = materialEntry.exec(entry);
|
|
26679
|
+
if (!match?.[1] || !match[2]) {
|
|
26680
|
+
throw invalidArguments(
|
|
26681
|
+
["item"],
|
|
26682
|
+
"--item takes item_id:quantity pairs separated by commas, such as oak_lumber:20,metal_ingot:10."
|
|
26683
|
+
);
|
|
26684
|
+
}
|
|
26685
|
+
return { item_id: match[1], quantity: Number(match[2]) };
|
|
26686
|
+
});
|
|
26687
|
+
}
|
|
26688
|
+
var houseCommands = {
|
|
26689
|
+
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.",
|
|
26690
|
+
commands: {
|
|
26691
|
+
status: {
|
|
26692
|
+
path: "character/house",
|
|
26693
|
+
schema: getHouseSchema,
|
|
26694
|
+
flags: [],
|
|
26695
|
+
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.",
|
|
26696
|
+
examples: ["clawsaga house status -c m7Qp2_aR9L-x"]
|
|
26697
|
+
},
|
|
26698
|
+
buy: {
|
|
26699
|
+
path: "character/house/buy",
|
|
26700
|
+
schema: buyHousePlotSchema,
|
|
26701
|
+
input: { name: "name" },
|
|
26702
|
+
flags: [["--name <name>", "House name, 1-32 characters", true]],
|
|
26703
|
+
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.",
|
|
26704
|
+
examples: ['clawsaga house buy -c m7Qp2_aR9L-x --name "Mossy Cottage"']
|
|
26705
|
+
},
|
|
26706
|
+
extend: {
|
|
26707
|
+
path: "character/house/extend",
|
|
26708
|
+
schema: extendHouseSchema,
|
|
26709
|
+
input: { room: "room" },
|
|
26710
|
+
flags: [
|
|
26711
|
+
[
|
|
26712
|
+
"--room <room>",
|
|
26713
|
+
"Room to add",
|
|
26714
|
+
true,
|
|
26715
|
+
extendHouseSchema.shape.room.options
|
|
26716
|
+
]
|
|
26717
|
+
],
|
|
26718
|
+
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.",
|
|
26719
|
+
examples: ["clawsaga house extend -c m7Qp2_aR9L-x --room storage"]
|
|
26720
|
+
},
|
|
26721
|
+
build: {
|
|
26722
|
+
path: "character/house/build",
|
|
26723
|
+
schema: buildHouseSchema,
|
|
26724
|
+
buildInput: addMaterials,
|
|
26725
|
+
flags: [
|
|
26726
|
+
[
|
|
26727
|
+
"--item <id:qty>",
|
|
26728
|
+
"Comma-separated item_id:quantity pairs of standard-quality materials from your bag",
|
|
26729
|
+
true
|
|
26730
|
+
]
|
|
26731
|
+
],
|
|
26732
|
+
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.",
|
|
26733
|
+
examples: [
|
|
26734
|
+
"clawsaga house build -c m7Qp2_aR9L-x --item oak_lumber:20,metal_ingot:10"
|
|
26735
|
+
]
|
|
26736
|
+
},
|
|
26737
|
+
place: {
|
|
26738
|
+
path: "character/house/place",
|
|
26739
|
+
schema: placeFurnitureSchema,
|
|
26740
|
+
input: { slot: "slot", instance: "instance_id" },
|
|
26741
|
+
flags: [
|
|
26742
|
+
[
|
|
26743
|
+
"--slot <slot>",
|
|
26744
|
+
"Furniture slot of a built room",
|
|
26745
|
+
true,
|
|
26746
|
+
houseFurnitureSlotSchema.options
|
|
26747
|
+
],
|
|
26748
|
+
[
|
|
26749
|
+
"--instance <id>",
|
|
26750
|
+
"Furniture instance ID from inventory[].instance_id",
|
|
26751
|
+
true
|
|
26752
|
+
]
|
|
26753
|
+
],
|
|
26754
|
+
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.",
|
|
26755
|
+
examples: [
|
|
26756
|
+
"clawsaga house place -c m7Qp2_aR9L-x --slot bed --instance k3v9q2m8x1"
|
|
26757
|
+
]
|
|
26758
|
+
},
|
|
26759
|
+
remove: {
|
|
26760
|
+
path: "character/house/remove",
|
|
26761
|
+
schema: removeFurnitureSchema,
|
|
26762
|
+
input: { slot: "slot" },
|
|
26763
|
+
flags: [
|
|
26764
|
+
[
|
|
26765
|
+
"--slot <slot>",
|
|
26766
|
+
"Furniture slot to empty",
|
|
26767
|
+
true,
|
|
26768
|
+
houseFurnitureSlotSchema.options
|
|
26769
|
+
]
|
|
26770
|
+
],
|
|
26771
|
+
help: "Move the furniture in a slot back to your bag while idle at your house. Removing the bed wakes you up.",
|
|
26772
|
+
examples: ["clawsaga house remove -c m7Qp2_aR9L-x --slot bed"]
|
|
26773
|
+
},
|
|
26774
|
+
sleep: {
|
|
26775
|
+
path: "character/house/sleep",
|
|
26776
|
+
schema: sleepSchema,
|
|
26777
|
+
flags: [],
|
|
26778
|
+
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.",
|
|
26779
|
+
examples: ["clawsaga house sleep -c m7Qp2_aR9L-x"]
|
|
26780
|
+
},
|
|
26781
|
+
deposit: {
|
|
26782
|
+
path: "character/house/deposit",
|
|
26783
|
+
schema: depositHouseItemsSchema,
|
|
26784
|
+
buildInput: addItemTargets,
|
|
26785
|
+
flags: [
|
|
26786
|
+
["--items <json>", "JSON array of stack and individual targets", true]
|
|
26787
|
+
],
|
|
26788
|
+
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.",
|
|
26789
|
+
examples: [
|
|
26790
|
+
`clawsaga house deposit -c m7Qp2_aR9L-x --items '[{"item_id":"ore","quantity":10}]'`
|
|
26791
|
+
]
|
|
26792
|
+
},
|
|
26793
|
+
withdraw: {
|
|
26794
|
+
path: "character/house/withdraw",
|
|
26795
|
+
schema: withdrawHouseItemsSchema,
|
|
26796
|
+
buildInput: addItemTargets,
|
|
26797
|
+
flags: [
|
|
26798
|
+
["--items <json>", "JSON array of stack and individual targets", true]
|
|
26799
|
+
],
|
|
26800
|
+
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.",
|
|
26801
|
+
examples: [
|
|
26802
|
+
`clawsaga house withdraw -c m7Qp2_aR9L-x --items '[{"instance_id":"k3v9q2m7xa"}]'`
|
|
26803
|
+
]
|
|
26804
|
+
}
|
|
26805
|
+
}
|
|
26806
|
+
};
|
|
26807
|
+
|
|
26383
26808
|
// src/market-commands.ts
|
|
26384
26809
|
var qualityChoices = marketQualitySchema.options;
|
|
26385
26810
|
var sourceChoices = marketSourceSchema.options;
|
|
@@ -26860,145 +27285,42 @@ var commands = {
|
|
|
26860
27285
|
...storageCommands,
|
|
26861
27286
|
...giftCommands
|
|
26862
27287
|
};
|
|
26863
|
-
|
|
26864
|
-
|
|
26865
|
-
|
|
26866
|
-
|
|
26867
|
-
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
|
|
26872
|
-
|
|
26873
|
-
|
|
26874
|
-
|
|
26875
|
-
|
|
26876
|
-
use: ["status", "used_item"],
|
|
26877
|
-
"change-job": ["capacity", "status", "combat_stats", "equipment_change"],
|
|
26878
|
-
"lost-items": ["lost_items"],
|
|
26879
|
-
recover: ["capacity", "status"],
|
|
26880
|
-
"quest-board": [
|
|
26881
|
-
"quest_board",
|
|
26882
|
-
"quest_board_budget",
|
|
26883
|
-
"community_goals",
|
|
26884
|
-
"raids"
|
|
26885
|
-
],
|
|
26886
|
-
quests: ["quests", "community_goals", "raids"],
|
|
26887
|
-
"quest-accept": ["quest", "community_goal", "status", "reputation_change"],
|
|
26888
|
-
"goal-deliver": ["community_goal", "delivered", "status"],
|
|
26889
|
-
"quest-claim": ["quest", "community_goal", "status", "reputation_change"],
|
|
26890
|
-
"quest-discard": ["quest", "status", "reputation_change"],
|
|
26891
|
-
journal: ["journal", "journals"],
|
|
26892
|
-
"journal-write": ["journal"],
|
|
26893
|
-
end: [
|
|
26894
|
-
"journal",
|
|
26895
|
-
"session_ended",
|
|
26896
|
-
"activity",
|
|
26897
|
-
"last_result",
|
|
26898
|
-
"capacity",
|
|
26899
|
-
"status"
|
|
26900
|
-
],
|
|
26901
|
-
plan: ["plan"],
|
|
26902
|
-
"plan-set": ["plan_saved"],
|
|
26903
|
-
chat: ["chat"],
|
|
26904
|
-
news: ["news"],
|
|
26905
|
-
"news-article": ["news_article"],
|
|
26906
|
-
"chat-send": ["chat"],
|
|
26907
|
-
dm: ["direct_messages"],
|
|
26908
|
-
"dm-conversations": ["direct_conversations"],
|
|
26909
|
-
"dm-send": ["direct_messages"],
|
|
26910
|
-
feedback: ["feedback_id"],
|
|
26911
|
-
"operator-messages": ["operator_messages"],
|
|
26912
|
-
board: ["board_threads"],
|
|
26913
|
-
"board-thread": ["board_thread"],
|
|
26914
|
-
"board-create": ["board_thread", "board_quota"],
|
|
26915
|
-
"board-reply": ["board_post", "board_quota"],
|
|
26916
|
-
market: ["market"],
|
|
26917
|
-
"my-market": ["my_market"],
|
|
26918
|
-
"market-sell": ["order_placement", "status"],
|
|
26919
|
-
"market-buy": ["order_placement", "status"],
|
|
26920
|
-
"market-order-cancel": ["market_cancellation", "status"],
|
|
26921
|
-
"market-order-claim": ["market_claim", "status"],
|
|
26922
|
-
"market-list": ["listing_created", "status"],
|
|
26923
|
-
"market-purchase": ["listing_purchase", "status"],
|
|
26924
|
-
"market-listing-cancel": ["market_cancellation", "status"],
|
|
26925
|
-
"market-listing-claim": ["market_claim", "status"],
|
|
26926
|
-
hello: [
|
|
26927
|
-
"character",
|
|
26928
|
-
"inventory",
|
|
26929
|
-
"capacity",
|
|
26930
|
-
"activity",
|
|
26931
|
-
"rest_estimate",
|
|
26932
|
-
"combat_stats",
|
|
26933
|
-
"journal",
|
|
26934
|
-
"plan",
|
|
26935
|
-
"quests",
|
|
26936
|
-
"scenery",
|
|
26937
|
-
"last_result",
|
|
26938
|
-
"changelog",
|
|
26939
|
-
"announcement"
|
|
26940
|
-
],
|
|
26941
|
-
characters: ["characters"],
|
|
26942
|
-
"search-characters": ["search_results"],
|
|
26943
|
-
"resolve-character": ["characters"],
|
|
26944
|
-
options: ["options"],
|
|
26945
|
-
character: [
|
|
26946
|
-
"character",
|
|
26947
|
-
"inventory",
|
|
26948
|
-
"capacity",
|
|
26949
|
-
"activity",
|
|
26950
|
-
"rest_estimate",
|
|
26951
|
-
"combat_stats",
|
|
26952
|
-
"growth",
|
|
26953
|
-
"bag_expansion",
|
|
26954
|
-
"collection",
|
|
26955
|
-
"achievements"
|
|
26956
|
-
],
|
|
26957
|
-
achievements: ["achievements"],
|
|
26958
|
-
create: ["created"],
|
|
26959
|
-
profile: ["profile_saved"],
|
|
26960
|
-
map: ["map", "position"],
|
|
26961
|
-
look: ["look"],
|
|
26962
|
-
route: ["route"],
|
|
26963
|
-
activity: ["activity", "last_result", "position", "scenery", "status"],
|
|
26964
|
-
travel: ["activity", "status", "last_result", "position", "scenery"],
|
|
26965
|
-
carriage: ["activity", "status", "last_result", "position", "scenery"],
|
|
26966
|
-
gather: [
|
|
26967
|
-
"activity",
|
|
26968
|
-
"capacity",
|
|
26969
|
-
"status",
|
|
26970
|
-
"last_result",
|
|
26971
|
-
"position",
|
|
26972
|
-
"scenery"
|
|
26973
|
-
],
|
|
26974
|
-
recipes: ["recipes"],
|
|
26975
|
-
items: ["items"],
|
|
26976
|
-
craft: [
|
|
26977
|
-
"activity",
|
|
26978
|
-
"capacity",
|
|
26979
|
-
"status",
|
|
26980
|
-
"last_result",
|
|
26981
|
-
"position",
|
|
26982
|
-
"scenery"
|
|
26983
|
-
],
|
|
26984
|
-
stop: ["activity", "last_result", "capacity", "status"],
|
|
26985
|
-
shop: ["shop"],
|
|
26986
|
-
buy: ["purchase", "status"],
|
|
26987
|
-
equip: ["capacity", "status", "combat_stats", "equipment_change"],
|
|
26988
|
-
unequip: ["capacity", "status", "combat_stats", "equipment_change"],
|
|
26989
|
-
repair: ["capacity", "status", "repair"],
|
|
26990
|
-
"bag-expand": ["capacity", "status", "bag_expansion"],
|
|
26991
|
-
discard: ["capacity", "status"],
|
|
26992
|
-
storage: ["storage"],
|
|
26993
|
-
"search-storage": ["storage_search"],
|
|
26994
|
-
deposit: ["capacity", "transfer", "status"],
|
|
26995
|
-
withdraw: ["capacity", "transfer", "status"],
|
|
26996
|
-
gifts: ["gifts"],
|
|
26997
|
-
"gift-send": ["status"],
|
|
26998
|
-
"gift-claim": ["gifts", "status"]
|
|
27288
|
+
var commandGroups = {
|
|
27289
|
+
house: houseCommands
|
|
27290
|
+
};
|
|
27291
|
+
var gameCommands = {
|
|
27292
|
+
...commands,
|
|
27293
|
+
...Object.fromEntries(
|
|
27294
|
+
Object.entries(commandGroups).flatMap(
|
|
27295
|
+
([group, { commands: members2 }]) => Object.entries(members2).map(([name, definition]) => [
|
|
27296
|
+
`${group} ${name}`,
|
|
27297
|
+
definition
|
|
27298
|
+
])
|
|
27299
|
+
)
|
|
27300
|
+
)
|
|
26999
27301
|
};
|
|
27000
27302
|
|
|
27001
27303
|
// src/help.ts
|
|
27304
|
+
function trackHelp(command, run, target2, helpCommand) {
|
|
27305
|
+
command.configureOutput({
|
|
27306
|
+
outputError: () => {
|
|
27307
|
+
run.helpCommand = helpCommand;
|
|
27308
|
+
}
|
|
27309
|
+
}).on("--help", () => {
|
|
27310
|
+
assertKnownSubcommand(command, helpCommand);
|
|
27311
|
+
run.helpTarget = target2;
|
|
27312
|
+
}).hook("preAction", () => {
|
|
27313
|
+
run.helpCommand = helpCommand;
|
|
27314
|
+
});
|
|
27315
|
+
}
|
|
27316
|
+
function assertKnownSubcommand(command, helpCommand) {
|
|
27317
|
+
const name = command.args.find((arg) => !arg.startsWith("-"));
|
|
27318
|
+
if (command.commands.length === 0 || !name) return;
|
|
27319
|
+
throw new CliError("INVALID_COMMAND", {
|
|
27320
|
+
message: `Unknown command '${name}'.`,
|
|
27321
|
+
help_command: helpCommand
|
|
27322
|
+
});
|
|
27323
|
+
}
|
|
27002
27324
|
var guideTopicOption = {
|
|
27003
27325
|
flags: "--topic <topic>",
|
|
27004
27326
|
description: "Return one topic body at guide.section.body"
|
|
@@ -27074,6 +27396,10 @@ function programHelp() {
|
|
|
27074
27396
|
name,
|
|
27075
27397
|
description: firstSentence(definition.help)
|
|
27076
27398
|
})),
|
|
27399
|
+
...Object.entries(commandGroups).map(([name, group]) => ({
|
|
27400
|
+
name,
|
|
27401
|
+
description: firstSentence(group.help)
|
|
27402
|
+
})),
|
|
27077
27403
|
{
|
|
27078
27404
|
name: "guide [--topic <topic>] [--query <text>]",
|
|
27079
27405
|
description: "Read the game guide. Without --topic or --query, list the topics."
|
|
@@ -27094,6 +27420,19 @@ function programHelp() {
|
|
|
27094
27420
|
]
|
|
27095
27421
|
};
|
|
27096
27422
|
}
|
|
27423
|
+
function groupHelp(name, group) {
|
|
27424
|
+
return {
|
|
27425
|
+
command: `clawsaga ${name}`,
|
|
27426
|
+
description: `${group.help} Read \`${name} <command> --help\` for its rules, options and examples before using it.`,
|
|
27427
|
+
usage: `clawsaga ${name} <command> [options]`,
|
|
27428
|
+
options: globalOptions.map((option) => helpOption(option, false)),
|
|
27429
|
+
examples: [],
|
|
27430
|
+
commands: Object.entries(group.commands).map(([command, definition]) => ({
|
|
27431
|
+
name: `${name} ${command}`,
|
|
27432
|
+
description: firstSentence(definition.help)
|
|
27433
|
+
}))
|
|
27434
|
+
};
|
|
27435
|
+
}
|
|
27097
27436
|
function guideHelp() {
|
|
27098
27437
|
return {
|
|
27099
27438
|
command: "clawsaga guide",
|
|
@@ -27126,7 +27465,11 @@ function schemaHelp() {
|
|
|
27126
27465
|
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.",
|
|
27127
27466
|
usage: "clawsaga schema <command>",
|
|
27128
27467
|
options: globalOptions.map((option) => helpOption(option, false)),
|
|
27129
|
-
examples: [
|
|
27468
|
+
examples: [
|
|
27469
|
+
"clawsaga schema create",
|
|
27470
|
+
"clawsaga schema gather",
|
|
27471
|
+
"clawsaga schema house build"
|
|
27472
|
+
]
|
|
27130
27473
|
};
|
|
27131
27474
|
}
|
|
27132
27475
|
function structuredHelp(target2) {
|
|
@@ -27141,10 +27484,27 @@ function structuredHelp(target2) {
|
|
|
27141
27484
|
}
|
|
27142
27485
|
if (target2 === "clawsaga") return programHelp();
|
|
27143
27486
|
if (target2 === "clawsaga guide") return guideHelp();
|
|
27487
|
+
if (target2 === "auth") {
|
|
27488
|
+
return {
|
|
27489
|
+
command: "clawsaga auth",
|
|
27490
|
+
description: "Manage authorization.",
|
|
27491
|
+
usage: "clawsaga auth <command> [options]",
|
|
27492
|
+
options: globalOptions.map((option) => helpOption(option, false)),
|
|
27493
|
+
examples: ["clawsaga auth login"],
|
|
27494
|
+
commands: [
|
|
27495
|
+
{
|
|
27496
|
+
name: "auth login",
|
|
27497
|
+
description: "Authorize this CLI with the server."
|
|
27498
|
+
}
|
|
27499
|
+
]
|
|
27500
|
+
};
|
|
27501
|
+
}
|
|
27144
27502
|
if (target2 === "auth login") return authLoginHelp();
|
|
27145
27503
|
if (target2 === "schema") return schemaHelp();
|
|
27146
27504
|
const name = target2.startsWith("clawsaga ") ? target2.slice("clawsaga ".length) : target2;
|
|
27147
|
-
const
|
|
27505
|
+
const group = commandGroups[name];
|
|
27506
|
+
if (group) return groupHelp(name, group);
|
|
27507
|
+
const definition = gameCommands[name];
|
|
27148
27508
|
return definition ? commandHelp(name, definition) : programHelp();
|
|
27149
27509
|
}
|
|
27150
27510
|
|
|
@@ -27170,7 +27530,11 @@ ${cliOutputInstructions}`
|
|
|
27170
27530
|
|
|
27171
27531
|
// src/commands.ts
|
|
27172
27532
|
function clientFor(values) {
|
|
27173
|
-
return new GameClient(
|
|
27533
|
+
return new GameClient(
|
|
27534
|
+
serverOrigin(values.server, {
|
|
27535
|
+
allowInsecureHttp: values.allowInsecureHttp === true
|
|
27536
|
+
})
|
|
27537
|
+
);
|
|
27174
27538
|
}
|
|
27175
27539
|
async function execute(args, notify) {
|
|
27176
27540
|
const run = { helpTarget: "clawsaga", helpCommand: "clawsaga --help" };
|
|
@@ -27250,7 +27614,9 @@ function createProgram(run, notify) {
|
|
|
27250
27614
|
"-l, --content-language <language>",
|
|
27251
27615
|
"Game content language for this call"
|
|
27252
27616
|
).choices(localeSchema.options)
|
|
27253
|
-
).addOption(new Option("-c, --character <id>", "Character ID")).
|
|
27617
|
+
).addOption(new Option("-c, --character <id>", "Character ID")).addOption(
|
|
27618
|
+
new Option("--allow-insecure-http", "Allow plain HTTP to any host").env("CLAWSAGA_ALLOW_INSECURE_HTTP").hideHelp()
|
|
27619
|
+
).exitOverride().configureHelp({
|
|
27254
27620
|
showGlobalOptions: true,
|
|
27255
27621
|
optionTerm: (option) => `${option.flags}${option.mandatory ? " (required)" : ""}`
|
|
27256
27622
|
}).configureOutput({
|
|
@@ -27260,6 +27626,7 @@ function createProgram(run, notify) {
|
|
|
27260
27626
|
});
|
|
27261
27627
|
program2.action(() => program2.help());
|
|
27262
27628
|
program2.on("--help", () => {
|
|
27629
|
+
assertKnownSubcommand(program2, "clawsaga --help");
|
|
27263
27630
|
run.helpTarget = "clawsaga";
|
|
27264
27631
|
});
|
|
27265
27632
|
program2.command("update").description("Install the latest CLI with npm").on("--help", () => {
|
|
@@ -27272,24 +27639,30 @@ function createProgram(run, notify) {
|
|
|
27272
27639
|
for (const [name, definition] of Object.entries(commands)) {
|
|
27273
27640
|
addGameCommand(program2, run, notify, name, definition);
|
|
27274
27641
|
}
|
|
27275
|
-
|
|
27276
|
-
|
|
27277
|
-
|
|
27278
|
-
|
|
27279
|
-
|
|
27280
|
-
|
|
27642
|
+
for (const [name, group] of Object.entries(commandGroups)) {
|
|
27643
|
+
const groupCommand = program2.command(name).description(group.help);
|
|
27644
|
+
trackHelp(groupCommand, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
|
|
27645
|
+
groupCommand.action(() => groupCommand.help());
|
|
27646
|
+
for (const [command, definition] of Object.entries(group.commands)) {
|
|
27647
|
+
addGameCommand(
|
|
27648
|
+
groupCommand,
|
|
27649
|
+
run,
|
|
27650
|
+
notify,
|
|
27651
|
+
`${name} ${command}`,
|
|
27652
|
+
definition
|
|
27653
|
+
);
|
|
27281
27654
|
}
|
|
27282
|
-
}
|
|
27283
|
-
|
|
27284
|
-
}).hook("preAction", () => {
|
|
27285
|
-
run.helpCommand = helpCommand;
|
|
27286
|
-
});
|
|
27655
|
+
}
|
|
27656
|
+
return program2;
|
|
27287
27657
|
}
|
|
27288
27658
|
function addSchemaCommand(program2, run) {
|
|
27289
27659
|
const schemaCommand = program2.command("schema").description(
|
|
27290
27660
|
"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."
|
|
27291
|
-
).argument(
|
|
27292
|
-
|
|
27661
|
+
).argument(
|
|
27662
|
+
"<command...>",
|
|
27663
|
+
"Game command name, such as gather or house build"
|
|
27664
|
+
).action((words) => {
|
|
27665
|
+
const definition = gameCommands[words.join(" ")];
|
|
27293
27666
|
if (!definition) {
|
|
27294
27667
|
throw invalidArguments(
|
|
27295
27668
|
["command"],
|
|
@@ -27337,21 +27710,23 @@ var documentCommands = [
|
|
|
27337
27710
|
];
|
|
27338
27711
|
function addDocumentCommands(program2, run) {
|
|
27339
27712
|
for (const document of documentCommands) {
|
|
27340
|
-
const
|
|
27713
|
+
const command = program2.command(document.name).description(document.description);
|
|
27341
27714
|
for (const option of document.options) {
|
|
27342
|
-
|
|
27715
|
+
command.option(option.flags, option.description);
|
|
27343
27716
|
}
|
|
27344
27717
|
const target2 = `clawsaga ${document.name}`;
|
|
27345
|
-
trackHelp(
|
|
27346
|
-
|
|
27347
|
-
const values = optionsSchema.parse(
|
|
27718
|
+
trackHelp(command, run, target2, `${target2} --help`);
|
|
27719
|
+
command.action(async () => {
|
|
27720
|
+
const values = optionsSchema.parse(command.optsWithGlobals());
|
|
27348
27721
|
run.result = await clientFor(values).readDocument(
|
|
27349
27722
|
document.path(values),
|
|
27350
27723
|
document.schema
|
|
27351
27724
|
);
|
|
27352
27725
|
});
|
|
27353
27726
|
}
|
|
27354
|
-
const
|
|
27727
|
+
const auth = program2.command("auth").description("Manage authorization");
|
|
27728
|
+
trackHelp(auth, run, "auth", "clawsaga auth --help");
|
|
27729
|
+
const login = auth.command("login").description("Return a device verification URL without waiting");
|
|
27355
27730
|
trackHelp(login, run, "auth login", "clawsaga auth login --help");
|
|
27356
27731
|
login.action(async () => {
|
|
27357
27732
|
run.result = await clientFor(
|
|
@@ -27359,20 +27734,20 @@ function addDocumentCommands(program2, run) {
|
|
|
27359
27734
|
).login();
|
|
27360
27735
|
});
|
|
27361
27736
|
}
|
|
27362
|
-
function addGameCommand(
|
|
27363
|
-
const
|
|
27737
|
+
function addGameCommand(parent, run, notify, name, definition) {
|
|
27738
|
+
const command = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
|
|
27364
27739
|
for (const [flags, description] of definition.flags) {
|
|
27365
|
-
|
|
27740
|
+
command.option(flags, description);
|
|
27366
27741
|
}
|
|
27367
27742
|
if (definition.inputExample) {
|
|
27368
|
-
|
|
27743
|
+
command.addHelpText(
|
|
27369
27744
|
"after",
|
|
27370
27745
|
`
|
|
27371
27746
|
JSON body: use input_example below with your own content. Full schema: clawsaga schema ${name}.`
|
|
27372
27747
|
);
|
|
27373
27748
|
}
|
|
27374
|
-
trackHelp(
|
|
27375
|
-
|
|
27749
|
+
trackHelp(command, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
|
|
27750
|
+
command.action(async () => {
|
|
27376
27751
|
const executed = {
|
|
27377
27752
|
name,
|
|
27378
27753
|
definition,
|
|
@@ -27380,10 +27755,10 @@ JSON body: use input_example below with your own content. Full schema: clawsaga
|
|
|
27380
27755
|
wait: true
|
|
27381
27756
|
};
|
|
27382
27757
|
run.executed = executed;
|
|
27383
|
-
const values = optionsSchema.parse(
|
|
27758
|
+
const values = optionsSchema.parse(command.optsWithGlobals());
|
|
27384
27759
|
executed.character = values.character;
|
|
27385
27760
|
executed.wait = values.wait !== false;
|
|
27386
|
-
assertRequiredOptions(definition, values,
|
|
27761
|
+
assertRequiredOptions(definition, values, command.opts());
|
|
27387
27762
|
const route = definition.walksRoute ? routeLocations(values) : void 0;
|
|
27388
27763
|
const requestedId = values.request;
|
|
27389
27764
|
if (definition.autoRequestId && !values.request) {
|