Add direct and AI-assisted command insertion modes#136
Open
MUFFANUJ wants to merge 12 commits intojupyterlab:mainfrom
Open
Add direct and AI-assisted command insertion modes#136MUFFANUJ wants to merge 12 commits intojupyterlab:mainfrom
MUFFANUJ wants to merge 12 commits intojupyterlab:mainfrom
Conversation
Contributor
Contributor
Member
Author
|
The bot comments looks better now :) |
krassowski
reviewed
Apr 2, 2026
Member
There was a problem hiding this comment.
Pull request overview
Adds a split “+” action for command IDs in the Plugin Playground sidebar, letting users either insert app.commands.execute('<id>'); directly at the editor cursor or open JupyterLite AI chat with a prefilled prompt to guide insertion in context.
Changes:
- Introduces a command insertion split-button UI (Insert vs AI prompt) and persists the default mode via a new setting.
- Implements direct cursor insertion plus AI chat prompt prefilling (via
@jupyter/chattracker + JupyterLite AI open-chat command). - Expands AST-based source utilities to better detect/ensure
activate(app: JupyterFrontEnd, …)context and to group imports; adds/updates UI integration tests accordingly.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/index.ts |
Adds command insertion flows (direct + AI prompt), setting persistence, editor gating, and chat integration via IChatTracker. |
src/token-sidebar.tsx |
Adds split insert button + dropdown menu for command insertion mode selection. |
src/token-insertion.ts |
Enhances import insertion (group into existing imports) and adds helpers to detect/ensure activate() app parameter context. |
schema/plugin.json |
Adds commandInsertDefaultMode setting (insert / ai). |
style/base.css |
Styles the split-button and AI marker icon for command insertion. |
ui-tests/tests/plugin-playground.spec.ts |
Adds UI tests for command insertion at cursor and AI prompt prefilling; updates token import assertions to allow grouped imports. |
package.json |
Adds dependency on @jupyter/chat for IChatTracker. |
yarn.lock |
Lockfile updates reflecting new dependency graph. |
README.md |
Documents the new command insert modes and the persisted setting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

closes #106
This update adds an insertion dropdown for commands so users can choose the flow they want. In Insert mode, clicking + adds the command right at the current cursor position for a fast manual action. In AI mode, it does not insert immediately; it opens the AI chat and pre-fills a prompt so the user can review or adjust before sending. This gives both a quick, direct option and a guided AI option in the same UI.