@aws/nx-plugin 1.2.0 → 1.3.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.
- package/LICENSE-THIRD-PARTY +107 -259
- package/README.md +1 -0
- package/generators.json +8 -0
- package/migrations.json +53 -10
- package/package.json +14 -14
- package/src/agentcore-gateway/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/greengrass/component/python/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/internal/test-matrix/generator.js +6 -1
- package/src/internal/test-matrix/generator.js.map +1 -1
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/metadata.json +3 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.d.ts +6 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.js +113 -0
- package/src/migrations/latest/biome-markdown-yaml-formatter-off/migration.js.map +1 -0
- package/src/migrations/v1.0.15/0001-py-agent-pillow-override/migration.js.map +1 -0
- package/src/migrations/v1.1.1/0001-ts-agent-guardrails-synth-input/migration.js.map +1 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/metadata.json +3 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.d.ts +6 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.js +118 -0
- package/src/migrations/v1.3.0/0001-ts-agent-guardrails-terraform-version-retention/migration.js.map +1 -0
- package/src/preset/__snapshots__/generator.spec.ts.snap +17 -5
- package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
- package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +7 -7
- package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +4 -4
- package/src/py/agent/guardrails/__snapshots__/generator.spec.ts.snap +3813 -0
- package/src/py/agent/guardrails/files/langchain/guardrail.py.template +135 -0
- package/src/py/agent/guardrails/files/strands/guardrail.py.template +93 -0
- package/src/py/agent/guardrails/generator.d.ts +10 -0
- package/src/py/agent/guardrails/generator.js +175 -0
- package/src/py/agent/guardrails/generator.js.map +1 -0
- package/src/py/agent/guardrails/runtime-check/run_checks.py +250 -0
- package/src/py/agent/guardrails/schema.d.js +6 -0
- package/src/py/agent/guardrails/schema.d.js.map +1 -0
- package/src/py/agent/guardrails/schema.d.ts +9 -0
- package/src/py/agent/guardrails/schema.json +25 -0
- package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
- package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/py/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/sdk/py.d.ts +2 -0
- package/src/sdk/py.js +1 -0
- package/src/sdk/py.js.map +1 -1
- package/src/smithy/project/__snapshots__/generator.spec.ts.snap +5 -5
- package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +8 -8
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
- package/src/ts/agent/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/ts/agent/guardrails/__snapshots__/generator.spec.ts.snap +57 -6
- package/src/ts/agent/guardrails/generator.js +2 -1
- package/src/ts/agent/guardrails/generator.js.map +1 -1
- package/src/ts/dcr-proxy/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +2 -2
- package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +4 -4
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +53 -33
- package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
- package/src/utils/format.d.ts +10 -0
- package/src/utils/format.js +11 -0
- package/src/utils/format.js.map +1 -1
- package/src/utils/guardrail-constructs/files/terraform/app/guardrails/__nameKebabCase__/__nameKebabCase__-guardrail.tf.template +18 -1
- package/src/utils/guardrail-constructs/guardrail-constructs.d.ts +5 -0
- package/src/utils/guardrail-constructs/guardrail-constructs.js +8 -0
- package/src/utils/guardrail-constructs/guardrail-constructs.js.map +1 -1
- package/src/utils/guardrail-constructs/guardrail-wiring.d.ts +7 -0
- package/src/utils/guardrail-constructs/guardrail-wiring.js +6 -5
- package/src/utils/guardrail-constructs/guardrail-wiring.js.map +1 -1
- package/src/utils/test/fake-aws/fake_aws.py +205 -0
- package/src/utils/test/python-dependencies.d.ts +6 -0
- package/src/utils/test/python-dependencies.js +19 -0
- package/src/utils/test/python-dependencies.js.map +1 -1
- package/src/utils/test/warm-python-cache.js +5 -1
- package/src/utils/test/warm-python-cache.js.map +1 -1
- package/src/utils/version-upgrade-migration/sync-vended-versions.d.ts +8 -0
- package/src/utils/version-upgrade-migration/sync-vended-versions.js +11 -2
- package/src/utils/version-upgrade-migration/sync-vended-versions.js.map +1 -1
- package/src/utils/versions.d.ts +71 -71
- package/src/utils/versions.js +68 -68
- package/src/utils/versions.js.map +1 -1
- package/src/migrations/latest/py-agent-pillow-override/migration.js.map +0 -1
- package/src/migrations/latest/ts-agent-guardrails-synth-input/migration.js.map +0 -1
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/metadata.json +0 -0
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/migration.d.ts +0 -0
- /package/src/migrations/{latest/py-agent-pillow-override → v1.0.15/0001-py-agent-pillow-override}/migration.js +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/metadata.json +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/migration.d.ts +0 -0
- /package/src/migrations/{latest/ts-agent-guardrails-synth-input → v1.1.1/0001-ts-agent-guardrails-synth-input}/migration.js +0 -0
- /package/src/{ts/agent/guardrails/files/agent → utils/guardrail-constructs/files/policy}/guardrail.json.template +0 -0
|
@@ -3223,7 +3223,7 @@ terraform {
|
|
|
3223
3223
|
required_providers {
|
|
3224
3224
|
aws = {
|
|
3225
3225
|
source = "hashicorp/aws"
|
|
3226
|
-
version = "6.
|
|
3226
|
+
version = "6.70.0"
|
|
3227
3227
|
}
|
|
3228
3228
|
}
|
|
3229
3229
|
}
|
|
@@ -3474,7 +3474,7 @@ output "api_log_group_arn" {
|
|
|
3474
3474
|
}
|
|
3475
3475
|
aws = {
|
|
3476
3476
|
source = "hashicorp/aws"
|
|
3477
|
-
version = "6.
|
|
3477
|
+
version = "6.70.0"
|
|
3478
3478
|
}
|
|
3479
3479
|
random = {
|
|
3480
3480
|
source = "hashicorp/random"
|
|
@@ -4100,7 +4100,7 @@ terraform {
|
|
|
4100
4100
|
required_providers {
|
|
4101
4101
|
aws = {
|
|
4102
4102
|
source = "hashicorp/aws"
|
|
4103
|
-
version = "6.
|
|
4103
|
+
version = "6.70.0"
|
|
4104
4104
|
}
|
|
4105
4105
|
}
|
|
4106
4106
|
}
|
|
@@ -4351,7 +4351,7 @@ output "api_log_group_arn" {
|
|
|
4351
4351
|
}
|
|
4352
4352
|
aws = {
|
|
4353
4353
|
source = "hashicorp/aws"
|
|
4354
|
-
version = "6.
|
|
4354
|
+
version = "6.70.0"
|
|
4355
4355
|
}
|
|
4356
4356
|
random = {
|
|
4357
4357
|
source = "hashicorp/random"
|
|
@@ -5050,7 +5050,7 @@ terraform {
|
|
|
5050
5050
|
required_providers {
|
|
5051
5051
|
aws = {
|
|
5052
5052
|
source = "hashicorp/aws"
|
|
5053
|
-
version = "6.
|
|
5053
|
+
version = "6.70.0"
|
|
5054
5054
|
}
|
|
5055
5055
|
}
|
|
5056
5056
|
}
|
|
@@ -5301,7 +5301,7 @@ output "api_log_group_arn" {
|
|
|
5301
5301
|
}
|
|
5302
5302
|
aws = {
|
|
5303
5303
|
source = "hashicorp/aws"
|
|
5304
|
-
version = "6.
|
|
5304
|
+
version = "6.70.0"
|
|
5305
5305
|
}
|
|
5306
5306
|
random = {
|
|
5307
5307
|
source = "hashicorp/random"
|
|
@@ -5904,7 +5904,7 @@ terraform {
|
|
|
5904
5904
|
required_providers {
|
|
5905
5905
|
aws = {
|
|
5906
5906
|
source = "hashicorp/aws"
|
|
5907
|
-
version = "6.
|
|
5907
|
+
version = "6.70.0"
|
|
5908
5908
|
}
|
|
5909
5909
|
random = {
|
|
5910
5910
|
source = "hashicorp/random"
|
|
@@ -6217,7 +6217,7 @@ output "waf_web_acl_arn" {
|
|
|
6217
6217
|
}
|
|
6218
6218
|
aws = {
|
|
6219
6219
|
source = "hashicorp/aws"
|
|
6220
|
-
version = "6.
|
|
6220
|
+
version = "6.70.0"
|
|
6221
6221
|
}
|
|
6222
6222
|
random = {
|
|
6223
6223
|
source = "hashicorp/random"
|
|
@@ -7280,7 +7280,7 @@ terraform {
|
|
|
7280
7280
|
required_providers {
|
|
7281
7281
|
aws = {
|
|
7282
7282
|
source = "hashicorp/aws"
|
|
7283
|
-
version = "6.
|
|
7283
|
+
version = "6.70.0"
|
|
7284
7284
|
}
|
|
7285
7285
|
random = {
|
|
7286
7286
|
source = "hashicorp/random"
|
|
@@ -7593,7 +7593,7 @@ output "waf_web_acl_arn" {
|
|
|
7593
7593
|
}
|
|
7594
7594
|
aws = {
|
|
7595
7595
|
source = "hashicorp/aws"
|
|
7596
|
-
version = "6.
|
|
7596
|
+
version = "6.70.0"
|
|
7597
7597
|
}
|
|
7598
7598
|
random = {
|
|
7599
7599
|
source = "hashicorp/random"
|
|
@@ -8645,7 +8645,7 @@ terraform {
|
|
|
8645
8645
|
required_providers {
|
|
8646
8646
|
aws = {
|
|
8647
8647
|
source = "hashicorp/aws"
|
|
8648
|
-
version = "6.
|
|
8648
|
+
version = "6.70.0"
|
|
8649
8649
|
}
|
|
8650
8650
|
random = {
|
|
8651
8651
|
source = "hashicorp/random"
|
|
@@ -8958,7 +8958,7 @@ output "waf_web_acl_arn" {
|
|
|
8958
8958
|
}
|
|
8959
8959
|
aws = {
|
|
8960
8960
|
source = "hashicorp/aws"
|
|
8961
|
-
version = "6.
|
|
8961
|
+
version = "6.70.0"
|
|
8962
8962
|
}
|
|
8963
8963
|
random = {
|
|
8964
8964
|
source = "hashicorp/random"
|
|
@@ -984,7 +984,7 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
|
|
|
984
984
|
required_providers {
|
|
985
985
|
aws = {
|
|
986
986
|
source = "hashicorp/aws"
|
|
987
|
-
version = "6.
|
|
987
|
+
version = "6.70.0"
|
|
988
988
|
}
|
|
989
989
|
random = {
|
|
990
990
|
source = "hashicorp/random"
|
|
@@ -1307,7 +1307,7 @@ exports[`ts#agent generator > should match snapshot for Terraform generated file
|
|
|
1307
1307
|
required_providers {
|
|
1308
1308
|
aws = {
|
|
1309
1309
|
source = "hashicorp/aws"
|
|
1310
|
-
version = "6.
|
|
1310
|
+
version = "6.70.0"
|
|
1311
1311
|
}
|
|
1312
1312
|
null = {
|
|
1313
1313
|
source = "hashicorp/null"
|
|
@@ -1666,7 +1666,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
1666
1666
|
|
|
1667
1667
|
provisioner "local-exec" {
|
|
1668
1668
|
command = <<-EOT
|
|
1669
|
-
uv run --with boto3==1.43.
|
|
1669
|
+
uv run --with boto3==1.43.118 python -c "
|
|
1670
1670
|
import boto3
|
|
1671
1671
|
import json
|
|
1672
1672
|
import os
|
|
@@ -439,12 +439,16 @@ exports[`ts#agent#guardrails generator > protocol a2a > should generate the guar
|
|
|
439
439
|
required_providers {
|
|
440
440
|
aws = {
|
|
441
441
|
source = "hashicorp/aws"
|
|
442
|
-
version = "6.
|
|
442
|
+
version = "6.70.0"
|
|
443
443
|
}
|
|
444
444
|
random = {
|
|
445
445
|
source = "hashicorp/random"
|
|
446
446
|
version = "3.9.1"
|
|
447
447
|
}
|
|
448
|
+
time = {
|
|
449
|
+
source = "hashicorp/time"
|
|
450
|
+
version = "0.14.2"
|
|
451
|
+
}
|
|
448
452
|
}
|
|
449
453
|
}
|
|
450
454
|
|
|
@@ -509,12 +513,25 @@ resource "aws_bedrock_guardrail_version" "this" {
|
|
|
509
513
|
}
|
|
510
514
|
}
|
|
511
515
|
|
|
516
|
+
resource "time_sleep" "version_retention" {
|
|
517
|
+
destroy_duration = "15s"
|
|
518
|
+
|
|
519
|
+
triggers = {
|
|
520
|
+
guardrail_id = aws_bedrock_guardrail.this.guardrail_id
|
|
521
|
+
guardrail_version = aws_bedrock_guardrail_version.this.version
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
lifecycle {
|
|
525
|
+
create_before_destroy = true
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
512
529
|
module "add_guardrail_to_runtime_config" {
|
|
513
530
|
source = "../../../core/runtime-config/entry"
|
|
514
531
|
|
|
515
532
|
namespace = "agentcore"
|
|
516
533
|
key = "guardrails"
|
|
517
|
-
value = { "TestProjectAgent" = { guardrailId =
|
|
534
|
+
value = { "TestProjectAgent" = { guardrailId = time_sleep.version_retention.triggers.guardrail_id, guardrailVersion = time_sleep.version_retention.triggers.guardrail_version } }
|
|
518
535
|
}
|
|
519
536
|
|
|
520
537
|
output "guardrail_id" {
|
|
@@ -971,12 +988,16 @@ exports[`ts#agent#guardrails generator > protocol ag-ui > should generate the gu
|
|
|
971
988
|
required_providers {
|
|
972
989
|
aws = {
|
|
973
990
|
source = "hashicorp/aws"
|
|
974
|
-
version = "6.
|
|
991
|
+
version = "6.70.0"
|
|
975
992
|
}
|
|
976
993
|
random = {
|
|
977
994
|
source = "hashicorp/random"
|
|
978
995
|
version = "3.9.1"
|
|
979
996
|
}
|
|
997
|
+
time = {
|
|
998
|
+
source = "hashicorp/time"
|
|
999
|
+
version = "0.14.2"
|
|
1000
|
+
}
|
|
980
1001
|
}
|
|
981
1002
|
}
|
|
982
1003
|
|
|
@@ -1041,12 +1062,25 @@ resource "aws_bedrock_guardrail_version" "this" {
|
|
|
1041
1062
|
}
|
|
1042
1063
|
}
|
|
1043
1064
|
|
|
1065
|
+
resource "time_sleep" "version_retention" {
|
|
1066
|
+
destroy_duration = "15s"
|
|
1067
|
+
|
|
1068
|
+
triggers = {
|
|
1069
|
+
guardrail_id = aws_bedrock_guardrail.this.guardrail_id
|
|
1070
|
+
guardrail_version = aws_bedrock_guardrail_version.this.version
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
lifecycle {
|
|
1074
|
+
create_before_destroy = true
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1044
1078
|
module "add_guardrail_to_runtime_config" {
|
|
1045
1079
|
source = "../../../core/runtime-config/entry"
|
|
1046
1080
|
|
|
1047
1081
|
namespace = "agentcore"
|
|
1048
1082
|
key = "guardrails"
|
|
1049
|
-
value = { "TestProjectAgent" = { guardrailId =
|
|
1083
|
+
value = { "TestProjectAgent" = { guardrailId = time_sleep.version_retention.triggers.guardrail_id, guardrailVersion = time_sleep.version_retention.triggers.guardrail_version } }
|
|
1050
1084
|
}
|
|
1051
1085
|
|
|
1052
1086
|
output "guardrail_id" {
|
|
@@ -1517,12 +1551,16 @@ exports[`ts#agent#guardrails generator > protocol http > should generate the gua
|
|
|
1517
1551
|
required_providers {
|
|
1518
1552
|
aws = {
|
|
1519
1553
|
source = "hashicorp/aws"
|
|
1520
|
-
version = "6.
|
|
1554
|
+
version = "6.70.0"
|
|
1521
1555
|
}
|
|
1522
1556
|
random = {
|
|
1523
1557
|
source = "hashicorp/random"
|
|
1524
1558
|
version = "3.9.1"
|
|
1525
1559
|
}
|
|
1560
|
+
time = {
|
|
1561
|
+
source = "hashicorp/time"
|
|
1562
|
+
version = "0.14.2"
|
|
1563
|
+
}
|
|
1526
1564
|
}
|
|
1527
1565
|
}
|
|
1528
1566
|
|
|
@@ -1587,12 +1625,25 @@ resource "aws_bedrock_guardrail_version" "this" {
|
|
|
1587
1625
|
}
|
|
1588
1626
|
}
|
|
1589
1627
|
|
|
1628
|
+
resource "time_sleep" "version_retention" {
|
|
1629
|
+
destroy_duration = "15s"
|
|
1630
|
+
|
|
1631
|
+
triggers = {
|
|
1632
|
+
guardrail_id = aws_bedrock_guardrail.this.guardrail_id
|
|
1633
|
+
guardrail_version = aws_bedrock_guardrail_version.this.version
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
lifecycle {
|
|
1637
|
+
create_before_destroy = true
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1590
1641
|
module "add_guardrail_to_runtime_config" {
|
|
1591
1642
|
source = "../../../core/runtime-config/entry"
|
|
1592
1643
|
|
|
1593
1644
|
namespace = "agentcore"
|
|
1594
1645
|
key = "guardrails"
|
|
1595
|
-
value = { "TestProjectAgent" = { guardrailId =
|
|
1646
|
+
value = { "TestProjectAgent" = { guardrailId = time_sleep.version_retention.triggers.guardrail_id, guardrailVersion = time_sleep.version_retention.triggers.guardrail_version } }
|
|
1596
1647
|
}
|
|
1597
1648
|
|
|
1598
1649
|
output "guardrail_id" {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/ import { generateFiles, joinPathFragments, logger, OverwriteStrategy } from "@nx/devkit";
|
|
5
5
|
import { addDestructuredImport, applyGritQL, matchGritQL } from "../../../utils/ast.js";
|
|
6
6
|
import { formatFilesInSubtree } from "../../../utils/format.js";
|
|
7
|
-
import { addGuardrailInfra } from "../../../utils/guardrail-constructs/guardrail-constructs.js";
|
|
7
|
+
import { addGuardrailInfra, addGuardrailPolicy } from "../../../utils/guardrail-constructs/guardrail-constructs.js";
|
|
8
8
|
import { guardrailWiringMessage } from "../../../utils/guardrail-constructs/guardrail-wiring.js";
|
|
9
9
|
import { addGeneratorMetricsIfApplicable } from "../../../utils/metrics.js";
|
|
10
10
|
import { esmVars, isEsmWorkspace } from "../../../utils/module-format.js";
|
|
@@ -74,6 +74,7 @@ export const tsAgentGuardrailsGenerator = async (tree, options)=>{
|
|
|
74
74
|
}, {
|
|
75
75
|
overwriteStrategy: OverwriteStrategy.KeepExisting
|
|
76
76
|
});
|
|
77
|
+
addGuardrailPolicy(tree, agentDir);
|
|
77
78
|
await addGuardrailedModelToAgent(tree, joinPathFragments(agentDir, 'agent.ts'));
|
|
78
79
|
const iac = agent.iac;
|
|
79
80
|
let wiringMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/agent/guardrails/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n logger,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport {\n addDestructuredImport,\n applyGritQL,\n matchGritQL,\n} from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport { addGuardrailInfra } from '../../../utils/guardrail-constructs/guardrail-constructs.js';\nimport { guardrailWiringMessage } from '../../../utils/guardrail-constructs/guardrail-wiring.js';\nimport type { Iac } from '../../../utils/iac.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars, isEsmWorkspace } from '../../../utils/module-format.js';\nimport { kebabCase, toClassName } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n type ComponentMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { TS_AGENT_GENERATOR_INFO } from '../generator.js';\nimport type { TsAgentGuardrailsGeneratorSchema } from './schema';\nimport { addGuardrailPolicySynthInputs } from './synth-inputs.js';\n\nexport const TS_AGENT_GUARDRAILS_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Find the `ts#agent` component to guard, by name when given, otherwise the\n * project's only one.\n */\nconst resolveAgent = (\n projectName: string,\n components: ComponentMetadata[],\n agent?: string,\n): ComponentMetadata => {\n const agents = components.filter(\n (c) => c.generator === TS_AGENT_GENERATOR_INFO.id,\n );\n const available = agents.map((c) => c.name).join(', ') || 'none';\n if (agent) {\n const match = agents.find((c) => c.name === agent);\n if (!match) {\n throw new Error(\n `No TypeScript Agent named ${agent} in project ${projectName}. Available agents: ${available}`,\n );\n }\n return match;\n }\n if (agents.length !== 1) {\n throw new Error(\n agents.length === 0\n ? `Project ${projectName} has no TypeScript Agent. Add one with the ts#agent generator first.`\n : `Project ${projectName} has more than one TypeScript Agent. Specify which to guard with --agent. Available agents: ${available}`,\n );\n }\n return agents[0];\n};\n\n/**\n * Add `model: getGuardrailedModel()` to the `new Agent({...})` call in\n * agent.ts. An agent that already sets its own model is left unchanged, and\n * the lines to add by hand are logged instead.\n */\nconst addGuardrailedModelToAgent = async (\n tree: Tree,\n agentFile: string,\n): Promise<void> => {\n const guardrailImport = isEsmWorkspace(tree)\n ? './guardrail.js'\n : './guardrail';\n\n if (tree.exists(agentFile)) {\n if (await matchGritQL(tree, agentFile, '`getGuardrailedModel()`')) {\n return;\n }\n if (\n await applyGritQL(\n tree,\n agentFile,\n '`new Agent({ $props })` => `new Agent({ model: getGuardrailedModel(), $props })` where { $props <: not some or { `model: $_`, `model` } }',\n )\n ) {\n await addDestructuredImport(\n tree,\n agentFile,\n ['getGuardrailedModel'],\n './guardrail.js',\n );\n return;\n }\n }\n\n logger.warn(\n `Could not add the guardrail to ${agentFile}, because ${tree.exists(agentFile) ? 'its new Agent({...}) call already sets a model or is not an inline object' : 'the file does not exist'}. Set the model of your Agent to the guardrailed model by hand:\n\n model: getGuardrailedModel(),\n\nand import it:\n\n import { getGuardrailedModel } from '${guardrailImport}';`,\n );\n};\n\nexport const tsAgentGuardrailsGenerator = async (\n tree: Tree,\n options: TsAgentGuardrailsGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n const agent = resolveAgent(\n project.name,\n (project.metadata as any)?.components ?? [],\n options.agent,\n );\n\n const agentTargetPrefix = agent.name ?? 'agent';\n const agentNameClassName = agent.rc ?? toClassName(agentTargetPrefix);\n const nameKebabCase = kebabCase(agentNameClassName);\n const agentPath = agent.path ?? joinPathFragments('src', agentTargetPrefix);\n const agentDir = joinPathFragments(project.root, agentPath);\n\n // The policy is the user's to edit, so a re-run never touches these files.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent'),\n agentDir,\n {\n ...esmVars(tree),\n agentConnectionImport: `@${getNpmScope(tree)}/agent-connection`,\n agentNameClassName,\n nameKebabCase,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n\n await addGuardrailedModelToAgent(\n tree,\n joinPathFragments(agentDir, 'agent.ts'),\n );\n\n const iac = agent.iac as Iac | undefined;\n let wiringMessage: string | undefined;\n if (iac) {\n const policyPath = joinPathFragments(agentDir, 'guardrail.json');\n await addGuardrailInfra(tree, {\n iac,\n nameClassName: agentNameClassName,\n nameKebabCase,\n policyPath,\n });\n if (iac === 'cdk') {\n for (const message of addGuardrailPolicySynthInputs(tree, [policyPath])) {\n logger.warn(message);\n }\n }\n wiringMessage = guardrailWiringMessage({\n iac,\n nameClassName: agentNameClassName,\n nameKebabCase,\n npmScope: getNpmScope(tree),\n });\n } else {\n logger.warn(\n `Agent ${agentTargetPrefix} in project ${project.name} has no infrastructure, so no guardrail infrastructure was generated. Create the guardrail yourself and write its ID and version to runtime config at agentcore.guardrails.${agentNameClassName} as { guardrailId, guardrailVersion }.`,\n );\n }\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_AGENT_GUARDRAILS_GENERATOR_INFO,\n agentPath,\n agentTargetPrefix,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_GUARDRAILS_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n\n // Printed from the callback so it appears after Nx lists the changed\n // files, on every run, since the generator cannot tell whether the stack is\n // already wired.\n return () => {\n if (wiringMessage) {\n logger.info(wiringMessage);\n }\n };\n};\n\nexport default tsAgentGuardrailsGenerator;\n"],"names":["generateFiles","joinPathFragments","logger","OverwriteStrategy","addDestructuredImport","applyGritQL","matchGritQL","formatFilesInSubtree","addGuardrailInfra","guardrailWiringMessage","addGeneratorMetricsIfApplicable","esmVars","isEsmWorkspace","kebabCase","toClassName","getNpmScope","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","TS_AGENT_GENERATOR_INFO","addGuardrailPolicySynthInputs","TS_AGENT_GUARDRAILS_GENERATOR_INFO","filename","resolveAgent","projectName","components","agent","agents","filter","c","generator","id","available","map","name","join","match","find","Error","length","addGuardrailedModelToAgent","tree","agentFile","guardrailImport","exists","warn","tsAgentGuardrailsGenerator","options","project","metadata","agentTargetPrefix","agentNameClassName","rc","nameKebabCase","agentPath","path","agentDir","root","dirname","agentConnectionImport","overwriteStrategy","KeepExisting","iac","wiringMessage","policyPath","nameClassName","message","npmScope","info"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,MAAM,EACNC,iBAAiB,QAEZ,aAAa;AACpB,SACEC,qBAAqB,EACrBC,WAAW,EACXC,WAAW,QACN,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,iBAAiB,QAAQ,8DAA8D;AAChG,SAASC,sBAAsB,QAAQ,0DAA0D;AAEjG,SAASC,+BAA+B,QAAQ,4BAA4B;AAC5E,SAASC,OAAO,EAAEC,cAAc,QAAQ,kCAAkC;AAC1E,SAASC,SAAS,EAAEC,WAAW,QAAQ,0BAA0B;AACjE,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SACEC,6BAA6B,EAE7BC,gBAAgB,EAEhBC,mCAAmC,QAC9B,uBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1D,SAASC,6BAA6B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AAC,2KAA2K,EAAEiB,mBAAmB,sCAAsC,CAAC;IAEjS;IAEAnC,8BACEyB,MACAO,QAAQd,IAAI,EACZb,oCACAiC,WACAJ;IAGF,MAAMxC,gCAAgC+B,MAAM;QAC1CpB;KACD;IAED,MAAMd,qBAAqBkC;IAE3B,qEAAqE;IACrE,4EAA4E;IAC5E,iBAAiB;IACjB,OAAO;QACL,IAAIsB,eAAe;YACjB7D,OAAOkE,IAAI,CAACL;QACd;IACF;AACF,EAAE;AAEF,eAAejB,2BAA2B"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../packages/nx-plugin/src/ts/agent/guardrails/generator.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n type GeneratorCallback,\n generateFiles,\n joinPathFragments,\n logger,\n OverwriteStrategy,\n type Tree,\n} from '@nx/devkit';\nimport {\n addDestructuredImport,\n applyGritQL,\n matchGritQL,\n} from '../../../utils/ast.js';\nimport { formatFilesInSubtree } from '../../../utils/format.js';\nimport {\n addGuardrailInfra,\n addGuardrailPolicy,\n} from '../../../utils/guardrail-constructs/guardrail-constructs.js';\nimport { guardrailWiringMessage } from '../../../utils/guardrail-constructs/guardrail-wiring.js';\nimport type { Iac } from '../../../utils/iac.js';\nimport { addGeneratorMetricsIfApplicable } from '../../../utils/metrics.js';\nimport { esmVars, isEsmWorkspace } from '../../../utils/module-format.js';\nimport { kebabCase, toClassName } from '../../../utils/names.js';\nimport { getNpmScope } from '../../../utils/npm-scope.js';\nimport {\n addComponentGeneratorMetadata,\n type ComponentMetadata,\n getGeneratorInfo,\n type NxGeneratorInfo,\n readProjectConfigurationUnqualified,\n} from '../../../utils/nx.js';\nimport { TS_AGENT_GENERATOR_INFO } from '../generator.js';\nimport type { TsAgentGuardrailsGeneratorSchema } from './schema';\nimport { addGuardrailPolicySynthInputs } from './synth-inputs.js';\n\nexport const TS_AGENT_GUARDRAILS_GENERATOR_INFO: NxGeneratorInfo =\n getGeneratorInfo(import.meta.filename);\n\n/**\n * Find the `ts#agent` component to guard, by name when given, otherwise the\n * project's only one.\n */\nconst resolveAgent = (\n projectName: string,\n components: ComponentMetadata[],\n agent?: string,\n): ComponentMetadata => {\n const agents = components.filter(\n (c) => c.generator === TS_AGENT_GENERATOR_INFO.id,\n );\n const available = agents.map((c) => c.name).join(', ') || 'none';\n if (agent) {\n const match = agents.find((c) => c.name === agent);\n if (!match) {\n throw new Error(\n `No TypeScript Agent named ${agent} in project ${projectName}. Available agents: ${available}`,\n );\n }\n return match;\n }\n if (agents.length !== 1) {\n throw new Error(\n agents.length === 0\n ? `Project ${projectName} has no TypeScript Agent. Add one with the ts#agent generator first.`\n : `Project ${projectName} has more than one TypeScript Agent. Specify which to guard with --agent. Available agents: ${available}`,\n );\n }\n return agents[0];\n};\n\n/**\n * Add `model: getGuardrailedModel()` to the `new Agent({...})` call in\n * agent.ts. An agent that already sets its own model is left unchanged, and\n * the lines to add by hand are logged instead.\n */\nconst addGuardrailedModelToAgent = async (\n tree: Tree,\n agentFile: string,\n): Promise<void> => {\n const guardrailImport = isEsmWorkspace(tree)\n ? './guardrail.js'\n : './guardrail';\n\n if (tree.exists(agentFile)) {\n if (await matchGritQL(tree, agentFile, '`getGuardrailedModel()`')) {\n return;\n }\n if (\n await applyGritQL(\n tree,\n agentFile,\n '`new Agent({ $props })` => `new Agent({ model: getGuardrailedModel(), $props })` where { $props <: not some or { `model: $_`, `model` } }',\n )\n ) {\n await addDestructuredImport(\n tree,\n agentFile,\n ['getGuardrailedModel'],\n './guardrail.js',\n );\n return;\n }\n }\n\n logger.warn(\n `Could not add the guardrail to ${agentFile}, because ${tree.exists(agentFile) ? 'its new Agent({...}) call already sets a model or is not an inline object' : 'the file does not exist'}. Set the model of your Agent to the guardrailed model by hand:\n\n model: getGuardrailedModel(),\n\nand import it:\n\n import { getGuardrailedModel } from '${guardrailImport}';`,\n );\n};\n\nexport const tsAgentGuardrailsGenerator = async (\n tree: Tree,\n options: TsAgentGuardrailsGeneratorSchema,\n): Promise<GeneratorCallback> => {\n const project = readProjectConfigurationUnqualified(tree, options.project);\n const agent = resolveAgent(\n project.name,\n (project.metadata as any)?.components ?? [],\n options.agent,\n );\n\n const agentTargetPrefix = agent.name ?? 'agent';\n const agentNameClassName = agent.rc ?? toClassName(agentTargetPrefix);\n const nameKebabCase = kebabCase(agentNameClassName);\n const agentPath = agent.path ?? joinPathFragments('src', agentTargetPrefix);\n const agentDir = joinPathFragments(project.root, agentPath);\n\n // The policy is the user's to edit, so a re-run never touches these files.\n generateFiles(\n tree,\n joinPathFragments(import.meta.dirname, 'files', 'agent'),\n agentDir,\n {\n ...esmVars(tree),\n agentConnectionImport: `@${getNpmScope(tree)}/agent-connection`,\n agentNameClassName,\n nameKebabCase,\n },\n { overwriteStrategy: OverwriteStrategy.KeepExisting },\n );\n addGuardrailPolicy(tree, agentDir);\n\n await addGuardrailedModelToAgent(\n tree,\n joinPathFragments(agentDir, 'agent.ts'),\n );\n\n const iac = agent.iac as Iac | undefined;\n let wiringMessage: string | undefined;\n if (iac) {\n const policyPath = joinPathFragments(agentDir, 'guardrail.json');\n await addGuardrailInfra(tree, {\n iac,\n nameClassName: agentNameClassName,\n nameKebabCase,\n policyPath,\n });\n if (iac === 'cdk') {\n for (const message of addGuardrailPolicySynthInputs(tree, [policyPath])) {\n logger.warn(message);\n }\n }\n wiringMessage = guardrailWiringMessage({\n iac,\n nameClassName: agentNameClassName,\n nameKebabCase,\n npmScope: getNpmScope(tree),\n });\n } else {\n logger.warn(\n `Agent ${agentTargetPrefix} in project ${project.name} has no infrastructure, so no guardrail infrastructure was generated. Create the guardrail yourself and write its ID and version to runtime config at agentcore.guardrails.${agentNameClassName} as { guardrailId, guardrailVersion }.`,\n );\n }\n\n addComponentGeneratorMetadata(\n tree,\n project.name,\n TS_AGENT_GUARDRAILS_GENERATOR_INFO,\n agentPath,\n agentTargetPrefix,\n );\n\n await addGeneratorMetricsIfApplicable(tree, [\n TS_AGENT_GUARDRAILS_GENERATOR_INFO,\n ]);\n\n await formatFilesInSubtree(tree);\n\n // Printed from the callback so it appears after Nx lists the changed\n // files, on every run, since the generator cannot tell whether the stack is\n // already wired.\n return () => {\n if (wiringMessage) {\n logger.info(wiringMessage);\n }\n };\n};\n\nexport default tsAgentGuardrailsGenerator;\n"],"names":["generateFiles","joinPathFragments","logger","OverwriteStrategy","addDestructuredImport","applyGritQL","matchGritQL","formatFilesInSubtree","addGuardrailInfra","addGuardrailPolicy","guardrailWiringMessage","addGeneratorMetricsIfApplicable","esmVars","isEsmWorkspace","kebabCase","toClassName","getNpmScope","addComponentGeneratorMetadata","getGeneratorInfo","readProjectConfigurationUnqualified","TS_AGENT_GENERATOR_INFO","addGuardrailPolicySynthInputs","TS_AGENT_GUARDRAILS_GENERATOR_INFO","filename","resolveAgent","projectName","components","agent","agents","filter","c","generator","id","available","map","name","join","match","find","Error","length","addGuardrailedModelToAgent","tree","agentFile","guardrailImport","exists","warn","tsAgentGuardrailsGenerator","options","project","metadata","agentTargetPrefix","agentNameClassName","rc","nameKebabCase","agentPath","path","agentDir","root","dirname","agentConnectionImport","overwriteStrategy","KeepExisting","iac","wiringMessage","policyPath","nameClassName","message","npmScope","info"],"mappings":"AAAA;;;CAGC,GACD,SAEEA,aAAa,EACbC,iBAAiB,EACjBC,MAAM,EACNC,iBAAiB,QAEZ,aAAa;AACpB,SACEC,qBAAqB,EACrBC,WAAW,EACXC,WAAW,QACN,wBAAwB;AAC/B,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SACEC,iBAAiB,EACjBC,kBAAkB,QACb,8DAA8D;AACrE,SAASC,sBAAsB,QAAQ,0DAA0D;AAEjG,SAASC,+BAA+B,QAAQ,4BAA4B;AAC5E,SAASC,OAAO,EAAEC,cAAc,QAAQ,kCAAkC;AAC1E,SAASC,SAAS,EAAEC,WAAW,QAAQ,0BAA0B;AACjE,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SACEC,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qD;YACAG,eAAed;YACfE;YACAc,UAAUpD,YAAY0B;QACxB;IACF,OAAO;QACLxC,OAAO4C,IAAI,CACT,CAAC,MAAM,EAAEK,kBAAkB,YAAY,EAAEF,QAAQd,IAAI,CAAC,2KAA2K,EAAEiB,mBAAmB,sCAAsC,CAAC;IAEjS;IAEAnC,8BACEyB,MACAO,QAAQd,IAAI,EACZb,oCACAiC,WACAJ;IAGF,MAAMxC,gCAAgC+B,MAAM;QAC1CpB;KACD;IAED,MAAMf,qBAAqBmC;IAE3B,qEAAqE;IACrE,4EAA4E;IAC5E,iBAAiB;IACjB,OAAO;QACL,IAAIsB,eAAe;YACjB9D,OAAOmE,IAAI,CAACL;QACd;IACF;AACF,EAAE;AAEF,eAAejB,2BAA2B"}
|
|
@@ -35,7 +35,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
|
|
|
35
35
|
required_providers {
|
|
36
36
|
aws = {
|
|
37
37
|
source = "hashicorp/aws"
|
|
38
|
-
version = "6.
|
|
38
|
+
version = "6.70.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -232,7 +232,7 @@ exports[`ts#dynamodb generator > should generate terraform modules when iac is t
|
|
|
232
232
|
required_providers {
|
|
233
233
|
aws = {
|
|
234
234
|
source = "hashicorp/aws"
|
|
235
|
-
version = "6.
|
|
235
|
+
version = "6.70.0"
|
|
236
236
|
}
|
|
237
237
|
random = {
|
|
238
238
|
source = "hashicorp/random"
|
|
@@ -141,7 +141,7 @@ exports[`ts-lambda-function generator > terraform iac > should generate terrafor
|
|
|
141
141
|
required_providers {
|
|
142
142
|
aws = {
|
|
143
143
|
source = "hashicorp/aws"
|
|
144
|
-
version = "6.
|
|
144
|
+
version = "6.70.0"
|
|
145
145
|
}
|
|
146
146
|
archive = {
|
|
147
147
|
source = "hashicorp/archive"
|
|
@@ -326,7 +326,7 @@ exports[`ts-lambda-function generator > terraform iac > should match snapshot fo
|
|
|
326
326
|
required_providers {
|
|
327
327
|
aws = {
|
|
328
328
|
source = "hashicorp/aws"
|
|
329
|
-
version = "6.
|
|
329
|
+
version = "6.70.0"
|
|
330
330
|
}
|
|
331
331
|
archive = {
|
|
332
332
|
source = "hashicorp/archive"
|
|
@@ -155,7 +155,7 @@ exports[`ts#mcp-server generator > should match snapshot for Terraform generated
|
|
|
155
155
|
required_providers {
|
|
156
156
|
aws = {
|
|
157
157
|
source = "hashicorp/aws"
|
|
158
|
-
version = "6.
|
|
158
|
+
version = "6.70.0"
|
|
159
159
|
}
|
|
160
160
|
null = {
|
|
161
161
|
source = "hashicorp/null"
|
|
@@ -514,7 +514,7 @@ resource "null_resource" "runtime_ready" {
|
|
|
514
514
|
|
|
515
515
|
provisioner "local-exec" {
|
|
516
516
|
command = <<-EOT
|
|
517
|
-
uv run --with boto3==1.43.
|
|
517
|
+
uv run --with boto3==1.43.118 python -c "
|
|
518
518
|
import boto3
|
|
519
519
|
import json
|
|
520
520
|
import os
|
|
@@ -848,7 +848,7 @@ terraform {
|
|
|
848
848
|
required_providers {
|
|
849
849
|
aws = {
|
|
850
850
|
source = "hashicorp/aws"
|
|
851
|
-
version = "6.
|
|
851
|
+
version = "6.70.0"
|
|
852
852
|
}
|
|
853
853
|
null = {
|
|
854
854
|
source = "hashicorp/null"
|
|
@@ -1519,7 +1519,7 @@ exports[`ts#rdb generator > should generate terraform modules when iac is Terraf
|
|
|
1519
1519
|
}
|
|
1520
1520
|
aws = {
|
|
1521
1521
|
source = "hashicorp/aws"
|
|
1522
|
-
version = "6.
|
|
1522
|
+
version = "6.70.0"
|
|
1523
1523
|
}
|
|
1524
1524
|
external = {
|
|
1525
1525
|
source = "hashicorp/external"
|
|
@@ -2214,7 +2214,7 @@ terraform {
|
|
|
2214
2214
|
required_providers {
|
|
2215
2215
|
aws = {
|
|
2216
2216
|
source = "hashicorp/aws"
|
|
2217
|
-
version = "6.
|
|
2217
|
+
version = "6.70.0"
|
|
2218
2218
|
}
|
|
2219
2219
|
null = {
|
|
2220
2220
|
source = "hashicorp/null"
|
|
@@ -2885,7 +2885,7 @@ exports[`ts#rdb generator > should generate terraform modules with MySQL engine
|
|
|
2885
2885
|
}
|
|
2886
2886
|
aws = {
|
|
2887
2887
|
source = "hashicorp/aws"
|
|
2888
|
-
version = "6.
|
|
2888
|
+
version = "6.70.0"
|
|
2889
2889
|
}
|
|
2890
2890
|
external = {
|
|
2891
2891
|
source = "hashicorp/external"
|
|
@@ -131,7 +131,7 @@ exports[`react-website generator > TailwindCSS integration > terraform iac > sho
|
|
|
131
131
|
required_providers {
|
|
132
132
|
aws = {
|
|
133
133
|
source = "hashicorp/aws"
|
|
134
|
-
version = "6.
|
|
134
|
+
version = "6.70.0"
|
|
135
135
|
configuration_aliases = [aws.us_east_1]
|
|
136
136
|
}
|
|
137
137
|
null = {
|
|
@@ -745,7 +745,7 @@ resource "null_resource" "upload_website_files" {
|
|
|
745
745
|
provisioner "local-exec" {
|
|
746
746
|
command = <<-EOT
|
|
747
747
|
cd "$ROOT_PATH"
|
|
748
|
-
uv run --with boto3==1.43.
|
|
748
|
+
uv run --with boto3==1.43.118 python3 -c "
|
|
749
749
|
import os
|
|
750
750
|
import sys
|
|
751
751
|
import boto3
|
|
@@ -868,7 +868,7 @@ resource "null_resource" "cloudfront_invalidation" {
|
|
|
868
868
|
|
|
869
869
|
provisioner "local-exec" {
|
|
870
870
|
command = <<-EOT
|
|
871
|
-
uv run --with boto3==1.43.
|
|
871
|
+
uv run --with boto3==1.43.118 python3 -c "
|
|
872
872
|
import boto3
|
|
873
873
|
import os
|
|
874
874
|
import sys
|
|
@@ -954,7 +954,7 @@ output "waf_web_acl_arn" {
|
|
|
954
954
|
required_providers {
|
|
955
955
|
aws = {
|
|
956
956
|
source = "hashicorp/aws"
|
|
957
|
-
version = "6.
|
|
957
|
+
version = "6.70.0"
|
|
958
958
|
configuration_aliases = [aws.us_east_1]
|
|
959
959
|
}
|
|
960
960
|
}
|
|
@@ -1061,7 +1061,7 @@ runtime-config.json
|
|
|
1061
1061
|
|
|
1062
1062
|
exports[`react-website generator > Tanstack router integration > should generate website with no router correctly > biome.json 1`] = `
|
|
1063
1063
|
"{
|
|
1064
|
-
"$schema": "https://biomejs.dev/schemas/2.
|
|
1064
|
+
"$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
|
|
1065
1065
|
"root": true,
|
|
1066
1066
|
"formatter": {
|
|
1067
1067
|
"enabled": true,
|
|
@@ -1086,6 +1086,16 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
1086
1086
|
"enabled": false
|
|
1087
1087
|
}
|
|
1088
1088
|
},
|
|
1089
|
+
"markdown": {
|
|
1090
|
+
"formatter": {
|
|
1091
|
+
"enabled": false
|
|
1092
|
+
}
|
|
1093
|
+
},
|
|
1094
|
+
"yaml": {
|
|
1095
|
+
"formatter": {
|
|
1096
|
+
"enabled": false
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1089
1099
|
"linter": {
|
|
1090
1100
|
"enabled": true,
|
|
1091
1101
|
"rules": {
|
|
@@ -1242,11 +1252,11 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
1242
1252
|
"name": "@proj/source",
|
|
1243
1253
|
"dependencies": {},
|
|
1244
1254
|
"devDependencies": {
|
|
1245
|
-
"@nx/js": "23.3.
|
|
1255
|
+
"@nx/js": "23.3.1",
|
|
1246
1256
|
"@nx/react": "catalog:",
|
|
1247
|
-
"@nx/vite": "23.3.
|
|
1257
|
+
"@nx/vite": "23.3.1",
|
|
1248
1258
|
"@nx/vitest": "catalog:",
|
|
1249
|
-
"@nx/web": "23.3.
|
|
1259
|
+
"@nx/web": "23.3.1",
|
|
1250
1260
|
"@swc/helpers": "~0.5.18",
|
|
1251
1261
|
"@tailwindcss/vite": "catalog:",
|
|
1252
1262
|
"@testing-library/dom": "10.4.0",
|
|
@@ -2377,21 +2387,21 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
2377
2387
|
- packages/common/*
|
|
2378
2388
|
catalog:
|
|
2379
2389
|
'@types/node': 26.6.5
|
|
2380
|
-
vite: 8.3.
|
|
2381
|
-
vitest: 5.0.
|
|
2382
|
-
'@vitest/coverage-v8': 5.0.
|
|
2390
|
+
vite: 8.3.5
|
|
2391
|
+
vitest: 5.0.5
|
|
2392
|
+
'@vitest/coverage-v8': 5.0.5
|
|
2383
2393
|
jsdom: 29.1.1
|
|
2384
|
-
'@nx/vitest': 23.3.
|
|
2394
|
+
'@nx/vitest': 23.3.1
|
|
2385
2395
|
constructs: 10.8.1
|
|
2386
|
-
aws-cdk-lib: 2.
|
|
2396
|
+
aws-cdk-lib: 2.274.0
|
|
2387
2397
|
react: 19.3.1
|
|
2388
2398
|
react-dom: 19.3.1
|
|
2389
|
-
'@cloudscape-design/components': 3.0.
|
|
2390
|
-
'@cloudscape-design/board-components': 3.0.
|
|
2399
|
+
'@cloudscape-design/components': 3.0.1404
|
|
2400
|
+
'@cloudscape-design/board-components': 3.0.240
|
|
2391
2401
|
'@cloudscape-design/global-styles': 1.0.71
|
|
2392
2402
|
tailwindcss: 4.3.3
|
|
2393
|
-
'@nx/react': 23.3.
|
|
2394
|
-
'@vitest/ui': 5.0.
|
|
2403
|
+
'@nx/react': 23.3.1
|
|
2404
|
+
'@vitest/ui': 5.0.5
|
|
2395
2405
|
'@tailwindcss/vite': 4.3.3
|
|
2396
2406
|
"
|
|
2397
2407
|
`;
|
|
@@ -2988,7 +2998,7 @@ runtime-config.json
|
|
|
2988
2998
|
|
|
2989
2999
|
exports[`react-website generator > Tanstack router integration > should generate website with router correctly > biome.json 1`] = `
|
|
2990
3000
|
"{
|
|
2991
|
-
"$schema": "https://biomejs.dev/schemas/2.
|
|
3001
|
+
"$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
|
|
2992
3002
|
"root": true,
|
|
2993
3003
|
"formatter": {
|
|
2994
3004
|
"enabled": true,
|
|
@@ -3013,6 +3023,16 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
3013
3023
|
"enabled": false
|
|
3014
3024
|
}
|
|
3015
3025
|
},
|
|
3026
|
+
"markdown": {
|
|
3027
|
+
"formatter": {
|
|
3028
|
+
"enabled": false
|
|
3029
|
+
}
|
|
3030
|
+
},
|
|
3031
|
+
"yaml": {
|
|
3032
|
+
"formatter": {
|
|
3033
|
+
"enabled": false
|
|
3034
|
+
}
|
|
3035
|
+
},
|
|
3016
3036
|
"linter": {
|
|
3017
3037
|
"enabled": true,
|
|
3018
3038
|
"rules": {
|
|
@@ -3169,11 +3189,11 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
3169
3189
|
"name": "@proj/source",
|
|
3170
3190
|
"dependencies": {},
|
|
3171
3191
|
"devDependencies": {
|
|
3172
|
-
"@nx/js": "23.3.
|
|
3192
|
+
"@nx/js": "23.3.1",
|
|
3173
3193
|
"@nx/react": "catalog:",
|
|
3174
|
-
"@nx/vite": "23.3.
|
|
3194
|
+
"@nx/vite": "23.3.1",
|
|
3175
3195
|
"@nx/vitest": "catalog:",
|
|
3176
|
-
"@nx/web": "23.3.
|
|
3196
|
+
"@nx/web": "23.3.1",
|
|
3177
3197
|
"@swc/helpers": "~0.5.18",
|
|
3178
3198
|
"@tailwindcss/vite": "catalog:",
|
|
3179
3199
|
"@tanstack/router-generator": "catalog:",
|
|
@@ -4308,25 +4328,25 @@ exports[`react-website generator > Tanstack router integration > should generate
|
|
|
4308
4328
|
- packages/common/*
|
|
4309
4329
|
catalog:
|
|
4310
4330
|
'@types/node': 26.6.5
|
|
4311
|
-
vite: 8.3.
|
|
4312
|
-
vitest: 5.0.
|
|
4313
|
-
'@vitest/coverage-v8': 5.0.
|
|
4331
|
+
vite: 8.3.5
|
|
4332
|
+
vitest: 5.0.5
|
|
4333
|
+
'@vitest/coverage-v8': 5.0.5
|
|
4314
4334
|
jsdom: 29.1.1
|
|
4315
|
-
'@nx/vitest': 23.3.
|
|
4335
|
+
'@nx/vitest': 23.3.1
|
|
4316
4336
|
constructs: 10.8.1
|
|
4317
|
-
aws-cdk-lib: 2.
|
|
4337
|
+
aws-cdk-lib: 2.274.0
|
|
4318
4338
|
react: 19.3.1
|
|
4319
4339
|
react-dom: 19.3.1
|
|
4320
|
-
'@cloudscape-design/components': 3.0.
|
|
4321
|
-
'@cloudscape-design/board-components': 3.0.
|
|
4340
|
+
'@cloudscape-design/components': 3.0.1404
|
|
4341
|
+
'@cloudscape-design/board-components': 3.0.240
|
|
4322
4342
|
'@cloudscape-design/global-styles': 1.0.71
|
|
4323
4343
|
tailwindcss: 4.3.3
|
|
4324
|
-
'@tanstack/react-router': 1.170.
|
|
4325
|
-
'@nx/react': 23.3.
|
|
4326
|
-
'@vitest/ui': 5.0.
|
|
4344
|
+
'@tanstack/react-router': 1.170.46
|
|
4345
|
+
'@nx/react': 23.3.1
|
|
4346
|
+
'@vitest/ui': 5.0.5
|
|
4327
4347
|
'@tailwindcss/vite': 4.3.3
|
|
4328
|
-
'@tanstack/router-plugin': 1.168.
|
|
4329
|
-
'@tanstack/router-generator': 1.167.
|
|
4348
|
+
'@tanstack/router-plugin': 1.168.48
|
|
4349
|
+
'@tanstack/router-generator': 1.167.46
|
|
4330
4350
|
'@tanstack/virtual-file-routes': 1.162.0
|
|
4331
4351
|
'@tanstack/router-utils': 1.162.4
|
|
4332
4352
|
"
|
|
@@ -6,7 +6,7 @@ exports[`cognito-auth generator terraform iac > should generate terraform files
|
|
|
6
6
|
required_providers {
|
|
7
7
|
aws = {
|
|
8
8
|
source = "hashicorp/aws"
|
|
9
|
-
version = "6.
|
|
9
|
+
version = "6.70.0"
|
|
10
10
|
}
|
|
11
11
|
null = {
|
|
12
12
|
source = "hashicorp/null"
|
|
@@ -67,7 +67,7 @@ resource "null_resource" "add_callback_url" {
|
|
|
67
67
|
|
|
68
68
|
provisioner "local-exec" {
|
|
69
69
|
command = <<-EOT
|
|
70
|
-
uv run --with boto3==1.43.
|
|
70
|
+
uv run --with boto3==1.43.118 python -c "
|
|
71
71
|
import boto3
|
|
72
72
|
import os
|
|
73
73
|
import sys
|
package/src/utils/format.d.ts
CHANGED
|
@@ -61,6 +61,16 @@ export declare const getDefaultBiomeConfig: (tree: Tree) => {
|
|
|
61
61
|
enabled: boolean;
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
markdown: {
|
|
65
|
+
formatter: {
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
yaml: {
|
|
70
|
+
formatter: {
|
|
71
|
+
enabled: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
64
74
|
linter: {
|
|
65
75
|
enabled: boolean;
|
|
66
76
|
rules: {
|