mbeditor 0.14.1 → 0.14.3

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +66 -0
  3. data/app/assets/javascripts/mbeditor/application.js +5 -1
  4. data/app/assets/javascripts/mbeditor/collaboration_identity.js +4 -2
  5. data/app/assets/javascripts/mbeditor/collaboration_service.js +74 -2
  6. data/app/assets/javascripts/mbeditor/components/AiRoundTripModal.js +452 -0
  7. data/app/assets/javascripts/mbeditor/components/ChangelogView.js +1 -1
  8. data/app/assets/javascripts/mbeditor/components/CombinedFileView.js +44 -29
  9. data/app/assets/javascripts/mbeditor/components/DiffViewer.js +2 -1
  10. data/app/assets/javascripts/mbeditor/components/EditorPanel.js +33 -27
  11. data/app/assets/javascripts/mbeditor/components/FileHistoryPanel.js +2 -7
  12. data/app/assets/javascripts/mbeditor/components/FileTree.js +144 -4
  13. data/app/assets/javascripts/mbeditor/components/GitPanel.js +1 -1
  14. data/app/assets/javascripts/mbeditor/components/ImportConflictModal.js +7 -68
  15. data/app/assets/javascripts/mbeditor/components/ImportDialog.js +2 -16
  16. data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +368 -471
  17. data/app/assets/javascripts/mbeditor/components/ModalDialog.js +203 -0
  18. data/app/assets/javascripts/mbeditor/components/PastePlaceModal.js +1 -9
  19. data/app/assets/javascripts/mbeditor/components/Popover.js +88 -0
  20. data/app/assets/javascripts/mbeditor/components/PopupMenu.js +166 -0
  21. data/app/assets/javascripts/mbeditor/components/ProblemsPanel.js +8 -4
  22. data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +5 -7
  23. data/app/assets/javascripts/mbeditor/components/SettingsModal.js +3 -14
  24. data/app/assets/javascripts/mbeditor/components/ShortcutHelp.js +5 -26
  25. data/app/assets/javascripts/mbeditor/components/TabBar.js +15 -32
  26. data/app/assets/javascripts/mbeditor/components/TestResultsPanel.js +2 -7
  27. data/app/assets/javascripts/mbeditor/editor_plugins.js +3 -23
  28. data/app/assets/javascripts/mbeditor/file_service.js +1 -1
  29. data/app/assets/javascripts/mbeditor/git_service.js +0 -7
  30. data/app/assets/javascripts/mbeditor/patch_select.js +156 -0
  31. data/app/assets/javascripts/mbeditor/tab_manager.js +22 -0
  32. data/app/assets/stylesheets/mbeditor/application.css +7 -110
  33. data/app/assets/stylesheets/mbeditor/editor.css +200 -194
  34. data/app/assets/stylesheets/mbeditor/glass.css +1 -1
  35. data/app/channels/mbeditor/collaboration_channel.rb +24 -5
  36. data/app/controllers/mbeditor/editors_controller.rb +75 -38
  37. data/app/controllers/mbeditor/git_controller.rb +1 -12
  38. data/app/services/mbeditor/ai_bundle_service.rb +181 -0
  39. data/app/services/mbeditor/archive_service.rb +43 -6
  40. data/app/services/mbeditor/availability_probe.rb +2 -2
  41. data/app/services/mbeditor/code_search_service.rb +1 -3
  42. data/app/services/mbeditor/collaboration_doc_store.rb +37 -1
  43. data/app/services/mbeditor/exclusion_matcher.rb +0 -4
  44. data/app/services/mbeditor/file_import_service.rb +4 -1
  45. data/app/services/mbeditor/file_operation_service.rb +3 -3
  46. data/app/services/mbeditor/git_service.rb +11 -45
  47. data/app/services/mbeditor/js_definition_service.rb +1 -0
  48. data/app/services/mbeditor/model_graph_service.rb +1 -0
  49. data/app/services/mbeditor/patch_apply_service.rb +185 -0
  50. data/app/services/mbeditor/rails_related_files_service.rb +1 -1
  51. data/app/services/mbeditor/redmine_config_error.rb +6 -0
  52. data/app/services/mbeditor/redmine_disabled_error.rb +10 -0
  53. data/app/services/mbeditor/redmine_service.rb +0 -8
  54. data/app/services/mbeditor/ruby_definition_service.rb +1 -0
  55. data/app/services/mbeditor/schema_service.rb +1 -0
  56. data/app/services/mbeditor/test_runner_service.rb +1 -1
  57. data/lib/mbeditor/rack/silence_ping_request.rb +14 -14
  58. data/lib/mbeditor/route_map.rb +5 -2
  59. data/lib/mbeditor/ruby_lsp_client.rb +7 -26
  60. data/lib/mbeditor/version.rb +1 -1
  61. data/public/monaco-editor/VERSIONS +2 -1
  62. data/public/monaco-editor/monaco.js +226 -226
  63. metadata +11 -4
  64. data/app/assets/javascripts/mbeditor/components/CommitGraph.js +0 -65
  65. data/app/services/mbeditor/git_commit_graph_service.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6faf6632c3072f98fe34083c809069a4e37ed9e956fd6722fd2fb188ed13c55
