@plurnk/plurnk-execs-git 0.1.6 → 0.1.9
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 +11 -0
- package/dist/Git.d.ts +2 -2
- package/dist/Git.d.ts.map +1 -1
- package/dist/Git.js +18 -7
- package/dist/Git.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ A `@plurnk/plurnk-execs-*` sibling built on the [plurnk-execs](https://github.co
|
|
|
18
18
|
|
|
19
19
|
The command is tokenized into **real argv** (`tokenizeArgv`) and the tag's binary is run directly — **never** through a shell. That's deliberate: shelling `git commit -m "costs $5"` would expand `$5` and corrupt the message; passing argv preserves `$`, backticks, and other specials literally. Shell metacharacters (`|`, `;`, `>`) are passed as literal args, not interpreted.
|
|
20
20
|
|
|
21
|
+
### Feeding stdin — the `(target)` slot
|
|
22
|
+
|
|
23
|
+
For commands that read **stdin** (`git apply`, `commit -F -`, `hash-object --stdin`, `mktree`), put the invocation in the **`(target)` slot** and the stdin content in the body (plurnk-execs#15):
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<<EXEC[git](apply --index):<patch text>:EXEC
|
|
27
|
+
<<EXEC[git](hash-object -w --stdin):<blob bytes>:EXEC
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The target is tokenized the same way; the body is written to the child's stdin. With no target, the body is the invocation (as above).
|
|
31
|
+
|
|
21
32
|
## Effect & gating
|
|
22
33
|
|
|
23
34
|
`effect` is **`host` for every command** (proposal-gated). This is required, not a shortcut: `effect(target)` classifies the target only and must never inspect the command, so `git status` and `git push` are indistinguishable to it. **The service owns all gating** — membership, proposal/confirm, the enable ceiling, and outward-confirm for `push` / `gh pr create`. The executor only runs the command and declares the effect.
|
package/dist/Git.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SubprocessExecutor } from "@plurnk/plurnk-execs";
|
|
2
2
|
import type { RuntimeAvailability, SpawnArgs } from "@plurnk/plurnk-execs";
|
|
3
3
|
export default class Git extends SubprocessExecutor {
|
|
4
|
-
protected spawnArgs(runtime: string, command: string): SpawnArgs;
|
|
5
|
-
probe(): Promise<RuntimeAvailability>;
|
|
4
|
+
protected spawnArgs(runtime: string, command: string, target?: string | null): SpawnArgs;
|
|
5
|
+
probe(signal?: AbortSignal): Promise<RuntimeAvailability>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=Git.d.ts.map
|
package/dist/Git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Git.d.ts","sourceRoot":"","sources":["../src/Git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAc3E,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,kBAAkB;cAC5B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"Git.d.ts","sourceRoot":"","sources":["../src/Git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAc3E,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,kBAAkB;cAC5B,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,SAAS;IAYxF,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAO3E"}
|
package/dist/Git.js
CHANGED
|
@@ -13,26 +13,37 @@ import { tokenizeArgv } from "./tokenizeArgv.js";
|
|
|
13
13
|
// (plurnk-execs#5). All run/stream/abort behavior is inherited from
|
|
14
14
|
// SubprocessExecutor.
|
|
15
15
|
export default class Git extends SubprocessExecutor {
|
|
16
|
-
spawnArgs(runtime, command) {
|
|
17
|
-
// runtime is "git" or "gh" — the tag is the executable.
|
|
16
|
+
spawnArgs(runtime, command, target = null) {
|
|
17
|
+
// runtime is "git" or "gh" — the tag is the executable. With a target the
|
|
18
|
+
// target IS the invocation (tokenized argv) and the body is its stdin
|
|
19
|
+
// (plurnk-execs#15) — `EXEC[git](apply --index):<patch>`, `commit -F -`,
|
|
20
|
+
// `hash-object -w --stdin`. No target → the body is the invocation.
|
|
21
|
+
if (target !== null)
|
|
22
|
+
return { cmd: runtime, args: tokenizeArgv(target), useShell: false, stdin: command };
|
|
18
23
|
return { cmd: runtime, args: tokenizeArgv(command), useShell: false };
|
|
19
24
|
}
|
|
20
25
|
// Per-tag availability: `git` needs the binary; `gh` needs the binary AND an
|
|
21
26
|
// authenticated session. (Correct only once the consumer probes per-tag, not
|
|
22
27
|
// per-package — plurnk-service#185.)
|
|
23
|
-
async probe() {
|
|
28
|
+
async probe(signal) {
|
|
24
29
|
if (this.runtime === "gh") {
|
|
25
|
-
return runProbe("gh", ["auth", "status"], "gh authenticated", "gh present but not authenticated — run `gh auth login`", "gh not on PATH");
|
|
30
|
+
return runProbe("gh", ["auth", "status"], "gh authenticated", "gh present but not authenticated — run `gh auth login`", "gh not on PATH", signal);
|
|
26
31
|
}
|
|
27
|
-
return runProbe("git", ["--version"], undefined, "git --version failed", "git not on PATH");
|
|
32
|
+
return runProbe("git", ["--version"], undefined, "git --version failed", "git not on PATH", signal);
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
// Spawn a probe command; resolve availability from its exit. Async so the
|
|
31
36
|
// consumer's per-probe timeout can race it (a hung `gh auth status` mustn't
|
|
32
37
|
// wedge boot).
|
|
33
|
-
const runProbe = (bin, args, okDetail, nonzeroDetail, missingDetail) => new Promise((resolve) => {
|
|
38
|
+
const runProbe = (bin, args, okDetail, nonzeroDetail, missingDetail, signal) => new Promise((resolve) => {
|
|
39
|
+
if (signal?.aborted) {
|
|
40
|
+
resolve({ available: false, detail: missingDetail });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
34
43
|
let out = "";
|
|
35
|
-
|
|
44
|
+
// Honor the consumer's per-probe signal so a resolved/timed-out probe
|
|
45
|
+
// reaps the child (plurnk-execs#16); /dev/null stdin+stderr.
|
|
46
|
+
const child = spawn(bin, args, { signal, stdio: ["ignore", "pipe", "ignore"] });
|
|
36
47
|
child.stdout?.on("data", (chunk) => { out += chunk.toString("utf8"); });
|
|
37
48
|
child.on("error", () => resolve({ available: false, detail: missingDetail }));
|
|
38
49
|
child.on("close", (code) => resolve(code === 0
|
package/dist/Git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Git.js","sourceRoot":"","sources":["../src/Git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,wDAAwD;AACxD,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,oEAAoE;AACpE,sBAAsB;AACtB,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,kBAAkB;IAC5B,SAAS,CAAC,OAAe,EAAE,OAAe;
|
|
1
|
+
{"version":3,"file":"Git.js","sourceRoot":"","sources":["../src/Git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,4EAA4E;AAC5E,6EAA6E;AA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runtime executor for plurnk-service's exec scheme — shells the system git/gh binaries (no third-party lib) for EXEC[git] / EXEC[gh].",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plurnk",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^26.0.0",
|
|
67
67
|
"typescript": "^6.0.3",
|
|
68
|
-
"@plurnk/plurnk-execs": "
|
|
68
|
+
"@plurnk/plurnk-execs": "0.4.28"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
|
-
"@plurnk/plurnk-execs": "
|
|
71
|
+
"@plurnk/plurnk-execs": "0.4.28"
|
|
72
72
|
}
|
|
73
73
|
}
|