@henryqw/pi-herdr 0.2.0 → 0.3.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/README.md +1 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,8 +13,7 @@ npm install @henryqw/pi-herdr
|
|
|
13
13
|
```ts
|
|
14
14
|
import { createHerdrClient } from "@henryqw/pi-herdr";
|
|
15
15
|
|
|
16
|
-
const herdr = createHerdrClient((
|
|
17
|
-
pi.exec(command, [...args], options));
|
|
16
|
+
const herdr = createHerdrClient(pi.exec.bind(pi));
|
|
18
17
|
const response = await herdr.json(["agent", "list"], { cwd: ctx.cwd });
|
|
19
18
|
```
|
|
20
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export interface HerdrExecResult {
|
|
|
4
4
|
stderr: string;
|
|
5
5
|
killed?: boolean;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
/** Mutable-array executor, compatible with a bound `pi.exec`. Args are copied by createHerdrClient. */
|
|
8
|
+
export type HerdrExecutor<Options> = (command: string, args: string[], options: Options) => Promise<HerdrExecResult>;
|
|
8
9
|
export interface HerdrClient<Options> {
|
|
9
10
|
exec(args: readonly string[], options: Options): Promise<HerdrExecResult>;
|
|
10
11
|
run(args: readonly string[], options: Options): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export function createHerdrClient(execute) {
|
|
|
4
4
|
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "string")) {
|
|
5
5
|
throw new TypeError("Herdr command arguments must be an array of strings");
|
|
6
6
|
}
|
|
7
|
-
return await execute("herdr", args, options);
|
|
7
|
+
return await execute("herdr", [...args], options);
|
|
8
8
|
};
|
|
9
9
|
const run = async (args, options) => {
|
|
10
10
|
const result = await exec(args, options);
|