alchemy 0.1.11 → 0.1.12

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 (277) hide show
  1. package/README.md +324 -0
  2. package/lib/apply.d.ts +2 -2
  3. package/lib/apply.d.ts.map +1 -1
  4. package/lib/apply.js +2 -2
  5. package/lib/apply.js.map +1 -1
  6. package/lib/aws/index.d.ts +1 -0
  7. package/lib/aws/index.d.ts.map +1 -1
  8. package/lib/aws/index.js +1 -0
  9. package/lib/aws/index.js.map +1 -1
  10. package/lib/aws/ses.d.ts +75 -0
  11. package/lib/aws/ses.d.ts.map +1 -0
  12. package/lib/aws/ses.js +197 -0
  13. package/lib/aws/ses.js.map +1 -0
  14. package/lib/cloudflare/api.d.ts +84 -0
  15. package/lib/cloudflare/api.d.ts.map +1 -0
  16. package/lib/cloudflare/api.js +178 -0
  17. package/lib/cloudflare/api.js.map +1 -0
  18. package/lib/cloudflare/asset-manifest.d.ts +15 -0
  19. package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
  20. package/lib/cloudflare/asset-manifest.js +2 -0
  21. package/lib/cloudflare/asset-manifest.js.map +1 -0
  22. package/lib/cloudflare/auth.d.ts +52 -0
  23. package/lib/cloudflare/auth.d.ts.map +1 -0
  24. package/lib/cloudflare/auth.js +114 -0
  25. package/lib/cloudflare/auth.js.map +1 -0
  26. package/lib/cloudflare/bindings.d.ts +244 -0
  27. package/lib/cloudflare/bindings.d.ts.map +1 -0
  28. package/lib/cloudflare/bindings.js +7 -0
  29. package/lib/cloudflare/bindings.js.map +1 -0
  30. package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
  31. package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
  32. package/lib/cloudflare/generate-asset-manifest.js +69 -0
  33. package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
  34. package/lib/cloudflare/index.d.ts +6 -0
  35. package/lib/cloudflare/index.d.ts.map +1 -0
  36. package/lib/cloudflare/index.js +6 -0
  37. package/lib/cloudflare/index.js.map +1 -0
  38. package/lib/cloudflare/kv-namespace.d.ts +61 -0
  39. package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
  40. package/lib/cloudflare/kv-namespace.js +93 -0
  41. package/lib/cloudflare/kv-namespace.js.map +1 -0
  42. package/lib/cloudflare/state.d.ts +83 -0
  43. package/lib/cloudflare/state.d.ts.map +1 -0
  44. package/lib/cloudflare/state.js +109 -0
  45. package/lib/cloudflare/state.js.map +1 -0
  46. package/lib/cloudflare/static-site-router.d.ts +10 -0
  47. package/lib/cloudflare/static-site-router.d.ts.map +1 -0
  48. package/lib/cloudflare/static-site-router.js +88 -0
  49. package/lib/cloudflare/static-site-router.js.map +1 -0
  50. package/lib/cloudflare/static-site.d.ts +166 -0
  51. package/lib/cloudflare/static-site.d.ts.map +1 -0
  52. package/lib/cloudflare/static-site.js +152 -0
  53. package/lib/cloudflare/static-site.js.map +1 -0
  54. package/lib/cloudflare/types.d.ts +52 -0
  55. package/lib/cloudflare/types.d.ts.map +1 -0
  56. package/lib/cloudflare/types.js +21 -0
  57. package/lib/cloudflare/types.js.map +1 -0
  58. package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
  59. package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
  60. package/lib/cloudflare/upload-asset-manifest.js +55 -0
  61. package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
  62. package/lib/cloudflare/worker.d.ts +87 -0
  63. package/lib/cloudflare/worker.d.ts.map +1 -0
  64. package/lib/cloudflare/worker.js +364 -0
  65. package/lib/cloudflare/worker.js.map +1 -0
  66. package/lib/esbuild.d.ts +82 -0
  67. package/lib/esbuild.d.ts.map +1 -1
  68. package/lib/esbuild.js +24 -17
  69. package/lib/esbuild.js.map +1 -1
  70. package/lib/fs.d.ts +1 -1
  71. package/lib/global.d.ts.map +1 -1
  72. package/lib/global.js +3 -1
  73. package/lib/global.js.map +1 -1
  74. package/lib/index.d.ts +0 -1
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/index.js +0 -1
  77. package/lib/index.js.map +1 -1
  78. package/lib/main.js +1 -1
  79. package/lib/main.js.map +1 -1
  80. package/lib/output.d.ts +17 -13
  81. package/lib/output.d.ts.map +1 -1
  82. package/lib/output.js +2 -2
  83. package/lib/output.js.map +1 -1
  84. package/lib/resource.d.ts +3 -2
  85. package/lib/resource.d.ts.map +1 -1
  86. package/lib/resource.js +2 -2
  87. package/lib/resource.js.map +1 -1
  88. package/lib/utils/content-type.d.ts +8 -0
  89. package/lib/utils/content-type.d.ts.map +1 -0
  90. package/lib/utils/content-type.js +41 -0
  91. package/lib/utils/content-type.js.map +1 -0
  92. package/package.json +26 -8
  93. package/src/apply.ts +5 -5
  94. package/src/aws/index.ts +1 -0
  95. package/src/aws/ses.ts +346 -0
  96. package/src/cloudflare/api.ts +276 -0
  97. package/src/cloudflare/asset-manifest.ts +16 -0
  98. package/src/cloudflare/auth.ts +187 -0
  99. package/src/cloudflare/bindings.ts +286 -0
  100. package/src/cloudflare/generate-asset-manifest.ts +93 -0
  101. package/src/cloudflare/index.ts +5 -0
  102. package/src/cloudflare/kv-namespace.ts +195 -0
  103. package/src/cloudflare/state.ts +138 -0
  104. package/src/cloudflare/static-site-router.ts +108 -0
  105. package/src/cloudflare/static-site.ts +379 -0
  106. package/src/cloudflare/types.ts +71 -0
  107. package/src/cloudflare/upload-asset-manifest.ts +83 -0
  108. package/src/cloudflare/worker.ts +568 -0
  109. package/src/esbuild.ts +31 -22
  110. package/src/global.ts +1 -0
  111. package/src/index.ts +0 -1
  112. package/src/main.ts +1 -1
  113. package/src/output.ts +32 -32
  114. package/src/resource.ts +11 -5
  115. package/src/utils/content-type.ts +42 -0
  116. package/lib/$.d.ts +0 -7
  117. package/lib/$.d.ts.map +0 -1
  118. package/lib/$.js +0 -31
  119. package/lib/$.js.map +0 -1
  120. package/lib/agent/ai.d.ts +0 -40
  121. package/lib/agent/ai.d.ts.map +0 -1
  122. package/lib/agent/ai.js +0 -132
  123. package/lib/agent/ai.js.map +0 -1
  124. package/lib/agent/anthropic.d.ts +0 -9
  125. package/lib/agent/anthropic.d.ts.map +0 -1
  126. package/lib/agent/anthropic.js +0 -25
  127. package/lib/agent/anthropic.js.map +0 -1
  128. package/lib/agent/dependencies.d.ts +0 -4
  129. package/lib/agent/dependencies.d.ts.map +0 -1
  130. package/lib/agent/dependencies.js +0 -48
  131. package/lib/agent/dependencies.js.map +0 -1
  132. package/lib/agent/file-context.d.ts +0 -13
  133. package/lib/agent/file-context.d.ts.map +0 -1
  134. package/lib/agent/file-context.js +0 -6
  135. package/lib/agent/file-context.js.map +0 -1
  136. package/lib/agent/index.d.ts +0 -10
  137. package/lib/agent/index.d.ts.map +0 -1
  138. package/lib/agent/index.js +0 -10
  139. package/lib/agent/index.js.map +0 -1
  140. package/lib/agent/model.d.ts +0 -8
  141. package/lib/agent/model.d.ts.map +0 -1
  142. package/lib/agent/model.js +0 -29
  143. package/lib/agent/model.js.map +0 -1
  144. package/lib/agent/module.d.ts +0 -81
  145. package/lib/agent/module.d.ts.map +0 -1
  146. package/lib/agent/module.js +0 -309
  147. package/lib/agent/module.js.map +0 -1
  148. package/lib/agent/openai.d.ts +0 -6
  149. package/lib/agent/openai.d.ts.map +0 -1
  150. package/lib/agent/openai.js +0 -41
  151. package/lib/agent/openai.js.map +0 -1
  152. package/lib/agent/program.d.ts +0 -12
  153. package/lib/agent/program.d.ts.map +0 -1
  154. package/lib/agent/program.js +0 -21
  155. package/lib/agent/program.js.map +0 -1
  156. package/lib/agent/prompts.d.ts +0 -4
  157. package/lib/agent/prompts.d.ts.map +0 -1
  158. package/lib/agent/prompts.js +0 -11
  159. package/lib/agent/prompts.js.map +0 -1
  160. package/lib/agent/scrape.d.ts +0 -71
  161. package/lib/agent/scrape.d.ts.map +0 -1
  162. package/lib/agent/scrape.js +0 -45
  163. package/lib/agent/scrape.js.map +0 -1
  164. package/lib/aws/auto/docs.d.ts +0 -11
  165. package/lib/aws/auto/docs.d.ts.map +0 -1
  166. package/lib/aws/auto/docs.js +0 -56
  167. package/lib/aws/auto/docs.js.map +0 -1
  168. package/lib/aws/auto/index.d.ts +0 -5
  169. package/lib/aws/auto/index.d.ts.map +0 -1
  170. package/lib/aws/auto/index.js +0 -5
  171. package/lib/aws/auto/index.js.map +0 -1
  172. package/lib/aws/auto/resource.d.ts +0 -24
  173. package/lib/aws/auto/resource.d.ts.map +0 -1
  174. package/lib/aws/auto/resource.js +0 -194
  175. package/lib/aws/auto/resource.js.map +0 -1
  176. package/lib/aws/auto/service.d.ts +0 -10
  177. package/lib/aws/auto/service.d.ts.map +0 -1
  178. package/lib/aws/auto/service.js +0 -34
  179. package/lib/aws/auto/service.js.map +0 -1
  180. package/lib/aws/auto/spec.d.ts +0 -83
  181. package/lib/aws/auto/spec.d.ts.map +0 -1
  182. package/lib/aws/auto/spec.js +0 -58
  183. package/lib/aws/auto/spec.js.map +0 -1
  184. package/lib/markdown/design.d.ts +0 -17
  185. package/lib/markdown/design.d.ts.map +0 -1
  186. package/lib/markdown/design.js +0 -92
  187. package/lib/markdown/design.js.map +0 -1
  188. package/lib/markdown/extract.d.ts +0 -7
  189. package/lib/markdown/extract.d.ts.map +0 -1
  190. package/lib/markdown/extract.js +0 -10
  191. package/lib/markdown/extract.js.map +0 -1
  192. package/lib/markdown/index.d.ts +0 -4
  193. package/lib/markdown/index.d.ts.map +0 -1
  194. package/lib/markdown/index.js +0 -4
  195. package/lib/markdown/index.js.map +0 -1
  196. package/lib/markdown/requirements.d.ts +0 -79
  197. package/lib/markdown/requirements.d.ts.map +0 -1
  198. package/lib/markdown/requirements.js +0 -105
  199. package/lib/markdown/requirements.js.map +0 -1
  200. package/lib/typescript/check-omission.d.ts +0 -2
  201. package/lib/typescript/check-omission.d.ts.map +0 -1
  202. package/lib/typescript/check-omission.js +0 -43
  203. package/lib/typescript/check-omission.js.map +0 -1
  204. package/lib/typescript/debug-type-errors.d.ts +0 -3
  205. package/lib/typescript/debug-type-errors.d.ts.map +0 -1
  206. package/lib/typescript/debug-type-errors.js +0 -35
  207. package/lib/typescript/debug-type-errors.js.map +0 -1
  208. package/lib/typescript/extract.d.ts +0 -7
  209. package/lib/typescript/extract.d.ts.map +0 -1
  210. package/lib/typescript/extract.js +0 -10
  211. package/lib/typescript/extract.js.map +0 -1
  212. package/lib/typescript/index.d.ts +0 -7
  213. package/lib/typescript/index.d.ts.map +0 -1
  214. package/lib/typescript/index.js +0 -7
  215. package/lib/typescript/index.js.map +0 -1
  216. package/lib/typescript/install-dependencies.d.ts +0 -29
  217. package/lib/typescript/install-dependencies.d.ts.map +0 -1
  218. package/lib/typescript/install-dependencies.js +0 -52
  219. package/lib/typescript/install-dependencies.js.map +0 -1
  220. package/lib/typescript/package.d.ts +0 -157
  221. package/lib/typescript/package.d.ts.map +0 -1
  222. package/lib/typescript/package.js +0 -115
  223. package/lib/typescript/package.js.map +0 -1
  224. package/lib/typescript/repair-omissions.d.ts +0 -3
  225. package/lib/typescript/repair-omissions.d.ts.map +0 -1
  226. package/lib/typescript/repair-omissions.js +0 -23
  227. package/lib/typescript/repair-omissions.js.map +0 -1
  228. package/lib/typescript/repair.d.ts +0 -3
  229. package/lib/typescript/repair.d.ts.map +0 -1
  230. package/lib/typescript/repair.js +0 -34
  231. package/lib/typescript/repair.js.map +0 -1
  232. package/lib/typescript/tsconfig.d.ts +0 -469
  233. package/lib/typescript/tsconfig.d.ts.map +0 -1
  234. package/lib/typescript/tsconfig.js +0 -143
  235. package/lib/typescript/tsconfig.js.map +0 -1
  236. package/lib/typescript/typescript.d.ts +0 -107
  237. package/lib/typescript/typescript.d.ts.map +0 -1
  238. package/lib/typescript/typescript.js +0 -180
  239. package/lib/typescript/typescript.js.map +0 -1
  240. package/lib/typescript/validate.d.ts +0 -10
  241. package/lib/typescript/validate.d.ts.map +0 -1
  242. package/lib/typescript/validate.js +0 -49
  243. package/lib/typescript/validate.js.map +0 -1
  244. package/src/$.ts +0 -36
  245. package/src/agent/ai.ts +0 -215
  246. package/src/agent/anthropic.ts +0 -31
  247. package/src/agent/dependencies.ts +0 -62
  248. package/src/agent/file-context.ts +0 -8
  249. package/src/agent/index.ts +0 -9
  250. package/src/agent/model.ts +0 -39
  251. package/src/agent/module.ts +0 -418
  252. package/src/agent/openai.ts +0 -50
  253. package/src/agent/program.md +0 -38
  254. package/src/agent/program.ts +0 -37
  255. package/src/agent/prompts.ts +0 -20
  256. package/src/agent/scrape.ts +0 -47
  257. package/src/aws/auto/cfn.json +0 -225310
  258. package/src/aws/auto/docs.ts +0 -73
  259. package/src/aws/auto/index.ts +0 -4
  260. package/src/aws/auto/resource.ts +0 -269
  261. package/src/aws/auto/service.ts +0 -51
  262. package/src/aws/auto/spec.ts +0 -160
  263. package/src/markdown/design.ts +0 -125
  264. package/src/markdown/extract.ts +0 -9
  265. package/src/markdown/index.ts +0 -3
  266. package/src/markdown/requirements.ts +0 -135
  267. package/src/typescript/check-omission.ts +0 -47
  268. package/src/typescript/debug-type-errors.ts +0 -42
  269. package/src/typescript/extract.ts +0 -9
  270. package/src/typescript/index.ts +0 -6
  271. package/src/typescript/install-dependencies.ts +0 -61
  272. package/src/typescript/package.ts +0 -143
  273. package/src/typescript/repair-omissions.ts +0 -31
  274. package/src/typescript/repair.ts +0 -45
  275. package/src/typescript/tsconfig.ts +0 -170
  276. package/src/typescript/typescript.ts +0 -217
  277. package/src/typescript/validate.ts +0 -73