4
- data.tar.gz: 24e179af4efd250cef7ddeec7d81a8c033891af89cb286980ddbb3541f543239
3
+ metadata.gz: 1fc498e721a6a3b9cb8aa187521e9e364a3a7362805b9f4a6e6607160ee4d959
4
+ data.tar.gz: ac57067a597ef2d067bc230f67b63b15c3b0117798c6a19611eae14fae7f9a0a
5
5
  SHA512:
6
- metadata.gz: 800cbc5afda678e3ae3298dc781f39054c32ecb0098dc82e68df9c6f0f8222ba4e5c06d0c6b424e50360dda0f02ed678169c4f4922353c432c8c0b446f28f428
7
- data.tar.gz: 49bca37c5e4a696a4ba1ec4f5f01454899d006cb827f109e11a96e46feb65544ac7c85afdc55756076302618a2af30ced210e1b149b85690899b6801f5dcd37b
6
+ metadata.gz: 5562930f430efcc27e92c39a7b6a35c91fc3727f42bca96fb3f49b2df4494ab6cc1a72b72fe9600e810b330b4f1dba1cc46868c35078cb0ff981f2fb1f7d2a80
7
+ data.tar.gz: fb7cbc0cdbcfd74a690efb84fc8a7df18aa5b252c64c4b48e1535c22671077cc928ae3fb22f8b812afaf219d8b8d57c74e63e6af71d7c415436144f3c719c55d
data/CHANGELOG.md CHANGED
@@ -5,6 +5,72 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.14.3] - 2026-11-25
9
+
10
+ ### Added
11
+ - **AI round trip** (robot button, top right). Export the project, with a
12
+ choice of folders, as one Markdown bundle for a web chat assistant. A
13
+ separate short prompt tells the agent to unpack it and grep it instead of
14
+ reading it whole. Paste or upload the unified diff it returns to see one
15
+ scrollable, syntax-highlighted red/green view. Choose which hunks to keep,
16
+ then apply them with `git apply`. Files can be created, deleted and
17
+ renamed.
18
+ - **Rails panel**: open files are outlined, and an "Open all" button opens
19
+ every file of a resource (e.g. all User files).
20
+ - **Keyboard-operable file tree** following the WAI-ARIA tree pattern
21
+ (arrows, Home/End, Enter, Space, type-to-find).
22
+ - **Keyboard-operable context menus** in the explorer and tabs (arrows,
23
+ Enter/Space, Esc, Shift+F10).
24
+ - Correctness lint for Ruby (`bundle exec rubocop`, Lint department only)
25
+ and JS (`npm run lint:js`), run in CI.
26
+
27
+ ### Changed
28
+ - Every modal is a native `<dialog>`, and menus and hovercards are popovers.
29
+ They now get the browser's focus containment, Esc handling and top layer,
30
+ and follow the light theme. `window.confirm` and `window.prompt` are
31
+ replaced by in-app dialogs, so they no longer block the page.
32
+ - Themed scrollbars in Firefox (`scrollbar-color` / `scrollbar-width`).
33
+
34
+ ### Fixed
35
+ - **Import and export hardening** after an audit:
36
+ - The AI bundle skips secrets (`.env*`, keys, credentials).
37
+ - Unpacking survives a file that contains its own end marker.
38
+ - Non-ASCII names no longer crash, and errors never show host paths.
39
+ - Patches cannot write excluded paths or create symlinks.
40
+ - Imports overwrite files atomically.
41
+ - `/raw` serves markup sandboxed as plain text.
42
+ - **A shared (collaborative) tab no longer reverts an applied patch or an
43
+ external edit.** It takes the new disk content once, without duplicating
44
+ it. Unsaved shared edits are kept, and the reload banner shows instead.
45
+ - A file opened from Quick Open now gets editor focus.
46
+ - Esc no longer threw a ReferenceError.
47
+ - ruby-lsp now restarts once its crash window has passed. Before, it stayed
48
+ failed until Rails restarted.
49
+ - Monaco ships a patched DOMPurify.
50
+
51
+ ## [0.14.2] - 2026-10-20
52
+
53
+ ### Added
54
+ - **Combined View picker.** One "Copy .md" / "Download .md" at the top
55
+ replaces the per-file buttons, above a scrollable picker with a checkbox per
56
+ file and, for `.rb` files, per method. Unticked files are left out; ticked
57
+ methods limit a file to those methods.
58
+ - The Markdown export now opens with a `# Files` index of the included paths.
59
+ - **Open all editors in Combined View**: a stacked-layers action on the OPEN
60
+ EDITORS header.
61
+
62
+ ### Fixed
63
+ - **Checkboxes inside editor panes did not respond to clicks.** The pane's
64
+ click-capture focus handler set store state on every click, and under the
65
+ legacy React root that re-render reset the controlled checkbox before React
66
+ saw it change. Focusing is now a no-op when nothing changes, and happens on
67
+ mousedown.
68
+ - **The editor right-click menu was dim and unreadable** (since Monaco 0.57):
69
+ it rendered in a shadow root the theme's `--vscode-*` variables cannot reach.
70
+ Editors now use `useShadowDOM: false`.
71
+ - **The explorer's workspace header went transparent on hover** with Liquid
72
+ Glass off, letting the scrolled tree show through.
73
+
8
74
  ## [0.14.1] - 2026-10-19
