mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
- Rename 20 crate directories lib/crates/arc-* → fabro-* - Update all Cargo.toml: crate names, dep paths, feature flags, bin name - Rename arc_server module → fabro_server in fabro-llm - ArcError → FabroError across 30+ files - ARC_VERSION/ARC_GIT_SHA/ARC_BUILD_DATE → FABRO_* constants - All use/qualified paths: arc_agent:: → fabro_agent::, etc. (~1500 occurrences) - Env vars ARC_* → FABRO_* in string literals and shell scripts - String literals: X-Arc-Demo, arc-bot, arc@local, arc-web, arc-mcp, etc. - Path strings: .arc/ → .fabro/, arc.toml → fabro.toml, refs/arc/ → refs/fabro/ - arc-api.yaml → fabro-api.yaml (OpenAPI spec) - skills/arc-create-workflow → fabro-create-workflow - trycmd fixtures: $ arc → $ fabro - Inline snapshots (insta) updated - CI, Docker, install.sh, scripts, CLAUDE.md, AGENTS.md - TypeScript app: env vars, headers, JWT issuer - Docs: page slugs, git refs, config paths, sandbox names, repo URLs - Repo references: brynary/arc → fabro-sh/fabro Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
802 B
TypeScript
29 lines
802 B
TypeScript
import Database from "better-sqlite3";
|
|
import path from "node:path";
|
|
import os from "node:os";
|
|
import fs from "node:fs";
|
|
|
|
let db: Database.Database | null = null;
|
|
|
|
export function getDatabase(): Database.Database {
|
|
if (db) return db;
|
|
|
|
const fabroDir = path.join(os.homedir(), ".fabro");
|
|
fs.mkdirSync(fabroDir, { recursive: true });
|
|
|
|
db = new Database(path.join(fabroDir, "fabro-web.db"));
|
|
db.pragma("journal_mode = WAL");
|
|
|
|
db.exec(`
|
|
CREATE TABLE IF NOT EXISTS web_sessions (
|
|
id TEXT PRIMARY KEY,
|
|
user_url TEXT NOT NULL,
|
|
data TEXT NOT NULL,
|
|
expires_at INTEGER
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_web_sessions_user_url ON web_sessions (user_url);
|
|
CREATE INDEX IF NOT EXISTS idx_web_sessions_expires_at ON web_sessions (expires_at);
|
|
`);
|
|
|
|
return db;
|
|
}
|