@innovatorved/code-lab 0.3.2 → 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.
Files changed (155) hide show
  1. package/ARCHITECTURE.md +5 -3
  2. package/CHANGELOG.md +20 -0
  3. package/README.md +70 -168
  4. package/dist/apps/web/src/index.d.ts +34 -0
  5. package/dist/code-lab-sql.css +482 -0
  6. package/dist/code-lab-sql.d.ts +179 -0
  7. package/dist/code-lab-sql.esm.js +542 -0
  8. package/dist/code-lab-sql.umd.js +531 -0
  9. package/dist/code-lab.css +246 -0
  10. package/dist/code-lab.d.ts +110 -15
  11. package/dist/code-lab.esm.js +34265 -18104
  12. package/dist/code-lab.js +33186 -17053
  13. package/dist/code-lab.umd.js +65502 -0
  14. package/dist/extensions/cpp.esm.js +19478 -3760
  15. package/dist/extensions/cpp.js +19475 -3757
  16. package/dist/extensions/guided-lab.esm.js +19401 -3725
  17. package/dist/extensions/guided-lab.js +19400 -3724
  18. package/dist/extensions/python.d.ts +1 -0
  19. package/dist/extensions/python.esm.js +19576 -3766
  20. package/dist/extensions/python.js +19576 -3766
  21. package/dist/extensions/umbrella.d.ts +5 -0
  22. package/dist/index.d.ts +1 -1
  23. package/dist/modular-kernel.d.ts +11 -0
  24. package/dist/packages/commands/src/index.d.ts +96 -0
  25. package/dist/packages/core/src/di.d.ts +36 -0
  26. package/dist/packages/core/src/disposable.d.ts +27 -0
  27. package/dist/packages/core/src/errors.d.ts +69 -0
  28. package/dist/packages/core/src/events.d.ts +38 -0
  29. package/dist/packages/core/src/index.d.ts +6 -0
  30. package/dist/packages/core/src/path.d.ts +14 -0
  31. package/dist/packages/core/src/registry.d.ts +23 -0
  32. package/dist/packages/editor/src/index.d.ts +118 -0
  33. package/dist/packages/fs/src/backends.d.ts +37 -0
  34. package/dist/packages/fs/src/index.d.ts +3 -0
  35. package/dist/packages/fs/src/types.d.ts +40 -0
  36. package/dist/packages/fs/src/vfs-service.d.ts +33 -0
  37. package/dist/packages/preview/src/index.d.ts +34 -0
  38. package/dist/packages/runtime/src/index.d.ts +47 -0
  39. package/dist/packages/settings/src/builtin-schemas.d.ts +15 -0
  40. package/dist/packages/settings/src/configuration-service.d.ts +100 -0
  41. package/dist/packages/settings/src/index.d.ts +4 -0
  42. package/dist/packages/settings/src/jsonc.d.ts +20 -0
  43. package/dist/packages/settings/src/schema.d.ts +28 -0
  44. package/dist/packages/sql/src/completions.d.ts +8 -0
  45. package/dist/packages/sql/src/diagnostics.d.ts +2 -0
  46. package/dist/packages/sql/src/formatter.d.ts +2 -0
  47. package/dist/packages/sql/src/index.d.ts +7 -0
  48. package/dist/packages/sql/src/sql-editor.d.ts +2 -0
  49. package/dist/packages/sql/src/styles.d.ts +2 -0
  50. package/dist/packages/sql/src/tokenizer.d.ts +13 -0
  51. package/dist/packages/sql/src/types.d.ts +130 -0
  52. package/dist/packages/terminal/src/index.d.ts +54 -0
  53. package/dist/packages/ui/src/index.d.ts +4 -0
  54. package/dist/packages/ui/src/observability.d.ts +22 -0
  55. package/dist/packages/ui/src/plugin-registry.d.ts +89 -0
  56. package/dist/packages/ui/src/settings-dialog.d.ts +25 -0
  57. package/dist/packages/ui/src/themes.d.ts +35 -0
  58. package/dist/preview-sw.js +53 -12
  59. package/dist/runtime.d.ts +3 -3
  60. package/dist/runtime.esm.js +467 -44
  61. package/dist/runtime.js +465 -44
  62. package/dist/schemas.d.ts +234 -814
  63. package/dist/schemas.esm.js +19401 -3725
  64. package/dist/schemas.js +19404 -3728
  65. package/dist/shell.d.ts +1 -1
  66. package/dist/shell.esm.js +364 -39
  67. package/dist/shell.js +364 -39
  68. package/dist/terminal.esm.js +62 -3
  69. package/dist/terminal.js +62 -3
  70. package/dist/workbench/diff-editor.d.ts +1 -0
  71. package/package.json +37 -8
  72. package/packages/commands/README.md +7 -0
  73. package/packages/commands/package.json +16 -0
  74. package/packages/commands/src/index.ts +467 -0
  75. package/packages/commands/tsconfig.json +22 -0
  76. package/packages/core/README.md +12 -0
  77. package/packages/core/package.json +13 -0
  78. package/packages/core/src/di.ts +147 -0
  79. package/packages/core/src/disposable.ts +112 -0
  80. package/packages/core/src/errors.ts +205 -0
  81. package/packages/core/src/events.ts +157 -0
  82. package/packages/core/src/index.ts +49 -0
  83. package/packages/core/src/path.ts +118 -0
  84. package/packages/core/src/registry.ts +61 -0
  85. package/packages/core/tsconfig.json +19 -0
  86. package/packages/editor/README.md +9 -0
  87. package/packages/editor/package.json +18 -0
  88. package/packages/editor/src/index.ts +344 -0
  89. package/packages/editor/tsconfig.json +24 -0
  90. package/packages/fs/README.md +7 -0
  91. package/packages/fs/package.json +16 -0
  92. package/packages/fs/src/backends.ts +301 -0
  93. package/packages/fs/src/index.ts +18 -0
  94. package/packages/fs/src/types.ts +44 -0
  95. package/packages/fs/src/vfs-service.ts +257 -0
  96. package/packages/fs/tsconfig.json +22 -0
  97. package/packages/preview/README.md +3 -0
  98. package/packages/preview/package.json +16 -0
  99. package/packages/preview/src/index.ts +125 -0
  100. package/packages/preview/tsconfig.json +22 -0
  101. package/packages/runtime/README.md +3 -0
  102. package/packages/runtime/package.json +17 -0
  103. package/packages/runtime/src/index.ts +134 -0
  104. package/packages/runtime/tsconfig.json +23 -0
  105. package/packages/settings/README.md +7 -0
  106. package/packages/settings/package.json +16 -0
  107. package/packages/settings/src/builtin-schemas.ts +235 -0
  108. package/packages/settings/src/configuration-service.ts +543 -0
  109. package/packages/settings/src/index.ts +37 -0
  110. package/packages/settings/src/jsonc.ts +189 -0
  111. package/packages/settings/src/schema.ts +164 -0
  112. package/packages/settings/tsconfig.json +22 -0
  113. package/packages/sql/README.md +12 -0
  114. package/packages/sql/package.json +13 -0
  115. package/packages/sql/src/completions.ts +359 -0
  116. package/packages/sql/src/diagnostics.ts +200 -0
  117. package/packages/sql/src/formatter.ts +271 -0
  118. package/packages/sql/src/index.ts +54 -0
  119. package/packages/sql/src/sql-editor.ts +802 -0
  120. package/packages/sql/src/styles.ts +501 -0
  121. package/packages/sql/src/tokenizer.ts +457 -0
  122. package/packages/sql/src/types.ts +148 -0
  123. package/packages/sql/tsconfig.json +19 -0
  124. package/packages/terminal/README.md +3 -0
  125. package/packages/terminal/package.json +16 -0
  126. package/packages/terminal/src/index.ts +183 -0
  127. package/packages/terminal/tsconfig.json +22 -0
  128. package/packages/ui/README.md +8 -0
  129. package/packages/ui/package.json +18 -0
  130. package/packages/ui/src/index.ts +36 -0
  131. package/packages/ui/src/observability.ts +175 -0
  132. package/packages/ui/src/plugin-registry.ts +274 -0
  133. package/packages/ui/src/settings-dialog.ts +293 -0
  134. package/packages/ui/src/themes.ts +174 -0
  135. package/packages/ui/tsconfig.json +24 -0
  136. package/src/code-lab.css +246 -0
  137. package/src/extensions/cpp.ts +58 -15
  138. package/src/extensions/python.ts +156 -24
  139. package/src/extensions/umbrella.ts +5 -0
  140. package/src/index.ts +1 -1
  141. package/src/modular-kernel.ts +11 -0
  142. package/src/preview-sw.js +52 -11
  143. package/src/runtime.ts +466 -46
  144. package/src/schemas.ts +62 -62
  145. package/src/shell.ts +363 -39
  146. package/src/terminal.ts +60 -2
  147. package/src/workbench/diff-editor.ts +66 -6
  148. package/src/workbench/icons.ts +5 -2
  149. package/src/workbench.ts +2410 -220
  150. package/dist/runtime/index.d.ts +0 -4
  151. package/dist/shell/coreutils/compilers-cli.d.ts +0 -24
  152. package/dist/shell/index.d.ts +0 -4
  153. package/src/runtime/index.ts +0 -5
  154. package/src/shell/coreutils/compilers-cli.ts +0 -103
  155. package/src/shell/index.ts +0 -5
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.3.2 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.4.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -86,6 +86,7 @@ var CodeLabLogger = (() => {
86
86
  } catch (err) {
87
87
  sinkError = err;
88
88
  }
89
+ void sinkError;
89
90
  }
