oc-pilot 0.101.0 → 0.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.js CHANGED
@@ -1294,6 +1294,61 @@ const TOOLS = [
1294
1294
  },
1295
1295
  },
1296
1296
  },
1297
+ {
1298
+ name: "mitosis",
1299
+ description: "Split a large diff into reviewable commits grouped by file, directory or change type. plan is read-only; apply creates commits in a shadow worktree, optionally runs tests after each, and exposes a branch plus patch files. apply needs --allow-write and confirm=true.",
1300
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1301
+ inputSchema: {
1302
+ type: "object",
1303
+ additionalProperties: false,
1304
+ required: ["action"],
1305
+ properties: {
1306
+ action: { type: "string", enum: ["plan", "apply"] },
1307
+ strategy: { type: "string", enum: ["file", "dir", "type"] },
1308
+ max_files: { type: "integer", minimum: 1, maximum: 500 },
1309
+ prefix: { type: "string", description: "Commit message prefix; default mitosis" },
1310
+ branch: { type: "string", description: "Branch to create for apply" },
1311
+ test_command: { type: "string", description: "Test command after each commit" },
1312
+ test_timeout_ms: { type: "integer", minimum: 1000, maximum: 1800000 },
1313
+ no_test: { type: "boolean", description: "Skip tests after commits" },
1314
+ confirm: { type: "boolean", description: "Required for apply" },
1315
+ force: { type: "boolean", description: "Overwrite an existing branch" },
1316
+ markdown: { type: "boolean", description: "Render the plan as Markdown" },
1317
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1318
+ base: { type: "string" },
1319
+ staged: { type: "boolean" },
1320
+ unstaged: { type: "boolean" },
1321
+ include_untracked: { type: "boolean" },
1322
+ ...RESULT_PROPERTIES,
1323
+ },
1324
+ },
1325
+ },
1326
+ {
1327
+ name: "intent",
1328
+ description: "Check acceptance criteria against the diff (met, partial, unmet, unverifiable) or interrogate a request before code (questions, assumptions, testable criteria). Model-backed, read-only and limited to what the diff can show.",
1329
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
1330
+ inputSchema: {
1331
+ type: "object",
1332
+ additionalProperties: false,
1333
+ required: ["action"],
1334
+ properties: {
1335
+ action: { type: "string", enum: ["check", "sphinx"] },
1336
+ criteria: { type: "array", description: "Acceptance criteria as strings", items: { type: "string" } },
1337
+ criteria_text: { type: "string", description: "Criteria as Markdown checklist or plain lines" },
1338
+ criteria_file: { type: "string", description: "Repository-relative criteria file" },
1339
+ request: { type: "string", description: "Feature request for sphinx" },
1340
+ request_file: { type: "string", description: "Repository-relative request file" },
1341
+ context: { type: "string", description: "Extra context for the model" },
1342
+ strict: { type: "boolean", description: "Fail on partial and unverifiable criteria" },
1343
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1344
+ base: { type: "string" },
1345
+ staged: { type: "boolean" },
1346
+ unstaged: { type: "boolean" },
1347
+ include_untracked: { type: "boolean" },
1348
+ ...RESULT_PROPERTIES,
1349
+ },
1350
+ },
1351
+ },
1297
1352
  {
1298
1353
  name: "apoptosis",
1299
1354
  description: "Scan functions marked /* @lifespan: 30d */ and report [Senescent] when the marker is older than the lifespan and the symbol has no references. With action=apply and confirm=true, comment the senescent functions out in a shadow git worktree, run tests and land the diff only if the suite is green. Apply writes files and needs --allow-write.",
@@ -1514,6 +1569,30 @@ const PROMPTS = [
1514
1569
  { name: "context", description: "What broke and why the fix is correct", required: false },
1515
1570
  ],
1516
1571
  },
