diff --git a/functions/shell/run_cmd.go b/functions/shell/run_cmd.go new file mode 100644 index 00000000..a2b31c25 --- /dev/null +++ b/functions/shell/run_cmd.go @@ -0,0 +1,9 @@ +package shell + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// Run ejecuta un comando del sistema con timeout de 30 segundos y devuelve el resultado. +func Run(name string, args ...string) Result[CmdResult] { + // stub — implementation in devfactory/shell + return Result[CmdResult]{} +} diff --git a/functions/shell/run_cmd.md b/functions/shell/run_cmd.md new file mode 100644 index 00000000..ea99a411 --- /dev/null +++ b/functions/shell/run_cmd.md @@ -0,0 +1,31 @@ +--- +name: run_cmd +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: impure +signature: "func Run(name string, args ...string) core.Result[CmdResult]" +description: "Ejecuta un comando del sistema con timeout de 30 segundos y devuelve el resultado." +tags: [shell, command, process, exec] +uses_functions: [] +uses_types: [cmd_result_go_shell, result_go_core] +returns: [result_go_core] +returns_optional: false +error_type: "error_go_core" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/run_cmd.go" +--- + +## Ejemplo + +```go +result := Run("ls", "-la") +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/functions/shell/run_cmd_timeout.go b/functions/shell/run_cmd_timeout.go new file mode 100644 index 00000000..557037f1 --- /dev/null +++ b/functions/shell/run_cmd_timeout.go @@ -0,0 +1,11 @@ +package shell + +import "time" + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// RunWithTimeout ejecuta un comando del sistema con timeout configurable. +func RunWithTimeout(name string, timeout time.Duration, args ...string) Result[CmdResult] { + // stub — implementation in devfactory/shell + return Result[CmdResult]{} +} diff --git a/functions/shell/run_cmd_timeout.md b/functions/shell/run_cmd_timeout.md new file mode 100644 index 00000000..491dc3a6 --- /dev/null +++ b/functions/shell/run_cmd_timeout.md @@ -0,0 +1,31 @@ +--- +name: run_cmd_timeout +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: impure +signature: "func RunWithTimeout(name string, timeout time.Duration, args ...string) core.Result[CmdResult]" +description: "Ejecuta un comando del sistema con timeout configurable." +tags: [shell, command, process, exec, timeout] +uses_functions: [] +uses_types: [cmd_result_go_shell, result_go_core] +returns: [result_go_core] +returns_optional: false +error_type: "error_go_core" +imports: [time] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/run_cmd_timeout.go" +--- + +## Ejemplo + +```go +result := RunWithTimeout("curl", 5*time.Second, "https://example.com") +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/functions/shell/run_pipe.go b/functions/shell/run_pipe.go new file mode 100644 index 00000000..947b3be0 --- /dev/null +++ b/functions/shell/run_pipe.go @@ -0,0 +1,9 @@ +package shell + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// RunPipe encadena multiples comandos con pipe y devuelve el resultado final. +func RunPipe(commands ...string) Result[CmdResult] { + // stub — implementation in devfactory/shell + return Result[CmdResult]{} +} diff --git a/functions/shell/run_pipe.md b/functions/shell/run_pipe.md new file mode 100644 index 00000000..17420706 --- /dev/null +++ b/functions/shell/run_pipe.md @@ -0,0 +1,31 @@ +--- +name: run_pipe +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: impure +signature: "func RunPipe(commands ...string) core.Result[CmdResult]" +description: "Encadena multiples comandos con pipe y devuelve el resultado final." +tags: [shell, command, process, pipe] +uses_functions: [] +uses_types: [cmd_result_go_shell, result_go_core] +returns: [result_go_core] +returns_optional: false +error_type: "error_go_core" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/run_pipe.go" +--- + +## Ejemplo + +```go +result := RunPipe("ls -la", "grep go", "wc -l") +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/functions/shell/run_shell.go b/functions/shell/run_shell.go new file mode 100644 index 00000000..5899ce53 --- /dev/null +++ b/functions/shell/run_shell.go @@ -0,0 +1,9 @@ +package shell + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// RunShell ejecuta un comando shell interpretado por /bin/sh. +func RunShell(command string) Result[CmdResult] { + // stub — implementation in devfactory/shell + return Result[CmdResult]{} +} diff --git a/functions/shell/run_shell.md b/functions/shell/run_shell.md new file mode 100644 index 00000000..8b3cfe11 --- /dev/null +++ b/functions/shell/run_shell.md @@ -0,0 +1,31 @@ +--- +name: run_shell +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: impure +signature: "func RunShell(command string) core.Result[CmdResult]" +description: "Ejecuta un comando shell interpretado por /bin/sh." +tags: [shell, command, process, exec] +uses_functions: [] +uses_types: [cmd_result_go_shell, result_go_core] +returns: [result_go_core] +returns_optional: false +error_type: "error_go_core" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/run_shell.go" +--- + +## Ejemplo + +```go +result := RunShell("ls -la | grep go") +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/functions/shell/run_shell_timeout.go b/functions/shell/run_shell_timeout.go new file mode 100644 index 00000000..90c0cca4 --- /dev/null +++ b/functions/shell/run_shell_timeout.go @@ -0,0 +1,11 @@ +package shell + +import "time" + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// RunShellTimeout ejecuta un comando shell con timeout configurable. +func RunShellTimeout(command string, timeout time.Duration) Result[CmdResult] { + // stub — implementation in devfactory/shell + return Result[CmdResult]{} +} diff --git a/functions/shell/run_shell_timeout.md b/functions/shell/run_shell_timeout.md new file mode 100644 index 00000000..22abd287 --- /dev/null +++ b/functions/shell/run_shell_timeout.md @@ -0,0 +1,31 @@ +--- +name: run_shell_timeout +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: impure +signature: "func RunShellTimeout(command string, timeout time.Duration) core.Result[CmdResult]" +description: "Ejecuta un comando shell con timeout configurable." +tags: [shell, command, process, exec, timeout] +uses_functions: [] +uses_types: [cmd_result_go_shell, result_go_core] +returns: [result_go_core] +returns_optional: false +error_type: "error_go_core" +imports: [time] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/run_shell_timeout.go" +--- + +## Ejemplo + +```go +result := RunShellTimeout("long-running-cmd", 30*time.Second) +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/functions/shell/which.go b/functions/shell/which.go new file mode 100644 index 00000000..3dcda7bc --- /dev/null +++ b/functions/shell/which.go @@ -0,0 +1,9 @@ +package shell + +// Implementation: github.com/lucasdataproyects/devfactory/shell + +// Which busca la ruta de un ejecutable en el PATH del sistema. Devuelve None si no existe. +func Which(name string) Option[string] { + // stub — implementation in devfactory/shell + return Option[string]{} +} diff --git a/functions/shell/which.md b/functions/shell/which.md new file mode 100644 index 00000000..599f3966 --- /dev/null +++ b/functions/shell/which.md @@ -0,0 +1,31 @@ +--- +name: which +kind: function +lang: go +domain: shell +version: "1.0.0" +purity: pure +signature: "func Which(name string) core.Option[string]" +description: "Busca la ruta de un ejecutable en el PATH del sistema. Devuelve None si no existe." +tags: [shell, path, lookup] +uses_functions: [] +uses_types: [option_go_core] +returns: [option_go_core] +returns_optional: false +error_type: "" +imports: [] +tested: false +tests: [] +test_file_path: "" +file_path: "functions/shell/which.go" +--- + +## Ejemplo + +```go +path := Which("docker") +``` + +## Notas + +Implementacion en devfactory/shell. diff --git a/types/shell/cmd_result.go b/types/shell/cmd_result.go new file mode 100644 index 00000000..37a65e64 --- /dev/null +++ b/types/shell/cmd_result.go @@ -0,0 +1,9 @@ +package shell + +// CmdResult almacena el resultado de ejecutar un comando del sistema. +// Implementation: github.com/lucasdataproyects/devfactory/shell +type CmdResult struct { + Stdout string + Stderr string + ExitCode int +} diff --git a/types/shell/cmd_result.md b/types/shell/cmd_result.md new file mode 100644 index 00000000..2eb1cc8d --- /dev/null +++ b/types/shell/cmd_result.md @@ -0,0 +1,21 @@ +--- +name: cmd_result +lang: go +domain: shell +version: "1.0.0" +algebraic: product +definition: | + type CmdResult struct { + Stdout string + Stderr string + ExitCode int + } +description: "Resultado de la ejecucion de un comando del sistema con stdout, stderr y codigo de salida." +tags: [shell, command, process, result] +uses_types: [] +file_path: "types/shell/cmd_result.go" +--- + +## Notas + +Tipo producto. Metodos Output(), Lines(), Success(), ToResult() disponibles sobre la instancia.