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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ jobs:
- name: Check formatting
run: cargo fmt --all --check

msrv:
name: MSRV (Rust 1.80)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: Verify compilation on Rust 1.80 MSRV
run: cargo check --locked --workspace

deny:
name: Cargo Deny
runs-on: ubuntu-latest
Expand Down
43 changes: 21 additions & 22 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "starforge"
version = "0.1.0"
edition = "2021"
rust-version = "1.80"
description = "A developer productivity CLI for Stellar and Soroban workflows"
license = "MIT"
repository = "https://github.com/YOUR_USERNAME/starforge"
Expand Down Expand Up @@ -50,6 +51,7 @@ colored = "=2.1.0"
comfy-table = "7.1.1"
dirs = "=5.0.1"
anyhow = "1.0"
thiserror = "1.0"
chrono = { version = "0.4", features = ["serde"] }
rand = "0.8"
ed25519-dalek = ">=2.1.1, <3"
Expand Down
1 change: 1 addition & 0 deletions crates/starforge-plugin-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "starforge-plugin-sdk"
version = "0.1.0"
edition = "2021"
rust-version = "1.80"
description = "SDK for building StarForge CLI plugins"
license = "MIT"

Expand Down
1 change: 1 addition & 0 deletions crates/starforge-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "starforge-wasm"
version = "0.1.0"
edition = "2021"
rust-version = "1.80"
description = "WebAssembly API surface for StarForge — browser-based Stellar wallet management"
license = "MIT"
repository = "https://github.com/YOUR_USERNAME/starforge"
Expand Down
44 changes: 44 additions & 0 deletions src/plugins/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ pub struct InstalledPlugin {
/// Plugin version from manifest.
#[serde(default)]
pub plugin_version: String,
/// Optional description from manifest.
#[serde(default)]
pub description: String,
/// RFC3339 timestamp of when the plugin was installed.
#[serde(default)]
pub installed_at: Option<String>,
Expand Down Expand Up @@ -258,6 +261,46 @@ pub fn plugin_list_entries(reg: &PluginRegistry) -> Vec<InstalledPlugin> {
.collect()
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PluginListEntry {
pub name: String,
pub path: String,
pub source: String,
pub trust: String,
pub starforge_version: String,
pub plugin_version: String,
pub description: String,
pub installed_at: Option<String>,
pub commands: Vec<RegisteredCommand>,
}

pub fn resolve_plugin_description(plugin: &InstalledPlugin) -> String {
if !plugin.description.is_empty() {
plugin.description.clone()
} else if let Some(cmd) = plugin.commands.first() {
cmd.description.clone()
} else {
String::new()
}
}

pub fn plugin_list_entries(reg: &PluginRegistry) -> Vec<PluginListEntry> {
reg.plugins
.iter()
.map(|p| PluginListEntry {
name: p.name.clone(),
path: p.path.clone(),
source: p.source.clone(),
trust: p.trust.label().to_string(),
starforge_version: p.starforge_version.clone(),
plugin_version: p.plugin_version.clone(),
description: resolve_plugin_description(p),
installed_at: p.installed_at.clone(),
commands: p.commands.clone(),
})
.collect()
}

fn registry_path() -> Result<PathBuf> {
let home = dirs::home_dir().ok_or_else(|| anyhow::anyhow!("Could not find home directory"))?;
let dir = home.join(".starforge").join("plugins");
Expand Down Expand Up @@ -354,6 +397,7 @@ pub fn install_plugin(
trust,
starforge_version: starforge_version.to_string(),
plugin_version: plugin_version.to_string(),
description: String::new(),
installed_at: Some(now),
commands,
description: description.to_string(),
Expand Down
34 changes: 34 additions & 0 deletions src/utils/ai_test_assistant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,40 @@ fn extract_external_calls(source: &str) -> Vec<String> {
calls
}

pub fn generate_edge_case_descriptions(func: &FunctionInfo) -> Vec<String> {
let mut cases = vec![
"Zero address / null argument".to_string(),
"Maximum value boundary".to_string(),
"Minimum value boundary".to_string(),
"Unauthorized caller".to_string(),
"Empty collection / zero length".to_string(),
"Reentrancy / repeated invocation".to_string(),
];
for param in &func.params {
cases.push(format!("Boundary case for parameter {}", param.name));
}
cases
}

pub fn generate_security_checks(func: &FunctionInfo) -> Vec<String> {
let mut checks = vec![
"Authorization verification".to_string(),
"Overflow / underflow guard".to_string(),
];
if func.is_mutating {
checks.push("State mutation access control".to_string());
}
checks
}

pub fn generate_warnings(analysis: &ContractAnalysis) -> Vec<String> {
let mut warnings = Vec::new();
if analysis.public_functions > 5 || analysis.complex_functions > 10 {
warnings.push("High complexity detected in contract functions".to_string());
}
warnings
}

pub fn generate_test_priorities(analysis: &ContractAnalysis) -> Vec<TestPrioritySuggestion> {
let mut suggestions = Vec::new();

Expand Down
20 changes: 1 addition & 19 deletions src/utils/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,7 @@ pub fn generate_bindings(wasm_path: &Path, language: BindingLanguage) -> Result<
generate_from_metadata(&metadata, language)
}

/// Generate binding code from pre-built metadata for a given language.
///
/// This is useful for testing generators directly without needing a WASM file.
pub fn generate_from_metadata(
metadata: &ContractMetadata,
language: BindingLanguage,
) -> Result<String> {
if metadata.functions.is_empty() {
anyhow::bail!("No contract functions found in metadata");
}
match language {
BindingLanguage::Rust => Ok(generate_rust(metadata)),
BindingLanguage::TypeScript => Ok(generate_typescript(metadata)),
BindingLanguage::Python => Ok(generate_python(metadata)),
BindingLanguage::Go => Ok(generate_go(metadata)),
}
}

fn read_spec_entries(wasm: &[u8]) -> Result<Vec<ScSpecEntry>> {
pub fn read_spec_entries(wasm: &[u8]) -> Result<Vec<ScSpecEntry>> {
let spec = contract_spec_section(wasm)?;
let cursor = Cursor::new(spec);
let entries = ScSpecEntry::read_xdr_iter(&mut Limited::new(
Expand Down
Loading