Skip to content
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

Allow for commit prefix #160

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(api.ts): improve readability by adding a space between prefi…
…x and message content

fix(config.ts): fix config validation for prefix to allow non-empty values
  • Loading branch information
amitayk committed May 4, 2023
commit 098db008f297d07521008bd60d9593d69406cc65
2 changes: 1 addition & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ class OpenAi {

const prefix = generatePrefix();

const finalMessage = (prefix || '') + (message?.content || '');
const finalMessage = (prefix ? prefix + ' ' : '') + (message?.content || '')

return finalMessage;
} catch (error: unknown) {
2 changes: 1 addition & 1 deletion src/commands/config.ts
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ export const configValidators = {
[CONFIG_KEYS.prefix](value: any) {
validateConfig(
CONFIG_KEYS.prefix,
value,
true,
Copy link
Owner

Choose a reason for hiding this comment

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

true is not validating anything here :) we should validate the config input with a function or expression which return Boolean

Copy link
Author

Choose a reason for hiding this comment

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

@di-sukharev Do you have an idea what can we validate?

Copy link
Owner

Choose a reason for hiding this comment

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

you somehow need to confirm that the value is the exact format you expect, if your format is ^(*) and not /^(*)/ — make sure you don't have /s in the value, you may also do multiple validations like !a && b && !c

'Cannot be empty'
);
return value;