ework-aio 0.5.34 → 0.5.36
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 +2 -2
- package/src/commands/install.ts +21 -2
- package/src/preflight.ts +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ework-aio",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.36",
|
|
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",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
|
-
"start": "bun bin/ework-aio
|
|
41
|
+
"start": "bun bin/ework-aio",
|
|
42
42
|
"check": "tsc --noEmit",
|
|
43
43
|
"test": "bun test",
|
|
44
44
|
"test:e2e": "bash scripts/e2e-install.sh",
|
package/src/commands/install.ts
CHANGED
|
@@ -347,8 +347,27 @@ export async function runInstall(
|
|
|
347
347
|
if (webStarted && exists(botTokenFile)) {
|
|
348
348
|
botToken = (await fs.promises.readFile(botTokenFile, "utf8")).trim();
|
|
349
349
|
if (botToken) {
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
// Saved token may be orphaned if the DB was wiped/replaced (fresh MySQL,
|
|
351
|
+
// sqlite→mysql migration). Verify before trusting — a stale token causes
|
|
352
|
+
// silent 401s on every daemon call. Any non-401 status means auth passed
|
|
353
|
+
// (404 = route missing but token valid); network error = web starting up.
|
|
354
|
+
const fetchImpl = hooks.fetchImpl ?? fetch;
|
|
355
|
+
try {
|
|
356
|
+
const verifyRes = await fetchImpl(`${baseUrl}/api/v1/user`, {
|
|
357
|
+
headers: { Authorization: `token ${botToken}` },
|
|
358
|
+
redirect: "manual",
|
|
359
|
+
});
|
|
360
|
+
if (verifyRes.status !== 401) {
|
|
361
|
+
logger.ok(`reusing saved bot token from ${botTokenFile} (verified)`);
|
|
362
|
+
botBootstrapped = true;
|
|
363
|
+
} else {
|
|
364
|
+
logger.warn(`saved bot token is stale (db has no matching PAT), re-bootstrapping`);
|
|
365
|
+
botToken = "";
|
|
366
|
+
}
|
|
367
|
+
} catch {
|
|
368
|
+
logger.warn(`cannot verify saved bot token, will re-bootstrap`);
|
|
369
|
+
botToken = "";
|
|
370
|
+
}
|
|
352
371
|
}
|
|
353
372
|
}
|
|
354
373
|
if (webStarted && !botBootstrapped) {
|
package/src/preflight.ts
CHANGED
|
@@ -41,6 +41,13 @@ export function resolveCommand(cmd: string): string | null {
|
|
|
41
41
|
// the user to "install ework-web first" even though it was already bundled
|
|
42
42
|
// (B-1). Returns the absolute bin path, or null if not bundled.
|
|
43
43
|
export function resolveBundledBin(pkgName: string, binRelPath: string): string | null {
|
|
44
|
+
// Explicit override wins everywhere (tests + non-standard install prefix).
|
|
45
|
+
// Without this, the dev-repo branch below would ignore AIO_PACKAGE_ROOT and
|
|
46
|
+
// the "empty dir → null" contract couldn't be exercised from a git checkout.
|
|
47
|
+
if (process.env.AIO_PACKAGE_ROOT) {
|
|
48
|
+
const candidate = path.join(process.env.AIO_PACKAGE_ROOT, "node_modules", pkgName, binRelPath);
|
|
49
|
+
return fs.existsSync(candidate) ? candidate : null;
|
|
50
|
+
}
|
|
44
51
|
if (isDevRepo()) {
|
|
45
52
|
const r = spawnSync("npm", ["root", "-g"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], env: process.env });
|
|
46
53
|
const npmRoot = (r.stdout ?? "").trim();
|
|
@@ -50,8 +57,7 @@ export function resolveBundledBin(pkgName: string, binRelPath: string): string |
|
|
|
50
57
|
}
|
|
51
58
|
return null;
|
|
52
59
|
}
|
|
53
|
-
const
|
|
54
|
-
const candidate = path.join(root, "node_modules", pkgName, binRelPath);
|
|
60
|
+
const candidate = path.join(DEFAULT_PACKAGE_ROOT, "node_modules", pkgName, binRelPath);
|
|
55
61
|
return fs.existsSync(candidate) ? candidate : null;
|
|
56
62
|
}
|
|
57
63
|
|