-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(server): add read doc tool #12811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ai-editable-markdown-format
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## ai-editable-markdown-format #12811 +/- ##
===============================================================
+ Coverage 55.67% 55.88% +0.21%
===============================================================
Files 2658 2659 +1
Lines 126088 126190 +102
Branches 19973 20032 +59
===============================================================
+ Hits 70197 70521 +324
+ Misses 53630 53321 -309
- Partials 2261 2348 +87
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
03e15d8
to
dd21429
Compare
d1416e6
to
6c7ec97
Compare
e9acb88
to
416d507
Compare
6c7ec97
to
729c8e8
Compare
416d507
to
4dd7854
Compare
729c8e8
to
a5f73b9
Compare
4dd7854
to
9d6ee14
Compare
a5f73b9
to
9541597
Compare
9d6ee14
to
016adc0
Compare
9541597
to
1ba4569
Compare
016adc0
to
a9e4dd0
Compare
1ba4569
to
a186b28
Compare
e4d26eb
to
541a2cc
Compare
df48490
to
3893e0e
Compare
3893e0e
to
4a34a09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new Copilot tool for reading document content directly within the workspace.
- Introduces
doc-read
tool implementation intools/doc-read.ts
- Integrates the new tool into Copilot’s utilities and provider setup
- Exposes the tool in the tools index for discovery
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
packages/backend/server/src/plugins/copilot/tools/index.ts | Export new doc-read tool |
packages/backend/server/src/plugins/copilot/tools/doc-read.ts | Add buildDocContentGetter and createDocReadTool |
packages/backend/server/src/plugins/copilot/providers/utils.ts | Import and register doc_read in CustomAITools |
packages/backend/server/src/plugins/copilot/providers/provider.ts | Wire up docRead in provider switch |
Comments suppressed due to low confidence (2)
packages/backend/server/src/plugins/copilot/tools/doc-read.ts:1
- No tests were added for the new doc-read tool. Consider adding unit tests for both
buildDocContentGetter
(authorized, unauthorized, missing doc) andcreateDocReadTool
(successful read, error handling).
import { Logger } from '@nestjs/common';
packages/backend/server/src/plugins/copilot/tools/doc-read.ts:12
- Add JSDoc or comments to explain
buildDocContentGetter
parameters and return value so future maintainers understand its contract and side effects.
export const buildDocContentGetter = (
...content, | ||
...docMeta, | ||
}; | ||
}; | ||
return getDoc; | ||
}; | ||
|
||
export const createDocReadTool = ( | ||
getDoc: (targetId?: string) => Promise<object | undefined> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool's return type is currently object | undefined
. Defining a specific interface for the doc payload (e.g. DocReadResult
) will improve type safety and clarity.
...content, | |
...docMeta, | |
}; | |
}; | |
return getDoc; | |
}; | |
export const createDocReadTool = ( | |
getDoc: (targetId?: string) => Promise<object | undefined> | |
createdAt: docMeta.createdAt, | |
updatedAt: docMeta.updatedAt, | |
createdByUser: docMeta.createdByUser, | |
updatedByUser: docMeta.updatedByUser, | |
markdownContent: content, | |
}; | |
}; | |
return getDoc; | |
}; | |
export const createDocReadTool = ( | |
getDoc: (targetId?: string) => Promise<DocReadResult | undefined> |
Copilot uses AI. Check for mistakes.
@@ -10,6 +10,7 @@ import { | |||
import { ZodType } from 'zod'; | |||
|
|||
import { | |||
createDocReadTool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider grouping and ordering imports alphabetically (or per project style) to keep the import block organized as more tools are added.
Copilot uses AI. Check for mistakes.
close AI-186
PR Dependency Tree
This tree was auto-generated by Charcoal