test-devin-plugin.sh 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env bash
  2. # Validate the Devin CLI integration. `devin plugins install obra/superpowers`
  3. # reads `.devin-plugin/plugin.json` and auto-discovers the co-located `skills/`
  4. # directory; Devin CLI surfaces every installed skill's name + description in
  5. # the system prompt at session start and invokes them via its native `skill`
  6. # tool, so there is no hook or injector scaffold to test. What IS Devin-specific
  7. # is the manifest and the tool mapping — subagent dispatch via run_subagent
  8. # profiles and task tracking via todo_write — and SKILL.md pointing at it.
  9. #
  10. # Mirrors tests/kimi/test-plugin-manifest.sh (manifest) and
  11. # tests/antigravity/test-antigravity-tools.sh (mapping). CI-safe: does not
  12. # require `devin` installed.
  13. set -euo pipefail
  14. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  15. REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
  16. MANIFEST="$REPO_ROOT/.devin-plugin/plugin.json"
  17. MAPPING="$REPO_ROOT/skills/using-superpowers/references/devin-tools.md"
  18. SKILL="$REPO_ROOT/skills/using-superpowers/SKILL.md"
  19. fail() { echo "FAIL: $*" >&2; exit 1; }
  20. echo "test-devin-plugin: checking Devin CLI manifest and tool mapping"
  21. # --- Manifest is valid and matches the repo version -------------------------
  22. [ -f "$MANIFEST" ] || fail "manifest missing at $MANIFEST"
  23. python3 - "$MANIFEST" <<'PY'
  24. import json
  25. import sys
  26. from pathlib import Path
  27. manifest_path = Path(sys.argv[1])
  28. manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
  29. repo_root = manifest_path.parents[1]
  30. if manifest.get("name") != "superpowers":
  31. raise AssertionError(f"plugin name: expected 'superpowers', got {manifest.get('name')!r}")
  32. package = json.loads((repo_root / "package.json").read_text(encoding="utf-8"))
  33. if manifest.get("version") != package.get("version"):
  34. raise AssertionError(
  35. f"manifest version {manifest.get('version')!r} != package.json version {package.get('version')!r}"
  36. )
  37. # Devin CLI plugins carry skills only (auto-discovered from ./skills/); the
  38. # manifest supports metadata + dependency lists, nothing executable.
  39. unsupported = ["skills", "hooks", "commands", "sessionStart", "contextFileName", "inject"]
  40. present = sorted(field for field in unsupported if field in manifest)
  41. if present:
  42. raise AssertionError("unsupported Devin manifest fields present: " + ", ".join(present))
  43. version_config = json.loads((repo_root / ".version-bump.json").read_text(encoding="utf-8"))
  44. entries = version_config.get("files")
  45. if not isinstance(entries, list) or not any(
  46. entry.get("path") == ".devin-plugin/plugin.json" and entry.get("field") == "version"
  47. for entry in entries
  48. if isinstance(entry, dict)
  49. ):
  50. raise AssertionError(".version-bump.json must update .devin-plugin/plugin.json version")
  51. print("Devin plugin manifest looks good")
  52. PY
  53. # --- Mapping exists ----------------------------------------------------------
  54. [ -f "$MAPPING" ] || fail "tool mapping missing at $MAPPING"
  55. # --- Core action→tool mappings are documented --------------------------------
  56. for tool in skill run_subagent todo_write ask_user_question; do
  57. grep -q "$tool" "$MAPPING" \
  58. || fail "mapping does not document the '$tool' tool"
  59. done
  60. # --- Subagents use the built-in profiles --------------------------------------
  61. grep -q 'subagent_general' "$MAPPING" \
  62. || fail "mapping does not document the 'subagent_general' profile"
  63. grep -q 'subagent_explore' "$MAPPING" \
  64. || fail "mapping does not document the 'subagent_explore' profile"
  65. # --- SKILL.md Platform Adaptation links the mapping ---------------------------
  66. grep -q "devin-tools.md" "$SKILL" \
  67. || fail "SKILL.md Platform Adaptation does not reference devin-tools.md"
  68. echo "PASS: Devin CLI plugin valid (manifest, tool mapping, SKILL.md link)"