Skip to content

Commit a1ad979

Browse files
committed
Add CI workflows and app version display
1 parent 09d7d64 commit a1ad979

5 files changed

Lines changed: 148 additions & 10 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: PR Checks
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: pr-checks-${{ github.event.pull_request.number }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
rust:
15+
name: Rust checks
16+
runs-on: windows-latest
17+
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v5
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v6
24+
with:
25+
version: 10
26+
27+
- name: Install Node.js
28+
uses: actions/setup-node@v6
29+
with:
30+
node-version: 22
31+
cache: pnpm
32+
cache-dependency-path: apps/kimi-code/pnpm-lock.yaml
33+
34+
- name: Install frontend dependencies
35+
working-directory: apps/kimi-code
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Build frontend
39+
working-directory: apps/kimi-code
40+
run: pnpm build
41+
42+
- name: Install Rust
43+
uses: dtolnay/rust-toolchain@stable
44+
with:
45+
components: rustfmt, clippy
46+
47+
- name: Check formatting
48+
run: cargo fmt --all -- --check
49+
50+
- name: Check workspace
51+
run: cargo check --workspace --all-targets
52+
53+
- name: Run Clippy
54+
run: cargo clippy --workspace --all-targets -- -D warnings
55+
56+
- name: Run tests
57+
run: cargo test --workspace --all-targets
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release Windows
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Build and publish Windows
14+
runs-on: windows-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v5
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v6
22+
with:
23+
version: 10
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v6
27+
with:
28+
node-version: 22
29+
cache: pnpm
30+
cache-dependency-path: apps/kimi-code/pnpm-lock.yaml
31+
32+
- name: Install Rust
33+
uses: dtolnay/rust-toolchain@stable
34+
35+
- name: Install frontend dependencies
36+
working-directory: apps/kimi-code
37+
run: pnpm install --frozen-lockfile
38+
39+
- name: Build and publish Kimi Code
40+
uses: tauri-apps/tauri-action@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
projectPath: apps/kimi-code
45+
tagName: ${{ github.ref_name }}
46+
releaseName: Kimi Code ${{ github.ref_name }}
47+
releaseBody: Windows builds for Kimi Code ${{ github.ref_name }}.
48+
releaseDraft: false
49+
prerelease: false

apps/kimi-code/src/App.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
useState,
1212
} from "react";
1313
import { invoke, isTauri } from "@tauri-apps/api/core";
14+
import { getVersion } from "@tauri-apps/api/app";
1415
import { listen } from "@tauri-apps/api/event";
1516
import { getCurrentWindow } from "@tauri-apps/api/window";
1617
import { open } from "@tauri-apps/plugin-dialog";
@@ -595,6 +596,7 @@ export default function App() {
595596
const [loginBusy, setLoginBusy] = useState(false);
596597
const [deviceCode, setDeviceCode] = useState<DeviceCode>();
597598
const [profileOpen, setProfileOpen] = useState(false);
599+
const [appVersion, setAppVersion] = useState<string>();
598600
const [accountUsage, setAccountUsage] = useState<AccountUsage>();
599601
const [accountUsageBusy, setAccountUsageBusy] = useState(false);
600602
const [accountUsageError, setAccountUsageError] = useState<string>();
@@ -843,6 +845,19 @@ export default function App() {
843845
};
844846
}, []);
845847

848+
useEffect(() => {
849+
if (!isTauri()) return;
850+
let active = true;
851+
void getVersion()
852+
.then((version) => {
853+
if (active) setAppVersion(version);
854+
})
855+
.catch(() => undefined);
856+
return () => {
857+
active = false;
858+
};
859+
}, []);
860+
846861
useEffect(() => {
847862
if (!profileOpen) return;
848863
const closeProfile = (event: PointerEvent): void => {
@@ -1994,6 +2009,7 @@ export default function App() {
19942009
</div>
19952010
{profileOpen && (
19962011
<AccountUsagePopover
2012+
appVersion={appVersion}
19972013
usage={accountUsage}
19982014
busy={accountUsageBusy}
19992015
error={accountUsageError}
@@ -2357,12 +2373,14 @@ export default function App() {
23572373
}
23582374

23592375
function AccountUsagePopover({
2376+
appVersion,
23602377
usage,
23612378
busy,
23622379
error,
23632380
onRefresh,
23642381
onSignOut,
23652382
}: {
2383+
appVersion?: string;
23662384
usage?: AccountUsage;
23672385
busy: boolean;
23682386
error?: string;
@@ -2385,8 +2403,11 @@ function AccountUsagePopover({
23852403
<span className="profile-identity-mark">
23862404
<Sparkles size={14} />
23872405
</span>
2388-
<span>
2389-
<strong>Kimi Code</strong>
2406+
<span className="profile-identity-copy">
2407+
<span className="profile-identity-title">
2408+
<strong>Kimi Code</strong>
2409+
{appVersion && <small>v{appVersion}</small>}
2410+
</span>
23902411
<small>OAuth 账号</small>
23912412
</span>
23922413
</div>

apps/kimi-code/src/styles.css

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,19 +962,32 @@ select:focus-visible {
962962
background: rgba(139, 124, 246, 0.1);
963963
}
964964

965-
.profile-identity > span:last-child {
965+
.profile-identity-copy {
966966
display: flex;
967967
min-width: 0;
968968
flex-direction: column;
969969
}
970970

971+
.profile-identity-title {
972+
display: flex;
973+
align-items: baseline;
974+
gap: 6px;
975+
}
976+
971977
.profile-identity strong {
972978
color: #e1e1e6;
973979
font-size: 11.5px;
974980
font-weight: 600;
975981
}
976982

977-
.profile-identity small {
983+
.profile-identity-title small {
984+
margin: 0;
985+
color: #656570;
986+
font-size: 8.5px;
987+
font-weight: 450;
988+
}
989+
990+
.profile-identity-copy > small {
978991
margin-top: 3px;
979992
color: var(--subtle);
980993
font-size: 9.5px;

crates/transcript/src/model/ids.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,11 @@ fn parse_prefixed_integer(value: &str) -> Option<i128> {
124124
.or_else(|| unsigned.strip_prefix("0B"))
125125
{
126126
(2, digits)
127-
} else if let Some(digits) = unsigned
128-
.strip_prefix("0o")
129-
.or_else(|| unsigned.strip_prefix("0O"))
130-
{
131-
(8, digits)
132127
} else {
133-
return None;
128+
let digits = unsigned
129+
.strip_prefix("0o")
130+
.or_else(|| unsigned.strip_prefix("0O"))?;
131+
(8, digits)
134132
};
135133

136134
i128::from_str_radix(digits, radix).ok().and_then(|number| {

0 commit comments

Comments
 (0)