9
75
 
10
76
  ### Added
@@ -18,12 +18,14 @@
18
18
  //= require mbeditor/ruby_outline
19
19
  //= require mbeditor/js_outline
20
20
  //= require mbeditor/components/CollapsibleSection
21
+ //= require mbeditor/components/ModalDialog
22
+ //= require mbeditor/components/Popover
23
+ //= require mbeditor/components/PopupMenu
21
24
  //= require mbeditor/components/SettingsModal
22
25
  //= require mbeditor/components/Gutter
23
26
  //= require mbeditor/components/ShortcutHelp
24
27
  //= require mbeditor/components/DiffViewer
25
28
  //= require mbeditor/components/CombinedDiffViewer
26
- //= require mbeditor/components/CommitGraph
27
29
  //= require mbeditor/components/ModelGraph
28
30
  //= require mbeditor/components/ChangelogView
29
31
  //= require mbeditor/components/CombinedFileView
@@ -43,6 +45,8 @@
43
45
  // whole app down the first time it renders.
44
46
  //= require mbeditor/components/ImportConflictModal
45
47
  //= require mbeditor/components/ImportDialog
48
+ //= require mbeditor/patch_select
49
+ //= require mbeditor/components/AiRoundTripModal
46
50
  //= require mbeditor/components/PastePlaceModal
47
51
  //= require mbeditor/components/MbeditorApp
48
52
  //= require mbeditor/application_iife_tail
