@plurnk/plurnk-execs-common 0.1.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/.env.example ADDED
@@ -0,0 +1,16 @@
1
+ # @plurnk/plurnk-execs-common — environment
2
+
3
+ # Operator kill-switch per runtime tag. Set to 0 (or false) to disable a tag
4
+ # even when its interpreter is installed on the host. Absent = enabled (the tag
5
+ # is offered when its binary is on PATH). Disabling drops it from the model's
6
+ # available-runtimes list with a "disabled" reason on the 501.
7
+ #
8
+ # PLURNK_EXECS_PERL=0
9
+ # PLURNK_EXECS_RUBY=0
10
+ # PLURNK_EXECS_PHP=0
11
+ # PLURNK_EXECS_LUA=0
12
+ # PLURNK_EXECS_DENO=0
13
+ # PLURNK_EXECS_BUN=0
14
+ # PLURNK_EXECS_TCL=0
15
+ # PLURNK_EXECS_BC=0
16
+ # PLURNK_EXECS_AWK=0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PossumTech Laboratories
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.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @plurnk/plurnk-execs-common
2
+
3
+ A **detection harness** for [plurnk-service](https://github.com/plurnk/plurnk-service)'s `exec` scheme: one package that exposes whichever common interpreters/REPLs exist on the host. Install it once and the model gets `perl`/`ruby`/`php`/`lua`/`awk`/`bc`/â€Ķ — but only the ones actually present.
4
+
5
+ A `@plurnk/plurnk-execs-*` sibling built on the [plurnk-execs](https://github.com/plurnk/plurnk-execs) framework.
6
+
7
+ ## How it works
8
+
9
+ The manifest claims a candidate set of common-REPL tags. The framework's `probe()` (per-tag, cheap `command -v`) lights up only the interpreters on PATH, so the consumer offers the model exactly the platform's runtimes. No per-language packages to install — one harness adapts to the host.
10
+
11
+ | Tag | Binary | Command via |
12
+ |---|---|---|
13
+ | `perl` 🐊 / `ruby` 💎 / `lua` 🌙 | perl / ruby / lua | `-e <command>` |
14
+ | `php` 🐘 | php | `-r <command>` |
15
+ | `deno` ðŸĶ• | deno | `eval <command>` |
16
+ | `bun` ðŸĨŸ | bun | `-e <command>` |
17
+ | `tcl` ðŸŠķ | tclsh | stdin |
18
+ | `bc` ðŸ§Ū | bc | stdin (e.g. `6 * 7`) |
19
+ | `awk` 🊄 | awk | program arg, empty stdin (`BEGIN { â€Ķ }`) |
20
+
21
+ All run arbitrary code → `effect: host` → **proposal-gated** (not auto-run). For the snappy auto-run tier, see the pure in-process evaluators (`calc`/`jq`/`wasm`, planned). Input-processing transforms (`sed`, input-driven `awk`) await the EXEC input-channel and aren't claimed here.
22
+
23
+ ## Configuration
24
+
25
+ `.env.example` documents per-tag kill-switches: `PLURNK_EXECS_<TAG>=0` disables a tag even when installed (drops it from the available list with a "disabled" 501 reason).
26
+
27
+ ## Tests
28
+
29
+ `test:lint`, `test:unit`. Live-eval tests auto-skip where the interpreter is absent.
@@ -0,0 +1,8 @@
1
+ import { SubprocessExecutor } from "@plurnk/plurnk-execs";
2
+ import type { RuntimeAvailability, SpawnArgs } from "@plurnk/plurnk-execs";
3
+ export declare const RUNTIME_TAGS: readonly string[];
4
+ export default class Common extends SubprocessExecutor {
5
+ protected spawnArgs(runtime: string, command: string): SpawnArgs;
6
+ probe(): Promise<RuntimeAvailability>;
7
+ }
8
+ //# sourceMappingURL=Common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Common.d.ts","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA2B3E,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAwC,CAAC;AAqBnF,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,kBAAkB;cAC/B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;IAU1D,KAAK,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAUvD"}
package/dist/Common.js ADDED
@@ -0,0 +1,57 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { SubprocessExecutor } from "@plurnk/plurnk-execs";
3
+ const RECIPES = Object.freeze({
4
+ perl: { bin: "perl", arg: (c) => ["-e", c] },
5
+ ruby: { bin: "ruby", arg: (c) => ["-e", c] },
6
+ php: { bin: "php", arg: (c) => ["-r", c] },
7
+ lua: { bin: "lua", arg: (c) => ["-e", c] },
8
+ deno: { bin: "deno", arg: (c) => ["eval", c] },
9
+ bun: { bin: "bun", arg: (c) => ["-e", c] },
10
+ tcl: { bin: "tclsh", stdin: true },
11
+ bc: { bin: "bc", stdin: true },
12
+ awk: { bin: "awk", bare: true },
13
+ });
14
+ // Exposed for tests / consumers wanting the candidate set.
15
+ export const RUNTIME_TAGS = Object.freeze(Object.keys(RECIPES));
16
+ // Operator kill-switch: PLURNK_EXECS_<TAG>=0 (or "false") disables a tag even
17
+ // when its interpreter is installed. (Honored here locally; the cross-family
18
+ // equivalent is service registry policy.)
19
+ const isDisabled = (tag) => {
20
+ const v = process.env[`PLURNK_EXECS_${tag.toUpperCase()}`];
21
+ return v === "0" || v?.toLowerCase() === "false";
22
+ };
23
+ // PATH presence via POSIX `command -v` — robust across interpreters that don't
24
+ // support `--version` (tclsh, bc, some awks). bin is from the fixed table above.
25
+ const onPath = (bin) => spawnSync("sh", ["-c", `command -v "$1"`, "sh", bin]).status === 0;
26
+ // Detection harness: one package claiming the common-REPL tags. probe() lights
27
+ // up only the interpreters present on this host (and not operator-disabled), so
28
+ // the consumer offers the model exactly what the platform has — "plurnk supports
29
+ // the host's REPLs out of the box". All run arbitrary code → effect `host`
30
+ // (inherited, proposal-gated). Reuses SubprocessExecutor's run() (streaming +
31
+ // process-group abort) via the spawnArgs() hook.
32
+ export default class Common extends SubprocessExecutor {
33
+ spawnArgs(runtime, command) {
34
+ const r = RECIPES[runtime];
35
+ if (r === undefined)
36
+ throw new Error(`plurnk-execs-common received unclaimed runtime tag '${runtime}'`);
37
+ // Trailing newline so line-oriented readers (bc, tclsh) evaluate the
38
+ // final line before EOF rather than erroring on an unterminated line.
39
+ if (r.stdin)
40
+ return { cmd: r.bin, args: [], useShell: false, stdin: `${command}\n` };
41
+ if (r.bare)
42
+ return { cmd: r.bin, args: [command], useShell: false, stdin: "" };
43
+ return { cmd: r.bin, args: r.arg(command), useShell: false };
44
+ }
45
+ async probe() {
46
+ const r = RECIPES[this.runtime];
47
+ if (r === undefined)
48
+ return { available: false, detail: `unknown runtime '${this.runtime}'` };
49
+ if (isDisabled(this.runtime)) {
50
+ return { available: false, detail: `disabled (PLURNK_EXECS_${this.runtime.toUpperCase()}=0)` };
51
+ }
52
+ return onPath(r.bin)
53
+ ? { available: true, detail: r.bin }
54
+ : { available: false, detail: `${r.bin} not on PATH` };
55
+ }
56
+ }
57
+ //# sourceMappingURL=Common.js.map
@@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,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC/E,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,GAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAClE,CAAC;IAEQ,KAAK,CAAC,KAAK;QAChB,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,SAAS;YAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAC9F,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,0BAA0B,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;QACnG,CAAC;QACD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;YAChB,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE;YACpC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,cAAc,EAAE,CAAC;IAC/D,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export { default as Common, RUNTIME_TAGS } from "./Common.ts";
2
+ export { default } from "./Common.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default as Common, RUNTIME_TAGS } from "./Common.js";
2
+ export { default } from "./Common.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@plurnk/plurnk-execs-common",
3
+ "version": "0.1.0",
4
+ "description": "Common-REPL detection harness for plurnk-service's exec scheme — one package that exposes whichever common interpreters (perl, ruby, php, lua, awk, bc, â€Ķ) exist on the host.",
5
+ "keywords": ["plurnk", "exec", "runtime", "executor", "repl", "perl", "ruby", "lua", "awk"],
6
+ "homepage": "https://github.com/plurnk/plurnk-execs-common#readme",
7
+ "bugs": {
8
+ "url": "https://github.com/plurnk/plurnk-execs-common/issues"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/plurnk/plurnk-execs-common.git"
13
+ },
14
+ "engines": {
15
+ "node": ">=25"
16
+ },
17
+ "license": "MIT",
18
+ "author": "@wikitopian",
19
+ "type": "module",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "plurnk": {
24
+ "kind": "exec",
25
+ "runtimes": [
26
+ { "name": "perl", "glyph": "🐊" },
27
+ { "name": "ruby", "glyph": "💎" },
28
+ { "name": "php", "glyph": "🐘" },
29
+ { "name": "lua", "glyph": "🌙" },
30
+ { "name": "deno", "glyph": "ðŸĶ•" },
31
+ { "name": "bun", "glyph": "ðŸĨŸ" },
32
+ { "name": "tcl", "glyph": "ðŸŠķ" },
33
+ { "name": "bc", "glyph": "ðŸ§Ū" },
34
+ { "name": "awk", "glyph": "🊄" }
35
+ ]
36
+ },
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.ts",
40
+ "default": "./dist/index.js"
41
+ },
42
+ "./package.json": "./package.json"
43
+ },
44
+ "files": [
45
+ "dist/**/*",
46
+ "README.md",
47
+ ".env.example"
48
+ ],
49
+ "scripts": {
50
+ "test:lint": "tsc --noEmit",
51
+ "test:unit": "node --test \"src/**/*.test.ts\"",
52
+ "test": "npm run test:lint && npm run test:unit",
53
+ "build:dist": "tsc -p tsconfig.build.json",
54
+ "build": "npm run build:dist",
55
+ "prepare": "npm run build"
56
+ },
57
+ "dependencies": {
58
+ "@plurnk/plurnk-execs": "0.4.1"
59
+ },
60
+ "devDependencies": {
61
+ "@types/node": "^25.8.0",
62
+ "typescript": "^6.0.3"
63
+ }
64
+ }