Skip to content

Commit f6706d0

Browse files
Setup project infrastructure and fix build issues
- Add MIT LICENSE file - Add GitHub topics (ai, mcp, knowledge-base, claude, context-memory, coding-assistant) - Configure pnpm workspace (pnpm-workspace.yaml, update scripts) - Add ESLint configuration (.eslintrc.json) - Create GitHub Actions CI workflow (Node 18.x and 20.x matrix) - Fix TypeScript errors (type casting through unknown) - Fix ESLint issues (unused variables, const declarations) - Update .gitignore for build artifacts and lock files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3b1ef4b commit f6706d0

File tree

14 files changed

+2582
-50
lines changed

14 files changed

+2582
-50
lines changed

.eslintrc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"es2022": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaVersion": "latest",
14+
"sourceType": "module"
15+
},
16+
"plugins": ["@typescript-eslint"],
17+
"ignorePatterns": ["dist", "node_modules", "examples"],
18+
"rules": {
19+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
20+
"@typescript-eslint/no-explicit-any": "warn"
21+
}
22+
}

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x, 20.x]
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
with:
24+
version: 9
25+
26+
- name: Setup Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
cache: 'pnpm'
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Build
36+
run: pnpm run build
37+
38+
- name: Type check
39+
run: pnpm run typecheck
40+
41+
- name: Lint
42+
run: pnpm run lint
43+
44+
- name: Test
45+
run: pnpm run test
46+
continue-on-error: true # Tests not implemented yet

.gitignore

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ node_modules/
55
dist/
66
*.tsbuildinfo
77

8+
# Example build outputs
9+
examples/**/*.js
10+
examples/**/*.d.ts
11+
examples/**/*.d.ts.map
12+
examples/**/*.js.map
13+
814
# Codebrain data (user's local index)
915
.codebrain/
1016

17+
# Claude Code plugin state
18+
.claude/
19+
1120
# Environment
1221
.env
1322
.env.local
@@ -32,7 +41,6 @@ yarn-error.log*
3241
# Test coverage
3342
coverage/
3443

35-
# Package manager locks (use one)
36-
# package-lock.json
37-
# yarn.lock
38-
# pnpm-lock.yaml
44+
# Package manager locks (keep pnpm-lock.yaml for reproducible builds)
45+
package-lock.json
46+
yarn.lock

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 codebrain contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
"version": "0.1.0",
44
"description": "Persistent context index for AI coding agents",
55
"private": true,
6-
"workspaces": [
7-
"packages/*"
8-
],
96
"scripts": {
10-
"build": "npm run build --workspaces",
11-
"dev": "npm run dev --workspaces --if-present",
12-
"test": "npm run test --workspaces --if-present",
13-
"lint": "eslint packages/*/src",
7+
"build": "pnpm -r run build",
8+
"dev": "pnpm -r run dev --if-present",
9+
"test": "pnpm -r run test --if-present",
10+
"lint": "eslint 'packages/*/src/**/*.ts'",
1411
"typecheck": "tsc --build",
1512
"clean": "rm -rf packages/*/dist"
1613
},

