pi-cicd 1.0.7 → 1.0.9
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 +46 -7
- package/package.json +4 -1
package/install.mjs
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Install script
|
|
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());
|
|
13
16
|
const configPath = path.join(agentDir, `${pkgName}.json`);
|
|
14
17
|
|
|
18
|
+
// Get the directory where this script is located (package root)
|
|
19
|
+
const pkgRoot = path.dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
|
|
21
|
+
// Copy skills to project skills/ directory
|
|
22
|
+
function copySkills() {
|
|
23
|
+
const skillsSrc = path.join(pkgRoot, "skills");
|
|
24
|
+
const skillsDest = path.join(process.cwd(), "skills", pkgName);
|
|
25
|
+
|
|
26
|
+
// Create skills destination directory
|
|
27
|
+
fs.mkdirSync(skillsDest, { recursive: true });
|
|
28
|
+
|
|
29
|
+
// Check if source skills directory exists
|
|
30
|
+
if (!fs.existsSync(skillsSrc)) {
|
|
31
|
+
console.log(`No skills directory in ${pkgName}`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Copy all skill directories
|
|
36
|
+
const skillDirs = fs.readdirSync(skillsSrc, { withFileTypes: true });
|
|
37
|
+
for (const entry of skillDirs) {
|
|
38
|
+
if (entry.isDirectory()) {
|
|
39
|
+
const srcDir = path.join(skillsSrc, entry.name);
|
|
40
|
+
const destDir = path.join(skillsDest, entry.name);
|
|
41
|
+
|
|
42
|
+
// Create destination directory
|
|
43
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
44
|
+
|
|
45
|
+
// Copy SKILL.md
|
|
46
|
+
const srcFile = path.join(srcDir, "SKILL.md");
|
|
47
|
+
if (fs.existsSync(srcFile)) {
|
|
48
|
+
fs.copyFileSync(srcFile, path.join(destDir, "SKILL.md"));
|
|
49
|
+
console.log(`Copied skill: ${pkgName}/${entry.name}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
15
55
|
// Create config directory
|
|
16
56
|
fs.mkdirSync(agentDir, { recursive: true });
|
|
17
57
|
|
|
@@ -26,9 +66,8 @@ if (!fs.existsSync(configPath)) {
|
|
|
26
66
|
console.log(`${pkgName} config already exists: ${configPath}`);
|
|
27
67
|
}
|
|
28
68
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
console.log(
|
|
33
|
-
console.log(
|
|
34
|
-
console.log(` pi list\n`);
|
|
69
|
+
// Copy skills
|
|
70
|
+
copySkills();
|
|
71
|
+
|
|
72
|
+
console.log(`\nInstall complete for ${pkgName}`);
|
|
73
|
+
console.log(`Skills installed to: ${path.join(process.cwd(), "skills", pkgName)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-cicd",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Extension for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -38,5 +38,8 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"typescript": "^5.0.0",
|
|
40
40
|
"@earendil-works/pi-coding-agent": ">=0.73.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"postinstall": "node install.mjs"
|
|
41
44
|
}
|
|
42
45
|
}
|