infernoflow 0.32.3 → 0.32.5

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
@@ -1,97 +1,233 @@
1
1
  # 🔥 infernoflow
2
- > The forge for liquid code — keep capabilities, contracts, and docs in sync with your codebase.
2
+ > The forge for liquid code — keep capabilities, contracts, and docs in sync automatically as your codebase evolves.
3
3
 
4
4
  ## What it does
5
- infernoflow ensures that when your code changes, your **capability contracts** and **documentation** stay in sync. It prevents semantic drift — where code evolves but no one knows what the system can actually do.
5
+
6
+ infernoflow prevents **semantic drift** — where code changes daily but nobody knows what the system actually does. It tracks your project's capabilities, keeps contracts up to date, and works silently in the background so developers never have to think about it.
7
+
8
+ Works standalone in any terminal, as a VS Code extension, and as an MCP server inside Claude Code, Cursor, and GitHub Copilot.
6
9
 
7
10
  ## Install
11
+
8
12
  ```bash
9
13
  npm install -g infernoflow
10
- # or:
11
- npx infernoflow init
12
14
  ```
13
15
 
14
16
  ## Quick Start
17
+
15
18
  ```bash
16
- npx infernoflow init
17
- npx infernoflow install-cursor-hooks # installs MCP server + .cursor/mcp.json
18
- # Restart Cursor → Settings → MCP → infernoflow: 4 tools enabled
19
- infernoflow status
20
- infernoflow suggest "added email notifications"
21
- infernoflow check
19
+ # Initialize infernoflow in your project
20
+ infernoflow init
21
+
22
+ # Set up AI provider (Anthropic, OpenAI, Gemini, OpenRouter, or Ollama)
23
+ infernoflow ai setup
24
+
25
+ # Set up MCP server for Claude Code / Cursor
26
+ infernoflow setup --yes
27
+
28
+ # Check project health
29
+ infernoflow doctor
22
30
  ```
23
31
 
24
- ## Cursor MCP Integration (recommended)
32
+ ---
25
33
 
26
- After running `install-cursor-hooks`, infernoflow registers as an MCP server inside Cursor. No copy/paste — Cursor calls infernoflow tools directly in chat.
34
+ ## AI Provider Setup
35
+
36
+ infernoflow uses AI for `explain`, `why`, `review`, `changelog ai`, and auto contract sync.
27
37
 
28
- ### Setup
29
38
  ```bash
30
- infernoflow install-cursor-hooks
31
- # Restart Cursor
32
- # Settings MCP infernoflow: 4 tools enabled
39
+ infernoflow ai setup # interactive numbered menu
40
+ infernoflow ai status # show configured providers
41
+ infernoflow ai test # send a test prompt
42
+ infernoflow ai clear # remove a provider's key
33
43
  ```
34
44
 
35
- ### MCP tools
45
+ Supported providers — no API key needed for Ollama:
46
+
47
+ | Provider | Env variable | Default model |
48
+ |---|---|---|
49
+ | Anthropic (Claude) | `ANTHROPIC_API_KEY` | claude-sonnet-4-6 |
50
+ | OpenAI (GPT) | `OPENAI_API_KEY` | gpt-4o |
51
+ | Google Gemini | `GOOGLE_AI_API_KEY` | gemini-2.0-flash |
52
+ | OpenRouter | `OPENROUTER_API_KEY` | any model |
53
+ | Ollama (local) | — | llama3.2 |
54
+
55
+ If you have **Claude Code for VS Code** or **GitHub Copilot**, infernoflow picks up the active model automatically — no API key required.
56
+
57
+ ---
58
+
59
+ ## MCP Integration (Claude Code / Cursor / Copilot)
60
+
61
+ After setup, infernoflow registers as an MCP server. Claude Code and Cursor call infernoflow tools automatically — no manual commands needed.
62
+
63
+ ```bash
64
+ infernoflow setup --yes # Claude Code / Cursor
65
+ infernoflow install-cursor-hooks # Cursor only
66
+ infernoflow install-vscode-copilot-hooks # VS Code + Copilot
67
+ ```
68
+
69
+ ### MCP tools available in chat
36
70
 
37
71
  | Tool | What it does |
38
72
  |---|---|
