@imenam/mcp-dependabot-tracker 0.0.0-stage → 1.0.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.
Files changed (59) hide show
  1. package/README.md +208 -2
  2. package/dist/shared/schemas/api.schema.d.ts +49 -0
  3. package/dist/shared/schemas/api.schema.js +11 -0
  4. package/dist/shared/schemas/ipc.schema.d.ts +26 -0
  5. package/dist/shared/schemas/ipc.schema.js +30 -0
  6. package/dist/shared/schemas/model.schema.d.ts +276 -0
  7. package/dist/shared/schemas/model.schema.js +116 -0
  8. package/dist/src/cli/setup-mcp.d.ts +24 -0
  9. package/dist/src/cli/setup-mcp.js +137 -0
  10. package/dist/src/core/commands.d.ts +26 -0
  11. package/dist/src/core/commands.js +101 -0
  12. package/dist/src/core/config.d.ts +12 -0
  13. package/dist/src/core/config.js +18 -0
  14. package/dist/src/core/data-dir.d.ts +11 -0
  15. package/dist/src/core/data-dir.js +27 -0
  16. package/dist/src/core/errors.d.ts +12 -0
  17. package/dist/src/core/errors.js +21 -0
  18. package/dist/src/core/github.d.ts +43 -0
  19. package/dist/src/core/github.js +122 -0
  20. package/dist/src/core/log-dir.d.ts +6 -0
  21. package/dist/src/core/log-dir.js +13 -0
  22. package/dist/src/core/npm-audit.d.ts +36 -0
  23. package/dist/src/core/npm-audit.js +115 -0
  24. package/dist/src/core/operations.d.ts +42 -0
  25. package/dist/src/core/operations.js +438 -0
  26. package/dist/src/core/repo-ref.d.ts +9 -0
  27. package/dist/src/core/repo-ref.js +33 -0
  28. package/dist/src/core/repos.d.ts +23 -0
  29. package/dist/src/core/repos.js +84 -0
  30. package/dist/src/core/store.d.ts +49 -0
  31. package/dist/src/core/store.js +266 -0
  32. package/dist/src/gui-worker.d.ts +1 -0
  33. package/dist/src/gui-worker.js +325 -0
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/index.js +363 -0
  36. package/dist/src/tools/format.d.ts +7 -0
  37. package/dist/src/tools/format.js +81 -0
  38. package/dist/src/tools/tools.d.ts +15 -0
  39. package/dist/src/tools/tools.js +56 -0
  40. package/dist/src/tools/types.d.ts +21 -0
  41. package/dist/src/tools/types.js +38 -0
  42. package/dist/src/version.d.ts +1 -0
  43. package/dist/src/version.js +16 -0
  44. package/gui/dist/assets/index-BBJkUr54.css +1 -0
  45. package/gui/dist/assets/index-DbT51E3H.js +63 -0
  46. package/gui/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  47. package/gui/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  48. package/gui/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  49. package/gui/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  50. package/gui/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  51. package/gui/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  52. package/gui/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  53. package/gui/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  54. package/gui/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  55. package/gui/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  56. package/gui/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  57. package/gui/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  58. package/gui/dist/index.html +13 -0
  59. package/package.json +57 -4
