pi-cicd 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/install.mjs +43 -7
  2. package/package.json +4 -1
package/install.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Install script for <PKG-NAME>
3
+ * Install script - copies skills to project skills/ directory
4
4
  */
5
5
 
6
6
  import * as fs from "node:fs";
@@ -12,6 +12,43 @@ const agentDir = path.join(home, ".pi", "agent");
12
12
  const pkgName = path.basename(process.cwd());
13
13
  const configPath = path.join(agentDir, `${pkgName}.json`);
14
14
 
15
+ // Get the directory where this script is located (package root)
16
+ const pkgRoot = path.dirname(fileURLToPath(import.meta.url));
17
+
18
+ // Copy skills to project skills/ directory
19
+ function copySkills() {
20
+ const skillsSrc = path.join(pkgRoot, "skills");
21
+ const skillsDest = path.join(process.cwd(), "skills", pkgName);
22
+
23
+ // Create skills destination directory
24
+ fs.mkdirSync(skillsDest, { recursive: true });
25
+
26
+ // Check if source skills directory exists
27
+ if (!fs.existsSync(skillsSrc)) {
28
+ console.log(`No skills directory in ${pkgName}`);
29
+ return;
30
+ }
31
+
32
+ // Copy all skill directories
33
+ const skillDirs = fs.readdirSync(skillsSrc, { withFileTypes: true });
34
+ for (const entry of skillDirs) {
35
+ if (entry.isDirectory()) {
36
+ const srcDir = path.join(skillsSrc, entry.name);
37
+ const destDir = path.join(skillsDest, entry.name);
38
+
39
+ // Create destination directory
40
+ fs.mkdirSync(destDir, { recursive: true });
41
+
42
+ // Copy SKILL.md
43
+ const srcFile = path.join(srcDir, "SKILL.md");
44
+ if (fs.existsSync(srcFile)) {
45
+ fs.copyFileSync(srcFile, path.join(destDir, "SKILL.md"));
46
+ console.log(`Copied skill: ${pkgName}/${entry.name}`);
47
+ }
48
+ }
49
+ }
50
+ }
51
+
15
52
  // Create config directory
16
53
  fs.mkdirSync(agentDir, { recursive: true });
17
54
 
@@ -26,9 +63,8 @@ if (!fs.existsSync(configPath)) {
26
63
  console.log(`${pkgName} config already exists: ${configPath}`);
27
64
  }
28
65
 
29
- console.log(`\nInstall the published package in Pi with:`);
30
- console.log(` pi install npm:@baphuongna/${pkgName}`);
31
- console.log(`\nFor local development from a cloned repo:`);
32
- console.log(` pi install .`);
33
- console.log(`\nVerify installation:`);
34
- console.log(` pi list\n`);
66
+ // Copy skills
67
+ copySkills();
68
+
69
+ console.log(`\nInstall complete for ${pkgName}`);
70
+ 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.7",
3
+ "version": "1.0.8",
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
  }