@youtyan/code-viewer 0.8.9 → 0.9.1

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
@@ -32,9 +32,9 @@ Requires Node.js 20 or newer when installed from npm. Development uses
32
32
  - Switch the viewer UI between English and Japanese from Viewer Settings —
33
33
  the language toggle live-updates every screen including the datastore
34
34
  viewer.
35
- - Browse SQLite, PostgreSQL, MySQL, Redis, Elasticsearch, DynamoDB, and
36
- S3-compatible object storage (MinIO, LocalStack) with a built-in datastore
37
- viewer.
35
+ - Browse SQLite, PostgreSQL, MySQL, Cloudflare D1, Redis, Elasticsearch,
36
+ DynamoDB, and S3-compatible object storage (MinIO, LocalStack, Cloudflare R2)
37
+ with a built-in datastore viewer.
38
38
  Local Supabase CLI (`supabase start`) Postgres projects are auto-discovered
39
39
  too, without needing a `docker-compose.yml`.
40
40
  Table descriptions appear inside expanded table entries and in the Schema
@@ -144,7 +144,11 @@ metadata instead of dumping bytes as text.
144
144
  Markdown files use a dedicated preview tab. Relative links and images are
145
145
  resolved inside the repository, code blocks are highlighted with Shiki, and
146
146
  Mermaid diagrams are rendered lazily in the browser (click any diagram to
147
- open it in a lightbox).
147
+ open it in a lightbox). Relative links lead to the same destinations as they
148
+ do on GitHub: another Markdown file opens its file page, an `#anchor` opens
149
+ the preview and scrolls to that heading, a non-Markdown file opens in the
150
+ Code view, and a link to a directory opens that folder in the repository
151
+ tree.
148
152
 
149
153
  A file detail page lays out up to four tabs — **Preview**, **Code**,
150
154
  **Blame**, **History** — modelled after the GitHub file view. For text files
@@ -182,8 +186,24 @@ tree state survives navigation and refresh.
182
186
  Symlinks get a distinct icon and a "→ target" label instead of looking like a
183
187
  regular file, and clicking one navigates straight to its resolved target.
184
188
  Broken symlinks are flagged and disabled instead of erroring out. Files with
185
- pending git changes (new, modified, renamed, deleted) show a status badge in
186
- the tree in place of the regular type icon.
189
+ pending git changes show a status badge in the tree in place of the regular
190
+ type icon:
191
+
192
+ | Badge | Meaning |
193
+ |---|---|
194
+ | `M` | Modified |
195
+ | `A` | Added — staged for commit |
196
+ | `D` | Deleted |
197
+ | `R` | Renamed |
198
+ | `U` | Untracked — in the worktree, not under version control yet |
199
+ | `I` | Ignored — excluded by a `.gitignore` rule |
200
+
201
+ `U` and `A` are deliberately separate: a file you have never run `git add` on
202
+ reads differently from one already staged. A directory that is wholly
203
+ untracked or ignored is badged as a whole, so it stays recognizable while
204
+ collapsed; it keeps its folder icon and carries the badge next to its name.
205
+ Inside an untracked directory the badge is inherited by its contents, except
206
+ where an ignore rule names a file specifically.
187
207
 
188
208
  ## Uploads and Scope Settings
189
209
 
@@ -274,7 +294,23 @@ global/local secondary indexes, and non-key attribute types inferred from
274
294
  loaded items) alongside scan or query items, `LastEvaluatedKey` pagination,
275
295
  and an item detail view with a copyable key. The explorer is read-only.
276
296
 
277
- **S3-compatible object storage** (MinIO, LocalStack): browse
297
+ **Cloudflare D1** support: add a saved connection with a Cloudflare account ID,
298
+ database ID, and API token (needs the `D1:Read` permission). The database is
299
+ browsed over the D1 REST API (`POST /accounts/{account}/d1/database/{db}/raw`)
300
+ and reuses the SQL screens — table list, row grid, query editor, schema, ER
301
+ diagram, snapshots and diffs. D1 is SQLite, so the same `sqlite_master` and
302
+ `PRAGMA table_info` / `index_list` / `foreign_key_list` introspection is used.
303
+ The connection is read-only: the query editor accepts only
304
+ `SELECT` / `PRAGMA` / `EXPLAIN` / `WITH`, and the grid's row editing is
305
+ unavailable.
306
+
307
+ **Cloudflare R2**: R2 speaks the S3 API, so it is a saved connection of type
308
+ `s3` with the **Cloudflare R2** provider preset. Enter the account ID and an R2
309
+ access key pair; the endpoint (`https://<account-id>.r2.cloudflarestorage.com`)
310
+ and the required `auto` signing region are filled in for you. Everything in the
311
+ object-storage section below applies.
312
+
313
+ **S3-compatible object storage** (MinIO, LocalStack, Cloudflare R2): browse
278
314
  buckets as a folder tree, search by prefix or filename, sort scanned objects by