39
- | `infernoflow_run` | Generates a task prompt from your contract |
40
- | `infernoflow_apply` | Applies the JSON response updates contract + CHANGELOG |
41
- | `infernoflow_check` | Validates contract sync |
42
- | `infernoflow_status` | Shows contract health |
73
+ | `infernoflow_status` | Contract health snapshot |
74
+ | `infernoflow_context` | Load full project state into AI context |
75
+ | `infernoflow_suggest` | Update capability contract from a description |
76
+ | `infernoflow_apply` | Apply a JSON suggestion — updates contract + CHANGELOG |
77
+ | `infernoflow_check` | Validate contract sync |
78
+ | `infernoflow_implement` | Generate a structured implementation plan |
79
+ | `infernoflow_review` | Check for capability drift risk |
80
+ | `infernoflow_synthesize` | Detect repeating workflows and turn them into agents |
81
+ | `infernoflow_version` | Recommend semver bump based on capability changes |
82
+ | `infernoflow_git_drift` | Detect drift between git commits and contract |
83
+
84
+ ### How it works in Claude Code
43
85
 
44
- ### Workflow in Cursor chat
45
86
  ```
46
- You: Use infernoflow_run with task "add search functionality"
47
- Cursor: [calls infernoflow_runreturns prompt]
48
- Cursor: [generates JSON]
49
- Cursor: [calls infernoflow_apply]
50
- contract.json, capabilities.json, CHANGELOG.md updated + validated
87
+ You: "add search functionality to the task list"
88
+ Claude: [calls infernoflow_implementstructured plan]
89
+ Claude: [writes the code]
90
+ Claude: [calls infernoflow_suggest → contract updated silently]
91
+ capabilities.json, contract.json, CHANGELOG.md stay in sync
51
92
  ```
52
93
 
53
- ### Terminal fallback (without MCP)
54
- ```bash
55
- infernoflow run "add search functionality"
56
- # writes inferno/agent-prompt.md and waits
57
- # paste prompt into Cursor/Claude save JSON to inferno/agent-response.json
58
- # infernoflow picks it up and applies automatically
59
- ```
94
+ ---
95
+
96
+ ## VS Code Extension
97
+
98
+ Install `infernoflow-X.X.X.vsix` from the `vscode-extension/` folder in the repo.
99
+
100
+ **What the extension does:**
101
+ - **Status bar** — permanent `🔥 infernoflow: 12 caps ✓` badge. Click for quick actions menu.
102
+ - **Save-triggered sync** — when you save a source file mapped in `capability-map.json`, infernoflow automatically runs `suggest` + `check` in the background (3s debounce). Zero manual steps.
103
+ - **Drift notification** — if check finds issues after a save, a one-time warning appears with a "View check" button.
104
+ - **Right-click → Sync contract** — right-click any `.ts`/`.js`/`.py` file to manually sync.
105
+ - **Sidebar panels** — Capabilities, Scenarios, Changelog, Agents tree views.
106
+ - **Inline annotations** — capability IDs shown next to matching functions.
107
+ - **AI review** — uses Claude Code / Copilot model directly, no extra key needed.
108
+
109
+ ---
60
110
 
61
111
  ## Commands
62
112
 
113
+ ### Core
63
114
  | Command | Description |
64
115
  |---|---|
65
- | `infernoflow init` | Scaffold inferno/ in your project |
66
- | `infernoflow install-cursor-hooks` | MCP server + hooks + .cursor/mcp.json |
67
- | `infernoflow install-vscode-copilot-hooks` | VS Code + Copilot hooks (Preview) |
116
+ | `infernoflow init` | Scaffold `inferno/` in your project |
68
117
  | `infernoflow status` | Contract health at a glance |
