Skip to content

Commit 4db952c

Browse files
committed
Merging branches
2 parents 16eb388 + 544fc92 commit 4db952c

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# GRIMOIRE
1+
# G.R.I.M.O.I.R.E.
22

33
**G**lobal **R**epository and **I**ndex for **M**odel **O**perations, **I**nstructions and **R**esponse **E**ngineering
44

@@ -7,6 +7,8 @@ A terminal user interface (TUI) application for managing prompts, agents, and sk
77
![Rust](https://img.shields.io/badge/rust-2024-orange.svg)
88
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
99

10+
![grimoire](./grimoire.gif)
11+
1012
## Features
1113

1214
- Manage and organize your LLM prompts in a searchable database

grimoire.gif

5.63 MB
Loading

scripts/generate_fixtures.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@
33
# Generate fixture data for GRIMOIRE
44
# Creates 200 items across all categories
55

6-
DB_PATH="${HOME}/.local/share/grimoire/grimoire.db"
6+
# Detect OS and set appropriate database path
7+
case "$(uname -s)" in
8+
Darwin)
9+
DB_PATH="${HOME}/Library/Application Support/grimoire/grimoire.db"
10+
;;
11+
Linux)
12+
DB_PATH="${HOME}/.local/share/grimoire/grimoire.db"
13+
;;
14+
MINGW*|MSYS*|CYGWIN*)
15+
DB_PATH="${APPDATA}/grimoire/grimoire.db"
16+
;;
17+
*)
18+
echo "Unsupported OS: $(uname -s)"
19+
exit 1
20+
;;
21+
esac
722

823
# Check if database exists
924
if [ ! -f "$DB_PATH" ]; then

src/db/schema.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,9 @@ impl Database {
2121
Ok(db)
2222
}
2323

24-
fn db_path() -> Result<PathBuf> {
25-
// Use local database in project directory during development
26-
#[cfg(debug_assertions)]
27-
{
28-
return Ok(PathBuf::from("grimoire-dev.db"));
29-
}
30-
31-
#[cfg(not(debug_assertions))]
32-
{
33-
let proj_dirs = directories::ProjectDirs::from("", "", "grimoire")
34-
.ok_or_else(|| color_eyre::eyre::eyre!("Could not determine home directory"))?;
24+
pub fn db_path() -> Result<PathBuf> {
25+
let proj_dirs = directories::ProjectDirs::from("", "", "grimoire")
26+
.ok_or_else(|| color_eyre::eyre::eyre!("Could not determine home directory"))?;
3527

3628
Ok(proj_dirs.data_dir().join("grimoire.db"))
3729
}

src/ui/settings_screen.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::db::Database;
12
use ratatui::{
23
layout::{Constraint, Direction, Layout, Rect},
34
style::{Color, Modifier, Style},
@@ -275,12 +276,12 @@ fn draw_content(frame: &mut Frame, area: Rect, state: &SettingsState) -> Rect {
275276
let data_inner = data_block.inner(chunks[2]);
276277
frame.render_widget(data_block, chunks[2]);
277278

279+
let db_path = Database::db_path()
280+
.map(|p| p.display().to_string())
281+
.unwrap_or_else(|_| "unknown".to_string());
278282
let data_info = Paragraph::new(vec![Line::from(vec![
279283
Span::styled("Database: ", Style::default().fg(Color::Yellow)),
280-
Span::styled(
281-
"~/.local/share/grimoire/grimoire.db",
282-
Style::default().fg(Color::DarkGray),
283-
),
284+
Span::styled(db_path, Style::default().fg(Color::DarkGray)),
284285
])]);
285286
frame.render_widget(data_info, data_inner);
286287

0 commit comments

Comments
 (0)