@mmmbuto/nexuscli 0.5.8 → 0.6.0

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.
@@ -58,6 +58,26 @@ class SessionManager {
58
58
  return true; // Always trust DB for exec-mode CLI sessions
59
59
  }
60
60
 
61
+ // For Claude: search ALL project folders (session might be in different workspace)
62
+ if (normalizedEngine === 'claude') {
63
+ try {
64
+ const projectsDir = SESSION_DIRS.claude;
65
+ if (fs.existsSync(projectsDir)) {
66
+ const dirs = fs.readdirSync(projectsDir);
67
+ for (const dir of dirs) {
68
+ const sessionFile = path.join(projectsDir, dir, `${sessionId}.jsonl`);
69
+ if (fs.existsSync(sessionFile)) {
70
+ console.log(`[SessionManager] Claude session found: ${sessionFile}`);
71
+ return true;
72
+ }
73
+ }
74
+ }
75
+ } catch (err) {
76
+ console.warn(`[SessionManager] Claude session lookup failed:`, err.message);
77
+ }
78
+ return false;
79
+ }
80
+
61
81
  try {
62
82
  const sessionPath = this.getSessionFilePath(sessionId, engine, workspacePath);
63
83
  if (!sessionPath) return false;
@@ -165,12 +185,13 @@ class SessionManager {
165
185
  }
166
186
 
167
187
  // 2. Check DB for existing session mapping
188
+ // Note: Frontend may send sessionId as conversationId, so check both columns
168
189
  try {
169
190
  const stmt = prepare(`
170
191
  SELECT id, workspace_path FROM sessions
171
- WHERE conversation_id = ? AND engine = ?
192
+ WHERE (conversation_id = ? OR id = ?) AND engine = ?
172
193
  `);
173
- const row = stmt.get(conversationId, normalizedEngine);
194
+ const row = stmt.get(conversationId, conversationId, normalizedEngine);
174
195
 
175
196
  if (row) {
176
197
  // 3. Verify session file exists on filesystem
@@ -396,7 +396,7 @@ class WorkspaceManager {
396
396
  * @returns {string}
397
397
  */
398
398
  getSessionPath(workspacePath) {
399
- // Convert /var/www/cli.wellanet.dev → -var-www-cli-wellanet-dev
399
+ // Convert /var/www/myapp → -var-www-myapp
400
400
  const projectDir = workspacePath.replace(/\//g, '-').replace(/^-/, '');
401
401
  return path.join(this.claudePath, 'projects', projectDir);
402
402
  }
@@ -45,7 +45,7 @@ describe('Performance Benchmarks', () => {
45
45
 
46
46
  test('Workspace validation should be fast', async () => {
47
47
  const manager = new WorkspaceManager();
48
- const testPath = '/var/www/cli.wellanet.dev';
48
+ const testPath = '/var/www/myapp';
49
49
 
50
50
  const start = Date.now();
51
51
  const validated = await manager.validateWorkspace(testPath);
@@ -16,7 +16,7 @@ describe('WorkspaceManager', () => {
16
16
 
17
17
  test('should validate workspace path', async () => {
18
18
  // Test with allowed path
19
- const validPath = '/var/www/cli.wellanet.dev';
19
+ const validPath = '/var/www/myapp';
20
20
  const result = await manager.validateWorkspace(validPath);
21
21
  expect(result).toBe(validPath);
22
22
  });
@@ -147,7 +147,7 @@ describe('SummaryGenerator', () => {
147
147
  describe('Integration - Service Interactions', () => {
148
148
  test('WorkspaceManager should use consistent path resolution', async () => {
149
149
  const manager = new WorkspaceManager();
150
- const testPath = '/var/www/cli.wellanet.dev';
150
+ const testPath = '/var/www/myapp';
151
151
  const validated = await manager.validateWorkspace(testPath);
152
152
  expect(validated).toBe(testPath);
153
153
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmmbuto/nexuscli",
3
- "version": "0.5.8",
3
+ "version": "0.6.0",
4
4
  "description": "NexusCLI - TRI CLI Control Plane (Claude/Codex/Gemini)",
5
5
  "main": "lib/server/server.js",
6
6
  "bin": {