mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-04 21:17:30 +00:00
* feat(cli): feedback says whether a person or an agent wrote it, with the email an app attaches * refactor(cli): split the .env loader so each part stays simple * fix(cli): a broken .env loader fails loudly; only a missing .env is ignored
18 lines
753 B
TypeScript
18 lines
753 B
TypeScript
export type FeedbackSource = "person" | "agent";
|
|
|
|
const SOURCES: readonly string[] = ["person", "agent"];
|
|
|
|
/** The `--source` value, undefined when absent, null when it is neither. */
|
|
export function parseFeedbackSource(raw: string | undefined): FeedbackSource | null | undefined {
|
|
if (raw === undefined) return undefined;
|
|
const source = raw.trim();
|
|
return SOURCES.includes(source) ? (source as FeedbackSource) : null;
|
|
}
|
|
|
|
export const FEEDBACK_EMAIL_ENV = "HYPERFRAMES_FEEDBACK_EMAIL";
|
|
|
|
/** Set only by the launching app (never a flag or a project `.env`); unverified, so never proof of identity. */
|
|
export function feedbackEmail(env: NodeJS.ProcessEnv = process.env): string | undefined {
|
|
return env[FEEDBACK_EMAIL_ENV]?.trim() || undefined;
|
|
}
|