interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / crates / aien-closure / src / main.rs

87 lines · 2888 bytes Raw Blame History
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! `verify-closure --root <repo> [--store <receipt dir>] [--write-lock]`
17//!
18//! Exit 0 PASS. Exit 1 internal error. Exit 2 usage error. Otherwise the exit
19//! code of the first finding (sorted by code, then component), 10 to 18.
20
21use aien_closure::{verify, Options};
22use std::path::PathBuf;
23use std::process::ExitCode;
24
25fn usage() -> ExitCode {
26 eprintln!("usage: verify-closure --root <repo> [--store <receipt dir>] [--write-lock]");
27 ExitCode::from(2)
28}
29
30fn default_store() -> PathBuf {
31 std::env::var_os("AIEN_PROOF_DIR")
32 .map(PathBuf::from)
33 .unwrap_or_else(|| {
34 std::env::var_os("HOME")
35 .map(PathBuf::from)
36 .unwrap_or_else(|| PathBuf::from("."))
37 .join(".local/state/aien-proof")
38 })
39}
40
41fn main() -> ExitCode {
42 let mut root = None;
43 let mut store = None;
44 let mut write_lock = false;
45 let mut args = std::env::args().skip(1);
46 while let Some(a) = args.next() {
47 match a.as_str() {
48 "--root" => root = args.next().map(PathBuf::from),
49 "--store" => store = args.next().map(PathBuf::from),
50 "--write-lock" => write_lock = true,
51 _ => return usage(),
52 }
53 }
54 let Some(root) = root else {
55 return usage();
56 };
57 let opts = Options {
58 root,
59 store: store.unwrap_or_else(default_store),
60 write_lock,
61 };
62 match verify(&opts) {
63 Err(e) => {
64 println!(
65 "SUMMARY status=ERROR findings=0 components=0 detail={}",
66 e.replace('\n', " ")
67 );
68 ExitCode::from(1)
69 }
70 Ok(out) => {
71 for (name, id) in &out.passed {
72 println!("PASS component={name} receipt={id}");
73 }
74 for f in &out.findings {
75 println!("{}", f.line());
76 }
77 let code = out.findings.first().map_or(0, |f| f.code.exit_code());
78 println!(
79 "SUMMARY status={} findings={} components={}",
80 if out.ok() { "PASS" } else { "FAIL" },
81 out.findings.len(),
82 out.components
83 );
84 ExitCode::from(code as u8)
85 }
86 }
87}