From 6b408cd66ddc5adab9fc3fb06df30e3f0dd1d316 Mon Sep 17 00:00:00 2001 From: alexion Date: Sat, 5 Sep 2026 22:15:20 -0400 Subject: [PATCH] feat(ariadne): add graph core crate --- AGENTS.md | 11 +++++++++++ Cargo.lock | 7 +++++++ Cargo.toml | 3 ++- src/ariadne/BUILD | 15 --------------- src/ariadne/README.md | 27 --------------------------- src/ariadne/bin/BUILD | 9 +++++++++ src/ariadne/bin/Cargo.toml | 11 +++++++++++ src/ariadne/{src => bin}/main.rs | 0 src/ariadne/core/BUILD | 16 ++++++++++++++++ src/ariadne/{ => core}/Cargo.toml | 3 +++ src/ariadne/core/graph.rs | 4 ++++ src/ariadne/{src => core}/lib.rs | 2 ++ 12 files changed, 65 insertions(+), 43 deletions(-) delete mode 100644 src/ariadne/README.md create mode 100644 src/ariadne/bin/BUILD create mode 100644 src/ariadne/bin/Cargo.toml rename src/ariadne/{src => bin}/main.rs (100%) create mode 100644 src/ariadne/core/BUILD rename src/ariadne/{ => core}/Cargo.toml (86%) create mode 100644 src/ariadne/core/graph.rs rename src/ariadne/{src => core}/lib.rs (72%) diff --git a/AGENTS.md b/AGENTS.md index bd8749d..f77c29b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -96,5 +96,16 @@ - In this monorepo, "dotfiles" refers to the dotfiles/NixOS configuration under `src/dotfiles/` and `configs/nixos/`. - The flake does not currently define `formatter.x86_64-linux`. Do not use `nix fmt` as a validation command until a formatter is added. +- When creating a pull request from a worktree-specific development branch, create a dedicated pull-request branch + separate from the branch that names or anchors the worktree. + Do not open pull requests directly from the worktree branch. +- Ariadne separates Rust library code and binary entry-point code under `src/ariadne/core/` and + `src/ariadne/bin/`. + Do not add a Cargo-default nested `src/ariadne/src/` source directory. +- Use `bazel build` for non-test targets when no Bazel test target is part of the validation set. + `bazel test` exits non-zero when it finds no test targets. +- In Bazel `BUILD` files, depend on vendored Rust crates through the public aliases under + `//third_party/crates`, for example `//third_party/crates:serde`. + Use crate universe only to vendor crates, not as a dependency macro API for first-party targets. - Ariadne extraction must preserve the game-root season prefix for archived source. Different game installs can contain compiled scripts with the same internal path. diff --git a/Cargo.lock b/Cargo.lock index 413061d..c62239c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,6 +10,13 @@ dependencies = [ "serde_json", ] +[[package]] +name = "ariadne-bin" +version = "0.1.0" +dependencies = [ + "ariadne", +] + [[package]] name = "itoa" version = "1.0.18" diff --git a/Cargo.toml b/Cargo.toml index 10b9230..5b8731f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] members = [ - "src/ariadne", + "src/ariadne/bin", + "src/ariadne/core", "src/machoke", ] resolver = "3" diff --git a/src/ariadne/BUILD b/src/ariadne/BUILD index c3f343f..e40b023 100644 --- a/src/ariadne/BUILD +++ b/src/ariadne/BUILD @@ -1,18 +1,3 @@ -load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library") - -rust_library( - name = "ariadne_lib", - crate_name = "ariadne", - srcs = ["src/lib.rs"], -) - -rust_binary( - name = "ariadne", - crate_name = "ariadne_cli", - srcs = ["src/main.rs"], - deps = [":ariadne_lib"], -) - sh_binary( name = "extract_and_decompile", srcs = ["extract-and-decompile.sh"], diff --git a/src/ariadne/README.md b/src/ariadne/README.md deleted file mode 100644 index bbadaaa..0000000 --- a/src/ariadne/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Ariadne - -Ariadne prepares Ren'Py game source for later analysis. - -## Bazel shape - -Keep project-owned source under `src/ariadne/`. Keep game-derived files local and ignored under -`src/ariadne/output/`. - -The first target is a shell entry point: - -```sh -bazel run //src/ariadne:extract_and_decompile -- \ - --game-root /path/to/game-install -``` - -The script defaults to `/src/ariadne/output`. -This path stays stable when you run the command from inside `src/ariadne`. -Use the game installation directory as the game root. -One run processes all installed season directories. -Extracted archive source keeps the archive path relative to the game root, so files with the same -internal path from different season installs do not overwrite each other. -If `rpycdec` is not available, the script uses `extract-tools.nix` to enter a Nix shell. - -Keep the script as a thin orchestration layer. -Bazel owns stable inputs and wrappers. -Keep large game files and recovered output outside the build graph. diff --git a/src/ariadne/bin/BUILD b/src/ariadne/bin/BUILD new file mode 100644 index 0000000..efa77be --- /dev/null +++ b/src/ariadne/bin/BUILD @@ -0,0 +1,9 @@ +load("@rules_rust//rust:defs.bzl", "rust_binary") + +rust_binary( + name = "ariadne", + crate_name = "ariadne_cli", + visibility = ["//src/ariadne:__pkg__"], + srcs = ["main.rs"], + deps = ["//src/ariadne/core:ariadne_lib"], +) diff --git a/src/ariadne/bin/Cargo.toml b/src/ariadne/bin/Cargo.toml new file mode 100644 index 0000000..18559a3 --- /dev/null +++ b/src/ariadne/bin/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "ariadne-bin" +version = "0.1.0" +edition = "2024" + +[[bin]] +name = "ariadne" +path = "main.rs" + +[dependencies] +ariadne = { path = "../core" } diff --git a/src/ariadne/src/main.rs b/src/ariadne/bin/main.rs similarity index 100% rename from src/ariadne/src/main.rs rename to src/ariadne/bin/main.rs diff --git a/src/ariadne/core/BUILD b/src/ariadne/core/BUILD new file mode 100644 index 0000000..258a2b4 --- /dev/null +++ b/src/ariadne/core/BUILD @@ -0,0 +1,16 @@ +load("@rules_rust//rust:defs.bzl", "rust_library") + +rust_library( + name = "ariadne_lib", + crate_name = "ariadne", + crate_root = "lib.rs", + visibility = ["//src/ariadne:__subpackages__"], + srcs = [ + "graph.rs", + "lib.rs", + ], + deps = [ + "//third_party/crates:serde", + "//third_party/crates:serde_json", + ], +) diff --git a/src/ariadne/Cargo.toml b/src/ariadne/core/Cargo.toml similarity index 86% rename from src/ariadne/Cargo.toml rename to src/ariadne/core/Cargo.toml index 2d5ae86..cfc2504 100644 --- a/src/ariadne/Cargo.toml +++ b/src/ariadne/core/Cargo.toml @@ -3,6 +3,9 @@ name = "ariadne" version = "0.1.0" edition = "2024" +[lib] +path = "lib.rs" + [dependencies] serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/src/ariadne/core/graph.rs b/src/ariadne/core/graph.rs new file mode 100644 index 0000000..6a2afbb --- /dev/null +++ b/src/ariadne/core/graph.rs @@ -0,0 +1,4 @@ +//! In-memory graph model used by Ariadne pipeline stages. + +#[derive(Clone, Debug, Default, Eq, PartialEq)] +pub struct Graph; diff --git a/src/ariadne/src/lib.rs b/src/ariadne/core/lib.rs similarity index 72% rename from src/ariadne/src/lib.rs rename to src/ariadne/core/lib.rs index 8f9e795..53718a4 100644 --- a/src/ariadne/src/lib.rs +++ b/src/ariadne/core/lib.rs @@ -1,3 +1,5 @@ +pub mod graph; + pub fn run() { println!("Ariadne"); }