You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
readme is missing documentation for the new commands #123
Hi @Souvikns 👋, automating this would be really interesting so that when we add new commands, the docs on the README are automatically updated. I had a look on the package.json and there is already a script for the readme, are we already using it on GitHub actions?
I'd like to help with this issue if no one is working on it 🙂. I messed around with oclif readme command to see the output, and I just want to clarify if the generated docs are correct:
USAGE
$ asyncapi config context add CONTEXT-NAME SPEC-FILE-PATH
ARGUMENTS
CONTEXT-NAME context name
SPEC-FILE-PATH file path of the spec file
OPTIONS
-h, --help show CLI help
USAGE
$ asyncapi new
OPTIONS
-e, --example=example name of the example to use
-h, --help show CLI help
-n, --file-name=file-name name of the file
-p, --port=port port in which to start Studio
-s, --studio open in Studio
--no-tty do not use an interactive terminal
USAGE
$ asyncapi start studio
OPTIONS
-f, --file=file path to the AsyncAPI file to link with Studio
-h, --help show CLI help
-p, --port=port port in which to start Studio
Unfortunately, I wasn't able to test the current CLI commands by installing the asyncapi/cli package, I believe this error: [MODULE_NOT_FOUND] Error Plugin: @asyncapi/cli: Cannot find module '@oclif/plugin-help/lib/command' Require stack: is related to #192 😢
Feel free to give me any feedback on my assumption, I appreciate it 👍.
Awesome @BOLT04 the generated docs are correct 👍🏻. No one is working on this issue as of now so you can take it up.
Yeah the CLI is kinda breaking in production but it works fine in the development and you can just clone the repo and run /bin/run in the project to run the CLI. Currently working on #203 to fix the issue. I think you have to wait for this as we are updating oclif version and the oclif readme command might work differently from right now.
ok, then for this issue we'll wait on #203 👍 . Then setup the topicSeparator on the package.json and build a new workflow to automatically run this script when there is a push to master. The next step would be to open a PR with those changes to be merged.
Is there a better way to run this script what does everyone think?
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
@BOLT04, cli documentation was a part of GSoD, but don't know what is the status. asyncapi/website#602, #232 were planned for this. I don't know if anyone is working on CLI documentation right now. Give me some time, I will check on the status and update you.
@mhmohona I'm pretty sure it is because of some delay on oclif readme command, and the JS code just needs to wait.
can you open a followup PR with fix like below:
/* eslint-disable @typescript-eslint/no-var-requires */const{writeFile, readFile}=require('fs').promises;// Define the paths to the README and usage filesconstREADME_PATH='./scripts/README.md';// File path for the generated README fileconstUSAGE_PATH='./docs/usage.md';// File path for the usage documentation fileconstheader=`---title: 'Usage'weight: 40---<!-- This file is automatically generated from updateUsageDocs.js script. In package.json in line 158-161 lines the following steps has been executed in order to run this script successfully - * generate:readme:create: It creates the initial content for the README file by printing the usage and commands tags using printf and redirects the output to scripts/README.md file.* generate:readme:commands: It changes the directory to the scripts folder and executes the oclif readme command. This command generates the usage and commands sections based on the CLI commands and updates the content in the scripts/README.md file.* generate:assets: This script combines the two previously mentioned scripts (generate:readme:toc and generate:commands) to generate the necessary assets, such as the README file and usage documentation.* generate:commands: This script executes the following steps: - Runs the generate:readme:create script to create the initial content for the README file. - Executes the generate:readme:commands script to generate the usage and commands sections based on the CLI commands. - Runs the updateUsageDocs.js script using Node.js to update the usage documentation file with the contents of the generated README file. - Deletes the scripts/README.md file using the rimraf command.-->The AsyncAPI CLI makes it easier to work with AsyncAPI documents.`;// Define an async function to write the header and the README contents to the usage documentation fileasyncfunctionrun(){try{awaitwriteFile(USAGE_PATH,header);constreadmeContents=awaitreadContents();// Append the contents of the README file to the usage documentation fileawaitwriteFile(USAGE_PATH,readmeContents,{flag: 'a'});}catch(e){console.error(e);}}run();asyncfunctionreadContents(){letreadmeContents;letcommandsContent='';while(commandsContent.length===0){readmeContents=awaitreadFile(README_PATH,'utf8');// Check if the content between <!-- commands --> and <!-- commandsstop --> is emptyconstcommandsStartText='<!-- commands -->';constcommandStartIndex=readmeContents.indexOf(commandsStartText);constcommandStopIndex=readmeContents.indexOf('<!-- commandsstop -->');//cutting the content between the above mentioned tags, removing white spaces and checking if there is some text as it will mean text was added by oclifcommandsContent=readmeContents.slice(commandStartIndex+commandsStartText.length,commandStopIndex).trim();if(commandsContent.length===0){console.log('No content between <!-- commands --> and <!-- commandsstop -->. Trying again...');}else{console.log('Content found!');}awaitdelay(3000);// 3-second delay}returnreadmeContents;}functiondelay(ms){returnnewPromise(resolve=>setTimeout(resolve,ms));}
we could add a step in CI that checks run: ls /home/runner/work/cli/cli/lib/commands as maybe it is empty but I'm not sure, I'm kinda sure /home/runner/work/cli/cli is correct.
Activity
fmvilas commentedon Nov 3, 2021
Yeah, just watch out that it might generate documentation of commands separated by colons (
:) instead of spaces.BOLT04 commentedon Jan 30, 2022
Hi @Souvikns 👋, automating this would be really interesting so that when we add new commands, the docs on the
READMEare automatically updated. I had a look on thepackage.jsonand there is already a script for the readme, are we already using it on GitHub actions?I'd like to help with this issue if no one is working on it 🙂. I messed around with
oclif readmecommand to see the output, and I just want to clarify if the generated docs are correct:Usage
Commands
asyncapi configasyncapi config:contextasyncapi config:context:add CONTEXT-NAME SPEC-FILE-PATHasyncapi config:context:currentasyncapi config:context:listasyncapi config:context:remove CONTEXT-NAMEasyncapi config:context:use CONTEXT-NAMEasyncapi newasyncapi startasyncapi start:studioasyncapi validate [SPEC-FILE]asyncapi configaccess configs
See code: src/commands/config.ts
asyncapi config:contextSee code: src/commands/config/context.ts
asyncapi config:context:add CONTEXT-NAME SPEC-FILE-PATHAdd or modify a context in the store
See code: src/commands/config/context/add.ts
asyncapi config:context:currentShows the current context that is being used
See code: src/commands/config/context/current.ts
asyncapi config:context:listList all the stored context in the store
See code: src/commands/config/context/list.ts
asyncapi config:context:remove CONTEXT-NAMEDelete a context from the store
See code: src/commands/config/context/remove.ts
asyncapi config:context:use CONTEXT-NAMESet a context as current
See code: src/commands/config/context/use.ts
asyncapi newcreates a new asyncapi file
See code: src/commands/new.ts
asyncapi startstarts a new local instance of Studio
See code: src/commands/start.ts
asyncapi start:studiostarts a new local instance of Studio
See code: src/commands/start/studio.ts
asyncapi validate [SPEC-FILE]validate asyncapi file
See code: src/commands/validate.ts
Unfortunately, I wasn't able to test the current CLI commands by installing the
asyncapi/clipackage, I believe this error:[MODULE_NOT_FOUND] Error Plugin: @asyncapi/cli: Cannot find module '@oclif/plugin-help/lib/command' Require stack:is related to #192 😢Feel free to give me any feedback on my assumption, I appreciate it 👍.
Souvikns commentedon Jan 31, 2022
Awesome @BOLT04 the generated docs are correct 👍🏻. No one is working on this issue as of now so you can take it up.
Yeah the CLI is kinda breaking in production but it works fine in the development and you can just clone the repo and run
/bin/runin the project to run the CLI. Currently working on #203 to fix the issue. I think you have to wait for this as we are updating oclif version and theoclif readmecommand might work differently from right now.derberg commentedon Jan 31, 2022
the only problem with the generated stuff is
:that should be spaces. Soasyncapi config:contextis actuallyasyncapi config contextSouvikns commentedon Jan 31, 2022
The new version has some inbuilt support for topic separators maybe this would help.
BOLT04 commentedon Jan 31, 2022
ok, then for this issue we'll wait on #203 👍 . Then setup the
topicSeparatoron the package.json and build a new workflow to automatically run this script when there is apushtomaster. The next step would be to open a PR with those changes to be merged.Is there a better way to run this script what does everyone think?
github-actions commentedon Jun 1, 2022
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience ❤️
BOLT04 commentedon Jun 1, 2022
hi @Souvikns, since #203 is done could we resume this issue, wdyt 🙂 ?
Souvikns commentedon Jun 2, 2022
@BOLT04, cli documentation was a part of GSoD, but don't know what is the status. asyncapi/website#602, #232 were planned for this. I don't know if anyone is working on CLI documentation right now. Give me some time, I will check on the status and update you.
imabp commentedon Jun 2, 2022
@Souvikns we can continue on the CLI command reference using this tool
And I will be writing the getting started document
18 remaining items
mhmohona commentedon May 16, 2023
Hello @thulieblack, I am alsmot done with the task.
derberg commentedon May 29, 2023
@mhmohona hey, so it looks like automation worked, scripts got triggered and we got #601 but as you can see, commands section is empty 🤔
derberg commentedon May 29, 2023
@mhmohona I'm pretty sure it is because of some delay on
oclif readmecommand, and the JS code just needs to wait.can you open a followup PR with fix like below:
mhmohona commentedon May 29, 2023
Thank you so much for pointing this @derberg! I have updated the code and created new PR.
I thought of adding it but then thought it might be unnecessary but it seems it is needed. :3
derberg commentedon May 29, 2023
ok, so 😄 it didn't work
workflow was running for over 3min and below was just logged out
I don't think it is normal so I cancelled the run. Not sure yet what is the solution
derberg commentedon May 29, 2023
I can't figure from their code what might be wrong, but we can log more things in the GitHub Action
so please open another PR with change in the
package.jsonwhere you runoclif readmeso it isDEBUG=* oclif readmeso basically make sure it says
"generate:readme:commands": "cd scripts && DEBUG=* oclif readme",this will give us a lot of insights and info where it stucks with commands generation
asyncapi-bot commentedon May 30, 2023
🎉 This issue has been resolved in version 0.45.1 🎉
The release is available on:
Your semantic-release bot 📦🚀
derberg commentedon May 30, 2023
@mhmohona is still doesn't work, logs show
while on local I get
so looks like oclif cannot figure what commands are available, but I do not know why
derberg commentedon May 30, 2023
we could add a step in CI that checks
run: ls /home/runner/work/cli/cli/lib/commandsas maybe it is empty but I'm not sure, I'm kinda sure/home/runner/work/cli/cliis correct.derberg commentedon May 31, 2023
@mhmohona congrats, topic completed. Look what we got on the website thanks to your work ❤️ -> https://www.asyncapi.com/docs/tools/cli/usage
@thulieblack another bounty issue completed, over to you
cc @Souvikns fyi usage docs are not automatically updated 💪🏼
thulieblack commentedon May 31, 2023
Hey, @mhmohona, congratulations on completing your issue!!
This is how'll claim your bounty: