maidang 29.7.20 → 29.7.21
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 +237 -526
- package/dist/index.js.map +4 -4
- package/package.json +8 -9
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 Command14 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/home.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -51,6 +51,7 @@ var commands = [
|
|
|
51
51
|
{ name: "projects", desc: "\u4E00\u4E9B\u5DF2\u7ECF\u843D\u5730\u7684\u4E1C\u897F" },
|
|
52
52
|
{ name: "posts", desc: "\u6700\u8FD1\u5728\u5199\u3001\u5728\u60F3\u7684" },
|
|
53
53
|
{ name: "tools", desc: "\u6700\u8FD1\u5728\u7528\u7684\u597D\u7269" },
|
|
54
|
+
{ name: "skills", desc: "\u53EF\u5206\u4EAB\u7684 Agent Skills" },
|
|
54
55
|
{ name: "songs", desc: "\u5E74\u5EA6\u6B4C\u5355" },
|
|
55
56
|
{ name: "links", desc: "\u793E\u4EA4\u4E0E\u5916\u94FE" },
|
|
56
57
|
{ name: "cat", desc: "\u9EA6\u9EA6" },
|
|
@@ -277,207 +278,82 @@ function createCatCommand() {
|
|
|
277
278
|
return cmd;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
// src/commands/posts.
|
|
281
|
-
import React, { useState, useEffect } from "react";
|
|
282
|
-
import { render, Box, Text, useInput } from "ink";
|
|
281
|
+
// src/commands/posts.ts
|
|
283
282
|
import { Command as Command4 } from "commander";
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
} else if (key.downArrow) {
|
|
293
|
-
onSelect(Math.min(posts.length - 1, selectedIndex + 1));
|
|
294
|
-
} else if (key.return) {
|
|
295
|
-
onEnter();
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React.createElement(Box, { marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: "cyan" }, "\u{1F426} \u63A8\u6587\u5217\u8868"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " \xB7 ", posts.length, " \u6761")), /* @__PURE__ */ React.createElement(Text, { dimColor: true, marginBottom: 1 }, "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u67E5\u770B\u8BE6\u60C5 \xB7 q \u9000\u51FA"), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 0, paddingY: 0 }, posts.map((post, index) => {
|
|
299
|
-
const isSelected = selectedIndex === index;
|
|
300
|
-
const num = String(index + 1).padStart(2, " ");
|
|
301
|
-
const title = post.title || post.summary?.substring(0, 40) || post.content.substring(0, 40);
|
|
302
|
-
const meta = [post.date, post.time].filter(Boolean).join(" ");
|
|
303
|
-
return /* @__PURE__ */ React.createElement(
|
|
304
|
-
Box,
|
|
305
|
-
{
|
|
306
|
-
key: post.slug,
|
|
307
|
-
paddingX: 1,
|
|
308
|
-
paddingY: 0,
|
|
309
|
-
marginY: 0,
|
|
310
|
-
borderStyle: "single",
|
|
311
|
-
borderColor: isSelected ? "cyan" : "gray"
|
|
312
|
-
},
|
|
313
|
-
/* @__PURE__ */ React.createElement(Text, { dimColor: true }, num),
|
|
314
|
-
/* @__PURE__ */ React.createElement(Text, { dimColor: true }, " \u2502 "),
|
|
315
|
-
/* @__PURE__ */ React.createElement(Box, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: isSelected, color: isSelected ? "cyan" : void 0 }, title), meta && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, meta)),
|
|
316
|
-
isSelected && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " \u2190")
|
|
317
|
-
);
|
|
318
|
-
})));
|
|
319
|
-
};
|
|
320
|
-
var DetailView = ({ post, onBack, onQuit, onPrev, onNext, hasPrev, hasNext }) => {
|
|
321
|
-
useInput((input, key) => {
|
|
322
|
-
if (input === "q" || input === "Q") {
|
|
323
|
-
onQuit();
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
if (key.escape || input === "b" || input === "B") {
|
|
327
|
-
onBack();
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
if (key.leftArrow && hasPrev) {
|
|
331
|
-
onPrev();
|
|
332
|
-
} else if (key.rightArrow && hasNext) {
|
|
333
|
-
onNext();
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
const paragraphs = post.content.split("\n").reduce((acc, line) => {
|
|
337
|
-
if (line.trim() === "") {
|
|
338
|
-
acc.push([]);
|
|
339
|
-
} else {
|
|
340
|
-
if (acc.length === 0 || acc[acc.length - 1].length === 0) {
|
|
341
|
-
acc.push([line]);
|
|
342
|
-
} else {
|
|
343
|
-
acc[acc.length - 1].push(line);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return acc;
|
|
347
|
-
}, []).filter((p) => p.length > 0);
|
|
348
|
-
const tags = post.tags || [];
|
|
349
|
-
const meta = [post.date, post.time].filter(Boolean).join(" ");
|
|
350
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1, flexShrink: 0 }, /* @__PURE__ */ React.createElement(Box, { marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: "cyan" }, "\u{1F4C4} \u63A8\u6587\u8BE6\u60C5"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " \xB7 Esc/q \u8FD4\u56DE \xB7 \u2190\u2192 \u5207\u6362")), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", paddingX: 1, marginBottom: 0, flexShrink: 0 }, /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Text, { bold: true, color: "white" }, post.author || "\u9EA6\u5F53"), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " ", post.handle || "@maidang"), meta && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " \xB7 ", meta)), post.title && /* @__PURE__ */ React.createElement(Text, { bold: true, color: "cyan" }, post.title)), /* @__PURE__ */ React.createElement(
|
|
351
|
-
Box,
|
|
352
|
-
{
|
|
353
|
-
flexDirection: "column",
|
|
354
|
-
borderStyle: "single",
|
|
355
|
-
borderColor: "gray",
|
|
356
|
-
paddingX: 1,
|
|
357
|
-
marginY: 0,
|
|
358
|
-
flexShrink: 1,
|
|
359
|
-
overflow: "hidden"
|
|
360
|
-
},
|
|
361
|
-
paragraphs.map((para, pi) => /* @__PURE__ */ React.createElement(Box, { key: pi, flexDirection: "column", marginBottom: pi < paragraphs.length - 1 ? 1 : 0, flexShrink: 0 }, para.map((line, li) => /* @__PURE__ */ React.createElement(Text, { key: li, wrap: "wrap" }, line))))
|
|
362
|
-
), tags.length > 0 && /* @__PURE__ */ React.createElement(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1, marginY: 0, flexShrink: 0 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, tags.map((tag) => /* @__PURE__ */ React.createElement(Text, { key: tag, color: "cyan" }, "#", tag, " ")))), /* @__PURE__ */ React.createElement(Box, { marginTop: 1, flexShrink: 0 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u2190 ", hasPrev ? "\u4E0A\u4E00\u7BC7" : "\u65E0", "\u3000\u3000\u2192 ", hasNext ? "\u4E0B\u4E00\u7BC7" : "\u65E0", "\u3000\u3000Esc \u8FD4\u56DE")));
|
|
363
|
-
};
|
|
364
|
-
var PostsApp = ({ apiUrl }) => {
|
|
365
|
-
const [posts, setPosts] = useState([]);
|
|
366
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
367
|
-
const [view, setView] = useState("LIST");
|
|
368
|
-
const [loading, setLoading] = useState(true);
|
|
369
|
-
const [error, setError] = useState(null);
|
|
370
|
-
useEffect(() => {
|
|
371
|
-
fetch(apiUrl).then(async (res) => {
|
|
372
|
-
if (!res.ok) throw new Error(await readApiMessage(res));
|
|
373
|
-
return readApiData(res);
|
|
374
|
-
}).then((data) => {
|
|
375
|
-
setPosts(data);
|
|
376
|
-
setLoading(false);
|
|
377
|
-
}).catch((err) => {
|
|
378
|
-
setError(err.message);
|
|
379
|
-
setLoading(false);
|
|
380
|
-
});
|
|
381
|
-
}, [apiUrl]);
|
|
382
|
-
const handleQuit = () => {
|
|
383
|
-
process.exit(0);
|
|
384
|
-
};
|
|
385
|
-
const handleEnter = () => {
|
|
386
|
-
setView("DETAIL");
|
|
387
|
-
};
|
|
388
|
-
const handleBack = () => {
|
|
389
|
-
setView("LIST");
|
|
390
|
-
};
|
|
391
|
-
const handlePrev = () => {
|
|
392
|
-
setSelectedIndex((i) => Math.max(0, i - 1));
|
|
393
|
-
};
|
|
394
|
-
const handleNext = () => {
|
|
395
|
-
setSelectedIndex((i) => Math.min(posts.length - 1, i + 1));
|
|
396
|
-
};
|
|
397
|
-
if (loading) {
|
|
398
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u52A0\u8F7D\u4E2D..."));
|
|
399
|
-
}
|
|
400
|
-
if (error) {
|
|
401
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, "\u52A0\u8F7D\u5931\u8D25: ", error), /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216API\u5730\u5740"));
|
|
402
|
-
}
|
|
403
|
-
if (posts.length === 0) {
|
|
404
|
-
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "yellow" }, "\u6682\u65E0\u63A8\u6587"));
|
|
283
|
+
|
|
284
|
+
// src/utils/pagination.ts
|
|
285
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
286
|
+
function parseCliPagination(value, name, fallback) {
|
|
287
|
+
if (value === void 0) return fallback;
|
|
288
|
+
const parsed = Number(value);
|
|
289
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
290
|
+
throw new Error(`${name} must be a positive integer`);
|
|
405
291
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
onQuit: handleQuit,
|
|
413
|
-
onPrev: handlePrev,
|
|
414
|
-
onNext: handleNext,
|
|
415
|
-
hasPrev: selectedIndex > 0,
|
|
416
|
-
hasNext: selectedIndex < posts.length - 1
|
|
417
|
-
}
|
|
418
|
-
);
|
|
292
|
+
return parsed;
|
|
293
|
+
}
|
|
294
|
+
function buildPaginationUrl(baseUrl, options, extra = {}) {
|
|
295
|
+
const url = new URL(baseUrl);
|
|
296
|
+
for (const [key, value] of Object.entries(extra)) {
|
|
297
|
+
url.searchParams.set(key, value);
|
|
419
298
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
onEnter: handleEnter,
|
|
427
|
-
onQuit: handleQuit
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
};
|
|
299
|
+
url.searchParams.set("page", String(parseCliPagination(options.page, "page", 1)));
|
|
300
|
+
url.searchParams.set("pageSize", String(parseCliPagination(options.pageSize, "pageSize", DEFAULT_PAGE_SIZE)));
|
|
301
|
+
return url.toString();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// src/commands/posts.ts
|
|
431
305
|
function createPostsCommand() {
|
|
432
306
|
const baseApiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
cmd.action((opts) => {
|
|
436
|
-
const wantsJson = opts.json;
|
|
307
|
+
const cmd = new Command4("posts").description("\u52A8\u6001\u5217\u8868\uFF0C\u9ED8\u8BA4\u6BCF\u9875 10 \u6761\uFF08--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("-s, --slug <slug>", "\u6309 slug \u83B7\u53D6\u5355\u7BC7\u6587\u7AE0/\u52A8\u6001").option("--page <page>", "\u9875\u7801\uFF0C\u4ECE 1 \u5F00\u59CB", "1").option("--page-size <size>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 10", "10");
|
|
308
|
+
cmd.action(async (opts) => {
|
|
437
309
|
const slug = opts.slug?.trim();
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
if (!
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}).then((data) => {
|
|
446
|
-
if (wantsJson) {
|
|
447
|
-
console.log(JSON.stringify({ tool: "maidang", command: "posts", slug, data }, null, 2));
|
|
310
|
+
try {
|
|
311
|
+
if (slug) {
|
|
312
|
+
const response2 = await fetch(`${baseApiUrl}/api/posts/${encodeURIComponent(slug)}`);
|
|
313
|
+
if (!response2.ok) throw new Error(await readApiMessage(response2));
|
|
314
|
+
const data2 = await readApiData(response2);
|
|
315
|
+
if (opts.json) {
|
|
316
|
+
console.log(JSON.stringify({ tool: "maidang", command: "posts", slug, data: data2 }, null, 2));
|
|
448
317
|
return;
|
|
449
318
|
}
|
|
450
319
|
console.log("");
|
|
451
|
-
console.log(
|
|
320
|
+
console.log(data2.title || data2.slug);
|
|
452
321
|
console.log("");
|
|
453
|
-
console.log(
|
|
322
|
+
console.log(data2.content);
|
|
454
323
|
console.log("");
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const response = await fetch(buildPaginationUrl(`${baseApiUrl}/api/social-posts`, opts, { type: "social" }));
|
|
327
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
328
|
+
const data = await readApiData(response);
|
|
329
|
+
if (opts.json) {
|
|
330
|
+
console.log(JSON.stringify({ tool: "maidang", command: "posts", data }, null, 2));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
console.log("");
|
|
334
|
+
console.log(" " + eyebrow("posts"));
|
|
335
|
+
console.log(" " + theme.ink(`\u7B2C ${data.pagination.page}/${data.pagination.totalPages || 1} \u9875 \xB7 \u5171 ${data.pagination.total} \u6761`));
|
|
336
|
+
console.log("");
|
|
337
|
+
console.log(" " + hairline());
|
|
338
|
+
console.log("");
|
|
339
|
+
data.items.forEach((post, index) => {
|
|
340
|
+
const title = post.title || post.summary || post.content.split("\n")[0] || post.slug;
|
|
341
|
+
const meta = [post.date, post.time].filter(Boolean).join(" ");
|
|
342
|
+
console.log(` ${theme.inkMuted(String((data.pagination.page - 1) * data.pagination.pageSize + index + 1).padStart(2, "0"))} ${theme.inkBody(title)}`);
|
|
343
|
+
if (meta) console.log(` ${theme.inkMuted(meta)}`);
|
|
344
|
+
console.log(` ${theme.inkSoft(post.slug)}`);
|
|
345
|
+
if (index < data.items.length - 1) console.log("");
|
|
470
346
|
});
|
|
471
|
-
|
|
347
|
+
console.log("");
|
|
348
|
+
} catch (error) {
|
|
349
|
+
console.error(theme.err(`\u83B7\u53D6\u52A8\u6001\u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
350
|
+
process.exit(1);
|
|
472
351
|
}
|
|
473
|
-
render(/* @__PURE__ */ React.createElement(PostsApp, { apiUrl }));
|
|
474
352
|
});
|
|
475
353
|
return cmd;
|
|
476
354
|
}
|
|
477
355
|
|
|
478
|
-
// src/commands/songs.
|
|
479
|
-
import React2, { useState as useState2, useRef } from "react";
|
|
480
|
-
import { render as render2, Box as Box2, Text as Text2, useInput as useInput2 } from "ink";
|
|
356
|
+
// src/commands/songs.ts
|
|
481
357
|
import { Command as Command5 } from "commander";
|
|
482
358
|
|
|
483
359
|
// src/data/songs.json
|
|
@@ -1367,203 +1243,70 @@ function copyToClipboard(text) {
|
|
|
1367
1243
|
execSync(`printf '${text.replace(/'/g, "'\\''")}' | pbcopy`, { stdio: "ignore" });
|
|
1368
1244
|
}
|
|
1369
1245
|
|
|
1370
|
-
// src/commands/songs.
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1373
|
-
var
|
|
1246
|
+
// src/commands/songs.ts
|
|
1247
|
+
var allYears = songs_default.data;
|
|
1248
|
+
var availableYears = songs_default.years;
|
|
1249
|
+
var allMeta = songs_default.meta;
|
|
1374
1250
|
function formatDuration(ms) {
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1377
|
-
const sec = s % 60;
|
|
1378
|
-
return `${m}:${sec.toString().padStart(2, "0")}`;
|
|
1251
|
+
const seconds = Math.round(ms / 1e3);
|
|
1252
|
+
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
1379
1253
|
}
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
const meta = ALL_META.find((m) => m.year === entry.year);
|
|
1397
|
-
const preview = entry.songs[0] ? `${entry.songs[0].artists[0] || ""} \xB7 ${entry.songs[0].name}` : "";
|
|
1398
|
-
return /* @__PURE__ */ React2.createElement(
|
|
1399
|
-
Box2,
|
|
1400
|
-
{
|
|
1401
|
-
key: entry.year,
|
|
1402
|
-
paddingX: 1,
|
|
1403
|
-
paddingY: 0,
|
|
1404
|
-
marginY: 0,
|
|
1405
|
-
borderStyle: "single",
|
|
1406
|
-
borderColor: isSelected ? "cyan" : "gray"
|
|
1407
|
-
},
|
|
1408
|
-
/* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, entry.year),
|
|
1409
|
-
/* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, " \u2502 "),
|
|
1410
|
-
/* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React2.createElement(Text2, { bold: isSelected, color: isSelected ? "cyan" : void 0 }, entry.year, " \u5E74\u5EA6\u6B4C\u5355"), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, meta?.trackCount || entry.songs.length, " \u9996 ", preview ? `\xB7 ${preview}` : "")),
|
|
1411
|
-
isSelected && /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, " \u2190")
|
|
1412
|
-
);
|
|
1413
|
-
})));
|
|
1414
|
-
};
|
|
1415
|
-
var SongList = ({ entry, selectedIndex, onSelect, onEnter, onBack, onQuit }) => {
|
|
1416
|
-
useInput2((input, key) => {
|
|
1417
|
-
if (input === "q" || input === "Q") {
|
|
1418
|
-
onQuit();
|
|
1419
|
-
return;
|
|
1420
|
-
}
|
|
1421
|
-
if (key.escape || input === "b" || input === "B") {
|
|
1422
|
-
onBack();
|
|
1423
|
-
return;
|
|
1424
|
-
}
|
|
1425
|
-
if (key.upArrow) {
|
|
1426
|
-
onSelect(Math.max(0, selectedIndex - 1));
|
|
1427
|
-
} else if (key.downArrow) {
|
|
1428
|
-
onSelect(Math.min(entry.songs.length - 1, selectedIndex + 1));
|
|
1429
|
-
} else if (key.return) {
|
|
1430
|
-
onEnter();
|
|
1431
|
-
}
|
|
1432
|
-
});
|
|
1433
|
-
return /* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", paddingX: 2, paddingY: 1 }, /* @__PURE__ */ React2.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React2.createElement(Text2, { bold: true, color: "cyan" }, "\u{1F3B5} ", entry.year, " \u5E74\u5EA6\u6B4C\u5355"), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, " \xB7 ", entry.songs.length, " \u9996 \xB7 Esc \u8FD4\u56DE")), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true, marginBottom: 1 }, "\u2191\u2193 \u9009\u62E9 \xB7 Enter \u67E5\u770B\u8BE6\u60C5 \xB7 q \u9000\u51FA"), /* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 0, paddingY: 0 }, entry.songs.map((song, index) => {
|
|
1434
|
-
const isSelected = selectedIndex === index;
|
|
1435
|
-
const num = String(index + 1).padStart(2, " ");
|
|
1436
|
-
const artists = song.artists.join(", ");
|
|
1437
|
-
const dur = formatDuration(song.duration);
|
|
1438
|
-
return /* @__PURE__ */ React2.createElement(
|
|
1439
|
-
Box2,
|
|
1440
|
-
{
|
|
1441
|
-
key: song.id,
|
|
1442
|
-
paddingX: 1,
|
|
1443
|
-
paddingY: 0,
|
|
1444
|
-
marginY: 0,
|
|
1445
|
-
borderStyle: "single",
|
|
1446
|
-
borderColor: isSelected ? "cyan" : "gray"
|
|
1447
|
-
},
|
|
1448
|
-
/* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, num),
|
|
1449
|
-
/* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, " \u2502 "),
|
|
1450
|
-
/* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React2.createElement(Text2, { bold: isSelected, color: isSelected ? "cyan" : void 0 }, song.name), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, artists, " \xB7 ", dur)),
|
|
1451
|
-
isSelected && /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, " \u2190")
|
|
1452
|
-
);
|
|
1453
|
-
})));
|
|
1454
|
-
};
|
|
1455
|
-
var SongDetail = ({ song, year, onBack, onQuit, onPrev, onNext, hasPrev, hasNext }) => {
|
|
1456
|
-
const [copied, setCopied] = useState2(false);
|
|
1457
|
-
const timerRef = useRef(null);
|
|
1458
|
-
useInput2((input, key) => {
|
|
1459
|
-
if (input === "q" || input === "Q") {
|
|
1460
|
-
onQuit();
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
if (key.escape || input === "b" || input === "B") {
|
|
1464
|
-
onBack();
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
if (key.return) {
|
|
1468
|
-
copyToClipboard(song.name);
|
|
1469
|
-
setCopied(true);
|
|
1470
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
1471
|
-
timerRef.current = setTimeout(() => setCopied(false), 1500);
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1474
|
-
if (key.leftArrow && hasPrev) {
|
|
1475
|
-
onPrev();
|
|
1476
|
-
} else if (key.rightArrow && hasNext) {
|
|
1477
|
-
onNext();
|
|
1254
|
+
function printSong(song, index) {
|
|
1255
|
+
console.log(`${String(index + 1).padStart(2, "0")} ${song.name}`);
|
|
1256
|
+
console.log(` ${song.artists.join(", ")} \xB7 ${formatDuration(song.duration)} \xB7 ${song.album}`);
|
|
1257
|
+
}
|
|
1258
|
+
function createSongsCommand() {
|
|
1259
|
+
return new Command5("songs").description(`\u5E74\u5EA6\u6B4C\u5355\uFF0C\u652F\u6301: ${availableYears.join(", ")}\uFF08--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09`).option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("--year <year>", "\u8F93\u51FA\u6307\u5B9A\u5E74\u4EFD\u7684\u6B4C\u66F2\u5217\u8868").option("--copy <song-id>", "\u590D\u5236\u6307\u5B9A\u6B4C\u66F2\u540D\u79F0").action((opts) => {
|
|
1260
|
+
const year = opts.year ? Number(opts.year) : void 0;
|
|
1261
|
+
const entry = year === void 0 ? void 0 : allYears.find((item) => item.year === year);
|
|
1262
|
+
if (year !== void 0 && !entry) {
|
|
1263
|
+
const message = `\u6CA1\u6709 ${year} \u5E74\u7684\u6B4C\u5355`;
|
|
1264
|
+
if (opts.json) {
|
|
1265
|
+
console.error(JSON.stringify({ tool: "maidang", command: "songs", error: message }, null, 2));
|
|
1266
|
+
} else {
|
|
1267
|
+
console.error(message);
|
|
1268
|
+
}
|
|
1269
|
+
process.exit(1);
|
|
1478
1270
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
const [selectedSongIndex, setSelectedSongIndex] = useState2(0);
|
|
1485
|
-
const [view, setView] = useState2("YEAR_PICK");
|
|
1486
|
-
const handleQuit = () => process.exit(0);
|
|
1487
|
-
const currentEntry = ALL_YEARS[selectedYearIndex];
|
|
1488
|
-
if (view === "SONG_DETAIL") {
|
|
1489
|
-
const song = currentEntry.songs[selectedSongIndex];
|
|
1490
|
-
if (!song) return null;
|
|
1491
|
-
return /* @__PURE__ */ React2.createElement(
|
|
1492
|
-
SongDetail,
|
|
1493
|
-
{
|
|
1494
|
-
song,
|
|
1495
|
-
year: currentEntry.year,
|
|
1496
|
-
onBack: () => setView("SONG_LIST"),
|
|
1497
|
-
onQuit: handleQuit,
|
|
1498
|
-
onPrev: () => setSelectedSongIndex((i) => Math.max(0, i - 1)),
|
|
1499
|
-
onNext: () => setSelectedSongIndex((i) => Math.min(currentEntry.songs.length - 1, i + 1)),
|
|
1500
|
-
hasPrev: selectedSongIndex > 0,
|
|
1501
|
-
hasNext: selectedSongIndex < currentEntry.songs.length - 1
|
|
1271
|
+
if (opts.copy) {
|
|
1272
|
+
const song = allYears.flatMap((item) => item.songs).find((item) => item.id === opts.copy);
|
|
1273
|
+
if (!song) {
|
|
1274
|
+
console.error(`\u6CA1\u6709\u627E\u5230\u6B4C\u66F2 ${opts.copy}`);
|
|
1275
|
+
process.exit(1);
|
|
1502
1276
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
{
|
|
1509
|
-
entry: currentEntry,
|
|
1510
|
-
selectedIndex: selectedSongIndex,
|
|
1511
|
-
onSelect: setSelectedSongIndex,
|
|
1512
|
-
onEnter: () => setView("SONG_DETAIL"),
|
|
1513
|
-
onBack: () => {
|
|
1514
|
-
setSelectedSongIndex(0);
|
|
1515
|
-
setView("YEAR_PICK");
|
|
1516
|
-
},
|
|
1517
|
-
onQuit: handleQuit
|
|
1277
|
+
copyToClipboard(song.name);
|
|
1278
|
+
if (opts.json) {
|
|
1279
|
+
console.log(JSON.stringify({ tool: "maidang", command: "songs", copied: song.name, data: song }, null, 2));
|
|
1280
|
+
} else {
|
|
1281
|
+
console.log(`\u5DF2\u590D\u5236\uFF1A${song.name}`);
|
|
1518
1282
|
}
|
|
1519
|
-
|
|
1520
|
-
}
|
|
1521
|
-
return /* @__PURE__ */ React2.createElement(
|
|
1522
|
-
YearPicker,
|
|
1523
|
-
{
|
|
1524
|
-
selectedIndex: selectedYearIndex,
|
|
1525
|
-
onSelect: (i) => {
|
|
1526
|
-
setSelectedYearIndex(i);
|
|
1527
|
-
setSelectedSongIndex(0);
|
|
1528
|
-
},
|
|
1529
|
-
onConfirm: () => {
|
|
1530
|
-
setSelectedSongIndex(0);
|
|
1531
|
-
setView("SONG_LIST");
|
|
1532
|
-
},
|
|
1533
|
-
onQuit: handleQuit
|
|
1283
|
+
return;
|
|
1534
1284
|
}
|
|
1535
|
-
);
|
|
1536
|
-
};
|
|
1537
|
-
function createSongsCommand() {
|
|
1538
|
-
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`);
|
|
1539
|
-
cmd.action((opts) => {
|
|
1540
1285
|
if (opts.json) {
|
|
1541
|
-
if (
|
|
1542
|
-
const
|
|
1543
|
-
const entry = ALL_YEARS.find((e) => e.year === year);
|
|
1544
|
-
if (!entry) {
|
|
1545
|
-
console.error(`\u6CA1\u6709 ${year} \u5E74\u7684\u6B4C\u5355`);
|
|
1546
|
-
process.exit(1);
|
|
1547
|
-
}
|
|
1548
|
-
const meta = ALL_META.find((m) => m.year === year);
|
|
1286
|
+
if (entry) {
|
|
1287
|
+
const meta = allMeta.find((item) => item.year === entry.year);
|
|
1549
1288
|
console.log(JSON.stringify({ tool: "maidang", command: "songs", meta, data: entry.songs }, null, 2));
|
|
1550
1289
|
} else {
|
|
1551
|
-
console.log(JSON.stringify({ tool: "maidang", command: "songs", years:
|
|
1290
|
+
console.log(JSON.stringify({ tool: "maidang", command: "songs", years: availableYears, meta: allMeta, data: allYears }, null, 2));
|
|
1552
1291
|
}
|
|
1553
1292
|
return;
|
|
1554
1293
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1294
|
+
if (entry) {
|
|
1295
|
+
console.log(`
|
|
1296
|
+
${entry.year} \u5E74\u5EA6\u6B4C\u5355 \xB7 ${entry.songs.length} \u9996
|
|
1297
|
+
`);
|
|
1298
|
+
entry.songs.forEach(printSong);
|
|
1299
|
+
console.log("");
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
console.log("\n\u5E74\u5EA6\u6B4C\u5355\n");
|
|
1303
|
+
for (const item of allYears) {
|
|
1304
|
+
const meta = allMeta.find((candidate) => candidate.year === item.year);
|
|
1305
|
+
const preview = item.songs[0] ? ` \xB7 ${item.songs[0].name}` : "";
|
|
1306
|
+
console.log(`${item.year} ${meta?.trackCount || item.songs.length} \u9996${preview}`);
|
|
1563
1307
|
}
|
|
1564
|
-
|
|
1308
|
+
console.log("\n\u67E5\u770B\u67D0\u5E74\uFF1Anpx maidang songs --year <year>\n");
|
|
1565
1309
|
});
|
|
1566
|
-
return cmd;
|
|
1567
1310
|
}
|
|
1568
1311
|
|
|
1569
1312
|
// src/commands/links.ts
|
|
@@ -1605,41 +1348,36 @@ function createLinksCommand() {
|
|
|
1605
1348
|
// src/commands/projects.ts
|
|
1606
1349
|
import { Command as Command7 } from "commander";
|
|
1607
1350
|
function createProjectsCommand() {
|
|
1608
|
-
|
|
1351
|
+
return new Command7("projects").description("\u9879\u76EE\u5217\u8868\uFF0C\u9ED8\u8BA4\u6BCF\u9875 10 \u6761\uFF08--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("--page <page>", "\u9875\u7801\uFF0C\u4ECE 1 \u5F00\u59CB", "1").option("--page-size <size>", "\u6BCF\u9875\u6761\u6570\uFF0C\u9ED8\u8BA4 10", "10").action(async (opts) => {
|
|
1609
1352
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1610
1353
|
try {
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1354
|
+
const response = await fetch(buildPaginationUrl(`${apiUrl}/api/projects`, opts));
|
|
1355
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
1356
|
+
const data = await readApiData(response);
|
|
1614
1357
|
if (opts.json) {
|
|
1615
|
-
console.log(JSON.stringify({ tool: "maidang", command: "projects", data
|
|
1358
|
+
console.log(JSON.stringify({ tool: "maidang", command: "projects", data }, null, 2));
|
|
1616
1359
|
return;
|
|
1617
1360
|
}
|
|
1618
1361
|
console.log("");
|
|
1619
1362
|
console.log(" " + eyebrow("projects"));
|
|
1620
|
-
console.log(" " + theme.ink(
|
|
1363
|
+
console.log(" " + theme.ink(`\u7B2C ${data.pagination.page}/${data.pagination.totalPages || 1} \u9875 \xB7 \u5171 ${data.pagination.total} \u4E2A\u9879\u76EE`));
|
|
1621
1364
|
console.log("");
|
|
1622
1365
|
console.log(" " + hairline());
|
|
1623
1366
|
console.log("");
|
|
1624
|
-
|
|
1625
|
-
const num = theme.inkMuted(String(
|
|
1367
|
+
data.items.forEach((project, index) => {
|
|
1368
|
+
const num = theme.inkMuted(String((data.pagination.page - 1) * data.pagination.pageSize + index + 1).padStart(2, "0"));
|
|
1626
1369
|
const cat = theme.inkMuted(`\xB7 ${project.category}`);
|
|
1627
1370
|
console.log(` ${num} ${theme.inkBody(project.name)} ${cat}`);
|
|
1628
1371
|
console.log(` ${theme.inkSoft(project.description)}`);
|
|
1629
|
-
if (project.url) {
|
|
1630
|
-
|
|
1631
|
-
}
|
|
1632
|
-
if (idx < projects.length - 1) {
|
|
1633
|
-
console.log("");
|
|
1634
|
-
}
|
|
1372
|
+
if (project.url) console.log(` ${theme.linkUnderline(project.url)}`);
|
|
1373
|
+
if (index < data.items.length - 1) console.log("");
|
|
1635
1374
|
});
|
|
1636
1375
|
console.log("");
|
|
1637
|
-
} catch (
|
|
1638
|
-
console.error(theme.err(`\u83B7\u53D6\u9879\u76EE\u5931\u8D25: ${
|
|
1376
|
+
} catch (error) {
|
|
1377
|
+
console.error(theme.err(`\u83B7\u53D6\u9879\u76EE\u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
1639
1378
|
process.exit(1);
|
|
1640
1379
|
}
|
|
1641
1380
|
});
|
|
1642
|
-
return cmd;
|
|
1643
1381
|
}
|
|
1644
1382
|
|
|
1645
1383
|
// src/commands/tools.ts
|
|
@@ -1691,10 +1429,62 @@ function createToolsCommand() {
|
|
|
1691
1429
|
return cmd;
|
|
1692
1430
|
}
|
|
1693
1431
|
|
|
1694
|
-
// src/commands/
|
|
1695
|
-
import React3, { useRef as useRef2, useState as useState3 } from "react";
|
|
1696
|
-
import { render as render3, Box as Box3, Text as Text3, useInput as useInput3 } from "ink";
|
|
1432
|
+
// src/commands/skills.ts
|
|
1697
1433
|
import { Command as Command9 } from "commander";
|
|
1434
|
+
function createSkillsCommand() {
|
|
1435
|
+
return new Command9("skills").description("\u53EF\u5206\u4EAB\u7684 Agent Skills\uFF08--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09").option("--slug <slug>", "\u67E5\u8BE2\u4E00\u4E2A Skill \u7684\u5B8C\u6574\u5185\u5BB9").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action(async (opts) => {
|
|
1436
|
+
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1437
|
+
try {
|
|
1438
|
+
if (opts.slug) {
|
|
1439
|
+
const response2 = await fetch(`${apiUrl}/api/skills/${encodeURIComponent(opts.slug)}`);
|
|
1440
|
+
if (!response2.ok) throw new Error(await readApiMessage(response2));
|
|
1441
|
+
const skill = await readApiData(response2);
|
|
1442
|
+
if (opts.json) {
|
|
1443
|
+
console.log(JSON.stringify({ tool: "maidang", command: "skills", slug: opts.slug, data: skill }, null, 2));
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
console.log("");
|
|
1447
|
+
console.log(" " + eyebrow(`skill / ${skill.category}`));
|
|
1448
|
+
console.log(" " + theme.ink(skill.name));
|
|
1449
|
+
console.log(" " + theme.inkSoft(skill.description));
|
|
1450
|
+
console.log("");
|
|
1451
|
+
console.log(" " + hairline());
|
|
1452
|
+
console.log("");
|
|
1453
|
+
console.log(" " + theme.inkMuted(`SKILL.md + ${skill.files.length} reference files`));
|
|
1454
|
+
for (const file of skill.files) console.log(" " + theme.inkMuted(`\u251C\u2500 ${file.path}`));
|
|
1455
|
+
console.log("");
|
|
1456
|
+
console.log(skill.content);
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
const response = await fetch(`${apiUrl}/api/skills`);
|
|
1460
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
1461
|
+
const skills = await readApiData(response);
|
|
1462
|
+
if (opts.json) {
|
|
1463
|
+
console.log(JSON.stringify({ tool: "maidang", command: "skills", data: skills }, null, 2));
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
console.log("");
|
|
1467
|
+
console.log(" " + eyebrow("skills"));
|
|
1468
|
+
console.log(" " + theme.ink("\u53EF\u5206\u4EAB\u7684 Agent Skills"));
|
|
1469
|
+
console.log("");
|
|
1470
|
+
console.log(" " + hairline());
|
|
1471
|
+
console.log("");
|
|
1472
|
+
for (const [index, skill] of skills.entries()) {
|
|
1473
|
+
console.log(` ${theme.inkMuted(String(index + 1).padStart(2, "0"))} ${theme.inkBody(skill.name)} ${theme.inkMuted(`\xB7 ${skill.category}`)}`);
|
|
1474
|
+
console.log(` ${theme.inkSoft(skill.description)}`);
|
|
1475
|
+
console.log(` ${theme.inkMuted(`npx maidang skills --slug ${skill.slug}`)}`);
|
|
1476
|
+
if (index < skills.length - 1) console.log("");
|
|
1477
|
+
}
|
|
1478
|
+
console.log("");
|
|
1479
|
+
} catch (error) {
|
|
1480
|
+
console.error(theme.err(`\u83B7\u53D6 Skills \u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
1481
|
+
process.exit(1);
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// src/commands/contact.ts
|
|
1487
|
+
import { Command as Command10 } from "commander";
|
|
1698
1488
|
import chalk2 from "chalk";
|
|
1699
1489
|
|
|
1700
1490
|
// src/utils/contact-api.ts
|
|
@@ -1713,8 +1503,7 @@ async function sendContactMessage(input) {
|
|
|
1713
1503
|
return readApiData(res);
|
|
1714
1504
|
}
|
|
1715
1505
|
|
|
1716
|
-
// src/commands/contact.
|
|
1717
|
-
var IDLE_HINT = "\u586B\u5199\u79F0\u547C / \u90AE\u7BB1 / \u7559\u8A00\uFF0CEnter \u53D1\u9001\uFF0CShift+Enter \u6362\u884C";
|
|
1506
|
+
// src/commands/contact.ts
|
|
1718
1507
|
async function contactSync(message, options) {
|
|
1719
1508
|
try {
|
|
1720
1509
|
const result = await sendContactMessage({
|
|
@@ -1738,105 +1527,15 @@ async function contactSync(message, options) {
|
|
|
1738
1527
|
} catch (error) {
|
|
1739
1528
|
const messageText = error instanceof Error ? error.message : String(error);
|
|
1740
1529
|
if (options?.json) {
|
|
1741
|
-
console.error(JSON.stringify({
|
|
1742
|
-
tool: "maidang",
|
|
1743
|
-
command: "contact",
|
|
1744
|
-
error: messageText
|
|
1745
|
-
}, null, 2));
|
|
1530
|
+
console.error(JSON.stringify({ tool: "maidang", command: "contact", error: messageText }, null, 2));
|
|
1746
1531
|
return;
|
|
1747
1532
|
}
|
|
1748
1533
|
console.error(chalk2.red(`Error: ${messageText}`));
|
|
1749
1534
|
process.exit(1);
|
|
1750
1535
|
}
|
|
1751
1536
|
}
|
|
1752
|
-
var ContactApp = () => {
|
|
1753
|
-
const [input, setInput] = useState3("");
|
|
1754
|
-
const [cursorPos, setCursorPos] = useState3(0);
|
|
1755
|
-
const [submitState, setSubmitState] = useState3({ type: "idle" });
|
|
1756
|
-
const sendingRef = useRef2(false);
|
|
1757
|
-
const sending = submitState.type === "sending";
|
|
1758
|
-
const visibleHint = (() => {
|
|
1759
|
-
if (submitState.type === "success") {
|
|
1760
|
-
return "\u5DF2\u53D1\u9001\uFF0CCtrl+C \u9000\u51FA";
|
|
1761
|
-
}
|
|
1762
|
-
if (submitState.type === "error") {
|
|
1763
|
-
return "\u53D1\u9001\u5931\u8D25\uFF0C\u53EF\u7EE7\u7EED\u7F16\u8F91\u540E\u91CD\u8BD5";
|
|
1764
|
-
}
|
|
1765
|
-
return IDLE_HINT;
|
|
1766
|
-
})();
|
|
1767
|
-
const send = async () => {
|
|
1768
|
-
const raw = input.trim();
|
|
1769
|
-
if (!raw || sendingRef.current) {
|
|
1770
|
-
return;
|
|
1771
|
-
}
|
|
1772
|
-
sendingRef.current = true;
|
|
1773
|
-
setSubmitState({ type: "sending" });
|
|
1774
|
-
try {
|
|
1775
|
-
const result = await sendContactMessage({ message: raw });
|
|
1776
|
-
setSubmitState({
|
|
1777
|
-
type: "success",
|
|
1778
|
-
message: result.message || "\u90AE\u4EF6\u5DF2\u53D1\u9001\u7ED9\u9EA6\u5F53\u3002"
|
|
1779
|
-
});
|
|
1780
|
-
} catch (error) {
|
|
1781
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1782
|
-
setSubmitState({ type: "error", message });
|
|
1783
|
-
} finally {
|
|
1784
|
-
sendingRef.current = false;
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
useInput3((char, key) => {
|
|
1788
|
-
if (key.ctrl && char === "c") {
|
|
1789
|
-
process.exit(0);
|
|
1790
|
-
}
|
|
1791
|
-
if (submitState.type === "success") {
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
if (sending) {
|
|
1795
|
-
return;
|
|
1796
|
-
}
|
|
1797
|
-
if (key.return) {
|
|
1798
|
-
if (key.shift) {
|
|
1799
|
-
const nextInput = `${input.slice(0, cursorPos)}
|
|
1800
|
-
${input.slice(cursorPos)}`;
|
|
1801
|
-
setInput(nextInput);
|
|
1802
|
-
setCursorPos(cursorPos + 1);
|
|
1803
|
-
return;
|
|
1804
|
-
}
|
|
1805
|
-
if (input.trim()) {
|
|
1806
|
-
void send();
|
|
1807
|
-
}
|
|
1808
|
-
return;
|
|
1809
|
-
}
|
|
1810
|
-
if (key.backspace || key.delete) {
|
|
1811
|
-
if (cursorPos === 0) {
|
|
1812
|
-
return;
|
|
1813
|
-
}
|
|
1814
|
-
setInput(`${input.slice(0, cursorPos - 1)}${input.slice(cursorPos)}`);
|
|
1815
|
-
setCursorPos(cursorPos - 1);
|
|
1816
|
-
return;
|
|
1817
|
-
}
|
|
1818
|
-
if (key.leftArrow) {
|
|
1819
|
-
setCursorPos(Math.max(0, cursorPos - 1));
|
|
1820
|
-
return;
|
|
1821
|
-
}
|
|
1822
|
-
if (key.rightArrow) {
|
|
1823
|
-
setCursorPos(Math.min(input.length, cursorPos + 1));
|
|
1824
|
-
return;
|
|
1825
|
-
}
|
|
1826
|
-
if (key.upArrow || key.downArrow || key.tab || key.escape) {
|
|
1827
|
-
return;
|
|
1828
|
-
}
|
|
1829
|
-
if (!char) {
|
|
1830
|
-
return;
|
|
1831
|
-
}
|
|
1832
|
-
setInput(`${input.slice(0, cursorPos)}${char}${input.slice(cursorPos)}`);
|
|
1833
|
-
setCursorPos(cursorPos + char.length);
|
|
1834
|
-
});
|
|
1835
|
-
const displayValue = input.slice(0, cursorPos) + (submitState.type === "success" ? "" : chalk2.inverse(" ")) + input.slice(cursorPos);
|
|
1836
|
-
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 || chalk2.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)));
|
|
1837
|
-
};
|
|
1838
1537
|
function createContactCommand() {
|
|
1839
|
-
|
|
1538
|
+
return new Command10("contact").description("\u7ED9\u9EA6\u5F53\u7559\u8A00\uFF08-m \u76F4\u63A5\u53D1\u9001\uFF0C--json \u8F93\u51FA\u7ED3\u6784\u5316\u7ED3\u679C\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").option("-m, --message <message>", "\u76F4\u63A5\u53D1\u9001\u7559\u8A00").option("--name <name>", "\u7559\u8A00\u4EBA\u79F0\u547C").option("--email <email>", "\u7559\u8A00\u4EBA\u90AE\u7BB1").action(async (opts) => {
|
|
1840
1539
|
const data = { email: "borisdunk@sina.com", note: "\u76F4\u63A5\u53D1\u9001\u539F\u6587\u7559\u8A00\uFF0C\u4E0D\u7ECF\u8FC7 chat \u6216\u5927\u6A21\u578B" };
|
|
1841
1540
|
if (opts.json && !opts.message) {
|
|
1842
1541
|
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
@@ -1850,13 +1549,20 @@ function createContactCommand() {
|
|
|
1850
1549
|
});
|
|
1851
1550
|
return;
|
|
1852
1551
|
}
|
|
1853
|
-
|
|
1552
|
+
if (opts.json) {
|
|
1553
|
+
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
console.log("");
|
|
1557
|
+
console.log("contact");
|
|
1558
|
+
console.log("\u7ED9\u9EA6\u5F53\u7559\u8A00\uFF1A");
|
|
1559
|
+
console.log(' npx maidang contact -m "\u4F60\u597D\uFF0C\u60F3\u548C\u4F60\u804A\u804A\u5408\u4F5C\u3002"');
|
|
1560
|
+
console.log("");
|
|
1854
1561
|
});
|
|
1855
|
-
return cmd;
|
|
1856
1562
|
}
|
|
1857
1563
|
|
|
1858
1564
|
// src/commands/whoami.ts
|
|
1859
|
-
import { Command as
|
|
1565
|
+
import { Command as Command11 } from "commander";
|
|
1860
1566
|
|
|
1861
1567
|
// src/constants/profile.ts
|
|
1862
1568
|
var INTRO_TEXT = "Agent \u5F00\u53D1 / AI \u5DE5\u4F5C\u6D41 / \u5168\u6808 \xB7 \u5F00\u653E\u5408\u4F5C\uFF0C\u6B22\u8FCE\u627E\u6211\u804A\u804A";
|
|
@@ -1871,7 +1577,7 @@ function getStatus() {
|
|
|
1871
1577
|
return { status: "working", label: "\u5DE5\u4F5C\u4E2D", description: "\u6B63\u5E38\u5DE5\u4F5C\u65F6\u6BB5" };
|
|
1872
1578
|
}
|
|
1873
1579
|
function createWhoAmICommand() {
|
|
1874
|
-
const cmd = new
|
|
1580
|
+
const cmd = new Command11("whoami").description("\u4E00\u53E5\u8BDD\u4ECB\u7ECD\u6211\uFF08--json \u8F93\u51FA\u7ED3\u6784\u5316\u6570\u636E\uFF09").option("--json", "\u8F93\u51FA JSON \u683C\u5F0F").action((opts) => {
|
|
1875
1581
|
const status = getStatus();
|
|
1876
1582
|
const whoami = {
|
|
1877
1583
|
tagline: INTRO_TEXT,
|
|
@@ -1909,9 +1615,9 @@ function createWhoAmICommand() {
|
|
|
1909
1615
|
}
|
|
1910
1616
|
|
|
1911
1617
|
// src/commands/chat.tsx
|
|
1912
|
-
import
|
|
1913
|
-
import { render
|
|
1914
|
-
import { Command as
|
|
1618
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
1619
|
+
import { render, Box, Text, useInput } from "ink";
|
|
1620
|
+
import { Command as Command12 } from "commander";
|
|
1915
1621
|
import chalk3 from "chalk";
|
|
1916
1622
|
|
|
1917
1623
|
// src/utils/chat-api.ts
|
|
@@ -2031,36 +1737,36 @@ async function chatSync(message, json = false, sessionId) {
|
|
|
2031
1737
|
}
|
|
2032
1738
|
var _id = 0;
|
|
2033
1739
|
var uid = () => ++_id;
|
|
2034
|
-
var ItemUser = ({ content }) => /* @__PURE__ */
|
|
2035
|
-
var ItemThinking = ({ content, expanded }) => /* @__PURE__ */
|
|
2036
|
-
var ItemLoading = () => /* @__PURE__ */
|
|
2037
|
-
var ItemTool = ({ content }) => /* @__PURE__ */
|
|
2038
|
-
var ItemContent = ({ content }) => /* @__PURE__ */
|
|
2039
|
-
var ItemError = ({ content }) => /* @__PURE__ */
|
|
1740
|
+
var ItemUser = ({ content }) => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Box, { width: "100%", backgroundColor: "cyan", paddingX: 1, paddingY: 0 }, /* @__PURE__ */ React.createElement(Text, { color: "black", wrap: "wrap" }, content)));
|
|
1741
|
+
var ItemThinking = ({ content, expanded }) => /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u601D\u8003"), expanded && /* @__PURE__ */ React.createElement(Box, { width: "100%", borderStyle: "round", borderColor: "gray", paddingX: 1, paddingY: 0, marginTop: 0 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true, wrap: "wrap" }, content)));
|
|
1742
|
+
var ItemLoading = () => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u601D\u8003\u4E2D..."));
|
|
1743
|
+
var ItemTool = ({ content }) => /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "yellow" }, "\u26A1"), /* @__PURE__ */ React.createElement(Box, { width: "100%", borderStyle: "round", borderColor: "yellow", paddingX: 1, paddingY: 0, marginTop: 0 }, /* @__PURE__ */ React.createElement(Text, { color: "yellow", wrap: "wrap" }, content)));
|
|
1744
|
+
var ItemContent = ({ content }) => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { wrap: "wrap" }, content));
|
|
1745
|
+
var ItemError = ({ content }) => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, content));
|
|
2040
1746
|
var DOUBLE_PRESS_WINDOW = 1e3;
|
|
2041
1747
|
var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
2042
|
-
const [items, setItems] =
|
|
2043
|
-
const [input, setInput] =
|
|
2044
|
-
const [cursorPos, setCursorPos] =
|
|
2045
|
-
const [loading, setLoading] =
|
|
2046
|
-
const [hint, setHint] =
|
|
2047
|
-
const [sessionId, setSessionId] =
|
|
2048
|
-
const sessionIdRef =
|
|
2049
|
-
const [showThinking, setShowThinking] =
|
|
2050
|
-
const lastEscRef =
|
|
2051
|
-
const lastCtrlCRef =
|
|
2052
|
-
const bottomRef =
|
|
2053
|
-
const showThinkingRef =
|
|
2054
|
-
|
|
1748
|
+
const [items, setItems] = useState([]);
|
|
1749
|
+
const [input, setInput] = useState("");
|
|
1750
|
+
const [cursorPos, setCursorPos] = useState(0);
|
|
1751
|
+
const [loading, setLoading] = useState(false);
|
|
1752
|
+
const [hint, setHint] = useState("");
|
|
1753
|
+
const [sessionId, setSessionId] = useState(void 0);
|
|
1754
|
+
const sessionIdRef = useRef(void 0);
|
|
1755
|
+
const [showThinking, setShowThinking] = useState(false);
|
|
1756
|
+
const lastEscRef = useRef(0);
|
|
1757
|
+
const lastCtrlCRef = useRef(0);
|
|
1758
|
+
const bottomRef = useRef(null);
|
|
1759
|
+
const showThinkingRef = useRef(false);
|
|
1760
|
+
useEffect(() => {
|
|
2055
1761
|
showThinkingRef.current = showThinking;
|
|
2056
1762
|
}, [showThinking]);
|
|
2057
|
-
|
|
1763
|
+
useEffect(() => {
|
|
2058
1764
|
if (initialSessionId) {
|
|
2059
1765
|
setSessionId(initialSessionId);
|
|
2060
1766
|
sessionIdRef.current = initialSessionId;
|
|
2061
1767
|
}
|
|
2062
1768
|
}, [initialSessionId]);
|
|
2063
|
-
|
|
1769
|
+
useEffect(() => {
|
|
2064
1770
|
if (hint) {
|
|
2065
1771
|
const t = setTimeout(() => setHint(""), 1500);
|
|
2066
1772
|
return () => clearTimeout(t);
|
|
@@ -2103,7 +1809,7 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2103
1809
|
setLoading(false);
|
|
2104
1810
|
}
|
|
2105
1811
|
};
|
|
2106
|
-
|
|
1812
|
+
useInput((char, key) => {
|
|
2107
1813
|
if (key.ctrl && char === "o") {
|
|
2108
1814
|
const hasThinking = items.some((i) => i.type === "thinking");
|
|
2109
1815
|
if (hasThinking) {
|
|
@@ -2189,27 +1895,27 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2189
1895
|
const cursorChar = input[cursorPos] ?? " ";
|
|
2190
1896
|
const after = input.slice(cursorPos + 1);
|
|
2191
1897
|
const fw = isFullWidth(cursorChar) ? 2 : 1;
|
|
2192
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Text, { color: "cyan" }, "> "), /* @__PURE__ */ React.createElement(Text, null, before), /* @__PURE__ */ React.createElement(Text, { backgroundColor: "gray", color: "black" }, cursorChar, fw === 2 ? " " : ""), /* @__PURE__ */ React.createElement(Text, null, after), loading && /* @__PURE__ */ React.createElement(Text, { dimColor: true }, " "));
|
|
2193
1899
|
};
|
|
2194
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 1, flexGrow: 1 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", flexGrow: 1 }, items.map((item) => {
|
|
2195
1901
|
switch (item.type) {
|
|
2196
1902
|
case "user":
|
|
2197
|
-
return /* @__PURE__ */
|
|
1903
|
+
return /* @__PURE__ */ React.createElement(ItemUser, { key: item.id, content: item.content });
|
|
2198
1904
|
case "thinking":
|
|
2199
|
-
return /* @__PURE__ */
|
|
1905
|
+
return /* @__PURE__ */ React.createElement(ItemThinking, { key: item.id, content: item.content, expanded: showThinking });
|
|
2200
1906
|
case "loading":
|
|
2201
|
-
return /* @__PURE__ */
|
|
1907
|
+
return /* @__PURE__ */ React.createElement(ItemLoading, { key: item.id });
|
|
2202
1908
|
case "tool":
|
|
2203
|
-
return /* @__PURE__ */
|
|
1909
|
+
return /* @__PURE__ */ React.createElement(ItemTool, { key: item.id, content: item.content });
|
|
2204
1910
|
case "content":
|
|
2205
|
-
return /* @__PURE__ */
|
|
1911
|
+
return /* @__PURE__ */ React.createElement(ItemContent, { key: item.id, content: item.content });
|
|
2206
1912
|
case "error":
|
|
2207
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ React.createElement(ItemError, { key: item.id, content: item.content });
|
|
2208
1914
|
}
|
|
2209
|
-
})), /* @__PURE__ */
|
|
1915
|
+
})), /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", flexShrink: 0 }, /* @__PURE__ */ React.createElement(Box, { borderStyle: "single", borderColor: "gray", paddingX: 1 }, renderInputLine()), /* @__PURE__ */ React.createElement(Box, { paddingTop: 1 }, /* @__PURE__ */ React.createElement(Text, { 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__ */ React.createElement(Box, { paddingTop: 0 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true, color: "yellow" }, hint)), !loading && items.some((i) => i.type === "thinking") && !showThinking && /* @__PURE__ */ React.createElement(Box, { paddingTop: 0 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true, color: "cyan" }, "Ctrl+O \u67E5\u770B\u601D\u8003"))), /* @__PURE__ */ React.createElement(Box, { ref: bottomRef }));
|
|
2210
1916
|
};
|
|
2211
1917
|
function createChatCommand() {
|
|
2212
|
-
const cmd = new
|
|
1918
|
+
const cmd = new Command12("chat").description("\u548C\u9EA6\u5F53\u5BF9\u8BDD\uFF08-m \u5355\u8F6E\u6D88\u606F\uFF0C--session-id \u7EED\u63A5\u5BF9\u8BDD\uFF09").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");
|
|
2213
1919
|
cmd.action(async (opts) => {
|
|
2214
1920
|
if (opts.json || opts.message) {
|
|
2215
1921
|
if (!opts.message) {
|
|
@@ -2223,13 +1929,13 @@ function createChatCommand() {
|
|
|
2223
1929
|
await chatSync(opts.message, !!opts.json, opts.sessionId);
|
|
2224
1930
|
return;
|
|
2225
1931
|
}
|
|
2226
|
-
|
|
1932
|
+
render(/* @__PURE__ */ React.createElement(ChatApp, { sessionId: opts.sessionId }));
|
|
2227
1933
|
});
|
|
2228
1934
|
return cmd;
|
|
2229
1935
|
}
|
|
2230
1936
|
|
|
2231
1937
|
// src/commands/manifest.ts
|
|
2232
|
-
import { Command as
|
|
1938
|
+
import { Command as Command13 } from "commander";
|
|
2233
1939
|
|
|
2234
1940
|
// src/utils/version.ts
|
|
2235
1941
|
function getAgeVersion() {
|
|
@@ -2256,11 +1962,12 @@ async function fetchOrEmpty(url) {
|
|
|
2256
1962
|
}
|
|
2257
1963
|
}
|
|
2258
1964
|
function createManifestCommand() {
|
|
2259
|
-
const cmd = new
|
|
1965
|
+
const cmd = new Command13("manifest").description("\u4E00\u6B21\u6027\u8F93\u51FA\u5168\u90E8\u516C\u5F00\u6570\u636E\uFF0C\u7ED9 AI agent \u7528").option("--json", "\u8F93\u51FA JSON\uFF08\u9ED8\u8BA4\u5C31\u662F JSON\uFF0C\u52A0\u4E0D\u52A0\u90FD\u4E00\u6837\uFF09").option("--pretty", "\u4EBA\u7C7B\u53EF\u8BFB\u7684\u7B80\u7248\u6982\u89C8\uFF08\u4E0D\u542B\u6B63\u6587\uFF09").action(async (opts) => {
|
|
2260
1966
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
2261
|
-
const [projects, tools, links] = await Promise.all([
|
|
1967
|
+
const [projects, tools, skills, links] = await Promise.all([
|
|
2262
1968
|
fetchOrEmpty(`${apiUrl}/api/projects`),
|
|
2263
1969
|
fetchOrEmpty(`${apiUrl}/api/tools`),
|
|
1970
|
+
fetchOrEmpty(`${apiUrl}/api/skills`),
|
|
2264
1971
|
fetchOrEmpty(`${apiUrl}/api/links`)
|
|
2265
1972
|
]);
|
|
2266
1973
|
const manifest = {
|
|
@@ -2280,6 +1987,7 @@ function createManifestCommand() {
|
|
|
2280
1987
|
career: career_default.career,
|
|
2281
1988
|
projects: projects ?? [],
|
|
2282
1989
|
tools: tools ?? [],
|
|
1990
|
+
skills: skills ?? [],
|
|
2283
1991
|
links: links ?? [],
|
|
2284
1992
|
commands: [
|
|
2285
1993
|
{ name: "whoami", desc: "\u4E00\u53E5\u8BDD\u4ECB\u7ECD" },
|
|
@@ -2287,6 +1995,7 @@ function createManifestCommand() {
|
|
|
2287
1995
|
{ name: "projects", desc: "\u9879\u76EE" },
|
|
2288
1996
|
{ name: "posts", desc: "\u63A8\u6587" },
|
|
2289
1997
|
{ name: "tools", desc: "\u5DE5\u5177" },
|
|
1998
|
+
{ name: "skills", desc: "Agent Skills" },
|
|
2290
1999
|
{ name: "songs", desc: "\u6B4C\u5355" },
|
|
2291
2000
|
{ name: "links", desc: "\u5916\u94FE" },
|
|
2292
2001
|
{ name: "cat", desc: "\u732B\u732B" },
|
|
@@ -2310,6 +2019,7 @@ function createManifestCommand() {
|
|
|
2310
2019
|
printKV("career", `${manifest.career.experiences.length} \u6BB5\u7ECF\u5386`);
|
|
2311
2020
|
printKV("projects", `${manifest.projects.length} \u4E2A\u9879\u76EE`);
|
|
2312
2021
|
printKV("tools", `${manifest.tools.length} \u4E2A\u5DE5\u5177`);
|
|
2022
|
+
printKV("skills", `${manifest.skills.length} \u4E2A Skill`);
|
|
2313
2023
|
printKV("links", `${manifest.links.length} \u4E2A\u5916\u94FE`);
|
|
2314
2024
|
console.log("");
|
|
2315
2025
|
console.log(" " + hairline());
|
|
@@ -2324,7 +2034,7 @@ function createManifestCommand() {
|
|
|
2324
2034
|
}
|
|
2325
2035
|
|
|
2326
2036
|
// src/index.ts
|
|
2327
|
-
var program = new
|
|
2037
|
+
var program = new Command14();
|
|
2328
2038
|
program.name("maidang").description("\u4E00\u4EFD\u53EF\u4EE5\u88AB AI \u8BFB\u53D6\u7684\u4E2A\u4EBA\u624B\u518C").version(getAgeVersion(), "-v, --version", "\u663E\u793A\u7248\u672C\u53F7");
|
|
2329
2039
|
program.addCommand(createCareerCommand());
|
|
2330
2040
|
program.addCommand(createCatCommand());
|
|
@@ -2333,6 +2043,7 @@ program.addCommand(createSongsCommand());
|
|
|
2333
2043
|
program.addCommand(createLinksCommand());
|
|
2334
2044
|
program.addCommand(createProjectsCommand());
|
|
2335
2045
|
program.addCommand(createToolsCommand());
|
|
2046
|
+
program.addCommand(createSkillsCommand());
|
|
2336
2047
|
program.addCommand(createContactCommand());
|
|
2337
2048
|
program.addCommand(createWhoAmICommand());
|
|
2338
2049
|
program.addCommand(createChatCommand());
|