Skip to content

Commit c697175

Browse files
author
StackMemory Bot (CLI)
committed
fix(conductor): resolve claude-app-server.cjs path from package root
__dirname in ESM bundles points to dist/src/cli/commands/ which lacks the scripts/ directory. Use findPackageRoot() to walk up to package.json and resolve scripts/conductor/ from there. Also adds fallback candidates for repoRoot-relative resolution.
1 parent af56b6d commit c697175

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stackmemoryai/stackmemory",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "Project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, Claude/Codex/OpenCode wrappers, Linear sync, automatic hooks, and log analysis.",
55
"engines": {
66
"node": ">=20.0.0",

src/cli/commands/orchestrator.ts

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
import { spawn, execSync, type ChildProcess } from 'child_process';
1212
import { existsSync, mkdirSync, rmSync } from 'fs';
13-
import { join } from 'path';
13+
import { join, dirname } from 'path';
1414
import { tmpdir } from 'os';
15+
import { fileURLToPath } from 'url';
1516
import { logger } from '../../core/monitoring/logger.js';
1617
import {
1718
LinearClient,
@@ -84,6 +85,19 @@ export interface ConductorStats {
8485
}>;
8586
}
8687

88+
// ── Helpers ──
89+
90+
/** Find the package root by walking up from the current file. */
91+
function findPackageRoot(): string {
92+
const currentFile = fileURLToPath(import.meta.url);
93+
let dir = dirname(currentFile);
94+
for (let i = 0; i < 6; i++) {
95+
if (existsSync(join(dir, 'package.json'))) return dir;
96+
dir = dirname(dir);
97+
}
98+
return dirname(currentFile);
99+
}
100+
87101
// ── Default Config ──
88102

89103
const DEFAULT_CONFIG: ConductorConfig = {
@@ -97,10 +111,7 @@ const DEFAULT_CONFIG: ConductorConfig = {
97111
repoRoot: process.cwd(),
98112
baseBranch: 'main',
99113
appServerPath: join(
100-
__dirname,
101-
'..',
102-
'..',
103-
'..',
114+
findPackageRoot(),
104115
'scripts',
105116
'conductor',
106117
'claude-app-server.cjs'
@@ -146,17 +157,25 @@ export class Conductor {
146157
this.startedAt = Date.now();
147158
this.stopping = false;
148159

149-
// Resolve app-server path
160+
// Resolve app-server path — try multiple locations
150161
if (!existsSync(this.config.appServerPath)) {
151-
// Try resolving relative to the package
152-
const altPath = join(
153-
this.config.repoRoot,
154-
'scripts',
155-
'symphony',
156-
'claude-app-server.cjs'
157-
);
158-
if (existsSync(altPath)) {
159-
this.config.appServerPath = altPath;
162+
const candidates = [
163+
join(
164+
this.config.repoRoot,
165+
'scripts',
166+
'conductor',
167+
'claude-app-server.cjs'
168+
),
169+
join(
170+
this.config.repoRoot,
171+
'scripts',
172+
'symphony',
173+
'claude-app-server.cjs'
174+
),
175+
];
176+
const found = candidates.find((p) => existsSync(p));
177+
if (found) {
178+
this.config.appServerPath = found;
160179
} else {
161180
throw new Error(
162181
`claude-app-server.cjs not found at ${this.config.appServerPath}`

0 commit comments

Comments
 (0)