69
- | `infernoflow check` | Full validation |
70
- | `infernoflow suggest` | AI-powered contract update |
71
- | `infernoflow run` | One-command flow with rollback |
72
- | `infernoflow implement` | Generate coding agent prompts |
73
- | `infernoflow context` | Build AI session context |
74
- | `infernoflow doc-gate` | Fail if docs not updated |
75
- | `infernoflow pr-impact` | Analyze PR capability drift |
118
+ | `infernoflow check` | Full contract validation |
119
+ | `infernoflow doctor` | Full diagnostic with auto-fix suggestions |
120
+ | `infernoflow setup --yes` | Install MCP server, CLAUDE.md, git hooks |
121
+
122
+ ### AI
123
+ | Command | Description |
124
+ |---|---|
125
+ | `infernoflow ai setup` | Interactive AI provider setup |
126
+ | `infernoflow ai status` | Show configured providers |
127
+ | `infernoflow ai test` | Test AI connection |
128
+ | `infernoflow suggest "what changed"` | AI-powered contract update |
129
+ | `infernoflow explain src/auth.ts` | Explain a file's capabilities |
130
+ | `infernoflow why src/auth.ts` | Map file to contract capabilities |
131
+ | `infernoflow review` | AI review of staged changes |
132
+ | `infernoflow changelog ai` | AI-generated changelog entry |
133
+
134
+ ### Code Intelligence
135
+ | Command | Description |
136
+ |---|---|
137
+ | `infernoflow scan` | AST scan — detect capabilities from code |
138
+ | `infernoflow graph` | Capability dependency graph |
139
+ | `infernoflow impact` | Blast radius of a change |
140
+ | `infernoflow coverage` | Map test files to capabilities |
141
+ | `infernoflow stability` | Show frozen/stable/experimental capabilities |
142
+ | `infernoflow freeze <cap>` | Lock a capability (prevents accidental changes) |
143
+
144
+ ### Workflow
145
+ | Command | Description |
146
+ |---|---|
147
+ | `infernoflow watch` | Auto-run suggest on every file save |
148
+ | `infernoflow run` | One-command detect → propose → apply flow |
149
+ | `infernoflow implement "task"` | Generate a structured coding plan |
150
+ | `infernoflow context` | Build AI session context file |
151
+ | `infernoflow diff` | Show capability changes since last tag |
152
+ | `infernoflow version` | Recommend semver bump |
153
+ | `infernoflow changelog update` | Draft Unreleased section from commits |
154
+
155
+ ### Ops
156
+ | Command | Description |
157
+ |---|---|
158
+ | `infernoflow ci` | CI/CD integration helper |
159
+ | `infernoflow report` | Generate capability report |
160
+ | `infernoflow snapshot save <name>` | Save a contract snapshot |
161
+ | `infernoflow export` | Export contract to various formats |
162
+ | `infernoflow audit` | Security audit of capabilities |
163
+ | `infernoflow health` | Health score (0–100) |
164
+ | `infernoflow demo` | Narrated 7-step walkthrough |
165
+
166
+ ### Agents
167
+ | Command | Description |
168
+ |---|---|
169
+ | `infernoflow synthesize` | Detect repeating workflows → auto-agents |
170
+ | `infernoflow agent run <name>` | Run a synthesized agent |
171
+ | `infernoflow test` | Run capability scenario tests |
172
+
173
+ ---
76
174
 
77
175
  ## CI Integration
176
+
78
177
  ```yaml
79
178
  - name: infernoflow check
80
179
  run: npx infernoflow check --json
180
+
81
181
  - name: infernoflow doc-gate
82
182
  run: npx infernoflow doc-gate --json
83
183
  ```
84
184
 
185
+ ---
186
+
187
+ ## Watch Mode
188
+
189
+ Zero-effort contract sync while you code:
190
+
191
+ ```bash
192
+ infernoflow watch # watches src/ (auto-detected)
193
+ infernoflow watch src lib # watch specific directories
194
+ infernoflow watch --interval 5 # 5s debounce
195
+ ```
196
+
197
+ On every source file save, infernoflow checks if the file is mapped to any capabilities, runs `suggest` silently, and logs any issues to `inferno/WATCH.log`.
198
+
199
+ ---
200
+
201
+ ## Stability Markers
202
+
203
+ Tag capabilities as frozen, stable, or experimental:
204
+
205
+ ```bash
206
+ infernoflow freeze auth-login # lock — no changes allowed
207
+ infernoflow thaw auth-login # unlock
208
+ infernoflow stability # view all markers
209
+ ```
210
+
211
+ Frozen capabilities are protected from accidental contract changes.
212
+
213
+ ---
214
+
85
215
  ## Troubleshooting
86
216
 
87
- - **MCP not showing in Cursor** — restart Cursor completely after install-cursor-hooks
88
- - `ide_agent_bridge_not_configured` — use MCP tools in Cursor chat instead
89
- - **infernoflow not found** use `npx infernoflow` or install globally
90
- - **PowerShell scripts disabled** run `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass`
217
+ | Problem | Fix |
218
+ |---|---|
219
+ | `infernoflow not found` | Use `npx infernoflow` or `npm install -g infernoflow` |
220
+ | MCP not showing in Cursor | Restart Cursor after `install-cursor-hooks` |
221
+ | `apply` command fails | Ensure `infernoflow ai setup` is done |
222
+ | No AI provider | Run `infernoflow ai setup` or set `ANTHROPIC_API_KEY` |
223
+ | PowerShell scripts disabled | `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` |
224
+ | `infernoflow doctor` shows warnings | Run `infernoflow doctor --fix` to auto-fix |
225
+
226
+ ---
91
227
 
92
228
  ## Why infernoflow?
93
229
 
