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
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"scripts": {
"prepack": "node ../../scripts/check-workspace-protocol.mjs",
"prepublishOnly": "pnpm run build",
"build": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig.json --noEmit",
"build": "tsc -p tsconfig.build.json",
"typecheck": "tsc -p tsconfig.json",
"test": "vitest run --passWithNoTests",
"lint": "eslint src"
},
Expand All @@ -44,4 +44,4 @@
"commander": "^13.1.0",
"fast-glob": "^3.3.3"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
listMarkdownFiles,
listPromptFiles,
resolvePreferredPromptFiles,
} from "../src/discovery.js";
} from "../discovery.js";

const FIXTURE_DOCS_DIR = path.resolve(import.meta.dirname, "../../../tests/fixtures/docs");
const FIXTURE_DOCS_DIR = path.resolve(import.meta.dirname, "../../../../tests/fixtures/docs");

describe("docs discovery", () => {
it("excludes prompt template files from markdown indexing list", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { buildHeuristicManifest, suggestChunkBy } from "../src/fix.js";
import { buildHeuristicManifest, suggestChunkBy } from "../fix.js";

describe("suggestChunkBy", () => {
it("returns file when no headings exist", () => {
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false
},
"exclude": ["node_modules", "src/test/**"]
}
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
},
"scripts": {
"prepublishOnly": "pnpm run build",
"build": "tsc -p tsconfig.json",
"typecheck": "tsc -p tsconfig.json --noEmit",
"build": "tsc -p tsconfig.build.json",
"typecheck": "tsc -p tsconfig.json",
"test": "vitest run",
"lint": "eslint src test",
"lint": "eslint src",
"generate:schema": "tsx scripts/generate-schema.ts"
},
"devDependencies": {
Expand All @@ -52,4 +52,4 @@
"unified": "^11.0.5",
"zod": "^4.3.6"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { mkdtemp, rm } from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { computeChunkFingerprint, loadChunksFromPreviousIndex } from "../src/chunk-cache.js";
import { buildLanceDbIndex } from "../src/lancedb.js";
import type { Chunk, ChunkingStrategy } from "../src/types.js";
import { computeChunkFingerprint, loadChunksFromPreviousIndex } from "../chunk-cache.js";
import { buildLanceDbIndex } from "../lancedb.js";
import type { Chunk, ChunkingStrategy } from "../types.js";

function makeChunk(overrides: Partial<Chunk> = {}): Chunk {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { buildChunks, DEFAULT_MAX_CHUNK_SIZE } from "../src/chunking.js";
import { buildChunks, DEFAULT_MAX_CHUNK_SIZE } from "../chunking.js";

describe("buildChunks", () => {
it("creates deterministic chunk IDs and resolves duplicates", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { describe, it, expect } from "vitest";
import {
encodeCursor,
decodeCursor,
encodeSearchCursor,
decodeSearchCursor,
} from "../src/cursor.js";
import type { CursorPayload } from "../src/types.js";
import { encodeCursor, decodeCursor, encodeSearchCursor, decodeSearchCursor } from "../cursor.js";
import type { CursorPayload } from "../types.js";

describe("cursor encode/decode", () => {
// ─── Round-trip tests ──────────────────────────────────────────
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { dedupKey } from "../src/search-common.js";
import { InMemorySearchEngine } from "../src/search.js";
import type { Chunk } from "../src/types.js";
import { dedupKey } from "../search-common.js";
import { InMemorySearchEngine } from "../search.js";
import type { Chunk } from "../types.js";

describe("dedupKey", () => {
const getter = (metadata: Record<string, string>) => (key: string) => metadata[key] ?? "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
embedChunksIncremental,
loadCache,
saveCache,
} from "../src/embedding-cache.js";
import { HashEmbeddingProvider, toEmbeddingInput } from "../src/embedding.js";
import type { Chunk, EmbeddingConfig } from "../src/types.js";
} from "../embedding-cache.js";
import { HashEmbeddingProvider, toEmbeddingInput } from "../embedding.js";
import type { Chunk, EmbeddingConfig } from "../types.js";

function makeChunk(overrides: Partial<Chunk> = {}): Chunk {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
NoopEmbeddingProvider,
OpenAIEmbeddingProvider,
createEmbeddingProvider,
} from "../src/embedding.js";
} from "../embedding.js";

afterEach(() => {
vi.restoreAllMocks();
Expand Down Expand Up @@ -295,7 +295,7 @@ describe("embedding providers", () => {
// Instead, we'll rely on the fact that the provider builds JSONL deterministically,
// so two providers with the same config and inputs produce the same SHA.
// We'll build the expected SHA by constructing a second provider.
const { sha256hex } = await import("../src/embedding.js");
const { sha256hex } = await import("../embedding.js");
// Build the JSONL the provider would create (access via same logic)
const expectedJsonl = [
JSON.stringify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { mkdtemp, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { buildChunks } from "../src/chunking.js";
import { buildLanceDbIndex, LanceDbSearchEngine } from "../src/lancedb.js";
import { parseManifest, resolveFileConfig } from "../src/manifest.js";
import type { Chunk, Manifest } from "../src/types.js";
import { buildChunks } from "../chunking.js";
import { buildLanceDbIndex, LanceDbSearchEngine } from "../lancedb.js";
import { parseManifest, resolveFileConfig } from "../manifest.js";
import type { Chunk, Manifest } from "../types.js";

const FIXTURES_DIR = path.resolve(import.meta.dirname, "../../../tests/fixtures/docs");
const FIXTURES_DIR = path.resolve(import.meta.dirname, "../../../../tests/fixtures/docs");

const tempDirs: string[] = [];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { mkdtemp, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { buildLanceDbIndex, LanceDbSearchEngine } from "../src/lancedb.js";
import type { Chunk, EmbeddingProvider } from "../src/types.js";
import { buildChunks } from "../src/chunking.js";
import { afterEach, describe, expect, it, assert } from "vitest";
import { buildLanceDbIndex, LanceDbSearchEngine } from "../lancedb.js";
import type { Chunk, EmbeddingProvider } from "../types.js";
import { buildChunks } from "../chunking.js";

const tempDirs: string[] = [];

Expand Down Expand Up @@ -234,6 +234,9 @@ describe("LanceDbSearchEngine", () => {
async embed(): Promise<number[][]> {
return [[0, 1, 0]];
},

configFingerprint: "",
costPerMillionTokens: 0,
};

const engine = await LanceDbSearchEngine.open({
Expand Down Expand Up @@ -286,6 +289,8 @@ describe("LanceDbSearchEngine", () => {
async embed(): Promise<number[][]> {
throw new Error("provider unavailable");
},
configFingerprint: "",
costPerMillionTokens: 0,
};

const engine = await LanceDbSearchEngine.open({
Expand Down Expand Up @@ -484,6 +489,7 @@ third
metadataKeys: [],
});

assert(chunks[1]?.chunk_id);
const result = await engine.getDoc({
chunk_id: chunks[1].chunk_id,
context: -1,
Expand Down Expand Up @@ -554,6 +560,7 @@ Greetings friend!
metadataKeys: [],
});

assert(target[1]?.chunk_id);
const result = await engine.getDoc({
chunk_id: target[1].chunk_id,
context: -1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import { z } from "zod";
import { ManifestSchema } from "../src/manifest-schema.js";
import { ManifestSchema } from "../manifest-schema.js";

const __dirname = dirname(fileURLToPath(import.meta.url));
const schemaPath = resolve(__dirname, "../../../schemas/docs-mcp.schema.json");
const schemaPath = resolve(__dirname, "../../../../schemas/docs-mcp.schema.json");

describe("manifest JSON schema", () => {
it("committed schema matches generated schema from Zod", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { mergeTaxonomyConfigs, parseManifest, resolveFileConfig } from "../src/manifest.js";
import type { Manifest } from "../src/types.js";
import { mergeTaxonomyConfigs, parseManifest, resolveFileConfig } from "../manifest.js";
import type { Manifest } from "../types.js";

describe("manifest resolution", () => {
it("uses last-match wins for overrides", () => {
Expand Down Expand Up @@ -307,13 +307,9 @@ describe("mergeTaxonomyConfigs", () => {

describe("resolveFileConfig title resolution", () => {
it("prefers frontmatter title over H1 heading", () => {
const markdown = [
"---",
"title: Frontmatter Title",
"---",
"# H1 Title",
"Body text",
].join("\n");
const markdown = ["---", "title: Frontmatter Title", "---", "# H1 Title", "Body text"].join(
"\n",
);

const resolved = resolveFileConfig({
relativeFilePath: "guide.md",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { normalizeMetadata } from "../src/metadata.js";
import { normalizeMetadata } from "../metadata.js";

/**
* Helper to build a minimal valid metadata object.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { extractFirstH1 } from "../src/parser.js";
import { extractFirstH1 } from "../parser.js";

describe("extractFirstH1", () => {
it("returns the text of the first H1 heading", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { readFile } from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { parsePromptMarkdown, parsePromptTemplateYaml } from "../src/prompt.js";
import { parsePromptMarkdown, parsePromptTemplateYaml } from "../prompt.js";

const FIXTURE_PROMPT_PATH = path.resolve(
import.meta.dirname,
"../../../tests/fixtures/docs/guides/auth-integration.template.md",
"../../../../tests/fixtures/docs/guides/auth-integration.template.md",
);
const FIXTURE_PROMPT_YAML_PATH = path.resolve(
import.meta.dirname,
"../../../tests/fixtures/docs/guides/auth-integration.template.yaml",
"../../../../tests/fixtures/docs/guides/auth-integration.template.yaml",
);

describe("parsePromptMarkdown", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { DocsIndex } from "../src/search.js";
import type { Chunk } from "../src/types.js";
import { buildChunks } from "../src/chunking.js";
import { describe, expect, it, assert } from "vitest";
import { DocsIndex } from "../search.js";
import type { Chunk } from "../types.js";
import { buildChunks } from "../chunking.js";

const baseChunks: Chunk[] = [
{
Expand Down Expand Up @@ -271,6 +271,7 @@ third
});

const index = new DocsIndex(chunks);
assert(chunks[1]?.chunk_id);
const result = await index.getDoc({
chunk_id: chunks[1].chunk_id,
context: -1,
Expand Down Expand Up @@ -333,6 +334,7 @@ Greetings friend!
);

const index = new DocsIndex(chunks);
assert(target[1]?.chunk_id);
const result = await index.getDoc({
chunk_id: target[1].chunk_id,
context: -1,
Expand Down
7 changes: 7 additions & 0 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false
},
"exclude": ["node_modules", "src/test/**"]
}
6 changes: 3 additions & 3 deletions packages/eval/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
},
"scripts": {
"prepublishOnly": "pnpm run build",
"build": "tsc -p tsconfig.json",
"build": "tsc -p tsconfig.build.json",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "vitest run",
"lint": "eslint src test"
"lint": "eslint src"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
Expand All @@ -48,4 +48,4 @@
"dotenv": "^16.4.7",
"yaml": "^2.7.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { evaluateAssertions } from "../../src/agent/assertions.js";
import type { AgentAssertion } from "../../src/agent/types.js";
import { evaluateAssertions } from "../../agent/assertions.js";
import type { AgentAssertion } from "../../agent/types.js";

let workspaceDir: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { DEFAULT_FEEDBACK_TOOL_CONFIG, parseFeedbackResult } from "../../src/agent/feedback.js";
import type { FeedbackToolConfig } from "../../src/agent/types.js";
import { DEFAULT_FEEDBACK_TOOL_CONFIG, parseFeedbackResult } from "../../agent/feedback.js";
import type { FeedbackToolConfig } from "../../agent/types.js";

const customConfig: FeedbackToolConfig = {
name: "give_feedback",
Expand Down Expand Up @@ -50,10 +50,7 @@ describe("parseFeedbackResult", () => {
});

it("skips non-numeric metric values instead of failing", () => {
const result = parseFeedbackResult(
{ feedback: "test", rating: "not a number" },
customConfig,
);
const result = parseFeedbackResult({ feedback: "test", rating: "not a number" }, customConfig);
expect(result).toEqual({ scores: {}, reasoning: "test" });
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { describe, expect, it } from "vitest";
import { computeAgentEvalSummary } from "../../src/agent/metrics.js";
import type { AgentScenarioResult } from "../../src/agent/types.js";
import { computeAgentEvalSummary } from "../../agent/metrics.js";
import type { AgentScenarioResult } from "../../agent/types.js";

function makeResult(overrides: Partial<AgentScenarioResult> = {}): AgentScenarioResult {
return {
id: "1",
name: "test",
activated: true,
passed: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
summarizeCases,
toDeltaCases,
type RankedCase,
} from "../src/index.js";
} from "../index.js";

const cases: RankedCase[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { computeRoundsToRightDoc } from "../src/runner.js";
import { computeRoundsToRightDoc } from "../runner.js";

describe("computeRoundsToRightDoc", () => {
it("uses executed rounds when the expected chunk was found", () => {
Expand Down
Loading