1572
+ {
1573
+ name: "split-the-diff",
1574
+ title: "Split a large diff into reviewable commits",
1575
+ description: "Partition a diff into small commits by file, directory or type, apply them in a shadow worktree, run tests after each and expose a branch for review.",
1576
+ arguments: [
1577
+ { name: "context", description: "Why the change is being split", required: false },
1578
+ ],
1579
+ },
1580
+ {
1581
+ name: "check-the-criteria",
1582
+ title: "Check acceptance criteria against the diff",
1583
+ description: "Evaluate every acceptance criterion as met, partial, unmet or unverifiable against the real diff and stop on an unmet criterion.",
1584
+ arguments: [
1585
+ { name: "context", description: "What the change is supposed to do", required: false },
1586
+ ],
1587
+ },
1588
+ {
1589
+ name: "interrogate-the-intent",
1590
+ title: "Interrogate the request before code",
1591
+ description: "Extract missing decisions, hidden assumptions and testable acceptance criteria before implementation starts.",
1592
+ arguments: [
1593
+ { name: "context", description: "What is already known", required: false },
1594
+ ],
1595
+ },
1517
1596
  {
1518
1597
  name: "prune-senescent-code",
1519
1598
  title: "Prune senescent AI code",
@@ -3521,6 +3600,102 @@ async function callVaccine(input, cwd) {
3521
3600
  args.push("--force");
3522
3601
  return toToolResult(await runCli(args, cwd));
3523
3602
  }
3603
+ async function callMitosis(input, cwd) {
3604
+ const temp = new TempFiles();
3605
+ try {
3606
+ const action = stringArg(input, "action", true);
3607
+ if (action === "apply" && !booleanArg(input, "confirm")) {
3608
+ throw new ToolInputError("mitosis apply needs confirm=true");
3609
+ }
3610
+ const args = ["mitosis", action, "--json"];
3611
+ const strategy = stringArg(input, "strategy");
3612
+ if (strategy)
3613
+ args.push("--strategy", strategy);
3614
+ const maxFiles = integerArg(input, "max_files");
3615
+ if (maxFiles !== undefined)
3616
+ args.push("--max-files", String(maxFiles));
3617
+ const prefix = stringArg(input, "prefix");
3618
+ if (prefix)
3619
+ args.push("--prefix", prefix);
3620
+ const branch = stringArg(input, "branch");
3621
+ if (branch)
3622
+ args.push("--branch", branch);
3623
+ const testCommand = stringArg(input, "test_command");
3624
+ if (testCommand)
3625
+ args.push("--test-command", testCommand);
3626
+ const timeout = integerArg(input, "test_timeout_ms");
3627
+ if (timeout !== undefined)
3628
+ args.push("--test-timeout", String(Math.max(1, Math.round(timeout / 1000))) + "s");
3629
+ if (booleanArg(input, "no_test"))
3630
+ args.push("--no-test");
3631
+ if (action === "apply")
3632
+ args.push("--confirm");
3633
+ if (booleanArg(input, "force"))
3634
+ args.push("--force");
3635
+ if (booleanArg(input, "markdown"))
3636
+ args.push("--markdown");
3637
+ const diff = stringArg(input, "diff");
3638
+ if (diff)
3639
+ args.push("--diff", temp.write("mitosis.diff", diff));
3640
+ const base = baseArg(input);
3641
+ if (base)
3642
+ args.push("--base", base);
3643
+ if (booleanArg(input, "staged"))
3644
+ args.push("--staged");
3645
+ if (booleanArg(input, "unstaged"))
3646
+ args.push("--unstaged");
3647
+ if (booleanArg(input, "include_untracked"))
3648
+ args.push("--include-untracked");
3649
+ return toToolResult(await runCli(args, cwd));
3650
+ }
3651
+ finally {
3652
+ temp.cleanup();
3653
+ }
3654
+ }
3655
+ async function callIntent(input, cwd) {
3656
+ const temp = new TempFiles();
3657
+ try {
3658
+ const action = stringArg(input, "action", true);
3659
+ const args = ["intent", action, "--json"];
3660
+ if (Array.isArray(input.criteria)) {
3661
+ const lines = input.criteria.filter((item) => typeof item === "string");
3662
+ args.push("--criteria", temp.write("intent-criteria.md", lines.map((line) => "- [ ] " + line).join("\n")));
3663
+ }
3664
+ const criteriaFile = stringArg(input, "criteria_file");
3665
+ if (criteriaFile)
3666
+ args.push("--criteria", criteriaFile);
3667
+ const criteriaText = stringArg(input, "criteria_text");
3668
+ if (criteriaText)
3669
+ args.push("--criteria-text", criteriaText);
3670
+ const request = stringArg(input, "request");
3671
+ if (request)
3672
+ args.push("--request", request);
3673
+ const requestFile = stringArg(input, "request_file");
3674
+ if (requestFile)
3675
+ args.push("--request-file", requestFile);
3676
+ const context = stringArg(input, "context");
3677
+ if (context)
3678
+ args.push("--context", context);
3679
+ if (booleanArg(input, "strict"))
3680
+ args.push("--strict");
3681
+ const diff = stringArg(input, "diff");
3682
+ if (diff)
3683
+ args.push("--diff", temp.write("intent.diff", diff));
3684
+ const base = baseArg(input);
3685
+ if (base)
3686
+ args.push("--base", base);
3687
+ if (booleanArg(input, "staged"))
3688
+ args.push("--staged");
3689
+ if (booleanArg(input, "unstaged"))
3690
+ args.push("--unstaged");
3691
+ if (booleanArg(input, "include_untracked"))
3692
+ args.push("--include-untracked");
3693
+ return toToolResult(await runCli(args, cwd));
3694
+ }
3695
+ finally {
3696
+ temp.cleanup();
3697
+ }
3698
+ }
3524
3699
  async function callApoptosis(input, cwd) {
3525
3700
  const action = stringArg(input, "action") ?? "scan";
3526
3701
  const args = ["apoptosis", action, "--json"];
@@ -3742,6 +3917,9 @@ async function dispatchTool(name, input, cwd, readOnly) {
3742
3917
  if (name === "vaccine" && ["create", "forget", "clear"].includes(stringArg(input, "action") ?? "")) {
3743
3918
  throw new ToolInputError("vaccine create/forget/clear write .oc-pilot/vaccines and are disabled in read-only mode; start the MCP server with --allow-write");
3744
3919
  }
3920
+ if (name === "mitosis" && stringArg(input, "action") === "apply") {
3921
+ throw new ToolInputError("mitosis apply creates commits and a branch and is disabled in read-only mode; start the MCP server with --allow-write");
3922
+ }
3745
3923
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
3746
3924
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
3747
3925
  }
@@ -3863,6 +4041,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
3863
4041
  return callOracle(input, cwd);
3864
4042
  case "vaccine":
3865
4043
  return callVaccine(input, cwd);
4044
+ case "mitosis":
4045
+ return callMitosis(input, cwd);
4046
+ case "intent":
4047
+ return callIntent(input, cwd);
3866
4048
  case "apoptosis":
3867
4049
  return callApoptosis(input, cwd);
3868
4050
  case "scan_injection":
@@ -3942,6 +4124,19 @@ function summarizeResult(value) {
3942
4124
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3943
4125
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3944
4126
  }
4127
+ if (typeof value.status === "string" && Array.isArray(value.results) && value.counts && typeof value.counts === "object") {
4128
+ const counts = value.counts;
4129
+ return `oc-pilot: intent ${value.status}, ${String(counts.unmet ?? 0)} unmet`;
4130
+ }
4131
+ if (typeof value.status === "string" && Array.isArray(value.questions) && Array.isArray(value.assumptions)) {
4132
+ return `oc-pilot: sphinx ${value.status}, ${String(value.questions.length)} question(s)`;
4133
+ }
4134
+ if (typeof value.status === "string" && typeof value.branch === "string" && Array.isArray(value.commits)) {
4135
+ return `oc-pilot: mitosis ${value.status}, ${String(value.commits.length)} commit(s) on ${value.branch}`;
4136
+ }
4137
+ if (Array.isArray(value.commits) && typeof value.files === "number" && typeof value.additions === "number") {
4138
+ return `oc-pilot: mitosis plan ${String(value.commits.length)} commit(s), ${String(value.files)} file(s)`;
4139
+ }
3945
4140
  if (typeof value.total === "number" && typeof value.passed === "number" && Array.isArray(value.results)) {
3946
4141
  return `oc-pilot: vaccines ${String(value.passed)}/${String(value.total)} passed`;
3947
4142
  }
@@ -4241,6 +4436,12 @@ function promptBody(name, args) {
4241
4436
  return `Call the oc-pilot "skeptic" tool on the proposed diff. Read the hypothesis reason and the exact status. If it returns bug, stop and quote the failing test output: the generated test fails on the diff and passes on HEAD, so the change is falsified. Fix the code or the test expectation, then rerun; do not delete the test, do not weaken the assertion and do not claim a bug from a test that also fails on HEAD. If it returns clean, say that the hypothesis was rejected, not that the code is proven correct. If it returns unfalsifiable, explain that the test did not distinguish the diff from HEAD. If it returns error, report the infrastructure failure instead of guessing.${suffix}`;
4242
4437
  case "stamp-the-passport":
4243
4438
  return `Call the oc-pilot "passport" tool with action=write after the checks you actually ran, then action=verify. Record only real checks as name=pass|warn|fail|skip, the real agent/model and the commit. If verify returns [PASSPORT STALE] or [PASSPORT TAMPERED], stop: the manifest no longer matches the tree; rewrite it from the current state or investigate the change. Never mark a check as pass without running it, never edit the manifest by hand to hide a mismatch, and never claim that a passport proves correctness: it proves what was recorded and that the files still match. write/clear need --allow-write.${suffix}`;
4439
+ case "check-the-criteria":
4440
+ return `Call the oc-pilot "intent" tool with action=check and the acceptance criteria for this change. Read every criterion as met, partial, unmet or unverifiable. If any is unmet, stop and quote the criterion and the evidence: the diff does not do what was promised. Fix the code or the criterion, never mark it met without evidence. Partial is not done, and unverifiable means the diff cannot prove it. Model-backed and read-only.${suffix}`;
4441
+ case "interrogate-the-intent":
4442
+ return `Call the oc-pilot "intent" tool with action=sphinx on the request before writing code. Read the questions and assumptions. Ask the user to resolve each question; do not invent answers. Turn the criteria into tests. If it returns [REQUIREMENTS AMBIGUOUS], do not start implementation yet. Model-backed and read-only.${suffix}`;
4443
+ case "split-the-diff":
4444
+ return `Call the oc-pilot "mitosis" tool with action=plan on the proposed diff and read the commit sequence. Check that every commit is independently applicable and that config changes come before the code that needs them. Then call action=apply with confirm=true, a branch name and the project test command; read the test status after each commit. If a commit fails tests, stop: the split is wrong or the change is incomplete; fix the split and rerun. Do not delete failing commits, do not squash everything into one commit to hide the failure, and do not claim the branch is safe when tests were skipped. apply writes a branch and patch files and needs --allow-write.${suffix}`;
4244
4445
  case "inoculate-the-fix":
4245
4446
  return `Call the oc-pilot "vaccine" tool with action=create for the fix commit and its buggy parent. Read the verification: only verified means the test fails on the bug and passes on the fix. If it is rejected, do not store it: the test does not distinguish the two trees; explain why and try a sharper test. If it is error, report the infrastructure failure. Then call action=run to prove the stored vaccines still pass on HEAD. Never mark a rejected test as a vaccine, never weaken the assertion to force a pass, and never delete a failing vaccine to make the suite green. create/forget/clear need --allow-write.${suffix}`;
4246
4447
  case "compare-the-behavior":