@@ -43,10 +43,12 @@ mkdir -p "$INSTALL_DIR"
4343
4444# Copy all necessary files
4545cp -r " $CURRENT_DIR /src" " $INSTALL_DIR /" 2> /dev/null || true
46- cp -r " $CURRENT_DIR /attention-scoring" " $INSTALL_DIR /" 2> /dev/null || true
46+ cp -r " $CURRENT_DIR /scripts" " $INSTALL_DIR /" 2> /dev/null || true
47+ cp -r " $CURRENT_DIR /attention-scoring" " $INSTALL_DIR /" 2> /dev/null || true
4748cp -r " $CURRENT_DIR /p2p-sync" " $INSTALL_DIR /" 2> /dev/null || true
4849cp " $CURRENT_DIR /package.json" " $INSTALL_DIR /"
4950cp " $CURRENT_DIR /tsconfig.json" " $INSTALL_DIR /"
51+ cp " $CURRENT_DIR /esbuild.config.js" " $INSTALL_DIR /"
5052
5153# 2. Install dependencies
5254echo -e " ${GREEN} [2/5]${NC} Installing dependencies..."
@@ -90,7 +92,7 @@ for CONFIG_DIR in "$MCP_CONFIG_DIR" "$ALT_MCP_DIR"; do
9092
9193 config.mcpServers.stackmemory = {
9294 command: 'node',
93- args: ['$INSTALL_DIR /dist/src /mcp- server.js'],
95+ args: ['$INSTALL_DIR /dist/integrations /mcp/ server.js'],
9496 env: {
9597 STACKMEMORY_GLOBAL: 'true'
9698 }
@@ -106,7 +108,7 @@ for CONFIG_DIR in "$MCP_CONFIG_DIR" "$ALT_MCP_DIR"; do
106108 "mcpServers": {
107109 "stackmemory": {
108110 "command": "node",
109- "args": ["$INSTALL_DIR /dist/src /mcp- server.js"],
111+ "args": ["$INSTALL_DIR /dist/integrations /mcp/ server.js"],
110112 "env": {
111113 "STACKMEMORY_GLOBAL": "true"
112114 }
@@ -124,75 +126,25 @@ echo -e "${GREEN}[5/5]${NC} Creating global command..."
124126# Create bin directory if it doesn't exist
125127mkdir -p " $HOME /.local/bin"
126128
127- # Create the global stackmemory command
129+ # Create the global stackmemory command - delegates to the real CLI
128130cat > " $HOME /.local/bin/stackmemory" << 'EOF '
129131#!/usr/bin/env node
130132
131133const { spawn } = require('child_process');
132134const path = require('path');
133- const fs = require('fs');
134135const os = require('os');
135136
136137const installDir = path.join(os.homedir(), '.stackmemory');
137- const mcpServer = path.join(installDir, 'dist', 'src', 'mcp-server.js');
138-
139- // Check if we're in a git repo
140- function isGitRepo() {
141- try {
142- require('child_process').execSync('git rev-parse --git-dir', { stdio: 'ignore' });
143- return true;
144- } catch (e) {
145- return false;
146- }
147- }
138+ const cliPath = path.join(installDir, 'dist', 'cli', 'index.js');
148139
149- // Auto-initialize if in git repo
150- if (isGitRepo() && !fs.existsSync('.stackmemory')) {
151- console.log('🎯 Initializing StackMemory in this repository...');
152-
153- fs.mkdirSync('.stackmemory', { recursive: true });
154-
155- const config = {
156- projectId: path.basename(process.cwd()),
157- userId: process.env.USER || 'default',
158- initialized: new Date().toISOString()
159- };
160-
161- fs.writeFileSync('.stackmemory/config.json', JSON.stringify(config, null, 2));
162- fs.writeFileSync('.stackmemory/frames.jsonl', '');
163-
164- // Add to .gitignore
165- if (fs.existsSync('.gitignore')) {
166- const gitignore = fs.readFileSync('.gitignore', 'utf8');
167- if (!gitignore.includes('.stackmemory')) {
168- fs.appendFileSync('.gitignore', '\n# StackMemory\n.stackmemory/*.db\n.stackmemory/*.db-*\n');
169- }
170- }
171-
172- console.log('✅ StackMemory initialized!');
173- }
140+ // Pass all arguments to the real CLI
141+ const args = process.argv.slice(2);
142+ const child = spawn('node', [cliPath, ...args], {
143+ env: { ...process.env, PROJECT_ROOT: process.cwd() },
144+ stdio: 'inherit'
145+ });
174146
175- // Handle commands
176- const command = process.argv[2];
177-
178- switch(command) {
179- case 'init':
180- // Already handled above
181- break;
182- case 'status':
183- require(path.join(installDir, 'dist', 'scripts', 'status.js'));
184- break;
185- case 'test':
186- require(path.join(installDir, 'dist', 'test', 'test-framework.js'));
187- break;
188- default:
189- // Start MCP server
190- const child = spawn('node', [mcpServer], {
191- env: { ...process.env, PROJECT_ROOT: process.cwd() },
192- stdio: 'inherit'
193- });
194- child.on('exit', code => process.exit(code));
195- }
147+ child.on('exit', code => process.exit(code || 0));
196148EOF
197149
198150chmod +x " $HOME /.local/bin/stackmemory"
0 commit comments