Skip to content

Conversation

@crohasang
Copy link
Contributor

@crohasang crohasang commented Jul 12, 2025

Description

closes #262

Changes

  • Use --actor-name and --actor-summary values in Application object

    • --actor-name <name>: Customize actor display name

      • Default: "Fedify Ephemeral Inbox"
    • --actor-summary <summary>: Customize actor description

      • Default: "An ephemeral ActivityPub inbox for testing purposes."

- Add actorOptions global object to store custom values

  • eliminate global state and implement function factory (updated)
  • Replace hardcoded actor name and summary with dynamic values

Checklist

  • Add --actor-name option to customize actor display name
  • Add --actor-summary option to customize actor description
  • Update the Application object creation to use these custom values
  • Provide appropriate default values when options are not specified
  • Update command help text to document the new options

Tests

  • Ran deno task check-all — all checks passed.
  • Executed deno fmt — no formatting changes were needed.
  • Confirmed that the --actor-name and --actor-summary options appear in the help output (deno task cli inbox --help).
    CLI help screenshot
  • Manually tested the new CLI options:
    • Ran:
      deno task cli inbox --actor-name "My Test Actor" --actor-summary "A temporary actor for testing"
      
    • Accessed the site and verified that the custom actor name and summary are displayed correctly.
    • See screenshot for confirmation:
      Custom actor test screenshot
  • Ran deno task test and encountered an error.
    Based on the error message, it appears unrelated to the changes introduced in this PR.
    Test error screenshot

Additional Notes

  • During testing, I attempted to connect using both lhr.life and serveo.net:
    • The connection was successful with lhr.life.
    • However, I was unable to establish a connection using serveo.net.

Update(KST 20250713 1628)

  • Refactored implementation to eliminate global state using function factory pattern for improved code maintainability and following Builder Pattern established in the codebase.

  • Ran deno task check-all — all checks passed.

  • Executed deno fmt — no formatting changes were needed.

  • Ran deno task cli inbox

image
  • Ran
    deno task cli inbox --actor-name "My Test Actor" --actor-summary "A temporary actor for testing"
image

Update(KST 20250713 1058)

  • Rebased the feature branch onto the latest main to resolve merge conflicts
  • Remove hardcoded actorOptions
  • Extract ActorOptions interface to reduce inline type duplication in factory functions
  • Change action handler to use InboxOptions & ActorOptions intersection type
  • Update ContextData and ActorOptions annotation

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Summary of Changes

Hello @crohasang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces new command-line interface options for the fedify inbox command, enabling users to customize the ephemeral ActivityPub actor's display name and summary. This enhancement provides greater flexibility for testing and demonstration scenarios by allowing dynamic configuration of the temporary actor's identity.

