Skip to content

Conversation

@jsonify
Copy link
Owner

@jsonify jsonify commented Nov 13, 2025

No description provided.

- Add 'user-story' template with title, description, tasks, acceptance criteria, and time estimate
- Include template metadata in picker with description
- Add User Stories category with 📝 icon for organization
- Support auto-categorization with 'user-story' and 'story' keywords
- Template includes placeholders for {filename}, {date}, and {user}
- Add 'noted.createUserStoryWithAI' command to create user stories from brief descriptions
- Uses VS Code LLM API (GitHub Copilot) to analyze description and populate:
  - Story title
  - User story format (As a... I want... So that...)
  - 3-5 actionable tasks as checklist
  - 3-5 testable acceptance criteria
  - Realistic time estimate
- Creates note in User Stories folder with YAML frontmatter
- Supports fallback when AI is unavailable
- Register command in extension.ts and package.json
- Icon: $(notebook) for command palette
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jsonify, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant new feature that leverages AI to streamline the creation of user stories within the application. By providing a brief description, users can now automatically generate fully structured user stories, complete with titles, descriptions, tasks, acceptance criteria, and time estimates, which are then saved as new notes. This enhancement aims to boost productivity for agile development workflows by automating a common documentation task.

Highlights

  • AI-Powered User Story Generation: Introduced a new command noted.createUserStoryWithAI that allows users to generate a structured user story from a brief description using an AI model. This command prompts the user for a description, sends it to a selected AI model, parses the AI's JSON response, and then creates a new note with the populated user story content.
  • New User Story Template: Added a dedicated 'user-story' template to the system. This template includes fields for title, user type, goal, benefit, tasks (as a checklist), acceptance criteria (as a checklist), and a time estimate, providing a standardized structure for agile user stories.
  • AI Model Selection Logic: Implemented a selectAIModel function to intelligently choose an available AI model, prioritizing a preferred model from settings, then Claude (from Copilot), Anthropic models, GPT (from Copilot), and finally any other available model. This ensures flexibility and robustness in AI integration.
  • Dynamic Note Creation and Formatting: Developed createUserStoryNote to dynamically create a new markdown note file based on the AI-generated user story. It sanitizes the title for the filename, organizes notes into a 'User Stories' subfolder, and formats the content with front matter, checklists for tasks and acceptance criteria, and author/date information.
  • Command Integration and UI Updates: The new user story generation command is registered in the extension and added to package.json with a 'Noted: Create User Story with AI' title and a notebook icon. The built-in templates and categories are updated to include the new 'User Story' type and its corresponding 'User Stories' folder.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a great new feature for generating user stories with AI. The implementation is well-structured, with clear separation of concerns for building the prompt, parsing the response, and creating the note file. The use of a fallback mechanism in parseUserStoryResponse is particularly robust.

I've left a few comments with suggestions for improvement, mainly related to making the progress indicator cancellable for better UX, removing hardcoded strings, avoiding require() inside functions, and addressing some code duplication.

Overall, this is a solid contribution that enhances the AI capabilities of the extension.

Issue 1 - Fix workspace folder error:
- Use getNotesPath() from configService instead of workspace folders
- Support absolute path configurations for notes folder
- Add getNotesPath import to templateCommands.ts
- Provide clearer error message when notes folder not configured

Issue 2 - Add AI User Story to templates picker:
- Add "$(sparkle) User Story with AI" option at top of template picker
- Shows as "AI-Enhanced" category in picker UI
- Accessible via Cmd+K Cmd+N template selection flow
- Special value '__ai_user_story__' triggers handleCreateUserStoryWithAI()
- Also added regular "User Story" template to built-in list
Update model selection priority in both TemplateGenerator and user story creation:

Priority hierarchy:
1. Claude Sonnet (latest version) - best for structured JSON output
2. Claude Opus - most capable
3. Other Claude models
4. Direct Anthropic vendor
5. GPT-4 models
6. Other GPT models
7. Gemini models
8. First available model

Key improvements:
- Filters for all Sonnet models and sorts by ID to get latest (e.g., sonnet-4-5)
- Case-insensitive matching for model family/ID
- Checks both 'copilot' and 'anthropic' vendors for Claude models
- Maintains user preference override at top of hierarchy
- Provides clear fallback chain for reliability

Applies to:
- User story AI generation (templateCommands.ts)
- Template creation with AI (TemplateGenerator.ts)
Add both manual and AI-enhanced User Story options to the Standard Templates section:

Standard Templates section now includes:
- Problem/Solution
- Meeting
- Research
- User Story (manual template)
- ✨ User Story with AI (AI-powered generation)
- Quick Note

Changes:
- Add 'user-story' to STANDARD_TEMPLATES array
- Insert AI-enhanced option after regular User Story template
- AI option uses sparkle icon (✨) to distinguish it visually
- Both options now appear in the collapsible "Standard Templates" section of the Templates panel

User can now access user story creation from three places:
1. Templates panel > Standard Templates
2. Command Palette (Cmd+K Cmd+N)
3. Direct command palette search for "Create User Story with AI"
CI/CD Fix:
- Fix TypeScript compilation error in templatesTreeProvider.ts
- Explicitly type items array as TreeItem[] to allow mixing TemplateActionItem and ActionButtonItem
- Resolves: error TS2345 "Property 'templateType' is missing in type 'ActionButtonItem'"

Code Review Improvements:

1. Cancellation Support:
- Add cancellable: true to withProgress in handleCreateUserStoryWithAI
- Use token from progress callback instead of creating new CancellationTokenSource
- Check token.isCancellationRequested during response streaming
- Add early return if cancelled to prevent partial operations

2. ES6 Import Refactoring:
- Replace require('os') with top-level import * as os from 'os'
- Change require('os').userInfo().username to os.userInfo().username
- Improves code readability and enables static analysis

3. DRY Principle - Shared AI Model Service:
- Create new src/services/aiModelService.ts with shared selectAIModel()
- Remove duplicate selectModel() from TemplateGenerator.ts (84 lines)
- Remove duplicate selectAIModel() from templateCommands.ts (75 lines)
- Both files now import and use shared selectAIModel()
- Single source of truth for AI model selection logic
- Prioritizes Claude Sonnet (latest) > Opus > other Claude > GPT-4 > GPT > Gemini

Benefits:
- Easier to maintain model selection logic in one place
- Consistent behavior across all AI features
- Reduced code duplication by ~160 lines
- Future AI features can reuse the same selection logic
@jsonify jsonify merged commit e40ffed into main Nov 14, 2025
8 checks passed
@jsonify jsonify deleted the claude/user-story-generator-01CYqeCpce3FFyh1xyGbCFEL branch November 14, 2025 06:08
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.

2 participants