Add writer schema request copy and response import tools#208
Conversation
|
Warning Review limit reached
More reviews will be available in 40 minutes and 48 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe Writer Schema page gains clipboard-copy actions for the latest API request JSON and prompt text, plus a new "Process AI Response" card allowing schema rows to be generated from pasted AI output without invoking the browser Writer API. The generation result handling is refactored into a shared ChangesWriter Schema clipboard copy and AI response processing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Pull request overview
This PR enhances the Writer schema prototype page by adding clipboard copy helpers for the most recent Writer request (raw JSON and a chat-friendly “prompt” format) and by introducing a “Process AI Response” workflow to turn pasted JSON responses into schema rows without re-calling the browser Writer API.
Changes:
- Added UI actions to copy the latest Writer request as formatted JSON or as a reusable prompt.
- Added a “Process AI Response” textarea + handler to parse pasted AI output into schema rows.
- Updated styling and expanded Jest coverage for streaming output, copy helpers, and pasted-response processing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/web/writer-schema.html | Adds copy buttons under “Full Request” and a new “Process AI Response” section. |
| apps/web/styles.css | Styles inline action buttons and adds an icon sizing class; adjusts wrapping behavior for JSON output. |
| apps/web/src/writer-schema-page.mjs | Implements clipboard copy helpers, request/prompt formatting, and pasted-response schema creation flow. |
| apps/web/src/tests/jest/writer-schema-page.test.js | Adds focused Jest tests for streaming Writer chunks, copy helpers, and pasted-response processing. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d81b212de5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryThis PR adds clipboard copy actions for the Writer API request (raw JSON and a chat-prompt variant) and a new "Process AI Response" card that lets users paste any AI-generated JSON and create schema rows without re-invoking the browser Writer API. Streaming generation is also exercised through new test coverage.
Confidence Score: 5/5Safe to merge — the new clipboard helpers and pasted-response workflow are self-contained, error paths are handled, and the test suite covers the happy path and streaming accumulation correctly. All three new page-controller functions guard their entry conditions, propagate errors to the UI, and are exercised through the bootstrapped page API in tests. The only finding is cosmetic double-spacing on the flag copy buttons from redundant margin and gap values in CSS. apps/web/styles.css — minor icon-spacing inconsistency between flag-copy-button and inline-actions contexts. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([User]) -->|Click Generate| B[generateFromPrompt]
B --> C[runWriterSchemaGeneration]
C --> D{writeStreaming\navailable?}
D -->|Yes| E[Accumulate stream chunks\nvia onStatus callbacks]
D -->|No| F[writer.write]
E --> G[parseWriterStructuredOutput]
F --> G
G --> H[normalizeStructuredSchemaPayload]
H --> I[applySchemaResult\nsourceLabel: Writer API output]
A -->|Click Copy JSON| J[copyLatestRequestJson]
J --> K{latestRequestDetails\nset?}
K -->|No| L[setStatus: warning]
K -->|Yes| M[copyTextToClipboard\nJSON.stringify]
A -->|Click Copy Prompt| N[copyLatestRequestAsPrompt]
N --> O{latestRequestDetails\nset?}
O -->|No| L
O -->|Yes| P[createCopyApiRequestPrompt\ncopyTextToClipboard]
A -->|Paste + Click Create Schema| Q[createSchemaFromResponse]
Q --> R[parseSchemaFromAiResponse\nuses writerContextDomainCommands]
R --> S[applySchemaResult\nsourceLabel: pasted AI response]
I --> T[(latestRequestDetails\nupdated)]
S -.->|requestDetails = latestRequestDetails\nno-op if null| T
Reviews (2): Last reviewed commit: "Add copy buttons for Chrome flag URLs" | Re-trigger Greptile |
Summary
Validation
Summary by CodeRabbit
New Features
Tests
Style