@awsless/cli 0.1.37 → 0.1.38
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/bin.js +310 -39
- package/package.json +16 -14
package/dist/bin.js
CHANGED
|
@@ -126318,6 +126318,11 @@ function useColor() {
|
|
|
126318
126318
|
// ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
|
|
126319
126319
|
var program = new Command;
|
|
126320
126320
|
|
|
126321
|
+
// src/util/remote-agent.ts
|
|
126322
|
+
var isRemoteAgent = () => {
|
|
126323
|
+
return !!process.env.AWSLESS_REMOTE_AGENT && process.env.AWSLESS_REMOTE_AGENT !== "0";
|
|
126324
|
+
};
|
|
126325
|
+
|
|
126321
126326
|
// src/cli/command/auth/user/create.ts
|
|
126322
126327
|
import {
|
|
126323
126328
|
AdminAddUserToGroupCommand as AdminAddUserToGroupCommand2,
|
|
@@ -155252,7 +155257,20 @@ var isError = (error52, name) => {
|
|
|
155252
155257
|
return error52 instanceof Error && error52.name === name;
|
|
155253
155258
|
};
|
|
155254
155259
|
var hasRuntimeAwsCredentials = () => !!(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI || process.env.AWS_CONTAINER_CREDENTIALS_FULL_URI || process.env.AWS_ACCESS_KEY_ID || process.env.AWS_WEB_IDENTITY_TOKEN_FILE);
|
|
155260
|
+
var getRemoteAgentCredentials = async (profile) => {
|
|
155261
|
+
process.env.AWS_EC2_METADATA_DISABLED ??= "true";
|
|
155262
|
+
const provider = fromNodeProviderChain();
|
|
155263
|
+
try {
|
|
155264
|
+
await provider();
|
|
155265
|
+
} catch (error52) {
|
|
155266
|
+
throw new ExpectedError(`No AWS credentials found for the ${profile} profile while running as a remote agent. ` + `Set AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY in the environment.`, { cause: error52 });
|
|
155267
|
+
}
|
|
155268
|
+
return provider;
|
|
155269
|
+
};
|
|
155255
155270
|
var getCredentials = async (profile) => {
|
|
155271
|
+
if (isRemoteAgent()) {
|
|
155272
|
+
return getRemoteAgentCredentials(profile);
|
|
155273
|
+
}
|
|
155256
155274
|
if (hasRuntimeAwsCredentials()) {
|
|
155257
155275
|
return fromNodeProviderChain();
|
|
155258
155276
|
}
|
|
@@ -205177,6 +205195,255 @@ var prune = (program3) => {
|
|
|
205177
205195
|
});
|
|
205178
205196
|
};
|
|
205179
205197
|
|
|
205198
|
+
// src/cli/command/remote-agent/credentials/shared.ts
|
|
205199
|
+
import { IAMClient as IAMClient2 } from "@aws-sdk/client-iam";
|
|
205200
|
+
|
|
205201
|
+
// src/util/remote-agent-iam.ts
|
|
205202
|
+
import {
|
|
205203
|
+
CreateAccessKeyCommand,
|
|
205204
|
+
CreateUserCommand,
|
|
205205
|
+
DeleteAccessKeyCommand,
|
|
205206
|
+
DeleteUserCommand,
|
|
205207
|
+
DeleteUserPolicyCommand,
|
|
205208
|
+
GetUserCommand,
|
|
205209
|
+
GetUserPolicyCommand,
|
|
205210
|
+
ListAccessKeysCommand,
|
|
205211
|
+
PutUserPolicyCommand
|
|
205212
|
+
} from "@aws-sdk/client-iam";
|
|
205213
|
+
var remoteAgentUserName = (appName) => `awsless-remote-agent-${appName}`;
|
|
205214
|
+
var remoteAgentPolicyName = "awsless-remote-agent";
|
|
205215
|
+
var buildRemoteAgentPolicy = ({ appName, region, accountId, auth: auth2 }) => {
|
|
205216
|
+
return {
|
|
205217
|
+
Version: "2012-10-17",
|
|
205218
|
+
Statement: [
|
|
205219
|
+
{
|
|
205220
|
+
Sid: "ReadConfig",
|
|
205221
|
+
Effect: "Allow",
|
|
205222
|
+
Action: ["ssm:GetParametersByPath", "ssm:GetParameter", "ssm:GetParameters"],
|
|
205223
|
+
Resource: `arn:aws:ssm:${region}:${accountId}:parameter${configParameterPrefix(appName)}/*`
|
|
205224
|
+
},
|
|
205225
|
+
{
|
|
205226
|
+
Sid: "DecryptConfig",
|
|
205227
|
+
Effect: "Allow",
|
|
205228
|
+
Action: "kms:Decrypt",
|
|
205229
|
+
Resource: `arn:aws:kms:${region}:${accountId}:key/*`,
|
|
205230
|
+
Condition: { StringEquals: { "kms:ViaService": `ssm.${region}.amazonaws.com` } }
|
|
205231
|
+
},
|
|
205232
|
+
...auth2 ? [
|
|
205233
|
+
{
|
|
205234
|
+
Sid: "ResolveAuthPools",
|
|
205235
|
+
Effect: "Allow",
|
|
205236
|
+
Action: ["cognito-idp:ListUserPools", "cognito-idp:ListUserPoolClients"],
|
|
205237
|
+
Resource: "*"
|
|
205238
|
+
}
|
|
205239
|
+
] : []
|
|
205240
|
+
]
|
|
205241
|
+
};
|
|
205242
|
+
};
|
|
205243
|
+
|
|
205244
|
+
class RemoteAgentIam {
|
|
205245
|
+
client;
|
|
205246
|
+
appName;
|
|
205247
|
+
constructor(client2, appName) {
|
|
205248
|
+
this.client = client2;
|
|
205249
|
+
this.appName = appName;
|
|
205250
|
+
}
|
|
205251
|
+
get userName() {
|
|
205252
|
+
return remoteAgentUserName(this.appName);
|
|
205253
|
+
}
|
|
205254
|
+
async ensureUser() {
|
|
205255
|
+
try {
|
|
205256
|
+
await this.client.send(new GetUserCommand({ UserName: this.userName }));
|
|
205257
|
+
return "existing";
|
|
205258
|
+
} catch (error53) {
|
|
205259
|
+
if (!isError(error53, "NoSuchEntityException")) {
|
|
205260
|
+
throw error53;
|
|
205261
|
+
}
|
|
205262
|
+
}
|
|
205263
|
+
await this.client.send(new CreateUserCommand({
|
|
205264
|
+
UserName: this.userName,
|
|
205265
|
+
Tags: [
|
|
205266
|
+
{ Key: "awsless:app", Value: this.appName },
|
|
205267
|
+
{ Key: "awsless:purpose", Value: "remote-agent" }
|
|
205268
|
+
]
|
|
205269
|
+
}));
|
|
205270
|
+
return "created";
|
|
205271
|
+
}
|
|
205272
|
+
async ensurePolicy(policy) {
|
|
205273
|
+
const document2 = JSON.stringify(policy);
|
|
205274
|
+
let current;
|
|
205275
|
+
try {
|
|
205276
|
+
const result = await this.client.send(new GetUserPolicyCommand({ UserName: this.userName, PolicyName: remoteAgentPolicyName }));
|
|
205277
|
+
current = result.PolicyDocument ? JSON.stringify(JSON.parse(decodeURIComponent(result.PolicyDocument))) : undefined;
|
|
205278
|
+
} catch (error53) {
|
|
205279
|
+
if (!isError(error53, "NoSuchEntityException")) {
|
|
205280
|
+
throw error53;
|
|
205281
|
+
}
|
|
205282
|
+
}
|
|
205283
|
+
if (current === document2) {
|
|
205284
|
+
return "unchanged";
|
|
205285
|
+
}
|
|
205286
|
+
await this.client.send(new PutUserPolicyCommand({
|
|
205287
|
+
UserName: this.userName,
|
|
205288
|
+
PolicyName: remoteAgentPolicyName,
|
|
205289
|
+
PolicyDocument: document2
|
|
205290
|
+
}));
|
|
205291
|
+
return current === undefined ? "created" : "updated";
|
|
205292
|
+
}
|
|
205293
|
+
async listKeys() {
|
|
205294
|
+
try {
|
|
205295
|
+
const result = await this.client.send(new ListAccessKeysCommand({ UserName: this.userName }));
|
|
205296
|
+
return (result.AccessKeyMetadata ?? []).filter((key) => key.AccessKeyId).map((key) => ({ id: key.AccessKeyId, createdAt: key.CreateDate }));
|
|
205297
|
+
} catch (error53) {
|
|
205298
|
+
if (isError(error53, "NoSuchEntityException")) {
|
|
205299
|
+
return [];
|
|
205300
|
+
}
|
|
205301
|
+
throw error53;
|
|
205302
|
+
}
|
|
205303
|
+
}
|
|
205304
|
+
async createKey() {
|
|
205305
|
+
const result = await this.client.send(new CreateAccessKeyCommand({ UserName: this.userName }));
|
|
205306
|
+
const key = result.AccessKey;
|
|
205307
|
+
if (!key?.AccessKeyId || !key.SecretAccessKey) {
|
|
205308
|
+
throw new Error("IAM returned an access key without an id or secret.");
|
|
205309
|
+
}
|
|
205310
|
+
return { id: key.AccessKeyId, secret: key.SecretAccessKey };
|
|
205311
|
+
}
|
|
205312
|
+
async deleteKey(id) {
|
|
205313
|
+
await this.client.send(new DeleteAccessKeyCommand({ UserName: this.userName, AccessKeyId: id }));
|
|
205314
|
+
}
|
|
205315
|
+
async deleteUser() {
|
|
205316
|
+
try {
|
|
205317
|
+
await this.client.send(new GetUserCommand({ UserName: this.userName }));
|
|
205318
|
+
} catch (error53) {
|
|
205319
|
+
if (isError(error53, "NoSuchEntityException")) {
|
|
205320
|
+
return false;
|
|
205321
|
+
}
|
|
205322
|
+
throw error53;
|
|
205323
|
+
}
|
|
205324
|
+
for (const key of await this.listKeys()) {
|
|
205325
|
+
await this.deleteKey(key.id);
|
|
205326
|
+
}
|
|
205327
|
+
try {
|
|
205328
|
+
await this.client.send(new DeleteUserPolicyCommand({ UserName: this.userName, PolicyName: remoteAgentPolicyName }));
|
|
205329
|
+
} catch (error53) {
|
|
205330
|
+
if (!isError(error53, "NoSuchEntityException")) {
|
|
205331
|
+
throw error53;
|
|
205332
|
+
}
|
|
205333
|
+
}
|
|
205334
|
+
await this.client.send(new DeleteUserCommand({ UserName: this.userName }));
|
|
205335
|
+
return true;
|
|
205336
|
+
}
|
|
205337
|
+
}
|
|
205338
|
+
|
|
205339
|
+
// src/cli/command/remote-agent/credentials/shared.ts
|
|
205340
|
+
var createRemoteAgentIam = async (appConfig) => {
|
|
205341
|
+
const credentials2 = await getCredentials(appConfig.profile);
|
|
205342
|
+
const accountId = await getAccountId(credentials2, appConfig.region);
|
|
205343
|
+
const client2 = new IAMClient2({ region: appConfig.region, credentials: credentials2 });
|
|
205344
|
+
const iam = new RemoteAgentIam(client2, appConfig.name);
|
|
205345
|
+
const policy = buildRemoteAgentPolicy({
|
|
205346
|
+
appName: appConfig.name,
|
|
205347
|
+
region: appConfig.region,
|
|
205348
|
+
accountId,
|
|
205349
|
+
auth: Object.keys(appConfig.auth ?? {}).length > 0
|
|
205350
|
+
});
|
|
205351
|
+
return { iam, policy };
|
|
205352
|
+
};
|
|
205353
|
+
var ensureRemoteAgentUser = async (iam, policy) => {
|
|
205354
|
+
const user2 = await logs_exports.task({
|
|
205355
|
+
initialMessage: `Ensuring the ${iam.userName} IAM user...`,
|
|
205356
|
+
successMessage: `The ${iam.userName} IAM user is in place.`,
|
|
205357
|
+
errorMessage: `Failed to ensure the ${iam.userName} IAM user.`,
|
|
205358
|
+
task: () => iam.ensureUser()
|
|
205359
|
+
});
|
|
205360
|
+
const state = await logs_exports.task({
|
|
205361
|
+
initialMessage: "Ensuring the remote agent policy...",
|
|
205362
|
+
successMessage: "The remote agent policy is in place.",
|
|
205363
|
+
errorMessage: "Failed to ensure the remote agent policy.",
|
|
205364
|
+
task: () => iam.ensurePolicy(policy)
|
|
205365
|
+
});
|
|
205366
|
+
return { user: user2, policy: state };
|
|
205367
|
+
};
|
|
205368
|
+
var printCredentials = (appConfig, key) => {
|
|
205369
|
+
logs_exports.list("Remote agent environment", {
|
|
205370
|
+
AWSLESS_REMOTE_AGENT: "1",
|
|
205371
|
+
AWS_REGION: appConfig.region,
|
|
205372
|
+
AWS_ACCESS_KEY_ID: key.id,
|
|
205373
|
+
AWS_SECRET_ACCESS_KEY: key.secret
|
|
205374
|
+
});
|
|
205375
|
+
logs_exports.warning(`The secret access key is shown only once. Copy these variables into the agent environment now - ` + `run ${color2.info("awsless remote-agent credentials rotate")} to get a new one later.`);
|
|
205376
|
+
};
|
|
205377
|
+
|
|
205378
|
+
// src/cli/command/remote-agent/credentials/create.ts
|
|
205379
|
+
var create2 = (program3) => {
|
|
205380
|
+
program3.command("create").description("Create the IAM user & access key a remote agent needs to run the dev & test commands").action(async () => {
|
|
205381
|
+
await layout("remote-agent credentials create", async ({ appConfig }) => {
|
|
205382
|
+
const { iam, policy } = await createRemoteAgentIam(appConfig);
|
|
205383
|
+
await ensureRemoteAgentUser(iam, policy);
|
|
205384
|
+
const keys = await iam.listKeys();
|
|
205385
|
+
if (keys.length > 0) {
|
|
205386
|
+
const key2 = keys[0];
|
|
205387
|
+
const created = key2.createdAt ? ` created ${key2.createdAt.toISOString()}` : "";
|
|
205388
|
+
throw new ExpectedError(`The ${iam.userName} user already has an access key (${key2.id}${created}). ` + `Its secret can't be shown again - run ${color2.info("awsless remote-agent credentials rotate")} to replace it.`);
|
|
205389
|
+
}
|
|
205390
|
+
const key = await iam.createKey();
|
|
205391
|
+
printCredentials(appConfig, key);
|
|
205392
|
+
});
|
|
205393
|
+
});
|
|
205394
|
+
};
|
|
205395
|
+
|
|
205396
|
+
// src/cli/command/remote-agent/credentials/delete.ts
|
|
205397
|
+
var del5 = (program3) => {
|
|
205398
|
+
program3.command("delete").description("Delete the remote agent IAM user, its policy & access keys").action(async () => {
|
|
205399
|
+
await layout("remote-agent credentials delete", async ({ appConfig }) => {
|
|
205400
|
+
const { iam } = await createRemoteAgentIam(appConfig);
|
|
205401
|
+
const deleted = await logs_exports.task({
|
|
205402
|
+
initialMessage: `Deleting the ${iam.userName} IAM user...`,
|
|
205403
|
+
successMessage: `Deleted the ${iam.userName} IAM user.`,
|
|
205404
|
+
errorMessage: `Failed to delete the ${iam.userName} IAM user.`,
|
|
205405
|
+
task: () => iam.deleteUser()
|
|
205406
|
+
});
|
|
205407
|
+
if (!deleted) {
|
|
205408
|
+
logs_exports.info(`The ${iam.userName} IAM user doesn't exist - nothing to delete.`);
|
|
205409
|
+
}
|
|
205410
|
+
});
|
|
205411
|
+
});
|
|
205412
|
+
};
|
|
205413
|
+
|
|
205414
|
+
// src/cli/command/remote-agent/credentials/rotate.ts
|
|
205415
|
+
var rotate = (program3) => {
|
|
205416
|
+
program3.command("rotate").description("Replace the access key of the remote agent IAM user").action(async () => {
|
|
205417
|
+
await layout("remote-agent credentials rotate", async ({ appConfig }) => {
|
|
205418
|
+
const { iam, policy } = await createRemoteAgentIam(appConfig);
|
|
205419
|
+
await ensureRemoteAgentUser(iam, policy);
|
|
205420
|
+
const old = await iam.listKeys();
|
|
205421
|
+
const key = await iam.createKey();
|
|
205422
|
+
for (const entry of old) {
|
|
205423
|
+
await iam.deleteKey(entry.id);
|
|
205424
|
+
}
|
|
205425
|
+
if (old.length > 0) {
|
|
205426
|
+
logs_exports.info(`Deleted ${old.length} previous access key${old.length === 1 ? "" : "s"}.`);
|
|
205427
|
+
}
|
|
205428
|
+
printCredentials(appConfig, key);
|
|
205429
|
+
});
|
|
205430
|
+
});
|
|
205431
|
+
};
|
|
205432
|
+
|
|
205433
|
+
// src/cli/command/remote-agent/credentials/index.ts
|
|
205434
|
+
var commands10 = [create2, rotate, del5];
|
|
205435
|
+
var credentials2 = (program3) => {
|
|
205436
|
+
const command3 = program3.command("credentials").description("Manage the AWS credentials a remote agent uses for the dev & test commands");
|
|
205437
|
+
commands10.forEach((cb) => cb(command3));
|
|
205438
|
+
};
|
|
205439
|
+
|
|
205440
|
+
// src/cli/command/remote-agent/index.ts
|
|
205441
|
+
var commands11 = [credentials2];
|
|
205442
|
+
var remoteAgent = (program3) => {
|
|
205443
|
+
const command3 = program3.command("remote-agent").description("Manage the setup for remote agents, like the Claude cloud sandbox");
|
|
205444
|
+
commands11.forEach((cb) => cb(command3));
|
|
205445
|
+
};
|
|
205446
|
+
|
|
205180
205447
|
// src/cli/command/resources.ts
|
|
205181
205448
|
var import_wildstring4 = __toESM(require_wildstring(), 1);
|
|
205182
205449
|
import { DynamoDBClient as DynamoDBClient7 } from "@awsless/dynamodb";
|
|
@@ -205185,14 +205452,14 @@ var resources = (program3) => {
|
|
|
205185
205452
|
await layout("resources", async ({ appConfig, stackConfigs }) => {
|
|
205186
205453
|
const region = appConfig.region;
|
|
205187
205454
|
const profile = appConfig.profile;
|
|
205188
|
-
const
|
|
205189
|
-
const accountId = await getAccountId(
|
|
205190
|
-
const dynamo = new DynamoDBClient7({ credentials:
|
|
205455
|
+
const credentials3 = await getCredentials(profile);
|
|
205456
|
+
const accountId = await getAccountId(credentials3, region);
|
|
205457
|
+
const dynamo = new DynamoDBClient7({ credentials: credentials3, region });
|
|
205191
205458
|
const deployment = await currentDeployment(dynamo, generateGlobalAppId({ accountId, region, appName: appConfig.name }));
|
|
205192
205459
|
const { app, ready: ready2 } = createApp({ appConfig, stackConfigs, accountId, deploymentId: deployment?.id });
|
|
205193
205460
|
ready2();
|
|
205194
205461
|
const { workspace } = await createWorkSpace({
|
|
205195
|
-
credentials:
|
|
205462
|
+
credentials: credentials3,
|
|
205196
205463
|
accountId,
|
|
205197
205464
|
region
|
|
205198
205465
|
});
|
|
@@ -206349,8 +206616,8 @@ var getHttpAuthExtensionConfiguration3 = (runtimeConfig) => {
|
|
|
206349
206616
|
httpAuthSchemeProvider() {
|
|
206350
206617
|
return _httpAuthSchemeProvider;
|
|
206351
206618
|
},
|
|
206352
|
-
setCredentials(
|
|
206353
|
-
_credentials =
|
|
206619
|
+
setCredentials(credentials3) {
|
|
206620
|
+
_credentials = credentials3;
|
|
206354
206621
|
},
|
|
206355
206622
|
credentials() {
|
|
206356
206623
|
return _credentials;
|
|
@@ -206777,7 +207044,7 @@ var sinon;
|
|
|
206777
207044
|
return;
|
|
206778
207045
|
}
|
|
206779
207046
|
const proto2 = {
|
|
206780
|
-
create: function
|
|
207047
|
+
create: function create3(stub) {
|
|
206781
207048
|
const behavior = extend2({}, proto2);
|
|
206782
207049
|
delete behavior.create;
|
|
206783
207050
|
delete behavior.addBehavior;
|
|
@@ -207386,7 +207653,7 @@ var sinon;
|
|
|
207386
207653
|
const mockExpectation = {
|
|
207387
207654
|
minCalls: 1,
|
|
207388
207655
|
maxCalls: 1,
|
|
207389
|
-
create: function
|
|
207656
|
+
create: function create3(methodName) {
|
|
207390
207657
|
const expectation = extend2.nonEnum(stub(), mockExpectation);
|
|
207391
207658
|
delete expectation.create;
|
|
207392
207659
|
expectation.method = methodName;
|
|
@@ -207579,7 +207846,7 @@ var sinon;
|
|
|
207579
207846
|
});
|
|
207580
207847
|
}
|
|
207581
207848
|
extend2(mock, {
|
|
207582
|
-
create: function
|
|
207849
|
+
create: function create3(object3) {
|
|
207583
207850
|
if (!object3) {
|
|
207584
207851
|
throw new TypeError("object is null");
|
|
207585
207852
|
}
|
|
@@ -218786,21 +219053,21 @@ var run = (program3) => {
|
|
|
218786
219053
|
program3.command("run").allowUnknownOption(true).argument("[command]", "The command you want to run").description("Run one of your defined commands.").action(async (selected) => {
|
|
218787
219054
|
await layout(`run ${selected ?? ""}`, async ({ appConfig, stackConfigs }) => {
|
|
218788
219055
|
const region = appConfig.region;
|
|
218789
|
-
const
|
|
218790
|
-
const accountId = await getAccountId(
|
|
218791
|
-
const { commands:
|
|
219056
|
+
const credentials3 = await getCredentials(appConfig.profile);
|
|
219057
|
+
const accountId = await getAccountId(credentials3, region);
|
|
219058
|
+
const { commands: commands12, appId } = createApp({ appConfig, stackConfigs, accountId });
|
|
218792
219059
|
let command3;
|
|
218793
219060
|
if (selected) {
|
|
218794
|
-
command3 =
|
|
219061
|
+
command3 = commands12.find((cmd) => {
|
|
218795
219062
|
return cmd.name === selected;
|
|
218796
219063
|
});
|
|
218797
219064
|
} else if (process.env.SKIP_PROMPT) {
|
|
218798
|
-
throw new ExpectedError(`Pass the command argument when running with --skip-prompt: [ ${
|
|
219065
|
+
throw new ExpectedError(`Pass the command argument when running with --skip-prompt: [ ${commands12.map((cmd) => cmd.name).join(", ")} ]`);
|
|
218799
219066
|
} else {
|
|
218800
219067
|
command3 = await prompts_exports.select({
|
|
218801
219068
|
message: "Pick the command you want to run:",
|
|
218802
|
-
initialValue:
|
|
218803
|
-
options:
|
|
219069
|
+
initialValue: commands12[0],
|
|
219070
|
+
options: commands12.map((cmd) => ({
|
|
218804
219071
|
value: cmd,
|
|
218805
219072
|
label: cmd.name,
|
|
218806
219073
|
hint: cmd.description
|
|
@@ -218824,15 +219091,15 @@ var run = (program3) => {
|
|
|
218824
219091
|
if (!handler) {
|
|
218825
219092
|
throw new ExpectedError(`No "${command3.handler}" handler found.`);
|
|
218826
219093
|
}
|
|
218827
|
-
dynamoDBClient.set(new DynamoDBClient8({ region, credentials:
|
|
218828
|
-
lambdaClient.set(new LambdaClient7({ region, credentials:
|
|
218829
|
-
snsClient.set(new SNSClient2({ region, credentials:
|
|
218830
|
-
iotClient.set(new IoTDataPlaneClient({ region, credentials:
|
|
218831
|
-
sqsClient.set(new SQSClient({ region, credentials:
|
|
218832
|
-
s3Client.set(new S3Client8({ region, credentials:
|
|
219094
|
+
dynamoDBClient.set(new DynamoDBClient8({ region, credentials: credentials3 }));
|
|
219095
|
+
lambdaClient.set(new LambdaClient7({ region, credentials: credentials3 }));
|
|
219096
|
+
snsClient.set(new SNSClient2({ region, credentials: credentials3 }));
|
|
219097
|
+
iotClient.set(new IoTDataPlaneClient({ region, credentials: credentials3 }));
|
|
219098
|
+
sqsClient.set(new SQSClient({ region, credentials: credentials3 }));
|
|
219099
|
+
s3Client.set(new S3Client8({ region, credentials: credentials3 }));
|
|
218833
219100
|
await handler({
|
|
218834
219101
|
region,
|
|
218835
|
-
credentials:
|
|
219102
|
+
credentials: credentials3,
|
|
218836
219103
|
accountId
|
|
218837
219104
|
});
|
|
218838
219105
|
});
|
|
@@ -218845,10 +219112,10 @@ var pull = (program3) => {
|
|
|
218845
219112
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
218846
219113
|
const region = appConfig.region;
|
|
218847
219114
|
const profile = appConfig.profile;
|
|
218848
|
-
const
|
|
218849
|
-
const accountId = await getAccountId(
|
|
219115
|
+
const credentials3 = await getCredentials(profile);
|
|
219116
|
+
const accountId = await getAccountId(credentials3, region);
|
|
218850
219117
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
218851
|
-
const { state } = await createWorkSpace({ credentials:
|
|
219118
|
+
const { state } = await createWorkSpace({ credentials: credentials3, region, accountId });
|
|
218852
219119
|
await pullRemoteState(app, state);
|
|
218853
219120
|
return "State pull was successful.";
|
|
218854
219121
|
});
|
|
@@ -218861,10 +219128,10 @@ var push2 = (program3) => {
|
|
|
218861
219128
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
218862
219129
|
const region = appConfig.region;
|
|
218863
219130
|
const profile = appConfig.profile;
|
|
218864
|
-
const
|
|
218865
|
-
const accountId = await getAccountId(
|
|
219131
|
+
const credentials3 = await getCredentials(profile);
|
|
219132
|
+
const accountId = await getAccountId(credentials3, region);
|
|
218866
219133
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
218867
|
-
const { state } = await createWorkSpace({ credentials:
|
|
219134
|
+
const { state } = await createWorkSpace({ credentials: credentials3, region, accountId });
|
|
218868
219135
|
if (!process.env.SKIP_PROMPT) {
|
|
218869
219136
|
const ok2 = await prompts_exports.confirm({
|
|
218870
219137
|
message: "Pushing up the local state might corrupt your remote state. Are you sure?",
|
|
@@ -220836,10 +221103,10 @@ var refresh2 = (program3) => {
|
|
|
220836
221103
|
await layout("state refresh", async ({ appConfig, stackConfigs }) => {
|
|
220837
221104
|
const region = appConfig.region;
|
|
220838
221105
|
const profile = appConfig.profile;
|
|
220839
|
-
const
|
|
220840
|
-
const accountId = await getAccountId(
|
|
221106
|
+
const credentials3 = await getCredentials(profile);
|
|
221107
|
+
const accountId = await getAccountId(credentials3, region);
|
|
220841
221108
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
220842
|
-
const { workspace } = await createWorkSpace({ credentials:
|
|
221109
|
+
const { workspace } = await createWorkSpace({ credentials: credentials3, region, accountId });
|
|
220843
221110
|
const stackNames = app.stacks.filter((stack) => {
|
|
220844
221111
|
return !!filters.find((f4) => import_wildstring5.default.match(f4, stack.name));
|
|
220845
221112
|
}).map((s2) => s2.name);
|
|
@@ -220930,10 +221197,10 @@ var unlock2 = (program3) => {
|
|
|
220930
221197
|
await layout("state unlock", async ({ appConfig, stackConfigs }) => {
|
|
220931
221198
|
const region = appConfig.region;
|
|
220932
221199
|
const profile = appConfig.profile;
|
|
220933
|
-
const
|
|
220934
|
-
const accountId = await getAccountId(
|
|
221200
|
+
const credentials3 = await getCredentials(profile);
|
|
221201
|
+
const accountId = await getAccountId(credentials3, region);
|
|
220935
221202
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
220936
|
-
const { lock: lock2 } = createDeploymentBackends({ credentials:
|
|
221203
|
+
const { lock: lock2 } = createDeploymentBackends({ credentials: credentials3, region, accountId });
|
|
220937
221204
|
const releaseUrn = getAppReleaseLockUrn(generateGlobalAppId({ accountId, region, appName: appConfig.name }));
|
|
220938
221205
|
const lockedUrns = [];
|
|
220939
221206
|
for (const urn of [app.urn, releaseUrn]) {
|
|
@@ -220962,10 +221229,10 @@ var unlock2 = (program3) => {
|
|
|
220962
221229
|
};
|
|
220963
221230
|
|
|
220964
221231
|
// src/cli/command/state/index.ts
|
|
220965
|
-
var
|
|
221232
|
+
var commands12 = [pull, push2, unlock2, refresh2];
|
|
220966
221233
|
var state = (program3) => {
|
|
220967
221234
|
const command3 = program3.command("state").description(`Manage app state`);
|
|
220968
|
-
|
|
221235
|
+
commands12.forEach((cb) => cb(command3));
|
|
220969
221236
|
};
|
|
220970
221237
|
|
|
220971
221238
|
// src/cli/command/test.ts
|
|
@@ -221010,7 +221277,7 @@ var types2 = (program3) => {
|
|
|
221010
221277
|
};
|
|
221011
221278
|
|
|
221012
221279
|
// src/cli/command/index.ts
|
|
221013
|
-
var
|
|
221280
|
+
var commands13 = [
|
|
221014
221281
|
bootstrap,
|
|
221015
221282
|
types2,
|
|
221016
221283
|
build2,
|
|
@@ -221028,6 +221295,7 @@ var commands11 = [
|
|
|
221028
221295
|
state,
|
|
221029
221296
|
resources,
|
|
221030
221297
|
config3,
|
|
221298
|
+
remoteAgent,
|
|
221031
221299
|
test2,
|
|
221032
221300
|
cron,
|
|
221033
221301
|
image,
|
|
@@ -221047,10 +221315,13 @@ program2.exitOverride((error53) => {
|
|
|
221047
221315
|
program2.on("option:skip-prompt", () => {
|
|
221048
221316
|
process.env.SKIP_PROMPT = program2.opts().skipPrompt ? "1" : undefined;
|
|
221049
221317
|
});
|
|
221318
|
+
if (isRemoteAgent()) {
|
|
221319
|
+
process.env.SKIP_PROMPT = "1";
|
|
221320
|
+
}
|
|
221050
221321
|
program2.on("option:no-cache", () => {
|
|
221051
221322
|
process.env.NO_CACHE = program2.opts().cache === false ? "1" : undefined;
|
|
221052
221323
|
});
|
|
221053
|
-
|
|
221324
|
+
commands13.forEach((fn) => fn(program2));
|
|
221054
221325
|
|
|
221055
221326
|
// src/bin.ts
|
|
221056
221327
|
clearDebugLog();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/awsless/awsless/issues"
|
|
6
6
|
},
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@aws-sdk/client-cloudwatch-logs": "3.1113.0",
|
|
30
30
|
"@aws-sdk/client-cognito-identity-provider": "3.1113.0",
|
|
31
31
|
"@aws-sdk/client-dynamodb": "3.1113.0",
|
|
32
|
+
"@aws-sdk/client-iam": "3.1113.0",
|
|
32
33
|
"@aws-sdk/client-lambda": "3.1113.0",
|
|
33
34
|
"@aws-sdk/client-route-53": "3.1113.0",
|
|
34
35
|
"@aws-sdk/client-s3": "3.1113.0",
|
|
@@ -81,33 +82,34 @@
|
|
|
81
82
|
"wildstring": "1.0.9",
|
|
82
83
|
"wrap-ansi": "10.0.1",
|
|
83
84
|
"zod": "4.4.3",
|
|
84
|
-
"@awsless/big-float": "^0.1.8",
|
|
85
85
|
"@awsless/cloudwatch": "^0.0.2",
|
|
86
|
+
"@awsless/big-float": "^0.1.8",
|
|
86
87
|
"@awsless/duration": "^0.0.4",
|
|
87
|
-
"@awsless/dynamodb": "^0.3.28",
|
|
88
88
|
"@awsless/clui": "^0.0.10",
|
|
89
|
+
"@awsless/dynamodb": "^0.3.28",
|
|
89
90
|
"@awsless/dynamodb-server": "^0.1.11",
|
|
91
|
+
"@awsless/iot": "^0.0.6",
|
|
90
92
|
"@awsless/json": "^0.0.12",
|
|
93
|
+
"@awsless/lambda": "^0.0.50",
|
|
91
94
|
"@awsless/open-search": "^0.0.32",
|
|
92
95
|
"@awsless/open-search-server": "^0.0.1",
|
|
93
|
-
"@awsless/iot": "^0.0.6",
|
|
94
|
-
"@awsless/lambda": "^0.0.50",
|
|
95
|
-
"@awsless/redis-server": "^0.1.0",
|
|
96
96
|
"@awsless/redis": "^0.1.15",
|
|
97
97
|
"@awsless/s3": "^0.0.23",
|
|
98
|
-
"@awsless/
|
|
98
|
+
"@awsless/redis-server": "^0.1.0",
|
|
99
99
|
"@awsless/size": "^0.0.3",
|
|
100
|
-
"awsless": "^0.1.11",
|
|
101
100
|
"@awsless/sns": "^0.0.12",
|
|
101
|
+
"@awsless/ts-file-cache": "^0.0.22",
|
|
102
102
|
"@awsless/sqs": "^0.0.25",
|
|
103
103
|
"@awsless/validate": "^0.2.1",
|
|
104
|
-
"@awsless/weak-cache": "^0.0.2"
|
|
104
|
+
"@awsless/weak-cache": "^0.0.2",
|
|
105
|
+
"awsless": "^0.1.11"
|
|
105
106
|
},
|
|
106
107
|
"peerDependencies": {
|
|
107
108
|
"@aws-sdk/client-cloudfront-keyvaluestore": "3.1113.0",
|
|
108
109
|
"@aws-sdk/client-cloudwatch-logs": "3.1113.0",
|
|
109
110
|
"@aws-sdk/client-cognito-identity-provider": "3.1113.0",
|
|
110
111
|
"@aws-sdk/client-dynamodb": "3.1113.0",
|
|
112
|
+
"@aws-sdk/client-iam": "3.1113.0",
|
|
111
113
|
"@aws-sdk/client-lambda": "3.1113.0",
|
|
112
114
|
"@aws-sdk/client-route-53": "3.1113.0",
|
|
113
115
|
"@aws-sdk/client-s3": "3.1113.0",
|
|
@@ -118,17 +120,17 @@
|
|
|
118
120
|
"@aws-sdk/credential-providers": "3.1113.0",
|
|
119
121
|
"@aws-sdk/lib-dynamodb": "3.1113.0",
|
|
120
122
|
"@opensearch-project/opensearch": "3.6.0",
|
|
123
|
+
"@awsless/big-float": "^0.1.8",
|
|
121
124
|
"@awsless/duration": "^0.0.4",
|
|
122
125
|
"@awsless/dynamodb": "^0.3.28",
|
|
123
|
-
"@awsless/big-float": "^0.1.8",
|
|
124
|
-
"@awsless/lambda": "^0.0.50",
|
|
125
126
|
"@awsless/json": "^0.0.12",
|
|
126
|
-
"@awsless/
|
|
127
|
-
"@awsless/ts-file-cache": "^0.0.22",
|
|
127
|
+
"@awsless/lambda": "^0.0.50",
|
|
128
128
|
"@awsless/dynamodb-server": "^0.1.11",
|
|
129
|
+
"@awsless/ts-file-cache": "^0.0.22",
|
|
129
130
|
"@awsless/weak-cache": "^0.0.2",
|
|
130
131
|
"awsless": "^0.1.11",
|
|
131
|
-
"@awsless/s3": "^0.0.23"
|
|
132
|
+
"@awsless/s3": "^0.0.23",
|
|
133
|
+
"@awsless/validate": "^0.2.1"
|
|
132
134
|
},
|
|
133
135
|
"scripts": {
|
|
134
136
|
"test": "bun cli/build-handlers.ts && pnpm vitest run",
|