codesearch-mcp 0.0.1-alpha → 0.0.3-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.js CHANGED
@@ -36,12 +36,6 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  require("./src/env-loader");
38
38
  const path = __importStar(require("path"));
39
- const db_1 = require("./src/db");
40
- const indexer_1 = require("./src/indexer");
41
- const interrupt_1 = require("./src/interrupt");
42
- const project_selector_1 = require("./src/project-selector");
43
- const mcp_1 = require("./src/mcp");
44
- const graph_1 = require("./src/graph");
45
39
  function printSummary(allStats) {
46
40
  const cols = { name: 30, num: 8 };
47
41
  const line = '─'.repeat(cols.name + cols.num * 5 + 5);
@@ -67,6 +61,11 @@ async function main() {
67
61
  const isSetup = argv1 === 'rag-setup' || process.argv[2] === 'setup';
68
62
  const mode = isMcp ? 'mcp' : isSetup ? 'setup' : (process.argv[2] ?? '');
69
63
  if (mode === 'index') {
64
+ const { initDbWithSchema } = await Promise.resolve().then(() => __importStar(require('./src/db')));
65
+ const { discoverProjects, scanAndIndex } = await Promise.resolve().then(() => __importStar(require('./src/indexer')));
66
+ const { setupInterrupt, teardownInterrupt, signal } = await Promise.resolve().then(() => __importStar(require('./src/interrupt')));
67
+ const { selectProjects } = await Promise.resolve().then(() => __importStar(require('./src/project-selector')));
68
+ const { generateProjectGraph } = await Promise.resolve().then(() => __importStar(require('./src/graph')));
70
69
  const args = process.argv.slice(argv1 === 'rag-index' ? 2 : 3);
71
70
  const workspacePath = args.find(a => !a.startsWith('--'));
72
71
  const force = args.includes('--reindex');
@@ -76,39 +75,45 @@ async function main() {
76
75
  process.exit(1);
77
76
  }
78
77
  process.env.WORKSPACE_ROOT ??= workspacePath;
79
- await (0, db_1.initDbWithSchema)();
80
- (0, interrupt_1.setupInterrupt)();
81
- const discovered = (0, indexer_1.discoverProjects)(workspacePath);
82
- const projects = await (0, project_selector_1.selectProjects)(discovered, workspacePath, forceSelect);
78
+ await initDbWithSchema();
79
+ setupInterrupt();
80
+ const discovered = discoverProjects(workspacePath);
81
+ const projects = await selectProjects(discovered, workspacePath, forceSelect);
83
82
  if (projects.length === 0) {
84
- (0, interrupt_1.teardownInterrupt)();
83
+ teardownInterrupt();
85
84
  process.exit(0);
86
85
  }
87
86
  const allStats = [];
88
87
  if (force)
89
88
  console.log('Reindex mode: all files will be re-indexed.');
90
89
  for (const proj of projects) {
91
- if (interrupt_1.signal.aborted)
90
+ if (signal.aborted)
92
91
  break;
93
- const stats = await (0, indexer_1.scanAndIndex)(proj.path, proj.name, force, interrupt_1.signal);
92
+ const stats = await scanAndIndex(proj.path, proj.name, force, signal);
94
93
  allStats.push(stats);
95
94
  }
96
- (0, interrupt_1.teardownInterrupt)();
97
- if (interrupt_1.signal.aborted)
95
+ teardownInterrupt();
96
+ if (signal.aborted)
98
97
  console.log('\nIndexing interrupted.');
99
98
  printSummary(allStats);
100
- if (!interrupt_1.signal.aborted)
101
- (0, graph_1.generateProjectGraph)(projects, workspacePath);
99
+ if (!signal.aborted)
100
+ generateProjectGraph(projects, workspacePath);
102
101
  process.exit(0);
103
102
  }
104
103
  else if (mode === 'mcp') {
104
+ const { initDb } = await Promise.resolve().then(() => __importStar(require('./src/db')));
105
+ const { startMCP } = await Promise.resolve().then(() => __importStar(require('./src/mcp')));
105
106
  if (!process.env.WORKSPACE_ROOT) {
106
- console.error('WORKSPACE_ROOT is required for MCP mode. Set it in ~/.config/codesearch-mcp/.env');
107
- console.error('Run `rag-setup` to configure.');
108
- process.exit(1);
107
+ if (argv1 === 'rag-mcp') {
108
+ console.error('WORKSPACE_ROOT is required for MCP mode. Set it in ~/.config/codesearch-mcp/.env');
109
+ console.error('Run `rag-setup` to configure.');
110
+ process.exit(1);
111
+ }
112
+ // dev fallback: infer from cwd (project lives inside workspace)
113
+ process.env.WORKSPACE_ROOT = path.dirname(process.cwd());
109
114
  }
110
- await (0, db_1.initDb)();
111
- await (0, mcp_1.startMCP)();
115
+ await initDb();
116
+ await startMCP();
112
117
  }
113
118
  else if (mode === 'setup') {
114
119
  const { runSetup } = await Promise.resolve().then(() => __importStar(require('./src/setup')));
package/dist/src/setup.js CHANGED
@@ -41,7 +41,7 @@ const os = __importStar(require("os"));
41
41
  const child_process_1 = require("child_process");
42
42
  const CONFIG_DIR = path.join(os.homedir(), '.config', 'codesearch-mcp');
43
43
  const CONFIG_FILE = path.join(CONFIG_DIR, '.env');
44
- const DOCKER_COMPOSE_SRC = path.join(__dirname, '..', 'docker', 'docker-compose.yml');
44
+ const DOCKER_COMPOSE_SRC = path.join(__dirname, '..', '..', 'docker', 'docker-compose.yml');
45
45
  const DOCKER_COMPOSE_DST = path.join(CONFIG_DIR, 'docker-compose.yml');
46
46
  function ask(rl, question) {
47
47
  return new Promise(resolve => rl.question(question, resolve));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codesearch-mcp",
3
- "version": "0.0.1-alpha",
3
+ "version": "0.0.3-alpha",
4
4
  "description": "Local semantic codebase search via MCP — indexes projects into pgvector, exposes search to Claude",
5
5
  "main": "dist/app.js",
6
6
  "bin": {