Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Oct 21, 2025

Summary

  • Add dedicated "Environment Plugin Development" guide (new doc page)
  • Expand existing environment directive documentation with better examples
  • Update plugins overview to reference the new dedicated guide

Changes

New File: docs/env-plugin-development.md

Complete guide for creating environment plugins:

  • When to use environment plugins vs tool/backend plugins
  • Quick start with template
  • Plugin structure (metadata.lua, hooks/mise_env.lua, hooks/mise_path.lua)
  • Complete code examples showing real-world usage
  • Best practices: defaults, validation, error handling, caching, multi-environment support
  • Testing and debugging instructions
  • Real-world examples: secret manager integration, dynamic environments
  • Migration guide from tool plugins
  • Related documentation cross-references

Updated: docs/plugins.md

  • Replaced lengthy inline section with concise "Environment Plugins" summary
  • Links to dedicated env-plugin-development.md page
  • Maintains consistent structure with backend/tool plugin documentation

Updated: docs/environments/index.md

Expanded "Plugin-provided env._ Directives" section:

  • Better explanation of how env._ directives work
  • Step-by-step flow of how mise processes these directives
  • Multiple practical examples:
    • Secret manager integration (Vault)
    • Dynamic environment detection (git branch)
  • Configuration options and ctx.options usage patterns
  • Cross-references to plugin development guide

Problem This Solves

Environment plugins existed and worked in mise but were poorly documented:

  • Only brief 2-line mention in environments doc
  • No dedicated guide like backend/tool plugins have
  • Unclear when to use them vs other plugin types
  • No examples of advanced patterns (secrets, caching, etc.)
  • Hard to discover the feature existed

Test Plan

  • Documentation builds successfully (mise run docs:build)
  • All links work correctly
  • Prettier formatting passes
  • New file appears in documentation sidebar (verified locally)

References

  • Example repository: mise-env-sample
  • Related issue: Addresses gap in plugin documentation

🤖 Generated with Claude Code


Note

Adds an Environment Plugin Development guide, expands env._ directive docs with examples, updates plugins overview, and links the new page in the sidebar.

  • Docs:
    • New Guide: docs/env-plugin-development.md
      • Covers plugin structure (metadata.lua, hooks/mise_env.lua, hooks/mise_path.lua), configuration via env._.<plugin>, examples (e.g., Vault), best practices, testing, and migration from tool plugins.
    • Plugins Overview: docs/plugins.md
      • Adds concise “Environment Plugins” section with usage and link to the new guide.
    • Environments: docs/environments/index.md
      • Expands “Plugin-provided env._ Directives” with how it works, configuration via ctx.options, and practical examples.
    • Site Navigation: docs/.vitepress/config.ts
      • Adds sidebar link to “Environment Plugin Development.”

Written by Cursor Bugbot for commit a7ec1ba. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings October 21, 2025 11:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive documentation for environment plugins, a previously underdocumented feature of mise. The changes establish environment plugins as a first-class plugin type with dedicated guidance comparable to tool and backend plugins.

Key Changes:

  • Creates a complete environment plugin development guide with examples, best practices, and testing instructions
  • Expands the environments documentation to better explain how plugin-provided directives work
  • Updates the plugins overview to include environment plugins alongside tool and backend plugins

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
docs/env-plugin-development.md New comprehensive guide covering environment plugin creation, structure, examples, and best practices
docs/plugins.md Adds environment plugins section with overview and links to detailed guide
docs/environments/index.md Expands plugin-provided directives section with detailed explanations and practical examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


## Quick Start

