---
import Layout from '../components/Layout.astro';
import Footer from '../components/Footer.astro';
import CTA from '../components/CTA.astro';
---

<Layout title="dd0c/run — Runbook Automation" description="Write runbooks in YAML. Classify commands by safety. Destructive ops require Slack approval. Full audit trail.">
  <section class="pt-32 pb-20 px-6">
    <div class="max-w-4xl mx-auto">
      <div class="mb-8">
        <span class="font-mono text-sm text-dd0c-primary">dd0c/run</span>
        <h1 class="text-4xl sm:text-5xl font-bold mt-2">Runbooks that run themselves<br />(with your permission)</h1>
        <p class="mt-6 text-lg text-dd0c-muted leading-relaxed max-w-2xl">
          Write runbooks in YAML. The Rust agent classifies every command as read-only, modifying, or destructive. Read-only runs automatically. Destructive commands pause and ask for Slack approval. Full audit trail. No YOLO.
        </p>
      </div>

      <div class="mt-10 flex gap-4">
        <a href="https://app.dd0c.dev/signup" class="px-6 py-3 rounded-lg bg-dd0c-primary hover:bg-dd0c-primary-light text-white font-medium transition">Start free →</a>
        <a href="https://docs.dd0c.dev/run" class="px-6 py-3 rounded-lg border border-dd0c-border hover:border-dd0c-muted text-dd0c-muted hover:text-dd0c-text transition">Read docs</a>
      </div>

      <div class="mt-16 rounded-xl border border-dd0c-border bg-dd0c-surface p-6">
        <h3 class="font-semibold mb-4">Example runbook</h3>
        <pre class="font-mono text-sm text-dd0c-muted overflow-x-auto"><code><span class="text-dd0c-primary">name:</span> restart-ecs-service
<span class="text-dd0c-primary">steps:</span>
  - <span class="text-dd0c-accent">description:</span> Check current task count
    <span class="text-dd0c-accent">command:</span> aws ecs describe-services --cluster prod --services api
    <span class="text-dd0c-muted"># → classified: read_only (auto-approved)</span>

  - <span class="text-dd0c-accent">description:</span> Force new deployment
    <span class="text-dd0c-accent">command:</span> aws ecs update-service --cluster prod --service api --force-new-deployment
    <span class="text-dd0c-muted"># → classified: modifying (requires approval)</span>

  - <span class="text-dd0c-accent">description:</span> Wait for stable
    <span class="text-dd0c-accent">command:</span> aws ecs wait services-stable --cluster prod --services api
    <span class="text-dd0c-accent">timeout_seconds:</span> 300
    <span class="text-dd0c-accent">on_failure:</span>
      <span class="text-dd0c-accent">action:</span> retry
      <span class="text-dd0c-accent">max_attempts:</span> 3</code></pre>
      </div>

      <div class="mt-16 grid md:grid-cols-3 gap-6">
        <div class="rounded-xl border border-dd0c-border bg-dd0c-surface p-6">
          <div class="text-2xl mb-3">🛑</div>
          <h3 class="font-semibold mb-2">Safety classification</h3>
          <p class="text-sm text-dd0c-muted">Pattern-based classification for shell, AWS CLI, kubectl, and terraform commands. Destructive ops always require human approval.</p>
        </div>
        <div class="rounded-xl border border-dd0c-border bg-dd0c-surface p-6">
          <div class="text-2xl mb-3">💬</div>
          <h3 class="font-semibold mb-2">Slack approval flow</h3>
          <p class="text-sm text-dd0c-muted">Block Kit messages with approve/reject buttons. Click to approve from your phone. No SSH required.</p>
        </div>
        <div class="rounded-xl border border-dd0c-border bg-dd0c-surface p-6">
          <div class="text-2xl mb-3">📝</div>
          <h3 class="font-semibold mb-2">Immutable audit log</h3>
          <p class="text-sm text-dd0c-muted">Every command, every approval, every exit code. SHA-256 hashed stdout. Append-only. Compliance-ready.</p>
        </div>
      </div>
    </div>
  </section>
  <CTA />
  <Footer />
</Layout>
