@http-forge/core 0.6.26 → 0.6.27

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.
@@ -46,9 +46,22 @@ export declare class FolderCollectionStore implements ICollectionStore {
46
46
  */
47
47
  getIdBySlug(slug: string): string | undefined;
48
48
  /**
49
- * Ensure collections directory exists
49
+ * Ensure collections directory exists, and write AGENTS.md to the forge root
50
+ * (.http-forge/) on first initialisation so AI agents can discover the workspace
51
+ * schema without needing MCP tools.
50
52
  */
51
53
  private ensureDirectory;
54
+ /**
55
+ * Write .http-forge/AGENTS.md the first time a workspace is initialised.
56
+ * The file teaches AI assistants (GitHub Copilot, Claude, Cursor, …) the
57
+ * folder layout and schema URLs so they can author collections by editing
58
+ * files directly — without consuming MCP tool tokens.
59
+ *
60
+ * collectionsDir = {forgeRoot}/collections → forgeRoot = parent dir
61
+ * forgeRoot lives inside .http-forge/assets/ in the extension, so we walk
62
+ * two levels up to land in .http-forge/.
63
+ */
64
+ private ensureAgentsMd;
52
65
  /**
53
66
  * Read and parse a JSON metadata file, tolerating transient partial/empty reads.
54
67
  *
@@ -117,8 +117,13 @@ export interface McpCorsConfig {
117
117
  * useful for tiny, stable collections or external automation that relies on
118
118
  * exact generated tool names. **Avoid for workspaces with >100 requests** —
119
119
  * the tool list will bloat the AI context window and degrade tool-selection accuracy.
120
+ * - `execution-only`: exposes only tools that require the HTTP Forge runtime
121
+ * (run, poll results, AI analysis). Discovery and collection-management tools
122
+ * are omitted because AI agents with file-system access can read/write the
123
+ * plain-JSON collection files directly. Best token-budget option for local
124
+ * VS Code / CLI setups where the agent also has workspace file access.
120
125
  */
121
- export type McpToolMode = 'flat' | 'drilldown' | 'auto';
126
+ export type McpToolMode = 'flat' | 'drilldown' | 'auto' | 'execution-only';
122
127
  /**
123
128
  * MCP Server project-level configuration (stored in http-forge.config.json)
124
129
  */
@@ -31,10 +31,12 @@ export interface ResultSummary {
31
31
  d: number;
32
32
  /** Passed (p) */
33
33
  p: boolean;
34
- /** Assertions passed count (ap) */
34
+ /** Assertions passed count — excludes skipped (ap) */
35
35
  ap: number;
36
36
  /** Assertions failed count (af) */
37
37
  af: number;
38
+ /** Assertions skipped via pm.test.skip() (as) — omitted when 0 */
39
+ as?: number;
38
40
  /** Request ID (r) - used to rebuild filename */
39
41
  r: string;
40
42
  /** Error message if failed (e) - null if passed */
@@ -230,6 +232,8 @@ export interface FullResultDetails {
230
232
  name: string;
231
233
  passed: boolean;
232
234
  message: string | null;
235
+ /** True when explicitly skipped via pm.test.skip() */
236
+ skipped?: boolean;
233
237
  }>;
234
238
  /** Error message */
235
239
  error: string | null;
@@ -35,6 +35,13 @@ export interface McpRunCallbacks {
35
35
  runCollection: (col: Collection, args: Record<string, unknown>) => Promise<unknown>;
36
36
  runSuite: (suiteId: string, suiteName: string, args: Record<string, unknown>) => Promise<unknown>;
37
37
  }
38
+ /**
39
+ * Post-process a run result before returning it to the AI:
40
+ * - truncates `result.body` (run_request)
41
+ * - truncates `result.failedRequests[N].body` (run_collection / run_folder / run_suite / get_run_summary)
42
+ * No-op when `include` contains `'fullBody'` or when the result has no body fields.
43
+ */
44
+ export declare function applyMcpBodyTruncation(result: unknown, include: string[]): unknown;
38
45
  /** Tools that write to disk and should bust the MCP tool-list cache after execution. */
39
46
  export declare const CACHE_BUSTING_TOOLS: Set<string>;
40
47
  /**
@@ -31,5 +31,11 @@ export declare function decodeCursor(cursor: string | undefined): number;
31
31
  *
32
32
  * The caller is responsible for applying exclusion filters before passing the
33
33
  * arrays here. This function is pure — it reads no disk state.
34
+ *
35
+ * @param workspaceFolder - Optional path to the workspace root. When supplied
36
+ * and `toolMode` is `auto`, the function checks whether `.http-forge/AGENTS.md`
37
+ * exists. If it does, the workspace has been prepared for AI file-based editing
38
+ * and `execution-only` is used instead of `drilldown`, saving ~60 % of tool-list
39
+ * tokens without any manual configuration.
34
40
  */
35
- export declare function buildMcpToolList(collections: Collection[], suites: TestSuite[], config: McpConfig): McpTool[];
41
+ export declare function buildMcpToolList(collections: Collection[], suites: TestSuite[], config: McpConfig, workspaceFolder?: string): McpTool[];
@@ -43,9 +43,9 @@ export declare const REQUEST_INPUT_SCHEMA: {
43
43
  readonly type: "array";
44
44
  readonly items: {
45
45
  readonly type: "string";
46
- readonly enum: readonly ["headers", "cookies", "tests", "consoleOutput", "report"];
46
+ readonly enum: readonly ["headers", "cookies", "tests", "consoleOutput", "report", "fullBody"];
47
47
  };
48
- readonly description: "Extra fields to include in the response (default: status, ok, body, allPassed)";
48
+ readonly description: "Extra fields to include in the response (default: status, ok, body, allPassed). Use fullBody to disable the 4KB body truncation.";
49
49
  };
50
50
  };
51
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@http-forge/core",
3
- "version": "0.6.26",
3
+ "version": "0.6.27",
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",