@deathbeam/pi-rtk 0.0.1 → 0.0.3
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 +0 -20
- package/index.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Rewrite bash commands to [RTK](https://github.com/rtk-ai/rtk) (`rtk ...`) so tool output costs fewer tokens.
|
|
4
4
|
|
|
5
|
-
This is the RTK Pi hook packaged for the `packages` setting, so it replaces `rtk init -g --agent pi`, which
|
|
6
|
-
drops a loose file into `~/.pi/agent/extensions`. The decision logic stays in `rtk rewrite`; this package only
|
|
7
|
-
delegates to it. Adapted from [rtk-ai/rtk `hooks/pi/rtk.ts`](https://github.com/rtk-ai/rtk/blob/develop/hooks/pi/rtk.ts)
|
|
8
|
-
(Apache-2.0).
|
|
9
|
-
|
|
10
5
|
## Installation
|
|
11
6
|
|
|
12
7
|
`rtk` must be in `PATH`.
|
|
@@ -17,21 +12,6 @@ pi install npm:@deathbeam/pi-rtk # this package
|
|
|
17
12
|
pi install git:github.com/deathbeam/pi-packages # all my packages
|
|
18
13
|
```
|
|
19
14
|
|
|
20
|
-
Or add it to `packages` in `~/.pi/agent/settings.json` or `.pi/settings.json`:
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"packages": ["npm:@deathbeam/pi-rtk"]
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
|
|
30
|
-
Every bash command is passed to `rtk rewrite` before it runs. A rewrite replaces the command; no rewrite or a
|
|
31
|
-
missing `rtk` leaves it untouched.
|
|
32
|
-
|
|
33
|
-
`/rtk` shows the `rtk gain` report.
|
|
34
|
-
|
|
35
15
|
## Development
|
|
36
16
|
|
|
37
17
|
From this package directory:
|
package/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ export function rewrittenCommand(result: ExecResult): string | null {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default async function (pi: ExtensionAPI) {
|
|
11
|
-
if ((await pi.exec("rtk", ["--
|
|
11
|
+
if ((await pi.exec("rtk", ["gain", "--help"]).catch(() => null))?.code !== 0) return;
|
|
12
12
|
|
|
13
13
|
pi.on("tool_call", async (event, ctx) => {
|
|
14
14
|
if (!isBash(event)) return;
|