UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

63 lines 2.13 kB
/** * Artifact Index Reader * * Shared utility to load .aiwg/.index/ JSON files. * Used by query, deps, and stats commands. * * @implements #420 * @source @src/artifacts/types.ts * @tests @test/unit/artifacts/index-reader.test.ts */ import type { ArtifactIndex, TagIndex, DependencyGraph, IndexStats, GraphType } from './types.js'; /** * Load a JSON file from the index directory * * @param cwd - Project root directory * @param filename - JSON file to load (e.g. 'metadata.json') * @returns Parsed JSON or null if file doesn't exist or is corrupt */ export declare function loadIndexFile<T>(cwd: string, filename: string): T | null; /** * Load the master metadata index */ export declare function loadMetadataIndex(cwd: string): ArtifactIndex | null; /** * Load the tag reverse index */ export declare function loadTagIndex(cwd: string): TagIndex | null; /** * Load the dependency graph */ export declare function loadDependencyGraph(cwd: string): DependencyGraph | null; /** * Load the index statistics */ export declare function loadIndexStats(cwd: string): IndexStats | null; /** * Check if an index exists */ export declare function indexExists(cwd: string): boolean; /** * Write a JSON file to the index directory atomically * * Uses write-to-temp + rename for POSIX-safe atomic writes. * * @param cwd - Project root directory * @param filename - JSON file to write * @param data - Data to serialize * @param indexDir - Override index directory (for multi-graph support) */ export declare function writeIndexFile(cwd: string, filename: string, data: unknown, indexDir?: string): void; /** * Resolve the index directory for a graph type * * @param cwd - Project root directory * @param graph - Graph type (undefined = default .aiwg/.index/) * @returns Absolute path to the index directory */ export declare function resolveIndexDir(cwd: string, graph?: GraphType): string; /** * Load a JSON file from a graph-specific index directory */ export declare function loadGraphIndexFile<T>(cwd: string, filename: string, graph?: GraphType): T | null; //# sourceMappingURL=index-reader.d.ts.map