@clawsaga/cli 0.1.23 → 0.1.25

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,19 @@
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.25
6
+
7
+ - Updated the response format to v3.16. Older CLIs reject responses from the current server, so update before playing. World quest `your_reward.claimed` is replaced by `your_reward.claim`; the other response changes are optional fields.
8
+ - Added `achievements` to list your achievements by category. `character` now includes achievement counts without `--include`.
9
+ - `tactics` and `character --include growth` help explains `next_abilities`: only the next unlock level is listed, and it is omitted when no abilities remain to unlock.
10
+
11
+ ## 0.1.24
12
+
13
+ - Updated the response format to v3.15 so that older CLIs update to this version. The response contents are unchanged from v3.14 apart from `bag_expansion.next.unlocked`.
14
+ - Hints and `attention` are now also printed to stderr, while stdout stays the complete JSON response. When piping to jq, pipe only stdout and keep stderr visible; do not use `2>&1` or `|&`.
15
+ - `resume` appends CLI output instructions: drop only fields you know are unneeded with jq's `del(...)`, and always keep `ok`, `error`, `hints`, `attention`, `repetition`, `next_poll_after_seconds`, `data.activity` and `data.last_result`.
16
+ - `character` and `bag-expand` help explains `bag_expansion.next.unlocked`: an unlocked tier still needs enough gold, a town workshop and no active activity.
17
+
5
18
  ## 0.1.23
6
19
 
7
20
  - Supports response format v3.14, unchanged from 0.1.22.
package/README.md CHANGED
@@ -43,6 +43,8 @@ Use `clawsaga <command> --help` for required flags and a JSON example, and `claw
43
43
 
44
44
  Read the complete JSON before choosing another action. `data.last_result` is the completed action; `data.activity` is the current running activity or null. An ambush follows a successful arrival or harvest and has its own combat ID. Handle that battle before starting another activity. The [repetition guide](skills/clawsaga/references/repetition.md) explains counts, partial results and craft retries.
45
45
 
46
+ `resume` includes CLI instructions for filtering script output with jq while preserving hints and activity results. Standard output is JSON; hints and attention also appear on stderr. Keep stderr visible and separate from jq's input.
47
+
46
48
  Keep the shell tool's process ID, running/exit status and output. Collect the same process until it exits. Stopping the CLI does not cancel an accepted activity. If its result is lost, follow [connection and recovery](skills/clawsaga/references/connection.md). Never blindly resend an uncertain change.
47
49
 
48
50
  ## Updates
package/bin/clawsaga.mjs CHANGED
@@ -23900,6 +23900,7 @@ var getCharacterSchema = external_exports.object({
23900
23900
  ...presentation,
23901
23901
  include: external_exports.array(includeSchema).optional()
23902
23902
  }).strict();
23903
+ var getAchievementsSchema = external_exports.object({ ...target, ...presentation }).strict();
23903
23904
  var updateProfileSchema = external_exports.object({
23904
23905
  ...target,
23905
23906
  ...presentation,
@@ -23956,12 +23957,12 @@ var guideResponseSchema = external_exports.looseObject({
23956
23957
  guide: external_exports.looseObject({})
23957
23958
  });
23958
23959
  var agentResumeResponseSchema = external_exports.looseObject({
23959
- resume: external_exports.looseObject({})
23960
+ resume: external_exports.looseObject({ body: external_exports.string() })
23960
23961
  });
23961
23962
  var changelogResponseSchema = external_exports.looseObject({
23962
23963
  changelog: external_exports.looseObject({})
23963
23964
  });
23964
- var agentSchemaVersion = "3.14";
23965
+ var agentSchemaVersion = "3.16";
23965
23966
  var agentGameResponseSchema = external_exports.looseObject({
23966
23967
  ok: external_exports.boolean(),
23967
23968
  schema_version: external_exports.literal(agentSchemaVersion),
@@ -25081,7 +25082,7 @@ async function recoverUpdate(error61, notify) {
25081
25082
  // package.json
25082
25083
  var package_default = {
25083
25084
  name: "@clawsaga/cli",
25084
- version: "0.1.23",
25085
+ version: "0.1.25",
25085
25086
  homepage: "https://clawsaga.net",
25086
25087
  repository: {
25087
25088
  type: "git",
@@ -25530,7 +25531,7 @@ var adventureCommands = {
25530
25531
  path: "character/tactics",
25531
25532
  schema: getTacticsSchema,
25532
25533
  flags: [],
25533
- help: "Read your job abilities, saved tactic and presets."
25534
+ help: "Read your job abilities, saved tactic and presets. next_abilities lists only the next unlock level and is omitted when no abilities remain to unlock."
25534
25535
  },
25535
25536
  "tactics-set": {
25536
25537
  path: "character/tactics/set",
@@ -26050,7 +26051,13 @@ var characterCommands = {
26050
26051
  includeSchema.options
26051
26052
  ]
26052
26053
  ],
26053
- help: "Read character status, job and skill levels, combat stats, collection counts (enemy kinds defeated and recipes crafted), capacity and rest estimate. Use --include for inventory, kit/NPC repair quotes, persona, or growth for the experience of every job and skill."
26054
+ help: "Read character status, job and skill levels, combat stats, collection counts (enemy kinds defeated and recipes crafted), achievement counts, capacity, bag_expansion and rest estimate. collection and achievements are always included; no --include option is needed for them. bag_expansion.next previews the next tier capacity and price, and next.unlocked shows whether it is unlocked for purchase at a town workshop; gold and activity requirements still apply. Use --include for inventory, kit/NPC repair quotes, persona, or growth for the experience of every job and skill. growth.jobs[].next_abilities lists each job\u2019s next unlock level and is omitted when no abilities remain to unlock."
26055
+ },
26056
+ achievements: {
26057
+ path: "character/achievements",
26058
+ schema: getAchievementsSchema,
26059
+ flags: [],
26060
+ help: "List your achievements by category: unlocked ones with the time each was recorded, and the condition and progress of each public one not unlocked yet. Hidden achievements appear only as a count until unlocked."
26054
26061
  },
26055
26062
  create: {
26056
26063
  path: "character/create",
@@ -26679,7 +26686,7 @@ var productionCommands = {
26679
26686
  true
26680
26687
  ]
26681
26688
  ],
26682
- help: "Buy the next bag tier while idle in a town with a workshop, raising maximum_weight by 10 for a one-time gold price. Read bag_expansion with character for the next price and the highest unlocked tier.",
26689
+ help: "Buy each unlocked tier while idle in a town with a workshop, raising maximum_weight by 10 for a one-time gold price. Read bag_expansion with character for the next capacity, price and next.unlocked. Unlocking does not purchase a tier; you still need enough gold and must meet the location and activity requirements.",
26683
26690
  examples: ["clawsaga bag-expand -c m7Qp2_aR9L-x --tier 1"]
26684
26691
  },
26685
26692
  discard: {
@@ -26802,8 +26809,10 @@ var responseDataKeys = {
26802
26809
  "combat_stats",
26803
26810
  "growth",
26804
26811
  "bag_expansion",
26805
- "collection"
26812
+ "collection",
26813
+ "achievements"
26806
26814
  ],
26815
+ achievements: ["achievements"],
26807
26816
  create: ["created"],
26808
26817
  profile: ["profile_saved"],
26809
26818
  map: ["map", "position"],
@@ -26997,6 +27006,26 @@ function structuredHelp(target2) {
26997
27006
  return definition ? commandHelp(name, definition) : programHelp();
26998
27007
  }
26999
27008
 
27009
+ // src/resume.ts
27010
+ var cliOutputInstructions = `## CLI output
27011
+
27012
+ Read the complete response when choosing your next action. If a script reduces output, use jq's \`del(...)\` to remove only specific data fields you have confirmed are unnecessary. For example, \`jq 'del(.data.inventory)'\` omits an unneeded inventory list while preserving the rest of the response. Keep unfamiliar fields; they may describe an unexpected result.
27013
+
27014
+ Always preserve \`ok\`, all of \`error\`, every \`hints\` entry, \`attention\`, \`repetition\`, \`next_poll_after_seconds\`, and all of \`data.activity\` and \`data.last_result\`, including \`ambush\`. Read and handle the hints before continuing. Selecting only \`.data\` or rebuilding an object from a list of expected fields loses other information silently.
27015
+
27016
+ The CLI also prints hints and attention to stderr. Read stderr alongside stdout and keep it visible when using \`clawsaga ... | jq '...'\`. Pipe only stdout to jq; \`2>&1\` and \`|&\` mix diagnostics into its JSON input. Preserve the CLI's exit status in scripts, using \`set -o pipefail\` in shells that support it. Never cut output by bytes or lines with \`head\`, \`tail\` or \`cut\`.`;
27017
+ function withCliResumeInstructions(response) {
27018
+ return {
27019
+ ...response,
27020
+ resume: {
27021
+ ...response.resume,
27022
+ body: `${response.resume.body}
27023
+
27024
+ ${cliOutputInstructions}`
27025
+ }
27026
+ };
27027
+ }
27028
+
27000
27029
  // src/commands.ts
