ai-cmg 0.0.4 → 0.0.5

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/dist/index.js +16 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ const LOCK_FILES = new Set([
23
23
  const GENERATED_PREFIXES = ['dist/', 'build/', '.next/', 'coverage/', 'node_modules/'];
24
24
  const MAX_BLOCK_LINES = 400;
25
25
  const MAX_BLOCK_CHARS = 20000;
26
+ const MAX_INPUT_CHARS = 200000;
26
27
  function getPackageVersion() {
27
28
  try {
28
29
  const currentFile = fileURLToPath(import.meta.url);
@@ -285,6 +286,16 @@ function summarizeDiff(diff) {
285
286
  : '';
286
287
  return `${summaryHeader}${keptBlocks.join('\n')}`.trim();
287
288
  }
289
+ function limitDiffSize(diff) {
290
+ if (diff.length <= MAX_INPUT_CHARS) {
291
+ return { diff, truncated: false };
292
+ }
293
+ const trimmed = diff.slice(0, MAX_INPUT_CHARS);
294
+ return {
295
+ diff: `${trimmed}\n\n# diff truncated due to size limit\n`,
296
+ truncated: true
297
+ };
298
+ }
288
299
  async function main() {
289
300
  // 1. 사용자 힌트(Arguments) 가져오기
290
301
  const rawArgs = process.argv.slice(2);
@@ -347,7 +358,11 @@ async function main() {
347
358
  return;
348
359
  }
349
360
  }
350
- const filteredDiff = summarizeDiff(diff);
361
+ const summarizedDiff = summarizeDiff(diff);
362
+ const { diff: filteredDiff, truncated } = limitDiffSize(summarizedDiff);
363
+ if (truncated) {
364
+ console.log(`Diff truncated to ${MAX_INPUT_CHARS} characters.`);
365
+ }
351
366
  // 4. API 요청 (Diff + Hint + Auth)
352
367
  const response = await fetch(getWorkerUrl(), {
353
368
  method: 'POST',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-cmg",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "AI Commit Message Generator",
5
5
  "type": "module",
6
6
  "bin": {