How skeletonkey/joplin_alfred_workflow works
Main Components
• Alfred User Interface: Represented by the Alfred Workflow which captures commands (e.g., “jn”, “js”, “jt”) from the user.
• Perl Script Executor: This set includes create_note.pl, find_folder.pl, search_notes.pl – each responsible for handling a different functionality.
• Perl Modules: The code under perl_modules (e.g., Joplin.pm, JSON.pm, and modules under Jundy) provides reusable functionality. They encapsulate the underlying logic (JSON parsing, interacting with Curl, formatting commands for Alfred).
• External Joplin API: The workflow communicates with Joplin via its API; the user must enable the Web Clipper in Joplin to allow this.
• External Tools: You have dependencies such as Curl and Perl 5 with the JSON module.
Relationships and Interactions
• User Interaction Flow: The user inputs a command in Alfred, which is intercepted by the Alfred Workflow.
• Command Processing: Based on the command (create note, search for notes, search for titles), Alfred triggers the corresponding Perl script.
• Script Execution: The Perl scripts call functions within the custom Perl modules. They use Curl to send HTTP requests to Joplin’s API endpoint, including authentication through the provided token from Joplin’s settings.
• Data Flow: The API response (JSON) is parsed by the Perl modules and formatted by the scripts to display results or confirm creation within Alfred.
Architectural Patterns and Design Principles
• Separation of Concerns: The workflow separates user interface handling (Alfred) from business logic (Perl scripts and modules). Each script is specialized for a particular command.
• Modularization: Reusable Perl modules encapsulate common functionality (JSON processing, HTTP requests for Alfred workflow filtering), making the system easier to extend or maintain.
• Dependency Injection: Although not explicitly structured as injection, the reliance on external modules (like Curl’s usage and JSON capability provided in perl_modules) outlines a loosely coupled architecture.
Relevant Technologies and Their Roles
• Alfred Workflow: The integration point with the user, handling input and output via Alfred’s interface.
• Perl 5: Script language executing core functionalities.
• Curl: Utility for sending HTTP requests to the Joplin API.
• Joplin API: The endpoint for creating and searching notes, which requires specific configurations (i.e., enabling the Web Clipper and using the provided port and token).
• JSON Module: Used for encoding/decoding data during API transactions.