Skip to content

Conversation

@ultmaster
Copy link
Contributor

Summary

  • add new prompt templates for common tasks in the gallery
  • separate default prompts from user prompts in the gallery tree

Testing

  • npm run build-webview
  • npm run build-cli
  • npm run lint
  • npm test
  • python -m pytest python/tests
  • xvfb-run -a npm run compile && xvfb-run -a npm run test-vscode

https://chatgpt.com/codex/tasks/task_e_6874d99b1664832ead07907876f5e3d4

Copilot AI review requested due to automatic review settings July 16, 2025 09:29

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@ultmaster ultmaster requested a review from Copilot July 16, 2025 09:57
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 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 PromptGalleryProvider to show two collapsible categories (“Default Prompts” and “My Prompts”)
  • Update context menu in package.json so 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_LABEL could be renamed to USER_PROMPTS_LABEL to 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 getChildren to verify that both default and user categories load the correct prompt lists, and that leaf nodes return an empty array.
  getChildren(element?: TreeNode): TreeNode[] {

Comment on lines +43 to +48
{ type: 'category', label: DEFAULT_PROMPTS_LABEL },
{ type: 'category', label: MY_PROMPTS_LABEL },
];
}
if (isCategory(element)) {
return element.label === DEFAULT_PROMPTS_LABEL
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
{ 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'

Copilot uses AI. Check for mistakes.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

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

private get userEntries(): PromptEntry[] {
return this.context.globalState.get<PromptEntry[]>(STORAGE_KEY, []);
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@ultmaster ultmaster merged commit 2b5cf21 into main Jul 16, 2025
4 checks passed
@ultmaster ultmaster deleted the codex/add-prompts-to-gallery-for-various-topics branch August 27, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants