@qodalis/cli-server-plugin-aws 0.0.0-stage → 1.0.0-beta.13

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -2
  3. package/dist/aws-command-processor.d.ts +19 -0
  4. package/dist/aws-command-processor.d.ts.map +1 -0
  5. package/dist/aws-command-processor.js +265 -0
  6. package/dist/aws-command-processor.js.map +1 -0
  7. package/dist/index.d.ts +12 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +23 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/processors/cloudwatch-processor.d.ts +12 -0
  12. package/dist/processors/cloudwatch-processor.d.ts.map +1 -0
  13. package/dist/processors/cloudwatch-processor.js +168 -0
  14. package/dist/processors/cloudwatch-processor.js.map +1 -0
  15. package/dist/processors/dynamodb-processor.d.ts +12 -0
  16. package/dist/processors/dynamodb-processor.d.ts.map +1 -0
  17. package/dist/processors/dynamodb-processor.js +201 -0
  18. package/dist/processors/dynamodb-processor.js.map +1 -0
  19. package/dist/processors/ec2-processor.d.ts +12 -0
  20. package/dist/processors/ec2-processor.d.ts.map +1 -0
  21. package/dist/processors/ec2-processor.js +305 -0
  22. package/dist/processors/ec2-processor.js.map +1 -0
  23. package/dist/processors/ecs-processor.d.ts +12 -0
  24. package/dist/processors/ecs-processor.d.ts.map +1 -0
  25. package/dist/processors/ecs-processor.js +169 -0
  26. package/dist/processors/ecs-processor.js.map +1 -0
  27. package/dist/processors/iam-processor.d.ts +12 -0
  28. package/dist/processors/iam-processor.d.ts.map +1 -0
  29. package/dist/processors/iam-processor.js +151 -0
  30. package/dist/processors/iam-processor.js.map +1 -0
  31. package/dist/processors/lambda-processor.d.ts +12 -0
  32. package/dist/processors/lambda-processor.d.ts.map +1 -0
  33. package/dist/processors/lambda-processor.js +187 -0
  34. package/dist/processors/lambda-processor.js.map +1 -0
  35. package/dist/processors/s3-processor.d.ts +27 -0
  36. package/dist/processors/s3-processor.d.ts.map +1 -0
  37. package/dist/processors/s3-processor.js +345 -0
  38. package/dist/processors/s3-processor.js.map +1 -0
  39. package/dist/processors/sns-processor.d.ts +12 -0
  40. package/dist/processors/sns-processor.d.ts.map +1 -0
  41. package/dist/processors/sns-processor.js +157 -0
  42. package/dist/processors/sns-processor.js.map +1 -0
  43. package/dist/processors/sqs-processor.d.ts +12 -0
  44. package/dist/processors/sqs-processor.d.ts.map +1 -0
  45. package/dist/processors/sqs-processor.js +191 -0
  46. package/dist/processors/sqs-processor.js.map +1 -0
  47. package/dist/services/aws-config-service.d.ts +50 -0
  48. package/dist/services/aws-config-service.d.ts.map +1 -0
  49. package/dist/services/aws-config-service.js +61 -0
  50. package/dist/services/aws-config-service.js.map +1 -0
  51. package/dist/services/aws-credential-manager.d.ts +29 -0
  52. package/dist/services/aws-credential-manager.d.ts.map +1 -0
  53. package/dist/services/aws-credential-manager.js +50 -0
  54. package/dist/services/aws-credential-manager.js.map +1 -0
  55. package/dist/utils/output-helpers.d.ts +68 -0
  56. package/dist/utils/output-helpers.d.ts.map +1 -0
  57. package/dist/utils/output-helpers.js +107 -0
  58. package/dist/utils/output-helpers.js.map +1 -0
  59. package/dist/utils/pagination.d.ts +9 -0
  60. package/dist/utils/pagination.d.ts.map +1 -0
  61. package/dist/utils/pagination.js +21 -0
  62. package/dist/utils/pagination.js.map +1 -0
  63. package/package.json +51 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Qodalis Solutions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,156 @@
