-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Actions parity in TS SDK #991
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to e899b48 in 40 seconds
More details
- Looked at
86
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/cli/actions.ts:41
- Draft comment:
ThegetOpenAPIClient
function is called but its return value is not used. Ensure this is intentional and necessary. - Reason this comment was not posted:
Confidence changes required:50%
ThegetOpenAPIClient
function is called but its return value is not used. Ensure this is intentional.
Workflow ID: wflow_jlNwzS25TxTsbnpo
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
js/src/cli/actions.ts
Outdated
}): Promise<void> { | ||
getOpenAPIClient(); | ||
const { apps = [], tags = [], useCase, limit, enabled } = options; | ||
if (apps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check if (apps)
is unnecessary because apps
is always initialized as an empty array. Consider removing this check.
js/src/cli/actions.ts
Outdated
(value, previous: string[]) => previous.concat([value]), | ||
[] | ||
) | ||
.option("--use-case", "Search for actions based on the given use case") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --use-case
option is defined but not used in the command options. Consider adding <useCase>
to the option definition to accept a value.
js/src/cli/actions.ts
Outdated
useCase?: string; | ||
limit?: number; | ||
enabled?: boolean; | ||
copy?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copy
option is defined but not used. Consider removing it if it's not needed.
This comment was generated by github-actions[bot]! JS SDK Coverage Report📊 Coverage report for JS SDK can be found at the following URL: 📁 Test report folder can be found at the following URL: |
js/src/cli/actions.ts
Outdated
.option("--use-case", "Search for actions based on the given use case") | ||
.option("--limit <limit>", "Limit the number of actions to display") | ||
.option("--enabled", "Only show enabled actions") | ||
.option("--copy", "Copy the action to the clipboard") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The copy
option is defined in the command options (line 30) but not used in the handleAction
method. Either implement the copy functionality or remove the unused option.
js/src/cli/actions.ts
Outdated
const data: ListActionsV2Data = { | ||
query: {}, | ||
}; | ||
if (data?.query) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if (data?.query)
check is redundant since we just created the data object with a query property. Consider simplifying this by directly setting the query parameters.
js/src/cli/actions.ts
Outdated
if (tags) { | ||
data.query.tags = tags.join(","); | ||
} | ||
if (limit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding validation for the limit
parameter to ensure it's a positive number. Currently, negative or zero values could cause unexpected behavior.
js/src/cli/actions.ts
Outdated
const actions = response.data?.items || []; | ||
actions.forEach((action) => console.log(action.name)); | ||
} catch (error) { | ||
console.log(chalk.red((error as any).message)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error type casting to any
is not type-safe. Consider creating a proper error interface or using a more specific error type from the SDK.
Code Review SummaryOverall, the implementation is well-structured and follows the existing patterns in the codebase. Here are the key points: Strengths:✅ Good use of TypeScript and Commander.js for CLI implementation Areas for Improvement:
Suggestions for Enhancement:
The code is functional and maintainable, but implementing the suggested improvements would make it more robust and easier to maintain. Rating: 7/10 - Good implementation with room for minor improvements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on afb4e26 in 12 seconds
More details
- Looked at
21
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/cli/actions.ts:36
- Draft comment:
Thecopy
option is removed from thehandleAction
method's parameter type but not from the method's logic. Ensure that the logic does not rely on acopy
parameter. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_lIC6kga4iemlDdiF
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 1ccdf0d in 12 seconds
More details
- Looked at
12
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/cli/actions.ts:6
- Draft comment:
The removal ofAxiosError
import is appropriate as it is not used in the code. - Reason this comment was not posted:
Confidence changes required:0%
The import statement forAxiosError
is removed, but there is no usage ofAxiosError
in the code, so this change is valid and does not require any action.
Workflow ID: wflow_i0Nddm5MUoaWqmws
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 1196135 in 28 seconds
More details
- Looked at
23
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. js/src/cli/actions.ts:45
- Draft comment:
The check forapps.length === 0
is redundant becauseapps
is always initialized as an empty array if not provided. Consider removing this check. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The check forapps.length === 0
is not redundant in the context of user interaction. It ensures that the user is prompted to provide at least one app name, which is a necessary validation step. The comment misunderstands the purpose of the check, which is not about initialization but about user input validation.
I might be missing the perspective that the comment is focusing on code efficiency rather than user interaction. However, the user interaction aspect is crucial here.
Even if the comment is focusing on code efficiency, the user interaction and validation aspect is more important in this context, making the check necessary.
The comment should be deleted because the check forapps.length === 0
is necessary for user input validation and is not redundant.
Workflow ID: wflow_tm51GPYcfEto21c6
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 8d890c9 in 34 seconds
More details
- Looked at
81
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. js/src/cli/actions.ts:56
- Draft comment:
Consider validating the--limit
option to ensure it is a number. This can prevent unexpected behavior if a non-numeric value is provided. - Reason this comment was not posted:
Comment was on unchanged code.
2. js/src/cli/actions.ts:70
- Draft comment:
Consider adding a check to ensureresponse.data
is defined before accessingresponse.data.items
. This can prevent potential runtime errors. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_QUkNcKHn0lJ08eS2
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
js/src/cli/actions.ts
Outdated
const data: ListActionsV2Data = { | ||
query: {}, | ||
}; | ||
if (data?.query) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if (data?.query)
check is redundant since query
is initialized on line 50. Consider removing this check as it will always be true.
js/src/cli/actions.ts
Outdated
query: {}, | ||
}; | ||
if (data?.query) { | ||
if (tags) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The if (tags)
check is redundant since tags
is defaulted to an empty array in the destructuring. Consider removing this check and simplifying the logic.
js/src/cli/actions.ts
Outdated
if (tags) { | ||
data.query.tags = tags.join(","); | ||
} | ||
if (limit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding validation for the limit
parameter to ensure it's a positive number. This would prevent potential API errors from invalid input.
console.log(""); | ||
// render list | ||
const actions = response.data?.items || []; | ||
actions.forEach((action) => console.log(action.name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider enhancing the action list output to include more useful information like displayName
and enabled
status. Current output only shows the action name.
js/src/cli/actions.ts
Outdated
// render list | ||
const actions = response.data?.items || []; | ||
actions.forEach((action) => console.log(action.name)); | ||
} catch (error: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a more specific type than any
for the error. You could create a custom error type or use unknown
if the error structure is not known.
Code Review SummaryOverall, the implementation provides a solid foundation for the Actions CLI command with good TypeScript integration and error handling. Here are the key points: Strengths:✅ Well-structured TypeScript implementation Suggested Improvements:
The changes look good to merge after addressing these minor improvements. The code is functional and follows the project's patterns. Rating: 7/10 - Solid implementation with room for minor improvements in type safety and user experience. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 02c31ec in 17 seconds
More details
- Looked at
30
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. js/src/cli/actions.ts:48
- Draft comment:
Consider usingimport * as chalk from "chalk";
to ensure type safety and avoid potential runtime errors. - Reason this comment was not posted:
Confidence changes required:50%
The code useschalk
for colored output, but it doesn't importchalk
in a type-safe way. This can lead to runtime errors if the import fails or ifchalk
is not installed.
2. js/src/cli/actions.ts:69
- Draft comment:
Consider logging the error stack or additional context to aid in debugging. For example,console.error(chalk.red('Error fetching actions:'), error);
- Reason this comment was not posted:
Confidence changes required:50%
The error handling in the catch block is not specific. It logs the error message but does not provide any context or stack trace, which can be useful for debugging.
Workflow ID: wflow_7YMncs3slpGo4fRK
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 1c6cb24 in 11 seconds
More details
- Looked at
22
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_kt5DWYc1nO0udfxG
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 0a30bf7 in 11 seconds
More details
- Looked at
16
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. .github/workflows/common.yml:7
- Draft comment:
Removing the 'paths' filter for 'push' and 'pull_request' events will trigger the workflow for all changes, not just those in 'python/**'. Consider if this is the intended behavior. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_XGhBnxPVDtRqtF4s
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Adds
ActionCommand
to handle CLI action commands with filtering options and integrates it into the CLI.ActionCommand
class inactions.ts
for CLI action commands with options:--apps
,--tags
,--use-case
,--limit
,--enabled
.handleAction()
to fetch and display actions usingclient.actionsV2.listActionsV2()
.chalk
for colored output.actions
command to CLI inindex.ts
.eslint
max warnings from 281 to 261 inpackage.json
.This description was created by for 0a30bf7. It will automatically update as commits are pushed.