- Daily backups (database + config) into <data_dir>/backups, keep N, optional upload to any S3-compatible bucket (SigV4, bucket pruning); settings panel with run-now, list and download - Daily cost summary push at 20:00 (opt-in per user, preview button) - Automations from templates (dependency check, security review, test health, daily summary, TODO report, docs freshness) via POST /jobs/create - browser tool: headless Chromium over CDP – click, type, keys, waits, JavaScript, navigation, screenshots, console errors; requests to private network addresses are blocked (sub-resources and redirects included) - Secrets masked in the config view: S3 secret key, metrics token - Replace the remaining text arrows/refresh glyphs with SVG icons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
2.1 KiB
Rust
82 lines
2.1 KiB
Rust
//! CodeCraft – web-based coding harness for AI models.
|
||
|
||
mod api;
|
||
mod app;
|
||
mod auth;
|
||
mod backup;
|
||
mod cli_api;
|
||
mod budget;
|
||
mod config;
|
||
mod digest;
|
||
mod docs;
|
||
mod export;
|
||
mod files;
|
||
mod git;
|
||
mod health;
|
||
mod gitcreds;
|
||
mod hooks;
|
||
mod images;
|
||
mod jobs;
|
||
mod lsp;
|
||
mod mentions;
|
||
mod metrics;
|
||
mod mcp;
|
||
mod permission;
|
||
mod prompts;
|
||
mod push;
|
||
mod provider;
|
||
mod reverse;
|
||
mod runner;
|
||
mod sandbox;
|
||
mod shells;
|
||
mod store;
|
||
mod terminal;
|
||
mod tools;
|
||
mod types;
|
||
mod update;
|
||
|
||
use anyhow::Result;
|
||
use tracing_subscriber::EnvFilter;
|
||
|
||
#[tokio::main]
|
||
async fn main() -> Result<()> {
|
||
// CODECRAFT_LOG_FORMAT=json: one JSON object per line (Loki, Elastic, …).
|
||
let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info,codecraft=info"));
|
||
if std::env::var("CODECRAFT_LOG_FORMAT").is_ok_and(|f| f.eq_ignore_ascii_case("json")) {
|
||
tracing_subscriber::fmt().json().flatten_event(true).with_current_span(false).with_env_filter(filter).init();
|
||
} else {
|
||
tracing_subscriber::fmt().with_env_filter(filter).init();
|
||
}
|
||
|
||
// In Docker, HOME lives on the data volume; make sure it exists for git/npm.
|
||
if let Ok(home) = std::env::var("HOME") {
|
||
let _ = std::fs::create_dir_all(home);
|
||
}
|
||
|
||
let path = config::config_path();
|
||
let (cfg, _) = config::load_or_init(&path)?;
|
||
tracing::info!("config: {}", path.display());
|
||
tracing::info!("workspace: {}", cfg.workspace().display());
|
||
let _ = sandbox::probe().await;
|
||
let bind = cfg.server.bind.clone();
|
||
let app = app::App::new(path, cfg).await?;
|
||
lsp::spawn_reaper(app.clone());
|
||
push::spawn_listener(app.clone());
|
||
terminal::spawn_reaper(app.clone());
|
||
jobs::spawn_scheduler(app.clone());
|
||
update::spawn_checker(app.clone());
|
||
health::spawn_checker(app.clone());
|
||
digest::spawn(app.clone());
|
||
backup::spawn(app.clone());
|
||
let router = api::router(app);
|
||
let listener = tokio::net::TcpListener::bind(&bind).await?;
|
||
tracing::info!("listening on http://{bind}");
|
||
axum::serve(listener, router).with_graceful_shutdown(shutdown()).await?;
|
||
Ok(())
|
||
}
|
||
|
||
async fn shutdown() {
|
||
let _ = tokio::signal::ctrl_c().await;
|
||
tracing::info!("shutting down");
|
||
}
|