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

Auto generate CLI docs for documentation repo #685

Merged
merged 18 commits into from
Oct 8, 2024

Conversation

yuandrew
Copy link
Contributor

@yuandrew yuandrew commented Oct 2, 2024

What was changed

Auto generate all of the *.mdx files present in the current documentation repo. index.mdx is not auto-generated

IMPORTANT: The generated files are not yet being consumed anywhere. A future PR will auto-publish a PR into the docs repo whenever there is a docs related change.

Added a field in the YML to indicate doc-specific information, like SEO related keywords and descriptions.

Removed cmd-options.cdx and print each command option description inline in each file instead.
temporalio/documentation#3122 removes all references to this file from the documentation side.

Why?

This is in a larger effort to have the CLI be the source of truth for docs, and have the documentation auto-ingest any CLI changes, keeping all information in sync.

This is the first step to this goal, there are a number of follow up tasks that I wanted to split up from this PR:

  1. Diff the current information on the docs with the CLI, and unify into a single master-description for each command.
  2. Auto-publish PR to docs repo whenever there is a CLI doc change
  3. Auto update sidebars.js and vercel.js whenever a new temporal command is added.
  4. Clean up the SEO keywords/tags - being handled by the documentation team
  5. Support markdown in the CLI help output in terminal [Feature Request] Support Markdown in CLI help output in terminal #687

Checklist

  1. Any docs updates needed?

For now, docs will not be updated. There will be a future PR that auto-creates a PR into the documentation repo with any updates.

yuandrew and others added 8 commits September 24, 2024 14:43
<!--- Note to EXTERNAL Contributors -->
<!-- Thanks for opening a PR!
If it is a significant code change, please **make sure there is an open
issue** for this.
We work best with you when we have accepted the idea first before you
code. -->

<!--- For ALL Contributors 👇 -->

<!-- Describe what has changed in this PR -->
Created a new `string-enum[]` type

<!-- Tell your future self why have you made these changes -->
Command option behavior already exists, there just wasn't a specific
type for this yet.

<!--- add/delete as needed --->

1. Closes temporalio#670

2. How was this tested:
<!--- Please describe how you tested your changes/how we can test them
-->

3. Any docs updates needed?
<!--- update README if applicable
      or point out where to update docs.temporal.io -->

---------

Co-authored-by: David Reiss <[email protected]>
temporalcli/commandsgen/parse.go Outdated Show resolved Hide resolved
temporalcli/commandsgen/commands.yml Outdated Show resolved Hide resolved
temporalcli/commandsgen/parse.go Outdated Show resolved Hide resolved
temporalcli/commandsgen/docs.go Outdated Show resolved Hide resolved
temporalcli/internal/cmd/gen-docs/main.go Outdated Show resolved Hide resolved
temporalcli/internal/cmd/gen-docs/main.go Show resolved Hide resolved
@yuandrew yuandrew requested a review from cretz October 4, 2024 17:35

go run ./temporalcli/internal/cmd/gen-docs

This will auto-generate a new set of docs to `temporalcli/docs/`. If a new root command is added, a new file will be automatically generated, like `temporal activity` and `activity.mdx`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also accept the dir to write to as a CLI arg to this tool, but up to you

@yuandrew yuandrew merged commit bd76c2f into temporalio:main Oct 8, 2024
7 checks passed
@yuandrew yuandrew deleted the auto-generate-docs branch October 8, 2024 15:44
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