@intentius/chant-lexicon-aws 0.0.6 → 0.0.9

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 (128) hide show
  1. package/dist/integrity.json +25 -10
  2. package/dist/manifest.json +1 -1
  3. package/dist/meta.json +9444 -4597
  4. package/dist/rules/cf-refs.ts +99 -0
  5. package/dist/rules/ext001.ts +32 -25
  6. package/dist/rules/hardcoded-region.ts +1 -0
  7. package/dist/rules/iam-wildcard.ts +1 -0
  8. package/dist/rules/s3-encryption.ts +3 -3
  9. package/dist/rules/waw016.ts +86 -0
  10. package/dist/rules/waw017.ts +53 -0
  11. package/dist/rules/waw018.ts +71 -0
  12. package/dist/rules/waw019.ts +82 -0
  13. package/dist/rules/waw020.ts +64 -0
  14. package/dist/rules/waw021.ts +53 -0
  15. package/dist/rules/waw022.ts +43 -0
  16. package/dist/rules/waw023.ts +47 -0
  17. package/dist/rules/waw024.ts +54 -0
  18. package/dist/rules/waw025.ts +43 -0
  19. package/dist/rules/waw026.ts +46 -0
  20. package/dist/rules/waw027.ts +50 -0
  21. package/dist/rules/waw028.ts +47 -0
  22. package/dist/rules/waw029.ts +62 -0
  23. package/dist/rules/waw030.ts +246 -0
  24. package/dist/skills/chant-aws.md +430 -0
  25. package/dist/types/index.d.ts +58525 -58501
  26. package/package.json +2 -2
  27. package/src/actions/actions.test.ts +75 -0
  28. package/src/actions/dynamodb.ts +36 -0
  29. package/src/actions/ecr.ts +9 -0
  30. package/src/actions/ecs.ts +5 -0
  31. package/src/actions/iam.ts +3 -0
  32. package/src/actions/index.ts +9 -0
  33. package/src/actions/lambda.ts +11 -0
  34. package/src/actions/logs.ts +4 -0
  35. package/src/actions/s3.ts +34 -0
  36. package/src/actions/sns.ts +5 -0
  37. package/src/actions/sqs.ts +15 -0
  38. package/src/codegen/__snapshots__/snapshot.test.ts.snap +20 -20
  39. package/src/codegen/docs-links.test.ts +143 -0
  40. package/src/codegen/docs.ts +294 -124
  41. package/src/codegen/generate-lexicon.ts +8 -0
  42. package/src/codegen/generate-typescript.ts +25 -1
  43. package/src/codegen/generate.ts +1 -13
  44. package/src/codegen/package.ts +2 -0
  45. package/src/codegen/typecheck.test.ts +1 -1
  46. package/src/composites/composites.test.ts +442 -0
  47. package/src/composites/fargate-alb.ts +253 -0
  48. package/src/composites/index.ts +20 -0
  49. package/src/composites/lambda-api.ts +20 -0
  50. package/src/composites/lambda-dynamodb.ts +64 -0
  51. package/src/composites/lambda-eventbridge.ts +36 -0
  52. package/src/composites/lambda-function.ts +76 -0
  53. package/src/composites/lambda-s3.ts +72 -0
  54. package/src/composites/lambda-sns.ts +30 -0
  55. package/src/composites/lambda-sqs.ts +44 -0
  56. package/src/composites/scheduled-lambda.ts +37 -0
  57. package/src/composites/vpc-default.ts +148 -0
  58. package/src/default-tags.test.ts +38 -0
  59. package/src/default-tags.ts +77 -0
  60. package/src/generated/index.d.ts +58525 -58501
  61. package/src/generated/index.ts +1351 -1351
  62. package/src/generated/lexicon-aws.json +9444 -4597
  63. package/src/import/generator.test.ts +5 -5
  64. package/src/import/generator.ts +4 -4
  65. package/src/import/roundtrip-fixtures.test.ts +2 -1
  66. package/src/import/roundtrip.test.ts +5 -5
  67. package/src/index.ts +21 -0
  68. package/src/integration.test.ts +92 -21
  69. package/src/intrinsics.ts +24 -13
  70. package/src/lint/post-synth/cf-refs.ts +99 -0
  71. package/src/lint/post-synth/ext001.test.ts +214 -31
  72. package/src/lint/post-synth/ext001.ts +32 -25
  73. package/src/lint/post-synth/waw013.test.ts +120 -0
  74. package/src/lint/post-synth/waw014.test.ts +121 -0
  75. package/src/lint/post-synth/waw015.test.ts +147 -0
  76. package/src/lint/post-synth/waw016.test.ts +141 -0
  77. package/src/lint/post-synth/waw016.ts +86 -0
  78. package/src/lint/post-synth/waw017.test.ts +130 -0
  79. package/src/lint/post-synth/waw017.ts +53 -0
  80. package/src/lint/post-synth/waw018.test.ts +109 -0
  81. package/src/lint/post-synth/waw018.ts +71 -0
  82. package/src/lint/post-synth/waw019.test.ts +138 -0
  83. package/src/lint/post-synth/waw019.ts +82 -0
  84. package/src/lint/post-synth/waw020.test.ts +125 -0
  85. package/src/lint/post-synth/waw020.ts +64 -0
  86. package/src/lint/post-synth/waw021.test.ts +81 -0
  87. package/src/lint/post-synth/waw021.ts +53 -0
  88. package/src/lint/post-synth/waw022.test.ts +54 -0
  89. package/src/lint/post-synth/waw022.ts +43 -0
  90. package/src/lint/post-synth/waw023.test.ts +53 -0
  91. package/src/lint/post-synth/waw023.ts +47 -0
  92. package/src/lint/post-synth/waw024.test.ts +64 -0
  93. package/src/lint/post-synth/waw024.ts +54 -0
  94. package/src/lint/post-synth/waw025.test.ts +42 -0
  95. package/src/lint/post-synth/waw025.ts +43 -0
  96. package/src/lint/post-synth/waw026.test.ts +54 -0
  97. package/src/lint/post-synth/waw026.ts +46 -0
  98. package/src/lint/post-synth/waw027.test.ts +63 -0
  99. package/src/lint/post-synth/waw027.ts +50 -0
  100. package/src/lint/post-synth/waw028.test.ts +68 -0
  101. package/src/lint/post-synth/waw028.ts +47 -0
  102. package/src/lint/post-synth/waw029.test.ts +179 -0
  103. package/src/lint/post-synth/waw029.ts +62 -0
  104. package/src/lint/post-synth/waw030.test.ts +800 -0
  105. package/src/lint/post-synth/waw030.ts +246 -0
  106. package/src/lint/rules/hardcoded-region.ts +1 -0
  107. package/src/lint/rules/iam-wildcard.ts +1 -0
  108. package/src/lint/rules/rules.test.ts +8 -8
  109. package/src/lint/rules/s3-encryption.ts +3 -3
  110. package/src/lsp/completions.ts +2 -0
  111. package/src/lsp/hover.ts +17 -0
  112. package/src/nested-stack-integration.test.ts +100 -0
  113. package/src/nested-stack.ts +2 -2
  114. package/src/plugin.test.ts +13 -15
  115. package/src/plugin.ts +552 -114
  116. package/src/serializer.test.ts +370 -43
  117. package/src/serializer.ts +69 -17
  118. package/src/spec/fetch.ts +10 -0
  119. package/src/spec/parse.test.ts +141 -0
  120. package/src/spec/parse.ts +40 -0
  121. package/src/taggable.ts +44 -0
  122. package/src/testdata/nested-stacks/app.ts +26 -0
  123. package/src/testdata/nested-stacks/network/outputs.ts +17 -0
  124. package/src/testdata/nested-stacks/network/security.ts +17 -0
  125. package/src/testdata/nested-stacks/network/vpc.ts +54 -0
  126. package/dist/skills/aws-cloudformation.md +0 -41
  127. package/src/codegen/rollback.test.ts +0 -80
  128. package/src/codegen/rollback.ts +0 -20
