Skip to content

feat: add --availability flag for event transparency#868

Open
Aurelian-Shuttleworth wants to merge 2 commits intoinsanum:mainfrom
Aurelian-Shuttleworth:feature/transparency
Open

feat: add --availability flag for event transparency#868
Aurelian-Shuttleworth wants to merge 2 commits intoinsanum:mainfrom
Aurelian-Shuttleworth:feature/transparency

Conversation

@Aurelian-Shuttleworth
Copy link

@Aurelian-Shuttleworth Aurelian-Shuttleworth commented Jan 26, 2026

Summary

Added a new --availability flag to the add command, allowing users to explicitly set an event as "Free" or "Busy".

Why

Resolves #867.
Currently, gcalcli defaults all new events to "Busy" (Opaque). Users need the ability to create "Ghost Blocks" — events that are visible for planning but do not block scheduling availability.
This PR exposes the Google Calendar API transparency field via a user-friendly --availability flag.

Verification

  • Automated Tests: Added test_add_event_availability to tests/test_gcalcli.py. Verified with pytest.
  • Manual Verification:
    1. Ran gcalcli add ... --availability free -> Event created as "Free".
    2. Ran gcalcli add ... --availability busy -> Event created as "Busy".

Checklist

  • Code follows project style
  • Tests added and passing
  • Documentation updated (README.md)

This pull request introduces a new --availability flag to the add command, allowing users to specify their free/busy status for new events.

Key changes include:

  • Added --availability flag: Users can now set an event's availability to free or busy (defaulting to busy) when creating it.
  • Integrated availability into event creation: The chosen availability status is translated into the Google Calendar API's transparency field (transparent for free, opaque for busy) when an event is added.
  • Enhanced event details display: A new handler is added to correctly interpret and display the event's availability (free/busy) when viewing event details.
  • New test case: A test has been added to ensure that events created with --availability free correctly set the transparency field to transparent.

- Add Transparency handler to details.py
- Add --transparency flag to argparsers.py
- Update CLI wiring to pass transparency arg
- Add regression test
- Rename CLI flag to --availability
- Update choices to free/busy
- Map free->transparent and busy->opaque in gcal.py
- Rename Transparency handler to Availability and update display logic
- Update tests
@kody-ai
Copy link

kody-ai bot commented Jan 26, 2026

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Automatic Review: Kody reviews this PR automatically on every push.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Cross File

Access your configuration settings here.

Comment on lines +612 to +617
add.add_argument(
'--availability',
default='busy',
choices=['free', 'busy'],
help='Event availability (free/busy status). Default is busy.',
)
Copy link

Choose a reason for hiding this comment

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

kody code-review Bug high

The code uses user-friendly values ('free', 'busy') instead of the Google Calendar API's required values ('transparent', 'opaque') for the event availability/transparency field. This mismatch causes API errors and prevents the feature from working correctly.

This issue appears in multiple locations:

  • gcalcli/argparsers.py: Lines 612-617
  • gcalcli/details.py: Lines 359-367
    Please ensure all code handling event availability translates between user-facing terms ('free'/'busy') and API-required values ('transparent'/'opaque') consistently across the codebase.
    add.add_argument(
        '--availability',
        dest='transparency',
        default='opaque',
        choices=['transparent', 'opaque'],
        help='Event availability. Use "transparent" for free, "opaque" for busy. Default is opaque.',
    )
Prompt for LLM

File gcalcli/argparsers.py:

Line 612 to 617:

The provided Python code adds a new command-line argument `--availability` to a tool that interacts with the Google Calendar API. The argument is intended to control the event's 'transparency' property, which makes an event appear as 'Free' or 'Busy' on the calendar.

The current implementation defines the choices for this argument as 'free' and 'busy'. However, the Google Calendar API's `transparency` field requires the literal string values 'transparent' or 'opaque'.

The code is missing a step to translate the user-friendly values ('free', 'busy') into the API-required values ('transparent', 'opaque'). This will cause API errors when the feature is used.

Please refactor the `add_argument` call to fix this issue. The most direct solution is to use the API-compliant values directly. You should also update the `dest` parameter to 'transparency' to match the API field name, change the `default` value to its API equivalent, and update the `help` text to guide the user correctly.

Suggested Code:

    add.add_argument(
        '--availability',
        dest='transparency',
        default='opaque',
        choices=['transparent', 'opaque'],
        help='Event availability. Use "transparent" for free, "opaque" for busy. Default is opaque.',
    )

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

Comment on lines +399 to +409
gcal = PatchedGCalI(
cal_names=cal_names, allday=False, default_reminders=True)
assert gcal.AddEvent(title='transparent event',
where='anywhere',
start='now',
end='tomorrow',
descr='testing',
who='anyone',
reminders=None,
color='banana',
availability='free')
Copy link

Choose a reason for hiding this comment

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

kody code-review Bug high

The test passes the availability option as a keyword argument to the AddEvent method. However, command-line options are typically used to initialize the GCalI object's state via its constructor. The AddEvent method would then read this state from self.options.availability rather than accepting it as a direct parameter.

This approach tests a method signature that likely differs from the production code, which will cause the test to fail with a TypeError: AddEvent() got an unexpected keyword argument 'availability' before the actual logic can be verified. The availability option should be passed to the PatchedGCalI constructor to correctly simulate the application's behavior.

    gcal = PatchedGCalI(
            cal_names=cal_names, allday=False, default_reminders=True,
            availability='free')
    assert gcal.AddEvent(title='transparent event',
                         where='anywhere',
                         start='now',
                         end='tomorrow',
                         descr='testing',
                         who='anyone',
                         reminders=None,
                         color='banana')
Prompt for LLM

File tests/test_gcalcli.py:

Line 399 to 409:

The provided Python test case is flawed. It attempts to test a new 'availability' feature by passing `availability='free'` as a keyword argument directly to the `AddEvent` method. However, in this command-line application, options like this are typically passed to the main class's constructor to set its internal state (e.g., `self.options`). The `AddEvent` method would then read the availability from this internal state, not from a direct method argument. Because the test calls the method with an unexpected keyword argument, it will raise a `TypeError` and crash before it can verify the feature's logic. Please refactor the test to pass the `availability` option to the `PatchedGCalI` constructor instead of the `AddEvent` method call, which will correctly simulate the application's behavior and allow the test to validate the implementation.

Suggested Code:

    gcal = PatchedGCalI(
            cal_names=cal_names, allday=False, default_reminders=True,
            availability='free')
    assert gcal.AddEvent(title='transparent event',
                         where='anywhere',
                         start='now',
                         end='tomorrow',
                         descr='testing',
                         who='anyone',
                         reminders=None,
                         color='banana')

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support for event availability (free/busy)

1 participant