/** * Shared storage utilities for ARCS project stores. * * Filesystem helpers, validation utilities, and common types used by * plan-store, knowledge-store, and task-store modules. */ export declare const PLAN_STATUSES: readonly ["proposed", "planned", "in_progress", "blocked", "done", "archived"]; export type PlanStatus = (typeof PLAN_STATUSES)[number]; export declare const KNOWLEDGE_KINDS: readonly ["lesson", "gotcha", "pattern", "architecture", "module", "feature", "reference", "decision"]; export type KnowledgeKind = (typeof KNOWLEDGE_KINDS)[number]; export declare const KNOWLEDGE_AUDIENCES: readonly ["orchestrator", "implementer", "designer", "universal"]; export type KnowledgeAudience = (typeof KNOWLEDGE_AUDIENCES)[number]; export declare const TASK_STATUSES: readonly ["backlog", "in_progress", "done", "cancelled"]; export type TaskStatus = (typeof TASK_STATUSES)[number]; export declare const TASK_PRIORITIES: readonly ["critical", "high", "medium", "low"]; export type TaskPriority = (typeof TASK_PRIORITIES)[number]; export declare const SESSION_STATUSES: readonly ["active", "idle", "completed", "failed", "disconnected"]; export type SessionStatus = (typeof SESSION_STATUSES)[number]; export declare const SESSION_RUNTIME_TYPES: readonly ["claude-code", "opencode", "pi", "codex"]; export type SessionRuntimeType = (typeof SESSION_RUNTIME_TYPES)[number]; /** * DAG node kinds a session may be linked to. Linkage always keys on the * task/plan normalized id — never on a diagram node id (T001…), which is * regenerated by `arcs diagram sort-metadata`. */ export declare const SESSION_LINKED_NODE_TYPES: readonly ["task", "plan"]; export type SessionLinkedNodeType = (typeof SESSION_LINKED_NODE_TYPES)[number]; export interface FileRef { path: string; anchor?: string; } /** * Validates and normalizes an array of FileRef objects. * - path: backslashes normalized to forward slashes first, then validated. * Must be relative (no leading /), no .., no empty, no #, comma, or colon. * - anchor: if provided, must be non-empty/non-whitespace, no # or comma. * Returns a new array with normalized paths. Throws on invalid input. */ export declare function sanitizeFileRefs(refs: FileRef[]): FileRef[]; export declare function validatePlanStatus(status: string): asserts status is PlanStatus; export declare function validateKnowledgeKind(kind: string): asserts kind is KnowledgeKind; export declare function validateTaskStatus(status: string): asserts status is TaskStatus; export declare function validateTaskPriority(priority: string): asserts priority is TaskPriority; export declare function validateSessionStatus(status: string): asserts status is SessionStatus; export declare function validateSessionRuntimeType(runtimeType: string): asserts runtimeType is SessionRuntimeType; export declare function validateSessionLinkedNodeType(nodeType: string): asserts nodeType is SessionLinkedNodeType; /** A valid keyword is a non-empty, lowercase, alpha-numeric-or-dash string. */ export declare function sanitizeKeywords(raw: string[]): string[]; export declare function fileExists(path: string): Promise; export declare function ensureDir(dir: string): Promise; /** * Durably replace a text file: fsync the staged file, rename atomically, then * fsync the parent directory where supported. */ export declare function writeTextAtomic(filePath: string, content: string): Promise; export interface FileMutation { path: string; /** null removes the file. */ content: string | null; } /** * Best-effort multi-file transaction. Every file replacement is individually * atomic/durable; if a later mutation fails, prior files are restored from * their snapshots before the error is rethrown. Callers must hold the * collection-level advisory lock for the whole operation. */ export declare function writeFilesTransaction(mutations: FileMutation[]): Promise; export declare function writeJson(filePath: string, data: unknown): Promise; export declare function nowISO(override?: string): string; /** * Build body markdown. If `content` is supplied and already starts with * a matching H1, use as-is. Otherwise, prepend `# title\n\n`. */ export declare function buildBody(title: string, content?: string): string; /** * Rewrite the leading H1 in an existing body file. */ export declare function rewriteH1(filePath: string, newTitle: string): Promise; //# sourceMappingURL=storage-utils.d.ts.map