freeturtle 0.1.27 → 0.1.28
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/dist/bin/freeturtle.js +2 -2
- package/dist/src/cli/update.js +15 -22
- package/dist/src/cli/update.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/freeturtle.js
CHANGED
|
@@ -15,14 +15,14 @@ const program = new Command();
|
|
|
15
15
|
program
|
|
16
16
|
.name("freeturtle")
|
|
17
17
|
.description("An open-source framework for deploying autonomous AI CEOs that run onchain businesses.")
|
|
18
|
-
.version("0.1.
|
|
18
|
+
.version("0.1.28");
|
|
19
19
|
program
|
|
20
20
|
.command("hello")
|
|
21
21
|
.description("Verify the CLI is working")
|
|
22
22
|
.action(() => {
|
|
23
23
|
console.log(" \x1b[38;2;94;255;164m _____ ____\x1b[0m");
|
|
24
24
|
console.log(" \x1b[38;2;94;255;164m/ \\ | o |\x1b[0m");
|
|
25
|
-
console.log(" \x1b[38;2;94;255;164m| |/ ___\\|\x1b[0m FreeTurtle v0.1.
|
|
25
|
+
console.log(" \x1b[38;2;94;255;164m| |/ ___\\|\x1b[0m FreeTurtle v0.1.28");
|
|
26
26
|
console.log(" \x1b[38;2;94;255;164m|_________/\x1b[0m");
|
|
27
27
|
console.log(" \x1b[38;2;94;255;164m|_|_| |_|_|\x1b[0m");
|
|
28
28
|
});
|
package/dist/src/cli/update.js
CHANGED
|
@@ -53,26 +53,6 @@ function stopDaemon(pid) {
|
|
|
53
53
|
// already gone
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function startDaemon(dir) {
|
|
57
|
-
// Resolve the freeturtle binary from the *newly installed* version, not the
|
|
58
|
-
// currently-running process. `which freeturtle` always returns the global
|
|
59
|
-
// bin shim, which now points to the updated package.
|
|
60
|
-
let bin;
|
|
61
|
-
try {
|
|
62
|
-
bin = execSync("which freeturtle", { encoding: "utf-8" }).trim();
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
// Fallback: try resolving relative to this file (pre-update path)
|
|
66
|
-
bin = join(__dirname, "../../bin/freeturtle.js");
|
|
67
|
-
}
|
|
68
|
-
// Use spawn(…, { detached: true }) via nohup + shell to ensure the child
|
|
69
|
-
// survives after this process exits. execSync with & is unreliable because
|
|
70
|
-
// the backgrounded child can be killed when the parent shell exits.
|
|
71
|
-
const escaped = dir.replace(/'/g, "'\\''");
|
|
72
|
-
execSync(`nohup ${bin} start --dir '${escaped}' </dev/null >/dev/null 2>&1 &`, {
|
|
73
|
-
shell: "/bin/sh",
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
56
|
export async function runUpdate(dir) {
|
|
77
57
|
const workspaceDir = dir ?? join(homedir(), ".freeturtle");
|
|
78
58
|
const daemonPid = getDaemonPid(workspaceDir);
|
|
@@ -103,9 +83,22 @@ export async function runUpdate(dir) {
|
|
|
103
83
|
if (daemonPid) {
|
|
104
84
|
console.log("\nRestarting daemon...");
|
|
105
85
|
try {
|
|
106
|
-
|
|
86
|
+
// Resolve the *newly installed* binary so we launch the updated code,
|
|
87
|
+
// not the code from the process that's currently running.
|
|
88
|
+
let bin;
|
|
89
|
+
try {
|
|
90
|
+
bin = execSync("which freeturtle", { encoding: "utf-8" }).trim();
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
bin = "freeturtle";
|
|
94
|
+
}
|
|
95
|
+
// Use the new binary's start command directly via nohup.
|
|
96
|
+
// This ensures the new version's daemon code runs, avoiding the
|
|
97
|
+
// "old code restarts old daemon" race condition.
|
|
98
|
+
const escaped = workspaceDir.replace(/'/g, "'\\''");
|
|
99
|
+
execSync(`nohup ${bin} start --dir '${escaped}' </dev/null >/dev/null 2>&1 &`, { shell: "/bin/sh" });
|
|
107
100
|
// Give it a moment to write PID
|
|
108
|
-
execSync("sleep
|
|
101
|
+
execSync("sleep 2");
|
|
109
102
|
const newPid = getDaemonPid(workspaceDir);
|
|
110
103
|
if (newPid) {
|
|
111
104
|
console.log(`Daemon restarted (PID ${newPid}).`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,SAAS,oBAAoB;IAC3B,8BAA8B;IAC9B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,qCAAqC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACpF,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,OAAO,MAAM,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAE1B,8BAA8B;IAC9B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,8BAA8B,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7E,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;YAAE,OAAO,MAAM,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAE1B,iBAAiB;IACjB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,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