lovecode-ai 0.1.4 → 0.1.5
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 +37 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -5118,6 +5118,7 @@ configCommand.action(cmdShow);
|
|
|
5118
5118
|
// src/commands/env.ts
|
|
5119
5119
|
import { Command as Command5 } from "commander";
|
|
5120
5120
|
import chalk24 from "chalk";
|
|
5121
|
+
import inquirer from "inquirer";
|
|
5121
5122
|
async function cmdEnvShow(options) {
|
|
5122
5123
|
console.log(formatEnvStatus(options.dir));
|
|
5123
5124
|
}
|
|
@@ -5134,15 +5135,50 @@ async function cmdEnvUnset(key, options) {
|
|
|
5134
5135
|
saveEnv(vars, options.dir);
|
|
5135
5136
|
console.log(chalk24.yellow(`Unset ${key.toUpperCase()}`));
|
|
5136
5137
|
}
|
|
5138
|
+
async function cmdEnvSelect(options) {
|
|
5139
|
+
const vars = loadEnv(options.dir);
|
|
5140
|
+
const choices = KNOWN_ENV_VARS.map((v) => {
|
|
5141
|
+
const current = vars[v.key] || process.env[v.key] || "";
|
|
5142
|
+
const status = current ? chalk24.green("\u2713 set") : chalk24.dim("\u25CB empty");
|
|
5143
|
+
const masked = current && v.key.includes("KEY") ? current.slice(0, 8) + "*".repeat(Math.min(current.length - 8, 12)) : current || "";
|
|
5144
|
+
return {
|
|
5145
|
+
name: `${v.key.padEnd(28)} ${status} ${chalk24.dim(v.description)}${masked ? chalk24.dim(` (${masked})`) : ""}`,
|
|
5146
|
+
value: v.key,
|
|
5147
|
+
short: v.key
|
|
5148
|
+
};
|
|
5149
|
+
});
|
|
5150
|
+
const { key } = await inquirer.prompt([{
|
|
5151
|
+
type: "list",
|
|
5152
|
+
name: "key",
|
|
5153
|
+
message: "Select an environment variable to set:",
|
|
5154
|
+
choices,
|
|
5155
|
+
pageSize: 15
|
|
5156
|
+
}]);
|
|
5157
|
+
const existing = vars[key] || "";
|
|
5158
|
+
const description = KNOWN_ENV_VARS.find((v) => v.key === key)?.description || "";
|
|
5159
|
+
const { value } = await inquirer.prompt([{
|
|
5160
|
+
type: "input",
|
|
5161
|
+
name: "value",
|
|
5162
|
+
message: `Enter value for ${chalk24.cyan(key)} (${description}):`,
|
|
5163
|
+
default: existing || void 0,
|
|
5164
|
+
validate: (input) => input.length > 0 || "Value cannot be empty"
|
|
5165
|
+
}]);
|
|
5166
|
+
vars[key] = value;
|
|
5167
|
+
saveEnv(vars, options.dir);
|
|
5168
|
+
console.log(chalk24.green(`
|
|
5169
|
+
\u2713 ${key} saved`));
|
|
5170
|
+
console.log(formatEnvStatus(options.dir));
|
|
5171
|
+
}
|
|
5137
5172
|
var envCommand = new Command5("env").alias("environment").description("Manage environment variables for API keys and settings").option("--dir <path>", "Project directory", process.cwd()).addHelpText("after", `
|
|
5138
5173
|
Examples:
|
|
5139
5174
|
lovecode env Show current environment
|
|
5175
|
+
lovecode env select Interactive variable selection
|
|
5140
5176
|
lovecode env set GROQ_API_KEY gsk_xxx
|
|
5141
|
-
lovecode env set OPENROUTER_API_KEY sk-or-xxx
|
|
5142
5177
|
lovecode env unset GROQ_API_KEY
|
|
5143
5178
|
`);
|
|
5144
5179
|
envCommand.command("set").description("Set an environment variable").argument("<key>", "Variable name").argument("<value>", "Variable value").option("--dir <path>", "Project directory").action(cmdEnvSet);
|
|
5145
5180
|
envCommand.command("unset").description("Remove an environment variable").argument("<key>", "Variable name").option("--dir <path>", "Project directory").action(cmdEnvUnset);
|
|
5181
|
+
envCommand.command("select").alias("pick").description("Interactively select and set an environment variable").option("--dir <path>", "Project directory").action(cmdEnvSelect);
|
|
5146
5182
|
envCommand.action(cmdEnvShow);
|
|
5147
5183
|
|
|
5148
5184
|
// src/commands/platform.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lovecode-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Terminal-native autonomous coding agent powered by free AI models",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/dotenv": "^6.1.1",
|
|
63
|
+
"@types/inquirer": "^9.0.9",
|
|
63
64
|
"@types/js-yaml": "^4.0.9",
|
|
64
65
|
"@types/marked": "^5.0.2",
|
|
65
66
|
"@types/node": "^20.11.0",
|