gpt-engineer-app[bot] commited on
Commit
052c05a
Β·
1 Parent(s): 97a1f05
Files changed (1) hide show
  1. src/routes/dashboard.branch-debug.tsx +66 -27
src/routes/dashboard.branch-debug.tsx CHANGED
@@ -405,53 +405,92 @@ function CliView() {
405
  </div>
406
  );
407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  return (
409
  <div className="flex-1 overflow-y-auto p-8">
410
- <div className="max-w-3xl mx-auto space-y-6">
411
  <div>
412
  <h2 className="text-xl font-semibold flex items-center gap-2">
413
  <FileCode className="h-5 w-5 text-primary" /> Run Branch Debug from VS Code
414
  </h2>
415
  <p className="text-sm text-muted-foreground mt-1">
416
- One command in your VS Code terminal collects your current branch's diff, sends it through the IP Shield, and prints clickable jump links to the exact lines.
417
  </p>
418
  </div>
419
 
420
- <section className="space-y-2">
421
- <h3 className="text-xs font-mono uppercase tracking-widest text-muted-foreground">1 β€” Download the helper (once)</h3>
422
- <Block cmd={install} />
423
- </section>
 
 
 
 
 
 
 
 
 
 
424
 
425
- <section className="space-y-2">
426
- <h3 className="text-xs font-mono uppercase tracking-widest text-muted-foreground">2 β€” Describe the failure & run</h3>
427
- <Block cmd={run} />
428
- <p className="text-xs text-muted-foreground">
429
- Auto-detects your repo root + branch. Diffs against <code className="text-primary">origin/main</code> by default.
430
- </p>
431
- </section>
 
 
432
 
433
- <section className="space-y-2">
434
- <h3 className="text-xs font-mono uppercase tracking-widest text-muted-foreground">3 β€” Click suspects β†’ opens in your editor</h3>
435
- <div className="rounded-lg border border-border bg-surface/30 p-4 font-mono text-xs space-y-1.5">
436
- <div className="text-muted-foreground">Summary</div>
437
- <div className="pl-2 text-foreground">Threshold change excludes valid 15-digit Amex card numbers.</div>
438
- <div className="mt-3 text-severity-critical font-bold">[1] HIGH payments/AmexValidator.py:42-47 <span className="text-muted-foreground font-normal">(validate_card)</span></div>
439
- <div className="pl-4 text-foreground">Threshold change 15β†’16</div>
440
- <div className="pl-4 text-muted-foreground">Excludes valid 15-digit Amex card_numbers</div>
441
- <div className="pl-4 text-blue-400 underline">vscode://file/{`{repoRoot}`}/payments/AmexValidator.py:42 <span className="text-muted-foreground no-underline">← ⌘-click to open</span></div>
 
 
 
 
442
  </div>
443
  </section>
444
 
445
- <section className="space-y-2">
446
- <h3 className="text-xs font-mono uppercase tracking-widest text-muted-foreground">Options</h3>
447
- <Block cmd={runCursor} />
448
- <Block cmd={runBase} />
 
 
 
 
 
 
 
 
 
449
  </section>
450
 
451
  <div className="rounded-lg border border-primary/30 bg-primary/5 p-4 text-xs text-muted-foreground flex gap-3">
452
  <Shield className="h-4 w-4 text-primary shrink-0 mt-0.5" />
453
  <div>
454
- Your diff passes through the same IP Shield as the web Analyzer β€” identifiers tokenized, comments stripped, secrets blocked β€” before any AI sees it. Real file paths and line numbers are restored locally.
455
  </div>
456
  </div>
457
  </div>
 
405
  </div>
406
  );
407
 
