@http-forge/core 0.6.32 → 0.6.36-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/README.md +51 -0
  2. package/dist/__tests__/api-discovery/golden-utils.d.ts +10 -0
  3. package/dist/index.d.ts +49 -22
  4. package/dist/index.js +456 -480
  5. package/dist/index.mjs +456 -480
  6. package/dist/infrastructure/ai/ai-context.d.ts +109 -0
  7. package/dist/infrastructure/ai/ai-provider.d.ts +1 -1
  8. package/dist/infrastructure/ai/ai-utils.d.ts +38 -0
  9. package/dist/infrastructure/ai/http-providers.d.ts +34 -0
  10. package/dist/infrastructure/api-discovery/analyzer/component-analyzer.d.ts +60 -0
  11. package/dist/infrastructure/api-discovery/analyzer/express-component-analyzer.d.ts +14 -0
  12. package/dist/infrastructure/api-discovery/analyzer/fastify-component-analyzer.d.ts +14 -0
  13. package/dist/infrastructure/api-discovery/analyzer/index.d.ts +11 -0
  14. package/dist/infrastructure/api-discovery/analyzer/lambda-component-analyzer.d.ts +18 -0
  15. package/dist/infrastructure/api-discovery/api-discovery-service.d.ts +49 -0
  16. package/dist/infrastructure/api-discovery/auth-validation.d.ts +34 -0
  17. package/dist/infrastructure/api-discovery/drift-engine.d.ts +139 -0
  18. package/dist/infrastructure/api-discovery/fastapi/fastapi-discovery-provider.d.ts +19 -0
  19. package/dist/infrastructure/api-discovery/fastapi/fastapi-parser.d.ts +60 -0
  20. package/dist/infrastructure/api-discovery/framework-detector.d.ts +8 -0
  21. package/dist/infrastructure/api-discovery/index.d.ts +29 -0
  22. package/dist/infrastructure/api-discovery/path-utils.d.ts +17 -0
  23. package/dist/infrastructure/api-discovery/project-name.d.ts +2 -0
  24. package/dist/infrastructure/api-discovery/provider.d.ts +29 -0
  25. package/dist/infrastructure/api-discovery/providers/express-discovery-provider.d.ts +13 -0
  26. package/dist/infrastructure/api-discovery/providers/fastify-discovery-provider.d.ts +13 -0
  27. package/dist/infrastructure/api-discovery/providers/lambda-discovery-provider.d.ts +19 -0
  28. package/dist/infrastructure/api-discovery/providers/nest-discovery-provider.d.ts +12 -0
  29. package/dist/infrastructure/api-discovery/seed-loader.d.ts +11 -0
  30. package/dist/infrastructure/api-discovery/source-files.d.ts +1 -0
  31. package/dist/infrastructure/api-discovery/spring/controller-visitor.d.ts +141 -0
  32. package/dist/infrastructure/api-discovery/spring/endpoint-parser.d.ts +51 -0
  33. package/dist/infrastructure/api-discovery/spring/file-utils.d.ts +28 -0
  34. package/dist/infrastructure/api-discovery/spring/model.d.ts +84 -0
  35. package/dist/infrastructure/api-discovery/spring/schema-generator.d.ts +65 -0
  36. package/dist/infrastructure/api-discovery/spring/spring-discovery-provider.d.ts +30 -0
  37. package/dist/infrastructure/api-discovery/spring/spring-types.d.ts +27 -0
  38. package/dist/infrastructure/api-discovery/test-generator.d.ts +69 -0
  39. package/dist/infrastructure/api-discovery/types.d.ts +154 -0
  40. package/dist/infrastructure/api-discovery/workflow-discovery.d.ts +55 -0
  41. package/dist/infrastructure/architect/api-architect-service.d.ts +85 -0
  42. package/dist/infrastructure/architect/architect-prompt.d.ts +22 -0
  43. package/dist/infrastructure/architect/collection-to-endpoints.d.ts +13 -0
  44. package/dist/infrastructure/architect/index.d.ts +10 -0
  45. package/dist/infrastructure/collection/collection-service.d.ts +1 -5
  46. package/dist/infrastructure/collection/json-collection-loader.d.ts +0 -8
  47. package/dist/infrastructure/cookie/cookie-service.d.ts +2 -13
  48. package/dist/infrastructure/cookie/cookie-utils.d.ts +5 -0
  49. package/dist/infrastructure/docs/index.d.ts +5 -0
  50. package/dist/infrastructure/docs/release-notes.d.ts +51 -0
  51. package/dist/infrastructure/environment/environment-config-service.d.ts +0 -1
  52. package/dist/infrastructure/environment/variable-interpolator.d.ts +9 -0
  53. package/dist/infrastructure/http/header-utils.d.ts +13 -0
  54. package/dist/infrastructure/http/http-request-service.d.ts +3 -3
  55. package/dist/infrastructure/http/interceptor-chain.d.ts +35 -16
  56. package/dist/infrastructure/http/native-http-client.d.ts +0 -10
  57. package/dist/infrastructure/openapi/interfaces.d.ts +14 -0
  58. package/dist/infrastructure/openapi/openapi-exporter.d.ts +11 -91
  59. package/dist/infrastructure/openapi/openapi-importer.d.ts +19 -0
  60. package/dist/infrastructure/openapi/openapi-operation-builder.d.ts +36 -0
  61. package/dist/infrastructure/openapi/openapi-schema-merger.d.ts +33 -0
  62. package/dist/infrastructure/openapi/openapi-spec-writer.d.ts +27 -0
  63. package/dist/infrastructure/openapi/openapi-utils.d.ts +62 -0
  64. package/dist/infrastructure/parsers/har-parser.d.ts +63 -0
  65. package/dist/infrastructure/parsers/index.d.ts +2 -0
  66. package/dist/infrastructure/review/index.d.ts +5 -0
  67. package/dist/infrastructure/review/review-engine.d.ts +95 -0
  68. package/dist/infrastructure/script/crypto-js-compat.d.ts +123 -0
  69. package/dist/infrastructure/script/request-object-factory.d.ts +54 -0
  70. package/dist/infrastructure/script/request-script-session.d.ts +0 -5
  71. package/dist/infrastructure/script/script-executor.d.ts +4 -33
  72. package/dist/infrastructure/script/script-factories.d.ts +13 -0
  73. package/dist/infrastructure/script/variable-scopes.d.ts +101 -0
  74. package/dist/infrastructure/test-suite/interfaces.d.ts +6 -0
  75. package/dist/infrastructure/test-suite/result-storage-service.d.ts +6 -1
  76. package/dist/infrastructure/test-suite/result-storage.d.ts +14 -1
  77. package/dist/runtime/collection-traversal.d.ts +32 -0
  78. package/dist/runtime/direct-execution.d.ts +7 -0
  79. package/dist/runtime/execution-helpers.d.ts +30 -0
  80. package/dist/runtime/mcp-dispatcher.d.ts +10 -34
  81. package/dist/runtime/mcp-handlers/ai.d.ts +6 -0
  82. package/dist/runtime/mcp-handlers/collection.d.ts +5 -0
  83. package/dist/runtime/mcp-handlers/discovery.d.ts +12 -0
  84. package/dist/runtime/mcp-handlers/environment-management.d.ts +6 -0
  85. package/dist/runtime/mcp-handlers/environment.d.ts +5 -0
  86. package/dist/runtime/mcp-handlers/execution.d.ts +6 -0
  87. package/dist/runtime/mcp-handlers/helpers.d.ts +43 -0
  88. package/dist/runtime/mcp-handlers/inspection.d.ts +5 -0
  89. package/dist/runtime/mcp-handlers/registry.d.ts +12 -0
  90. package/dist/runtime/mcp-handlers/request.d.ts +5 -0
  91. package/dist/runtime/mcp-handlers/review.d.ts +10 -0
  92. package/dist/runtime/mcp-handlers/run-status.d.ts +5 -0
  93. package/dist/runtime/mcp-handlers/suite.d.ts +6 -0
  94. package/dist/runtime/mcp-handlers/types.d.ts +59 -0
  95. package/dist/runtime/mcp-prompts.d.ts +16 -2
  96. package/dist/runtime/mcp-tool-schemas.d.ts +8 -0
  97. package/dist/runtime/suite-executor.d.ts +20 -0
  98. package/dist/types/types.d.ts +0 -9
  99. package/dist/utils/env-hints.d.ts +17 -0
  100. 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(workspaceRoot: string, configService: IConfigService, fileWatcherFactory?: IFileWatcherFactory | undefined);
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
  }
