@imenam/mcp-dependabot-tracker 1.0.17 → 1.0.19
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 +41 -57
- package/dist/shared/schemas/api.schema.d.ts +16 -28
- package/dist/shared/schemas/api.schema.js +2 -5
- package/dist/shared/schemas/ipc.schema.d.ts +1 -1
- package/dist/shared/schemas/ipc.schema.js +1 -4
- package/dist/shared/schemas/model.schema.d.ts +38 -321
- package/dist/shared/schemas/model.schema.js +22 -93
- package/dist/shared/schemas/settings.schema.d.ts +2 -5
- package/dist/shared/schemas/settings.schema.js +2 -3
- package/dist/src/core/npm-audit.d.ts +3 -13
- package/dist/src/core/npm-audit.js +6 -45
- package/dist/src/core/operations.d.ts +8 -21
- package/dist/src/core/operations.js +60 -290
- package/dist/src/core/organizer.d.ts +1 -1
- package/dist/src/core/repair.d.ts +39 -11
- package/dist/src/core/repair.js +82 -44
- package/dist/src/core/repos.d.ts +16 -3
- package/dist/src/core/repos.js +36 -9
- package/dist/src/core/settings.d.ts +1 -1
- package/dist/src/core/settings.js +2 -5
- package/dist/src/core/store.js +9 -7
- package/dist/src/gui-worker.js +7 -20
- package/dist/src/index.js +17 -33
- package/dist/src/tools/format.js +5 -7
- package/dist/src/tools/tools.js +3 -7
- package/gui/dist/assets/index-pU6GyhHw.js +64 -0
- package/gui/dist/assets/index-tEFABc4K.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/src/core/analysis.d.ts +0 -54
- package/dist/src/core/analysis.js +0 -180
- package/gui/dist/assets/index-CFsF8q30.css +0 -1
- package/gui/dist/assets/index-OzP2GcuA.js +0 -64
package/dist/src/core/repair.js
CHANGED
|
@@ -4,7 +4,6 @@ import path from "path";
|
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { RepairReportSchema, TEST_OUTCOMES } from "../../shared/schemas/model.schema.js";
|
|
7
|
-
import { ORGANIZER_SERVER, factsJson, organizerServer } from "./analysis.js";
|
|
8
7
|
import { runClaudeSession } from "./claude.js";
|
|
9
8
|
import { tail } from "./commands.js";
|
|
10
9
|
import { TrackerError } from "./errors.js";
|
|
@@ -12,29 +11,31 @@ import { OrganizerClient } from "./organizer.js";
|
|
|
12
11
|
import { organizerConnection } from "./settings.js";
|
|
13
12
|
/**
|
|
14
13
|
* Corrections par Claude des vulnérabilités que `npm audit fix` laisse dans un
|
|
15
|
-
* clone,
|
|
16
|
-
*
|
|
17
|
-
* ni écriture hors du clone, et lance les commandes npm
|
|
18
|
-
* installation, tests) par les outils du serveur `npm-tools`,
|
|
19
|
-
* exécute dans son propre bac à sable, sans aucun token. Il
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* tracker relit la
|
|
23
|
-
*
|
|
14
|
+
* clone, en une seule session. Claude analyse chaque vulnérabilité dans le
|
|
15
|
+
* code, la corrige quand il le peut en modifiant le clone (Read, Grep, Glob,
|
|
16
|
+
* Edit, Write), sans git ni écriture hors du clone, et lance les commandes npm
|
|
17
|
+
* (lockfile, audit, installation, tests) par les outils du serveur `npm-tools`,
|
|
18
|
+
* que le tracker exécute dans son propre bac à sable, sans aucun token. Il rend
|
|
19
|
+
* compte de son travail dans une seule tâche de l'organizer, assignée au
|
|
20
|
+
* propriétaire de l'espace et taguée du nom du dépôt, puis rend un rapport
|
|
21
|
+
* structuré. Le tracker relit la tâche sur l'organizer : absente, mal assignée
|
|
22
|
+
* ou mal taguée, elle fait échouer les corrections.
|
|
24
23
|
*/
|
|
24
|
+
/** Nom du serveur MCP organizer dans la configuration de la session. */
|
|
25
|
+
export const ORGANIZER_SERVER = "organizer";
|
|
26
|
+
const ORGANIZER_PACKAGE = "@imenam/mcp-organizer";
|
|
25
27
|
/** Outils organizer autorisés ; tout autre appel est refusé par `dontAsk`. */
|
|
26
|
-
const ORGANIZER_TOOLS = ["
|
|
28
|
+
const ORGANIZER_TOOLS = ["create_task", "set_assignees", "set_tags", "get_task"];
|
|
27
29
|
/** Serveur MCP des commandes npm, dans la configuration de la session. */
|
|
28
30
|
const NPM_SERVER = "npm";
|
|
29
31
|
/** Outils du serveur `npm-tools`. */
|
|
30
32
|
const NPM_TOOLS = ["npm_install_lockfile", "npm_audit", "npm_ci", "npm_test", "npm_run", "npm_ls", "tsc"];
|
|
31
33
|
/** Réglages de la session : Edit et Write refusent tout chemin hors du clone. */
|
|
32
34
|
const SESSION_SETTINGS = { permissions: { blockWritesOutsideWorkingDirectories: true } };
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
35
|
+
/** Taille maximale des vulnérabilités transmises dans la consigne. */
|
|
36
|
+
const MAX_FACTS_CHARS = 20_000;
|
|
37
|
+
/** Chemins d'installation gardés par vulnérabilité. */
|
|
38
|
+
const MAX_NODES = 5;
|
|
38
39
|
/** Bac à sable minimal, du type de ceux où le tracker lance les commandes npm sous Linux. */
|
|
39
40
|
const BWRAP_PROBE = ["--ro-bind", "/", "/", "--dev", "/dev", "--proc", "/proc", "--unshare-user", "--unshare-pid", "--unshare-net", "true"];
|
|
40
41
|
/** Durée maximale du test de bubblewrap. */
|
|
@@ -63,14 +64,47 @@ export function assertSandboxAvailable(platform = process.platform, command = "b
|
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
/**
|
|
67
|
+
/** Vulnérabilités d'un rapport `npm audit --json`, réduites à ce qui sert les corrections. */
|
|
68
|
+
export function auditFacts(report, project) {
|
|
69
|
+
return Object.values((report?.vulnerabilities ?? {})).map((entry) => ({
|
|
70
|
+
project: project === "" ? "." : project,
|
|
71
|
+
name: entry.name,
|
|
72
|
+
severity: entry.severity,
|
|
73
|
+
isDirect: entry.isDirect,
|
|
74
|
+
range: entry.range,
|
|
75
|
+
via: (Array.isArray(entry.via) ? entry.via : []).map((via) => typeof via === "string" ? via : { title: via?.title, url: via?.url, range: via?.range, severity: via?.severity }),
|
|
76
|
+
effects: entry.effects,
|
|
77
|
+
fixAvailable: entry.fixAvailable,
|
|
78
|
+
nodes: (Array.isArray(entry.nodes) ? entry.nodes : []).slice(0, MAX_NODES),
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
/** JSON des vulnérabilités dans la limite de taille ; au-delà, les dernières sont seulement comptées. */
|
|
82
|
+
export function factsJson(facts) {
|
|
83
|
+
for (let count = facts.length; count > 0; count--) {
|
|
84
|
+
const json = JSON.stringify(facts.slice(0, count), null, 1);
|
|
85
|
+
if (json.length <= MAX_FACTS_CHARS)
|
|
86
|
+
return count === facts.length ? json : `${json}\n(${facts.length - count} more vulnerabilities not listed)`;
|
|
87
|
+
}
|
|
88
|
+
return `(${facts.length} vulnerabilities, too large to list)`;
|
|
89
|
+
}
|
|
90
|
+
/** Serveur MCP organizer de la session, lancé par `npx` avec le token réglé dans la GUI. */
|
|
91
|
+
export function organizerServer(connection) {
|
|
92
|
+
const launch = process.platform === "win32" ? { command: "cmd", args: ["/c", "npx", "-y", ORGANIZER_PACKAGE] } : { command: "npx", args: ["-y", ORGANIZER_PACKAGE] };
|
|
93
|
+
return { ...launch, env: { ORGANIZER_URL: connection.url, ORGANIZER_TOKEN: connection.token } };
|
|
94
|
+
}
|
|
95
|
+
/** Lancement du serveur `npm-tools` du tracker sur le clone et le cache npm de l'opération. */
|
|
96
|
+
function npmServer(input, cache) {
|
|
97
|
+
const entry = fileURLToPath(new URL("../npm-tools.js", import.meta.url));
|
|
98
|
+
return { command: process.execPath, args: [entry, "--root", input.cwd, "--cache", cache, "--scope", input.scope] };
|
|
99
|
+
}
|
|
100
|
+
/** Résultat demandé à Claude : le rapport et la clé de la tâche. */
|
|
67
101
|
const OutputSchema = RepairReportSchema.extend({ task: z.string().min(1), commitMessage: z.string().trim().min(1) });
|
|
68
102
|
const OUTPUT_JSON_SCHEMA = {
|
|
69
103
|
type: "object",
|
|
70
104
|
additionalProperties: false,
|
|
71
105
|
required: ["task", "summary", "changes", "commitMessage", "tests"],
|
|
72
106
|
properties: {
|
|
73
|
-
task: { type: "string", description: "Key of the
|
|
107
|
+
task: { type: "string", description: "Key of the organizer task of your report, e.g. ORG-42." },
|
|
74
108
|
summary: { type: "string", description: "One or two sentences, in French." },
|
|
75
109
|
changes: {
|
|
76
110
|
type: "array",
|
|
@@ -92,18 +126,13 @@ const OUTPUT_JSON_SCHEMA = {
|
|
|
92
126
|
},
|
|
93
127
|
};
|
|
94
128
|
function prompt(input, space, owner, tag) {
|
|
95
|
-
const fixes = input.forceApplied ? "`npm audit fix` and `npm audit fix --force`" : "`npm audit fix`";
|
|
96
129
|
const omit = input.scope === "production" ? " --omit=dev" : "";
|
|
97
|
-
const report = input.reportTask
|
|
98
|
-
? `update the description of your previous report, task ${input.reportTask}, with update_task (keep it a sub-task of ${input.analysisTask}); do not create a new one.`
|
|
99
|
-
: `create one sub-task of ${input.analysisTask} with create_task (parent "${input.analysisTask}"), without request_id, titled in French "Rapport de développement — " followed by what you changed.`;
|
|
100
130
|
return [
|
|
101
|
-
`You fix the npm vulnerabilities that
|
|
131
|
+
`You fix the npm vulnerabilities that \`npm audit fix\` left in the GitHub repository ${input.repoId} (branch ${input.branch}).`,
|
|
102
132
|
input.scope === "production"
|
|
103
133
|
? "The audit covers the production dependencies only (`--omit=dev`): the vulnerabilities of the devDependencies are out of scope."
|
|
104
134
|
: "The audit covers all the dependencies, devDependencies included.",
|
|
105
|
-
|
|
106
|
-
...(input.reportTask ? [`It also holds the changes of your previous pass, described in task ${input.reportTask}: build on them, and change or revert them where the remarks of the user ask for it.`] : []),
|
|
135
|
+
"The current directory is a clone of that branch where `npm audit fix --package-lock-only` already updated the lockfiles.",
|
|
107
136
|
"",
|
|
108
137
|
"Remaining vulnerabilities, from `npm audit --json` (`project` is the folder of the package-lock.json):",
|
|
109
138
|
"```json",
|
|
@@ -111,33 +140,26 @@ function prompt(input, space, owner, tag) {
|
|
|
111
140
|
"```",
|
|
112
141
|
"",
|
|
113
142
|
"Your job:",
|
|
114
|
-
|
|
143
|
+
"1. For each vulnerability, find in the code how the vulnerable package is used (directly, or through which dependency), whether the vulnerable code is reachable from this project, and how urgent the fix is.",
|
|
115
144
|
`2. Fix what can be fixed, with minimal changes: upgrade a dependency in package.json, or pin a transitive one with an \`overrides\` entry, with Edit, then update the lockfile with the ${NPM_SERVER} tool npm_install_lockfile in the folder of the package-lock.json; adapt the code to the new versions.`,
|
|
116
145
|
`3. Check your work with the ${NPM_SERVER} tools, the only way to run npm here: npm_audit${omit ? " (it runs `npm audit" + omit + "`)" : ""} in each project; npm_ci to install the dependencies, then npm_test (or npm_run with the test script of package.json) when the project has some; npm_ls and tsc when useful. Their \`project\` argument is the folder of the package.json, "" for the root.`,
|
|
117
|
-
" You have no shell. Never write outside the current directory: the tracker commits your changes, node_modules aside.",
|
|
146
|
+
" You have no shell. Never write outside the current directory: the tracker commits your changes, node_modules aside, and opens the pull request.",
|
|
118
147
|
" If a command fails, quote its exact error, with the path it names, in your report.",
|
|
119
|
-
`4. Report in the organizer space "${space}":
|
|
148
|
+
`4. Report in the organizer space "${space}": create one task with create_task, without request_id, titled in French "Rapport de correction — " followed by what you changed. Its description, in French markdown, is your only report: for each vulnerable package, its usage in the code, its reachability, its urgency and its advisory link; then every change file by file and why; the result of the audit and of the tests; what is left to fix or check by hand. When the tests fail, say so in a warning at the very top of the description. Set its priority from the urgency of what is left.`,
|
|
120
149
|
` Assign it to ${owner.name} with set_assignees (member id ${owner.id}), and set its tags to exactly ["${tag}"] with set_tags.`,
|
|
121
|
-
"5. Finish with the structured report: the key of the
|
|
150
|
+
"5. Finish with the structured report: the key of the task, a summary in French, every changed file with its change in a few words in French, a conventional commit message in English for your changes, and the outcome of the tests with a one-sentence detail in French.",
|
|
122
151
|
].join("\n");
|
|
123
152
|
}
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (!connection)
|
|
129
|
-
throw new TrackerError("The organizer connection is not set: set it in the settings.");
|
|
130
|
-
if (!task)
|
|
131
|
-
throw new TrackerError(`Operation ${operation.id} has no organizer task from an analysis.`);
|
|
132
|
-
const { comments } = await new OrganizerClient(connection).taskWithComments(task.key);
|
|
133
|
-
return { task, remarks: comments };
|
|
134
|
-
}
|
|
135
|
-
/** Lance les corrections, puis vérifie sur l'organizer la sous-tâche que Claude dit avoir créée ou mise à jour. */
|
|
153
|
+
/**
|
|
154
|
+
* Lance les corrections, puis vérifie sur l'organizer la tâche que Claude dit
|
|
155
|
+
* avoir créée. Lève une erreur sans l'organizer ou le token Claude.
|
|
156
|
+
*/
|
|
136
157
|
export async function repairVulnerabilities(input) {
|
|
137
158
|
const connection = organizerConnection(input.settings);
|
|
138
159
|
const token = input.settings.claude.token;
|
|
139
160
|
if (!connection || !token)
|
|
140
161
|
throw new TrackerError("The fixes by Claude need the organizer connection and the Claude token: set them in the settings.");
|
|
162
|
+
await assertSandboxAvailable();
|
|
141
163
|
const organizer = new OrganizerClient(connection);
|
|
142
164
|
const { space, owner } = await organizer.space();
|
|
143
165
|
const tag = input.repoId.split("/")[1];
|
|
@@ -177,9 +199,6 @@ export async function repairVulnerabilities(input) {
|
|
|
177
199
|
if (!output.success)
|
|
178
200
|
throw new TrackerError("Claude Code ended without the structured report of its fixes.");
|
|
179
201
|
const task = await organizer.task(output.data.task);
|
|
180
|
-
if (task.parentKey?.toLowerCase() !== input.analysisTask.toLowerCase()) {
|
|
181
|
-
throw new TrackerError(`Task ${task.key} is not a sub-task of ${input.analysisTask}.`);
|
|
182
|
-
}
|
|
183
202
|
if (!task.tags.some((candidate) => candidate.toLowerCase() === tag.toLowerCase())) {
|
|
184
203
|
throw new TrackerError(`Task ${task.key} was created without the tag "${tag}".`);
|
|
185
204
|
}
|
|
@@ -189,3 +208,22 @@ export async function repairVulnerabilities(input) {
|
|
|
189
208
|
const { task: _key, ...report } = output.data;
|
|
190
209
|
return { report, task: { key: task.key, title: task.title, url: organizer.taskUrl(task.id), status: task.status } };
|
|
191
210
|
}
|
|
211
|
+
/** Dernière opération du dépôt dont les corrections ont créé une tâche ; `operations` va de la plus récente à la plus ancienne. */
|
|
212
|
+
export function latestReported(operations) {
|
|
213
|
+
return operations.find((operation) => operation.repair?.task) ?? null;
|
|
214
|
+
}
|
|
215
|
+
/** Relit sur l'organizer le statut de la dernière tâche de rapport du dépôt, tant qu'elle n'est pas terminée. */
|
|
216
|
+
export async function refreshReportTask(store, settings, repoId) {
|
|
217
|
+
const connection = organizerConnection(settings);
|
|
218
|
+
const operation = latestReported(store.listOperations(repoId));
|
|
219
|
+
const current = operation?.repair?.task;
|
|
220
|
+
if (!connection || !operation || !current || current.status === "done")
|
|
221
|
+
return;
|
|
222
|
+
const { status } = await new OrganizerClient(connection).task(current.key);
|
|
223
|
+
if (status === current.status)
|
|
224
|
+
return;
|
|
225
|
+
store.updateOperation(operation.id, (latest) => ({
|
|
226
|
+
...latest,
|
|
227
|
+
repair: latest.repair && latest.repair.task ? { ...latest.repair, task: { ...latest.repair.task, status } } : latest.repair,
|
|
228
|
+
}));
|
|
229
|
+
}
|
package/dist/src/core/repos.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Alert, type AlertSeverity, type
|
|
1
|
+
import { type Alert, type AlertSeverity, type HandledAlert, type Operation, type OrganizerTask, type PullRequest, type Repo, type Rights } from "../../shared/schemas/model.schema.js";
|
|
2
2
|
import type { AuditFindings, AuditTarget, CleanAudit, OperationSummary, RepoView } from "../../shared/schemas/api.schema.js";
|
|
3
3
|
import type { GitHubConfig } from "./config.js";
|
|
4
4
|
import { type OpenPullRequest } from "./github.js";
|
|
@@ -27,6 +27,13 @@ export declare function sortRepos<T extends {
|
|
|
27
27
|
* plus ancienne.
|
|
28
28
|
*/
|
|
29
29
|
export declare function cleanAudit(repo: Repo, operations: Operation[]): CleanAudit | null;
|
|
30
|
+
/**
|
|
31
|
+
* Dernier audit, quand il porte sur la branche par défaut et sur les seules
|
|
32
|
+
* dépendances de production, n'y a trouvé aucune vulnérabilité, et que toutes
|
|
33
|
+
* les alertes Dependabot ouvertes portent sur des dépendances de développement.
|
|
34
|
+
* Null sinon. `operations` va de la plus récente à la plus ancienne.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cleanProductionAudit(repo: Repo, operations: Operation[]): CleanAudit | null;
|
|
30
37
|
/**
|
|
31
38
|
* Vulnérabilités trouvées par le dernier audit de la branche par défaut, la
|
|
32
39
|
* seule que Dependabot analyse, quand Dependabot ne signale aucune alerte dans
|
|
@@ -55,8 +62,8 @@ export declare function trackerPullRequests(repoId: string, pulls: OpenPullReque
|
|
|
55
62
|
/** Ligne de l'historique d'une opération. */
|
|
56
63
|
export declare function operationSummary(operation: Operation): OperationSummary;
|
|
57
64
|
export declare function repoView(store: Store, repo: Repo): RepoView;
|
|
58
|
-
/** Tâche organizer
|
|
59
|
-
export declare function
|
|
65
|
+
/** Tâche organizer du dernier rapport de Claude, tant qu'elle n'est pas terminée. `operations` va de la plus récente à la plus ancienne. */
|
|
66
|
+
export declare function openReportTask(operations: Operation[]): OrganizerTask | null;
|
|
60
67
|
/** Vues de tous les dépôts suivis ; les dépôts, les catégories et les opérations sont lus une seule fois. */
|
|
61
68
|
export declare function listRepoViews(store: Store): RepoView[];
|
|
62
69
|
/**
|
|
@@ -81,6 +88,12 @@ export declare function queueRepository(store: Store, repoId: string): Repo;
|
|
|
81
88
|
export declare function queueCategory(store: Store, categoryId: string): void;
|
|
82
89
|
/** Retire le dépôt de la file d'attente ; sans effet s'il n'y est pas. */
|
|
83
90
|
export declare function unqueueRepository(store: Store, repoId: string): Repo;
|
|
91
|
+
/**
|
|
92
|
+
* Retire du dépôt ses pull requests en attente, que l'utilisateur dit
|
|
93
|
+
* fusionnées, sans attendre la relecture suivante ; avec `deploy`, le dépôt
|
|
94
|
+
* passe aussi « à déployer ». Refusé pour un dépôt déprécié.
|
|
95
|
+
*/
|
|
96
|
+
export declare function markPullRequestsMerged(store: Store, repoId: string, deploy: boolean): Repo;
|
|
84
97
|
/** Dépôts non dépréciés visés par « Auditer tout » ; une catégorie inconnue est refusée. */
|
|
85
98
|
export declare function auditTargetRepos(store: Store, target: AuditTarget): Repo[];
|
|
86
99
|
/** Dépôts de la file d'attente qui ne sont pas dépréciés, dans l'ordre de leur entrée dans la file. */
|
package/dist/src/core/repos.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { alertsInScope, fromNpmSeverity, pendingAlerts, worstOf } from "../../shared/alerts.js";
|
|
2
2
|
import { ALERT_SEVERITIES, DEFAULT_RIGHTS } from "../../shared/schemas/model.schema.js";
|
|
3
|
-
import { latestAnalysed } from "./analysis.js";
|
|
4
3
|
import { ConflictError, NotFoundError } from "./errors.js";
|
|
5
4
|
import { GitHubClient } from "./github.js";
|
|
6
5
|
import { isTrackerBranch } from "./operations.js";
|
|
6
|
+
import { latestReported } from "./repair.js";
|
|
7
7
|
import { parseRepoRef } from "./repo-ref.js";
|
|
8
8
|
import { assertNotDeprecated, isActive } from "./store.js";
|
|
9
9
|
/** Ancienneté au-delà de laquelle les alertes d'un dépôt sont relues sur GitHub. */
|
|
@@ -60,6 +60,20 @@ export function cleanAudit(repo, operations) {
|
|
|
60
60
|
const auditedAt = Date.parse(audited.createdAt);
|
|
61
61
|
return alerts.every((alert) => Date.parse(alert.createdAt) <= auditedAt) ? { at: audited.createdAt, scope: audited.scope } : null;
|
|
62
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Dernier audit, quand il porte sur la branche par défaut et sur les seules
|
|
65
|
+
* dépendances de production, n'y a trouvé aucune vulnérabilité, et que toutes
|
|
66
|
+
* les alertes Dependabot ouvertes portent sur des dépendances de développement.
|
|
67
|
+
* Null sinon. `operations` va de la plus récente à la plus ancienne.
|
|
68
|
+
*/
|
|
69
|
+
export function cleanProductionAudit(repo, operations) {
|
|
70
|
+
const audited = operations.find((operation) => operation.steps.audit === "done");
|
|
71
|
+
if (!audited || audited.counts.initial !== 0 || audited.baseBranch !== repo.defaultBranch || audited.scope !== "production")
|
|
72
|
+
return null;
|
|
73
|
+
if (repo.alerts.length === 0 || alertsInScope(repo.alerts, "production").length > 0)
|
|
74
|
+
return null;
|
|
75
|
+
return { at: audited.createdAt, scope: audited.scope };
|
|
76
|
+
}
|
|
63
77
|
/**
|
|
64
78
|
* Vulnérabilités trouvées par le dernier audit de la branche par défaut, la
|
|
65
79
|
* seule que Dependabot analyse, quand Dependabot ne signale aucune alerte dans
|
|
@@ -110,7 +124,7 @@ export function trackerPullRequests(repoId, pulls) {
|
|
|
110
124
|
}
|
|
111
125
|
/** Ligne de l'historique d'une opération. */
|
|
112
126
|
export function operationSummary(operation) {
|
|
113
|
-
const { initial, afterFix,
|
|
127
|
+
const { initial, afterFix, afterRepair } = operation.counts;
|
|
114
128
|
return {
|
|
115
129
|
id: operation.id,
|
|
116
130
|
kind: operation.kind,
|
|
@@ -120,9 +134,8 @@ export function operationSummary(operation) {
|
|
|
120
134
|
baseBranch: operation.baseBranch,
|
|
121
135
|
createdAt: operation.createdAt,
|
|
122
136
|
before: initial,
|
|
123
|
-
after: afterRepair ??
|
|
124
|
-
|
|
125
|
-
claudeRuns: operation.repair?.runs ?? 0,
|
|
137
|
+
after: afterRepair ?? afterFix ?? (operation.kind === "audit" ? initial : null),
|
|
138
|
+
claude: operation.repair !== null,
|
|
126
139
|
pullRequest: operation.pullRequest,
|
|
127
140
|
error: operation.error,
|
|
128
141
|
};
|
|
@@ -138,14 +151,15 @@ function buildRepoView(repo, operations, category) {
|
|
|
138
151
|
activeOperation: operations.find(isActive) ?? null,
|
|
139
152
|
latestOperation: operations[0] ?? null,
|
|
140
153
|
cleanAudit: cleanAudit(repo, operations),
|
|
154
|
+
cleanProductionAudit: cleanProductionAudit(repo, operations),
|
|
141
155
|
auditFindings: auditFindings(repo, operations),
|
|
142
156
|
unfixable: unfixablePackages(repo, operations),
|
|
143
|
-
|
|
157
|
+
reportTask: openReportTask(operations),
|
|
144
158
|
};
|
|
145
159
|
}
|
|
146
|
-
/** Tâche organizer
|
|
147
|
-
export function
|
|
148
|
-
const task =
|
|
160
|
+
/** Tâche organizer du dernier rapport de Claude, tant qu'elle n'est pas terminée. `operations` va de la plus récente à la plus ancienne. */
|
|
161
|
+
export function openReportTask(operations) {
|
|
162
|
+
const task = latestReported(operations)?.repair?.task ?? null;
|
|
149
163
|
return task && task.status !== "done" ? task : null;
|
|
150
164
|
}
|
|
151
165
|
/** Vues de tous les dépôts suivis ; les dépôts, les catégories et les opérations sont lus une seule fois. */
|
|
@@ -230,6 +244,19 @@ export function queueCategory(store, categoryId) {
|
|
|
230
244
|
export function unqueueRepository(store, repoId) {
|
|
231
245
|
return store.updateRepo(repoId, (current) => ({ ...current, queuedAt: null }));
|
|
232
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Retire du dépôt ses pull requests en attente, que l'utilisateur dit
|
|
249
|
+
* fusionnées, sans attendre la relecture suivante ; avec `deploy`, le dépôt
|
|
250
|
+
* passe aussi « à déployer ». Refusé pour un dépôt déprécié.
|
|
251
|
+
*/
|
|
252
|
+
export function markPullRequestsMerged(store, repoId, deploy) {
|
|
253
|
+
assertNotDeprecated(store.getRepo(repoId));
|
|
254
|
+
return store.updateRepo(repoId, (current) => ({
|
|
255
|
+
...current,
|
|
256
|
+
pullRequests: [],
|
|
257
|
+
deployPendingAt: deploy ? (current.deployPendingAt ?? new Date().toISOString()) : current.deployPendingAt,
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
233
260
|
/** Dépôts non dépréciés visés par « Auditer tout » ; une catégorie inconnue est refusée. */
|
|
234
261
|
export function auditTargetRepos(store, target) {
|
|
235
262
|
if (target.kind === "queue")
|
|
@@ -14,7 +14,7 @@ export declare function settingsView(settings: Settings): SettingsView;
|
|
|
14
14
|
/**
|
|
15
15
|
* Enregistre les réglages de la GUI. Une connexion à l'organizer modifiée est
|
|
16
16
|
* testée, un nouveau token Claude vérifié : un échec refuse tout
|
|
17
|
-
* l'enregistrement.
|
|
17
|
+
* l'enregistrement.
|
|
18
18
|
*/
|
|
19
19
|
export declare function saveSettings(dataDir: string, body: SaveSettingsBody, checks: SettingsChecks): Promise<SettingsView>;
|
|
20
20
|
/** Teste la connexion enregistrée à l'organizer et relève son espace et son propriétaire. */
|
|
@@ -5,7 +5,7 @@ import { DEFAULT_SETTINGS, SettingsSchema } from "../../shared/schemas/settings.
|
|
|
5
5
|
import { TrackerError } from "./errors.js";
|
|
6
6
|
import { organizerUrl } from "./organizer.js";
|
|
7
7
|
/**
|
|
8
|
-
* Réglages
|
|
8
|
+
* Réglages des corrections par Claude, dans `<données>/settings.json`, lisible par
|
|
9
9
|
* le seul compte du serveur : ils portent le token de l'organizer et celui de
|
|
10
10
|
* Claude, que la GUI ne reçoit jamais en entier.
|
|
11
11
|
*/
|
|
@@ -77,7 +77,7 @@ async function checkedOrganizer(organizer, checks) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Enregistre les réglages de la GUI. Une connexion à l'organizer modifiée est
|
|
79
79
|
* testée, un nouveau token Claude vérifié : un échec refuse tout
|
|
80
|
-
* l'enregistrement.
|
|
80
|
+
* l'enregistrement.
|
|
81
81
|
*/
|
|
82
82
|
export async function saveSettings(dataDir, body, checks) {
|
|
83
83
|
const current = readSettings(dataDir);
|
|
@@ -91,9 +91,6 @@ export async function saveSettings(dataDir, body, checks) {
|
|
|
91
91
|
claude = { token: body.claudeToken, savedAt: new Date().toISOString() };
|
|
92
92
|
}
|
|
93
93
|
const next = { organizer, claude, analysis: body.analysis };
|
|
94
|
-
if (next.analysis.auto && !analysisReady(next)) {
|
|
95
|
-
throw new TrackerError("The automatic analysis needs the organizer connection and the Claude token.");
|
|
96
|
-
}
|
|
97
94
|
writeSettings(dataDir, next);
|
|
98
95
|
return settingsView(next);
|
|
99
96
|
}
|
package/dist/src/core/store.js
CHANGED
|
@@ -67,24 +67,26 @@ function normalizeReposFile(file) {
|
|
|
67
67
|
})),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
/** Statuts d'attente d'une version antérieure, où l'opération attendait une décision de l'utilisateur. */
|
|
71
|
+
const FORMER_WAITING_STATUSES = ["waiting_force", "waiting_repair", "waiting_push"];
|
|
70
72
|
/**
|
|
71
73
|
* Complète une opération écrite par une version antérieure : sans `found`, les
|
|
72
74
|
* vulnérabilités du premier audit sont `remaining` tant qu'aucune correction
|
|
73
|
-
* n'a suivi, et inconnues sinon ; sans étape
|
|
74
|
-
*
|
|
75
|
-
* dépendances.
|
|
75
|
+
* n'a suivi, et inconnues sinon ; sans étape de corrections par Claude,
|
|
76
|
+
* l'étape est passée ; sans périmètre, l'audit a couvert toutes les
|
|
77
|
+
* dépendances. Une opération qui attendait une décision de l'utilisateur est
|
|
78
|
+
* annulée ; des corrections par Claude sans déroulé en ont un vide.
|
|
76
79
|
*/
|
|
77
80
|
function normalizeOperation(operation) {
|
|
78
81
|
if (operation === null || typeof operation !== "object")
|
|
79
82
|
return operation;
|
|
80
83
|
return {
|
|
81
84
|
...operation,
|
|
85
|
+
status: FORMER_WAITING_STATUSES.includes(operation.status) ? "cancelled" : operation.status,
|
|
82
86
|
found: operation.found ?? (operation.counts?.afterFix === null ? operation.remaining : []),
|
|
83
|
-
steps: operation.steps && typeof operation.steps === "object" ? {
|
|
87
|
+
steps: operation.steps && typeof operation.steps === "object" ? { repair: "skipped", ...operation.steps } : operation.steps,
|
|
84
88
|
counts: operation.counts && typeof operation.counts === "object" ? { afterRepair: null, ...operation.counts } : operation.counts,
|
|
85
|
-
|
|
86
|
-
repair: operation.repair ?? null,
|
|
87
|
-
sessions: operation.sessions ?? [],
|
|
89
|
+
repair: operation.repair ? { events: [], ...operation.repair } : null,
|
|
88
90
|
scope: operation.scope ?? "all",
|
|
89
91
|
};
|
|
90
92
|
}
|
package/dist/src/gui-worker.js
CHANGED
|
@@ -6,7 +6,7 @@ import path from "path";
|
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import { IPCMessageSchema } from "../shared/schemas/ipc.schema.js";
|
|
9
|
-
import { AddRepoBodySchema, AuditAllBodySchema, CategoryBodySchema,
|
|
9
|
+
import { AddRepoBodySchema, AuditAllBodySchema, CategoryBodySchema, MergedBodySchema, ScopeBodySchema, SetBranchBodySchema, SetCategoryBodySchema, SetRightsBodySchema } from "../shared/schemas/api.schema.js";
|
|
10
10
|
import { SaveSettingsBodySchema } from "../shared/schemas/settings.schema.js";
|
|
11
11
|
import { resolveLogDir } from "./core/log-dir.js";
|
|
12
12
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -213,6 +213,12 @@ app.put("/api/repos/:owner/:name/queued", (c) => forward(c, "QUEUE_REPO", { repo
|
|
|
213
213
|
app.delete("/api/repos/:owner/:name/queued", (c) => forward(c, "UNQUEUE_REPO", { repoId: repoId(c) }));
|
|
214
214
|
app.put("/api/repos/:owner/:name/deploy-pending", (c) => forward(c, "MARK_DEPLOY_PENDING", { repoId: repoId(c) }));
|
|
215
215
|
app.delete("/api/repos/:owner/:name/deploy-pending", (c) => forward(c, "UNMARK_DEPLOY_PENDING", { repoId: repoId(c) }));
|
|
216
|
+
app.put("/api/repos/:owner/:name/merged", async (c) => {
|
|
217
|
+
const read = await readBody(c, MergedBodySchema);
|
|
218
|
+
if ("response" in read)
|
|
219
|
+
return read.response;
|
|
220
|
+
return forward(c, "MARK_PULL_REQUESTS_MERGED", { repoId: repoId(c), body: read.body });
|
|
221
|
+
});
|
|
216
222
|
app.put("/api/repos/:owner/:name/rights", async (c) => {
|
|
217
223
|
const read = await readBody(c, SetRightsBodySchema);
|
|
218
224
|
if ("response" in read)
|
|
@@ -257,25 +263,6 @@ app.post("/api/repos/:owner/:name/operations", async (c) => {
|
|
|
257
263
|
});
|
|
258
264
|
app.get("/api/repos/:owner/:name/operations", (c) => forward(c, "LIST_OPERATIONS", { repoId: repoId(c) }));
|
|
259
265
|
app.get("/api/operations/:id", (c) => forward(c, "GET_OPERATION", { operationId: c.req.param("id") }));
|
|
260
|
-
app.post("/api/operations/:id/force", async (c) => {
|
|
261
|
-
const read = await readBody(c, ForceBodySchema);
|
|
262
|
-
if ("response" in read)
|
|
263
|
-
return read.response;
|
|
264
|
-
return forward(c, "DECIDE_FORCE", { operationId: c.req.param("id"), body: read.body });
|
|
265
|
-
});
|
|
266
|
-
app.post("/api/operations/:id/repair", async (c) => {
|
|
267
|
-
const read = await readBody(c, RepairBodySchema);
|
|
268
|
-
if ("response" in read)
|
|
269
|
-
return read.response;
|
|
270
|
-
return forward(c, "DECIDE_REPAIR", { operationId: c.req.param("id"), body: read.body });
|
|
271
|
-
});
|
|
272
|
-
app.get("/api/operations/:id/remarks", (c) => forward(c, "GET_REMARKS", { operationId: c.req.param("id") }));
|
|
273
|
-
app.post("/api/operations/:id/push", async (c) => {
|
|
274
|
-
const read = await readBody(c, PushBodySchema);
|
|
275
|
-
if ("response" in read)
|
|
276
|
-
return read.response;
|
|
277
|
-
return forward(c, "PUSH_OPERATION", { operationId: c.req.param("id"), body: read.body });
|
|
278
|
-
});
|
|
279
266
|
app.post("/api/operations/:id/cancel", (c) => forward(c, "CANCEL_OPERATION", { operationId: c.req.param("id") }));
|
|
280
267
|
app.get("/api/settings", (c) => forward(c, "GET_SETTINGS"));
|
|
281
268
|
app.put("/api/settings", async (c) => {
|
package/dist/src/index.js
CHANGED
|
@@ -13,18 +13,17 @@ 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,
|
|
16
|
+
import { cancelOperation, runDefaultBranchAudit, startUserFix } from "./core/operations.js";
|
|
17
17
|
import { AuditAll } from "./core/audit-all.js";
|
|
18
|
-
import {
|
|
19
|
-
import { analysisRemarks } from "./core/repair.js";
|
|
18
|
+
import { refreshReportTask } from "./core/repair.js";
|
|
20
19
|
import { checkClaudeToken, packagedClaudeCommand } from "./core/claude.js";
|
|
21
20
|
import { OrganizerClient } from "./core/organizer.js";
|
|
22
21
|
import { readSettings, saveSettings, settingsView, testOrganizer } from "./core/settings.js";
|
|
23
22
|
import { SaveSettingsBodySchema } from "../shared/schemas/settings.schema.js";
|
|
24
23
|
import { AUDIT_SCOPES } from "../shared/schemas/model.schema.js";
|
|
25
|
-
import { SYNC_INTERVAL_MS, addRepository, auditTargetRepos, queueCategory, queueRepository, unqueueRepository, markDeployPending, unmarkDeployPending, operationSummary, deprecateRepository, listAddableRepositories, restoreRepository, listRepoBranches, listRepoViews, markAlertHandled, setBranch, setCategory, repoView, setRights, staleRepos, syncAllRepositories, syncRepository, unmarkAlertHandled } from "./core/repos.js";
|
|
24
|
+
import { SYNC_INTERVAL_MS, addRepository, auditTargetRepos, queueCategory, queueRepository, unqueueRepository, markDeployPending, unmarkDeployPending, markPullRequestsMerged, operationSummary, deprecateRepository, listAddableRepositories, restoreRepository, listRepoBranches, listRepoViews, markAlertHandled, setBranch, setCategory, repoView, setRights, staleRepos, syncAllRepositories, syncRepository, unmarkAlertHandled } from "./core/repos.js";
|
|
26
25
|
import { GUI_REQUEST_TYPES, IPCMessageSchema } from "../shared/schemas/ipc.schema.js";
|
|
27
|
-
import { AddRepoBodySchema, AlertRequestSchema, CategoryBodySchema, CategoryRequestSchema,
|
|
26
|
+
import { AddRepoBodySchema, AlertRequestSchema, CategoryBodySchema, CategoryRequestSchema, MergedBodySchema, OperationRequestSchema, RepoRequestSchema, AuditAllBodySchema, ScopeBodySchema, SetBranchBodySchema, SetCategoryBodySchema, SetRightsBodySchema, } from "../shared/schemas/api.schema.js";
|
|
28
27
|
import { errorResult, textResult } from "./tools/types.js";
|
|
29
28
|
import { fixVulnerabilities, getAlerts, listRepositories, runAudit } from "./tools/tools.js";
|
|
30
29
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -95,10 +94,10 @@ const INSTRUCTIONS = `mcp-dependabot-tracker follows the Dependabot alerts of Gi
|
|
|
95
94
|
Concepts:
|
|
96
95
|
- 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.
|
|
97
96
|
- A **deprecated repository** is one the user set aside in the GUI: it is neither synced nor audited, list_repositories leaves it out, and every tool refuses it until the user restores it.
|
|
98
|
-
- **Rights**: for each repository, the user allows you to run npm audit (audit), npm audit fix (fix)
|
|
97
|
+
- **Rights**: for each repository, the user allows you to run npm audit (audit), npm audit fix (fix) and to push the fixes (push). A tool refuses an action you are not allowed to do; only the user can change the rights.
|
|
99
98
|
- The **scope** of an audit is chosen at each launch: production (the default) runs npm audit and npm audit fix with --omit=dev, so the devDependencies are left out; all covers every dependency. Each Dependabot alert says whether its dependency is a runtime or a development one.
|
|
100
99
|
- 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.
|
|
101
|
-
- 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),
|
|
100
|
+
- 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), then a commit on a new branch fix/npm-audit-<date>-<time> and a pull request to the analysed branch.
|
|
102
101
|
|
|
103
102
|
Workflow:
|
|
104
103
|
1. list_repositories to see the tracked repositories, their open alerts and your rights.
|
|
@@ -106,8 +105,7 @@ Workflow:
|
|
|
106
105
|
3. run_audit to see what npm audit reports, or fix_vulnerabilities to fix, on the production dependencies unless the user asks for all of them: without push, nothing leaves the temporary clone and the result shows what the fixes would change; with push, the fixes are pushed and the pull request is opened.
|
|
107
106
|
|
|
108
107
|
Rules:
|
|
109
|
-
- An operation runs until it ends; one operation at a time per repository
|
|
110
|
-
- npm audit fix --force can install breaking major versions: use force only when the user asked for it.`;
|
|
108
|
+
- An operation runs until it ends; one operation at a time per repository.`;
|
|
111
109
|
const server = new Server({ name: "mcp-dependabot-tracker", version: APP_VERSION }, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
|
|
112
110
|
// --- GUI ----------------------------------------------------------------------
|
|
113
111
|
function broadcastToGUI(message) {
|
|
@@ -186,6 +184,10 @@ async function handleGuiRequest(msg) {
|
|
|
186
184
|
return repoView(store, markDeployPending(store, parseRequest(RepoRequestSchema, msg.data).repoId));
|
|
187
185
|
case "UNMARK_DEPLOY_PENDING":
|
|
188
186
|
return repoView(store, unmarkDeployPending(store, parseRequest(RepoRequestSchema, msg.data).repoId));
|
|
187
|
+
case "MARK_PULL_REQUESTS_MERGED": {
|
|
188
|
+
const { repoId } = parseRequest(RepoRequestSchema, msg.data);
|
|
189
|
+
return repoView(store, markPullRequestsMerged(store, repoId, parseRequest(MergedBodySchema, msg.data?.body).deploy));
|
|
190
|
+
}
|
|
189
191
|
case "RESTORE_REPO":
|
|
190
192
|
return repoView(store, await restoreRepository(store, readGitHubConfig(), parseRequest(RepoRequestSchema, msg.data).repoId));
|
|
191
193
|
case "SET_RIGHTS": {
|
|
@@ -240,20 +242,6 @@ async function handleGuiRequest(msg) {
|
|
|
240
242
|
store.failOrphanedOperations();
|
|
241
243
|
return { operation: store.getOperation(parseRequest(OperationRequestSchema, msg.data).operationId) };
|
|
242
244
|
}
|
|
243
|
-
case "DECIDE_FORCE": {
|
|
244
|
-
const { operationId } = parseRequest(OperationRequestSchema, msg.data);
|
|
245
|
-
return { operation: decideForce(operations, operationId, parseRequest(ForceBodySchema, msg.data?.body).apply) };
|
|
246
|
-
}
|
|
247
|
-
case "DECIDE_REPAIR": {
|
|
248
|
-
const { operationId } = parseRequest(OperationRequestSchema, msg.data);
|
|
249
|
-
return { operation: await decideRepair(operations, operationId, parseRequest(RepairBodySchema, msg.data?.body).run) };
|
|
250
|
-
}
|
|
251
|
-
case "GET_REMARKS":
|
|
252
|
-
return await analysisRemarks(readSettings(dataDir), store.getOperation(parseRequest(OperationRequestSchema, msg.data).operationId));
|
|
253
|
-
case "PUSH_OPERATION": {
|
|
254
|
-
const { operationId } = parseRequest(OperationRequestSchema, msg.data);
|
|
255
|
-
return { operation: pushOperation(operations, operationId, parseRequest(PushBodySchema, msg.data?.body).commitMessage) };
|
|
256
|
-
}
|
|
257
245
|
case "CANCEL_OPERATION":
|
|
258
246
|
return { operation: cancelOperation(operations, parseRequest(OperationRequestSchema, msg.data).operationId) };
|
|
259
247
|
case "GET_SETTINGS":
|
|
@@ -340,7 +328,7 @@ const SYNC_CHECK_MS = 60_000;
|
|
|
340
328
|
let syncing = false;
|
|
341
329
|
/**
|
|
342
330
|
* Relit les alertes des dépôts dont la dernière lecture date de plus de 10
|
|
343
|
-
* minutes, et le statut de la tâche organizer
|
|
331
|
+
* minutes, et le statut de la tâche organizer du dernier rapport de Claude.
|
|
344
332
|
*/
|
|
345
333
|
async function syncStaleRepos() {
|
|
346
334
|
if (syncing || !githubConfigured())
|
|
@@ -352,7 +340,7 @@ async function syncStaleRepos() {
|
|
|
352
340
|
const synced = await syncRepository(store, config, repo.id);
|
|
353
341
|
if (synced.syncError)
|
|
354
342
|
logger.warn(`Dependabot alerts of ${repo.id} not synced: ${synced.syncError}`);
|
|
355
|
-
await
|
|
343
|
+
await refreshReportTask(store, readSettings(dataDir), repo.id).catch((err) => logger.warn(`Organizer task of ${repo.id} not refreshed: ${err?.message ?? err}`));
|
|
356
344
|
}
|
|
357
345
|
}
|
|
358
346
|
catch (err) {
|
|
@@ -372,7 +360,7 @@ const SCOPE_PROPERTY = {
|
|
|
372
360
|
const TOOLS = [
|
|
373
361
|
{
|
|
374
362
|
name: "list_repositories",
|
|
375
|
-
description: "List the tracked repositories that are not deprecated, 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,
|
|
363
|
+
description: "List the tracked repositories that are not deprecated, 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, push), the pull requests the tracker opened that are still open, and the operation in progress. Start here.",
|
|
376
364
|
inputSchema: {
|
|
377
365
|
type: "object",
|
|
378
366
|
properties: { category: { type: "string", description: "Only list the repositories of this category, by name (case-insensitive). The user creates the categories in the GUI." } },
|
|
@@ -389,7 +377,7 @@ const TOOLS = [
|
|
|
389
377
|
},
|
|
390
378
|
{
|
|
391
379
|
name: "run_audit",
|
|
392
|
-
description: "Run npm audit on a temporary clone of the analysed branch, in every directory that holds a package-lock.json, and report the vulnerabilities with the fix npm proposes (none, within the declared ranges, or a major upgrade
|
|
380
|
+
description: "Run npm audit on a temporary clone of the analysed branch, in every directory that holds a package-lock.json, and report the vulnerabilities with the fix npm proposes (none, within the declared ranges, or a major upgrade). Needs the audit right. Nothing is changed; the clone is deleted.",
|
|
393
381
|
inputSchema: {
|
|
394
382
|
type: "object",
|
|
395
383
|
properties: { repository: { type: "string", description: REPOSITORY_DOC }, scope: SCOPE_PROPERTY },
|
|
@@ -398,17 +386,13 @@ const TOOLS = [
|
|
|
398
386
|
},
|
|
399
387
|
{
|
|
400
388
|
name: "fix_vulnerabilities",
|
|
401
|
-
description: "Fix the npm vulnerabilities of a tracked repository in a temporary clone of its analysed branch: npm audit, then npm audit fix --package-lock-only --ignore-scripts, then optionally
|
|
402
|
-
"Needs the fix right, plus the
|
|
389
|
+
description: "Fix the npm vulnerabilities of a tracked repository in a temporary clone of its analysed branch: npm audit, then npm audit fix --package-lock-only --ignore-scripts, then optionally a commit on a new branch fix/npm-audit-<date>-<time>, its push and a pull request to the analysed branch. " +
|
|
390
|
+
"Needs the fix right, plus the push right with push. Without push, nothing leaves the clone: the result reports what the fixes change. Waits until the operation ends and reports the vulnerabilities before and after, the updated packages and the pull request.",
|
|
403
391
|
inputSchema: {
|
|
404
392
|
type: "object",
|
|
405
393
|
properties: {
|
|
406
394
|
repository: { type: "string", description: REPOSITORY_DOC },
|
|
407
395
|
scope: SCOPE_PROPERTY,
|
|
408
|
-
force: {
|
|
409
|
-
type: "boolean",
|
|
410
|
-
description: "Also run npm audit fix --force when vulnerabilities remain that only a major upgrade fixes (default false). Breaking changes possible: only when the user asked for it.",
|
|
411
|
-
},
|
|
412
396
|
push: { type: "boolean", description: "Commit the fixes on a new branch, push it and open a pull request (default false)." },
|
|
413
397
|
commit_message: { type: "string", description: "Commit message, also the pull request title (first line). Default \"fix(deps): resolve npm audit vulnerabilities\"." },
|
|
414
398
|
},
|