@astro-minimax/cli 0.7.0 → 0.7.2
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/commands/podcast.d.ts +2 -0
- package/dist/commands/podcast.d.ts.map +1 -0
- package/dist/commands/podcast.js +89 -0
- package/dist/commands/podcast.js.map +1 -0
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +7 -2
- package/dist/commands/profile.js.map +1 -1
- package/dist/tools/build-fact-registry.d.ts +14 -0
- package/dist/tools/build-fact-registry.d.ts.map +1 -0
- package/dist/tools/build-fact-registry.js +545 -0
- package/dist/tools/build-fact-registry.js.map +1 -0
- package/dist/tools/eval-ai-chat.js +34 -4
- package/dist/tools/eval-ai-chat.js.map +1 -1
- package/dist/tools/lib/audio-processor.d.ts +46 -0
- package/dist/tools/lib/audio-processor.d.ts.map +1 -0
- package/dist/tools/lib/audio-processor.js +188 -0
- package/dist/tools/lib/audio-processor.js.map +1 -0
- package/dist/tools/lib/script-generator.d.ts +61 -0
- package/dist/tools/lib/script-generator.d.ts.map +1 -0
- package/dist/tools/lib/script-generator.js +182 -0
- package/dist/tools/lib/script-generator.js.map +1 -0
- package/dist/tools/lib/tts-provider.d.ts +65 -0
- package/dist/tools/lib/tts-provider.d.ts.map +1 -0
- package/dist/tools/lib/tts-provider.js +116 -0
- package/dist/tools/lib/tts-provider.js.map +1 -0
- package/dist/tools/lib/types.d.ts +129 -0
- package/dist/tools/lib/types.d.ts.map +1 -0
- package/dist/tools/lib/types.js +64 -0
- package/dist/tools/lib/types.js.map +1 -0
- package/dist/tools/podcast-feed.d.ts +6 -0
- package/dist/tools/podcast-feed.d.ts.map +1 -0
- package/dist/tools/podcast-feed.js +121 -0
- package/dist/tools/podcast-feed.js.map +1 -0
- package/dist/tools/podcast-generate.d.ts +15 -0
- package/dist/tools/podcast-generate.d.ts.map +1 -0
- package/dist/tools/podcast-generate.js +318 -0
- package/dist/tools/podcast-generate.js.map +1 -0
- package/dist/tools/podcast-list.d.ts +6 -0
- package/dist/tools/podcast-list.d.ts.map +1 -0
- package/dist/tools/podcast-list.js +66 -0
- package/dist/tools/podcast-list.js.map +1 -0
- package/package.json +3 -2
- package/template/.gitignore +7 -0
- package/template/datas/fact-registry.json +17 -0
- package/template/eslint.config.js +3 -0
- package/template/functions/api/chat.ts +6 -1
- package/template/package.json +8 -6
- package/template/src/config.ts +6 -2
- package/template/src/data/blog/zh/alerts-examples.md +86 -0
- package/template/src/data/blog/zh/code-examples.md +168 -0
- package/template/src/data/blog/zh/markmap-examples.md +103 -0
- package/template/src/data/blog/zh/math-examples.md +81 -0
- package/template/src/data/blog/zh/mermaid-examples.md +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"podcast.d.ts","sourceRoot":"","sources":["../../src/commands/podcast.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqElE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const __dirname = fileURLToPath(new URL("..", import.meta.url));
|
|
6
|
+
const toolsDir = join(__dirname, "tools");
|
|
7
|
+
export async function podcastCommand(args) {
|
|
8
|
+
if (args.length === 0 || args[0] === "--help" || args[0] === "-h") {
|
|
9
|
+
console.log(`
|
|
10
|
+
Generate AI podcasts from blog posts
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
astro-minimax podcast <subcommand> [options]
|
|
14
|
+
|
|
15
|
+
Subcommands:
|
|
16
|
+
generate Generate podcasts from blog posts
|
|
17
|
+
list List generated podcasts
|
|
18
|
+
feed Generate podcast RSS feed
|
|
19
|
+
|
|
20
|
+
Options for "generate":
|
|
21
|
+
--force Regenerate all (ignore cache)
|
|
22
|
+
--slug=<slug> Process only specified post
|
|
23
|
+
--task=<type> "script" (text only) or "audio" (full)
|
|
24
|
+
--dry-run Preview without generating
|
|
25
|
+
--lang=<zh|en> Process only specified language
|
|
26
|
+
|
|
27
|
+
Description:
|
|
28
|
+
Converts blog posts to multi-speaker podcast audio using:
|
|
29
|
+
- LLM for script generation (host/guest dialogue)
|
|
30
|
+
- OpenAI TTS for audio synthesis
|
|
31
|
+
- FFmpeg for audio concatenation
|
|
32
|
+
|
|
33
|
+
Results cached in datas/podcast-scripts.json
|
|
34
|
+
Audio files saved to public/podcasts/{lang}/{slug}.mp3
|
|
35
|
+
|
|
36
|
+
Environment Variables:
|
|
37
|
+
AI_API_KEY OpenAI API key (required)
|
|
38
|
+
AI_BASE_URL API base URL (optional)
|
|
39
|
+
AI_MODEL Model for script generation (optional)
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
astro-minimax podcast generate
|
|
43
|
+
astro-minimax podcast generate --slug=zh/getting-started
|
|
44
|
+
astro-minimax podcast generate --task=script --dry-run
|
|
45
|
+
astro-minimax podcast list
|
|
46
|
+
astro-minimax podcast feed
|
|
47
|
+
`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const subcommand = args[0];
|
|
51
|
+
const subArgs = args.slice(1);
|
|
52
|
+
const blogDir = process.cwd();
|
|
53
|
+
const contentDir = join(blogDir, "src", "data", "blog");
|
|
54
|
+
if (!existsSync(contentDir)) {
|
|
55
|
+
console.error("Error: Not in an astro-minimax blog directory.");
|
|
56
|
+
console.error("Run this command from your blog's root directory.");
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
const scriptMap = {
|
|
60
|
+
generate: "podcast-generate.js",
|
|
61
|
+
list: "podcast-list.js",
|
|
62
|
+
feed: "podcast-feed.js",
|
|
63
|
+
};
|
|
64
|
+
const script = scriptMap[subcommand];
|
|
65
|
+
if (!script) {
|
|
66
|
+
console.error(`Unknown subcommand: ${subcommand}`);
|
|
67
|
+
console.error("Available: generate, list, feed");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
await runTool(script, subArgs, blogDir);
|
|
71
|
+
}
|
|
72
|
+
async function runTool(script, args, cwd) {
|
|
73
|
+
const scriptPath = join(toolsDir, script);
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const child = spawn("npx", ["tsx", scriptPath, ...args], {
|
|
76
|
+
stdio: "inherit",
|
|
77
|
+
shell: true,
|
|
78
|
+
cwd,
|
|
79
|
+
});
|
|
80
|
+
child.on("close", (code) => {
|
|
81
|
+
if (code === 0)
|
|
82
|
+
resolve();
|
|
83
|
+
else
|
|
84
|
+
reject(new Error(`Process exited with code ${code}`));
|
|
85
|
+
});
|
|
86
|
+
child.on("error", reject);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=podcast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"podcast.js","sourceRoot":"","sources":["../../src/commands/podcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc;IACjD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAClE,OAAO,C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AAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE;YACvD,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAI;YACX,GAAG;SACJ,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;;gBACrB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAQA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwElE"}
|
package/dist/commands/profile.js
CHANGED
|
@@ -13,15 +13,17 @@ Usage:
|
|
|
13
13
|
astro-minimax profile <subcommand>
|
|
14
14
|
|
|
15
15
|
Subcommands:
|
|
16
|
-
build Build complete author profile (context + voice + report)
|
|
16
|
+
build Build complete author profile (context + voice + facts + report)
|
|
17
17
|
context Build author context from posts
|
|
18
18
|
voice Build writing style profile
|
|
19
|
+
facts Build fact registry for AI accuracy
|
|
19
20
|
report Generate author profile report
|
|
20
21
|
|
|
21
22
|
Description:
|
|
22
23
|
Generates author-related data for AI-powered features:
|
|
23
24
|
- Author context: Writing patterns, topics, expertise
|
|
24
25
|
- Voice profile: Style characteristics for AI responses
|
|
26
|
+
- Fact registry: Verified facts to reduce AI hallucination
|
|
25
27
|
- Profile report: Structured author profile for About page
|
|
26
28
|
|
|
27
29
|
These profiles help the AI chat feature respond in a style
|
|
@@ -31,6 +33,7 @@ Examples:
|
|
|
31
33
|
astro-minimax profile build
|
|
32
34
|
astro-minimax profile context
|
|
33
35
|
astro-minimax profile voice
|
|
36
|
+
astro-minimax profile facts
|
|
34
37
|
astro-minimax profile report
|
|
35
38
|
`);
|
|
36
39
|
return;
|
|
@@ -47,16 +50,18 @@ Examples:
|
|
|
47
50
|
build: [
|
|
48
51
|
"build-author-context.js",
|
|
49
52
|
"build-voice-profile.js",
|
|
53
|
+
"build-fact-registry.js",
|
|
50
54
|
"generate-author-profile.js",
|
|
51
55
|
],
|
|
52
56
|
context: "build-author-context.js",
|
|
53
57
|
voice: "build-voice-profile.js",
|
|
58
|
+
facts: "build-fact-registry.js",
|
|
54
59
|
report: "generate-author-profile.js",
|
|
55
60
|
};
|
|
56
61
|
const scripts = scriptMap[subcommand];
|
|
57
62
|
if (!scripts) {
|
|
58
63
|
console.error(`Unknown subcommand: ${subcommand}`);
|
|
59
|
-
console.error("Available: build, context, voice, report");
|
|
64
|
+
console.error("Available: build, context, voice, facts, report");
|
|
60
65
|
process.exit(1);
|
|
61
66
|
}
|
|
62
67
|
if (Array.isArray(scripts)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,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AAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE;YACvD,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAI;YACX,GAAG;SACJ,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,EAAE,CAAC;;gBACrB,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* 构建事实注册表 (Fact Registry)
|
|
4
|
+
*
|
|
5
|
+
* 从博客内容、作者上下文、AI 摘要等数据中提取可验证的事实,
|
|
6
|
+
* 生成 fact-registry.json 供 AI 对话时注入 Prompt,减少幻觉。
|
|
7
|
+
*
|
|
8
|
+
* 用法:
|
|
9
|
+
* pnpm facts:build 构建事实注册表
|
|
10
|
+
* pnpm facts:build --force 强制全量重建
|
|
11
|
+
* pnpm facts:build --verbose 显示详细输出
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=build-fact-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-fact-registry.d.ts","sourceRoot":"","sources":["../../src/tools/build-fact-registry.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
|