regen.mde 0.2.2 → 0.8.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 (56) hide show
  1. package/LICENSE +16 -16
  2. package/README.md +409 -295
  3. package/bin/build-corpus-editor.js +83 -81
  4. package/bin/build-corpus.js +41 -41
  5. package/bin/postinstall.js +259 -187
  6. package/bin/regen-mdeditor-install.js +27 -27
  7. package/bin/regen-mdeditor-uninstall.js +19 -19
  8. package/bin/validate-katex.js +93 -93
  9. package/desktop/BuildCorpusEditor/BuildCorpusBridge.cs +493 -270
  10. package/desktop/BuildCorpusEditor/BuildCorpusEditor.csproj +22 -22
  11. package/desktop/BuildCorpusEditor/EditorForm.cs +853 -540
  12. package/desktop/BuildCorpusEditor/Program.cs +85 -81
  13. package/desktop/BuildCorpusEditor/app.manifest +16 -16
  14. package/dist/release/regen-mde-0.8.0-win-x64.zip +0 -0
  15. package/dist/windows-editor/BuildCorpusEditor.dll +0 -0
  16. package/dist/windows-editor/BuildCorpusEditor.exe +0 -0
  17. package/dist/windows-editor/BuildCorpusEditor.pdb +0 -0
  18. package/dist/windows-editor/BuildCorpusEditor.runtimeconfig.json +1 -1
  19. package/dist/windows-editor/wwwroot/assets/index-C_VxJk4k.js +375 -0
  20. package/dist/windows-editor/wwwroot/assets/index-Wt9zSjIw.css +1 -0
  21. package/dist/windows-editor/wwwroot/index.html +22 -22
  22. package/editor-web/index.html +21 -21
  23. package/editor-web/src/main.jsx +1044 -399
  24. package/editor-web/src/styles.css +846 -602
  25. package/editor-web/vite.config.js +13 -13
  26. package/examples/build-corpus.config.example.json +21 -21
  27. package/installer/install-regen-mde.ps1 +214 -175
  28. package/installer/regen-mde.nsi +81 -81
  29. package/package.json +10 -6
  30. package/pyproject.toml +4 -3
  31. package/requirements.txt +5 -4
  32. package/scripts/build-windows-editor.ps1 +47 -47
  33. package/scripts/package-windows-editor.ps1 +90 -90
  34. package/scripts/release-dual.mjs +105 -0
  35. package/scripts/run-corpus.ps1 +28 -28
  36. package/scripts/run-editor-implementation-plane.ps1 +226 -203
  37. package/scripts/run-required-tests.ps1 +98 -98
  38. package/scripts/run-smoke.ps1 +28 -28
  39. package/src/build_corpus/__init__.py +1 -1
  40. package/src/build_corpus/docx_exporter.py +1055 -798
  41. package/src/build_corpus/equations.py +1345 -0
  42. package/src/build_corpus/exporter.py +1488 -1195
  43. package/src/build_corpus/frontmatter.py +302 -0
  44. package/src/build_corpus/ppt_exporter.py +543 -532
  45. package/src/build_corpus/templates/__init__.py +1 -1
  46. package/src/build_corpus/validate_assets.py +46 -46
  47. package/tools/audit_corpus.py +203 -203
  48. package/tools/collect_microsoft_word_templates.py +228 -228
  49. package/tools/collect_online_docx_corpus.py +272 -272
  50. package/tools/collect_online_pptx_corpus.py +252 -252
  51. package/tools/compare_pptx_inputs_outputs.py +87 -87
  52. package/tools/roundtrip_docx_corpus.py +171 -171
  53. package/dist/release/regen.mde-0.2.2-win-x64-setup.exe +0 -0
  54. package/dist/release/regen.mde-0.2.2-win-x64.zip +0 -0
  55. package/dist/windows-editor/wwwroot/assets/index-DjJ6xmhy.js +0 -326
  56. package/dist/windows-editor/wwwroot/assets/index-_dwMNNsm.css +0 -1
