返回 CodeWhale
operate_read_audit.workflow.js
根目录 / workflows / operate_read_audit.workflow.js
1 /**
2 * Operate starter — read-only parallel audit (scouts → synthesizer).
3 *
4 * Dogfood source: docs/examples/dogfood-automatic/wf_a1_read_only_audit.workflow.js
5 * Run: /workflow run workflows/operate_read_audit.workflow.js
6 */
7 export default async function (args) {
8 phase("Scout");
9 const [crates, unsafeHits, unwrapHits] = await parallel([
10 () =>
11 task({
12 description:
13 "List top-level crates and one-line role for each under crates/.",
14 label: "map crates",
15 type: "explore",
16 prompt:
17 "Read Cargo.toml workspace members and crates/*/Cargo.toml. Return a short bullet list of crate names and purposes. Read-only.",
18 }),
19 () =>
20 task({
21 description: "Find unsafe blocks in Rust sources.",
22 label: "scan unsafe",
23 type: "explore",
24 prompt:
25 "Search for `unsafe` in crates/**/*.rs (exclude target). Summarize count and notable hot paths. Read-only; no edits.",
26 }),
27 () =>
28 task({
29 description: "Find unwrap/expect in hot paths.",
30 label: "scan unwrap",
31 type: "explore",
32 prompt:
33 "Search for `.unwrap(` and `.expect(` in crates/tui and crates/engine (if present). Note densest files. Read-only.",
34 }),
35 ]);
36
37 phase("Synthesize");
38 // Synthesizer must stay read-only: type "general" is write-capable and
39 // requires writeRoots/exactFiles/coordinationContracts (dogfood 2026-07-24).
40 const summary = await task({
41 description: "Synthesize audit findings for the operator.",
42 label: "audit summary",
43 type: "review",
44 prompt: [
45 "Synthesize a concise security/reliability audit from these scout results.",
46 "Filter null/failed scouts. Group by severity. No file edits.",
47 "",
48 "crates:",
49 String(crates ?? "(missing)"),
50 "",
51 "unsafe:",
52 String(unsafeHits ?? "(missing)"),
53 "",
54 "unwrap:",
55 String(unwrapHits ?? "(missing)"),
56 ].join("\n"),
57 });
58
59 return {
60 scenario: "WF-A1",
61 goal: args?.goal ?? "read-only repo audit",
62 summary,
63 };
64 }
65
65 lines JAVASCRIPT