@virsanghavi/axis-server 1.0.7 → 1.0.8

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.
Files changed (3) hide show
  1. package/bin/cli.ts +47 -32
  2. package/dist/cli.js +13 -1
  3. package/package.json +1 -1
package/bin/cli.ts CHANGED
@@ -16,45 +16,60 @@ program
16
16
  .description("Start the Axis Shared Context MCP Server")
17
17
  .version("1.0.0");
18
18
 
19
- program.action(() => {
20
- console.error(chalk.bold.blue("Axis MCP Server Starting..."));
19
+ program
20
+ .argument('[root]', 'Project root directory (optional)')
21
+ .action((root) => {
22
+ console.error(chalk.bold.blue("Axis MCP Server Starting..."));
21
23
 
22
- // Locate the bundled server script
23
- const serverScript = path.resolve(__dirname, "../dist/mcp-server.mjs");
24
+ // If root is provided, change CWD
25
+ if (root) {
26
+ const resolvedRoot = path.resolve(root);
27
+ if (fs.existsSync(resolvedRoot)) {
28
+ console.error(chalk.blue(`Setting CWD to: ${resolvedRoot}`));
29
+ process.chdir(resolvedRoot);
30
+ } else {
31
+ console.error(chalk.red(`Error: Project root not found: ${resolvedRoot}`));
32
+ process.exit(1);
33
+ }
34
+ }
24
35
 
25
- if (!fs.existsSync(serverScript)) {
26
- console.error(chalk.red("Error: Server script not found."));
27
- console.error(chalk.yellow(`Expected at: ${serverScript}`));
28
- console.error(chalk.gray("Did you run 'npm run build'?"));
29
- process.exit(1);
30
- }
36
+ // Locate the bundled server script
37
+ const serverScript = path.resolve(__dirname, "../dist/mcp-server.mjs");
31
38
 
32
- console.error(chalk.gray(`Launching server context...`));
39
+ if (!fs.existsSync(serverScript)) {
40
+ console.error(chalk.red("Error: Server script not found."));
41
+ console.error(chalk.yellow(`Expected at: ${serverScript}`));
42
+ console.error(chalk.gray("Did you run 'npm run build'?"));
43
+ process.exit(1);
44
+ }
33
45
 
34
- // Pass through all arguments from the CLI to the underlying server
35
- const args = [serverScript, ...process.argv.slice(2)];
46
+ console.error(chalk.gray(`Launching server context...`));
36
47
 
37
- // Spawn the node process with the bundled script
38
- const proc = spawn("node", args, {
39
- stdio: "inherit",
40
- env: { ...process.env, FORCE_COLOR: '1' }
41
- });
48
+ // Pass through all arguments from the CLI to the underlying server
49
+ const args = [serverScript, ...process.argv.slice(2)];
42
50
 
43
- proc.on("close", (code) => {
44
- if (code !== 0) {
45
- console.error(chalk.red(`Server process exited with code ${code}`));
46
- } else {
47
- console.error(chalk.green("Server stopped gracefully."));
48
- }
49
- });
51
+ // Spawn the node process with the bundled script
52
+ const proc = spawn("node", args, {
53
+ stdio: "inherit",
54
+ cwd: process.cwd(), // Pass the CWD to the child process
55
+ env: { ...process.env, FORCE_COLOR: '1' }
56
+ });
50
57
 
51
- // Handle signals to cleanup child
52
- process.on('SIGINT', () => {
53
- proc.kill('SIGINT');
54
- });
55
- process.on('SIGTERM', () => {
56
- proc.kill('SIGTERM');
58
+ proc.on("close", (code) => {
59
+ if (code !== 0) {
60
+ console.error(chalk.red(`Server process exited with code ${code}`));
61
+ } else {
62
+ console.error(chalk.green("Server stopped gracefully."));
63
+ }
64
+ });
65
+
66
+ // Handle signals to cleanup child
67
+ process.on('SIGINT', () => {
68
+ proc.kill('SIGINT');
69
+ });
70
+ process.on('SIGTERM', () => {
71
+ proc.kill('SIGTERM');
72
+ });
57
73
  });
58
- });
59
74
 
60
75
  program.parse();
package/dist/cli.js CHANGED
@@ -37,8 +37,18 @@ var import_fs = __toESM(require("fs"));
37
37
  var __filename2 = (0, import_url.fileURLToPath)(importMetaUrl);
38
38
  var __dirname = import_path.default.dirname(__filename2);
39
39
  import_commander.program.name("axis-server").description("Start the Axis Shared Context MCP Server").version("1.0.0");
40
- import_commander.program.action(() => {
40
+ import_commander.program.argument("[root]", "Project root directory (optional)").action((root) => {
41
41
  console.error(import_chalk.default.bold.blue("Axis MCP Server Starting..."));
42
+ if (root) {
43
+ const resolvedRoot = import_path.default.resolve(root);
44
+ if (import_fs.default.existsSync(resolvedRoot)) {
45
+ console.error(import_chalk.default.blue(`Setting CWD to: ${resolvedRoot}`));
46
+ process.chdir(resolvedRoot);
47
+ } else {
48
+ console.error(import_chalk.default.red(`Error: Project root not found: ${resolvedRoot}`));
49
+ process.exit(1);
50
+ }
51
+ }
42
52
  const serverScript = import_path.default.resolve(__dirname, "../dist/mcp-server.mjs");
43
53
  if (!import_fs.default.existsSync(serverScript)) {
44
54
  console.error(import_chalk.default.red("Error: Server script not found."));
@@ -50,6 +60,8 @@ import_commander.program.action(() => {
50
60
  const args = [serverScript, ...process.argv.slice(2)];
51
61
  const proc = (0, import_child_process.spawn)("node", args, {
52
62
  stdio: "inherit",
63
+ cwd: process.cwd(),
64
+ // Pass the CWD to the child process
53
65
  env: { ...process.env, FORCE_COLOR: "1" }
54
66
  });
55
67
  proc.on("close", (code) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virsanghavi/axis-server",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Axis MCP Server CLI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {