Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ env:
GODOT_WINDOWS_SHA512: 83decd58fdf67b9d657958a1ae6bf1929c20785315a81effe245874cdc57acb709bf868e00778a96984338c1b29dafdb453c6847747694621c6ecf5da2259993
GODOT_MACOS_SHA512: 38aa16e5bba2083941fc5b3e54be0089bd4cc35e32415f5b9fd9a8a6a7b9818255d44532ea8ef94b5aef56c4b407c2d634fa4f657e4ebe681ebbf59b7bac69ca
AGENT_GUILD_COMMIT: 3a3cd721f713068ff78264560e29bf951ff9a37b
COMPANIONS_COMMIT: 05dfd1f5c0d64963048c67a826f0758d31b7e83d

jobs:
build:
Expand Down Expand Up @@ -105,6 +106,14 @@ jobs:
run: |
node tools/check_with_agent_guild.mjs build/pieces .agent-guild
if ($LASTEXITCODE -ne 0) { throw "Agent Guild refused a piece Studio made." }
- name: Every character the suites made passes Grove Companion's own check
working-directory: tools/companion_check
env:
COMPANION_CHARACTERS_RS: ${{ runner.temp }}/characters.rs
run: |
Invoke-WebRequest "https://raw.githubusercontent.com/oddessentials/agent-guild-companions/$env:COMPANIONS_COMMIT/src-tauri/src/characters.rs" -OutFile $env:COMPANION_CHARACTERS_RS
cargo run --locked -- ../../build/pieces
if ($LASTEXITCODE -ne 0) { throw "Grove Companion refused a character Studio made." }
- name: The agents' page gives the app's own connect commands
run: |
& $env:GODOT --headless --path . --script res://tests/site_commands.gd
Expand Down Expand Up @@ -269,6 +278,14 @@ jobs:
run: |
node tools/check_with_agent_guild.mjs build/pieces .agent-guild
if ($LASTEXITCODE -ne 0) { throw "Agent Guild refused a piece Studio made." }
- name: Every character the suites made passes Grove Companion's own check
working-directory: tools/companion_check
env:
COMPANION_CHARACTERS_RS: ${{ runner.temp }}/characters.rs
run: |
Invoke-WebRequest "https://raw.githubusercontent.com/oddessentials/agent-guild-companions/$env:COMPANIONS_COMMIT/src-tauri/src/characters.rs" -OutFile $env:COMPANION_CHARACTERS_RS
cargo run --locked -- ../../build/pieces
if ($LASTEXITCODE -ne 0) { throw "Grove Companion refused a character Studio made." }
- name: The agents' page gives the app's own connect commands
run: |
& $env:GODOT --headless --path . --script res://tests/site_commands.gd
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*.tmp
__pycache__/
node_modules/
/tools/companion_check/target/
4 changes: 4 additions & 0 deletions site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ Follow step 4 above.
## Mac update

Run Mac step 2 again with the same folder. The connection, the downloaded art and the person's pieces are kept. Then start a new session, so the Studio tools load again.

## Use a character in Agent Guild: Companions

A character Studio makes can also be the person's desktop spirit in Agent Guild: Companions. Follow its own steps at [oddessentials.github.io/agent-guild-companions](https://oddessentials.github.io/agent-guild-companions/), with the folder `list_pieces` gives for the character.
Empty file added tools/companion_check/.gdignore
Empty file.
249 changes: 249 additions & 0 deletions tools/companion_check/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tools/companion_check/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "companion_check"
version = "0.0.0"
edition = "2021"
publish = false

[dependencies]
serde_json = "=1.0.154"
uuid = { version = "=1.29.0", features = ["v4"] }
10 changes: 10 additions & 0 deletions tools/companion_check/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::{env, fs, path::PathBuf};

fn main() {
println!("cargo:rerun-if-env-changed=COMPANION_CHARACTERS_RS");
let source = env::var("COMPANION_CHARACTERS_RS").expect("Set COMPANION_CHARACTERS_RS to Grove Companion's src-tauri/src/characters.rs.");
println!("cargo:rerun-if-changed={source}");
let text = fs::read_to_string(&source).unwrap_or_else(|err| panic!("{source}: {err}"));
let items: String = text.lines().filter(|line| !line.starts_with("//!")).map(|line| format!("{line}\n")).collect();
fs::write(PathBuf::from(env::var("OUT_DIR").unwrap()).join("characters.rs"), items).unwrap();
}
3 changes: 3 additions & 0 deletions tools/companion_check/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.99.1"
profile = "minimal"
41 changes: 41 additions & 0 deletions tools/companion_check/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use std::{env, fs, path::PathBuf, process::ExitCode};

#[allow(dead_code)]
mod characters {
include!(concat!(env!("OUT_DIR"), "/characters.rs"));
}

fn kind(folder: &PathBuf) -> Option<String> {
let manifest: serde_json::Value = serde_json::from_slice(&fs::read(folder.join("piece.json")).ok()?).ok()?;
manifest.get("kind")?.as_str().map(str::to_string)
}

fn main() -> ExitCode {
let Some(pieces) = env::args().nth(1) else {
eprintln!("Usage: companion_check <folder of piece folders>");
return ExitCode::FAILURE;
};
let mut folders: Vec<PathBuf> = fs::read_dir(&pieces).expect("the pieces folder can't be read").flatten().map(|entry| entry.path()).filter(|path| path.is_dir()).collect();
folders.sort();
let scratch = env::temp_dir().join(format!("studio-companion-check-{}", characters::new_id()));
let (mut checked, mut refused) = (0, 0);
for folder in folders {
if kind(&folder).as_deref() != Some("character") {
continue;
}
checked += 1;
let name = folder.file_name().unwrap().to_string_lossy().into_owned();
let token = characters::new_id();
match characters::stage(&scratch, &folder, &token) {
Ok(title) => println!("ok {name} ({title})"),
Err(reason) => {
refused += 1;
println!("REFUSED {name}: {reason}");
}
}
characters::discard(&scratch, &token);
}
let _ = fs::remove_dir_all(&scratch);
println!("{} of {checked} characters pass Grove Companion's check", checked - refused);
if checked == 0 || refused > 0 { ExitCode::FAILURE } else { ExitCode::SUCCESS }
}
Loading