sphere-cli 0.1.4 → 0.1.7

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/README.md CHANGED
@@ -49,6 +49,9 @@ sh install.sh --uninstall
49
49
  ## Quick start
50
50
 
51
51
  ```sh
52
+ # Activate your license (once)
53
+ sphere license activate sphere_xxxxxxxxxxxxxxxxxxxx
54
+
52
55
  # Generate synthetic data
53
56
  sphere generate real.csv -o synth.csv
54
57
 
@@ -63,6 +66,22 @@ sphere certify real.csv synth.csv -o report.html
63
66
 
64
67
  ## Commands
65
68
 
69
+ ### `sphere license`
70
+
71
+ Activate and manage your SPHERE license. A valid license is required to use `generate`, `evaluate`, and `certify`.
72
+
73
+ ```
74
+ sphere license activate [KEY] # Activate with a sphere_… key (prompts if omitted)
75
+ sphere license status # Check current license (validates online, falls back to cache)
76
+ sphere license clear # Remove stored key and cache
77
+ ```
78
+
79
+ The key is stored at `~/.config/sphere/license_key` (mode 0600). After a successful activation the license is cached locally for **7 days**, so the CLI works offline within that window.
80
+
81
+ > Don't have a license? Contact [zihuai@stanford.edu](mailto:zihuai@stanford.edu) or visit [sphere.stanford.edu](https://sphere.stanford.edu).
82
+
83
+ ---
84
+
66
85
  ### `sphere generate`
67
86
 
68
87
  ```
@@ -118,6 +137,8 @@ sphere evaluate real.csv synth.csv --json > metrics.json
118
137
 
119
138
  | Variable | Description |
120
139
  |---|---|
140
+ | `SPHERE_LICENSE_REQUIRED` | Set to `false` to bypass license checks (research / unlocked builds) |
141
+ | `SPHERE_WORKER_URL` | Override the license validation endpoint |
121
142
  | `SPHERE_PREFIX` | Override install prefix |
122
143
  | `SPHERE_VERSION` | Pin a release tag, e.g. `v0.1.0` |
123
144
  | `SPHERE_BUNDLE_URL` | Full URL to a `sphere-cli-*.tar.gz` (skip auto-detect) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sphere-cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "SPHERE CLI — synthetic data generation, evaluation, and certification",
5
5
  "keywords": ["synthetic-data", "privacy", "cli", "data-science"],
6
6
  "homepage": "https://github.com/statzihuai/sphere-cli",
@@ -77,14 +77,25 @@ async function main() {
77
77
  const nativeDir = path.join(PKG_DIR, 'native');
78
78
  const tmpTar = path.join(os.tmpdir(), `sphere-cli-install-${process.pid}.tar.gz`);
79
79
 
80
- // Already installed (e.g. re-running postinstall manually)
81
- const binaryPath = path.join(nativeDir, 'sphere-cli', 'sphere');
82
- if (fs.existsSync(binaryPath)) {
83
- console.log(' SPHERE CLI binary already present — skipping download.');
80
+ // Re-download whenever the installed version doesn't match the package version.
81
+ // This ensures `npm install -g sphere-cli` or `npm update -g sphere-cli` always
82
+ // delivers the correct binary even when one is already present from a prior release.
83
+ const binaryPath = path.join(nativeDir, 'sphere-cli', 'sphere');
84
+ const markerPath = path.join(nativeDir, '.sphere-cli-version');
85
+ const installedVer = fs.existsSync(markerPath)
86
+ ? fs.readFileSync(markerPath, 'utf8').trim()
87
+ : null;
88
+
89
+ if (fs.existsSync(binaryPath) && installedVer === VERSION) {
90
+ console.log(`✓ SPHERE CLI v${VERSION} already installed — skipping download.`);
84
91
  return;
85
92
  }
86
93
 
87
- console.log(`\nDownloading SPHERE CLI v${VERSION} for ${platform} …`);
94
+ if (installedVer && installedVer !== VERSION) {
95
+ console.log(`\nUpgrading SPHERE CLI ${installedVer} → ${VERSION} for ${platform} …`);
96
+ } else {
97
+ console.log(`\nDownloading SPHERE CLI v${VERSION} for ${platform} …`);
98
+ }
88
99
  console.log(` ${url}\n`);
89
100
 
90
101
  try {
@@ -109,6 +120,9 @@ async function main() {
109
120
  // Ensure the binary is executable
110
121
  fs.chmodSync(binaryPath, 0o755);
111
122
 
123
+ // Write version marker so future postinstall runs can detect upgrades
124
+ fs.writeFileSync(markerPath, VERSION, 'utf8');
125
+
112
126
  console.log('✓ SPHERE CLI installed.\n');
113
127
  console.log(' Quick start:');
114
128
  console.log(' sphere generate data.csv -o synth.csv');