@clawsaga/cli 0.1.31 → 0.1.33

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 CHANGED
@@ -2,6 +2,20 @@
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.33
6
+
7
+ - Updated the response format to v3.22. Older CLIs reject responses from the current server. Battle reports carry the items used and left, gauges and enemy MP, and status effects carry their `percent`.
8
+ - Tactics: `potion_items` is gone; `potion` and the new `cure` action take optional `item_ids`, and `potion_limit` counts both. Added the conditions `enemy_mp_below`, `gauge_at_least` and `enemy_last_action`, and `power_at_least` on `enemy_winding_up` and `enemy_attacking_heavy`.
9
+ - `craft --use-fine` uses fine intermediate materials first. `quest-deliver`, `quest-claim` and `house build` accept `--allow-quality`, and `discard --quality` discards a fine or superior stack.
10
+ - `fight --input` can be combined with `--practice`. Hints given when an activity starts, such as unused fine materials, stay on the final output.
11
+
12
+ ## 0.1.32
13
+
14
+ - 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`.
15
+ - 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`.
16
+ - Hints for operations this CLI cannot render point to `clawsaga update` instead of naming a raw operation.
17
+ - The `journal-write` and `end` help separate entries written during play from the session summary, which `end` saves.
18
+
5
19
  ## 0.1.31
6
20
 