@@ -206,10 +206,12 @@ var CollaborationIdentity = (function () {
206
206
 
207
207
  // Prompt-based editor wired to the status-bar presence chip. Returns nothing;
208
208
  // listeners pick up the change and push it onto live awareness.
209
+ // MbeditorDialogs is defined later in the bundle (ModalDialog.js) but is
210
+ // only read at call time, by which point the whole bundle has run.
209
211
  function editName() {
210
212
  var current = get().name;
211
- var next = window.prompt('Your collaboration name', current);
212
- if (next != null) setName(next);
213
+ window.MbeditorDialogs.prompt({ title: 'Collaboration name', message: 'Shown to people editing with you.', value: current, confirmLabel: 'Save' })
214
+ .then(function (next) { if (next != null) setName(next); });
213
215
  }
214
216
 
215
217
  // Subscribe to identity changes (name or colour). Returns an unsubscribe fn.
@@ -407,6 +407,9 @@ var CollaborationService = (function () {
407
407
  // A peer's replay was incomplete. Answer with our full state if we hold
408
408
  // one, so it can attach instead of diverging on stale text.
409
409
  if (room.binding && room.text.length > 0) pushSnapshot(room.path);
410
+ } else if (data.type === 'disk_claim') {
411
+ var onClaim = room.diskClaims && room.diskClaims[data.key];
412
+ if (onClaim) { delete room.diskClaims[data.key]; onClaim(!!data.granted); }
410
413
  } else if (data.type === 'awareness') {
411
414
  if (data.awareness && room.awareness && window.awarenessProtocol) {
412
415
  // REMOTE origin keeps the outbound handler from echoing peer state back.
@@ -895,8 +898,7 @@ var CollaborationService = (function () {
895
898
 
896
899
  // True when the room owns the file's content (a late-join applied shared state):
897
900
  // EditorPanel must then NOT apply the disk content at open, which would clobber it.
898
- // Later external on-disk edits are filtered earlier, at the change-detection source
899
- // (MbeditorApp.checkOpenTabsForExternalChanges), which skips any collab-bound file.
901
+ // Later external on-disk edits reach an attached room through applyDiskContent.
900
902
  function consumesDiskLoad(path) {
901
903
  var room = _rooms[path];
902
904
  return !!(room && room.binding && room.lateJoin);
@@ -984,6 +986,74 @@ var CollaborationService = (function () {
984
986
  return !!(room && room.binding);
985
987
  }
986
988
 
989
+ function _normEol(s) { return String(s).replace(/\r\n/g, '\n'); }
990
+
991
+ // FNV-1a: an opaque key the server compares for equality, nothing more.
992
+ function _contentKey(s) {
993
+ var h = 0x811c9dc5;
994
+ for (var i = 0; i < s.length; i++) {
995
+ h ^= s.charCodeAt(i);
996
+ h = Math.imul(h, 0x01000193);
997
+ }
998
+ return s.length + ':' + (h >>> 0).toString(16);
999
+ }
1000
+
1001
+ // The file was rewritten on disk (apply patch, import) while this room's
1002
+ // shared text still holds the old version. Every attached client calls this,
1003
+ // but only the one the server grants (claim_disk_write) replaces the text;
1004
+ // two replacements would insert two copies. The rest receive it as a
1005
+ // doc_update. onConverged fires on each client once its text matches disk,
1006
+ // so it can rebaseline the tab as clean. Returns false when not attached.
1007
+ function applyDiskContent(path, content, onConverged) {
1008
+ var room = _rooms[path];
1009
+ if (!room || !room.binding || !room.subscription) return false;
1010
+ // Stop listening if the granted peer's update never arrives; the next
1011
+ // external-change check finds the tab still behind and asks again.
1012
+ var watch = _watchText(room, content, onConverged, 15000);
1013
+ if (watch.done()) return true;
1014
+ var key = _contentKey(_normEol(content));
1015
+ room.diskClaims = room.diskClaims || {};
1016
+ room.diskClaims[key] = function (granted) {
1017
+ if (!granted || watch.done() || !room.binding) return;
1018
+ room.doc.transact(function () {
1019
+ room.text.delete(0, room.text.length);
1020
+ room.text.insert(0, content);
1021
+ });
1022
+ };
1023
+ try { room.subscription.perform('claim_disk_write', { key: key }); } catch (e) { /* cable down */ }
1024
+ return true;
1025
+ }
1026
+
1027
+ // A tab waiting on a reload banner: a peer may resolve it (Discard & Reload)
1028
+ // without any disk write, so no files_changed ever reaches this client. Fire
1029
+ // cb once the shared text equals content. No timeout; leaveRoom destroys the
1030
+ // doc and its observers with it.
1031
+ function whenContentMatches(path, content, cb) {
1032
+ var room = _rooms[path];
1033
+ if (!room || !room.binding) return false;
1034
+ _watchText(room, content, cb, 0);
1035
+ return true;
1036
+ }
1037
+
1038
+ function _watchText(room, content, cb, timeoutMs) {
1039
+ var target = _normEol(content);
1040
+ var done = false;
1041
+ var timer = null;
1042
+ var settle = function () {
1043
+ if (done || _normEol(room.text.toString()) !== target) return;
1044
+ done = true;
1045
+ room.text.unobserve(settle);
1046
+ if (timer) clearTimeout(timer);
1047
+ cb();
1048
+ };
1049
+ settle();
1050
+ if (!done) {
1051
+ room.text.observe(settle);
1052
+ if (timeoutMs) timer = setTimeout(function () { done = true; room.text.unobserve(settle); }, timeoutMs);
1053
+ }
1054
+ return { done: function () { return done; } };
1055
+ }
1056
+
987
1057
  // Push a fresh full snapshot to the server so it can compact the doc store:
988
1058
  // CollaborationDocStore.replace_snapshot swaps the cached snapshot and keeps
989
1059
  // only the deltas recorded after `applied_seq` (the newest sequence this client
@@ -1019,6 +1089,8 @@ var CollaborationService = (function () {
1019
1089
  isBound: isBound,
1020
1090
  isAttached: isAttached,
1021
1091
  pushSnapshot: pushSnapshot,
1092
+ applyDiskContent: applyDiskContent,
1093
+ whenContentMatches: whenContentMatches,
1022
1094
  setFollow: setFollow,
1023
1095
  clearFollow: clearFollow
1024
1096
  };