Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single source of truth for commands help text #644

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

Amnish04
Copy link
Collaborator

@Amnish04 Amnish04 commented Jun 1, 2024

I always felt that the way we manage commands help text documentation could be done better.
Currently, every time we add a new command we have to manually go and add the corresponding documentation to the Help component, which many new developers might not even know about.

In this PR,

  1. I have added a metaData property to ChatCraftCommand class, that takes a helpTitle and helpDescription as a markdown string.
  2. The ChatCraftCommandRegistry now exposes a list of all the supported command objects, that is used to generate the relevant documentation markdown for the commands table (instead of static text)
  3. Making the metaData a mandatory argument in ChatCraftCommand constructor also ensures that if anyone adds a new command in the future, they cannot get away without adding corresponding documentation to it.

I did not file an issue prior to this, as I was just experimenting and it turned out to work well.

@Amnish04 Amnish04 requested a review from humphd June 1, 2024 05:13
@Amnish04 Amnish04 self-assigned this Jun 1, 2024
src/lib/ChatCraftCommand.ts Outdated Show resolved Hide resolved
src/lib/ChatCraftCommandRegistry.ts Outdated Show resolved Hide resolved
Copy link

cloudflare-workers-and-pages bot commented Jun 1, 2024

Deploying chatcraft-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1279273
Status: ✅  Deploy successful!
Preview URL: https://cd4b175a.console-overthinker-dev.pages.dev
Branch Preview URL: https://amnish04-commands-metadata.console-overthinker-dev.pages.dev

View logs

@Amnish04
Copy link
Collaborator Author

Amnish04 commented Jun 1, 2024

@humphd Not sure why, I've started getting a lint error in a file I did not even change.

https://github.com/tarasglek/chatcraft.org/actions/runs/9333938306/job/25691497752?pr=644

Update: I think its related to @tarasglek's latest commit, and #646 should fix it.

@tarasglek
Copy link
Owner

@humphd Not sure why, I've started getting a lint error in a file I did not even change.

https://github.com/tarasglek/chatcraft.org/actions/runs/9333938306/job/25691497752?pr=644

Update: I think its related to @tarasglek's latest commit, and #646 should fix it.

sorry, was distracted and forgot to check on first landing and then forgot to land the fixup

@Amnish04 Amnish04 force-pushed the amnish04/commands-metadata branch from 2740767 to 1279273 Compare June 3, 2024 21:39
@Amnish04 Amnish04 merged commit f617bcd into main Jun 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants