fix(coding-agent): unify source provenance, closes #1734

This commit is contained in:
Mario Zechner
2026-03-23 02:02:42 +01:00
parent 883862a354
commit 4e5af01d73
26 changed files with 340 additions and 157 deletions

View File

@@ -1,14 +1,17 @@
import type { PathMetadata } from "./package-manager.js";
export type SourceScope = "user" | "project" | "temporary";
export type SourceOrigin = "package" | "top-level";
export interface SourceInfo {
path?: string;
path: string;
source: string;
scope: "user" | "project" | "temporary";
origin: "package" | "top-level";
scope: SourceScope;
origin: SourceOrigin;
baseDir?: string;
}
export function createSourceInfo(path: string | undefined, metadata: PathMetadata): SourceInfo {
export function createSourceInfo(path: string, metadata: PathMetadata): SourceInfo {
return {
path,
source: metadata.source,
@@ -17,3 +20,21 @@ export function createSourceInfo(path: string | undefined, metadata: PathMetadat
baseDir: metadata.baseDir,
};
}
export function createSyntheticSourceInfo(
path: string,
options: {
source: string;
scope?: SourceScope;
origin?: SourceOrigin;
baseDir?: string;
},
): SourceInfo {
return {
path,
source: options.source,
scope: options.scope ?? "temporary",
origin: options.origin ?? "top-level",
baseDir: options.baseDir,
};
}