Conversation
- Made argument names more verbose and readable - Made sure they are represented as camelCase in the codebase - Updated utils.ts to display arguments as `SNAKE_CASE`
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Added separate hook to apply camelCase to snake_case transformation - Simplified generate-doc to re-use `doc-template.md`
There was a problem hiding this comment.
Pull request overview
This PR standardizes positional argument identifiers across the CLI command sources to consistent camelCase, while ensuring the rendered help/readme placeholders remain readable as UPPER_SNAKE_CASE (via a camel→snake transform before oclif uppercases them).
Changes:
- Renames positional args across commands to consistent, more descriptive
camelCasekeys (e.g.,space_name→spaceName,room→roomName,serial→messageSerial). - Updates
CustomHelp(and a new init hook for doc generation) to render arg placeholders asUPPER_SNAKE_CASEin help/readme output. - Adjusts doc generation scaffolding and updates the affected Spaces unit test assertion.
Reviewed changes
Copilot reviewed 64 out of 64 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/unit/commands/spaces/spaces.test.ts | Updates help-output expectation (LOCK_ID). |
| src/hooks/init/patch-arg-names.ts | Adds init hook to patch arg names during GENERATING_DOC=true readme generation. |
| src/help.ts | Adds camelToSnake + temporary arg-name patching during formatCommand() to improve help placeholders. |
| src/commands/stats/app.ts | Renames id arg to appId and updates usage. |
| src/commands/spaces/subscribe.ts | Renames space_name to spaceName. |
| src/commands/spaces/occupancy/subscribe.ts | Renames space_name to spaceName + updates error context. |
| src/commands/spaces/occupancy/get.ts | Renames space_name to spaceName + updates error context. |
| src/commands/spaces/members/subscribe.ts | Renames space_name to spaceName. |
| src/commands/spaces/members/get.ts | Renames space_name to spaceName. |
| src/commands/spaces/members/enter.ts | Renames space_name to spaceName. |
| src/commands/spaces/locks/subscribe.ts | Renames space_name to spaceName. |
| src/commands/spaces/locks/get.ts | Renames space_name to spaceName. |
| src/commands/spaces/locks/acquire.ts | Renames space_name to spaceName. |
| src/commands/spaces/locations/subscribe.ts | Renames space_name to spaceName. |
| src/commands/spaces/locations/set.ts | Renames space_name to spaceName. |
| src/commands/spaces/locations/get.ts | Renames space_name to spaceName. |
| src/commands/spaces/get.ts | Renames space_name to spaceName. |
| src/commands/spaces/cursors/subscribe.ts | Renames space_name to spaceName. |
| src/commands/spaces/cursors/set.ts | Renames space_name to spaceName. |
| src/commands/spaces/cursors/get.ts | Renames space_name to spaceName. |
| src/commands/spaces/create.ts | Renames space_name to spaceName. |
| src/commands/rooms/typing/subscribe.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/typing/keystroke.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/reactions/subscribe.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/reactions/send.ts | Renames room to roomName. |
| src/commands/rooms/presence/subscribe.ts | Renames room to roomName. |
| src/commands/rooms/presence/get.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/presence/enter.ts | Renames room to roomName. |
| src/commands/rooms/occupancy/subscribe.ts | Renames room to roomName. |
| src/commands/rooms/occupancy/get.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/messages/update.ts | Renames room→roomName, serial→messageSerial throughout. |
| src/commands/rooms/messages/subscribe.ts | Renames rooms to roomNames for help/args key consistency. |
| src/commands/rooms/messages/send.ts | Renames room to roomName throughout. |
| src/commands/rooms/messages/reactions/subscribe.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/messages/reactions/send.ts | Renames room to roomName (local alias retained as room). |
| src/commands/rooms/messages/reactions/remove.ts | Renames room to roomName (local alias retained as room). |
| src/commands/rooms/messages/history.ts | Renames room to roomName + updates error context. |
| src/commands/rooms/messages/delete.ts | Renames room→roomName, serial→messageSerial throughout. |
| src/commands/push/devices/remove.ts | Renames "device-id" arg key to deviceId and updates access. |
| src/commands/push/devices/get.ts | Renames "device-id" arg key to deviceId and updates access. |
| src/commands/integrations/delete.ts | Renames integrationId to ruleId and updates API calls. |
| src/commands/channels/update.ts | Renames channel→channelName, serial→messageSerial throughout. |
| src/commands/channels/subscribe.ts | Renames channels to channelNames for help/args key consistency. |
| src/commands/channels/publish.ts | Renames channel to channelName throughout. |
| src/commands/channels/presence/subscribe.ts | Renames channel to channelName + updates error context. |
| src/commands/channels/presence/get.ts | Renames channel to channelName + updates error context. |
| src/commands/channels/presence/enter.ts | Renames channel to channelName + updates error context. |
| src/commands/channels/occupancy/subscribe.ts | Renames channel to channelName + updates error context. |
| src/commands/channels/occupancy/get.ts | Renames channel to channelName + updates error context. |
| src/commands/channels/inspect.ts | Renames channel to channelName (URL generation). |
| src/commands/channels/history.ts | Renames channel to channelName. |
| src/commands/channels/delete.ts | Renames channel→channelName, serial→messageSerial. |
| src/commands/channels/append.ts | Renames channel→channelName, serial→messageSerial. |
| src/commands/channels/annotations/subscribe.ts | Renames channel to channelName. |
| src/commands/channels/annotations/publish.ts | Renames channel→channelName, serial→messageSerial, type→annotationType. |
| src/commands/channels/annotations/get.ts | Renames channel→channelName, serial→messageSerial. |
| src/commands/channels/annotations/delete.ts | Renames channel→channelName, serial→messageSerial, type→annotationType. |
| src/commands/bench/subscriber.ts | Renames channel to channelName throughout. |
| src/commands/bench/publisher.ts | Renames channel to channelName throughout (including typed args). |
| src/commands/apps/update.ts | Renames id to appId throughout. |
| src/commands/accounts/switch.ts | Renames alias to accountAlias throughout. |
| src/commands/accounts/logout.ts | Renames alias to accountAlias throughout. |
| scripts/doc-template.md | Adds a reusable readme template skeleton for doc generation. |
| package.json | Updates generate-doc to use the template and registers the new init hook. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (const command of config.commands) { | ||
| for (const arg of Object.values(command.args)) { | ||
| arg.name = arg.name.replaceAll(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(); | ||
| } |
There was a problem hiding this comment.
The camelCase→snake_case transform here duplicates the camelToSnake() logic added in src/help.ts. To avoid divergence (e.g., if the regex ever needs to change to handle acronyms/edge cases), consider extracting a small shared helper (e.g., in src/utils/) and using it in both the init hook and CustomHelp.formatCommand().
WalkthroughThis PR standardizes positional argument names across all CLI commands, making them more descriptive ( Changes
Review Notes
|
There was a problem hiding this comment.
Review Summary
| File | Status | Notes |
|---|---|---|
src/help.ts |
OK | try/finally restore is correct |
src/hooks/init/patch-arg-names.ts |
Minor | Duplicates camelToSnake logic |
src/commands/**/*.ts (59 files) |
OK | Mechanical renames, all correct |
test/unit/commands/spaces/spaces.test.ts |
OK | LOCKID → LOCK_ID updated correctly |
One thing worth fixing
camelToSnake logic is duplicated across two files
The regex /([a-z])([A-Z])/g with .toLowerCase() appears as a named function in src/help.ts (line 13–15) and then repeated inline in src/hooks/init/patch-arg-names.ts (line 19). If the transform ever needs to change (e.g., to handle acronyms like appID), one place gets updated and the other doesn't — causing the --help body and the generated readme to silently diverge.
The hook could import camelToSnake from help.ts, or both could import from a small shared utility. Either way, one source of truth.
Everything else looks good
- The
try/finallypattern informatCommand()correctly restores arg names after oclif mutates them — no risk of the patched names leaking into subsequent calls. - The hook guards on
GENERATING_DOC !== "true"so it is a no-op in normal CLI usage — zero runtime cost per invocation. - Test coverage is sufficient: the bench test's
toContain("CHANNEL")still matches the newCHANNEL_NAMEoutput (substring match), and the spaces test was correctly updated toLOCK_ID. - No
this.error()calls, no JSON output contract issues, no flag architecture problems.
| export default class IntegrationsDeleteCommand extends ControlBaseCommand { | ||
| static args = { | ||
| integrationId: Args.string({ | ||
| ruleId: Args.string({ |
There was a problem hiding this comment.
In our documentation, rules refers to the conditions set on channel namespaces (forced client IDs etc). Integrations are things like Lambda, Kafka - which is what this command is doing.
I think the flag should therefore be integrationId everywhere.
There was a problem hiding this comment.
Sure, will update accordingly 👍
|
|
||
| for (const command of config.commands) { | ||
| for (const arg of Object.values(command.args)) { | ||
| arg.name = arg.name.replaceAll(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(); |
There was a problem hiding this comment.
Looks like this should be something shared somewhere seeing as we have it in help.ts too
There was a problem hiding this comment.
Okay, will update accordingly 👍
e53b975 to
895f41c
Compare
snake_casedisplay.camelToSnake transformin the custom help class to convertcamelCasearg names tosnake_casebefore oclif uppercases them. This also helps codebase to maintaincamelCaseargument naming across commands while keeping them verbose.--helpoutput display.Arguments
aliasaccountAliasACCOUNT_ALIASinstead ofACCOUNTALIASchannelchannelNameCHANNEL_NAMEchannelschannelNamesCHANNEL_NAMES"device-id"deviceIdDEVICE_IDidappIdAPP_IDruleIdintegrationIdINTEGRATION_IDroomroomNameROOM_NAMEroomsroomNamesROOM_NAMESserialmessageSerialMESSAGE_SERIALspace_namespaceNameSPACE_NAMEtypeannotationTypeANNOTATION_TYPESummary
ruleId, underscore likespace_name, and hyphenated likedevice-id) with a single camelCase convention in source code.camelToSnaketransform insrc/help.tsthat temporarily converts camelCase arg names to snake_case before oclif'sformatCommand()uppercases them, producing readableUPPER_SNAKE_CASEplaceholders in help output (e.g.,spaceName→SPACE_NAME,messageSerial→MESSAGE_SERIAL).id,serial, andchannelare nowappId,messageSerial, andchannelName, making help output clearer without needing to read descriptions.