(MOT-4172) feat(iii-directory): prompt library backend + injectable directory UI - #564
(MOT-4172) feat(iii-directory): prompt library backend + injectable directory UI#564rohitg00 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe prompt system adds configurable global and local libraries, frontmatter-based kinds and sources, precedence-aware listing and retrieval, plus registered save and delete APIs with validation and filesystem persistence. ChangesPrompt library
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant PromptAPI
participant PromptLibraries
participant WorkerTemplates
Caller->>PromptAPI: list or get prompt
PromptAPI->>PromptLibraries: collect local and global prompts
PromptAPI->>WorkerTemplates: collect shipped templates
PromptLibraries-->>PromptAPI: classified prompt entries
WorkerTemplates-->>PromptAPI: template entries
PromptAPI-->>Caller: precedence-resolved prompt
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 49 skipped (no docs/).
Four for four. Nicely done. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
iii-directory/src/fs_source.rs (1)
406-511: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider extracting the shared frontmatter-parsing body.
scan_user_promptsduplicates most ofscan_prompts(read →split_frontmatter→serde_yamlparse → name derivation → description validation →kindmapping). The only real differences are thehas_prompts_segmentgate and duplicate-detection. A sharedparse_prompt_entry(abs) -> Result<FsPrompt, SkipReason>helper would keep the two scanners from drifting.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@iii-directory/src/fs_source.rs` around lines 406 - 511, Extract the duplicated prompt frontmatter processing from scan_user_prompts and scan_prompts into a shared parse_prompt_entry helper returning Result<FsPrompt, SkipReason>. Keep file reading, frontmatter splitting/parsing, name derivation and validation, description validation, kind mapping, and error construction in the helper; leave has_prompts_segment filtering and scanner-specific duplicate detection in each caller.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@iii-directory/src/functions/prompts.rs`:
- Around line 347-353: Update the frontmatter construction in the format! call
to pass req.name through yaml_quote, matching the existing description handling,
so PromptFrontmatter.name always deserializes as a string for names such as
numeric or boolean-looking values.
- Around line 394-396: Update yaml_quote to use a YAML-aware quoting/escaping
implementation instead of Rust’s {:?} formatting and newline replacement. Ensure
all control characters in the input produce valid YAML double-quoted escapes so
description values round-trip safely through frontmatter.
---
Nitpick comments:
In `@iii-directory/src/fs_source.rs`:
- Around line 406-511: Extract the duplicated prompt frontmatter processing from
scan_user_prompts and scan_prompts into a shared parse_prompt_entry helper
returning Result<FsPrompt, SkipReason>. Keep file reading, frontmatter
splitting/parsing, name derivation and validation, description validation, kind
mapping, and error construction in the helper; leave has_prompts_segment
filtering and scanner-specific duplicate detection in each caller.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b8faa56d-cf49-42e5-b1f2-9a0929ad04fe
📒 Files selected for processing (4)
iii-directory/src/config.rsiii-directory/src/fs_source.rsiii-directory/src/functions/mod.rsiii-directory/src/functions/prompts.rs
The directory worker's prompt surface becomes a real library on the injectable-view base: - backend (folded from the prompt-library branch): directory::prompts::save and ::delete, kind (command|system) + source (worker|user) on list/get, prompts_folder config. - injectable UI: the prompts tab lists worker-shipped and user entries with kind + source badges; create, edit, fork, and delete via save/delete; worker-shipped templates render read-only. The skills tab is unchanged. Console-side prompt selection (composer picker, slash commands) ships as a separate console PR; this change is directory-only.
562f083 to
08ab1a7
Compare
What
The directory worker's prompt surface becomes a full library on the injectable-view base.
Backend (folds in the prompt-library work):
directory::prompts::saveanddirectory::prompts::delete.kind(command|system) andsource(worker|user) onlist/get, filterable by both.prompts_folder/local_prompts_folderconfig, mirroring the skills folders.deleterequiresyes: trueand refuses worker-shipped templates and project-local files.Injectable UI (the directory page's prompts tab):
kindandsourcebadges.directory::prompts::on-change. The skills tab is unchanged.Verification
cargo build/fmt/clippyclean; 266 lib/bin tests pass.tsc+ esbuild build + biome clean.save->list(sourceuser, kindsystem) ->get(body round-trips) ->delete(yes: true) -> gone. The prompts tab renders the library with badges and the create/fork/delete editor.Notes
Console-side prompt selection (composer picker + slash-command prompts) ships separately in #565.