408
+ const downloadExtension = () => {
409
+ fetch("/branchdebug-vscode-extension.zip")
410
+ .then((res) => { if (!res.ok) throw new Error(`Download failed: ${res.status}`); return res.blob(); })
411
+ .then((blob) => {
412
+ const a = document.createElement("a");
413
+ a.href = URL.createObjectURL(blob);
414
+ a.download = "branchdebug-vscode-extension.zip";
415
+ a.click();
416
+ URL.revokeObjectURL(a.href);
417
+ toast.success("Extension downloaded");
418
+ })
419
+ .catch((err) => toast.error(err.message));
420
+ };
421
+
422
  return (
423
  <div className="flex-1 overflow-y-auto p-8">
424
+ <div className="max-w-3xl mx-auto space-y-8">
425
  <div>
426
  <h2 className="text-xl font-semibold flex items-center gap-2">
427
  <FileCode className="h-5 w-5 text-primary" /> Run Branch Debug from VS Code
428
  </h2>
429
  <p className="text-sm text-muted-foreground mt-1">
430
+ Two ways to connect your editor: install the official VS Code extension, or use the lightweight terminal helper.
431
  </p>
432
  </div>
433
 
434
+ {/* Option A: Extension */}
435
+ <section className="rounded-xl border border-primary/40 bg-primary/5 p-6 space-y-4">
436
+ <div className="flex items-start justify-between gap-4">
437
+ <div>
438
+ <div className="text-[10px] uppercase tracking-widest text-primary font-mono">Recommended</div>
439
+ <h3 className="text-lg font-semibold mt-0.5">BranchDebug VS Code Extension</h3>
440
+ <p className="text-sm text-muted-foreground mt-1 max-w-xl">
441
+ Sidebar panel, inline highlights, and one-click navigation to every suspect line. Works with VS Code, Cursor, and other Code-based editors.
442
+ </p>
443
+ </div>
444
+ <Button onClick={downloadExtension} className="shrink-0">
445
+ <ExternalLink className="h-4 w-4 mr-2" /> Download .zip
446
+ </Button>
447
+ </div>
448
 
449
+ <div className="rounded-lg bg-[#0a0e15] border border-border p-4 text-xs text-foreground space-y-2">
450
+ <div className="text-[10px] uppercase tracking-widest text-muted-foreground font-mono">Install (unpacked)</div>
451
+ <ol className="list-decimal list-inside space-y-1 text-muted-foreground">
452
+ <li>Unzip the downloaded file.</li>
453
+ <li>In VS Code / Cursor, open the unzipped folder and run <code className="text-primary">npm install &amp;&amp; npm run compile</code>.</li>
454
+ <li>Press <code className="text-primary">F5</code> to launch an Extension Development Host, or run <code className="text-primary">vsce package</code> and install the resulting <code className="text-primary">.vsix</code>.</li>
455
+ <li>Open the BranchDebug sidebar β†’ set <code className="text-primary">serverUrl</code> to <code className="text-primary">{endpoint.replace("/api/public/branch-debug", "")}</code>.</li>
456
+ </ol>
457
+ </div>
458
 
459
+ <div className="grid sm:grid-cols-3 gap-2 text-[11px]">
460
+ <div className="rounded-md bg-surface/50 border border-border p-2">
461
+ <div className="font-mono text-primary">branchdebug.analyzeCurrentBranch</div>
462
+ <div className="text-muted-foreground mt-0.5">Run analysis on your current branch.</div>
463
+ </div>
464
+ <div className="rounded-md bg-surface/50 border border-border p-2">
465
+ <div className="font-mono text-primary">URI handler</div>
466
+ <div className="text-muted-foreground mt-0.5">Opens <code>branchdebug://</code> deep links.</div>
467
+ </div>
468
+ <div className="rounded-md bg-surface/50 border border-border p-2">
469
+ <div className="font-mono text-primary">Inline highlights</div>
470
+ <div className="text-muted-foreground mt-0.5">Suspect lines decorated in the editor.</div>
471
+ </div>
472
  </div>
473
  </section>
474
 
475
+ {/* Option B: CLI */}
476
+ <section className="space-y-3">
477
+ <div>
478
+ <div className="text-[10px] uppercase tracking-widest text-muted-foreground font-mono">Alternative</div>
479
+ <h3 className="text-base font-semibold mt-0.5">Terminal helper (no install)</h3>
480
+ <p className="text-xs text-muted-foreground mt-0.5">For CI, headless servers, or when you don't want an extension.</p>
481
+ </div>
482
+ <Block cmd={install} />
483
+ <Block cmd={run} />
484
+ <div className="grid sm:grid-cols-2 gap-2">
485
+ <Block cmd={runCursor} />
486
+ <Block cmd={runBase} />
487
+ </div>
488
  </section>
489
 
490
  <div className="rounded-lg border border-primary/30 bg-primary/5 p-4 text-xs text-muted-foreground flex gap-3">
491
  <Shield className="h-4 w-4 text-primary shrink-0 mt-0.5" />
492
  <div>
493
+ Both paths send your diff through the same IP Shield β€” identifiers tokenized, comments stripped, secrets blocked β€” before any AI sees it. Real file paths and line numbers are restored locally.
494
  </div>
495
  </div>
496
  </div>