autocrew 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autocrew",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "One-person content studio powered by AI — from trending topics to published posts",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -6,7 +6,10 @@ export const cmd: CommandDef = {
6
6
  description: "Generate a content draft from a topic (loads style + methodology + wiki)",
7
7
  usage: "autocrew draft <topic-title> [--platform <platform>]",
8
8
  action: async (args, runner) => {
9
- const topicTitle = args.filter((a) => !a.startsWith("--")).join(" ");
9
+ const flagsWithValues = ["--platform"];
10
+ const topicTitle = args
11
+ .filter((a, i) => !a.startsWith("--") && !flagsWithValues.includes(args[i - 1]))
12
+ .join(" ");
10
13
  if (!topicTitle) {
11
14
  console.error("Usage: autocrew draft <topic-title> [--platform <platform>]");
12
15
  console.error("Example: autocrew draft 'vibe-coding 实践者的真实工作流' --platform xiaohongshu");
@@ -5,7 +5,7 @@ export const cmd: CommandDef = {
5
5
  name: "render",
6
6
  description: "Render a video timeline (TTS + screenshots + Jianying export)",
7
7
  usage: "autocrew render <project-slug> [--voice <voiceId>] [--ratio <9:16|16:9>]",
8
- action: async (args, runner) => {
8
+ action: async (args, _runner, ctx) => {
9
9
  const slug = args[0];
10
10
  if (!slug) {
11
11
  console.error("Usage: autocrew render <project-slug> [--voice <voiceId>] [--ratio <9:16|16:9>]");
@@ -42,12 +42,9 @@ export const cmd: CommandDef = {
42
42
  }
43
43
 
44
44
  // Try to load studio
45
- let renderTimeline: any;
46
- let loadConfig: any;
45
+ let studio: any;
47
46
  try {
48
- const studio = await import("autocrew-studio");
49
- renderTimeline = studio.renderTimeline;
50
- loadConfig = studio.loadConfig;
47
+ studio = await import("autocrew-studio");
51
48
  } catch {
52
49
  console.error("autocrew-studio is not installed. Install it with:");
53
50
  console.error(" npm install autocrew-studio");
@@ -55,17 +52,34 @@ export const cmd: CommandDef = {
55
52
  return;
56
53
  }
57
54
 
58
- const config = loadConfig();
55
+ const config = await studio.loadConfig(ctx.dataDir);
59
56
  const outputDir = path.join(found.dir, "render");
60
57
 
58
+ // Instantiate providers from config
59
+ const tts = new studio.DoubaoTTS(config.tts.doubao || {});
60
+ const screenshot = new studio.PuppeteerScreenshot();
61
+
62
+ let exporter: { export(t: any, d: string): Promise<{ path: string; format: string }> };
63
+ if (config.compositor.provider === "ffmpeg") {
64
+ const compositor = new studio.FFmpegCompositor();
65
+ exporter = {
66
+ async export(t: any, outDir: string) {
67
+ const result = await compositor.compose(t, path.join(outDir, "output.mp4"));
68
+ return { path: result.path, format: result.format };
69
+ },
70
+ };
71
+ } else {
72
+ exporter = new studio.JianyingExporter();
73
+ }
74
+
61
75
  console.log(`Rendering timeline for "${slug}" (${ratio}, voice: ${voice})...`);
62
76
 
63
- const result = await renderTimeline({
77
+ const result = await studio.renderTimeline({
64
78
  timeline,
65
79
  outputDir,
66
- tts: config.tts,
67
- screenshot: config.screenshot,
68
- exporter: config.exporter,
80
+ tts,
81
+ screenshot,
82
+ exporter,
69
83
  voice: { voiceId: voice },
70
84
  });
71
85