@imenam/mcp-dependabot-tracker 1.0.24 → 1.0.26
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 +187 -77
- package/dist/shared/schemas/agent-token.schema.d.ts +47 -0
- package/dist/shared/schemas/agent-token.schema.js +18 -0
- package/dist/shared/schemas/api.schema.d.ts +23 -23
- package/dist/shared/schemas/api.schema.js +8 -8
- package/dist/shared/schemas/deploy.schema.d.ts +174 -0
- package/dist/shared/schemas/deploy.schema.js +72 -0
- package/dist/shared/schemas/model.schema.d.ts +9 -26
- package/dist/shared/schemas/model.schema.js +7 -15
- package/dist/src/cli/setup-mcp.d.ts +19 -16
- package/dist/src/cli/setup-mcp.js +35 -82
- package/dist/src/cli/users.d.ts +5 -0
- package/dist/src/cli/users.js +164 -0
- package/dist/src/core/agent-tokens.d.ts +15 -0
- package/dist/src/core/agent-tokens.js +96 -0
- package/dist/src/core/auth.d.ts +774 -0
- package/dist/src/core/auth.js +191 -0
- package/dist/src/core/commands.d.ts +1 -1
- package/dist/src/core/commands.js +47 -4
- package/dist/src/core/config.d.ts +2 -3
- package/dist/src/core/config.js +2 -9
- package/dist/src/core/data-dir.d.ts +6 -8
- package/dist/src/core/data-dir.js +18 -16
- package/dist/src/core/deploy-servers.d.ts +77 -0
- package/dist/src/core/deploy-servers.js +480 -0
- package/dist/src/core/deployments.d.ts +75 -0
- package/dist/src/core/deployments.js +387 -0
- package/dist/src/core/github.d.ts +2 -0
- package/dist/src/core/github.js +8 -0
- package/dist/src/core/log-dir.d.ts +2 -6
- package/dist/src/core/log-dir.js +3 -8
- package/dist/src/core/npm-sandbox.d.ts +19 -3
- package/dist/src/core/npm-sandbox.js +87 -17
- package/dist/src/core/operations.d.ts +20 -18
- package/dist/src/core/operations.js +86 -70
- package/dist/src/core/repair.d.ts +0 -7
- package/dist/src/core/repair.js +10 -33
- package/dist/src/core/repos.d.ts +2 -3
- package/dist/src/core/repos.js +4 -7
- package/dist/src/core/server-config.d.ts +29 -0
- package/dist/src/core/server-config.js +85 -0
- package/dist/src/core/settings.d.ts +9 -3
- package/dist/src/core/settings.js +49 -10
- package/dist/src/core/ssh.d.ts +31 -0
- package/dist/src/core/ssh.js +82 -0
- package/dist/src/core/store.d.ts +5 -12
- package/dist/src/core/store.js +82 -160
- package/dist/src/core/vault.d.ts +10 -0
- package/dist/src/core/vault.js +50 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +46 -455
- package/dist/src/mcp.d.ts +6 -0
- package/dist/src/mcp.js +59 -0
- package/dist/src/server/app.d.ts +47 -0
- package/dist/src/server/app.js +273 -0
- package/dist/src/server/serve.d.ts +7 -0
- package/dist/src/server/serve.js +185 -0
- package/dist/src/tools/client.d.ts +15 -0
- package/dist/src/tools/client.js +62 -0
- package/dist/src/tools/format.d.ts +4 -5
- package/dist/src/tools/format.js +39 -16
- package/dist/src/tools/tools.d.ts +101 -15
- package/dist/src/tools/tools.js +91 -62
- package/gui/dist/assets/index-FrRzRTkV.js +71 -0
- package/gui/dist/assets/index-o3l3BAZD.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +11 -4
- package/dist/shared/schemas/ipc.schema.d.ts +0 -26
- package/dist/shared/schemas/ipc.schema.js +0 -53
- package/dist/src/gui-worker.d.ts +0 -1
- package/dist/src/gui-worker.js +0 -379
- package/gui/dist/assets/index-BFMdldjC.css +0 -1
- package/gui/dist/assets/index-BFWRvPPl.js +0 -64
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
import { type Auth } from "../core/auth.js";
|
|
3
|
+
import type { AuditAll } from "../core/audit-all.js";
|
|
4
|
+
import type { Deployer } from "../core/deployments.js";
|
|
5
|
+
import type { GitHubConfig } from "../core/config.js";
|
|
6
|
+
import { type OperationContext } from "../core/operations.js";
|
|
7
|
+
import { type SettingsChecks } from "../core/settings.js";
|
|
8
|
+
import type { Store } from "../core/store.js";
|
|
9
|
+
/** Ce dont les routes ont besoin : données, opérations, réglages, authentification et adresse publique du serveur. */
|
|
10
|
+
export interface ServerContext {
|
|
11
|
+
store: Store;
|
|
12
|
+
dataDir: string;
|
|
13
|
+
github: GitHubConfig;
|
|
14
|
+
operations: OperationContext;
|
|
15
|
+
auditAll: AuditAll;
|
|
16
|
+
/** Serveurs de déploiement, scripts et déploiements des dépôts. */
|
|
17
|
+
deployer: Deployer;
|
|
18
|
+
settingsChecks: SettingsChecks;
|
|
19
|
+
/** Dossier de la SPA compilée (`gui/dist`). */
|
|
20
|
+
staticRoot: string;
|
|
21
|
+
/** Comptes et sessions de l'interface. */
|
|
22
|
+
auth: Auth;
|
|
23
|
+
/** Clé du coffre (VAULT_KEY), qui chiffre les tokens des réglages. */
|
|
24
|
+
vaultKey: Buffer;
|
|
25
|
+
/** Adresse publique du serveur (APP_URL), sans barre finale. */
|
|
26
|
+
appUrl: string;
|
|
27
|
+
/** Les proxies de confiance sont configurés : X-Forwarded-For est transmis au limiteur de débit. */
|
|
28
|
+
trustsProxies: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Raison du refus d'une requête de modification venue d'un autre site, ou
|
|
32
|
+
* `null` : Sec-Fetch-Site doit valoir `same-origin` ou `none`, à défaut
|
|
33
|
+
* l'en-tête Origin doit être l'adresse publique du serveur.
|
|
34
|
+
*/
|
|
35
|
+
export declare function crossSiteRejection(method: string, headers: {
|
|
36
|
+
secFetchSite?: string;
|
|
37
|
+
origin?: string;
|
|
38
|
+
}, appUrl: string): string | null;
|
|
39
|
+
/**
|
|
40
|
+
* En-têtes de sécurité de toutes les réponses : la page ne charge que des
|
|
41
|
+
* ressources du serveur (polices intégrées en `data:` comprises), ne se laisse
|
|
42
|
+
* afficher dans aucun cadre, et n'envoie pas de référent. HSTS n'est envoyé
|
|
43
|
+
* qu'avec une adresse publique en https.
|
|
44
|
+
*/
|
|
45
|
+
export declare function securityHeaders(appUrl: string): import("hono").MiddlewareHandler;
|
|
46
|
+
/** Application Hono du serveur : authentification, API de la GUI, API des agents, fichiers de la SPA. */
|
|
47
|
+
export declare function createApp(ctx: ServerContext): Hono;
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getConnInfo } from "@hono/node-server/conninfo";
|
|
4
|
+
import { serveStatic } from "@hono/node-server/serve-static";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
import { secureHeaders } from "hono/secure-headers";
|
|
7
|
+
import { AddRepoBodySchema, AgentFixBodySchema, AlertNumberSchema, AuditAllBodySchema, CategoryBodySchema, MergedBodySchema, ScopeBodySchema, SetBranchBodySchema, SetCategoryBodySchema, } from "../../shared/schemas/api.schema.js";
|
|
8
|
+
import { CreateAgentTokenBodySchema } from "../../shared/schemas/agent-token.schema.js";
|
|
9
|
+
import { DeployServerBodySchema, SaveScriptBodySchema, SetDeployServerBodySchema, } from "../../shared/schemas/deploy.schema.js";
|
|
10
|
+
import { SaveSettingsBodySchema } from "../../shared/schemas/settings.schema.js";
|
|
11
|
+
import { setupCommand } from "../cli/setup-mcp.js";
|
|
12
|
+
import { AUTH_BASE_PATH, CLIENT_IP_HEADER } from "../core/auth.js";
|
|
13
|
+
import { authenticateAgent, createAgentToken, listAgentTokens, revokeAgentToken } from "../core/agent-tokens.js";
|
|
14
|
+
import { ConflictError, NotFoundError, TrackerError } from "../core/errors.js";
|
|
15
|
+
import { assertMergeAuditPossible, cancelOperation, startAudit, startFix, startMergeAudit } from "../core/operations.js";
|
|
16
|
+
import { addRepository, auditTargetRepos, deprecateRepository, listAddableRepositories, listRepoBranches, listRepoViews, markAlertHandled, markDeployPending, markPullRequestsMerged, operationSummary, queueCategory, queueRepository, repoView, restoreRepository, setBranch, setCategory, syncAllRepositories, syncRepository, unmarkAlertHandled, unmarkDeployPending, unqueueRepository, } from "../core/repos.js";
|
|
17
|
+
import { readSettings, saveSettings, settingsView, testOrganizer } from "../core/settings.js";
|
|
18
|
+
import { APP_VERSION } from "../version.js";
|
|
19
|
+
const SAFE_METHODS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
20
|
+
/**
|
|
21
|
+
* Raison du refus d'une requête de modification venue d'un autre site, ou
|
|
22
|
+
* `null` : Sec-Fetch-Site doit valoir `same-origin` ou `none`, à défaut
|
|
23
|
+
* l'en-tête Origin doit être l'adresse publique du serveur.
|
|
24
|
+
*/
|
|
25
|
+
export function crossSiteRejection(method, headers, appUrl) {
|
|
26
|
+
if (SAFE_METHODS.has(method.toUpperCase()))
|
|
27
|
+
return null;
|
|
28
|
+
const fetchSite = headers.secFetchSite?.trim().toLowerCase();
|
|
29
|
+
if (fetchSite)
|
|
30
|
+
return fetchSite === "same-origin" || fetchSite === "none" ? null : `Cross-site request refused (Sec-Fetch-Site: ${fetchSite}).`;
|
|
31
|
+
if (headers.origin === undefined || headers.origin === appUrl)
|
|
32
|
+
return null;
|
|
33
|
+
return `Cross-site request refused (Origin: ${headers.origin}).`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* En-têtes de sécurité de toutes les réponses : la page ne charge que des
|
|
37
|
+
* ressources du serveur (polices intégrées en `data:` comprises), ne se laisse
|
|
38
|
+
* afficher dans aucun cadre, et n'envoie pas de référent. HSTS n'est envoyé
|
|
39
|
+
* qu'avec une adresse publique en https.
|
|
40
|
+
*/
|
|
41
|
+
export function securityHeaders(appUrl) {
|
|
42
|
+
return secureHeaders({
|
|
43
|
+
contentSecurityPolicy: {
|
|
44
|
+
defaultSrc: ["'self'"],
|
|
45
|
+
scriptSrc: ["'self'"],
|
|
46
|
+
styleSrc: ["'self'", "'unsafe-inline'"],
|
|
47
|
+
fontSrc: ["'self'", "data:"],
|
|
48
|
+
imgSrc: ["'self'", "data:"],
|
|
49
|
+
connectSrc: ["'self'"],
|
|
50
|
+
objectSrc: ["'none'"],
|
|
51
|
+
baseUri: ["'self'"],
|
|
52
|
+
formAction: ["'self'"],
|
|
53
|
+
frameAncestors: ["'none'"],
|
|
54
|
+
},
|
|
55
|
+
xFrameOptions: "DENY",
|
|
56
|
+
strictTransportSecurity: appUrl.startsWith("https:") ? "max-age=31536000; includeSubDomains" : false,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function statusOf(err) {
|
|
60
|
+
if (err instanceof NotFoundError)
|
|
61
|
+
return 404;
|
|
62
|
+
if (err instanceof ConflictError)
|
|
63
|
+
return 409;
|
|
64
|
+
if (err instanceof TrackerError)
|
|
65
|
+
return 400;
|
|
66
|
+
return 500;
|
|
67
|
+
}
|
|
68
|
+
/** Application Hono du serveur : authentification, API de la GUI, API des agents, fichiers de la SPA. */
|
|
69
|
+
export function createApp(ctx) {
|
|
70
|
+
const { store, dataDir, github, operations, auditAll, deployer } = ctx;
|
|
71
|
+
const app = new Hono();
|
|
72
|
+
/** Rend le résultat de `fn` en JSON, ou `{ error }` avec le code HTTP de l'erreur. */
|
|
73
|
+
async function respond(c, fn) {
|
|
74
|
+
try {
|
|
75
|
+
return c.json((await fn()));
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
const status = statusOf(err);
|
|
79
|
+
if (status === 500)
|
|
80
|
+
operations.logError(`${c.req.method} ${c.req.path} failed: ${err?.stack ?? err}`);
|
|
81
|
+
return c.json({ error: err?.message ?? String(err) }, status);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** Lit et valide le corps JSON, puis rend le résultat de `fn` ; un corps invalide est une erreur 400 explicite. */
|
|
85
|
+
async function withBody(c, schema, fn) {
|
|
86
|
+
let raw;
|
|
87
|
+
try {
|
|
88
|
+
raw = await c.req.json();
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return c.json({ error: `The request body is not valid JSON: ${err?.message ?? err}` }, 400);
|
|
92
|
+
}
|
|
93
|
+
const parsed = schema.safeParse(raw);
|
|
94
|
+
if (!parsed.success) {
|
|
95
|
+
const issues = parsed.error.issues.map((issue) => `${issue.path.map(String).join(".") || "(root)"} ${issue.message}`);
|
|
96
|
+
return c.json({ error: `Invalid request body: ${issues.join("; ")}.` }, 400);
|
|
97
|
+
}
|
|
98
|
+
return respond(c, () => fn(parsed.data));
|
|
99
|
+
}
|
|
100
|
+
/** Identifiant `propriétaire/nom` d'un dépôt, porté par deux segments de chemin. */
|
|
101
|
+
const repoId = (c) => `${c.req.param("owner")}/${c.req.param("name")}`;
|
|
102
|
+
const alertNumber = (c) => {
|
|
103
|
+
const parsed = AlertNumberSchema.safeParse(c.req.param("number"));
|
|
104
|
+
if (!parsed.success)
|
|
105
|
+
throw new TrackerError(`Alert number "${c.req.param("number")}" is not a positive integer.`);
|
|
106
|
+
return parsed.data;
|
|
107
|
+
};
|
|
108
|
+
const reposResponse = () => ({ repos: listRepoViews(store), categories: store.listCategories() });
|
|
109
|
+
const agentOperation = (operation) => ({
|
|
110
|
+
operation,
|
|
111
|
+
guiUrl: `${ctx.appUrl}#/r/${operation.repoId}/op/${operation.id}`,
|
|
112
|
+
});
|
|
113
|
+
app.use("*", securityHeaders(ctx.appUrl));
|
|
114
|
+
app.get("/health", (c) => c.json({ status: "ok", uptime: process.uptime(), timestamp: new Date().toISOString() }));
|
|
115
|
+
// --- Authentification -----------------------------------------------------------
|
|
116
|
+
/** Adresse du client vue par la socket, précédée de X-Forwarded-For quand des proxies de confiance sont configurés. */
|
|
117
|
+
const clientIpChain = (c) => {
|
|
118
|
+
const socketIp = getConnInfo(c).remote.address ?? "";
|
|
119
|
+
const forwarded = ctx.trustsProxies ? c.req.header("x-forwarded-for")?.trim() : undefined;
|
|
120
|
+
return forwarded ? `${forwarded}, ${socketIp}` : socketIp;
|
|
121
|
+
};
|
|
122
|
+
app.on(["GET", "POST"], `${AUTH_BASE_PATH}/*`, (c) => {
|
|
123
|
+
const headers = new Headers(c.req.raw.headers);
|
|
124
|
+
headers.set(CLIENT_IP_HEADER, clientIpChain(c));
|
|
125
|
+
return ctx.auth.handler(new Request(c.req.raw, { headers }));
|
|
126
|
+
});
|
|
127
|
+
app.all(`${AUTH_BASE_PATH}/*`, (c) => c.json({ error: `Unknown authentication route: ${c.req.method} ${c.req.path}` }, 404));
|
|
128
|
+
// --- API des agents ------------------------------------------------------------
|
|
129
|
+
app.use("/api/agent/*", async (c, next) => {
|
|
130
|
+
const header = c.req.header("authorization") ?? "";
|
|
131
|
+
const match = /^Bearer\s+(\S+)$/i.exec(header);
|
|
132
|
+
if (!match)
|
|
133
|
+
return c.json({ error: "An agent token is required: Authorization: Bearer <token>." }, 401);
|
|
134
|
+
if (!authenticateAgent(dataDir, match[1]))
|
|
135
|
+
return c.json({ error: "This agent token is unknown or was revoked." }, 401);
|
|
136
|
+
await next();
|
|
137
|
+
});
|
|
138
|
+
app.get("/api/agent/repos", (c) => respond(c, () => {
|
|
139
|
+
const name = c.req.query("category")?.trim();
|
|
140
|
+
const active = listRepoViews(store).filter((view) => view.repo.deprecatedAt === null);
|
|
141
|
+
if (name === undefined || name === "")
|
|
142
|
+
return { repos: active, category: null };
|
|
143
|
+
const categories = store.listCategories();
|
|
144
|
+
const category = categories.find((candidate) => candidate.name.toLowerCase() === name.toLowerCase());
|
|
145
|
+
if (!category) {
|
|
146
|
+
const known = categories.length === 0 ? "the user has created none" : `existing categories: ${categories.map((candidate) => candidate.name).join(", ")}`;
|
|
147
|
+
throw new NotFoundError(`Category "${name}" does not exist (${known}).`);
|
|
148
|
+
}
|
|
149
|
+
return { repos: active.filter((view) => view.repo.categoryId === category.id), category };
|
|
150
|
+
}));
|
|
151
|
+
app.post("/api/agent/repos/:owner/:name/sync", (c) => respond(c, async () => repoView(store, await syncRepository(store, github, store.getRepo(repoId(c)).id))));
|
|
152
|
+
app.post("/api/agent/repos/:owner/:name/audits", (c) => withBody(c, ScopeBodySchema, (body) => agentOperation(startAudit(operations, repoId(c), "agent", body.scope))));
|
|
153
|
+
app.post("/api/agent/repos/:owner/:name/fixes", (c) => withBody(c, AgentFixBodySchema, (body) => agentOperation(startFix(operations, repoId(c), "agent", { scope: body.scope, claude: body.claude }))));
|
|
154
|
+
app.get("/api/agent/operations/:id", (c) => respond(c, () => agentOperation(store.getOperation(c.req.param("id")))));
|
|
155
|
+
app.post("/api/agent/operations/:id/cancel", (c) => respond(c, () => agentOperation(cancelOperation(operations, c.req.param("id")))));
|
|
156
|
+
app.all("/api/agent/*", (c) => c.json({ error: `Unknown agent API route: ${c.req.method} ${c.req.path}` }, 404));
|
|
157
|
+
// --- API de la GUI --------------------------------------------------------------
|
|
158
|
+
// Session ouverte exigée, et refus des modifications venues d'un autre site.
|
|
159
|
+
app.use("/api/*", async (c, next) => {
|
|
160
|
+
const rejection = crossSiteRejection(c.req.method, { secFetchSite: c.req.header("sec-fetch-site"), origin: c.req.header("origin") }, ctx.appUrl);
|
|
161
|
+
if (rejection)
|
|
162
|
+
return c.json({ error: rejection }, 403);
|
|
163
|
+
const session = await ctx.auth.api.getSession({ headers: c.req.raw.headers });
|
|
164
|
+
if (!session)
|
|
165
|
+
return c.json({ error: "Sign in to use the interface." }, 401);
|
|
166
|
+
await next();
|
|
167
|
+
});
|
|
168
|
+
app.get("/api/config", (c) => respond(c, () => ({ version: APP_VERSION, dataDir, githubServerUrl: github.serverUrl })));
|
|
169
|
+
app.get("/api/repos", (c) => respond(c, reposResponse));
|
|
170
|
+
app.post("/api/repos", (c) => withBody(c, AddRepoBodySchema, async (body) => repoView(store, await addRepository(store, github, body.repository, body.categoryId))));
|
|
171
|
+
app.post("/api/sync", (c) => respond(c, async () => {
|
|
172
|
+
await syncAllRepositories(store, github);
|
|
173
|
+
return reposResponse();
|
|
174
|
+
}));
|
|
175
|
+
app.get("/api/audit-all", (c) => respond(c, () => ({ auditAll: auditAll.status() })));
|
|
176
|
+
app.post("/api/audit-all", (c) => withBody(c, AuditAllBodySchema, ({ scope, target }) => ({
|
|
177
|
+
auditAll: auditAll.start(auditTargetRepos(store, target).map((repo) => repo.id), scope, target),
|
|
178
|
+
})));
|
|
179
|
+
app.get("/api/github/repos", (c) => respond(c, async () => ({ repositories: await listAddableRepositories(store, github) })));
|
|
180
|
+
app.get("/api/repos/:owner/:name", (c) => respond(c, () => repoView(store, store.getRepo(repoId(c)))));
|
|
181
|
+
app.delete("/api/repos/:owner/:name", (c) => respond(c, () => {
|
|
182
|
+
const repo = store.getRepo(repoId(c));
|
|
183
|
+
if (deployer.deployments.active(repo.id))
|
|
184
|
+
throw new ConflictError(`A deployment is running on ${repo.id}: interrupt it before removing the repository.`);
|
|
185
|
+
store.removeRepo(repo.id);
|
|
186
|
+
deployer.deployments.removeRepo(repo.id);
|
|
187
|
+
return { removed: true };
|
|
188
|
+
}));
|
|
189
|
+
app.put("/api/repos/:owner/:name/deprecated", (c) => respond(c, () => repoView(store, deprecateRepository(store, repoId(c)))));
|
|
190
|
+
app.delete("/api/repos/:owner/:name/deprecated", (c) => respond(c, async () => repoView(store, await restoreRepository(store, github, repoId(c)))));
|
|
191
|
+
app.put("/api/repos/:owner/:name/queued", (c) => respond(c, () => repoView(store, queueRepository(store, repoId(c)))));
|
|
192
|
+
app.delete("/api/repos/:owner/:name/queued", (c) => respond(c, () => repoView(store, unqueueRepository(store, repoId(c)))));
|
|
193
|
+
app.put("/api/repos/:owner/:name/deploy-pending", (c) => respond(c, () => repoView(store, markDeployPending(store, repoId(c)))));
|
|
194
|
+
app.delete("/api/repos/:owner/:name/deploy-pending", (c) => respond(c, () => repoView(store, unmarkDeployPending(store, repoId(c)))));
|
|
195
|
+
app.put("/api/repos/:owner/:name/merged", (c) => withBody(c, MergedBodySchema, ({ deploy }) => {
|
|
196
|
+
const id = repoId(c);
|
|
197
|
+
const merged = store.getRepo(id).pullRequests.map((pull) => pull.number);
|
|
198
|
+
if (merged.length > 0)
|
|
199
|
+
assertMergeAuditPossible(operations, id);
|
|
200
|
+
const repo = markPullRequestsMerged(store, id, deploy);
|
|
201
|
+
if (merged.length > 0)
|
|
202
|
+
startMergeAudit(operations, repo.id, merged);
|
|
203
|
+
return repoView(store, repo);
|
|
204
|
+
}));
|
|
205
|
+
app.get("/api/repos/:owner/:name/branches", (c) => respond(c, async () => ({ branches: await listRepoBranches(store, github, repoId(c)) })));
|
|
206
|
+
app.put("/api/repos/:owner/:name/branch", (c) => withBody(c, SetBranchBodySchema, async (body) => repoView(store, await setBranch(store, github, repoId(c), body.branch))));
|
|
207
|
+
app.put("/api/repos/:owner/:name/category", (c) => withBody(c, SetCategoryBodySchema, (body) => repoView(store, setCategory(store, repoId(c), body.categoryId))));
|
|
208
|
+
app.put("/api/repos/:owner/:name/alerts/:number/handled", (c) => respond(c, () => repoView(store, markAlertHandled(store, repoId(c), alertNumber(c)))));
|
|
209
|
+
app.delete("/api/repos/:owner/:name/alerts/:number/handled", (c) => respond(c, () => repoView(store, unmarkAlertHandled(store, repoId(c), alertNumber(c)))));
|
|
210
|
+
app.get("/api/categories", (c) => respond(c, () => ({ categories: store.listCategories() })));
|
|
211
|
+
app.post("/api/categories", (c) => withBody(c, CategoryBodySchema, (body) => store.createCategory(body.name)));
|
|
212
|
+
app.put("/api/categories/:id", (c) => withBody(c, CategoryBodySchema, (body) => store.renameCategory(c.req.param("id"), body.name)));
|
|
213
|
+
app.delete("/api/categories/:id", (c) => respond(c, () => {
|
|
214
|
+
store.deleteCategory(c.req.param("id"));
|
|
215
|
+
return { deleted: true };
|
|
216
|
+
}));
|
|
217
|
+
app.put("/api/categories/:id/queued", (c) => respond(c, () => {
|
|
218
|
+
queueCategory(store, c.req.param("id"));
|
|
219
|
+
return reposResponse();
|
|
220
|
+
}));
|
|
221
|
+
app.post("/api/repos/:owner/:name/operations", (c) => withBody(c, ScopeBodySchema, (body) => ({ operation: startFix(operations, repoId(c), "user", { scope: body.scope, claude: true }) })));
|
|
222
|
+
app.get("/api/repos/:owner/:name/operations", (c) => respond(c, () => {
|
|
223
|
+
const repo = store.getRepo(repoId(c));
|
|
224
|
+
return { operations: store.listOperations(repo.id).map(operationSummary) };
|
|
225
|
+
}));
|
|
226
|
+
app.get("/api/operations/:id", (c) => respond(c, () => ({ operation: store.getOperation(c.req.param("id")) })));
|
|
227
|
+
app.post("/api/operations/:id/cancel", (c) => respond(c, () => ({ operation: cancelOperation(operations, c.req.param("id")) })));
|
|
228
|
+
app.get("/api/deploy-servers", (c) => respond(c, () => ({ servers: deployer.servers.list().map((server) => deployer.servers.view(server)) })));
|
|
229
|
+
app.post("/api/deploy-servers", (c) => withBody(c, DeployServerBodySchema, (body) => deployer.servers.view(deployer.servers.create(body))));
|
|
230
|
+
app.put("/api/deploy-servers/:id", (c) => withBody(c, DeployServerBodySchema, (body) => deployer.servers.view(deployer.servers.update(c.req.param("id"), body))));
|
|
231
|
+
app.post("/api/deploy-servers/:id/test", (c) => respond(c, () => deployer.servers.test(c.req.param("id"))));
|
|
232
|
+
/** Opération sur la clé d'un serveur, refusée pendant un déploiement qui l'utilise. */
|
|
233
|
+
const withIdleServer = (c, fn) => {
|
|
234
|
+
const id = deployer.servers.get(c.req.param("id")).id;
|
|
235
|
+
deployer.assertServerIdle(id);
|
|
236
|
+
return fn(id);
|
|
237
|
+
};
|
|
238
|
+
app.post("/api/deploy-servers/:id/key", (c) => respond(c, () => deployer.servers.installNewKey(c.req.param("id"))));
|
|
239
|
+
app.post("/api/deploy-servers/:id/key/rotate", (c) => respond(c, () => withIdleServer(c, (id) => deployer.servers.rotate(id))));
|
|
240
|
+
app.post("/api/deploy-servers/:id/key/revoke", (c) => respond(c, () => withIdleServer(c, (id) => deployer.servers.revoke(id))));
|
|
241
|
+
app.post("/api/deploy-servers/:id/key/forget", (c) => respond(c, () => withIdleServer(c, (id) => deployer.servers.forget(id))));
|
|
242
|
+
app.get("/api/repos/:owner/:name/deploy", (c) => respond(c, () => deployer.view(repoId(c))));
|
|
243
|
+
app.put("/api/repos/:owner/:name/deploy/server", (c) => withBody(c, SetDeployServerBodySchema, (body) => deployer.setServer(repoId(c), body.serverId)));
|
|
244
|
+
app.put("/api/repos/:owner/:name/deploy/script", (c) => withBody(c, SaveScriptBodySchema, (body) => deployer.saveScript(repoId(c), body.script)));
|
|
245
|
+
app.post("/api/repos/:owner/:name/deployments", (c) => respond(c, async () => ({ deployment: await deployer.start(repoId(c)) })));
|
|
246
|
+
app.get("/api/deployments/:id", (c) => respond(c, () => ({ deployment: deployer.deployments.get(c.req.param("id")) })));
|
|
247
|
+
app.post("/api/deployments/:id/cancel", (c) => respond(c, async () => ({ deployment: await deployer.cancel(c.req.param("id")) })));
|
|
248
|
+
app.get("/api/settings", (c) => respond(c, () => settingsView(readSettings(dataDir, ctx.vaultKey))));
|
|
249
|
+
app.put("/api/settings", (c) => withBody(c, SaveSettingsBodySchema, (body) => saveSettings(dataDir, ctx.vaultKey, body, ctx.settingsChecks)));
|
|
250
|
+
app.post("/api/settings/organizer/test", (c) => respond(c, () => testOrganizer(dataDir, ctx.vaultKey, ctx.settingsChecks)));
|
|
251
|
+
app.get("/api/agent-tokens", (c) => respond(c, () => ({ tokens: listAgentTokens(dataDir) })));
|
|
252
|
+
app.post("/api/agent-tokens", (c) => withBody(c, CreateAgentTokenBodySchema, (body) => {
|
|
253
|
+
const { token, secret } = createAgentToken(dataDir, body.name);
|
|
254
|
+
return { token, secret, setupCommand: setupCommand({ serverUrl: ctx.appUrl, token: secret }) };
|
|
255
|
+
}));
|
|
256
|
+
app.delete("/api/agent-tokens/:id", (c) => respond(c, () => {
|
|
257
|
+
revokeAgentToken(dataDir, c.req.param("id"));
|
|
258
|
+
return { revoked: true };
|
|
259
|
+
}));
|
|
260
|
+
/** Route d'API inconnue : 404 explicite plutôt que la page de la SPA. */
|
|
261
|
+
app.all("/api/*", (c) => c.json({ error: `Unknown API route: ${c.req.method} ${c.req.path}` }, 404));
|
|
262
|
+
// --- Fichiers de la SPA ---------------------------------------------------------
|
|
263
|
+
app.use("/assets/*", serveStatic({ root: path.relative(process.cwd(), ctx.staticRoot) }));
|
|
264
|
+
// Toute autre route renvoie la page de la SPA, qui affiche l'écran de connexion sans session.
|
|
265
|
+
app.get("/*", (c) => {
|
|
266
|
+
const indexPath = path.join(ctx.staticRoot, "index.html");
|
|
267
|
+
if (!fs.existsSync(indexPath)) {
|
|
268
|
+
return c.text(`GUI build not found at ${ctx.staticRoot}. Run "npm run build:gui" in the package.`, 404);
|
|
269
|
+
}
|
|
270
|
+
return c.html(fs.readFileSync(indexPath, "utf8"));
|
|
271
|
+
});
|
|
272
|
+
return app;
|
|
273
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Charge le `.env` de la racine du paquet, s'il existe ; ses valeurs priment sur l'environnement. */
|
|
2
|
+
export declare function loadPackageEnv(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Serveur Dependabot Tracker : interface, API de la GUI et des agents,
|
|
5
|
+
* opérations et relecture périodique des alertes, dans un seul processus.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serve(): Promise<void>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import dotenv from "dotenv";
|
|
5
|
+
import { serve as serveHttp } from "@hono/node-server";
|
|
6
|
+
import { createLogger, setupLogging } from "@imenam/mcp-gui-interface";
|
|
7
|
+
import { AuditAll } from "../core/audit-all.js";
|
|
8
|
+
import { createAuth, listUsers, migrateAuth } from "../core/auth.js";
|
|
9
|
+
import { checkClaudeToken, packagedClaudeCommand } from "../core/claude.js";
|
|
10
|
+
import { readGitHubConfig } from "../core/config.js";
|
|
11
|
+
import { resolveCloneDir, resolveDataDir } from "../core/data-dir.js";
|
|
12
|
+
import { DeployServerStore } from "../core/deploy-servers.js";
|
|
13
|
+
import { Deployer, DeploymentStore } from "../core/deployments.js";
|
|
14
|
+
import { resolveLogDir } from "../core/log-dir.js";
|
|
15
|
+
import { runDefaultBranchAudit } from "../core/operations.js";
|
|
16
|
+
import { OrganizerClient } from "../core/organizer.js";
|
|
17
|
+
import { refreshReportTask } from "../core/repair.js";
|
|
18
|
+
import { SYNC_INTERVAL_MS, staleRepos, syncRepository } from "../core/repos.js";
|
|
19
|
+
import { encryptStoredTokens, readSettings } from "../core/settings.js";
|
|
20
|
+
import { readServerConfig } from "../core/server-config.js";
|
|
21
|
+
import { Store } from "../core/store.js";
|
|
22
|
+
import { parseVaultKey } from "../core/vault.js";
|
|
23
|
+
import { APP_VERSION } from "../version.js";
|
|
24
|
+
import { createApp } from "./app.js";
|
|
25
|
+
/** Intervalle de vérification des dépôts à relire. */
|
|
26
|
+
const SYNC_CHECK_MS = 60_000;
|
|
27
|
+
/** Racine du paquet : le premier dossier qui contient un package.json, en remontant depuis ce module. */
|
|
28
|
+
function packageRoot() {
|
|
29
|
+
let current = path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
while (!fs.existsSync(path.join(current, "package.json"))) {
|
|
31
|
+
const parent = path.dirname(current);
|
|
32
|
+
if (parent === current)
|
|
33
|
+
throw new Error("package.json not found above the server module.");
|
|
34
|
+
current = parent;
|
|
35
|
+
}
|
|
36
|
+
return current;
|
|
37
|
+
}
|
|
38
|
+
/** Charge le `.env` de la racine du paquet, s'il existe ; ses valeurs priment sur l'environnement. */
|
|
39
|
+
export function loadPackageEnv() {
|
|
40
|
+
const envFile = path.join(packageRoot(), ".env");
|
|
41
|
+
if (fs.existsSync(envFile))
|
|
42
|
+
dotenv.config({ path: envFile, override: true, quiet: true });
|
|
43
|
+
}
|
|
44
|
+
/** Met le serveur à l'écoute de `port` sur l'adresse `hostname` ; un port occupé arrête le serveur. */
|
|
45
|
+
function listen(app, port, hostname) {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const server = serveHttp({ fetch: app.fetch, port, hostname }, () => resolve());
|
|
48
|
+
server.on("error", (err) => {
|
|
49
|
+
reject(err.code === "EADDRINUSE" ? new Error(`Port ${port} is already in use: another server listens on it.`) : err);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Serveur Dependabot Tracker : interface, API de la GUI et des agents,
|
|
55
|
+
* opérations et relecture périodique des alertes, dans un seul processus.
|
|
56
|
+
*/
|
|
57
|
+
export async function serve() {
|
|
58
|
+
const root = packageRoot();
|
|
59
|
+
loadPackageEnv();
|
|
60
|
+
let dataDir;
|
|
61
|
+
try {
|
|
62
|
+
dataDir = resolveDataDir();
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
console.error(err.message);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
setupLogging({ processLabel: "mcp-dependabot-tracker", logDir: resolveLogDir(dataDir) });
|
|
69
|
+
const logger = createLogger("mcp-dependabot-tracker");
|
|
70
|
+
process.on("uncaughtException", (err) => {
|
|
71
|
+
logger.error(`Uncaught exception: ${err.stack ?? err.message}`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
});
|
|
74
|
+
process.on("unhandledRejection", (reason) => {
|
|
75
|
+
logger.error(`Unhandled rejection: ${reason?.stack ?? reason}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
let github;
|
|
79
|
+
let cloneDir;
|
|
80
|
+
let config;
|
|
81
|
+
let vaultKey;
|
|
82
|
+
try {
|
|
83
|
+
github = readGitHubConfig();
|
|
84
|
+
cloneDir = resolveCloneDir(dataDir);
|
|
85
|
+
config = readServerConfig();
|
|
86
|
+
vaultKey = parseVaultKey(process.env.VAULT_KEY);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
logger.error(err.message);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
let auth;
|
|
93
|
+
try {
|
|
94
|
+
auth = createAuth(dataDir, config);
|
|
95
|
+
await migrateAuth(auth);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
logger.error(`The account database cannot be opened: ${err?.stack ?? err}`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
const store = new Store(dataDir);
|
|
102
|
+
const deployServers = new DeployServerStore(dataDir, vaultKey);
|
|
103
|
+
try {
|
|
104
|
+
deployServers.verifyVault();
|
|
105
|
+
if (encryptStoredTokens(dataDir, vaultKey))
|
|
106
|
+
logger.info("The tokens of settings.json are now encrypted with VAULT_KEY.");
|
|
107
|
+
readSettings(dataDir, vaultKey);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
logger.error(err.message);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
const deployer = new Deployer(store, deployServers, new DeploymentStore(dataDir), github, (message) => logger.error(message));
|
|
114
|
+
const claude = { command: packagedClaudeCommand(), home: path.join(dataDir, "claude") };
|
|
115
|
+
const settingsChecks = {
|
|
116
|
+
organizer: (connection) => new OrganizerClient(connection).space(),
|
|
117
|
+
claudeToken: (token) => checkClaudeToken(claude, token),
|
|
118
|
+
};
|
|
119
|
+
const operations = {
|
|
120
|
+
store,
|
|
121
|
+
githubConfig: () => github,
|
|
122
|
+
cloneDir: () => cloneDir,
|
|
123
|
+
logError: (message) => logger.error(message),
|
|
124
|
+
settings: () => readSettings(dataDir, vaultKey),
|
|
125
|
+
claude,
|
|
126
|
+
};
|
|
127
|
+
const auditAll = new AuditAll((repoId, scope) => runDefaultBranchAudit(operations, repoId, scope), (message) => logger.error(message));
|
|
128
|
+
const app = createApp({
|
|
129
|
+
store,
|
|
130
|
+
dataDir,
|
|
131
|
+
github,
|
|
132
|
+
operations,
|
|
133
|
+
auditAll,
|
|
134
|
+
deployer,
|
|
135
|
+
settingsChecks,
|
|
136
|
+
staticRoot: path.join(root, "gui", "dist"),
|
|
137
|
+
auth,
|
|
138
|
+
vaultKey,
|
|
139
|
+
appUrl: config.appUrl,
|
|
140
|
+
trustsProxies: config.trustedProxies.length > 0,
|
|
141
|
+
});
|
|
142
|
+
process.on("SIGTERM", () => process.exit(0));
|
|
143
|
+
process.on("SIGINT", () => process.exit(0));
|
|
144
|
+
try {
|
|
145
|
+
await listen(app, config.port, config.listenHost);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
logger.error(err.message);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
for (const deployment of deployer.deployments.failInterrupted())
|
|
152
|
+
logger.warn(`Deployment ${deployment.id} on ${deployment.repoId} was interrupted by the last stop of the server.`);
|
|
153
|
+
for (const operation of store.failInterruptedOperations())
|
|
154
|
+
logger.warn(`Operation ${operation.id} on ${operation.repoId} was interrupted by the last stop of the server.`);
|
|
155
|
+
logger.info(`Dependabot Tracker ${APP_VERSION} serves ${config.appUrl} (port ${config.port} on ${config.listenHost}, data dir ${dataDir}, clone dir ${cloneDir})`);
|
|
156
|
+
const users = await listUsers(auth);
|
|
157
|
+
if (users.length === 0)
|
|
158
|
+
logger.warn('No account exists yet: create one with "mcp-dependabot-tracker user add <email>".');
|
|
159
|
+
for (const user of users.filter((candidate) => !candidate.twoFactor)) {
|
|
160
|
+
logger.warn(`The account ${user.email} signs in with its password alone: enable two-factor authentication with "mcp-dependabot-tracker user totp ${user.email}".`);
|
|
161
|
+
}
|
|
162
|
+
let syncing = false;
|
|
163
|
+
/** Relit les alertes des dépôts lus il y a plus de 10 minutes, et le statut de la tâche organizer du dernier rapport de Claude. */
|
|
164
|
+
const syncStaleRepos = async () => {
|
|
165
|
+
if (syncing)
|
|
166
|
+
return;
|
|
167
|
+
syncing = true;
|
|
168
|
+
try {
|
|
169
|
+
for (const repo of staleRepos(store, SYNC_INTERVAL_MS)) {
|
|
170
|
+
const synced = await syncRepository(store, github, repo.id);
|
|
171
|
+
if (synced.syncError)
|
|
172
|
+
logger.warn(`Dependabot alerts of ${repo.id} not synced: ${synced.syncError}`);
|
|
173
|
+
await refreshReportTask(store, readSettings(dataDir, vaultKey), repo.id).catch((err) => logger.warn(`Organizer task of ${repo.id} not refreshed: ${err?.message ?? err}`));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (err) {
|
|
177
|
+
logger.error(`Alert sync failed: ${err?.stack ?? err}`);
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
syncing = false;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
void syncStaleRepos();
|
|
184
|
+
setInterval(() => void syncStaleRepos(), SYNC_CHECK_MS);
|
|
185
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentOperationResponse, AgentReposResponse, RepoView } from "../../shared/schemas/api.schema.js";
|
|
2
|
+
import type { AuditScope } from "../../shared/schemas/model.schema.js";
|
|
3
|
+
/** Client de l'API des agents du serveur Dependabot Tracker, authentifié par un token d'agent. */
|
|
4
|
+
export declare class AgentClient {
|
|
5
|
+
private readonly serverUrl;
|
|
6
|
+
private readonly token;
|
|
7
|
+
constructor(serverUrl: string, token: string);
|
|
8
|
+
private request;
|
|
9
|
+
listRepositories(category: string | undefined): Promise<AgentReposResponse>;
|
|
10
|
+
syncAlerts(repository: string): Promise<RepoView>;
|
|
11
|
+
startAudit(repository: string, scope: AuditScope): Promise<AgentOperationResponse>;
|
|
12
|
+
startFix(repository: string, scope: AuditScope, claude: boolean): Promise<AgentOperationResponse>;
|
|
13
|
+
getOperation(id: string): Promise<AgentOperationResponse>;
|
|
14
|
+
cancelOperation(id: string): Promise<AgentOperationResponse>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Délai de réponse du serveur ; la relecture des alertes interroge GitHub. */
|
|
2
|
+
const REQUEST_TIMEOUT_MS = 45_000;
|
|
3
|
+
/** Chemin d'un dépôt `propriétaire/nom` : deux segments encodés séparément. */
|
|
4
|
+
function repoPath(repository) {
|
|
5
|
+
const [owner, name, ...rest] = repository.split("/");
|
|
6
|
+
if (!owner || !name || rest.length > 0)
|
|
7
|
+
throw new Error(`"repository" must be owner/name (got ${JSON.stringify(repository)}).`);
|
|
8
|
+
return `repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}`;
|
|
9
|
+
}
|
|
10
|
+
/** Client de l'API des agents du serveur Dependabot Tracker, authentifié par un token d'agent. */
|
|
11
|
+
export class AgentClient {
|
|
12
|
+
serverUrl;
|
|
13
|
+
token;
|
|
14
|
+
constructor(serverUrl, token) {
|
|
15
|
+
this.serverUrl = serverUrl;
|
|
16
|
+
this.token = token;
|
|
17
|
+
}
|
|
18
|
+
async request(method, route, body) {
|
|
19
|
+
const url = `${this.serverUrl}/api/agent/${route}`;
|
|
20
|
+
let response;
|
|
21
|
+
try {
|
|
22
|
+
response = await fetch(url, {
|
|
23
|
+
method,
|
|
24
|
+
headers: { Authorization: `Bearer ${this.token}`, ...(body === undefined ? {} : { "Content-Type": "application/json" }) },
|
|
25
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
26
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new Error(`The Dependabot Tracker server at ${this.serverUrl} cannot be reached: ${err?.cause?.message ?? err?.message ?? err}`);
|
|
31
|
+
}
|
|
32
|
+
const text = await response.text();
|
|
33
|
+
let json;
|
|
34
|
+
try {
|
|
35
|
+
json = JSON.parse(text);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
throw new Error(`The Dependabot Tracker server answered ${method} ${url} with HTTP ${response.status} and no JSON: ${text.slice(0, 300)}`);
|
|
39
|
+
}
|
|
40
|
+
if (!response.ok)
|
|
41
|
+
throw new Error(json?.error ?? `HTTP ${response.status}`);
|
|
42
|
+
return json;
|
|
43
|
+
}
|
|
44
|
+
listRepositories(category) {
|
|
45
|
+
return this.request("GET", category === undefined ? "repos" : `repos?category=${encodeURIComponent(category)}`);
|
|
46
|
+
}
|
|
47
|
+
syncAlerts(repository) {
|
|
48
|
+
return this.request("POST", `${repoPath(repository)}/sync`);
|
|
49
|
+
}
|
|
50
|
+
startAudit(repository, scope) {
|
|
51
|
+
return this.request("POST", `${repoPath(repository)}/audits`, { scope });
|
|
52
|
+
}
|
|
53
|
+
startFix(repository, scope, claude) {
|
|
54
|
+
return this.request("POST", `${repoPath(repository)}/fixes`, { scope, claude });
|
|
55
|
+
}
|
|
56
|
+
getOperation(id) {
|
|
57
|
+
return this.request("GET", `operations/${encodeURIComponent(id)}`);
|
|
58
|
+
}
|
|
59
|
+
cancelOperation(id) {
|
|
60
|
+
return this.request("POST", `operations/${encodeURIComponent(id)}/cancel`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Operation, type Repo } from "../../shared/schemas/model.schema.js";
|
|
2
2
|
import type { RepoView } from "../../shared/schemas/api.schema.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare function describeRepo(view: RepoView, category: Category | null): string;
|
|
3
|
+
/** Description d'un dépôt pour l'agent. */
|
|
4
|
+
export declare function describeRepo(view: RepoView): string;
|
|
6
5
|
export declare function describeAlerts(repo: Repo): string;
|
|
7
|
-
/** Compte rendu d'une opération pour l'agent :
|
|
6
|
+
/** Compte rendu d'une opération pour l'agent : avancement, vulnérabilités, paquets modifiés, corrections par Claude, PR, erreur. */
|
|
8
7
|
export declare function describeOperation(operation: Operation): string;
|