@http-forge/core 0.6.37 → 0.6.39

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.
@@ -0,0 +1,60 @@
1
+ /**
2
+ * AGENTS.md Guide Management
3
+ *
4
+ * Single Responsibility: own the `.http-forge/AGENTS.md` template (version +
5
+ * content) and the read/status/refresh operations on it. `FolderCollectionStore`
6
+ * delegates first-time creation here; the VS Code extension and the CLI reuse
7
+ * the status/refresh helpers so every host agrees on what "stale" means.
8
+ *
9
+ * Versioning: `AGENTS_MD_VERSION` must be bumped on every template change.
10
+ * Files without a marker (all guides written before versioning) read as
11
+ * version 0 and are therefore stale. Refresh is always replace-with-backup —
12
+ * the previous file is copied to `AGENTS.md.bak` (single deterministic
13
+ * backup, overwritten on repeat) before the fresh template is written, so
14
+ * user customizations are never silently lost.
15
+ */
16
+ /** Current template version. Bump when `buildAgentsMdContent()` changes. */
17
+ export declare const AGENTS_MD_VERSION = 1;
18
+ export declare const AGENTS_MD_FILENAME = "AGENTS.md";
19
+ export declare const AGENTS_MD_BACKUP_FILENAME = "AGENTS.md.bak";
20
+ /** Absolute path of the guide inside a `.http-forge/` directory. */
21
+ export declare function getAgentsMdPath(forgeDir: string): string;
22
+ /**
23
+ * Parse the version marker from guide content.
24
+ * Missing or unparseable markers read as 0 (legacy guide — stale).
25
+ */
26
+ export declare function readAgentsMdVersion(content: string): number;
27
+ export interface AgentsMdStatus {
28
+ exists: boolean;
29
+ path: string;
30
+ currentVersion: number;
31
+ latestVersion: number;
32
+ stale: boolean;
33
+ }
34
+ /** Report whether the guide exists and whether it predates the template. */
35
+ export declare function getAgentsMdStatus(forgeDir: string): AgentsMdStatus;
36
+ export interface AgentsMdRefreshResult {
37
+ path: string;
38
+ backupPath: string | null;
39
+ previousVersion: number;
40
+ version: number;
41
+ /** True when no guide existed and one was created (no backup taken). */
42
+ created: boolean;
43
+ }
44
+ /**
45
+ * Replace the guide with the current template, backing up the previous file
46
+ * to `AGENTS.md.bak` first. `backupPath` is null when nothing existed before.
47
+ */
48
+ export declare function refreshAgentsMd(forgeDir: string): AgentsMdRefreshResult;
49
+ /**
50
+ * Write-once creation used on workspace initialisation. Returns true when the
51
+ * file was created, false when it already existed (never overwrites).
52
+ */
53
+ export declare function ensureAgentsMdFile(forgeDir: string): boolean;
54
+ /**
55
+ * Build the current `.http-forge/AGENTS.md` template. The file teaches AI
56
+ * assistants (GitHub Copilot, Claude, Cursor, …) the folder layout and schema
57
+ * URLs so they can author collections by editing files directly — without
58
+ * consuming MCP tool tokens.
59
+ */
60
+ export declare function buildAgentsMdContent(): string;
@@ -49,13 +49,16 @@ export declare class FolderCollectionStore implements ICollectionStore {
49
49
  * Ensure collections directory exists, and write AGENTS.md to the forge root
50
50
  * (.http-forge/) on first initialisation so AI agents can discover the workspace
51
51
  * schema without needing MCP tools.
52
+ * Only called when actually saving data, not on construction.
52
53
  */
53
54
  private ensureDirectory;
54
55
  /**
55
56
  * 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.
57
+ * Template ownership lives in `./agents-md` (versioned via
58
+ * `AGENTS_MD_VERSION`). This stays write-once so user customizations are
59
+ * never overwritten; stale guides are refreshed explicitly through
60
+ * `refreshAgentsMd()` (extension command / CLI), which backs up the
61
+ * previous file to `AGENTS.md.bak` first.
59
62
  *
60
63
  * collectionsDir = {forgeRoot}/collections → forgeRoot = parent dir
61
64
  * forgeRoot lives inside .http-forge/assets/ in the extension, so we walk
@@ -18,7 +18,7 @@ export declare class JsonCollectionLoader implements ICollectionStore {
18
18
  private cache;
19
19
  constructor(collectionsDir: string);
20
20
  /**
21
- * Ensure collections directory exists
21
+ * Ensure collections directory exists (lazy)
22
22
  */
23
23
  private ensureDirectory;
24
24
  /**
@@ -21,6 +21,7 @@ export declare class ConfigService implements IConfigService {
21
21
  private notifications?;
22
22
  private config;
23
23
  private configPath;
24
+ private configDir;
24
25
  private fileWatchers;
25
26
  constructor(workspacePath: string, fileWatcherFactory?: IFileWatcherFactory | undefined, notifications?: INotificationService | undefined);
26
27
  private normalizeWorkspacePath;
@@ -57,7 +58,11 @@ export declare class ConfigService implements IConfigService {
57
58
  getDiscoveryConfig(): DiscoveryConfig;
58
59
  getMcpConfig(): McpConfig;
59
60
  /**
60
- * Resolve a path relative to workspace
61
+ * Resolve a path relative to the config file location.
62
+ * When a config file exists, paths are resolved against its directory.
63
+ * When no config exists, fallback to workspace root.
64
+ * Handles backward compatibility for configs inside .http-forge that used
65
+ * workspace-relative defaults like "./.http-forge/assets".
61
66
  */
62
67
  private resolvePath;
63
68
  /**
@@ -73,9 +78,8 @@ export declare class ConfigService implements IConfigService {
73
78
  /**
74
79
  * Resolve storage root with backward compatibility for config-less workspaces.
75
80
  *
76
- * In v0.6.16 the default root changed to `.http-forge/assets`. If a workspace
77
- * has no config file and existing collections were created under an older
78
- * default location, prefer that legacy location so collections remain visible.
81
+ * Supports both integrated mode (workspace/.http-forge/assets) and standalone mode
82
+ * (workspace/assets) where .http-forge is opened as the workspace root.
79
83
  */
80
84
  private resolveStorageRootPath;
81
85
  getRootPath(): string;
@@ -92,6 +96,7 @@ export declare class ConfigService implements IConfigService {
92
96
  onConfigReloaded?: () => void;
93
97
  reload(): void;
94
98
  configExists(): boolean;
99
+ private getDefaultConfigForCurrentLocation;
95
100
  createDefaultConfig(): Promise<void>;
96
101
  /**
97
102
  * Create sample environment files
@@ -73,6 +73,7 @@ export declare class EnvironmentConfigService implements IEnvironmentConfigServi
73
73
  resetEnvironmentOverrides(envName?: string): Promise<void>;
74
74
  getEnvironmentVariableLocal(key: string): string | undefined;
75
75
  getEnvironmentVariableLocals(): Record<string, string>;
76
+ getAllEnvironmentVariableLocals(): Record<string, Record<string, string>>;
76
77
  setGlobalVariable(key: string, value: unknown): void;
77
78
  getGlobalVariable(key: string): string | undefined;
78
79
  getGlobalVariableLocal(key: string): string | undefined;
@@ -30,7 +30,7 @@ export declare class TestSuiteService implements ITestSuiteService {
30
30
  onSuitesChanged?: SuitesChangedCallback;
31
31
  });
32
32
  /**
33
- * Ensure suites directory exists
33
+ * Ensure suites directory exists (lazy — only when saving).
34
34
  */
35
35
  private ensureSuitesDir;
36
36
  /**
@@ -104,6 +104,13 @@ export interface IVariableManager {
104
104
  deleteEnvironmentVariable(key: string, envName?: string): void;
105
105
  clearEnvironmentVariables(envName?: string): void;
106
106
  getEnvironmentVariableLocals(): Record<string, string>;
107
+ /** Session overrides for every environment (keyed by env name). Empty when no script wrote any. */
108
+ getAllEnvironmentVariableLocals(): Record<string, Record<string, string>>;
109
+ /**
110
+ * Drop all session overrides for one environment (Postman's "Reset All").
111
+ * File values shine through again; persisted override state is removed.
112
+ */
113
+ resetEnvironmentOverrides(envName?: string): Promise<void>;
107
114
  setGlobalVariable(key: string, value: unknown): void;
108
115
  getGlobalVariable(key: string): string | undefined;
109
116
  deleteGlobalVariable(key: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@http-forge/core",
3
- "version": "0.6.37",
3
+ "version": "0.6.39",
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",
@@ -68,7 +68,7 @@
68
68
  "@apidevtools/json-schema-ref-parser": "^11.7.3",
69
69
  "ajv": "^8.12.0",
70
70
  "java-parser": "^3.0.1",
71
- "lodash": "^4.17.21",
71
+ "lodash": "4.18.1",
72
72
  "moment": "^2.30.1",
73
73
  "tv4": "^1.3.0",
74
74
  "typescript": "^5.3.0",
@@ -100,10 +100,15 @@
100
100
  "@types/node": "^20.10.0",
101
101
  "@types/tv4": "^1.2.33",
102
102
  "@types/uuid": "^9.0.7",
103
- "esbuild": "^0.28.1",
103
+ "esbuild": "0.28.2",
104
104
  "rimraf": "^5.0.5",
105
105
  "tsup": "^8.0.1",
106
106
  "typescript": "^5.3.0",
107
107
  "vitest": "^4.1.9"
108
+ },
109
+ "overrides": {
110
+ "esbuild": "0.28.2",
111
+ "lodash": "4.18.1",
112
+ "lodash-es": "4.18.1"
108
113
  }
109
114
  }