u-foo 1.0.1 → 1.0.2

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/package.json +1 -1
  2. package/src/chat/index.js +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-foo",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Multi-Agent Workspace Protocol. Just add u. claude → uclaude, codex → ucodex.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://ufoo.dev",
package/src/chat/index.js CHANGED
@@ -13,10 +13,15 @@ function connectSocket(sockPath) {
13
13
  });
14
14
  }
15
15
 
16
+ function resolveProjectFile(projectRoot, relativePath, fallbackRelativePath) {
17
+ const local = path.join(projectRoot, relativePath);
18
+ if (fs.existsSync(local)) return local;
19
+ return path.join(__dirname, "..", "..", fallbackRelativePath);
20
+ }
21
+
16
22
  function startDaemon(projectRoot) {
17
- // eslint-disable-next-line no-console
18
- console.log("Starting ufoo daemon...");
19
- const child = spawn(process.execPath, [path.join(projectRoot, "bin", "ufoo.js"), "daemon", "--start"], {
23
+ const daemonBin = resolveProjectFile(projectRoot, path.join("bin", "ufoo.js"), path.join("bin", "ufoo.js"));
24
+ const child = spawn(process.execPath, [daemonBin, "daemon", "--start"], {
20
25
  detached: true,
21
26
  stdio: "ignore",
22
27
  cwd: projectRoot,
@@ -40,7 +45,8 @@ async function connectWithRetry(sockPath, retries, delayMs) {
40
45
 
41
46
  async function runChat(projectRoot) {
42
47
  if (!fs.existsSync(path.join(projectRoot, ".ufoo"))) {
43
- spawnSync("bash", [path.join(projectRoot, "scripts", "init.sh"), "--modules", "context,bus", "--project", projectRoot], {
48
+ const initScript = resolveProjectFile(projectRoot, path.join("scripts", "init.sh"), path.join("scripts", "init.sh"));
49
+ spawnSync("bash", [initScript, "--modules", "context,bus", "--project", projectRoot], {
44
50
  stdio: "inherit",
45
51
  });
46
52
  }