@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,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Discovery — Core Domain Types
|
|
3
|
+
*
|
|
4
|
+
* The unified, platform-agnostic model for source-code API discovery (plan §3.2).
|
|
5
|
+
* This is a SUPERSET of the models used by the `node-api-forge` and
|
|
6
|
+
* `spring-api-tester` extensions. Every layer above discovery (workflow, test
|
|
7
|
+
* generation, maintenance, review) depends on THIS shape and nothing else.
|
|
8
|
+
*
|
|
9
|
+
* Rules (DECISIONS D4/D5/D11):
|
|
10
|
+
* - provenance (`source`) and `confidence` are mandatory on every endpoint.
|
|
11
|
+
* - deterministic ordering; no timestamps inside endpoint records.
|
|
12
|
+
* - structured `JsonSchema` preferred over string hints for body/response.
|
|
13
|
+
*/
|
|
14
|
+
export type ApiFramework = 'express' | 'nestjs' | 'fastify' | 'lambda' | 'spring' | 'fastapi' | 'unknown';
|
|
15
|
+
export type EndpointConfidence = 'high' | 'medium' | 'low';
|
|
16
|
+
export interface SourceLocation {
|
|
17
|
+
filePath: string;
|
|
18
|
+
line: number;
|
|
19
|
+
column?: number;
|
|
20
|
+
symbolName?: string;
|
|
21
|
+
accessMode?: 'read' | 'write';
|
|
22
|
+
}
|
|
23
|
+
export type JsonSchema = Record<string, unknown>;
|
|
24
|
+
export type ParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'body' | 'form' | 'locals' | (string & {});
|
|
25
|
+
export interface DiscoveredApiParameter {
|
|
26
|
+
name: string;
|
|
27
|
+
location: ParameterLocation;
|
|
28
|
+
type?: string;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
description?: string;
|
|
31
|
+
example?: string;
|
|
32
|
+
schema?: JsonSchema;
|
|
33
|
+
detectionLocation?: SourceLocation;
|
|
34
|
+
evidenceLocations?: SourceLocation[];
|
|
35
|
+
conflictingTypes?: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface DiscoveredApiBody {
|
|
38
|
+
type?: 'json' | 'form' | 'text' | 'multipart' | 'graphql' | string;
|
|
39
|
+
schema?: JsonSchema;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
example?: unknown;
|
|
42
|
+
detectionLocation?: SourceLocation;
|
|
43
|
+
}
|
|
44
|
+
export interface DiscoveredApiResponse {
|
|
45
|
+
statusCode?: number;
|
|
46
|
+
headers?: DiscoveredApiParameter[];
|
|
47
|
+
body?: {
|
|
48
|
+
type?: string;
|
|
49
|
+
schema?: JsonSchema;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface DiscoveredApiAuth {
|
|
53
|
+
required: boolean;
|
|
54
|
+
type?: 'jwt' | 'basic' | 'oauth2' | 'cookie' | 'apiKey' | (string & {});
|
|
55
|
+
/** @Secured, @PreAuthorize, passport strategy, firewall rules, etc. */
|
|
56
|
+
annotation?: string;
|
|
57
|
+
detectionLocation?: SourceLocation;
|
|
58
|
+
}
|
|
59
|
+
export interface DiscoveredApiMiddleware {
|
|
60
|
+
name: string;
|
|
61
|
+
location?: SourceLocation;
|
|
62
|
+
}
|
|
63
|
+
export interface DiscoveredApiCookie {
|
|
64
|
+
name: string;
|
|
65
|
+
type?: 'request' | 'response';
|
|
66
|
+
secure?: boolean;
|
|
67
|
+
httpOnly?: boolean;
|
|
68
|
+
sameSite?: string;
|
|
69
|
+
detectionLocation?: SourceLocation;
|
|
70
|
+
}
|
|
71
|
+
export interface DiscoveredApi {
|
|
72
|
+
id: string;
|
|
73
|
+
framework: ApiFramework;
|
|
74
|
+
method: string;
|
|
75
|
+
pathExpression: string;
|
|
76
|
+
resolvedPath?: string;
|
|
77
|
+
source: SourceLocation;
|
|
78
|
+
confidence: EndpointConfidence;
|
|
79
|
+
requestBody?: DiscoveredApiBody;
|
|
80
|
+
params?: DiscoveredApiParameter[];
|
|
81
|
+
/** Summarized validation rules: @Valid, joi/zod/class-validator, etc. */
|
|
82
|
+
validation?: string[];
|
|
83
|
+
auth?: DiscoveredApiAuth;
|
|
84
|
+
responseModels?: JsonSchema[];
|
|
85
|
+
responses?: DiscoveredApiResponse[];
|
|
86
|
+
cookies?: DiscoveredApiCookie[];
|
|
87
|
+
middleware?: DiscoveredApiMiddleware[];
|
|
88
|
+
tags?: string[];
|
|
89
|
+
projectName?: string;
|
|
90
|
+
projectRoot?: string;
|
|
91
|
+
deprecated?: boolean;
|
|
92
|
+
description?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface DiscoveryContext {
|
|
95
|
+
workspaceFolder: string;
|
|
96
|
+
includeProjectRoots?: string[];
|
|
97
|
+
frameworksByProjectRoot?: Record<string, ApiFramework[]>;
|
|
98
|
+
/** Overrides for `process.env.*` resolution during path/route parsing (see envOverrides). */
|
|
99
|
+
envOverrides?: Record<string, string>;
|
|
100
|
+
/** Absolute path to a custom seed loader module; only active when set (see seed-loader). */
|
|
101
|
+
customSeedLoaderModulePath?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Sub-property names on request/response objects to track as shared context.
|
|
104
|
+
* Defaults to `["locals"]` (Express `res.locals` convention).
|
|
105
|
+
*/
|
|
106
|
+
contextProperties?: string[];
|
|
107
|
+
/** Skip per-endpoint component dependency traversal; call enrichEndpoint() on demand. */
|
|
108
|
+
skipComponentAnalysis?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface DiscoveryWarning {
|
|
111
|
+
code: 'provider-not-supported' | 'provider-failed' | 'dynamic-path-unresolved' | 'parameter-type-conflict' | 'component-dependency-limit-reached' | 'seed-manifest-invalid' | 'seed-endpoint-unmatched' | 'seed-loader-failed' | 'project-fingerprint-missing' | (string & {});
|
|
112
|
+
message: string;
|
|
113
|
+
framework?: ApiFramework;
|
|
114
|
+
filePath?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface DiscoveryStats {
|
|
117
|
+
frameworksDetected: ApiFramework[];
|
|
118
|
+
providersRun: string[];
|
|
119
|
+
endpointCount: number;
|
|
120
|
+
unresolvedEndpointCount: number;
|
|
121
|
+
scanDurationMs: number;
|
|
122
|
+
}
|
|
123
|
+
export interface DiscoveryResult {
|
|
124
|
+
endpoints: DiscoveredApi[];
|
|
125
|
+
warnings: DiscoveryWarning[];
|
|
126
|
+
stats: DiscoveryStats;
|
|
127
|
+
}
|
|
128
|
+
export interface FrameworkFingerprint {
|
|
129
|
+
projectRoot: string;
|
|
130
|
+
packageJsonPath?: string;
|
|
131
|
+
packageJson?: {
|
|
132
|
+
dependencies?: Record<string, string>;
|
|
133
|
+
devDependencies?: Record<string, string>;
|
|
134
|
+
scripts?: Record<string, string>;
|
|
135
|
+
};
|
|
136
|
+
evidenceFiles: string[];
|
|
137
|
+
/** Pre-collected source files, shared across providers in one run. */
|
|
138
|
+
sourceFiles?: string[];
|
|
139
|
+
}
|
|
140
|
+
export interface DiscoveredApiIndex {
|
|
141
|
+
version: string;
|
|
142
|
+
generatedAt: string;
|
|
143
|
+
projects: DiscoveredApiIndexProject[];
|
|
144
|
+
}
|
|
145
|
+
export interface DiscoveredApiIndexProject {
|
|
146
|
+
projectRoot: string;
|
|
147
|
+
frameworks: ApiFramework[];
|
|
148
|
+
/** Freshness metadata for drift detection (mtime + git hash where available). */
|
|
149
|
+
freshness: {
|
|
150
|
+
gitHash?: string;
|
|
151
|
+
scannedAt: string;
|
|
152
|
+
};
|
|
153
|
+
endpoints: DiscoveredApi[];
|
|
154
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 2a — Workflow discovery (L3).
|
|
3
|
+
*
|
|
4
|
+
* Analyzes discovered endpoints to find cross-request chains, emitted as
|
|
5
|
+
* suite flow-graph nodes (`request` + `if`/`for` + `script`):
|
|
6
|
+
*
|
|
7
|
+
* - AUTH chains: a token-producing endpoint (login/token/oauth) → protected
|
|
8
|
+
* endpoints (`auth.required`). The producer's post-response script extracts
|
|
9
|
+
* the token into a variable; an `if` gate runs dependents only when present.
|
|
10
|
+
* - CRUD chains: a create endpoint (`POST /x`) → id-scoped dependents
|
|
11
|
+
* (`GET/PUT/DELETE /x/{id}`). The producer captures the created id; the
|
|
12
|
+
* dependents run inside a `for` loop over one iteration.
|
|
13
|
+
*
|
|
14
|
+
* Extends `generate_scenarios` (within-request edge cases) with cross-request
|
|
15
|
+
* chains. Deterministic: chains are emitted sorted by producer path.
|
|
16
|
+
*/
|
|
17
|
+
import type { SuiteFlowNode } from '../test-suite/interfaces';
|
|
18
|
+
import type { DiscoveredApi } from './types';
|
|
19
|
+
export interface WorkflowProducer {
|
|
20
|
+
endpointId: string;
|
|
21
|
+
requestName: string;
|
|
22
|
+
method: string;
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkflowDependent {
|
|
26
|
+
endpointId: string;
|
|
27
|
+
requestName: string;
|
|
28
|
+
method: string;
|
|
29
|
+
path: string;
|
|
30
|
+
}
|
|
31
|
+
export interface WorkflowChain {
|
|
32
|
+
id: string;
|
|
33
|
+
kind: 'auth' | 'crud';
|
|
34
|
+
name: string;
|
|
35
|
+
confidence: 'high' | 'medium';
|
|
36
|
+
producer: WorkflowProducer;
|
|
37
|
+
dependents: WorkflowDependent[];
|
|
38
|
+
/** Variable the producer stores for dependents to read. */
|
|
39
|
+
variableName: string;
|
|
40
|
+
/** Suite flow nodes implementing the chain (request producer + if/for gate + dependents). */
|
|
41
|
+
nodes: SuiteFlowNode[];
|
|
42
|
+
}
|
|
43
|
+
/** Options for workflow discovery. */
|
|
44
|
+
export interface WorkflowDiscoveryOptions {
|
|
45
|
+
/** Collection id referenced by generated suite request nodes. */
|
|
46
|
+
collectionId: string;
|
|
47
|
+
/** Collection name referenced by generated suite request nodes. */
|
|
48
|
+
collectionName: string;
|
|
49
|
+
/** Folder path within the collection where the requests live (default ''). */
|
|
50
|
+
folderPath?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Discover cross-request workflow chains from discovered endpoints.
|
|
54
|
+
*/
|
|
55
|
+
export declare function discoverWorkflows(endpoints: DiscoveredApi[], options: WorkflowDiscoveryOptions): WorkflowChain[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Architect Service (Phase 4 / Layer 8).
|
|
3
|
+
*
|
|
4
|
+
* "I need a shopping cart" → a complete, reviewable API package in one flow:
|
|
5
|
+
* intent → AI-designed OpenAPI spec → imported collection → endpoints →
|
|
6
|
+
* test suite + .flow.js + workflow chains + markdown docs + round-trip
|
|
7
|
+
* OpenAPI export. Everything is tagged `ai_generated: true` so the Phase 2b
|
|
8
|
+
* drift machinery treats it as regenerable content.
|
|
9
|
+
*
|
|
10
|
+
* Dependencies are injected (DIP): the importer creates the collection from the
|
|
11
|
+
* designed spec, the exporter proves the round-trip, and the suite/flow/workflow
|
|
12
|
+
* generators are pure functions over the discovery model — all reused unchanged.
|
|
13
|
+
*/
|
|
14
|
+
import { IAiProvider } from '../ai/ai-provider';
|
|
15
|
+
import type { IOpenApiExporter, IOpenApiImporter } from '../openapi/interfaces';
|
|
16
|
+
import type { OpenApiExportOptions } from '../openapi/openapi-utils';
|
|
17
|
+
import type { DiscoveredApi } from '../api-discovery/types';
|
|
18
|
+
import { WorkflowChain } from '../api-discovery/workflow-discovery';
|
|
19
|
+
import type { TestSuite } from '../test-suite/interfaces';
|
|
20
|
+
export interface ApiArchitectOptions {
|
|
21
|
+
/** Collection name for the designed API (default: spec info title or intent slug). */
|
|
22
|
+
collectionName?: string;
|
|
23
|
+
/** Base URL for the designed API (default http://localhost:3000). */
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
/** Environment name to create with the server URL (optional). */
|
|
26
|
+
environmentName?: string;
|
|
27
|
+
/** OpenAPI info overrides for the round-trip export. */
|
|
28
|
+
openapiInfo?: OpenApiExportOptions['info'];
|
|
29
|
+
/** OpenAPI export format for the round-trip document (default json). */
|
|
30
|
+
openapiFormat?: OpenApiExportOptions['format'];
|
|
31
|
+
/** Folder path for generated suite request nodes (default ''). */
|
|
32
|
+
suiteFolderPath?: string;
|
|
33
|
+
/** Also assert discovered response body schemas (default false). */
|
|
34
|
+
assertBodySchema?: boolean;
|
|
35
|
+
/** Workspace folder for grounding knowledge (optional). */
|
|
36
|
+
workspaceFolder?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ApiArchitectResult {
|
|
39
|
+
/** The user intent this package was designed from. */
|
|
40
|
+
intent: string;
|
|
41
|
+
/** Collection created from the designed spec. */
|
|
42
|
+
collectionId: string;
|
|
43
|
+
collectionName: string;
|
|
44
|
+
environmentCreated?: string;
|
|
45
|
+
/** Endpoints derived from the designed collection (provenance = design). */
|
|
46
|
+
endpoints: DiscoveredApi[];
|
|
47
|
+
/** Test suite with one request node per endpoint. */
|
|
48
|
+
suite: TestSuite;
|
|
49
|
+
/** Runnable `.flow.js` source string. */
|
|
50
|
+
flow: string;
|
|
51
|
+
/** Discovered workflow chains (auth / CRUD) over the designed surface. */
|
|
52
|
+
workflows: WorkflowChain[];
|
|
53
|
+
/** Round-trip OpenAPI document exported from the collection. */
|
|
54
|
+
openapi: string;
|
|
55
|
+
/** Human-readable markdown docs for the designed API. */
|
|
56
|
+
docs: string;
|
|
57
|
+
/** ai_generated flag (Phase 2b drift hook). */
|
|
58
|
+
ai_generated: true;
|
|
59
|
+
derivedFrom: string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validate an AI-produced spec is a plausible OpenAPI 3.0 document.
|
|
63
|
+
* Returns an error message, or null when the shape is acceptable.
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateDesignedSpec(spec: unknown): string | null;
|
|
66
|
+
export declare class ApiArchitectService {
|
|
67
|
+
private importer;
|
|
68
|
+
private exporter;
|
|
69
|
+
private aiProvider;
|
|
70
|
+
constructor(importer: IOpenApiImporter, exporter: IOpenApiExporter, aiProvider: IAiProvider);
|
|
71
|
+
/**
|
|
72
|
+
* Design an API from a natural-language intent and produce the full,
|
|
73
|
+
* reviewable package. The collection is persisted via the importer;
|
|
74
|
+
* the suite/flow/docs are generated (not yet saved — callers decide
|
|
75
|
+
* whether to persist as part of an approve flow).
|
|
76
|
+
*/
|
|
77
|
+
designFromIntent(intent: string, options?: ApiArchitectOptions): Promise<ApiArchitectResult>;
|
|
78
|
+
/** Call the AI to produce and validate the designed OpenAPI spec. */
|
|
79
|
+
private designSpec;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Render markdown API docs from the designed surface. Keep the docs focused:
|
|
83
|
+
* intent, endpoint table, auth notes, and workflow chains.
|
|
84
|
+
*/
|
|
85
|
+
export declare function renderArchitectDocs(intent: string, collectionName: string, endpoints: DiscoveredApi[], workflows: WorkflowChain[]): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Architect — intent prompt builder (L8).
|
|
3
|
+
*
|
|
4
|
+
* Turns a natural-language API intent into a bounded instruction for the AI
|
|
5
|
+
* provider to design a complete OpenAPI 3.0 document (endpoints + DTOs + auth).
|
|
6
|
+
* The returned spec is parsed and imported by ApiArchitectService, so the
|
|
7
|
+
* prompt is strict about shape: a single JSON object, `openapi: "3.0.x"`,
|
|
8
|
+
* `paths`, and `components.schemas` for every request/response DTO.
|
|
9
|
+
*/
|
|
10
|
+
export interface ArchitectPromptOptions {
|
|
11
|
+
/** Target collection name (used to name the API in info.title when not given). */
|
|
12
|
+
collectionName?: string;
|
|
13
|
+
/** Base URL for `servers[0].url`. Defaults to `http://localhost:3000`. */
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
/** Optional workspace knowledge (gathered by the service) to ground the design. */
|
|
16
|
+
workspaceKnowledge?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build the AI prompt for designing an API from a natural-language intent.
|
|
20
|
+
* The model is expected to reply with ONLY a JSON OpenAPI document.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildArchitectPrompt(intent: string, options?: ArchitectPromptOptions): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Architect — collection → discovered-endpoints adapter (L8).
|
|
3
|
+
*
|
|
4
|
+
* Converts a designed OpenAPI collection (created via the OpenAPI importer)
|
|
5
|
+
* back into the discovery `DiscoveredApi` model so the Phase 2a test-suite /
|
|
6
|
+
* flow / workflow generators can be reused unchanged. The design flow has no
|
|
7
|
+
* source code, so provenance is the design itself (confidence 'high', the
|
|
8
|
+
* design is the ground truth for the intended surface).
|
|
9
|
+
*/
|
|
10
|
+
import { Collection } from '../../types/collection';
|
|
11
|
+
import { DiscoveredApi } from '../api-discovery/types';
|
|
12
|
+
/** Walk a collection tree, mapping every request item to a DiscoveredApi. */
|
|
13
|
+
export declare function collectionToEndpoints(collection: Collection): DiscoveredApi[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Architect (Phase 4 / Layer 8) — barrel.
|
|
3
|
+
*
|
|
4
|
+
* Exports the intent-driven API design service plus its pure helpers.
|
|
5
|
+
*/
|
|
6
|
+
export { ApiArchitectService, renderArchitectDocs, validateDesignedSpec } from './api-architect-service';
|
|
7
|
+
export type { ApiArchitectOptions, ApiArchitectResult } from './api-architect-service';
|
|
8
|
+
export { collectionToEndpoints } from './collection-to-endpoints';
|
|
9
|
+
export { buildArchitectPrompt } from './architect-prompt';
|
|
10
|
+
export type { ArchitectPromptOptions } from './architect-prompt';
|
|
@@ -15,7 +15,6 @@ import { IConfigService } from '../config';
|
|
|
15
15
|
* Service for managing HTTP Forge collections
|
|
16
16
|
*/
|
|
17
17
|
export declare class CollectionService implements ICollectionService {
|
|
18
|
-
private workspaceRoot;
|
|
19
18
|
private configService;
|
|
20
19
|
private fileWatcherFactory?;
|
|
21
20
|
private collectionsDir;
|
|
@@ -41,7 +40,7 @@ export declare class CollectionService implements ICollectionService {
|
|
|
41
40
|
* Set by the extension host to refresh tree views and panels.
|
|
42
41
|
*/
|
|
43
42
|
onCollectionsChanged?: () => void;
|
|
44
|
-
constructor(
|
|
43
|
+
constructor(configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined);
|
|
45
44
|
private ensureCollectionsDir;
|
|
46
45
|
private loadCollections;
|
|
47
46
|
private setupFileWatcher;
|
|
@@ -64,7 +63,6 @@ export declare class CollectionService implements ICollectionService {
|
|
|
64
63
|
getAllRequests(collectionId: string): CollectionItem[];
|
|
65
64
|
private findItemRecursive;
|
|
66
65
|
private findItemByPath;
|
|
67
|
-
private updateItemRecursive;
|
|
68
66
|
private deleteItemRecursive;
|
|
69
67
|
private collectRequestsRecursive;
|
|
70
68
|
createCollection(name: string): Promise<Collection>;
|
|
@@ -84,9 +82,7 @@ export declare class CollectionService implements ICollectionService {
|
|
|
84
82
|
reorderItems(collectionId: string, parentId: string | undefined, orderedItemIds: string[]): Promise<boolean>;
|
|
85
83
|
getRequestScript(collectionId: string, requestId: string, phase: 'pre-request' | 'post-response'): string | undefined;
|
|
86
84
|
setRequestScript(collectionId: string, requestId: string, phase: 'pre-request' | 'post-response', source: string): Promise<boolean>;
|
|
87
|
-
private findItemById;
|
|
88
85
|
private copyDirRecursive;
|
|
89
|
-
private deleteItemById;
|
|
90
86
|
importCollection(filePath: string): Promise<Collection>;
|
|
91
87
|
private importPostmanCollection;
|
|
92
88
|
exportCollection(collectionId: string, filePath: string): Promise<void>;
|
|
@@ -89,12 +89,4 @@ export declare class JsonCollectionLoader implements ICollectionStore {
|
|
|
89
89
|
* For JSON format, just reorder the items array and save
|
|
90
90
|
*/
|
|
91
91
|
reorderItems(collectionId: string, parentId: string | undefined, orderedItemIds: string[]): Promise<boolean>;
|
|
92
|
-
/**
|
|
93
|
-
* Find an item by ID in the collection tree
|
|
94
|
-
*/
|
|
95
|
-
private findItemById;
|
|
96
|
-
/**
|
|
97
|
-
* Delete an item by ID from the collection tree
|
|
98
|
-
*/
|
|
99
|
-
private deleteItemById;
|
|
100
92
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* instead of VS Code APIs.
|
|
9
9
|
*/
|
|
10
10
|
import { IFileWatcherFactory, INotificationService } from '../../types/platform';
|
|
11
|
-
import type { EnvironmentsConfig, HttpForgeConfig, IConfigService, McpConfig, ProxyConfig, RequestConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
11
|
+
import type { DiscoveryConfig, EnvironmentsConfig, HttpForgeConfig, IConfigService, McpConfig, ProxyConfig, RequestConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
12
12
|
/**
|
|
13
13
|
* Configuration Service Implementation
|
|
14
14
|
*
|
|
@@ -53,6 +53,7 @@ export declare class ConfigService implements IConfigService {
|
|
|
53
53
|
*/
|
|
54
54
|
getRestClientMergeGlobals(): boolean;
|
|
55
55
|
getProxyConfig(): ProxyConfig | null;
|
|
56
|
+
getDiscoveryConfig(): DiscoveryConfig;
|
|
56
57
|
getMcpConfig(): McpConfig;
|
|
57
58
|
/**
|
|
58
59
|
* Resolve a path relative to workspace
|
|
@@ -119,6 +119,19 @@ export interface RestClientExportConfig {
|
|
|
119
119
|
/** When exporting environments, merge global variables into each environment file */
|
|
120
120
|
mergeGlobals?: boolean;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Discovery configuration
|
|
124
|
+
*/
|
|
125
|
+
export interface DiscoveryConfig {
|
|
126
|
+
/** Absolute or workspace-relative path to a custom seed loader module. */
|
|
127
|
+
customSeedLoaderModulePath?: string;
|
|
128
|
+
/** Custom framework hints for discovery. Defaults to ['auto']. */
|
|
129
|
+
frameworks?: string[];
|
|
130
|
+
/** Custom request/response context properties to search for during component analysis. */
|
|
131
|
+
contextProperties?: string[];
|
|
132
|
+
/** When true, skip component dependency analysis during discovery. */
|
|
133
|
+
skipComponentAnalysis?: boolean;
|
|
134
|
+
}
|
|
122
135
|
/**
|
|
123
136
|
* MCP Server CORS configuration
|
|
124
137
|
*/
|
|
@@ -260,6 +273,8 @@ export interface HttpForgeConfig {
|
|
|
260
273
|
proxy?: ProxyConfig | null;
|
|
261
274
|
/** Cloud secret provider configuration (optional) */
|
|
262
275
|
secrets?: SecretsConfig;
|
|
276
|
+
/** Discovery configuration (optional) */
|
|
277
|
+
discovery?: DiscoveryConfig;
|
|
263
278
|
}
|
|
264
279
|
/**
|
|
265
280
|
* Configuration service interface
|
|
@@ -277,6 +292,8 @@ export interface IConfigService {
|
|
|
277
292
|
getRunnerConfig(): RunnerConfig;
|
|
278
293
|
/** Get environments configuration */
|
|
279
294
|
getEnvironmentsConfig(): EnvironmentsConfig;
|
|
295
|
+
/** Get discovery configuration */
|
|
296
|
+
getDiscoveryConfig(): DiscoveryConfig;
|
|
280
297
|
/** Get proxy configuration */
|
|
281
298
|
getProxyConfig(): ProxyConfig | null;
|
|
282
299
|
/** Get MCP server project-level configuration (always returns resolved defaults) */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config Services
|
|
3
3
|
*/
|
|
4
|
-
export type { EnvironmentsConfig, HttpForgeConfig, IConfigService, McpConfig, McpCorsConfig, McpToolMode, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
4
|
+
export type { DiscoveryConfig, EnvironmentsConfig, HttpForgeConfig, IConfigService, McpConfig, McpCorsConfig, McpToolMode, ProxyConfig, RequestConfig, RestClientExportConfig, RunnerConfig, ScriptsConfig, StorageConfig } from './config.interface';
|
|
5
5
|
export { CONFIG_FILES, DEFAULT_CONFIG, ROOT_DIRECTORIES } from './default-config';
|
|
6
6
|
export { ConfigService } from './config-service';
|
|
@@ -6,23 +6,12 @@
|
|
|
6
6
|
* instead of VS Code globalState.
|
|
7
7
|
*/
|
|
8
8
|
import { IKeyValueStore } from '../../types/platform';
|
|
9
|
-
import { Cookie,
|
|
10
|
-
/**
|
|
11
|
-
* Full cookie service interface (async write operations for platform persistence)
|
|
12
|
-
*/
|
|
13
|
-
export interface IAsyncCookieServiceFull extends ICookieReader, ICookieParser {
|
|
14
|
-
readonly count: number;
|
|
15
|
-
set(cookie: Cookie): Promise<void>;
|
|
16
|
-
setFromResponse(cookies: Cookie[]): Promise<void>;
|
|
17
|
-
delete(name: string, domain?: string, path?: string): Promise<boolean>;
|
|
18
|
-
clear(): Promise<void>;
|
|
19
|
-
clearDomain(domain: string): Promise<void>;
|
|
20
|
-
}
|
|
9
|
+
import { Cookie, IAsyncCookieService } from './interfaces';
|
|
21
10
|
/**
|
|
22
11
|
* Service for managing cookies across HTTP Forge sessions.
|
|
23
12
|
* Provides persistent cookie storage via IKeyValueStore.
|
|
24
13
|
*/
|
|
25
|
-
export declare class CookieService implements
|
|
14
|
+
export declare class CookieService implements IAsyncCookieService {
|
|
26
15
|
private store;
|
|
27
16
|
private storeKey;
|
|
28
17
|
private cookies;
|
|
@@ -37,6 +37,11 @@ export declare class CookieUtils {
|
|
|
37
37
|
* @returns Cookie header value (e.g., "name1=value1; name2=value2")
|
|
38
38
|
*/
|
|
39
39
|
static formatCookieHeader(cookies: Cookie[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* Generate the unique storage key for a cookie
|
|
42
|
+
* (domain|path|name, with wildcard defaults)
|
|
43
|
+
*/
|
|
44
|
+
static cookieKey(name: string, domain?: string, path?: string): string;
|
|
40
45
|
/**
|
|
41
46
|
* Check if a cookie is expired
|
|
42
47
|
*
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs module barrel (Layer 6 — docs as a BYPRODUCT of drift).
|
|
3
|
+
*/
|
|
4
|
+
export { generateReleaseNotes, renderReleaseNotesMarkdown, } from './release-notes';
|
|
5
|
+
export type { ReleaseNoteEntry, ReleaseNotes, ReleaseNotesOptions, ReleaseNoteType, } from './release-notes';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Release Notes (Layer 6 — docs as a BYPRODUCT of drift)
|
|
3
|
+
*
|
|
4
|
+
* Single Responsibility: derive a "what changed" release-notes artifact from
|
|
5
|
+
* the same git history the drift engine fingerprints. No dedicated docs phase
|
|
6
|
+
* budget (plan §4 Phase 3 / §7): the reviewer ships the diff, this renders it.
|
|
7
|
+
*
|
|
8
|
+
* Deterministic: pure `git log` parsing + conventional-commit classification.
|
|
9
|
+
*/
|
|
10
|
+
export type ReleaseNoteType = 'feat' | 'fix' | 'perf' | 'docs' | 'refactor' | 'test' | 'build' | 'chore' | 'other';
|
|
11
|
+
export interface ReleaseNoteEntry {
|
|
12
|
+
/** Conventional-commit type, e.g. `feat`, `fix`, `perf`. */
|
|
13
|
+
type: ReleaseNoteType;
|
|
14
|
+
/** Optional scope, e.g. `core`, `discovery`, `review`. */
|
|
15
|
+
scope?: string;
|
|
16
|
+
/** Commit subject (without the type/scope prefix). */
|
|
17
|
+
subject: string;
|
|
18
|
+
/** Short git hash. */
|
|
19
|
+
hash: string;
|
|
20
|
+
/** True when the subject carries `!` (e.g. `feat!:`) or "BREAKING CHANGE". */
|
|
21
|
+
breaking: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface ReleaseNotesOptions {
|
|
24
|
+
/** Project root (must be inside a git work tree). */
|
|
25
|
+
projectRoot: string;
|
|
26
|
+
/** Lower bound (exclusive). Omit to list all reachable history up to `to`. */
|
|
27
|
+
from?: string;
|
|
28
|
+
/** Upper bound (inclusive). Defaults to HEAD. */
|
|
29
|
+
to?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ReleaseNotes {
|
|
32
|
+
from: string | null;
|
|
33
|
+
to: string;
|
|
34
|
+
/** The resolved `to` hash, when available. */
|
|
35
|
+
toHash?: string;
|
|
36
|
+
entries: ReleaseNoteEntry[];
|
|
37
|
+
/** Type → count. */
|
|
38
|
+
summary: Partial<Record<ReleaseNoteType, number>>;
|
|
39
|
+
/** True when the project is not a git work tree (no notes could be generated). */
|
|
40
|
+
gitAvailable: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* List conventional commits between two refs via `git log`. Returns [] when
|
|
44
|
+
* git is unavailable or the range is empty/invalid.
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateReleaseNotes(options: ReleaseNotesOptions): ReleaseNotes;
|
|
47
|
+
/**
|
|
48
|
+
* Render release notes as markdown — grouped by type, breaking changes first.
|
|
49
|
+
* This is the artifact dropped into a PR/release body or release-notes.md.
|
|
50
|
+
*/
|
|
51
|
+
export declare function renderReleaseNotesMarkdown(notes: ReleaseNotes): string;
|
|
@@ -164,6 +164,5 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
|
|
|
164
164
|
private validateEnvironmentNameNotTaken;
|
|
165
165
|
private validateConfigLoaded;
|
|
166
166
|
updateEnvironmentVariables(environmentId: string, variables: Record<string, string>): Promise<void>;
|
|
167
|
-
private loadJsonFile;
|
|
168
167
|
private saveJsonFile;
|
|
169
168
|
}
|
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
* 5. Return original {{...}} if nothing matched
|
|
22
22
|
*/
|
|
23
23
|
import type { IVariableInterpolator } from '../../types/environment-config';
|
|
24
|
+
/**
|
|
25
|
+
* Parse arguments from a dynamic variable call, e.g. "1, 100" → [1, 100]
|
|
26
|
+
* Supports environment variable resolution for unquoted args:
|
|
27
|
+
* - Quoted: "hello" or 'hello' → always literal string (quotes stripped)
|
|
28
|
+
* - Unquoted: myVar → variable lookup first, fallback to literal string
|
|
29
|
+
* - Number: 100 → number
|
|
30
|
+
*/
|
|
31
|
+
declare function parseDynamicArgs(argsStr: string | undefined, variables?: Record<string, any>): any[] | undefined;
|
|
32
|
+
export { parseDynamicArgs };
|
|
24
33
|
/**
|
|
25
34
|
* Configuration for variable resolution
|
|
26
35
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header sanitization helpers shared by RequestPreprocessor and NodeHttpClient.
|
|
3
|
+
* Single source of truth for removing characters invalid in HTTP header values.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Sanitize a single header value by replacing smart/curly quotes with ASCII
|
|
7
|
+
* equivalents and stripping control characters (tab preserved).
|
|
8
|
+
*/
|
|
9
|
+
export declare function sanitizeHeaderValue(value: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Sanitize every value in a headers record.
|
|
12
|
+
*/
|
|
13
|
+
export declare function sanitizeHeaders(headers: Record<string, string>): Record<string, string>;
|
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
* SOLID:
|
|
14
14
|
* - Single Responsibility: Orchestrates HTTP requests via interceptors
|
|
15
15
|
* - Open/Closed: Extended through interceptor chain
|
|
16
|
-
* - Dependency Inversion: Depends on IHttpClient, IUrlBuilder,
|
|
16
|
+
* - Dependency Inversion: Depends on IHttpClient, IUrlBuilder, IInterceptorExecutor, IRequestPreprocessor
|
|
17
17
|
*/
|
|
18
18
|
import type { IHttpClient } from '../../types/platform';
|
|
19
19
|
import { HttpRequestOptions, HttpResponse } from '../../types/types';
|
|
20
|
-
import {
|
|
20
|
+
import { IInterceptorExecutor } from './interceptor-chain';
|
|
21
21
|
import { IHttpRequestService } from './interfaces';
|
|
22
22
|
import { IUrlBuilder } from './url-builder';
|
|
23
23
|
export declare class HttpRequestService implements IHttpRequestService {
|
|
24
24
|
private readonly urlBuilder;
|
|
25
25
|
private readonly interceptors;
|
|
26
26
|
private readonly httpClient;
|
|
27
|
-
constructor(urlBuilder: IUrlBuilder, interceptors:
|
|
27
|
+
constructor(urlBuilder: IUrlBuilder, interceptors: IInterceptorExecutor, httpClient: IHttpClient);
|
|
28
28
|
/**
|
|
29
29
|
* Execute an HTTP request with interceptor support.
|
|
30
30
|
*/
|