@paretools/ruby 0.11.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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +11 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/formatters.d.ts +90 -0
  7. package/dist/lib/formatters.d.ts.map +1 -0
  8. package/dist/lib/formatters.js +206 -0
  9. package/dist/lib/formatters.js.map +1 -0
  10. package/dist/lib/parsers.d.ts +37 -0
  11. package/dist/lib/parsers.d.ts.map +1 -0
  12. package/dist/lib/parsers.js +134 -0
  13. package/dist/lib/parsers.js.map +1 -0
  14. package/dist/lib/ruby-runner.d.ts +8 -0
  15. package/dist/lib/ruby-runner.d.ts.map +1 -0
  16. package/dist/lib/ruby-runner.js +14 -0
  17. package/dist/lib/ruby-runner.js.map +1 -0
  18. package/dist/schemas/index.d.ts +88 -0
  19. package/dist/schemas/index.d.ts.map +1 -0
  20. package/dist/schemas/index.js +81 -0
  21. package/dist/schemas/index.js.map +1 -0
  22. package/dist/tools/bundle-check.d.ts +4 -0
  23. package/dist/tools/bundle-check.d.ts.map +1 -0
  24. package/dist/tools/bundle-check.js +24 -0
  25. package/dist/tools/bundle-check.js.map +1 -0
  26. package/dist/tools/bundle-exec.d.ts +4 -0
  27. package/dist/tools/bundle-exec.d.ts.map +1 -0
  28. package/dist/tools/bundle-exec.js +56 -0
  29. package/dist/tools/bundle-exec.js.map +1 -0
  30. package/dist/tools/bundle-install.d.ts +4 -0
  31. package/dist/tools/bundle-install.d.ts.map +1 -0
  32. package/dist/tools/bundle-install.js +26 -0
  33. package/dist/tools/bundle-install.js.map +1 -0
  34. package/dist/tools/check.d.ts +4 -0
  35. package/dist/tools/check.d.ts.map +1 -0
  36. package/dist/tools/check.js +30 -0
  37. package/dist/tools/check.js.map +1 -0
  38. package/dist/tools/gem-install.d.ts +4 -0
  39. package/dist/tools/gem-install.d.ts.map +1 -0
  40. package/dist/tools/gem-install.js +39 -0
  41. package/dist/tools/gem-install.js.map +1 -0
  42. package/dist/tools/gem-list.d.ts +4 -0
  43. package/dist/tools/gem-list.d.ts.map +1 -0
  44. package/dist/tools/gem-list.js +41 -0
  45. package/dist/tools/gem-list.js.map +1 -0
  46. package/dist/tools/gem-outdated.d.ts +4 -0
  47. package/dist/tools/gem-outdated.d.ts.map +1 -0
  48. package/dist/tools/gem-outdated.js +24 -0
  49. package/dist/tools/gem-outdated.js.map +1 -0
  50. package/dist/tools/index.d.ts +4 -0
  51. package/dist/tools/index.d.ts.map +1 -0
  52. package/dist/tools/index.js +30 -0
  53. package/dist/tools/index.js.map +1 -0
  54. package/dist/tools/run.d.ts +4 -0
  55. package/dist/tools/run.d.ts.map +1 -0
  56. package/dist/tools/run.js +50 -0
  57. package/dist/tools/run.js.map +1 -0
  58. package/package.json +71 -0
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, projectPathInput, } from "@paretools/shared";
3
+ import { rubyCmd } from "../lib/ruby-runner.js";
4
+ import { parseRunOutput } from "../lib/parsers.js";
5
+ import { formatRun, compactRunMap, formatRunCompact } from "../lib/formatters.js";
6
+ import { RubyRunResultSchema } from "../schemas/index.js";
7
+ /** Registers the `run` tool on the given MCP server. */
8
+ export function registerRunTool(server) {
9
+ server.registerTool("run", {
10
+ title: "Ruby Run",
11
+ description: "Executes a Ruby script file and returns structured output (stdout, stderr, exit code, duration).",
12
+ inputSchema: {
13
+ file: z.string().max(INPUT_LIMITS.PATH_MAX).describe("Path to the Ruby file to execute"),
14
+ args: z
15
+ .array(z.string().max(INPUT_LIMITS.STRING_MAX))
16
+ .max(INPUT_LIMITS.ARRAY_MAX)
17
+ .optional()
18
+ .default([])
19
+ .describe("Arguments to pass to the Ruby script"),
20
+ path: projectPathInput,
21
+ compact: compactInput,
22
+ },
23
+ outputSchema: RubyRunResultSchema,
24
+ }, async ({ file, args, path, compact }) => {
25
+ assertNoFlagInjection(file, "file");
26
+ const cwd = path || process.cwd();
27
+ const cmdArgs = [file, ...(args || [])];
28
+ const start = Date.now();
29
+ let timedOut = false;
30
+ let result;
31
+ try {
32
+ result = await rubyCmd(cmdArgs, cwd);
33
+ }
34
+ catch (err) {
35
+ const errMsg = err instanceof Error ? err.message : String(err);
36
+ if (errMsg.includes("timed out")) {
37
+ timedOut = true;
38
+ result = { exitCode: 124, stdout: "", stderr: errMsg };
39
+ }
40
+ else {
41
+ throw err;
42
+ }
43
+ }
44
+ const duration = Date.now() - start;
45
+ const data = parseRunOutput(file, result.stdout, result.stderr, result.exitCode, duration, timedOut);
46
+ const rawOutput = (result.stdout + "\n" + result.stderr).trim();
47
+ return compactDualOutput(data, rawOutput, formatRun, compactRunMap, formatRunCompact, compact === false);
48
+ });
49
+ }
50
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,YAAY,CACjB,KAAK,EACL;QACE,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,kGAAkG;QACpG,WAAW,EAAE;YACX,IAAI,EAAE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G,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACzD,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAEpC,MAAM,IAAI,GAAG,cAAc,CACzB,IAAI,EACJ,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,EACf,QAAQ,EACR,QAAQ,CACT,CAAC;QACF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@paretools/ruby",
3
+ "version": "0.11.0",
4
+ "mcpName": "io.github.Dave-London/pare-ruby",
5
+ "description": "MCP server for Ruby and Bundler operations with structured, token-efficient output",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "mcp",
9
+ "mcp-server",
10
+ "model-context-protocol",
11
+ "structured-output",
12
+ "ai",
13
+ "ai-agent",
14
+ "claude",
15
+ "cursor",
16
+ "copilot",
17
+ "token-efficient",
18
+ "devtools",
19
+ "cli",
20
+ "ruby",
21
+ "bundler",
22
+ "gem",
23
+ "rake"
24
+ ],
25
+ "homepage": "https://github.com/Dave-London/Pare/tree/main/packages/server-ruby",
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "type": "module",
30
+ "bin": {
31
+ "pare-ruby": "./dist/index.js"
32
+ },
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ }
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/Dave-London/Pare.git",
45
+ "directory": "packages/server-ruby"
46
+ },
47
+ "bugs": {
48
+ "url": "https://github.com/Dave-London/Pare/issues"
49
+ },
50
+ "files": [
51
+ "dist"
52
+ ],
53
+ "dependencies": {
54
+ "@modelcontextprotocol/sdk": "^1.26.0",
55
+ "zod": "^4.3.6",
56
+ "@paretools/shared": "0.11.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^25.2.3",
60
+ "typescript": "^5.7.0",
61
+ "vitest": "^4.0.18",
62
+ "@paretools/tsconfig": "0.0.0"
63
+ },
64
+ "scripts": {
65
+ "build": "tsc",
66
+ "test": "vitest run",
67
+ "test:watch": "vitest",
68
+ "coverage": "vitest run --coverage",
69
+ "lint": "eslint src/"
70
+ }
71
+ }