Commit 8fc62a60 authored by LongLD's avatar LongLD

feat: support workspace root detection for GitLab distribution

parent 811b0909
......@@ -29,7 +29,6 @@ lerna-debug.log*
coverage/
# IDEs
.vscode/
.idea/
*.swp
*.swo
{
"servers": {
"awing-rules-claudecode-mcp": {
"command": "npx",
"args": [
"-y",
"git+https://gitlab.awing.vn/awing-mcp/awing-rules-claudecode-mcp.git"
]
}
}
}
#!/usr/bin/env node
import { spawn } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Pass current working directory as argument to the main script
const workspaceRoot = process.cwd();
const mainScript = path.resolve(__dirname, '../dist/index.js');
const child = spawn('node', [mainScript, workspaceRoot], {
stdio: 'inherit',
cwd: process.cwd()
});
child.on('exit', (code) => {
process.exit(code);
});
\ No newline at end of file
......@@ -10,7 +10,8 @@ import { fileURLToPath } from 'url';
// --- Configuration ---
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const ROOT_DIR = path.resolve(__dirname, '..'); // storage root is one level up from dist
// Allow override via command line argument, environment variable, or use current working directory
const ROOT_DIR = process.argv[2] || process.env.AWING_RULES_ROOT || process.cwd();
// --- Initialization ---
const indexer = new RuleIndexer(ROOT_DIR);
const composer = new Composer(ROOT_DIR);
......
......@@ -5,10 +5,11 @@
"main": "dist/index.js",
"type": "module",
"bin": {
"awing-rules-claudecode-mcp": "./dist/index.js"
"awing-rules-claudecode-mcp": "./bin/awing-rules-mcp.js"
},
"files": [
"dist"
"dist",
"bin"
],
"scripts": {
"build": "tsc",
......
......@@ -17,7 +17,8 @@ import { fileURLToPath } from 'url';
// --- Configuration ---
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const ROOT_DIR = path.resolve(__dirname, '..'); // storage root is one level up from dist
// Allow override via command line argument, environment variable, or use current working directory
const ROOT_DIR = process.argv[2] || process.env.AWING_RULES_ROOT || process.cwd();
// --- Initialization ---
const indexer = new RuleIndexer(ROOT_DIR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment