How maciejsmolinski/orchy works
Project type and purpose
• Orchy is a small, single‐process “webhook manager” CLI tool that spins up an HTTP server on Node.js (8181 by default) and, upon receiving an authenticated request, reads a JSON configuration, executes shell commands, logs output, and optionally posts to Slack.
• Built in PureScript, compiled via Spago → esbuild into a single Node.js bundle with zero npm dependencies at runtime.
File structure
Top‐level files & dirs:
• configuration.json.example – sample JSON definitions of “hooks.”
• package.json / spago.dhall / packages.dhall – build & dependency config for PureScript & esbuild.
• src/
– Main.purs → entrypoint, boots the HTTP server.
– HTTP/Server.purs & HTTP/Client.purs (.js FFI counterparts) → request parsing, routing, HTTP logic.
– Orchestrator/Main.purs (.js FFI in Orchestrator/FS.js) → read & parse configuration.json, select definition.
– System/Commands.purs (.js FFI in System/Commands.js) → spawn shell commands, capture results.
– Notifications/Slack.purs → format & POST messages to Slack.
– Logger.purs → unified logging facade.
– Utilities under HTTP/Utils.purs, System/Environment.purs.
• test/ → PureScript test modules for HTTP client, orchestrator, main logic.
Extract insights from README
• HTTP endpoints:
• GET /run?definition=<id>&secret=<token>
• Env vars: PORT, SLACK_HOOK_URL, SLACK_CHANNEL.
• Error and success flows all use structured console logging.
• Modes: local dev via spago bundle-app --platform=node -w + nodemon.