agcel 1.0.1

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 (100) hide show
  1. package/.agent/workflows/api-gen.md +59 -0
  2. package/.agent/workflows/architect.md +44 -0
  3. package/.agent/workflows/brainstorm.md +223 -0
  4. package/.agent/workflows/build.md +38 -0
  5. package/.agent/workflows/changelog.md +51 -0
  6. package/.agent/workflows/checkpoint.md +138 -0
  7. package/.agent/workflows/commit.md +223 -0
  8. package/.agent/workflows/debug.md +57 -0
  9. package/.agent/workflows/deploy.md +76 -0
  10. package/.agent/workflows/doc.md +247 -0
  11. package/.agent/workflows/execute-plan.md +225 -0
  12. package/.agent/workflows/feature.md +255 -0
  13. package/.agent/workflows/fix.md +323 -0
  14. package/.agent/workflows/help.md +63 -0
  15. package/.agent/workflows/index.md +148 -0
  16. package/.agent/workflows/load.md +112 -0
  17. package/.agent/workflows/mode.md +170 -0
  18. package/.agent/workflows/optimize.md +53 -0
  19. package/.agent/workflows/plan.md +337 -0
  20. package/.agent/workflows/pr.md +74 -0
  21. package/.agent/workflows/product-plan.md +36 -0
  22. package/.agent/workflows/production-deploy.md +39 -0
  23. package/.agent/workflows/refactor.md +63 -0
  24. package/.agent/workflows/research.md +116 -0
  25. package/.agent/workflows/review.md +344 -0
  26. package/.agent/workflows/security-scan.md +56 -0
  27. package/.agent/workflows/ship.md +221 -0
  28. package/.agent/workflows/spawn.md +177 -0
  29. package/.agent/workflows/status.md +59 -0
  30. package/.agent/workflows/tdd.md +139 -0
  31. package/.agent/workflows/test.md +340 -0
  32. package/.agent/workflows/verify.md +35 -0
  33. package/LICENSE +21 -0
  34. package/README.md +67 -0
  35. package/dist/commands/init.js +142 -0
  36. package/dist/commands/install.js +98 -0
  37. package/dist/commands/list.js +49 -0
  38. package/dist/commands/restart.js +17 -0
  39. package/dist/commands/start.js +41 -0
  40. package/dist/commands/status.js +24 -0
  41. package/dist/commands/stop.js +29 -0
  42. package/dist/commands/uninstall.js +78 -0
  43. package/dist/index.js +58 -0
  44. package/dist/server/index.js +174 -0
  45. package/dist/utils/index.js +63 -0
  46. package/package.json +54 -0
  47. package/skills/api-security-best-practices/SKILL.md +291 -0
  48. package/skills/api-security-best-practices/references/examples.md +617 -0
  49. package/skills/architecture/SKILL.md +59 -0
  50. package/skills/architecture/context-discovery.md +43 -0
  51. package/skills/architecture/examples.md +94 -0
  52. package/skills/architecture/pattern-selection.md +68 -0
  53. package/skills/architecture/patterns-reference.md +50 -0
  54. package/skills/architecture/trade-off-analysis.md +77 -0
  55. package/skills/aws-serverless/SKILL.md +327 -0
  56. package/skills/brainstorming/SKILL.md +234 -0
  57. package/skills/c4-context/SKILL.md +154 -0
  58. package/skills/ci-cd-engineer/SKILL.md +50 -0
  59. package/skills/code-auditing/SKILL.md +55 -0
  60. package/skills/copywriting/SKILL.md +248 -0
  61. package/skills/database-engineer/SKILL.md +47 -0
  62. package/skills/doc-coauthoring/SKILL.md +379 -0
  63. package/skills/docker-expert/SKILL.md +412 -0
  64. package/skills/langgraph/SKILL.md +291 -0
  65. package/skills/postgresql/SKILL.md +73 -0
  66. package/skills/pricing-strategy/SKILL.md +360 -0
  67. package/skills/product-manager/SKILL.md +57 -0
  68. package/skills/prompt-engineer/README.md +659 -0
  69. package/skills/prompt-engineer/SKILL.md +256 -0
  70. package/skills/python-patterns/SKILL.md +445 -0
  71. package/skills/qa-engineer/SKILL.md +42 -0
  72. package/skills/rag-engineer/SKILL.md +94 -0
  73. package/skills/react-patterns/SKILL.md +202 -0
  74. package/skills/secure-refactoring/SKILL.md +54 -0
  75. package/skills/security-documentation/SKILL.md +53 -0
  76. package/skills/senior-architect/SKILL.md +213 -0
  77. package/skills/senior-architect/references/architecture_patterns.md +103 -0
  78. package/skills/senior-architect/references/system_design_workflows.md +103 -0
  79. package/skills/senior-architect/references/tech_decision_guide.md +103 -0
  80. package/skills/senior-architect/scripts/architecture_diagram_generator.py +114 -0
  81. package/skills/senior-architect/scripts/dependency_analyzer.py +114 -0
  82. package/skills/senior-architect/scripts/project_architect.py +114 -0
  83. package/skills/seo-audit/SKILL.md +491 -0
  84. package/skills/sql-injection-testing/SKILL.md +452 -0
  85. package/skills/test-driven-development/SKILL.md +375 -0
  86. package/skills/test-driven-development/testing-anti-patterns.md +299 -0
  87. package/skills/test-fixing/SKILL.md +123 -0
  88. package/skills/testing-patterns/SKILL.md +263 -0
  89. package/skills/typescript-expert/SKILL.md +202 -0
  90. package/skills/typescript-expert/references/advanced-topics.md +252 -0
  91. package/skills/typescript-expert/references/tsconfig-strict.json +92 -0
  92. package/skills/typescript-expert/references/typescript-cheatsheet.md +383 -0
  93. package/skills/typescript-expert/references/utility-types.ts +335 -0
  94. package/skills/typescript-expert/scripts/ts_diagnostic.py +203 -0
  95. package/skills/ui-ux-designer/SKILL.md +46 -0
  96. package/skills/vercel-deployment/SKILL.md +83 -0
  97. package/skills/vulnerability-scanner/SKILL.md +280 -0
  98. package/skills/vulnerability-scanner/checklists.md +121 -0
  99. package/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  100. package/skills/writing-plans/SKILL.md +120 -0
