Skip to content

Commit 7954463

Browse files
committed
feat: add concern field to flow tool for categorization and filtering
1 parent 763d71d commit 7954463

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const FlowParams = Type.Object({
178178
title: "FlowToolParams",
179179
description: "The root object MUST contain a 'flow' array. Never flatten fields to the root.",
180180
examples: [{
181-
flow: [{ type: "scout", intent: "Map auth module files", aim: "Map auth module", complexity: "moderate" }],
181+
flow: [{ type: "scout", intent: "Map auth module files", aim: "Map auth module", complexity: "moderate", concern: "The auth module was recently refactored — verify assumptions" }],
182182
}],
183183
});
184184

@@ -737,6 +737,7 @@ export default function (pi: ExtensionAPI) {
737737
intent: f.intent,
738738
aim: f.aim,
739739
acceptance: f.acceptance,
740+
concern: f.concern,
740741
cwd: f.cwd,
741742
complexity: f.complexity,
742743
preDispatchResults: preDispatchResults[i],

tests/index.test.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,42 @@ describe("flow tool execute", () => {
497497
expect(acceptanceProp.kind).toBe("optional");
498498
});
499499

500+
it("forwards concern to runFlow via flowItems", async () => {
501+
setupFlowsDir([
502+
{
503+
fileName: "build.md",
504+
content: `---\nname: build\ndescription: Build\n---\nPrompt.`,
505+
},
506+
]);
507+
508+
const pi = createMockPi();
509+
registerExtension(pi as any);
510+
await pi.trigger("session_start", {}, makeMockCtx(tmpDir));
511+
512+
vi.mocked(runFlow).mockResolvedValue({
513+
type: "scout",
514+
agentSource: "project",
515+
intent: "Discover things",
516+
aim: "Discover codebase",
517+
exitCode: 0,
518+
messages: [],
519+
stderr: "",
520+
usage: emptyFlowUsage(),
521+
});
522+
523+
const tool = pi.getTool("flow");
524+
await tool.execute(
525+
"call-1",
526+
{ flow: [{ type: "scout", intent: "Discover things", aim: "Discover codebase", complexity: "moderate", concern: "The auth module was recently refactored — verify assumptions" }], confirmProjectFlows: false },
527+
new AbortController().signal,
528+
undefined,
529+
makeMockCtx(tmpDir),
530+
);
531+
532+
expect(runFlow).toHaveBeenCalledTimes(1);
533+
expect(vi.mocked(runFlow).mock.calls[0][0].concern).toBe("The auth module was recently refactored — verify assumptions");
534+
});
535+
500536
it("uses PI_FLOW_COMPLEXITY as the default complexity", async () => {
501537
process.env.PI_FLOW_COMPLEXITY = "complex";
502538
setupFlowsDir([

0 commit comments

Comments
 (0)