Files
photocraft/apps/photocraft-cli/tests/it/main.rs
David MannandClaude Opus 5.5 fd626999fc One switch for agents, in the ArtCraft Launcher; plain mcp works in the open app
As agreed in craft-ai-integrations#195: one switch for every Craft app, in
the launcher; only the launcher writes MCP client configurations; plain
`<app>-cli mcp` works in the open app.

- Consent: with the AI-MCP flag, the launcher's switch alone decides,
  read through `craft-ai-agents` (craft-ai-integrations#197), the crate the
  launcher writes the app list with and the gateway reads it with. The
  "Let AI agents connect" box is gone; without the flag everything is as on
  main (a saved Control Port keeps its connection).
- `photocraft-cli mcp`: works in the open window while agents may use it
  (what `--live` did), and headless otherwise, exactly as before (only the
  roots given to it; the app is never started). `--headless` forces that;
  `--bridge` / PHOTOCRAFT_CONTROL_PORT as before. `--live` and `mcp install`
  are gone. Several read roots work again, invalid roots stop the start, and
  `--gpu` applies to the headless session.
- Client setup is the launcher's: the client code (Claude Desktop, Claude
  Code, Cursor, JSON), Copy Configuration, its service and its docs are
  removed (about 740 lines net).
- CLI tests run with their own settings, launcher and flags folders: plain
  `mcp` would otherwise find (or start) the developer's own PhotoCraft.
- Docs, book, README, scorecard row, packaging comments follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 23:41:14 +01:00

32 lines
1.3 KiB
Rust

//! The crate's integration tests, linked into one test binary.
mod cli;
mod gpu;
#[cfg(all(target_os = "linux", target_env = "gnu"))]
mod malloc_tuning;
mod man_and_completions;
mod orientation;
mod psd_write_oracle;
/// Nextest archives relocate binaries; plain Cargo keeps the compile-time path valid.
fn binary() -> std::ffi::OsString {
std::env::var_os("NEXTEST_BIN_EXE_photocraft_cli").unwrap_or_else(|| env!("CARGO_BIN_EXE_photocraft-cli").into())
}
/// The CLI, kept away from this machine's own PhotoCraft settings, ArtCraft Launcher and feature
/// flags: plain `mcp` works in the open app when the launcher's switch lets agents use it, and
/// would otherwise find (or start) the developer's own PhotoCraft. A test that needs a settings
/// folder of its own sets `PHOTOCRAFT_CONFIG_DIR` again; the last value wins.
fn command() -> std::process::Command {
let base = std::env::temp_dir().join(format!("pc-cli-it-isolated-{}", std::process::id()));
let settings = base.join("settings");
let _ = std::fs::create_dir_all(&settings);
let mut cmd = std::process::Command::new(binary());
cmd.env("PHOTOCRAFT_CONFIG_DIR", &settings)
.env("CRAFT_MCP_DIR", base.join("launcher"))
.env("CRAFT_FLAGS_FILE", base.join("flags.toml"))
.env_remove("CRAFT_FLAGS");
cmd
}