refactor(catalog): import CLI metadata from its owner
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export function createCliInventory(cli: unknown): {
|
||||
readonly primary: readonly string[];
|
||||
readonly aliases: readonly {
|
||||
readonly name: string;
|
||||
readonly target: string;
|
||||
}[];
|
||||
};
|
||||
export function cliCommandOptionNames(
|
||||
cli: unknown,
|
||||
name: string,
|
||||
): readonly string[];
|
||||
export function cliCommandDescriptionIssues(cli: unknown): readonly string[];
|
||||
@@ -26,10 +26,6 @@ export interface ProductCatalog {
|
||||
readonly format: string;
|
||||
readonly configuration: string;
|
||||
}[];
|
||||
readonly schemas: readonly {
|
||||
readonly id: string;
|
||||
readonly version: string | number;
|
||||
}[];
|
||||
readonly cli: {
|
||||
readonly primary_count: number;
|
||||
readonly commands: readonly string[];
|
||||
@@ -45,21 +41,6 @@ export interface ProductCatalog {
|
||||
}
|
||||
|
||||
export function createProductCatalog(root: string): Promise<ProductCatalog>;
|
||||
export function providerCatalogDigest(
|
||||
providers: ProductCatalog["providers"],
|
||||
): string;
|
||||
export function createCliInventory(cli: unknown): {
|
||||
readonly primary: readonly string[];
|
||||
readonly aliases: readonly {
|
||||
readonly name: string;
|
||||
readonly target: string;
|
||||
}[];
|
||||
};
|
||||
export function cliCommandOptionNames(
|
||||
cli: unknown,
|
||||
name: string,
|
||||
): readonly string[];
|
||||
export function cliCommandDescriptionIssues(cli: unknown): readonly string[];
|
||||
export function serializeProductCatalog(
|
||||
catalog: ProductCatalog,
|
||||
): Promise<string>;
|
||||
|
||||
@@ -1,22 +1,9 @@
|
||||
import { formatGeneratedFile } from "./format-generated-file.mjs";
|
||||
|
||||
import { assertSameNames, digest, loadSources } from "./catalog-core.mjs";
|
||||
import {
|
||||
createCliInventory,
|
||||
cliCommandDescriptionIssues,
|
||||
cliCommandOptionNames,
|
||||
} from "./catalog-cli.mjs";
|
||||
import { createCliInventory } from "./catalog-cli.mjs";
|
||||
import { providerCatalog, toolFamilyCatalog } from "./catalog-builders.mjs";
|
||||
|
||||
export {
|
||||
createCliInventory,
|
||||
cliCommandDescriptionIssues,
|
||||
cliCommandOptionNames,
|
||||
};
|
||||
|
||||
/** Return the stable digest for the source-derived provider projection. */
|
||||
export const providerCatalogDigest = (providers) => digest(providers);
|
||||
|
||||
/** Project current runtime contracts into deterministic, machine-readable facts. */
|
||||
export const createProductCatalog = async (root) => {
|
||||
const sources = await loadSources(root);
|
||||
@@ -59,7 +46,7 @@ export const createProductCatalog = async (root) => {
|
||||
counts: sources.catalogIdentity.CATALOG_IDENTITY.counts,
|
||||
digests: {
|
||||
// Full runtime schema digests belong to server identity, not this facts projection.
|
||||
providers_sha256: providerCatalogDigest(providers),
|
||||
providers_sha256: digest(providers),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user