The fastest way to create an environment plugin is to use the [mise-env-plugin-template](https://github.com/jdx/mise-env-sample):
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link text says 'mise-env-plugin-template' but the URL points to 'mise-env-sample', and line 382 confirms the correct repository name is 'mise-env-sample'. Either the link text should be 'mise-env-sample' or a separate template repository exists at the URL shown in the text.

Suggested change
The fastest way to create an environment plugin is to use the [mise-env-plugin-template](https://github.com/jdx/mise-env-sample):
The fastest way to create an environment plugin is to use the [mise-env-sample](https://github.com/jdx/mise-env-sample):

Copilot uses AI. Check for mistakes.

### Creating Environment Plugins

See [Environment-Only Plugins](/plugins#environment-only-plugins) in the Plugins documentation for a complete guide to creating your own environment plugins.
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The anchor link '#environment-only-plugins' does not match the actual section heading in docs/plugins.md, which is '## Environment Plugins' (would create anchor '#environment-plugins'). This will result in a broken link.

Suggested change
See [Environment-Only Plugins](/plugins#environment-only-plugins) in the Plugins documentation for a complete guide to creating your own environment plugins.
See [Environment Plugins](/plugins#environment-plugins) in the Plugins documentation for a complete guide to creating your own environment plugins.

Copilot uses AI. Check for mistakes.
@jdx jdx force-pushed the doc-env-only-plugins branch from 3d488d2 to df4245e Compare October 21, 2025 11:30
cursor[bot]

This comment was marked as outdated.

Add dedicated "Environment Plugin Development" guide with complete examples
and best practices for creating plugins that provide environment variables
and PATH modifications without managing tool versions.

Changes:
- Created docs/env-plugin-development.md:
  - Complete guide to creating environment plugins
  - When to use environment plugins vs other plugin types
  - Directory structure and required files
  - Full code examples for MiseEnv and MisePath hooks
  - Best practices (defaults, validation, error handling, caching)
  - Testing and debugging instructions
  - Real-world examples (secret managers, dynamic environments)
  - Migration guide from tool plugins

- Updated docs/plugins.md:
  - Replaced lengthy inline section with concise summary
  - Links to dedicated env-plugin-development.md page
  - Maintains consistent structure with backend/tool plugin docs

- Expanded docs/environments/index.md:
  - Better explanation of plugin-provided env._ directives
  - How the directive system works (step-by-step flow)
  - Multiple practical examples
  - Configuration options and ctx.options usage
  - Cross-references to plugin development guide

This addresses the documentation gap where environment plugins existed
and worked but were poorly documented, making them hard to discover.

References mise-env-sample repository throughout as working example.

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

Co-Authored-By: Claude <[email protected]>
@jdx jdx force-pushed the doc-env-only-plugins branch from df4245e to f661219 Compare October 21, 2025 11:33
@jdx jdx enabled auto-merge (squash) October 21, 2025 11:43
@jdx jdx changed the title docs: add comprehensive documentation for environment plugins docs: environment plugins Oct 21, 2025
@github-actions
Copy link

github-actions bot commented Oct 21, 2025

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.13 x -- echo 18.0 ± 0.4 17.4 20.4 1.00
mise x -- echo 18.1 ± 0.4 17.5 22.9 1.01 ± 0.03

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.13 env 17.5 ± 0.5 16.8 21.9 1.00
mise env 18.1 ± 0.7 16.9 20.9 1.04 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.13 hook-env 18.0 ± 0.8 17.0 22.0 1.02 ± 0.08
mise hook-env 17.7 ± 1.1 17.0 39.6 1.00

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.10.13 ls 15.3 ± 0.4 14.7 20.1 1.00
mise ls 15.3 ± 0.3 14.6 16.5 1.00 ± 0.03

xtasks/test/perf

Command mise-2025.10.13 mise Variance
install (cached) 199ms ✅ 105ms +89%
ls (cached) 63ms 64ms -1%
bin-paths (cached) 71ms 70ms +1%
task-ls (cached) 509ms 481ms +5%

✅ Performance improvement: install cached is 89%

@jdx jdx merged commit c35906d into main Oct 21, 2025
27 checks passed
@jdx jdx deleted the doc-env-only-plugins branch October 21, 2025 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants