@selfagency/beans-mcp 0.1.3 → 0.4.2

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 (59) hide show
  1. package/README.md +63 -6
  2. package/{dist/beans-mcp-server.cjs → beans-mcp-server.cjs} +269 -34
  3. package/{dist/index.cjs → index.cjs} +269 -34
  4. package/{dist/index.d.ts → index.d.ts} +19 -1
  5. package/{dist/index.js → index.js} +269 -34
  6. package/package.json +28 -64
  7. package/.beans.yml +0 -6
  8. package/.claude/settings.local.json +0 -18
  9. package/.editorconfig +0 -13
  10. package/.github/dependabot.yml +0 -11
  11. package/.github/workflows/release.yml +0 -235
  12. package/.github/workflows/test.yml +0 -84
  13. package/.husky/pre-commit +0 -1
  14. package/.nvmrc +0 -1
  15. package/.oxfmtrc.json +0 -11
  16. package/.oxlintrc.json +0 -37
  17. package/.vscode/settings.json +0 -3
  18. package/CHANGELOG.md +0 -160
  19. package/CONTRIBUTING.md +0 -139
  20. package/LICENSE.txt +0 -21
  21. package/codeql/codeql-custom-queries-actions/README.md +0 -14
  22. package/codeql/codeql-custom-queries-actions/codeql-pack.lock.yml +0 -32
  23. package/codeql/codeql-custom-queries-actions/codeql-pack.yml +0 -7
  24. package/codeql/codeql-custom-queries-actions/qlpack.yml +0 -6
  25. package/codeql/codeql-custom-queries-actions/queries/github-script-without-tojson.ql +0 -18
  26. package/codeql/codeql-custom-queries-actions/queries/strict-external-action-pinning.ql +0 -18
  27. package/codeql/codeql-custom-queries-javascript/README.md +0 -14
  28. package/codeql/codeql-custom-queries-javascript/codeql-pack.lock.yml +0 -30
  29. package/codeql/codeql-custom-queries-javascript/codeql-pack.yml +0 -7
  30. package/codeql/codeql-custom-queries-javascript/qlpack.yml +0 -6
  31. package/codeql/codeql-custom-queries-javascript/queries/child-process-shell-apis.ql +0 -26
  32. package/codeql/codeql-custom-queries-javascript/queries/innerhtml-assignment.ql +0 -24
  33. package/dist/README.md +0 -307
  34. package/dist/beans-mcp-server.cjs.map +0 -1
  35. package/dist/index.cjs.map +0 -1
  36. package/dist/index.js.map +0 -1
  37. package/dist/package.json +0 -43
  38. package/pnpm-workspace.yaml +0 -2
  39. package/scripts/release.js +0 -433
  40. package/scripts/write-dist-package.js +0 -53
  41. package/src/cli.ts +0 -14
  42. package/src/index.ts +0 -21
  43. package/src/internal/graphql.ts +0 -33
  44. package/src/internal/queryHelpers.ts +0 -157
  45. package/src/server/BeansMcpServer.ts +0 -623
  46. package/src/server/backend.ts +0 -364
  47. package/src/test/BeansMcpServer.test.ts +0 -514
  48. package/src/test/handlers.unit.test.ts +0 -201
  49. package/src/test/parseCliArgs.test.ts +0 -69
  50. package/src/test/protocol.e2e.test.ts +0 -884
  51. package/src/test/queryHelpers.test.ts +0 -524
  52. package/src/test/startBeansMcpServer.test.ts +0 -146
  53. package/src/test/tools-integration.test.ts +0 -912
  54. package/src/test/utils.test.ts +0 -81
  55. package/src/types.ts +0 -46
  56. package/src/utils.ts +0 -20
  57. package/tsconfig.json +0 -24
  58. package/tsup.config.ts +0 -42
  59. package/vitest.config.ts +0 -18
