@phi-code-admin/phi-code 0.59.6 → 0.59.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phi-code-admin/phi-code",
3
- "version": "0.59.6",
3
+ "version": "0.59.7",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Post-install script: copies bundled extensions, agents, and skills
4
- * to ~/.phi/agent/ so Pi discovers them automatically.
4
+ * to ~/.phi/agent/ and makes sigma packages resolvable from there.
5
5
  */
6
- const { existsSync, mkdirSync, cpSync, readdirSync } = require("fs");
7
- const { join } = require("path");
6
+ const { existsSync, mkdirSync, cpSync, readdirSync, symlinkSync, unlinkSync, readlinkSync } = require("fs");
7
+ const { join, dirname } = require("path");
8
8
  const { homedir } = require("os");
9
9
 
10
10
  const agentDir = join(homedir(), ".phi", "agent");
11
- const packageDir = __dirname.replace(/[/\\]scripts$/, "");
11
+ const packageDir = __dirname.replace(/[\\/]scripts$/, "");
12
12
 
13
+ // 1. Copy extensions, agents, skills
13
14
  const copies = [
14
15
  { src: "extensions/phi", dest: join(agentDir, "extensions"), label: "extensions" },
15
16
  { src: "agents", dest: join(agentDir, "agents"), label: "agents" },
@@ -19,22 +20,61 @@ const copies = [
19
20
  for (const { src, dest, label } of copies) {
20
21
  const srcDir = join(packageDir, src);
21
22
  if (!existsSync(srcDir)) continue;
22
-
23
23
  mkdirSync(dest, { recursive: true });
24
-
25
24
  const files = readdirSync(srcDir);
26
25
  let copied = 0;
27
26
  for (const file of files) {
28
- const srcPath = join(srcDir, file);
29
- const destPath = join(dest, file);
30
27
  try {
31
- cpSync(srcPath, destPath, { recursive: true, force: true });
28
+ cpSync(join(srcDir, file), join(dest, file), { recursive: true, force: true });
32
29
  copied++;
33
- } catch (e) {
34
- // Skip files that can't be copied (permissions, etc.)
30
+ } catch (e) { /* skip */ }
31
+ }
32
+ if (copied > 0) console.log(` Φ Installed ${copied} ${label} to ${dest}`);
33
+ }
34
+
35
+ // 2. Make sigma packages resolvable from ~/.phi/agent/extensions/
36
+ // Create node_modules with symlinks to the actual packages
37
+ const sigmaPackages = ["sigma-memory", "sigma-agents", "sigma-skills"];
38
+ const extensionsNodeModules = join(agentDir, "extensions", "node_modules");
39
+ mkdirSync(extensionsNodeModules, { recursive: true });
40
+
41
+ for (const pkg of sigmaPackages) {
42
+ const srcPkg = join(packageDir, "node_modules", pkg);
43
+ const destLink = join(extensionsNodeModules, pkg);
44
+
45
+ if (!existsSync(srcPkg)) {
46
+ // Try parent node_modules (hoisted)
47
+ let parent = dirname(packageDir);
48
+ while (parent !== dirname(parent)) {
49
+ const hoisted = join(parent, "node_modules", pkg);
50
+ if (existsSync(hoisted)) {
51
+ createLink(hoisted, destLink, pkg);
52
+ break;
53
+ }
54
+ parent = dirname(parent);
35
55
  }
56
+ continue;
36
57
  }
37
- if (copied > 0) {
38
- console.log(` Φ Installed ${copied} ${label} to ${dest}`);
58
+ createLink(srcPkg, destLink, pkg);
59
+ }
60
+
61
+ function createLink(src, dest, name) {
62
+ try {
63
+ // Remove existing (symlink or directory)
64
+ if (existsSync(dest)) {
65
+ try { unlinkSync(dest); } catch {
66
+ try { cpSync(src, dest, { recursive: true, force: true }); return; } catch { return; }
67
+ }
68
+ }
69
+ // Try symlink first, fall back to copy (Windows may not support symlinks)
70
+ try {
71
+ symlinkSync(src, dest, "junction");
72
+ console.log(` Φ Linked ${name}`);
73
+ } catch {
74
+ cpSync(src, dest, { recursive: true, force: true });
75
+ console.log(` Φ Copied ${name}`);
76
+ }
77
+ } catch (e) {
78
+ console.log(` ⚠ Could not install ${name}: ${e.message}`);
39
79
  }
40
80
  }
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "REST API design patterns, versioning, error handling, and documentation"
3
+ ---
1
4
  # API Design Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Code quality standards, naming conventions, and best practices"
3
+ ---
1
4
  # Coding Standards Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Database design, queries, migrations, and optimization"
3
+ ---
1
4
  # Database Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "CI/CD pipelines, deployment, monitoring, and infrastructure"
3
+ ---
1
4
  # DevOps Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Docker containers, Compose, images, and orchestration"
3
+ ---
1
4
  # Docker Operations Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Git branching, commits, merges, and collaboration workflows"
3
+ ---
1
4
  # Git Workflow Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "GitHub Actions, PRs, issues, releases, and repository management"
3
+ ---
1
4
  # GitHub Workflow Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Performance profiling, optimization, caching, and benchmarking"
3
+ ---
1
4
  # Performance Optimization Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Crafting production-grade structured prompts for AI systems"
3
+ ---
1
4
  # Prompt Architect Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Security auditing, vulnerability scanning, and hardening"
3
+ ---
1
4
  # Security Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Continuous learning from errors, corrections, and discoveries"
3
+ ---
1
4
  # Self-Improving Agent Skill
2
5
 
3
6
  ## When to use
@@ -1,3 +1,6 @@
1
+ ---
2
+ description: "Test strategy, unit tests, integration tests, and test automation"
3
+ ---
1
4
  # Testing Skill
2
5
 
3
6
  ## When to use