Archived
- WorkspaceFiles: writeFile, deleteFile, moveFile with path safety - writeFile: text/binary, auto-create dirs, overwrite option - deleteFile: idempotent, uses lstat (removes symlinks not targets) - moveFile: unix mv semantics, overwrite defaults to false - All mutations auto-refreshFiles() in File Explorer - Symlink escape prevention via realpath(dirname) check - PluginPromptEditor: insertText, getText, getSelection, onPaste, onKeyDown, focus - Uses CM6 EditorView.domEventHandlers() via Compartment (not raw DOM) - Handlers registered before mount are preserved and applied on mount - First-to-consume-wins ordering for multi-plugin scenarios - insertText replaces selection (not inserts after) - PluginAttachments: insertFileReference, getAttachedFiles, removeFileReference - insertFileReference validates file exists before inserting @path - Does not auto-focus editor (unlike prompt.insertText) - @file regex requires file extension to avoid matching emails - Server endpoints: PUT /file, DELETE /file, POST /file/move - All work for local and federated machines - Tests: 31 unit tests, 9 integration tests, 5 client tests - Docs: 3 new sections in plugins.md
36 lines
1010 B
JavaScript
36 lines
1010 B
JavaScript
import { chmodSync, readdirSync, statSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
|
|
/**
|
|
* node-pty 1.1.0 ships macOS prebuilds with `spawn-helper` files at 644
|
|
* instead of 755, causing `posix_spawnp failed` at runtime. This script
|
|
* fixes permissions after install on Darwin platforms.
|
|
*/
|
|
function fixNodePtyPermissions() {
|
|
if (process.platform === "win32") return;
|
|
const prebuildsDir = join("node_modules", "node-pty", "prebuilds");
|
|
let entries;
|
|
try {
|
|
entries = readdirSync(prebuildsDir, { withFileTypes: true });
|
|
} catch {
|
|
return;
|
|
}
|
|
for (const entry of entries) {
|
|
if (!entry.isDirectory()) continue;
|
|
const helper = join(prebuildsDir, entry.name, "spawn-helper");
|
|
let stats;
|
|
try {
|
|
stats = statSync(helper);
|
|
} catch {
|
|
continue;
|
|
}
|
|
if (!stats.isFile()) continue;
|
|
// 0o100 = regular file, 0o111 = owner/group/other execute
|
|
if ((stats.mode & 0o111) === 0) {
|
|
chmodSync(helper, 0o755);
|
|
}
|
|
}
|
|
}
|
|
|
|
fixNodePtyPermissions();
|