2 views
vastsa/PI-Desktop
Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript★ 2,858+552 that day#5 on trending
3.4%duplicated code · 5,299 of 155,989 lines
499clones in code
355code files of 1,282 scanned
3.83%duplicated over all files · 1,085 clones
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code, and 2 generated files: packages/shared/src/changelog.ts, scripts/release.mjs.
Largest clones in the code
- 7 lines in 11 placesrust54 tokenscrates/host-core/src/db.rs:1645–1651crates/host-core/src/db.rs:1811–1817crates/host-core/src/db.rs:1920–1926crates/host-core/src/db.rs:2055–2061crates/host-core/src/db.rs:2162–2168and 6 more
1645fn v14_database_migrates_to_v15_with_the_turn_queue() { 1646 let dir = tempfile::tempdir().unwrap(); 1647 let path = dir.path().join("pi.sqlite"); 1648 { 1649 let db = Database::open(&path).unwrap(); 1650 db.conn() 1651 .execute_batch(1811fn migrates_v13_plugin_session_schema() { 1812 let dir = tempfile::tempdir().unwrap(); 1813 let path = dir.path().join("pi.sqlite"); 1814 { 1815 let db = Database::open(&path).unwrap(); 1816 db.conn() 1817 .execute( - 7 lines in 11 placesrust52 tokenscrates/host-core/src/rpc/mod.rs:1432–1438crates/host-core/src/rpc/mod.rs:1442–1448crates/host-core/src/rpc/mod.rs:1452–1458crates/host-core/src/rpc/mod.rs:1480–1486crates/host-core/src/rpc/mod.rs:1655–1661and 6 more
1432"providers.delete" => { 1433 let id = params 1434 .get("id") 1435 .and_then(|v| v.as_str()) 1436 .ok_or_else(|| rpc_err(1002, "id required", "INVALID_PARAMS"))?; 1437 let st = state.lock().await; 1438 let ok = providers::delete_provider(&st.db, &st.secrets, id)1442"providers.get" => { 1443 let id = params 1444 .get("id") 1445 .and_then(|v| v.as_str()) 1446 .ok_or_else(|| rpc_err(1002, "id required", "INVALID_PARAMS"))?; 1447 let st = state.lock().await; 1448 let provider = providers::get_provider(&st.db, &st.secrets, id) - 12 lines in 5 placesrust100 tokenscrates/host-core/src/rpc/mod.rs:5054–5065crates/host-core/src/rpc/mod.rs:5141–5152crates/host-core/src/rpc/mod.rs:5254–5265crates/host-core/src/rpc/mod.rs:5437–5448crates/host-core/src/rpc/mod.rs:5516–5527
5054async fn tools_abort_before_approval_cleans_the_cancellation_registry() { 5055 let Some(shell_id) = available_test_shell_id() else { 5056 return; 5057 }; 5058 let data_dir = tempfile::tempdir().unwrap(); 5059 let project = data_dir.path().join("project"); 5060 fs::create_dir_all(&project).unwrap(); 5061 let mut app_state = AppState::open(data_dir.path()).unwrap(); 5062 app_state.handshook = true; 5063 let session = sessions::create_session(First 10 of 12 lines.
7 more
- 19 lines in 4 placesrust103 tokens
- 6 lines in 7 placesrust51 tokens
- 7 lines in 5 placesrust75 tokens
- 11 lines in 6 placesrust57 tokens
- 7 lines in 5 placesrust64 tokens
- 6 lines in 4 placesrust83 tokens
- 13 lines in 3 placestsx116 tokens
Largest clones over all files, tests and data included
- 409 lines in 2 placescsstests1,343 tokens
270/* === Design System Token Bridge (spec reference, not runtime file) === */ 271/* Dark theme (default) */ 272:root[data-theme="dark"] { 273 --color-bg-primary: #181818; 274 --color-bg-secondary: #212121; 275 --color-bg-tertiary: #282828; 276 --color-bg-inset: #0d0d0d; 277 --color-text-primary: #FFFFFF; 278 --color-text-secondary: rgba(255,255,255,0.70); 279 --color-text-muted: #5d5d5d;First 10 of 409 lines.
- 295 lines in 2 placestypescripttests1,101 tokens
303 modelId?: string 304 providerId?: string 305 toolName?: string 306 toolCallId?: string 307 toolStatus?: "success" | "error" 308 toolArgs?: unknown 309 toolResult?: unknown 310 }> 311}): Promise<{ sessionId: string; imported: boolean; skipped: boolean }> 312First 10 of 295 lines.
- 446 lines in 2 placessqltests1,044 tokensdocs/spec/03-runtime/04-data-storage.md:478–923docs/zh-CN/spec/03-runtime/04-data-storage.md:447–872
478CREATE INDEX idx_turns_ended_at ON turns(ended_at DESC); 479``` 480 481### 4.6a plan_approvals — immutable checkpoint and execution fields (schema v11) 482 483The host writes each submitted Markdown snapshot to a new unique file under the 484proposal kind's directory: `<workspaceRoot>/.pi/plan/` for a plan and 485`<workspaceRoot>/.pi/goal/` for a goal. The existing `plan_approvals` row stores 486the kind, the structured title/question, artifact metadata, and post-approval 487execution descriptor. The file path is relative to the session workspace and447CREATE INDEX idx_turns_session ON turns(session_id, started_at DESC); 448``` 449 450### 4.6a plan_approvals — 不可变的检查点和执行字段(模式 v11) 451 452主机将每个提交的 Markdown 快照写入到一个新的唯一文件中 453提案类型的目录:`<workspaceRoot>/.pi/plan/` 用于计划和 454`<workspaceRoot>/.pi/goal/` 实现目标。现有 `plan_approvals` 行存储 455种类、结构化 title/question、工件元数据和批准后 456执行描述符。文件路径是相对于会话工作空间的First 10 of 446 lines, the second copy on the right.
- 90 lines in 2 placestxtdocs and examples915 tokens
- 341 lines in 2 placestypescripttests740 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| rust | 37 | 41,700 | 312 | 3,059 | 7.34% |
| typescript | 211 | 73,971 | 92 | 1,030 | 1.39% |
| tsx | 76 | 33,448 | 91 | 1,151 | 3.44% |
| javascript | 15 | 5,578 | 4 | 59 | 1.06% |
| bash | 13 | 866 | 0 | 0 | 0% |
| python | 2 | 252 | 0 | 0 | 0% |
| perl | 1 | 174 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| rust | 37 | 41,700 | 312 | 3,059 | 7.34% |
| typescript | 328 | 112,591 | 247 | 3,712 | 3.3% |
| css | 37 | 22,546 | 191 | 1,621 | 7.19% |
| tsx | 76 | 33,448 | 91 | 1,151 | 3.44% |
| javascript | 233 | 39,086 | 88 | 1,004 | 2.57% |
| markdown | 420 | 99,821 | 53 | 445 | 0.45% |
| text | 63 | 1,758 | 49 | 598 | 34.02% |
| json | 29 | 4,095 | 27 | 1,473 | 35.97% |
| markup | 8 | 2,638 | 12 | 132 | 5% |
| bash | 27 | 1,033 | 5 | 62 | 6% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Sep 12, 2026 | #5 | 2,858 (+552) | 1,282 | 361,251 | 1,085 | 3.83% | 3.4% | — | 24a2c43 |
| Sep 10, 2026 | #10 | 1,816 (+417) | 1,196 | 335,742 | 997 | 3.6% | 3.4% | — | 8ce8ed3 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.