packages/cli/src/cli.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ program
2424
.command('init')
2525
.description('Initialize codebrain in the current project')
2626
.option('-n, --name <name>', 'Project name')
27-
.action(async (options) => {
27+
.action(async (_options) => {
2828
console.log(chalk.cyan('🧠 Initializing Codebrain...\n'));
2929

3030
// TODO: Implement init
@@ -49,7 +49,7 @@ program
4949
.description('Index all configured sources')
5050
.option('-s, --source <source>', 'Index only this source')
5151
.option('--force', 'Re-index everything, ignoring cache')
52-
.action(async (options) => {
52+
.action(async (_options) => {
5353
console.log(chalk.cyan('🧠 Indexing sources...\n'));
5454

5555
// TODO: Implement indexing
@@ -71,7 +71,7 @@ program
7171
.option('--scope <scope>', 'Filter by scope')
7272
.option('--type <type>', 'Filter by signal type')
7373
.option('--limit <n>', 'Max results', '10')
74-
.action(async (query, options) => {
74+
.action(async (query, _options) => {
7575
console.log(chalk.cyan(`🔍 Searching for: ${query}\n`));
7676

7777
// TODO: Implement search
@@ -87,7 +87,7 @@ program
8787
.command('context <scope>')
8888
.description('Get formatted context for a scope')
8989
.option('--depth <depth>', 'Context depth: shallow, normal, deep', 'normal')
90-
.action(async (scope, options) => {
90+
.action(async (scope, _options) => {
9191
console.log(chalk.cyan(`📋 Getting context for: ${scope}\n`));
9292

9393
// TODO: Implement context retrieval
@@ -118,7 +118,7 @@ program
118118
.command('serve')
119119
.description('Start the MCP server')
120120
.option('-p, --port <port>', 'Port for HTTP mode')
121-
.action(async (options) => {
121+
.action(async (_options) => {
122122
console.log(chalk.cyan('🚀 Starting Codebrain MCP server...\n'));
123123

124124
// Import and start the MCP server
@@ -134,7 +134,7 @@ program
134134
.command('validate')
135135
.description('Validate signals and check freshness')
136136
.option('--fix', 'Automatically fix issues where possible')
137-
.action(async (options) => {
137+
.action(async (_options) => {
138138
console.log(chalk.cyan('✅ Validating signals...\n'));
139139

140140
// TODO: Implement validation

packages/core/src/config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
* to configure sources, signals, scopes, and behavior.
66
*/
77

8-
import type {
9-
BuiltInSignalType,
10-
CustomSignalType,
8+
import type {
9+
BuiltInSignalType,
10+
CustomSignalType,
1111
Scope,
12-
SourceType,
13-
RawDocument
12+
RawDocument
1413
} from './types';
1514

1615
// ═══════════════════════════════════════════════════════════════════

packages/extraction/src/extractor.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ import type {
1212
SignalSource,
1313
CodeRef
1414
} from '@codebrain/core';
15-
import {
16-
SYSTEM_PROMPT,
15+
import {
16+
SYSTEM_PROMPT,
1717
EXTRACTION_PROMPT,
1818
MEETING_EXTRACTION_PROMPT,
19-
CLAUDE_CODE_EXTRACTION_PROMPT,
20-
SIGNAL_TYPE_PROMPTS
19+
CLAUDE_CODE_EXTRACTION_PROMPT
2120
} from './prompts';
2221
import { randomUUID } from 'crypto';
2322

packages/mcp-server/src/index.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ import {
1111
ListToolsRequestSchema,
1212
Tool,
1313
} from '@modelcontextprotocol/sdk/types.js';
14-
import type {
15-
RetrievalQuery,
16-
RetrievalResult,
17-
Signal,
18-
FormattedContext
19-
} from '@codebrain/core';
14+
import type { FormattedContext } from '@codebrain/core';
2015

2116
// ═══════════════════════════════════════════════════════════════════
2217
// TYPES
@@ -218,9 +213,9 @@ This ensures the knowledge persists for future sessions.`,
218213
// SERVER
219214
// ═══════════════════════════════════════════════════════════════════
220215

221-
export async function createServer(config: CodebrainMCPConfig): Promise<Server> {
216+
export async function createServer(_config: CodebrainMCPConfig): Promise<Server> {
222217
// TODO: Initialize storage and retrieval from config
223-
// const storage = await initializeStorage(config.dataDir);
218+
// const storage = await initializeStorage(_config.dataDir);
224219

225220
const server = new Server(
226221
{
@@ -245,16 +240,16 @@ export async function createServer(config: CodebrainMCPConfig): Promise<Server>
245240

246241
switch (name) {
247242
case 'codebrain_search':
248-
return handleSearch(args as SearchArgs);
243+
return handleSearch(args as unknown as SearchArgs);
249244

250245
case 'codebrain_context':
251-
return handleContext(args as ContextArgs);
246+
return handleContext(args as unknown as ContextArgs);
252247

253248
case 'codebrain_validate':
254-
return handleValidate(args as ValidateArgs);
249+
return handleValidate(args as unknown as ValidateArgs);
255250

256251
case 'codebrain_record':
257-
return handleRecord(args as RecordArgs);
252+
return handleRecord(args as unknown as RecordArgs);
258253

259254
case 'codebrain_status':
260255
return handleStatus();
@@ -310,12 +305,9 @@ async function handleContext(args: ContextArgs) {
310305
// TODO: Implement context retrieval and formatting
311306
// const signals = await storage.signals.getByScope(args.scope);
312307
// const formatted = formatContext(signals, args.depth);
313-
314-
const depthLimits = {
315-
shallow: 10,
316-
normal: 30,
317-
deep: 100,
318-
};
308+
309+
// Depth limits for future implementation
310+
// shallow: 10, normal: 30, deep: 100
319311

320312
// Placeholder response showing expected format
321313
const placeholder: FormattedContext = {
@@ -363,7 +355,7 @@ interface ValidateArgs {
363355
filesAffected?: string[];
364356
}
365357

366-
async function handleValidate(args: ValidateArgs) {
358+
async function handleValidate(_args: ValidateArgs) {
367359
// TODO: Implement validation logic
368360
// 1. Get all constraints and edge cases for scope
369361
// 2. Check if planned changes might violate any

packages/parsers/src/claude-code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export async function parseConversationsDirectory(
121121
const files = await readdir(dirPath);
122122
const jsonlFiles = files.filter(f => f.endsWith('.jsonl'));
123123

124-
let conversations: ParsedConversation[] = [];
124+
const conversations: ParsedConversation[] = [];
125125

126126
for (const file of jsonlFiles) {
127127
const filePath = join(dirPath, file);

0 commit comments

Comments
 (0)