pi-skill-search 0.2.0 → 0.2.1
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/package.json +3 -1
- package/src/scanner.ts +4 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-skill-search",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "On-demand skill search extension for Pi — replaces inject-all with search tool + category summary",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "index.ts",
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"@types/js-yaml": "^4.0.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
+
"install:skill": "node install.mjs",
|
|
25
|
+
"postinstall": "node install.mjs",
|
|
24
26
|
"check": "biome check . && tsc --noEmit",
|
|
25
27
|
"test": "tsx node_modules/vitest/dist/cli.js --run",
|
|
26
28
|
"test:watch": "tsx node_modules/vitest/dist/cli.js",
|
package/src/scanner.ts
CHANGED
|
@@ -81,9 +81,7 @@ export function scanSkillDirectory(dir: string): PiSkill[] {
|
|
|
81
81
|
* 3. <global-npm>/pi-skill-search/data/ (global install + sibling data)
|
|
82
82
|
*/
|
|
83
83
|
export function findCorpusPath(): string | undefined {
|
|
84
|
-
const thisFile = path.dirname(
|
|
85
|
-
new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1"),
|
|
86
|
-
);
|
|
84
|
+
const thisFile = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1"));
|
|
87
85
|
const extRoot = path.basename(thisFile) === "src" ? path.dirname(thisFile) : thisFile;
|
|
88
86
|
|
|
89
87
|
// 1. Check ext-root/data/
|
|
@@ -107,7 +105,7 @@ export function findCorpusPath(): string | undefined {
|
|
|
107
105
|
|
|
108
106
|
// 3. Try global npm root
|
|
109
107
|
try {
|
|
110
|
-
const { execSync } = require("child_process");
|
|
108
|
+
const { execSync } = require("node:child_process");
|
|
111
109
|
const globalRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
|
|
112
110
|
for (const pkgName of ["pi-skill-search", "pss-corpus", "pss-data"]) {
|
|
113
111
|
const globalPath = path.join(globalRoot, pkgName, "data");
|
|
@@ -126,8 +124,6 @@ export function findCorpusPath(): string | undefined {
|
|
|
126
124
|
* Resolve extension root — thu muc chua index.ts cua extension.
|
|
127
125
|
*/
|
|
128
126
|
export function resolveExtensionRoot(): string {
|
|
129
|
-
const thisFile = path.dirname(
|
|
130
|
-
new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1"),
|
|
131
|
-
);
|
|
127
|
+
const thisFile = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1"));
|
|
132
128
|
return path.basename(thisFile) === "src" ? path.dirname(thisFile) : thisFile;
|
|
133
|
-
}
|
|
129
|
+
}
|