UNPKG

@morodomi/ait3

Version:

AIT³ Development Platform - AI + Ticket + Test + Tool driven development methodology

38 lines (37 loc) 1.23 kB
import { readFile, writeFile, access } from 'fs/promises'; import { join } from 'path'; export async function validateTicketsDirectory(cwd) { try { await access(join(cwd, '.tickets')); return null; // No error } catch { return { success: false, message: 'No .tickets directory found', data: { details: 'Initialize the ticket system first with: ait3 ticket create "First ticket"' } }; } } export async function readConfig(cwd) { const configPath = join(cwd, '.tickets', 'config.json'); try { const configContent = await readFile(configPath, 'utf-8'); return JSON.parse(configContent); } catch { return {}; } } export async function writeConfig(cwd, config) { const configPath = join(cwd, '.tickets', 'config.json'); await writeFile(configPath, JSON.stringify(config, null, 2)); } export function buildTicketNotice(ticketCount, backendType) { if (ticketCount === 0) return ''; const sourceType = backendType === 'local' ? 'local tickets' : 'GitHub issues'; return `\n\nFound ${ticketCount} ${sourceType}. Use 'ait3 migrate' to transfer them.`; }