This repository was archived by the owner on Jul 27, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathbuild.rs
More file actions
94 lines (89 loc) · 2.51 KB
/
Copy pathbuild.rs
File metadata and controls
94 lines (89 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Build-time entrypoint for the root `cargo-ai` crate.
//!
//! Shared parsing/mapping/codegen lives in `templates/build_support.rs` so the
//! root build and scaffolded-agent build stay behavior-identical.
#[path = "templates/build_support.rs"]
mod build_support;
use build_support::TemplateSource;
const _: &str = include_str!("templates/build_support.rs");
const BUILD_RERUN_PATHS: &[&str] = &[
".agentcfg",
"build.rs",
"templates",
"templates/build_support.rs",
];
const TEMPLATE_SOURCES: &[TemplateSource] = &[
TemplateSource {
destination: "build.rs",
source: "build.rs",
},
TemplateSource {
destination: "build_support.rs",
source: "build_support.rs",
},
TemplateSource {
destination: ".agentcfg",
source: ".agentcfg",
},
TemplateSource {
destination: "Cargo.toml",
source: "Targo.toml",
},
TemplateSource {
destination: "src/main.rs",
source: "src/main.rs",
},
TemplateSource {
destination: "src/args.rs",
source: "src/args.rs",
},
TemplateSource {
destination: "src/web_resources.rs",
source: "src/web_resources.rs",
},
TemplateSource {
destination: "src/providers/mod.rs",
source: "src/providers/mod.rs",
},
TemplateSource {
destination: "src/providers/runtime.rs",
source: "src/providers/runtime.rs",
},
TemplateSource {
destination: "src/providers/openai.rs",
source: "src/providers/openai.rs",
},
TemplateSource {
destination: "src/providers/ollama.rs",
source: "src/providers/ollama.rs",
},
TemplateSource {
destination: "src/providers/error.rs",
source: "src/providers/error.rs",
},
TemplateSource {
destination: "src/config/loader.rs",
source: "src/config/loader.rs",
},
TemplateSource {
destination: "src/config/mod.rs",
source: "src/config/mod.rs",
},
TemplateSource {
destination: "src/config/schema.rs",
source: "src/config/schema.rs",
},
TemplateSource {
destination: "src/credentials/mod.rs",
source: "src/credentials/mod.rs",
},
TemplateSource {
destination: "src/credentials/store.rs",
source: "src/credentials/store.rs",
},
];
fn main() -> Result<(), build_support::BuildError> {
build_support::run_agent_codegen(BUILD_RERUN_PATHS)?;
build_support::write_generated_templates(TEMPLATE_SOURCES)?;
Ok(())
}