From 025d1763a5c04c21e1db0fd12a45f544b9f88cce Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Sun, 3 May 2026 21:55:00 +0800 Subject: [PATCH] chore(workspace): bootstrap Cargo workspace + toolchain pin --- .cargo/config.toml | 8 ++++++++ .gitignore | 7 +++++++ Cargo.toml | 36 ++++++++++++++++++++++++++++++++++++ rust-toolchain.toml | 5 +++++ rustfmt.toml | 8 ++++++++ 5 files changed, 64 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 Cargo.toml create mode 100644 rust-toolchain.toml create mode 100644 rustfmt.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..c1e6a0594 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,8 @@ +[build] +# wasm32 target enabled via rust-toolchain.toml; no override here + +[net] +git-fetch-with-cli = true + +[term] +verbose = false diff --git a/.gitignore b/.gitignore index db3675d9c..82bedcff1 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,10 @@ dist-electron/ .omx .worktrees/ .omx/ + +# Rust +/target +**/*.rs.bk +Cargo.lock.merge-conflict +/crates/*/target +/vendor/agent/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..fb4dc69b7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,36 @@ +[workspace] +resolver = "2" +members = [ + "crates/openpencil-app", + "crates/openpencil-shell-core", + "crates/openpencil-shell-web", + "crates/openpencil-shell-native", + "crates/pen-types", + "crates/pen-core", + "crates/pen-engine", + "crates/pen-codegen", + "crates/pen-figma", +] +exclude = [ + "vendor/agent", + "node_modules", +] + +[workspace.package] +version = "0.1.0" +edition = "2021" +rust-version = "1.80" +license = "MIT" +authors = ["ZSeven-W "] +repository = "https://github.com/ZSeven-W/openpencil" + +[workspace.dependencies] +serde = { version = "1", features = ["derive"] } +serde_json = "1" +thiserror = "1" +anyhow = "1" +tracing = "0.1" + +# WASM 边界相关(per kickoff §1.2 黑名单 = 不出现在这里) +# 故意不在 workspace.dependencies 暴露 tokio / reqwest / agent / pen-agent-cli / +# pen-server / native-tls —— 这些只在 native-only crate 内部用 dev-deps 或 target-specific deps。 diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..bbda63c3a --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "1.80" +components = ["rustfmt", "clippy", "rust-src"] +targets = ["wasm32-unknown-unknown"] +profile = "default" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 000000000..0e3c8464b --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,8 @@ +edition = "2021" +max_width = 100 +tab_spaces = 4 +hard_tabs = false +imports_granularity = "Crate" +group_imports = "StdExternalCrate" +reorder_imports = true +newline_style = "Unix"