@aetherionfw/cli 1.0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cristian Londoño
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const init_1 = require("../commands/init");
10
+ const synth_1 = require("../commands/synth");
11
+ const deploy_1 = require("../commands/deploy");
12
+ const docs_1 = require("../commands/docs");
13
+ const program = new commander_1.Command();
14
+ program
15
+ .name('aetherion')
16
+ .description(chalk_1.default.blue('Aetherion Serverless Framework CLI'))
17
+ .version('1.0.0');
18
+ program
19
+ .command('init <project-name>')
20
+ .description('Initialize a new Aetherion project')
21
+ .action(init_1.initCommand);
22
+ program
23
+ .command('synth')
24
+ .description('Synthesize the infrastructure to CDKTF JSON')
25
+ .action(synth_1.synthCommand);
26
+ program
27
+ .command('deploy')
28
+ .description('Deploy the infrastructure to AWS')
29
+ .action(deploy_1.deployCommand);
30
+ program
31
+ .command('docs')
32
+ .description('Generate OpenAPI documentation')
33
+ .option('-s, --serve', 'Serve the documentation using Scalar UI locally')
34
+ .action(docs_1.docsCommand);
35
+ program.parse(process.argv);
36
+ if (!process.argv.slice(2).length) {
37
+ program.outputHelp();
38
+ }
@@ -0,0 +1 @@
1
+ export declare function deployCommand(): Promise<void>;
@@ -0,0 +1,23 @@
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.deployCommand = deployCommand;
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const ora_1 = __importDefault(require("ora"));
10
+ async function deployCommand() {
11
+ const spinner = (0, ora_1.default)('Deploying infrastructure to AWS...').start();
12
+ try {
13
+ // Using inherit to show CDKTF output directly to the user
14
+ spinner.stop();
15
+ console.log(chalk_1.default.blue('Running cdktf deploy...'));
16
+ (0, child_process_1.execSync)('cdktf deploy --auto-approve', { stdio: 'inherit' });
17
+ console.log(chalk_1.default.green('\nDeploy completed successfully.'));
18
+ }
19
+ catch (err) {
20
+ console.error(chalk_1.default.red('\nDeploy failed.'));
21
+ process.exit(1);
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export declare function docsCommand(options: any): Promise<void>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.docsCommand = docsCommand;
40
+ const chalk_1 = __importDefault(require("chalk"));
41
+ const ora_1 = __importDefault(require("ora"));
42
+ // Assuming the CLI runs in an environment where @aetherionfw/docs is accessible
43
+ // For a global CLI, we might need to dynamically import it from the user's workspace
44
+ const docs_1 = require("@aetherionfw/docs");
45
+ const path = __importStar(require("path"));
46
+ const fs = __importStar(require("fs"));
47
+ async function docsCommand(options) {
48
+ const isServe = options.serve;
49
+ const spinner = (0, ora_1.default)('Preparing OpenAPI documentation...').start();
50
+ try {
51
+ // Dynamically register ts-node to load TS files from the user project
52
+ require('ts-node').register({
53
+ transpileOnly: true,
54
+ compilerOptions: { module: 'commonjs' }
55
+ });
56
+ // Load the root app.module from the user's project
57
+ const appModulePath = path.resolve(process.cwd(), 'src/app.module.ts');
58
+ if (fs.existsSync(appModulePath)) {
59
+ require(appModulePath);
60
+ }
61
+ else {
62
+ spinner.warn(chalk_1.default.yellow('src/app.module.ts not found. API documentation might be empty.'));
63
+ }
64
+ if (isServe) {
65
+ spinner.succeed(chalk_1.default.green('Starting Scalar API Reference Server...'));
66
+ (0, docs_1.startScalarServer)(3000);
67
+ // Keep process alive
68
+ }
69
+ else {
70
+ (0, docs_1.generateStaticDocs)(process.cwd());
71
+ spinner.succeed(chalk_1.default.green('Documentation generated at openapi.json'));
72
+ }
73
+ }
74
+ catch (err) {
75
+ spinner.fail(chalk_1.default.red('Failed to process documentation.'));
76
+ console.error(err.message);
77
+ }
78
+ }
@@ -0,0 +1 @@
1
+ export declare function initCommand(projectName: string): Promise<void>;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.initCommand = initCommand;
40
+ const fs = __importStar(require("fs-extra"));
41
+ const path = __importStar(require("path"));
42
+ const chalk_1 = __importDefault(require("chalk"));
43
+ const ora_1 = __importDefault(require("ora"));
44
+ async function initCommand(projectName) {
45
+ const spinner = (0, ora_1.default)(`Initializing project ${chalk_1.default.cyan(projectName)}...`).start();
46
+ try {
47
+ const projectPath = path.resolve(process.cwd(), projectName);
48
+ if (fs.existsSync(projectPath)) {
49
+ spinner.fail(`Directory ${chalk_1.default.red(projectName)} already exists.`);
50
+ return;
51
+ }
52
+ // 1. Copy the entire template directory
53
+ // Assuming this file runs from `dist/commands/init.js`, the template is at `../../template`
54
+ // Depending on the build setup, we might need to adjust this path.
55
+ const templatePath = path.resolve(__dirname, '../../template');
56
+ if (!fs.existsSync(templatePath)) {
57
+ spinner.fail(`Template directory not found at ${templatePath}`);
58
+ return;
59
+ }
60
+ await fs.copy(templatePath, projectPath);
61
+ // 2. Generate package.json dynamically
62
+ const packageJson = {
63
+ name: projectName,
64
+ version: "1.0.0",
65
+ scripts: {
66
+ "build": "tsc",
67
+ "synth": "aetherion synth",
68
+ "deploy": "aetherion deploy",
69
+ "docs": "aetherion docs",
70
+ "test": "vitest run"
71
+ },
72
+ dependencies: {
73
+ "@aetherionfw/core": "latest",
74
+ "@aetherionfw/infra": "latest",
75
+ "@aetherionfw/docs": "latest"
76
+ },
77
+ devDependencies: {
78
+ "typescript": "^5.5.4",
79
+ "vitest": "^2.0.5"
80
+ }
81
+ };
82
+ await fs.writeJson(path.join(projectPath, 'package.json'), packageJson, { spaces: 2 });
83
+ spinner.succeed(`Project ${chalk_1.default.green(projectName)} created successfully.`);
84
+ console.log(chalk_1.default.blue(`\nNext steps:`));
85
+ console.log(` $ cd ${projectName}`);
86
+ console.log(` $ pnpm install`);
87
+ console.log(` $ pnpm test`);
88
+ console.log(` $ aetherion synth`);
89
+ }
90
+ catch (err) {
91
+ spinner.fail(`Failed to create project: ${err.message}`);
92
+ }
93
+ }
@@ -0,0 +1 @@
1
+ export declare function synthCommand(): Promise<void>;
@@ -0,0 +1,22 @@
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.synthCommand = synthCommand;
7
+ const child_process_1 = require("child_process");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const ora_1 = __importDefault(require("ora"));
10
+ async function synthCommand() {
11
+ const spinner = (0, ora_1.default)('Synthesizing CDKTF infrastructure...').start();
12
+ try {
13
+ // In a real scenario, this would dynamically resolve the infra entrypoint.
14
+ // Assuming the user runs this in their project root and there's a cdktf project.
15
+ (0, child_process_1.execSync)('cdktf synth', { stdio: 'pipe' });
16
+ spinner.succeed(chalk_1.default.green('Infrastructure synthesized successfully.'));
17
+ }
18
+ catch (err) {
19
+ spinner.fail(chalk_1.default.red('Synthesis failed.'));
20
+ console.error(err.message);
21
+ }
22
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@aetherionfw/cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI for Aetherion Framework",
5
+ "bin": {
6
+ "aetherion": "dist/bin/aetherion.js"
7
+ },
8
+ "dependencies": {
9
+ "chalk": "^4.1.2",
10
+ "commander": "^11.0.0",
11
+ "fs-extra": "^11.1.1",
12
+ "ora": "^5.4.1",
13
+ "ts-node": "^10.9.2",
14
+ "@aetherionfw/docs": "1.0.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/fs-extra": "^11.0.1",
18
+ "@types/node": "^20.0.0",
19
+ "typescript": "^5.5.4",
20
+ "vitest": "^2.0.5",
21
+ "@aetherionfw/core": "1.0.0",
22
+ "@aetherionfw/infra": "1.0.0"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "template",
30
+ "package.json",
31
+ "README.md"
32
+ ],
33
+ "author": "CrisD3v",
34
+ "license": "MIT",
35
+ "scripts": {
36
+ "build": "tsc",
37
+ "clean": "rm -rf dist"
38
+ }
39
+ }
@@ -0,0 +1,10 @@
1
+ // Import the modules to register them in the MetadataRegistry
2
+ import '../src/app.module';
3
+
4
+ import { App } from 'cdktf';
5
+ import { FrameworkStack } from '@aetherionfw/infra';
6
+
7
+ const app = new App();
8
+ // This automatically synthesizes all Lambdas, API Gateways, etc.
9
+ new FrameworkStack(app, 'initial-dev');
10
+ app.synth();
@@ -0,0 +1,8 @@
1
+ import { Module } from '@aetherionfw/core';
2
+ import { InitialModule } from './initial/initial.module';
3
+
4
+ @Module({
5
+ name: 'AppModule',
6
+ imports: [InitialModule],
7
+ })
8
+ export class AppModule {}
@@ -0,0 +1,14 @@
1
+ import { Injectable } from '@aetherionfw/core';
2
+ import { InitialHealth } from '../domain/initial-health.entity';
3
+
4
+ @Injectable()
5
+ export class InitialHealthService {
6
+ getHealth(): InitialHealth {
7
+ return new InitialHealth(
8
+ 'ok',
9
+ 'Aetherion framework initial template is running',
10
+ 'Aetherion',
11
+ '0.1.0',
12
+ );
13
+ }
14
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ LambdaController,
3
+ Handle,
4
+ Route,
5
+ IamPermissions,
6
+ } from '@aetherionfw/core';
7
+ import {
8
+ ApiTag,
9
+ ApiOperation,
10
+ ApiResponse,
11
+ } from '@aetherionfw/docs';
12
+ import { InitialHealthService } from '../application/initial-health.service';
13
+ import { InitialHealthResponseDto } from '../dto/initial-health.response.dto';
14
+ import initialIamPermissions from '../infra/iam/initial.permissions.json';
15
+
16
+ @ApiTag('Initial', 'Template inicial de salud del framework Aetherion')
17
+ @LambdaController({
18
+ lambdaName: 'initial-api',
19
+ runtime: 'nodejs22.x',
20
+ memorySize: 128,
21
+ timeout: 5,
22
+ })
23
+ export class InitialLambdaController {
24
+ constructor(private readonly health: InitialHealthService) {}
25
+
26
+ @Handle()
27
+ @Route({ method: 'GET', path: '/initial/health' })
28
+ @IamPermissions(initialIamPermissions.initialHealth)
29
+ @ApiOperation({
30
+ summary: 'Health check inicial',
31
+ description: 'Devuelve el estado básico del framework Aetherion (template inicial).',
32
+ })
33
+ @ApiResponse({
34
+ status: 200,
35
+ description: 'Health OK',
36
+ type: InitialHealthResponseDto,
37
+ })
38
+ async getHealth(): Promise<InitialHealthResponseDto> {
39
+ const health = this.health.getHealth();
40
+ return InitialHealthResponseDto.fromEntity(health);
41
+ }
42
+ }
@@ -0,0 +1,8 @@
1
+ export class InitialHealth {
2
+ constructor(
3
+ readonly status: 'ok',
4
+ readonly message: string,
5
+ readonly framework: string,
6
+ readonly version: string,
7
+ ) {}
8
+ }
@@ -0,0 +1,28 @@
1
+ import { ApiProperty } from '@aetherionfw/docs';
2
+ import { InitialHealth } from '../domain/initial-health.entity';
3
+
4
+ export class InitialHealthResponseDto {
5
+ @ApiProperty({ description: 'Estado de salud del sistema', example: 'ok' })
6
+ status!: 'ok';
7
+
8
+ @ApiProperty({
9
+ description: 'Mensaje descriptivo del estado',
10
+ example: 'Aetherion framework initial template is running',
11
+ })
12
+ message!: string;
13
+
14
+ @ApiProperty({ description: 'Nombre del framework', example: 'Aetherion' })
15
+ framework!: string;
16
+
17
+ @ApiProperty({ description: 'Versión del framework', example: '0.1.0' })
18
+ version!: string;
19
+
20
+ static fromEntity(entity: InitialHealth): InitialHealthResponseDto {
21
+ const dto = new InitialHealthResponseDto();
22
+ dto.status = entity.status;
23
+ dto.message = entity.message;
24
+ dto.framework = entity.framework;
25
+ dto.version = entity.version;
26
+ return dto;
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "initialHealth": {
3
+ "logs": [
4
+ {
5
+ "action": "logs:CreateLogGroup",
6
+ "resource": "*"
7
+ },
8
+ {
9
+ "action": "logs:CreateLogStream",
10
+ "resource": "*"
11
+ },
12
+ {
13
+ "action": "logs:PutLogEvents",
14
+ "resource": "*"
15
+ }
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ import { Infra } from '@aetherionfw/core';
2
+ // Using generic HttpApi decorators if available, or just mocking for the template
3
+ // Since we only added standard decorators like @Vpc, @S3Bucket, etc. earlier, we'll use a placeholder or generic @Infra config
4
+
5
+ @Infra()
6
+ export class InitialInfra {
7
+ // Example definition
8
+ // @ApiGatewayHttpApi({ name: 'initial-api', description: 'Initial health API for Aetherion framework' })
9
+ // api!: any;
10
+ }
@@ -0,0 +1,12 @@
1
+ import { Module } from '@aetherionfw/core';
2
+ import { InitialInfra } from './infra/initial.infra';
3
+ import { InitialLambdaController } from './controllers/initial.lambda';
4
+ import { InitialHealthService } from './application/initial-health.service';
5
+
6
+ @Module({
7
+ name: 'InitialModule',
8
+ providers: [InitialHealthService],
9
+ controllers: [InitialLambdaController],
10
+ infra: [InitialInfra],
11
+ })
12
+ export class InitialModule {}
@@ -0,0 +1,15 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { InitialLambdaController } from '../initial/controllers/initial.lambda';
3
+ import { InitialHealthService } from '../initial/application/initial-health.service';
4
+
5
+ describe('InitialLambdaController', () => {
6
+ it('should return initial health status', async () => {
7
+ const service = new InitialHealthService();
8
+ const controller = new InitialLambdaController(service);
9
+
10
+ const response = await controller.getHealth();
11
+
12
+ expect(response.status).toBe('ok');
13
+ expect(response.framework).toBe('Aetherion');
14
+ });
15
+ });
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "rootDir": "src",
7
+ "outDir": "dist",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "experimentalDecorators": true,
11
+ "emitDecoratorMetadata": true,
12
+ "skipLibCheck": true,
13
+ "resolveJsonModule": true
14
+ },
15
+ "include": ["src"]
16
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ include: ['src/tests/**/*.spec.ts']
8
+ }
9
+ });