gitpt 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const userPrompt = "\nGenerate a pull request title and description for the following changes:\n\nFormat your response exactly like this example:\nTitle: Add user authentication with JWT\nDescription: \n## Summary\nThis PR adds user authentication using JWT tokens.\n\n## Changes\n- Implement login and registration endpoints\n- Add JWT generation and validation\n- Update user model with password hashing\n- Add authorization middleware\n\n## How to test\n1. Register a new user with `/api/register`\n2. Login with the new user credentials\n3. Use the returned token to access protected endpoints\n";
1
+ export declare const userPrompt: (context: string) => string;
@@ -1,6 +1,8 @@
1
- export const userPrompt = `
1
+ export const userPrompt = (context) => `
2
2
  Generate a pull request title and description for the following changes:
3
3
 
4
+ ${context}
5
+
4
6
  Format your response exactly like this example:
5
7
  Title: Add user authentication with JWT
6
8
  Description:
@@ -7,7 +7,7 @@ import { getPRContext } from "./getPRContext.js";
7
7
  export const generatePRDetails = async () => {
8
8
  const { model } = getConfig();
9
9
  const context = getPRContext().join("\n\n");
10
- const userPromptWithContext = [userPrompt, context].join("\n\n");
10
+ const userPromptWithContext = userPrompt(context);
11
11
  const llmClient = getLLMClient();
12
12
  try {
13
13
  const response = await llmClient.chat.completions.create({
package/dist/llm/index.js CHANGED
@@ -4,9 +4,9 @@ import { formatBaseURL } from "../utils/formatBaseURL.js";
4
4
  export const OPENROUTER_API_URL = "https://openrouter.ai/api/v1";
5
5
  export const getLLMClient = (options) => {
6
6
  const { baseURLOverride } = options || {};
7
- const { apiKey, customLLMEndpoint } = getConfig();
8
- const baseURL = formatBaseURL(baseURLOverride ?? customLLMEndpoint ?? OPENROUTER_API_URL);
9
- console.log({ baseURL });
7
+ const { apiKey, customLLMEndpoint, provider } = getConfig();
8
+ const localLLMEndpoint = provider === "local" ? customLLMEndpoint : undefined;
9
+ const baseURL = formatBaseURL(baseURLOverride ?? localLLMEndpoint ?? OPENROUTER_API_URL);
10
10
  return new openai.OpenAI({
11
11
  apiKey,
12
12
  baseURL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitpt",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "CLI tool that helps you write commit messages & pull request descriptions using AI",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",