lovecode-ai 0.2.1 → 0.2.3
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/dist/{chunk-3AHNSXQX.js → chunk-DRN3XLN3.js} +5 -0
- package/dist/{chunk-Y3HADLWO.js → chunk-LTTRUG6S.js} +2 -2
- package/dist/{chunk-PX34PVT4.js → chunk-MPOKDBWT.js} +8 -8
- package/dist/{chunk-7CT3XDH6.js → chunk-WNHWSO4Y.js} +1 -1
- package/dist/{env-HJQWWL6N.js → env-7TE4MZGW.js} +1 -1
- package/dist/{git-FZPRJVFI.js → git-D4TGFVUK.js} +2 -2
- package/dist/index.js +65 -48
- package/dist/{registry-ADSIKXA4.js → registry-UKNF5I3W.js} +1 -1
- package/dist/{server-M2RNDQFX.js → server-VHL4FYCR.js} +5 -5
- package/package.json +1 -1
|
@@ -40,6 +40,11 @@ function loadEnv(rootDir) {
|
|
|
40
40
|
const envVal = process.env[v.key];
|
|
41
41
|
if (envVal) vars[v.key] = envVal;
|
|
42
42
|
}
|
|
43
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
44
|
+
if (value && !process.env[key]) {
|
|
45
|
+
process.env[key] = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
43
48
|
return vars;
|
|
44
49
|
}
|
|
45
50
|
function saveEnv(vars, rootDir) {
|
|
@@ -224,10 +224,10 @@ var registry = [
|
|
|
224
224
|
{
|
|
225
225
|
name: "groq",
|
|
226
226
|
provider: new OpenAILikeProvider("groq", "https://api.groq.com/openai/v1"),
|
|
227
|
-
models: ["
|
|
227
|
+
models: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant", "mixtral-8x7b-32768", "gemma2-9b-it", "deepseek-r1-distill-llama-70b", "meta-llama/llama-4-scout-17b-16e-instruct", "qwen/qwen3-32b"],
|
|
228
228
|
local: false,
|
|
229
229
|
priority: 30,
|
|
230
|
-
defaultModel: "
|
|
230
|
+
defaultModel: "llama-3.3-70b-versatile",
|
|
231
231
|
getConfig: (model) => ({
|
|
232
232
|
model,
|
|
233
233
|
baseUrl: "https://api.groq.com/openai/v1",
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
disablePlugin,
|
|
3
|
+
enablePlugin,
|
|
4
|
+
getAllPluginTools,
|
|
5
|
+
listPlugins,
|
|
6
|
+
loadBuiltinPlugins
|
|
7
|
+
} from "./chunk-MOZHR2QY.js";
|
|
1
8
|
import {
|
|
2
9
|
commit,
|
|
3
10
|
createBranch,
|
|
@@ -13,7 +20,7 @@ import {
|
|
|
13
20
|
isGitAvailable,
|
|
14
21
|
stageAll,
|
|
15
22
|
switchBranch
|
|
16
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WNHWSO4Y.js";
|
|
17
24
|
import {
|
|
18
25
|
click,
|
|
19
26
|
formatDOMElement,
|
|
@@ -24,13 +31,6 @@ import {
|
|
|
24
31
|
screenshot,
|
|
25
32
|
type
|
|
26
33
|
} from "./chunk-IVAMLKMS.js";
|
|
27
|
-
import {
|
|
28
|
-
disablePlugin,
|
|
29
|
-
enablePlugin,
|
|
30
|
-
getAllPluginTools,
|
|
31
|
-
listPlugins,
|
|
32
|
-
loadBuiltinPlugins
|
|
33
|
-
} from "./chunk-MOZHR2QY.js";
|
|
34
34
|
|
|
35
35
|
// src/core/tools.ts
|
|
36
36
|
import * as fs14 from "fs";
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
formatConfig,
|
|
3
|
-
getDefaults,
|
|
4
|
-
loadConfig,
|
|
5
|
-
saveConfig
|
|
6
|
-
} from "./chunk-LJ7HTOIK.js";
|
|
7
|
-
import {
|
|
8
|
-
KNOWN_ENV_VARS,
|
|
9
|
-
formatEnvStatus,
|
|
10
|
-
loadEnv,
|
|
11
|
-
saveEnv,
|
|
12
|
-
saveEnvExample
|
|
13
|
-
} from "./chunk-3AHNSXQX.js";
|
|
14
1
|
import {
|
|
15
2
|
getTheme,
|
|
16
3
|
getThemeNames,
|
|
@@ -48,7 +35,9 @@ import {
|
|
|
48
35
|
scanDirectory,
|
|
49
36
|
searchVectors,
|
|
50
37
|
storeVector
|
|
51
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-MPOKDBWT.js";
|
|
39
|
+
import "./chunk-LKUWOZUZ.js";
|
|
40
|
+
import "./chunk-MOZHR2QY.js";
|
|
52
41
|
import {
|
|
53
42
|
appendToSession,
|
|
54
43
|
createSession,
|
|
@@ -61,6 +50,19 @@ import {
|
|
|
61
50
|
listChatLogs,
|
|
62
51
|
writeChatLog
|
|
63
52
|
} from "./chunk-4IPMBDCG.js";
|
|
53
|
+
import {
|
|
54
|
+
KNOWN_ENV_VARS,
|
|
55
|
+
formatEnvStatus,
|
|
56
|
+
loadEnv,
|
|
57
|
+
saveEnv,
|
|
58
|
+
saveEnvExample
|
|
59
|
+
} from "./chunk-DRN3XLN3.js";
|
|
60
|
+
import {
|
|
61
|
+
formatConfig,
|
|
62
|
+
getDefaults,
|
|
63
|
+
loadConfig,
|
|
64
|
+
saveConfig
|
|
65
|
+
} from "./chunk-LJ7HTOIK.js";
|
|
64
66
|
import {
|
|
65
67
|
cleanupMergedBranches,
|
|
66
68
|
commit,
|
|
@@ -84,16 +86,14 @@ import {
|
|
|
84
86
|
stageAll,
|
|
85
87
|
suggestResolutions,
|
|
86
88
|
switchBranch
|
|
87
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-WNHWSO4Y.js";
|
|
88
90
|
import {
|
|
89
91
|
OllamaProvider,
|
|
90
92
|
getProvider,
|
|
91
93
|
printProviders,
|
|
92
94
|
setDefaultModel
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-LKUWOZUZ.js";
|
|
95
|
+
} from "./chunk-LTTRUG6S.js";
|
|
95
96
|
import "./chunk-IVAMLKMS.js";
|
|
96
|
-
import "./chunk-MOZHR2QY.js";
|
|
97
97
|
|
|
98
98
|
// src/index.ts
|
|
99
99
|
import { Command as Command18 } from "commander";
|
|
@@ -1128,34 +1128,51 @@ function renderUserMessage(content) {
|
|
|
1128
1128
|
console.log(chalk4.bold.green("\n \u2500\u2500 You \u2500\u2500"));
|
|
1129
1129
|
console.log(` ${content}`);
|
|
1130
1130
|
}
|
|
1131
|
-
var chatCommand = new Command("chat").alias("c").description("Start an interactive chat session with LoveCode AI").option("-m, --model <name>", "AI model to use"
|
|
1131
|
+
var chatCommand = new Command("chat").alias("c").description("Start an interactive chat session with LoveCode AI").option("-m, --model <name>", "AI model to use").option("-p, --provider <name>", "AI provider (ollama, groq, openrouter, together, huggingface)").option("--base-url <url>", "Base URL for the AI provider").option("--no-stream", "Disable streaming responses").option("--resume", "Resume last session").action(async (options) => {
|
|
1132
1132
|
ensureDirs();
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1133
|
+
let loadEnvFn = () => ({});
|
|
1134
|
+
let loadConfigFn = () => ({});
|
|
1135
|
+
try {
|
|
1136
|
+
({ loadEnv: loadEnvFn } = await import("./env-7TE4MZGW.js"));
|
|
1137
|
+
({ loadConfig: loadConfigFn } = await import("./config-FJNTTKR3.js"));
|
|
1138
|
+
loadEnvFn();
|
|
1139
|
+
} catch {
|
|
1140
|
+
}
|
|
1141
|
+
let cfgModel = options.model;
|
|
1142
|
+
let cfgProvider = options.provider;
|
|
1143
|
+
let cfgBaseUrl = options.baseUrl;
|
|
1144
|
+
if (!cfgModel || !cfgProvider) {
|
|
1145
|
+
try {
|
|
1146
|
+
const config = loadConfigFn();
|
|
1147
|
+
if (!cfgModel) cfgModel = config.model || "codellama";
|
|
1148
|
+
if (!cfgProvider) cfgProvider = config.provider || "ollama";
|
|
1149
|
+
} catch {
|
|
1150
|
+
if (!cfgModel) cfgModel = "codellama";
|
|
1151
|
+
if (!cfgProvider) cfgProvider = "ollama";
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
const { resolveModel } = await import("./registry-UKNF5I3W.js");
|
|
1155
|
+
const resolved = resolveModel(cfgProvider || cfgModel || "codellama");
|
|
1156
|
+
const entry = resolved.entry;
|
|
1157
|
+
const model = entry.models.includes(cfgModel || "") ? cfgModel || entry.defaultModel : entry.defaultModel;
|
|
1158
|
+
const cfg = entry.getConfig?.(model) || { model, baseUrl: cfgBaseUrl || "http://localhost:11434", temperature: 0.2, maxTokens: 4096 };
|
|
1159
|
+
const provider = entry.provider;
|
|
1137
1160
|
const providerConfig = {
|
|
1138
|
-
model
|
|
1139
|
-
baseUrl:
|
|
1140
|
-
temperature:
|
|
1141
|
-
maxTokens: 4096
|
|
1161
|
+
model,
|
|
1162
|
+
baseUrl: cfgBaseUrl || cfg.baseUrl,
|
|
1163
|
+
temperature: cfg.temperature ?? 0.2,
|
|
1164
|
+
maxTokens: cfg.maxTokens ?? 4096
|
|
1142
1165
|
};
|
|
1143
|
-
history
|
|
1166
|
+
const history = new ChatHistory();
|
|
1167
|
+
const slash = new SlashHandler();
|
|
1168
|
+
history.createSession(`Chat - ${model}`);
|
|
1144
1169
|
renderHeader();
|
|
1145
|
-
console.log(chalk4.dim(` Model: ${
|
|
1170
|
+
console.log(chalk4.dim(` Model: ${model} \u2022 Provider: ${entry.name}`));
|
|
1146
1171
|
console.log(chalk4.dim(` Session: ${history.getCurrent()?.id}
|
|
1147
1172
|
`));
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
console.log(chalk4.yellow(" \u26A0 Ollama not detected. Start it with: ollama serve"));
|
|
1152
|
-
console.log(chalk4.yellow(` Ensure model "${options.model}" is pulled: ollama pull ${options.model}
|
|
1153
|
-
`));
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
const session = createSession(`Chat - ${options.model}`, {
|
|
1157
|
-
model: options.model,
|
|
1158
|
-
provider: options.provider
|
|
1173
|
+
const session = createSession(`Chat - ${model}`, {
|
|
1174
|
+
model,
|
|
1175
|
+
provider: entry.name
|
|
1159
1176
|
});
|
|
1160
1177
|
let dirty = false;
|
|
1161
1178
|
const saveLog = () => {
|
|
@@ -1188,11 +1205,11 @@ var chatCommand = new Command("chat").alias("c").description("Start an interacti
|
|
|
1188
1205
|
}
|
|
1189
1206
|
if (input === "/clear") {
|
|
1190
1207
|
history.reset();
|
|
1191
|
-
history.createSession(`Chat - ${
|
|
1208
|
+
history.createSession(`Chat - ${model}`);
|
|
1192
1209
|
}
|
|
1193
1210
|
if (input === "/reset") {
|
|
1194
1211
|
history.reset();
|
|
1195
|
-
history.createSession(`Chat - ${
|
|
1212
|
+
history.createSession(`Chat - ${model}`);
|
|
1196
1213
|
console.log(chalk4.green(" \u2713 Conversation reset\n"));
|
|
1197
1214
|
}
|
|
1198
1215
|
continue;
|
|
@@ -2986,7 +3003,7 @@ async function cmdDiff(options) {
|
|
|
2986
3003
|
if (!requireGit(options.dir)) return;
|
|
2987
3004
|
const dir = options.dir || process.cwd();
|
|
2988
3005
|
const root = getGitRoot(dir);
|
|
2989
|
-
const diff = options.staged ? (await import("./git-
|
|
3006
|
+
const diff = options.staged ? (await import("./git-D4TGFVUK.js")).getStagedDiff(root || dir) : getDiff(root || dir);
|
|
2990
3007
|
if (!diff) {
|
|
2991
3008
|
console.log(chalk22.yellow(" No changes to show."));
|
|
2992
3009
|
return;
|
|
@@ -3570,9 +3587,9 @@ function App({
|
|
|
3570
3587
|
}
|
|
3571
3588
|
async function handleConnect() {
|
|
3572
3589
|
try {
|
|
3573
|
-
const { getAllProviders } = await import("./registry-
|
|
3590
|
+
const { getAllProviders } = await import("./registry-UKNF5I3W.js");
|
|
3574
3591
|
const { loadConfig: loadConfig2 } = await import("./config-FJNTTKR3.js");
|
|
3575
|
-
const { loadEnv: loadEnv2 } = await import("./env-
|
|
3592
|
+
const { loadEnv: loadEnv2 } = await import("./env-7TE4MZGW.js");
|
|
3576
3593
|
loadEnv2();
|
|
3577
3594
|
const providers = getAllProviders();
|
|
3578
3595
|
const config = loadConfig2();
|
|
@@ -3875,9 +3892,9 @@ When you need to access files, use the appropriate tool tag.
|
|
|
3875
3892
|
After getting results, continue helping the user.`;
|
|
3876
3893
|
async function loadAIProvider() {
|
|
3877
3894
|
try {
|
|
3878
|
-
const { loadEnv: loadEnv2 } = await import("./env-
|
|
3895
|
+
const { loadEnv: loadEnv2 } = await import("./env-7TE4MZGW.js");
|
|
3879
3896
|
const { loadConfig: loadConfig2 } = await import("./config-FJNTTKR3.js");
|
|
3880
|
-
const { resolveModel } = await import("./registry-
|
|
3897
|
+
const { resolveModel } = await import("./registry-UKNF5I3W.js");
|
|
3881
3898
|
loadEnv2();
|
|
3882
3899
|
const cfg = loadConfig2();
|
|
3883
3900
|
if (!cfg.provider) {
|
|
@@ -4979,7 +4996,7 @@ import { Command as Command17 } from "commander";
|
|
|
4979
4996
|
import chalk31 from "chalk";
|
|
4980
4997
|
async function cmdStartMcp() {
|
|
4981
4998
|
console.log(chalk31.dim("Starting LoveCode MCP server on stdio..."));
|
|
4982
|
-
const { startMcpServer } = await import("./server-
|
|
4999
|
+
const { startMcpServer } = await import("./server-VHL4FYCR.js");
|
|
4983
5000
|
await startMcpServer();
|
|
4984
5001
|
}
|
|
4985
5002
|
var mcpCommand = new Command17("mcp").description("Model Context Protocol server \u2014 expose LoveCode tools to MCP clients").addHelpText("after", `
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allTools
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MPOKDBWT.js";
|
|
4
|
+
import "./chunk-LKUWOZUZ.js";
|
|
5
|
+
import "./chunk-MOZHR2QY.js";
|
|
4
6
|
import "./chunk-OTEQ6CQ7.js";
|
|
5
7
|
import "./chunk-4IPMBDCG.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-LKUWOZUZ.js";
|
|
8
|
+
import "./chunk-WNHWSO4Y.js";
|
|
9
|
+
import "./chunk-LTTRUG6S.js";
|
|
9
10
|
import "./chunk-IVAMLKMS.js";
|
|
10
|
-
import "./chunk-MOZHR2QY.js";
|
|
11
11
|
|
|
12
12
|
// src/mcp/server.ts
|
|
13
13
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|