No description
Find a file
Felipe Martin b43e7ac3ec
Add updateassets command with webapp code detection
- Add updateassets command to update plugin files from embedded assets
- Only include webapp assets if plugin manifest indicates webapp code presence
- Compare file contents before updating to avoid unnecessary writes
- Display count of updated files in completion message

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 16:38:26 +02:00
assets Add updateassets command with webapp code detection 2025-07-09 16:38:26 +02:00
cmd/pluginctl Add updateassets command with webapp code detection 2025-07-09 16:38:26 +02:00
testdata Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
.gitignore Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
.golangci.yml Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
.goreleaser.yml Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
CLAUDE.md Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
client.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
disable.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
enable.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
go.mod Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
go.sum Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
info.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
info_test.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
LICENSE Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
Makefile Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
plugin.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
plugin_test.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
README.md Initial implementation of pluginctl CLI tool 2025-07-08 14:30:09 +02:00
reset.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00
updateassets.go Add updateassets command with webapp code detection 2025-07-09 16:38:26 +02:00
version.go Add enable/disable/reset commands 2025-07-09 14:01:23 +02:00

pluginctl

A command-line interface tool for Mattermost plugin development. pluginctl provides utilities to manage, inspect, and work with Mattermost plugins from the command line.

Installation

From Source

git clone https://github.com/mattermost/pluginctl.git
cd pluginctl
make build

Binary Installation

Download the latest binary from the releases page.

Package Managers

# Using go install
go install github.com/mattermost/pluginctl/cmd/pluginctl@latest

# Using Homebrew (if available)
brew install mattermost/tap/pluginctl

# Using Scoop on Windows (if available)
scoop bucket add mattermost https://github.com/mattermost/scoop-bucket.git
scoop install pluginctl

Usage

Basic Commands

# Display plugin information
pluginctl info

# Show help
pluginctl --help

# Show version
pluginctl --version

Plugin Path Configuration

pluginctl supports multiple ways to specify the plugin directory:

  1. Command-line flag (highest priority):

    pluginctl --plugin-path /path/to/plugin info
    
  2. Environment variable:

    export PLUGINCTL_PLUGIN_PATH=/path/to/plugin
    pluginctl info
    
  3. Current directory (default):

    cd /path/to/plugin
    pluginctl info
    

Commands

info

Display comprehensive information about a Mattermost plugin:

pluginctl info

Output includes:

  • Plugin ID, name, and version
  • Minimum Mattermost server version required
  • Description (if available)
  • Server code presence and supported platforms
  • Webapp code presence and bundle path
  • Settings schema availability

Example output:

Plugin Information:
==================

ID:              com.example.testplugin
Name:            Test Plugin
Version:         1.0.0
Min MM Version:  7.0.0
Description:     A test plugin for demonstrating pluginctl functionality

Code Components:
================
Server Code:     Yes
  Executables:   linux-amd64, darwin-amd64, windows-amd64
Webapp Code:     Yes
  Bundle Path:   webapp/dist/main.js
Settings Schema: Yes

Requirements

  • Go 1.24.3 or later
  • Valid Mattermost plugin directory with plugin.json manifest file

Development Tools

The project uses the following tools for development and release automation:

  • golangci-lint v1.62.2 - Code linting and quality checks
  • goreleaser v2.6.2 - Automated releases and cross-platform builds
  • gosec v2.22.0 - Security vulnerability scanning

Plugin Directory Structure

pluginctl expects to work with standard Mattermost plugin directories containing a plugin.json file. For more information about Mattermost plugin structure, visit the official documentation.

Environment Variables

Variable Description
PLUGINCTL_PLUGIN_PATH Default plugin directory path

Contributing

We welcome contributions to pluginctl! Please see the CLAUDE.md file for architecture guidelines and development instructions.

Development Setup

  1. Clone the repository:

    git clone https://github.com/mattermost/pluginctl.git
    cd pluginctl
    
  2. Set up development environment (installs pinned tool versions):

    make dev-setup
    
  3. Install dependencies:

    make deps
    
  4. Build the project:

    make build
    
  5. Test with a sample plugin:

    ./pluginctl info
    

Development Workflow

Use these Make targets for efficient development:

# Quick development build (format, lint, build)
make dev

# Check all changes before committing (lint, security, test)
make check-changes

# Full verification (clean, lint, test, build)
make verify

# Run tests with coverage
make test-coverage

# Build for all platforms
make build-all

Available Make Targets

Development:

  • make dev - Quick development build
  • make check-changes - Validate changes (lint, security, test)
  • make verify - Full build verification
  • make fmt - Format code
  • make clean - Clean build artifacts

Testing:

  • make test - Run tests
  • make test-coverage - Run tests with coverage report
  • make lint - Run linter
  • make lint-fix - Fix linting issues automatically
  • make security - Run security scan

Building:

  • make build - Build for current platform
  • make build-all - Build for all platforms
  • make install - Install to GOPATH/bin

Release:

  • make release - Create production release
  • make snapshot - Create snapshot release

Utilities:

  • make help - Show all available targets
  • make version - Show version information
  • make dev-setup - Install development tools

Adding New Commands

  1. Create a new command file (e.g., build.go)
  2. Implement the command following the patterns in info.go
  3. Register the command in cmd/pluginctl/main.go
  4. Update the help text and documentation

See CLAUDE.md for detailed architecture guidelines.

Code Style

  • Follow Go best practices and conventions
  • Use the official Mattermost model types from github.com/mattermost/mattermost/server/public/model
  • Maintain separation between CLI framework and command implementation
  • Include comprehensive error handling with descriptive messages

Testing

Test your changes with various plugin configurations:

# Run all tests
make test

# Run tests with coverage
make test-coverage

# Test CLI functionality
./pluginctl info

# Test with command-line flag
./pluginctl --plugin-path /path/to/plugin info

# Test with environment variable
export PLUGINCTL_PLUGIN_PATH=/path/to/plugin
./pluginctl info

# Validate all changes before committing
make check-changes

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Support

For questions, issues, or feature requests, please:

  1. Check the issues page
  2. Create a new issue if your problem isn't already reported
  3. Join the Mattermost Community for general discussion