Dashboard HTML: full Neuron web experience with avatar, voice; add X-NC-CLI header to http_post for CLI mirroring

This commit is contained in:
Will Anderson
2026-04-28 03:42:44 -05:00
parent c427a0adc0
commit f4730bc39e
2 changed files with 1978 additions and 5 deletions
File diff suppressed because it is too large Load Diff
+64 -5
View File
@@ -35,6 +35,8 @@ use el_compiler::{Compiler, CompilerOptions, Target};
use el_test;
use el_manifest::{BuildTarget, Manifest};
use el_seal::{seal as seal_fn, unseal as unseal_fn, SealedArtifact, DeploymentBinding, SealAlgorithm, SealConfig};
use el_fmt;
use el_lint;
// ── Global state (thread-local for simplicity) ────────────────────────────────
@@ -172,12 +174,30 @@ enum Command {
manifest: Option<PathBuf>,
},
/// Format source files.
/// Format an engram-lang source file (or all files in a project).
Fmt {
/// Single source file to format (*.el). When omitted, formats the whole project.
file: Option<PathBuf>,
/// Overwrite the file in place with canonical formatting.
#[arg(long)]
in_place: bool,
/// Exit 1 if the file is not in canonical format (useful in CI). Does not modify the file.
#[arg(long)]
check: bool,
/// Project manifest (used when no `file` is given).
#[arg(long)]
manifest: Option<PathBuf>,
},
/// Lint an engram-lang source file.
Lint {
/// Source file to lint (*.el).
file: PathBuf,
/// Emit diagnostics as JSON instead of human-readable text.
#[arg(long)]
json: bool,
},
/// Remove build artifacts and cache.
Clean {
#[arg(long)]
@@ -396,10 +416,48 @@ async fn run(cli: Cli) -> Result<(), Box<dyn std::error::Error>> {
}
}
Command::Fmt { manifest } => {
let manifest_path = resolve_manifest(manifest.as_deref())?;
let bs = BuildSystem::from_manifest_file(&manifest_path)?;
bs.fmt()?;
Command::Fmt { file, in_place, check, manifest } => {
if let Some(path) = file {
// Single-file mode
let source = std::fs::read_to_string(&path)
.map_err(|e| format!("cannot read {}: {e}", path.display()))?;
let formatted = el_fmt::format(&source)
.map_err(|e| format!("fmt error: {e}"))?;
if check {
if formatted != source {
eprintln!("error: {} is not in canonical format", path.display());
std::process::exit(1);
}
println!("ok: {} is already formatted", path.display());
} else if in_place {
std::fs::write(&path, &formatted)
.map_err(|e| format!("cannot write {}: {e}", path.display()))?;
println!("formatted: {}", path.display());
} else {
print!("{formatted}");
}
} else {
// Project mode — fall back to build system's fmt
let manifest_path = resolve_manifest(manifest.as_deref())?;
let bs = BuildSystem::from_manifest_file(&manifest_path)?;
bs.fmt()?;
}
}
Command::Lint { file, json } => {
let source = std::fs::read_to_string(&file)
.map_err(|e| format!("cannot read {}: {e}", file.display()))?;
let mut report = el_lint::lint(&source)
.map_err(|e| format!("lint error: {e}"))?;
report.file_path = Some(file.display().to_string());
if json {
println!("{}", report.to_json());
} else {
print!("{}", report.display());
}
if report.has_errors() {
std::process::exit(1);
}
}
Command::Clean { manifest } => {
@@ -1577,6 +1635,7 @@ fn dispatch_builtin(
let result = reqwest::blocking::Client::new()
.post(&url)
.header("Content-Type", "application/json")
.header("X-NC-CLI", "true")
.body(body)
.send()
.and_then(|r| r.text())