@henryqw/pi-open-in 0.2.4 → 0.2.6

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
@@ -30,20 +30,8 @@ pi install npm:@henryqw/pi-open-in
30
30
  }
31
31
  ```
32
32
 
33
- The command is split on whitespace; tokens cannot contain spaces (no quoting). Use a wrapper script for executables in spaced paths.
33
+ | Field | Required | Possible values | Default (missing file) |
34
+ | --- | --- | --- | --- |
35
+ | `command` | Yes when the file exists | Non-empty string, split on whitespace into executable plus arguments; tokens cannot contain spaces (no quoting) — use a wrapper script for executables in spaced paths | `"code"` |
34
36
 
35
- A missing config file falls back to `code`. An existing file must be a JSON object with exactly one non-empty string `command` property; otherwise `/open` fails with a visible error. The file is never rewritten by this extension except via `/set-open-in`. When the config is invalid, no open URI is offered.
36
-
37
- ## Remove
38
-
39
- ```bash
40
- pi remove npm:@henryqw/pi-open-in
41
- ```
42
-
43
- ## Development
44
-
45
- ```bash
46
- npm test --workspace @henryqw/pi-open-in
47
- npm run typecheck --workspace @henryqw/pi-open-in
48
- npm run pack:check --workspace @henryqw/pi-open-in
49
- ```
37
+ An existing file must be a JSON object with exactly one non-empty string `command` property; otherwise `/open` fails with a visible error and no open URI is offered. The file is never rewritten by this extension except via `/set-open-in`. This package uses no shared config.
@@ -49,12 +49,6 @@ export function configuredOpenUri(path: string): string | undefined {
49
49
  return `vscode://file${pathToFileURL(path).pathname}`;
50
50
  }
51
51
 
52
- async function saveCommand(command: string): Promise<void> {
53
- const path = configPath();
54
- await mkdir(dirname(path), { recursive: true });
55
- await writeFile(path, `${JSON.stringify({ command }, null, 2)}\n`, "utf8");
56
- }
57
-
58
52
  export default function openInExtension(pi: ExtensionAPI): void {
59
53
  // ponytail: static description so it never goes stale after /set-open-in
60
54
  // (handler re-reads config per invocation); per-token whitespace splitting,
@@ -75,7 +69,9 @@ export default function openInExtension(pi: ExtensionAPI): void {
75
69
  handler: async (args, ctx) => {
76
70
  const command = args.trim();
77
71
  if (!command) throw new Error("Usage: /set-open-in <command>");
78
- await saveCommand(command);
72
+ const path = configPath();
73
+ await mkdir(dirname(path), { recursive: true });
74
+ await writeFile(path, `${JSON.stringify({ command }, null, 2)}\n`, "utf8");
79
75
  ctx.ui.notify(`Saved open-in command: ${command}`, "info");
80
76
  },
81
77
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-open-in",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Open the current Pi working directory with a configurable command.",
5
5
  "keywords": [
6
6
  "pi-package",