fix: resolved AI/OAuth helper duplication via shared modules
- Standardized missing-file read errors and now return `File not found: <path>` for absent edit targets. - Centralized AI provider, usage, and OAuth helpers into shared modules to remove duplicated logic. - Migrated OAuth/API-key login flows to shared factory helpers and removed inline prompt/token-exchange code. - Reused shared tools and formatter utilities for discovery, stream tails, LSP batching, and source formatting. - Consolidated repeated test helpers and fixtures into shared modules, replacing inline helper duplicates.
This commit is contained in:
@@ -4,21 +4,10 @@ import * as fs from "node:fs/promises";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { AgentStorage } from "../src/session/agent-storage";
|
||||
import { readTableSql } from "./helpers/sqlite-inspect";
|
||||
|
||||
const LEGACY_TIMESTAMP = 1_700_000_000;
|
||||
|
||||
function readTableSql(dbPath: string, tableName: string): string | null {
|
||||
const db = new Database(dbPath, { readonly: true });
|
||||
try {
|
||||
const row = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?").get(tableName) as
|
||||
| { sql?: string | null }
|
||||
| undefined;
|
||||
return row?.sql ?? null;
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
|
||||
function readSchemaVersion(dbPath: string): number | null {
|
||||
const db = new Database(dbPath, { readonly: true });
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user