@@ -1,80 +0,0 @@
1
- import { describe, test, expect } from "bun:test";
2
- import { mkdirSync, writeFileSync, rmSync, readFileSync } from "fs";
3
- import { join } from "path";
4
- import { tmpdir } from "os";
5
- import { snapshotArtifacts, saveSnapshot, restoreSnapshot, listSnapshots } from "./rollback";
6
-
7
- function makeTempDir(): string {
8
- const dir = join(tmpdir(), `chant-rollback-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
9
- mkdirSync(dir, { recursive: true });
10
- return dir;
11
- }
12
-
13
- describe("rollback", () => {
14
- test("snapshot captures generated files", () => {
15
- const dir = makeTempDir();
16
- const genDir = join(dir, "generated");
17
- mkdirSync(genDir, { recursive: true });
18
-
19
- writeFileSync(join(genDir, "lexicon-aws.json"), '{"Bucket":{"kind":"resource"}}');
20
- writeFileSync(join(genDir, "index.d.ts"), "declare class Bucket {}");
21
- writeFileSync(join(genDir, "index.ts"), "export const Bucket = {};");
22
-
23
- const snapshot = snapshotArtifacts(genDir);
24
- expect(snapshot.files["lexicon-aws.json"]).toBeDefined();
25
- expect(snapshot.files["index.d.ts"]).toBeDefined();
26
- expect(snapshot.files["index.ts"]).toBeDefined();
27
- expect(snapshot.hashes["lexicon-aws.json"]).toBeDefined();
28
- expect(snapshot.resourceCount).toBe(1);
29
-
30
- rmSync(dir, { recursive: true, force: true });
31
- });
32
-
33
- test("save and list snapshots", () => {
34
- const dir = makeTempDir();
35
- const snapshotsDir = join(dir, ".snapshots");
36
-
37
- const snapshot = {
38
- timestamp: "2025-01-01T00:00:00.000Z",
39
- files: { "test.json": "{}" },
40
- hashes: { "test.json": "abc123" },
41
- resourceCount: 0,
42
- };
43
-
44
- saveSnapshot(snapshot, snapshotsDir);
45
- const list = listSnapshots(snapshotsDir);
46
- expect(list.length).toBe(1);
47
- expect(list[0].timestamp).toBe("2025-01-01T00:00:00.000Z");
48
-
49
- rmSync(dir, { recursive: true, force: true });
50
- });
51
-
52
- test("restore snapshot overwrites generated files", () => {
53
- const dir = makeTempDir();
54
- const genDir = join(dir, "generated");
55
- const snapshotsDir = join(dir, ".snapshots");
56
- mkdirSync(genDir, { recursive: true });
57
-
58
- // Write original files
59
- writeFileSync(join(genDir, "lexicon-aws.json"), '{"original":true}');
60
-
61
- // Snapshot them
62
- const snapshot = snapshotArtifacts(genDir);
63
- const snapshotPath = saveSnapshot(snapshot, snapshotsDir);
64
-
65
- // Overwrite with new content
66
- writeFileSync(join(genDir, "lexicon-aws.json"), '{"modified":true}');
67
- expect(readFileSync(join(genDir, "lexicon-aws.json"), "utf-8")).toBe('{"modified":true}');
68
-
69
- // Restore
70
- restoreSnapshot(snapshotPath, genDir);
71
- expect(readFileSync(join(genDir, "lexicon-aws.json"), "utf-8")).toBe('{"original":true}');
72
-
73
- rmSync(dir, { recursive: true, force: true });
74
- });
75
-
76
- test("listSnapshots returns empty for nonexistent dir", () => {
77
- const list = listSnapshots("/nonexistent/path");
78
- expect(list).toHaveLength(0);
79
- });
80
- });
@@ -1,20 +0,0 @@
1
- /**
2
- * Re-export from core with AWS-specific artifact names.
3
- */
4
- import {
5
- snapshotArtifacts as _snapshotArtifacts,
6
- saveSnapshot,
7
- restoreSnapshot,
8
- listSnapshots,
9
- } from "@intentius/chant/codegen/rollback";
10
- export type { ArtifactSnapshot, SnapshotInfo } from "@intentius/chant/codegen/rollback";
11
- export { saveSnapshot, restoreSnapshot, listSnapshots };
12
-
13
- const AWS_ARTIFACT_NAMES = ["lexicon-aws.json", "index.d.ts", "index.ts"];
14
-
15
- /**
16
- * Snapshot AWS lexicon artifacts.
17
- */
18
- export function snapshotArtifacts(generatedDir: string) {
19
- return _snapshotArtifacts(generatedDir, AWS_ARTIFACT_NAMES);
20
- }