/** * File System Utilities for Work Item Sync * * Handles file operations: reading, writing, path resolution, and folder scanning. */ import { ParsedWorkItemFile } from './markdown-serializer.js'; /** * Sync configuration from environment */ export interface SyncConfig { folder: string; autoCommit: boolean; } /** * Get sync configuration from environment variables */ export declare function getSyncConfig(folderOverride?: string): SyncConfig; /** * Ensure a folder exists, creating it if necessary */ export declare function ensureFolderExists(folderPath: string): Promise; /** * Get the file path for a work item markdown file */ export declare function getWorkItemFilePath(folder: string, workItemId: number): string; /** * Get the file path for a work item comments file */ export declare function getCommentsFilePath(folder: string, workItemId: number): string; /** * Check if a file exists */ export declare function fileExists(filePath: string): Promise; /** * Write content to a file (creates parent directories if needed) */ export declare function writeWorkItemFile(filePath: string, content: string): Promise; /** * Read a work item file and parse it */ export declare function readWorkItemFile(filePath: string): Promise; /** * Read raw content from a file */ export declare function readFileContent(filePath: string): Promise; /** * List synced work item files in a folder * Returns list of parsed frontmatter from each file */ export declare function listSyncedWorkItems(folder: string): Promise<{ id: number; title: string; state: string; revision: number; hasComments: boolean; filePath: string; }[]>; /** * Validate a folder path for security (prevent path traversal) */ export declare function validateFolderPath(folderPath: string): void; /** * Get the file path for a new work item file * Format: new_{parentId}_{index}.md (with parent) or new_{index}.md (standalone) */ export declare function getNewWorkItemFilePath(folder: string, parentId: number | undefined, index: number): string; /** * Find the next available index for a new work item file * When parentId is provided, scans for new_{parentId}_*.md files * When parentId is undefined, scans for new_*.md (standalone) files */ export declare function findNextNewFileIndex(folder: string, parentId?: number): Promise; /** * Find all new work item files in a folder * Returns paths to all new_*.md files */ export declare function findNewWorkItemFiles(folder: string): Promise; /** * Rename a file (used for renaming new_*.md to {id}.md after creation) */ export declare function renameFile(oldPath: string, newPath: string): Promise; /** * Extract parent ID from a new work item filename * e.g., "new_12345_1.md" -> 12345 * e.g., "new_1.md" -> null (standalone, no parent) */ export declare function extractParentIdFromNewFilename(filename: string): number | null; //# sourceMappingURL=file-utils.d.ts.map