infernoflow 0.10.23 → 0.10.26
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/CHANGELOG.md +13 -6
- package/dist/bin/infernoflow.mjs +135 -41
- package/dist/lib/adopters/angular.mjs +128 -1
- package/dist/lib/adopters/css.mjs +111 -1
- package/dist/lib/adopters/react.mjs +104 -1
- package/dist/lib/ai/ideDetection.mjs +31 -1
- package/dist/lib/ai/localProvider.mjs +88 -1
- package/dist/lib/ai/providerRouter.mjs +73 -1
- package/dist/lib/commands/adopt.mjs +869 -20
- package/dist/lib/commands/changelog.mjs +343 -21
- package/dist/lib/commands/check.mjs +179 -3
- package/dist/lib/commands/context.mjs +287 -31
- package/dist/lib/commands/diff.mjs +274 -5
- package/dist/lib/commands/docGate.mjs +81 -2
- package/dist/lib/commands/generateSkills.mjs +163 -38
- package/dist/lib/commands/implement.mjs +103 -7
- package/dist/lib/commands/init.mjs +394 -10
- package/dist/lib/commands/installCursorHooks.mjs +36 -1
- package/dist/lib/commands/installVsCodeCopilotHooks.mjs +37 -1
- package/dist/lib/commands/prImpact.mjs +157 -2
- package/dist/lib/commands/publish.mjs +293 -15
- package/dist/lib/commands/run.mjs +336 -8
- package/dist/lib/commands/setup.mjs +234 -4
- package/dist/lib/commands/status.mjs +172 -4
- package/dist/lib/commands/suggest.mjs +563 -21
- package/dist/lib/commands/syncAuto.mjs +96 -1
- package/dist/lib/cursorHooksInstall.mjs +60 -1
- package/dist/lib/draftToolingInstall.mjs +68 -7
- package/dist/lib/git/detect-drift.mjs +208 -4
- package/dist/lib/learning/adapt.mjs +101 -6
- package/dist/lib/learning/observe.mjs +114 -1
- package/dist/lib/learning/profile.mjs +212 -2
- package/dist/lib/ui/output.mjs +72 -6
- package/dist/lib/ui/prompts.mjs +147 -6
- package/dist/lib/vsCodeCopilotHooksInstall.mjs +42 -1
- package/package.json +47 -47
|
@@ -1 +1,31 @@
|
|
|
1
|
-
function
|
|
1
|
+
export function detectIdeContext(preferredIde = "auto") {
|
|
2
|
+
const env = process.env;
|
|
3
|
+
const lowerPreferred = String(preferredIde || "auto").toLowerCase();
|
|
4
|
+
|
|
5
|
+
const hasCursor = !!(env.CURSOR_TRACE_ID || env.CURSOR_AGENT || env.CURSOR_SESSION_ID || (env.VSCODE_GIT_ASKPASS_NODE || "").toLowerCase().includes("cursor") || (env.VSCODE_GIT_ASKPASS_MAIN || "").toLowerCase().includes("cursor"));
|
|
6
|
+
const hasVscode = !!(env.VSCODE_PID || env.VSCODE_CWD || env.GITHUB_COPILOT_AGENT);
|
|
7
|
+
const hasWindsurf = !!(env.WINDSURF || env.CODEIUM || env.WINDSURF_SESSION_ID);
|
|
8
|
+
|
|
9
|
+
let ideDetected = "unknown";
|
|
10
|
+
if (hasCursor) ideDetected = "cursor";
|
|
11
|
+
else if (hasVscode) ideDetected = "vscode";
|
|
12
|
+
else if (hasWindsurf) ideDetected = "windsurf";
|
|
13
|
+
|
|
14
|
+
if (lowerPreferred !== "auto" && ["cursor", "vscode", "windsurf"].includes(lowerPreferred)) {
|
|
15
|
+
ideDetected = lowerPreferred;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const explicitAgentAvailability = env.INFERNO_AGENT_AVAILABLE;
|
|
19
|
+
const agentAvailable = explicitAgentAvailability != null
|
|
20
|
+
? explicitAgentAvailability === "1" || explicitAgentAvailability === "true"
|
|
21
|
+
: ideDetected !== "unknown";
|
|
22
|
+
|
|
23
|
+
const reasonCodes = [];
|
|
24
|
+
if (ideDetected !== "unknown") reasonCodes.push(`IDE_${ideDetected.toUpperCase()}_DETECTED`);
|
|
25
|
+
else reasonCodes.push("IDE_UNKNOWN");
|
|
26
|
+
if (agentAvailable) reasonCodes.push("IDE_AGENT_AVAILABLE");
|
|
27
|
+
else reasonCodes.push("IDE_AGENT_UNAVAILABLE");
|
|
28
|
+
|
|
29
|
+
return { ideDetected, agentAvailable, reasonCodes };
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -1 +1,88 @@
|
|
|
1
|
-
const
|
|
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
|
+
|
|
@@ -1 +1,73 @@
|
|
|
1
|
-
import{detectIdeContext
|
|
1
|
+
import { detectIdeContext } from "./ideDetection.mjs";
|
|
2
|
+
|
|
3
|
+
export async function resolveProvider(requestedProvider = "auto", preferredIde = "auto") {
|
|
4
|
+
const providerRequested = String(requestedProvider || "auto").toLowerCase();
|
|
5
|
+
const ide = detectIdeContext(preferredIde);
|
|
6
|
+
const reasonCodes = [...ide.reasonCodes];
|
|
7
|
+
|
|
8
|
+
if (providerRequested === "local") {
|
|
9
|
+
reasonCodes.push("LOCAL_PROVIDER_SELECTED");
|
|
10
|
+
return {
|
|
11
|
+
providerRequested,
|
|
12
|
+
providerResolved: "local",
|
|
13
|
+
ideDetected: ide.ideDetected,
|
|
14
|
+
agentAvailable: ide.agentAvailable,
|
|
15
|
+
reasonCodes,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (providerRequested === "prompt") {
|
|
20
|
+
reasonCodes.push("PROMPT_PROVIDER_SELECTED");
|
|
21
|
+
return {
|
|
22
|
+
providerRequested,
|
|
23
|
+
providerResolved: "prompt",
|
|
24
|
+
ideDetected: ide.ideDetected,
|
|
25
|
+
agentAvailable: ide.agentAvailable,
|
|
26
|
+
reasonCodes,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (providerRequested === "agent") {
|
|
31
|
+
if (!ide.agentAvailable) {
|
|
32
|
+
reasonCodes.push("EXPLICIT_AGENT_REQUIRED");
|
|
33
|
+
return {
|
|
34
|
+
providerRequested,
|
|
35
|
+
providerResolved: "none",
|
|
36
|
+
ideDetected: ide.ideDetected,
|
|
37
|
+
agentAvailable: ide.agentAvailable,
|
|
38
|
+
reasonCodes,
|
|
39
|
+
error: "agent_unavailable",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
reasonCodes.push("IDE_AGENT_SELECTED");
|
|
43
|
+
return {
|
|
44
|
+
providerRequested,
|
|
45
|
+
providerResolved: "agent",
|
|
46
|
+
ideDetected: ide.ideDetected,
|
|
47
|
+
agentAvailable: ide.agentAvailable,
|
|
48
|
+
reasonCodes,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// auto
|
|
53
|
+
if (ide.agentAvailable) {
|
|
54
|
+
reasonCodes.push("IDE_AGENT_SELECTED");
|
|
55
|
+
return {
|
|
56
|
+
providerRequested: "auto",
|
|
57
|
+
providerResolved: "agent",
|
|
58
|
+
ideDetected: ide.ideDetected,
|
|
59
|
+
agentAvailable: ide.agentAvailable,
|
|
60
|
+
reasonCodes,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
reasonCodes.push("FALLBACK_PROMPT_MODE");
|
|
65
|
+
return {
|
|
66
|
+
providerRequested: "auto",
|
|
67
|
+
providerResolved: "prompt",
|
|
68
|
+
ideDetected: ide.ideDetected,
|
|
69
|
+
agentAvailable: ide.agentAvailable,
|
|
70
|
+
reasonCodes,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|