(input: {
attachments?: LocalInputFile[] | undefined;
referenceUrl?: string | undefined;
designSystem?: StoredDesignSystem | null | undefined;
resolveReferenceHost?: ReferenceHostResolver | undefined;
fetchReference?: ReferenceFetcher | undefined;
workspaceRoot?: string | undefined;
})
| 857 | } |
| 858 | |
| 859 | export async function preparePromptContext(input: { |
| 860 | attachments?: LocalInputFile[] | undefined; |
| 861 | referenceUrl?: string | undefined; |
| 862 | designSystem?: StoredDesignSystem | null | undefined; |
| 863 | resolveReferenceHost?: ReferenceHostResolver | undefined; |
| 864 | fetchReference?: ReferenceFetcher | undefined; |
| 865 | workspaceRoot?: string | undefined; |
| 866 | }): Promise<PreparedPromptContext> { |
| 867 | const attachments = await Promise.all( |
| 868 | (input.attachments ?? []).map((file) => readAttachment(file, input.workspaceRoot)), |
| 869 | ); |
| 870 | const referenceUrl = |
| 871 | typeof input.referenceUrl === 'string' && input.referenceUrl.trim().length > 0 |
| 872 | ? await inspectReferenceUrl( |
| 873 | input.referenceUrl.trim(), |
| 874 | input.resolveReferenceHost ?? defaultResolveReferenceHost, |
| 875 | input.fetchReference ?? defaultFetchReference, |
| 876 | ) |
| 877 | : null; |
| 878 | const projectContext = await readProjectContext(input.workspaceRoot); |
| 879 | |
| 880 | return { |
| 881 | designSystem: input.designSystem ?? null, |
| 882 | attachments, |
| 883 | referenceUrl, |
| 884 | projectContext, |
| 885 | }; |
| 886 | } |
no test coverage detected