improvements
CI / check (push) Has been cancelled

This commit is contained in:
2026-07-31 13:29:22 +02:00
parent daf8945da7
commit e126182ae6
11 changed files with 578 additions and 7 deletions
+28
View File
@@ -0,0 +1,28 @@
/**
* Project scratch note: a plain text file at `<project>/.notes.txt`.
*
* Deliberately not JSON and not part of `.helder/`. It is a note the user
* writes by hand, so it must stay readable and editable outside Helder.
*/
import { readFile, writeFile } from 'node:fs/promises'
import { join } from 'node:path'
import { logger } from './logger'
export const NOTES_FILE = '.notes.txt'
/** The note's text. Empty string when the project has no note yet. */
export async function readNote(root: string): Promise<string> {
try {
return await readFile(join(root, NOTES_FILE), 'utf8')
} catch (err) {
// ENOENT is the normal "no note yet" case, anything else is worth knowing.
if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
logger.warn('notes', 'read failed', { root, err: String(err) })
}
return ''
}
}
export async function writeNote(root: string, text: string): Promise<void> {
await writeFile(join(root, NOTES_FILE), text, 'utf8')
}