@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
51 lines • 2.31 kB
TypeScript
export declare const PATH_IDENTITY_VERSION = 1;
export interface PathIdentityStats {
readonly dev: bigint;
readonly ino: bigint;
isSymbolicLink(): boolean;
}
export interface PathIdentityPrimitives {
readonly realpathNative: (value: string) => string;
readonly lstat: (value: string, options?: {
bigint: true;
}) => PathIdentityStats;
readonly readlink: (value: string) => string;
readonly pathApi: {
readonly join: (...parts: string[]) => string;
readonly dirname: (value: string) => string;
readonly basename: (value: string) => string;
readonly isAbsolute: (value: string) => boolean;
readonly sep: string;
readonly win32Resolve: (...parts: string[]) => string;
};
readonly platform: string;
}
export interface CanonicalPath {
readonly path: string;
readonly foldCase: boolean;
}
export interface CanonicalRule {
readonly prefix: string | undefined;
readonly foldCase: boolean;
readonly suffix: string;
readonly wildcardOnly: boolean;
}
export interface PathIdentity {
canonical(executed: string, cwd?: string): CanonicalPath;
canonicalRule(pattern: string, cwd?: string): CanonicalRule | undefined;
volumeFoldCase(existingPath: string): boolean;
}
export interface PathIdentityError extends Error {
readonly code: string;
}
/** Lowercase per code point, only where the lowercase form is exactly one code point (U+0130 stays). */
export declare function foldCaseText(text: string): string;
export declare function createPathIdentity({ realpathNative, lstat, readlink, pathApi, platform, }: PathIdentityPrimitives): PathIdentity;
/**
* Whether a rule's canonical form covers a request's canonical path. The request target's volume
* decides the fold (N6): on a case-insensitive volume both sides are folded, otherwise neither.
* Both sides go through the mount rewrite first: a native realpath that keeps the firmlink spelling
* (Node's does on darwin) must still meet a rule written on the canonical one, and the reverse.
*/
export declare function identityMatches(rule: CanonicalRule, request: CanonicalPath, match: (value: string, pattern: string) => boolean, sep: string, rewrite?: (value: string) => string): boolean;
//# sourceMappingURL=path-identity.d.ts.map