UNPKG

@every-env/cli

Version:

Multi-agent orchestrator for AI-powered development workflows

38 lines 1.18 kB
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs'; import { join, dirname } from 'path'; const STATE_FILE = '.every-env/command-state.json'; export function getCommandState() { const statePath = join(process.cwd(), STATE_FILE); if (!existsSync(statePath)) { return {}; } try { const content = readFileSync(statePath, 'utf-8'); return JSON.parse(content); } catch { return {}; } } export function saveCommandState(state) { const statePath = join(process.cwd(), STATE_FILE); const dir = dirname(statePath); // Ensure directory exists if (!existsSync(dir)) { mkdirSync(dir, { recursive: true }); } writeFileSync(statePath, JSON.stringify(state, null, 2)); } export function updateLastUsedAgent(command, agent) { const state = getCommandState(); if (!state.lastUsedAgents) { state.lastUsedAgents = {}; } state.lastUsedAgents[command] = agent; saveCommandState(state); } export function getLastUsedAgent(command) { const state = getCommandState(); return state.lastUsedAgents?.[command]; } //# sourceMappingURL=command-state.js.map