@imenam/mcp-dependabot-tracker 1.0.25 → 1.0.27
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 +32 -11
- package/dist/shared/schemas/settings.schema.d.ts +36 -1
- package/dist/shared/schemas/settings.schema.js +22 -1
- package/dist/src/core/config.d.ts +6 -2
- package/dist/src/core/config.js +11 -9
- package/dist/src/core/data-dir.d.ts +6 -10
- package/dist/src/core/data-dir.js +14 -18
- package/dist/src/core/deployments.d.ts +17 -2
- package/dist/src/core/deployments.js +29 -4
- package/dist/src/core/github.d.ts +15 -2
- package/dist/src/core/github.js +21 -4
- package/dist/src/core/log-dir.d.ts +1 -1
- package/dist/src/core/log-dir.js +2 -3
- package/dist/src/core/settings.d.ts +24 -1
- package/dist/src/core/settings.js +64 -8
- package/dist/src/server/app.d.ts +4 -1
- package/dist/src/server/app.js +8 -8
- package/dist/src/server/serve.js +39 -10
- package/gui/dist/assets/{index-FrRzRTkV.js → index-BhIO2hHa.js} +1 -1
- package/gui/dist/assets/{index-o3l3BAZD.css → index-JLEsoQSQ.css} +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ import { TrackerError } from "./errors.js";
|
|
|
6
6
|
import { organizerUrl } from "./organizer.js";
|
|
7
7
|
import { decryptSecret, encryptSecret, isEncrypted } from "./vault.js";
|
|
8
8
|
/**
|
|
9
|
-
* Réglages
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* en entier.
|
|
9
|
+
* Réglages du tracker, dans `<données>/settings.json`, lisible par le seul
|
|
10
|
+
* compte du serveur : ils portent le token GitHub du tracker, le token de
|
|
11
|
+
* déploiement, le token de l'organizer et celui de Claude, chiffrés avec
|
|
12
|
+
* VAULT_KEY dans le fichier, que la GUI ne reçoit jamais en entier.
|
|
13
13
|
*/
|
|
14
14
|
/** Durée de validité d'un token créé par `claude setup-token`. */
|
|
15
15
|
const CLAUDE_TOKEN_VALIDITY_MS = 365 * 24 * 3600_000;
|
|
@@ -36,7 +36,13 @@ function readSettingsFile(dataDir) {
|
|
|
36
36
|
/** Applique `fn` à chaque token des réglages, null laissé tel quel. */
|
|
37
37
|
function mapTokens(settings, fn) {
|
|
38
38
|
const map = (token) => (token === null ? null : fn(token));
|
|
39
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
...settings,
|
|
41
|
+
organizer: { ...settings.organizer, token: map(settings.organizer.token) },
|
|
42
|
+
claude: { ...settings.claude, token: map(settings.claude.token) },
|
|
43
|
+
github: { ...settings.github, token: map(settings.github.token) },
|
|
44
|
+
deploy: { ...settings.deploy, token: map(settings.deploy.token) },
|
|
45
|
+
};
|
|
40
46
|
}
|
|
41
47
|
/** Réglages, tokens déchiffrés avec `vaultKey` ; un token que la clé ne déchiffre pas lève une erreur. */
|
|
42
48
|
export function readSettings(dataDir, vaultKey) {
|
|
@@ -60,7 +66,7 @@ export function encryptStoredTokens(dataDir, vaultKey) {
|
|
|
60
66
|
const stored = readSettingsFile(dataDir);
|
|
61
67
|
if (stored === null)
|
|
62
68
|
return false;
|
|
63
|
-
const tokens = [stored.organizer.token, stored.claude.token].filter((token) => token !== null);
|
|
69
|
+
const tokens = [stored.organizer.token, stored.claude.token, stored.github.token, stored.deploy.token].filter((token) => token !== null);
|
|
64
70
|
if (tokens.every(isEncrypted))
|
|
65
71
|
return false;
|
|
66
72
|
writeSettingsFile(dataDir, mapTokens(stored, (token) => (isEncrypted(token) ? token : encryptSecret(token, vaultKey))));
|
|
@@ -86,6 +92,38 @@ export function organizerConnection(settings) {
|
|
|
86
92
|
const { url, token } = settings.organizer;
|
|
87
93
|
return url && token ? { url, token } : null;
|
|
88
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Reprend dans les réglages le GITHUB_TOKEN de l'environnement tant que les
|
|
97
|
+
* réglages n'ont pas de token du tracker : il y est vérifié auprès de GitHub
|
|
98
|
+
* (un refus est rendu en avertissement, le token est repris quand même) et
|
|
99
|
+
* chiffré. Avec un token déjà réglé, la variable est ignorée.
|
|
100
|
+
*/
|
|
101
|
+
export async function adoptEnvGitHubToken(dataDir, vaultKey, envToken, checks) {
|
|
102
|
+
const token = envToken?.trim();
|
|
103
|
+
if (!token)
|
|
104
|
+
return { status: "none" };
|
|
105
|
+
const current = readSettings(dataDir, vaultKey);
|
|
106
|
+
if (current.github.token !== null)
|
|
107
|
+
return { status: "ignored" };
|
|
108
|
+
let check = null;
|
|
109
|
+
let warning = null;
|
|
110
|
+
try {
|
|
111
|
+
check = await checks.githubToken(token);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
warning = err?.message ?? String(err);
|
|
115
|
+
}
|
|
116
|
+
writeSettings(dataDir, vaultKey, { ...current, github: { token, savedAt: new Date().toISOString(), login: check?.login ?? null, expiresAt: check?.expiresAt ?? null } });
|
|
117
|
+
return { status: "adopted", warning };
|
|
118
|
+
}
|
|
119
|
+
/** Token GitHub du tracker, null sans token enregistré. */
|
|
120
|
+
export function githubToken(settings) {
|
|
121
|
+
return settings.github.token;
|
|
122
|
+
}
|
|
123
|
+
/** Token GitHub transmis aux scripts de déploiement, null sans token enregistré. */
|
|
124
|
+
export function deployToken(settings) {
|
|
125
|
+
return settings.deploy.token;
|
|
126
|
+
}
|
|
89
127
|
/** Vrai quand l'organizer (connexion testée) et Claude sont configurés. */
|
|
90
128
|
export function analysisReady(settings) {
|
|
91
129
|
return organizerConnection(settings) !== null && settings.organizer.space !== null && settings.claude.token !== null;
|
|
@@ -93,6 +131,14 @@ export function analysisReady(settings) {
|
|
|
93
131
|
function tokenHint(token) {
|
|
94
132
|
return token === null ? null : token.slice(-4);
|
|
95
133
|
}
|
|
134
|
+
function tokenView({ token, savedAt, login, expiresAt }) {
|
|
135
|
+
return { tokenHint: tokenHint(token), savedAt, login, expiresAt };
|
|
136
|
+
}
|
|
137
|
+
/** Token GitHub vérifié, avec son compte et son expiration, prêt à enregistrer. */
|
|
138
|
+
async function checkedGitHubToken(token, checks) {
|
|
139
|
+
const { login, expiresAt } = await checks.githubToken(token);
|
|
140
|
+
return { token, savedAt: new Date().toISOString(), login, expiresAt };
|
|
141
|
+
}
|
|
96
142
|
export function settingsView(settings) {
|
|
97
143
|
const { savedAt } = settings.claude;
|
|
98
144
|
return {
|
|
@@ -104,6 +150,8 @@ export function settingsView(settings) {
|
|
|
104
150
|
},
|
|
105
151
|
analysis: settings.analysis,
|
|
106
152
|
ready: analysisReady(settings),
|
|
153
|
+
github: tokenView(settings.github),
|
|
154
|
+
deploy: tokenView(settings.deploy),
|
|
107
155
|
};
|
|
108
156
|
}
|
|
109
157
|
/** Espace et propriétaire relevés par un test de la connexion, ou rien sans connexion. */
|
|
@@ -115,7 +163,7 @@ async function checkedOrganizer(organizer, checks) {
|
|
|
115
163
|
}
|
|
116
164
|
/**
|
|
117
165
|
* Enregistre les réglages de la GUI. Une connexion à l'organizer modifiée est
|
|
118
|
-
* testée, un nouveau token Claude vérifié : un échec refuse tout
|
|
166
|
+
* testée, un nouveau token Claude ou GitHub vérifié : un échec refuse tout
|
|
119
167
|
* l'enregistrement.
|
|
120
168
|
*/
|
|
121
169
|
export async function saveSettings(dataDir, vaultKey, body, checks) {
|
|
@@ -129,7 +177,15 @@ export async function saveSettings(dataDir, vaultKey, body, checks) {
|
|
|
129
177
|
await checks.claudeToken(body.claudeToken);
|
|
130
178
|
claude = { token: body.claudeToken, savedAt: new Date().toISOString() };
|
|
131
179
|
}
|
|
132
|
-
const
|
|
180
|
+
const github = body.githubToken === undefined ? current.github : await checkedGitHubToken(body.githubToken, checks);
|
|
181
|
+
let deploy = current.deploy;
|
|
182
|
+
if (body.deployToken === null) {
|
|
183
|
+
deploy = DEFAULT_SETTINGS.deploy;
|
|
184
|
+
}
|
|
185
|
+
else if (body.deployToken !== undefined) {
|
|
186
|
+
deploy = await checkedGitHubToken(body.deployToken, checks);
|
|
187
|
+
}
|
|
188
|
+
const next = { organizer, claude, analysis: body.analysis, github, deploy };
|
|
133
189
|
writeSettings(dataDir, vaultKey, next);
|
|
134
190
|
return settingsView(next);
|
|
135
191
|
}
|
package/dist/src/server/app.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import type { Store } from "../core/store.js";
|
|
|
10
10
|
export interface ServerContext {
|
|
11
11
|
store: Store;
|
|
12
12
|
dataDir: string;
|
|
13
|
-
|
|
13
|
+
/** Configuration GitHub, avec le token du tracker relu dans les réglages ; lève une erreur sans token. */
|
|
14
|
+
github: () => GitHubConfig;
|
|
15
|
+
/** Adresse web du serveur GitHub, connue même sans token. */
|
|
16
|
+
githubServerUrl: string;
|
|
14
17
|
operations: OperationContext;
|
|
15
18
|
auditAll: AuditAll;
|
|
16
19
|
/** Serveurs de déploiement, scripts et déploiements des dépôts. */
|
package/dist/src/server/app.js
CHANGED
|
@@ -148,7 +148,7 @@ export function createApp(ctx) {
|
|
|
148
148
|
}
|
|
149
149
|
return { repos: active.filter((view) => view.repo.categoryId === category.id), category };
|
|
150
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))));
|
|
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
152
|
app.post("/api/agent/repos/:owner/:name/audits", (c) => withBody(c, ScopeBodySchema, (body) => agentOperation(startAudit(operations, repoId(c), "agent", body.scope))));
|
|
153
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
154
|
app.get("/api/agent/operations/:id", (c) => respond(c, () => agentOperation(store.getOperation(c.req.param("id")))));
|
|
@@ -165,18 +165,18 @@ export function createApp(ctx) {
|
|
|
165
165
|
return c.json({ error: "Sign in to use the interface." }, 401);
|
|
166
166
|
await next();
|
|
167
167
|
});
|
|
168
|
-
app.get("/api/config", (c) => respond(c, () => ({ version: APP_VERSION, dataDir, githubServerUrl:
|
|
168
|
+
app.get("/api/config", (c) => respond(c, () => ({ version: APP_VERSION, dataDir, githubServerUrl: ctx.githubServerUrl })));
|
|
169
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))));
|
|
170
|
+
app.post("/api/repos", (c) => withBody(c, AddRepoBodySchema, async (body) => repoView(store, await addRepository(store, github(), body.repository, body.categoryId))));
|
|
171
171
|
app.post("/api/sync", (c) => respond(c, async () => {
|
|
172
|
-
await syncAllRepositories(store, github);
|
|
172
|
+
await syncAllRepositories(store, github());
|
|
173
173
|
return reposResponse();
|
|
174
174
|
}));
|
|
175
175
|
app.get("/api/audit-all", (c) => respond(c, () => ({ auditAll: auditAll.status() })));
|
|
176
176
|
app.post("/api/audit-all", (c) => withBody(c, AuditAllBodySchema, ({ scope, target }) => ({
|
|
177
177
|
auditAll: auditAll.start(auditTargetRepos(store, target).map((repo) => repo.id), scope, target),
|
|
178
178
|
})));
|
|
179
|
-
app.get("/api/github/repos", (c) => respond(c, async () => ({ repositories: await listAddableRepositories(store, github) })));
|
|
179
|
+
app.get("/api/github/repos", (c) => respond(c, async () => ({ repositories: await listAddableRepositories(store, github()) })));
|
|
180
180
|
app.get("/api/repos/:owner/:name", (c) => respond(c, () => repoView(store, store.getRepo(repoId(c)))));
|
|
181
181
|
app.delete("/api/repos/:owner/:name", (c) => respond(c, () => {
|
|
182
182
|
const repo = store.getRepo(repoId(c));
|
|
@@ -187,7 +187,7 @@ export function createApp(ctx) {
|
|
|
187
187
|
return { removed: true };
|
|
188
188
|
}));
|
|
189
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)))));
|
|
190
|
+
app.delete("/api/repos/:owner/:name/deprecated", (c) => respond(c, async () => repoView(store, await restoreRepository(store, github(), repoId(c)))));
|
|
191
191
|
app.put("/api/repos/:owner/:name/queued", (c) => respond(c, () => repoView(store, queueRepository(store, repoId(c)))));
|
|
192
192
|
app.delete("/api/repos/:owner/:name/queued", (c) => respond(c, () => repoView(store, unqueueRepository(store, repoId(c)))));
|
|
193
193
|
app.put("/api/repos/:owner/:name/deploy-pending", (c) => respond(c, () => repoView(store, markDeployPending(store, repoId(c)))));
|
|
@@ -202,8 +202,8 @@ export function createApp(ctx) {
|
|
|
202
202
|
startMergeAudit(operations, repo.id, merged);
|
|
203
203
|
return repoView(store, repo);
|
|
204
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))));
|
|
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
207
|
app.put("/api/repos/:owner/:name/category", (c) => withBody(c, SetCategoryBodySchema, (body) => repoView(store, setCategory(store, repoId(c), body.categoryId))));
|
|
208
208
|
app.put("/api/repos/:owner/:name/alerts/:number/handled", (c) => respond(c, () => repoView(store, markAlertHandled(store, repoId(c), alertNumber(c)))));
|
|
209
209
|
app.delete("/api/repos/:owner/:name/alerts/:number/handled", (c) => respond(c, () => repoView(store, unmarkAlertHandled(store, repoId(c), alertNumber(c)))));
|
package/dist/src/server/serve.js
CHANGED
|
@@ -7,7 +7,8 @@ import { createLogger, setupLogging } from "@imenam/mcp-gui-interface";
|
|
|
7
7
|
import { AuditAll } from "../core/audit-all.js";
|
|
8
8
|
import { createAuth, listUsers, migrateAuth } from "../core/auth.js";
|
|
9
9
|
import { checkClaudeToken, packagedClaudeCommand } from "../core/claude.js";
|
|
10
|
-
import {
|
|
10
|
+
import { gitHubConfig, readGitHubServers } from "../core/config.js";
|
|
11
|
+
import { GitHubClient } from "../core/github.js";
|
|
11
12
|
import { resolveCloneDir, resolveDataDir } from "../core/data-dir.js";
|
|
12
13
|
import { DeployServerStore } from "../core/deploy-servers.js";
|
|
13
14
|
import { Deployer, DeploymentStore } from "../core/deployments.js";
|
|
@@ -16,7 +17,7 @@ import { runDefaultBranchAudit } from "../core/operations.js";
|
|
|
16
17
|
import { OrganizerClient } from "../core/organizer.js";
|
|
17
18
|
import { refreshReportTask } from "../core/repair.js";
|
|
18
19
|
import { SYNC_INTERVAL_MS, staleRepos, syncRepository } from "../core/repos.js";
|
|
19
|
-
import { encryptStoredTokens, readSettings } from "../core/settings.js";
|
|
20
|
+
import { adoptEnvGitHubToken, deployToken, encryptStoredTokens, githubToken, readSettings } from "../core/settings.js";
|
|
20
21
|
import { readServerConfig } from "../core/server-config.js";
|
|
21
22
|
import { Store } from "../core/store.js";
|
|
22
23
|
import { parseVaultKey } from "../core/vault.js";
|
|
@@ -57,7 +58,15 @@ function listen(app, port, hostname) {
|
|
|
57
58
|
export async function serve() {
|
|
58
59
|
const root = packageRoot();
|
|
59
60
|
loadPackageEnv();
|
|
60
|
-
|
|
61
|
+
let dataDir;
|
|
62
|
+
try {
|
|
63
|
+
dataDir = resolveDataDir();
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
console.error(err.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
setupLogging({ processLabel: "mcp-dependabot-tracker", logDir: resolveLogDir(dataDir) });
|
|
61
70
|
const logger = createLogger("mcp-dependabot-tracker");
|
|
62
71
|
process.on("uncaughtException", (err) => {
|
|
63
72
|
logger.error(`Uncaught exception: ${err.stack ?? err.message}`);
|
|
@@ -67,13 +76,11 @@ export async function serve() {
|
|
|
67
76
|
logger.error(`Unhandled rejection: ${reason?.stack ?? reason}`);
|
|
68
77
|
process.exit(1);
|
|
69
78
|
});
|
|
70
|
-
let github;
|
|
71
79
|
let cloneDir;
|
|
72
80
|
let config;
|
|
73
81
|
let vaultKey;
|
|
74
82
|
try {
|
|
75
|
-
|
|
76
|
-
cloneDir = resolveCloneDir();
|
|
83
|
+
cloneDir = resolveCloneDir(dataDir);
|
|
77
84
|
config = readServerConfig();
|
|
78
85
|
vaultKey = parseVaultKey(process.env.VAULT_KEY);
|
|
79
86
|
}
|
|
@@ -81,7 +88,6 @@ export async function serve() {
|
|
|
81
88
|
logger.error(err.message);
|
|
82
89
|
process.exit(1);
|
|
83
90
|
}
|
|
84
|
-
const dataDir = resolveDataDir();
|
|
85
91
|
let auth;
|
|
86
92
|
try {
|
|
87
93
|
auth = createAuth(dataDir, config);
|
|
@@ -103,15 +109,27 @@ export async function serve() {
|
|
|
103
109
|
logger.error(err.message);
|
|
104
110
|
process.exit(1);
|
|
105
111
|
}
|
|
106
|
-
const
|
|
112
|
+
const githubServers = readGitHubServers();
|
|
113
|
+
/** Configuration GitHub avec le token du tracker, relu dans les réglages à chaque usage. */
|
|
114
|
+
const github = () => gitHubConfig(githubServers, githubToken(readSettings(dataDir, vaultKey)));
|
|
107
115
|
const claude = { command: packagedClaudeCommand(), home: path.join(dataDir, "claude") };
|
|
108
116
|
const settingsChecks = {
|
|
109
117
|
organizer: (connection) => new OrganizerClient(connection).space(),
|
|
110
118
|
claudeToken: (token) => checkClaudeToken(claude, token),
|
|
119
|
+
githubToken: (token) => new GitHubClient({ ...githubServers, token }, "the token").checkToken(),
|
|
111
120
|
};
|
|
121
|
+
const adoption = await adoptEnvGitHubToken(dataDir, vaultKey, process.env.GITHUB_TOKEN, settingsChecks);
|
|
122
|
+
if (adoption.status === "adopted") {
|
|
123
|
+
logger.info("GITHUB_TOKEN is now the GitHub token of the tracker in the settings, encrypted with VAULT_KEY: it can be removed from the environment.");
|
|
124
|
+
if (adoption.warning)
|
|
125
|
+
logger.warn(`GITHUB_TOKEN was taken over, but GitHub did not accept it: ${adoption.warning}`);
|
|
126
|
+
}
|
|
127
|
+
if (adoption.status === "ignored")
|
|
128
|
+
logger.warn("GITHUB_TOKEN is ignored: the GitHub token of the tracker is the one of the settings. Remove the variable from the environment.");
|
|
129
|
+
const deployer = new Deployer(store, deployServers, new DeploymentStore(dataDir), github, (message) => logger.error(message), () => deployToken(readSettings(dataDir, vaultKey)));
|
|
112
130
|
const operations = {
|
|
113
131
|
store,
|
|
114
|
-
githubConfig:
|
|
132
|
+
githubConfig: github,
|
|
115
133
|
cloneDir: () => cloneDir,
|
|
116
134
|
logError: (message) => logger.error(message),
|
|
117
135
|
settings: () => readSettings(dataDir, vaultKey),
|
|
@@ -122,6 +140,7 @@ export async function serve() {
|
|
|
122
140
|
store,
|
|
123
141
|
dataDir,
|
|
124
142
|
github,
|
|
143
|
+
githubServerUrl: githubServers.serverUrl,
|
|
125
144
|
operations,
|
|
126
145
|
auditAll,
|
|
127
146
|
deployer,
|
|
@@ -152,15 +171,25 @@ export async function serve() {
|
|
|
152
171
|
for (const user of users.filter((candidate) => !candidate.twoFactor)) {
|
|
153
172
|
logger.warn(`The account ${user.email} signs in with its password alone: enable two-factor authentication with "mcp-dependabot-tracker user totp ${user.email}".`);
|
|
154
173
|
}
|
|
174
|
+
if (githubToken(readSettings(dataDir, vaultKey)) === null) {
|
|
175
|
+
logger.warn("The GitHub token of the tracker is not set: enter it in the settings of the interface (Réglages › GitHub). Until then, nothing is synced, audited or fixed.");
|
|
176
|
+
}
|
|
155
177
|
let syncing = false;
|
|
156
178
|
/** 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. */
|
|
157
179
|
const syncStaleRepos = async () => {
|
|
158
180
|
if (syncing)
|
|
159
181
|
return;
|
|
182
|
+
let config;
|
|
183
|
+
try {
|
|
184
|
+
config = github();
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
160
189
|
syncing = true;
|
|
161
190
|
try {
|
|
162
191
|
for (const repo of staleRepos(store, SYNC_INTERVAL_MS)) {
|
|
163
|
-
const synced = await syncRepository(store,
|
|
192
|
+
const synced = await syncRepository(store, config, repo.id);
|
|
164
193
|
if (synced.syncError)
|
|
165
194
|
logger.warn(`Dependabot alerts of ${repo.id} not synced: ${synced.syncError}`);
|
|
166
195
|
await refreshReportTask(store, readSettings(dataDir, vaultKey), repo.id).catch((err) => logger.warn(`Organizer task of ${repo.id} not refreshed: ${err?.message ?? err}`));
|
|
@@ -68,4 +68,4 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
68
68
|
`).map(e=>e.length),1);(0,_.useEffect)(()=>c.current?.focus(),[]);function d(){let e=c.current;e&&s(e.value.slice(0,e.selectionStart).split(`
|
|
69
69
|
`).length)}function f(e){let t=c.current;if(!t)return;let{selectionStart:n,selectionEnd:r}=t,o=i.slice(0,n)+e+i.slice(r);a(o),requestAnimationFrame(()=>{t.focus(),t.selectionStart=t.selectionEnd=n+e.length,d()})}function p(e){e.key===`Tab`&&!e.shiftKey?(e.preventDefault(),f(_d)):e.key===`s`&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),t||n(i)):e.key===`Escape`&&(e.preventDefault(),r())}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsx)(`p`,{className:`section-label section-label-strong`,children:`Script de déploiement`}),(0,B.jsxs)(`span`,{className:`hint-inline`,children:[`bash · `,l,` `,l>1?`lignes`:`ligne`]})]}),(0,B.jsxs)(`div`,{className:`code-box is-active is-editing`,children:[(0,B.jsx)(vd,{lines:l,active:o}),(0,B.jsx)(`div`,{className:`code-scroll`,children:(0,B.jsxs)(`div`,{className:`code-layer`,style:{width:`calc(${u+2}ch + 32px)`,height:l*gd+32},children:[(0,B.jsx)(`div`,{className:`code-band is-cursor`,style:{top:(o-1)*gd}}),(0,B.jsx)(`pre`,{className:`code-text`,"aria-hidden":`true`,children:(0,B.jsx)(hd,{script:i.endsWith(`
|
|
70
70
|
`)?`${i} `:i})}),(0,B.jsx)(`textarea`,{ref:c,className:`code-input`,value:i,wrap:`off`,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,"aria-label":`Script de déploiement`,onChange:e=>{a(e.target.value),d()},onKeyDown:p,onKeyUp:d,onClick:d,onSelect:d})]})})]}),(0,B.jsxs)(`div`,{className:`editor-foot`,children:[(0,B.jsxs)(`div`,{className:`editor-vars`,children:[(0,B.jsx)(`span`,{className:`hint-inline`,children:`Variables`}),rd.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`var-chip mono`,title:e.description,onClick:()=>f(`$${e.name}`),children:[`$`,e.name]},e.name))]}),(0,B.jsxs)(`div`,{className:`editor-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary`,onClick:r,disabled:t,children:`Annuler`}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary editor-save`,onClick:()=>n(i),disabled:t,children:[(0,B.jsx)(V,{name:`check`}),`Enregistrer`]})]})]}),(0,B.jsx)(`p`,{className:`hint`,children:`Le script s'exécute avec bash sur le serveur, depuis le dossier personnel de l'utilisateur, l'entrée venant de /dev/null. Tab indente, Ctrl+S enregistre, Échap annule.`})]})}var xd=`.ssh/authorized_keys.d/dependabot-tracker`,Sd=[{step:`form`,label:`Serveur`},{step:`key`,label:`Installation`},{step:`test`,label:`Test`}];function Cd({step:e}){let t=Sd.findIndex(t=>t.step===e);return(0,B.jsx)(`div`,{className:`stepper`,children:Sd.map((e,n)=>(0,B.jsxs)(`span`,{className:`stepper-item`,children:[n>0&&(0,B.jsx)(`span`,{className:`stepper-line`}),(0,B.jsxs)(`span`,{className:`stepper-step${n<t?` is-done`:n===t?` is-active`:``}`,children:[(0,B.jsx)(`span`,{className:`stepper-dot`,children:n<t?(0,B.jsx)(V,{name:`check`,size:12}):n+1}),e.label]})]},e.step))})}function wd({ok:e,title:t,detail:n}){return(0,B.jsxs)(`div`,{className:`check-row`,children:[(0,B.jsx)(V,{name:e?`circle-check`:`triangle-alert`,size:20,className:e?`text-ok`:`text-warning`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`check-title`,children:t}),(0,B.jsx)(`div`,{className:`check-detail`,children:n})]})]})}function Td({fingerprint:e,cwd:t,keyFile:n}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`check-list`,children:[(0,B.jsx)(wd,{ok:!0,title:`Connexion établie`,detail:`empreinte du serveur ${e} enregistrée · shell ouvert dans ${t}`}),n.inDedicatedFile&&(n.allowedFrom&&!n.restrictError?(0,B.jsx)(wd,{ok:!0,title:`Clé limitée à l'adresse du tracker`,detail:`from="${n.allowedFrom}" sur sa ligne : l'adresse vue par le serveur pendant le test`}):(0,B.jsx)(wd,{ok:!1,title:`Clé non limitée à une adresse`,detail:n.restrictError??`Aucune limite d'adresse sur sa ligne.`})),n.inDedicatedFile?(0,B.jsx)(wd,{ok:!0,title:`Fichier dédié en place`,detail:`~/${xd} · ton authorized_keys n'a pas été touché`}):(0,B.jsx)(wd,{ok:!1,title:`Clé hors du fichier dédié`,detail:`Elle n'est pas dans ~/${xd} : la limite d'adresse n'est pas posée. Colle la commande d'installation pour l'activer.`}),n.inAuthorizedKeys&&(0,B.jsx)(wd,{ok:!1,title:`Clé aussi présente dans ~/.ssh/authorized_keys`,detail:`Le tracker ne modifie jamais ce fichier : retires-en cette ligne toi-même, sinon la clé reste valable depuis n'importe quelle adresse.`})]}),n.allowedFrom&&(0,B.jsxs)(`div`,{className:`muted-line`,children:[(0,B.jsx)(V,{name:`info`}),(0,B.jsxs)(`span`,{children:[`Si l'adresse du tracker change, seul son accès est refusé :`,(0,B.jsx)(`br`,{}),`recolle alors la commande d'installation.`]})]})]})}function Ed({icon:e,children:t}){return(0,B.jsxs)(`div`,{className:`does-row`,children:[(0,B.jsx)(V,{name:e}),t]})}async function Dd(e,t){try{await navigator.clipboard.writeText(e),ae.getState().show(`info`,t)}catch(e){T(e)}}function Od({value:e,compact:t=!1}){return t?(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,onClick:()=>void Dd(e,`Clé copiée.`),title:`Copier`,"aria-label":`Copier`,children:(0,B.jsx)(V,{name:`copy`})}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-copy`,onClick:()=>void Dd(e,`Commande copiée.`),children:[(0,B.jsx)(V,{name:`copy`,size:14}),`Copier`]})}function kd({repoId:e,server:t,step:n,onClose:r,onChanged:i,onWriteScript:a}){let[o,s]=(0,_.useState)(t),[c,l]=(0,_.useState)(t?n:`form`),[u,d]=(0,_.useState)(t?{name:t.server.name,host:t.server.host,port:t.server.port,username:t.server.username}:{name:``,host:``,port:22,username:``}),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!f&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[f,r]);async function x(t){t?.preventDefault(),p(!0),h(null);try{let t;o?t=await D.updateDeployServer(o.server.id,u):(t=await D.createDeployServer(u),await D.setRepoDeployServer(e,t.server.id)),s(t),i(),l(`key`)}catch(e){h(e.message)}finally{p(!1)}}async function S(){if(o){p(!0),h(null),b(null),l(`test`);try{let e=await D.testDeployServer(o.server.id);s(e.server),i(),b({fingerprint:e.fingerprint,cwd:e.cwd,keyFile:e.keyFile})}catch(e){h(e.message)}finally{p(!1)}}}let ee=(e,t,n,r=``)=>(0,B.jsxs)(`label`,{className:`wizard-field ${r}`,children:[(0,B.jsx)(`span`,{className:`field-label`,children:t}),(0,B.jsx)(`input`,{className:`input`,value:u[e],placeholder:n,autoFocus:e===`name`,inputMode:e===`port`?`numeric`:void 0,spellCheck:!1,onChange:t=>d({...u,[e]:e===`port`?t.target.value.replace(/\D/g,``):t.target.value})})]}),te,C;return c===`form`?(te=(0,B.jsxs)(`form`,{className:`wizard-form`,onSubmit:e=>void x(e),children:[ee(`name`,`Nom`,`prod-web`,`is-wide`),ee(`host`,`Hôte`,`10.0.0.12`),ee(`port`,`Port`,`22`,`is-port`),ee(`username`,`Utilisateur`,`deploy`,`is-wide`),(0,B.jsx)(`button`,{type:`submit`,hidden:!0})]}),C=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-large`,onClick:o?()=>l(`key`):r,children:o?`Retour`:`Annuler`}),(0,B.jsx)(`button`,{type:`button`,className:`button button-primary button-large`,onClick:()=>void x(),disabled:f,children:o?`Enregistrer`:`Générer la clé`})]})):c===`key`&&o?(te=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`wizard-summary`,children:[(0,B.jsx)(V,{name:`server`,size:20}),(0,B.jsxs)(`span`,{children:[o.server.name,` · `,o.server.username,`@`,o.server.host,`:`,o.server.port]}),(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,title:`Modifier`,"aria-label":`Modifier le serveur`,onClick:()=>l(`form`),children:(0,B.jsx)(V,{name:`pencil`,size:18})})]}),(0,B.jsxs)(`div`,{className:`wizard-section`,children:[(0,B.jsxs)(`div`,{className:`wizard-section-title`,children:[`Commande d'installation`,(0,B.jsx)(Od,{value:o.installCommand??``})]}),(0,B.jsx)(`div`,{className:`keybox mono`,children:o.installCommand}),(0,B.jsxs)(`div`,{className:`key-caption`,children:[(0,B.jsxs)(`span`,{children:[`Une seule ligne, à coller dans une session ouverte sur le serveur en tant que `,o.server.username,`.`]}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>v(!g),children:g?`Masquer la clé`:`Clé publique seule`})]}),g&&(0,B.jsxs)(`div`,{className:`oneliner mono`,children:[(0,B.jsx)(`span`,{children:o.server.publicKey}),(0,B.jsx)(Od,{value:o.server.publicKey??``,compact:!0})]})]}),(0,B.jsxs)(`div`,{className:`wizard-section`,children:[(0,B.jsx)(`div`,{className:`wizard-section-title`,children:`Ce qu'elle fait`}),(0,B.jsx)(Ed,{icon:`file-key`,children:`Écrit la clé dans authorized_keys.d/dependabot-tracker, limitée par restrict`}),(0,B.jsx)(Ed,{icon:`settings`,children:`Fait lire ce fichier à sshd, en plus de ~/.ssh/authorized_keys (sudo)`}),(0,B.jsx)(Ed,{icon:`shield-check`,children:`Vérifie la configuration avant de recharger sshd, et s'arrête si elle est invalide`})]}),(0,B.jsxs)(`div`,{className:`callout-warn`,children:[(0,B.jsx)(V,{name:`triangle-alert`,size:18}),(0,B.jsxs)(`div`,{children:[`Ton fichier ~/.ssh/authorized_keys n'est pas modifié.`,(0,B.jsx)(`br`,{}),`Garde quand même ta session ouverte jusqu'au test réussi.`]})]}),(0,B.jsxs)(`div`,{className:`muted-line`,children:[(0,B.jsx)(V,{name:`lock`}),`La clé privée reste chiffrée dans le tracker. Elle n'est jamais affichée.`]})]}),C=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-large`,onClick:r,children:`Plus tard`}),(0,B.jsx)(`button`,{type:`button`,className:`button button-primary button-large`,onClick:()=>void S(),disabled:f,children:`Tester la connexion`})]})):(te=f?(0,B.jsxs)(`div`,{className:`muted-line`,children:[(0,B.jsx)(V,{name:`loader-circle`,className:`spin`}),`Connexion à `,o?.server.host,`…`]}):y?(0,B.jsx)(Td,{...y}):(0,B.jsxs)(`div`,{className:`result-ko`,children:[(0,B.jsx)(V,{name:`circle-x`,size:20}),(0,B.jsx)(`div`,{children:m})]}),C=y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-large`,onClick:r,children:`Terminer`}),(0,B.jsx)(`button`,{type:`button`,className:`button button-primary button-large`,onClick:a,children:`Écrire le script`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-large`,onClick:()=>l(`key`),disabled:f,children:`Retour à l'installation`}),(0,B.jsx)(`button`,{type:`button`,className:`button button-primary button-large`,onClick:()=>void S(),disabled:f,children:`Réessayer`})]})),(0,B.jsx)(`div`,{className:`veil`,onMouseDown:e=>e.target===e.currentTarget&&!f&&r(),children:(0,B.jsxs)(`div`,{className:`modal modal-wizard`,role:`dialog`,"aria-label":t?`Serveur ${t.server.name}`:`Connecter un serveur`,children:[(0,B.jsxs)(`div`,{className:`wizard-head`,children:[(0,B.jsx)(`h2`,{className:`wizard-title`,children:t?t.server.name:`Connecter un serveur`}),(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,onClick:r,title:`Fermer`,"aria-label":`Fermer`,children:(0,B.jsx)(V,{name:`x`,size:20})})]}),(0,B.jsx)(Cd,{step:c}),(0,B.jsxs)(`div`,{className:`wizard-body`,children:[te,m&&c===`form`&&(0,B.jsxs)(`div`,{className:`result-ko`,children:[(0,B.jsx)(V,{name:`circle-x`,size:20}),(0,B.jsx)(`div`,{children:m})]})]}),(0,B.jsx)(`div`,{className:`wizard-foot`,children:C})]})})}var Ad=3e3,jd=1e3;function Md(e,t,n=Date.now()){let r=Math.max(0,Math.round(((t?Date.parse(t):n)-Date.parse(e))/1e3));return`${Math.floor(r/60)}:${String(r%60).padStart(2,`0`)}`}function Nd(e){return e?e.slice(0,7):`—`}function Pd(e,t){let n=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!e)return;let r=e=>{n.current?.contains(e.target)||t()},i=e=>{e.key===`Escape`&&t()};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e,t]),n}function Fd({currentId:e,onChoose:t,onNew:n}){let r=b(`deploy-servers`,D.listDeployServers,null);return(0,B.jsxs)(B.Fragment,{children:[r.error&&(0,B.jsx)(`p`,{className:`picker-note error-text`,children:r.error}),r.data&&r.data.servers.length>0&&(0,B.jsx)(`ul`,{className:`picker-options`,role:`listbox`,"aria-label":`Serveurs`,children:r.data.servers.map(({server:n})=>(0,B.jsxs)(`li`,{role:`option`,"aria-selected":n.id===e,className:`picker-option server-option`,onMouseDown:e=>{e.preventDefault(),t(n.id)},children:[(0,B.jsx)(V,{name:`server`,size:14}),(0,B.jsxs)(`span`,{className:`picker-name`,children:[n.name,(0,B.jsxs)(`span`,{className:`server-option-detail`,children:[n.username,`@`,n.host,`:`,n.port]})]}),n.id===e&&(0,B.jsx)(V,{name:`check`,size:14,className:`picker-check`})]},n.id))}),(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onMouseDown:e=>{e.preventDefault(),n()},children:[(0,B.jsx)(V,{name:`plus`,size:14}),`Nouveau serveur`]})]})}function Id({repoId:e,onChanged:t,onNew:n}){let r=b(`deploy-servers`,D.listDeployServers,null),[i,a]=(0,_.useState)(!1),o=Pd(i,()=>a(!1)),s=r.data?.servers.length??0;async function c(n){a(!1);try{await D.setRepoDeployServer(e,n),t()}catch(e){T(e)}}return(0,B.jsxs)(`div`,{className:`picker`,ref:o,children:[(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,onClick:()=>s>0?a(!i):n(),children:[(0,B.jsx)(V,{name:`plug`}),`Connecter un serveur`,s>0&&(0,B.jsx)(V,{name:`chevron-down`,size:14})]}),i&&(0,B.jsx)(`div`,{className:`picker-menu picker-menu-center`,children:(0,B.jsx)(Fd,{currentId:null,onChoose:e=>void c(e),onNew:()=>{a(!1),n()}})})]})}function Ld({repoId:e,onChanged:t,onNew:n}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`panel empty deploy-empty`,children:[(0,B.jsx)(`span`,{className:`deploy-empty-icon`,children:(0,B.jsx)(V,{name:`rocket`,size:24})}),(0,B.jsxs)(`div`,{className:`deploy-empty-text`,children:[(0,B.jsx)(`p`,{className:`deploy-empty-title`,children:`Aucun serveur de déploiement`}),(0,B.jsx)(`p`,{children:`Connectez le serveur en SSH, puis écrivez le script shell qui installe ce dépôt.`})]}),(0,B.jsx)(Id,{repoId:e,onChanged:t,onNew:n})]}),(0,B.jsxs)(`p`,{className:`hint`,children:[`Le serveur se connecte exactement comme dans SSH Gate : clé générée par le tracker, commande d'installation à coller, test.`,(0,B.jsx)(`br`,{}),`Un serveur déjà connecté pour un autre dépôt se choisit dans le menu du bouton, sans refaire l'installation.`]})]})}function Rd({repo:e,view:t,deploy:n,starting:r,onDeploy:i,onCancel:a,onWizard:o,onKey:s,onNewServer:c,onChanged:l}){let{server:u}=t,[d,f]=(0,_.useState)(`closed`),p=Pd(d!==`closed`,()=>f(`closed`)),m=n.activeDeployment,h=n.deployments.find(e=>e.status!==`running`)??null,g=u.publicKey!==null,v=g?u.testedAt===null?`Testez la connexion avant de déployer.`:n.script.trim()?e.deprecatedAt?`Dépôt déprécié.`:null:`Écrivez le script avant de déployer.`:`Clé révoquée : installez une nouvelle clé.`;async function y(t){f(`closed`);try{await D.setRepoDeployServer(e.id,t),l()}catch(e){T(e)}}async function b(){f(`closed`);try{let e=await D.installDeployKey(u.id);l(),o(`key`,e)}catch(e){T(e)}}let x=g?h?`dernier déploiement ${ol(h.createdAt)}`:u.testedAt?`testé ${ol(u.testedAt)}`:`connexion à tester`:`clé révoquée`;return(0,B.jsxs)(`div`,{className:`panel deploy-server`,children:[(0,B.jsx)(V,{name:`server`,size:20,className:`deploy-server-icon`}),(0,B.jsxs)(`div`,{className:`deploy-server-text`,children:[(0,B.jsx)(`div`,{className:`deploy-server-name`,children:u.name}),(0,B.jsx)(`div`,{className:`deploy-server-detail`,children:m?`${u.username}@${u.host}:${u.port} · ${m.branch} · ${Nd(m.commit)}`:`${u.username}@${u.host}:${u.port} · ${x}`})]}),m?(0,B.jsxs)(`span`,{className:`status-chip is-running`,children:[(0,B.jsx)(`span`,{className:`status-dot`}),`En cours`]}):g?u.testedAt?(0,B.jsxs)(`span`,{className:`status-chip is-ok`,children:[(0,B.jsx)(`span`,{className:`status-dot`}),`Connecté`]}):(0,B.jsxs)(`button`,{type:`button`,className:`status-chip is-idle`,onClick:()=>o(`key`),children:[(0,B.jsx)(`span`,{className:`status-dot`}),`À tester`]}):(0,B.jsxs)(`button`,{type:`button`,className:`status-chip is-idle`,onClick:()=>void b(),children:[(0,B.jsx)(`span`,{className:`status-dot`}),`Sans clé`]}),m?(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-stop`,onClick:()=>a(m),disabled:m.cancelRequested,children:[(0,B.jsx)(V,{name:`square`,size:14}),m.cancelRequested?`Interruption…`:`Interrompre`]}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-queued`,onClick:i,disabled:r||v!==null,title:v??void 0,children:[(0,B.jsx)(V,{name:`rocket`}),`Déployer`]}),(0,B.jsxs)(`div`,{className:`picker`,ref:p,children:[(0,B.jsx)(`button`,{type:`button`,className:`icon-button deploy-server-more`,"aria-label":`Menu du serveur`,title:`Menu du serveur`,onClick:()=>f(d===`closed`?`actions`:`closed`),children:(0,B.jsx)(V,{name:`ellipsis`,size:20})}),d===`actions`&&(0,B.jsxs)(`div`,{className:`picker-menu picker-menu-right`,children:[g?(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onClick:()=>(f(`closed`),o(`key`)),children:[(0,B.jsx)(V,{name:`file-key`,size:14}),`Commande d'installation et test`]}):(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onClick:()=>void b(),children:[(0,B.jsx)(V,{name:`key-round`,size:14}),`Installer une clé`]}),(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onClick:()=>(f(`closed`),o(`form`)),children:[(0,B.jsx)(V,{name:`pencil`,size:14}),`Modifier le serveur`]}),g&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onClick:()=>(f(`closed`),s(`rotate`)),disabled:m!==null||u.hostKeyFingerprint===null,title:u.hostKeyFingerprint===null?`Testez la connexion avant de renouveler la clé.`:void 0,children:[(0,B.jsx)(V,{name:`refresh-cw`,size:14}),`Renouveler la clé`]}),(0,B.jsxs)(`button`,{type:`button`,className:`menu-item menu-item-danger`,onClick:()=>(f(`closed`),s(`revoke`)),disabled:m!==null,children:[(0,B.jsx)(V,{name:`key-round`,size:14}),`Révoquer la clé`]})]}),(0,B.jsx)(`span`,{className:`menu-divider`}),(0,B.jsxs)(`button`,{type:`button`,className:`menu-item`,onClick:()=>f(`servers`),disabled:m!==null,children:[(0,B.jsx)(V,{name:`server`,size:14}),`Changer de serveur`]}),(0,B.jsxs)(`button`,{type:`button`,className:`menu-item menu-item-danger`,onClick:()=>void y(null),disabled:m!==null,children:[(0,B.jsx)(V,{name:`x`,size:14}),`Ne plus déployer ce dépôt`]})]}),d===`servers`&&(0,B.jsx)(`div`,{className:`picker-menu picker-menu-right`,children:(0,B.jsx)(Fd,{currentId:u.id,onChoose:e=>void y(e),onNew:()=>{f(`closed`),c()}})})]})]})}var zd={running:{icon:`circle-dot`,className:`text-accent`,text:`en cours`},done:{icon:`circle-check`,className:`text-ok`,text:`réussi`},failed:{icon:`circle-x`,className:`error-text`,text:`échoué`},cancelled:{icon:`circle-minus`,className:`muted`,text:`interrompu`}};function Bd(e){return e.status===`failed`&&e.exitCode!==null?`échoué${e.currentLine===null?``:` à la ligne ${e.currentLine}`} · code ${e.exitCode}`:zd[e.status].text}function Vd({repoId:e,deployments:t}){return t.length===0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`section-label section-label-strong section-label-spaced`,children:`Derniers déploiements`}),(0,B.jsx)(`div`,{className:`panel list`,children:t.map(t=>{let n=zd[t.status];return(0,B.jsxs)(`a`,{className:`row row-linked deployment-row`,href:W.deployment(e,t.id),children:[(0,B.jsx)(V,{name:n.icon,className:`history-icon ${n.className}`}),(0,B.jsxs)(`div`,{className:`history-title`,children:[(0,B.jsx)(`span`,{className:`row-title`,children:`Déploiement`}),(0,B.jsxs)(`span`,{className:`history-meta`,children:[t.branch,` · `,Nd(t.commit)]})]}),(0,B.jsx)(`span`,{className:`history-date`,children:ml(t.createdAt)}),(0,B.jsx)(`span`,{className:`deployment-duration`,children:Md(t.createdAt,t.endedAt)}),(0,B.jsx)(`span`,{className:`deployment-outcome ${t.status===`failed`?`error-text`:``}`,children:Bd(t)}),(0,B.jsx)(V,{name:`chevron-right`,className:`row-chevron`})]},t.id)})}),(0,B.jsx)(`p`,{className:`hint`,children:`Les 20 derniers déploiements du dépôt sont conservés.`})]})}function Hd(e){return e.currentLine===null?null:e.status===`running`?{line:e.currentLine,state:`running`,label:`en cours`}:e.status===`failed`?{line:e.currentLine,state:`failed`,label:e.exitCode===null?`échec`:`code ${e.exitCode}`}:e.status===`cancelled`?{line:e.currentLine,state:`failed`,label:`interrompu`}:null}function Ud({deployment:e,onBack:t}){let n=(0,_.useRef)(null),r=e.status===`running`,[,i]=(0,_.useState)(0);(0,_.useEffect)(()=>{if(!r)return;let e=setInterval(()=>i(e=>e+1),1e3);return()=>clearInterval(e)},[r]),(0,_.useEffect)(()=>{let e=n.current;e&&r&&(e.scrollTop=e.scrollHeight)},[e.output,r]);let a=K(e.script),o=zd[e.status],s=r?e.currentLine===null?`Exécution — connexion…`:`Exécution — ligne ${e.currentLine} sur ${a}`:e.status===`done`?`Déploiement réussi`:e.status===`cancelled`?`Déploiement interrompu`:`Déploiement échoué`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsxs)(`p`,{className:`section-label section-label-strong deployment-title`,children:[t&&(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,onClick:t,"aria-label":`Retour au déploiement`,title:`Retour au déploiement`,children:(0,B.jsx)(V,{name:`arrow-left`})}),(0,B.jsx)(V,{name:r?`loader-circle`:o.icon,className:r?`spin text-accent`:o.className}),s]}),(0,B.jsxs)(`span`,{className:`hint-inline`,children:[r?`lancé à ${gl(e.createdAt)}`:ml(e.createdAt),` · `,Md(e.createdAt,e.endedAt)]})]}),(0,B.jsx)(yd,{script:e.script,mark:Hd(e),dimAfter:r,active:r}),e.error&&(0,B.jsx)(`p`,{className:`banner banner-error deployment-error`,children:e.error}),(0,B.jsx)(`p`,{className:`section-label section-label-strong section-label-spaced`,children:`Sortie`}),(0,B.jsxs)(`pre`,{ref:n,className:`terminal mono`,children:[e.outputTruncated&&(0,B.jsxs)(`span`,{className:`muted`,children:[`[début de la sortie coupé]`,`
|
|
71
|
-
`]}),e.output,r&&(0,B.jsx)(`span`,{className:`terminal-cursor`}),!r&&!e.output&&(0,B.jsx)(`span`,{className:`muted`,children:`Aucune sortie.`})]}),(0,B.jsxs)(`p`,{className:`hint-line`,children:[(0,B.jsx)(V,{name:`info`}),e.server,` · `,e.branch,` · `,Nd(e.commit),r?` · un déploiement réussi retire le dépôt de « À déployer ».`:``]})]})}function Wd({id:e,onFinished:t}){let n=b(`deployment:${e}`,()=>D.getDeployment(e),jd),r=n.data?.deployment,i=r!==void 0&&r.status!==`running`;return(0,_.useEffect)(()=>{i&&t()},[i,t]),r?(0,B.jsx)(Ud,{deployment:r,onBack:null}):(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`})}function Gd({repoId:e,deploymentId:t}){let n=b(`deployment:${t}`,()=>D.getDeployment(t),jd),r=n.data?.deployment;return r?(0,B.jsx)(Ud,{deployment:r,onBack:()=>jl(W.repoDeploy(e))}):(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`})}function Kd({repo:e,deploymentId:t}){let n=b(`deploy:${e.id}`,()=>D.getRepoDeploy(e.id),Ad),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),d=n.data,f=d?.activeDeployment??null;if(!d)return(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`});async function p(t){u(!0);try{await D.saveRepoDeployScript(e.id,t),c(!1),n.reload()}catch(e){T(e)}finally{u(!1)}}async function m(){u(!0);try{await D.startDeployment(e.id),t&&jl(W.repoDeploy(e.id)),n.reload()}catch(e){T(e)}finally{u(!1)}}async function h(e){try{await D.cancelDeployment(e.id),n.reload()}catch(e){T(e)}}let g=r&&(0,B.jsx)(kd,{repoId:e.id,server:r.server,step:r.step,onClose:()=>i(null),onChanged:n.reload,onWriteScript:()=>{i(null),c(!0)}}),v=t===null&&f?f:null,y=d.server?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Rd,{repo:e,view:d.server,deploy:d,starting:l,onDeploy:()=>void m(),onCancel:e=>void h(e),onWizard:(e,t)=>i({server:t??d.server,step:e}),onKey:o,onNewServer:()=>i({server:null,step:`form`}),onChanged:n.reload}),(0,B.jsx)(`div`,{className:`deploy-body`,children:t===null?v?(0,B.jsx)(Wd,{id:v.id,onFinished:n.reload}):s?(0,B.jsx)(bd,{initial:d.script,busy:l,onSave:e=>void p(e),onCancel:()=>c(!1)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsx)(`p`,{className:`section-label section-label-strong`,children:`Script de déploiement`}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-small`,onClick:()=>c(!0),children:[(0,B.jsx)(V,{name:`pencil`,size:14}),d.script.trim()?`Modifier`:`Écrire le script`]})]}),d.script.trim()?(0,B.jsx)(yd,{script:d.script}):(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:`Aucun script : il s'écrit en bash et s'exécute sur le serveur à chaque déploiement.`})}),(0,B.jsx)(Vd,{repoId:e.id,deployments:d.deployments})]}):(0,B.jsx)(Gd,{repoId:e.id,deploymentId:t})})]}):(0,B.jsx)(Ld,{repoId:e.id,onChanged:n.reload,onNew:()=>i({server:null,step:`form`})}),x=a&&d.server?a===`rotate`?(0,B.jsx)(td,{view:d.server,onClose:()=>o(null),onChanged:n.reload}):(0,B.jsx)(nd,{view:d.server,onClose:()=>o(null),onChanged:n.reload}):null;return(0,B.jsxs)(B.Fragment,{children:[y,g,x]})}var qd={running:`en cours`,done:`terminée`,failed:`échouée`,cancelled:`annulée`};function Jd(e){return qc.includes(e.status)?{icon:`circle-dot`,className:`text-accent`}:e.status===`done`?{icon:`circle-check`,className:`text-ok`}:e.status===`failed`?{icon:`circle-x`,className:`error-text`}:{icon:`circle-minus`,className:`muted`}}function Yd(e){if(e.status===`failed`&&e.error)return(0,B.jsx)(`span`,{className:`error-text`,children:e.error.split(/\r?\n/)[0]});let{before:t,after:n}=e;return t===null?null:e.kind===`audit`||n===null?sl(t,`vulnérabilité`):`${t} → ${sl(n,`vulnérabilité`)}`}function Xd(e){return e.claude?`Claude`:null}function Zd(e){return e.pullRequest?(0,B.jsxs)(`a`,{className:`pr-note`,href:e.pullRequest.url,target:`_blank`,rel:`noreferrer`,children:[`PR #`,e.pullRequest.number]}):(0,B.jsx)(`span`,{className:e.status===`failed`?`error-text`:void 0,children:qd[e.status]})}function Qd({repoId:e,operations:t}){return t.length===0?(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:`Aucune opération sur ce dépôt.`})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`panel list`,children:t.map(t=>{let n=Jd(t),r=Xd(t);return(0,B.jsxs)(`div`,{className:`row row-linked history-row`,children:[(0,B.jsx)(V,{name:n.icon,className:`history-icon ${n.className}`}),(0,B.jsxs)(`div`,{className:`history-title`,children:[(0,B.jsx)(`a`,{className:`row-link`,href:W.operation(e,t.id),children:t.kind===`audit`?`Audit`:`Correction`}),(0,B.jsxs)(`span`,{className:`history-meta`,children:[t.origin===`agent`?`l'agent`:`vous`,` · `,t.scope===`production`?`production`:ll.all,` · `,t.baseBranch]})]}),(0,B.jsx)(`span`,{className:`history-date`,children:ml(t.createdAt)}),(0,B.jsx)(`span`,{className:`history-counts`,children:Yd(t)}),(0,B.jsx)(`span`,{className:`history-claude`,children:r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`sparkles`,size:14}),r]})}),(0,B.jsx)(`span`,{className:`history-outcome`,children:Zd(t)}),(0,B.jsx)(V,{name:`chevron-right`,className:`row-chevron`})]},t.id)})}),(0,B.jsxs)(`p`,{className:`hint history-note`,children:[`Les `,20,` dernières opérations du dépôt sont conservées.`]})]})}var $d=3e3,ef=4e3;function tf({repoId:e}){let[t,n]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),ef);return()=>clearTimeout(e)},[t]);async function r(){if(!t)n(!0);else try{await D.removeRepo(e),jl(W.lastHome())}catch(e){n(!1),T(e)}}return t?(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-danger`,onClick:()=>void r(),children:[(0,B.jsx)(V,{name:`trash-2`}),`Confirmer le retrait`]}):(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-icon`,onClick:()=>void r(),"aria-label":`Retirer le dépôt`,title:`Retirer le dépôt`,children:(0,B.jsx)(V,{name:`trash-2`})})}function nf({view:e,onChanged:t}){let{repo:n,unfixable:r}=e,i=nl(n);async function a(e){try{await D.markAlertHandled(n.id,e),t()}catch(e){T(e)}}return i.length===0?(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:n.alerts.length===0?`Aucune alerte ouverte.`:`Toutes les alertes sont corrigées à la main.`})}):(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(`div`,{className:`panel list`,children:i.map(e=>(0,B.jsxs)(`div`,{className:`alert-line`,children:[(0,B.jsxs)(`a`,{className:`row alert-row`,href:e.url,target:`_blank`,rel:`noreferrer`,title:`Alerte #${e.number} sur GitHub`,children:[(0,B.jsx)(Ll,{severity:e.severity,wide:!0,children:cl[e.severity]}),(0,B.jsx)(`span`,{className:`alert-package mono`,children:e.package}),(0,B.jsx)(`span`,{className:`alert-summary`,children:e.summary}),r.includes(e.package)&&(0,B.jsxs)(`span`,{className:`unfixable-note`,title:`Le dernier audit n'a trouvé aucune version corrigée publiée sur le registre npm.`,children:[(0,B.jsx)(V,{name:`triangle-alert`}),`sans correctif`]}),e.scope===`development`&&(0,B.jsx)(`span`,{className:`dev-tag`,title:`Dépendance de développement : un audit de production la laisse de côté.`,children:`dév.`}),(0,B.jsx)(`span`,{className:`alert-mark-space`}),(0,B.jsx)(V,{name:`external-link`,className:`row-chevron`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary alert-mark`,onClick:()=>void a(e.number),children:[(0,B.jsx)(V,{name:`check`,size:14}),`Corrigée à la main`]})]},e.number))})})}function rf({view:e,onChanged:t}){let{repo:n}=e,r=rl(n);if(r.length===0)return null;async function i(e){try{await D.unmarkAlertHandled(n.id,e),t()}catch(e){T(e)}}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`section-label section-label-spaced`,children:`Corrigées à la main`}),(0,B.jsx)(`div`,{className:`panel list`,children:r.map(e=>{let t=n.handledAlerts.find(t=>t.number===e.number);return(0,B.jsxs)(`div`,{className:`row alert-row`,children:[(0,B.jsx)(Ll,{severity:e.severity,wide:!0,faded:!0,children:cl[e.severity]}),(0,B.jsx)(`span`,{className:`alert-package mono`,children:e.package}),(0,B.jsxs)(`span`,{className:`alert-summary handled-note`,children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),`Corrigée à la main`,t&&` le ${ml(t.markedAt)}`]}),(0,B.jsx)(`button`,{type:`button`,className:`link restore-link`,onClick:()=>void i(e.number),children:`Rétablir`})]},e.number)})})]})}function af({view:e,onChanged:t}){let[n,r]=(0,_.useState)(!1),i=e.repo.id,a=e.repo.queuedAt!==null;async function o(){r(!0);try{if(a){await D.unqueueRepo(i),jl(W.queue());return}await D.queueRepo(i),t()}catch(e){T(e)}finally{r(!1)}}return a?(0,B.jsxs)(`button`,{type:`button`,className:`button button-queued`,onClick:()=>void o(),disabled:n,title:`Retirer de la file d'attente`,children:[(0,B.jsx)(V,{name:`list-check`}),`Traité`]}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void o(),disabled:n,children:[(0,B.jsx)(V,{name:`list-plus`}),`Ajouter à la file`]})}function of({view:e,onChanged:t}){let[n,r]=(0,_.useState)(!1),i=e.repo.id,a=e.repo.deployPendingAt!==null;async function o(){r(!0);try{await(a?D.unmarkDeployPending(i):D.markDeployPending(i)),t()}catch(e){T(e)}finally{r(!1)}}return a?(0,B.jsxs)(`button`,{type:`button`,className:`button button-queued`,onClick:()=>void o(),disabled:n,title:`Retirer de « À déployer »`,children:[(0,B.jsx)(V,{name:`rocket`}),`Déployé`]}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void o(),disabled:n,children:[(0,B.jsx)(V,{name:`rocket`}),`À déployer`]})}function sf({repoId:e,tab:t,deploymentId:n}){let r=b(`repo:${e}`,()=>D.getRepo(e),$d),i=b(`history:${e}`,()=>D.listOperations(e),$d),a=b(`config`,D.getConfig,null),[o,s]=(0,_.useState)(!1),c=r.data;if(!c)return(0,B.jsx)(`div`,{className:`page`,children:(0,B.jsx)(`p`,{className:r.error?`error-text`:`muted`,children:r.error??`Chargement du dépôt…`})});let{repo:l,activeOperation:u}=c,d=nl(l).length,f=i.data?.operations??[];async function p(e){s(!0);try{let{operation:t}=await D.startFix(l.id,e);jl(W.operation(l.id,t.id))}catch(e){T(e),s(!1)}}return(0,B.jsxs)(`div`,{className:`page`,children:[(0,B.jsxs)(`div`,{className:`page-head`,children:[(0,B.jsx)(`a`,{className:`back`,href:W.lastHome(),"aria-label":`Retour aux dépôts`,children:(0,B.jsx)(V,{name:`arrow-left`,size:20})}),(0,B.jsxs)(`div`,{className:`page-head-text`,children:[(0,B.jsxs)(`h1`,{className:`page-title`,children:[l.name,a.data&&(0,B.jsx)(`a`,{className:`title-link`,href:`${a.data.githubServerUrl}/${l.id}`,target:`_blank`,rel:`noreferrer`,title:`Ouvrir ${l.id} sur GitHub`,"aria-label":`Ouvrir ${l.id} sur GitHub`,children:(0,B.jsx)(V,{name:`external-link`,size:16})})]}),(0,B.jsxs)(`div`,{className:`subtitle`,children:[l.owner,` · `,(0,B.jsx)(Zu,{repo:l,onChanged:r.reload}),` ·`,` `,(0,B.jsx)($u,{repo:l,categoryName:c.category?.name??null,onChanged:r.reload}),` ·`,` `,l.deprecatedAt?`déprécié le ${ml(l.deprecatedAt)}`:l.syncError?(0,B.jsx)(`span`,{className:`error-text`,title:l.syncError,children:`synchronisation impossible`}):l.syncedAt?`synchronisé ${ol(l.syncedAt)}`:`synchronisation…`]})]}),(0,B.jsxs)(`div`,{className:`page-actions`,children:[!l.deprecatedAt&&(0,B.jsx)(of,{view:c,onChanged:r.reload}),!l.deprecatedAt&&(0,B.jsx)(af,{view:c,onChanged:r.reload}),(0,B.jsx)(tf,{repoId:l.id}),u?(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,onClick:()=>jl(W.operation(l.id,u.id)),children:[(0,B.jsx)(V,{name:`wrench`}),u.kind===`audit`?`Voir l'audit en cours`:`Voir la correction en cours`]}):l.deprecatedAt?(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,disabled:!0,title:`Dépôt déprécié : rétablissez-le depuis l’onglet « Dépréciés » pour le corriger.`,children:[(0,B.jsx)(V,{name:`wrench`}),`Corriger`]}):(0,B.jsx)(H,{variant:`primary`,icon:`wrench`,label:`Corriger`,disabled:o,onLaunch:e=>void p(e)})]})]}),l.syncError&&(0,B.jsx)(`p`,{className:`banner banner-error`,children:l.syncError}),(0,B.jsxs)(`nav`,{className:`tabs`,children:[(0,B.jsxs)(`a`,{className:`tab${t===`alerts`?` is-active`:``}`,href:W.repo(l.id),children:[`Alertes ouvertes`,d>0&&(0,B.jsx)(`span`,{className:`tab-count tab-count-alert`,children:d})]}),(0,B.jsxs)(`a`,{className:`tab${t===`history`?` is-active`:``}`,href:W.repoHistory(l.id),children:[`Historique`,f.length>0&&(0,B.jsx)(`span`,{className:`tab-count`,children:f.length})]}),(0,B.jsx)(`a`,{className:`tab${t===`deploy`?` is-active`:``}`,href:W.repoDeploy(l.id),children:`Déploiement`})]}),t===`alerts`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nf,{view:c,onChanged:r.reload}),(0,B.jsx)(rf,{view:c,onChanged:r.reload})]}):t===`deploy`?(0,B.jsx)(Kd,{repo:l,deploymentId:n}):i.data?(0,B.jsx)(Qd,{repoId:l.id,operations:f}):(0,B.jsx)(`p`,{className:i.error?`error-text`:`muted`,children:i.error??`Chargement de l'historique…`})]})}var cf={maxTurns:{min:1,max:200},maxMinutes:{min:1,max:60}},lf=z({maxTurns:qs().int().min(cf.maxTurns.min).max(cf.maxTurns.max),maxMinutes:qs().int().min(cf.maxMinutes.min).max(cf.maxMinutes.max)});z({organizer:z({url:R().nullable(),token:R().nullable(),space:R().nullable(),owner:R().nullable()}),claude:z({token:R().nullable(),savedAt:R().nullable()}),analysis:lf}),z({organizerUrl:R().trim(),organizerToken:R().trim().min(1).optional(),claudeToken:R().trim().min(1).optional(),analysis:lf});var uf=3e3,df=4e3;function ff(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})}async function pf(e,t){try{await navigator.clipboard.writeText(e),ae.getState().show(`info`,t)}catch(e){T(e)}}function Z({onCreated:e,onCancel:t}){let[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);(0,_.useEffect)(()=>o.current?.focus(),[]);async function s(){if(n.trim()&&!i){a(!0);try{e(await D.createAgentToken(n.trim()))}catch(e){T(e),a(!1)}}}return(0,B.jsxs)(`div`,{className:`token-create`,children:[(0,B.jsx)(`input`,{ref:o,className:`input`,value:n,maxLength:60,placeholder:`Nom, ex. Claude Code — portable`,"aria-label":`Nom du token`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&t()}}),(0,B.jsx)(`button`,{type:`button`,className:`button button-queued`,disabled:!n.trim()||i,onClick:()=>void s(),children:`Créer`}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:t,children:`Annuler`})]})}function mf({created:e,onClose:t}){return(0,B.jsxs)(`div`,{className:`token-created`,children:[(0,B.jsxs)(`div`,{className:`token-created-head`,children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Token « `,e.token.name,` » créé. Copiez-le maintenant : il ne sera plus affiché.`]}),(0,B.jsx)(`span`,{className:`spacer`}),(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,onClick:t,"aria-label":`Fermer`,children:(0,B.jsx)(V,{name:`x`,size:16})})]}),(0,B.jsxs)(`div`,{className:`token-secret`,children:[(0,B.jsx)(`span`,{className:`input mono token-secret-value`,children:e.secret}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void pf(e.secret,`Token copié.`),children:[(0,B.jsx)(V,{name:`copy`}),`Copier`]})]}),(0,B.jsx)(`span`,{className:`field-label`,children:`Déclarer le MCP dans un projet`}),(0,B.jsxs)(`button`,{type:`button`,className:`code-chip mono token-command`,onClick:()=>void pf(e.setupCommand,`Commande copiée.`),title:`Copier la commande`,children:[(0,B.jsx)(`span`,{className:`token-command-text`,children:e.setupCommand}),(0,B.jsx)(V,{name:`copy`,size:14})]})]})}function hf({token:e,onRevoked:t}){let[n,r]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),df);return()=>clearTimeout(e)},[n]);async function i(){if(!n)r(!0);else try{await D.revokeAgentToken(e.id),t()}catch(e){r(!1),T(e)}}return(0,B.jsxs)(`div`,{className:`token-row${n?` is-confirming`:``}`,children:[(0,B.jsx)(V,{name:`key-round`,className:`token-icon`}),(0,B.jsxs)(`div`,{className:`token-text`,children:[(0,B.jsx)(`div`,{className:`token-name`,children:e.name}),(0,B.jsxs)(`div`,{className:`token-meta`,children:[`•••• `,e.hint,` · créé le `,ff(e.createdAt),` · `,e.lastUsedAt?`utilisé ${ol(e.lastUsedAt)}`:`jamais utilisé`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`token-revoke`,onClick:()=>void i(),children:n?`Confirmer la révocation`:`Révoquer`})]})}function gf(){let e=b(`agent-tokens`,()=>D.listAgentTokens(),uf),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),a=e.data?.tokens??[];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsx)(`p`,{className:`section-label`,children:`Accès des agents — outils MCP`}),!t&&(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-small`,onClick:()=>n(!0),children:[(0,B.jsx)(V,{name:`plus`}),`Nouveau token`]})]}),(t||r||a.length>0)&&(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[t&&(0,B.jsx)(Z,{onCancel:()=>n(!1),onCreated:t=>{n(!1),i(t),e.reload()}}),r&&(0,B.jsx)(mf,{created:r,onClose:()=>i(null)}),a.map(t=>(0,B.jsx)(hf,{token:t,onRevoked:e.reload},t.id))]}),e.error&&(0,B.jsx)(`p`,{className:`error-text`,children:e.error}),(0,B.jsx)(`p`,{className:`hint`,children:`Un agent déclare le MCP avec l'adresse de ce serveur et l'un de ces tokens.`})]})}var _f=`claude setup-token`;function vf(e){return new Date(e).toLocaleDateString(`fr-FR`)}function yf({hint:e,value:t,onChange:n,label:r,placeholder:i}){return e!==null&&t===null?(0,B.jsxs)(`div`,{className:`input token-saved`,children:[(0,B.jsxs)(`span`,{className:`mono`,children:[`•••••••••••• `,e]}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>n(``),children:`Remplacer`})]}):(0,B.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-label":r,placeholder:i,value:t??``,onChange:e=>n(e.target.value)})}function bf({view:e,onSaved:t}){let[n,r]=(0,_.useState)(e.organizer.url??``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(e.claude.tokenHint===null?``:null),[c,l]=(0,_.useState)(e.analysis),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1);async function m(){let e={organizerUrl:n.trim(),analysis:c};i?.trim()&&(e.organizerToken=i.trim()),o?.trim()&&(e.claudeToken=o.trim()),d(!0);try{let n=await D.saveSettings(e);a(null),s(n.claude.tokenHint===null?``:null),t(n),ae.getState().show(`info`,`Réglages enregistrés.`)}catch(e){T(e)}d(!1)}async function h(){p(!0);try{t(await D.testOrganizer()),ae.getState().show(`info`,`La connexion à l'organizer fonctionne.`)}catch(e){T(e)}p(!1)}async function g(){try{await navigator.clipboard.writeText(_f),ae.getState().show(`info`,`Commande copiée.`)}catch(e){T(e)}}let v=(e,t)=>{let n=Math.round(Number(t));Number.isFinite(n)&&l({...c,[e]:Math.min(cf[e].max,Math.max(cf[e].min,n))})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`page-head`,children:[(0,B.jsx)(`a`,{className:`back`,href:W.lastHome(),"aria-label":`Retour à l'accueil`,children:(0,B.jsx)(V,{name:`arrow-left`,size:20})}),(0,B.jsxs)(`div`,{className:`page-head-text`,children:[(0,B.jsx)(`h1`,{className:`page-title`,children:`Réglages`}),(0,B.jsx)(`p`,{className:`subtitle`,children:`Corrections par Claude quand npm audit fix ne suffit pas`})]}),(0,B.jsx)(`div`,{className:`page-actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`button button-primary`,disabled:u,onClick:()=>void m(),children:u?`Enregistrement…`:`Enregistrer`})})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Organizer — où Claude dépose son rapport`}),(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[(0,B.jsxs)(`div`,{className:`settings-fields`,children:[(0,B.jsxs)(`label`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`field-label`,children:`Adresse du site`}),(0,B.jsx)(`input`,{className:`input`,value:n,placeholder:`https://organizer.example.com`,spellCheck:!1,onChange:e=>r(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`settings-field settings-field-narrow`,children:[(0,B.jsx)(`span`,{className:`field-label`,children:`Token d'agent`}),(0,B.jsx)(yf,{hint:e.organizer.tokenHint,value:i,onChange:a,label:`Token d'agent`,placeholder:`Paramètres › Agents dans l'organizer`})]})]}),(0,B.jsxs)(`div`,{className:`settings-status`,children:[e.organizer.space?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Connecté à l'espace « `,e.organizer.space,` » · tâches assignées à `,e.organizer.owner]})]}):(0,B.jsx)(`span`,{className:`muted`,children:`Indiquez l'adresse du site et un token d'agent, créé dans l'organizer (Paramètres › Agents).`}),(0,B.jsx)(`span`,{className:`spacer`}),e.organizer.tokenHint!==null&&(0,B.jsx)(`button`,{type:`button`,className:`link`,disabled:f,onClick:()=>void h(),children:f?`Test…`:`Tester`})]})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Claude — abonnement utilisé pour les corrections`}),(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[(0,B.jsx)(`div`,{className:`settings-status settings-status-top`,children:e.claude.tokenHint===null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-alert`,className:`text-warning`}),(0,B.jsx)(`span`,{children:`Non connecté — sans Claude, une correction pousse les seules corrections de npm audit fix`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Connecté · token enregistré le `,vf(e.claude.savedAt),`, valable jusqu'au `,vf(e.claude.expiresAt)]}),(0,B.jsx)(`span`,{className:`spacer`}),o===null&&(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>s(``),children:`Remplacer`})]})}),o!==null&&(0,B.jsxs)(`ol`,{className:`claude-steps`,children:[(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`1`}),`Sur un poste avec navigateur, lancez`,(0,B.jsxs)(`button`,{type:`button`,className:`code-chip mono`,onClick:()=>void g(),title:`Copier la commande`,children:[_f,(0,B.jsx)(V,{name:`copy`,size:14})]})]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`2`}),`Autorisez l'accès dans le navigateur : le terminal affiche un token valable un an`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`3`}),`Collez-le ici`]}),(0,B.jsx)(`li`,{className:`claude-token-input`,children:(0,B.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-label":`Token Claude`,placeholder:`sk-ant-oat01-…`,value:o,onChange:e=>s(e.target.value)})})]})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Corrections par Claude`}),(0,B.jsx)(`div`,{className:`panel settings-card`,children:(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`right-label`,children:`Limites d'une session`}),(0,B.jsx)(`div`,{className:`right-description`,children:`Claude est lancé dès que npm audit fix laisse des vulnérabilités`})]}),(0,B.jsxs)(`div`,{className:`limits`,children:[(0,B.jsx)(`input`,{className:`input number-input`,type:`number`,min:cf.maxTurns.min,max:cf.maxTurns.max,value:c.maxTurns,"aria-label":`Tours au plus`,onChange:e=>v(`maxTurns`,e.target.value)}),(0,B.jsx)(`span`,{className:`muted`,children:`tours`}),(0,B.jsx)(`input`,{className:`input number-input`,type:`number`,min:cf.maxMinutes.min,max:cf.maxMinutes.max,value:c.maxMinutes,"aria-label":`Minutes au plus`,onChange:e=>v(`maxMinutes`,e.target.value)}),(0,B.jsx)(`span`,{className:`muted`,children:`min`})]})]})}),(0,B.jsx)(gf,{})]})}function xf(){let e=b(`settings`,()=>D.getSettings(),null,{remember:!1}),[t,n]=(0,_.useState)(null),r=t??e.data;return(0,B.jsx)(`div`,{className:`page`,children:r?(0,B.jsx)(bf,{view:r,onSaved:n}):(0,B.jsx)(`p`,{className:e.error?`error-text`:`muted`,children:e.error??`Chargement des réglages…`})})}function Sf(){let e=de(e=>e.status),t=de(e=>e.check),[n,r]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t().catch(e=>r(e instanceof Error?e.message:String(e)))},[t]),n?(0,B.jsx)(`div`,{className:`login`,children:(0,B.jsx)(`p`,{className:`error-text`,children:n})}):e.kind===`checking`?null:e.kind===`signed-out`?(0,B.jsx)(xu,{}):(0,B.jsx)(Cf,{})}function Cf(){let e=Pl(),[t,n]=(0,_.useState)(!1),r=(0,_.useCallback)(()=>n(!0),[]),i=(0,_.useCallback)(()=>n(!1),[]),a,o=e.name===`home`||e.name===`queue`||e.name===`pulls`||e.name===`deploy`||e.name===`deprecated`;if(o){let n=e.name===`home`?{kind:`category`,categoryId:e.categoryId}:{kind:e.name};a=(0,B.jsx)(bu,{tab:n,adding:t,onAdd:r,onCloseAdd:i})}else a=e.name===`settings`?(0,B.jsx)(xf,{}):e.name===`repo`?(0,B.jsx)(sf,{repoId:e.repoId,tab:e.tab,deploymentId:e.deploymentId},e.repoId):e.name===`operation`?(0,B.jsx)(Ju,{repoId:e.repoId,operationId:e.operationId},e.operationId):(0,B.jsx)(`div`,{className:`page`,children:(0,B.jsxs)(`p`,{className:`muted`,children:[`Adresse inconnue : `,(0,B.jsx)(`code`,{children:e.hash}),`. `,(0,B.jsx)(`a`,{className:`link`,href:W.home(),children:`Revenir à l'accueil`}),`.`]})});let s=o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`a`,{className:`button button-secondary button-icon`,href:W.settings(),"aria-label":`Réglages`,title:`Réglages`,children:(0,B.jsx)(V,{name:`settings`})}),(0,B.jsx)(Tl,{}),e.name!==`deploy`&&e.name!==`pulls`&&(0,B.jsx)(Cl,{target:e.name===`queue`?{kind:`queue`}:e.name===`home`&&e.categoryId!==null?{kind:`category`,categoryId:e.categoryId}:{kind:`all`}}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,onClick:r,children:[(0,B.jsx)(V,{name:`plus`}),`Ajouter un dépôt`]})]}):null;return(0,B.jsxs)(`div`,{className:`app`,children:[(0,B.jsx)(Fl,{action:s}),(0,B.jsx)(`main`,{className:`main`,children:a}),(0,B.jsx)(wl,{})]})}(0,v.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(_.StrictMode,{children:(0,B.jsx)(Sf,{})}));
|
|
71
|
+
`]}),e.output,r&&(0,B.jsx)(`span`,{className:`terminal-cursor`}),!r&&!e.output&&(0,B.jsx)(`span`,{className:`muted`,children:`Aucune sortie.`})]}),(0,B.jsxs)(`p`,{className:`hint-line`,children:[(0,B.jsx)(V,{name:`info`}),e.server,` · `,e.branch,` · `,Nd(e.commit),r?` · un déploiement réussi retire le dépôt de « À déployer ».`:``]})]})}function Wd({id:e,onFinished:t}){let n=b(`deployment:${e}`,()=>D.getDeployment(e),jd),r=n.data?.deployment,i=r!==void 0&&r.status!==`running`;return(0,_.useEffect)(()=>{i&&t()},[i,t]),r?(0,B.jsx)(Ud,{deployment:r,onBack:null}):(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`})}function Gd({repoId:e,deploymentId:t}){let n=b(`deployment:${t}`,()=>D.getDeployment(t),jd),r=n.data?.deployment;return r?(0,B.jsx)(Ud,{deployment:r,onBack:()=>jl(W.repoDeploy(e))}):(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`})}function Kd({repo:e,deploymentId:t}){let n=b(`deploy:${e.id}`,()=>D.getRepoDeploy(e.id),Ad),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),d=n.data,f=d?.activeDeployment??null;if(!d)return(0,B.jsx)(`p`,{className:n.error?`error-text`:`muted`,children:n.error??`Chargement du déploiement…`});async function p(t){u(!0);try{await D.saveRepoDeployScript(e.id,t),c(!1),n.reload()}catch(e){T(e)}finally{u(!1)}}async function m(){u(!0);try{await D.startDeployment(e.id),t&&jl(W.repoDeploy(e.id)),n.reload()}catch(e){T(e)}finally{u(!1)}}async function h(e){try{await D.cancelDeployment(e.id),n.reload()}catch(e){T(e)}}let g=r&&(0,B.jsx)(kd,{repoId:e.id,server:r.server,step:r.step,onClose:()=>i(null),onChanged:n.reload,onWriteScript:()=>{i(null),c(!0)}}),v=t===null&&f?f:null,y=d.server?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Rd,{repo:e,view:d.server,deploy:d,starting:l,onDeploy:()=>void m(),onCancel:e=>void h(e),onWizard:(e,t)=>i({server:t??d.server,step:e}),onKey:o,onNewServer:()=>i({server:null,step:`form`}),onChanged:n.reload}),(0,B.jsx)(`div`,{className:`deploy-body`,children:t===null?v?(0,B.jsx)(Wd,{id:v.id,onFinished:n.reload}):s?(0,B.jsx)(bd,{initial:d.script,busy:l,onSave:e=>void p(e),onCancel:()=>c(!1)}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsx)(`p`,{className:`section-label section-label-strong`,children:`Script de déploiement`}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-small`,onClick:()=>c(!0),children:[(0,B.jsx)(V,{name:`pencil`,size:14}),d.script.trim()?`Modifier`:`Écrire le script`]})]}),d.script.trim()?(0,B.jsx)(yd,{script:d.script}):(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:`Aucun script : il s'écrit en bash et s'exécute sur le serveur à chaque déploiement.`})}),(0,B.jsx)(Vd,{repoId:e.id,deployments:d.deployments})]}):(0,B.jsx)(Gd,{repoId:e.id,deploymentId:t})})]}):(0,B.jsx)(Ld,{repoId:e.id,onChanged:n.reload,onNew:()=>i({server:null,step:`form`})}),x=a&&d.server?a===`rotate`?(0,B.jsx)(td,{view:d.server,onClose:()=>o(null),onChanged:n.reload}):(0,B.jsx)(nd,{view:d.server,onClose:()=>o(null),onChanged:n.reload}):null;return(0,B.jsxs)(B.Fragment,{children:[y,g,x]})}var qd={running:`en cours`,done:`terminée`,failed:`échouée`,cancelled:`annulée`};function Jd(e){return qc.includes(e.status)?{icon:`circle-dot`,className:`text-accent`}:e.status===`done`?{icon:`circle-check`,className:`text-ok`}:e.status===`failed`?{icon:`circle-x`,className:`error-text`}:{icon:`circle-minus`,className:`muted`}}function Yd(e){if(e.status===`failed`&&e.error)return(0,B.jsx)(`span`,{className:`error-text`,children:e.error.split(/\r?\n/)[0]});let{before:t,after:n}=e;return t===null?null:e.kind===`audit`||n===null?sl(t,`vulnérabilité`):`${t} → ${sl(n,`vulnérabilité`)}`}function Xd(e){return e.claude?`Claude`:null}function Zd(e){return e.pullRequest?(0,B.jsxs)(`a`,{className:`pr-note`,href:e.pullRequest.url,target:`_blank`,rel:`noreferrer`,children:[`PR #`,e.pullRequest.number]}):(0,B.jsx)(`span`,{className:e.status===`failed`?`error-text`:void 0,children:qd[e.status]})}function Qd({repoId:e,operations:t}){return t.length===0?(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:`Aucune opération sur ce dépôt.`})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`panel list`,children:t.map(t=>{let n=Jd(t),r=Xd(t);return(0,B.jsxs)(`div`,{className:`row row-linked history-row`,children:[(0,B.jsx)(V,{name:n.icon,className:`history-icon ${n.className}`}),(0,B.jsxs)(`div`,{className:`history-title`,children:[(0,B.jsx)(`a`,{className:`row-link`,href:W.operation(e,t.id),children:t.kind===`audit`?`Audit`:`Correction`}),(0,B.jsxs)(`span`,{className:`history-meta`,children:[t.origin===`agent`?`l'agent`:`vous`,` · `,t.scope===`production`?`production`:ll.all,` · `,t.baseBranch]})]}),(0,B.jsx)(`span`,{className:`history-date`,children:ml(t.createdAt)}),(0,B.jsx)(`span`,{className:`history-counts`,children:Yd(t)}),(0,B.jsx)(`span`,{className:`history-claude`,children:r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`sparkles`,size:14}),r]})}),(0,B.jsx)(`span`,{className:`history-outcome`,children:Zd(t)}),(0,B.jsx)(V,{name:`chevron-right`,className:`row-chevron`})]},t.id)})}),(0,B.jsxs)(`p`,{className:`hint history-note`,children:[`Les `,20,` dernières opérations du dépôt sont conservées.`]})]})}var $d=3e3,ef=4e3;function tf({repoId:e}){let[t,n]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>n(!1),ef);return()=>clearTimeout(e)},[t]);async function r(){if(!t)n(!0);else try{await D.removeRepo(e),jl(W.lastHome())}catch(e){n(!1),T(e)}}return t?(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-danger`,onClick:()=>void r(),children:[(0,B.jsx)(V,{name:`trash-2`}),`Confirmer le retrait`]}):(0,B.jsx)(`button`,{type:`button`,className:`button button-secondary button-icon`,onClick:()=>void r(),"aria-label":`Retirer le dépôt`,title:`Retirer le dépôt`,children:(0,B.jsx)(V,{name:`trash-2`})})}function nf({view:e,onChanged:t}){let{repo:n,unfixable:r}=e,i=nl(n);async function a(e){try{await D.markAlertHandled(n.id,e),t()}catch(e){T(e)}}return i.length===0?(0,B.jsx)(`div`,{className:`panel empty`,children:(0,B.jsx)(`p`,{children:n.alerts.length===0?`Aucune alerte ouverte.`:`Toutes les alertes sont corrigées à la main.`})}):(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(`div`,{className:`panel list`,children:i.map(e=>(0,B.jsxs)(`div`,{className:`alert-line`,children:[(0,B.jsxs)(`a`,{className:`row alert-row`,href:e.url,target:`_blank`,rel:`noreferrer`,title:`Alerte #${e.number} sur GitHub`,children:[(0,B.jsx)(Ll,{severity:e.severity,wide:!0,children:cl[e.severity]}),(0,B.jsx)(`span`,{className:`alert-package mono`,children:e.package}),(0,B.jsx)(`span`,{className:`alert-summary`,children:e.summary}),r.includes(e.package)&&(0,B.jsxs)(`span`,{className:`unfixable-note`,title:`Le dernier audit n'a trouvé aucune version corrigée publiée sur le registre npm.`,children:[(0,B.jsx)(V,{name:`triangle-alert`}),`sans correctif`]}),e.scope===`development`&&(0,B.jsx)(`span`,{className:`dev-tag`,title:`Dépendance de développement : un audit de production la laisse de côté.`,children:`dév.`}),(0,B.jsx)(`span`,{className:`alert-mark-space`}),(0,B.jsx)(V,{name:`external-link`,className:`row-chevron`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary alert-mark`,onClick:()=>void a(e.number),children:[(0,B.jsx)(V,{name:`check`,size:14}),`Corrigée à la main`]})]},e.number))})})}function rf({view:e,onChanged:t}){let{repo:n}=e,r=rl(n);if(r.length===0)return null;async function i(e){try{await D.unmarkAlertHandled(n.id,e),t()}catch(e){T(e)}}return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`section-label section-label-spaced`,children:`Corrigées à la main`}),(0,B.jsx)(`div`,{className:`panel list`,children:r.map(e=>{let t=n.handledAlerts.find(t=>t.number===e.number);return(0,B.jsxs)(`div`,{className:`row alert-row`,children:[(0,B.jsx)(Ll,{severity:e.severity,wide:!0,faded:!0,children:cl[e.severity]}),(0,B.jsx)(`span`,{className:`alert-package mono`,children:e.package}),(0,B.jsxs)(`span`,{className:`alert-summary handled-note`,children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),`Corrigée à la main`,t&&` le ${ml(t.markedAt)}`]}),(0,B.jsx)(`button`,{type:`button`,className:`link restore-link`,onClick:()=>void i(e.number),children:`Rétablir`})]},e.number)})})]})}function af({view:e,onChanged:t}){let[n,r]=(0,_.useState)(!1),i=e.repo.id,a=e.repo.queuedAt!==null;async function o(){r(!0);try{if(a){await D.unqueueRepo(i),jl(W.queue());return}await D.queueRepo(i),t()}catch(e){T(e)}finally{r(!1)}}return a?(0,B.jsxs)(`button`,{type:`button`,className:`button button-queued`,onClick:()=>void o(),disabled:n,title:`Retirer de la file d'attente`,children:[(0,B.jsx)(V,{name:`list-check`}),`Traité`]}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void o(),disabled:n,children:[(0,B.jsx)(V,{name:`list-plus`}),`Ajouter à la file`]})}function of({view:e,onChanged:t}){let[n,r]=(0,_.useState)(!1),i=e.repo.id,a=e.repo.deployPendingAt!==null;async function o(){r(!0);try{await(a?D.unmarkDeployPending(i):D.markDeployPending(i)),t()}catch(e){T(e)}finally{r(!1)}}return a?(0,B.jsxs)(`button`,{type:`button`,className:`button button-queued`,onClick:()=>void o(),disabled:n,title:`Retirer de « À déployer »`,children:[(0,B.jsx)(V,{name:`rocket`}),`Déployé`]}):(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void o(),disabled:n,children:[(0,B.jsx)(V,{name:`rocket`}),`À déployer`]})}function sf({repoId:e,tab:t,deploymentId:n}){let r=b(`repo:${e}`,()=>D.getRepo(e),$d),i=b(`history:${e}`,()=>D.listOperations(e),$d),a=b(`config`,D.getConfig,null),[o,s]=(0,_.useState)(!1),c=r.data;if(!c)return(0,B.jsx)(`div`,{className:`page`,children:(0,B.jsx)(`p`,{className:r.error?`error-text`:`muted`,children:r.error??`Chargement du dépôt…`})});let{repo:l,activeOperation:u}=c,d=nl(l).length,f=i.data?.operations??[];async function p(e){s(!0);try{let{operation:t}=await D.startFix(l.id,e);jl(W.operation(l.id,t.id))}catch(e){T(e),s(!1)}}return(0,B.jsxs)(`div`,{className:`page`,children:[(0,B.jsxs)(`div`,{className:`page-head`,children:[(0,B.jsx)(`a`,{className:`back`,href:W.lastHome(),"aria-label":`Retour aux dépôts`,children:(0,B.jsx)(V,{name:`arrow-left`,size:20})}),(0,B.jsxs)(`div`,{className:`page-head-text`,children:[(0,B.jsxs)(`h1`,{className:`page-title`,children:[l.name,a.data&&(0,B.jsx)(`a`,{className:`title-link`,href:`${a.data.githubServerUrl}/${l.id}`,target:`_blank`,rel:`noreferrer`,title:`Ouvrir ${l.id} sur GitHub`,"aria-label":`Ouvrir ${l.id} sur GitHub`,children:(0,B.jsx)(V,{name:`external-link`,size:16})})]}),(0,B.jsxs)(`div`,{className:`subtitle`,children:[l.owner,` · `,(0,B.jsx)(Zu,{repo:l,onChanged:r.reload}),` ·`,` `,(0,B.jsx)($u,{repo:l,categoryName:c.category?.name??null,onChanged:r.reload}),` ·`,` `,l.deprecatedAt?`déprécié le ${ml(l.deprecatedAt)}`:l.syncError?(0,B.jsx)(`span`,{className:`error-text`,title:l.syncError,children:`synchronisation impossible`}):l.syncedAt?`synchronisé ${ol(l.syncedAt)}`:`synchronisation…`]})]}),(0,B.jsxs)(`div`,{className:`page-actions`,children:[!l.deprecatedAt&&(0,B.jsx)(of,{view:c,onChanged:r.reload}),!l.deprecatedAt&&(0,B.jsx)(af,{view:c,onChanged:r.reload}),(0,B.jsx)(tf,{repoId:l.id}),u?(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,onClick:()=>jl(W.operation(l.id,u.id)),children:[(0,B.jsx)(V,{name:`wrench`}),u.kind===`audit`?`Voir l'audit en cours`:`Voir la correction en cours`]}):l.deprecatedAt?(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,disabled:!0,title:`Dépôt déprécié : rétablissez-le depuis l’onglet « Dépréciés » pour le corriger.`,children:[(0,B.jsx)(V,{name:`wrench`}),`Corriger`]}):(0,B.jsx)(H,{variant:`primary`,icon:`wrench`,label:`Corriger`,disabled:o,onLaunch:e=>void p(e)})]})]}),l.syncError&&(0,B.jsx)(`p`,{className:`banner banner-error`,children:l.syncError}),(0,B.jsxs)(`nav`,{className:`tabs`,children:[(0,B.jsxs)(`a`,{className:`tab${t===`alerts`?` is-active`:``}`,href:W.repo(l.id),children:[`Alertes ouvertes`,d>0&&(0,B.jsx)(`span`,{className:`tab-count tab-count-alert`,children:d})]}),(0,B.jsxs)(`a`,{className:`tab${t===`history`?` is-active`:``}`,href:W.repoHistory(l.id),children:[`Historique`,f.length>0&&(0,B.jsx)(`span`,{className:`tab-count`,children:f.length})]}),(0,B.jsx)(`a`,{className:`tab${t===`deploy`?` is-active`:``}`,href:W.repoDeploy(l.id),children:`Déploiement`})]}),t===`alerts`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nf,{view:c,onChanged:r.reload}),(0,B.jsx)(rf,{view:c,onChanged:r.reload})]}):t===`deploy`?(0,B.jsx)(Kd,{repo:l,deploymentId:n}):i.data?(0,B.jsx)(Qd,{repoId:l.id,operations:f}):(0,B.jsx)(`p`,{className:i.error?`error-text`:`muted`,children:i.error??`Chargement de l'historique…`})]})}var cf={maxTurns:{min:1,max:200},maxMinutes:{min:1,max:60}},lf=z({maxTurns:qs().int().min(cf.maxTurns.min).max(cf.maxTurns.max),maxMinutes:qs().int().min(cf.maxMinutes.min).max(cf.maxMinutes.max)}),uf=z({token:R().nullable(),savedAt:R().nullable(),login:R().nullable().default(null),expiresAt:R().nullable().default(null)}),df={token:null,savedAt:null,login:null,expiresAt:null};z({organizer:z({url:R().nullable(),token:R().nullable(),space:R().nullable(),owner:R().nullable()}),claude:z({token:R().nullable(),savedAt:R().nullable()}),analysis:lf,github:uf.default(df),deploy:uf.default(df)}),z({organizerUrl:R().trim(),organizerToken:R().trim().min(1).optional(),claudeToken:R().trim().min(1).optional(),githubToken:R().trim().min(1).optional(),deployToken:R().trim().min(1).nullable().optional(),analysis:lf});var ff=3e3,pf=4e3;function Z(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`})}async function mf(e,t){try{await navigator.clipboard.writeText(e),ae.getState().show(`info`,t)}catch(e){T(e)}}function hf({onCreated:e,onCancel:t}){let[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(!1),o=(0,_.useRef)(null);(0,_.useEffect)(()=>o.current?.focus(),[]);async function s(){if(n.trim()&&!i){a(!0);try{e(await D.createAgentToken(n.trim()))}catch(e){T(e),a(!1)}}}return(0,B.jsxs)(`div`,{className:`token-create`,children:[(0,B.jsx)(`input`,{ref:o,className:`input`,value:n,maxLength:60,placeholder:`Nom, ex. Claude Code — portable`,"aria-label":`Nom du token`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s(),e.key===`Escape`&&t()}}),(0,B.jsx)(`button`,{type:`button`,className:`button button-queued`,disabled:!n.trim()||i,onClick:()=>void s(),children:`Créer`}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:t,children:`Annuler`})]})}function gf({created:e,onClose:t}){return(0,B.jsxs)(`div`,{className:`token-created`,children:[(0,B.jsxs)(`div`,{className:`token-created-head`,children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Token « `,e.token.name,` » créé. Copiez-le maintenant : il ne sera plus affiché.`]}),(0,B.jsx)(`span`,{className:`spacer`}),(0,B.jsx)(`button`,{type:`button`,className:`icon-button`,onClick:t,"aria-label":`Fermer`,children:(0,B.jsx)(V,{name:`x`,size:16})})]}),(0,B.jsxs)(`div`,{className:`token-secret`,children:[(0,B.jsx)(`span`,{className:`input mono token-secret-value`,children:e.secret}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary`,onClick:()=>void mf(e.secret,`Token copié.`),children:[(0,B.jsx)(V,{name:`copy`}),`Copier`]})]}),(0,B.jsx)(`span`,{className:`field-label`,children:`Déclarer le MCP dans un projet`}),(0,B.jsxs)(`button`,{type:`button`,className:`code-chip mono token-command`,onClick:()=>void mf(e.setupCommand,`Commande copiée.`),title:`Copier la commande`,children:[(0,B.jsx)(`span`,{className:`token-command-text`,children:e.setupCommand}),(0,B.jsx)(V,{name:`copy`,size:14})]})]})}function _f({token:e,onRevoked:t}){let[n,r]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>r(!1),pf);return()=>clearTimeout(e)},[n]);async function i(){if(!n)r(!0);else try{await D.revokeAgentToken(e.id),t()}catch(e){r(!1),T(e)}}return(0,B.jsxs)(`div`,{className:`token-row${n?` is-confirming`:``}`,children:[(0,B.jsx)(V,{name:`key-round`,className:`token-icon`}),(0,B.jsxs)(`div`,{className:`token-text`,children:[(0,B.jsx)(`div`,{className:`token-name`,children:e.name}),(0,B.jsxs)(`div`,{className:`token-meta`,children:[`•••• `,e.hint,` · créé le `,Z(e.createdAt),` · `,e.lastUsedAt?`utilisé ${ol(e.lastUsedAt)}`:`jamais utilisé`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`token-revoke`,onClick:()=>void i(),children:n?`Confirmer la révocation`:`Révoquer`})]})}function vf(){let e=b(`agent-tokens`,()=>D.listAgentTokens(),ff),[t,n]=(0,_.useState)(!1),[r,i]=(0,_.useState)(null),a=e.data?.tokens??[];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`section-head`,children:[(0,B.jsx)(`p`,{className:`section-label`,children:`Accès des agents — outils MCP`}),!t&&(0,B.jsxs)(`button`,{type:`button`,className:`button button-secondary button-small`,onClick:()=>n(!0),children:[(0,B.jsx)(V,{name:`plus`}),`Nouveau token`]})]}),(t||r||a.length>0)&&(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[t&&(0,B.jsx)(hf,{onCancel:()=>n(!1),onCreated:t=>{n(!1),i(t),e.reload()}}),r&&(0,B.jsx)(gf,{created:r,onClose:()=>i(null)}),a.map(t=>(0,B.jsx)(_f,{token:t,onRevoked:e.reload},t.id))]}),e.error&&(0,B.jsx)(`p`,{className:`error-text`,children:e.error}),(0,B.jsx)(`p`,{className:`hint`,children:`Un agent déclare le MCP avec l'adresse de ce serveur et l'un de ces tokens.`})]})}var yf=`claude setup-token`,bf=`unset GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0`,xf=4e3;function Sf(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`numeric`,month:`short`,year:`numeric`})}async function Cf(e,t){try{await navigator.clipboard.writeText(e),ae.getState().show(`info`,`${t} copiée.`)}catch(e){T(e)}}function wf({title:e,description:t,view:n,missing:r,rights:i,value:a,onChange:o,onRemove:s}){let[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(!c)return;let e=setTimeout(()=>l(!1),xf);return()=>clearTimeout(e)},[c]);async function u(){c?(l(!1),await s?.()):l(!0)}let d=n.tokenHint!==null;return(0,B.jsxs)(`div`,{className:`github-token`,children:[(0,B.jsx)(`div`,{className:`right-label`,children:e}),(0,B.jsx)(`div`,{className:`right-description`,children:t}),d&&a===null?(0,B.jsxs)(`div`,{className:`github-token-status`,children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`•••• `,n.tokenHint,n.login&&` · compte ${n.login}`,n.expiresAt?` · expire le ${Sf(n.expiresAt)}`:n.login?` · sans expiration`:``]}),(0,B.jsx)(`span`,{className:`spacer`}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>o(``),children:`Remplacer`}),s&&(0,B.jsx)(`button`,{type:`button`,className:`link-danger`,onClick:()=>void u(),children:c?`Confirmer le retrait`:`Retirer`})]}):(0,B.jsxs)(B.Fragment,{children:[!d&&(0,B.jsxs)(`div`,{className:`github-token-status`,children:[(0,B.jsx)(V,{name:`circle-alert`,className:`text-warning`}),(0,B.jsx)(`span`,{className:`github-token-missing`,children:r})]}),(0,B.jsx)(`div`,{className:`github-token-rights`,children:i}),(0,B.jsx)(`input`,{className:`input mono github-token-input`,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-label":e,placeholder:`github_pat_…`,value:a??``,onChange:e=>o(e.target.value)})]})]})}function Tf(e){return new Date(e).toLocaleDateString(`fr-FR`)}function Ef({hint:e,value:t,onChange:n,label:r,placeholder:i}){return e!==null&&t===null?(0,B.jsxs)(`div`,{className:`input token-saved`,children:[(0,B.jsxs)(`span`,{className:`mono`,children:[`•••••••••••• `,e]}),(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>n(``),children:`Remplacer`})]}):(0,B.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-label":r,placeholder:i,value:t??``,onChange:e=>n(e.target.value)})}function Df({view:e,onSaved:t}){let[n,r]=(0,_.useState)(e.organizer.url??``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(e.claude.tokenHint===null?``:null),[c,l]=(0,_.useState)(e.github.tokenHint===null?``:null),[u,d]=(0,_.useState)(e.deploy.tokenHint===null?``:null),[f,p]=(0,_.useState)(e.analysis),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1);async function y(){let e={organizerUrl:n.trim(),analysis:f};i?.trim()&&(e.organizerToken=i.trim()),o?.trim()&&(e.claudeToken=o.trim()),c?.trim()&&(e.githubToken=c.trim()),u?.trim()&&(e.deployToken=u.trim()),h(!0);try{let n=await D.saveSettings(e);a(null),s(n.claude.tokenHint===null?``:null),l(n.github.tokenHint===null?``:null),d(n.deploy.tokenHint===null?``:null),t(n),ae.getState().show(`info`,`Réglages enregistrés.`)}catch(e){T(e)}h(!1)}async function b(){v(!0);try{t(await D.testOrganizer()),ae.getState().show(`info`,`La connexion à l'organizer fonctionne.`)}catch(e){T(e)}v(!1)}async function x(){try{let n=await D.saveSettings({organizerUrl:e.organizer.url??``,analysis:e.analysis,deployToken:null});d(``),t(n),ae.getState().show(`info`,`Token de déploiement retiré.`)}catch(e){T(e)}}let S=(e,t)=>{let n=Math.round(Number(t));Number.isFinite(n)&&p({...f,[e]:Math.min(cf[e].max,Math.max(cf[e].min,n))})};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`page-head`,children:[(0,B.jsx)(`a`,{className:`back`,href:W.lastHome(),"aria-label":`Retour à l'accueil`,children:(0,B.jsx)(V,{name:`arrow-left`,size:20})}),(0,B.jsxs)(`div`,{className:`page-head-text`,children:[(0,B.jsx)(`h1`,{className:`page-title`,children:`Réglages`}),(0,B.jsx)(`p`,{className:`subtitle`,children:`Accès à GitHub, corrections par Claude et agents`})]}),(0,B.jsx)(`div`,{className:`page-actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`button button-primary`,disabled:m,onClick:()=>void y(),children:m?`Enregistrement…`:`Enregistrer`})})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`GitHub — accès aux dépôts`}),(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[(0,B.jsx)(wf,{title:`Token du tracker`,description:`Lit les alertes, clone les dépôts, pousse les corrections et ouvre les pull requests`,view:e.github,missing:`Manquant — ni synchronisation, ni audit, ni correction`,rights:`Token à grain fin : Dependabot alerts en lecture, Contents et Pull requests en lecture et écriture`,value:c,onChange:l}),(0,B.jsx)(wf,{title:`Token de déploiement`,description:`Transmis aux scripts de déploiement, pour leur git pull`,view:e.deploy,missing:`Absent — le git pull d'un dépôt privé échoue pendant un déploiement`,rights:`Token à grain fin en lecture seule : Contents en lecture, limité aux dépôts que vous déployez`,value:u,onChange:d,onRemove:x})]}),(0,B.jsxs)(`div`,{className:`settings-note`,children:[(0,B.jsx)(`span`,{children:`Dans un script de déploiement, retirez le token après le git pull, pour ne pas le transmettre aux commandes suivantes :`}),(0,B.jsxs)(`button`,{type:`button`,className:`code-chip mono`,onClick:()=>void Cf(bf,`Ligne`),title:`Copier la ligne`,children:[bf,(0,B.jsx)(V,{name:`copy`,size:14})]})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Organizer — où Claude dépose son rapport`}),(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[(0,B.jsxs)(`div`,{className:`settings-fields`,children:[(0,B.jsxs)(`label`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`field-label`,children:`Adresse du site`}),(0,B.jsx)(`input`,{className:`input`,value:n,placeholder:`https://organizer.example.com`,spellCheck:!1,onChange:e=>r(e.target.value)})]}),(0,B.jsxs)(`div`,{className:`settings-field settings-field-narrow`,children:[(0,B.jsx)(`span`,{className:`field-label`,children:`Token d'agent`}),(0,B.jsx)(Ef,{hint:e.organizer.tokenHint,value:i,onChange:a,label:`Token d'agent`,placeholder:`Paramètres › Agents dans l'organizer`})]})]}),(0,B.jsxs)(`div`,{className:`settings-status`,children:[e.organizer.space?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Connecté à l'espace « `,e.organizer.space,` » · tâches assignées à `,e.organizer.owner]})]}):(0,B.jsx)(`span`,{className:`muted`,children:`Indiquez l'adresse du site et un token d'agent, créé dans l'organizer (Paramètres › Agents).`}),(0,B.jsx)(`span`,{className:`spacer`}),e.organizer.tokenHint!==null&&(0,B.jsx)(`button`,{type:`button`,className:`link`,disabled:g,onClick:()=>void b(),children:g?`Test…`:`Tester`})]})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Claude — abonnement utilisé pour les corrections`}),(0,B.jsxs)(`div`,{className:`panel settings-card`,children:[(0,B.jsx)(`div`,{className:`settings-status settings-status-top`,children:e.claude.tokenHint===null?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-alert`,className:`text-warning`}),(0,B.jsx)(`span`,{children:`Non connecté — sans Claude, une correction pousse les seules corrections de npm audit fix`})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(V,{name:`circle-check`,className:`text-ok`}),(0,B.jsxs)(`span`,{children:[`Connecté · token enregistré le `,Tf(e.claude.savedAt),`, valable jusqu'au `,Tf(e.claude.expiresAt)]}),(0,B.jsx)(`span`,{className:`spacer`}),o===null&&(0,B.jsx)(`button`,{type:`button`,className:`link`,onClick:()=>s(``),children:`Remplacer`})]})}),o!==null&&(0,B.jsxs)(`ol`,{className:`claude-steps`,children:[(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`1`}),`Sur un poste avec navigateur, lancez`,(0,B.jsxs)(`button`,{type:`button`,className:`code-chip mono`,onClick:()=>void Cf(yf,`Commande`),title:`Copier la commande`,children:[yf,(0,B.jsx)(V,{name:`copy`,size:14})]})]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`2`}),`Autorisez l'accès dans le navigateur : le terminal affiche un token valable un an`]}),(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`span`,{className:`step-number`,children:`3`}),`Collez-le ici`]}),(0,B.jsx)(`li`,{className:`claude-token-input`,children:(0,B.jsx)(`input`,{className:`input mono`,type:`password`,autoComplete:`off`,spellCheck:!1,"aria-label":`Token Claude`,placeholder:`sk-ant-oat01-…`,value:o,onChange:e=>s(e.target.value)})})]})]}),(0,B.jsx)(`p`,{className:`section-label`,children:`Corrections par Claude`}),(0,B.jsx)(`div`,{className:`panel settings-card`,children:(0,B.jsxs)(`div`,{className:`right`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`div`,{className:`right-label`,children:`Limites d'une session`}),(0,B.jsx)(`div`,{className:`right-description`,children:`Claude est lancé dès que npm audit fix laisse des vulnérabilités`})]}),(0,B.jsxs)(`div`,{className:`limits`,children:[(0,B.jsx)(`input`,{className:`input number-input`,type:`number`,min:cf.maxTurns.min,max:cf.maxTurns.max,value:f.maxTurns,"aria-label":`Tours au plus`,onChange:e=>S(`maxTurns`,e.target.value)}),(0,B.jsx)(`span`,{className:`muted`,children:`tours`}),(0,B.jsx)(`input`,{className:`input number-input`,type:`number`,min:cf.maxMinutes.min,max:cf.maxMinutes.max,value:f.maxMinutes,"aria-label":`Minutes au plus`,onChange:e=>S(`maxMinutes`,e.target.value)}),(0,B.jsx)(`span`,{className:`muted`,children:`min`})]})]})}),(0,B.jsx)(vf,{})]})}function Of(){let e=b(`settings`,()=>D.getSettings(),null,{remember:!1}),[t,n]=(0,_.useState)(null),r=t??e.data;return(0,B.jsx)(`div`,{className:`page`,children:r?(0,B.jsx)(Df,{view:r,onSaved:n}):(0,B.jsx)(`p`,{className:e.error?`error-text`:`muted`,children:e.error??`Chargement des réglages…`})})}function kf(){let e=de(e=>e.status),t=de(e=>e.check),[n,r]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t().catch(e=>r(e instanceof Error?e.message:String(e)))},[t]),n?(0,B.jsx)(`div`,{className:`login`,children:(0,B.jsx)(`p`,{className:`error-text`,children:n})}):e.kind===`checking`?null:e.kind===`signed-out`?(0,B.jsx)(xu,{}):(0,B.jsx)(Af,{})}function Af(){let e=Pl(),[t,n]=(0,_.useState)(!1),r=(0,_.useCallback)(()=>n(!0),[]),i=(0,_.useCallback)(()=>n(!1),[]),a,o=e.name===`home`||e.name===`queue`||e.name===`pulls`||e.name===`deploy`||e.name===`deprecated`;if(o){let n=e.name===`home`?{kind:`category`,categoryId:e.categoryId}:{kind:e.name};a=(0,B.jsx)(bu,{tab:n,adding:t,onAdd:r,onCloseAdd:i})}else a=e.name===`settings`?(0,B.jsx)(Of,{}):e.name===`repo`?(0,B.jsx)(sf,{repoId:e.repoId,tab:e.tab,deploymentId:e.deploymentId},e.repoId):e.name===`operation`?(0,B.jsx)(Ju,{repoId:e.repoId,operationId:e.operationId},e.operationId):(0,B.jsx)(`div`,{className:`page`,children:(0,B.jsxs)(`p`,{className:`muted`,children:[`Adresse inconnue : `,(0,B.jsx)(`code`,{children:e.hash}),`. `,(0,B.jsx)(`a`,{className:`link`,href:W.home(),children:`Revenir à l'accueil`}),`.`]})});let s=o?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`a`,{className:`button button-secondary button-icon`,href:W.settings(),"aria-label":`Réglages`,title:`Réglages`,children:(0,B.jsx)(V,{name:`settings`})}),(0,B.jsx)(Tl,{}),e.name!==`deploy`&&e.name!==`pulls`&&(0,B.jsx)(Cl,{target:e.name===`queue`?{kind:`queue`}:e.name===`home`&&e.categoryId!==null?{kind:`category`,categoryId:e.categoryId}:{kind:`all`}}),(0,B.jsxs)(`button`,{type:`button`,className:`button button-primary`,onClick:r,children:[(0,B.jsx)(V,{name:`plus`}),`Ajouter un dépôt`]})]}):null;return(0,B.jsxs)(`div`,{className:`app`,children:[(0,B.jsx)(Fl,{action:s}),(0,B.jsx)(`main`,{className:`main`,children:a}),(0,B.jsx)(wl,{})]})}(0,v.createRoot)(document.getElementById(`root`)).render((0,B.jsx)(_.StrictMode,{children:(0,B.jsx)(kf,{})}));
|