thinkwork-cli 0.4.0 → 0.4.1

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 (2) hide show
  1. package/dist/cli.js +32 -65
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1372,6 +1372,36 @@ function discoverAwsStages(region) {
1372
1372
  }
1373
1373
  return stages;
1374
1374
  }
1375
+ function printStageDetail(info) {
1376
+ console.log(chalk6.bold.cyan(` \u2B21 ${info.stage}`));
1377
+ console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1378
+ console.log(` ${chalk6.bold("Source:")} ${info.source === "both" ? "AWS + local config" : info.source === "aws" ? "AWS (no local config)" : "local only (not in AWS)"}`);
1379
+ console.log(` ${chalk6.bold("Region:")} ${info.region}`);
1380
+ console.log(` ${chalk6.bold("Account:")} ${info.accountId}`);
1381
+ console.log(` ${chalk6.bold("Lambda fns:")} ${info.lambdaCount || "\u2014"}`);
1382
+ console.log(` ${chalk6.bold("AgentCore:")} ${info.agentcoreStatus || "unknown"}`);
1383
+ console.log(` ${chalk6.bold("Memory:")} ${info.memoryEngine || "unknown"}`);
1384
+ if (info.hindsightHealth) console.log(` ${chalk6.bold("Hindsight:")} ${info.hindsightHealth}`);
1385
+ if (info.bucketName) console.log(` ${chalk6.bold("S3 bucket:")} ${info.bucketName}`);
1386
+ if (info.dbEndpoint) console.log(` ${chalk6.bold("Database:")} ${info.dbEndpoint}`);
1387
+ if (info.ecrUrl) console.log(` ${chalk6.bold("ECR:")} ${info.ecrUrl}`);
1388
+ console.log("");
1389
+ console.log(chalk6.bold(" URLs:"));
1390
+ if (info.adminUrl) console.log(` Admin: ${link(info.adminUrl)}`);
1391
+ if (info.docsUrl) console.log(` Docs: ${link(info.docsUrl)}`);
1392
+ if (info.apiEndpoint) console.log(` API: ${link(info.apiEndpoint)}`);
1393
+ if (info.appsyncApiUrl) console.log(` AppSync: ${link(info.appsyncApiUrl)}`);
1394
+ if (info.appsyncUrl) console.log(` WebSocket: ${link(info.appsyncUrl)}`);
1395
+ if (info.hindsightEndpoint) console.log(` Hindsight: ${link(info.hindsightEndpoint)}`);
1396
+ console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1397
+ const local = loadEnvironment(info.stage);
1398
+ if (local) {
1399
+ console.log(chalk6.dim(` Terraform dir: ${local.terraformDir}`));
1400
+ } else {
1401
+ console.log(chalk6.dim(` No local config. Run: thinkwork init -s ${info.stage}`));
1402
+ }
1403
+ console.log("");
1404
+ }
1375
1405
  function registerStatusCommand(program2) {
1376
1406
  program2.command("status").description("Show all Thinkwork environments (AWS + local)").option("-s, --stage <name>", "Show details for a specific stage").option("--region <region>", "AWS region to scan", "us-east-1").action(async (opts) => {
1377
1407
  const identity = getAwsIdentity();
@@ -1410,34 +1440,7 @@ function registerStatusCommand(program2) {
1410
1440
  printError(`No environment "${opts.stage}" found in AWS or local config.`);
1411
1441
  process.exit(1);
1412
1442
  }
1413
- console.log(chalk6.bold.cyan(` \u2B21 ${info.stage}`));
1414
- console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1415
- console.log(` ${chalk6.bold("Source:")} ${info.source === "both" ? "AWS + local config" : info.source === "aws" ? "AWS (no local config)" : "local only (not in AWS)"}`);
1416
- console.log(` ${chalk6.bold("Region:")} ${info.region}`);
1417
- console.log(` ${chalk6.bold("Account:")} ${info.accountId}`);
1418
- console.log(` ${chalk6.bold("Lambda fns:")} ${info.lambdaCount || "\u2014"}`);
1419
- console.log(` ${chalk6.bold("AgentCore:")} ${info.agentcoreStatus || "unknown"}`);
1420
- console.log(` ${chalk6.bold("Memory:")} ${info.memoryEngine || "unknown"}`);
1421
- if (info.hindsightHealth) console.log(` ${chalk6.bold("Hindsight:")} ${info.hindsightHealth}`);
1422
- if (info.bucketName) console.log(` ${chalk6.bold("S3 bucket:")} ${info.bucketName}`);
1423
- if (info.dbEndpoint) console.log(` ${chalk6.bold("Database:")} ${info.dbEndpoint}`);
1424
- if (info.ecrUrl) console.log(` ${chalk6.bold("ECR:")} ${info.ecrUrl}`);
1425
- console.log("");
1426
- console.log(chalk6.bold(" URLs:"));
1427
- if (info.adminUrl) console.log(` Admin: ${link(info.adminUrl)}`);
1428
- if (info.docsUrl) console.log(` Docs: ${link(info.docsUrl)}`);
1429
- if (info.apiEndpoint) console.log(` API: ${link(info.apiEndpoint)}`);
1430
- if (info.appsyncApiUrl) console.log(` AppSync: ${link(info.appsyncApiUrl)}`);
1431
- if (info.appsyncUrl) console.log(` WebSocket: ${link(info.appsyncUrl)}`);
1432
- if (info.hindsightEndpoint) console.log(` Hindsight: ${link(info.hindsightEndpoint)}`);
1433
- console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1434
- const local = loadEnvironment(opts.stage);
1435
- if (local) {
1436
- console.log(chalk6.dim(` Terraform dir: ${local.terraformDir}`));
1437
- } else {
1438
- console.log(chalk6.dim(` No local config. Run: thinkwork init -s ${opts.stage}`));
1439
- }
1440
- console.log("");
1443
+ printStageDetail(info);
1441
1444
  return;
1442
1445
  }
1443
1446
  if (merged.size === 0) {
@@ -1446,45 +1449,9 @@ function registerStatusCommand(program2) {
1446
1449
  console.log("");
1447
1450
  return;
1448
1451
  }
1449
- const COL1 = 16;
1450
- const COL2 = 10;
1451
- const COL3 = 10;
1452
- const COL4 = 14;
1453
- const COL5 = 14;
1454
- const pad = " ".repeat(2 + 2 + COL1 + COL2 + COL3 + COL4 + COL5);
1455
- console.log(chalk6.bold(" Environments"));
1456
- console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1457
- console.log(
1458
- chalk6.dim(" ") + "Stage".padEnd(COL1) + "Source".padEnd(COL2) + "Lambdas".padEnd(COL3) + "AgentCore".padEnd(COL4) + "Memory".padEnd(COL5) + "URLs"
1459
- );
1460
- console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1461
1452
  for (const [, info] of [...merged].sort((a, b) => a[0].localeCompare(b[0]))) {
1462
- const sourceBadge = info.source === "both" ? chalk6.green("\u25CF") : info.source === "aws" ? chalk6.yellow("\u25CF") : chalk6.dim("\u25CB");
1463
- const acStatus = info.agentcoreStatus === "Active" ? chalk6.green("active") : info.agentcoreStatus === "not deployed" ? chalk6.dim("\u2014") : chalk6.yellow(info.agentcoreStatus || "\u2014");
1464
- const memBadge = info.memoryEngine === "hindsight" ? info.hindsightHealth === "healthy" ? chalk6.magenta("hindsight \u2713") : chalk6.yellow("hindsight ?") : chalk6.dim(info.memoryEngine || "\u2014");
1465
- const prefix = ` ${sourceBadge} ` + chalk6.bold(info.stage.padEnd(COL1 - 1)) + " " + (info.source === "both" ? "aws+cli" : info.source).padEnd(COL2) + String(info.lambdaCount || "\u2014").padEnd(COL3);
1466
- const urls = [];
1467
- if (info.adminUrl) urls.push(`Admin: ${link(info.adminUrl, info.adminUrl)}`);
1468
- if (info.docsUrl) urls.push(`Docs: ${link(info.docsUrl, info.docsUrl)}`);
1469
- if (info.apiEndpoint) urls.push(`API: ${link(info.apiEndpoint, info.apiEndpoint)}`);
1470
- if (info.appsyncUrl) urls.push(`WS: ${link(info.appsyncUrl, info.appsyncUrl.replace("wss://", "").split(".")[0] + "...")}`);
1471
- if (info.hindsightEndpoint) urls.push(`Mem: ${link(info.hindsightEndpoint, info.hindsightEndpoint)}`);
1472
- if (urls.length === 0) {
1473
- console.log(prefix + acStatus.padEnd(22) + memBadge.padEnd(22) + chalk6.dim("\u2014"));
1474
- } else {
1475
- console.log(prefix + acStatus.padEnd(22) + memBadge.padEnd(22) + chalk6.dim(urls[0]));
1476
- for (let i = 1; i < urls.length; i++) {
1477
- console.log(pad + chalk6.dim(urls[i]));
1478
- }
1479
- }
1453
+ printStageDetail(info);
1480
1454
  }
1481
- console.log(chalk6.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
1482
- console.log(
1483
- chalk6.dim(` ${merged.size} environment(s) `) + chalk6.green("\u25CF") + chalk6.dim(" aws+cli ") + chalk6.yellow("\u25CF") + chalk6.dim(" aws only ") + chalk6.dim("\u25CB local only")
1484
- );
1485
- console.log("");
1486
- console.log(` Details: ${chalk6.cyan("thinkwork status -s <stage>")}`);
1487
- console.log("");
1488
1455
  });
1489
1456
  }
1490
1457
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkwork-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Thinkwork CLI — deploy, manage, and interact with your Thinkwork stack",
5
5
  "license": "MIT",
6
6
  "type": "module",