@intend-it/core 4.0.1 → 4.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/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  ### ✨ Key Features
21
21
 
22
22
  - **🧠 AI Code Generation** - Transforms natural language steps into actual code
23
+ - **🌐 Global Context** - Define file-level rules using the `context` keyword
23
24
  - **🔀 Hybrid Orchestration** - Mix AI steps with deterministic function calls
24
25
  - **🔄 Self-Correction Loop** - Validates output and auto-fixes errors
25
26
  - **⚡ Smart Caching (CAS)** - Content-addressable storage for instant rebuilds
package/dist/index.js CHANGED
@@ -169173,9 +169173,10 @@ ${request.prompt}`;
169173
169173
  }
169174
169174
  // src/ai/prompt-builder.ts
169175
169175
  class PromptBuilder {
169176
- buildContext(intent, fileImports, importedIntents = []) {
169176
+ buildContext(intent, fileImports, importedIntents = [], fileContext) {
169177
169177
  const returnType = this.formatReturnType(intent.returnType);
169178
169178
  return {
169179
+ fileContext,
169179
169180
  functionName: intent.name,
169180
169181
  parameters: intent.parameters,
169181
169182
  returnType,
@@ -169209,6 +169210,11 @@ class PromptBuilder {
169209
169210
  const lines = [];
169210
169211
  lines.push(`Implement this TypeScript function step:
169211
169212
  `);
169213
+ if (context.fileContext) {
169214
+ lines.push(`GLOBAL CONTEXT / RULES:`);
169215
+ lines.push(context.fileContext);
169216
+ lines.push("");
169217
+ }
169212
169218
  lines.push(`Function: ${context.functionName}`);
169213
169219
  lines.push(`Parameters: ${this.formatParameters(context.parameters)}`);
169214
169220
  lines.push(`Return Type: ${context.returnType}
@@ -169270,6 +169276,11 @@ Generate ONLY the TypeScript code for this step (no explanations, no markdown).`
169270
169276
  const lines = [];
169271
169277
  lines.push(`Implement this complete TypeScript function:
169272
169278
  `);
169279
+ if (context.fileContext) {
169280
+ lines.push(`GLOBAL CONTEXT / RULES:`);
169281
+ lines.push(context.fileContext);
169282
+ lines.push("");
169283
+ }
169273
169284
  lines.push(`Function: ${context.functionName}`);
169274
169285
  lines.push(`Parameters: ${this.formatParameters(context.parameters)}`);
169275
169286
  lines.push(`Return Type: ${context.returnType}
@@ -169908,7 +169919,7 @@ class AICodeGenerator {
169908
169919
  }
169909
169920
  }
169910
169921
  }
169911
- const context = this.promptBuilder.buildContext(intent, file.imports, importedIntents);
169922
+ const context = this.promptBuilder.buildContext(intent, file.imports, importedIntents, file.context);
169912
169923
  totalSteps += context.steps.length;
169913
169924
  if (this.mode === "step-by-step") {
169914
169925
  currentCode = await this.generateFull(currentCode, context, intent.name);
@@ -169951,7 +169962,8 @@ class AICodeGenerator {
169951
169962
  console.log(errorMsg.split(`
169952
169963
  `).map((l) => ` ${l}`).join(`
169953
169964
  `));
169954
- console.log(` Retrying with AI auto-correction...
169965
+ console.log(`
169966
+ Retrying with AI auto-correction...
169955
169967
  `);
169956
169968
  prompt += `
169957
169969
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intend-it/core",
3
- "version": "4.0.1",
3
+ "version": "4.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.3.1",
38
+ "@intend-it/parser": "^1.3.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.3.1"
46
+ "@intend-it/parser": ">=1.3.2"
47
47
  }
48
48
  }