Developer guide
Build Ossiframe, generate an app and write your own module. Layers and crates: architecture.md. Threat model: security.md. Gaps: known-limitations.md.
Status: Verified live (2026-11-25, one Ubuntu 24.04 server): generated read-only apps in standalone mode (record). The tutorial is Not verified against a server. Everything else is Implemented unless its section links another record.
Onboarding
Prerequisites
- Rust stable with
rustfmtandclippy(rust-toolchain.tomlselects them through rustup). - Node.js 24 and pnpm 11 (
packageManagerin the rootpackage.json). Install Rust with rustup. After installing Node, runcorepack enable. - Tauri 2 prerequisites: Xcode Command Line Tools on macOS, the official Tauri 2 page for other systems.
- git. The primary development platform is macOS Apple Silicon.
Clone, install, run
git clone https://github.com/shojibur/Ossiframe
cd Ossiframe
pnpm install
pnpm run doctor # Doctor in development mode
pnpm --filter @ossiframe/deploy tauri dev # Deploy in development modeThe first run takes several minutes. Connect only to servers you are authorized to access, and use disposable servers in development.
Required checks
CI runs the same checks.
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
pnpm typecheck
pnpm lint
pnpm build # production frontend builds
shellcheck tools/*.sh # when you change scriptsRelease bundles: tools/build-release.sh, see release.md.
Disk space
target/ often grows to 10 to 30 GB. tools/clean-build.sh deletes it but keeps built .app bundles; --all deletes everything. To test several generated apps, share one CARGO_TARGET_DIR=~/.cache/ossiframe-target and delete it when done.
Module catalog
Checked against cargo run -q -p ossiframe-cli -- list --json. Unless stated otherwise, operations take no arguments (pass null) and run as the SSH user, without sudo, through the ReadOnly executor. "Commands" are Tauri commands in the app's handler, build manifest and capability file.
| Module | Depends on | Operations | Commands | UI | Opt-in flag |
|---|---|---|---|---|---|
linux-inventory | none | Eight: server-info, services, listening-sockets, software, service-status, service-logs, nginx-error-log, http-check | 0 | Inventory page | none |
linux-audit | linux-inventory | Eight scan steps, in order: resources, services, network, software, ssh, firewall, updates, certificates | 2: audit_build_report, audit_save_report (save dialog opened by Rust) | Combined Overview (replaces the inventory page, keeps id linux-inventory), Diagnostics, Security, Network, Services, Software, Reports | none |
linux-monitoring | none | sample, processes | 0 | Monitoring page | none |
linux-logs | linux-inventory | journal, file | 1: logs_save | Logs page | none |
ai-assistant | linux-inventory | none | 10 ai_* | Assistant page and buttons | none (bring your own key) |
ubuntu-provisioning | linux-inventory | none. Runs root commands through sudo -n in approved plans | 10 provision_* (from ossiframe-desktop) | Provisioning pages | --enable-provisioning |
app-deploy | ubuntu-provisioning | none. Creates, deploys, rolls back and removes applications through approved plans | 14 app_* (feature tauri) | Applications page | --enable-app-deploy and --enable-provisioning |
ssh-terminal | none | none | 6 terminal_* | Terminal page | --enable-terminal |
ssh-filesystem | none | none | 8 read files_*, plus 5 write files_* with --enable-file-write | Files page | --enable-files |
ssh-tunnel | none | none | 6 tunnel_* | Tunnels page | --enable-tunnels |
ports (example) | none | listening-tcp | 0 | Ports page | none. Added with --with-example-module |
Dependencies are added automatically. Presets never add opt-in modules. ssh-terminal, ssh-filesystem and ssh-tunnel are never part of Doctor. Verification status: compatibility.md, known-limitations.md.
CLI reference
Run the generator, tools/ossiframe-cli, from a checkout with cargo run -p ossiframe-cli -- <command> (no standalone binary yet). Invalid input stops with a one-line error and writes nothing. Help blocks are the output of <command> --help.
new
Generate a new Ossiframe app in <DIR> (absent or empty directory)
Usage: ossiframe-cli new [OPTIONS] [DIR]
Arguments:
[DIR] Target directory. Must be absent or empty
Options:
--name <NAME> Product name, for example "Acme Ops"
--identifier <IDENTIFIER> Reverse-DNS app identifier, for example dev.example.acme
--preset <PRESET> A module preset (see `list`). It never enables an opt-in flag
--modules <MODULES> Optional modules to include (comma separated), added to the preset
--with-example-module Include the example `ports` module as a local module crate
--rev <REV> Ossiframe commit to pin (40-hex). Defaults to the local HEAD
--ossiframe-local <PATH> Use plain `path` dependencies on a local Ossiframe checkout (testing only)
--enable-provisioning Allow modules that run commands as root on servers (`ubuntu-provisioning`)
--enable-terminal Allow modules that open an interactive shell on servers (`ssh-terminal`)
--enable-files Allow modules that browse and transfer files over SFTP (`ssh-filesystem`)
--enable-tunnels Allow modules that forward local TCP ports over SSH (`ssh-tunnel`)
--enable-file-write Also generate the file write commands (upload, new folder, rename, delete). Needs --enable-files
--enable-app-deploy Allow the application deployment module (`app-deploy`). Needs --enable-provisioning too
--allow-ossiframe-namespace Allow identifiers under dev.ossiframe.*
--interactive Ask for every input in the terminal
--dry-run Show what would be generated; write nothing
-h, --help Print helpThe name is 1 to 64 characters, starts with a letter and uses A-Z a-z 0-9 space _ -. The identifier is reverse-DNS with lowercase segments. Each opt-in flag is valid only with its module, and the module is refused without its flag. With --interactive, each opt-in needs a typed yes, and the CLI asks for confirmation before writing.
list
List the modules and presets
Usage: ossiframe-cli list [OPTIONS]
Options:
--json Print JSON instead of text
-h, --help Print helpadd
Add catalog modules to a generated project
Usage: ossiframe-cli add [OPTIONS] <PROJECT> <MODULES>...
Arguments:
<PROJECT> The generated project (the folder with ossiframe.json)
<MODULES>... Module ids
Options:
--enable-provisioning Allow modules that run commands as root on servers (`ubuntu-provisioning`)
--enable-terminal Allow modules that open an interactive shell on servers (`ssh-terminal`)
--enable-files Allow modules that browse and transfer files over SFTP (`ssh-filesystem`)
--enable-tunnels Allow modules that forward local TCP ports over SSH (`ssh-tunnel`)
--enable-file-write Also generate the file write commands (upload, new folder, rename, delete). Needs --enable-files
--enable-app-deploy Allow the application deployment module (`app-deploy`). Needs --enable-provisioning too
--accept-merged <PATH> A managed file you merged by hand after a conflict (repeatable)
--dry-run Show what would change; write nothing
-h, --help Print helpDependencies are resolved again, and opt-in modules need their flag, as in new.
remove
Remove modules from a generated project (local modules are only unregistered)
Usage: ossiframe-cli remove [OPTIONS] <PROJECT> <MODULES>...
Arguments:
<PROJECT> The generated project (the folder with ossiframe.json)
<MODULES>... Module ids
Options:
--enable-provisioning Allow modules that run commands as root on servers (`ubuntu-provisioning`)
--enable-terminal Allow modules that open an interactive shell on servers (`ssh-terminal`)
--enable-files Allow modules that browse and transfer files over SFTP (`ssh-filesystem`)
--enable-tunnels Allow modules that forward local TCP ports over SSH (`ssh-tunnel`)
--enable-file-write Also generate the file write commands (upload, new folder, rename, delete). Needs --enable-files
--enable-app-deploy Allow the application deployment module (`app-deploy`). Needs --enable-provisioning too
--accept-merged <PATH> A managed file you merged by hand after a conflict (repeatable)
--dry-run Show what would change; write nothing
-h, --help Print helpremove refuses a module another module needs, and clears an opt-in no remaining module needs.
new-module
Create a local module in a generated project and register it
Usage: ossiframe-cli new-module [OPTIONS] --id <ID> <PROJECT>
Arguments:
<PROJECT>
Options:
--id <ID> Module id, for example acme-disk
--name <NAME> Display name. Defaults to the id
--dry-run Show what would change; write nothing
-h, --help Print helpSee the tutorial.
recover
Finish or discard an interrupted add, remove or new-module
Usage: ossiframe-cli recover [OPTIONS] <PROJECT>
Arguments:
<PROJECT>
Options:
--release-lock Remove a leftover lock. Only when no ossiframe-cli runs on this project
-h, --help Print helpPresets
The default is minimal; --modules adds to a preset.
| Preset | Modules |
|---|---|
minimal | none |
monitor | linux-monitoring |
observe | linux-inventory, linux-monitoring, linux-logs |
audit | observe plus linux-audit |
connect | ssh-terminal, ssh-filesystem, ssh-tunnel |
operator | observe plus connect |
Presets never enable opt-in flags: connect and operator still need --enable-terminal, --enable-files and --enable-tunnels.
The project record
new writes ossiframe.json at the project root: inputs only, no secrets. add, remove and new-module read it.
| Field | Meaning |
|---|---|
schema | 2 for new records (adds optIns.appDeploy). Schema 1 is still read |
generator | CLI version that wrote it |
name, identifier | The product inputs |
source | { "kind": "git", "rev": "<40-hex>" } or { "kind": "local", "path": "<checkout>" } |
modules | Selected catalog modules |
exampleModule | ports example registered |
localModules | Local modules (id, crate, type, ui) |
optIns | provisioning, terminal, files, fileWrite, tunnels, appDeploy (schema 2, omitted when false) |
managed | SHA-256 of each managed file and module folder as last written or accepted (folders end with /) |
The CLI refuses projects without ossiframe.json. Every path it touches must stay inside the project with no symlink component.
Managed files
Managed files: package.json, src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/build.rs, src-tauri/capabilities/main.json, src/App.tsx, src/modules.ts, OSSIFRAME-LICENSE and the copied src/modules/<catalog module>/ folders. A change touches only files whose generated output differs.
Conflicts
If you changed a managed file that the update also changes, the CLI writes a proposal <file>.ossiframe-new and never overwrites an existing one. To resolve it:
- Merge the proposal into the file by hand.
- Delete the
.ossiframe-newfile. - Rerun the command with
--accept-merged <file>for each merged file.
A merge of a security file (src-tauri/Cargo.toml, src-tauri/src/lib.rs, src-tauri/build.rs, src-tauri/capabilities/main.json) is accepted only if its declarations equal the proposal's:
- the full capability structure (identifier, windows, webviews, local and remote access, platforms, permissions; only
descriptionis ignored); - the build command list;
- the handler commands, module registrations and plugins;
- the Ossiframe and plugin dependencies.
Otherwise the CLI lists what is missing and extra and changes nothing. A changed copied module folder cannot be merged: restore it from version control.
Staging, lock and recovery
- Each change takes an exclusive
.ossiframe.lock, stages in.ossiframe-staging/with a journal, applies, and writesossiframe.jsonlast. - After an interruption,
recover <project>finishes the run if staging is complete, otherwise discards it. For a stale lock with no CLI running, userecover <project> --release-lock. - Each staged step records the destination's original and intended hashes and checks them when applying.
- If you changed a destination after staging, the step refuses to overwrite or remove it. Move your change aside and run
recoveragain, or delete.ossiframe-staging/and rerun.
Pinned checkout
A Git-pinned project needs a clean checkout at the pinned commit. A local-mode project must point at the checkout you run the CLI from. Changing the pin is not supported.
Local modules and dry runs
The CLI never rewrites local modules (from new-module) or the copied ports example, and remove keeps their source. --dry-run shows the files that would change and writes nothing.
Custom module tutorial
Build acme-disk, a module with one read-only operation that reports root filesystem use. You need the prerequisites and a checkout ($OSSIFRAME).
1. Generate an app
cd $OSSIFRAME
cargo run -q -p ossiframe-cli -- new /tmp/acme --name "Acme Ops" \
--identifier dev.example.acme --preset observe --ossiframe-local $OSSIFRAME--ossiframe-local is for development only (see Local mode and standalone mode).
2. Create the module
cargo run -q --manifest-path $OSSIFRAME/Cargo.toml -p ossiframe-cli -- \
new-module /tmp/acme --id acme-disk --name "Acme Disk"The CLI writes and registers:
| Path in the app | Content |
|---|---|
modules/acme-disk/Cargo.toml, modules/acme-disk/src/lib.rs | The Rust module with one operation, uptime (runs uptime -p) |
src/modules/acme-disk/index.ts, src/modules/acme-disk/AcmeDiskPage.tsx | The page |
src-tauri/Cargo.toml, src-tauri/src/lib.rs, src/modules.ts | Dependency, .register(acme_disk::AcmeDisk) and the UI import |
ossiframe.json | The localModules entry |
3. Change the operation
Edit modules/acme-disk/src/lib.rs:
- Rename the operation to
root-usageinOPERATIONSand in the check at the top ofrun. - Run a fixed command:
CommandSpec::new("df", &["-P", "/"], TIMEOUT). No user text reaches a shell. - Reject arguments:
if !args.is_null() { return Err(OperationError::InvalidArguments(...)) }, and rename_argstoargs. - Parse the second line of
df -P /(Filesystem 1024-blocks Used Available Capacity Mounted on) into a struct (size_kib,used_kib,use_percent), and return an error for output you cannot parse. - Add unit tests for a valid line and malformed lines.
4. Adjust the page
In src/modules/acme-disk/AcmeDiskPage.tsx, change the result interface to { observedAt, sizeKib, usedKib, usePercent }, call api.runOperation<RootUsage>(serverId, "acme-disk", "root-usage", null) and show the values as text in the KeyValue rows. The id in index.ts stays acme-disk.
5. Check it
cd /tmp/acme
pnpm install
pnpm exec tsc --noEmit
pnpm exec vite build
(cd src-tauri && cargo check && cargo test)
(cd modules/acme-disk && cargo test && cargo clippy -- -D warnings && cargo fmt)Observed: all steps passed, including the module's 3 tests. The module crate is its own Cargo workspace, so run its checks inside modules/acme-disk/. Apps sharing one CARGO_TARGET_DIR wait on its lock, so run steps one at a time.
The tutorial did not run the app against a server. Before calling the module done, run pnpm tauri dev, connect to a disposable server and open the page.
6. Remove the module
cargo run -q --manifest-path $OSSIFRAME/Cargo.toml -p ossiframe-cli -- remove /tmp/acme acme-diskThe CLI unregisters the module (dependency, registration, UI import) and keeps modules/acme-disk/ and src/modules/acme-disk/. Delete them to remove the module for good.
Module UI contract
src/modules/<id>/index.ts exports the items below; src/modules.ts imports each folder. Types: packages/ui/src/module-ui.ts.
| Export | Meaning |
|---|---|
moduleUi: ModuleUi | One page. Or |
moduleUis: ModuleUi[] | Several pages |
hooks | Optional { onStale, onConnected, onRemoved }, each called with a server id |
replaces: string[] | Page ids this module's pages replace. linux-audit replaces linux-inventory, and its Overview keeps that id |
ModuleUi fields:
| Field | Meaning |
|---|---|
id | The Rust module id, or <id>/<page> for several pages |
title | Page title |
Page | Component receiving { serverId, connected } |
group | Sidebar group heading. Pages without one are listed at the top level |
section | Pages sharing a section become one sidebar entry with tabs |
icon | A lucide-react icon for the entry |
offline | Page works without a connection (shows saved data) and renders while disconnected |
- Duplicate page ids throw
Duplicate module page id "<id>". - Render remote output as text.
AssistButton(@ossiframe/ui) renders nothing unless the app wraps its UI in theai-assistantprovider.
Core contract reference
Source: crates/ossiframe-core/src.
| Item | Contract |
|---|---|
Module (trait) | manifest() -> ModuleManifest, operations() -> &'static [OperationInfo], async run(operation, args, ctx) -> Result<serde_json::Value, OperationError>. run is called only with an id listed in operations(). The module validates args itself |
ModuleManifest | id: ModuleId, name, version, description, dependencies: Vec<ModuleId>. Metadata, not a sandbox |
OperationInfo | id: &'static str, description: &'static str |
OperationContext | exec: &dyn Executor, cancel: &CancelToken, observed_at (RFC 3339, set by the dispatcher). An operation reaches a server only through this |
CommandSpec | Program, arguments, timeout, Privilege and optional stdin. Built with CommandSpec::new(program, &[args], timeout) (user), privileged (root, absolute program path) or run_as (another user, absolute path). Every word is quoted; there is no shell syntax. Stdin is at most 1 MiB (MAX_STDIN_BYTES), never serialized and never in Debug output |
Privilege | User (the SSH login user), Root (sudo -n), RunAs(LinuxUserName) (sudo -n -u <user>, never root) |
Executor (trait) | async run(&CommandSpec, &CancelToken) -> Result<ExecResult, ExecError>. ExecResult has exit, stdout, stderr, truncated |
ReadOnly | Wrapper that refuses Root and RunAs with ExecError::PrivilegeDenied. It guards only code handed the wrapper, does not stop a user-level command from changing state, and is not a sandbox |
Registry | Registry::builder().register(module)....build(). Refuses duplicate ids, missing dependencies, dependency cycles and duplicate operations. run dispatches only to a listed operation of a registered module |
OperationError | InvalidArguments(String), Exec(ExecError) (converted with ?), Failed(String) (a short, redacted message, never raw command output) |
An ExecError other than PrivilegeDenied means the outcome is unknown. Never retry automatically.
Local mode and standalone mode
The generated src-tauri/Cargo.toml gets Ossiframe from one of two sources.
- Standalone (default). Git dependencies on one exact commit of
https://github.com/shojibur/Ossiframe:--rev, orHEADof the checkout (refused with uncommitted changes). The generator does no network access, so push the commit first orcargo buildfails. Verified to build, connect and show inventory on a real server (record). - Local (
--ossiframe-local <path>).pathdependencies into your checkout, for local testing only. Switch to a publishedrevbefore sharing the app. A working local build does not show that the standalone build works.
An explicit --rev must match the generator, frontend packages and template: the generator copies @ossiframe/ui, @ossiframe/client (not on npm) and the template from your checkout, while the Rust crates come from the pinned commit.
Opt-in modules in generated apps
The generator needs the matching flag and refuses a flag without its module. Presets never imply a flag, and Doctor includes none of these modules. Guarantees: security.md. Wiring:
- Provisioning (
--enable-provisioning): enables theprovisioningfeature ofossiframe-desktop, registers the module, callsprovisioning::setupand lists the tenprovision_*commands. Without it,run_operationrejectsPrivilege::RootandPrivilege::RunAs. - App deployment (
--enable-app-deploywith--enable-provisioning): registers theapp_*commands behind the module'staurifeature and the provisioning engine with the application-aware provisioner, so an app has one engine and one activity registry. App code, Composer and Artisan run as the app's Linux user throughPrivilege::RunAs. - Terminal (
--enable-terminal): enables the module'staurifeature and theterminaltransport, and callsossiframe_mod_ssh_terminal::commands::setupaftertauri_support::setup. ADR-0008. - Files (
--enable-files): the eight read commands.--enable-file-write(requires--enable-files) adds the five write commands and thewritefeature. ADR-0009. - Tunnels (
--enable-tunnels):ossiframe_desktop::tunnels::Tunnels(featuretunnels) works without the module's UI. ADR-0010. - AI assistant (
ai-assistant, no flag): the app passes an explicitVec<ToolSpec>toossiframe_mod_ai_assistant::commands::setup(app, tools)aftertauri_support::setup. EachToolSpecnames a registered(module, operation)pair, marks it sensitive or not and carries an argument schema. Therecordsfeature, which lets "Diagnose failure" read operation records, is enabled only with--enable-provisioning. Data sent to the provider: security.md.
Commands per module: the module catalog. Verification status: known-limitations.md.
Continuous integration
.github/workflows/ci.yml runs on every pull request, every push to main and when the release workflow calls it. A push that changes only docs/, root *.md, .kiro/specs/ or LICENSE skips it. Markdown under templates/ still triggers it.
checks(macOS Apple Silicon):tools/check-version.sh, the required checks,cargo checkof Doctor and Deploy separately,tools/check-kiro-config.sh,tools/check-recipes.sh(recipes against the generator, both modes) and the Doctor guards.- Doctor guards:
tools/check-doctor-boundary.shfails if Doctor depends on a mutating, terminal, SFTP or tunnel module, or enables theterminal,sftp,files,forwardortunnelsfeatures. audit(Linux):cargo audit --deny warnings(exceptions in.cargo/audit.toml) andpnpm audit --prod.shellcheck: every tracked*.shfile.generated-projects(pushes only): generates four standalone apps pinned to the pushed commit (readonly,provision,assistant,tools), checks that each exposes only its expected commands, then runscargo check,pnpm install,pnpm typecheckandpnpm buildin each.
.github/workflows/windows.yml is a Windows x64 build check on code-changing pushes to main and on demand. It publishes nothing; a manual run keeps the unsigned .exe files for 7 days. Windows is not supported (known-limitations.md).
.github/workflows/docs.yml deploys this site to GitHub Pages at https://shojibur.github.io/Ossiframe/ on pushes to main that change docs/, and on demand.
Documentation site
The Markdown in docs/ is the only source. Topic pages include guide sections through #region comments. Links to files outside docs/ point to GitHub.
pnpm docs:dev # local site with live reload
pnpm docs:build # production build in docs/.vitepress/dist; fails on dead links
pnpm docs:preview # serve the production buildMove a region marker together with its heading.
Read more
architecture.md, security.md, roadmap.md, and templates/starter/README.md (the README of a generated app).
