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
14 changes: 8 additions & 6 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then
ARGS="$ARGS --npm"
fi
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/benchmark.ts $ARGS 2>/dev/null > benchmark-result.json
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/benchmark.ts $ARGS > benchmark-result.json

- name: Update build report
if: steps.existing.outputs.skip != 'true'
Expand Down Expand Up @@ -231,12 +231,14 @@ jobs:
uses: actions/cache@v5
with:
path: ~/.cache/huggingface
key: hf-models-${{ runner.os }}-${{ hashFiles('src/embeddings/**') }}
key: hf-models-${{ runner.os }}-${{ hashFiles('src/domain/search/**') }}
restore-keys: hf-models-${{ runner.os }}-

- name: Build graph
if: steps.existing.outputs.skip != 'true'
run: node src/cli.js build .
run: |
STRIP_FLAG=$(node -e "const [M]=process.versions.node.split('.').map(Number); console.log(M>=23?'--strip-types':'--experimental-strip-types')")
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js src/cli.ts build .

- name: Run embedding benchmark
if: steps.existing.outputs.skip != 'true'
Expand All @@ -248,7 +250,7 @@ jobs:
if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then
ARGS="$ARGS --npm"
fi
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/embedding-benchmark.ts $ARGS 2>/dev/null > embedding-benchmark-result.json
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/embedding-benchmark.ts $ARGS > embedding-benchmark-result.json

- name: Update embedding report
if: steps.existing.outputs.skip != 'true'
Expand Down Expand Up @@ -388,7 +390,7 @@ jobs:
if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then
ARGS="$ARGS --npm"
fi
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/query-benchmark.ts $ARGS 2>/dev/null > query-benchmark-result.json
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/query-benchmark.ts $ARGS > query-benchmark-result.json

- name: Update query report
if: steps.existing.outputs.skip != 'true'
Expand Down Expand Up @@ -528,7 +530,7 @@ jobs:
if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then
ARGS="$ARGS --npm"
fi
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/incremental-benchmark.ts $ARGS 2>/dev/null > incremental-benchmark-result.json
node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/incremental-benchmark.ts $ARGS > incremental-benchmark-result.json

- name: Update incremental report
if: steps.existing.outputs.skip != 'true'
Expand Down
16 changes: 13 additions & 3 deletions scripts/lib/bench-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,20 @@ export async function resolveBenchmarkSource() {
/**
* Build a file:// URL suitable for dynamic import.
*
* After the TypeScript migration, src/ contains .ts files while the .js
* extension is still used in import specifiers. This helper checks for the
* .ts variant first (matching the actual source) and falls back to .js so it
* works in both local-dev and npm-published layouts.
*
* @param {string} srcDir Absolute path to the codegraph src/ directory
* @param {string} file Relative filename within src/ (e.g. 'builder.js')
* @param {string} file Relative filename within src/ (e.g. 'domain/queries.js')
* @returns {string} file:// URL string
*/
export function srcImport(srcDir, file) {
return pathToFileURL(path.join(srcDir, file)).href;
export function srcImport(srcDir: string, file: string): string {
const full = path.join(srcDir, file);
if (file.endsWith('.js')) {
const tsVariant = full.replace(/\.js$/, '.ts');
if (fs.existsSync(tsVariant)) return pathToFileURL(tsVariant).href;
}
return pathToFileURL(full).href;
}
Loading