brightspace-mcp-server 5.0.5 → 5.0.6

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.
Files changed (2) hide show
  1. package/build/update.js +21 -7
  2. package/package.json +1 -1
package/build/update.js CHANGED
@@ -15,7 +15,6 @@ dotenv.config({ quiet: true });
15
15
  // ANSI color helpers
16
16
  const bold = (s) => `\x1b[1m${s}\x1b[0m`;
17
17
  const green = (s) => `\x1b[32m${s}\x1b[0m`;
18
- const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
19
18
  const red = (s) => `\x1b[31m${s}\x1b[0m`;
20
19
  const dim = (s) => `\x1b[2m${s}\x1b[0m`;
21
20
  const projectRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
@@ -50,6 +49,12 @@ export function samePath(a, b) {
50
49
  };
51
50
  return canonical(a) === canonical(b);
52
51
  }
52
+ /** Stop before anything is modified, saying why and what to do. */
53
+ function refuse(reason, remedy) {
54
+ console.error(red(` Error: ${reason}`));
55
+ console.error(` ${remedy}`);
56
+ process.exit(1);
57
+ }
53
58
  const STABLE_VERSION = /^(\d+)\.(\d+)\.(\d+)$/;
54
59
  const COMMIT_SHA = /^[0-9a-f]{40}$/;
55
60
  function versionTriple(version) {
@@ -149,12 +154,15 @@ export function main() {
149
154
  const currentVersion = getVersion();
150
155
  console.log(` Current version: ${bold(currentVersion)}`);
151
156
  console.log("");
152
- // Check for uncommitted changes
157
+ // The update fast-forwards the checked-out branch to origin/main, so it only
158
+ // runs where that cannot touch local work: a clean working tree on main.
153
159
  const status = run("git status --porcelain", { silent: true });
154
160
  if (status) {
155
- console.log(yellow(" Warning: You have uncommitted changes."));
156
- console.log(dim(" The update will proceed, but your local changes may conflict."));
157
- console.log("");
161
+ refuse("You have uncommitted changes.", "Commit or stash them, then run the update again.");
162
+ }
163
+ const branch = run("git branch --show-current", { silent: true });
164
+ if (branch !== "main") {
165
+ refuse(branch ? `You are on branch '${branch}', not main.` : "HEAD is detached, not on main.", "Run 'git switch main', then run the update again.");
158
166
  }
159
167
  // Resolve the latest published release: the checkout follows what npm
160
168
  // ships, never the unreleased tip of main.
@@ -192,6 +200,11 @@ export function main() {
192
200
  fail(`Could not verify release ${targetVersion} (commit ${commit.slice(0, 7)}) on origin/main.`, "Nothing was changed.");
193
201
  return;
194
202
  }
203
+ // Local commits on main that origin/main lacks would need a merge or rebase.
204
+ const aheadCount = run("git rev-list --count origin/main..HEAD", { silent: true });
205
+ if (aheadCount !== "0") {
206
+ refuse(`Your main has ${aheadCount} commit${aheadCount === "1" ? "" : "s"} that origin/main does not.`, "Move them to another branch or reconcile main with origin/main yourself, then run the update again.");
207
+ }
195
208
  // Check if we're behind
196
209
  const behindCount = run(`git rev-list --count HEAD..${commit}`, { silent: true });
197
210
  if (behindCount === "0") {
@@ -209,13 +222,14 @@ export function main() {
209
222
  console.log(` ${dim("•")} ${line}`);
210
223
  }
211
224
  console.log("");
212
- // Move to the release
225
+ // Fast-forward only, to the verified release: never a merge or rebase,
226
+ // whatever git's pull settings say, and no pull fallback if it fails.
213
227
  console.log(dim(` Updating to ${targetVersion}...`));
214
228
  try {
215
229
  run(`git merge --ff-only ${commit}`, { silent: true });
216
230
  }
217
231
  catch {
218
- fail(`Failed to update to ${targetVersion}.`, "Your checkout has local commits or changes in the way. Resolve them and try again.");
232
+ fail(`Could not fast-forward to ${targetVersion}.`, "Nothing was changed. Check 'git status' and try again.");
219
233
  return;
220
234
  }
221
235
  // Install dependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "mcpName": "io.github.RohanMuppa/brightspace",
5
5
  "description": "MCP server for Brightspace (D2L). Check grades, due dates, assignments, announcements, syllabus, rosters and more via Claude, ChatGPT, Cursor, Windsurf, or any MCP client.",
6
6
  "type": "module",