@futuvara/connect 0.3.2 → 0.3.3
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/README.md +3 -0
- package/bin/connect.js +74 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,9 @@ What it does, in order:
|
|
|
44
44
|
4. **Verify** — every skill the server lists is where it was installed, the end-of-turn check is in
|
|
45
45
|
the settings it was written to (Claude Code), the repository's `futuvara` entry reads the
|
|
46
46
|
project's variable, and that variable is set. A `[FAIL]` exits 1 with the exact fix.
|
|
47
|
+
5. **Jean** — when the Jean desktop app is installed, every run (not only installs) makes sure
|
|
48
|
+
`claude:futuvara` (or `codex:` / `cursor:`) is in Jean's default MCP servers: Jean hands each
|
|
49
|
+
session its own server list and ignores `.mcp.json`. `--check` only reports it.
|
|
47
50
|
|
|
48
51
|
**Staying current.** Each install writes the live version to `<skills dir>/.futuvara-version`.
|
|
49
52
|
A re-run reads the live version with one `list_skills` call: when the marker matches and verify
|
package/bin/connect.js
CHANGED
|
@@ -49,6 +49,9 @@ Python 3 for the project config, gh (warning only), the key. Any [FAIL] exits 1.
|
|
|
49
49
|
a verify step checks what landed and exits 1 with the fix when something is missing.
|
|
50
50
|
Children never read stdin and are time-limited, so it runs unattended (CI, agents, scripts).
|
|
51
51
|
|
|
52
|
+
No futuvara tools in your session? Send each call directly instead — same tools, same arguments:
|
|
53
|
+
npx -y @futuvara/connect@latest call report_progress '{"pack":"BP-050","task":"…"}' --project <Project>
|
|
54
|
+
|
|
52
55
|
claude-code merges .mcp.json (Authorization: Bearer \${FUTUVARA_KEY_<PROJECT>}); skills in ~/.claude/skills
|
|
53
56
|
cursor merges .cursor/mcp.json (Authorization: Bearer \${env:FUTUVARA_KEY_<PROJECT>}); skills in ~/.agents/skills
|
|
54
57
|
codex prints a config.toml snippet (bearer_token_env_var = "FUTUVARA_KEY_<PROJECT>"); skills in ~/.agents/skills
|
|
@@ -144,7 +147,11 @@ export async function callTool(mcpUrl, key, name, args = {}, fetchImpl = fetch)
|
|
|
144
147
|
if (msg.error) throw new Error(`Futuvara MCP server error: ${msg.error.message}`);
|
|
145
148
|
const text = msg.result?.content?.[0]?.text ?? "";
|
|
146
149
|
if (msg.result?.isError) throw new Error(`Futuvara ${name}: ${text}`);
|
|
147
|
-
|
|
150
|
+
try {
|
|
151
|
+
return JSON.parse(text);
|
|
152
|
+
} catch {
|
|
153
|
+
return text; // a tool that answers in prose (report_progress, ask_question)
|
|
154
|
+
}
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
/** Every skill, every file: `list_skills` (unless already fetched), then `get_skill` for each. */
|
|
@@ -297,6 +304,39 @@ export function removeUserServer(home = homedir()) {
|
|
|
297
304
|
}
|
|
298
305
|
}
|
|
299
306
|
|
|
307
|
+
// Jean (desktop app that runs agent sessions per worktree) hands each session its own MCP server list and
|
|
308
|
+
// ignores the repository's .mcp.json; sessions it starts from an issue get only its default list.
|
|
309
|
+
const JEAN_BACKEND = { "claude-code": "claude", codex: "codex", cursor: "cursor" };
|
|
310
|
+
export const jeanPrefsPaths = (home = homedir(), env = process.env) => [
|
|
311
|
+
join(env.APPDATA ?? join(home, "AppData", "Roaming"), "com.jean.desktop", "preferences.json"),
|
|
312
|
+
join(home, "Library", "Application Support", "com.jean.desktop", "preferences.json"),
|
|
313
|
+
join(env.XDG_DATA_HOME ?? join(home, ".local", "share"), "com.jean.desktop", "preferences.json"),
|
|
314
|
+
join(env.XDG_CONFIG_HOME ?? join(home, ".config"), "com.jean.desktop", "preferences.json"),
|
|
315
|
+
];
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Put "<backend>:futuvara" in Jean's default MCP servers, so every session Jean starts gets the Futuvara tools.
|
|
319
|
+
* @returns {{status: "ok" | "fail", label: string, fix?: string} | null} null when Jean is not installed
|
|
320
|
+
*/
|
|
321
|
+
export function ensureJeanDefault(agent, { write = true, paths = jeanPrefsPaths() } = {}) {
|
|
322
|
+
const backend = JEAN_BACKEND[agent];
|
|
323
|
+
const path = backend && paths.find((p) => existsSync(p));
|
|
324
|
+
if (!path) return null;
|
|
325
|
+
const id = `${backend}:${SERVER_NAME}`;
|
|
326
|
+
let prefs;
|
|
327
|
+
try {
|
|
328
|
+
prefs = JSON.parse(readFileSync(path, "utf8"));
|
|
329
|
+
} catch {
|
|
330
|
+
return { status: "fail", label: `Jean preferences unreadable (${path})`, fix: `add ${id} to Jean > Settings > MCP servers` };
|
|
331
|
+
}
|
|
332
|
+
const lists = ["default_enabled_mcp_servers", "known_mcp_servers"];
|
|
333
|
+
if (lists.every((k) => prefs[k]?.includes(id))) return { status: "ok", label: `Jean starts every session with ${id}` };
|
|
334
|
+
if (!write) return { status: "fail", label: `Jean's default MCP servers lack ${id} — sessions it starts have no Futuvara tools`, fix: "run without --check" };
|
|
335
|
+
for (const k of lists) prefs[k] = [...new Set([...(prefs[k] ?? []), id])];
|
|
336
|
+
writeFileSync(path, JSON.stringify(prefs, null, 2));
|
|
337
|
+
return { status: "ok", label: `Added ${id} to Jean's default MCP servers (${path}) — restart Jean if it is open` };
|
|
338
|
+
}
|
|
339
|
+
|
|
300
340
|
/** The key: the project's variable, else plain FUTUVARA_KEY (backwards compatible). */
|
|
301
341
|
export function readKey(project, env = process.env) {
|
|
302
342
|
const variable = keyVar(project);
|
|
@@ -397,8 +437,37 @@ export function report(title, checks) {
|
|
|
397
437
|
return checks.every((c) => c.status !== "fail");
|
|
398
438
|
}
|
|
399
439
|
|
|
440
|
+
export const CALL_USAGE = `Usage: npx -y @futuvara/connect@latest call <tool> '<JSON arguments>' --project <Project> [--url ${DEFAULT_URL}]`;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* `call <tool> '<json>' --project P`: one Futuvara tool call straight over HTTP, for a session that was started
|
|
444
|
+
* without the futuvara MCP tools (a desktop app that picks its own server list, an unapproved .mcp.json).
|
|
445
|
+
* Prints the tool's answer; exits 1 with the reason when it was not delivered.
|
|
446
|
+
*/
|
|
447
|
+
export async function callMain(argv, env = process.env, fetchImpl = fetch) {
|
|
448
|
+
const { values, positionals } = nodeParseArgs({
|
|
449
|
+
args: argv,
|
|
450
|
+
allowPositionals: true,
|
|
451
|
+
options: { project: { type: "string" }, url: { type: "string", default: DEFAULT_URL } },
|
|
452
|
+
});
|
|
453
|
+
const [tool, json = "{}"] = positionals;
|
|
454
|
+
if (!tool || !values.project) throw new Error(CALL_USAGE);
|
|
455
|
+
let args;
|
|
456
|
+
try {
|
|
457
|
+
args = JSON.parse(json);
|
|
458
|
+
} catch {
|
|
459
|
+
throw new Error(`The arguments are not JSON: ${json}\n${CALL_USAGE}`);
|
|
460
|
+
}
|
|
461
|
+
const { key, from } = readKey(values.project, env);
|
|
462
|
+
if (!from) throw new Error(`${keyVar(values.project)} is not set, so nothing was sent. ${exportLine(keyVar(values.project))}`);
|
|
463
|
+
const answer = await callTool(`${values.url.replace(/\/+$/, "")}/api/connect/mcp`, key, tool, args, fetchImpl);
|
|
464
|
+
console.log(typeof answer === "string" ? answer : JSON.stringify(answer, null, 2));
|
|
465
|
+
return 0;
|
|
466
|
+
}
|
|
467
|
+
|
|
400
468
|
/** @returns {Promise<number>} the exit code */
|
|
401
469
|
export async function main(argv = process.argv.slice(2)) {
|
|
470
|
+
if (argv[0] === "call") return callMain(argv.slice(1));
|
|
402
471
|
let opts;
|
|
403
472
|
try {
|
|
404
473
|
opts = parseArgs(argv);
|
|
@@ -455,6 +524,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
455
524
|
checks = [fresh, ...checks];
|
|
456
525
|
}
|
|
457
526
|
|
|
527
|
+
// Every run, not only installs: a machine current on skills can still have Jean without the server.
|
|
528
|
+
const jean = ensureJeanDefault(opts.agent, { write: !opts.check });
|
|
529
|
+
if (jean) checks = [...checks, jean];
|
|
530
|
+
|
|
458
531
|
if (!report("Verify", checks)) {
|
|
459
532
|
console.log("\nNot complete — fix the [FAIL] lines above, then run this again.");
|
|
460
533
|
return 1;
|
package/package.json
CHANGED