Skip to content

Use static command discovery in @fedify/cli#808

Merged
dahlia merged 8 commits into
fedify-dev:mainfrom
dahlia:cli/discover
Jun 18, 2026
Merged

Use static command discovery in @fedify/cli#808
dahlia merged 8 commits into
fedify-dev:mainfrom
dahlia:cli/discover

Conversation

@dahlia

@dahlia dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member

What changed

This PR updates @fedify/cli to Optique 1.1.0 and moves the CLI command tree to static command descriptors from @optique/discover. The new packages/cli/src/commands.ts registry declares the available commands with defineCommand(), while each command module now exports its option parser and metadata separately. The existing *Command exports stay in place for tests and direct parser use.

packages/cli/src/runner.ts composes those static descriptors into the same grouped command layout the CLI already exposed. It keeps the selected command as internal parse state, then strips that marker from the public runCli() result. packages/cli/src/mod.ts uses the selected command path to dispatch to the existing handlers and now awaits every async branch.

The dependency update touches deno.json, deno.lock, pnpm-workspace.yaml, pnpm-lock.yaml, and packages/cli/package.json. It upgrades @optique/config, @optique/core, and @optique/run to 1.1.0, then adds @optique/discover for the CLI package.

Why static commands

Optique 1.1.0 added command discovery, including a file-system discovery mode and a static command mode. File-system discovery is convenient for many CLIs, but @fedify/cli is also built with deno compile. Static descriptors give the CLI a discoverable command registry without depending on runtime file scanning or dynamic command imports in the standalone executable.

This follows the Optique 1.1.0 command discovery work discussed at dahlia/optique#834.

Testing

  • git diff --check
  • deno task -f @fedify/cli check
  • pnpm --filter @fedify/cli test
  • deno task -f @fedify/cli test
  • OS=linux ARCH=x86_64 CONCURRENCY=1 deno task -f @fedify/cli pack

@netlify

netlify Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy Preview for fedify-json-schema ready!

