fix: exclude .laputa-cache.json and settings.json from vault git tracking
These files are machine-specific and should never be committed or cause conflicts when syncing vaults across devices. Changes: - init_repo() now writes .gitignore with .laputa-cache.json and .laputa/settings.json excluded before the first commit - .DS_Store and common editor artifacts also excluded - openConflictFileRef falls back to openLocalFile() for non-note files so 'Open in editor' works for .json conflict files (opens in system default app, e.g. TextEdit/VS Code) - Removed stale git.rs (replaced by git/mod.rs from refactor) - 2 new Rust tests for .gitignore creation behavior
This commit is contained in:
@@ -45,6 +45,7 @@ import { isTauri, mockInvoke } from './mock-tauri'
|
||||
import type { SidebarSelection, VaultEntry } from './types'
|
||||
import type { NoteListItem } from './utils/ai-context'
|
||||
import { filterEntries } from './utils/noteListHelpers'
|
||||
import { openLocalFile } from './utils/url'
|
||||
import './App.css'
|
||||
|
||||
// Type declaration for mock content storage
|
||||
@@ -287,8 +288,13 @@ function App() {
|
||||
const fullPath = `${resolvedPath}/${relativePath}`
|
||||
const entry = vault.entries.find(e => e.path === fullPath)
|
||||
if (entry) {
|
||||
// Markdown note — open inside Laputa editor
|
||||
notes.handleSelectNote(entry)
|
||||
dialogs.closeConflictResolver()
|
||||
} else {
|
||||
// Non-note file (e.g. .laputa-cache.json, settings.json) —
|
||||
// open with system default app so the user can inspect/edit it
|
||||
openLocalFile(fullPath)
|
||||
}
|
||||
}
|
||||
}, [resolvedPath, vault.entries, notes, dialogs])
|
||||
|
||||
@@ -22,3 +22,11 @@ export async function openExternalUrl(url: string): Promise<void> {
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
/** Open a local file path with the system default app (e.g. TextEdit for .json). */
|
||||
export async function openLocalFile(absolutePath: string): Promise<void> {
|
||||
if (isTauri()) {
|
||||
const { openPath } = await import('@tauri-apps/plugin-opener')
|
||||
await openPath(absolutePath)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user