ework-web 0.10.11 → 0.10.13

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-web",
3
- "version": "0.10.11",
3
+ "version": "0.10.13",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
@@ -74,10 +74,16 @@ function parseEnvFile(content: string): Map<string, string> {
74
74
 
75
75
  function buildEnvBlock(env: Map<string, string>, target: DeployTarget): string {
76
76
  const lines: string[] = [];
77
+ const localIP = detectLocalIP();
77
78
  for (const k of FORWARD_KEYS) {
78
79
  const v = env.get(k);
79
80
  if (v === undefined) continue;
80
- lines.push(`${k}=${v}`);
81
+ if (k === "OPENCODE_BINARY") continue;
82
+ let val = v;
83
+ if (k === "GITEA_URL" && localIP && (val.includes("127.0.0.1") || val.includes("localhost"))) {
84
+ val = val.replace(/127\.0\.0\.1|localhost/g, localIP);
85
+ }
86
+ lines.push(`${k}=${val}`);
81
87
  }
82
88
  const mysqlHost = String(target.mysqlHost).replace(/:\d+$/, "");
83
89
  lines.push(`WORK_DB_HOST=${mysqlHost}`);
@@ -87,6 +93,23 @@ function buildEnvBlock(env: Map<string, string>, target: DeployTarget): string {
87
93
  return lines.join("\n");
88
94
  }
89
95
 
96
+ function detectLocalIP(): string | null {
97
+ try {
98
+ const { networkInterfaces } = require("node:os");
99
+ const nets = networkInterfaces();
100
+ for (const name of Object.keys(nets)) {
101
+ for (const net of nets[name] ?? []) {
102
+ if (net.family === "IPv4" && !net.internal) {
103
+ return net.address;
104
+ }
105
+ }
106
+ }
107
+ } catch {
108
+ // Network detection best-effort
109
+ }
110
+ return null;
111
+ }
112
+
90
113
  function buildSetupScript(envBlock: string, daemonPort: number, mysqlHostRaw: string, mysqlPort: string): string {
91
114
  const mysqlHost = mysqlHostRaw.replace(/:\d+$/, "");
92
115
  return [
@@ -102,6 +125,9 @@ function buildSetupScript(envBlock: string, daemonPort: number, mysqlHostRaw: st
102
125
  `timeout 5 bash -c "echo > /dev/tcp/${mysqlHost}/${mysqlPort}" 2>/dev/null && echo "MySQL port reachable" || { echo "MySQL UNREACHABLE at ${mysqlHost}:${mysqlPort} — daemon will fail to connect"; exit 1; }`,
103
126
  `echo "[2/5] installing ework-aio..."`,
104
127
  `npm install -g ework-aio`,
128
+ `echo "[2.5/5] ensuring opencode is available..."`,
129
+ `command -v opencode >/dev/null 2>&1 || { echo "installing opencode..."; curl -fsSL https://opencode.ai/install | bash; }`,
130
+ `mkdir -p ~/.local/share/ework-aio/opencode-workdir`,
105
131
  `echo "[3/5] writing daemon config..."`,
106
132
  `mkdir -p ~/.local/share/ework-aio/ework-daemon`,
107
133
  `REMOTE_IP=$(hostname -I 2>/dev/null | awk '{print $1}')`,