Name Link
🔨 Latest commit f2a541d
🔍 Latest deploy log https://app.netlify.com/projects/fedify-json-schema/deploys/6a326504e9ac6400075bca92
😎 Deploy Preview https://deploy-preview-808--fedify-json-schema.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@dahlia dahlia added the component/cli CLI tools related label Jun 16, 2026
@dahlia dahlia added this to the Fedify 2.3 milestone Jun 16, 2026
@dahlia dahlia self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Bumps @optique/* packages from ^1.0.2 to ^1.1.0 and adds @optique/discover. Refactors every CLI command to export separate *Options and *Metadata constants. Extracts the lookup command into a new lookup/command.ts module. Introduces a new commands.ts registry grouping all commands into typed arrays, rewrites runner.ts with a tagged-command parsing model and a new parseCliProgram export, and updates mod.ts to dispatch commands via await program.run().

Changes

CLI Command Registry and Optique v1.1 Upgrade

Layer / File(s) Summary
@optique dependency bumps
deno.json, pnpm-workspace.yaml, packages/cli/package.json
@optique/config, @optique/core, and @optique/run bumped to ^1.1.0; @optique/discover added at ^1.1.0 in all manifests.
Extract lookup command into lookup/command.ts
packages/cli/src/lookup/command.ts, packages/cli/src/lookup.ts
New lookup/command.ts module exports ActivityStreams IRIs, recursion-property configuration, and full lookup CLI options/metadata; lookup.ts re-exports these and refactors runLookup to use an internal LookupCommand type and resolve firstKnock spec when authorized-fetch is enabled.
Extract Options/Metadata from all CLI commands
packages/cli/src/bench/command.ts, packages/cli/src/generate-vocab/command.ts, packages/cli/src/inbox/command.ts, packages/cli/src/init/mod.ts, packages/cli/src/nodeinfo.ts, packages/cli/src/relay/command.ts, packages/cli/src/tunnel.ts, packages/cli/src/webfinger/command.ts
Each command extracts its previously inline merged option schema and help text into exported *Options and *Metadata constants, then passes them into the command constructor. init/mod.ts removes re-exports of initCommand and runInit.
New commands.ts command registry
packages/cli/src/commands.ts
New module exports CliStaticCommand type, defineCliCommand helper, and three typed readonly arrays (generatingCommands, activityPubCommands, networkCommands) that aggregate all CLI commands with no-op handlers, wired Options/Metadata, and run implementations. Exports cliCommands concatenated array and CliCommand union type.
runner.ts tagged-command parsing and parseCliProgram
packages/cli/src/runner.ts
Replaces individual command imports with grouped command arrays from commands.ts; adds staticCommandParser/staticCommandsParser helpers that tag the selected command during parsing; introduces CliProgram type and parseCliProgram export that returns a runnable program object; extracts getRunOptions helper; updates runCli to delegate to run(command, getRunOptions(args)).
CLI dispatch switch and test coverage
packages/cli/src/mod.ts, packages/cli/src/runner.test.ts, packages/cli/src/startup.test.ts
mod.ts imports parseCliProgram and executes via await program.run() instead of manual if/else command dispatch. runner.test.ts adds two tests validating parseCliProgram preserves selected command and runCli strips internal markers. startup.test.ts verifies dist/commands.js instead of dist/init/mod.js.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fedify-dev/fedify#677: Introduced packages/cli/src/runner.ts and updated packages/cli/src/mod.ts to use runCli, which this PR directly extends by adding parseCliProgram and the grouped static-command dispatch.

Suggested labels

dependencies

Suggested reviewers

  • 2chanhaeng
  • sij411
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: transitioning the CLI to use static command discovery from Optique's @optique/discover package.
Description check ✅ Passed The description comprehensively explains what changed, why the shift to static commands was made, and includes testing information that aligns with the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dahlia

dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command parsing and definition structure in @fedify/cli by upgrading @optique dependencies to ^1.1.0 and introducing @optique/discover. Individual commands (such as bench, inbox, lookup, nodeinfo, relay, tunnel, and webfinger) have been refactored to separate their options and metadata, with their static definitions consolidated into a new commands.ts file. Additionally, the main entry point and runner have been updated to use the new parseCliProgram utility, accompanied by corresponding test updates. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/mod.ts`:
- Around line 16-47: The switch statement in the command dispatch logic uses
unsafe type casts with `as unknown as Parameters<typeof ...>[0]` which bypass
TypeScript's type checking. Create a discriminated union type or a typed handler
mapping object that associates each command string (init, generate-vocab,
webfinger, lookup, inbox, nodeinfo, relay, bench, tunnel) with its corresponding
handler and its expected parameter type. Refactor the switch statement to use
this mapping so that the value parameter gets properly type-narrowed by the
discriminated union without requiring the unsafe unknown casts, allowing
TypeScript to enforce compile-time contracts between parser output and handler
inputs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 178af8f7-242a-4cc2-adaf-4b9839195072

📥 Commits

Reviewing files that changed from the base of the PR and between d351e55 and 48e42e5.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (17)
  • deno.json
  • packages/cli/package.json
  • packages/cli/src/bench/command.ts
  • packages/cli/src/commands.ts
  • packages/cli/src/generate-vocab/command.ts
  • packages/cli/src/inbox/command.ts
  • packages/cli/src/init/mod.ts
  • packages/cli/src/lookup.ts
  • packages/cli/src/mod.ts
  • packages/cli/src/nodeinfo.ts
  • packages/cli/src/relay/command.ts
  • packages/cli/src/runner.test.ts
  • packages/cli/src/runner.ts
  • packages/cli/src/startup.test.ts
  • packages/cli/src/tunnel.ts
  • packages/cli/src/webfinger/command.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • packages/cli/src/init/mod.ts

Comment thread packages/cli/src/mod.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 48e42e557e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.69863% with 46 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/cli/src/commands.ts 80.00% 26 Missing ⚠️
packages/cli/src/runner.ts 88.28% 8 Missing and 5 partials ⚠️
packages/cli/src/lookup.ts 80.95% 4 Missing ⚠️
packages/cli/src/lookup/command.ts 99.16% 1 Missing and 1 partial ⚠️
packages/cli/src/relay/command.ts 98.73% 1 Missing ⚠️
Files with missing lines Coverage Δ
packages/cli/src/bench/command.ts 100.00% <100.00%> (ø)
packages/cli/src/generate-vocab/command.ts 100.00% <100.00%> (ø)
packages/cli/src/inbox/command.ts 100.00% <100.00%> (ø)
packages/cli/src/nodeinfo.ts 45.77% <100.00%> (+0.27%) ⬆️
packages/cli/src/tunnel.ts 92.10% <100.00%> (+0.21%) ⬆️
packages/cli/src/webfinger/command.ts 100.00% <100.00%> (ø)
packages/cli/src/relay/command.ts 99.06% <98.73%> (+0.01%) ⬆️
packages/cli/src/lookup/command.ts 99.16% <99.16%> (ø)
packages/cli/src/lookup.ts 66.01% <80.95%> (-5.92%) ⬇️
packages/cli/src/runner.ts 83.05% <88.28%> (-1.44%) ⬇️
... and 1 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dahlia added a commit to dahlia/fedify-fork that referenced this pull request Jun 16, 2026
Static CLI command definitions now carry the typed runtime handler next to the parser descriptor.  The entrypoint dispatches through the parsed program without erasing each handler parameter type or casting through unknown.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
@dahlia

dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@dahlia

dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command registration and execution by upgrading the @optique dependencies to version 1.1.0 and introducing @optique/discover. Individual command options and metadata have been decoupled, and a centralized commands.ts file has been created to define and group all CLI commands. The main entry point and runner have been updated to dynamically parse and run commands using the new discovery mechanism, accompanied by updated tests. There are no review comments to evaluate, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75db7c876b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/commands.ts Outdated
dahlia added a commit to dahlia/fedify-fork that referenced this pull request Jun 16, 2026
Static command descriptors now import parser-only modules where available
and load heavier command handlers only when the selected command runs.
This keeps parse-only runner imports compatible with Node 20, where
node:sqlite is not available.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
@dahlia

dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

@codex review

@dahlia

dahlia commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/cli/src/lookup.ts (1)

75-95: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Derive LookupCommand from the parser type instead of duplicating the shape.

The hand-written command type is broader than the parser contract and can silently drift. Use InferValue<typeof import("./lookup/command.ts").lookupOptions> (or equivalent) to keep runLookup() strictly aligned with CLI parsing output.

Suggested refactor
-import { message, optionNames } from "`@optique/core`";
+import { type InferValue, message, optionNames } from "`@optique/core`";
@@
-type LookupCommand = GlobalOptions & {
-  readonly command: "lookup";
-  readonly traverse: boolean;
-  readonly recurse: RecurseProperty | undefined;
-  readonly recurseDepth: number | undefined;
-  readonly suppressErrors: boolean;
-  readonly authorizedFetch: boolean | undefined;
-  readonly firstKnock:
-    | "draft-cavage-http-signatures-12"
-    | "rfc9421"
-    | undefined;
-  readonly tunnelService: TunnelService | undefined;
-  readonly userAgent: string;
-  readonly allowPrivateAddress: boolean;
-  readonly timeout: number | undefined;
-  readonly urls: readonly string[];
-  readonly reverse: boolean;
-  readonly format: string | undefined;
-  readonly separator: string;
-  readonly output: string | undefined;
-};
+type LookupCommand = GlobalOptions & InferValue<
+  typeof import("./lookup/command.ts").lookupOptions
+>;

As per coding guidelines, **/*.ts must maintain strict TypeScript typing throughout.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/lookup.ts` around lines 75 - 95, The LookupCommand type is
hand-written and duplicates the parser contract, which can cause it to drift out
of sync with the actual CLI parsing output. Replace the manually defined
LookupCommand type with a derived type that uses TypeScript's type inference
from the parser's lookupOptions export (from the lookup/command.ts file). Use
InferValue or equivalent type utility to automatically infer the command shape
from the parser, ensuring that runLookup() is always strictly aligned with the
actual CLI parsing output without manual duplication.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@packages/cli/src/lookup.ts`:
- Around line 75-95: The LookupCommand type is hand-written and duplicates the
parser contract, which can cause it to drift out of sync with the actual CLI
parsing output. Replace the manually defined LookupCommand type with a derived
type that uses TypeScript's type inference from the parser's lookupOptions
export (from the lookup/command.ts file). Use InferValue or equivalent type
utility to automatically infer the command shape from the parser, ensuring that
runLookup() is always strictly aligned with the actual CLI parsing output
without manual duplication.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d3ed876-8a1f-48a0-a197-9471b14c87cc

📥 Commits

Reviewing files that changed from the base of the PR and between 75db7c8 and ae384ab.

📒 Files selected for processing (3)
  • packages/cli/src/commands.ts
  • packages/cli/src/lookup.ts
  • packages/cli/src/lookup/command.ts

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command registration and execution by adopting the @optique/discover package. It separates options and metadata definitions for all commands (such as bench, inbox, lookup, nodeinfo, relay, tunnel, and webfinger) and centralizes command routing into a new commands.ts file. This allows the main entry point to dynamically parse and execute commands using a unified CliProgram runner. Feedback on the changes suggests renaming a destructured variable run in runner.ts to avoid shadowing the imported run function from @optique/run.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/cli/src/runner.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ae384ab152

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dahlia added a commit to dahlia/fedify-fork that referenced this pull request Jun 17, 2026
The parsed command runner was destructured into a local variable named run inside the module that imports Optique's run helper. Rename the local binding to make the dispatch path unambiguous.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command structure by upgrading @optique packages to version 1.1.0 and integrating @optique/discover for command definition and routing. Command options and metadata have been modularized across individual command files, and a centralized commands.ts file has been introduced to manage command groups. A critical TypeScript compilation error was identified in packages/cli/src/lookup.ts where lookupOptions is imported as a type but referenced as a value in a typeof type query.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/cli/src/lookup.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4ad4d4fa68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dahlia added 4 commits June 17, 2026 16:35
Upgrade Optique to 1.1.0 and register CLI commands as static
command descriptors.  This keeps the command tree discoverable without
runtime file scanning, so `deno compile` packaging continues to work.

