deslop 0.2.0

A static analyzer that spots low-context and AI-assisted code patterns across naming, concurrency, security, performance, and test quality.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
import {
  cliCommands,
  commonRules,
  goEcosystemSupport,
  githubActionInputs,
  githubActionBenchExample,
  githubActionJsonExample,
  githubActionWorkflow,
  goRules,
  languages,
  limitations,
  overviewContent,
  pipelineStages,
  pythonRules,
  repositoryConfigExample,
  rustRules,
  sections,
  type Language,
  type SectionId,
} from '../docs-content'
import { currentRelease } from '../../../content/site-content'
import { CodeBlock } from './CodeBlock'

interface DocsLayoutProps {
  activeLang: Language
  activeSection: SectionId
  onLangChange: (lang: Language) => void
  onSectionChange: (section: SectionId) => void
}

export function DocsLayout({
  activeLang,
  activeSection,
  onLangChange,
  onSectionChange,
}: DocsLayoutProps) {

  const langClass = `lang-${activeLang}`
  const overview = overviewContent[activeLang]
  const rules = activeLang === 'common' ? commonRules : activeLang === 'go' ? goRules : activeLang === 'python' ? pythonRules : rustRules
  const commands = cliCommands[activeLang]
  const limits = limitations[activeLang]

  const handleLangChange = (lang: Language) => {
    onLangChange(lang)
    onSectionChange('overview')
  }

  const setActiveSection = onSectionChange

  const ruleCounts: Record<Language, number> = {
    go: goRules.length,
    python: pythonRules.length,
    rust: rustRules.length,
    common: commonRules.length,
  }

  return (
    <div className="docs-layout">
      {/* ── Sidebar ─────────────────────────────────────────────────────── */}
      <aside className="docs-sidebar">
        {/* Language tabs */}
        <p className="docs-sidebar-section-label" style={{ marginTop: 0 }}>Language</p>
        <div className="docs-lang-tabs">
          {languages.map((lang) => (
            <button
              key={lang.id}
              className={`docs-lang-tab lang-${lang.id}${activeLang === lang.id ? ' active' : ''}`}
              onClick={() => handleLangChange(lang.id)}
              type="button"
            >
              <span className="docs-lang-tab-dot" />
              <span className="docs-lang-tab-label">{lang.label}</span>
              <span className="docs-lang-tab-count">{ruleCounts[lang.id]}</span>
            </button>
          ))}
        </div>

        {/* Section navigation */}
        <p className="docs-sidebar-section-label">Sections</p>
        {sections.map((section) => (
          <button
            key={section.id}
            className={`docs-nav-item${activeSection === section.id ? ` active ${langClass}` : ''}`}
            onClick={() => setActiveSection(section.id)}
            type="button"
          >
            <span style={{ fontSize: '0.75rem', opacity: 0.65 }}>{section.icon}</span>
            {section.label}
          </button>
        ))}

        {/* Language note */}
        <div style={{ margin: '2rem 1.25rem 0', borderTop: '1px solid var(--border)', paddingTop: '1.25rem' }}>
          <p style={{ fontSize: '0.75rem', lineHeight: 1.6, color: 'var(--muted)', margin: 0 }}>
            Showing documentation for{' '}
            <span style={{ color: `var(--lang-${activeLang})`, fontFamily: 'var(--mono-font)', fontWeight: 600 }}>
              {activeLang}
            </span>
            . Switch the tab above to view another language.
          </p>
        </div>
      </aside>

      {/* ── Main content ─────────────────────────────────────────────────── */}
      <main className="docs-content">

        {/* OVERVIEW */}
        <div className={`docs-section${activeSection === 'overview' ? ' active' : ''}`}>
          <div className={`docs-eyebrow ${langClass}`}>{overview.title}</div>
          <h1 className="docs-h1">
            {activeLang === 'go' && 'Static analysis for Go repositories.'}
            {activeLang === 'python' && 'Static analysis for Python repositories.'}
            {activeLang === 'rust' && 'Static analysis for Rust repositories.'}
            {activeLang === 'common' && 'Shared heuristics for all supported languages.'}
          </h1>
          <p className="docs-lead">{overview.lead}</p>

          <h2 className="docs-h2">What deslop does</h2>
          <p className="docs-p">
            deslop is a Rust-based static analyzer that looks for signals commonly associated with low-context or AI-generated code.
            It is intentionally conservative: findings are heuristics, not compile-time proof. The goal is to surface suspicious
            patterns quickly, explain why they were flagged, and let a reviewer decide whether the code is actually a problem.
          </p>

          <div className="docs-callout" style={{ borderLeftColor: `var(--lang-${activeLang})`, background: `var(--lang-${activeLang}-soft)` }}>
            <p>
              deslop auto-detects supported source files. The same command works for {overview.title.replace(' Analysis', '')}-only
              repositories and mixed-language repositories containing Go, Python, and Rust files.
            </p>
          </div>

          <h2 className="docs-h2">Pipeline properties</h2>
          <div className="docs-pill-list">
            {overview.bullets.map((bullet) => (
              <span key={bullet} className="docs-pill">{bullet}</span>
            ))}
          </div>

          {activeLang === 'go' && (
            <>
              <h2 className="docs-h2">Third-party coverage</h2>
              <p className="docs-p">
                Go support includes dedicated heuristics for common server and infrastructure stacks without turning the overview into a wall of text.
              </p>
              <div className="docs-pill-list">
                {goEcosystemSupport.map((item) => (
                  <span key={item} className="docs-pill">{item}</span>
                ))}
              </div>
            </>
          )}

          <h2 className="docs-h2">Installation</h2>
          <p className="docs-p">Install the CLI from crates.io using Cargo:</p>
          <CodeBlock code="cargo install deslop" />
          <p className="docs-p">Or download prebuilt binaries from the GitHub release page:</p>
          <div className="docs-download-grid">
            {currentRelease.assets.map((asset) => (
              <a
                key={asset.id}
                className="docs-download-card"
                href={asset.url}
                target="_blank"
                rel="noreferrer"
              >
                <span className="docs-download-label">{asset.label}</span>
                <span className="docs-download-file">{asset.fileName}</span>
              </a>
            ))}
          </div>
          <p className="docs-p">
            Release overview:{' '}
            <a className="docs-link" href={currentRelease.releasePage} target="_blank" rel="noreferrer">
              {currentRelease.releasePage}
            </a>
          </p>
          <p className="docs-p">Or use the composite GitHub Action which downloads the correct binary for your runner automatically.</p>

          <h2 className="docs-h2">GitHub Actions</h2>
          <p className="docs-p">Scan the checked-out repository with defaults:</p>
          <CodeBlock code={githubActionWorkflow} />
          <p className="docs-p">Emit JSON, include per-function fingerprints, and keep the workflow green while you evaluate the report:</p>
          <CodeBlock code={githubActionJsonExample} />
          <p className="docs-p">Run benchmark mode instead of a scan:</p>
          <CodeBlock code={githubActionBenchExample} />

          <h3 className="docs-h3">Action inputs</h3>
          <table className="cli-table">
            <colgroup>
              <col className="cli-col-command" />
              <col className="cli-col-description" />
            </colgroup>
            <thead>
              <tr>
                <th>Input</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              {githubActionInputs.map((input) => (
                <tr key={input.name}>
                  <td>{input.name}</td>
                  <td>{input.description}</td>
                </tr>
              ))}
            </tbody>
          </table>
        </div>

        {/* DETECTION RULES */}
        <div className={`docs-section${activeSection === 'detection-rules' ? ' active' : ''}`}>
          <div className={`docs-eyebrow ${langClass}`}>Detection rules</div>
          <h1 className="docs-h1">
            {activeLang === 'common'
              ? `${rules.length} generic rules.`
              : `${rules.length} rules for ${activeLang === 'go' ? 'Go' : activeLang === 'python' ? 'Python' : 'Rust'}.`}
          </h1>
          <p className="docs-lead">
            Each rule produces a finding with a rule ID, severity, file path, line number, and human-readable evidence.
            Findings are heuristics, not compile-time proof. deslop is conservative where full type information is missing.
          </p>

          <div className="docs-callout" style={{ borderLeftColor: `var(--lang-${activeLang})`, background: `var(--lang-${activeLang}-soft)` }}>
            <p>
              By default, <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>deslop scan</code> prints the standard finding set.
              Pass <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>--details</code> when you want the per-function fingerprint breakdown alongside the normal findings.
            </p>
          </div>

          <h2 className="docs-h2">All {activeLang === 'go' ? 'Go' : activeLang === 'python' ? 'Python' : activeLang === 'rust' ? 'Rust' : 'Common'} rules</h2>
          <div className="rule-grid">
            {rules.map((rule) => (
              <div key={rule.id} className="rule-item">
                <div>
                  <span className={`rule-tag ${langClass}`}>{rule.id}</span>
                </div>
                <div>
                  <p className="rule-desc">{rule.description}</p>
                </div>
              </div>
            ))}
          </div>

          {activeLang === 'go' && (
            <>
              <h2 className="docs-h2">Detection philosophy</h2>
              <p className="docs-p">Findings are heuristics, not compile-time proof. The analyzer is intentionally conservative where full type information is missing.</p>
              <p className="docs-p">Rules are designed to produce readable evidence so humans can validate them quickly. Local repository context is used where possible, but deslop does not replace go/types.</p>
            </>
          )}
          {activeLang === 'python' && (
            <>
              <h2 className="docs-h2">Shared signals</h2>
              <p className="docs-p">Python also inherits the shared cross-language layer when parser evidence supports it, including naming-quality checks, doc-comment hygiene, conservative test-quality findings, <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>hardcoded_secret</code>, <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>full_dataset_load</code>, and <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>string_concat_in_loop</code>.</p>
            </>
          )}
          {activeLang === 'rust' && (
            <>
              <h2 className="docs-h2">Growing rule pack</h2>
              <p className="docs-p">The Rust rule pack now covers leftovers and comment hygiene, crate-local hallucination checks, async/runtime hazards, performance smells, domain-modeling anti-patterns, and unsafe-soundness operations. Stronger trait resolution, macro expansion, and cargo-workspace modeling are still pending.</p>
            </>
          )}
        </div>

        {/* CLI COMMANDS */}
        <div className={`docs-section${activeSection === 'cli-commands' ? ' active' : ''}`}>
          <div className={`docs-eyebrow ${langClass}`}>CLI reference</div>
          <h1 className="docs-h1">Commands and flags.</h1>
          <p className="docs-lead">
            Run deslop from the repository root. The same binary handles Go, Python, and Rust files — language detection is automatic based on file extensions.
          </p>

          <h2 className="docs-h2">
            {activeLang === 'go' ? 'Go' : activeLang === 'python' ? 'Python' : 'Rust'} commands
          </h2>
          <table className="cli-table">
            <colgroup>
              <col className="cli-col-command" />
              <col className="cli-col-description" />
            </colgroup>
            <thead>
              <tr>
                <th>Command</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              {commands.map((command) => (
                <tr key={command.cmd}>
                  <td>{command.cmd}</td>
                  <td>{command.desc}</td>
                </tr>
              ))}
            </tbody>
          </table>

          <h2 className="docs-h2">Global flags</h2>
          <table className="cli-table">
            <colgroup>
              <col className="cli-col-command" />
              <col className="cli-col-description" />
            </colgroup>
            <thead>
              <tr>
                <th>Flag</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr><td>--details</td><td>Include full per-function fingerprint details in scan output.</td></tr>
              <tr><td>--enable-semantic</td><td>Force the deeper semantic Go heuristics on for the current scan or benchmark run.</td></tr>
              <tr><td>--ignore RULE1,RULE2</td><td>Ignore specific rule IDs for one scan invocation after analysis completes.</td></tr>
              <tr><td>--json</td><td>Emit structured JSON instead of human-readable text output.</td></tr>
              <tr><td>--no-fail</td><td>Exit 0 even when findings are present.</td></tr>
              <tr><td>--no-ignore</td><td>Disable .gitignore filtering and scan all files under the target path.</td></tr>
              <tr><td>--warmups N</td><td>Benchmark warmup iterations for bench. Defaults to 1.</td></tr>
              <tr><td>--repeats N</td><td>Benchmark repeat count for bench. Defaults to 5.</td></tr>
            </tbody>
          </table>

          <h2 className="docs-h2">Repository config</h2>
          <p className="docs-p">
            Repository-local behavior can be tuned with a <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>.deslop.toml</code> file at the scan root.
            Place it in the directory you pass to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>deslop scan</code>.
          </p>
          <CodeBlock code={repositoryConfigExample} />
          <table className="cli-table" style={{ marginTop: '1.25rem' }}>
            <colgroup>
              <col className="cli-col-command" />
              <col className="cli-col-description" />
            </colgroup>
            <thead>
              <tr>
                <th>Key</th>
                <th>What it does</th>
              </tr>
            </thead>
            <tbody>
              <tr><td>go_semantic_experimental</td><td>Set to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>true</code> to keep the deeper semantic Go heuristics enabled — nested-loop allocation/string-build checks and stronger N+1 escalation. Defaults to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>true</code>.</td></tr>
              <tr><td>rust_async_experimental</td><td>Set to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>false</code> only if you need to temporarily disable the Rust async rule pack for the repository. Defaults to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>true</code>.</td></tr>
              <tr><td>disabled_rules</td><td>Array of rule IDs to remove entirely from the emitted findings for this repository.</td></tr>
              <tr><td>suppressed_paths</td><td>Array of relative path prefixes. Findings under matching paths are filtered out after analysis.</td></tr>
              <tr><td>[severity_overrides]</td><td>Map of rule ID to new severity string. Rewrites the emitted severity after analysis without disabling the rule.</td></tr>
            </tbody>
          </table>
          <p className="docs-p" style={{ marginTop: '1rem' }}>
            To ignore rule IDs for a single run without touching the repository config, use <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>--ignore</code>:
          </p>
          <CodeBlock code="deslop scan --ignore hallucinated_import_call,hallucinated_local_call ." />

          <h2 className="docs-h2">Output modes</h2>
          <p className="docs-p">Text output (default) prints the scan summary plus the standard finding set. JSON output is available for pipeline integration. The --details flag adds per-function fingerprint data to either output mode.</p>
          <CodeBlock code={`# Text output (default)
deslop scan . > results.txt

# JSON output
deslop scan --json . > results.json

# Full detail output
deslop scan --details --json .`} />

          <h2 className="docs-h2">Build from source</h2>
          <p className="docs-p">
            Build a native release binary for your current platform:
          </p>
          <CodeBlock code="cargo build --release" />
          <p className="docs-p">
            The binary is written to <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>target/release/deslop</code> on Unix-like systems and <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>target/release/deslop.exe</code> on Windows.
          </p>
          <p className="docs-p">Cross-compile for other supported platforms by adding the matching Rust target first, then building with the target flag:</p>
          <CodeBlock code={`# Add the targets you need
rustup target add x86_64-pc-windows-gnu x86_64-apple-darwin x86_64-unknown-linux-gnu

# Build for each target
cargo build --release --target x86_64-pc-windows-gnu
cargo build --release --target x86_64-apple-darwin
cargo build --release --target x86_64-unknown-linux-gnu`} />
          <p className="docs-p">
            Cross-compiled binaries land under <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>target/&lt;target-triple&gt;/release/</code>. Adjust the triple to match the architecture you want to ship.
          </p>

          <h2 className="docs-h2">VS Code finding opener</h2>
          <div className="docs-callout" style={{ borderLeftColor: 'var(--border-strong)', background: 'var(--accent-soft)' }}>
            <p>
              <strong>Experimental helper.</strong> If you review scan output in Visual Studio Code, the <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem' }}>vscode-finding-opener</code> extension lets you jump directly from a finding to the relevant line in the editor — no copy-paste required.
            </p>
          </div>
          <p className="docs-p">
            The helper is a small VS Code extension bundled inside the repository under <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>vscode-finding-opener/</code>.
            It reads the <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>path:line</code> entries from deslop scan output and opens each finding in the editor for fast triage.
            See the <a className="docs-link" href="https://github.com/chinmay-sawant/deslop/tree/main/vscode-finding-opener" target="_blank" rel="noreferrer">vscode-finding-opener README</a> for installation, usage, and troubleshooting notes.
          </p>
        </div>

        {/* PIPELINE */}
        <div className={`docs-section${activeSection === 'pipeline' ? ' active' : ''}`}>
          <div className={`docs-eyebrow ${langClass}`}>Pipeline</div>
          <h1 className="docs-h1">A local analysis pipeline built for speed and readable output.</h1>
          <p className="docs-lead">
            deslop discovers files, parses structure, builds a lightweight language-scoped index, and runs explainable heuristics.
            Each stage is designed to be fast and independently composable.
          </p>

          {pipelineStages.map((stage, index) => (
            <div key={stage.name} style={{ marginBottom: '2.5rem' }}>
              <div style={{ display: 'flex', alignItems: 'center', gap: '0.75rem', marginBottom: '0.75rem' }}>
                <span style={{
                  fontFamily: 'var(--mono-font)',
                  fontSize: '0.72rem',
                  fontWeight: 700,
                  color: `var(--lang-${activeLang})`,
                  background: `var(--lang-${activeLang}-badge)`,
                  padding: '0.15rem 0.5rem',
                  letterSpacing: '0.08em',
                }}>
                  {String(index + 1).padStart(2, '0')}
                </span>
                <h2 style={{ margin: 0, fontFamily: 'var(--heading-font)', fontSize: '1.2rem', fontWeight: 700, letterSpacing: '-0.03em', color: 'var(--text-strong)' }}>
                  {stage.name}
                </h2>
              </div>
              <p className="docs-lead" style={{ fontSize: '1rem', marginBottom: '0.75rem' }}>{stage.summary}</p>
              <p className="docs-p">{stage.detail}</p>
            </div>
          ))}

          <h2 className="docs-h2">Benchmarking</h2>
          <p className="docs-p">
            The <code style={{ fontFamily: 'var(--mono-font)', fontSize: '0.8rem', color: 'var(--code)' }}>bench</code> command measures each pipeline stage individually — discovery, parse, index, heuristics, and total runtime.
            A local benchmark recorded on April 3, 2026 averaged 1906.20 ms over 5 repeats after 1 warmup against gopdfsuit at 125 files and 876 functions.
          </p>
          <CodeBlock code="cargo run -- bench --warmups 2 --repeats 5 /path/to/repo" />

          <h2 className="docs-h2">Mixed-language repositories</h2>
          <p className="docs-p">
            deslop handles mixed Go, Python, and Rust repositories in a single scan pass. The local symbol index is language-scoped, so
            Go, Python, and Rust symbols are tracked separately. Hallucination checks remain accurate across language boundaries.
          </p>
        </div>

        {/* LIMITATIONS */}
        <div className={`docs-section${activeSection === 'limitations' ? ' active' : ''}`}>
          <div className={`docs-eyebrow ${langClass}`}>Limitations</div>
          <h1 className="docs-h1">What deslop does not do.</h1>
          <p className="docs-lead">
            deslop is explicit about what it can and cannot prove. It surfaces suspicious patterns quickly and leaves the final
            judgment to engineers. The following limitations apply to{' '}
            {activeLang === 'go' ? 'Go' : activeLang === 'python' ? 'Python' : 'Rust'} analysis specifically.
          </p>

          <div className="docs-callout" style={{ borderLeftColor: `var(--lang-${activeLang})`, background: `var(--lang-${activeLang}-soft)` }}>
            <p>
              Findings are heuristics, not compile-time proof. The analyzer is intentionally conservative where full type
              information is missing.
            </p>
          </div>

          <h2 className="docs-h2">
            {activeLang === 'go' ? 'Go' : activeLang === 'python' ? 'Python' : 'Rust'} analysis limitations
          </h2>
          <div className="rule-grid">
            {limits.map((limit) => (
              <div key={limit} style={{ padding: '0.85rem 1rem', border: '1px solid var(--border)', background: 'var(--accent-soft)', fontSize: '0.9rem', lineHeight: 1.65, color: 'var(--muted)' }}>
                {limit}
              </div>
            ))}
          </div>

          <h2 className="docs-h2">General limitations</h2>
          <div className="rule-grid">
            {[
              'No full interprocedural context propagation. Most analysis is local to each function, with only conservative repository-local wrapper-chain awareness.',
              'Package-method and local-symbol checks are repository-local and language-scoped for mixed-language repositories.',
              'No proof of runtime behavior: goroutine leaks, N+1 query counts, or actual memory pressure are not detectable from static structure alone.',
            ].map((limit) => (
              <div key={limit} style={{ padding: '0.85rem 1rem', border: '1px solid var(--border)', background: 'var(--accent-soft)', fontSize: '0.9rem', lineHeight: 1.65, color: 'var(--muted)' }}>
                {limit}
              </div>
            ))}
          </div>

          <h2 className="docs-h2">Planned improvements</h2>
          <p className="docs-p">The following capabilities are pending or in development:</p>
          <div className="docs-pill-list">
            {activeLang === 'go' && ['Index-assisted DB call classification', 'Public-API-aware context propagation', 'AST-resolved ctx.Done detection inside goroutines', 'Type-aware Go analysis'].map((item) => <span key={item} className="docs-pill">{item}</span>)}
            {activeLang === 'python' && ['Installed-package and module-graph awareness', 'Deeper interprocedural asyncio reasoning', 'Optional type-aware data-flow analysis', 'Framework-specific rule packs (Django/FastAPI)'].map((item) => <span key={item} className="docs-pill">{item}</span>)}
            {activeLang === 'rust' && ['Trait resolution', 'Cargo workspace modeling', 'Macro expansion analysis', 'Deeper Rust rule pack', 'Cross-crate symbol resolution'].map((item) => <span key={item} className="docs-pill">{item}</span>)}
            {activeLang === 'common' && ['Inter-language FFI/RPC bridge modeling', 'Global AST-normalized similarity indexing', 'Heuristic weight calibration', 'Support for JS/TS and C++'].map((item) => <span key={item} className="docs-pill">{item}</span>)}
          </div>
        </div>

        {/* WHY THIS EXISTS */}
        <div className={`docs-section${activeSection === 'why-this-exists' ? ' active' : ''}`}>
          <div className="docs-eyebrow" style={{ color: 'var(--muted)' }}>Why This Exists</div>
          <h1 className="docs-h1">The Last Checkpoint That Does Not Argue Back.</h1>
          <p className="docs-lead">
            LLMs are getting faster, cheaper, and more capable — but they still ship patterns you would not want in production. Deslop is the static layer that does not hallucinate, does not drift, and does not need a prompt.
          </p>

          <div className="docs-callout" style={{ borderLeftColor: 'var(--border-strong)', background: 'var(--accent-soft)', marginBottom: '2rem' }}>
            <p>
              These are the ten honest reasons this tool was built. None of them require you to stop using LLMs — they just explain why a rule-based pass after the model still earns its place.
            </p>
          </div>

          <ol style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: '1.5rem' }}>
            {[
              {
                n: '01',
                title: 'You are probably using a smaller, faster model',
                body: 'Not every workflow runs on the most capable frontier model. Lighter models cut latency and cost but miss the edge-case logic, failure paths, and naming discipline a senior reviewer would flag. Deslop finds the pattern regardless of which model generated the code.',
              },
              {
                n: '02',
                title: 'LLMs hallucinate even with perfect prompts',
                body: 'Precise markdown, structured skills, and thorough context reduce hallucination — they do not eliminate it. A model can confidently reference a function that does not exist, a package it cannot import, or a pattern your codebase has never used. Rule-based detection does not hallucinate.',
              },
              {
                n: '03',
                title: 'This is the last checkzone before code ships',
                body: 'After the model, before the reviewer. Deslop is the checkpoint that asks the questions no one else asked: does this code follow the patterns we actually care about? No re-prompting. No second opinion from the same source.',
              },
              {
                n: '04',
                title: 'Future-proof against LLM price spikes',
                body: 'If API costs double next quarter, you switch to a cheaper model without lowering your quality floor. The rules stay the same. The safety net stays in place. Capability and cost can move independently when you have a static validation layer.',
              },
              {
                n: '05',
                title: 'Actionable by engineers, not delegated back to LLMs',
                body: 'You read the rule ID. You read the evidence. You decide if it is a real problem. No re-prompting a model to review its own output. Easier to detect, easier to fix — by a human, not by the system that created the issue.',
              },
              {
                n: '06',
                title: 'Static rules do not drift with model versions',
                body: 'When a provider ships updated weights, your generated output changes. Deslop\'s rules do not. The same check runs with the same result on every scan, every version, every model, every team.',
              },
              {
                n: '07',
                title: 'Works offline, costs nothing per invocation',
                body: 'No API call. No token burn. No rate limit. No data leaving your machine. Run it as many times as you want in CI, locally, or in an air-gapped environment. The only cost is the two seconds it takes to scan a repository.',
              },
              {
                n: '08',
                title: 'An LLM reviewing its own output has no incentive to fail it',
                body: 'Asking a model to review code it generated introduces a subtle bias toward validation. A static heuristic has no opinion about the author. It flags the pattern or it does not.',
              },
              {
                n: '09',
                title: 'Gives CI a language-native quality gate with no model in the loop',
                body: 'Wire it in once and every future AI-assisted PR gets the same sweep automatically. No LLM token, no network call, no flaky API dependency — just a binary and a findings file.',
              },
              {
                n: '10',
                title: 'Keeps human review time focused on what matters',
                body: 'When reviewers read findings backed by rule IDs and quoted evidence, they spend time on real problems instead of hunting for patterns a machine could have flagged. Deslop moves the boring part out of human review.',
              },
            ].map(({ n, title, body }) => (
              <li key={n} style={{ display: 'grid', gridTemplateColumns: '3rem 1fr', gap: '1rem', alignItems: 'start' }}>
                <span style={{ fontFamily: 'var(--mono-font)', fontSize: '0.7rem', fontWeight: 700, color: 'var(--muted)', paddingTop: '0.25rem', letterSpacing: '0.05em' }}>{n}</span>
                <div>
                  <h3 style={{ margin: '0 0 0.4rem', fontSize: '0.95rem', fontWeight: 600, color: 'var(--text-strong)' }}>{title}</h3>
                  <p className="docs-p" style={{ margin: 0 }}>{body}</p>
                </div>
              </li>
            ))}
          </ol>

          <div className="docs-callout" style={{ borderLeftColor: 'var(--border-strong)', background: 'var(--accent-soft)', marginTop: '2.5rem' }}>
            <p style={{ margin: '0 0 0.75rem', fontWeight: 600, color: 'var(--text-strong)' }}>
            This tool is currently in Beta.
            </p>
            <p style={{ margin: '0 0 0.75rem' }}>
              This tool is not production-grade and does not claim to be. It is a beta-stage experiment built with the intention of doing the job well. The rule set is growing, the patterns are expanding, and every release gets closer to the best-practice coverage we are aiming for. Expect rough edges — and expect them to get filed down.
            </p>
            <p style={{ margin: '0 0 0.75rem' }}>
              The roadmap includes more detection patterns, better language coverage, and tighter alignment with community best-practice guides. This is a long-term project, not a one-shot release.
            </p>
            <p style={{ margin: 0 }}>
              Want to help? You can contribute by raising a PR or opening a ticket on GitHub —{' '}
              <a
                href="https://github.com/chinmay-sawant/deslop"
                target="_blank"
                rel="noreferrer"
                style={{ color: 'var(--text-strong)', textDecoration: 'underline', textDecorationColor: 'var(--border-strong)', textUnderlineOffset: '3px' }}
              >
                github.com/chinmay-sawant/deslop
              </a>
              . Every idea, bug report, and pattern suggestion moves this forward.
            </p>
          </div>
        </div>

        {/* ABOUT */}
        <div className={`docs-section${activeSection === 'about' ? ' active' : ''}`}>
          <div className="docs-eyebrow" style={{ color: 'var(--muted)' }}>About</div>
          <h1 className="docs-h1">Deslop: The Bad Practice Detector.</h1>
          <p className="docs-lead">
           An early-stage experiment focused on filtering out worst practices and highlighting what works best.
          </p>
          <h3>The Philosophy</h3>
          <p className="docs-p">
            If the folks at Anthropic and Peter Steinberger can generate full-fledged applications without manually writing every line of code, then we can certainly vibecode a tool to detect the resulting "slop."
          </p>
          <p className="docs-p">
            We’re fighting fire with fire. This project is mostly vibecoded, but the architecture is built with intention. Instead of just calling things slop, let’s build a better filter together.
          </p>

          <div className="docs-callout" style={{ borderLeftColor: 'var(--border-strong)', background: 'var(--accent-soft)' }}>
            <p>
              I built this to solve a real problem I was facing. Full disclosure: the code itself is mostly 'vibecoded' right now, but I’ve put a lot of thought into the core architecture. I’d love to make this better, so I'm very open to constructive feedback. If you have ideas or see room for improvement, let's collaborate! Feel free to open an issue so we can discuss.
              Send me more ideas by{' '}
              <a
                href="https://github.com/chinmay-sawant/deslop/issues/new"
                target="_blank"
                rel="noreferrer"
                style={{ color: 'var(--text-strong)', textDecoration: 'underline', textDecorationColor: 'var(--border-strong)', textUnderlineOffset: '3px' }}
              >
                creating a new issue
              </a>
              .
            </p>
          </div>

          <h2 className="docs-h2">Open-source & free</h2>
          <p className="docs-p">
            Going to keep this as open-source. Got no intention to monetize the application — for now :3
          </p>
          <p className="docs-p">
            The full source is on{' '}
            <a
              href="https://github.com/chinmay-sawant/deslop"
              target="_blank"
              rel="noreferrer"
              style={{ color: 'var(--text-strong)', textDecoration: 'underline', textDecorationColor: 'var(--border-strong)', textUnderlineOffset: '3px' }}
            >
              GitHub
            </a>
            {' '}under the MIT license. Contributions, ideas, and bug reports are all welcome.
          </p>

          <h2 className="docs-h2">Built & vibecoded by</h2>
          <p className="docs-p">
            <a
              href="https://github.com/chinmay-sawant"
              target="_blank"
              rel="noreferrer"
              style={{ color: 'var(--text-strong)', textDecoration: 'underline', textDecorationColor: 'var(--border-strong)', textUnderlineOffset: '3px' }}
            >
              Chinmay Sawant
            </a>
            {' '}with ❤️
          </p>
        </div>

      </main>
    </div>
  )
}