Skip to content
Back to search

grip

grip: pass the whiteboard defense before you push. A quiz on your own diff.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/guilyx--grip/badge.svg)](/listings/guilyx--grip)

HTML

<a href="/listings/guilyx--grip"><img src="/api/listings/guilyx--grip/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

pipx install grip-hook        # or: uv tool install grip-hook

Python 3.11 or newer, on Linux, macOS or Windows. This installs the `grip` command and a `git grip` alias.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 24 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. {
  2. "name": "grip",
  3. "owner": {
  4. "name": "Erwin L.",
  5. "url": "https://github.com/guilyx"
  6. },
  7. "description": "grip: pass the whiteboard defense before you push. A quiz on your own diff.",
  8. "plugins": [
  9. {
  10. "name": "grip",
  11. "source": "./",
  12. "description": "Quiz yourself on your diff before Claude pushes it. /grip asks five questions; a hook blocks `git push` until the diff has passed.",
  13. "version": "0.5.0",
  14. "author": {
  15. "name": "Erwin L."
  16. },
  17. "homepage": "https://guilyx.github.io/grip/agents/",
  18. "repository": "https://github.com/guilyx/grip",
  19. "license": "BSD-3-Clause",
  20. "category": "Development",
  21. "keywords": ["git", "hook", "quiz", "code-review", "understanding"]
  22. }
  23. ]
  24. }
