Skip to content
Closed
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
2 changes: 1 addition & 1 deletion packages/ai/bin/rsdoctor-mcp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

const { runServer } = require('../dist/server/server.js');
import { runServer } from '../dist/index.cjs';


runServer().catch((error) => {
Expand Down
15 changes: 5 additions & 10 deletions packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,21 @@
"bin": {
"rsdoctor-mcp": "./bin/rsdoctor-mcp"
},
"type": "module",
"scripts": {
"build": "rslib build",
"dev": "rslib build --watch",
"test": "vitest run",
"client": "npm run build && node dist/mcp/index.js"
},
"devDependencies": {
"@coze/api": "^1.2.0",
"@rsdoctor/types": "workspace:*",
"@rslib/core": "^0.2.2",
"@modelcontextprotocol/sdk": "1.4.1",
"@rslib/core": "^0.6.9",
"@types/node": "^22.8.1",
"dotenv": "^16.4.7",
"langchain": "^0.3.26",
"openai": "^4.77.0",
"typescript": "^5.2.2",
"vitest": "3.0.9"
},
"dependencies": {
"@modelcontextprotocol/sdk": "1.4.1",
"vitest": "3.0.9",
"@rsdoctor/utils": "workspace:*",
"@rsdoctor/types": "workspace:*",
"axios": "^1.9.0",
"socket.io-client": "4.6.1",
"zod": "^3.24.4"
Expand Down
7 changes: 4 additions & 3 deletions packages/ai/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ export default defineConfig({
{
source: {
entry: {
index: './src',
index: './src/server/server.ts',
},
tsconfigPath: './tsconfig.build.json',
},
output: {
distPath: {
root: './dist/',
},
},
bundle: false,
bundle: true,
dts: true,
format: 'cjs',
syntax: 'es2021',
Expand All @@ -25,7 +26,7 @@ export default defineConfig({
'utf-8-validate': 'utf-8-validate',
},
copy: {
patterns: [{ from: 'src/resources', to: 'resources' }],
patterns: [{ from: 'resources', to: 'resources' }],
},
},
});
2 changes: 1 addition & 1 deletion packages/ai/src/server/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runServer } from './server.ts';
import { runServer } from './server.js';

runServer().catch((error) => {
console.error('Fatal error running server:', error);
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/server/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const readMarkdownResource: ReadResourceCallback = async (
) => {
// Read the contents of the Markdown file
const contents = await readFileAsync(
path.join(__dirname, '../resources', uri.pathname),
path.join(__dirname, './resources', uri.pathname),
'utf-8',
);

Expand All @@ -38,7 +38,7 @@ const readMarkdownResource: ReadResourceCallback = async (
* @param {Object} resourcesData - The resources data object containing static resources
*/
function registerStaticResources(server: McpServer) {
const resourcesDir = path.join(__dirname, '../resources/');
const resourcesDir = path.join(__dirname, './resources/');
fs.readdirSync(resourcesDir).forEach((file) => {
if (file.endsWith('.md')) {
const uri = `file://rsdoctor/${file}`;
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/utils/chunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
FilteredModule,
SimpleChunk,
SimpleModule,
} from '@/types/index';
} from '@/types/index.js';

export const getMedianChunkSize = (list: Chunk[]): number => {
const sortedList = list.sort((a, b) => a.size - b.size);
Expand Down Expand Up @@ -69,7 +69,7 @@ export const getSimpleChunk = (
name: chunk.name,
size: chunk.size,
modules: chunk.modules
.map((mId) => {
.map((mId: number) => {
const m = modules.find((m) => m.id === mId);
if (!m) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './chunks';
export * from './chunks.js';
4 changes: 2 additions & 2 deletions packages/ai/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"outDir": "./dist",
"rootDir": ".",
"rootDir": "./src",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "dist", "src/resources/**/*"]
}
Loading
Loading