rpg-engine 0.1.2 → 0.2.1
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/README.md +3 -1
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +5 -1
- package/dist/campaign/settings.js +18 -3
- package/dist/command-line.js +26 -8
- package/dist/commands/advance.js +26 -7
- package/dist/commands/ask.d.ts +6 -0
- package/dist/commands/ask.js +3 -3
- package/dist/commands/config.js +40 -10
- package/dist/commands/game-advance.d.ts +6 -0
- package/dist/commands/game-advance.js +9 -2
- package/dist/commands/game-extension-list.d.ts +27 -0
- package/dist/commands/game-extension-list.js +92 -0
- package/dist/commands/game-extensions.d.ts +27 -0
- package/dist/commands/game-extensions.js +177 -0
- package/dist/commands/game-mode.js +2 -1
- package/dist/commands/game-time.d.ts +15 -3
- package/dist/commands/game-time.js +76 -6
- package/dist/commands/game-world.js +6 -3
- package/dist/commands/index.js +2 -0
- package/dist/commands/package.d.ts +64 -0
- package/dist/commands/package.js +293 -0
- package/dist/commands/problems.js +3 -1
- package/dist/commands/scene.d.ts +3 -3
- package/dist/commands/sheet.js +7 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +10 -5
- package/dist/commands/travel.js +4 -2
- package/dist/commands/validate.js +4 -2
- package/dist/commands/view.d.ts +5 -0
- package/dist/commands/view.js +3 -1
- package/dist/core/context.d.ts +38 -0
- package/dist/core/context.js +11 -0
- package/dist/core/instruction-parts.d.ts +10 -0
- package/dist/core/instruction-parts.js +32 -0
- package/dist/core/store.d.ts +2 -0
- package/dist/core/store.js +8 -0
- package/dist/dashboard/app.js +2 -1
- package/dist/dashboard/game-words.js +21 -0
- package/dist/dashboard/i18n/ar.json +7 -0
- package/dist/dashboard/i18n/cs.json +7 -0
- package/dist/dashboard/i18n/da.json +7 -0
- package/dist/dashboard/i18n/de.json +7 -0
- package/dist/dashboard/i18n/el.json +7 -0
- package/dist/dashboard/i18n/es.json +7 -0
- package/dist/dashboard/i18n/fi.json +7 -0
- package/dist/dashboard/i18n/fr.json +7 -0
- package/dist/dashboard/i18n/he.json +7 -0
- package/dist/dashboard/i18n/hi.json +7 -0
- package/dist/dashboard/i18n/hu.json +7 -0
- package/dist/dashboard/i18n/is.json +7 -0
- package/dist/dashboard/i18n/it.json +7 -0
- package/dist/dashboard/i18n/ja.json +7 -0
- package/dist/dashboard/i18n/ko.json +7 -0
- package/dist/dashboard/i18n/nb.json +7 -0
- package/dist/dashboard/i18n/nl.json +7 -0
- package/dist/dashboard/i18n/pl.json +7 -0
- package/dist/dashboard/i18n/pt.json +7 -0
- package/dist/dashboard/i18n/ro.json +7 -0
- package/dist/dashboard/i18n/ru.json +7 -0
- package/dist/dashboard/i18n/sv.json +7 -0
- package/dist/dashboard/i18n/tr.json +7 -0
- package/dist/dashboard/i18n/uk.json +7 -0
- package/dist/dashboard/i18n/zh.json +7 -0
- package/dist/dashboard/icons.js +1 -0
- package/dist/dashboard/top.js +5 -5
- package/dist/extensions/api.d.ts +73 -0
- package/dist/extensions/api.js +1 -0
- package/dist/extensions/extension.d.ts +43 -0
- package/dist/extensions/extension.js +113 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.js +2 -0
- package/dist/extensions/packages.d.ts +11 -0
- package/dist/extensions/packages.js +155 -0
- package/dist/index.d.ts +1 -0
- package/dist/mcp-server.js +50 -4
- package/dist/systems/game-system.d.ts +1 -5
- package/dist/systems/game-system.js +6 -31
- package/dist/systems/index.d.ts +1 -1
- package/dist/time/calendar.d.ts +36 -0
- package/dist/time/calendar.js +84 -0
- package/dist/time/index.d.ts +1 -0
- package/dist/time/index.js +2 -1
- package/package.json +2 -3
- package/systems/5e/instructions/play.md +1 -0
- package/systems/5e/system.yaml +2 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { changeExtensions, readTextSetting, requireCampaign } from "../campaign/index.js";
|
|
3
|
+
import { appendLogEntry } from "../core/log.js";
|
|
4
|
+
import { defineCommand } from "../core/registry.js";
|
|
5
|
+
import { files } from "../core/store.js";
|
|
6
|
+
import { comparableText } from "../core/text.js";
|
|
7
|
+
import { extensionApi, findExtension, installedExtensions, isFolderSpec, isVerified, readExtension, shortName, verifiedScope } from "../extensions/index.js";
|
|
8
|
+
import { chooseAnswer } from "./ask.js";
|
|
9
|
+
import { listedExtensions, runsCode } from "./game-extension-list.js";
|
|
10
|
+
import { extensionCommandNames, packagesInstalled } from "./game-extensions.js";
|
|
11
|
+
import { campaignMode } from "./game-mode.js";
|
|
12
|
+
import { newDatedLogEntry } from "./game-time.js";
|
|
13
|
+
import { campaignWorld } from "./game-world.js";
|
|
14
|
+
export const packageCommand = defineCommand({
|
|
15
|
+
name: "package",
|
|
16
|
+
description: "The packages of the campaign: extensions such as weather, from npm. "
|
|
17
|
+
+ "list says those on this computer and those the campaign uses; available, those npm has, and updates. install adds or updates one, on this computer and in the campaign, "
|
|
18
|
+
+ "only once the player wants it; one not published by RPG Engine (@rpgengine/…) is someone else's: the player is asked on their dashboard or in a form, or installs it from their terminal. "
|
|
19
|
+
+ "remove takes one out of the campaign; uninstall takes it off this computer. Example: package install weather.",
|
|
20
|
+
group: "campaign",
|
|
21
|
+
positionals: ["action", "name"],
|
|
22
|
+
slow: true,
|
|
23
|
+
input: z.object({
|
|
24
|
+
action: z.enum(["list", "available", "install", "remove", "uninstall"]).describe("list, available, install, remove or uninstall"),
|
|
25
|
+
name: z.string().optional().describe("the package: its name alone for one of ours, such as weather; another's npm name with its scope, or npm:name without one, its version if wanted; or a folder on this computer"),
|
|
26
|
+
"accept-risk": z.boolean().optional().describe("on the command line only: the player's own yes to a package not published by RPG Engine, at their own risk"),
|
|
27
|
+
}),
|
|
28
|
+
async run(input, context) {
|
|
29
|
+
const root = requireCampaign(context.folder);
|
|
30
|
+
if (input.action === "list") {
|
|
31
|
+
return listed(root, context);
|
|
32
|
+
}
|
|
33
|
+
if (input.action === "available") {
|
|
34
|
+
return await available(context);
|
|
35
|
+
}
|
|
36
|
+
const name = input.name?.trim();
|
|
37
|
+
if (name === undefined || name === "") {
|
|
38
|
+
throw new Error(`Give the package to ${input.action}, such as package ${input.action} weather.`);
|
|
39
|
+
}
|
|
40
|
+
if (input.action === "install") {
|
|
41
|
+
return await installed(root, context, name, context.terminal === true && input["accept-risk"] === true);
|
|
42
|
+
}
|
|
43
|
+
return input.action === "remove" ? removed(root, context, name) : await uninstalled(root, context, name);
|
|
44
|
+
},
|
|
45
|
+
format(result) {
|
|
46
|
+
if (result.kind === "removed") {
|
|
47
|
+
return `The campaign no longer uses ${result.name}: its commands and its parts of your instructions are gone; what it kept in the campaign stays, and comes back if it is installed again.`;
|
|
48
|
+
}
|
|
49
|
+
if (result.kind === "uninstalled") {
|
|
50
|
+
return `${result.name} is off this computer${result.wasUsed ? ", and the campaign no longer uses it" : ""}: another campaign that lists it asks to install it again.`;
|
|
51
|
+
}
|
|
52
|
+
if (result.kind === "installed") {
|
|
53
|
+
const { extension } = result;
|
|
54
|
+
const what = `${extension.name} ${extension.version}${result.verified ? ", verified" : ", not verified: at the player's risk"}`;
|
|
55
|
+
const said = [
|
|
56
|
+
`${result.already ? `The campaign already uses ${what}` : `Installed ${what}, and the campaign uses it`}: ${extension.about}.`,
|
|
57
|
+
result.codeLeftOut ? "Its code is not used: for now RPG Engine runs only its own packages' code, and its texts bring the rest." : "",
|
|
58
|
+
result.commands.length === 0 ? "" : `Its commands: ${result.commands.join(", ")}.${result.tools === "" ? "" : ` ${result.tools}`}`,
|
|
59
|
+
Object.keys(extension.parts).length === 0 ? "" : `Its parts of your instructions are given when they apply: ${Object.keys(extension.parts).join(", ")}.`,
|
|
60
|
+
].filter((line) => line !== "").join(" ");
|
|
61
|
+
return result.part === undefined ? said : `${said}\n\nIts part for now:\n\n${result.part}`;
|
|
62
|
+
}
|
|
63
|
+
if (result.kind === "available") {
|
|
64
|
+
if (result.failed !== undefined) {
|
|
65
|
+
return `npm could not be asked: ${result.failed}.`;
|
|
66
|
+
}
|
|
67
|
+
const lines = result.packages.map((one) => {
|
|
68
|
+
const here = one.installed === undefined ? "" : one.update ? `, installed ${one.installed}: an update` : ", installed";
|
|
69
|
+
const by = one.author === undefined ? "" : ` by ${one.author}`;
|
|
70
|
+
return `${one.name} ${one.version}${one.verified ? "" : " (not verified)"}${by}${here}${one.description === undefined ? "" : `: ${one.description.replace(/\.$/, "")}`}`;
|
|
71
|
+
});
|
|
72
|
+
return `On npm: ${lines.length === 0 ? "none" : lines.join("; ")}.`;
|
|
73
|
+
}
|
|
74
|
+
const installedLines = result.installed.map((one) => "broken" in one ? `${one.name} (broken: ${one.broken}; install it again)` : `${one.name} ${one.version}${one.verified ? "" : " (not verified)"}${one.used ? ", used by the campaign" : ""}`);
|
|
75
|
+
return [
|
|
76
|
+
`On this computer: ${installedLines.length === 0 ? "none" : installedLines.join("; ")}.`,
|
|
77
|
+
result.missing.length === 0 ? "" : `The campaign lists, not installed here: ${result.missing.join(", ")}; install each with package install.`,
|
|
78
|
+
"package available says those npm has, and updates.",
|
|
79
|
+
].filter((line) => line !== "").join("\n");
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
/** The packages on this computer, and those the campaign lists and does not find there: at once, without npm (D-442). */
|
|
83
|
+
function listed(root, context) {
|
|
84
|
+
const used = Object.keys(listedExtensions(root));
|
|
85
|
+
const here = installedExtensions(context.extensionFolders ?? []).map((found) => {
|
|
86
|
+
try {
|
|
87
|
+
const extension = readExtension(found.folder);
|
|
88
|
+
return {
|
|
89
|
+
name: extension.name,
|
|
90
|
+
package: extension.package,
|
|
91
|
+
version: extension.version,
|
|
92
|
+
title: extension.title,
|
|
93
|
+
about: extension.about,
|
|
94
|
+
verified: isVerified(extension.package, extension.linked),
|
|
95
|
+
used: used.includes(extension.package),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return { name: shortName(found.package), package: found.package, broken: error instanceof Error ? error.message : String(error) };
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return { kind: "list", installed: here, missing: used.filter((name) => !here.some((one) => one.package === name)) };
|
|
103
|
+
}
|
|
104
|
+
/** The extensions npm has for this rpg-engine's API, ours first, each with the version installed here and whether npm has a newer one (D-442). */
|
|
105
|
+
async function available(context) {
|
|
106
|
+
const searched = context.packages === undefined ? { failed: "only the game's server and the command line reach npm" } : await context.packages.search();
|
|
107
|
+
if ("failed" in searched) {
|
|
108
|
+
return { kind: "available", packages: [], failed: searched.failed };
|
|
109
|
+
}
|
|
110
|
+
const here = installedExtensions(context.extensionFolders ?? []);
|
|
111
|
+
const packages = searched.filter((one) => one.kind === "extension" && one.api === extensionApi).map((one) => {
|
|
112
|
+
const installed = here.find((found) => found.package === one.name);
|
|
113
|
+
const version = installed === undefined ? undefined : usable(context, one.name)?.version;
|
|
114
|
+
return {
|
|
115
|
+
name: shortName(one.name),
|
|
116
|
+
package: one.name,
|
|
117
|
+
version: one.version,
|
|
118
|
+
...(one.description === undefined ? {} : { description: one.description }),
|
|
119
|
+
...(one.author === undefined ? {} : { author: one.author }),
|
|
120
|
+
verified: one.name.startsWith(verifiedScope),
|
|
121
|
+
...(installed === undefined ? {} : { installed: version ?? "broken" }),
|
|
122
|
+
update: version !== undefined && newer(one.version, version),
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
return { kind: "available", packages: packages.sort((first, second) => Number(second.verified) - Number(first.verified) || first.name.localeCompare(second.name)) };
|
|
126
|
+
}
|
|
127
|
+
/** Whether a version is newer than another, by its numbers: 0.2.0 after 0.1.10. */
|
|
128
|
+
function newer(version, than) {
|
|
129
|
+
const numbers = (text) => text.split(/[.+-]/).slice(0, 3).map((part) => Number.parseInt(part, 10) || 0);
|
|
130
|
+
const [one, other] = [numbers(version), numbers(than)];
|
|
131
|
+
const differs = one.findIndex((part, index) => part !== other[index]);
|
|
132
|
+
return differs !== -1 && one[differs] > other[differs];
|
|
133
|
+
}
|
|
134
|
+
/** Installs a package on this computer and adds it to the campaign (D-27, D-428, D-441): ours, or another once the player wants it; an extension, for this game. */
|
|
135
|
+
async function installed(root, context, name, acceptRisk) {
|
|
136
|
+
const packages = context.packages;
|
|
137
|
+
if (packages === undefined) {
|
|
138
|
+
throw new Error("Packages are installed only by the game's server or the command line, which reach npm.");
|
|
139
|
+
}
|
|
140
|
+
// A name alone is one of ours: weather is @rpgengine/weather, never a stranger's of that name, which is given as npm:weather.
|
|
141
|
+
const spec = name.startsWith("npm:") ? name.slice(4) : isFolderSpec(name) || name.startsWith("@") ? name : `${verifiedScope}${name}`;
|
|
142
|
+
const described = await packages.describe(spec);
|
|
143
|
+
if ("failed" in described) {
|
|
144
|
+
throw new Error(`${described.failed}. Nothing changed${spec === name ? "" : `: ${name} alone means ${spec}, one of RPG Engine's; another's is named with its scope, or as npm:${name} without one`}.`);
|
|
145
|
+
}
|
|
146
|
+
if (described.kind !== "extension") {
|
|
147
|
+
throw new Error(described.kind === undefined
|
|
148
|
+
? `${described.name} is not a package for RPG Engine: its package.json does not say "rpg-engine": {"kind": "extension"}. Nothing changed.`
|
|
149
|
+
: `${described.name} is a package of kind ${described.kind}: for now only extensions are installed this way. Nothing changed.`);
|
|
150
|
+
}
|
|
151
|
+
if (described.api !== extensionApi) {
|
|
152
|
+
throw new Error(`${described.name} ${described.version} is made for the extension API ${described.api ?? "none"}, and this RPG Engine reads the API ${extensionApi}: install a version made for it. Nothing changed.`);
|
|
153
|
+
}
|
|
154
|
+
const folderSpec = isFolderSpec(spec);
|
|
155
|
+
if (!isVerified(described.name, folderSpec)) {
|
|
156
|
+
await playerYes(context, folderSpec ? name : described.name, acceptRisk, folderSpec);
|
|
157
|
+
}
|
|
158
|
+
const before = usable(context, described.name);
|
|
159
|
+
const reinstall = before === undefined || before.version !== described.version || folderSpec;
|
|
160
|
+
if (reinstall) {
|
|
161
|
+
const why = await packages.install(spec);
|
|
162
|
+
if (why !== undefined) {
|
|
163
|
+
throw new Error(`${described.name} could not be installed: ${why}. Nothing changed in the campaign.`);
|
|
164
|
+
}
|
|
165
|
+
// npm wrote there: what the call read of those folders is read again, and the code anew.
|
|
166
|
+
(context.extensionFolders ?? []).forEach((folder) => files().refresh(folder));
|
|
167
|
+
packagesInstalled();
|
|
168
|
+
}
|
|
169
|
+
const extension = usable(context, described.name);
|
|
170
|
+
if (extension === undefined) {
|
|
171
|
+
throw new Error(`${described.name} was installed, but RPG Engine cannot use it as an extension. Nothing changed in the campaign.`);
|
|
172
|
+
}
|
|
173
|
+
const system = readTextSetting(root, "system");
|
|
174
|
+
if (extension.needs.system !== undefined && comparableText(extension.needs.system) !== comparableText(system ?? "")) {
|
|
175
|
+
throw new Error(`${extension.name} is installed on this computer, but it is for the game system ${extension.needs.system}, and the campaign plays ${system ?? "none"}: the campaign does not use it.`);
|
|
176
|
+
}
|
|
177
|
+
const others = Object.keys(listedExtensions(root)).filter((other) => other !== extension.package && shortName(other) === extension.name);
|
|
178
|
+
if (others.length > 0) {
|
|
179
|
+
throw new Error(`The campaign uses ${others[0]}, with the same name, ${extension.name}: take it away with package remove ${others[0]} first. Nothing changed in the campaign.`);
|
|
180
|
+
}
|
|
181
|
+
// Its code is checked before the campaign lists it: a package that would not work is never added.
|
|
182
|
+
const commands = runsCode(extension)
|
|
183
|
+
? await extensionCommandNames(extension, []).catch((error) => {
|
|
184
|
+
throw new Error(`The code of ${extension.package} cannot be used: ${error instanceof Error ? error.message : String(error)}. Nothing changed in the campaign.`);
|
|
185
|
+
})
|
|
186
|
+
: [];
|
|
187
|
+
const listedBefore = listedExtensions(root);
|
|
188
|
+
const already = listedBefore[extension.package] === extension.version && !reinstall;
|
|
189
|
+
const verified = isVerified(extension.package, extension.linked);
|
|
190
|
+
if (listedBefore[extension.package] !== extension.version) {
|
|
191
|
+
changeExtensions(root, { ...listedBefore, [extension.package]: extension.version });
|
|
192
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-installed", "public", { package: extension.package, version: extension.version, verified }));
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
kind: "installed",
|
|
196
|
+
extension,
|
|
197
|
+
verified,
|
|
198
|
+
commands,
|
|
199
|
+
codeLeftOut: extension.code !== undefined && !runsCode(extension),
|
|
200
|
+
already,
|
|
201
|
+
...modePart(root, context, extension),
|
|
202
|
+
tools: toolsNote(context),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The player's own yes to a package not ours (D-441): on the command line, --accept-risk they typed; in a chat, a button on their dashboard or in the host's
|
|
207
|
+
* form, never the master's word. It throws when there is none.
|
|
208
|
+
*/
|
|
209
|
+
async function playerYes(context, name, acceptRisk, fromFolder) {
|
|
210
|
+
const warning = fromFolder
|
|
211
|
+
? `${name} is a folder of this computer, not a package published by RPG Engine: it is never verified, and RPG Engine takes no responsibility for it.`
|
|
212
|
+
: `${name} is not published by RPG Engine: its texts are someone else's, and RPG Engine takes no responsibility for it.`;
|
|
213
|
+
if (context.terminal === true) {
|
|
214
|
+
if (!acceptRisk) {
|
|
215
|
+
throw new Error(`${warning} To install it at your own risk: package install ${name} --accept-risk. Nothing changed.`);
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const answer = await chooseAnswer(context, `Install ${name}? ${warning}`, "A package not ours", ["Install it, at my risk", "Do not install it"]);
|
|
220
|
+
if (answer === 0) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (answer === 1 || (typeof answer === "object" && answer !== null)) {
|
|
224
|
+
throw new Error(`The player did not want ${name}. Nothing changed.`);
|
|
225
|
+
}
|
|
226
|
+
throw new Error(`${warning} Only the player can say yes to it, and they cannot be asked here: tell them to install it from their terminal, in the campaign's folder, with rpg package install ${name} --accept-risk. Nothing changed.`);
|
|
227
|
+
}
|
|
228
|
+
/** The installed extension of this package, when it reads; undefined when it is missing or broken. */
|
|
229
|
+
function usable(context, name) {
|
|
230
|
+
try {
|
|
231
|
+
return findExtension(context.extensionFolders ?? [], name);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** The extension's part of the instructions for the mode the campaign is in, which the chat going on has not been given. */
|
|
238
|
+
function modePart(root, context, extension) {
|
|
239
|
+
const mode = campaignMode(root, campaignWorld(root, context)).replace(" ", "-");
|
|
240
|
+
const part = extension.parts[mode]?.text;
|
|
241
|
+
return part === undefined ? {} : { part };
|
|
242
|
+
}
|
|
243
|
+
/** When the master can call the new commands: on the command line at once; in a chat, as the app in use hears new tools. */
|
|
244
|
+
function toolsNote(context) {
|
|
245
|
+
const host = context.host?.() ?? "";
|
|
246
|
+
if (context.host === undefined) {
|
|
247
|
+
return "";
|
|
248
|
+
}
|
|
249
|
+
if (/codex/i.test(host)) {
|
|
250
|
+
return "Codex sees them only once it is closed and opened again: tell the player.";
|
|
251
|
+
}
|
|
252
|
+
if (/claude-ai|claude desktop/i.test(host)) {
|
|
253
|
+
return "This app sees them only once it is closed and opened again: tell the player.";
|
|
254
|
+
}
|
|
255
|
+
return "They are yours from the player's next message.";
|
|
256
|
+
}
|
|
257
|
+
/** Takes an extension out of the campaign; it stays on this computer, for other campaigns. */
|
|
258
|
+
function removed(root, context, name) {
|
|
259
|
+
const listed = listedExtensions(root);
|
|
260
|
+
const found = Object.keys(listed).find((candidate) => candidate === name || comparableText(shortName(candidate)) === comparableText(name));
|
|
261
|
+
if (found === undefined) {
|
|
262
|
+
const names = Object.keys(listed).map(shortName);
|
|
263
|
+
throw new Error(`The campaign does not use ${name}${names.length === 0 ? ": it uses no package" : `; it uses ${names.join(", ")}`}. Nothing changed.`);
|
|
264
|
+
}
|
|
265
|
+
const rest = Object.fromEntries(Object.entries(listed).filter(([candidate]) => candidate !== found));
|
|
266
|
+
changeExtensions(root, rest);
|
|
267
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-removed", "public", { package: found }));
|
|
268
|
+
return { kind: "removed", name: shortName(found) };
|
|
269
|
+
}
|
|
270
|
+
/** Takes a package off this computer with npm, and out of the campaign when it uses it (D-442); other campaigns that list it ask to install it again. */
|
|
271
|
+
async function uninstalled(root, context, name) {
|
|
272
|
+
const packages = context.packages;
|
|
273
|
+
const found = installedExtensions(context.extensionFolders ?? []).find((one) => one.package === name || comparableText(shortName(one.package)) === comparableText(name));
|
|
274
|
+
if (found === undefined) {
|
|
275
|
+
const here = installedExtensions(context.extensionFolders ?? []).map((one) => shortName(one.package));
|
|
276
|
+
throw new Error(`${name} is not on this computer${here.length === 0 ? ": no package is" : `; these are: ${here.join(", ")}`}. Nothing changed.`);
|
|
277
|
+
}
|
|
278
|
+
if (packages === undefined) {
|
|
279
|
+
throw new Error("Packages are uninstalled only by the game's server or the command line, which reach npm.");
|
|
280
|
+
}
|
|
281
|
+
const why = await packages.uninstall(found.package);
|
|
282
|
+
if (why !== undefined) {
|
|
283
|
+
throw new Error(`${found.package} could not be uninstalled: ${why}. Nothing changed.`);
|
|
284
|
+
}
|
|
285
|
+
(context.extensionFolders ?? []).forEach((folder) => files().refresh(folder));
|
|
286
|
+
const listed = listedExtensions(root);
|
|
287
|
+
const wasUsed = Object.hasOwn(listed, found.package);
|
|
288
|
+
if (wasUsed) {
|
|
289
|
+
changeExtensions(root, Object.fromEntries(Object.entries(listed).filter(([candidate]) => candidate !== found.package)));
|
|
290
|
+
}
|
|
291
|
+
appendLogEntry(root, newDatedLogEntry(root, context, "package-uninstalled", "public", { package: found.package }));
|
|
292
|
+
return { kind: "uninstalled", name: shortName(found.package), wasUsed };
|
|
293
|
+
}
|
|
@@ -4,6 +4,7 @@ import { checkWorld } from "../pages/index.js";
|
|
|
4
4
|
import { effectProblems } from "./game-effects.js";
|
|
5
5
|
import { eventProblems } from "./game-events.js";
|
|
6
6
|
import { experienceProblems } from "./game-experience.js";
|
|
7
|
+
import { campaignExtensions } from "./game-extension-list.js";
|
|
7
8
|
import { gridProblems } from "./game-grids.js";
|
|
8
9
|
import { imageProblems } from "./game-images.js";
|
|
9
10
|
import { mapProblems } from "./game-maps.js";
|
|
@@ -37,7 +38,8 @@ export function campaignProblems(root, world, context) {
|
|
|
37
38
|
...mapProblems(world),
|
|
38
39
|
...gridProblems(world, readOpenScene(root).scene),
|
|
39
40
|
...shortRoadProblems(world),
|
|
40
|
-
...timeProblems(root),
|
|
41
|
+
...timeProblems(root, context),
|
|
42
|
+
...campaignExtensions(root, context).problems,
|
|
41
43
|
...modeProblems(root),
|
|
42
44
|
...eventProblems(world),
|
|
43
45
|
...questProblems(world),
|
package/dist/commands/scene.d.ts
CHANGED
|
@@ -26,12 +26,12 @@ interface Saved {
|
|
|
26
26
|
export declare const scene: import("../core/registry.ts").Command<z.ZodObject<{
|
|
27
27
|
action: z.ZodEnum<{
|
|
28
28
|
next: "next";
|
|
29
|
-
open: "open";
|
|
30
29
|
add: "add";
|
|
31
|
-
|
|
30
|
+
close: "close";
|
|
31
|
+
open: "open";
|
|
32
32
|
order: "order";
|
|
33
|
+
now: "now";
|
|
33
34
|
hostile: "hostile";
|
|
34
|
-
close: "close";
|
|
35
35
|
leave: "leave";
|
|
36
36
|
calm: "calm";
|
|
37
37
|
}>;
|
package/dist/commands/sheet.js
CHANGED
|
@@ -430,7 +430,13 @@ function linkText(text) {
|
|
|
430
430
|
/** The items of a list that the game system does not take, by the names they are read as (SYS-8); none for a field without values. */
|
|
431
431
|
function wrongValues(system, field, value) {
|
|
432
432
|
const allowed = allowedValues(system, field);
|
|
433
|
-
|
|
433
|
+
// A text with closed names, as an alignment, is one name whole, commas and all.
|
|
434
|
+
const names = isTextField(system, field) ? (isEmptyField(value) ? [] : [String(value).trim()]) : listItemNames(value);
|
|
435
|
+
return allowed === undefined ? [] : names.filter((name) => !allowed.some((item) => comparableText(item) === comparableText(name)));
|
|
436
|
+
}
|
|
437
|
+
/** A field the system declares as text, such as alignment. */
|
|
438
|
+
function isTextField(system, field) {
|
|
439
|
+
return Object.entries(system?.fields ?? {}).some(([name, kind]) => kind === "text" && comparableText(name) === comparableText(field));
|
|
434
440
|
}
|
|
435
441
|
/** The names a list field takes in the game system (SYS-8); undefined for a field without values. */
|
|
436
442
|
function allowedValues(system, field) {
|
package/dist/commands/status.js
CHANGED
|
@@ -5,12 +5,13 @@ import { defineCommand } from "../core/registry.js";
|
|
|
5
5
|
import { isInParty, isPartyMember, locate, pagesWithName, parsePageReference } from "../pages/index.js";
|
|
6
6
|
import { bookTitles, readRuleBook } from "../rules/index.js";
|
|
7
7
|
import { sceneTypes } from "../scene/index.js";
|
|
8
|
-
import { formatGameDate } from "../time/index.js";
|
|
9
8
|
import { effectiveFields, effectsOf } from "./effect-layer.js";
|
|
10
9
|
import { effectShown, keptEffects } from "./game-effects.js";
|
|
11
10
|
import { surroundings, surroundingsText } from "./game-environment.js";
|
|
12
11
|
import { clocksToMove, dueAdvice, dueText, isDated, isDue, plannedEvents, plannedText, worldFacts } from "./game-events.js";
|
|
13
12
|
import { experienceOf, levelDueNote } from "./game-experience.js";
|
|
13
|
+
import { extensionsLine } from "./game-extension-list.js";
|
|
14
|
+
import { extensionCodeProblems } from "./game-extensions.js";
|
|
14
15
|
import { picturesNote } from "./game-images.js";
|
|
15
16
|
import { journeyText, readJourney } from "./game-journey.js";
|
|
16
17
|
import { campaignMode, campaignNote } from "./game-mode.js";
|
|
@@ -20,7 +21,7 @@ import { isTickedOpenQuest, openQuestText } from "./game-quests.js";
|
|
|
20
21
|
import { measuresOf, roadsOf } from "./game-roads.js";
|
|
21
22
|
import { interruptedLoad } from "./game-saves.js";
|
|
22
23
|
import { closedScenes, copyCounters, copyPage, partyAwayText, readOpenScene } from "./game-scene.js";
|
|
23
|
-
import { problemText, readPresent } from "./game-time.js";
|
|
24
|
+
import { datedText, problemText, readPresent } from "./game-time.js";
|
|
24
25
|
import { campaignSystem, campaignWorld, systemInStatus, systemSettingValue } from "./game-world.js";
|
|
25
26
|
import { countersText, pageCounters, partyCounters } from "./page-counters.js";
|
|
26
27
|
import { campaignProblems } from "./problems.js";
|
|
@@ -39,8 +40,9 @@ export const status = defineCommand({
|
|
|
39
40
|
readOnly: true,
|
|
40
41
|
alwaysLoad: true,
|
|
41
42
|
input: z.object({}),
|
|
42
|
-
run(input, context) {
|
|
43
|
+
async run(input, context) {
|
|
43
44
|
const root = requireCampaign(context.folder);
|
|
45
|
+
const codeProblems = await extensionCodeProblems(root, context, []);
|
|
44
46
|
const settings = readSettings(root);
|
|
45
47
|
const world = campaignWorld(root, context);
|
|
46
48
|
const characters = world.pages.filter((page) => page.type === "character");
|
|
@@ -105,6 +107,8 @@ export const status = defineCommand({
|
|
|
105
107
|
veils: settings.veils ?? [],
|
|
106
108
|
table: settings.table ?? [],
|
|
107
109
|
precedents: settings.precedents ?? [],
|
|
110
|
+
// The extensions it uses, each with what it brings (D-28).
|
|
111
|
+
extensions: extensionsLine(root, context),
|
|
108
112
|
houseRules: bookTitles(readRuleBook(join(root, houseRulesFolderName), "house rules")),
|
|
109
113
|
players: players.map(member),
|
|
110
114
|
companions: characters.filter((page) => page.fields.role === "companion").map(member),
|
|
@@ -124,13 +128,13 @@ export const status = defineCommand({
|
|
|
124
128
|
lastScenes: closed.slice(0, shownNames).map((scene) => `${scene.title} (${scene.type}): ${scene.summary}`),
|
|
125
129
|
sceneCounts: sceneCounts(closed),
|
|
126
130
|
openQuests: openQuests(world, now),
|
|
127
|
-
now: now === undefined ? undefined :
|
|
131
|
+
now: now === undefined ? undefined : datedText(root, context, now),
|
|
128
132
|
dateProblem: present.problem === undefined ? undefined : problemText(present.problem),
|
|
129
133
|
datedEvents: events.some(isDated),
|
|
130
134
|
dueEvents: due.map(dueText),
|
|
131
135
|
plannedEvents: events.filter((event) => !due.includes(event)).map((event) => plannedText(event, now)),
|
|
132
136
|
clocks: clocksToMove(world, now, facts),
|
|
133
|
-
problems: campaignProblems(root, world, context).length,
|
|
137
|
+
problems: campaignProblems(root, world, context).length + codeProblems.length,
|
|
134
138
|
// A load that stopped halfway leaves the campaign between two times (SAV-5).
|
|
135
139
|
halfLoaded: interruptedLoad(root)?.number,
|
|
136
140
|
sheet: system === undefined ? undefined : sheetSummary(system),
|
|
@@ -159,6 +163,7 @@ export const status = defineCommand({
|
|
|
159
163
|
boundariesLine(result.lines, result.veils),
|
|
160
164
|
result.table.length === 0 ? "" : `Table: ${result.table.join("; ")}`,
|
|
161
165
|
result.precedents.length === 0 ? "" : `Precedents: ${result.precedents.join("; ")}`,
|
|
166
|
+
result.extensions,
|
|
162
167
|
result.houseRules.length === 0 ? "" : `House rules (rules): ${result.houseRules.join(", ")}`,
|
|
163
168
|
timeLine(result),
|
|
164
169
|
...(result.players.length === 0 ? [`No player character yet.${sheetNote(result.sheet)}`] : result.players.map((member) => `PC: ${member.name}${whereabouts(member)}${memberCounters(member)}`)),
|
package/dist/commands/travel.js
CHANGED
|
@@ -6,6 +6,7 @@ import { directionHelp, directionName, distanceBetween, pointAlong, pointFrom, r
|
|
|
6
6
|
import { environmentAt, locate, pageNamed, parsePageReference } from "../pages/index.js";
|
|
7
7
|
import { addDuration, formatGameDate, minutesBetween } from "../time/index.js";
|
|
8
8
|
import { aroundLead, passedLines, passTime } from "./game-advance.js";
|
|
9
|
+
import { timePassedLines } from "./game-extensions.js";
|
|
9
10
|
import { journeyPoint, journeyStart, moversMap, moversNamed, moversPosition, readJourney, sameMovers, saveJourney, travelledSinceRest } from "./game-journey.js";
|
|
10
11
|
import { playerCharacter } from "./game-knowledge.js";
|
|
11
12
|
import { mapKey, mapOf } from "./game-maps.js";
|
|
@@ -36,7 +37,7 @@ export const travel = defineCommand({
|
|
|
36
37
|
pace: z.string().optional().describe("one of the game's paces, such as fast or slow, or a speed, such as 4.5 km; if left out, the game's usual pace, or the one the journey had"),
|
|
37
38
|
hours: z.union([z.number(), z.string()]).optional().describe("the hours of travel today, when they differ from the game's: more for a forced march, 24 for a ship with its crew, 8 for a boat the party rows"),
|
|
38
39
|
}),
|
|
39
|
-
run(input, context) {
|
|
40
|
+
async run(input, context) {
|
|
40
41
|
const root = requireCampaign(context.folder);
|
|
41
42
|
let world = campaignWorld(root, context);
|
|
42
43
|
const system = campaignSystem(root, context);
|
|
@@ -87,7 +88,8 @@ export const travel = defineCommand({
|
|
|
87
88
|
const around = point === undefined || plan.from === undefined ? [] : aroundLines(world, roads, plan.from, point, measures, plan.map?.path);
|
|
88
89
|
const merged = mergedTimes(walked.times);
|
|
89
90
|
// What holds around the player character where the journey ended, not where the last hour passed (ENV-5).
|
|
90
|
-
const
|
|
91
|
+
const extensionLines = merged === undefined ? [] : await timePassedLines(root, context, now, addDuration(now, merged.passed));
|
|
92
|
+
const time = merged === undefined ? undefined : { ...merged, around: merged.passed >= 60 ? aroundLead(world) : undefined, extensionLines };
|
|
91
93
|
// A passage's conditions are its page's text, the master's to judge (ROA-8).
|
|
92
94
|
const passages = (plan.passages ?? []).map((name) => `The way goes through ${name}, a passage to another map: read its page for when and how it opens.`);
|
|
93
95
|
return { ...told, reached: walked.reached, date: formatGameDate(date), travelled, hoursLeft: Math.max(0, plan.hours * 60 - travelled), ending, around, time, notes: [...passages, ...walked.notes] };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { requireCampaign } from "../campaign/index.js";
|
|
3
3
|
import { defineCommand } from "../core/registry.js";
|
|
4
|
+
import { extensionCodeProblems } from "./game-extensions.js";
|
|
4
5
|
import { campaignWorld } from "./game-world.js";
|
|
5
6
|
import { campaignProblems } from "./problems.js";
|
|
6
7
|
export const validate = defineCommand({
|
|
@@ -11,9 +12,10 @@ export const validate = defineCommand({
|
|
|
11
12
|
group: "game",
|
|
12
13
|
readOnly: true,
|
|
13
14
|
input: z.object({}),
|
|
14
|
-
run(input, context) {
|
|
15
|
+
async run(input, context) {
|
|
15
16
|
const root = requireCampaign(context.folder);
|
|
16
|
-
|
|
17
|
+
// And what keeps an extension's code from being used, which only loading it tells (D-441).
|
|
18
|
+
return { problems: [...campaignProblems(root, campaignWorld(root, context), context), ...await extensionCodeProblems(root, context, [])] };
|
|
17
19
|
},
|
|
18
20
|
format(result) {
|
|
19
21
|
if (result.problems.length === 0) {
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import type { Mood } from "../core/mood.ts";
|
|
3
3
|
import { type NotationPart, type ThrownDie } from "../dice/index.ts";
|
|
4
4
|
import { type SystemWords } from "../systems/index.ts";
|
|
5
|
+
import { type CalendarDay } from "../time/index.ts";
|
|
5
6
|
import { type PlayerSetting } from "./config.ts";
|
|
6
7
|
import { type SeenEffect } from "./game-effects.ts";
|
|
7
8
|
import { type Mode } from "./game-mode.ts";
|
|
@@ -81,6 +82,8 @@ export type ViewResult = {
|
|
|
81
82
|
attribution?: string;
|
|
82
83
|
};
|
|
83
84
|
now?: string;
|
|
85
|
+
/** The day of the calendar it is now, when the campaign has one (TIM-8). */
|
|
86
|
+
calendar?: CalendarDay;
|
|
84
87
|
/** The master's mood, which the robot shows, and their last moment, which the dashboard shows for a few seconds when it is new (MOOD-4, MOOD-6). */
|
|
85
88
|
master: {
|
|
86
89
|
mood: Mood;
|
|
@@ -184,6 +187,8 @@ export declare const view: import("../core/registry.ts").Command<z.ZodObject<{
|
|
|
184
187
|
attribution?: string;
|
|
185
188
|
};
|
|
186
189
|
now?: string;
|
|
190
|
+
/** The day of the calendar it is now, when the campaign has one (TIM-8). */
|
|
191
|
+
calendar?: CalendarDay;
|
|
187
192
|
/** The master's mood, which the robot shows, and their last moment, which the dashboard shows for a few seconds when it is new (MOOD-4, MOOD-6). */
|
|
188
193
|
master: {
|
|
189
194
|
mood: Mood;
|
package/dist/commands/view.js
CHANGED
|
@@ -23,7 +23,7 @@ import { lastMoment, livingMood, masterMood } from "./game-moods.js";
|
|
|
23
23
|
import { measuresOf } from "./game-roads.js";
|
|
24
24
|
import { campaignSaves, isPlayerDead, loadRefusal, loadRule, resetPoints, resetSave, saveMode, savesWhy, wentBackTo } from "./game-saves.js";
|
|
25
25
|
import { readOpenScene } from "./game-scene.js";
|
|
26
|
-
import { readPresent } from "./game-time.js";
|
|
26
|
+
import { calendarDayOf, readPresent } from "./game-time.js";
|
|
27
27
|
import { questText, shownJournal } from "./game-view-journal.js";
|
|
28
28
|
import { mapText, shownMap } from "./game-view-map.js";
|
|
29
29
|
import { dyingOf, sceneNames, seenEffect, shownPlace, shownScene, strangerImage } from "./game-view-place.js";
|
|
@@ -204,6 +204,7 @@ export const view = defineCommand({
|
|
|
204
204
|
const place = shownPlace(sight);
|
|
205
205
|
const openScene = shownScene(sight);
|
|
206
206
|
const settings = readSettings(root);
|
|
207
|
+
const today = now === undefined ? undefined : calendarDayOf(root, context, now.day);
|
|
207
208
|
const words = system === undefined || settings.language === undefined ? undefined : wordsOf(system, settings.language, context);
|
|
208
209
|
return {
|
|
209
210
|
kind: "overview",
|
|
@@ -212,6 +213,7 @@ export const view = defineCommand({
|
|
|
212
213
|
...(words === undefined ? {} : { words }),
|
|
213
214
|
...(system === undefined ? {} : { system: { name: system.name, title: system.title, ...(system.attribution === undefined ? {} : { attribution: system.attribution }) } }),
|
|
214
215
|
...(now === undefined ? {} : { now: formatGameDate(now) }),
|
|
216
|
+
...(today === undefined ? {} : { calendar: today }),
|
|
215
217
|
master: { mood: masterMood(root), ...(moment === undefined ? {} : { moment }) },
|
|
216
218
|
party: [pc, ...companions].map(member),
|
|
217
219
|
...(place === undefined ? {} : { place }),
|
package/dist/core/context.d.ts
CHANGED
|
@@ -22,6 +22,14 @@ export interface Context {
|
|
|
22
22
|
signal?: AbortSignal;
|
|
23
23
|
/** The folders that hold the installed game systems, nearest first (SYS-1). */
|
|
24
24
|
systemFolders: string[];
|
|
25
|
+
/** The folders that hold the installed extensions, each a package folder or npm's node_modules (D-436); none where missing. */
|
|
26
|
+
extensionFolders?: string[];
|
|
27
|
+
/** The AI app the MCP server serves, by the name it gives itself, such as claude-code; missing on the command line. */
|
|
28
|
+
host?: () => string | undefined;
|
|
29
|
+
/** The command was typed by the player in their own terminal: their own hands, as the yes to a package not ours needs (D-441). */
|
|
30
|
+
terminal?: boolean;
|
|
31
|
+
/** npm on this computer, which installs the packages in the engine's own folder (D-436); missing where nothing installs, as in most tests. */
|
|
32
|
+
packages?: PackageManager;
|
|
25
33
|
/** The files as the MCP server keeps them for a whole session (D-137, D-193); without it, each call reads them afresh. */
|
|
26
34
|
files?: FileStore;
|
|
27
35
|
/** The parts of the instructions already given in this chat, which the MCP server keeps until instructions starts over (D-97); without it, every call gives them. */
|
|
@@ -49,6 +57,34 @@ export interface Context {
|
|
|
49
57
|
/** Codex and Claude Code on this computer, installed and signed in with the player's yes (D-424); missing outside the MCP server, as in tests. */
|
|
50
58
|
helpers?: Helpers;
|
|
51
59
|
}
|
|
60
|
+
/** A package for rpg-engine as npm or its folder describes it (D-439): its name, version and kind, and what it is. */
|
|
61
|
+
export interface PackageInfo {
|
|
62
|
+
name: string;
|
|
63
|
+
version: string;
|
|
64
|
+
/** What its package.json says it is for rpg-engine: extension, system…; undefined for a package that is not one. */
|
|
65
|
+
kind?: string;
|
|
66
|
+
/** The version of the extensions' API it is made for (D-441). */
|
|
67
|
+
api?: number;
|
|
68
|
+
description?: string;
|
|
69
|
+
/** Who wrote it, as npm gives it. */
|
|
70
|
+
author?: string;
|
|
71
|
+
}
|
|
72
|
+
/** npm for the packages (D-436): what one is before it is installed, installing it in the engine's folder without running its scripts, and the search. */
|
|
73
|
+
export interface PackageManager {
|
|
74
|
+
/** A package by its npm name, with a version or not, or by its folder; why not when there is none. */
|
|
75
|
+
describe(spec: string): Promise<PackageInfo | {
|
|
76
|
+
failed: string;
|
|
77
|
+
missing?: true;
|
|
78
|
+
}>;
|
|
79
|
+
/** Installs it: undefined once it is installed, else why not. */
|
|
80
|
+
install(spec: string): Promise<string | undefined>;
|
|
81
|
+
/** Takes an installed package off this computer, by its name: undefined once it is gone, else why not. */
|
|
82
|
+
uninstall(name: string): Promise<string | undefined>;
|
|
83
|
+
/** The packages for rpg-engine npm has, by their keyword and what their package.json says. */
|
|
84
|
+
search(): Promise<PackageInfo[] | {
|
|
85
|
+
failed: string;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
52
88
|
/** A program of this computer that writes and draws outside the chat, with the player's own login (D-424). */
|
|
53
89
|
export type HelperName = "codex" | "claude";
|
|
54
90
|
/** How a helper program stands: not on this computer, there without the player's login, signed in with an API key, which the engine never uses, or ready. */
|
|
@@ -138,3 +174,5 @@ export interface Player {
|
|
|
138
174
|
asking?(): boolean;
|
|
139
175
|
}
|
|
140
176
|
export declare function defaultContext(folder?: string): Context;
|
|
177
|
+
/** Where the engine installs the packages, with npm, on this computer (D-436): the player's local data, beside the programs it installs (D-425). */
|
|
178
|
+
export declare function packagesFolder(): string;
|
package/dist/core/context.js
CHANGED
|
@@ -13,11 +13,22 @@ export function defaultContext(folder = process.cwd()) {
|
|
|
13
13
|
platform: process.platform,
|
|
14
14
|
// From src/core/ and from dist/core/ alike, the package's systems/ folder is two levels up.
|
|
15
15
|
systemFolders: [fileURLToPath(new URL("../../systems/", import.meta.url))],
|
|
16
|
+
extensionFolders: [join(packagesFolder(), "node_modules")],
|
|
16
17
|
home: userDataFolder(),
|
|
17
18
|
// The built page is in dist/dashboard, two levels up from src/core/ and from dist/core/ alike.
|
|
18
19
|
pageFolder: fileURLToPath(new URL("../../dist/dashboard/", import.meta.url)),
|
|
19
20
|
};
|
|
20
21
|
}
|
|
22
|
+
/** Where the engine installs the packages, with npm, on this computer (D-436): the player's local data, beside the programs it installs (D-425). */
|
|
23
|
+
export function packagesFolder() {
|
|
24
|
+
const home = homedir();
|
|
25
|
+
if (process.platform === "win32") {
|
|
26
|
+
return join(process.env.LOCALAPPDATA || join(home, "AppData", "Local"), "rpg-engine", "packages");
|
|
27
|
+
}
|
|
28
|
+
return process.platform === "darwin"
|
|
29
|
+
? join(home, "Library", "Application Support", "rpg-engine", "packages")
|
|
30
|
+
: join(process.env.XDG_DATA_HOME || join(home, ".local", "share"), "rpg-engine", "packages");
|
|
31
|
+
}
|
|
21
32
|
/** Where this player's data is kept on this computer (D-406): the folder the system gives a program's data. */
|
|
22
33
|
function userDataFolder() {
|
|
23
34
|
const home = homedir();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A part of the master's instructions as a layer gives it: its text, and whether it takes the place of the layers below instead of adding to them (D-121). */
|
|
2
|
+
export interface InstructionPart {
|
|
3
|
+
text: string;
|
|
4
|
+
replace: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The parts of the master's instructions a package gives, a game system or an extension, from the files of its instructions folder: a part is named after its
|
|
8
|
+
* file (D-121). `owner` names the package in the error of a part that does not read, such as "The game system 5e".
|
|
9
|
+
*/
|
|
10
|
+
export declare function readParts(folder: string, owner: string): Record<string, InstructionPart>;
|