Skip to main content

Crate surjection_core

Crate surjection_core 

Source
Expand description

Core library of Surjection.

This crate never reads process-global state (std::env, home directory lookups, the system clock) outside [env]. Callers inject an Env and an Fs; the CLI and the app build them from the process, tests build them from a temp root.

Re-exports§

pub use env::Clock;
pub use env::Env;
pub use env::EnvBuilder;
pub use env::FixedClock;
pub use env::KnownFolder;
pub use env::Os;
pub use env::SystemClock;
pub use error::CoreError;
pub use error::ErrorCode;
pub use fs::Fs;
pub use fs::RealFs;

Modules§

access
Write access to client files and folders (SPEC 8.2 read_only_target, #4): a folder managed by a separate installer can hold client files this account may read but not write. Surjection shows them, never plans a write into them, and reports a write the OS refuses as read_only_target instead of a failure.
adapters
Client adapters (SPEC 7): a declarative table of clients, each with detection probes, MCP target locations, capabilities and an entry mapper.
address_check
“Check this address” (#47): what a remote MCP server asks of a client before it answers, found without credentials, following the MCP authorization specification (revision 2026-07-28, https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization):
agent
The Surjection skill for agents (#8, SPEC 12.6): a read-only skill that teaches coding agents Surjection’s read and plan commands. It ships inside this crate (so the CLI works on its own) and as a resource of the app, and is installed as a normal store skill: id SKILL_ID, marked by its [bundled] table, enabled per client through the normal skill sync, so it is versioned, reversible and visible like any other skill.
apply
Apply engine (SPEC 8): reconcile client files with the store’s desired state through a plan, own exactly what was written (the ledger), commit every run to the store, and roll a run back.
brand
Single source of brand strings (SPEC Appendix C). A rename touches this module, the crate names and the docs, nothing else.
catalog
Catalogs (#26): places that list MCP servers and skills, searched and browsed on the user’s request, installed through the paths that exist.
diagnostics
The log file and the diagnostic report (SPEC 4.5, M55). Both stay on this computer and are redacted: no secret or environment values, no file contents, folders only as ~ or <SURJECTION_HOME>.
eject
Stop managing (M57, SPEC 8.10, surject eject): hand everything Surjection owns on this machine back to the clients, so they keep working with Surjection uninstalled.
env
Process environment facade: OS, known folders, environment variables, host name and clock. The core reads these only through Env; the CLI and the app build one from the process, tests build one from a temp root.
error
Typed core errors. The CLI and the GUI localize from ErrorCode; the message is English diagnostic detail, never state.
formats
Format-preserving editors for native client files (SPEC 7.2).
fs
File system facade. Core code takes &dyn Fs so tests can confine every access to a temp root (surjection_testkit::RootedFs).
layering
Project scope (SPEC 6): the project layer of a folder over the system layer of the store.
local_settings
state/local-settings.toml (SPEC 4.5): this machine’s own settings, never synced. Only the keys this build reads are typed; every other key is kept as it is when the file is written.
mcp_source
MCP servers from a Git repository or a local folder (#5).
migrate
Migration from SkillDock (SPEC 15.1): ~/.skilldock into the store.
model
Store file schemas (SPEC 5).
paths
SURJECTION_HOME resolution, data layout and sync-root detection (SPEC 4.5).
process
Starting other programs from the app without a console window (#41).
remote
Remotes (SPEC 9.6 to 9.9): optional backup and sync targets for the store. None exists by default and none is privileged.
scan
The built-in offline scanner (SPEC 17, #25): Surjection’s own rules, shipped as data (rules.toml), run locally on every skill install and update and on every MCP server drafted from a Git repository or folder. Nothing leaves the machine.
secrets
Secrets (SPEC 11): references, providers and the leak scanner.
server_input
What a pasted or typed server is (#47, the Add dialog and surject server add <URL> / -- <COMMAND...>): an address, a config snippet, a command line, a repository or a folder; the transport an address suggests; the clients a new server is enabled for by default; and the entries client files already hold for the same address or command (the dialog offers Import instead).
skills
Skills (SPEC 12): the store copy of each skill (store/skills/<id>/ plus store/skill-meta/<id>.toml), installs from git or local sources, links and copies in client skill directories (table 7.6), the classification of those directories, and the read-only scan of the agents CLI’s ~/.agents/skills.
sources
Source trust (#24, SPEC 17): installing or updating from a source the user has not trusted asks first, a block wins over any trust, and a repository that was force-pushed, renamed or transferred makes its trust lapse so the user is asked again.
store
The versioned store <SURJECTION_HOME>/store (SPEC 9.1): a normal git repository on branch main, readable by any git client.
versions
Schema versions of the data folder (SPEC 5.0): which files carry a schema number, refusing a data folder a newer Surjection wrote, and migrating files an older Surjection wrote.