1
- # Temporary Holding Version
1
+ # @qodalis/cli-server-plugin-aws
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ AWS cloud resource management plugin for [Qodalis CLI Server (Node.js)](https://github.com/qodalis-solutions/cli-server-node). Provides commands for managing S3, EC2, Lambda, CloudWatch, SNS, SQS, IAM, DynamoDB, and ECS resources directly from the CLI.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @qodalis/cli-server-plugin-aws
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createCliServer } from '@qodalis/cli-server-node';
15
+ import { AwsModule } from '@qodalis/cli-server-plugin-aws';
16
+
17
+ const { app } = createCliServer({
18
+ configure: (builder) => {
19
+ builder.addModule(new AwsModule());
20
+ },
21
+ });
22
+ ```
23
+
24
+ ## Authentication
25
+
26
+ The plugin supports the full AWS credential chain:
27
+
28
+ 1. **CLI configure command**: `aws configure set --key <key> --secret <secret> --region <region>`
29
+ 2. **Environment variables**: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`
30
+ 3. **AWS profiles**: `aws configure set --profile <name>`
31
+ 4. **IAM roles**: Automatic when running on EC2/ECS/Lambda
32
+
33
+ Check connectivity: `aws status`
34
+
35
+ ## Commands
36
+
37
+ ### Configuration
38
+
39
+ | Command | Description |
40
+ |---------|-------------|
41
+ | `aws configure set` | Set AWS credentials and region |
42
+ | `aws configure get` | Show current configuration (secrets masked) |
43
+ | `aws configure profiles` | List available AWS profiles |
44
+ | `aws status` | Test connectivity via STS GetCallerIdentity |
45
+
46
+ ### S3
47
+
48
+ | Command | Description |
49
+ |---------|-------------|
50
+ | `aws s3 ls [bucket]` | List buckets or objects in a bucket |
51
+ | `aws s3 cp <source> <dest>` | Copy objects between S3 locations |
52
+ | `aws s3 rm <path>` | Delete an object (supports `--dry-run`) |
53
+ | `aws s3 mb <name>` | Create a bucket |
54
+ | `aws s3 rb <name>` | Delete a bucket (supports `--dry-run`) |
55
+ | `aws s3 presign <path>` | Generate a pre-signed URL |
56
+
57
+ ### EC2
58
+
59
+ | Command | Description |
60
+ |---------|-------------|
61
+ | `aws ec2 list` | List EC2 instances |
62
+ | `aws ec2 describe <id>` | Describe an instance |
63
+ | `aws ec2 start <id>` | Start an instance (supports `--dry-run`) |
64
+ | `aws ec2 stop <id>` | Stop an instance (supports `--dry-run`) |
65
+ | `aws ec2 reboot <id>` | Reboot an instance (supports `--dry-run`) |
66
+ | `aws ec2 sg list` | List security groups |
67
+
68
+ ### Lambda
69
+
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `aws lambda list` | List Lambda functions |
73
+ | `aws lambda invoke <name>` | Invoke a function (supports `--payload`) |
74
+ | `aws lambda logs <name>` | View recent function logs |
75
+
76
+ ### CloudWatch
77
+
78
+ | Command | Description |
79
+ |---------|-------------|
80
+ | `aws cloudwatch alarms` | List CloudWatch alarms |
81
+ | `aws cloudwatch logs <group>` | Fetch log events from a log group |
82
+ | `aws cloudwatch metrics <namespace>` | List metrics for a namespace |
83
+
84
+ ### SNS
85
+
86
+ | Command | Description |
87
+ |---------|-------------|
88
+ | `aws sns topics` | List SNS topics |
89
+ | `aws sns publish <arn> --message <msg>` | Publish a message to a topic |
90
+ | `aws sns subscriptions [arn]` | List subscriptions |
91
+
92
+ ### SQS
93
+
94
+ | Command | Description |
95
+ |---------|-------------|
96
+ | `aws sqs list` | List SQS queues |
97
+ | `aws sqs send <url> --message <msg>` | Send a message to a queue |
98
+ | `aws sqs receive <url>` | Receive messages (supports `--max`) |
99
+ | `aws sqs purge <url>` | Purge a queue (supports `--dry-run`) |
100
+
101
+ ### IAM
102
+
103
+ | Command | Description |
104
+ |---------|-------------|
105
+ | `aws iam users` | List IAM users |
106
+ | `aws iam roles` | List IAM roles |
107
+ | `aws iam policies` | List customer-managed policies |
108
+
109
+ ### DynamoDB
110
+
111
+ | Command | Description |
112
+ |---------|-------------|
113
+ | `aws dynamodb tables` | List DynamoDB tables |
114
+ | `aws dynamodb describe <table>` | Describe a table |
115
+ | `aws dynamodb scan <table>` | Scan items (supports `--limit`) |
116
+ | `aws dynamodb query <table> --key <expr>` | Query items |
117
+
118
+ ### ECS
119
+
120
+ | Command | Description |
121
+ |---------|-------------|
122
+ | `aws ecs clusters` | List ECS clusters |
123
+ | `aws ecs services <cluster>` | List services in a cluster |
124
+ | `aws ecs tasks <cluster>` | List tasks in a cluster |
125
+
126
+ ## Common Parameters
127
+
128
+ | Parameter | Alias | Description |
129
+ |-----------|-------|-------------|
130
+ | `--region` | `-r` | Override the AWS region for this command |
131
+ | `--output` | `-o` | Output format: `table` (default), `json`, or `text` |
132
+ | `--dry-run` | | Preview destructive operations without executing |
133
+
134
+ ## Output Formats
135
+
136
+ Commands return structured responses adapted to the data:
137
+
138
+ - **Tables** for resource lists (instances, buckets, functions, etc.)
139
+ - **Key-value** for single resource details (describe commands)
140
+ - **JSON** for complex data (DynamoDB items, Lambda payloads)
141
+ - **Text** for status messages and confirmations
142
+ - **Lists** for simple enumerations (ARNs, profile names)
143
+
144
+ ## Dependencies
145
+
146
+ This plugin uses AWS SDK v3 for JavaScript:
147
+
148
+ - `@aws-sdk/client-s3`, `@aws-sdk/client-ec2`, `@aws-sdk/client-lambda`
149
+ - `@aws-sdk/client-cloudwatch`, `@aws-sdk/client-cloudwatch-logs`
150
+ - `@aws-sdk/client-sns`, `@aws-sdk/client-sqs`, `@aws-sdk/client-iam`
151
+ - `@aws-sdk/client-dynamodb`, `@aws-sdk/client-ecs`, `@aws-sdk/client-sts`
152
+ - `@aws-sdk/credential-providers`, `@aws-sdk/s3-request-presigner`
153
+
154
+ ## License
155
+
156
+ MIT
@@ -0,0 +1,19 @@
1
+ import { CliCommandProcessor, ICliCommandProcessor } from '@qodalis/cli-server-abstractions';
2
+ import { AwsConfigService } from './services/aws-config-service';
3
+ import { AwsCredentialManager } from './services/aws-credential-manager';
4
+ /** Root processor for all AWS CLI commands, providing access to service-specific sub-processors. */
5
+ export declare class AwsCommandProcessor extends CliCommandProcessor {
6
+ command: string;
7
+ description: string;
8
+ processors: ICliCommandProcessor[];
9
+ private readonly configService;
10
+ private readonly credentialManager;
11
+ constructor();
12
+ /** Returns the credential manager used by all sub-processors. */
13
+ getCredentialManager(): AwsCredentialManager;
14
+ /** Returns the configuration service used by all sub-processors. */
15
+ getConfigService(): AwsConfigService;
16
+ /** @inheritdoc */
17
+ handleAsync(): Promise<string>;
18
+ }
19
+ //# sourceMappingURL=aws-command-processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-command-processor.d.ts","sourceRoot":"","sources":["../src/aws-command-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EAInB,oBAAoB,EACvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AA8NzE,oGAAoG;AACpG,qBAAa,mBAAoB,SAAQ,mBAAmB;IACxD,OAAO,SAAS;IAChB,WAAW,SAAmC;IAC9C,UAAU,EAAE,oBAAoB,EAAE,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuB;;IAqBzD,iEAAiE;IACjE,oBAAoB,IAAI,oBAAoB;IAI5C,oEAAoE;IACpE,gBAAgB,IAAI,gBAAgB;IAIpC,kBAAkB;IACZ,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}
@@ -0,0 +1,265 @@
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.AwsCommandProcessor = void 0;
37
+ const cli_server_abstractions_1 = require("@qodalis/cli-server-abstractions");
38
+ const aws_config_service_1 = require("./services/aws-config-service");
39
+ const aws_credential_manager_1 = require("./services/aws-credential-manager");
40
+ const output_helpers_1 = require("./utils/output-helpers");
41
+ const client_sts_1 = require("@aws-sdk/client-sts");
42
+ const s3_processor_1 = require("./processors/s3-processor");
43
+ const ec2_processor_1 = require("./processors/ec2-processor");
44
+ const lambda_processor_1 = require("./processors/lambda-processor");
45
+ const cloudwatch_processor_1 = require("./processors/cloudwatch-processor");
46
+ const sns_processor_1 = require("./processors/sns-processor");
47
+ const sqs_processor_1 = require("./processors/sqs-processor");
48
+ const iam_processor_1 = require("./processors/iam-processor");
49
+ const ecs_processor_1 = require("./processors/ecs-processor");
50
+ const dynamodb_processor_1 = require("./processors/dynamodb-processor");
51
+ const fs = __importStar(require("fs"));
52
+ const path = __importStar(require("path"));
53
+ const os = __importStar(require("os"));
54
+ /** Sub-processor that sets AWS credentials, region, and profile via `aws configure set`. */
55
+ class AwsConfigureSetProcessor extends cli_server_abstractions_1.CliCommandProcessor {
56
+ configService;
57
+ credentialManager;
58
+ command = 'set';
59
+ description = 'Set AWS credentials and region';
60
+ parameters = [
61
+ new cli_server_abstractions_1.CliCommandParameterDescriptor('key', 'AWS access key ID', false, 'string', ['-k']),
62
+ new cli_server_abstractions_1.CliCommandParameterDescriptor('secret', 'AWS secret access key', false, 'string', ['-s']),
63
+ new cli_server_abstractions_1.CliCommandParameterDescriptor('region', 'AWS region', false, 'string', ['-r']),
64
+ new cli_server_abstractions_1.CliCommandParameterDescriptor('profile', 'AWS profile name', false, 'string', ['-p'], 'default'),
65
+ ];
66
+ constructor(configService, credentialManager) {
67
+ super();
68
+ this.configService = configService;
69
+ this.credentialManager = credentialManager;
70
+ }
71
+ /** @inheritdoc */
72
+ async handleAsync() {
73
+ return '';
74
+ }
75
+ /** @inheritdoc */
76
+ async handleStructuredAsync(command) {
77
+ const key = command.args?.key;
78
+ const secret = command.args?.secret;
79
+ const region = command.args?.region;
80
+ const profile = command.args?.profile;
81
+ if (key && secret) {
82
+ this.configService.setCredentials(key, secret);
83
+ this.credentialManager.clearCache();
84
+ }
85
+ else if (key || secret) {
86
+ return (0, output_helpers_1.buildErrorResponse)('Both --key and --secret must be provided together.');
87
+ }
88
+ if (region) {
89
+ this.configService.setRegion(region);
90
+ this.credentialManager.clearCache();
91
+ }
92
+ if (profile) {
93
+ this.configService.setProfile(profile);
94
+ this.credentialManager.clearCache();
95
+ }
96
+ if (!key && !secret && !region && !profile) {
97
+ return (0, output_helpers_1.buildErrorResponse)('Provide at least one of --key/--secret, --region, or --profile.');
98
+ }
99
+ return (0, output_helpers_1.buildSuccessResponse)('AWS configuration updated.');
100
+ }
101
+ }
102
+ /** Sub-processor that displays the current AWS configuration (secrets masked) via `aws configure get`. */
103
+ class AwsConfigureGetProcessor extends cli_server_abstractions_1.CliCommandProcessor {
104
+ configService;
105
+ command = 'get';
106
+ description = 'Show current AWS configuration (secrets masked)';
107
+ constructor(configService) {
108
+ super();
109
+ this.configService = configService;
110
+ }
111
+ /** @inheritdoc */
112
+ async handleAsync() {
113
+ return '';
114
+ }
115
+ /** @inheritdoc */
116
+ async handleStructuredAsync() {
117
+ const summary = this.configService.getConfigSummary();
118
+ const entries = {};
119
+ entries['Access Key ID'] = summary.accessKeyId ?? '(not set)';
120
+ entries['Secret Access Key'] = summary.secretAccessKey ?? '(not set)';
121
+ entries['Region'] = summary.region ?? '(not set)';
122
+ entries['Profile'] = summary.profile ?? 'default';
123
+ return (0, output_helpers_1.buildResponse)([(0, output_helpers_1.formatAsKeyValue)(entries)]);
124
+ }
125
+ }
126
+ /** Sub-processor that lists available AWS profiles from ~/.aws/credentials and ~/.aws/config. */
127
+ class AwsConfigureProfilesProcessor extends cli_server_abstractions_1.CliCommandProcessor {
128
+ command = 'profiles';
129
+ description = 'List available AWS profiles from ~/.aws/credentials and ~/.aws/config';
130
+ /** @inheritdoc */
131
+ async handleAsync() {
132
+ return '';
133
+ }
134
+ /** @inheritdoc */
135
+ async handleStructuredAsync() {
136
+ const profiles = new Set();
137
+ const credentialsPath = path.join(os.homedir(), '.aws', 'credentials');
138
+ const configPath = path.join(os.homedir(), '.aws', 'config');
139
+ this.parseProfiles(credentialsPath, /^\[([^\]]+)\]/, profiles);
140
+ this.parseProfiles(configPath, /^\[(?:profile\s+)?([^\]]+)\]/, profiles);
141
+ const items = Array.from(profiles).sort();
142
+ if (items.length === 0) {
143
+ return (0, output_helpers_1.buildResponse)([
144
+ { type: 'text', value: 'No AWS profiles found in ~/.aws/credentials or ~/.aws/config.', style: 'warning' },
145
+ ]);
146
+ }
147
+ return (0, output_helpers_1.buildResponse)([(0, output_helpers_1.formatAsList)(items)]);
148
+ }
149
+ /**
150
+ * Parses profile names from an AWS configuration file.
151
+ * @param filePath - Path to the AWS credentials or config file.
152
+ * @param pattern - Regex to match section headers and capture profile names.
153
+ * @param profiles - Set to add discovered profile names to.
154
+ */
155
+ parseProfiles(filePath, pattern, profiles) {
156
+ try {
157
+ const content = fs.readFileSync(filePath, 'utf-8');
158
+ for (const line of content.split('\n')) {
159
+ const match = line.trim().match(pattern);
160
+ if (match) {
161
+ profiles.add(match[1].trim());
162
+ }
163
+ }
164
+ }
165
+ catch {
166
+ // File doesn't exist or is unreadable
167
+ }
168
+ }
169
+ }
170
+ /** Parent processor for `aws configure` sub-commands (set, get, profiles). */
171
+ class AwsConfigureProcessor extends cli_server_abstractions_1.CliCommandProcessor {
172
+ command = 'configure';
173
+ description = 'Manage AWS credentials and configuration';
174
+ processors;
175
+ constructor(configService, credentialManager) {
176
+ super();
177
+ this.processors = [
178
+ new AwsConfigureSetProcessor(configService, credentialManager),
179
+ new AwsConfigureGetProcessor(configService),
180
+ new AwsConfigureProfilesProcessor(),
181
+ ];
182
+ }
183
+ /** @inheritdoc */
184
+ async handleAsync() {
185
+ return '';
186
+ }
187
+ }
188
+ /** Sub-processor that tests AWS connectivity via STS GetCallerIdentity. */
189
+ class AwsStatusProcessor extends cli_server_abstractions_1.CliCommandProcessor {
190
+ credentialManager;
191
+ command = 'status';
192
+ description = 'Test AWS connectivity using STS GetCallerIdentity';
193
+ constructor(credentialManager) {
194
+ super();
195
+ this.credentialManager = credentialManager;
196
+ }
197
+ /** @inheritdoc */
198
+ async handleAsync() {
199
+ return '';
200
+ }
201
+ /** @inheritdoc */
202
+ async handleStructuredAsync() {
203
+ try {
204
+ const client = this.credentialManager.getClient(client_sts_1.STSClient);
205
+ const response = await client.send(new client_sts_1.GetCallerIdentityCommand({}));
206
+ const entries = {
207
+ Account: response.Account ?? '(unknown)',
208
+ Arn: response.Arn ?? '(unknown)',
209
+ UserId: response.UserId ?? '(unknown)',
210
+ };
211
+ return (0, output_helpers_1.buildResponse)([
212
+ { type: 'text', value: 'AWS connection successful.', style: 'success' },
213
+ (0, output_helpers_1.formatAsKeyValue)(entries),
214
+ ]);
215
+ }
216
+ catch (err) {
217
+ if (err.name === 'CredentialsProviderError' ||
218
+ err.name === 'NoSuchKey' ||
219
+ err.message?.includes('Could not load credentials')) {
220
+ return (0, output_helpers_1.buildErrorResponse)('No AWS credentials configured. Run "aws configure set --key <key> --secret <secret>" or set AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY environment variables.');
221
+ }
222
+ return (0, output_helpers_1.buildErrorResponse)(`AWS status check failed: ${err.message ?? err}`);
223
+ }
224
+ }
225
+ }
226
+ /** Root processor for all AWS CLI commands, providing access to service-specific sub-processors. */
227
+ class AwsCommandProcessor extends cli_server_abstractions_1.CliCommandProcessor {
228
+ command = 'aws';
229
+ description = 'AWS cloud resource management';
230
+ processors;
231
+ configService;
232
+ credentialManager;
233
+ constructor() {
234
+ super();
235
+ this.configService = new aws_config_service_1.AwsConfigService();
236
+ this.credentialManager = new aws_credential_manager_1.AwsCredentialManager(this.configService);
237
+ this.processors = [
238
+ new AwsConfigureProcessor(this.configService, this.credentialManager),
239
+ new AwsStatusProcessor(this.credentialManager),
240
+ new s3_processor_1.AwsS3Processor(this.credentialManager),
241
+ new ec2_processor_1.AwsEc2Processor(this.credentialManager),
242
+ new lambda_processor_1.AwsLambdaProcessor(this.credentialManager),
243
+ new cloudwatch_processor_1.AwsCloudWatchProcessor(this.credentialManager),
244
+ new sns_processor_1.AwsSnsProcessor(this.credentialManager),
245
+ new sqs_processor_1.AwsSqsProcessor(this.credentialManager),
246
+ new ecs_processor_1.AwsEcsProcessor(this.credentialManager),
247
+ new dynamodb_processor_1.AwsDynamoDbProcessor(this.credentialManager),
248
+ new iam_processor_1.AwsIamProcessor(this.credentialManager),
249
+ ];
250
+ }
251
+ /** Returns the credential manager used by all sub-processors. */
252
+ getCredentialManager() {
253
+ return this.credentialManager;
254
+ }
255
+ /** Returns the configuration service used by all sub-processors. */
256
+ getConfigService() {
257
+ return this.configService;
258
+ }
259
+ /** @inheritdoc */
260
+ async handleAsync() {
261
+ return '';
262
+ }
263
+ }
264
+ exports.AwsCommandProcessor = AwsCommandProcessor;
265
+ //# sourceMappingURL=aws-command-processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aws-command-processor.js","sourceRoot":"","sources":["../src/aws-command-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAM0C;AAC1C,sEAAiE;AACjE,8EAAyE;AACzE,2DAMgC;AAEhC,oDAA0E;AAC1E,4DAA2D;AAC3D,8DAA6D;AAC7D,oEAAmE;AACnE,4EAA2E;AAC3E,8DAA6D;AAC7D,8DAA6D;AAC7D,8DAA6D;AAC7D,8DAA6D;AAC7D,wEAAuE;AACvE,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,4FAA4F;AAC5F,MAAM,wBAAyB,SAAQ,6CAAmB;IAWjC;IACA;IAXrB,OAAO,GAAG,KAAK,CAAC;IAChB,WAAW,GAAG,gCAAgC,CAAC;IAC/C,UAAU,GAAG;QACT,IAAI,uDAA6B,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;QACtF,IAAI,uDAA6B,CAAC,QAAQ,EAAE,uBAAuB,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,IAAI,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,CAAC,iBAAiB,CAAC;YAC9C,IAAI,6BAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC1C,IAAI,+BAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,qCAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC9C,IAAI,6CAAsB,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAClD,IAAI,+BAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,+BAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,+BAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAC3C,IAAI,yCAAoB,CAAC,IAAI,CAAC,iBAAiB,CAAC;YAChD,IAAI,+BAAe,CAAC,IAAI,CAAC,iBAAiB,CAAC;SAC9C,CAAC;IACN,CAAC;IAED,iEAAiE;IACjE,oBAAoB;QAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED,oEAAoE;IACpE,gBAAgB;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,kBAAkB;IAClB,KAAK,CAAC,WAAW;QACb,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AAzCD,kDAyCC"}
@@ -0,0 +1,12 @@
1
+ import { CliModule, ICliCommandProcessor } from '@qodalis/cli-server-abstractions';
2
+ export declare class AwsModule extends CliModule {
3
+ name: string;
4
+ version: string;
5
+ description: string;
6
+ processors: ICliCommandProcessor[];
7
+ constructor();
8
+ }
9
+ export { AwsCommandProcessor } from './aws-command-processor';
10
+ export { AwsConfigService } from './services/aws-config-service';
11
+ export { AwsCredentialManager } from './services/aws-credential-manager';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAGnF,qBAAa,SAAU,SAAQ,SAAS;IACpC,IAAI,SAAS;IACb,OAAO,SAAW;IAClB,WAAW,SAAmC;IAC9C,UAAU,EAAE,oBAAoB,EAAE,CAAC;;CAMtC;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AwsCredentialManager = exports.AwsConfigService = exports.AwsCommandProcessor = exports.AwsModule = void 0;
4
+ const cli_server_abstractions_1 = require("@qodalis/cli-server-abstractions");
5
+ const aws_command_processor_1 = require("./aws-command-processor");
6
+ class AwsModule extends cli_server_abstractions_1.CliModule {
7
+ name = 'aws';
8
+ version = '1.0.0';
9
+ description = 'AWS cloud resource management';
10
+ processors;
11
+ constructor() {
12
+ super();
13
+ this.processors = [new aws_command_processor_1.AwsCommandProcessor()];
14
+ }
15
+ }
16
+ exports.AwsModule = AwsModule;
17
+ var aws_command_processor_2 = require("./aws-command-processor");
18
+ Object.defineProperty(exports, "AwsCommandProcessor", { enumerable: true, get: function () { return aws_command_processor_2.AwsCommandProcessor; } });
19
+ var aws_config_service_1 = require("./services/aws-config-service");
20
+ Object.defineProperty(exports, "AwsConfigService", { enumerable: true, get: function () { return aws_config_service_1.AwsConfigService; } });
21
+ var aws_credential_manager_1 = require("./services/aws-credential-manager");
22
+ Object.defineProperty(exports, "AwsCredentialManager", { enumerable: true, get: function () { return aws_credential_manager_1.AwsCredentialManager; } });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8EAAmF;AACnF,mEAA8D;AAE9D,MAAa,SAAU,SAAQ,mCAAS;IACpC,IAAI,GAAG,KAAK,CAAC;IACb,OAAO,GAAG,OAAO,CAAC;IAClB,WAAW,GAAG,+BAA+B,CAAC;IAC9C,UAAU,CAAyB;IAEnC;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,2CAAmB,EAAE,CAAC,CAAC;IAClD,CAAC;CACJ;AAVD,8BAUC;AAED,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,oEAAiE;AAAxD,sHAAA,gBAAgB,OAAA;AACzB,4EAAyE;AAAhE,8HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,12 @@
1
+ import { CliCommandProcessor, ICliCommandProcessor } from '@qodalis/cli-server-abstractions';
2
+ import { AwsCredentialManager } from '../services/aws-credential-manager';
3
+ /** Parent processor for CloudWatch sub-commands (alarms, logs, metrics). */
4
+ export declare class AwsCloudWatchProcessor extends CliCommandProcessor {
5
+ command: string;
6
+ description: string;
7
+ processors: ICliCommandProcessor[];
8
+ constructor(credentialManager: AwsCredentialManager);
9
+ /** @inheritdoc */
10
+ handleAsync(): Promise<string>;
11
+ }
12
+ //# sourceMappingURL=cloudwatch-processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudwatch-processor.d.ts","sourceRoot":"","sources":["../../src/processors/cloudwatch-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EAInB,oBAAoB,EAEvB,MAAM,kCAAkC,CAAC;AAU1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AA6K1E,4EAA4E;AAC5E,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC3D,OAAO,SAAgB;IACvB,WAAW,SAAmD;IAC9D,UAAU,EAAE,oBAAoB,EAAE,CAAC;gBAEvB,iBAAiB,EAAE,oBAAoB;IASnD,kBAAkB;IACZ,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAGvC"}