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

feat(ruflo-testgen): v0.2.0 β€” adopt plugin contract + SPARC Refinement-phase ownership (ADR-0001)

Reuvenf457b3918535
diff --git a/plugins/ruflo-testgen/.claude-plugin/plugin.json b/plugins/ruflo-testgen/.claude-plugin/plugin.json
index 3f58bb9de9..9e0b95666c 100644
--- a/plugins/ruflo-testgen/.claude-plugin/plugin.json
+++ b/plugins/ruflo-testgen/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-testgen",
- "description": "Test gap detection, coverage analysis, and automated test generation",
- "version": "0.1.0",
+ "description": "Test gap detection, coverage analysis, and automated test generation β€” drives the testgaps background worker via hooks_worker-dispatch; SPARC Refinement-phase canonical owner",
+ "version": "0.2.0",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
@@ -13,6 +13,9 @@
"testing",
"tdd",
"coverage",
- "test-generation"
+ "test-generation",
+ "mcp",
+ "tdd-london-school",
+ "coverage-routing"
]
}
diff --git a/plugins/ruflo-testgen/README.md b/plugins/ruflo-testgen/README.md
index a9c45364be..b596c25ecf 100644
--- a/plugins/ruflo-testgen/README.md
+++ b/plugins/ruflo-testgen/README.md
@@ -1,6 +1,6 @@
# ruflo-testgen
-Test gap detection, coverage analysis, and automated test generation.
+Test gap detection, coverage analysis, and automated test generation. SPARC Refinement-phase canonical owner.
## Install
@@ -21,3 +21,54 @@ Test gap detection, coverage analysis, and automated test generation.
## Requires
- `ruflo-core` plugin (provides MCP server)
+
+## Compatibility
+
+- **CLI:** pinned to `@claude-flow/cli` v3.6 major+minor.
+- **Verification:** `bash plugins/ruflo-testgen/scripts/smoke.sh` is the contract.
+
+## testgaps worker + coverage CLI surface
+
+This plugin's two MCP/CLI surfaces:
+
+| Surface | Invocation |
+|---------|-----------|
+| **MCP**: dispatch the `testgaps` worker | `mcp tool call hooks_worker-dispatch --json -- '{"trigger":"testgaps"}'` |
+| **CLI**: `coverage-gaps` (table of gaps) | `npx @claude-flow/cli@latest hooks coverage-gaps --format table --limit 20` |
+| **CLI**: `coverage-route` (route a task by gap) | `npx @claude-flow/cli@latest hooks coverage-route --task "add auth tests"` |
+| **CLI**: `coverage-suggest` (suggest tests for a path) | `npx @claude-flow/cli@latest hooks coverage-suggest --path src/` |
+
+`testgaps` is one of 12 background workers documented in [ruflo-loop-workers ADR-0001](../ruflo-loop-workers/docs/adrs/0001-loop-workers-contract.md).
+
+## SPARC Refinement-phase ownership
+
+This plugin owns the **Refinement** phase per [ruflo-sparc ADR-0001](../ruflo-sparc/docs/adrs/0001-sparc-contract.md) Β§"Phase-to-plugin alignment". When SPARC's `sparc-refine` skill runs, it composes:
+
+1. **This plugin** β€” coverage gap detection + TDD test generation
+2. [ruflo-jujutsu](../ruflo-jujutsu/docs/adrs/0001-jujutsu-contract.md) β€” diff-aware refactor recommendations
+
+Together they enforce the Refinement gate: β‰₯80% coverage on new code + diff risk score below threshold.
+
+## Namespace coordination
+
+This plugin owns the `test-gaps` AgentDB namespace (kebab-case, follows the convention from [ruflo-agentdb ADR-0001 Β§"Namespace convention"](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md)). Reserved namespaces (`pattern`, `claude-memories`, `default`) MUST NOT be shadowed.
+
+`test-gaps` indexes detected gaps by file + priority + last-seen timestamp. Accessed via `memory_*` (namespace-routed).
+
+## Verification
+
+```bash
+bash plugins/ruflo-testgen/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Architecture Decisions
+
+- [`ADR-0001` β€” ruflo-testgen plugin contract (testgaps-worker contract, SPARC Refinement ownership, smoke as contract)](./docs/adrs/0001-testgen-contract.md)
+
+## Related Plugins
+
+- `ruflo-loop-workers` β€” defines the `testgaps` background worker
+- `ruflo-sparc` β€” Refinement-phase canonical handoff
+- `ruflo-jujutsu` β€” diff-aware refactor companion in the Refinement gate
+- `ruflo-agentdb` β€” namespace convention owner
diff --git a/plugins/ruflo-testgen/docs/adrs/0001-testgen-contract.md b/plugins/ruflo-testgen/docs/adrs/0001-testgen-contract.md
new file mode 100644
index 0000000000..e94c1bd19b
--- /dev/null
+++ b/plugins/ruflo-testgen/docs/adrs/0001-testgen-contract.md
@@ -0,0 +1,44 @@
+---
+id: ADR-0001
+title: ruflo-testgen plugin contract β€” pinning, namespace coordination, testgaps-worker contract, smoke as contract
+status: Proposed
+date: 2026-05-04
+authors:
+ - reviewer (Claude Code)
+tags: [plugin, testgen, tdd, coverage, namespace, smoke-test]
+---
+
+## Context
+
+`ruflo-testgen` (v0.1.0) β€” test gap detection + TDD London School workflow + automated test generation. 1 agent (`tester`), 2 skills (`tdd-workflow`, `test-gaps`), 1 command (`/testgen`).
+
+Drives the `testgaps` background worker (one of 12 documented in [ruflo-loop-workers ADR-0001](../../ruflo-loop-workers/docs/adrs/0001-loop-workers-contract.md)) via `hooks_worker-dispatch`. Also uses three coverage CLI commands: `hooks coverage-gaps`, `hooks coverage-route`, `hooks coverage-suggest`.
+
+This plugin is the canonical owner of the **Refinement phase** in the SPARC methodology per [ruflo-sparc ADR-0001](../../ruflo-sparc/docs/adrs/0001-sparc-contract.md) Β§"Phase-to-plugin alignment".
+
+## Decision
+
+1. Add this ADR (Proposed).
+2. README augment: Compatibility (pin v3.6); testgaps worker + coverage CLI command surface; SPARC Refinement phase ownership cross-reference; Namespace coordination (claims `test-gaps`); Verification + Architecture Decisions sections.
+3. Bump `0.1.0 β†’ 0.2.0`. Keywords add `mcp`, `tdd-london-school`, `coverage-routing`.
+4. `scripts/smoke.sh` β€” 10 structural checks: version + keywords; both skills + agent + command with valid frontmatter; `hooks_worker-dispatch` referenced; `testgaps` trigger documented; coverage CLI commands referenced; v3.6 pin; namespace coordination; SPARC Refinement cross-reference; ADR Proposed; no wildcard tools.
+
+## Consequences
+
+**Positive:** plugin joins the cadence. testgaps-worker consumer relationship is now contractually documented; SPARC Refinement-phase ownership is cross-linked.
+
+**Negative:** none material.
+
+## Verification
+
+```bash
+bash plugins/ruflo-testgen/scripts/smoke.sh
+# Expected: "10 passed, 0 failed"
+```
+
+## Related
+
+- `plugins/ruflo-loop-workers/docs/adrs/0001-loop-workers-contract.md` β€” defines the `testgaps` worker
+- `plugins/ruflo-sparc/docs/adrs/0001-sparc-contract.md` β€” Refinement phase ownership
+- `plugins/ruflo-jujutsu/docs/adrs/0001-jujutsu-contract.md` β€” diff analysis for PR-time coverage gating
+- `plugins/ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md` β€” namespace convention
diff --git a/plugins/ruflo-testgen/scripts/smoke.sh b/plugins/ruflo-testgen/scripts/smoke.sh
new file mode 100755
index 0000000000..898a99e029
--- /dev/null
+++ b/plugins/ruflo-testgen/scripts/smoke.sh
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+set -u
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+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 0.2.0 with new keywords"
+v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
+if [[ "$v" != "0.2.0" ]]; then bad "expected 0.2.0, got '$v'"; else
+ miss=""
+ for k in mcp tdd-london-school coverage-routing; do
+ grep -q "\"$k\"" "$ROOT/.claude-plugin/plugin.json" || miss="$miss $k"
+ done
+ [[ -z "$miss" ]] && ok || bad "missing keywords:$miss"
+fi
+
+step "2. both skills + agent + command present with valid frontmatter"
+miss=""
+for s in tdd-workflow test-gaps; do
+ f="$ROOT/skills/$s/SKILL.md"
+ [[ -f "$f" ]] || { miss="$miss missing-$s"; continue; }
+ for k in 'name:' 'description:' 'allowed-tools:'; do
+ grep -q "^$k" "$f" || miss="$miss $s-no-$k"
+ done
+done
+[[ -f "$ROOT/agents/tester.md" ]] || miss="$miss missing-agent"
+[[ -f "$ROOT/commands/testgen.md" ]] || miss="$miss missing-command"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "3. hooks_worker-dispatch + testgaps trigger documented"
+miss=""
+grep -rq "hooks_worker-dispatch" "$ROOT" --include='*.md' || miss="$miss dispatch-tool"
+grep -rq "testgaps" "$ROOT" --include='*.md' || miss="$miss testgaps-trigger"
+[[ -z "$miss" ]] && ok || bad "$miss"
+
+step "4. all 3 coverage CLI commands referenced"
+F="$ROOT/README.md"
+miss=""
+for cmd in coverage-gaps coverage-route coverage-suggest; do
+ grep -q "$cmd" "$F" || miss="$miss $cmd"
+done
+[[ -z "$miss" ]] && ok || bad "missing CLI commands:$miss"
+
+step "5. README pins @claude-flow/cli to v3.6"
+grep -qE "@claude-flow/cli.*v3\.6|v3\.6.*claude-flow/cli" "$ROOT/README.md" \
+ && ok || bad "v3.6 pin missing"
+
+step "6. README defers to ruflo-agentdb namespace convention"
+grep -q "ruflo-agentdb" "$ROOT/README.md" \
+ && grep -q "Namespace convention" "$ROOT/README.md" \
+ && ok || bad "namespace coordination block incomplete"
+
+step "7. test-gaps namespace claimed"
+grep -q "test-gaps" "$ROOT/README.md" \
+ && ok || bad "test-gaps namespace not claimed"
+
+step "8. SPARC Refinement-phase ownership cross-reference"
+F="$ROOT/README.md"
+grep -q "ruflo-sparc" "$F" \
+ && grep -qE "Refinement|refinement phase" "$F" \
+ && ok || bad "SPARC Refinement-phase cross-reference missing"
+
+step "9. ADR-0001 exists with status Proposed"
+ADR="$ROOT/docs/adrs/0001-testgen-contract.md"
+[[ -f "$ADR" ]] && grep -qE "^status:[[:space:]]*Proposed" "$ADR" \
+ && ok || bad "ADR missing or status != Proposed"
+
+step "10. no wildcard tool grants in skills"
+bad_skills=""
+for f in "$ROOT"/skills/*/SKILL.md; do
+ grep -q '^allowed-tools:[[:space:]]*\*' "$f" && bad_skills="$bad_skills $(basename $(dirname "$f"))"
+done
+[[ -z "$bad_skills" ]] && ok || bad "wildcard:$bad_skills"
+
+printf "\n%s passed, %s failed\n" "$PASS" "$FAIL"
+[[ $FAIL -eq 0 ]] || exit 1