Uh oh!
There was an error while loading. Please reload this page.
fix(docs): resolve missing tool outputs for spread-inherited V2 tools - #4020
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryLow Risk Overview Refactors Reviewed by Cursor Bugbot for commit 785d9fe. Configure here. |
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 7, 2026
waleedlatif1
commented
Apr 7, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
Greptile SummaryThis PR fixes a bug in The fix adds a fallback path — when no outputs are found, the script reconstructs the full enclosing export block (using a global regex to find the last Additional refactoring:
One minor inconsistency: two inline brace-matching loops in Confidence Score: 5/5Safe to merge — the fix is correct, well-scoped to a docs generation script with no app runtime impact, and the regenerated MDX files show the previously-missing outputs. All findings are P2 style/consistency issues. The core V2 spread-inheritance fix is sound: the global-regex approach correctly identifies the last enclosing export declaration before the id: field, findMatchingClose is properly used with absolute file offsets, and baseToolRegex applies a word-boundary lookahead to avoid false matches. The two remaining inline brace-matching loops are a minor consistency issue but do not affect correctness. scripts/generate-docs.ts — two inline brace-matching loops in parseConstFieldContent and parseFieldContent were not refactored to use findMatchingClose Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[getToolInfo
calls extractToolInfo] --> B[Narrow toolContent
find export block around id:]
B --> C[extractOutputsFromToolContent
on narrowed toolContent]
C --> D{Outputs
found?}
D -- Yes --> G[Return outputs]
D -- No --> E[Reconstruct fullToolBlock
find last 'export const = {'
in beforeId via global regex]
E --> F[Search for spread:
...\w+Tool|Base\w*]
F --> H{Spread
found?}
H -- No --> I[Return empty]
H -- Yes --> J[Locate base tool
export const baseVarName = {]
J --> K[extractOutputsFromToolContent
on base tool block]
K --> G
Reviews (2): Last reviewed commit: "fix(docs): remove unnecessary case-insen..." | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
waleedlatif1
commented
Apr 7, 2026
waleedlatif1
commented
Apr 7, 2026
@cursor review |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 785d9fe. Configure here.
| const endIdx = findMatchingClose(fileContent, baseStart) | ||
| if (endIdx !== -1) { | ||
| const baseToolContent = fileContent.substring(baseStart, endIdx) | ||
| outputs = extractOutputsFromToolContent(baseToolContent, toolPrefix) |
There was a problem hiding this comment.
Spread inheritance overrides explicitly empty outputs
Low Severity
The spread inheritance fallback checks Object.keys(outputs).length === 0 to decide whether to look up a base tool's outputs. This can't distinguish between "no outputs key found" and "tool explicitly declared outputs: {}". If a V2 tool intentionally overrides outputs to be empty (e.g., ...baseTool, outputs: {}), the code would incorrectly inherit the base tool's outputs, generating wrong documentation for that tool.
Reviewed by Cursor Bugbot for commit 785d9fe. Configure here.


Summary
generate-docs.tsto resolve outputs for V2 tools that inherit via spread syntax (e.g.,...extendParserTool)findMatchingClosehelper replacing ~26 inline brace-matching loops (-98 net lines)extractOutputsFromToolContenthelper consolidating duplicated output extraction patternsType of Change
Testing
Ran
generate-docs.tsand verified all 186 docs generate successfully with correct outputs. Diffed before/after refactor to confirm behavior preservation.Checklist