@edgible-team/cli 1.2.13 → 1.2.15
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/dist/commands/stack/deploy.d.ts +6 -0
- package/dist/commands/stack/deploy.d.ts.map +1 -0
- package/dist/commands/stack/deploy.js +58 -0
- package/dist/commands/stack/diff.d.ts +7 -0
- package/dist/commands/stack/diff.d.ts.map +1 -0
- package/dist/commands/stack/diff.js +64 -0
- package/dist/commands/stack/status.d.ts +9 -0
- package/dist/commands/stack/status.d.ts.map +1 -0
- package/dist/commands/stack/status.js +53 -0
- package/dist/commands/stack/teardown.d.ts +6 -0
- package/dist/commands/stack/teardown.d.ts.map +1 -0
- package/dist/commands/stack/teardown.js +104 -0
- package/dist/commands/stack/validate.d.ts +7 -0
- package/dist/commands/stack/validate.d.ts.map +1 -0
- package/dist/commands/stack/validate.js +42 -0
- package/dist/commands/stack.d.ts +10 -0
- package/dist/commands/stack.d.ts.map +1 -0
- package/dist/commands/stack.js +112 -0
- package/dist/index.js +2 -0
- package/dist/services/instances.d.ts +23 -0
- package/dist/services/instances.d.ts.map +1 -1
- package/dist/services/instances.js +46 -1
- package/dist/services/stack/DependencyGraphManager.d.ts +69 -0
- package/dist/services/stack/DependencyGraphManager.d.ts.map +1 -0
- package/dist/services/stack/DependencyGraphManager.js +204 -0
- package/dist/services/stack/DeviceResolver.d.ts +63 -0
- package/dist/services/stack/DeviceResolver.d.ts.map +1 -0
- package/dist/services/stack/DeviceResolver.js +147 -0
- package/dist/services/stack/GatewayResolver.d.ts +84 -0
- package/dist/services/stack/GatewayResolver.d.ts.map +1 -0
- package/dist/services/stack/GatewayResolver.js +179 -0
- package/dist/services/stack/StackParser.d.ts +38 -0
- package/dist/services/stack/StackParser.d.ts.map +1 -0
- package/dist/services/stack/StackParser.js +234 -0
- package/dist/services/stack/StackService.d.ts +76 -0
- package/dist/services/stack/StackService.d.ts.map +1 -0
- package/dist/services/stack/StackService.js +476 -0
- package/dist/types/stack.d.ts +191 -0
- package/dist/types/stack.d.ts.map +1 -0
- package/dist/types/stack.js +5 -0
- package/dist/types/validation/schemas.d.ts +17 -17
- package/dist/utils/stack-errors.d.ts +103 -0
- package/dist/utils/stack-errors.d.ts.map +1 -0
- package/dist/utils/stack-errors.js +158 -0
- package/dist/validation/stack-schemas.d.ts +535 -0
- package/dist/validation/stack-schemas.d.ts.map +1 -0
- package/dist/validation/stack-schemas.js +178 -0
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/stack/deploy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD7E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack deploy command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleStackDeploy = handleStackDeploy;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const instances_1 = require("../../services/instances");
|
|
12
|
+
async function handleStackDeploy(options) {
|
|
13
|
+
const { stackService, logger } = (0, instances_1.getServiceInstances)();
|
|
14
|
+
try {
|
|
15
|
+
logger.info(`Deploying stack from: ${options.file}`);
|
|
16
|
+
if (options.dryRun) {
|
|
17
|
+
console.log(chalk_1.default.cyan('Running in dry-run mode (no changes will be made)\n'));
|
|
18
|
+
}
|
|
19
|
+
const result = await stackService.deployStack(options);
|
|
20
|
+
// Display results
|
|
21
|
+
console.log('\n' + chalk_1.default.bold('Deployment Results:'));
|
|
22
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
23
|
+
if (result.deployed.length > 0) {
|
|
24
|
+
console.log(chalk_1.default.green('\n✓ Successfully deployed:'));
|
|
25
|
+
for (const app of result.deployed) {
|
|
26
|
+
console.log(chalk_1.default.green(` - ${app.name}`));
|
|
27
|
+
if (app.urls && app.urls.length > 0) {
|
|
28
|
+
for (const url of app.urls) {
|
|
29
|
+
console.log(chalk_1.default.gray(` ${url}`));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (result.failed.length > 0) {
|
|
35
|
+
console.log(chalk_1.default.red('\n✗ Failed to deploy:'));
|
|
36
|
+
for (const app of result.failed) {
|
|
37
|
+
console.log(chalk_1.default.red(` - ${app.name}: ${app.error}`));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (result.skipped.length > 0) {
|
|
41
|
+
console.log(chalk_1.default.yellow('\n⊘ Skipped:'));
|
|
42
|
+
for (const appName of result.skipped) {
|
|
43
|
+
console.log(chalk_1.default.yellow(` - ${appName}`));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
console.log(chalk_1.default.gray('\n' + '─'.repeat(50)));
|
|
47
|
+
console.log(chalk_1.default.bold(`Total: ${result.deployed.length} deployed, ${result.failed.length} failed, ${result.skipped.length} skipped`));
|
|
48
|
+
if (!result.success) {
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
logger.error(`Deployment error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
54
|
+
console.log(chalk_1.default.red(`\n✗ Deployment failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/commands/stack/diff.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2D9E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack diff command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleStackDiff = handleStackDiff;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const instances_1 = require("../../services/instances");
|
|
12
|
+
async function handleStackDiff(options) {
|
|
13
|
+
const { stackService, logger } = (0, instances_1.getServiceInstances)();
|
|
14
|
+
try {
|
|
15
|
+
logger.info(`Computing diff for stack: ${options.file}`);
|
|
16
|
+
const diff = await stackService.diffStack(options.file);
|
|
17
|
+
console.log(chalk_1.default.bold('\nStack Differences:'));
|
|
18
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
19
|
+
let hasChanges = false;
|
|
20
|
+
if (diff.toCreate.length > 0) {
|
|
21
|
+
hasChanges = true;
|
|
22
|
+
console.log(chalk_1.default.green('\n+ Applications to create:'));
|
|
23
|
+
for (const app of diff.toCreate) {
|
|
24
|
+
console.log(chalk_1.default.green(` + ${app.name} (${app.subtype})`));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (diff.toUpdate.length > 0) {
|
|
28
|
+
hasChanges = true;
|
|
29
|
+
console.log(chalk_1.default.yellow('\n~ Applications to update:'));
|
|
30
|
+
for (const app of diff.toUpdate) {
|
|
31
|
+
console.log(chalk_1.default.yellow(` ~ ${app.name}`));
|
|
32
|
+
for (const change of app.changes) {
|
|
33
|
+
console.log(chalk_1.default.gray(` ${change.field}: ${change.oldValue} → ${change.newValue}`));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (diff.toDelete.length > 0) {
|
|
38
|
+
hasChanges = true;
|
|
39
|
+
console.log(chalk_1.default.red('\n- Applications to delete:'));
|
|
40
|
+
for (const app of diff.toDelete) {
|
|
41
|
+
console.log(chalk_1.default.red(` - ${app.name}`));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (diff.unchanged.length > 0) {
|
|
45
|
+
console.log(chalk_1.default.gray('\n= Unchanged applications:'));
|
|
46
|
+
for (const appName of diff.unchanged) {
|
|
47
|
+
console.log(chalk_1.default.gray(` = ${appName}`));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
console.log(chalk_1.default.gray('\n' + '─'.repeat(50)));
|
|
51
|
+
if (!hasChanges) {
|
|
52
|
+
console.log(chalk_1.default.green('No changes detected. Stack is up to date.'));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log(chalk_1.default.bold(`Summary: ${diff.toCreate.length} to create, ${diff.toUpdate.length} to update, ${diff.toDelete.length} to delete`));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
logger.error(`Diff error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
60
|
+
console.log(chalk_1.default.red(`\n✗ Failed to compute diff: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/stack/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiD9G"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack status command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleStackStatus = handleStackStatus;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const instances_1 = require("../../services/instances");
|
|
12
|
+
async function handleStackStatus(options) {
|
|
13
|
+
const { stackService, logger } = (0, instances_1.getServiceInstances)();
|
|
14
|
+
try {
|
|
15
|
+
logger.info(`Getting stack status from: ${options.file}`);
|
|
16
|
+
const status = await stackService.getStackStatus(options.file);
|
|
17
|
+
// Filter to single app if specified
|
|
18
|
+
const applications = options.app
|
|
19
|
+
? status.applications.filter(app => app.name === options.app)
|
|
20
|
+
: status.applications;
|
|
21
|
+
if (options.json) {
|
|
22
|
+
console.log(JSON.stringify({ ...status, applications }, null, 2));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Display status
|
|
26
|
+
console.log(chalk_1.default.bold(`\nStack: ${status.stackName}`));
|
|
27
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
28
|
+
for (const app of applications) {
|
|
29
|
+
const statusIcon = app.status === 'deployed' ? chalk_1.default.green('✓') : chalk_1.default.gray('○');
|
|
30
|
+
const statusText = app.status === 'deployed' ? chalk_1.default.green('deployed') : chalk_1.default.gray('not deployed');
|
|
31
|
+
console.log(`\n${statusIcon} ${chalk_1.default.bold(app.name)} - ${statusText}`);
|
|
32
|
+
console.log(chalk_1.default.gray(` Device: ${app.deviceName}`));
|
|
33
|
+
if (app.published) {
|
|
34
|
+
console.log(chalk_1.default.gray(` Published: yes`));
|
|
35
|
+
}
|
|
36
|
+
if (app.urls && app.urls.length > 0) {
|
|
37
|
+
console.log(chalk_1.default.gray(` URLs:`));
|
|
38
|
+
for (const url of app.urls) {
|
|
39
|
+
console.log(chalk_1.default.cyan(` - ${url}`));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
console.log(chalk_1.default.gray('\n' + '─'.repeat(50)));
|
|
44
|
+
const deployedCount = applications.filter(a => a.status === 'deployed').length;
|
|
45
|
+
console.log(chalk_1.default.bold(`Total: ${deployedCount}/${applications.length} deployed`));
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
logger.error(`Status error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
49
|
+
console.log(chalk_1.default.red(`\n✗ Failed to get status: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teardown.d.ts","sourceRoot":"","sources":["../../../src/commands/stack/teardown.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAgBpD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDjF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack teardown command handler
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.handleStackTeardown = handleStackTeardown;
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
const readline = __importStar(require("readline"));
|
|
45
|
+
const instances_1 = require("../../services/instances");
|
|
46
|
+
async function promptConfirmation(message) {
|
|
47
|
+
const rl = readline.createInterface({
|
|
48
|
+
input: process.stdin,
|
|
49
|
+
output: process.stdout,
|
|
50
|
+
});
|
|
51
|
+
return new Promise((resolve) => {
|
|
52
|
+
rl.question(message + ' (yes/no): ', (answer) => {
|
|
53
|
+
rl.close();
|
|
54
|
+
resolve(answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function handleStackTeardown(options) {
|
|
59
|
+
const { stackService, logger } = (0, instances_1.getServiceInstances)();
|
|
60
|
+
try {
|
|
61
|
+
logger.info(`Tearing down stack from: ${options.file}`);
|
|
62
|
+
// Prompt for confirmation unless --force
|
|
63
|
+
if (!options.force) {
|
|
64
|
+
const confirmed = await promptConfirmation(chalk_1.default.yellow('\n⚠ This will remove all applications in the stack. Continue?'));
|
|
65
|
+
if (!confirmed) {
|
|
66
|
+
console.log(chalk_1.default.gray('Teardown cancelled.'));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const result = await stackService.teardownStack(options);
|
|
71
|
+
// Display results
|
|
72
|
+
console.log('\n' + chalk_1.default.bold('Teardown Results:'));
|
|
73
|
+
console.log(chalk_1.default.gray('─'.repeat(50)));
|
|
74
|
+
if (result.removed.length > 0) {
|
|
75
|
+
console.log(chalk_1.default.green('\n✓ Successfully removed:'));
|
|
76
|
+
for (const appName of result.removed) {
|
|
77
|
+
console.log(chalk_1.default.green(` - ${appName}`));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (result.failed.length > 0) {
|
|
81
|
+
console.log(chalk_1.default.red('\n✗ Failed to remove:'));
|
|
82
|
+
for (const app of result.failed) {
|
|
83
|
+
console.log(chalk_1.default.red(` - ${app.name}: ${app.error}`));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (result.skipped.length > 0) {
|
|
87
|
+
console.log(chalk_1.default.yellow('\n⊘ Skipped (not deployed):'));
|
|
88
|
+
for (const appName of result.skipped) {
|
|
89
|
+
console.log(chalk_1.default.yellow(` - ${appName}`));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
console.log(chalk_1.default.gray('\n' + '─'.repeat(50)));
|
|
93
|
+
console.log(chalk_1.default.bold(`Total: ${result.removed.length} removed, ${result.failed.length} failed, ${result.skipped.length} skipped`));
|
|
94
|
+
if (!result.success) {
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
logger.error(`Teardown error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
100
|
+
console.log(chalk_1.default.red(`\n✗ Teardown failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=teardown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/stack/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BlF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack validate command handler
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.handleStackValidate = handleStackValidate;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const instances_1 = require("../../services/instances");
|
|
12
|
+
async function handleStackValidate(options) {
|
|
13
|
+
const { stackService, logger } = (0, instances_1.getServiceInstances)();
|
|
14
|
+
try {
|
|
15
|
+
logger.info(`Validating stack file: ${options.file}`);
|
|
16
|
+
const result = await stackService.validateStack(options.file);
|
|
17
|
+
if (result.valid) {
|
|
18
|
+
console.log(chalk_1.default.green('✓ Stack validation passed'));
|
|
19
|
+
if (result.warnings.length > 0) {
|
|
20
|
+
console.log(chalk_1.default.yellow('\nWarnings:'));
|
|
21
|
+
for (const warning of result.warnings) {
|
|
22
|
+
console.log(chalk_1.default.yellow(` - ${warning.path}: ${warning.message}`));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.log(chalk_1.default.red('✗ Stack validation failed'));
|
|
28
|
+
console.log(chalk_1.default.red('\nErrors:'));
|
|
29
|
+
for (const error of result.errors) {
|
|
30
|
+
const location = error.line ? `${error.path} (line ${error.line})` : error.path;
|
|
31
|
+
console.log(chalk_1.default.red(` - ${location}: ${error.message}`));
|
|
32
|
+
}
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
logger.error(`Validation error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
38
|
+
console.log(chalk_1.default.red(`\n✗ Validation failed: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack command group
|
|
3
|
+
* Commands for managing application stacks
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
/**
|
|
7
|
+
* Setup stack commands
|
|
8
|
+
*/
|
|
9
|
+
export declare function setupStackCommands(program: Command): void;
|
|
10
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/commands/stack.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4HzD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stack command group
|
|
4
|
+
* Commands for managing application stacks
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.setupStackCommands = setupStackCommands;
|
|
8
|
+
const command_wrapper_1 = require("./base/command-wrapper");
|
|
9
|
+
const deploy_1 = require("./stack/deploy");
|
|
10
|
+
const teardown_1 = require("./stack/teardown");
|
|
11
|
+
const status_1 = require("./stack/status");
|
|
12
|
+
const validate_1 = require("./stack/validate");
|
|
13
|
+
const diff_1 = require("./stack/diff");
|
|
14
|
+
/**
|
|
15
|
+
* Setup stack commands
|
|
16
|
+
*/
|
|
17
|
+
function setupStackCommands(program) {
|
|
18
|
+
const stackCommand = program
|
|
19
|
+
.command('stack')
|
|
20
|
+
.description('Manage application stacks (declarative multi-app deployments)');
|
|
21
|
+
// Deploy command
|
|
22
|
+
stackCommand
|
|
23
|
+
.command('deploy')
|
|
24
|
+
.description('Deploy or update applications from a stack file')
|
|
25
|
+
.requiredOption('-f, --file <path>', 'Path to stack file')
|
|
26
|
+
.option('--app <name>', 'Deploy only specified application')
|
|
27
|
+
.option('--dry-run', 'Show what would change without deploying')
|
|
28
|
+
.option('--skip-dependencies', "Don't deploy dependencies")
|
|
29
|
+
.option('--force', 'Force redeployment even if unchanged')
|
|
30
|
+
.addHelpText('after', `
|
|
31
|
+
Examples:
|
|
32
|
+
$ edgible stack deploy -f production.yml
|
|
33
|
+
$ edgible stack deploy -f production.yml --app api-server
|
|
34
|
+
$ edgible stack deploy -f production.yml --dry-run
|
|
35
|
+
`)
|
|
36
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
37
|
+
await (0, deploy_1.handleStackDeploy)(options);
|
|
38
|
+
}, {
|
|
39
|
+
requireAuth: true,
|
|
40
|
+
requireOrganization: true,
|
|
41
|
+
}));
|
|
42
|
+
// Teardown command
|
|
43
|
+
stackCommand
|
|
44
|
+
.command('teardown')
|
|
45
|
+
.description('Remove applications defined in a stack')
|
|
46
|
+
.requiredOption('-f, --file <path>', 'Path to stack file')
|
|
47
|
+
.option('--app <name>', 'Teardown only specified application')
|
|
48
|
+
.option('--force', 'Skip confirmation prompts')
|
|
49
|
+
.option('--keep-dependencies', "Don't teardown dependencies")
|
|
50
|
+
.addHelpText('after', `
|
|
51
|
+
Examples:
|
|
52
|
+
$ edgible stack teardown -f production.yml
|
|
53
|
+
$ edgible stack teardown -f production.yml --app worker
|
|
54
|
+
$ edgible stack teardown -f production.yml --force
|
|
55
|
+
`)
|
|
56
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
57
|
+
await (0, teardown_1.handleStackTeardown)(options);
|
|
58
|
+
}, {
|
|
59
|
+
requireAuth: true,
|
|
60
|
+
requireOrganization: true,
|
|
61
|
+
}));
|
|
62
|
+
// Status command
|
|
63
|
+
stackCommand
|
|
64
|
+
.command('status')
|
|
65
|
+
.description('Check the status of applications in a stack')
|
|
66
|
+
.requiredOption('-f, --file <path>', 'Path to stack file')
|
|
67
|
+
.option('--json', 'Output as JSON')
|
|
68
|
+
.option('--app <name>', 'Show status for specific application')
|
|
69
|
+
.addHelpText('after', `
|
|
70
|
+
Examples:
|
|
71
|
+
$ edgible stack status -f production.yml
|
|
72
|
+
$ edgible stack status -f production.yml --json
|
|
73
|
+
$ edgible stack status -f production.yml --app database
|
|
74
|
+
`)
|
|
75
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
76
|
+
await (0, status_1.handleStackStatus)(options);
|
|
77
|
+
}, {
|
|
78
|
+
requireAuth: true,
|
|
79
|
+
requireOrganization: true,
|
|
80
|
+
}));
|
|
81
|
+
// Validate command
|
|
82
|
+
stackCommand
|
|
83
|
+
.command('validate')
|
|
84
|
+
.description('Validate a stack file without deploying')
|
|
85
|
+
.requiredOption('-f, --file <path>', 'Path to stack file')
|
|
86
|
+
.addHelpText('after', `
|
|
87
|
+
Examples:
|
|
88
|
+
$ edgible stack validate -f production.yml
|
|
89
|
+
`)
|
|
90
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
91
|
+
await (0, validate_1.handleStackValidate)(options);
|
|
92
|
+
}, {
|
|
93
|
+
requireAuth: false,
|
|
94
|
+
requireOrganization: false,
|
|
95
|
+
}));
|
|
96
|
+
// Diff command
|
|
97
|
+
stackCommand
|
|
98
|
+
.command('diff')
|
|
99
|
+
.description('Show differences between stack and deployed state')
|
|
100
|
+
.requiredOption('-f, --file <path>', 'Path to stack file')
|
|
101
|
+
.addHelpText('after', `
|
|
102
|
+
Examples:
|
|
103
|
+
$ edgible stack diff -f production.yml
|
|
104
|
+
`)
|
|
105
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
106
|
+
await (0, diff_1.handleStackDiff)(options);
|
|
107
|
+
}, {
|
|
108
|
+
requireAuth: true,
|
|
109
|
+
requireOrganization: true,
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=stack.js.map
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const config_1 = require("./commands/config");
|
|
|
11
11
|
const discover_1 = require("./commands/discover");
|
|
12
12
|
const connectivity_1 = require("./commands/connectivity");
|
|
13
13
|
const ai_1 = require("./commands/ai");
|
|
14
|
+
const stack_1 = require("./commands/stack");
|
|
14
15
|
const agent_1 = require("./commands/agent");
|
|
15
16
|
const debug_1 = require("./commands/debug");
|
|
16
17
|
const managedGateway_1 = require("./commands/managedGateway");
|
|
@@ -36,6 +37,7 @@ program
|
|
|
36
37
|
(0, auth_1.setupAuthCommands)(program);
|
|
37
38
|
(0, application_1.setupApplicationCommands)(program);
|
|
38
39
|
(0, gateway_1.setupGatewayCommands)(program);
|
|
40
|
+
(0, stack_1.setupStackCommands)(program);
|
|
39
41
|
(0, config_1.setupConfigCommands)(program);
|
|
40
42
|
(0, discover_1.setupDiscoverCommands)(program);
|
|
41
43
|
(0, connectivity_1.setupConnectivityCommands)(program);
|
|
@@ -10,6 +10,7 @@ import { EdgibleService } from './edgible';
|
|
|
10
10
|
import { LocalAgentManager } from './LocalAgentManager';
|
|
11
11
|
import { ConnectivityTester } from './ConnectivityTester';
|
|
12
12
|
import { WorkloadDetector } from '../detection/WorkloadDetector';
|
|
13
|
+
import { StackService } from './stack/StackService';
|
|
13
14
|
import type { Logger } from '../utils/logger';
|
|
14
15
|
import type { TokenManager } from './token/TokenManager';
|
|
15
16
|
import type { AuthService } from './auth/AuthService';
|
|
@@ -29,6 +30,28 @@ export declare const localAgentManager: LocalAgentManager;
|
|
|
29
30
|
export declare const managedGatewayService: ManagedGatewayService;
|
|
30
31
|
export declare const diagnosticsService: DiagnosticsService;
|
|
31
32
|
export declare const agentDeploymentService: AgentDeploymentService;
|
|
33
|
+
export declare function getStackService(): StackService;
|
|
34
|
+
export declare const stackService: {
|
|
35
|
+
readonly instance: StackService;
|
|
36
|
+
};
|
|
32
37
|
export declare function createConnectivityTester(): ConnectivityTester;
|
|
33
38
|
export declare function createWorkloadDetector(): WorkloadDetector;
|
|
39
|
+
/**
|
|
40
|
+
* Get all service instances
|
|
41
|
+
* Convenience function for commands that need multiple services
|
|
42
|
+
*/
|
|
43
|
+
export declare function getServiceInstances(): {
|
|
44
|
+
logger: Logger;
|
|
45
|
+
configManager: ConfigManager;
|
|
46
|
+
tokenManager: TokenManager;
|
|
47
|
+
authService: AuthService;
|
|
48
|
+
applicationService: ApplicationService;
|
|
49
|
+
gatewayService: GatewayService;
|
|
50
|
+
edgibleService: EdgibleService;
|
|
51
|
+
localAgentManager: LocalAgentManager;
|
|
52
|
+
managedGatewayService: ManagedGatewayService;
|
|
53
|
+
diagnosticsService: DiagnosticsService;
|
|
54
|
+
agentDeploymentService: AgentDeploymentService;
|
|
55
|
+
stackService: StackService;
|
|
56
|
+
};
|
|
34
57
|
//# sourceMappingURL=instances.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/services/instances.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/services/instances.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAMvF,eAAO,MAAM,MAAM,EAAE,MAInB,CAAC;AAGH,eAAO,MAAM,aAAa,eAAsB,CAAC;AAGjD,eAAO,MAAM,YAAY,EAAE,YAA0D,CAAC;AAGtF,eAAO,MAAM,WAAW,EAAE,WAKzB,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,kBAMhC,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE,cAM5B,CAAC;AAGF,eAAO,MAAM,cAAc,gBAK1B,CAAC;AAGF,eAAO,MAAM,iBAAiB,mBAA0B,CAAC;AAGzD,eAAO,MAAM,qBAAqB,EAAE,qBAAqE,CAAC;AAG1G,eAAO,MAAM,kBAAkB,EAAE,kBAA+D,CAAC;AAGjG,eAAO,MAAM,sBAAsB,EAAE,sBAAuE,CAAC;AAI7G,wBAAgB,eAAe,IAAI,YAAY,CAoB9C;AAGD,eAAO,MAAM,YAAY;;CAIxB,CAAC;AAGF,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D;AAGD,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB;;;;;;;;;;;;;EAelC"}
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* Services are instantiated once and shared across the application.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.agentDeploymentService = exports.diagnosticsService = exports.managedGatewayService = exports.localAgentManager = exports.edgibleService = exports.gatewayService = exports.applicationService = exports.authService = exports.tokenManager = exports.configManager = exports.logger = void 0;
|
|
10
|
+
exports.stackService = exports.agentDeploymentService = exports.diagnosticsService = exports.managedGatewayService = exports.localAgentManager = exports.edgibleService = exports.gatewayService = exports.applicationService = exports.authService = exports.tokenManager = exports.configManager = exports.logger = void 0;
|
|
11
|
+
exports.getStackService = getStackService;
|
|
11
12
|
exports.createConnectivityTester = createConnectivityTester;
|
|
12
13
|
exports.createWorkloadDetector = createWorkloadDetector;
|
|
14
|
+
exports.getServiceInstances = getServiceInstances;
|
|
13
15
|
const console_logger_1 = require("../utils/console-logger");
|
|
14
16
|
const config_1 = require("../state/config");
|
|
15
17
|
const TokenManager_1 = require("./token/TokenManager");
|
|
@@ -23,6 +25,8 @@ const WorkloadDetector_1 = require("../detection/WorkloadDetector");
|
|
|
23
25
|
const ManagedGatewayService_1 = require("./managedGateway/ManagedGatewayService");
|
|
24
26
|
const DiagnosticsService_1 = require("./diagnostics/DiagnosticsService");
|
|
25
27
|
const AgentDeploymentService_1 = require("./agentDeployment/AgentDeploymentService");
|
|
28
|
+
const StackService_1 = require("./stack/StackService");
|
|
29
|
+
const client_1 = require("../client");
|
|
26
30
|
const app_config_1 = require("../config/app-config");
|
|
27
31
|
const logger_1 = require("../utils/logger");
|
|
28
32
|
// Get application configuration
|
|
@@ -53,6 +57,27 @@ exports.managedGatewayService = new ManagedGatewayService_1.ManagedGatewayServic
|
|
|
53
57
|
exports.diagnosticsService = new DiagnosticsService_1.DiagnosticsServiceImpl(exports.edgibleService);
|
|
54
58
|
// Create agent deployment service
|
|
55
59
|
exports.agentDeploymentService = new AgentDeploymentService_1.AgentDeploymentServiceImpl(exports.edgibleService);
|
|
60
|
+
// Create stack service
|
|
61
|
+
let _stackService = null;
|
|
62
|
+
function getStackService() {
|
|
63
|
+
if (!_stackService) {
|
|
64
|
+
const config = exports.configManager.getConfig();
|
|
65
|
+
const organizationId = config.organizationId;
|
|
66
|
+
if (!organizationId) {
|
|
67
|
+
throw new Error('Organization ID not set. Please authenticate first.');
|
|
68
|
+
}
|
|
69
|
+
const apiClient = (0, client_1.createApiClient)(appConfig.apiBaseUrl);
|
|
70
|
+
exports.tokenManager.restoreTokensFromConfig(apiClient);
|
|
71
|
+
_stackService = new StackService_1.StackService(apiClient, exports.applicationService, organizationId, exports.logger);
|
|
72
|
+
}
|
|
73
|
+
return _stackService;
|
|
74
|
+
}
|
|
75
|
+
// Export stackService as a getter to ensure it's initialized with proper organizationId
|
|
76
|
+
exports.stackService = {
|
|
77
|
+
get instance() {
|
|
78
|
+
return getStackService();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
56
81
|
// Create connectivity tester (transient - create new instances as needed)
|
|
57
82
|
function createConnectivityTester() {
|
|
58
83
|
return new ConnectivityTester_1.ConnectivityTester();
|
|
@@ -61,4 +86,24 @@ function createConnectivityTester() {
|
|
|
61
86
|
function createWorkloadDetector() {
|
|
62
87
|
return new WorkloadDetector_1.WorkloadDetector();
|
|
63
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Get all service instances
|
|
91
|
+
* Convenience function for commands that need multiple services
|
|
92
|
+
*/
|
|
93
|
+
function getServiceInstances() {
|
|
94
|
+
return {
|
|
95
|
+
logger: exports.logger,
|
|
96
|
+
configManager: exports.configManager,
|
|
97
|
+
tokenManager: exports.tokenManager,
|
|
98
|
+
authService: exports.authService,
|
|
99
|
+
applicationService: exports.applicationService,
|
|
100
|
+
gatewayService: exports.gatewayService,
|
|
101
|
+
edgibleService: exports.edgibleService,
|
|
102
|
+
localAgentManager: exports.localAgentManager,
|
|
103
|
+
managedGatewayService: exports.managedGatewayService,
|
|
104
|
+
diagnosticsService: exports.diagnosticsService,
|
|
105
|
+
agentDeploymentService: exports.agentDeploymentService,
|
|
106
|
+
stackService: getStackService(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
64
109
|
//# sourceMappingURL=instances.js.map
|