Skip to content

Commit 54268fd

Browse files
Merge remote-tracking branch 'repoconf-rust-public-lib-template/main'
2 parents cf7604e + 1b9348b commit 54268fd

File tree

15 files changed

+743
-181
lines changed

15 files changed

+743
-181
lines changed

.claude/settings.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"permissions": {
3+
"defaultMode": "acceptEdits",
4+
"allow": [
5+
"Agent",
6+
"Bash(rg :*)",
7+
"Bash(fd :*)",
8+
"Bash(jq :*)",
9+
"Bash(echo :*)",
10+
"Bash(grep :*)",
11+
"Bash(find :*)",
12+
"Bash(mv :*)",
13+
"Bash(mkdir :*)",
14+
"Bash(head :*)",
15+
"Bash(tail :*)",
16+
"Bash(git diff :*)",
17+
"Bash(git log :*)",
18+
"Bash(cargo :*)",
19+
"Bash(mise run :*)",
20+
"Edit",
21+
"MultiEdit",
22+
"Glob",
23+
"Grep",
24+
"LS",
25+
"NotebookRead",
26+
"NotebookEdit",
27+
"Read",
28+
"Write",
29+
"TodoRead",
30+
"TodoWrite",
31+
"WebFetch",
32+
"WebSearch"
33+
]
34+
},
35+
"hooks": {
36+
"Stop": [
37+
{
38+
"hooks": [
39+
{
40+
"type": "command",
41+
"command": "if ! mise run --quiet agent:on:stop 1>&2; then exit 2; fi"
42+
}
43+
]
44+
}
45+
]
46+
}
47+
}

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: CI
22
on: [ push, pull_request ]
33

44
env:
5-
RUSTFLAGS: -Dwarnings
5+
RUSTFLAGS: >-
6+
-Dwarnings
7+
-Clink-arg=-fuse-ld=mold
68
RUST_BACKTRACE: 1
79
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
810

@@ -20,18 +22,20 @@ jobs:
2022
timeout-minutes: 45
2123
steps:
2224
- uses: actions/checkout@v4
25+
# mold is a workaround for regression in Rust 1.93 beta
26+
- uses: rui314/setup-mold@v1
2327
- uses: jdx/mise-action@v2
2428
with:
25-
version: 2025.1.14
29+
version: 2025.10.11
2630
- name: Remove rust from mise
2731
run: |
2832
# a different rust version will be installed in the next step
2933
mise rm rust
30-
- uses: dtolnay/rust-toolchain@stable
34+
- uses: dtolnay/rust-toolchain@master
3135
with:
3236
toolchain: ${{ matrix.rust }}
3337
components: clippy, rustfmt
34-
- uses: Swatinem/rust-cache@v2.7.3
38+
- uses: Swatinem/rust-cache@v2.8.0
3539
- run: lefthook run --force pre-commit
3640
- run: cargo hack test --feature-powerset
3741
- uses: wagoid/commitlint-github-action@v6

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
/.cache

.repoconf/data/managed-files

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.github/workflows/ci.yml
2+
.gitignore
3+
commitlint.config.mjs
4+
deno.json
5+
lefthook.yml
6+
mise.toml
7+
README.ts
8+
rustfmt.toml
9+
CLAUDE.md

.repoconf/hooks/post-init.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env -S usage bash
2+
#USAGE flag "-n --name <name>" help="Package name (if this flag is not provided, then the package name is inferred from the directory name)"
3+
#USAGE arg "<dir>"
4+
5+
set -xeuo pipefail
6+
7+
dir=$(realpath "${usage_dir:?}")
8+
name_new_default="${usage_name:-$(basename "$dir")}"
9+
cargo_toml="$dir/Cargo.toml"
10+
#mise_toml="$dir/mise.toml"
11+
12+
read -r -p "Rust package name (default: $name_new_default): " name_new
13+
read -r -p "Rust package description: " description
14+
read -r -p "Rust package title (default: same as description): " title
15+
16+
if [[ -z $name_new ]]; then
17+
name_new=$name_new_default
18+
fi
19+
20+
if [[ -z $title ]]; then
21+
title=$description
22+
fi
23+
24+
(
25+
cd "$dir"
26+
27+
files=("README.md" "LICENSE-APACHE" "LICENSE-MIT")
28+
for file in "${files[@]}"; do
29+
if [[ -f "$file" ]]; then
30+
rm "$file"
31+
fi
32+
done
33+
34+
mise trust
35+
mise install
36+
37+
name_old=$(taplo get -f "$cargo_toml" "package.name")
38+
name_old_snake_case=$(ccase --to snake "$name_old")
39+
name_new_snake_case=$(ccase --to snake "$name_new")
40+
repo_url=$(cd "$dir" && gh repo view --json url | jq -r .url)
41+
42+
tomli set -f "$cargo_toml" "package.name" "$name_new" | sponge "$cargo_toml"
43+
tomli set -f "$cargo_toml" "package.repository" "$repo_url" | sponge "$cargo_toml"
44+
tomli set -f "$cargo_toml" "package.homepage" "$repo_url" | sponge "$cargo_toml"
45+
tomli set -f "$cargo_toml" "package.description" "$description" | sponge "$cargo_toml"
46+
tomli set -f "$cargo_toml" "package.metadata.details.title" "$title" | sponge "$cargo_toml"
47+
48+
# rg exits with status code = 1 if it doesn't find any files, so we need to disable & re-enable "set -e"
49+
set +e
50+
rg --files-with-matches "$name_old_snake_case" "$dir" | xargs gsed -i "s/\b$name_old_snake_case\b/$name_new_snake_case/g"
51+
set -e
52+
53+
mise exec -- lefthook install
54+
55+
mise run build
56+
mise run test
57+
58+
git add .
59+
git commit -a -m "chore: update package details"
60+
)

.repomixignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.github
2+
.claude
3+
README.ts
4+
commitlint.config.mjs
5+
deno.json
6+
LICENSE*
7+
AGENTS*
8+
README.ts
9+
rustfmt.toml
10+
.repomixignore

0 commit comments

Comments
 (0)