Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@kody/blandPublic

src/adapt.ts

75 lines · 1.9 KB · TypeScript
/**
 * After a community fork, call this first.
 * Returns owner-specific secret setup and publish steps for your Bland copy.
 *
 * @returns Adapt playbook (secrets, settings, smoke, publish)
 *
 * @example
 * import adapt from 'kody:@you/bland/adapt'
 * await adapt()
 */
import {
	API_HOST,
	DASHBOARD_SETTINGS_URL,
	DEFAULT_API_KEY_SECRET,
	SETTINGS_DEFAULT_VOICE,
	apiKeySetupUrl,
} from './core.ts'
import { readBlandSettings } from './settings.ts'

export default async function adapt() {
	const settings = await readBlandSettings()
	return {
		purpose:
			'Point this forked Bland package at your own API key, set a default voice if you want, then publish your copy.',
		ownerSettings: {
			defaultVoice: {
				storageName: SETTINGS_DEFAULT_VOICE,
				resolved: settings.defaultVoice,
				source: settings.defaultVoice ? 'package-storage' : 'unset',
				needsSwap: false,
			},
			apiKey: {
				secretName: DEFAULT_API_KEY_SECRET,
				setupUrl: apiKeySetupUrl(),
				approveHost: API_HOST,
			},
		},
		steps: [
			{
				id: 'intent',
				title: 'Rewrite README ## Intent',
				detail: 'Describe how this fork will place Bland calls for the forking user.',
			},
			{
				id: 'secret',
				title: 'Save Bland API key',
				detail:
					'Send the owner this URL (never paste the value in chat): ' +
					apiKeySetupUrl() +
					'. Approve host ' +
					API_HOST +
					'. Dashboard: ' +
					DASHBOARD_SETTINGS_URL,
			},
			{
				id: 'settings',
				title: 'Optional default voice',
				detail:
					'import settings from "kody:@you/bland/settings"; await settings({ defaultVoice: "maya" })',
			},
			{
				id: 'smoke',
				title: 'Run smoke-test then me()',
				detail:
					'import smokeTest from "kody:@you/bland/smoke-test"; await smokeTest({ live: true })',
			},
			{
				id: 'publish',
				title: 'Publish your fork',
				detail: 'Publish after README Intent matches this copy.',
			},
		],
		share: 'https://kody.codes/@kody/bland',
	}
}