@imenam/mcp-dependabot-tracker 1.0.6 → 1.0.8
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 +14 -6
- package/dist/shared/alerts.d.ts +5 -1
- package/dist/shared/alerts.js +13 -0
- package/dist/shared/schemas/api.schema.d.ts +33 -4
- package/dist/shared/schemas/ipc.schema.d.ts +1 -1
- package/dist/shared/schemas/ipc.schema.js +3 -0
- package/dist/shared/schemas/model.schema.d.ts +40 -2
- package/dist/shared/schemas/model.schema.js +13 -2
- package/dist/src/core/audit-all.d.ts +24 -0
- package/dist/src/core/audit-all.js +62 -0
- package/dist/src/core/github.d.ts +14 -2
- package/dist/src/core/github.js +19 -1
- package/dist/src/core/operations.d.ts +8 -0
- package/dist/src/core/operations.js +30 -1
- package/dist/src/core/repos.d.ts +27 -6
- package/dist/src/core/repos.js +53 -12
- package/dist/src/core/store.js +14 -2
- package/dist/src/gui-worker.js +3 -0
- package/dist/src/index.js +16 -4
- package/dist/src/tools/format.js +7 -0
- package/gui/dist/assets/index-D_wlwOtv.js +64 -0
- package/gui/dist/assets/{index-DYqEypkM.css → index-U8DEkNi4.css} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/gui/dist/assets/index-CzKoNRZJ.js +0 -63
package/dist/src/core/repos.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type Alert, type AlertSeverity, type HandledAlert, type Operation, type Repo, type Rights } from "../../shared/schemas/model.schema.js";
|
|
2
|
-
import type { RepoView } from "../../shared/schemas/api.schema.js";
|
|
1
|
+
import { type Alert, type AlertSeverity, type HandledAlert, type Operation, type PullRequest, type Repo, type Rights } from "../../shared/schemas/model.schema.js";
|
|
2
|
+
import type { AuditFindings, RepoView } from "../../shared/schemas/api.schema.js";
|
|
3
3
|
import type { GitHubConfig } from "./config.js";
|
|
4
|
+
import { type OpenPullRequest } from "./github.js";
|
|
4
5
|
import { type Store } from "./store.js";
|
|
5
6
|
/** Ancienneté au-delà de laquelle les alertes d'un dépôt sont relues sur GitHub. */
|
|
6
7
|
export declare const SYNC_INTERVAL_MS: number;
|
|
@@ -9,12 +10,14 @@ export declare function sortAlerts(alerts: Alert[]): Alert[];
|
|
|
9
10
|
/** Nombre d'alertes ouvertes par gravité. */
|
|
10
11
|
export declare function countBySeverity(alerts: Alert[]): Record<AlertSeverity, number>;
|
|
11
12
|
/**
|
|
12
|
-
* Dépôts triés par gravité la plus haute, puis par nombre
|
|
13
|
-
* nom
|
|
14
|
-
*
|
|
13
|
+
* Dépôts triés par gravité la plus haute, puis par nombre de vulnérabilités,
|
|
14
|
+
* puis par nom. Comptent les alertes non corrigées à la main et, sans alerte,
|
|
15
|
+
* les vulnérabilités du dernier audit ; un dépôt sans rien de tout cela vient
|
|
16
|
+
* en dernier.
|
|
15
17
|
*/
|
|
16
18
|
export declare function sortRepos<T extends {
|
|
17
19
|
repo: Repo;
|
|
20
|
+
auditFindings?: AuditFindings | null;
|
|
18
21
|
}>(views: T[]): T[];
|
|
19
22
|
/**
|
|
20
23
|
* Date du dernier audit, quand il n'a trouvé aucune vulnérabilité alors que
|
|
@@ -23,6 +26,12 @@ export declare function sortRepos<T extends {
|
|
|
23
26
|
* alertes. Null sinon. `operations` va de la plus récente à la plus ancienne.
|
|
24
27
|
*/
|
|
25
28
|
export declare function cleanAuditAt(repo: Repo, operations: Operation[]): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Vulnérabilités trouvées par le dernier audit de la branche par défaut, la
|
|
31
|
+
* seule que Dependabot analyse, quand Dependabot ne signale aucune alerte.
|
|
32
|
+
* Null sinon. `operations` va de la plus récente à la plus ancienne.
|
|
33
|
+
*/
|
|
34
|
+
export declare function auditFindings(repo: Repo, operations: Operation[]): AuditFindings | null;
|
|
26
35
|
/**
|
|
27
36
|
* Paquets pour lesquels le dernier audit n'a trouvé aucune version corrigée,
|
|
28
37
|
* hors ceux dont une alerte est marquée corrigée à la main. `operations` va de
|
|
@@ -35,10 +44,22 @@ export declare function unfixablePackages(repo: Repo, operations: Operation[]):
|
|
|
35
44
|
* depuis le marquage.
|
|
36
45
|
*/
|
|
37
46
|
export declare function pruneHandledAlerts(handled: HandledAlert[], alerts: Alert[]): HandledAlert[];
|
|
47
|
+
/**
|
|
48
|
+
* Pull requests ouvertes par le tracker parmi celles ouvertes sur le dépôt :
|
|
49
|
+
* leur branche suit le nommage `fix/npm-audit-…` et appartient au dépôt
|
|
50
|
+
* lui-même, pas à une fourche. Par numéro croissant.
|
|
51
|
+
*/
|
|
52
|
+
export declare function trackerPullRequests(repoId: string, pulls: OpenPullRequest[]): PullRequest[];
|
|
38
53
|
export declare function repoView(store: Store, repo: Repo): RepoView;
|
|
39
54
|
export declare function listRepoViews(store: Store): RepoView[];
|
|
40
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Relit les alertes Dependabot ouvertes du dépôt et ses pull requests ouvertes
|
|
57
|
+
* par le tracker ; un échec est enregistré dans `syncError`, données précédentes
|
|
58
|
+
* conservées.
|
|
59
|
+
*/
|
|
41
60
|
export declare function syncRepository(store: Store, config: GitHubConfig, repoId: string): Promise<Repo>;
|
|
61
|
+
/** Relit tout de suite, en parallèle, les alertes et les pull requests de chaque dépôt suivi. */
|
|
62
|
+
export declare function syncAllRepositories(store: Store, config: GitHubConfig): Promise<void>;
|
|
42
63
|
/** Suit un nouveau dépôt, rangé dans `categoryId`, avec l'audit pour seul droit de l'agent, puis lit ses alertes. */
|
|
43
64
|
export declare function addRepository(store: Store, config: GitHubConfig, input: string, categoryId: string | null): Promise<Repo>;
|
|
44
65
|
/** Dépôts accessibles au token qui ne sont pas encore suivis, proposés à l'ajout. */
|
package/dist/src/core/repos.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { pendingAlerts } from "../../shared/alerts.js";
|
|
1
|
+
import { fromNpmSeverity, pendingAlerts, worstOf } from "../../shared/alerts.js";
|
|
2
2
|
import { ALERT_SEVERITIES, DEFAULT_RIGHTS } from "../../shared/schemas/model.schema.js";
|
|
3
3
|
import { ConflictError, NotFoundError } from "./errors.js";
|
|
4
4
|
import { GitHubClient } from "./github.js";
|
|
5
|
+
import { isTrackerBranch } from "./operations.js";
|
|
5
6
|
import { parseRepoRef } from "./repo-ref.js";
|
|
6
7
|
import { isActive } from "./store.js";
|
|
7
8
|
/** Ancienneté au-delà de laquelle les alertes d'un dépôt sont relues sur GitHub. */
|
|
@@ -21,19 +22,23 @@ export function countBySeverity(alerts) {
|
|
|
21
22
|
return counts;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
* Dépôts triés par gravité la plus haute, puis par nombre
|
|
25
|
-
* nom
|
|
26
|
-
*
|
|
25
|
+
* Dépôts triés par gravité la plus haute, puis par nombre de vulnérabilités,
|
|
26
|
+
* puis par nom. Comptent les alertes non corrigées à la main et, sans alerte,
|
|
27
|
+
* les vulnérabilités du dernier audit ; un dépôt sans rien de tout cela vient
|
|
28
|
+
* en dernier.
|
|
27
29
|
*/
|
|
28
30
|
export function sortRepos(views) {
|
|
29
|
-
const key = (
|
|
30
|
-
const pending = pendingAlerts(repo);
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const key = (view) => {
|
|
32
|
+
const pending = pendingAlerts(view.repo);
|
|
33
|
+
const severities = pending.map((alert) => alert.severity);
|
|
34
|
+
if (view.auditFindings)
|
|
35
|
+
severities.push(view.auditFindings.severity);
|
|
36
|
+
const worst = severities.reduce((best, severity) => Math.min(best, severityRank(severity)), ALERT_SEVERITIES.length);
|
|
37
|
+
return { worst, count: pending.length + (view.auditFindings?.count ?? 0) };
|
|
33
38
|
};
|
|
34
39
|
return [...views].sort((a, b) => {
|
|
35
|
-
const ka = key(a
|
|
36
|
-
const kb = key(b
|
|
40
|
+
const ka = key(a);
|
|
41
|
+
const kb = key(b);
|
|
37
42
|
return ka.worst - kb.worst || kb.count - ka.count || a.repo.id.localeCompare(b.repo.id);
|
|
38
43
|
});
|
|
39
44
|
}
|
|
@@ -52,6 +57,20 @@ export function cleanAuditAt(repo, operations) {
|
|
|
52
57
|
const auditedAt = Date.parse(audited.createdAt);
|
|
53
58
|
return repo.alerts.every((alert) => Date.parse(alert.createdAt) <= auditedAt) ? audited.createdAt : null;
|
|
54
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Vulnérabilités trouvées par le dernier audit de la branche par défaut, la
|
|
62
|
+
* seule que Dependabot analyse, quand Dependabot ne signale aucune alerte.
|
|
63
|
+
* Null sinon. `operations` va de la plus récente à la plus ancienne.
|
|
64
|
+
*/
|
|
65
|
+
export function auditFindings(repo, operations) {
|
|
66
|
+
if (repo.alerts.length > 0)
|
|
67
|
+
return null;
|
|
68
|
+
const audited = operations.find((operation) => operation.steps.audit === "done" && operation.baseBranch === repo.defaultBranch);
|
|
69
|
+
const severity = audited ? worstOf(audited.found.map((vulnerability) => fromNpmSeverity(vulnerability.severity))) : null;
|
|
70
|
+
if (!audited || severity === null)
|
|
71
|
+
return null;
|
|
72
|
+
return { at: audited.createdAt, count: audited.found.length, severity };
|
|
73
|
+
}
|
|
55
74
|
/**
|
|
56
75
|
* Paquets pour lesquels le dernier audit n'a trouvé aucune version corrigée,
|
|
57
76
|
* hors ceux dont une alerte est marquée corrigée à la main. `operations` va de
|
|
@@ -74,6 +93,17 @@ export function pruneHandledAlerts(handled, alerts) {
|
|
|
74
93
|
const open = new Set(alerts.map((alert) => alert.number));
|
|
75
94
|
return handled.filter((mark) => open.has(mark.number) && !alerts.some((alert) => alert.package === mark.package && Date.parse(alert.createdAt) > Date.parse(mark.markedAt)));
|
|
76
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Pull requests ouvertes par le tracker parmi celles ouvertes sur le dépôt :
|
|
98
|
+
* leur branche suit le nommage `fix/npm-audit-…` et appartient au dépôt
|
|
99
|
+
* lui-même, pas à une fourche. Par numéro croissant.
|
|
100
|
+
*/
|
|
101
|
+
export function trackerPullRequests(repoId, pulls) {
|
|
102
|
+
return pulls
|
|
103
|
+
.filter((pull) => isTrackerBranch(pull.branch) && pull.headRepo?.toLowerCase() === repoId.toLowerCase())
|
|
104
|
+
.sort((a, b) => a.number - b.number)
|
|
105
|
+
.map(({ number, url, branch, createdAt }) => ({ number, url, branch, createdAt }));
|
|
106
|
+
}
|
|
77
107
|
export function repoView(store, repo) {
|
|
78
108
|
const operations = store.listOperations(repo.id);
|
|
79
109
|
return {
|
|
@@ -82,6 +112,7 @@ export function repoView(store, repo) {
|
|
|
82
112
|
activeOperation: operations.find(isActive) ?? null,
|
|
83
113
|
latestOperation: operations[0] ?? null,
|
|
84
114
|
cleanAuditAt: cleanAuditAt(repo, operations),
|
|
115
|
+
auditFindings: auditFindings(repo, operations),
|
|
85
116
|
unfixable: unfixablePackages(repo, operations),
|
|
86
117
|
};
|
|
87
118
|
}
|
|
@@ -89,16 +120,21 @@ export function listRepoViews(store) {
|
|
|
89
120
|
store.failOrphanedOperations();
|
|
90
121
|
return sortRepos(store.listRepos().map((repo) => repoView(store, repo)));
|
|
91
122
|
}
|
|
92
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Relit les alertes Dependabot ouvertes du dépôt et ses pull requests ouvertes
|
|
125
|
+
* par le tracker ; un échec est enregistré dans `syncError`, données précédentes
|
|
126
|
+
* conservées.
|
|
127
|
+
*/
|
|
93
128
|
export async function syncRepository(store, config, repoId) {
|
|
94
129
|
const repo = store.getRepo(repoId);
|
|
95
130
|
const github = new GitHubClient(config);
|
|
96
131
|
try {
|
|
97
|
-
const alerts = await github.listOpenAlerts(repo.owner, repo.name);
|
|
132
|
+
const [alerts, pulls] = await Promise.all([github.listOpenAlerts(repo.owner, repo.name), github.listOpenPullRequests(repo.owner, repo.name)]);
|
|
98
133
|
return store.updateRepo(repo.id, (current) => ({
|
|
99
134
|
...current,
|
|
100
135
|
alerts,
|
|
101
136
|
handledAlerts: pruneHandledAlerts(current.handledAlerts, alerts),
|
|
137
|
+
pullRequests: trackerPullRequests(current.id, pulls),
|
|
102
138
|
syncedAt: new Date().toISOString(),
|
|
103
139
|
syncError: null,
|
|
104
140
|
}));
|
|
@@ -108,6 +144,10 @@ export async function syncRepository(store, config, repoId) {
|
|
|
108
144
|
return store.updateRepo(repo.id, (current) => ({ ...current, syncedAt: new Date().toISOString(), syncError: message }));
|
|
109
145
|
}
|
|
110
146
|
}
|
|
147
|
+
/** Relit tout de suite, en parallèle, les alertes et les pull requests de chaque dépôt suivi. */
|
|
148
|
+
export async function syncAllRepositories(store, config) {
|
|
149
|
+
await Promise.all(store.listRepos().map((repo) => syncRepository(store, config, repo.id)));
|
|
150
|
+
}
|
|
111
151
|
/** Suit un nouveau dépôt, rangé dans `categoryId`, avec l'audit pour seul droit de l'agent, puis lit ses alertes. */
|
|
112
152
|
export async function addRepository(store, config, input, categoryId) {
|
|
113
153
|
const ref = parseRepoRef(input);
|
|
@@ -127,6 +167,7 @@ export async function addRepository(store, config, input, categoryId) {
|
|
|
127
167
|
rights: DEFAULT_RIGHTS,
|
|
128
168
|
alerts: [],
|
|
129
169
|
handledAlerts: [],
|
|
170
|
+
pullRequests: [],
|
|
130
171
|
syncedAt: null,
|
|
131
172
|
syncError: null,
|
|
132
173
|
});
|
package/dist/src/core/store.js
CHANGED
|
@@ -39,7 +39,8 @@ export function processAlive(pid) {
|
|
|
39
39
|
* Complète un fichier écrit par une version antérieure : un dépôt sans branche
|
|
40
40
|
* choisie analyse sa branche par défaut, un dépôt sans catégorie n'est rangé
|
|
41
41
|
* dans aucune, un fichier sans catégories n'en a aucune, un dépôt sans alerte
|
|
42
|
-
* corrigée à la main n'en a aucune
|
|
42
|
+
* corrigée à la main n'en a aucune, un dépôt sans pull request en attente n'en
|
|
43
|
+
* a aucune jusqu'à sa lecture suivante. Une alerte sans date
|
|
43
44
|
* d'émission prend celle de la lecture qui l'a rapportée ; la lecture suivante
|
|
44
45
|
* la remplace par la vraie.
|
|
45
46
|
*/
|
|
@@ -54,12 +55,23 @@ function normalizeReposFile(file) {
|
|
|
54
55
|
branch: typeof repo?.branch === "string" ? repo.branch : repo?.defaultBranch,
|
|
55
56
|
categoryId: repo?.categoryId ?? null,
|
|
56
57
|
handledAlerts: repo?.handledAlerts ?? [],
|
|
58
|
+
pullRequests: repo?.pullRequests ?? [],
|
|
57
59
|
alerts: Array.isArray(repo?.alerts)
|
|
58
60
|
? repo.alerts.map((alert) => ({ ...alert, createdAt: alert?.createdAt ?? repo.syncedAt ?? repo.addedAt }))
|
|
59
61
|
: repo?.alerts,
|
|
60
62
|
})),
|
|
61
63
|
};
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Complète une opération écrite par une version antérieure : sans `found`, les
|
|
67
|
+
* vulnérabilités du premier audit sont `remaining` tant qu'aucune correction
|
|
68
|
+
* n'a suivi, et inconnues sinon.
|
|
69
|
+
*/
|
|
70
|
+
function normalizeOperation(operation) {
|
|
71
|
+
if (operation === null || typeof operation !== "object" || operation.found !== undefined)
|
|
72
|
+
return operation;
|
|
73
|
+
return { ...operation, found: operation.counts?.afterFix === null ? operation.remaining : [] };
|
|
74
|
+
}
|
|
63
75
|
function sameName(a, b) {
|
|
64
76
|
return a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
65
77
|
}
|
|
@@ -265,7 +277,7 @@ export class Store {
|
|
|
265
277
|
return null;
|
|
266
278
|
throw err;
|
|
267
279
|
}
|
|
268
|
-
const parsed = OperationSchema.safeParse(JSON.parse(raw));
|
|
280
|
+
const parsed = OperationSchema.safeParse(normalizeOperation(JSON.parse(raw)));
|
|
269
281
|
if (!parsed.success)
|
|
270
282
|
throw new TrackerError(`${file} is invalid: ${parsed.error.message}`);
|
|
271
283
|
return parsed.data;
|
package/dist/src/gui-worker.js
CHANGED
|
@@ -195,6 +195,9 @@ app.post("/api/repos", async (c) => {
|
|
|
195
195
|
return read.response;
|
|
196
196
|
return forward(c, "ADD_REPO", { body: read.body });
|
|
197
197
|
});
|
|
198
|
+
app.post("/api/sync", (c) => forward(c, "SYNC_REPOS"));
|
|
199
|
+
app.get("/api/audit-all", (c) => forward(c, "GET_AUDIT_ALL"));
|
|
200
|
+
app.post("/api/audit-all", (c) => forward(c, "START_AUDIT_ALL"));
|
|
198
201
|
app.get("/api/github/repos", (c) => forward(c, "LIST_ADDABLE_REPOS"));
|
|
199
202
|
app.get("/api/repos/:owner/:name", (c) => forward(c, "GET_REPO", { repoId: repoId(c) }));
|
|
200
203
|
app.delete("/api/repos/:owner/:name", (c) => forward(c, "REMOVE_REPO", { repoId: repoId(c) }));
|
package/dist/src/index.js
CHANGED
|
@@ -13,8 +13,9 @@ import { resolveLogDir } from "./core/log-dir.js";
|
|
|
13
13
|
import { githubConfigured, readGitHubConfig } from "./core/config.js";
|
|
14
14
|
import { ConflictError, NotFoundError, TrackerError } from "./core/errors.js";
|
|
15
15
|
import { Store } from "./core/store.js";
|
|
16
|
-
import { cancelOperation, decideForce, pushOperation, startUserFix } from "./core/operations.js";
|
|
17
|
-
import {
|
|
16
|
+
import { cancelOperation, decideForce, pushOperation, runDefaultBranchAudit, startUserFix } from "./core/operations.js";
|
|
17
|
+
import { AuditAll } from "./core/audit-all.js";
|
|
18
|
+
import { SYNC_INTERVAL_MS, addRepository, listAddableRepositories, listRepoBranches, listRepoViews, markAlertHandled, setBranch, setCategory, repoView, setRights, staleRepos, syncAllRepositories, syncRepository, unmarkAlertHandled } from "./core/repos.js";
|
|
18
19
|
import { GUI_REQUEST_TYPES, IPCMessageSchema } from "../shared/schemas/ipc.schema.js";
|
|
19
20
|
import { AddRepoBodySchema, AlertRequestSchema, CategoryBodySchema, CategoryRequestSchema, ForceBodySchema, OperationRequestSchema, PushBodySchema, RepoRequestSchema, SetBranchBodySchema, SetCategoryBodySchema, SetRightsBodySchema, } from "../shared/schemas/api.schema.js";
|
|
20
21
|
import { errorResult, textResult } from "./tools/types.js";
|
|
@@ -71,11 +72,13 @@ const operations = {
|
|
|
71
72
|
cloneDir: resolveCloneDir,
|
|
72
73
|
logError: (message) => logger.error(message),
|
|
73
74
|
};
|
|
75
|
+
/** Série « Auditer tout » de la GUI servie par ce processus. */
|
|
76
|
+
const auditAll = new AuditAll((repoId) => runDefaultBranchAudit(operations, repoId), (message) => logger.error(message));
|
|
74
77
|
/** Présentation du serveur transmise au client MCP : concepts, déroulé et règles. */
|
|
75
78
|
const INSTRUCTIONS = `mcp-dependabot-tracker follows the Dependabot alerts of GitHub repositories and fixes their npm vulnerabilities. The user tracks repositories and decides what you may do on each of them in a web GUI; you act only through these tools, never with git or npm yourself.
|
|
76
79
|
|
|
77
80
|
Concepts:
|
|
78
|
-
- A **tracked repository** is a GitHub repository the user added in the GUI. Its open Dependabot alerts are read from GitHub and refreshed every 10 minutes.
|
|
81
|
+
- A **tracked repository** is a GitHub repository the user added in the GUI. Its open Dependabot alerts, and the pull requests the tracker opened that are not merged or closed yet, are read from GitHub and refreshed every 10 minutes.
|
|
79
82
|
- **Rights**: for each repository, the user allows you to run npm audit (audit), npm audit fix (fix), npm audit fix --force (force) and to push the fixes (push). A tool refuses an action you are not allowed to do; only the user can change the rights.
|
|
80
83
|
- The **analysed branch** of a repository is chosen by the user in the GUI (the default branch unless changed). Dependabot alerts always describe the default branch; npm audit describes the analysed branch.
|
|
81
84
|
- An **operation** runs in a temporary clone of the analysed branch, deleted at the end: npm audit in every directory that holds a package-lock.json, then npm audit fix with --package-lock-only and --ignore-scripts (lockfiles only, no install, no scripts), optionally --force, then a commit on a new branch fix/npm-audit-<date>-<time> and a pull request to the analysed branch.
|
|
@@ -132,6 +135,15 @@ async function handleGuiRequest(msg) {
|
|
|
132
135
|
return { version: APP_VERSION, dataDir, githubConfigured: githubConfigured() };
|
|
133
136
|
case "LIST_REPOS":
|
|
134
137
|
return { repos: listRepoViews(store), categories: store.listCategories() };
|
|
138
|
+
case "SYNC_REPOS":
|
|
139
|
+
await syncAllRepositories(store, readGitHubConfig());
|
|
140
|
+
return { repos: listRepoViews(store), categories: store.listCategories() };
|
|
141
|
+
case "GET_AUDIT_ALL":
|
|
142
|
+
return { auditAll: auditAll.status() };
|
|
143
|
+
case "START_AUDIT_ALL":
|
|
144
|
+
readGitHubConfig();
|
|
145
|
+
store.failOrphanedOperations();
|
|
146
|
+
return { auditAll: auditAll.start(store.listRepos().map((repo) => repo.id)) };
|
|
135
147
|
case "LIST_ADDABLE_REPOS":
|
|
136
148
|
return { repositories: await listAddableRepositories(store, readGitHubConfig()) };
|
|
137
149
|
case "GET_REPO": {
|
|
@@ -300,7 +312,7 @@ const REPOSITORY_DOC = "Tracked repository, as owner/name (see list_repositories
|
|
|
300
312
|
const TOOLS = [
|
|
301
313
|
{
|
|
302
314
|
name: "list_repositories",
|
|
303
|
-
description: "List the tracked repositories with their category, their analysed branch, their open Dependabot alerts by severity, the time of the last sync, the rights the user gave you (audit, fix, force, push) and the operation in progress. Start here.",
|
|
315
|
+
description: "List the tracked repositories with their category, their analysed branch, their open Dependabot alerts by severity, the time of the last sync, the rights the user gave you (audit, fix, force, push), the pull requests the tracker opened that are still open, and the operation in progress. Start here.",
|
|
304
316
|
inputSchema: {
|
|
305
317
|
type: "object",
|
|
306
318
|
properties: { category: { type: "string", description: "Only list the repositories of this category, by name (case-insensitive). The user creates the categories in the GUI." } },
|
package/dist/src/tools/format.js
CHANGED
|
@@ -29,11 +29,18 @@ export function describeRepo(view, category) {
|
|
|
29
29
|
];
|
|
30
30
|
if (repo.syncError)
|
|
31
31
|
lines.push(` Last sync failed: ${repo.syncError}`);
|
|
32
|
+
if (repo.pullRequests.length > 0) {
|
|
33
|
+
lines.push(` Pull requests opened by the tracker, not merged yet: ${repo.pullRequests.map((pull) => `#${pull.number} ${pull.url}`).join(", ")}`);
|
|
34
|
+
}
|
|
32
35
|
if (view.unfixable.length > 0)
|
|
33
36
|
lines.push(` Last npm audit found no published fix for: ${view.unfixable.join(", ")}`);
|
|
34
37
|
if (view.cleanAuditAt) {
|
|
35
38
|
lines.push(` npm audit of ${view.cleanAuditAt} found no vulnerability on the default branch: these Dependabot alerts are probably not refreshed yet.`);
|
|
36
39
|
}
|
|
40
|
+
if (view.auditFindings) {
|
|
41
|
+
const { at, count, severity } = view.auditFindings;
|
|
42
|
+
lines.push(` npm audit of ${at} found ${count} vulnerabilit${count === 1 ? "y" : "ies"} (worst: ${severity}) on the default branch although Dependabot reports none: Dependabot has probably not caught up yet.`);
|
|
43
|
+
}
|
|
37
44
|
lines.push(` Agent rights: ${rightsLabel(repo)}`);
|
|
38
45
|
if (activeOperation)
|
|
39
46
|
lines.push(` Operation in progress: ${activeOperation.id} (${activeOperation.status})`);
|