agcel 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -8,23 +8,21 @@ The project consists of two main components:
8
8
  1. **AgCel CLI**: A command-line interface to manage and interact with the MCP server.
9
9
  2. **AgCel MCP Skills Server**: A local server that hosts skills and capabilities, enabling AI agents to perform complex tasks.
10
10
 
11
- ## Installation
12
-
13
- To install the AgCel CLI globally and set up the local MCP server:
11
+ To install the AgCel CLI globally:
14
12
 
15
13
  ```bash
16
- npx agcel install
14
+ npm install -g agcel
17
15
  ```
18
16
 
19
- ## Uninstallation
17
+ This will make the `agc` command available globally. If you are developing locally, you can run `npm install -g .` from the project root.
20
18
 
21
- To completely remove AgCel from your system:
19
+ To remove AgCel, simply uninstall the npm package:
22
20
 
23
21
  ```bash
24
- agc uninstall
22
+ npm uninstall -g agcel
25
23
  ```
26
24
 
27
- This will remove AgCel from your MCP config, delete the global data directory (`~/.agcel`), and prompt to uninstall the npm package.
25
+ You may also want to manually remove the global data directory (`~/.agcel`) and the server registration in your MCP config if you previously ran the legacy `install` command.
28
26
 
29
27
  ## CLI Usage
30
28
 
@@ -32,14 +30,10 @@ The `agc` command-line tool is your primary interface. Application data is store
32
30
 
33
31
  | Command | Description |
34
32
  | :--- | :--- |
35
- | `agc start` | Start the MCP server locally. |
36
- | `agc stop` | Stop the running MCP server. |
37
- | `agc restart` | Restart the MCP server. |
38
- | `agc status` | Check the status of the local MCP server. |
39
33
  | `agc init` | Initialize AgCel in the current project (copies workflows to `.agent/workflows`). |
40
- | `agc skills list` | List all available skills. |
41
- | `agc workflows list` | List all available workflows. |
42
- | `agc uninstall` | Completely remove AgCel from your system. |
34
+ | `agc skills list` | List all available skills (local or global). |
35
+ | `agc workflows list` | List all available workflows (local or global). |
36
+ | `agc uninstall` | Clean up global data and remove the npm package. |
43
37
  | `agc --help` | Show the help menu. |
44
38
  | `agc --version` | Show the CLI version. |
45
39
 
@@ -16,12 +16,12 @@ async function initCommand() {
16
16
  // 1. Check if global install exists
17
17
  if (!fs_1.default.existsSync(globalDir)) {
18
18
  console.error(chalk_1.default.red('Error: AgCel is not installed globally.'));
19
- console.error(chalk_1.default.yellow('Please run "npx agcel install" first to set up the global environment.'));
19
+ console.error(chalk_1.default.yellow('Please run "npm install -g agcel" first.'));
20
20
  return;
21
21
  }
22
22
  if (!fs_1.default.existsSync(globalWorkflowsDir)) {
23
23
  console.error(chalk_1.default.red(`Error: Workflows directory not found in global install at ${globalWorkflowsDir}`));
24
- console.error(chalk_1.default.yellow('Please try running "npx agcel install" again to fix the installation.'));
24
+ console.error(chalk_1.default.yellow('Please try reinstalling: npm install -g agcel'));
25
25
  return;
26
26
  }
27
27
  // 2. Setup local .agc and .agent directories
@@ -42,7 +42,12 @@ async function initCommand() {
42
42
  fs_1.default.mkdirSync(projectSkillsDir, { recursive: true });
43
43
  }
44
44
  console.log(chalk_1.default.blue('Copying skills...'));
45
- fs_1.default.cpSync(globalSkillsDir, projectSkillsDir, { recursive: true });
45
+ try {
46
+ fs_1.default.cpSync(globalSkillsDir, projectSkillsDir, { recursive: true });
47
+ }
48
+ catch (e) {
49
+ console.error(chalk_1.default.red('Failed to copy skills.'), e);
50
+ }
46
51
  }
