summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main.zig b/src/main.zig
index 2c5b414..86f1cb1 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -388,6 +388,17 @@ pub fn main(init: std.process.Init) !void {
// chance to register tools that might want to yield.
try rt.installScheduler();
+ // Install any user rocks (`extensions.rocks`) into the shared tree so the
+ // loader can `require` them below. Best-effort: a rock that fails to
+ // install is logged and skipped — the REPL still starts. This is where
+ // registry code enters, so it is the code-execution trust boundary; the
+ // allow/deny policy is a feature toggle, not a security gate.
+ for (app_config.ext_rocks) |spec| {
+ _ = luarocks_runtime.installRockIfMissing(luarocks_rt, alloc, io, spec.value) catch |err| {
+ std.log.err("extensions.rocks: failed to install '{s}': {t}", .{ spec.value, err });
+ };
+ }
+
// Discover Lua extensions across three layers — base
// (<data home>/agent), user ($XDG_CONFIG_HOME/panto or
// $HOME/.config/panto), and project (./.panto). Project shadows
@@ -399,10 +410,9 @@ pub fn main(init: std.process.Init) !void {
init.environ_map,
luarocks_rt.layout.agent_dir,
rt,
- .{
- .extensions = &app_config.extensions,
- .tools = &app_config.tools,
- },
+ &app_config.extensions,
+ app_config.ext_paths,
+ app_config.ext_rocks,
) catch |err| {
std.log.err("extension discovery failed: {t}", .{err});
return err;