andy-stack_vaultkeeper-ai/Services/WorkSpaceService.ts
Andrew Beal e543bf5351 refactor: improve dependency injection type safety and add AI exclusions setting
- Add generic types to all Resolve() calls for type safety
- Introduce VaultService abstraction layer for file operations
- Add AI File Exclusions setting with textarea and glob pattern support
- Refactor FileSystemService to use VaultService instead of direct Vault access
- Improve code organization with comments and renamed variables
- Update styles for exclusions input field
2025-10-12 21:26:01 +01:00

17 lines
No EOL
608 B
TypeScript

import type AIAgentPlugin from "main";
import { Resolve } from "./DependencyService";
import { Services } from "./Services";
import type { TFile, WorkspaceLeaf } from "obsidian";
export class WorkSpaceService {
private readonly plugin: AIAgentPlugin = Resolve<AIAgentPlugin>(Services.AIAgentPlugin);
public async openNote(noteName: string) {
const file: TFile | null = this.plugin.app.metadataCache.getFirstLinkpathDest(noteName, "");
const leaf: WorkspaceLeaf = this.plugin.app.workspace.getLeaf(false);
if (file) {
await leaf.openFile(file);
}
}
}