Open stalinkay opened 1 year ago
I have the same
Stale issue message
Same. Install new NextJS project -> https://nextjs.org/learn-pages-router/basics/create-nextjs-app/setup Install @commitlint/load - npm install --save-dev @commitlint/load Add commitlint config .commitlintrc.yml run oco
And another question, why @commitlint whats a @commitlint/load?
Stale issue message
Same here
Has anyone found a workaround? I'm digging now to see if i can resolve and make a PR.
It looks like the returned prompt is coming back from GPT with preceding text which is causing the naive JSON.parse to fail.
Here is the JSON output for the commit messages:
```json
{
"localLanguage": "english",
"commitFix": "utils(server): Change 'port' variable to uppercase",
"commitFeat": "utils(server): Allow server to listen on env variable port",
"commitDescription": "Changed 'port' variable to uppercase for consistency. Added feature to allow server to listen on a port specified through the environment variable."
}
│ └ ✖ SyntaxError: Unexpected token 'H', "Here is th"... is not valid JSON
I've submitted a PR to fix this here https://github.com/di-sukharev/opencommit/pull/297
Note you can hack this fix in your node_modules
by copying and pasting it into node_modules/opencommit/out/cli.js
just to generate the file once, from that point you will have it cached.
add to line 21980
const jsonIndex = consistency.search('```json');
if(jsonIndex > -1) {
consistency = consistency.slice(jsonIndex + 8);
const endJsonIndex = consistency.search('```');
consistency = consistency.slice(0, endJsonIndex);
}
right after
const prompts = inferPromptsFromCommitlintConfig(commitLintConfig);
const consistencyPrompts = commitlintPrompts.GEN_COMMITLINT_CONSISTENCY_PROMPT(prompts);
let consistency = await api.generateCommitMessage(consistencyPrompts) || "{}";
thank you, i will get to it, thanks, prob next week, very tight schedule
On Fri, Feb 16, 2024 at 5:34 AM Jack Lukic @.***> wrote:
I've submitted a PR to fix this here
297 https://github.com/di-sukharev/opencommit/pull/297
Note you can hack this fix in your node_modules by copying and pasting into node_modules/opencommit/out/cli.js just to generate the file once, from that point you will have it cached.
— Reply to this email directly, view it on GitHub https://github.com/di-sukharev/opencommit/issues/261#issuecomment-1947375712, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANWS3DEHB6UDU3NDV2RZB33YTZ5NHAVCNFSM6AAAAAA5DU4LQGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXGM3TKNZRGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
oco
┌ open-commit
│
◇ 3 staged files:
db/models/init.py
db/models/currency.py
db/models/invoice.py
│
○ Generating the commit message
│
◇ ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ OCO_PROMPT_MODULE is @commitlint but you haven't generated consistency for this project yet. │
│ │
├────────────────────────────────────────────────────────────────────────────────────────────────╯
│
◇ 📝 Commit message generated
│
└ ✖ Cannot find module 'app\node_modules\@commitlint\load'
Require stack:
Opencommit Version
3.0.4
Node Version
18.8.0
NPM Version
9.8.1
What OS are you seeing the problem on?
Mac
What happened?
Instead of generating the commit, it outputs an error related to an
Unexpected token in JSON
.Expected Behavior
It should create the commit.
Current Behavior
It appears that instead of returning valid JSON. The OpenAI API is outputting additional explanatory text which is not needed.
Possible Solution
To ensure valid JSON is output when using @commitlint
Steps to Reproduce
Enable @commitlint Run
oco
Relevant log output