Files
feynman/tests/bootstrap-sync.test.ts
Advait Paliwal f5570b4e5a Rename .pi to .feynman, rename citation agent to verifier, add website, skills, and docs
- Rename project config dir from .pi/ to .feynman/ (Pi supports this via piConfig.configDir)
- Rename citation agent to verifier across all prompts, agents, skills, and docs
- Add website with homepage and 24 doc pages (Astro + Tailwind)
- Add skills for all workflows (deep-research, lit, review, audit, replicate, compare, draft, autoresearch, watch, jobs, session-log, agentcomputer)
- Add Pi-native prompt frontmatter (args, section, topLevelCli) and read at runtime
- Remove sync-docs generation layer — docs are standalone
- Remove metadata/prompts.mjs and metadata/packages.mjs — not needed at runtime
- Rewrite README and homepage copy
- Add environment selection to /replicate before executing
- Add prompts/delegate.md and AGENTS.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 17:35:35 -07:00

52 lines
2.2 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { syncBundledAssets } from "../src/bootstrap/sync.js";
function createAppRoot(): string {
const appRoot = mkdtempSync(join(tmpdir(), "feynman-app-"));
mkdirSync(join(appRoot, ".feynman", "themes"), { recursive: true });
mkdirSync(join(appRoot, ".feynman", "agents"), { recursive: true });
writeFileSync(join(appRoot, ".feynman", "themes", "feynman.json"), '{"theme":"v1"}\n', "utf8");
writeFileSync(join(appRoot, ".feynman", "agents", "researcher.md"), "# v1\n", "utf8");
return appRoot;
}
test("syncBundledAssets copies missing bundled files", () => {
const appRoot = createAppRoot();
const home = mkdtempSync(join(tmpdir(), "feynman-home-"));
process.env.FEYNMAN_HOME = home;
const agentDir = join(home, "agent");
mkdirSync(agentDir, { recursive: true });
const result = syncBundledAssets(appRoot, agentDir);
assert.deepEqual(result.copied.sort(), ["feynman.json", "researcher.md"]);
assert.equal(readFileSync(join(agentDir, "themes", "feynman.json"), "utf8"), '{"theme":"v1"}\n');
assert.equal(readFileSync(join(agentDir, "agents", "researcher.md"), "utf8"), "# v1\n");
});
test("syncBundledAssets preserves user-modified files and updates managed files", () => {
const appRoot = createAppRoot();
const home = mkdtempSync(join(tmpdir(), "feynman-home-"));
process.env.FEYNMAN_HOME = home;
const agentDir = join(home, "agent");
mkdirSync(agentDir, { recursive: true });
syncBundledAssets(appRoot, agentDir);
writeFileSync(join(appRoot, ".feynman", "themes", "feynman.json"), '{"theme":"v2"}\n', "utf8");
writeFileSync(join(appRoot, ".feynman", "agents", "researcher.md"), "# v2\n", "utf8");
writeFileSync(join(agentDir, "agents", "researcher.md"), "# user-custom\n", "utf8");
const result = syncBundledAssets(appRoot, agentDir);
assert.deepEqual(result.updated, ["feynman.json"]);
assert.deepEqual(result.skipped, ["researcher.md"]);
assert.equal(readFileSync(join(agentDir, "themes", "feynman.json"), "utf8"), '{"theme":"v2"}\n');
assert.equal(readFileSync(join(agentDir, "agents", "researcher.md"), "utf8"), "# user-custom\n");
});