@selfagency/beans-mcp 0.1.0 → 0.1.1

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 (47) hide show
  1. package/.beans.yml +6 -0
  2. package/.claude/settings.local.json +18 -0
  3. package/.editorconfig +13 -0
  4. package/.github/workflows/release.yml +235 -0
  5. package/.github/workflows/test.yml +80 -0
  6. package/.husky/pre-commit +1 -0
  7. package/.nvmrc +1 -0
  8. package/.oxfmtrc.json +11 -0
  9. package/.oxlintrc.json +37 -0
  10. package/.vscode/settings.json +3 -0
  11. package/CHANGELOG.md +140 -0
  12. package/CONTRIBUTING.md +139 -0
  13. package/LICENSE.txt +21 -0
  14. package/README.md +4 -4
  15. package/dist/README.md +307 -0
  16. package/dist/beans-mcp-server.cjs.map +1 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.js +31676 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/package.json +43 -0
  21. package/package.json +64 -27
  22. package/pnpm-workspace.yaml +2 -0
  23. package/scripts/release.js +433 -0
  24. package/scripts/write-dist-package.js +53 -0
  25. package/src/cli.ts +14 -0
  26. package/src/index.ts +21 -0
  27. package/src/internal/graphql.ts +33 -0
  28. package/src/internal/queryHelpers.ts +157 -0
  29. package/src/server/BeansMcpServer.ts +600 -0
  30. package/src/server/backend.ts +358 -0
  31. package/src/test/BeansMcpServer.test.ts +514 -0
  32. package/src/test/handlers.unit.test.ts +184 -0
  33. package/src/test/parseCliArgs.test.ts +69 -0
  34. package/src/test/protocol.e2e.test.ts +884 -0
  35. package/src/test/queryHelpers.test.ts +524 -0
  36. package/src/test/startBeansMcpServer.test.ts +146 -0
  37. package/src/test/tools-integration.test.ts +912 -0
  38. package/src/test/utils.test.ts +80 -0
  39. package/src/types.ts +46 -0
  40. package/src/utils.ts +20 -0
  41. package/tsconfig.json +24 -0
  42. package/tsup.config.ts +42 -0
  43. package/vitest.config.ts +18 -0
  44. package/index.js +0 -15350
  45. /package/{beans-mcp-server.cjs → dist/beans-mcp-server.cjs} +0 -0
  46. /package/{index.cjs → dist/index.cjs} +0 -0
  47. /package/{index.d.ts → dist/index.d.ts} +0 -0
@@ -0,0 +1,69 @@
1
+ import { afterEach, describe, expect, it, vi } from 'vitest';
2
+ import { parseCliArgs } from '../server/BeansMcpServer';
3
+
4
+ describe('parseCliArgs', () => {
5
+ it('should parse workspace root positional argument', () => {
6
+ const result = parseCliArgs(['/workspace']);
7
+ expect(result.workspaceRoot).toBe('/workspace');
8
+ expect(result.cliPath).toBe('beans');
9
+ expect(result.workspaceExplicit).toBe(true);
10
+ });
11
+
12
+ it('should parse --workspace-root flag', () => {
13
+ const result = parseCliArgs(['--workspace-root', '/workspace']);
14
+ expect(result.workspaceRoot).toBe('/workspace');
15
+ expect(result.workspaceExplicit).toBe(true);
16
+ });
17
+
18
+ it('should mark workspaceExplicit false when no workspace arg given', () => {
19
+ const result = parseCliArgs([]);
20
+ expect(result.workspaceExplicit).toBe(false);
21
+ });
22
+
23
+ it('should parse --cli-path flag', () => {
24
+ const result = parseCliArgs(['--cli-path', '/usr/local/bin/beans']);
25
+ expect(result.cliPath).toBe('/usr/local/bin/beans');
26
+ });
27
+
28
+ it('should parse --port flag', () => {
29
+ const result = parseCliArgs(['--port', '8080']);
30
+ expect(result.port).toBe(8080);
31
+ });
32
+
33
+ it('should parse --log-dir flag', () => {
34
+ const result = parseCliArgs(['--log-dir', '/tmp/logs']);
35
+ expect(result.logDir).toBe('/tmp/logs');
36
+ });
37
+
38
+ it('should reject suspicious CLI paths', () => {
39
+ expect(() => {
40
+ parseCliArgs(['--cli-path', 'beans; rm -rf /']);
41
+ }).toThrow('Invalid CLI path');
42
+ });
43
+
44
+ describe('--help / -h', () => {
45
+ afterEach(() => {
46
+ vi.restoreAllMocks();
47
+ });
48
+
49
+ it('--help writes help text to stdout and exits with 0', () => {
50
+ const writeSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
51
+ const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => {}) as (code?: number) => never);
52
+
53
+ parseCliArgs(['--help']);
54
+
55
+ expect(writeSpy).toHaveBeenCalledWith(expect.stringContaining('Usage'));
56
+ expect(exitSpy).toHaveBeenCalledWith(0);
57
+ });
58
+
59
+ it('-h writes help text to stdout and exits with 0', () => {
60
+ const writeSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
61
+ const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => {}) as (code?: number) => never);
62
+
63
+ parseCliArgs(['-h']);
64
+
65
+ expect(writeSpy).toHaveBeenCalledWith(expect.stringContaining('Usage'));
66
+ expect(exitSpy).toHaveBeenCalledWith(0);
67
+ });
68
+ });
69
+ });