Highlights

  • CLI Customization: The fedify inbox command now supports two new options: --actor-name and --actor-summary. These allow users to customize the display name and summary of the ephemeral ActivityPub actor created by the command.
  • Dynamic Actor Properties: The Application object, which represents the ephemeral actor, now uses the values provided by the new CLI options for its name and summary properties, replacing previously hardcoded strings. Sensible default values are provided if the options are not specified.
  • Code Structure: A new actorOptions global object has been introduced in cli/inbox.tsx to store and manage the custom actor name and summary values, which are then passed to the Application constructor.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@crohasang crohasang changed the title feat(cli): add --actor-name and --actor-summary options to [fedify inbox] command (#262) feat(cli): add --actor-name and --actor-summary options to [fedify inbox] command Jul 12, 2025
@github-actions github-actions bot added component/cli CLI tools related difficulty/beginner Beginner friendly good first issue Good for newcomers type/enhancement Improvements to existing features labels Jul 12, 2025
@crohasang crohasang changed the title feat(cli): add --actor-name and --actor-summary options to [fedify inbox] command feat(cli): add --actor-name and --actor-summary options to 'fedify inbox' command Jul 12, 2025
Copy link
Contributor

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

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 introduces the --actor-name and --actor-summary options to the fedify inbox command, allowing users to customize the actor's display name and summary. The changes are well-structured and include appropriate default values and documentation.

cli/inbox.tsx Outdated
Comment on lines 80 to 81
actorOptions.name = options.actorName;
actorOptions.summary = options.actorSummary;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Assigning options.actorName and options.actorSummary to the module-level actorOptions object here means that these values are effectively global state. This can lead to unexpected behavior if the command is ever used in a context where it's called multiple times, as the actorOptions would retain the values from the last call. Consider passing options.actorName and options.actorSummary directly to the Application constructor to avoid this global state.

// actorOptions.name = options.actorName;
// actorOptions.summary = options.actorSummary;

Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor Author

@crohasang crohasang Jul 13, 2025

Choose a reason for hiding this comment

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

I’ve refactored the code to eliminate the module-level global variable. Instead, I used a factory function to generate the necessary handlers, so actorName and actorSummary are now passed explicitly and safely scoped per invocation.

I’ve also updated the PR description to reflect these changes.
Please check latest commits that I pushed. Thank you!

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Thanks for your first contribution!

cli/inbox.tsx Outdated
Comment on lines 80 to 81
actorOptions.name = options.actorName;
actorOptions.summary = options.actorSummary;
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

crohasang added a commit to crohasang/fedify that referenced this pull request Jul 13, 2025
@github-actions
Copy link
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 1.8.0-pr.285.985+92329061 JSR npm
@fedify/cli 1.8.0-pr.285.985+92329061 JSR
@fedify/amqp 1.8.0-pr.285.985+92329061 JSR npm
@fedify/express 1.8.0-pr.285.985+92329061 JSR npm
@fedify/h3 1.8.0-pr.285.985+92329061 JSR npm
@fedify/postgres 1.8.0-pr.285.985+92329061 JSR npm
@fedify/redis 1.8.0-pr.285.985+92329061 JSR npm

@github-actions
Copy link
Contributor

The docs for this pull request have been published:

https://9fd021ac.fedify.pages.dev

@dahlia dahlia requested a review from Copilot July 13, 2025 12:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds --actor-name and --actor-summary options to the fedify inbox command, refactors out global state using factory functions, and replaces hardcoded actor metadata with dynamic values.

  • Introduce CLI options with sensible defaults for actor name and summary.
  • Refactor createContext, fetch, and delete handlers to accept ContextData.
  • Update Application instantiation to use actorName and actorSummary.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cli/inbox.tsx Add options, define ContextData, convert federation and handlers to use dynamic metadata.
CHANGES.md Document new CLI options and link issue/PR references.
Comments suppressed due to low confidence (3)

cli/inbox.tsx:81

  • [nitpick] The local variable name fetch shadows the global fetch function and may cause confusion. Consider renaming it to something like handleRequest or requestHandler.
    const fetch = createFetchHandler(options);

cli/inbox.tsx:38

  • Consider adding unit tests for createFetchHandler and createSendDeleteToPeers to verify that the actorName and actorSummary options are correctly passed through the federation context.
interface ContextData {

CHANGES.md:34

  • There's an extra [ before #262 in the changelog entry ([[#262], [#285]). Remove the redundant bracket to correct the markdown links.
 -  Added options to customize the temporary actor information when running

cli/inbox.tsx Outdated
Comment on lines 224 to 227
function createSendDeleteToPeers(actorOptions: {
actorName: string;
actorSummary: string;
}): (server: TemporaryServer) => Promise<void> {
Copy link

Copilot AI Jul 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The inline type { actorName: string; actorSummary: string } is duplicated in both factory functions. Extract it into a shared ActorOptions type to reduce duplication and improve clarity.

Suggested change
function createSendDeleteToPeers(actorOptions: {
actorName: string;
actorSummary: string;
}): (server: TemporaryServer) => Promise<void> {
function createSendDeleteToPeers(actorOptions: ActorOptions): (server: TemporaryServer) => Promise<void> {

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I've applied your recommendations.

@dahlia
Copy link
Member

dahlia commented Jul 13, 2025

There seem some conflicts. Could you rebase it on the current main?

- Use --actor-name and --actor-summary values in Application object
- Add actorOptions global object to store custom values
- Replace hardcoded actor name and summary with dynamic values
- Document --actor-name and --actor-summary options for Issue fedify-dev#262
…nnotations

- Remove hardcoded actorOptions
- Extract ActorOptions interface to reduce inline type duplication in factory functions
- Change action handler to use InboxOptions & ActorOptions intersection type
- Update ContextData and ActorOptions annotation
@crohasang crohasang force-pushed the feature/262-inbox-actor-customization branch from 9232906 to 131fe7a Compare July 13, 2025 13:57
@crohasang
Copy link
Contributor Author

There seem some conflicts. Could you rebase it on the current main?

Thank you for pointing that out!
I have rebased my branch onto the latest main and resolved all conflicts.
I also updated my code to accommodate the recent changes in main.

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

I feel like we could abstract this better than we currently have, but I can't think of how. Let's just merge it for now!

@dahlia dahlia merged commit 67cd278 into fedify-dev:main Jul 14, 2025
10 of 11 checks passed
@crohasang crohasang deleted the feature/262-inbox-actor-customization branch July 14, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/cli CLI tools related difficulty/beginner Beginner friendly good first issue Good for newcomers type/enhancement Improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add actor customization options to fedify inbox command

2 participants