@remixhq/mcp 0.1.17 → 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 +15 -63
- package/dist/cli.js.map +1 -1
- package/dist/index.js +15 -63
- package/dist/index.js.map +1 -1
- package/dist/server.js +15 -63
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -506,9 +506,6 @@ var applyInputSchema = {
|
|
|
506
506
|
confirm: z2.boolean(),
|
|
507
507
|
allowBranchMismatch: z2.boolean().optional()
|
|
508
508
|
};
|
|
509
|
-
var reAnchorInputSchema = {
|
|
510
|
-
...applyInputSchema
|
|
511
|
-
};
|
|
512
509
|
var requestMergeInputSchema = {
|
|
513
510
|
...commonRequestFieldsSchema
|
|
514
511
|
};
|
|
@@ -621,7 +618,7 @@ var initSyncDataSchema = z2.object({
|
|
|
621
618
|
repoRoot: z2.string(),
|
|
622
619
|
bindingMode: z2.enum(["legacy", "lane", "explicit_root"]).optional(),
|
|
623
620
|
createdCanonicalFamily: z2.boolean().optional(),
|
|
624
|
-
baselineStatus: z2.enum(["seeded", "existing", "
|
|
621
|
+
baselineStatus: z2.enum(["seeded", "existing", "baseline_missing", "requires_sync"]).optional()
|
|
625
622
|
});
|
|
626
623
|
var initQueuedDataSchema = z2.object({
|
|
627
624
|
queued: z2.literal(true),
|
|
@@ -669,7 +666,6 @@ var drainFinalizeQueueDataSchema = z2.object({
|
|
|
669
666
|
results: z2.array(genericRecordSchema)
|
|
670
667
|
});
|
|
671
668
|
var syncDataSchema = genericRecordSchema;
|
|
672
|
-
var reAnchorDataSchema = genericRecordSchema;
|
|
673
669
|
var requestMergeDataSchema = genericRecordSchema;
|
|
674
670
|
var mergeRequestQueueDataSchema = z2.object({
|
|
675
671
|
queue: mergeRequestQueueSchema,
|
|
@@ -745,7 +741,6 @@ var addSuccessSchema = makeSuccessSchema(addDataSchema);
|
|
|
745
741
|
var recordTurnSuccessSchema = makeSuccessSchema(recordTurnDataSchema);
|
|
746
742
|
var drainFinalizeQueueSuccessSchema = makeSuccessSchema(drainFinalizeQueueDataSchema);
|
|
747
743
|
var syncSuccessSchema = makeSuccessSchema(syncDataSchema);
|
|
748
|
-
var reAnchorSuccessSchema = makeSuccessSchema(reAnchorDataSchema);
|
|
749
744
|
var requestMergeSuccessSchema = makeSuccessSchema(requestMergeDataSchema);
|
|
750
745
|
var mergeRequestQueueSuccessSchema = makeSuccessSchema(mergeRequestQueueDataSchema);
|
|
751
746
|
var viewMergeRequestSuccessSchema = makeSuccessSchema(viewMergeRequestDataSchema);
|
|
@@ -772,7 +767,6 @@ import {
|
|
|
772
767
|
collabCheckout as coreCollabCheckout,
|
|
773
768
|
collabListMergeRequests as coreCollabListMergeRequests,
|
|
774
769
|
collabInit as coreCollabInit,
|
|
775
|
-
collabReAnchor as coreCollabReAnchor,
|
|
776
770
|
collabInvite as coreCollabInvite,
|
|
777
771
|
collabReconcile as coreCollabReconcile,
|
|
778
772
|
collabReject as coreCollabReject,
|
|
@@ -787,7 +781,7 @@ import { findGitRoot } from "@remixhq/core/repo";
|
|
|
787
781
|
function getRiskLevel(status) {
|
|
788
782
|
if (status.recommendedAction === "reconcile") return "high";
|
|
789
783
|
if (status.recommendedAction === "choose_family" || status.recommendedAction === "await_finalize") return "medium";
|
|
790
|
-
if (status.recommendedAction === "pull" || status.
|
|
784
|
+
if (status.recommendedAction === "pull" || status.remote.incomingOpenMergeRequestCount) {
|
|
791
785
|
return "medium";
|
|
792
786
|
}
|
|
793
787
|
if (status.repo.branchMismatch || !status.repo.isGitRepo || !status.binding.isBound || !status.repo.worktree.isClean) return "medium";
|
|
@@ -804,10 +798,6 @@ function getRecommendedNextActions(status) {
|
|
|
804
798
|
return ["Run remix_collab_init to bind the repository to Remix before using any Remix collaboration mutation flow."];
|
|
805
799
|
case "pull":
|
|
806
800
|
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."];
|
|
807
|
-
case "re_anchor":
|
|
808
|
-
return [
|
|
809
|
-
"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."
|
|
810
|
-
];
|
|
811
801
|
case "record":
|
|
812
802
|
return [
|
|
813
803
|
"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."
|
|
@@ -892,8 +882,8 @@ async function initCollab(params) {
|
|
|
892
882
|
return {
|
|
893
883
|
data: syncResult,
|
|
894
884
|
warnings: collectResultWarnings(result),
|
|
895
|
-
recommendedNextActions: syncResult.baselineStatus === "
|
|
896
|
-
"This checkout has no local Remix baseline yet. Run
|
|
885
|
+
recommendedNextActions: syncResult.baselineStatus === "baseline_missing" ? [
|
|
886
|
+
"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."
|
|
897
887
|
] : syncResult.baselineStatus === "requires_sync" ? [
|
|
898
888
|
"Run remix_collab_sync_preview, then remix_collab_sync_apply to pull the server delta and create the first local baseline for this checkout."
|
|
899
889
|
] : ["Run remix_collab_status to inspect sync, reconcile, and merge-request readiness before mutating bound-repo state."],
|
|
@@ -996,26 +986,6 @@ async function syncCollab(params) {
|
|
|
996
986
|
}
|
|
997
987
|
};
|
|
998
988
|
}
|
|
999
|
-
async function reAnchor(params) {
|
|
1000
|
-
const api = await createCollabApiClient();
|
|
1001
|
-
const result = await coreCollabReAnchor({
|
|
1002
|
-
api,
|
|
1003
|
-
cwd: params.cwd,
|
|
1004
|
-
dryRun: params.dryRun,
|
|
1005
|
-
allowBranchMismatch: params.allowBranchMismatch ?? false
|
|
1006
|
-
});
|
|
1007
|
-
return {
|
|
1008
|
-
data: result,
|
|
1009
|
-
warnings: collectWarnings(result.warnings),
|
|
1010
|
-
recommendedNextActions: params.dryRun ? [
|
|
1011
|
-
"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."
|
|
1012
|
-
] : [],
|
|
1013
|
-
logContext: {
|
|
1014
|
-
repoRoot: result.repoRoot,
|
|
1015
|
-
appId: result.currentAppId
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
}
|
|
1019
989
|
async function requestMerge(params) {
|
|
1020
990
|
const api = await createCollabApiClient();
|
|
1021
991
|
const drainWarnings = await drainBeforeMutation(api);
|
|
@@ -1752,7 +1722,10 @@ function shouldAutoSpawnHistoryImport(repoRoot) {
|
|
|
1752
1722
|
return false;
|
|
1753
1723
|
}
|
|
1754
1724
|
}
|
|
1755
|
-
function
|
|
1725
|
+
function isAutoSpawnEligibleBindingMode(bindingMode) {
|
|
1726
|
+
return bindingMode === "explicit_root";
|
|
1727
|
+
}
|
|
1728
|
+
function spawnHistoryImportDetached(repoRoot, options) {
|
|
1756
1729
|
const remixDir = path2.join(repoRoot, ".remix");
|
|
1757
1730
|
try {
|
|
1758
1731
|
mkdirSync(remixDir, { recursive: true });
|
|
@@ -1768,6 +1741,8 @@ function spawnHistoryImportDetached(repoRoot) {
|
|
|
1768
1741
|
"import",
|
|
1769
1742
|
"--repo",
|
|
1770
1743
|
repoRoot,
|
|
1744
|
+
"--before",
|
|
1745
|
+
options.cutoffAt,
|
|
1771
1746
|
// Include prompt text for parity with the CLI auto-spawn path:
|
|
1772
1747
|
// first-time UX is a lot worse if the dashboard renders every
|
|
1773
1748
|
// historical row as "(prompt not uploaded)".
|
|
@@ -1918,11 +1893,13 @@ function registerCollabTools(server, context) {
|
|
|
1918
1893
|
});
|
|
1919
1894
|
try {
|
|
1920
1895
|
const repoRoot = result && typeof result === "object" && "data" in result && result.data && typeof result.data.repoRoot === "string" ? result.data.repoRoot : null;
|
|
1921
|
-
|
|
1922
|
-
|
|
1896
|
+
const bindingMode = result && typeof result === "object" && "data" in result && result.data && typeof result.data.bindingMode === "string" ? result.data.bindingMode : null;
|
|
1897
|
+
if (repoRoot && isAutoSpawnEligibleBindingMode(bindingMode) && shouldAutoSpawnHistoryImport(repoRoot)) {
|
|
1898
|
+
const cutoffAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1899
|
+
const spawned = spawnHistoryImportDetached(repoRoot, { cutoffAt });
|
|
1923
1900
|
context.logger.log({
|
|
1924
1901
|
level: "info",
|
|
1925
|
-
message: `history_import_auto_spawned pid=${spawned.pid ?? "?"} log=${spawned.logPath}`,
|
|
1902
|
+
message: `history_import_auto_spawned pid=${spawned.pid ?? "?"} log=${spawned.logPath} cutoffAt=${cutoffAt}`,
|
|
1926
1903
|
tool: "remix_collab_init",
|
|
1927
1904
|
repoRoot
|
|
1928
1905
|
});
|
|
@@ -2026,31 +2003,6 @@ function registerCollabTools(server, context) {
|
|
|
2026
2003
|
return syncCollab({ cwd, dryRun: false, allowBranchMismatch: input.allowBranchMismatch ?? false });
|
|
2027
2004
|
}
|
|
2028
2005
|
});
|
|
2029
|
-
registerTool(server, context, {
|
|
2030
|
-
name: "remix_collab_re_anchor_preview",
|
|
2031
|
-
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.",
|
|
2032
|
-
access: "read",
|
|
2033
|
-
inputSchema: previewInputSchema,
|
|
2034
|
-
outputSchema: reAnchorSuccessSchema,
|
|
2035
|
-
run: async (args) => {
|
|
2036
|
-
const input = z3.object(previewInputSchema).parse(args);
|
|
2037
|
-
const cwd = resolvePolicyCwd(context.policy, input.cwd);
|
|
2038
|
-
return reAnchor({ cwd, dryRun: true });
|
|
2039
|
-
}
|
|
2040
|
-
});
|
|
2041
|
-
registerTool(server, context, {
|
|
2042
|
-
name: "remix_collab_re_anchor_apply",
|
|
2043
|
-
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.",
|
|
2044
|
-
access: "local_write",
|
|
2045
|
-
inputSchema: reAnchorInputSchema,
|
|
2046
|
-
outputSchema: reAnchorSuccessSchema,
|
|
2047
|
-
run: async (args) => {
|
|
2048
|
-
const input = z3.object(reAnchorInputSchema).parse(args);
|
|
2049
|
-
assertConfirm(input.confirm, "remix_collab_re_anchor_apply");
|
|
2050
|
-
const cwd = resolvePolicyCwd(context.policy, input.cwd);
|
|
2051
|
-
return reAnchor({ cwd, dryRun: false, allowBranchMismatch: input.allowBranchMismatch ?? false });
|
|
2052
|
-
}
|
|
2053
|
-
});
|
|
2054
2006
|
registerTool(server, context, {
|
|
2055
2007
|
name: "remix_collab_request_merge",
|
|
2056
2008
|
description: "Open a prompt-backed Remix merge request from the current bound repository to its upstream app instead of merging locally with raw git.",
|