7
21
  - 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`.
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, command2) => {
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(command2))
1938
+ helper.styleSubcommandTerm(helper.subcommandTerm(command))
1939
1939
  )
1940
1940
  );
1941
1941
  }, 0);
@@ -2836,8 +2836,8 @@ var Command = class _Command extends EventEmitter {
2836
2836
  */
2837
2837
  _getCommandAndAncestors() {
2838
2838
  const result = [];
2839
- for (let command2 = this; command2; command2 = command2.parent) {
2840
- result.push(command2);
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(command2) {
3281
+ _registerCommand(command) {
3282
3282
  const knownBy = (cmd) => {
3283
3283
  return [cmd.name()].concat(cmd.aliases());
3284
3284
  };
3285
- const alreadyUsed = knownBy(command2).find(
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(command2).join("|");
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(command2);
3296
- this.commands.push(command2);
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 command2 = this;
4470
+ let command = this;
4471
4471
  do {
4472
- const moreFlags = command2.createHelp().visibleOptions(command2).filter((option) => option.long).map((option) => option.long);
4472
+ const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
4473
4473
  candidateFlags = candidateFlags.concat(moreFlags);
4474
- command2 = command2.parent;
4475
- } while (command2 && !command2._enablePositionalOptions);
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((command2) => {
4508
- candidateNames.push(command2.name());
4509
- if (command2.alias()) candidateNames.push(command2.alias());
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 command2 = this;
4580
+ let command = this;
4581
4581
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
4582
- command2 = this.commands[this.commands.length - 1];
4582
+ command = this.commands[this.commands.length - 1];
4583
4583
  }
4584
- if (alias === command2._name)
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
- command2._aliases.push(alias);
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((command2) => command2.emit("beforeAllHelp", eventContext));
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
- (command2) => command2.emit("afterAllHelp", eventContext)
4820
+ (command) => command.emit("afterAllHelp", eventContext)
4821
4821
  );
4822
4822
  }
4823
4823
  /**
@@ -23871,6 +23871,7 @@ var activityIdSchema = external_exports.number().int().min(1);
23871
23871
  var instanceIdSchema = external_exports.string().regex(/^[0-9a-z]{10}$/);
23872
23872
  var dropIdSchema = instanceIdSchema;
23873
23873
  var itemIdSchema = external_exports.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
23874
+ var itemQualitySchema = external_exports.enum(["standard", "fine", "superior"]);
23874
23875
  var skillIdSchema = external_exports.enum([
23875
23876
  "mining",
23876
23877
  "gathering",
@@ -23963,7 +23964,7 @@ var agentResumeResponseSchema = external_exports.looseObject({
23963
23964
  var changelogResponseSchema = external_exports.looseObject({
23964
23965
  changelog: external_exports.looseObject({})
23965
23966
  });
23966
- var agentSchemaVersion = "3.20";
23967
+ var agentSchemaVersion = "3.22";
23967
23968
  var agentGameResponseSchema = external_exports.looseObject({
23968
23969
  ok: external_exports.boolean(),
23969
23970
  // The client rejects a newer version before parsing. An older server's
@@ -24026,6 +24027,7 @@ var craftSchema = external_exports.object({
24026
24027
  ...characterTarget,
24027
24028
  recipe_id: external_exports.string().min(1),
24028
24029
  max_fee_per_lot: external_exports.number().int().min(0).optional(),
24030
+ use_fine_materials: external_exports.boolean().optional(),
24029
24031
  request_id: external_exports.uuid()
24030
24032
  }).strict();
24031
24033
  var stopActivitySchema = external_exports.object({ ...characterTarget, activity_id: activityIdSchema }).strict();
@@ -24051,7 +24053,8 @@ var discardItemSchema = external_exports.object({
24051
24053
  external_exports.object({
24052
24054
  kind: external_exports.literal("stack"),
24053
24055
  item_id: itemIdSchema,
24054
- quantity: external_exports.number().int().positive()
24056
+ quantity: external_exports.number().int().positive(),
24057
+ quality: itemQualitySchema.optional()
24055
24058
  }).strict(),
24056
24059
  external_exports.object({
24057
24060
  kind: external_exports.literal("individual"),
@@ -24080,17 +24083,50 @@ var combatStatusSchema = external_exports.enum([
24080
24083
  "empowered",
24081
24084
  "regen"
24082
24085
  ]);
24086
+ var combatActionKindSchema = external_exports.enum([
24087
+ "attack",
24088
+ "heavy_attack",
24089
+ "defend",
24090
+ "ability",
24091
+ "potion",
24092
+ "cure",
24093
+ "none"
24094
+ ]);
24095
+ var heavyPowerAtLeastSchema = external_exports.number().int().min(1).optional().describe(
24096
+ "Match only a heavy attack of at least this power percent, as shown by next_heavy.power_percent."
24097
+ );
24083
24098
  var tacticConditionSchema = external_exports.discriminatedUnion("kind", [
24084
24099
  external_exports.object({
24085
- kind: external_exports.enum(["hp_below", "mp_below", "enemy_hp_below"]),
24100
+ kind: external_exports.enum([
24101
+ "hp_below",
24102
+ "mp_below",
24103
+ "enemy_hp_below",
24104
+ "enemy_mp_below"
24105
+ ]),
24086
24106
  percent: external_exports.number().int().min(1)
24087
24107
  }).strict().describe(
24088
24108
  "Matches when the named current percentage is strictly below percent. HP percentages use current / maximum HP; MP uses its 0\u2013100 value."
24089
24109
  ),
24090
- external_exports.object({ kind: external_exports.literal("enemy_winding_up") }).strict().describe(
24110
+ external_exports.object({
24111
+ kind: external_exports.literal("gauge_at_least"),
24112
+ value: external_exports.number().int().min(1)
24113
+ }).strict().describe("Matches when your gauge is at least value."),
24114
+ external_exports.object({
24115
+ kind: external_exports.literal("enemy_last_action"),
24116
+ action: combatActionKindSchema
24117
+ }).strict().describe(
24118
+ "Matches when the enemy took this kind of action on the previous tick. A heavy attack is a charged ability released; an interrupted one counts as attack. Doing nothing, charging without acting and retreating count as none."
24119
+ ),
24120
+ external_exports.object({
24121
+ kind: external_exports.literal("enemy_winding_up"),
24122
+ power_at_least: heavyPowerAtLeastSchema
24123
+ }).strict().describe(
24091
24124
  "Matches when the enemy heavy attack is at most two ticks away, including the tick it occurs."
24092
24125
  ),
24093
- external_exports.object({ kind: external_exports.literal("enemy_attacking_heavy") }).strict().describe("Matches on the tick when the enemy heavy attack occurs."),
24126
+ external_exports.object({
24127
+ kind: external_exports.literal("enemy_attacking_heavy"),
24128
+ power_at_least: heavyPowerAtLeastSchema
24129
+ }).strict().describe("Matches on the tick when the enemy heavy attack occurs."),
24094
24130
  external_exports.object({ kind: external_exports.literal("enemy_recovering") }).strict().describe("Matches on the recovery tick after a heavy attack."),
24095
24131
  external_exports.object({ kind: external_exports.literal("enemy_heavy_interruptible") }).strict().describe(
24096
24132
  "Matches when the scheduled enemy heavy attack can be interrupted."
@@ -24099,7 +24135,7 @@ var tacticConditionSchema = external_exports.discriminatedUnion("kind", [
24099
24135
  kind: external_exports.literal("potions_below"),
24100
24136
  count: external_exports.number().int().min(1)
24101
24137
  }).strict().describe(
24102
- "Matches when usable potions remaining in this battle are strictly below count."
24138
+ "Matches when the potions you can still drink in this battle, left in your bag and under potion_limit, are strictly below count."
24103
24139
  ),
24104
24140
  external_exports.object({ kind: external_exports.literal("enemy_weak_to"), damage_type: damageTypeSchema }).strict().describe("Matches when the enemy resistance for damage_type is negative."),
24105
24141
  external_exports.object({
@@ -24122,9 +24158,27 @@ var tacticConditionSchema = external_exports.discriminatedUnion("kind", [
24122
24158
  "Matches when the named enemy status has more than one tick left, or not; one tick left counts as missing."
24123
24159
  )
24124
24160
  ]);
24161
+ var battleItemIdsSchema = external_exports.array(itemIdSchema).min(1).refine(
24162
+ (itemIds) => new Set(itemIds).size === itemIds.length,
24163
+ "item_ids must not repeat"
24164
+ ).optional();
24125
24165
  var tacticActionSchema = external_exports.discriminatedUnion("kind", [
24126
- external_exports.object({ kind: external_exports.enum(["attack", "defend", "potion", "retreat"]) }).strict().describe(
24127
- "A potion action is usable only with a remaining potion and missing HP."
24166
+ external_exports.object({ kind: external_exports.enum(["attack", "defend", "retreat"]) }).strict(),
24167
+ external_exports.object({
24168
+ kind: external_exports.literal("potion"),
24169
+ item_ids: battleItemIdsSchema.describe(
24170
+ "Potions this rule may drink. When omitted, any potion usable in battle."
24171
+ )
24172
+ }).strict().describe(
24173
+ "Drinks a potion from your bag when one remains and HP is missing: the weakest that fills the missing HP, or the strongest when none does."
24174
+ ),
24175
+ external_exports.object({
24176
+ kind: external_exports.literal("cure"),
24177
+ item_ids: battleItemIdsSchema.describe(
24178
+ "Cure items this rule may use. When omitted, any cure item usable in battle."
24179
+ )
24180
+ }).strict().describe(
24181
+ "Uses a cure item from your bag when it removes a status on you: the one that removes the most of them, then the one that removes the fewest kinds of status."
24128
24182
  ),
24129
24183
  external_exports.object({ kind: external_exports.literal("ability"), ability_id: combatIdSchema }).strict().describe(
24130
24184
  "Uses the ability when it is unlocked, off cooldown, affordable in MP and its effect is currently applicable."
@@ -24142,13 +24196,7 @@ var tacticSchema = external_exports.object({
24142
24196
  "Evaluated from top to bottom each tick. The first matching, usable action runs; otherwise use a basic attack."
24143
24197
  ),
24144
24198
  potion_limit: external_exports.number().int().min(0).describe(
24145
- "Most potions one battle may use in total, capped by the bag at start. Each is consumed when used; zero disables potions."
24146
- ),
24147
- potion_items: external_exports.array(itemIdSchema).min(1).refine(
24148
- (itemIds) => new Set(itemIds).size === itemIds.length,
24149
- "potion_items must not repeat"
24150
- ).optional().describe(
24151
- "Item IDs of potions in drinking order. When omitted, drinks every potion usable in battle, weakest first."
24199
+ "Most potions and cure items one battle may use in total, taken from your bag as they are used. Unused items stay in the bag; zero disables both."
24152
24200
  )
24153
24201
  }).strict().meta({ id: "Tactic" });
24154
24202
  var presetIdSchema = external_exports.enum(["safe", "aggressive"]);
@@ -24206,12 +24254,14 @@ var deliverGoalSchema = external_exports.object({
24206
24254
  ...characterTarget,
24207
24255
  goal_id: questNumber,
24208
24256
  item_id: itemIdSchema,
24209
- quantity: questNumber
24257
+ quantity: questNumber,
24258
+ allow_quality: itemQualitySchema.optional()
24210
24259
  }).strict();
24211
24260
  var claimQuestSchema = external_exports.object({
24212
24261
  ...characterTarget,
24213
24262
  quest_number: questNumber.optional(),
24214
- goal_id: questNumber.optional()
24263
+ goal_id: questNumber.optional(),
24264
+ allow_quality: itemQualitySchema.optional()
24215
24265
  }).strict().refine(
24216
24266
  (input2) => input2.quest_number !== void 0 !== (input2.goal_id !== void 0),
24217
24267
  { message: "Supply exactly one of quest_number and goal_id" }
@@ -24366,7 +24416,6 @@ var getGiftsSchema = external_exports.object({
24366
24416
 
24367
24417
  // src/protocol/market.ts
24368
24418
  var change = { ...characterTarget, request_id: uuidSchema };
24369
- var marketQualitySchema = external_exports.enum(["standard", "fine", "superior"]);
24370
24419
  var positiveInteger = external_exports.number().int().positive();
24371
24420
  var marketSourceSchema = external_exports.enum(["carried", "storage"]);
24372
24421
  var marketSectionSchema = external_exports.enum(["orders", "listings", "trades"]);
@@ -24374,7 +24423,7 @@ var getMarketSchema = external_exports.object({
24374
24423
  ...characterTarget,
24375
24424
  town_id: locationIdSchema,
24376
24425
  item_id: itemIdSchema.optional(),
24377
- quality: marketQualitySchema.optional(),
24426
+ quality: itemQualitySchema.optional(),
24378
24427
  levels: external_exports.number().int().min(1).optional(),
24379
24428
  cursor: external_exports.number().int().positive().optional(),
24380
24429
  max_price: positiveInteger.optional(),
@@ -24388,7 +24437,7 @@ var getMyMarketSchema = external_exports.object({
24388
24437
  var placeMarketSellOrderSchema = external_exports.object({
24389
24438
  ...change,
24390
24439
  item_id: itemIdSchema,
24391
- quality: marketQualitySchema,
24440
+ quality: itemQualitySchema,
24392
24441
  quantity: positiveInteger,
24393
24442
  unit_price: positiveInteger,
24394
24443
  source: marketSourceSchema
@@ -24396,7 +24445,7 @@ var placeMarketSellOrderSchema = external_exports.object({
24396
24445
  var placeMarketBuyOrderSchema = external_exports.object({
24397
24446
  ...change,
24398
24447
  item_id: itemIdSchema,
24399
- quality: marketQualitySchema,
24448
+ quality: itemQualitySchema,
24400
24449
  quantity: positiveInteger,
24401
24450
  unit_price: positiveInteger
24402
24451
  }).strict();
@@ -24428,7 +24477,8 @@ var buildHouseSchema = external_exports.object({
24428
24477
  ...characterTarget,
24429
24478
  items: external_exports.array(
24430
24479
  external_exports.object({ item_id: itemIdSchema, quantity: external_exports.number().int().min(1) }).strict()
24431
- ).min(1)
24480
+ ).min(1),
24481
+ allow_quality: itemQualitySchema.optional()
24432
24482
  }).strict();
24433
24483
  var extendHouseSchema = external_exports.object({ ...characterTarget, room: external_exports.enum(["storage"]) }).strict();
24434
24484
  var houseFurnitureSlotSchema = external_exports.enum([
@@ -24605,7 +24655,7 @@ var CredentialStore = class {
24605
24655
  // package.json
24606
24656
  var package_default = {
24607
24657
  name: "@clawsaga/cli",
24608
- version: "0.1.31",
24658
+ version: "0.1.33",
24609
24659
  homepage: "https://clawsaga.net",
24610
24660
  repository: {
24611
24661
  type: "git",
@@ -24940,17 +24990,274 @@ var GameClient = class {
24940
24990
  }
24941
24991
  };
24942
24992
 
24993
+ // src/response-data-keys.generated.ts
24994
+ var responseDataKeys = {
24995
+ monologue: ["monologue"],
24996
+ encounters: ["encounters", "hunting_ground_thinned"],
24997
+ raids: ["raids"],
24998
+ tactics: ["tactics"],
24999
+ "tactics-set": ["validation", "tactics"],
25000
+ "tactics-check": ["validation"],
25001
+ fight: ["activity", "status", "last_result", "position", "scenery"],
25002
+ report: ["combat_report"],
25003
+ rest: ["activity", "status", "last_result", "position", "scenery"],
25004
+ inn: ["activity", "status", "last_result", "position", "scenery"],
25005
+ use: ["status", "used_item"],
25006
+ "change-job": ["capacity", "status", "combat_stats", "equipment_change"],
25007
+ "lost-items": ["lost_items"],
25008
+ recover: ["capacity", "status"],
25009
+ "quest-board": [
25010
+ "quest_board",
25011
+ "quest_board_budget",
25012
+ "community_goals",
25013
+ "raids"
25014
+ ],
25015
+ quests: ["quests", "community_goals", "raids"],
25016
+ "quest-accept": ["quest", "community_goal", "status", "reputation_change"],
25017
+ "goal-deliver": ["community_goal", "delivered", "status"],
25018
+ "quest-claim": [
25019
+ "quest",
25020
+ "community_goal",
25021
+ "status",
25022
+ "reputation_change",
25023
+ "sleep_bonus_experience"
25024
+ ],
25025
+ "quest-discard": ["quest", "status", "reputation_change"],
25026
+ journal: ["journal", "journals"],
25027
+ "journal-write": ["journal"],
25028
+ end: [
25029
+ "journal",
25030
+ "session_ended",
25031
+ "activity",
25032
+ "last_result",
25033
+ "capacity",
25034
+ "status"
25035
+ ],
25036
+ plan: ["plan"],
25037
+ "plan-set": ["plan_saved"],
25038
+ chat: ["chat"],
25039
+ news: ["news"],
25040
+ "news-article": ["news_article"],
25041
+ "chat-send": ["chat"],
25042
+ dm: ["direct_messages"],
25043
+ "dm-conversations": ["direct_conversations"],
25044
+ "dm-send": ["direct_messages"],
25045
+ feedback: ["feedback_id"],
25046
+ "operator-messages": ["operator_messages"],
25047
+ board: ["board_threads"],
25048
+ "board-thread": ["board_thread"],
25049
+ "board-create": ["board_thread", "board_quota"],
25050
+ "board-reply": ["board_post", "board_quota"],
25051
+ market: ["market"],
25052
+ "my-market": ["my_market"],
25053
+ "market-sell": ["order_placement", "status"],
25054
+ "market-buy": ["order_placement", "status"],
25055
+ "market-order-cancel": ["market_cancellation", "status"],
25056
+ "market-order-claim": ["market_claim", "status"],
25057
+ "market-list": ["listing_created", "status"],
25058
+ "market-purchase": ["listing_purchase", "status"],
25059
+ "market-listing-cancel": ["market_cancellation", "status"],
25060
+ "market-listing-claim": ["market_claim", "status"],
25061
+ hello: [
25062
+ "character",
25063
+ "inventory",
25064
+ "capacity",
25065
+ "activity",
25066
+ "rest_estimate",
25067
+ "combat_stats",
25068
+ "journal",
25069
+ "plan",
25070
+ "quests",
25071
+ "scenery",
25072
+ "last_result",
25073
+ "changelog",
25074
+ "announcement",
25075
+ "house_at"
25076
+ ],
25077
+ characters: ["characters"],
25078
+ "search-characters": ["search_results"],
25079
+ "resolve-character": ["characters"],
25080
+ options: ["options"],
25081
+ character: [
25082
+ "character",
25083
+ "inventory",
25084
+ "capacity",
25085
+ "activity",
25086
+ "rest_estimate",
25087
+ "combat_stats",
25088
+ "growth",
25089
+ "bag_expansion",
25090
+ "collection",
25091
+ "achievements"
25092
+ ],
25093
+ achievements: ["achievements"],
25094
+ create: ["created"],
25095
+ profile: ["profile_saved"],
25096
+ map: ["map", "position"],
25097
+ look: ["look"],
25098
+ route: ["route"],
25099
+ activity: ["activity", "last_result", "position", "scenery", "status"],
25100
+ travel: ["activity", "status", "last_result", "position", "scenery"],
25101
+ carriage: ["activity", "status", "last_result", "position", "scenery"],
25102
+ gather: [
25103
+ "activity",
25104
+ "capacity",
25105
+ "status",
25106
+ "last_result",
25107
+ "fine_materials_unused",
25108
+ "position",
25109
+ "scenery"
25110
+ ],
25111
+ recipes: ["recipes"],
25112
+ items: ["items"],
25113
+ craft: [
25114
+ "activity",
25115
+ "capacity",
25116
+ "status",
25117
+ "last_result",
25118
+ "fine_materials_unused",
25119
+ "position",
25120
+ "scenery"
25121
+ ],
25122
+ stop: ["activity", "last_result", "capacity", "status"],
25123
+ shop: ["shop"],
25124
+ buy: ["purchase", "status"],
25125
+ equip: ["capacity", "status", "combat_stats", "equipment_change"],
25126
+ unequip: ["capacity", "status", "combat_stats", "equipment_change"],
25127
+ repair: ["capacity", "status", "repair"],
25128
+ "bag-expand": ["capacity", "status", "bag_expansion"],
25129
+ discard: ["capacity", "status"],
25130
+ storage: ["storage"],
25131
+ "search-storage": ["storage_search"],
25132
+ deposit: ["capacity", "transfer", "status"],
25133
+ withdraw: ["capacity", "transfer", "status"],
25134
+ gifts: ["gifts"],
25135
+ "gift-send": ["status"],
25136
+ "gift-claim": ["gifts", "status"],
25137
+ "house status": ["house"],
25138
+ "house buy": ["house", "status"],
25139
+ "house extend": ["house", "status"],
25140
+ "house build": ["house"],
25141
+ "house place": ["house", "capacity"],
25142
+ "house remove": ["house", "capacity"],
25143
+ "house sleep": ["status", "sleeping_since", "sleep_bonus"],
25144
+ "house deposit": ["house", "capacity"],
25145
+ "house withdraw": ["house", "capacity"]
25146
+ };
25147
+ var commandByOperation = {
25148
+ send_monologue: "monologue",
25149
+ get_encounters: "encounters",
25150
+ get_raids: "raids",
25151
+ get_tactics: "tactics",
25152
+ set_tactics: "tactics-set",
25153
+ validate_tactics: "tactics-check",
25154
+ start_combat: "fight",
25155
+ get_combat_report: "report",
25156
+ rest: "rest",
25157
+ stay_at_inn: "inn",
25158
+ use_item: "use",
25159
+ change_job: "change-job",
25160
+ get_lost_items: "lost-items",
25161
+ recover_lost_items: "recover",
25162
+ get_quest_board: "quest-board",
25163
+ get_quests: "quests",
25164
+ accept_quest: "quest-accept",
25165
+ deliver_goal: "goal-deliver",
25166
+ claim_quest: "quest-claim",
25167
+ discard_quest: "quest-discard",
25168
+ get_journal: "journal",
25169
+ write_journal: "journal-write",
25170
+ end_session: "end",
25171
+ get_plan: "plan",
25172
+ update_plan: "plan-set",
25173
+ get_chat: "chat",
25174
+ get_news: "news",
25175
+ get_news_article: "news-article",
25176
+ send_chat: "chat-send",
25177
+ get_direct_messages: "dm",
25178
+ get_direct_conversations: "dm-conversations",
25179
+ send_direct_message: "dm-send",
25180
+ send_feedback: "feedback",
25181
+ get_operator_messages: "operator-messages",
25182
+ get_board_threads: "board",
25183
+ get_board_thread: "board-thread",
25184
+ create_board_thread: "board-create",
25185
+ reply_board_thread: "board-reply",
25186
+ get_market: "market",
25187
+ get_my_market: "my-market",
25188
+ place_market_sell_order: "market-sell",
25189
+ place_market_buy_order: "market-buy",
25190
+ cancel_market_order: "market-order-cancel",
25191
+ claim_market_order: "market-order-claim",
25192
+ create_market_listing: "market-list",
25193
+ buy_market_listing: "market-purchase",
25194
+ cancel_market_listing: "market-listing-cancel",
25195
+ claim_market_listing: "market-listing-claim",
25196
+ hello: "hello",
25197
+ list_characters: "characters",
25198
+ search_characters: "search-characters",
25199
+ resolve_character: "resolve-character",
25200
+ get_onboarding_options: "options",
25201
+ get_character: "character",
25202
+ get_achievements: "achievements",
25203
+ create_character: "create",
25204
+ update_profile: "profile",
25205
+ get_map: "map",
25206
+ look: "look",
25207
+ route: "route",
25208
+ get_activity: "activity",
25209
+ travel: "travel",
25210
+ ride_carriage: "carriage",
25211
+ gather: "gather",
25212
+ get_recipes: "recipes",
25213
+ get_items: "items",
25214
+ craft: "craft",
25215
+ stop_activity: "stop",
25216
+ get_shop: "shop",
25217
+ buy_shop_item: "buy",
25218
+ equip_item: "equip",
25219
+ unequip_item: "unequip",
25220
+ repair_equipment: "repair",
25221
+ expand_bag: "bag-expand",
25222
+ discard_item: "discard",
25223
+ get_storage: "storage",
25224
+ search_storage: "search-storage",
25225
+ deposit_items: "deposit",
25226
+ withdraw_items: "withdraw",
25227
+ get_gifts: "gifts",
25228
+ send_gift: "gift-send",
25229
+ claim_gifts: "gift-claim",
25230
+ get_house: "house status",
25231
+ buy_house_plot: "house buy",
25232
+ extend_house: "house extend",
25233
+ build_house: "house build",
25234
+ place_furniture: "house place",
25235
+ remove_furniture: "house remove",
25236
+ sleep: "house sleep",
25237
+ deposit_house_items: "house deposit",
25238
+ withdraw_house_items: "house withdraw"
25239
+ };
25240
+
24943
25241
  // src/hints.ts
24944
- var command = {
24945
- hello: (args) => `Run \`hello -c ${args.character_id}\`.`,
24946
- get_activity: (args, character) => `Run \`activity -a ${args.activity_id}${character ? ` -c ${character}` : ""}\`.`,
24947
- equip_item: (args, character) => `Run \`equip --instance ${args.instance_id}${character ? ` -c ${character}` : ""}\`.`
25242
+ var argumentFlags = {
25243
+ hello: () => [],
25244
+ get_activity: (args) => [`-a ${args.activity_id}`],
25245
+ equip_item: (args) => [`--instance ${args.instance_id}`],
25246
+ claim_quest: (args) => [`--quest ${args.quest_number}`],
25247
+ get_operator_messages: () => []
24948
25248
  };
