feat: add diagnostic system and improve CLI with check command
Implement comprehensive diagnostic reporting system: - Add Diagnostic struct with severity levels and span-based error tracking - Add diagnostic rendering with source context and caret positioning - Replace ParseError with diagnostic collection in lexer and parser - Add LexResult and ParseResult types to carry diagnostics Enhance driver crate with frontend output: - Replace CompileResult with FrontendOutput containing diagnostics - Add has_errors() and render_diagnostics() methods - Add AstSummary for
This commit is contained in:
@@ -1,30 +1,18 @@
|
||||
use core.env
|
||||
use db.postgres.Pool
|
||||
use web.http.{App, Response}
|
||||
struct AppConfig:
|
||||
port: Int
|
||||
service_name: String
|
||||
|
||||
struct AppState:
|
||||
pool: Pool
|
||||
fn build_message(name: String, port: Int) -> String:
|
||||
if port > 0 && port < 65536:
|
||||
return name
|
||||
else:
|
||||
return "invalid"
|
||||
|
||||
async fn health(state: AppState) -> Response:
|
||||
let version = env.get("APP_VERSION").or("dev")
|
||||
let row = await state.pool.query_one<Map>(
|
||||
"select now() as now"
|
||||
)?
|
||||
|
||||
Response.json({
|
||||
"status": "ok",
|
||||
"version": version,
|
||||
"database_time": row["now"]
|
||||
})
|
||||
|
||||
async fn main() -> Result<Void, AppError>:
|
||||
let database_url = env.require("DATABASE_URL")?
|
||||
let port = env.get("PORT").or("8080").to_int()?
|
||||
let pool = Pool.connect(database_url, max: 16)?
|
||||
|
||||
let app = App.new()
|
||||
.state(AppState { pool: pool })
|
||||
.get("/health", health)
|
||||
|
||||
await app.listen("0.0.0.0", port)?
|
||||
fn main() -> Int:
|
||||
let config = build_message("backend-api", 8080)
|
||||
let enabled = true || false
|
||||
if enabled:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user