Skip to content

Commit 13bcacc

Browse files
authored
Merge pull request #272 from voidcooks/fix/snapshot-macos
fix snapshots, add macOS docker support
2 parents 7d9127a + 3223831 commit 13bcacc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+4674
-1668
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,28 @@ Traditional Chat OSVM AI Chat (NEW!)
4646

4747
### Installation (5 Minutes)
4848

49+
**Linux:**
4950
```bash
50-
# Clone the repository
51+
# Clone and build
5152
git clone https://github.com/opensvm/osvm-cli.git
5253
cd osvm-cli
53-
54-
# Build and install
5554
cargo build --release
5655
sudo cp target/release/osvm /usr/bin/osvm
5756

58-
# Verify installation
59-
osvm --version # Should show 0.9.3
57+
# Verify
58+
osvm --version
59+
```
60+
61+
**macOS (via Docker):**
62+
```bash
63+
# Clone and run via Docker
64+
git clone https://github.com/opensvm/osvm-cli.git
65+
cd osvm-cli
66+
./scripts/docker-run-macos.sh --version
67+
68+
# Use any command
69+
./scripts/docker-run-macos.sh snapshot --help
70+
./scripts/docker-run-macos.sh ovsm eval '(+ 1 2 3)'
6071
```
6172

6273
### 🆕 Try the AI-Powered Chat (NEW!)

crates/ovsm/src/runtime/lisp_evaluator.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,8 +3165,8 @@ impl LispEvaluator {
31653165
};
31663166

