Skip to content

Commit 70eb6d0

Browse files
authored
Merge pull request #63 from unvt/main
Release 2026-01-15 07:40:33 UTC
2 parents 5ee5a75 + 677f3e9 commit 70eb6d0

File tree

14 files changed

+512
-31
lines changed

14 files changed

+512
-31
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Must bump version for release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- release
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
version-check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Ensure Cargo.toml version increased from release
16+
uses: actions/github-script@v8
17+
with:
18+
script: |
19+
const owner = context.repo.owner;
20+
const repo = context.repo.repo;
21+
const pr = context.payload.pull_request;
22+
const baseRef = pr.base.ref;
23+
const headSha = pr.head.sha;
24+
25+
async function getCargoToml(ref) {
26+
const { data } = await github.rest.repos.getContent({
27+
owner,
28+
repo,
29+
path: 'Cargo.toml',
30+
ref,
31+
});
32+
return Buffer.from(data.content, data.encoding).toString('utf8');
33+
}
34+
35+
function extractPackageVersion(toml) {
36+
const lines = toml.split(/\r?\n/);
37+
let inPackage = false;
38+
for (const line of lines) {
39+
const trimmed = line.trim();
40+
if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
41+
inPackage = trimmed === '[package]';
42+
continue;
43+
}
44+
if (!inPackage) continue;
45+
const match = trimmed.match(/^version\s*=\s*"([^"]+)"/);
46+
if (match) return match[1];
47+
}
48+
return null;
49+
}
50+
51+
function parseVersion(version) {
52+
const [core, pre] = version.split('-', 2);
53+
const parts = core.split('.').map((part) => parseInt(part, 10));
54+
while (parts.length < 3) parts.push(0);
55+
return { parts, pre: pre || null };
56+
}
57+
58+
function compareVersions(a, b) {
59+
const av = parseVersion(a);
60+
const bv = parseVersion(b);
61+
for (let i = 0; i < 3; i += 1) {
62+
if (av.parts[i] !== bv.parts[i]) {
63+
return av.parts[i] > bv.parts[i] ? 1 : -1;
64+
}
65+
}
66+
if (av.pre === bv.pre) return 0;
67+
if (av.pre === null) return 1;
68+
if (bv.pre === null) return -1;
69+
return av.pre > bv.pre ? 1 : -1;
70+
}
71+
72+
const headToml = await getCargoToml(headSha);
73+
const baseToml = await getCargoToml(baseRef);
74+
const headVersion = extractPackageVersion(headToml);
75+
const baseVersion = extractPackageVersion(baseToml);
76+
77+
if (!headVersion || !baseVersion) {
78+
core.setFailed(`Failed to read version from Cargo.toml (head: ${headVersion}, base: ${baseVersion}).`);
79+
return;
80+
}
81+
82+
if (compareVersions(headVersion, baseVersion) <= 0) {
83+
core.setFailed(`Cargo.toml version must be increased before merging into ${baseRef}. head=${headVersion}, base=${baseVersion}`);
84+
}

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
- Use PRs for `main` (direct push is blocked); `release` is the promotion branch.
1111
- Direct pushes to `main` are blocked.
1212
- Always use `.github/PULL_REQUEST_TEMPLATE.md` when creating pull requests.
13+
- Fork the repository on GitHub and open pull requests against the upstream repository (not your fork).
1314
- When editing PR bodies, do not paste raw `cargo test --verbose` output. If you ran `make test` and it passed, just check the Testing checkbox.
1415
- Do not use `gh pr edit` to update PR bodies. Use `gh api -X PATCH` instead.
1516
- Avoid `gh pr create`. Create PRs with `gh api -X POST /repos/<owner>/<repo>/pulls` and pass `title`, `head`, `base`, and `body`.
1617
- Always update `CHANGELOG.md` for user-visible changes before releasing.
1718
- When asked to bump versions, follow `docs/RELEASE.md`.
19+
- Release version bump PR branches must be named `bump/v<version>` (for example, `bump/v0.4.4`).
1820
- Release flow: `main``release` PRs are auto-created/updated; tags are created by workflow on `release` merges and releases are dispatched automatically.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ The format is based on Keep a Changelog and adheres to Semantic Versioning.
2020
### Security
2121
- TBD_UNVT_CHANGELOG_SECURITY
2222

23+
## [0.4.4] - 2026-01-15
24+
### Added
25+
- Add tile size to tile summary output ("Size of tile").
26+
- Add progress indicators for PMTiles inspect (spinner/bar depending on estimate availability).
27+
28+
### Changed
29+
- Align PMTiles inspect output sections with MBTiles.
30+
- Enforce Cargo.toml version bump for release PRs via CI.
31+
2332
## [0.4.3] - 2026-01-14
2433
### Added
2534
- Add a "Top 10 big tiles" section to inspect text output (respects --zoom).

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ Thanks for your interest in improving vt-optimizer-rs. Contributions are welcome
99
- Feature requests: describe the use case and expected output.
1010

