ework-aio 0.3.2 → 0.3.4

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": "ework-aio",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "All-in-one installer for ework (issue tracker) + ework-daemon (AI bridge) + opencode-ework (plugin). One command: npm i -g ework-aio && ework-aio install.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,6 +22,7 @@ import type { GlobalOptions, ServiceTarget } from "../types.ts";
22
22
 
23
23
  interface ServicePaths {
24
24
  bin: string;
25
+ pkg: string;
25
26
  dataDir: string;
26
27
  envFile: string;
27
28
  pidFile: string;
@@ -33,6 +34,7 @@ function servicePaths(paths: PathConfig, svc: "web" | "daemon"): ServicePaths {
33
34
  if (svc === "web") {
34
35
  return {
35
36
  bin: "ework-web",
37
+ pkg: "ework-web",
36
38
  dataDir: paths.webDataDir,
37
39
  envFile: paths.webEnvFile,
38
40
  pidFile: paths.webPidFile,
@@ -46,6 +48,9 @@ function servicePaths(paths: PathConfig, svc: "web" | "daemon"): ServicePaths {
46
48
  // and exits — spawning it leaves the daemon "looking dead" with help text
47
49
  // in the log. See install.ts preflight for the full rationale.
48
50
  bin: "ework-daemon-server",
51
+ // npm package name differs from the bin name — the error hint must use the
52
+ // package name, not the bin, or the user gets a 404 trying to install.
53
+ pkg: "ework-daemon",
49
54
  dataDir: paths.daemonDataDir,
50
55
  envFile: paths.daemonEnvFile,
51
56
  pidFile: paths.daemonPidFile,
@@ -74,7 +79,7 @@ async function startOne(
74
79
  const sp = servicePaths(paths, svc);
75
80
  const binPath = resolveCommand(sp.bin);
76
81
  if (!binPath) {
77
- throw new InstallError(`${sp.bin} not found on PATH — install with: npm install -g ${sp.bin}`);
82
+ throw new InstallError(`${sp.bin} not found on PATH — install with: npm install -g ${sp.pkg}`);
78
83
  }
79
84
  const existingPid = await readPidFile(sp.pidFile);
80
85
  if (existingPid !== null && isProcessRunning(existingPid)) {
@@ -2,6 +2,8 @@
2
2
  // all user data. Idempotent — missing units or stale PID files are not
3
3
  // errors. Data dir is never touched; user removes it manually if desired.
4
4
 
5
+ import path from "node:path";
6
+ import { existsSync } from "node:fs";
5
7
  import { Logger } from "../log.ts";
6
8
  import { resolvePaths } from "../paths.ts";
7
9
  import { stopProcess } from "../pidfile.ts";
@@ -58,7 +60,23 @@ export async function runUninstall(opts: GlobalOptions, logger: Logger): Promise
58
60
  }
59
61
 
60
62
  // 3. Print recovery hint.
63
+ // Derive ework-aio's own install path from import.meta.dir so the removal
64
+ // command works even when npm's global prefix changed since install (the
65
+ // bin symlink may live under a different prefix than `npm prefix -g`).
66
+ const pkgRoot = path.resolve(import.meta.dir, "..", "..");
67
+ const binCandidates = [
68
+ path.join(pkgRoot, "..", "..", "..", "bin", "ework-aio"),
69
+ path.join(pkgRoot, "..", "..", "bin", "ework-aio"),
70
+ ];
71
+ const binPath = binCandidates.find((p) => existsSync(p));
72
+ const rmSelf = `rm -rf ${pkgRoot}${binPath ? ` ${binPath}` : ""}`;
73
+
61
74
  logger.hr();
62
75
  logger.ok(`services removed. data preserved at ${paths.dataDir}`);
63
- logger.warn(`to fully remove: rm -rf ${paths.dataDir} && npm uninstall -g ework-aio ework-web ework-daemon opencode-ework`);
76
+ logger.warn(
77
+ `to fully remove:\n` +
78
+ ` rm -rf ${paths.dataDir}\n` +
79
+ ` ${rmSelf}\n` +
80
+ ` npm uninstall -g ework-web ework-daemon opencode-ework`,
81
+ );
64
82
  }