pi-libactions 0.3.2 → 0.3.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 +13 -13
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# pi-libactions
|
|
1
|
+
# @luan.sh/pi-libactions [<img src="https://pi.luan.sh/icons/pi.svg" width="14" alt="Pi gallery">](https://pi.dev/packages/@luan.sh/pi-libactions) [<img src="https://pi.luan.sh/icons/npm.svg" width="14" alt="npm">](https://www.npmjs.com/package/@luan.sh/pi-libactions)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@luan.sh/pi-libactions` is a UI-free action registry and keybinding loader
|
|
4
4
|
for Pi extensions. It is a library, not a Pi extension: importing it registers
|
|
5
5
|
no commands, shortcuts, tools, or UI, and it is not installed with `pi install`
|
|
6
6
|
on its own. It reaches users as a dependency of the extensions that use it.
|
|
7
7
|
|
|
8
8
|
The registry lets an extension publish a named action without knowing which
|
|
9
|
-
host will expose it. A shortcut host (currently
|
|
9
|
+
host will expose it. A shortcut host (currently `@luan.sh/pi-xsettings`) reads
|
|
10
10
|
the user's `keybindings.json` and binds each configured key to the matching
|
|
11
|
-
action. Modal features such as
|
|
11
|
+
action. Modal features such as `@luan.sh/pi-copy-mode` read the same snapshot
|
|
12
12
|
without registering their keys as global editor shortcuts.
|
|
13
13
|
|
|
14
14
|
## Preview
|
|
15
15
|
|
|
16
16
|
Actions registered by Side Panel and Side Chat, bound by Xsettings, and listed in Pi's `/hotkeys`. The library itself registers no UI.
|
|
17
17
|
|
|
18
|
-

|
|
19
19
|
|
|
20
|
-
[Watch the demo](https://
|
|
20
|
+
[Watch the demo](https://pi.luan.sh/media/previews/pi-libactions-c0f46f189045.mp4).
|
|
21
21
|
|
|
22
22
|
## For users: `keybindings.json`
|
|
23
23
|
|
|
@@ -67,7 +67,7 @@ Rules the loader applies:
|
|
|
67
67
|
|
|
68
68
|
Which action IDs exist depends on the extensions you have installed; each
|
|
69
69
|
extension's README lists its IDs. Bindings only take effect when a shortcut
|
|
70
|
-
host is installed: `pi install npm
|
|
70
|
+
host is installed: `pi install npm:@luan.sh/pi-xsettings` provides one that
|
|
71
71
|
calls `pi.registerShortcut()` for every configured key. Without a host, the
|
|
72
72
|
registry still works but nothing binds global keys.
|
|
73
73
|
|
|
@@ -81,16 +81,16 @@ ships inside your published package:
|
|
|
81
81
|
```json
|
|
82
82
|
{
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"pi-libactions": "^0.1.0"
|
|
84
|
+
"@luan.sh/pi-libactions": "^0.1.0"
|
|
85
85
|
},
|
|
86
|
-
"bundledDependencies": ["pi-libactions"]
|
|
86
|
+
"bundledDependencies": ["@luan.sh/pi-libactions"]
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
Then import the public SDK:
|
|
91
91
|
|
|
92
92
|
```ts
|
|
93
|
-
import { registerAction } from "pi-libactions/sdk";
|
|
93
|
+
import { registerAction } from "@luan.sh/pi-libactions/sdk";
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
The package has no runtime dependencies; `@earendil-works/pi-coding-agent` and
|
|
@@ -121,7 +121,7 @@ Use a stable, namespaced ID (for example `myext.panel.open`). Register during
|
|
|
121
121
|
extension setup and keep the disposer for reload and shutdown:
|
|
122
122
|
|
|
123
123
|
```ts
|
|
124
|
-
import { registerAction } from "pi-libactions/sdk";
|
|
124
|
+
import { registerAction } from "@luan.sh/pi-libactions/sdk";
|
|
125
125
|
|
|
126
126
|
const unregister = registerAction({
|
|
127
127
|
id: "example.open",
|
|
@@ -140,7 +140,7 @@ unregister();
|
|
|
140
140
|
registry uses the full API:
|
|
141
141
|
|
|
142
142
|
```ts
|
|
143
|
-
import { ensureActionsRegistry } from "pi-libactions/sdk";
|
|
143
|
+
import { ensureActionsRegistry } from "@luan.sh/pi-libactions/sdk";
|
|
144
144
|
|
|
145
145
|
const actions = ensureActionsRegistry();
|
|
146
146
|
const stopListening = actions.onRegister((action) => {
|
|
@@ -170,7 +170,7 @@ Behaviour, as implemented in `src/protocol/actions.ts`:
|
|
|
170
170
|
### Reading keybindings from an extension
|
|
171
171
|
|
|
172
172
|
```ts
|
|
173
|
-
import { loadActionKeybindings, isActionKeyId } from "pi-libactions/sdk";
|
|
173
|
+
import { loadActionKeybindings, isActionKeyId } from "@luan.sh/pi-libactions/sdk";
|
|
174
174
|
|
|
175
175
|
const bindings = loadActionKeybindings(); // defaults to <agent dir>/keybindings.json
|
|
176
176
|
const keys = bindings["example.open"] ?? []; // readonly KeyId[], frozen
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-libactions",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"pi": {
|
|
20
20
|
"extensions": [],
|
|
21
|
-
"image": "https://
|
|
22
|
-
"video": "https://
|
|
21
|
+
"image": "https://pi.luan.sh/media/previews/pi-libactions-bbaab600e262.png",
|
|
22
|
+
"video": "https://pi.luan.sh/media/previews/pi-libactions-c0f46f189045.mp4"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"peerDependencies": {
|
|
@@ -36,5 +36,8 @@
|
|
|
36
36
|
"typecheck": "tsc --build",
|
|
37
37
|
"test": "bun test --only-failures test"
|
|
38
38
|
},
|
|
39
|
-
"bundledDependencies": []
|
|
39
|
+
"bundledDependencies": [],
|
|
40
|
+
"publishAliases": [
|
|
41
|
+
"pi-libactions"
|
|
42
|
+
]
|
|
40
43
|
}
|