lewxclaw 0.1.2 → 0.1.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/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2528,7 +2528,7 @@ async function createRealLLMClient() {
|
|
|
2528
2528
|
if (minimax.isConfigured()) registry.register(minimax);
|
|
2529
2529
|
if (deepseek.isConfigured()) registry.register(deepseek);
|
|
2530
2530
|
if (registry.list().length === 0) {
|
|
2531
|
-
console.error(chalk.red("\u6CA1\u6709\u53EF\u7528\u7684 LLM Provider\u3002\u8BF7\u5728 .
|
|
2531
|
+
console.error(chalk.red("\u6CA1\u6709\u53EF\u7528\u7684 LLM Provider\u3002\u8BF7\u5728 .lewxclaw/config.json \u4E2D\u914D\u7F6E API Key\u3002"));
|
|
2532
2532
|
console.error(chalk.gray(' \u6216\u4F7F\u7528 --mock \u6A21\u5F0F\uFF1Alewxclaw create --mock --topic "\u4E3B\u9898"'));
|
|
2533
2533
|
process.exit(1);
|
|
2534
2534
|
}
|
|
@@ -2573,7 +2573,7 @@ function withSpinner(step, label, successLabel) {
|
|
|
2573
2573
|
};
|
|
2574
2574
|
}
|
|
2575
2575
|
var createCommand = new Command("create").description("\u521B\u5EFA\u516C\u4F17\u53F7\u6587\u7AE0").requiredOption("--topic <topic>", "\u6587\u7AE0\u4E3B\u9898").option("--style <style>", "\u5199\u4F5C\u98CE\u683C", "tech").option("--mock", "\u4F7F\u7528 Mock LLM\uFF08\u4E0D\u9700\u8981 API Key\uFF09").action(async (options) => {
|
|
2576
|
-
console.log(chalk.cyan("
|
|
2576
|
+
console.log(chalk.cyan("LeWxClaw \u6587\u7AE0\u521B\u4F5C"));
|
|
2577
2577
|
console.log(chalk.gray("\u2501".repeat(50)));
|
|
2578
2578
|
console.log(`\u4E3B\u9898\uFF1A${chalk.bold(options.topic)}`);
|
|
2579
2579
|
console.log(`\u98CE\u683C\uFF1A${chalk.bold(options.style)}`);
|
|
@@ -2661,7 +2661,7 @@ import { Command as Command2 } from "commander";
|
|
|
2661
2661
|
import chalk2 from "chalk";
|
|
2662
2662
|
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
2663
2663
|
import { join as join4, dirname } from "path";
|
|
2664
|
-
var CONFIG_PATH = join4(process.cwd(), ".
|
|
2664
|
+
var CONFIG_PATH = join4(process.cwd(), ".lewxclaw", "config.json");
|
|
2665
2665
|
function readConfig() {
|
|
2666
2666
|
if (!existsSync3(CONFIG_PATH)) return {};
|
|
2667
2667
|
return JSON.parse(readFileSync4(CONFIG_PATH, "utf-8"));
|
|
@@ -2709,7 +2709,7 @@ function maskConfig(obj) {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
return result;
|
|
2711
2711
|
}
|
|
2712
|
-
var configCommand = new Command2("config").description("\u7BA1\u7406
|
|
2712
|
+
var configCommand = new Command2("config").description("\u7BA1\u7406 LeWxClaw \u914D\u7F6E");
|
|
2713
2713
|
configCommand.command("set <key> <value>").description("\u8BBE\u7F6E\u914D\u7F6E\u9879\uFF08\u5982 providers.minimax.apiKey\uFF09").action((key, value) => {
|
|
2714
2714
|
if (value.trim() === "") {
|
|
2715
2715
|
console.error(chalk2.red("\u9519\u8BEF\uFF1Avalue \u4E0D\u80FD\u4E3A\u7A7A"));
|
|
@@ -2738,7 +2738,7 @@ configCommand.command("list").description("\u663E\u793A\u6240\u6709\u914D\u7F6E\
|
|
|
2738
2738
|
return;
|
|
2739
2739
|
}
|
|
2740
2740
|
const masked = maskConfig(config);
|
|
2741
|
-
console.log(chalk2.cyan("
|
|
2741
|
+
console.log(chalk2.cyan("LeWxClaw \u914D\u7F6E\uFF08.lewxclaw/config.json\uFF09\uFF1A"));
|
|
2742
2742
|
console.log(chalk2.gray("\u2500".repeat(50)));
|
|
2743
2743
|
console.log(JSON.stringify(masked, null, 2));
|
|
2744
2744
|
});
|
|
@@ -2748,7 +2748,7 @@ import { Command as Command3 } from "commander";
|
|
|
2748
2748
|
import chalk3 from "chalk";
|
|
2749
2749
|
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
|
|
2750
2750
|
import { join as join5 } from "path";
|
|
2751
|
-
var CACHE_PATH = join5(process.cwd(), ".
|
|
2751
|
+
var CACHE_PATH = join5(process.cwd(), ".lewxclaw", "topics-cache.json");
|
|
2752
2752
|
var MOCK_TOPICS = [
|
|
2753
2753
|
{ title: "AI Agent 2026\u8D8B\u52BF", heat: 95, source: "weibo" },
|
|
2754
2754
|
{ title: "GPT-5.4 \u53D1\u5E03", heat: 88, source: "zhihu" },
|
|
@@ -2782,7 +2782,7 @@ function printTopics(topics) {
|
|
|
2782
2782
|
console.log(chalk3.gray(`\u5171 ${topics.length} \u6761\u70ED\u70B9`));
|
|
2783
2783
|
}
|
|
2784
2784
|
function saveCache(topics) {
|
|
2785
|
-
const dir = join5(process.cwd(), ".
|
|
2785
|
+
const dir = join5(process.cwd(), ".lewxclaw");
|
|
2786
2786
|
if (!existsSync4(dir)) mkdirSync3(dir, { recursive: true });
|
|
2787
2787
|
writeFileSync3(CACHE_PATH, JSON.stringify({ fetchedAt: (/* @__PURE__ */ new Date()).toISOString(), topics }, null, 2), "utf-8");
|
|
2788
2788
|
}
|
|
@@ -2800,7 +2800,7 @@ topicsCommand.command("fetch").description("\u6293\u53D6\u6700\u65B0\u70ED\u70B9
|
|
|
2800
2800
|
console.log(chalk3.cyan(`\u6B63\u5728\u83B7\u53D6\u70ED\u70B9\uFF08Mock \u6A21\u5F0F${options.source ? ` - ${options.source}` : ""}\uFF09...`));
|
|
2801
2801
|
saveCache(topics);
|
|
2802
2802
|
printTopics(topics);
|
|
2803
|
-
console.log(chalk3.green("\n\u5DF2\u7F13\u5B58\u5230 .
|
|
2803
|
+
console.log(chalk3.green("\n\u5DF2\u7F13\u5B58\u5230 .lewxclaw/topics-cache.json"));
|
|
2804
2804
|
return;
|
|
2805
2805
|
}
|
|
2806
2806
|
try {
|
|
@@ -2811,7 +2811,7 @@ topicsCommand.command("fetch").description("\u6293\u53D6\u6700\u65B0\u70ED\u70B9
|
|
|
2811
2811
|
const topics = aggregator.aggregate(raw);
|
|
2812
2812
|
saveCache(topics);
|
|
2813
2813
|
printTopics(topics);
|
|
2814
|
-
console.log(chalk3.green("\n\u5DF2\u7F13\u5B58\u5230 .
|
|
2814
|
+
console.log(chalk3.green("\n\u5DF2\u7F13\u5B58\u5230 .lewxclaw/topics-cache.json"));
|
|
2815
2815
|
} catch {
|
|
2816
2816
|
console.log(chalk3.yellow("scrapers \u5305\u5C1A\u672A\u53EF\u7528\uFF0C\u8BF7\u4F7F\u7528 --mock \u6A21\u5F0F\uFF1A"));
|
|
2817
2817
|
console.log(chalk3.gray(" lewxclaw topics fetch --mock"));
|
|
@@ -2833,7 +2833,7 @@ import { Command as Command4 } from "commander";
|
|
|
2833
2833
|
import chalk4 from "chalk";
|
|
2834
2834
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, existsSync as existsSync5, mkdirSync as mkdirSync4 } from "fs";
|
|
2835
2835
|
import { join as join6 } from "path";
|
|
2836
|
-
var TASKS_PATH = join6(process.cwd(), ".
|
|
2836
|
+
var TASKS_PATH = join6(process.cwd(), ".lewxclaw", "scheduler-tasks.json");
|
|
2837
2837
|
function loadTasks() {
|
|
2838
2838
|
if (!existsSync5(TASKS_PATH)) {
|
|
2839
2839
|
return [];
|
|
@@ -2846,7 +2846,7 @@ function loadTasks() {
|
|
|
2846
2846
|
}
|
|
2847
2847
|
}
|
|
2848
2848
|
function saveTasks(tasks) {
|
|
2849
|
-
const dir = join6(process.cwd(), ".
|
|
2849
|
+
const dir = join6(process.cwd(), ".lewxclaw");
|
|
2850
2850
|
if (!existsSync5(dir)) {
|
|
2851
2851
|
mkdirSync4(dir, { recursive: true });
|
|
2852
2852
|
}
|
|
@@ -3018,7 +3018,7 @@ styleCommand.command("list").description("\u663E\u793A\u6240\u6709\u98CE\u683C")
|
|
|
3018
3018
|
);
|
|
3019
3019
|
console.log(chalk5.gray("\u2500".repeat(40)));
|
|
3020
3020
|
if (styles.length === 0) {
|
|
3021
|
-
console.log(chalk5.yellow("\u6682\u65E0\u98CE\u683C\u6587\u4EF6\u3002\u8BF7\u68C0\u67E5 .
|
|
3021
|
+
console.log(chalk5.yellow("\u6682\u65E0\u98CE\u683C\u6587\u4EF6\u3002\u8BF7\u68C0\u67E5 .lewxclaw/styles/ \u76EE\u5F55\u3002"));
|
|
3022
3022
|
return;
|
|
3023
3023
|
}
|
|
3024
3024
|
for (const s of styles) {
|
|
@@ -3091,15 +3091,15 @@ import { homedir as homedir2 } from "os";
|
|
|
3091
3091
|
import { createInterface } from "readline";
|
|
3092
3092
|
var setupCommand = new Command6("setup").description("\u4EA4\u4E92\u5F0F\u914D\u7F6E\u5411\u5BFC").action(async () => {
|
|
3093
3093
|
console.log("");
|
|
3094
|
-
console.log(chalk6.cyan("\u{1F99E}
|
|
3094
|
+
console.log(chalk6.cyan("\u{1F99E} LeWxClaw \u914D\u7F6E\u5411\u5BFC"));
|
|
3095
3095
|
console.log(chalk6.gray("\u2501".repeat(50)));
|
|
3096
3096
|
console.log("");
|
|
3097
|
-
console.log("\u6B22\u8FCE\u4F7F\u7528
|
|
3097
|
+
console.log("\u6B22\u8FCE\u4F7F\u7528 LeWxClaw\uFF01\u8BA9\u6211\u4EEC\u914D\u7F6E\u4F60\u7684\u516C\u4F17\u53F7\u521B\u4F5C Agent\u3002");
|
|
3098
3098
|
console.log("");
|
|
3099
|
-
const
|
|
3100
|
-
const configPath2 = join7(
|
|
3101
|
-
if (!existsSync7(
|
|
3102
|
-
mkdirSync5(
|
|
3099
|
+
const lewxclawDir = join7(homedir2(), ".lewxclaw");
|
|
3100
|
+
const configPath2 = join7(lewxclawDir, "config.json");
|
|
3101
|
+
if (!existsSync7(lewxclawDir)) {
|
|
3102
|
+
mkdirSync5(lewxclawDir, { recursive: true });
|
|
3103
3103
|
}
|
|
3104
3104
|
let config = {};
|
|
3105
3105
|
if (existsSync7(configPath2)) {
|
|
@@ -3124,7 +3124,7 @@ var setupCommand = new Command6("setup").description("\u4EA4\u4E92\u5F0F\u914D\u
|
|
|
3124
3124
|
});
|
|
3125
3125
|
};
|
|
3126
3126
|
console.log(chalk6.yellow("\u{1F4E6} Step 1/4: LLM Provider \u914D\u7F6E"));
|
|
3127
|
-
console.log(chalk6.gray("
|
|
3127
|
+
console.log(chalk6.gray(" LeWxClaw \u9700\u8981\u81F3\u5C11\u4E00\u4E2A LLM API Key \u6765\u751F\u6210\u5185\u5BB9\u3002"));
|
|
3128
3128
|
console.log("");
|
|
3129
3129
|
console.log(chalk6.white(" MiniMax\uFF08\u9ED8\u8BA4 Provider\uFF0C\u63A8\u8350\uFF09"));
|
|
3130
3130
|
const minimaxKey = await ask(" MiniMax API Key\uFF08\u7559\u7A7A\u8DF3\u8FC7\uFF09");
|
|
@@ -3179,7 +3179,7 @@ var setupCommand = new Command6("setup").description("\u4EA4\u4E92\u5F0F\u914D\u
|
|
|
3179
3179
|
console.log(chalk6.gray(" \u4F60\u7684\u516C\u4F17\u53F7\u5B9A\u4F4D\u662F\u4EC0\u4E48\uFF1F\u8FD9\u4F1A\u5F71\u54CD AI \u7684\u5199\u4F5C\u98CE\u683C\u3002"));
|
|
3180
3180
|
console.log("");
|
|
3181
3181
|
const positioning = await ask(" \u516C\u4F17\u53F7\u5B9A\u4F4D\uFF08\u5982\uFF1A\u79D1\u6280\u8BC4\u8BBA\u3001\u804C\u573A\u6210\u957F\uFF09", "\u79D1\u6280\u8BC4\u8BBA");
|
|
3182
|
-
const soulDir = join7(
|
|
3182
|
+
const soulDir = join7(lewxclawDir, "styles");
|
|
3183
3183
|
if (!existsSync7(soulDir)) {
|
|
3184
3184
|
mkdirSync5(soulDir, { recursive: true });
|
|
3185
3185
|
}
|
|
@@ -3203,7 +3203,7 @@ var setupCommand = new Command6("setup").description("\u4EA4\u4E92\u5F0F\u914D\u
|
|
|
3203
3203
|
- \u4E0D\u5806\u780C\u7F51\u7EDC\u6D41\u884C\u8BED
|
|
3204
3204
|
- \u4E0D\u5199\u6807\u9898\u515A\u5185\u5BB9
|
|
3205
3205
|
`;
|
|
3206
|
-
writeFileSync5(join7(
|
|
3206
|
+
writeFileSync5(join7(lewxclawDir, "soul.md"), soulContent, "utf-8");
|
|
3207
3207
|
console.log(chalk6.green(` \u2713 \u516C\u4F17\u53F7\u4EBA\u8BBE\u5DF2\u4FDD\u5B58\uFF08${positioning}\uFF09`));
|
|
3208
3208
|
console.log("");
|
|
3209
3209
|
console.log(chalk6.yellow("\u{1F3A8} Step 4/4: \u9ED8\u8BA4\u5199\u4F5C\u98CE\u683C"));
|
|
@@ -3244,10 +3244,10 @@ var setupCommand = new Command6("setup").description("\u4EA4\u4E92\u5F0F\u914D\u
|
|
|
3244
3244
|
}
|
|
3245
3245
|
console.log("");
|
|
3246
3246
|
console.log(chalk6.cyan("\u2501".repeat(50)));
|
|
3247
|
-
console.log(chalk6.green("\u2705
|
|
3247
|
+
console.log(chalk6.green("\u2705 LeWxClaw \u914D\u7F6E\u5B8C\u6210\uFF01"));
|
|
3248
3248
|
console.log("");
|
|
3249
3249
|
console.log(" \u914D\u7F6E\u6587\u4EF6\uFF1A" + chalk6.gray(configPath2));
|
|
3250
|
-
console.log(" \u4EBA\u8BBE\u6587\u4EF6\uFF1A" + chalk6.gray(join7(
|
|
3250
|
+
console.log(" \u4EBA\u8BBE\u6587\u4EF6\uFF1A" + chalk6.gray(join7(lewxclawDir, "soul.md")));
|
|
3251
3251
|
console.log(" \u98CE\u683C\u76EE\u5F55\uFF1A" + chalk6.gray(soulDir));
|
|
3252
3252
|
console.log("");
|
|
3253
3253
|
console.log(" \u5FEB\u901F\u5F00\u59CB\uFF1A");
|
|
@@ -3283,7 +3283,7 @@ var webCommand = new Command7("web").description("\u542F\u52A8 Web \u7BA1\u7406\
|
|
|
3283
3283
|
console.log("");
|
|
3284
3284
|
return;
|
|
3285
3285
|
}
|
|
3286
|
-
console.log(chalk7.cyan("\u{1F99E}
|
|
3286
|
+
console.log(chalk7.cyan("\u{1F99E} LeWxClaw Web \u7BA1\u7406\u540E\u53F0"));
|
|
3287
3287
|
console.log(chalk7.gray("\u2501".repeat(50)));
|
|
3288
3288
|
console.log(` \u5730\u5740\uFF1A${chalk7.green(`http://localhost:${port}`)}`);
|
|
3289
3289
|
console.log(` \u76EE\u5F55\uFF1A${chalk7.gray(webDir)}`);
|
|
@@ -3333,7 +3333,7 @@ function findWebPackage() {
|
|
|
3333
3333
|
|
|
3334
3334
|
// src/index.ts
|
|
3335
3335
|
var program = new Command8();
|
|
3336
|
-
program.name("lewxclaw").description("
|
|
3336
|
+
program.name("lewxclaw").description("LeWxClaw \u2014 \u516C\u4F17\u53F7\u521B\u4F5C Agent").version("0.1.0");
|
|
3337
3337
|
program.addCommand(setupCommand);
|
|
3338
3338
|
program.addCommand(createCommand);
|
|
3339
3339
|
program.addCommand(configCommand);
|
|
@@ -3347,7 +3347,7 @@ var isSetup = args[0] === "setup";
|
|
|
3347
3347
|
var isHelp = args.includes("--help") || args.includes("-h");
|
|
3348
3348
|
var isVersion = args.includes("--version") || args.includes("-V");
|
|
3349
3349
|
if (!existsSync9(configPath) && !isSetup && !isHelp && !isVersion && args.length > 0) {
|
|
3350
|
-
console.log(chalk8.yellow("\u{1F99E} \u9996\u6B21\u4F7F\u7528
|
|
3350
|
+
console.log(chalk8.yellow("\u{1F99E} \u9996\u6B21\u4F7F\u7528 LeWxClaw\uFF1F\u8FD0\u884C lewxclaw setup \u6765\u914D\u7F6E\u4F60\u7684 Agent\u3002"));
|
|
3351
3351
|
console.log(chalk8.gray(' \u6216\u4F7F\u7528 --mock \u6A21\u5F0F\u514D\u914D\u7F6E\u4F53\u9A8C\uFF1Alewxclaw create --mock --topic "AI \u8D8B\u52BF"'));
|
|
3352
3352
|
console.log("");
|
|
3353
3353
|
}
|