npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@intend-it/core

v4.0.3

Published

Core compiler and AI integration for the Intend programming language

Readme


Overview

@intend-it/core is the heart of the Intend compiler. It takes parsed AST from @intend-it/parser and generates production-ready TypeScript code using AI (Google Gemini or Ollama).

Read the full documentation 📖

✨ Key Features

  • 🧠 AI Code Generation - Transforms natural language steps into actual code
  • 🌐 Global Context - Define file-level rules using the context keyword
  • 🔀 Hybrid Orchestration - Mix AI steps with deterministic function calls
  • 🔄 Self-Correction Loop - Validates output and auto-fixes errors
  • ⚡ Smart Caching (CAS) - Content-addressable storage for instant rebuilds
  • 🔌 Multi-Provider - Supports Gemini and Ollama (local)
  • 🛡️ Type-Safe Output - Generates valid, compilable TypeScript

Installation

npm install @intend-it/core @intend-it/parser
# or
bun add @intend-it/core @intend-it/parser

Usage

Basic Code Generation

import { AICodeGenerator } from "@intend-it/core";
import { parseToAST } from "@intend-it/parser";

const source = `
export intent Add(a: number, b: number) -> number {
    step "Add the two numbers together" => const result
    ensure result is a number
}
`;

const { ast } = parseToAST(source);

const generator = new AICodeGenerator({
  provider: "gemini",
  geminiConfig: {
    apiKey: process.env.GEMINI_API_KEY!,
    model: "gemini-2.0-flash"
  }
});

const result = await generator.generate(ast);
console.log(result.code);
// export function Add(a: number, b: number): number {
//   const result = a + b;
//   if (typeof result !== 'number') throw new Error(...);
//   return result;
// }

Using Ollama (Local AI)

const generator = new AICodeGenerator({
  provider: "ollama",
  ollamaConfig: {
    model: "llama3",
    baseUrl: "http://localhost:11434",
    num_thread: 4 // Optional: limit CPU usage
  }
});

Template Generation (No AI)

import { generateTypeScript } from "@intend-it/core";

const result = generateTypeScript(ast);
// Generates template with // TODO comments

Configuration Options

interface AIGeneratorOptions {
  provider: "gemini" | "ollama";
  
  geminiConfig?: {
    apiKey: string;
    model?: string;        // Default: "gemini-2.0-flash"
    temperature?: number;  // Default: 0.2
  };
  
  ollamaConfig?: {
    model?: string;        // Default: "llama3"
    baseUrl?: string;      // Default: "http://localhost:11434"
    temperature?: number;
    num_thread?: number;   // CPU thread limit
  };
  
  maxAttempts?: number;    // Auto-correction retries (default: 5)
}

🔒 Build Determinism & Lockfiles

The core package includes a LockfileManager that ensures generated code is deterministic and reusable.

import { LockfileManager, computeHash } from "@intend-it/core";

const lockManager = new LockfileManager("./intend.lock");

// Calculate hashes
const sourceHash = computeHash(intentSource);
const configHash = computeHash(JSON.stringify(config));

// Try to get from lockfile
const cachedCode = lockManager.getEntry(relativePath, sourceHash, configHash);

if (cachedCode) {
  return cachedCode; // Instant build!
}

// Generate new code and save to lockfile
const result = await generator.generate(ast);
lockManager.setEntry(relativePath, sourceHash, configHash, result.code, {
  model: "gemini-2.0-flash",
  provider: "gemini"
});
lockManager.save();

Why a Lockfile?

  • Determinism: Prevents minor AI fluctuations from changing your production code.
  • Performance: Skips expensive LLM calls for unchanged intentions.
  • Auditability: Changes to generated code appear in your git diffs, making it easy to review what the AI has changed.

Architecture

┌─────────────────┐     ┌──────────────┐     ┌─────────────────┐
│  .intent file   │ ──▶ │    Parser    │ ──▶ │       AST       │
└─────────────────┘     └──────────────┘     └────────┬────────┘
                                                      │
                        ┌──────────────┐              ▼
                        │   AI Provider │ ◀── ┌─────────────────┐
                        │ (Gemini/Ollama)│    │  Prompt Builder │
                        └───────┬───────┘    └─────────────────┘
                                │
                                ▼
                        ┌──────────────┐     ┌─────────────────┐
                        │  Validator   │ ──▶ │  TypeScript.ts  │
                        │ (auto-retry) │     └─────────────────┘
                        └──────────────┘

Related Packages

License

MIT © Intend Team