@payconductor/houndsman 0.10.0 → 0.12.0
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/README.md +4 -19
- package/package.json +1 -1
- package/src/cli/help.ts +0 -7
- package/src/cli/index.ts +9 -3
- package/src/core/ai/ai-client.ts +3 -7
- package/src/core/ai/ai-sdk-model-provider.ts +4 -24
- package/src/core/ai/features/brief-enricher.ts +0 -1
- package/src/core/ai/features/classifier.ts +0 -1
- package/src/core/ai/features/context-summarizer.ts +0 -1
- package/src/core/ai/features/pre-analyzer.ts +0 -1
- package/src/core/ai/features/technical-summarizer.ts +0 -1
- package/src/core/ai/features/verifier.ts +0 -1
- package/src/core/ai/index.ts +0 -3
- package/src/core/ai/prompts/base.ts +7 -0
- package/src/core/ai/prompts/context.ts +2 -1
- package/src/core/ai/prompts/pre-analysis.ts +3 -2
- package/src/core/ai/prompts/technical.ts +2 -1
- package/src/core/ai/schemas.ts +1 -23
- package/src/core/ai/types.ts +2 -15
- package/src/core/ai/usage-budget.ts +1 -1
- package/src/core/ast/diff.ts +37 -2
- package/src/core/ast/service.ts +1 -1
- package/src/core/brief.ts +54 -5
- package/src/core/changed-scope.ts +207 -0
- package/src/core/commands/scaffold.ts +1 -18
- package/src/core/config-loader.ts +18 -4
- package/src/core/config.ts +2 -15
- package/src/core/defaults.ts +0 -6
- package/src/core/engine/review-scope.ts +55 -8
- package/src/core/engine/review-workspace.ts +6 -2
- package/src/core/jev/jev-detector.ts +7 -2
- package/src/core/logging/index.ts +1 -1
- package/src/core/logging/logger.ts +3 -3
- package/src/core/orchestrator.ts +19 -14
- package/src/core/project-config.ts +0 -28
- package/src/core/registry-check.ts +2 -12
- package/src/core/rule-text.ts +3 -55
- package/src/core/services/git-repository.ts +8 -0
- package/src/core/services/worktree-manager.ts +61 -2
- package/src/core/storage/types.ts +0 -1
- package/src/core/types.ts +3 -14
- package/src/index.ts +25 -3
- package/src/server/client/utils/constants.ts +3 -6
- package/src/server/client/utils/types.ts +0 -1
- package/src/skill/OUTPUT-FORMAT.md +5 -0
- package/src/skill/README.md +2 -1
- package/src/skill/SETUP.md +1 -1
- package/src/skill/fix.md +1 -1
- package/src/skill/hunt.md +2 -6
- package/src/tests/__snapshots__/baseline.test.ts.snap +50 -32
- package/src/tests/ai-features.test.ts +11 -0
- package/src/tests/changed-scope.test.ts +197 -0
- package/src/tests/fallback.test.ts +1 -96
- package/src/tests/fixtures/fake-model-provider.ts +0 -1
- package/src/tests/review-scope.test.ts +33 -0
- package/src/tests/worktree.test.ts +72 -4
- package/src/cli/commands/hunt-command.ts +0 -51
- package/src/harness/README.md +0 -15
- package/src/harness/agent/agent-context.ts +0 -33
- package/src/harness/agent/agent-errors.ts +0 -30
- package/src/harness/agent/agent-factory.ts +0 -46
- package/src/harness/agent/agent-reporter.ts +0 -34
- package/src/harness/agent/agent-result.ts +0 -16
- package/src/harness/agent/agent-runner.ts +0 -32
- package/src/harness/agent/agent-scheduler.ts +0 -37
- package/src/harness/agent/review-agent.ts +0 -401
- package/src/harness/config/harness-config.ts +0 -89
- package/src/harness/hunt/hunt-harness.ts +0 -83
- package/src/harness/hunt/hunt-options.ts +0 -92
- package/src/harness/hunt/hunt-result.ts +0 -17
- package/src/harness/hunt/hunt-session.ts +0 -359
- package/src/harness/hunt/review-planner.ts +0 -98
- package/src/harness/index.ts +0 -36
- package/src/harness/investigation/agent-state.ts +0 -134
- package/src/harness/investigation/evidence-verifier.ts +0 -129
- package/src/harness/investigation/evidence.ts +0 -110
- package/src/harness/investigation/finding-critic.ts +0 -96
- package/src/harness/investigation/investigation-planner.ts +0 -118
- package/src/harness/investigation/investigation-task.ts +0 -10
- package/src/harness/investigation/review-journal.ts +0 -87
- package/src/harness/investigation/rule-analyzer.ts +0 -178
- package/src/harness/investigation/rule-signals.ts +0 -110
- package/src/harness/prompts/agent-schemas.ts +0 -57
- package/src/harness/prompts/reviewer-prompt-builder.ts +0 -101
- package/src/harness/prompts/states/conclude-prompt.ts +0 -16
- package/src/harness/prompts/states/investigate-prompt.ts +0 -37
- package/src/harness/prompts/states/orient-prompt.ts +0 -15
- package/src/harness/prompts/states/verify-prompt.ts +0 -22
- package/src/harness/tools/agent-tool.ts +0 -102
- package/src/harness/tools/builtin/changed-symbols-tool.ts +0 -48
- package/src/harness/tools/builtin/doc-context-tool.ts +0 -74
- package/src/harness/tools/builtin/file-outline-tool.ts +0 -66
- package/src/harness/tools/builtin/find-references-tool.ts +0 -66
- package/src/harness/tools/builtin/find-symbol-tool.ts +0 -91
- package/src/harness/tools/builtin/helpers.ts +0 -115
- package/src/harness/tools/builtin/impact-tool.ts +0 -48
- package/src/harness/tools/builtin/imports-exports-tool.ts +0 -53
- package/src/harness/tools/builtin/index.ts +0 -59
- package/src/harness/tools/builtin/list-files-tool.ts +0 -85
- package/src/harness/tools/builtin/pr-context-tool.ts +0 -41
- package/src/harness/tools/builtin/read-file-range-tool.ts +0 -73
- package/src/harness/tools/builtin/rule-signals-tool.ts +0 -36
- package/src/harness/tools/builtin/search-code-tool.ts +0 -65
- package/src/harness/tools/builtin/symbol-context-tool.ts +0 -106
- package/src/harness/tools/builtin/tests-for-symbol-tool.ts +0 -61
- package/src/harness/tools/path-guard.ts +0 -90
- package/src/harness/tools/result-limiter.ts +0 -49
- package/src/harness/tools/secret-redactor.ts +0 -54
- package/src/harness/tools/tool-cache.ts +0 -50
- package/src/harness/tools/tool-call-budget.ts +0 -60
- package/src/harness/tools/tool-context.ts +0 -5
- package/src/harness/tools/tool-middleware.ts +0 -105
- package/src/harness/tools/tool-policy.ts +0 -51
- package/src/harness/tools/tool-registry.ts +0 -112
- package/src/harness/tools/tool-result.ts +0 -15
- package/src/harness/tools/toolbox.ts +0 -36
- package/src/harness/validation/finding-validator.ts +0 -119
- package/src/tests/fixtures/fake-agent-tools.ts +0 -69
- package/src/tests/fixtures/fake-investigation.ts +0 -64
- package/src/tests/harness-agent.test.ts +0 -141
- package/src/tests/harness-investigation.test.ts +0 -206
- package/src/tests/harness-tools.test.ts +0 -148
- package/src/tests/hunt-command.test.ts +0 -212
- package/src/tests/rule-analyzer.test.ts +0 -61
- package/src/tests/tool-contracts.test.ts +0 -82
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RuleAnalyzer — polaridade, categoria, sinais e hints.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, expect, test } from "bun:test";
|
|
6
|
-
import { RuleAnalyzer } from "../harness/investigation/rule-analyzer";
|
|
7
|
-
|
|
8
|
-
const analyzer = new RuleAnalyzer();
|
|
9
|
-
|
|
10
|
-
describe("RuleAnalyzer", () => {
|
|
11
|
-
test("detecta polaridade explícita", () => {
|
|
12
|
-
const [avoid, promote] = analyzer.analyze([
|
|
13
|
-
{ severity: "blocking", text: "Evitar: chamar banco diretamente em rotas." },
|
|
14
|
-
{ severity: "attention", text: "Promover: usar `logger` estruturado." },
|
|
15
|
-
]);
|
|
16
|
-
expect(avoid?.intent).toBe("avoid");
|
|
17
|
-
expect(promote?.intent).toBe("promote");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test("classifica categoria por keywords", () => {
|
|
21
|
-
const [data, tests] = analyzer.analyze([
|
|
22
|
-
{
|
|
23
|
-
severity: "attention",
|
|
24
|
-
text: "Evitar: query direta no banco sem migration.",
|
|
25
|
-
},
|
|
26
|
-
{ severity: "nit", text: "Promover: cobertura de teste no handler." },
|
|
27
|
-
]);
|
|
28
|
-
expect(data?.category).toBe("data");
|
|
29
|
-
expect(tests?.category).toBe("tests");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test("extrai sinais de backticks e hints (confiança alta)", () => {
|
|
33
|
-
const [analysis] = analyzer.analyze([
|
|
34
|
-
{
|
|
35
|
-
severity: "blocking",
|
|
36
|
-
text: "Evitar: usar `db.query` fora do service.",
|
|
37
|
-
hints: {
|
|
38
|
-
symbols: ["OrderService"],
|
|
39
|
-
imports: ["db"],
|
|
40
|
-
checks: ["symbol_context"],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
]);
|
|
44
|
-
expect(analysis?.confidence).toBe("high");
|
|
45
|
-
expect(analysis?.signals.some((signal) => signal.value === "OrderService")).toBe(
|
|
46
|
-
true,
|
|
47
|
-
);
|
|
48
|
-
expect(analysis?.signals.some((signal) => signal.value === "db")).toBe(true);
|
|
49
|
-
expect(analysis?.checks.some((check) => check.tool === "symbol_context")).toBe(
|
|
50
|
-
true,
|
|
51
|
-
);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test("keywords ignoram stopwords", () => {
|
|
55
|
-
const [analysis] = analyzer.analyze([
|
|
56
|
-
{ severity: "nit", text: "Nunca usar any em produção" },
|
|
57
|
-
]);
|
|
58
|
-
expect(analysis?.keywords).not.toContain("nunca");
|
|
59
|
-
expect(analysis?.keywords).toContain("produção");
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Contract test das tools built-in: metadata, schema e erros estruturados.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { describe, expect, test } from "bun:test";
|
|
6
|
-
import { AstService } from "../core/ast/service";
|
|
7
|
-
import { Watchdog } from "../core/domain/watchdog";
|
|
8
|
-
import { SilentReporter } from "../harness/agent/agent-reporter";
|
|
9
|
-
import { AgentState } from "../harness/investigation/agent-state";
|
|
10
|
-
import type { ToolContext } from "../harness/tools/agent-tool";
|
|
11
|
-
import { BuiltinToolsModule } from "../harness/tools/builtin";
|
|
12
|
-
import { ToolCache } from "../harness/tools/tool-cache";
|
|
13
|
-
import { ToolCallBudget } from "../harness/tools/tool-call-budget";
|
|
14
|
-
import { ToolMiddleware } from "../harness/tools/tool-middleware";
|
|
15
|
-
import { ToolRegistry } from "../harness/tools/tool-registry";
|
|
16
|
-
import { fakeAgentContext } from "./fixtures/fake-investigation";
|
|
17
|
-
import { fakeHoundsmanConfig } from "./fixtures/fake-project";
|
|
18
|
-
|
|
19
|
-
function registry(): ToolRegistry {
|
|
20
|
-
const value = new ToolRegistry();
|
|
21
|
-
value.registerModule(new BuiltinToolsModule());
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function context(): ToolContext {
|
|
26
|
-
return {
|
|
27
|
-
repoRoot: process.cwd(),
|
|
28
|
-
watchdog: new Watchdog(fakeHoundsmanConfig.watchdogs.alpha),
|
|
29
|
-
diff: { byFile: new Map(), churn: new Map() },
|
|
30
|
-
ast: new AstService(fakeHoundsmanConfig),
|
|
31
|
-
state: new AgentState(),
|
|
32
|
-
budget: new ToolCallBudget(20, 10),
|
|
33
|
-
cache: new ToolCache(),
|
|
34
|
-
logger: new SilentReporter(),
|
|
35
|
-
agent: fakeAgentContext({ repoRoot: process.cwd() }),
|
|
36
|
-
rules: new Map(),
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
describe("contratos das tools", () => {
|
|
41
|
-
test("todas declaram metadata read-only e capabilities", () => {
|
|
42
|
-
for (const tool of registry().list()) {
|
|
43
|
-
expect(tool.metadata.name.length).toBeGreaterThan(0);
|
|
44
|
-
expect(tool.metadata.description.length).toBeGreaterThan(0);
|
|
45
|
-
expect(tool.metadata.readOnly).toBe(true);
|
|
46
|
-
expect(tool.metadata.capabilities.length).toBeGreaterThan(0);
|
|
47
|
-
expect(tool.metadata.cost).toBeGreaterThanOrEqual(1);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("nenhuma tool devolve arquivo inteiro por padrão", () => {
|
|
52
|
-
// `read_file_range` exige faixa explícita.
|
|
53
|
-
const range = registry().get("read_file_range");
|
|
54
|
-
expect(range?.inputSchema.safeParse({ path: "a.ts" }).success).toBe(false);
|
|
55
|
-
// `file_outline` só devolve metadados (não tem parâmetro de corpo).
|
|
56
|
-
const outline = registry().get("file_outline");
|
|
57
|
-
expect(outline?.inputSchema.safeParse({ path: "a.ts" }).success).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test("tools de arquivo devolvem erro estruturado (não lançam)", async () => {
|
|
61
|
-
const middleware = new ToolMiddleware();
|
|
62
|
-
for (const [name, input] of [
|
|
63
|
-
["read_file_range", { path: "../x", startLine: 1, endLine: 2 }],
|
|
64
|
-
["file_outline", { path: "../x" }],
|
|
65
|
-
["imports_exports", { file: "../x" }],
|
|
66
|
-
] as const) {
|
|
67
|
-
const result = await registry().execute(name, input, context(), middleware);
|
|
68
|
-
expect(result.ok).toBe(false);
|
|
69
|
-
expect(typeof result.error).toBe("string");
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test("rule_signals devolve erro quando a regra não existe", async () => {
|
|
74
|
-
const result = await registry().execute(
|
|
75
|
-
"rule_signals",
|
|
76
|
-
{ rule: "regra inexistente" },
|
|
77
|
-
context(),
|
|
78
|
-
new ToolMiddleware(),
|
|
79
|
-
);
|
|
80
|
-
expect(result.ok).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
});
|