fix(sdk): address project tooling review findings

This commit is contained in:
imccyu
2026-07-15 21:06:01 +08:00
parent 42b07a7022
commit e150bc446d
18 changed files with 241 additions and 47 deletions

View File

@@ -17,12 +17,16 @@ export abstract class ProjectFile {
/** Text observed when the document entered the snapshot; absent for a new file. */
readonly originalText: string | undefined
protected constructor(relativePath: string, originalText?: string) {
/** Permission bits used only when the file is first created. */
readonly createMode: number | undefined
protected constructor(relativePath: string, originalText?: string, createMode?: number) {
if (relativePath.startsWith('/') || relativePath.split('/').includes('..')) {
throw new Error(`project document path must stay inside the project: ${relativePath}`)
}
this.relativePath = relativePath
this.originalText = originalText
this.createMode = createMode
}
/** Clone the document for an isolated edit session. */