@@ -1,45 +0,0 @@
1
- import { tool } from "ai";
2
- import TurndownService from "turndown";
3
- import { z } from "zod";
4
- export const scrapeWebPage = tool({
5
- description: "Scrapes a web page and converts HTML content to Markdown",
6
- parameters: z.object({
7
- url: z.string().url().describe("The URL to scrape content from"),
8
- turndownOptions: z
9
- .object({
10
- headingStyle: z.enum(["setext", "atx"]).optional(),
11
- hr: z.string().optional(),
12
- bulletListMarker: z.enum(["-", "*", "+"]).optional(),
13
- codeBlockStyle: z.enum(["indented", "fenced"]).optional(),
14
- emDelimiter: z.enum(["_", "*"]).optional(),
15
- strongDelimiter: z.enum(["__", "**"]).optional(),
16
- linkStyle: z.enum(["inlined", "referenced"]).optional(),
17
- linkReferenceStyle: z
18
- .enum(["full", "collapsed", "shortcut"])
19
- .optional(),
20
- })
21
- .optional()
22
- .describe("Custom options for Turndown HTML to Markdown conversion"),
23
- }),
24
- execute: async ({ url, turndownOptions }) => {
25
- console.log("Scraping web page:", url);
26
- try {
27
- // Fetch the page content
28
- const response = await fetch(url);
29
- if (!response.ok) {
30
- throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
31
- }
32
- // Get the HTML content
33
- const html = await response.text();
34
- // Initialize Turndown with options
35
- const turndownService = new TurndownService(turndownOptions);
36
- // Convert HTML to Markdown and return
37
- return turndownService.turndown(html);
38
- }
39
- catch (error) {
40
- console.error("Error scraping web page:", error);
41
- throw error;
42
- }
43
- },
44
- });
45
- //# sourceMappingURL=scrape.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrape.js","sourceRoot":"","sources":["../../src/agent/scrape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,eAAe,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,0DAA0D;IACvE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;QACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QAChE,eAAe,EAAE,CAAC;aACf,MAAM,CAAC;YACN,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;YAClD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACzB,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,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C;QACxC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YACjD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- declare const AWSDocReference_base: import("../../resource").Provider<"AWSDocReference", [props: {
2
- serviceName: string;
3
- resourceName: string;
4
- requirements: string;
5
- }], {
6
- content: string;
7
- }>;
8
- export declare class AWSDocReference extends AWSDocReference_base {
9
- }
10
- export {};
11
- //# sourceMappingURL=docs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/docs.ts"],"names":[],"mappings":";iBAUmB,MAAM;kBACL,MAAM;kBACN,MAAM;;aAGb,MAAM;;AAVnB,qBAAa,eAAgB,SAAQ,oBAmEpC;CAAG"}
@@ -1,56 +0,0 @@
1
- import TurndownService from "turndown";
2
- import { generateText } from "../../agent/ai";
3
- import { resolveModel } from "../../agent/model";
4
- import { Resource } from "../../resource";
5
- export class AWSDocReference extends Resource("AWSDocReference", async (ctx, props) => {
6
- if (ctx.event === "delete") {
7
- return;
8
- }
9
- const serviceNameLower = props.serviceName.toLowerCase();
10
- const url = `https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/${serviceNameLower}`;
11
- const response = await fetch(url);
12
- if (!response.ok) {
13
- throw new Error(`Failed to fetch ${url}: ${response.statusText}`);
14
- }
15
- const html = await response.text();
16
- const turndownService = new TurndownService({
17
- headingStyle: "atx",
18
- codeBlockStyle: "fenced",
19
- });
20
- const markdown = turndownService.turndown(html);
21
- // Use AI to analyze the docs and extract relevant API information
22
- const model = await resolveModel("gpt-4o");
23
- const apiSummary = await generateText({
24
- model,
25
- temperature: 0.1,
26
- messages: [
27
- {
28
- role: "system",
29
- content: "You are an expert at analyzing AWS SDK documentation and identifying relevant APIs for CloudFormation resource implementations.",
30
- },
31
- {
32
- role: "user",
33
- content: `Please analyze the AWS SDK v3 documentation for the ${props.serviceName} service and identify APIs that would be relevant for implementing the ${props.resourceName} resource's CRUD lifecycle.
34
-
35
- Requirements for the CRUD lifecycle:
36
- ${props.requirements}
37
-
38
- For each relevant API, extract:
39
- 1. The command name (e.g., CreateUserCOMmand, DeleteRoleCommand)
40
- 2. A brief description of what it does
41
- 3. The Input type name (e.g. CreateUserCommandInput)
42
- 4. The Output type name (e.g. CreateUserCommandOutput)
43
-
44
- Also include the written documentation for the API.
45
-
46
- Documentation:
47
- ${markdown}`,
48
- },
49
- ],
50
- });
51
- return {
52
- content: apiSummary.text,
53
- };
54
- }) {
55
- }
56
- //# sourceMappingURL=docs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/aws/auto/docs.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAgB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,OAAO,eAAgB,SAAQ,QAAQ,CAC3C,iBAAiB,EACjB,KAAK,EACH,GAAiC,EACjC,KAIC,EAGO,EAAE;IACV,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;IACzD,MAAM,GAAG,GAAG,iEAAiE,gBAAgB,EAAE,CAAC;IAEhG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC;QAC1C,YAAY,EAAE,KAAK;QACnB,cAAc,EAAE,QAAQ;KACzB,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEhD,kEAAkE;IAClE,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC;QACpC,KAAK;QACL,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EACL,iIAAiI;aACpI;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,uDAAuD,KAAK,CAAC,WAAW,0EAA0E,KAAK,CAAC,YAAY;;;EAGrL,KAAK,CAAC,YAAY;;;;;;;;;;;EAWlB,QAAQ,EAAE;aACH;SACF;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,IAAI;KACzB,CAAC;AACJ,CAAC,CACF;CAAG"}
@@ -1,5 +0,0 @@
1
- export * from "./docs";
2
- export * from "./resource";
3
- export * from "./service";
4
- export * from "./spec";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from "./docs";
2
- export * from "./resource";
3
- export * from "./service";
4
- export * from "./spec";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/aws/auto/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -1,24 +0,0 @@
1
- import { Requirements } from "../../markdown/requirements";
2
- import { TypeScriptFile } from "../../typescript";
3
- declare const AWSResource_base: import("../../resource").Provider<"cfn-resource", [props: import("./spec").ResourceSpec & {
4
- ServiceName: string;
5
- ResourceName: string;
6
- ResourceFQN: string;
7
- Properties: {
8
- [propertyName: string]: import("./spec").ResourceProperty & {
9
- Spec: import("./spec").PropertySpec;
10
- };
11
- };
12
- } & {
13
- ServiceName: string;
14
- requirementsDir: string;
15
- srcDir: string;
16
- rootDir: string;
17
- }], {
18
- requirements: Requirements;
19
- implementation: TypeScriptFile;
20
- } | undefined>;
21
- export declare class AWSResource extends AWSResource_base {
22
- }
23
- export {};
24
- //# sourceMappingURL=resource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/resource.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;;;;;;;;;;;iBAS/B,MAAM;qBACF,MAAM;YACf,MAAM;aACL,MAAM;;;;;AARrB,qBAAa,WAAY,SAAQ,gBAmMhC;CAAG"}
@@ -1,194 +0,0 @@
1
- import { kebabCase } from "change-case";
2
- import fs from "node:fs/promises";
3
- import path from "node:path";
4
- import { z } from "zod";
5
- import { generateObject } from "../../agent/ai";
6
- import { resolveModel } from "../../agent/model";
7
- import { Requirements } from "../../markdown/requirements";
8
- import { Resource } from "../../resource";
9
- import { TypeScriptFile } from "../../typescript";
10
- import { AWSDocReference } from "./docs";
11
- export class AWSResource extends Resource("cfn-resource", async (ctx, props) => {
12
- if (ctx.event === "delete") {
13
- return;
14
- }
15
- // Load relevant Terraform provider implementation files for this resource
16
- const terraformServicePath = path.join(props.rootDir, "3p", "terraform-provider-aws", "internal", "service", props.ServiceName.toLowerCase());
17
- const files = await fs.readdir(terraformServicePath);
18
- const resourcePrefix = kebabCase(props.ResourceName).toLowerCase();
19
- const goFiles = files.filter((file) => file.endsWith(".go") && !file.endsWith("_test.go"));
20
- if (goFiles.length === 0) {
21
- throw new Error(`No Terraform implementation files found for resource ${props.ResourceName} in ${terraformServicePath}. Expected files starting with "${resourcePrefix}"`);
22
- }
23
- // Identify relevant files using AI
24
- const { relevantFiles } = await identifyRelevantFiles(props.ResourceName, props.ServiceName, goFiles, resourcePrefix, props);
25
- if (relevantFiles.length === 0) {
26
- throw new Error(`No relevant Terraform implementation files identified for resource ${props.ResourceName}`);
27
- }
28
- console.log(`Found ${relevantFiles.length} relevant files for ${props.ResourceFQN}:`);
29
- for (const file of relevantFiles) {
30
- console.log(` - ${file}`);
31
- }
32
- const fileContents = await Promise.all(relevantFiles.map(async (file) => {
33
- const content = await fs.readFile(path.join(terraformServicePath, file), "utf-8");
34
- return `// ${file}\n${content}`;
35
- }));
36
- const terraformImplementation = fileContents.join("\n\n");
37
- const requirements = new Requirements("requirements", {
38
- modelId: "o3-mini",
39
- reasoningEffort: "high",
40
- file: path.join(props.requirementsDir, kebabCase(props.ResourceName) + ".md"),
41
- requirements: [
42
- `Due to problems relying on the AWS CloudFormation Service, we have decided
43
- to reproduce the CRUD lifecycle of the ${props.ResourceName} resource locally using
44
- TypeScript and the AWS SDK v3.
45
-
46
- Before proceeding, we need to clearly define the requirements for this Resource's lifecycle handler, covering the following aspects:
47
- 1. Input and Output contract. These are the input properties that are accepted by CloudFormation
48
- and the output Attributes produced and referenceable after the resource has been created. Don't be lazy by just referencing the documentation, you should describe the property and its behavior explicitly in the requirements document.
49
- 2. Update lifecycle for each property. This determines the behavior of the CRUD lifecycle when
50
- a property changes, e.g. when a resource must be REPLACED when a property changes, or whether it can be mutated with a PUT.
51
- 3. AWS APIs that must be called to create this "CloudFormation Resource". This is not always 1:1, e.g. an IAM Role may have Policies that need to be created and attached.
52
- 4. Waiting for stabilization - AWS resources can take time to fully stabilize and be ready for use. Our Resource should wait and poll until the resource is ready. Please identify the resources that require stabilization check and which API call can be used to check the status reliably.
53
- Note: ideally, stabilization checks are performed downstream where they are used (i.e. optimistically instead of pessimistically), so we should analyze this Resource's upstream dependencies and define any checks that should be performed.
54
- 5. Create, Update and Delete lifecycle procedure. What operations should be performed on CREATE, UPDATE and DELETE?
55
- 6. Error handling. Point out specific error codes for AWS APIs that require special handling an describe how.
56
-
57
- Don't be vague. This is a specific requirements doc. Information like "robust" blah-blah is not relevant. Simply focus on the details of the AWS Resource, its contract, composite parts, error handling and lifecycle.
58
-
59
- Based on analysis of the Terraform AWS Provider implementation below, be sure to identify:
60
- - Important edge cases and error conditions that need special handling
61
- - API call patterns and sequences that have been proven to work
62
- - Stabilization and wait conditions that are necessary
63
- - Any specific error codes or scenarios that require retry logic or special handling
64
-
65
- Here is the relevant Terraform implementation:
66
- ${terraformImplementation}
67
-
68
- Below is the CloudFormation Resource Specification for the ${props.ResourceName} resource:
69
- ${JSON.stringify(props, null, 2)}
70
- `,
71
- ],
72
- });
73
- // First, fetch AWS SDK documentation
74
- const docReference = new AWSDocReference("docs", {
75
- serviceName: props.ServiceName,
76
- resourceName: props.ResourceName,
77
- requirements: requirements.content,
78
- });
79
- const exampleDir = path.join(props.rootDir, "alchemy", "src", "aws");
80
- const fewShotExamples = await Promise.all((await fs.readdir(exampleDir))
81
- .filter((file) => file.endsWith(".ts"))
82
- .map(async (file) => {
83
- const content = await fs.readFile(path.join(exampleDir, file), "utf-8");
84
- return `// ${file}\n${content}`;
85
- }));
86
- const implementation = new TypeScriptFile("implementation", {
87
- modelId: "claude-3-5-sonnet-20241022",
88
- path: path.join(props.srcDir, kebabCase(props.ResourceName) + ".ts"),
89
- projectRoot: __dirname,
90
- typeCheck: true,
91
- requirements: requirements.content.apply((requirements) => docReference.content.apply((docs) => `Implement the ${props.ResourceName} using TypeScript and AWS SDK V3.
92
-
93
- Requirements:
94
- ${requirements}
95
-
96
- API SDK v3 Documentation:
97
- ${docs}
98
-
99
- Here is the Terraform Go implementation that we can learn from:
100
- ${terraformImplementation}
101
-
102
- Here are some examples of how this has been done before. Make sure to follow the same structure and style of defining input and output contracts as types and then export a class using the mixin pattern and implement the lifecycle as a function, using ctx.event to detect CREATE, UPDATE and DELETE events:
103
- ${fewShotExamples.join("\n")}
104
-
105
- One slight difference from the example is that the \`ignore\` and \`Resource\` functions should be imported from alchemy
106
-
107
- import { type Context, Resource, ignore } from "alchemy";
108
-
109
- Make sure to add an explicit type for Context<T>
110
-
111
- async (ctx: Context<OutputType>, props: InputType) => Promise<OutputType> { .. }
112
-
113
- It must be the OutputType. This avoids problems like it ctx.output being \`unknown\`.
114
-
115
- Another common gotcha is that ctx.outputs only exists when ctx.event is update | delete. You will get type error when it is create.
116
-
117
- For reference, here is what the Context object looks like:
118
- export type Context<Outputs> = {
119
- stage: string;
120
- resourceID: ResourceID;
121
- scope: IScope;
122
- /**
123
- * Indicate that this resource is being replaced.
124
- * This will cause the resource to be deleted at the end of the stack's CREATE phase.
125
- */
126
- replace(): void;
127
- } & (
128
- | {
129
- event: "create";
130
- }
131
- | {
132
- event: "update" | "delete";
133
- output: Outputs;
134
- }
135
- );
136
- `)),
137
- });
138
- return {
139
- requirements,
140
- implementation,
141
- };
142
- }) {
143
- }
144
- const RelevantFilesSchema = z.object({
145
- /**
146
- * List of Go file names that are relevant for implementing the CRUD lifecycle
147
- * for this resource
148
- */
149
- relevantFiles: z.array(z.string()),
150
- });
151
- async function identifyRelevantFiles(resourceName, serviceName, files, resourcePrefix, cfnSpec) {
152
- const model = await resolveModel("gpt-4o");
153
- const result = await generateObject({
154
- model,
155
- schema: RelevantFilesSchema,
156
- temperature: 0.1,
157
- messages: [
158
- {
159
- role: "system",
160
- content: "You are an expert at AWS service implementations and Go code analysis. Your task is to identify ONLY the Go files that are specifically implementing the given AWS resource's CRUD lifecycle, excluding any files that work with other resources.",
161
- },
162
- {
163
- role: "user",
164
- content: `Please identify which Go files are specifically implementing the CRUD lifecycle for the AWS::${serviceName}::${resourceName} resource.
165
-
166
- Available files (all in the ${serviceName.toLowerCase()} package):
167
- ${files.map((f) => `- ${f}`).join("\n")}
168
-
169
- CloudFormation Resource Specification:
170
- ${JSON.stringify(cfnSpec, null, 2)}
171
-
172
- Selection Rules:
173
- 1. ONLY select files that are specifically implementing this exact resource type (AWS::${serviceName}::${resourceName})
174
- 2. Files must handle one or more of:
175
- - Resource creation and deletion
176
- - Resource updates and modifications
177
- - Resource state checking and stabilization
178
- - Resource validation
179
- 3. Strict Exclusions:
180
- - Test files
181
- - Files working with other resource types
182
- - General utility files (unless they are ONLY used by this resource)
183
- - Files that just happen to share a similar prefix but work with different resources
184
- 4. Files should start with the prefix: ${resourcePrefix}
185
-
186
- Important: Be very strict about only including files that are specifically working with this exact resource type. If a file works with multiple resources or similar resources, exclude it unless it's absolutely essential for this resource's implementation.
187
-
188
- Return ONLY the list of relevant file names.`,
189
- },
190
- ],
191
- });
192
- return result.object;
193
- }
194
- //# sourceMappingURL=resource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../src/aws/auto/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAA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M,CAAC;IACnC;;;OAGG;IACH,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACnC,CAAC,CAAC;AAEH,KAAK,UAAU,qBAAqB,CAClC,YAAoB,EACpB,WAAmB,EACnB,KAAe,EACf,cAAsB,EACtB,OAAoB;IAEpB,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAE3C,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;QAClC,KAAK;QACL,MAAM,EAAE,mBAAmB;QAC3B,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,QAAQ;gBACd,OAAO,EACL,mPAAmP;aACtP;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,gGAAgG,WAAW,KAAK,YAAY;;8BAE/G,WAAW,CAAC,WAAW,EAAE;EACrD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;EAGrC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;;yFAGuD,WAAW,KAAK,YAAY;;;;;;;;;;;yCAW5E,cAAc;;;;6CAIV;aACtC;SACF;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { CfnService } from "./spec";
2
- declare const AWSService_base: import("../../resource").Provider<"aws-service", [props: CfnService & {
3
- requirementsDir: string;
4
- srcDir: string;
5
- rootDir: string;
6
- }], unknown>;
7
- export declare class AWSService extends AWSService_base {
8
- }
9
- export {};
10
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/aws/auto/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;;qBAOlB,MAAM;YACf,MAAM;aACL,MAAM;;AAPrB,qBAAa,UAAW,SAAQ,eA2C/B;CAAG"}
@@ -1,34 +0,0 @@
1
- import { kebabCase } from "change-case";
2
- import path from "node:path";
3
- import { Folder } from "../../fs";
4
- import { Resource } from "../../resource";
5
- import { AWSResource } from "./resource";
6
- export class AWSService extends Resource("aws-service", async (ctx, props) => {
7
- const serviceDir = new Folder("service", path.join(props.requirementsDir, kebabCase(props.ServiceName))).path;
8
- const srcDir = new Folder("src", path.join(props.srcDir, kebabCase(props.ServiceName))).path;
9
- const resources = Object.entries(props.Resources);
10
- if (process.env.DEBUG) {
11
- // Only instantiate first resource in debug mode
12
- const [resourceName, resource] = resources[0];
13
- return [
14
- new AWSResource(resourceName, {
15
- ...resource,
16
- ServiceName: props.ServiceName,
17
- requirementsDir: serviceDir,
18
- srcDir,
19
- rootDir: props.rootDir,
20
- }),
21
- ];
22
- }
23
- return resources.map(([resourceName, resource]) => {
24
- return new AWSResource(resourceName, {
25
- ...resource,
26
- ServiceName: props.ServiceName,
27
- rootDir: props.rootDir,
28
- srcDir,
29
- requirementsDir: serviceDir,
30
- });
31
- });
32
- }) {
33
- }
34
- //# sourceMappingURL=service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/aws/auto/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,OAAO,UAAW,SAAQ,QAAQ,CACtC,aAAa,EACb,KAAK,EACH,GAAG,EACH,KAIC,EACD,EAAE;IACF,MAAM,UAAU,GAAG,IAAI,MAAM,CAC3B,SAAS,EACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAC/D,CAAC,IAAI,CAAC;IACP,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,KAAK,EACL,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CACtD,CAAC,IAAI,CAAC;IAEP,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACtB,gDAAgD;QAChD,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAO;YACL,IAAI,WAAW,CAAC,YAAY,EAAE;gBAC5B,GAAG,QAAQ;gBACX,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,eAAe,EAAE,UAAU;gBAC3B,MAAM;gBACN,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC;SACH,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,EAAE;QAChD,OAAO,IAAI,WAAW,CAAC,YAAY,EAAE;YACnC,GAAG,QAAQ;YACX,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM;YACN,eAAe,EAAE,UAAU;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CACF;CAAG"}
@@ -1,83 +0,0 @@
1
- export interface CfnSpec {
2
- PropertyTypes: {
3
- [propertyFQN: `${keyof CfnSpec["ResourceTypes"]}.${string}`]: PropertySpec;
4
- };
5
- ResourceTypes: {
6
- [key: `AWS::${string}::${string}`]: ResourceSpec;
7
- };
8
- ResourceSpecificationVersion: string;
9
- }
10
- export type UpdateType = "Immutable" | "Mutable" | "Conditional";
11
- export type PrimitiveType = "String" | "Double" | "Integer" | "Json";
12
- export type PropertySpec = {
13
- Type?: never;
14
- PrimitiveType?: never;
15
- Documentation: string;
16
- Properties: {
17
- [propertyName: string]: {
18
- Documentation: string;
19
- Type: "Extensions" | "Subject";
20
- UpdateType: UpdateType;
21
- Required: boolean;
22
- };
23
- };
24
- } | {
25
- Type: "List" | "Map";
26
- PrimitiveType?: PrimitiveType;
27
- Required: boolean;
28
- ItemType: string;
29
- UpdateType: UpdateType;
30
- } | {
31
- Type?: never;
32
- PrimitiveType: PrimitiveType;
33
- Documentation: string;
34
- UpdateType: UpdateType;
35
- Required: boolean;
36
- };
37
- export type ResourceProperty = {
38
- [propertyName: string]: {
39
- Documentation: string;
40
- UpdateType: UpdateType;
41
- Required: boolean;
42
- } & ({
43
- Type: string;
44
- PrimitiveType?: never;
45
- } | {
46
- Type: "List";
47
- ItemType?: string;
48
- PrimitiveItemType?: PrimitiveType;
49
- DuplicatesAllowed: boolean;
50
- } | {
51
- Type?: never;
52
- PrimitiveType: PrimitiveType;
53
- });
54
- };
55
- export type ResourceSpec = {
56
- Documentation: string;
57
- Properties: ResourceProperty;
58
- Attributes?: {
59
- [attributeName: string]: {
60
- PrimitiveType: PrimitiveType;
61
- };
62
- };
63
- };
64
- export type CfnResource = ResourceSpec & {
65
- ServiceName: string;
66
- ResourceName: string;
67
- ResourceFQN: string;
68
- Properties: {
69
- [propertyName: string]: ResourceProperty & {
70
- Spec: PropertySpec;
71
- };
72
- };
73
- };
74
- export type CfnService = {
75
- ServiceName: string;
76
- Resources: {
77
- [resourceName: string]: CfnResource;
78
- };
79
- };
80
- export type CfnServices = Record<string, CfnService>;
81
- export declare function loadServices(): Promise<CfnServices>;
82
- export declare function loadSpec(): Promise<CfnSpec>;
83
- //# sourceMappingURL=spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec.d.ts","sourceRoot":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CAAC,OAAO,CAAC,CAcjD"}
@@ -1,58 +0,0 @@
1
- import path from "node:path";
2
- export async function loadServices() {
3
- const cfnSpec = await loadSpec();
4
- const resources = Object.keys(cfnSpec.ResourceTypes).map((resourceType) => {
5
- const [partition, service, resource] = resourceType.split("::");
6
- return {
7
- partition,
8
- service,
9
- resource,
10
- };
11
- });
12
- const awsServices = resources.filter(({ partition }) => partition === "AWS");
13
- const awsServiceGroups = awsServices.reduce((acc, service) => {
14
- if (!acc[service.service]) {
15
- acc[service.service] = {
16
- ServiceName: service.service,
17
- Resources: {},
18
- };
19
- }
20
- const spec = {
21
- ...cfnSpec.ResourceTypes[`AWS::${service.service}::${service.resource}`],
22
- ServiceName: service.service,
23
- ResourceName: service.resource,
24
- ResourceFQN: `AWS::${service.service}::${service.resource}`,
25
- };
26
- for (const [propertyName, property] of Object.entries(spec.Properties)) {
27
- if (property.Type && !["List", "Map"].includes(property.Type)) {
28
- const propFQN = `${spec.ResourceFQN}.${propertyName}`;
29
- const propertySpec = {
30
- ...cfnSpec.PropertyTypes[propFQN],
31
- PropertyFQN: propFQN,
32
- };
33
- // @ts-ignore
34
- property.Spec = propertySpec;
35
- if (propertySpec === undefined) {
36
- throw new Error(`Property ${propertyName} has no spec`);
37
- }
38
- }
39
- }
40
- acc[service.service].Resources[service.resource] = spec;
41
- return acc;
42
- }, {});
43
- return awsServiceGroups;
44
- }
45
- export async function loadSpec() {
46
- const awsSpecURL = "https://dnwj8swjjbsbt.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json";
47
- const specPath = path.join(__dirname, "cfn.json");
48
- let awsSpec;
49
- try {
50
- awsSpec = JSON.parse(await Bun.file(specPath).text());
51
- }
52
- catch {
53
- awsSpec = await (await fetch(awsSpecURL)).json();
54
- await Bun.write(specPath, JSON.stringify(awsSpec, null, 2));
55
- }
56
- return awsSpec;
57
- }
58
- //# sourceMappingURL=spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["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AAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,OAAkB,CAAC;AAC5B,CAAC"}
@@ -1,17 +0,0 @@
1
- import { type FileContext, type ModelId } from "../agent";
2
- export interface DesignInput {
3
- prompt: string;
4
- path: string;
5
- deps?: any[];
6
- model?: ModelId;
7
- dependencies: FileContext[];
8
- }
9
- export interface DesignOutput {
10
- path: string;
11
- content: string;
12
- }
13
- declare const Design_base: import("../resource").Provider<"design", [props: DesignInput], DesignOutput>;
14
- export declare class Design extends Design_base {
15
- }
16
- export {};
17
- //# sourceMappingURL=design.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/markdown/design.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,OAAO,EAIb,MAAM,UAAU,CAAC;AAMlB,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;;AAED,qBAAa,MAAO,SAAQ,WA+F3B;CAAG"}