mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-17 19:47:10 +08:00
chore(cursor-proxy-debugger): enhance traffic capture for Fork Chat and update README
- Added support for capturing and decoding Fork Chat traffic, including `ForkBackgroundComposer`, `NotifyConversationClone`, and `UploadConversationBlobs`. - Updated the README to reflect new features and usage instructions for Fork Chat traffic. - Modified `.gitignore` to include `proto/extensions-cursor-app/`. - Refactored `Taskfile.yml` to improve error messages related to Cursor extensions. - Introduced new tests for decoding functionality in `cursor-proxy-debugger`.
This commit is contained in:
+2500
-739
File diff suppressed because it is too large
Load Diff
+10896
-4348
File diff suppressed because it is too large
Load Diff
+226
-60
@@ -101,24 +101,28 @@ func SetStrictMode(enabled bool) {
|
||||
var activeDiagnostics *extractionDiagnostics
|
||||
|
||||
var (
|
||||
noRe = regexp.MustCompile(`(?:^|[,{]\s*)no:\s*(\d+)`)
|
||||
nameRe = regexp.MustCompile(`(?:^|[,{]\s*)name:\s*["']([^"']+)["']`)
|
||||
kindRe = regexp.MustCompile(`(?:^|[,{]\s*)kind:\s*["']([^"']+)["']`)
|
||||
enumTypeRe = regexp.MustCompile(`[,\s]T:\s*[\w$.]+\.getEnumType\s*\(\s*([\w$.]+)\s*\)`)
|
||||
tRe = regexp.MustCompile(`[,\s]T:\s*([\w$.]+)`)
|
||||
oneofRe = regexp.MustCompile(`oneof:\s*["']([^"']+)["']`)
|
||||
repeatedRe = regexp.MustCompile(`repeated:\s*(!0|true)`)
|
||||
optRe = regexp.MustCompile(`opt:\s*(!0|true)`)
|
||||
keyRe = regexp.MustCompile(`[,\s]K:\s*(\d+)`)
|
||||
mapValueRe = regexp.MustCompile(`V:\s*\{([^}]*)\}`)
|
||||
mapValueKRe = regexp.MustCompile(`(?:^|[,{]\s*)kind:\s*["'](\w+)["']`)
|
||||
mapValueTRe = regexp.MustCompile(`[,\s]T:\s*([\w$.]+)`)
|
||||
oneofNameRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
|
||||
fieldNameRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
|
||||
placeholderRe = regexp.MustCompile(`^\s*(optional\s+|repeated\s+)?[A-Za-z_][A-Za-z0-9_.<>]*\s+(field_\d+|unknown(?:_[A-Za-z0-9_]+)?)\s*=\s*\d+\s*;`)
|
||||
varAliasRe = regexp.MustCompile(`\b(?:let|const|var)\s+([\w$]+)\s*=\s*([\w$]+)\s*(?:[,;])`)
|
||||
streamCloseRe = regexp.MustCompile(`(?s)message\s+ExecClientControlMessage\s*\{.*?ExecClientStreamClose\s+stream_close\s*=\s*1\s*;`)
|
||||
shellStdoutRe = regexp.MustCompile(`(?s)message\s+ShellStream\s*\{.*?ShellStreamStdout\s+stdout\s*=\s*1\s*;`)
|
||||
noRe = regexp.MustCompile(`(?:^|[,{]\s*)no:\s*(\d+)`)
|
||||
nameRe = regexp.MustCompile(`(?:^|[,{]\s*)name:\s*["']([^"']+)["']`)
|
||||
kindRe = regexp.MustCompile(`(?:^|[,{]\s*)kind:\s*["']([^"']+)["']`)
|
||||
enumTypeRe = regexp.MustCompile(`[,\s]T:\s*[\w$.]+\.getEnumType\s*\(\s*([\w$.]+)\s*\)`)
|
||||
tRe = regexp.MustCompile(`[,\s]T:\s*([\w$.]+)`)
|
||||
oneofRe = regexp.MustCompile(`oneof:\s*["']([^"']+)["']`)
|
||||
repeatedRe = regexp.MustCompile(`repeated:\s*(!0|true)`)
|
||||
optRe = regexp.MustCompile(`opt:\s*(!0|true)`)
|
||||
keyRe = regexp.MustCompile(`[,\s]K:\s*(\d+)`)
|
||||
mapValueRe = regexp.MustCompile(`V:\s*\{([^}]*)\}`)
|
||||
mapValueKRe = regexp.MustCompile(`(?:^|[,{]\s*)kind:\s*["'](\w+)["']`)
|
||||
mapValueTRe = regexp.MustCompile(`[,\s]T:\s*([\w$.]+)`)
|
||||
shorthandTRe = regexp.MustCompile(`(?:^|[,\{])\s*T\s*(?:[,\}])`)
|
||||
oneofNameRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
|
||||
fieldNameRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
|
||||
placeholderRe = regexp.MustCompile(`^\s*(optional\s+|repeated\s+)?[A-Za-z_][A-Za-z0-9_.<>]*\s+(field_\d+|unknown(?:_[A-Za-z0-9_]+)?)\s*=\s*\d+\s*;`)
|
||||
varAliasRe = regexp.MustCompile(`\b(?:let|const|var)\s+([\w$]+)\s*=\s*([\w$]+)\s*(?:[,;])`)
|
||||
webpackExportBlockRe = regexp.MustCompile(`[\w$]+\.d\(\s*[\w$]+\s*,\s*\{`)
|
||||
webpackExportEntryRe = regexp.MustCompile(`(?:^|[,\{])\s*([\w$]+)\s*:\s*\(\s*\)\s*=>\s*([\w$]+)`)
|
||||
moduleImportRe = regexp.MustCompile(`(?:\b(?:var|let|const)\s+|,)\s*([\w$]+)\s*=\s*[\w$]+\(\s*(\d+)\s*\)`)
|
||||
streamCloseRe = regexp.MustCompile(`(?s)message\s+ExecClientControlMessage\s*\{.*?ExecClientStreamClose\s+stream_close\s*=\s*1\s*;`)
|
||||
shellStdoutRe = regexp.MustCompile(`(?s)message\s+ShellStream\s*\{.*?ShellStreamStdout\s+stdout\s*=\s*1\s*;`)
|
||||
)
|
||||
|
||||
type Field struct {
|
||||
@@ -185,13 +189,18 @@ type symbolDef struct {
|
||||
}
|
||||
|
||||
type TypeResolver struct {
|
||||
bySymbol map[string][]symbolDef
|
||||
byShort map[string][]symbolDef
|
||||
bySymbol map[string][]symbolDef
|
||||
byAlias map[string][]symbolDef
|
||||
byShort map[string][]symbolDef
|
||||
moduleImports map[int]map[string]int
|
||||
}
|
||||
|
||||
func newTypeResolver(messages []Message, enums []Enum, aliases map[string][]string) *TypeResolver {
|
||||
type aliasIndex map[int]map[string][]string
|
||||
|
||||
func newTypeResolver(messages []Message, enums []Enum, aliases aliasIndex, exportAliases aliasIndex) *TypeResolver {
|
||||
resolver := &TypeResolver{
|
||||
bySymbol: make(map[string][]symbolDef),
|
||||
byAlias: make(map[string][]symbolDef),
|
||||
byShort: make(map[string][]symbolDef),
|
||||
}
|
||||
|
||||
@@ -218,43 +227,64 @@ func newTypeResolver(messages []Message, enums []Enum, aliases map[string][]stri
|
||||
}
|
||||
}
|
||||
}
|
||||
addAlias := func(symbol, typeName string, pos int, moduleStart int, kind string) {
|
||||
symbol = strings.TrimSpace(symbol)
|
||||
typeName = strings.TrimSpace(typeName)
|
||||
if symbol == "" || typeName == "" {
|
||||
return
|
||||
}
|
||||
resolver.byAlias[symbol] = append(resolver.byAlias[symbol], symbolDef{
|
||||
TypeName: typeName, Pos: pos, ModuleStart: moduleStart, Kind: kind,
|
||||
})
|
||||
}
|
||||
|
||||
for _, msg := range messages {
|
||||
add(msg.VarName, msg.TypeName, msg.Pos, msg.ModuleStart, "message")
|
||||
if msg.InternalName != "" && msg.InternalName != msg.VarName {
|
||||
add(msg.InternalName, msg.TypeName, msg.Pos, msg.ModuleStart, "message")
|
||||
}
|
||||
for _, alias := range aliasesForSymbols(aliases, msg.VarName, msg.InternalName) {
|
||||
add(alias, msg.TypeName, msg.Pos, msg.ModuleStart, "message")
|
||||
for _, alias := range aliasesForSymbols(aliases[msg.ModuleStart], msg.VarName, msg.InternalName) {
|
||||
addAlias(alias, msg.TypeName, msg.Pos, msg.ModuleStart, "message")
|
||||
}
|
||||
}
|
||||
for _, enum := range enums {
|
||||
add(enum.VarName, enum.TypeName, enum.Pos, enum.ModuleStart, "enum")
|
||||
for _, alias := range aliasesForSymbols(aliases, enum.VarName) {
|
||||
add(alias, enum.TypeName, enum.Pos, enum.ModuleStart, "enum")
|
||||
for _, alias := range aliasesForSymbols(aliases[enum.ModuleStart], enum.VarName) {
|
||||
addAlias(alias, enum.TypeName, enum.Pos, enum.ModuleStart, "enum")
|
||||
}
|
||||
}
|
||||
|
||||
for _, msg := range messages {
|
||||
for _, alias := range aliasesForSymbols(exportAliases[msg.ModuleStart], msg.VarName, msg.InternalName) {
|
||||
addAlias(alias, msg.TypeName, msg.Pos, msg.ModuleStart, "message")
|
||||
}
|
||||
}
|
||||
for _, enum := range enums {
|
||||
for _, alias := range aliasesForSymbols(exportAliases[enum.ModuleStart], enum.VarName) {
|
||||
addAlias(alias, enum.TypeName, enum.Pos, enum.ModuleStart, "enum")
|
||||
}
|
||||
}
|
||||
|
||||
return resolver
|
||||
}
|
||||
|
||||
func buildAliasIndex(text string) map[string][]string {
|
||||
matches := varAliasRe.FindAllStringSubmatch(text, -1)
|
||||
if len(matches) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
direct := make(map[string]string, len(matches))
|
||||
func buildAliasIndex(text string, moduleStarts []int) aliasIndex {
|
||||
matches := varAliasRe.FindAllStringSubmatchIndex(text, -1)
|
||||
directByModule := make(map[int]map[string]string)
|
||||
for _, match := range matches {
|
||||
alias := strings.TrimSpace(match[1])
|
||||
target := strings.TrimSpace(match[2])
|
||||
alias := strings.TrimSpace(text[match[2]:match[3]])
|
||||
target := strings.TrimSpace(text[match[4]:match[5]])
|
||||
if alias == "" || target == "" || alias == target {
|
||||
continue
|
||||
}
|
||||
direct[alias] = target
|
||||
moduleStart := moduleStartForPos(moduleStarts, match[0])
|
||||
if directByModule[moduleStart] == nil {
|
||||
directByModule[moduleStart] = make(map[string]string)
|
||||
}
|
||||
directByModule[moduleStart][alias] = target
|
||||
}
|
||||
|
||||
resolveRoot := func(symbol string) string {
|
||||
resolveRoot := func(direct map[string]string, symbol string) string {
|
||||
seen := make(map[string]bool)
|
||||
current := symbol
|
||||
for {
|
||||
@@ -270,16 +300,90 @@ func buildAliasIndex(text string) map[string][]string {
|
||||
}
|
||||
}
|
||||
|
||||
aliases := make(map[string][]string)
|
||||
for alias := range direct {
|
||||
root := resolveRoot(alias)
|
||||
if root == alias {
|
||||
aliasSets := make(map[int]map[string]map[string]bool)
|
||||
addAlias := func(moduleStart int, root string, alias string) {
|
||||
root = strings.TrimSpace(root)
|
||||
alias = strings.TrimSpace(alias)
|
||||
if root == "" || alias == "" || root == alias {
|
||||
return
|
||||
}
|
||||
if aliasSets[moduleStart] == nil {
|
||||
aliasSets[moduleStart] = make(map[string]map[string]bool)
|
||||
}
|
||||
if aliasSets[moduleStart][root] == nil {
|
||||
aliasSets[moduleStart][root] = make(map[string]bool)
|
||||
}
|
||||
aliasSets[moduleStart][root][alias] = true
|
||||
}
|
||||
|
||||
for moduleStart, direct := range directByModule {
|
||||
for alias := range direct {
|
||||
root := resolveRoot(direct, alias)
|
||||
addAlias(moduleStart, root, alias)
|
||||
}
|
||||
}
|
||||
|
||||
if len(aliasSets) == 0 {
|
||||
return nil
|
||||
}
|
||||
aliases := make(aliasIndex, len(aliasSets))
|
||||
for moduleStart, roots := range aliasSets {
|
||||
aliases[moduleStart] = make(map[string][]string, len(roots))
|
||||
for root, set := range roots {
|
||||
for alias := range set {
|
||||
aliases[moduleStart][root] = append(aliases[moduleStart][root], alias)
|
||||
}
|
||||
sort.Strings(aliases[moduleStart][root])
|
||||
}
|
||||
}
|
||||
return aliases
|
||||
}
|
||||
|
||||
func buildWebpackExportAliasIndex(text string, moduleStarts []int) aliasIndex {
|
||||
aliasSets := make(map[int]map[string]map[string]bool)
|
||||
addAlias := func(moduleStart int, root string, alias string) {
|
||||
root = strings.TrimSpace(root)
|
||||
alias = strings.TrimSpace(alias)
|
||||
if root == "" || alias == "" || root == alias {
|
||||
return
|
||||
}
|
||||
if aliasSets[moduleStart] == nil {
|
||||
aliasSets[moduleStart] = make(map[string]map[string]bool)
|
||||
}
|
||||
if aliasSets[moduleStart][root] == nil {
|
||||
aliasSets[moduleStart][root] = make(map[string]bool)
|
||||
}
|
||||
aliasSets[moduleStart][root][alias] = true
|
||||
}
|
||||
|
||||
// Webpack exposes module members through tables such as
|
||||
// n.d(t, { KS: () => T }). Service descriptors refer to the exported
|
||||
// name (r.KS), while message definitions use the local symbol (T).
|
||||
for _, blockMatch := range webpackExportBlockRe.FindAllStringIndex(text, -1) {
|
||||
moduleStart := moduleStartForPos(moduleStarts, blockMatch[0])
|
||||
blockStart := blockMatch[1] - 1
|
||||
blockEnd := findMatchingBrace(text, blockStart)
|
||||
if blockEnd == -1 {
|
||||
continue
|
||||
}
|
||||
aliases[root] = append(aliases[root], alias)
|
||||
block := text[blockStart:blockEnd]
|
||||
for _, entry := range webpackExportEntryRe.FindAllStringSubmatch(block, -1) {
|
||||
addAlias(moduleStart, entry[2], entry[1])
|
||||
}
|
||||
}
|
||||
for root := range aliases {
|
||||
sort.Strings(aliases[root])
|
||||
|
||||
if len(aliasSets) == 0 {
|
||||
return nil
|
||||
}
|
||||
aliases := make(aliasIndex, len(aliasSets))
|
||||
for moduleStart, roots := range aliasSets {
|
||||
aliases[moduleStart] = make(map[string][]string, len(roots))
|
||||
for root, set := range roots {
|
||||
for alias := range set {
|
||||
aliases[moduleStart][root] = append(aliases[moduleStart][root], alias)
|
||||
}
|
||||
sort.Strings(aliases[moduleStart][root])
|
||||
}
|
||||
}
|
||||
return aliases
|
||||
}
|
||||
@@ -318,11 +422,10 @@ func pickBestDefinition(candidates []symbolDef, contextPos int, contextModuleSta
|
||||
}
|
||||
|
||||
filtered := candidates
|
||||
if strings.TrimSpace(preferredPkg) != "" {
|
||||
if strings.TrimSpace(expectedKind) != "" {
|
||||
tmp := make([]symbolDef, 0, len(candidates))
|
||||
for _, item := range candidates {
|
||||
pkg, _ := parseTypeName(item.TypeName)
|
||||
if pkg == preferredPkg {
|
||||
if item.Kind == expectedKind {
|
||||
tmp = append(tmp, item)
|
||||
}
|
||||
}
|
||||
@@ -331,10 +434,11 @@ func pickBestDefinition(candidates []symbolDef, contextPos int, contextModuleSta
|
||||
}
|
||||
}
|
||||
|
||||
if strings.TrimSpace(expectedKind) != "" {
|
||||
if strings.TrimSpace(preferredPkg) != "" {
|
||||
tmp := make([]symbolDef, 0, len(filtered))
|
||||
for _, item := range filtered {
|
||||
if item.Kind == expectedKind {
|
||||
pkg, _ := parseTypeName(item.TypeName)
|
||||
if pkg == preferredPkg {
|
||||
tmp = append(tmp, item)
|
||||
}
|
||||
}
|
||||
@@ -416,6 +520,17 @@ func (resolver *TypeResolver) ResolveTypeName(ref string, contextPos int, contex
|
||||
}
|
||||
return best.TypeName, true
|
||||
}
|
||||
resolveByAlias := func(symbol string, targetModuleStart int) (string, bool) {
|
||||
candidates := resolver.byAlias[symbol]
|
||||
if len(candidates) == 0 {
|
||||
return "", false
|
||||
}
|
||||
best, ok := pickBestDefinition(candidates, contextPos, targetModuleStart, preferredPkg, expectedKind)
|
||||
if !ok {
|
||||
return "", false
|
||||
}
|
||||
return best.TypeName, true
|
||||
}
|
||||
resolveByShort := func(symbol string, preferSameModule bool) (string, bool) {
|
||||
candidates := resolver.byShort[symbol]
|
||||
if len(candidates) == 0 {
|
||||
@@ -435,17 +550,30 @@ func (resolver *TypeResolver) ResolveTypeName(ref string, contextPos int, contex
|
||||
if typeName, ok := resolveBySymbol(trimmed, !strings.Contains(trimmed, ".")); ok {
|
||||
return typeName, true
|
||||
}
|
||||
if typeName, ok := resolveByAlias(trimmed, 0); ok {
|
||||
return typeName, true
|
||||
}
|
||||
if typeName, ok := resolveByShort(trimmed, !strings.Contains(trimmed, ".")); ok {
|
||||
return typeName, true
|
||||
}
|
||||
|
||||
if strings.Contains(trimmed, ".") {
|
||||
parts := strings.Split(trimmed, ".")
|
||||
first := parts[0]
|
||||
last := parts[len(parts)-1]
|
||||
targetModuleStart := 0
|
||||
if imports := resolver.moduleImports[contextModuleStart]; imports != nil {
|
||||
targetModuleStart = imports[first]
|
||||
}
|
||||
if typeName, ok := resolveByAlias(last, targetModuleStart); ok {
|
||||
return typeName, true
|
||||
}
|
||||
if typeName, ok := resolveBySymbol(last, false); ok {
|
||||
return typeName, true
|
||||
}
|
||||
if typeName, ok := resolveByShort(last, false); ok {
|
||||
return typeName, true
|
||||
}
|
||||
first := parts[0]
|
||||
if typeName, ok := resolveBySymbol(first, false); ok {
|
||||
return typeName, true
|
||||
}
|
||||
@@ -473,7 +601,7 @@ func absInt(value int) int {
|
||||
return value
|
||||
}
|
||||
|
||||
var moduleStartRe = regexp.MustCompile(`(?:^|,)(\d+):(?:function\([\w$,]*\)|\([\w$,]*\)=>)\{`)
|
||||
var moduleStartRe = regexp.MustCompile(`(?:^|,)\s*(\d+)\s*:\s*(?:function\s*\(\s*[\w$,\s]*\s*\)|\(\s*[\w$,\s]*\s*\)\s*=>)\s*\{`)
|
||||
|
||||
func buildModuleStarts(text string) []int {
|
||||
matches := moduleStartRe.FindAllStringSubmatchIndex(text, -1)
|
||||
@@ -497,6 +625,38 @@ func moduleStartForPos(moduleStarts []int, pos int) int {
|
||||
return moduleStarts[index]
|
||||
}
|
||||
|
||||
func buildModuleImportIndex(text string, moduleStarts []int) map[int]map[string]int {
|
||||
if len(moduleStarts) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
moduleMatches := moduleStartRe.FindAllStringSubmatchIndex(text, -1)
|
||||
moduleStartByID := make(map[string]int, len(moduleMatches))
|
||||
for _, match := range moduleMatches {
|
||||
moduleStartByID[text[match[2]:match[3]]] = match[0]
|
||||
}
|
||||
|
||||
importsByModule := make(map[int]map[string]int)
|
||||
for index, moduleStart := range moduleStarts {
|
||||
moduleEnd := len(text)
|
||||
if index+1 < len(moduleStarts) {
|
||||
moduleEnd = moduleStarts[index+1]
|
||||
}
|
||||
body := text[moduleStart:moduleEnd]
|
||||
for _, match := range moduleImportRe.FindAllStringSubmatch(body, -1) {
|
||||
targetModuleStart, ok := moduleStartByID[match[2]]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if importsByModule[moduleStart] == nil {
|
||||
importsByModule[moduleStart] = make(map[string]int)
|
||||
}
|
||||
importsByModule[moduleStart][match[1]] = targetModuleStart
|
||||
}
|
||||
}
|
||||
return importsByModule
|
||||
}
|
||||
|
||||
// ExtractProtos extracts proto definitions from formatted JS file
|
||||
func ExtractProtos(inputFile, outputDir string) {
|
||||
activeDiagnostics = newExtractionDiagnostics()
|
||||
@@ -512,7 +672,8 @@ func ExtractProtos(inputFile, outputDir string) {
|
||||
|
||||
text := string(content)
|
||||
moduleStarts := buildModuleStarts(text)
|
||||
aliases := buildAliasIndex(text)
|
||||
aliases := buildAliasIndex(text, moduleStarts)
|
||||
exportAliases := buildWebpackExportAliasIndex(text, moduleStarts)
|
||||
|
||||
// Extract messages, enums, and services
|
||||
messages := extractMessages(text, moduleStarts)
|
||||
@@ -524,7 +685,8 @@ func ExtractProtos(inputFile, outputDir string) {
|
||||
}
|
||||
}
|
||||
|
||||
resolver := newTypeResolver(messages, enums, aliases)
|
||||
resolver := newTypeResolver(messages, enums, aliases, exportAliases)
|
||||
resolver.moduleImports = buildModuleImportIndex(text, moduleStarts)
|
||||
|
||||
// Generate proto files
|
||||
generateProtos(messages, enums, services, resolver, outputDir)
|
||||
@@ -900,6 +1062,8 @@ func parseFieldObject(obj string) (*Field, error) {
|
||||
} else {
|
||||
field.T = tMatch[1]
|
||||
}
|
||||
} else if shorthandTRe.MatchString(obj) {
|
||||
field.T = "T"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1195,8 +1359,9 @@ func copyAllExternalTypes(pkgName string, pkg struct {
|
||||
neededTypes := make(map[string]bool)
|
||||
|
||||
for _, msg := range result.messages {
|
||||
preferredPkg, _ := parseTypeName(msg.TypeName)
|
||||
for _, f := range msg.Fields {
|
||||
collectFieldRefsSimple(f, pkgName, msg.Pos, msg.ModuleStart, resolver, neededTypes, localTypes)
|
||||
collectFieldRefsSimple(f, pkgName, preferredPkg, msg.Pos, msg.ModuleStart, resolver, neededTypes, localTypes)
|
||||
}
|
||||
}
|
||||
for _, svc := range result.services {
|
||||
@@ -1268,7 +1433,7 @@ func copyAllExternalTypes(pkgName string, pkg struct {
|
||||
}
|
||||
|
||||
// collectFieldRefsSimple collects external type references from a field (non-recursive, just this field)
|
||||
func collectFieldRefsSimple(f Field, currentPkg string, contextPos int, contextModuleStart int, resolver *TypeResolver,
|
||||
func collectFieldRefsSimple(f Field, currentPkg string, preferredPkg string, contextPos int, contextModuleStart int, resolver *TypeResolver,
|
||||
neededTypes map[string]bool, localTypes map[string]bool) {
|
||||
|
||||
type refWithKind struct {
|
||||
@@ -1289,7 +1454,7 @@ func collectFieldRefsSimple(f Field, currentPkg string, contextPos int, contextM
|
||||
}
|
||||
|
||||
for _, item := range refs {
|
||||
typeName, ok := resolver.ResolveTypeName(item.ref, contextPos, contextModuleStart, currentPkg, item.kind)
|
||||
typeName, ok := resolver.ResolveTypeName(item.ref, contextPos, contextModuleStart, preferredPkg, item.kind)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
@@ -1637,6 +1802,7 @@ func writeMessageFields(msg *Message, sb *strings.Builder, resolver *TypeResolve
|
||||
// Get the current message's path prefix for relative type resolution
|
||||
msgPath := msg.ShortName
|
||||
currentPkg := msg.Package
|
||||
preferredPkg, _ := parseTypeName(msg.TypeName)
|
||||
|
||||
// Group fields by oneof
|
||||
oneofGroups := make(map[string][]Field)
|
||||
@@ -1652,7 +1818,7 @@ func writeMessageFields(msg *Message, sb *strings.Builder, resolver *TypeResolve
|
||||
|
||||
// Write regular fields
|
||||
for _, f := range regularFields {
|
||||
fieldType := resolveFieldTypeWithPkg(f, resolver, msgPath, currentPkg, msg.Pos, msg.ModuleStart)
|
||||
fieldType := resolveFieldTypeWithPkg(f, resolver, msgPath, currentPkg, preferredPkg, msg.Pos, msg.ModuleStart)
|
||||
prefix := ""
|
||||
if f.Repeated {
|
||||
prefix = "repeated "
|
||||
@@ -1673,7 +1839,7 @@ func writeMessageFields(msg *Message, sb *strings.Builder, resolver *TypeResolve
|
||||
fields := oneofGroups[oneofName]
|
||||
sb.WriteString(fmt.Sprintf("%soneof %s {\n", indentStr, oneofName))
|
||||
for _, f := range fields {
|
||||
fieldType := resolveFieldTypeWithPkg(f, resolver, msgPath, currentPkg, msg.Pos, msg.ModuleStart)
|
||||
fieldType := resolveFieldTypeWithPkg(f, resolver, msgPath, currentPkg, preferredPkg, msg.Pos, msg.ModuleStart)
|
||||
sb.WriteString(fmt.Sprintf("%s %s %s = %d;\n", indentStr, fieldType, f.Name, f.No))
|
||||
}
|
||||
sb.WriteString(fmt.Sprintf("%s}\n", indentStr))
|
||||
@@ -1721,15 +1887,15 @@ func getNestedPath(shortName string) []string {
|
||||
}
|
||||
|
||||
func resolveFieldType(f Field, resolver *TypeResolver, contextPos int, contextModuleStart int) string {
|
||||
return resolveFieldTypeWithPkg(f, resolver, "", "", contextPos, contextModuleStart)
|
||||
return resolveFieldTypeWithPkg(f, resolver, "", "", "", contextPos, contextModuleStart)
|
||||
}
|
||||
|
||||
// resolveFieldTypeWithPkg resolves field type with package awareness
|
||||
// parentPath is like "ConversationMessage" or "ConversationMessage.ToolResult"
|
||||
// currentPkg is the package of the current message being written (e.g., "agent.v1")
|
||||
func resolveFieldTypeWithPkg(f Field, resolver *TypeResolver, parentPath string, currentPkg string, contextPos int, contextModuleStart int) string {
|
||||
func resolveFieldTypeWithPkg(f Field, resolver *TypeResolver, parentPath string, currentPkg string, preferredPkg string, contextPos int, contextModuleStart int) string {
|
||||
resolveNamedType := func(ref string, expectedKind string) string {
|
||||
typeName, ok := resolver.ResolveTypeName(ref, contextPos, contextModuleStart, currentPkg, expectedKind)
|
||||
typeName, ok := resolver.ResolveTypeName(ref, contextPos, contextModuleStart, preferredPkg, expectedKind)
|
||||
if !ok {
|
||||
activeDiagnostics.addUnresolvedType(expectedKind + ":" + ref)
|
||||
return fallbackTypeToken(ref)
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseFieldObjectSupportsShorthandType(t *testing.T) {
|
||||
field, err := parseFieldObject(`{no:4,name:"file_not_found",kind:"message",T,oneof:"result"}`)
|
||||
if err != nil {
|
||||
t.Fatalf("parse shorthand T: %v", err)
|
||||
}
|
||||
if field.T != "T" {
|
||||
t.Fatalf("parsed shorthand T as %#v, want T", field.T)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWebpackExportAliasResolvesServiceMessageType(t *testing.T) {
|
||||
const bundle = `
|
||||
1:(e,t,n)=>{
|
||||
n.d(t,{KS:()=>T,_B:()=>r});
|
||||
var r;
|
||||
class T {}
|
||||
T.typeName="agent.v1.AgentClientMessage";
|
||||
n.proto3.util.setEnumType(r,"agent.v1.DiagnosticSeverity",[]);
|
||||
},
|
||||
2:(e,t,n)=>{
|
||||
var r=n(1);
|
||||
const service={typeName:"agent.v1.AgentService",methods:{run:{name:"Run",I:r.KS,O:r.KS,kind:n.MethodKind.BiDiStreaming}}};
|
||||
}`
|
||||
|
||||
moduleStarts := buildModuleStarts(bundle)
|
||||
messages := []Message{{
|
||||
TypeName: "agent.v1.AgentClientMessage",
|
||||
VarName: "T",
|
||||
InternalName: "T",
|
||||
Package: "agent.v1",
|
||||
Pos: 35,
|
||||
ModuleStart: moduleStartForPos(moduleStarts, 35),
|
||||
}}
|
||||
enums := []Enum{{
|
||||
TypeName: "agent.v1.DiagnosticSeverity",
|
||||
VarName: "r",
|
||||
Package: "agent.v1",
|
||||
Pos: 100,
|
||||
ModuleStart: moduleStartForPos(moduleStarts, 100),
|
||||
}}
|
||||
|
||||
resolver := newTypeResolver(messages, enums, buildAliasIndex(bundle, moduleStarts), buildWebpackExportAliasIndex(bundle, moduleStarts))
|
||||
resolver.moduleImports = buildModuleImportIndex(bundle, moduleStarts)
|
||||
typeName, ok := resolver.ResolveTypeName("r.KS", len(bundle)-1, moduleStartForPos(moduleStarts, len(bundle)-1), "agent.v1", "message")
|
||||
if !ok {
|
||||
t.Fatal("expected webpack export alias to resolve")
|
||||
}
|
||||
if typeName != "agent.v1.AgentClientMessage" {
|
||||
t.Fatalf("resolved r.KS to %q, want agent.v1.AgentClientMessage", typeName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolverPrefersExpectedKindOverCurrentPackage(t *testing.T) {
|
||||
resolver := &TypeResolver{bySymbol: map[string][]symbolDef{
|
||||
"nt": {
|
||||
{TypeName: "git_forge.v1.GetTagResponse", Kind: "message", Pos: 10, ModuleStart: 1},
|
||||
{TypeName: "origin.v1.TeamGroupKind", Kind: "enum", Pos: 20, ModuleStart: 1},
|
||||
},
|
||||
}}
|
||||
|
||||
typeName, ok := resolver.ResolveTypeName("nt", 30, 1, "origin.v1", "message")
|
||||
if !ok {
|
||||
t.Fatal("expected cross-package message type to resolve")
|
||||
}
|
||||
if typeName != "git_forge.v1.GetTagResponse" {
|
||||
t.Fatalf("resolved nt to %q, want git_forge.v1.GetTagResponse", typeName)
|
||||
}
|
||||
}
|
||||
@@ -2,22 +2,8 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SNAPSHOT_DEFAULT="$SCRIPT_DIR/extensions-cursor-app/cursor-always-local"
|
||||
INSTALLED_CURSOR_DEFAULT="/Applications/Cursor.app/Contents/Resources/app/extensions/cursor-always-local/dist/main.js"
|
||||
LATEST_EXT_DIR="$(
|
||||
find "$SCRIPT_DIR" -maxdepth 1 -type d -name 'extensions-*' 2>/dev/null \
|
||||
| sort -V \
|
||||
| tail -n 1
|
||||
)"
|
||||
if [[ -f "$SNAPSHOT_DEFAULT/dist/main.js" ]]; then
|
||||
INPUT_DEFAULT="$SNAPSHOT_DEFAULT"
|
||||
elif [[ -f "$INSTALLED_CURSOR_DEFAULT" ]]; then
|
||||
INPUT_DEFAULT="$INSTALLED_CURSOR_DEFAULT"
|
||||
elif [[ -n "$LATEST_EXT_DIR" ]]; then
|
||||
INPUT_DEFAULT="$LATEST_EXT_DIR"
|
||||
else
|
||||
INPUT_DEFAULT="$SCRIPT_DIR/extensions-2.6.19"
|
||||
fi
|
||||
INPUT_DEFAULT="$INSTALLED_CURSOR_DEFAULT"
|
||||
OUTPUT_DEFAULT="$SCRIPT_DIR/from_extensions"
|
||||
|
||||
INPUT_PATH="${1:-$INPUT_DEFAULT}"
|
||||
@@ -57,7 +43,8 @@ fi
|
||||
|
||||
if [[ ! -f "$INPUT_PATH" ]]; then
|
||||
echo "Input JS not found: $INPUT_PATH" >&2
|
||||
echo "Usage: $0 [input-js-file-or-extensions-dir] [output-dir]" >&2
|
||||
echo "Install/update Cursor, or pass an explicit input bundle:" >&2
|
||||
echo " $0 /path/to/cursor-always-local/dist/main.js [output-dir]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
+10896
-4348
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,809 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package git_forge.v1;
|
||||
|
||||
option go_package = "react-admin/cursor-server/gen/git_forge/v1;git_forgev1";
|
||||
|
||||
// Copied from: local:git_forge.v1.BatchGetRepoContentRequest (var: Qt)
|
||||
message BatchGetRepoContentRequest {
|
||||
string repo_uuid = 1;
|
||||
string revision = 2;
|
||||
repeated string paths = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.BatchGetRepoContentResponse (var: Ht)
|
||||
message BatchGetRepoContentResponse {
|
||||
repeated BatchRepoContentResult results = 1;
|
||||
string resolved_commit_sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.BatchRepoContentResult (var: Gt)
|
||||
message BatchRepoContentResult {
|
||||
string path = 1;
|
||||
bool found = 2;
|
||||
oneof content {
|
||||
FileContent file_content = 3;
|
||||
DirectoryContent directory_content = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.BlameChunk (var: sn)
|
||||
message BlameChunk {
|
||||
repeated ShortCommit commits = 1;
|
||||
repeated BlameLineRange line_ranges = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.BlameLineRange (var: rn)
|
||||
message BlameLineRange {
|
||||
bytes commit_sha = 1;
|
||||
uint32 start_in_blamed_file = 2;
|
||||
uint32 len = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CanMergeRequest (var: ft)
|
||||
message CanMergeRequest {
|
||||
string repo_uuid = 1;
|
||||
string ours = 2;
|
||||
string theirs = 3;
|
||||
uint64 change_number = 4;
|
||||
MergeMode mode = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CanMergeResponse (var: gt)
|
||||
message CanMergeResponse {
|
||||
bool can_merge_without_conflicts = 1;
|
||||
optional bytes merged_tree_sha = 2;
|
||||
repeated string conflicted_paths = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ChangeKind (var: _)
|
||||
enum ChangeKind {
|
||||
CHANGE_KIND_UNSPECIFIED = 0;
|
||||
CHANGE_KIND_ADDED = 1;
|
||||
CHANGE_KIND_DELETED = 2;
|
||||
CHANGE_KIND_MODIFIED = 3;
|
||||
CHANGE_KIND_RENAMED = 4;
|
||||
CHANGE_KIND_COPIED = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ChangedFile (var: Nn)
|
||||
message ChangedFile {
|
||||
string path = 1;
|
||||
optional string old_path = 2;
|
||||
ChangeKind change_kind = 3;
|
||||
optional FileMode old_mode = 4;
|
||||
optional FileMode new_mode = 5;
|
||||
optional string old_sha = 6;
|
||||
optional string new_sha = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ChangedFileWithStats (var: Pn)
|
||||
message ChangedFileWithStats {
|
||||
string path = 1;
|
||||
optional string old_path = 2;
|
||||
ChangeKind change_kind = 3;
|
||||
bool is_binary = 4;
|
||||
int32 additions = 5;
|
||||
int32 deletions = 6;
|
||||
optional FileMode old_mode = 7;
|
||||
optional FileMode new_mode = 8;
|
||||
optional string old_sha = 9;
|
||||
optional string new_sha = 10;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.Commit (var: bt)
|
||||
message Commit {
|
||||
string sha = 1;
|
||||
string message = 2;
|
||||
Signature author = 3;
|
||||
Signature committer = 4;
|
||||
repeated string parent_shas = 5;
|
||||
string tree_sha = 7;
|
||||
optional string change_id = 8;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitDiffChunk (var: Jn)
|
||||
message CommitDiffChunk {
|
||||
optional CommitDiffHeader header = 1;
|
||||
repeated FileDiff file_diffs = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitDiffHeader (var: Bn)
|
||||
message CommitDiffHeader {
|
||||
Commit commit = 1;
|
||||
optional string base_commit_sha = 2;
|
||||
CommitDiffStats stats = 3;
|
||||
repeated ChangedFileWithStats changed_files = 4;
|
||||
bool has_more = 5;
|
||||
optional string next_page_cursor = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitDiffStats (var: Rn)
|
||||
message CommitDiffStats {
|
||||
uint32 files_changed = 1;
|
||||
int32 additions = 2;
|
||||
int32 deletions = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitFileDelete (var: Ct)
|
||||
message CommitFileDelete {
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitFileMode (var: g)
|
||||
enum CommitFileMode {
|
||||
COMMIT_FILE_MODE_UNSPECIFIED = 0;
|
||||
COMMIT_FILE_MODE_REGULAR = 1;
|
||||
COMMIT_FILE_MODE_EXECUTABLE = 2;
|
||||
COMMIT_FILE_MODE_SYMLINK = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitFileOperation (var: Nt)
|
||||
message CommitFileOperation {
|
||||
string path = 1;
|
||||
oneof operation {
|
||||
CommitFileUpsert upsert = 2;
|
||||
CommitFileDelete delete = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CommitFileUpsert (var: Jt)
|
||||
message CommitFileUpsert {
|
||||
bytes content = 1;
|
||||
CommitFileMode mode = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CompareCommitsRequest (var: dt)
|
||||
message CompareCommitsRequest {
|
||||
string repo_uuid = 1;
|
||||
string base_revision = 2;
|
||||
string head_revision = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CompareCommitsResponse (var: pt)
|
||||
message CompareCommitsResponse {
|
||||
CompareCommitsStatus status = 1;
|
||||
int32 ahead_by = 2;
|
||||
int32 behind_by = 3;
|
||||
string base_commit_sha = 4;
|
||||
string head_commit_sha = 5;
|
||||
string merge_base_commit_sha = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CompareCommitsStatus (var: p)
|
||||
enum CompareCommitsStatus {
|
||||
COMPARE_COMMITS_STATUS_UNSPECIFIED = 0;
|
||||
COMPARE_COMMITS_STATUS_IDENTICAL = 1;
|
||||
COMPARE_COMMITS_STATUS_AHEAD = 2;
|
||||
COMPARE_COMMITS_STATUS_BEHIND = 3;
|
||||
COMPARE_COMMITS_STATUS_DIVERGED = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ComputeMergeCommitRequest (var: _t)
|
||||
message ComputeMergeCommitRequest {
|
||||
string repo_uuid = 1;
|
||||
string ours_sha = 2;
|
||||
string theirs_sha = 3;
|
||||
string message = 4;
|
||||
Signature author = 5;
|
||||
Signature committer = 6;
|
||||
MergeMode mode = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ComputeMergeCommitResponse (var: Tt)
|
||||
message ComputeMergeCommitResponse {
|
||||
string merge_commit_sha = 1;
|
||||
bytes packfile = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateCommitFromFilesRequest (var: Rt)
|
||||
message CreateCommitFromFilesRequest {
|
||||
string repo_uuid = 1;
|
||||
string target_ref = 2;
|
||||
optional string expected_head_sha = 3;
|
||||
string message = 4;
|
||||
Signature author = 5;
|
||||
optional Signature committer = 6;
|
||||
repeated CommitFileOperation files = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateCommitFromFilesResponse (var: Pt)
|
||||
message CreateCommitFromFilesResponse {
|
||||
string commit_sha = 1;
|
||||
string tree_sha = 2;
|
||||
string old_head_sha = 3;
|
||||
string wal_entry_key = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateMergeCommitRequest (var: ht)
|
||||
message CreateMergeCommitRequest {
|
||||
string repo_uuid = 1;
|
||||
optional string ours_sha = 2;
|
||||
optional string theirs_sha = 3;
|
||||
string ours_ref = 4;
|
||||
string theirs_ref = 5;
|
||||
string message = 6;
|
||||
Signature author = 7;
|
||||
Signature committer = 8;
|
||||
uint64 change_number = 9;
|
||||
MergeMode mode = 10;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateMergeCommitResponse (var: At)
|
||||
message CreateMergeCommitResponse {
|
||||
string merge_commit_sha = 1;
|
||||
string wal_entry_key = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateRepoRequest (var: wn)
|
||||
message CreateRepoRequest {
|
||||
string repo_uuid = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.CreateRepoResponse (var: En)
|
||||
message CreateRepoResponse {
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.DiffHeader (var: Cn)
|
||||
message DiffHeader {
|
||||
string merge_base_commit_sha = 1;
|
||||
repeated ChangedFile files = 2;
|
||||
repeated ChangedFileWithStats files_with_stats = 3;
|
||||
bool has_more = 4;
|
||||
optional string next_page_cursor = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.DirectoryContent (var: qt)
|
||||
message DirectoryContent {
|
||||
repeated RepoContentEntry entries = 1;
|
||||
string sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FastForwardRefRequest (var: qn)
|
||||
message FastForwardRefRequest {
|
||||
string repo_uuid = 1;
|
||||
string target_ref = 2;
|
||||
string expected_head_sha = 3;
|
||||
string new_head_sha = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FastForwardRefResponse (var: Dn)
|
||||
message FastForwardRefResponse {
|
||||
string old_head_sha = 1;
|
||||
string new_head_sha = 2;
|
||||
string wal_entry_key = 3;
|
||||
bool unchanged = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileContent (var: Ft)
|
||||
message FileContent {
|
||||
string size = 1;
|
||||
string encoding = 2;
|
||||
string content = 3;
|
||||
string sha = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileDiff (var: bn)
|
||||
message FileDiff {
|
||||
string path = 1;
|
||||
optional string old_path = 2;
|
||||
bool is_binary = 3;
|
||||
string patch = 4;
|
||||
int32 additions = 5;
|
||||
int32 deletions = 6;
|
||||
optional FileMode old_mode = 7;
|
||||
optional FileMode new_mode = 8;
|
||||
optional string old_sha = 9;
|
||||
optional string new_sha = 10;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileHistoryCommitEntry (var: Zt)
|
||||
message FileHistoryCommitEntry {
|
||||
ShortCommit commit = 1;
|
||||
optional string diff_base_commit_sha = 2;
|
||||
optional FileHistoryPathStats path_stats = 8;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileHistoryPathStats (var: Xt)
|
||||
message FileHistoryPathStats {
|
||||
int32 additions = 1;
|
||||
int32 deletions = 2;
|
||||
bool is_binary = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileHistoryWithDiffStatsChunk (var: en)
|
||||
message FileHistoryWithDiffStatsChunk {
|
||||
repeated FileHistoryCommitEntry entries = 1;
|
||||
bool exhausted = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.FileMode (var: A)
|
||||
enum FileMode {
|
||||
FILE_MODE_UNSPECIFIED = 0;
|
||||
FILE_MODE_REGULAR = 1;
|
||||
FILE_MODE_EXECUTABLE = 2;
|
||||
FILE_MODE_SYMLINK = 3;
|
||||
FILE_MODE_GITLINK = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetBlameRequest (var: nn)
|
||||
message GetBlameRequest {
|
||||
string repo_uuid = 1;
|
||||
string start_commit_sha = 2;
|
||||
string path = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetBlobRequest (var: $e)
|
||||
message GetBlobRequest {
|
||||
string repo_uuid = 1;
|
||||
string blob_sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetBlobResponse (var: et)
|
||||
message GetBlobResponse {
|
||||
FileContent blob = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetCommitDiffRequest (var: vn)
|
||||
message GetCommitDiffRequest {
|
||||
string repo_uuid = 1;
|
||||
string commit_sha = 2;
|
||||
optional string base_commit_sha = 3;
|
||||
bool include_patches = 4;
|
||||
repeated string paths = 5;
|
||||
optional uint32 page_size = 6;
|
||||
optional string page_cursor = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetCommitRequest (var: Xe)
|
||||
message GetCommitRequest {
|
||||
string repo_uuid = 1;
|
||||
string commit_sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetCommitResponse (var: Ze)
|
||||
message GetCommitResponse {
|
||||
Commit commit = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFileHistoryPageWithDiffStatsResponse (var: tn)
|
||||
message GetFileHistoryPageWithDiffStatsResponse {
|
||||
repeated FileHistoryCommitEntry entries = 1;
|
||||
bool has_more = 2;
|
||||
optional string next_cursor = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFileHistoryRequest (var: Wt)
|
||||
message GetFileHistoryRequest {
|
||||
string repo_uuid = 1;
|
||||
string start_commit_sha = 2;
|
||||
optional string path = 3;
|
||||
uint32 max_commits = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFileHistoryResponse (var: zt)
|
||||
message GetFileHistoryResponse {
|
||||
repeated ShortCommit commits = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFileHistoryWithDiffStatsRequest (var: jt)
|
||||
message GetFileHistoryWithDiffStatsRequest {
|
||||
string repo_uuid = 1;
|
||||
string start_commit_sha = 2;
|
||||
optional string path = 3;
|
||||
uint32 max_commits = 4;
|
||||
optional string next_cursor = 5;
|
||||
bool include_diff_stats = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFileHistoryWithDiffStatsResponse (var: $t)
|
||||
message GetFileHistoryWithDiffStatsResponse {
|
||||
repeated FileHistoryCommitEntry entries = 1;
|
||||
bool has_more = 2;
|
||||
optional string next_cursor = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFuzzyPathsRequest (var: un)
|
||||
message GetFuzzyPathsRequest {
|
||||
string repo_uuid = 1;
|
||||
string commit_sha = 2;
|
||||
string query = 3;
|
||||
uint32 limit = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetFuzzyPathsResponse (var: mn)
|
||||
message GetFuzzyPathsResponse {
|
||||
repeated string paths = 1;
|
||||
bool has_more = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetLocalDevInfoRequest (var: ze)
|
||||
message GetLocalDevInfoRequest {
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetLocalDevInfoResponse (var: je)
|
||||
message GetLocalDevInfoResponse {
|
||||
string repo_uuid = 1;
|
||||
string git_forge_root_dir = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetPullRequestDiffRequest (var: Sn)
|
||||
message GetPullRequestDiffRequest {
|
||||
string repo_uuid = 1;
|
||||
string head_commit_sha = 2;
|
||||
string base_commit_sha = 3;
|
||||
optional bool include_patches = 4;
|
||||
optional uint32 page_size = 5;
|
||||
optional string page_cursor = 6;
|
||||
optional bool include_file_stats = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetRepoContentDetailsRequest (var: Yt)
|
||||
message GetRepoContentDetailsRequest {
|
||||
string repo_uuid = 1;
|
||||
PathIdentifier path_identifier = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetRepoContentDetailsResponse (var: Kt)
|
||||
message GetRepoContentDetailsResponse {
|
||||
optional RepoContentDetails details = 1;
|
||||
PathIdentifier path_identifier = 2;
|
||||
string resolved_commit_sha = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetRepoContentRequest (var: Ut)
|
||||
message GetRepoContentRequest {
|
||||
string repo_uuid = 1;
|
||||
oneof id {
|
||||
PathIdentifier path_identifier = 2;
|
||||
string ref_and_path = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetRepoContentResponse (var: xt)
|
||||
message GetRepoContentResponse {
|
||||
PathIdentifier path_identifier = 3;
|
||||
string resolved_commit_sha = 4;
|
||||
oneof content {
|
||||
FileContent file_content = 1;
|
||||
DirectoryContent directory_content = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTagRequest (var: tt)
|
||||
message GetTagRequest {
|
||||
string repo_uuid = 1;
|
||||
string tag_sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTagResponse (var: nt)
|
||||
message GetTagResponse {
|
||||
Tag tag = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTreeBlameRequest (var: on)
|
||||
message GetTreeBlameRequest {
|
||||
string repo_uuid = 1;
|
||||
string start_commit_sha = 2;
|
||||
string path = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTreeBlameResponse (var: ln)
|
||||
message GetTreeBlameResponse {
|
||||
repeated TreeEntryBlame entries = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTreeRequest (var: rt)
|
||||
message GetTreeRequest {
|
||||
string repo_uuid = 1;
|
||||
string tree_sha = 2;
|
||||
bool recursive = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GetTreeResponse (var: st)
|
||||
message GetTreeResponse {
|
||||
Tree tree = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepLineKind (var: h)
|
||||
enum GrepLineKind {
|
||||
GREP_LINE_KIND_UNSPECIFIED = 0;
|
||||
GREP_LINE_KIND_MATCH = 1;
|
||||
GREP_LINE_KIND_CONTEXT = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepMatch (var: hn)
|
||||
message GrepMatch {
|
||||
string path = 1;
|
||||
string lines = 2;
|
||||
uint32 line_number = 3;
|
||||
uint64 absolute_offset = 4;
|
||||
repeated GrepSubmatch submatches = 5;
|
||||
GrepLineKind kind = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepRepoChunk (var: An)
|
||||
message GrepRepoChunk {
|
||||
repeated GrepMatch matches = 1;
|
||||
bool limit_hit = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepRepoRequest (var: fn)
|
||||
message GrepRepoRequest {
|
||||
string repo_uuid = 1;
|
||||
string revision = 2;
|
||||
string query = 3;
|
||||
GrepSearchOptions options = 4;
|
||||
uint32 max_results = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepSearchOptions (var: pn)
|
||||
message GrepSearchOptions {
|
||||
bool literal = 1;
|
||||
bool case_insensitive = 2;
|
||||
bool whole_word = 3;
|
||||
uint32 context_before = 4;
|
||||
uint32 context_after = 5;
|
||||
optional uint64 max_lines = 6;
|
||||
optional string filter_path = 7;
|
||||
repeated string includes = 8;
|
||||
repeated string excludes = 9;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.GrepSubmatch (var: gn)
|
||||
message GrepSubmatch {
|
||||
uint32 start = 1;
|
||||
uint32 end = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListCommitsInRangeRequest (var: mt)
|
||||
message ListCommitsInRangeRequest {
|
||||
string repo_uuid = 1;
|
||||
string base_revision = 2;
|
||||
string head_revision = 3;
|
||||
optional int32 max_commits = 4;
|
||||
bool oldest_first = 5;
|
||||
ListCommitsSort sort = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListCommitsInRangeResponse (var: ct)
|
||||
message ListCommitsInRangeResponse {
|
||||
repeated Commit commits = 1;
|
||||
string base_commit_sha = 2;
|
||||
string head_commit_sha = 3;
|
||||
string merge_base_commit_sha = 4;
|
||||
bool truncated = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListCommitsRequest (var: lt)
|
||||
message ListCommitsRequest {
|
||||
string repo_uuid = 1;
|
||||
string revision = 2;
|
||||
int32 page = 3;
|
||||
int32 per_page = 4;
|
||||
ListCommitsSort sort = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListCommitsResponse (var: ut)
|
||||
message ListCommitsResponse {
|
||||
repeated Commit commits = 1;
|
||||
optional int32 next_page = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListCommitsSort (var: y)
|
||||
enum ListCommitsSort {
|
||||
LIST_COMMITS_SORT_UNSPECIFIED = 0;
|
||||
LIST_COMMITS_SORT_COMMIT_TIME = 1;
|
||||
LIST_COMMITS_SORT_TOPOLOGICAL = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListRefsFilter (var: T)
|
||||
enum ListRefsFilter {
|
||||
LIST_REFS_FILTER_UNSPECIFIED = 0;
|
||||
LIST_REFS_FILTER_ALL = 1;
|
||||
LIST_REFS_FILTER_BRANCHES = 2;
|
||||
LIST_REFS_FILTER_TAGS = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListRefsRequest (var: Mn)
|
||||
message ListRefsRequest {
|
||||
string repo_uuid = 1;
|
||||
ListRefsFilter filter = 2;
|
||||
bool names_only = 3;
|
||||
string prefix = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListRefsResponse (var: Fn)
|
||||
message ListRefsResponse {
|
||||
repeated string refs = 1;
|
||||
repeated RefInfo ref_infos = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListTreePathsRequest (var: cn)
|
||||
message ListTreePathsRequest {
|
||||
string repo_uuid = 1;
|
||||
string revision = 2;
|
||||
repeated string includes = 3;
|
||||
repeated string excludes = 4;
|
||||
uint32 limit = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ListTreePathsResponse (var: dn)
|
||||
message ListTreePathsResponse {
|
||||
repeated string paths = 1;
|
||||
bool has_more = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.MergeMode (var: f)
|
||||
enum MergeMode {
|
||||
MERGE_MODE_UNSPECIFIED = 0;
|
||||
MERGE_MODE_MERGE_COMMIT = 1;
|
||||
MERGE_MODE_SQUASH = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.NotifyRepoPushedRequest (var: _n)
|
||||
message NotifyRepoPushedRequest {
|
||||
string repo_uuid = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.NotifyRepoPushedResponse (var: Tn)
|
||||
message NotifyRepoPushedResponse {
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.PathIdentifier (var: Lt)
|
||||
message PathIdentifier {
|
||||
string revision = 1;
|
||||
string path = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.PrepareChangeMergeRequest (var: yt)
|
||||
message PrepareChangeMergeRequest {
|
||||
string repo_uuid = 1;
|
||||
string base_ref = 2;
|
||||
string head_ref = 3;
|
||||
uint64 change_number = 4;
|
||||
optional string expected_base_sha = 5;
|
||||
optional string expected_head_sha = 6;
|
||||
MergeMode mode = 7;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.PrepareChangeMergeResponse (var: kt)
|
||||
message PrepareChangeMergeResponse {
|
||||
bool mergeable = 1;
|
||||
optional string merged_tree_sha = 2;
|
||||
optional string change_merge_ref = 3;
|
||||
optional string dummy_commit_sha = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.PullRequestDiffChunk (var: In)
|
||||
message PullRequestDiffChunk {
|
||||
optional DiffHeader header = 1;
|
||||
repeated FileDiff file_diffs = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackBranch (var: Et)
|
||||
message RebaseStackBranch {
|
||||
string head_ref = 1;
|
||||
string expected_old_oid = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackBranchUpdate (var: vt)
|
||||
message RebaseStackBranchUpdate {
|
||||
string head_ref = 1;
|
||||
string old_oid = 2;
|
||||
string new_oid = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackConflict (var: Bt)
|
||||
message RebaseStackConflict {
|
||||
string conflicted_head_ref = 1;
|
||||
repeated string conflicted_paths = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackRequest (var: wt)
|
||||
message RebaseStackRequest {
|
||||
string repo_uuid = 1;
|
||||
string onto_ref = 2;
|
||||
optional string expected_onto_oid = 3;
|
||||
repeated RebaseStackBranch branches = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackResponse (var: St)
|
||||
message RebaseStackResponse {
|
||||
oneof result {
|
||||
RebaseStackSuccess success = 1;
|
||||
RebaseStackConflict conflict = 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RebaseStackSuccess (var: It)
|
||||
message RebaseStackSuccess {
|
||||
string wal_entry_key = 1;
|
||||
repeated RebaseStackBranchUpdate updates = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RefInfo (var: Ln)
|
||||
message RefInfo {
|
||||
string name = 1;
|
||||
string target_sha = 2;
|
||||
string object_sha = 3;
|
||||
string object_type = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RepoContentDetails (var: Vt)
|
||||
message RepoContentDetails {
|
||||
string type = 1;
|
||||
optional uint64 size = 2;
|
||||
bool is_binary = 3;
|
||||
bool too_large_to_introspect = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.RepoContentEntry (var: kn)
|
||||
message RepoContentEntry {
|
||||
string type = 1;
|
||||
string name = 2;
|
||||
string path = 3;
|
||||
string sha = 4;
|
||||
optional uint64 size = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ResolveRefPathRequest (var: Dt)
|
||||
message ResolveRefPathRequest {
|
||||
string repo_uuid = 1;
|
||||
string ref_path = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ResolveRefPathResponse (var: Ot)
|
||||
message ResolveRefPathResponse {
|
||||
PathIdentifier path_identifier = 1;
|
||||
string resolved_commit_sha = 2;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.ShortCommit (var: yn)
|
||||
message ShortCommit {
|
||||
bytes sha = 1;
|
||||
string summary = 2;
|
||||
string author_name = 3;
|
||||
string author_email = 4;
|
||||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.Signature (var: Mt)
|
||||
message Signature {
|
||||
string name = 1;
|
||||
string email = 2;
|
||||
int64 timestamp = 3;
|
||||
int32 timezone_offset = 4;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.Tag (var: at)
|
||||
message Tag {
|
||||
string sha = 1;
|
||||
string name = 2;
|
||||
string message = 3;
|
||||
Signature tagger = 4;
|
||||
string object_sha = 5;
|
||||
string object_type = 6;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.Tree (var: ot)
|
||||
message Tree {
|
||||
string sha = 1;
|
||||
repeated TreeEntry tree = 2;
|
||||
bool truncated = 3;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.TreeEntry (var: it)
|
||||
message TreeEntry {
|
||||
string path = 1;
|
||||
string mode = 2;
|
||||
string type = 3;
|
||||
string sha = 4;
|
||||
optional uint64 size = 5;
|
||||
}
|
||||
|
||||
// Copied from: local:git_forge.v1.TreeEntryBlame (var: an)
|
||||
message TreeEntryBlame {
|
||||
string name = 1;
|
||||
ShortCommit last_commit = 2;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package internapi.v1;
|
||||
|
||||
option go_package = "react-admin/cursor-server/gen/internapi/v1;internapiv1";
|
||||
|
||||
// Copied from: local:internapi.v1.BlobData (var: hxe)
|
||||
// Copied from: local:internapi.v1.BlobData (var: Mn)
|
||||
message BlobData {
|
||||
BlobType blob_type = 1;
|
||||
bytes blob_id = 2;
|
||||
@@ -14,12 +14,12 @@ message BlobData {
|
||||
}
|
||||
}
|
||||
|
||||
// Copied from: local:internapi.v1.BlobDataPerMessage (var: Txe)
|
||||
// Copied from: local:internapi.v1.BlobDataPerMessage (var: Ln)
|
||||
message BlobDataPerMessage {
|
||||
repeated BlobData blob_data = 1;
|
||||
}
|
||||
|
||||
// Copied from: local:internapi.v1.BlobType (var: Axe)
|
||||
// Copied from: local:internapi.v1.BlobType (var: Nn)
|
||||
enum BlobType {
|
||||
BLOB_TYPE_UNSPECIFIED = 0;
|
||||
BLOB_TYPE_IMAGE = 1;
|
||||
@@ -34,7 +34,7 @@ enum BlobType {
|
||||
BLOB_TYPE_VIDEO = 10;
|
||||
}
|
||||
|
||||
// Copied from: local:internapi.v1.ImageBlobData (var: pxe)
|
||||
// Copied from: local:internapi.v1.ImageBlobData (var: bn)
|
||||
message ImageBlobData {
|
||||
string mime_type = 1;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user