@bluelibs/runner-dev 4.0.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.
- package/AI.md +411 -0
- package/README.md +1103 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +58 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/documentation.d.ts +8 -0
- package/dist/client/documentation.js +144 -0
- package/dist/client/documentation.js.map +1 -0
- package/dist/components/Documentation/Documentation.d.ts +8 -0
- package/dist/components/Documentation/Documentation.js +283 -0
- package/dist/components/Documentation/Documentation.js.map +1 -0
- package/dist/components/Documentation/components/DiagnosticsPanel.d.ts +7 -0
- package/dist/components/Documentation/components/DiagnosticsPanel.js +126 -0
- package/dist/components/Documentation/components/DiagnosticsPanel.js.map +1 -0
- package/dist/components/Documentation/components/EventCard.d.ts +8 -0
- package/dist/components/Documentation/components/EventCard.js +164 -0
- package/dist/components/Documentation/components/EventCard.js.map +1 -0
- package/dist/components/Documentation/components/HookCard.d.ts +8 -0
- package/dist/components/Documentation/components/HookCard.js +111 -0
- package/dist/components/Documentation/components/HookCard.js.map +1 -0
- package/dist/components/Documentation/components/MiddlewareCard.d.ts +8 -0
- package/dist/components/Documentation/components/MiddlewareCard.js +159 -0
- package/dist/components/Documentation/components/MiddlewareCard.js.map +1 -0
- package/dist/components/Documentation/components/ResourceCard.d.ts +8 -0
- package/dist/components/Documentation/components/ResourceCard.js +94 -0
- package/dist/components/Documentation/components/ResourceCard.js.map +1 -0
- package/dist/components/Documentation/components/Sidebar.d.ts +13 -0
- package/dist/components/Documentation/components/Sidebar.js +129 -0
- package/dist/components/Documentation/components/Sidebar.js.map +1 -0
- package/dist/components/Documentation/components/TagCard.d.ts +7 -0
- package/dist/components/Documentation/components/TagCard.js +75 -0
- package/dist/components/Documentation/components/TagCard.js.map +1 -0
- package/dist/components/Documentation/components/TaskCard.d.ts +8 -0
- package/dist/components/Documentation/components/TaskCard.js +77 -0
- package/dist/components/Documentation/components/TaskCard.js.map +1 -0
- package/dist/components/Documentation/index.d.ts +2 -0
- package/dist/components/Documentation/index.js +6 -0
- package/dist/components/Documentation/index.js.map +1 -0
- package/dist/components/Documentation/utils/formatting.d.ts +8 -0
- package/dist/components/Documentation/utils/formatting.js +84 -0
- package/dist/components/Documentation/utils/formatting.js.map +1 -0
- package/dist/components/ExampleComponent.d.ts +10 -0
- package/dist/components/ExampleComponent.js +48 -0
- package/dist/components/ExampleComponent.js.map +1 -0
- package/dist/generated/resolvers-types.d.ts +1523 -0
- package/dist/generated/resolvers-types.js +3 -0
- package/dist/generated/resolvers-types.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +3 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/env.d.ts +5 -0
- package/dist/mcp/env.js +42 -0
- package/dist/mcp/env.js.map +1 -0
- package/dist/mcp/format.d.ts +50 -0
- package/dist/mcp/format.js +249 -0
- package/dist/mcp/format.js.map +1 -0
- package/dist/mcp/help.d.ts +20 -0
- package/dist/mcp/help.js +121 -0
- package/dist/mcp/help.js.map +1 -0
- package/dist/mcp/http.d.ts +6 -0
- package/dist/mcp/http.js +47 -0
- package/dist/mcp/http.js.map +1 -0
- package/dist/mcp/projectOverview.d.ts +2 -0
- package/dist/mcp/projectOverview.js +210 -0
- package/dist/mcp/projectOverview.js.map +1 -0
- package/dist/mcp/schema.d.ts +1 -0
- package/dist/mcp/schema.js +17 -0
- package/dist/mcp/schema.js.map +1 -0
- package/dist/mcp/tools/graphql.introspect.d.ts +2 -0
- package/dist/mcp/tools/graphql.introspect.js +19 -0
- package/dist/mcp/tools/graphql.introspect.js.map +1 -0
- package/dist/mcp/tools/graphql.mutation.d.ts +2 -0
- package/dist/mcp/tools/graphql.mutation.js +43 -0
- package/dist/mcp/tools/graphql.mutation.js.map +1 -0
- package/dist/mcp/tools/graphql.ping.d.ts +2 -0
- package/dist/mcp/tools/graphql.ping.js +23 -0
- package/dist/mcp/tools/graphql.ping.js.map +1 -0
- package/dist/mcp/tools/graphql.query.d.ts +2 -0
- package/dist/mcp/tools/graphql.query.js +42 -0
- package/dist/mcp/tools/graphql.query.js.map +1 -0
- package/dist/mcp/tools/graphql.schemaSdl.d.ts +2 -0
- package/dist/mcp/tools/graphql.schemaSdl.js +15 -0
- package/dist/mcp/tools/graphql.schemaSdl.js.map +1 -0
- package/dist/mcp/tools/help.read.d.ts +2 -0
- package/dist/mcp/tools/help.read.js +67 -0
- package/dist/mcp/tools/help.read.js.map +1 -0
- package/dist/mcp/tools/help.runner.d.ts +2 -0
- package/dist/mcp/tools/help.runner.js +55 -0
- package/dist/mcp/tools/help.runner.js.map +1 -0
- package/dist/mcp/tools/help.runnerDev.d.ts +2 -0
- package/dist/mcp/tools/help.runnerDev.js +56 -0
- package/dist/mcp/tools/help.runnerDev.js.map +1 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +75 -0
- package/dist/mcp.js.map +1 -0
- package/dist/resources/dev.resource.d.ts +5 -0
- package/dist/resources/dev.resource.js +26 -0
- package/dist/resources/dev.resource.js.map +1 -0
- package/dist/resources/docs.generator.resource.d.ts +17 -0
- package/dist/resources/docs.generator.resource.js +230 -0
- package/dist/resources/docs.generator.resource.js.map +1 -0
- package/dist/resources/graphql-accumulator.resource.d.ts +7 -0
- package/dist/resources/graphql-accumulator.resource.js +41 -0
- package/dist/resources/graphql-accumulator.resource.js.map +1 -0
- package/dist/resources/introspector.resource.d.ts +129 -0
- package/dist/resources/introspector.resource.js +266 -0
- package/dist/resources/introspector.resource.js.map +1 -0
- package/dist/resources/introspector.tools.d.ts +47 -0
- package/dist/resources/introspector.tools.js +505 -0
- package/dist/resources/introspector.tools.js.map +1 -0
- package/dist/resources/live.resource.d.ts +80 -0
- package/dist/resources/live.resource.js +231 -0
- package/dist/resources/live.resource.js.map +1 -0
- package/dist/resources/server.resource.d.ts +38 -0
- package/dist/resources/server.resource.js +106 -0
- package/dist/resources/server.resource.js.map +1 -0
- package/dist/resources/swap.resource.d.ts +43 -0
- package/dist/resources/swap.resource.js +251 -0
- package/dist/resources/swap.resource.js.map +1 -0
- package/dist/resources/swap.tools.d.ts +31 -0
- package/dist/resources/swap.tools.js +207 -0
- package/dist/resources/swap.tools.js.map +1 -0
- package/dist/resources/telemetry.chain.d.ts +13 -0
- package/dist/resources/telemetry.chain.js +32 -0
- package/dist/resources/telemetry.chain.js.map +1 -0
- package/dist/resources/telemetry.resource.d.ts +1 -0
- package/dist/resources/telemetry.resource.js +90 -0
- package/dist/resources/telemetry.resource.js.map +1 -0
- package/dist/schema/context.d.ts +11 -0
- package/dist/schema/context.js +3 -0
- package/dist/schema/context.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.js +72 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/model.d.ts +97 -0
- package/dist/schema/model.js +5 -0
- package/dist/schema/model.js.map +1 -0
- package/dist/schema/mutation.d.ts +3 -0
- package/dist/schema/mutation.js +112 -0
- package/dist/schema/mutation.js.map +1 -0
- package/dist/schema/query.d.ts +3 -0
- package/dist/schema/query.js +295 -0
- package/dist/schema/query.js.map +1 -0
- package/dist/schema/types/AllType.d.ts +3 -0
- package/dist/schema/types/AllType.js +149 -0
- package/dist/schema/types/AllType.js.map +1 -0
- package/dist/schema/types/BaseElementCommon.d.ts +11 -0
- package/dist/schema/types/BaseElementCommon.js +61 -0
- package/dist/schema/types/BaseElementCommon.js.map +1 -0
- package/dist/schema/types/DiagnosticsType.d.ts +2 -0
- package/dist/schema/types/DiagnosticsType.js +15 -0
- package/dist/schema/types/DiagnosticsType.js.map +1 -0
- package/dist/schema/types/EventType.d.ts +4 -0
- package/dist/schema/types/EventType.js +97 -0
- package/dist/schema/types/EventType.js.map +1 -0
- package/dist/schema/types/HookType.d.ts +4 -0
- package/dist/schema/types/HookType.js +123 -0
- package/dist/schema/types/HookType.js.map +1 -0
- package/dist/schema/types/LiveType.d.ts +33 -0
- package/dist/schema/types/LiveType.js +553 -0
- package/dist/schema/types/LiveType.js.map +1 -0
- package/dist/schema/types/MetaType.d.ts +3 -0
- package/dist/schema/types/MetaType.js +31 -0
- package/dist/schema/types/MetaType.js.map +1 -0
- package/dist/schema/types/MiddlewareType.d.ts +4 -0
- package/dist/schema/types/MiddlewareType.js +26 -0
- package/dist/schema/types/MiddlewareType.js.map +1 -0
- package/dist/schema/types/ResourceType.d.ts +2 -0
- package/dist/schema/types/ResourceType.js +145 -0
- package/dist/schema/types/ResourceType.js.map +1 -0
- package/dist/schema/types/RunTypes.d.ts +7 -0
- package/dist/schema/types/RunTypes.js +95 -0
- package/dist/schema/types/RunTypes.js.map +1 -0
- package/dist/schema/types/SwapType.d.ts +5 -0
- package/dist/schema/types/SwapType.js +42 -0
- package/dist/schema/types/SwapType.js.map +1 -0
- package/dist/schema/types/TagType.d.ts +6 -0
- package/dist/schema/types/TagType.js +48 -0
- package/dist/schema/types/TagType.js.map +1 -0
- package/dist/schema/types/TaskLikeCommon.d.ts +7 -0
- package/dist/schema/types/TaskLikeCommon.js +86 -0
- package/dist/schema/types/TaskLikeCommon.js.map +1 -0
- package/dist/schema/types/TaskType.d.ts +11 -0
- package/dist/schema/types/TaskType.js +188 -0
- package/dist/schema/types/TaskType.js.map +1 -0
- package/dist/schema/types/index.d.ts +13 -0
- package/dist/schema/types/index.js +44 -0
- package/dist/schema/types/index.js.map +1 -0
- package/dist/schema/types/middleware/UsageTypes.d.ts +3 -0
- package/dist/schema/types/middleware/UsageTypes.js +23 -0
- package/dist/schema/types/middleware/UsageTypes.js.map +1 -0
- package/dist/schema/types/middleware/common.d.ts +6 -0
- package/dist/schema/types/middleware/common.js +156 -0
- package/dist/schema/types/middleware/common.js.map +1 -0
- package/dist/schema/utils.d.ts +12 -0
- package/dist/schema/utils.js +35 -0
- package/dist/schema/utils.js.map +1 -0
- package/dist/ui/index.html +20 -0
- package/dist/ui/static/index-D-NS5aw1.js +40 -0
- package/dist/utils/json-schema-to-readable.d.ts +1 -0
- package/dist/utils/json-schema-to-readable.js +256 -0
- package/dist/utils/json-schema-to-readable.js.map +1 -0
- package/dist/utils/path.d.ts +16 -0
- package/dist/utils/path.js +101 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/react-ssr.d.ts +9 -0
- package/dist/utils/react-ssr.js +36 -0
- package/dist/utils/react-ssr.js.map +1 -0
- package/dist/utils/zod.d.ts +6 -0
- package/dist/utils/zod.js +39 -0
- package/dist/utils/zod.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers-types.js","sourceRoot":"","sources":["../../src/generated/resolvers-types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { dev } from "./resources/dev.resource";
|
|
2
|
+
export declare const resources: {
|
|
3
|
+
server: import("@bluelibs/runner/dist/defs").IResource<import("./resources/server.resource").ServerConfig, Promise<{
|
|
4
|
+
apolloServer: import("@apollo/server").ApolloServer<import("@apollo/server").BaseContext>;
|
|
5
|
+
httpServer: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
6
|
+
}>, {
|
|
7
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
8
|
+
logger: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Logger>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
9
|
+
introspector: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/introspector.resource").Introspector>, {
|
|
10
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
11
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
12
|
+
live: import("@bluelibs/runner/dist/defs").IResource<{
|
|
13
|
+
maxEntries?: number;
|
|
14
|
+
}, Promise<import("./resources/live.resource").Live>, {
|
|
15
|
+
liveService: import("@bluelibs/runner/dist/defs").IResource<{
|
|
16
|
+
maxEntries?: number;
|
|
17
|
+
}, Promise<import("./resources/live.resource").Live>, {}, any, any, import("@bluelibs/runner/dist/defs").ITag<{
|
|
18
|
+
metadata?: Record<string, any>;
|
|
19
|
+
}, void, void>[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
20
|
+
logger: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Logger>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
21
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
22
|
+
swapManager: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/swap.resource").SwapManager>, {
|
|
23
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
24
|
+
taskRunner: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").TaskRunner>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
25
|
+
introspector: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/introspector.resource").Introspector>, {
|
|
26
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
27
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
28
|
+
eventManager: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").EventManager>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
29
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
30
|
+
graphql: import("@bluelibs/runner/dist/defs").IResource<void, Promise<{
|
|
31
|
+
getSchema: () => import("graphql").GraphQLSchema;
|
|
32
|
+
}>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
33
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
34
|
+
introspector: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/introspector.resource").Introspector>, {
|
|
35
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
36
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
37
|
+
live: import("@bluelibs/runner/dist/defs").IResource<{
|
|
38
|
+
maxEntries?: number;
|
|
39
|
+
}, Promise<import("./resources/live.resource").Live>, {
|
|
40
|
+
liveService: import("@bluelibs/runner/dist/defs").IResource<{
|
|
41
|
+
maxEntries?: number;
|
|
42
|
+
}, Promise<import("./resources/live.resource").Live>, {}, any, any, import("@bluelibs/runner/dist/defs").ITag<{
|
|
43
|
+
metadata?: Record<string, any>;
|
|
44
|
+
}, void, void>[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
45
|
+
logger: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Logger>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
46
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
47
|
+
telemetry: import("@bluelibs/runner/dist/defs").IResource<void, Promise<void>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
48
|
+
swapManager: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/swap.resource").SwapManager>, {
|
|
49
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
50
|
+
taskRunner: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").TaskRunner>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
51
|
+
introspector: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("./resources/introspector.resource").Introspector>, {
|
|
52
|
+
store: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").Store>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
53
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
54
|
+
eventManager: import("@bluelibs/runner/dist/defs").IResource<void, Promise<import("@bluelibs/runner").EventManager>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
55
|
+
}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
56
|
+
graphql: import("@bluelibs/runner/dist/defs").IResource<void, Promise<{
|
|
57
|
+
getSchema: () => import("graphql").GraphQLSchema;
|
|
58
|
+
}>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
59
|
+
dev: import("@bluelibs/runner/dist/defs").IResource<import("./resources/dev.resource").DevConfig, Promise<any>, {}, any, any, import("@bluelibs/runner/dist/defs").TagType[], import("@bluelibs/runner/dist/defs").ResourceMiddlewareAttachmentType[]>;
|
|
60
|
+
};
|
|
61
|
+
export { dev };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dev = exports.resources = void 0;
|
|
4
|
+
const server_resource_1 = require("./resources/server.resource");
|
|
5
|
+
const introspector_resource_1 = require("./resources/introspector.resource");
|
|
6
|
+
const live_resource_1 = require("./resources/live.resource");
|
|
7
|
+
const telemetry_resource_1 = require("./resources/telemetry.resource");
|
|
8
|
+
const swap_resource_1 = require("./resources/swap.resource");
|
|
9
|
+
const graphql_accumulator_resource_1 = require("./resources/graphql-accumulator.resource");
|
|
10
|
+
const dev_resource_1 = require("./resources/dev.resource");
|
|
11
|
+
Object.defineProperty(exports, "dev", { enumerable: true, get: function () { return dev_resource_1.dev; } });
|
|
12
|
+
Error.stackTraceLimit = Infinity;
|
|
13
|
+
exports.resources = {
|
|
14
|
+
server: server_resource_1.serverResource,
|
|
15
|
+
introspector: introspector_resource_1.introspector,
|
|
16
|
+
live: live_resource_1.live,
|
|
17
|
+
telemetry: telemetry_resource_1.telemetry,
|
|
18
|
+
swapManager: swap_resource_1.swapManager,
|
|
19
|
+
graphql: graphql_accumulator_resource_1.graphql,
|
|
20
|
+
dev: dev_resource_1.dev,
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,iEAA6D;AAC7D,6EAAiE;AACjE,6DAAiD;AACjD,uEAA2D;AAC3D,6DAAwD;AACxD,2FAAmE;AACnE,2DAA+C;AActC,oFAdA,kBAAG,OAcA;AAZZ,KAAK,CAAC,eAAe,GAAG,QAAQ,CAAC;AAEpB,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE,gCAAc;IACtB,YAAY,EAAZ,oCAAY;IACZ,IAAI,EAAJ,oBAAI;IACJ,SAAS,EAAT,8BAAS;IACT,WAAW,EAAX,2BAAW;IACX,OAAO,EAAP,sCAAO;IACP,GAAG,EAAH,kBAAG;CACJ,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/main.js
ADDED
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ENDPOINT: string | undefined;
|
|
2
|
+
export declare const ALLOW_MUTATIONS: boolean;
|
|
3
|
+
export declare function parseHeadersFromEnv(): Record<string, string>;
|
|
4
|
+
export declare function getEndpoint(): string | undefined;
|
|
5
|
+
export declare function assertEndpoint(): string;
|
package/dist/mcp/env.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ALLOW_MUTATIONS = exports.ENDPOINT = void 0;
|
|
4
|
+
exports.parseHeadersFromEnv = parseHeadersFromEnv;
|
|
5
|
+
exports.getEndpoint = getEndpoint;
|
|
6
|
+
exports.assertEndpoint = assertEndpoint;
|
|
7
|
+
exports.ENDPOINT = process.env.ENDPOINT || process.env.GRAPHQL_ENDPOINT;
|
|
8
|
+
exports.ALLOW_MUTATIONS = (process.env.ALLOW_MUTATIONS || "").toLowerCase() === "true";
|
|
9
|
+
function parseHeadersFromEnv() {
|
|
10
|
+
const headersEnv = process.env.HEADERS;
|
|
11
|
+
if (!headersEnv)
|
|
12
|
+
return {};
|
|
13
|
+
try {
|
|
14
|
+
const parsed = JSON.parse(headersEnv);
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
17
|
+
if (typeof value === "string") {
|
|
18
|
+
result[key] = value;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
result[key] = JSON.stringify(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.warn("HEADERS env var is not valid JSON. Ignoring. Error:", e);
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function getEndpoint() {
|
|
33
|
+
return process.env.ENDPOINT || process.env.GRAPHQL_ENDPOINT;
|
|
34
|
+
}
|
|
35
|
+
function assertEndpoint() {
|
|
36
|
+
const endpoint = getEndpoint();
|
|
37
|
+
if (!endpoint) {
|
|
38
|
+
throw new Error("ENDPOINT env variable is required to use the GraphQL MCP server");
|
|
39
|
+
}
|
|
40
|
+
return endpoint;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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5B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard to check if a value is a plain object (Record).
|
|
3
|
+
* @param value - The value to check
|
|
4
|
+
* @returns True if the value is a plain object, false otherwise
|
|
5
|
+
*/
|
|
6
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Type guard to check if a value is a scalar (primitive) type.
|
|
9
|
+
* @param value - The value to check
|
|
10
|
+
* @returns True if the value is a scalar type (string, number, boolean, null, or undefined)
|
|
11
|
+
*/
|
|
12
|
+
export declare function isScalar(value: unknown): value is string | number | boolean | null;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a preview string for an object by finding the first available scalar value.
|
|
15
|
+
* Prioritizes common identifier fields like 'id', 'name', 'title', etc.
|
|
16
|
+
* @param obj - The object to generate a preview for
|
|
17
|
+
* @returns A preview string in the format "key=value" or undefined if no scalar found
|
|
18
|
+
*/
|
|
19
|
+
export declare function getFirstScalarPreview(obj: Record<string, unknown>): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a concise preview string for any value type.
|
|
22
|
+
* @param value - The value to create a preview for
|
|
23
|
+
* @returns A short string representation of the value
|
|
24
|
+
*/
|
|
25
|
+
export declare function valuePreview(value: unknown): string;
|
|
26
|
+
/**
|
|
27
|
+
* Formats GraphQL query/mutation results as readable Markdown.
|
|
28
|
+
*
|
|
29
|
+
* Features:
|
|
30
|
+
* - Handles data, errors, and extensions sections
|
|
31
|
+
* - Supports configurable depth traversal for nested objects
|
|
32
|
+
* - Two presentation styles: "summary" (structured) and "story" (narrative)
|
|
33
|
+
* - Intelligent truncation with maxItems limit
|
|
34
|
+
* - Enhanced error formatting with path and location information
|
|
35
|
+
* - Type-safe implementation with comprehensive error handling
|
|
36
|
+
*
|
|
37
|
+
* @param result - The GraphQL result object to format
|
|
38
|
+
* @param options - Formatting options
|
|
39
|
+
* @param options.title - Custom title for the output (default: "GraphQL Result")
|
|
40
|
+
* @param options.maxItems - Maximum items to show per level (default: 10)
|
|
41
|
+
* @param options.maxDepth - Maximum nesting depth to traverse (default: 3)
|
|
42
|
+
* @param options.style - Output style: "summary" or "story" (default: "summary")
|
|
43
|
+
* @returns Formatted Markdown string
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatGraphQLResultAsMarkdown(result: unknown, options?: {
|
|
46
|
+
title?: string;
|
|
47
|
+
maxItems?: number;
|
|
48
|
+
maxDepth?: number;
|
|
49
|
+
style?: "summary" | "story";
|
|
50
|
+
}): string;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRecord = isRecord;
|
|
4
|
+
exports.isScalar = isScalar;
|
|
5
|
+
exports.getFirstScalarPreview = getFirstScalarPreview;
|
|
6
|
+
exports.valuePreview = valuePreview;
|
|
7
|
+
exports.formatGraphQLResultAsMarkdown = formatGraphQLResultAsMarkdown;
|
|
8
|
+
/**
|
|
9
|
+
* Type guard to check if a value is a plain object (Record).
|
|
10
|
+
* @param value - The value to check
|
|
11
|
+
* @returns True if the value is a plain object, false otherwise
|
|
12
|
+
*/
|
|
13
|
+
function isRecord(value) {
|
|
14
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Type guard to check if a value is a scalar (primitive) type.
|
|
18
|
+
* @param value - The value to check
|
|
19
|
+
* @returns True if the value is a scalar type (string, number, boolean, null, or undefined)
|
|
20
|
+
*/
|
|
21
|
+
function isScalar(value) {
|
|
22
|
+
const t = typeof value;
|
|
23
|
+
return value == null || t === "string" || t === "number" || t === "boolean";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generates a preview string for an object by finding the first available scalar value.
|
|
27
|
+
* Prioritizes common identifier fields like 'id', 'name', 'title', etc.
|
|
28
|
+
* @param obj - The object to generate a preview for
|
|
29
|
+
* @returns A preview string in the format "key=value" or undefined if no scalar found
|
|
30
|
+
*/
|
|
31
|
+
function getFirstScalarPreview(obj) {
|
|
32
|
+
const preferredKeys = ["id", "name", "title", "eventId", "nodeId"];
|
|
33
|
+
for (const key of preferredKeys) {
|
|
34
|
+
if (key in obj && isScalar(obj[key])) {
|
|
35
|
+
return `${key}=${String(obj[key])}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
39
|
+
if (isScalar(v)) {
|
|
40
|
+
return `${k}=${String(v)}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a concise preview string for any value type.
|
|
47
|
+
* @param value - The value to create a preview for
|
|
48
|
+
* @returns A short string representation of the value
|
|
49
|
+
*/
|
|
50
|
+
function valuePreview(value) {
|
|
51
|
+
if (isScalar(value))
|
|
52
|
+
return String(value);
|
|
53
|
+
if (Array.isArray(value))
|
|
54
|
+
return `Array(${value.length})`;
|
|
55
|
+
if (isRecord(value))
|
|
56
|
+
return "Object";
|
|
57
|
+
return typeof value;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Enhanced object formatting with depth control and better nested structure display.
|
|
61
|
+
* @param obj - The object to format
|
|
62
|
+
* @param currentDepth - Current nesting depth
|
|
63
|
+
* @param maxDepth - Maximum allowed nesting depth
|
|
64
|
+
* @param maxItems - Maximum number of items to display per level
|
|
65
|
+
* @param indent - Current indentation string
|
|
66
|
+
* @returns Array of formatted strings representing the object structure
|
|
67
|
+
*/
|
|
68
|
+
function formatObjectWithDepth(obj, currentDepth, maxDepth, maxItems, indent = "") {
|
|
69
|
+
const parts = [];
|
|
70
|
+
if (currentDepth >= maxDepth) {
|
|
71
|
+
const preview = getFirstScalarPreview(obj);
|
|
72
|
+
parts.push(`${indent}{${preview ? preview : "..."}}`);
|
|
73
|
+
return parts;
|
|
74
|
+
}
|
|
75
|
+
const entries = Object.entries(obj).slice(0, maxItems);
|
|
76
|
+
for (const [key, value] of entries) {
|
|
77
|
+
if (isScalar(value)) {
|
|
78
|
+
parts.push(`${indent}- ${key}: ${String(value)}`);
|
|
79
|
+
}
|
|
80
|
+
else if (Array.isArray(value)) {
|
|
81
|
+
parts.push(`${indent}- ${key}: Array(${value.length})`);
|
|
82
|
+
if (value.length > 0 && currentDepth < maxDepth - 1) {
|
|
83
|
+
const sampleItems = value.slice(0, Math.min(3, maxItems));
|
|
84
|
+
for (let i = 0; i < sampleItems.length; i++) {
|
|
85
|
+
const item = sampleItems[i];
|
|
86
|
+
if (isRecord(item)) {
|
|
87
|
+
parts.push(`${indent} [${i}]:`);
|
|
88
|
+
parts.push(...formatObjectWithDepth(item, currentDepth + 1, maxDepth, maxItems, indent + " "));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
parts.push(`${indent} [${i}]: ${valuePreview(item)}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (value.length > sampleItems.length) {
|
|
95
|
+
parts.push(`${indent} ... and ${value.length - sampleItems.length} more items`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (isRecord(value)) {
|
|
100
|
+
parts.push(`${indent}- ${key}: Object`);
|
|
101
|
+
parts.push(...formatObjectWithDepth(value, currentDepth + 1, maxDepth, maxItems, indent + " "));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
parts.push(`${indent}- ${key}: ${valuePreview(value)}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (Object.keys(obj).length > entries.length) {
|
|
108
|
+
parts.push(`${indent}... and ${Object.keys(obj).length - entries.length} more properties`);
|
|
109
|
+
}
|
|
110
|
+
return parts;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Type guard to check if a value is a GraphQL error object.
|
|
114
|
+
* @param value - The value to check
|
|
115
|
+
* @returns True if the value conforms to GraphQL error structure
|
|
116
|
+
*/
|
|
117
|
+
function isGraphQLError(value) {
|
|
118
|
+
return isRecord(value) && typeof value.message === "string";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Formats a GraphQL error with enhanced information including path and location.
|
|
122
|
+
* @param error - The error to format
|
|
123
|
+
* @returns A formatted error message string
|
|
124
|
+
*/
|
|
125
|
+
function formatGraphQLError(error) {
|
|
126
|
+
if (isGraphQLError(error)) {
|
|
127
|
+
let msg = error.message;
|
|
128
|
+
if (error.path) {
|
|
129
|
+
msg += ` (at path: ${error.path.join(".")})`;
|
|
130
|
+
}
|
|
131
|
+
if (error.locations && error.locations.length > 0) {
|
|
132
|
+
const loc = error.locations[0];
|
|
133
|
+
msg += ` (line ${loc.line}, column ${loc.column})`;
|
|
134
|
+
}
|
|
135
|
+
return msg;
|
|
136
|
+
}
|
|
137
|
+
return valuePreview(error);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Formats GraphQL query/mutation results as readable Markdown.
|
|
141
|
+
*
|
|
142
|
+
* Features:
|
|
143
|
+
* - Handles data, errors, and extensions sections
|
|
144
|
+
* - Supports configurable depth traversal for nested objects
|
|
145
|
+
* - Two presentation styles: "summary" (structured) and "story" (narrative)
|
|
146
|
+
* - Intelligent truncation with maxItems limit
|
|
147
|
+
* - Enhanced error formatting with path and location information
|
|
148
|
+
* - Type-safe implementation with comprehensive error handling
|
|
149
|
+
*
|
|
150
|
+
* @param result - The GraphQL result object to format
|
|
151
|
+
* @param options - Formatting options
|
|
152
|
+
* @param options.title - Custom title for the output (default: "GraphQL Result")
|
|
153
|
+
* @param options.maxItems - Maximum items to show per level (default: 10)
|
|
154
|
+
* @param options.maxDepth - Maximum nesting depth to traverse (default: 3)
|
|
155
|
+
* @param options.style - Output style: "summary" or "story" (default: "summary")
|
|
156
|
+
* @returns Formatted Markdown string
|
|
157
|
+
*/
|
|
158
|
+
function formatGraphQLResultAsMarkdown(result, options) {
|
|
159
|
+
const title = options?.title || "GraphQL Result";
|
|
160
|
+
const maxItems = options?.maxItems ?? 10;
|
|
161
|
+
const maxDepth = options?.maxDepth ?? 3;
|
|
162
|
+
const style = options?.style || "summary";
|
|
163
|
+
const parts = [];
|
|
164
|
+
parts.push(`# ${title}`);
|
|
165
|
+
const res = (result ?? {});
|
|
166
|
+
const data = isRecord(res.data)
|
|
167
|
+
? res.data
|
|
168
|
+
: undefined;
|
|
169
|
+
const errors = Array.isArray(res.errors) ? res.errors : [];
|
|
170
|
+
const extensions = isRecord(res.extensions)
|
|
171
|
+
? res.extensions
|
|
172
|
+
: undefined;
|
|
173
|
+
if (errors.length) {
|
|
174
|
+
parts.push("\n## Errors");
|
|
175
|
+
for (const e of errors.slice(0, maxItems)) {
|
|
176
|
+
const msg = formatGraphQLError(e);
|
|
177
|
+
parts.push(`- ${msg}`);
|
|
178
|
+
}
|
|
179
|
+
if (errors.length > maxItems) {
|
|
180
|
+
parts.push(`- ... and ${errors.length - maxItems} more errors`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (!data) {
|
|
184
|
+
parts.push("\n_No data returned._");
|
|
185
|
+
return parts.join("\n");
|
|
186
|
+
}
|
|
187
|
+
const topKeys = Object.keys(data);
|
|
188
|
+
if (style === "story") {
|
|
189
|
+
const sentences = [];
|
|
190
|
+
sentences.push("I queried the server and received the following top-level fields:");
|
|
191
|
+
const facts = [];
|
|
192
|
+
for (const key of topKeys) {
|
|
193
|
+
const val = data[key];
|
|
194
|
+
if (Array.isArray(val)) {
|
|
195
|
+
facts.push(`${key} (${val.length} item${val.length === 1 ? "" : "s"})`);
|
|
196
|
+
}
|
|
197
|
+
else if (isRecord(val)) {
|
|
198
|
+
facts.push(`${key} (object)`);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
facts.push(`${key}=${valuePreview(val)}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
sentences.push(facts.join(", ") + ".");
|
|
205
|
+
if (errors.length) {
|
|
206
|
+
sentences.push(`There were ${errors.length} error${errors.length === 1 ? "" : "s"} included above.`);
|
|
207
|
+
}
|
|
208
|
+
parts.push("\n" + sentences.join(" ") + "\n");
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
parts.push("\n## Data Summary");
|
|
212
|
+
for (const key of topKeys) {
|
|
213
|
+
const val = data[key];
|
|
214
|
+
if (Array.isArray(val)) {
|
|
215
|
+
parts.push(`- ${key}: ${val.length} item${val.length === 1 ? "" : "s"}`);
|
|
216
|
+
if (val.length > 0) {
|
|
217
|
+
const items = val.slice(0, maxItems);
|
|
218
|
+
for (let i = 0; i < items.length; i++) {
|
|
219
|
+
const item = items[i];
|
|
220
|
+
if (isRecord(item)) {
|
|
221
|
+
parts.push(` [${i}]:`);
|
|
222
|
+
parts.push(...formatObjectWithDepth(item, 1, maxDepth, maxItems, " "));
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
parts.push(` [${i}]: ${valuePreview(item)}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (val.length > items.length) {
|
|
229
|
+
parts.push(` ... and ${val.length - items.length} more items`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else if (isRecord(val)) {
|
|
234
|
+
parts.push(`- ${key}: Object`);
|
|
235
|
+
parts.push(...formatObjectWithDepth(val, 1, maxDepth, maxItems, " "));
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
parts.push(`- ${key}: ${valuePreview(val)}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Add extensions if present
|
|
243
|
+
if (extensions && Object.keys(extensions).length > 0) {
|
|
244
|
+
parts.push("\n## Extensions");
|
|
245
|
+
parts.push(...formatObjectWithDepth(extensions, 1, maxDepth, maxItems, ""));
|
|
246
|
+
}
|
|
247
|
+
return parts.join("\n");
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/mcp/format.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAOD,4BAKC;AAQD,sDAeC;AAOD,oCAKC;AA+ID,sEA6GC;AAlTD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,SAAgB,QAAQ,CACtB,KAAc;IAEd,MAAM,CAAC,GAAG,OAAO,KAAK,CAAC;IACvB,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,SAAS,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,GAA4B;IAE5B,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnE,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,IAAI,GAAG,IAAI,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YACrC,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACtC,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,OAA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,20 @@
|
|
|
1
|
+
export type HelpDoc = "readme" | "ai";
|
|
2
|
+
export declare function readDocContent(doc: HelpDoc): Promise<{
|
|
3
|
+
doc: HelpDoc;
|
|
4
|
+
filePath: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function readPackageDoc(packageName: string, docPath?: string): Promise<{
|
|
8
|
+
packageName: string;
|
|
9
|
+
filePath: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function extractSectionByHeading(markdown: string, headingQuery: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Extract multiple sections by heading queries (supports array of headings).
|
|
15
|
+
* @param markdown - The markdown content to search
|
|
16
|
+
* @param headingQueries - Array of heading queries to search for
|
|
17
|
+
* @returns Combined sections with separators
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractSectionsByHeadings(markdown: string, headingQueries: string[]): string;
|
|
20
|
+
export declare function buildTOC(markdown: string): string[];
|
package/dist/mcp/help.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.readDocContent = readDocContent;
|
|
27
|
+
exports.readPackageDoc = readPackageDoc;
|
|
28
|
+
exports.extractSectionByHeading = extractSectionByHeading;
|
|
29
|
+
exports.extractSectionsByHeadings = extractSectionsByHeadings;
|
|
30
|
+
exports.buildTOC = buildTOC;
|
|
31
|
+
const fs_1 = require("fs");
|
|
32
|
+
const path = __importStar(require("path"));
|
|
33
|
+
const path_1 = require("../utils/path");
|
|
34
|
+
async function readDocContent(doc) {
|
|
35
|
+
const root = process.cwd();
|
|
36
|
+
const fileName = doc === "readme" ? "README.md" : "AI.md";
|
|
37
|
+
const filePath = path.join(root, fileName);
|
|
38
|
+
const content = await fs_1.promises.readFile(filePath, "utf8").catch(() => "");
|
|
39
|
+
return { doc, filePath: (0, path_1.sanitizePath)(filePath) ?? filePath, content };
|
|
40
|
+
}
|
|
41
|
+
async function readPackageDoc(packageName, docPath = "README.md") {
|
|
42
|
+
const root = process.cwd();
|
|
43
|
+
const filePath = path.join(root, "node_modules", packageName, docPath);
|
|
44
|
+
const content = await fs_1.promises.readFile(filePath, "utf8").catch(() => "");
|
|
45
|
+
return { packageName, filePath: (0, path_1.sanitizePath)(filePath) ?? filePath, content };
|
|
46
|
+
}
|
|
47
|
+
function extractSectionByHeading(markdown, headingQuery) {
|
|
48
|
+
if (!markdown || !headingQuery)
|
|
49
|
+
return "";
|
|
50
|
+
const lines = markdown.split(/\r?\n/);
|
|
51
|
+
const normalizedQuery = headingQuery.trim().toLowerCase();
|
|
52
|
+
let startIndex = -1;
|
|
53
|
+
for (let i = 0; i < lines.length; i++) {
|
|
54
|
+
const line = lines[i];
|
|
55
|
+
if (/^#{1,6}\s+/.test(line)) {
|
|
56
|
+
const title = line
|
|
57
|
+
.replace(/^#{1,6}\s+/, "")
|
|
58
|
+
.trim()
|
|
59
|
+
.toLowerCase();
|
|
60
|
+
if (title.includes(normalizedQuery)) {
|
|
61
|
+
startIndex = i;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (startIndex === -1)
|
|
67
|
+
return "";
|
|
68
|
+
let endIndex = lines.length;
|
|
69
|
+
const startLevel = lines[startIndex].match(/^#+/)?.[0].length ?? 1;
|
|
70
|
+
for (let j = startIndex + 1; j < lines.length; j++) {
|
|
71
|
+
const l = lines[j];
|
|
72
|
+
const m = l.match(/^#{1,6}\s+/);
|
|
73
|
+
if (m && m[0].trim().length <= startLevel) {
|
|
74
|
+
endIndex = j;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return lines.slice(startIndex, endIndex).join("\n");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract multiple sections by heading queries (supports array of headings).
|
|
82
|
+
* @param markdown - The markdown content to search
|
|
83
|
+
* @param headingQueries - Array of heading queries to search for
|
|
84
|
+
* @returns Combined sections with separators
|
|
85
|
+
*/
|
|
86
|
+
function extractSectionsByHeadings(markdown, headingQueries) {
|
|
87
|
+
if (!markdown || !headingQueries || headingQueries.length === 0)
|
|
88
|
+
return "";
|
|
89
|
+
const sections = [];
|
|
90
|
+
const foundHeadings = [];
|
|
91
|
+
for (const query of headingQueries) {
|
|
92
|
+
const section = extractSectionByHeading(markdown, query);
|
|
93
|
+
if (section) {
|
|
94
|
+
sections.push(section);
|
|
95
|
+
foundHeadings.push(query);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (sections.length === 0) {
|
|
99
|
+
return `No sections found matching: ${headingQueries.join(", ")}`;
|
|
100
|
+
}
|
|
101
|
+
const header = foundHeadings.length === headingQueries.length
|
|
102
|
+
? `Found all ${sections.length} requested sections:`
|
|
103
|
+
: `Found ${sections.length} of ${headingQueries.length} requested sections:`;
|
|
104
|
+
return (`${header} ${foundHeadings.join(", ")}\n\n` + sections.join("\n\n---\n\n"));
|
|
105
|
+
}
|
|
106
|
+
function buildTOC(markdown) {
|
|
107
|
+
if (!markdown)
|
|
108
|
+
return [];
|
|
109
|
+
const lines = markdown.split(/\r?\n/);
|
|
110
|
+
const toc = [];
|
|
111
|
+
for (const line of lines) {
|
|
112
|
+
const m = line.match(/^(#{1,6})\s+(.*)$/);
|
|
113
|
+
if (m) {
|
|
114
|
+
const level = m[1].length;
|
|
115
|
+
const title = m[2].trim();
|
|
116
|
+
toc.push(`${" ".repeat(level - 1)}- ${title}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return toc;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/mcp/help.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wCAUC;AAED,wCAQC;AAED,0DAiCC;AAQD,8DA6BC;AAED,4BAaC;AAjHD,2BAAoC;AACpC,2CAA6B;AAC7B,wCAA6C;AAItC,KAAK,UAAU,cAAc,CAAC,GAAY;IAK/C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,aAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,E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