ktg-plugin-marketplace/plugins/ms-ai-architect/tests/run-e2e.sh
Kjell Tore Guttormsen a7a334c8d1 feat(ms-ai-architect): v1.12.0 manuell KB-refresh — fjern launchd/cron-arkitektur
ToS-vurdering konkluderte med at autonom cron-kjøring er unødvendig kompleks
for en solo-fork-and-own-plugin. Apply-fasen krever LLM-resonnering uansett,
så manuell trigger fra en aktiv Claude Code-sesjon er enklere og holder
pluginen klart innenfor Anthropic Consumer Terms paragraf 3 (automated access
only via API key or where explicitly permitted — Claude Code CLI er
eksemptert som offisielt verktøy).

Lagt til:
- commands/kb-update.md — ny /architect:kb-update slash-kommando som driver
  poll, endringsrapport, microsoft_docs_fetch-update og commit fra sesjonen.
  Argumenter: --skip-discover, --priorities, --dry-run, --single-commit
- Catalog-entry i playground HTML for kb-update (categori: tool, 4 input-felt)

Slettet (Wave 3-5 reversert, ~1500 linjer + 7 testmoduler):
- scripts/install-kb-cron.mjs (cross-OS scheduler-installer)
- scripts/kb-update/weekly-kb-cron.mjs (cron-orkestrator med pre-flight, lock,
  backup, claude -p subprocess, post-run verify, rollback)
- scripts/kb-update/templates/ (4 scheduler-templates: launchd plist, systemd
  service+timer, Windows ps1 + README)
- scripts/kb-update/lib/auth-mode.mjs (cron-spesifikk auth validation)
- scripts/kb-update/lib/lock-file.mjs (PID+mtime stale-detection)
- scripts/kb-update/lib/cost-estimat.mjs (pre-flight budget-cap)
- 7 testmoduler under tests/kb-update/ for slettet kode
- tests/test-kb-update.sh (Bash-3.2-shim, erstattet av direkte node --test)

Beholdt (utility-laget fortsatt brukbart):
- run-weekly-update.mjs, report-changes.mjs, build-registry.mjs,
  discover-new-urls.mjs (KB change-detection-pipelinen)
- lib/atomic-write, lib/backup, lib/cross-platform-paths, lib/log-rotate
- 4 testmoduler (42/42 tester PASS)

Endret:
- hooks/scripts/session-start-context.mjs: fjern kb-update-status.json-overvaaking
- tests/run-e2e.sh --kb-update kaller node --test direkte i stedet for shim
- README.md, CLAUDE.md: KB-vedlikehold-seksjon rewriter for manuell modell
- plugin.json: 1.11.0 -> 1.12.0
- Rot README + CLAUDE.md: ms-ai-architect-versjon bumpet

Schedulering er bevisst utenfor scope og overlatt til brukeren — eventuelle
forks som vil ha periodisk varsling kan sette opp egen cron / launchd /
GitHub Actions som kjører rapport-fasen og varsler om aa kjore
/architect:kb-update i CC-sesjon.

Verifisering:
- bash tests/validate-plugin.sh: 219 PASS, 0 FAIL
- bash tests/run-e2e.sh --kb-update: 42/42 inner + suite PASS
- bash tests/run-e2e.sh --playground: 271/271 PASS (statisk + parsers)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 12:03:45 +02:00

100 lines
3 KiB
Bash
Executable file

#!/bin/bash
# run-e2e.sh — Run E2E regression tests for agent outputs
# Usage: bash tests/run-e2e.sh [--security] [--cost] [--summary] [--ros] [--ai-act] [--playground] [--kb-update] [--all]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
# Parse arguments
RUN_SECURITY=false
RUN_COST=false
RUN_SUMMARY=false
RUN_ROS=false
RUN_AI_ACT=false
RUN_PLAYGROUND=false
RUN_KB_UPDATE=false
if [ $# -eq 0 ] || [ "${1:-}" = "--all" ]; then
RUN_SECURITY=true
RUN_COST=true
RUN_SUMMARY=true
RUN_ROS=true
RUN_AI_ACT=true
RUN_PLAYGROUND=true
RUN_KB_UPDATE=true
else
while [ $# -gt 0 ]; do
case "$1" in
--security) RUN_SECURITY=true ;;
--cost) RUN_COST=true ;;
--summary) RUN_SUMMARY=true ;;
--ros) RUN_ROS=true ;;
--ai-act) RUN_AI_ACT=true ;;
--playground) RUN_PLAYGROUND=true ;;
--kb-update) RUN_KB_UPDATE=true ;;
*)
echo "Usage: bash tests/run-e2e.sh [--security] [--cost] [--summary] [--ros] [--ai-act] [--playground] [--kb-update] [--all]"
exit 1
;;
esac
shift
done
fi
echo -e "${CYAN}╔══════════════════════════════════════════════╗${NC}"
echo -e "${CYAN}║ MS AI Architect — E2E Regression Tests ║${NC}"
echo -e "${CYAN}╚══════════════════════════════════════════════╝${NC}"
echo ""
FAILURES=0
if $RUN_SECURITY; then
bash "$SCRIPT_DIR/test-security-output.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_COST; then
bash "$SCRIPT_DIR/test-cost-output.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_SUMMARY; then
bash "$SCRIPT_DIR/test-summary-output.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_ROS; then
bash "$SCRIPT_DIR/test-ros-output.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_AI_ACT; then
bash "$SCRIPT_DIR/test-ai-act-output.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_PLAYGROUND; then
bash "$SCRIPT_DIR/test-playground-v3.sh" || FAILURES=$((FAILURES + 1))
bash "$SCRIPT_DIR/test-playground-parsers.sh" || FAILURES=$((FAILURES + 1))
fi
if $RUN_KB_UPDATE; then
echo -e "${CYAN}─── KB Update utilities ───${NC}"
PLUGIN_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
if (cd "$PLUGIN_ROOT" && node --test tests/kb-update/*.test.mjs); then
echo -e "${GREEN}KB Update: PASS${NC}"
else
echo -e "${RED}KB Update: FAIL${NC}"
FAILURES=$((FAILURES + 1))
fi
fi
echo -e "${CYAN}══════════════════════════════════════════════${NC}"
if [ "$FAILURES" -eq 0 ]; then
echo -e "${GREEN} All E2E suites passed${NC}"
else
echo -e "${RED} $FAILURES suite(s) had failures${NC}"
fi
echo -e "${CYAN}══════════════════════════════════════════════${NC}"
exit $FAILURES