Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a09c3d7c
Submodule agent-a09c3d7c added at a1e75e
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a327b0c2
Submodule agent-a327b0c2 added at b61747
Submodule agent-a5e65331 added at 061b96
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a51ac752
Submodule agent-a51ac752 added at 13c9a4
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a662428a
Submodule agent-a662428a added at edf380
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a802499a
Submodule agent-a802499a added at 3f27bb
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a886725f
Submodule agent-a886725f added at bf6e1b
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a8d7741c
Submodule agent-a8d7741c added at 7f4c33
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a8f0cb8d
Submodule agent-a8f0cb8d added at 49f9da
1 change: 1 addition & 0 deletions .claude/worktrees/agent-ab455ec1
Submodule agent-ab455ec1 added at 5f3520
1 change: 1 addition & 0 deletions .claude/worktrees/agent-abffe11f
Submodule agent-abffe11f added at bf6e1b
1 change: 1 addition & 0 deletions .claude/worktrees/agent-aca555c0
Submodule agent-aca555c0 added at f8ae7c
1 change: 1 addition & 0 deletions .claude/worktrees/agent-af29ee1c
Submodule agent-af29ee1c added at 015b53
1 change: 1 addition & 0 deletions .claude/worktrees/agent-af8e138d
Submodule agent-af8e138d added at bf6e1b
1 change: 1 addition & 0 deletions .claude/worktrees/feat-integration-tests
Submodule feat-integration-tests added at 3c5364
1 change: 1 addition & 0 deletions .claude/worktrees/feat-provider-tests
Submodule feat-provider-tests added at 35faeb
1 change: 1 addition & 0 deletions .claude/worktrees/feat-spider
Submodule feat-spider added at 71b1ca
1 change: 1 addition & 0 deletions .claude/worktrees/fix-error-handling
Submodule fix-error-handling added at f1c1b1
1 change: 1 addition & 0 deletions .claude/worktrees/fix-performance
Submodule fix-performance added at 9a3341
1 change: 1 addition & 0 deletions .claude/worktrees/fix-quick-wins
Submodule fix-quick-wins added at 9ac126
1 change: 1 addition & 0 deletions .claude/worktrees/fix-security
Submodule fix-security added at cc2df0
1 change: 1 addition & 0 deletions .claude/worktrees/fix-type-safety
Submodule fix-type-safety added at 26f2c4
1 change: 1 addition & 0 deletions .claude/worktrees/issue-330-cli-logging-pack-perf
Submodule issue-330-cli-logging-pack-perf added at d5dae0
1 change: 1 addition & 0 deletions .claude/worktrees/passthrough-mode
Submodule passthrough-mode added at b3f696
1 change: 1 addition & 0 deletions .claude/worktrees/refactor-cli-decompose
Submodule refactor-cli-decompose added at bb0b1e
1 change: 1 addition & 0 deletions .claude/worktrees/refactor-mcp-decompose
Submodule refactor-mcp-decompose added at 989260
9 changes: 5 additions & 4 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,16 @@ import {
syncOneNote,
disconnectOneNote,
} from "../connectors/onenote.js";
import { loadConnectorConfig, saveConnectorConfig } from "../connectors/index.js";
import { syncNotion, disconnectNotion } from "../connectors/notion.js";
import type { NotionConfig } from "../connectors/notion.js";
import { syncSlack, disconnectSlack, type SlackConfig } from "../connectors/slack.js";
import {
loadConnectorConfig,
saveConnectorConfig,
saveNamedConnectorConfig,
loadNamedConnectorConfig,
hasNamedConnectorConfig,
} from "../connectors/index.js";
import { syncNotion, disconnectNotion } from "../connectors/notion.js";
import type { NotionConfig } from "../connectors/notion.js";
import { syncSlack, disconnectSlack, type SlackConfig } from "../connectors/slack.js";
import {
createSavedSearch,
listSavedSearches,
Expand Down
2 changes: 1 addition & 1 deletion src/core/dedup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function checkDuplicate(

if (row) {
log.debug({ existingDocId: row.id }, "Exact duplicate detected via content hash");
return { isDuplicate: true, matchType: "exact", existingDocId: row.id, similarity: 1.0 };
return { isDuplicate: true, matchType: "exact", existingDocId: row.id, similarity: 1 };
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/indexing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function startChunkAtHeading(
line: string,
): { lines: string[]; length: number } {
const level = (headingMatch[1] ?? "").length;
while (headingStack.length > 0 && (headingStack[headingStack.length - 1]?.level ?? 0) >= level) {
while (headingStack.length > 0 && (headingStack.at(-1)?.level ?? 0) >= level) {
headingStack.pop();
}
const breadcrumb = headingStack.map((h) => h.text).join(" > ");
Expand Down
6 changes: 4 additions & 2 deletions src/core/parsers/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export class CsvParser implements DocumentParser {
cell.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n/g, " ");

const lines: string[] = [];
lines.push("| " + header.map(escapeCell).join(" | ") + " |");
lines.push("| " + header.map(() => "---").join(" | ") + " |");
lines.push(
"| " + header.map(escapeCell).join(" | ") + " |",
"| " + header.map(() => "---").join(" | ") + " |",
);
for (const row of rows) {
// Normalize row length to match header
const normalized = Array.from({ length: colCount }, (_, i) => row[i] ?? "");
Expand Down
9 changes: 3 additions & 6 deletions src/core/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,7 @@ function keywordSearch(
const baseParams = [...params];

sql += " LIMIT ? OFFSET ?";
params.push(limit);
params.push(offset);
params.push(limit, offset);

const KeywordRowSchema = z.object({
chunk_id: z.string(),
Expand Down Expand Up @@ -1086,8 +1085,7 @@ function fts5Search(
let baseParams = [...params];

sql += " ORDER BY rank LIMIT ? OFFSET ?";
params.push(limit);
params.push(offset);
params.push(limit, offset);

const Fts5RowSchema = z.object({
chunk_id: z.string(),
Expand Down Expand Up @@ -1140,8 +1138,7 @@ function fts5Search(
baseParams = [...orParams];

orSql += " ORDER BY rank LIMIT ? OFFSET ?";
orParams.push(limit);
orParams.push(offset);
orParams.push(limit, offset);

rows = validateRows(Fts5RowSchema, db.prepare(orSql).all(...orParams), "fts5Search.orRows");
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export function suggestTags(
for (const [term, count] of tf) {
if (existingTags.has(term)) continue;
const normalizedTf = count / maxTf;
const knownBoost = knownTags.has(term) ? 2.0 : 1.0;
const knownBoost = knownTags.has(term) ? 2 : 1;
scored.push({ term, score: normalizedTf * knownBoost });
}

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/batch-search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { describe, it, expect, beforeEach, afterEach } from "vitest";
import type Database from "better-sqlite3";
import { createTestDbWithVec } from "../fixtures/test-db.js";
import { MockEmbeddingProvider } from "../fixtures/mock-provider.js";
import { seedTestDocument } from "../fixtures/helpers.js";
import { insertChunk } from "../fixtures/helpers.js";
import { seedTestDocument, insertChunk } from "../fixtures/helpers.js";
import {
searchBatch,
BATCH_SEARCH_MAX_REQUESTS,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/dedup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("dedup", () => {

expect(result.isDuplicate).toBe(true);
expect(result.matchType).toBe("exact");
expect(result.similarity).toBe(1.0);
expect(result.similarity).toBe(1);
expect(result.existingDocId).toBeDefined();
});

Expand Down
7 changes: 5 additions & 2 deletions tests/unit/obsidian.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { parseObsidianMarkdown } from "../../src/connectors/obsidian.js";
import {
parseObsidianMarkdown,
syncObsidianVault,
disconnectVault,
} from "../../src/connectors/obsidian.js";
import { createTestDb, createTestDbWithVec } from "../fixtures/test-db.js";
import { MockEmbeddingProvider } from "../fixtures/mock-provider.js";
import type Database from "better-sqlite3";
Expand Down Expand Up @@ -29,7 +33,6 @@ vi.mock("node:fs/promises", async (importOriginal) => {
});

import { readdirSync, readFileSync, statSync, existsSync, writeFileSync } from "node:fs";
import { syncObsidianVault, disconnectVault } from "../../src/connectors/obsidian.js";
import { initLogger } from "../../src/logger.js";

const mockedReaddirSync = vi.mocked(readdirSync);
Expand Down
Loading