feat: replace 'Is a' / 'is_a' with 'type' as the canonical frontmatter key
- Rust Frontmatter struct now parses both 'type' (new) and 'Is A'/'is_a' (legacy), with 'type' taking precedence via resolve_type() - Added migrate_is_a_to_type() vault-wide migration (runs on startup, also exposed as Tauri command) - Frontend: buildNoteContent and resolveNewType now emit 'type:' in YAML - Inspector SKIP_KEYS hides 'is_a', 'Is A', 'type', 'title' from property list (TypeRow already renders the type with its dedicated UI) - frontmatterToEntryPatch handles both 'type' and legacy 'is_a' keys - Mock data updated: all YAML content uses 'type:' instead of 'is_a:'/'Is A:' - Tests updated to expect 'type:' in generated frontmatter Product decision: internal VaultEntry field stays as `isA` (TS) / `is_a` (Rust) to minimize blast radius. The user-facing change is the YAML key and inspector. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,11 @@ fn purge_trash(vault_path: String) -> Result<Vec<String>, String> {
|
||||
vault::purge_trash(&vault_path)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn migrate_is_a_to_type(vault_path: String) -> Result<usize, String> {
|
||||
vault::migrate_is_a_to_type(&vault_path)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn get_settings() -> Result<Settings, String> {
|
||||
settings::get_settings()
|
||||
@@ -154,7 +159,8 @@ pub fn run() {
|
||||
.map(|h| h.join("Laputa"))
|
||||
.unwrap_or_default();
|
||||
if vault_path.is_dir() {
|
||||
match vault::purge_trash(vault_path.to_str().unwrap_or_default()) {
|
||||
let vp_str = vault_path.to_str().unwrap_or_default();
|
||||
match vault::purge_trash(vp_str) {
|
||||
Ok(deleted) if !deleted.is_empty() => {
|
||||
log::info!("Purged {} trashed files on startup", deleted.len());
|
||||
}
|
||||
@@ -163,6 +169,16 @@ pub fn run() {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
// Migrate legacy is_a/Is A frontmatter to type
|
||||
match vault::migrate_is_a_to_type(vp_str) {
|
||||
Ok(n) if n > 0 => {
|
||||
log::info!("Migrated {} files from is_a to type on startup", n);
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("Failed to migrate is_a on startup: {}", e);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@@ -183,6 +199,7 @@ pub fn run() {
|
||||
ai_chat,
|
||||
save_image,
|
||||
purge_trash,
|
||||
migrate_is_a_to_type,
|
||||
get_settings,
|
||||
save_settings,
|
||||
github_list_repos,
|
||||
|
||||
Reference in New Issue
Block a user