-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Move rule-to-slash-command conversion from YAML loading to config loading #7871
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
base: main
Are you sure you want to change the base?
Conversation
|
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.
1 issue found across 2 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="core/config/profile/doLoadConfig.ts">
<violation number="1" location="core/config/profile/doLoadConfig.ts:164">
Potential silent no-op: using optional chaining when pushing to slashCommands can drop converted commands if the array is undefined. Initialize the array before pushing to ensure consistency with later code that assumes it exists.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
if (rule.invokable) { | ||
try { | ||
const slashCommand = convertRuleBlockToSlashCommand(rule); | ||
newConfig.slashCommands?.push(slashCommand); |
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.
Potential silent no-op: using optional chaining when pushing to slashCommands can drop converted commands if the array is undefined. Initialize the array before pushing to ensure consistency with later code that assumes it exists.
Prompt for AI agents
Address the following comment on core/config/profile/doLoadConfig.ts at line 164:
<comment>Potential silent no-op: using optional chaining when pushing to slashCommands can drop converted commands if the array is undefined. Initialize the array before pushing to ensure consistency with later code that assumes it exists.</comment>
<file context>
@@ -155,6 +156,21 @@ export default async function doLoadConfig(options: {
+ if (rule.invokable) {
+ try {
+ const slashCommand = convertRuleBlockToSlashCommand(rule);
+ newConfig.slashCommands?.push(slashCommand);
+ } catch (e) {
+ errors.push({
</file context>
newConfig.slashCommands?.push(slashCommand); | |
(newConfig.slashCommands ??= []).push(slashCommand); |
Summary by cubic
Moved conversion of invokable rules to slash commands from YAML parsing to config loading. This centralizes the logic and ensures all rules in the final merged config are converted consistently.