alchemy 0.1.11 → 0.1.13
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/README.md +324 -0
- package/lib/$.d.ts +8 -3
- package/lib/$.d.ts.map +1 -1
- package/lib/$.js +38 -27
- package/lib/$.js.map +1 -1
- package/lib/alchemize.d.ts.map +1 -1
- package/lib/alchemize.js +7 -0
- package/lib/alchemize.js.map +1 -1
- package/lib/apply.d.ts +2 -2
- package/lib/apply.d.ts.map +1 -1
- package/lib/apply.js +3 -3
- package/lib/apply.js.map +1 -1
- package/lib/aws/index.d.ts +1 -0
- package/lib/aws/index.d.ts.map +1 -1
- package/lib/aws/index.js +1 -0
- package/lib/aws/index.js.map +1 -1
- package/lib/aws/ses.d.ts +75 -0
- package/lib/aws/ses.d.ts.map +1 -0
- package/lib/aws/ses.js +197 -0
- package/lib/aws/ses.js.map +1 -0
- package/lib/cloudflare/api.d.ts +88 -0
- package/lib/cloudflare/api.d.ts.map +1 -0
- package/lib/cloudflare/api.js +184 -0
- package/lib/cloudflare/api.js.map +1 -0
- package/lib/cloudflare/asset-manifest.d.ts +15 -0
- package/lib/cloudflare/asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/asset-manifest.js +2 -0
- package/lib/cloudflare/asset-manifest.js.map +1 -0
- package/lib/cloudflare/auth.d.ts +52 -0
- package/lib/cloudflare/auth.d.ts.map +1 -0
- package/lib/cloudflare/auth.js +114 -0
- package/lib/cloudflare/auth.js.map +1 -0
- package/lib/cloudflare/bindings.d.ts +254 -0
- package/lib/cloudflare/bindings.d.ts.map +1 -0
- package/lib/cloudflare/bindings.js +2 -0
- package/lib/cloudflare/bindings.js.map +1 -0
- package/lib/cloudflare/durable-object-namespace.d.ts +23 -0
- package/lib/cloudflare/durable-object-namespace.d.ts.map +1 -0
- package/lib/cloudflare/durable-object-namespace.js +26 -0
- package/lib/cloudflare/durable-object-namespace.js.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts +3 -0
- package/lib/cloudflare/generate-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/generate-asset-manifest.js +69 -0
- package/lib/cloudflare/generate-asset-manifest.js.map +1 -0
- package/lib/cloudflare/index.d.ts +7 -0
- package/lib/cloudflare/index.d.ts.map +1 -0
- package/lib/cloudflare/index.js +7 -0
- package/lib/cloudflare/index.js.map +1 -0
- package/lib/cloudflare/kv-namespace.d.ts +61 -0
- package/lib/cloudflare/kv-namespace.d.ts.map +1 -0
- package/lib/cloudflare/kv-namespace.js +93 -0
- package/lib/cloudflare/kv-namespace.js.map +1 -0
- package/lib/cloudflare/state.d.ts +83 -0
- package/lib/cloudflare/state.d.ts.map +1 -0
- package/lib/cloudflare/state.js +109 -0
- package/lib/cloudflare/state.js.map +1 -0
- package/lib/cloudflare/static-site-router.d.ts +19 -0
- package/lib/cloudflare/static-site-router.d.ts.map +1 -0
- package/lib/cloudflare/static-site-router.js +110 -0
- package/lib/cloudflare/static-site-router.js.map +1 -0
- package/lib/cloudflare/static-site.d.ts +166 -0
- package/lib/cloudflare/static-site.d.ts.map +1 -0
- package/lib/cloudflare/static-site.js +168 -0
- package/lib/cloudflare/static-site.js.map +1 -0
- package/lib/cloudflare/types.d.ts +52 -0
- package/lib/cloudflare/types.d.ts.map +1 -0
- package/lib/cloudflare/types.js +21 -0
- package/lib/cloudflare/types.js.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts +12 -0
- package/lib/cloudflare/upload-asset-manifest.d.ts.map +1 -0
- package/lib/cloudflare/upload-asset-manifest.js +55 -0
- package/lib/cloudflare/upload-asset-manifest.js.map +1 -0
- package/lib/cloudflare/worker-metadata.d.ts +130 -0
- package/lib/cloudflare/worker-metadata.d.ts.map +1 -0
- package/lib/cloudflare/worker-metadata.js +2 -0
- package/lib/cloudflare/worker-metadata.js.map +1 -0
- package/lib/cloudflare/worker-migration.d.ts +110 -0
- package/lib/cloudflare/worker-migration.d.ts.map +1 -0
- package/lib/cloudflare/worker-migration.js +11 -0
- package/lib/cloudflare/worker-migration.js.map +1 -0
- package/lib/cloudflare/worker.d.ts +105 -0
- package/lib/cloudflare/worker.d.ts.map +1 -0
- package/lib/cloudflare/worker.js +358 -0
- package/lib/cloudflare/worker.js.map +1 -0
- package/lib/destroy.d.ts +1 -1
- package/lib/destroy.d.ts.map +1 -1
- package/lib/destroy.js +2 -1
- package/lib/destroy.js.map +1 -1
- package/lib/esbuild.d.ts +83 -1
- package/lib/esbuild.d.ts.map +1 -1
- package/lib/esbuild.js +27 -18
- package/lib/esbuild.js.map +1 -1
- package/lib/fs.d.ts +1 -1
- package/lib/global.d.ts +0 -2
- package/lib/global.d.ts.map +1 -1
- package/lib/global.js +3 -3
- package/lib/global.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/main.js +1 -1
- package/lib/main.js.map +1 -1
- package/lib/output.d.ts +18 -13
- package/lib/output.d.ts.map +1 -1
- package/lib/output.js +12 -5
- package/lib/output.js.map +1 -1
- package/lib/print.d.ts +7 -0
- package/lib/print.d.ts.map +1 -0
- package/lib/print.js +10 -0
- package/lib/print.js.map +1 -0
- package/lib/resource.d.ts +9 -4
- package/lib/resource.d.ts.map +1 -1
- package/lib/resource.js +127 -93
- package/lib/resource.js.map +1 -1
- package/lib/scope.d.ts +3 -0
- package/lib/scope.d.ts.map +1 -1
- package/lib/scope.js +4 -12
- package/lib/scope.js.map +1 -1
- package/lib/utils/content-type.d.ts +8 -0
- package/lib/utils/content-type.d.ts.map +1 -0
- package/lib/utils/content-type.js +41 -0
- package/lib/utils/content-type.js.map +1 -0
- package/package.json +27 -8
- package/src/$.ts +63 -30
- package/src/alchemize.ts +12 -0
- package/src/apply.ts +6 -6
- package/src/aws/index.ts +1 -0
- package/src/aws/ses.ts +346 -0
- package/src/cloudflare/api.ts +282 -0
- package/src/cloudflare/asset-manifest.ts +16 -0
- package/src/cloudflare/auth.ts +187 -0
- package/src/cloudflare/bindings.ts +297 -0
- package/src/cloudflare/durable-object-namespace.ts +43 -0
- package/src/cloudflare/generate-asset-manifest.ts +93 -0
- package/src/cloudflare/index.ts +6 -0
- package/src/cloudflare/kv-namespace.ts +195 -0
- package/src/cloudflare/state.ts +138 -0
- package/src/cloudflare/static-site-router.ts +150 -0
- package/src/cloudflare/static-site.ts +395 -0
- package/src/cloudflare/types.ts +71 -0
- package/src/cloudflare/upload-asset-manifest.ts +83 -0
- package/src/cloudflare/worker-metadata.ts +154 -0
- package/src/cloudflare/worker-migration.ts +145 -0
- package/src/cloudflare/worker.ts +666 -0
- package/src/destroy.ts +2 -2
- package/src/esbuild.ts +34 -22
- package/src/global.ts +1 -3
- package/src/index.ts +1 -1
- package/src/main.ts +1 -1
- package/src/output.ts +53 -37
- package/src/print.ts +18 -0
- package/src/resource.ts +163 -116
- package/src/scope.ts +7 -12
- package/src/utils/content-type.ts +42 -0
- package/lib/agent/ai.d.ts +0 -40
- package/lib/agent/ai.d.ts.map +0 -1
- package/lib/agent/ai.js +0 -132
- package/lib/agent/ai.js.map +0 -1
- package/lib/agent/anthropic.d.ts +0 -9
- package/lib/agent/anthropic.d.ts.map +0 -1
- package/lib/agent/anthropic.js +0 -25
- package/lib/agent/anthropic.js.map +0 -1
- package/lib/agent/dependencies.d.ts +0 -4
- package/lib/agent/dependencies.d.ts.map +0 -1
- package/lib/agent/dependencies.js +0 -48
- package/lib/agent/dependencies.js.map +0 -1
- package/lib/agent/file-context.d.ts +0 -13
- package/lib/agent/file-context.d.ts.map +0 -1
- package/lib/agent/file-context.js +0 -6
- package/lib/agent/file-context.js.map +0 -1
- package/lib/agent/index.d.ts +0 -10
- package/lib/agent/index.d.ts.map +0 -1
- package/lib/agent/index.js +0 -10
- package/lib/agent/index.js.map +0 -1
- package/lib/agent/model.d.ts +0 -8
- package/lib/agent/model.d.ts.map +0 -1
- package/lib/agent/model.js +0 -29
- package/lib/agent/model.js.map +0 -1
- package/lib/agent/module.d.ts +0 -81
- package/lib/agent/module.d.ts.map +0 -1
- package/lib/agent/module.js +0 -309
- package/lib/agent/module.js.map +0 -1
- package/lib/agent/openai.d.ts +0 -6
- package/lib/agent/openai.d.ts.map +0 -1
- package/lib/agent/openai.js +0 -41
- package/lib/agent/openai.js.map +0 -1
- package/lib/agent/program.d.ts +0 -12
- package/lib/agent/program.d.ts.map +0 -1
- package/lib/agent/program.js +0 -21
- package/lib/agent/program.js.map +0 -1
- package/lib/agent/prompts.d.ts +0 -4
- package/lib/agent/prompts.d.ts.map +0 -1
- package/lib/agent/prompts.js +0 -11
- package/lib/agent/prompts.js.map +0 -1
- package/lib/agent/scrape.d.ts +0 -71
- package/lib/agent/scrape.d.ts.map +0 -1
- package/lib/agent/scrape.js +0 -45
- package/lib/agent/scrape.js.map +0 -1
- package/lib/aws/auto/docs.d.ts +0 -11
- package/lib/aws/auto/docs.d.ts.map +0 -1
- package/lib/aws/auto/docs.js +0 -56
- package/lib/aws/auto/docs.js.map +0 -1
- package/lib/aws/auto/index.d.ts +0 -5
- package/lib/aws/auto/index.d.ts.map +0 -1
- package/lib/aws/auto/index.js +0 -5
- package/lib/aws/auto/index.js.map +0 -1
- package/lib/aws/auto/resource.d.ts +0 -24
- package/lib/aws/auto/resource.d.ts.map +0 -1
- package/lib/aws/auto/resource.js +0 -194
- package/lib/aws/auto/resource.js.map +0 -1
- package/lib/aws/auto/service.d.ts +0 -10
- package/lib/aws/auto/service.d.ts.map +0 -1
- package/lib/aws/auto/service.js +0 -34
- package/lib/aws/auto/service.js.map +0 -1
- package/lib/aws/auto/spec.d.ts +0 -83
- package/lib/aws/auto/spec.d.ts.map +0 -1
- package/lib/aws/auto/spec.js +0 -58
- package/lib/aws/auto/spec.js.map +0 -1
- package/lib/markdown/design.d.ts +0 -17
- package/lib/markdown/design.d.ts.map +0 -1
- package/lib/markdown/design.js +0 -92
- package/lib/markdown/design.js.map +0 -1
- package/lib/markdown/extract.d.ts +0 -7
- package/lib/markdown/extract.d.ts.map +0 -1
- package/lib/markdown/extract.js +0 -10
- package/lib/markdown/extract.js.map +0 -1
- package/lib/markdown/index.d.ts +0 -4
- package/lib/markdown/index.d.ts.map +0 -1
- package/lib/markdown/index.js +0 -4
- package/lib/markdown/index.js.map +0 -1
- package/lib/markdown/requirements.d.ts +0 -79
- package/lib/markdown/requirements.d.ts.map +0 -1
- package/lib/markdown/requirements.js +0 -105
- package/lib/markdown/requirements.js.map +0 -1
- package/lib/typescript/check-omission.d.ts +0 -2
- package/lib/typescript/check-omission.d.ts.map +0 -1
- package/lib/typescript/check-omission.js +0 -43
- package/lib/typescript/check-omission.js.map +0 -1
- package/lib/typescript/debug-type-errors.d.ts +0 -3
- package/lib/typescript/debug-type-errors.d.ts.map +0 -1
- package/lib/typescript/debug-type-errors.js +0 -35
- package/lib/typescript/debug-type-errors.js.map +0 -1
- package/lib/typescript/extract.d.ts +0 -7
- package/lib/typescript/extract.d.ts.map +0 -1
- package/lib/typescript/extract.js +0 -10
- package/lib/typescript/extract.js.map +0 -1
- package/lib/typescript/index.d.ts +0 -7
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.js +0 -7
- package/lib/typescript/index.js.map +0 -1
- package/lib/typescript/install-dependencies.d.ts +0 -29
- package/lib/typescript/install-dependencies.d.ts.map +0 -1
- package/lib/typescript/install-dependencies.js +0 -52
- package/lib/typescript/install-dependencies.js.map +0 -1
- package/lib/typescript/package.d.ts +0 -157
- package/lib/typescript/package.d.ts.map +0 -1
- package/lib/typescript/package.js +0 -115
- package/lib/typescript/package.js.map +0 -1
- package/lib/typescript/repair-omissions.d.ts +0 -3
- package/lib/typescript/repair-omissions.d.ts.map +0 -1
- package/lib/typescript/repair-omissions.js +0 -23
- package/lib/typescript/repair-omissions.js.map +0 -1
- package/lib/typescript/repair.d.ts +0 -3
- package/lib/typescript/repair.d.ts.map +0 -1
- package/lib/typescript/repair.js +0 -34
- package/lib/typescript/repair.js.map +0 -1
- package/lib/typescript/tsconfig.d.ts +0 -469
- package/lib/typescript/tsconfig.d.ts.map +0 -1
- package/lib/typescript/tsconfig.js +0 -143
- package/lib/typescript/tsconfig.js.map +0 -1
- package/lib/typescript/typescript.d.ts +0 -107
- package/lib/typescript/typescript.d.ts.map +0 -1
- package/lib/typescript/typescript.js +0 -180
- package/lib/typescript/typescript.js.map +0 -1
- package/lib/typescript/validate.d.ts +0 -10
- package/lib/typescript/validate.d.ts.map +0 -1
- package/lib/typescript/validate.js +0 -49
- package/lib/typescript/validate.js.map +0 -1
- package/src/agent/ai.ts +0 -215
- package/src/agent/anthropic.ts +0 -31
- package/src/agent/dependencies.ts +0 -62
- package/src/agent/file-context.ts +0 -8
- package/src/agent/index.ts +0 -9
- package/src/agent/model.ts +0 -39
- package/src/agent/module.ts +0 -418
- package/src/agent/openai.ts +0 -50
- package/src/agent/program.md +0 -38
- package/src/agent/program.ts +0 -37
- package/src/agent/prompts.ts +0 -20
- package/src/agent/scrape.ts +0 -47
- package/src/aws/auto/cfn.json +0 -225310
- package/src/aws/auto/docs.ts +0 -73
- package/src/aws/auto/index.ts +0 -4
- package/src/aws/auto/resource.ts +0 -269
- package/src/aws/auto/service.ts +0 -51
- package/src/aws/auto/spec.ts +0 -160
- package/src/markdown/design.ts +0 -125
- package/src/markdown/extract.ts +0 -9
- package/src/markdown/index.ts +0 -3
- package/src/markdown/requirements.ts +0 -135
- package/src/typescript/check-omission.ts +0 -47
- package/src/typescript/debug-type-errors.ts +0 -42
- package/src/typescript/extract.ts +0 -9
- package/src/typescript/index.ts +0 -6
- package/src/typescript/install-dependencies.ts +0 -61
- package/src/typescript/package.ts +0 -143
- package/src/typescript/repair-omissions.ts +0 -31
- package/src/typescript/repair.ts +0 -45
- package/src/typescript/tsconfig.ts +0 -170
- package/src/typescript/typescript.ts +0 -217
- package/src/typescript/validate.ts +0 -73
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
2
|
-
import { dirname } from "path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import {
|
|
5
|
-
FileContext,
|
|
6
|
-
ModelId,
|
|
7
|
-
dependenciesAsMessages,
|
|
8
|
-
generateText,
|
|
9
|
-
resolveModel,
|
|
10
|
-
} from "../agent";
|
|
11
|
-
import { rm } from "../fs";
|
|
12
|
-
import { type Context, Resource } from "../resource";
|
|
13
|
-
|
|
14
|
-
export const ReasoningEffort = z.enum(["low", "medium", "high"]);
|
|
15
|
-
|
|
16
|
-
export const RequirementsInput = z.object({
|
|
17
|
-
/**
|
|
18
|
-
* The ID of the model to use for generating requirements documentation
|
|
19
|
-
* @default "gpt-4o"
|
|
20
|
-
*/
|
|
21
|
-
modelId: ModelId.optional(),
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The effort to put into reasoning about the requirements
|
|
25
|
-
*/
|
|
26
|
-
reasoningEffort: ReasoningEffort.optional(),
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* List of requirements to document and analyze
|
|
30
|
-
*/
|
|
31
|
-
requirements: z.array(z.string()),
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* List of dependencies for the requirements document
|
|
35
|
-
*/
|
|
36
|
-
dependencies: z.array(FileContext).optional(),
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Temperature setting for model generation (higher = more creative, lower = more focused)
|
|
40
|
-
* @default 0.7
|
|
41
|
-
*/
|
|
42
|
-
temperature: z.number().optional(),
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* File path where the requirements document should be written
|
|
46
|
-
*/
|
|
47
|
-
file: z.string().optional(),
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export const RequirementsOutput = z.object({
|
|
51
|
-
/**
|
|
52
|
-
* Generated markdown document containing organized and analyzed requirements
|
|
53
|
-
*/
|
|
54
|
-
content: z.string(),
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export interface RequirementsInput extends z.infer<typeof RequirementsInput> {}
|
|
58
|
-
export type RequirementsOutput = z.infer<typeof RequirementsOutput>;
|
|
59
|
-
|
|
60
|
-
export class Requirements extends Resource(
|
|
61
|
-
"code::Requirements",
|
|
62
|
-
async (ctx: Context<RequirementsOutput>, props: RequirementsInput) => {
|
|
63
|
-
if (ctx.event === "delete") {
|
|
64
|
-
if (props.file) {
|
|
65
|
-
await rm(props.file);
|
|
66
|
-
}
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (props.file) {
|
|
71
|
-
console.log(
|
|
72
|
-
ctx.event === "create" ? "Designing" : "Revising",
|
|
73
|
-
"requirements",
|
|
74
|
-
props.file,
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Get the appropriate model based on the ID
|
|
79
|
-
const model = await resolveModel(props.modelId ?? "gpt-4o");
|
|
80
|
-
|
|
81
|
-
// Generate the requirements document
|
|
82
|
-
const { text } = await generateText({
|
|
83
|
-
model,
|
|
84
|
-
temperature: props.temperature ?? 0.7,
|
|
85
|
-
maxSteps: 3, // Allow multiple steps for potential tool usage
|
|
86
|
-
providerOptions: props.reasoningEffort
|
|
87
|
-
? {
|
|
88
|
-
openai: {
|
|
89
|
-
reasoningEffort: props.reasoningEffort,
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
: undefined,
|
|
93
|
-
tools: {
|
|
94
|
-
// scrapeWebPage,
|
|
95
|
-
},
|
|
96
|
-
messages: [
|
|
97
|
-
{
|
|
98
|
-
role: "system",
|
|
99
|
-
content:
|
|
100
|
-
"You are a helpful assistant that creates markdown documents from requirements. You can use the scrapeWebPage tool to get additional requirements from relevant URLs if needed.",
|
|
101
|
-
},
|
|
102
|
-
...dependenciesAsMessages(props.dependencies ?? []),
|
|
103
|
-
{
|
|
104
|
-
role: "user",
|
|
105
|
-
content: `Please analyze the following system requirements and create a comprehensive, unambiguous markdown document that covers all aspects:
|
|
106
|
-
|
|
107
|
-
Requirements:
|
|
108
|
-
${props.requirements.map((req) => `- ${req}`).join("\n")}
|
|
109
|
-
|
|
110
|
-
Guidelines:
|
|
111
|
-
1. Make explicit decisions for any ambiguous requirements - do not leave open questions
|
|
112
|
-
2. Document the reasoning behind key decisions
|
|
113
|
-
3. Be specific about technical choices and implementation details
|
|
114
|
-
4. Avoid phrases like "could be", "might need", or "possibly requires" - be definitive
|
|
115
|
-
5. Organize requirements into logical sections with clear dependencies and relationships
|
|
116
|
-
|
|
117
|
-
Format the output in markdown with appropriate headers, lists, and sections, starting with the title as an H1 header.
|
|
118
|
-
Include technical considerations and implementation details, ensuring every requirement has a clear, actionable specification.`,
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (props.file) {
|
|
124
|
-
// Ensure the directory exists
|
|
125
|
-
await mkdir(dirname(props.file), { recursive: true });
|
|
126
|
-
|
|
127
|
-
// Write the requirements to the file
|
|
128
|
-
await writeFile(props.file, text);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
content: text,
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
) {}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { generateObject } from "../agent/ai";
|
|
3
|
-
import { resolveModel } from "../agent/model";
|
|
4
|
-
|
|
5
|
-
const CodeOmissionCheck = z.object({
|
|
6
|
-
hasOmittedCode: z.boolean(),
|
|
7
|
-
explanation: z.string(),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const haiku = await resolveModel("claude-3-5-haiku-latest");
|
|
11
|
-
|
|
12
|
-
export async function checkForCodeOmission(code: string): Promise<boolean> {
|
|
13
|
-
const result = await generateObject({
|
|
14
|
-
model: haiku,
|
|
15
|
-
schema: CodeOmissionCheck,
|
|
16
|
-
temperature: 0.1,
|
|
17
|
-
messages: [
|
|
18
|
-
{
|
|
19
|
-
role: "system",
|
|
20
|
-
content:
|
|
21
|
-
"You are checking for signs of code omission in TypeScript code. Look for comments that indicate abbreviated or omitted content.",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
role: "user",
|
|
25
|
-
content: `Check this code for any signs of content being lazily omitted:
|
|
26
|
-
|
|
27
|
-
\`\`\`typescript
|
|
28
|
-
${code}
|
|
29
|
-
\`\`\`
|
|
30
|
-
|
|
31
|
-
Look for patterns like:
|
|
32
|
-
- "// rest of the ..."
|
|
33
|
-
- "// remaining code ..."
|
|
34
|
-
- "// ... existing code ..."
|
|
35
|
-
- "// other methods ..."
|
|
36
|
-
- "// etc ..."
|
|
37
|
-
- "// Implementation would go here"
|
|
38
|
-
- "// For now just ..."
|
|
39
|
-
- Any similar comments that indicate code was abbreviated
|
|
40
|
-
|
|
41
|
-
Only answer true if you find such comments indicating omitted content. Otherwise answer false.`,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return result.object.hasOmittedCode;
|
|
47
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CoreMessage } from "ai";
|
|
2
|
-
import { generateText } from "../agent/ai";
|
|
3
|
-
import { resolveModel } from "../agent/model";
|
|
4
|
-
|
|
5
|
-
export async function debugTypeErrors(
|
|
6
|
-
messages: CoreMessage[],
|
|
7
|
-
typeErrors: string,
|
|
8
|
-
): Promise<string> {
|
|
9
|
-
const o3Model = await resolveModel("o3-mini");
|
|
10
|
-
|
|
11
|
-
// Get diagnostic analysis from o3-mini
|
|
12
|
-
const consultationMessages: CoreMessage[] = [
|
|
13
|
-
...messages,
|
|
14
|
-
{
|
|
15
|
-
role: "user",
|
|
16
|
-
content: `Analyze these TypeScript errors and the code to identify the root causes:
|
|
17
|
-
|
|
18
|
-
TypeScript errors:
|
|
19
|
-
${typeErrors}
|
|
20
|
-
|
|
21
|
-
Please help by:
|
|
22
|
-
1. Diagnosing the root cause of any type errors
|
|
23
|
-
2. Identifying specific sections of code that need to change
|
|
24
|
-
3. Providing step-by-step guidance on how to fix them
|
|
25
|
-
|
|
26
|
-
Focus only on type-related issues and necessary fixes.`,
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const { text: analysis } = await generateText({
|
|
31
|
-
model: o3Model,
|
|
32
|
-
temperature: 0.1,
|
|
33
|
-
providerOptions: {
|
|
34
|
-
openai: {
|
|
35
|
-
reasoningEffort: "high",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
messages: consultationMessages,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return analysis;
|
|
42
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts TypeScript code from a markdown code block
|
|
3
|
-
* @param text Response text that may contain markdown
|
|
4
|
-
* @returns The TypeScript code if found, undefined otherwise
|
|
5
|
-
*/
|
|
6
|
-
export function extractTypeScriptCode(text: string): string | undefined {
|
|
7
|
-
const matches = text.match(/```(?:ts|typescript)\n([\s\S]*?)```/);
|
|
8
|
-
return matches?.[1]?.trim();
|
|
9
|
-
}
|
package/src/typescript/index.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { tool } from "ai";
|
|
2
|
-
import { exec } from "child_process";
|
|
3
|
-
import { promisify } from "util";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
const execAsync = promisify(exec);
|
|
7
|
-
|
|
8
|
-
export const installDependencies = tool({
|
|
9
|
-
description:
|
|
10
|
-
"Installs dependencies using bun with support for different dependency types (runtime, dev, or peer)",
|
|
11
|
-
parameters: z.object({
|
|
12
|
-
packages: z.array(z.string()).describe("Array of package names to install"),
|
|
13
|
-
type: z
|
|
14
|
-
.enum(["runtime", "dev", "peer"])
|
|
15
|
-
.optional()
|
|
16
|
-
.describe(
|
|
17
|
-
"Type of dependency to install: runtime, dev, or peer. Default 'runtime'.",
|
|
18
|
-
),
|
|
19
|
-
}),
|
|
20
|
-
execute: async ({ packages, type }) => {
|
|
21
|
-
if (packages.length === 0) {
|
|
22
|
-
throw new Error("No packages specified for installation");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let command = "bun add";
|
|
26
|
-
|
|
27
|
-
// Add appropriate flags based on dependency type
|
|
28
|
-
switch (type) {
|
|
29
|
-
case "dev":
|
|
30
|
-
command += " -D";
|
|
31
|
-
break;
|
|
32
|
-
case "peer":
|
|
33
|
-
command += " --peer";
|
|
34
|
-
break;
|
|
35
|
-
// runtime dependencies don't need a special flag
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Add packages to the command
|
|
39
|
-
command += " " + packages.join(" ");
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
console.log(`Executing: ${command}`);
|
|
43
|
-
const { stdout, stderr } = await execAsync(command);
|
|
44
|
-
|
|
45
|
-
if (stderr) {
|
|
46
|
-
console.warn("Installation warnings:", stderr);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
success: true,
|
|
51
|
-
command,
|
|
52
|
-
output: stdout,
|
|
53
|
-
packages,
|
|
54
|
-
type,
|
|
55
|
-
};
|
|
56
|
-
} catch (error: any) {
|
|
57
|
-
console.error("Installation failed:", error);
|
|
58
|
-
throw new Error(`Failed to install packages: ${error.message}`);
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { generateObject } from "ai";
|
|
2
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { dependenciesAsMessages } from "../agent/dependencies";
|
|
6
|
-
import { FileContext } from "../agent/file-context";
|
|
7
|
-
import { resolveModel } from "../agent/model";
|
|
8
|
-
import { rm } from "../fs";
|
|
9
|
-
import { type Context, Resource } from "../resource";
|
|
10
|
-
|
|
11
|
-
export const PackageJsonSchema = z.object({
|
|
12
|
-
name: z.string(),
|
|
13
|
-
version: z.string(),
|
|
14
|
-
description: z.string().optional(),
|
|
15
|
-
main: z.string().optional(),
|
|
16
|
-
types: z.string().optional(),
|
|
17
|
-
type: z.literal("module"),
|
|
18
|
-
scripts: z.record(z.string()).optional(),
|
|
19
|
-
peerDependencies: z.record(z.string()).optional(),
|
|
20
|
-
peerDependenciesMeta: z
|
|
21
|
-
.record(z.object({ optional: z.boolean() }))
|
|
22
|
-
.optional(),
|
|
23
|
-
devDependencies: z.record(z.string()).optional(),
|
|
24
|
-
keywords: z.array(z.string()).optional(),
|
|
25
|
-
author: z.string().optional(),
|
|
26
|
-
license: z.string().optional(),
|
|
27
|
-
repository: z
|
|
28
|
-
.object({
|
|
29
|
-
type: z.string(),
|
|
30
|
-
url: z.string(),
|
|
31
|
-
})
|
|
32
|
-
.optional(),
|
|
33
|
-
exports: z.unknown().optional(),
|
|
34
|
-
files: z.array(z.string()).optional(),
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
export const PackageJsonInput = z.object({
|
|
38
|
-
/**
|
|
39
|
-
* List of requirements for the package
|
|
40
|
-
* Can include dependencies, dev dependencies, scripts, etc.
|
|
41
|
-
*/
|
|
42
|
-
requirements: z.array(z.string()),
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* List of dependencies for the package
|
|
46
|
-
*/
|
|
47
|
-
dependencies: z.array(FileContext).optional(),
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Name of the package
|
|
51
|
-
*/
|
|
52
|
-
name: z.string(),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The ID of the model to use for generating package configuration
|
|
56
|
-
* @default "gpt-4o"
|
|
57
|
-
*/
|
|
58
|
-
model: z.string().optional(),
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Temperature setting for model generation
|
|
62
|
-
* @default 0.3
|
|
63
|
-
*/
|
|
64
|
-
temperature: z.number().optional(),
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Path to the package.json file to generate
|
|
68
|
-
*/
|
|
69
|
-
path: z.string(),
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export type PackageJsonInput = z.infer<typeof PackageJsonInput>;
|
|
73
|
-
|
|
74
|
-
export interface PackageJsonOutput {
|
|
75
|
-
path: string;
|
|
76
|
-
content: string;
|
|
77
|
-
packageJson: z.infer<typeof PackageJsonSchema>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export class PackageJson extends Resource(
|
|
81
|
-
"code::Package",
|
|
82
|
-
async (
|
|
83
|
-
ctx: Context<PackageJsonOutput>,
|
|
84
|
-
props: PackageJsonInput,
|
|
85
|
-
): Promise<PackageJsonOutput | void> => {
|
|
86
|
-
if (ctx.event === "delete") {
|
|
87
|
-
await rm(props.path);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
console.log(ctx.event === "create" ? "Creating" : "Updating", props.path);
|
|
92
|
-
|
|
93
|
-
// Get the appropriate model
|
|
94
|
-
const model = await resolveModel(props.model ?? "gpt-4o");
|
|
95
|
-
|
|
96
|
-
// Generate the package configuration using generateObject for type safety
|
|
97
|
-
const result = await generateObject({
|
|
98
|
-
model,
|
|
99
|
-
schema: PackageJsonSchema,
|
|
100
|
-
temperature: props.temperature ?? 0.3,
|
|
101
|
-
messages: [
|
|
102
|
-
{
|
|
103
|
-
role: "system",
|
|
104
|
-
content:
|
|
105
|
-
"You are an expert at creating Node.js/TypeScript package configurations. You will generate a package.json configuration based on requirements.",
|
|
106
|
-
},
|
|
107
|
-
...dependenciesAsMessages(props.dependencies ?? []),
|
|
108
|
-
{
|
|
109
|
-
role: "user",
|
|
110
|
-
content: `Please generate a package.json configuration based on these requirements:
|
|
111
|
-
|
|
112
|
-
Package name: ${props.name}
|
|
113
|
-
|
|
114
|
-
Requirements:
|
|
115
|
-
${props.requirements.map((req) => `- ${req}`).join("\n")}
|
|
116
|
-
|
|
117
|
-
Rules:
|
|
118
|
-
1. All dependencies must be peer dependencies
|
|
119
|
-
2. Use latest stable versions for all dependencies
|
|
120
|
-
3. Include standard TypeScript configuration in devDependencies
|
|
121
|
-
4. Use "bun" as the package manager
|
|
122
|
-
5. Must use ESM modules (type: "module")
|
|
123
|
-
|
|
124
|
-
Output only the package.json code (do not emit any other files).`,
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// Ensure the directory exists
|
|
130
|
-
await mkdir(dirname(props.path), { recursive: true });
|
|
131
|
-
|
|
132
|
-
const content = JSON.stringify(result.object, null, 2);
|
|
133
|
-
|
|
134
|
-
// Write the package.json file
|
|
135
|
-
await writeFile(props.path, content);
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
path: props.path,
|
|
139
|
-
content,
|
|
140
|
-
packageJson: result.object,
|
|
141
|
-
};
|
|
142
|
-
},
|
|
143
|
-
) {}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { CoreMessage, LanguageModelV1 } from "ai";
|
|
2
|
-
import { generateText } from "../agent/ai";
|
|
3
|
-
import { extractTypeScriptCode } from "./extract";
|
|
4
|
-
|
|
5
|
-
export async function repairCodeOmissions(
|
|
6
|
-
model: LanguageModelV1,
|
|
7
|
-
messages: CoreMessage[] = [],
|
|
8
|
-
): Promise<string> {
|
|
9
|
-
console.log("[TypeScript] Repairing code omissions...");
|
|
10
|
-
|
|
11
|
-
const repairMessages: CoreMessage[] = [
|
|
12
|
-
...messages,
|
|
13
|
-
{
|
|
14
|
-
role: "user" as const,
|
|
15
|
-
content: `Do not omit implementation or leave placeholders. Complete the implementation fully.`,
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const { text } = await generateText({
|
|
20
|
-
model,
|
|
21
|
-
temperature: 0.1,
|
|
22
|
-
messages: repairMessages,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const repairedCode = extractTypeScriptCode(text);
|
|
26
|
-
if (!repairedCode) {
|
|
27
|
-
throw new Error("Failed to repair code omissions");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return repairedCode;
|
|
31
|
-
}
|
package/src/typescript/repair.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { CoreMessage } from "ai";
|
|
2
|
-
import { generateText } from "../agent";
|
|
3
|
-
import { extractTypeScriptCode } from "./extract";
|
|
4
|
-
|
|
5
|
-
export async function repairTypeScriptCode(
|
|
6
|
-
model: any,
|
|
7
|
-
typeErrors: string,
|
|
8
|
-
messages: CoreMessage[],
|
|
9
|
-
): Promise<string> {
|
|
10
|
-
// If we have type check options, validate and potentially repair type errors
|
|
11
|
-
console.log("[TypeScript] Fixing type errors...");
|
|
12
|
-
|
|
13
|
-
messages.push({
|
|
14
|
-
role: "user" as const,
|
|
15
|
-
content: `Fix the type errors in this code:
|
|
16
|
-
|
|
17
|
-
Type errors found:
|
|
18
|
-
${typeErrors}
|
|
19
|
-
|
|
20
|
-
Provide a complete implementation that fixes these issues while preserving all functionality.`,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Add the repair attempt to the message history
|
|
24
|
-
const repairMessages: CoreMessage[] = [
|
|
25
|
-
{
|
|
26
|
-
role: "system" as const,
|
|
27
|
-
content:
|
|
28
|
-
"You are an expert TypeScript developer fixing type errors. Provide a complete implementation that resolves the identified issues.",
|
|
29
|
-
},
|
|
30
|
-
...messages,
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
const { text: repairAttempt } = await generateText({
|
|
34
|
-
model,
|
|
35
|
-
temperature: 0.1,
|
|
36
|
-
messages: repairMessages,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const repairedCode = extractTypeScriptCode(repairAttempt);
|
|
40
|
-
if (!repairedCode) {
|
|
41
|
-
throw new Error("Failed to repair type errors");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return repairedCode;
|
|
45
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { generateObject } from "ai";
|
|
2
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
3
|
-
import { dirname } from "path";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { FileContext, dependenciesAsMessages, resolveModel } from "../agent";
|
|
6
|
-
import { rm } from "../fs";
|
|
7
|
-
import { type Context, Resource } from "../resource";
|
|
8
|
-
|
|
9
|
-
export type TypeScriptConfigInput = z.infer<typeof TypeScriptConfigInput>;
|
|
10
|
-
|
|
11
|
-
export const TypeScriptConfigInput = z.object({
|
|
12
|
-
/**
|
|
13
|
-
* The ID of the model to use for generating tsconfig configuration
|
|
14
|
-
* @default "gpt-4o"
|
|
15
|
-
*/
|
|
16
|
-
modelId: z.string().optional(),
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* List of requirements for the TypeScript configuration
|
|
20
|
-
* Can include module settings, compilation options, etc.
|
|
21
|
-
*/
|
|
22
|
-
requirements: z.array(z.string()),
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* List of dependencies for the TypeScript configuration
|
|
26
|
-
*/
|
|
27
|
-
dependencies: z.array(FileContext).optional(),
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Temperature setting for model generation
|
|
31
|
-
* @default 0.3
|
|
32
|
-
*/
|
|
33
|
-
temperature: z.number().optional(),
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Path to the tsconfig.json file to generate
|
|
37
|
-
*/
|
|
38
|
-
path: z.string(),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export type TsConfigJson = z.infer<typeof TsConfigSchema>;
|
|
42
|
-
export const TsConfigSchema = z.object({
|
|
43
|
-
$schema: z.string().optional(),
|
|
44
|
-
compilerOptions: z.object({
|
|
45
|
-
target: z.enum([
|
|
46
|
-
"es2015",
|
|
47
|
-
"es2016",
|
|
48
|
-
"es2017",
|
|
49
|
-
"es2018",
|
|
50
|
-
"es2019",
|
|
51
|
-
"es2020",
|
|
52
|
-
"es2021",
|
|
53
|
-
"es2022",
|
|
54
|
-
"esnext",
|
|
55
|
-
]),
|
|
56
|
-
module: z.enum([
|
|
57
|
-
"commonjs",
|
|
58
|
-
"es2015",
|
|
59
|
-
"es2020",
|
|
60
|
-
"es2022",
|
|
61
|
-
"esnext",
|
|
62
|
-
"node16",
|
|
63
|
-
"nodenext",
|
|
64
|
-
]),
|
|
65
|
-
lib: z.array(z.string()).optional(),
|
|
66
|
-
declaration: z.boolean().optional(),
|
|
67
|
-
declarationMap: z.boolean().optional(),
|
|
68
|
-
sourceMap: z.boolean().optional(),
|
|
69
|
-
outDir: z.string().optional(),
|
|
70
|
-
rootDir: z.string().optional(),
|
|
71
|
-
strict: z.boolean(),
|
|
72
|
-
esModuleInterop: z.boolean().optional(),
|
|
73
|
-
skipLibCheck: z.boolean().optional(),
|
|
74
|
-
forceConsistentCasingInFileNames: z.boolean().optional(),
|
|
75
|
-
moduleResolution: z
|
|
76
|
-
.enum(["node", "node16", "nodenext", "bundler"])
|
|
77
|
-
.optional(),
|
|
78
|
-
resolveJsonModule: z.boolean().optional(),
|
|
79
|
-
isolatedModules: z.boolean().optional(),
|
|
80
|
-
allowJs: z.boolean().optional(),
|
|
81
|
-
checkJs: z.boolean().optional(),
|
|
82
|
-
noEmit: z.boolean().optional(),
|
|
83
|
-
incremental: z.boolean().optional(),
|
|
84
|
-
composite: z.boolean().optional(),
|
|
85
|
-
tsBuildInfoFile: z.string().optional(),
|
|
86
|
-
paths: z.record(z.array(z.string())).optional(),
|
|
87
|
-
baseUrl: z.string().optional(),
|
|
88
|
-
types: z.array(z.string()).optional(),
|
|
89
|
-
typeRoots: z.array(z.string()).optional(),
|
|
90
|
-
}),
|
|
91
|
-
include: z.array(z.string()).optional(),
|
|
92
|
-
exclude: z.array(z.string()).optional(),
|
|
93
|
-
references: z
|
|
94
|
-
.array(
|
|
95
|
-
z.object({
|
|
96
|
-
path: z.string(),
|
|
97
|
-
}),
|
|
98
|
-
)
|
|
99
|
-
.optional(),
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
export interface TypeScriptConfigOutput
|
|
103
|
-
extends z.infer<typeof TypeScriptConfigOutput> {}
|
|
104
|
-
export const TypeScriptConfigOutput = z.object({
|
|
105
|
-
path: z.string(),
|
|
106
|
-
content: z.string(),
|
|
107
|
-
tsconfig: TsConfigSchema,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
export class TypeScriptConfig extends Resource(
|
|
111
|
-
"code::tsconfig",
|
|
112
|
-
async (
|
|
113
|
-
ctx: Context<TypeScriptConfigOutput>,
|
|
114
|
-
props: TypeScriptConfigInput,
|
|
115
|
-
) => {
|
|
116
|
-
if (ctx.event === "delete") {
|
|
117
|
-
await rm(props.path);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
console.log(ctx.event === "create" ? "Creating" : "Updating", props.path);
|
|
122
|
-
|
|
123
|
-
// Get the appropriate model
|
|
124
|
-
const model = await resolveModel(props.modelId ?? "gpt-4o");
|
|
125
|
-
|
|
126
|
-
// Generate the tsconfig configuration using generateObject for type safety
|
|
127
|
-
const result = await generateObject({
|
|
128
|
-
model,
|
|
129
|
-
schema: TsConfigSchema,
|
|
130
|
-
temperature: props.temperature ?? 0.3,
|
|
131
|
-
messages: [
|
|
132
|
-
{
|
|
133
|
-
role: "system",
|
|
134
|
-
content:
|
|
135
|
-
"You are an expert at creating TypeScript configurations. You will generate a tsconfig.json configuration based on requirements.",
|
|
136
|
-
},
|
|
137
|
-
...dependenciesAsMessages(props.dependencies),
|
|
138
|
-
{
|
|
139
|
-
role: "user",
|
|
140
|
-
content: `Please generate a tsconfig.json configuration based on these requirements:
|
|
141
|
-
|
|
142
|
-
Requirements:
|
|
143
|
-
${props.requirements.map((req) => `- ${req}`).join("\n")}
|
|
144
|
-
|
|
145
|
-
Rules:
|
|
146
|
-
1. Use modern TypeScript features
|
|
147
|
-
2. Enable strict type checking
|
|
148
|
-
3. Use ESM modules by default
|
|
149
|
-
4. Include source maps for better debugging
|
|
150
|
-
5. Infer appropriate settings for declarations, module resolution, and other options based on the requirements
|
|
151
|
-
6. Use appropriate paths for source and output directories`,
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Ensure the directory exists
|
|
157
|
-
await mkdir(dirname(props.path), { recursive: true });
|
|
158
|
-
|
|
159
|
-
const content = JSON.stringify(result.object, null, 2);
|
|
160
|
-
|
|
161
|
-
// Write the tsconfig.json file
|
|
162
|
-
await writeFile(props.path, content);
|
|
163
|
-
|
|
164
|
-
return {
|
|
165
|
-
path: props.path,
|
|
166
|
-
content,
|
|
167
|
-
tsconfig: result.object,
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
) {}
|