Files
codecraft/web/src/components/settings/CliInstall.tsx
T
Richard ZinkandClaude Opus 5.5 ed9942829a Release 0.1.0: MIT license, changelog, multi-arch Docker image without CLI builds
- LICENSE (MIT), CHANGELOG for 0.1.0, README overhaul
- docker-compose.release.yml pulling the registry image
- Dockerfile cross-compiles the server with cargo-zigbuild for amd64 and arm64;
  the terminal client is no longer built into the image
- Server, install script and settings point to a source install of the
  terminal client when no prebuilt binaries are available (/info: cli_builds)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 07:50:57 +01:00

52 lines
1.9 KiB
TypeScript

import { useT } from "../../i18n";
import { toast } from "../../dialogs";
import { Icon } from "../Icon";
import { useFetch } from "../../hooks";
import type { Info } from "../../types";
/** How to install and use the terminal client. */
export function CliInstall() {
const t = useT();
const prebuilt = useFetch<Info>("/info").data?.cli_builds ?? false;
const cmd = prebuilt
? `curl -fsSL ${location.origin}/cli/install.sh | sh`
: "cargo install --locked --git https://git.familie-zink.org/zink/codecraft codecraft-cli";
const copy = (s: string) => navigator.clipboard.writeText(s).then(() => toast(t("tokens.copied"), "success"));
return (
<div className="panel">
<h3>
<Icon name="terminal" /> {t("cli.title")}
</h3>
<div className="hint" style={{ marginBottom: 10 }}>
{t("cli.intro")}
</div>
<ol className="cli-steps">
<li>
{t(prebuilt ? "cli.step1" : "cli.step1Source")}
<div className="row" style={{ gap: 6, marginTop: 4 }}>
<code className="token-value">{cmd}</code>
<button className="small" onClick={() => copy(cmd)}>
<Icon name="copy" /> {t("tokens.copy")}
</button>
</div>
</li>
<li>
{t("cli.step2")}
<div className="row" style={{ gap: 6, marginTop: 4 }}>
<code className="token-value">{`codecraft login ${location.origin}`}</code>
<button className="small" onClick={() => copy(`codecraft login ${location.origin}`)}>
<Icon name="copy" /> {t("tokens.copy")}
</button>
</div>
</li>
<li>{t("cli.step3")}</li>
</ol>
{prebuilt && (
<div className="hint">
{t("cli.downloads")} <a href="/cli/download/linux-x86_64">Linux x86_64</a> · <a href="/cli/download/linux-aarch64">Linux arm64</a>
</div>
)}
</div>
);
}