How mrmoneyc/slack-exporter works
Main Components
• Command-Line Interface (CLI) and Entry Point:
• Main binary (located in cmd/slack-exporter/main.go) as the starting point of the application.
• This component is responsible for bootstrapping the application, handling user-supplied command options (like configuration paths and verbosity), and triggering the export process.
• Configuration Management:
• Configuration module (pkg/config/config.go) which reads and parses the config.yaml file.
• That configuration details (API tokens, request delay, export base path, etc.) are provided either via the default file or via command-line parameters.
• Exporter Logic:
▪ Channel Exporter (pkg/exporter/channel.go) – handles exporting channels and their metadata.
▪ File Exporter (pkg/exporter/file.go) – manages downloading and saving files linked in messages.
▪ Message Exporter (pkg/exporter/message.go) – processes the conversation history, including threaded replies.
▪ User Exporter (pkg/exporter/user.go) – exports user profiles and participation information.
• Modules as part of the overall export pipeline.
• Archival Module:
• Archiver component (pkg/archiver/zip.go) which packages exported data into a ZIP archive if enabled in the configuration.
• Command Routing & Utility Functions:
• Package structure inside pkg/cmd (including modules like root.go and version.go) which likely supports CLI command parsing, global flags, and version management.
• External Dependencies and Integrations:
• Slack API as an external service/component.
Relationships and Interactions
• Next, represent a flow from the CLI to the command routing/logic component (pkg/cmd) which directs application behavior based on input options.
• Exporter components side by side and show how each specific exporter (channel, file, message, user) is invoked as part of the export process.
• Exporter components to the external Slack API (illustrating API calls and data retrieval).
• If the ArchiveData option is enabled, show a subsequent step routing data into the Archiver module (pkg/archiver) that prepares a ZIP file of the export.
Architectural Patterns and Design Principles
• Modular Design: The project is structured into distinct modules (configuration, exporter, archiver, command routing) which are cleanly separated and interoperate through well-defined interfaces.
• Single Binary / CLI Tool: Highlight that all components are packaged into one CLI application, with command-line arguments determining operational modes (e.g., specifying alternate configuration files or log verbosity).
Relevant Technologies/Frameworks
• Mention that continuous integration is set up through GitHub Workflows (.github/workflows/release.yml) though this does not directly affect runtime architecture.
• The Makefile and scripts (like scripts/run.bat) are used for building and running the tool in different environments.
Emphasize
• Each component’s role and its dependencies should be clearly marked.
• The overall workflow—from reading config and accepting CLI commands, interfacing with Slack, processing data, to final archiving—should be sequentially represented.
• Use additional annotations (such as notes or legends) for any conditional flows like using an alternative config file or changing logging verbosity.