From d7ec2220a142bf70e5ad96cafe0d2a201518a327 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 2 Dec 2025 12:17:10 +0000 Subject: [PATCH] feat(diff-processor): Improve diff sampling and file prioritization: increase inclusion thresholds, expand sampled context, and boost priority for interface/type and entry-point files --- changelog.md | 8 ++++++++ ts/00_commitinfo_data.ts | 2 +- ts/aidocs_classes/commit.ts | 8 ++++---- ts/context/diff-processor.ts | 16 ++++++++++++++-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 5c437f4..bf86ed4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2025-12-02 - 1.10.0 - feat(diff-processor) +Improve diff sampling and file prioritization: increase inclusion thresholds, expand sampled context, and boost priority for interface/type and entry-point files + +- Raise small/medium file thresholds used by DiffProcessor (smallFileLines 50 -> 300, mediumFileLines 200 -> 800) so more source files are included fully or summarized rather than treated as large metadata-only files +- Increase sample window for medium files (sampleHeadLines/sampleTailLines 20 -> 75) to provide more context when summarizing diffs +- Boost importance scoring for interfaces/type files and entry points (adds +20 for interfaces/.types and +15 for index/mod entry files) to prioritize critical API surface in diff processing +- Keep other prioritization rules intact (source/test/config/docs/build heuristics), and align the aidoc commit DiffProcessor usage with the new defaults + ## 2025-11-04 - 1.9.2 - fix(deps) Update dependencies and devDependencies to newer versions (bump multiple packages) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 85617ca..8f95f4a 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tsdoc', - version: '1.9.2', + version: '1.10.0', description: 'A comprehensive TypeScript documentation tool that leverages AI to generate and enhance project documentation, including dynamic README creation, API docs via TypeDoc, and smart commit message generation.' } diff --git a/ts/aidocs_classes/commit.ts b/ts/aidocs_classes/commit.ts index 59bde64..3ed70ce 100644 --- a/ts/aidocs_classes/commit.ts +++ b/ts/aidocs_classes/commit.ts @@ -92,10 +92,10 @@ export class Commit { // Use DiffProcessor to intelligently handle large diffs const diffProcessor = new DiffProcessor({ maxDiffTokens: 100000, // Reserve 100k tokens for diffs - smallFileLines: 50, // Include files <= 50 lines fully - mediumFileLines: 200, // Summarize files <= 200 lines - sampleHeadLines: 20, // Show first 20 lines - sampleTailLines: 20, // Show last 20 lines + smallFileLines: 300, // Most source files are under 300 lines + mediumFileLines: 800, // Only very large files get head/tail treatment + sampleHeadLines: 75, // When sampling, show more context + sampleTailLines: 75, // When sampling, show more context }); const processedDiff = diffProcessor.processDiffs(diffStringArray); diff --git a/ts/context/diff-processor.ts b/ts/context/diff-processor.ts index 7d37d64..477d890 100644 --- a/ts/context/diff-processor.ts +++ b/ts/context/diff-processor.ts @@ -239,8 +239,20 @@ export class DiffProcessor { return 10; } - // Everything else - default priority - return 50; + // Start with default priority + let score = 50; + + // Boost interface/type files - they're usually small but critical + if (filepath.includes('interfaces/') || filepath.includes('.types.')) { + score += 20; + } + + // Boost entry points + if (filepath.endsWith('index.ts') || filepath.endsWith('mod.ts')) { + score += 15; + } + + return score; } /**