@henryqw/pi-open-in 3.0.1 → 3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@henryqw/pi-open-in`
2
2
 
3
- Open the current Pi working directory in your editor with one command. Move from terminal work while the agent is busy, using VS Code by default or any simple editor command.
3
+ Open the current Pi working directory with one command, using VS Code by default or another configured command. `/open` works while the agent is busy.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,16 +8,22 @@ Open the current Pi working directory in your editor with one command. Move from
8
8
  pi install npm:@henryqw/pi-open-in
9
9
  ```
10
10
 
11
- ## Use
11
+ ## Works with
12
+
13
+ | Package | Relationship | Purpose |
14
+ | --- | --- | --- |
15
+ | [`@henryqw/pi-config-store`](https://pi.henry.wang/extensions/pi-config-store) | Required | Owns config-home resolution and storage. |
12
16
 
13
- Run `/open`. With default settings, VS Code opens the current working directory.
17
+ ## Use
14
18
 
15
- Run `/set-open-in` when you want another command.
19
+ Run `/open` to open the current Pi working directory in VS Code by default.
16
20
 
17
21
  | Surface | Type | Purpose |
18
22
  | --- | --- | --- |
19
- | `/open` | command | Run `<command> <current-working-directory>`. Works while the agent is busy. |
20
- | `/set-open-in` | command | Set the command used by `/open`. |
23
+ | `/open` | command | Opens the current working directory with the configured command. |
24
+ | `/set-open-in <command>` | command | Sets the command used by `/open`. |
25
+
26
+ Run `/set-open-in <command>` to choose another command, such as `cursor --reuse-window`. `/open` runs `<command> <current-working-directory>`.
21
27
 
22
28
  ## Config
23
29
 
@@ -25,15 +31,13 @@ Package-owned: `~/.pi/agent/config/pi-open-in/config.json`
25
31
 
26
32
  | Name | Description | Values | Default |
27
33
  | --- | --- | --- | --- |
28
- | `command` | Sets the command used by `/open`. Required when the file exists. | Non-empty string. | `"code"` |
34
+ | `command` | Command run by `/open`; required when the file exists. | Non-empty string. | `"code"` |
29
35
 
30
- - A missing file silently uses the default command, `"code"`.
31
- - Reads do not create or write the config home.
32
- - Only `/set-open-in` writes the file. Its write is atomic.
36
+ A missing file silently uses the default command, `code`. An invalid existing file makes `/open` fail visibly and remains unchanged; see Limits and recovery. `/open` reads the config on every run. Only `/set-open-in` writes the file, atomically. Reads do not create or write the config home.
33
37
 
34
38
  ## API
35
39
 
36
- Consumers use the owner API instead of reading this file.
40
+ Consumers should use the owner API instead of reading the config file directly.
37
41
 
38
42
  ```ts
39
43
  import { loadOpenInConfig } from "@henryqw/pi-open-in/open-uri";
@@ -41,19 +45,21 @@ import { loadOpenInConfig } from "@henryqw/pi-open-in/open-uri";
41
45
  const { source, value } = loadOpenInConfig();
42
46
  ```
43
47
 
48
+ These exports serve package consumers; the commands in Use are the Pi interfaces.
49
+
44
50
  | Surface | Type | Purpose |
45
51
  | --- | --- | --- |
52
+ | `default` (`openInExtension(pi)`) | function | Registers the extension's commands with Pi. |
53
+ | `OpenInConfig` | type | Describes the configured command. |
46
54
  | `loadOpenInConfig(agentDir?)` | function | Reads and validates the owner config. |
47
55
  | `configuredOpenUri(path)` | function | Returns a safe VS Code URI for a supported command. |
48
56
 
49
- `loadOpenInConfig` returns `source` as `"missing"` or `"file"`. Its `value.command` is validated. Pass an agent directory when needed.
50
-
51
- `configuredOpenUri(path)` works when the executable is `code`. For `code -n` and `code --new-window`, it adds `windowId=_blank` so the link opens a new window. It returns `undefined` for other commands or invalid config.
57
+ `loadOpenInConfig` returns `source` as `"missing"` or `"file"`; `value.command` is validated. Pass an agent directory when needed.
52
58
 
53
- This extension owns command validation. `@henryqw/pi-config-store` owns the config home and storage.
59
+ `configuredOpenUri(path)` works when the executable is `code`. With `code -n` or `code --new-window`, it adds `windowId=_blank` so the link opens in a new window. It returns `undefined` for other commands or invalid config. `@henryqw/pi-config-store` owns the config home and storage.
54
60
 
55
61
  ## Limits and recovery
56
62
 
57
63
  The command splits on whitespace into an executable and arguments. Tokens cannot contain spaces, and quoting is unsupported. Use a wrapper script for executables in spaced paths.
58
64
 
59
- An existing file must be a JSON object with exactly one non-empty string `command` property. Otherwise `/open` fails with a visible error and offers no open URI. Malformed files remain unchanged.
65
+ An existing file must be a JSON object with exactly one non-empty string `command` property. Otherwise `/open` fails with a visible error, offers no open URI, and leaves the malformed file unchanged. If the configured command exits unsuccessfully, Pi reports its error output or exit code; fix the command and run `/open` again.
@@ -53,9 +53,7 @@ export function configuredOpenUri(path: string): string | undefined {
53
53
  export default function openInExtension(pi: ExtensionAPI): void {
54
54
  const configStore = createOpenInConfigStore();
55
55
 
56
- // ponytail: static description so it never goes stale after /set-open-in
57
- // (handler re-reads config per invocation); per-token whitespace splitting,
58
- // tokens with spaces not supported.
56
+ // Reload config on each call; split the command on whitespace (no quoted tokens).
59
57
  pi.registerCommand("open", {
60
58
  description: "Open the current path with the configured command",
61
59
  handler: async (_args, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-open-in",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Open the current Pi working directory with a configurable command.",
5
5
  "keywords": [
6
6
  "pi-package",