Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(scripts): run tool guard through symlinked paths

Rudy Celekli2c23959367c4
diff --git a/scripts/check-guard-tool-names.mjs b/scripts/check-guard-tool-names.mjs
index d20819e02b..7f33af7957 100644
--- a/scripts/check-guard-tool-names.mjs
+++ b/scripts/check-guard-tool-names.mjs
@@ -13,7 +13,7 @@
//
// Exit: 0 clean · 1 unmatched watched names · 3 nothing extracted / empty registry (fail loud).
-import { existsSync, readFileSync, readdirSync } from 'node:fs';
+import { existsSync, readFileSync, readdirSync, realpathSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -115,4 +115,6 @@ function main() {
process.exit(r.unmatched.length ? 1 : 0);
}
-if (process.argv[1] === fileURLToPath(import.meta.url)) main();
+// Node canonicalizes the module URL, while argv can retain a symlinked path
+// (including macOS /var -> /private/var). Do not silently skip CLI checks.
+if (process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) main();
diff --git a/tests/check-guard-tool-names.test.mjs b/tests/check-guard-tool-names.test.mjs
index 0fa7a91241..c42da84f1b 100644
--- a/tests/check-guard-tool-names.test.mjs
+++ b/tests/check-guard-tool-names.test.mjs
@@ -1,7 +1,7 @@
// node --test tests/check-guard-tool-names.test.mjs
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
-import { cpSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { cpSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { test } from 'node:test';
@@ -69,12 +69,15 @@ test('gather skips test files, reads plugin server names, and merges the allowli
}
});
-function runIn(files) {
+function runIn(files, useSymlink = false) {
const root = fixture(files);
mkdirSync(join(root, 'scripts'), { recursive: true });
cpSync(SCRIPT, join(root, 'scripts/check-guard-tool-names.mjs'));
try {
- return spawnSync(process.execPath, [join(root, 'scripts/check-guard-tool-names.mjs')], { encoding: 'utf8' });
+ const entry = join(root, 'scripts/check-guard-tool-names.mjs');
+ const alias = join(root, 'scripts/check-guard-alias.mjs');
+ if (useSymlink) symlinkSync(entry, alias);
+ return spawnSync(process.execPath, [useSymlink ? alias : entry], { encoding: 'utf8' });
} finally {
rmSync(root, { recursive: true, force: true });
}
@@ -104,3 +107,9 @@ test('the real repo passes', () => {
const r = spawnSync(process.execPath, [SCRIPT], { encoding: 'utf8' });
assert.equal(r.status, 0, r.stderr);
});
+
+test("symlinked CLI entry still rejects renamed tools", () => {
+ const result = runIn({ "plugins/p/hooks/guard.ts": "['memory_missing']", "v3/@claude-flow/cli/src/mcp-tools/a.ts": "{name: 'memory_store'}" }, true);
+ assert.equal(result.status, 1);
+ assert.match(result.stderr, /UNMATCHED memory_missing/);
+});