@brainbase-labs/cli 0.29.0 → 0.29.1
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/index.js +39 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36018,7 +36018,7 @@ function padStart(s, n) {
|
|
|
36018
36018
|
// package.json
|
|
36019
36019
|
var package_default = {
|
|
36020
36020
|
name: "@brainbase-labs/cli",
|
|
36021
|
-
version: "0.29.
|
|
36021
|
+
version: "0.29.1",
|
|
36022
36022
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36023
36023
|
type: "module",
|
|
36024
36024
|
bin: {
|
|
@@ -40969,7 +40969,7 @@ function acquireLock(lockFile, timeoutMs) {
|
|
|
40969
40969
|
function acquireAuthLock() {
|
|
40970
40970
|
const release = acquireLock(AUTH_LOCK_FILE, AUTH_LOCK_TIMEOUT_MS);
|
|
40971
40971
|
if (!release) {
|
|
40972
|
-
throw new Error(`Timed out waiting to update CLI authentication
|
|
40972
|
+
throw new Error(`Timed out waiting to update CLI authentication.${lockHolderState(AUTH_LOCK_FILE)} Retry, or remove ${AUTH_LOCK_FILE}`);
|
|
40973
40973
|
}
|
|
40974
40974
|
return release;
|
|
40975
40975
|
}
|
|
@@ -41021,10 +41021,44 @@ class AuthSessionChangedError extends Error {
|
|
|
41021
41021
|
this.name = "AuthSessionChangedError";
|
|
41022
41022
|
}
|
|
41023
41023
|
}
|
|
41024
|
+
function heldFor(lockFile) {
|
|
41025
|
+
try {
|
|
41026
|
+
const ms = Date.now() - fs6.statSync(lockFile).mtimeMs;
|
|
41027
|
+
if (!Number.isFinite(ms) || ms < 0)
|
|
41028
|
+
return "";
|
|
41029
|
+
if (ms < 60000)
|
|
41030
|
+
return ` Held for ${Math.round(ms / 1000)}s.`;
|
|
41031
|
+
if (ms < 3600000)
|
|
41032
|
+
return ` Held for ${Math.round(ms / 60000)}m.`;
|
|
41033
|
+
return ` Held for ${Math.round(ms / 3600000)}h.`;
|
|
41034
|
+
} catch {
|
|
41035
|
+
return "";
|
|
41036
|
+
}
|
|
41037
|
+
}
|
|
41038
|
+
function lockHolderState(lockFile) {
|
|
41039
|
+
let pid;
|
|
41040
|
+
try {
|
|
41041
|
+
pid = Number.parseInt(fs6.readFileSync(lockFile, "utf8").split(":")[0] ?? "", 10);
|
|
41042
|
+
} catch {
|
|
41043
|
+
return "";
|
|
41044
|
+
}
|
|
41045
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
41046
|
+
return "";
|
|
41047
|
+
const age = heldFor(lockFile);
|
|
41048
|
+
try {
|
|
41049
|
+
process.kill(pid, 0);
|
|
41050
|
+
return ` A process with pid ${pid} is running, so this may clear on its own — but pids get reused, so if that is not a brainbase command the lock is stale.${age}`;
|
|
41051
|
+
} catch (error) {
|
|
41052
|
+
if (error.code === "EPERM") {
|
|
41053
|
+
return ` A process with pid ${pid} is running, so this may clear on its own — but pids get reused, so if that is not a brainbase command the lock is stale.${age}`;
|
|
41054
|
+
}
|
|
41055
|
+
return ` The process that held it (pid ${pid}) is gone, so this lock is stale and will not clear itself.${age}`;
|
|
41056
|
+
}
|
|
41057
|
+
}
|
|
41024
41058
|
|
|
41025
41059
|
class AuthRefreshLockTimeoutError extends Error {
|
|
41026
41060
|
constructor() {
|
|
41027
|
-
super(`Timed out waiting to refresh CLI authentication
|
|
41061
|
+
super(`Timed out waiting to refresh CLI authentication.${lockHolderState(REFRESH_LOCK_FILE)} Retry, or remove ${REFRESH_LOCK_FILE}`);
|
|
41028
41062
|
this.name = "AuthRefreshLockTimeoutError";
|
|
41029
41063
|
}
|
|
41030
41064
|
}
|
|
@@ -53890,7 +53924,7 @@ var StoredTokenSchema = exports_external.object({
|
|
|
53890
53924
|
function withTokenLock(operation) {
|
|
53891
53925
|
const release = acquireLock(TOKEN_LOCK_FILE, TOKEN_LOCK_TIMEOUT_MS);
|
|
53892
53926
|
if (!release) {
|
|
53893
|
-
throw new Error(`Timed out waiting to update the local CLI token
|
|
53927
|
+
throw new Error(`Timed out waiting to update the local CLI token.${lockHolderState(TOKEN_LOCK_FILE)} Retry, or remove ${TOKEN_LOCK_FILE}`);
|
|
53894
53928
|
}
|
|
53895
53929
|
try {
|
|
53896
53930
|
return operation();
|
|
@@ -89253,8 +89287,8 @@ async function main() {
|
|
|
89253
89287
|
const limitFlag = Number.isInteger(limitParsed) && limitParsed >= 1 && limitParsed <= 200 ? limitParsed : undefined;
|
|
89254
89288
|
const archivedFlag = hasFlag2(sharedArgs, "--archived");
|
|
89255
89289
|
ensureSkillResolversRegistered();
|
|
89256
|
-
await requireAuth(cmd);
|
|
89257
89290
|
try {
|
|
89291
|
+
await requireAuth(cmd);
|
|
89258
89292
|
switch (cmd) {
|
|
89259
89293
|
case "login": {
|
|
89260
89294
|
await runLogin(cwd2, { web });
|