fix: Rename freeflowuniverse to incubaid

This commit is contained in:
Mahmoud-Emad
2025-10-12 12:30:19 +03:00
parent 801c4abb43
commit 8f2d187b17
1593 changed files with 8753 additions and 8300 deletions

View File

@@ -1,11 +1,11 @@
module core
import os
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.pathlib
import incubaid.herolib.core
import incubaid.herolib.ui.console
// import regex
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.core.texttools
pub struct CmdAddArgs {
pub mut:
@@ -13,7 +13,7 @@ pub mut:
source string @[required] // path where the binary is
symlink bool // if rather than copy do a symlink
reset bool = true // if existing cmd will delete
// bin_repo_url string = 'https://github.com/freeflowuniverse/freeflow_binary' // binary where we put the results
// bin_repo_url string = 'https://github.com/incubaid/freeflow_binary' // binary where we put the results
}
// copy a binary to the right location on the local computer .

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.core.base
import freeflowuniverse.herolib.core.redisclient
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.base
import incubaid.herolib.core.redisclient
import incubaid.herolib.ui.console
fn donedb() !&redisclient.Redis {
mut context := base.context()!

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.core.pathlib
// import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.pathlib
// import incubaid.herolib.core.texttools
import incubaid.herolib.ui.console
import os
@[params]

View File

@@ -1,6 +1,6 @@
module core
import freeflowuniverse.herolib.core.pathlib
import incubaid.herolib.core.pathlib
import os
@[params]

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.core.texttools
// import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.texttools
// import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
import json
import os
import time

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.pathlib
// import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.texttools
import incubaid.herolib.core.pathlib
// import incubaid.herolib.ui.console
// will return temporary path which then can be executed, is a helper function for making script out of command
pub fn cmd_to_script_path(cmd Command) !string {

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.texttools
import incubaid.herolib.core
import incubaid.herolib.ui.console
import os
pub fn file_write(path string, text string) ! {

View File

@@ -2,8 +2,8 @@ module core
import net
import time
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core as herolib_core
import incubaid.herolib.ui.console
import incubaid.herolib.core as herolib_core
import math
import os

View File

@@ -1,8 +1,8 @@
module core
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core
import incubaid.herolib.ui.console
import incubaid.herolib.core.texttools
import incubaid.herolib.core
// update the package list
pub fn package_refresh() ! {

View File

@@ -1,6 +1,6 @@
module core
import freeflowuniverse.herolib.core
import incubaid.herolib.core
fn test_package_management() {
platform_ := core.platform()!

View File

@@ -3,7 +3,7 @@ module core
import time
import os
import math
// import freeflowuniverse.herolib.ui.console
// import incubaid.herolib.ui.console
pub enum PMState {
init

View File

@@ -10,31 +10,31 @@ This module encapsulates essential OS-level features, making system programming
Execute shell commands with fine-grained control and robust error handling.
* **`osal.exec(cmd: Command)`**: Executes a command with extensive options.
* `Command` struct fields:
* `cmd` (string): The command string.
* `timeout` (int): Max execution time in seconds (default: 3600).
* `retry` (int): Number of retries on failure.
* `work_folder` (string): Working directory for the command.
* `environment` (map[string]string): Environment variables for the command.
* `stdout` (bool): Show command output (default: true).
* `raise_error` (bool): Raise V error on failure (default: true).
* `ignore_error` (bool): Do not raise error, just report.
* `debug` (bool): Enable debug output.
* `shell` (bool): Execute in interactive shell.
* `async` (bool): Run command asynchronously.
* `runtime` (RunTime): Specify runtime (e.g., `.bash`, `.python`).
* Returns `Job` struct with `status`, `output`, `error`, `exit_code`, etc.
* **`osal.execute_silent(cmd string)`**: Executes a command silently, returns output.
* **`osal.execute_debug(cmd string)`**: Executes a command with debug output, returns output.
* **`osal.execute_stdout(cmd string)`**: Executes a command and prints output to stdout, returns output.
* **`osal.execute_interactive(cmd string)`**: Executes a command in an interactive shell.
* **`osal.cmd_exists(cmd string)`**: Checks if a command exists in the system's PATH.
* **`osal.exec(cmd: Command)`**: Executes a command with extensive options.
* `Command` struct fields:
* `cmd` (string): The command string.
* `timeout` (int): Max execution time in seconds (default: 3600).
* `retry` (int): Number of retries on failure.
* `work_folder` (string): Working directory for the command.
* `environment` (map[string]string): Environment variables for the command.
* `stdout` (bool): Show command output (default: true).
* `raise_error` (bool): Raise V error on failure (default: true).
* `ignore_error` (bool): Do not raise error, just report.
* `debug` (bool): Enable debug output.
* `shell` (bool): Execute in interactive shell.
* `async` (bool): Run command asynchronously.
* `runtime` (RunTime): Specify runtime (e.g., `.bash`, `.python`).
* Returns `Job` struct with `status`, `output`, `error`, `exit_code`, etc.
* **`osal.execute_silent(cmd string)`**: Executes a command silently, returns output.
* **`osal.execute_debug(cmd string)`**: Executes a command with debug output, returns output.
* **`osal.execute_stdout(cmd string)`**: Executes a command and prints output to stdout, returns output.
* **`osal.execute_interactive(cmd string)`**: Executes a command in an interactive shell.
* **`osal.cmd_exists(cmd string)`**: Checks if a command exists in the system's PATH.
**Example: Flexible Command Execution**
```v
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
// Simple command execution
job := osal.exec(cmd: 'ls -la')!
@@ -79,90 +79,89 @@ if job_result.is_err() {
Tools for network diagnostics and information.
* **`osal.ping(args: PingArgs)`**: Checks host reachability.
* `PingArgs` struct fields: `address` (string, required), `count` (u8), `timeout` (u16), `retry` (u8).
* Returns `PingResult` enum: `.ok`, `.timeout`, `.unknownhost`.
* **`osal.tcp_port_test(args: TcpPortTestArgs)`**: Tests if a TCP port is open.
* `TcpPortTestArgs` struct fields: `address` (string, required), `port` (int), `timeout` (u16 in milliseconds).
* Returns `bool`.
* **`osal.ipaddr_pub_get()`**: Retrieves the public IP address. Returns `string`.
* **`osal.is_ip_on_local_interface(ip string)`**: Checks if an IP is on a local interface. Returns `bool`.
* **`osal.ping(args: PingArgs)`**: Checks host reachability.
* `PingArgs` struct fields: `address` (string, required), `count` (u8), `timeout` (u16), `retry` (u8).
* Returns `PingResult` enum: `.ok`, `.timeout`, `.unknownhost`.
* **`osal.tcp_port_test(args: TcpPortTestArgs)`**: Tests if a TCP port is open.
* `TcpPortTestArgs` struct fields: `address` (string, required), `port` (int), `timeout` (u16 in milliseconds).
* Returns `bool`.
* **`osal.ipaddr_pub_get()`**: Retrieves the public IP address. Returns `string`.
* **`osal.is_ip_on_local_interface(ip string)`**: Checks if an IP is on a local interface. Returns `bool`.
### 3. File System Operations (`file.v`)
Functions for managing files and directories.
* **`osal.file_write(path string, text string)`**: Writes text to a file.
* **`osal.file_read(path string)`**: Reads content from a file. Returns `string`.
* **`osal.dir_ensure(path string)`**: Ensures a directory exists, creates if not.
* **`osal.dir_delete(path string)`**: Deletes a directory if it exists.
* **`osal.dir_reset(path string)`**: Deletes and recreates a directory.
* **`osal.rm(todelete string)`**: Removes files/directories (supports `~`, comma/newline separated paths, sudo).
* **`osal.file_write(path string, text string)`**: Writes text to a file.
* **`osal.file_read(path string)`**: Reads content from a file. Returns `string`.
* **`osal.dir_ensure(path string)`**: Ensures a directory exists, creates if not.
* **`osal.dir_delete(path string)`**: Deletes a directory if it exists.
* **`osal.dir_reset(path string)`**: Deletes and recreates a directory.
* **`osal.rm(todelete string)`**: Removes files/directories (supports `~`, comma/newline separated paths, sudo).
### 4. Environment Variables (`env.v`)
Manage system environment variables.
* **`osal.env_set(args: EnvSet)`**: Sets an environment variable.
* `EnvSet` struct fields: `key` (string, required), `value` (string, required), `overwrite` (bool).
* **`osal.env_unset(key string)`**: Unsets an environment variable.
* **`osal.env_unset_all()`**: Unsets all environment variables.
* **`osal.env_set_all(args: EnvSetAll)`**: Sets multiple environment variables.
* `EnvSetAll` struct fields: `env` (map[string]string), `clear_before_set` (bool), `overwrite_if_exists` (bool).
* **`osal.env_get(key string)`**: Retrieves an environment variable's value. Returns `string`.
* **`osal.env_exists(key string)`**: Checks if an environment variable exists. Returns `bool`.
* **`osal.env_get_default(key string, def string)`**: Gets an environment variable or a default value. Returns `string`.
* **`osal.load_env_file(file_path string)`**: Loads environment variables from a file.
* **`osal.env_set(args: EnvSet)`**: Sets an environment variable.
* `EnvSet` struct fields: `key` (string, required), `value` (string, required), `overwrite` (bool).
* **`osal.env_unset(key string)`**: Unsets an environment variable.
* **`osal.env_unset_all()`**: Unsets all environment variables.
* **`osal.env_set_all(args: EnvSetAll)`**: Sets multiple environment variables.
* `EnvSetAll` struct fields: `env` (map[string]string), `clear_before_set` (bool), `overwrite_if_exists` (bool).
* **`osal.env_get(key string)`**: Retrieves an environment variable's value. Returns `string`.
* **`osal.env_exists(key string)`**: Checks if an environment variable exists. Returns `bool`.
* **`osal.env_get_default(key string, def string)`**: Gets an environment variable or a default value. Returns `string`.
* **`osal.load_env_file(file_path string)`**: Loads environment variables from a file.
### 5. Command & Profile Management (`cmds.v`)
Manage system commands and shell profile paths.
* **`osal.cmd_add(args: CmdAddArgs)`**: Adds a binary to system paths and updates profiles.
* `CmdAddArgs` struct fields: `cmdname` (string), `source` (string, required), `symlink` (bool), `reset` (bool).
* **`osal.profile_path_add_hero()`**: Adds `~/hero/bin` to profile. Returns `string` (path).
* **`osal.bin_path()`**: Returns the preferred binary installation path. Returns `string`.
* **`osal.hero_path()`**: Returns the `~/hero` directory path. Returns `string`.
* **`osal.usr_local_path()`**: Returns `/usr/local` (Linux) or `~/hero` (macOS). Returns `string`.
* **`osal.profile_path_source()`**: Returns a source command for the preferred profile. Returns `string`.
* **`osal.profile_path_source_and()`**: Returns a source command followed by `&&`. Returns `string`.
* **`osal.profile_path_add_remove(args: ProfilePathAddRemoveArgs)`**: Adds/removes paths from profiles.
* `ProfilePathAddRemoveArgs` struct fields: `paths_profile` (string), `paths2add` (string), `paths2delete` (string), `allprofiles` (bool).
* **`osal.cmd_path(cmd string)`**: Returns the full path of an executable command. Returns `string`.
* **`osal.cmd_delete(cmd string)`**: Deletes commands from their locations.
* **`osal.profile_paths_all()`**: Lists all possible profile file paths. Returns `[]string`.
* **`osal.profile_paths_preferred()`**: Lists preferred profile file paths for the OS. Returns `[]string`.
* **`osal.profile_path()`**: Returns the most preferred profile file path. Returns `string`.
* **`osal.cmd_add(args: CmdAddArgs)`**: Adds a binary to system paths and updates profiles.
* `CmdAddArgs` struct fields: `cmdname` (string), `source` (string, required), `symlink` (bool), `reset` (bool).
* **`osal.profile_path_add_hero()`**: Adds `~/hero/bin` to profile. Returns `string` (path).
* **`osal.bin_path()`**: Returns the preferred binary installation path. Returns `string`.
* **`osal.hero_path()`**: Returns the `~/hero` directory path. Returns `string`.
* **`osal.usr_local_path()`**: Returns `/usr/local` (Linux) or `~/hero` (macOS). Returns `string`.
* **`osal.profile_path_source()`**: Returns a source command for the preferred profile. Returns `string`.
* **`osal.profile_path_source_and()`**: Returns a source command followed by `&&`. Returns `string`.
* **`osal.profile_path_add_remove(args: ProfilePathAddRemoveArgs)`**: Adds/removes paths from profiles.
* `ProfilePathAddRemoveArgs` struct fields: `paths_profile` (string), `paths2add` (string), `paths2delete` (string), `allprofiles` (bool).
* **`osal.cmd_path(cmd string)`**: Returns the full path of an executable command. Returns `string`.
* **`osal.cmd_delete(cmd string)`**: Deletes commands from their locations.
* **`osal.profile_paths_all()`**: Lists all possible profile file paths. Returns `[]string`.
* **`osal.profile_paths_preferred()`**: Lists preferred profile file paths for the OS. Returns `[]string`.
* **`osal.profile_path()`**: Returns the most preferred profile file path. Returns `string`.
### 6. System Information & Utilities (`ps_tool.v`, `sleep.v`, `downloader.v`, `users.v`, etc.)
Miscellaneous system functionalities.
* **`osal.processmap_get()`**: Gets a map of all running processes. Returns `ProcessMap`.
* **`osal.processinfo_get(pid int)`**: Gets info for a specific process. Returns `ProcessInfo`.
* **`osal.processinfo_get_byname(name string)`**: Gets info for processes by name. Returns `[]ProcessInfo`.
* **`osal.process_exists(pid int)`**: Checks if a process exists by PID. Returns `bool`.
* **`osal.processinfo_with_children(pid int)`**: Gets a process and its children. Returns `ProcessMap`.
* **`osal.processinfo_children(pid int)`**: Gets children of a process. Returns `ProcessMap`.
* **`osal.process_kill_recursive(args: ProcessKillArgs)`**: Kills a process and its children.
* `ProcessKillArgs` struct fields: `name` (string), `pid` (int).
* **`osal.whoami()`**: Returns the current username. Returns `string`.
* **`osal.sleep(duration int)`**: Pauses execution for `duration` seconds.
* **`osal.download(args: DownloadArgs)`**: Downloads a file from a URL.
* `DownloadArgs` struct fields: `url` (string), `name` (string), `reset` (bool), `hash` (string), `dest` (string), `timeout` (int), `retry` (int), `minsize_kb` (u32), `maxsize_kb` (u32), `expand_dir` (string), `expand_file` (string).
* Returns `pathlib.Path`.
* **`osal.user_exists(username string)`**: Checks if a user exists. Returns `bool`.
* **`osal.user_id_get(username string)`**: Gets user ID. Returns `int`.
* **`osal.user_add(args: UserArgs)`**: Adds a user.
* `UserArgs` struct fields: `name` (string, required). Returns `int` (user ID).
* **`osal.processmap_get()`**: Gets a map of all running processes. Returns `ProcessMap`.
* **`osal.processinfo_get(pid int)`**: Gets info for a specific process. Returns `ProcessInfo`.
* **`osal.processinfo_get_byname(name string)`**: Gets info for processes by name. Returns `[]ProcessInfo`.
* **`osal.process_exists(pid int)`**: Checks if a process exists by PID. Returns `bool`.
* **`osal.processinfo_with_children(pid int)`**: Gets a process and its children. Returns `ProcessMap`.
* **`osal.processinfo_children(pid int)`**: Gets children of a process. Returns `ProcessMap`.
* **`osal.process_kill_recursive(args: ProcessKillArgs)`**: Kills a process and its children.
* `ProcessKillArgs` struct fields: `name` (string), `pid` (int).
* **`osal.whoami()`**: Returns the current username. Returns `string`.
* **`osal.sleep(duration int)`**: Pauses execution for `duration` seconds.
* **`osal.download(args: DownloadArgs)`**: Downloads a file from a URL.
* `DownloadArgs` struct fields: `url` (string), `name` (string), `reset` (bool), `hash` (string), `dest` (string), `timeout` (int), `retry` (int), `minsize_kb` (u32), `maxsize_kb` (u32), `expand_dir` (string), `expand_file` (string).
* Returns `pathlib.Path`.
* **`osal.user_exists(username string)`**: Checks if a user exists. Returns `bool`.
* **`osal.user_id_get(username string)`**: Gets user ID. Returns `int`.
* **`osal.user_add(args: UserArgs)`**: Adds a user.
* `UserArgs` struct fields: `name` (string, required). Returns `int` (user ID).
## Notes on the CMD Job Execution
* Commands are executed from temporary scripts in `/tmp/execscripts`.
* Failed script executions are preserved for debugging.
* Successful script executions are automatically cleaned up.
* Platform-specific behavior is automatically handled.
* Timeout and retry mechanisms are available for robust execution.
* Environment variables and working directories can be specified per command.
* Interactive and non-interactive modes are supported.
* Commands are executed from temporary scripts in `/tmp/execscripts`.
* Failed script executions are preserved for debugging.
* Successful script executions are automatically cleaned up.
* Platform-specific behavior is automatically handled.
* Timeout and retry mechanisms are available for robust execution.
* Environment variables and working directories can be specified per command.
* Interactive and non-interactive modes are supported.

View File

@@ -1,6 +1,6 @@
module core
import freeflowuniverse.herolib.core.pathlib
import incubaid.herolib.core.pathlib
import os
@[noinit]

View File

@@ -1,8 +1,8 @@
module core
import os
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.core
import incubaid.herolib.ui.console
import incubaid.herolib.core
@[params]
pub struct UserArgs {

View File

@@ -2,12 +2,12 @@
This module provides functionality for managing DNS records in Redis for use with CoreDNS. It supports various DNS record types and provides a simple interface for adding and managing DNS records.
## Heroscript Examples
The following examples demonstrate how to define DNS records using heroscript actions:
### A Record
```
!!dns.a_record
sub_domain: 'host1'
@@ -16,6 +16,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### AAAA Record
```
!!dns.aaaa_record
sub_domain: 'host1'
@@ -24,6 +25,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### MX Record
```
!!dns.mx_record
sub_domain: '*'
@@ -33,6 +35,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### TXT Record
```
!!dns.txt_record
sub_domain: '*'
@@ -41,6 +44,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### SRV Record
```
!!dns.srv_record
service: 'ssh'
@@ -54,6 +58,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### NS Record
```
!!dns.ns_record
sub_domain: '@'
@@ -62,6 +67,7 @@ The following examples demonstrate how to define DNS records using heroscript ac
```
### SOA Record
```
!!dns.soa_record
mbox: 'hostmaster.example.com'
@@ -73,11 +79,10 @@ The following examples demonstrate how to define DNS records using heroscript ac
ttl: 300
```
## v
```v
import freeflowuniverse.herolib.osal.core.coredns
import incubaid.herolib.osal.core.coredns
// Create a new DNS record set
mut rs := coredns.new_dns_record_set()
@@ -96,12 +101,12 @@ rs.add_ns(host: 'ns2.example.net.')
rs.set('example.com')!
```
## Record Types
The following DNS record types are supported:
### SRV Record
```v
SRVRecord {
target string // Required: Target hostname
@@ -113,6 +118,7 @@ SRVRecord {
```
### TXT Record
```v
TXTRecord {
text string // Required: Text content
@@ -121,6 +127,7 @@ TXTRecord {
```
### MX Record
```v
MXRecord {
host string // Required: Mail server hostname
@@ -130,6 +137,7 @@ MXRecord {
```
### A Record
```v
ARecord {
name string // Required: Hostname
@@ -139,6 +147,7 @@ ARecord {
```
### AAAA Record
```v
AAAARecord {
name string // Required: Hostname
@@ -148,6 +157,7 @@ AAAARecord {
```
### NS Record
```v
NSRecord {
host string // Required: Nameserver hostname
@@ -156,6 +166,7 @@ NSRecord {
```
### SOA Record
```v
SOARecord {
mbox string // Required: Email address of the admin
@@ -167,5 +178,3 @@ SOARecord {
ttl int // Default: 300
}
```

View File

@@ -1,6 +1,6 @@
module coredns
import freeflowuniverse.herolib.core.redisclient
import incubaid.herolib.core.redisclient
// // Input parameter structs for each record type

View File

@@ -1,6 +1,6 @@
module coredns
import freeflowuniverse.herolib.core.playbook
import incubaid.herolib.core.playbook
// play_dns processes DNS-related actions from heroscript
pub fn play_dns(mut plbook playbook.PlayBook) !DNSRecordSet {

View File

@@ -1,6 +1,6 @@
module coredns
import freeflowuniverse.herolib.core.redisclient
import incubaid.herolib.core.redisclient
import x.json2
// new_dns_record_set creates a new DNSRecordSet

View File

@@ -19,7 +19,7 @@ Create a file `example.vsh`:
```v
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.osal.core.hostsfile
import incubaid.herolib.osal.core.hostsfile
import os
// Create a new instance by reading the hosts file

View File

@@ -1,7 +1,7 @@
module hostsfile
import os
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
const hosts_file_path = '/etc/hosts'

View File

@@ -1,6 +1,6 @@
module linux
import freeflowuniverse.herolib.core.playbook { PlayBook }
import incubaid.herolib.core.playbook { PlayBook }
pub fn play(mut plbook PlayBook) ! {
if !plbook.exists(filter: 'usermgmt.') {

View File

@@ -2,8 +2,8 @@ module linux
import os
import json
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.ui.console
@[params]
pub struct UserCreateArgs {

View File

@@ -16,7 +16,7 @@ A file system notification system for V that provides real-time monitoring of fi
## Usage Example
```v
import freeflowuniverse.herolib.osal.notifier
import incubaid.herolib.osal.notifier
// Define callback function for file events
fn on_file_change(event notifier.NotifyEvent, path string) {

View File

@@ -1,7 +1,7 @@
module osinstaller
import os
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
pub fn (s ServerManager) raid_stop() !bool {
if !os.exists('/proc/mdstat') {

View File

@@ -1,7 +1,7 @@
module osinstaller
import os
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
// import json
// import maxux.vssh

View File

@@ -1,8 +1,8 @@
module rsync
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
import incubaid.herolib.osal.core as osal
@[params]
pub struct RsyncArgs {

View File

@@ -1,6 +1,6 @@
module rsync
import freeflowuniverse.herolib.core.pathlib
import incubaid.herolib.core.pathlib
pub struct UserManager {
pub mut:

View File

@@ -1,12 +1,12 @@
module screen
// import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.texttools
// import freeflowuniverse.herolib.screen
// import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.texttools
// import incubaid.herolib.screen
import os
import time
// import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.core as osal
// import incubaid.herolib.ui.console
import incubaid.herolib.osal.core as osal
@[heap]
pub struct ScreensFactory {

View File

@@ -9,7 +9,7 @@ Create a file `screen_example.vsh`:
```v
#!/usr/bin/env -S v run
import freeflowuniverse.herolib.osal.screen
import incubaid.herolib.osal.screen
// Create a new screen factory
mut sf := screen.new()!

View File

@@ -1,8 +1,8 @@
module screen
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core
import incubaid.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core
import os
import time

View File

@@ -1,6 +1,6 @@
module sshagent
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
// Check if SSH agent is properly configured and all is good
pub fn agent_check(mut agent SSHAgent) ! {

View File

@@ -1,7 +1,7 @@
module sshagent
import freeflowuniverse.herolib.builder
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.builder
import incubaid.herolib.ui.console
// push SSH public key to a remote node's authorized_keys
pub fn (mut agent SSHAgent) push_key_to_node(mut node builder.Node, key_name string) ! {

View File

@@ -1,7 +1,7 @@
module sshagent
import os
import freeflowuniverse.herolib.core.pathlib
import incubaid.herolib.core.pathlib
@[params]
pub struct SSHAgentNewArgs {

View File

@@ -1,6 +1,6 @@
module sshagent
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.core.texttools
@[params]
pub struct KeyGetArgs {

View File

@@ -1,6 +1,6 @@
module sshagent
import freeflowuniverse.herolib.core.playbook { PlayBook }
import incubaid.herolib.core.playbook { PlayBook }
pub fn play(mut plbook PlayBook) ! {
if !plbook.exists(filter: 'sshagent.') {

View File

@@ -19,7 +19,7 @@ SSH agent management library for V language. Provides secure key handling, agent
## Quick Start
```v
import freeflowuniverse.herolib.osal.sshagent
import incubaid.herolib.osal.sshagent
mut agent := sshagent.new()!
mut key := agent.generate('my_key', '')!
@@ -58,7 +58,7 @@ agent.reset()!
### Remote
```v
import freeflowuniverse.herolib.builder
import incubaid.herolib.builder
mut node := builder.node_new(ipaddr: 'user@remote:22')!
agent.push_key_to_node(mut node, 'my_key')!

View File

@@ -1,7 +1,7 @@
module sshagent
import os
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.core.texttools
// Security validation functions for SSH agent operations

View File

@@ -1,8 +1,8 @@
module sshagent
import os
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
@[heap]
pub struct SSHAgent {

View File

@@ -1,7 +1,7 @@
module sshagent
import os
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
// Test helper to create temporary directory for testing
fn setup_test_env() !string {

View File

@@ -1,8 +1,8 @@
module sshagent
import os
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
@[heap]
pub struct SSHKey {

View File

@@ -16,11 +16,11 @@ The `ZProcessNewArgs` struct defines the parameters for creating and managing a
You can initialize the `StartupManager` in a few ways:
1. **Automatic Detection (Recommended):**
1. **Automatic Detection (Recommended):**
The manager will automatically detect if `zinit` is available and use it, otherwise it defaults to `screen`.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get(cat:.screen)!
@@ -29,11 +29,11 @@ You can initialize the `StartupManager` in a few ways:
}
```
2. **Explicitly Specify Type:**
2. **Explicitly Specify Type:**
You can force the manager to use a specific type.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm_zinit := startupmanager.get(cat: .zinit)!
@@ -56,7 +56,7 @@ The following examples demonstrate how to use the `StartupManager` to interact w
This method creates and optionally starts a new process.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -111,7 +111,7 @@ fn main() {
Starts an existing process.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -125,7 +125,7 @@ fn main() {
Stops a running process.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -139,7 +139,7 @@ fn main() {
Restarts a process.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -153,7 +153,7 @@ fn main() {
Removes a process from the startup manager.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -167,7 +167,7 @@ fn main() {
Returns the current status of a process.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -181,7 +181,7 @@ fn main() {
Returns `true` if the process is active, `false` otherwise.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -195,7 +195,7 @@ fn main() {
Retrieves the output (logs) of a process. Currently supported for `systemd`.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get(startupmanager.StartupManagerArgs{cat: .systemd})!
@@ -209,7 +209,7 @@ fn main() {
Returns `true` if the process is known to the startup manager, `false` otherwise.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
@@ -223,10 +223,10 @@ fn main() {
Returns a list of names of all services managed by the startup manager.
```v
import freeflowuniverse.herolib.osal.startupmanager
import incubaid.herolib.osal.startupmanager
fn main() {
mut sm := startupmanager.get()!
services := sm.list()!
println("Managed services: ${services}")
}
}

View File

@@ -1,10 +1,10 @@
module startupmanager
import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.screen
import freeflowuniverse.herolib.osal.systemd
// import freeflowuniverse.herolib.osal.zinit // Comment or remove this line
import freeflowuniverse.herolib.clients.zinit // Add this line
import incubaid.herolib.ui.console
import incubaid.herolib.osal.screen
import incubaid.herolib.osal.systemd
// import incubaid.herolib.osal.zinit // Comment or remove this line
import incubaid.herolib.clients.zinit // Add this line
pub struct StartupManager {
pub mut:

View File

@@ -1,8 +1,8 @@
module startupmanager
// import freeflowuniverse.herolib.ui.console
import freeflowuniverse.herolib.osal.screen
// import freeflowuniverse.herolib.osal.systemd
// import incubaid.herolib.ui.console
import incubaid.herolib.osal.screen
// import incubaid.herolib.osal.systemd
import os
import time

View File

@@ -1,6 +1,6 @@
module systemd
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
// Add more flexible journalctl options
@[params]

View File

@@ -13,7 +13,7 @@ A V module for managing systemd services with comprehensive error handling and m
## Quick Start
```v
import freeflowuniverse.herolib.lib.osal.systemd
import incubaid.herolib.lib.osal.systemd
// Create systemd factory
mut systemd := systemd.new()!
@@ -251,4 +251,4 @@ mut web_service := systemd.new(
```v
// Test module
vtest ~/code/github/incubaid/herolib/lib/osal/systemd/systemd_process_test.v
vtest ~/code/github/incubaid/herolib/lib/osal/systemd/systemd_process_test.v

View File

@@ -1,9 +1,9 @@
module systemd
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.pathlib
import incubaid.herolib.core.texttools
import incubaid.herolib.ui.console
__global (
systemd_global []&Systemd

View File

@@ -2,9 +2,9 @@ module systemd
// import os
import maps
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
import os
import time

View File

@@ -2,9 +2,9 @@ module systemd
// import os
import maps
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.pathlib
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.pathlib
import incubaid.herolib.ui.console
import os
pub fn testsuite_begin() ! {

View File

@@ -2,8 +2,8 @@ module main
import os
import io
import freeflowuniverse.herolib.core.logger
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.core.logger
import incubaid.herolib.core.texttools
struct Args {
mut:

View File

@@ -1,9 +1,9 @@
module tmux
import freeflowuniverse.herolib.core.playbook { PlayBook }
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.core.playbook { PlayBook }
import incubaid.herolib.core.texttools
import incubaid.herolib.osal.core as osal
import incubaid.herolib.ui.console
pub fn play(mut plbook PlayBook) ! {
if !plbook.exists(filter: 'tmux.') {

View File

@@ -1,12 +1,12 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.core.redisclient
// import freeflowuniverse.herolib.session
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.texttools
import incubaid.herolib.core.redisclient
// import incubaid.herolib.session
import os
import time
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
@[heap]
pub struct Tmux {

View File

@@ -1,8 +1,8 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.data.ourtime
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.data.ourtime
import incubaid.herolib.ui.console
import time
import os

View File

@@ -1,8 +1,8 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.texttools
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.texttools
import incubaid.herolib.ui.console
import time
// Check if error message indicates tmux server is not running

View File

@@ -1,9 +1,9 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.texttools
import os
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
@[heap]
struct Session {

View File

@@ -1,6 +1,6 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
import rand
fn testsuite_begin() {

View File

@@ -1,10 +1,10 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
import crypto.md5
import json
import time
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
// Command state structure for Redis storage
pub struct CommandState {

View File

@@ -1,9 +1,9 @@
module tmux
import freeflowuniverse.herolib.osal.core as osal
// import freeflowuniverse.herolib.installers.tmux
import incubaid.herolib.osal.core as osal
// import incubaid.herolib.installers.tmux
import os
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
const testpath = os.dir(@FILE) + '/testdata'

View File

@@ -1,9 +1,9 @@
module tmux
import os
import freeflowuniverse.herolib.osal.core as osal
import incubaid.herolib.osal.core as osal
import time
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.ui.console
@[heap]
struct Window {

View File

@@ -5,6 +5,7 @@ This module provides functionality to manage Traefik configurations using Redis
## Overview
The module allows you to:
- Define HTTP/HTTPS routes
- Configure backend services
- Set up middlewares
@@ -14,7 +15,7 @@ The module allows you to:
## Usage Example
```v
import freeflowuniverse.herolib.osal.core.traefik
import incubaid.herolib.osal.core.traefik
fn main() ! {
// Create a new Traefik configuration
@@ -73,6 +74,7 @@ The module uses the following Redis key structure as per Traefik's KV store spec
## Configuration Types
### Router Configuration
```v
RouteConfig {
name: string // Router name
@@ -85,6 +87,7 @@ RouteConfig {
```
### Service Configuration
```v
ServiceConfig {
name: string
@@ -101,6 +104,7 @@ ServerConfig {
```
### Middleware Configuration
```v
MiddlewareConfig {
name: string
@@ -110,6 +114,7 @@ MiddlewareConfig {
```
### TLS Configuration
```v
TLSConfig {
domain: string // Domain name

View File

@@ -1,7 +1,7 @@
module traefik
import json
import freeflowuniverse.herolib.core.redisclient
import incubaid.herolib.core.redisclient
// new_traefik_config creates a new TraefikConfig
pub fn new_traefik_config() TraefikConfig {

View File

@@ -5,12 +5,16 @@ This module provides functionality to manage TUN (network tunnel) interfaces on
## Functions
### available() !bool
Checks if TUN/TAP functionality is available on the system:
- Linux: Verifies `/dev/net/tun` exists and is a character device
- macOS: Checks for `utun` interfaces using `ifconfig` and `sysctl`
### free() !string
Returns the name of an available TUN interface:
- Linux: Returns first available interface from tun0-tun10
- macOS: Returns next available utun interface number
@@ -20,7 +24,7 @@ Returns the name of an available TUN interface:
#!/usr/bin/env -S v -n -w -gc none -cc tcc -d use_openssl -enable-globals run
import freeflowuniverse.herolib.osal.core.tun
import incubaid.herolib.osal.core.tun
// Check if TUN is available
@@ -57,6 +61,7 @@ The module automatically detects the platform (Linux/macOS) and uses the appropr
## Error Handling
Both functions return a Result type, so errors should be handled appropriately:
- Unsupported platform errors
- Interface availability errors
- System command execution errors
- System command execution errors

View File

@@ -1,7 +1,7 @@
module tun
import os
import freeflowuniverse.herolib.core
import incubaid.herolib.core
// available checks if TUN/TAP is available on the system
pub fn available() !bool {

View File

@@ -1,7 +1,7 @@
module ubuntu
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.core.texttools
import incubaid.herolib.osal.core as osal
import incubaid.herolib.core.texttools
import net.http
import os
import time

View File

@@ -1,7 +1,7 @@
module ufw
import freeflowuniverse.herolib.core.playbook
import freeflowuniverse.herolib.data.paramsparser
import incubaid.herolib.core.playbook
import incubaid.herolib.data.paramsparser
pub fn play_ufw(mut plbook playbook.PlayBook) !RuleSet {
mut ufw_status := UFWStatus{

View File

@@ -1,7 +1,7 @@
module ufw
import freeflowuniverse.herolib.osal.core as osal
import freeflowuniverse.herolib.ui.console
import incubaid.herolib.osal.core as osal
import incubaid.herolib.ui.console
import os
pub fn reset() ! {