- Feature Name: terminal-coffee-integration
- Start Date: 2025-03-13
- RFC PR: (leave blank until submitted)
- Implementation PR: (leave blank until implemented)
This RFC proposes integrating the 'terminal' coffee shop (an online shop accessible via SSH) with the Dune build system. This integration will allow developers to order coffee directly from their build environment, improving developer experience and productivity by streamlining the coffee procurement process.
Developers often require caffeine during long build sessions. Currently, acquiring coffee requires context switching away from the development environment, resulting in reduced productivity and focus. By integrating the 'terminal' coffee shop directly into the Dune build system, developers can:
- Order coffee without leaving their terminal environment
- Schedule coffee deliveries to coincide with build completions
- Maintain build context and focus while ensuring adequate caffeine supply
- Track coffee consumption alongside build metrics
This integration aligns with Dune's philosophy of providing a comprehensive, unified development experience while addressing the critical developer need for convenient caffeine access.
After implementation, developers will be able to order coffee using Dune commands:
$ dune coffee order --beverage americano --size large
The system will authenticate with the 'terminal' coffee shop via SSH, place the order, and return order confirmation and estimated delivery time. Developers can also configure preferences in their dune-project
file:
(coffee_preferences
(default_beverage espresso)
(default_size medium)
(payment_method store_credit))
Build rules can include coffee dependencies:
(rule
(targets complex_module.ml)
(deps source_data.csv (coffee americano large))
(action (run ./generate_module.sh %{deps})))
This would ensure that an americano is ordered and delivered before or during the execution of complex builds.
- SSH Client Module: A Dune module that handles SSH connections to the 'terminal' coffee shop server
- Order Processing Interface: Translates Dune commands into coffee shop API requests
- Authentication Manager: Securely stores and manages SSH credentials
- Build Integration Layer: Allows expressing coffee dependencies in build specifications
The integration will use the existing SSH protocol to communicate with the 'terminal' coffee shop server:
module Terminal_coffee = struct
type credentials = {
username : string;
password : string option;
key_file : string option;
}
type order = {
beverage : string;
size : string;
options : string list;
}
(* Establish SSH connection to terminal coffee shop *)
let connect credentials =
(* Implementation details for SSH connection *)
...
(* Send order via established SSH connection *)
let place_order conn order =
(* Implementation details for order placement *)
...
end
The build system will be extended to recognize coffee-related dependencies:
let coffee_dependency =
let+ syntax = Dune_lang.Syntax.get_exn Stanza.syntax (3, 5) in
let+ beverage = field "beverage" string in
let+ size = field "size" string in
Coffee { beverage; size }
When a coffee dependency is encountered during build planning:
- The build system will check if the ordered coffee has already been delivered
- If not, it will place the order via SSH to the 'terminal' coffee shop
- It will then either wait for delivery confirmation or proceed with the build, depending on configuration
- Delivery status will be tracked and can trigger notifications
Developers can configure their coffee preferences in ~/.config/dune/coffee_config
:
(terminal_coffee
(credentials
(username developer1)
(key_file ~/.ssh/coffee_id_rsa))
(preferences
(default_beverage espresso)
(default_size medium)
(auto_order_threshold 2h)))
- Adds complexity to the Dune build system
- Requires secure management of 'terminal' coffee shop credentials
- May lead to excessive coffee consumption during recursive builds
- Integration maintenance adds overhead to Dune development
This design leverages existing SSH communication, making integration relatively straightforward. It follows Dune's philosophy of declarative build specifications and provides a natural way to express coffee dependencies.
- Web API Integration: Could use HTTP/REST instead of SSH, but wouldn't align with the terminal-centric philosophy
- Standalone Tool: Could develop a separate coffee ordering tool, but would miss integration benefits
- Plugin System: Could implement as an optional plugin, reducing core complexity but increasing setup friction
The SSH-based direct integration provides the best balance of developer experience and implementation complexity.
Other systems have implemented similar productivity-enhancing integrations:
- The
coffee
protocol (RFC 2324 and 7168) - Various IDE extensions for food delivery services
- ChatGPT's integration with Doordash for meal ordering
However, this would be the first build system to directly integrate coffee ordering.
- How to handle failed deliveries that block critical builds?
- What is the appropriate timeout for waiting on coffee deliveries?
- Should the system support team orders for collaborative builds?
- How to handle differing coffee preferences in distributed build environments?
Once implemented, this integration could expand to include:
- Snack ordering for extended build sessions
- Coffee consumption analytics correlated with build performance
- Automatic ordering based on build complexity prediction
- Integration with other developer-focused service providers