<script lang="ts">
	import { onMount } from 'svelte';

	onMount(() => {
		const observer = new IntersectionObserver(
			(entries) => {
				entries.forEach((entry) => {
					if (entry.isIntersecting) {
						entry.target.classList.add('revealed');
						observer.unobserve(entry.target);
					}
				});
			},
			{ threshold: 0.1 }
		);
		document.querySelectorAll('.scroll-reveal').forEach((el) => observer.observe(el));
		return () => observer.disconnect();
	});
</script>

<svelte:head>
	<title>CLI Reference — cora docs</title>
	<meta name="description" content="Complete CLI reference for cora - AI code review tool commands, flags, and options." />
</svelte:head>

<div class="docs-content">
<h1 class="scroll-reveal">CLI Reference</h1>
<p class="scroll-reveal">Complete command reference for the cora CLI.</p>

<!-- Global Flags -->
<section class="docs-section scroll-reveal">
	<h2 class="flex items-center gap-2">
		<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg>
		Global Flags
	</h2>
	<div class="glass-card p-0 overflow-hidden">
		<table class="compare-table">
			<thead>
				<tr>
					<th class="w-1/3">Flag</th>
					<th>Description</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td><code class="syntax-flag">--config</code> <code class="text-[var(--muted-foreground)]">&lt;path&gt;</code></td>
					<td>Override config file path (default: <code class="text-[var(--muted-foreground)]">.cora.yaml</code>)</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--format</code> <code class="text-[var(--muted-foreground)]">&lt;fmt&gt;</code></td>
					<td>Output format: pretty, json, compact, sarif</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--no-color</code></td>
					<td>Disable colored output</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--provider</code> <code class="text-[var(--muted-foreground)]">&lt;name&gt;</code></td>
					<td>Override provider</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--model</code> <code class="text-[var(--muted-foreground)]">&lt;name&gt;</code></td>
					<td>Override model</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--base-url</code> <code class="text-[var(--muted-foreground)]">&lt;url&gt;</code></td>
					<td>Override API base URL</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--api-key</code> <code class="text-[var(--muted-foreground)]">&lt;key&gt;</code></td>
					<td>Override API key</td>
				</tr>
				<tr>
					<td><code class="syntax-flag">--verbose</code></td>
					<td>Enable debug logging</td>
				</tr>
			</tbody>
		</table>
	</div>
</section>

<!-- Commands -->
<section class="docs-section scroll-reveal">
	<h2 class="flex items-center gap-2">
		<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z"/></svg>
		Commands
	</h2>
	<div class="glass-card p-0 overflow-hidden">
		<table class="compare-table">
			<thead>
				<tr>
					<th class="w-1/3">Command</th>
					<th>Description</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td><code class="syntax-highlight">cora init</code></td>
					<td>Create <code class="text-[var(--muted-foreground)]">.cora.yaml</code> config file</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review</code></td>
					<td>Review code changes (default: staged files)</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --staged</code></td>
					<td>Review staged git changes explicitly</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --unstaged</code></td>
					<td>Review unstaged working changes</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --unpushed</code></td>
					<td>Review unpushed commits</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --base</code> <code class="text-[var(--muted-foreground)]">&lt;branch&gt;</code></td>
					<td>Compare current branch against target</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --commit</code> <code class="text-[var(--muted-foreground)]">&lt;ref&gt;</code></td>
					<td>Review specific commit or range</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --diff-file</code> <code class="text-[var(--muted-foreground)]">&lt;path&gt;</code></td>
					<td>Review from a diff file</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora review --upload</code></td>
					<td>Review and upload SARIF to GitHub Code Scanning</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora scan</code> <code class="text-[var(--muted-foreground)]">&lt;path&gt;</code></td>
					<td>Scan files for issues</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora scan .</code> <code class="syntax-flag">[--incremental]</code></td>
					<td>Scan only changed files</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora config show</code></td>
					<td>Show resolved configuration</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora config set</code> <code class="text-[var(--muted-foreground)]">&lt;key&gt; &lt;value&gt;</code></td>
					<td>Set a config value</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora hook install</code></td>
					<td>Install pre-commit hook</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora hook uninstall</code></td>
					<td>Remove pre-commit hook</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora auth login</code></td>
					<td>Save API key to <code class="text-[var(--muted-foreground)]">~/.cora/config.toml</code></td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora auth status</code></td>
					<td>Check current auth status</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora auth remove</code></td>
					<td>Remove stored API key</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora providers</code></td>
					<td>List detected AI providers</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora upload-sarif</code> <code class="text-[var(--muted-foreground)]">&lt;file&gt;</code></td>
					<td>Upload SARIF to GitHub Code Scanning</td>
				</tr>
				<tr>
					<td><code class="syntax-highlight">cora completion</code> <code class="text-[var(--muted-foreground)]">&lt;shell&gt;</code></td>
					<td>Generate shell completions (bash/zsh/fish)</td>
				</tr>
			</tbody>
		</table>
	</div>
</section>

<!-- Quick Examples -->
<section class="docs-section scroll-reveal">
	<h2 class="flex items-center gap-2">
		<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>
		Quick Examples
	</h2>
	<div class="flex flex-col gap-3">
		<div class="docs-terminal">
			<div class="terminal-bar">
				<span class="terminal-dot terminal-dot-red"></span>
				<span class="terminal-dot terminal-dot-yellow"></span>
				<span class="terminal-dot terminal-dot-green"></span>
			</div>
			<div class="terminal-body">
				<span class="syntax-comment"># Review staged changes (what's about to be committed)</span><br/>
				<span class="syntax-cmd">$</span> <span class="syntax-highlight">cora review</span> <span class="syntax-flag">--staged</span>
			</div>
		</div>

		<div class="docs-terminal">
			<div class="terminal-bar">
				<span class="terminal-dot terminal-dot-red"></span>
				<span class="terminal-dot terminal-dot-yellow"></span>
				<span class="terminal-dot terminal-dot-green"></span>
			</div>
			<div class="terminal-body">
				<span class="syntax-comment"># Compare your feature branch against main</span><br/>
				<span class="syntax-cmd">$</span> <span class="syntax-highlight">cora review</span> <span class="syntax-flag">--base</span> <span class="syntax-string">main</span>
			</div>
		</div>

		<div class="docs-terminal">
			<div class="terminal-bar">
				<span class="terminal-dot terminal-dot-red"></span>
				<span class="terminal-dot terminal-dot-yellow"></span>
				<span class="terminal-dot terminal-dot-green"></span>
			</div>
			<div class="terminal-body">
				<span class="syntax-comment"># Full project scan with incremental caching</span><br/>
				<span class="syntax-cmd">$</span> <span class="syntax-highlight">cora scan</span> <span class="syntax-flag">--incremental</span>
			</div>
		</div>

		<div class="docs-terminal">
			<div class="terminal-bar">
				<span class="terminal-dot terminal-dot-red"></span>
				<span class="terminal-dot terminal-dot-yellow"></span>
				<span class="terminal-dot terminal-dot-green"></span>
			</div>
			<div class="terminal-body">
				<span class="syntax-comment"># Install pre-commit hook</span><br/>
				<span class="syntax-cmd">$</span> <span class="syntax-highlight">cora hook</span> <span class="syntax-string">install</span>
			</div>
		</div>
	</div>
</section>
</div>