279
315
  update time, and preview images, video, audio, PDFs, Markdown, HTML, and text
280
316
  files. Edit text/markdown/JSON object bodies inline, upload new objects to any
@@ -291,27 +327,45 @@ table grid to insert, update, or delete rows inline. Edits queue as pending
291
327
  changes (shown with a yellow highlight on the affected row/cell) and are
292
328
  applied as a single transaction on commit. Row updates and deletes require the
293
329
  table to have a primary key. The whole batch rolls back on the first
294
- constraint violation.
330
+ constraint violation. Cloudflare D1 is browsed read-only, so Edit mode is not
331
+ offered there.
295
332
 
296
333
  ### Browser UI
297
334
 
298
335
  Open Datastores in the global navigation to access:
299
336
 
300
337
  - **Saved connections** — use the `+` action beside the datastore selector to
301
- add PostgreSQL, MySQL, Redis, Elasticsearch, S3-compatible, or DynamoDB
302
- endpoints that are not present in the repository's local discovery files.
338
+ add PostgreSQL, MySQL, Cloudflare D1, Redis, Elasticsearch, S3-compatible
339
+ (including Cloudflare R2), or DynamoDB endpoints that are not present in the
340
+ repository's local discovery files.
303
341
  Required fields are marked in the connection dialog, and **Test connection**
304
342
  verifies the current values before saving. Saved connections can be edited
305
343
  or deleted from the adjacent actions.
306
344
  PostgreSQL, MySQL, and Redis use Node.js drivers installed automatically with
307
- this package, while Elasticsearch, S3, and DynamoDB use built-in HTTP
308
- clients. No database CLI or `curl` installation is required for saved
309
- connections.
310
- Non-secret settings are stored in `.code-viewer/datastore-connections.json`.
311
- User names, access key IDs, passwords, secret keys, and session tokens remain
312
- in server memory only and are never written to that file or returned by
313
- list/edit responses, so they must be entered again after restarting
314
- code-viewer.
345
+ this package, while Cloudflare D1, Elasticsearch, S3, and DynamoDB use
346
+ built-in HTTP clients. No database CLI or `curl` installation is required for
347
+ saved connections.
348
+ Non-secret settings (host, endpoint, account/database id, region, …) are
349
+ stored in `.code-viewer/datastore-connections.json`. User names, access key
350
+ IDs, passwords, secret keys, session tokens, and API tokens are never written
351
+ to that file and are never returned by list/edit responses.
352
+
353
+ Those credentials are kept in the macOS Keychain (one generic-password item
354
+ per connection, service `code-viewer`) and reloaded on demand, so they
355
+ survive a restart without being stored anywhere in the repository. The
356
+ keychain item is written through `security -i`, which reads the command from
357
+ stdin, so the secret never appears in any process's argument list. Deleting a
358
+ connection also deletes its keychain item; if that fails (a locked keychain,
359
+ for example) the connection is still removed and the UI says the credentials
360
+ were left behind, so you can clear them from Keychain Access yourself.
361
+
362
+ Credentials are deliberately not encrypted into a file next to the data: a
363
+ file the app can decrypt unattended needs its key on the same disk, which is
364
+ no stronger than plaintext. Key protection is left to the OS.
365
+
366
+ On platforms without keychain integration (currently everything except
367
+ macOS), credentials stay in server memory only and must be entered again
368
+ after restarting code-viewer.
315
369
 
316
370
  - **Multi-DB tabs** — open multiple databases side by side, with their own
317
371
  sidebar, panes, and history. `+` adds an empty tab; `×` or middle-click