mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-19 22:01:39 +00:00
- Copy all pi-mono source into apps/companion-os/ - Update Dockerfile to COPY pre-built binary instead of downloading from GitHub Releases - Update deploy-staging.yml to build pi from source (bun compile) before Docker build - Add apps/companion-os/** to path triggers - No more cross-repo dispatch needed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import fs from "node:fs";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
|
|
export const PI_DIR = path.join(os.homedir(), ".pi");
|
|
export const TEAMS_DIR = path.join(PI_DIR, "teams");
|
|
export const TASKS_DIR = path.join(PI_DIR, "tasks");
|
|
|
|
export function ensureDirs() {
|
|
if (!fs.existsSync(PI_DIR)) fs.mkdirSync(PI_DIR);
|
|
if (!fs.existsSync(TEAMS_DIR)) fs.mkdirSync(TEAMS_DIR);
|
|
if (!fs.existsSync(TASKS_DIR)) fs.mkdirSync(TASKS_DIR);
|
|
}
|
|
|
|
export function sanitizeName(name: string): string {
|
|
// Allow only alphanumeric characters, hyphens, and underscores.
|
|
if (/[^a-zA-Z0-9_-]/.test(name)) {
|
|
throw new Error(
|
|
`Invalid name: "${name}". Only alphanumeric characters, hyphens, and underscores are allowed.`,
|
|
);
|
|
}
|
|
return name;
|
|
}
|
|
|
|
export function teamDir(teamName: string) {
|
|
return path.join(TEAMS_DIR, sanitizeName(teamName));
|
|
}
|
|
|
|
export function taskDir(teamName: string) {
|
|
return path.join(TASKS_DIR, sanitizeName(teamName));
|
|
}
|
|
|
|
export function inboxPath(teamName: string, agentName: string) {
|
|
return path.join(
|
|
teamDir(teamName),
|
|
"inboxes",
|
|
`${sanitizeName(agentName)}.json`,
|
|
);
|
|
}
|
|
|
|
export function configPath(teamName: string) {
|
|
return path.join(teamDir(teamName), "config.json");
|
|
}
|