pi-cicd 1.0.8 → 1.0.10
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/install.mjs +20 -2
- package/package.json +1 -1
package/install.mjs
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
* Install script - copies skills to project skills/ directory
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { createRequire } from "module";
|
|
6
7
|
import * as fs from "node:fs";
|
|
7
8
|
import * as os from "node:os";
|
|
8
9
|
import * as path from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
9
11
|
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
10
13
|
const home = os.homedir();
|
|
11
14
|
const agentDir = path.join(home, ".pi", "agent");
|
|
12
15
|
const pkgName = path.basename(process.cwd());
|
|
@@ -15,10 +18,25 @@ const configPath = path.join(agentDir, `${pkgName}.json`);
|
|
|
15
18
|
// Get the directory where this script is located (package root)
|
|
16
19
|
const pkgRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
17
20
|
|
|
21
|
+
// Find project root (go up from node_modules)
|
|
22
|
+
function findProjectRoot(pkgDir) {
|
|
23
|
+
// If we're in node_modules/<pkg>, go up to project root
|
|
24
|
+
const nodeModulesIndex = pkgDir.indexOf("/node_modules/");
|
|
25
|
+
if (nodeModulesIndex !== -1) {
|
|
26
|
+
return pkgDir.substring(0, nodeModulesIndex);
|
|
27
|
+
}
|
|
28
|
+
return pkgDir;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const projectRoot = findProjectRoot(pkgRoot);
|
|
32
|
+
|
|
18
33
|
// Copy skills to project skills/ directory
|
|
19
34
|
function copySkills() {
|
|
20
35
|
const skillsSrc = path.join(pkgRoot, "skills");
|
|
21
|
-
const skillsDest = path.join(
|
|
36
|
+
const skillsDest = path.join(projectRoot, "skills", pkgName);
|
|
37
|
+
|
|
38
|
+
console.log(`Copying skills from: ${skillsSrc}`);
|
|
39
|
+
console.log(`Copying skills to: ${skillsDest}`);
|
|
22
40
|
|
|
23
41
|
// Create skills destination directory
|
|
24
42
|
fs.mkdirSync(skillsDest, { recursive: true });
|
|
@@ -67,4 +85,4 @@ if (!fs.existsSync(configPath)) {
|
|
|
67
85
|
copySkills();
|
|
68
86
|
|
|
69
87
|
console.log(`\nInstall complete for ${pkgName}`);
|
|
70
|
-
console.log(`Skills installed to: ${path.join(
|
|
88
|
+
console.log(`Skills installed to: ${path.join(projectRoot, "skills", pkgName)}`);
|