@http-forge/core 0.6.35 → 0.6.36-beta.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.
- package/README.md +51 -0
- package/dist/__tests__/api-discovery/golden-utils.d.ts +10 -0
- package/dist/index.d.ts +50 -23
- package/dist/index.js +456 -480
- package/dist/index.mjs +456 -480
- package/dist/infrastructure/ai/ai-context.d.ts +109 -0
- package/dist/infrastructure/ai/ai-provider.d.ts +1 -1
- package/dist/infrastructure/ai/ai-utils.d.ts +38 -0
- package/dist/infrastructure/ai/http-providers.d.ts +34 -0
- package/dist/infrastructure/api-discovery/analyzer/component-analyzer.d.ts +60 -0
- package/dist/infrastructure/api-discovery/analyzer/express-component-analyzer.d.ts +14 -0
- package/dist/infrastructure/api-discovery/analyzer/fastify-component-analyzer.d.ts +14 -0
- package/dist/infrastructure/api-discovery/analyzer/index.d.ts +11 -0
- package/dist/infrastructure/api-discovery/analyzer/lambda-component-analyzer.d.ts +18 -0
- package/dist/infrastructure/api-discovery/api-discovery-service.d.ts +49 -0
- package/dist/infrastructure/api-discovery/auth-validation.d.ts +34 -0
- package/dist/infrastructure/api-discovery/drift-engine.d.ts +139 -0
- package/dist/infrastructure/api-discovery/fastapi/fastapi-discovery-provider.d.ts +19 -0
- package/dist/infrastructure/api-discovery/fastapi/fastapi-parser.d.ts +60 -0
- package/dist/infrastructure/api-discovery/framework-detector.d.ts +8 -0
- package/dist/infrastructure/api-discovery/index.d.ts +29 -0
- package/dist/infrastructure/api-discovery/path-utils.d.ts +17 -0
- package/dist/infrastructure/api-discovery/project-name.d.ts +2 -0
- package/dist/infrastructure/api-discovery/provider.d.ts +29 -0
- package/dist/infrastructure/api-discovery/providers/express-discovery-provider.d.ts +13 -0
- package/dist/infrastructure/api-discovery/providers/fastify-discovery-provider.d.ts +13 -0
- package/dist/infrastructure/api-discovery/providers/lambda-discovery-provider.d.ts +19 -0
- package/dist/infrastructure/api-discovery/providers/nest-discovery-provider.d.ts +12 -0
- package/dist/infrastructure/api-discovery/seed-loader.d.ts +11 -0
- package/dist/infrastructure/api-discovery/source-files.d.ts +1 -0
- package/dist/infrastructure/api-discovery/spring/controller-visitor.d.ts +141 -0
- package/dist/infrastructure/api-discovery/spring/endpoint-parser.d.ts +51 -0
- package/dist/infrastructure/api-discovery/spring/file-utils.d.ts +28 -0
- package/dist/infrastructure/api-discovery/spring/model.d.ts +84 -0
- package/dist/infrastructure/api-discovery/spring/schema-generator.d.ts +65 -0
- package/dist/infrastructure/api-discovery/spring/spring-discovery-provider.d.ts +30 -0
- package/dist/infrastructure/api-discovery/spring/spring-types.d.ts +27 -0
- package/dist/infrastructure/api-discovery/test-generator.d.ts +69 -0
- package/dist/infrastructure/api-discovery/types.d.ts +154 -0
- package/dist/infrastructure/api-discovery/workflow-discovery.d.ts +55 -0
- package/dist/infrastructure/architect/api-architect-service.d.ts +85 -0
- package/dist/infrastructure/architect/architect-prompt.d.ts +22 -0
- package/dist/infrastructure/architect/collection-to-endpoints.d.ts +13 -0
- package/dist/infrastructure/architect/index.d.ts +10 -0
- package/dist/infrastructure/collection/collection-service.d.ts +1 -5
- package/dist/infrastructure/collection/json-collection-loader.d.ts +0 -8
- package/dist/infrastructure/config/config-service.d.ts +2 -1
- package/dist/infrastructure/config/config.interface.d.ts +17 -0
- package/dist/infrastructure/config/index.d.ts +1 -1
- package/dist/infrastructure/cookie/cookie-service.d.ts +2 -13
- package/dist/infrastructure/cookie/cookie-utils.d.ts +5 -0
- package/dist/infrastructure/docs/index.d.ts +5 -0
- package/dist/infrastructure/docs/release-notes.d.ts +51 -0
- package/dist/infrastructure/environment/environment-config-service.d.ts +0 -1
- package/dist/infrastructure/environment/variable-interpolator.d.ts +9 -0
- package/dist/infrastructure/http/header-utils.d.ts +13 -0
- package/dist/infrastructure/http/http-request-service.d.ts +3 -3
- package/dist/infrastructure/http/interceptor-chain.d.ts +35 -16
- package/dist/infrastructure/http/native-http-client.d.ts +0 -10
- package/dist/infrastructure/openapi/interfaces.d.ts +14 -0
- package/dist/infrastructure/openapi/openapi-exporter.d.ts +11 -91
- package/dist/infrastructure/openapi/openapi-importer.d.ts +19 -0
- package/dist/infrastructure/openapi/openapi-operation-builder.d.ts +36 -0
- package/dist/infrastructure/openapi/openapi-schema-merger.d.ts +33 -0
- package/dist/infrastructure/openapi/openapi-spec-writer.d.ts +27 -0
- package/dist/infrastructure/openapi/openapi-utils.d.ts +62 -0
- package/dist/infrastructure/parsers/har-parser.d.ts +63 -0
- package/dist/infrastructure/parsers/index.d.ts +2 -0
- package/dist/infrastructure/review/index.d.ts +5 -0
- package/dist/infrastructure/review/review-engine.d.ts +95 -0
- package/dist/infrastructure/script/crypto-js-compat.d.ts +123 -0
- package/dist/infrastructure/script/request-object-factory.d.ts +54 -0
- package/dist/infrastructure/script/request-script-session.d.ts +0 -5
- package/dist/infrastructure/script/script-executor.d.ts +4 -33
- package/dist/infrastructure/script/script-factories.d.ts +13 -0
- package/dist/infrastructure/script/variable-scopes.d.ts +101 -0
- package/dist/infrastructure/test-suite/interfaces.d.ts +6 -0
- package/dist/runtime/collection-traversal.d.ts +32 -0
- package/dist/runtime/direct-execution.d.ts +7 -0
- package/dist/runtime/execution-helpers.d.ts +30 -0
- package/dist/runtime/mcp-dispatcher.d.ts +10 -34
- package/dist/runtime/mcp-handlers/ai.d.ts +6 -0
- package/dist/runtime/mcp-handlers/collection.d.ts +5 -0
- package/dist/runtime/mcp-handlers/discovery.d.ts +12 -0
- package/dist/runtime/mcp-handlers/environment-management.d.ts +6 -0
- package/dist/runtime/mcp-handlers/environment.d.ts +5 -0
- package/dist/runtime/mcp-handlers/execution.d.ts +6 -0
- package/dist/runtime/mcp-handlers/helpers.d.ts +43 -0
- package/dist/runtime/mcp-handlers/inspection.d.ts +5 -0
- package/dist/runtime/mcp-handlers/registry.d.ts +12 -0
- package/dist/runtime/mcp-handlers/request.d.ts +5 -0
- package/dist/runtime/mcp-handlers/review.d.ts +10 -0
- package/dist/runtime/mcp-handlers/run-status.d.ts +5 -0
- package/dist/runtime/mcp-handlers/suite.d.ts +6 -0
- package/dist/runtime/mcp-handlers/types.d.ts +59 -0
- package/dist/runtime/mcp-prompts.d.ts +16 -2
- package/dist/runtime/mcp-tool-schemas.d.ts +8 -0
- package/dist/runtime/suite-executor.d.ts +20 -0
- package/dist/types/types.d.ts +0 -9
- package/dist/utils/env-hints.d.ts +17 -0
- package/package.json +16 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Generic Tool Handler Contracts
|
|
3
|
+
*
|
|
4
|
+
* Each generic ("argument-selected") MCP tool is implemented by one
|
|
5
|
+
* `McpToolHandler`. A registry maps tool names to handlers, so adding a
|
|
6
|
+
* new tool means adding a handler — never editing a shared dispatcher.
|
|
7
|
+
*/
|
|
8
|
+
import type { Collection } from '../../types/collection';
|
|
9
|
+
import type { McpRunStore } from '../mcp-run-store';
|
|
10
|
+
import type { GenericToolName } from '../mcp-tool-schemas';
|
|
11
|
+
/** Services injected into every tool handler. */
|
|
12
|
+
export interface McpDispatchServices {
|
|
13
|
+
collection: import('../../types/collection').ICollectionService;
|
|
14
|
+
testSuite: import('../../infrastructure/test-suite/interfaces').ITestSuiteService;
|
|
15
|
+
environmentConfig: import('../../types/environment-config').IEnvironmentConfigService;
|
|
16
|
+
/** Absolute path to the workspace folder — used by AI-native tools. */
|
|
17
|
+
workspaceFolder?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional AI provider. When supplied, AI-flavoured tools (e.g. assertion
|
|
20
|
+
* suggestion, failure explanation) call a real LLM and fall back to their
|
|
21
|
+
* built-in heuristics when absent or on provider errors.
|
|
22
|
+
*/
|
|
23
|
+
aiProvider?: import('../../infrastructure/ai/ai-provider').IAiProvider;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Callbacks for the four execution tools that differ between server
|
|
27
|
+
* implementations. The extension uses CollectionRequestExecutor + executeSuite;
|
|
28
|
+
* the core runtime uses the direct-execution functions.
|
|
29
|
+
*/
|
|
30
|
+
export interface McpRunCallbacks {
|
|
31
|
+
runRequest: (col: Collection, requestId: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
32
|
+
runFolder: (col: Collection, folderPath: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
33
|
+
runCollection: (col: Collection, args: Record<string, unknown>) => Promise<unknown>;
|
|
34
|
+
runSuite: (suiteId: string, suiteName: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
35
|
+
}
|
|
36
|
+
/** Everything a tool handler needs to do its job. */
|
|
37
|
+
export interface McpToolContext {
|
|
38
|
+
/** The tool name constant from GENERIC_TOOL_NAMES. */
|
|
39
|
+
tool: GenericToolName;
|
|
40
|
+
/** Raw arguments object from the MCP tools/call payload. */
|
|
41
|
+
args: Record<string, unknown>;
|
|
42
|
+
/** Live service instances from either server's DI container. */
|
|
43
|
+
services: McpDispatchServices;
|
|
44
|
+
/** The caller's McpRunStore instance (each server owns one). */
|
|
45
|
+
runStore: McpRunStore;
|
|
46
|
+
/** Implementation-specific run-* execution callbacks. */
|
|
47
|
+
callbacks: McpRunCallbacks;
|
|
48
|
+
/** Snapshot of all collections (resolved once per dispatch). */
|
|
49
|
+
collections: Collection[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A single tool handler. `toolNames` is the set of tool names this handler
|
|
53
|
+
* implements (a handler may implement more than one, e.g. analyze_coverage
|
|
54
|
+
* and ai_analyze_coverage share behaviour).
|
|
55
|
+
*/
|
|
56
|
+
export interface McpToolHandler {
|
|
57
|
+
readonly toolNames: GenericToolName[];
|
|
58
|
+
handle(ctx: McpToolContext): Promise<unknown> | unknown;
|
|
59
|
+
}
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* review-collection — structural review of a collection
|
|
13
13
|
*/
|
|
14
14
|
import type { ICollectionService } from '../types/collection';
|
|
15
|
-
import type {
|
|
15
|
+
import type { ReviewReport } from '../infrastructure/review';
|
|
16
|
+
import type { TestSuite } from '../infrastructure/test-suite/interfaces';
|
|
17
|
+
import type { McpRunRecord, McpRunStore } from './mcp-run-store';
|
|
16
18
|
export interface McpPromptArg {
|
|
17
19
|
name: string;
|
|
18
20
|
description: string;
|
|
@@ -35,5 +37,17 @@ export interface PromptResult {
|
|
|
35
37
|
description: string;
|
|
36
38
|
messages: PromptMessage[];
|
|
37
39
|
}
|
|
38
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Build the LLM-enrichment prompt for the review_suite tool.
|
|
42
|
+
*
|
|
43
|
+
* Rules-first: the deterministic findings are always the source of truth; the
|
|
44
|
+
* LLM only prioritizes them and adds actionable prose. Passing the findings in
|
|
45
|
+
* keeps the model honest (it cannot invent severity) and keeps the gate CI-safe.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildReviewSuitePrompt(input: {
|
|
48
|
+
rec: McpRunRecord;
|
|
49
|
+
suite?: TestSuite;
|
|
50
|
+
report: ReviewReport;
|
|
51
|
+
}): Promise<string>;
|
|
52
|
+
export declare function buildPromptResult(name: string, args: Record<string, string>, collectionService: ICollectionService, runStore: McpRunStore, workspaceFolder?: string): Promise<PromptResult>;
|
|
39
53
|
export {};
|
|
@@ -219,6 +219,13 @@ export declare const GENERIC_TOOL_NAMES: {
|
|
|
219
219
|
readonly createRequest: "create_request";
|
|
220
220
|
readonly updateRequest: "update_request";
|
|
221
221
|
readonly deleteRequest: "delete_request";
|
|
222
|
+
readonly createRequestFromEndpoint: "create_request_from_endpoint";
|
|
223
|
+
readonly generateTestSuite: "generate_test_suite";
|
|
224
|
+
readonly suggestWorkflow: "suggest_workflow";
|
|
225
|
+
readonly generateWorkflow: "generate_workflow";
|
|
226
|
+
readonly checkDrift: "check_drift";
|
|
227
|
+
readonly proposeUpdate: "propose_update";
|
|
228
|
+
readonly reviewSuite: "review_suite";
|
|
222
229
|
readonly getRequestScript: "get_request_script";
|
|
223
230
|
readonly setRequestScript: "set_request_script";
|
|
224
231
|
readonly reorderCollectionItems: "reorder_collection_items";
|
|
@@ -258,6 +265,7 @@ export declare const GENERIC_TOOL_NAMES: {
|
|
|
258
265
|
readonly analyzeCoverage: "analyze_coverage";
|
|
259
266
|
readonly aiAnalyzeCoverage: "ai_analyze_coverage";
|
|
260
267
|
readonly generateRequestFromIntent: "generate_request_from_intent";
|
|
268
|
+
readonly designApiFromIntent: "design_api_from_intent";
|
|
261
269
|
readonly validateAgainstSpec: "validate_against_spec";
|
|
262
270
|
readonly generateScenarios: "generate_scenarios";
|
|
263
271
|
readonly healAssertions: "heal_assertions";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suite flow engine for direct execution.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the node-graph interpreter used to execute a test suite
|
|
5
|
+
* (or a collection replayed as a suite): conditional/loop/switch nodes,
|
|
6
|
+
* request execution, pre/post scripts, per-iteration concurrency, result
|
|
7
|
+
* persistence, and report generation.
|
|
8
|
+
*/
|
|
9
|
+
import type { ServiceContainer } from '../di/service-container';
|
|
10
|
+
/**
|
|
11
|
+
* Executes a suite node graph against a resolved service container.
|
|
12
|
+
*
|
|
13
|
+
* The whole flow engine lives here so the public entry points in
|
|
14
|
+
* `direct-execution.ts` stay thin. One instance is scoped to one run.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SuiteExecutor {
|
|
17
|
+
private readonly container;
|
|
18
|
+
constructor(container: ServiceContainer);
|
|
19
|
+
execute(suite: any, args: Record<string, unknown>, source: 'suite' | 'collection'): Promise<unknown>;
|
|
20
|
+
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -280,15 +280,6 @@ export interface ExecutionVariables {
|
|
|
280
280
|
globals?: Record<string, string>;
|
|
281
281
|
environmentVariables?: Record<string, string>;
|
|
282
282
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Environment configuration
|
|
285
|
-
*/
|
|
286
|
-
export interface Environment {
|
|
287
|
-
name: string;
|
|
288
|
-
description?: string;
|
|
289
|
-
variables: Record<string, string>;
|
|
290
|
-
headers?: Record<string, string>;
|
|
291
|
-
}
|
|
292
283
|
/**
|
|
293
284
|
* Context available to scripts during execution
|
|
294
285
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Env-suggestion heuristics shared by the rule-based suggester (env-suggester),
|
|
3
|
+
* the AI suggester (ai-env-suggester), and the curl parser (curl-parser).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth for:
|
|
6
|
+
* - Sensitive header/query key detection
|
|
7
|
+
* - `{{VAR}}` placeholder detection
|
|
8
|
+
* - Var-name derivation and secret-value heuristics
|
|
9
|
+
*/
|
|
10
|
+
export declare const SENSITIVE_HEADER_NAMES: Set<string>;
|
|
11
|
+
export declare const SENSITIVE_QUERY_KEYS: Set<string>;
|
|
12
|
+
/** True if the value contains a `{{var}}` placeholder. */
|
|
13
|
+
export declare function isForgeVar(value: string): boolean;
|
|
14
|
+
/** True if the value looks like a hardcoded secret (long, non-placeholder). */
|
|
15
|
+
export declare function looksLikeSecret(value: string, minLen?: number): boolean;
|
|
16
|
+
/** Derive an UPPER_SNAKE var name from a raw key/value. */
|
|
17
|
+
export declare function toVarName(raw: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.36-beta.2",
|
|
4
4
|
"description": "Headless Postman-compatible API testing engine for Node.js, CI/CD, OpenAPI workflows, and HTTP Forge automation",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -67,23 +67,33 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@apidevtools/json-schema-ref-parser": "^11.7.3",
|
|
69
69
|
"ajv": "^8.12.0",
|
|
70
|
+
"java-parser": "^3.0.1",
|
|
70
71
|
"lodash": "^4.17.21",
|
|
71
72
|
"moment": "^2.30.1",
|
|
72
73
|
"tv4": "^1.3.0",
|
|
74
|
+
"typescript": "^5.3.0",
|
|
73
75
|
"uuid": "^14.0.0",
|
|
74
76
|
"yaml": "^2.7.0"
|
|
75
77
|
},
|
|
76
78
|
"peerDependencies": {
|
|
77
79
|
"@aws-sdk/client-secrets-manager": ">=3.0.0",
|
|
78
|
-
"@azure/keyvault-secrets": ">=4.0.0",
|
|
79
80
|
"@azure/identity": ">=3.0.0",
|
|
81
|
+
"@azure/keyvault-secrets": ">=4.0.0",
|
|
80
82
|
"node-vault": ">=0.9.0"
|
|
81
83
|
},
|
|
82
84
|
"peerDependenciesMeta": {
|
|
83
|
-
"@aws-sdk/client-secrets-manager": {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
85
|
+
"@aws-sdk/client-secrets-manager": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@azure/keyvault-secrets": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"@azure/identity": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"node-vault": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
87
97
|
},
|
|
88
98
|
"devDependencies": {
|
|
89
99
|
"@types/lodash": "^4.14.202",
|