Remove unnecessary ctx.file APIs - plugins can use node:fs directly

This commit is contained in:
Gregory Schier
2025-12-28 14:06:35 -08:00
parent 218fdf3715
commit 6d5ba685f1
4 changed files with 7 additions and 76 deletions

View File

@@ -68,10 +68,6 @@ export interface Context {
templates: {
render<T extends JsonValue>(args: TemplateRenderRequest & { data: T }): Promise<T>;
};
file: {
writeText(filePath: string, content: string): Promise<void>;
readText(filePath: string): Promise<string>;
};
plugin: {
reload(): void;
};

View File

@@ -689,24 +689,6 @@ export class PluginInstance {
return result.data as any;
},
},
file: {
writeText: async (filePath: string, content: string) => {
const payload: InternalEventPayload = {
type: 'write_text_file_request',
filePath,
content,
} as any;
await this.#sendForReply(context, payload);
},
readText: async (filePath: string) => {
const payload: InternalEventPayload = {
type: 'read_text_file_request',
filePath,
} as any;
const result = await this.#sendForReply<any>(context, payload);
return result.content;
},
},
store: {
get: async <T>(key: string) => {
const payload = { type: 'get_key_value_request', key } as const;