Skip to content

[BUG] [v0.0.7] cortex plugin list and plugin show ignore [plugin] section — display directory name, 0.0.0 version, empty description for all plugins #53393

@nightmare0329

Description

@nightmare0329

Project

cortex

Description

cortex plugin list and cortex plugin show display wrong metadata for any plugin created with the built-in cortex plugin new template. All plugins appear with their directory name as the plugin name, 0.0.0 as the version, and an empty description — regardless of what the plugin.toml actually contains.

Root cause: MANIFEST_TEMPLATE (used by cortex plugin new) stores name, version, and description under the [plugin] nested section:

[plugin]
id = "my-awesome-plugin"
name = "My Awesome Plugin"
version = "1.2.3"
description = "Adds awesome features to Cortex"

But run_list() and run_show() read only top-level keys:

// src/cortex-cli/src/plugin_cmd.rs  (run_list, ~line 992)
let name = manifest
    .get("name")           // BUG: looks for top-level "name" — not found in [plugin] section
    .and_then(|v| v.as_str())
    .unwrap_or_else(|| path.file_name()...);  // falls back to directory name

let version = manifest
    .get("version")        // BUG: same issue
    .and_then(|v| v.as_str())
    .unwrap_or("0.0.0");   // always shows 0.0.0

Meanwhile run_install() and run_validate() correctly handle the [plugin] structure:

// run_install() correctly checks [plugin].name first, then falls back to top-level
let plugin_name = manifest
    .get("plugin")
    .and_then(|p| p.get("name"))     // checks [plugin].name
    .or_else(|| manifest.get("name")) // then top-level
    .and_then(|v| v.as_str())
    .unwrap_or("unknown");

run_list() and run_show() lack the manifest.get("plugin") lookup, making them inconsistent with the rest of the plugin subsystem.

Error Message

(no error — wrong metadata is silently displayed)

Debug Logs

$ cortex plugin new my-awesome-plugin
# Creates plugin.toml with [plugin] section (see template)

$ cortex plugin list
Installed Plugins:
------------------------------------------------------------
  my-awesome-plugin v0.0.0 [enabled]
# BUG: shows directory name, not "My Awesome Plugin"
# BUG: shows 0.0.0, not the actual version from [plugin]
# BUG: description is empty

$ cortex plugin show my-awesome-plugin
Plugin: my-awesome-plugin
----------------------------------------
# BUG: no version, no description shown (keys not found at top level)

System Information

Cortex CLI v0.0.7
OS: Linux (Ubuntu 22.04)
Component: src/cortex-cli/src/plugin_cmd.rs — run_list() and run_show()

Screenshots

cortex plugin list shows directory name and 0.0.0 instead of actual name/version (real v0.0.7 binary)

Steps to Reproduce

  1. Create a plugin: cortex plugin new my-plugin
  2. The template creates plugin.toml with [plugin] nested section containing name, version, description
  3. Run cortex plugin list
  4. Observe: name shows as directory name, version shows as 0.0.0, description is empty

Expected Behavior

cortex plugin list should display the name, version, and description from the [plugin] section of plugin.toml — the same metadata that run_install() and run_validate() correctly read.

Actual Behavior

run_list() and run_show() only look for top-level keys (manifest.get("name")). Since the manifest template nests these under [plugin], the keys are not found and defaults are used (directory name, "0.0.0", empty string).

Additional Context

Fix: Apply the same pattern used in run_install() to run_list() and run_show():

// In run_list() and run_show(), replace:
manifest.get("name").and_then(|v| v.as_str()).unwrap_or("...")

// With:
manifest.get("plugin")
    .and_then(|p| p.get("name"))
    .or_else(|| manifest.get("name"))
    .and_then(|v| v.as_str())
    .unwrap_or("...")

Apply the same fix for version, description, enabled, and author fields.

Affected file: src/cortex-cli/src/plugin_cmd.rs, functions run_list() (~line 992) and run_show() (~line 1240)

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions