mastracode 0.36.0-alpha.10 → 0.36.0-alpha.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # mastracode
2
2
 
3
+ ## 0.36.0-alpha.12
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`48ef1f1`](https://github.com/mastra-ai/mastra/commit/48ef1f1d24eedafbb07f64e659a81b52b67b8bf6), [`63796ba`](https://github.com/mastra-ai/mastra/commit/63796ba0fda60253be17535e68f6bbbf1e6ffa09), [`3c19dce`](https://github.com/mastra-ai/mastra/commit/3c19dcef8e73062a80627a4927eae3ec11145afd)]:
8
+ - @mastra/core@1.62.0-alpha.12
9
+ - @mastra/code-sdk@1.5.0-alpha.12
10
+
11
+ ## 0.36.0-alpha.11
12
+
13
+ ### Minor Changes
14
+
15
+ - Added review and working modes to MastraCode GitHub subscriptions. ([#21542](https://github.com/mastra-ai/mastra/pull/21542))
16
+
17
+ ```text
18
+ /github subscribe 42 --mode review
19
+ ```
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`15f92d0`](https://github.com/mastra-ai/mastra/commit/15f92d02bcacac7506346709d88b8bf11ae11695), [`4ff3ee2`](https://github.com/mastra-ai/mastra/commit/4ff3ee2bff7ed07528b4817f8f49639031c72a4d), [`c24754c`](https://github.com/mastra-ai/mastra/commit/c24754c1fb6fe144e5051e536e98c8a18b0214ac), [`cd7683d`](https://github.com/mastra-ai/mastra/commit/cd7683d3040bc322ec6f6efb6f9c1e8e40f062a1), [`45dd6ee`](https://github.com/mastra-ai/mastra/commit/45dd6ee089bd7df0d0c98a10098e483fd388e04a), [`32d3583`](https://github.com/mastra-ai/mastra/commit/32d358332cb8ac2306b83b73cf3536e74dbd435e), [`aca2869`](https://github.com/mastra-ai/mastra/commit/aca2869b2031982f3c4a2f52525c9be7cf123ef8)]:
24
+ - @mastra/github-signals@0.3.0-alpha.0
25
+ - @mastra/core@1.62.0-alpha.11
26
+ - @mastra/memory@1.28.0-alpha.4
27
+ - @mastra/code-sdk@1.5.0-alpha.11
28
+
3
29
  ## 0.36.0-alpha.10
4
30
 
5
31
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_tui = require("./tui-JjrLDEgc.cjs");
2
+ const require_tui = require("./tui-Dg7vMm5_.cjs");
3
3
  let _mastra_code_sdk = require("@mastra/code-sdk");
4
4
  let fs = require("fs");
5
5
  fs = require_tui.__toESM(fs, 1);
@@ -33,7 +33,7 @@ function createShutdownCoordinator(cleanup, exit, timeoutMs = 5e3) {
33
33
  //#endregion
34
34
  //#region src/version.ts
35
35
  function getCurrentVersion() {
36
- return "0.36.0-alpha.10";
36
+ return "0.36.0-alpha.12";
37
37
  }
38
38
  //#endregion
39
39
  //#region src/main.ts
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-5ivxiFIl.js";
2
+ import { d as detectTerminalTheme, f as applyThemeMode, t as MastraTUI, v as restoreTerminalForeground } from "./tui-BaobOqGM.js";
3
3
  import { createMastraCode } from "@mastra/code-sdk";
4
4
  import fs from "fs";
5
5
  import { createMastraCodeAnalytics } from "@mastra/code-sdk/analytics";
@@ -32,7 +32,7 @@ function createShutdownCoordinator(cleanup, exit, timeoutMs = 5e3) {
32
32
  //#endregion
33
33
  //#region src/version.ts
34
34
  function getCurrentVersion() {
35
- return "0.36.0-alpha.10";
35
+ return "0.36.0-alpha.12";
36
36
  }
37
37
  //#endregion
38
38
  //#region src/main.ts
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/github.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAmKtD,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiEtG"}
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/tui/commands/github.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAuMtD,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAmFtG"}
@@ -2310,7 +2310,7 @@ function getCommands(modes) {
2310
2310
  },
2311
2311
  {
2312
2312
  key: "/github",
2313
- description: "Subscribe/sync GitHub PR signals"
2313
+ description: "Subscribe in review/working mode or sync GitHub PR signals"
2314
2314
  },
2315
2315
  {
2316
2316
  key: "/goal",
@@ -16656,6 +16656,7 @@ function formatPollInterval(value) {
16656
16656
  if (value % 6e4 === 0) return `${value / 6e4}m`;
16657
16657
  return `${Math.round(value / 1e3)}s`;
16658
16658
  }
16659
+ const GITHUB_USAGE = "Usage: /github subscribe <PR> [--mode review|working], /github <PR> [--mode review|working], /github unsubscribe <PR>, /github sync, or /github debug. <PR> can be 123, owner/repo#123, or a GitHub pull request URL.";
16659
16660
  function parseGithubPRReference(input) {
16660
16661
  const trimmed = input.trim();
16661
16662
  if (!trimmed) return void 0;
@@ -16668,6 +16669,27 @@ function parseGithubPRReference(input) {
16668
16669
  number: Number(repoReference[3])
16669
16670
  };
16670
16671
  }
16672
+ function extractGithubSubscriptionMode(args, action) {
16673
+ if (args.some((arg) => arg.startsWith("--mode="))) return { error: `Use the spaced form --mode review or --mode working; --mode=... is not supported. ${GITHUB_USAGE}` };
16674
+ const modeIndexes = args.flatMap((arg, index) => arg === "--mode" ? [index] : []);
16675
+ if (modeIndexes.length > 1) return { error: `Specify --mode only once. ${GITHUB_USAGE}` };
16676
+ if (modeIndexes.length === 0) return {
16677
+ referenceArgs: args,
16678
+ mode: "working"
16679
+ };
16680
+ if (action === "unsubscribe") return { error: `--mode applies only when subscribing. ${GITHUB_USAGE}` };
16681
+ const modeIndex = modeIndexes[0];
16682
+ const mode = args[modeIndex + 1];
16683
+ if (!mode) return { error: `Missing value for --mode. Use review or working. ${GITHUB_USAGE}` };
16684
+ if (mode !== "review" && mode !== "working") return { error: `Unknown GitHub subscription mode "${mode}". Use review or working. ${GITHUB_USAGE}` };
16685
+ return {
16686
+ referenceArgs: args.filter((_, index) => index !== modeIndex && index !== modeIndex + 1),
16687
+ mode
16688
+ };
16689
+ }
16690
+ function normalizeGithubSubscriptionMode(value) {
16691
+ return value === "review" ? "review" : "working";
16692
+ }
16671
16693
  async function getCurrentGithubThread(ctx) {
16672
16694
  const session = ctx.state.session;
16673
16695
  const threadId = session?.thread?.getId?.();
@@ -16711,6 +16733,7 @@ async function describeGithubSubscriptions(ctx) {
16711
16733
  return [`GitHub Signals debug for ${threadId}: ${subscriptions.length} subscription${subscriptions.length === 1 ? "" : "s"}, polling=${pollingActive ? "active" : "inactive"}${pollIntervalMs ? `, interval=${formatPollInterval(pollIntervalMs)}` : ""}`, ...subscriptions.map((subscription) => {
16712
16734
  if (!isPlainObject(subscription)) return "- invalid subscription metadata";
16713
16735
  const pr = `${subscription.owner}/${subscription.repo}#${subscription.number}`;
16736
+ const mode = `mode=${normalizeGithubSubscriptionMode(subscription.mode)}`;
16714
16737
  const sync = subscription.lastSyncStatus ? `sync=${subscription.lastSyncStatus}` : "sync=unknown";
16715
16738
  const poll = subscription.lastSyncAt ? `lastPoll=${formatLocalTimestamp(subscription.lastSyncAt)}` : "lastPoll=never";
16716
16739
  const observed = [
@@ -16722,7 +16745,7 @@ async function describeGithubSubscriptions(ctx) {
16722
16745
  ].filter(Boolean);
16723
16746
  const notificationTime = formatLocalTimestamp(subscription.lastNotificationAt) ?? "unknown time";
16724
16747
  const notification = subscription.lastNotificationKind ? `lastNotification=${subscription.lastNotificationKind}/${subscription.lastNotificationPriority ?? "unknown"} at ${notificationTime}: ${subscription.lastNotificationSummary ?? ""}` : "lastNotification=none";
16725
- return `- ${pr} ${sync} ${poll}${subscription.lastSyncError ? ` error=${subscription.lastSyncError}` : ""}${subscription.lastSnapshotError ? ` snapshotError=${subscription.lastSnapshotError}` : ""}${observed.length ? ` (${observed.join(", ")})` : ""}\n ${notification}`;
16748
+ return `- ${pr} ${mode} ${sync} ${poll}${subscription.lastSyncError ? ` error=${subscription.lastSyncError}` : ""}${subscription.lastSnapshotError ? ` snapshotError=${subscription.lastSnapshotError}` : ""}${observed.length ? ` (${observed.join(", ")})` : ""}\n ${notification}`;
16726
16749
  })].join("\n");
16727
16750
  }
16728
16751
  async function syncGithubSubscriptions(ctx) {
@@ -16776,7 +16799,13 @@ async function handleGithubCommand(ctx, args = []) {
16776
16799
  }
16777
16800
  const explicitSubscribe = maybeAction === "subscribe" || maybeAction === "sub";
16778
16801
  const action = maybeAction === "unsubscribe" || maybeAction === "unsub" ? "unsubscribe" : "subscribe";
16779
- const inlineReference = (action === "unsubscribe" || explicitSubscribe ? restArgs : args).join(" ").trim();
16802
+ const parsedMode = extractGithubSubscriptionMode(action === "unsubscribe" || explicitSubscribe ? restArgs : args, action);
16803
+ if ("error" in parsedMode) {
16804
+ ctx.showError(parsedMode.error);
16805
+ return;
16806
+ }
16807
+ const { referenceArgs, mode } = parsedMode;
16808
+ const inlineReference = referenceArgs.join(" ").trim();
16780
16809
  const currentThread = await getCurrentGithubThread(ctx);
16781
16810
  const existingSubscriptions = getGithubSubscriptionsFromThreadMetadata(currentThread.metadata);
16782
16811
  const reference = inlineReference ? inlineReference : action === "unsubscribe" && existingSubscriptions.length === 1 ? existingSubscriptions[0] : await askModalQuestion(ctx.state.ui, {
@@ -16786,7 +16815,7 @@ async function handleGithubCommand(ctx, args = []) {
16786
16815
  if (reference === null) return;
16787
16816
  const parsed = typeof reference === "string" ? parseGithubPRReference(reference) : reference;
16788
16817
  if (!parsed) {
16789
- ctx.showError("Usage: /github 123, /github owner/repo#123, /github unsubscribe 123, /github sync, /github debug, or /github https://github.com/owner/repo/pull/123");
16818
+ ctx.showError(GITHUB_USAGE);
16790
16819
  return;
16791
16820
  }
16792
16821
  if (!currentThread.threadId || !currentThread.resourceId) {
@@ -16794,19 +16823,32 @@ async function handleGithubCommand(ctx, args = []) {
16794
16823
  return;
16795
16824
  }
16796
16825
  const githubSignalsProcessor = ctx.state.options?.githubSignals;
16797
- const runOperation = action === "unsubscribe" ? githubSignalsProcessor?.unsubscribeThreadFromPR : githubSignalsProcessor?.subscribeThreadToPR;
16798
- if (!runOperation) {
16826
+ if (!githubSignalsProcessor) {
16799
16827
  ctx.showError("GitHub signals are not available. Enable them in /settings and restart MastraCode.");
16800
16828
  return;
16801
16829
  }
16802
16830
  try {
16803
- const result = await runOperation.call(githubSignalsProcessor, {
16831
+ if (action === "unsubscribe") {
16832
+ const result = await githubSignalsProcessor.unsubscribeThreadFromPR({
16833
+ threadId: currentThread.threadId,
16834
+ resourceId: currentThread.resourceId,
16835
+ pr: parsed
16836
+ });
16837
+ const prefix = result.removed ? "Unsubscribed from" : "No subscription found for";
16838
+ ctx.showInfo(`${prefix} ${result.owner}/${result.repo}#${result.number}.`);
16839
+ return;
16840
+ }
16841
+ const result = await githubSignalsProcessor.subscribeThreadToPR({
16804
16842
  threadId: currentThread.threadId,
16805
16843
  resourceId: currentThread.resourceId,
16806
- pr: parsed
16844
+ pr: parsed,
16845
+ mode
16807
16846
  });
16808
- const prefix = action === "unsubscribe" ? result.removed ? "Unsubscribed from" : "No subscription found for" : "Subscribed to";
16809
- ctx.showInfo(`${prefix} ${result.owner}/${result.repo}#${result.number}.`);
16847
+ if (result.terminalState) {
16848
+ ctx.showInfo(`Not subscribed to ${result.owner}/${result.repo}#${result.number} in review mode because it is already ${result.terminalState}.`);
16849
+ return;
16850
+ }
16851
+ ctx.showInfo(`Subscribed to ${result.owner}/${result.repo}#${result.number} in ${normalizeGithubSubscriptionMode(result.mode)} mode.`);
16810
16852
  } catch (error) {
16811
16853
  ctx.showError(`Failed to ${action} GitHub PR: ${error instanceof Error ? error.message : String(error)}`);
16812
16854
  }
@@ -23959,4 +24001,4 @@ var MastraTUI = class MastraTUI {
23959
24001
  //#endregion
23960
24002
  export { mastraBrand as _, OMProgressComponent as a, ToolExecutionComponentEnhanced as c, detectTerminalTheme as d, applyThemeMode as f, mastra as g, getThemeMode as h, LoginDialogComponent as i, ModelSelectorComponent as l, getMarkdownTheme as m, createTUIState as n, formatOMStatus as o, getEditorTheme as p, LoginSelectorComponent as r, UserMessageComponent as s, MastraTUI as t, AssistantMessageComponent as u, restoreTerminalForeground as v, theme as y };
23961
24003
 
23962
- //# sourceMappingURL=tui-5ivxiFIl.js.map
24004
+ //# sourceMappingURL=tui-BaobOqGM.js.map