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