/** What the fleet says about one exclusive group. */ export interface GroupAnalysis { /** Member id to propose, or `null` when the fleet says nothing useful. */ propose: string | null; /** Services using each member, by member id. */ counts: Record; /** * `scan` when the directories were read, `cache` when a previous scan * answered, `override` when the user's own contradicting choice did. */ source: 'scan' | 'cache' | 'override'; } /** What a fleet scan found. */ export interface FleetAnalysis { /** Services found in the fleet. */ services: number; /** One entry per probed group, keyed by catalog group id. */ groups: Record; } /** * Path of the analysis cache. Under VAR_HOME, so IMQ_CLI_HOME relocates it * along with everything else the CLI writes — which is what lets tests use a * sandbox rather than the developer's real cache. * * @return {string} */ export declare function fleetCachePath(): string; /** * Works out what a fleet is built on, for every group the prompt can propose in. * * @remarks * Answers from the cache when it can. The cache is keyed by path and carries the * subdirectory names it was built from, so a fleet that has gained or lost a * directory is rescanned — one `readdir` to know, rather than a package.json per * service. A user's own contradicting choice, recorded by * {@link recordFleetChoices}, outranks both: they said it deliberately, and it * survives later rescans until a scan agrees with it. * * @param {string} root - directory holding the service directories * @return {FleetAnalysis} */ export declare function analyseFleet(root: string): FleetAnalysis; /** * The CATALOG ids to preselect. * * @remarks * Catalog groups only. A provider id like `github` would be rejected by * `validateSelection` as an unknown package, and rightly — it is not one. * * @param {FleetAnalysis} analysis * @return {string[]} */ export declare function fleetDefaults(analysis: FleetAnalysis): string[]; /** * What to mark as recommended for one group. * * @remarks * The fleet first: a fleet already running on something IS the recommendation, * because a new service joining it should match it. Only when the fleet says * nothing does the project's own preference apply — pg-prisma, opentelemetry, * github, github-actions. * * This is a LABEL, not the pre-selection. For the optional groups the cursor * still opens on `(none)` when the fleet is silent: a service that needs no * database is not a service that chose wrongly. * * @param {FleetAnalysis | null} analysis * @param {string} group * @return {string | null} */ export declare function recommendedFor(analysis: FleetAnalysis | null, group: string): string | null; /** * What the fleet proposes for one group, or `null` when it says nothing. * * @remarks * For the choices with their own prompt — the VCS host and the CI provider — * where the caller supplies its own default to fall back on. * * @param {FleetAnalysis | null} analysis * @param {string} group * @return {string | null} */ export declare function fleetProposal(analysis: FleetAnalysis | null, group: string): string | null; /** * One line per group explaining what was proposed and why, for the prompt. * * @remarks * Keyed by catalog group id, and a group the fleet says nothing about gets no * entry — silence is the right output when there is nothing to report. * * @param {FleetAnalysis} analysis * @return {Record} */ export declare function fleetNotes(analysis: FleetAnalysis): Record; /** * The note for one group, ready to append to a prompt message, or `''`. * * @param {FleetAnalysis | null} analysis * @param {string} group * @return {string} */ export declare function fleetNote(analysis: FleetAnalysis | null, group: string): string; /** * Records selections that contradict the scan, so the next run proposes what the * user actually wants. * * @remarks * Only a contradiction is written. Agreeing with the scan is not an instruction, * and storing it would make an override out of a shrug. Selecting nothing from a * group is not a contradiction either: it says the service does not need that * capability, not that the fleet is built differently. * * @param {string} root - directory holding the service directories * @param {string[]} selection - the resolved catalog ids */ export declare function recordFleetChoices(root: string, selection: string[]): void;