import * as fs from "node:fs";
import { FileType, } from "../index.js";
import { getContinueGlobalPath } from "./paths.js";
class FileSystemIde {
    async getGitHubAuthToken() {
        return undefined;
    }
    getLastModified(files) {
        return new Promise((resolve) => {
            resolve({
                [files[0]]: 1234567890,
            });
        });
    }
    getGitRootPath(dir) {
        return Promise.resolve(dir);
    }
    async listDir(dir) {
        const all = fs
            .readdirSync(dir, { withFileTypes: true })
            .map((dirent) => [
            dirent.path,
            dirent.isDirectory()
                ? FileType.Directory
                : dirent.isSymbolicLink()
                    ? FileType.SymbolicLink
                    : FileType.File,
        ]);
        return Promise.resolve(all);
    }
    infoPopup(message) {
        return Promise.resolve();
    }
    errorPopup(message) {
        return Promise.resolve();
    }
    getRepoName(dir) {
        return Promise.resolve(undefined);
    }
    getTags(artifactId) {
        return Promise.resolve([]);
    }
    getIdeInfo() {
        return Promise.resolve({
            ideType: "vscode",
            name: "na",
            version: "0.1",
            remoteName: "na",
            extensionVersion: "na",
        });
    }
    readRangeInFile(filepath, range) {
        return Promise.resolve("");
    }
    isTelemetryEnabled() {
        return Promise.resolve(false);
    }
    getUniqueId() {
        return Promise.resolve("NOT_UNIQUE");
    }
    getWorkspaceConfigs() {
        return Promise.resolve([]);
    }
    getDiff() {
        return Promise.resolve("");
    }
    getTerminalContents() {
        return Promise.resolve("");
    }
    async getDebugLocals(threadIndex) {
        return Promise.resolve("");
    }
    async getTopLevelCallStackSources(threadIndex, stackDepth) {
        return Promise.resolve([]);
    }
    async getAvailableThreads() {
        return Promise.resolve([]);
    }
    showLines(filepath, startLine, endLine) {
        return Promise.resolve();
    }
    listWorkspaceContents() {
        return new Promise((resolve, reject) => {
            fs.readdir("/tmp/continue", (err, files) => {
                if (err) {
                    reject(err);
                }
                resolve(files);
            });
        });
    }
    getWorkspaceDirs() {
        return new Promise((resolve, reject) => {
            fs.mkdtemp("/tmp/continue", (err, folder) => {
                if (err) {
                    reject(err);
                }
                resolve([folder]);
            });
        });
    }
    listFolders() {
        return Promise.resolve([]);
    }
    writeFile(path, contents) {
        return new Promise((resolve, reject) => {
            fs.writeFile(path, contents, (err) => {
                if (err) {
                    reject(err);
                }
                resolve();
            });
        });
    }
    showVirtualFile(title, contents) {
        return Promise.resolve();
    }
    getContinueDir() {
        return Promise.resolve(getContinueGlobalPath());
    }
    openFile(path) {
        return Promise.resolve();
    }
    runCommand(command) {
        return Promise.resolve();
    }
    saveFile(filepath) {
        return Promise.resolve();
    }
    readFile(filepath) {
        return new Promise((resolve, reject) => {
            fs.readFile(filepath, "utf8", (err, contents) => {
                if (err) {
                    reject(err);
                }
                resolve(contents);
            });
        });
    }
    showDiff(filepath, newContents, stepIndex) {
        return Promise.resolve();
    }
    getBranch(dir) {
        return Promise.resolve("");
    }
    getOpenFiles() {
        return Promise.resolve([]);
    }
    getCurrentFile() {
        return Promise.resolve("");
    }
    getPinnedFiles() {
        return Promise.resolve([]);
    }
    async getSearchResults(query) {
        return "";
    }
    async getProblems(filepath) {
        return Promise.resolve([]);
    }
    async subprocess(command) {
        return ["", ""];
    }
}
export default FileSystemIde;
