<svelte:head>
	<title>Installation — cora docs</title>
</svelte:head>

<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));
	});
</script>

<div class="docs-content">
<h1 class="scroll-reveal">
	Installation
</h1>

<div class="docs-section scroll-reveal">
	<h2>Prerequisites</h2>
	<p>cora is a Rust binary. You have two installation paths:</p>
	<div class="docs-term-list">
		<div class="text-sm text-[var(--muted-foreground)]">
			<span class="font-semibold text-[var(--accent)]">Via Cargo (recommended)</span> — Requires Rust 1.85 or later with Cargo installed
		</div>
		<div class="text-sm text-[var(--muted-foreground)]">
			<span class="font-semibold text-[var(--accent)]">Binary download</span> — No Rust required; just download and place in your PATH
		</div>
	</div>
	<p>cora works on Linux (x86_64 and arm64), macOS (arm64), and Windows.</p>
</div>

<div class="docs-section scroll-reveal">
	<h2>Install via Cargo</h2>
	<p>The recommended way to install cora is through Cargo:</p>

	<div class="docs-terminal">
		<div class="terminal-bar">
			<span class="terminal-dot-red"></span>
			<span class="terminal-dot-yellow"></span>
			<span class="terminal-dot-green"></span>
		</div>
		<div class="terminal-body">
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cargo install</span>			<span class="syntax-string">cora-cli</span></div>
		</div>
	</div>

	<p>This compiles cora from source and installs it to Cargo's binary directory (typically <code>~/.cargo/bin/</code>).</p>
</div>

<div class="docs-section scroll-reveal">
	<h2>Download Binary</h2>
	<p>Pre-built binaries are available from the <a href="https://github.com/ajianaz/cora-cli/releases" target="_blank" rel="noopener">GitHub Releases</a> page.</p>

	<div class="text-sm text-[var(--muted-foreground)] mb-4">
		<p>Supported platforms:</p>
		<div class="flex flex-col gap-1 mt-2">
			<div>Linux x86_64 (glibc)</div>
			<div>Linux arm64 (aarch64)</div>
			<div>macOS arm64 (Apple Silicon)</div>
			<div>Windows x86_64</div>
		</div>
	</div>

	<div class="docs-terminal">
		<div class="terminal-bar">
			<span class="terminal-dot-red"></span>
			<span class="terminal-dot-yellow"></span>
			<span class="terminal-dot-green"></span>
		</div>
		<div class="terminal-body">
			<div><span class="syntax-comment"># Download and extract</span></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">curl</span> -sL https://github.com/ajianaz/cora-cli/releases/latest/download/cora-linux-x86_64.tar.gz | <span class="syntax-highlight">tar</span> xz</div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">mv</span> cora ~/.local/bin/cora</div>
		</div>
	</div>
</div>

<div class="docs-section scroll-reveal">
	<h2>Build from Source</h2>
	<p>If you prefer to build from the latest source:</p>

	<div class="docs-terminal">
		<div class="terminal-bar">
			<span class="terminal-dot-red"></span>
			<span class="terminal-dot-yellow"></span>
			<span class="terminal-dot-green"></span>
		</div>
		<div class="terminal-body">
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">git clone</span> <span class="syntax-string">https://github.com/ajianaz/cora-cli.git</span></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cd</span> cora-cli</div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cargo build</span> <span class="syntax-flag">--release</span></div>
			<div><span class="syntax-comment"># Binary at target/release/cora</span></div>
		</div>
	</div>
</div>

<div class="docs-section scroll-reveal">
	<h2>Shell Completions</h2>
	<p>cora provides shell completions for bash, zsh, and fish:</p>

	<div class="docs-terminal">
		<div class="terminal-bar">
			<span class="terminal-dot-red"></span>
			<span class="terminal-dot-yellow"></span>
			<span class="terminal-dot-green"></span>
		</div>
		<div class="terminal-body">
			<div><span class="syntax-comment"># Bash</span></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cora completion</span> <span class="syntax-string">bash</span> > ~/.cora/completion.bash</div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">echo</span> <span class="syntax-string">'source ~/.cora/completion.bash'</span> >> ~/.bashrc</div>
			<div></div>
			<div><span class="syntax-comment"># Zsh</span></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cora completion</span> <span class="syntax-string">zsh</span> > ~/.cora/completion.zsh</div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">echo</span> <span class="syntax-string">'source ~/.cora/completion.zsh'</span> >> ~/.zshrc</div>
			<div></div>
			<div><span class="syntax-comment"># Fish</span></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cora completion</span> <span class="syntax-string">fish</span> > ~/.config/fish/completions/cora.fish</div>
		</div>
	</div>
</div>

<div class="docs-section scroll-reveal">
	<h2>Verify Installation</h2>
	<p>Confirm cora is installed correctly:</p>

	<div class="docs-terminal">
		<div class="terminal-bar">
			<span class="terminal-dot-red"></span>
			<span class="terminal-dot-yellow"></span>
			<span class="terminal-dot-green"></span>
		</div>
		<div class="terminal-body">
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cora</span> <span class="syntax-flag">--version</span></div>
			<div><span class="syntax-string">cora 0.x.x</span></div>
			<div></div>
			<div><span class="syntax-cmd">$</span> <span class="syntax-highlight">cora auth</span> <span class="syntax-string">status</span></div>
			<div><span class="syntax-string">Provider: openai</span></div>
			<div><span class="syntax-string">API key: configured</span></div>
		</div>
	</div>
</div>

<div class="docs-section scroll-reveal">
	<h2>Updating</h2>
	<p>To update cora to the latest version:</p>

	<div class="docs-term-list">
		<div class="text-sm text-[var(--muted-foreground)]">
			<span class="font-semibold text-[var(--accent)]">Via Cargo:</span> <code>cargo install cora-cli --force</code>
		</div>
		<div class="text-sm text-[var(--muted-foreground)]">
			<span class="font-semibold text-[var(--accent)]">Via Binary:</span> Download the latest release from GitHub and replace the existing binary
		</div>
	</div>
</div>
</div>
