mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-22 08:38:08 +02:00
* feat(cli): show Slack CTA on help and unexpected errors * feat(cli): show Slack CTA after crashes * feat(setup): show Slack community note after setup * chore: refresh Python lockfile versions
28 lines
831 B
TypeScript
28 lines
831 B
TypeScript
import type { KtxCliIo } from './cli-runtime.js';
|
|
import { isWritableTtyOutput } from './io/tty.js';
|
|
import { dim } from './io/symbols.js';
|
|
import { SLACK_URL } from './links.js';
|
|
|
|
type ErrorCtaVariant = 'error' | 'crash';
|
|
|
|
/** @internal */
|
|
export const SLACK_HELP_FOOTER = `Community & support: ${SLACK_URL}`;
|
|
|
|
/** @internal */
|
|
export const SLACK_SETUP_NOTE = {
|
|
title: 'Community',
|
|
body: `Questions or feedback? Join the ktx Slack: ${SLACK_URL}`,
|
|
} as const;
|
|
|
|
export function writeErrorCommunityHint(io: KtxCliIo, variant: ErrorCtaVariant): void {
|
|
if (!isWritableTtyOutput(io.stderr)) {
|
|
return;
|
|
}
|
|
|
|
const line =
|
|
variant === 'crash'
|
|
? `This may be a bug - report it or ask in the ktx community: ${SLACK_URL}`
|
|
: `Stuck? The ktx community can help: ${SLACK_URL}`;
|
|
|
|
io.stderr.write(`${dim(line)}\n`);
|
|
}
|