@@ -0,0 +1,98 @@
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
+ }
@@ -0,0 +1,49 @@
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.listCommand = listCommand;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const chalk_1 = __importDefault(require("chalk"));
10
+ const index_js_1 = require("../utils/index.js");
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
+ 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>
23
+ let targetDir = path_1.default.join(agCelDir, type);
24
+ // FIX: Workflows are stored in .agent/workflows, not .agc/workflows
25
+ if (type === 'workflows') {
26
+ targetDir = path_1.default.join(process.cwd(), '.agent', 'workflows');
27
+ }
28
+ if (!fs_1.default.existsSync(targetDir)) {
29
+ console.log(chalk_1.default.yellow(`No ${type} directory found in .agc.`));
30
+ return;
31
+ }
32
+ try {
33
+ const items = fs_1.default.readdirSync(targetDir).filter(item => {
34
+ return fs_1.default.statSync(path_1.default.join(targetDir, item)).isDirectory();
35
+ });
36
+ if (items.length === 0) {
37
+ console.log(chalk_1.default.yellow(`No ${type} found.`));
38
+ }
39
+ else {
40
+ console.log(chalk_1.default.blue(`Available ${type}:`));
41
+ items.forEach(item => {
42
+ console.log(`- ${item}`);
43
+ });
44
+ }
45
+ }
46
+ catch (error) {
47
+ console.error(chalk_1.default.red(`Failed to list ${type}:`), error);
48
+ }
49
+ }
@@ -0,0 +1,17 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,78 @@
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.uninstallCommand = uninstallCommand;
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 inquirer_1 = __importDefault(require("inquirer"));
12
+ const child_process_1 = require("child_process");
13
+ const index_js_1 = require("../utils/index.js");
14
+ async function uninstallCommand() {
15
+ const globalDir = (0, index_js_1.getGlobalAgCelDir)();
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;
19
+ // 1. Remove from MCP Config
20
+ if (fs_1.default.existsSync(mcpConfigPath)) {
21
+ try {
22
+ const content = fs_1.default.readFileSync(mcpConfigPath, 'utf-8');
23
+ const mcpConfig = JSON.parse(content);
24
+ if (mcpConfig.mcpServers && mcpConfig.mcpServers['agcel']) {
25
+ delete mcpConfig.mcpServers['agcel'];
26
+ fs_1.default.writeFileSync(mcpConfigPath, JSON.stringify(mcpConfig, null, 2));
27
+ console.log(chalk_1.default.green(`Removed AgCel from ${mcpConfigPath}`));
28
+ }
29
+ else {
30
+ console.log(chalk_1.default.yellow('AgCel not found in MCP config.'));
31
+ }
32
+ }
33
+ catch (error) {
34
+ console.error(chalk_1.default.red('Failed to update MCP config:'), error);
35
+ }
36
+ }
37
+ else {
38
+ console.log(chalk_1.default.yellow('MCP config not found.'));
39
+ }
40
+ // 2. Remove Global Directory
41
+ 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;
50
+ }
51
+ else {
52
+ console.error(chalk_1.default.red(`Failed to remove global directory:`), error);
53
+ }
54
+ }
55
+ }
56
+ else {
57
+ console.log(chalk_1.default.yellow('Global directory not found.'));
58
+ }
59
+ // 3. Prompt for npm uninstall
60
+ const answer = await inquirer_1.default.prompt([{
61
+ type: 'confirm',
62
+ name: 'npmUninstall',
63
+ message: 'Do you want to run "npm uninstall -g agcel" now?',
64
+ default: true
65
+ }]);
66
+ if (answer.npmUninstall) {
67
+ try {
68
+ console.log(chalk_1.default.blue('Running "npm uninstall -g agcel"...'));
69
+ (0, child_process_1.execSync)('npm uninstall -g agcel', { stdio: 'inherit' });
70
+ console.log(chalk_1.default.green('AgCel package uninstalled successfully.'));
71
+ }
72
+ 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'));
75
+ }
76
+ }
77
+ console.log(chalk_1.default.green('AgCel uninstallation complete.'));
78
+ }
package/dist/index.js ADDED
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const init_js_1 = require("./commands/init.js");
6
+ const install_js_1 = require("./commands/install.js");
7
+ const uninstall_js_1 = require("./commands/uninstall.js");
8
+ const start_js_1 = require("./commands/start.js");
9
+ const stop_js_1 = require("./commands/stop.js");
10
+ const restart_js_1 = require("./commands/restart.js");
11
+ const status_js_1 = require("./commands/status.js");
12
+ const list_js_1 = require("./commands/list.js");
13
+ const program = new commander_1.Command();
14
+ program
15
+ .name('agc')
16
+ .description('AgCel MCP Skills Server CLI')
17
+ .version('1.0.0');
18
+ program
19
+ .command('init')
20
+ .description('Initialize AgCel in the current directory')
21
+ .action(init_js_1.initCommand);
22
+ program
23
+ .command('install')
24
+ .description('Install AgCel globally')
25
+ .action(install_js_1.installCommand);
26
+ program
27
+ .command('uninstall')
28
+ .description('Uninstall AgCel globally')
29
+ .action(uninstall_js_1.uninstallCommand);
30
+ program
31
+ .command('start')
32
+ .description('Start the MCP server locally')
33
+ .action(start_js_1.startCommand);
34
+ program
35
+ .command('stop')
36
+ .description('Stop the MCP server locally')
37
+ .action(stop_js_1.stopCommand);
38
+ program
39
+ .command('restart')
40
+ .description('Restart the MCP server locally')
41
+ .action(restart_js_1.restartCommand);
42
+ program
43
+ .command('status')
44
+ .description('Check the status of the MCP server')
45
+ .action(status_js_1.statusCommand);
46
+ const skillskCommand = new commander_1.Command('skills');
47
+ skillskCommand
48
+ .command('list')
49
+ .description('List available skills')
50
+ .action(() => (0, list_js_1.listCommand)('skills'));
51
+ const workflowsCommand = new commander_1.Command('workflows');
52
+ workflowsCommand
53
+ .command('list')
54
+ .description('List available workflows')
55
+ .action(() => (0, list_js_1.listCommand)('workflows'));
56
+ program.addCommand(skillskCommand);
57
+ program.addCommand(workflowsCommand);
58
+ program.parse(process.argv);
@@ -0,0 +1,174 @@
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
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
7
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
8
+ const sse_js_1 = require("@modelcontextprotocol/sdk/server/sse.js");
9
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
10
+ const fs_1 = __importDefault(require("fs"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const express_1 = __importDefault(require("express"));
13
+ const cors_1 = __importDefault(require("cors"));
14
+ const index_js_2 = require("../utils/index.js");
15
+ // Argument parsing for transport mode
16
+ const args = process.argv.slice(2);
17
+ const modeIndex = args.indexOf('--mode');
18
+ const mode = modeIndex !== -1 ? args[modeIndex + 1] : 'stdio'; // Default to stdio if not specified
19
+ const server = new index_js_1.Server({
20
+ name: "AgCel",
21
+ version: "1.0.0",
22
+ }, {
23
+ capabilities: {
24
+ tools: {},
25
+ resources: {}
26
+ },
27
+ });
28
+ // Helper to load skills
29
+ // Helper to determine the skills directory
30
+ function getSkillsDir() {
31
+ const agCelDir = (0, index_js_2.getAgCelDir)();
32
+ let skillsDir = path_1.default.join(agCelDir, 'skills');
33
+ // Fallback for global install where skills are in project root (e.g. ~/.agc/skills)
34
+ if (!fs_1.default.existsSync(skillsDir)) {
35
+ skillsDir = path_1.default.join(process.cwd(), 'skills');
36
+ }
37
+ // Double fallback to global installation directory
38
+ if (!fs_1.default.existsSync(skillsDir)) {
39
+ skillsDir = path_1.default.join((0, index_js_2.getGlobalAgCelDir)(), 'skills');
40
+ }
41
+ if (!fs_1.default.existsSync(skillsDir))
42
+ return null;
43
+ return skillsDir;
44
+ }
45
+ // Helper to load skills
46
+ function getSkills() {
47
+ const skillsDir = getSkillsDir();
48
+ if (!skillsDir)
49
+ return [];
50
+ return fs_1.default.readdirSync(skillsDir).filter(skill => {
51
+ return fs_1.default.statSync(path_1.default.join(skillsDir, skill)).isDirectory() && fs_1.default.existsSync(path_1.default.join(skillsDir, skill, 'SKILL.md'));
52
+ });
53
+ }
54
+ // List Tools Handler
55
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
56
+ const skills = getSkills();
57
+ const tools = skills.map(skill => {
58
+ return {
59
+ name: skill,
60
+ description: `Retrieve instructions for the ${skill} skill`,
61
+ inputSchema: {
62
+ type: "object",
63
+ properties: {
64
+ instruction: {
65
+ type: "string",
66
+ description: "Context or specific requirements for retrieving the skill"
67
+ }
68
+ },
69
+ required: ["instruction"]
70
+ }
71
+ };
72
+ });
73
+ return {
74
+ tools: tools
75
+ };
76
+ });
77
+ // Call Tool Handler
78
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
79
+ const { name, arguments: args } = request.params;
80
+ const skills = getSkills();
81
+ const skillsDir = getSkillsDir();
82
+ if (skillsDir && skills.includes(name)) {
83
+ const skillPath = path_1.default.join(skillsDir, name, 'SKILL.md');
84
+ if (fs_1.default.existsSync(skillPath)) {
85
+ const content = fs_1.default.readFileSync(skillPath, 'utf-8');
86
+ const ironRule = `
87
+ ## Iron Rules
88
+ 1. If there is anything unclear, ask the user instead of inventing new stuff. Unless the user explicitly tells the AI to invent or suggest ideas.
89
+ `;
90
+ return {
91
+ content: [
92
+ {
93
+ type: "text",
94
+ text: content + ironRule
95
+ }
96
+ ]
97
+ };
98
+ }
99
+ }
100
+ throw new Error(`Tool not found: ${name}`);
101
+ });
102
+ // List Resources Handler
103
+ server.setRequestHandler(types_js_1.ListResourcesRequestSchema, async () => {
104
+ const skills = getSkills();
105
+ const resources = skills.map(skill => ({
106
+ uri: `agcel://skills/${skill}/SKILL.md`,
107
+ name: `${skill} Documentation`,
108
+ mimeType: "text/markdown"
109
+ }));
110
+ return { resources };
111
+ });
112
+ // Read Resource Handler
113
+ server.setRequestHandler(types_js_1.ReadResourceRequestSchema, async (request) => {
114
+ const { uri } = request.params;
115
+ const match = uri.match(/^agcel:\/\/skills\/([^\/]+)\/SKILL.md$/);
116
+ if (match) {
117
+ const skill = match[1];
118
+ const skillsDir = getSkillsDir();
119
+ if (skillsDir) {
120
+ const skillPath = path_1.default.join(skillsDir, skill, 'SKILL.md');
121
+ if (fs_1.default.existsSync(skillPath)) {
122
+ const content = fs_1.default.readFileSync(skillPath, 'utf-8');
123
+ return {
124
+ contents: [{ uri, mimeType: "text/markdown", text: content }]
125
+ };
126
+ }
127
+ }
128
+ }
129
+ throw new Error(`Resource not found: ${uri}`);
130
+ });
131
+ async function main() {
132
+ if (mode === 'sse') {
133
+ const app = (0, express_1.default)();
134
+ app.use((0, cors_1.default)());
135
+ const agCelDir = (0, index_js_2.getAgCelDir)();
136
+ const configPath = path_1.default.join(agCelDir, 'config.json');
137
+ let port = 3000;
138
+ if (fs_1.default.existsSync(configPath)) {
139
+ try {
140
+ const config = JSON.parse(fs_1.default.readFileSync(configPath, 'utf-8'));
141
+ if (config.port)
142
+ port = config.port;
143
+ }
144
+ catch (e) {
145
+ console.error("Failed to read config:", e);
146
+ }
147
+ }
148
+ let transport;
149
+ app.get('/sse', async (req, res) => {
150
+ transport = new sse_js_1.SSEServerTransport('/message', res);
151
+ await server.connect(transport);
152
+ });
153
+ app.post('/message', async (req, res) => {
154
+ if (transport) {
155
+ await transport.handlePostMessage(req, res);
156
+ }
157
+ else {
158
+ res.status(404).json({ error: "Session not found" });
159
+ }
160
+ });
161
+ app.listen(port, () => {
162
+ console.log(`AgCel MCP Server running on SSE at http://localhost:${port}/sse`);
163
+ });
164
+ }
165
+ else {
166
+ const transport = new stdio_js_1.StdioServerTransport();
167
+ await server.connect(transport);
168
+ console.error("AgCel MCP Server running on stdio");
169
+ }
170
+ }
171
+ main().catch((error) => {
172
+ console.error("Server error:", error);
173
+ process.exit(1);
174
+ });
@@ -0,0 +1,63 @@
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.AG_CEL_PID_FILE = exports.AG_CEL_CONFIG_FILE = exports.AG_CEL_DIR = void 0;
7
+ exports.getPackageRoot = getPackageRoot;
8
+ exports.getAgCelDir = getAgCelDir;
9
+ exports.getGlobalAgCelDir = getGlobalAgCelDir;
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
+ const fs_1 = __importDefault(require("fs"));
17
+ const path_1 = __importDefault(require("path"));
18
+ const os_1 = __importDefault(require("os"));
19
+ // In CJS, __dirname is available globally
20
+ function getPackageRoot() {
21
+ return path_1.default.resolve(__dirname, '..', '..');
22
+ }
23
+ exports.AG_CEL_DIR = '.agc';
24
+ exports.AG_CEL_CONFIG_FILE = 'config.json';
25
+ exports.AG_CEL_PID_FILE = 'mcp-server.pid';
26
+ function getAgCelDir() {
27
+ return path_1.default.join(process.cwd(), exports.AG_CEL_DIR);
28
+ }
29
+ function getGlobalAgCelDir() {
30
+ return path_1.default.join(os_1.default.homedir(), '.agcel');
31
+ }
32
+ function isInitialized() {
33
+ return fs_1.default.existsSync(getAgCelDir());
34
+ }
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
+ }