6c605849d8
- /api/workspaces and `agenthub workspace(s)` / `--workspace` as aliases of /api/lanes and `agenthub lanes` / `--lane`; old names print one stderr note. REPL `help lanes|workspace|workspaces` resolves through the aliases. - A workspace holds up to ten sessions (slots 0-9); every console tab is a group of 1-4 split panes (PaneGroups, agenthub.workspace.paneLayout); parseGroups keeps the stored active tab when an earlier one is dropped. - Browse button beside path fields: POST /api/lanes/pick-path opens the OS picker on the server's desktop — loopback only and no forwarding header (EREMOTE), a display failure is ENODIALOG not a Cancel, the dialog is killed when the request closes, a folder field falls back to the in-app browser on any failure. - Changes rail counts chip, image viewer (/git/raw), status bar session counts and per-day cost (`date=` on /api/pricing/cost). - /agenthub-open and /agenthub-doctor run from the INSTALLED build (supersededBy), doctor offers fixes behind two confirmations; plugin-open treats a locked bootstrap as non-fatal. - New-terminal shell waits for the first attach (issue #55). - repo-onboarding / debug-live-issue skills removed. - OpenAPI: pick-path, lane/date on /pricing/cost, tool on /run/history, /api/workspaces mount.
74 lines
2.7 KiB
JavaScript
74 lines
2.7 KiB
JavaScript
/**
|
|
* @file Tests the `tmux` row of scripts/plugin-doctor.js — the check that tells
|
|
* an install its browser run console cannot work, because every run the
|
|
* dashboard starts is a tmux session (server/lib/tmux.js). The row must WARN
|
|
* and never FAIL: sessions, analytics, lanes and the CLI all work without the
|
|
* binary, so failing a doctor run over it would cry wolf. A tmux older than 3.7
|
|
* (no pane scrollbars) also warns, as does a new binary still talking to an
|
|
* older running server. tmux is faked through the module's own exec seam, so
|
|
* the test never depends on the host having it.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
const { describe, it, after } = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const fs = require("node:fs");
|
|
const os = require("node:os");
|
|
const path = require("node:path");
|
|
|
|
const TMP_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "agenthub-doctor-tmux-"));
|
|
process.env.CLAUDE_HOME = TMP_HOME;
|
|
|
|
const tmux = require("../lib/tmux");
|
|
const { diagnose } = require("../../scripts/plugin-doctor");
|
|
|
|
after(() => {
|
|
tmux.__reset();
|
|
fs.rmSync(TMP_HOME, { recursive: true, force: true });
|
|
delete process.env.CLAUDE_HOME;
|
|
});
|
|
|
|
/** Fake the tmux binary (null = absent) and its running server (null = none),
|
|
* then read back the row. */
|
|
function rowWithTmux(client, server = null) {
|
|
tmux.__setExecImpl((args) => {
|
|
if (!client) throw new Error("spawnSync tmux ENOENT");
|
|
if (args[0] === "-V") return `tmux ${client}\n`;
|
|
if (!server) throw new Error("no server running");
|
|
return `${server}\n`;
|
|
});
|
|
const row = diagnose().find((r) => r.label === "tmux");
|
|
assert.ok(row, "the doctor must always emit a tmux row");
|
|
return row;
|
|
}
|
|
|
|
describe("plugin-doctor: tmux row", () => {
|
|
it("warns, never fails, when tmux is not on PATH", () => {
|
|
const row = rowWithTmux(null);
|
|
|
|
assert.equal(row.level, "warn", "a missing tmux must not fail the doctor run");
|
|
assert.match(row.detail, /workspace shell/, "the reader needs to know WHAT breaks");
|
|
assert.match(row.detail, /install/i, "and how to fix it");
|
|
});
|
|
|
|
it("passes when tmux has pane scrollbars (3.7+)", () => {
|
|
assert.equal(rowWithTmux("3.7c").level, "ok");
|
|
assert.equal(rowWithTmux("next-3.8", "3.8-rc3").level, "ok");
|
|
});
|
|
|
|
it("warns, with the upgrade path, when tmux is older than 3.7", () => {
|
|
const row = rowWithTmux("3.4", "3.4");
|
|
|
|
assert.equal(row.level, "warn");
|
|
assert.match(row.detail, /3\.7/);
|
|
assert.match(row.detail, /brew upgrade tmux/);
|
|
});
|
|
|
|
it("warns when a new tmux is still talking to an older running server", () => {
|
|
const row = rowWithTmux("3.7c", "3.4");
|
|
|
|
assert.equal(row.level, "warn");
|
|
assert.match(row.detail, /server is 3\.4/);
|
|
});
|
|
});
|