Dispatch the selected static command from the parsed program and await
all command handlers so asynchronous failures remain observable.

dahlia/optique#834

Assisted-by: Codex:gpt-5.5
Static CLI command definitions now carry the typed runtime handler next to the parser descriptor.  The entrypoint dispatches through the parsed program without erasing each handler parameter type or casting through unknown.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
Static command descriptors now import parser-only modules where available
and load heavier command handlers only when the selected command runs.
This keeps parse-only runner imports compatible with Node 20, where
node:sqlite is not available.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
The lookup runner used a hand-written command value type that duplicated the parser output shape. This made the runner easy to drift from lookupOptions as new flags moved into the command parser.

Infer the command value from lookupOptions so runLookup stays aligned with the actual parser contract.

Assisted-by: Codex:gpt-5.5
dahlia added 2 commits June 17, 2026 16:35
The parsed command runner was destructured into a local variable named run inside the module that imports Optique's run helper. Rename the local binding to make the dispatch path unambiguous.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
The rebased branch now sits on top of benchmark comparison support. The static command registry must load the dispatcher that handles both run and compare modes instead of loading the run-only action directly.

Assisted-by: Codex:gpt-5.5

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/runner.ts`:
- Around line 243-255: The toCliProgram function extracts and strips internal
properties (selectedCommand and selectedRun) from the parsed object into the
value variable, but the run function being returned still passes the original
unparsed object to runCommand. This means the internal tagged properties
(__fedifyCliSelectedCommand and __fedifyCliRunCommand) are still forwarded to
command handlers. Instead of passing the full parsed object, pass the
already-stripped value object to runCommand so that only the cleaned command
arguments are forwarded to handlers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d14680a6-1a14-4ce5-b800-8d6fee34727f

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad4d4f and 97c0fe5.

⛔ Files ignored due to path filters (2)
  • deno.lock is excluded by !**/*.lock
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • deno.json
  • packages/cli/package.json
  • packages/cli/src/bench/command.ts
  • packages/cli/src/commands.ts
  • packages/cli/src/generate-vocab/command.ts
  • packages/cli/src/inbox/command.ts
  • packages/cli/src/init/mod.ts
  • packages/cli/src/lookup.ts
  • packages/cli/src/lookup/command.ts
  • packages/cli/src/mod.ts
  • packages/cli/src/nodeinfo.ts
  • packages/cli/src/relay/command.ts
  • packages/cli/src/runner.test.ts
  • packages/cli/src/runner.ts
  • packages/cli/src/startup.test.ts
  • packages/cli/src/tunnel.ts
  • packages/cli/src/webfinger/command.ts
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (1)
  • packages/cli/src/init/mod.ts

Comment thread packages/cli/src/runner.ts Outdated
The parsed CLI value carries private marker fields used to identify and run the selected static command. Reuse the public value when dispatching through parseCliProgram so command handlers do not receive those internal fields.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command structure to use @optique/discover for dynamic command definition and parsing, separating command options and metadata from their execution logic. It also updates dependencies to @optique version 1.1.0 and simplifies the main entry point. Feedback on the changes highlights a TypeScript compilation error in lookup.ts due to importing lookupOptions as a type instead of a value, and suggests avoiding the use of as never for type assertion in tests to maintain type safety.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/cli/src/lookup.ts
Comment thread packages/cli/src/runner.test.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 66389047f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The runner regression test still needs to construct a synthetic parsed value, but it can assert the parameter type expected by toCliProgram instead of bypassing type checking with never.

fedify-dev#808 (comment)

Assisted-by: Codex:gpt-5.5
@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@dahlia

dahlia commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the CLI command registration and execution structure by upgrading the @optique dependencies to version 1.1.0 and introducing @optique/discover. It extracts options and metadata from individual command definitions (such as bench, generate-vocab, inbox, lookup, nodeinfo, relay, tunnel, and webfinger) and consolidates command definitions into a new commands.ts file. The main entry point (mod.ts) and the runner (runner.ts) are simplified to dynamically parse and execute these commands using the new discover utility. Additionally, unit tests are added to verify the CLI program parsing and execution. There are no review comments to address, and I have no further feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: f2a541d170

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dahlia dahlia requested review from 2chanhaeng and sij411 June 17, 2026 12:31
@dahlia dahlia merged commit d573d41 into fedify-dev:main Jun 18, 2026
20 checks passed
@dahlia dahlia deleted the cli/discover branch June 18, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli CLI tools related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants