Skip to content

Commit 7761b16

Browse files
authored
feat(tools): added greptile tools/block, updated copilot panel styling (#2618)
1 parent 71130c8 commit 7761b16

File tree

16 files changed

+1062
-28
lines changed

16 files changed

+1062
-28
lines changed

apps/docs/components/icons.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4344,3 +4344,16 @@ export function CirclebackIcon(props: SVGProps<SVGSVGElement>) {
43444344
</svg>
43454345
)
43464346
}
4347+
4348+
export function GreptileIcon(props: SVGProps<SVGSVGElement>) {
4349+
return (
4350+
<svg {...props} viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'>
4351+
<path
4352+
clipRule='evenodd'
4353+
fillRule='evenodd'
4354+
fill='#44A775'
4355+
d='M3.353.004a6.074 6.074 0 01-.265.045C2.63.12 2.092.348 1.71.633 1.426.846.717 1.575.557 1.819a3.359 3.359 0 00-.23 3.296c.154.322.35.59.71.972.187.198.434.486.55.64a6.629 6.629 0 011.305 3.546c.01.138.035 1.607.057 3.264.043 3.273.038 3.18.203 3.485.266.494.94.79 1.474.648.29-.077.463-.204 1.353-.986.957-.84 1.092-.932 1.446-.98.124-.017.631 0 1.66.053 1.513.08 1.622.079 1.85-.016.393-.164.539-.4.661-1.074.247-1.36 1.296-2.56 2.64-3.022.116-.04.373-.104.572-.144.198-.04.426-.102.506-.138.296-.136.515-.424.566-.744.017-.11-.007-.549-.089-1.602-.091-1.179-.107-1.483-.083-1.621.057-.342.139-.46 1.01-1.448.447-.506.85-.976.895-1.043.262-.39.288-.91.068-1.345a1.44 1.44 0 00-.822-.67c-.1-.029-.834-.037-3.544-.038H9.897l-.335-.063c-.958-.179-1.765-.49-2.484-.958-.362-.236-.583-.41-1.018-.804-.408-.37-.59-.502-.921-.67A3.018 3.018 0 003.744.005a3.942 3.942 0 00-.391 0zm15.728 5.858c-.132.049-.217.127-.48.44-.592.707-.74 1.336-.531 2.256.106.466.163.572.361.673.105.054.169.055 2.637.046l2.53-.009.118-.063a.551.551 0 00.095-.895 184.88 184.88 0 00-2.223-1.254c-2.293-1.282-2.281-1.276-2.507-1.194zm-3.216 6.71a9.258 9.258 0 00-1.364.696c-.844.557-1.454 1.36-1.923 2.53-.211.525-.202.75.04.935.111.087 6.478 3.14 6.667 3.198.153.047.27.027.43-.074a.538.538 0 00.24-.434c0-.06-.03-.18-.065-.264-.156-.368-3.098-6.467-3.158-6.545-.168-.222-.394-.232-.867-.042zm-8.48 5.457c-.453.102-.83.32-1.285.745-.296.277-.336.468-.167.798.053.103.61 1.104 1.236 2.224 1.297 2.317 1.22 2.206 1.558 2.202.152-.002.198-.015.296-.084a.662.662 0 00.173-.193c.058-.11.06-.152.08-2.595.018-1.93.015-2.51-.011-2.606a.569.569 0 00-.138-.227c-.09-.091-.14-.112-.406-.176-.582-.138-.992-.165-1.336-.088z'
4356+
/>
4357+
</svg>
4358+
)
4359+
}

