mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-25 06:36:49 +09:00
- The docked pane no longer goes compact. Compact was meant for an inline pane too short for its view, but it also fired on the dock, so the taller pages (Swarm, Claims, Plugins, Learning, Terminal, x.ruv.io) lost the banner and their block title while the shorter ones kept them. The dock scrolls, so it now always draws the full frame. Even a compact inline pane keeps each page's title and description line. - The Main Menu is back to the banner and the RUFLO BBS title, and the neon sign is the boot's alone. Rows go back to 32. - The terminal's field takes the keys when the view opens and after a harness pick ($.ui.focus), so typing reaches it instead of firing pane hotkeys (w, s, c…). Verified live: "where is the swarm" landed in the field. Co-Authored-By: RuFlo <ruv@ruv.net>
79 lines
4.5 KiB
Bash
Executable File
79 lines
4.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Structural + security smoke for ruflo-console. Static checks first (CI has no Claude Code), then the pure vitest
|
|
# specs. The hooks module's behaviour is held by `claude plugin test plugins/ruflo-console` where function hooks are on.
|
|
set -u
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
REPO="$(cd "$ROOT/../.." && pwd)"
|
|
HOOKS="$ROOT/hooks"
|
|
PASS=0
|
|
FAIL=0
|
|
step() { printf "→ %s ... " "$1"; }
|
|
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
|
|
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
|
|
|
|
step "1. plugin.json declares ruflo-console 0.6.2"
|
|
grep -q '"name": "ruflo-console"' "$ROOT/.claude-plugin/plugin.json" \
|
|
&& grep -q '"version": "0.6.2"' "$ROOT/.claude-plugin/plugin.json" && ok || bad "name/version"
|
|
|
|
step "2. hooks.json names exactly one module and no classic hook commands"
|
|
grep -q '"modules": \["./register.ts"\]' "$HOOKS/hooks.json" && ! grep -q '"command"' "$HOOKS/hooks.json" \
|
|
&& ok || bad "hooks.json must be modules-only"
|
|
|
|
step "3. no Node, Buffer or dynamic import in the module"
|
|
hits=$(grep -rnE "from ['\"]node:|\bBuffer\b|\bimport\(|require\(" "$HOOKS" || true)
|
|
[[ -z "$hits" ]] && ok || bad "$hits"
|
|
|
|
step "4. no import reaches outside the plugin folder"
|
|
deep=$(grep -rnE "from ['\"](\.\./){3,}" "$HOOKS" || true)
|
|
[[ -z "$deep" ]] && ok || bad "$deep"
|
|
|
|
step "5. no network call from the module (\$.http) and \$ is touched in register.ts only"
|
|
http=$(grep -rnE '\$\.http\.' "$HOOKS" || true)
|
|
# Code lines only: comments may name the calls they explain.
|
|
outside=$(grep -rnE '\$\.(fs|process|ui|clock|store|env|ruflo|tool|session|settings|command)\.' "$HOOKS" | grep -vE '^[^:]+:[0-9]+:\s*(\*|//|/\*)' | grep -v '/register.ts:' || true)
|
|
[[ -z "$http" && -z "$outside" ]] && ok || bad "http: $http outside: $outside"
|
|
|
|
step "6. never runs plugins list or verify (network); roster and registry are the two network probes, both opt-in"
|
|
cmds=$(grep -nE "args: \['(plugins|verify)'" "$HOOKS/data/cli.ts" || true)
|
|
net=$(grep -c "isNetwork: true" "$HOOKS/data/cli.ts")
|
|
[[ -z "$cmds" && "$net" == "2" ]] && grep -q "federationNetwork" "$HOOKS/controller.ts" && ok || bad "cmds: $cmds network probes: $net"
|
|
|
|
step "7. private key files are never read paths"
|
|
# The federation folder is listed for its file names (node ids); a key file's path never reaches fs.read.
|
|
keys=$(grep -nE "(key-[^'\"]*\.json|channels\.json|nostr\.key)" "$HOOKS/data/files.ts" | grep -vE "^\s*[0-9]+:\s*(\*|//)|NOSTR_KEY = |test\(entry\.name\)" || true)
|
|
grep -q "fs.stat(under(home, NOSTR_KEY))" "$HOOKS/data/files.ts" && [[ -z "$keys" ]] && ok || bad "$keys"
|
|
|
|
step "8. mutations only through fixed argv (claims_* via JSON.stringify), behind a confirm"
|
|
grep -q "JSON.stringify(params)" "$HOOKS/actions.ts" \
|
|
&& [[ "$(grep -ohE "exec\('claims_[a-z-]+'" "$HOOKS/actions.ts" "$HOOKS/ops.ts" | sort -u | tr '\n' ' ')" == "exec('claims_claim' exec('claims_handoff' exec('claims_release' exec('claims_status' exec('claims_steal' " ]] \
|
|
&& grep -q "state.pending = " "$HOOKS/runner.ts" && ! grep -qE "'(sh|bash)', '-c'" -r "$HOOKS" && ok || bad "action surface changed"
|
|
|
|
step "9. plugin.register and tool.call are observed, never answered"
|
|
reg=$(awk '/on\(.plugin.register./,/^ }\)/' "$HOOKS/register.ts" | grep -cE "refuse:|deny:")
|
|
tool=$(awk '/on\(.tool.call./,/^ }\)/' "$HOOKS/register.ts" | grep -cE "deny|result:")
|
|
[[ "$reg" == "0" && "$tool" == "0" ]] && ok || bad "plugin.register answers: $reg tool.call answers: $tool"
|
|
|
|
step "10. no secrets or credentials in the module"
|
|
sec=$(grep -rniE "(api[_-]?key|secret|password|token)\s*[:=]\s*['\"][^'\"]{8,}" "$HOOKS" || true)
|
|
[[ -z "$sec" ]] && ok || bad "$sec"
|
|
|
|
step "11. every source file is under 500 lines"
|
|
long=$(find "$HOOKS" "$ROOT/tests" "$ROOT/scripts" -name '*.ts' -not -path '*/fixtures/ruflo-run.ts' -exec awk 'END { if (NR > 500) print FILENAME }' {} \;)
|
|
[[ -z "$long" ]] && ok || bad "$long"
|
|
|
|
step "12. kit tests are in the CI baseline (root vitest cannot resolve claude-code/testing)"
|
|
miss=""
|
|
for f in "$ROOT"/tests/*.test.ts; do
|
|
grep -qx "plugins/ruflo-console/tests/$(basename "$f")" "$REPO/scripts/ci-test-baseline.txt" || miss="$miss $(basename "$f")"
|
|
done
|
|
[[ -z "$miss" ]] && ok || bad "not in baseline:$miss"
|
|
|
|
step "13. marketplace lists ruflo-console"
|
|
grep -q '"name": "ruflo-console"' "$REPO/.claude-plugin/marketplace.json" && ok || bad "missing marketplace entry"
|
|
|
|
step "14. pure specs pass under vitest"
|
|
if (cd "$REPO" && npx vitest run plugins/ruflo-console/tests/pure.spec.ts plugins/ruflo-console/tests/vendored-types.spec.ts >/dev/null 2>&1); then ok; else bad "vitest specs failed"; fi
|
|
|
|
printf "\n%d passed, %d failed\n" "$PASS" "$FAIL"
|
|
[[ $FAIL -eq 0 ]]
|