/** * @fileoverview Auto-discovery of @opensip-tools/graph-* adapter * packages installed in node_modules. * * Resolution rules (apply in order): * * 1. If `plugins.graphAdapters` is declared in the project config, * that explicit list wins. Auto-discovery is skipped entirely. * Lets users pin their adapter set deterministically. * * 2. Else if `plugins.autoDiscoverGraphAdapters: false` is declared, * no adapter packages are loaded via discovery. Lets users opt * out of dependency-based discovery (e.g. when running in an * environment with unrelated @opensip-tools packages installed). * * 3. Otherwise (default), discover every package that declares * `opensipTools.kind: "graph-adapter"` via the ONE shared marker * substrate (`discoverPackagesByMarker`, core). The marker is the * authoritative gate: shared scaffolding libraries under the same * prefix (e.g. `@opensip-tools/graph-adapter-common`, which carries * no marker) are NOT adapters and never surface. Return the list. * * Rule 3 used to carry a bespoke ancestor-walk that re-implemented the * marker substrate's node_modules traversal plus a redundant * `@opensip-tools/graph-*` prefix anchor. The walk is now delegated to * `discoverPackagesByMarker({ kind: 'graph-adapter' })`; this file keeps * only the graph-domain POLICY (the three-rule resolution + the explicit * `plugins.graphAdapters` / `autoDiscoverGraphAdapters` config reads). */ export interface GraphAdapterDiscoveryOptions { /** Absolute path to the project root (where opensip-tools.config.yml lives). */ readonly projectDir: string; /** Explicit list from `plugins.graphAdapters` in the config. */ readonly explicitPackages?: readonly string[]; /** When false, auto-discovery is disabled. Default: true. */ readonly autoDiscover?: boolean; } export interface DiscoveredGraphAdapterPackage { /** npm package name, e.g. '@opensip-tools/graph-typescript'. */ readonly name: string; /** Absolute path to the package's directory inside node_modules. */ readonly packageDir: string; } /** * Resolve the list of graph-adapter packages to load, applying the * ordered resolution rules in the file header. Returns every * discovered @opensip-tools/graph-* package; the CLI loads them all * uniformly, with no package privileged over another. */ export declare function discoverGraphAdapterPackages(options: GraphAdapterDiscoveryOptions): DiscoveredGraphAdapterPackage[]; /** * Read `name` and `main`/`exports` from a package.json. Used by the CLI * to resolve the entry point of a discovered graph adapter package. */ export interface GraphAdapterPackageMetadata { readonly name: string; readonly mainEntry: string; } /** * Read the `plugins.graphAdapters` and `plugins.autoDiscoverGraphAdapters` * fields from the project's opensip-tools.config.yml without doing a * full schema parse. Returns the raw values so callers can apply the * resolution rules in `discoverGraphAdapterPackages()`. * * Mirrors the inline-yaml-read pattern used by fitness's * `readCheckPackagePreferences()` — avoids a circular dep between * plugins/ and any heavier config-parsing module. */ export declare function readGraphAdapterPackagePreferences(projectDir: string): { readonly graphAdapters?: readonly string[]; readonly autoDiscoverGraphAdapters?: boolean; }; export declare function readGraphAdapterPackageMetadata(packageDir: string): GraphAdapterPackageMetadata | undefined; //# sourceMappingURL=graph-adapter-discovery.d.ts.map