Skip to content

[DX-919] Push PR Cleanup/Dogfooding #187

Open
umair-ably wants to merge 1 commit intomainfrom
DX-919-pushFixes
Open

[DX-919] Push PR Cleanup/Dogfooding #187
umair-ably wants to merge 1 commit intomainfrom
DX-919-pushFixes

Conversation

@umair-ably
Copy link
Contributor

@umair-ably umair-ably commented Mar 24, 2026

remove deprecated set-apns-p12 command path, use promptForConfirmation helper, and fix clear FCM

Closes #180, and addresses remaining feedback from #169

Summary by CodeRabbit

  • Documentation

    • Updated to remove ably apps set-apns-p12 command examples.
    • Added new ably channels presence update example with --pretty-json flag for colorized output.
  • Changes

    • Removed the deprecated ably apps set-apns-p12 command.
    • Improved confirmation prompts in push-related commands.
    • Enhanced FCM configuration clearing to include project ID removal.

@umair-ably umair-ably requested review from AndyTWF and sacOO7 March 24, 2026 10:36
@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli-web-cli Ready Ready Preview, Comment Mar 24, 2026 10:36am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

Walkthrough

This pull request removes the deprecated ably apps set-apns-p12 command along with its documentation and tests, and refactors push-related commands to use a shared promptForConfirmation utility instead of the inquirer library. Additionally, the FCM clearing logic is updated to null out the fcmProjectId field.

Changes

Cohort / File(s) Summary
APNS P12 Command Removal
README.md, src/commands/apps/index.ts, src/commands/apps/set-apns-p12.ts, test/unit/commands/apps/set-apns-p12.test.ts
Removed the deprecated ably apps set-apns-p12 command implementation (107 lines), its example references, and complete test suite (175 lines). Updated README with a new channels presence example.
Confirmation Prompt Refactoring
src/commands/push/channels/remove-where.ts, src/commands/push/channels/remove.ts, src/commands/push/config/clear-apns.ts, src/commands/push/devices/remove-where.ts, src/commands/push/devices/remove.ts
Replaced inquirer dependency with shared promptForConfirmation utility across five push-related commands for consistent confirmation flow.
FCM Clearing Enhancement
src/commands/push/config/clear-fcm.ts
Updated FCM clearing logic to additionally null out fcmProjectId field alongside existing fcmServiceAccount, addressing issue with Project ID field remaining visible after clearing FCM configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 The APNS command hops away to history's bright page,
While prompts find unity through a shared new stage,
FCM clears its Project ID with newfound care,
Six commands dance together in patterns oh so fair! 🎭✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'DX-919 Push PR Cleanup/Dogfooding' is partially related to the changeset, referencing cleanup activities but lacking specific clarity about the main changes.
Linked Issues check ✅ Passed The changeset successfully addresses issue #180 by updating the FCM clear command to null out both fcmServiceAccount and fcmProjectId fields, resolving the issue.
Out of Scope Changes check ✅ Passed Several changes extend beyond the linked issue #180: removal of set-apns-p12 command (deprecation cleanup), replacement of inquirer with promptForConfirmation helper across multiple files, and associated test file removals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DX-919-pushFixes

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/commands/push/channels/remove.ts (1)

59-61: Format resource names in the confirmation text.

Line 60 currently interpolates raw identifiers (target and flags.channel). Use formatResource(...) for those resource values to match command output conventions.

♻️ Proposed tweak
-      const target = flags["device-id"]
-        ? `device ${flags["device-id"]}`
-        : `client ${flags["client-id"]}`;
+      const target = flags["device-id"]
+        ? `device ${formatResource(flags["device-id"])}`
+        : `client ${formatResource(flags["client-id"] as string)}`;

       if (!flags.force && !this.shouldOutputJson(flags)) {
         const confirmed = await promptForConfirmation(
-          `Are you sure you want to unsubscribe ${target} from channel ${flags.channel}?`,
+          `Are you sure you want to unsubscribe ${target} from channel ${formatResource(flags.channel)}?`,
         );
As per coding guidelines, "Always use formatResource(name) (cyan) for resource names instead of quoted strings, including in logCliEvent messages".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/push/channels/remove.ts` around lines 59 - 61, The confirmation
prompt is interpolating raw identifiers; change the message passed to
promptForConfirmation to wrap the channel and target using formatResource(...)
so resource names follow the CLI convention; update the call in remove.ts (the
promptForConfirmation invocation that currently uses `target` and
`flags.channel`) to use formatResource(target) and formatResource(flags.channel)
instead.
src/commands/push/devices/remove.ts (1)

43-45: Use formatResource in the confirmation prompt.

Line 44 prints the device ID raw; wrap it with formatResource(...) to keep resource rendering consistent with other command output.

♻️ Proposed tweak
-        const confirmed = await promptForConfirmation(
-          `Are you sure you want to remove device ${deviceId}?`,
-        );
+        const confirmed = await promptForConfirmation(
+          `Are you sure you want to remove device ${formatResource(deviceId)}?`,
+        );
As per coding guidelines, "Always use formatResource(name) (cyan) for resource names instead of quoted strings, including in logCliEvent messages".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/push/devices/remove.ts` around lines 43 - 45, The confirmation
prompt currently interpolates the raw deviceId into promptForConfirmation;
update the prompt to wrap the resource name with formatResource(deviceId) so the
device is rendered consistently (cyan) across CLI output—locate the
promptForConfirmation call in removeDevice flow and replace the raw ${deviceId}
usage with formatResource(deviceId).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/commands/push/channels/remove.ts`:
- Around line 59-61: The confirmation prompt is interpolating raw identifiers;
change the message passed to promptForConfirmation to wrap the channel and
target using formatResource(...) so resource names follow the CLI convention;
update the call in remove.ts (the promptForConfirmation invocation that
currently uses `target` and `flags.channel`) to use formatResource(target) and
formatResource(flags.channel) instead.

In `@src/commands/push/devices/remove.ts`:
- Around line 43-45: The confirmation prompt currently interpolates the raw
deviceId into promptForConfirmation; update the prompt to wrap the resource name
with formatResource(deviceId) so the device is rendered consistently (cyan)
across CLI output—locate the promptForConfirmation call in removeDevice flow and
replace the raw ${deviceId} usage with formatResource(deviceId).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dfffddf7-c57c-4d2e-9ba0-7ef0ec0c5b99

📥 Commits

Reviewing files that changed from the base of the PR and between c2c1d30 and 454c390.

📒 Files selected for processing (10)
  • README.md
  • src/commands/apps/index.ts
  • src/commands/apps/set-apns-p12.ts
  • src/commands/push/channels/remove-where.ts
  • src/commands/push/channels/remove.ts
  • src/commands/push/config/clear-apns.ts
  • src/commands/push/config/clear-fcm.ts
  • src/commands/push/devices/remove-where.ts
  • src/commands/push/devices/remove.ts
  • test/unit/commands/apps/set-apns-p12.test.ts
💤 Files with no reviewable changes (3)
  • src/commands/apps/index.ts
  • src/commands/apps/set-apns-p12.ts
  • test/unit/commands/apps/set-apns-p12.test.ts

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

After clearing FCM, Project ID field still shown

1 participant