specmem-hardwicksoftware 3.5.23 → 3.5.25
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
|
@@ -178,6 +178,73 @@ function ensureDir(dir) {
|
|
|
178
178
|
// CLAUDE CODE INSTALLATION
|
|
179
179
|
// ============================================================================
|
|
180
180
|
|
|
181
|
+
// ============================================================================
|
|
182
|
+
// CORE SYSTEM DEPENDENCIES - Install EVERYTHING if missing
|
|
183
|
+
// ============================================================================
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Install ALL core system dependencies before anything else
|
|
187
|
+
*/
|
|
188
|
+
function installCoreDeps() {
|
|
189
|
+
log.header('Installing Core System Dependencies');
|
|
190
|
+
|
|
191
|
+
const packages = [];
|
|
192
|
+
|
|
193
|
+
// Check what's missing
|
|
194
|
+
if (!commandExists('python3')) packages.push('python3');
|
|
195
|
+
if (!commandExists('pip3') && !commandExists('pip')) packages.push('python3-pip');
|
|
196
|
+
if (!commandExists('screen')) packages.push('screen');
|
|
197
|
+
if (!commandExists('curl')) packages.push('curl');
|
|
198
|
+
if (!commandExists('git')) packages.push('git');
|
|
199
|
+
if (!commandExists('sudo')) packages.push('sudo');
|
|
200
|
+
|
|
201
|
+
if (packages.length === 0) {
|
|
202
|
+
log.success('All core dependencies already installed');
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
log.info(`Missing packages: ${packages.join(', ')}`);
|
|
207
|
+
log.info('Installing via package manager...');
|
|
208
|
+
|
|
209
|
+
if (IS_LINUX) {
|
|
210
|
+
if (commandExists('apt-get')) {
|
|
211
|
+
// Debian/Ubuntu/Mint
|
|
212
|
+
const result = run(`apt-get update -qq && apt-get install -y ${packages.join(' ')} python3-venv build-essential`, { timeout: 300000 });
|
|
213
|
+
if (!result.success) {
|
|
214
|
+
// Try with sudo
|
|
215
|
+
run(`sudo apt-get update -qq && sudo apt-get install -y ${packages.join(' ')} python3-venv build-essential`, { timeout: 300000 });
|
|
216
|
+
}
|
|
217
|
+
} else if (commandExists('dnf')) {
|
|
218
|
+
run(`sudo dnf install -y ${packages.join(' ').replace('python3-pip', 'python3-pip python3-devel')} gcc make`, { timeout: 300000 });
|
|
219
|
+
} else if (commandExists('yum')) {
|
|
220
|
+
run(`sudo yum install -y ${packages.join(' ').replace('python3-pip', 'python3-pip python3-devel')} gcc make`, { timeout: 300000 });
|
|
221
|
+
} else if (commandExists('pacman')) {
|
|
222
|
+
run(`sudo pacman -Sy --noconfirm ${packages.join(' ').replace('python3-pip', 'python-pip')}`, { timeout: 300000 });
|
|
223
|
+
}
|
|
224
|
+
} else if (IS_MAC) {
|
|
225
|
+
if (commandExists('brew')) {
|
|
226
|
+
run(`brew install ${packages.join(' ').replace('python3-pip', 'python3')}`, { timeout: 300000 });
|
|
227
|
+
} else {
|
|
228
|
+
log.warn('Homebrew not found - install from https://brew.sh');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Verify critical ones
|
|
233
|
+
const missing = [];
|
|
234
|
+
if (!commandExists('python3')) missing.push('python3');
|
|
235
|
+
if (!commandExists('pip3') && !commandExists('pip')) missing.push('pip');
|
|
236
|
+
if (!commandExists('screen')) missing.push('screen');
|
|
237
|
+
|
|
238
|
+
if (missing.length > 0) {
|
|
239
|
+
log.warn(`Still missing: ${missing.join(', ')}`);
|
|
240
|
+
log.info('Some features may not work without these dependencies');
|
|
241
|
+
} else {
|
|
242
|
+
log.success('All core dependencies installed');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
|
|
181
248
|
/**
|
|
182
249
|
* Check if Claude Code is installed, install if missing
|
|
183
250
|
*/
|
|
@@ -1656,14 +1723,17 @@ ${c.reset}
|
|
|
1656
1723
|
};
|
|
1657
1724
|
|
|
1658
1725
|
try {
|
|
1659
|
-
// Step
|
|
1726
|
+
// Step 0: Install ALL core system deps FIRST (python3, pip, screen, curl, git)
|
|
1727
|
+
installCoreDeps();
|
|
1728
|
+
|
|
1729
|
+
// Step 0a: Claude Code (REQUIRED)
|
|
1660
1730
|
results.claudeCode = ensureClaudeCode();
|
|
1661
1731
|
if (!results.claudeCode) {
|
|
1662
1732
|
log.warn('Claude Code not installed - SpecMem requires Claude Code to function');
|
|
1663
1733
|
log.info('Install manually: npm install -g @anthropic-ai/claude-code');
|
|
1664
1734
|
}
|
|
1665
1735
|
|
|
1666
|
-
// Step 0b: screen (needed for team members)
|
|
1736
|
+
// Step 0b: screen (needed for team members) - should already be installed by installCoreDeps
|
|
1667
1737
|
results.screen = ensureScreen();
|
|
1668
1738
|
|
|
1669
1739
|
// Step 1: PostgreSQL
|
package/scripts/specmem-init.cjs
CHANGED
|
@@ -5456,6 +5456,46 @@ async function main() {
|
|
|
5456
5456
|
console.log(`${c.brightYellow}⚡ TURBO MODE${c.reset}${c.dim} - Fast initialization enabled${c.reset}`);
|
|
5457
5457
|
console.log('');
|
|
5458
5458
|
|
|
5459
|
+
// ========== PRE-STAGE 0: Auto-run setup if not done ==========
|
|
5460
|
+
// Check if first-run setup has been completed (models downloaded, deps installed)
|
|
5461
|
+
const specmemPkgDir = path.dirname(__dirname);
|
|
5462
|
+
const modelsDir = path.join(specmemPkgDir, 'models', 'optimized');
|
|
5463
|
+
const setupMarker = path.join(specmemPkgDir, '.setup-complete');
|
|
5464
|
+
|
|
5465
|
+
// Check if setup is needed: no models dir OR no setup marker OR missing Python deps
|
|
5466
|
+
let needsSetup = false;
|
|
5467
|
+
if (!fs.existsSync(modelsDir) || !fs.existsSync(setupMarker)) {
|
|
5468
|
+
needsSetup = true;
|
|
5469
|
+
} else {
|
|
5470
|
+
// Also check if sentence_transformers is available
|
|
5471
|
+
try {
|
|
5472
|
+
execSync('python3 -c "import sentence_transformers" 2>/dev/null', { stdio: 'pipe' });
|
|
5473
|
+
} catch (e) {
|
|
5474
|
+
needsSetup = true;
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
|
|
5478
|
+
if (needsSetup) {
|
|
5479
|
+
console.log(`${c.yellow}═══ First-time setup required ═══${c.reset}`);
|
|
5480
|
+
console.log(`${c.dim}Running specmem setup to download models and install dependencies...${c.reset}\n`);
|
|
5481
|
+
|
|
5482
|
+
try {
|
|
5483
|
+
// Run first-run-model-setup.cjs
|
|
5484
|
+
const setupScript = path.join(specmemPkgDir, 'scripts', 'first-run-model-setup.cjs');
|
|
5485
|
+
if (fs.existsSync(setupScript)) {
|
|
5486
|
+
execSync(`node "${setupScript}"`, { stdio: 'inherit', timeout: 600000 }); // 10 min timeout
|
|
5487
|
+
// Create marker file to indicate setup is complete
|
|
5488
|
+
fs.writeFileSync(setupMarker, new Date().toISOString());
|
|
5489
|
+
console.log(`\n${c.green}✓ Setup complete!${c.reset}\n`);
|
|
5490
|
+
} else {
|
|
5491
|
+
console.log(`${c.yellow}⚠ Setup script not found, continuing anyway...${c.reset}\n`);
|
|
5492
|
+
}
|
|
5493
|
+
} catch (e) {
|
|
5494
|
+
console.log(`${c.yellow}⚠ Setup had issues but continuing with init...${c.reset}`);
|
|
5495
|
+
console.log(`${c.dim}You can run 'specmem setup' manually later${c.reset}\n`);
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5459
5499
|
// ========== PRE-STAGE: Kill Old Stuck Init Processes ==========
|
|
5460
5500
|
// Prevent resource conflicts by killing old specmem-init processes for THIS PROJECT ONLY
|
|
5461
5501
|
// CRITICAL: Use realpath to normalize paths and avoid killing other projects' processes
|