mpd-llm-cli 0.1.12 → 0.1.14
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/bundle/api.cjs +3 -1
- package/bundle/api.js +5 -3
- package/bundle/gemini.js +132 -65
- package/package.json +2 -2
package/bundle/api.cjs
CHANGED
|
@@ -140148,7 +140148,9 @@ Make sure it is available in the sandbox`;
|
|
|
140148
140148
|
return;
|
|
140149
140149
|
}
|
|
140150
140150
|
mcpClient.onerror = (error) => {
|
|
140151
|
-
|
|
140151
|
+
if (process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true") {
|
|
140152
|
+
console.error(`MCP ERROR (${mcpServerName}):`, error.toString());
|
|
140153
|
+
}
|
|
140152
140154
|
updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED);
|
|
140153
140155
|
};
|
|
140154
140156
|
if (transport instanceof StdioClientTransport && transport.stderr) {
|
package/bundle/api.js
CHANGED
|
@@ -27717,7 +27717,7 @@ async function createContentGeneratorConfig(model, authType) {
|
|
|
27717
27717
|
return contentGeneratorConfig;
|
|
27718
27718
|
}
|
|
27719
27719
|
async function createContentGenerator(config2, sessionId2) {
|
|
27720
|
-
const version2 = "0.1.
|
|
27720
|
+
const version2 = "0.1.14";
|
|
27721
27721
|
const httpOptions = {
|
|
27722
27722
|
headers: {
|
|
27723
27723
|
"User-Agent": `GeminiCLI/${version2} (${process.platform}; ${process.arch})`
|
|
@@ -140144,7 +140144,9 @@ Make sure it is available in the sandbox`;
|
|
|
140144
140144
|
return;
|
|
140145
140145
|
}
|
|
140146
140146
|
mcpClient.onerror = (error) => {
|
|
140147
|
-
|
|
140147
|
+
if (process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true") {
|
|
140148
|
+
console.error(`MCP ERROR (${mcpServerName}):`, error.toString());
|
|
140149
|
+
}
|
|
140148
140150
|
updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED);
|
|
140149
140151
|
};
|
|
140150
140152
|
if (transport instanceof StdioClientTransport && transport.stderr) {
|
|
@@ -165362,7 +165364,7 @@ async function getPackageJson() {
|
|
|
165362
165364
|
// packages/cli/src/utils/version.ts
|
|
165363
165365
|
async function getCliVersion() {
|
|
165364
165366
|
const pkgJson = await getPackageJson();
|
|
165365
|
-
return "0.1.
|
|
165367
|
+
return "0.1.14";
|
|
165366
165368
|
}
|
|
165367
165369
|
|
|
165368
165370
|
// packages/cli/src/config/sandboxConfig.ts
|
package/bundle/gemini.js
CHANGED
|
@@ -78252,7 +78252,7 @@ async function createContentGeneratorConfig(model, authType) {
|
|
|
78252
78252
|
return contentGeneratorConfig;
|
|
78253
78253
|
}
|
|
78254
78254
|
async function createContentGenerator(config2, sessionId2) {
|
|
78255
|
-
const version3 = "0.1.
|
|
78255
|
+
const version3 = "0.1.14";
|
|
78256
78256
|
const httpOptions = {
|
|
78257
78257
|
headers: {
|
|
78258
78258
|
"User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
|
|
@@ -149312,7 +149312,7 @@ var require_homedir = __commonJS({
|
|
|
149312
149312
|
"node_modules/resolve/lib/homedir.js"(exports2, module2) {
|
|
149313
149313
|
"use strict";
|
|
149314
149314
|
var os23 = __require("os");
|
|
149315
|
-
module2.exports = os23.homedir || function
|
|
149315
|
+
module2.exports = os23.homedir || function homedir15() {
|
|
149316
149316
|
var home = process.env.HOME;
|
|
149317
149317
|
var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
|
149318
149318
|
if (process.platform === "win32") {
|
|
@@ -149793,11 +149793,11 @@ var require_async2 = __commonJS({
|
|
|
149793
149793
|
var normalizeOptions = require_normalize_options();
|
|
149794
149794
|
var isCore = require_is_core_module();
|
|
149795
149795
|
var realpathFS = process.platform !== "win32" && fs51.realpath && typeof fs51.realpath.native === "function" ? fs51.realpath.native : fs51.realpath;
|
|
149796
|
-
var
|
|
149796
|
+
var homedir15 = getHomedir();
|
|
149797
149797
|
var defaultPaths = function() {
|
|
149798
149798
|
return [
|
|
149799
|
-
path53.join(
|
|
149800
|
-
path53.join(
|
|
149799
|
+
path53.join(homedir15, ".node_modules"),
|
|
149800
|
+
path53.join(homedir15, ".node_libraries")
|
|
149801
149801
|
];
|
|
149802
149802
|
};
|
|
149803
149803
|
var defaultIsFile = function isFile(file, cb) {
|
|
@@ -150283,11 +150283,11 @@ var require_sync = __commonJS({
|
|
|
150283
150283
|
var nodeModulesPaths = require_node_modules_paths();
|
|
150284
150284
|
var normalizeOptions = require_normalize_options();
|
|
150285
150285
|
var realpathFS = process.platform !== "win32" && fs51.realpathSync && typeof fs51.realpathSync.native === "function" ? fs51.realpathSync.native : fs51.realpathSync;
|
|
150286
|
-
var
|
|
150286
|
+
var homedir15 = getHomedir();
|
|
150287
150287
|
var defaultPaths = function() {
|
|
150288
150288
|
return [
|
|
150289
|
-
path53.join(
|
|
150290
|
-
path53.join(
|
|
150289
|
+
path53.join(homedir15, ".node_modules"),
|
|
150290
|
+
path53.join(homedir15, ".node_libraries")
|
|
150291
150291
|
];
|
|
150292
150292
|
};
|
|
150293
150293
|
var defaultIsFile = function isFile(file) {
|
|
@@ -190619,7 +190619,7 @@ var require_require_directory = __commonJS({
|
|
|
190619
190619
|
"node_modules/require-directory/index.js"(exports2, module2) {
|
|
190620
190620
|
"use strict";
|
|
190621
190621
|
var fs51 = __require("fs");
|
|
190622
|
-
var
|
|
190622
|
+
var join23 = __require("path").join;
|
|
190623
190623
|
var resolve18 = __require("path").resolve;
|
|
190624
190624
|
var dirname11 = __require("path").dirname;
|
|
190625
190625
|
var defaultOptions2 = {
|
|
@@ -190656,7 +190656,7 @@ var require_require_directory = __commonJS({
|
|
|
190656
190656
|
}
|
|
190657
190657
|
path53 = !path53 ? dirname11(m.filename) : resolve18(dirname11(m.filename), path53);
|
|
190658
190658
|
fs51.readdirSync(path53).forEach(function(filename) {
|
|
190659
|
-
var joined =
|
|
190659
|
+
var joined = join23(path53, filename), files, key, obj;
|
|
190660
190660
|
if (fs51.statSync(joined).isDirectory() && options.recurse) {
|
|
190661
190661
|
files = requireDirectory(m, joined, options);
|
|
190662
190662
|
if (Object.keys(files).length) {
|
|
@@ -194426,7 +194426,7 @@ var require_minimist = __commonJS({
|
|
|
194426
194426
|
var require_rc = __commonJS({
|
|
194427
194427
|
"node_modules/rc/index.js"(exports2, module2) {
|
|
194428
194428
|
var cc = require_utils13();
|
|
194429
|
-
var
|
|
194429
|
+
var join23 = __require("path").join;
|
|
194430
194430
|
var deepExtend = require_deep_extend();
|
|
194431
194431
|
var etc = "/etc";
|
|
194432
194432
|
var win = process.platform === "win32";
|
|
@@ -194451,15 +194451,15 @@ var require_rc = __commonJS({
|
|
|
194451
194451
|
}
|
|
194452
194452
|
if (!win)
|
|
194453
194453
|
[
|
|
194454
|
-
|
|
194455
|
-
|
|
194454
|
+
join23(etc, name2, "config"),
|
|
194455
|
+
join23(etc, name2 + "rc")
|
|
194456
194456
|
].forEach(addConfigFile);
|
|
194457
194457
|
if (home)
|
|
194458
194458
|
[
|
|
194459
|
-
|
|
194460
|
-
|
|
194461
|
-
|
|
194462
|
-
|
|
194459
|
+
join23(home, ".config", name2, "config"),
|
|
194460
|
+
join23(home, ".config", name2),
|
|
194461
|
+
join23(home, "." + name2, "config"),
|
|
194462
|
+
join23(home, "." + name2 + "rc")
|
|
194463
194463
|
].forEach(addConfigFile);
|
|
194464
194464
|
addConfigFile(cc.find("." + name2 + "rc"));
|
|
194465
194465
|
if (env6.config) addConfigFile(env6.config);
|
|
@@ -213721,7 +213721,9 @@ Make sure it is available in the sandbox`;
|
|
|
213721
213721
|
return;
|
|
213722
213722
|
}
|
|
213723
213723
|
mcpClient.onerror = (error) => {
|
|
213724
|
-
|
|
213724
|
+
if (process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true") {
|
|
213725
|
+
console.error(`MCP ERROR (${mcpServerName}):`, error.toString());
|
|
213726
|
+
}
|
|
213725
213727
|
updateMCPServerStatus(mcpServerName, MCPServerStatus.DISCONNECTED);
|
|
213726
213728
|
};
|
|
213727
213729
|
if (transport instanceof StdioClientTransport && transport.stderr) {
|
|
@@ -225279,8 +225281,8 @@ function many(p) {
|
|
|
225279
225281
|
function many1(p) {
|
|
225280
225282
|
return ab(p, many(p), (head, tail) => [head, ...tail]);
|
|
225281
225283
|
}
|
|
225282
|
-
function ab(pa, pb,
|
|
225283
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) =>
|
|
225284
|
+
function ab(pa, pb, join23) {
|
|
225285
|
+
return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join23(ma.value, vb, data, i, j)));
|
|
225284
225286
|
}
|
|
225285
225287
|
function left(pa, pb) {
|
|
225286
225288
|
return ab(pa, pb, (va) => va);
|
|
@@ -225288,8 +225290,8 @@ function left(pa, pb) {
|
|
|
225288
225290
|
function right(pa, pb) {
|
|
225289
225291
|
return ab(pa, pb, (va, vb) => vb);
|
|
225290
225292
|
}
|
|
225291
|
-
function abc(pa, pb, pc,
|
|
225292
|
-
return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) =>
|
|
225293
|
+
function abc(pa, pb, pc, join23) {
|
|
225294
|
+
return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join23(ma.value, mb.value, vc, data, i, j))));
|
|
225293
225295
|
}
|
|
225294
225296
|
function middle(pa, pb, pc) {
|
|
225295
225297
|
return abc(pa, pb, pc, (ra, rb) => rb);
|
|
@@ -243942,7 +243944,7 @@ var LangfuseClient = class {
|
|
|
243942
243944
|
name: "MPD LLM CLI Session",
|
|
243943
243945
|
metadata: {
|
|
243944
243946
|
...safeMetadata,
|
|
243945
|
-
cli_version: this.safeString("0.1.
|
|
243947
|
+
cli_version: this.safeString("0.1.14", "unknown"),
|
|
243946
243948
|
model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
|
|
243947
243949
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
243948
243950
|
environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
|
|
@@ -244973,7 +244975,7 @@ var LangfuseIntegration = class {
|
|
|
244973
244975
|
const metadata = {
|
|
244974
244976
|
model: this.config.getModel(),
|
|
244975
244977
|
auth_type: this.config.getContentGeneratorConfig()?.authType,
|
|
244976
|
-
cli_version: "0.1.
|
|
244978
|
+
cli_version: "0.1.14",
|
|
244977
244979
|
start_time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
244978
244980
|
session_id: this.sessionId
|
|
244979
244981
|
};
|
|
@@ -245043,7 +245045,7 @@ var LangfuseIntegration = class {
|
|
|
245043
245045
|
error,
|
|
245044
245046
|
metadata: {
|
|
245045
245047
|
session_id: this.sessionId,
|
|
245046
|
-
cli_version: "0.1.
|
|
245048
|
+
cli_version: "0.1.14",
|
|
245047
245049
|
auth_type: this.config.getContentGeneratorConfig()?.authType
|
|
245048
245050
|
}
|
|
245049
245051
|
});
|
|
@@ -248769,7 +248771,7 @@ import { promises as fs33 } from "fs";
|
|
|
248769
248771
|
import path37 from "path";
|
|
248770
248772
|
|
|
248771
248773
|
// packages/cli/src/generated/git-commit.ts
|
|
248772
|
-
var GIT_COMMIT_INFO = "
|
|
248774
|
+
var GIT_COMMIT_INFO = "611a052";
|
|
248773
248775
|
|
|
248774
248776
|
// node_modules/read-package-up/index.js
|
|
248775
248777
|
import path35 from "node:path";
|
|
@@ -248982,7 +248984,7 @@ async function getPackageJson() {
|
|
|
248982
248984
|
// packages/cli/src/utils/version.ts
|
|
248983
248985
|
async function getCliVersion() {
|
|
248984
248986
|
const pkgJson = await getPackageJson();
|
|
248985
|
-
return "0.1.
|
|
248987
|
+
return "0.1.14";
|
|
248986
248988
|
}
|
|
248987
248989
|
|
|
248988
248990
|
// packages/cli/src/ui/commands/memoryCommand.ts
|
|
@@ -249099,11 +249101,76 @@ var clearCommand = {
|
|
|
249099
249101
|
}
|
|
249100
249102
|
};
|
|
249101
249103
|
|
|
249104
|
+
// packages/cli/src/ui/commands/logoutCommand.ts
|
|
249105
|
+
import { existsSync as existsSync7, unlinkSync } from "fs";
|
|
249106
|
+
import { join as join12 } from "path";
|
|
249107
|
+
import { homedir as homedir7 } from "os";
|
|
249108
|
+
var logoutCommand = {
|
|
249109
|
+
name: "logout",
|
|
249110
|
+
description: "logout and clear user credentials and settings, then exit",
|
|
249111
|
+
action: async (context2, _args) => {
|
|
249112
|
+
const now = /* @__PURE__ */ new Date();
|
|
249113
|
+
const { sessionStartTime } = context2.session.stats;
|
|
249114
|
+
const wallDuration = now.getTime() - sessionStartTime.getTime();
|
|
249115
|
+
const userJsonPath = join12(homedir7(), ".gemini", "user.json");
|
|
249116
|
+
if (existsSync7(userJsonPath)) {
|
|
249117
|
+
try {
|
|
249118
|
+
unlinkSync(userJsonPath);
|
|
249119
|
+
context2.ui.addItem({
|
|
249120
|
+
type: "info" /* INFO */,
|
|
249121
|
+
text: "\u2705 User credentials cleared"
|
|
249122
|
+
}, now.getTime());
|
|
249123
|
+
} catch (error) {
|
|
249124
|
+
context2.ui.addItem({
|
|
249125
|
+
type: "error" /* ERROR */,
|
|
249126
|
+
text: `\u274C Failed to clear user credentials: ${error}`
|
|
249127
|
+
}, now.getTime());
|
|
249128
|
+
}
|
|
249129
|
+
}
|
|
249130
|
+
const userSettingsPath = join12(homedir7(), ".gemini", "settings.json");
|
|
249131
|
+
if (existsSync7(userSettingsPath)) {
|
|
249132
|
+
try {
|
|
249133
|
+
unlinkSync(userSettingsPath);
|
|
249134
|
+
context2.ui.addItem({
|
|
249135
|
+
type: "info" /* INFO */,
|
|
249136
|
+
text: "\u2705 User settings cleared"
|
|
249137
|
+
}, now.getTime());
|
|
249138
|
+
} catch (error) {
|
|
249139
|
+
context2.ui.addItem({
|
|
249140
|
+
type: "error" /* ERROR */,
|
|
249141
|
+
text: `\u274C Failed to clear user settings: ${error}`
|
|
249142
|
+
}, now.getTime());
|
|
249143
|
+
}
|
|
249144
|
+
}
|
|
249145
|
+
setTimeout(() => {
|
|
249146
|
+
process.exit(0);
|
|
249147
|
+
}, 100);
|
|
249148
|
+
return {
|
|
249149
|
+
type: "message",
|
|
249150
|
+
messageType: "info",
|
|
249151
|
+
content: `\u{1F44B} Logging out... Session duration: ${formatDuration2(wallDuration)}`
|
|
249152
|
+
};
|
|
249153
|
+
}
|
|
249154
|
+
};
|
|
249155
|
+
function formatDuration2(milliseconds) {
|
|
249156
|
+
const seconds = Math.floor(milliseconds / 1e3);
|
|
249157
|
+
const minutes = Math.floor(seconds / 60);
|
|
249158
|
+
const hours = Math.floor(minutes / 60);
|
|
249159
|
+
if (hours > 0) {
|
|
249160
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
249161
|
+
} else if (minutes > 0) {
|
|
249162
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
249163
|
+
} else {
|
|
249164
|
+
return `${seconds}s`;
|
|
249165
|
+
}
|
|
249166
|
+
}
|
|
249167
|
+
|
|
249102
249168
|
// packages/cli/src/services/CommandService.ts
|
|
249103
249169
|
var loadBuiltInCommands = async () => [
|
|
249104
249170
|
clearCommand,
|
|
249105
249171
|
helpCommand,
|
|
249106
|
-
memoryCommand
|
|
249172
|
+
memoryCommand,
|
|
249173
|
+
logoutCommand
|
|
249107
249174
|
];
|
|
249108
249175
|
var CommandService = class {
|
|
249109
249176
|
constructor(commandLoader = loadBuiltInCommands) {
|
|
@@ -266208,10 +266275,10 @@ var getLanguageFromExtension = (extension) => {
|
|
|
266208
266275
|
var dotenv = __toESM(require_main(), 1);
|
|
266209
266276
|
import * as fs36 from "fs";
|
|
266210
266277
|
import * as path40 from "path";
|
|
266211
|
-
import { homedir as
|
|
266278
|
+
import { homedir as homedir8 } from "os";
|
|
266212
266279
|
var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
|
|
266213
266280
|
var SETTINGS_DIRECTORY_NAME = ".gemini";
|
|
266214
|
-
var USER_SETTINGS_DIR = path40.join(
|
|
266281
|
+
var USER_SETTINGS_DIR = path40.join(homedir8(), SETTINGS_DIRECTORY_NAME);
|
|
266215
266282
|
var USER_SETTINGS_PATH = path40.join(USER_SETTINGS_DIR, "settings.json");
|
|
266216
266283
|
var LoadedSettings = class {
|
|
266217
266284
|
constructor(user, workspace, errors) {
|
|
@@ -266294,11 +266361,11 @@ function findEnvFile(startDir) {
|
|
|
266294
266361
|
}
|
|
266295
266362
|
const parentDir = path40.dirname(currentDir);
|
|
266296
266363
|
if (parentDir === currentDir || !parentDir) {
|
|
266297
|
-
const homeGeminiEnvPath = path40.join(
|
|
266364
|
+
const homeGeminiEnvPath = path40.join(homedir8(), GEMINI_CONFIG_DIR, ".env");
|
|
266298
266365
|
if (fs36.existsSync(homeGeminiEnvPath)) {
|
|
266299
266366
|
return homeGeminiEnvPath;
|
|
266300
266367
|
}
|
|
266301
|
-
const homeEnvPath = path40.join(
|
|
266368
|
+
const homeEnvPath = path40.join(homedir8(), ".env");
|
|
266302
266369
|
if (fs36.existsSync(homeEnvPath)) {
|
|
266303
266370
|
return homeEnvPath;
|
|
266304
266371
|
}
|
|
@@ -269825,7 +269892,7 @@ var import_react62 = __toESM(require_react(), 1);
|
|
|
269825
269892
|
// packages/cli/src/telemetry/dataCollector.ts
|
|
269826
269893
|
import { execSync as execSync2 } from "child_process";
|
|
269827
269894
|
import { promises as fs38 } from "fs";
|
|
269828
|
-
import { join as
|
|
269895
|
+
import { join as join17 } from "path";
|
|
269829
269896
|
var DataCollector = class {
|
|
269830
269897
|
langfuseClient;
|
|
269831
269898
|
constructor() {
|
|
@@ -269935,7 +270002,7 @@ var DataCollector = class {
|
|
|
269935
270002
|
// 提取元数据
|
|
269936
270003
|
extractMetadata(data) {
|
|
269937
270004
|
return {
|
|
269938
|
-
cli_version: "0.1.
|
|
270005
|
+
cli_version: "0.1.14",
|
|
269939
270006
|
model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
|
|
269940
270007
|
auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
|
|
269941
270008
|
project_path: data.projectPath,
|
|
@@ -270152,7 +270219,7 @@ var DataCollector = class {
|
|
|
270152
270219
|
const walkDir = async (dir) => {
|
|
270153
270220
|
const entries = await fs38.readdir(dir, { withFileTypes: true });
|
|
270154
270221
|
for (const entry of entries) {
|
|
270155
|
-
const fullPath =
|
|
270222
|
+
const fullPath = join17(dir, entry.name);
|
|
270156
270223
|
if (entry.isDirectory()) {
|
|
270157
270224
|
dirCount++;
|
|
270158
270225
|
await walkDir(fullPath);
|
|
@@ -277109,10 +277176,10 @@ async function runNonInteractive(config2, input) {
|
|
|
277109
277176
|
|
|
277110
277177
|
// packages/cli/src/utils/cleanup.ts
|
|
277111
277178
|
import { promises as fs49 } from "fs";
|
|
277112
|
-
import { join as
|
|
277179
|
+
import { join as join18 } from "path";
|
|
277113
277180
|
async function cleanupCheckpoints() {
|
|
277114
277181
|
const tempDir = getProjectTempDir(process.cwd());
|
|
277115
|
-
const checkpointsDir =
|
|
277182
|
+
const checkpointsDir = join18(tempDir, "checkpoints");
|
|
277116
277183
|
try {
|
|
277117
277184
|
await fs49.rm(checkpointsDir, { recursive: true, force: true });
|
|
277118
277185
|
} catch {
|
|
@@ -277120,14 +277187,14 @@ async function cleanupCheckpoints() {
|
|
|
277120
277187
|
}
|
|
277121
277188
|
|
|
277122
277189
|
// packages/cli/src/services/AuthService.ts
|
|
277123
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync5, existsSync as
|
|
277124
|
-
import { join as
|
|
277125
|
-
import { homedir as
|
|
277190
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync5, existsSync as existsSync12, mkdirSync as mkdirSync4 } from "fs";
|
|
277191
|
+
import { join as join20 } from "path";
|
|
277192
|
+
import { homedir as homedir12 } from "os";
|
|
277126
277193
|
|
|
277127
277194
|
// packages/cli/src/config/mpdaiConfig.ts
|
|
277128
|
-
import { readFileSync as readFileSync12, existsSync as
|
|
277129
|
-
import { join as
|
|
277130
|
-
import { homedir as
|
|
277195
|
+
import { readFileSync as readFileSync12, existsSync as existsSync11 } from "fs";
|
|
277196
|
+
import { join as join19 } from "path";
|
|
277197
|
+
import { homedir as homedir11 } from "os";
|
|
277131
277198
|
var MpdaiConfigManager = class _MpdaiConfigManager {
|
|
277132
277199
|
static instance;
|
|
277133
277200
|
config = null;
|
|
@@ -277144,14 +277211,14 @@ var MpdaiConfigManager = class _MpdaiConfigManager {
|
|
|
277144
277211
|
return this.config;
|
|
277145
277212
|
}
|
|
277146
277213
|
try {
|
|
277147
|
-
const userConfigPath =
|
|
277148
|
-
if (
|
|
277214
|
+
const userConfigPath = join19(homedir11(), ".gemini", "config.json");
|
|
277215
|
+
if (existsSync11(userConfigPath)) {
|
|
277149
277216
|
const configContent = readFileSync12(userConfigPath, "utf-8");
|
|
277150
277217
|
this.config = JSON.parse(configContent);
|
|
277151
277218
|
return this.config;
|
|
277152
277219
|
}
|
|
277153
|
-
const projectConfigPath =
|
|
277154
|
-
if (
|
|
277220
|
+
const projectConfigPath = join19(process.cwd(), ".mpdai", "config.json");
|
|
277221
|
+
if (existsSync11(projectConfigPath)) {
|
|
277155
277222
|
const configContent = readFileSync12(projectConfigPath, "utf-8");
|
|
277156
277223
|
this.config = JSON.parse(configContent);
|
|
277157
277224
|
return this.config;
|
|
@@ -277207,13 +277274,13 @@ var AuthService = class {
|
|
|
277207
277274
|
constructor(authApiUrl) {
|
|
277208
277275
|
this.mpdaiConfig = MpdaiConfigManager.getInstance();
|
|
277209
277276
|
this.authApiUrl = authApiUrl || this.mpdaiConfig.getAuthUrl();
|
|
277210
|
-
this.userJsonPath =
|
|
277277
|
+
this.userJsonPath = join20(homedir12(), ".gemini", "user.json");
|
|
277211
277278
|
}
|
|
277212
277279
|
/**
|
|
277213
277280
|
* 检查本地是否存在用户凭据文件
|
|
277214
277281
|
*/
|
|
277215
277282
|
hasLocalCredentials() {
|
|
277216
|
-
return
|
|
277283
|
+
return existsSync12(this.userJsonPath);
|
|
277217
277284
|
}
|
|
277218
277285
|
/**
|
|
277219
277286
|
* 从本地文件读取用户凭据
|
|
@@ -277235,8 +277302,8 @@ var AuthService = class {
|
|
|
277235
277302
|
*/
|
|
277236
277303
|
saveCredentials(credentials) {
|
|
277237
277304
|
try {
|
|
277238
|
-
const dir =
|
|
277239
|
-
if (!
|
|
277305
|
+
const dir = join20(homedir12(), ".gemini");
|
|
277306
|
+
if (!existsSync12(dir)) {
|
|
277240
277307
|
mkdirSync4(dir, { recursive: true });
|
|
277241
277308
|
}
|
|
277242
277309
|
writeFileSync5(this.userJsonPath, JSON.stringify(credentials, null, 2), "utf-8");
|
|
@@ -277376,9 +277443,9 @@ var AuthService = class {
|
|
|
277376
277443
|
};
|
|
277377
277444
|
|
|
277378
277445
|
// packages/cli/src/services/EnvConfigManager.ts
|
|
277379
|
-
import { readFileSync as readFileSync14, writeFileSync as writeFileSync6, existsSync as
|
|
277380
|
-
import { join as
|
|
277381
|
-
import { homedir as
|
|
277446
|
+
import { readFileSync as readFileSync14, writeFileSync as writeFileSync6, existsSync as existsSync13, mkdirSync as mkdirSync5 } from "fs";
|
|
277447
|
+
import { join as join21, dirname as dirname10 } from "path";
|
|
277448
|
+
import { homedir as homedir13 } from "os";
|
|
277382
277449
|
var EnvConfigManager = class {
|
|
277383
277450
|
envPaths;
|
|
277384
277451
|
constructor() {
|
|
@@ -277396,17 +277463,17 @@ var EnvConfigManager = class {
|
|
|
277396
277463
|
let currentDir = startDir;
|
|
277397
277464
|
while (true) {
|
|
277398
277465
|
for (const envPath of this.envPaths) {
|
|
277399
|
-
const fullPath =
|
|
277400
|
-
if (
|
|
277466
|
+
const fullPath = join21(currentDir, envPath);
|
|
277467
|
+
if (existsSync13(fullPath)) {
|
|
277401
277468
|
return fullPath;
|
|
277402
277469
|
}
|
|
277403
277470
|
}
|
|
277404
|
-
const parentDir =
|
|
277471
|
+
const parentDir = join21(currentDir, "..");
|
|
277405
277472
|
if (parentDir === currentDir) {
|
|
277406
|
-
const homeDir2 =
|
|
277473
|
+
const homeDir2 = homedir13();
|
|
277407
277474
|
for (const envPath of this.envPaths) {
|
|
277408
|
-
const fullPath =
|
|
277409
|
-
if (
|
|
277475
|
+
const fullPath = join21(homeDir2, envPath);
|
|
277476
|
+
if (existsSync13(fullPath)) {
|
|
277410
277477
|
return fullPath;
|
|
277411
277478
|
}
|
|
277412
277479
|
}
|
|
@@ -277465,7 +277532,7 @@ var EnvConfigManager = class {
|
|
|
277465
277532
|
writeEnvFile(envConfig, envPath) {
|
|
277466
277533
|
try {
|
|
277467
277534
|
const dir = dirname10(envPath);
|
|
277468
|
-
if (!
|
|
277535
|
+
if (!existsSync13(dir)) {
|
|
277469
277536
|
mkdirSync5(dir, { recursive: true });
|
|
277470
277537
|
}
|
|
277471
277538
|
const envContent = Object.entries(envConfig).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";
|
|
@@ -277480,8 +277547,8 @@ var EnvConfigManager = class {
|
|
|
277480
277547
|
* 更新或创建.env文件
|
|
277481
277548
|
*/
|
|
277482
277549
|
updateEnvFile(model, targetPath) {
|
|
277483
|
-
const envPath = targetPath || this.findEnvFile(process.cwd()) ||
|
|
277484
|
-
const existingConfig =
|
|
277550
|
+
const envPath = targetPath || this.findEnvFile(process.cwd()) || join21(process.cwd(), ".gemini", ".env");
|
|
277551
|
+
const existingConfig = existsSync13(envPath) ? this.readEnvFile(envPath) : {};
|
|
277485
277552
|
const newConfig = this.generateEnvConfig(model, existingConfig);
|
|
277486
277553
|
this.writeEnvFile(newConfig, envPath);
|
|
277487
277554
|
return envPath;
|
|
@@ -277504,9 +277571,9 @@ var EnvConfigManager = class {
|
|
|
277504
277571
|
// packages/cli/src/config/startup.ts
|
|
277505
277572
|
import * as fs50 from "fs";
|
|
277506
277573
|
import * as path52 from "path";
|
|
277507
|
-
import { homedir as
|
|
277574
|
+
import { homedir as homedir14 } from "os";
|
|
277508
277575
|
function initializeLangfuseConfig() {
|
|
277509
|
-
const langfuseDir = path52.join(
|
|
277576
|
+
const langfuseDir = path52.join(homedir14(), ".gemini");
|
|
277510
277577
|
const settingsFile = path52.join(langfuseDir, "settings.conf");
|
|
277511
277578
|
try {
|
|
277512
277579
|
if (!fs50.existsSync(langfuseDir)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpd-llm-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20.0.0"
|
|
6
6
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "git+https://
|
|
13
|
+
"url": "git+https://git.rakuten-it.com/scm/mpd-ai/mpd-llm-cli.git"
|
|
14
14
|
},
|
|
15
15
|
"config": {
|
|
16
16
|
"sandboxImageUri": "xx:0.1.0"
|