nomadcode/src/api/projects.ts

88 lines
3 KiB
TypeScript

export type ProjectStatus = "ready" | "active" | "paused" | "archived";
export interface Project {
id: string;
name: string;
description: string;
workspacePath: string;
codeServerUrl: string;
repoUrl: string;
planeProject: string;
outlineDoc: string;
defaultAgent: string;
status: ProjectStatus;
lastOpenedAt: string;
}
export const mockProjects: Project[] = [
{
id: "nomadcode-web",
name: "nomadcode-web",
description: "React web frontend for NomadCode Server.",
workspacePath: "/config/workspace/nomadcode-web",
codeServerUrl: "http://localhost:8081/?folder=/config/workspace/nomadcode-web",
repoUrl: "https://github.com/nomadcode/nomadcode-web",
planeProject: "NC-WEB",
outlineDoc: "NomadCode Web UI",
defaultAgent: "codex-local",
status: "active",
lastOpenedAt: "2026-05-21T00:00:00Z",
},
{
id: "nomadcode-core",
name: "nomadcode-core",
description: "Go server for task APIs, workflow state, and async agent jobs.",
workspacePath: "/config/workspace/nomadcode-core",
codeServerUrl: "http://localhost:8081/?folder=/config/workspace/nomadcode-core",
repoUrl: "https://github.com/nomadcode/nomadcode-core",
planeProject: "NC-CORE",
outlineDoc: "NomadCode Core Server",
defaultAgent: "codex-local",
status: "ready",
lastOpenedAt: "2026-05-20T14:30:00Z",
},
{
id: "iop",
name: "iop",
description: "Inference Operations Platform skeleton for edge, node, and control plane flows.",
workspacePath: "/config/workspace/iop",
codeServerUrl: "http://localhost:8081/?folder=/config/workspace/iop",
repoUrl: "https://github.com/nomadcode/iop",
planeProject: "IOP",
outlineDoc: "IOP Control Plane",
defaultAgent: "codex-local",
status: "ready",
lastOpenedAt: "2026-05-19T09:10:00Z",
},
{
id: "proto-socket",
name: "proto-socket",
description: "Protocol buffer socket library with TypeScript, Go, Dart, Kotlin, and Python implementations.",
workspacePath: "/config/workspace/proto-socket",
codeServerUrl: "http://localhost:8081/?folder=/config/workspace/proto-socket",
repoUrl: "https://github.com/nomadcode/proto-socket",
planeProject: "PROTO",
outlineDoc: "Proto Socket Wire Protocol",
defaultAgent: "codex-local",
status: "paused",
lastOpenedAt: "2026-05-18T16:45:00Z",
},
];
export async function listProjectsPlaceholder(): Promise<Project[]> {
return mockProjects;
}
export function openWorkspacePlaceholder(project: Project): void {
console.log("[projects] open workspace placeholder", project.workspacePath);
window.open(project.codeServerUrl, "_blank", "noopener,noreferrer");
}
export function openCodeServerPlaceholder(project: Project): void {
console.log("[projects] open code-server placeholder", project.codeServerUrl);
window.open(project.codeServerUrl, "_blank", "noopener,noreferrer");
}
export function viewRecentJobsPlaceholder(project: Project): void {
console.log("[projects] view recent jobs placeholder", project.id);
}