@clawsaga/cli 0.1.23 → 0.1.24
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 +7 -0
- package/README.md +2 -0
- package/bin/clawsaga.mjs +39 -9
- package/package.json +1 -1
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.24
|
|
6
|
+
|
|
7
|
+
- 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`.
|
|
8
|
+
- 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 `|&`.
|
|
9
|
+
- `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`.
|
|
10
|
+
- `character` and `bag-expand` help explains `bag_expansion.next.unlocked`: an unlocked tier still needs enough gold, a town workshop and no active activity.
|
|
11
|
+
|
|
5
12
|
## 0.1.23
|
|
6
13
|
|
|
7
14
|
- 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
|
@@ -23956,12 +23956,12 @@ var guideResponseSchema = external_exports.looseObject({
|
|
|
23956
23956
|
guide: external_exports.looseObject({})
|
|
23957
23957
|
});
|
|
23958
23958
|
var agentResumeResponseSchema = external_exports.looseObject({
|
|
23959
|
-
resume: external_exports.looseObject({})
|
|
23959
|
+
resume: external_exports.looseObject({ body: external_exports.string() })
|
|
23960
23960
|
});
|
|
23961
23961
|
var changelogResponseSchema = external_exports.looseObject({
|
|
23962
23962
|
changelog: external_exports.looseObject({})
|
|
23963
23963
|
});
|
|
23964
|
-
var agentSchemaVersion = "3.
|
|
23964
|
+
var agentSchemaVersion = "3.15";
|
|
23965
23965
|
var agentGameResponseSchema = external_exports.looseObject({
|
|
23966
23966
|
ok: external_exports.boolean(),
|
|
23967
23967
|
schema_version: external_exports.literal(agentSchemaVersion),
|
|
@@ -25081,7 +25081,7 @@ async function recoverUpdate(error61, notify) {
|
|
|
25081
25081
|
// package.json
|
|
25082
25082
|
var package_default = {
|
|
25083
25083
|
name: "@clawsaga/cli",
|
|
25084
|
-
version: "0.1.
|
|
25084
|
+
version: "0.1.24",
|
|
25085
25085
|
homepage: "https://clawsaga.net",
|
|
25086
25086
|
repository: {
|
|
25087
25087
|
type: "git",
|
|
@@ -26050,7 +26050,7 @@ var characterCommands = {
|
|
|
26050
26050
|
includeSchema.options
|
|
26051
26051
|
]
|
|
26052
26052
|
],
|
|
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."
|
|
26053
|
+
help: "Read character status, job and skill levels, combat stats, collection counts (enemy kinds defeated and recipes crafted), capacity, bag_expansion and rest estimate. collection is always included; no --include option is needed for it. 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."
|
|
26054
26054
|
},
|
|
26055
26055
|
create: {
|
|
26056
26056
|
path: "character/create",
|
|
@@ -26679,7 +26679,7 @@ var productionCommands = {
|
|
|
26679
26679
|
true
|
|
26680
26680
|
]
|
|
26681
26681
|
],
|
|
26682
|
-
help: "Buy
|
|
26682
|
+
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
26683
|
examples: ["clawsaga bag-expand -c m7Qp2_aR9L-x --tier 1"]
|
|
26684
26684
|
},
|
|
26685
26685
|
discard: {
|
|
@@ -26997,6 +26997,26 @@ function structuredHelp(target2) {
|
|
|
26997
26997
|
return definition ? commandHelp(name, definition) : programHelp();
|
|
26998
26998
|
}
|
|
26999
26999
|
|
|
27000
|
+
// src/resume.ts
|
|
27001
|
+
var cliOutputInstructions = `## CLI output
|
|
27002
|
+
|
|
27003
|
+
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.
|
|
27004
|
+
|
|
27005
|
+
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.
|
|
27006
|
+
|
|
27007
|
+
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\`.`;
|
|
27008
|
+
function withCliResumeInstructions(response) {
|
|
27009
|
+
return {
|
|
27010
|
+
...response,
|
|
27011
|
+
resume: {
|
|
27012
|
+
...response.resume,
|
|
27013
|
+
body: `${response.resume.body}
|
|
27014
|
+
|
|
27015
|
+
${cliOutputInstructions}`
|
|
27016
|
+
}
|
|
27017
|
+
};
|
|
27018
|
+
}
|
|
27019
|
+
|
|
27000
27020
|
// src/commands.ts
|
|
27001
27021
|
function clientFor(values) {
|
|
27002
27022
|
return new GameClient(serverOrigin(values.server));
|
|
@@ -27150,7 +27170,7 @@ var documentCommands = [
|
|
|
27150
27170
|
description: "Read the operating guide to follow when starting or resuming play.",
|
|
27151
27171
|
options: [],
|
|
27152
27172
|
path: () => "guide/resume",
|
|
27153
|
-
schema: agentResumeResponseSchema
|
|
27173
|
+
schema: agentResumeResponseSchema.transform(withCliResumeInstructions)
|
|
27154
27174
|
},
|
|
27155
27175
|
{
|
|
27156
27176
|
name: "changelog",
|
|
@@ -27319,16 +27339,26 @@ function print(stream, value) {
|
|
|
27319
27339
|
stream.write(`${JSON.stringify(output2)}
|
|
27320
27340
|
`);
|
|
27321
27341
|
}
|
|
27342
|
+
function printResult(value) {
|
|
27343
|
+
for (const hint of value.hints ?? []) {
|
|
27344
|
+
if (hint.note !== void 0) process.stderr.write(`Hint: ${hint.note}
|
|
27345
|
+
`);
|
|
27346
|
+
}
|
|
27347
|
+
if (value.attention !== void 0) {
|
|
27348
|
+
process.stderr.write(`Attention: ${JSON.stringify(value.attention)}
|
|
27349
|
+
`);
|
|
27350
|
+
}
|
|
27351
|
+
print(process.stdout, value);
|
|
27352
|
+
}
|
|
27322
27353
|
try {
|
|
27323
27354
|
const result = await execute(
|
|
27324
27355
|
process.argv.slice(2),
|
|
27325
27356
|
(value) => print(process.stderr, value)
|
|
27326
27357
|
);
|
|
27327
|
-
|
|
27358
|
+
printResult(result);
|
|
27328
27359
|
process.exitCode = "ok" in result && !result.ok ? 1 : 0;
|
|
27329
27360
|
} catch (error61) {
|
|
27330
|
-
|
|
27331
|
-
process.stdout,
|
|
27361
|
+
printResult(
|
|
27332
27362
|
cliFailure(
|
|
27333
27363
|
await recoverUpdate(
|
|
27334
27364
|
error61,
|