Skip to content

Add extensions framework for custom btcli plugins#879

Open
tmimmanuel wants to merge 5 commits intoopentensor:stagingfrom
tmimmanuel:feat/extensions-framework
Open

Add extensions framework for custom btcli plugins#879
tmimmanuel wants to merge 5 commits intoopentensor:stagingfrom
tmimmanuel:feat/extensions-framework

Conversation

@tmimmanuel
Copy link
Copy Markdown

@tmimmanuel tmimmanuel commented Mar 27, 2026

Summary

Implements the extensions system proposed in #500. This allows developers to create, install, and manage custom btcli plugins without modifying the core codebase.

What changed

  • Added btcli ext command group with subcommands: add, update, remove, list, create, test, run
  • Extensions are stored in ~/.bittensor/extensions/ and validated via an extension.yaml manifest (name, version, description, entry_point)
  • ext create scaffolds a new extension with manifest, entry point, and test template
  • ext run resolves the entry point from the manifest, avoiding hardcoded paths
  • Aliases btcli extension and btcli extensions are also registered

Why

Currently there is no way to extend btcli with custom commands. This framework provides a standard structure for community-built plugins while keeping the core CLI clean. See #500 for the original proposal and discussion.

New files

  • bittensor_cli/src/commands/extensions/ — extension management commands, manifest parsing, templates
  • tests/unit_tests/test_extensions.py — 19 unit tests covering manifest parsing, directory helpers, and CLI commands

Test plan

  • btcli ext create test-ext creates boilerplate at ~/.bittensor/extensions/test-ext/
  • btcli ext list shows the created extension
  • btcli ext run test-ext prints "Hello from test-ext!"
  • btcli ext test test-ext runs and passes the scaffold test
  • btcli ext remove test-ext removes the extension
  • btcli ext add <valid-repo-url> clones and validates manifest
  • btcli ext add <repo-without-manifest> fails gracefully and cleans up
  • btcli ext update pulls latest for all installed extensions
  • btcli extensions list and btcli extension list work as aliases
  • pytest tests/unit_tests/test_extensions.py — all 19 unit tests pass

Closes #500

@thewhaleking
Copy link
Copy Markdown
Contributor

Read CONTRIBUTING.md

@tmimmanuel
Copy link
Copy Markdown
Author

tmimmanuel commented Mar 30, 2026

@thewhaleking I am really sorry for my mistake.
I read the CONTRIBUTING.md again deeply one line by one line.
Could you please reopen my PR? I will target to staging branch again.
Also I will write some more commits to enhance my PR.

@thewhaleking thewhaleking reopened this Mar 30, 2026
@tmimmanuel tmimmanuel force-pushed the feat/extensions-framework branch from d304fee to 0a4911c Compare March 30, 2026 18:00
@tmimmanuel tmimmanuel changed the base branch from main to staging March 30, 2026 18:00
Copy link
Copy Markdown
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

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

I think overall this is going in the right direction, but I think it needs to finish its thought.

I think this is a good first step, but needs to be a bit better fleshed out. Ideally I would like to see a test extension that does something.

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.

RFC: BTCLI Extensions

2 participants