import { ensureDir, readJsonFile, writeJsonFile } from './json-store.js';
import path from 'node:path';
import { getDataDir } from './json-store.js';
function commandsFile(workspaceId) {
    return path.join(getDataDir(), 'workspaces', workspaceId, 'commands.json');
}
export function listCommands(workspaceId) {
    return readJsonFile(commandsFile(workspaceId)) ?? [];
}
export function getCommand(workspaceId, commandId) {
    return listCommands(workspaceId).find(c => c.id === commandId) ?? null;
}
export function saveCommands(workspaceId, commands) {
    ensureDir(path.dirname(commandsFile(workspaceId)));
    writeJsonFile(commandsFile(workspaceId), commands);
}
//# sourceMappingURL=command-store.js.map