2026-02-20 22:55:49 +01:00
|
|
|
pub mod ai_chat;
|
2026-03-01 19:49:58 +01:00
|
|
|
pub mod claude_cli;
|
refactor: split Rust backend into sub-modules — git, theme, github, frontmatter, commands
- git.rs (1907 lines) → 7 files: mod, history, status, commit, remote, conflict, pulse
- theme.rs (1075 lines) → 4 files: mod, defaults, seed, create
- github.rs (886 lines) → 4 files: mod, api, auth, clone
- frontmatter.rs (827 lines) → 3 files: mod, yaml, ops
- lib.rs (772 lines) → lib.rs (160) + commands.rs (650)
484 tests pass, clippy clean, rustfmt clean, coverage 85.42%
2026-03-06 13:16:32 +01:00
|
|
|
mod commands;
|
2026-02-17 12:05:39 +01:00
|
|
|
pub mod frontmatter;
|
2026-02-15 12:54:11 +01:00
|
|
|
pub mod git;
|
2026-02-22 17:40:20 +01:00
|
|
|
pub mod github;
|
feat: auto-index vault on open + qmd auto-install + status bar progress
Search now works out of the box on any vault without manual qmd
installation. On vault open, the app checks the index status and
auto-triggers background indexing (qmd update + embed) when needed.
If qmd is not installed, it auto-installs via bun.
Changes:
- New indexing.rs module: find_qmd_binary (cached), check_index_status,
ensure_collection, run_full_index with progress callbacks,
run_incremental_update, auto_install_qmd
- search.rs: delegates to indexing::find_qmd_binary (removes duplication)
- lib.rs: new Tauri commands (get_index_status, start_indexing,
trigger_incremental_index)
- useIndexing hook: auto-triggers on vault open, listens for
indexing-progress events, auto-dismisses complete state after 5s
- StatusBar: IndexingBadge shows phase + progress counts with spinner
- App.tsx: wires up useIndexing, triggers incremental index on file save
- design/search-bundle-qmd.pen: documents indexing progress UI states
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 02:27:50 +01:00
|
|
|
pub mod indexing;
|
2026-02-28 20:11:52 +01:00
|
|
|
pub mod mcp;
|
2026-02-22 18:44:54 +01:00
|
|
|
pub mod menu;
|
feat: full-text search with qmd backend and SearchPanel UI (Cmd+Shift+F) (#64)
* feat: add search backend (qmd CLI) and design file
- Add search.rs: qmd integration for keyword (BM25), semantic (vsearch),
and hybrid search modes via CLI JSON output
- Register search_vault Tauri command in lib.rs
- Design file with 3 frames: empty, results, no-results states
- Fix pre-existing test failures: install @tauri-apps/plugin-opener,
add mock in test setup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add SearchPanel UI with Cmd+Shift+F shortcut
- SearchPanel component: full-text search overlay with keyword/semantic
mode toggle, debounced search (200ms), arrow key navigation, result
count + elapsed time display, note type badges from vault entries
- Cmd+Shift+F shortcut registered in useAppKeyboard
- Mock search_vault handler in mock-tauri for browser dev mode
- SearchResult/SearchResponse types in types.ts
- Tests: 15 new tests for SearchPanel + 2 for keyboard shortcut
- scrollIntoView mock in test setup for jsdom compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: correct SearchPanel imports for Tauri/browser dual-mode
Use invoke from @tauri-apps/api/core and mockInvoke from mock-tauri
with a searchCall wrapper, fixing the TypeScript build error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: make test_detect_collection_fallback robust when qmd not installed
* fix: reset localStorage between App tests to prevent view mode state leak
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 17:09:50 +01:00
|
|
|
pub mod search;
|
2026-02-22 13:33:32 +01:00
|
|
|
pub mod settings;
|
feat: vault-native theming system with live reload (#154)
* feat: add theming system design file with 3 frames
Design frames for Settings > Appearance panel, Command Palette
theme switching, and live theme editing flow visualization.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add Rust backend for vault-native theming system
Theme files live in _themes/*.json with colors, typography, and spacing
sections. Vault-level settings (.laputa/settings.json) store the active
theme. Built-in themes (default, dark, minimal) are seeded on vault
creation. All 6 Tauri commands registered: list_themes, get_theme,
get_vault_settings, save_vault_settings, set_active_theme, create_theme.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add frontend theme engine, settings UI, and command palette integration
Wire up useThemeManager hook to load themes via Tauri IPC, apply CSS
custom properties to :root, and support switching/creating themes.
Add Appearance section to Settings panel with color swatches and theme
cards. Register theme switch and create commands in the command registry.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use .to_string() instead of format! for string literal (clippy)
* style: cargo fmt on theme.rs
---------
Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 23:05:14 +01:00
|
|
|
pub mod theme;
|
2026-02-14 18:20:07 +01:00
|
|
|
pub mod vault;
|
2026-03-05 15:05:57 +01:00
|
|
|
pub mod vault_config;
|
2026-03-03 00:41:46 +01:00
|
|
|
pub mod vault_list;
|
2026-02-14 18:20:07 +01:00
|
|
|
|
2026-02-28 20:11:52 +01:00
|
|
|
use std::process::Child;
|
|
|
|
|
use std::sync::Mutex;
|
refactor: split vault.rs into focused submodules
Break the 2338-line vault.rs into vault/ directory with 6 focused modules:
- mod.rs: core types (VaultEntry, Frontmatter), parse_md_file, scan_vault
- parsing.rs: text processing (snippet extraction, markdown stripping, date parsing)
- cache.rs: git-based incremental vault caching
- trash.rs: purge_trash with flat iterator chain
- rename.rs: note renaming with wikilink updates
- image.rs: attachment saving with filename sanitization
Also moves frontmatter update/delete wrappers to frontmatter.rs where they
belong, and converts public functions to accept &Path instead of &str.
CodeScene scores: mod.rs 10.0, parsing.rs 9.68, cache.rs 9.68,
trash.rs 9.38, rename.rs 9.68, image.rs 10.0 (all above 9.0 target).
All 169 Rust tests pass, 86.28% line coverage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 20:16:21 +01:00
|
|
|
|
2026-02-28 20:11:52 +01:00
|
|
|
struct WsBridgeChild(Mutex<Option<Child>>);
|
|
|
|
|
|
2026-02-25 13:31:25 +01:00
|
|
|
fn log_startup_result(label: &str, result: Result<usize, String>) {
|
|
|
|
|
match result {
|
|
|
|
|
Ok(n) if n > 0 => log::info!("{}: {} files", label, n),
|
|
|
|
|
Err(e) => log::warn!("{}: {}", label, e),
|
|
|
|
|
_ => {}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Run startup housekeeping on the default vault (purge old trash, migrate legacy frontmatter).
|
|
|
|
|
fn run_startup_tasks() {
|
|
|
|
|
let vault_path = dirs::home_dir()
|
|
|
|
|
.map(|h| h.join("Laputa"))
|
|
|
|
|
.unwrap_or_default();
|
|
|
|
|
if !vault_path.is_dir() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let vp_str = vault_path.to_str().unwrap_or_default();
|
|
|
|
|
log_startup_result(
|
|
|
|
|
"Purged trashed files on startup",
|
|
|
|
|
vault::purge_trash(vp_str).map(|d| d.len()),
|
|
|
|
|
);
|
|
|
|
|
log_startup_result(
|
|
|
|
|
"Migrated is_a to type on startup",
|
|
|
|
|
vault::migrate_is_a_to_type(vp_str),
|
|
|
|
|
);
|
2026-02-28 20:11:52 +01:00
|
|
|
|
2026-03-02 21:05:20 +01:00
|
|
|
// Seed _themes/ with built-in JSON themes (legacy) if missing
|
2026-03-01 00:32:32 +01:00
|
|
|
theme::seed_default_themes(vp_str);
|
2026-03-02 21:05:20 +01:00
|
|
|
// Seed theme/ with built-in vault theme notes if missing
|
|
|
|
|
theme::seed_vault_themes(vp_str);
|
2026-03-01 00:32:32 +01:00
|
|
|
|
2026-02-28 20:11:52 +01:00
|
|
|
// Register Laputa MCP server in Claude Code and Cursor configs
|
|
|
|
|
match mcp::register_mcp(vp_str) {
|
|
|
|
|
Ok(status) => log::info!("MCP registration: {status}"),
|
|
|
|
|
Err(e) => log::warn!("MCP registration failed: {e}"),
|
|
|
|
|
}
|
2026-02-25 13:31:25 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-03 00:41:46 +01:00
|
|
|
fn spawn_ws_bridge(app: &mut tauri::App) {
|
|
|
|
|
use tauri::Manager;
|
|
|
|
|
let vault_path = dirs::home_dir()
|
|
|
|
|
.map(|h| h.join("Laputa"))
|
|
|
|
|
.unwrap_or_default();
|
|
|
|
|
let vp_str = vault_path.to_string_lossy().to_string();
|
|
|
|
|
match mcp::spawn_ws_bridge(&vp_str) {
|
|
|
|
|
Ok(child) => {
|
|
|
|
|
let state: tauri::State<'_, WsBridgeChild> = app.state();
|
|
|
|
|
*state.0.lock().unwrap() = Some(child);
|
|
|
|
|
}
|
|
|
|
|
Err(e) => log::warn!("Failed to start ws-bridge: {}", e),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-14 18:20:07 +01:00
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
|
pub fn run() {
|
|
|
|
|
tauri::Builder::default()
|
2026-02-28 20:11:52 +01:00
|
|
|
.manage(WsBridgeChild(Mutex::new(None)))
|
2026-02-14 18:20:07 +01:00
|
|
|
.setup(|app| {
|
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
|
app.handle().plugin(
|
|
|
|
|
tauri_plugin_log::Builder::default()
|
|
|
|
|
.level(log::LevelFilter::Info)
|
|
|
|
|
.build(),
|
|
|
|
|
)?;
|
|
|
|
|
}
|
2026-02-21 17:14:02 +01:00
|
|
|
|
2026-02-23 14:42:39 +01:00
|
|
|
app.handle().plugin(tauri_plugin_dialog::init())?;
|
|
|
|
|
|
2026-02-22 12:10:24 +01:00
|
|
|
#[cfg(desktop)]
|
|
|
|
|
{
|
feat: auto-build, GitHub Release, and in-app updater (#14)
* ci: auto-release workflow on merge to main
Rewrite .github/workflows/release.yml to trigger on every push to main
instead of manual tag pushes. The workflow now:
- Computes version as 0.YYYYMMDD.GITHUB_RUN_NUMBER
- Builds aarch64-apple-darwin and x86_64-apple-darwin in parallel
- Merges them into a universal binary using lipo
- Creates a universal .dmg and signed updater tarball
- Generates latest.json with per-arch and universal platform entries
- Publishes a GitHub Release with auto-generated release notes
- Updates a GitHub Pages release history site (gh-pages branch)
Product decisions:
- Universal binary approach: copy arm64 .app as base, lipo the main
executable, keep everything else from arm64 (shared frameworks are
architecture-independent). This is the standard Tauri pattern.
- Per-arch updater tarballs are also uploaded so the Tauri updater can
download the correct arch-specific build (smaller download).
- Release notes are auto-generated from git log since last tag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: github pages with release history
Use peaceiris/actions-gh-pages@v4 to deploy a release history site.
The page fetches releases.json (also deployed) and renders each release
with date, notes, and download links for .dmg files.
This handles the gh-pages branch creation automatically on first run.
The page is available at https://refactoringhq.github.io/laputa-app/
Product decision: used fetch() to load releases.json at runtime instead
of inlining it, which is cleaner and avoids shell escaping issues with
release note content. The releases.json is deployed alongside index.html.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: in-app update notification UI
Replace the old window.confirm updater with a proper React-based
update notification system:
- useUpdater hook now exposes state machine (idle → available →
downloading → ready) and actions (startDownload, openReleaseNotes,
dismiss)
- UpdateBanner component renders at the top of the app shell:
- "Available" state: shows version, Release Notes link, Update Now
button, dismiss X
- "Downloading" state: animated spinner, progress bar with percentage
- "Ready" state: Restart Now button to apply the update
- Silently checks on startup after 3s delay; fails silently on
network errors or 404
- Release Notes link opens the GitHub Pages release history site
Product decisions:
- Banner at top of app (not a modal) — non-intrusive, visible but
not blocking. User can dismiss and continue working.
- Progress bar shows during download so user knows it's working.
- Separate "Restart Now" state after download so user controls when
the app restarts (they may have unsaved work).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: updater component tests
Rewrite useUpdater hook tests and add UpdateBanner component tests:
Hook tests (10 cases):
- Starts in idle state
- Does nothing when not in Tauri
- Checks for updates after 3s delay
- Stays idle when no update available
- Transitions to available when update found
- Handles missing release body gracefully
- Stays idle on network error (fails silently)
- Dismiss returns to idle
- openReleaseNotes opens correct URL
- startDownload transitions through downloading to ready
Component tests (10 cases):
- Renders nothing when idle
- Renders nothing on error
- Shows version and buttons when available
- Update Now calls startDownload
- Release Notes calls openReleaseNotes
- Dismiss button works
- Shows progress bar during download
- Shows 0% at start of download
- Shows restart button when ready
- Restart button calls restartApp
All 457 tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: auto-build-release wireframes
Copy ui-design.pen as base. Frames to be added for:
1. Update notification banner (visible state) — horizontal bar at
top of app shell with version text, Release Notes link, Update
Now button, and dismiss X
2. Update download progress state — spinner icon, progress bar with
percentage, downloading text
3. "Restart to apply" state — green accent, version text, Restart
Now button
Note: Pencil editor was not available during this session. The base
design file is committed; frames will be added when the editor is
accessible. The implemented component (UpdateBanner.tsx) serves as
the source of truth for the design.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update ARCHITECTURE.md with release/update system
Add comprehensive documentation for:
- Release pipeline (4-phase workflow: version → build → release → pages)
- Versioning scheme (0.YYYYMMDD.RUN_NUMBER)
- Universal binary strategy (lipo merge)
- Updater endpoint and latest.json manifest
- In-app update UI state machine
- GitHub Pages release history site
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: rustfmt formatting
* fix: rustfmt build.rs
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:50:36 +01:00
|
|
|
app.handle()
|
|
|
|
|
.plugin(tauri_plugin_updater::Builder::new().build())?;
|
2026-02-22 12:10:24 +01:00
|
|
|
app.handle().plugin(tauri_plugin_process::init())?;
|
2026-02-24 22:20:33 +01:00
|
|
|
app.handle().plugin(tauri_plugin_opener::init())?;
|
2026-02-22 18:44:54 +01:00
|
|
|
menu::setup_menu(app)?;
|
2026-02-22 12:10:24 +01:00
|
|
|
}
|
|
|
|
|
|
2026-02-25 13:31:25 +01:00
|
|
|
run_startup_tasks();
|
2026-03-03 00:41:46 +01:00
|
|
|
spawn_ws_bridge(app);
|
2026-02-14 18:20:07 +01:00
|
|
|
Ok(())
|
|
|
|
|
})
|
2026-02-15 12:54:11 +01:00
|
|
|
.invoke_handler(tauri::generate_handler![
|
refactor: split Rust backend into sub-modules — git, theme, github, frontmatter, commands
- git.rs (1907 lines) → 7 files: mod, history, status, commit, remote, conflict, pulse
- theme.rs (1075 lines) → 4 files: mod, defaults, seed, create
- github.rs (886 lines) → 4 files: mod, api, auth, clone
- frontmatter.rs (827 lines) → 3 files: mod, yaml, ops
- lib.rs (772 lines) → lib.rs (160) + commands.rs (650)
484 tests pass, clippy clean, rustfmt clean, coverage 85.42%
2026-03-06 13:16:32 +01:00
|
|
|
commands::list_vault,
|
|
|
|
|
commands::get_note_content,
|
|
|
|
|
commands::save_note_content,
|
|
|
|
|
commands::update_frontmatter,
|
|
|
|
|
commands::delete_frontmatter_property,
|
|
|
|
|
commands::rename_note,
|
|
|
|
|
commands::get_file_history,
|
|
|
|
|
commands::get_modified_files,
|
|
|
|
|
commands::get_file_diff,
|
|
|
|
|
commands::get_file_diff_at_commit,
|
|
|
|
|
commands::get_vault_pulse,
|
|
|
|
|
commands::git_commit,
|
|
|
|
|
commands::get_build_number,
|
|
|
|
|
commands::get_last_commit_info,
|
|
|
|
|
commands::git_pull,
|
|
|
|
|
commands::git_push,
|
|
|
|
|
commands::get_conflict_files,
|
|
|
|
|
commands::get_conflict_mode,
|
|
|
|
|
commands::git_resolve_conflict,
|
|
|
|
|
commands::git_commit_conflict_resolution,
|
|
|
|
|
commands::ai_chat,
|
|
|
|
|
commands::check_claude_cli,
|
|
|
|
|
commands::stream_claude_chat,
|
|
|
|
|
commands::stream_claude_agent,
|
|
|
|
|
commands::save_image,
|
|
|
|
|
commands::copy_image_to_vault,
|
|
|
|
|
commands::purge_trash,
|
|
|
|
|
commands::delete_note,
|
|
|
|
|
commands::migrate_is_a_to_type,
|
|
|
|
|
commands::batch_archive_notes,
|
|
|
|
|
commands::batch_trash_notes,
|
|
|
|
|
commands::get_settings,
|
|
|
|
|
commands::update_menu_state,
|
|
|
|
|
commands::save_settings,
|
|
|
|
|
commands::load_vault_list,
|
|
|
|
|
commands::save_vault_list,
|
|
|
|
|
commands::github_list_repos,
|
|
|
|
|
commands::github_create_repo,
|
|
|
|
|
commands::clone_repo,
|
|
|
|
|
commands::github_device_flow_start,
|
|
|
|
|
commands::github_device_flow_poll,
|
|
|
|
|
commands::github_get_user,
|
|
|
|
|
commands::search_vault,
|
|
|
|
|
commands::get_index_status,
|
|
|
|
|
commands::start_indexing,
|
|
|
|
|
commands::trigger_incremental_index,
|
|
|
|
|
commands::create_getting_started_vault,
|
|
|
|
|
commands::check_vault_exists,
|
|
|
|
|
commands::get_default_vault_path,
|
|
|
|
|
commands::register_mcp_tools,
|
|
|
|
|
commands::check_mcp_status,
|
|
|
|
|
commands::list_themes,
|
|
|
|
|
commands::get_theme,
|
|
|
|
|
commands::get_vault_settings,
|
|
|
|
|
commands::save_vault_settings,
|
|
|
|
|
commands::set_active_theme,
|
|
|
|
|
commands::create_theme,
|
|
|
|
|
commands::create_vault_theme,
|
|
|
|
|
commands::ensure_vault_themes,
|
|
|
|
|
commands::restore_default_themes,
|
|
|
|
|
commands::get_vault_config,
|
|
|
|
|
commands::save_vault_config
|
2026-02-15 12:54:11 +01:00
|
|
|
])
|
2026-02-28 20:11:52 +01:00
|
|
|
.build(tauri::generate_context!())
|
|
|
|
|
.expect("error while building tauri application")
|
|
|
|
|
.run(|app_handle, event| {
|
|
|
|
|
use tauri::Manager;
|
|
|
|
|
if let tauri::RunEvent::Exit = event {
|
|
|
|
|
let state: tauri::State<'_, WsBridgeChild> = app_handle.state();
|
|
|
|
|
let mut guard = state.0.lock().unwrap();
|
|
|
|
|
if let Some(ref mut child) = *guard {
|
|
|
|
|
let _ = child.kill();
|
|
|
|
|
log::info!("ws-bridge child process killed on exit");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-02-14 18:20:07 +01:00
|
|
|
}
|