@intentius/chant-lexicon-aws 0.0.6 → 0.0.8
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/integrity.json +7 -7
- package/dist/manifest.json +1 -1
- package/dist/meta.json +3701 -3701
- package/dist/rules/ext001.ts +2 -4
- package/dist/rules/s3-encryption.ts +2 -3
- package/dist/skills/chant-aws.md +72 -0
- package/dist/types/index.d.ts +57087 -57087
- package/package.json +1 -1
- package/src/codegen/__snapshots__/snapshot.test.ts.snap +18 -18
- package/src/codegen/docs.ts +59 -4
- package/src/codegen/generate.ts +1 -13
- package/src/codegen/package.ts +2 -0
- package/src/codegen/typecheck.test.ts +1 -1
- package/src/generated/index.d.ts +57087 -57087
- package/src/generated/index.ts +1351 -1351
- package/src/generated/lexicon-aws.json +3701 -3701
- package/src/import/generator.test.ts +5 -5
- package/src/import/generator.ts +4 -4
- package/src/import/roundtrip-fixtures.test.ts +2 -1
- package/src/import/roundtrip.test.ts +5 -5
- package/src/integration.test.ts +21 -21
- package/src/lint/post-synth/ext001.ts +2 -4
- package/src/lint/rules/rules.test.ts +8 -8
- package/src/lint/rules/s3-encryption.ts +2 -3
- package/src/lsp/completions.ts +2 -0
- package/src/lsp/hover.ts +2 -0
- package/src/nested-stack.ts +1 -1
- package/src/plugin.test.ts +13 -15
- package/src/plugin.ts +116 -110
- package/src/serializer.test.ts +42 -43
- package/src/serializer.ts +7 -16
- package/dist/skills/aws-cloudformation.md +0 -41
- package/src/codegen/rollback.test.ts +0 -80
- package/src/codegen/rollback.ts +0 -20
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`snapshot tests Bucket lexicon entry 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"attrs": {
|
|
6
|
-
"
|
|
6
|
+
"Arn": "Arn",
|
|
7
7
|
},
|
|
8
8
|
"createOnly": [
|
|
9
9
|
"BucketName",
|
|
@@ -27,7 +27,7 @@ exports[`snapshot tests Bucket lexicon entry 1`] = `
|
|
|
27
27
|
exports[`snapshot tests Function lexicon entry 1`] = `
|
|
28
28
|
{
|
|
29
29
|
"attrs": {
|
|
30
|
-
"
|
|
30
|
+
"Arn": "Arn",
|
|
31
31
|
},
|
|
32
32
|
"kind": "resource",
|
|
33
33
|
"lexicon": "aws",
|
|
@@ -79,8 +79,8 @@ exports[`snapshot tests Function lexicon entry 1`] = `
|
|
|
79
79
|
exports[`snapshot tests Role lexicon entry 1`] = `
|
|
80
80
|
{
|
|
81
81
|
"attrs": {
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"Arn": "Arn",
|
|
83
|
+
"RoleId": "RoleId",
|
|
84
84
|
},
|
|
85
85
|
"kind": "resource",
|
|
86
86
|
"lexicon": "aws",
|
|
@@ -160,17 +160,17 @@ exports[`snapshot tests Bucket .d.ts class declaration 1`] = `
|
|
|
160
160
|
"export declare class Bucket {
|
|
161
161
|
constructor(props: {
|
|
162
162
|
/** A name for the bucket. */
|
|
163
|
-
|
|
163
|
+
BucketName: string;
|
|
164
164
|
/** The Amazon Resource Name (ARN) of the bucket. */
|
|
165
|
-
|
|
165
|
+
Arn?: string;
|
|
166
166
|
/** Specifies default encryption for a bucket. */
|
|
167
|
-
|
|
167
|
+
BucketEncryption?: Bucket_BucketEncryption;
|
|
168
168
|
/** An arbitrary set of tags (key-value pairs) for this S3 bucket. */
|
|
169
|
-
|
|
169
|
+
Tags?: Bucket_Tag[];
|
|
170
170
|
/** Enables multiple versions of all objects in this bucket. */
|
|
171
|
-
|
|
171
|
+
VersioningConfiguration?: Bucket_VersioningConfiguration;
|
|
172
172
|
});
|
|
173
|
-
readonly
|
|
173
|
+
readonly Arn: string;
|
|
174
174
|
}"
|
|
175
175
|
`;
|
|
176
176
|
|
|
@@ -178,20 +178,20 @@ exports[`snapshot tests Function .d.ts class declaration 1`] = `
|
|
|
178
178
|
"export declare class Function {
|
|
179
179
|
constructor(props: {
|
|
180
180
|
/** The code for the function. */
|
|
181
|
-
|
|
181
|
+
Code: Function_Code;
|
|
182
182
|
/** The ARN of the function's execution role. */
|
|
183
|
-
|
|
183
|
+
Role: string;
|
|
184
184
|
/** The ARN of the function. */
|
|
185
|
-
|
|
185
|
+
Arn?: string;
|
|
186
186
|
/** The name of the Lambda function. */
|
|
187
|
-
|
|
187
|
+
FunctionName?: string;
|
|
188
188
|
/** The name of the method within your code that Lambda calls to run your function. */
|
|
189
|
-
|
|
189
|
+
Handler?: string;
|
|
190
190
|
/** The amount of memory available to the function at runtime. */
|
|
191
|
-
|
|
191
|
+
MemorySize?: number;
|
|
192
192
|
/** The identifier of the function's runtime. */
|
|
193
|
-
|
|
193
|
+
Runtime?: "java17" | "java21" | "nodejs18.x" | "nodejs20.x" | "python3.11" | "python3.12";
|
|
194
194
|
});
|
|
195
|
-
readonly
|
|
195
|
+
readonly Arn: string;
|
|
196
196
|
}"
|
|
197
197
|
`;
|
package/src/codegen/docs.ts
CHANGED
|
@@ -152,7 +152,7 @@ Produces this CloudFormation resource:
|
|
|
152
152
|
}
|
|
153
153
|
\`\`\`
|
|
154
154
|
|
|
155
|
-
Notice how \`dataBucket\` becomes \`DataBucket\` (PascalCase logical ID)
|
|
155
|
+
Notice how \`dataBucket\` becomes \`DataBucket\` (PascalCase logical ID). Property names like \`BucketName\` use the CloudFormation spec-native PascalCase directly.
|
|
156
156
|
|
|
157
157
|
## Resource types and naming
|
|
158
158
|
|
|
@@ -517,7 +517,7 @@ Pass CloudFormation Parameters to child stacks with the \`parameters\` option:
|
|
|
517
517
|
\`\`\`typescript
|
|
518
518
|
import { nestedStack } from "@intentius/chant-lexicon-aws";
|
|
519
519
|
|
|
520
|
-
const network = nestedStack("network", import.meta.
|
|
520
|
+
const network = nestedStack("network", import.meta.dirname + "/network", {
|
|
521
521
|
parameters: { Environment: "prod", CidrBlock: "10.0.0.0/16" },
|
|
522
522
|
});
|
|
523
523
|
\`\`\`
|
|
@@ -739,8 +739,8 @@ src/
|
|
|
739
739
|
**Patterns demonstrated:**
|
|
740
740
|
|
|
741
741
|
1. **Direct imports** — lexicon types come from \`@intentius/chant-lexicon-aws\`, sibling exports are imported from the file that defines them
|
|
742
|
-
2. **Shared defaults** — \`defaults.ts\` exports reusable property objects (\`
|
|
743
|
-
3. **Cross-resource references** — \`dataBucket.
|
|
742
|
+
2. **Shared defaults** — \`defaults.ts\` exports reusable property objects (\`BucketEncryption\`, \`PublicAccessBlockConfiguration\`) that other files import directly
|
|
743
|
+
3. **Cross-resource references** — \`dataBucket.Arn\` in \`handler.ts\` serializes to \`Fn::GetAtt\` in the template
|
|
744
744
|
4. **Intrinsics** — \`Sub\` tagged templates with pseudo-parameters for dynamic naming
|
|
745
745
|
|
|
746
746
|
{{file:getting-started/src/handler.ts}}
|
|
@@ -798,6 +798,61 @@ src/
|
|
|
798
798
|
|
|
799
799
|
See [Nested Stacks](./nested-stacks) for the full guide.`,
|
|
800
800
|
},
|
|
801
|
+
{
|
|
802
|
+
slug: "skills",
|
|
803
|
+
title: "AI Skills",
|
|
804
|
+
description: "AI agent skills bundled with the AWS CloudFormation lexicon",
|
|
805
|
+
content: `The AWS lexicon ships an AI skill called **chant-aws** that teaches AI coding agents (like Claude Code) how to build, validate, and deploy CloudFormation templates from a chant project.
|
|
806
|
+
|
|
807
|
+
## What are skills?
|
|
808
|
+
|
|
809
|
+
Skills are structured markdown documents bundled with a lexicon. When an AI agent works in a chant project, it discovers and loads relevant skills automatically — giving it operational knowledge about the deployment workflow without requiring the user to explain each step.
|
|
810
|
+
|
|
811
|
+
## Installation
|
|
812
|
+
|
|
813
|
+
When you scaffold a new project with \`chant init --lexicon aws\`, the skill is installed to \`.claude/skills/chant-aws/SKILL.md\` for automatic discovery by Claude Code.
|
|
814
|
+
|
|
815
|
+
For existing projects, create the file manually:
|
|
816
|
+
|
|
817
|
+
\`\`\`
|
|
818
|
+
.claude/
|
|
819
|
+
skills/
|
|
820
|
+
chant-aws/
|
|
821
|
+
SKILL.md # skill content (see below)
|
|
822
|
+
\`\`\`
|
|
823
|
+
|
|
824
|
+
## Skill: chant-aws
|
|
825
|
+
|
|
826
|
+
The \`chant-aws\` skill covers the full deployment lifecycle:
|
|
827
|
+
|
|
828
|
+
- **Build** — \`chant build src/ --output stack.json\`
|
|
829
|
+
- **Validate** — \`chant lint src/\` + \`aws cloudformation validate-template\`
|
|
830
|
+
- **Deploy** — \`aws cloudformation deploy\` with capabilities
|
|
831
|
+
- **Update** — change sets for preview, or direct deploy
|
|
832
|
+
- **Delete** — \`aws cloudformation delete-stack\`
|
|
833
|
+
- **Status** — \`describe-stacks\` and \`describe-stack-events\`
|
|
834
|
+
- **Troubleshooting** — event inspection, rollback recovery, drift detection
|
|
835
|
+
|
|
836
|
+
The skill is invocable as a slash command: \`/chant-aws\`
|
|
837
|
+
|
|
838
|
+
## MCP integration
|
|
839
|
+
|
|
840
|
+
The lexicon also provides MCP (Model Context Protocol) tools and resources that AI agents can use programmatically:
|
|
841
|
+
|
|
842
|
+
| MCP tool | Description |
|
|
843
|
+
|----------|-------------|
|
|
844
|
+
| \`build\` | Build the chant project |
|
|
845
|
+
| \`lint\` | Run lint rules |
|
|
846
|
+
| \`explain\` | Summarize project resources |
|
|
847
|
+
| \`scaffold\` | Generate starter files |
|
|
848
|
+
| \`search\` | Search available resource types |
|
|
849
|
+
| \`aws:diff\` | Compare current build output against previous |
|
|
850
|
+
|
|
851
|
+
| MCP resource | Description |
|
|
852
|
+
|--------------|-------------|
|
|
853
|
+
| \`resource-catalog\` | JSON list of all supported CloudFormation resource types |
|
|
854
|
+
| \`examples/basic-stack\` | Example stack with S3 bucket and IAM role |`,
|
|
855
|
+
},
|
|
801
856
|
],
|
|
802
857
|
};
|
|
803
858
|
|
package/src/codegen/generate.ts
CHANGED
|
@@ -152,17 +152,6 @@ export function writeGeneratedFiles(result: GenerateResult, baseDir: string): vo
|
|
|
152
152
|
"",
|
|
153
153
|
].join("\n"),
|
|
154
154
|
},
|
|
155
|
-
snapshot: (generatedDir) => {
|
|
156
|
-
const { snapshotArtifacts, saveSnapshot } = require("./rollback");
|
|
157
|
-
const lexiconPath = join(generatedDir, "lexicon-aws.json");
|
|
158
|
-
if (existsSync(lexiconPath)) {
|
|
159
|
-
const snapshot = snapshotArtifacts(generatedDir);
|
|
160
|
-
if (Object.keys(snapshot.files).length > 0) {
|
|
161
|
-
const snapshotsDir = join(baseDir, ".snapshots");
|
|
162
|
-
saveSnapshot(snapshot, snapshotsDir);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
155
|
});
|
|
167
156
|
}
|
|
168
157
|
|
|
@@ -184,8 +173,7 @@ function generateRuntimeIndex(
|
|
|
184
173
|
// Build attrs map
|
|
185
174
|
const attrs: Record<string, string> = {};
|
|
186
175
|
for (const a of r.resource.attributes) {
|
|
187
|
-
|
|
188
|
-
attrs[camelName] = a.name;
|
|
176
|
+
attrs[a.name] = a.name;
|
|
189
177
|
}
|
|
190
178
|
|
|
191
179
|
resourceEntries.push({ tsName, resourceType: cfnType, attrs });
|
package/src/codegen/package.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* with AWS-specific manifest building and skill collection.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { createRequire } from "module";
|
|
6
7
|
import { readFileSync } from "fs";
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
7
9
|
import { join, dirname } from "path";
|
|
8
10
|
import { fileURLToPath } from "url";
|
|
9
11
|
import type { IntrinsicDef } from "@intentius/chant/lexicon";
|