@remixhq/mcp 0.1.16 → 0.1.18

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/cli.js CHANGED
@@ -510,9 +510,6 @@ var applyInputSchema = {
510
510
  confirm: z2.boolean(),
511
511
  allowBranchMismatch: z2.boolean().optional()
512
512
  };
513
- var reAnchorInputSchema = {
514
- ...applyInputSchema
515
- };
516
513
  var requestMergeInputSchema = {
517
514
  ...commonRequestFieldsSchema
518
515
  };
@@ -625,7 +622,7 @@ var initSyncDataSchema = z2.object({
625
622
  repoRoot: z2.string(),
626
623
  bindingMode: z2.enum(["legacy", "lane", "explicit_root"]).optional(),
627
624
  createdCanonicalFamily: z2.boolean().optional(),
628
- baselineStatus: z2.enum(["seeded", "existing", "requires_re_anchor", "requires_sync"]).optional()
625
+ baselineStatus: z2.enum(["seeded", "existing", "baseline_missing", "requires_sync"]).optional()
629
626
  });
630
627
  var initQueuedDataSchema = z2.object({
631
628
  queued: z2.literal(true),
@@ -673,7 +670,6 @@ var drainFinalizeQueueDataSchema = z2.object({
673
670
  results: z2.array(genericRecordSchema)
674
671
  });
675
672
  var syncDataSchema = genericRecordSchema;
676
- var reAnchorDataSchema = genericRecordSchema;
677
673
  var requestMergeDataSchema = genericRecordSchema;
678
674
  var mergeRequestQueueDataSchema = z2.object({
679
675
  queue: mergeRequestQueueSchema,
@@ -749,7 +745,6 @@ var addSuccessSchema = makeSuccessSchema(addDataSchema);
749
745
  var recordTurnSuccessSchema = makeSuccessSchema(recordTurnDataSchema);
750
746
  var drainFinalizeQueueSuccessSchema = makeSuccessSchema(drainFinalizeQueueDataSchema);
751
747
  var syncSuccessSchema = makeSuccessSchema(syncDataSchema);
752
- var reAnchorSuccessSchema = makeSuccessSchema(reAnchorDataSchema);
753
748
  var requestMergeSuccessSchema = makeSuccessSchema(requestMergeDataSchema);
754
749
  var mergeRequestQueueSuccessSchema = makeSuccessSchema(mergeRequestQueueDataSchema);
755
750
  var viewMergeRequestSuccessSchema = makeSuccessSchema(viewMergeRequestDataSchema);
@@ -776,7 +771,6 @@ import {
776
771
  collabCheckout as coreCollabCheckout,
777
772
  collabListMergeRequests as coreCollabListMergeRequests,
778
773
  collabInit as coreCollabInit,
779
- collabReAnchor as coreCollabReAnchor,
780
774
  collabInvite as coreCollabInvite,
781
775
  collabReconcile as coreCollabReconcile,
782
776
  collabReject as coreCollabReject,
@@ -791,7 +785,7 @@ import { findGitRoot } from "@remixhq/core/repo";
791
785
  function getRiskLevel(status) {
792
786
  if (status.recommendedAction === "reconcile") return "high";
793
787
  if (status.recommendedAction === "choose_family" || status.recommendedAction === "await_finalize") return "medium";
794
- if (status.recommendedAction === "pull" || status.recommendedAction === "re_anchor" || status.remote.incomingOpenMergeRequestCount) {
788
+ if (status.recommendedAction === "pull" || status.remote.incomingOpenMergeRequestCount) {
795
789
  return "medium";
796
790
  }
797
791
  if (status.repo.branchMismatch || !status.repo.isGitRepo || !status.binding.isBound || !status.repo.worktree.isClean) return "medium";
@@ -808,10 +802,6 @@ function getRecommendedNextActions(status) {
808
802
  return ["Run remix_collab_init to bind the repository to Remix before using any Remix collaboration mutation flow."];
809
803
  case "pull":
810
804
  return ["Run remix_collab_sync_preview, then remix_collab_sync_apply if the preview is acceptable. This pulls the server delta into the local working tree without rewriting local git history."];
811
- case "re_anchor":
812
- return [
813
- "Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply. This seeds a local Remix baseline. It is required because no local baseline exists for this lane yet (fresh clone, deleted .remix/ state, or first init didn't seed) \u2014 not because of any specific git operation. After it succeeds, automatic hook recording can capture completed turns."
814
- ];
815
805
  case "record":
816
806
  return [
817
807
  "No MCP recording tool is required. Automatic hook finalization will capture the local boundary at the end of the completed turn; this covers agent edits, manual user edits, git commit, git pull, git merge, git rebase, and git reset."
@@ -896,8 +886,8 @@ async function initCollab(params) {
896
886
  return {
897
887
  data: syncResult,
898
888
  warnings: collectResultWarnings(result),
899
- recommendedNextActions: syncResult.baselineStatus === "requires_re_anchor" ? [
900
- "This checkout has no local Remix baseline yet. Run remix_collab_re_anchor_preview, then remix_collab_re_anchor_apply to seed one. After it succeeds, automatic hook recording can capture completed turns."
889
+ recommendedNextActions: syncResult.baselineStatus === "baseline_missing" ? [
890
+ "This checkout has no local Remix revision baseline yet. Run remix_collab_init or remix_collab_sync_preview/apply to seed one. After it succeeds, automatic hook recording can capture completed turns."
901
891
  ] : syncResult.baselineStatus === "requires_sync" ? [
902
892
  "Run remix_collab_sync_preview, then remix_collab_sync_apply to pull the server delta and create the first local baseline for this checkout."
903
893
  ] : ["Run remix_collab_status to inspect sync, reconcile, and merge-request readiness before mutating bound-repo state."],
@@ -1000,26 +990,6 @@ async function syncCollab(params) {
1000
990
  }
1001
991
  };
1002
992
  }
1003
- async function reAnchor(params) {
1004
- const api = await createCollabApiClient();
1005
- const result = await coreCollabReAnchor({
1006
- api,
1007
- cwd: params.cwd,
1008
- dryRun: params.dryRun,
1009
- allowBranchMismatch: params.allowBranchMismatch ?? false
1010
- });
1011
- return {
1012
- data: result,
1013
- warnings: collectWarnings(result.warnings),
1014
- recommendedNextActions: params.dryRun ? [
1015
- "Run remix_collab_re_anchor_apply with confirm=true to seed a local Remix baseline for this checkout. Re-anchor is for missing-baseline cases only and does not replace automatic hook recording for ordinary local content changes."
1016
- ] : [],
1017
- logContext: {
1018
- repoRoot: result.repoRoot,
1019
- appId: result.currentAppId
1020
- }
1021
- };
1022
- }
1023
993
  async function requestMerge(params) {
1024
994
  const api = await createCollabApiClient();
1025
995
  const drainWarnings = await drainBeforeMutation(api);
@@ -1756,7 +1726,10 @@ function shouldAutoSpawnHistoryImport(repoRoot) {
1756
1726
  return false;
1757
1727
  }
1758
1728
  }
1759
- function spawnHistoryImportDetached(repoRoot) {
1729
+ function isAutoSpawnEligibleBindingMode(bindingMode) {
1730
+ return bindingMode === "explicit_root";
1731
+ }
1732
+ function spawnHistoryImportDetached(repoRoot, options) {
1760
1733
  const remixDir = path2.join(repoRoot, ".remix");
1761
1734
  try {
1762
1735
  mkdirSync(remixDir, { recursive: true });
@@ -1772,6 +1745,8 @@ function spawnHistoryImportDetached(repoRoot) {
1772
1745
  "import",
1773
1746
  "--repo",
1774
1747
  repoRoot,
1748
+ "--before",
1749
+ options.cutoffAt,
1775
1750
  // Include prompt text for parity with the CLI auto-spawn path:
1776
1751
  // first-time UX is a lot worse if the dashboard renders every
1777
1752
  // historical row as "(prompt not uploaded)".
@@ -1922,11 +1897,13 @@ function registerCollabTools(server, context) {
1922
1897
  });
1923
1898
  try {
1924
1899
  const repoRoot = result && typeof result === "object" && "data" in result && result.data && typeof result.data.repoRoot === "string" ? result.data.repoRoot : null;
1925
- if (repoRoot && shouldAutoSpawnHistoryImport(repoRoot)) {
1926
- const spawned = spawnHistoryImportDetached(repoRoot);
1900
+ const bindingMode = result && typeof result === "object" && "data" in result && result.data && typeof result.data.bindingMode === "string" ? result.data.bindingMode : null;
1901
+ if (repoRoot && isAutoSpawnEligibleBindingMode(bindingMode) && shouldAutoSpawnHistoryImport(repoRoot)) {
1902
+ const cutoffAt = (/* @__PURE__ */ new Date()).toISOString();
1903
+ const spawned = spawnHistoryImportDetached(repoRoot, { cutoffAt });
1927
1904
  context.logger.log({
1928
1905
  level: "info",
1929
- message: `history_import_auto_spawned pid=${spawned.pid ?? "?"} log=${spawned.logPath}`,
1906
+ message: `history_import_auto_spawned pid=${spawned.pid ?? "?"} log=${spawned.logPath} cutoffAt=${cutoffAt}`,
1930
1907
  tool: "remix_collab_init",
1931
1908
  repoRoot
1932
1909
  });
@@ -2030,31 +2007,6 @@ function registerCollabTools(server, context) {
2030
2007
  return syncCollab({ cwd, dryRun: false, allowBranchMismatch: input.allowBranchMismatch ?? false });
2031
2008
  }
2032
2009
  });
2033
- registerTool(server, context, {
2034
- name: "remix_collab_re_anchor_preview",
2035
- description: "Preview whether this checkout needs a fresh local Remix baseline. Use only when status reports `re_anchor` (no local baseline exists for this lane yet \u2014 fresh clone, deleted `.remix/` state, or first init didn't seed). Re-anchor does not replace automatic hook recording; ordinary local content changes (including merges, pulls, and rebases) are captured at the completed-turn boundary, not by re-anchor.",
2036
- access: "read",
2037
- inputSchema: previewInputSchema,
2038
- outputSchema: reAnchorSuccessSchema,
2039
- run: async (args) => {
2040
- const input = z3.object(previewInputSchema).parse(args);
2041
- const cwd = resolvePolicyCwd(context.policy, input.cwd);
2042
- return reAnchor({ cwd, dryRun: true });
2043
- }
2044
- });
2045
- registerTool(server, context, {
2046
- name: "remix_collab_re_anchor_apply",
2047
- description: "Establish a local Remix baseline for the current checkout against the existing app head, without rewriting the local checkout afterward. Required only when status reports `re_anchor` (missing local baseline). It does not replace automatic hook recording \u2014 local commits, pulls, merges, and rebases are still captured at the completed-turn boundary.",
2048
- access: "local_write",
2049
- inputSchema: reAnchorInputSchema,
2050
- outputSchema: reAnchorSuccessSchema,
2051
- run: async (args) => {
2052
- const input = z3.object(reAnchorInputSchema).parse(args);
2053
- assertConfirm(input.confirm, "remix_collab_re_anchor_apply");
2054
- const cwd = resolvePolicyCwd(context.policy, input.cwd);
2055
- return reAnchor({ cwd, dryRun: false, allowBranchMismatch: input.allowBranchMismatch ?? false });
2056
- }
2057
- });
2058
2010
  registerTool(server, context, {
2059
2011
  name: "remix_collab_request_merge",
2060
2012
  description: "Open a prompt-backed Remix merge request from the current bound repository to its upstream app instead of merging locally with raw git.",