CLI for the Intend programming language
npm install @intend-it/clibash
Global install
npm install -g @intend-it/cli
Or use with npx/bunx
npx @intend-it/cli build
bunx @intend-it/cli build
`
Quick Start
`bash
1. Create a new project
intend init my-app
cd my-app
2. Set your API key
export GEMINI_API_KEY="your-key-here"
3. Build!
intend build
`
Commands
$3
Initialize a new Intend project with configuration and example files.
`bash
intend init my-project
intend init . # Current directory
`
Creates:
- intend.config.json - Project configuration
- src/intents/ - Directory for .intent files
- out/ - Output directory for generated TypeScript
- intend.lock - Deterministic build lockfile (commit this!)
$3
To ensure that your builds are deterministic and fast, Intend uses a lockfile system.
When you run intend build, the CLI calculates a hash of your .intent source code and your configuration. If a match is found in intend.lock, the compiler uses the cached implementation instead of calling the AI provider.
- Fast Rebuilds: Near-instant builds for unchanged files.
- Stable Production: Your code won't change in CI/CD unless you explicitly change the intention.
- Version Control: You should always commit intend.lock to your repository.
$3
Build all .intent files in your project.
`bash
intend build # Build with default config
intend build --force # Ignore cache, rebuild all
intend build --attempts=10 # Set retry limit
intend build --provider=ollama # Use Ollama instead of Gemini
`
Options:
| Flag | Description |
|------|-------------|
| --config | Custom config file path |
| --output | Override output directory |
| --provider | AI provider: gemini or ollama |
| --api-key | Gemini API key |
| --force | Ignore cache, rebuild everything |
| --attempts | Max auto-correction retries (default: 5) |
$3
Watch for changes and auto-rebuild.
`bash
intend watch
`
$3
Parse a single file and output AST/CST (useful for debugging).
`bash
intend parse src/intents/user.intent --ast
intend parse src/intents/user.intent --cst
`
Configuration
Create intend.config.json in your project root:
`json
{
"sourceDir": "./src/intents",
"outDir": "./out",
"provider": "gemini",
"gemini": {
"apiKey": "${GEMINI_API_KEY}",
"model": "gemini-2.0-flash",
"temperature": 0.2
}
}
`
$3
`json
{
"sourceDir": "./src/intents",
"outDir": "./out",
"provider": "ollama",
"ollama": {
"model": "llama3",
"baseUrl": "http://localhost:11434",
"num_thread": 4
}
}
`
Example Workflow
1. Write an intent file (src/intents/math.intent):
`typescript
export intent Add(a: number, b: number) -> number {
invariant "Both inputs must be numbers"
step "Add the two numbers together" => const result
ensure result is a number
}
export intent Multiply(a: number, b: number) -> number {
step "Multiply the numbers" => const product
ensure product is a number
}
`
2. Build:
`bash
$ intend build
⨠Intend Build
Source ./src/intents
Output ./out
Provider gemini
ā Scanning for .intent files...
ā Found 1 intent file
Compiling
ā math.intent 1247ms
Summary
ā 1 compiled
ā 1.25s
`
3. Use the generated code:
`typescript
import { Add, Multiply } from "./out/math";
const sum = Add(5, 3); // 8
const product = Multiply(4, 7); // 28
`
Environment Variables
| Variable | Description |
|----------|-------------|
| GEMINI_API_KEY | Google Gemini API key |
| INTEND_PROVIDER | Default provider (gemini or ollama) |
Related Packages
- @intend-it/parser - Lexer and parser
- @intend-it/core` - AI code generator