@http-forge/core 0.6.40 → 0.6.41
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 +7 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +202 -193
- package/dist/index.mjs +199 -190
- package/dist/infrastructure/collection/agents-md.d.ts +1 -1
- package/dist/infrastructure/qa/qa-report.d.ts +7 -0
- package/dist/infrastructure/qa/qa-service.d.ts +125 -0
- package/dist/runtime/mcp-handlers/ai.d.ts +8 -0
- package/dist/runtime/mcp-handlers/qa.d.ts +9 -0
- package/dist/runtime/mcp-tool-schemas.d.ts +1 -0
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* user customizations are never silently lost.
|
|
15
15
|
*/
|
|
16
16
|
/** Current template version. Bump when `buildAgentsMdContent()` changes. */
|
|
17
|
-
export declare const AGENTS_MD_VERSION =
|
|
17
|
+
export declare const AGENTS_MD_VERSION = 2;
|
|
18
18
|
export declare const AGENTS_MD_FILENAME = "AGENTS.md";
|
|
19
19
|
export declare const AGENTS_MD_BACKUP_FILENAME = "AGENTS.md.bak";
|
|
20
20
|
/** Absolute path of the guide inside a `.http-forge/` directory. */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QA check report rendering — table output for humans.
|
|
3
|
+
* JSON output is `JSON.stringify(report, null, 2)` at the call site.
|
|
4
|
+
*/
|
|
5
|
+
import type { QaCheckReport } from './qa-service';
|
|
6
|
+
/** Render a QA check report as a human-readable summary table. */
|
|
7
|
+
export declare function renderQaReportTable(report: QaCheckReport): string;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QA Check service — one-shot API quality gate.
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the discover → generate → run → report loop in a single call:
|
|
5
|
+
* source-code discovery, idempotent request creation (reuse by endpoint key,
|
|
6
|
+
* never duplicate), deterministic suite generation, live execution, and a
|
|
7
|
+
* machine-readable report with CI-friendly status.
|
|
8
|
+
*
|
|
9
|
+
* All stage logic lives in its existing module (drift-engine, discovery
|
|
10
|
+
* providers, test-generator, suite executor). This module only sequences them.
|
|
11
|
+
*/
|
|
12
|
+
import type { IConfigService } from '../config';
|
|
13
|
+
import type { ICollectionService } from '../../types/collection';
|
|
14
|
+
import type { ITestSuiteService } from '../test-suite/interfaces';
|
|
15
|
+
import type { DiscoveredApi } from '../api-discovery';
|
|
16
|
+
import type { IAiProvider } from '../ai/ai-provider';
|
|
17
|
+
/** Services the QA check is sequenced over (narrow interface — no container). */
|
|
18
|
+
export interface QaCheckServices {
|
|
19
|
+
collection: ICollectionService;
|
|
20
|
+
testSuite: ITestSuiteService;
|
|
21
|
+
/** Optional: discovery tuning. Defaults apply when absent (e.g. MCP). */
|
|
22
|
+
config?: IConfigService;
|
|
23
|
+
}
|
|
24
|
+
/** Options for a QA check run. */
|
|
25
|
+
export interface QaCheckOptions {
|
|
26
|
+
/** Backend project root to scan. */
|
|
27
|
+
projectPath: string;
|
|
28
|
+
/** Target collection (id, slug, or name). Requests are created/reused here. */
|
|
29
|
+
collectionRef: string;
|
|
30
|
+
/** Running server to execute against. Required unless `dryRun`. */
|
|
31
|
+
baseUrl?: string;
|
|
32
|
+
/** Environment name for variable resolution. */
|
|
33
|
+
environment?: string;
|
|
34
|
+
/** Extra variables injected into every request (e.g. auth tokens). */
|
|
35
|
+
variables?: Record<string, unknown>;
|
|
36
|
+
/** Restrict discovery to one framework (express, nestjs, fastify, lambda, spring, fastapi). */
|
|
37
|
+
framework?: string;
|
|
38
|
+
/** Preview only: no requests created, nothing saved, no network calls. */
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
/** Return `drift` status instead of proceeding when the project moved. */
|
|
41
|
+
failOnDrift?: boolean;
|
|
42
|
+
/** Git HEAD from a prior scan (enables git-based drift comparison). */
|
|
43
|
+
storedGitHash?: string;
|
|
44
|
+
/** Scan time from a prior scan (enables mtime-based drift comparison). */
|
|
45
|
+
storedScannedAt?: string;
|
|
46
|
+
/** Also assert JSON array response bodies in generated suites. */
|
|
47
|
+
assertBodySchema?: boolean;
|
|
48
|
+
/** Request an AI assertion pass after the deterministic run (needs `aiProvider`). */
|
|
49
|
+
aiAssertions?: boolean;
|
|
50
|
+
/** AI backend for the assertion pass. Without it, the flag is noted and skipped. */
|
|
51
|
+
aiProvider?: IAiProvider;
|
|
52
|
+
/** Max AI suggestions per endpoint (default 5). */
|
|
53
|
+
aiMaxSuggestions?: number;
|
|
54
|
+
}
|
|
55
|
+
/** Terminal status of a QA check (maps to CLI exit codes 0/1/3/2). */
|
|
56
|
+
export type QaCheckStatus = 'pass' | 'fail' | 'drift' | 'infra' | 'dry-run';
|
|
57
|
+
/** Per-endpoint row of the QA report. */
|
|
58
|
+
export interface QaEndpointResult {
|
|
59
|
+
/** Stable endpoint key: `METHOD /resolved/path`. */
|
|
60
|
+
endpointKey: string;
|
|
61
|
+
method: string;
|
|
62
|
+
path: string;
|
|
63
|
+
confidence: DiscoveredApi['confidence'];
|
|
64
|
+
requestId: string;
|
|
65
|
+
requestName: string;
|
|
66
|
+
/** True when an existing collection request was reused. */
|
|
67
|
+
reused: boolean;
|
|
68
|
+
statusExpected: number;
|
|
69
|
+
statusGot?: number;
|
|
70
|
+
passed?: boolean;
|
|
71
|
+
duration?: string;
|
|
72
|
+
failures?: string[];
|
|
73
|
+
error?: string;
|
|
74
|
+
/** AI-suggested assertions (only when the `aiAssertions` pass ran for this endpoint). */
|
|
75
|
+
suggestions?: Array<{
|
|
76
|
+
snippet: string;
|
|
77
|
+
rationale: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
/** Machine-readable QA check report (JSON-serializable). */
|
|
81
|
+
export interface QaCheckReport {
|
|
82
|
+
status: QaCheckStatus;
|
|
83
|
+
project: {
|
|
84
|
+
path: string;
|
|
85
|
+
gitHash?: string;
|
|
86
|
+
frameworks: string[];
|
|
87
|
+
};
|
|
88
|
+
drift: {
|
|
89
|
+
status: 'current' | 'stale' | 'unknown';
|
|
90
|
+
reason?: string;
|
|
91
|
+
};
|
|
92
|
+
discovered: number;
|
|
93
|
+
reused: number;
|
|
94
|
+
created: number;
|
|
95
|
+
updatedUrls: number;
|
|
96
|
+
suite?: {
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
};
|
|
100
|
+
results: {
|
|
101
|
+
passed: number;
|
|
102
|
+
failed: number;
|
|
103
|
+
skipped: number;
|
|
104
|
+
};
|
|
105
|
+
endpoints: QaEndpointResult[];
|
|
106
|
+
/** Low-confidence discoveries are reported, never silently dropped. */
|
|
107
|
+
lowConfidence: string[];
|
|
108
|
+
/** Outcome of the optional AI assertion pass. */
|
|
109
|
+
aiAssertions: {
|
|
110
|
+
requested: boolean;
|
|
111
|
+
applied: boolean;
|
|
112
|
+
note?: string;
|
|
113
|
+
};
|
|
114
|
+
checkedAt: string;
|
|
115
|
+
}
|
|
116
|
+
/** Stable endpoint identity across runs: method + resolved path. */
|
|
117
|
+
export declare function qaEndpointKey(ep: Pick<DiscoveredApi, 'method' | 'resolvedPath' | 'pathExpression'>): string;
|
|
118
|
+
/**
|
|
119
|
+
* Run the QA check pipeline: freshness → discover → generate → run → report.
|
|
120
|
+
*
|
|
121
|
+
* Idempotent: reruns reuse existing requests matched by endpoint key and
|
|
122
|
+
* overwrite the deterministic QA suite, so repeated runs create nothing new
|
|
123
|
+
* unless the source changed.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runQaCheck(services: QaCheckServices, workspaceFolder: string, options: QaCheckOptions): Promise<QaCheckReport>;
|
|
@@ -2,5 +2,13 @@
|
|
|
2
2
|
* AI-native tool handlers — scaffold/openapi, suggestions, coverage, and the
|
|
3
3
|
* "task" tools that instruct the calling LLM to take follow-up actions.
|
|
4
4
|
*/
|
|
5
|
+
import type { IAiProvider } from '../../infrastructure/ai/ai-provider';
|
|
6
|
+
import type { CollectionRequestItem } from '../../types/collection';
|
|
5
7
|
import type { McpToolHandler } from './types';
|
|
8
|
+
export interface AssertionSuggestion {
|
|
9
|
+
snippet: string;
|
|
10
|
+
rationale: string;
|
|
11
|
+
}
|
|
12
|
+
/** Ask an LLM for tailored pm.test() assertions, returning [] on any failure. */
|
|
13
|
+
export declare function suggestAssertionsWithAi(provider: IAiProvider, req: CollectionRequestItem, latestResult: Record<string, unknown> | undefined, maxSuggestions: number, workspaceKnowledge?: string): Promise<AssertionSuggestion[]>;
|
|
6
14
|
export declare const aiHandlers: McpToolHandler[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QA tool handler — one-shot discover → generate → run → report quality gate.
|
|
3
|
+
*
|
|
4
|
+
* Thin adapter over the core QA service (`infrastructure/qa/qa-service`):
|
|
5
|
+
* argument validation only. Reruns are idempotent (requests matched by
|
|
6
|
+
* method + path and reused), so agents can safely re-run after fixing code.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpToolHandler } from './types';
|
|
9
|
+
export declare const qaHandlers: McpToolHandler[];
|
|
@@ -225,6 +225,7 @@ export declare const GENERIC_TOOL_NAMES: {
|
|
|
225
225
|
readonly generateWorkflow: "generate_workflow";
|
|
226
226
|
readonly checkDrift: "check_drift";
|
|
227
227
|
readonly proposeUpdate: "propose_update";
|
|
228
|
+
readonly qaApi: "qa_api";
|
|
228
229
|
readonly reviewSuite: "review_suite";
|
|
229
230
|
readonly getRequestScript: "get_request_script";
|
|
230
231
|
readonly setRequestScript: "set_request_script";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@http-forge/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.41",
|
|
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",
|