Skip to content

feat: refactor CLI to be service based and initial migration of server-api - #1825

Merged
asyncapi-bot merged 21 commits into
asyncapi:masterfrom
Shurtu-gal:refactor
Aug 19, 2025
Merged

asyncapi-bot merged 21 commits into
asyncapi:masterfrom
Shurtu-gal:refactor

Conversation

@Shurtu-gal

Copy link
Copy Markdown
Collaborator

Description

  • Refactored CLI to be service based. Especially validation and generate due to shared tasks between API and itself.
  • Added a start api command which is working perfectly fine, hence can still be used till I make another PR regarding its release process etc.

Related issue(s)
Fixes #1793
Partial #1794

@changeset-bot

changeset-bot Bot commented Jul 22, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4ac7c8a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jul 22, 2025 •

Copy link
Copy Markdown
Contributor

Changeset has been generated for this PR as part of auto-changeset workflow.

Please review the changeset before merging the PR.
---
'@asyncapi/cli': minor
---

feat: refactor CLI to be service based and initial migration of server-api

- ac95777: feat: refactor cli to be service based and migrate server-api

Signed-off-by: Shurtu-gal <[email protected]>
- 6b925f4: chore: fix diff test

Signed-off-by: Shurtu-gal <[email protected]>
- cfe6e8d: feat: add generator controller

Signed-off-by: Shurtu-gal <[email protected]>
- b2d7bcc: chore: don't need to install everytime

Signed-off-by: Shurtu-gal <[email protected]>
- dd71d22: Merge remote-tracking branch 'origin/master' into refactor
- 1fd1216: fix: linting

Signed-off-by: Ashish Padhy <[email protected]>
- 6bd3e73: chore: run prettier

Signed-off-by: Ashish Padhy <[email protected]>
- ca3fdee: chore: run linter

Signed-off-by: Ashish Padhy <[email protected]>
- 1d03d79: chore: quick startup of server-api

Signed-off-by: Shurtu-gal <[email protected]>
- 13729bb: chore: rename to apps

Signed-off-by: Ashish Padhy <[email protected]>
- cdd2a43: chore: rename npm commands

Signed-off-by: Ashish Padhy <[email protected]>
- 90aca02: Merge remote-tracking branch 'remote/master' into refactor

If you are a maintainer or the author of the PR, you can change the changeset by clicking here

Tip

If you don't want auto-changeset to run on this PR, you can add the label skip-changeset to the PR or remove the changeset and change PR title to something other than fix: or feat:.

Comment on lines +95 to +103
asyncapi = `${asyncapi}+${proxyUrl}`;
}
const asyncapiInput = (await load(asyncapi)) || (await load());

this.specFile = asyncapiInput;
this.metricsMetadata.template = template;

const watchTemplate = flags['watch'];
const genOption: any = {};

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygVkoVy1oNo4WlTLs-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygVkoVy1oNo4WlTLs&open=AZgygVkoVy1oNo4WlTLs&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +219 to +221
}

private disableHooksParser(inputs?: string[]) {

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygVkoVy1oNo4WlTLu-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygVkoVy1oNo4WlTLu&open=AZgygVkoVy1oNo4WlTLu&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +269 to +271
if (!isURL.test(input.toLowerCase())) {
throw new Error(
'Invalid --registry-url flag. The param requires a valid http/https url.',

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygVkoVy1oNo4WlTLv-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygVkoVy1oNo4WlTLv&open=AZgygVkoVy1oNo4WlTLv&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +361 to +363
} catch (err: any) {
// intentional
}

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygVkoVy1oNo4WlTLz-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygVkoVy1oNo4WlTLz&open=AZgygVkoVy1oNo4WlTLz&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +92 to +99
let optimizer: Optimizer;
let report: Report;
try {
optimizer = new Optimizer(this.specFile.text());
report = await optimizer.getReport();
} catch (err) {
this.error(
new ValidationError({

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygVvgVy1oNo4WlTMZ-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygVvgVy1oNo4WlTMZ&open=AZgygVvgVy1oNo4WlTMZ&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +94 to +96
await (await this.recorder).flush();
} catch (e: any) {
if (e instanceof Error) {

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygV0ZVy1oNo4WlTMl-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygV0ZVy1oNo4WlTMl&open=AZgygV0ZVy1oNo4WlTMl&pullRequest=1825">SonarQube Cloud</a></p>
Comment on lines +269 to +271
} catch (e) {
// We did our best...
}

Check notice

Code scanning / SonarCloud

Exceptions should not be ignored

<!--SONAR_ISSUE_KEY:AZgygV1gVy1oNo4WlTM5-->Handle this exception or don't catch it at all. <p>See more on <a href="https://sonarcloud.io/project/issues?id=asyncapi_cli&issues=AZgygV1gVy1oNo4WlTM5&open=AZgygV1gVy1oNo4WlTM5&pullRequest=1825">SonarQube Cloud</a></p>
@asyncapi-bot asyncapi-bot added the bounty AsyncAPI Bounty program related label label Jul 28, 2025
@aeworxet

Copy link
Copy Markdown
Contributor

@asyncapi/bounty_team

@aeworxet aeworxet moved this to In Progress in Microgrant Program Jul 28, 2025
@Shurtu-gal Shurtu-gal mentioned this pull request Jul 29, 2025
2 tasks done

@Souvikns Souvikns left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what is happening inside domain folder, I see that the bundler controller is missing service why is that?

@Shurtu-gal

Copy link
Copy Markdown
Collaborator Author

what is happening inside domain folder, I see that the bundler controller is missing service why is that?

Both the command and controller functionality is a single liner:

https://github.com/asyncapi/cli/pull/1825/files#diff-bcdbb07adcb4dbc9a0f352ef02fae6bc3ebc3420459351691c51a3df55e7e28eR35

https://github.com/asyncapi/cli/pull/1825/files#diff-a24635abb0853af65b077941557f3fe58a21bc061ec9c563ac02256bd4600677R17

Hence I didn't feel the need to add another service for them.

Souvikns
Souvikns previously approved these changes Aug 13, 2025

@Souvikns Souvikns left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. I noticed you also updated the folder name we discussed in the meeting. When merging, please make sure to account for the other open PRs so there are no conflicts.

@github-project-automation github-project-automation Bot moved this from To Triage to Backlog in CLI - Kanban Aug 13, 2025
@sonarqubecloud

Copy link
Copy Markdown

@Shurtu-gal

Copy link
Copy Markdown
Collaborator Author

@Souvikns would require your approval again.

Regarding the current open PRs all of them are pretty small. I can help out in resolving their conflicts.

@Shurtu-gal

Copy link
Copy Markdown
Collaborator Author

/rtm

@asyncapi-bot
asyncapi-bot merged commit c944268 into asyncapi:master Aug 19, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Completed in Microgrant Program Aug 19, 2025
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CLI - Kanban Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty AsyncAPI Bounty program related label ready-to-merge

Projects

Status: Done
Status: Completed

Development

Successfully merging this pull request may close these issues.

Refactor the CLI to be service based

5 participants