Skip to content

The only tool you need to know what is happening and how to fix it.

1.3 KB
Raw Blame
export const SKILL_INSTALL_COMMAND = 'npx skills add tracewayapp/traceway --all';

export type PromptPart = {
	text: string;
	bold: boolean;
};

export function getSetupPromptParts(
	backendUrl: string,
	token: string,
	sourceMapToken: string | null = null
): PromptPart[] {
	const parts: PromptPart[] = [
		{ text: '/traceway-setup with token ', bold: false },
		{ text: token, bold: true },
		{ text: ' and url ', bold: false },
		{ text: backendUrl, bold: true }
	];
	if (sourceMapToken) {
		parts.push(
			{ text: ' and source map upload token ', bold: false },
			{ text: sourceMapToken, bold: true }
		);
	}
	return parts;
}

export function getSetupPrompt(
	backendUrl: string,
	token: string,
	sourceMapToken: string | null = null
): string {
	return getSetupPromptParts(backendUrl, token, sourceMapToken)
		.map((p) => p.text)
		.join('');
}

export function getSetupTokenPromptParts(backendUrl: string, setupToken: string): PromptPart[] {
	return [
		{ text: '/traceway-setup with setup token ', bold: false },
		{ text: setupToken, bold: true },
		{ text: ' and url ', bold: false },
		{ text: backendUrl, bold: true }
	];
}

export function getSetupTokenPrompt(backendUrl: string, setupToken: string): string {
	return getSetupTokenPromptParts(backendUrl, setupToken)
		.map((p) => p.text)
		.join('');
}