MCPcopy Create free account
hub / github.com/douglance/devsql / load_history

Method load_history

crates/devsql/src/engine.rs:115–149  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

113 // --- Table loaders ---
114
115 fn load_history(&mut self) -> Result<()> {
116 // Create history table
117 self.conn.execute(
118 "CREATE TABLE IF NOT EXISTS history (
119 rowid INTEGER PRIMARY KEY,
120 display TEXT,
121 timestamp TEXT,
122 project TEXT
123 )",
124 [],
125 )?;
126
127 // Load from ccql's history.jsonl
128 let history_path = self.claude_data_dir.join("history.jsonl");
129 if history_path.exists() {
130 let content = std::fs::read_to_string(&history_path)?;
131 for line in content.lines() {
132 if let Ok(entry) = serde_json::from_str::<Value>(line) {
133 let display = entry.get("display").and_then(|v| v.as_str()).unwrap_or("");
134 let timestamp = entry
135 .get("timestamp")
136 .map(|v| v.to_string())
137 .unwrap_or_default();
138 let project = entry.get("project").and_then(|v| v.as_str()).unwrap_or("");
139
140 self.conn.execute(
141 "INSERT INTO history (display, timestamp, project) VALUES (?1, ?2, ?3)",
142 params![display, timestamp, project],
143 )?;
144 }
145 }
146 }
147
148 Ok(())
149 }
150
151 /// Build a ccql Config for transcript discovery (None when the Claude
152 /// data directory does not exist).

Callers 1

load_claude_tablesMethod · 0.80

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected