feat(query): replace readline with read-multiline in REPL#895
feat(query): replace readline with read-multiline in REPL#895
Conversation
Replace node:readline/promises with @toiroakr/read-multiline for the interactive query REPL, enabling full multi-line editing with cursor navigation, undo/redo, bracketed paste, and persistent history. - Enter inserts newline, modified-Enter (Shift/Ctrl/Alt) submits - Validate on submit: SQL requires ';' terminator, GraphQL requires complete document - File-based history per engine (~/.config/tailor-platform/) - Remove obsolete line-buffering logic and interrupt handling
…text - Check raw value length instead of trimmed length on Ctrl+C cancel so whitespace-only drafts do not exit the REPL (regression from readline) - Replace hardcoded Enter/Shift+Enter key bindings in \help with terminal-agnostic Ctrl+J and a reference to the auto-detected footer
- Note that history is shared across workspaces/profiles - Note that empty input and REPL commands are saved to history
Use the discriminated union on QueryDispatchResult.engine to branch print logic after a single execute() call, removing the redundant per-engine assertion guards.
🦋 Changeset detectedLatest commit: ba775d3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
📖 Docs Consistency Check✅ No inconsistencies found between documentation and implementation. Checked areas:
Analysis: The query command is intentionally undocumented:
All user-facing changes are properly reflected in the implementation:
PR Changes Summary:
Since the query command has no external documentation and all user-visible information is displayed via the in-REPL help command (which was updated), there are no documentation files requiring changes. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| logger.log( | ||
| engine === "sql" | ||
| ? "Submit executes when input ends with ';'." | ||
| : "Submit executes when input is a complete GraphQL document.", | ||
| ); |
There was a problem hiding this comment.
This might not be correct anymore.
toiroakr
left a comment
There was a problem hiding this comment.
I would also like to support features such as syntax highlighting and automatic bracket insertion. Please refer to the read-multiline example.
This comment has been minimized.
This comment has been minimized.
Bumps @toiroakr/read-multiline to 0.3.0 which adds highlight and transform callback options used by the REPL syntax highlighting and auto-close bracket support. Adds sql-highlight for SQL tokenization and promotes graphql from a transitive to a direct dependency for GraphQL Lexer access.
Wire the new highlight and transform options from read-multiline 0.3.0 into the query REPL: per-engine syntax highlighting (SQL via sql-highlight, GraphQL via the official graphql Lexer) and auto-closing brackets with auto-indent on newline. The editor module is lazy-imported inside runRepl so graphql and sql-highlight are not pulled in on every CLI startup.
|
#895 (review) |
Code Metrics Report (packages/sdk)
Details | | main (0be43dd) | #895 (a76d4f3) | +/- |
|--------------------|----------------|----------------|-------|
+ | Coverage | 57.0% | 57.5% | +0.5% |
| Files | 337 | 338 | +1 |
| Lines | 11035 | 11154 | +119 |
+ | Covered | 6292 | 6418 | +126 |
- | Code to Test Ratio | 1:0.4 | 1:0.4 | -0.1 |
| Code | 67220 | 67500 | +280 |
+ | Test | 27489 | 27588 | +99 |Code coverage of files in pull request scope (46.8% → 63.5%)
SDK Configure Bundle Size
Runtime Performance
Type Performance (instantiations)
Reported by octocov |
Replace Node.js readline with
@toiroakr/read-multilinefor native multiline editing in the query REPLBefore / After
Before: Single-line readline with manual line buffering. Multi-line SQL/GraphQL required pressing Enter after each line, with no way to edit previous lines.
After: True multiline editor with validation-based submit, undo/redo, and history navigation.
Main Changes
node:readlinewith@toiroakr/read-multilinefor built-in multiline editing, validation, and history~/.config/tailor-platform/)Notes