restores Helder in all its glory

This commit is contained in:
2026-09-28 11:34:49 +02:00
parent c2b38b853c
commit 1d29d0952d
280 changed files with 29205 additions and 7 deletions
@@ -0,0 +1,28 @@
import Foundation
public protocol NotesServicing: Sendable {
/// The note's text; "" when the project has none yet.
func read() async -> String
func write(_ text: String) async throws
}
/// The note is a plain `.notes.txt` in the project root, not JSON and not in `.helder/`,
/// so it stays readable and editable outside Helder.
public struct NotesService: NotesServicing {
public static let fileName = ".notes.txt"
public let root: URL
public init(root: URL) {
self.root = root
}
private var url: URL { root.appendingPathComponent(Self.fileName) }
public func read() async -> String {
(try? String(contentsOf: url, encoding: .utf8)) ?? ""
}
public func write(_ text: String) async throws {
try Data(text.utf8).write(to: url, options: .atomic)
}
}