mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-07 11:02:11 +02:00
feat(cli): add Slack community CTA on errors, crashes, setup, and help (#277)
* 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
This commit is contained in:
parent
6b2f7c3365
commit
66517fc320
14 changed files with 350 additions and 29 deletions
28
packages/cli/src/community-cta.ts
Normal file
28
packages/cli/src/community-cta.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
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`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue