chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
import { indexRepoTool } from '@/tools/greptile/index_repo'
import { queryTool } from '@/tools/greptile/query'
import { searchTool } from '@/tools/greptile/search'
import { statusTool } from '@/tools/greptile/status'
export const greptileQueryTool = queryTool
export const greptileSearchTool = searchTool
export const greptileIndexRepoTool = indexRepoTool
export const greptileStatusTool = statusTool
+123
View File
@@ -0,0 +1,123 @@
import type { GreptileIndexParams, GreptileIndexResponse } from '@/tools/greptile/types'
import type { ToolConfig } from '@/tools/types'
export const indexRepoTool: ToolConfig<GreptileIndexParams, GreptileIndexResponse> = {
id: 'greptile_index_repo',
name: 'Greptile Index Repository',
description:
'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.',
version: '1.0.0',
params: {
remote: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Git remote type: github or gitlab',
},
repository: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Repository in owner/repo format. Example: "facebook/react" or "vercel/next.js"',
},
branch: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Branch to index (e.g., "main" or "master")',
},
reload: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Force re-indexing even if already indexed',
},
notify: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Send email notification when indexing completes',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Greptile API key',
},
githubToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'GitHub Personal Access Token with repo read access',
},
},
request: {
url: 'https://api.greptile.com/v2/repositories',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
'X-Github-Token': params.githubToken,
}),
body: (params) => {
const body: Record<string, unknown> = {
remote: params.remote,
repository: params.repository,
branch: params.branch,
}
if (params.reload != null) {
body.reload = params.reload
}
if (params.notify != null) {
body.notify = params.notify
}
return body
},
},
transformResponse: async (response: Response, params) => {
const data = await response.json()
let repositoryId = ''
if (data.statusEndpoint) {
const match = data.statusEndpoint.match(/\/repositories\/(.+)$/)
if (match) {
repositoryId = decodeURIComponent(match[1])
}
}
if (!repositoryId && params) {
repositoryId = `${params.remote}:${params.branch}:${params.repository}`
}
return {
success: true,
output: {
repositoryId,
statusEndpoint: data.statusEndpoint || '',
message: data.message || 'Repository submitted for indexing',
},
}
},
outputs: {
repositoryId: {
type: 'string',
description:
'Unique identifier for the indexed repository (format: remote:branch:owner/repo)',
},
statusEndpoint: {
type: 'string',
description: 'URL endpoint to check indexing status',
},
message: {
type: 'string',
description: 'Status message about the indexing operation',
},
},
}
+130
View File
@@ -0,0 +1,130 @@
import type { GreptileQueryParams, GreptileQueryResponse } from '@/tools/greptile/types'
import { parseRepositories } from '@/tools/greptile/utils'
import type { ToolConfig } from '@/tools/types'
export const queryTool: ToolConfig<GreptileQueryParams, GreptileQueryResponse> = {
id: 'greptile_query',
name: 'Greptile Query',
description:
'Query repositories in natural language and get answers with relevant code references. Greptile uses AI to understand your codebase and answer questions.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Natural language question about the codebase. Example: "How does authentication work?" or "Where is the payment processing logic?"',
},
repositories: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Comma-separated list of repositories. Format: "github:branch:owner/repo" or just "owner/repo" (defaults to github:main). Example: "facebook/react" or "github:main:facebook/react,github:main:facebook/relay"',
},
sessionId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Session ID for conversation continuity. Use the same sessionId across multiple queries to maintain context. Example: "session-abc123"',
},
genius: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Enable genius mode for more thorough analysis (slower but more accurate)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Greptile API key',
},
githubToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'GitHub Personal Access Token with repo read access',
},
},
request: {
url: 'https://api.greptile.com/v2/query',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
'X-Github-Token': params.githubToken,
}),
body: (params) => {
const body: Record<string, unknown> = {
messages: [
{
role: 'user',
content: params.query,
},
],
repositories: parseRepositories(params.repositories),
stream: false,
}
if (params.sessionId) {
body.sessionId = params.sessionId
}
if (params.genius != null) {
body.genius = params.genius
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
message: data.message || '',
sources: (data.sources || []).map((source: Record<string, unknown>) => ({
repository: source.repository || '',
remote: source.remote || '',
branch: source.branch || '',
filepath: source.filepath || '',
linestart: source.linestart,
lineend: source.lineend,
summary: source.summary,
distance: source.distance,
})),
},
}
},
outputs: {
message: {
type: 'string',
description: 'AI-generated answer to the query',
},
sources: {
type: 'array',
description: 'Relevant code references that support the answer',
items: {
type: 'object',
properties: {
repository: { type: 'string', description: 'Repository name (owner/repo)' },
remote: { type: 'string', description: 'Git remote (github/gitlab)' },
branch: { type: 'string', description: 'Branch name' },
filepath: { type: 'string', description: 'Path to the file' },
linestart: { type: 'number', description: 'Starting line number' },
lineend: { type: 'number', description: 'Ending line number' },
summary: { type: 'string', description: 'Summary of the code section' },
distance: { type: 'number', description: 'Similarity score (lower = more relevant)' },
},
},
},
},
}
+119
View File
@@ -0,0 +1,119 @@
import type { GreptileSearchParams, GreptileSearchResponse } from '@/tools/greptile/types'
import { parseRepositories } from '@/tools/greptile/utils'
import type { ToolConfig } from '@/tools/types'
export const searchTool: ToolConfig<GreptileSearchParams, GreptileSearchResponse> = {
id: 'greptile_search',
name: 'Greptile Search',
description:
'Search repositories in natural language and get relevant code references without generating an answer. Useful for finding specific code locations.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Natural language search query to find relevant code. Example: "authentication middleware" or "database connection handling"',
},
repositories: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Comma-separated list of repositories. Format: "github:branch:owner/repo" or just "owner/repo" (defaults to github:main). Example: "facebook/react" or "github:main:facebook/react,github:main:facebook/relay"',
},
sessionId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Session ID for conversation continuity. Use the same sessionId across multiple searches to maintain context. Example: "session-abc123"',
},
genius: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Enable genius mode for more thorough search (slower but more accurate)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Greptile API key',
},
githubToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'GitHub Personal Access Token with repo read access',
},
},
request: {
url: 'https://api.greptile.com/v2/search',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
'X-Github-Token': params.githubToken,
}),
body: (params) => {
const body: Record<string, unknown> = {
query: params.query,
repositories: parseRepositories(params.repositories),
}
if (params.sessionId) {
body.sessionId = params.sessionId
}
if (params.genius != null) {
body.genius = params.genius
}
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
sources: (data.sources || data || []).map((source: Record<string, unknown>) => ({
repository: source.repository || '',
remote: source.remote || '',
branch: source.branch || '',
filepath: source.filepath || '',
linestart: source.linestart,
lineend: source.lineend,
summary: source.summary,
distance: source.distance,
})),
},
}
},
outputs: {
sources: {
type: 'array',
description: 'Relevant code references matching the search query',
items: {
type: 'object',
properties: {
repository: { type: 'string', description: 'Repository name (owner/repo)' },
remote: { type: 'string', description: 'Git remote (github/gitlab)' },
branch: { type: 'string', description: 'Branch name' },
filepath: { type: 'string', description: 'Path to the file' },
linestart: { type: 'number', description: 'Starting line number' },
lineend: { type: 'number', description: 'Ending line number' },
summary: { type: 'string', description: 'Summary of the code section' },
distance: { type: 'number', description: 'Similarity score (lower = more relevant)' },
},
},
},
},
}
+115
View File
@@ -0,0 +1,115 @@
import type { GreptileStatusParams, GreptileStatusResponse } from '@/tools/greptile/types'
import type { ToolConfig } from '@/tools/types'
export const statusTool: ToolConfig<GreptileStatusParams, GreptileStatusResponse> = {
id: 'greptile_status',
name: 'Greptile Repository Status',
description:
'Check the indexing status of a repository. Use this to verify if a repository is ready to be queried or to monitor indexing progress.',
version: '1.0.0',
params: {
remote: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Git remote type: github or gitlab',
},
repository: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Repository in owner/repo format. Example: "facebook/react" or "vercel/next.js"',
},
branch: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Branch name (e.g., "main" or "master")',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Greptile API key',
},
githubToken: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'GitHub Personal Access Token with repo read access',
},
},
request: {
url: (params) => {
// Repository ID format: remote:branch:owner/repo (URL encoded)
const repositoryId = `${params.remote}:${params.branch}:${params.repository}`
return `https://api.greptile.com/v2/repositories/${encodeURIComponent(repositoryId)}`
},
method: 'GET',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
'X-Github-Token': params.githubToken,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
repository: data.repository || '',
remote: data.remote || '',
branch: data.branch || '',
private: data.private || false,
status: data.status || 'unknown',
filesProcessed: data.filesProcessed,
numFiles: data.numFiles,
sampleQuestions: data.sampleQuestions || [],
sha: data.sha,
},
}
},
outputs: {
repository: {
type: 'string',
description: 'Repository name (owner/repo)',
},
remote: {
type: 'string',
description: 'Git remote (github/gitlab)',
},
branch: {
type: 'string',
description: 'Branch name',
},
private: {
type: 'boolean',
description: 'Whether the repository is private',
},
status: {
type: 'string',
description: 'Indexing status: submitted, cloning, processing, completed, or failed',
},
filesProcessed: {
type: 'number',
description: 'Number of files processed so far',
},
numFiles: {
type: 'number',
description: 'Total number of files in the repository',
},
sampleQuestions: {
type: 'array',
description: 'Sample questions for the indexed repository',
},
sha: {
type: 'string',
description: 'Git commit SHA of the indexed version',
},
},
}
+129
View File
@@ -0,0 +1,129 @@
import type { ToolResponse } from '@/tools/types'
/**
* Common parameters for all Greptile tools
*/
interface GreptileBaseParams {
apiKey: string
githubToken: string
}
/**
* Repository identifier format
*/
interface GreptileRepository {
remote: 'github' | 'gitlab'
branch: string
repository: string
}
/**
* Query tool parameters
*/
export interface GreptileQueryParams extends GreptileBaseParams {
query: string
repositories: string
sessionId?: string
stream?: boolean
genius?: boolean
}
/**
* Source reference in query/search results
*/
interface GreptileSource {
repository: string
remote: string
branch: string
filepath: string
linestart?: number
lineend?: number
summary?: string
distance?: number
}
/**
* Query response
*/
export interface GreptileQueryResponse extends ToolResponse {
output: {
message: string
sources: GreptileSource[]
}
}
/**
* Search tool parameters
*/
export interface GreptileSearchParams extends GreptileBaseParams {
query: string
repositories: string
sessionId?: string
genius?: boolean
}
/**
* Search response
*/
export interface GreptileSearchResponse extends ToolResponse {
output: {
sources: GreptileSource[]
}
}
/**
* Index repository tool parameters
*/
export interface GreptileIndexParams extends GreptileBaseParams {
remote: 'github' | 'gitlab'
repository: string
branch: string
reload?: boolean
notify?: boolean
}
/**
* Index repository response
*/
export interface GreptileIndexResponse extends ToolResponse {
output: {
repositoryId: string
statusEndpoint: string
message: string
}
}
/**
* Get repository status tool parameters
*/
export interface GreptileStatusParams extends GreptileBaseParams {
remote: 'github' | 'gitlab'
repository: string
branch: string
}
/**
* Repository status response
*/
export interface GreptileStatusResponse extends ToolResponse {
output: {
repository: string
remote: string
branch: string
private: boolean
status: 'submitted' | 'cloning' | 'processing' | 'completed' | 'failed'
filesProcessed?: number
numFiles?: number
sampleQuestions?: string[]
sha?: string
}
}
/**
* Union type for all Greptile responses
*/
export type GreptileResponse =
| GreptileQueryResponse
| GreptileSearchResponse
| GreptileIndexResponse
| GreptileStatusResponse
+29
View File
@@ -0,0 +1,29 @@
/**
* Parse repository string into structured format for Greptile API
* Accepts formats like "github:main:owner/repo" or "owner/repo" (defaults to github:main)
*/
export function parseRepositories(repoString: string): Array<{
remote: string
branch: string
repository: string
}> {
return repoString
.split(',')
.map((r) => r.trim())
.filter((r) => r.length > 0)
.map((repo) => {
const parts = repo.split(':')
if (parts.length === 3) {
return {
remote: parts[0],
branch: parts[1],
repository: parts[2],
}
}
return {
remote: 'github',
branch: 'main',
repository: repo,
}
})
}