README.md · README · 142 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # grip
  2. **A git hook that won't let you push code you can't explain.**
  3. [![CI](https://github.com/guilyx/grip/actions/workflows/ci.yml/badge.svg)](https://github.com/guilyx/grip/actions/workflows/ci.yml)
  4. [![PyPI](https://img.shields.io/pypi/v/grip-hook)](https://pypi.org/project/grip-hook/)
  5. [![Python](https://img.shields.io/pypi/pyversions/grip-hook)](https://pypi.org/project/grip-hook/)
  6. [![Docs](https://img.shields.io/badge/docs-guilyx.github.io%2Fgrip-ff8644)](https://guilyx.github.io/grip/)
  7. [![License: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](https://github.com/guilyx/grip/blob/main/LICENSE)
  8. ![grip whiteboard: the change drawn as parts and arrows, with a question about a malicious client pinned to it](https://raw.githubusercontent.com/guilyx/grip/main/docs/assets/whiteboard.png)
  9. Before your code leaves your machine, grip reads the diff and asks you about it: why it is
  10. built this way, where it fails, what a malicious caller could do, how you know it works.
  11. In the terminal, or on a whiteboard of your change in the browser. A model grades your
  12. answers out of 100. Below your team's pass mark, the push waits.
  13. It checks the developer, not the code. Let AI write it; just be able to defend it.
  14. **[Follow one real change from commit to push](https://guilyx.github.io/grip/walkthrough/)**
  15. to see what it asks and how it grades.
  16. > "If I ask 'why did you do X instead of Y?', 'what happens if this actor behaves
  17. > maliciously?' [...] you should be able to answer confidently."
  18. > Mitchell Hashimoto, [on X](https://x.com/mitchellh/status/2100249348345057389), about
  19. > [the whiteboard defense](https://guilyx.github.io/grip/whiteboard-defense/) (not affiliated with grip)
  20. ## Try it in 30 seconds
  21. No hook, no account, no API key: the `fake` provider runs the whole flow offline.
  22. ```bash
  23. pipx install grip-hook # or: uv tool install grip-hook
  24. mkdir try-grip && cd try-grip && git init -q
  25. echo 'def add(a, b): return a + b' > math.py && git add math.py
  26. grip quiz --provider fake # five questions in your terminal
  27. grip whiteboard --provider fake # the same, drawn in your browser
  28. ```
  29. The offline grader does not read your answers, it only checks their length: twenty
  30. characters, or the word "because", gets full marks. Any long answer passes and a row of
  31. "idk" fails, so this shows the flow, not the grading. For questions written from your diff
  32. and real grading, use a model you have (`--provider claude-code`, `codex`, `gemini` or
  33. `anthropic`), or read the [walkthrough](https://guilyx.github.io/grip/walkthrough/).
  34. Nothing is blocked until you install the hook with `grip init`.
  35. ## Features
  36. - **Five questions from your diff**, graded against a hidden rubric into a Grip Score out
  37. of 100. Never line numbers or trivia.
  38. - **`grip whiteboard`**: your change drawn as parts and arrows in the browser, with the
  39. questions pinned to it, including what a malicious actor could do. Set
  40. `hook_mode = "whiteboard"` and every push is defended there.
  41. - **Works with what you have**: reuse Claude Code, Codex or Gemini CLI as the model (no
  42. API key), or use Anthropic, any OpenAI-compatible API, or Ollama locally.
  43. - **Inside coding agents**: `/grip` in Claude Code, Codex, Gemini CLI, Cursor and others,
  44. and a gate that keeps the agent from pushing until you pass.
  45. - **Out of the way when it should be**: a passed diff is remembered, a retry reuses its
  46. questions so only grading costs a call, `grip skip` lets one push through, CI and
  47. non-interactive runs are skipped.
  48. ## Installation
  49. ```bash
  50. pipx install grip-hook # or: uv tool install grip-hook
  51. ```
  52. Python 3.11 or newer, on Linux, macOS or Windows. This installs the `grip` command and a
  53. `git grip` alias.
  54. ## Quick start
  55. ![grip blocking a push with lazy answers, then letting it through after real ones](https://raw.githubusercontent.com/guilyx/grip/main/docs/assets/demo.gif)
  56. ```bash
  57. cd your-repo
  58. grip init # writes .grip.toml, installs the pre-push hook
  59. git push # grip asks five questions first
  60. ```
  61. `grip init` writes `provider = "auto"`: each machine uses Claude Code, Codex or Gemini CLI
  62. when one is installed. Otherwise set `ANTHROPIC_API_KEY`, or see
  63. [Providers](https://guilyx.github.io/grip/providers/).
  64. Other commands you will use:
  65. ```bash
  66. grip quiz # quiz your staged changes now, no hook needed
  67. grip quiz --branch # quiz the whole branch since main: your pull request
  68. grip whiteboard # defend the change in the browser
  69. grip quiz --provider fake # try the flow offline (grades by length only)
  70. grip skip # let the next push through
  71. grip status # hooks, last score, configuration
  72. ```
  73. The [walkthrough](https://guilyx.github.io/grip/walkthrough/) follows one real change from
  74. `git commit` to an accepted push.
  75. ## Configuration
  76. `.grip.toml` at the root of the repository, committed so the team shares one bar:
  77. ```toml
  78. passing_score = 70 # 0-100
  79. difficulty = "normal" # easy | normal | hard
  80. provider = "claude-code" # auto | anthropic | claude-code | codex | gemini | openai | ollama
  81. ```
  82. Every option, environment variables and the pre-commit framework hook are in the
  83. [configuration reference](https://guilyx.github.io/grip/configuration/).
  84. ## Documentation
  85. **[guilyx.github.io/grip](https://guilyx.github.io/grip/)**: getting started, a
  86. walkthrough, coding agents, the whiteboard, how grip works inside, and the honest numbers
  87. on what the score does and does not measure.
  88. ## Contributing
  89. Issues and pull requests are welcome. See [CONTRIBUTING.md](https://github.com/guilyx/grip/blob/main/CONTRIBUTING.md)
  90. for the development setup and [SECURITY.md](https://github.com/guilyx/grip/blob/main/SECURITY.md)
  91. for reporting vulnerabilities and what data grip sends. This project follows a
  92. [code of conduct](https://github.com/guilyx/grip/blob/main/CODE_OF_CONDUCT.md).
  93. ## Citation
  94. If grip is part of a study or a course, please cite it; GitHub's "Cite this repository"
  95. button reads [CITATION.cff](https://github.com/guilyx/grip/blob/main/CITATION.cff).
  96. ## License
  97. [BSD-3-Clause](https://github.com/guilyx/grip/blob/main/LICENSE). Copyright (c) 2026, Erwin L.
  98. ## Star history
  99. <a href="https://star-history.com/#guilyx/grip&Date">
  100. <picture>
  101. <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=guilyx/grip&type=Date&logscale&theme=dark" />
  102. <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=guilyx/grip&type=Date&logscale" />
  103. <img alt="Star history of guilyx/grip" src="https://api.star-history.com/svg?repos=guilyx/grip&type=Date&logscale" />
  104. </picture>
  105. </a>
install.sh · Bundled script · 73 lines · 1 finding marked
  1. #!/bin/sh
  2. # grip installer
  3. #
  4. # curl -fsSL https://raw.githubusercontent.com/guilyx/grip/main/install.sh | sh
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 4 on GitHub
  5. #
  6. # Installs grip from PyPI (the grip-hook package) as a command-line tool, with uv when it
  7. # is there and pipx otherwise. You get `grip` and a `git grip` alias. The same as running
  8. # `uv tool install grip-hook` or `pipx install grip-hook` yourself.
  9. #
  10. # Options (pass after `sh -s --` when piping):
  11. # --version X.Y.Z install a specific version (default: latest)
  12. # --uninstall remove grip
  13. # -h, --help show this help
  14. #
  15. # Environment overrides: GRIP_VERSION, GRIP_PACKAGE (a name, wheel path or URL).
  16. set -eu
  17. PACKAGE="${GRIP_PACKAGE:-grip-hook}"
  18. VERSION="${GRIP_VERSION:-}"
  19. UNINSTALL=0
  20. say() { printf '%s\n' "grip: $*"; }
  21. die() { printf '%s\n' "grip: error: $*" >&2; exit 1; }
  22. usage() {
  23. sed -n '2,15p' "$0" 2>/dev/null | sed 's/^# \{0,1\}//' || true
  24. }
  25. while [ $# -gt 0 ]; do
  26. case "$1" in
  27. --version) [ $# -ge 2 ] || die "--version needs a value"; VERSION="$2"; shift 2 ;;
  28. --version=*) VERSION="${1#*=}"; shift ;;
  29. --uninstall) UNINSTALL=1; shift ;;
  30. -h | --help) usage; exit 0 ;;
  31. *) die "unknown option: $1 (try --help)" ;;
  32. esac
  33. done
  34. VERSION="${VERSION#v}"
  35. spec="$PACKAGE"
  36. [ -n "$VERSION" ] && spec="$PACKAGE==$VERSION"
  37. if command -v uv >/dev/null 2>&1; then
  38. tool=uv
  39. elif command -v pipx >/dev/null 2>&1; then
  40. tool=pipx
  41. else
  42. die "grip installs with uv or pipx and neither is on PATH. Get uv with
  43. curl -LsSf https://astral.sh/uv/install.sh | sh
  44. then run this again, or run: uv tool install grip-hook"
  45. fi
  46. if [ "$UNINSTALL" = 1 ]; then
  47. case "$tool" in
  48. uv) uv tool uninstall grip-hook ;;
  49. pipx) pipx uninstall grip-hook ;;
  50. esac
  51. exit 0
  52. fi
  53. say "installing $spec with $tool"
  54. # --force replaces an older grip on PATH, such as a binary from an earlier install.sh.
  55. case "$tool" in
  56. uv) uv tool install --force "$spec" ;;
  57. pipx) pipx install --force "$spec" ;;
  58. esac
  59. if command -v grip >/dev/null 2>&1; then
  60. say "installed $(grip --version)"
  61. else
  62. say "installed, but grip is not on your PATH yet. Run '$tool ensurepath' (uv: 'uv tool update-shell') and open a new shell."
  63. fi
  64. say "next: cd into a repository and run 'grip init' (docs: https://guilyx.github.io/grip/)"
scripts/launch/make_launch.py · Bundled script · 354 lines · 2 findings marked
  1. """Build the launch assets from the recorded demo.
  2. python scripts/launch/make_launch.py
  3. Writes to ``docs/assets``:
  4. * ``demo.mp4``: the demo as H.264, for LinkedIn, X and anything that dislikes WebM.
  5. * ``launch/grip-producthunt-1270x760.png``: Product Hunt gallery image.
  6. * ``launch/grip-thumbnail-240.png`` and ``-480.png``: the mark, square.
  7. * ``launch/grip-launch-1080p.mp4``: an 84 second launch video, title cards around the demo,
  8. with a silent stereo track so upload sites treat it as a normal video.
  9. Needs the ``demo`` extra (Pillow, imageio-ffmpeg) and ``docs/assets/demo.webm`` from
  10. ``scripts/demo/make_demo.py``. Colours, fonts and the mark come from
  11. ``scripts/demo/brandkit.py``, so everything matches the docs and ``branding/``.
  12. """
  13. from __future__ import annotations
  14. import shutil
  15. import subprocess
  16. import sys
  17. from pathlib import Path
  18. from PIL import Image, ImageDraw, ImageFilter, ImageFont
  19. ROOT = Path(__file__).resolve().parents[2]
  20. sys.path.insert(0, str(ROOT / "scripts" / "demo"))
  21. from brandkit import colour, dot_grid, mark_image # noqa: E402
  22. from brandkit import font as brand_font # noqa: E402
  23. ASSETS = ROOT / "docs" / "assets"
  24. OUT = ASSETS / "launch"
  25. DEMO = ASSETS / "demo.webm"
  26. DEMO_MP4 = ASSETS / "demo.mp4"
  27. # Frames of the demo where the two score panels are fully drawn.
  28. FAIL_AT, PASS_AT = 16.0, 49.0
  29. DEMO_SECONDS = 54.0
  30. BG = colour("graphite-975")
  31. CARD = colour("graphite-950")
  32. FG = colour("graphite-50")
  33. DIM = colour("graphite-300")
  34. MUTED = colour("graphite-500")
  35. EMBER = colour("ember-400")
  36. CODE = colour("ember-300")
  37. PASS = colour("jade-300")
  38. FAIL = colour("berry-300")
  39. # Launch kinds to brand fonts: Archivo for display, Instrument Sans for text.
  40. KINDS = {"bold": "display-800", "regular": "text", "strong": "text-bold", "mono": "mono",
  41. "wordmark": "display"} # fmt: skip
  42. def font(kind: str, size: int) -> ImageFont.FreeTypeFont:
  43. """The brand font for ``kind`` at ``size`` pixels."""
  44. return brand_font(KINDS[kind], size)
  45. def fit(
  46. d: ImageDraw.ImageDraw, text: str, kind: str, size: int, width: float
  47. ) -> ImageFont.FreeTypeFont:
  48. """``font(kind, size)``, shrunk until ``text`` fits in ``width`` pixels."""
  49. f = font(kind, size)
  50. while size > 8 and d.textlength(text, font=f) > width:
  51. size -= 1
  52. f = font(kind, size)
  53. return f
  54. def find_ffmpeg() -> str:
  55. """An ffmpeg with libx264: imageio-ffmpeg's bundled build, else one on PATH."""
  56. try:
  57. import imageio_ffmpeg # noqa: PLC0415 - optional dependency
  58. return str(imageio_ffmpeg.get_ffmpeg_exe())
  59. except ImportError:
  60. pass
  61. found = shutil.which("ffmpeg")
  62. if found:
  63. return found
  64. raise SystemExit("ffmpeg not found: pip install imageio-ffmpeg, or install ffmpeg")
  65. FF = find_ffmpeg()
  66. def ffmpeg(*args: str) -> None:
  67. """Run ffmpeg quietly, overwriting outputs."""
  68. subprocess.run([FF, "-y", "-hide_banner", "-loglevel", "error", *args], check=True)
  69. # --------------------------------------------------------------------------- drawing helpers
  70. def surface(size: tuple[int, int]) -> Image.Image:
  71. """The brand surface: graphite-975 with the faint dot grid."""
  72. img = Image.new("RGB", size, BG)
  73. dot_grid(ImageDraw.Draw(img), *size, step=max(28, size[0] // 60))
  74. return img
  75. def rounded(img: Image.Image, radius: int) -> Image.Image:
  76. """``img`` with rounded corners (alpha)."""
  77. mask = Image.new("L", img.size, 0)
  78. ImageDraw.Draw(mask).rounded_rectangle((0, 0, img.width - 1, img.height - 1), radius, fill=255)
  79. out = img.convert("RGBA")
  80. out.putalpha(mask)
  81. return out
  82. def shadowed(canvas: Image.Image, card: Image.Image, xy: tuple[int, int], blur: int = 28) -> None:
  83. """Paste ``card`` on ``canvas`` with a soft drop shadow."""
  84. x, y = xy
  85. shadow = Image.new("RGBA", (card.width + blur * 4, card.height + blur * 4), (0, 0, 0, 0))
  86. ImageDraw.Draw(shadow).rounded_rectangle(
  87. (blur * 2, blur * 2 + 10, blur * 2 + card.width, blur * 2 + card.height + 10),
  88. 18,
  89. fill=(0, 0, 0, 170),
  90. )
  91. shadow = shadow.filter(ImageFilter.GaussianBlur(blur))
  92. canvas.alpha_composite(shadow, (x - blur * 2, y - blur * 2))
  93. canvas.alpha_composite(card, (x, y))
  94. def label(
  95. d: ImageDraw.ImageDraw, xy: tuple[int, int], text: str, color: str, f: ImageFont.FreeTypeFont
  96. ) -> None:
  97. """A small outlined tag."""
  98. x, y = xy
  99. tw = d.textlength(text, font=f)
  100. d.rounded_rectangle((x, y, x + tw + 22, y + f.size + 14), 8, fill=CARD, outline=color, width=2)
  101. d.text((x + 11, y + 7 - f.getbbox(text)[1]), text, fill=color, font=f)
  102. def centred(
  103. d: ImageDraw.ImageDraw,
  104. y: float,
  105. text: str,
  106. color: str,
  107. f: ImageFont.FreeTypeFont,
  108. *,
  109. width: int,
  110. ) -> None:
  111. """Draw ``text`` centred horizontally at ``y``."""
  112. d.text(((width - d.textlength(text, font=f)) / 2, y), text, fill=color, font=f)
  113. # --------------------------------------------------------------------------- assets
  114. def demo_frames(workdir: Path) -> tuple[Image.Image, Image.Image]:
  115. """The blocked and passed frames of the demo."""
  116. fail, pas = workdir / "fail.png", workdir / "pass.png"
  117. ffmpeg("-ss", str(FAIL_AT), "-i", str(DEMO), "-frames:v", "1", str(fail))
  118. ffmpeg("-ss", str(PASS_AT), "-i", str(DEMO), "-frames:v", "1", str(pas))
  119. return Image.open(fail), Image.open(pas)
  120. def demo_mp4() -> Path:
  121. """The demo as H.264 MP4 with a faststart header."""
  122. ffmpeg(
  123. "-i", str(DEMO),
  124. "-vf", "scale=trunc(iw/2)*2:trunc(ih/2)*2",
  125. "-c:v", "libx264", "-pix_fmt", "yuv420p", "-profile:v", "high", "-crf", "18",
  126. "-preset", "slow", "-r", "24", "-movflags", "+faststart", "-an", str(DEMO_MP4),
  127. ) # fmt: skip
  128. return DEMO_MP4
  129. def gallery(fail_frame: Image.Image, pass_frame: Image.Image) -> Path:
  130. """Product Hunt gallery image: pitch on the left, the two real score panels on the right."""
  131. w, h = 1270, 760
  132. img = surface((w, h)).convert("RGBA")
  133. scale = 0.64
  134. fail = fail_frame.crop((10, 480, 890, 590))
  135. pas = pass_frame.crop((10, 222, 890, 588))
  136. fail = fail.resize((int(fail.width * scale), int(fail.height * scale)), Image.LANCZOS)
  137. pas = pas.resize((int(pas.width * scale), int(pas.height * scale)), Image.LANCZOS)
  138. cx = w - fail.width - 48
  139. column = cx - 72 - 48
  140. x = 72
  141. img.alpha_composite(mark_image(84), (x, 92))
  142. d = ImageDraw.Draw(img)
  143. d.text((x + 108, 84), "grip", fill=FG, font=font("wordmark", 92))
  144. d.text((x, 206), "keep a grip on your code", fill=EMBER, font=font("strong", 26))
  145. y = 270
  146. head = ("A git hook that quizzes", "you on your own diff", "before you push.")
  147. hf = fit(d, max(head, key=len), "bold", 42, column)
  148. for line in head:
  149. d.text((x, y), line, fill=FG, font=hf)
  150. y += hf.size + 12
  151. y += 24
  152. for line in ("5 questions. A score out of 100.", "Under the pass mark, the push is blocked."):
  153. d.text((x, y), line, fill=DIM, font=font("regular", 24))
  154. y += 34
  155. y += 26
  156. install = "curl -fsSL guilyx.github.io/grip/install.sh | sh"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 201 on GitHub
  157. d.text((x, y), install, fill=CODE, font=fit(d, install, "mono", 19, column))
  158. y += 40
  159. providers = "Claude Code · Codex · Gemini CLI · API key · Ollama"
  160. d.text((x, y), providers, fill=MUTED, font=fit(d, providers, "regular", 19, column))
  161. d.text((x, h - 58), "github.com/guilyx/grip", fill=MUTED, font=font("mono", 19))
  162. shadowed(img, rounded(fail, 14), (cx, 96))
  163. shadowed(img, rounded(pas, 14), (cx, 96 + fail.height + 70))
  164. d = ImageDraw.Draw(img)
  165. small = font("strong", 17)
  166. label(d, (cx, 96 + fail.height + 16), "lazy answers", FAIL, small)
  167. label(d, (cx, 96 + fail.height + 70 + pas.height + 16), "after reading the diff", PASS, small)
  168. path = OUT / "grip-producthunt-1270x760.png"
  169. img.convert("RGB").save(path, optimize=True)
  170. return path
  171. def thumbnail() -> Path:
  172. """Square icon: the mark on its tile."""
  173. img = mark_image(480)
  174. img.resize((240, 240), Image.LANCZOS).save(OUT / "grip-thumbnail-240.png", optimize=True)
  175. path = OUT / "grip-thumbnail-480.png"
  176. img.save(path, optimize=True)
  177. return path
  178. def card(lines: list[tuple[str, str, str, int]], *, mark: int = 0) -> Image.Image:
  179. """A 1920x1080 title card. ``lines`` are (text, font kind, colour, size), centred."""
  180. w, h = 1920, 1080
  181. img = surface((w, h)).convert("RGBA")
  182. d = ImageDraw.Draw(img)
  183. fonts = [fit(d, text, kind, size, w - 240) for text, kind, _, size in lines]
  184. gap = 26
  185. total = sum(f.size for f in fonts) + gap * (len(lines) - 1) + (mark + 48 if mark else 0)
  186. y = (h - total) / 2 - 20
  187. if mark:
  188. img.alpha_composite(mark_image(mark), ((w - mark) // 2, int(y)))
  189. y += mark + 48
  190. for (text, _, color, _), f in zip(lines, fonts, strict=True):
  191. top = f.getbbox(text)[1] if text else 0
  192. centred(d, y - top, text, color, f, width=w)
  193. y += f.size + gap
  194. return img.convert("RGB")
  195. def backdrop() -> Image.Image:
  196. """The frame the demo plays in."""
  197. w, h = 1920, 1080
  198. img = surface((w, h)).convert("RGBA")
  199. img.alpha_composite(mark_image(56), (70, 34))
  200. d = ImageDraw.Draw(img)
  201. d.text((142, 30), "grip", fill=FG, font=font("wordmark", 44))
  202. context = "pre-commit hook · amr-safety · a ROS 2 cmd_vel filter gains a scan watchdog"
  203. d.text((290, 50), context, fill=MUTED, font=font("regular", 24))
  204. f = font("mono", 24)
  205. url = "github.com/guilyx/grip"
  206. d.text((w - 70 - d.textlength(url, font=f), 50), url, fill=MUTED, font=f)
  207. return img.convert("RGB")
  208. CARDS: list[tuple[str, float, list[tuple[str, str, str, int]]]] = [
  209. ("c1", 3.5, [("grip", "wordmark", FG, 200), ("keep a grip on your code", "strong", EMBER, 52)]),
  210. ("c2", 4.0, [
  211. ("We ship more code with AI than ever.", "bold", FG, 76),
  212. ("And explain less of it.", "bold", DIM, 76),
  213. ]),
  214. ("c3", 5.0, [
  215. ("Ask a dev to walk you through a PR from last week.", "regular", FG, 56),
  216. ("Why that guard clause is there.", "regular", DIM, 56),
  217. ("What happens when the list is empty.", "regular", DIM, 56),
  218. ]),
  219. ("c4", 4.0, [
  220. ("grip quizzes you on your own diff", "bold", FG, 76),
  221. ("before it goes upstream.", "bold", EMBER, 76),
  222. ]),
  223. ("c5", 3.5, [
  224. ("5 questions · score out of 100", "bold", FG, 64),
  225. ("under the pass mark, the push is blocked", "regular", DIM, 48),
  226. ]),
  227. ("demo", DEMO_SECONDS, []),
  228. ("c6", 5.0, [
  229. ("One curl to install.", "bold", FG, 72),
  230. ("curl -fsSL guilyx.github.io/grip/install.sh | sh", "mono", CODE, 40),
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 285 on GitHub
  231. ("", "regular", FG, 10),
  232. ("Claude Code · Codex · Gemini CLI · API key · Ollama", "regular", DIM, 40),
  233. ]),
  234. ("c7", 5.0, [
  235. ("Owning your code is still on you.", "bold", FG, 76),
  236. ("github.com/guilyx/grip", "mono", EMBER, 48),
  237. ]),
  238. ] # fmt: skip
  239. # Cards that open and close the video carry the mark.
  240. MARKED = {"c1": 160, "c7": 112}
  241. def launch_video(workdir: Path) -> Path:
  242. """Title cards, the demo in a frame, closing cards; 1080p, 24 fps, fades between segments."""
  243. fade = 0.5
  244. inputs: list[str] = []
  245. filters: list[str] = []
  246. idx = 0
  247. for name, seconds, lines in CARDS:
  248. if name == "demo":
  249. bd = workdir / "backdrop.png"
  250. backdrop().save(bd)
  251. inputs += ["-i", str(bd), "-i", str(DEMO)]
  252. filters.append(
  253. f"[{idx}:v]loop=loop=-1:size=1:start=0,fps=24,trim=duration={seconds},"
  254. f"setpts=PTS-STARTPTS[bd];"
  255. f"[{idx + 1}:v]fps=24,scale=1230:916:flags=lanczos,setpts=PTS-STARTPTS[dm];"
  256. f"[bd][dm]overlay=(W-w)/2:120:shortest=1,"
  257. f"fade=t=in:st=0:d={fade},fade=t=out:st={seconds - fade}:d={fade},"
  258. f"format=yuv420p[v{name}]"
  259. )
  260. idx += 2
  261. continue
  262. png = workdir / f"{name}.png"
  263. card(lines, mark=MARKED.get(name, 0)).save(png)
  264. inputs += ["-loop", "1", "-t", str(seconds), "-i", str(png)]
  265. filters.append(
  266. f"[{idx}:v]fps=24,fade=t=in:st=0:d={fade},fade=t=out:st={seconds - fade}:d={fade},"
  267. f"format=yuv420p[v{name}]"
  268. )
  269. idx += 1
  270. concat = "".join(f"[v{name}]" for name, _, _ in CARDS) + f"concat=n={len(CARDS)}:v=1:a=0[v]"
  271. out = OUT / "grip-launch-1080p.mp4"
  272. ffmpeg(
  273. *inputs,
  274. "-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate=48000",
  275. "-filter_complex", ";".join([*filters, concat]),
  276. "-map", "[v]", "-map", f"{idx}:a",
  277. "-c:v", "libx264", "-preset", "slow", "-crf", "18", "-r", "24",
  278. "-c:a", "aac", "-b:a", "96k", "-shortest", "-movflags", "+faststart", str(out),
  279. ) # fmt: skip
  280. return out
  281. def main() -> None:
  282. """Build everything."""
  283. if not DEMO.exists():
  284. raise SystemExit(f"{DEMO} is missing; run scripts/demo/make_demo.py first")
  285. OUT.mkdir(parents=True, exist_ok=True)
  286. workdir = ROOT / "build" / "launch"
  287. workdir.mkdir(parents=True, exist_ok=True)
  288. fail_frame, pass_frame = demo_frames(workdir)
  289. for path in (demo_mp4(), gallery(fail_frame, pass_frame), thumbnail(), launch_video(workdir)):
  290. print(f"wrote {path.relative_to(ROOT)} ({path.stat().st_size / 1e6:.1f} MB)")
  291. if __name__ == "__main__":
  292. sys.exit(main())

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.