24949
25249
  function renderHint(hint, character) {
24950
25250
  if (hint.note !== void 0) return hint.note;
24951
- const render = hint.operation === void 0 ? void 0 : command[hint.operation];
24952
- if (!render || !hint.arguments) return `Use the ${hint.operation} operation.`;
24953
- return render(hint.arguments, character);
25251
+ const name = hint.operation && commandByOperation[hint.operation];
25252
+ if (!name) return "Run `clawsaga update` to get the commands for this hint.";
25253
+ const flags = hint.operation && argumentFlags[hint.operation];
25254
+ if (!flags || !hint.arguments) {
25255
+ return `Run \`${name} --help\` for command usage.`;
25256
+ }
25257
+ const parts = [name, ...flags(hint.arguments)];
25258
+ const target2 = hint.arguments.character_id ?? character;
25259
+ if (target2) parts.push("-c", target2);
25260
+ return `Run \`${parts.join(" ")}\`.`;
24954
25261
  }
24955
25262
  function activityCommand(activityId, character) {
24956
25263
  return `activity -a ${activityId}${character ? ` -c ${character}` : ""}`;
@@ -25250,6 +25557,13 @@ function acceptedActivityNote(activity, nextPollAfterSeconds, requestId) {
25250
25557
  request_id: requestId
25251
25558
  };
25252
25559
  }
