@payconductor/houndsman 0.11.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.
Files changed (118) hide show
  1. package/README.md +4 -19
  2. package/package.json +1 -1
  3. package/src/cli/help.ts +0 -7
  4. package/src/cli/index.ts +0 -2
  5. package/src/core/ai/ai-client.ts +3 -7
  6. package/src/core/ai/ai-sdk-model-provider.ts +4 -24
  7. package/src/core/ai/features/brief-enricher.ts +0 -1
  8. package/src/core/ai/features/classifier.ts +0 -1
  9. package/src/core/ai/features/context-summarizer.ts +0 -1
  10. package/src/core/ai/features/pre-analyzer.ts +0 -1
  11. package/src/core/ai/features/technical-summarizer.ts +0 -1
  12. package/src/core/ai/features/verifier.ts +0 -1
  13. package/src/core/ai/index.ts +0 -3
  14. package/src/core/ai/prompts/pre-analysis.ts +3 -2
  15. package/src/core/ai/schemas.ts +1 -23
  16. package/src/core/ai/types.ts +2 -15
  17. package/src/core/ai/usage-budget.ts +1 -1
  18. package/src/core/ast/diff.ts +37 -2
  19. package/src/core/ast/service.ts +1 -1
  20. package/src/core/brief.ts +54 -5
  21. package/src/core/changed-scope.ts +207 -0
  22. package/src/core/commands/scaffold.ts +1 -18
  23. package/src/core/config.ts +2 -15
  24. package/src/core/defaults.ts +0 -6
  25. package/src/core/engine/review-scope.ts +55 -8
  26. package/src/core/jev/jev-detector.ts +7 -2
  27. package/src/core/logging/index.ts +1 -1
  28. package/src/core/logging/logger.ts +3 -3
  29. package/src/core/orchestrator.ts +19 -14
  30. package/src/core/project-config.ts +0 -28
  31. package/src/core/registry-check.ts +2 -12
  32. package/src/core/rule-text.ts +3 -55
  33. package/src/core/services/git-repository.ts +8 -0
  34. package/src/core/storage/types.ts +0 -1
  35. package/src/core/types.ts +3 -14
  36. package/src/index.ts +25 -3
  37. package/src/server/client/utils/constants.ts +3 -6
  38. package/src/server/client/utils/types.ts +0 -1
  39. package/src/skill/OUTPUT-FORMAT.md +5 -0
  40. package/src/skill/README.md +2 -1
  41. package/src/skill/SETUP.md +1 -1
  42. package/src/skill/fix.md +1 -1
  43. package/src/skill/hunt.md +2 -6
  44. package/src/tests/__snapshots__/baseline.test.ts.snap +50 -32
  45. package/src/tests/changed-scope.test.ts +197 -0
  46. package/src/tests/fallback.test.ts +1 -96
  47. package/src/tests/fixtures/fake-model-provider.ts +0 -1
  48. package/src/tests/review-scope.test.ts +33 -0
  49. package/src/tests/worktree.test.ts +1 -3
  50. package/src/cli/commands/hunt-command.ts +0 -51
  51. package/src/harness/README.md +0 -15
  52. package/src/harness/agent/agent-context.ts +0 -33
  53. package/src/harness/agent/agent-errors.ts +0 -30
  54. package/src/harness/agent/agent-factory.ts +0 -46
  55. package/src/harness/agent/agent-reporter.ts +0 -34
  56. package/src/harness/agent/agent-result.ts +0 -16
  57. package/src/harness/agent/agent-runner.ts +0 -32
  58. package/src/harness/agent/agent-scheduler.ts +0 -37
  59. package/src/harness/agent/review-agent.ts +0 -401
  60. package/src/harness/config/harness-config.ts +0 -89
  61. package/src/harness/hunt/hunt-harness.ts +0 -83
  62. package/src/harness/hunt/hunt-options.ts +0 -92
  63. package/src/harness/hunt/hunt-result.ts +0 -17
  64. package/src/harness/hunt/hunt-session.ts +0 -359
  65. package/src/harness/hunt/review-planner.ts +0 -98
  66. package/src/harness/index.ts +0 -36
  67. package/src/harness/investigation/agent-state.ts +0 -134
  68. package/src/harness/investigation/evidence-verifier.ts +0 -129
  69. package/src/harness/investigation/evidence.ts +0 -110
  70. package/src/harness/investigation/finding-critic.ts +0 -96
  71. package/src/harness/investigation/investigation-planner.ts +0 -118
  72. package/src/harness/investigation/investigation-task.ts +0 -10
  73. package/src/harness/investigation/review-journal.ts +0 -87
  74. package/src/harness/investigation/rule-analyzer.ts +0 -178
  75. package/src/harness/investigation/rule-signals.ts +0 -110
  76. package/src/harness/prompts/agent-schemas.ts +0 -57
  77. package/src/harness/prompts/reviewer-prompt-builder.ts +0 -101
  78. package/src/harness/prompts/states/conclude-prompt.ts +0 -16
  79. package/src/harness/prompts/states/investigate-prompt.ts +0 -37
  80. package/src/harness/prompts/states/orient-prompt.ts +0 -15
  81. package/src/harness/prompts/states/verify-prompt.ts +0 -22
  82. package/src/harness/tools/agent-tool.ts +0 -102
  83. package/src/harness/tools/builtin/changed-symbols-tool.ts +0 -48
  84. package/src/harness/tools/builtin/doc-context-tool.ts +0 -74
  85. package/src/harness/tools/builtin/file-outline-tool.ts +0 -66
  86. package/src/harness/tools/builtin/find-references-tool.ts +0 -66
  87. package/src/harness/tools/builtin/find-symbol-tool.ts +0 -91
  88. package/src/harness/tools/builtin/helpers.ts +0 -115
  89. package/src/harness/tools/builtin/impact-tool.ts +0 -48
  90. package/src/harness/tools/builtin/imports-exports-tool.ts +0 -53
  91. package/src/harness/tools/builtin/index.ts +0 -59
  92. package/src/harness/tools/builtin/list-files-tool.ts +0 -85
  93. package/src/harness/tools/builtin/pr-context-tool.ts +0 -41
  94. package/src/harness/tools/builtin/read-file-range-tool.ts +0 -73
  95. package/src/harness/tools/builtin/rule-signals-tool.ts +0 -36
  96. package/src/harness/tools/builtin/search-code-tool.ts +0 -65
  97. package/src/harness/tools/builtin/symbol-context-tool.ts +0 -106
  98. package/src/harness/tools/builtin/tests-for-symbol-tool.ts +0 -61
  99. package/src/harness/tools/path-guard.ts +0 -90
  100. package/src/harness/tools/result-limiter.ts +0 -49
  101. package/src/harness/tools/secret-redactor.ts +0 -54
  102. package/src/harness/tools/tool-cache.ts +0 -50
  103. package/src/harness/tools/tool-call-budget.ts +0 -60
  104. package/src/harness/tools/tool-context.ts +0 -5
  105. package/src/harness/tools/tool-middleware.ts +0 -105
  106. package/src/harness/tools/tool-policy.ts +0 -51
  107. package/src/harness/tools/tool-registry.ts +0 -112
  108. package/src/harness/tools/tool-result.ts +0 -15
  109. package/src/harness/tools/toolbox.ts +0 -36
  110. package/src/harness/validation/finding-validator.ts +0 -119
  111. package/src/tests/fixtures/fake-agent-tools.ts +0 -69
  112. package/src/tests/fixtures/fake-investigation.ts +0 -64
  113. package/src/tests/harness-agent.test.ts +0 -141
  114. package/src/tests/harness-investigation.test.ts +0 -206
  115. package/src/tests/harness-tools.test.ts +0 -148
  116. package/src/tests/hunt-command.test.ts +0 -212
  117. package/src/tests/rule-analyzer.test.ts +0 -61
  118. 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
- });