agentlang
Version:
The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans
154 lines • 5.31 kB
TypeScript
import { ExtendedFileSystem } from '../utils/fs/index.js';
import { URI as VSCodeURI } from 'vscode-uri';
/**
* Re-export the URI type from vscode-uri
*/
export type URI = VSCodeURI;
/**
* Creates a URI from a string
* @param uriString String representation of a URI
* @returns URI object
*/
export declare function createURI(uriString: string): URI;
/**
* Creates a file URI from a file path
* @param filePath File path (can be absolute or relative)
* @returns File URI object
*/
export declare function createFileURI(filePath: string): URI;
/**
* Creates a directory URI from a directory path
* @param dirPath Directory path (can be absolute or relative)
* @returns Directory URI object
*/
export declare function createDirectoryURI(dirPath: string): URI;
/**
* Helper function to extract filesystem path from URI or string
* @param uri URI or string representation of URI
* @returns Filesystem path
*/
export declare function toFsPath(uri: URI | string): string;
/**
* Initialize the filesystem with the appropriate implementation based on environment
* @param options Optional configuration for the filesystem
* @returns Promise resolving to the filesystem instance
*/
export declare function initializeFileSystem(options?: any): Promise<ExtendedFileSystem>;
/**
* Get the filesystem instance, initializing it if necessary
* @param options Optional configuration for the filesystem
* @returns Promise resolving to the filesystem instance
*/
export declare function getFileSystem(options?: any): Promise<ExtendedFileSystem>;
/**
* Read a file as text
* @param uri URI to the file
* @returns Promise resolving to file content as string
*/
export declare function readFile(uri: URI | string): Promise<string>;
/**
* Read a file as binary
* @param uri URI to the file
* @returns Promise resolving to file content as Buffer
*/
export declare function readFileBuffer(uri: URI | string): Promise<Buffer>;
/**
* Write content to a file
* @param uri URI to the file
* @param data Content to write (string or Buffer)
* @returns Promise that resolves when write is complete
*/
export declare function writeFile(uri: URI | string, data: string | Buffer): Promise<void>;
/**
* Check if a file or directory exists
* @param uri URI to check
* @returns Promise resolving to boolean indicating existence
*/
export declare function exists(uri: URI | string): Promise<boolean>;
/**
* Create a directory
* @param uri Directory URI to create
* @returns Promise that resolves when directory is created
*/
export declare function mkdir(uri: URI | string): Promise<void>;
/**
* List files in a directory
* @param uri Directory URI
* @returns Promise resolving to array of file names
*/
export declare function readdir(uri: URI | string): Promise<string[]>;
/**
* List files in a Directory (Wrapper for readdir)
* @param uri Directory URI
* @returns Promise resolving to array of file names
*/
export declare function readDirectory(uri: URI | string): Promise<string[]>;
/**
* Get stats for a file or directory
* @param uri URI to check
* @returns Promise resolving to stats object
*/
export declare function stat(uri: URI | string): Promise<any>;
/**
* Remove a file
* @param uri URI to the file
* @returns Promise that resolves when file is removed
*/
export declare function unlink(uri: URI | string): Promise<void>;
/**
* Remove a directory
* @param uri URI to the directory
* @returns Promise that resolves when directory is removed
*/
export declare function rmdir(uri: URI | string): Promise<void>;
/**
* Copy a file
* @param srcUri Source URI
* @param destUri Destination URI
* @returns Promise that resolves when copy is complete
*/
export declare function copyFile(srcUri: URI | string, destUri: URI | string): Promise<void>;
/**
* Move a file
* @param srcUri Source URI
* @param destUri Destination URI
* @returns Promise that resolves when move is complete
*/
export declare function moveFile(srcUri: URI | string, destUri: URI | string): Promise<void>;
/**
* Ensure a directory exists, creating it and any parent directories if needed
* @param uri Directory URI
* @returns Promise that resolves when directory exists
*/
export declare function ensureDir(uri: URI | string): Promise<void>;
/**
* Remove a directory and all its contents recursively
* @param uri Directory URI
* @returns Promise that resolves when directory is removed
*/
export declare function removeDir(uri: URI | string): Promise<void>;
/**
* Determine if we're running in a browser environment
* @returns boolean indicating if in browser
*/
export declare function isBrowser(): boolean;
/**
* Determine if we're running in Node.js environment
* @returns boolean indicating if in Node.js
*/
export declare function isNode(): boolean;
export declare function platformIsWindows(): boolean;
/**
* Joins a URI with path segments
* @param base Base URI
* @param pathSegments Path segments to join
* @returns New URI with joined path
*/
export declare function joinURI(base: URI | string, ...pathSegments: string[]): URI;
/**
* Gets the parent directory URI from a file or directory URI
* @param uri URI to get parent from
* @returns Parent directory URI
*/
export declare function getParentURI(uri: URI | string): URI;
//# sourceMappingURL=fs-utils.d.ts.map