lovecode-ai 0.2.0 → 0.2.2

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/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-PX34PVT4.js";
38
+ } from "./chunk-DA5SRYF4.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-3AHNSXQX.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,
@@ -91,9 +93,7 @@ import {
91
93
  printProviders,
92
94
  setDefaultModel
93
95
  } from "./chunk-Y3HADLWO.js";
94
- import "./chunk-LKUWOZUZ.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", "codellama").option("-p, --provider <name>", "AI provider (ollama, openai-compatible)", "ollama").option("--base-url <url>", "Base URL for the AI provider", "http://localhost:11434").option("--no-stream", "Disable streaming responses").option("--resume", "Resume last session").action(async (options) => {
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
- const history = new ChatHistory();
1134
- const slash = new SlashHandler();
1135
- const provider = new OllamaProvider();
1136
- const prefs = getPreferences();
1133
+ let loadEnvFn = () => ({});
1134
+ let loadConfigFn = () => ({});
1135
+ try {
1136
+ ({ loadEnv: loadEnvFn } = await import("./env-HJQWWL6N.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-ADSIKXA4.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: options.model,
1139
- baseUrl: options.baseUrl,
1140
- temperature: prefs.indentSize ? 0.2 : 0.2,
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.createSession(`Chat - ${options.model}`);
1166
+ const history = new ChatHistory();
1167
+ const slash = new SlashHandler();
1168
+ history.createSession(`Chat - ${model}`);
1144
1169
  renderHeader();
1145
- console.log(chalk4.dim(` Model: ${options.model} \u2022 Provider: ${options.provider}`));
1170
+ console.log(chalk4.dim(` Model: ${model} \u2022 Provider: ${entry.name}`));
1146
1171
  console.log(chalk4.dim(` Session: ${history.getCurrent()?.id}
1147
1172
  `));
1148
- if (!provider.isAvailable) {
1149
- const available = await provider.isAvailable(options.baseUrl);
1150
- if (!available) {
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 - ${options.model}`);
1208
+ history.createSession(`Chat - ${model}`);
1192
1209
  }
1193
1210
  if (input === "/reset") {
1194
1211
  history.reset();
1195
- history.createSession(`Chat - ${options.model}`);
1212
+ history.createSession(`Chat - ${model}`);
1196
1213
  console.log(chalk4.green(" \u2713 Conversation reset\n"));
1197
1214
  }
1198
1215
  continue;
@@ -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-M2RNDQFX.js");
4999
+ const { startMcpServer } = await import("./server-XUIKJRQZ.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-PX34PVT4.js";
3
+ } from "./chunk-DA5SRYF4.js";
4
+ import "./chunk-LKUWOZUZ.js";
5
+ import "./chunk-MOZHR2QY.js";
4
6
  import "./chunk-OTEQ6CQ7.js";
5
7
  import "./chunk-4IPMBDCG.js";
6
8
  import "./chunk-7CT3XDH6.js";
7
9
  import "./chunk-Y3HADLWO.js";
8
- import "./chunk-LKUWOZUZ.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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lovecode-ai",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Terminal-native autonomous coding agent powered by free AI models",
5
5
  "keywords": [
6
6
  "ai",
@@ -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,
@@ -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";