@youtyan/code-viewer 0.2.11 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,12 @@ Requires Node.js 20 or newer when installed from npm. Development uses
14
14
  pills" that copy `@path#start-end` for AI agents.
15
15
  - Browse commit history per branch and open any commit's changed files and
16
16
  diff, with shareable `/history?ref=<branch>&commit=<sha>` links.
17
+ - Open per-file Blame and History tabs on a file detail page (GitHub-style):
18
+ Blame groups consecutive lines from the same commit with an Older→Newer
19
+ colour bar and lets you jump to the originating commit; History embeds the
20
+ same commit list and diff renderer used by `/history` inside the file's
21
+ tab shell, filtered to that path. Both tabs keep the Repository sidebar
22
+ visible.
17
23
  - Open files directly from the repository or diff view, including large
18
24
  generated files (virtualized source viewer with copy/open-full-view).
19
25
  - Preview Markdown with a table of contents, task lists, Mermaid diagrams
@@ -111,6 +117,15 @@ resolved inside the repository, code blocks are highlighted with Shiki, and
111
117
  Mermaid diagrams are rendered lazily in the browser (click any diagram to
112
118
  open it in a lightbox).
113
119
 
120
+ A file detail page lays out four tabs — **Preview**, **Code**, **Blame**,
121
+ **History** — modelled after the GitHub file view. `Code` is the default and
122
+ `?preview=1` opts in to the Markdown / media preview. `Blame` and `History`
123
+ each have their own canonical URL (`view=blame`, `view=history`), so deep
124
+ links and the browser back/forward stay in sync. The Blame tab reuses the
125
+ source view's row component, so line numbers, drag-selection of `line=`
126
+ ranges, syntax highlighting and the Viewer Settings code font size all match
127
+ the Code tab.
128
+
114
129
  Very large text files use a virtualized source viewer. Only visible rows are
115
130
  rendered, and the page includes controls to copy the full file or reopen it in
116
131
  the full non-virtual view.
@@ -178,26 +193,36 @@ Services whose names collide across subdirectories are kept distinct via
178
193
  `docker:<service>@<relDir>` ids (cwd-direct compose files keep the historical
179
194
  `docker:<service>` id for backward compatibility).
180
195
 
181
- **Redis** support is read-only: browse DB 0–15, SCAN keys, and view values per
182
- type (string/hash/list as dedicated panes, set/zset/stream as JSON views). It
183
- also participates in snapshots and diffs.
196
+ **Redis** support: browse DB 0–15, SCAN keys, and view values per
197
+ type (string/hash/list as dedicated panes, set/zset/stream as JSON views).
198
+ Edit values, delete keys, and create new keys (string/hash/list/set/zset/stream)
199
+ with confirmation dialogs. It also participates in snapshots and diffs.
184
200
 
185
- **Elasticsearch** support is read-only: list indices, view mappings, paginate
201
+ **Elasticsearch** support: list indices, view mappings, paginate
186
202
  docs with `search_after`, run lucene `q=` searches, and submit DSL queries to a
187
203
  small allowlist of `_search` / `_count` / `_msearch` / `_explain` /
188
- `_validate` / `_field_caps` / `_eql`. Snapshots and diffs over `_search`
189
- iteration are supported.
204
+ `_validate` / `_field_caps` / `_eql`. Edit documents (with optimistic
205
+ concurrency via `_seq_no` / `_primary_term`), create new documents, and delete
206
+ existing ones. Snapshots and diffs over `_search` iteration are supported.
190
207
 
191
- **S3-compatible object storage** (MinIO, LocalStack) is read-only: browse
208
+ **S3-compatible object storage** (MinIO, LocalStack): browse
192
209
  buckets as a folder tree, search by prefix or filename, sort scanned objects by
193
210
  update time, and preview images, video, audio, PDFs, Markdown, HTML, and text
