From 4d9fbdeed5067de26d8eac3579e8b462b99352a3 Mon Sep 17 00:00:00 2001 From: igm Date: Sun, 11 Jan 2026 12:59:47 +0800 Subject: [PATCH] Add tea 0.10.1 nix derivation and Gitea PR skill - Pin tea CLI to 0.10.1 to avoid TTY bug in 0.11.x - Add .claude/skills/gitea for PR creation workflow - Document tea CLI usage in CLAUDE.md Co-Authored-By: Claude Opus 4.5 --- .claude/skills/gitea/SKILL.md | 77 +++++++++++++++++++++++++++++++++++ CLAUDE.md | 7 ++++ devenv.nix | 5 +++ nix/tea.nix | 53 ++++++++++++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 .claude/skills/gitea/SKILL.md create mode 100644 nix/tea.nix diff --git a/.claude/skills/gitea/SKILL.md b/.claude/skills/gitea/SKILL.md new file mode 100644 index 0000000..4def937 --- /dev/null +++ b/.claude/skills/gitea/SKILL.md @@ -0,0 +1,77 @@ +--- +name: gitea +description: Create pull requests on Gitea using the tea CLI. Use when the user asks to "create a PR", "open a pull request", "make a PR", "submit PR", or any variation involving pull requests for this repository. +--- + +# Gitea Pull Requests + +This project uses Gitea (git.rev.iq) for hosting and the `tea` CLI for creating pull requests. + +## Prerequisites + +- The `tea` CLI is installed via devenv (pinned to 0.10.1 to avoid TTY bugs in 0.11.x) +- Login is configured via `~/.config/tea/config.yml` + +## Creating a Pull Request + +When asked to create a PR, follow these steps: + +### 1. Check current state + +```bash +git status +git log --oneline -5 +git diff master...HEAD --stat +``` + +### 2. Ensure changes are committed and pushed + +If there are uncommitted changes, commit them first. Then push: + +```bash +git push -u origin +``` + +### 3. Create the PR using tea + +```bash +tea pr create \ + -r igm/publisher-dashboard \ + --title "PR title here" \ + --description "## Summary +- Change 1 +- Change 2 + +🤖 Generated with [Claude Code](https://claude.ai/code)" \ + --head \ + --base master +``` + +**Important flags:** +- `-r igm/publisher-dashboard` - Always specify the repo explicitly (required due to SSH remote detection issues) +- `--head` - The source branch (your feature branch) +- `--base` - The target branch (usually `master`) + +### 4. Return the PR URL + +The command outputs the PR URL. Always share this with the user. + +## Example Output + +``` +# #1 Update packages to export from dist/ (open) + +@igm created 2024-01-11 **master** <- **fix-exports** + +-------- + +• No Conflicts +• Maintainers are allowed to edit + +https://git.rev.iq/igm/publisher-dashboard/pulls/1 +``` + +## Troubleshooting + +- If tea fails with TTY errors, ensure you're using tea 0.10.1 (configured in `nix/tea.nix`) +- The repo flag `-r igm/publisher-dashboard` is required because the SSH remote isn't auto-detected diff --git a/CLAUDE.md b/CLAUDE.md index cea3024..dd7db9f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,6 +7,13 @@ Before starting the dev server, check if it's already running: - The dev server runs on port 6827 (may fall back to 6828 if port is in use) - Start with `bun run --cwd apps/publisher-dashboard dev` or `devenv up` +## Pull Requests + +This repo uses Gitea (git.rev.iq) with the `tea` CLI for pull requests: +- Use the `/gitea` skill when creating PRs +- tea 0.10.1 is pinned in `nix/tea.nix` (0.11.x has TTY bugs) +- Always specify `-r igm/publisher-dashboard` flag (SSH remote auto-detection doesn't work) + ## macOS sed Syntax macOS uses BSD sed which differs from GNU sed: diff --git a/devenv.nix b/devenv.nix index cc5e1b9..9aa07d1 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,5 +1,10 @@ { pkgs, ... }: +let + # Use tea 0.10.1 to avoid TTY bug in 0.11.x + # See: https://gitea.com/gitea/tea/issues/827 + tea = pkgs.callPackage ./nix/tea.nix { }; +in { packages = with pkgs; [ nixfmt-rfc-style diff --git a/nix/tea.nix b/nix/tea.nix new file mode 100644 index 0000000..0fe7454 --- /dev/null +++ b/nix/tea.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenv, + fetchurl, +}: + +let + version = "0.10.1"; + + sources = { + x86_64-linux = { + url = "https://dl.gitea.com/tea/${version}/tea-${version}-linux-amd64"; + sha256 = "sha256-QcODwFm2T8hVCqBkp8FAnQ3KbNw8P0ZHv0iJ4zSP5mA="; + }; + aarch64-linux = { + url = "https://dl.gitea.com/tea/${version}/tea-${version}-linux-arm64"; + sha256 = "sha256-qfvJ4FJSHt1+sMG4hPwGNFLChqhNNf+l3ELQ97zZm50="; + }; + x86_64-darwin = { + url = "https://dl.gitea.com/tea/${version}/tea-${version}-darwin-amd64"; + sha256 = "sha256-WKjZKhFKWjZqnrdxPv00fzTIc0z4xrLSsL+jqLQ1huc="; + }; + aarch64-darwin = { + url = "https://dl.gitea.com/tea/${version}/tea-${version}-darwin-arm64"; + sha256 = "sha256-SMwxMEDKmhbLvLn1ZR1MmbjutZPk0P9QAfvNKCvrSk0="; + }; + }; + + src = sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); +in +stdenv.mkDerivation { + pname = "tea"; + inherit version; + + src = fetchurl { + inherit (src) url sha256; + }; + + dontUnpack = true; + + installPhase = '' + runHook preInstall + install -D $src $out/bin/tea + runHook postInstall + ''; + + meta = with lib; { + description = "A command line tool to interact with Gitea servers"; + homepage = "https://gitea.com/gitea/tea"; + license = licenses.mit; + platforms = builtins.attrNames sources; + }; +}