This guide covers the recommended IDEs, editor configuration, required development tools, and environment variables for contributing to MeshAgent.
VS Code works well for both the C/C++ native code and the JavaScript modules.
Recommended extensions:
| Extension | Publisher | Purpose |
|---|---|---|
| C/C++ | Microsoft | IntelliSense, debugging, code navigation for C/C++ |
| C/C++ Extension Pack | Microsoft | CMake, themes, and full C/C++ suite |
| clangd | LLVM | Fast code completion and diagnostics |
| EditorConfig for VS Code | EditorConfig | Consistent formatting across contributors |
| GitLens | GitKraken | Enhanced Git history and blame |
| ESLint | Microsoft | JavaScript linting |
Workspace settings (.vscode/settings.json):
{
"editor.formatOnSave": false,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"C_Cpp.intelliSenseEngine": "default",
"files.associations": {
"*.h": "c",
"*.c": "c"
}
}For Windows-native development, Visual Studio 2019 or 2022 provides the full MSVC toolchain along with built-in debugger support for the Windows KVM engine (GDI/DXGI), Windows service host (meshservice/), and Windows cryptography (wincrypto).
For macOS KVM development involving CoreGraphics, TCC permission handling, and LaunchAgent integration, Xcode provides the best debugging experience for system-level APIs.
| Tool | Version | Installation |
|---|---|---|
gcc or clang |
7.0+ | System package manager (see Prerequisites) |
make |
4.0+ | System package manager |
gdb or lldb |
Any | GNU Debugger (gdb) for Linux, lldb for macOS |
valgrind |
3.x+ | Memory leak detection (Linux) |
strace / dtrace |
Any | System call tracing |
| Tool | Version | Installation |
|---|---|---|
| Node.js | 18+ | https://nodejs.org or via nvm |
| npm | 9+ | Included with Node.js |
Install Node.js via nvm (recommended for managing versions):
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell, then install Node.js 18
nvm install 18
nvm use 18
# Verify
node --version
npm --versionThe MeshAgent bundles OpenSSL 1.1.1f headers in openssl-1.1.1f/, but system OpenSSL headers are also referenced. Install development headers:
# Ubuntu/Debian
sudo apt-get install libssl-dev
# macOS (via Homebrew)
brew install openssl
# Red Hat / Fedora
sudo dnf install openssl-develThe following environment variables influence the build and runtime behavior of MeshAgent.
| Variable | Description | Example |
|---|---|---|
CC |
C compiler override | CC=clang make |
CXX |
C++ compiler override | CXX=clang++ make |
CFLAGS |
Additional C compiler flags | CFLAGS="-g -O0" for debug builds |
LDFLAGS |
Additional linker flags | LDFLAGS="-L/usr/local/lib" |
OPENSSL_DIR |
Override OpenSSL installation path | /usr/local/opt/openssl |
Build with debug symbols and no optimization:
CFLAGS="-g -O0" make| Variable | Description |
|---|---|
MESH_AGENT_PORT |
Override default agent port (default: 16990) |
MESH_DEBUG |
Enable additional runtime debug output when set |
| Variable | Description |
|---|---|
OPENFRAME_TOKEN_PATH |
Path to the AES-256 encrypted token file (default: /etc/openframe/token.txt) |
OPENFRAME_SECRET |
32-byte AES-256 key for token decryption |
Security Note: Never commit
OPENFRAME_SECRETor any decryption keys to source control. Use your environment's secrets manager.
MeshAgent follows a consistent C code style. Create or reference a .editorconfig at the project root:
root = true
[*.{c,h}]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.js]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[Makefile]
indent_style = tab
Build with debug symbols:
CFLAGS="-g -O0" makeLaunch under GDB:
gdb ./meshagent
(gdb) run
(gdb) bt # backtrace on crash
(gdb) info localsAttach to a running agent process:
gdb -p $(pidof meshagent)lldb ./meshagent
(lldb) run
(lldb) bt # backtrace
(lldb) frame variableThe embedded Duktape engine supports remote debugging via a TCP socket. Enable it by setting jsDebugPort in the agent's data store:
jsDebugPort=9090
Connect with a Duktape-compatible debugger client on localhost:9090. The VS Code Duktape Debugger extension (HaroldBrenes.duk-debug) can attach to this port.
# Verify C compiler
gcc --version || clang --version
# Verify make
make --version
# Verify Node.js
node --version && npm --version
# Verify OpenSSL headers present
ls /usr/include/openssl/ssl.h 2>/dev/null || \
ls /usr/local/opt/openssl/include/openssl/ssl.h 2>/dev/null && \
echo "OpenSSL headers found"
# Verify repository clone is complete
ls meshcore/agentcore.h microstack/ILibAsyncSocket.h microscript/duktape.hAll commands should complete without errors before beginning development.
For environment setup issues, reach out in the OpenMSP Slack: