@http-forge/core 0.6.37 → 0.6.38
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/dist/index.d.ts +2 -0
- package/dist/index.js +188 -155
- package/dist/index.mjs +193 -160
- package/dist/infrastructure/collection/agents-md.d.ts +60 -0
- package/dist/infrastructure/collection/folder-collection-store.d.ts +5 -3
- package/dist/infrastructure/environment/environment-config-service.d.ts +1 -0
- package/dist/types/environment-config.d.ts +7 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -53,9 +53,11 @@ export declare class FolderCollectionStore implements ICollectionStore {
|
|
|
53
53
|
private ensureDirectory;
|
|
54
54
|
/**
|
|
55
55
|
* Write .http-forge/AGENTS.md the first time a workspace is initialised.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
56
|
+
* Template ownership lives in `./agents-md` (versioned via
|
|
57
|
+
* `AGENTS_MD_VERSION`). This stays write-once so user customizations are
|
|
58
|
+
* never overwritten; stale guides are refreshed explicitly through
|
|
59
|
+
* `refreshAgentsMd()` (extension command / CLI), which backs up the
|
|
60
|
+
* previous file to `AGENTS.md.bak` first.
|
|
59
61
|
*
|
|
60
62
|
* collectionsDir = {forgeRoot}/collections → forgeRoot = parent dir
|
|
61
63
|
* forgeRoot lives inside .http-forge/assets/ in the extension, so we walk
|
|
@@ -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;
|
|
@@ -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.
|
|
3
|
+
"version": "0.6.38",
|
|
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",
|