deepv-code 1.0.182
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/LICENSE +202 -0
- package/README.md +3 -0
- package/bundle/assets/help/README.md +113 -0
- package/bundle/assets/help/cli-help-knowledge.md +1382 -0
- package/bundle/assets/sounds/README.md +74 -0
- package/bundle/assets/sounds/confirmation-required.wav +0 -0
- package/bundle/assets/sounds/response-complete.wav +0 -0
- package/bundle/assets/sounds/selection-made.wav +0 -0
- package/bundle/dvcode.js +4442 -0
- package/bundle/fix-binary-permissions.js +215 -0
- package/bundle/login/templates/authSelectPage.html +870 -0
- package/bundle/login/templates/deepv.ico +0 -0
- package/bundle/login/templates/feishu.ico +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/darwin-arm64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/darwin-x64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-arm-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-arm64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/linux-x64-rg +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-arm64-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-ia32-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/bin/win32-x64-rg.exe +0 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/download.js +357 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/index.d.ts +1 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/index.js +42 -0
- package/bundle/node_modules/@vscode/ripgrep/lib/postinstall.js +121 -0
- package/bundle/node_modules/@vscode/ripgrep/package.json +24 -0
- package/bundle/node_modules/undici/LICENSE +21 -0
- package/bundle/node_modules/undici/README.md +472 -0
- package/bundle/node_modules/undici/docs/docs/api/Agent.md +83 -0
- package/bundle/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/bundle/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/bundle/node_modules/undici/docs/docs/api/CacheStore.md +151 -0
- package/bundle/node_modules/undici/docs/docs/api/Client.md +281 -0
- package/bundle/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/bundle/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/bundle/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/bundle/node_modules/undici/docs/docs/api/Cookies.md +101 -0
- package/bundle/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/bundle/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +204 -0
- package/bundle/node_modules/undici/docs/docs/api/Dispatcher.md +1200 -0
- package/bundle/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/bundle/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/bundle/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/bundle/node_modules/undici/docs/docs/api/Fetch.md +52 -0
- package/bundle/node_modules/undici/docs/docs/api/H2CClient.md +262 -0
- package/bundle/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/bundle/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/bundle/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/bundle/node_modules/undici/docs/docs/api/MockClient.md +77 -0
- package/bundle/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/bundle/node_modules/undici/docs/docs/api/MockPool.md +548 -0
- package/bundle/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/bundle/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/bundle/node_modules/undici/docs/docs/api/ProxyAgent.md +227 -0
- package/bundle/node_modules/undici/docs/docs/api/RedirectHandler.md +96 -0
- package/bundle/node_modules/undici/docs/docs/api/RetryAgent.md +45 -0
- package/bundle/node_modules/undici/docs/docs/api/RetryHandler.md +117 -0
- package/bundle/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/bundle/node_modules/undici/docs/docs/api/WebSocket.md +85 -0
- package/bundle/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/bundle/node_modules/undici/docs/docs/best-practices/writing-tests.md +20 -0
- package/bundle/node_modules/undici/index-fetch.js +35 -0
- package/bundle/node_modules/undici/index.d.ts +3 -0
- package/bundle/node_modules/undici/index.js +183 -0
- package/bundle/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/bundle/node_modules/undici/lib/api/api-connect.js +110 -0
- package/bundle/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/bundle/node_modules/undici/lib/api/api-request.js +199 -0
- package/bundle/node_modules/undici/lib/api/api-stream.js +209 -0
- package/bundle/node_modules/undici/lib/api/api-upgrade.js +110 -0
- package/bundle/node_modules/undici/lib/api/index.js +7 -0
- package/bundle/node_modules/undici/lib/api/readable.js +558 -0
- package/bundle/node_modules/undici/lib/api/util.js +95 -0
- package/bundle/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
- package/bundle/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
- package/bundle/node_modules/undici/lib/core/connect.js +164 -0
- package/bundle/node_modules/undici/lib/core/constants.js +143 -0
- package/bundle/node_modules/undici/lib/core/diagnostics.js +196 -0
- package/bundle/node_modules/undici/lib/core/errors.js +244 -0
- package/bundle/node_modules/undici/lib/core/request.js +397 -0
- package/bundle/node_modules/undici/lib/core/symbols.js +68 -0
- package/bundle/node_modules/undici/lib/core/tree.js +160 -0
- package/bundle/node_modules/undici/lib/core/util.js +988 -0
- package/bundle/node_modules/undici/lib/dispatcher/agent.js +135 -0
- package/bundle/node_modules/undici/lib/dispatcher/balanced-pool.js +206 -0
- package/bundle/node_modules/undici/lib/dispatcher/client-h1.js +1615 -0
- package/bundle/node_modules/undici/lib/dispatcher/client-h2.js +798 -0
- package/bundle/node_modules/undici/lib/dispatcher/client.js +614 -0
- package/bundle/node_modules/undici/lib/dispatcher/dispatcher-base.js +161 -0
- package/bundle/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/bundle/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +151 -0
- package/bundle/node_modules/undici/lib/dispatcher/fixed-queue.js +159 -0
- package/bundle/node_modules/undici/lib/dispatcher/h2c-client.js +122 -0
- package/bundle/node_modules/undici/lib/dispatcher/pool-base.js +191 -0
- package/bundle/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/bundle/node_modules/undici/lib/dispatcher/proxy-agent.js +275 -0
- package/bundle/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/bundle/node_modules/undici/lib/global.js +32 -0
- package/bundle/node_modules/undici/lib/handler/cache-handler.js +448 -0
- package/bundle/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/bundle/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/bundle/node_modules/undici/lib/handler/redirect-handler.js +227 -0
- package/bundle/node_modules/undici/lib/handler/retry-handler.js +342 -0
- package/bundle/node_modules/undici/lib/handler/unwrap-handler.js +96 -0
- package/bundle/node_modules/undici/lib/handler/wrap-handler.js +95 -0
- package/bundle/node_modules/undici/lib/interceptor/cache.js +372 -0
- package/bundle/node_modules/undici/lib/interceptor/dns.js +432 -0
- package/bundle/node_modules/undici/lib/interceptor/dump.js +111 -0
- package/bundle/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/bundle/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/bundle/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/bundle/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.d.ts +97 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.js +498 -0
- package/bundle/node_modules/undici/lib/llhttp/constants.js.map +1 -0
- package/bundle/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.js +15 -0
- package/bundle/node_modules/undici/lib/llhttp/utils.js.map +1 -0
- package/bundle/node_modules/undici/lib/mock/mock-agent.js +224 -0
- package/bundle/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/bundle/node_modules/undici/lib/mock/mock-client.js +64 -0
- package/bundle/node_modules/undici/lib/mock/mock-errors.js +19 -0
- package/bundle/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/bundle/node_modules/undici/lib/mock/mock-pool.js +64 -0
- package/bundle/node_modules/undici/lib/mock/mock-symbols.js +31 -0
- package/bundle/node_modules/undici/lib/mock/mock-utils.js +433 -0
- package/bundle/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/bundle/node_modules/undici/lib/util/cache.js +368 -0
- package/bundle/node_modules/undici/lib/util/date.js +259 -0
- package/bundle/node_modules/undici/lib/util/stats.js +32 -0
- package/bundle/node_modules/undici/lib/util/timers.js +423 -0
- package/bundle/node_modules/undici/lib/web/cache/cache.js +862 -0
- package/bundle/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/bundle/node_modules/undici/lib/web/cache/util.js +45 -0
- package/bundle/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/bundle/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/bundle/node_modules/undici/lib/web/cookies/parse.js +322 -0
- package/bundle/node_modules/undici/lib/web/cookies/util.js +282 -0
- package/bundle/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
- package/bundle/node_modules/undici/lib/web/eventsource/eventsource.js +484 -0
- package/bundle/node_modules/undici/lib/web/eventsource/util.js +37 -0
- package/bundle/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/bundle/node_modules/undici/lib/web/fetch/body.js +532 -0
- package/bundle/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/bundle/node_modules/undici/lib/web/fetch/data-url.js +744 -0
- package/bundle/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/bundle/node_modules/undici/lib/web/fetch/formdata-parser.js +501 -0
- package/bundle/node_modules/undici/lib/web/fetch/formdata.js +263 -0
- package/bundle/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/bundle/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/bundle/node_modules/undici/lib/web/fetch/index.js +2258 -0
- package/bundle/node_modules/undici/lib/web/fetch/request.js +1099 -0
- package/bundle/node_modules/undici/lib/web/fetch/response.js +636 -0
- package/bundle/node_modules/undici/lib/web/fetch/util.js +1782 -0
- package/bundle/node_modules/undici/lib/web/fetch/webidl.js +740 -0
- package/bundle/node_modules/undici/lib/web/websocket/connection.js +325 -0
- package/bundle/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/bundle/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/bundle/node_modules/undici/lib/web/websocket/frame.js +138 -0
- package/bundle/node_modules/undici/lib/web/websocket/permessage-deflate.js +70 -0
- package/bundle/node_modules/undici/lib/web/websocket/receiver.js +454 -0
- package/bundle/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/bundle/node_modules/undici/lib/web/websocket/stream/websocketerror.js +83 -0
- package/bundle/node_modules/undici/lib/web/websocket/stream/websocketstream.js +485 -0
- package/bundle/node_modules/undici/lib/web/websocket/util.js +338 -0
- package/bundle/node_modules/undici/lib/web/websocket/websocket.js +686 -0
- package/bundle/node_modules/undici/package.json +149 -0
- package/bundle/node_modules/undici/scripts/strip-comments.js +10 -0
- package/bundle/node_modules/undici/types/README.md +6 -0
- package/bundle/node_modules/undici/types/agent.d.ts +35 -0
- package/bundle/node_modules/undici/types/api.d.ts +43 -0
- package/bundle/node_modules/undici/types/balanced-pool.d.ts +29 -0
- package/bundle/node_modules/undici/types/cache-interceptor.d.ts +172 -0
- package/bundle/node_modules/undici/types/cache.d.ts +36 -0
- package/bundle/node_modules/undici/types/client-stats.d.ts +15 -0
- package/bundle/node_modules/undici/types/client.d.ts +110 -0
- package/bundle/node_modules/undici/types/connector.d.ts +34 -0
- package/bundle/node_modules/undici/types/content-type.d.ts +21 -0
- package/bundle/node_modules/undici/types/cookies.d.ts +30 -0
- package/bundle/node_modules/undici/types/diagnostics-channel.d.ts +66 -0
- package/bundle/node_modules/undici/types/dispatcher.d.ts +281 -0
- package/bundle/node_modules/undici/types/env-http-proxy-agent.d.ts +21 -0
- package/bundle/node_modules/undici/types/errors.d.ts +171 -0
- package/bundle/node_modules/undici/types/eventsource.d.ts +61 -0
- package/bundle/node_modules/undici/types/fetch.d.ts +210 -0
- package/bundle/node_modules/undici/types/formdata.d.ts +108 -0
- package/bundle/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/bundle/node_modules/undici/types/global-origin.d.ts +7 -0
- package/bundle/node_modules/undici/types/h2c-client.d.ts +75 -0
- package/bundle/node_modules/undici/types/handlers.d.ts +15 -0
- package/bundle/node_modules/undici/types/header.d.ts +160 -0
- package/bundle/node_modules/undici/types/index.d.ts +75 -0
- package/bundle/node_modules/undici/types/interceptors.d.ts +34 -0
- package/bundle/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/bundle/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/bundle/node_modules/undici/types/mock-client.d.ts +25 -0
- package/bundle/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/bundle/node_modules/undici/types/mock-interceptor.d.ts +93 -0
- package/bundle/node_modules/undici/types/mock-pool.d.ts +25 -0
- package/bundle/node_modules/undici/types/patch.d.ts +29 -0
- package/bundle/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/bundle/node_modules/undici/types/pool.d.ts +41 -0
- package/bundle/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/bundle/node_modules/undici/types/readable.d.ts +68 -0
- package/bundle/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/bundle/node_modules/undici/types/retry-handler.d.ts +116 -0
- package/bundle/node_modules/undici/types/util.d.ts +18 -0
- package/bundle/node_modules/undici/types/utility.d.ts +7 -0
- package/bundle/node_modules/undici/types/webidl.d.ts +266 -0
- package/bundle/node_modules/undici/types/websocket.d.ts +184 -0
- package/bundle/sandbox-macos-permissive-closed.sb +26 -0
- package/bundle/sandbox-macos-permissive-open.sb +19 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +31 -0
- package/bundle/sandbox-macos-restrictive-closed.sb +87 -0
- package/bundle/sandbox-macos-restrictive-open.sb +90 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +92 -0
- package/package.json +137 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2025 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 🔧 Cross-platform Binary Permissions Fix Script
|
|
11
|
+
*
|
|
12
|
+
* Problem:
|
|
13
|
+
* - When packaging on Windows, Unix binary files in zip archives lose execute permissions
|
|
14
|
+
* - This prevents ripgrep binaries and Sharp native modules from executing on macOS/Linux after extraction
|
|
15
|
+
*
|
|
16
|
+
* Solution:
|
|
17
|
+
* - Automatically detect and fix execute permissions for all binary files after installation
|
|
18
|
+
* - Supports ripgrep binary files
|
|
19
|
+
* - Can run as npm postinstall hook or manually
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import fs from 'fs';
|
|
23
|
+
import path from 'path';
|
|
24
|
+
import { fileURLToPath } from 'url';
|
|
25
|
+
|
|
26
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
|
|
28
|
+
function fixBinaryPermissions() {
|
|
29
|
+
// Only execute on Unix-like systems
|
|
30
|
+
if (process.platform === 'win32') {
|
|
31
|
+
console.log('🔧 Windows system - binary permissions fix not needed');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
console.log('🔧 Detecting and fixing binary file execute permissions...');
|
|
36
|
+
|
|
37
|
+
const fixes = [];
|
|
38
|
+
const bundleDir = path.resolve(__dirname, '..', 'bundle');
|
|
39
|
+
|
|
40
|
+
// Binary file path patterns that need permission fixes
|
|
41
|
+
const binaryPaths = [
|
|
42
|
+
// Ripgrep binary files
|
|
43
|
+
'node_modules/@vscode/ripgrep/bin/rg',
|
|
44
|
+
'node_modules/@vscode/ripgrep/bin/darwin-x64-rg',
|
|
45
|
+
'node_modules/@vscode/ripgrep/bin/darwin-arm64-rg',
|
|
46
|
+
'node_modules/@vscode/ripgrep/bin/linux-x64-rg',
|
|
47
|
+
'node_modules/@vscode/ripgrep/bin/linux-arm64-rg',
|
|
48
|
+
'node_modules/@vscode/ripgrep/bin/linux-arm-rg',
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
for (const relativePath of binaryPaths) {
|
|
54
|
+
const fullPath = path.join(bundleDir, relativePath);
|
|
55
|
+
|
|
56
|
+
if (fs.existsSync(fullPath)) {
|
|
57
|
+
try {
|
|
58
|
+
const stats = fs.statSync(fullPath);
|
|
59
|
+
const currentMode = stats.mode;
|
|
60
|
+
const expectedMode = 0o755; // rwxr-xr-x
|
|
61
|
+
|
|
62
|
+
// Check if execute permissions already exist
|
|
63
|
+
if ((currentMode & 0o111) === 0) {
|
|
64
|
+
// No execute permissions, needs fix
|
|
65
|
+
fs.chmodSync(fullPath, expectedMode);
|
|
66
|
+
fixes.push(relativePath);
|
|
67
|
+
console.log(` ✅ Fixed: ${relativePath}`);
|
|
68
|
+
} else {
|
|
69
|
+
console.log(` ✓ Permissions correct: ${relativePath}`);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.warn(` ⚠️ Unable to fix ${relativePath}: ${error.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (fixes.length > 0) {
|
|
78
|
+
console.log(`🎉 Successfully fixed execute permissions for ${fixes.length} binary files`);
|
|
79
|
+
} else {
|
|
80
|
+
console.log('✅ All binary file permissions are correct');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Recursively search and fix all binary file permissions
|
|
85
|
+
function fixAllBinaryPermissions(dir = null) {
|
|
86
|
+
if (process.platform === 'win32') {
|
|
87
|
+
console.log('🔧 Windows system - binary permissions fix not needed');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const searchDir = dir || path.resolve(__dirname, '..', 'bundle');
|
|
92
|
+
|
|
93
|
+
if (!fs.existsSync(searchDir)) {
|
|
94
|
+
console.log(`⚠️ Directory does not exist: ${searchDir}`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(`🔧 Recursively searching and fixing binary file permissions in ${searchDir}...`);
|
|
99
|
+
|
|
100
|
+
const fixes = [];
|
|
101
|
+
|
|
102
|
+
function walkDir(currentDir) {
|
|
103
|
+
try {
|
|
104
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
105
|
+
|
|
106
|
+
for (const entry of entries) {
|
|
107
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
108
|
+
|
|
109
|
+
if (entry.isDirectory()) {
|
|
110
|
+
// Recursively process subdirectories
|
|
111
|
+
walkDir(fullPath);
|
|
112
|
+
} else if (entry.isFile()) {
|
|
113
|
+
// Check if it's a binary file (no extension or excluding .exe)
|
|
114
|
+
const ext = path.extname(entry.name);
|
|
115
|
+
const basename = path.basename(entry.name);
|
|
116
|
+
|
|
117
|
+
// Conditions for identifying binary files:
|
|
118
|
+
// 1. No extension and not common text files
|
|
119
|
+
// 2. Filename contains 'rg' and not .exe
|
|
120
|
+
// 3. Executable files in bin/ directory
|
|
121
|
+
const isBinary = (
|
|
122
|
+
(ext === '' && !['README', 'LICENSE', 'CHANGELOG'].includes(basename.toUpperCase())) ||
|
|
123
|
+
(basename.includes('rg') && ext !== '.exe') ||
|
|
124
|
+
(currentDir.includes('/bin') && ext === '')
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (isBinary) {
|
|
128
|
+
try {
|
|
129
|
+
const stats = fs.statSync(fullPath);
|
|
130
|
+
const currentMode = stats.mode;
|
|
131
|
+
|
|
132
|
+
// Check if execute permissions already exist
|
|
133
|
+
if ((currentMode & 0o111) === 0) {
|
|
134
|
+
// No execute permissions, needs fix
|
|
135
|
+
const expectedMode = 0o755; // rwxr-xr-x
|
|
136
|
+
fs.chmodSync(fullPath, expectedMode);
|
|
137
|
+
|
|
138
|
+
const relativePath = path.relative(searchDir, fullPath);
|
|
139
|
+
fixes.push(relativePath);
|
|
140
|
+
console.log(` ✅ Fixed: ${relativePath}`);
|
|
141
|
+
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.warn(` ⚠️ Unable to process ${fullPath}: ${error.message}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.warn(` ⚠️ Unable to read directory ${currentDir}: ${error.message}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
walkDir(searchDir);
|
|
154
|
+
|
|
155
|
+
if (fixes.length > 0) {
|
|
156
|
+
console.log(`🎉 Successfully fixed execute permissions for ${fixes.length} binary files`);
|
|
157
|
+
fixes.forEach(file => console.log(` - ${file}`));
|
|
158
|
+
} else {
|
|
159
|
+
console.log('✅ All binary file permissions are correct or no fixes needed');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Main function
|
|
164
|
+
function main() {
|
|
165
|
+
const args = process.argv.slice(2);
|
|
166
|
+
|
|
167
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
168
|
+
console.log(`
|
|
169
|
+
🔧 Binary File Permissions Fix Tool
|
|
170
|
+
|
|
171
|
+
Usage:
|
|
172
|
+
node fix-binary-permissions.js [options]
|
|
173
|
+
|
|
174
|
+
Options:
|
|
175
|
+
--all, -a Recursively search and fix all binary file permissions
|
|
176
|
+
--dir <path> Specify directory to search (use with --all)
|
|
177
|
+
--help, -h Show help information
|
|
178
|
+
|
|
179
|
+
Default behavior:
|
|
180
|
+
Fix permissions for known ripgrep binary files
|
|
181
|
+
|
|
182
|
+
Description:
|
|
183
|
+
This script solves the issue of lost Unix execute permissions when packaging on Windows.
|
|
184
|
+
Automatically restores binary file execute permissions after installation on Unix systems.
|
|
185
|
+
Supports ripgrep search tools.
|
|
186
|
+
No operations performed on Windows systems.
|
|
187
|
+
|
|
188
|
+
Examples:
|
|
189
|
+
node fix-binary-permissions.js # Fix known binary files (ripgrep)
|
|
190
|
+
node fix-binary-permissions.js --all # Recursively fix all binary files
|
|
191
|
+
node fix-binary-permissions.js --all --dir /path/to/bundle
|
|
192
|
+
`);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
if (args.includes('--all') || args.includes('-a')) {
|
|
198
|
+
const dirIndex = args.indexOf('--dir');
|
|
199
|
+
const customDir = dirIndex !== -1 && args[dirIndex + 1] ? args[dirIndex + 1] : null;
|
|
200
|
+
fixAllBinaryPermissions(customDir);
|
|
201
|
+
} else {
|
|
202
|
+
fixBinaryPermissions();
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error('❌ Error occurred while fixing permissions:', error.message);
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// If this script is executed directly
|
|
211
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
212
|
+
main();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { fixBinaryPermissions, fixAllBinaryPermissions };
|