@@ -6,23 +6,12 @@
6
6
  * instead of VS Code globalState.
7
7
  */
8
8
  import { IKeyValueStore } from '../../types/platform';
9
- import { Cookie, ICookieParser, ICookieReader } from './interfaces';
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 IAsyncCookieServiceFull {
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, IInterceptorChain, IRequestPreprocessor
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 { IInterceptorChain } from './interceptor-chain';
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: IInterceptorChain, httpClient: IHttpClient);
27
+ constructor(urlBuilder: IUrlBuilder, interceptors: IInterceptorExecutor, httpClient: IHttpClient);
28
28
  /**
29
29
  * Execute an HTTP request with interceptor support.
30
30
  */
@@ -98,11 +98,12 @@ export interface IErrorInterceptor {
98
98
  handle(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | void> | HttpResponse | void;
99
99
  }
100
100
  /**
101
- * Interceptor chain interface
102
- * Same as plugin's IInterceptorChain
103
- * Defines the contract for managing and executing interceptors
101
+ * Interceptor registry interface
102
+ * Defines the contract for managing registered interceptors.
103
+ * Consumers that only register/interrogate interceptors depend on this
104
+ * narrow interface instead of the full chain.
104
105
  */
105
- export interface IInterceptorChain {
106
+ export interface IInterceptorRegistry {
106
107
  /**
107
108
  * Register a request interceptor
108
109
  */
@@ -127,18 +128,6 @@ export interface IInterceptorChain {
127
128
  * Remove an error interceptor by name
128
129
  */
129
130
  removeErrorInterceptor(name: string): boolean;
130
- /**
131
- * Execute request interceptors
132
- */
133
- executeRequestInterceptors(request: HttpRequest, context: InterceptorContext): Promise<HttpRequest>;
134
- /**
135
- * Execute response interceptors
136
- */
137
- executeResponseInterceptors(response: HttpResponse, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse>;
138
- /**
139
- * Execute error interceptors
140
- */
141
- executeErrorInterceptors(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | undefined>;
142
131
  /**
143
132
  * Clear all interceptors
144
133
  */
@@ -152,6 +141,36 @@ export interface IInterceptorChain {
152
141
  error: string[];
153
142
  };
154
143
  }
144
+ /**
145
+ * Interceptor executor interface
146
+ * Defines the contract for running the interceptor pipeline.
147
+ * Consumers that only execute interceptors depend on this narrow interface
148
+ * instead of the full chain.
149
+ */
150
+ export interface IInterceptorExecutor {
151
+ /**
152
+ * Execute request interceptors
153
+ */
154
+ executeRequestInterceptors(request: HttpRequest, context: InterceptorContext): Promise<HttpRequest>;
155
+ /**
156
+ * Execute response interceptors
157
+ */
158
+ executeResponseInterceptors(response: HttpResponse, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse>;
159
+ /**
160
+ * Execute error interceptors
161
+ */
162
+ executeErrorInterceptors(error: Error, request: HttpRequest, context: InterceptorContext): Promise<HttpResponse | undefined>;
163
+ }
164
+ /**
165
+ * Interceptor chain interface
166
+ * Same as plugin's IInterceptorChain
167
+ * Defines the full contract for managing and executing interceptors.
168
+ * Segregated into IInterceptorRegistry (management) and
169
+ * IInterceptorExecutor (execution); this type composes both so existing
170
+ * consumers keep a single, complete dependency.
171
+ */
172
+ export interface IInterceptorChain extends IInterceptorRegistry, IInterceptorExecutor {
173
+ }
155
174
  /**
156
175
  * Interceptor chain manager
157
176
  * Same implementation as plugin's InterceptorChain class
@@ -80,16 +80,6 @@ export declare class NodeHttpClient implements IHttpClient {
80
80
  private findCertificateMapping;
81
81
  private mappingMatchesHost;
82
82
  private readOptionalFile;
83
- /**
84
- * Sanitize header value to remove/replace invalid characters
85
- * Same implementation as plugin's RequestPreprocessor.sanitizeHeaderValue
86
- */
87
- private sanitizeHeaderValue;
88
- /**
89
- * Sanitize all headers
90
- * Same implementation as plugin's RequestPreprocessor.sanitizeHeaders
91
- */
92
- private sanitizeHeaders;
93
83
  /**
94
84
  * Parse Set-Cookie headers into structured objects
95
85
  * Same implementation as plugin's HttpRequestService.parseCookies
@@ -32,6 +32,20 @@ export interface IOpenApiImporter {
32
32
  collection: Collection;
33
33
  environmentCreated?: string;
34
34
  }>;
35
+ /**
36
+ * Import an OpenAPI spec fetched from a URL.
37
+ */
38
+ importFromUrl(url: string, options?: OpenApiImportOptions): Promise<{
39
+ collection: Collection;
40
+ environmentCreated?: string;
41
+ }>;
42
+ /**
43
+ * Import an OpenAPI spec from an in-memory string (JSON or YAML).
44
+ */
45
+ importFromString(rawContent: string, options?: OpenApiImportOptions): Promise<{
46
+ collection: Collection;
47
+ environmentCreated?: string;
48
+ }>;
35
49
  }
36
50
  /**
37
51
  * Schema inferrer interface (low-level)