maidang 29.7.20 → 29.7.22
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 +249 -525
- 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 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,95 @@ 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\u663E\u793A\u5168\u90E8\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").option("--page-size <size>", "\u6BCF\u9875\u6761\u6570");
|
|
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
|
-
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const usesPagination = opts.page !== void 0 || opts.pageSize !== void 0;
|
|
327
|
+
const url = usesPagination ? buildPaginationUrl(`${baseApiUrl}/api/posts`, opts) : `${baseApiUrl}/api/posts`;
|
|
328
|
+
const response = await fetch(url);
|
|
329
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
330
|
+
const responseData = await readApiData(response);
|
|
331
|
+
const data = Array.isArray(responseData) ? {
|
|
332
|
+
items: responseData,
|
|
333
|
+
pagination: {
|
|
334
|
+
page: 1,
|
|
335
|
+
pageSize: responseData.length,
|
|
336
|
+
total: responseData.length,
|
|
337
|
+
totalPages: responseData.length > 0 ? 1 : 0,
|
|
338
|
+
hasNext: false,
|
|
339
|
+
hasPrevious: false
|
|
465
340
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
console.
|
|
469
|
-
|
|
341
|
+
} : responseData;
|
|
342
|
+
if (opts.json) {
|
|
343
|
+
console.log(JSON.stringify({ tool: "maidang", command: "posts", data }, null, 2));
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
console.log("");
|
|
347
|
+
console.log(" " + eyebrow("posts"));
|
|
348
|
+
console.log(" " + theme.ink(`\u7B2C ${data.pagination.page}/${data.pagination.totalPages || 1} \u9875 \xB7 \u5171 ${data.pagination.total} \u6761`));
|
|
349
|
+
console.log("");
|
|
350
|
+
console.log(" " + hairline());
|
|
351
|
+
console.log("");
|
|
352
|
+
data.items.forEach((post, index) => {
|
|
353
|
+
const title = post.title || post.summary || post.content.split("\n")[0] || post.slug;
|
|
354
|
+
const meta = [post.date, post.time].filter(Boolean).join(" ");
|
|
355
|
+
console.log(` ${theme.inkMuted(String((data.pagination.page - 1) * data.pagination.pageSize + index + 1).padStart(2, "0"))} ${theme.inkBody(title)}`);
|
|
356
|
+
if (meta) console.log(` ${theme.inkMuted(meta)}`);
|
|
357
|
+
console.log(` ${theme.inkSoft(post.slug)}`);
|
|
358
|
+
if (index < data.items.length - 1) console.log("");
|
|
470
359
|
});
|
|
471
|
-
|
|
360
|
+
console.log("");
|
|
361
|
+
} catch (error) {
|
|
362
|
+
console.error(theme.err(`\u83B7\u53D6\u52A8\u6001\u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
363
|
+
process.exit(1);
|
|
472
364
|
}
|
|
473
|
-
render(/* @__PURE__ */ React.createElement(PostsApp, { apiUrl }));
|
|
474
365
|
});
|
|
475
366
|
return cmd;
|
|
476
367
|
}
|
|
477
368
|
|
|
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";
|
|
369
|
+
// src/commands/songs.ts
|
|
481
370
|
import { Command as Command5 } from "commander";
|
|
482
371
|
|
|
483
372
|
// src/data/songs.json
|
|
@@ -1367,203 +1256,70 @@ function copyToClipboard(text) {
|
|
|
1367
1256
|
execSync(`printf '${text.replace(/'/g, "'\\''")}' | pbcopy`, { stdio: "ignore" });
|
|
1368
1257
|
}
|
|
1369
1258
|
|
|
1370
|
-
// src/commands/songs.
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1373
|
-
var
|
|
1259
|
+
// src/commands/songs.ts
|
|
1260
|
+
var allYears = songs_default.data;
|
|
1261
|
+
var availableYears = songs_default.years;
|
|
1262
|
+
var allMeta = songs_default.meta;
|
|
1374
1263
|
function formatDuration(ms) {
|
|
1375
|
-
const
|
|
1376
|
-
|
|
1377
|
-
const sec = s % 60;
|
|
1378
|
-
return `${m}:${sec.toString().padStart(2, "0")}`;
|
|
1264
|
+
const seconds = Math.round(ms / 1e3);
|
|
1265
|
+
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
1379
1266
|
}
|
|
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();
|
|
1267
|
+
function printSong(song, index) {
|
|
1268
|
+
console.log(`${String(index + 1).padStart(2, "0")} ${song.name}`);
|
|
1269
|
+
console.log(` ${song.artists.join(", ")} \xB7 ${formatDuration(song.duration)} \xB7 ${song.album}`);
|
|
1270
|
+
}
|
|
1271
|
+
function createSongsCommand() {
|
|
1272
|
+
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) => {
|
|
1273
|
+
const year = opts.year ? Number(opts.year) : void 0;
|
|
1274
|
+
const entry = year === void 0 ? void 0 : allYears.find((item) => item.year === year);
|
|
1275
|
+
if (year !== void 0 && !entry) {
|
|
1276
|
+
const message = `\u6CA1\u6709 ${year} \u5E74\u7684\u6B4C\u5355`;
|
|
1277
|
+
if (opts.json) {
|
|
1278
|
+
console.error(JSON.stringify({ tool: "maidang", command: "songs", error: message }, null, 2));
|
|
1279
|
+
} else {
|
|
1280
|
+
console.error(message);
|
|
1281
|
+
}
|
|
1282
|
+
process.exit(1);
|
|
1478
1283
|
}
|
|
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
|
|
1284
|
+
if (opts.copy) {
|
|
1285
|
+
const song = allYears.flatMap((item) => item.songs).find((item) => item.id === opts.copy);
|
|
1286
|
+
if (!song) {
|
|
1287
|
+
console.error(`\u6CA1\u6709\u627E\u5230\u6B4C\u66F2 ${opts.copy}`);
|
|
1288
|
+
process.exit(1);
|
|
1502
1289
|
}
|
|
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
|
|
1290
|
+
copyToClipboard(song.name);
|
|
1291
|
+
if (opts.json) {
|
|
1292
|
+
console.log(JSON.stringify({ tool: "maidang", command: "songs", copied: song.name, data: song }, null, 2));
|
|
1293
|
+
} else {
|
|
1294
|
+
console.log(`\u5DF2\u590D\u5236\uFF1A${song.name}`);
|
|
1518
1295
|
}
|
|
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
|
|
1296
|
+
return;
|
|
1534
1297
|
}
|
|
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
1298
|
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);
|
|
1299
|
+
if (entry) {
|
|
1300
|
+
const meta = allMeta.find((item) => item.year === entry.year);
|
|
1549
1301
|
console.log(JSON.stringify({ tool: "maidang", command: "songs", meta, data: entry.songs }, null, 2));
|
|
1550
1302
|
} else {
|
|
1551
|
-
console.log(JSON.stringify({ tool: "maidang", command: "songs", years:
|
|
1303
|
+
console.log(JSON.stringify({ tool: "maidang", command: "songs", years: availableYears, meta: allMeta, data: allYears }, null, 2));
|
|
1552
1304
|
}
|
|
1553
1305
|
return;
|
|
1554
1306
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1307
|
+
if (entry) {
|
|
1308
|
+
console.log(`
|
|
1309
|
+
${entry.year} \u5E74\u5EA6\u6B4C\u5355 \xB7 ${entry.songs.length} \u9996
|
|
1310
|
+
`);
|
|
1311
|
+
entry.songs.forEach(printSong);
|
|
1312
|
+
console.log("");
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
console.log("\n\u5E74\u5EA6\u6B4C\u5355\n");
|
|
1316
|
+
for (const item of allYears) {
|
|
1317
|
+
const meta = allMeta.find((candidate) => candidate.year === item.year);
|
|
1318
|
+
const preview = item.songs[0] ? ` \xB7 ${item.songs[0].name}` : "";
|
|
1319
|
+
console.log(`${item.year} ${meta?.trackCount || item.songs.length} \u9996${preview}`);
|
|
1563
1320
|
}
|
|
1564
|
-
|
|
1321
|
+
console.log("\n\u67E5\u770B\u67D0\u5E74\uFF1Anpx maidang songs --year <year>\n");
|
|
1565
1322
|
});
|
|
1566
|
-
return cmd;
|
|
1567
1323
|
}
|
|
1568
1324
|
|
|
1569
1325
|
// src/commands/links.ts
|
|
@@ -1605,41 +1361,36 @@ function createLinksCommand() {
|
|
|
1605
1361
|
// src/commands/projects.ts
|
|
1606
1362
|
import { Command as Command7 } from "commander";
|
|
1607
1363
|
function createProjectsCommand() {
|
|
1608
|
-
|
|
1364
|
+
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
1365
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1610
1366
|
try {
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1367
|
+
const response = await fetch(buildPaginationUrl(`${apiUrl}/api/projects`, opts));
|
|
1368
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
1369
|
+
const data = await readApiData(response);
|
|
1614
1370
|
if (opts.json) {
|
|
1615
|
-
console.log(JSON.stringify({ tool: "maidang", command: "projects", data
|
|
1371
|
+
console.log(JSON.stringify({ tool: "maidang", command: "projects", data }, null, 2));
|
|
1616
1372
|
return;
|
|
1617
1373
|
}
|
|
1618
1374
|
console.log("");
|
|
1619
1375
|
console.log(" " + eyebrow("projects"));
|
|
1620
|
-
console.log(" " + theme.ink(
|
|
1376
|
+
console.log(" " + theme.ink(`\u7B2C ${data.pagination.page}/${data.pagination.totalPages || 1} \u9875 \xB7 \u5171 ${data.pagination.total} \u4E2A\u9879\u76EE`));
|
|
1621
1377
|
console.log("");
|
|
1622
1378
|
console.log(" " + hairline());
|
|
1623
1379
|
console.log("");
|
|
1624
|
-
|
|
1625
|
-
const num = theme.inkMuted(String(
|
|
1380
|
+
data.items.forEach((project, index) => {
|
|
1381
|
+
const num = theme.inkMuted(String((data.pagination.page - 1) * data.pagination.pageSize + index + 1).padStart(2, "0"));
|
|
1626
1382
|
const cat = theme.inkMuted(`\xB7 ${project.category}`);
|
|
1627
1383
|
console.log(` ${num} ${theme.inkBody(project.name)} ${cat}`);
|
|
1628
1384
|
console.log(` ${theme.inkSoft(project.description)}`);
|
|
1629
|
-
if (project.url) {
|
|
1630
|
-
|
|
1631
|
-
}
|
|
1632
|
-
if (idx < projects.length - 1) {
|
|
1633
|
-
console.log("");
|
|
1634
|
-
}
|
|
1385
|
+
if (project.url) console.log(` ${theme.linkUnderline(project.url)}`);
|
|
1386
|
+
if (index < data.items.length - 1) console.log("");
|
|
1635
1387
|
});
|
|
1636
1388
|
console.log("");
|
|
1637
|
-
} catch (
|
|
1638
|
-
console.error(theme.err(`\u83B7\u53D6\u9879\u76EE\u5931\u8D25: ${
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
console.error(theme.err(`\u83B7\u53D6\u9879\u76EE\u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
1639
1391
|
process.exit(1);
|
|
1640
1392
|
}
|
|
1641
1393
|
});
|
|
1642
|
-
return cmd;
|
|
1643
1394
|
}
|
|
1644
1395
|
|
|
1645
1396
|
// src/commands/tools.ts
|
|
@@ -1691,10 +1442,62 @@ function createToolsCommand() {
|
|
|
1691
1442
|
return cmd;
|
|
1692
1443
|
}
|
|
1693
1444
|
|
|
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";
|
|
1445
|
+
// src/commands/skills.ts
|
|
1697
1446
|
import { Command as Command9 } from "commander";
|
|
1447
|
+
function createSkillsCommand() {
|
|
1448
|
+
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) => {
|
|
1449
|
+
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
1450
|
+
try {
|
|
1451
|
+
if (opts.slug) {
|
|
1452
|
+
const response2 = await fetch(`${apiUrl}/api/skills/${encodeURIComponent(opts.slug)}`);
|
|
1453
|
+
if (!response2.ok) throw new Error(await readApiMessage(response2));
|
|
1454
|
+
const skill = await readApiData(response2);
|
|
1455
|
+
if (opts.json) {
|
|
1456
|
+
console.log(JSON.stringify({ tool: "maidang", command: "skills", slug: opts.slug, data: skill }, null, 2));
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
console.log("");
|
|
1460
|
+
console.log(" " + eyebrow(`skill / ${skill.category}`));
|
|
1461
|
+
console.log(" " + theme.ink(skill.name));
|
|
1462
|
+
console.log(" " + theme.inkSoft(skill.description));
|
|
1463
|
+
console.log("");
|
|
1464
|
+
console.log(" " + hairline());
|
|
1465
|
+
console.log("");
|
|
1466
|
+
console.log(" " + theme.inkMuted(`SKILL.md + ${skill.files.length} reference files`));
|
|
1467
|
+
for (const file of skill.files) console.log(" " + theme.inkMuted(`\u251C\u2500 ${file.path}`));
|
|
1468
|
+
console.log("");
|
|
1469
|
+
console.log(skill.content);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
const response = await fetch(`${apiUrl}/api/skills`);
|
|
1473
|
+
if (!response.ok) throw new Error(await readApiMessage(response));
|
|
1474
|
+
const skills = await readApiData(response);
|
|
1475
|
+
if (opts.json) {
|
|
1476
|
+
console.log(JSON.stringify({ tool: "maidang", command: "skills", data: skills }, null, 2));
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
console.log("");
|
|
1480
|
+
console.log(" " + eyebrow("skills"));
|
|
1481
|
+
console.log(" " + theme.ink("\u53EF\u5206\u4EAB\u7684 Agent Skills"));
|
|
1482
|
+
console.log("");
|
|
1483
|
+
console.log(" " + hairline());
|
|
1484
|
+
console.log("");
|
|
1485
|
+
for (const [index, skill] of skills.entries()) {
|
|
1486
|
+
console.log(` ${theme.inkMuted(String(index + 1).padStart(2, "0"))} ${theme.inkBody(skill.name)} ${theme.inkMuted(`\xB7 ${skill.category}`)}`);
|
|
1487
|
+
console.log(` ${theme.inkSoft(skill.description)}`);
|
|
1488
|
+
console.log(` ${theme.inkMuted(`npx maidang skills --slug ${skill.slug}`)}`);
|
|
1489
|
+
if (index < skills.length - 1) console.log("");
|
|
1490
|
+
}
|
|
1491
|
+
console.log("");
|
|
1492
|
+
} catch (error) {
|
|
1493
|
+
console.error(theme.err(`\u83B7\u53D6 Skills \u5931\u8D25: ${error instanceof Error ? error.message : error}`));
|
|
1494
|
+
process.exit(1);
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
// src/commands/contact.ts
|
|
1500
|
+
import { Command as Command10 } from "commander";
|
|
1698
1501
|
import chalk2 from "chalk";
|
|
1699
1502
|
|
|
1700
1503
|
// src/utils/contact-api.ts
|
|
@@ -1713,8 +1516,7 @@ async function sendContactMessage(input) {
|
|
|
1713
1516
|
return readApiData(res);
|
|
1714
1517
|
}
|
|
1715
1518
|
|
|
1716
|
-
// src/commands/contact.
|
|
1717
|
-
var IDLE_HINT = "\u586B\u5199\u79F0\u547C / \u90AE\u7BB1 / \u7559\u8A00\uFF0CEnter \u53D1\u9001\uFF0CShift+Enter \u6362\u884C";
|
|
1519
|
+
// src/commands/contact.ts
|
|
1718
1520
|
async function contactSync(message, options) {
|
|
1719
1521
|
try {
|
|
1720
1522
|
const result = await sendContactMessage({
|
|
@@ -1738,105 +1540,15 @@ async function contactSync(message, options) {
|
|
|
1738
1540
|
} catch (error) {
|
|
1739
1541
|
const messageText = error instanceof Error ? error.message : String(error);
|
|
1740
1542
|
if (options?.json) {
|
|
1741
|
-
console.error(JSON.stringify({
|
|
1742
|
-
tool: "maidang",
|
|
1743
|
-
command: "contact",
|
|
1744
|
-
error: messageText
|
|
1745
|
-
}, null, 2));
|
|
1543
|
+
console.error(JSON.stringify({ tool: "maidang", command: "contact", error: messageText }, null, 2));
|
|
1746
1544
|
return;
|
|
1747
1545
|
}
|
|
1748
1546
|
console.error(chalk2.red(`Error: ${messageText}`));
|
|
1749
1547
|
process.exit(1);
|
|
1750
1548
|
}
|
|
1751
1549
|
}
|
|
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
1550
|
function createContactCommand() {
|
|
1839
|
-
|
|
1551
|
+
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
1552
|
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
1553
|
if (opts.json && !opts.message) {
|
|
1842
1554
|
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
@@ -1850,13 +1562,20 @@ function createContactCommand() {
|
|
|
1850
1562
|
});
|
|
1851
1563
|
return;
|
|
1852
1564
|
}
|
|
1853
|
-
|
|
1565
|
+
if (opts.json) {
|
|
1566
|
+
console.log(JSON.stringify({ tool: "maidang", command: "contact", data }, null, 2));
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
console.log("");
|
|
1570
|
+
console.log("contact");
|
|
1571
|
+
console.log("\u7ED9\u9EA6\u5F53\u7559\u8A00\uFF1A");
|
|
1572
|
+
console.log(' npx maidang contact -m "\u4F60\u597D\uFF0C\u60F3\u548C\u4F60\u804A\u804A\u5408\u4F5C\u3002"');
|
|
1573
|
+
console.log("");
|
|
1854
1574
|
});
|
|
1855
|
-
return cmd;
|
|
1856
1575
|
}
|
|
1857
1576
|
|
|
1858
1577
|
// src/commands/whoami.ts
|
|
1859
|
-
import { Command as
|
|
1578
|
+
import { Command as Command11 } from "commander";
|
|
1860
1579
|
|
|
1861
1580
|
// src/constants/profile.ts
|
|
1862
1581
|
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 +1590,7 @@ function getStatus() {
|
|
|
1871
1590
|
return { status: "working", label: "\u5DE5\u4F5C\u4E2D", description: "\u6B63\u5E38\u5DE5\u4F5C\u65F6\u6BB5" };
|
|
1872
1591
|
}
|
|
1873
1592
|
function createWhoAmICommand() {
|
|
1874
|
-
const cmd = new
|
|
1593
|
+
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
1594
|
const status = getStatus();
|
|
1876
1595
|
const whoami = {
|
|
1877
1596
|
tagline: INTRO_TEXT,
|
|
@@ -1909,9 +1628,9 @@ function createWhoAmICommand() {
|
|
|
1909
1628
|
}
|
|
1910
1629
|
|
|
1911
1630
|
// src/commands/chat.tsx
|
|
1912
|
-
import
|
|
1913
|
-
import { render
|
|
1914
|
-
import { Command as
|
|
1631
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
1632
|
+
import { render, Box, Text, useInput } from "ink";
|
|
1633
|
+
import { Command as Command12 } from "commander";
|
|
1915
1634
|
import chalk3 from "chalk";
|
|
1916
1635
|
|
|
1917
1636
|
// src/utils/chat-api.ts
|
|
@@ -2031,36 +1750,36 @@ async function chatSync(message, json = false, sessionId) {
|
|
|
2031
1750
|
}
|
|
2032
1751
|
var _id = 0;
|
|
2033
1752
|
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__ */
|
|
1753
|
+
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)));
|
|
1754
|
+
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)));
|
|
1755
|
+
var ItemLoading = () => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { dimColor: true }, "\u601D\u8003\u4E2D..."));
|
|
1756
|
+
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)));
|
|
1757
|
+
var ItemContent = ({ content }) => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { wrap: "wrap" }, content));
|
|
1758
|
+
var ItemError = ({ content }) => /* @__PURE__ */ React.createElement(Box, { width: "100%", marginBottom: 1 }, /* @__PURE__ */ React.createElement(Text, { color: "red" }, content));
|
|
2040
1759
|
var DOUBLE_PRESS_WINDOW = 1e3;
|
|
2041
1760
|
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
|
-
|
|
1761
|
+
const [items, setItems] = useState([]);
|
|
1762
|
+
const [input, setInput] = useState("");
|
|
1763
|
+
const [cursorPos, setCursorPos] = useState(0);
|
|
1764
|
+
const [loading, setLoading] = useState(false);
|
|
1765
|
+
const [hint, setHint] = useState("");
|
|
1766
|
+
const [sessionId, setSessionId] = useState(void 0);
|
|
1767
|
+
const sessionIdRef = useRef(void 0);
|
|
1768
|
+
const [showThinking, setShowThinking] = useState(false);
|
|
1769
|
+
const lastEscRef = useRef(0);
|
|
1770
|
+
const lastCtrlCRef = useRef(0);
|
|
1771
|
+
const bottomRef = useRef(null);
|
|
1772
|
+
const showThinkingRef = useRef(false);
|
|
1773
|
+
useEffect(() => {
|
|
2055
1774
|
showThinkingRef.current = showThinking;
|
|
2056
1775
|
}, [showThinking]);
|
|
2057
|
-
|
|
1776
|
+
useEffect(() => {
|
|
2058
1777
|
if (initialSessionId) {
|
|
2059
1778
|
setSessionId(initialSessionId);
|
|
2060
1779
|
sessionIdRef.current = initialSessionId;
|
|
2061
1780
|
}
|
|
2062
1781
|
}, [initialSessionId]);
|
|
2063
|
-
|
|
1782
|
+
useEffect(() => {
|
|
2064
1783
|
if (hint) {
|
|
2065
1784
|
const t = setTimeout(() => setHint(""), 1500);
|
|
2066
1785
|
return () => clearTimeout(t);
|
|
@@ -2103,7 +1822,7 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2103
1822
|
setLoading(false);
|
|
2104
1823
|
}
|
|
2105
1824
|
};
|
|
2106
|
-
|
|
1825
|
+
useInput((char, key) => {
|
|
2107
1826
|
if (key.ctrl && char === "o") {
|
|
2108
1827
|
const hasThinking = items.some((i) => i.type === "thinking");
|
|
2109
1828
|
if (hasThinking) {
|
|
@@ -2189,27 +1908,27 @@ var ChatApp = ({ sessionId: initialSessionId }) => {
|
|
|
2189
1908
|
const cursorChar = input[cursorPos] ?? " ";
|
|
2190
1909
|
const after = input.slice(cursorPos + 1);
|
|
2191
1910
|
const fw = isFullWidth(cursorChar) ? 2 : 1;
|
|
2192
|
-
return /* @__PURE__ */
|
|
1911
|
+
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
1912
|
};
|
|
2194
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", paddingX: 1, flexGrow: 1 }, /* @__PURE__ */ React.createElement(Box, { flexDirection: "column", flexGrow: 1 }, items.map((item) => {
|
|
2195
1914
|
switch (item.type) {
|
|
2196
1915
|
case "user":
|
|
2197
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ React.createElement(ItemUser, { key: item.id, content: item.content });
|
|
2198
1917
|
case "thinking":
|
|
2199
|
-
return /* @__PURE__ */
|
|
1918
|
+
return /* @__PURE__ */ React.createElement(ItemThinking, { key: item.id, content: item.content, expanded: showThinking });
|
|
2200
1919
|
case "loading":
|
|
2201
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ React.createElement(ItemLoading, { key: item.id });
|
|
2202
1921
|
case "tool":
|
|
2203
|
-
return /* @__PURE__ */
|
|
1922
|
+
return /* @__PURE__ */ React.createElement(ItemTool, { key: item.id, content: item.content });
|
|
2204
1923
|
case "content":
|
|
2205
|
-
return /* @__PURE__ */
|
|
1924
|
+
return /* @__PURE__ */ React.createElement(ItemContent, { key: item.id, content: item.content });
|
|
2206
1925
|
case "error":
|
|
2207
|
-
return /* @__PURE__ */
|
|
1926
|
+
return /* @__PURE__ */ React.createElement(ItemError, { key: item.id, content: item.content });
|
|
2208
1927
|
}
|
|
2209
|
-
})), /* @__PURE__ */
|
|
1928
|
+
})), /* @__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
1929
|
};
|
|
2211
1930
|
function createChatCommand() {
|
|
2212
|
-
const cmd = new
|
|
1931
|
+
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
1932
|
cmd.action(async (opts) => {
|
|
2214
1933
|
if (opts.json || opts.message) {
|
|
2215
1934
|
if (!opts.message) {
|
|
@@ -2223,13 +1942,13 @@ function createChatCommand() {
|
|
|
2223
1942
|
await chatSync(opts.message, !!opts.json, opts.sessionId);
|
|
2224
1943
|
return;
|
|
2225
1944
|
}
|
|
2226
|
-
|
|
1945
|
+
render(/* @__PURE__ */ React.createElement(ChatApp, { sessionId: opts.sessionId }));
|
|
2227
1946
|
});
|
|
2228
1947
|
return cmd;
|
|
2229
1948
|
}
|
|
2230
1949
|
|
|
2231
1950
|
// src/commands/manifest.ts
|
|
2232
|
-
import { Command as
|
|
1951
|
+
import { Command as Command13 } from "commander";
|
|
2233
1952
|
|
|
2234
1953
|
// src/utils/version.ts
|
|
2235
1954
|
function getAgeVersion() {
|
|
@@ -2256,11 +1975,12 @@ async function fetchOrEmpty(url) {
|
|
|
2256
1975
|
}
|
|
2257
1976
|
}
|
|
2258
1977
|
function createManifestCommand() {
|
|
2259
|
-
const cmd = new
|
|
1978
|
+
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
1979
|
const apiUrl = process.env.MAIDANG_API_URL || DEFAULT_API_URL;
|
|
2261
|
-
const [projects, tools, links] = await Promise.all([
|
|
1980
|
+
const [projects, tools, skills, links] = await Promise.all([
|
|
2262
1981
|
fetchOrEmpty(`${apiUrl}/api/projects`),
|
|
2263
1982
|
fetchOrEmpty(`${apiUrl}/api/tools`),
|
|
1983
|
+
fetchOrEmpty(`${apiUrl}/api/skills`),
|
|
2264
1984
|
fetchOrEmpty(`${apiUrl}/api/links`)
|
|
2265
1985
|
]);
|
|
2266
1986
|
const manifest = {
|
|
@@ -2280,6 +2000,7 @@ function createManifestCommand() {
|
|
|
2280
2000
|
career: career_default.career,
|
|
2281
2001
|
projects: projects ?? [],
|
|
2282
2002
|
tools: tools ?? [],
|
|
2003
|
+
skills: skills ?? [],
|
|
2283
2004
|
links: links ?? [],
|
|
2284
2005
|
commands: [
|
|
2285
2006
|
{ name: "whoami", desc: "\u4E00\u53E5\u8BDD\u4ECB\u7ECD" },
|
|
@@ -2287,6 +2008,7 @@ function createManifestCommand() {
|
|
|
2287
2008
|
{ name: "projects", desc: "\u9879\u76EE" },
|
|
2288
2009
|
{ name: "posts", desc: "\u63A8\u6587" },
|
|
2289
2010
|
{ name: "tools", desc: "\u5DE5\u5177" },
|
|
2011
|
+
{ name: "skills", desc: "Agent Skills" },
|
|
2290
2012
|
{ name: "songs", desc: "\u6B4C\u5355" },
|
|
2291
2013
|
{ name: "links", desc: "\u5916\u94FE" },
|
|
2292
2014
|
{ name: "cat", desc: "\u732B\u732B" },
|
|
@@ -2310,6 +2032,7 @@ function createManifestCommand() {
|
|
|
2310
2032
|
printKV("career", `${manifest.career.experiences.length} \u6BB5\u7ECF\u5386`);
|
|
2311
2033
|
printKV("projects", `${manifest.projects.length} \u4E2A\u9879\u76EE`);
|
|
2312
2034
|
printKV("tools", `${manifest.tools.length} \u4E2A\u5DE5\u5177`);
|
|
2035
|
+
printKV("skills", `${manifest.skills.length} \u4E2A Skill`);
|
|
2313
2036
|
printKV("links", `${manifest.links.length} \u4E2A\u5916\u94FE`);
|
|
2314
2037
|
console.log("");
|
|
2315
2038
|
console.log(" " + hairline());
|
|
@@ -2324,7 +2047,7 @@ function createManifestCommand() {
|
|
|
2324
2047
|
}
|
|
2325
2048
|
|
|
2326
2049
|
// src/index.ts
|
|
2327
|
-
var program = new
|
|
2050
|
+
var program = new Command14();
|
|
2328
2051
|
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
2052
|
program.addCommand(createCareerCommand());
|
|
2330
2053
|
program.addCommand(createCatCommand());
|
|
@@ -2333,6 +2056,7 @@ program.addCommand(createSongsCommand());
|
|
|
2333
2056
|
program.addCommand(createLinksCommand());
|
|
2334
2057
|
program.addCommand(createProjectsCommand());
|
|
2335
2058
|
program.addCommand(createToolsCommand());
|
|
2059
|
+
program.addCommand(createSkillsCommand());
|
|
2336
2060
|
program.addCommand(createContactCommand());
|
|
2337
2061
|
program.addCommand(createWhoAmICommand());
|
|
2338
2062
|
program.addCommand(createChatCommand());
|