* fix(ruflo-adr): find ADRs on Windows and report POSIX paths (#2413)
findAdrs matched literal /docs/adr/ substrings, so join()'s backslashes on Windows silently produced 0 ADRs. Match either separator and report the file field relative to the scan root with forward slashes so bySource and stored records are stable across platforms.
* fix(ruflo-adr): spawn npm npx-cli.js on Windows (#2413)
spawnSync cannot launch npx.cmd without a shell, so the no-installed-CLI fallback returned ENOENT and every store failed on Windows. Resolve npm's npx-cli.js (npm_execpath, PATH shims, or Node's bundled npm) and run it with process.execPath so argv stays shell-safe.
---------
Co-authored-by: rUv <ruv@ruv.net>
A plugin installed from the Claude Code marketplace is copied on its own to
~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/, with no CLI next
to it. ruflo-cost-tracker and ruflo-adr always spawned
`npx -y @claude-flow/cli@latest` for their memory/hooks calls, and #3366's
resolveRufloCli() in ruflo-metaharness only looks for the CLI that ships the
plugin or a repo checkout, so all three fell back to npx @latest there. For
cost-tracker that is every turn (its Stop hook): a registry round trip per
call, and a different CLI than the one the user installed, including a
release published minutes earlier. Each such run also refreshes
~/.claude/helpers ahead of the installed CLI.
All three plugins now resolve the CLI in the same order:
1. CLI_CORE=1: unchanged (npx @claude-flow/cli-core@alpha, ADR-100); adr
still ignores it (#2781).
2. The CLI that ships the plugin, or a repo checkout, with #3366's guards
(package.json named @claude-flow/cli + bin/cli.js + dist/src/index.js).
3. New: `ruflo`, then `claude-flow`, on PATH. fs-only probe (X_OK + isFile),
shell: false; relative and empty PATH entries are skipped; on win32 an npm
`.cmd` shim is mapped to its package's bin entry and run with node, and
anything unmappable is skipped, never run through cmd.exe.
4. The unchanged npx @latest fallback.
- ruflo-cost-tracker: new scripts/_ruflo-cli.mjs; spawnNpxSync() in _npx.mjs
sends `@claude-flow/cli@latest` to the resolved CLI (signature unchanged,
no call-site edits).
- ruflo-adr: new scripts/lib/ruflo-cli.mjs; import.mjs, reindex.mjs and
verify.mjs use it (verify too, so reader and writers share a store, #2781).
- ruflo-metaharness: step 3 added to resolveRufloCli() in _invoke.mjs.
- Test seams RUFLO_PLUGIN_SKIP_LOCAL_CLI=1 / RUFLO_PLUGIN_SKIP_PATH_CLI=1
(same style as RUFLO_METAHARNESS_SKIP_LOCAL). The existing npx-stub tests
(import-root-exit-3097, verify-read-safety-3147, test-no-tool-time-npx)
set them; without that they fail on any machine with ruflo on PATH.
- New regression tests for each plugin, run in a marketplace-style plugin
cache with fake ruflo/claude-flow/npx on PATH: fail on 49da6ecc4
(cost-tracker 5/12, adr 2/6, metaharness 5/8), pass with the fix (14/14,
6/6, 8/8). Wired into v3-ci.yml and metaharness-ci.yml.
Co-Authored-By: ruflo <ruv@ruv.net>
edgeKey() joined the endpoints with '->', and '>' is in the CLI's
DANGEROUS_KEY_PATTERN, so every adr-edges store failed with "Key contains
disallowed characters". Join with '__' instead; parseEdgeKey() still reads
the earlier '->' keys so existing rows stay verifiable.
* fix(ruflo-adr): skip .brain when walking for ADRs (#2911)
ruvnet-brain clones ~50 external repos under .brain/repo/clones/,
many carrying their own docs/adr/. Without .brain in SKIP_DIRS,
findAdrs() picked up hundreds of foreign ADRs alongside the
project's own — and since .brain sorts before docs, the project's
ADRs landed dead last in the walk order.
Co-Authored-By: RuFlo <ruv@ruv.net>
* fix(ruflo-adr): smoke step 22 should not hard-code the test-file count
Was `-eq 3`, breaking every time a new *.test.mjs file is added to
__tests__/ even when the new tests themselves pass. `-ge 3` keeps the
"regression tests exist and run" guarantee without re-breaking on
growth — caught by this PR's own new test file (skip-brain-dir-2911).
Co-Authored-By: RuFlo <ruv@ruv.net>