lean-spec 0.2.18-dev.21126840699 → 0.2.18
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/bin/lean-spec-rust.js +8 -77
- package/binaries/darwin-arm64/lean-spec +0 -0
- package/binaries/darwin-arm64/package.json +1 -1
- package/binaries/darwin-x64/lean-spec +0 -0
- package/binaries/darwin-x64/package.json +1 -1
- package/binaries/{windows-x64/lean-spec.exe → linux-arm64/lean-spec} +0 -0
- package/binaries/linux-arm64/package.json +24 -0
- package/binaries/linux-arm64/postinstall.js +17 -0
- package/binaries/linux-x64/lean-spec +0 -0
- package/binaries/linux-x64/package.json +1 -1
- package/binaries/windows-x64/package.json +2 -6
- package/package.json +8 -7
- package/binaries/windows-x64/postinstall.js +0 -6
package/bin/lean-spec-rust.js
CHANGED
|
@@ -14,7 +14,7 @@ import { spawn } from 'child_process';
|
|
|
14
14
|
import { createRequire } from 'module';
|
|
15
15
|
import { fileURLToPath } from 'url';
|
|
16
16
|
import { dirname, join } from 'path';
|
|
17
|
-
import { accessSync
|
|
17
|
+
import { accessSync } from 'fs';
|
|
18
18
|
|
|
19
19
|
const require = createRequire(import.meta.url);
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -27,64 +27,10 @@ const debug = (...args) => DEBUG && console.error('[lean-spec debug]', ...args);
|
|
|
27
27
|
// Platform detection mapping
|
|
28
28
|
const PLATFORM_MAP = {
|
|
29
29
|
darwin: { x64: 'darwin-x64', arm64: 'darwin-arm64' },
|
|
30
|
-
linux: { x64: 'linux-x64' },
|
|
30
|
+
linux: { x64: 'linux-x64', arm64: 'linux-arm64' },
|
|
31
31
|
win32: { x64: 'windows-x64', arm64: 'windows-arm64' }
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const MACHO_MAGICS = new Set([
|
|
35
|
-
0xfeedface,
|
|
36
|
-
0xfeedfacf,
|
|
37
|
-
0xcefaedfe,
|
|
38
|
-
0xcffaedfe,
|
|
39
|
-
0xcafebabe,
|
|
40
|
-
0xbebafeca,
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
function readHeaderBytes(filePath) {
|
|
44
|
-
const fd = openSync(filePath, 'r');
|
|
45
|
-
try {
|
|
46
|
-
const buffer = Buffer.alloc(4);
|
|
47
|
-
const bytesRead = readSync(fd, buffer, 0, 4, 0);
|
|
48
|
-
return bytesRead === 4 ? buffer : null;
|
|
49
|
-
} finally {
|
|
50
|
-
closeSync(fd);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function isValidBinaryHeader(filePath, platform) {
|
|
55
|
-
try {
|
|
56
|
-
const header = readHeaderBytes(filePath);
|
|
57
|
-
if (!header) return false;
|
|
58
|
-
|
|
59
|
-
if (platform === 'linux') {
|
|
60
|
-
return header[0] === 0x7f && header[1] === 0x45 && header[2] === 0x4c && header[3] === 0x46;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (platform === 'win32') {
|
|
64
|
-
return header[0] === 0x4d && header[1] === 0x5a;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (platform === 'darwin') {
|
|
68
|
-
const magicBE = header.readUInt32BE(0);
|
|
69
|
-
const magicLE = header.readUInt32LE(0);
|
|
70
|
-
return MACHO_MAGICS.has(magicBE) || MACHO_MAGICS.has(magicLE);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return false;
|
|
74
|
-
} catch (error) {
|
|
75
|
-
debug('Failed to read binary header:', error.message);
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function isExecutableBinary(filePath, platform) {
|
|
81
|
-
if (!isValidBinaryHeader(filePath, platform)) {
|
|
82
|
-
debug('Invalid binary header:', filePath);
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
34
|
function getBinaryPath() {
|
|
89
35
|
const platform = process.platform;
|
|
90
36
|
const arch = process.arch;
|
|
@@ -107,11 +53,8 @@ function getBinaryPath() {
|
|
|
107
53
|
// Try to resolve platform package
|
|
108
54
|
try {
|
|
109
55
|
const resolvedPath = require.resolve(`${packageName}/${binaryName}`);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return resolvedPath;
|
|
113
|
-
}
|
|
114
|
-
debug('Platform package binary is invalid:', resolvedPath);
|
|
56
|
+
debug('Found platform package binary:', resolvedPath);
|
|
57
|
+
return resolvedPath;
|
|
115
58
|
} catch (e) {
|
|
116
59
|
debug('Platform package not found:', packageName, '-', e.message);
|
|
117
60
|
}
|
|
@@ -121,11 +64,8 @@ function getBinaryPath() {
|
|
|
121
64
|
const localPath = join(__dirname, '..', 'binaries', platformKey, binaryName);
|
|
122
65
|
debug('Trying local binary:', localPath);
|
|
123
66
|
accessSync(localPath);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return localPath;
|
|
127
|
-
}
|
|
128
|
-
debug('Local binary is invalid:', localPath);
|
|
67
|
+
debug('Found local binary:', localPath);
|
|
68
|
+
return localPath;
|
|
129
69
|
} catch (e) {
|
|
130
70
|
debug('Local binary not found:', e.message);
|
|
131
71
|
}
|
|
@@ -135,11 +75,8 @@ function getBinaryPath() {
|
|
|
135
75
|
const rustTargetPath = join(__dirname, '..', '..', '..', 'rust', 'target', 'release', binaryName);
|
|
136
76
|
debug('Trying rust target binary:', rustTargetPath);
|
|
137
77
|
accessSync(rustTargetPath);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return rustTargetPath;
|
|
141
|
-
}
|
|
142
|
-
debug('Rust target binary is invalid:', rustTargetPath);
|
|
78
|
+
debug('Found rust target binary:', rustTargetPath);
|
|
79
|
+
return rustTargetPath;
|
|
143
80
|
} catch (e) {
|
|
144
81
|
debug('Rust target binary not found:', e.message);
|
|
145
82
|
}
|
|
@@ -147,12 +84,6 @@ function getBinaryPath() {
|
|
|
147
84
|
console.error(`Binary not found for ${platform}-${arch}`);
|
|
148
85
|
console.error(`Expected package: ${packageName}`);
|
|
149
86
|
console.error('');
|
|
150
|
-
console.error('Detected missing or corrupted binary.');
|
|
151
|
-
console.error('If you installed globally, reinstall to restore the binary:');
|
|
152
|
-
console.error(' npm uninstall -g lean-spec && npm install -g lean-spec');
|
|
153
|
-
console.error('');
|
|
154
|
-
console.error('If your npm config omits optional dependencies, enable them and reinstall.');
|
|
155
|
-
console.error('');
|
|
156
87
|
console.error('To install:');
|
|
157
88
|
console.error(' npm install -g lean-spec');
|
|
158
89
|
console.error('');
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leanspec/cli-linux-arm64",
|
|
3
|
+
"version": "0.2.18",
|
|
4
|
+
"description": "LeanSpec CLI binary for Linux ARM64",
|
|
5
|
+
"os": [
|
|
6
|
+
"linux"
|
|
7
|
+
],
|
|
8
|
+
"cpu": [
|
|
9
|
+
"arm64"
|
|
10
|
+
],
|
|
11
|
+
"main": "lean-spec",
|
|
12
|
+
"files": [
|
|
13
|
+
"lean-spec",
|
|
14
|
+
"postinstall.js"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"postinstall": "node postinstall.js"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/codervisor/lean-spec.git"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT"
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script to set execute permissions on the binary.
|
|
4
|
+
* npm doesn't preserve file permissions, so we need to set them after install.
|
|
5
|
+
*/
|
|
6
|
+
const { chmodSync } = require('fs');
|
|
7
|
+
const { join } = require('path');
|
|
8
|
+
|
|
9
|
+
const binaryPath = join(__dirname, 'lean-spec');
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
chmodSync(binaryPath, 0o755);
|
|
13
|
+
console.log('✓ Set execute permissions on lean-spec binary');
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.error('Warning: Could not set execute permissions:', err.message);
|
|
16
|
+
// Don't fail the install
|
|
17
|
+
}
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leanspec/cli-windows-x64",
|
|
3
|
-
"version": "0.2.18
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "LeanSpec CLI binary for Windows x64",
|
|
5
5
|
"os": [
|
|
6
6
|
"win32"
|
|
@@ -10,12 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"main": "lean-spec.exe",
|
|
12
12
|
"files": [
|
|
13
|
-
"lean-spec.exe"
|
|
14
|
-
"postinstall.js"
|
|
13
|
+
"lean-spec.exe"
|
|
15
14
|
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"postinstall": "node postinstall.js"
|
|
18
|
-
},
|
|
19
15
|
"repository": {
|
|
20
16
|
"type": "git",
|
|
21
17
|
"url": "https://github.com/codervisor/lean-spec.git"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lean-spec",
|
|
3
|
-
"version": "0.2.18
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "Specification-driven development made simple",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
"LICENSE",
|
|
36
36
|
"CHANGELOG.md"
|
|
37
37
|
],
|
|
38
|
+
"optionalDependencies": {
|
|
39
|
+
"@leanspec/cli-darwin-arm64": "^0.2.18",
|
|
40
|
+
"@leanspec/cli-darwin-x64": "^0.2.18",
|
|
41
|
+
"@leanspec/cli-linux-arm64": "^0.2.18",
|
|
42
|
+
"@leanspec/cli-linux-x64": "^0.2.18",
|
|
43
|
+
"@leanspec/cli-windows-x64": "^0.2.18"
|
|
44
|
+
},
|
|
38
45
|
"engines": {
|
|
39
46
|
"node": ">=20"
|
|
40
|
-
},
|
|
41
|
-
"optionalDependencies": {
|
|
42
|
-
"@leanspec/cli-darwin-x64": "^0.2.18-dev.21126840699",
|
|
43
|
-
"@leanspec/cli-darwin-arm64": "^0.2.18-dev.21126840699",
|
|
44
|
-
"@leanspec/cli-linux-x64": "^0.2.18-dev.21126840699",
|
|
45
|
-
"@leanspec/cli-windows-x64": "^0.2.18-dev.21126840699"
|
|
46
47
|
}
|
|
47
48
|
}
|