better gitignore
Some checks failed
CI / check (push) Has been cancelled

This commit is contained in:
2026-06-16 10:44:40 +02:00
parent d5dbf7187d
commit 7c69853e85
13 changed files with 171 additions and 86 deletions

View File

@@ -1,4 +1,4 @@
import { readdir, readFile, stat, writeFile } from 'node:fs/promises'
import { readdir, readFile, rm, stat, writeFile } from 'node:fs/promises'
import { join, relative, sep } from 'node:path'
import { listFiles } from './search-service'
@@ -120,6 +120,13 @@ export async function writeProjectFile(root: string, rel: string, content: strin
await writeFile(join(root, rel), content, 'utf8')
}
/** Delete a project file or folder (relative path). Stays inside the project root. */
export async function deleteProjectFile(root: string, rel: string): Promise<void> {
const target = join(root, rel)
if (relative(root, target).startsWith('..')) return // guard against escaping the root
await rm(target, { recursive: true, force: true })
}
/**
* In-memory content index of all (small, text) files — powers content viewing.
* Primary: read the rg file list; fallback: walk. Capped for large repos.