194
- files. Updated-time sorting is scoped to the objects scanned for the current
195
- prefix/search rather than a persistent whole-bucket index. HTML previews are
196
- rendered in a sandboxed `srcdoc` iframe; relative subresources inside the HTML
197
- are not rewritten. **LocalStack** falls back to `docker exec <container> curl`
198
- against the container-local endpoint when the service does not publish a host
199
- port; **MinIO** requires a published host port (add a `9000:9000` mapping) and
200
- will refuse to browse otherwise.
211
+ files. Edit text/markdown/JSON object bodies inline, upload new objects to any
212
+ prefix, and delete existing objects. Updated-time sorting is scoped to the
213
+ objects scanned for the current prefix/search rather than a persistent
214
+ whole-bucket index. HTML previews are rendered in a sandboxed `srcdoc` iframe;
215
+ relative subresources inside the HTML are not rewritten. **LocalStack** falls
216
+ back to `docker exec <container> curl` against the container-local endpoint
217
+ when the service does not publish a host port; **MinIO** requires a published
218
+ host port (add a `9000:9000` mapping) and will refuse to browse otherwise.
219
+
220
+ **SQL row editing** (SQLite / PostgreSQL / MySQL): toggle an Edit mode on the
221
+ table grid to insert, update, or delete rows inline. Edits queue as pending
222
+ changes (shown with a yellow highlight on the affected row/cell) and are
223
+ applied as a single transaction on commit. Row updates and deletes require the
224
+ table to have a primary key. The whole batch rolls back on the first
225
+ constraint violation.
201
226
 
202
227
  ### Browser UI
203
228
 
@@ -211,11 +236,19 @@ Open Datastores in the global navigation to access:
211
236
  the database.
212
237
  - **Table browser** — paginated data grid with column sort, text filter, cell
213
238
  copy, and CSV/JSON export (capped at 100,000 rows; export respects current
214
- filter/sort).
239
+ filter/sort). Double-click a cell to edit inline when Edit mode is on; the
240
+ whole pending edit batch commits atomically.
215
241
  - **Detail footer and related panel** — click any cell to open a resizable
216
242
  detail footer; foreign-key cells open a related panel showing the
217
243
  referenced or referencing rows, with multi-step drill-down breadcrumbs.
218
244
  Cells that match the focused row are highlighted in both panels.
245
+ - **Footer dock with Query History & Session log** — JetBrains-style bottom
246
+ dock that hosts two tabs: the per-database **Query History** (master/detail
247
+ list of saved queries, SSE-synced across tabs) and a **Session log** that
248
+ records every SQL the server runs in this browser session (read fetches,
249
+ user queries, and write commits) with timing, row counts, and the actual
250
+ executed SQL syntax-highlighted with shiki. Auto-follow keeps the newest
251
+ entry pinned; scroll up to pause.
219
252
  - **Rails FK inference toggle** — opt-in heuristic that adds virtual foreign
220
253
  keys following Rails naming conventions (e.g. `user_id → users.id`) on top
221
254
  of the database-declared FKs.
@@ -227,16 +260,20 @@ Open Datastores in the global navigation to access:
227
260
  whether each entry came from the browser or the CLI.
228
261
  - **ER diagram** — auto-generated entity-relationship diagram showing
229
262
  foreign-key relationships between tables.
230
- - **Schema view** — table columns, indexes, foreign keys, triggers, and DDL.
263
+ - **Schema view** — table columns (with column comments when the database
264
+ defines them), indexes, foreign keys, triggers, and DDL. Tables themselves
265
+ surface a comment column on the database table list.
231
266
  - **Global search** — full-text search across all tables and text columns of
232
267
  a database.
233
268
  - **Snapshots and diffs** — take point-in-time snapshots of selected tables
234
269
  (or Redis key spaces, or Elasticsearch indices) and compare any two
235
270
  snapshots to see inserted, updated, and deleted rows with full before/after
236
271
  values.
237
- - **Datastore explorers** — first-class sidebars for Redis (DB / SCAN),
272
+ - **Datastore explorers** — first-class sidebars for Redis (DB / SCAN),
238
273
  Elasticsearch (indices / mappings / docs), and S3 (folder tree, kind
239
- badges) so the same Multi-DB tab UI works for non-SQL stores too.
274
+ badges) so the same Multi-DB tab UI works for non-SQL stores too. Each
275
+ explorer supports value editing / document creation / object upload /
276
+ deletion via in-line panes and confirmation dialogs.
240
277
 
241
278
  ### CLI
242
279