@nathapp/nax 0.45.0 → 0.46.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 (33) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin/nax.ts +7 -6
  3. package/dist/nax.js +181 -124
  4. package/package.json +1 -1
  5. package/src/agents/acp/adapter.ts +34 -6
  6. package/src/agents/acp/index.ts +0 -2
  7. package/src/agents/acp/parser.ts +57 -104
  8. package/src/agents/acp/spawn-client.ts +2 -1
  9. package/src/agents/{claude.ts → claude/adapter.ts} +15 -12
  10. package/src/agents/{claude-complete.ts → claude/complete.ts} +3 -3
  11. package/src/agents/{cost.ts → claude/cost.ts} +1 -1
  12. package/src/agents/{claude-execution.ts → claude/execution.ts} +5 -5
  13. package/src/agents/claude/index.ts +3 -0
  14. package/src/agents/{claude-interactive.ts → claude/interactive.ts} +4 -4
  15. package/src/agents/{claude-plan.ts → claude/plan.ts} +12 -9
  16. package/src/agents/index.ts +5 -5
  17. package/src/agents/registry.ts +5 -5
  18. package/src/agents/{claude-decompose.ts → shared/decompose.ts} +2 -2
  19. package/src/agents/{model-resolution.ts → shared/model-resolution.ts} +2 -2
  20. package/src/agents/{types-extended.ts → shared/types-extended.ts} +4 -4
  21. package/src/agents/{validation.ts → shared/validation.ts} +2 -2
  22. package/src/agents/{version-detection.ts → shared/version-detection.ts} +3 -3
  23. package/src/agents/types.ts +8 -4
  24. package/src/cli/agents.ts +1 -1
  25. package/src/pipeline/stages/acceptance.ts +5 -8
  26. package/src/pipeline/stages/regression.ts +2 -0
  27. package/src/pipeline/stages/verify.ts +5 -10
  28. package/src/precheck/checks-agents.ts +1 -1
  29. package/src/utils/log-test-output.ts +25 -0
  30. /package/src/agents/{adapters/aider.ts → aider/adapter.ts} +0 -0
  31. /package/src/agents/{adapters/codex.ts → codex/adapter.ts} +0 -0
  32. /package/src/agents/{adapters/gemini.ts → gemini/adapter.ts} +0 -0
  33. /package/src/agents/{adapters/opencode.ts → opencode/adapter.ts} +0 -0
@@ -27,6 +27,7 @@
27
27
  import path from "node:path";
28
28
  import { getLogger } from "../../logger";
29
29
  import { countStories } from "../../prd";
30
+ import { logTestOutput } from "../../utils/log-test-output";
30
31
  import type { PipelineContext, PipelineStage, StageResult } from "../types";
31
32
 
32
33
  /**
@@ -163,10 +164,8 @@ export const acceptanceStage: PipelineStage = {
163
164
 
164
165
  // Non-zero exit but no AC failures parsed at all — test crashed (syntax error, import failure, etc.)
165
166
  if (failedACs.length === 0 && exitCode !== 0) {
166
- logger.error("acceptance", "Tests errored with no AC failures parsed", {
167
- exitCode,
168
- output,
169
- });
167
+ logger.error("acceptance", "Tests errored with no AC failures parsed", { exitCode });
168
+ logTestOutput(logger, "acceptance", output);
170
169
 
171
170
  ctx.acceptanceFailures = {
172
171
  failedACs: ["AC-ERROR"],
@@ -190,10 +189,8 @@ export const acceptanceStage: PipelineStage = {
190
189
  });
191
190
  }
192
191
 
193
- logger.error("acceptance", "Acceptance tests failed", {
194
- failedACs: actualFailures,
195
- output,
196
- });
192
+ logger.error("acceptance", "Acceptance tests failed", { failedACs: actualFailures });
193
+ logTestOutput(logger, "acceptance", output);
197
194
 
198
195
  // Store failed ACs and test output in context for fix generation
199
196
  ctx.acceptanceFailures = {
@@ -14,6 +14,7 @@
14
14
  */
15
15
 
16
16
  import { getLogger } from "../../logger";
17
+ import { logTestOutput } from "../../utils/log-test-output";
17
18
  import { verificationOrchestrator } from "../../verification/orchestrator";
18
19
  import type { VerifyContext } from "../../verification/orchestrator-types";
19
20
  import { pipelineEventBus } from "../event-bus";
@@ -71,6 +72,7 @@ export const regressionStage: PipelineStage = {
71
72
  storyId: ctx.story.id,
72
73
  failCount: result.failCount,
73
74
  });
75
+ logTestOutput(logger, "regression", result.rawOutput, { storyId: ctx.story.id });
74
76
 
75
77
  pipelineEventBus.emit({
76
78
  type: "regression:detected",
@@ -11,6 +11,7 @@
11
11
 
12
12
  import type { SmartTestRunnerConfig } from "../../config/types";
13
13
  import { getLogger } from "../../logger";
14
+ import { logTestOutput } from "../../utils/log-test-output";
14
15
  import { detectRuntimeCrash } from "../../verification/crash-detector";
15
16
  import type { VerifyStatus } from "../../verification/orchestrator-types";
16
17
  import { regression } from "../../verification/runners";
@@ -173,16 +174,10 @@ export const verifyStage: PipelineStage = {
173
174
  });
174
175
  }
175
176
 
176
- // Log first few lines of output for context
177
- // BUG-037: Changed from .slice(0, 10) to .slice(-20) to show failures, not prechecks
178
- if (result.output && result.status !== "TIMEOUT") {
179
- const outputLines = result.output.split("\n").slice(-20);
180
- if (outputLines.length > 0) {
181
- logger.debug("verify", "Test output preview", {
182
- storyId: ctx.story.id,
183
- output: outputLines.join("\n"),
184
- });
185
- }
177
+ // Log tail of output at debug level for context (ENH-001)
178
+ // BUG-037: Use .slice(-20) to show failures, not prechecks
179
+ if (result.status !== "TIMEOUT") {
180
+ logTestOutput(logger, "verify", result.output, { storyId: ctx.story.id });
186
181
  }
187
182
 
188
183
  return {
@@ -5,7 +5,7 @@
5
5
  * and checks health status for each configured agent.
6
6
  */
7
7
 
8
- import { getAgentVersions } from "../agents/version-detection";
8
+ import { getAgentVersions } from "../agents/shared/version-detection";
9
9
  import type { Check } from "./types";
10
10
 
11
11
  /**
@@ -0,0 +1,25 @@
1
+ import type { Logger } from "../logger";
2
+
3
+ /**
4
+ * Log test output consistently across all pipeline stages.
5
+ *
6
+ * Summary (exitCode, storyId) is logged at the caller's level (error/warn).
7
+ * Raw output is logged at debug level only — last `tailLines` lines.
8
+ *
9
+ * `storyId` is optional: works for per-story verify/acceptance AND for
10
+ * deferred runs (deferred acceptance, deferred regression) with no story context.
11
+ */
12
+ export function logTestOutput(
13
+ logger: Logger | null | undefined,
14
+ stage: string,
15
+ output: string | undefined,
16
+ opts: { storyId?: string; tailLines?: number } = {},
17
+ ): void {
18
+ if (!logger || !output) return;
19
+ const tailLines = opts.tailLines ?? 20;
20
+ const lines = output.split("\n").slice(-tailLines).join("\n");
21
+ logger.debug(stage, "Test output (tail)", {
22
+ ...(opts.storyId !== undefined && { storyId: opts.storyId }),
23
+ output: lines,
24
+ });
25
+ }