@clawsaga/cli 0.1.31 → 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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  ## 0.1.31
6
13
 
7
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`.
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
  /**
@@ -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.20";
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
@@ -24605,7 +24605,7 @@ var CredentialStore = class {
24605
24605
  // package.json
24606
24606
  var package_default = {
24607
24607
  name: "@clawsaga/cli",
24608
- version: "0.1.31",
24608
+ version: "0.1.32",
24609
24609
  homepage: "https://clawsaga.net",
24610
24610
  repository: {
24611
24611
  type: "git",
@@ -24940,17 +24940,272 @@ var GameClient = class {
24940
24940
  }
24941
24941
  };
24942
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
+
24943
25189
  // 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}` : ""}\`.`
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: () => []
24948
25196
  };
24949
25197
  function renderHint(hint, character) {
24950
25198
  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);
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(" ")}\`.`;
24954
25209
  }
24955
25210
  function activityCommand(activityId, character) {
24956
25211
  return `activity -a ${activityId}${character ? ` -c ${character}` : ""}`;
@@ -25944,7 +26199,7 @@ var adventureCommands = {
25944
26199
  schema: writeJournalSchema,
25945
26200
  autoRequestId: true,
25946
26201
  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.",
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.",
25948
26203
  inputExample: {
25949
26204
  text: "After the ambush, I abandoned the shortcut. I now understand why the caravan warned me about that road.",
25950
26205
  language: "en"
@@ -25955,7 +26210,7 @@ var adventureCommands = {
25955
26210
  schema: endSessionSchema,
25956
26211
  autoRequestId: true,
25957
26212
  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.",
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.",
25959
26214
  inputExample: {
25960
26215
  text: "I rested after returning from the forest.",
25961
26216
  language: "en",
@@ -27045,160 +27300,27 @@ var gameCommands = {
27045
27300
  )
27046
27301
  };
27047
27302
 
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
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
+ }
27202
27324
  var guideTopicOption = {
27203
27325
  flags: "--topic <topic>",
27204
27326
  description: "Return one topic body at guide.section.body"
@@ -27305,8 +27427,8 @@ function groupHelp(name, group) {
27305
27427
  usage: `clawsaga ${name} <command> [options]`,
27306
27428
  options: globalOptions.map((option) => helpOption(option, false)),
27307
27429
  examples: [],
27308
- commands: Object.entries(group.commands).map(([command2, definition]) => ({
27309
- name: `${name} ${command2}`,
27430
+ commands: Object.entries(group.commands).map(([command, definition]) => ({
27431
+ name: `${name} ${command}`,
27310
27432
  description: firstSentence(definition.help)
27311
27433
  }))
27312
27434
  };
@@ -27362,6 +27484,21 @@ function structuredHelp(target2) {
27362
27484
  }
27363
27485
  if (target2 === "clawsaga") return programHelp();
27364
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
+ }
27365
27502
  if (target2 === "auth login") return authLoginHelp();
27366
27503
  if (target2 === "schema") return schemaHelp();
27367
27504
  const name = target2.startsWith("clawsaga ") ? target2.slice("clawsaga ".length) : target2;
@@ -27489,6 +27626,7 @@ function createProgram(run, notify) {
27489
27626
  });
27490
27627
  program2.action(() => program2.help());
27491
27628
  program2.on("--help", () => {
27629
+ assertKnownSubcommand(program2, "clawsaga --help");
27492
27630
  run.helpTarget = "clawsaga";
27493
27631
  });
27494
27632
  program2.command("update").description("Install the latest CLI with npm").on("--help", () => {
@@ -27505,29 +27643,18 @@ function createProgram(run, notify) {
27505
27643
  const groupCommand = program2.command(name).description(group.help);
27506
27644
  trackHelp(groupCommand, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27507
27645
  groupCommand.action(() => groupCommand.help());
27508
- for (const [command2, definition] of Object.entries(group.commands)) {
27646
+ for (const [command, definition] of Object.entries(group.commands)) {
27509
27647
  addGameCommand(
27510
27648
  groupCommand,
27511
27649
  run,
27512
27650
  notify,
27513
- `${name} ${command2}`,
27651
+ `${name} ${command}`,
27514
27652
  definition
27515
27653
  );
27516
27654
  }
27517
27655
  }
27518
27656
  return program2;
27519
27657
  }
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
27658
  function addSchemaCommand(program2, run) {
27532
27659
  const schemaCommand = program2.command("schema").description(
27533
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."
@@ -27583,21 +27710,23 @@ var documentCommands = [
27583
27710
  ];
27584
27711
  function addDocumentCommands(program2, run) {
27585
27712
  for (const document of documentCommands) {
27586
- const command2 = program2.command(document.name).description(document.description);
27713
+ const command = program2.command(document.name).description(document.description);
27587
27714
  for (const option of document.options) {
27588
- command2.option(option.flags, option.description);
27715
+ command.option(option.flags, option.description);
27589
27716
  }
27590
27717
  const target2 = `clawsaga ${document.name}`;
27591
- trackHelp(command2, run, target2, `${target2} --help`);
27592
- command2.action(async () => {
27593
- const values = optionsSchema.parse(command2.optsWithGlobals());
27718
+ trackHelp(command, run, target2, `${target2} --help`);
27719
+ command.action(async () => {
27720
+ const values = optionsSchema.parse(command.optsWithGlobals());
27594
27721
  run.result = await clientFor(values).readDocument(
27595
27722
  document.path(values),
27596
27723
  document.schema
27597
27724
  );
27598
27725
  });
27599
27726
  }
27600
- const login = program2.command("auth").description("Manage authorization").command("login").description("Return a device verification URL without waiting");
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");
27601
27730
  trackHelp(login, run, "auth login", "clawsaga auth login --help");
27602
27731
  login.action(async () => {
27603
27732
  run.result = await clientFor(
@@ -27606,19 +27735,19 @@ function addDocumentCommands(program2, run) {
27606
27735
  });
27607
27736
  }
27608
27737
  function addGameCommand(parent, run, notify, name, definition) {
27609
- const command2 = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
27738
+ const command = parent.command(name.slice(name.lastIndexOf(" ") + 1)).description(definition.help);
27610
27739
  for (const [flags, description] of definition.flags) {
27611
- command2.option(flags, description);
27740
+ command.option(flags, description);
27612
27741
  }
27613
27742
  if (definition.inputExample) {
27614
- command2.addHelpText(
27743
+ command.addHelpText(
27615
27744
  "after",
27616
27745
  `
27617
27746
  JSON body: use input_example below with your own content. Full schema: clawsaga schema ${name}.`
27618
27747
  );
27619
27748
  }
27620
- trackHelp(command2, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27621
- command2.action(async () => {
27749
+ trackHelp(command, run, `clawsaga ${name}`, `clawsaga ${name} --help`);
27750
+ command.action(async () => {
27622
27751
  const executed = {
27623
27752
  name,
27624
27753
  definition,
@@ -27626,10 +27755,10 @@ JSON body: use input_example below with your own content. Full schema: clawsaga
27626
27755
  wait: true
27627
27756
  };
27628
27757
  run.executed = executed;
27629
- const values = optionsSchema.parse(command2.optsWithGlobals());
27758
+ const values = optionsSchema.parse(command.optsWithGlobals());
27630
27759
  executed.character = values.character;
27631
27760
  executed.wait = values.wait !== false;
27632
- assertRequiredOptions(definition, values, command2.opts());
27761
+ assertRequiredOptions(definition, values, command.opts());
27633
27762
  const route = definition.walksRoute ? routeLocations(values) : void 0;
27634
27763
  const requestedId = values.request;
27635
27764
  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.32",
4
4
  "homepage": "https://clawsaga.net",
5
5
  "repository": {
6
6
  "type": "git",