feat(ai-index): add configurable generation options#46
Conversation
|
@KimHyeongRae0 is attempting to deploy a commit to the Cytonic Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds two configurable options —
Confidence Score: 5/5The change is well-scoped and safe to merge. The new configuration fields are resolved with ??-safe defaults, threaded correctly through both generation paths, and validated with appropriate warnings. All test fixtures compile, new tests exercise the key scenarios, and the documentation accurately describes the soft-limit behaviour. No functional regressions were found in the changed code paths. No files require special attention; the one minor gap is a missing negative-value assertion in the maxKeywords test in src/core/utils.test.ts. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["AeoConfig"] -->|"resolveConfig (??defaults 2000/10)"| B["ResolvedAeoConfig"]
A -->|"validateConfig (warns if <= 0)"| W["warnings[]"]
B --> G["generateAIIndex(config)"]
G --> P["pages loop"]
G --> C["collectAIIndexEntries (contentDir)"]
P --> CC["chunkContent(content, maxChunkLength)"]
P --> EK["extractKeywords(content, maxKeywords)"]
C --> CC2["chunkContent(mainContent, maxChunkLength)"]
C --> EK2["extractKeywords(mainContent, maxKeywords)"]
CC --> E["AIIndexEntry[]"]
EK --> E
CC2 --> E
EK2 --> E
E --> D["deduplicate + sort"]
D --> J["ai-index.json"]
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/core/utils.test.ts:94-98
The test description says "warns when aiIndex.maxKeywords is zero or negative", but only the zero case is exercised. The parallel `maxChunkLength` test covers both `0` and `-1`; `maxKeywords` should do the same to match the description and stay consistent.
```suggestion
it('warns when aiIndex.maxKeywords is zero or negative', () => {
expect(validateConfig({ aiIndex: { maxKeywords: 0 } })).toEqual(
expect.arrayContaining([expect.stringContaining('aiIndex.maxKeywords')])
);
expect(validateConfig({ aiIndex: { maxKeywords: -1 } })).toEqual(
expect.arrayContaining([expect.stringContaining('aiIndex.maxKeywords')])
);
});
```
Reviews (4): Last reviewed commit: "chore(ai-index): address Greptile P2 nit..." | Re-trigger Greptile |
|
Thanks @KimHyeongRae0 — this is clean. The implementation matches the spec exactly: Greptile passed and flagged only two non-blocking P2s:
Both are nice-to-haves, not merge blockers. Happy to either:
Your call. Closes #32 either way. |
1. validateConfig now warns when aiIndex.maxChunkLength or maxKeywords is ≤ 0 (mirrors the existing warning pattern for negative crawlDelay). Sub-1 values still produce sensible behavior at runtime — the warning surfaces typos instead of letting them silently produce odd output. 2. configuration.mdx maxChunkLength description now explicitly calls out that it's a soft limit (chunks split on paragraph boundaries, so a single long paragraph can exceed the value). Avoids the "hard cap" reading. Added 4 validateConfig tests covering the new warnings + omission cases. 176 tests pass; typecheck clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Applied both Greptile P2 nits directly: @greptileai re-review please. |
|
Thanks for folding those in. |
Implements the approved ai-index configuration options from #32.
Changes:
aiIndex.maxChunkLengthandaiIndex.maxKeywordsto config types and resolved defaults.Validation:
npm run test -- --run src/core/ai-index.test.ts src/core/utils.test.tsnpx tsc --noEmitnpm run test -- --runnpm run buildgit diff --checkCloses #32