@@ -1,187 +1,259 @@
1
- #!/usr/bin/env node
2
- const { spawnSync } = require("node:child_process");
3
- const path = require("node:path");
4
-
5
- const UNINSTALL_MODE = process.argv.includes("--uninstall");
6
- const SKIP_PIP_INSTALL = process.env.BUILD_CORPUS_SKIP_PIP_INSTALL === "1";
7
-
8
- const packageRoot = path.resolve(__dirname, "..");
9
- const candidates = process.platform === "win32" ? ["py", "python"] : ["python3", "python"];
10
- const requirements = path.join(packageRoot, "requirements.txt");
11
-
12
- function isGlobalInstall() {
13
- return process.env.npm_config_global === "true";
14
- }
15
-
16
- function printUsage() {
17
- const isGlobal = isGlobalInstall();
18
- if (isGlobal) {
19
- console.log("Build Corpus installed globally. Run: build-corpus --help");
20
- return;
21
- }
22
-
23
- console.log("Build Corpus installed locally.");
24
- console.log("Run with: npx build-corpus --help");
25
- }
26
-
27
- function warnOnShadowedWindowsCommand() {
28
- if (process.platform !== "win32") return;
29
-
30
- const whereResult = spawnSync("where.exe", ["build-corpus"], { encoding: "utf8" });
31
- if (whereResult.error || whereResult.status !== 0) return;
32
-
33
- const matches = whereResult.stdout
34
- .split(/\r?\n/)
35
- .map((line) => line.trim())
36
- .filter(Boolean);
37
- if (matches.length === 0) return;
38
-
39
- const firstMatch = matches[0].toLowerCase();
40
- if (!firstMatch.includes("python") || !firstMatch.endsWith("build-corpus.exe")) return;
41
-
42
- console.warn("");
43
- console.warn("WARNING: 'build-corpus' currently resolves to a Python executable:");
44
- console.warn(` ${matches[0]}`);
45
- console.warn("That usually means a stale pip install is shadowing the npm command.");
46
- console.warn("Fix it with: py -3 -m pip uninstall build-corpus");
47
- console.warn("Then rerun your npm install or use: npx build-corpus --help");
48
- }
49
-
50
- function installWindowsContextMenu() {
51
- if (process.platform !== "win32") return;
52
- if (!isGlobalInstall()) return;
53
- if (process.env.BUILD_CORPUS_SKIP_WINDOWS_MENU === "1") return;
54
-
55
- const prefix = process.env.npm_config_prefix || path.join(process.env.APPDATA || "", "npm");
56
- const commandPath = path.join(prefix, "build-corpus.cmd");
57
- const editorPath = path.join(prefix, "build-corpus-editor.cmd");
58
- const nativeEditorPath = path.join(packageRoot, "dist", "windows-editor", "BuildCorpusEditor.exe");
59
- const editorCommandPath = fileExists(nativeEditorPath) ? nativeEditorPath : editorPath;
60
- const menus = [
61
- {
62
- keyName: "BuildCorpusToMarkdown",
63
- label: "Convert to Markdown",
64
- commandValue: `"${commandPath}" "%1" --out-same-dir`,
65
- extension: ".docx",
66
- },
67
- ...(process.env.BUILD_CORPUS_SKIP_EDITOR === "1" ? [] : [
68
- {
69
- keyName: "BuildCorpusOpenEditor",
70
- label: "Open in regen.mde",
71
- commandValue: `"${editorCommandPath}" "%1"`,
72
- extension: ".docx",
73
- },
74
- {
75
- keyName: "BuildCorpusOpenEditor",
76
- label: "Open in regen.mde",
77
- commandValue: `"${editorCommandPath}" "%1"`,
78
- extension: ".md",
79
- },
80
- ]),
81
- {
82
- keyName: "BuildCorpusToWord",
83
- label: "Convert to Word",
84
- commandValue: `"${commandPath}" "%1" --to word --out-same-dir`,
85
- extension: ".md",
86
- },
87
- ];
88
-
89
- for (const menu of menus) {
90
- const commands = [
91
- ["delete", `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\Life AI`, "/f"],
92
- ["delete", `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\LifeAI.${menu.keyName}`, "/f"],
93
- ["delete", `HKCU\\Software\\LifeAI\\ShellCommands\\${menu.keyName}`, "/f"],
94
- ["add", `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\${menu.keyName}`, "/v", "MUIVerb", "/d", menu.label, "/f"],
95
- ["add", `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\${menu.keyName}`, "/v", "Icon", "/t", "REG_EXPAND_SZ", "/d", menu.keyName === "BuildCorpusOpenEditor" ? editorCommandPath : commandPath, "/f"],
96
- ["add", `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\${menu.keyName}\\command`, "/ve", "/d", menu.commandValue, "/f"],
97
- ];
98
-
99
- for (const args of commands) {
100
- const result = spawnSync("reg.exe", args, { stdio: "inherit" });
101
- const status = result.status ?? 1;
102
- if (args[0] === "delete" && status === 1 && !result.error) {
103
- continue;
104
- }
105
- if (result.error || status !== 0) {
106
- console.warn(`Build Corpus could not add the Windows ${menu.extension} context menu.`);
107
- return;
108
- }
109
- }
110
- }
111
-
112
- console.log("Windows Explorer menus added for .docx and .md");
113
- }
114
-
115
- function fileExists(candidate) {
116
- try {
117
- return require("node:fs").existsSync(candidate);
118
- } catch {
119
- return false;
120
- }
121
- }
122
-
123
- function uninstallWindowsContextMenu() {
124
- if (process.platform !== "win32") return 0;
125
-
126
- const menus = [
127
- { extension: ".docx", keyName: "BuildCorpusToMarkdown" },
128
- { extension: ".docx", keyName: "BuildCorpusOpenEditor" },
129
- { extension: ".md", keyName: "BuildCorpusOpenEditor" },
130
- { extension: ".md", keyName: "BuildCorpusToWord" },
131
- ];
132
-
133
- let exitCode = 0;
134
- for (const menu of menus) {
135
- const removals = [
136
- `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\BuildCorpus`,
137
- `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\${menu.keyName}`,
138
- `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell\\Life AI`,
139
- `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\LifeAI.${menu.keyName}`,
140
- `HKCU\\Software\\LifeAI\\ShellCommands\\${menu.keyName}`,
141
- ];
142
-
143
- for (const key of removals) {
144
- const result = spawnSync("reg.exe", ["delete", key, "/f"], { stdio: "inherit" });
145
- const status = result.status ?? 1;
146
- if (result.error || (status !== 0 && status !== 1)) {
147
- console.warn(`Build Corpus could not remove the Windows ${menu.extension} context menu.`);
148
- exitCode = 1;
149
- }
150
- }
151
- }
152
-
153
- console.log("Windows Explorer menus removed for .docx and .md");
154
- return exitCode;
155
- }
156
-
157
- if (UNINSTALL_MODE) {
158
- process.exit(uninstallWindowsContextMenu());
159
- }
160
-
161
- if (SKIP_PIP_INSTALL) {
162
- printUsage();
163
- installWindowsContextMenu();
164
- warnOnShadowedWindowsCommand();
165
- process.exit(0);
166
- }
167
-
168
- for (const candidate of candidates) {
169
- const args = candidate === "py"
170
- ? ["-3", "-m", "pip", "install", "-r", requirements]
171
- : ["-m", "pip", "install", "-r", requirements];
172
- const result = spawnSync(candidate, args, { stdio: "inherit" });
173
- if (result.error && result.error.code === "ENOENT") continue;
174
- if ((result.status ?? 1) !== 0) {
175
- process.exit(result.status ?? 1);
176
- }
177
-
178
- printUsage();
179
- installWindowsContextMenu();
180
- warnOnShadowedWindowsCommand();
181
- process.exit(0);
182
- }
183
-
184
- console.warn("Build Corpus could not find Python to install Python dependencies.");
185
- printUsage();
186
- installWindowsContextMenu();
187
- process.exit(0);
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+ const path = require("node:path");
4
+
5
+ const UNINSTALL_MODE = process.argv.includes("--uninstall");
6
+ const SKIP_PIP_INSTALL = process.env.BUILD_CORPUS_SKIP_PIP_INSTALL === "1";
7
+
8
+ const packageRoot = path.resolve(__dirname, "..");
9
+ const candidates = process.platform === "win32" ? ["py", "python"] : ["python3", "python"];
10
+ const requirements = path.join(packageRoot, "requirements.txt");
11
+
12
+ function isGlobalInstall() {
13
+ return process.env.npm_config_global === "true";
14
+ }
15
+
16
+ function printUsage() {
17
+ const isGlobal = isGlobalInstall();
18
+ if (isGlobal) {
19
+ console.log("Build Corpus installed globally. Run: build-corpus --help");
20
+ return;
21
+ }
22
+
23
+ console.log("Build Corpus installed locally.");
24
+ console.log("Run with: npx build-corpus --help");
25
+ }
26
+
27
+ function warnOnShadowedWindowsCommand() {
28
+ if (process.platform !== "win32") return;
29
+
30
+ const whereResult = spawnSync("where.exe", ["build-corpus"], { encoding: "utf8" });
31
+ if (whereResult.error || whereResult.status !== 0) return;
32
+
33
+ const matches = whereResult.stdout
34
+ .split(/\r?\n/)
35
+ .map((line) => line.trim())
36
+ .filter(Boolean);
37
+ if (matches.length === 0) return;
38
+
39
+ const firstMatch = matches[0].toLowerCase();
40
+ if (!firstMatch.includes("python") || !firstMatch.endsWith("build-corpus.exe")) return;
41
+
42
+ console.warn("");
43
+ console.warn("WARNING: 'build-corpus' currently resolves to a Python executable:");
44
+ console.warn(` ${matches[0]}`);
45
+ console.warn("That usually means a stale pip install is shadowing the npm command.");
46
+ console.warn("Fix it with: py -3 -m pip uninstall build-corpus");
47
+ console.warn("Then rerun your npm install or use: npx build-corpus --help");
48
+ }
49
+
50
+ function installWindowsContextMenu() {
51
+ if (process.platform !== "win32") return;
52
+ if (!isGlobalInstall()) return;
53
+ if (process.env.BUILD_CORPUS_SKIP_WINDOWS_MENU === "1") return;
54
+
55
+ const prefix = process.env.npm_config_prefix || path.join(process.env.APPDATA || "", "npm");
56
+ const commandPath = path.join(prefix, "build-corpus.cmd");
57
+ const editorPath = path.join(prefix, "build-corpus-editor.cmd");
58
+ const nativeEditorPath = path.join(packageRoot, "dist", "windows-editor", "BuildCorpusEditor.exe");
59
+ const editorCommandPath = fileExists(nativeEditorPath) ? nativeEditorPath : editorPath;
60
+ const markdownInputMenus = [".docx", ".pptx", ".ppt"].map((extension) => ({
61
+ keyName: "BuildCorpusToMarkdown",
62
+ label: "Convert to Markdown",
63
+ commandValue: `"${commandPath}" "%1" --out-same-dir`,
64
+ extension,
65
+ }));
66
+ const menus = [
67
+ ...markdownInputMenus,
68
+ {
69
+ keyName: "BuildCorpusFolderToMarkdown",
70
+ label: "Convert Documents to Markdown",
71
+ commandValue: `"${commandPath}" "%V" --out-same-dir`,
72
+ extension: "Directory",
73
+ },
74
+ ...(process.env.BUILD_CORPUS_SKIP_EDITOR === "1" ? [] : [
75
+ {
76
+ keyName: "BuildCorpusOpenEditor",
77
+ label: "Open in regen-mde",
78
+ commandValue: `"${editorCommandPath}" "%1"`,
79
+ extension: ".docx",
80
+ },
81
+ {
82
+ keyName: "BuildCorpusOpenEditor",
83
+ label: "Open in regen-mde",
84
+ commandValue: `"${editorCommandPath}" "%1"`,
85
+ extension: ".md",
86
+ },
87
+ ]),
88
+ {
89
+ keyName: "BuildCorpusToWord",
90
+ label: "Convert to Word",
91
+ commandValue: `"${commandPath}" "%1" --to word --out-same-dir`,
92
+ extension: ".md",
93
+ },
94
+ {
95
+ keyName: "BuildCorpusInlineImages",
96
+ label: "Inline Markdown Images",
97
+ commandValue: `"${commandPath}" "%1" --inline-images`,
98
+ extension: ".md",
99
+ },
100
+ ];
101
+
102
+ for (const menu of menus) {
103
+ const shellBase = menu.extension === "Directory"
104
+ ? "HKCU\\Software\\Classes\\Directory\\shell"
105
+ : `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell`;
106
+ const commands = [
107
+ ["delete", `${shellBase}\\Life AI`, "/f"],
108
+ ["delete", `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\LifeAI.${menu.keyName}`, "/f"],
109
+ ["delete", `HKCU\\Software\\LifeAI\\ShellCommands\\${menu.keyName}`, "/f"],
110
+ ["add", `${shellBase}\\${menu.keyName}`, "/v", "MUIVerb", "/d", menu.label, "/f"],
111
+ ["add", `${shellBase}\\${menu.keyName}`, "/v", "Icon", "/t", "REG_EXPAND_SZ", "/d", menu.keyName === "BuildCorpusOpenEditor" ? editorCommandPath : commandPath, "/f"],
112
+ ["add", `${shellBase}\\${menu.keyName}\\command`, "/ve", "/d", menu.commandValue, "/f"],
113
+ ];
114
+
115
+ for (const args of commands) {
116
+ const result = spawnSync("reg.exe", args, { stdio: "inherit" });
117
+ const status = result.status ?? 1;
118
+ if (args[0] === "delete" && status === 1 && !result.error) {
119
+ continue;
120
+ }
121
+ if (result.error || status !== 0) {
122
+ console.warn(`Build Corpus could not add the Windows ${menu.extension} context menu.`);
123
+ return;
124
+ }
125
+ }
126
+ }
127
+ spawnSync("reg.exe", ["add", "HKCU\\Software\\Classes\\.md", "/v", "Content Type", "/d", "text/markdown", "/f"], { stdio: "inherit" });
128
+ spawnSync("reg.exe", ["add", "HKCU\\Software\\Classes\\.md\\ShellNew", "/v", "NullFile", "/t", "REG_SZ", "/d", "", "/f"], { stdio: "inherit" });
129
+
130
+ console.log("Windows Explorer menus added for .docx, .pptx, .ppt, .md, folders, and New Markdown Document");
131
+ }
132
+
133
+ function fileExists(candidate) {
134
+ try {
135
+ return require("node:fs").existsSync(candidate);
136
+ } catch {
137
+ return false;
138
+ }
139
+ }
140
+
141
+ function uninstallWindowsContextMenu() {
142
+ if (process.platform !== "win32") return 0;
143
+
144
+ const menus = [
145
+ { extension: ".docx", keyName: "BuildCorpusToMarkdown" },
146
+ { extension: ".pptx", keyName: "BuildCorpusToMarkdown" },
147
+ { extension: ".ppt", keyName: "BuildCorpusToMarkdown" },
148
+ { extension: ".docx", keyName: "BuildCorpusOpenEditor" },
149
+ { extension: ".md", keyName: "BuildCorpusOpenEditor" },
150
+ { extension: ".md", keyName: "BuildCorpusToWord" },
151
+ { extension: ".md", keyName: "BuildCorpusInlineImages" },
152
+ { extension: "Directory", keyName: "BuildCorpusFolderToMarkdown" },
153
+ ];
154
+
155
+ let exitCode = 0;
156
+ for (const menu of menus) {
157
+ const shellBase = menu.extension === "Directory"
158
+ ? `HKCU\\Software\\Classes\\Directory\\shell`
159
+ : `HKCU\\Software\\Classes\\SystemFileAssociations\\${menu.extension}\\shell`;
160
+ const removals = [
161
+ `${shellBase}\\BuildCorpus`,
162
+ `${shellBase}\\${menu.keyName}`,
163
+ `${shellBase}\\Life AI`,
164
+ `HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\LifeAI.${menu.keyName}`,
165
+ `HKCU\\Software\\LifeAI\\ShellCommands\\${menu.keyName}`,
166
+ ];
167
+
168
+ for (const key of removals) {
169
+ const result = spawnSync("reg.exe", ["delete", key, "/f"], { stdio: "inherit" });
170
+ const status = result.status ?? 1;
171
+ if (result.error || (status !== 0 && status !== 1)) {
172
+ console.warn(`Build Corpus could not remove the Windows ${menu.extension} context menu.`);
173
+ exitCode = 1;
174
+ }
175
+ }
176
+ }
177
+ spawnSync("reg.exe", ["delete", "HKCU\\Software\\Classes\\.md\\ShellNew", "/f"], { stdio: "inherit" });
178
+
179
+ console.log("Windows Explorer menus removed for .docx, .pptx, .ppt, .md, and folders");
180
+ return exitCode;
181
+ }
182
+
183
+ if (UNINSTALL_MODE) {
184
+ process.exit(uninstallWindowsContextMenu());
185
+ }
186
+
187
+ if (SKIP_PIP_INSTALL) {
188
+ printUsage();
189
+ installWindowsContextMenu();
190
+ warnOnShadowedWindowsCommand();
191
+ process.exit(0);
192
+ }
193
+
194
+ function pipInstallArgs(candidate, extraFlags) {
195
+ const base = candidate === "py"
196
+ ? ["-3", "-m", "pip", "install", "-r", requirements]
197
+ : ["-m", "pip", "install", "-r", requirements];
198
+ return [...base, ...extraFlags];
199
+ }
200
+
201
+ // Install the Python dependencies for one interpreter candidate.
202
+ // On Windows we make a single attempt (PEP 668 does not apply). On Linux/macOS
203
+ // modern distros mark the system Python "externally managed" (PEP 668), so a
204
+ // bare `pip install` aborts; fall back to user-site, then --break-system-packages.
205
+ // Returns { found } so the caller can try the next interpreter on ENOENT, and
206
+ // { status } for the best attempt.
207
+ function installPythonDeps(candidate) {
208
+ const attempts = process.platform === "win32"
209
+ ? [[]]
210
+ : [[], ["--user"], ["--break-system-packages"]];
211
+
212
+ let lastStatus = 1;
213
+ for (const extraFlags of attempts) {
214
+ const result = spawnSync(candidate, pipInstallArgs(candidate, extraFlags), { stdio: "inherit" });
215
+ if (result.error && result.error.code === "ENOENT") return { found: false, status: 1 };
216
+ lastStatus = result.status ?? 1;
217
+ if (lastStatus === 0) return { found: true, status: 0 };
218
+ }
219
+ return { found: true, status: lastStatus };
220
+ }
221
+
222
+ function warnLinuxDependencyFallback() {
223
+ console.warn("");
224
+ console.warn("Build Corpus could not install its Python dependencies automatically.");
225
+ console.warn("On Debian/Ubuntu the system Python is externally managed (PEP 668).");
226
+ console.warn("Recommended: install the Python-native package in an isolated environment:");
227
+ console.warn(" pipx install build-corpus");
228
+ console.warn("Or install the dependencies into your user site manually:");
229
+ console.warn(" python3 -m pip install --user -r requirements.txt");
230
+ }
231
+
232
+ for (const candidate of candidates) {
233
+ const { found, status } = installPythonDeps(candidate);
234
+ if (!found) continue;
235
+
236
+ if (status !== 0) {
237
+ // Windows treats a pip failure as fatal; on Linux/macOS we never fail the
238
+ // npm install over PEP 668 — the CLI still works once deps are present.
239
+ if (process.platform === "win32") {
240
+ process.exit(status);
241
+ }
242
+ warnLinuxDependencyFallback();
243
+ printUsage();
244
+ process.exit(0);
245
+ }
246
+
247
+ printUsage();
248
+ installWindowsContextMenu();
249
+ warnOnShadowedWindowsCommand();
250
+ process.exit(0);
251
+ }
252
+
253
+ console.warn("Build Corpus could not find Python to install Python dependencies.");
254
+ if (process.platform !== "win32") {
255
+ console.warn("Install Python 3.10+ (e.g. `sudo apt install python3 python3-pip`), then re-run the install.");
256
+ }
257
+ printUsage();
258
+ installWindowsContextMenu();
259
+ process.exit(0);
@@ -1,27 +1,27 @@
1
- #!/usr/bin/env node
2
- const { spawnSync } = require("node:child_process");
3
- const path = require("node:path");
4
-
5
- if (process.platform !== "win32") {
6
- console.error("regen.mde installer is only available on Windows.");
7
- process.exit(1);
8
- }
9
-
10
- const root = path.resolve(__dirname, "..");
11
- const script = path.join(root, "installer", "install-regen-mde.ps1");
12
- const result = spawnSync("powershell.exe", [
13
- "-NoProfile",
14
- "-ExecutionPolicy",
15
- "Bypass",
16
- "-File",
17
- script,
18
- "-PackageRoot",
19
- root,
20
- ...process.argv.slice(2),
21
- ], {
22
- stdio: "inherit",
23
- cwd: root,
24
- windowsHide: true,
25
- });
26
-
27
- process.exit(result.status ?? 1);
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+ const path = require("node:path");
4
+
5
+ if (process.platform !== "win32") {
6
+ console.error("regen-mde installer is only available on Windows.");
7
+ process.exit(1);
8
+ }
9
+
10
+ const root = path.resolve(__dirname, "..");
11
+ const script = path.join(root, "installer", "install-regen-mde.ps1");
12
+ const result = spawnSync("powershell.exe", [
13
+ "-NoProfile",
14
+ "-ExecutionPolicy",
15
+ "Bypass",
16
+ "-File",
17
+ script,
18
+ "-PackageRoot",
19
+ root,
20
+ ...process.argv.slice(2),
21
+ ], {
22
+ stdio: "inherit",
23
+ cwd: root,
24
+ windowsHide: true,
25
+ });
26
+
27
+ process.exit(result.status ?? 1);
@@ -1,19 +1,19 @@
1
- #!/usr/bin/env node
2
- const { spawnSync } = require("node:child_process");
3
- const path = require("node:path");
4
-
5
- if (process.platform !== "win32") {
6
- console.error("regen.mde uninstaller is only available on Windows.");
7
- process.exit(1);
8
- }
9
-
10
- const root = path.resolve(__dirname, "..");
11
- const result = spawnSync(process.execPath, [
12
- path.join(root, "bin", "postinstall.js"),
13
- "--uninstall",
14
- ], {
15
- stdio: "inherit",
16
- cwd: root,
17
- });
18
-
19
- process.exit(result.status ?? 1);
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+ const path = require("node:path");
4
+
5
+ if (process.platform !== "win32") {
6
+ console.error("regen-mde uninstaller is only available on Windows.");
7
+ process.exit(1);
8
+ }
9
+
10
+ const root = path.resolve(__dirname, "..");
11
+ const result = spawnSync(process.execPath, [
12
+ path.join(root, "bin", "postinstall.js"),
13
+ "--uninstall",
14
+ ], {
15
+ stdio: "inherit",
16
+ cwd: root,
17
+ });
18
+
19
+ process.exit(result.status ?? 1);