@codyn06/cboard 0.3.8 → 0.3.9
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/kit/cboard-connect.js
CHANGED
|
@@ -331,9 +331,11 @@ export function connect(options = {}) {
|
|
|
331
331
|
const mergeEntry = (serverName, helperCommand) => {
|
|
332
332
|
const entry = isObject(mcp.mcpServers[serverName]) ? mcp.mcpServers[serverName] : {};
|
|
333
333
|
if (!("type" in entry)) entry.type = "http";
|
|
334
|
-
const setGenerated = (key, value, mayOverwrite) => {
|
|
334
|
+
const setGenerated = (key, value, mayOverwrite, keepQuietly = () => false) => {
|
|
335
335
|
if (!(key in entry) || entry[key] === value) {
|
|
336
336
|
entry[key] = value;
|
|
337
|
+
} else if (keepQuietly(entry[key])) {
|
|
338
|
+
// The repository's own replacement: kept on purpose, nothing to report.
|
|
337
339
|
} else if (mayOverwrite(entry[key])) {
|
|
338
340
|
entry[key] = value;
|
|
339
341
|
} else {
|
|
@@ -352,13 +354,11 @@ export function connect(options = {}) {
|
|
|
352
354
|
setGenerated(
|
|
353
355
|
"headersHelper",
|
|
354
356
|
helperCommand,
|
|
357
|
+
(current) => typeof current === "string" && GENERATED_HELPER.test(current),
|
|
355
358
|
(current) =>
|
|
356
359
|
typeof current === "string" &&
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
current.startsWith("node scripts/graph-up.js") &&
|
|
360
|
-
existsSync(join(repo, "scripts", "graph-up.js"))
|
|
361
|
-
),
|
|
360
|
+
current.startsWith("node scripts/graph-up.js") &&
|
|
361
|
+
existsSync(join(repo, "scripts", "graph-up.js")),
|
|
362
362
|
);
|
|
363
363
|
mcp.mcpServers[serverName] = entry;
|
|
364
364
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SessionStart hook: checks that this repository can reach its cboard graph (token present and
|
|
3
3
|
// accepted, configured project visible). Never starts anything and never prints the token.
|
|
4
4
|
// Prints `cboard graph: CONNECTED …` or a fix hint on stderr; exits 1 when not connected.
|
|
5
|
-
import { McpError, describeWhoami, fetchWhoami, mcpCall } from "./mcp.js";
|
|
5
|
+
import { LOGIN_COMMAND, McpError, describeWhoami, fetchWhoami, mcpCall } from "./mcp.js";
|
|
6
6
|
import { retryWake } from "./wait.js";
|
|
7
7
|
import { checkReference } from "./references.js";
|
|
8
8
|
import {
|
|
@@ -68,7 +68,10 @@ async function checkMain(config, env, { fetchImpl, timeoutMs, wake }) {
|
|
|
68
68
|
projects = Array.isArray(listed?.data) ? listed.data : [];
|
|
69
69
|
} catch (error) {
|
|
70
70
|
if (error instanceof McpError && error.kind === "unauthorized") {
|
|
71
|
-
return {
|
|
71
|
+
return {
|
|
72
|
+
code: 1,
|
|
73
|
+
message: `token rejected (expired or revoked); log in again: ${LOGIN_COMMAND}, or ${tokenFix(config)}`,
|
|
74
|
+
};
|
|
72
75
|
}
|
|
73
76
|
return {
|
|
74
77
|
code: 1,
|
package/kit/cboard-kit/mcp.js
CHANGED
|
@@ -67,7 +67,10 @@ export async function mcpCall({
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
/** Logs in again when the token is missing, expired or revoked. */
|
|
71
|
+
export const LOGIN_COMMAND = "npx @codyn06/cboard@latest connect";
|
|
72
|
+
/** Replaces a token that still works (connect alone keeps it). */
|
|
73
|
+
export const RENEW_COMMAND = `${LOGIN_COMMAND} --renew`;
|
|
71
74
|
const NEAR_EXPIRY_DAYS = 14;
|
|
72
75
|
|
|
73
76
|
/** The token's own view of itself (`whoami`); null on an older server, a network error or junk. */
|