specmem-hardwicksoftware 3.5.25 → 3.5.27

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.

Potentially problematic release.


This version of specmem-hardwicksoftware might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specmem-hardwicksoftware",
3
- "version": "3.5.25",
3
+ "version": "3.5.27",
4
4
  "type": "module",
5
5
  "description": "SpecMem - Speculative Memory for Claude Code. Auto-configures hooks, docker, embeddings. https://justcalljon.pro",
6
6
  "main": "dist/index.js",
@@ -53,6 +53,31 @@ const MODELS_DIR = path.join(SPECMEM_DIR, 'models');
53
53
  const OPTIMIZED_DIR = path.join(MODELS_DIR, 'optimized');
54
54
  const BASE_MODEL_DIR = path.join(MODELS_DIR, 'base');
55
55
 
56
+ // ============================================================================
57
+ // DIRECTORY CHECK - Warn if running from home/system directory
58
+ // ============================================================================
59
+ function checkProjectDirectory() {
60
+ const cwd = process.cwd();
61
+ const homeDir = require('os').homedir();
62
+ const badDirs = [homeDir, '/', '/root', '/home', '/usr', '/var', '/tmp', '/etc', '/opt'];
63
+
64
+ if (badDirs.some(bad => cwd === bad || cwd === bad + '/')) {
65
+ console.log(`
66
+ ${YELLOW}${BOLD}╔════════════════════════════════════════════════════════════════╗
67
+ ║ ⚠ WARNING: Running from system/home directory! ║
68
+ ╠════════════════════════════════════════════════════════════════╣
69
+ ║ ║
70
+ ║ Current: ${cwd.substring(0, 50).padEnd(50)} ║
71
+ ║ ║
72
+ ║ SpecMem setup should run from a PROJECT directory. ║
73
+ ║ cd into your project first, then run specmem setup. ║
74
+ ║ ║
75
+ ╚════════════════════════════════════════════════════════════════╝${RESET}
76
+ `);
77
+ console.log(`${DIM}Continuing anyway...${RESET}\n`);
78
+ }
79
+ }
80
+
56
81
  // ASCII art banner
57
82
  function showBanner() {
58
83
  console.log(`
@@ -167,10 +192,11 @@ function installPythonDeps() {
167
192
 
168
193
  const deps = [
169
194
  'torch --index-url https://download.pytorch.org/whl/cpu',
170
- 'sentence-transformers',
195
+ 'sentence-transformers[onnx]',
171
196
  'onnx',
172
197
  'onnxruntime',
173
- 'optimum[onnxruntime]'
198
+ 'optimum[onnxruntime]',
199
+ 'optimum'
174
200
  ];
175
201
 
176
202
  for (const dep of deps) {
@@ -178,7 +204,7 @@ function installPythonDeps() {
178
204
  console.log(`${DIM}Installing ${dep.split(' ')[0]}...${RESET}`);
179
205
  execSync(`pip3 install ${dep} --break-system-packages -q 2>/dev/null || pip install ${dep} --break-system-packages -q 2>/dev/null || pip3 install ${dep} -q 2>/dev/null || pip install ${dep} -q 2>/dev/null`, {
180
206
  stdio: ['pipe', 'pipe', 'pipe'],
181
- timeout: 300000 // 5 min timeout for torch
207
+ timeout: 600000 // 10 min timeout for large packages like torch/optimum
182
208
  });
183
209
  console.log(`${GREEN}✓${RESET} ${dep.split(' ')[0]} installed`);
184
210
  } catch (e) {
@@ -545,6 +571,7 @@ function showSummary() {
545
571
  // Main
546
572
  async function main() {
547
573
  showBanner();
574
+ checkProjectDirectory();
548
575
 
549
576
  // Check if already done
550
577
  if (modelsExist()) {
@@ -30,6 +30,17 @@ const isGlobalInstall = process.env.npm_config_global === 'true' ||
30
30
  process.env.npm_lifecycle_event === 'postinstall' &&
31
31
  !__dirname.includes(process.cwd());
32
32
 
33
+ // ============================================================================
34
+ // UNINSTALL OLD VERSIONS FIRST
35
+ // ============================================================================
36
+ try {
37
+ const oldVersionCheck = require('child_process').execSync('npm list -g specmem-hardwicksoftware --depth=0 2>/dev/null || true', { encoding: 'utf8' });
38
+ if (oldVersionCheck.includes('specmem-hardwicksoftware@') && !oldVersionCheck.includes(require('../package.json').version)) {
39
+ console.log('\x1b[33m⚠ Removing old version before installing new one...\x1b[0m');
40
+ require('child_process').execSync('npm uninstall -g specmem-hardwicksoftware 2>/dev/null || true', { stdio: 'pipe' });
41
+ }
42
+ } catch (e) { /* ignore */ }
43
+
33
44
  // ============================================================================
34
45
  // PLATFORM CHECK - Linux only for now
35
46
  // ============================================================================
@@ -5448,6 +5448,45 @@ async function main() {
5448
5448
  const projectPath = process.cwd();
5449
5449
  const startTime = Date.now();
5450
5450
 
5451
+ // ========== DIRECTORY CHECK - Warn if not in a project directory ==========
5452
+ const homeDir = os.homedir();
5453
+ const badDirs = [
5454
+ homeDir,
5455
+ '/',
5456
+ '/root',
5457
+ '/home',
5458
+ '/usr',
5459
+ '/var',
5460
+ '/tmp',
5461
+ '/etc',
5462
+ '/opt'
5463
+ ];
5464
+
5465
+ const isBadDir = badDirs.some(bad => projectPath === bad || projectPath === bad + '/');
5466
+
5467
+ if (isBadDir) {
5468
+ console.log(`
5469
+ ${c.red}${c.bright}╔════════════════════════════════════════════════════════════════╗
5470
+ ║ ⚠ WARNING: You're running specmem from a system directory! ║
5471
+ ╠════════════════════════════════════════════════════════════════╣
5472
+ ║ ║
5473
+ ║ Current directory: ${projectPath.padEnd(41)}║
5474
+ ║ ║
5475
+ ║ SpecMem should be run from a PROJECT directory, not: ║
5476
+ ║ • Your home folder (~) ║
5477
+ ║ • System directories (/root, /usr, /etc, etc) ║
5478
+ ║ • Temporary directories (/tmp) ║
5479
+ ║ ║
5480
+ ║ Please cd into your project first: ║
5481
+ ║ $ cd /path/to/your/project ║
5482
+ ║ $ specmem init ║
5483
+ ║ ║
5484
+ ╚════════════════════════════════════════════════════════════════╝${c.reset}
5485
+ `);
5486
+ console.log(`${c.yellow}Continuing anyway in 5 seconds... (Ctrl+C to cancel)${c.reset}`);
5487
+ await new Promise(r => setTimeout(r, 5000));
5488
+ }
5489
+
5451
5490
  // Speed mode enabled by default - no need to wait for SPACE
5452
5491
 
5453
5492
  // Animated banner with sliding red highlight (screen already cleared at startup)