@xynogen/pix-commands 0.1.0 → 0.1.2
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 +31 -0
- package/package.json +1 -1
- package/src/extension.ts +5 -2
- package/src/once.ts +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# pix-commands
|
|
2
|
+
|
|
3
|
+
Pi extension — `/diff` and `/clear` slash commands.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
Registers two slash commands. `/diff` asks the agent to inspect `git status` and `git diff`, then respond with a one-sentence TL;DR, a per-file breakdown of what changed and why (with +/− line counts), and a brief impact note on behaviour or tests. If an agent turn is already in progress, the prompt is queued as a follow-up. `/clear` deletes `~/.cache/pi` — useful for flushing stale model-data or BenchLM cache — and prompts you to run `/reload` to apply the change. No extra dependencies beyond Pi.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pi install npm:@xynogen/pix-commands
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> Also included in [`@xynogen/pix-core`](https://github.com/xynogen/pix-mono/tree/main/packages/pix-core):
|
|
16
|
+
>
|
|
17
|
+
> ```bash
|
|
18
|
+
> pi install npm:@xynogen/pix-core
|
|
19
|
+
> ```
|
|
20
|
+
|
|
21
|
+
## Full distro
|
|
22
|
+
|
|
23
|
+
To install the complete pix suite (all packages + Pi itself):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl -fsSL https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.sh | sh
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT
|
package/package.json
CHANGED
package/src/extension.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import registerClear from "./clear.ts";
|
|
3
3
|
import registerDiff from "./diff.ts";
|
|
4
|
+
import { once } from "./once.ts";
|
|
4
5
|
|
|
5
6
|
export default function (pi: ExtensionAPI): void {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
once("pix-commands", () => {
|
|
8
|
+
registerDiff(pi);
|
|
9
|
+
registerClear(pi);
|
|
10
|
+
});
|
|
8
11
|
}
|
package/src/once.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotency guard for extension activation.
|
|
3
|
+
*
|
|
4
|
+
* pix-core (the meta-package) invokes this package's factory in addition to a
|
|
5
|
+
* possible direct install. Pi's loader uses jiti with `moduleCache: false`, so
|
|
6
|
+
* each load pass re-evaluates modules — a plain module-level flag would not be
|
|
7
|
+
* shared. The dedupe key therefore lives on `globalThis`, which persists for
|
|
8
|
+
* the lifetime of the process across all load passes.
|
|
9
|
+
*/
|
|
10
|
+
export function once(key: string, fn: () => void): void {
|
|
11
|
+
const g = globalThis as { __pixLoaded?: Set<string> };
|
|
12
|
+
const loaded = (g.__pixLoaded ??= new Set<string>());
|
|
13
|
+
if (loaded.has(key)) return;
|
|
14
|
+
loaded.add(key);
|
|
15
|
+
fn();
|
|
16
|
+
}
|