mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 06:36:49 +09:00
Merge pull request #2074 from Observator01/fix/cost-tracker-windows-spawn
fix(cost-tracker): spawnSync npx ENOENT on Windows
This commit is contained in:
7 files changed
+15
-15
No files matched your search
@@ -36,7 +36,7 @@ function memoryStore(key, value) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'store',
|
||||
'--namespace', NS, '--key', stamped, '--value', JSON.stringify(value),
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) throw new Error(`memory store failed: ${r.stderr?.slice(0, 200) || r.status}`);
|
||||
// The "current pointer" is found at retrieval time by listing all
|
||||
// budget-config-* keys and picking the lexicographically-largest
|
||||
@@ -46,7 +46,7 @@ function memoryStore(key, value) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'store',
|
||||
'--namespace', NS, '--key', key, '--value', JSON.stringify(value),
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) throw new Error(`memory store failed: ${r.stderr?.slice(0, 200) || r.status}`);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ function memoryRetrieveOne(key) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'retrieve',
|
||||
'--namespace', NS, '--key', key,
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return null;
|
||||
const m = /\{[\s\S]*\}/.exec(r.stdout || '');
|
||||
if (!m) return null;
|
||||
@@ -67,7 +67,7 @@ function memoryRetrieve(key) {
|
||||
const list = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', NS, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (list.status !== 0) return null;
|
||||
const m = /\[[\s\S]*\]/.exec(list.stdout || '');
|
||||
if (!m) return null;
|
||||
@@ -92,7 +92,7 @@ function memoryListSessionRecords() {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', NS, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return [];
|
||||
// CLI may emit a small banner before the JSON array; extract the first '['..']' block.
|
||||
const m = /\[[\s\S]*\]/.exec(r.stdout || '');
|
||||
|
||||
@@ -23,7 +23,7 @@ function memoryListSessionKeys() {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', NS, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return [];
|
||||
const m = /\[[\s\S]*\]/.exec(r.stdout || '');
|
||||
if (!m) return [];
|
||||
@@ -38,7 +38,7 @@ function memoryRetrieve(key) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'retrieve',
|
||||
'--namespace', NS, '--key', key,
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return null;
|
||||
const m = /\{[\s\S]*\}/.exec(r.stdout || '');
|
||||
if (!m) return null;
|
||||
|
||||
@@ -28,7 +28,7 @@ function memoryListKeys() {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', NS, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return [];
|
||||
const m = /\[[\s\S]*\]/.exec(r.stdout || '');
|
||||
if (!m) return [];
|
||||
@@ -38,7 +38,7 @@ function memoryRetrieve(key) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'retrieve',
|
||||
'--namespace', NS, '--key', key,
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return null;
|
||||
const m = /\{[\s\S]*\}/.exec(r.stdout || '');
|
||||
if (!m) return null;
|
||||
|
||||
@@ -31,7 +31,7 @@ function memoryList() {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', NS, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return [];
|
||||
const m = /\[[\s\S]*\]/.exec(r.stdout || '');
|
||||
if (!m) return [];
|
||||
@@ -41,7 +41,7 @@ function memoryRetrieve(key) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'retrieve',
|
||||
'--namespace', NS, '--key', key,
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return null;
|
||||
const m = /\{[\s\S]*\}/.exec(r.stdout || '');
|
||||
if (!m) return null;
|
||||
|
||||
@@ -33,7 +33,7 @@ function main() {
|
||||
const r = spawnSync('npx', [
|
||||
'@claude-flow/cli@latest', 'hooks', 'model-outcome',
|
||||
'-t', task, '-m', model, '-o', outcome,
|
||||
], { stdio: 'inherit' });
|
||||
], { stdio: 'inherit', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) {
|
||||
console.error(`emit failed (exit ${r.status})`);
|
||||
process.exit(r.status || 1);
|
||||
|
||||
@@ -36,7 +36,7 @@ function memoryListKeys(ns) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'list',
|
||||
'--namespace', ns, '--format', 'json',
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return [];
|
||||
const m = /\[[\s\S]*\]/.exec(r.stdout || '');
|
||||
if (!m) return [];
|
||||
@@ -46,7 +46,7 @@ function memoryRetrieve(ns, key) {
|
||||
const r = spawnSync('npx', [
|
||||
CLI_PKG, 'memory', 'retrieve',
|
||||
'--namespace', ns, '--key', key,
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) return null;
|
||||
const m = /\{[\s\S]*\}/.exec(r.stdout || '');
|
||||
if (!m) return null;
|
||||
|
||||
@@ -132,7 +132,7 @@ function persistToMemory(summary) {
|
||||
'--namespace', ns,
|
||||
'--key', key,
|
||||
'--value', JSON.stringify(summary),
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8' });
|
||||
], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
|
||||
if (r.status !== 0) {
|
||||
return { ok: false, reason: r.stderr?.slice(0, 300) || `exit ${r.status}` };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user