cloudops-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.
- package/README.md +132 -0
- package/dist/api/api-client.d.ts +78 -0
- package/dist/api/api-client.d.ts.map +1 -0
- package/dist/api/api-client.js +197 -0
- package/dist/api/api-client.js.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/__mocks__/auth-handler.d.ts +27 -0
- package/dist/auth/__mocks__/auth-handler.d.ts.map +1 -0
- package/dist/auth/__mocks__/auth-handler.js +24 -0
- package/dist/auth/__mocks__/auth-handler.js.map +1 -0
- package/dist/auth/auth-handler.d.ts +80 -0
- package/dist/auth/auth-handler.d.ts.map +1 -0
- package/dist/auth/auth-handler.js +266 -0
- package/dist/auth/auth-handler.js.map +1 -0
- package/dist/auth/callback-server.d.ts +31 -0
- package/dist/auth/callback-server.d.ts.map +1 -0
- package/dist/auth/callback-server.js +143 -0
- package/dist/auth/callback-server.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +422 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/accounts.d.ts +15 -0
- package/dist/commands/accounts.d.ts.map +1 -0
- package/dist/commands/accounts.js +307 -0
- package/dist/commands/accounts.js.map +1 -0
- package/dist/commands/audit.d.ts +23 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +348 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/config.d.ts +15 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +148 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/incident.d.ts +59 -0
- package/dist/commands/incident.d.ts.map +1 -0
- package/dist/commands/incident.js +1032 -0
- package/dist/commands/incident.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +300 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/investigate.d.ts +15 -0
- package/dist/commands/investigate.d.ts.map +1 -0
- package/dist/commands/investigate.js +65 -0
- package/dist/commands/investigate.js.map +1 -0
- package/dist/commands/runbook.d.ts +20 -0
- package/dist/commands/runbook.d.ts.map +1 -0
- package/dist/commands/runbook.js +265 -0
- package/dist/commands/runbook.js.map +1 -0
- package/dist/config/__mocks__/config-handler.d.ts +11 -0
- package/dist/config/__mocks__/config-handler.d.ts.map +1 -0
- package/dist/config/__mocks__/config-handler.js +31 -0
- package/dist/config/__mocks__/config-handler.js.map +1 -0
- package/dist/config/certificate-pinning.d.ts +68 -0
- package/dist/config/certificate-pinning.d.ts.map +1 -0
- package/dist/config/certificate-pinning.js +249 -0
- package/dist/config/certificate-pinning.js.map +1 -0
- package/dist/config/config-handler.d.ts +45 -0
- package/dist/config/config-handler.d.ts.map +1 -0
- package/dist/config/config-handler.js +149 -0
- package/dist/config/config-handler.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/types/cli-options.d.ts +31 -0
- package/dist/types/cli-options.d.ts.map +1 -0
- package/dist/types/cli-options.js +3 -0
- package/dist/types/cli-options.js.map +1 -0
- package/dist/utils/output-formatter.d.ts +67 -0
- package/dist/utils/output-formatter.d.ts.map +1 -0
- package/dist/utils/output-formatter.js +147 -0
- package/dist/utils/output-formatter.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certificate-pinning.js","sourceRoot":"","s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AC,EAAE,CAAC;YACtE,MAAM,CAAC,IAAI,CAAC,kCAAkC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC9D,SAAS;QACX,CAAC;QAED,6EAA6E;QAC7E,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,kCAAkC,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CAAC,QAAgB;IAC1D,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,SAAgB,yBAAyB,CAAC,QAAgB;IACxD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CLIConfig } from '@cloudops/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration file handler for CloudOps CLI
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigHandler {
|
|
6
|
+
private configPath;
|
|
7
|
+
/**
|
|
8
|
+
* Create a new configuration handler
|
|
9
|
+
* @param configPath Optional custom config file path (defaults to ~/.cloudops/config.yaml)
|
|
10
|
+
*/
|
|
11
|
+
constructor(configPath?: string);
|
|
12
|
+
/**
|
|
13
|
+
* Read configuration from file
|
|
14
|
+
* @returns Parsed configuration object
|
|
15
|
+
* @throws Error if file doesn't exist or is invalid
|
|
16
|
+
*/
|
|
17
|
+
readConfig(): CLIConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Write configuration to file
|
|
20
|
+
* @param config Configuration object to write
|
|
21
|
+
* @throws Error if configuration is invalid
|
|
22
|
+
*/
|
|
23
|
+
writeConfig(config: CLIConfig): void;
|
|
24
|
+
/**
|
|
25
|
+
* Check if configuration file exists
|
|
26
|
+
* @returns True if config file exists
|
|
27
|
+
*/
|
|
28
|
+
configExists(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Get the configuration file path
|
|
31
|
+
* @returns Path to configuration file
|
|
32
|
+
*/
|
|
33
|
+
getConfigPath(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Validate configuration object
|
|
36
|
+
* @param config Configuration to validate
|
|
37
|
+
* @throws Error if configuration is invalid
|
|
38
|
+
*/
|
|
39
|
+
private validateConfig;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the default configuration handler instance
|
|
43
|
+
*/
|
|
44
|
+
export declare function getDefaultConfigHandler(): ConfigHandler;
|
|
45
|
+
//# sourceMappingURL=config-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-handler.d.ts","sourceRoot":"","sources":["../../src/config/config-handler.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAY7C;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAS;IAE3B;;;OAGG;gBACS,UAAU,CAAC,EAAE,MAAM;IAI/B;;;;OAIG;IACH,UAAU,IAAI,SAAS;IAYvB;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAkBpC;;;OAGG;IACH,YAAY,IAAI,OAAO;IAIvB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAkCvB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAEvD"}
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ConfigHandler = void 0;
|
|
37
|
+
exports.getDefaultConfigHandler = getDefaultConfigHandler;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const yaml = __importStar(require("js-yaml"));
|
|
42
|
+
/**
|
|
43
|
+
* Default configuration directory path
|
|
44
|
+
*/
|
|
45
|
+
const CONFIG_DIR = path.join(os.homedir(), '.cloudops');
|
|
46
|
+
/**
|
|
47
|
+
* Default configuration file path
|
|
48
|
+
*/
|
|
49
|
+
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.yaml');
|
|
50
|
+
/**
|
|
51
|
+
* Configuration file handler for CloudOps CLI
|
|
52
|
+
*/
|
|
53
|
+
class ConfigHandler {
|
|
54
|
+
configPath;
|
|
55
|
+
/**
|
|
56
|
+
* Create a new configuration handler
|
|
57
|
+
* @param configPath Optional custom config file path (defaults to ~/.cloudops/config.yaml)
|
|
58
|
+
*/
|
|
59
|
+
constructor(configPath) {
|
|
60
|
+
this.configPath = configPath || CONFIG_FILE;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read configuration from file
|
|
64
|
+
* @returns Parsed configuration object
|
|
65
|
+
* @throws Error if file doesn't exist or is invalid
|
|
66
|
+
*/
|
|
67
|
+
readConfig() {
|
|
68
|
+
if (!fs.existsSync(this.configPath)) {
|
|
69
|
+
throw new Error(`Configuration file not found at ${this.configPath}`);
|
|
70
|
+
}
|
|
71
|
+
const fileContent = fs.readFileSync(this.configPath, 'utf8');
|
|
72
|
+
const config = yaml.load(fileContent);
|
|
73
|
+
this.validateConfig(config);
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Write configuration to file
|
|
78
|
+
* @param config Configuration object to write
|
|
79
|
+
* @throws Error if configuration is invalid
|
|
80
|
+
*/
|
|
81
|
+
writeConfig(config) {
|
|
82
|
+
this.validateConfig(config);
|
|
83
|
+
// Ensure config directory exists
|
|
84
|
+
const configDir = path.dirname(this.configPath);
|
|
85
|
+
if (!fs.existsSync(configDir)) {
|
|
86
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
87
|
+
}
|
|
88
|
+
const yamlContent = yaml.dump(config, {
|
|
89
|
+
indent: 2,
|
|
90
|
+
lineWidth: 120,
|
|
91
|
+
noRefs: true,
|
|
92
|
+
});
|
|
93
|
+
fs.writeFileSync(this.configPath, yamlContent, 'utf8');
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Check if configuration file exists
|
|
97
|
+
* @returns True if config file exists
|
|
98
|
+
*/
|
|
99
|
+
configExists() {
|
|
100
|
+
return fs.existsSync(this.configPath);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the configuration file path
|
|
104
|
+
* @returns Path to configuration file
|
|
105
|
+
*/
|
|
106
|
+
getConfigPath() {
|
|
107
|
+
return this.configPath;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validate configuration object
|
|
111
|
+
* @param config Configuration to validate
|
|
112
|
+
* @throws Error if configuration is invalid
|
|
113
|
+
*/
|
|
114
|
+
validateConfig(config) {
|
|
115
|
+
if (!config || typeof config !== 'object') {
|
|
116
|
+
throw new Error('Configuration must be an object');
|
|
117
|
+
}
|
|
118
|
+
if (!config.tenant_id || typeof config.tenant_id !== 'string') {
|
|
119
|
+
throw new Error('Configuration must include a valid tenant_id');
|
|
120
|
+
}
|
|
121
|
+
if (!config.control_plane_url || typeof config.control_plane_url !== 'string') {
|
|
122
|
+
throw new Error('Configuration must include a valid control_plane_url');
|
|
123
|
+
}
|
|
124
|
+
if (!config.auth || typeof config.auth !== 'object') {
|
|
125
|
+
throw new Error('Configuration must include auth settings');
|
|
126
|
+
}
|
|
127
|
+
if (!config.auth.method || !['sso', 'oauth', 'api_key'].includes(config.auth.method)) {
|
|
128
|
+
throw new Error('Configuration auth.method must be one of: sso, oauth, api_key');
|
|
129
|
+
}
|
|
130
|
+
// Optional fields validation
|
|
131
|
+
if (config.default_profile !== undefined && typeof config.default_profile !== 'string') {
|
|
132
|
+
throw new Error('Configuration default_profile must be a string');
|
|
133
|
+
}
|
|
134
|
+
if (config.auth.sso_provider !== undefined && typeof config.auth.sso_provider !== 'string') {
|
|
135
|
+
throw new Error('Configuration auth.sso_provider must be a string');
|
|
136
|
+
}
|
|
137
|
+
if (config.auth.sso_url !== undefined && typeof config.auth.sso_url !== 'string') {
|
|
138
|
+
throw new Error('Configuration auth.sso_url must be a string');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.ConfigHandler = ConfigHandler;
|
|
143
|
+
/**
|
|
144
|
+
* Get the default configuration handler instance
|
|
145
|
+
*/
|
|
146
|
+
function getDefaultConfigHandler() {
|
|
147
|
+
return new ConfigHandler();
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=config-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-handler.js","sourceRoot":"","sources":["../../src/config/config-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,0DAEC;AApID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,8CAAgC;AAGhC;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAa,aAAa;IAChB,UAAU,CAAS;IAE3B;;;OAGG;IACH,YAAY,UAAmB;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,WAAW,CAAC;IAC9C,CAAC;IAED;;;;OAIG;I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AO,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACjF,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF;AA1GD,sCA0GC;AAED;;GAEG;AACH,SAAgB,uBAAuB;IACrC,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultConfigHandler = exports.ConfigHandler = void 0;
|
|
4
|
+
var config_handler_1 = require("./config-handler");
|
|
5
|
+
Object.defineProperty(exports, "ConfigHandler", { enumerable: true, get: function () { return config_handler_1.ConfigHandler; } });
|
|
6
|
+
Object.defineProperty(exports, "getDefaultConfigHandler", { enumerable: true, get: function () { return config_handler_1.getDefaultConfigHandler; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAAjE,+GAAA,aAAa,OAAA;AAAE,yHAAA,uBAAuB,OAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.OutputFormatter = exports.getDefaultConfigHandler = exports.ConfigHandler = void 0;
|
|
18
|
+
// CLI entry point
|
|
19
|
+
var config_1 = require("./config");
|
|
20
|
+
Object.defineProperty(exports, "ConfigHandler", { enumerable: true, get: function () { return config_1.ConfigHandler; } });
|
|
21
|
+
Object.defineProperty(exports, "getDefaultConfigHandler", { enumerable: true, get: function () { return config_1.getDefaultConfigHandler; } });
|
|
22
|
+
var output_formatter_1 = require("./utils/output-formatter");
|
|
23
|
+
Object.defineProperty(exports, "OutputFormatter", { enumerable: true, get: function () { return output_formatter_1.OutputFormatter; } });
|
|
24
|
+
__exportStar(require("./types/cli-options"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kBAAkB;AAClB,mCAAkE;AAAzD,uGAAA,aAAa,OAAA;AAAE,iHAAA,uBAAuB,OAAA;AAC/C,6DAA2D;AAAlD,mHAAA,eAAe,OAAA;AACxB,sDAAoC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global CLI options available to all commands
|
|
3
|
+
*/
|
|
4
|
+
export interface GlobalOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Path to config file (default: ~/.cloudops/config.yaml)
|
|
7
|
+
*/
|
|
8
|
+
config?: string;
|
|
9
|
+
/**
|
|
10
|
+
* AI model profile to use for this command
|
|
11
|
+
*/
|
|
12
|
+
profile?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Enable debug output
|
|
15
|
+
*/
|
|
16
|
+
debug?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Output format options
|
|
20
|
+
*/
|
|
21
|
+
export type OutputFormat = 'table' | 'json' | 'yaml';
|
|
22
|
+
/**
|
|
23
|
+
* Common command options
|
|
24
|
+
*/
|
|
25
|
+
export interface CommonCommandOptions extends GlobalOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Output format
|
|
28
|
+
*/
|
|
29
|
+
format?: OutputFormat;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=cli-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-options.d.ts","sourceRoot":"","sources":["../../src/types/cli-options.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-options.js","sourceRoot":"","sources":["../../src/types/cli-options.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OutputFormatter provides consistent formatting for CLI output
|
|
3
|
+
* using chalk for colors and cli-table3 for tables
|
|
4
|
+
*/
|
|
5
|
+
export declare class OutputFormatter {
|
|
6
|
+
/**
|
|
7
|
+
* Format a success message
|
|
8
|
+
*/
|
|
9
|
+
static success(message: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Format an error message
|
|
12
|
+
*/
|
|
13
|
+
static error(message: string, error?: Error): void;
|
|
14
|
+
/**
|
|
15
|
+
* Format a warning message
|
|
16
|
+
*/
|
|
17
|
+
static warning(message: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Format an info message
|
|
20
|
+
*/
|
|
21
|
+
static info(message: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Format a debug message (only shown in debug mode)
|
|
24
|
+
*/
|
|
25
|
+
static debug(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Create a formatted table
|
|
28
|
+
*/
|
|
29
|
+
static table(headers: string[], rows: string[][]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Create a key-value table
|
|
32
|
+
*/
|
|
33
|
+
static keyValue(data: Record<string, string | number | boolean>): void;
|
|
34
|
+
/**
|
|
35
|
+
* Format JSON output
|
|
36
|
+
*/
|
|
37
|
+
static json(data: any, pretty?: boolean): void;
|
|
38
|
+
/**
|
|
39
|
+
* Format a section header
|
|
40
|
+
*/
|
|
41
|
+
static header(text: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Format a loading spinner message
|
|
44
|
+
*/
|
|
45
|
+
static loading(message: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Clear the loading message and show result
|
|
48
|
+
*/
|
|
49
|
+
static loadingDone(success?: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Format a list of items
|
|
52
|
+
*/
|
|
53
|
+
static list(items: string[], bullet?: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Format a numbered list
|
|
56
|
+
*/
|
|
57
|
+
static numberedList(items: string[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Format a horizontal separator
|
|
60
|
+
*/
|
|
61
|
+
static separator(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Format empty line
|
|
64
|
+
*/
|
|
65
|
+
static newline(): void;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=output-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/output-formatter.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAOlD;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMnC;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI;IAavD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI;IAiBtE;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,GAAE,OAAc,GAAG,IAAI;IAQpD;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMjC;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIrC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,GAAE,OAAc,GAAG,IAAI;IASjD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAY,GAAG,IAAI;IAMxD;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAM1C;;OAEG;IACH,MAAM,CAAC,SAAS,IAAI,IAAI;IAIxB;;OAEG;IACH,MAAM,CAAC,OAAO,IAAI,IAAI;CAGvB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
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.OutputFormatter = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
9
|
+
/**
|
|
10
|
+
* OutputFormatter provides consistent formatting for CLI output
|
|
11
|
+
* using chalk for colors and cli-table3 for tables
|
|
12
|
+
*/
|
|
13
|
+
class OutputFormatter {
|
|
14
|
+
/**
|
|
15
|
+
* Format a success message
|
|
16
|
+
*/
|
|
17
|
+
static success(message) {
|
|
18
|
+
console.log(chalk_1.default.green('✓'), message);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Format an error message
|
|
22
|
+
*/
|
|
23
|
+
static error(message, error) {
|
|
24
|
+
console.error(chalk_1.default.red('✗'), message);
|
|
25
|
+
if (error && process.env.DEBUG) {
|
|
26
|
+
console.error(chalk_1.default.gray(error.stack || error.message));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Format a warning message
|
|
31
|
+
*/
|
|
32
|
+
static warning(message) {
|
|
33
|
+
console.log(chalk_1.default.yellow('⚠'), message);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Format an info message
|
|
37
|
+
*/
|
|
38
|
+
static info(message) {
|
|
39
|
+
console.log(chalk_1.default.blue('ℹ'), message);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Format a debug message (only shown in debug mode)
|
|
43
|
+
*/
|
|
44
|
+
static debug(message) {
|
|
45
|
+
if (process.env.DEBUG) {
|
|
46
|
+
console.log(chalk_1.default.gray('→'), chalk_1.default.gray(message));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a formatted table
|
|
51
|
+
*/
|
|
52
|
+
static table(headers, rows) {
|
|
53
|
+
const table = new cli_table3_1.default({
|
|
54
|
+
head: headers.map(h => chalk_1.default.cyan(h)),
|
|
55
|
+
style: {
|
|
56
|
+
head: [],
|
|
57
|
+
border: ['gray']
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
rows.forEach(row => table.push(row));
|
|
61
|
+
console.log(table.toString());
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a key-value table
|
|
65
|
+
*/
|
|
66
|
+
static keyValue(data) {
|
|
67
|
+
const table = new cli_table3_1.default({
|
|
68
|
+
style: {
|
|
69
|
+
head: [],
|
|
70
|
+
border: ['gray']
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
74
|
+
table.push({
|
|
75
|
+
[chalk_1.default.cyan(key)]: String(value)
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
console.log(table.toString());
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format JSON output
|
|
82
|
+
*/
|
|
83
|
+
static json(data, pretty = true) {
|
|
84
|
+
if (pretty) {
|
|
85
|
+
console.log(JSON.stringify(data, null, 2));
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
console.log(JSON.stringify(data));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Format a section header
|
|
93
|
+
*/
|
|
94
|
+
static header(text) {
|
|
95
|
+
console.log();
|
|
96
|
+
console.log(chalk_1.default.bold.cyan(text));
|
|
97
|
+
console.log(chalk_1.default.gray('─'.repeat(text.length)));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Format a loading spinner message
|
|
101
|
+
*/
|
|
102
|
+
static loading(message) {
|
|
103
|
+
process.stdout.write(chalk_1.default.blue('⏳') + ' ' + message + '...');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Clear the loading message and show result
|
|
107
|
+
*/
|
|
108
|
+
static loadingDone(success = true) {
|
|
109
|
+
process.stdout.write('\r' + ' '.repeat(80) + '\r');
|
|
110
|
+
if (success) {
|
|
111
|
+
console.log(chalk_1.default.green('✓') + ' Done');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
console.log(chalk_1.default.red('✗') + ' Failed');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Format a list of items
|
|
119
|
+
*/
|
|
120
|
+
static list(items, bullet = '•') {
|
|
121
|
+
items.forEach(item => {
|
|
122
|
+
console.log(chalk_1.default.gray(bullet), item);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Format a numbered list
|
|
127
|
+
*/
|
|
128
|
+
static numberedList(items) {
|
|
129
|
+
items.forEach((item, index) => {
|
|
130
|
+
console.log(chalk_1.default.cyan(`${index + 1}.`), item);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Format a horizontal separator
|
|
135
|
+
*/
|
|
136
|
+
static separator() {
|
|
137
|
+
console.log(chalk_1.default.gray('─'.repeat(80)));
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Format empty line
|
|
141
|
+
*/
|
|
142
|
+
static newline() {
|
|
143
|
+
console.log();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.OutputFormatter = OutputFormatter;
|
|
147
|
+
//# sourceMappingURL=output-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-formatter.js","sourceRoot":"","sources":["../../src/utils/output-formatter.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4DAA+B;AAE/B;;;GAGG;AACH,MAAa,eAAe;IAC1B;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,OAAe,EAAE,KAAa;QACzC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAe;QACzB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,MAAM,CA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AC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAe,EAAE,SAAiB,GAAG;QAC/C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,KAAe;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAS;QACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO;QACZ,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;CACF;AAnJD,0CAmJC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cloudops-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CloudOps Enterprise CLI - AI-assisted cloud operations control plane",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"cloudops": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/**/*",
|
|
12
|
+
"README.md",
|
|
13
|
+
"package.json"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"cloudops",
|
|
20
|
+
"devops",
|
|
21
|
+
"sre",
|
|
22
|
+
"cloud",
|
|
23
|
+
"aws",
|
|
24
|
+
"azure",
|
|
25
|
+
"gcp",
|
|
26
|
+
"incident-management",
|
|
27
|
+
"ai",
|
|
28
|
+
"cli",
|
|
29
|
+
"automation",
|
|
30
|
+
"infrastructure"
|
|
31
|
+
],
|
|
32
|
+
"author": "",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/yourusername/cloudops-enterprise"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -b",
|
|
40
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
41
|
+
"test": "jest --passWithNoTests",
|
|
42
|
+
"test:watch": "jest --watch",
|
|
43
|
+
"lint": "eslint src --ext .ts",
|
|
44
|
+
"typecheck": "tsc --noEmit"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@cloudops/shared": "workspace:*",
|
|
48
|
+
"@types/js-yaml": "^4.0.9",
|
|
49
|
+
"axios": "^1.6.5",
|
|
50
|
+
"chalk": "^4.1.2",
|
|
51
|
+
"cli-table3": "^0.6.3",
|
|
52
|
+
"commander": "^11.1.0",
|
|
53
|
+
"inquirer": "^8.2.6",
|
|
54
|
+
"js-yaml": "^4.1.1",
|
|
55
|
+
"open": "^8.4.2",
|
|
56
|
+
"openid-client": "^6.8.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/inquirer": "^9.0.7",
|
|
60
|
+
"@types/jest": "^29.5.11",
|
|
61
|
+
"fast-check": "^3.15.0",
|
|
62
|
+
"jest": "^29.7.0",
|
|
63
|
+
"ts-jest": "^29.1.1"
|
|
64
|
+
}
|
|
65
|
+
}
|