Refactor user message hook for first-run detection, update Python version regex validation in settings routes, and simplify package commands directory retrieval

This commit is contained in:
Alex Newman
2025-12-09 14:33:23 -05:00
parent 1fb8df42b6
commit d9f3798c90
7 changed files with 42 additions and 47 deletions
+4 -4
View File
@@ -11,12 +11,12 @@ import { homedir } from "os";
import { existsSync } from "fs";
import { ensureWorkerRunning, getWorkerPort } from "../shared/worker-utils.js";
// Check if node_modules exists - if not, this is first run
// Check if first-run marker exists - if not, this is first run
const pluginDir = join(homedir(), '.claude', 'plugins', 'marketplaces', 'thedotmack');
const nodeModulesPath = join(pluginDir, 'node_modules');
const firstRunMarker = join(pluginDir, '.first-run-complete');
if (!existsSync(nodeModulesPath)) {
// First-time installation - dependencies not yet installed
if (!existsSync(firstRunMarker)) {
// First-time installation - setup not yet complete
console.error(`
---
🎉 Note: This appears under Plugin Hook Error, but it's not an error. That's the only option for
@@ -95,11 +95,11 @@ export class SettingsRoutes extends BaseRouteHandler {
// Validate CLAUDE_MEM_PYTHON_VERSION (must be valid Python version format)
if (req.body.CLAUDE_MEM_PYTHON_VERSION) {
const pythonVersionRegex = /^3\.\d+$/;
const pythonVersionRegex = /^3\.\d{1,2}$/;
if (!pythonVersionRegex.test(req.body.CLAUDE_MEM_PYTHON_VERSION)) {
res.status(400).json({
success: false,
error: 'CLAUDE_MEM_PYTHON_VERSION must be in format "3.X" (e.g., "3.13")'
error: 'CLAUDE_MEM_PYTHON_VERSION must be in format "3.X" or "3.XX" (e.g., "3.13")'
});
return;
}
+1 -7
View File
@@ -112,13 +112,7 @@ export function getPackageRoot(): string {
*/
export function getPackageCommandsDir(): string {
const packageRoot = getPackageRoot();
const commandsDir = join(packageRoot, 'commands');
if (!existsSync(join(commandsDir, 'save.md'))) {
throw new Error('Package commands directory missing required files');
}
return commandsDir;
return join(packageRoot, 'commands');
}
/**