adds schema view and schema generating command

This commit is contained in:
2026-11-03 09:35:41 +01:00
parent cc41decccb
commit 600d4874d2
62 changed files with 4416 additions and 105 deletions
@@ -0,0 +1,25 @@
import Foundation
import HelderCore
/// The Schema view's disk and process work for one project.
public protocol SchemaServicing: Sendable {
/// True when the project root holds an `artisan` file.
func isLaravelApp() async -> Bool
/// True when `app/Console/Commands/HelderSchemaCommand.php` exists.
func hasCommand() async -> Bool
/// The model from `database/helder/schema.json`, nil when the file is missing; throws `SchemaDumpError` when it is corrupt.
func readDump() async throws -> SchemaModel?
/// When the dump was last written, nil when it is missing.
func dumpModificationDate() async -> Date?
/// Runs `php artisan helder:schema` in the project and streams each line (`isError` for stderr); returns the exit code.
///
/// Never throws and never waits on input: a missing php, a launch failure or the timeout becomes one error line and code -1.
func runDump(onLine: @escaping @Sendable (_ line: String, _ isError: Bool) -> Void) async -> Int32
}
/// Card positions per project, kept in Helder's own settings rather than in the project folder.
public protocol SchemaLayoutPersisting: Sendable {
/// Empty when nothing was saved for `root`.
func loadPositions(root: String) -> [String: SchemaPoint]
func savePositions(_ positions: [String: SchemaPoint], root: String)
}