31673167
// Parse JSON string into serde_json::Value
3168-
let json_value: serde_json::Value = serde_json::from_str(&json_str)
3169-
.map_err(|e| Error::ToolExecutionError {
3168+
let json_value: serde_json::Value =
3169+
serde_json::from_str(&json_str).map_err(|e| Error::ToolExecutionError {
31703170
tool: "json-parse".to_string(),
31713171
reason: format!("Failed to parse JSON: {}", e),
31723172
})?;
@@ -3240,9 +3240,9 @@ impl LispEvaluator {
32403240
}
32413241
}
32423242
JV::String(s) => Value::String(s),
3243-
JV::Array(arr) => {
3244-
Value::Array(Arc::new(arr.into_iter().map(|v| self.json_to_value(v)).collect()))
3245-
}
3243+
JV::Array(arr) => Value::Array(Arc::new(
3244+
arr.into_iter().map(|v| self.json_to_value(v)).collect(),
3245+
)),
32463246
JV::Object(map) => {
32473247
let mut obj = HashMap::new();
32483248
for (k, v) in map {
@@ -3260,11 +3260,9 @@ impl LispEvaluator {
32603260
Value::Null => JV::Null,
32613261
Value::Bool(b) => JV::Bool(b),
32623262
Value::Int(i) => JV::Number(serde_json::Number::from(i)),
3263-
Value::Float(f) => {
3264-
serde_json::Number::from_f64(f)
3265-
.map(JV::Number)
3266-
.unwrap_or(JV::Null)
3267-
}
3263+
Value::Float(f) => serde_json::Number::from_f64(f)
3264+
.map(JV::Number)
3265+
.unwrap_or(JV::Null),
32683266
Value::String(s) => JV::String(s.to_string()),
32693267
Value::Array(arr) => {
32703268
let mut json_arr = Vec::new();
@@ -3896,7 +3894,8 @@ impl LispEvaluator {
38963894
for (key, values) in groups_obj.iter() {
38973895
// Create scope for aggregation function
38983896
self.env.enter_scope();
3899-
self.env.define(params[0].clone(), Value::String(key.clone()));
3897+
self.env
3898+
.define(params[0].clone(), Value::String(key.clone()));
39003899
self.env.define(params[1].clone(), values.clone());
39013900

39023901
// Evaluate aggregation function
@@ -3921,7 +3920,8 @@ impl LispEvaluator {
39213920
if args.len() < 2 || args.len() > 3 {
39223921
return Err(Error::InvalidArguments {
39233922
tool: "sort-by".to_string(),
3924-
reason: "Expected 2-3 arguments: collection, key-fn, and optional :desc flag".to_string(),
3923+
reason: "Expected 2-3 arguments: collection, key-fn, and optional :desc flag"
3924+
.to_string(),
39253925
});
39263926
}
39273927

@@ -3949,7 +3949,10 @@ impl LispEvaluator {
39493949
if params.len() != 1 {
39503950
return Err(Error::InvalidArguments {
39513951
tool: "sort-by".to_string(),
3952-
reason: format!("Key function must take exactly 1 parameter, got {}", params.len()),
3952+
reason: format!(
3953+
"Key function must take exactly 1 parameter, got {}",
3954+
params.len()
3955+
),
39533956
});
39543957
}
39553958

crates/ovsm/src/tools/stdlib/advanced_math.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,7 @@ impl Tool for AshTool {
993993
let n = args[0].as_int()?;
994994
let count = args[1].as_int()?;
995995

996-
let result = if count >= 0 {
997-
n << count
998-
} else {
999-
n >> -count
1000-
};
996+
let result = if count >= 0 { n << count } else { n >> -count };
1001997

1002998
Ok(Value::Int(result))
1003999
}
@@ -1062,11 +1058,23 @@ impl Tool for SignumTool {
10621058

10631059
match &args[0] {
10641060
Value::Int(n) => {
1065-
let sign = if *n < 0 { -1 } else if *n > 0 { 1 } else { 0 };
1061+
let sign = if *n < 0 {
1062+
-1
1063+
} else if *n > 0 {
1064+
1
1065+
} else {
1066+
0
1067+
};
10661068
Ok(Value::Int(sign))
10671069
}
10681070
Value::Float(f) => {
1069-
let sign = if *f < 0.0 { -1.0 } else if *f > 0.0 { 1.0 } else { 0.0 };
1071+
let sign = if *f < 0.0 {
1072+
-1.0
1073+
} else if *f > 0.0 {
1074+
1.0
1075+
} else {
1076+
0.0
1077+
};
10701078
Ok(Value::Float(sign))
10711079
}
10721080
_ => Err(Error::TypeError {

crates/ovsm/src/tools/stdlib/arrays.rs

Lines changed: 91 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,13 @@ impl Tool for ArefTool {
155155
let array = args[0].as_array()?;
156156
let index = args[1].as_int()? as usize;
157157

158-
array.get(index).cloned().ok_or_else(|| Error::IndexOutOfBounds {
159-
index,
160-
length: array.len(),
161-
})
158+
array
159+
.get(index)
160+
.cloned()
161+
.ok_or_else(|| Error::IndexOutOfBounds {
162+
index,
163+
length: array.len(),
164+
})
162165
}
163166
}
164167

@@ -545,9 +548,12 @@ impl Tool for CaadrTool {
545548
}
546549

547550
let second = list[1].as_array()?;
548-
second.first().cloned().ok_or_else(|| Error::EmptyCollection {
549-
operation: "CAADR".to_string(),
550-
})
551+
second
552+
.first()
553+
.cloned()
554+
.ok_or_else(|| Error::EmptyCollection {
555+
operation: "CAADR".to_string(),
556+
})
551557
}
552558
}
553559

@@ -670,18 +676,30 @@ impl Tool for CaaaarTool {
670676
});
671677
}
672678

673-
let l1 = args[0].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
674-
operation: "CAAAAR".to_string(),
675-
})?;
676-
let l2 = l1.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
677-
operation: "CAAAAR".to_string(),
678-
})?;
679-
let l3 = l2.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
680-
operation: "CAAAAR".to_string(),
681-
})?;
682-
let l4 = l3.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
683-
operation: "CAAAAR".to_string(),
684-
})?;
679+
let l1 = args[0]
680+
.as_array()?
681+
.first()
682+
.ok_or_else(|| Error::EmptyCollection {
683+
operation: "CAAAAR".to_string(),
684+
})?;
685+
let l2 = l1
686+
.as_array()?
687+
.first()
688+
.ok_or_else(|| Error::EmptyCollection {
689+
operation: "CAAAAR".to_string(),
690+
})?;
691+
let l3 = l2
692+
.as_array()?
693+
.first()
694+
.ok_or_else(|| Error::EmptyCollection {
695+
operation: "CAAAAR".to_string(),
696+
})?;
697+
let l4 = l3
698+
.as_array()?
699+
.first()
700+
.ok_or_else(|| Error::EmptyCollection {
701+
operation: "CAAAAR".to_string(),
702+
})?;
685703

