mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
chore(dev): add an optional mise contributor toolchain (#4948)
Add mise.toml pinning Rust (with rustfmt and clippy), Node.js and pnpm, plus six tasks (setup, dev, dev:app, build, test, check) that call the existing pnpm scripts and Cargo commands, so the worktree-aware launcher is unchanged and contributors can still work without mise. Document the optional workflow in both setup guides and AGENTS.md, and raise the documented Node minimum to 22.22.2, which the locked jsdom requires on the 22.x line. Closes #4941 Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com>
This commit is contained in:
@@ -73,7 +73,9 @@ Shared agent skills live in `.agents/skills/` (`.claude/skills/` links to them):
|
||||
|
||||
## Commands
|
||||
|
||||
- `pnpm tauri dev` — run the app with worktree isolation (Node 22.18+).
|
||||
- Optional: `mise install` provisions the contributor toolchain; `mise tasks` lists the task aliases.
|
||||
See [Development setup](docs/en/contribute/setup.mdx). The direct commands below still work without mise.
|
||||
- `pnpm tauri dev` — run the app with worktree isolation. Use Node 22.22.2 or later on the 22.x line.
|
||||
`pnpm dev:app` also enables the global Tauri API. `pnpm dev:status` reports
|
||||
this worktree's running MCP bridges and actual ports.
|
||||
- `pnpm build` — typecheck + bundle frontend.
|
||||
|
||||
@@ -7,12 +7,12 @@ OpenIDEA is a Tauri 2 app: a Rust backend (`crates/`, `src-tauri/`) and a React
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Tool | Version | Notes |
|
||||
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| Rust | stable, at least 1.96 | `rust-version` in the root `Cargo.toml`. Install `clippy` and `rustfmt` too. |
|
||||
| Node.js | 22.18 or newer | The repo's scripts (`scripts/*.ts`, `perf/*.ts`) are run directly by Node as TypeScript. CI uses Node 22. |
|
||||
| pnpm | 11 | The version CI uses. |
|
||||
| Tauri system dependencies | — | Per OS: see [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/). |
|
||||
| Tool | Version | Notes |
|
||||
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| Rust | stable, at least 1.96 | `rust-version` in the root `Cargo.toml`. Install `clippy` and `rustfmt` too. |
|
||||
| Node.js | 22.x, at least 22.22.2 | CI uses Node 22. Node runs the TypeScript scripts directly; the locked jsdom requires this patch or newer on 22.x. |
|
||||
| pnpm | 11 | The version CI uses. |
|
||||
| Tauri system dependencies | — | Per OS: see [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/). |
|
||||
|
||||
On Linux (Ubuntu 22.04, as in CI) the system packages are:
|
||||
|
||||
@@ -54,6 +54,21 @@ Other everyday commands:
|
||||
| `pnpm gen:bindings` | Regenerate `src/bindings.ts` from the Rust command signatures. |
|
||||
| `pnpm dev` | Vite alone: the UI in a plain browser with in-memory backends (no Rust). |
|
||||
|
||||
## Optional: use mise
|
||||
|
||||
Instead of installing Rust, Node.js and pnpm separately, [install mise](https://mise.jdx.dev/installing-mise.html). You still need the Tauri system dependencies above. From the cloned worktree, after reviewing `mise.toml`, run:
|
||||
|
||||
```sh
|
||||
mise trust
|
||||
mise install
|
||||
mise run setup
|
||||
mise run dev
|
||||
```
|
||||
|
||||
`setup` runs `pnpm install` in this worktree. `dev` and `dev:app` use the same worktree-aware launchers as the direct commands. No shell activation is needed for `mise run`.
|
||||
|
||||
Run `mise tasks` to list all six tasks. `mise run build` builds the frontend (not a desktop installer). `mise run test` runs Vitest and `cargo test --workspace`; `mise run check` runs the format, lint, type and unused-code checks, then both test suites. Neither requires nextest or the plugin WASM target.
|
||||
|
||||
## Worktrees
|
||||
|
||||
Several worktrees can be developed and run side by side. Create one per task:
|
||||
|
||||
@@ -7,12 +7,12 @@ OpenIDEA 是一个 Tauri 2 应用:Rust 后端(`crates/`、`src-tauri/`)加
|
||||
|
||||
## 前置条件
|
||||
|
||||
| 工具 | 版本 | 说明 |
|
||||
| -------------- | ----------------- | ------------------------------------------------------------------------------------------ |
|
||||
| Rust | stable,至少 1.96 | 见根目录 `Cargo.toml` 的 `rust-version`。同时安装 `clippy` 和 `rustfmt`。 |
|
||||
| Node.js | 22.18 及以上 | 仓库脚本(`scripts/*.ts`、`perf/*.ts`)由 Node 直接按 TypeScript 运行。CI 用的是 Node 22。 |
|
||||
| pnpm | 11 | 与 CI 一致。 |
|
||||
| Tauri 系统依赖 | — | 各平台要求见 [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/)。 |
|
||||
| 工具 | 版本 | 说明 |
|
||||
| -------------- | ------------------ | ------------------------------------------------------------------------------------------- |
|
||||
| Rust | stable,至少 1.96 | 见根目录 `Cargo.toml` 的 `rust-version`。同时安装 `clippy` 和 `rustfmt`。 |
|
||||
| Node.js | 22.x,至少 22.22.2 | CI 使用 Node 22。Node 直接运行 TypeScript 脚本;锁定的 jsdom 在 22.x 上至少需要此补丁版本。 |
|
||||
| pnpm | 11 | 与 CI 一致。 |
|
||||
| Tauri 系统依赖 | — | 各平台要求见 [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/)。 |
|
||||
|
||||
Linux(与 CI 一样以 Ubuntu 22.04 为例)需要的系统包:
|
||||
|
||||
@@ -54,6 +54,21 @@ sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librs
|
||||
| `pnpm gen:bindings` | 根据 Rust 命令签名重新生成 `src/bindings.ts`。 |
|
||||
| `pnpm dev` | 只起 Vite:在普通浏览器里运行 UI,后端用内存实现(不需要 Rust)。 |
|
||||
|
||||
## 可选:使用 mise
|
||||
|
||||
如果不想分别安装 Rust、Node.js 和 pnpm,可以[安装 mise](https://mise.jdx.dev/installing-mise.html)。上面列出的 Tauri 系统依赖仍需单独安装。在克隆的 worktree 中查看 `mise.toml`,然后运行:
|
||||
|
||||
```sh
|
||||
mise trust
|
||||
mise install
|
||||
mise run setup
|
||||
mise run dev
|
||||
```
|
||||
|
||||
`setup` 在当前 worktree 中执行 `pnpm install`。`dev` 和 `dev:app` 都沿用原来的启动脚本,保留 worktree 隔离。使用 `mise run` 不需要在 shell 中激活 mise。
|
||||
|
||||
运行 `mise tasks` 可以查看全部六个任务。`mise run build` 构建前端,不生成桌面安装包。`mise run test` 运行 Vitest 和 `cargo test --workspace`;`mise run check` 先检查格式、代码规范、类型和未使用的代码,再运行这两套测试。两者都不需要 nextest 或插件的 WASM 目标。
|
||||
|
||||
## Worktree
|
||||
|
||||
可以同时开发和运行多个 worktree。每个任务建一个:
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
[tools]
|
||||
node = "22.23.5"
|
||||
# Use the JS distribution: pnpm's standalone release doesn't cover Intel Macs.
|
||||
"npm:pnpm" = "11.28.12"
|
||||
rust = { version = "1.100.0", profile = "minimal", components = ["rustfmt", "clippy"] }
|
||||
|
||||
[tasks.setup]
|
||||
description = "Install frontend dependencies for this worktree"
|
||||
run = "pnpm install"
|
||||
|
||||
[tasks.dev]
|
||||
description = "Launch the desktop app with worktree isolation"
|
||||
run = "pnpm tauri dev"
|
||||
|
||||
[tasks."dev:app"]
|
||||
description = "Launch the desktop app with the global Tauri API enabled"
|
||||
run = "pnpm dev:app"
|
||||
|
||||
[tasks.build]
|
||||
description = "Typecheck, bundle and verify the frontend"
|
||||
run = "pnpm build"
|
||||
|
||||
[tasks.test]
|
||||
description = "Run the frontend and Rust workspace tests"
|
||||
run = ["pnpm test", "cargo test --workspace"]
|
||||
|
||||
[tasks.check]
|
||||
description = "Check formatting, lint, types and unused code, then run the tests"
|
||||
run = [
|
||||
"pnpm format:check",
|
||||
"pnpm lint",
|
||||
"pnpm typecheck",
|
||||
"pnpm knip",
|
||||
"cargo fmt --all --check",
|
||||
"cargo clippy --workspace --all-targets -- -D warnings",
|
||||
{ task = "test" },
|
||||
]
|
||||
Reference in New Issue
Block a user