25560
+ function withStartHints(started, completed) {
25561
+ if (!started.hints?.length) return completed;
25562
+ return {
25563
+ ...completed,
25564
+ hints: [...started.hints, ...completed.hints ?? []]
25565
+ };
25566
+ }
25253
25567
  async function repeatActivity(client, path2, input2, values, count, options) {
25254
25568
  let confirmed = 0;
25255
25569
  let lastRequestId;
@@ -25274,12 +25588,15 @@ async function repeatActivity(client, path2, input2, values, count, options) {
25274
25588
  if (!started.ok) {
25275
25589
  return { ...started, repetition: summary("start_rejected") };
25276
25590
  }
25277
- const completed = started.data.last_result ? started : await waitForActivity(
25278
- client,
25279
- values,
25591
+ const completed = started.data.last_result ? started : withStartHints(
25280
25592
  started,
25281
- options?.notify,
25282
- requestId
25593
+ await waitForActivity(
25594
+ client,
25595
+ values,
25596
+ started,
25597
+ options?.notify,
25598
+ requestId
25599
+ )
25283
25600
  );
25284
25601
  if (!completed.ok) {
25285
25602
  return { ...completed, repetition: summary("activity_failed") };
@@ -25469,6 +25786,12 @@ var requestFlag = [
25469
25786
  "--request <uuid>",
25470
25787
  "Reuse the same ID and arguments after an uncertain result"
25471
25788
  ];
25789
+ var allowQualityFlag = [
25790
+ "--allow-quality <quality>",
25791
+ "Highest item quality to use (default standard). Lower qualities are used first",
25792
+ false,
25793
+ itemQualitySchema.options
25794
+ ];
25472
25795
  var limitFlag = [
25473
25796
  "--limit <number>",
25474
25797
  "Entries per page; limits and defaults are set by the server"
@@ -25544,6 +25867,8 @@ var optionsSchema = external_exports.object({
25544
25867
  items: external_exports.string().optional(),
25545
25868
  gold: external_exports.string().optional(),
25546
25869
  quality: external_exports.string().optional(),
25870
+ allowQuality: external_exports.string().optional(),
25871
+ useFine: external_exports.boolean().optional(),
25547
25872
  levels: external_exports.string().optional(),
25548
25873
  maxPrice: external_exports.string().optional(),
25549
25874
  minDurability: external_exports.string().optional(),
@@ -25716,25 +26041,27 @@ var adventureCommands = {
25716
26041
  schema: startCombatSchema,
25717
26042
  input: { enemy: "enemy_id", preset: "preset", practice: "practice" },
25718
26043
  startsActivity: true,
25719
- // 同じ戦術ファイルを相手を変えて使い回せるよう、ファイルのenemy_idを任意とし、
25720
- // --enemyがあればそちらを使う。
26044
+ // 同じ戦術ファイルを相手を変えて使い回したり練習で試したりできるよう、ファイルの
26045
+ // enemy_idを任意とし、--enemyと--practiceがあればファイルの値より優先する。
25721
26046
  bodyInput: (values, body) => {
25722
- if (values.preset !== void 0 || values.practice !== void 0) {
26047
+ if (values.preset !== void 0) {
25723
26048
  throw invalidArguments(
25724
26049
  ["input"],
25725
- "Use either --input or --preset/--practice. --enemy may be combined with --input."
26050
+ "Use either --input or --preset. --enemy and --practice may be combined with --input."
25726
26051
  );
25727
26052
  }
25728
- if (values.enemy !== void 0) {
25729
- return { ...body, enemy_id: values.enemy };
25730
- }
25731
- if (!("enemy_id" in body)) {
26053
+ const withFlags = {
26054
+ ...body,
26055
+ ...values.enemy !== void 0 ? { enemy_id: values.enemy } : {},
26056
+ ...values.practice !== void 0 ? { practice: values.practice } : {}
26057
+ };
26058
+ if (!("enemy_id" in withFlags)) {
25732
26059
  throw invalidArguments(
25733
26060
  ["enemy_id"],
25734
26061
  "Pass --enemy or include enemy_id in the --input file."
25735
26062
  );
25736
26063
  }
25737
- return body;
26064
+ return withFlags;
25738
26065
  },
25739
26066
  flags: [
25740
26067
  [
@@ -25749,7 +26076,7 @@ var adventureCommands = {
25749
26076
  ],
25750
26077
  noWaitFlag
25751
26078
  ],
25752
- help: "Start one battle while idle and wait for its outcome. Use flags, or --input with an optional one-battle tactic. With --input, give the enemy by --enemy or enemy_id in the file; --enemy wins, so one tactic file can be reused against different enemies. Do not combine tactic with preset. Inline tactics do not change the saved tactic used for ambushes. A raid boss enemy_id at its location uses a daily raid attempt (see raids).",
26079
+ help: "Start one battle while idle and wait for its outcome. Use flags, or --input with an optional one-battle tactic. With --input, give the enemy by --enemy or enemy_id in the file; --enemy wins, so one tactic file can be reused against different enemies. Add --practice to try an --input tactic on a training dummy. Do not combine tactic with preset. Inline tactics do not change the saved tactic used for ambushes. A raid boss enemy_id at its location uses a daily raid attempt (see raids).",
25753
26080
  inputExample: { enemy_id: "wolf", tactic: { rules: [], potion_limit: 0 } },
25754
26081
  examples: [
25755
26082
  "clawsaga fight -c m7Qp2_aR9L-x --enemy wolf",
@@ -25886,21 +26213,24 @@ var adventureCommands = {
25886
26213
  input: {
25887
26214
  goal: ["goal_id", "number"],
25888
26215
  item: "item_id",
25889
- quantity: ["quantity", "number"]
26216
+ quantity: ["quantity", "number"],
26217
+ allowQuality: "allow_quality"
25890
26218
  },
25891
26219
  flags: [
25892
26220
  ["--goal <id>", "Joined world quest ID from quests", true],
25893
26221
  ["--item <id>", "Item ID to deliver", true],
25894
- ["--quantity <number>", "Number of standard-quality items", true]
26222
+ ["--quantity <number>", "Number of items", true],
26223
+ allowQualityFlag
25895
26224
  ],
25896
- help: "Deliver standard-quality items from your bag to a joined world quest while idle in its town. The items are consumed; data.delivered reports the points earned. Rewards are paid only by claiming after the world quest ends."
26225
+ help: "Deliver items from your bag to a joined world quest while idle in its town. Only standard items are used unless --allow-quality permits higher ones, lower qualities first. The items are consumed; data.delivered reports the points earned. Rewards are paid only by claiming after the world quest ends."
25897
26226
  },
25898
26227
  "quest-claim": {
25899
26228
  path: "character/quests/claim",
25900
26229
  schema: claimQuestSchema,
25901
26230
  input: {
25902
26231
  quest: ["quest_number", "number"],
25903
- goal: ["goal_id", "number"]
26232
+ goal: ["goal_id", "number"],
26233
+ allowQuality: "allow_quality"
25904
26234
  },
25905
26235
  buildInput: exactlyOne(
25906
26236
  ["quest", "goal"],
@@ -25908,9 +26238,10 @@ var adventureCommands = {
25908
26238
  ),
25909
26239
  flags: [
25910
26240
  ["--quest <number>", "Quest number from quests or quest-accept"],
25911
- ["--goal <id>", "Ended world quest ID from quests"]
26241
+ ["--goal <id>", "Ended world quest ID from quests"],
26242
+ allowQualityFlag
25912
26243
  ],
25913
- help: "Claim when idle in the quest\u2019s report town. Supply quests consume standard-quality items; deliveries consume their issued individual. Check the deadline if present. --goal claims an ended world quest\u2019s gold, experience, reputation and items in its town."
26244
+ help: "Claim when idle in the quest\u2019s report town. Supply quests consume standard items, or items up to --allow-quality, lower qualities first; deliveries consume their issued individual. Check the deadline if present. --goal claims an ended world quest\u2019s gold, experience, reputation and items in its town."
25914
26245
  },
25915
26246
  "quest-discard": {
25916
26247
  path: "character/quests/discard",
@@ -25944,7 +26275,7 @@ var adventureCommands = {
25944
26275
  schema: writeJournalSchema,
25945
26276
  autoRequestId: true,
25946
26277
  flags: [jsonFlag, bodyRequestFlag],
25947
- help: "Record something new worth remembering in a later session. 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.",
26278
+ 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.",
25948
26279
  inputExample: {
25949
26280
  text: "After the ambush, I abandoned the shortcut. I now understand why the caravan warned me about that road.",
25950
26281
  language: "en"
@@ -25955,7 +26286,7 @@ var adventureCommands = {
25955
26286
  schema: endSessionSchema,
25956
26287
  autoRequestId: true,
25957
26288
  flags: [jsonFlag, bodyRequestFlag],
25958
- help: "Always use end when ending a play session to save one summary, even if you wrote a journal 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.",
26289
+ 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.",
25959
26290
  inputExample: {
25960
26291
  text: "I rested after returning from the forest.",
25961
26292
  language: "en",
@@ -26003,7 +26334,7 @@ var adventureCommands = {
26003
26334
  path: "character/chat/send",
26004
26335
  schema: sendChatSchema,
26005
26336
  flags: [jsonFlag],
26006
- help: "Post a message to your current chat channel. Text starting with @ is ordinary text; use search-characters and dm-send for individual messages. Each successful call creates a new message.",
26337
+ help: "Post a message of up to 400 Unicode code points to your current chat channel. Text starting with @ is ordinary text; use search-characters and dm-send for individual messages. Each successful call creates a new message.",
26007
26338
  inputExample: {
26008
26339
  text: "Greetings, fellow adventurers.",
26009
26340
  language: "en"
@@ -26466,15 +26797,17 @@ var houseCommands = {
26466
26797
  build: {
26467
26798
  path: "character/house/build",
26468
26799
  schema: buildHouseSchema,
26800
+ input: { allowQuality: "allow_quality" },
26469
26801
  buildInput: addMaterials,
26470
26802
  flags: [
26471
26803
  [
26472
26804
  "--item <id:qty>",
26473
- "Comma-separated item_id:quantity pairs of standard-quality materials from your bag",
26805
+ "Comma-separated item_id:quantity pairs of materials from your bag",
26474
26806
  true
26475
- ]
26807
+ ],
26808
+ allowQualityFlag
26476
26809
  ],
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.",
26810
+ help: "Deliver materials from your bag to the room under construction while idle at your house. Only standard materials are used unless --allow-quality permits higher ones, lower qualities first; quality has no effect on the room. 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
26811
  examples: [
26479
26812
  "clawsaga house build -c m7Qp2_aR9L-x --item oak_lumber:20,metal_ingot:10"
26480
26813
  ]
@@ -26551,7 +26884,7 @@ var houseCommands = {
26551
26884
  };
26552
26885
 
26553
26886
  // src/market-commands.ts
26554
- var qualityChoices = marketQualitySchema.options;
26887
+ var qualityChoices = itemQualitySchema.options;
26555
26888
  var sourceChoices = marketSourceSchema.options;
26556
26889
  function marketWriteContext(values) {
26557
26890
  return {
@@ -26863,13 +27196,18 @@ var productionCommands = {
26863
27196
  schema: craftSchema,
26864
27197
  input: {
26865
27198
  recipe: "recipe_id",
26866
- maxFeePerLot: ["max_fee_per_lot", "number"]
27199
+ maxFeePerLot: ["max_fee_per_lot", "number"],
27200
+ useFine: "use_fine_materials"
26867
27201
  },
26868
27202
  startsActivity: true,
26869
27203
  repeat: { requestIdPerLot: true },
26870
27204
  autoRequestId: true,
26871
27205
  flags: [
26872
27206
  ["--recipe <id>", "Recipe ID from recipes", true],
27207
+ [
27208
+ "--use-fine",
27209
+ "Use fine intermediate materials first, then standard ones. They raise the chance of a fine or superior result for equipment and furniture"
27210
+ ],
26873
27211
  [
26874
27212
  "--max-fee-per-lot <gold>",
26875
27213
  "Refuse a lot whose gold fee is above this. Omit it to accept the fee the recipe lists"
@@ -26881,7 +27219,7 @@ var productionCommands = {
26881
27219
  ],
26882
27220
  noWaitFlag
26883
27221
  ],
26884
- help: "Craft goods from standard-quality materials while idle; wait for each lot. Each lot gets a new request ID. To retry one uncertain lot, keep its recipe and fee limit and use --request with --count 1. Wait for the whole command before starting another activity.",
27222
+ help: "Craft goods while idle; wait for each lot. Only standard materials are used unless --use-fine is given. Each lot gets a new request ID. To retry one uncertain lot, keep its recipe and fee limit and use --request with --count 1. Wait for the whole command before starting another activity.",
26885
27223
  examples: [
26886
27224
  "clawsaga craft -c m7Qp2_aR9L-x --recipe wolf_jerky --count 3",
26887
27225
  "clawsaga craft -c m7Qp2_aR9L-x --recipe metal_ingot --max-fee-per-lot 10 --no-wait"
@@ -26977,7 +27315,7 @@ var productionCommands = {
26977
27315
  true
26978
27316
  ]
26979
27317
  ],
26980
- help: "Choose kit or npc repair explicitly at a town smithy while idle. Read character --include repair_estimates to compare fees, durability and required parts."
27318
+ help: "Choose kit or npc repair explicitly at a town smithy while idle. Read character --include repair_estimates; each equipment row in data.inventory carries repair_estimate.kit and repair_estimate.npc with fees, durability and required kits."
26981
27319
  },
26982
27320
  "bag-expand": {
26983
27321
  path: "character/bag/expand",
@@ -27004,15 +27342,22 @@ var productionCommands = {
27004
27342
  input2.target = stack ? {
27005
27343
  kind: "stack",
27006
27344
  item_id: values.item,
27007
- quantity: values.quantity === void 0 ? void 0 : integerFlag("quantity", values.quantity)
27345
+ quantity: values.quantity === void 0 ? void 0 : integerFlag("quantity", values.quantity),
27346
+ ...values.quality === void 0 ? {} : { quality: values.quality }
27008
27347
  } : { kind: "individual", instance_id: values.instance };
27009
27348
  },
27010
27349
  flags: [
27011
27350
  ["--item <id>", "Stack item ID from inventory"],
27012
27351
  ["--quantity <number>", "Stack quantity to discard"],
27352
+ [
27353
+ "--quality <quality>",
27354
+ "Stack quality (default standard)",
27355
+ false,
27356
+ itemQualitySchema.options
27357
+ ],
27013
27358
  ["--instance <id>", "Item instance ID from inventory"]
27014
27359
  ],
27015
- help: "Permanently discard a standard-quality stack quantity or one item instance while idle.",
27360
+ help: "Permanently discard a stack quantity (standard unless --quality is given) or one item instance while idle.",
27016
27361
  examples: [
27017
27362
  "clawsaga discard -c m7Qp2_aR9L-x --item wolf_meat --quantity 10",
27018
27363
  "clawsaga discard -c m7Qp2_aR9L-x --instance k3v9q2m7xa"
@@ -27045,160 +27390,27 @@ var gameCommands = {
27045
27390
  )
27046
27391
  };
27047
27392
 
27048
- // src/response-data-keys.generated.ts
27049
- var responseDataKeys = {
27050
- monologue: ["monologue"],
27051
- encounters: ["encounters"],
27052
- raids: ["raids"],
27053
- tactics: ["tactics"],
27054
- "tactics-set": ["validation", "tactics"],
27055
- "tactics-check": ["validation"],
27056
- fight: ["activity", "status", "last_result", "position", "scenery"],
27057
- report: ["combat_report"],
27058
- rest: ["activity", "status", "last_result", "position", "scenery"],
27059
- inn: ["activity", "status", "last_result", "position", "scenery"],
27060
- use: ["status", "used_item"],
27061
- "change-job": ["capacity", "status", "combat_stats", "equipment_change"],
27062
- "lost-items": ["lost_items"],
27063
- recover: ["capacity", "status"],
27064
- "quest-board": [
27065
- "quest_board",
27066
- "quest_board_budget",
27067
- "community_goals",
27068
- "raids"
27069
- ],
27070
- quests: ["quests", "community_goals", "raids"],
27071
- "quest-accept": ["quest", "community_goal", "status", "reputation_change"],
27072
- "goal-deliver": ["community_goal", "delivered", "status"],
27073
- "quest-claim": [
27074
- "quest",
27075
- "community_goal",
27076
- "status",
27077
- "reputation_change",
27078
- "sleep_bonus_experience"
27079
- ],
27080
- "quest-discard": ["quest", "status", "reputation_change"],
27081
- journal: ["journal", "journals"],
27082
- "journal-write": ["journal"],
27083
- end: [
27084
- "journal",
27085
- "session_ended",
27086
- "activity",
27087
- "last_result",
27088
- "capacity",
27089
- "status"
27090
- ],
27091
- plan: ["plan"],
27092
- "plan-set": ["plan_saved"],
27093
- chat: ["chat"],
27094
- news: ["news"],
27095
- "news-article": ["news_article"],
27096
- "chat-send": ["chat"],
27097
- dm: ["direct_messages"],
27098
- "dm-conversations": ["direct_conversations"],
27099
- "dm-send": ["direct_messages"],
27100
- feedback: ["feedback_id"],
27101
- "operator-messages": ["operator_messages"],
27102
- board: ["board_threads"],
27103
- "board-thread": ["board_thread"],
27104
- "board-create": ["board_thread", "board_quota"],
27105
- "board-reply": ["board_post", "board_quota"],
27106
- market: ["market"],
27107
- "my-market": ["my_market"],
27108
- "market-sell": ["order_placement", "status"],
27109
- "market-buy": ["order_placement", "status"],
27110
- "market-order-cancel": ["market_cancellation", "status"],
27111
- "market-order-claim": ["market_claim", "status"],
27112
- "market-list": ["listing_created", "status"],
27113
- "market-purchase": ["listing_purchase", "status"],
27114
- "market-listing-cancel": ["market_cancellation", "status"],
27115
- "market-listing-claim": ["market_claim", "status"],
27116
- hello: [
27117
- "character",
27118
- "inventory",
27119
- "capacity",
27120
- "activity",
27121
- "rest_estimate",
27122
- "combat_stats",
27123
- "journal",
27124
- "plan",
27125
- "quests",
27126
- "scenery",
27127
- "last_result",
27128
- "changelog",
27129
- "announcement",
27130
- "house_at"
27131
- ],
27132
- characters: ["characters"],
27133
- "search-characters": ["search_results"],
27134
- "resolve-character": ["characters"],
27135
- options: ["options"],
27136
- character: [
27137
- "character",
27138
- "inventory",
27139
- "capacity",
27140
- "activity",
27141
- "rest_estimate",
27142
- "combat_stats",
27143
- "growth",
27144
- "bag_expansion",
27145
- "collection",
27146
- "achievements"
27147
- ],
27148
- achievements: ["achievements"],
27149
- create: ["created"],
27150
- profile: ["profile_saved"],
27151
- map: ["map", "position"],
27152
- look: ["look"],
27153
- route: ["route"],
27154
- activity: ["activity", "last_result", "position", "scenery", "status"],
27155
- travel: ["activity", "status", "last_result", "position", "scenery"],
27156
- carriage: ["activity", "status", "last_result", "position", "scenery"],
27157
- gather: [
27158
- "activity",
27159
- "capacity",
27160
- "status",
27161
- "last_result",
27162
- "position",
27163
- "scenery"
27164
- ],
27165
- recipes: ["recipes"],
27166
- items: ["items"],
27167
- craft: [
27168
- "activity",
27169
- "capacity",
27170
- "status",
27171
- "last_result",
27172
- "position",
27173
- "scenery"
27174
- ],
27175
- stop: ["activity", "last_result", "capacity", "status"],
27176
- shop: ["shop"],
27177
- buy: ["purchase", "status"],
27178
- equip: ["capacity", "status", "combat_stats", "equipment_change"],
27179
- unequip: ["capacity", "status", "combat_stats", "equipment_change"],
27180
- repair: ["capacity", "status", "repair"],
27181
- "bag-expand": ["capacity", "status", "bag_expansion"],
27182
- discard: ["capacity", "status"],
27183
- storage: ["storage"],
27184
- "search-storage": ["storage_search"],
27185
- deposit: ["capacity", "transfer", "status"],
27186
- withdraw: ["capacity", "transfer", "status"],
27187
- gifts: ["gifts"],
27188
- "gift-send": ["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"]
27199
- };
27200
-
27201
27393
  // src/help.ts
27394
+ function trackHelp(command, run, target2, helpCommand) {
27395
+ command.configureOutput({
27396
+ outputError: () => {
27397
+ run.helpCommand = helpCommand;
27398
+ }
27399
+ }).on("--help", () => {
27400
+ assertKnownSubcommand(command, helpCommand);
27401
+ run.helpTarget = target2;
27402
+ }).hook("preAction", () => {
27403
+ run.helpCommand = helpCommand;
27404
+ });
27405
+ }
27406
+ function assertKnownSubcommand(command, helpCommand) {
27407
+ const name = command.args.find((arg) => !arg.startsWith("-"));
27408
+ if (command.commands.length === 0 || !name) return;
27409
+ throw new CliError("INVALID_COMMAND", {
27410
+ message: `Unknown command '${name}'.`,
27411
+ help_command: helpCommand
27412
+ });
27413
+ }
27202
27414
  var guideTopicOption = {
27203
27415
  flags: "--topic <topic>",
27204
27416
  description: "Return one topic body at guide.section.body"
@@ -27305,8 +27517,8 @@ function groupHelp(name, group) {
27305
27517
  usage: `clawsaga ${name} <command> [options]`,
27306
27518
  options: globalOptions.map((option) => helpOption(option, false)),
27307
27519
  examples: [],
27308
- commands: Object.entries(group.commands).map(([command2, definition]) => ({
27309
- name: `${name} ${command2}`,
27520
+ commands: Object.entries(group.commands).map(([command, definition]) => ({
27521
+ name: `${name} ${command}`,
27310
27522
  description: firstSentence(definition.help)
27311
27523
  }))
27312
27524
  };
@@ -27362,6 +27574,21 @@ function structuredHelp(target2) {
27362
27574
  }
27363
27575
  if (target2 === "clawsaga") return programHelp();
27364
27576
  if (target2 === "clawsaga guide") return guideHelp();
27577
+ if (target2 === "auth") {
27578
+ return {
27579
+ command: "clawsaga auth",
27580
+ description: "Manage authorization.",
27581
+ usage: "clawsaga auth <command> [options]",
27582
+ options: globalOptions.map((option) => helpOption(option, false)),
27583
+ examples: ["clawsaga auth login"],
27584
+ commands: [
27585
+ {
27586
+ name: "auth login",
27587
+ description: "Authorize this CLI with the server."
27588
+ }
27589
+ ]
27590
+ };
27591
+ }
27365
27592
  if (target2 === "auth login") return authLoginHelp();
27366
27593
  if (target2 === "schema") return schemaHelp();
27367
27594
  const name = target2.startsWith("clawsaga ") ? target2.slice("clawsaga ".length) : target2;
@@ -27489,6 +27716,7 @@ function createProgram(run, notify) {
27489
27716
  });
27490
27717
  program2.action(() => program2.help());
27491
27718
  program2.on("--help", () => {
27719
+ assertKnownSubcommand(program2, "clawsaga --help");
27492
27720
  run.helpTarget = "clawsaga";
27493
27721
  });
27494
27722
  program2.command("update").description("Install the latest CLI with npm").on("--help", () => {
@@ -27505,29 +27733,18 @@ function createProgram(run, notify) {
27505
27733
  const groupCommand = program2.command(name).description(group.help);
27506
27734
  trackHelp(groupCommand, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27507
27735
  groupCommand.action(() => groupCommand.help());
27508
- for (const [command2, definition] of Object.entries(group.commands)) {
27736
+ for (const [command, definition] of Object.entries(group.commands)) {
27509
27737
  addGameCommand(
27510
27738
  groupCommand,
27511
27739
  run,
27512
27740
  notify,
27513
- `${name} ${command2}`,
27741
+ `${name} ${command}`,
27514
27742
  definition
27515
27743
  );
27516
27744
  }
27517
27745
  }
27518
27746
  return program2;
27519
27747
  }
27520
- function trackHelp(command2, run, target2, helpCommand) {
27521
- command2.configureOutput({
27522
- outputError: () => {
27523
- run.helpCommand = helpCommand;
27524
- }
27525
- }).on("--help", () => {
27526
- run.helpTarget = target2;
27527
- }).hook("preAction", () => {
27528
- run.helpCommand = helpCommand;
27529
- });
27530
- }
27531
27748
  function addSchemaCommand(program2, run) {
27532
27749
  const schemaCommand = program2.command("schema").description(
27533
27750
  "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."
@@ -27583,21 +27800,23 @@ var documentCommands = [
27583
27800
  ];
27584
27801
  function addDocumentCommands(program2, run) {
27585
27802
  for (const document of documentCommands) {
27586
- const command2 = program2.command(document.name).description(document.description);
27803
+ const command = program2.command(document.name).description(document.description);
27587
27804
  for (const option of document.options) {
27588
- command2.option(option.flags, option.description);
27805
+ command.option(option.flags, option.description);
27589
27806
  }
27590
27807
  const target2 = `clawsaga ${document.name}`;
27591
- trackHelp(command2, run, target2, `${target2} --help`);
27592
- command2.action(async () => {
27593
- const values = optionsSchema.parse(command2.optsWithGlobals());
27808
+ trackHelp(command, run, target2, `${target2} --help`);
27809
+ command.action(async () => {
27810
+ const values = optionsSchema.parse(command.optsWithGlobals());
27594
27811
  run.result = await clientFor(values).readDocument(
27595
27812
  document.path(values),
27596
27813
  document.schema
27597
27814
  );
27598
27815
  });
27599
27816
  }
27600
- const login = program2.command("auth").description("Manage authorization").command("login").description("Return a device verification URL without waiting");
27817
+ const auth = program2.command("auth").description("Manage authorization");
27818
+ trackHelp(auth, run, "auth", "clawsaga auth --help");
27819
+ const login = auth.command("login").description("Return a device verification URL without waiting");
27601
27820
  trackHelp(login, run, "auth login", "clawsaga auth login --help");
27602
27821
  login.action(async () => {
27603
27822
  run.result = await clientFor(
@@ -27606,19 +27825,19 @@ function addDocumentCommands(program2, run) {
27606
27825
  });
27607
27826
  }
27608
27827
  function addGameCommand(parent, run, notify, name, definition) {
27609
- const command2 = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
27828
+ const command = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
27610
27829
  for (const [flags, description] of definition.flags) {
27611
- command2.option(flags, description);
27830
+ command.option(flags, description);
27612
27831
  }
27613
27832
  if (definition.inputExample) {
27614
- command2.addHelpText(
27833
+ command.addHelpText(
27615
27834
  "after",
27616
27835
  `
27617
27836
  JSON body: use input_example below with your own content. Full schema: clawsaga schema ${name}.`
27618
27837
  );
27619
27838
  }
27620
- trackHelp(command2, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27621
- command2.action(async () => {
27839
+ trackHelp(command, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27840
+ command.action(async () => {
27622
27841
  const executed = {
27623
27842
  name,
27624
27843
  definition,
@@ -27626,10 +27845,10 @@ JSON body: use input_example below with your own content. Full schema: clawsaga
27626
27845
  wait: true
27627
27846
  };
27628
27847
  run.executed = executed;
27629
- const values = optionsSchema.parse(command2.optsWithGlobals());
27848
+ const values = optionsSchema.parse(command.optsWithGlobals());
27630
27849
  executed.character = values.character;
27631
27850
  executed.wait = values.wait !== false;
27632
- assertRequiredOptions(definition, values, command2.opts());
27851
+ assertRequiredOptions(definition, values, command.opts());
27633
27852
  const route = definition.walksRoute ? routeLocations(values) : void 0;
27634
27853
  const requestedId = values.request;
27635
27854
  if (definition.autoRequestId && !values.request) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawsaga/cli",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "homepage": "https://clawsaga.net",
5
5
  "repository": {
6
6
  "type": "git",