tewip-ai 0.68.0 → 0.69.1
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/dist/mcp/github-report.js +35 -5
- package/package.json +1 -1
|
@@ -24,6 +24,33 @@ async function latestReports(repo, branch) {
|
|
|
24
24
|
}
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Which of the artifact's reports to show, and in what order.
|
|
29
|
+
*
|
|
30
|
+
* This used to be two hard-coded names, `pr-comment.md` and `infra.md`, which are what the Action's
|
|
31
|
+
* *triage* mode writes. Its **check** mode writes a different set - `checks.md`, `done.md`,
|
|
32
|
+
* `schema.md`, `standards.md`, `vouch.md`, `access.md` - under the same artifact name, and both
|
|
33
|
+
* modes were read by the same two lines. Found by running `tewip ci hmamut39/tewip` against Tewip's
|
|
34
|
+
* own repository, whose self-check workflow runs in check mode: the artifact held 9KB of findings
|
|
35
|
+
* across six files and the command printed **167 characters** - a title, a run link, and nothing
|
|
36
|
+
* underneath. The answer to "why did CI fail on my PR?" was a URL.
|
|
37
|
+
*
|
|
38
|
+
* So the artifact decides what is shown, not this file. `pr-comment.md` leads when it exists because
|
|
39
|
+
* it is the one written to be read by a person on a pull request; `infra.md` stays behind its ENV
|
|
40
|
+
* count because it is about the machines rather than the change; everything else is named and shown.
|
|
41
|
+
*/
|
|
42
|
+
const LEADS = ['pr-comment.md', 'checks.md'];
|
|
43
|
+
export function reportsIn(files, envCount) {
|
|
44
|
+
const text = (name) => (files.get(name)?.toString('utf8') ?? '').trim();
|
|
45
|
+
const names = [...files.keys()].filter((n) => n.endsWith('.md'));
|
|
46
|
+
const ordered = [...LEADS.filter((n) => names.includes(n)), ...names.filter((n) => !LEADS.includes(n)).sort()];
|
|
47
|
+
return ordered
|
|
48
|
+
.filter((name) => (name === 'infra.md' ? envCount > 0 : true))
|
|
49
|
+
.map((name) => ({ name, body: text(name) }))
|
|
50
|
+
.filter((r) => r.body.length > 0);
|
|
51
|
+
}
|
|
52
|
+
/** A report's own heading if it has one, else its filename turned into words. */
|
|
53
|
+
const titleOf = (name) => name.replace(/\.md$/, '').replace(/[-_]/g, ' ');
|
|
27
54
|
export async function githubCiReport(repo, pr, branch) {
|
|
28
55
|
const head = pr ? (await ghApi(`repos/${repo}/pulls/${pr}`)).head.ref : branch;
|
|
29
56
|
const target = pr ? `PR #${pr} (${head})` : head ? `branch ${head}` : 'any branch';
|
|
@@ -37,14 +64,17 @@ export async function githubCiReport(repo, pr, branch) {
|
|
|
37
64
|
const bundle = JSON.parse(text('triage.json') || '{}');
|
|
38
65
|
const envCount = (bundle.items ?? []).filter((i) => i.diagnosis.category === 'ENV').length;
|
|
39
66
|
const suite = artifact.name.replace(/^(?:tewip|triage-agent)-report-?/, '');
|
|
67
|
+
const reports = reportsIn(files, envCount);
|
|
68
|
+
// A header with nothing under it is the worst of the three possible answers here, because it
|
|
69
|
+
// reads as "CI is fine" to anyone who does not know what the artifact was supposed to contain.
|
|
70
|
+
const body = reports.length > 0
|
|
71
|
+
? reports.map((r, i) => (i === 0 && LEADS.includes(r.name) ? r.body : `## ${titleOf(r.name)}\n\n${r.body}`)).join('\n\n')
|
|
72
|
+
: `This run's \`${artifact.name}\` artifact has nothing Tewip can show. It holds ${files.size === 0 ? 'no files' : `${files.size} file(s): ${[...files.keys()].sort().join(', ')}`}, and none of them has any content. The run itself is at ${found.run.html_url}.`;
|
|
40
73
|
sections.push([
|
|
41
74
|
`# Tewip CI report: ${repo}, ${target}${suite ? ` - suite "${suite}"` : ''}`,
|
|
42
75
|
`Run: ${bundle.runUrl ?? found.run.html_url} · commit \`${(bundle.sha ?? found.run.head_sha).slice(0, 8)}\` · generated ${bundle.generatedAt ?? artifact.created_at}${bundle.fixPr ? ` · verified fix PR: ${bundle.fixPr}` : ''}`,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
]
|
|
46
|
-
.filter(Boolean)
|
|
47
|
-
.join('\n\n'));
|
|
76
|
+
body,
|
|
77
|
+
].join('\n\n'));
|
|
48
78
|
}
|
|
49
79
|
return cap(sections.join('\n\n---\n\n'));
|
|
50
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tewip-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.1",
|
|
4
4
|
"mcpName": "io.github.hmamut39/tewip",
|
|
5
5
|
"description": "Tewip finds why each failing test failed - real bug, flaky test, environment, test data or changed selector - for any stack, from the command line, CI, or your editor.",
|
|
6
6
|
"keywords": [
|