Lander.astro 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. ---
  2. import { Image } from 'astro:assets';
  3. import config from "virtual:starlight/user-config";
  4. import type { Props } from '@astrojs/starlight/props';
  5. import CopyIcon from "../assets/lander/copy.svg";
  6. import CheckIcon from "../assets/lander/check.svg";
  7. import Screenshot from "../assets/lander/screenshot-splash.png";
  8. const { data } = Astro.locals.starlightRoute.entry;
  9. const { title = data.title, tagline, image, actions = [] } = data.hero || {};
  10. const imageAttrs = {
  11. loading: 'eager' as const,
  12. decoding: 'async' as const,
  13. width: 400,
  14. alt: image?.alt || '',
  15. };
  16. const github = config.social.filter(s => s.icon === 'github')[0];
  17. const command = "curl -fsSL"
  18. const protocol = "https://"
  19. const url = "opencode.ai/install"
  20. const bash = "| bash"
  21. let darkImage: ImageMetadata | undefined;
  22. let lightImage: ImageMetadata | undefined;
  23. let rawHtml: string | undefined;
  24. if (image) {
  25. if ('file' in image) {
  26. darkImage = image.file;
  27. } else if ('dark' in image) {
  28. darkImage = image.dark;
  29. lightImage = image.light;
  30. } else {
  31. rawHtml = image.html;
  32. }
  33. }
  34. ---
  35. <div class="hero">
  36. <section class="top">
  37. <div class="logo">
  38. <Image
  39. src={darkImage}
  40. {...imageAttrs}
  41. class:list={{ 'light:sl-hidden': Boolean(lightImage) }}
  42. />
  43. <Image src={lightImage} {...imageAttrs} class="dark:sl-hidden" />
  44. </div>
  45. <h1>The AI coding agent built for the terminal.</h1>
  46. </section>
  47. <section class="cta">
  48. <div class="col1">
  49. <a href="/docs">Docs</a>
  50. </div>
  51. <div class="col2">
  52. <button class="command" data-command={`${command} ${protocol}${url} ${bash}`}>
  53. <code>
  54. <span>{command}&nbsp;</span><span class="protocol">{protocol}</span><span class="highlight">{url}</span>&nbsp;{bash}
  55. </code>
  56. <span class="copy">
  57. <CopyIcon />
  58. <CheckIcon />
  59. </span>
  60. </button>
  61. </div>
  62. <div class="col3">
  63. <a href={github.href}>GitHub</a>
  64. </div>
  65. </section>
  66. <section class="content">
  67. <ul>
  68. <li><b>Native TUI</b>: A responsive, native, themeable terminal UI.</li>
  69. <li><b>LSP enabled</b>: Automatically loads the right LSPs for the LLM.</li>
  70. <li><b>Multi-session</b>: Start multiple agents in parallel on the same project.</li>
  71. <li><b>Shareable links</b>: Share a link to any sessions for reference or to debug.</li>
  72. <li><b>Claude Pro</b>: Log in with Anthropic to use your Claude Pro or Max account.</li>
  73. <li><b>Use any model</b>: Supports 75+ LLM providers through <a href="https://models.dev">Models.dev</a>, including local models.</li>
  74. </ul>
  75. </section>
  76. <section class="images">
  77. <div>
  78. <p>opencode TUI with the tokyonight theme</p>
  79. <Image width={600} src={Screenshot} alt="opencode TUI with the tokyonight theme" />
  80. </div>
  81. </section>
  82. <section class="footer">
  83. <div class="col1">
  84. <span>Version: Beta</span>
  85. </div>
  86. <div class="col2">
  87. <span>Author: <a href="https://sst.dev">SST</a></span>
  88. </div>
  89. </section>
  90. </div>
  91. <style>
  92. .hero {
  93. --padding: 3rem;
  94. --vertical-padding: 2rem;
  95. --heading-font-size: var(--sl-text-3xl);
  96. margin: 1rem;
  97. border: 2px solid var(--sl-color-border);
  98. }
  99. @media (max-width: 30rem) {
  100. .hero {
  101. --padding: 1rem;
  102. --vertical-padding: 1rem;
  103. --heading-font-size: var(--sl-text-2xl);
  104. margin: 0.5rem;
  105. }
  106. }
  107. section.top {
  108. padding: var(--padding);
  109. h1 {
  110. margin-top: calc(var(--vertical-padding) / 8);
  111. font-size: var(--heading-font-size);
  112. line-height: 1.25;
  113. text-transform: uppercase;
  114. }
  115. img {
  116. height: auto;
  117. width: clamp(200px, 70vw, 400px);
  118. }
  119. }
  120. section.cta {
  121. display: flex;
  122. flex-direction: row;
  123. justify-content: flex-start;
  124. align-items: stretch;
  125. border-top: 2px solid var(--sl-color-border);
  126. @media (max-width: 50rem) {
  127. flex-direction: column;
  128. & > div.col1 { order: 1; }
  129. & > div.col3 { order: 2; }
  130. & > div.col2 { order: 3; }
  131. }
  132. & > div {
  133. line-height: 1.4;
  134. padding: calc(var(--padding) / 2) 1rem;
  135. a {
  136. font-size: 1rem;
  137. }
  138. }
  139. & > div.col1, & > div.col3 {
  140. flex: 1 1 auto;
  141. text-align: center;
  142. text-transform: uppercase;
  143. @media (max-width: 50rem) {
  144. padding-bottom: calc(var(--padding) / 2 + 4px);
  145. }
  146. }
  147. & > div.col2 {
  148. flex: 0 0 auto;
  149. }
  150. & > div + div {
  151. border-left: 2px solid var(--sl-color-border);
  152. @media (max-width: 50rem) {
  153. border-left: none;
  154. border-top: 2px solid var(--sl-color-border);
  155. }
  156. }
  157. .command {
  158. all: unset;
  159. display: flex;
  160. align-items: center;
  161. gap: 0.625rem;
  162. justify-content: center;
  163. cursor: pointer;
  164. width: 100%;
  165. code {
  166. color: var(--sl-color-text-secondary);
  167. font-size: 1.125rem;
  168. @media (max-width: 24rem) {
  169. font-size: 0.875rem;
  170. }
  171. @media (max-width: 30rem) {
  172. span.protocol {
  173. display: none;
  174. }
  175. }
  176. @media (max-width: 43rem) {
  177. text-align: center;
  178. span:first-child {
  179. display: block;
  180. }
  181. }
  182. }
  183. code .highlight {
  184. color: var(--sl-color-text);
  185. font-weight: 500;
  186. }
  187. .copy {
  188. line-height: 1;
  189. padding: 0;
  190. @media (max-width: 43rem) {
  191. display: none;
  192. }
  193. }
  194. .copy svg {
  195. width: 1rem;
  196. height: 1rem;
  197. vertical-align: middle;
  198. }
  199. .copy svg:first-child {
  200. color: var(--sl-color-text-dimmed);
  201. }
  202. .copy svg:last-child {
  203. color: var(--sl-color-text);
  204. display: none;
  205. }
  206. &.success .copy {
  207. pointer-events: none;
  208. }
  209. &.success .copy svg:first-child {
  210. display: none;
  211. }
  212. &.success .copy svg:last-child {
  213. display: inline;
  214. }
  215. }
  216. }
  217. section.content {
  218. border-top: 2px solid var(--sl-color-border);
  219. padding: var(--padding);
  220. ul {
  221. padding-left: 1rem;
  222. li + li {
  223. margin-top: calc(var(--vertical-padding) / 2);
  224. }
  225. li b {
  226. text-transform: uppercase;
  227. }
  228. }
  229. }
  230. section.images {
  231. display: flex;
  232. flex-direction: row;
  233. align-items: stretch;
  234. justify-content: space-between;
  235. border-top: 2px solid var(--sl-color-border);
  236. & > div {
  237. flex: 1;
  238. display: flex;
  239. flex-direction: column;
  240. gap: calc(var(--padding) / 4);
  241. padding: calc(var(--padding) / 2);
  242. border-width: 0;
  243. border-style: solid;
  244. border-color: var(--sl-color-border);
  245. & > div, p {
  246. flex: 1;
  247. display: flex;
  248. align-items: center;
  249. }
  250. }
  251. p {
  252. letter-spacing: -0.03125rem;
  253. text-transform: uppercase;
  254. color: var(--sl-color-text-dimmed);
  255. @media (max-width: 30rem) {
  256. font-size: 0.75rem;
  257. }
  258. }
  259. img {
  260. align-self: center;
  261. width: 100%;
  262. max-width: 600px;
  263. height: auto;
  264. }
  265. & > div + div {
  266. border-width: 0 0 0 2px;
  267. }
  268. @media (max-width: 30rem) {
  269. & {
  270. flex-direction: column;
  271. }
  272. & > div + div {
  273. border-width: 2px 0 0 0;
  274. }
  275. }
  276. }
  277. section.approach {
  278. border-top: 2px solid var(--sl-color-border);
  279. padding: var(--padding);
  280. p + p {
  281. margin-top: var(--vertical-padding);
  282. }
  283. }
  284. section.footer {
  285. border-top: 2px solid var(--sl-color-border);
  286. display: flex;
  287. flex-direction: row;
  288. & > div {
  289. flex: 1;
  290. text-align: center;
  291. text-transform: uppercase;
  292. padding: calc(var(--padding) / 2) 0.5rem;
  293. }
  294. & > div + div {
  295. border-left: 2px solid var(--sl-color-border);
  296. }
  297. }
  298. </style>
  299. <style is:global>
  300. :root[data-has-hero] {
  301. header.header {
  302. display: none;
  303. }
  304. .main-frame {
  305. padding-top: 0;
  306. .main-pane > main {
  307. padding: 0;
  308. }
  309. }
  310. main > .content-panel .sl-markdown-content {
  311. margin-top: 0;
  312. }
  313. }
  314. </style>
  315. <script>
  316. const button = document.querySelector("button.command") as HTMLButtonElement;
  317. button?.addEventListener("click", () => {
  318. navigator.clipboard.writeText(button.dataset.command!);
  319. button.classList.toggle("success");
  320. setTimeout(() => {
  321. button.classList.toggle("success");
  322. }, 1500);
  323. });
  324. </script>