@atlashub/smartstack-cli 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, APEX, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -19,6 +19,9 @@ Set up GitFlow configuration, create main/develop branches, and configure worktr
19
19
  ### 1. Detect Environment
20
20
 
21
21
  ```bash
22
+ # Check if we're in a git repository
23
+ IS_GIT_REPO=$(git rev-parse --git-dir 2>/dev/null && echo "true" || echo "false")
24
+
22
25
  # Check if already initialized
23
26
  [ -f ".claude/gitflow/config.json" ] && {
24
27
  echo "GitFlow already initialized"
@@ -35,6 +38,15 @@ else
35
38
  GIT_PROVIDER="unknown"
36
39
  fi
37
40
 
41
+ # Auto-detect project name from remote URL or folder name
42
+ if [[ -n "$REMOTE_URL" ]]; then
43
+ # Extract repo name from URL (works for github and azure devops)
44
+ PROJECT_NAME=$(basename -s .git "$REMOTE_URL")
45
+ else
46
+ # Use current folder name
47
+ PROJECT_NAME=$(basename "$(pwd)")
48
+ fi
49
+
38
50
  # Detect existing branches
39
51
  HAS_MAIN=$(git branch -r --list "origin/main" | wc -l)
40
52
  HAS_DEVELOP=$(git branch -r --list "origin/develop" | wc -l)
@@ -42,6 +54,36 @@ HAS_DEVELOP=$(git branch -r --list "origin/develop" | wc -l)
42
54
 
43
55
  ### 2. Configuration Questions
44
56
 
57
+ **If NOT in a git repository (`IS_GIT_REPO` = false):**
58
+
59
+ ```yaml
60
+ AskUserQuestion:
61
+ - header: "Folder"
62
+ question: "Where should the project be initialized?"
63
+ options:
64
+ - label: "Current directory (Recommended)"
65
+ description: "Initialize GitFlow in {pwd}"
66
+ - label: "Create new folder"
67
+ description: "Create a new folder and initialize there"
68
+ - label: "Choose existing folder"
69
+ description: "Navigate to an existing folder"
70
+ ```
71
+
72
+ **Always ask (Custom Setup only, or if auto-detected name is wrong):**
73
+
74
+ ```yaml
75
+ AskUserQuestion:
76
+ - header: "Project"
77
+ question: "What is the project name? (detected: {PROJECT_NAME})"
78
+ options:
79
+ - label: "Use detected name (Recommended)"
80
+ description: "Use '{PROJECT_NAME}' as project name"
81
+ - label: "Enter custom name"
82
+ description: "Specify a different project name"
83
+ ```
84
+
85
+ **Setup mode:**
86
+
45
87
  ```yaml
46
88
  AskUserQuestion:
47
89
  - header: "Mode"
@@ -65,6 +107,31 @@ AskUserQuestion:
65
107
  description: "No worktrees, use git checkout"
66
108
  ```
67
109
 
110
+ **Question flow logic:**
111
+ - Quick Setup: Skip project name question (use auto-detected)
112
+ - Custom Setup: Ask all questions including project name
113
+ - Not in git repo: Ask folder question first, then `git init`
114
+
115
+ ### 2.5 Initialize Git Repository (if needed)
116
+
117
+ **If `IS_GIT_REPO` = false:**
118
+
119
+ ```bash
120
+ # Navigate to chosen folder if user selected "Create new folder" or "Choose existing folder"
121
+ [ -n "$TARGET_FOLDER" ] && {
122
+ mkdir -p "$TARGET_FOLDER"
123
+ cd "$TARGET_FOLDER"
124
+ }
125
+
126
+ # Initialize git repository
127
+ git init
128
+
129
+ # Update PROJECT_NAME if user provided custom name
130
+ [ -n "$CUSTOM_PROJECT_NAME" ] && PROJECT_NAME="$CUSTOM_PROJECT_NAME"
131
+
132
+ echo "Git repository initialized in $(pwd)"
133
+ ```
134
+
68
135
  ### 3. Create Branches (if needed)
69
136
 
70
137
  ```bash
@@ -106,7 +173,7 @@ esac
106
173
  {
107
174
  "version": "2.0.0",
108
175
  "repository": {
109
- "name": "{repo_name}",
176
+ "name": "{PROJECT_NAME}",
110
177
  "defaultBranch": "main",
111
178
  "remoteUrl": "{remote_url}"
112
179
  },
@@ -176,7 +243,7 @@ VERSION=$(grep -oP '<Version>\K[^<]+' *.csproj 2>/dev/null | head -1)
176
243
  ╔══════════════════════════════════════════════════════════════════╗
177
244
  ║ GITFLOW INITIALIZED ║
178
245
  ╠══════════════════════════════════════════════════════════════════╣
179
- Repository: {repo_name}
246
+ Project: {PROJECT_NAME}
180
247
  ║ Provider: {github|azuredevops} ║
181
248
  ║ Version: {X.Y.Z} ║
182
249
  ╠══════════════════════════════════════════════════════════════════╣