@atlassian/mcp-compressor 0.28.0 → 0.29.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.
@@ -1,5 +1,5 @@
1
1
  import { defineCommand } from "just-bash";
2
- import { parseToolArgv } from "./rust_core.js";
2
+ import { parseToolArgv, renderCliSubcommandHelp, renderCliTopLevelHelp, } from "./rust_core.js";
3
3
  import { normalizeStructuredArgValues } from "./tool_specs.js";
4
4
  export function createJustBashCommandRegistrations(sources) {
5
5
  const grouped = new Map();
@@ -21,13 +21,21 @@ export function createJustBashCommandRegistrations(sources) {
21
21
  command: defineCommand(providerName, async (args) => {
22
22
  try {
23
23
  const [subcommand, ...toolArgs] = args;
24
- if (subcommand === undefined || subcommand === "--help" || subcommand === "-h") {
25
- return output(dispatcherHelp(providerName, providerSources));
24
+ if (subcommand === undefined ||
25
+ subcommand === "--help" ||
26
+ subcommand === "-h" ||
27
+ subcommand === "help") {
28
+ return output(renderCliTopLevelHelp(providerName, providerName, providerSources.map((source) => source.tool)));
26
29
  }
27
30
  const source = bySubcommand.get(subcommand);
28
31
  if (source === undefined) {
29
32
  throw new Error(`Unknown ${providerName} subcommand: ${subcommand}`);
30
33
  }
34
+ // Per-subcommand help must match the generated CLI's rich `--help`
35
+ // output, so render it from the shared Rust renderer.
36
+ if (toolArgs.includes("--help") || toolArgs.includes("-h")) {
37
+ return output(renderCliSubcommandHelp(providerName, source.tool));
38
+ }
31
39
  const parsedInput = parseToolArgv(source.tool, toolArgs);
32
40
  const toolInput = normalizeStructuredArgValues(source.tool.inputSchema, parsedInput);
33
41
  return output(await source.invoke(toolInput));
@@ -52,22 +60,6 @@ export function installJustBashRegistrations(bash, registrations) {
52
60
  ];
53
61
  }
54
62
  }
55
- function dispatcherHelp(providerName, sources) {
56
- const maxNameLength = Math.max(...sources.map((source) => source.backendToolName.replaceAll("_", "-").length), 0);
57
- return [
58
- `${providerName} - the ${providerName} toolset`,
59
- "",
60
- "USAGE:",
61
- ` ${providerName} <subcommand> [options]`,
62
- "",
63
- "SUBCOMMANDS:",
64
- ...sources.map((source) => {
65
- const description = (source.tool.description ?? "").replace(/\s+/g, " ").trim();
66
- const subcommand = source.backendToolName.replaceAll("_", "-");
67
- return ` ${subcommand.padEnd(maxNameLength + 2)}${description}`.trimEnd();
68
- }),
69
- ].join("\n");
70
- }
71
63
  function output(stdout) {
72
64
  return { stdout: `${stdout}\n`, stderr: "", exitCode: 0 };
73
65
  }
package/dist/native.d.ts CHANGED
@@ -8,6 +8,8 @@ export interface NativeCore {
8
8
  formatToolSchemaResponseJson(toolJson: string): string;
9
9
  maybeToonifyOutputJson(output: string): string;
10
10
  parseToolArgvJson(toolJson: string, argvJson: string): string;
11
+ renderCliTopLevelHelpJson(command: string, cliName: string, toolsJson: string): string;
12
+ renderCliSubcommandHelpJson(cliName: string, toolJson: string): string;
11
13
  generateClientArtifactsJson(kind: string, configJson: string): string;
12
14
  generateClientArtifactFilesJson(kind: string, configJson: string): string;
13
15
  buildHostTransformPlanJson(configJson: string): string;
@@ -8,6 +8,17 @@ export declare function compressToolListing(level: string, tools: ToolSpec[]): s
8
8
  export declare function formatToolSchemaResponse(tool: ToolSpec): string;
9
9
  export declare function maybeToonifyOutput(output: string): string;
10
10
  export declare function parseToolArgv(tool: ToolSpec, argv: string[]): Record<string, unknown>;
11
+ /**
12
+ * Render the shared top-level CLI help text (`<command> --help`). Backed by the
13
+ * same Rust renderer used for the generated CLI script and the `*_help` tool
14
+ * description, so all transform modes stay in sync.
15
+ */
16
+ export declare function renderCliTopLevelHelp(command: string, cliName: string, tools: ToolSpec[]): string;
17
+ /**
18
+ * Render the shared rich per-subcommand CLI help text
19
+ * (`<command> <subcommand> --help`).
20
+ */
21
+ export declare function renderCliSubcommandHelp(cliName: string, tool: ToolSpec): string;
11
22
  export type ClientArtifactKind = "cli" | "python" | "typescript";
12
23
  export interface ClientGeneratorConfig {
13
24
  cliName: string;
package/dist/rust_core.js CHANGED
@@ -21,6 +21,21 @@ export function maybeToonifyOutput(output) {
21
21
  export function parseToolArgv(tool, argv) {
22
22
  return JSON.parse(loadNativeCore().parseToolArgvJson(stringify(toNativeTool(tool)), stringify(argv)));
23
23
  }
24
+ /**
25
+ * Render the shared top-level CLI help text (`<command> --help`). Backed by the
26
+ * same Rust renderer used for the generated CLI script and the `*_help` tool
27
+ * description, so all transform modes stay in sync.
28
+ */
29
+ export function renderCliTopLevelHelp(command, cliName, tools) {
30
+ return loadNativeCore().renderCliTopLevelHelpJson(command, cliName, stringify(tools.map(toNativeTool)));
31
+ }
32
+ /**
33
+ * Render the shared rich per-subcommand CLI help text
34
+ * (`<command> <subcommand> --help`).
35
+ */
36
+ export function renderCliSubcommandHelp(cliName, tool) {
37
+ return loadNativeCore().renderCliSubcommandHelpJson(cliName, stringify(toNativeTool(tool)));
38
+ }
24
39
  function toNativeGeneratorConfig(config) {
25
40
  return {
26
41
  cli_name: config.cliName,
package/native/index.d.ts CHANGED
@@ -32,6 +32,10 @@ export declare function parseToolArgvJson(toolJson: string, argvJson: string): s
32
32
 
33
33
  export declare function rememberOauthBackendJson(backendUri: string, backendName: string, storeDir: string): void
34
34
 
35
+ export declare function renderCliSubcommandHelpJson(cliName: string, toolJson: string): string
36
+
37
+ export declare function renderCliTopLevelHelpJson(command: string, cliName: string, toolsJson: string): string
38
+
35
39
  export declare function startCompressedSessionFromMcpConfigJson(configJson: string, mcpConfigJson: string): Promise<NativeCompressedSession>
36
40
 
37
41
  export declare function startCompressedSessionJson(configJson: string, backendsJson: string): Promise<NativeCompressedSession>
Binary file
Binary file
package/native/index.js CHANGED
@@ -590,6 +590,8 @@ module.exports.normalizeServersJson = nativeBinding.normalizeServersJson
590
590
  module.exports.parseMcpConfigJson = nativeBinding.parseMcpConfigJson
591
591
  module.exports.parseToolArgvJson = nativeBinding.parseToolArgvJson
592
592
  module.exports.rememberOauthBackendJson = nativeBinding.rememberOauthBackendJson
593
+ module.exports.renderCliSubcommandHelpJson = nativeBinding.renderCliSubcommandHelpJson
594
+ module.exports.renderCliTopLevelHelpJson = nativeBinding.renderCliTopLevelHelpJson
593
595
  module.exports.startCompressedSessionFromMcpConfigJson = nativeBinding.startCompressedSessionFromMcpConfigJson
594
596
  module.exports.startCompressedSessionJson = nativeBinding.startCompressedSessionJson
595
597
  module.exports.startCompressedSessionWithProviderBackendsJson = nativeBinding.startCompressedSessionWithProviderBackendsJson
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/mcp-compressor",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "TypeScript MCP server wrapper for reducing tokens consumed by MCP tools.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/atlassian-labs/mcp-compressor",