## Summary Adds a bundled **Quality** plugin (`fusion-plugin-quality`) that makes task QA easier and more visual: - **Task QA tab** (action-first): preview/test server for the task worktree, allowlisted test runs, report viewer, screenshots CTA, suggested test cases, CI handoff - **Quality hub** (left sidebar): project-wide run history and preset launches - Host **task-detail slot context** (`taskId`, worktree, `projectId`) so plugin tabs can scope correctly - `superviseSpawn` re-exported on the plugin packaging shim for published plugins - Plan: `docs/plans/2026-07-14-001-feat-quality-plugin-plan.md` ## Design constraints - Does **not** replace the merge gate — advisory orchestration only - Composes Dev Server process patterns and artifact registry (no second browser stack) - Never free-form shell; never port 4040 - Full-suite requires explicit confirm ## Test plan - [x] `pnpm --filter @fusion-plugin-examples/quality test` (15 tests) - [x] PluginSlot unit tests still pass - [ ] Enable Quality plugin in dashboard Settings → Built-in Plugins - [ ] Open Task Detail → **QA** tab with a worktree; start preview, run verify:fast, generate suggestions - [ ] Open left sidebar **Quality** hub and list runs - [ ] Confirm merge gate / PR checks unchanged ## Residual / follow-up (same plan, later units) - Deeper hub CI (host route) - Full browser-verification toggle UX + agent QA sessions (U7/U9/U10) - Richer screenshots gallery wiring to live artifacts API - Test plans CRUD polish <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added the Quality plugin with a project Quality hub and task-focused QA tab. * Added test runs, reports, preview server controls, suggested test cases, and run history. * Added configurable test presets, cancellation, status tracking, and safe command execution. * Added experimental-feature controls for enabling Quality functionality. * Bundled Quality with the CLI and made it available through the plugin manager. * **Documentation** * Added Quality plugin guidance, terminology, configuration details, and implementation planning documentation. * **Bug Fixes** * Improved process supervision so command failures and shutdown timers are handled safely. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
107 lines
3.3 KiB
JavaScript
107 lines
3.3 KiB
JavaScript
import { spawn } from "node:child_process";
|
|
|
|
/*
|
|
* FNXC:BundledPlugins 2026-07-15-13:40:
|
|
* Clean CI typechecks the CLI before @fusion/core emits dist, but published
|
|
* bundled plugins need both postgresSchema runtime values and Quality's
|
|
* process-group supervisor. Keep this alias implementation in untyped MJS so
|
|
* tsc stays inside the CLI root while esbuild follows the core source schema
|
|
* and bundles every runtime export without a private @fusion/core dependency.
|
|
*/
|
|
import * as postgresSchema from "../../core/src/postgres/schema/index.js";
|
|
|
|
export { postgresSchema };
|
|
|
|
export const FUSION_RESTART_EXIT_CODE = 86;
|
|
|
|
export function superviseSpawn(command, args = [], options = {}) {
|
|
const killGraceMs = options.killGraceMs ?? 2_000;
|
|
const maxLifetimeMs = options.maxLifetimeMs;
|
|
const spawnOptions = { ...options };
|
|
delete spawnOptions.killGraceMs;
|
|
delete spawnOptions.maxLifetimeMs;
|
|
const processGroup = globalThis.process.platform !== "win32";
|
|
const child = spawn(command, [...args], { ...spawnOptions, detached: processGroup });
|
|
const pgid = processGroup && typeof child.pid === "number" ? child.pid : null;
|
|
let settled = false;
|
|
let resolveExit;
|
|
const waitExit = new Promise((resolve) => {
|
|
resolveExit = resolve;
|
|
});
|
|
|
|
const killProcess = (signal = "SIGTERM") => {
|
|
if (typeof child.pid !== "number") return;
|
|
try {
|
|
if (pgid != null) globalThis.process.kill(-pgid, signal);
|
|
else child.kill(signal);
|
|
} catch {
|
|
try {
|
|
child.kill(signal);
|
|
} catch {
|
|
// FNXC:Quality 2026-07-15-13:40: A concurrently exited child needs no further cancellation action.
|
|
}
|
|
}
|
|
};
|
|
|
|
let lifetimeTimer = null;
|
|
if (typeof maxLifetimeMs === "number" && Number.isFinite(maxLifetimeMs) && maxLifetimeMs > 0) {
|
|
lifetimeTimer = globalThis.setTimeout(() => {
|
|
if (settled) return;
|
|
killProcess("SIGTERM");
|
|
const escalationTimer = globalThis.setTimeout(() => {
|
|
if (!settled) killProcess("SIGKILL");
|
|
}, killGraceMs);
|
|
escalationTimer.unref?.();
|
|
}, maxLifetimeMs);
|
|
lifetimeTimer.unref?.();
|
|
}
|
|
|
|
child.once("close", (code, signal) => {
|
|
settled = true;
|
|
if (lifetimeTimer) globalThis.clearTimeout(lifetimeTimer);
|
|
resolveExit?.({ code, signal });
|
|
});
|
|
// FNXC:Quality 2026-07-15-13:40: Spawn failures must not crash a bundled plugin; close settles waitExit.
|
|
child.on("error", () => {});
|
|
|
|
return {
|
|
pid: child.pid,
|
|
pgid,
|
|
child,
|
|
kill(signal = "SIGTERM") {
|
|
if (settled) return;
|
|
killProcess(signal);
|
|
if (signal === "SIGTERM") {
|
|
const escalationTimer = globalThis.setTimeout(() => {
|
|
if (!settled) killProcess("SIGKILL");
|
|
}, killGraceMs);
|
|
escalationTimer.unref?.();
|
|
}
|
|
},
|
|
waitExit() {
|
|
return waitExit;
|
|
},
|
|
};
|
|
}
|
|
|
|
export const ProcessSupervisor = { superviseSpawn };
|
|
export const WORKFLOW_EXTENSION_SCHEMA_VERSION = 1;
|
|
|
|
export function workflowExtensionRegistryId(pluginId, extensionId) {
|
|
return `plugin:${pluginId}:${extensionId}`;
|
|
}
|
|
|
|
export function createBoardActionServices(store) {
|
|
return {
|
|
moveTask(input) {
|
|
return store.moveTask(input.taskId, input.column, {
|
|
preserveProgress: input.preserveProgress,
|
|
moveSource: input.source ?? "user",
|
|
});
|
|
},
|
|
updateTask(input) {
|
|
return store.updateTask(input.taskId, input.updates);
|
|
},
|
|
};
|
|
}
|