@intend-it/core 2.0.0 → 2.0.2
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/index.js +19 -13
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -168863,7 +168863,14 @@ class TypeScriptGenerator {
|
|
|
168863
168863
|
blocks.push(...this.generateEnsure(ensure));
|
|
168864
168864
|
});
|
|
168865
168865
|
}
|
|
168866
|
-
if (intent.body.
|
|
168866
|
+
if (intent.body.returnStmt) {
|
|
168867
|
+
blocks.push({ type: "comment", content: "", indent: 0 });
|
|
168868
|
+
blocks.push({
|
|
168869
|
+
type: "statement",
|
|
168870
|
+
content: `return ${intent.body.returnStmt.identifier};`,
|
|
168871
|
+
indent: 1
|
|
168872
|
+
});
|
|
168873
|
+
} else if (intent.body.steps.length > 0) {
|
|
168867
168874
|
const lastStep = intent.body.steps[intent.body.steps.length - 1];
|
|
168868
168875
|
if (lastStep.resultVariable) {
|
|
168869
168876
|
blocks.push({ type: "comment", content: "", indent: 0 });
|
|
@@ -168872,16 +168879,6 @@ class TypeScriptGenerator {
|
|
|
168872
168879
|
content: `return ${lastStep.resultVariable};`,
|
|
168873
168880
|
indent: 1
|
|
168874
168881
|
});
|
|
168875
|
-
} else {
|
|
168876
|
-
const returnVar = intent.body.steps.find((s) => s.resultVariable)?.resultVariable;
|
|
168877
|
-
if (returnVar) {
|
|
168878
|
-
blocks.push({ type: "comment", content: "", indent: 0 });
|
|
168879
|
-
blocks.push({
|
|
168880
|
-
type: "statement",
|
|
168881
|
-
content: `return ${returnVar};`,
|
|
168882
|
-
indent: 1
|
|
168883
|
-
});
|
|
168884
|
-
}
|
|
168885
168882
|
}
|
|
168886
168883
|
}
|
|
168887
168884
|
return blocks;
|
|
@@ -169616,10 +169613,19 @@ class AICodeGenerator {
|
|
|
169616
169613
|
console.log(` Retrying with AI auto-correction...`);
|
|
169617
169614
|
prompt += `
|
|
169618
169615
|
|
|
169619
|
-
|
|
169616
|
+
Validation Failed (Attempt ${attempts}/${limit}).
|
|
169617
|
+
` + `The code you generated caused errors:
|
|
169618
|
+
\`\`\`typescript
|
|
169619
|
+
${cleanCode}
|
|
169620
|
+
\`\`\`
|
|
169621
|
+
|
|
169622
|
+
` + `Errors encountered:
|
|
169620
169623
|
${errorMsg}
|
|
169621
169624
|
|
|
169622
|
-
|
|
169625
|
+
` + `CRITICAL INSTRUCTION: Don't just patch the code.
|
|
169626
|
+
` + `1. First, analyze WHY this error occurred (e.g., mismatching types, undefined variable).
|
|
169627
|
+
` + `2. Then, generate the completely fixed function body wrapped in a \`\`\`typescript block.
|
|
169628
|
+
`;
|
|
169623
169629
|
} else {
|
|
169624
169630
|
console.warn(` ❌ Validation failed for ${functionName} after ${limit} attempts.`);
|
|
169625
169631
|
await this.explainFailure(functionName, updatedCode, errors);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intend-it/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Core compiler and AI integration for the Intend programming language",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@intend-it/parser": "^1.1.
|
|
38
|
+
"@intend-it/parser": "^1.1.2",
|
|
39
39
|
"@google/generative-ai": "^0.21.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"typescript": "^5.0.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@intend-it/parser": ">=1.1.
|
|
46
|
+
"@intend-it/parser": ">=1.1.2"
|
|
47
47
|
}
|
|
48
48
|
}
|