Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: conversation starters #4758

Merged
merged 17 commits into from
Mar 22, 2025
Merged

feat: conversation starters #4758

merged 17 commits into from
Mar 22, 2025

Conversation

Patrick-Erichsen
Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen commented Mar 21, 2025

  • Adds prompt Conversation Starts with Bookmarks feature
  • Support @contextProvider references in v2 prompt files
  • Add prompt contents to slash command description
  • Removes tutorial card and prompt files context provider

Copy link

netlify bot commented Mar 21, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 4c030c1
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67de2b50d75a2f00087ff3d8

@Patrick-Erichsen Patrick-Erichsen marked this pull request as ready for review March 21, 2025 22:28
@Patrick-Erichsen Patrick-Erichsen requested a review from a team as a code owner March 21, 2025 22:28
@Patrick-Erichsen Patrick-Erichsen requested review from RomneyDa and removed request for a team March 21, 2025 22:28
RomneyDa
RomneyDa previously approved these changes Mar 22, 2025
Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

nice tests + analytics!

})),
slashCommands: final.slashCommands?.map(
({ run, ...slashCommandDescription }) => slashCommandDescription,
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

stylistically prefer old way, not important

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Submitted this to the @tomasz-stefaniak oracle (e.g. Clean Code assistant)

Prompt

    slashCommands: final.slashCommands?.map(
      ({ run, ...slashCommandDescription }) => slashCommandDescription,
    ),
slashCommands: final.slashCommands?.map((s) => ({
name: s.name,
description: s.description,
params: s.params, // TODO: is this why params aren't referenced properly by slash commands?
}))

which version is cleaner?


Response
The first version using destructuring is cleaner and more maintainable for several reasons:

slashCommands: final.slashCommands?.map(
  ({ run, ...slashCommandDescription }) => slashCommandDescription,
),

Advantages of the first version:

  1. It uses object destructuring with rest parameters (...) to explicitly show we're removing the run property while keeping everything else
  2. It's more maintainable - if new properties are added to slash commands in the future, they'll automatically be included without modifying this code
  3. It follows the Open/Closed Principle better - the code is open for extension (new properties) but closed for modification
  4. It's more concise and has less repetition

The second version:

slashCommands: final.slashCommands?.map((s) => ({
  name: s.name,
  description: s.description,
  params: s.params,
}))

Has these drawbacks:

  1. It explicitly lists every property that needs to be copied
  2. It's more brittle - if new properties are added, this code needs to be updated
  3. More verbose and repetitive
  4. Higher chance of human error when maintaining the property list

The first version is the better choice as it's more maintainable, flexible, and follows SOLID principles better. It also makes it very clear that we're intentionally excluding the run property while preserving everything else.


I made the update mostly stylistically but I think I agree with the points made by the model.

Copy link
Collaborator

@RomneyDa RomneyDa Mar 22, 2025

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Collaborator

Choose a reason for hiding this comment

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

😮😮😮😮

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is a good callout - my thought was that the card was mostly redundant at this point when our tooltip UI has improved for cmd+I/cmd+L and more visible configurations through Nate's toolbar updates.

Lmk what your thoughts are though, I don't feel particularly strongly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

was just excited

Copy link
Collaborator

Choose a reason for hiding this comment

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

🤯🤯🤯🤯🤯

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is valid since all prompt files are now rendered as slash commands.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this was just excitement hahaha

Copy link
Collaborator

Choose a reason for hiding this comment

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

consider renaming/moving file/function to reflect v2 support

Copy link
Collaborator

Choose a reason for hiding this comment

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

"auth" slice or similar might be nice since orgs ~= profiles but nitpick

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good callout - I created a new organizations slice to make this clearer 👍 the reason I don't think auth would have been clear is that we have all the preference logic (e.g. bookmarks) in the profile slice. Using an org slice is also more similar to what we have on the Hub.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant auth slice with both orgs and profiles

@Patrick-Erichsen Patrick-Erichsen force-pushed the pe/conversation-starters branch from 61ea04b to 71f8508 Compare March 22, 2025 02:29
@Patrick-Erichsen Patrick-Erichsen merged commit ed6f001 into main Mar 22, 2025
31 checks passed
@Patrick-Erichsen Patrick-Erichsen deleted the pe/conversation-starters branch March 22, 2025 04:10
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.

3 participants