Skip to content

Add Prompt Library support #1168

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add Prompt Library support #1168

wants to merge 4 commits into from

Conversation

trly
Copy link
Contributor

@trly trly commented May 22, 2025

Test plan

Changes were manually tested: https://ampcode.com/threads/T-d71803f6-01cb-4655-8150-95a9f4517899

✅ Basic Commands: Help, command structure, and navigation
✅ Tag CRUD: Create, read, update, delete operations for prompt tags
✅ Prompt CRUD: Create, read, update, delete operations for prompts
✅ Export/Import: Full workflow including data integrity verification
✅ Advanced Filtering: Owner, affiliated, built-in, recommended, draft filtering
✅ Search & Pagination: Query search, column selection, cursor pagination
✅ Long Content: Handles large prompt content (2.7KB+ tested)
✅ Unicode Support: Full Unicode in descriptions/content, restricted in names
✅ Empty Libraries: Graceful handling of empty prompt collections
✅ Malformed Data: Robust JSON validation and error reporting
✅ Character Validation: Database constraints properly enforced

trly added 2 commits May 22, 2025 15:04
The following subcommands are included:

- `list`: lists prompts
- `get`: gets a prompt by ID
- `create`: creates a prompt
- `update`: updates a prompt
- `delete`: deletes a prompt
- `tags`: manages prompt tags (with subcommands: list, create, update, delete)
This commit introduces enhancements to the prompt management commands, allowing users to select specific columns for display and output results in JSON format.

The following changes were made:

- Added column selection functionality to `src prompts list` and `src prompts tags list` commands using the `-c` flag. Users can now specify a comma-separated list of columns to display.
- Implemented JSON output functionality for `src prompts list` and `src prompts tags list` commands using the `-json` flag.
- Updated `src prompts update`, `src prompts tags update`, `src prompts delete`, and `src prompts tags delete` commands to accept the ID as a positional argument instead of a flag.
- Updated `src prompts export` to fetch all tags with pagination.
@trly trly requested a review from peterguy May 22, 2025 20:20
This commit modifies the `src prompts create` command to default the prompt owner to the current user if no owner is explicitly specified via the `-owner` flag.
@trly
Copy link
Contributor Author

trly commented May 23, 2025

documentation updates are in
sourcegraph/docs#1155

@bahrmichael
Copy link
Contributor

@trly Heya, thanks for building this! Before heading into the review I wanted to ask if this has been mainly Amp generated, and if you've done a cleanup pass after letting Amp do its work.

@trly
Copy link
Contributor Author

trly commented May 27, 2025

Just pushed a formatting fix, but other than than, it all appears to be structured very similar to the search-jobs functionality that I recently added without Amp and used as a reference for myself and Amp when adding this feature.

@trly
Copy link
Contributor Author

trly commented May 27, 2025

And, yes it was mainly Amp generated, but throughly reviewed in comparison to work I had previously done on this repo.

autoSubmit
mode
recommended
tags(first: 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about making the 100 configurable via a flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been back and forth on that a few times. I really don't know how well the CLI is going to display a large number of tags anyway.

Maybe add a flag but set the default lower (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.

2 participants