Skip to content

Migrate cli lookup from Cliffy to Optique - #390

Merged
dahlia merged 51 commits into
fedify-dev:nextfrom
sij411:feat/optique
Sep 5, 2025
Merged

Migrate cli lookup from Cliffy to Optique #390
dahlia merged 51 commits into
fedify-dev:nextfrom
sij411:feat/optique

Conversation

@sij411

@sij411 sij411 commented Aug 29, 2025

Copy link
Copy Markdown
Member

Summary

Migrated fedify/cli lookup and its test from Cliffy to Optique

Related Issue

Changes

  • Created new package cli-optique. This will be a working directory for migrating entire Cliffy codebase to Optique.
  • Re-wrote mod.ts, lookup.ts and lookup.test.ts with optique
  • Replaced Deno API to Node API in lookup.ts.
  • Added placeholder scripts for development
    • init.ts, nodeinfo.ts, tunnel.ts, webfinger.ts, inbox.ts

Benefits

With this migration, fedify/cli will run natively all major runtimes such as Node.js, Deno, and Bun. Also thanks to optique is type-safety and other features, future cli development and maintenance would be easier.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run deno task test-all on your machine?

Additional Notes

  • I import modules such as docloader.ts and 'tempserver.tsfrom originalpackages/cli`
  • CI failed due to relative import, I copied multiple scripts from original cli/

@github-actions github-actions Bot added component/cli CLI tools related priority/high runtime/bun Bun runtime related runtime/deno Deno runtime related runtime/node Node.js runtime related labels Aug 29, 2025
@sij411

sij411 commented Aug 30, 2025

Copy link
Copy Markdown
Member Author

Should I upgrade node version from 24.2.1 to 24.3.o (pnpm-lock.yaml)

@dahlia

dahlia commented Aug 30, 2025

Copy link
Copy Markdown
Member

No, you don't have to.

@dahlia dahlia 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.

Could you replace console.log()/console.error() calls with print()/printError() provided by Optique? See also: https://optique.dev/concepts/messages#terminal-output.

Comment thread packages/cli-optique/deno.json Outdated
Comment thread packages/cli-optique/deno.json Outdated
Comment thread packages/cli-optique/package.json Outdated
sij411 added 2 commits August 30, 2025 16:35
- replace console.log to print, console.error to printError from optique
- remove unused packages
@sij411
sij411 marked this pull request as ready for review August 30, 2025 07:58
@dahlia

dahlia commented Aug 30, 2025

Copy link
Copy Markdown
Member

Seems your commits have conflicts with the current next branch.

@github-actions

github-actions Bot commented Aug 31, 2025

Copy link
Copy Markdown
Contributor

The docs for this pull request have been published:

https://061513a5.fedify.pages.dev

@2chanhaeng 2chanhaeng 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.

Maybe it would be better to change the modules to only return command and run, then write the code like this for better consistency?

Comment thread packages/cli/src/mod.ts
Comment thread packages/cli/package.json Outdated

@dahlia dahlia 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.

Also, we should port the packages/cli/src/tempserver.ts module to Node.js and Bun as well as Deno. Deno.serve() API would be able to be replaced by srvx.

Comment thread packages/cli/src/tunnel.ts Outdated
Comment thread packages/cli/package.json Outdated
Comment thread packages/cli/deno.json Outdated
Comment thread packages/cli/src/nodeinfo.ts
Comment thread packages/cli/src/init.ts Outdated
Comment thread packages/cli/src/log.ts
Comment thread packages/cli/src/lookup.ts Outdated
Comment thread packages/cli/src/lookup.ts Outdated
- unappropriate import alias
- update pacakage version
- update message text
- update metavar

@dahlia dahlia 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.

Few nitpicks!

Comment thread packages/cli/src/log.ts Outdated
Comment thread packages/cli/src/globals.ts Outdated
Comment thread packages/cli/src/lookup.ts
Comment thread packages/cli/src/lookup.ts Outdated
@github-actions

github-actions Bot commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

Package Version JSR npm
@fedify/fedify 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/cli 2.0.0-pr.390.1532+a8ede25d JSR
@fedify/amqp 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/cfworkers 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/denokv 2.0.0-pr.390.1532+a8ede25d JSR
@fedify/elysia 2.0.0-pr.390.1532+a8ede25d npm
@fedify/express 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/h3 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/hono 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/nestjs 2.0.0-pr.390.1532+a8ede25d npm
@fedify/next 2.0.0-pr.390.1532+a8ede25d npm
@fedify/postgres 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/redis 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/sqlite 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/sveltekit 2.0.0-pr.390.1532+a8ede25d JSR npm
@fedify/testing 2.0.0-pr.390.1532+a8ede25d JSR npm

@dahlia dahlia 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.

Great work, thanks!

@dahlia
dahlia merged commit fb363e6 into fedify-dev:next Sep 5, 2025
10 checks passed
@dahlia dahlia added this to the Fedify 2.0 milestone Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli CLI tools related runtime/bun Bun runtime related runtime/deno Deno runtime related runtime/node Node.js runtime related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants