@gaud_erp/paperclip-github-manager 1.7.0 → 1.7.2
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/dist/manifest.js +1 -1
- package/dist/manifest.js.map +1 -1
- package/dist/ui/index.js +126 -77
- package/dist/ui/index.js.map +4 -4
- package/dist/worker.js +12 -2
- package/dist/worker.js.map +3 -3
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -140,10 +140,54 @@ function GitHubRouteSidebar() {
|
|
|
140
140
|
}) });
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
// src/ui/components/NavBar.tsx
|
|
144
|
+
import { useHostNavigation as useHostNavigation2 } from "@paperclipai/plugin-sdk/ui";
|
|
145
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
146
|
+
var NAV_ITEMS2 = [
|
|
147
|
+
{ label: "Reposit\xF3rios", path: PATHS.repos },
|
|
148
|
+
{ label: "Pull Requests", path: PATHS.prs },
|
|
149
|
+
{ label: "Knowledge Graphs", path: PATHS.graphs },
|
|
150
|
+
{ label: "Configura\xE7\xF5es", path: PATHS.settings }
|
|
151
|
+
];
|
|
152
|
+
function GitHubNavBar() {
|
|
153
|
+
const nav = useHostNavigation2();
|
|
154
|
+
const currentPath = typeof window !== "undefined" ? window.location.pathname : "";
|
|
155
|
+
return /* @__PURE__ */ jsx2("nav", { style: {
|
|
156
|
+
display: "flex",
|
|
157
|
+
gap: "2px",
|
|
158
|
+
padding: "4px",
|
|
159
|
+
borderRadius: "8px",
|
|
160
|
+
background: "rgba(128,128,128,0.06)",
|
|
161
|
+
marginBottom: "4px"
|
|
162
|
+
}, children: NAV_ITEMS2.map((item) => {
|
|
163
|
+
const href = nav.resolveHref(item.path);
|
|
164
|
+
const isActive = currentPath.endsWith(item.path.replace("/", ""));
|
|
165
|
+
return /* @__PURE__ */ jsx2(
|
|
166
|
+
"a",
|
|
167
|
+
{
|
|
168
|
+
...nav.linkProps(item.path),
|
|
169
|
+
"aria-current": isActive ? "page" : void 0,
|
|
170
|
+
style: {
|
|
171
|
+
padding: "6px 14px",
|
|
172
|
+
borderRadius: "6px",
|
|
173
|
+
fontSize: "13px",
|
|
174
|
+
fontWeight: isActive ? 600 : 400,
|
|
175
|
+
background: isActive ? "rgba(128,128,128,0.12)" : "transparent",
|
|
176
|
+
textDecoration: "none",
|
|
177
|
+
color: "inherit",
|
|
178
|
+
cursor: "pointer"
|
|
179
|
+
},
|
|
180
|
+
children: item.label
|
|
181
|
+
},
|
|
182
|
+
item.path
|
|
183
|
+
);
|
|
184
|
+
}) });
|
|
185
|
+
}
|
|
186
|
+
|
|
143
187
|
// src/ui/components/SettingsPage.tsx
|
|
144
188
|
import { useState } from "react";
|
|
145
189
|
import { useHostContext, usePluginAction } from "@paperclipai/plugin-sdk/ui";
|
|
146
|
-
import { jsx as
|
|
190
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
147
191
|
function GitHubSettingsPage() {
|
|
148
192
|
const context = useHostContext();
|
|
149
193
|
const companyId = context.companyId;
|
|
@@ -157,7 +201,7 @@ function GitHubSettingsPage() {
|
|
|
157
201
|
const testConnection = usePluginAction("test-connection");
|
|
158
202
|
const addRepo = usePluginAction("add-repo");
|
|
159
203
|
const syncAll = usePluginAction("sync-all");
|
|
160
|
-
if (!companyId) return /* @__PURE__ */
|
|
204
|
+
if (!companyId) return /* @__PURE__ */ jsx3("div", { style: layoutStack, children: "Selecione uma empresa." });
|
|
161
205
|
const handleSaveToken = async () => {
|
|
162
206
|
if (!token.trim()) return;
|
|
163
207
|
setLoading(true);
|
|
@@ -220,12 +264,13 @@ function GitHubSettingsPage() {
|
|
|
220
264
|
setLoading(false);
|
|
221
265
|
};
|
|
222
266
|
return /* @__PURE__ */ jsxs2("div", { style: layoutStack, children: [
|
|
223
|
-
/* @__PURE__ */
|
|
224
|
-
|
|
267
|
+
/* @__PURE__ */ jsx3(GitHubNavBar, {}),
|
|
268
|
+
/* @__PURE__ */ jsx3("h2", { style: { margin: 0, fontSize: "18px" }, children: "Configura\xE7\xF5es GitHub" }),
|
|
269
|
+
status && /* @__PURE__ */ jsx3("div", { style: { ...cardStyle, fontSize: "13px", color: status.startsWith("Erro") ? "#ef4444" : "#22c55e" }, children: status }),
|
|
225
270
|
/* @__PURE__ */ jsxs2("div", { style: cardStyle, children: [
|
|
226
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 8px", fontSize: "14px" }, children: "Autentica\xE7\xE3o" }),
|
|
227
272
|
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "8px", marginBottom: "8px" }, children: [
|
|
228
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ jsx3(
|
|
229
274
|
"input",
|
|
230
275
|
{
|
|
231
276
|
type: "password",
|
|
@@ -235,10 +280,10 @@ function GitHubSettingsPage() {
|
|
|
235
280
|
style: { flex: 1, padding: "6px 10px", borderRadius: "6px", border: "1px solid rgba(128,128,128,0.3)", background: "transparent", fontSize: "13px" }
|
|
236
281
|
}
|
|
237
282
|
),
|
|
238
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ jsx3("button", { type: "button", style: buttonStyle, onClick: handleSaveToken, disabled: loading, children: "Salvar PAT" })
|
|
239
284
|
] }),
|
|
240
285
|
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "8px", marginBottom: "8px" }, children: [
|
|
241
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ jsx3(
|
|
242
287
|
"input",
|
|
243
288
|
{
|
|
244
289
|
placeholder: "UUID do secret (alternativa)",
|
|
@@ -247,14 +292,14 @@ function GitHubSettingsPage() {
|
|
|
247
292
|
style: { flex: 1, padding: "6px 10px", borderRadius: "6px", border: "1px solid rgba(128,128,128,0.3)", background: "transparent", fontSize: "13px" }
|
|
248
293
|
}
|
|
249
294
|
),
|
|
250
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ jsx3("button", { type: "button", style: buttonStyle, onClick: handleSaveSecretRef, disabled: loading, children: "Salvar Ref" })
|
|
251
296
|
] }),
|
|
252
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ jsx3("button", { type: "button", style: primaryButtonStyle, onClick: handleTestConnection, disabled: loading, children: "Testar Conex\xE3o" })
|
|
253
298
|
] }),
|
|
254
299
|
/* @__PURE__ */ jsxs2("div", { style: cardStyle, children: [
|
|
255
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 8px", fontSize: "14px" }, children: "Adicionar Reposit\xF3rio" }),
|
|
256
301
|
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
257
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ jsx3(
|
|
258
303
|
"input",
|
|
259
304
|
{
|
|
260
305
|
placeholder: "owner/repo (ex: gauderp/gaud-erp-api)",
|
|
@@ -263,35 +308,36 @@ function GitHubSettingsPage() {
|
|
|
263
308
|
style: { flex: 1, padding: "6px 10px", borderRadius: "6px", border: "1px solid rgba(128,128,128,0.3)", background: "transparent", fontSize: "13px" }
|
|
264
309
|
}
|
|
265
310
|
),
|
|
266
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ jsx3("button", { type: "button", style: primaryButtonStyle, onClick: handleAddRepo, disabled: loading, children: "Adicionar" })
|
|
267
312
|
] })
|
|
268
313
|
] }),
|
|
269
314
|
/* @__PURE__ */ jsxs2("div", { style: cardStyle, children: [
|
|
270
|
-
/* @__PURE__ */
|
|
271
|
-
/* @__PURE__ */
|
|
272
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ jsx3("h3", { style: { margin: "0 0 8px", fontSize: "14px" }, children: "Sincroniza\xE7\xE3o" }),
|
|
316
|
+
/* @__PURE__ */ jsx3("p", { style: { margin: "0 0 8px", fontSize: "12px", opacity: 0.7 }, children: "Sync autom\xE1tico a cada 5 minutos. Use o bot\xE3o abaixo para for\xE7ar um sync completo." }),
|
|
317
|
+
/* @__PURE__ */ jsx3("button", { type: "button", style: primaryButtonStyle, onClick: handleFullSync, disabled: loading, children: loading ? "Sincronizando..." : "Sync Completo" })
|
|
273
318
|
] })
|
|
274
319
|
] });
|
|
275
320
|
}
|
|
276
321
|
|
|
277
322
|
// src/ui/components/ReposPage.tsx
|
|
278
323
|
import { useState as useState2 } from "react";
|
|
279
|
-
import { useHostContext as useHostContext2, useHostNavigation as
|
|
280
|
-
import { jsx as
|
|
324
|
+
import { useHostContext as useHostContext2, useHostNavigation as useHostNavigation3, usePluginData as usePluginData2, usePluginAction as usePluginAction2 } from "@paperclipai/plugin-sdk/ui";
|
|
325
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
281
326
|
function GitHubReposPage() {
|
|
282
327
|
const context = useHostContext2();
|
|
283
328
|
const companyId = context.companyId;
|
|
284
329
|
const [filter, setFilter] = useState2("");
|
|
285
|
-
const nav =
|
|
330
|
+
const nav = useHostNavigation3();
|
|
286
331
|
const reposData = usePluginData2("repos", { companyId });
|
|
287
332
|
const syncAction = usePluginAction2("sync-all");
|
|
288
333
|
const generateGraph = usePluginAction2("generate-graph");
|
|
289
334
|
const [graphLoading, setGraphLoading] = useState2(null);
|
|
290
|
-
if (!companyId) return /* @__PURE__ */
|
|
335
|
+
if (!companyId) return /* @__PURE__ */ jsx4("div", { style: layoutStack, children: "Selecione uma empresa." });
|
|
291
336
|
const repos = (reposData.data?.repos ?? []).filter(
|
|
292
337
|
(r) => !filter || r.fullName.toLowerCase().includes(filter.toLowerCase())
|
|
293
338
|
);
|
|
294
339
|
return /* @__PURE__ */ jsxs3("div", { style: layoutStack, children: [
|
|
340
|
+
/* @__PURE__ */ jsx4(GitHubNavBar, {}),
|
|
295
341
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
296
342
|
/* @__PURE__ */ jsxs3("h2", { style: { margin: 0, fontSize: "18px" }, children: [
|
|
297
343
|
"Reposit\xF3rios (",
|
|
@@ -303,7 +349,7 @@ function GitHubReposPage() {
|
|
|
303
349
|
"\xDAltimo sync: ",
|
|
304
350
|
reposData.data?.lastSync ? timeAgo(reposData.data.lastSync) : "nunca"
|
|
305
351
|
] }),
|
|
306
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ jsx4(
|
|
307
353
|
"button",
|
|
308
354
|
{
|
|
309
355
|
type: "button",
|
|
@@ -314,7 +360,7 @@ function GitHubReposPage() {
|
|
|
314
360
|
)
|
|
315
361
|
] })
|
|
316
362
|
] }),
|
|
317
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ jsx4(
|
|
318
364
|
"input",
|
|
319
365
|
{
|
|
320
366
|
placeholder: "Filtrar reposit\xF3rios...",
|
|
@@ -323,15 +369,15 @@ function GitHubReposPage() {
|
|
|
323
369
|
style: { padding: "6px 10px", borderRadius: "6px", border: "1px solid rgba(128,128,128,0.3)", background: "transparent", fontSize: "13px" }
|
|
324
370
|
}
|
|
325
371
|
),
|
|
326
|
-
repos.length === 0 && /* @__PURE__ */
|
|
372
|
+
repos.length === 0 && /* @__PURE__ */ jsx4("div", { style: { ...cardStyle, textAlign: "center", opacity: 0.6 }, children: "Nenhum reposit\xF3rio rastreado. Adicione em Configura\xE7\xF5es." }),
|
|
327
373
|
repos.map((repo) => /* @__PURE__ */ jsxs3("div", { style: cardStyle, children: [
|
|
328
374
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
|
|
329
375
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
repo.private && /* @__PURE__ */
|
|
332
|
-
repo.description && /* @__PURE__ */
|
|
376
|
+
/* @__PURE__ */ jsx4("a", { href: repo.htmlUrl, target: "_blank", rel: "noopener", style: { fontWeight: 600, fontSize: "14px", color: "#3b82f6", textDecoration: "none" }, children: repo.fullName }),
|
|
377
|
+
repo.private && /* @__PURE__ */ jsx4("span", { style: { marginLeft: "8px", fontSize: "11px", opacity: 0.5 }, children: "privado" }),
|
|
378
|
+
repo.description && /* @__PURE__ */ jsx4("p", { style: { margin: "4px 0 0", fontSize: "12px", opacity: 0.7 }, children: repo.description })
|
|
333
379
|
] }),
|
|
334
|
-
/* @__PURE__ */
|
|
380
|
+
/* @__PURE__ */ jsx4("div", { style: { display: "flex", gap: "4px" }, children: /* @__PURE__ */ jsx4(
|
|
335
381
|
"button",
|
|
336
382
|
{
|
|
337
383
|
type: "button",
|
|
@@ -354,7 +400,7 @@ function GitHubReposPage() {
|
|
|
354
400
|
) })
|
|
355
401
|
] }),
|
|
356
402
|
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "16px", marginTop: "8px", fontSize: "11px", opacity: 0.5 }, children: [
|
|
357
|
-
repo.language && /* @__PURE__ */
|
|
403
|
+
repo.language && /* @__PURE__ */ jsx4("span", { children: repo.language }),
|
|
358
404
|
/* @__PURE__ */ jsxs3("span", { children: [
|
|
359
405
|
"branch: ",
|
|
360
406
|
repo.defaultBranch
|
|
@@ -371,7 +417,7 @@ function GitHubReposPage() {
|
|
|
371
417
|
// src/ui/components/PullRequestsPage.tsx
|
|
372
418
|
import { useState as useState3 } from "react";
|
|
373
419
|
import { useHostContext as useHostContext3, usePluginData as usePluginData3, usePluginAction as usePluginAction3 } from "@paperclipai/plugin-sdk/ui";
|
|
374
|
-
import { jsx as
|
|
420
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
375
421
|
function GitHubPullRequestsPage() {
|
|
376
422
|
const context = useHostContext3();
|
|
377
423
|
const companyId = context.companyId;
|
|
@@ -387,7 +433,7 @@ function GitHubPullRequestsPage() {
|
|
|
387
433
|
const syncAction = usePluginAction3("sync-all");
|
|
388
434
|
const requestReview = usePluginAction3("request-review");
|
|
389
435
|
const runQuickCheck = usePluginAction3("run-quick-check");
|
|
390
|
-
if (!companyId) return /* @__PURE__ */
|
|
436
|
+
if (!companyId) return /* @__PURE__ */ jsx5("div", { style: layoutStack, children: "Selecione uma empresa." });
|
|
391
437
|
const prs = (prsData.data?.pullRequests ?? []).filter(
|
|
392
438
|
(pr) => !search || pr.title.toLowerCase().includes(search.toLowerCase()) || pr.repoFullName.toLowerCase().includes(search.toLowerCase())
|
|
393
439
|
);
|
|
@@ -433,16 +479,17 @@ function GitHubPullRequestsPage() {
|
|
|
433
479
|
}
|
|
434
480
|
};
|
|
435
481
|
return /* @__PURE__ */ jsxs4("div", { style: layoutStack, children: [
|
|
482
|
+
/* @__PURE__ */ jsx5(GitHubNavBar, {}),
|
|
436
483
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
437
484
|
/* @__PURE__ */ jsxs4("h2", { style: { margin: 0, fontSize: "18px" }, children: [
|
|
438
485
|
"Pull Requests (",
|
|
439
486
|
prs.length,
|
|
440
487
|
")"
|
|
441
488
|
] }),
|
|
442
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ jsx5("button", { type: "button", style: buttonStyle, onClick: () => syncAction({ companyId }).catch(console.error), children: "Sync" })
|
|
443
490
|
] }),
|
|
444
491
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
|
|
445
|
-
["open", "closed", "merged", ""].map((state) => /* @__PURE__ */
|
|
492
|
+
["open", "closed", "merged", ""].map((state) => /* @__PURE__ */ jsx5(
|
|
446
493
|
"button",
|
|
447
494
|
{
|
|
448
495
|
type: "button",
|
|
@@ -456,7 +503,7 @@ function GitHubPullRequestsPage() {
|
|
|
456
503
|
},
|
|
457
504
|
state
|
|
458
505
|
)),
|
|
459
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ jsx5(
|
|
460
507
|
"input",
|
|
461
508
|
{
|
|
462
509
|
placeholder: "Buscar por t\xEDtulo ou repo...",
|
|
@@ -466,7 +513,7 @@ function GitHubPullRequestsPage() {
|
|
|
466
513
|
}
|
|
467
514
|
)
|
|
468
515
|
] }),
|
|
469
|
-
prs.length === 0 && /* @__PURE__ */
|
|
516
|
+
prs.length === 0 && /* @__PURE__ */ jsx5("div", { style: { ...cardStyle, textAlign: "center", opacity: 0.6 }, children: "Nenhum PR encontrado com os filtros atuais." }),
|
|
470
517
|
prs.map((pr) => {
|
|
471
518
|
const badge = prStateBadge(pr.draft ? "draft" : pr.state);
|
|
472
519
|
const status = reviewStatus[pr.id];
|
|
@@ -475,7 +522,7 @@ function GitHubPullRequestsPage() {
|
|
|
475
522
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
|
|
476
523
|
/* @__PURE__ */ jsxs4("div", { style: { flex: 1 }, children: [
|
|
477
524
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
|
|
478
|
-
/* @__PURE__ */
|
|
525
|
+
/* @__PURE__ */ jsx5("span", { style: badgeStyle(badge.color), children: badge.label }),
|
|
479
526
|
/* @__PURE__ */ jsxs4("a", { href: pr.htmlUrl, target: "_blank", rel: "noopener", style: { fontWeight: 600, fontSize: "14px", color: "#3b82f6", textDecoration: "none" }, children: [
|
|
480
527
|
"#",
|
|
481
528
|
pr.number,
|
|
@@ -496,7 +543,7 @@ function GitHubPullRequestsPage() {
|
|
|
496
543
|
] })
|
|
497
544
|
] }),
|
|
498
545
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "4px", flexShrink: 0 }, children: [
|
|
499
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ jsx5(
|
|
500
547
|
"button",
|
|
501
548
|
{
|
|
502
549
|
type: "button",
|
|
@@ -521,14 +568,14 @@ function GitHubPullRequestsPage() {
|
|
|
521
568
|
if (e.target.value) handleRequestReview(pr, e.target.value);
|
|
522
569
|
},
|
|
523
570
|
children: [
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
agents.map((agent) => /* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ jsx5("option", { value: "", disabled: true, children: "Agent Review" }),
|
|
572
|
+
agents.map((agent) => /* @__PURE__ */ jsx5("option", { value: agent.id, children: agent.displayName }, agent.id))
|
|
526
573
|
]
|
|
527
574
|
}
|
|
528
|
-
) : /* @__PURE__ */
|
|
575
|
+
) : /* @__PURE__ */ jsx5("button", { type: "button", style: primaryButtonStyle, disabled: true, title: "Nenhum agente dispon\xEDvel", children: "Agent Review" })
|
|
529
576
|
] })
|
|
530
577
|
] }),
|
|
531
|
-
status && /* @__PURE__ */
|
|
578
|
+
status && /* @__PURE__ */ jsx5("div", { style: { marginTop: "6px", padding: "4px 8px", borderRadius: "4px", background: "rgba(128,128,128,0.08)", fontSize: "11px" }, children: status })
|
|
532
579
|
] }, pr.id);
|
|
533
580
|
})
|
|
534
581
|
] });
|
|
@@ -537,7 +584,7 @@ function GitHubPullRequestsPage() {
|
|
|
537
584
|
// src/ui/components/GraphsPage.tsx
|
|
538
585
|
import { useState as useState4, useEffect } from "react";
|
|
539
586
|
import { useHostContext as useHostContext4, usePluginAction as usePluginAction4 } from "@paperclipai/plugin-sdk/ui";
|
|
540
|
-
import { jsx as
|
|
587
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
541
588
|
function toObsidianCanvas(graph) {
|
|
542
589
|
const CARD_W = 250;
|
|
543
590
|
const CARD_H = 60;
|
|
@@ -613,7 +660,7 @@ function GitHubGraphsPage() {
|
|
|
613
660
|
generateGraph({ companyId, repoFullName: repo, level: "code" }).then((result) => setGraphData(result)).catch(console.error).finally(() => setLoading(false));
|
|
614
661
|
}
|
|
615
662
|
}, [companyId, autoLoaded]);
|
|
616
|
-
if (!companyId) return /* @__PURE__ */
|
|
663
|
+
if (!companyId) return /* @__PURE__ */ jsx6("div", { style: layoutStack, children: "Selecione uma empresa." });
|
|
617
664
|
const handleGenerateHighLevel = async () => {
|
|
618
665
|
setLoading(true);
|
|
619
666
|
try {
|
|
@@ -642,11 +689,12 @@ function GitHubGraphsPage() {
|
|
|
642
689
|
downloadFile(`${name}.canvas`, canvas);
|
|
643
690
|
};
|
|
644
691
|
return /* @__PURE__ */ jsxs5("div", { style: layoutStack, children: [
|
|
645
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ jsx6(GitHubNavBar, {}),
|
|
693
|
+
/* @__PURE__ */ jsx6("h2", { style: { margin: 0, fontSize: "18px" }, children: "Knowledge Graphs" }),
|
|
646
694
|
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: [
|
|
647
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ jsx6("button", { type: "button", style: primaryButtonStyle, onClick: handleGenerateHighLevel, disabled: loading, children: loading ? "Gerando..." : "Grafo de Alto N\xEDvel" }),
|
|
648
696
|
/* @__PURE__ */ jsxs5("div", { style: { display: "flex", gap: "4px", flex: 1 }, children: [
|
|
649
|
-
/* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ jsx6(
|
|
650
698
|
"input",
|
|
651
699
|
{
|
|
652
700
|
placeholder: "owner/repo para drill-down...",
|
|
@@ -655,13 +703,13 @@ function GitHubGraphsPage() {
|
|
|
655
703
|
style: { flex: 1, padding: "6px 10px", borderRadius: "6px", border: "1px solid rgba(128,128,128,0.3)", background: "transparent", fontSize: "13px" }
|
|
656
704
|
}
|
|
657
705
|
),
|
|
658
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ jsx6("button", { type: "button", style: buttonStyle, onClick: handleGenerateCode, disabled: loading || !repoInput.trim(), children: "Grafo de C\xF3digo" })
|
|
659
707
|
] })
|
|
660
708
|
] }),
|
|
661
709
|
graphData && /* @__PURE__ */ jsxs5("div", { style: cardStyle, children: [
|
|
662
710
|
/* @__PURE__ */ jsxs5("div", { style: { marginBottom: "8px", fontSize: "13px", display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
663
711
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
664
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx6("strong", { children: graphData.level === "high" ? "Vis\xE3o Geral" : graphData.repoFullName }),
|
|
665
713
|
/* @__PURE__ */ jsxs5("span", { style: { marginLeft: "8px", fontSize: "11px", opacity: 0.5 }, children: [
|
|
666
714
|
graphData.nodes.length,
|
|
667
715
|
" n\xF3s \xB7 ",
|
|
@@ -670,11 +718,11 @@ function GitHubGraphsPage() {
|
|
|
670
718
|
new Date(graphData.generatedAt).toLocaleString()
|
|
671
719
|
] })
|
|
672
720
|
] }),
|
|
673
|
-
/* @__PURE__ */
|
|
721
|
+
/* @__PURE__ */ jsx6("button", { type: "button", style: primaryButtonStyle, onClick: handleExportObsidian, children: "Abrir no Obsidian" })
|
|
674
722
|
] }),
|
|
675
723
|
/* @__PURE__ */ jsxs5("div", { style: { maxHeight: "400px", overflow: "auto", fontSize: "12px" }, children: [
|
|
676
724
|
/* @__PURE__ */ jsxs5("div", { style: { marginBottom: "8px" }, children: [
|
|
677
|
-
/* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ jsx6("strong", { children: "N\xF3s:" }),
|
|
678
726
|
graphData.nodes.map((node) => /* @__PURE__ */ jsxs5("div", { style: { padding: "2px 0", paddingLeft: "12px" }, children: [
|
|
679
727
|
/* @__PURE__ */ jsxs5("span", { style: { opacity: 0.5 }, children: [
|
|
680
728
|
"[",
|
|
@@ -686,7 +734,7 @@ function GitHubGraphsPage() {
|
|
|
686
734
|
] }, node.id))
|
|
687
735
|
] }),
|
|
688
736
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
689
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsx6("strong", { children: "Arestas:" }),
|
|
690
738
|
graphData.edges.map((edge, i) => /* @__PURE__ */ jsxs5("div", { style: { padding: "2px 0", paddingLeft: "12px" }, children: [
|
|
691
739
|
edge.source,
|
|
692
740
|
" \u2192 ",
|
|
@@ -701,7 +749,7 @@ function GitHubGraphsPage() {
|
|
|
701
749
|
] })
|
|
702
750
|
] })
|
|
703
751
|
] }),
|
|
704
|
-
!graphData && !loading && /* @__PURE__ */
|
|
752
|
+
!graphData && !loading && /* @__PURE__ */ jsx6("div", { style: { ...cardStyle, textAlign: "center", opacity: 0.5 }, children: "Clique em um dos bot\xF5es acima para gerar um knowledge graph." })
|
|
705
753
|
] });
|
|
706
754
|
}
|
|
707
755
|
|
|
@@ -712,7 +760,7 @@ import { usePluginData as usePluginData5, usePluginAction as usePluginAction6 }
|
|
|
712
760
|
// src/ui/components/ReviewDropdown.tsx
|
|
713
761
|
import { useState as useState5 } from "react";
|
|
714
762
|
import { usePluginData as usePluginData4, usePluginAction as usePluginAction5 } from "@paperclipai/plugin-sdk/ui";
|
|
715
|
-
import { jsx as
|
|
763
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
716
764
|
function ReviewDropdown({ companyId, prId, repoFullName, prNumber }) {
|
|
717
765
|
const [open, setOpen] = useState5(false);
|
|
718
766
|
const [reviewing, setReviewing] = useState5(false);
|
|
@@ -730,10 +778,10 @@ function ReviewDropdown({ companyId, prId, repoFullName, prNumber }) {
|
|
|
730
778
|
setReviewing(false);
|
|
731
779
|
};
|
|
732
780
|
if (reviewing) {
|
|
733
|
-
return /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ jsx7("span", { style: { fontSize: "12px", opacity: 0.6 }, children: "Revisando..." });
|
|
734
782
|
}
|
|
735
783
|
return /* @__PURE__ */ jsxs6("div", { style: { position: "relative", display: "inline-block" }, children: [
|
|
736
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ jsx7("button", { type: "button", style: primaryButtonStyle, onClick: () => setOpen(!open), children: "Revisar \u25BE" }),
|
|
737
785
|
open && /* @__PURE__ */ jsxs6("div", { style: {
|
|
738
786
|
position: "absolute",
|
|
739
787
|
top: "100%",
|
|
@@ -747,7 +795,7 @@ function ReviewDropdown({ companyId, prId, repoFullName, prNumber }) {
|
|
|
747
795
|
zIndex: 10,
|
|
748
796
|
boxShadow: "0 4px 12px rgba(0,0,0,0.3)"
|
|
749
797
|
}, children: [
|
|
750
|
-
agents.length === 0 && /* @__PURE__ */
|
|
798
|
+
agents.length === 0 && /* @__PURE__ */ jsx7("div", { style: { padding: "8px", fontSize: "12px", opacity: 0.5 }, children: "Nenhum agente dispon\xEDvel" }),
|
|
751
799
|
agents.map((agent) => /* @__PURE__ */ jsxs6(
|
|
752
800
|
"button",
|
|
753
801
|
{
|
|
@@ -755,8 +803,8 @@ function ReviewDropdown({ companyId, prId, repoFullName, prNumber }) {
|
|
|
755
803
|
style: { ...buttonStyle, width: "100%", textAlign: "left", border: "none", borderRadius: "4px" },
|
|
756
804
|
onClick: () => handleReview(agent.id),
|
|
757
805
|
children: [
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
806
|
+
/* @__PURE__ */ jsx7("div", { style: { fontWeight: 500 }, children: agent.displayName }),
|
|
807
|
+
/* @__PURE__ */ jsx7("div", { style: { fontSize: "11px", opacity: 0.5 }, children: agent.role })
|
|
760
808
|
]
|
|
761
809
|
},
|
|
762
810
|
agent.id
|
|
@@ -766,7 +814,7 @@ function ReviewDropdown({ companyId, prId, repoFullName, prNumber }) {
|
|
|
766
814
|
}
|
|
767
815
|
|
|
768
816
|
// src/ui/components/DetailTab.tsx
|
|
769
|
-
import { Fragment, jsx as
|
|
817
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
770
818
|
function GitHubDetailTab({ context }) {
|
|
771
819
|
const issueId = context.entityId;
|
|
772
820
|
const companyId = context.companyId;
|
|
@@ -783,7 +831,7 @@ function GitHubDetailTab({ context }) {
|
|
|
783
831
|
const linkAction = usePluginAction6("link-pr-to-card");
|
|
784
832
|
const quickCheck = usePluginAction6("run-quick-check");
|
|
785
833
|
if (!companyId || !issueId) {
|
|
786
|
-
return /* @__PURE__ */
|
|
834
|
+
return /* @__PURE__ */ jsx8("div", { style: { padding: "12px", fontSize: "13px", opacity: 0.5 }, children: "Sem contexto dispon\xEDvel." });
|
|
787
835
|
}
|
|
788
836
|
const prs = cardPRs.data?.pullRequests ?? [];
|
|
789
837
|
const handleLink = async () => {
|
|
@@ -794,15 +842,15 @@ function GitHubDetailTab({ context }) {
|
|
|
794
842
|
};
|
|
795
843
|
return /* @__PURE__ */ jsxs7("div", { style: { display: "flex", flexDirection: "column", gap: "8px", padding: "12px" }, children: [
|
|
796
844
|
prs.length === 0 ? /* @__PURE__ */ jsxs7("div", { style: { textAlign: "center", padding: "20px 0" }, children: [
|
|
797
|
-
/* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ jsx8("p", { style: { fontSize: "13px", opacity: 0.5, margin: "0 0 12px" }, children: "Nenhum PR vinculado a este card." }),
|
|
846
|
+
/* @__PURE__ */ jsx8("button", { type: "button", style: buttonStyle, onClick: () => setShowLinkInput(true), children: "Vincular PR" })
|
|
799
847
|
] }) : /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
800
848
|
prs.map((pr) => {
|
|
801
849
|
const badge = prStateBadge(pr.draft ? "draft" : pr.state);
|
|
802
|
-
return /* @__PURE__ */
|
|
850
|
+
return /* @__PURE__ */ jsx8("div", { style: cardStyle, children: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [
|
|
803
851
|
/* @__PURE__ */ jsxs7("div", { style: { flex: 1 }, children: [
|
|
804
852
|
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
|
|
805
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx8("span", { style: badgeStyle(badge.color), children: badge.label }),
|
|
806
854
|
/* @__PURE__ */ jsxs7("a", { href: pr.htmlUrl, target: "_blank", rel: "noopener", style: { fontWeight: 600, fontSize: "13px", color: "#3b82f6", textDecoration: "none" }, children: [
|
|
807
855
|
"#",
|
|
808
856
|
pr.number,
|
|
@@ -822,7 +870,7 @@ function GitHubDetailTab({ context }) {
|
|
|
822
870
|
timeAgo(pr.updatedAt)
|
|
823
871
|
] })
|
|
824
872
|
] }),
|
|
825
|
-
/* @__PURE__ */
|
|
873
|
+
/* @__PURE__ */ jsx8(
|
|
826
874
|
ReviewDropdown,
|
|
827
875
|
{
|
|
828
876
|
companyId,
|
|
@@ -833,10 +881,10 @@ function GitHubDetailTab({ context }) {
|
|
|
833
881
|
)
|
|
834
882
|
] }) }, pr.id);
|
|
835
883
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ jsx8("button", { type: "button", style: { ...buttonStyle, alignSelf: "flex-start", fontSize: "12px" }, onClick: () => setShowLinkInput(true), children: "+ Vincular outro PR" })
|
|
837
885
|
] }),
|
|
838
886
|
showLinkInput && /* @__PURE__ */ jsxs7("div", { style: cardStyle, children: [
|
|
839
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ jsx8("div", { style: { fontSize: "13px", fontWeight: 500, marginBottom: "8px" }, children: "Selecionar PR" }),
|
|
840
888
|
/* @__PURE__ */ jsxs7(
|
|
841
889
|
"select",
|
|
842
890
|
{
|
|
@@ -844,7 +892,7 @@ function GitHubDetailTab({ context }) {
|
|
|
844
892
|
onChange: (e) => setSelectedPrId(Number(e.target.value)),
|
|
845
893
|
value: selectedPrId ?? "",
|
|
846
894
|
children: [
|
|
847
|
-
/* @__PURE__ */
|
|
895
|
+
/* @__PURE__ */ jsx8("option", { value: "", children: "Selecione um PR..." }),
|
|
848
896
|
(allPRs.data?.pullRequests ?? []).map((pr) => /* @__PURE__ */ jsxs7("option", { value: pr.id, children: [
|
|
849
897
|
pr.repoFullName,
|
|
850
898
|
" #",
|
|
@@ -856,26 +904,26 @@ function GitHubDetailTab({ context }) {
|
|
|
856
904
|
}
|
|
857
905
|
),
|
|
858
906
|
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", gap: "8px" }, children: [
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ jsx8("button", { type: "button", style: buttonStyle, onClick: handleLink, disabled: !selectedPrId, children: "Vincular" }),
|
|
908
|
+
/* @__PURE__ */ jsx8("button", { type: "button", style: buttonStyle, onClick: () => setShowLinkInput(false), children: "Cancelar" })
|
|
861
909
|
] })
|
|
862
910
|
] })
|
|
863
911
|
] });
|
|
864
912
|
}
|
|
865
913
|
|
|
866
914
|
// src/ui/components/DashboardWidget.tsx
|
|
867
|
-
import { useHostNavigation as
|
|
868
|
-
import { jsx as
|
|
915
|
+
import { useHostNavigation as useHostNavigation4, usePluginData as usePluginData6 } from "@paperclipai/plugin-sdk/ui";
|
|
916
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
869
917
|
function GitHubDashboardWidget({ context }) {
|
|
870
|
-
const nav =
|
|
918
|
+
const nav = useHostNavigation4();
|
|
871
919
|
const syncStatus = usePluginData6("sync-status", {
|
|
872
920
|
companyId: context.companyId
|
|
873
921
|
});
|
|
874
922
|
const data = syncStatus.data;
|
|
875
923
|
return /* @__PURE__ */ jsxs8("div", { style: { display: "flex", flexDirection: "column", gap: "6px", fontSize: "12px" }, children: [
|
|
876
924
|
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ jsx9("strong", { style: { fontSize: "13px" }, children: "GitHub" }),
|
|
926
|
+
/* @__PURE__ */ jsx9("span", { style: {
|
|
879
927
|
display: "inline-block",
|
|
880
928
|
width: "8px",
|
|
881
929
|
height: "8px",
|
|
@@ -897,13 +945,13 @@ function GitHubDashboardWidget({ context }) {
|
|
|
897
945
|
data?.lastSync ? timeAgo(data.lastSync) : "nunca"
|
|
898
946
|
] })
|
|
899
947
|
] }),
|
|
900
|
-
/* @__PURE__ */
|
|
948
|
+
/* @__PURE__ */ jsx9("a", { ...nav.linkProps(PATHS.prs), style: { fontSize: "12px", color: "#3b82f6" }, children: "Ver Pull Requests \u2192" })
|
|
901
949
|
] });
|
|
902
950
|
}
|
|
903
951
|
|
|
904
952
|
// src/ui/components/ContextMenu.tsx
|
|
905
953
|
import { useHostContext as useHostContext5, usePluginAction as usePluginAction7 } from "@paperclipai/plugin-sdk/ui";
|
|
906
|
-
import { jsx as
|
|
954
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
907
955
|
function GitHubContextMenu() {
|
|
908
956
|
const context = useHostContext5();
|
|
909
957
|
const generateGraph = usePluginAction7("generate-graph");
|
|
@@ -914,13 +962,14 @@ function GitHubContextMenu() {
|
|
|
914
962
|
level: "high"
|
|
915
963
|
}).catch(console.error);
|
|
916
964
|
};
|
|
917
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ jsx10("button", { type: "button", style: buttonStyle, onClick: handleGraphify, children: "Gerar Knowledge Graph" });
|
|
918
966
|
}
|
|
919
967
|
export {
|
|
920
968
|
GitHubContextMenu,
|
|
921
969
|
GitHubDashboardWidget,
|
|
922
970
|
GitHubDetailTab,
|
|
923
971
|
GitHubGraphsPage,
|
|
972
|
+
GitHubNavBar,
|
|
924
973
|
GitHubPullRequestsPage,
|
|
925
974
|
GitHubReposPage,
|
|
926
975
|
GitHubRouteSidebar,
|