autocrew 0.3.1 → 0.3.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 +1 -1
- package/src/cli/index.ts +3 -1
- package/src/tools/content-save.ts +24 -1
- package/src/tools/pipeline-ops.ts +10 -1
- package/src/tools/registry.ts +13 -5
- package/src/tools/research.ts +19 -6
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI command router — parses argv and dispatches to the matching command.
|
|
3
3
|
*/
|
|
4
|
+
import { createRequire } from "node:module";
|
|
4
5
|
import { commands } from "./commands/index.js";
|
|
5
6
|
import { showBanner } from "./banner.js";
|
|
6
7
|
import type { ToolRunner } from "../runtime/tool-runner.js";
|
|
7
8
|
import type { ToolContext } from "../runtime/context.js";
|
|
8
9
|
import type { EventBus } from "../runtime/events.js";
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const { version: VERSION } = require("../../package.json");
|
|
11
13
|
|
|
12
14
|
export async function run(argv: string[], runner: ToolRunner, ctx: ToolContext, eventBus: EventBus): Promise<void> {
|
|
13
15
|
const subcommand = argv[0];
|
|
@@ -84,7 +84,30 @@ export async function executeContentSave(params: Record<string, unknown>) {
|
|
|
84
84
|
|
|
85
85
|
if (action === "list") {
|
|
86
86
|
const contents = await listContents(dataDir);
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
// Also list pipeline drafting projects (these may not exist in legacy contents/)
|
|
89
|
+
const pipelineProjects: Array<{ slug: string; title: string; stage: string; current: string }> = [];
|
|
90
|
+
try {
|
|
91
|
+
const { listProjects, getProjectMeta, stagePath } = await import("../storage/pipeline-store.js");
|
|
92
|
+
for (const stage of ["drafting", "production", "published"] as const) {
|
|
93
|
+
const slugs = await listProjects(stage, dataDir);
|
|
94
|
+
for (const slug of slugs) {
|
|
95
|
+
const meta = await getProjectMeta(slug, dataDir);
|
|
96
|
+
if (meta) {
|
|
97
|
+
pipelineProjects.push({
|
|
98
|
+
slug,
|
|
99
|
+
title: meta.title,
|
|
100
|
+
stage,
|
|
101
|
+
current: meta.current,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} catch {
|
|
107
|
+
// Pipeline store may not be initialized
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return { ok: true, contents, pipelineProjects };
|
|
88
111
|
}
|
|
89
112
|
|
|
90
113
|
if (action === "get") {
|
|
@@ -62,7 +62,16 @@ export async function executePipelineOps(params: Record<string, unknown>) {
|
|
|
62
62
|
return { ok: false, error: "Missing 'project' — provide a topic slug to start from." };
|
|
63
63
|
}
|
|
64
64
|
const dir = await startProject(project, dataDir);
|
|
65
|
-
return {
|
|
65
|
+
return {
|
|
66
|
+
ok: true,
|
|
67
|
+
action: "start",
|
|
68
|
+
projectDir: dir,
|
|
69
|
+
nextStep:
|
|
70
|
+
"Project structure created with empty draft.md. " +
|
|
71
|
+
"NEXT: Write the content draft and save it using autocrew_content action='save' " +
|
|
72
|
+
"with title and body. The save action handles pipeline integration, version tracking, " +
|
|
73
|
+
"and auto-humanization. Do NOT use the Write tool to edit draft.md directly.",
|
|
74
|
+
};
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
case "advance": {
|
package/src/tools/registry.ts
CHANGED
|
@@ -47,8 +47,12 @@ export function registerAllTools(runner: ToolRunner): void {
|
|
|
47
47
|
name: "autocrew_content",
|
|
48
48
|
label: "AutoCrew Content",
|
|
49
49
|
description:
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"Content creation and lifecycle management. THIS IS THE PRIMARY CONTENT CREATION TOOL. " +
|
|
51
|
+
"To create content: use action='save' with title and body (the full draft text). " +
|
|
52
|
+
"The tool handles pipeline project creation, version tracking, and auto-humanization. " +
|
|
53
|
+
"Workflow: 1) Research with autocrew_intel, 2) Write the full draft body, " +
|
|
54
|
+
"3) Save with autocrew_content action='save' (title, body, platform, hypothesis, tags). " +
|
|
55
|
+
"Other actions: list, get, update, transition, create_variant, siblings, allowed_transitions.",
|
|
52
56
|
parameters: contentSaveSchema,
|
|
53
57
|
execute: executeContentSave,
|
|
54
58
|
});
|
|
@@ -145,8 +149,10 @@ export function registerAllTools(runner: ToolRunner): void {
|
|
|
145
149
|
name: "autocrew_intel",
|
|
146
150
|
label: "AutoCrew 灵感源",
|
|
147
151
|
description:
|
|
148
|
-
"
|
|
149
|
-
"
|
|
152
|
+
"Content research and inspiration pipeline. Use this BEFORE writing content to gather real data, " +
|
|
153
|
+
"case studies, and trends. Actions: pull (collect from web search/RSS/trends — primary research tool), " +
|
|
154
|
+
"list (show saved intel), clean (archive expired), ingest (manually add url/text/memory sources). " +
|
|
155
|
+
"Research results feed into the knowledge wiki and are referenced during content creation.",
|
|
150
156
|
parameters: intelSchema,
|
|
151
157
|
execute: executeIntel,
|
|
152
158
|
});
|
|
@@ -155,7 +161,9 @@ export function registerAllTools(runner: ToolRunner): void {
|
|
|
155
161
|
name: "autocrew_pipeline_ops",
|
|
156
162
|
label: "AutoCrew Pipeline Ops",
|
|
157
163
|
description:
|
|
158
|
-
"Content pipeline lifecycle management. Actions: status (stage counts), start (topic→project
|
|
164
|
+
"Content pipeline lifecycle management. Actions: status (stage counts), start (topic→project — creates project structure, NOT content), " +
|
|
165
|
+
"advance (next stage — requires draft.md with ≥100 chars), version (add draft revision), trash, restore. " +
|
|
166
|
+
"NOTE: 'start' only creates the project folder. To create actual content, use autocrew_content action='save' with the full draft body.",
|
|
159
167
|
parameters: pipelineOpsSchema,
|
|
160
168
|
execute: executePipelineOps,
|
|
161
169
|
});
|
package/src/tools/research.ts
CHANGED
|
@@ -235,13 +235,26 @@ async function runDiscovery(params: Record<string, unknown>) {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
if (items.length === 0) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
// All sources failed. Instead of returning useless placeholders,
|
|
239
|
+
// tell the caller to use the intel pipeline which has working
|
|
240
|
+
// web search + RSS + trends collectors.
|
|
241
|
+
return {
|
|
242
|
+
ok: false,
|
|
243
|
+
mode: "failed",
|
|
241
244
|
platform,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
+
keyword,
|
|
246
|
+
industry: industry || null,
|
|
247
|
+
sourcesUsed,
|
|
248
|
+
error:
|
|
249
|
+
"所有调研源都未返回结果(browser/API/free engine)。" +
|
|
250
|
+
"建议使用 autocrew_intel action='pull' 进行内容调研," +
|
|
251
|
+
"它支持 web search + RSS + 趋势热榜,不依赖浏览器登录态。",
|
|
252
|
+
suggestion: {
|
|
253
|
+
tool: "autocrew_intel",
|
|
254
|
+
action: "pull",
|
|
255
|
+
keywords: [keyword],
|
|
256
|
+
},
|
|
257
|
+
};
|
|
245
258
|
}
|
|
246
259
|
|
|
247
260
|
const topics = items.slice(0, topicCount).map((item) => ({
|