Skip to content

Commit 4b17067

Browse files
committed
refactor: move Node/Edge/ReadableGraph types to @bibgraph/types and keep evaluation in algorithms
Move core graph types to @bibgraph/types to break circular dependency: - Create packages/types/src/graph-algorithms.ts with Node, Edge, NodeBase, EdgeBase, ReadableGraph - Export core graph types from @bibgraph/types package - Update algorithms to re-export Node/Edge from @bibgraph/types (backwards compatibility) - Update graph-expansion to import ReadableGraph, NodeBase, EdgeBase from @bibgraph/types - Update all evaluation files to import Node/Edge from @bibgraph/types Move BFS back to algorithms package: - Copy BFS implementation from graph-expansion to algorithms/traversal/bfs.ts - Update BFS to import ReadableGraph from @bibgraph/types - Create algorithms/traversal/index.ts to export BFS - Update algorithms/src/index.ts to export bfs function (not types to avoid conflicts) - Update algorithms/src/extraction/path.ts to import bfs from local traversal - Update algorithms/src/graph-adapter.ts to import ReadableGraph from @bibgraph/types Keep evaluation framework in algorithms package: - Move evaluation framework from graph-expansion back to algorithms (where it belongs) - Update evaluation imports to use relative paths (../.. for Graph/Path types) - Export all evaluation functions from algorithms/src/index.ts - Remove evaluation exports from graph-expansion/src/index.ts - Remove evaluation export configuration from graph-expansion/package.json This breaks the circular dependency: - Previously: graph-expansion → algorithms (Node/Edge) → graph-expansion (bfs/ReadableGraph) - Now: Both packages import from @bibgraph/types (no circular dependency) - Evaluation stays in algorithms (depends on Graph/Path types from same package) fix(lint-staged): wrap Nx commands in sh -c for environment variable support - Fix NX_DAEMON=false spawn error by using shell wrapper - Enables proper environment variable parsing in pre-commit hook
1 parent 5d2225c commit 4b17067

33 files changed

+1012
-538
lines changed

.lintstagedrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ export default {
1212
// TypeScript and JavaScript files in packages and apps
1313
'{packages,apps}/**/*.{ts,tsx,js,jsx}': [
1414
// Run cached lint:fix for affected projects using Nx (no daemon for pre-commit)
15-
() => 'NX_DAEMON=false nx affected --target=lint:fix'
15+
() => 'sh -c "NX_DAEMON=false nx affected --target=lint:fix"'
1616
],
1717

1818
// Type check all affected projects (no daemon for pre-commit)
1919
'*.{ts,tsx}': [
20-
() => 'NX_DAEMON=false nx affected --target=typecheck'
20+
() => 'sh -c "NX_DAEMON=false nx affected --target=typecheck"'
2121
],
2222

2323
// GitHub workflow files (actionlint only validates workflow files in .github/workflows/)

packages/algorithms/__tests__/evaluation/mi-experiment.integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
generateMarkdownReport,
1515
generateLatexTable,
1616
generateJSONSummary,
17-
} from '@bibgraph/algorithms';
18-
import { randomRanker } from '@bibgraph/algorithms';
17+
} from '@bibgraph/graph-expansion';
18+
import { randomRanker } from '@bibgraph/graph-expansion';
1919
import {
2020
createSmallCitationNetwork,
2121
createMediumCitationNetwork,
@@ -27,7 +27,7 @@ import {
2727
validateGraphTypePerformance,
2828
getEffectSizeCategory,
2929
} from './fixtures/expected-results';
30-
import type { ExperimentConfig, MetricType, StatisticalTestType } from '@bibgraph/algorithms';
30+
import type { ExperimentConfig, MetricType, StatisticalTestType } from '@bibgraph/graph-expansion';
3131

3232
/**
3333
* Simple MI ranker for testing (ranks by total path weight)

packages/algorithms/__tests__/evaluation/path-planting.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
pathFollowsTemplate,
1414
type PlantedPathConfig,
1515
type CitationPathType,
16-
} from '@bibgraph/algorithms';
16+
} from '@bibgraph/graph-expansion';
1717

1818
/** Simple graph node */
1919
interface TestNode extends Node {

0 commit comments

Comments
 (0)