maidang 29.7.7 → 29.7.9
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 +330 -359
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command12 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/home.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -23,14 +23,14 @@ function displaySeparator(char = "\u2500", length = 50) {
|
|
|
23
23
|
// src/commands/home.ts
|
|
24
24
|
var commands = [
|
|
25
25
|
{ name: "whoami", desc: "\u4E86\u89E3\u6211" },
|
|
26
|
-
{ name: "skills", desc: "\u6280\u80FD & \u5174\u8DA3" },
|
|
27
26
|
{ name: "career", desc: "\u5DE5\u4F5C" },
|
|
28
27
|
{ name: "posts", desc: "\u63A8\u6587" },
|
|
29
28
|
{ name: "songs", desc: "\u5E74\u5EA6\u6B4C\u5355" },
|
|
30
29
|
{ name: "tools", desc: "\u5E38\u7528\u5DE5\u5177" },
|
|
31
30
|
{ name: "links", desc: "\u94FE\u63A5" },
|
|
32
31
|
{ name: "projects", desc: "\u9879\u76EE" },
|
|
33
|
-
{ name: "cat | meow", desc: "\u9EA6\u9EA6" }
|
|
32
|
+
{ name: "cat | meow", desc: "\u9EA6\u9EA6" },
|
|
33
|
+
{ name: "contact", desc: "\u7559\u8A00" }
|
|
34
34
|
];
|
|
35
35
|
function createHomeCommand() {
|
|
36
36
|
const cmd = new Command("maidang").description("\u6B22\u8FCE\u6765\u5230\u9EA6\u5F53\u7684\u4E16\u754C").action(async () => {
|
|
@@ -48,89 +48,15 @@ function createHomeCommand() {
|
|
|
48
48
|
console.log(` ${chalk2.white(c.name.padEnd(nameWidth))} ${chalk2.gray(c.desc)}`);
|
|
49
49
|
});
|
|
50
50
|
console.log("");
|
|
51
|
+
console.log(chalk2.gray(" \u5982\u679C\u4F60\u662F Agent\uFF0C\u53EF\u5148\u770B\u8FD9\u91CC\uFF1A"));
|
|
51
52
|
console.log(chalk2.gray(" maidang --help"));
|
|
52
53
|
});
|
|
53
54
|
return cmd;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
// src/commands/
|
|
57
|
+
// src/commands/career.ts
|
|
57
58
|
import { Command as Command2 } from "commander";
|
|
58
59
|
import chalk3 from "chalk";
|
|
59
|
-
import ora2 from "ora";
|
|
60
|
-
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
61
|
-
function validatePackageName(name) {
|
|
62
|
-
if (!name) {
|
|
63
|
-
return "\u5305\u540D\u4E0D\u80FD\u4E3A\u7A7A";
|
|
64
|
-
}
|
|
65
|
-
if (name.length > 214) {
|
|
66
|
-
return "\u5305\u540D\u4E0D\u80FD\u8D85\u8FC7 214 \u4E2A\u5B57\u7B26";
|
|
67
|
-
}
|
|
68
|
-
if (name.startsWith(".") || name.startsWith("_")) {
|
|
69
|
-
return "\u5305\u540D\u4E0D\u80FD\u4EE5 . \u6216 _ \u5F00\u5934";
|
|
70
|
-
}
|
|
71
|
-
if (name !== name.toLowerCase()) {
|
|
72
|
-
return "\u5305\u540D\u5FC5\u987B\u5168\u5C0F\u5199";
|
|
73
|
-
}
|
|
74
|
-
if (encodeURIComponent(name) !== name) {
|
|
75
|
-
return "\u5305\u540D\u5305\u542B\u975E\u6CD5\u5B57\u7B26";
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
async function checkPackageExists(name, spinner) {
|
|
80
|
-
try {
|
|
81
|
-
spinner.text = `\u6B63\u5728\u68C0\u67E5 ${name}...`;
|
|
82
|
-
const res = await fetch(`${NPM_REGISTRY}/${name}`, {
|
|
83
|
-
method: "HEAD"
|
|
84
|
-
});
|
|
85
|
-
return res.ok;
|
|
86
|
-
} catch {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function createCreateCommand() {
|
|
91
|
-
const cmd = new Command2("create").description("\u521B\u5EFA\u65B0\u5305\uFF08\u81EA\u52A8\u6821\u9A8C\u5305\u540D\u662F\u5426\u53EF\u7528\uFF09").argument("<name>", "\u5305\u540D\u79F0").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (name, opts) => {
|
|
92
|
-
const spinner = ora2("\u51C6\u5907\u521B\u5EFA\u5305...").start();
|
|
93
|
-
const validationError = validatePackageName(name);
|
|
94
|
-
if (validationError) {
|
|
95
|
-
spinner.fail(chalk3.red(`\u5305\u540D\u6821\u9A8C\u5931\u8D25: ${validationError}`));
|
|
96
|
-
process.exit(1);
|
|
97
|
-
}
|
|
98
|
-
spinner.text = `\u6B63\u5728\u68C0\u67E5 ${name} \u662F\u5426\u53EF\u7528...`;
|
|
99
|
-
const exists = await checkPackageExists(name, spinner);
|
|
100
|
-
if (exists) {
|
|
101
|
-
spinner.fail(chalk3.red(`\u5305\u540D ${name} \u5DF2\u88AB\u4F7F\u7528\uFF0C\u8BF7\u6362\u4E00\u4E2A\u540D\u79F0`));
|
|
102
|
-
if (opts.json) {
|
|
103
|
-
console.log(JSON.stringify({
|
|
104
|
-
tool: "maidang",
|
|
105
|
-
command: "create",
|
|
106
|
-
success: false,
|
|
107
|
-
error: `\u5305\u540D ${name} \u5DF2\u88AB\u4F7F\u7528`,
|
|
108
|
-
suggestion: "\u5C1D\u8BD5\u6DFB\u52A0\u4F60\u7684\u4F5C\u7528\u57DF\uFF0C\u4F8B\u5982 @yourname/" + name
|
|
109
|
-
}, null, 2));
|
|
110
|
-
}
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
spinner.succeed(chalk3.green(`\u5305\u540D ${name} \u53EF\u7528\uFF01`));
|
|
114
|
-
if (opts.json) {
|
|
115
|
-
console.log(JSON.stringify({
|
|
116
|
-
tool: "maidang",
|
|
117
|
-
command: "create",
|
|
118
|
-
success: true,
|
|
119
|
-
name,
|
|
120
|
-
available: true
|
|
121
|
-
}, null, 2));
|
|
122
|
-
} else {
|
|
123
|
-
console.log("");
|
|
124
|
-
console.log(chalk3.dim("\u4E0B\u4E00\u6B65:"));
|
|
125
|
-
console.log(` ${chalk3.white(`pnpm create ${name}`)} ${chalk3.dim("# \u6216\u4F7F\u7528\u5176\u4ED6\u811A\u624B\u67B6\u5DE5\u5177")}`);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
return cmd;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/commands/career.ts
|
|
132
|
-
import { Command as Command3 } from "commander";
|
|
133
|
-
import chalk4 from "chalk";
|
|
134
60
|
|
|
135
61
|
// src/data/career.json
|
|
136
62
|
var career_default = {
|
|
@@ -226,11 +152,11 @@ var career_default = {
|
|
|
226
152
|
// src/commands/career.ts
|
|
227
153
|
var printIndentedGray = (text, indent) => {
|
|
228
154
|
for (const line of text.split("\n")) {
|
|
229
|
-
console.log(
|
|
155
|
+
console.log(chalk3.gray(indent + line));
|
|
230
156
|
}
|
|
231
157
|
};
|
|
232
158
|
function createCareerCommand() {
|
|
233
|
-
const cmd = new
|
|
159
|
+
const cmd = new Command2("career").description("\u804C\u4E1A\u5207\u7247\uFF08\u4E0E\u7AD9\u70B9 career \u9875\u540C\u6E90\uFF0C--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
234
160
|
const root = career_default;
|
|
235
161
|
const data = root.career;
|
|
236
162
|
if (opts.json) {
|
|
@@ -239,48 +165,48 @@ function createCareerCommand() {
|
|
|
239
165
|
}
|
|
240
166
|
const { intro, sections, focuses, experiences, principles } = data;
|
|
241
167
|
console.log("");
|
|
242
|
-
console.log(
|
|
243
|
-
console.log(
|
|
168
|
+
console.log(chalk3.dim(intro.eyebrow));
|
|
169
|
+
console.log(chalk3.white.bold(intro.title));
|
|
244
170
|
console.log("");
|
|
245
|
-
console.log(
|
|
171
|
+
console.log(chalk3.white(intro.lead));
|
|
246
172
|
console.log("");
|
|
247
173
|
printIndentedGray(intro.body, " ");
|
|
248
174
|
console.log("");
|
|
249
175
|
displaySeparator();
|
|
250
|
-
console.log(
|
|
251
|
-
console.log(
|
|
176
|
+
console.log(chalk3.bold.cyan(sections.focus.title));
|
|
177
|
+
console.log(chalk3.dim(sections.focus.subtitle));
|
|
252
178
|
console.log("");
|
|
253
179
|
for (const f of focuses) {
|
|
254
|
-
console.log(
|
|
255
|
-
console.log(
|
|
180
|
+
console.log(chalk3.white.bold(` ${f.title}`));
|
|
181
|
+
console.log(chalk3.gray(` ${f.description}`));
|
|
256
182
|
console.log("");
|
|
257
183
|
}
|
|
258
184
|
displaySeparator();
|
|
259
|
-
console.log(
|
|
260
|
-
console.log(
|
|
185
|
+
console.log(chalk3.bold.cyan(sections.experience.title));
|
|
186
|
+
console.log(chalk3.dim(sections.experience.subtitle));
|
|
261
187
|
console.log("");
|
|
262
188
|
experiences.forEach((exp, index) => {
|
|
263
|
-
console.log(
|
|
264
|
-
console.log(
|
|
265
|
-
console.log(
|
|
189
|
+
console.log(chalk3.dim(` ${exp.period}`));
|
|
190
|
+
console.log(chalk3.white.bold(` ${exp.company}`));
|
|
191
|
+
console.log(chalk3.gray(` ${exp.role}`));
|
|
266
192
|
console.log("");
|
|
267
|
-
console.log(
|
|
193
|
+
console.log(chalk3.gray(` ${exp.summary}`));
|
|
268
194
|
console.log("");
|
|
269
195
|
for (const p of exp.paragraphs) {
|
|
270
|
-
console.log(
|
|
196
|
+
console.log(chalk3.gray(` ${p}`));
|
|
271
197
|
console.log("");
|
|
272
198
|
}
|
|
273
199
|
if (index < experiences.length - 1) {
|
|
274
|
-
console.log(
|
|
200
|
+
console.log(chalk3.dim(" " + "\xB7".repeat(36)));
|
|
275
201
|
console.log("");
|
|
276
202
|
}
|
|
277
203
|
});
|
|
278
204
|
displaySeparator();
|
|
279
|
-
console.log(
|
|
280
|
-
console.log(
|
|
205
|
+
console.log(chalk3.bold.cyan(sections.principles.title));
|
|
206
|
+
console.log(chalk3.dim(sections.principles.subtitle));
|
|
281
207
|
console.log("");
|
|
282
208
|
for (const line of principles) {
|
|
283
|
-
console.log(
|
|
209
|
+
console.log(chalk3.gray(` ${line}`));
|
|
284
210
|
console.log("");
|
|
285
211
|
}
|
|
286
212
|
});
|
|
@@ -288,8 +214,8 @@ function createCareerCommand() {
|
|
|
288
214
|
}
|
|
289
215
|
|
|
290
216
|
// src/commands/cat.ts
|
|
291
|
-
import { Command as
|
|
292
|
-
import
|
|
217
|
+
import { Command as Command3 } from "commander";
|
|
218
|
+
import chalk4 from "chalk";
|
|
293
219
|
|
|
294
220
|
// src/constants/api.ts
|
|
295
221
|
var DEFAULT_API_URL = "https://www.maidang.me";
|
|
@@ -349,22 +275,22 @@ var getCatMoments = async () => {
|
|
|
349
275
|
return Array.isArray(data) ? data : [];
|
|
350
276
|
};
|
|
351
277
|
var printCatList = (catMoments) => {
|
|
352
|
-
console.log(
|
|
278
|
+
console.log(chalk4.yellow.bold("\u9EA6\u9EA6"));
|
|
353
279
|
console.log("");
|
|
354
280
|
for (const moment of catMoments) {
|
|
355
281
|
const title = moment.title || "\u672A\u547D\u540D\u732B\u732B\u52A8\u6001";
|
|
356
|
-
console.log(` ${
|
|
282
|
+
console.log(` ${chalk4.white.bold(title)} ${chalk4.dim(`[${moment.slug}]`)}`);
|
|
357
283
|
if (moment.description) {
|
|
358
|
-
console.log(` ${
|
|
284
|
+
console.log(` ${chalk4.gray(moment.description)}`);
|
|
359
285
|
}
|
|
360
286
|
if (moment.imageUrl) {
|
|
361
|
-
console.log(` ${
|
|
287
|
+
console.log(` ${chalk4.blue(moment.imageUrl)}`);
|
|
362
288
|
}
|
|
363
289
|
console.log("");
|
|
364
290
|
}
|
|
365
291
|
};
|
|
366
292
|
function createCatCommand() {
|
|
367
|
-
const cmd = new
|
|
293
|
+
const cmd = new Command3("cat").alias("meow").description("\u67E5\u770B\u732B\u732B\u52A8\u6001\u5217\u8868 (--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E)").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (opts) => {
|
|
368
294
|
const printJson = (data, error) => {
|
|
369
295
|
const payload = {
|
|
370
296
|
tool: "maidang",
|
|
@@ -383,9 +309,9 @@ function createCatCommand() {
|
|
|
383
309
|
return;
|
|
384
310
|
}
|
|
385
311
|
if (catMoments.length === 0) {
|
|
386
|
-
console.log(
|
|
312
|
+
console.log(chalk4.yellow.bold("\u9EA6\u9EA6"));
|
|
387
313
|
console.log("");
|
|
388
|
-
console.log(
|
|
314
|
+
console.log(chalk4.gray("\u6682\u65E0\u732B\u732B\u52A8\u6001\uFF0C\u53EF\u5728\u540E\u53F0\u5148\u6DFB\u52A0\u3002"));
|
|
389
315
|
console.log("");
|
|
390
316
|
return;
|
|
391
317
|
}
|
|
@@ -396,7 +322,7 @@ function createCatCommand() {
|
|
|
396
322
|
printJson([], message);
|
|
397
323
|
return;
|
|
398
324
|
}
|
|
399
|
-
console.error(
|
|
325
|
+
console.error(chalk4.red(`\u83B7\u53D6\u732B\u732B\u52A8\u6001\u5931\u8D25: ${message}`));
|
|
400
326
|
process.exit(1);
|
|
401
327
|
}
|
|
402
328
|
});
|
|
@@ -406,7 +332,7 @@ function createCatCommand() {
|
|
|
406
332
|
// src/commands/posts.tsx
|
|
407
333
|
import React, { useState, useEffect } from "react";
|
|
408
334
|
import { render, Box, Text, useInput } from "ink";
|
|
409
|
-
import { Command as
|
|
335
|
+
import { Command as Command4 } from "commander";
|
|
410
336
|
var ListView = ({ posts, selectedIndex, onSelect, onEnter, onQuit }) => {
|
|
411
337
|
useInput((input, key) => {
|
|
412
338
|
if (input === "q" || input === "Q") {
|
|
@@ -556,7 +482,7 @@ var PostsApp = ({ apiUrl }) => {
|
|
|
556
482
|
};
|
|
557
483
|
function createPostsCommand() {
|
|
558
484
|
const apiUrl = `${process.env.MAIDANG_API_URL || DEFAULT_API_URL}/api/social-posts?type=social`;
|
|
559
|
-
const cmd = new
|
|
485
|
+
const cmd = new Command4("posts").description("\u63A8\u6587\u5217\u8868\uFF0C\u8FDB\u5165\u540E\u53EF\u67E5\u770B\u8BE6\u60C5 (--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E)").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F");
|
|
560
486
|
cmd.action((opts) => {
|
|
561
487
|
const wantsJson = opts.json;
|
|
562
488
|
if (wantsJson) {
|
|
@@ -579,7 +505,7 @@ function createPostsCommand() {
|
|
|
579
505
|
// src/commands/songs.tsx
|
|
580
506
|
import React2, { useState as useState2, useRef } from "react";
|
|
581
507
|
import { render as render2, Box as Box2, Text as Text2, useInput as useInput2 } from "ink";
|
|
582
|
-
import { Command as
|
|
508
|
+
import { Command as Command5 } from "commander";
|
|
583
509
|
|
|
584
510
|
// src/data/songs.json
|
|
585
511
|
var songs_default = {
|
|
@@ -1636,7 +1562,7 @@ var SongsApp = ({ defaultYearIndex }) => {
|
|
|
1636
1562
|
);
|
|
1637
1563
|
};
|
|
1638
1564
|
function createSongsCommand() {
|
|
1639
|
-
const cmd = new
|
|
1565
|
+
const cmd = new Command5("songs").description(`\u5E74\u5EA6\u6B4C\u5355\uFF0C\u652F\u6301: ${AVAILABLE_YEARS.join(", ")} (--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E)`).option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("--year <year>", `\u8DF3\u8F6C\u81F3\u6307\u5B9A\u5E74\u4EFD\u7684\u6B4C\u66F2\u5217\u8868`);
|
|
1640
1566
|
cmd.action((opts) => {
|
|
1641
1567
|
if (opts.json) {
|
|
1642
1568
|
if (opts.year) {
|
|
@@ -1668,10 +1594,10 @@ function createSongsCommand() {
|
|
|
1668
1594
|
}
|
|
1669
1595
|
|
|
1670
1596
|
// src/commands/links.ts
|
|
1671
|
-
import { Command as
|
|
1672
|
-
import
|
|
1597
|
+
import { Command as Command6 } from "commander";
|
|
1598
|
+
import chalk5 from "chalk";
|
|
1673
1599
|
function createLinksCommand() {
|
|
1674
|
-
const cmd = new
|
|
1600
|
+
const cmd = new Command6("links").description("\u67E5\u770B\u793E\u4EA4\u94FE\u63A5 (--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E)").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (opts) => {
|
|
1675
1601
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1676
1602
|
try {
|
|
1677
1603
|
const res = await fetch(`${apiUrl}/api/links`);
|
|
@@ -1681,14 +1607,14 @@ function createLinksCommand() {
|
|
|
1681
1607
|
console.log(JSON.stringify({ tool: "maidang", command: "links", data: links }, null, 2));
|
|
1682
1608
|
return;
|
|
1683
1609
|
}
|
|
1684
|
-
console.log(
|
|
1610
|
+
console.log(chalk5.cyan.bold("\u{1F310} \u793E\u4EA4\u94FE\u63A5\n"));
|
|
1685
1611
|
for (const link of links) {
|
|
1686
|
-
console.log(` ${link.icon} ${
|
|
1687
|
-
console.log(` ${
|
|
1612
|
+
console.log(` ${link.icon} ${chalk5.white(link.name)} - ${chalk5.gray(link.description || "")}`);
|
|
1613
|
+
console.log(` ${chalk5.blue(link.url)}
|
|
1688
1614
|
`);
|
|
1689
1615
|
}
|
|
1690
1616
|
} catch (err) {
|
|
1691
|
-
console.error(
|
|
1617
|
+
console.error(chalk5.red(`\u83B7\u53D6\u94FE\u63A5\u5931\u8D25: ${err instanceof Error ? err.message : err}`));
|
|
1692
1618
|
process.exit(1);
|
|
1693
1619
|
}
|
|
1694
1620
|
});
|
|
@@ -1696,10 +1622,10 @@ function createLinksCommand() {
|
|
|
1696
1622
|
}
|
|
1697
1623
|
|
|
1698
1624
|
// src/commands/projects.ts
|
|
1699
|
-
import { Command as
|
|
1700
|
-
import
|
|
1625
|
+
import { Command as Command7 } from "commander";
|
|
1626
|
+
import chalk6 from "chalk";
|
|
1701
1627
|
function createProjectsCommand() {
|
|
1702
|
-
const cmd = new
|
|
1628
|
+
const cmd = new Command7("projects").description("\u67E5\u770B\u4E2A\u4EBA\u9879\u76EE").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (opts) => {
|
|
1703
1629
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1704
1630
|
try {
|
|
1705
1631
|
const res = await fetch(`${apiUrl}/api/projects`);
|
|
@@ -1709,17 +1635,17 @@ function createProjectsCommand() {
|
|
|
1709
1635
|
console.log(JSON.stringify({ tool: "maidang", command: "projects", data: projects }, null, 2));
|
|
1710
1636
|
return;
|
|
1711
1637
|
}
|
|
1712
|
-
console.log(
|
|
1638
|
+
console.log(chalk6.cyan.bold("\u{1F680} \u4E2A\u4EBA\u9879\u76EE\n"));
|
|
1713
1639
|
for (const project of projects) {
|
|
1714
|
-
console.log(` ${project.icon} ${
|
|
1640
|
+
console.log(` ${project.icon} ${chalk6.white.bold(project.name)} ${chalk6.gray(`[${project.category}]`)}`);
|
|
1715
1641
|
console.log(` ${project.description}`);
|
|
1716
1642
|
if (project.url) {
|
|
1717
|
-
console.log(` ${
|
|
1643
|
+
console.log(` ${chalk6.blue(project.url)}`);
|
|
1718
1644
|
}
|
|
1719
1645
|
console.log("");
|
|
1720
1646
|
}
|
|
1721
1647
|
} catch (err) {
|
|
1722
|
-
console.error(
|
|
1648
|
+
console.error(chalk6.red(`\u83B7\u53D6\u9879\u76EE\u5931\u8D25: ${err instanceof Error ? err.message : err}`));
|
|
1723
1649
|
process.exit(1);
|
|
1724
1650
|
}
|
|
1725
1651
|
});
|
|
@@ -1727,10 +1653,10 @@ function createProjectsCommand() {
|
|
|
1727
1653
|
}
|
|
1728
1654
|
|
|
1729
1655
|
// src/commands/tools.ts
|
|
1730
|
-
import { Command as
|
|
1731
|
-
import
|
|
1656
|
+
import { Command as Command8 } from "commander";
|
|
1657
|
+
import chalk7 from "chalk";
|
|
1732
1658
|
function createToolsCommand() {
|
|
1733
|
-
const cmd = new
|
|
1659
|
+
const cmd = new Command8("tools").description("\u67E5\u770B\u5E38\u7528\u5DE5\u5177").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (opts) => {
|
|
1734
1660
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1735
1661
|
try {
|
|
1736
1662
|
const res = await fetch(`${apiUrl}/api/tools`);
|
|
@@ -1750,204 +1676,28 @@ function createToolsCommand() {
|
|
|
1750
1676
|
device: "\u8BBE\u5907",
|
|
1751
1677
|
desktop: "\u684C\u9762\u88C5\u5907"
|
|
1752
1678
|
};
|
|
1753
|
-
console.log(
|
|
1679
|
+
console.log(chalk7.cyan.bold("\u{1F527} \u5E38\u7528\u5DE5\u5177\n"));
|
|
1754
1680
|
for (const [cat, items] of Object.entries(byCategory)) {
|
|
1755
|
-
console.log(
|
|
1681
|
+
console.log(chalk7.white.bold(` ${categoryNames[cat] || cat}`));
|
|
1756
1682
|
for (const tool of items) {
|
|
1757
|
-
const urlStr = tool.url ? ` ${
|
|
1758
|
-
console.log(` ${tool.icon} ${tool.name} - ${
|
|
1683
|
+
const urlStr = tool.url ? ` ${chalk7.blue(tool.url)}` : "";
|
|
1684
|
+
console.log(` ${tool.icon} ${tool.name} - ${chalk7.gray(tool.description)}${urlStr}`);
|
|
1759
1685
|
}
|
|
1760
1686
|
console.log("");
|
|
1761
1687
|
}
|
|
1762
1688
|
} catch (err) {
|
|
1763
|
-
console.error(
|
|
1689
|
+
console.error(chalk7.red(`\u83B7\u53D6\u5DE5\u5177\u5931\u8D25: ${err instanceof Error ? err.message : err}`));
|
|
1764
1690
|
process.exit(1);
|
|
1765
1691
|
}
|
|
1766
1692
|
});
|
|
1767
1693
|
return cmd;
|
|
1768
1694
|
}
|
|
1769
1695
|
|
|
1770
|
-
// src/commands/contact.
|
|
1771
|
-
import {
|
|
1772
|
-
import chalk9 from "chalk";
|
|
1773
|
-
function hr(char = "\u2500", len = 40) {
|
|
1774
|
-
console.log(chalk9.dim(char.repeat(len)));
|
|
1775
|
-
}
|
|
1776
|
-
function createContactCommand() {
|
|
1777
|
-
const cmd = new Command10("contact").description("\u8054\u7CFB\u65B9\u5F0F").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1778
|
-
const data = { email: "borisdunk@sina.com", note: "\u56DE\u590D\u53EF\u80FD\u8F83\u6162\uFF0C\u770B\u5230\u4F1A\u56DE" };
|
|
1779
|
-
if (opts.json) {
|
|
1780
|
-
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
1781
|
-
return;
|
|
1782
|
-
}
|
|
1783
|
-
console.log("");
|
|
1784
|
-
console.log(chalk9.bold("\u8054\u7CFB\u65B9\u5F0F"));
|
|
1785
|
-
console.log("");
|
|
1786
|
-
hr();
|
|
1787
|
-
console.log("");
|
|
1788
|
-
console.log(` Email ${chalk9.blue("borisdunk@sina.com")}`);
|
|
1789
|
-
console.log("");
|
|
1790
|
-
console.log(` ${chalk9.dim("\u56DE\u590D\u53EF\u80FD\u8F83\u6162\uFF0C\u770B\u5230\u4F1A\u56DE")}`);
|
|
1791
|
-
console.log("");
|
|
1792
|
-
});
|
|
1793
|
-
return cmd;
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
// src/commands/skills.ts
|
|
1797
|
-
import { Command as Command11 } from "commander";
|
|
1798
|
-
import chalk10 from "chalk";
|
|
1799
|
-
var skills = [
|
|
1800
|
-
// 生活方式
|
|
1801
|
-
{ name: "\u4E3E\u94C1 / \u5065\u8EAB", tags: ["life"] },
|
|
1802
|
-
{ name: "\u98DE\u76D8", tags: ["life"] },
|
|
1803
|
-
{ name: "\u5409\u4ED6", tags: ["life"] },
|
|
1804
|
-
{ name: "\u62FF\u94C1", tags: ["life"] },
|
|
1805
|
-
{ name: "\u7F8E\u5267", tags: ["life"] },
|
|
1806
|
-
// 产品
|
|
1807
|
-
{ name: "\u72EC\u7ACB\u5F00\u53D1", tags: ["product"] },
|
|
1808
|
-
{ name: "\u4EA7\u54C1\u8BBE\u8BA1", tags: ["product"] },
|
|
1809
|
-
{ name: "Hight Agency", tags: ["product"] },
|
|
1810
|
-
{ name: "\u4EA7\u54C1\u8C03\u7814", tags: ["product"] },
|
|
1811
|
-
// 技术
|
|
1812
|
-
{ name: "TypeScript", tags: ["tech"] },
|
|
1813
|
-
{ name: "Next.js / React", tags: ["tech"] },
|
|
1814
|
-
{ name: "Node.js", tags: ["tech"] },
|
|
1815
|
-
{ name: "AI Agent / LLM", tags: ["tech"] },
|
|
1816
|
-
{ name: "\u524D\u7AEF\u5DE5\u7A0B\u5316", tags: ["tech"] },
|
|
1817
|
-
{ name: "React Flow", tags: ["tech"] }
|
|
1818
|
-
];
|
|
1819
|
-
function hr2(char = "\u2500", len = 40) {
|
|
1820
|
-
console.log(chalk10.dim(char.repeat(len)));
|
|
1821
|
-
}
|
|
1822
|
-
function createSkillsCommand() {
|
|
1823
|
-
const cmd = new Command11("skills").description("\u6280\u80FD\u4E0E\u5174\u8DA3").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1824
|
-
if (opts.json) {
|
|
1825
|
-
console.log(JSON.stringify({ tool: "maidang", command: "skills", data: skills }, null, 2));
|
|
1826
|
-
return;
|
|
1827
|
-
}
|
|
1828
|
-
const life = skills.filter((s) => s.tags.includes("life"));
|
|
1829
|
-
const product = skills.filter((s) => s.tags.includes("product"));
|
|
1830
|
-
const tech = skills.filter((s) => s.tags.includes("tech"));
|
|
1831
|
-
console.log("");
|
|
1832
|
-
console.log(chalk10.bold("\u751F\u6D3B"));
|
|
1833
|
-
console.log("");
|
|
1834
|
-
console.log(" " + life.map((s) => chalk10.white(s.name)).join(chalk10.dim(" \xB7 ")));
|
|
1835
|
-
console.log("");
|
|
1836
|
-
hr2();
|
|
1837
|
-
console.log("");
|
|
1838
|
-
console.log(chalk10.bold("\u4EA7\u54C1"));
|
|
1839
|
-
console.log("");
|
|
1840
|
-
console.log(" " + product.map((s) => chalk10.white(s.name)).join(chalk10.dim(" \xB7 ")));
|
|
1841
|
-
console.log("");
|
|
1842
|
-
hr2();
|
|
1843
|
-
console.log("");
|
|
1844
|
-
console.log(chalk10.bold("\u6280\u672F"));
|
|
1845
|
-
console.log("");
|
|
1846
|
-
console.log(" " + tech.map((s) => chalk10.white(s.name)).join(chalk10.dim(" \xB7 ")));
|
|
1847
|
-
console.log("");
|
|
1848
|
-
});
|
|
1849
|
-
return cmd;
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
// src/commands/status.ts
|
|
1853
|
-
import { Command as Command12 } from "commander";
|
|
1854
|
-
import chalk11 from "chalk";
|
|
1855
|
-
function getStatus() {
|
|
1856
|
-
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
1857
|
-
const isWeekend = [0, 6].includes((/* @__PURE__ */ new Date()).getDay());
|
|
1858
|
-
if (isWeekend) return { status: "available", label: "\u5468\u672B\u53EF\u7EA6", description: "\u65F6\u95F4\u7075\u6D3B\uFF0C\u53EF\u4EE5\u804A\u804A" };
|
|
1859
|
-
if (hour < 9 || hour >= 22) return { status: "available", label: "\u7A7A\u95F2\u4E2D", description: "\u975E\u5DE5\u4F5C\u65F6\u95F4" };
|
|
1860
|
-
if (hour >= 19) return { status: "busy", label: "\u4E0B\u73ED\u4E86", description: "\u4F11\u606F\u4E2D\uFF0C\u770B\u5230\u4F1A\u56DE" };
|
|
1861
|
-
return { status: "working", label: "\u5DE5\u4F5C\u4E2D", description: "\u6B63\u5E38\u5DE5\u4F5C\u65F6\u6BB5" };
|
|
1862
|
-
}
|
|
1863
|
-
function hr3(char = "\u2500", len = 40) {
|
|
1864
|
-
console.log(chalk11.dim(char.repeat(len)));
|
|
1865
|
-
}
|
|
1866
|
-
function createStatusCommand() {
|
|
1867
|
-
const cmd = new Command12("status").description("\u5F53\u524D\u72B6\u6001").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1868
|
-
const info = getStatus();
|
|
1869
|
-
if (opts.json) {
|
|
1870
|
-
console.log(JSON.stringify({ tool: "maidang", command: "status", data: info }, null, 2));
|
|
1871
|
-
return;
|
|
1872
|
-
}
|
|
1873
|
-
console.log("");
|
|
1874
|
-
console.log(chalk11.bold("\u5F53\u524D\u72B6\u6001"));
|
|
1875
|
-
console.log("");
|
|
1876
|
-
hr3();
|
|
1877
|
-
console.log("");
|
|
1878
|
-
console.log(` ${chalk11.cyan("\u25CF")} ${chalk11.white(info.label)}`);
|
|
1879
|
-
console.log(` ${chalk11.dim(info.description)}`);
|
|
1880
|
-
console.log("");
|
|
1881
|
-
});
|
|
1882
|
-
return cmd;
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
// src/commands/whoami.ts
|
|
1886
|
-
import { Command as Command13 } from "commander";
|
|
1887
|
-
import chalk12 from "chalk";
|
|
1888
|
-
|
|
1889
|
-
// src/constants/profile.ts
|
|
1890
|
-
var INTRO_TEXT = "\u8FDE\u7EED\u5C31\u4E1A\u8005 / \u6587\u79D1\u8F6C\u7801 / \u5168\u6808 / \u72EC\u7ACB\u5F00\u53D1 / \u62FF\u94C1\u7231\u597D\u8005 / \u4E3E\u94C1 / \u98DE\u76D8 / ALL in AI";
|
|
1891
|
-
|
|
1892
|
-
// src/commands/whoami.ts
|
|
1893
|
-
function getStatus2() {
|
|
1894
|
-
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
1895
|
-
const isWeekend = [0, 6].includes((/* @__PURE__ */ new Date()).getDay());
|
|
1896
|
-
if (isWeekend) return { status: "available", label: "\u5468\u672B\u53EF\u7EA6", description: "\u65F6\u95F4\u7075\u6D3B\uFF0C\u53EF\u4EE5\u804A\u804A" };
|
|
1897
|
-
if (hour < 9 || hour >= 22) return { status: "available", label: "\u7A7A\u95F2\u4E2D", description: "\u975E\u5DE5\u4F5C\u65F6\u95F4" };
|
|
1898
|
-
if (hour >= 19) return { status: "busy", label: "\u4E0B\u73ED\u4E86", description: "\u4F11\u606F\u4E2D\uFF0C\u770B\u5230\u4F1A\u56DE" };
|
|
1899
|
-
return { status: "working", label: "\u5DE5\u4F5C\u4E2D", description: "\u6B63\u5E38\u5DE5\u4F5C\u65F6\u6BB5" };
|
|
1900
|
-
}
|
|
1901
|
-
function hr4(char = "\u2500", len = 40) {
|
|
1902
|
-
console.log(chalk12.dim(char.repeat(len)));
|
|
1903
|
-
}
|
|
1904
|
-
function createWhoAmICommand() {
|
|
1905
|
-
const cmd = new Command13("whoami").description("\u4E86\u89E3\u6211").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1906
|
-
const status = getStatus2();
|
|
1907
|
-
const whoami = {
|
|
1908
|
-
tagline: INTRO_TEXT,
|
|
1909
|
-
location: "\u676D\u5DDE \xB7 EFC",
|
|
1910
|
-
status,
|
|
1911
|
-
links: [
|
|
1912
|
-
{ label: "Blog", url: "https://www.maidang.me" }
|
|
1913
|
-
],
|
|
1914
|
-
contact: "borisdunk@sina.com",
|
|
1915
|
-
website: "https://www.maidang.me",
|
|
1916
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1917
|
-
};
|
|
1918
|
-
if (opts.json) {
|
|
1919
|
-
console.log(JSON.stringify({ tool: "maidang", command: "whoami", data: whoami }, null, 2));
|
|
1920
|
-
return;
|
|
1921
|
-
}
|
|
1922
|
-
console.log("");
|
|
1923
|
-
console.log(chalk12.bold("\u6211\u662F \u9EA6\u5F53"));
|
|
1924
|
-
console.log("");
|
|
1925
|
-
console.log(" " + whoami.tagline);
|
|
1926
|
-
console.log("");
|
|
1927
|
-
hr4();
|
|
1928
|
-
console.log("");
|
|
1929
|
-
console.log(` ${chalk12.cyan("\u{1F4CD}")} ${whoami.location}`);
|
|
1930
|
-
console.log(` ${chalk12.cyan("\u23F1")} ${whoami.status.label} \xB7 ${chalk12.dim(whoami.status.description)}`);
|
|
1931
|
-
console.log("");
|
|
1932
|
-
hr4();
|
|
1933
|
-
console.log("");
|
|
1934
|
-
console.log(` Blog ${chalk12.blue.underline(whoami.website)}`);
|
|
1935
|
-
console.log(` Email ${chalk12.blue(whoami.contact)}`);
|
|
1936
|
-
console.log("");
|
|
1937
|
-
hr4();
|
|
1938
|
-
console.log("");
|
|
1939
|
-
console.log(` ${chalk12.dim("\u60F3\u4E86\u89E3\u66F4\u591A\uFF1F")}`);
|
|
1940
|
-
console.log(` ${chalk12.dim("maidang skills / career / posts / links")}`);
|
|
1941
|
-
console.log("");
|
|
1942
|
-
});
|
|
1943
|
-
return cmd;
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
// src/commands/chat.tsx
|
|
1947
|
-
import React3, { useState as useState3, useRef as useRef2, useEffect as useEffect3 } from "react";
|
|
1696
|
+
// src/commands/contact.tsx
|
|
1697
|
+
import React3, { useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
1948
1698
|
import { render as render3, Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
|
|
1949
|
-
import { Command as
|
|
1950
|
-
import
|
|
1699
|
+
import { Command as Command9 } from "commander";
|
|
1700
|
+
import chalk8 from "chalk";
|
|
1951
1701
|
|
|
1952
1702
|
// src/utils/chat-api.ts
|
|
1953
1703
|
var API_URL = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
@@ -2023,7 +1773,234 @@ async function fetchChat(message, sessionId) {
|
|
|
2023
1773
|
};
|
|
2024
1774
|
}
|
|
2025
1775
|
|
|
1776
|
+
// src/commands/contact.tsx
|
|
1777
|
+
var DOUBLE_ENTER_WINDOW = 1e3;
|
|
1778
|
+
function buildContactPrompt(raw) {
|
|
1779
|
+
return [
|
|
1780
|
+
"\u8BF7\u5E2E\u6211\u7ED9\u9EA6\u5F53\u53D1\u9001\u4E00\u5C01\u7559\u8A00\u90AE\u4EF6\uFF0C\u5E76\u8C03\u7528 send_maidang_email \u5DE5\u5177\u3002",
|
|
1781
|
+
"\u4E0B\u9762\u662F\u7528\u6237\u5728\u8054\u7CFB\u8868\u5355\u91CC\u8F93\u5165\u7684\u539F\u59CB\u5185\u5BB9\uFF0C\u8BF7\u5C3D\u91CF\u4ECE\u4E2D\u63D0\u53D6\u79F0\u547C\u3001\u90AE\u7BB1\u548C\u7559\u8A00\u6B63\u6587\u3002",
|
|
1782
|
+
"\u5982\u679C\u80FD\u8BC6\u522B\u90AE\u7BB1\u5C31\u5E26\u4E0A\uFF1B\u5982\u679C\u8BC6\u522B\u4E0D\u5230\u5C31\u53EA\u53D1\u9001\u7559\u8A00\u5185\u5BB9\u3002",
|
|
1783
|
+
"\u53D1\u9001\u6210\u529F\u540E\uFF0C\u53EA\u9700\u8981\u7528\u4E00\u53E5\u7B80\u77ED\u4E2D\u6587\u786E\u8BA4\u5DF2\u7ECF\u53D1\u9001\u5373\u53EF\u3002",
|
|
1784
|
+
"",
|
|
1785
|
+
raw.trim()
|
|
1786
|
+
].join("\n");
|
|
1787
|
+
}
|
|
1788
|
+
function buildContactPayload(message, name, email) {
|
|
1789
|
+
const lines = [
|
|
1790
|
+
name?.trim() || "",
|
|
1791
|
+
email?.trim() || "",
|
|
1792
|
+
message.trim()
|
|
1793
|
+
].filter(Boolean);
|
|
1794
|
+
return buildContactPrompt(lines.join("\n"));
|
|
1795
|
+
}
|
|
1796
|
+
async function contactSync(message, options) {
|
|
1797
|
+
try {
|
|
1798
|
+
const { response, tool_calls } = await fetchChat(
|
|
1799
|
+
buildContactPayload(message, options?.name, options?.email)
|
|
1800
|
+
);
|
|
1801
|
+
const toolResult = Array.isArray(tool_calls) && tool_calls.length > 0 ? String(tool_calls[0]?.result || "").trim() : "";
|
|
1802
|
+
const finalMessage = toolResult || response || "\u90AE\u4EF6\u5DF2\u53D1\u9001\u7ED9\u9EA6\u5F53\u3002";
|
|
1803
|
+
if (options?.json) {
|
|
1804
|
+
console.log(JSON.stringify({
|
|
1805
|
+
tool: "maidang",
|
|
1806
|
+
command: "contact",
|
|
1807
|
+
message,
|
|
1808
|
+
name: options?.name,
|
|
1809
|
+
email: options?.email,
|
|
1810
|
+
response,
|
|
1811
|
+
tool_calls,
|
|
1812
|
+
result: finalMessage
|
|
1813
|
+
}, null, 2));
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
console.log(finalMessage);
|
|
1817
|
+
} catch (error) {
|
|
1818
|
+
const messageText = error instanceof Error ? error.message : String(error);
|
|
1819
|
+
if (options?.json) {
|
|
1820
|
+
console.error(JSON.stringify({
|
|
1821
|
+
tool: "maidang",
|
|
1822
|
+
command: "contact",
|
|
1823
|
+
error: messageText
|
|
1824
|
+
}, null, 2));
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
console.error(chalk8.red(`Error: ${messageText}`));
|
|
1828
|
+
process.exit(1);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
var ContactApp = () => {
|
|
1832
|
+
const [input, setInput] = useState3("");
|
|
1833
|
+
const [cursorPos, setCursorPos] = useState3(0);
|
|
1834
|
+
const [hint, setHint] = useState3("\u586B\u5199\u79F0\u547C / \u90AE\u7BB1 / \u7559\u8A00\uFF0C\u53CC\u51FB Enter \u53D1\u9001");
|
|
1835
|
+
const [submitState, setSubmitState] = useState3({ type: "idle" });
|
|
1836
|
+
const lastEnterRef = useRef2(0);
|
|
1837
|
+
const sending = submitState.type === "sending";
|
|
1838
|
+
const visibleHint = useMemo(() => {
|
|
1839
|
+
if (submitState.type === "success") {
|
|
1840
|
+
return "\u5DF2\u53D1\u9001\uFF0CCtrl+C \u9000\u51FA";
|
|
1841
|
+
}
|
|
1842
|
+
if (submitState.type === "error") {
|
|
1843
|
+
return "\u53D1\u9001\u5931\u8D25\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u91CD\u8BD5";
|
|
1844
|
+
}
|
|
1845
|
+
return hint;
|
|
1846
|
+
}, [hint, submitState]);
|
|
1847
|
+
const send = async () => {
|
|
1848
|
+
const raw = input.trim();
|
|
1849
|
+
if (!raw || sending) {
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
setSubmitState({ type: "sending" });
|
|
1853
|
+
setHint("\u53D1\u9001\u4E2D...");
|
|
1854
|
+
try {
|
|
1855
|
+
const { response, tool_calls } = await fetchChat(buildContactPrompt(raw));
|
|
1856
|
+
const toolResult = Array.isArray(tool_calls) && tool_calls.length > 0 ? String(tool_calls[0]?.result || "").trim() : "";
|
|
1857
|
+
setSubmitState({
|
|
1858
|
+
type: "success",
|
|
1859
|
+
message: toolResult || response || "\u90AE\u4EF6\u5DF2\u53D1\u9001\u7ED9\u9EA6\u5F53\u3002"
|
|
1860
|
+
});
|
|
1861
|
+
} catch (error) {
|
|
1862
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1863
|
+
setSubmitState({ type: "error", message });
|
|
1864
|
+
}
|
|
1865
|
+
};
|
|
1866
|
+
useInput3((char, key) => {
|
|
1867
|
+
if (key.ctrl && char === "c") {
|
|
1868
|
+
process.exit(0);
|
|
1869
|
+
}
|
|
1870
|
+
if (submitState.type === "success") {
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (key.return) {
|
|
1874
|
+
const now = Date.now();
|
|
1875
|
+
if (now - lastEnterRef.current < DOUBLE_ENTER_WINDOW && input.trim()) {
|
|
1876
|
+
void send();
|
|
1877
|
+
lastEnterRef.current = 0;
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
const nextInput = `${input.slice(0, cursorPos)}
|
|
1881
|
+
${input.slice(cursorPos)}`;
|
|
1882
|
+
setInput(nextInput);
|
|
1883
|
+
setCursorPos(cursorPos + 1);
|
|
1884
|
+
setHint("\u518D\u6309\u4E00\u6B21 Enter \u53D1\u9001");
|
|
1885
|
+
lastEnterRef.current = now;
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
lastEnterRef.current = 0;
|
|
1889
|
+
if (key.backspace || key.delete) {
|
|
1890
|
+
if (cursorPos === 0) {
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1893
|
+
setInput(`${input.slice(0, cursorPos - 1)}${input.slice(cursorPos)}`);
|
|
1894
|
+
setCursorPos(cursorPos - 1);
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
if (key.leftArrow) {
|
|
1898
|
+
setCursorPos(Math.max(0, cursorPos - 1));
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
if (key.rightArrow) {
|
|
1902
|
+
setCursorPos(Math.min(input.length, cursorPos + 1));
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
if (key.upArrow || key.downArrow || key.tab || key.escape) {
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
if (!char) {
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1911
|
+
setInput(`${input.slice(0, cursorPos)}${char}${input.slice(cursorPos)}`);
|
|
1912
|
+
setCursorPos(cursorPos + char.length);
|
|
1913
|
+
setHint("\u586B\u5199\u79F0\u547C / \u90AE\u7BB1 / \u7559\u8A00\uFF0C\u53CC\u51FB Enter \u53D1\u9001");
|
|
1914
|
+
});
|
|
1915
|
+
const displayValue = input.slice(0, cursorPos) + (submitState.type === "success" ? "" : chalk8.inverse(" ")) + input.slice(cursorPos);
|
|
1916
|
+
return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { bold: true }, "\u8054\u7CFB\u9EA6\u5F53")), /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "\u8F93\u5165\u683C\u5F0F\u4E0D\u9650\uFF0C\u4F8B\u5982\uFF1A")), /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1, paddingLeft: 2, flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "\u963F\u660E"), /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "aming@example.com"), /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "\u4F60\u597D\uFF0C\u60F3\u548C\u4F60\u804A\u804A\u5408\u4F5C\u3002")), /* @__PURE__ */ React3.createElement(Box3, { borderStyle: "round", borderColor: submitState.type === "error" ? "red" : "cyan", paddingX: 1, paddingY: 0, marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { wrap: "wrap" }, displayValue || chalk8.dim("\u5728\u8FD9\u91CC\u8F93\u5165\u4F60\u7684\u7559\u8A00..."))), /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, visibleHint)), submitState.type === "sending" && /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "yellow" }, "\u53D1\u9001\u4E2D...")), submitState.type === "success" && /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "green" }, submitState.message)), submitState.type === "error" && /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: "red" }, submitState.message)));
|
|
1917
|
+
};
|
|
1918
|
+
function createContactCommand() {
|
|
1919
|
+
const cmd = new Command9("contact").description("\u7ED9\u9EA6\u5F53\u7559\u8A00").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("-m, --message <message>", "\u76F4\u63A5\u53D1\u9001\u7559\u8A00\uFF0C\u4E0D\u8FDB\u5165 TUI").option("--name <name>", "\u7559\u8A00\u4EBA\u79F0\u547C").option("--email <email>", "\u7559\u8A00\u4EBA\u90AE\u7BB1").action(async (opts) => {
|
|
1920
|
+
const data = { email: "borisdunk@sina.com", note: "\u53EF\u76F4\u63A5\u8FDB\u5165\u7559\u8A00\u6A21\u5F0F\uFF0C\u4E5F\u53EF\u4F7F\u7528 chat \u8054\u7CFB" };
|
|
1921
|
+
if (opts.json && !opts.message) {
|
|
1922
|
+
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
if (opts.message) {
|
|
1926
|
+
await contactSync(opts.message, {
|
|
1927
|
+
name: opts.name,
|
|
1928
|
+
email: opts.email,
|
|
1929
|
+
json: opts.json
|
|
1930
|
+
});
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
render3(/* @__PURE__ */ React3.createElement(ContactApp, null));
|
|
1934
|
+
});
|
|
1935
|
+
return cmd;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
// src/commands/whoami.ts
|
|
1939
|
+
import { Command as Command10 } from "commander";
|
|
1940
|
+
import chalk9 from "chalk";
|
|
1941
|
+
|
|
1942
|
+
// src/constants/profile.ts
|
|
1943
|
+
var INTRO_TEXT = "\u8FDE\u7EED\u5C31\u4E1A\u8005 / \u6587\u79D1\u8F6C\u7801 / \u5168\u6808 / \u72EC\u7ACB\u5F00\u53D1 / \u62FF\u94C1\u7231\u597D\u8005 / \u4E3E\u94C1 / \u98DE\u76D8 / ALL in AI";
|
|
1944
|
+
|
|
1945
|
+
// src/commands/whoami.ts
|
|
1946
|
+
function getStatus() {
|
|
1947
|
+
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
1948
|
+
const isWeekend = [0, 6].includes((/* @__PURE__ */ new Date()).getDay());
|
|
1949
|
+
if (isWeekend) return { status: "available", label: "\u5468\u672B\u53EF\u7EA6", description: "\u65F6\u95F4\u7075\u6D3B\uFF0C\u53EF\u4EE5\u804A\u804A" };
|
|
1950
|
+
if (hour < 9 || hour >= 22) return { status: "available", label: "\u7A7A\u95F2\u4E2D", description: "\u975E\u5DE5\u4F5C\u65F6\u95F4" };
|
|
1951
|
+
if (hour >= 19) return { status: "busy", label: "\u4E0B\u73ED\u4E86", description: "\u4F11\u606F\u4E2D\uFF0C\u770B\u5230\u4F1A\u56DE" };
|
|
1952
|
+
return { status: "working", label: "\u5DE5\u4F5C\u4E2D", description: "\u6B63\u5E38\u5DE5\u4F5C\u65F6\u6BB5" };
|
|
1953
|
+
}
|
|
1954
|
+
function hr(char = "\u2500", len = 40) {
|
|
1955
|
+
console.log(chalk9.dim(char.repeat(len)));
|
|
1956
|
+
}
|
|
1957
|
+
function createWhoAmICommand() {
|
|
1958
|
+
const cmd = new Command10("whoami").description("\u4E86\u89E3\u6211").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1959
|
+
const status = getStatus();
|
|
1960
|
+
const whoami = {
|
|
1961
|
+
tagline: INTRO_TEXT,
|
|
1962
|
+
location: "\u676D\u5DDE \xB7 EFC",
|
|
1963
|
+
status,
|
|
1964
|
+
links: [
|
|
1965
|
+
{ label: "Blog", url: "https://www.maidang.me" }
|
|
1966
|
+
],
|
|
1967
|
+
contact: "borisdunk@sina.com",
|
|
1968
|
+
website: "https://www.maidang.me",
|
|
1969
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1970
|
+
};
|
|
1971
|
+
if (opts.json) {
|
|
1972
|
+
console.log(JSON.stringify({ tool: "maidang", command: "whoami", data: whoami }, null, 2));
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
console.log("");
|
|
1976
|
+
console.log(chalk9.bold("\u6211\u662F \u9EA6\u5F53"));
|
|
1977
|
+
console.log("");
|
|
1978
|
+
console.log(" " + whoami.tagline);
|
|
1979
|
+
console.log("");
|
|
1980
|
+
hr();
|
|
1981
|
+
console.log("");
|
|
1982
|
+
console.log(` ${chalk9.cyan("\u{1F4CD}")} ${whoami.location}`);
|
|
1983
|
+
console.log(` ${chalk9.cyan("\u23F1")} ${whoami.status.label} \xB7 ${chalk9.dim(whoami.status.description)}`);
|
|
1984
|
+
console.log("");
|
|
1985
|
+
hr();
|
|
1986
|
+
console.log("");
|
|
1987
|
+
console.log(` Blog ${chalk9.blue.underline(whoami.website)}`);
|
|
1988
|
+
console.log(` Email ${chalk9.blue(whoami.contact)}`);
|
|
1989
|
+
console.log("");
|
|
1990
|
+
hr();
|
|
1991
|
+
console.log("");
|
|
1992
|
+
console.log(` ${chalk9.dim("\u60F3\u4E86\u89E3\u66F4\u591A\uFF1F")}`);
|
|
1993
|
+
console.log(` ${chalk9.dim("maidang career / posts / links / contact")}`);
|
|
1994
|
+
console.log("");
|
|
1995
|
+
});
|
|
1996
|
+
return cmd;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
2026
1999
|
// src/commands/chat.tsx
|
|
2000
|
+
import React4, { useState as useState4, useRef as useRef3, useEffect as useEffect3 } from "react";
|
|
2001
|
+
import { render as render4, Box as Box4, Text as Text4, useInput as useInput4 } from "ink";
|
|
2002
|
+
import { Command as Command11 } from "commander";
|
|
2003
|
+
import chalk10 from "chalk";
|
|
2027
2004
|
async function chatSync(message, json = false, sessionId) {
|
|
2028
2005
|
try {
|
|
2029
2006
|
const { thinking, response, sessionId: newSessionId, tool_calls } = await fetchChat(message, sessionId);
|
|
@@ -2032,7 +2009,7 @@ async function chatSync(message, json = false, sessionId) {
|
|
|
2032
2009
|
} else {
|
|
2033
2010
|
if (thinking) {
|
|
2034
2011
|
thinking.split("\n").forEach((line) => {
|
|
2035
|
-
console.log(`${
|
|
2012
|
+
console.log(`${chalk10.dim("\u{1F4AD}")} ${chalk10.dim(line)}`);
|
|
2036
2013
|
});
|
|
2037
2014
|
console.log();
|
|
2038
2015
|
}
|
|
@@ -2041,51 +2018,51 @@ async function chatSync(message, json = false, sessionId) {
|
|
|
2041
2018
|
const name = tc.call?.function?.name || tc.name || "unknown";
|
|
2042
2019
|
const args = tc.call?.function?.arguments || tc.arguments || "{}";
|
|
2043
2020
|
const result = tc.result || "";
|
|
2044
|
-
let content = `${
|
|
2021
|
+
let content = `${chalk10.yellow(name)} ${chalk10.gray(args)}`;
|
|
2045
2022
|
if (result) content += `
|
|
2046
|
-
${
|
|
2047
|
-
console.log(`${
|
|
2023
|
+
${chalk10.cyan(result)}`;
|
|
2024
|
+
console.log(`${chalk10.dim("\u26A1")} ${content}`);
|
|
2048
2025
|
});
|
|
2049
2026
|
console.log();
|
|
2050
2027
|
}
|
|
2051
2028
|
console.log(response);
|
|
2052
2029
|
if (newSessionId && newSessionId !== sessionId) {
|
|
2053
2030
|
console.log();
|
|
2054
|
-
console.log(
|
|
2055
|
-
console.log(
|
|
2031
|
+
console.log(chalk10.dim(`Session: ${chalk10.cyan(newSessionId)}`));
|
|
2032
|
+
console.log(chalk10.dim("\u4F7F\u7528 --session-id \u7EE7\u7EED\u5BF9\u8BDD"));
|
|
2056
2033
|
}
|
|
2057
2034
|
}
|
|
2058
2035
|
} catch (err) {
|
|
2059
2036
|
if (json) {
|
|
2060
2037
|
console.error(JSON.stringify({ tool: "maidang", command: "chat", error: err.message }, null, 2));
|
|
2061
2038
|
} else {
|
|
2062
|
-
console.error(
|
|
2039
|
+
console.error(chalk10.red(`Error: ${err.message}`));
|
|
2063
2040
|
process.exit(1);
|
|
2064
2041
|
}
|
|
2065
2042
|
}
|
|
2066
2043
|
}
|
|
2067
2044
|
var _id = 0;
|
|
2068
2045
|
var uid = () => ++_id;
|
|
2069
|
-
var ItemUser = ({ content }) => /* @__PURE__ */
|
|
2070
|
-
var ItemThinking = ({ content, expanded }) => /* @__PURE__ */
|
|
2071
|
-
var ItemLoading = () => /* @__PURE__ */
|
|
2072
|
-
var ItemTool = ({ content }) => /* @__PURE__ */
|
|
2073
|
-
var ItemContent = ({ content }) => /* @__PURE__ */
|
|
2074
|
-
var ItemError = ({ content }) => /* @__PURE__ */
|
|
2046
|
+
var ItemUser = ({ content }) => /* @__PURE__ */ React4.createElement(Box4, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Box4, { width: "100%", backgroundColor: "cyan", paddingX: 1, paddingY: 0 }, /* @__PURE__ */ React4.createElement(Text4, { color: "black", wrap: "wrap" }, content)));
|
|
2047
|
+
var ItemThinking = ({ content, expanded }) => /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column", width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, "\u601D\u8003"), expanded && /* @__PURE__ */ React4.createElement(Box4, { width: "100%", borderStyle: "round", borderColor: "gray", paddingX: 1, paddingY: 0, marginTop: 0 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true, wrap: "wrap" }, content)));
|
|
2048
|
+
var ItemLoading = () => /* @__PURE__ */ React4.createElement(Box4, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, "\u601D\u8003\u4E2D..."));
|
|
2049
|
+
var ItemTool = ({ content }) => /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column", width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: "yellow" }, "\u26A1"), /* @__PURE__ */ React4.createElement(Box4, { width: "100%", borderStyle: "round", borderColor: "yellow", paddingX: 1, paddingY: 0, marginTop: 0 }, /* @__PURE__ */ React4.createElement(Text4, { color: "yellow", wrap: "wrap" }, content)));
|
|
2050
|
+
var ItemContent = ({ content }) => /* @__PURE__ */ React4.createElement(Box4, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { wrap: "wrap" }, content));
|
|
2051
|
+
var ItemError = ({ content }) => /* @__PURE__ */ React4.createElement(Box4, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: "red" }, content));
|
|
2075
2052
|
var DOUBLE_PRESS_WINDOW = 1e3;
|
|
2076
2053
|
var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
2077
|
-
const [items, setItems] =
|
|
2078
|
-
const [input, setInput] =
|
|
2079
|
-
const [cursorPos, setCursorPos] =
|
|
2080
|
-
const [loading, setLoading] =
|
|
2081
|
-
const [hint, setHint] =
|
|
2082
|
-
const [sessionId, setSessionId] =
|
|
2083
|
-
const sessionIdRef =
|
|
2084
|
-
const [showThinking, setShowThinking] =
|
|
2085
|
-
const lastEscRef =
|
|
2086
|
-
const lastCtrlCRef =
|
|
2087
|
-
const bottomRef =
|
|
2088
|
-
const showThinkingRef =
|
|
2054
|
+
const [items, setItems] = useState4([]);
|
|
2055
|
+
const [input, setInput] = useState4("");
|
|
2056
|
+
const [cursorPos, setCursorPos] = useState4(0);
|
|
2057
|
+
const [loading, setLoading] = useState4(false);
|
|
2058
|
+
const [hint, setHint] = useState4("");
|
|
2059
|
+
const [sessionId, setSessionId] = useState4(void 0);
|
|
2060
|
+
const sessionIdRef = useRef3(void 0);
|
|
2061
|
+
const [showThinking, setShowThinking] = useState4(false);
|
|
2062
|
+
const lastEscRef = useRef3(0);
|
|
2063
|
+
const lastCtrlCRef = useRef3(0);
|
|
2064
|
+
const bottomRef = useRef3(null);
|
|
2065
|
+
const showThinkingRef = useRef3(false);
|
|
2089
2066
|
useEffect3(() => {
|
|
2090
2067
|
showThinkingRef.current = showThinking;
|
|
2091
2068
|
}, [showThinking]);
|
|
@@ -2138,7 +2115,7 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2138
2115
|
setLoading(false);
|
|
2139
2116
|
}
|
|
2140
2117
|
};
|
|
2141
|
-
|
|
2118
|
+
useInput4((char, key) => {
|
|
2142
2119
|
if (key.ctrl && char === "o") {
|
|
2143
2120
|
const hasThinking = items.some((i) => i.type === "thinking");
|
|
2144
2121
|
if (hasThinking) {
|
|
@@ -2224,27 +2201,27 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2224
2201
|
const cursorChar = input[cursorPos] ?? " ";
|
|
2225
2202
|
const after = input.slice(cursorPos + 1);
|
|
2226
2203
|
const fw = isFullWidth(cursorChar) ? 2 : 1;
|
|
2227
|
-
return /* @__PURE__ */
|
|
2204
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Text4, { color: "cyan" }, "> "), /* @__PURE__ */ React4.createElement(Text4, null, before), /* @__PURE__ */ React4.createElement(Text4, { backgroundColor: "gray", color: "black" }, cursorChar, fw === 2 ? " " : ""), /* @__PURE__ */ React4.createElement(Text4, null, after), loading && /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, " "));
|
|
2228
2205
|
};
|
|
2229
|
-
return /* @__PURE__ */
|
|
2206
|
+
return /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column", paddingX: 1, flexGrow: 1 }, /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column", flexGrow: 1 }, items.map((item) => {
|
|
2230
2207
|
switch (item.type) {
|
|
2231
2208
|
case "user":
|
|
2232
|
-
return /* @__PURE__ */
|
|
2209
|
+
return /* @__PURE__ */ React4.createElement(ItemUser, { key: item.id, content: item.content });
|
|
2233
2210
|
case "thinking":
|
|
2234
|
-
return /* @__PURE__ */
|
|
2211
|
+
return /* @__PURE__ */ React4.createElement(ItemThinking, { key: item.id, content: item.content, expanded: showThinking });
|
|
2235
2212
|
case "loading":
|
|
2236
|
-
return /* @__PURE__ */
|
|
2213
|
+
return /* @__PURE__ */ React4.createElement(ItemLoading, { key: item.id });
|
|
2237
2214
|
case "tool":
|
|
2238
|
-
return /* @__PURE__ */
|
|
2215
|
+
return /* @__PURE__ */ React4.createElement(ItemTool, { key: item.id, content: item.content });
|
|
2239
2216
|
case "content":
|
|
2240
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ React4.createElement(ItemContent, { key: item.id, content: item.content });
|
|
2241
2218
|
case "error":
|
|
2242
|
-
return /* @__PURE__ */
|
|
2219
|
+
return /* @__PURE__ */ React4.createElement(ItemError, { key: item.id, content: item.content });
|
|
2243
2220
|
}
|
|
2244
|
-
})), /* @__PURE__ */
|
|
2221
|
+
})), /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column", flexShrink: 0 }, /* @__PURE__ */ React4.createElement(Box4, { borderStyle: "single", borderColor: "gray", paddingX: 1 }, renderInputLine()), /* @__PURE__ */ React4.createElement(Box4, { paddingTop: 1 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, "Ctrl+C \u9000\u51FA \xB7 Enter \u53D1\u9001 \xB7 Esc Esc \u6E05\u7A7A\u8F93\u5165 \xB7 \u2190\u2192 \u79FB\u52A8\u5149\u6807")), hint && /* @__PURE__ */ React4.createElement(Box4, { paddingTop: 0 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true, color: "yellow" }, hint)), !loading && items.some((i) => i.type === "thinking") && !showThinking && /* @__PURE__ */ React4.createElement(Box4, { paddingTop: 0 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true, color: "cyan" }, "Ctrl+O \u67E5\u770B\u601D\u8003"))), /* @__PURE__ */ React4.createElement(Box4, { ref: bottomRef }));
|
|
2245
2222
|
};
|
|
2246
2223
|
function createChatCommand() {
|
|
2247
|
-
const cmd = new
|
|
2224
|
+
const cmd = new Command11("chat").description("\u548C\u9EA6\u5F53\u5BF9\u8BDD").option("-m, --message <text>", "\u76F4\u63A5\u53D1\u9001\u6D88\u606F\uFF08\u975E\u4EA4\u4E92\u6A21\u5F0F\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("--session-id <id>", "\u7EED\u63A5\u5DF2\u6709\u5BF9\u8BDD");
|
|
2248
2225
|
cmd.action(async (opts) => {
|
|
2249
2226
|
if (opts.json || opts.message) {
|
|
2250
2227
|
if (!opts.message) {
|
|
@@ -2258,7 +2235,7 @@ function createChatCommand() {
|
|
|
2258
2235
|
await chatSync(opts.message, !!opts.json, opts.sessionId);
|
|
2259
2236
|
return;
|
|
2260
2237
|
}
|
|
2261
|
-
|
|
2238
|
+
render4(/* @__PURE__ */ React4.createElement(ChatApp, { sessionId: opts.sessionId }));
|
|
2262
2239
|
});
|
|
2263
2240
|
return cmd;
|
|
2264
2241
|
}
|
|
@@ -2276,32 +2253,26 @@ function getAgeVersion() {
|
|
|
2276
2253
|
}
|
|
2277
2254
|
|
|
2278
2255
|
// src/index.ts
|
|
2279
|
-
var program = new
|
|
2256
|
+
var program = new Command12();
|
|
2280
2257
|
program.name("maidang").description("\u4E86\u89E3\u9EA6\u5F53 - \u4E00\u4E2A AI \u65F6\u4EE3\u7684\u63A2\u7D22\u8005").version(getAgeVersion(), "-v, --version", "\u663E\u793A\u7248\u672C\u53F7");
|
|
2281
2258
|
var careerCmd = createCareerCommand();
|
|
2282
2259
|
var catCmd = createCatCommand();
|
|
2283
|
-
var createCmd = createCreateCommand();
|
|
2284
2260
|
var postsCmd = createPostsCommand();
|
|
2285
2261
|
var songsCmd = createSongsCommand();
|
|
2286
2262
|
var linksCmd = createLinksCommand();
|
|
2287
2263
|
var projectsCmd = createProjectsCommand();
|
|
2288
2264
|
var toolsCmd = createToolsCommand();
|
|
2289
2265
|
var contactCmd = createContactCommand();
|
|
2290
|
-
var skillsCmd = createSkillsCommand();
|
|
2291
|
-
var statusCmd = createStatusCommand();
|
|
2292
2266
|
var whoamiCmd = createWhoAmICommand();
|
|
2293
2267
|
var chatCmd = createChatCommand();
|
|
2294
2268
|
program.addCommand(careerCmd);
|
|
2295
2269
|
program.addCommand(catCmd);
|
|
2296
|
-
program.addCommand(createCmd);
|
|
2297
2270
|
program.addCommand(postsCmd);
|
|
2298
2271
|
program.addCommand(songsCmd);
|
|
2299
2272
|
program.addCommand(linksCmd);
|
|
2300
2273
|
program.addCommand(projectsCmd);
|
|
2301
2274
|
program.addCommand(toolsCmd);
|
|
2302
2275
|
program.addCommand(contactCmd);
|
|
2303
|
-
program.addCommand(skillsCmd);
|
|
2304
|
-
program.addCommand(statusCmd);
|
|
2305
2276
|
program.addCommand(whoamiCmd);
|
|
2306
2277
|
program.addCommand(chatCmd);
|
|
2307
2278
|
if (!process.argv.slice(2).length) {
|