@intend-it/cli 1.0.1 → 1.1.1

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.
Files changed (3) hide show
  1. package/README.md +200 -0
  2. package/dist/index.js +4 -1
  3. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ <div align="center">
2
+ <h1>@intend-it/cli</h1>
3
+ <p><strong>Command-Line Interface for the Intend Programming Language</strong></p>
4
+ <p>
5
+ <a href="https://www.npmjs.com/package/@intend-it/cli"><img src="https://img.shields.io/npm/v/@intend-it/cli.svg" alt="npm version"></a>
6
+ <a href="https://www.npmjs.com/package/@intend-it/cli"><img src="https://img.shields.io/npm/dm/@intend-it/cli.svg" alt="npm downloads"></a>
7
+ <a href="https://github.com/DRFR0ST/intend/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@intend-it/cli.svg" alt="license"></a>
8
+ </p>
9
+ </div>
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ The official CLI for building **Intend** projects. Write your intentions, let AI generate the code.
16
+
17
+ ### ✨ Features
18
+
19
+ - **🚀 Zero Config** - Works out of the box with sensible defaults
20
+ - **⚡ Instant Builds** - Smart caching means unchanged files build instantly
21
+ - **🔄 Watch Mode** - Auto-rebuild on file changes
22
+ - **🤖 AI Providers** - Supports Gemini and Ollama (local)
23
+ - **🛡️ Self-Healing** - Auto-corrects AI mistakes with validation loop
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ # Global install
29
+ npm install -g @intend-it/cli
30
+
31
+ # Or use with npx/bunx
32
+ npx @intend-it/cli build
33
+ bunx @intend-it/cli build
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```bash
39
+ # 1. Create a new project
40
+ intend init my-app
41
+ cd my-app
42
+
43
+ # 2. Set your API key
44
+ export GEMINI_API_KEY="your-key-here"
45
+
46
+ # 3. Build!
47
+ intend build
48
+ ```
49
+
50
+ ## Commands
51
+
52
+ ### `intend init [directory]`
53
+
54
+ Initialize a new Intend project with configuration and example files.
55
+
56
+ ```bash
57
+ intend init my-project
58
+ intend init . # Current directory
59
+ ```
60
+
61
+ Creates:
62
+ - `intend.config.json` - Project configuration
63
+ - `src/intents/` - Directory for `.intent` files
64
+ - `out/` - Output directory for generated TypeScript
65
+
66
+ ### `intend build`
67
+
68
+ Build all `.intent` files in your project.
69
+
70
+ ```bash
71
+ intend build # Build with default config
72
+ intend build --force # Ignore cache, rebuild all
73
+ intend build --attempts=10 # Set retry limit
74
+ intend build --provider=ollama # Use Ollama instead of Gemini
75
+ ```
76
+
77
+ **Options:**
78
+ | Flag | Description |
79
+ |------|-------------|
80
+ | `--config <path>` | Custom config file path |
81
+ | `--output <dir>` | Override output directory |
82
+ | `--provider <name>` | AI provider: `gemini` or `ollama` |
83
+ | `--api-key <key>` | Gemini API key |
84
+ | `--force` | Ignore cache, rebuild everything |
85
+ | `--attempts <n>` | Max auto-correction retries (default: 5) |
86
+
87
+ ### `intend watch`
88
+
89
+ Watch for changes and auto-rebuild.
90
+
91
+ ```bash
92
+ intend watch
93
+ ```
94
+
95
+ ### `intend parse <file>`
96
+
97
+ Parse a single file and output AST/CST (useful for debugging).
98
+
99
+ ```bash
100
+ intend parse src/intents/user.intent --ast
101
+ intend parse src/intents/user.intent --cst
102
+ ```
103
+
104
+ ## Configuration
105
+
106
+ Create `intend.config.json` in your project root:
107
+
108
+ ```json
109
+ {
110
+ "sourceDir": "./src/intents",
111
+ "outDir": "./out",
112
+ "provider": "gemini",
113
+ "gemini": {
114
+ "apiKey": "${GEMINI_API_KEY}",
115
+ "model": "gemini-2.0-flash",
116
+ "temperature": 0.2
117
+ }
118
+ }
119
+ ```
120
+
121
+ ### Using Ollama (Local AI)
122
+
123
+ ```json
124
+ {
125
+ "sourceDir": "./src/intents",
126
+ "outDir": "./out",
127
+ "provider": "ollama",
128
+ "ollama": {
129
+ "model": "llama3",
130
+ "baseUrl": "http://localhost:11434",
131
+ "num_thread": 4
132
+ }
133
+ }
134
+ ```
135
+
136
+ ## Example Workflow
137
+
138
+ **1. Write an intent file** (`src/intents/math.intent`):
139
+
140
+ ```typescript
141
+ export intent Add(a: number, b: number) -> number {
142
+ invariant "Both inputs must be numbers"
143
+ step "Add the two numbers together" => const result
144
+ ensure result is a number
145
+ }
146
+
147
+ export intent Multiply(a: number, b: number) -> number {
148
+ step "Multiply the numbers" => const product
149
+ ensure product is a number
150
+ }
151
+ ```
152
+
153
+ **2. Build:**
154
+
155
+ ```bash
156
+ $ intend build
157
+
158
+ ✨ Intend Build
159
+
160
+ Source ./src/intents
161
+ Output ./out
162
+ Provider gemini
163
+
164
+ ◐ Scanning for .intent files...
165
+ ✔ Found 1 intent file
166
+
167
+ Compiling
168
+
169
+ ✔ math.intent 1247ms
170
+
171
+ Summary
172
+
173
+ ✔ 1 compiled
174
+ → 1.25s
175
+ ```
176
+
177
+ **3. Use the generated code:**
178
+
179
+ ```typescript
180
+ import { Add, Multiply } from "./out/math";
181
+
182
+ const sum = Add(5, 3); // 8
183
+ const product = Multiply(4, 7); // 28
184
+ ```
185
+
186
+ ## Environment Variables
187
+
188
+ | Variable | Description |
189
+ |----------|-------------|
190
+ | `GEMINI_API_KEY` | Google Gemini API key |
191
+ | `INTEND_PROVIDER` | Default provider (`gemini` or `ollama`) |
192
+
193
+ ## Related Packages
194
+
195
+ - [`@intend-it/parser`](https://www.npmjs.com/package/@intend-it/parser) - Lexer and parser
196
+ - [`@intend-it/core`](https://www.npmjs.com/package/@intend-it/core) - AI code generator
197
+
198
+ ## License
199
+
200
+ MIT © [Intend Team](https://github.com/DRFR0ST/intend)
package/dist/index.js CHANGED
@@ -65,9 +65,12 @@ function createConfigFile(directory = process.cwd()) {
65
65
  // src/ui.ts
66
66
  import pc from "picocolors";
67
67
  import ora from "ora";
68
+ import { createRequire } from "module";
69
+ var require2 = createRequire(import.meta.url);
70
+ var pkg = require2("../package.json");
68
71
  var BRAND = {
69
72
  name: "intend",
70
- version: "0.0.1"
73
+ version: pkg.version
71
74
  };
72
75
  var heading = (text) => pc.bold(text);
73
76
  var success = (text) => pc.green(text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intend-it/cli",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "CLI for the Intend programming language",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,8 +29,8 @@
29
29
  ],
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "@intend-it/parser": "workspace:*",
33
- "@intend-it/core": "workspace:*",
32
+ "@intend-it/parser": "^1.1.1",
33
+ "@intend-it/core": "^2.0.1",
34
34
  "picocolors": "^1.1.1",
35
35
  "ora": "^8.1.1"
36
36
  },