8546748759
Dependencies
- Security: body-parser and multer DoS advisories fixed (npm audit: 0).
- Server: Express 5 (query parser kept "extended", req.body defaults to {},
SPA catch-all /{*splat}, send-file helper restores Express 4's dot-folder
rule for sendFile/download, alerts ack route without inline regex),
better-sqlite3 13, js-yaml 5 (server/lib/yaml.js keeps js-yaml 4's default
schema), uuid dropped for crypto.randomUUID, node-pty beta.18, multer 2.5.
- Client: React 19, xterm 6 (WebGL renderer replaces the removed canvas one,
DOM fallback on context loss; Alt+arrow word moves re-mapped), lucide-react 1,
TypeScript 7, i18next/react-i18next/codemirror minors.
Workspace rename step 4
- `agenthub lanes` and `--lane` exit 1 with "renamed: use …"; client api.ts,
the CLI and the MCP server call /api/workspaces; /api/lanes stays mounted.
Server mode (S3): members manage their own Claude Code config
- server/lib/cc-target.js resolves whose config a /cc-config request touches
and gates the router by allowlist; /profiles* and /plugins/update-all stay
admin-only. Member writes go through write-as, CLI calls through sudo as the
member (never -y), reads through openSafe; cc_config_changed reaches only
its owner. Not verified live on an S3 install yet.
Other
- Chat: an HTML file is an artifact only when written whole and not a project
page (index.html, or under src/, public/, templates/, …).
- OpenAPI covers every /api route; openapi-coverage.test.js guards it.
- read-pool test keeps its event loop alive (its worker is unref'd).
- Docs: plan statuses, checklists, CLI.md, LANES.md, SERVER-MODE.md, API.md.
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
/**
|
|
* @file Pins where a workspace git call goes: the workspace's own routes, or —
|
|
* for a session's worktree target — the same routes with `?session=`, which
|
|
* the server resolves to that session's worktree.
|
|
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
|
*/
|
|
|
|
import { describe, it, expect, vi, afterEach } from "vitest";
|
|
import { api, gitTarget } from "../api";
|
|
|
|
afterEach(() => {
|
|
vi.unstubAllGlobals();
|
|
});
|
|
|
|
function stubFetch() {
|
|
const spy = vi.fn().mockResolvedValue({
|
|
ok: true,
|
|
status: 200,
|
|
headers: { get: () => "application/json" },
|
|
json: async () => ({}),
|
|
});
|
|
vi.stubGlobal("fetch", spy);
|
|
return spy;
|
|
}
|
|
|
|
describe("git targets", () => {
|
|
it("adds session= for a worktree target and nothing for the workspace", async () => {
|
|
const spy = stubFetch();
|
|
await api.lanes.changes(3, { range: "work" });
|
|
await api.lanes.changes(gitTarget(3, "s-1"), { range: "work" });
|
|
await api.lanes.gitAction(gitTarget(3, "s-1"), "stage", { paths: ["a"] });
|
|
await api.lanes.git(gitTarget(3, null));
|
|
const urls = spy.mock.calls.map((c) => String(c[0]));
|
|
expect(urls[0]).toMatch(/\/workspaces\/3\/git\/changes\?range=work$/);
|
|
expect(urls[1]).toMatch(/\/workspaces\/3\/git\/changes\?range=work&session=s-1$/);
|
|
expect(urls[2]).toMatch(/\/workspaces\/3\/git\/stage\?session=s-1$/);
|
|
expect(urls[3]).toMatch(/\/workspaces\/3\/git$/);
|
|
});
|
|
});
|