Skip to content

Commit bacce51

Browse files
committed
refactor: remove unused randomSlugSuffix logic and update comments
1 parent 5f2ec83 commit bacce51

2 files changed

Lines changed: 10 additions & 33 deletions

File tree

internal/cli/quickstart_detect.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ func DetectProject(dir string) DetectionResult {
3535
// Read package.json deps early - needed for checks that must precede file-based signals.
3636
earlyDeps := readPackageJSONDeps(dir)
3737

38-
// -- 1. Manage.py (Django) — checked before Ionic to prevent monorepo misdetection.
38+
// -- 1. Manage.py (Django) — Checked before Ionic to prevent monorepo misdetection.
3939
if fileExists(dir, "manage.py") {
4040
result.Framework = "django"
4141
result.Type = "regular"
4242
result.Detected = true
4343
return result
4444
}
4545

46-
// -- 2. Ionic (package.json deps - must check BEFORE angular.json and vite.config) --.
46+
// -- 2. Ionic (package.json deps - Must check BEFORE angular.json and vite.config) --.
4747
if hasDep(earlyDeps, "@ionic/angular") {
4848
result.Framework = "ionic-angular"
4949
result.Type = "native"
@@ -80,7 +80,7 @@ func DetectProject(dir string) DetectionResult {
8080
if data, ok := readFileContent(dir, "pubspec.yaml"); ok {
8181
if strings.Contains(data, "sdk: flutter") {
8282
result.Detected = true
83-
// android/ios dirs signal native; flutter.web key signals web SPA; default native.
83+
// Android/ios dirs signal native; flutter.web key signals web SPA; default native.
8484
switch {
8585
case dirExists(dir, "android") || dirExists(dir, "ios"):
8686
result.Framework = "flutter"
@@ -99,7 +99,7 @@ func DetectProject(dir string) DetectionResult {
9999
}
100100
}
101101

102-
// -- 5. composer.json (PHP) — before vite.config to avoid Laravel misdetection.
102+
// Composer.json (PHP) — Before vite.config to avoid Laravel misdetection.
103103
if data, ok := readFileContent(dir, "composer.json"); ok {
104104
result.BuildTool = "composer"
105105
result.Type = "regular"
@@ -112,7 +112,7 @@ func DetectProject(dir string) DetectionResult {
112112
return result
113113
}
114114

115-
// -- 6. SvelteKit (@sveltejs/kit dep) — before vite.config; only reliable distinguishing signal.
115+
// -- 6. SvelteKit (@sveltejs/kit dep) — Before vite.config; only reliable distinguishing signal.
116116
if hasDep(earlyDeps, "@sveltejs/kit") {
117117
result.Framework = "sveltekit"
118118
result.Type = "regular"
@@ -121,7 +121,7 @@ func DetectProject(dir string) DetectionResult {
121121
return result
122122
}
123123

124-
// -- 7. nuxt.config.[ts|js] — before vite.config (Nuxt uses Vite internally).
124+
// Nuxt.config.[ts|js] — Before vite.config (Nuxt uses Vite internally).
125125
if fileExistsAny(dir, "nuxt.config.ts", "nuxt.config.js") {
126126
result.Framework = "nuxt"
127127
result.Type = "regular"
@@ -155,7 +155,7 @@ func DetectProject(dir string) DetectionResult {
155155
return result
156156
}
157157

158-
// -- 10. svelte.config.[js|ts] — only label as sveltekit when @sveltejs/kit dep is confirmed.
158+
// -- 10. svelte.config.[js|ts] — Only label as sveltekit when @sveltejs/kit dep is confirmed.
159159
if fileExistsAny(dir, "svelte.config.js", "svelte.config.ts") {
160160
framework := "sveltekit"
161161
appType := "regular"
@@ -192,7 +192,7 @@ func DetectProject(dir string) DetectionResult {
192192
}
193193
}
194194

195-
// -- 13. Android (native Java/Kotlin) — before Java build files to avoid vanilla-java misdetection.
195+
// -- 13. Android (native Java/Kotlin) — Before Java build files to avoid vanilla-java misdetection.
196196
// Excludes React Native projects which also have AndroidManifest.xml in a sub-project.
197197
if fileExists(dir, filepath.Join("app", "src", "main", "AndroidManifest.xml")) && !hasDep(earlyDeps, "react-native") {
198198
result.Framework = "android"
@@ -203,7 +203,7 @@ func DetectProject(dir string) DetectionResult {
203203
return result
204204
}
205205

206-
// -- 14. iOS Swift — .xcodeproj or Package.swift (excludes Vapor server-side Swift).
206+
// -- 14. iOS Swift — .xcodeproj or Package.swift (Excludes Vapor server-side Swift).
207207
if hasXcodeprojDir(dir) || (fileExists(dir, "Package.swift") && !isVaporSwiftPackage(dir)) {
208208
result.Framework = "ios-swift"
209209
result.Type = "native"
@@ -258,7 +258,7 @@ func DetectProject(dir string) DetectionResult {
258258
}
259259
}
260260

261-
// -- 19. Package.json dep scanning (lowest priority) --
261+
// -- 19. Package.json dep scanning (Lowest priority) --
262262
// Note: Ionic deps are already handled above (step 2).
263263
if len(earlyDeps) > 0 {
264264
candidates := collectPackageJSONCandidates(earlyDeps)

internal/cli/quickstarts.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package cli
22

33
import (
44
"context"
5-
"crypto/rand"
65
_ "embed"
7-
"encoding/hex"
86
"encoding/json"
97
"fmt"
108
"net/url"
@@ -16,7 +14,6 @@ import (
1614
"sort"
1715
"strconv"
1816
"strings"
19-
"time"
2017

2118
"github.com/auth0/go-auth0/management"
2219
"github.com/spf13/cobra"
@@ -822,22 +819,13 @@ func collectName(cmd *cobra.Command, inputs *SetupInputs) error {
822819
return nil
823820
}
824821

825-
// collectAPIInputs prompts for identifier, token lifetime, and signing algorithm.
826822
func collectAPIInputs(cmd *cobra.Command, cli *cli, inputs *SetupInputs) error {
827823
// Identifier.
828824
if !setupIdentifier.IsSet(cmd) {
829825
defaultID := inputs.Identifier
830826
if defaultID == "" && inputs.Name != "" {
831827
slug := strings.ToLower(strings.ReplaceAll(inputs.Name, " ", "-"))
832828
defaultID = "https://" + slug
833-
834-
// Check once if the clean slug is taken; if so, append a random suffix
835-
// so the rerun doesn't collide. Respects user input — only suggests, doesn't force.
836-
if _, err := cli.api.ResourceServer.Read(cmd.Context(), url.PathEscape(defaultID)); err == nil {
837-
suffixed := fmt.Sprintf("%s-%s", defaultID, randomSlugSuffix(4))
838-
cli.renderer.Warnf("API identifier %q is already in use. Generated a new identifier %q to avoid conflict.", defaultID, suffixed)
839-
defaultID = suffixed
840-
}
841829
}
842830
inputs.Identifier = defaultID
843831
if err := setupIdentifier.Ask(cmd, &inputs.Identifier, &defaultID); err != nil {
@@ -1436,17 +1424,6 @@ func validateAPIIdentifier(identifier string) error {
14361424
return nil
14371425
}
14381426

1439-
// randomSlugSuffix returns a lowercase hex string of the requested byte length
1440-
// (each byte expands to 2 hex chars). Falls back to a timestamp-based suffix if
1441-
// the crypto source fails, which should not happen in practice.
1442-
func randomSlugSuffix(n int) string {
1443-
b := make([]byte, n)
1444-
if _, err := rand.Read(b); err != nil {
1445-
return strconv.FormatInt(time.Now().UnixNano(), 36)
1446-
}
1447-
return hex.EncodeToString(b)
1448-
}
1449-
14501427
func generateClient(input SetupInputs, reqParams auth0.RequestParams) (*management.Client, error) {
14511428
if input.Name == "" {
14521429
input.Name = "My App"

0 commit comments

Comments
 (0)