Files
hyperframes/packages/cli/src/utils/feedbackSource.ts
T
Miguel Ángel 0ca69472d9 feat(cli): feedback says whether a person or an agent wrote it, with the email an app attaches (#4984)
* 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
2026-10-04 05:07:49 +00:00

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;
}