Files
fusion/plugins/fusion-plugin-quality/src/settings.ts
gsxdsm e3f98253cc feat: Quality plugin — Task QA tab, preview servers, tests, and suggested cases (#2127)
## 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 -->
2026-07-15 20:28:11 -07:00

54 lines
1.9 KiB
TypeScript

import type { PluginSettingSchema } from "@fusion/plugin-sdk";
/*
FNXC:Quality 2026-07-14-21:45:
Quality plugin settings control retention, log size, and optional root-fallback for task runs.
Defaults keep history bounded and require worktree for task-scoped commands unless operators opt in.
*/
export const settingsSchema: Record<string, PluginSettingSchema> = {
runRetentionCount: {
type: "number",
label: "Run history retention",
description: "Max finished test runs kept per project. Default: 50.",
defaultValue: 50,
},
logTruncateKb: {
type: "number",
label: "Log truncate (KB)",
description: "Max stdout/stderr stored per run in kilobytes. Default: 64.",
defaultValue: 64,
},
allowRootFallback: {
type: "boolean",
label: "Allow project-root fallback for task runs",
description: "When a task has no worktree, allow targeted runs on project root. Default: false (block).",
defaultValue: false,
},
defaultPreviewScript: {
type: "string",
label: "Default preview script",
description: "Package script used for task preview servers when Dev Server has no selection. Default: dev.",
defaultValue: "dev",
},
};
export function getRunRetentionCount(settings: Record<string, unknown> | undefined): number {
const n = settings?.runRetentionCount;
return typeof n === "number" && n > 0 ? Math.floor(n) : 50;
}
export function getLogTruncateKb(settings: Record<string, unknown> | undefined): number {
const n = settings?.logTruncateKb;
return typeof n === "number" && n > 0 ? Math.floor(n) : 64;
}
export function getAllowRootFallback(settings: Record<string, unknown> | undefined): boolean {
return settings?.allowRootFallback === true;
}
export function getDefaultPreviewScript(settings: Record<string, unknown> | undefined): string {
const s = settings?.defaultPreviewScript;
return typeof s === "string" && s.trim() ? s.trim() : "dev";
}