@twelvehart/supermemory-runtime 1.0.0-next.2 → 1.0.0-next.3
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/package.json
CHANGED
package/scripts/install.sh
CHANGED
|
@@ -5,6 +5,14 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
5
5
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
6
6
|
cd "$REPO_ROOT"
|
|
7
7
|
|
|
8
|
+
if [[ -d "$HOME/.local/bin" ]]; then
|
|
9
|
+
PATH="$HOME/.local/bin:$PATH"
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if [[ -d "/usr/local/bin" ]]; then
|
|
13
|
+
PATH="/usr/local/bin:$PATH"
|
|
14
|
+
fi
|
|
15
|
+
|
|
8
16
|
ACTION="install"
|
|
9
17
|
INSTALL_MODE="agent"
|
|
10
18
|
ENV_FILE=""
|
package/scripts/mcp-setup.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import { existsSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { createInterface } from 'node:readline';
|
|
5
|
-
import {
|
|
5
|
+
import { homedir } from 'node:os';
|
|
6
|
+
import { delimiter, resolve } from 'node:path';
|
|
6
7
|
import pkg from 'pg';
|
|
7
8
|
import { loadEnvFile } from '../src/config/env.js';
|
|
8
9
|
import {
|
|
@@ -52,9 +53,26 @@ function formatRemovalCommand(scope: ClaudeMcpScope): string {
|
|
|
52
53
|
return `claude mcp remove --scope ${scope} supermemory`;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
function createCommandEnv(): NodeJS.ProcessEnv {
|
|
57
|
+
const preferredPaths = [`${homedir()}/.local/bin`, '/usr/local/bin'];
|
|
58
|
+
const currentPath = process.env.PATH ?? '';
|
|
59
|
+
const mergedPath = [...preferredPaths, currentPath]
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.join(delimiter);
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
...process.env,
|
|
65
|
+
PATH: mergedPath,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
55
69
|
function commandExists(name: string): boolean {
|
|
56
70
|
try {
|
|
57
|
-
execSync(`command -v ${name}`, {
|
|
71
|
+
execSync(`command -v ${name}`, {
|
|
72
|
+
env: createCommandEnv(),
|
|
73
|
+
stdio: 'ignore',
|
|
74
|
+
shell: '/bin/zsh',
|
|
75
|
+
});
|
|
58
76
|
return true;
|
|
59
77
|
} catch {
|
|
60
78
|
return false;
|
|
@@ -162,7 +180,7 @@ async function run(): Promise<void> {
|
|
|
162
180
|
if (answer === '' || answer.toLowerCase() === 'y') {
|
|
163
181
|
console.log('Building...');
|
|
164
182
|
try {
|
|
165
|
-
execSync('npm run build', { stdio: 'inherit' });
|
|
183
|
+
execSync('npm run build', { env: createCommandEnv(), stdio: 'inherit' });
|
|
166
184
|
} catch {
|
|
167
185
|
console.error('Build failed. Fix errors and try again.');
|
|
168
186
|
process.exit(1);
|
|
@@ -238,7 +256,7 @@ async function run(): Promise<void> {
|
|
|
238
256
|
const removeCmd = formatRemovalCommand(selectedScope);
|
|
239
257
|
console.log(`[INFO] Existing ${selectedScope} scope registration does not match the current build output; repairing with: ${removeCmd} && ${cmd}`);
|
|
240
258
|
try {
|
|
241
|
-
execSync(removeCmd, { stdio: 'inherit', shell: '/bin/zsh' });
|
|
259
|
+
execSync(removeCmd, { env: createCommandEnv(), stdio: 'inherit', shell: '/bin/zsh' });
|
|
242
260
|
} catch (error) {
|
|
243
261
|
const msg = error instanceof Error ? error.message : String(error);
|
|
244
262
|
console.error(`\nCould not remove the existing ${selectedScope} scope registration: ${msg}`);
|
|
@@ -250,6 +268,7 @@ async function run(): Promise<void> {
|
|
|
250
268
|
|
|
251
269
|
try {
|
|
252
270
|
execSync(`claude mcp add supermemory --scope ${selectedScope} -- node ${JSON.stringify(entryPoint)}`, {
|
|
271
|
+
env: createCommandEnv(),
|
|
253
272
|
stdio: 'inherit',
|
|
254
273
|
shell: '/bin/zsh',
|
|
255
274
|
});
|
|
@@ -31,6 +31,25 @@ fi
|
|
|
31
31
|
# Database URL from environment or default
|
|
32
32
|
DATABASE_URL="${DATABASE_URL:-postgresql://supermemory:supermemory_secret@localhost:15432/supermemory}"
|
|
33
33
|
|
|
34
|
+
run_drizzle_migrations() {
|
|
35
|
+
print_info "Applying Drizzle schema migrations..."
|
|
36
|
+
|
|
37
|
+
if ! command -v npm >/dev/null 2>&1; then
|
|
38
|
+
print_error "npm is required to run Drizzle migrations"
|
|
39
|
+
return 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
if ! (cd "$PROJECT_ROOT" && npm run db:migrate > /dev/null 2>&1); then
|
|
43
|
+
print_error "Drizzle schema migration failed"
|
|
44
|
+
print_info "Run with verbose mode from the project root:"
|
|
45
|
+
print_info " npm run db:migrate"
|
|
46
|
+
return 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
print_success "Drizzle schema migration completed"
|
|
50
|
+
return 0
|
|
51
|
+
}
|
|
52
|
+
|
|
34
53
|
# Check if DATABASE_URL is set
|
|
35
54
|
if [ -z "$DATABASE_URL" ]; then
|
|
36
55
|
echo -e "${RED}Error: DATABASE_URL not set${NC}"
|
|
@@ -122,7 +141,6 @@ run_migration() {
|
|
|
122
141
|
run_all_migrations() {
|
|
123
142
|
local migrations=(
|
|
124
143
|
"001_create_pgvector_extension.sql"
|
|
125
|
-
"003_create_hnsw_index.sql"
|
|
126
144
|
)
|
|
127
145
|
|
|
128
146
|
print_info "Starting migration process..."
|
|
@@ -144,6 +162,35 @@ run_all_migrations() {
|
|
|
144
162
|
echo ""
|
|
145
163
|
done
|
|
146
164
|
|
|
165
|
+
if ! run_drizzle_migrations; then
|
|
166
|
+
print_error "Migration process aborted"
|
|
167
|
+
return 1
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
echo ""
|
|
171
|
+
|
|
172
|
+
local optional_migrations=(
|
|
173
|
+
"003_create_hnsw_index.sql"
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
for migration in "${optional_migrations[@]}"; do
|
|
177
|
+
local migration_path="$MIGRATIONS_DIR/$migration"
|
|
178
|
+
|
|
179
|
+
if [ ! -f "$migration_path" ]; then
|
|
180
|
+
print_warning "Optional migration file not found: $migration"
|
|
181
|
+
continue
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
if ! run_migration "$migration_path"; then
|
|
185
|
+
print_warning "Optional migration failed: $migration"
|
|
186
|
+
print_warning "Continuing because the core schema is already installed"
|
|
187
|
+
echo ""
|
|
188
|
+
continue
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
echo ""
|
|
192
|
+
done
|
|
193
|
+
|
|
147
194
|
print_success "All migrations completed successfully!"
|
|
148
195
|
return 0
|
|
149
196
|
}
|