infernoflow 0.10.7 → 0.10.8
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 +46 -4
- package/bin/infernoflow.mjs +8 -0
- package/lib/ai/localProvider.mjs +88 -0
- package/lib/commands/adopt.mjs +768 -768
- package/lib/commands/implement.mjs +103 -103
- package/lib/commands/init.mjs +1 -0
- package/lib/commands/prImpact.mjs +157 -157
- package/lib/commands/run.mjs +227 -0
- package/lib/commands/suggest.mjs +42 -12
- package/lib/commands/syncAuto.mjs +96 -96
- package/package.json +2 -2
- package/templates/ci/github-inferno-check.yml +33 -36
- package/templates/scripts/inferno-install-hooks.mjs +36 -36
package/README.md
CHANGED
|
@@ -166,6 +166,7 @@ infernoflow doc-gate --json
|
|
|
166
166
|
| `infernoflow status` | At-a-glance health of your contract |
|
|
167
167
|
| `infernoflow suggest` | Generate an AI prompt, apply capability updates |
|
|
168
168
|
| `infernoflow implement` | Generate implementation prompts for coding agents |
|
|
169
|
+
| `infernoflow run` | One-command local-model flow with validation and rollback |
|
|
169
170
|
| `infernoflow pr-impact` | Analyze changed files and infer capability/doc drift |
|
|
170
171
|
| `infernoflow sync --auto` | Deterministic sync flow for agents (skeleton) |
|
|
171
172
|
| `infernoflow check` | Full validation: contract, capabilities, scenarios, changelog |
|
|
@@ -185,6 +186,9 @@ infernoflow implement "..." --mode both
|
|
|
185
186
|
infernoflow implement "..." --mode cursor
|
|
186
187
|
infernoflow implement "..." --mode generic
|
|
187
188
|
infernoflow implement "..." --mode both --copy
|
|
189
|
+
infernoflow run "add favorite badge to tasks"
|
|
190
|
+
infernoflow run "sync check" --dry-run
|
|
191
|
+
infernoflow run "sync check" --json
|
|
188
192
|
infernoflow pr-impact
|
|
189
193
|
infernoflow pr-impact --json
|
|
190
194
|
infernoflow sync --auto
|
|
@@ -232,6 +236,43 @@ Proposed Changes
|
|
|
232
236
|
|
|
233
237
|
Works with any AI — Claude, ChatGPT, GitHub Copilot, Cursor, or your own setup.
|
|
234
238
|
|
|
239
|
+
## `infernoflow run` — zero copy/paste flow
|
|
240
|
+
|
|
241
|
+
Run one command and infernoflow will:
|
|
242
|
+
1. Detect drift (`pr-impact`)
|
|
243
|
+
2. Generate suggestion via local model
|
|
244
|
+
3. Apply inferno updates
|
|
245
|
+
4. Validate with `check`
|
|
246
|
+
5. Roll back automatically if validation fails
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
infernoflow run "add favorite badge to tasks and filter by favorite"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Machine mode:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
infernoflow run "sync check" --json
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Local model configuration (required):
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
# default provider: ollama
|
|
262
|
+
set INFERNO_LOCAL_PROVIDER=ollama
|
|
263
|
+
set INFERNO_LOCAL_ENDPOINT=http://127.0.0.1:11434/api/generate
|
|
264
|
+
set INFERNO_LOCAL_MODEL=llama3.1:8b
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Optional OpenAI-compatible local server:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
set INFERNO_LOCAL_PROVIDER=openai
|
|
271
|
+
set INFERNO_LOCAL_ENDPOINT=http://127.0.0.1:1234/v1/chat/completions
|
|
272
|
+
set INFERNO_LOCAL_MODEL=local-model
|
|
273
|
+
set INFERNO_LOCAL_API_KEY=local
|
|
274
|
+
```
|
|
275
|
+
|
|
235
276
|
## `infernoflow implement` — code-agent execution prompts
|
|
236
277
|
|
|
237
278
|
Generate coding prompts from your project context and inferno contract:
|
|
@@ -279,11 +320,12 @@ Recommended chain:
|
|
|
279
320
|
|
|
280
321
|
```yaml
|
|
281
322
|
# .github/workflows/ci.yml
|
|
282
|
-
- name: infernoflow
|
|
283
|
-
run:
|
|
284
|
-
npx infernoflow pr-impact --json
|
|
285
|
-
npx infernoflow check --json
|
|
323
|
+
- name: infernoflow run
|
|
324
|
+
run: npx infernoflow run "sync check" --json
|
|
286
325
|
env:
|
|
326
|
+
INFERNO_LOCAL_PROVIDER: ollama
|
|
327
|
+
INFERNO_LOCAL_ENDPOINT: http://127.0.0.1:11434/api/generate
|
|
328
|
+
INFERNO_LOCAL_MODEL: llama3.1:8b
|
|
287
329
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
288
330
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
289
331
|
```
|
package/bin/infernoflow.mjs
CHANGED
|
@@ -13,6 +13,7 @@ const COMMAND_DESCRIPTIONS = {
|
|
|
13
13
|
status: "Show contract health at a glance",
|
|
14
14
|
"pr-impact": "Summarize PR impact on capabilities and docs",
|
|
15
15
|
sync: "Run deterministic inferno sync flow",
|
|
16
|
+
run: "One-command detect/propose/apply/validate flow",
|
|
16
17
|
"doc-gate": "Fail if code changed but docs were not updated",
|
|
17
18
|
suggest: "Generate AI prompt + apply capability updates",
|
|
18
19
|
implement: "Generate code-agent implementation prompt(s)",
|
|
@@ -25,6 +26,7 @@ const COMMAND_HANDLERS = {
|
|
|
25
26
|
status: async (args) => (await import("../lib/commands/status.mjs")).statusCommand(args),
|
|
26
27
|
"pr-impact": async (args) => (await import("../lib/commands/prImpact.mjs")).prImpactCommand(args),
|
|
27
28
|
sync: async (args) => (await import("../lib/commands/syncAuto.mjs")).syncCommand(args),
|
|
29
|
+
run: async (args) => (await import("../lib/commands/run.mjs")).runCommand(args),
|
|
28
30
|
suggest: async (args) => (await import("../lib/commands/suggest.mjs")).suggestCommand(args),
|
|
29
31
|
implement: async (args) => (await import("../lib/commands/implement.mjs")).implementCommand(args),
|
|
30
32
|
context: async (args) => (await import("../lib/commands/context.mjs")).contextCommand(args),
|
|
@@ -70,6 +72,11 @@ ${formatCommandsHelp()}
|
|
|
70
72
|
--mode <type> cursor | generic | both (default: both)
|
|
71
73
|
--copy, -c Copy generated prompt(s) to clipboard
|
|
72
74
|
|
|
75
|
+
${bold("run options:")}
|
|
76
|
+
--dry-run Execute full flow without writing files
|
|
77
|
+
--json Emit machine-readable events and result payload
|
|
78
|
+
--no-rollback Keep changes even if validation fails
|
|
79
|
+
|
|
73
80
|
${bold("Typical workflow:")}
|
|
74
81
|
${gray('1. infernoflow context --intent "what I want to build"')}
|
|
75
82
|
${gray("2. [paste inferno/CONTEXT.md into Claude / Cursor / Copilot]")}
|
|
@@ -83,6 +90,7 @@ ${formatCommandsHelp()}
|
|
|
83
90
|
${gray("doc-gate --json")}
|
|
84
91
|
${gray("pr-impact --json")}
|
|
85
92
|
${gray("sync --auto --json")}
|
|
93
|
+
${gray('run "task" --json')}
|
|
86
94
|
`;
|
|
87
95
|
|
|
88
96
|
const [, , cmd, ...rest] = process.argv;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const DEFAULT_TIMEOUT_MS = 45000;
|
|
2
|
+
|
|
3
|
+
function withTimeout(ms) {
|
|
4
|
+
const controller = new AbortController();
|
|
5
|
+
const timer = setTimeout(() => controller.abort(), ms);
|
|
6
|
+
return { controller, timer };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function callOllama(prompt, timeoutMs) {
|
|
10
|
+
const endpoint = process.env.INFERNO_LOCAL_ENDPOINT || "http://127.0.0.1:11434/api/generate";
|
|
11
|
+
const model = process.env.INFERNO_LOCAL_MODEL || "llama3.1:8b";
|
|
12
|
+
const { controller, timer } = withTimeout(timeoutMs);
|
|
13
|
+
try {
|
|
14
|
+
const res = await fetch(endpoint, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: { "Content-Type": "application/json" },
|
|
17
|
+
signal: controller.signal,
|
|
18
|
+
body: JSON.stringify({
|
|
19
|
+
model,
|
|
20
|
+
prompt,
|
|
21
|
+
stream: false,
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
if (!res.ok) {
|
|
25
|
+
const body = await res.text();
|
|
26
|
+
throw new Error(`local_model_http_${res.status}: ${body.slice(0, 240)}`);
|
|
27
|
+
}
|
|
28
|
+
const data = await res.json();
|
|
29
|
+
if (!data?.response || typeof data.response !== "string") {
|
|
30
|
+
throw new Error("local_model_invalid_response");
|
|
31
|
+
}
|
|
32
|
+
return data.response.trim();
|
|
33
|
+
} finally {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function callOpenAICompat(prompt, timeoutMs) {
|
|
39
|
+
const endpoint = process.env.INFERNO_LOCAL_ENDPOINT || "http://127.0.0.1:1234/v1/chat/completions";
|
|
40
|
+
const model = process.env.INFERNO_LOCAL_MODEL || "local-model";
|
|
41
|
+
const apiKey = process.env.INFERNO_LOCAL_API_KEY || "local";
|
|
42
|
+
const { controller, timer } = withTimeout(timeoutMs);
|
|
43
|
+
try {
|
|
44
|
+
const res = await fetch(endpoint, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: {
|
|
47
|
+
"Content-Type": "application/json",
|
|
48
|
+
Authorization: `Bearer ${apiKey}`,
|
|
49
|
+
},
|
|
50
|
+
signal: controller.signal,
|
|
51
|
+
body: JSON.stringify({
|
|
52
|
+
model,
|
|
53
|
+
temperature: 0.1,
|
|
54
|
+
messages: [
|
|
55
|
+
{ role: "system", content: "Return JSON only." },
|
|
56
|
+
{ role: "user", content: prompt },
|
|
57
|
+
],
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
if (!res.ok) {
|
|
61
|
+
const body = await res.text();
|
|
62
|
+
throw new Error(`local_model_http_${res.status}: ${body.slice(0, 240)}`);
|
|
63
|
+
}
|
|
64
|
+
const data = await res.json();
|
|
65
|
+
const text = data?.choices?.[0]?.message?.content;
|
|
66
|
+
if (!text || typeof text !== "string") {
|
|
67
|
+
throw new Error("local_model_invalid_response");
|
|
68
|
+
}
|
|
69
|
+
return text.trim();
|
|
70
|
+
} finally {
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function generateWithLocalModel(prompt, options = {}) {
|
|
76
|
+
if (process.env.INFERNO_LOCAL_MOCK_RESPONSE) {
|
|
77
|
+
return process.env.INFERNO_LOCAL_MOCK_RESPONSE;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const provider = (process.env.INFERNO_LOCAL_PROVIDER || "ollama").toLowerCase();
|
|
81
|
+
const timeoutMs = Number(options.timeoutMs || process.env.INFERNO_LOCAL_TIMEOUT_MS || DEFAULT_TIMEOUT_MS);
|
|
82
|
+
|
|
83
|
+
if (provider === "openai") {
|
|
84
|
+
return callOpenAICompat(prompt, timeoutMs);
|
|
85
|
+
}
|
|
86
|
+
return callOllama(prompt, timeoutMs);
|
|
87
|
+
}
|
|
88
|
+
|