@rin-chat/rinext 0.0.0-stage → 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rin Chat LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ dist/ also carries third-party packages under their own licenses; see
24
+ dist/THIRD-PARTY-LICENSES.txt.
package/README.md CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @rin-chat/rinext
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The command-line kit for [Rin Chat](https://rin.chat) extensions: start from a template, test an extension in
4
+ Rin Chat's own sandbox, sign and pack it into a `.rinext`, and check a package the way the app's install dialog
5
+ will.
6
+
7
+ **Guide:** https://rin.chat/developers/extensions/ (getting started, the API, hooks, limits, five tested examples).
8
+
9
+ ```
10
+ npm install -g @rin-chat/rinext # then: rinext <command>
11
+ npx @rin-chat/rinext <command> # or without installing
12
+ ```
13
+
14
+ Node.js 22.2 or later. No other dependencies.
15
+
16
+ ```
17
+ rinext init <dir> copy the template (an extension and its tests) into a new folder
18
+ rinext keygen <out-dir> make an author key
19
+ rinext pack <folder> --key <private-key> [--out f] check, sign and zip a folder into a .rinext
20
+ rinext check <file.rinext> what Rin Chat would show for it, or why it refuses it
21
+ rinext test <folder> [test-file] run it in Rin Chat's sandbox against a fake chat
22
+ ```
23
+
24
+ Exit codes: 0 done, 1 refused or a test failed, 2 usage.
25
+
26
+ `rinext test` runs your script in the same QuickJS sandbox as the app, behind the same checks on every `rin.*`
27
+ call, with its hooks called the way the app calls them, the app's limits (1000 ms per hook, 100 ms of CPU per
28
+ call, 32 MB of heap) and the same error codes. Types for the `rin` API are
29
+ in [`@rin-chat/extension-api`](https://www.npmjs.com/package/@rin-chat/extension-api).
30
+
31
+ MIT licensed. `dist/` bundles QuickJS (quickjs-emscripten) and other packages under their own licenses, listed
32
+ in `dist/THIRD-PARTY-LICENSES.txt`.
package/bin/rinext.mjs ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ // rinext: the Rin Chat extension author's CLI. Usage in ../README.md.
3
+ import { spawnSync } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import { join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { check, init, keygen, pack } from "../src/commands.mjs";
8
+
9
+ const USAGE = `Usage:
10
+ rinext init <dir> copy the template (an extension and its tests) into a new folder
11
+ rinext keygen <out-dir> make an author key (never inside an extension folder)
12
+ rinext pack <folder> --key <private-key> [--out f] check, sign and zip a folder into a .rinext
13
+ rinext check <file.rinext> what Rin Chat would show for a package, or why it refuses it
14
+ rinext test <folder> [test-file] run the extension in the app's sandbox against a fake chat`;
15
+
16
+ const [cmd, ...rest] = process.argv.slice(2);
17
+ const flag = (name) => {
18
+ const i = rest.indexOf(name);
19
+ if (i < 0) return undefined;
20
+ const v = rest[i + 1];
21
+ rest.splice(i, 2);
22
+ return v;
23
+ };
24
+
25
+ /** `rinext test`: in this repo, the app's own TypeScript through vite-node; in the published kit, the bundle. */
26
+ function test(args) {
27
+ const root = fileURLToPath(new URL("../../../", import.meta.url));
28
+ const env = { ...process.env, RINEXT_TEST_MAIN: "1" };
29
+ if (!existsSync(join(root, "src/ext/testPort.ts"))) {
30
+ const run = spawnSync(process.execPath, [fileURLToPath(new URL("../dist/test-runner.mjs", import.meta.url)), ...args], { stdio: "inherit", env });
31
+ process.exit(run.status ?? 1);
32
+ }
33
+ // src/ext is TypeScript with Lingui macros, so the runner goes through vite-node with the app's test config.
34
+ const viteNode = join(root, "node_modules", "vite-node", "vite-node.mjs");
35
+ const run = spawnSync(process.execPath, [viteNode, "--root", root, "--config", join(root, "vitest.config.ts"), join(root, "packages/rinext/src/test-runner.ts"), ...args], { cwd: root, stdio: ["inherit", "inherit", "pipe"], env });
36
+ // Babel's note about the 500 KB English catalog is noise to an extension author.
37
+ process.stderr.write(String(run.stderr ?? "").replace(/^\[BABEL\] Note: The code generator has deoptimised.*\r?\n/m, ""));
38
+ process.exit(run.status ?? 1);
39
+ }
40
+
41
+ let r;
42
+ if (cmd === "init" && rest.length === 1) r = init(rest[0]);
43
+ else if (cmd === "keygen" && rest.length === 1) r = keygen(rest[0]);
44
+ else if (cmd === "pack") {
45
+ const key = flag("--key");
46
+ const out = flag("--out");
47
+ r = rest.length === 1 ? pack(rest[0], key, out) : null;
48
+ } else if (cmd === "check" && rest.length === 1) r = check(rest[0]);
49
+ else if (cmd === "test" && (rest.length === 1 || rest.length === 2)) test(rest.map((p) => resolve(p)));
50
+
51
+ if (!r) {
52
+ console.error(USAGE);
53
+ process.exit(2);
54
+ }
55
+ (r.ok ? console.log : console.error)(r.out.join("\n"));
56
+ process.exit(r.ok ? 0 : 1);
@@ -0,0 +1,103 @@
1
+ Packages bundled into test-runner.mjs and quickjs.wasm.
2
+
3
+ @jitl/quickjs-ffi-types@0.32.0 (MIT)
4
+
5
+ The MIT License
6
+
7
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ ------------------------------------------------------------------------------
28
+
29
+ @jitl/quickjs-wasmfile-release-sync@0.32.0 (MIT)
30
+
31
+ quickjs-emscripten:
32
+ The MIT License
33
+
34
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ of this software and associated documentation files (the "Software"), to deal
38
+ in the Software without restriction, including without limitation the rights
39
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ copies of the Software, and to permit persons to whom the Software is
41
+ furnished to do so, subject to the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be included in all
44
+ copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ SOFTWARE.
53
+
54
+
55
+ quickjs:
56
+ QuickJS Javascript Engine
57
+
58
+ Copyright (c) 2017-2021 Fabrice Bellard
59
+ Copyright (c) 2017-2021 Charlie Gordon
60
+
61
+ Permission is hereby granted, free of charge, to any person obtaining a copy
62
+ of this software and associated documentation files (the "Software"), to deal
63
+ in the Software without restriction, including without limitation the rights
64
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65
+ copies of the Software, and to permit persons to whom the Software is
66
+ furnished to do so, subject to the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be included in
69
+ all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
74
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
76
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
77
+ THE SOFTWARE.
78
+
79
+ ------------------------------------------------------------------------------
80
+
81
+ quickjs-emscripten-core@0.32.0 (MIT)
82
+
83
+ The MIT License
84
+
85
+ quickjs-emscripten copyright (c) 2019-2024 Jake Teton-Landis
86
+
87
+ Permission is hereby granted, free of charge, to any person obtaining a copy
88
+ of this software and associated documentation files (the "Software"), to deal
89
+ in the Software without restriction, including without limitation the rights
90
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
91
+ copies of the Software, and to permit persons to whom the Software is
92
+ furnished to do so, subject to the following conditions:
93
+
94
+ The above copyright notice and this permission notice shall be included in all
95
+ copies or substantial portions of the Software.
96
+
97
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
98
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
99
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
100
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
101
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
102
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
103
+ SOFTWARE.
Binary file