(
store: MemoryStore,
relPath: string,
virtualPath: string
)
| 895 | } |
| 896 | |
| 897 | private async readTextFileForEdit( |
| 898 | store: MemoryStore, |
| 899 | relPath: string, |
| 900 | virtualPath: string |
| 901 | ): Promise<string> { |
| 902 | const kind = await store.kind(relPath); |
| 903 | if (kind === null) { |
| 904 | throw new MemoryCommandError(`No memory file at ${virtualPath}`); |
| 905 | } |
| 906 | if (kind === "dir") { |
| 907 | throw new MemoryCommandError(`${virtualPath} is a directory, not a file`); |
| 908 | } |
| 909 | const content = await this.readBoundedTextFile(store, relPath, virtualPath); |
| 910 | if (content.includes("\u0000")) { |
| 911 | throw new MemoryCommandError(`${virtualPath} is not a UTF-8 text file; cannot edit it`); |
| 912 | } |
| 913 | return content; |
| 914 | } |
| 915 | |
| 916 | // ------------------------------------------------------------------------- |
| 917 | // UI commands (Memory tab): whole-file read/save with sha256 preconditions |
no test coverage detected