FCLI is a powerful, extensible, and thread-safe command-line interface (CLI) tool for interacting with APIs, particularly those following the Farcaster hub protocol. It allows users to query data, execute commands, and dynamically configure hub addresses with ease. Designed with modern C++ standards (C++23), it ensures high performance and stability.
- Dynamic Hub Configuration: Supports setting custom hub addresses via commands.
- Thread-Safe Operations: Ensures reliable and safe execution in multi-threaded environments.
- JSON Pretty-Printing: Parses and formats JSON responses for better readability.
- Verbose Mode: Enables detailed debugging information for API requests.
- Extensibility: Built with modular design principles, allowing easy addition of new features.
- C++23-compatible compiler (e.g., GCC 12+, Clang 16+)
libcurlfor HTTP requestsjsoncppfor JSON parsing- CMake 3.25+ for building the project
-
Clone the Repository:
git clone https://github.com/genyleap/FCLI.git cd FCLI -
Configure and Build:
mkdir build && cd build cmake .. cmake --build .
-
Run the Executable:
./fcli help
-
Fetch Hub Information:
./fcli /v1/info dbstats=1
Example Output:
[INFO] Executing command with URL: https://hub.pinata.cloud/v1/info?dbstats=1 [INFO] Response: { "version": "1.0.0", "dbStats": { "collections": 12, "documents": 456789 } } -
Set Custom Hub Address:
./fcli set-hub https://hub.pinata.cloud
Example Output:
[INFO] Hub URL updated to: https://hub.pinata.cloud -
Help:
./fcli helpExample Output:
[INFO] Available Commands: /v1/info - Fetch hub information. /v1/reactions - Fetch reactions for a cast or user. set-hub <hub_url> - Set a custom hub address. Example: ./fcli /v1/info dbstats=1 ./fcli set-hub https://hub.pinata.cloud ./fcli /v1/reactions query="hello world" cursor="a&b=c%20" -
Encoded Query Parameters (spaces/symbols):
./fcli /v1/reactions query="hello world" cursor="a&b=c%20"
Example Request URL:
[INFO] Executing command with URL: https://hub.pinata.cloud/v1/reactions?cursor=a%26b%3Dc%2520&query=hello%20world -
Real Farcaster Hub Smoke Request:
./fcli /v1/info dbstats=1 --verbose
Example Output (truncated):
[INFO] Executing command with URL: https://hub.pinata.cloud/v1/info?dbstats=1 [JSON] { "version": "...", ... } -
Explicitly Set Pinata Hub Then Query:
./fcli set-hub https://hub.pinata.cloud ./fcli /v1/info dbstats=1 --verbose
Example Request URL:
[INFO] Executing command with URL: https://hub.pinata.cloud/v1/info?dbstats=1
cmake -S . -B build -DENABLE_TESTING=ON
cmake --build build --target fcli_network_query_string_test fcli_farcaster_live_smoke_test fcli_farcaster_hub_info_variants_test
ctest --test-dir build -R network_query_string_test --output-on-failureRun the live Farcaster integration tests explicitly:
FCLI_RUN_LIVE_FARCASTER_TEST=1 ctest --test-dir build -R farcaster_ --output-on-failureFCLI/
├── tests/
│ ├── network_query_string_test.cpp # Query string encoding test
│ ├── farcaster_live_smoke_test.cpp # Optional live Farcaster integration test
│ └── farcaster_hub_info_variants_test.cpp # Live /v1/info coverage on hub.pinata.cloud
├── source/
│ ├── logger.cpp # Implementation of Logger class
│ ├── network.cpp # Implementation of Network class
│ ├── fcli.cpp # Implementation of FCLI class
│ ├── logger.hpp # Thread-safe logging utilities
│ ├── network.hpp # Network request handler
│ ├── fcli.hpp # CLI logic
├── CMakeLists.txt # Build configuration
├── README.md # Project documentation
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature" - Push to the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by C O M P Ξ Z (compez.eth) as part of the Genyleap initiative. 🎉
- libcurl for HTTP requests
- jsoncpp for JSON parsing
- The Farcaster ecosystem for their open API standards
---