@@ -0,0 +1,363 @@
1
+ #!/usr/bin/env node
2
+ import dotenv from "dotenv";
3
+ import path from "path";
4
+ import fs from "fs";
5
+ import { fileURLToPath } from "url";
6
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
+ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
9
+ import { GuiLauncher, createLogger, reconnectGuiToolDefinition, setupLogging } from "@imenam/mcp-gui-interface";
10
+ import { APP_VERSION } from "./version.js";
11
+ import { resolveCloneDir, resolveDataDir } from "./core/data-dir.js";
12
+ import { resolveLogDir } from "./core/log-dir.js";
13
+ import { githubConfigured, readGitHubConfig } from "./core/config.js";
14
+ import { ConflictError, NotFoundError, TrackerError } from "./core/errors.js";
15
+ import { Store } from "./core/store.js";
16
+ import { cancelOperation, decideForce, pushOperation, startUserFix } from "./core/operations.js";
17
+ import { SYNC_INTERVAL_MS, addRepository, listRepoViews, repoView, setRights, staleRepos, syncRepository } from "./core/repos.js";
18
+ import { GUI_REQUEST_TYPES, IPCMessageSchema } from "../shared/schemas/ipc.schema.js";
19
+ import { AddRepoBodySchema, ForceBodySchema, OperationRequestSchema, PushBodySchema, RepoRequestSchema, SetRightsBodySchema, } from "../shared/schemas/api.schema.js";
20
+ import { errorResult, textResult } from "./tools/types.js";
21
+ import { fixVulnerabilities, getAlerts, listRepositories, runAudit } from "./tools/tools.js";
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = path.dirname(__filename);
24
+ // Les flags CLI sont traités avant toute initialisation : ils s'exécutent dans le
25
+ // répertoire de l'utilisateur, pas dans un serveur MCP.
26
+ if (process.argv.slice(2).includes("--claude-setup-mcp")) {
27
+ const argv = process.argv.slice(2);
28
+ const { runSetupMcp, parseGuiExposure } = await import("./cli/setup-mcp.js");
29
+ const parsed = parseGuiExposure(argv);
30
+ if ("error" in parsed) {
31
+ console.error(`Erreur : ${parsed.error}`);
32
+ process.exit(1);
33
+ }
34
+ process.exit(runSetupMcp({ cwd: process.cwd(), force: argv.includes("--force"), exposure: parsed.exposure }));
35
+ }
36
+ function findProjectRoot(startDir) {
37
+ let current = startDir;
38
+ while (current !== path.dirname(current)) {
39
+ if (fs.existsSync(path.join(current, "package.json")))
40
+ return current;
41
+ current = path.dirname(current);
42
+ }
43
+ return startDir;
44
+ }
45
+ const rootDir = findProjectRoot(__dirname);
46
+ const packageEnvPath = path.join(rootDir, ".env");
47
+ setupLogging({ processLabel: "mcp-dependabot-tracker", logDir: resolveLogDir() });
48
+ const logger = createLogger("mcp-dependabot-tracker");
49
+ // Rechargé à chaque appel, avec override : le .env local prime sur les
50
+ // variables héritées de la déclaration du MCP.
51
+ function getConfig() {
52
+ if (fs.existsSync(packageEnvPath))
53
+ dotenv.config({ path: packageEnvPath, override: true, quiet: true });
54
+ return { proxyUrl: process.env.PROXY_URL, appPort: process.env.APP_PORT, version: APP_VERSION };
55
+ }
56
+ getConfig();
57
+ let cloneDir;
58
+ try {
59
+ cloneDir = resolveCloneDir();
60
+ }
61
+ catch (err) {
62
+ logger.error(err.message);
63
+ console.error(err.message);
64
+ process.exit(1);
65
+ }
66
+ const dataDir = resolveDataDir();
67
+ const store = new Store(dataDir);
68
+ const operations = {
69
+ store,
70
+ githubConfig: readGitHubConfig,
71
+ cloneDir: resolveCloneDir,
72
+ logError: (message) => logger.error(message),
73
+ };
74
+ /** Présentation du serveur transmise au client MCP : concepts, déroulé et règles. */
75
+ 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
+
77
+ 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.
79
+ - **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
+ - An **operation** runs in a temporary clone of the default 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 default branch.
81
+
82
+ Workflow:
83
+ 1. list_repositories to see the tracked repositories, their open alerts and your rights.
84
+ 2. get_alerts for the detail of the alerts of one repository.
85
+ 3. run_audit to see what npm audit reports, or fix_vulnerabilities to fix: 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.
86
+
87
+ Rules:
88
+ - An operation runs until it ends; one operation at a time per repository.
89
+ - npm audit fix --force can install breaking major versions: use force only when the user asked for it.`;
90
+ const server = new Server({ name: "mcp-dependabot-tracker", version: APP_VERSION }, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
91
+ // --- GUI ----------------------------------------------------------------------
92
+ function broadcastToGUI(message) {
93
+ const child = guiLauncher.getProcess();
94
+ if (child?.connected) {
95
+ try {
96
+ child.send(message);
97
+ }
98
+ catch (err) {
99
+ logger.error(`Failed to send IPC message: ${err.message}`);
100
+ }
101
+ }
102
+ }
103
+ function reply(msg, data) {
104
+ broadcastToGUI({ type: `${msg.type}_RESPONSE`, correlationId: msg.correlationId, data, timestamp: new Date().toISOString() });
105
+ }
106
+ function replyError(msg, error, errorKind) {
107
+ broadcastToGUI({ type: `${msg.type}_RESPONSE`, correlationId: msg.correlationId, error, errorKind, timestamp: new Date().toISOString() });
108
+ }
109
+ /** Données IPC d'une requête de la GUI, validées par `schema` ; une donnée invalide est une erreur de la requête. */
110
+ function parseRequest(schema, data) {
111
+ const parsed = schema.safeParse(data);
112
+ if (!parsed.success) {
113
+ const issues = parsed.error.issues.map((issue) => `${issue.path.map(String).join(".") || "(root)"} ${issue.message}`);
114
+ throw new TrackerError(`Invalid request: ${issues.join("; ")}.`);
115
+ }
116
+ return parsed.data;
117
+ }
118
+ function errorKindOf(err) {
119
+ if (err instanceof NotFoundError)
120
+ return "not_found";
121
+ if (err instanceof ConflictError)
122
+ return "conflict";
123
+ if (err instanceof TrackerError)
124
+ return "invalid";
125
+ return "internal";
126
+ }
127
+ /** Traite une requête de la GUI et renvoie ses données de réponse ; lève une erreur métier sinon. */
128
+ async function handleGuiRequest(msg) {
129
+ switch (msg.type) {
130
+ case "GET_CONFIG":
131
+ return { version: APP_VERSION, dataDir, githubConfigured: githubConfigured() };
132
+ case "LIST_REPOS":
133
+ return { repos: listRepoViews(store) };
134
+ case "GET_REPO": {
135
+ store.failOrphanedOperations();
136
+ return repoView(store, store.getRepo(parseRequest(RepoRequestSchema, msg.data).repoId));
137
+ }
138
+ case "ADD_REPO": {
139
+ const body = parseRequest(AddRepoBodySchema, msg.data?.body);
140
+ return repoView(store, await addRepository(store, readGitHubConfig(), body.repository));
141
+ }
142
+ case "REMOVE_REPO":
143
+ store.removeRepo(parseRequest(RepoRequestSchema, msg.data).repoId);
144
+ return { removed: true };
145
+ case "SET_RIGHTS": {
146
+ const { repoId } = parseRequest(RepoRequestSchema, msg.data);
147
+ const body = parseRequest(SetRightsBodySchema, msg.data?.body);
148
+ return repoView(store, setRights(store, repoId, body.rights));
149
+ }
150
+ case "START_FIX":
151
+ return { operation: startUserFix(operations, parseRequest(RepoRequestSchema, msg.data).repoId) };
152
+ case "GET_OPERATION": {
153
+ store.failOrphanedOperations();
154
+ return { operation: store.getOperation(parseRequest(OperationRequestSchema, msg.data).operationId) };
155
+ }
156
+ case "DECIDE_FORCE": {
157
+ const { operationId } = parseRequest(OperationRequestSchema, msg.data);
158
+ return { operation: decideForce(operations, operationId, parseRequest(ForceBodySchema, msg.data?.body).apply) };
159
+ }
160
+ case "PUSH_OPERATION": {
161
+ const { operationId } = parseRequest(OperationRequestSchema, msg.data);
162
+ return { operation: pushOperation(operations, operationId, parseRequest(PushBodySchema, msg.data?.body).commitMessage) };
163
+ }
164
+ case "CANCEL_OPERATION":
165
+ return { operation: cancelOperation(operations, parseRequest(OperationRequestSchema, msg.data).operationId) };
166
+ default:
167
+ throw new Error(`GUI request ${msg.type} has no handler.`);
168
+ }
169
+ }
170
+ const GUI_REQUESTS = new Set(GUI_REQUEST_TYPES);
171
+ /**
172
+ * Messages du GUI worker. READY et ALREADY_RUNNING sont d'abord traités par
173
+ * GuiLauncher (statut, URL), puis transmis ici.
174
+ */
175
+ function handleIPCMessage(raw) {
176
+ const parsed = IPCMessageSchema.safeParse(raw);
177
+ if (!parsed.success) {
178
+ logger.warn(`Invalid IPC message ignored: ${parsed.error.message}`);
179
+ return;
180
+ }
181
+ const msg = parsed.data;
182
+ switch (msg.type) {
183
+ case "READY":
184
+ logger.info(`GUI ready at ${msg.data?.url}`);
185
+ return;
186
+ case "ALREADY_RUNNING":
187
+ logger.info(`GUI already served by another instance at ${msg.data?.url}`);
188
+ return;
189
+ default:
190
+ if (GUI_REQUESTS.has(msg.type)) {
191
+ handleGuiRequest(msg).then((data) => reply(msg, data), (err) => {
192
+ const kind = errorKindOf(err);
193
+ if (kind === "internal")
194
+ logger.error(`GUI request ${msg.type} failed: ${err?.stack ?? err}`);
195
+ replyError(msg, err?.message ?? String(err), kind);
196
+ });
197
+ return;
198
+ }
199
+ logger.debug(`Unhandled IPC message type: ${msg.type}`);
200
+ }
201
+ }
202
+ const guiLauncher = new GuiLauncher({
203
+ guiPath: path.join(__dirname, "gui-worker.js"),
204
+ maxRestarts: 0,
205
+ onMessage: handleIPCMessage,
206
+ reloadEnv: getConfig,
207
+ });
208
+ /** La GUI a besoin soit d'un proxy, soit d'un port local (mode standalone). */
209
+ function guiIsConfigured() {
210
+ return !!(process.env.PROXY_URL?.trim() || process.env.APP_PORT?.trim());
211
+ }
212
+ function launchGUI() {
213
+ if (!guiIsConfigured()) {
214
+ logger.info("[MASTER] Ni PROXY_URL ni APP_PORT défini — GUI désactivée.");
215
+ return;
216
+ }
217
+ logger.info("Launching GUI worker...");
218
+ guiLauncher.start();
219
+ }
220
+ /**
221
+ * `reconnect_gui` : relance via GuiLauncher en mode proxy. En mode standalone,
222
+ * GuiLauncher ne sait pas relancer le worker : l'outil décrit l'état et la
223
+ * marche à suivre.
224
+ */
225
+ async function reconnectGui(args) {
226
+ getConfig();
227
+ const appPort = process.env.APP_PORT?.trim();
228
+ if (process.env.PROXY_URL?.trim() || !appPort) {
229
+ return { ...(await guiLauncher.handleReconnectTool({ force: args.force === true })) };
230
+ }
231
+ const child = guiLauncher.getProcess();
232
+ const alive = !!child && child.exitCode === null && !child.killed;
233
+ const url = guiLauncher.getUrl();
234
+ if (alive && guiLauncher.getStatus() === "ready") {
235
+ return textResult(`GUI is served in standalone mode at ${url}. Nothing to do.`);
236
+ }
237
+ return errorResult(`reconnect_gui relaunches the GUI through the proxy only. The GUI is in standalone mode (APP_PORT=${appPort}) and is not running (status: ${guiLauncher.getStatus()}). Free port ${appPort} or set another APP_PORT, then restart the MCP server. To use the proxy instead, set PROXY_URL and call reconnect_gui again.`);
238
+ }
239
+ // --- Synchronisation des alertes ---------------------------------------------------
240
+ const SYNC_CHECK_MS = 60_000;
241
+ let syncing = false;
242
+ /** Relit les alertes des dépôts dont la dernière lecture date de plus de 10 minutes. */
243
+ async function syncStaleRepos() {
244
+ if (syncing || !githubConfigured())
245
+ return;
246
+ syncing = true;
247
+ try {
248
+ const config = readGitHubConfig();
249
+ for (const repo of staleRepos(store, SYNC_INTERVAL_MS)) {
250
+ const synced = await syncRepository(store, config, repo.id);
251
+ if (synced.syncError)
252
+ logger.warn(`Dependabot alerts of ${repo.id} not synced: ${synced.syncError}`);
253
+ }
254
+ }
255
+ catch (err) {
256
+ logger.error(`Alert sync failed: ${err?.stack ?? err}`);
257
+ }
258
+ finally {
259
+ syncing = false;
260
+ }
261
+ }
262
+ // --- Outils -------------------------------------------------------------------
263
+ const REPOSITORY_DOC = "Tracked repository, as owner/name (see list_repositories).";
264
+ const TOOLS = [
265
+ {
266
+ name: "list_repositories",
267
+ description: "List the tracked repositories with 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.",
268
+ inputSchema: { type: "object", properties: {} },
269
+ },
270
+ {
271
+ name: "get_alerts",
272
+ description: "Read the open Dependabot alerts of a tracked repository from GitHub now, and list them from the most to the least severe: number, severity, package, ecosystem, manifest, summary, patched version and link.",
273
+ inputSchema: {
274
+ type: "object",
275
+ properties: { repository: { type: "string", description: REPOSITORY_DOC } },
276
+ required: ["repository"],
277
+ },
278
+ },
279
+ {
280
+ name: "run_audit",
281
+ description: "Run npm audit on a temporary clone of the default 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 that needs --force). Needs the audit right. Nothing is changed; the clone is deleted.",
282
+ inputSchema: {
283
+ type: "object",
284
+ properties: { repository: { type: "string", description: REPOSITORY_DOC } },
285
+ required: ["repository"],
286
+ },
287
+ },
288
+ {
289
+ name: "fix_vulnerabilities",
290
+ description: "Fix the npm vulnerabilities of a tracked repository in a temporary clone of its default branch: npm audit, then npm audit fix --package-lock-only --ignore-scripts, then optionally npm audit fix --force, then optionally a commit on a new branch fix/npm-audit-<date>-<time>, its push and a pull request to the default branch. " +
291
+ "Needs the fix right, plus the force right with force and 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.",
292
+ inputSchema: {
293
+ type: "object",
294
+ properties: {
295
+ repository: { type: "string", description: REPOSITORY_DOC },
296
+ force: {
297
+ type: "boolean",
298
+ 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.",
299
+ },
300
+ push: { type: "boolean", description: "Commit the fixes on a new branch, push it and open a pull request (default false)." },
301
+ commit_message: { type: "string", description: "Commit message, also the pull request title (first line). Default \"fix(deps): resolve npm audit vulnerabilities\"." },
302
+ },
303
+ required: ["repository"],
304
+ },
305
+ },
306
+ reconnectGuiToolDefinition(),
307
+ ];
308
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
309
+ /** Lien vers un écran de la GUI, ajouté aux résultats des opérations ; vide quand la GUI est désactivée. */
310
+ function guiHint(hash) {
311
+ const url = guiLauncher.getUrl();
312
+ if (!url)
313
+ return "";
314
+ return `\n\nOpen in the GUI: ${url}#/${hash}`;
315
+ }
316
+ /** Ajoute au résultat d'une opération le lien vers son écran dans la GUI. */
317
+ function withOperationLink({ result, operation }) {
318
+ const hint = guiHint(`r/${operation.repoId}/op/${operation.id}`);
319
+ return { ...result, content: [{ type: "text", text: result.content[0].text + hint }] };
320
+ }
321
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
322
+ const { name, arguments: args } = request.params;
323
+ const params = (args ?? {});
324
+ try {
325
+ switch (name) {
326
+ case "list_repositories":
327
+ return listRepositories(store, params);
328
+ case "get_alerts":
329
+ return await getAlerts(store, readGitHubConfig(), params);
330
+ case "run_audit":
331
+ return withOperationLink(await runAudit(operations, params));
332
+ case "fix_vulnerabilities":
333
+ return withOperationLink(await fixVulnerabilities(operations, params));
334
+ case "reconnect_gui":
335
+ return await reconnectGui(params);
336
+ default:
337
+ throw new Error(`Tool not found: ${name}`);
338
+ }
339
+ }
340
+ catch (error) {
341
+ return errorResult(error.message);
342
+ }
343
+ });
344
+ async function main() {
345
+ const transport = new StdioServerTransport();
346
+ await server.connect(transport);
347
+ logger.info(`MCP Server connected and running on stdio (data dir: ${dataDir}, clone dir: ${cloneDir})`);
348
+ for (const orphan of store.failOrphanedOperations())
349
+ logger.warn(`Operation ${orphan.id} on ${orphan.repoId} was interrupted.`);
350
+ launchGUI();
351
+ void syncStaleRepos();
352
+ setInterval(() => void syncStaleRepos(), SYNC_CHECK_MS).unref();
353
+ }
354
+ main().catch((err) => {
355
+ logger.error(`Fatal error: ${err.message}`);
356
+ process.exit(1);
357
+ });
358
+ process.on("uncaughtException", (err) => {
359
+ logger.error(`Uncaught Exception in MASTER: ${err.message}`);
360
+ logger.error(err.stack || "No stack trace");
361
+ guiLauncher.getProcess()?.kill("SIGTERM");
362
+ process.exit(1);
363
+ });
@@ -0,0 +1,7 @@
1
+ import { type Operation, type Repo } from "../../shared/schemas/model.schema.js";
2
+ import type { RepoView } from "../../shared/schemas/api.schema.js";
3
+ export declare function rightsLabel(repo: Repo): string;
4
+ export declare function describeRepo(view: RepoView): string;
5
+ export declare function describeAlerts(repo: Repo): string;
6
+ /** Compte rendu d'une opération pour l'agent : étapes, vulnérabilités, paquets modifiés, PR, erreur. */
7
+ export declare function describeOperation(operation: Operation): string;
@@ -0,0 +1,81 @@
1
+ import { ALERT_SEVERITIES, RIGHTS } from "../../shared/schemas/model.schema.js";
2
+ import { projectLabel } from "../core/npm-audit.js";
3
+ import { countBySeverity } from "../core/repos.js";
4
+ /** Paquets cités en clair dans un résultat ; au-delà, le reste est compté. */
5
+ const MAX_LISTED = 25;
6
+ export function rightsLabel(repo) {
7
+ const allowed = RIGHTS.filter((right) => repo.rights[right]);
8
+ return allowed.length === 0 ? "none" : allowed.join(", ");
9
+ }
10
+ function alertsLabel(repo) {
11
+ if (repo.alerts.length === 0)
12
+ return "none";
13
+ const counts = countBySeverity(repo.alerts);
14
+ const detail = ALERT_SEVERITIES.filter((severity) => counts[severity] > 0).map((severity) => `${severity} ${counts[severity]}`);
15
+ return `${repo.alerts.length} (${detail.join(", ")})`;
16
+ }
17
+ export function describeRepo(view) {
18
+ const { repo, activeOperation } = view;
19
+ const lines = [
20
+ `- ${repo.id} (default branch ${repo.defaultBranch})`,
21
+ ` Open Dependabot alerts: ${alertsLabel(repo)}${repo.syncedAt ? ` · synced ${repo.syncedAt}` : " · not synced yet"}`,
22
+ ];
23
+ if (repo.syncError)
24
+ lines.push(` Last sync failed: ${repo.syncError}`);
25
+ lines.push(` Agent rights: ${rightsLabel(repo)}`);
26
+ if (activeOperation)
27
+ lines.push(` Operation in progress: ${activeOperation.id} (${activeOperation.status})`);
28
+ return lines.join("\n");
29
+ }
30
+ export function describeAlerts(repo) {
31
+ const header = `${repo.id}: ${repo.alerts.length} open Dependabot alert(s), synced ${repo.syncedAt}.`;
32
+ const lines = repo.alerts.map((alert) => {
33
+ const patched = alert.patchedVersion ? ` — patched in ${alert.patchedVersion}` : " — no patched version";
34
+ return `- #${alert.number} ${alert.severity} ${alert.package} (${alert.ecosystem}, ${alert.manifestPath}): ${alert.summary}${patched} — ${alert.url}`;
35
+ });
36
+ return [header, ...lines].join("\n");
37
+ }
38
+ function list(items, render) {
39
+ const shown = items.slice(0, MAX_LISTED).map(render);
40
+ if (items.length > MAX_LISTED)
41
+ shown.push(`… and ${items.length - MAX_LISTED} more`);
42
+ return shown.join(", ");
43
+ }
44
+ /** Compte rendu d'une opération pour l'agent : étapes, vulnérabilités, paquets modifiés, PR, erreur. */
45
+ export function describeOperation(operation) {
46
+ const title = operation.kind === "audit" ? "npm audit" : "npm audit fix";
47
+ const lines = [`${title} on ${operation.repoId} (operation ${operation.id}): ${operation.status}.`];
48
+ if (operation.projects.length > 0) {
49
+ lines.push(`- npm projects: ${operation.projects.map((project) => projectLabel(project) || "./").join(", ")}`);
50
+ }
51
+ const { initial, afterFix, afterForce } = operation.counts;
52
+ if (initial !== null) {
53
+ const parts = [`${initial} found`];
54
+ if (afterFix !== null)
55
+ parts.push(`${afterFix} left after npm audit fix`);
56
+ if (afterForce !== null)
57
+ parts.push(`${afterForce} left after npm audit fix --force`);
58
+ lines.push(`- Vulnerabilities: ${parts.join(", ")}`);
59
+ }
60
+ if (operation.remaining.length > 0) {
61
+ lines.push(`- Remaining: ${list(operation.remaining, (vulnerability) => {
62
+ const fix = vulnerability.fix === "none" ? "no fix" : vulnerability.fix === "major" ? "fix needs --force" : "fix available";
63
+ return `${projectLabel(vulnerability.project)}${vulnerability.name} (${vulnerability.severity}, ${fix})`;
64
+ })}`);
65
+ }
66
+ if (operation.forceCandidates.length > 0 && operation.steps.force !== "done") {
67
+ lines.push(`- npm audit fix --force would upgrade: ${list(operation.forceCandidates, (candidate) => `${projectLabel(candidate.project)}${candidate.name} ${candidate.from ?? "?"} → ${candidate.to}`)}`);
68
+ }
69
+ if (operation.changes.length > 0) {
70
+ lines.push(`- Updated packages (${operation.changes.length}): ${list(operation.changes, (change) => `${projectLabel(change.project)}${change.name} ${change.from ?? "(added)"} → ${change.to ?? "(removed)"}`)}`);
71
+ }
72
+ if (operation.pullRequest) {
73
+ lines.push(`- Pull request #${operation.pullRequest.number}: ${operation.pullRequest.url} (branch ${operation.branch})`);
74
+ }
75
+ else if (operation.kind === "fix" && operation.status === "done" && operation.changes.length > 0) {
76
+ lines.push("- Nothing was pushed: the clone was discarded.");
77
+ }
78
+ if (operation.error)
79
+ lines.push(`- Error: ${operation.error}`);
80
+ return lines.join("\n");
81
+ }
@@ -0,0 +1,15 @@
1
+ import { type Operation } from "../../shared/schemas/model.schema.js";
2
+ import type { GitHubConfig } from "../core/config.js";
3
+ import { type OperationContext } from "../core/operations.js";
4
+ import type { Store } from "../core/store.js";
5
+ import { type Args, type ToolResult } from "./types.js";
6
+ export declare function listRepositories(store: Store, args: Args): ToolResult;
7
+ /** Relit les alertes sur GitHub avant de les lister. */
8
+ export declare function getAlerts(store: Store, config: GitHubConfig, args: Args): Promise<ToolResult>;
9
+ /** Résultat d'un outil qui a mené une opération, avec l'opération pour lier son écran de la GUI. */
10
+ export interface OperationToolResult {
11
+ result: ToolResult;
12
+ operation: Operation;
13
+ }
14
+ export declare function runAudit(ctx: OperationContext, args: Args): Promise<OperationToolResult>;
15
+ export declare function fixVulnerabilities(ctx: OperationContext, args: Args): Promise<OperationToolResult>;
@@ -0,0 +1,56 @@
1
+ import { DEFAULT_COMMIT_MESSAGE } from "../../shared/schemas/model.schema.js";
2
+ import { TrackerError } from "../core/errors.js";
3
+ import { runAgentOperation } from "../core/operations.js";
4
+ import { listRepoViews, repoView, syncRepository } from "../core/repos.js";
5
+ import { describeAlerts, describeOperation, describeRepo } from "./format.js";
6
+ import { errorResult, optionalBoolean, optionalString, rejectUnknownFields, requireString, textResult } from "./types.js";
7
+ const RIGHT_LABELS = {
8
+ audit: "run npm audit",
9
+ fix: "run npm audit fix",
10
+ force: "run npm audit fix --force",
11
+ push: "push a branch and open a pull request",
12
+ };
13
+ /** Refuse l'action si l'utilisateur n'a pas accordé ce droit à l'agent pour ce dépôt. */
14
+ function assertAllowed(repo, right) {
15
+ if (!repo.rights[right]) {
16
+ throw new TrackerError(`The agent is not allowed to ${RIGHT_LABELS[right]} on ${repo.id}. Only the user can grant this right, in the GUI.`);
17
+ }
18
+ }
19
+ export function listRepositories(store, args) {
20
+ rejectUnknownFields(args, []);
21
+ const views = listRepoViews(store);
22
+ if (views.length === 0)
23
+ return textResult("No repository is tracked. The user adds repositories in the GUI.");
24
+ return textResult([`${views.length} tracked repositor${views.length === 1 ? "y" : "ies"}:`, ...views.map(describeRepo)].join("\n"));
25
+ }
26
+ /** Relit les alertes sur GitHub avant de les lister. */
27
+ export async function getAlerts(store, config, args) {
28
+ rejectUnknownFields(args, ["repository"]);
29
+ const repo = await syncRepository(store, config, store.getRepo(requireString(args, "repository")).id);
30
+ if (repo.syncError)
31
+ return errorResult(`Could not read the Dependabot alerts of ${repo.id}: ${repo.syncError}`);
32
+ return textResult(describeAlerts(repoView(store, repo).repo));
33
+ }
34
+ function operationResult(operation) {
35
+ const text = describeOperation(operation);
36
+ return { result: operation.status === "done" ? textResult(text) : errorResult(text), operation };
37
+ }
38
+ export async function runAudit(ctx, args) {
39
+ rejectUnknownFields(args, ["repository"]);
40
+ const repo = ctx.store.getRepo(requireString(args, "repository"));
41
+ assertAllowed(repo, "audit");
42
+ return operationResult(await runAgentOperation(ctx, repo.id, "audit", { force: false, push: false, commitMessage: DEFAULT_COMMIT_MESSAGE }));
43
+ }
44
+ export async function fixVulnerabilities(ctx, args) {
45
+ rejectUnknownFields(args, ["repository", "force", "push", "commit_message"]);
46
+ const repo = ctx.store.getRepo(requireString(args, "repository"));
47
+ const force = optionalBoolean(args, "force", false);
48
+ const push = optionalBoolean(args, "push", false);
49
+ const commitMessage = optionalString(args, "commit_message") ?? DEFAULT_COMMIT_MESSAGE;
50
+ assertAllowed(repo, "fix");
51
+ if (force)
52
+ assertAllowed(repo, "force");
53
+ if (push)
54
+ assertAllowed(repo, "push");
55
+ return operationResult(await runAgentOperation(ctx, repo.id, "fix", { force, push, commitMessage }));
56
+ }
@@ -0,0 +1,21 @@
1
+ /** Forme de réponse attendue par le SDK MCP pour un appel d'outil. */
2
+ export interface ToolResult {
3
+ [key: string]: unknown;
4
+ content: Array<{
5
+ type: "text";
6
+ text: string;
7
+ }>;
8
+ isError?: boolean;
9
+ }
10
+ /** Arguments d'un outil. */
11
+ export type Args = Record<string, unknown> | undefined;
12
+ export declare function textResult(text: string): ToolResult;
13
+ export declare function errorResult(text: string): ToolResult;
14
+ /** Lit un argument texte obligatoire, rogné ; lève une erreur s'il est absent ou vide. */
15
+ export declare function requireString(args: Args, field: string): string;
16
+ /** Lit un argument texte facultatif, rogné ; `undefined` s'il est absent, erreur s'il est vide ou d'un autre type. */
17
+ export declare function optionalString(args: Args, field: string): string | undefined;
18
+ /** Lit un booléen facultatif ; `fallback` s'il est absent. */
19
+ export declare function optionalBoolean(args: Args, field: string, fallback: boolean): boolean;
20
+ /** Lève une erreur si `args` contient des champs hors de `allowed` : une faute de frappe ne passe pas inaperçue. */
21
+ export declare function rejectUnknownFields(args: Args, allowed: readonly string[]): void;
@@ -0,0 +1,38 @@
1
+ export function textResult(text) {
2
+ return { content: [{ type: "text", text }] };
3
+ }
4
+ export function errorResult(text) {
5
+ return { content: [{ type: "text", text: `Error: ${text}` }], isError: true };
6
+ }
7
+ /** Lit un argument texte obligatoire, rogné ; lève une erreur s'il est absent ou vide. */
8
+ export function requireString(args, field) {
9
+ const value = args?.[field];
10
+ if (typeof value !== "string" || value.trim() === "") {
11
+ throw new Error(`"${field}" is required and must be a non-empty string.`);
12
+ }
13
+ return value.trim();
14
+ }
15
+ /** Lit un argument texte facultatif, rogné ; `undefined` s'il est absent, erreur s'il est vide ou d'un autre type. */
16
+ export function optionalString(args, field) {
17
+ if (args?.[field] === undefined)
18
+ return undefined;
19
+ return requireString(args, field);
20
+ }
21
+ /** Lit un booléen facultatif ; `fallback` s'il est absent. */
22
+ export function optionalBoolean(args, field, fallback) {
23
+ const value = args?.[field];
24
+ if (value === undefined)
25
+ return fallback;
26
+ if (typeof value !== "boolean")
27
+ throw new Error(`"${field}" must be a boolean (got ${JSON.stringify(value)}).`);
28
+ return value;
29
+ }
30
+ /** Lève une erreur si `args` contient des champs hors de `allowed` : une faute de frappe ne passe pas inaperçue. */
31
+ export function rejectUnknownFields(args, allowed) {
32
+ if (!args)
33
+ return;
34
+ const unknown = Object.keys(args).filter((key) => !allowed.includes(key));
35
+ if (unknown.length > 0) {
36
+ throw new Error(`Unknown field(s): ${unknown.join(", ")}. Accepted fields: ${allowed.join(", ") || "none"}.`);
37
+ }
38
+ }
@@ -0,0 +1 @@
1
+ export declare const APP_VERSION: string;
@@ -0,0 +1,16 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ // Lit la version dans le premier package.json trouvé en remontant depuis ce module.
5
+ function readPackageVersion() {
6
+ let dir = path.dirname(fileURLToPath(import.meta.url));
7
+ while (!existsSync(path.join(dir, "package.json"))) {
8
+ const parent = path.dirname(dir);
9
+ if (parent === dir)
10
+ throw new Error("package.json introuvable");
11
+ dir = parent;
12
+ }
13
+ const pkg = JSON.parse(readFileSync(path.join(dir, "package.json"), "utf8"));
14
+ return pkg.version;
15
+ }
16
+ export const APP_VERSION = readPackageVersion();
@@ -0,0 +1 @@
1
+ @font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-cyrillic-wght-normal-DqGufNeO.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-ext-wght-normal-DlzME5K_.woff2)format("woff2-variations");unicode-range:U+1F??}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-greek-wght-normal-CkhJZR-_.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-vietnamese-wght-normal-CBcvBZtf.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-ext-wght-normal-DO1Apj_S.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(./inter-latin-wght-normal-Dx4kXJAl.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(data:font/woff2;base64,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)format("woff2-variations");unicode-range:U+460-52F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(./jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2)format("woff2-variations");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(./jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2)format("woff2-variations");unicode-range:U+370-377,U+37A-37F,U+384-38A,U+38C,U+38E-3A1,U+3A3-3FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(./jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2)format("woff2-variations");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(./jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2)format("woff2-variations");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:JetBrains Mono Variable;font-style:normal;font-display:swap;font-weight:100 800;src:url(./jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2)format("woff2-variations");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{--bg:#0c0e14;--panel:#0f1118;--surface:#13161f;--surface-raised:#151923;--surface-current:#171b2b;--border:#20242f;--border-strong:#2a2f3d;--divider:#1c2029;--text:#eceef3;--text-strong:#dfe2ea;--text-soft:#c9cedb;--muted:#9aa1b1;--faint:#646b7b;--idle:#3a4050;--accent:#5b6cf5;--accent-hover:#6878ff;--accent-soft:#8b97ff;--brand-bg:#1f2540;--ok:#3fb950;--danger:#f0625a;--warning:#e3a33b;--info:#6aa5ff;--critical-bg:#2a1517;--high-bg:#2a2010;--medium-bg:#142033;--low-bg:#1a1d26;--font-sans:"Inter Variable", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, Consolas, monospace;--topbar-height:60px;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;font-family:var(--font-sans);color:var(--text);-webkit-font-smoothing:antialiased;font-size:14px}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--bg)}a{color:inherit;text-decoration:none}button{font:inherit;color:inherit;cursor:pointer;background:0 0;border:none;padding:0}button:disabled{cursor:default}h1,h2,p,ul{margin:0}.mono,code,pre{font-family:var(--font-mono);font-variant-ligatures:none}code{color:var(--accent-soft);font-size:12px}.spacer{flex:1}.muted{color:var(--muted)}.error-text{color:var(--danger)}.text-ok{color:var(--ok)}.text-warning{color:var(--warning)}.pre{white-space:pre-wrap;word-break:break-word}.link{color:var(--accent-soft)}.link:hover{color:var(--accent-hover);text-decoration:underline}.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.app{flex-direction:column;height:100%;display:flex}.topbar{height:var(--topbar-height);background:var(--panel);border-bottom:1px solid var(--border);flex-shrink:0;align-items:center;gap:12px;padding:0 32px;display:flex}.brand{color:var(--text);align-items:center;gap:12px;font-size:14px;font-weight:500;display:flex}.brand-mark{background:var(--brand-bg);width:28px;height:28px;color:var(--accent-soft);border-radius:7px;justify-content:center;align-items:center;display:inline-flex}.main{flex:1;overflow:auto}.page{width:880px;max-width:calc(100% - 32px);margin:0 auto;padding:32px 0 64px}.page-title{color:var(--text);margin-bottom:18px;font-size:22px;font-weight:600}.page-head{align-items:flex-start;gap:12px;margin-bottom:30px;display:flex}.page-head .page-title{margin-bottom:8px}.page-head-text{flex:1;min-width:0}.back{color:var(--muted);margin-top:5px;display:inline-flex}.back:hover{color:var(--text)}.subtitle{color:var(--faint);font-size:12px}.page-actions{align-items:center;gap:12px;display:flex}.section-label{color:var(--muted);margin-bottom:12px;font-size:13px}.button{white-space:nowrap;border-radius:8px;justify-content:center;align-items:center;gap:8px;height:36px;padding:0 16px;font-size:13px;display:inline-flex}.button-primary{background:var(--accent);color:#fff;font-weight:600}.button-primary:hover:not(:disabled){background:var(--accent-hover)}.button-secondary{background:var(--surface);border:1px solid var(--border-strong);color:var(--text-soft)}.button-secondary:hover:not(:disabled){border-color:var(--idle);color:var(--text)}.button-ghost{color:var(--muted);padding:0 8px}.button-ghost:hover,.button-ghost.is-active{color:var(--text)}.button:disabled{opacity:.55}.icon-button{color:var(--muted);display:inline-flex}.icon-button:hover{color:var(--text)}.danger-link{color:var(--danger);align-items:center;gap:8px;font-size:13px;display:inline-flex}.panel{background:var(--surface);border:1px solid var(--border);border-radius:10px;overflow:hidden}.empty{color:var(--muted);flex-direction:column;align-items:center;gap:16px;padding:40px 20px;display:flex}.row{border-top:1px solid var(--divider);align-items:center;gap:20px;min-height:56px;padding:0 20px;display:flex}.row:first-child{border-top:none}.row:hover{background:var(--surface-raised)}.row-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.row-chevron{color:var(--faint);flex-shrink:0}.status{white-space:nowrap;align-items:center;gap:6px;font-size:13px;display:inline-flex}.status-busy{color:var(--accent-soft)}.status-error{color:var(--danger)}.status-muted{color:var(--faint)}.pill{white-space:nowrap;border-radius:12px;flex-shrink:0;justify-content:center;align-items:center;height:24px;padding:0 12px;font-size:12px;display:inline-flex}.pill-wide{width:76px;padding:0}.pill-critical{background:var(--critical-bg);color:var(--danger)}.pill-high{background:var(--high-bg);color:var(--warning)}.pill-medium{background:var(--medium-bg);color:var(--info)}.pill-low{background:var(--low-bg);color:var(--muted)}.alert-package{text-overflow:ellipsis;white-space:nowrap;flex-shrink:0;width:150px;font-size:13px;overflow:hidden}.alert-summary{min-width:0;color:var(--muted);text-overflow:ellipsis;white-space:nowrap;flex:1;font-size:13px;overflow:hidden}.banner{border-radius:10px;align-items:flex-start;gap:10px;margin-bottom:18px;padding:12px 14px;font-size:13px;line-height:1.5;display:flex}.banner svg{flex-shrink:0;margin-top:2px}.banner-error{background:var(--critical-bg);color:var(--text-soft);border:1px solid #5a2629}.steps{margin-bottom:18px}.step{border-top:1px solid var(--divider)}.step:first-child{border-top:none}.step-current{background:var(--surface-current)}.step-line{align-items:center;gap:16px;min-height:48px;padding:0 20px;display:flex}.step-icon{flex-shrink:0}.step-done .step-icon{color:var(--ok)}.step-running .step-icon{color:var(--accent-soft)}.step-failed .step-icon{color:var(--danger)}.step-pending .step-icon,.step-skipped .step-icon{color:var(--idle)}.step-current .step-icon{color:var(--accent-soft)}.step-current .step-icon.text-warning{color:var(--warning)}.step-label{color:var(--text-soft);flex:1}.step-pending .step-label,.step-skipped .step-label{color:var(--faint)}.step-current .step-label{color:var(--text);font-weight:500}.step-result{color:var(--faint);font-size:13px}.step-body{padding:0 20px 18px 52px;font-size:13px}.step-actions{gap:12px;margin-top:16px;display:flex}.candidates{color:var(--warning);margin-top:8px;padding:0;font-size:13px;line-height:1.7;list-style:none}.hint{color:var(--faint);margin-top:10px;font-size:12px}.hint .link{font-size:12px}.changes{background:var(--panel);border:1px solid var(--border);border-radius:8px;max-height:240px;margin-top:10px;padding:10px 14px;font-size:12px;line-height:1.7;list-style:none;overflow:auto}.log{background:var(--panel);border:1px solid var(--border);max-height:360px;color:var(--text-soft);white-space:pre-wrap;word-break:break-word;border-radius:10px;margin:0;padding:14px 16px;font-size:12px;line-height:1.6;overflow:auto}.log-time{color:var(--faint)}.input{background:var(--surface);border:1px solid var(--border-strong);width:100%;height:40px;color:var(--text-strong);font:inherit;border-radius:8px;outline:none;padding:0 12px;font-size:13px}.input.mono{font-family:var(--font-mono)}.step-body .input{background:var(--panel);height:36px}.step-body .commit-input{width:600px;max-width:100%}.input:focus{border-color:var(--accent)}.field-hint,.field-error{color:var(--faint);margin-top:12px;font-size:12px}.field-error{color:var(--danger)}.veil{z-index:40;background:#05060a99;position:fixed;inset:0}.modal{background:var(--panel);border:1px solid var(--border-strong);border-radius:12px;width:480px;max-width:calc(100% - 32px);padding:24px;position:absolute;top:110px;left:50%;transform:translate(-50%)}.modal-title{margin-bottom:18px;font-size:16px;font-weight:600}.modal-actions{justify-content:flex-end;gap:12px;margin-top:24px;display:flex}.drawer{background:var(--panel);border-left:1px solid var(--border);flex-direction:column;width:420px;max-width:100%;padding:24px;display:flex;position:absolute;top:0;bottom:0;right:0}.drawer-head{justify-content:space-between;align-items:center;display:flex}.drawer-title{font-size:16px;font-weight:600}.drawer-subtitle{color:var(--faint);margin-top:6px;font-size:12px}.rights{flex:1;margin-top:28px}.right{border-bottom:1px solid var(--divider);justify-content:space-between;align-items:center;gap:16px;padding:12px 0;display:flex}.right:last-child{border-bottom:none}.right-label{font-size:14px}.right-description{color:var(--faint);margin-top:4px;font-size:12px}.toggle{background:var(--border-strong);border-radius:10px;flex-shrink:0;width:36px;height:20px;transition:background .15s;position:relative}.toggle-knob{background:var(--muted);border-radius:50%;width:16px;height:16px;transition:left .15s;position:absolute;top:2px;left:2px}.toggle.is-on{background:var(--accent)}.toggle.is-on .toggle-knob{background:#fff;left:18px}.notice{z-index:50;background:var(--surface-raised);border:1px solid var(--border-strong);max-width:460px;color:var(--text-soft);border-radius:10px;align-items:flex-start;gap:10px;padding:12px 14px;font-size:12.5px;line-height:1.5;display:flex;position:fixed;bottom:24px;right:24px;box-shadow:0 12px 32px #00000073}.notice svg{flex-shrink:0;margin-top:2px}.notice-info svg:first-child{color:var(--accent-soft)}.notice-error{border-color:#5a2629}.notice-error svg:first-child{color:var(--danger)}.notice-text{flex:1}.notice-close{color:var(--faint)}.notice-close:hover{color:var(--text)}@media (width<=700px){.topbar{padding:0 16px}.page-head{flex-wrap:wrap}.alert-package{width:110px}.alert-summary{display:none}}