@evolith/smart-cli 1.1.4 → 1.1.5
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.es.md +989 -200
- package/README.md +98 -20
- package/dist/.tsbuildinfo +1 -1
- package/dist/CoreApiClient.d.ts +5 -0
- package/dist/CoreApiClient.js +25 -0
- package/dist/CoreApiClient.js.map +1 -0
- package/dist/app.module.js +12 -4
- package/dist/app.module.js.map +1 -1
- package/dist/commands/agents/agents.command.d.ts +19 -6
- package/dist/commands/agents/agents.command.js +333 -21
- package/dist/commands/agents/agents.command.js.map +1 -1
- package/dist/commands/chat/chat.command.d.ts +7 -0
- package/dist/commands/chat/chat.command.js +64 -0
- package/dist/commands/chat/chat.command.js.map +1 -0
- package/dist/commands/evaluate/evaluate.command.d.ts +28 -0
- package/dist/commands/evaluate/evaluate.command.js +197 -0
- package/dist/commands/evaluate/evaluate.command.js.map +1 -0
- package/dist/commands/mcp/mcp.command.d.ts +17 -0
- package/dist/commands/mcp/mcp.command.js +109 -0
- package/dist/commands/mcp/mcp.command.js.map +1 -0
- package/dist/commands/plan/index.d.ts +2 -0
- package/dist/commands/plan/index.js +133 -0
- package/dist/commands/plan/index.js.map +1 -0
- package/dist/commands/satellite/index.d.ts +2 -0
- package/dist/commands/satellite/index.js +8 -0
- package/dist/commands/satellite/index.js.map +1 -0
- package/dist/commands/satellite/satellite-adopt.command.d.ts +21 -0
- package/dist/commands/satellite/satellite-adopt.command.js +193 -0
- package/dist/commands/satellite/satellite-adopt.command.js.map +1 -0
- package/dist/commands/satellite/satellite-create.command.d.ts +26 -0
- package/dist/commands/satellite/satellite-create.command.js +192 -0
- package/dist/commands/satellite/satellite-create.command.js.map +1 -0
- package/dist/commands/upgrade/upgrade.command.d.ts +12 -4
- package/dist/commands/upgrade/upgrade.command.js +139 -19
- package/dist/commands/upgrade/upgrade.command.js.map +1 -1
- package/dist/commands/validate/validate.command.js +17 -3
- package/dist/commands/validate/validate.command.js.map +1 -1
- package/dist/infrastructure/agent/agent-runtime.factory.d.ts +9 -0
- package/dist/infrastructure/agent/agent-runtime.factory.js +47 -0
- package/dist/infrastructure/agent/agent-runtime.factory.js.map +1 -0
- package/dist/infrastructure/cli/command-executor.d.ts +1 -0
- package/dist/infrastructure/cli/command-executor.js +16 -0
- package/dist/infrastructure/cli/command-executor.js.map +1 -1
- package/dist/infrastructure/cli/providers/index.js +32 -29
- package/dist/infrastructure/cli/providers/index.js.map +1 -1
- package/dist/main.js +12 -1
- package/dist/main.js.map +1 -1
- package/package.json +8 -5
- package/dist/commands/init/agents.command.d.ts +0 -24
- package/dist/commands/init/agents.command.js +0 -330
- package/dist/commands/init/agents.command.js.map +0 -1
- package/dist/commands/init/upgrade.command.d.ts +0 -22
- package/dist/commands/init/upgrade.command.js +0 -178
- package/dist/commands/init/upgrade.command.js.map +0 -1
- package/dist/commands/mcp/mcp-serve.command.d.ts +0 -17
- package/dist/commands/mcp/mcp-serve.command.js +0 -153
- package/dist/commands/mcp/mcp-serve.command.js.map +0 -1
- package/dist/commands/upgrade/index.d.ts +0 -1
- package/dist/commands/upgrade/index.js +0 -6
- package/dist/commands/upgrade/index.js.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SatelliteAdoptCommand = void 0;
|
|
16
|
+
const nest_commander_1 = require("nest-commander");
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const initialize_satellite_use_case_1 = require("@evolith/core-domain/application/use-cases/initialize-satellite.use-case");
|
|
19
|
+
const infra_providers_1 = require("@evolith/infra-providers");
|
|
20
|
+
const base_command_1 = require("../../infrastructure/cli/base-command");
|
|
21
|
+
const prompt_service_1 = require("../../infrastructure/prompts/prompt.service");
|
|
22
|
+
const config_service_1 = require("../../infrastructure/config/config.service");
|
|
23
|
+
let SatelliteAdoptCommand = class SatelliteAdoptCommand extends base_command_1.BaseEvolithCommand {
|
|
24
|
+
constructor(promptService, configService) {
|
|
25
|
+
super('SatelliteAdoptCommand', promptService, configService);
|
|
26
|
+
}
|
|
27
|
+
async executeCommand(_passedParam, options) {
|
|
28
|
+
this.promptService.showIntro('Evolith — Adopt Satellite Repository');
|
|
29
|
+
let repoUrl = options?.repo ?? '';
|
|
30
|
+
if (!repoUrl) {
|
|
31
|
+
repoUrl = await this.promptService.text({
|
|
32
|
+
message: 'GitHub repository URL (https://github.com/owner/repo)',
|
|
33
|
+
placeholder: 'https://github.com/myorg/myrepo',
|
|
34
|
+
validate: (v) => {
|
|
35
|
+
if (!v.startsWith('https://github.com/')) {
|
|
36
|
+
return 'URL must start with https://github.com/';
|
|
37
|
+
}
|
|
38
|
+
if (!/github\.com\/[^/]+\/[^/]+/.test(v)) {
|
|
39
|
+
return 'URL must be in the form https://github.com/owner/repo';
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const parsed = this.parseRepoUrl(repoUrl);
|
|
46
|
+
let owner = options?.owner ?? parsed.owner;
|
|
47
|
+
if (!owner) {
|
|
48
|
+
owner = await this.promptService.text({
|
|
49
|
+
message: 'GitHub owner (user or organization)',
|
|
50
|
+
placeholder: parsed.owner || 'myorg',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const topologyChoices = [
|
|
54
|
+
{ value: 'monolith', label: 'Monolith' },
|
|
55
|
+
{ value: 'modular', label: 'Modular monolith' },
|
|
56
|
+
{ value: 'micro', label: 'Microservices' },
|
|
57
|
+
{ value: 'distributed', label: 'Distributed' },
|
|
58
|
+
{ value: 'custom', label: 'Custom' },
|
|
59
|
+
];
|
|
60
|
+
const topology = options?.topology
|
|
61
|
+
? options.topology
|
|
62
|
+
: await this.promptService.select({
|
|
63
|
+
message: 'Architecture topology',
|
|
64
|
+
options: topologyChoices,
|
|
65
|
+
initialValue: 'monolith',
|
|
66
|
+
});
|
|
67
|
+
let phase = options?.phase ?? '';
|
|
68
|
+
if (!phase) {
|
|
69
|
+
phase = await this.promptService.select({
|
|
70
|
+
message: 'SDLC phase',
|
|
71
|
+
options: [
|
|
72
|
+
{ value: 'alpha', label: 'Alpha' },
|
|
73
|
+
{ value: 'beta', label: 'Beta' },
|
|
74
|
+
{ value: 'rc', label: 'Release Candidate (RC)' },
|
|
75
|
+
{ value: 'ga', label: 'General Availability (GA)' },
|
|
76
|
+
],
|
|
77
|
+
initialValue: 'alpha',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const token = options?.token ?? process.env['GITHUB_TOKEN'] ?? '';
|
|
81
|
+
if (!token) {
|
|
82
|
+
this.promptService.showWarning('No GitHub token found. Set --token or GITHUB_TOKEN env var. ' +
|
|
83
|
+
'The adopt operation will likely fail without a valid token.');
|
|
84
|
+
}
|
|
85
|
+
this.promptService.startSpinner(`Adopting ${repoUrl} into Evolith governance...`);
|
|
86
|
+
try {
|
|
87
|
+
const useCase = new initialize_satellite_use_case_1.InitializeSatelliteUseCase(new infra_providers_1.GitHubApiAdapter(token));
|
|
88
|
+
const result = await useCase.execute({
|
|
89
|
+
mode: 'adopt',
|
|
90
|
+
name: parsed.name,
|
|
91
|
+
owner,
|
|
92
|
+
topology,
|
|
93
|
+
phase,
|
|
94
|
+
existingRepoUrl: repoUrl,
|
|
95
|
+
});
|
|
96
|
+
this.promptService.stopSpinner();
|
|
97
|
+
const { satellite } = result;
|
|
98
|
+
console.log('');
|
|
99
|
+
console.log(chalk_1.default.bold('Satellite adopted successfully'));
|
|
100
|
+
console.log(` ${chalk_1.default.cyan('ID:')} ${satellite.id}`);
|
|
101
|
+
console.log(` ${chalk_1.default.cyan('Name:')} ${satellite.name}`);
|
|
102
|
+
console.log(` ${chalk_1.default.cyan('Owner:')} ${satellite.owner}`);
|
|
103
|
+
console.log(` ${chalk_1.default.cyan('Repo:')} ${satellite.repoUrl}`);
|
|
104
|
+
console.log(` ${chalk_1.default.cyan('Topology:')} ${satellite.topology}`);
|
|
105
|
+
console.log(` ${chalk_1.default.cyan('Phase:')} ${satellite.phase}`);
|
|
106
|
+
console.log(` ${chalk_1.default.cyan('Status:')} ${chalk_1.default.green(satellite.status)}`);
|
|
107
|
+
console.log('');
|
|
108
|
+
this.promptService.showSuccess(`Satellite ${satellite.name} linked (${satellite.status})`);
|
|
109
|
+
this.promptService.showOutro('Done.');
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.promptService.stopSpinner();
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
parseRepo(val) {
|
|
117
|
+
return val;
|
|
118
|
+
}
|
|
119
|
+
parseTopology(val) {
|
|
120
|
+
return val;
|
|
121
|
+
}
|
|
122
|
+
parsePhase(val) {
|
|
123
|
+
return val;
|
|
124
|
+
}
|
|
125
|
+
parseToken(val) {
|
|
126
|
+
return val;
|
|
127
|
+
}
|
|
128
|
+
parseOwner(val) {
|
|
129
|
+
return val;
|
|
130
|
+
}
|
|
131
|
+
parseRepoUrl(url) {
|
|
132
|
+
const match = url.match(/github\.com[/:]([^/]+)\/([^/.]+?)(?:\.git)?$/);
|
|
133
|
+
if (!match) {
|
|
134
|
+
return { owner: '', name: '' };
|
|
135
|
+
}
|
|
136
|
+
return { owner: match[1], name: match[2] };
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.SatelliteAdoptCommand = SatelliteAdoptCommand;
|
|
140
|
+
__decorate([
|
|
141
|
+
(0, nest_commander_1.Option)({
|
|
142
|
+
flags: '--repo <url>',
|
|
143
|
+
description: 'GitHub repository URL (https://github.com/owner/repo)',
|
|
144
|
+
}),
|
|
145
|
+
__metadata("design:type", Function),
|
|
146
|
+
__metadata("design:paramtypes", [String]),
|
|
147
|
+
__metadata("design:returntype", String)
|
|
148
|
+
], SatelliteAdoptCommand.prototype, "parseRepo", null);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, nest_commander_1.Option)({
|
|
151
|
+
flags: '--topology <topology>',
|
|
152
|
+
description: 'Architecture topology: monolith | modular | micro | distributed | custom',
|
|
153
|
+
}),
|
|
154
|
+
__metadata("design:type", Function),
|
|
155
|
+
__metadata("design:paramtypes", [String]),
|
|
156
|
+
__metadata("design:returntype", String)
|
|
157
|
+
], SatelliteAdoptCommand.prototype, "parseTopology", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, nest_commander_1.Option)({
|
|
160
|
+
flags: '--phase <phase>',
|
|
161
|
+
description: 'SDLC phase: alpha | beta | rc | ga',
|
|
162
|
+
}),
|
|
163
|
+
__metadata("design:type", Function),
|
|
164
|
+
__metadata("design:paramtypes", [String]),
|
|
165
|
+
__metadata("design:returntype", String)
|
|
166
|
+
], SatelliteAdoptCommand.prototype, "parsePhase", null);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, nest_commander_1.Option)({
|
|
169
|
+
flags: '--token <token>',
|
|
170
|
+
description: 'GitHub personal access token (defaults to GITHUB_TOKEN env var)',
|
|
171
|
+
}),
|
|
172
|
+
__metadata("design:type", Function),
|
|
173
|
+
__metadata("design:paramtypes", [String]),
|
|
174
|
+
__metadata("design:returntype", String)
|
|
175
|
+
], SatelliteAdoptCommand.prototype, "parseToken", null);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, nest_commander_1.Option)({
|
|
178
|
+
flags: '--owner <owner>',
|
|
179
|
+
description: 'GitHub owner (user or organization); defaults to the owner parsed from --repo',
|
|
180
|
+
}),
|
|
181
|
+
__metadata("design:type", Function),
|
|
182
|
+
__metadata("design:paramtypes", [String]),
|
|
183
|
+
__metadata("design:returntype", String)
|
|
184
|
+
], SatelliteAdoptCommand.prototype, "parseOwner", null);
|
|
185
|
+
exports.SatelliteAdoptCommand = SatelliteAdoptCommand = __decorate([
|
|
186
|
+
(0, nest_commander_1.Command)({
|
|
187
|
+
name: 'satellite:adopt',
|
|
188
|
+
description: 'Adopt an existing GitHub repository as an Evolith satellite',
|
|
189
|
+
}),
|
|
190
|
+
__metadata("design:paramtypes", [prompt_service_1.PromptService,
|
|
191
|
+
config_service_1.ConfigService])
|
|
192
|
+
], SatelliteAdoptCommand);
|
|
193
|
+
//# sourceMappingURL=satellite-adopt.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satellite-adopt.command.js","sourceRoot":"","sources":["../../../src/commands/satellite/satellite-adopt.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAiD;AACjD,kDAA0B;AAC1B,4HAAsH;AACtH,8DAA4D;AAE5D,wEAA2E;AAC3E,gFAA4E;AAC5E,+EAA2E;AAkBpE,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iCAAkB;IAC3D,YACE,aAA4B,EAC5B,aAA6B;QAE7B,KAAK,CAAC,uBAAuB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,cAAc,CAClB,YAAsB,EACtB,OAAsC;QAEtC,IAAI,CAAC,aAAa,CAAC,SAA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,uBAAM,EAAC;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,oCAAoC;KAClD,CAAC;;;;uDAGD;AAMD;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,iEAAiE;KAC/E,CAAC;;;;uDAGD;AAMD;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,+EAA+E;KAC7F,CAAC;;;;uDAGD;gCAnLU,qBAAqB;IAJjC,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,6DAA6D;KAC3E,CAAC;qCAGiB,8BAAa;QACZ,8BAAa;GAHpB,qBAAqB,CAiMjC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseEvolithCommand } from '../../infrastructure/cli/base-command';
|
|
2
|
+
import { PromptService } from '../../infrastructure/prompts/prompt.service';
|
|
3
|
+
import { ConfigService } from '../../infrastructure/config/config.service';
|
|
4
|
+
type SatelliteTopologyOption = 'monolith' | 'modular' | 'micro' | 'distributed';
|
|
5
|
+
type SatellitePhaseOption = 'discovery' | 'design' | 'construction' | 'qa' | 'release';
|
|
6
|
+
interface SatelliteCreateCommandOptions {
|
|
7
|
+
name?: string;
|
|
8
|
+
owner?: string;
|
|
9
|
+
topology?: SatelliteTopologyOption;
|
|
10
|
+
phase?: SatellitePhaseOption;
|
|
11
|
+
private?: boolean;
|
|
12
|
+
description?: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class SatelliteCreateCommand extends BaseEvolithCommand {
|
|
16
|
+
constructor(promptService: PromptService, configService?: ConfigService);
|
|
17
|
+
executeCommand(_passedParam: string[], options?: SatelliteCreateCommandOptions): Promise<void>;
|
|
18
|
+
parseName(val: string): string;
|
|
19
|
+
parseOwner(val: string): string;
|
|
20
|
+
parseTopology(val: string): SatelliteTopologyOption;
|
|
21
|
+
parsePhase(val: string): SatellitePhaseOption;
|
|
22
|
+
parsePrivate(): boolean;
|
|
23
|
+
parseDescription(val: string): string;
|
|
24
|
+
parseToken(val: string): string;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SatelliteCreateCommand = void 0;
|
|
16
|
+
const nest_commander_1 = require("nest-commander");
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const initialize_satellite_use_case_1 = require("@evolith/core-domain/application/use-cases/initialize-satellite.use-case");
|
|
19
|
+
const infra_providers_1 = require("@evolith/infra-providers");
|
|
20
|
+
const base_command_1 = require("../../infrastructure/cli/base-command");
|
|
21
|
+
const prompt_service_1 = require("../../infrastructure/prompts/prompt.service");
|
|
22
|
+
const config_service_1 = require("../../infrastructure/config/config.service");
|
|
23
|
+
let SatelliteCreateCommand = class SatelliteCreateCommand extends base_command_1.BaseEvolithCommand {
|
|
24
|
+
constructor(promptService, configService) {
|
|
25
|
+
super('SatelliteCreateCommand', promptService, configService);
|
|
26
|
+
}
|
|
27
|
+
async executeCommand(_passedParam, options) {
|
|
28
|
+
this.promptService.showIntro('Evolith SDK - Satellite Create');
|
|
29
|
+
const name = options?.name ?? await this.promptService.text({
|
|
30
|
+
message: 'Repository name:',
|
|
31
|
+
placeholder: 'my-satellite',
|
|
32
|
+
validate: (v) => (v.trim().length === 0 ? 'Name is required' : undefined),
|
|
33
|
+
});
|
|
34
|
+
const owner = options?.owner ?? await this.promptService.text({
|
|
35
|
+
message: 'GitHub owner (user or organisation):',
|
|
36
|
+
placeholder: 'my-org',
|
|
37
|
+
validate: (v) => (v.trim().length === 0 ? 'Owner is required' : undefined),
|
|
38
|
+
});
|
|
39
|
+
const topology = options?.topology ?? await this.promptService.select({
|
|
40
|
+
message: 'Architecture topology:',
|
|
41
|
+
options: [
|
|
42
|
+
{ value: 'monolith', label: 'Monolith', hint: 'Single deployable unit' },
|
|
43
|
+
{ value: 'modular', label: 'Modular monolith', hint: 'Modular boundaries, single deployment' },
|
|
44
|
+
{ value: 'micro', label: 'Microservices', hint: 'Independent deployable services' },
|
|
45
|
+
{ value: 'distributed', label: 'Distributed', hint: 'Event-driven distributed system' },
|
|
46
|
+
],
|
|
47
|
+
initialValue: 'modular',
|
|
48
|
+
});
|
|
49
|
+
const phase = options?.phase ?? await this.promptService.select({
|
|
50
|
+
message: 'Initial SDLC phase:',
|
|
51
|
+
options: [
|
|
52
|
+
{ value: 'discovery', label: 'Discovery' },
|
|
53
|
+
{ value: 'design', label: 'Design' },
|
|
54
|
+
{ value: 'construction', label: 'Construction' },
|
|
55
|
+
{ value: 'qa', label: 'QA' },
|
|
56
|
+
{ value: 'release', label: 'Release' },
|
|
57
|
+
],
|
|
58
|
+
initialValue: 'discovery',
|
|
59
|
+
});
|
|
60
|
+
const token = options?.token ?? process.env['GITHUB_TOKEN'] ?? '';
|
|
61
|
+
if (!token) {
|
|
62
|
+
this.promptService.showError('GitHub token not found. Pass --token or set the GITHUB_TOKEN environment variable.');
|
|
63
|
+
this.promptService.showOutro('Satellite creation cancelled.');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.promptService.startSpinner(`Creating repository ${owner}/${name} on GitHub...`);
|
|
67
|
+
try {
|
|
68
|
+
const githubClient = new infra_providers_1.GitHubApiAdapter(token);
|
|
69
|
+
const useCase = new initialize_satellite_use_case_1.InitializeSatelliteUseCase(githubClient);
|
|
70
|
+
const result = await useCase.execute({
|
|
71
|
+
mode: 'create',
|
|
72
|
+
name: name.trim(),
|
|
73
|
+
owner: owner.trim(),
|
|
74
|
+
topology,
|
|
75
|
+
phase,
|
|
76
|
+
description: options?.description,
|
|
77
|
+
private: options?.private ?? false,
|
|
78
|
+
});
|
|
79
|
+
this.promptService.stopSpinner('Repository created.');
|
|
80
|
+
const { satellite } = result;
|
|
81
|
+
console.log(`\n${chalk_1.default.bgGreen.black(' Satellite Registered ')}\n`);
|
|
82
|
+
console.log(`${chalk_1.default.bold('ID:')} ${chalk_1.default.cyan(satellite.id)}`);
|
|
83
|
+
console.log(`${chalk_1.default.bold('Name:')} ${chalk_1.default.cyan(satellite.name)}`);
|
|
84
|
+
console.log(`${chalk_1.default.bold('Owner:')} ${chalk_1.default.cyan(satellite.owner)}`);
|
|
85
|
+
console.log(`${chalk_1.default.bold('Repo URL:')} ${chalk_1.default.underline(satellite.repoUrl)}`);
|
|
86
|
+
console.log(`${chalk_1.default.bold('Topology:')} ${satellite.topology}`);
|
|
87
|
+
console.log(`${chalk_1.default.bold('Phase:')} ${satellite.phase}`);
|
|
88
|
+
console.log(`${chalk_1.default.bold('Status:')} ${chalk_1.default.green(satellite.status)}`);
|
|
89
|
+
console.log('');
|
|
90
|
+
this.promptService.showSuccess(`Satellite "${satellite.name}" successfully created and registered.`);
|
|
91
|
+
this.promptService.showOutro('Done. Run `evolith satellite adopt` to link an existing repo.');
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
this.promptService.stopSpinner('Failed.');
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
parseName(val) {
|
|
99
|
+
return val;
|
|
100
|
+
}
|
|
101
|
+
parseOwner(val) {
|
|
102
|
+
return val;
|
|
103
|
+
}
|
|
104
|
+
parseTopology(val) {
|
|
105
|
+
return val;
|
|
106
|
+
}
|
|
107
|
+
parsePhase(val) {
|
|
108
|
+
return val;
|
|
109
|
+
}
|
|
110
|
+
parsePrivate() {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
parseDescription(val) {
|
|
114
|
+
return val;
|
|
115
|
+
}
|
|
116
|
+
parseToken(val) {
|
|
117
|
+
return val;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
exports.SatelliteCreateCommand = SatelliteCreateCommand;
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, nest_commander_1.Option)({
|
|
123
|
+
flags: '-n, --name [name]',
|
|
124
|
+
description: 'Name for the new GitHub repository',
|
|
125
|
+
}),
|
|
126
|
+
__metadata("design:type", Function),
|
|
127
|
+
__metadata("design:paramtypes", [String]),
|
|
128
|
+
__metadata("design:returntype", String)
|
|
129
|
+
], SatelliteCreateCommand.prototype, "parseName", null);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, nest_commander_1.Option)({
|
|
132
|
+
flags: '-o, --owner [owner]',
|
|
133
|
+
description: 'GitHub user or organisation that will own the repository',
|
|
134
|
+
}),
|
|
135
|
+
__metadata("design:type", Function),
|
|
136
|
+
__metadata("design:paramtypes", [String]),
|
|
137
|
+
__metadata("design:returntype", String)
|
|
138
|
+
], SatelliteCreateCommand.prototype, "parseOwner", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, nest_commander_1.Option)({
|
|
141
|
+
flags: '--topology [topology]',
|
|
142
|
+
description: 'Architecture topology: monolith | modular | micro | distributed',
|
|
143
|
+
}),
|
|
144
|
+
__metadata("design:type", Function),
|
|
145
|
+
__metadata("design:paramtypes", [String]),
|
|
146
|
+
__metadata("design:returntype", String)
|
|
147
|
+
], SatelliteCreateCommand.prototype, "parseTopology", null);
|
|
148
|
+
__decorate([
|
|
149
|
+
(0, nest_commander_1.Option)({
|
|
150
|
+
flags: '--phase [phase]',
|
|
151
|
+
description: 'Initial SDLC phase: discovery | design | construction | qa | release',
|
|
152
|
+
}),
|
|
153
|
+
__metadata("design:type", Function),
|
|
154
|
+
__metadata("design:paramtypes", [String]),
|
|
155
|
+
__metadata("design:returntype", String)
|
|
156
|
+
], SatelliteCreateCommand.prototype, "parsePhase", null);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, nest_commander_1.Option)({
|
|
159
|
+
flags: '--private',
|
|
160
|
+
description: 'Create the repository as private (default: public)',
|
|
161
|
+
}),
|
|
162
|
+
__metadata("design:type", Function),
|
|
163
|
+
__metadata("design:paramtypes", []),
|
|
164
|
+
__metadata("design:returntype", Boolean)
|
|
165
|
+
], SatelliteCreateCommand.prototype, "parsePrivate", null);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, nest_commander_1.Option)({
|
|
168
|
+
flags: '-d, --description [description]',
|
|
169
|
+
description: 'Optional description for the repository',
|
|
170
|
+
}),
|
|
171
|
+
__metadata("design:type", Function),
|
|
172
|
+
__metadata("design:paramtypes", [String]),
|
|
173
|
+
__metadata("design:returntype", String)
|
|
174
|
+
], SatelliteCreateCommand.prototype, "parseDescription", null);
|
|
175
|
+
__decorate([
|
|
176
|
+
(0, nest_commander_1.Option)({
|
|
177
|
+
flags: '-t, --token [token]',
|
|
178
|
+
description: 'GitHub personal access token (falls back to GITHUB_TOKEN env var)',
|
|
179
|
+
}),
|
|
180
|
+
__metadata("design:type", Function),
|
|
181
|
+
__metadata("design:paramtypes", [String]),
|
|
182
|
+
__metadata("design:returntype", String)
|
|
183
|
+
], SatelliteCreateCommand.prototype, "parseToken", null);
|
|
184
|
+
exports.SatelliteCreateCommand = SatelliteCreateCommand = __decorate([
|
|
185
|
+
(0, nest_commander_1.Command)({
|
|
186
|
+
name: 'satellite:create',
|
|
187
|
+
description: 'Create a new GitHub satellite repository and register it with Evolith',
|
|
188
|
+
}),
|
|
189
|
+
__metadata("design:paramtypes", [prompt_service_1.PromptService,
|
|
190
|
+
config_service_1.ConfigService])
|
|
191
|
+
], SatelliteCreateCommand);
|
|
192
|
+
//# sourceMappingURL=satellite-create.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satellite-create.command.js","sourceRoot":"","sources":["../../../src/commands/satellite/satellite-create.command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAiD;AACjD,kDAA0B;AAC1B,4HAAsH;AACtH,8DAA4D;AAC5D,wEAA2E;AAC3E,gFAA4E;AAC5E,+EAA2E;AAmBpE,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,iCAAkB;IAC5D,YACE,aAA4B,EAC5B,aAA6B;QAE7B,KAAK,CAAC,wBAAwB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,YAAsB,EAAE,OAAuC;QAClF,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;QAE/D,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YAC1D,OAAO,EAAE,kBAAkB;YAC3B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;SAC1E,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YAC5D,OAAO,EAAE,sCAAsC;YAC/C,WAAW,EAAE,QAAQ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1
|
import { BaseEvolithCommand } from '../../infrastructure/cli/base-command';
|
|
2
|
+
import { PromptService } from '../../infrastructure/prompts/prompt.service';
|
|
3
|
+
import { ConfigService } from '../../infrastructure/config/config.service';
|
|
2
4
|
interface UpgradeCommandOptions {
|
|
3
5
|
dryRun?: boolean;
|
|
4
|
-
target?: string;
|
|
5
6
|
force?: boolean;
|
|
7
|
+
core?: string;
|
|
8
|
+
report?: boolean;
|
|
6
9
|
}
|
|
7
10
|
export declare class UpgradeCommand extends BaseEvolithCommand {
|
|
8
|
-
constructor();
|
|
9
|
-
executeCommand(
|
|
11
|
+
constructor(promptService: PromptService, configService?: ConfigService);
|
|
12
|
+
executeCommand(passedParam: string[], options?: UpgradeCommandOptions): Promise<void>;
|
|
13
|
+
private printUpgradePlan;
|
|
14
|
+
private getChangeIcon;
|
|
15
|
+
private getRiskColor;
|
|
16
|
+
private findCorePath;
|
|
10
17
|
parseDryRun(): boolean;
|
|
11
|
-
parseTarget(val: string): string;
|
|
12
18
|
parseForce(): boolean;
|
|
19
|
+
parseCore(val: string): string;
|
|
20
|
+
parseReport(): boolean;
|
|
13
21
|
}
|
|
14
22
|
export {};
|
|
@@ -8,51 +8,171 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.UpgradeCommand = void 0;
|
|
13
16
|
const nest_commander_1 = require("nest-commander");
|
|
17
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
18
|
+
const satellite_upgrade_service_1 = require("@evolith/core-domain/application/upgrade/satellite-upgrade.service");
|
|
14
19
|
const base_command_1 = require("../../infrastructure/cli/base-command");
|
|
20
|
+
const prompt_service_1 = require("../../infrastructure/prompts/prompt.service");
|
|
21
|
+
const config_service_1 = require("../../infrastructure/config/config.service");
|
|
15
22
|
let UpgradeCommand = class UpgradeCommand extends base_command_1.BaseEvolithCommand {
|
|
16
|
-
constructor() {
|
|
17
|
-
super('UpgradeCommand');
|
|
23
|
+
constructor(promptService, configService) {
|
|
24
|
+
super('UpgradeCommand', promptService, configService);
|
|
25
|
+
}
|
|
26
|
+
async executeCommand(passedParam, options) {
|
|
27
|
+
const satellitePath = process.cwd();
|
|
28
|
+
const corePath = options?.core || this.profile.core || this.findCorePath(satellitePath);
|
|
29
|
+
const service = new satellite_upgrade_service_1.SatelliteUpgradeService();
|
|
30
|
+
this.promptService.showIntro('Evolith SDK - Satélite Upgrade');
|
|
31
|
+
this.promptService.startSpinner('Planning upgrade...');
|
|
32
|
+
try {
|
|
33
|
+
const plan = await service.planUpgrade({ satellitePath, corePath });
|
|
34
|
+
this.promptService.stopSpinner();
|
|
35
|
+
if (plan.changes.length === 0) {
|
|
36
|
+
this.promptService.showSuccess('Satellite is already up to date');
|
|
37
|
+
this.promptService.showOutro('No upgrade needed.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.printUpgradePlan(plan);
|
|
41
|
+
if (options?.dryRun) {
|
|
42
|
+
const _result = await service.executeUpgrade({
|
|
43
|
+
satellitePath,
|
|
44
|
+
corePath,
|
|
45
|
+
dryRun: true,
|
|
46
|
+
});
|
|
47
|
+
this.promptService.showInfo('Dry run complete - no changes applied');
|
|
48
|
+
this.promptService.showOutro('Dry run finished.');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (plan.breakingChanges.length > 0 && !options?.force) {
|
|
52
|
+
this.promptService.showWarning(`⚠ ${plan.breakingChanges.length} breaking change(s) detected`);
|
|
53
|
+
this.promptService.showInfo('Use --force to proceed with breaking changes');
|
|
54
|
+
this.promptService.showOutro('Upgrade cancelled.');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const confirm = await this.promptService.confirm(`Apply ${plan.changes.length} change(s)?`, true);
|
|
58
|
+
if (!confirm) {
|
|
59
|
+
this.promptService.showOutro('Upgrade cancelled.');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.promptService.startSpinner('Applying upgrade...');
|
|
63
|
+
const result = await service.executeUpgrade({
|
|
64
|
+
satellitePath,
|
|
65
|
+
corePath,
|
|
66
|
+
force: options?.force,
|
|
67
|
+
});
|
|
68
|
+
this.promptService.stopSpinner();
|
|
69
|
+
const report = await service.getUpgradeReport(result);
|
|
70
|
+
console.log(`\n${chalk_1.default.bgCyan.black(' Upgrade Report ')}\n${report}\n`);
|
|
71
|
+
if (result.success) {
|
|
72
|
+
this.promptService.showSuccess(`Upgrade complete: ${result.changesApplied} change(s) applied`);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
this.promptService.showError(`Upgrade completed with errors: ${result.errors.length}`);
|
|
76
|
+
}
|
|
77
|
+
this.promptService.showOutro(result.success ? 'Upgrade finished.' : 'Upgrade finished with errors.');
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
this.promptService.stopSpinner();
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
printUpgradePlan(plan) {
|
|
85
|
+
console.log(chalk_1.default.bold('\n📋 Upgrade Plan\n'));
|
|
86
|
+
console.log(`${chalk_1.default.bold('Current Version:')} ${chalk_1.default.cyan(plan.currentVersion)}`);
|
|
87
|
+
console.log(`${chalk_1.default.bold('Target Version:')} ${chalk_1.default.cyan(plan.targetVersion)}`);
|
|
88
|
+
console.log(`${chalk_1.default.bold('Risk Level:')} ${plan.estimatedRisk === 'high' ? chalk_1.default.red(plan.estimatedRisk.toUpperCase()) : plan.estimatedRisk === 'medium' ? chalk_1.default.yellow(plan.estimatedRisk.toUpperCase()) : chalk_1.default.green(plan.estimatedRisk.toUpperCase())}`);
|
|
89
|
+
console.log(`${chalk_1.default.bold('Total Changes:')} ${plan.changes.length}`);
|
|
90
|
+
if (plan.breakingChanges.length > 0) {
|
|
91
|
+
console.log(`${chalk_1.default.red('⚠ Breaking Changes:')} ${plan.breakingChanges.length}`);
|
|
92
|
+
}
|
|
93
|
+
console.log(chalk_1.default.cyan('\nChanges:'));
|
|
94
|
+
for (const change of plan.changes) {
|
|
95
|
+
const icon = this.getChangeIcon(change.type);
|
|
96
|
+
const breaking = change.breaking ? chalk_1.default.red(' [BREAKING]') : '';
|
|
97
|
+
console.log(` ${icon} ${change.description}${breaking}`);
|
|
98
|
+
}
|
|
99
|
+
console.log('');
|
|
100
|
+
}
|
|
101
|
+
getChangeIcon(type) {
|
|
102
|
+
switch (type) {
|
|
103
|
+
case 'add': return chalk_1.default.green('+');
|
|
104
|
+
case 'modify': return chalk_1.default.yellow('~');
|
|
105
|
+
case 'remove': return chalk_1.default.red('-');
|
|
106
|
+
case 'migrate': return chalk_1.default.blue('»');
|
|
107
|
+
default: return '?';
|
|
108
|
+
}
|
|
18
109
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return;
|
|
110
|
+
getRiskColor(risk) {
|
|
111
|
+
switch (risk) {
|
|
112
|
+
case 'high': return 'high';
|
|
113
|
+
case 'medium': return 'medium';
|
|
114
|
+
default: return 'low';
|
|
23
115
|
}
|
|
24
|
-
const target = options?.target ?? 'latest';
|
|
25
|
-
this.promptService.showIntro(`Evolith Upgrade → ${target}`);
|
|
26
|
-
this.promptService.showInfo('Upgrade in progress. Run with --dry-run to preview.');
|
|
27
116
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
117
|
+
findCorePath(satellitePath) {
|
|
118
|
+
return satellitePath;
|
|
119
|
+
}
|
|
120
|
+
parseDryRun() {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
parseForce() {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
parseCore(val) {
|
|
127
|
+
return val;
|
|
128
|
+
}
|
|
129
|
+
parseReport() {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
31
132
|
};
|
|
32
133
|
exports.UpgradeCommand = UpgradeCommand;
|
|
33
134
|
__decorate([
|
|
34
|
-
(0, nest_commander_1.Option)({
|
|
135
|
+
(0, nest_commander_1.Option)({
|
|
136
|
+
flags: '-d, --dry-run',
|
|
137
|
+
description: 'Ejecuta en modo simulacro sin alterar archivos',
|
|
138
|
+
}),
|
|
35
139
|
__metadata("design:type", Function),
|
|
36
140
|
__metadata("design:paramtypes", []),
|
|
37
141
|
__metadata("design:returntype", Boolean)
|
|
38
142
|
], UpgradeCommand.prototype, "parseDryRun", null);
|
|
39
143
|
__decorate([
|
|
40
|
-
(0, nest_commander_1.Option)({
|
|
144
|
+
(0, nest_commander_1.Option)({
|
|
145
|
+
flags: '-f, --force',
|
|
146
|
+
description: 'Force upgrade even with breaking changes',
|
|
147
|
+
}),
|
|
148
|
+
__metadata("design:type", Function),
|
|
149
|
+
__metadata("design:paramtypes", []),
|
|
150
|
+
__metadata("design:returntype", Boolean)
|
|
151
|
+
], UpgradeCommand.prototype, "parseForce", null);
|
|
152
|
+
__decorate([
|
|
153
|
+
(0, nest_commander_1.Option)({
|
|
154
|
+
flags: '-c, --core [path]',
|
|
155
|
+
description: 'Path to Evolith core repository',
|
|
156
|
+
}),
|
|
41
157
|
__metadata("design:type", Function),
|
|
42
158
|
__metadata("design:paramtypes", [String]),
|
|
43
159
|
__metadata("design:returntype", String)
|
|
44
|
-
], UpgradeCommand.prototype, "
|
|
160
|
+
], UpgradeCommand.prototype, "parseCore", null);
|
|
45
161
|
__decorate([
|
|
46
|
-
(0, nest_commander_1.Option)({
|
|
162
|
+
(0, nest_commander_1.Option)({
|
|
163
|
+
flags: '--report',
|
|
164
|
+
description: 'Show detailed upgrade report',
|
|
165
|
+
}),
|
|
47
166
|
__metadata("design:type", Function),
|
|
48
167
|
__metadata("design:paramtypes", []),
|
|
49
168
|
__metadata("design:returntype", Boolean)
|
|
50
|
-
], UpgradeCommand.prototype, "
|
|
169
|
+
], UpgradeCommand.prototype, "parseReport", null);
|
|
51
170
|
exports.UpgradeCommand = UpgradeCommand = __decorate([
|
|
52
171
|
(0, nest_commander_1.Command)({
|
|
53
172
|
name: 'upgrade',
|
|
54
|
-
description: '
|
|
173
|
+
description: 'Actualiza el repositorio satélite cuando el upstream Evolith recibe nuevas reglas',
|
|
55
174
|
}),
|
|
56
|
-
__metadata("design:paramtypes", [
|
|
175
|
+
__metadata("design:paramtypes", [prompt_service_1.PromptService,
|
|
176
|
+
config_service_1.ConfigService])
|
|
57
177
|
], UpgradeCommand);
|
|
58
178
|
//# sourceMappingURL=upgrade.command.js.map
|