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
13 changes: 10 additions & 3 deletions vext-tools/src/Mod.affine
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
// Ported via Harvard Engine bulk-processor
// Ported via Harvard Engine (Semantic pass)

module Mod;

// TODO: Complete semantic implementation
// SPDX-License-Identifier: MPL-2.0 OR MPL-2.0
// vext-tools - CLI utilities and hooks for vext
//
// @module

// Re-export hooks
module Git = Git
module Install = Install

86 changes: 83 additions & 3 deletions vext-tools/src/bindings/Deno.affine
Original file line number Diff line number Diff line change
@@ -1,7 +1,87 @@
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
// Ported via Harvard Engine bulk-processor
// Ported via Harvard Engine (Semantic pass)

module Deno;

// TODO: Complete semantic implementation
// SPDX-License-Identifier: MPL-2.0 OR MPL-2.0
// ReScript bindings for Deno runtime APIs

// Deno.Command for executing commands
module Command = {
struct t

struct commandOptions { {
args: array<string>,
stdout: string,
stderr: string,
}

struct output { {
success: bool,
stdout: Js.TypedArray2.Uint8Array.t,
stderr: Js.TypedArray2.Uint8Array.t,
}

@new @module("Deno") external make: (string, commandOptions) => t = "Command"
@send external output: t => promise<output> = "output"
}

// Deno.connect for network connections
module Net = {
struct conn

struct connectOptions { {
hostname: string,
port: int,
}

@module("Deno") external connect: connectOptions => promise<conn> = "connect"
@send external write: (conn, Js.TypedArray2.Uint8Array.t) => promise<int> = "write"
@send external close: conn => unit = "close"
}

// Deno.stdin
module Stdin = {
struct t

@module("Deno") @val external stdin: t = "stdin"
@send external read: (t, Js.TypedArray2.Uint8Array.t) => promise<Js.Nullable.t<int>> = "read"
}

// Deno.env
module Env = {
@module("Deno") @scope("env") external get: string => option<string> = "get"
}

// Deno.args
@module("Deno") @val external args: array<string> = "args"

// Deno.exit
@module("Deno") external exit: int => unit = "exit"

// Deno file operations
@module("Deno") external stat: string => promise<{..}> = "stat"
@module("Deno") external writeTextFile: (string, string) => promise<unit> = "writeTextFile"
@module("Deno") external chmod: (string, int) => promise<unit> = "chmod"

// TextEncoder/TextDecoder
module TextEncoder = {
struct t

@new external make: unit => t = "TextEncoder"
@send external encode: (t, string) => Js.TypedArray2.Uint8Array.t = "encode"
}

module TextDecoder = {
struct t

@new external make: unit => t = "TextDecoder"
@send external decode: (t, Js.TypedArray2.Uint8Array.t) => string = "decode"
}

// Console
module Console = {
@val external log: string => unit = "console.log"
@val external error: string => unit = "console.error"
}

47 changes: 44 additions & 3 deletions vext-tools/src/bindings/Std.affine
Original file line number Diff line number Diff line change
@@ -1,7 +1,48 @@
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell
// Ported via Harvard Engine bulk-processor
// Ported via Harvard Engine (Semantic pass)

module Std;

// TODO: Complete semantic implementation
// SPDX-License-Identifier: MPL-2.0 OR MPL-2.0
// ReScript bindings for Deno standard library (@std/*)

// @std/cli/parse-args
module ParseArgs = {
struct parseArgsOptions { {
string: array<string>,
boolean: array<string>,
alias: Js.Dict.t<string>,
}

struct args { {
_: array<string>,
}

@module("@std/cli/parse-args")
external parseArgs: (array<string>, parseArgsOptions) => args = "parseArgs"

// Helper to get string value from parsed args
fn getString: (args, string) => option<string> = (args, key) => {
fn obj = args->Obj.magic
Js.Dict.get(obj, key)
}

// Helper to get bool value from parsed args
fn getBool: (args, string) => bool = (args, key) => {
fn obj: Js.Dict.t<bool> = args->Obj.magic
Js.Dict.get(obj, key)->Option.getOr(false)
}
}

// @std/fs
module Fs = {
@module("@std/fs") external ensureDir: string => promise<unit> = "ensureDir"
}

// @std/path
module Path = {
@module("@std/path") external join: (string, string) => string = "join"
@module("@std/path") external join3: (string, string, string) => string = "join"
@module("@std/path") external dirname: string => string = "dirname"
}

Loading