- 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>
134 lines
5.3 KiB
JavaScript
134 lines
5.3 KiB
JavaScript
import { readFileSync, readdirSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
|
|
function parseFrontmatter(text) {
|
|
const match = text.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
if (!match) return {};
|
|
|
|
const frontmatter = {};
|
|
for (const line of match[1].split("\n")) {
|
|
const separator = line.indexOf(":");
|
|
if (separator === -1) continue;
|
|
const key = line.slice(0, separator).trim();
|
|
const value = line.slice(separator + 1).trim();
|
|
if (!key) continue;
|
|
frontmatter[key] = value;
|
|
}
|
|
return frontmatter;
|
|
}
|
|
|
|
export function readPromptSpecs(appRoot) {
|
|
const dir = resolve(appRoot, "prompts");
|
|
return readdirSync(dir)
|
|
.filter((f) => f.endsWith(".md"))
|
|
.map((f) => {
|
|
const text = readFileSync(resolve(dir, f), "utf8");
|
|
const fm = parseFrontmatter(text);
|
|
return {
|
|
name: f.replace(/\.md$/, ""),
|
|
description: fm.description ?? "",
|
|
args: fm.args ?? "",
|
|
section: fm.section ?? "Research Workflows",
|
|
topLevelCli: fm.topLevelCli === "true",
|
|
};
|
|
});
|
|
}
|
|
|
|
export const extensionCommandSpecs = [
|
|
{ name: "help", args: "", section: "Project & Session", description: "Show grouped Feynman commands and prefill the editor with a selected command.", publicDocs: true },
|
|
{ name: "init", args: "", section: "Project & Session", description: "Bootstrap AGENTS.md and session-log folders for a research project.", publicDocs: true },
|
|
{ name: "alpha-login", args: "", section: "Setup", description: "Sign in to alphaXiv from inside Feynman.", publicDocs: true },
|
|
{ name: "alpha-status", args: "", section: "Setup", description: "Show alphaXiv authentication status.", publicDocs: true },
|
|
{ name: "alpha-logout", args: "", section: "Setup", description: "Clear alphaXiv auth from inside Feynman.", publicDocs: true },
|
|
];
|
|
|
|
export const livePackageCommandGroups = [
|
|
{
|
|
title: "Agents & Delegation",
|
|
commands: [
|
|
{ name: "agents", usage: "/agents" },
|
|
{ name: "run", usage: "/run <agent> <task>" },
|
|
{ name: "chain", usage: "/chain agent1 -> agent2" },
|
|
{ name: "parallel", usage: "/parallel agent1 -> agent2" },
|
|
],
|
|
},
|
|
{
|
|
title: "Bundled Package Commands",
|
|
commands: [
|
|
{ name: "ps", usage: "/ps" },
|
|
{ name: "schedule-prompt", usage: "/schedule-prompt" },
|
|
{ name: "search", usage: "/search" },
|
|
{ name: "preview", usage: "/preview" },
|
|
{ name: "new", usage: "/new" },
|
|
{ name: "quit", usage: "/quit" },
|
|
{ name: "exit", usage: "/exit" },
|
|
],
|
|
},
|
|
];
|
|
|
|
export const cliCommandSections = [
|
|
{
|
|
title: "Core",
|
|
commands: [
|
|
{ usage: "feynman", description: "Launch the interactive REPL." },
|
|
{ usage: "feynman chat [prompt]", description: "Start chat explicitly, optionally with an initial prompt." },
|
|
{ usage: "feynman help", description: "Show CLI help." },
|
|
{ usage: "feynman setup", description: "Run the guided setup wizard." },
|
|
{ usage: "feynman doctor", description: "Diagnose config, auth, Pi runtime, and preview dependencies." },
|
|
{ usage: "feynman status", description: "Show the current setup summary." },
|
|
],
|
|
},
|
|
{
|
|
title: "Model Management",
|
|
commands: [
|
|
{ usage: "feynman model list", description: "List available models in Pi auth storage." },
|
|
{ usage: "feynman model login [id]", description: "Login to a Pi OAuth model provider." },
|
|
{ usage: "feynman model logout [id]", description: "Logout from a Pi OAuth model provider." },
|
|
{ usage: "feynman model set <provider/model>", description: "Set the default model." },
|
|
],
|
|
},
|
|
{
|
|
title: "AlphaXiv",
|
|
commands: [
|
|
{ usage: "feynman alpha login", description: "Sign in to alphaXiv." },
|
|
{ usage: "feynman alpha logout", description: "Clear alphaXiv auth." },
|
|
{ usage: "feynman alpha status", description: "Check alphaXiv auth status." },
|
|
],
|
|
},
|
|
{
|
|
title: "Utilities",
|
|
commands: [
|
|
{ usage: "feynman search status", description: "Show Pi web-access status and config path." },
|
|
{ usage: "feynman update [package]", description: "Update installed packages, or a specific package." },
|
|
],
|
|
},
|
|
];
|
|
|
|
export const legacyFlags = [
|
|
{ usage: '--prompt "<text>"', description: "Run one prompt and exit." },
|
|
{ usage: "--alpha-login", description: "Sign in to alphaXiv and exit." },
|
|
{ usage: "--alpha-logout", description: "Clear alphaXiv auth and exit." },
|
|
{ usage: "--alpha-status", description: "Show alphaXiv auth status and exit." },
|
|
{ usage: "--model <provider:model>", description: "Force a specific model." },
|
|
{ usage: "--thinking <level>", description: "Set thinking level: off | minimal | low | medium | high | xhigh." },
|
|
{ usage: "--cwd <path>", description: "Set the working directory for tools." },
|
|
{ usage: "--session-dir <path>", description: "Set the session storage directory." },
|
|
{ usage: "--new-session", description: "Start a new persisted session." },
|
|
{ usage: "--doctor", description: "Alias for `feynman doctor`." },
|
|
{ usage: "--setup-preview", description: "Alias for `feynman setup preview`." },
|
|
];
|
|
|
|
export const topLevelCommandNames = ["alpha", "chat", "doctor", "help", "model", "search", "setup", "status", "update"];
|
|
|
|
export function formatSlashUsage(command) {
|
|
return `/${command.name}${command.args ? ` ${command.args}` : ""}`;
|
|
}
|
|
|
|
export function formatCliWorkflowUsage(command) {
|
|
return `feynman ${command.name}${command.args ? ` ${command.args}` : ""}`;
|
|
}
|
|
|
|
export function getExtensionCommandSpec(name) {
|
|
return extensionCommandSpecs.find((command) => command.name === name);
|
|
}
|