triage-ai 1.5.3 → 1.6.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.
@@ -3,38 +3,21 @@
3
3
  *
4
4
  * Uses the Claude CLI (claude command) for analysis.
5
5
  * Prompt is passed via stdin in -p (print) mode.
6
- * Output format is JSON — the CLI wraps the response in an envelope
7
- * with metadata (cost, duration, etc.). We unwrap it in parseOutput().
8
6
  *
9
7
  * Ported from triage_cli/models/claude.py
10
8
  */
11
9
  import { SubprocessModel } from './base.js';
12
- import type { ModelResult } from '../types.js';
13
10
  export declare class ClaudeModel extends SubprocessModel {
14
11
  constructor();
15
12
  /**
16
13
  * Build Claude CLI command.
17
14
  *
18
15
  * Uses -p (print) mode for non-interactive pipe operation.
19
- * --output-format json wraps the response in a metadata envelope,
20
- * which lets us detect truncation (incomplete envelope = truncated).
21
- * --effort high gives Claude more room for thorough analysis.
22
16
  * CLAUDECODE env var is unset so Claude can run from within Claude Code sessions.
23
17
  */
24
18
  _buildCommand(_promptFile: string): {
25
19
  cmd: string[];
26
20
  env: Record<string, string | undefined>;
27
21
  };
28
- /**
29
- * Unwrap Claude's JSON envelope before parsing findings.
30
- *
31
- * Claude --output-format json produces:
32
- * {"type":"result","subtype":"success","result":"...","cost_usd":...,...}
33
- *
34
- * We extract the "result" field (the actual model response text)
35
- * and pass it to the standard parseOutput() for JSON finding extraction.
36
- * If the envelope itself is truncated, we flag it and try to salvage.
37
- */
38
- parseOutput(output: string): ModelResult;
39
22
  }
40
23
  //# sourceMappingURL=claude.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/models/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,WAAY,SAAQ,eAAe;;IAQ9C;;;;;;;;OAQG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG;QAClC,GAAG,EAAE,MAAM,EAAE,CAAC;QACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;KACzC;IAeD;;;;;;;;;OASG;IACM,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;CAoDlD"}
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/models/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,WAAY,SAAQ,eAAe;;IAQ9C;;;;;OAKG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG;QAClC,GAAG,EAAE,MAAM,EAAE,CAAC;QACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;KACzC;CAOF"}
@@ -3,8 +3,6 @@
3
3
  *
4
4
  * Uses the Claude CLI (claude command) for analysis.
5
5
  * Prompt is passed via stdin in -p (print) mode.
6
- * Output format is JSON — the CLI wraps the response in an envelope
7
- * with metadata (cost, duration, etc.). We unwrap it in parseOutput().
8
6
  *
9
7
  * Ported from triage_cli/models/claude.py
10
8
  */
@@ -20,80 +18,14 @@ export class ClaudeModel extends SubprocessModel {
20
18
  * Build Claude CLI command.
21
19
  *
22
20
  * Uses -p (print) mode for non-interactive pipe operation.
23
- * --output-format json wraps the response in a metadata envelope,
24
- * which lets us detect truncation (incomplete envelope = truncated).
25
- * --effort high gives Claude more room for thorough analysis.
26
21
  * CLAUDECODE env var is unset so Claude can run from within Claude Code sessions.
27
22
  */
28
23
  _buildCommand(_promptFile) {
29
- const cmd = [...this.command, '-p', '--output-format', 'json'];
30
- // Configurable effort level (default: high for thorough analysis)
31
- const effort = process.env['TRIAGE_CLAUDE_EFFORT'] ?? 'high';
32
- if (effort !== 'none') {
33
- cmd.push('--effort', effort);
34
- }
24
+ const cmd = [...this.command, '-p', '--output-format', 'text'];
35
25
  return {
36
26
  cmd,
37
27
  env: { CLAUDECODE: undefined }, // Unset to allow nested sessions
38
28
  };
39
29
  }
40
- /**
41
- * Unwrap Claude's JSON envelope before parsing findings.
42
- *
43
- * Claude --output-format json produces:
44
- * {"type":"result","subtype":"success","result":"...","cost_usd":...,...}
45
- *
46
- * We extract the "result" field (the actual model response text)
47
- * and pass it to the standard parseOutput() for JSON finding extraction.
48
- * If the envelope itself is truncated, we flag it and try to salvage.
49
- */
50
- parseOutput(output) {
51
- const trimmed = output.trim();
52
- try {
53
- const envelope = JSON.parse(trimmed);
54
- if (envelope.type === 'result' && typeof envelope.result === 'string') {
55
- // Successfully unwrapped — parse the inner response
56
- const result = super.parseOutput(envelope.result);
57
- // Propagate error status from envelope
58
- if (envelope.is_error === true && !result.error) {
59
- result.error = `Claude reported error: ${envelope.subtype ?? 'unknown'}`;
60
- }
61
- return result;
62
- }
63
- }
64
- catch {
65
- // Envelope parse failed — could be truncated or non-JSON.
66
- // Check if it looks like a truncated envelope (starts with {"type":"result")
67
- if (trimmed.startsWith('{"type":"result"') || trimmed.startsWith('{ "type": "result"')) {
68
- // Truncated envelope — try to extract partial "result" field
69
- const resultMatch = trimmed.match(/"result"\s*:\s*"([\s\S]*)/);
70
- if (resultMatch) {
71
- // Extract everything after "result":" — it's likely truncated
72
- let inner = resultMatch[1];
73
- // Remove trailing envelope fields if partially present
74
- const lastQuote = inner.lastIndexOf('"');
75
- if (lastQuote > 0) {
76
- inner = inner.slice(0, lastQuote);
77
- }
78
- // Unescape JSON string escapes
79
- try {
80
- inner = JSON.parse(`"${inner}"`);
81
- }
82
- catch {
83
- // Use raw if unescape fails
84
- inner = inner.replace(/\\n/g, '\n').replace(/\\"/g, '"').replace(/\\\\/g, '\\');
85
- }
86
- const result = super.parseOutput(inner);
87
- result.output_truncated = true;
88
- if (!result.error) {
89
- result.error = 'Claude output was truncated (incomplete JSON envelope)';
90
- }
91
- return result;
92
- }
93
- }
94
- }
95
- // Fallback: treat entire output as raw text (pre-envelope format or unexpected)
96
- return super.parseOutput(output);
97
- }
98
30
  }
99
31
  //# sourceMappingURL=claude.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/models/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,MAAM,OAAO,WAAY,SAAQ,eAAe;IAC9C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,WAAmB;QAI/B,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAE/D,kEAAkE;QAClE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,MAAM,CAAC;QAC7D,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO;YACL,GAAG;YACH,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,iCAAiC;SAClE,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACM,WAAW,CAAC,MAAc;QACjC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAE9B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;YAEhE,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,QAAQ,CAAC,MAAM,KAA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,CAAC;oBAClF,CAAC;oBAED,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;oBACxC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;oBAC/B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;wBAClB,MAAM,CAAC,KAAK,GAAG,wDAAwD,CAAC;oBAC1E,CAAC;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAED,gFAAgF;QAChF,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF"}
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/models/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,OAAO,WAAY,SAAQ,eAAe;IAC9C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACH,aAAa,CAAC,WAAmB;QAI/B,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO;YACL,GAAG;YACH,GAAG,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,iCAAiC;SAClE,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triage-ai",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "description": "Multi-model code triage — run Claude, Gemini and Codex in parallel to analyze your codebase and merge their findings",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",