Compare commits
2
Commits
v0.1.9
..
052e8d8800
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
052e8d8800
|
||
|
|
bfc97997a1
|
No files matched your search
@@ -1,68 +0,0 @@
|
|||||||
# Continuous integration: every pull request and every push to main must pass
|
|
||||||
# the linter, the build and the tests. Packaging lives in package.yml, which
|
|
||||||
# only runs when the version file changes.
|
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
# A version-only commit is released by package.yml, which runs the same
|
|
||||||
# checks on the package build; CI would build that commit a second time.
|
|
||||||
paths-ignore: [version]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# A new push on the same branch supersedes the previous run, but main builds run
|
|
||||||
# to completion so a broken merge is always reported.
|
|
||||||
concurrency:
|
|
||||||
group: ci-${{ github.ref }}
|
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
# Arch Linux host runner: kitty builds against the Arch toolchain (base-devel,
|
|
||||||
# go, python, harfbuzz, shader-slang...) and makepkg refuses to run as root.
|
|
||||||
runs-on: arch-host
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install the build dependencies
|
|
||||||
run: ./packaging/install-ci-deps.sh
|
|
||||||
|
|
||||||
- name: Check the version files agree
|
|
||||||
run: ./packaging/check-version.sh
|
|
||||||
|
|
||||||
- name: Lint Python
|
|
||||||
run: |
|
|
||||||
ruff check .
|
|
||||||
ruff format --check .
|
|
||||||
|
|
||||||
- name: Check Go formatting
|
|
||||||
run: |
|
|
||||||
# Generated files only exist after ./dev.sh build and are not tracked,
|
|
||||||
# so only the committed sources are checked.
|
|
||||||
unformatted="$(git ls-files -z '*.go' | xargs -0 gofmt -s -l)"
|
|
||||||
if [ -n "$unformatted" ]; then
|
|
||||||
echo "::error::gofmt is required for:"
|
|
||||||
echo "$unformatted"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: ./dev.sh build
|
|
||||||
|
|
||||||
# The Go packages import generated code and embedded data produced by the
|
|
||||||
# build above, so vet and tests cannot run on a bare checkout.
|
|
||||||
- name: Vet
|
|
||||||
run: go vet ./kittens/file_manager/
|
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: go test --tags testing ./kittens/file_manager/
|
|
||||||
|
|
||||||
- name: Smoke test the binaries
|
|
||||||
run: |
|
|
||||||
./kitty/launcher/kitty --version
|
|
||||||
./kitty/launcher/kitten --version
|
|
||||||
@@ -1,252 +0,0 @@
|
|||||||
# Release pipeline. A change to the version file on main is the only thing that
|
|
||||||
# publishes: the package is built once from that exact commit, the checks run on
|
|
||||||
# that same build, and it is attached to a Gitea release and pushed to the
|
|
||||||
# pacman repository at repo.laxacube.ch.
|
|
||||||
#
|
|
||||||
# Required secrets: RELEASE_TOKEN (release API), REPO_TOKEN (pacman repository).
|
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
# Only a version bump releases; every other commit stays on the CI path.
|
|
||||||
paths: [version]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
# Releases are ordered: a second run waits instead of racing for the same tag.
|
|
||||||
concurrency:
|
|
||||||
group: release
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# A single job so the package is compiled only once: makepkg builds kitty and
|
|
||||||
# the Go tools, the checks below run on that build tree, and publishing comes
|
|
||||||
# last, so a release never pays for a second build of the same commit.
|
|
||||||
release:
|
|
||||||
runs-on: arch-host
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install the build dependencies
|
|
||||||
run: ./packaging/install-ci-deps.sh
|
|
||||||
|
|
||||||
- name: Check the version files agree
|
|
||||||
run: ./packaging/check-version.sh
|
|
||||||
|
|
||||||
- name: Lint Python
|
|
||||||
run: |
|
|
||||||
ruff check .
|
|
||||||
ruff format --check .
|
|
||||||
|
|
||||||
- name: Check Go formatting
|
|
||||||
run: |
|
|
||||||
unformatted="$(git ls-files -z '*.go' | xargs -0 gofmt -s -l)"
|
|
||||||
if [ -n "$unformatted" ]; then
|
|
||||||
echo "::error::gofmt is required for:"
|
|
||||||
echo "$unformatted"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Read the version file
|
|
||||||
id: version
|
|
||||||
run: echo "version=$(./packaging/check-version.sh)" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Build the Arch package
|
|
||||||
id: package
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
# makepkg creates src/ and pkg/ next to the PKGBUILD, so build in a
|
|
||||||
# scratch directory to leave the checkout untouched.
|
|
||||||
work="$RUNNER_TEMP/fws-kitty-${{ steps.version.outputs.version }}"
|
|
||||||
rm -rf "$work"
|
|
||||||
mkdir -p "$work"
|
|
||||||
cp packaging/PKGBUILD "$work/"
|
|
||||||
cd "$work"
|
|
||||||
# Pin the build to the commit being released: main may already have
|
|
||||||
# moved on by the time makepkg clones the repository. The source tree
|
|
||||||
# is kept (no --cleanbuild) so the checks below run in it instead of
|
|
||||||
# rebuilding the project a second time.
|
|
||||||
FWS_SOURCE_REF="commit=$GITHUB_SHA" \
|
|
||||||
makepkg --noconfirm --nodeps --force
|
|
||||||
echo "FWS_SRC=$work/src/fws-kitty" >> "$GITHUB_ENV"
|
|
||||||
# kitty's linux-package target installs straight into the staging root,
|
|
||||||
# so the built binaries live there rather than in the source tree.
|
|
||||||
echo "FWS_PKG=$work/pkg/fws-kitty" >> "$GITHUB_ENV"
|
|
||||||
# ls prints ./*, which must not leak into the asset name or the
|
|
||||||
# X-Filename header of the pacman upload.
|
|
||||||
asset="$(ls -1 ./*.pkg.tar.zst | grep -v -- '-debug-' | head -n 1)"
|
|
||||||
asset="${asset#./}"
|
|
||||||
sha256sum "$asset" > "$asset.sha256"
|
|
||||||
cat "$asset.sha256"
|
|
||||||
echo "file=$work/$asset" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "name=$asset" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
# These import generated code and embedded data that only exist after a
|
|
||||||
# build, so they run in the makepkg tree above, not on the bare checkout.
|
|
||||||
- name: Vet the Go code
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
cd "$FWS_SRC"
|
|
||||||
go vet ./kittens/file_manager/
|
|
||||||
|
|
||||||
- name: Test the Go code
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
cd "$FWS_SRC"
|
|
||||||
go test --tags testing ./kittens/file_manager/
|
|
||||||
|
|
||||||
- name: Smoke test the binaries
|
|
||||||
env:
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
"$FWS_PKG/usr/bin/kitty" --version
|
|
||||||
"$FWS_PKG/usr/bin/kitten" --version
|
|
||||||
# The release announces the fork version, not the kitty one.
|
|
||||||
"$FWS_PKG/usr/bin/kitty" --version | grep -qF "fws-kitty $VERSION"
|
|
||||||
|
|
||||||
- name: Publish the Gitea release
|
|
||||||
env:
|
|
||||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
VERSION: ${{ steps.version.outputs.version }}
|
|
||||||
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
|
||||||
PACKAGE_FILE: ${{ steps.package.outputs.file }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
# Without the token every API call answers 401 and the failure would
|
|
||||||
# look like a missing release instead of a missing secret.
|
|
||||||
if [ -z "${RELEASE_TOKEN:-}" ]; then
|
|
||||||
echo "::error::RELEASE_TOKEN is not set: cannot create the release."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
|
||||||
tag="v$VERSION"
|
|
||||||
auth="Authorization: token $RELEASE_TOKEN"
|
|
||||||
|
|
||||||
# A pacman version is immutable: the repository index, the CDN in
|
|
||||||
# front of it and every client cache the package by its name, so a
|
|
||||||
# second build published under the same name leaves them disagreeing
|
|
||||||
# and pacman reports the download as corrupted. Once repo.laxacube.ch
|
|
||||||
# serves the name there is nothing left to publish: a re-run is a
|
|
||||||
# no-op, and a changed build needs a pkgrel bump so it gets its own
|
|
||||||
# package name.
|
|
||||||
local_sha256="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
|
||||||
repo_sha256=""
|
|
||||||
if curl -fsSL "https://repo.laxacube.ch/x86_64/$PACKAGE_NAME" -o "$RUNNER_TEMP/repo.pkg" 2>/dev/null; then
|
|
||||||
repo_sha256="$(sha256sum "$RUNNER_TEMP/repo.pkg" | cut -d' ' -f1)"
|
|
||||||
fi
|
|
||||||
if [ -n "$repo_sha256" ]; then
|
|
||||||
if [ "$repo_sha256" = "$local_sha256" ]; then
|
|
||||||
echo "$PACKAGE_NAME is already published to repo.laxacube.ch, nothing to do"
|
|
||||||
else
|
|
||||||
echo "::warning::$PACKAGE_NAME is already published to repo.laxacube.ch with sha256 $repo_sha256, this build is $local_sha256 and is not published"
|
|
||||||
echo "::warning::bump pkgrel in packaging/PKGBUILD to publish this build under its own package name"
|
|
||||||
fi
|
|
||||||
echo "SKIP_PUBLISH=1" >> "$GITHUB_ENV"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
release_id="$(curl -sS -H "$auth" "$api/releases/tags/$tag" | python3 -c '
|
|
||||||
import json, sys
|
|
||||||
try:
|
|
||||||
print(json.load(sys.stdin).get("id") or "")
|
|
||||||
except Exception:
|
|
||||||
print("")
|
|
||||||
')"
|
|
||||||
if [ -z "$release_id" ]; then
|
|
||||||
body="$(printf 'FWS-Kitty %s\n\nPaquet Arch du fork FWS-Kitty.\n\nInstallation :\n\n sudo pacman -U %s\n\nVérification du téléchargement :\n\n sha256sum -c %s.sha256\n' "$VERSION" "$PACKAGE_NAME" "$PACKAGE_NAME")"
|
|
||||||
payload="$(BODY="$body" TAG="$tag" VERSION="$VERSION" python3 -c '
|
|
||||||
import json, os
|
|
||||||
print(json.dumps({
|
|
||||||
"tag_name": os.environ["TAG"],
|
|
||||||
"name": "FWS-Kitty " + os.environ["VERSION"],
|
|
||||||
"body": os.environ["BODY"],
|
|
||||||
"draft": False,
|
|
||||||
"prerelease": False,
|
|
||||||
}))
|
|
||||||
')"
|
|
||||||
release_id="$(curl -sS --fail-with-body -X POST -H "$auth" \
|
|
||||||
-H 'Content-Type: application/json' -d "$payload" "$api/releases" \
|
|
||||||
| python3 -c 'import json, sys; print(json.load(sys.stdin)["id"])')"
|
|
||||||
fi
|
|
||||||
echo "release_id=$release_id"
|
|
||||||
|
|
||||||
# A re-run must replace its own artefacts instead of failing on them.
|
|
||||||
assets="$(curl -sS -H "$auth" "$api/releases/$release_id/assets")"
|
|
||||||
attach() {
|
|
||||||
file="$1"
|
|
||||||
name="$2"
|
|
||||||
asset_id="$(ASSETS="$assets" NAME="$name" python3 -c '
|
|
||||||
import json, os
|
|
||||||
try:
|
|
||||||
assets = json.loads(os.environ["ASSETS"])
|
|
||||||
except Exception:
|
|
||||||
assets = []
|
|
||||||
print(next((a["id"] for a in assets if a.get("name") == os.environ["NAME"]), ""))
|
|
||||||
')"
|
|
||||||
if [ -n "$asset_id" ]; then
|
|
||||||
curl -sS -X DELETE -H "$auth" "$api/releases/assets/$asset_id" -o /dev/null
|
|
||||||
fi
|
|
||||||
curl -sS --fail-with-body -X POST -H "$auth" \
|
|
||||||
-F "attachment=@$file" "$api/releases/$release_id/assets?name=$name" -o /dev/null
|
|
||||||
echo "attached $name"
|
|
||||||
}
|
|
||||||
attach "$PACKAGE_FILE" "$PACKAGE_NAME"
|
|
||||||
attach "$PACKAGE_FILE.sha256" "$PACKAGE_NAME.sha256"
|
|
||||||
|
|
||||||
- name: Push the package to repo.laxacube.ch
|
|
||||||
# Skipped when the release step found the version already published, so
|
|
||||||
# a re-run can never replace the bytes pacman clients are served.
|
|
||||||
if: env.SKIP_PUBLISH != '1'
|
|
||||||
env:
|
|
||||||
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
|
|
||||||
PACKAGE_NAME: ${{ steps.package.outputs.name }}
|
|
||||||
PACKAGE_FILE: ${{ steps.package.outputs.file }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
if [ -z "${REPO_TOKEN:-}" ]; then
|
|
||||||
echo "::warning::REPO_TOKEN is not set: the release exists but repo.laxacube.ch was not updated."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
curl -sS --fail-with-body -X POST https://repo.laxacube.ch/api/packages \
|
|
||||||
-H "Authorization: Bearer $REPO_TOKEN" \
|
|
||||||
-H "X-Filename: $PACKAGE_NAME" \
|
|
||||||
-H 'Content-Type: application/octet-stream' \
|
|
||||||
--data-binary "@$PACKAGE_FILE"
|
|
||||||
echo
|
|
||||||
# The index is rebuilt server-side and the file is served through a
|
|
||||||
# CDN, so a HEAD is not enough: the index and the file can disagree
|
|
||||||
# for as long as the CDN caches the previous build under this name,
|
|
||||||
# and the checksum is exactly what pacman verifies before installing.
|
|
||||||
# A freshly accepted upload is not routable instantly, so an absent
|
|
||||||
# file is retried before giving up; different bytes are a real
|
|
||||||
# mismatch and fail at once, since that is what breaks pacman.
|
|
||||||
url="https://repo.laxacube.ch/x86_64/$PACKAGE_NAME"
|
|
||||||
expected="$(cut -d' ' -f1 "$PACKAGE_FILE.sha256")"
|
|
||||||
code=000
|
|
||||||
for _ in $(seq 1 24); do
|
|
||||||
code="$(curl -sS -o "$RUNNER_TEMP/served.pkg" -w '%{http_code}' "$url" || true)"
|
|
||||||
if [ "$code" = 200 ]; then
|
|
||||||
served="$(sha256sum "$RUNNER_TEMP/served.pkg" | cut -d' ' -f1)"
|
|
||||||
if [ "$served" = "$expected" ]; then
|
|
||||||
echo "published $url"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "::error::$url serves sha256 $served instead of $expected"
|
|
||||||
echo "::error::the CDN is still caching another build under this name: purge it before re-running"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
if [ "$code" = 404 ]; then
|
|
||||||
echo "::warning::$url is not visible yet; the repository accepted the upload, pacman will see it once the index is rebuilt"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "::error::$url answered HTTP $code after the upload"
|
|
||||||
exit 1
|
|
||||||
@@ -13,10 +13,6 @@
|
|||||||
/.venv
|
/.venv
|
||||||
/tags
|
/tags
|
||||||
/build/
|
/build/
|
||||||
# makepkg output: built locally and published by the release workflow, never
|
|
||||||
# committed (the artefacts are large binaries that are reproducible from a tag).
|
|
||||||
/packaging/*.pkg.tar.zst*
|
|
||||||
/packaging/*.tar.gz
|
|
||||||
/fonts/
|
/fonts/
|
||||||
/shaders/
|
/shaders/
|
||||||
/linux-package/
|
/linux-package/
|
||||||
|
|||||||
@@ -299,38 +299,6 @@ réaffecte `_branch`) :
|
|||||||
_branch=feat/file-manager-panel
|
_branch=feat/file-manager-panel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Publication automatique
|
|
||||||
|
|
||||||
`version`, à la racine, est la source de vérité des releases. Il suit la version
|
|
||||||
du fork FWS (`0.1.9`), pas la version amont de kitty embarquée dans le paquet :
|
|
||||||
c'est elle qui nomme le tag, la release et le paquet
|
|
||||||
`fws-kitty-<version>-<rel>`. Il doit rester égal à `pkgver` dans
|
|
||||||
`packaging/PKGBUILD` et à la version affichée par `fws-kitty`
|
|
||||||
(`tools/cli/help.go`, `kitty/launcher/main.c`) ; `packaging/check-version.sh`
|
|
||||||
vérifie l'ensemble, ainsi que `_kittyver` du `PKGBUILD` contre
|
|
||||||
`kitty/constants.py`, et échoue sinon. Un push sur `main` qui modifie `version`
|
|
||||||
déclenche
|
|
||||||
`.gitea/workflows/package.yml`, qui compile le paquet une seule fois
|
|
||||||
(`makepkg`, seul build), lance lint, `go vet`, tests et smoke test sur cet
|
|
||||||
arbre, puis crée la release Gitea `v<version>` avec le paquet en pièce jointe
|
|
||||||
et l'envoie à `repo.laxacube.ch`. `.gitea/workflows/ci.yml` rejoue les mêmes
|
|
||||||
contrôles sur chaque PR et chaque push sur `main` qui ne modifie pas que
|
|
||||||
`version`.
|
|
||||||
|
|
||||||
Pour reconstruire la même version du fork (correctif de packaging), incrémentez
|
|
||||||
`pkgrel` dans `packaging/PKGBUILD` puis lancez le workflow à la main
|
|
||||||
(*Actions → Release → Run workflow*) : le paquet `0.1.8-2` remplace alors le
|
|
||||||
`0.1.8-1`. Une version déjà publiée n'est jamais réécrite avec un autre build :
|
|
||||||
si `repo.laxacube.ch` sert déjà ce nom de paquet, le workflow s'arrête sans
|
|
||||||
republier (relancer une release est donc sans effet et ne fait pas échouer la
|
|
||||||
CI) ; pour publier un build différent, incrémentez `pkgrel`, sinon les caches
|
|
||||||
(CDN, pacman) servent un fichier qui ne correspond plus à la base. Une nouvelle version du fork demande `version`,
|
|
||||||
`pkgver` et les deux front-ends, avec `pkgrel=1` ; pour suivre une nouvelle version de kitty, mettre
|
|
||||||
à jour `_kittyver` et `kitty/constants.py`. La publication vers
|
|
||||||
`repo.laxacube.ch` utilise le
|
|
||||||
secret `REPO_TOKEN` du dépôt, la release Gitea le secret `RELEASE_TOKEN` ; sans
|
|
||||||
`REPO_TOKEN` la release est créée mais le dépôt pacman n'est pas mis à jour.
|
|
||||||
|
|
||||||
La publication dans un dépôt pacman (`repo-add`, configuration client,
|
La publication dans un dépôt pacman (`repo-add`, configuration client,
|
||||||
automatisation) est détaillée dans `packaging/README.md`.
|
automatisation) est détaillée dans `packaging/README.md`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
# docCours — FWS-Kitty
|
|
||||||
|
|
||||||
Dossier de rendu du binôme (*Damien Rochat* + *Gianmarco Ruberti*) pour le projet
|
|
||||||
**FWS-Kitty**, le fork FWS du terminal kitty.
|
|
||||||
|
|
||||||
## Contenu
|
|
||||||
|
|
||||||
| Fichier | Rôle |
|
|
||||||
| --- | --- |
|
|
||||||
| [`plan-ci-cd.md`](plan-ci-cd.md) | **Document principal** : plan CI/CD complet (objectifs, analyse technique, conception du pipeline, suivi après mise en production, procédure de déploiement et de rollback) |
|
|
||||||
| [`methodologie-git-github.md`](methodologie-git-github.md) | Méthodologie de collaboration Git / GitHub : workflow, branches, revue de code, versionnage, commits |
|
|
||||||
| [`annexes/pipeline-ci.yml`](annexes/pipeline-ci.yml) | Ébauche de workflow CI/CD (syntaxe Actions, compatible Gitea `act_runner`) — non actif, à déplacer vers `.gitea/workflows/` après validation |
|
|
||||||
|
|
||||||
## Comment lire ce dossier
|
|
||||||
|
|
||||||
1. `plan-ci-cd.md` §1–2 : le contexte, les objectifs et les contraintes du projet.
|
|
||||||
2. §3 : les technologies, l'hébergement, les environnements, les variables et les secrets.
|
|
||||||
3. §4 : le pipeline étape par étape, avec les outils et les feedbacks attendus.
|
|
||||||
4. §5 : le suivi en production (monitoring, alertes, amélioration continue).
|
|
||||||
5. §6 : la synthèse des livrables et les procédures de déploiement / rollback.
|
|
||||||
6. `methodologie-git-github.md` pour la partie collaboration (workflow Git, revue, versionnage).
|
|
||||||
7. `annexes/pipeline-ci.yml` pour la traduction concrète du pipeline en configuration.
|
|
||||||
|
|
||||||
## État du dépôt
|
|
||||||
|
|
||||||
Le dépôt ne contient aujourd'hui **aucune configuration CI** (pas de
|
|
||||||
`.github/workflows/`, `.gitea/workflows/`, `.gitlab-ci.yml` ni `Jenkinsfile`) :
|
|
||||||
tous les contrôles (`./test.py`, `go test`, `ruff`, `./dev.sh build`,
|
|
||||||
`makepkg`) sont manuels. Les documents de ce dossier décrivent le pipeline
|
|
||||||
cible et l'ordre de mise en œuvre (§7 du plan).
|
|
||||||
@@ -1,291 +0,0 @@
|
|||||||
# Ébauche du pipeline CI/CD de FWS-Kitty.
|
|
||||||
#
|
|
||||||
# Ce fichier n'est PAS actif : il vit dans docCours/ pour être relu avant mise
|
|
||||||
# en service. Pour l'activer, le déplacer vers .gitea/workflows/ci.yml (Gitea
|
|
||||||
# act_runner accepte la syntaxe GitHub Actions utilisée ici).
|
|
||||||
#
|
|
||||||
# Hypothèses :
|
|
||||||
# - runner act_runner avec accès à Docker, étiquettes [self-hosted, linux, x64]
|
|
||||||
# - image de build préconstruite : fws/kitty-build:latest (Arch + deps système)
|
|
||||||
# - caches persistants montés : /cache/kitty (ccache, Go, bundle deps)
|
|
||||||
|
|
||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
tags: ['v*']
|
|
||||||
schedule:
|
|
||||||
- cron: '0 3 * * *' # nightly : sanitizers + réaudit
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ci-${{ github.ref }}
|
|
||||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
BUILD_IMAGE: fws/kitty-build:latest
|
|
||||||
CACHE_ROOT: /cache/kitty
|
|
||||||
CCACHE_DIR: /cache/kitty/ccache
|
|
||||||
GOCACHE: /cache/kitty/go-build
|
|
||||||
GOMODCACHE: /cache/kitty/go-mod
|
|
||||||
KITTY_DISABLE_WAYLAND: '1'
|
|
||||||
CI: 'true'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 0. Hygiène : convention de commits et fichiers interdits
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
hygiene:
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container: { image: 'fws/kitty-lint:latest' }
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with: { fetch-depth: 0 }
|
|
||||||
|
|
||||||
- name: Check whitespace and conflict markers
|
|
||||||
run: git diff --check "${{ github.event.pull_request.base.sha || 'HEAD~1' }}" HEAD
|
|
||||||
|
|
||||||
- name: Validate commit messages (Conventional Commits)
|
|
||||||
run: |
|
|
||||||
base="${{ github.event.pull_request.base.sha || 'HEAD~1' }}"
|
|
||||||
git log --format=%s "$base"..HEAD | while read -r subject; do
|
|
||||||
echo "$subject" | grep -Eq \
|
|
||||||
'^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9./-]+\))?!?: .{1,72}$' \
|
|
||||||
|| { echo "::error::Invalid commit subject: $subject"; exit 1; }
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Reject build artifacts and secrets
|
|
||||||
run: |
|
|
||||||
tracked="$(git ls-files)"
|
|
||||||
bad="$(echo "$tracked" | grep -E '\.pkg\.tar\.zst$|(^|/)(dependencies|build|\.venv)/|_generated\.go$|^\.env')" || true
|
|
||||||
if [ -n "$bad" ]; then echo "::error::Artifacts must not be tracked:"; echo "$bad"; exit 1; fi
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 1. Qualité : lint, format, typage
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
lint:
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container: { image: 'fws/kitty-lint:latest' }
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- run: ruff check --output-format=github .
|
|
||||||
- run: ruff format --check .
|
|
||||||
- run: gofmt -s -l tools kittens bypy gen | tee /tmp/fmt.txt && test ! -s /tmp/fmt.txt
|
|
||||||
# go vet exige le code généré : on limite aux paquets autonomes en PR rapide
|
|
||||||
- run: go vet ./kittens/file_manager/ ./tools/... ./bypy/...
|
|
||||||
- run: staticcheck ./kittens/file_manager/ ./tools/... ./bypy/...
|
|
||||||
- name: Type check Python
|
|
||||||
run: ./dev.sh build && ./test.py type-check
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 2. Audit : vulnérabilités, dépendances, secrets, SBOM
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
audit:
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container: { image: 'fws/kitty-lint:latest' }
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Go vulnerabilities
|
|
||||||
run: govulncheck ./... | tee /tmp/govuln.txt
|
|
||||||
- name: Python doc dependencies
|
|
||||||
run: pip-audit -r docs/requirements.txt
|
|
||||||
- name: Secret scan
|
|
||||||
run: gitleaks detect --no-git --redact -v
|
|
||||||
- name: SBOM
|
|
||||||
run: syft dir:. -o spdx-json=sbom.spdx.json
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with: { name: sbom, path: sbom.spdx.json, retention-days: 90 }
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 3. Build : C + code généré + kittens + docs
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
build:
|
|
||||||
needs: [lint]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container:
|
|
||||||
image: 'fws/kitty-build:latest'
|
|
||||||
options: --user builder
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Restore dependency bundle
|
|
||||||
run: |
|
|
||||||
test -x dependencies/linux-amd64/bin/python || ./dev.sh deps
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
start=$(date +%s)
|
|
||||||
./dev.sh build
|
|
||||||
echo "BUILD_SECONDS=$(( $(date +%s) - start ))" >> "$GITHUB_ENV"
|
|
||||||
- name: Smoke test binaries
|
|
||||||
run: |
|
|
||||||
./kitty/launcher/kitty --version
|
|
||||||
./kitty/launcher/kitten --version
|
|
||||||
- name: Build documentation
|
|
||||||
run: |
|
|
||||||
python -m venv .docs-venv
|
|
||||||
.docs-venv/bin/pip install --disable-pip-version-check -q -r docs/requirements.txt
|
|
||||||
PATH="$PWD/.docs-venv/bin:$PATH" make -C docs html FAIL_WARN=1
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: kitty-build
|
|
||||||
path: |
|
|
||||||
kitty/launcher/kitty
|
|
||||||
kitty/launcher/kitten
|
|
||||||
docs/_build/html
|
|
||||||
retention-days: 7
|
|
||||||
- name: Report build duration
|
|
||||||
run: echo "Build completed in ${BUILD_SECONDS}s"
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 4. Tests : suite Python + Go sous serveur X virtuel
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
test:
|
|
||||||
needs: [build]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container:
|
|
||||||
image: 'fws/kitty-build:latest'
|
|
||||||
options: --user builder
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with: { name: kitty-build, path: . }
|
|
||||||
- name: Go tests (file manager kitten)
|
|
||||||
run: go test --tags testing ./kittens/file_manager/
|
|
||||||
- name: Full suite
|
|
||||||
run: xvfb-run -a ./test.py
|
|
||||||
- name: Leak/UB check
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
run: make asan && xvfb-run -a ./test.py --module kittens/file_manager
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 5. Paquet Arch : build, signature, test d'installation
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
package:
|
|
||||||
needs: [test]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
container:
|
|
||||||
image: 'fws/kitty-build:latest'
|
|
||||||
options: --user builder
|
|
||||||
outputs:
|
|
||||||
pkgver: ${{ steps.version.outputs.pkgver }}
|
|
||||||
pkgrel: ${{ steps.version.outputs.pkgrel }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Derive version from tag
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
|
|
||||||
echo "pkgver=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "pkgver=$(sed -n 's/^pkgver=//p' packaging/PKGBUILD)" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
echo "pkgrel=$(sed -n 's/^pkgrel=//p' packaging/PKGBUILD)" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Build package
|
|
||||||
run: |
|
|
||||||
cd packaging
|
|
||||||
sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.pkgver }}/;s/^pkgrel=.*/pkgrel=${{ steps.version.outputs.pkgrel }}/" PKGBUILD
|
|
||||||
makepkg -f --nodeps
|
|
||||||
repo-add fws-kitty.db.tar.gz fws-kitty-*.pkg.tar.zst
|
|
||||||
namcap fws-kitty-*.pkg.tar.zst || true
|
|
||||||
- name: Sign (production only)
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
env:
|
|
||||||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
||||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
|
||||||
run: |
|
|
||||||
printf '%s' "$GPG_PRIVATE_KEY" | base64 -d | gpg --batch --import
|
|
||||||
cd packaging
|
|
||||||
for f in fws-kitty-*.pkg.tar.zst; do
|
|
||||||
gpg --batch --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
|
||||||
--detach-sign --no-armor "$f"
|
|
||||||
done
|
|
||||||
repo-add --sign --key <FWS_KEY_ID> fws-kitty.db.tar.gz fws-kitty-*.pkg.tar.zst
|
|
||||||
- name: Install test in a clean container
|
|
||||||
run: |
|
|
||||||
docker run --rm -v "$PWD/packaging:/pkgs:ro" archlinux:base-devel \
|
|
||||||
sh -c 'pacman -U --noconfirm /pkgs/fws-kitty-*.pkg.tar.zst && kitty --version && kitten file-manager --help'
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: arch-package
|
|
||||||
path: |
|
|
||||||
packaging/fws-kitty-*.pkg.tar.zst*
|
|
||||||
packaging/fws-kitty.db.tar.gz*
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 6a. Staging : automatique sur main
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
deploy-staging:
|
|
||||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
||||||
needs: [package]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
environment: staging
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with: { name: arch-package, path: pkgs }
|
|
||||||
- name: Publish to fws-testing repository
|
|
||||||
env:
|
|
||||||
SSH_KEY: ${{ secrets.REPO_DEPLOY_SSH_KEY }}
|
|
||||||
HOST: ${{ secrets.REPO_DEPLOY_HOST }}
|
|
||||||
USER: ${{ secrets.REPO_DEPLOY_USER }}
|
|
||||||
run: |
|
|
||||||
install -m 600 /dev/null ~/.ssh/deploy && printf '%s' "$SSH_KEY" > ~/.ssh/deploy
|
|
||||||
rsync -av -e "ssh -i ~/.ssh/deploy -o StrictHostKeyChecking=yes" \
|
|
||||||
pkgs/ "$USER@$HOST:/srv/pacman/fws/testing/x86_64/"
|
|
||||||
- name: Verify published package
|
|
||||||
run: |
|
|
||||||
docker run --rm archlinux:base-devel sh -c \
|
|
||||||
'printf "[fws-testing]\nServer = %s\nSigLevel = Optional\n" "${{ vars.TESTING_REPO_URL }}" >> /etc/pacman.conf && \
|
|
||||||
pacman -Syu --noconfirm fws-kitty && kitty --version'
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 6b. Production : tag vX.Y.Z + approbation manuelle
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
release:
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
needs: [package]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
environment: production # required_reviewers : 1 mainteneur
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with: { name: arch-package, path: pkgs }
|
|
||||||
- name: Publish to stable repository
|
|
||||||
env:
|
|
||||||
SSH_KEY: ${{ secrets.REPO_DEPLOY_SSH_KEY_PROD }}
|
|
||||||
HOST: ${{ secrets.REPO_DEPLOY_HOST }}
|
|
||||||
USER: ${{ secrets.REPO_DEPLOY_USER }}
|
|
||||||
run: |
|
|
||||||
install -m 600 /dev/null ~/.ssh/deploy && printf '%s' "$SSH_KEY" > ~/.ssh/deploy
|
|
||||||
rsync -av -e "ssh -i ~/.ssh/deploy -o StrictHostKeyChecking=yes" \
|
|
||||||
pkgs/ "$USER@$HOST:/srv/pacman/fws/x86_64/"
|
|
||||||
- name: Publish Gitea release
|
|
||||||
env:
|
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
|
||||||
curl -sS -X POST "$GITEA_API/repos/$GITHUB_REPOSITORY/releases" \
|
|
||||||
-H "Authorization: token $TOKEN" \
|
|
||||||
-F tag_name="$GITHUB_REF_NAME" \
|
|
||||||
-F name="$GITHUB_REF_NAME" \
|
|
||||||
-F body="$(sed -n "/^## \\[$GITHUB_REF_NAME\\]/,/^## \\[/p" CHANGELOG.rst | head -n -1)" \
|
|
||||||
-F attachment=@pkgs/fws-kitty-*.pkg.tar.zst
|
|
||||||
- name: Verify production install
|
|
||||||
run: |
|
|
||||||
docker run --rm archlinux:base-devel sh -c \
|
|
||||||
'printf "[fws]\nServer = %s\nSigLevel = Required DatabaseOptional\n" "${{ vars.PROD_REPO_URL }}" >> /etc/pacman.conf && \
|
|
||||||
pacman -Syu --noconfirm fws-kitty && kitty --version'
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# 7. Notification : un échec doit toujours dire quoi faire
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
notify:
|
|
||||||
if: always()
|
|
||||||
needs: [lint, audit, build, test, package]
|
|
||||||
runs-on: [self-hosted, linux, x64]
|
|
||||||
steps:
|
|
||||||
- name: Send status to team webhook
|
|
||||||
run: |
|
|
||||||
curl -sS -X POST "${{ secrets.NOTIFY_WEBHOOK_URL }}" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d "{\"content\":\"CI ${{ job.status }} on ${{ github.repository }}@${{ github.sha }} (${{ github.ref_name }})\"}"
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
# Méthodologie de collaboration Git / GitHub
|
|
||||||
|
|
||||||
| Élément | Valeur |
|
|
||||||
| --- | --- |
|
|
||||||
| Projet de référence | **FWS-Kitty** (fork FWS de kitty) |
|
|
||||||
| Binôme | *Damien Rochat* + *Gianmarco Ruberti* |
|
|
||||||
| Date / statut | Novembre 2026 — version 0.50.0 |
|
|
||||||
|
|
||||||
> Document de référence : il décrit **comment nous travaillerions** en contexte professionnel. Aucune manipulation Git réelle n'est effectuée ; les commandes illustrent la méthode.
|
|
||||||
|
|
||||||
## 1. Projet de référence
|
|
||||||
|
|
||||||
FWS-Kitty : fork du terminal kitty auquel nous ajoutons un panneau de gestion de fichiers (`kittens/file_manager/`). Représentatif de notre futur quotidien :
|
|
||||||
|
|
||||||
- **Dépôt existant et volumineux** (C, Python, Go, docs Sphinx) : on s'y insère, on ne réécrit pas.
|
|
||||||
- **Travail parallèle** sur des zones distinctes : interface Go, options Python, docs, packaging Arch, CI.
|
|
||||||
- **Revue réellement utile** : le code touche au shell (suppression de fichiers, `cd`).
|
|
||||||
- **Contrôles automatisables** : `./test.py`, `go test ./kittens/file_manager/`, `ruff check`, `./dev.sh build`, `./dev.sh docs`.
|
|
||||||
- Le choix du projet doit être **validé par l'enseignant** ; sinon seules les commandes changent.
|
|
||||||
|
|
||||||
## 2. a) Organisation
|
|
||||||
|
|
||||||
| Rôle | Responsabilité principale | Qui |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Mainteneur / intégrateur | protège `main`, arbitre, valide les fusions, tient `CHANGELOG` et tags | binôme A |
|
|
||||||
| Développeur·se / relecteur·se | développe, relit toutes les PR | binôme B |
|
|
||||||
| Responsable qualité | surveille CI, lint, tests, régressions | alternance |
|
|
||||||
| Responsable documentation | vérifie la mise à jour de `README.md` / `docs/` | alternance |
|
|
||||||
|
|
||||||
Règle d'or : **celui qui écrit le code ne valide jamais seul sa PR**. Découpage **par fonctionnalité verticale** (Go → Python → docs), jamais par couche technique. **Une issue = un périmètre = une branche = une PR**, sinon on scinde.
|
|
||||||
|
|
||||||
| Canal | Usage | Fréquence |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Issues / PR GitHub | canal **officiel** de toute décision technique | continu |
|
|
||||||
| Discussions | choix d'architecture, questions ouvertes | au besoin |
|
|
||||||
| Discord privé | synchronisation rapide, blocages | quotidien |
|
|
||||||
| Visio 15 min | hier / aujourd'hui / bloqué | 1–2×/jour |
|
|
||||||
| Bilan d'itération | reste à faire, Kanban, ajustement de la méthode | hebdomadaire |
|
|
||||||
|
|
||||||
**Traçabilité** : une décision prise à l'oral est retranscrite dans l'issue ou la PR avant application — « si ce n'est pas écrit sur GitHub, ça n'existe pas ».
|
|
||||||
|
|
||||||
| Besoin | Outil | Justification |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Suivi des tâches | **GitHub Projects** (Kanban) | une issue = une carte, rien à administrer |
|
|
||||||
| Doc technique | Markdown versionné (`docs/`, `README.md`) | évolue dans la même PR que le code |
|
|
||||||
| CI | **GitHub Actions** (ou Gitea `act_runner` si le dépôt y vit) | natif, pas de serveur |
|
|
||||||
| Qualité | `ruff`, `gofmt`/`go vet`, `./test.py`, hooks `pre-commit` | déjà dans le dépôt |
|
|
||||||
|
|
||||||
*Écartés* : Jira et Trello (outil + double saisie pour un binôme).
|
|
||||||
|
|
||||||
**Kanban** : `Backlog` -> `À faire` -> `En cours` (**1 carte max/personne**) -> `En revue` -> `Terminé`. Gabarit d'issue obligatoire (contexte, attendu, critères d'acceptation, labels). Labels : `type: feat|fix|docs|chore`, `prio:`, `zone: go|python|docs|packaging|ci`, `état: bloqué`. Lien bidirectionnel issue <-> PR <-> commit. Décisions structurantes consignées en issue `décision` ou en ADR (`docs/adr/NNN-titre.md`).
|
|
||||||
|
|
||||||
## 3. b) Workflow Git
|
|
||||||
|
|
||||||
**GitHub Flow (trunk-based simplifié)** : une seule branche longue (`main`, toujours déployable), branches de travail de **1 à 3 jours**, PR obligatoire.
|
|
||||||
|
|
||||||
| Critère | GitHub Flow (retenu) | Git Flow | Feature Branch pur |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| Complexité | faible | élevée | faible |
|
|
||||||
| Adapté au binôme | oui | non (`develop` = goulot) | oui mais sans garde-fou |
|
|
||||||
| Fréquence d'intégration | élevée, conflits rares | faible, gros merges | moyenne |
|
|
||||||
| Livraison | continue, tag sur `main` | par release planifiée | au cas par cas |
|
|
||||||
|
|
||||||
Git Flow a été conçu pour des équipes nombreuses livrant des versions planifiées ; à deux, sa `develop` n'ajoute que de la synchronisation. Le Feature Branch pur ne protège pas `main`.
|
|
||||||
|
|
||||||
| Branche | Rôle | Durée | Protection |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| `main` | référence, toujours compilable et testée, c'est elle qui est empaquetée | permanente | PR + 1 approbation + CI verte, pas de push direct ni force-push |
|
|
||||||
| `feat/<desc>` | fonctionnalité | ≤ 3 j | aucune, CI avant PR |
|
|
||||||
| `fix/<desc>`, `docs/<desc>` | correctif, documentation | ≤ 1 j | — |
|
|
||||||
| `chore/`, `ci/`, `refactor/` | maintenance, sans changement de comportement | ≤ 2 j | — |
|
|
||||||
| `hotfix/<desc>` | correction urgente d'une version livrée | heures | part de `main`, puis tag `PATCH` |
|
|
||||||
| `release/x.y.z` | uniquement si une version doit être gelée | jours | merge commit |
|
|
||||||
|
|
||||||
Nommage `type/description`, kebab-case, en anglais, décrivant **l'intention** (`feat/file-manager-create-entry`). Interdits : prénom, date, `test`, `wip`, majuscules. Branche supprimée après fusion.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git switch main && git pull --ff-only
|
|
||||||
git switch -c feat/file-manager-create-entry
|
|
||||||
git add kittens/file_manager/main.go
|
|
||||||
git commit -m "feat(file-manager): add file creation from status line"
|
|
||||||
git fetch origin && git rebase origin/main # branche perso uniquement
|
|
||||||
git push -u origin feat/file-manager-create-entry
|
|
||||||
gh pr create --fill --reviewer <binôme> # PR + CI verte
|
|
||||||
# fusion en "Squash and merge", puis suppression de la branche
|
|
||||||
```
|
|
||||||
|
|
||||||
Fusions : **squash and merge** pour les fonctionnalités (un commit propre par PR), merge commit pour `release/*` et `hotfix/*`, rebase-and-merge interdit sur `main`.
|
|
||||||
|
|
||||||
**Protection de `main`** : PR obligatoire (mainteneurs inclus), 1 approbation avec invalidation après nouveau push, statuts `lint` / `tests` / `build` requis, branche à jour et conversations résolues, force-push et suppression interdits, commits signés, `CODEOWNERS` sur `kittens/file_manager/`, `packaging/`, `docs/`.
|
|
||||||
|
|
||||||
**Versionnage SemVer 2.0.0** (`MAJEUR.MINEUR.CORRECTIF`, tags `vX.Y.Z`) : `MAJEUR` = rupture (option renommée, config illisible), `MINEUR` = fonctionnalité compatible, `CORRECTIF` = correction. Pré-versions `v0.51.0-rc.1`. Tag **annoté et signé** sur `main` (`git tag -s v0.51.0 -m "..."`), `CHANGELOG` mis à jour dans la PR de release, release créée depuis le tag. Une version livrée ne se réécrit jamais : on publie un `PATCH`.
|
|
||||||
|
|
||||||
**Conventional Commits 1.0.0** : `<type>(<portée>): <description impérative>` en **anglais**, ≤ 72 caractères, corps expliquant le *pourquoi*.
|
|
||||||
|
|
||||||
| Type | Usage | Type | Usage |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| `feat` | fonctionnalité visible | `test` | tests |
|
|
||||||
| `fix` | correction de bug | `build` | build, dépendances, packaging |
|
|
||||||
| `docs` | documentation | `ci` | intégration continue |
|
|
||||||
| `style` | formatage | `chore` | tâches annexes |
|
|
||||||
| `refactor` | réécriture interne | `perf` | performance |
|
|
||||||
| `revert` | annulation | — | — |
|
|
||||||
|
|
||||||
```
|
|
||||||
feat(file-manager): add directory creation with shift+n
|
|
||||||
fix(file-manager): keep cd working when panel runs in a dock
|
|
||||||
ci: run go tests for the file manager kitten
|
|
||||||
```
|
|
||||||
|
|
||||||
Un commit = un changement cohérent qui compile et dont les tests passent ; impératif présent ; pas de `wip` ni `update` ; référence d'issue (`Fixes #42`) ; breaking change = `feat(config)!` + pied `BREAKING CHANGE:`. Vérifié par `.gitmessage` et un hook `commit-msg` (Commitlint).
|
|
||||||
|
|
||||||
## 4. c) Revue de code
|
|
||||||
|
|
||||||
1. **Draft PR** dès le premier commit poussé : CI lancée, l'autre suit l'avancement.
|
|
||||||
2. **PR prête** : gabarit rempli (contexte, issue liée, changements, comment tester), relecteur assigné, labels.
|
|
||||||
3. **CI verte exigée** avant toute relecture approfondie.
|
|
||||||
4. **Revue sous 24 h ouvrées** : *Approve*, *Request changes* (bloquant, justifié) ou *Comment* (non bloquant).
|
|
||||||
5. **Corrections en commits supplémentaires**, sans force-push pendant la revue (diff incrémental lisible).
|
|
||||||
6. **Squash and merge**, suppression de la branche, carte en `Terminé`, vérification que `main` reste verte.
|
|
||||||
|
|
||||||
| Contexte | Approbations |
|
|
||||||
| --- | --- |
|
|
||||||
| Binôme (notre cas) | **1** par l'autre + CI verte (l'auteur ne peut pas s'auto-approuver) |
|
|
||||||
| Équipe de 3 à 5 | 2 |
|
|
||||||
| Équipe > 5 / code critique | 2 dont un `CODEOWNER` |
|
|
||||||
| `hotfix` urgent | 1, rétro-revue sous 48 h |
|
|
||||||
|
|
||||||
La CI ne remplace pas le relecteur et inversement : une PR approuvée dont un nouveau commit casse la CI repasse en revue.
|
|
||||||
|
|
||||||
**Definition of Done** : issue liée et critères couverts · **CI verte** (`ruff`, `gofmt`/`go vet`, `go test ./kittens/file_manager/`, `./test.py`, `./dev.sh build`) · relue et approuvée, commentaires résolus · Conventional Commits en anglais · **aucun fichier parasite** (`*_generated.go`, `dependencies/`, `.env`, artefacts) · doc et aide des options à jour · tests ajoutés (cas limites : caractères larges, chemins vides, permissions) · pas de régression sur les erreurs (répertoire non vide, fichier non inscriptible) · portée respectée · branche à jour, sans conflit · performance : pas de boucle coûteuse dans le rendu · sécurité : aucun shell concaténé non échappé, aucun secret.
|
|
||||||
|
|
||||||
**Bonnes pratiques** : PR ≤ 400 lignes modifiées (au-delà, le taux de détection s'effondre) · relire le code, pas la personne · commentaires actionnables et préfixés `[bloquant]`, `[suggestion]`, `[question]`, `[nit]` · on propose, l'auteur applique · test local quand le changement est subtil · pas de « LGTM » sec : dire ce qui a été vérifié.
|
|
||||||
|
|
||||||
## 5. d) Collaboration
|
|
||||||
|
|
||||||
| Action | Fréquence | Raison |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Commit | 3 à 10/jour, 50–200 lignes | point de sauvegarde, retour arrière ciblé |
|
|
||||||
| Push | ≥ 1×/demi-journée et en fin de journée | sauvegarde, CI lancée tôt, travail visible |
|
|
||||||
| PR | dès que c'est testable, même en brouillon | relecture précoce, conflits détectés tôt |
|
|
||||||
| Sync `main` | chaque matin + après chaque fusion | branches courtes = conflits rares |
|
|
||||||
|
|
||||||
**Conflits — prévention** : branches courtes et périmètre étroit ; `rebase origin/main` quotidien ; ne pas éditer `CHANGELOG.md` ni les fichiers générés dans deux branches ; formateurs et `.gitattributes`/`.editorconfig` pour éviter les faux conflits. **Résolution** : comprendre les deux versions (`git log --merge -p`), résoudre, `git add` puis `git rebase --continue` (`--abort` en cas de doute), tester puis `git push --force-with-lease` (jamais `--force`) ; **jamais de rebase sur une branche partagée** (on y fusionne `main`) ; au-delà de 15 min, on s'appelle. Des conflits récurrents signalent un mauvais découpage, pas seulement un mauvais merge.
|
|
||||||
|
|
||||||
**Traçabilité** : la chaîne **issue -> branche -> commit -> PR -> tag** doit permettre de retrouver chaque décision. Issue = le *quoi* et le *pourquoi* ; branche = l'intention + numéro d'issue si naturel ; commit = Conventional Commits avec le *pourquoi* ; PR = description, revue, décisions actées ; ADR pour les choix structurants (immuables) ; `CHANGELOG` par version ; labels et board pour l'état. Aucun message ne mentionne l'outil ou l'assistant utilisé.
|
|
||||||
|
|
||||||
| Niveau | Contrôle | Quand |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| Local | hooks `pre-commit` (ruff, gofmt, détection de secrets), `.gitmessage` | avant chaque commit |
|
|
||||||
| Branche | CI : lint, tests, build | à chaque push |
|
|
||||||
| PR | gabarit rempli, checklist cochée, CI obligatoire | avant revue |
|
|
||||||
| Revue | relecture humaine, test local, 1 approbation | avant fusion |
|
|
||||||
| `main` | CI post-fusion, tag SemVer, release notes | à chaque fusion notable |
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# .gitea/workflows/ci.yml (ou .github/workflows/ci.yml)
|
|
||||||
on: { pull_request: , push: { branches: [main] } }
|
|
||||||
jobs:
|
|
||||||
lint: { steps: [ruff check ., gofmt -l . && go vet ./kittens/file_manager/] }
|
|
||||||
tests: { steps: [go test ./kittens/file_manager/, ./test.py type-check] }
|
|
||||||
build: { steps: [./dev.sh deps && ./dev.sh build] }
|
|
||||||
```
|
|
||||||
|
|
||||||
Hygiène : `.gitignore` à la racine, jamais de secrets ni de `git add .` aveugle, pas de force-push sur une branche partagée, commits signés. Chaque `TODO` ou contournement devient une issue `dette`, jamais un commentaire orphelin.
|
|
||||||
|
|
||||||
**Rythme** : point quotidien de 15 min · revue croisée systématique · arrêt propre (branche poussée, carte à jour, état décrit en commentaire si incomplet) · pas de travail « fantôme » d'une semaine en local · bilan d'itération et ajustement de ce document, qui est versionné.
|
|
||||||
|
|
||||||
## 6. Bilan du choix
|
|
||||||
|
|
||||||
**Avantages** : feedback en heures · `main` toujours livrable · conflits limités · traçabilité complète · connaissance partagée (pas de bus factor de 1) · coût d'outillage quasi nul · historique lisible (squash + Conventional Commits + SemVer) · transposable à 5–10 personnes.
|
|
||||||
|
|
||||||
| Limite | Parade |
|
|
||||||
| --- | --- |
|
|
||||||
| Une seule approbation = un angle mort | checklist, CI stricte, test local, 2 approbations dès une 3ᵉ personne |
|
|
||||||
| Pas de `develop` (pas de zone de stabilisation) | branches `release/*` ponctuelles |
|
|
||||||
| La revue peut bloquer | réponse < 24 h, PR courtes, `Draft PR` |
|
|
||||||
| GitHub Flow exige des branches courtes | règle des 3 jours, indicateur « âge des branches » |
|
|
||||||
| Squash = perte de granularité | commits soignés quand même, merge commit pour `release/*` |
|
|
||||||
| Rôles cumulés (petit effectif) | rôles tournants + checklist non négociable |
|
|
||||||
|
|
||||||
*Écartés* : **Git Flow** (surdimensionné, merges massifs), **Feature Branch sans PR** (aucune garantie sur `main`), **trunk-based avec push direct** (trop risqué pour du code qui touche au shell).
|
|
||||||
|
|
||||||
## 7. Récapitulatif
|
|
||||||
|
|
||||||
1. Une seule branche longue, `main`, protégée et toujours verte.
|
|
||||||
2. Branches courtes `type/description` (≤ 3 jours).
|
|
||||||
3. Une issue = une branche = une PR, périmètre strict.
|
|
||||||
4. GitHub Flow, fusion en squash and merge.
|
|
||||||
5. Conventional Commits en anglais, un commit = un changement cohérent.
|
|
||||||
6. SemVer, tags signés, `CHANGELOG`.
|
|
||||||
7. PR obligatoire : gabarit, CI verte, checklist.
|
|
||||||
8. 1 approbation par le binôme (2 dès 3 personnes).
|
|
||||||
9. Push 2×/jour, rebase quotidien, conflits résolus à deux.
|
|
||||||
10. Toute décision est écrite sur GitHub, sinon elle n'existe pas.
|
|
||||||
|
|
||||||
## 8. Annexes
|
|
||||||
|
|
||||||
```
|
|
||||||
[ ] branche à jour, CI verte
|
|
||||||
[ ] diff < ~400 lignes, sinon découpé
|
|
||||||
[ ] issue liée, description remplie (contexte, tests)
|
|
||||||
[ ] propre diff relu (git diff main...HEAD)
|
|
||||||
[ ] aucun fichier généré, secret ou artefact versionné
|
|
||||||
[ ] doc et tests à jour
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git switch -c feat/<sujet>
|
|
||||||
git fetch origin && git rebase origin/main
|
|
||||||
git log --oneline --graph --decorate
|
|
||||||
git diff main...HEAD
|
|
||||||
git rebase -i origin/main
|
|
||||||
git push --force-with-lease
|
|
||||||
git tag -s v0.51.0 -m "release"
|
|
||||||
```
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
# Plan CI/CD — FWS-Kitty
|
|
||||||
|
|
||||||
| Élément | Valeur |
|
|
||||||
| --- | --- |
|
|
||||||
| Projet | **FWS-Kitty** — fork FWS de kitty (`0.50.0`, Gitea `FWS/FWS-Kitty`) |
|
|
||||||
| Binôme | *Damien Rochat* + *Gianmarco Ruberti* — Novembre 2026 |
|
|
||||||
| Livrables | paquet Arch `fws-kitty` (dépôt pacman, base de l'ISO FWS) + documentation Sphinx |
|
|
||||||
| Documents liés | `methodologie-git-github.md`, `annexes/pipeline-ci.yml` |
|
|
||||||
|
|
||||||
> **Constat** : aucune CI dans le dépôt (pas de `.github/`, `.gitea/`, `.gitlab-ci.yml` ni `Jenkinsfile`) ; tous les contrôles sont manuels. Ce plan décrit le pipeline cible.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 1. a) Objectifs
|
|
||||||
|
|
||||||
| Axe | Décision |
|
|
||||||
| --- | --- |
|
|
||||||
| **Fréquence** | CI sur chaque push/PR ; **staging automatique** à chaque fusion sur `main` (1–3×/semaine) ; **production sur tag `vX.Y.Z` + approbation manuelle** (toutes les 2–4 semaines, ou `hotfix`) ; build ASAN nightly |
|
|
||||||
| **Rollback** | Le dépôt pacman conserve les **3 dernières versions** ; retrait d'une version fautive par `repo-remove` (jamais de suppression d'artefact) ; tags immuables, artefact reconstructible ; **RTO ≤ 30 min, RPO = 0** |
|
|
||||||
| **Sécurité / conformité** | GPL-3.0 (sources publiées, `LICENSE` dans le paquet) ; **paquets et base `repo-add` signés GPG** ; aucun secret versionné, secrets scopés par environnement ; audit des dépendances à chaque PR ; SBOM + SHA-256 par release ; `main` protégée (PR + 1 approbation + CI verte) |
|
|
||||||
| **Performance** | Lint/audit ≤ 3 min ; **pipeline PR ≤ 20 min** ; build ≤ 25 min (caches `ccache`/Go/bundle) ; release ≤ 45 min ; runner ≥ 4 vCPU / 8 Go |
|
|
||||||
| **Contraintes** | Linux x86_64 uniquement (`dev.sh` refuse Windows) ; **Arch obligatoire** pour `makepkg`, qui refuse `root` ; ~25 dépendances système ; bundle de dépendances téléchargé d'un hôte tiers **sans somme de contrôle** ; code Go généré avant `go vet` ; `./test.py` exige un binaire compilé et un serveur X ; CI Gitea = runner `act_runner` à administrer |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 2. b) Analyse technique
|
|
||||||
|
|
||||||
### Technologies et impact CI/CD
|
|
||||||
|
|
||||||
| Techno | Impact |
|
|
||||||
| --- | --- |
|
|
||||||
| **C** (cœur, `glfw/`, `glad/`, `3rdparty/`) | Étape de build la plus longue → image Arch pré-équipée, `ccache` ; `clang-format --dry-run --Werror` (`.clang-format`) ; ASAN/UBSAN via `make asan` en nightly |
|
|
||||||
| **Python ≥ 3.12** | `ruff check` + `ruff format --check` (`pyproject.toml`), `ty` via `./test.py type-check`, `unittest` dans `kitty_tests/` (90 fichiers) ; le bundle fournit son propre Python |
|
|
||||||
| **Go ≥ 1.26** | `gofmt -s -l`, `go vet`, `staticcheck` (`staticcheck.conf`), `go test --tags testing` ; caches `GOCACHE`/`GOMODCACHE` ; `go.sum` = surface d'audit |
|
|
||||||
| **Sphinx/Furo** (`docs/requirements.txt`) | Build docs avec `FAIL_WARN=1` ; **versions non figées** → à épingler |
|
|
||||||
| **`setup.py` / `bypy`** | `./dev.sh build` est le **seul point d'entrée valable** (génère `*_generated.go`, compile shaders via `slangc`) : la CI ne doit pas appeler `go build` seul |
|
|
||||||
| **`makepkg` / `repo-add`** | Conteneur Arch + utilisateur non-root ; `repo-add --sign` ; publication `rsync` |
|
|
||||||
| **Gitea** | CI via `act_runner` (syntaxe Actions) ; API pour releases ; webhooks de notification |
|
|
||||||
|
|
||||||
### Hébergement et sécurisation
|
|
||||||
|
|
||||||
| Composant | Choix et mesures |
|
|
||||||
| --- | --- |
|
|
||||||
| Source | Gitea auto-hébergé ; `main` protégée, commits signés, `CODEOWNERS` sur `kittens/file_manager/`, `packaging/`, `docs/` |
|
|
||||||
| Runner | VM Arch dédiée, runner privé ; **aucun secret exposé aux PR de forks** ; jeton courte durée ; image de build reconstruite chaque semaine |
|
|
||||||
| Dépôts pacman | Staging `fws-testing` et prod `fws` en HTTPS statique ; écriture par clé SSH dédiée ; **prod signée** et lue avec `SigLevel = Required DatabaseOptional` — le `SigLevel = Optional TrustAll` de `packaging/README.md` ne doit pas être repris en production |
|
|
||||||
| Clés / artefacts | Clé GPG FWS uniquement dans le job de production (passphrase, rotation annuelle) ; 3 dernières versions conservées + archive hors ligne ; journaux 90 jours |
|
|
||||||
|
|
||||||
### Environnements
|
|
||||||
|
|
||||||
| Env | Usage | Moyens | Cycle de vie |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| **dev** | développement local | Arch/WSL2/`Dockerfile.arch`, `./dev.sh` | permanent, par développeur |
|
|
||||||
| **test (CI)** | valider chaque commit | conteneur Arch jetable, `HOME`/XDG redirigés, `CI=true`, `xvfb-run` | éphémère |
|
|
||||||
| **staging** | paquet installable + ISO de test | dépôt `fws-testing`, VM Arch | auto sur `main`, conservé 30 j |
|
|
||||||
| **prod** | utilisateurs et ISO FWS | dépôt `fws` signé, releases Gitea | tag validé uniquement, immuable |
|
|
||||||
|
|
||||||
### Variables et secrets
|
|
||||||
|
|
||||||
Variables non sensibles : `CI=true`, `DEVELOP_ROOT`, `PKG_CONFIG_PATH`, `SLANGC` (posés par `dev.sh`), `GOCACHE`, `GOMODCACHE`, `CCACHE_DIR`, `SOURCE_DATE_EPOCH`, `PKGEXT=.pkg.tar.zst`, `MAKEFLAGS=-j4`, `DISPLAY=:99`, `KITTY_DISABLE_WAYLAND=1`, `PACMAN_REPO_URL`, `PKGVER`/`PKGREL`.
|
|
||||||
|
|
||||||
| Secret | Usage | Portée |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| `GPG_PRIVATE_KEY` + `GPG_PASSPHRASE` | signature des paquets | **prod uniquement**, rotation annuelle |
|
|
||||||
| `REPO_DEPLOY_SSH_KEY` (×2) | écriture dépôts staging / prod | clés distinctes, trimestrielle |
|
|
||||||
| `GITEA_TOKEN` | release + artefacts | dépôt, portée `repo`, trimestrielle |
|
|
||||||
| `NOTIFY_WEBHOOK_URL` | notifications d'équipe | équipe |
|
|
||||||
| `GPG_KEY_ID`, `REPO_DEPLOY_HOST`/`_USER` | paramètres de publication | par environnement |
|
|
||||||
|
|
||||||
Règles : secrets masqués dans les logs (un secret affiché est tourné), scan `gitleaks` à chaque PR, aucune publication possible depuis une PR externe.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 3. c) Pipeline
|
|
||||||
|
|
||||||
```
|
|
||||||
PR / push ─► 0 Hygiène ─► 1 Qualité ∥ 2 Audit ─► 3 Build ─► 4 Tests ─► 5 Paquet
|
|
||||||
│
|
|
||||||
main ─► 6a Staging (auto) ◄──────────────────────┤
|
|
||||||
tag v* ─► 6b Prod (approbation) ◄───────────────────┘
|
|
||||||
└─► 7 Monitoring
|
|
||||||
```
|
|
||||||
|
|
||||||
| # | Étape | Outils | Feedback |
|
|
||||||
| --- | --- | --- | --- |
|
|
||||||
| 0 | Hygiène | `git diff --check`, Commitlint (Conventional Commits), contrôle des artefacts versionnés (`*.pkg.tar.zst`, `dependencies/`, `*_generated.go`, `.env*`) | annotation sur le commit fautif, merge bloqué |
|
|
||||||
| 1 | Qualité | `ruff check` / `ruff format --check`, `./test.py type-check` (`ty`), `gofmt -s -l`, `go vet`, `staticcheck`, `clang-format`, `shellcheck` | annotations fichier:ligne + correctif suggéré |
|
|
||||||
| 2 | Audit | `govulncheck ./...`, `pip-audit -r docs/requirements.txt`, `osv-scanner`, `trivy`, `gitleaks`, `go-licenses` (GPL), `syft` (SBOM) | résumé CVE en PR, issue `sécurité` pour le non bloquant, alerte si critique avec correctif |
|
|
||||||
| 3 | Build | `./dev.sh deps` (bundle mirroré + empreinte), `./dev.sh build`, `make -C docs html FAIL_WARN=1`, smoke `kitty --version` | journal en artefact, durée vs médiane (+20 % = alerte) |
|
|
||||||
| 4 | Tests | `xvfb-run -a ./test.py` (Python + Go, 8 workers), `go test --tags testing ./kittens/file_manager/`, couverture, ASAN nightly | JUnit + résumé + 5 tests les plus lents, annotation sur l'échec |
|
|
||||||
| 5 | Paquet | `pkgver` depuis le tag, `makepkg -f --nodeps`, `gpg --detach-sign`, `repo-add --sign`, `namcap`, **installation réelle dans un conteneur Arch propre** (bloquant) | taille, dépendances, résultat d'installation |
|
|
||||||
| 6a | Staging (auto) | `rsync` + `pacman -Sy && kitty --version` depuis le dépôt publié | « staging prêt » + empreinte ; retrait auto de l'index si la vérification échoue |
|
|
||||||
| 6b | Prod (manuel) | approbation d'environnement, publication signée, release Gitea (paquet, SBOM, SHA-256) | release + notification + rappel de rollback |
|
|
||||||
|
|
||||||
Bonnes pratiques : `cancel-in-progress` sur PR ; jobs idempotents ; un échec indique toujours la cause et l'action ; `go vet` limité aux paquets autonomes en PR rapide, étendu après build en job complet ; un test intermittent crée une issue, pas un re-run en boucle.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. d) Suivi après mise en production
|
|
||||||
|
|
||||||
| Forme | But |
|
|
||||||
| --- | --- |
|
|
||||||
| **Santé du paquet publié** (job quotidien) | `pacman -Syu fws-kitty` puis `kitty --version` dans un conteneur Arch propre : détecte un dépôt cassé, une signature invalide ou une casse due au rolling release Arch |
|
|
||||||
| **Métriques du pipeline** | durées, taux de succès, reprises : vérifier les objectifs du §1 |
|
|
||||||
| **Veille sécurité** | CVE sur les dépendances du paquet (harfbuzz, openssl, mesa) et sur le bundle |
|
|
||||||
|
|
||||||
Seuils d'alerte : succès `main` < 95 % sur 20 runs, pipeline PR p95 > 20 min, 1 échec d'installation prod, 1 CVE critique corrigeable, branche ouverte > 3 jours. **Pas de télémétrie embarquée** : le retour utilisateur passe par les issues, on n'ajoute pas de mouchard à un terminal. Amélioration continue : revue mensuelle du pipeline, post-mortem sans blâme, mesure avant toute optimisation, contrôles non bloquants promus en bloquants une fois la dette résorbée.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 5. Livrables, déploiement et rollback
|
|
||||||
|
|
||||||
**Besoins** : feedback rapide et `main` verte, paquet signé testé avant publication, staging auto, prod validée, rollback ≤ 30 min, conformité GPL, traçabilité commit → artefact.
|
|
||||||
|
|
||||||
**Dépendances externes**
|
|
||||||
|
|
||||||
| Dépendance | Risque / parade |
|
|
||||||
| --- | --- |
|
|
||||||
| Bundle `download.calibre-ebook.com` (Python, Sphinx, pkg-config, polices) | aucune somme de contrôle → **mirrorer et vérifier l'empreinte** |
|
|
||||||
| Nerd Fonts `v3.5.1` | déjà épinglée par `sha256sums` ✔ |
|
|
||||||
| Dépôts Arch `core`/`extra` | rolling release → job de santé quotidien |
|
|
||||||
| Modules Go / PyPI | versions Go figées (audit) ; **`docs/requirements.txt` à épingler** |
|
|
||||||
| Gitea et serveur pacman | sauvegardes, artefacts archivés hors ligne |
|
|
||||||
|
|
||||||
**Pas de BDD, d'API ni de microservice** : le livrable est un binaire, aucune dépendance runtime réseau.
|
|
||||||
|
|
||||||
**Déploiement staging (automatique, après build + tests)**
|
|
||||||
```sh
|
|
||||||
cd packaging && makepkg -f --nodeps
|
|
||||||
repo-add fws-kitty.db.tar.gz fws-kitty-*.pkg.tar.zst
|
|
||||||
rsync -av fws-kitty.db* fws-kitty-*.pkg.tar.zst \
|
|
||||||
"$REPO_USER@$REPO_HOST:/srv/pacman/fws/testing/x86_64/"
|
|
||||||
# vérif : conteneur Arch propre, pacman -Sy fws-kitty && kitty --version
|
|
||||||
```
|
|
||||||
|
|
||||||
**Déploiement production (manuel)** : `main` verte + staging de la même version validé → `git tag -s vX.Y.Z` et push → **approbation de l'environnement `production`** → publication signée + release Gitea → vérification d'installation → notification.
|
|
||||||
|
|
||||||
**Rollback** : `sudo pacman -U /var/cache/pacman/pkg/fws-kitty-<version>-<rel>-x86_64.pkg.tar.zst`, ou côté dépôt `repo-remove` puis `repo-add --sign` sur les versions antérieures ; publier ensuite un `hotfix` (`PATCH`) et documenter l'incident.
|
|
||||||
|
|
||||||
**Mise en œuvre** : 0) mesurer les durées réelles et épingler les dépendances → 1) runner + image + lint/build → 2) tests complets + audit → 3) paquet + staging → 4) signature + prod + rollback testé → 5) monitoring. Actions immédiates : sortir les 4 `*.pkg.tar.zst` de `packaging/` du versionnement, remplacer `SigLevel = Optional TrustAll`, mirrorer le bundle.
|
|
||||||
|
|
||||||
**Annexes** : `annexes/pipeline-ci.yml` (workflow complet, non actif), `methodologie-git-github.md`, `README.md`.
|
|
||||||
+15
-25
@@ -12,31 +12,21 @@ window manager. The keyboard controls (which are :ref:`all customizable
|
|||||||
Scrolling
|
Scrolling
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
========================== =======================
|
========================= =======================
|
||||||
Action Shortcut
|
Action Shortcut
|
||||||
========================== =======================
|
========================= =======================
|
||||||
Line up :sc:`scroll_line_up` (also :kbd:`⌥+⌘+⇞` and :kbd:`⌘+↑` on macOS)
|
Line up :sc:`scroll_line_up` (also :kbd:`⌥+⌘+⇞` and :kbd:`⌘+↑` on macOS)
|
||||||
Line down :sc:`scroll_line_down` (also :kbd:`⌥+⌘+⇟` and :kbd:`⌘+↓` on macOS)
|
Line down :sc:`scroll_line_down` (also :kbd:`⌥+⌘+⇟` and :kbd:`⌘+↓` on macOS)
|
||||||
Page up :sc:`scroll_page_up` (also :kbd:`⌘+⇞` on macOS)
|
Page up :sc:`scroll_page_up` (also :kbd:`⌘+⇞` on macOS)
|
||||||
Page down :sc:`scroll_page_down` (also :kbd:`⌘+⇟` on macOS)
|
Page down :sc:`scroll_page_down` (also :kbd:`⌘+⇟` on macOS)
|
||||||
Top :sc:`scroll_home` (also :kbd:`⌘+↖` on macOS)
|
Top :sc:`scroll_home` (also :kbd:`⌘+↖` on macOS)
|
||||||
Bottom :sc:`scroll_end` (also :kbd:`⌘+↘` on macOS)
|
Bottom :sc:`scroll_end` (also :kbd:`⌘+↘` on macOS)
|
||||||
Previous shell prompt :sc:`scroll_to_previous_prompt` (see :ref:`shell_integration`)
|
Previous shell prompt :sc:`scroll_to_previous_prompt` (see :ref:`shell_integration`)
|
||||||
Next shell prompt :sc:`scroll_to_next_prompt` (see :ref:`shell_integration`)
|
Next shell prompt :sc:`scroll_to_next_prompt` (see :ref:`shell_integration`)
|
||||||
Browse scrollback in less :sc:`show_scrollback`
|
Browse scrollback in less :sc:`show_scrollback`
|
||||||
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
|
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
|
||||||
Search scrollback in less :sc:`search_scrollback` (also :kbd:`⌘+F` on macOS)
|
Search scrollback in less :sc:`search_scrollback` (also :kbd:`⌘+F` on macOS)
|
||||||
Search scrollback in place :sc:`search_scrollback_prompt`
|
========================= =======================
|
||||||
========================== =======================
|
|
||||||
|
|
||||||
The in-place search highlights every match without replacing the screen with a
|
|
||||||
pager. Prefix the query with ``\c`` to match case sensitively and with ``\r``
|
|
||||||
to use a regular expression; both modifiers can be combined. While the search
|
|
||||||
is active, :kbd:`n` jumps to the next match, :kbd:`N` to the previous one and
|
|
||||||
:kbd:`Escape` ends it. The ``[current/total]`` counter is shown in the window
|
|
||||||
title and matches use the first marker color (see :opt:`mark1_foreground`).
|
|
||||||
The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and
|
|
||||||
:ac:`clear_scrollback_search` actions can also be mapped directly.
|
|
||||||
|
|
||||||
The scroll actions only take effect when the terminal is in the main screen.
|
The scroll actions only take effect when the terminal is in the main screen.
|
||||||
When the alternate screen is active (for example when using a full screen
|
When the alternate screen is active (for example when using a full screen
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@ Installer kitty
|
|||||||
========================
|
========================
|
||||||
|
|
||||||
Installation des binaires
|
Installation des binaires
|
||||||
-------------------------
|
----------------
|
||||||
|
|
||||||
.. highlight:: sh
|
.. highlight:: sh
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ dossier d'installation. Pour désinstaller, il suffit de supprimer ce dossier.
|
|||||||
|
|
||||||
|
|
||||||
Compiler depuis les sources
|
Compiler depuis les sources
|
||||||
---------------------------
|
------------------------
|
||||||
|
|
||||||
|kitty| est facile à compiler depuis les sources, suivez les :doc:`instructions
|
|kitty| est facile à compiler depuis les sources, suivez les :doc:`instructions
|
||||||
<build>`.
|
<build>`.
|
||||||
+2
-2
@@ -146,7 +146,7 @@ Dépendances de compilation :
|
|||||||
|
|
||||||
|
|
||||||
Compiler et exécuter depuis les sources avec Nix
|
Compiler et exécuter depuis les sources avec Nix
|
||||||
------------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
Sous NixOS ou tout autre système Linux ou macOS disposant du gestionnaire de
|
Sous NixOS ou tout autre système Linux ou macOS disposant du gestionnaire de
|
||||||
paquets Nix, exécutez `nix-shell
|
paquets Nix, exécutez `nix-shell
|
||||||
@@ -163,7 +163,7 @@ votre plateforme ci-dessus.
|
|||||||
.. _packagers:
|
.. _packagers:
|
||||||
|
|
||||||
Notes pour les empaqueteurs Linux/macOS
|
Notes pour les empaqueteurs Linux/macOS
|
||||||
---------------------------------------
|
----------------------------------
|
||||||
|
|
||||||
Le code source publié de |kitty| est disponible sous forme de `tarball`_ depuis
|
Le code source publié de |kitty| est disponible sous forme de `tarball`_ depuis
|
||||||
`la page des versions GitHub
|
`la page des versions GitHub
|
||||||
|
|||||||
@@ -273,22 +273,6 @@ Detailed list of changes
|
|||||||
:doc:`accessibility guide </accessibility>` documents keyboard navigation and
|
:doc:`accessibility guide </accessibility>` documents keyboard navigation and
|
||||||
the :opt:`text_fg_override_threshold` :code:`4.5 ratio` contrast mode.
|
the :opt:`text_fg_override_threshold` :code:`4.5 ratio` contrast mode.
|
||||||
|
|
||||||
- The scrollback can now be searched in place: :ac:`search_scrollback_prompt`
|
|
||||||
highlights every match without opening the pager, shows the
|
|
||||||
:code:`[current/total]` counter in the window title and moves between matches
|
|
||||||
with :kbd:`n` and :kbd:`N`. Prefix the query with :code:`\c` for a case
|
|
||||||
sensitive search and :code:`\r` for a regular expression. See
|
|
||||||
:doc:`basic` for the details.
|
|
||||||
|
|
||||||
- A configurable :opt:`leader` key now opens a which-key panel listing every
|
|
||||||
multi-key mapping available under that prefix, without waiting for a timeout.
|
|
||||||
The :doc:`command palette <kittens/command-palette>` shows the shortcut next
|
|
||||||
to each action and :kbd:`Ctrl+R` remaps it. See :ref:`leader_keymap`.
|
|
||||||
|
|
||||||
- The :doc:`file manager <kittens/file-manager>` now follows symbolic links to
|
|
||||||
directories, so they can be browsed like real ones, and expands a leading
|
|
||||||
:code:`~` in :code:`--start-dir`.
|
|
||||||
|
|
||||||
- A new :doc:`file manager kitten <kittens/file-manager>`, run with
|
- A new :doc:`file manager kitten <kittens/file-manager>`, run with
|
||||||
:code:`kitten file-manager`, that browses directories in a side panel and
|
:code:`kitten file-manager`, that browses directories in a side panel and
|
||||||
changes the working directory of the shell that launched it without leaving
|
changes the working directory of the shell that launched it without leaving
|
||||||
|
|||||||
+6
-12
@@ -20,7 +20,7 @@ from docutils import nodes
|
|||||||
from docutils.parsers.rst.roles import normalize_options
|
from docutils.parsers.rst.roles import normalize_options
|
||||||
from pygments.lexer import RegexLexer
|
from pygments.lexer import RegexLexer
|
||||||
from pygments.lexer import bygroups as untyped_bygroups
|
from pygments.lexer import bygroups as untyped_bygroups
|
||||||
from pygments.token import Comment, Error, Keyword, Literal, Name, Number, Punctuation, String, Whitespace
|
from pygments.token import Comment, Error, Keyword, Literal, Name, Number, String, Whitespace
|
||||||
from sphinx import addnodes, version_info
|
from sphinx import addnodes, version_info
|
||||||
from sphinx.util.logging import getLogger
|
from sphinx.util.logging import getLogger
|
||||||
|
|
||||||
@@ -220,19 +220,15 @@ def commit_role(
|
|||||||
name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
|
name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
|
||||||
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
|
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
|
||||||
"Link to a github commit"
|
"Link to a github commit"
|
||||||
# The changelog also cites upstream kitty commits, which a shallow clone of
|
|
||||||
# the fork does not contain: link to the id as written instead of failing
|
|
||||||
# the documentation build over missing local history.
|
|
||||||
try:
|
try:
|
||||||
commit_id = subprocess.check_output(f'git rev-list --max-count=1 {text}'.split(), stderr=subprocess.DEVNULL).decode('utf-8').strip()
|
commit_id = subprocess.check_output(f'git rev-list --max-count=1 {text}'.split()).decode('utf-8').strip()
|
||||||
except Exception:
|
except Exception:
|
||||||
commit_id = text
|
msg = inliner.reporter.error(f'git commit id "{text}" not recognized.', line=lineno)
|
||||||
|
prb = inliner.problematic(rawtext, rawtext, msg)
|
||||||
|
return [prb], [msg]
|
||||||
url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}'
|
url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}'
|
||||||
options = normalize_options(options)
|
options = normalize_options(options)
|
||||||
try:
|
short_id = subprocess.check_output(f'git rev-list --max-count=1 --abbrev-commit {commit_id}'.split()).decode('utf-8').strip()
|
||||||
short_id = subprocess.check_output(f'git rev-list --max-count=1 --abbrev-commit {commit_id}'.split(), stderr=subprocess.DEVNULL).decode('utf-8').strip()
|
|
||||||
except Exception:
|
|
||||||
short_id = commit_id
|
|
||||||
node = nodes.reference(rawtext, f'commit: {short_id}', refuri=url, **options)
|
node = nodes.reference(rawtext, f'commit: {short_id}', refuri=url, **options)
|
||||||
return [node], []
|
return [node], []
|
||||||
|
|
||||||
@@ -511,8 +507,6 @@ class ConfLexer(RegexLexer):
|
|||||||
tokens = {
|
tokens = {
|
||||||
'root': [
|
'root': [
|
||||||
(r'#.*?$', Comment.Single),
|
(r'#.*?$', Comment.Single),
|
||||||
# Closing brace of a profile block, see :ref:`config-profiles`.
|
|
||||||
(r'\}', Punctuation),
|
|
||||||
(r'\s+$', Whitespace),
|
(r'\s+$', Whitespace),
|
||||||
(r'\s+', Whitespace),
|
(r'\s+', Whitespace),
|
||||||
(r'(include)(\s+)(.+?)$', bygroups(Comment.Preproc, Whitespace, Name.Namespace)),
|
(r'(include)(\s+)(.+?)$', bygroups(Comment.Preproc, Whitespace, Name.Namespace)),
|
||||||
|
|||||||
+2
-6
@@ -100,16 +100,12 @@ quand même avec le reste de la configuration.
|
|||||||
Les profils ne peuvent pas être imbriqués. Ils peuvent toutefois utiliser
|
Les profils ne peuvent pas être imbriqués. Ils peuvent toutefois utiliser
|
||||||
:code:`include` et les autres directives d'inclusion.
|
:code:`include` et les autres directives d'inclusion.
|
||||||
|
|
||||||
.. envvar:: KITTY_PROFILE
|
|
||||||
|
|
||||||
Nom du profil à activer au démarrage, voir :ref:`config-profiles`.
|
|
||||||
|
|
||||||
|
|
||||||
.. include:: /generated/conf-kitty.rst
|
.. include:: /generated/conf-kitty.rst
|
||||||
|
|
||||||
|
|
||||||
Exemple de kitty.conf
|
Exemple de kitty.conf
|
||||||
---------------------
|
--------------------
|
||||||
|
|
||||||
.. only:: html
|
.. only:: html
|
||||||
|
|
||||||
@@ -133,7 +129,7 @@ Cela affichera le fichier de configuration par défaut commenté sur
|
|||||||
:file:`STDOUT`.
|
:file:`STDOUT`.
|
||||||
|
|
||||||
Toutes les actions associables
|
Toutes les actions associables
|
||||||
------------------------------
|
------------------------
|
||||||
|
|
||||||
Voir la :doc:`liste de tout ce que vous pouvez faire faire à |kitty| </actions>`.
|
Voir la :doc:`liste de tout ce que vous pouvez faire faire à |kitty| </actions>`.
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -83,10 +83,10 @@ Glossaire
|
|||||||
.. _env_vars:
|
.. _env_vars:
|
||||||
|
|
||||||
Variables d'environnement
|
Variables d'environnement
|
||||||
-------------------------
|
------------------------
|
||||||
|
|
||||||
Variables qui influencent le comportement de kitty
|
Variables qui influencent le comportement de kitty
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. envvar:: KITTY_CONFIG_DIRECTORY
|
.. envvar:: KITTY_CONFIG_DIRECTORY
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ Variables qui influencent le comportement de kitty
|
|||||||
|
|
||||||
|
|
||||||
Variables que kitty définit en lançant des programmes enfants
|
Variables que kitty définit en lançant des programmes enfants
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. envvar:: LANG
|
.. envvar:: LANG
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
:orphan:
|
:orphan:
|
||||||
|
|
||||||
L'interface en ligne de commande de kitty
|
L'interface en ligne de commande de kitty
|
||||||
=========================================
|
====================================
|
||||||
|
|
||||||
.. program:: kitty
|
.. program:: kitty
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ Il peut aussi tourner dans un :doc:`panneau du bureau </kittens/panel>` ou dans
|
|||||||
n'importe quelle :term:`fenêtre kitty <window>` classique.
|
n'importe quelle :term:`fenêtre kitty <window>` classique.
|
||||||
|
|
||||||
Le répertoire de départ est celui de la fenêtre courante, sauf si un répertoire
|
Le répertoire de départ est celui de la fenêtre courante, sauf si un répertoire
|
||||||
est passé en argument ou avec ``--start-dir``. Un chemin commençant par ``~``
|
est passé en argument ou avec ``--start-dir``.
|
||||||
y est développé, même lorsqu'il vient d'un mappage où le shell ne l'a pas fait.
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@@ -62,9 +61,7 @@ Actions
|
|||||||
|
|
||||||
:kbd:`→` ou :kbd:`L`
|
:kbd:`→` ou :kbd:`L`
|
||||||
descend dans le répertoire sélectionné ; le shell y va aussi, au prompt
|
descend dans le répertoire sélectionné ; le shell y va aussi, au prompt
|
||||||
suivant, quand la synchronisation est active. Un lien symbolique vers un
|
suivant, quand la synchronisation est active.
|
||||||
répertoire se parcourt comme un répertoire ; un lien cassé reste une entrée
|
|
||||||
ordinaire, ouverte dans l'éditeur.
|
|
||||||
|
|
||||||
:kbd:`←`, :kbd:`Retour arrière` ou :kbd:`H`
|
:kbd:`←`, :kbd:`Retour arrière` ou :kbd:`H`
|
||||||
remonte au répertoire parent.
|
remonte au répertoire parent.
|
||||||
@@ -235,9 +232,6 @@ Limites
|
|||||||
pour changer de répertoire ; utilisez-le depuis une fenêtre de shell.
|
pour changer de répertoire ; utilisez-le depuis une fenêtre de shell.
|
||||||
- Le panneau ne suit pas les modifications faites par d'autres programmes :
|
- Le panneau ne suit pas les modifications faites par d'autres programmes :
|
||||||
utilisez :kbd:`Ctrl+R` pour relire le répertoire.
|
utilisez :kbd:`Ctrl+R` pour relire le répertoire.
|
||||||
- Les liens symboliques ne sont pas distingués des fichiers ordinaires dans
|
|
||||||
l'affichage : seul le fait qu'ils pointent vers un répertoire change leur
|
|
||||||
comportement à l'ouverture.
|
|
||||||
|
|
||||||
.. include:: /generated/conf-kitten-file_manager.rst
|
.. include:: /generated/conf-kitten-file_manager.rst
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ défaut).
|
|||||||
Utilisation
|
Utilisation
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Dans le :doc:`shell kitty </remote-control>` (:kbd:`Ctrl+Shift+Échap`), la commande
|
Dans le :doc:`shell kitty </shell>` (:kbd:`Ctrl+Shift+Échap`), la commande
|
||||||
``help`` sans argument ouvre le panneau, tout comme :kbd:`kitty_mod+H` dans
|
``help`` sans argument ouvre le panneau, tout comme :kbd:`kitty_mod+H` dans
|
||||||
n'importe quelle fenêtre ::
|
n'importe quelle fenêtre ::
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.. _kittens:
|
.. _kittens:
|
||||||
|
|
||||||
Étendre avec les kittens
|
Étendre avec les kittens
|
||||||
------------------------
|
-----------------------
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|||||||
+3
-3
@@ -124,7 +124,7 @@ Par exemple ::
|
|||||||
.. _watchers:
|
.. _watchers:
|
||||||
|
|
||||||
Surveiller les fenêtres lancées
|
Surveiller les fenêtres lancées
|
||||||
-------------------------------
|
---------------------------
|
||||||
|
|
||||||
L'option :option:`launch --watcher` vous permet d'indiquer des fonctions Python
|
L'option :option:`launch --watcher` vous permet d'indiquer des fonctions Python
|
||||||
qui seront appelées lors d'événements précis, comme le redimensionnement ou la
|
qui seront appelées lors d'événements précis, comme le redimensionnement ou la
|
||||||
@@ -238,7 +238,7 @@ de contrôle à distance à votre disposition.
|
|||||||
|
|
||||||
|
|
||||||
Recherche des exécutables
|
Recherche des exécutables
|
||||||
-------------------------
|
-----------------------
|
||||||
|
|
||||||
Lorsque vous indiquez une commande à exécuter sous forme de simple nom plutôt
|
Lorsque vous indiquez une commande à exécuter sous forme de simple nom plutôt
|
||||||
que de chemin absolu, elle est recherchée dans la variable d'environnement
|
que de chemin absolu, elle est recherchée dans la variable d'environnement
|
||||||
@@ -252,6 +252,6 @@ shell est utilisée.
|
|||||||
Voir :opt:`exe_search_path` pour les détails et la façon de contrôler cela.
|
Voir :opt:`exe_search_path` pour les détails et la façon de contrôler cela.
|
||||||
|
|
||||||
Référence de syntaxe
|
Référence de syntaxe
|
||||||
--------------------
|
------------------
|
||||||
|
|
||||||
.. include:: /generated/launch.rst
|
.. include:: /generated/launch.rst
|
||||||
+1
-1
@@ -467,7 +467,7 @@ All mappable actions
|
|||||||
There is a list of :doc:`all mappable actions <actions>`.
|
There is a list of :doc:`all mappable actions <actions>`.
|
||||||
|
|
||||||
Remapping from the command palette
|
Remapping from the command palette
|
||||||
----------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Every entry in the command palette shows the shortcut currently bound to it.
|
Every entry in the command palette shows the shortcut currently bound to it.
|
||||||
Select an action and press :kbd:`Ctrl+R` to remap it: the footer asks for the
|
Select an action and press :kbd:`Ctrl+R` to remap it: the footer asks for the
|
||||||
|
|||||||
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
Marquer du texte à l'écran
|
Marquer du texte à l'écran
|
||||||
--------------------------
|
---------------------
|
||||||
|
|
||||||
|
|
||||||
kitty peut marquer du texte à l'écran à partir d'expressions régulières. C'est
|
kitty peut marquer du texte à l'écran à partir d'expressions régulières. C'est
|
||||||
@@ -67,7 +67,7 @@ Vous pouvez aussi utiliser les facilités de :doc:`contrôle à distance
|
|||||||
|
|
||||||
|
|
||||||
Défiler jusqu'aux marques
|
Défiler jusqu'aux marques
|
||||||
-------------------------
|
--------------------
|
||||||
|
|
||||||
kitty dispose d'une action :ac:`scroll_to_mark` pour défiler jusqu'à la ligne
|
kitty dispose d'une action :ac:`scroll_to_mark` pour défiler jusqu'à la ligne
|
||||||
suivante contenant une marque. Vous pouvez l'utiliser en l'associant à un
|
suivante contenant une marque. Vous pouvez l'utiliser en l'associant à un
|
||||||
@@ -88,7 +88,7 @@ Ce qui ne défilera que vers les marques de type 1.
|
|||||||
|
|
||||||
|
|
||||||
La syntaxe complète pour créer des marques
|
La syntaxe complète pour créer des marques
|
||||||
------------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
La syntaxe de l'action :ac:`toggle_marker` est ::
|
La syntaxe de l'action :ac:`toggle_marker` est ::
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ Ici :code:`marker-type` vaut l'un des suivants :
|
|||||||
.. _marker_funcs:
|
.. _marker_funcs:
|
||||||
|
|
||||||
Fonctions de marqueur arbitraires
|
Fonctions de marqueur arbitraires
|
||||||
---------------------------------
|
-----------------------------
|
||||||
|
|
||||||
Vous pouvez créer vos propres fonctions de marqueur. Créez un fichier Python
|
Vous pouvez créer vos propres fonctions de marqueur. Créez un fichier Python
|
||||||
nommé :file:`mymarker.py` et, à l'intérieur, une fonction :code:`marker`. Cette
|
nommé :file:`mymarker.py` et, à l'intérieur, une fonction :code:`marker`. Cette
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ ci-dessous :
|
|||||||
.. _matching_criteria:
|
.. _matching_criteria:
|
||||||
|
|
||||||
Critères de correspondance
|
Critères de correspondance
|
||||||
--------------------------
|
------------------
|
||||||
|
|
||||||
Une entrée de :file:`open-actions.conf` doit avoir un ou plusieurs critères de
|
Une entrée de :file:`open-actions.conf` doit avoir un ou plusieurs critères de
|
||||||
correspondance. Les URL qui satisfont tous les critères d'une entrée déclenchent
|
correspondance. Les URL qui satisfont tous les critères d'une entrée déclenchent
|
||||||
|
|||||||
+10
-11
@@ -52,7 +52,7 @@ les détails.
|
|||||||
.. _layouts:
|
.. _layouts:
|
||||||
|
|
||||||
Dispositions
|
Dispositions
|
||||||
------------
|
----------
|
||||||
|
|
||||||
Une :term:`disposition <layout>` est un agencement de plusieurs
|
Une :term:`disposition <layout>` est un agencement de plusieurs
|
||||||
:term:`fenêtres kitty <window>` à l'intérieur d'une :term:`fenêtre OS
|
:term:`fenêtres kitty <window>` à l'intérieur d'une :term:`fenêtre OS
|
||||||
@@ -130,7 +130,7 @@ sur le contrôle à distance.
|
|||||||
|
|
||||||
|
|
||||||
Contrôle à distance
|
Contrôle à distance
|
||||||
-------------------
|
------------------
|
||||||
|
|
||||||
|kitty| dispose d'un système très puissant qui vous permet de le piloter
|
|kitty| dispose d'un système très puissant qui vous permet de le piloter
|
||||||
depuis :doc:`l'invite du shell, même via SSH <remote-control>`. Vous pouvez
|
depuis :doc:`l'invite du shell, même via SSH <remote-control>`. Vous pouvez
|
||||||
@@ -159,7 +159,7 @@ facilement d'une session à l'autre avec une combinaison de touches. Voir
|
|||||||
|
|
||||||
|
|
||||||
Créer des onglets et des fenêtres
|
Créer des onglets et des fenêtres
|
||||||
---------------------------------
|
-------------------------------
|
||||||
|
|
||||||
kitty peut exécuter des programmes arbitraires dans de nouveaux :term:`onglets
|
kitty peut exécuter des programmes arbitraires dans de nouveaux :term:`onglets
|
||||||
<tab>`, :term:`fenêtres <window>` ou :term:`surcouches <overlay>` sur une
|
<tab>`, :term:`fenêtres <window>` ou :term:`surcouches <overlay>` sur une
|
||||||
@@ -172,7 +172,7 @@ combinaison de touches. Pour apprendre comment faire, voir :doc:`ici <launch>`.
|
|||||||
|
|
||||||
|
|
||||||
Fonctionnalités de la souris
|
Fonctionnalités de la souris
|
||||||
----------------------------
|
-------------------
|
||||||
|
|
||||||
* Vous pouvez cliquer sur une URL pour l'ouvrir dans un navigateur.
|
* Vous pouvez cliquer sur une URL pour l'ouvrir dans un navigateur.
|
||||||
* Vous pouvez double-cliquer pour sélectionner un mot, puis glisser pour
|
* Vous pouvez double-cliquer pour sélectionner un mot, puis glisser pour
|
||||||
@@ -233,7 +233,7 @@ de nouveaux onglets, ou double-cliquer sur un onglet existant pour le renommer.
|
|||||||
open_actions
|
open_actions
|
||||||
|
|
||||||
Contrôle des polices
|
Contrôle des polices
|
||||||
--------------------
|
-----------------
|
||||||
|
|
||||||
|kitty| dispose de fonctionnalités de sélection de polices extrêmement
|
|kitty| dispose de fonctionnalités de sélection de polices extrêmement
|
||||||
souples et puissantes. Vous pouvez indiquer des familles individuelles pour
|
souples et puissantes. Vous pouvez indiquer des familles individuelles pour
|
||||||
@@ -252,7 +252,7 @@ Le tampon d'historique
|
|||||||
|
|
||||||
|kitty| prend en charge le défilement arrière pour consulter l'historique,
|
|kitty| prend en charge le défilement arrière pour consulter l'historique,
|
||||||
comme la plupart des terminaux. Vous pouvez utiliser les raccourcis clavier ou
|
comme la plupart des terminaux. Vous pouvez utiliser les raccourcis clavier ou
|
||||||
la molette de la souris. |kitty| affiche une :opt:`scrollbar`
|
la molette de la souris. |kitty| affiche une :opt:`barre de défilement`
|
||||||
interactive le long du bord droit de la fenêtre, qui montre votre position
|
interactive le long du bord droit de la fenêtre, qui montre votre position
|
||||||
actuelle dans l'historique. Vous pouvez cliquer et faire glisser la barre de
|
actuelle dans l'historique. Vous pouvez cliquer et faire glisser la barre de
|
||||||
défilement pour naviguer rapidement dans l'historique.
|
défilement pour naviguer rapidement dans l'historique.
|
||||||
@@ -267,13 +267,12 @@ formatage du texte sont préservés. Vous pouvez explorer confortablement le
|
|||||||
tampon d'historique dans le pager.
|
tampon d'historique dans le pager.
|
||||||
|
|
||||||
De plus, vous pouvez envoyer le contenu du tampon d'historique à une commande
|
De plus, vous pouvez envoyer le contenu du tampon d'historique à une commande
|
||||||
arbitraire exécutée dans une nouvelle :term:`fenêtre <window>`, un nouvel
|
arbitraire exécutée dans une nouvelle :term:`fenêtre`, un nouvel :term:`onglet`
|
||||||
:term:`onglet <tab>` ou une :term:`surcouche <overlay>`. Par exemple ::
|
ou une :term:`surcouche`. Par exemple ::
|
||||||
|
|
||||||
map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting less +G -R
|
map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting less +G -R
|
||||||
|
|
||||||
ouvrira le tampon d'historique dans une nouvelle :term:`fenêtre <window>` lorsque
|
ouvrira le tampon d'historique dans une nouvelle :term:`fenêtre` lorsque vous
|
||||||
vous
|
|
||||||
appuyez sur la touche :kbd:`F1`. Voir :sc:`show_scrollback <show_scrollback>`
|
appuyez sur la touche :kbd:`F1`. Voir :sc:`show_scrollback <show_scrollback>`
|
||||||
pour les détails.
|
pour les détails.
|
||||||
|
|
||||||
@@ -308,7 +307,7 @@ les détails.
|
|||||||
.. _cpbuf:
|
.. _cpbuf:
|
||||||
|
|
||||||
Plusieurs tampons de copier/coller
|
Plusieurs tampons de copier/coller
|
||||||
----------------------------------
|
-----------------------------
|
||||||
|
|
||||||
En plus du copier/coller depuis le presse-papiers du système, vous pouvez
|
En plus du copier/coller depuis le presse-papiers du système, vous pouvez
|
||||||
configurer dans |kitty| un nombre arbitraire de tampons de copier/coller. Pour
|
configurer dans |kitty| un nombre arbitraire de tampons de copier/coller. Pour
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ d'énergie pour les tâches courantes, la latence entre le clavier et l'écran,
|
|||||||
le débit (traitement de grandes quantités de données).
|
le débit (traitement de grandes quantités de données).
|
||||||
|
|
||||||
Latence entre le clavier et l'écran
|
Latence entre le clavier et l'écran
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Elle se mesure soit avec du matériel dédié, soit avec des logiciels comme
|
Elle se mesure soit avec du matériel dédié, soit avec des logiciels comme
|
||||||
`Typometer <https://pavelfatin.com/typometer/>`__. Les mesures de tiers
|
`Typometer <https://pavelfatin.com/typometer/>`__. Les mesures de tiers
|
||||||
@@ -122,7 +122,7 @@ d'échappement de formatage typiques et de texte uniquement ASCII.
|
|||||||
|
|
||||||
|
|
||||||
Consommation d'énergie
|
Consommation d'énergie
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Malheureusement, je n'ai pas l'infrastructure pour mesurer la consommation
|
Malheureusement, je n'ai pas l'infrastructure pour mesurer la consommation
|
||||||
d'énergie réelle, l'utilisation du processeur devra donc la représenter. Voici
|
d'énergie réelle, l'utilisation du processeur devra donc la représenter. Voici
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
Soutenez le développement de kitty ❤️
|
Soutenez le développement de kitty ❤️
|
||||||
=====================================
|
==============================
|
||||||
|
|
||||||
Mon objectif avec |kitty| est de faire avancer l'écosystème stagnant des
|
Mon objectif avec |kitty| est de faire avancer l'écosystème stagnant des
|
||||||
terminaux. Dans cette optique, kitty possède de nombreuses fonctionnalités
|
terminaux. Dans cette optique, kitty possède de nombreuses fonctionnalités
|
||||||
|
|||||||
@@ -80,17 +80,7 @@ func read_dir(dir string, show_hidden bool, sort_by string) ([]Entry, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
e := Entry{Name: name, IsDir: item.IsDir()}
|
e := Entry{Name: name, IsDir: item.IsDir()}
|
||||||
info, ierr := item.Info()
|
if info, ierr := item.Info(); ierr == nil {
|
||||||
if item.Type()&os.ModeSymlink != 0 {
|
|
||||||
// A symlink is reported as its own type, so a link to a directory
|
|
||||||
// would be opened in the editor instead of being browsed. Follow
|
|
||||||
// it to classify the entry; broken links stay plain entries.
|
|
||||||
if target, terr := os.Stat(filepath.Join(dir, name)); terr == nil {
|
|
||||||
info, ierr = target, nil
|
|
||||||
e.IsDir = target.IsDir()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ierr == nil {
|
|
||||||
e.ModTime = info.ModTime().Unix()
|
e.ModTime = info.ModTime().Unix()
|
||||||
e.Size = info.Size()
|
e.Size = info.Size()
|
||||||
}
|
}
|
||||||
@@ -100,23 +90,6 @@ func read_dir(dir string, show_hidden bool, sort_by string) ([]Entry, error) {
|
|||||||
return entries, nil
|
return entries, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// expand_home expands a leading ~ so that a directory given in a mapping or by
|
|
||||||
// the remote control API, where no shell expands it, names the same directory
|
|
||||||
// as it would on the command line.
|
|
||||||
func expand_home(path string) (string, error) {
|
|
||||||
if path != "~" && !strings.HasPrefix(path, "~/") {
|
|
||||||
return path, nil
|
|
||||||
}
|
|
||||||
home, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if path == "~" {
|
|
||||||
return home, nil
|
|
||||||
}
|
|
||||||
return filepath.Join(home, path[2:]), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func entry_path(dir, name string) string {
|
func entry_path(dir, name string) string {
|
||||||
return filepath.Join(dir, name)
|
return filepath.Join(dir, name)
|
||||||
}
|
}
|
||||||
@@ -196,10 +169,6 @@ func resolve_start_dir(candidate string) (string, error) {
|
|||||||
}
|
}
|
||||||
candidate = cwd
|
candidate = cwd
|
||||||
}
|
}
|
||||||
candidate, err := expand_home(candidate)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
abs, err := filepath.Abs(candidate)
|
abs, err := filepath.Abs(candidate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -80,66 +80,6 @@ func TestReadDirReportsErrors(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadDirAcceptsAnEmptyDirectory(t *testing.T) {
|
|
||||||
entries, err := read_dir(t.TempDir(), false, "name")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if len(entries) != 0 {
|
|
||||||
t.Fatalf("an empty directory must list nothing, got %#v", entries)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadDirReportsPermissionDenied(t *testing.T) {
|
|
||||||
dir := t.TempDir()
|
|
||||||
if err := os.Chmod(dir, 0o000); err != nil {
|
|
||||||
t.Skipf("cannot change permissions: %v", err)
|
|
||||||
}
|
|
||||||
// Make the directory readable again before TempDir cleans it up.
|
|
||||||
defer os.Chmod(dir, 0o700) //nolint:errcheck
|
|
||||||
if _, err := read_dir(dir, false, "name"); err == nil {
|
|
||||||
t.Skip("the current user can read a mode 000 directory, probably running as root")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadDirTreatsSymlinkedDirectoryAsDirectory(t *testing.T) {
|
|
||||||
dir := t.TempDir()
|
|
||||||
if err := os.Mkdir(filepath.Join(dir, "target"), 0o755); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if err := os.Symlink("target", filepath.Join(dir, "link")); err != nil {
|
|
||||||
t.Skipf("cannot create symlinks: %v", err)
|
|
||||||
}
|
|
||||||
entries, err := read_dir(dir, false, "name")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
for _, e := range entries {
|
|
||||||
if e.Name == "link" {
|
|
||||||
if !e.IsDir {
|
|
||||||
t.Fatal("a symlink to a directory must be browsable, not opened as a file")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t.Fatalf("the symlink is missing from the listing: %#v", entries)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestReadDirHandlesNonUTF8Names(t *testing.T) {
|
|
||||||
dir := t.TempDir()
|
|
||||||
name := string([]byte{'b', 'a', 'd', 0xff, '.', 't', 'x', 't'})
|
|
||||||
if err := os.WriteFile(filepath.Join(dir, name), nil, 0o644); err != nil {
|
|
||||||
t.Skipf("the filesystem rejects non-UTF-8 names: %v", err)
|
|
||||||
}
|
|
||||||
entries, err := read_dir(dir, false, "name")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if len(entries) != 1 || entries[0].Name != name {
|
|
||||||
t.Fatalf("the non-UTF-8 name must be listed unchanged, got %#v", entries)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestValidateEntryName(t *testing.T) {
|
func TestValidateEntryName(t *testing.T) {
|
||||||
for _, name := range []string{"", ".", "..", "a/b", "a\x00b"} {
|
for _, name := range []string{"", ".", "..", "a/b", "a\x00b"} {
|
||||||
if err := validate_entry_name(name); err == nil {
|
if err := validate_entry_name(name); err == nil {
|
||||||
@@ -208,22 +148,6 @@ func TestCreateRenameAndDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResolveStartDirExpandsHome(t *testing.T) {
|
|
||||||
home := t.TempDir()
|
|
||||||
projects := filepath.Join(home, "projects")
|
|
||||||
if err := os.Mkdir(projects, 0o755); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
t.Setenv("HOME", home)
|
|
||||||
got, err := resolve_start_dir("~/projects")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if got != projects {
|
|
||||||
t.Fatalf("resolve_start_dir(~/projects) = %q, wanted %q", got, projects)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestResolveStartDirAcceptsFiles(t *testing.T) {
|
func TestResolveStartDirAcceptsFiles(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
file := filepath.Join(dir, "file.txt")
|
file := filepath.Join(dir, "file.txt")
|
||||||
|
|||||||
@@ -424,10 +424,10 @@ handle_fast_commandline(CLISpec *cli_spec, const char *instance_group_prefix) {
|
|||||||
if (get_bool_cli_val(cli_spec, "version")) {
|
if (get_bool_cli_val(cli_spec, "version")) {
|
||||||
if (isatty(STDOUT_FILENO)) {
|
if (isatty(STDOUT_FILENO)) {
|
||||||
printf("\x1b[3mkitty\x1b[23m \x1b[32m%s\x1b[39m created by \x1b[1;34mKovid Goyal\x1b[22;39m\n", KITTY_VERSION);
|
printf("\x1b[3mkitty\x1b[23m \x1b[32m%s\x1b[39m created by \x1b[1;34mKovid Goyal\x1b[22;39m\n", KITTY_VERSION);
|
||||||
printf("\x1b[3mfws-kitty\x1b[23m \x1b[32m0.1.9\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
|
printf("\x1b[3mfws-kitty\x1b[23m \x1b[32m0.1.6\x1b[39m by \x1b[1;34mBlackAngelTV\x1b[22;39m\n");
|
||||||
} else {
|
} else {
|
||||||
printf("kitty %s created by Kovid Goyal\n", KITTY_VERSION);
|
printf("kitty %s created by Kovid Goyal\n", KITTY_VERSION);
|
||||||
printf("fws-kitty 0.1.9 by BlackAngelTV\n");
|
printf("fws-kitty 0.1.6 by BlackAngelTV\n");
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2450,8 +2450,7 @@ lines is wrapped independently.
|
|||||||
|
|
||||||
opt(
|
opt(
|
||||||
'tab_title_template',
|
'tab_title_template',
|
||||||
'"{fmt.fg.red}{bell_symbol}{activity_symbol}{exit_status_symbol}{secure_input_symbol}'
|
'"{fmt.fg.red}{bell_symbol}{activity_symbol}{exit_status_symbol}{secure_input_symbol}{fmt.fg.tab}{tab.last_focused_progress_percent}{tab.active_wd_abbreviated} {title}"',
|
||||||
'{fmt.fg.tab}{tab.last_focused_progress_percent}{tab.active_wd_abbreviated} {title}"',
|
|
||||||
option_type='tab_title_template',
|
option_type='tab_title_template',
|
||||||
long_text="""
|
long_text="""
|
||||||
A template to render the tab title. The default just renders the title with
|
A template to render the tab title. The default just renders the title with
|
||||||
@@ -4157,21 +4156,6 @@ For more sophisticated control, such as using the current selection, use :ac:`re
|
|||||||
|
|
||||||
map('Search the scrollback within a pager', 'search_scrollback --allow-fallback=shifted,ascii cmd+f search_scrollback', only='macos')
|
map('Search the scrollback within a pager', 'search_scrollback --allow-fallback=shifted,ascii cmd+f search_scrollback', only='macos')
|
||||||
|
|
||||||
map(
|
|
||||||
'Search and highlight the scrollback in place',
|
|
||||||
'search_scrollback_prompt kitty_mod+shift+f search_scrollback_prompt',
|
|
||||||
long_text="""
|
|
||||||
Search the scrollback without opening a pager. Every match is highlighted in
|
|
||||||
the scrollback and the ``[current/total]`` counter is shown in the window title.
|
|
||||||
Prefix the query with ``\\c`` to match case sensitively and with ``\\r`` to use
|
|
||||||
a regular expression. While a search is active, :kbd:`n` and :kbd:`N` jump to
|
|
||||||
the next and previous match and :kbd:`Escape` ends the search.
|
|
||||||
|
|
||||||
The :ac:`scrollback_search_next`, :ac:`scrollback_search_prev` and
|
|
||||||
:ac:`clear_scrollback_search` actions can be mapped to other keys.
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
egr() # }}}
|
egr() # }}}
|
||||||
|
|
||||||
|
|||||||
Generated
-2
@@ -936,8 +936,6 @@ defaults.map = [
|
|||||||
KeyDefinition(trigger=SingleKey(mods=256, key=103), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='show_last_command_output'),
|
KeyDefinition(trigger=SingleKey(mods=256, key=103), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='show_last_command_output'),
|
||||||
# search_scrollback
|
# search_scrollback
|
||||||
KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'),
|
KeyDefinition(trigger=SingleKey(mods=256, key=47), definition='search_scrollback'),
|
||||||
# search_scrollback_prompt
|
|
||||||
KeyDefinition(trigger=SingleKey(mods=257, key=102), definition='search_scrollback_prompt'),
|
|
||||||
# new_window
|
# new_window
|
||||||
KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'),
|
KeyDefinition(trigger=SingleKey(mods=256, key=57345), definition='new_window'),
|
||||||
# new_os_window
|
# new_os_window
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# License: GPLv3 Copyright: 2026, Kovid Goyal <kovid at kovidgoyal.net>
|
|
||||||
|
|
||||||
"""In-place scrollback search.
|
|
||||||
|
|
||||||
The query parser and the matcher live here, away from the screen code, so that
|
|
||||||
they can be tested without a running terminal. A query can start with two
|
|
||||||
modifiers, in any order: ``\\c`` makes matching case sensitive and ``\\r``
|
|
||||||
treats the query as a regular expression.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import re
|
|
||||||
from dataclasses import dataclass, field
|
|
||||||
|
|
||||||
CASE_SENSITIVE_MODIFIER = 'c'
|
|
||||||
REGEX_MODIFIER = 'r'
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidQuery(ValueError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Query:
|
|
||||||
text: str
|
|
||||||
case_sensitive: bool = False
|
|
||||||
is_regex: bool = False
|
|
||||||
|
|
||||||
@property
|
|
||||||
def flags(self) -> int:
|
|
||||||
return 0 if self.case_sensitive else re.IGNORECASE
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Match:
|
|
||||||
line: int
|
|
||||||
start: int
|
|
||||||
end: int
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ScrollbackSearch:
|
|
||||||
query: Query
|
|
||||||
pattern: re.Pattern[str]
|
|
||||||
matches: list[Match] = field(default_factory=list)
|
|
||||||
index: int = 0
|
|
||||||
total_lines: int = 0
|
|
||||||
|
|
||||||
def __len__(self) -> int:
|
|
||||||
return len(self.matches)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_query(raw: str) -> Query:
|
|
||||||
text = (raw or '').strip()
|
|
||||||
case_sensitive = is_regex = False
|
|
||||||
while len(text) > 1 and text[0] == '\\':
|
|
||||||
modifier = text[1].lower()
|
|
||||||
if modifier == CASE_SENSITIVE_MODIFIER:
|
|
||||||
case_sensitive = True
|
|
||||||
elif modifier == REGEX_MODIFIER:
|
|
||||||
is_regex = True
|
|
||||||
else:
|
|
||||||
# Not a modifier, the backslash is part of the searched text.
|
|
||||||
break
|
|
||||||
text = text[2:]
|
|
||||||
text = text.strip()
|
|
||||||
if not text:
|
|
||||||
raise InvalidQuery('the search query is empty')
|
|
||||||
return Query(text, case_sensitive, is_regex)
|
|
||||||
|
|
||||||
|
|
||||||
def compile_query(query: Query) -> re.Pattern[str]:
|
|
||||||
source = query.text if query.is_regex else re.escape(query.text)
|
|
||||||
try:
|
|
||||||
return re.compile(source, query.flags)
|
|
||||||
except re.error as err:
|
|
||||||
raise InvalidQuery(f'invalid regular expression: {err}') from err
|
|
||||||
|
|
||||||
|
|
||||||
def find_matches(lines: list[str] | tuple[str, ...], query: Query, pattern: re.Pattern[str] | None = None) -> list[Match]:
|
|
||||||
pat = pattern if pattern is not None else compile_query(query)
|
|
||||||
ans: list[Match] = []
|
|
||||||
append = ans.append
|
|
||||||
for line_number, line in enumerate(lines):
|
|
||||||
for match in pat.finditer(line):
|
|
||||||
# Empty matches cannot be navigated to and would make the count
|
|
||||||
# meaningless, so they are ignored.
|
|
||||||
if match.end() > match.start():
|
|
||||||
append(Match(line_number, match.start(), match.end()))
|
|
||||||
return ans
|
|
||||||
|
|
||||||
|
|
||||||
def scroll_offset_for(match: Match, total_lines: int, visible_lines: int) -> int:
|
|
||||||
"""Number of lines to scroll up so that the match is visible.
|
|
||||||
|
|
||||||
The searched text is the history buffer followed by the visible screen, so
|
|
||||||
line 0 is the oldest line. The match is placed roughly a third of the way
|
|
||||||
down the screen, except near the top and bottom of the scrollback.
|
|
||||||
"""
|
|
||||||
history = max(0, total_lines - visible_lines)
|
|
||||||
margin = max(0, visible_lines // 3)
|
|
||||||
return max(0, min(history, history - match.line + margin))
|
|
||||||
-139
@@ -148,7 +148,6 @@ if TYPE_CHECKING:
|
|||||||
from .fast_data_types import MousePosition
|
from .fast_data_types import MousePosition
|
||||||
from .file_transmission import FileTransmission
|
from .file_transmission import FileTransmission
|
||||||
from .notifications import OnlyWhen
|
from .notifications import OnlyWhen
|
||||||
from .scrollback_search import ScrollbackSearch
|
|
||||||
|
|
||||||
|
|
||||||
class CwdRequestType(Enum):
|
class CwdRequestType(Enum):
|
||||||
@@ -826,11 +825,6 @@ class Window:
|
|||||||
self.actions_on_focus_change: list[Callable[['Window', bool], None]] = []
|
self.actions_on_focus_change: list[Callable[['Window', bool], None]] = []
|
||||||
self.actions_on_removal: list[Callable[['Window'], None]] = []
|
self.actions_on_removal: list[Callable[['Window'], None]] = []
|
||||||
self.current_marker_spec: tuple[str, str | tuple[tuple[int, str], ...]] | None = None
|
self.current_marker_spec: tuple[str, str | tuple[tuple[int, str], ...]] | None = None
|
||||||
self.scrollback_search: ScrollbackSearch | None = None
|
|
||||||
self.scrollback_search_mode: str = ''
|
|
||||||
self.scrollback_search_saved_marker: tuple[str, str | tuple[tuple[int, str], ...]] | None = None
|
|
||||||
self.scrollback_search_saved_title: str | None = None
|
|
||||||
self.actions_on_focus_change.append(self._on_focus_change_clear_scrollback_search)
|
|
||||||
self.kitten_result_processors: list[Callable[['Window', Any], None]] = []
|
self.kitten_result_processors: list[Callable[['Window', Any], None]] = []
|
||||||
self.child_is_launched = False
|
self.child_is_launched = False
|
||||||
self.restored_scrollback = b''
|
self.restored_scrollback = b''
|
||||||
@@ -2672,139 +2666,6 @@ class Window:
|
|||||||
w.screen.paste_bytes(sanitized)
|
w.screen.paste_bytes(sanitized)
|
||||||
w.send_key('enter')
|
w.send_key('enter')
|
||||||
|
|
||||||
@ac(
|
|
||||||
'sc',
|
|
||||||
"""
|
|
||||||
Search the scrollback in place, highlighting every match. Prefix the query with \\c for a case
|
|
||||||
sensitive search and with \\r for a regular expression. Matches are navigated with n and N and
|
|
||||||
the search ends with Escape. The [current/total] counter is shown in the window title.
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
def search_scrollback_prompt(self) -> bool | None:
|
|
||||||
if not self.screen.is_main_linebuf():
|
|
||||||
return True
|
|
||||||
|
|
||||||
def done(text: str) -> None:
|
|
||||||
if text:
|
|
||||||
self.start_scrollback_search(text)
|
|
||||||
else:
|
|
||||||
self.clear_scrollback_search()
|
|
||||||
|
|
||||||
get_boss().get_line(
|
|
||||||
_('Search the scrollback. Prefix the query with \\c for a case sensitive search and \\r for a regular expression.'),
|
|
||||||
done,
|
|
||||||
window=self,
|
|
||||||
prompt=_('search> '),
|
|
||||||
window_title=_('Search scrollback'),
|
|
||||||
)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def scrollback_search_lines(self) -> list[str]:
|
|
||||||
# Read the history buffer and the visible screen directly instead of using
|
|
||||||
# as_text(), so that line numbers are the ones scrolling actions use.
|
|
||||||
lines: list[str] = []
|
|
||||||
self.screen.as_text_for_history_buf(lines.append, False, True)
|
|
||||||
self.screen.as_text(lines.append, False, True)
|
|
||||||
return [line.replace('\r', '').replace('\n', '') for line in lines]
|
|
||||||
|
|
||||||
def start_scrollback_search(self, raw_query: str) -> None:
|
|
||||||
from .scrollback_search import InvalidQuery, ScrollbackSearch, compile_query, find_matches, parse_query
|
|
||||||
|
|
||||||
try:
|
|
||||||
query = parse_query(raw_query)
|
|
||||||
pattern = compile_query(query)
|
|
||||||
except InvalidQuery as err:
|
|
||||||
get_boss().show_error(_('Invalid search query'), str(err))
|
|
||||||
return
|
|
||||||
lines = self.scrollback_search_lines()
|
|
||||||
matches = find_matches(lines, query, pattern)
|
|
||||||
if not matches:
|
|
||||||
from .fast_data_types import ring_bell
|
|
||||||
|
|
||||||
ring_bell(self.os_window_id)
|
|
||||||
return
|
|
||||||
self.clear_scrollback_search()
|
|
||||||
from .marks import marker_from_regex
|
|
||||||
|
|
||||||
self.scrollback_search = ScrollbackSearch(query, pattern, matches, total_lines=len(lines))
|
|
||||||
self.scrollback_search_saved_marker = self.current_marker_spec
|
|
||||||
self.scrollback_search_saved_title = self.override_title
|
|
||||||
self.screen.set_marker(marker_from_regex(pattern, 1))
|
|
||||||
self._push_scrollback_search_mode()
|
|
||||||
self._goto_scrollback_match(0)
|
|
||||||
|
|
||||||
@ac('sc', 'Stop the in-place scrollback search and remove its highlights')
|
|
||||||
def clear_scrollback_search(self) -> None:
|
|
||||||
if self.scrollback_search is None:
|
|
||||||
return
|
|
||||||
self.scrollback_search = None
|
|
||||||
self.screen.set_marker()
|
|
||||||
self.current_marker_spec = None
|
|
||||||
saved = self.scrollback_search_saved_marker
|
|
||||||
self.scrollback_search_saved_marker = None
|
|
||||||
if saved is not None:
|
|
||||||
# Restore the marker that was displayed before the search started.
|
|
||||||
from .marks import marker_from_spec
|
|
||||||
|
|
||||||
ftype, spec = saved
|
|
||||||
self.screen.set_marker(marker_from_spec(ftype, spec, 0))
|
|
||||||
self.current_marker_spec = saved
|
|
||||||
self.set_title(self.scrollback_search_saved_title)
|
|
||||||
self.scrollback_search_saved_title = None
|
|
||||||
if self.scrollback_search_mode:
|
|
||||||
get_boss().mappings.pop_keyboard_mode_if_is(self.scrollback_search_mode)
|
|
||||||
self.scrollback_search_mode = ''
|
|
||||||
|
|
||||||
@ac('sc', 'Jump to the next match of the in-place scrollback search')
|
|
||||||
def scrollback_search_next(self) -> bool | None:
|
|
||||||
return self._scrollback_search_step(1)
|
|
||||||
|
|
||||||
@ac('sc', 'Jump to the previous match of the in-place scrollback search')
|
|
||||||
def scrollback_search_prev(self) -> bool | None:
|
|
||||||
return self._scrollback_search_step(-1)
|
|
||||||
|
|
||||||
def _scrollback_search_step(self, step: int) -> bool | None:
|
|
||||||
search = self.scrollback_search
|
|
||||||
if search is None:
|
|
||||||
return None
|
|
||||||
if not self.screen.is_main_linebuf():
|
|
||||||
return True
|
|
||||||
self._goto_scrollback_match(search.index + step)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def _goto_scrollback_match(self, index: int) -> None:
|
|
||||||
from .scrollback_search import scroll_offset_for
|
|
||||||
|
|
||||||
search = self.scrollback_search
|
|
||||||
if search is None or not search.matches:
|
|
||||||
return
|
|
||||||
search.index = index % len(search.matches)
|
|
||||||
match = search.matches[search.index]
|
|
||||||
self.set_title(f'[{search.index + 1}/{len(search.matches)}] {search.query.text}')
|
|
||||||
self.screen.scroll_to_absolute(scroll_offset_for(match, search.total_lines, self.screen.lines))
|
|
||||||
|
|
||||||
def _push_scrollback_search_mode(self) -> None:
|
|
||||||
from .fast_data_types import GLFW_FKEY_ESCAPE, GLFW_MOD_SHIFT
|
|
||||||
from .options.utils import KeyboardMode, KeyDefinition, SingleKey
|
|
||||||
|
|
||||||
km = KeyboardMode('__scrollback_search__')
|
|
||||||
km.on_unknown = 'passthrough'
|
|
||||||
km.on_action = 'keep'
|
|
||||||
next_match = KeyDefinition(definition='scrollback_search_next')
|
|
||||||
prev_match = KeyDefinition(definition='scrollback_search_prev')
|
|
||||||
km.keymap[SingleKey(key=ord('n'))].append(next_match)
|
|
||||||
km.keymap[SingleKey(mods=GLFW_MOD_SHIFT, key=ord('n'))].append(prev_match)
|
|
||||||
km.keymap[SingleKey(mods=GLFW_MOD_SHIFT, key=ord('N'))].append(prev_match)
|
|
||||||
km.keymap[SingleKey(key=GLFW_FKEY_ESCAPE)].append(KeyDefinition(definition='clear_scrollback_search'))
|
|
||||||
self.scrollback_search_mode = km.name
|
|
||||||
get_boss().mappings._push_keyboard_mode(km)
|
|
||||||
|
|
||||||
def _on_focus_change_clear_scrollback_search(self, window: 'Window', focused: bool) -> None:
|
|
||||||
# The n/N bindings live in a temporary keyboard mode, so the search must
|
|
||||||
# end when this window stops being the one receiving keys.
|
|
||||||
if not focused and self.scrollback_search is not None:
|
|
||||||
self.clear_scrollback_search()
|
|
||||||
|
|
||||||
def show_cmd_output(self, which: CommandOutput, title: str = 'Command output', as_ansi: bool = True, add_wrap_markers: bool = True) -> None:
|
def show_cmd_output(self, which: CommandOutput, title: str = 'Command output', as_ansi: bool = True, add_wrap_markers: bool = True) -> None:
|
||||||
text = self.cmd_output(which, as_ansi=as_ansi, add_wrap_markers=add_wrap_markers)
|
text = self.cmd_output(which, as_ansi=as_ansi, add_wrap_markers=add_wrap_markers)
|
||||||
text = text.replace('\r\n', '\n').replace('\r', '\n')
|
text = text.replace('\r\n', '\n').replace('\r', '\n')
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# License: GPLv3 Copyright: 2026, FWS
|
|
||||||
|
|
||||||
from unittest.mock import MagicMock, patch
|
|
||||||
|
|
||||||
from kittens.file_manager.main import change_directory, handle_result
|
|
||||||
|
|
||||||
from .base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileManager(BaseTest):
|
|
||||||
def test_file_manager(self):
|
|
||||||
"""The documented defaults are the ones the panel starts with."""
|
|
||||||
from kittens.file_manager.main import definition
|
|
||||||
|
|
||||||
options = {o.name: o for o in definition.iter_all_options()}
|
|
||||||
for name, expected in (
|
|
||||||
('show_hidden', 'no'),
|
|
||||||
('sort_by', 'name'),
|
|
||||||
('sync_cwd', 'yes'),
|
|
||||||
):
|
|
||||||
self.assertIn(name, options, f'{name} must be a documented option')
|
|
||||||
self.ae(options[name].defval_as_string, expected, name)
|
|
||||||
self.assertTrue(options[name].long_text, f'{name} must have help text')
|
|
||||||
|
|
||||||
def test_change_directory_at_the_prompt(self):
|
|
||||||
w = MagicMock()
|
|
||||||
w.at_prompt = True
|
|
||||||
change_directory(w, '/tmp/a b')
|
|
||||||
|
|
||||||
w.write_to_child.assert_called_once_with("cd '/tmp/a b'\r")
|
|
||||||
w.paste_text.assert_not_called()
|
|
||||||
|
|
||||||
def test_change_directory_while_a_program_runs(self):
|
|
||||||
# While a program owns the terminal the command is only pasted, so that
|
|
||||||
# it can be reviewed instead of being fed to the program's stdin.
|
|
||||||
w = MagicMock()
|
|
||||||
w.at_prompt = False
|
|
||||||
change_directory(w, "/tmp/it's")
|
|
||||||
|
|
||||||
w.paste_text.assert_called_once_with("cd '/tmp/it'\"'\"'s'")
|
|
||||||
w.write_to_child.assert_not_called()
|
|
||||||
|
|
||||||
def test_result_changes_the_target_window_directory(self):
|
|
||||||
boss = MagicMock()
|
|
||||||
window = MagicMock()
|
|
||||||
boss.window_id_map.get.return_value = window
|
|
||||||
with patch('kittens.file_manager.main.change_directory') as cd:
|
|
||||||
handle_result([], {'action': 'cd', 'path': '/tmp/project'}, 42, boss)
|
|
||||||
|
|
||||||
cd.assert_called_once_with(window, '/tmp/project')
|
|
||||||
boss.ring_bell_if_allowed.assert_not_called()
|
|
||||||
|
|
||||||
def test_result_with_sync_does_not_type_into_the_shell(self):
|
|
||||||
# With sync_cwd on, the panel wrote the directory in the session file
|
|
||||||
# and the shell hook applies it; typing a second cd would move twice.
|
|
||||||
boss = MagicMock()
|
|
||||||
with patch('kittens.file_manager.main.change_directory') as cd:
|
|
||||||
handle_result([], {'action': 'cd', 'path': '/tmp/project', 'sync': True}, 42, boss)
|
|
||||||
|
|
||||||
cd.assert_not_called()
|
|
||||||
boss.window_id_map.get.assert_not_called()
|
|
||||||
|
|
||||||
def test_result_without_the_target_window_rings_the_bell(self):
|
|
||||||
boss = MagicMock()
|
|
||||||
boss.window_id_map.get.return_value = None
|
|
||||||
handle_result([], {'action': 'cd', 'path': '/tmp/project'}, 42, boss)
|
|
||||||
|
|
||||||
boss.ring_bell_if_allowed.assert_called_once()
|
|
||||||
|
|
||||||
def test_result_ignores_incomplete_payloads(self):
|
|
||||||
boss = MagicMock()
|
|
||||||
with patch('kittens.file_manager.main.change_directory') as cd:
|
|
||||||
handle_result([], {}, 42, boss)
|
|
||||||
handle_result([], {'action': 'open', 'path': '/tmp'}, 42, boss)
|
|
||||||
handle_result([], {'action': 'cd'}, 42, boss)
|
|
||||||
|
|
||||||
cd.assert_not_called()
|
|
||||||
boss.ring_bell_if_allowed.assert_not_called()
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# License: GPLv3 Copyright: 2026, Kovid Goyal <kovid at kovidgoyal.net>
|
|
||||||
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
|
|
||||||
from kitty.scrollback_search import (
|
|
||||||
InvalidQuery,
|
|
||||||
Match,
|
|
||||||
compile_query,
|
|
||||||
find_matches,
|
|
||||||
parse_query,
|
|
||||||
scroll_offset_for,
|
|
||||||
)
|
|
||||||
|
|
||||||
from .base import BaseTest
|
|
||||||
|
|
||||||
|
|
||||||
class TestScrollbackSearch(BaseTest):
|
|
||||||
def test_parse_query(self):
|
|
||||||
q = parse_query('needle')
|
|
||||||
self.ae((q.text, q.case_sensitive, q.is_regex), ('needle', False, False))
|
|
||||||
self.assertTrue(compile_query(q).flags & re.IGNORECASE)
|
|
||||||
|
|
||||||
q = parse_query(' padded ')
|
|
||||||
self.ae(q.text, 'padded')
|
|
||||||
|
|
||||||
def test_parse_query_modifiers(self):
|
|
||||||
q = parse_query('\\c Needle')
|
|
||||||
self.ae((q.text, q.case_sensitive, q.is_regex), ('Needle', True, False))
|
|
||||||
self.ae(compile_query(q).flags & re.IGNORECASE, 0)
|
|
||||||
|
|
||||||
q = parse_query('\\r a.c')
|
|
||||||
self.ae((q.text, q.case_sensitive, q.is_regex), ('a.c', False, True))
|
|
||||||
|
|
||||||
for raw in ('\\r\\c a+b', '\\c\\r a+b', '\\C\\R a+b'):
|
|
||||||
q = parse_query(raw)
|
|
||||||
self.ae((q.text, q.case_sensitive, q.is_regex), ('a+b', True, True), raw)
|
|
||||||
|
|
||||||
with self.assertRaises(InvalidQuery):
|
|
||||||
parse_query('')
|
|
||||||
with self.assertRaises(InvalidQuery):
|
|
||||||
parse_query(' ')
|
|
||||||
with self.assertRaises(InvalidQuery):
|
|
||||||
parse_query('\\c')
|
|
||||||
with self.assertRaises(InvalidQuery):
|
|
||||||
compile_query(parse_query('\\r ('))
|
|
||||||
|
|
||||||
def test_find_matches_plain(self):
|
|
||||||
lines = ['needle at start', 'Needle again', 'nothing', 'a needle here']
|
|
||||||
matches = find_matches(lines, parse_query('needle'))
|
|
||||||
self.ae([(m.line, m.start, m.end) for m in matches], [(0, 0, 6), (1, 0, 6), (3, 2, 8)])
|
|
||||||
|
|
||||||
matches = find_matches(lines, parse_query('\\c Needle'))
|
|
||||||
self.ae([(m.line, m.start, m.end) for m in matches], [(1, 0, 6)])
|
|
||||||
|
|
||||||
# Regex metacharacters are literal in a plain query
|
|
||||||
self.ae(find_matches(['a+b', 'aab'], parse_query('a+b')), [Match(0, 0, 3)])
|
|
||||||
|
|
||||||
def test_find_matches_regex(self):
|
|
||||||
matches = find_matches(['abc abc', 'nothing here'], parse_query('\\r a.c'))
|
|
||||||
self.ae([(m.line, m.start, m.end) for m in matches], [(0, 0, 3), (0, 4, 7)])
|
|
||||||
|
|
||||||
# Empty matches are skipped and do not loop forever
|
|
||||||
self.ae(find_matches(['abc'], parse_query('\\r x*')), [])
|
|
||||||
|
|
||||||
def test_scroll_offset(self):
|
|
||||||
self.ae(scroll_offset_for(Match(0, 0, 1), 100, 10), 90)
|
|
||||||
self.ae(scroll_offset_for(Match(50, 0, 1), 100, 10), 43)
|
|
||||||
self.ae(scroll_offset_for(Match(99, 0, 1), 100, 10), 0)
|
|
||||||
# No scrollback: the visible screen is always shown as is
|
|
||||||
self.ae(scroll_offset_for(Match(3, 0, 1), 5, 5), 0)
|
|
||||||
|
|
||||||
def test_performance_on_large_scrollback(self):
|
|
||||||
lines = [f'line {i} with some ordinary text' for i in range(10_000)]
|
|
||||||
for i in range(0, 10_000, 10):
|
|
||||||
lines[i] = 'needle ' + lines[i]
|
|
||||||
query = parse_query('needle')
|
|
||||||
start = time.monotonic()
|
|
||||||
matches = find_matches(lines, query)
|
|
||||||
elapsed = time.monotonic() - start
|
|
||||||
self.ae(len(matches), 1000)
|
|
||||||
self.assertLess(elapsed, 0.05, f'searching 10 000 lines took {elapsed * 1000:.1f} ms')
|
|
||||||
+3
-18
@@ -11,26 +11,16 @@
|
|||||||
# upstream package, hence provides/conflicts.
|
# upstream package, hence provides/conflicts.
|
||||||
|
|
||||||
pkgname=fws-kitty
|
pkgname=fws-kitty
|
||||||
# Fork version from the version file: it names the release and the package.
|
pkgver=0.50.0
|
||||||
# The upstream kitty release built inside is tracked by _kittyver below.
|
pkgrel=2
|
||||||
pkgver=0.1.9
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)'
|
pkgdesc='Fast, feature-rich, GPU based terminal (FWS fork with the file-manager kitten)'
|
||||||
arch=('x86_64' 'aarch64')
|
arch=('x86_64' 'aarch64')
|
||||||
url='https://gitea.nocode-var.tech/FWS/FWS-Kitty'
|
url='https://gitea.nocode-var.tech/FWS/FWS-Kitty'
|
||||||
license=('GPL-3.0-only')
|
license=('GPL-3.0-only')
|
||||||
|
|
||||||
# Upstream kitty release shipped by this package. It is independent from pkgver
|
|
||||||
# and must match kitty/constants.py (checked by check-version.sh).
|
|
||||||
_kittyver=0.50.0
|
|
||||||
|
|
||||||
# Replace main with the tag or commit to ship once the release is cut.
|
# Replace main with the tag or commit to ship once the release is cut.
|
||||||
_branch=main
|
_branch=main
|
||||||
_repo='https://gitea.nocode-var.tech/FWS/FWS-Kitty.git'
|
_repo='https://gitea.nocode-var.tech/FWS/FWS-Kitty.git'
|
||||||
# The CI sets FWS_SOURCE_REF=commit=<sha> so the package is built from the exact
|
|
||||||
# commit being released instead of whatever main points at by the time makepkg
|
|
||||||
# clones. A local build keeps following _branch.
|
|
||||||
_source_ref=${FWS_SOURCE_REF:-branch=$_branch}
|
|
||||||
|
|
||||||
depends=(
|
depends=(
|
||||||
python harfbuzz zlib libpng lcms2 xxhash openssl
|
python harfbuzz zlib libpng lcms2 xxhash openssl
|
||||||
@@ -52,13 +42,8 @@ optdepends=(
|
|||||||
provides=('kitty')
|
provides=('kitty')
|
||||||
conflicts=('kitty')
|
conflicts=('kitty')
|
||||||
|
|
||||||
# The release publishes only the main package, so the separate debug package is
|
|
||||||
# built and thrown away. Skipping it also avoids makepkg running gdb-add-index
|
|
||||||
# over binaries that were already stripped, which only prints errors.
|
|
||||||
options=('!debug')
|
|
||||||
|
|
||||||
source=(
|
source=(
|
||||||
"$pkgname::git+$_repo#$_source_ref"
|
"$pkgname::git+$_repo#branch=$_branch"
|
||||||
"nerdfonts-symbols.tar.xz::https://github.com/ryanoasis/nerd-fonts/releases/download/v3.5.1/NerdFontsSymbolsOnly.tar.xz"
|
"nerdfonts-symbols.tar.xz::https://github.com/ryanoasis/nerd-fonts/releases/download/v3.5.1/NerdFontsSymbolsOnly.tar.xz"
|
||||||
)
|
)
|
||||||
sha256sums=('SKIP' '01172f37db8543edb102e5cb5c64101c9f4686630804d49b419aa07b23a69996')
|
sha256sums=('SKIP' '01172f37db8543edb102e5cb5c64101c9f4686630804d49b419aa07b23a69996')
|
||||||
|
|||||||
+1
-57
@@ -68,63 +68,7 @@ fonctionne pour héberger les fichiers, mais pacman a besoin d'URL stables pour
|
|||||||
`fws-kitty.db.tar.gz` et les `.pkg.tar.zst`, ce qu'un simple dossier servi par
|
`fws-kitty.db.tar.gz` et les `.pkg.tar.zst`, ce qu'un simple dossier servi par
|
||||||
nginx (ou des assets de release) fournit directement.
|
nginx (ou des assets de release) fournit directement.
|
||||||
|
|
||||||
## Publication automatique
|
Pour une publication automatique, il suffit d'enchaîner dans la CI :
|
||||||
|
|
||||||
Le fichier `version`, à la racine du dépôt, déclenche tout : un push sur `main`
|
|
||||||
qui le modifie lance `.gitea/workflows/package.yml` : lint, puis construction du
|
|
||||||
paquet avec ce `PKGBUILD` depuis le commit exact — c'est le seul build, les
|
|
||||||
`go vet`, tests et smoke test tournent sur cet arbre — avant de créer la
|
|
||||||
release Gitea `v<version>` (paquet + empreinte SHA-256 en pièces jointes) et
|
|
||||||
d'envoyer le paquet à `repo.laxacube.ch`.
|
|
||||||
|
|
||||||
Le workflow a besoin de deux secrets du dépôt :
|
|
||||||
|
|
||||||
| Secret | Usage |
|
|
||||||
| --- | --- |
|
|
||||||
| `RELEASE_TOKEN` | créer la release et y attacher les fichiers |
|
|
||||||
| `REPO_TOKEN` | `POST https://repo.laxacube.ch/api/packages` |
|
|
||||||
|
|
||||||
Sans `REPO_TOKEN`, la release est créée mais le dépôt pacman n'est pas mis à
|
|
||||||
jour (le workflow émet un avertissement). Pour reconstruire la même version du
|
|
||||||
fork, incrémentez `pkgrel` ici et lancez le workflow manuellement ; le paquet
|
|
||||||
`0.1.8-2` remplace le `0.1.8-1` dans la base `fws.db` reconstruite côté
|
|
||||||
serveur. Le `PKGBUILD` lit `FWS_SOURCE_REF` (`commit=<sha>` depuis la CI) pour
|
|
||||||
construire le commit publié plutôt que la tête de `main`.
|
|
||||||
|
|
||||||
Une version publiée n'est jamais réécrite : deux builds du même commit ne sont
|
|
||||||
pas identiques à l'octet près, et le CDN comme le cache pacman gardent le fichier
|
|
||||||
sous son nom, donc republier `0.1.8-1` avec un autre contenu donne des caches qui
|
|
||||||
désaccordent avec la base et pacman rejette le téléchargement (`paquet non valide
|
|
||||||
ou corrompu`). Le workflow s'arrête donc sans republier quand le dépôt sert déjà
|
|
||||||
ce nom de paquet (relancer une release est sans effet), et demande d'incrémenter
|
|
||||||
`pkgrel` pour publier un build différent.
|
|
||||||
Après l'envoi, il relit aussi le paquet servi et compare son `sha256` à celui du
|
|
||||||
build, pour ne pas annoncer une publication que les clients ne peuvent pas
|
|
||||||
installer. Le fichier met quelques secondes à être routé après l'upload : il est
|
|
||||||
retenté pendant deux minutes, et une empreinte différente échoue immédiatement.
|
|
||||||
|
|
||||||
`pkgver` est la version du fork FWS (fichier `version` à la racine), pas celle
|
|
||||||
de kitty : la version amont embarquée est dans `_kittyver`.
|
|
||||||
`packaging/check-version.sh` vérifie avant le build que `version` et `pkgver`
|
|
||||||
concordent avec la version compilée dans `tools/cli/help.go` et
|
|
||||||
`kitty/launcher/main.c`, et que `_kittyver` correspond à `kitty/constants.py`.
|
|
||||||
|
|
||||||
### Runner
|
|
||||||
|
|
||||||
Les jobs tournent sur un runner Arch auto-hébergé (label `arch-host`).
|
|
||||||
`packaging/install-ci-deps.sh` installe ce qui manque, mais `pacman` a besoin
|
|
||||||
de root : soit le runner a un sudo sans mot de passe pour `pacman`, soit les
|
|
||||||
paquets sont préinstallés une fois sur la machine :
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo pacman -S --needed go rsync ruff shader-slang libcanberra simde \
|
|
||||||
wayland-protocols wayland-utils kitty-shell-integration kitty-terminfo
|
|
||||||
```
|
|
||||||
|
|
||||||
Une fois installés, le script est un no-op et les jobs n'utilisent plus de
|
|
||||||
privilège.
|
|
||||||
|
|
||||||
Pour publier à la main :
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
makepkg -f --nodeps # ou -s avec un utilisateur autorisé à pacman
|
makepkg -f --nodeps # ou -s avec un utilisateur autorisé à pacman
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# The version file is the single source of truth for a release: it triggers the
|
|
||||||
# packaging workflow and names the tag, the Gitea release and the Arch package.
|
|
||||||
# It tracks the FWS fork version, which is independent from the upstream kitty
|
|
||||||
# release shipped inside the package. Both numbers are duplicated where the
|
|
||||||
# build reads them, so this script checks they still agree and prints the
|
|
||||||
# release version for the workflows to reuse:
|
|
||||||
#
|
|
||||||
# version="$(packaging/check-version.sh)"
|
|
||||||
#
|
|
||||||
# It runs on the CI runner and locally, before any build.
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
|
|
||||||
|
|
||||||
fail() {
|
|
||||||
echo "::error file=$1::$2"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
version=$(tr -d '[:space:]' < "$root/version")
|
|
||||||
|
|
||||||
case "$version" in
|
|
||||||
''|*[!0-9.]*|.*|*..*|*.)
|
|
||||||
fail version "expected MAJOR.MINOR.PATCH, got '$version'"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [ "$(printf '%s' "$version" | awk -F. '{print NF}')" -ne 3 ]; then
|
|
||||||
fail version "expected MAJOR.MINOR.PATCH, got '$version'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# makepkg names the package from pkgver, so an out-of-date PKGBUILD would
|
|
||||||
# publish a package whose name does not match its release.
|
|
||||||
pkgver=$(sed -n 's/^pkgver=//p' "$root/packaging/PKGBUILD" | head -n 1)
|
|
||||||
if [ "$pkgver" != "$version" ]; then
|
|
||||||
fail packaging/PKGBUILD "pkgver is '$pkgver' but the version file says '$version'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The upstream kitty release follows kitty, not the fork: it lives in its own
|
|
||||||
# variable and must keep matching the constant kitty compiles into the binaries.
|
|
||||||
kitty_version=$(sed -n 's/^_kittyver=//p' "$root/packaging/PKGBUILD" | head -n 1)
|
|
||||||
constants=$(sed -n 's/^version: Version = Version(\([0-9]*\), \([0-9]*\), \([0-9]*\)).*/\1.\2.\3/p' "$root/kitty/constants.py" | head -n 1)
|
|
||||||
if [ "$constants" != "$kitty_version" ]; then
|
|
||||||
fail kitty/constants.py "kitty reports '$constants' but _kittyver in the PKGBUILD says '$kitty_version'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The fork version is hard-coded in both front-ends, so bumping only the version
|
|
||||||
# file would ship binaries announcing the previous release.
|
|
||||||
for f in tools/cli/help.go kitty/launcher/main.c; do
|
|
||||||
if ! grep -qF "$version" "$root/$f"; then
|
|
||||||
fail "$f" "the fork version '$version' is not set in this file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
printf '%s\n' "$version"
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Install on the Arch CI runner everything the linter, ./dev.sh build and
|
|
||||||
# makepkg need. Idempotent: nothing is handed to pacman when it is already
|
|
||||||
# installed, and sudo is only used when something is actually missing.
|
|
||||||
#
|
|
||||||
# The runner user needs passwordless sudo for pacman the first time; once the
|
|
||||||
# packages are there, the script is a no-op and no privilege is required.
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
packages="git go python pkgconf ncurses rsync which file jq curl nodejs ruff \
|
|
||||||
harfbuzz zlib libpng lcms2 xxhash openssl shader-slang pixman cairo freetype2 \
|
|
||||||
fontconfig libcanberra systemd-libs simde libx11 libxcb libxrandr libxinerama \
|
|
||||||
libxcursor libxi libxrender xorgproto libxkbcommon libxkbcommon-x11 mesa dbus \
|
|
||||||
wayland wayland-protocols wayland-utils tar xz kitty-shell-integration \
|
|
||||||
kitty-terminfo"
|
|
||||||
|
|
||||||
missing=""
|
|
||||||
for package in $packages; do
|
|
||||||
if ! pacman -Q "$package" > /dev/null 2>&1; then
|
|
||||||
missing="$missing $package"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# base-devel is a group, so verbose queries do not report it as a package.
|
|
||||||
for tool in gcc make fakeroot; do
|
|
||||||
if ! command -v "$tool" > /dev/null 2>&1; then
|
|
||||||
missing="$missing base-devel"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$missing" ]; then
|
|
||||||
echo 'All the build dependencies are already installed.'
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Installing:$missing"
|
|
||||||
# pacman refuses to run without a terminal prompt for the password when the
|
|
||||||
# runner user has no NOPASSWD rule; fail with the list instead of hanging.
|
|
||||||
if ! sudo -n pacman -S --needed --noconfirm $missing; then
|
|
||||||
echo "::error::could not install:$missing"
|
|
||||||
echo '::error::give the runner user passwordless sudo for pacman or preinstall these packages.'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
+1
-1
@@ -31,7 +31,7 @@ func ShowError(err error) {
|
|||||||
|
|
||||||
func (self *Command) version_string(formatter *markup.Context) string {
|
func (self *Command) version_string(formatter *markup.Context) string {
|
||||||
return fmt.Sprintln(formatter.Italic(self.CommandStringForUsage()), formatter.Opt(kitty.VersionString+kitty.VersionSuffix), "created by", formatter.Title("Kovid Goyal")) +
|
return fmt.Sprintln(formatter.Italic(self.CommandStringForUsage()), formatter.Opt(kitty.VersionString+kitty.VersionSuffix), "created by", formatter.Title("Kovid Goyal")) +
|
||||||
fmt.Sprintln(formatter.Italic("fws-kitty"), formatter.Opt("0.1.9"), "by", formatter.Title("BlackAngelTV"))
|
fmt.Sprintln(formatter.Italic("fws-kitty"), formatter.Opt("0.1.6"), "by", formatter.Title("BlackAngelTV"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Command) ShowVersion() {
|
func (self *Command) ShowVersion() {
|
||||||
|
|||||||
Reference in new issue
Block a user