MCPcopy Create free account
hub / github.com/auth0/auth0-cli / DetectProject

Function DetectProject

internal/cli/quickstart_detect.go:32–288  ·  view source on GitHub ↗

DetectProject scans dir for framework signal files and returns a DetectionResult. Rules follow the priority order from the spec: config files beat package.json scanning.

(dir string)

Source from the content-addressed store, hash-verified

30// DetectProject scans dir for framework signal files and returns a DetectionResult.
31// Rules follow the priority order from the spec: config files beat package.json scanning.
32func DetectProject(dir string) DetectionResult {
33 result := DetectionResult{}
34
35 // Read package.json deps early - needed for checks that must precede file-based signals.
36 earlyDeps := readPackageJSONDeps(dir)
37
38 // -- 1. Manage.py (Django) — Checked before Ionic to prevent monorepo misdetection.
39 if fileExists(dir, "manage.py") {
40 result.Framework = "django"
41 result.Type = "regular"
42 result.Detected = true
43 return result
44 }
45
46 // -- 2. Ionic (package.json deps - Must check BEFORE angular.json and vite.config) --.
47 if hasDep(earlyDeps, "@ionic/angular") {
48 result.Framework = "ionic-angular"
49 result.Type = "native"
50 result.BundleID = readCapacitorAppID(dir)
51 result.Detected = true
52 return result
53 }
54 if hasDep(earlyDeps, "@ionic/react") {
55 result.Framework = "ionic-react"
56 result.Type = "native"
57 result.BuildTool = detectBuildToolFromFiles(dir, "ionic-react")
58 result.BundleID = readCapacitorAppID(dir)
59 result.Detected = true
60 return result
61 }
62 if hasDep(earlyDeps, "@ionic/vue") {
63 result.Framework = "ionic-vue"
64 result.Type = "native"
65 result.BuildTool = detectBuildToolFromFiles(dir, "ionic-vue")
66 result.BundleID = readCapacitorAppID(dir)
67 result.Detected = true
68 return result
69 }
70
71 // -- 3. Angular.json --.
72 if fileExists(dir, "angular.json") {
73 result.Framework = "angular"
74 result.Type = "spa"
75 result.Detected = true
76 return result
77 }
78
79 // -- 4. Pubspec.yaml (Flutter) --.
80 if data, ok := readFileContent(dir, "pubspec.yaml"); ok {
81 if strings.Contains(data, "sdk: flutter") {
82 result.Detected = true
83 // Android/iOS dirs signal native; flutter.web key signals web SPA; default native.
84 switch {
85 case dirExists(dir, "android") || dirExists(dir, "ios"):
86 result.Framework = "flutter"
87 result.Type = "native"
88 result.BundleID = readMobileBundleID(dir)
89 case pubspecHasFlutterWebTarget(data):

Calls 15

readPackageJSONDepsFunction · 0.85
fileExistsFunction · 0.85
hasDepFunction · 0.85
readCapacitorAppIDFunction · 0.85
detectBuildToolFromFilesFunction · 0.85
readFileContentFunction · 0.85
dirExistsFunction · 0.85
readMobileBundleIDFunction · 0.85
fileExistsAnyFunction · 0.85
isExpoProjectFunction · 0.85
findCsprojContentFunction · 0.85