feat(ffi,core): shell spawn/kill + fs mkdir_p/copy_file with .eph wrappers#26
Merged
Merged
Conversation
4 tasks
…ppers
Adds four capability-gated FFI exports the upcoming Ephapax-wasm CLI port
needs but libgossamer didn't expose:
• gossamer_shell_spawn(command, cap_token) -> opaque*
Spawns a process in the background via /bin/sh -c (POSIX) or cmd /c
(Windows). Stdin/stdout/stderr inherit from the caller. Returns an
opaque handle valid only for gossamer_shell_kill.
• gossamer_shell_kill(opaque*, cap_token) -> Result
Sends SIGTERM (or TerminateProcess on Windows), waits for exit,
frees the wrapper. Idempotent on null.
• gossamer_fs_mkdir_p(path, cap_token) -> Result
Recursive mkdir; treats "already exists" as success.
• gossamer_fs_copy_file(src, dst, cap_token) -> Result
Copies a file, overwriting dst. Parent of dst must already exist.
All four go through the existing main.gossamer_cap_check /
gossamer_cap_resource_kind taxonomy: shell ops need Shell (kind=2), fs ops
need FileSystem (kind=0).
Shell.zig is a new file; filesystem.zig grows by two exports. The new
src/interface/ffi/src/shell.zig is wired into the comptime import block
in src/interface/ffi/src/main.zig so the exports actually land in
libgossamer's symbol table.
Ephapax wrappers added to src/core/ShellExec.eph (spawn / spawnKill) and
src/core/Filesystem.eph (mkdirP / copyFile) in the same legacy __ffi(...)
style as the existing functions in those files, so the surface is
consistent. (The v2-grammar rewrite of these modules is its own concern.)
Used by the gossamer CLI port:
• cmdDev: shell.spawn replaces cli/src/main.zig's
runShellCommandBackground for `beforeDevCommand`; spawnKill replaces
the manual std.process.Child.kill in the defer block.
• cmdBundle: fs.mkdirP creates target/bundle/deb/DEBIAN; fs.copyFile
places gossamer.conf.json inside the package layout.
Verified:
• zig ast-check on shell.zig, filesystem.zig, main.zig — all clean.
• Full link to GTK3/WebKitGTK requires those system dev libs which
aren't installed in this WSL env (pre-existing limitation); CI runs
the full build.
Phase 14a.3 of the gossamer cli (cli/) port to typed-wasm Ephapax.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
f730003 to
9d5f168
Compare
🔍 Hypatia Security ScanFindings: 31 issues detected
View findings[
{
"reason": "Issue in quality.yml",
"type": "missing_workflow",
"file": "quality.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Issue in security-policy.yml",
"type": "missing_workflow",
"file": "security-policy.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Action actions/upload-artifact@v4 needs attention",
"type": "unpinned_action",
"file": "release.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action actions/download-artifact@v4 needs attention",
"type": "unpinned_action",
"file": "release.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
"type": "believe_me",
"file": "/home/runner/work/gossamer/gossamer/src/interface/abi/IPCDispatch.idr",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
"type": "believe_me",
"file": "/home/runner/work/gossamer/gossamer/src/interface/abi/ResourceCleanup.idr",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
"type": "believe_me",
"file": "/home/runner/work/gossamer/gossamer/src/interface/abi/GrooveTermination.idr",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
"type": "believe_me",
"file": "/home/runner/work/gossamer/gossamer/src/interface/abi/HandleLinearity.idr",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "believe_me undermines formal verification (1 occurrences, CWE-704)",
"type": "believe_me",
"file": "/home/runner/work/gossamer/gossamer/src/interface/abi/WindowStateMachine.idr",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
2 tasks
hyperpolymath
added a commit
that referenced
this pull request
May 20, 2026
PRs #26 (shell + fs mkdir_p/copy_file) and #27 (conf JSON loader) merged before their CHANGELOG entries landed. Backfills both under [Unreleased] > Added in the same format as the existing Plugin-system (Phase 6) entry: a top-level bolded title with phase + PR number, followed by sub-bullets covering the FFI surface, capability gating, Ephapax wrapper, and CLI-port consumers. No code change. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four capability-gated FFI exports the upcoming Ephapax-wasm CLI port needs but libgossamer didn't expose:
gossamer_shell_spawn(command, cap)→opaque*/bin/sh -c(POSIX) orcmd /c(Windows).gossamer_shell_kill(opaque*, cap)→Resultgossamer_fs_mkdir_p(path, cap)→Resultgossamer_fs_copy_file(src, dst, cap)→ResultEphapax wrappers added to
src/core/ShellExec.eph(spawn/spawnKill) andsrc/core/Filesystem.eph(mkdirP/copyFile) in matching legacy__ffi(...)style.Why
Phase 14a.3 of porting the gossamer CLI to typed-wasm Ephapax. These are the gaps the CLI hits today:
cmdDev: needs background-spawn-then-kill for the user's frontend dev server. The currentcli/src/main.ziguses Zig-nativestd.process.Childdirectly, which won't be reachable from wasm.cmdBundle: needs recursive mkdir + file copy to assembletarget/bundle/deb/usr/share/<id>/. The current code uses Zig-nativestd.fs.cwd().makePath/copyFile.Once these exports exist, the wasm-host launcher (Phase 14a.5) only needs to dlopen libgossamer and forward the symbols — no Zig std reimplementation required on the wasm side.
Test plan
zig ast-checkonshell.zig,filesystem.zig,main.zig— all clean.Types.idrResourceKind.Notes
gossamer_shell_execute(run-to-completion, capture stdout) is not added here. That's already declared insrc/core/ShellExec.ephagainst a not-yet-implemented Zig symbol — a separate gap to close, not folded into this PR.__ffi(...)syntax in the.ephwrappers matches the existing functions in those files. Rewritingsrc/core/*.ephto v2 grammar (extern blocks) is a separate workstream.🤖 Generated with Claude Code