@eagi/cli 0.1.0

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.
@@ -0,0 +1,14 @@
1
+
2
+ > @eagi/cli@0.1.0 build /home/runner/work/eagi-mcp-framework/eagi-mcp-framework/packages/cli
3
+ > tsup src/index.ts --format cjs --dts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Target: es2022
9
+ CJS Build start
10
+ CJS dist/index.js 8.05 KB
11
+ CJS ⚡️ Build success in 22ms
12
+ DTS Build start
13
+ DTS ⚡️ Build success in 1485ms
14
+ DTS dist/index.d.ts 20.00 B
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ EAGI Sustainable Use License
2
+
3
+ Version 1.0, June 2026
4
+
5
+ Copyright (c) 2026 EAGI Authors
6
+
7
+ This License governs the use of the EAGI MCP Framework (including its SDK, CLI, and Gateway). By using, copying, modifying, or distributing this software, you agree to comply with the terms of this License.
8
+
9
+ 1. Grant of License
10
+ Subject to the restrictions in Section 2, the authors hereby grant you a free, worldwide, non-exclusive, non-transferable, revocable license to:
11
+ a) Use, copy, and run the software for personal, educational, research, and internal business operations.
12
+ b) Modify the software's source code for your personal or internal business operations.
13
+ c) Distribute modifications of the software, provided that any recipient is bound by the terms of this License.
14
+
15
+ 2. Restrictions on Commercial and Competitive Use
16
+ You may NOT do any of the following without obtaining prior, written, explicit commercial licensing permission from the copyright holders:
17
+ a) Offer the software or any modified version thereof as a hosted service, Software-as-a-Service (SaaS), Platform-as-a-Service (PaaS), or managed cloud product where the core value or primary functionality derived by users comes from this software.
18
+ b) Sell, rent, lease, or sub-license the software, or any modified version thereof, for a fee.
19
+ c) Embed, bundle, or white-label the software (or any modified version thereof) inside a commercial application, platform, or hardware product that is distributed or sold to third parties.
20
+
21
+ 3. Professional Services Exception
22
+ You ARE permitted to charge for professional services related to this software (such as custom domain consulting, building workflows, training, deployment help, or infrastructure management) provided that your clients host and manage their own instances under their own names and comply with Section 1 and 2 of this License.
23
+
24
+ 4. Intellectual Property
25
+ All rights, title, and interest in and to the software, including copyright and other intellectual property rights, remain the exclusive property of the authors.
26
+
27
+ 5. Disclaimer of Warranty
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/index.js ADDED
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+
26
+ // src/index.ts
27
+ var import_commander5 = require("commander");
28
+
29
+ // src/commands/init.ts
30
+ var import_commander = require("commander");
31
+ var import_node_fs = require("fs");
32
+ var import_node_path = require("path");
33
+ var import_chalk = __toESM(require("chalk"));
34
+ var initCommand = new import_commander.Command("init").description("Scaffold a new EAGI project").argument("[name]", "Project name", "my-eagi-app").action((name) => {
35
+ console.log(import_chalk.default.blue(`Initializing EAGI project: ${name}...`));
36
+ const targetDir = (0, import_node_path.join)(process.cwd(), name);
37
+ (0, import_node_fs.mkdirSync)(targetDir, { recursive: true });
38
+ (0, import_node_fs.writeFileSync)((0, import_node_path.join)(targetDir, "package.json"), JSON.stringify({
39
+ name,
40
+ version: "0.1.0",
41
+ scripts: {
42
+ "dev": "eagi dev",
43
+ "serve": "eagi serve"
44
+ },
45
+ dependencies: {
46
+ "@eagi/sdk": "^0.1.0",
47
+ "zod": "^3.22.4"
48
+ }
49
+ }, null, 2));
50
+ (0, import_node_fs.writeFileSync)((0, import_node_path.join)(targetDir, "eagi.config.ts"), `import { defineConfig } from '@eagi/sdk';
51
+
52
+ export default defineConfig({
53
+ name: '${name}',
54
+ version: '0.1.0',
55
+ domains: {}
56
+ });
57
+ `);
58
+ console.log(import_chalk.default.green(`\u2713 Project ${name} scaffolded.`));
59
+ console.log(`
60
+ Next steps:
61
+ cd ${name}
62
+ npm install
63
+ npx eagi add domain core
64
+ npm run dev`);
65
+ });
66
+
67
+ // src/commands/add.ts
68
+ var import_commander2 = require("commander");
69
+ var import_node_fs2 = require("fs");
70
+ var import_node_path2 = require("path");
71
+ var import_chalk2 = __toESM(require("chalk"));
72
+ var addCommand = new import_commander2.Command("add").description("Add a new domain module").argument("<type>", 'Type to add (currently only "domain")').argument("<name>", "Name of the domain").action((type, name) => {
73
+ if (type !== "domain") {
74
+ console.error(import_chalk2.default.red('Only "domain" is supported right now.'));
75
+ process.exit(1);
76
+ }
77
+ console.log(import_chalk2.default.blue(`Scaffolding domain: ${name}...`));
78
+ const domainDir = (0, import_node_path2.join)(process.cwd(), "domains", name);
79
+ (0, import_node_fs2.mkdirSync)((0, import_node_path2.join)(domainDir, "tools"), { recursive: true });
80
+ (0, import_node_fs2.mkdirSync)((0, import_node_path2.join)(domainDir, "resources"), { recursive: true });
81
+ (0, import_node_fs2.mkdirSync)((0, import_node_path2.join)(domainDir, "prompts"), { recursive: true });
82
+ (0, import_node_fs2.mkdirSync)((0, import_node_path2.join)(domainDir, "services"), { recursive: true });
83
+ (0, import_node_fs2.mkdirSync)((0, import_node_path2.join)(domainDir, "hooks"), { recursive: true });
84
+ (0, import_node_fs2.writeFileSync)((0, import_node_path2.join)(domainDir, "domain.yaml"), `name: ${name}
85
+ version: 1.0.0
86
+ description: ${name} domain
87
+ `);
88
+ (0, import_node_fs2.writeFileSync)((0, import_node_path2.join)(domainDir, "hooks", "index.ts"), `import { defineHooks } from '@eagi/sdk';
89
+
90
+ export default defineHooks({});
91
+ `);
92
+ console.log(import_chalk2.default.green(`\u2713 Domain ${name} created.`));
93
+ });
94
+
95
+ // src/commands/dev.ts
96
+ var import_commander3 = require("commander");
97
+ var import_sdk = require("@eagi/sdk");
98
+ var import_node_fs3 = require("fs");
99
+ var import_node_path3 = require("path");
100
+ var import_chalk3 = __toESM(require("chalk"));
101
+ var devCommand = new import_commander3.Command("dev").description("Start the EAGI server in development mode").action(async () => {
102
+ console.log(import_chalk3.default.yellow("Starting EAGI in DEV mode (hot-reload coming soon)..."));
103
+ await runServer();
104
+ });
105
+ async function runServer() {
106
+ const cwd = process.cwd();
107
+ const configPath = (0, import_node_path3.join)(cwd, "eagi.config.ts");
108
+ let config = { name: "eagi-server", version: "1.0.0" };
109
+ if ((0, import_node_fs3.existsSync)(configPath)) {
110
+ config = require((0, import_node_path3.join)(cwd, "eagi.config.js")) || config;
111
+ }
112
+ const domainsDir = (0, import_node_path3.join)(cwd, "domains");
113
+ let domainDirs = [];
114
+ if ((0, import_node_fs3.existsSync)(domainsDir)) {
115
+ domainDirs = (0, import_node_fs3.readdirSync)(domainsDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => (0, import_node_path3.join)(domainsDir, dirent.name));
116
+ } else {
117
+ if ((0, import_node_fs3.existsSync)((0, import_node_path3.join)(cwd, "domain.yaml"))) {
118
+ domainDirs = [cwd];
119
+ }
120
+ }
121
+ const runner = new import_sdk.EagiRunner(config);
122
+ await runner.start(domainDirs);
123
+ console.log(import_chalk3.default.green("\u2713 EAGI Server started on stdio transport."));
124
+ }
125
+
126
+ // src/commands/serve.ts
127
+ var import_commander4 = require("commander");
128
+ var import_sdk2 = require("@eagi/sdk");
129
+ var import_node_child_process = require("child_process");
130
+ var import_node_fs4 = require("fs");
131
+ var import_node_path4 = require("path");
132
+ var import_chalk4 = __toESM(require("chalk"));
133
+ var serveCommand = new import_commander4.Command("serve").description("Start the EAGI Gateway Control Plane (Production mode)").action(() => {
134
+ console.log(import_chalk4.default.blue("Starting EAGI Gateway Control Plane..."));
135
+ const gatewayPath = (0, import_node_path4.join)(process.cwd(), "gateway", "eagi-gateway");
136
+ const child = (0, import_node_child_process.spawn)(gatewayPath, [], {
137
+ cwd: process.cwd(),
138
+ stdio: "inherit",
139
+ env: { ...process.env, DOMAIN_DIR: process.cwd() }
140
+ });
141
+ child.on("error", (err) => {
142
+ console.log(import_chalk4.default.yellow("Compiled binary not found, attempting go run..."));
143
+ const repoRoot = (0, import_node_path4.join)(__dirname, "../../../../");
144
+ const goChild = (0, import_node_child_process.spawn)("go", ["run", "./cmd/eagi-gateway"], {
145
+ cwd: (0, import_node_path4.join)(repoRoot, "gateway"),
146
+ stdio: "inherit",
147
+ env: { ...process.env, DOMAIN_DIR: process.cwd() }
148
+ });
149
+ goChild.on("error", (e) => console.error(import_chalk4.default.red("Failed to start: " + e.message)));
150
+ });
151
+ });
152
+ var serveDomainCommand = new import_commander4.Command("serve-domain").description("Internal: Start a specific Node.js domain server").option("--domain <name>", "Name of the domain to serve").action(async (options) => {
153
+ if (!options.domain) {
154
+ console.error(import_chalk4.default.red("--domain is required"));
155
+ process.exit(1);
156
+ }
157
+ const cwd = process.cwd();
158
+ const configPath = (0, import_node_path4.join)(cwd, "eagi.config.ts");
159
+ let config = { name: "eagi-server", version: "1.0.0" };
160
+ if ((0, import_node_fs4.existsSync)(configPath)) {
161
+ try {
162
+ config = require((0, import_node_path4.join)(cwd, "eagi.config.js")) || config;
163
+ } catch (e) {
164
+ }
165
+ }
166
+ const domainDirs = [(0, import_node_path4.join)(cwd, "domains", options.domain)];
167
+ const runner = new import_sdk2.EagiRunner(config);
168
+ await runner.start(domainDirs);
169
+ });
170
+
171
+ // src/index.ts
172
+ var program = new import_commander5.Command();
173
+ program.name("eagi").description("Enterprise AGI - Framework CLI").version("0.1.0");
174
+ program.addCommand(initCommand);
175
+ program.addCommand(addCommand);
176
+ program.addCommand(devCommand);
177
+ program.addCommand(serveCommand);
178
+ program.addCommand(serveDomainCommand);
179
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@eagi/cli",
3
+ "version": "0.1.0",
4
+ "description": "Enterprise AGI - CLI tool",
5
+ "bin": {
6
+ "eagi": "./dist/index.js"
7
+ },
8
+ "dependencies": {
9
+ "commander": "^12.0.0",
10
+ "chalk": "^5.3.0",
11
+ "inquirer": "^9.2.14",
12
+ "@eagi/sdk": "0.1.0"
13
+ },
14
+ "devDependencies": {
15
+ "@types/node": "^20.0.0",
16
+ "@types/inquirer": "^9.0.7",
17
+ "tsup": "^8.0.2",
18
+ "typescript": "^5.4.0"
19
+ },
20
+ "scripts": {
21
+ "build": "tsup src/index.ts --format cjs --dts",
22
+ "dev": "tsup src/index.ts --format cjs --dts --watch"
23
+ }
24
+ }
@@ -0,0 +1,32 @@
1
+ import { Command } from 'commander';
2
+ import { writeFileSync, mkdirSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import chalk from 'chalk';
5
+
6
+ export const addCommand = new Command('add')
7
+ .description('Add a new domain module')
8
+ .argument('<type>', 'Type to add (currently only "domain")')
9
+ .argument('<name>', 'Name of the domain')
10
+ .action((type, name) => {
11
+ if (type !== 'domain') {
12
+ console.error(chalk.red('Only "domain" is supported right now.'));
13
+ process.exit(1);
14
+ }
15
+
16
+ console.log(chalk.blue(`Scaffolding domain: ${name}...`));
17
+
18
+ const domainDir = join(process.cwd(), 'domains', name);
19
+ mkdirSync(join(domainDir, 'tools'), { recursive: true });
20
+ mkdirSync(join(domainDir, 'resources'), { recursive: true });
21
+ mkdirSync(join(domainDir, 'prompts'), { recursive: true });
22
+ mkdirSync(join(domainDir, 'services'), { recursive: true });
23
+ mkdirSync(join(domainDir, 'hooks'), { recursive: true });
24
+
25
+ // domain.yaml
26
+ writeFileSync(join(domainDir, 'domain.yaml'), `name: ${name}\nversion: 1.0.0\ndescription: ${name} domain\n`);
27
+
28
+ // hooks/index.ts
29
+ writeFileSync(join(domainDir, 'hooks', 'index.ts'), `import { defineHooks } from '@eagi/sdk';\n\nexport default defineHooks({});\n`);
30
+
31
+ console.log(chalk.green(`✓ Domain ${name} created.`));
32
+ });
@@ -0,0 +1,44 @@
1
+ import { Command } from 'commander';
2
+ import { EagiRunner } from '@eagi/sdk';
3
+ import { readdirSync, existsSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import chalk from 'chalk';
6
+
7
+ export const devCommand = new Command('dev')
8
+ .description('Start the EAGI server in development mode')
9
+ .action(async () => {
10
+ console.log(chalk.yellow('Starting EAGI in DEV mode (hot-reload coming soon)...'));
11
+ await runServer();
12
+ });
13
+
14
+
15
+
16
+ async function runServer() {
17
+ const cwd = process.cwd();
18
+
19
+ // Load config
20
+ const configPath = join(cwd, 'eagi.config.ts');
21
+ let config = { name: 'eagi-server', version: '1.0.0' };
22
+ if (existsSync(configPath)) {
23
+ // In a real CLI, we would use something like jiti to load TS config
24
+ config = require(join(cwd, 'eagi.config.js')) || config;
25
+ }
26
+
27
+ // Find domains
28
+ const domainsDir = join(cwd, 'domains');
29
+ let domainDirs: string[] = [];
30
+ if (existsSync(domainsDir)) {
31
+ domainDirs = readdirSync(domainsDir, { withFileTypes: true })
32
+ .filter(dirent => dirent.isDirectory())
33
+ .map(dirent => join(domainsDir, dirent.name));
34
+ } else {
35
+ // If running in a specific domain dir directly
36
+ if (existsSync(join(cwd, 'domain.yaml'))) {
37
+ domainDirs = [cwd];
38
+ }
39
+ }
40
+
41
+ const runner = new EagiRunner(config as any);
42
+ await runner.start(domainDirs);
43
+ console.log(chalk.green('✓ EAGI Server started on stdio transport.'));
44
+ }
@@ -0,0 +1,41 @@
1
+ import { Command } from 'commander';
2
+ import { writeFileSync, mkdirSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import chalk from 'chalk';
5
+
6
+ export const initCommand = new Command('init')
7
+ .description('Scaffold a new EAGI project')
8
+ .argument('[name]', 'Project name', 'my-eagi-app')
9
+ .action((name) => {
10
+ console.log(chalk.blue(`Initializing EAGI project: ${name}...`));
11
+
12
+ const targetDir = join(process.cwd(), name);
13
+ mkdirSync(targetDir, { recursive: true });
14
+
15
+ // Write package.json
16
+ writeFileSync(join(targetDir, 'package.json'), JSON.stringify({
17
+ name,
18
+ version: '0.1.0',
19
+ scripts: {
20
+ "dev": "eagi dev",
21
+ "serve": "eagi serve"
22
+ },
23
+ dependencies: {
24
+ "@eagi/sdk": "^0.1.0",
25
+ "zod": "^3.22.4"
26
+ }
27
+ }, null, 2));
28
+
29
+ // Write eagi.config.ts
30
+ writeFileSync(join(targetDir, 'eagi.config.ts'), `import { defineConfig } from '@eagi/sdk';
31
+
32
+ export default defineConfig({
33
+ name: '${name}',
34
+ version: '0.1.0',
35
+ domains: {}
36
+ });
37
+ `);
38
+
39
+ console.log(chalk.green(`✓ Project ${name} scaffolded.`));
40
+ console.log(`\nNext steps:\n cd ${name}\n npm install\n npx eagi add domain core\n npm run dev`);
41
+ });
@@ -0,0 +1,58 @@
1
+ import { Command } from 'commander';
2
+ import { EagiRunner } from '@eagi/sdk';
3
+ import { spawn } from 'node:child_process';
4
+ import { readdirSync, existsSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import chalk from 'chalk';
7
+
8
+ export const serveCommand = new Command('serve')
9
+ .description('Start the EAGI Gateway Control Plane (Production mode)')
10
+ .action(() => {
11
+ console.log(chalk.blue('Starting EAGI Gateway Control Plane...'));
12
+
13
+ // In a real framework, this would execute a pre-compiled binary.
14
+ // For this monorepo MVP, we assume the gateway is built.
15
+ const gatewayPath = join(process.cwd(), 'gateway', 'eagi-gateway');
16
+
17
+ // Run the gateway
18
+ const child = spawn(gatewayPath, [], {
19
+ cwd: process.cwd(),
20
+ stdio: 'inherit',
21
+ env: { ...process.env, DOMAIN_DIR: process.cwd() }
22
+ });
23
+
24
+ child.on('error', (err) => {
25
+ // Fallback to go run if binary not found
26
+ console.log(chalk.yellow('Compiled binary not found, attempting go run...'));
27
+ const repoRoot = join(__dirname, '../../../../');
28
+ const goChild = spawn('go', ['run', './cmd/eagi-gateway'], {
29
+ cwd: join(repoRoot, 'gateway'),
30
+ stdio: 'inherit',
31
+ env: { ...process.env, DOMAIN_DIR: process.cwd() }
32
+ });
33
+ goChild.on('error', (e) => console.error(chalk.red("Failed to start: " + e.message)));
34
+ });
35
+ });
36
+
37
+ export const serveDomainCommand = new Command('serve-domain')
38
+ .description('Internal: Start a specific Node.js domain server')
39
+ .option('--domain <name>', 'Name of the domain to serve')
40
+ .action(async (options) => {
41
+ if (!options.domain) {
42
+ console.error(chalk.red('--domain is required'));
43
+ process.exit(1);
44
+ }
45
+
46
+ const cwd = process.cwd();
47
+ const configPath = join(cwd, 'eagi.config.ts');
48
+ let config = { name: 'eagi-server', version: '1.0.0' };
49
+
50
+ if (existsSync(configPath)) {
51
+ try { config = require(join(cwd, 'eagi.config.js')) || config; } catch(e) {}
52
+ }
53
+
54
+ const domainDirs = [join(cwd, 'domains', options.domain)];
55
+
56
+ const runner = new EagiRunner(config as any);
57
+ await runner.start(domainDirs);
58
+ });
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { initCommand } from './commands/init.js';
4
+ import { addCommand } from './commands/add.js';
5
+ import { devCommand } from './commands/dev.js';
6
+ import { serveCommand, serveDomainCommand } from './commands/serve.js';
7
+
8
+ const program = new Command();
9
+
10
+ program
11
+ .name('eagi')
12
+ .description('Enterprise AGI - Framework CLI')
13
+ .version('0.1.0');
14
+
15
+ program.addCommand(initCommand);
16
+ program.addCommand(addCommand);
17
+ program.addCommand(devCommand);
18
+ program.addCommand(serveCommand);
19
+ program.addCommand(serveDomainCommand);
20
+
21
+ program.parse();
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src",
6
+ "module": "NodeNext",
7
+ "moduleResolution": "NodeNext"
8
+ },
9
+ "include": ["src"]
10
+ }