Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new “category” field for prompt entries, separates default and user prompts in the gallery tree, and adds several default .poml templates.
- Add
category: 'user'to commands that create or update user prompts - Refactor
PromptGalleryProviderto show two collapsible categories (“Default Prompts” and “My Prompts”) - Update context menu in
package.jsonso only user prompts offer edit/delete actions - Add seven new default prompt templates under
gallery/
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/poml-vscode/command/promptGallery.ts | Include category: 'user' when adding or updating prompts |
| packages/poml-vscode/chat/gallery.ts | Refactor provider to handle default vs user categories |
| package.json | Restrict edit/delete context menu to user prompts only |
| gallery/*.poml | Add new default prompt templates for code, LaTeX, PDF, table, etc. |
Comments suppressed due to low confidence (2)
packages/poml-vscode/chat/gallery.ts:23
- [nitpick] The constant name
MY_PROMPTS_LABELcould be renamed toUSER_PROMPTS_LABELto align with the'user'category value and improve consistency.
const MY_PROMPTS_LABEL = 'My Prompts';
packages/poml-vscode/chat/gallery.ts:40
- Add unit tests for
getChildrento verify that both default and user categories load the correct prompt lists, and that leaf nodes return an empty array.
getChildren(element?: TreeNode): TreeNode[] {
| { type: 'category', label: DEFAULT_PROMPTS_LABEL }, | ||
| { type: 'category', label: MY_PROMPTS_LABEL }, | ||
| ]; | ||
| } | ||
| if (isCategory(element)) { | ||
| return element.label === DEFAULT_PROMPTS_LABEL |
There was a problem hiding this comment.
Comparing against the display label can be brittle; consider adding a separate key or id field to PromptCategory so logic doesn’t rely on UI text.
| { type: 'category', label: DEFAULT_PROMPTS_LABEL }, | |
| { type: 'category', label: MY_PROMPTS_LABEL }, | |
| ]; | |
| } | |
| if (isCategory(element)) { | |
| return element.label === DEFAULT_PROMPTS_LABEL | |
| { type: 'category', key: 'default', label: DEFAULT_PROMPTS_LABEL }, | |
| { type: 'category', key: 'user', label: MY_PROMPTS_LABEL }, | |
| ]; | |
| } | |
| if (isCategory(element)) { | |
| return element.key === 'default' |
There was a problem hiding this comment.
Bug: Missing Data Migration Causes Type Violations
The PromptEntry interface was updated to require a category field, but no data migration was implemented for existing user prompts stored in globalState. This causes type violations and runtime errors when old entries are loaded and their missing category property is accessed (e.g., in getTreeItem), breaking the extension for users with previously saved prompts.
packages/poml-vscode/chat/gallery.ts#L30-L33
poml/packages/poml-vscode/chat/gallery.ts
Lines 30 to 33 in 2ee701a
Was this report helpful? Give feedback by reacting with 👍 or 👎
Summary
Testing
npm run build-webviewnpm run build-clinpm run lintnpm testpython -m pytest python/testsxvfb-run -a npm run compile && xvfb-run -a npm run test-vscodehttps://chatgpt.com/codex/tasks/task_e_6874d99b1664832ead07907876f5e3d4