返回 CodeWhale
wf_a1_read_only_audit.workflow.js
根目录 / docs / examples / dogfood-automatic / wf_a1_read_only_audit.workflow.js
1 /**
2 * #4131 WF-A1 — read-only repo audit (dogfood fixture).
3 *
4 * Expected: scout phase with read-only children, then a synthesizer that
5 * produces an operator-facing summary. No write tools required.
6 *
7 * Run: /workflow run docs/examples/dogfood-automatic/wf_a1_read_only_audit.workflow.js
8 */
9 export default async function (args) {
10 phase("Scout");
11 const [crates, unsafeHits, unwrapHits] = await parallel([
12 () =>
13 task({
14 description:
15 "List top-level crates and one-line role for each under crates/.",
16 label: "map crates",
17 type: "explore",
18 prompt:
19 "Read Cargo.toml workspace members and crates/*/Cargo.toml. Return a short bullet list of crate names and purposes. Read-only.",
20 }),
21 () =>
22 task({
23 description: "Find unsafe blocks in Rust sources.",
24 label: "scan unsafe",
25 type: "explore",
26 prompt:
27 "Search for `unsafe` in crates/**/*.rs (exclude target). Summarize count and notable hot paths. Read-only; no edits.",
28 }),
29 () =>
30 task({
31 description: "Find unwrap/expect in hot paths.",
32 label: "scan unwrap",
33 type: "explore",
34 prompt:
35 "Search for `.unwrap(` and `.expect(` in crates/tui and crates/engine (if present). Note densest files. Read-only.",
36 }),
37 ]);
38
39 phase("Synthesize");
40 const summary = await task({
41 description: "Synthesize audit findings for the operator.",
42 label: "audit summary",
43 type: "general",
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