Skip to content
Draft
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ target/
# moon
.moon/cache
.moon/docker

# AI / agents
.claude/settings.local.json
.claude/worktrees
1 change: 1 addition & 0 deletions .moon/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ projects:
root: .
# Backends
asdf-backend: backends/asdf
scoop-backend: backends/scoop
# Extensions
download-extension: extensions/download
migrate-nx-extension: extensions/migrate-nx
Expand Down
17 changes: 17 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions backends/scoop/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## Unreleased

- Initial release.
31 changes: 31 additions & 0 deletions backends/scoop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "scoop_backend"
version = "0.1.0"
edition = "2024"

[package.metadata.release]
pre-release-replacements = [
{ file = "./CHANGELOG.md", search = "Unreleased", replace = "{{version}}" },
]

[lib]
crate-type = ["cdylib"]

[dependencies]
backend_common = { path = "../../crates/backend-common" }
extism-pdk = { workspace = true }
proto_pdk = { workspace = true }
rustc-hash = { workspace = true }
schematic = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
starbase_utils = { workspace = true }

[dev-dependencies]
proto_pdk_test_utils = { workspace = true }
starbase_sandbox = { workspace = true }
tokio = { workspace = true }

[features]
default = ["wasm"]
wasm = []
47 changes: 47 additions & 0 deletions backends/scoop/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use proto_pdk::*;

const DEFAULT_BUCKET: &str = "ScoopInstaller/Main";
const DEFAULT_BRANCH: &str = "master";

/// Configuration for the Scoop backend plugin.
/// https://github.com/ScoopInstaller/Scoop/wiki/App-Manifests
#[derive(Debug, Default, schematic::Schematic, serde::Deserialize, serde::Serialize)]
#[serde(default, deny_unknown_fields, rename_all = "kebab-case")]
pub struct ScoopToolConfig {
/// The GitHub repository for the scoop bucket. Defaults to "ScoopInstaller/Main".
pub bucket: Option<String>,

/// The branch of the bucket repository. Defaults to "master".
pub bucket_branch: Option<String>,

/// Override the manifest filename (without .json extension).
/// Defaults to the tool ID.
pub manifest_name: Option<String>,
}

impl ScoopToolConfig {
pub fn get_bucket(&self) -> &str {
self.bucket.as_deref().unwrap_or(DEFAULT_BUCKET)
}

pub fn get_branch(&self) -> &str {
self.bucket_branch.as_deref().unwrap_or(DEFAULT_BRANCH)
}

pub fn get_manifest_name(&self) -> AnyResult<String> {
match &self.manifest_name {
Some(name) => Ok(name.clone()),
None => Ok(get_plugin_id()?.to_string()),
}
}

pub fn get_manifest_url(&self) -> AnyResult<String> {
let bucket = self.get_bucket();
let branch = self.get_branch();
let name = self.get_manifest_name()?;

Ok(format!(
"https://raw.githubusercontent.com/{bucket}/refs/heads/{branch}/bucket/{name}.json"
))
}
}
8 changes: 8 additions & 0 deletions backends/scoop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pub mod config;
pub mod manifest;

#[cfg(feature = "wasm")]
mod proto;

#[cfg(feature = "wasm")]
pub use proto::*;
Loading
Loading