chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -4,10 +4,7 @@ import path from "node:path";
import type { DatabaseSync } from "node:sqlite";
import chokidar, { type FSWatcher } from "chokidar";
import {
resolveAgentDir,
resolveAgentWorkspaceDir,
} from "../agents/agent-scope.js";
import { resolveAgentDir, resolveAgentWorkspaceDir } from "../agents/agent-scope.js";
import type { ResolvedMemorySearchConfig } from "../agents/memory-search.js";
import { resolveMemorySearchConfig } from "../agents/memory-search.js";
import type { ClawdbotConfig } from "../config/config.js";
@@ -216,9 +213,7 @@ export class MemoryIndexManager {
const files = this.db.prepare(`SELECT COUNT(*) as c FROM files`).get() as {
c: number;
};
const chunks = this.db
.prepare(`SELECT COUNT(*) as c FROM chunks`)
.get() as {
const chunks = this.db.prepare(`SELECT COUNT(*) as c FROM chunks`).get() as {
c: number;
};
return {
@@ -230,9 +225,7 @@ export class MemoryIndexManager {
provider: this.provider.id,
model: this.provider.model,
requestedProvider: this.requestedProvider,
fallback: this.fallbackReason
? { from: "local", reason: this.fallbackReason }
: undefined,
fallback: this.fallbackReason ? { from: "local", reason: this.fallbackReason } : undefined,
};
}
@@ -342,9 +335,7 @@ export class MemoryIndexManager {
embedding: number[];
}> {
const rows = this.db
.prepare(
`SELECT path, start_line, end_line, text, embedding FROM chunks WHERE model = ?`,
)
.prepare(`SELECT path, start_line, end_line, text, embedding FROM chunks WHERE model = ?`)
.all(this.provider.model) as Array<{
path: string;
start_line: number;
@@ -381,9 +372,9 @@ export class MemoryIndexManager {
const activePaths = new Set(fileEntries.map((entry) => entry.path));
for (const entry of fileEntries) {
const record = this.db
.prepare(`SELECT hash FROM files WHERE path = ?`)
.get(entry.path) as { hash: string } | undefined;
const record = this.db.prepare(`SELECT hash FROM files WHERE path = ?`).get(entry.path) as
| { hash: string }
| undefined;
if (!needsFullReindex && record?.hash === entry.hash) {
continue;
}
@@ -414,9 +405,9 @@ export class MemoryIndexManager {
}
private readMeta(): MemoryIndexMeta | null {
const row = this.db
.prepare(`SELECT value FROM meta WHERE key = ?`)
.get(META_KEY) as { value: string } | undefined;
const row = this.db.prepare(`SELECT value FROM meta WHERE key = ?`).get(META_KEY) as
| { value: string }
| undefined;
if (!row?.value) return null;
try {
return JSON.parse(row.value) as MemoryIndexMeta;
@@ -437,9 +428,7 @@ export class MemoryIndexManager {
private async indexFile(entry: MemoryFileEntry) {
const content = await fs.readFile(entry.absPath, "utf-8");
const chunks = chunkMarkdown(content, this.settings.chunking);
const embeddings = await this.provider.embedBatch(
chunks.map((chunk) => chunk.text),
);
const embeddings = await this.provider.embedBatch(chunks.map((chunk) => chunk.text));
const now = Date.now();
this.db.prepare(`DELETE FROM chunks WHERE path = ?`).run(entry.path);
for (let i = 0; i < chunks.length; i++) {