Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ingest-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export {
PATH_MAP_RELATIVE_PATH,
PATH_MAP_SCHEMA_VERSION,
} from "#src/path-map.ts";
export type { PathMap } from "#src/path-map.ts";
export type { PathMap, PathMapUnitEntry } from "#src/path-map.ts";
export type { ScanManifest, ScanManifestEntry, ScanManifestSummary, ScanEntryKind } from "#src/scan-manifest.ts";
export { writeEligibleFiles, ELIGIBLE_FILES_RELATIVE_PATH } from "#src/eligible-files.ts";
export type { EligibleFilesDocument, WriteEligibleFilesInput } from "#src/eligible-files.ts";
Expand Down
16 changes: 16 additions & 0 deletions packages/ingest-core/src/path-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,29 @@ import type { MetaPaths } from "#src/types/meta-paths.ts";
export const PATH_MAP_RELATIVE_PATH = "path-map.json";
export const PATH_MAP_SCHEMA_VERSION = 1;

/** One code unit's identity + on-disk location, recorded so `unit → file` is an explicit lookup. */
export interface PathMapUnitEntry {
/** `metaId(qualifiedName)` — the unit's dir name under `<file|big-file>-analysis/<fileMetaId>/codeUnits/`. */
unitHash: string;
qualifiedName: string;
unitId: string;
/** Analysis window for a big-file unit (1-based); `null` for a small file. Not part of the storage path. */
chunkNumber: number | null;
}

export interface PathMap {
version: number;
algo: "sha256";
/** `metaId(relativePath) → relativePath` for every scanned file. */
files: Record<string, string>;
/** `metaId(folderPath) → folderPath` for every ancestor folder; the repo root is `"__ROOT__" → ""`. */
folders: Record<string, string>;
/**
* `metaId(relativePath) → units of that file` (same key as `files`). OPTIONAL: added by a post-analysis
* augmentation (units are unknown when `buildPathMap` runs from the scan manifest). Answers "which units
* belong to this file?" in O(1); each unit's records live at `<...>-analysis/<key>/codeUnits/<unitHash>/`.
*/
unitsByFile?: Record<string, PathMapUnitEntry[]>;
}

/** PURE. Builds the `id → path` map for every file in the manifest plus every ancestor folder. */
Expand Down
Loading