47
52
  else {
48
53
  console.warn(chalk_1.default.yellow(`Warning: Global skills not found at ${globalSkillsDir}`));
@@ -9,25 +9,15 @@ const path_1 = __importDefault(require("path"));
9
9
  const chalk_1 = __importDefault(require("chalk"));
10
10
  const index_js_1 = require("../utils/index.js");
11
11
  function listCommand(type) {
12
- if (!(0, index_js_1.isInitialized)()) {
13
- console.error(chalk_1.default.red('AgCel is not initialized. Run "agc init" first.'));
14
- return;
15
- }
16
12
  const agCelDir = (0, index_js_1.getAgCelDir)();
17
- // Check both source and local directories
18
- // For now, let's assume we list what's in .agc
19
- // Ideally, we should also check the global or project skills if integrated.
20
- // NOTE: In a real implementation, we might want to list from the temp_skills directory too if configured?
21
- // But per requirements, `agc init` creates .agc.
22
- // Let's list from .AgCel/<type>
13
+ const globalDir = (0, index_js_1.getGlobalAgCelDir)();
23
14
  let targetDir = path_1.default.join(agCelDir, type);
24
- // FIX: Workflows are stored in .agent/workflows, not .agc/workflows
25
15
  if (type === 'workflows') {
26
16
  targetDir = path_1.default.join(process.cwd(), '.agent', 'workflows');
27
17
  }
28
- if (!fs_1.default.existsSync(targetDir)) {
29
- console.log(chalk_1.default.yellow(`No ${type} directory found in .agc.`));
30
- return;
18
+ if (!(0, index_js_1.isInitialized)() || !fs_1.default.existsSync(targetDir)) {
19
+ console.log(chalk_1.default.yellow(`Project not initialized or ${type} not found locally. Listing global ${type}...`));
20
+ targetDir = path_1.default.join(globalDir, type === 'workflows' ? 'workflows' : 'skills');
31
21
  }
32
22
  try {
33
23
  const items = fs_1.default.readdirSync(targetDir).filter(item => {
@@ -14,8 +14,7 @@ const index_js_1 = require("../utils/index.js");
14
14
  async function uninstallCommand() {
15
15
  const globalDir = (0, index_js_1.getGlobalAgCelDir)();
16
16
  const mcpConfigPath = path_1.default.join(os_1.default.homedir(), '.gemini', 'antigravity', 'mcp_config.json');
17
- console.log(chalk_1.default.blue('Uninstalling AgCel...'));
18
- let requiresSudo = false;
17
+ console.log(chalk_1.default.blue('Cleaning up AgCel configuration and data...'));
19
18
  // 1. Remove from MCP Config
20
19
  if (fs_1.default.existsSync(mcpConfigPath)) {
21
20
  try {
@@ -26,53 +25,46 @@ async function uninstallCommand() {
26
25
  fs_1.default.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
27
26
  console.log(chalk_1.default.green(`Removed AgCel from ${mcpConfigPath}`));
28
27
  }
29
- else {
30
- console.log(chalk_1.default.yellow('AgCel not found in MCP config.'));
31
- }
32
28
  }
33
29
  catch (error) {
34
30
  console.error(chalk_1.default.red('Failed to update MCP config:'), error);
35
31
  }
36
32
  }
37
- else {
38
- console.log(chalk_1.default.yellow('MCP config not found.'));
39
- }
40
- // 2. Remove Global Directory
33
+ // 2. Remove Global Data Directory (~/.agcel)
41
34
  if (fs_1.default.existsSync(globalDir)) {
42
- try {
43
- fs_1.default.rmSync(globalDir, { recursive: true, force: true });
44
- console.log(chalk_1.default.green(`Removed global directory at ${globalDir}`));
45
- }
46
- catch (error) {
47
- if (error.code === 'EACCES') {
48
- console.error(chalk_1.default.red(`Permission denied removing ${globalDir}. You might need sudo.`));
49
- requiresSudo = true;
35
+ const answer = await inquirer_1.default.prompt([{
36
+ type: 'confirm',
37
+ name: 'removeData',
38
+ message: `Do you want to remove the global data directory at ${globalDir}? (this deletes global logs and skills)`,
39
+ default: true
40
+ }]);
41
+ if (answer.removeData) {
42
+ try {
43
+ fs_1.default.rmSync(globalDir, { recursive: true, force: true });
44
+ console.log(chalk_1.default.green(`Removed global directory at ${globalDir}`));
50
45
  }
51
- else {
52
- console.error(chalk_1.default.red(`Failed to remove global directory:`), error);
46
+ catch (error) {
47
+ console.error(chalk_1.default.red(`Failed to remove global directory. You may need to delete it manually: sudo rm -rf ${globalDir}`));
53
48
  }
54
49
  }
55
50
  }
56
- else {
57
- console.log(chalk_1.default.yellow('Global directory not found.'));
58
- }
59
51
  // 3. Prompt for npm uninstall
60
- const answer = await inquirer_1.default.prompt([{
52
+ const npmAnswer = await inquirer_1.default.prompt([{
61
53
  type: 'confirm',
62
54
  name: 'npmUninstall',
63
55
  message: 'Do you want to run "npm uninstall -g agcel" now?',
64
56
  default: true
65
57
  }]);
66
- if (answer.npmUninstall) {
58
+ if (npmAnswer.npmUninstall) {
67
59
  try {
68
60
  console.log(chalk_1.default.blue('Running "npm uninstall -g agcel"...'));
69
61
  (0, child_process_1.execSync)('npm uninstall -g agcel', { stdio: 'inherit' });
70
62
  console.log(chalk_1.default.green('AgCel package uninstalled successfully.'));
71
63
  }
72
64
  catch (error) {
73
- console.error(chalk_1.default.red('Failed to uninstall npm package.'));
74
- console.error(chalk_1.default.yellow('You might need to run: sudo npm uninstall -g agcel'));
65
+ console.error(chalk_1.default.red('Failed to uninstall npm package via CLI.'));
66
+ console.error(chalk_1.default.yellow('Please run manually: npm uninstall -g agcel'));
75
67
  }
76
68
  }
77
- console.log(chalk_1.default.green('AgCel uninstallation complete.'));
69
+ console.log(chalk_1.default.green('\nAgCel cleanup complete.'));
78
70
  }
package/dist/index.js CHANGED
@@ -8,12 +8,7 @@ const commander_1 = require("commander");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const init_js_1 = require("./commands/init.js");
11
- const install_js_1 = require("./commands/install.js");
12
11
  const uninstall_js_1 = require("./commands/uninstall.js");
13
- const start_js_1 = require("./commands/start.js");
14
- const stop_js_1 = require("./commands/stop.js");
15
- const restart_js_1 = require("./commands/restart.js");
16
- const status_js_1 = require("./commands/status.js");
17
12
  const list_js_1 = require("./commands/list.js");
18
13
  const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(__dirname, '..', 'package.json'), 'utf-8'));
19
14
  const program = new commander_1.Command();
@@ -25,30 +20,10 @@ program
25
20
  .command('init')
26
21
  .description('Initialize AgCel in the current directory')
27
22
  .action(init_js_1.initCommand);
28
- program
29
- .command('install')
30
- .description('Install AgCel globally')
31
- .action(install_js_1.installCommand);
32
23
  program
33
24
  .command('uninstall')
34
- .description('Uninstall AgCel globally')
25
+ .description('Clean up AgCel configuration and data')
35
26
  .action(uninstall_js_1.uninstallCommand);
36
- program
37
- .command('start')
38
- .description('Start the MCP server locally')
39
- .action(start_js_1.startCommand);
40
- program
41
- .command('stop')
42
- .description('Stop the MCP server locally')
43
- .action(stop_js_1.stopCommand);
44
- program
45
- .command('restart')
46
- .description('Restart the MCP server locally')
47
- .action(restart_js_1.restartCommand);
48
- program
49
- .command('status')
50
- .description('Check the status of the MCP server')
51
- .action(status_js_1.statusCommand);
52
27
  const skillsCommand = new commander_1.Command('skills');
53
28
  skillsCommand
54
29
  .command('list')
@@ -3,16 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AG_CEL_PID_FILE = exports.AG_CEL_CONFIG_FILE = exports.AG_CEL_DIR = void 0;
6
+ exports.AG_CEL_CONFIG_FILE = exports.AG_CEL_DIR = void 0;
7
7
  exports.getPackageRoot = getPackageRoot;
8
8
  exports.getAgCelDir = getAgCelDir;
9
9
  exports.getGlobalAgCelDir = getGlobalAgCelDir;
10
10
  exports.isInitialized = isInitialized;
11
- exports.getPidFile = getPidFile;
12
- exports.savePid = savePid;
13
- exports.getPid = getPid;
14
- exports.removePid = removePid;
15
- exports.isRunning = isRunning;
16
11
  const fs_1 = __importDefault(require("fs"));
17
12
  const path_1 = __importDefault(require("path"));
18
13
  const os_1 = __importDefault(require("os"));
@@ -22,7 +17,6 @@ function getPackageRoot() {
22
17
  }
23
18
  exports.AG_CEL_DIR = '.agc';
24
19
  exports.AG_CEL_CONFIG_FILE = 'config.json';
25
- exports.AG_CEL_PID_FILE = 'mcp-server.pid';
26
20
  function getAgCelDir() {
27
21
  return path_1.default.join(process.cwd(), exports.AG_CEL_DIR);
28
22
  }
@@ -32,32 +26,3 @@ function getGlobalAgCelDir() {
32
26
  function isInitialized() {
33
27
  return fs_1.default.existsSync(getAgCelDir());
34
28
  }
35
- function getPidFile() {
36
- return path_1.default.join(getAgCelDir(), exports.AG_CEL_PID_FILE);
37
- }
38
- function savePid(pid) {
39
- fs_1.default.writeFileSync(getPidFile(), pid.toString());
40
- }
41
- function getPid() {
42
- const pidFile = getPidFile();
43
- if (fs_1.default.existsSync(pidFile)) {
44
- const pid = parseInt(fs_1.default.readFileSync(pidFile, 'utf-8'), 10);
45
- return pid;
46
- }
47
- return null;
48
- }
49
- function removePid() {
50
- const pidFile = getPidFile();
51
- if (fs_1.default.existsSync(pidFile)) {
52
- fs_1.default.unlinkSync(pidFile);
53
- }
54
- }
55
- function isRunning(pid) {
56
- try {
57
- process.kill(pid, 0);
58
- return true;
59
- }
60
- catch (e) {
61
- return false;
62
- }
63
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agcel",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Antigravity Context Engineering Library is a local MCP (Model Context Protocol) Server containing multiple skills, rules and workflows for end to end software development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -51,4 +51,4 @@
51
51
  "@types/node": "^20.11.19",
52
52
  "typescript": "^5.3.3"
53
53
  }
54
- }
54
+ }
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.installCommand = installCommand;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const os_1 = __importDefault(require("os"));
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const child_process_1 = require("child_process");
12
- const index_js_1 = require("../utils/index.js");
13
- async function installCommand() {
14
- const globalDir = (0, index_js_1.getGlobalAgCelDir)();
15
- const packageRoot = (0, index_js_1.getPackageRoot)();
16
- console.log(chalk_1.default.blue('Installing AgCel globally...'));
17
- try {
18
- // 1. Create global directory
19
- if (!fs_1.default.existsSync(globalDir)) {
20
- console.log(chalk_1.default.blue(`Creating global directory at ${globalDir}...`));
21
- fs_1.default.mkdirSync(globalDir, { recursive: true });
22
- }
23
- else {
24
- console.log(chalk_1.default.yellow(`Global directory already exists at ${globalDir}. Updating...`));
25
- }
26
- // 2. Copy necessary files (dist, skills, workflows, package.json)
27
- const dirsToCopy = [
28
- { src: 'dist', dest: 'dist' },
29
- { src: 'skills', dest: 'skills' },
30
- { src: '.agent/workflows', dest: 'workflows' } // Normalize workflows path
31
- ];
32
- for (const dir of dirsToCopy) {
33
- const srcPath = path_1.default.join(packageRoot, dir.src);
34
- const destPath = path_1.default.join(globalDir, dir.dest);
35
- if (fs_1.default.existsSync(srcPath)) {
36
- console.log(chalk_1.default.blue(`Copying ${dir.src} to ${destPath}...`));
37
- // Remove destination if it exists to ensure clean copy
38
- if (fs_1.default.existsSync(destPath)) {
39
- fs_1.default.rmSync(destPath, { recursive: true, force: true });
40
- }
41
- fs_1.default.cpSync(srcPath, destPath, { recursive: true });
42
- }
43
- else {
44
- console.warn(chalk_1.default.yellow(`Warning: Source directory ${srcPath} not found.`));
45
- }
46
- }
47
- // Copy package.json for dependencies
48
- const packageJsonSrc = path_1.default.join(packageRoot, 'package.json');
49
- const packageJsonDest = path_1.default.join(globalDir, 'package.json');
50
- if (fs_1.default.existsSync(packageJsonSrc)) {
51
- fs_1.default.copyFileSync(packageJsonSrc, packageJsonDest);
52
- }
53
- // 3. Install dependencies in global dir
54
- console.log(chalk_1.default.blue('Installing dependencies in global directory...'));
55
- try {
56
- (0, child_process_1.execSync)('npm install --production', { cwd: globalDir, stdio: 'inherit' });
57
- }
58
- catch (e) {
59
- console.error(chalk_1.default.red('Failed to install dependencies.'), e);
60
- }
61
- // 4. Register with Antigravity
62
- const mcpConfigPath = path_1.default.join(os_1.default.homedir(), '.gemini/antigravity/mcp_config.json');
63
- let mcpConfig = { mcpServers: {} };
64
- if (fs_1.default.existsSync(mcpConfigPath)) {
65
- try {
66
- const content = fs_1.default.readFileSync(mcpConfigPath, 'utf-8');
67
- if (content.trim()) {
68
- mcpConfig = JSON.parse(content);
69
- }
70
- }
71
- catch (e) {
72
- console.warn(chalk_1.default.yellow('Existing MCP config invalid. Creating new.'));
73
- }
74
- }
75
- else {
76
- fs_1.default.mkdirSync(path_1.default.dirname(mcpConfigPath), { recursive: true });
77
- }
78
- if (!mcpConfig.mcpServers)
79
- mcpConfig.mcpServers = {};
80
- const serverPath = path_1.default.join(globalDir, 'dist/server/index.js');
81
- mcpConfig.mcpServers['agcel'] = {
82
- command: 'node',
83
- args: [serverPath],
84
- env: {
85
- // Ensure the server knows where to find everything
86
- NODE_ENV: 'production'
87
- }
88
- };
89
- fs_1.default.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
90
- console.log(chalk_1.default.green(`Successfully registered AgCel in ${mcpConfigPath}`));
91
- console.log(chalk_1.default.green('AgCel installed successfully!'));
92
- console.log(chalk_1.default.cyan('You can now run "agc init" in your projects to set them up.'));
93
- }
94
- catch (error) {
95
- console.error(chalk_1.default.red('Failed to install AgCel:'), error);
96
- process.exit(1);
97
- }
98
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.restartCommand = restartCommand;
7
- const stop_js_1 = require("./stop.js");
8
- const start_js_1 = require("./start.js");
9
- const chalk_1 = __importDefault(require("chalk"));
10
- function restartCommand() {
11
- console.log(chalk_1.default.blue('Restarting AgCel MCP server...'));
12
- (0, stop_js_1.stopCommand)();
13
- // Add a small delay to ensure the port is released
14
- setTimeout(() => {
15
- (0, start_js_1.startCommand)();
16
- }, 1000);
17
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.startCommand = startCommand;
7
- const child_process_1 = require("child_process");
8
- const path_1 = __importDefault(require("path"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const index_js_1 = require("../utils/index.js");
12
- function startCommand() {
13
- if (!(0, index_js_1.isInitialized)()) {
14
- console.error(chalk_1.default.red('AgCel is not initialized. Run "agc init" first.'));
15
- return;
16
- }
17
- const existingPid = (0, index_js_1.getPid)();
18
- if (existingPid && (0, index_js_1.isRunning)(existingPid)) {
19
- console.log(chalk_1.default.yellow(`AgCel MCP server is already running (PID: ${existingPid})`));
20
- return;
21
- }
22
- console.log(chalk_1.default.blue('Starting AgCel MCP server...'));
23
- const serverScript = path_1.default.resolve(__dirname, '../../dist/server/index.js');
24
- const logFile = path_1.default.join((0, index_js_1.getAgCelDir)(), 'server.log');
25
- const out = fs_1.default.openSync(logFile, 'a');
26
- const err = fs_1.default.openSync(logFile, 'a');
27
- const child = (0, child_process_1.spawn)('node', [serverScript, '--mode', 'sse'], {
28
- detached: true,
29
- stdio: ['ignore', out, err],
30
- cwd: process.cwd()
31
- });
32
- if (child.pid) {
33
- (0, index_js_1.savePid)(child.pid);
34
- child.unref();
35
- console.log(chalk_1.default.green(`AgCel MCP server started successfully (PID: ${child.pid})`));
36
- console.log(chalk_1.default.cyan(`Logs are being written to ${logFile}`));
37
- }
38
- else {
39
- console.error(chalk_1.default.red('Failed to start AgCel MCP server.'));
40
- }
41
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.statusCommand = statusCommand;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const index_js_1 = require("../utils/index.js");
9
- function statusCommand() {
10
- if (!(0, index_js_1.isInitialized)()) {
11
- console.log(chalk_1.default.red('AgCel is not initialized. Run "agc init" first.'));
12
- return;
13
- }
14
- const pid = (0, index_js_1.getPid)();
15
- if (pid && (0, index_js_1.isRunning)(pid)) {
16
- console.log(chalk_1.default.green(`AgCel MCP server is running (PID: ${pid})`));
17
- }
18
- else {
19
- console.log(chalk_1.default.yellow('AgCel MCP server is stopped'));
20
- if (pid) {
21
- console.log(chalk_1.default.yellow('(PID file exists but process is not running)'));
22
- }
23
- }
24
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.stopCommand = stopCommand;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const index_js_1 = require("../utils/index.js");
9
- function stopCommand() {
10
- const pid = (0, index_js_1.getPid)();
11
- if (!pid) {
12
- console.log(chalk_1.default.yellow('AgCel MCP server is not running (no PID file found).'));
13
- return;
14
- }
15
- if (!(0, index_js_1.isRunning)(pid)) {
16
- console.log(chalk_1.default.yellow(`AgCel MCP server is not running (PID ${pid} not found). Cleaning up PID file.`));
17
- (0, index_js_1.removePid)();
18
- return;
19
- }
20
- console.log(chalk_1.default.blue(`Stopping AgCel MCP server (PID: ${pid})...`));
21
- try {
22
- process.kill(pid);
23
- (0, index_js_1.removePid)();
24
- console.log(chalk_1.default.green('AgCel MCP server stopped successfully.'));
25
- }
26
- catch (error) {
27
- console.error(chalk_1.default.red('Failed to stop AgCel MCP server:'), error);
28
- }
29
- }