lemmafit 0.2.2 → 0.3.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.
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ const { execSync } = require('child_process');
3
+
4
+ try {
5
+ execSync('claimcheck --version', { stdio: 'ignore' });
6
+ } catch {
7
+ if (process.env.npm_config_global === 'true') {
8
+ console.log('Installing claimcheck CLI...');
9
+ try {
10
+ execSync('npm install -g claimcheck', { stdio: 'inherit' });
11
+ } catch {
12
+ console.warn(
13
+ '\n⚠ Failed to install claimcheck. Install it manually:\n' +
14
+ ' npm install -g claimcheck\n'
15
+ );
16
+ }
17
+ } else {
18
+ console.warn(
19
+ '\n⚠ lemmafit requires the claimcheck CLI, but it was not found on your PATH.\n' +
20
+ ' Install it with: npm install -g claimcheck\n'
21
+ );
22
+ }
23
+ }
@@ -10,13 +10,14 @@ const path = require('path');
10
10
  const { execSync } = require('child_process');
11
11
  const os = require('os');
12
12
 
13
- const DAFNY2JS_VERSION = '0.9.5';
13
+ const DAFNY2JS_VERSION = '0.10.0';
14
14
 
15
15
  const PLATFORM_RIDS = {
16
16
  'darwin-arm64': 'osx-arm64',
17
17
  'darwin-x64': 'osx-x64',
18
18
  'linux-x64': 'linux-x64',
19
19
  'linux-arm64': 'linux-arm64',
20
+ 'win32-x64': 'win-x64',
20
21
  };
21
22
 
22
23
  function getPlatformKey() {
@@ -35,8 +36,9 @@ function printBuildInstructions(rid) {
35
36
  console.error(' cd dafny2js');
36
37
  console.error(` dotnet publish -c Release -r ${rid} --self-contained /p:PublishSingleFile=true`);
37
38
  console.error('');
39
+ const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
38
40
  console.error('Then copy the binary to:');
39
- console.error(` ${path.join(installDir, 'dafny2js')}`);
41
+ console.error(` ${path.join(installDir, binaryName)}`);
40
42
  }
41
43
 
42
44
  function download(url, dest) {
@@ -92,7 +94,8 @@ async function main() {
92
94
  }
93
95
 
94
96
  const installDir = path.join(os.homedir(), '.lemmafit', '.dafny2js');
95
- const binaryPath = path.join(installDir, 'dafny2js');
97
+ const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
98
+ const binaryPath = path.join(installDir, binaryName);
96
99
  const versionFile = path.join(installDir, 'version');
97
100
 
98
101
  // Check if correct version is already installed
package/lib/daemon.js CHANGED
@@ -30,10 +30,11 @@ class Daemon {
30
30
 
31
31
  // Shared cache paths (~/.lemmafit), with fallback to package-local
32
32
  const cacheDir = path.join(os.homedir(), '.lemmafit');
33
- const cacheDafny2js = path.join(cacheDir, '.dafny2js', 'dafny2js');
33
+ const dafny2jsBinName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
34
+ const cacheDafny2js = path.join(cacheDir, '.dafny2js', dafny2jsBinName);
34
35
  this.dafny2jsBin = fs.existsSync(cacheDafny2js)
35
36
  ? cacheDafny2js
36
- : path.join(__dirname, '..', '.dafny2js', 'dafny2js');
37
+ : path.join(__dirname, '..', '.dafny2js', dafny2jsBinName);
37
38
  this.kernelPath = path.join(__dirname, '..', 'kernels', 'Replay.dfy');
38
39
 
39
40
  // Load or create config
@@ -64,13 +65,14 @@ class Daemon {
64
65
  }
65
66
 
66
67
  findDafny() {
68
+ const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
67
69
  // Check shared cache directory first (~/.lemmafit)
68
- const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny', 'dafny');
70
+ const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny', dafnyBinName);
69
71
  if (fs.existsSync(cacheDafny)) {
70
72
  return cacheDafny;
71
73
  }
72
74
  // Check lemmafit package directory (fallback)
73
- const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny', 'dafny');
75
+ const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny', dafnyBinName);
74
76
  if (fs.existsSync(lemmafitDafny)) {
75
77
  return lemmafitDafny;
76
78
  }
@@ -83,7 +83,8 @@ async function main() {
83
83
  const cacheDir = path.join(os.homedir(), '.lemmafit');
84
84
  const installDir = path.join(cacheDir, '.dafny');
85
85
  const dafnyDir = path.join(installDir, 'dafny');
86
- const dafnyBin = path.join(dafnyDir, 'dafny');
86
+ const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
87
+ const dafnyBin = path.join(dafnyDir, dafnyBinName);
87
88
  const versionFile = path.join(installDir, 'version');
88
89
 
89
90
  // Check if correct version is already installed
@@ -109,7 +110,11 @@ async function main() {
109
110
 
110
111
  // Extract
111
112
  console.log('Extracting...');
112
- execSync(`unzip -q -o "${zipPath}" -d "${installDir}"`, { stdio: 'inherit' });
113
+ if (os.platform() === 'win32') {
114
+ execSync(`tar -xf "${zipPath}" -C "${installDir}"`, { stdio: 'inherit' });
115
+ } else {
116
+ execSync(`unzip -q -o "${zipPath}" -d "${installDir}"`, { stdio: 'inherit' });
117
+ }
113
118
 
114
119
  // Clean up zip
115
120
  fs.unlinkSync(zipPath);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "verified",
16
16
  "proof"
17
17
  ],
18
- "version": "0.2.2",
18
+ "version": "0.3.0",
19
19
  "type": "commonjs",
20
20
  "files": [
21
21
  "cli/",
@@ -36,7 +36,7 @@
36
36
  "lemmafit-generate-guarantees": "cli/generate-guarantees-md.js"
37
37
  },
38
38
  "scripts": {
39
- "postinstall": "node ./cli/sync.js && node ./cli/download-dafny2js.js && node ./lib/download-dafny.js"
39
+ "postinstall": "node ./cli/sync.js && node ./cli/download-dafny2js.js && node ./lib/download-dafny.js && node ./cli/check-claimcheck.js"
40
40
  },
41
41
  "dependencies": {
42
42
  "js-yaml": "^4.1.1",