mattermost-plugin-shelfmark/README.md
Felipe M. e05ab1bc96
Add i18n support for user-facing messages and rewrite README
Replace hardcoded English strings throughout the plugin with localized
messages via a new i18n system supporting English and Spanish. Store the
requester's locale on the download task so background job messages are
properly localized. Replace the starter template README with
project-specific documentation covering features, usage, configuration,
and development.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 17:55:33 +01:00

100 lines
3.4 KiB
Markdown

# Mattermost Plugin Shelfmark
[![Build Status](https://git.nakama.town/fmartingr/mattermost-plugin-shelfmark/actions/workflows/ci.yml/badge.svg)](https://git.nakama.town/fmartingr/mattermost-plugin-shelfmark/actions/workflows/ci.yml)
A Mattermost plugin that integrates with [Shelfmark](https://git.nakama.town/fmartingr/shelfmark) to let users search and request books directly from Mattermost using the `/requestbook` slash command. Requested books are automatically downloaded and posted to a designated channel.
## Features
- **Book search** -- Search by title, author, or ISBN via `/requestbook <query>`
- **Language filtering** -- Specify a preferred language with `--language <code>` (e.g., `--language es`), with a configurable default
- **Automatic downloads** -- Background processing handles the full lifecycle: search, queue, download, and post
- **Channel posting** -- Books are posted with cover art to a configured channel, with the file attached as a reply
- **User notifications** -- Requestors receive DM updates on download progress and completion
- **Localization** -- User-facing messages available in English and Spanish, with locale-aware delivery
- **Customizable posts** -- Post format is configurable via Go `text/template` syntax
## Usage
```
/requestbook [--language <code>] <search query>
```
Examples:
```
/requestbook The Hitchhiker's Guide to the Galaxy
/requestbook --language es El Quijote
/requestbook 978-0-13-468599-1
```
The plugin will search Shelfmark for the best match, queue a download, and post the result to the configured channel once complete.
## Configuration
Configure the plugin in **System Console > Plugins > Mattermost Plugin Shelfmark**.
| Setting | Description |
|---------|-------------|
| **Shelfmark Server URL** | Base URL of your Shelfmark instance (e.g., `http://shelfmark:8084`) |
| **Shelfmark Username** | Username for Shelfmark authentication (leave empty if auth is disabled) |
| **Shelfmark Password** | Password for Shelfmark authentication (leave empty if auth is disabled) |
| **Channel ID** | Mattermost channel ID where book posts will be created |
| **Default Language** | ISO language code used when `--language` is not specified (e.g., `en`, `es`, `fr`) |
| **Post Template** | Go template for book post messages. Variables: `{{.Title}}`, `{{.Authors}}`, `{{.AuthorsList}}` |
## Development
### Prerequisites
- Go 1.25+
- A running Mattermost server with plugin uploads enabled
### Building
```bash
make # lint, test, and build
make dist # create distributable plugin bundle
make test # run tests only
make coverage # generate test coverage report
```
The build produces a plugin bundle at `dist/com.fmartingr.shelfmark.tar.gz` with support for Linux (amd64/arm64), macOS (amd64/arm64), and Windows (amd64).
### Deploying
Enable plugin uploads in your Mattermost config:
```json
{
"PluginSettings": {
"EnableUploads": true
}
}
```
Then deploy with local mode:
```bash
make deploy
```
Or with credentials:
```bash
export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=<your-token>
make deploy
```
### Releasing
```bash
make patch # patch release (e.g., 1.0.1)
make minor # minor release (e.g., 1.1.0)
make major # major release (e.g., 2.0.0)
```
Release candidate variants are also available: `make patch-rc`, `make minor-rc`, `make major-rc`.
The version is determined automatically from git tags. See the Makefile for details.