Add readline, color, http_post_auth builtins; fix import resolution in build
Engram can now power the Neuron CLI: - readline(prompt) -> String: interactive terminal input via stdin - http_post_auth(url, token, body) -> String: authenticated POST for daemon API - color_cyan/green/red/yellow/bold/dim(s) -> String: ANSI color output All registered in el-types type checker - el build now resolves import "file.el" directives recursively (was only done for el run-file and el check; project builds failed silently) - Add .gitignore (target/, *.elc, *.sealed, *.map.json)
This commit is contained in:
@@ -134,9 +134,11 @@ impl TypeEnv {
|
||||
for name in &["str_len","string_len","list_len","array_length","array_len","map_len","json_array_len"] {
|
||||
env.functions.insert(name.to_string(), str_fn(vec![u.clone()], i.clone()));
|
||||
}
|
||||
for name in &["str_replace","string_replace","string_concat","string_substring","str_slice"] {
|
||||
for name in &["str_replace","string_replace","string_concat","string_substring"] {
|
||||
env.functions.insert(name.to_string(), str_fn(vec![s.clone(), s.clone(), s.clone()], s.clone()));
|
||||
}
|
||||
// str_slice(s: String, start: Int, end: Int) -> String
|
||||
env.functions.insert("str_slice".into(), str_fn(vec![s.clone(), i.clone(), i.clone()], s.clone()));
|
||||
env.functions.insert("str_split".into(), str_fn(vec![s.clone(), s.clone()], Type::Unknown));
|
||||
env.functions.insert("string_split".into(), str_fn(vec![s.clone(), s.clone()], Type::Unknown));
|
||||
env.functions.insert("string_split_last".into(), str_fn(vec![s.clone(), s.clone()], Type::Unknown));
|
||||
@@ -216,6 +218,7 @@ impl TypeEnv {
|
||||
env.functions.insert("http_delete".into(), str_fn(vec![s.clone()], s.clone()));
|
||||
env.functions.insert("http_patch".into(), str_fn(vec![s.clone(), s.clone()], s.clone()));
|
||||
env.functions.insert("http_get_auth".into(), str_fn(vec![s.clone(), s.clone()], s.clone()));
|
||||
env.functions.insert("http_post_auth".into(), str_fn(vec![s.clone(), s.clone(), s.clone()], s.clone()));
|
||||
env.functions.insert("http_put_auth".into(), str_fn(vec![s.clone(), s.clone(), s.clone()], s.clone()));
|
||||
env.functions.insert("http_delete_auth".into(), str_fn(vec![s.clone(), s.clone()], s.clone()));
|
||||
env.functions.insert("http_serve".into(), str_fn(vec![u.clone()], Type::Void));
|
||||
@@ -232,6 +235,12 @@ impl TypeEnv {
|
||||
env.functions.insert("exit".into(), str_fn(vec![i.clone()], Type::Void));
|
||||
env.functions.insert("sleep_ms".into(), str_fn(vec![i.clone()], Type::Void));
|
||||
env.functions.insert("timestamp".into(), str_fn(vec![], s.clone()));
|
||||
env.functions.insert("readline".into(), str_fn(vec![s.clone()], s.clone()));
|
||||
|
||||
// ANSI color builtins
|
||||
for name in &["color_cyan","color_green","color_red","color_yellow","color_bold","color_dim"] {
|
||||
env.functions.insert(name.to_string(), str_fn(vec![s.clone()], s.clone()));
|
||||
}
|
||||
|
||||
// Math
|
||||
for name in &["math_abs","math_floor","math_ceil","math_round","math_sqrt"] {
|
||||
|
||||
Reference in New Issue
Block a user