1111
### Pull requests
12+
- Fork the repository on GitHub and work on a branch in your fork.
1213
- Keep changes small and focused.
1314
- Add or update tests when behavior changes.
1415
- Update documentation when you add or change CLI options.
16+
- Open pull requests against the upstream repository (not your fork).
1517

1618
## Development
1719

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vt-optimizer-rs"
3-
version = "0.4.3"
3+
version = "0.4.4"
44
edition = "2024"
55
license = "MIT"
66
description = "A fast CLI to inspect and optimize MBTiles/PMTiles vector tiles."

docs/SPEC.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,12 @@ v0.0.4 では以下を **含めない**。
561561
* `inspect` の text 出力に Top 10 big tiles セクションを追加
562562
* `inspect``-z/-x/-y` 指定時に Tile Summary を表示
563563

564+
## 1.67 マイルストーン(v0.4.4)
565+
566+
* `inspect --tile --summary` の Tile Summary に **タイルサイズ** を追加
567+
* `inspect` の PMTiles 出力セクションを MBTiles と揃える(Summary/Histogram/Top Tiles 等)
568+
* `inspect` の PMTiles でも進捗表示を有効化(推定値が取れる場合はバー、難しい場合はスピナー)
569+
564570
## 2. 用語
565571

566572
* **Tile key**: `z/x/y`(内部表現は XYZ)

src/mbtiles.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ pub struct TileSummary {
116116
pub zoom: u8,
117117
pub x: u32,
118118
pub y: u32,
119+
pub tile_bytes: u64,
119120
pub layer_count: usize,
120121
pub total_features: usize,
121122
pub vertex_count: u64,
@@ -937,6 +938,7 @@ fn build_tile_summary(
937938
row.get(0)
938939
})
939940
.context("failed to read tile data")?;
941+
let tile_bytes = u64::try_from(data.len()).context("tile data size overflow")?;
940942
let payload = decode_tile_payload(&data)?;
941943
let reader =
942944
Reader::new(payload).map_err(|err| anyhow::anyhow!("decode vector tile: {err}"))?;
@@ -996,6 +998,7 @@ fn build_tile_summary(
996998
zoom: coord.zoom,
997999
x: coord.x,
9981000
y: coord.y,
1001+
tile_bytes,
9991002
layer_count: summaries.len(),
10001003
total_features,
10011004
vertex_count: total_vertices,

src/output.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ pub fn ndjson_lines(report: &MbtilesReport, mut options: NdjsonOptions) -> Resul
277277
"z": summary.zoom,
278278
"x": summary.x,
279279
"y": summary.y,
280+
"bytes": summary.tile_bytes,
280281
"layers": summary.layer_count,
281282
"total_features": summary.total_features,
282283
"vertices": summary.vertex_count,
@@ -304,14 +305,15 @@ pub fn ndjson_lines(report: &MbtilesReport, mut options: NdjsonOptions) -> Resul
304305
for summary in report.top_tile_summaries.iter() {
305306
if options.compact {
306307
lines.push(serde_json::to_string(&json!({
307-
"type": "top_tile_summary",
308-
"z": summary.zoom,
309-
"x": summary.x,
310-
"y": summary.y,
311-
"layers": summary.layer_count,
312-
"total_features": summary.total_features,
313-
"vertices": summary.vertex_count,
314-
"keys": summary.property_key_count,
308+
"type": "top_tile_summary",
309+
"z": summary.zoom,
310+
"x": summary.x,
311+
"y": summary.y,
312+
"bytes": summary.tile_bytes,
313+
"layers": summary.layer_count,
314+
"total_features": summary.total_features,
315+
"vertices": summary.vertex_count,
316+
"keys": summary.property_key_count,
315317
"values": summary.property_value_count,
316318
}))?);
317319
} else {
@@ -498,6 +500,11 @@ pub fn format_tile_summary_text(summary: &TileSummary) -> Vec<String> {
498500
let label = |text: &str| Color::Blue.paint(text).to_string();
499501
vec![
500502
format!("- z={} x={} y={}", summary.zoom, summary.x, summary.y),
503+
format!(
504+
"- {}: {}",
505+
label("Size of tile"),
506+
format_bytes(summary.tile_bytes)
507+
),
501508
format!(
502509
"- {}: {}",
503510
label("Layers in this tile"),

0 commit comments

Comments
 (0)