gamesteel 0.3.0 → 0.3.2
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/dist/gamesteel.js +30 -12
- package/package.json +2 -2
package/dist/gamesteel.js
CHANGED
|
@@ -121852,8 +121852,18 @@ var WorkingCopy = class {
|
|
|
121852
121852
|
* every other file, anything it no longer holds removed. A game from before saves, or one opened on the website and
|
|
121853
121853
|
* not saved yet, is loaded from its document's own files (opened there at its version, the first time); `unsaved`
|
|
121854
121854
|
* says the program saves it at once, so every other device can load it from its save. The batches after it are the
|
|
121855
|
-
* follower's to apply.
|
|
121855
|
+
* follower's to apply. A game that was not here and cannot be loaded (one written before tile kinds) leaves nothing
|
|
121856
|
+
* half-fetched behind: asked for again, it is fetched again. */
|
|
121856
121857
|
async pull(slug, options = {}) {
|
|
121858
|
+
const fresh = !this.has(slug);
|
|
121859
|
+
try {
|
|
121860
|
+
return await this.pullFrom(slug, options);
|
|
121861
|
+
} catch (error2) {
|
|
121862
|
+
if (fresh) this.forget(slug);
|
|
121863
|
+
throw error2;
|
|
121864
|
+
}
|
|
121865
|
+
}
|
|
121866
|
+
async pullFrom(slug, options) {
|
|
121857
121867
|
const { site } = this.options;
|
|
121858
121868
|
const dir = join29(this.root, slug);
|
|
121859
121869
|
for (let tries = 0; tries < 3; tries += 1) {
|
|
@@ -121922,19 +121932,22 @@ var WorkingCopy = class {
|
|
|
121922
121932
|
if (paths === null) this.whole.add(slug);
|
|
121923
121933
|
}
|
|
121924
121934
|
/** Every game's document the copy lacks, for a list of the games or a new game's name: the rest of each game's files
|
|
121925
|
-
* come when it is used. Answers the games to be saved at once (from before saves)
|
|
121935
|
+
* come when it is used. Answers the games to be saved at once (from before saves), and each game that could not be
|
|
121936
|
+
* loaded with why (written before tile kinds, still being made elsewhere): one game never fails the list. */
|
|
121926
121937
|
async documents() {
|
|
121927
121938
|
const unsaved = [];
|
|
121939
|
+
const unread = [];
|
|
121928
121940
|
for (const game of await this.options.site.games()) {
|
|
121929
121941
|
if (this.has(game.slug)) continue;
|
|
121930
121942
|
try {
|
|
121931
121943
|
if ((await this.pull(game.slug, { documentOnly: true })).unsaved) unsaved.push(game.slug);
|
|
121932
121944
|
} catch (error2) {
|
|
121933
|
-
|
|
121934
|
-
this.options.log?.(`${game.slug} could not be loaded for the list: ${
|
|
121945
|
+
const why = error2.message;
|
|
121946
|
+
this.options.log?.(`${game.slug} could not be loaded for the list: ${why}`);
|
|
121947
|
+
unread.push(`${game.slug}, ${why}`);
|
|
121935
121948
|
}
|
|
121936
121949
|
}
|
|
121937
|
-
return unsaved;
|
|
121950
|
+
return { unsaved, unread };
|
|
121938
121951
|
}
|
|
121939
121952
|
};
|
|
121940
121953
|
|
|
@@ -122871,7 +122884,7 @@ var Uploader = class {
|
|
|
122871
122884
|
} catch (error2) {
|
|
122872
122885
|
const words2 = error2 instanceof SiteRefusal ? error2.message : `the website could not be reached (${error2.message})`;
|
|
122873
122886
|
this.options.log(`${slug} was not all sent: ${words2}`);
|
|
122874
|
-
waiting.set("", `${slug} was not all sent
|
|
122887
|
+
waiting.set("", `${slug} was not all sent (${words2}): it is sent again with the next change`);
|
|
122875
122888
|
}
|
|
122876
122889
|
if (waiting.size === 0) this.waiting.delete(slug);
|
|
122877
122890
|
return [...waiting.values()];
|
|
@@ -122915,7 +122928,7 @@ var Uploader = class {
|
|
|
122915
122928
|
} else {
|
|
122916
122929
|
const answer3 = await site.putSave(slug, document2.version, bytes2, saveAbout(document2.doc));
|
|
122917
122930
|
if ("saved" in answer3) copy.setSaved(slug, answer3.current);
|
|
122918
|
-
else waiting.set("", `${slug} was not saved on the website
|
|
122931
|
+
else waiting.set("", `${slug} was not saved on the website (${answer3.reason ?? `it is at version ${String(answer3.latest)}`}): it is sent again with the next change`);
|
|
122919
122932
|
}
|
|
122920
122933
|
}
|
|
122921
122934
|
const here = new Map(filesUnder2(dir).map((path) => [path, this.options.copy.fingerprintOf(join32(dir, path))]));
|
|
@@ -122931,7 +122944,7 @@ var Uploader = class {
|
|
|
122931
122944
|
await this.put(slug, path, sha, known.get(path) ?? "none", waiting);
|
|
122932
122945
|
}
|
|
122933
122946
|
for (const [path, sha] of known) {
|
|
122934
|
-
if (here.has(path)) continue;
|
|
122947
|
+
if (here.has(path) || skipped(path)) continue;
|
|
122935
122948
|
const removed = await site.removeFile(slug, path, sha);
|
|
122936
122949
|
if (removed !== null && "refused" in removed && removed.current !== null) await site.removeFile(slug, path, removed.current);
|
|
122937
122950
|
copy.setKnown(slug, path, null);
|
|
@@ -122948,7 +122961,7 @@ var Uploader = class {
|
|
|
122948
122961
|
answer3 = await site.putFile(slug, path, from, mine, over);
|
|
122949
122962
|
} catch (error2) {
|
|
122950
122963
|
if (error2 instanceof SiteRefusal) {
|
|
122951
|
-
waiting.set(path, `${slug}'s ${path} was not sent
|
|
122964
|
+
waiting.set(path, `${slug}'s ${path} was not sent (${error2.message}): it is sent again with the next change`);
|
|
122952
122965
|
return;
|
|
122953
122966
|
}
|
|
122954
122967
|
const listed5 = await site.game(slug).catch(() => null);
|
|
@@ -123136,8 +123149,11 @@ async function startProgram(options) {
|
|
|
123136
123149
|
const named3 = typeof args2["game"] === "string" ? args2["game"] : name2 === "save_game" && typeof args2["name"] === "string" ? args2["name"] : null;
|
|
123137
123150
|
const slug = named3 !== null && isGameSlug(named3) ? named3 : null;
|
|
123138
123151
|
const pending = [];
|
|
123152
|
+
let unread = [];
|
|
123139
123153
|
try {
|
|
123140
|
-
const
|
|
123154
|
+
const listing = name2 === "list_games" || makesGame(name2, args2, () => false) ? await copy.documents() : { unsaved: [], unread: [] };
|
|
123155
|
+
const unsaved = [...listing.unsaved];
|
|
123156
|
+
unread = listing.unread;
|
|
123141
123157
|
if (slug !== null && await site.game(slug) !== null) {
|
|
123142
123158
|
if (!copy.has(slug)) {
|
|
123143
123159
|
if ((await copy.pull(slug)).unsaved) unsaved.push(slug);
|
|
@@ -123151,7 +123167,6 @@ async function startProgram(options) {
|
|
|
123151
123167
|
}
|
|
123152
123168
|
if (unsaved.length > 0) pending.push(...(await uploader.send(unsaved)).pending);
|
|
123153
123169
|
} catch (error2) {
|
|
123154
|
-
if (!(error2 instanceof SiteRefusal)) throw error2;
|
|
123155
123170
|
return refusal3(error2.message);
|
|
123156
123171
|
}
|
|
123157
123172
|
const here = slug !== null && existsSync21(join33(copy.root, slug, "game.json"));
|
|
@@ -123164,8 +123179,11 @@ async function startProgram(options) {
|
|
|
123164
123179
|
const made2 = [...gamesHere(copy.root)].filter((one2) => !before2.has(one2));
|
|
123165
123180
|
pending.push(...(await uploader.send([...slug === null ? [] : [slug], ...made2])).pending);
|
|
123166
123181
|
}
|
|
123182
|
+
if (name2 === "list_games" && unread.length > 0) {
|
|
123183
|
+
answer3 = { ...answer3, content: [...answer3.content, { type: "text", text: `Not read: ${unread.join("; ")}.` }] };
|
|
123184
|
+
}
|
|
123167
123185
|
if (pending.length > 0) {
|
|
123168
|
-
answer3 = { ...answer3, content: [...answer3.content, { type: "text", text: `Not on the website yet: ${pending.join("; ")}
|
|
123186
|
+
answer3 = { ...answer3, content: [...answer3.content, { type: "text", text: `Not on the website yet: ${pending.join("; ")}.` }] };
|
|
123169
123187
|
}
|
|
123170
123188
|
if (!told) {
|
|
123171
123189
|
told = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gamesteel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "The Gamesteel program your AI agent starts, and the command that sets it up in Claude Code, Codex, Gemini CLI, Cursor, VS Code and 26 more. The work runs on your machine; the website keeps your games.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gamesteel",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "UNLICENSED",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bin": {
|
|
20
|
-
"gamesteel": "
|
|
20
|
+
"gamesteel": "dist/gamesteel.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|