pi-incise 0.3.1 → 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/extension/normalize.ts +8 -1
- package/package.json +5 -5
package/extension/normalize.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
1
2
|
import { resolve } from "node:path";
|
|
2
3
|
|
|
3
4
|
export type ToolArguments = Record<string, unknown>;
|
|
@@ -93,12 +94,18 @@ export function stripPiPathPrefix(path: string): string {
|
|
|
93
94
|
return path.startsWith("@") ? path.slice(1) : path;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
export function expandHomePath(path: string, home: string = homedir()): string {
|
|
98
|
+
if (path === "~") return home;
|
|
99
|
+
if (path.startsWith("~/")) return resolve(home, path.slice(2));
|
|
100
|
+
return path;
|
|
101
|
+
}
|
|
102
|
+
|
|
96
103
|
export function resolveToolPath(args: ToolArguments, cwd: string): { path: string; args: ToolArguments } {
|
|
97
104
|
const raw = args.path ?? args.file;
|
|
98
105
|
if (typeof raw !== "string" || !raw) {
|
|
99
106
|
throw new Error("incise needs `path`: the markdown file to read or edit.");
|
|
100
107
|
}
|
|
101
|
-
const path = resolve(cwd, stripPiPathPrefix(raw));
|
|
108
|
+
const path = resolve(cwd, expandHomePath(stripPiPathPrefix(raw)));
|
|
102
109
|
return { path, args: { ...args, path } };
|
|
103
110
|
}
|
|
104
111
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-incise",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Semantic, byte-preserving Markdown editing tools for Pi and AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"typescript": "^5.9.3"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@pdalinis/pi-incise-darwin-arm64": "0.3.
|
|
50
|
-
"@pdalinis/pi-incise-darwin-x64": "0.3.
|
|
51
|
-
"@pdalinis/pi-incise-linux-arm64-gnu": "0.3.
|
|
52
|
-
"@pdalinis/pi-incise-linux-x64-gnu": "0.3.
|
|
49
|
+
"@pdalinis/pi-incise-darwin-arm64": "0.3.3",
|
|
50
|
+
"@pdalinis/pi-incise-darwin-x64": "0.3.3",
|
|
51
|
+
"@pdalinis/pi-incise-linux-arm64-gnu": "0.3.3",
|
|
52
|
+
"@pdalinis/pi-incise-linux-x64-gnu": "0.3.3"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "node --test --experimental-strip-types test/*.test.ts",
|