apps/docs/components/ui/icon-mapping.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
GoogleVaultIcon,
4343
GrafanaIcon,
4444
GrainIcon,
45+
GreptileIcon,
4546
HubspotIcon,
4647
HuggingFaceIcon,
4748
HunterIOIcon,
@@ -158,6 +159,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
158159
google_vault: GoogleVaultIcon,
159160
grafana: GrafanaIcon,
160161
grain: GrainIcon,
162+
greptile: GreptileIcon,
161163
hubspot: HubspotIcon,
162164
huggingface: HuggingFaceIcon,
163165
hunter: HunterIOIcon,
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: Greptile
3+
description: AI-powered codebase search and Q&A
4+
---
5+
6+
import { BlockInfoCard } from "@/components/ui/block-info-card"
7+
8+
<BlockInfoCard
9+
type="greptile"
10+
color="#e5e5e5"
11+
/>
12+
13+
{/* MANUAL-CONTENT-START:intro */}
14+
[Greptile](https://greptile.com/) is an AI-powered developer tool for searching and querying source code across one or more repositories. Greptile enables engineers to quickly answer complex codebase questions in natural language, locate relevant files or symbols, and gain insights into unfamiliar or legacy code.
15+
16+
With Greptile, you can:
17+
18+
- **Ask complex questions about your codebase in natural language**: Get AI-generated answers about architecture, usage patterns, or specific implementations.
19+
- **Find relevant code, files, or functions instantly**: Search using keywords or natural language queries and jump right to matching lines, files, or code blocks.
20+
- **Understand dependencies and relationships**: Uncover where functions are called, how modules are related, or where APIs are used across large codebases.
21+
- **Accelerate onboarding and code exploration**: Quickly ramp up on new projects or debug tricky issues without needing deep prior context.
22+
23+
The Sim Greptile integration allows your AI agents to:
24+
25+
- Query and search private and public repositories using Greptile’s advanced language models.
26+
- Retrieve contextually relevant code snippets, file references, and explanations to support code review, documentation, and development workflows.
27+
- Trigger automations in Sim workflows based on search/query results or embed code intelligence directly into your processes.
28+
29+
Whether you’re trying to accelerate developer productivity, automate documentation, or supercharge your team’s understanding of a complex codebase, Greptile and Sim provide seamless access to code intelligence and search—right where you need it.
30+
{/* MANUAL-CONTENT-END */}
31+
32+
33+
## Usage Instructions
34+
35+
Query and search codebases using natural language with Greptile. Get AI-generated answers about your code, find relevant files, and understand complex codebases.
36+
37+
38+
39+
## Tools
40+
41+
### `greptile_query`
42+
43+
Query repositories in natural language and get answers with relevant code references. Greptile uses AI to understand your codebase and answer questions.
44+
45+
#### Input
46+
47+
| Parameter | Type | Required | Description |
48+
| --------- | ---- | -------- | ----------- |
49+
| `query` | string | Yes | Natural language question about the codebase |
50+
| `repositories` | string | Yes | Comma-separated list of repositories. Format: "github:branch:owner/repo" or just "owner/repo" \(defaults to github:main\) |
51+
| `sessionId` | string | No | Session ID for conversation continuity |
52+
| `genius` | boolean | No | Enable genius mode for more thorough analysis \(slower but more accurate\) |
53+
| `apiKey` | string | Yes | Greptile API key |
54+
| `githubToken` | string | Yes | GitHub Personal Access Token with repo read access |
55+
56+
#### Output
57+
58+
| Parameter | Type | Description |
59+
| --------- | ---- | ----------- |
60+
| `message` | string | AI-generated answer to the query |
61+
| `sources` | array | Relevant code references that support the answer |
62+
63+
### `greptile_search`
64+
65+
Search repositories in natural language and get relevant code references without generating an answer. Useful for finding specific code locations.
66+
67+
#### Input
68+
69+
| Parameter | Type | Required | Description |
70+
| --------- | ---- | -------- | ----------- |
71+
| `query` | string | Yes | Natural language search query to find relevant code |
72+
| `repositories` | string | Yes | Comma-separated list of repositories. Format: "github:branch:owner/repo" or just "owner/repo" \(defaults to github:main\) |
73+
| `sessionId` | string | No | Session ID for conversation continuity |
74+
| `genius` | boolean | No | Enable genius mode for more thorough search \(slower but more accurate\) |
75+
| `apiKey` | string | Yes | Greptile API key |
76+
| `githubToken` | string | Yes | GitHub Personal Access Token with repo read access |
77+
78+
#### Output
79+
80+
| Parameter | Type | Description |
81+
| --------- | ---- | ----------- |
82+
| `sources` | array | Relevant code references matching the search query |
83+
84+
### `greptile_index_repo`
85+
86+
Submit a repository to be indexed by Greptile. Indexing must complete before the repository can be queried. Small repos take 3-5 minutes, larger ones can take over an hour.
87+
88+
#### Input
89+
90+
| Parameter | Type | Required | Description |
91+
| --------- | ---- | -------- | ----------- |
92+
| `remote` | string | Yes | Git remote type: github or gitlab |
93+
| `repository` | string | Yes | Repository in owner/repo format \(e.g., "facebook/react"\) |
94+
| `branch` | string | Yes | Branch to index \(e.g., "main" or "master"\) |
95+
| `reload` | boolean | No | Force re-indexing even if already indexed |
96+
| `notify` | boolean | No | Send email notification when indexing completes |
97+
| `apiKey` | string | Yes | Greptile API key |
98+
| `githubToken` | string | Yes | GitHub Personal Access Token with repo read access |
99+
100+
#### Output
101+
102+
| Parameter | Type | Description |
103+
| --------- | ---- | ----------- |
104+
| `repositoryId` | string | Unique identifier for the indexed repository \(format: remote:branch:owner/repo\) |
105+
| `statusEndpoint` | string | URL endpoint to check indexing status |
106+
| `message` | string | Status message about the indexing operation |
107+
108+
### `greptile_status`
109+
110+
Check the indexing status of a repository. Use this to verify if a repository is ready to be queried or to monitor indexing progress.
111+
112+
#### Input
113+
114+
| Parameter | Type | Required | Description |
115+
| --------- | ---- | -------- | ----------- |
116+
| `remote` | string | Yes | Git remote type: github or gitlab |
117+
| `repository` | string | Yes | Repository in owner/repo format \(e.g., "facebook/react"\) |
118+
| `branch` | string | Yes | Branch name \(e.g., "main" or "master"\) |
119+
| `apiKey` | string | Yes | Greptile API key |
120+
| `githubToken` | string | Yes | GitHub Personal Access Token with repo read access |
121+
122+
#### Output
123+
124+
| Parameter | Type | Description |
125+
| --------- | ---- | ----------- |
126+
| `repository` | string | Repository name \(owner/repo\) |
127+
| `remote` | string | Git remote \(github/gitlab\) |
128+
| `branch` | string | Branch name |
129+
| `private` | boolean | Whether the repository is private |
130+
| `status` | string | Indexing status: submitted, cloning, processing, completed, or failed |
131+
| `filesProcessed` | number | Number of files processed so far |
132+
| `numFiles` | number | Total number of files in the repository |
133+
| `sampleQuestions` | array | Sample questions for the indexed repository |
134+
| `sha` | string | Git commit SHA of the indexed version |
135+
136+
137+
138+
## Notes
139+
140+
- Category: `tools`
141+
- Type: `greptile`

apps/docs/content/docs/en/tools/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"google_vault",
3838
"grafana",
3939
"grain",
40+
"greptile",
4041
"hubspot",
4142
"huggingface",
4243
"hunter",

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/markdown-renderer.tsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ interface CopilotMarkdownRendererProps {
115115
export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRendererProps) {
116116
const [copiedCodeBlocks, setCopiedCodeBlocks] = useState<Record<string, boolean>>({})
117117

118-
// Reset copy success state after 2 seconds
119118
useEffect(() => {
120119
const timers: Record<string, NodeJS.Timeout> = {}
121120

@@ -132,17 +131,14 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
132131
}
133132
}, [copiedCodeBlocks])
134133

135-
// Custom components for react-markdown with current styling - memoized to prevent re-renders
136134
const markdownComponents = useMemo(
137135
() => ({
138-
// Paragraph
139136
p: ({ children }: React.HTMLAttributes<HTMLParagraphElement>) => (
140-
<p className='mb-1 font-base font-season text-[var(--text-primary)] text-sm leading-[1.25rem] last:mb-0 dark:font-[470]'>
137+
<p className='mb-2 font-base font-season text-[var(--text-primary)] text-sm leading-[1.25rem] last:mb-0 dark:font-[470]'>
141138
{children}
142139
</p>
143140
),
144141

145-
// Headings
146142
h1: ({ children }: React.HTMLAttributes<HTMLHeadingElement>) => (
147143
<h1 className='mt-3 mb-3 font-season font-semibold text-2xl text-[var(--text-primary)]'>
148144
{children}
@@ -159,23 +155,22 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
159155
</h3>
160156
),
161157
h4: ({ children }: React.HTMLAttributes<HTMLHeadingElement>) => (
162-
<h4 className='mt-5 mb-2 font-season font-semibold text-[var(--text-primary)] text-base'>
158+
<h4 className='mt-2 mb-2 font-season font-semibold text-[var(--text-primary)] text-base'>
163159
{children}
164160
</h4>
165161
),
166162

167-
// Lists
168163
ul: ({ children }: React.HTMLAttributes<HTMLUListElement>) => (
169164
<ul
170-
className='mt-1 mb-1 space-y-1 pl-6 font-base font-season text-[var(--text-primary)] dark:font-[470]'
165+
className='mt-1 mb-1 space-y-1.5 pl-6 font-base font-season text-[var(--text-primary)] dark:font-[470]'
171166
style={{ listStyleType: 'disc' }}
172167
>
173168
{children}
174169
</ul>
175170
),
176171
ol: ({ children }: React.HTMLAttributes<HTMLOListElement>) => (
177172
<ol
178-
className='mt-1 mb-1 space-y-1 pl-6 font-base font-season text-[var(--text-primary)] dark:font-[470]'
173+
className='mt-1 mb-1 space-y-1.5 pl-6 font-base font-season text-[var(--text-primary)] dark:font-[470]'
179174
style={{ listStyleType: 'decimal' }}
180175
>
181176
{children}
@@ -193,7 +188,6 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
193188
</li>
194189
),
195190

196-
// Code blocks - render using shared Code.Viewer for consistent styling
197191
pre: ({ children }: React.HTMLAttributes<HTMLPreElement>) => {
198192
let codeContent: React.ReactNode = children
199193
let language = 'code'
@@ -210,15 +204,12 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
210204
language = childElement.props.className?.replace('language-', '') || 'code'
211205
}
212206

213-
// Extract actual text content
214207
let actualCodeText = ''
215208
if (typeof codeContent === 'string') {
216209
actualCodeText = codeContent
217210
} else if (React.isValidElement(codeContent)) {
218-
// If it's a React element, try to get its text content
219211
actualCodeText = getTextContent(codeContent)
220212
} else if (Array.isArray(codeContent)) {
221-
// If it's an array of elements, join their text content
222213
actualCodeText = codeContent
223214
.map((child) =>
224215
typeof child === 'string'
@@ -232,7 +223,6 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
232223
actualCodeText = String(codeContent || '')
233224
}
234225

235-
// Create a unique key for this code block based on content
236226
const codeText = actualCodeText || 'code'
237227
const codeBlockKey = `${language}-${codeText.substring(0, 30).replace(/\s/g, '-')}-${codeText.length}`
238228

@@ -246,7 +236,6 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
246236
}
247237
}
248238

249-
// Map markdown language tag to Code.Viewer supported languages
250239
const normalizedLanguage = (language || '').toLowerCase()
251240
const viewerLanguage: 'javascript' | 'json' | 'python' =
252241
normalizedLanguage === 'json'
@@ -256,7 +245,7 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
256245
: 'javascript'
257246

258247
return (
259-
<div className='my-6 w-0 min-w-full overflow-hidden rounded-md border border-[var(--border-1)] bg-[var(--surface-1)] text-sm'>
248+
<div className='mt-6 mb-6 w-0 min-w-full overflow-hidden rounded-md border border-[var(--border-1)] bg-[var(--surface-1)] text-sm'>
260249
<div className='flex items-center justify-between border-[var(--border-1)] border-b px-4 py-1.5'>
261250
<span className='font-season text-[var(--text-muted)] text-xs'>
262251
{language === 'code' ? viewerLanguage : language}
@@ -274,16 +263,15 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
274263
</button>
275264
</div>
276265
<Code.Viewer
277-
code={actualCodeText}
266+
code={actualCodeText.replace(/\n+$/, '')}
278267
showGutter
279268
language={viewerLanguage}
280-
className='[&_pre]:!pb-0 m-0 rounded-none border-0 bg-transparent'
269+
className='m-0 min-h-0 rounded-none border-0 bg-transparent'
281270
/>
282271
</div>
283272
)
284273
},
285274

286-
// Inline code
287275
code: ({
288276
inline,
289277
className,
@@ -307,44 +295,36 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
307295
)
308296
},
309297

310-
// Bold text
311298
strong: ({ children }: React.HTMLAttributes<HTMLElement>) => (
312299
<strong className='font-semibold text-[var(--text-primary)]'>{children}</strong>
313300
),
314301

315-
// Bold text (alternative)
316302
b: ({ children }: React.HTMLAttributes<HTMLElement>) => (
317303
<b className='font-semibold text-[var(--text-primary)]'>{children}</b>
318304
),
319305

320-
// Italic text
321306
em: ({ children }: React.HTMLAttributes<HTMLElement>) => (
322307
<em className='text-[var(--text-primary)] italic'>{children}</em>
323308
),
324309

325-
// Italic text (alternative)
326310
i: ({ children }: React.HTMLAttributes<HTMLElement>) => (
327311
<i className='text-[var(--text-primary)] italic'>{children}</i>
328312
),
329313

330-
// Blockquotes
331314
blockquote: ({ children }: React.HTMLAttributes<HTMLQuoteElement>) => (
332315
<blockquote className='my-4 border-[var(--border-1)] border-l-4 py-1 pl-4 font-season text-[var(--text-secondary)] italic'>
333316
{children}
334317
</blockquote>
335318
),
336319

337-
// Horizontal rule
338320
hr: () => <hr className='my-8 border-[var(--divider)] border-t' />,
339321

340-
// Links
341322
a: ({ href, children, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (
342323
<LinkWithPreview href={href || '#'} {...props}>
343324
{children}
344325
</LinkWithPreview>
345326
),
346327

347-
// Tables
348328
table: ({ children }: React.TableHTMLAttributes<HTMLTableElement>) => (
349329
<div className='my-4 max-w-full overflow-x-auto'>
350330
<table className='min-w-full table-auto border border-[var(--border-1)] font-season text-sm'>
@@ -376,7 +356,6 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend
376356
</td>
377357
),
378358

379-
// Images
380359
img: ({ src, alt, ...props }: React.ImgHTMLAttributes<HTMLImageElement>) => (
381360
<img
382361
src={src}

0 commit comments

Comments
 (0)