chore: archive AgentDock v1 implementation
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import test from "node:test";
|
||||
import { listProjects, resolveWorkspacePath } from "./path-policy.js";
|
||||
|
||||
test("workspace policy accepts child directories and rejects traversal", async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "agentdock-workspace-"));
|
||||
await fs.mkdir(path.join(root, "demo"));
|
||||
assert.equal(await resolveWorkspacePath(root, "demo"), path.join(root, "demo"));
|
||||
await assert.rejects(() => resolveWorkspacePath(root, ".."));
|
||||
});
|
||||
|
||||
test("project listing hides dot directories", async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "agentdock-projects-"));
|
||||
await fs.mkdir(path.join(root, "zeta"));
|
||||
await fs.mkdir(path.join(root, "alpha"));
|
||||
await fs.mkdir(path.join(root, ".cache"));
|
||||
assert.deepEqual(await listProjects(root), ["alpha", "zeta"]);
|
||||
});
|
||||
Reference in New Issue
Block a user