neuro-commit 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/commit.js +46 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neuro-commit",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "neuro-commit CLI utility",
5
5
  "author": "cr1ma.dev",
6
6
  "bin": {
package/src/commit.js CHANGED
@@ -22,12 +22,50 @@ const CYAN = "\x1b[36m";
22
22
  const OUTPUT_FILE = "neuro-commit.md";
23
23
  const encoder = get_encoding("o200k_base");
24
24
 
25
+ // AI Prompt that will be added at the beginning of the generated file
26
+ const AI_PROMPT = `You are an expert in writing commit messages for repositories. Your task is to write me a commit message based on my diff file, which I will provide to you.
27
+
28
+ ### Rules for writing a commit message:
29
+
30
+ 1. Write in English, strictly considering the context.
31
+ 2. Return the answer using markdown formatting.
32
+ 3. Use the imperative mood, as if you are giving a command to the system that corresponds to messages that create changes in the code.
33
+ 4. The first line of the message (title) should be short, usually no longer than 50 characters. This makes it easier to quickly understand the changes. Do not end the title with a period.
34
+ 5. Leave one empty line after the title before starting the body of the message. This separation helps Git tools to correctly display the message text.
35
+ 6. Commits with messages like "Fix" or "Update" do not provide useful information. Always explain what exactly was fixed or updated.
36
+ 7. **Use lowercase letters to describe change types. Use** semantic tags in message titles:
37
+ - \`feat:\` — adding a new feature
38
+ - \`fix:\` — bug fixes
39
+ - \`docs:\` — changes in documentation
40
+ - \`style:\` — changes that do not affect the code (e.g., formatting fixes)
41
+ - \`refactor:\` — code change that doesn't add new functionality or fix bugs
42
+ - \`test:\` — adding or changing tests
43
+
44
+ ### Example of a correct commit message:
45
+
46
+ \`\`\`diff
47
+ refactor: update environment configuration and API connection
48
+
49
+ - Edited \`.env\` file to support different environments (production, development) and API connection modes (docker, local, remote).
50
+ - Updated \`config.py\` to load tokens and URLs depending on the environment and API mode.
51
+ - Removed logic for determining the operating system.
52
+ - Updated \`api_client.py\` to use BASE_API_URL instead of OS-specific URLs.
53
+ - Reduced the number of retries in \`_make_request\`.
54
+ \`\`\`
55
+
56
+ ---
57
+
58
+ `;
59
+
25
60
  /**
26
61
  * Build the markdown content for neuro-commit.md
27
62
  */
28
63
  function buildMarkdown(stagedFiles, diff, numstat) {
29
64
  const lines = [];
30
65
 
66
+ // Start with the AI prompt
67
+ lines.push(AI_PROMPT);
68
+
31
69
  const lockFiles = stagedFiles.filter((f) => isLockFile(f.file));
32
70
  const regularFiles = stagedFiles.filter((f) => !isLockFile(f.file));
33
71
 
@@ -104,6 +142,14 @@ function printSummary(files, content, outputFile) {
104
142
  `${CYAN}✓${RESET} Generated ${BOLD}${outputFile}${RESET} ${DIM}(${formatNumber(totalFiles)} files, ${formatNumber(totalTokens)} tokens, ${formatNumber(totalChars)} chars)${RESET}`,
105
143
  );
106
144
  console.log("");
145
+ console.log(`${BOLD}Next steps:${RESET}`);
146
+ console.log(` 1. Open ${CYAN}${outputFile}${RESET}`);
147
+ console.log(
148
+ ` 2. Copy the ${BOLD}entire content${RESET} (AI prompt is already included!)`,
149
+ );
150
+ console.log(` 3. Paste into your LLM (ChatGPT, Claude, etc.)`);
151
+ console.log(` 4. Get your perfect commit message! 🎉`);
152
+ console.log("");
107
153
  }
108
154
 
109
155
  /**