feat: publish Dever core with project scaffolding and versioned AI skills

This commit is contained in:
Antigravity committed 2026-10-04 13:37:30 +00:00
1 parent 70fa73cdc2
commit ac458ffa7f
960 files changed
+221319 -1163

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
use std::fmt::Write;
use crate::source::{SourceMap, Span};
#[derive(Clone, Debug, PartialEq)]
pub struct Label {
pub span: Span,
pub message: String,
}
#[derive(Clone, Debug, PartialEq)]
pub struct Diagnostic {
pub code: &'static str,
pub message: String,
pub primary: Span,
pub related: Vec<Label>,
}
impl Diagnostic {
pub(crate) fn error(code: &'static str, message: impl Into<String>, primary: Span) -> Self {
Self {
code,
message: message.into(),
primary,
related: Vec::new(),
}
}
pub fn render(&self, sources: &SourceMap) -> String {
let mut rendered = String::new();
render_label(
&mut rendered,
sources,
self.primary,
&format!(
"{}[{}]: {}",
if self.code.starts_with('W') {
"warning"
} else {
"error"
},
self.code,
self.message
),
);
for related in &self.related {
render_label(
&mut rendered,
sources,
related.span,
&format!("note: {}", related.message),
);
}
rendered
}
}
fn render_label(output: &mut String, sources: &SourceMap, span: Span, message: &str) {
let source = sources.get(span.source);
let (line, column) = source.position(span.start);
let line_text = source.line(line);
writeln!(
output,
"{}:{line}:{column}: {message}",
source.path().display()
)
.expect("string formatting");
writeln!(output, " | {line_text}").expect("string formatting");
}