@@ -1,81 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { isPathWithinRoot, makeTextAndStructured } from '../utils';
3
-
4
- describe('isPathWithinRoot', () => {
5
- it('should return true for paths within root', () => {
6
- const root = '/workspace/.beans';
7
- const target = '/workspace/.beans/file.md';
8
- expect(isPathWithinRoot(root, target)).toBe(true);
9
- });
10
-
11
- it('should return false for paths outside root', () => {
12
- const root = '/workspace/.beans';
13
- const target = '/workspace/outside.md';
14
- expect(isPathWithinRoot(root, target)).toBe(false);
15
- });
16
-
17
- it('should return false for paths with parent traversal', () => {
18
- const root = '/workspace/.beans';
19
- const target = '/workspace/.beans/../../etc/passwd';
20
- expect(isPathWithinRoot(root, target)).toBe(false);
21
- });
22
-
23
- it('should handle relative path normalization', () => {
24
- const root = '/workspace/.beans/';
25
- const target = '/workspace/.beans/subdir/file.md';
26
- expect(isPathWithinRoot(root, target)).toBe(true);
27
- });
28
-
29
- it('should return false when root and target are the same', () => {
30
- const root = '/workspace/.beans';
31
- const target = '/workspace/.beans';
32
- expect(isPathWithinRoot(root, target)).toBe(false);
33
- });
34
-
35
- it('should handle paths with trailing slashes', () => {
36
- const root = '/workspace/.beans/';
37
- const target = '/workspace/.beans/file.md';
38
- expect(isPathWithinRoot(root, target)).toBe(true);
39
- });
40
- });
41
-
42
- describe('makeTextAndStructured', () => {
43
- it('should serialize object as JSON text', () => {
44
- const input = { name: 'test', value: 42 } as const;
45
- const result = makeTextAndStructured(input);
46
-
47
- expect(result.content).toHaveLength(1);
48
- expect(result.content[0].type).toBe('text');
49
- expect(() => JSON.parse(result.content[0].text)).not.toThrow();
50
- expect(JSON.parse(result.content[0].text)).toEqual(input);
51
- });
52
-
53
- it('should preserve arbitrary fields', () => {
54
- const input = { message: 'Operation completed', extra: { ok: true } } as const;
55
- const result = makeTextAndStructured(input as any);
56
- expect(JSON.parse(result.content[0].text)).toEqual(input);
57
- });
58
-
59
- it('should include nested bean objects in JSON text', () => {
60
- const input = { bean: { id: 'b1', title: 'My Bean' } } as const;
61
- const result = makeTextAndStructured(input as any);
62
- const parsed = JSON.parse(result.content[0].text);
63
- expect(parsed).toEqual(input);
64
- });
65
-
66
- it('should handle arrays in JSON text', () => {
67
- const input = { items: [1, 2, 3] };
68
- const result = makeTextAndStructured(input);
69
- const parsed = JSON.parse(result.content[0].text);
70
- expect(parsed.items).toEqual([1, 2, 3]);
71
- });
72
-
73
- it('should handle null and undefined values', () => {
74
- const input = { nullValue: null, undefinedValue: undefined } as any;
75
- const result = makeTextAndStructured(input);
76
- const parsed = JSON.parse(result.content[0].text);
77
- expect(parsed.nullValue).toBeNull();
78
- // Note: undefined properties are omitted by JSON.stringify
79
- expect(Object.prototype.hasOwnProperty.call(parsed, 'undefinedValue')).toBe(false);
80
- });
81
- });
package/src/types.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * Public types for beans-mcp-server
3
- */
4
-
5
- export type SortMode =
6
- | "status-priority-type-title"
7
- | "updated"
8
- | "created"
9
- | "id";
10
-
11
- export type BeanRecord = {
12
- id: string;
13
- slug: string;
14
- path: string;
15
- title: string;
16
- body: string;
17
- status: string;
18
- type: string;
19
- description?: string;
20
- priority?: string;
21
- tags?: string[];
22
- parentId?: string;
23
- blockingIds?: string[];
24
- blockedByIds?: string[];
25
- createdAt?: string;
26
- updatedAt?: string;
27
- etag?: string;
28
- };
29
-
30
- /**
31
- * GraphQL error shape as returned by the Beans CLI GraphQL endpoint.
32
- */
33
- export type GraphQLError = {
34
- message: string;
35
- locations?: Array<{ line: number; column: number }>;
36
- path?: Array<string | number>;
37
- extensions?: Record<string, unknown>;
38
- };
39
-
40
- export const DEFAULT_MCP_PORT = 39173;
41
-
42
- export const MAX_ID_LENGTH = 128;
43
- export const MAX_TITLE_LENGTH = 1024;
44
- export const MAX_METADATA_LENGTH = 128;
45
- export const MAX_DESCRIPTION_LENGTH = 65536; // 64KB
46
- export const MAX_PATH_LENGTH = 1024;
package/src/utils.ts DELETED
@@ -1,20 +0,0 @@
1
- import { isAbsolute, relative, resolve } from 'node:path';
2
-
3
- /**
4
- * Check whether `target` is contained within `root` after resolving both paths.
5
- * Guards against the Windows cross-drive bypass where `path.relative(root, target)`
6
- * returns an absolute path (e.g. `D:\evil`) that does not start with `..`.
7
- */
8
- export function isPathWithinRoot(root: string, target: string): boolean {
9
- const resolvedRoot = resolve(root);
10
- const resolvedTarget = resolve(target);
11
- const rel = relative(resolvedRoot, resolvedTarget);
12
- return !!rel && !rel.startsWith('..') && !isAbsolute(rel);
13
- }
14
-
15
- export function makeTextAndStructured<T extends Record<string, unknown>>(value: T) {
16
- // Return JSON in text content only to avoid duplicate rendering in some clients.
17
- return {
18
- content: [{ type: 'text' as const, text: JSON.stringify(value, null, 2) }],
19
- };
20
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "lib": ["ES2022"],
6
- "declaration": true,
7
- "declarationMap": true,
8
- "outDir": "./dist",
9
- "rootDir": "./src",
10
- "moduleResolution": "bundler",
11
- "resolveJsonModule": true,
12
- "strict": true,
13
- "esModuleInterop": true,
14
- "skipLibCheck": true,
15
- "forceConsistentCasingInFileNames": true,
16
- "noUnusedLocals": true,
17
- "noUnusedParameters": true,
18
- "noImplicitReturns": true,
19
- "noFallthroughCasesInSwitch": true,
20
- "allowSyntheticDefaultImports": true
21
- },
22
- "include": ["src/**/*.ts"],
23
- "exclude": ["src/**/*.test.ts", "dist", "node_modules"]
24
- }
package/tsup.config.ts DELETED
@@ -1,42 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
-
3
- export default defineConfig([
4
- {
5
- // ESM library entry point
6
- entry: { index: 'src/index.ts' },
7
- format: ['esm'],
8
- outDir: 'dist',
9
- target: 'node18',
10
- splitting: false,
11
- dts: true,
12
- sourcemap: process.env.NODE_ENV !== 'production',
13
- clean: true,
14
- },
15
- {
16
- // CJS library entry point
17
- entry: { index: 'src/index.ts' },
18
- format: ['cjs'],
19
- outDir: 'dist',
20
- outExtension: () => ({ js: '.cjs' }),
21
- target: 'node18',
22
- splitting: false,
23
- cjsInterop: true,
24
- dts: false,
25
- sourcemap: process.env.NODE_ENV !== 'production',
26
- },
27
- {
28
- // CLI binary entry point
29
- entry: { 'beans-mcp-server': 'src/cli.ts' },
30
- format: ['cjs'],
31
- outDir: 'dist',
32
- outExtension: () => ({ js: '.cjs' }),
33
- target: 'node18',
34
- splitting: false,
35
- cjsInterop: true,
36
- dts: false,
37
- sourcemap: process.env.NODE_ENV !== 'production',
38
- banner: {
39
- js: '#!/usr/bin/env node',
40
- },
41
- },
42
- ]);
package/vitest.config.ts DELETED
@@ -1,18 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: false,
6
- environment: "node",
7
- coverage: {
8
- provider: "v8",
9
- reporter: ["text", "json", "html"],
10
- exclude: [
11
- "node_modules/",
12
- "dist/",
13
- "src/**/*.test.ts",
14
- "src/server/backend.ts",
15
- ],
16
- },
17
- },
18
- });