Manages SQLite database for gene capsules with schema migrations, indices for failure codes and q-values, and storage for coding pattern strategies and hints.
import Database from 'better-sqlite3';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
export const HELIX_DIR = path.join(os.homedir(), '.helix');
export const GENE_MAP_DB_PATH = path.join(HELIX_DIR, 'gene-map.db');
/**
* Create the coding-capsule table if it does not already exist.
* Idempotent โ safe to call on every open.
*/
function ensureSchema(db: Database.Database): void {
db.exec(`CREATE TABLE IF NOT EXISTS gene_capsules_coding (
id INTEGER PRIMARY KEY AUTOINCREMENT,
failure_code TEXT NOT NULL,
category TEXT NOT NULL DEFAULT 'coding',
pattern TEXT,
typical_files TEXT,
issue_keywords TEXT,
strategy TEXT NOT NULL,
hint TEXT NOT NULL,
example_fix TEXT,
q_value REAL DEFAULT 0.5,
success_count INTEGER D
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key