Skip to content

Commit b92eeb8

Browse files
sync from internal repository
1 parent 191d614 commit b92eeb8

File tree

14 files changed

+580
-172
lines changed

14 files changed

+580
-172
lines changed

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ bin/build-rs # Build Rust crate
1010
bin/build-py # Build Python bindings (maturin develop)
1111
bin/check # Run all checks (format, lint, test)
1212
bin/check-rs # Rust checks (fmt, clippy, test)
13-
bin/check-py # Python checks (ruff)
13+
bin/check-py # Python checks (ruff, ty)
1414
bin/test # Run all tests
1515
bin/test-rs # Rust tests
1616
bin/format # Format all code
1717
bin/install # Install CLI (Rust + Python)
18+
bin/bump-version # Bump version (--patch, --minor (default), --major)
1819
```
1920

2021
## Architecture
@@ -28,7 +29,7 @@ dkdc-links/ # Core Rust crate (standalone, not in monorepo workspace)
2829
src/open.rs # Link resolution (alias → link → URI)
2930
src/gui.rs # iced GUI (behind `gui` feature flag)
3031
dkdc-links-py/ # PyO3 bindings (cdylib)
31-
src/dkdc_links/ # Python wrapper
32+
src/dkdc_links/ # Python wrapper + type stubs (core.pyi, py.typed)
3233
```
3334

3435
Config structure: aliases map to links, links map to URIs, groups expand to multiple aliases/links.

bin/bump-version

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
4+
5+
# ---------- usage ----------
6+
7+
usage() {
8+
echo "Usage: bin/bump-version [--major | --minor | --patch]"
9+
echo ""
10+
echo "Bump the version across all Rust and Python packages."
11+
echo "Default: --minor"
12+
exit "${1:-0}"
13+
}
14+
15+
# ---------- args ----------
16+
17+
BUMP=""
18+
for arg in "$@"; do
19+
case "$arg" in
20+
--patch|--minor|--major)
21+
if [ -n "$BUMP" ]; then
22+
echo "ERROR: cannot combine --$BUMP and $arg" >&2
23+
exit 1
24+
fi
25+
BUMP="${arg#--}"
26+
;;
27+
--help|-h)
28+
usage 0
29+
;;
30+
*)
31+
echo "ERROR: unknown argument: $arg" >&2
32+
usage 1
33+
;;
34+
esac
35+
done
36+
37+
BUMP="${BUMP:-minor}"
38+
39+
# ---------- files ----------
40+
41+
TOML_FILES=(
42+
pyproject.toml
43+
dkdc-links/Cargo.toml
44+
dkdc-links-py/Cargo.toml
45+
)
46+
47+
# ---------- read current version ----------
48+
49+
CURRENT=$(grep -m1 '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
50+
if [ -z "$CURRENT" ]; then
51+
echo "ERROR: could not read version from pyproject.toml" >&2
52+
exit 1
53+
fi
54+
55+
for f in "${TOML_FILES[@]}"; do
56+
V=$(grep -m1 '^version = ' "$f" | sed 's/version = "\(.*\)"/\1/')
57+
if [ "$V" != "$CURRENT" ]; then
58+
echo "ERROR: version mismatch: pyproject.toml=$CURRENT but $f=$V" >&2
59+
exit 1
60+
fi
61+
done
62+
63+
# ---------- compute new version ----------
64+
65+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
66+
67+
case "$BUMP" in
68+
patch) NEW="$MAJOR.$MINOR.$((PATCH + 1))" ;;
69+
minor) NEW="$MAJOR.$((MINOR + 1)).0" ;;
70+
major) NEW="$((MAJOR + 1)).0.0" ;;
71+
esac
72+
73+
echo "Bumping version: $CURRENT -> $NEW ($BUMP)"
74+
75+
# ---------- update files ----------
76+
77+
for f in "${TOML_FILES[@]}"; do
78+
sed -i '' "s/^version = \"$CURRENT\"/version = \"$NEW\"/" "$f"
79+
echo " updated $f"
80+
done
81+
82+
# ---------- regenerate lock files ----------
83+
84+
echo "Regenerating lock files..."
85+
cargo generate-lockfile --quiet
86+
echo " updated Cargo.lock"
87+
(cd dkdc-links-py && cargo generate-lockfile --quiet)
88+
echo " updated dkdc-links-py/Cargo.lock"
89+
uv lock --quiet
90+
echo " updated uv.lock"
91+
92+
echo "Done! $CURRENT -> $NEW"

bin/check-py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

55
echo "Running ruff..."
6-
uv run dev ruff check .
7-
uv run ruff format --check .
6+
uv run --only-group dev ruff check .
7+
uv run --only-group dev ruff format --check .
8+
9+
echo "Running ty..."
10+
uv run --only-group dev ty check
811

912
echo "Python checks passed!"

bin/format-py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

55
echo "Formatting Python code..."
6-
uv run ruff format .
6+
uv run --only-group dev ruff format .
77

88
echo "Sorting Python imports..."
9-
uv run ruff check --fix --select I .
9+
uv run --only-group dev ruff check --fix --select I .
1010

1111
echo "Python formatting complete!"

dkdc-links-py/Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dkdc-links-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "dkdc-links-py"
5-
version = "4.0.0"
5+
version = "4.1.0"
66
edition = "2024"
77
authors = ["Cody <cody@dkdc.dev>"]
88
license = "MIT"

dkdc-links/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dkdc-links/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
[workspace]
22

3+
[profile.release]
4+
lto = true
5+
strip = true
6+
codegen-units = 1
7+
38
[package]
49
name = "dkdc-links"
5-
version = "4.0.0"
10+
version = "4.1.0"
611
edition = "2024"
712
authors = ["Cody <cody@dkdc.dev>"]
813
description = "Bookmarks in your terminal"
@@ -19,7 +24,7 @@ name = "dkdc-links"
1924
path = "src/main.rs"
2025

2126
[features]
22-
app = ["dep:iced"]
27+
app = ["dep:iced", "dep:png"]
2328
webapp = ["dep:axum", "dep:tokio"]
2429

2530
[dependencies]
@@ -29,6 +34,7 @@ clap = { version = "4.5", features = ["derive"] }
2934
dirs = "6"
3035
iced = { version = "0.14", features = ["tokio", "svg"], optional = true }
3136
open = "5"
37+
png = { version = "0.17", optional = true }
3238
serde = { version = "1", features = ["derive"] }
3339
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "signal"], optional = true }
3440
toml = "0.9"

dkdc-links/assets/icon.png

631 KB
Loading

0 commit comments

Comments
 (0)