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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Lex toolchain
run: |
set -euxo pipefail
LEX_VERSION="0.9.14"
LEX_VERSION="0.10.0"
curl -fsSL -o /tmp/lex.tgz \
"https://github.com/alpibrusl/lex-lang/releases/download/v${LEX_VERSION}/lex-v${LEX_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf /tmp/lex.tgz -C /tmp/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install lex
if: steps.ver.outputs.changed == 'true'
run: |
curl -fsSL "https://github.com/alpibrusl/lex-lang/releases/download/v0.9.14/lex-v0.9.14-x86_64-unknown-linux-gnu.tar.gz" \
curl -fsSL "https://github.com/alpibrusl/lex-lang/releases/download/v0.10.0/lex-v0.10.0-x86_64-unknown-linux-gnu.tar.gz" \
| tar -xz --strip-components=1 -C /usr/local/bin

- name: Mint JWT + publish
Expand Down
4 changes: 2 additions & 2 deletions examples/manifesto_full_chain/orchestrator.lex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import "std.http" as http

import "std.bytes" as bytes

import "std.proc" as proc
import "std.process" as proc

import "std.sql" as sql

Expand Down Expand Up @@ -113,7 +113,7 @@ fn validate_snippet(code :: Str) -> [proc, io, fs_write] Bool {
let __mkdir := fs.mkdir_p("/tmp/lex_validate")
match io.write("/tmp/lex_validate/snippet.lex", code) {
Err(_) => false,
Ok(_) => match proc.spawn("lex", ["check", "/tmp/lex_validate/snippet.lex"]) {
Ok(_) => match proc.run("lex", ["check", "/tmp/lex_validate/snippet.lex"]) {
Ok(r) => r.exit_code == 0,
Err(_) => false,
},
Expand Down
4 changes: 2 additions & 2 deletions examples/manifesto_full_chain/orchestrator_bad.lex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "std.http" as http

import "std.bytes" as bytes

import "std.proc" as proc
import "std.process" as proc

import "std.sql" as sql

Expand Down Expand Up @@ -91,7 +91,7 @@ fn validate_snippet(code :: Str) -> [proc, io, fs_write] Bool {
let __mkdir := fs.mkdir_p("/tmp/lex_validate")
match io.write("/tmp/lex_validate/snippet.lex", code) {
Err(_) => false,
Ok(_) => match proc.spawn("lex", ["check", "/tmp/lex_validate/snippet.lex"]) {
Ok(_) => match proc.run("lex", ["check", "/tmp/lex_validate/snippet.lex"]) {
Ok(r) => r.exit_code == 0,
Err(_) => false,
},
Expand Down
4 changes: 2 additions & 2 deletions src/tools/attestation_query.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -24,7 +24,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => ["store", "attestations", fn_name],
Some(path) => ["store", "attestations", "--path", path, fn_name],
}
match proc.spawn("lex", cmd_args) {
match proc.run("lex", cmd_args) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let result := if str.is_empty(out.stdout) {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/effects_of.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "fn_name is required")),
Some(fn_name) => {
let target := util.field_str_or(args, "path", ".")
match proc.spawn("lex", ["check", "--json", "--effects", fn_name, target]) {
match proc.run("lex", ["check", "--json", "--effects", fn_name, target]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code == 0 {
Ok(JStr(out.stdout))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_audit.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "query is required")),
Some(query) => {
let target := util.field_str_or(args, "path", ".")
match proc.spawn("lex", ["audit", query, target]) {
match proc.run("lex", ["audit", query, target]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_check.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -18,7 +18,7 @@ fn params() -> s.ModelSchema {

fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
let target := util.field_str_or(args, "path", ".")
match proc.spawn("lex", ["check", target]) {
match proc.run("lex", ["check", target]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let output := if out.exit_code == 0 {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_cli.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -19,7 +19,7 @@ fn params() -> s.ModelSchema {
fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match util.field_str(args, "command") {
None => Err(e.single("", "missing_field", "command is required")),
Some(cmd) => match proc.spawn("bash", ["-c", str.concat("lex ", cmd)]) {
Some(cmd) => match proc.run("bash", ["-c", str.concat("lex ", cmd)]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let combined := str.concat(out.stdout, out.stderr)
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_run.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand Down Expand Up @@ -26,7 +26,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => ["run", path, fn_name],
Some(fn_args) => ["run", path, fn_name, fn_args],
}
match proc.spawn("lex", cmd_args) {
match proc.run("lex", cmd_args) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_spec_check.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -24,7 +24,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => 100,
Some(n) => n,
}
match proc.spawn("lex", ["spec", "check", "--count", int.to_str(count), target]) {
match proc.run("lex", ["spec", "check", "--count", int.to_str(count), target]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let output := if out.exit_code == 0 {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_spec_smt.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -24,7 +24,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => ["spec", "smt", path],
Some(out_path) => ["spec", "smt", "--out", out_path, path],
}
match proc.spawn("lex", out_args) {
match proc.run("lex", out_args) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_store_apply.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -19,7 +19,7 @@ fn params() -> s.ModelSchema {
fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match util.field_str(args, "operation") {
None => Err(e.single("", "missing_field", "operation is required")),
Some(op_json) => match proc.spawn("lex", ["store", "apply", op_json]) {
Some(op_json) => match proc.run("lex", ["store", "apply", op_json]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code == 0 {
Ok(JStr(str.concat("applied\n", out.stdout)))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_store_diff.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "sigid_a is required")),
Some(a) => match util.field_str(args, "sigid_b") {
None => Err(e.single("", "missing_field", "sigid_b is required")),
Some(b) => match proc.spawn("lex", ["store", "diff", a, b]) {
Some(b) => match proc.run("lex", ["store", "diff", a, b]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
},
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_store_merge.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -23,7 +23,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "left is required")),
Some(left) => match util.field_str(args, "right") {
None => Err(e.single("", "missing_field", "right is required")),
Some(right) => match proc.spawn("lex", ["store", "merge", base, left, right]) {
Some(right) => match proc.run("lex", ["store", "merge", base, left, right]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code == 0 {
Ok(JStr(str.concat("merged\n", out.stdout)))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/lex_test.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -18,7 +18,7 @@ fn params() -> s.ModelSchema {

fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
let target := util.field_str_or(args, "path", "tests")
match proc.spawn("lex", ["run", target, "run_all"]) {
match proc.run("lex", ["run", target, "run_all"]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let output := if out.exit_code == 0 {
Expand Down
6 changes: 3 additions & 3 deletions src/tools/linter.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand Down Expand Up @@ -162,7 +162,7 @@ fn translate_lex_error(raw :: Str) -> Str {
}

fn run_lex_fmt(path :: Str) -> [proc] LintOutcome {
match proc.spawn("bash", ["-c", str.concat("\"${LEX:-lex}\" fmt ", path)]) {
match proc.run("bash", ["-c", str.concat("\"${LEX:-lex}\" fmt ", path)]) {
Err(msg) => LintWarn("lex fmt", str.concat("could not run: ", msg)),
Ok(out) => if out.exit_code == 0 {
if str.contains(str.trim(out.stdout), "reformatted") {
Expand All @@ -177,7 +177,7 @@ fn run_lex_fmt(path :: Str) -> [proc] LintOutcome {
}

fn run_lex_check(path :: Str) -> [proc] LintOutcome {
match proc.spawn("bash", ["-c", str.concat("\"${LEX:-lex}\" check ", path)]) {
match proc.run("bash", ["-c", str.concat("\"${LEX:-lex}\" check ", path)]) {
Err(msg) => LintFail("lex check", str.concat("could not run: ", msg)),
Ok(out) => if out.exit_code == 0 {
LintOk("lex check")
Expand Down
4 changes: 2 additions & 2 deletions src/tools/load_guidelines.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "lex-llm/tool" as t

Expand All @@ -13,7 +13,7 @@ fn params() -> s.ModelSchema {
}

fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match proc.spawn("lex", ["agent-guidelines"]) {
match proc.run("lex", ["agent-guidelines"]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code == 0 {
Ok(JStr(out.stdout))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/os_check.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand Down Expand Up @@ -69,7 +69,7 @@ fn extract_effects(check_json :: jv.Json) -> List[Str] {
fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
let path := util.field_str_or(args, "path", ".")
let mode := util.field_str_or(args, "mode", "build")
match proc.spawn("lex", ["--output", "json", "check", path]) {
match proc.run("lex", ["--output", "json", "check", path]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code != 0 {
Err(e.single("", "lex_check_failed", str.concat(out.stdout, out.stderr)))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/sigid_lookup.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -19,7 +19,7 @@ fn params() -> s.ModelSchema {
fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match util.field_str(args, "sigid") {
None => Err(e.single("", "missing_field", "sigid is required")),
Some(sigid) => match proc.spawn("lex", ["store", "lookup", sigid]) {
Some(sigid) => match proc.run("lex", ["store", "lookup", sigid]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => if out.exit_code == 0 {
Ok(JStr(out.stdout))
Expand Down
4 changes: 2 additions & 2 deletions src/tools/standard/bash.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -19,7 +19,7 @@ fn params() -> s.ModelSchema {
fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match util.field_str(args, "command") {
None => Err(e.single("", "missing_field", "command is required")),
Some(cmd) => match proc.spawn("bash", ["-c", cmd]) {
Some(cmd) => match proc.run("bash", ["-c", cmd]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let combined := str.concat(out.stdout, out.stderr)
Expand Down
4 changes: 2 additions & 2 deletions src/tools/standard/glob.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "pattern is required")),
Some(pattern) => {
let dir := util.field_str_or(args, "directory", ".")
match proc.spawn("find", [dir, "-name", pattern, "-type", "f"]) {
match proc.run("find", [dir, "-name", pattern, "-type", "f"]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let result := if str.is_empty(out.stdout) {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/standard/grep.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "pattern is required")),
Some(pattern) => match util.field_str(args, "path") {
None => Err(e.single("", "missing_field", "path is required")),
Some(path) => match proc.spawn("grep", ["-r", "-n", pattern, path]) {
Some(path) => match proc.run("grep", ["-r", "-n", pattern, path]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => {
let result := if str.is_empty(out.stdout) {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/vcs/ast_diff.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -21,7 +21,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
None => Err(e.single("", "missing_field", "file_a is required")),
Some(a) => match util.field_str(args, "file_b") {
None => Err(e.single("", "missing_field", "file_b is required")),
Some(b) => match proc.spawn("lex", ["diff", a, b, "--json"]) {
Some(b) => match proc.run("lex", ["diff", a, b, "--json"]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
},
Expand Down
4 changes: 2 additions & 2 deletions src/tools/vcs/branch_create.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand Down Expand Up @@ -28,7 +28,7 @@ fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
Some(f) => ["--from", f],
}
let cmd := list.concat(base, from_args)
match proc.spawn("lex", cmd) {
match proc.run("lex", cmd) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
}
Expand Down
4 changes: 2 additions & 2 deletions src/tools/vcs/branch_current.lex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "std.proc" as proc
import "std.process" as proc

import "std.str" as str

Expand All @@ -15,7 +15,7 @@ fn params() -> s.ModelSchema {
}

fn execute(args :: jv.Json) -> [net, io, proc] Result[jv.Json, e.Errors] {
match proc.spawn("lex", ["branch", "current", "--output", "json"]) {
match proc.run("lex", ["branch", "current", "--output", "json"]) {
Err(msg) => Err(e.single("", "proc_error", msg)),
Ok(out) => Ok(JStr(str.concat(out.stdout, out.stderr))),
}
Expand Down
Loading
Loading