686704
Ok(l4.clone())
687705
}
@@ -707,15 +725,24 @@ impl Tool for CdaaarTool {
707725
});
708726
}
709727

710-
let l1 = args[0].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
711-
operation: "CDAAAR".to_string(),
712-
})?;
713-
let l2 = l1.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
714-
operation: "CDAAAR".to_string(),
715-
})?;
716-
let l3 = l2.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
717-
operation: "CDAAAR".to_string(),
718-
})?;
728+
let l1 = args[0]
729+
.as_array()?
730+
.first()
731+
.ok_or_else(|| Error::EmptyCollection {
732+
operation: "CDAAAR".to_string(),
733+
})?;
734+
let l2 = l1
735+
.as_array()?
736+
.first()
737+
.ok_or_else(|| Error::EmptyCollection {
738+
operation: "CDAAAR".to_string(),
739+
})?;
740+
let l3 = l2
741+
.as_array()?
742+
.first()
743+
.ok_or_else(|| Error::EmptyCollection {
744+
operation: "CDAAAR".to_string(),
745+
})?;
719746
let l4 = l3.as_array()?;
720747

721748
if l4.is_empty() {
@@ -746,12 +773,18 @@ impl Tool for CadaarTool {
746773
});
747774
}
748775

749-
let l1 = args[0].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
750-
operation: "CADAAR".to_string(),
751-
})?;
752-
let l2 = l1.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
753-
operation: "CADAAR".to_string(),
754-
})?;
776+
let l1 = args[0]
777+
.as_array()?
778+
.first()
779+
.ok_or_else(|| Error::EmptyCollection {
780+
operation: "CADAAR".to_string(),
781+
})?;
782+
let l2 = l1
783+
.as_array()?
784+
.first()
785+
.ok_or_else(|| Error::EmptyCollection {
786+
operation: "CADAAR".to_string(),
787+
})?;
755788
let l3 = l2.as_array()?;
756789

757790
if l3.len() < 2 {
@@ -785,12 +818,18 @@ impl Tool for CddaarTool {
785818
});
786819
}
787820

788-
let l1 = args[0].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
789-
operation: "CDDAAR".to_string(),
790-
})?;
791-
let l2 = l1.as_array()?.first().ok_or_else(|| Error::EmptyCollection {
792-
operation: "CDDAAR".to_string(),
793-
})?;
821+
let l1 = args[0]
822+
.as_array()?
823+
.first()
824+
.ok_or_else(|| Error::EmptyCollection {
825+
operation: "CDDAAR".to_string(),
826+
})?;
827+
let l2 = l1
828+
.as_array()?
829+
.first()
830+
.ok_or_else(|| Error::EmptyCollection {
831+
operation: "CDDAAR".to_string(),
832+
})?;
794833
let l3 = l2.as_array()?;
795834

796835
if l3.len() < 2 {
@@ -821,9 +860,12 @@ impl Tool for CaadarTool {
821860
});
822861
}
823862

824-
let l1 = args[0].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
825-
operation: "CAADAR".to_string(),
826-
})?;
863+
let l1 = args[0]
864+
.as_array()?
865+
.first()
866+
.ok_or_else(|| Error::EmptyCollection {
867+
operation: "CAADAR".to_string(),
868+
})?;
827869
let l2 = l1.as_array()?;
828870

829871
if l2.len() < 2 {
@@ -833,9 +875,12 @@ impl Tool for CaadarTool {
833875
});
834876
}
835877

836-
let l3 = l2[1].as_array()?.first().ok_or_else(|| Error::EmptyCollection {
837-
operation: "CAADAR".to_string(),
838-
})?;
878+
let l3 = l2[1]
879+
.as_array()?
880+
.first()
881+
.ok_or_else(|| Error::EmptyCollection {
882+
operation: "CAADAR".to_string(),
883+
})?;
839884

840885
Ok(l3.clone())
841886
}

0 commit comments

Comments
 (0)