@futuvara/connect 0.3.1 → 0.3.2
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 +6 -1
- package/bin/connect.js +39 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,12 @@ What it does, in order:
|
|
|
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
47
|
|
|
48
|
-
|
|
48
|
+
**Staying current.** Each install writes the live version to `<skills dir>/.futuvara-version`.
|
|
49
|
+
A re-run reads the live version with one `list_skills` call: when the marker matches and verify
|
|
50
|
+
passes it prints `[ ok ] skills up to date (vX)` and finishes in seconds — no download, no restart;
|
|
51
|
+
when the platform has a newer version it reinstalls and says "Updated the skills to vX". Agents run
|
|
52
|
+
`npx -y @futuvara/connect@latest …` at the start of every build pack, so every machine stays current.
|
|
53
|
+
`--check` on an older install reports `[FAIL] skills out of date` and writes nothing.
|
|
49
54
|
|
|
50
55
|
**Is this machine set up?** Add `--check`: preflight + verify only, nothing installed, exit 0 or 1.
|
|
51
56
|
|
package/bin/connect.js
CHANGED
|
@@ -38,7 +38,8 @@ FUTUVARA_KEY_<PROJECT>, and futu-setup applies the project config. Run it once p
|
|
|
38
38
|
--no-config skip "futu-setup.sh apply" (ESLint futu rules, .futu/, .github/workflows/futu.yml,
|
|
39
39
|
the AGENTS.md rules block, docs/ skeleton, the end-of-turn check)
|
|
40
40
|
--check install nothing: run the preflight and verify that the skills, the end-of-turn
|
|
41
|
-
check and this repository's MCP connection are in place
|
|
41
|
+
check and this repository's MCP connection are in place and the skills are the live
|
|
42
|
+
version ("is this machine set up and current?")
|
|
42
43
|
|
|
43
44
|
The key: export FUTUVARA_KEY_<PROJECT>=<key from Futuvara > Coding agent access>, in your shell
|
|
44
45
|
profile so your agent sees it too. Plain FUTUVARA_KEY alone fails: the agent's config reads the
|
|
@@ -53,7 +54,9 @@ Children never read stdin and are time-limited, so it runs unattended (CI, agent
|
|
|
53
54
|
codex prints a config.toml snippet (bearer_token_env_var = "FUTUVARA_KEY_<PROJECT>"); skills in ~/.agents/skills
|
|
54
55
|
copilot prints the repo-settings JSON and the secret to add; skills in ~/.agents/skills
|
|
55
56
|
|
|
56
|
-
Re-running changes nothing that is already current
|
|
57
|
+
Re-running changes nothing that is already current: when the installed skills (<skills dir>/.futuvara-version)
|
|
58
|
+
match the live version and verify passes, it skips the download and finishes in seconds — run it
|
|
59
|
+
at the start of every pack (npx -y @futuvara/connect@latest …); restart only when it says it updated.`;
|
|
57
60
|
|
|
58
61
|
/** @param {string[]} argv @returns {{project: string, agent: string, scope: "project" | "user", url: string, config: boolean, check: boolean, help: boolean}} */
|
|
59
62
|
export function parseArgs(argv) {
|
|
@@ -144,9 +147,9 @@ export async function callTool(mcpUrl, key, name, args = {}, fetchImpl = fetch)
|
|
|
144
147
|
return JSON.parse(text);
|
|
145
148
|
}
|
|
146
149
|
|
|
147
|
-
/** Every skill, every file: `list_skills
|
|
148
|
-
export async function fetchSkills(mcpUrl, key, fetchImpl = fetch) {
|
|
149
|
-
|
|
150
|
+
/** Every skill, every file: `list_skills` (unless already fetched), then `get_skill` for each. */
|
|
151
|
+
export async function fetchSkills(mcpUrl, key, fetchImpl = fetch, list = null) {
|
|
152
|
+
list ??= await callTool(mcpUrl, key, "list_skills", {}, fetchImpl);
|
|
150
153
|
const skills = [];
|
|
151
154
|
for (const s of list) skills.push(await callTool(mcpUrl, key, "get_skill", { name: s.name }, fetchImpl));
|
|
152
155
|
return skills;
|
|
@@ -414,15 +417,25 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
414
417
|
const variable = keyVar(opts.project);
|
|
415
418
|
const repo = gitRoot();
|
|
416
419
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
420
|
+
// One request: proves the key is accepted, says which skills should be present and the live version.
|
|
421
|
+
const list = await callTool(mcpUrl, key, "list_skills");
|
|
422
|
+
const names = list.map((s) => s.name);
|
|
423
|
+
const live = list[0]?.version ?? "";
|
|
424
|
+
const marker = versionMarker(opts);
|
|
425
|
+
const installed = existsSync(marker) ? readFileSync(marker, "utf8").trim() : "";
|
|
426
|
+
const fresh = live
|
|
427
|
+
? installed === live
|
|
428
|
+
? { status: "ok", label: `skills up to date (v${live})` }
|
|
429
|
+
: { status: "fail", label: `skills out of date (installed v${installed || "?"}, live v${live}) — run without --check` }
|
|
430
|
+
: null;
|
|
431
|
+
let checks = verify(opts, names, { repo });
|
|
432
|
+
// Current and in place: nothing to download, nothing to restart.
|
|
433
|
+
const current = fresh?.status === "ok" && checks.every((c) => c.status !== "fail");
|
|
434
|
+
|
|
435
|
+
if (!opts.check && !current) {
|
|
422
436
|
console.log("\nInstalling");
|
|
423
437
|
// Fetch first: a refused key or an unreachable server fails before anything is written.
|
|
424
|
-
const skills = await fetchSkills(mcpUrl, key);
|
|
425
|
-
names = skills.map((s) => s.name);
|
|
438
|
+
const skills = await fetchSkills(mcpUrl, key, fetch, list);
|
|
426
439
|
removeUserServer();
|
|
427
440
|
if (repo) configureMcp(opts.agent, mcpUrl, repo, variable);
|
|
428
441
|
// A fixed folder, not a fresh temp one: npx skills records it in skills-lock.json, so a re-run leaves the lock unchanged.
|
|
@@ -436,9 +449,13 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
436
449
|
console.log(`Installed ${skills.length} Futuvara skills (v${skills[0]?.version ?? "?"}) into ${base}/skills.`);
|
|
437
450
|
if (!opts.config) console.log("Project config skipped (--no-config).");
|
|
438
451
|
else applyConfig(base, root, opts.scope);
|
|
452
|
+
if (live) put(marker, Buffer.from(`${live}\n`));
|
|
453
|
+
checks = verify(opts, names, { repo });
|
|
454
|
+
} else if (fresh && (opts.check || current)) {
|
|
455
|
+
checks = [fresh, ...checks];
|
|
439
456
|
}
|
|
440
457
|
|
|
441
|
-
if (!report("Verify",
|
|
458
|
+
if (!report("Verify", checks)) {
|
|
442
459
|
console.log("\nNot complete — fix the [FAIL] lines above, then run this again.");
|
|
443
460
|
return 1;
|
|
444
461
|
}
|
|
@@ -447,14 +464,21 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
447
464
|
? `\n${repo} is connected to Futuvara project ${opts.project}; your agent reads ${variable}.`
|
|
448
465
|
: `\nNot inside a git repository: skills and the end-of-turn check only — run again inside the project's repo to connect it.`,
|
|
449
466
|
);
|
|
467
|
+
if (opts.check || current) return console.log("Done. Nothing was updated — no restart needed."), 0;
|
|
450
468
|
console.log(
|
|
451
469
|
opts.scope === "user"
|
|
452
|
-
?
|
|
453
|
-
:
|
|
470
|
+
? `Done. Updated the skills to v${live || "?"}. Restart your coding agent — every project and worktree on this machine now has the skills.`
|
|
471
|
+
: `Done. Updated the skills to v${live || "?"}. Restart your coding agent — this project now has the skills.`,
|
|
454
472
|
);
|
|
455
473
|
return 0;
|
|
456
474
|
}
|
|
457
475
|
|
|
476
|
+
/** `<skills dir>/.futuvara-version`: the version connect last installed there, so a current run skips the download. */
|
|
477
|
+
export const versionMarker = (opts, home = homedir(), cwd = process.cwd()) => {
|
|
478
|
+
const base = skillsBase(opts.agent, opts.scope, home);
|
|
479
|
+
return join(opts.scope === "user" ? base : join(cwd, base), "skills", ".futuvara-version");
|
|
480
|
+
};
|
|
481
|
+
|
|
458
482
|
/**
|
|
459
483
|
* `futu-setup.sh apply` from the installed copy: ESLint futu rules, .futu/, the CI job, the AGENTS.md block,
|
|
460
484
|
* the end-of-turn check. Idempotent. User scope (FUTU_SETUP_SCOPE=user): the check goes into
|
package/package.json
CHANGED