@s2script/sdk 0.28.0 → 0.29.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 +31 -1
- package/commands.d.ts +1 -1
- package/dist/cli.js +3892 -787
- package/package.json +3 -1
- package/phrases.d.ts +1 -1
- package/plugins.d.ts +31 -2
- package/unsafe.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s2script/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"license": "MIT OR Apache-2.0",
|
|
5
5
|
"description": "s2script SDK — the builtin capability types (imported as @s2script/sdk/entity, …) plus the `s2s` CLI for building Source 2 / CS2 plugins.",
|
|
6
6
|
"type": "module",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@clack/prompts": "^1.7.0",
|
|
23
23
|
"fflate": "^0.8.2",
|
|
24
|
+
"ignore": "^5.3.2",
|
|
25
|
+
"minimatch": "^10.2.6",
|
|
24
26
|
"semver": "^7.8.5"
|
|
25
27
|
},
|
|
26
28
|
"publishConfig": {
|
package/phrases.d.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* unresolved key renders as the key itself, so it should still read as a sentence.
|
|
24
24
|
*
|
|
25
25
|
* ```json
|
|
26
|
-
* { "Gagged Player": "{green}[
|
|
26
|
+
* { "Gagged Player": "{green}[S2S]{default} Gagged {1} player." }
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
29
|
* A translator adds `translations/<code>/<your-plugin>.phrases.json` — no code change, no rebuild.
|
package/plugins.d.ts
CHANGED
|
@@ -16,12 +16,15 @@ export interface PluginInfo {
|
|
|
16
16
|
* - `"unloaded"` — on disk but manually unloaded via `unload` (not auto-reloaded until `load`/`reload`).
|
|
17
17
|
*/
|
|
18
18
|
readonly state: "running" | "loading" | "waiting" | "failed" | "unloaded";
|
|
19
|
+
/** The folder under `plugins/` (e.g. `"disabled"`, `"fun"`) this plugin was loaded from by
|
|
20
|
+
* {@link Plugins.load} for this run only — it stays there on disk, so a restart leaves it off.
|
|
21
|
+
* null for a plugin loaded from `plugins/` itself. */
|
|
22
|
+
readonly folder: string | null;
|
|
19
23
|
}
|
|
20
24
|
/**
|
|
21
25
|
* Enumerate and drive the plugin set at runtime (list / load / unload / reload).
|
|
22
26
|
* @example
|
|
23
27
|
* import { Plugins } from "@s2script/sdk/plugins";
|
|
24
|
-
* // plugins/basecommands/src/plugin.ts:126 — sm plugins list
|
|
25
28
|
* for (const p of Plugins.list()) cmd.reply(p.id + " — " + p.state);
|
|
26
29
|
*/
|
|
27
30
|
export declare const Plugins: {
|
|
@@ -32,6 +35,32 @@ export declare const Plugins: {
|
|
|
32
35
|
unload(id: string): boolean;
|
|
33
36
|
/** Reload a plugin (unload + load from disk, deferred). false if the id is unknown. */
|
|
34
37
|
reload(id: string): boolean;
|
|
35
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Load a plugin that isn't running (deferred): one unloaded earlier this run, by id — or, as
|
|
40
|
+
* `"<folder>/<plugin id>"` (e.g. `"fun/@edgegamers/jailbreak"`, `"disabled/@edge/rtv"`), one kept
|
|
41
|
+
* in any folder under `plugins/`, for THIS RUN ONLY. Only a folder prefix reaches into a folder;
|
|
42
|
+
* the id is mapped to its file for you; nothing outside `plugins/` is reachable. The file stays
|
|
43
|
+
* where it is (a restart leaves it off; for disabled/ plugins, `enable` makes it permanent).
|
|
44
|
+
* false if there is no such plugin. `unload` accepts the same `<folder>/<plugin id>` form.
|
|
45
|
+
*/
|
|
36
46
|
load(id: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Add registry plugins to the server's `addons/s2script/plugins.json` and install them with their
|
|
49
|
+
* dependencies (`sm plugins install`). A bare name records `^<latest>`; `name@range` records the
|
|
50
|
+
* range. `with` names optional members of the ONE bundle given. The files land in `plugins/`,
|
|
51
|
+
* where the loader picks them up — or, with `disabled`, in `plugins/disabled/`, where it never
|
|
52
|
+
* looks (kept current at startup, loaded once enabled). Resolves with report lines; rejects with
|
|
53
|
+
* the reason.
|
|
54
|
+
*/
|
|
55
|
+
install(names: string[], opts?: { with?: string[]; disabled?: boolean }): Promise<string[]>;
|
|
56
|
+
/** Move the named plugins (all when omitted) to the newest version their plugins.json range allows. */
|
|
57
|
+
update(names?: string[]): Promise<string[]>;
|
|
58
|
+
/** Drop plugins from plugins.json; their files are removed (unless edited by hand) and unloaded. */
|
|
59
|
+
remove(names: string[]): Promise<string[]>;
|
|
60
|
+
/** One line per plugins.json dependency: current, wanted (newest in range) and latest version. */
|
|
61
|
+
outdated(): Promise<string[]>;
|
|
62
|
+
/** Move installed plugins out of plugins/disabled/ (they load) and record it in plugins.json. */
|
|
63
|
+
enable(names: string[]): Promise<string[]>;
|
|
64
|
+
/** Move installed plugins into plugins/disabled/ (they unload, and stay off across restarts). */
|
|
65
|
+
disable(names: string[]): Promise<string[]>;
|
|
37
66
|
};
|
package/unsafe.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* UNSAFE by design. A declared call reaches a real engine function; a declared hook patches
|
|
6
6
|
* that function's prologue. The framework validates every descriptor at load and degrades a
|
|
7
7
|
* failure to `null`, but it cannot prove your signature or vtable index names the function you
|
|
8
|
-
* meant.
|
|
9
|
-
* `
|
|
10
|
-
* (see docs/superpowers/specs/2026-07-24-plugin-gamedata-design.md
|
|
8
|
+
* meant. `s2s build` records `engine:calls` / `engine:hooks` in the manifest from your gamedata so
|
|
9
|
+
* `s2s inspect` and the registry can show what the plugin reaches into; nothing to declare by hand
|
|
10
|
+
* (see docs/superpowers/specs/2026-07-24-plugin-gamedata-design.md and ARCHITECTURE.md §2.0.7).
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|