94
- AI-assisted development moves fast. Code changes daily. But what does the system *actually do*? infernoflow keeps the answer current — automatically.
230
+ AI-assisted development moves fast. Code changes daily. But what does the system *actually do*? infernoflow keeps the answer current — automatically, invisibly, without interrupting the developer.
95
231
 
96
232
  ## License
97
- MIT
233
+ MIT
@@ -234,3 +234,62 @@ export function detectAvailableProviders(cwd) {
234
234
  ollama: false, // checked async — doctor runs its own check
235
235
  };
236
236
  }
237
+
238
+ /**
239
+ * Resolve which provider + IDE is available for the `run` command.
240
+ * Returns a structured object that run.mjs uses to decide how to proceed.
241
+ *
242
+ * @param {string} providerRequested - "auto"|"anthropic"|"openai"|etc.
243
+ * @param {string} ideRequested - "auto"|"vscode"|"cursor"|etc.
244
+ * @returns {{ providerResolved: string, ideDetected: string, agentAvailable: boolean, reasonCodes: string[], error?: string }}
245
+ */
246
+ export async function resolveProvider(providerRequested = "auto", ideRequested = "auto") {
247
+ const cwd = process.cwd();
248
+ const config = readAiConfig(cwd);
249
+ const reasons = [];
250
+
251
+ // Detect IDE
252
+ const inVsCode = !!process.env.VSCODE_PID || !!process.env.TERM_PROGRAM?.includes("vscode");
253
+ const inCursor = !!process.env.CURSOR_TRACE_ID || !!process.env.CURSOR_CHANNEL;
254
+ const ideDetected = inCursor ? "cursor" : inVsCode ? "vscode" : "terminal";
255
+
256
+ // Detect available providers
257
+ const available = {
258
+ anthropic: !!(process.env.ANTHROPIC_API_KEY || config.anthropic?.apiKey),
259
+ openai: !!(process.env.OPENAI_API_KEY || config.openai?.apiKey),
260
+ gemini: !!(process.env.GOOGLE_AI_API_KEY || process.env.GEMINI_API_KEY || config.gemini?.apiKey),
261
+ openrouter: !!(process.env.OPENROUTER_API_KEY || config.openrouter?.apiKey),
262
+ ollama: false,
263
+ vscode: inVsCode || inCursor,
264
+ };
265
+
266
+ // Check Ollama quickly (sync port probe via env hint)
267
+ if (process.env.OLLAMA_HOST || config.ollama?.host) {
268
+ available.ollama = true;
269
+ reasons.push("ollama_env");
270
+ }
271
+
272
+ // Resolve which provider to use
273
+ let providerResolved = "none";
274
+ const forced = (providerRequested || "auto").toLowerCase();
275
+
276
+ if (forced !== "auto" && forced !== "prompt" && available[forced]) {
277
+ providerResolved = forced;
278
+ reasons.push(`forced_${forced}`);
279
+ } else {
280
+ // Priority order: vscode/cursor IDE → anthropic → openai → gemini → openrouter → ollama
281
+ const priority = ["vscode", "anthropic", "openai", "gemini", "openrouter", "ollama"];
282
+ for (const p of priority) {
283
+ if (available[p]) { providerResolved = p; reasons.push(`auto_${p}`); break; }
284
+ }
285
+ }
286
+
287
+ const agentAvailable = providerResolved !== "none";
288
+
289
+ if (!agentAvailable) {
290
+ reasons.push("no_provider");
291
+ return { providerResolved: "none", ideDetected, agentAvailable: false, reasonCodes: reasons, error: "agent_unavailable" };
292
+ }
293
+
294
+ return { providerResolved, ideDetected, agentAvailable: true, reasonCodes: reasons };
295
+ }
@@ -323,12 +323,10 @@ function loadCapsFromDisk(infernoDir) {
323
323
  }
324
324
 
325
325
  function loadCapsAtRef(ref, cwd) {
326
- const { execSync: _exec } = await import ? null : null; // handled below
327
326
  try {
328
- const { execSync: ex } = await import("node:child_process");
329
327
  for (const name of ["capabilities.json", "contract.json"]) {
330
328
  try {
331
- const content = ex(`git show "${ref}:inferno/${name}"`, {
329
+ const content = execSync(`git show "${ref}:inferno/${name}"`, {
332
330
  cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"]
333
331
  }).trim();
334
332
  if (content) return parseCaps(content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infernoflow",
3
- "version": "0.32.3",
3
+ "version": "0.32.5",
4
4
  "description": "The forge for liquid code - keep capabilities, contracts, and docs in sync.",
5
5
  "type": "module",
6
6
  "bin": {