From f8350ba235a3e4063aea963529f6a540705799e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Mon, 12 Oct 2026 13:32:43 +0200 Subject: [PATCH 1/4] ops: adapt script to work on windows --- .gitattributes | 3 ++ scripts/bootstrap.sh | 97 +++++++++++++++++++++++++++++++++++--------- scripts/calepin.sh | 9 +++- 3 files changed, 88 insertions(+), 21 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..729a380 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Shell scripts and the Justfile must stay LF so they run in Git Bash on Windows. +*.sh text eol=lf +Justfile text eol=lf diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 363725c..55f5fe4 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,14 +1,16 @@ #!/usr/bin/env bash # Bootstrap the pinned toolchain (Calepin + Typst) into tools/. # Idempotent: skips downloads when the binaries are already in place. +# Supports x86_64 Linux and Windows (run through Git Bash / MSYS2). set -euo pipefail # Pinned toolchain -- bump both binaries together and re-verify checksums. calepin_version="0.0.61" typst_version="0.15.1" -# Typst publishes no .sha256 assets; this digest comes from the official -# release metadata (GitHub asset digest of typst-x86_64-unknown-linux-musl.tar.xz). -typst_sha256="a6d077d0a95eed5a2eba715b2dae06be954f624ccbf85758a03f389ded33118c" +# Typst publishes no .sha256 assets; these digests come from the official +# release metadata (GitHub asset digests of the downloads below). +typst_sha256_linux="a6d077d0a95eed5a2eba715b2dae06be954f624ccbf85758a03f389ded33118c" +typst_sha256_windows="19ce3551153c2fe7ee9fa2f95208310c8f4d3209fedb699e0333faf8913f6736" root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" tools="$root/tools" @@ -18,26 +20,83 @@ if [ "$(uname -m)" != "x86_64" ]; then exit 1 fi +case "$(uname -s)" in + Linux*) + exe="" + calepin_name="calepin-x86_64-unknown-linux-gnu.tar.xz" + typst_name="typst-x86_64-unknown-linux-musl.tar.xz" + typst_sha256="$typst_sha256_linux" + ;; + MINGW*|MSYS*|CYGWIN*) + exe=".exe" + calepin_name="calepin-x86_64-pc-windows-msvc.zip" + typst_name="typst-x86_64-pc-windows-msvc.zip" + typst_sha256="$typst_sha256_windows" + ;; + *) + echo "error: unsupported operating system $(uname -s)" >&2 + exit 1 + ;; +esac + +# Extract a single binary from a zip into tools/. The zip may or may not nest +# it in a top-level directory. Git Bash ships no unzip, so fall back to the +# bsdtar.exe bundled with Windows 10+. +install_zip_binary() { + local archive="$1" bin="$2" + local tmp="$tools/.extract" + rm -rf "$tmp" + mkdir -p "$tmp" + if command -v unzip >/dev/null 2>&1; then + unzip -q -o "$archive" -d "$tmp" + else + local wintar="" + if command -v cygpath >/dev/null 2>&1; then + wintar="$(cygpath -u "${SYSTEMROOT:-C:/Windows}")/System32/tar.exe" + fi + if [ -z "$wintar" ] || [ ! -x "$wintar" ]; then + echo "error: extracting $archive needs unzip or Windows tar.exe" >&2 + return 1 + fi + "$wintar" -xf "$archive" -C "$tmp" + fi + local found + found="$(find "$tmp" -type f -name "$bin" -print -quit)" + if [ -z "$found" ]; then + echo "error: $bin not found in $archive" >&2 + return 1 + fi + mv "$found" "$tools/$bin" + rm -rf "$tmp" +} + mkdir -p "$tools" -if [ ! -x "$tools/calepin" ]; then - name="calepin-x86_64-unknown-linux-gnu.tar.xz" +if [ ! -x "$tools/calepin$exe" ]; then + # Calepin publishes .sha256 assets next to its downloads. base="https://github.com/vincentarelbundock/calepin/releases/download/v$calepin_version" - curl -fsSLo "$tools/$name" "$base/$name" - curl -fsSLo "$tools/$name.sha256" "$base/$name.sha256" - (cd "$tools" && sha256sum -c "$name.sha256") - tar -xJf "$tools/$name" -C "$tools" --strip-components=1 "calepin-x86_64-unknown-linux-gnu/calepin" - rm "$tools/$name" "$tools/$name.sha256" + curl -fsSLo "$tools/$calepin_name" "$base/$calepin_name" + curl -fsSLo "$tools/$calepin_name.sha256" "$base/$calepin_name.sha256" + (cd "$tools" && sha256sum -c "$calepin_name.sha256") + if [ "$exe" ]; then + install_zip_binary "$tools/$calepin_name" "calepin.exe" + else + tar -xJf "$tools/$calepin_name" -C "$tools" --strip-components=1 "${calepin_name%.tar.xz}/calepin" + fi + rm "$tools/$calepin_name" "$tools/$calepin_name.sha256" fi -if [ ! -x "$tools/typst" ]; then - name="typst-x86_64-unknown-linux-musl.tar.xz" - curl -fsSLo "$tools/$name" "https://github.com/typst/typst/releases/download/v$typst_version/$name" - echo "$typst_sha256 $name" > "$tools/$name.sha256" - (cd "$tools" && sha256sum -c "$name.sha256") - tar -xJf "$tools/$name" -C "$tools" --strip-components=1 "typst-x86_64-unknown-linux-musl/typst" - rm "$tools/$name" "$tools/$name.sha256" +if [ ! -x "$tools/typst$exe" ]; then + curl -fsSLo "$tools/$typst_name" "https://github.com/typst/typst/releases/download/v$typst_version/$typst_name" + echo "$typst_sha256 $typst_name" > "$tools/$typst_name.sha256" + (cd "$tools" && sha256sum -c "$typst_name.sha256") + if [ "$exe" ]; then + install_zip_binary "$tools/$typst_name" "typst.exe" + else + tar -xJf "$tools/$typst_name" -C "$tools" --strip-components=1 "${typst_name%.tar.xz}/typst" + fi + rm "$tools/$typst_name" "$tools/$typst_name.sha256" fi -"$tools/calepin" --version -"$tools/typst" --version +"$tools/calepin$exe" --version +"$tools/typst$exe" --version diff --git a/scripts/calepin.sh b/scripts/calepin.sh index b8ca051..d81148e 100755 --- a/scripts/calepin.sh +++ b/scripts/calepin.sh @@ -4,9 +4,14 @@ set -euo pipefail root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -if [ ! -x "$root/tools/calepin" ]; then +exe="" +case "$(uname -s)" in + MINGW*|MSYS*|CYGWIN*) exe=".exe" ;; +esac + +if [ ! -x "$root/tools/calepin$exe" ]; then "$root/scripts/bootstrap.sh" fi export PATH="$root/tools:$PATH" -exec "$root/tools/calepin" "$@" +exec "$root/tools/calepin$exe" "$@" -- 2.54.0 From 49e6820eae9a5bd4bf99882f8dcd5207080b85df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Mon, 12 Oct 2026 14:05:28 +0200 Subject: [PATCH 2/4] feat(cs): add tools section --- .gitignore | 2 +- site/calepin.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a732407..52652cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Generated site and pinned toolchain public/ -tools/ +/tools/ # Calepin build artifacts .calepin/ diff --git a/site/calepin.toml b/site/calepin.toml index a01f9d7..0d1a17a 100644 --- a/site/calepin.toml +++ b/site/calepin.toml @@ -63,6 +63,10 @@ item = [ { target = "cs/index.typ" }, { glob = "cs/*" } ] +section = [ + { title = "Tools", item = [{ glob = "cs/tools/*.typ" }] } +] + [[sidebar.section]] -- 2.54.0 From 6436f528898833960b4165e01800d87c2ce4f259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Mon, 12 Oct 2026 14:05:52 +0200 Subject: [PATCH 3/4] feat(cs): add initial git doc --- site/cs/tools/git.typ | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 site/cs/tools/git.typ diff --git a/site/cs/tools/git.typ b/site/cs/tools/git.typ new file mode 100644 index 0000000..04452a3 --- /dev/null +++ b/site/cs/tools/git.typ @@ -0,0 +1,85 @@ +#import "/lib/lib.typ": * +#set document(title: [Git]) +#metadata(( + title: "Git", + translation_key: "git", + summary: "What's git and lot of usefull command" +)) +#calepin.setup(eval: false) + += What's Git +This is git + += Bascis command +TODO: +- fetch +- pull +- push +- commit (with sign) +- checkout +- rebase + + += Config +Git config live in `~/.gitconfig` + +== User +In User section, we can specify default `name` and `email`: +```yaml +[user] + name = Rémi Heredero + email = remi@heredero.ch +``` + +== Signing +To sign commit and tag by default, you can set the flag on the configfile: +```yaml +[commit] + gpgsign = true +[tag] + gpgSign = true +``` +You also probably want to specify your default gpg key in the user section: +```yaml +[user] + signingkey = 4A8C1907D8B15B47 +``` + +Sometime (often in windows), you need to specify the path of the gpg program with: +```yaml +[gpg] + program = C:/Users/her/dev/GnuPG/bin/gpg.exe +``` + +== Default editor +You can define a default editor to edit commit message or solve conflict. In my case, my favourite code editor is Zed, so: +```yaml +[core] + editor = zed --wait +``` + +== Include If +You maybe want a different config for some repo. It's easy to do that with `includeIf`. You can define a gitconfig overlay to apply to a specific repository: +```yaml +[includeIf "gitdir:"] + path = ~/.gitconfig-work +``` += Advanced command + +== Reset author +If you didn't use the right config for commiting somewhere, you can reset the author of commit with the following command. + +=== Single commit +```sh +git commit --amend --no-edit --reset-author +``` + +=== Entire project history +```sh +git rebase -r --root --exec "git commit --amend --no-edit --reset-author" +``` + +=== From a specific commit +```sh +git rebase -r --exec "git commit --amend --no-edit --reset-author" +``` -- 2.54.0 From 7b34f5a5892531190e6a8266d6234aeb706be8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Heredero?= Date: Mon, 12 Oct 2026 14:06:04 +0200 Subject: [PATCH 4/4] feat(cs): add initial lazygit doc --- site/cs/tools/lazygit.typ | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 site/cs/tools/lazygit.typ diff --git a/site/cs/tools/lazygit.typ b/site/cs/tools/lazygit.typ new file mode 100644 index 0000000..5c46d91 --- /dev/null +++ b/site/cs/tools/lazygit.typ @@ -0,0 +1,25 @@ +#import "/lib/lib.typ": * +#set document(title: [Lazygit]) +#metadata(( + title: "Lazygit", + translation_key: "lazygit", + summary: "Simple TUI for git commands build in GO" +)) +#calepin.setup(eval: false) + += Install +TODO + += Config file +On linux: +`~/.config/lazygit/config.yml` + +On Windows: +`%USERPROFILE%\AppData\Local\lazygit\config.yml ` + += Disable auto-fetch +Add the following code in your config gile: +```yaml +git: + autoFetch: false +``` -- 2.54.0