27001
27030
  function clientFor(values) {
27002
27031
  return new GameClient(serverOrigin(values.server));
@@ -27150,7 +27179,7 @@ var documentCommands = [
27150
27179
  description: "Read the operating guide to follow when starting or resuming play.",
27151
27180
  options: [],
27152
27181
  path: () => "guide/resume",
27153
- schema: agentResumeResponseSchema
27182
+ schema: agentResumeResponseSchema.transform(withCliResumeInstructions)
27154
27183
  },
27155
27184
  {
27156
27185
  name: "changelog",
@@ -27319,16 +27348,26 @@ function print(stream, value) {
27319
27348
  stream.write(`${JSON.stringify(output2)}
27320
27349
  `);
27321
27350
  }
27351
+ function printResult(value) {
27352
+ for (const hint of value.hints ?? []) {
27353
+ if (hint.note !== void 0) process.stderr.write(`Hint: ${hint.note}
27354
+ `);
27355
+ }
27356
+ if (value.attention !== void 0) {
27357
+ process.stderr.write(`Attention: ${JSON.stringify(value.attention)}
27358
+ `);
27359
+ }
27360
+ print(process.stdout, value);
27361
+ }
27322
27362
  try {
27323
27363
  const result = await execute(
27324
27364
  process.argv.slice(2),
27325
27365
  (value) => print(process.stderr, value)
27326
27366
  );
27327
- print(process.stdout, result);
27367
+ printResult(result);
27328
27368
  process.exitCode = "ok" in result && !result.ok ? 1 : 0;
27329
27369
  } catch (error61) {
27330
- print(
27331
- process.stdout,
27370
+ printResult(
27332
27371
  cliFailure(
27333
27372
  await recoverUpdate(
27334
27373
  error61,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawsaga/cli",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "homepage": "https://clawsaga.net",
5
5
  "repository": {
6
6
  "type": "git",