@adhd/apigen-engine-runtime 0.2.1 → 0.2.3

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.
@@ -1,6 +1,8 @@
1
- /** The minimal shape this module reads off a composed schema entry. */
1
+ import { JsonSchemaLike } from '@adhd/apigen-base-logical';
2
+
3
+ /** The minimal shape this module reads off a composed (or mount) schema entry. */
2
4
  export interface ToolDescriptionSchema {
3
- input?: {
5
+ input?: JsonSchemaLike & {
4
6
  description?: unknown;
5
7
  };
6
8
  }
@@ -9,9 +11,10 @@ export interface ToolDescriptionSchema {
9
11
  * response.
10
12
  *
11
13
  * @param name - The MCP tool name (used as the final fallback).
12
- * @param schema - The function's composed schema (as produced by
13
- * `composeSchemas`); `input.description` carries the auto-generated
14
- * envelope/data-wrapper documentation.
14
+ * @param schema - The function's composed (or mount) schema; `input` is
15
+ * read both for the envelope/data-wrapper documentation
16
+ * (`input.description`, when present) and for synthesizing a concrete
17
+ * worked example off its actual shape.
15
18
  * @param override - An optional caller-supplied description (e.g. from the
16
19
  * `toolDescriptions` plugin option), prepended when present.
17
20
  */
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@adhd/apigen-engine-runtime",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",
6
6
  "ajv-formats": "2.1.1",
7
7
  "pino": "10.3.1",
8
- "@adhd/apigen-core-client": "^0.2.1",
9
- "@adhd/apigen-base-logical": "^0.1.0",
8
+ "@adhd/apigen-core-client": "^0.3.0",
9
+ "@adhd/apigen-base-logical": "^0.1.1",
10
10
  "@adhd/apigen-base-errors": "^0.2.0",
11
- "@adhd/apigen-engine-naming": "^0.2.1",
11
+ "@adhd/apigen-engine-naming": "^0.2.2",
12
12
  "better-sqlite3": "12.10.0"
13
13
  },
14
14
  "main": "./index.js",
@@ -88,6 +88,43 @@ export interface NegativeControlOptions {
88
88
  * only mutation performed, and it is always undone in a `finally`.
89
89
  */
90
90
  export declare function proveNegativeControl(runner: () => void | Promise<void>, patchPath: string, opts?: NegativeControlOptions): Promise<void>;
91
+ /**
92
+ * Runs `git <args>` scoped to `cwd` via `-C` (never relying on the child's
93
+ * inherited working directory alone), with every `GIT_*` environment
94
+ * variable stripped so an ambient `GIT_DIR`/`GIT_WORK_TREE`/`GIT_INDEX_FILE`
95
+ * (as git sets when invoking hooks — see above) cannot silently redirect the
96
+ * command at a different repository than `cwd`.
97
+ */
98
+ export declare function runGit(args: readonly string[], opts: {
99
+ cwd: string;
100
+ }): string;
101
+ /**
102
+ * Proves `dir` is itself a git repository root — not merely a subdirectory
103
+ * of some OTHER repository (which `git rev-parse --show-toplevel` would
104
+ * silently resolve to instead). Throws loudly on any mismatch, missing
105
+ * repo, or git failure — this is the assertion that turns "we assume the
106
+ * scratch repo is isolated" into "we proved it before touching it".
107
+ */
108
+ export declare function assertIsolatedRepoRoot(dir: string): void;
109
+ /**
110
+ * Creates a throwaway, PROVABLY isolated git repository for tests that need
111
+ * to exercise real `git` mutations (init/config/add/commit) without any
112
+ * possibility of touching the enclosing repository.
113
+ *
114
+ * Isolation is structural, not incidental:
115
+ * - The scratch repo lives under `os.tmpdir()` (never nested inside any
116
+ * tracked working tree), so nothing that walks up looking for an
117
+ * enclosing `.git` can land on the real repo.
118
+ * - `git init` and every subsequent call go through {@link runGit}, which
119
+ * strips `GIT_*` env so ambient hook variables cannot redirect it.
120
+ * - {@link assertIsolatedRepoRoot} is run immediately after `init` and
121
+ * BEFORE this function returns — the caller only ever receives a dir
122
+ * that has already been proven isolated; a failure to isolate throws
123
+ * here rather than silently degrading into "isolated most of the time".
124
+ */
125
+ export declare function createIsolatedScratchRepo(prefix: string): {
126
+ dir: string;
127
+ };
91
128
  /**
92
129
  * Bulletproof teardown for a spawned test server (`flask_server.py`,
93
130
  * `grpc_server.py`, …): sends `SIGTERM`, waits for the process's real `exit`