feat(FN-4222): add experiment-finalize CLI command and API route

Implements the `experiment-finalize` CLI command (FN-4222) and its companion dashboard API route, wiring the feature through the pi extension as a new callable tool. Includes the command implementation, extension tooling, API integration, and corresponding test coverage.

Fusion-Task-Id: FN-4222
This commit is contained in:
Fusion
2026-05-14 04:20:59 -07:00
committed by gsxdsm
parent 25234edc97
commit 81b1eae394
15 changed files with 732 additions and 2 deletions

View File

@@ -139,6 +139,7 @@ async function loadCommandHandlers() {
const { runPluginCreate } = await import("./commands/plugin-scaffold.js");
const { runSkillsSearch, runSkillsInstall } = await import("./commands/skills.js");
const { runResearchCreate, runResearchList, runResearchShow, runResearchExport, runResearchCancel, runResearchRetry } = await import("./commands/research.js");
const { runExperimentFinalize } = await import("./commands/experiment-finalize.js");
const { runUpdate } = await import("./commands/update.js");
return {
@@ -235,6 +236,7 @@ async function loadCommandHandlers() {
runResearchExport,
runResearchCancel,
runResearchRetry,
runExperimentFinalize,
runUpdate,
runChatInteractive,
};
@@ -605,6 +607,7 @@ async function main() {
runResearchExport,
runResearchCancel,
runResearchRetry,
runExperimentFinalize,
runUpdate,
runChatInteractive,
} = await loadCommandHandlers();
@@ -916,6 +919,34 @@ async function main() {
break;
}
case "experiment": {
const subcommand = args[1];
switch (subcommand) {
case "finalize": {
const sessionId = args[2];
if (!sessionId) {
console.error("Usage: fn experiment finalize <sessionId> [--integration-branch <name>] [--dry-run] [--json] [--summary <text>] [--plan-file <path>]");
process.exit(1);
}
await runExperimentFinalize({
sessionId,
integrationBranch: getFlagValue(args, "--integration-branch") ?? "main",
dryRun: args.includes("--dry-run"),
json: args.includes("--json"),
summary: getFlagValue(args, "--summary"),
planFile: getFlagValue(args, "--plan-file"),
projectName,
});
break;
}
default:
console.error(`Unknown subcommand: experiment ${subcommand || ""}`);
console.log("Try: fn experiment finalize <session-id>");
process.exit(1);
}
break;
}
case "task": {
const subcommand = args[1];
switch (subcommand) {