@henryqw/pi-herdr 0.4.4 → 0.4.7
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 +15 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
# `@henryqw/pi-herdr`
|
|
2
2
|
|
|
3
|
-
Call the Herdr CLI from Node through one thin client
|
|
4
|
-
|
|
5
|
-
This package is an extension-author library. Pi users normally install a Herdr companion extension instead.
|
|
6
|
-
|
|
7
|
-
## Why
|
|
8
|
-
|
|
9
|
-
- **Created for**: Extension authors building Herdr-aware Pi features.
|
|
10
|
-
- **Advantage**: Share process handling without copying Herdr's command catalog into a second API.
|
|
3
|
+
Call the Herdr CLI from Node through one thin client. Extension authors share process handling without copying Herdr's command catalog. Pi users normally install a Herdr companion extension instead.
|
|
11
4
|
|
|
12
5
|
## Install
|
|
13
6
|
|
|
@@ -15,12 +8,12 @@ This package is an extension-author library. Pi users normally install a Herdr c
|
|
|
15
8
|
npm install @henryqw/pi-herdr
|
|
16
9
|
```
|
|
17
10
|
|
|
18
|
-
Install the Herdr CLI and make `herdr` available on the calling process's `PATH`.
|
|
19
|
-
|
|
20
|
-
For ready-to-use Pi workflows, see [`@henryqw/pi-herdr-clone`](https://pi.henry.wang/extensions/pi-herdr-clone).
|
|
11
|
+
Install the Herdr CLI and make `herdr` available on the calling process's `PATH`. Run `herdr --version` to verify it.
|
|
21
12
|
|
|
22
13
|
## Use
|
|
23
14
|
|
|
15
|
+
Create a client and run a command. The client returns the parsed response.
|
|
16
|
+
|
|
24
17
|
```ts
|
|
25
18
|
import { createHerdrClient } from "@henryqw/pi-herdr";
|
|
26
19
|
|
|
@@ -28,12 +21,16 @@ const herdr = createHerdrClient(pi.exec.bind(pi));
|
|
|
28
21
|
const response = await herdr.json(["agent", "list"], { cwd: ctx.cwd });
|
|
29
22
|
```
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
| `
|
|
24
|
+
For a ready-to-use Pi workflow, see [`@henryqw/pi-herdr-clone`](https://pi.henry.wang/extensions/pi-herdr-clone).
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| Surface | Type | Purpose |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `exec` | function | Validates string argv and returns the raw process result. |
|
|
31
|
+
| `run` | function | Requires a successful exit and returns stdout. |
|
|
32
|
+
| `json` | function | Requires a successful exit and parses a JSON object. |
|
|
33
|
+
| `hasHerdrErrorCode` | function | Detects structured CLI errors in stdout or stderr. |
|
|
34
|
+
| `startPiAgent` | function | Validates and builds the shared `agent start --kind pi --pane ... --` boundary. It retries structured `agent_pane_busy` responses allowed by the caller's result-aware policy, with a five-attempt limit, and returns the raw final result. |
|
|
38
35
|
|
|
39
36
|
Callers build Pi-specific arguments and validate responses. The client does not mirror the Herdr command catalog. Herdr remains the source of truth for supported commands and response shapes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henryqw/pi-herdr",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Shared client for interacting with Herdr from Node.js tools and Pi packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/HenryQW/pi-harness.git",
|
|
44
|
-
"directory": "
|
|
44
|
+
"directory": "packages/pi-herdr"
|
|
45
45
|
},
|
|
46
46
|
"bugs": {
|
|
47
47
|
"url": "https://github.com/HenryQW/pi-harness/issues"
|