feat: clean-room rewrite — replace ported modules with original implementations

Every Rust module under src/ that previously contained upstream-derivative
code has been replaced by a from-scratch implementation:

  diag/    log + simplelog file appender (was: diagnose.rs)
  os/      color, dpi, registry, string, theme (was: theme.rs, native_interop.rs)
  net/     WinHTTP-based HTTP client (was: ureq + native-tls)
  i18n/    TOML-embedded locale tables (was: localization/*.rs)
  usage/   trait UsageProvider + ClaudeProvider + ChatGptProvider + refresh
           orchestrator + registry (was: poller.rs, models.rs)
  creds/   trait CredentialSource + local/WSL/Codex impls (was: poller.rs)
  tray/    stateless tray manager + tiny-skia anti-aliased badge renderer
           (was: tray_icon.rs)
  update/  release fetch + inline cmd /c handoff installer
           (was: updater.rs's helper-exe pattern)

Application files (app.rs, bubble.rs, panel.rs, settings.rs) migrated to
the new modules. main.rs declares only the new modules.

NOTICE deleted; LICENSE is plain Apache-2.0; README updated to credit
inspiration rather than claim derivation. Cargo.toml drops ureq + native-tls
+ winres in favour of log + simplelog + thiserror + toml + tiny-skia +
embed-resource. Build script swapped to embed-resource via res/icon.rc.

External contracts preserved unchanged: Anthropic + ChatGPT endpoints and
headers, ~/.claude/.credentials.json + Codex auth.json paths, WSL bridging
via wsl.exe, CLI-driven token refresh, GitHub Releases JSON shape, Windows
registry path for startup, single-instance mutex name.

Phase docs: plans/260516-0707-cleanroom-rewrite/.
This commit is contained in:
tiennm99 committed 2026-05-16 10:09:43 +07:00
1 parent c0f3e3f860
commit aa6217d2cf
72 files changed
+6265 -3788

No files matched your search

+16 -16
View File
@@ -1,39 +1,39 @@
#![windows_subsystem = "windows"]
// Original infrastructure.
mod creds;
mod diag;
mod i18n;
mod net;
mod os;
mod tray;
mod update;
mod usage;
// Application surface.
mod app;
mod bubble;
mod diagnose;
mod localization;
mod models;
mod native_interop;
mod panel;
mod poller;
mod settings;
mod theme;
mod tray_icon;
mod updater;
fn main() {
let args: Vec<String> = std::env::args().collect();
let diagnose_enabled = args.iter().any(|a| a == "--diagnose");
if diagnose_enabled {
if let Ok(path) = diagnose::init() {
diagnose::log(format!(
"startup args={args:?} log_path={}",
path.display()
));
if let Ok(Some(path)) = diag::init(true) {
log::info!("startup args={args:?} log_path={}", path.display());
}
}
if let Some(exit_code) = updater::handle_cli_mode(&args) {
if let Some(exit_code) = update::run_cli(&args) {
if diagnose_enabled {
diagnose::log(format!("cli mode exited with code {exit_code}"));
log::info!("cli mode exited with code {exit_code}");
}
std::process::exit(exit_code);
}
if diagnose_enabled {
diagnose::log("entering app::run");
log::info!("entering app::run");
}
app::run();
}