Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:37:38.006Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

main.rs

53 lines · 1.5 KB · rust
1use std::{
2    path::Path,
3    sync::{Arc, atomic::AtomicUsize},
4};
5
6use fs::RealFs;
7use settings::WorktreeId;
8use worktree::Worktree;
9
10fn main() {
11    let Some(worktree_root_path) = std::env::args().nth(1) else {
12        println!(
13            "Missing path to worktree root\nUsage: bench_background_scan PATH_TO_WORKTREE_ROOT"
14        );
15        return;
16    };
17    let app = gpui_platform::headless();
18
19    app.run(|cx| {
20        settings::init(cx);
21        let fs = Arc::new(RealFs::new(None, cx.background_executor().clone()));
22
23        cx.spawn(async move |cx| {
24            let worktree = Worktree::local(
25                Path::new(&worktree_root_path),
26                true,
27                fs,
28                Arc::new(AtomicUsize::new(0)),
29                true,
30                WorktreeId::from_proto(0),
31                cx,
32            )
33            .await
34            .expect("Worktree initialization to succeed");
35            let did_finish_scan =
36                worktree.update(cx, |this, _| this.as_local().unwrap().scan_complete());
37            let start = std::time::Instant::now();
38            did_finish_scan.await;
39            let elapsed = start.elapsed();
40            let (files, directories) =
41                worktree.read_with(cx, |this, _| (this.file_count(), this.dir_count()));
42            println!(
43                "{:?} for {directories} directories and {files} files",
44                elapsed
45            );
46            cx.update(|cx| {
47                cx.quit();
48            })
49        })
50        .detach();
51    })
52}
53
Served at tenant.openagents/omega Member data and write actions are omitted.