palmier 0.3.6 → 0.3.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.
@@ -96,6 +96,23 @@ WantedBy=default.target
96
96
  console.log("\nHost initialization complete!");
97
97
  }
98
98
  async restartDaemon() {
99
+ // Update the service file's PATH so the daemon can find agent CLIs.
100
+ // Resolve the user's login PATH (not the daemon's limited PATH)
101
+ // by sourcing their shell profile.
102
+ const servicePath = path.join(UNIT_DIR, "palmier.service");
103
+ if (fs.existsSync(servicePath)) {
104
+ let userPath = process.env.PATH || "";
105
+ try {
106
+ userPath = execSync("bash -lc 'echo $PATH'", { encoding: "utf-8" }).trim();
107
+ }
108
+ catch { /* fall back to current PATH */ }
109
+ const content = fs.readFileSync(servicePath, "utf-8");
110
+ const updated = content.replace(/^Environment=PATH=.*/m, `Environment=PATH=${userPath || "/usr/local/bin:/usr/bin:/bin"}`);
111
+ if (updated !== content) {
112
+ fs.writeFileSync(servicePath, updated, "utf-8");
113
+ execSync("systemctl --user daemon-reload", { encoding: "utf-8" });
114
+ }
115
+ }
99
116
  execSync("systemctl --user restart palmier.service", { stdio: "inherit" });
100
117
  console.log("Palmier daemon restarted.");
101
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palmier",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Palmier host CLI - provisions, executes tasks, and serves NATS RPC",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hongxu Cai",
@@ -113,6 +113,25 @@ WantedBy=default.target
113
113
  }
114
114
 
115
115
  async restartDaemon(): Promise<void> {
116
+ // Update the service file's PATH so the daemon can find agent CLIs.
117
+ // Resolve the user's login PATH (not the daemon's limited PATH)
118
+ // by sourcing their shell profile.
119
+ const servicePath = path.join(UNIT_DIR, "palmier.service");
120
+ if (fs.existsSync(servicePath)) {
121
+ let userPath = process.env.PATH || "";
122
+ try {
123
+ userPath = execSync("bash -lc 'echo $PATH'", { encoding: "utf-8" }).trim();
124
+ } catch { /* fall back to current PATH */ }
125
+ const content = fs.readFileSync(servicePath, "utf-8");
126
+ const updated = content.replace(
127
+ /^Environment=PATH=.*/m,
128
+ `Environment=PATH=${userPath || "/usr/local/bin:/usr/bin:/bin"}`,
129
+ );
130
+ if (updated !== content) {
131
+ fs.writeFileSync(servicePath, updated, "utf-8");
132
+ execSync("systemctl --user daemon-reload", { encoding: "utf-8" });
133
+ }
134
+ }
116
135
  execSync("systemctl --user restart palmier.service", { stdio: "inherit" });
117
136
  console.log("Palmier daemon restarted.");
118
137
  }