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
38 changes: 32 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,47 @@ on:
branches: [master]

jobs:
test:
quality:
name: Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- name: Lint & Format
run: |
pnpm lint
pnpm format:check

- name: Type Check
run: pnpm type-check

- name: Security Audit
run: pnpm audit

test:
name: Functional Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm audit
- run: pnpm build
- run: pnpm test

- name: Build
run: pnpm build

- name: Run Tests
run: pnpm test
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2
}
12 changes: 7 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
```bash
git clone https://github.com/PatrickSys/codebase-context.git
cd codebase-context
npm install
npm run build
pnpm install
pnpm build

```

## Using the Package
Expand Down Expand Up @@ -37,7 +38,8 @@ src/

**Better search ranking** - The hybrid search in `src/core/search.ts` could use tuning. Currently uses RRF to combine semantic and keyword scores.

**Tests** - There are none. Any test coverage would be an improvement.
**Tests** - Run `pnpm test`. We use Vitest for unit and smoke testing.


## Adding a Framework Analyzer

Expand All @@ -59,7 +61,7 @@ interface FrameworkAnalyzer {
## Running Locally

```bash
npm run build
pnpm build
node dist/index.js /path/to/test/project
```

Expand All @@ -68,7 +70,7 @@ The server logs to stderr, so you can see what it's doing.
## Pull Requests

- Fork, branch, make changes
- Run `npm run build` to make sure it compiles
- Run `pnpm build` to make sure it compiles
- Test on an actual project
- Open PR with what you changed and why

Expand Down
24 changes: 24 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

export default tseslint.config(
{ ignores: ['dist', 'node_modules', 'coverage'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended, prettier],
files: ['src/**/*.ts', 'tests/**/*.ts'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.node,
},
plugins: {
// import plugin is handled via recommended usually, but kept simple for now
},
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_', 'caughtErrorsIgnorePattern': '^_' }],
'no-console': ['warn', { 'allow': ['warn', 'error'] }],
},
},
);
22 changes: 21 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@
"dev": "ts-node src/index.ts",
"watch": "tsc -w",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"lint": "eslint \"src/**/*.ts\"",
"format": "prettier --write \"src/**/*.ts\"",
"format:check": "prettier --check \"src/**/*.ts\"",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@lancedb/lancedb": "^0.4.0",
Expand All @@ -94,10 +98,26 @@
"zod": "^4.3.4"
},
"devDependencies": {
"@eslint/js": "^9.39.2",
"@types/glob": "^8.1.0",
"@types/node": "^20.11.24",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^8.51.0",
"@typescript-eslint/parser": "^8.51.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"globals": "^17.0.0",
"prettier": "^3.7.4",
"ts-node": "^10.9.2",
"typescript-eslint": "^8.51.0",
"vitest": "^4.0.16"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild",
"protobufjs",
"sharp"
]
}
}
Loading
Loading