19420cc01d
- Asana REST API client for task polling, section management, and commenting - Pi CLI executor for running tasks with specialist agent teams - Task loop: polls Asana To Do/Pi Worker sections, executes tasks, reports results - Improvement loop: rotates through 8 improvement categories (code quality, security, docs, testing, etc) - Health server on :8787 - File-based mutex locks with stale lock detection - Docker + docker-compose deployment config - deploy.sh for one-command deployment to cr-server-new via SSH/Incus
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
// Pi Worker Configuration
|
|
// Loads and validates environment variables
|
|
|
|
export interface Config {
|
|
// Asana
|
|
asanaAccessToken: string;
|
|
asanaProjectGid: string;
|
|
asanaWorkspaceGid: string;
|
|
|
|
// Pi Agent
|
|
piBin: string;
|
|
piModel: string;
|
|
anthropicApiKey: string;
|
|
|
|
// Paths
|
|
targetProjectPath: string;
|
|
extensionsPath: string;
|
|
agentsPath: string;
|
|
logDir: string;
|
|
|
|
// Timing
|
|
pollIntervalSec: number;
|
|
improvementIntervalSec: number;
|
|
healthPort: number;
|
|
}
|
|
|
|
function requireEnv(key: string): string {
|
|
const value = process.env[key];
|
|
if (!value) {
|
|
throw new Error(`Missing required environment variable: ${key}`);
|
|
}
|
|
return value;
|
|
}
|
|
|
|
export function loadConfig(): Config {
|
|
return {
|
|
asanaAccessToken: requireEnv("ASANA_ACCESS_TOKEN"),
|
|
asanaProjectGid: process.env.ASANA_PROJECT_GID || "",
|
|
asanaWorkspaceGid: process.env.ASANA_WORKSPACE_GID || "",
|
|
|
|
piBin: process.env.PI_BIN || "pi",
|
|
piModel: process.env.PI_MODEL || "claude-sonnet-4-6",
|
|
anthropicApiKey: requireEnv("ANTHROPIC_API_KEY"),
|
|
|
|
targetProjectPath: process.env.TARGET_PROJECT_PATH || process.cwd(),
|
|
extensionsPath: process.env.EXTENSIONS_PATH || "../extensions",
|
|
agentsPath: process.env.AGENTS_PATH || "../.pi/agents",
|
|
logDir: process.env.LOG_DIR || "./logs",
|
|
|
|
pollIntervalSec: parseInt(process.env.POLL_INTERVAL_SEC || "120"),
|
|
improvementIntervalSec: parseInt(process.env.IMPROVEMENT_INTERVAL_SEC || "3600"),
|
|
healthPort: parseInt(process.env.HEALTH_PORT || "8787"),
|
|
};
|
|
}
|