90
91
  const consoleObj = typeof console !== "undefined" ? console : null;
91
92
  const fn = consoleObj ? consoleObj[level] : null;
@@ -447,6 +448,9 @@ var CodeLabLogger = (() => {
447
448
  this.maxScrollback = typeof this.options.maxScrollback === 'number' && this.options.maxScrollback > 0
448
449
  ? this.options.maxScrollback
449
450
  : MAX_SCROLLBACK;
451
+ this.maxHistory = typeof this.options.maxHistory === 'number' && this.options.maxHistory > 0
452
+ ? this.options.maxHistory
453
+ : 1000;
450
454
  this.logs = Array.isArray(this.options.logs) ? this.options.logs : [];
451
455
  this.cwd = this.options.cwd || '/workspace';
452
456
  this.replMode = Boolean(this.options.replMode);
@@ -735,14 +739,60 @@ var CodeLabLogger = (() => {
735
739
  }
736
740
  }
737
741
 
738
- readLine(promptText = '') {
742
+ _drainReadLineQueue(result = null) {
743
+ if (!Array.isArray(this._readLineQueue) || this._readLineQueue.length === 0) return;
744
+ const queued = this._readLineQueue.splice(0, this._readLineQueue.length);
745
+ let restoredPrompt = undefined;
746
+ for (const entry of queued) {
747
+ if (entry && typeof entry === 'object' && entry._activated && restoredPrompt === undefined) {
748
+ restoredPrompt = entry.prevPrompt;
749
+ }
750
+ if (entry && typeof entry.cleanup === 'function') {
751
+ entry.cleanup();
752
+ }
753
+ }
754
+ if (restoredPrompt !== undefined) {
755
+ this.promptOverride = restoredPrompt;
756
+ }
757
+ for (const entry of queued) {
758
+ if (typeof entry === 'function') {
759
+ try { entry(result); } catch (err) { _terminalLogger.debug('readLine callback threw during drain.', err); }
760
+ } else if (entry && typeof entry.resolve === 'function') {
761
+ try { entry.resolve(result); } catch (err) { _terminalLogger.debug('readLine resolve threw during drain.', err); }
762
+ }
763
+ }
764
+ }
765
+
766
+ readLine(promptText = '', options = {}) {
767
+ if (options && options.signal && options.signal.aborted) {
768
+ return Promise.resolve(null);
769
+ }
739
770
  return new Promise((resolve) => {
740
771
  const item = {
741
772
  promptText: String(promptText || ''),
742
773
  prevPrompt: null,
743
774
  _activated: false,
775
+ cleanup: null,
744
776
  resolve
745
777
  };
778
+ if (options && options.signal && typeof options.signal.addEventListener === 'function') {
779
+ const onAbort = () => {
780
+ const idx = this._readLineQueue.indexOf(item);
781
+ if (idx !== -1) {
782
+ this._readLineQueue.splice(idx, 1);
783
+ if (item._activated) {
784
+ this.promptOverride = item.prevPrompt;
785
+ this._activateNextReadLine();
786
+ }
787
+ this.updateActiveLine();
788
+ resolve(null);
789
+ }
790
+ };
791
+ options.signal.addEventListener('abort', onAbort, { once: true });
792
+ item.cleanup = () => {
793
+ try { options.signal.removeEventListener('abort', onAbort); } catch (err) { _terminalLogger.debug('readLine abort listener cleanup failed.', err); }
794
+ };
795
+ }
746
796
  this._readLineQueue.push(item);
747
797
  this._activateNextReadLine();
748
798
  this.updateActiveLine();
@@ -786,6 +836,7 @@ var CodeLabLogger = (() => {
786
836
  }
787
837
 
788
838
  destroy() {
839
+ this._drainReadLineQueue(null);
789
840
  this._cleanupListeners();
790
841
  this._mounted = false;
791
842
  }
@@ -868,12 +919,13 @@ var CodeLabLogger = (() => {
868
919
 
869
920
  if (isCtrl && (key === 'c' || key === 'C')) {
870
921
  if (e.preventDefault) e.preventDefault();
871
- const wasBusy = this.isBusy;
922
+ const wasBusy = this.isBusy || (this._readLineQueue && this._readLineQueue.length > 0);
872
923
  this.isBusy = false;
873
924
  this._pushLog({ type: 'system', text: wasBusy ? '^C' : `${this.getPrompt()}${this.buffer}^C` });
874
925
  this.buffer = '';
875
926
  this.cursor = 0;
876
927
  this.historyIdx = -1;
928
+ this._drainReadLineQueue(null);
877
929
  if (this.replMode) {
878
930
  this.replMode = false;
879
931
  }
@@ -1135,6 +1187,9 @@ var CodeLabLogger = (() => {
1135
1187
  this.searchMatchIdx = -1;
1136
1188
 
1137
1189
  const entry = this._readLineQueue.shift();
1190
+ if (entry && typeof entry.cleanup === 'function') {
1191
+ entry.cleanup();
1192
+ }
1138
1193
  if (typeof entry === 'function') {
1139
1194
  this.updateActiveLine();
1140
1195
  entry(line);
@@ -1171,6 +1226,10 @@ var CodeLabLogger = (() => {
1171
1226
  if (line.trim()) {
1172
1227
  if (this.history[this.history.length - 1] !== line.trim()) {
1173
1228
  this.history.push(line.trim());
1229
+ const maxHist = typeof this.maxHistory === 'number' && this.maxHistory > 0 ? this.maxHistory : 1000;
1230
+ if (this.history.length > maxHist) {
1231
+ this.history.splice(0, this.history.length - maxHist);
1232
+ }
1174
1233
  }
1175
1234
  }
1176
1235
 
package/dist/terminal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ============================================================
3
- * @innovatorved/code-lab v0.3.2 — Standalone Browser Code IDE & Virtual Runtime
3
+ * @innovatorved/code-lab v0.4.0 — Standalone Browser Code IDE & Virtual Runtime
4
4
  * ============================================================
5
5
  * Features:
6
6
  * - Sandboxed Web Worker Execution Engine with Multi-Instance Isolation & Watchdog Timer
@@ -87,6 +87,7 @@ var CodeLabLogger = (() => {
87
87
  } catch (err) {
88
88
  sinkError = err;
89
89
  }
90
+ void sinkError;
90
91
  }
91
92
  const consoleObj = typeof console !== "undefined" ? console : null;
92
93
  const fn = consoleObj ? consoleObj[level] : null;
@@ -448,6 +449,9 @@ var CodeLabLogger = (() => {
448
449
  this.maxScrollback = typeof this.options.maxScrollback === 'number' && this.options.maxScrollback > 0
449
450
  ? this.options.maxScrollback
450
451
  : MAX_SCROLLBACK;
452
+ this.maxHistory = typeof this.options.maxHistory === 'number' && this.options.maxHistory > 0
453
+ ? this.options.maxHistory
454
+ : 1000;
451
455
  this.logs = Array.isArray(this.options.logs) ? this.options.logs : [];
452
456
  this.cwd = this.options.cwd || '/workspace';
453
457
  this.replMode = Boolean(this.options.replMode);
@@ -736,14 +740,60 @@ var CodeLabLogger = (() => {
736
740
  }
737
741
  }
738
742
 
739
- readLine(promptText = '') {
743
+ _drainReadLineQueue(result = null) {
744
+ if (!Array.isArray(this._readLineQueue) || this._readLineQueue.length === 0) return;
745
+ const queued = this._readLineQueue.splice(0, this._readLineQueue.length);
746
+ let restoredPrompt = undefined;
747
+ for (const entry of queued) {
748
+ if (entry && typeof entry === 'object' && entry._activated && restoredPrompt === undefined) {
749
+ restoredPrompt = entry.prevPrompt;
750
+ }
751
+ if (entry && typeof entry.cleanup === 'function') {
752
+ entry.cleanup();
753
+ }
754
+ }
755
+ if (restoredPrompt !== undefined) {
756
+ this.promptOverride = restoredPrompt;
757
+ }
758
+ for (const entry of queued) {
759
+ if (typeof entry === 'function') {
760
+ try { entry(result); } catch (err) { _terminalLogger.debug('readLine callback threw during drain.', err); }
761
+ } else if (entry && typeof entry.resolve === 'function') {
762
+ try { entry.resolve(result); } catch (err) { _terminalLogger.debug('readLine resolve threw during drain.', err); }
763
+ }
764
+ }
765
+ }
766
+
767
+ readLine(promptText = '', options = {}) {
768
+ if (options && options.signal && options.signal.aborted) {
769
+ return Promise.resolve(null);
770
+ }
740
771
  return new Promise((resolve) => {
741
772
  const item = {
742
773
  promptText: String(promptText || ''),
743
774
  prevPrompt: null,
744
775
  _activated: false,
776
+ cleanup: null,
745
777
  resolve
746
778
  };
779
+ if (options && options.signal && typeof options.signal.addEventListener === 'function') {
780
+ const onAbort = () => {
781
+ const idx = this._readLineQueue.indexOf(item);
782
+ if (idx !== -1) {
783
+ this._readLineQueue.splice(idx, 1);
784
+ if (item._activated) {
785
+ this.promptOverride = item.prevPrompt;
786
+ this._activateNextReadLine();
787
+ }
788
+ this.updateActiveLine();
789
+ resolve(null);
790
+ }
791
+ };
792
+ options.signal.addEventListener('abort', onAbort, { once: true });
793
+ item.cleanup = () => {
794
+ try { options.signal.removeEventListener('abort', onAbort); } catch (err) { _terminalLogger.debug('readLine abort listener cleanup failed.', err); }
795
+ };
796
+ }
747
797
  this._readLineQueue.push(item);
748
798
  this._activateNextReadLine();
749
799
  this.updateActiveLine();
@@ -787,6 +837,7 @@ var CodeLabLogger = (() => {
787
837
  }
788
838
 
789
839
  destroy() {
840
+ this._drainReadLineQueue(null);
790
841
  this._cleanupListeners();
791
842
  this._mounted = false;
792
843
  }
@@ -869,12 +920,13 @@ var CodeLabLogger = (() => {
869
920
 
870
921
  if (isCtrl && (key === 'c' || key === 'C')) {
871
922
  if (e.preventDefault) e.preventDefault();
872
- const wasBusy = this.isBusy;
923
+ const wasBusy = this.isBusy || (this._readLineQueue && this._readLineQueue.length > 0);
873
924
  this.isBusy = false;
874
925
  this._pushLog({ type: 'system', text: wasBusy ? '^C' : `${this.getPrompt()}${this.buffer}^C` });
875
926
  this.buffer = '';
876
927
  this.cursor = 0;
877
928
  this.historyIdx = -1;
929
+ this._drainReadLineQueue(null);
878
930
  if (this.replMode) {
879
931
  this.replMode = false;
880
932
  }
@@ -1136,6 +1188,9 @@ var CodeLabLogger = (() => {
1136
1188
  this.searchMatchIdx = -1;
1137
1189
 
1138
1190
  const entry = this._readLineQueue.shift();
1191
+ if (entry && typeof entry.cleanup === 'function') {
1192
+ entry.cleanup();
1193
+ }
1139
1194
  if (typeof entry === 'function') {
1140
1195
  this.updateActiveLine();
1141
1196
  entry(line);
@@ -1172,6 +1227,10 @@ var CodeLabLogger = (() => {
1172
1227
  if (line.trim()) {
1173
1228
  if (this.history[this.history.length - 1] !== line.trim()) {
1174
1229
  this.history.push(line.trim());
1230
+ const maxHist = typeof this.maxHistory === 'number' && this.maxHistory > 0 ? this.maxHistory : 1000;
1231
+ if (this.history.length > maxHist) {
1232
+ this.history.splice(0, this.history.length - maxHist);
1233
+ }
1175
1234
  }
1176
1235
  }
1177
1236
 
@@ -22,5 +22,6 @@ export declare class CodeLabDiffEditorManager {
22
22
  currentTarget: 'starter' | 'solution';
23
23
  constructor(workbench: any);
24
24
  openInlineDiff(file: string, target?: 'starter' | 'solution'): boolean;
25
+ syncFileToWorkbench(file: string, nextVal: string): void;
25
26
  closeInlineDiff(): void;
26
27
  }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@innovatorved/code-lab",
3
- "version": "0.3.2",
4
- "description": "Standalone browser-native IDE Workbench, POSIX Shell & Coreutils, PTY Terminal, Web Worker Node.js/Bun Virtual Runtime, Real WebAssembly C++20 (Clang/WASI) Extension, and Python 3.12 (Pyodide WebAssembly) Extension.",
3
+ "version": "0.4.0",
4
+ "description": "Modular browser-native IDE Workbench, Lightweight SQL Playground & Inline Editor (@innovatorved/code-lab/sql), POSIX Shell & Coreutils, PTY Terminal, Web Worker Node.js/Bun Virtual Runtime, C++20 WASI, and Python 3.12 Extension.",
5
+ "workspaces": [
6
+ "packages/*",
7
+ "apps/*"
8
+ ],
5
9
  "main": "./dist/code-lab.js",
6
10
  "module": "./dist/code-lab.esm.js",
11
+ "umd": "./dist/code-lab.umd.js",
7
12
  "types": "./dist/code-lab.d.ts",
8
13
  "style": "./dist/code-lab.css",
9
14
  "exports": {
@@ -13,6 +18,16 @@
13
18
  "require": "./dist/code-lab.js",
14
19
  "default": "./dist/code-lab.js"
15
20
  },
21
+ "./umd": "./dist/code-lab.umd.js",
22
+ "./sql": {
23
+ "types": "./dist/code-lab-sql.d.ts",
24
+ "import": "./dist/code-lab-sql.esm.js",
25
+ "require": "./dist/code-lab-sql.umd.js",
26
+ "default": "./dist/code-lab-sql.umd.js"
27
+ },
28
+ "./sql.css": "./dist/code-lab-sql.css",
29
+ "./code-lab-sql.css": "./dist/code-lab-sql.css",
30
+ "./dist/code-lab-sql.css": "./dist/code-lab-sql.css",
16
31
  "./runtime": {
17
32
  "types": "./dist/runtime.d.ts",
18
33
  "import": "./dist/runtime.esm.js",
@@ -80,6 +95,7 @@
80
95
  "files": [
81
96
  "dist",
82
97
  "src",
98
+ "packages",
83
99
  "README.md",
84
100
  "ARCHITECTURE.md",
85
101
  "CHANGELOG.md",
@@ -97,6 +113,8 @@
97
113
  "scripts": {
98
114
  "build": "bun run tools/bundle.js",
99
115
  "lint": "node tools/lint.js",
116
+ "check:boundaries": "node tools/check-boundaries.js",
117
+ "check:size": "node tools/check-bundle-size.js",
100
118
  "typecheck": "bun x tsc --noEmit",
101
119
  "typecheck:strict": "bun x tsc -p tsconfig.strict.json",
102
120
  "test": "bun run tools/bundle.js && bun run tests/run-all.js",
@@ -106,16 +124,23 @@
106
124
  "test:browser": "bunx playwright test --project=chromium",
107
125
  "test:browser:all": "bunx playwright test",
108
126
  "test:browser:install": "bunx playwright install --with-deps chromium firefox webkit",
109
- "pack:check": "bun pm pack --dry-run"
127
+ "pack:check": "bun pm pack --dry-run",
128
+ "prepublishOnly": "bun run build && node tests/test-esm-exports.js && node tests/test-version-sync.js"
129
+ },
130
+ "lint-staged": {
131
+ "*.{ts,js}": [
132
+ "node tools/lint.js",
133
+ "node tools/check-boundaries.js"
134
+ ]
110
135
  },
111
136
  "dependencies": {
112
- "zod": "^3.23.8"
137
+ "zod": "^4.6.7"
113
138
  },
114
139
  "devDependencies": {
115
- "@playwright/test": "^1.64.1",
116
- "@types/node": "^22.7.5",
117
- "esbuild": "^0.24.0",
118
- "typescript": "^5.6.3"
140
+ "@playwright/test": "^1.65.0",
141
+ "@types/node": "26.6.6",
142
+ "esbuild": "^0.28.2",
143
+ "typescript": "6.0.3"
119
144
  },
120
145
  "publishConfig": {
121
146
  "access": "public",
@@ -123,6 +148,10 @@
123
148
  },
124
149
  "keywords": [
125
150
  "ide",
151
+ "sql-editor",
152
+ "sql-playground",
153
+ "postgres",
154
+ "sqlite",
126
155
  "code-playground",
127
156
  "monaco-editor",
128
157
  "virtual-runtime",
@@ -0,0 +1,7 @@
1
+ # `@code-lab/commands`
2
+
3
+ Layer 1 (`platform`) command execution, `when`-clause context evaluation, and customizable keybinding dispatch:
4
+
5
+ - `ContextKeyService` — evaluates VS Code-style `when` expressions (`editorFocus && !editorReadonly && resourceLangId == 'sql'`).
6
+ - `CommandRegistry` — registers typed commands (`registerCommand` -> `IDisposable`) and dispatches `executeCommand`.
7
+ - `KeybindingService` — normalizes cross-platform `Mod`/`Cmd`/`Ctrl` chords, supports `.codelab/keybindings.json` overrides and `-command` unbinding rules.
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@code-lab/commands",
3
+ "version": "0.4.0",
4
+ "description": "CommandRegistry, VS Code-style ContextKeyService (when-clause evaluator), and KeybindingService for CodeLab.",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts",
8
+ "exports": {
9
+ ".": "./src/index.ts"
10
+ },
11
+ "dependencies": {
12
+ "@code-lab/core": "workspace:*"
13
+ },
14
+ "sideEffects": false,
15
+ "license": "MIT"
16
+ }