Skip to content

Commit a49eca4

Browse files
committed
chore: hk
1 parent 746f95f commit a49eca4

14 files changed

Lines changed: 82 additions & 39 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ pnpm-lock.yaml
3131
yarn.lock
3232
.venv
3333
__pycache__
34+
.ruff_cache

.zed/settings.json

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"JSONC": ["**/.zed/**/*.json"]
66
},
77
"hidden_files": ["**/.ruff_cache", "**/__pycache__/**"],
8-
"file_scan_exclusions": [".git", "**/.vscode"],
8+
"file_scan_exclusions": [".git", "**/.vscode", "**/.ruff_cache"],
99
"use_autoclose": true,
1010
"enable_language_server": true,
1111
"formatter": "language_server",
@@ -17,17 +17,41 @@
1717
"pkl",
1818
"!eslint",
1919
"!biome",
20+
"!typescript-language-server",
2021
"tombi",
2122
"oxfmt",
2223
"oxlint",
2324
"ruff",
2425
"pyrefly",
25-
"markdown-oxide",
26-
"json-language-server",
2726
"typescript-ls",
28-
"!typescript-language-server"
27+
"markdown-oxide",
28+
"json-language-server"
2929
],
3030
"lsp": {
31+
"ruff": {
32+
"fetch": { "pre_release": true },
33+
"binary": {
34+
"path": "./.venv/bin/ruff",
35+
"arguments": ["server"]
36+
},
37+
"initialization_options": {
38+
"settings": {
39+
"configuration": "./pyproject.toml",
40+
"lint": {
41+
"extendSelect": ["I"]
42+
}
43+
}
44+
}
45+
},
46+
"pyrefly": {
47+
"fetch": {
48+
"pre_release": true
49+
},
50+
"binary": {
51+
"path": "./.venv/bin/pyrefly",
52+
"arguments": ["lsp"]
53+
}
54+
},
3155
"pkl": {
3256
"fetch": {
3357
"pre_release": true
@@ -68,6 +92,19 @@
6892
}
6993
},
7094
"languages": {
95+
"Python": {
96+
"code_actions_on_format": {
97+
"source.fixAll.ruff": true,
98+
"source.organizeImports.ruff": true
99+
},
100+
"format_on_save": "on",
101+
"language_servers": ["ruff", "pyrefly", "!pyright", "!pylsp"],
102+
"formatter": {
103+
"language_server": {
104+
"name": "ruff"
105+
}
106+
}
107+
},
71108
"Shell Script": {
72109
"format_on_save": "on",
73110
"formatter": {

hk.pkl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
amends "package://github.com/jdx/hk/releases/download/v1.51.0/hk@1.51.0#/Config.pkl"
1+
amends "package://github.com/jdx/hk/releases/download/v1.53.0/hk@1.53.0#/Config.pkl"
22

3-
import "package://github.com/jdx/hk/releases/download/v1.51.0/hk@1.51.0#/Builtins.pkl"
3+
import "package://github.com/jdx/hk/releases/download/v1.53.0/hk@1.53.0#/Builtins.pkl"
44

55
// https://hk.jdx.dev/configuration.html
66

@@ -34,9 +34,7 @@ local linters = new Mapping<String, Step> {
3434
".github/workflows/*.yaml",
3535
)
3636
}
37-
["betterleaks"] = (Builtins.betterleaks) {
38-
exclude = List("users/o/thaw/thaw.json")
39-
}
37+
["betterleaks"] = Builtins.betterleaks
4038
["gitleaks"] = (Builtins.gitleaks) {
4139
check =
4240
#"""
@@ -99,12 +97,12 @@ hooks {
9997
stash = "git"
10098
steps = allSteps
10199
}
102-
// formatters only — `just fmt` / `hk fix --all`
100+
// formatters only — `hk fix --all`
103101
["fix"] {
104102
fix = true
105103
steps = formatters
106104
}
107-
// linters only — `just lint` / `hk check --all`
105+
// linters only — `hk check --all`
108106
["check"] {
109107
steps = linters
110108
}

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ description = "Add your description here"
55
requires-python = ">=3.14"
66

77
[dependency-groups]
8-
dev = ["pyrefly>=1.1.1", "ruff>=0.15.22"]
8+
dev = [
9+
"pyrefly>=1.1.1",
10+
"ruff>=0.16.0",
11+
]
912

1013
[tool.pyrefly]
1114
search_path = [".", "skills/multilingual-caption-video/scripts"]

skills/multilingual-caption-video/scripts/check_requirements.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
24

35
uv_available=false
46
ffmpeg_available=false

skills/multilingual-caption-video/scripts/cleanup.py

100644100755
File mode changed.

skills/multilingual-caption-video/scripts/deliver.py

100644100755
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
# ///
77

88
import argparse
9+
import datetime
910
import os
1011
import re
1112
import shutil
1213
import sys
1314
import unicodedata
14-
from datetime import date
1515
from pathlib import Path
1616

1717
LANGUAGE_CODE = re.compile(r"[a-z]{2,3}(?:-[a-z0-9]{2,8})*")
@@ -84,7 +84,7 @@ def deliver_video(
8484
language: str,
8585
*,
8686
destination: Path | None = None,
87-
today: date | None = None,
87+
today: datetime.date | None = None,
8888
) -> Path:
8989
video = video.resolve(strict=True)
9090
if not video.is_file() or video.suffix.lower() != ".mp4":
@@ -98,7 +98,11 @@ def deliver_video(
9898
if not destination.is_dir():
9999
raise ValueError("Delivery destination must be a directory")
100100

101-
day = date.today() if today is None else today
101+
day = (
102+
datetime.datetime.now(tz=datetime.UTC).date()
103+
if today is None
104+
else today
105+
)
102106
base = (
103107
f"{day:%Y%m%d}-{sanitize_stem(original_name)}-"
104108
f"{normalized_language_code(language)}-subtitles"

skills/multilingual-caption-video/scripts/download.py

100644100755
File mode changed.

skills/multilingual-caption-video/scripts/make_ass.py

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from pathlib import Path
1313
from typing import NotRequired, TypedDict
1414

15-
1615
CAPTION_STYLES = {"Default", "DarkOnLight", "Boxed"}
1716

1817

@@ -54,7 +53,7 @@ def probe_display_dimensions(video: Path) -> VideoDimensions:
5453
stream = streams[0]
5554
width, height = stream.get("width"), stream.get("height")
5655
if not isinstance(width, int) or not isinstance(height, int):
57-
raise ValueError("Video dimensions are unavailable")
56+
raise TypeError("Video dimensions are unavailable")
5857
if width <= 0 or height <= 0:
5958
raise ValueError("Video dimensions must be positive")
6059

skills/multilingual-caption-video/scripts/preferences.py

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from pathlib import Path
1414
from typing import cast
1515

16-
1716
type Preferences = dict[str, str | int]
1817

1918

0 commit comments

Comments
 (0)