@tiny-fish/cli 0.24.1-next.212 → 0.25.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.
@@ -343,6 +343,40 @@ const grokEntrySchema = z.looseObject({
343
343
  headers: z.record(z.string(), z.unknown()).optional(),
344
344
  });
345
345
  const grokListSchema = z.array(grokEntrySchema);
346
+ // grok 0.0.60 reports `installed` whether a plugin is enabled or disabled.
347
+ const grokPluginSchema = z.array(z.looseObject({ name: z.string().optional() }));
348
+ /** The Grok plugin ships its own MCP server, and `grok mcp list` does not show it. */
349
+ function fromGrokPlugin() {
350
+ const probe = runProbe("grok", ["plugin", "list", "--json"]);
351
+ if (probe.outcome === "unavailable" || probe.exitCode !== 0)
352
+ return undefined;
353
+ let listed;
354
+ try {
355
+ listed = JSON.parse(probe.stdout);
356
+ }
357
+ catch {
358
+ // A build ignoring `--json` prints prose, which is no evidence either way.
359
+ return undefined;
360
+ }
361
+ // A future wrapper shape decodes fine and then reports "no plugin", which earns a `connect`
362
+ // repair that double-registers a working one. Anything but a list is unknown, not absent.
363
+ const shape = grokPluginSchema.safeParse(listed);
364
+ if (!shape.success) {
365
+ return {
366
+ registered: Registered.Unknown,
367
+ authMode: AuthMode.Unknown,
368
+ reason: "`grok plugin list --json` returned an unexpected shape",
369
+ };
370
+ }
371
+ if (!shape.data.some((plugin) => plugin.name === "tinyfish"))
372
+ return undefined;
373
+ // The plugin manifest carries no headers, so its only credential path is the browser sign-in.
374
+ return {
375
+ registered: Registered.Yes,
376
+ authMode: AuthMode.OAuth,
377
+ reason: "registered by the TinyFish Grok plugin",
378
+ };
379
+ }
346
380
  // Grok has no `mcp get`; `mcp list --json` is the only machine-readable view.
347
381
  function probeGrok() {
348
382
  const probe = runProbe("grok", ["mcp", "list", "--json"]);
@@ -376,7 +410,7 @@ function probeGrok() {
376
410
  }
377
411
  const entry = entries.find((server) => server.name === "tinyfish");
378
412
  if (!entry)
379
- return { registered: Registered.No, authMode: AuthMode.Unknown };
413
+ return fromGrokPlugin() ?? { registered: Registered.No, authMode: AuthMode.Unknown };
380
414
  // Grok drops X-API-Key when the server advertises OAuth metadata, so keys ride Authorization.
381
415
  const hasAuthorization = Object.keys(entry.headers ?? {}).some((name) => name.toLowerCase() === "authorization");
382
416
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.24.1-next.212",
3
+ "version": "0.25.0",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {