import * as path from "path"; import * as vscode from "vscode"; import { getConfigSection, getSettingDefault } from "@/config"; import { IConfigProvider } from "@/ports"; export class VscodeConfigProvider implements IConfigProvider { getProjectTaskPath(): string | undefined { const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; if (!workspaceRoot) return undefined; const config = vscode.workspace.getConfiguration(getConfigSection()); // get() already merges package.json defaults; fallback for safety. const relativePath = config.get("projectPath") ?? getSettingDefault("projectPath"); return path.join(workspaceRoot, relativePath); } getGlobalTaskPath(): string | undefined { const config = vscode.workspace.getConfiguration(getConfigSection()); const globalPath = config.get("globalPath") ?? getSettingDefault("globalPath"); return globalPath || undefined; } }