@promptbook/utils
Version:
Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action
39 lines (38 loc) • 1.73 kB
TypeScript
import type { InitializationStatus } from './boilerplateTemplates';
/**
* Parameters controlling one string-record merge into a JSON file.
*/
type MergeStringRecordJsonFileOptions = {
readonly projectPath: string;
readonly relativeFilePath: string;
readonly fieldPath: string;
readonly nextEntries: Readonly<Record<string, string>>;
readonly ensureParentDirectoryPath?: string;
/** Optional narrowly scoped migration of existing entries before missing defaults are added. */
readonly transformExistingEntries?: (entries: Readonly<Record<string, string>>) => Readonly<Record<string, string>> | Promise<Readonly<Record<string, string>>>;
};
/**
* Result of one additive string-record merge into a JSON file.
*
* @private internal utility of `coder init` command
*/
export type MergedStringRecordJsonFile = {
/**
* Status describing whether the JSON file had to be created or updated.
*/
readonly status: InitializationStatus;
/**
* Keys which were missing in the JSON file and therefore added by the merge.
*/
readonly addedEntryKeys: ReadonlyArray<string>;
};
/**
* Ensures one JSON object field contains the provided string-record entries.
*
* Entries are additive unless a caller explicitly supplies a scoped migration callback.
* Hand-tuned scripts and settings survive repeated `ptbk coder init`; migrations recognize generated entries only.
*
* @private function of `initializeCoderProjectConfiguration`
*/
export declare function mergeStringRecordJsonFile({ projectPath, relativeFilePath, fieldPath, nextEntries, ensureParentDirectoryPath, transformExistingEntries, }: MergeStringRecordJsonFileOptions): Promise<MergedStringRecordJsonFile>;
export {};