@atlashub/smartstack-cli 3.38.0 → 3.39.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.
Files changed (47) hide show
  1. package/dist/mcp-entry.mjs +62 -37
  2. package/dist/mcp-entry.mjs.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/agents/efcore/scan.md +3 -1
  5. package/templates/agents/gitflow/commit.md +74 -0
  6. package/templates/agents/gitflow/finish.md +5 -2
  7. package/templates/agents/gitflow/init-clone.md +3 -3
  8. package/templates/agents/gitflow/init-validate.md +3 -2
  9. package/templates/agents/gitflow/merge.md +5 -0
  10. package/templates/agents/gitflow/pr.md +5 -0
  11. package/templates/agents/gitflow/start.md +8 -1
  12. package/templates/hooks/hooks.json +11 -0
  13. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  14. package/templates/skills/apex/references/core-seed-data.md +0 -1
  15. package/templates/skills/apex/references/examine-build-validation.md +1 -6
  16. package/templates/skills/apex/references/smartstack-frontend.md +1 -1
  17. package/templates/skills/apex/steps/step-03-execute.md +4 -9
  18. package/templates/skills/apex/steps/step-08-run-tests.md +1 -2
  19. package/templates/skills/application/SKILL.md +241 -241
  20. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +5 -5
  21. package/templates/skills/application/references/frontend-verification.md +1 -1
  22. package/templates/skills/application/references/init-parameter-detection.md +121 -120
  23. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -100
  24. package/templates/skills/application/references/nav-fallback-procedure.md +199 -199
  25. package/templates/skills/application/steps/step-00-init.md +130 -130
  26. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  27. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  28. package/templates/skills/application/steps/step-03-roles.md +182 -182
  29. package/templates/skills/application/steps/step-03b-provider.md +133 -133
  30. package/templates/skills/application/steps/step-04-backend.md +174 -174
  31. package/templates/skills/application/steps/step-05-frontend.md +1 -1
  32. package/templates/skills/application/templates-frontend.md +7 -7
  33. package/templates/skills/business-analyse/react/schema.md +836 -836
  34. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  35. package/templates/skills/business-analyse/templates-frd.md +1 -1
  36. package/templates/skills/efcore/SKILL.md +1 -1
  37. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  38. package/templates/skills/gitflow/SKILL.md +27 -4
  39. package/templates/skills/gitflow/_shared.md +86 -12
  40. package/templates/skills/gitflow/phases/abort.md +4 -0
  41. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  42. package/templates/skills/gitflow/references/finish-cleanup.md +4 -0
  43. package/templates/skills/gitflow/references/init-structure-creation.md +4 -0
  44. package/templates/skills/gitflow/references/start-worktree-creation.md +1 -1
  45. package/templates/skills/ralph-loop/steps/step-04-check.md +1 -2
  46. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  47. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "3.38.0",
3
+ "version": "3.39.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -45,7 +45,9 @@ FOR each branch in active_worktrees:
45
45
  ## Fallback Commands (if MCP unavailable)
46
46
 
47
47
  ```bash
48
- # List worktrees
48
+ # List worktrees (run preflight_git_check first for cross-platform compatibility)
49
+ detect_platform
50
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
49
51
  git worktree list
50
52
 
51
53
  # ModelSnapshot hash
@@ -14,6 +14,80 @@ Commit with EF Core migration validation. Executes directly, displays only the r
14
14
 
15
15
  ## EXECUTION SEQUENCE
16
16
 
17
+ ### 0. Pre-flight: Worktree Accessibility
18
+
19
+ ```bash
20
+ # Quick check: can git resolve the repo?
21
+ git rev-parse --git-dir >/dev/null 2>&1
22
+ if [ $? -ne 0 ]; then
23
+ # Worktree .git file likely has cross-platform absolute path
24
+ # Find .bare directory by walking up
25
+ BARE_DIR=""
26
+ DIR="$(pwd)"
27
+ while [ "$DIR" != "/" ]; do
28
+ [ -d "$DIR/.bare" ] && { BARE_DIR="$DIR/.bare"; break; }
29
+ DIR=$(dirname "$DIR")
30
+ done
31
+
32
+ if [ -n "$BARE_DIR" ] && [ -f .git ]; then
33
+ echo "Repairing worktree paths (cross-platform fix)..."
34
+
35
+ # Detect platform
36
+ GF_PLATFORM="linux"
37
+ [ -f /proc/version ] && grep -qi "microsoft\|wsl" /proc/version 2>/dev/null && GF_PLATFORM="wsl"
38
+
39
+ # Repair all worktrees: convert absolute paths to relative paths
40
+ WORKTREES_DIR="$BARE_DIR/worktrees"
41
+ for wt_dir in "$WORKTREES_DIR"/*/; do
42
+ [ ! -d "$wt_dir" ] && continue
43
+ wt_name=$(basename "$wt_dir")
44
+ gitdir_file="$wt_dir/gitdir"
45
+ [ ! -f "$gitdir_file" ] && continue
46
+
47
+ stored_path=$(cat "$gitdir_file" | tr -d '\n\r')
48
+
49
+ # Determine if path is absolute and resolve to current platform
50
+ resolved_path="$stored_path"
51
+ is_abs=false
52
+ if [[ "$stored_path" =~ ^[A-Za-z]:[\\/] ]]; then
53
+ is_abs=true
54
+ if [ "$GF_PLATFORM" = "wsl" ]; then
55
+ drive=$(echo "${stored_path:0:1}" | tr '[:upper:]' '[:lower:]')
56
+ rest="${stored_path:2}"; rest="${rest//\\//}"
57
+ resolved_path="/mnt/$drive$rest"
58
+ fi
59
+ elif [[ "$stored_path" =~ ^/ ]]; then
60
+ is_abs=true
61
+ fi
62
+ [ "$is_abs" = "false" ] && continue # Already relative, skip
63
+
64
+ wt_real_dir=$(dirname "$resolved_path")
65
+ [ ! -d "$wt_real_dir" ] && continue
66
+
67
+ bare_wt_abs=$(realpath -m "$wt_dir")
68
+ wt_abs=$(realpath -m "$wt_real_dir")
69
+
70
+ # Fix gitdir backlink to relative
71
+ rel_gitdir=$(realpath -m --relative-to="$bare_wt_abs" "$wt_abs/.git")
72
+ [ "$stored_path" != "$rel_gitdir" ] && printf '%s\n' "$rel_gitdir" > "$gitdir_file"
73
+
74
+ # Fix worktree .git pseudo-file to relative
75
+ if [ -f "$wt_real_dir/.git" ]; then
76
+ git_content=$(cat "$wt_real_dir/.git" | tr -d '\n\r')
77
+ git_path="${git_content#gitdir: }"
78
+ rel_bare=$(realpath -m --relative-to="$wt_abs" "$bare_wt_abs")
79
+ [ "$git_path" != "$rel_bare" ] && printf 'gitdir: %s\n' "$rel_bare" > "$wt_real_dir/.git"
80
+ fi
81
+ done
82
+
83
+ # Verify repair
84
+ git rev-parse --git-dir >/dev/null 2>&1 && echo "Worktree paths repaired successfully" || { echo "BLOCKED: worktree repair failed"; exit 1; }
85
+ else
86
+ echo "BLOCKED: not a git repository and no .bare found"; exit 1
87
+ fi
88
+ fi
89
+ ```
90
+
17
91
  ### 1. Guards
18
92
 
19
93
  ```bash
@@ -31,8 +31,11 @@ fi
31
31
  BRANCH=${1:-$(git rev-parse --abbrev-ref HEAD)}
32
32
  BRANCH_TYPE=$(echo $BRANCH | cut -d'/' -f1)
33
33
 
34
- # Worktree detection: if in a worktree, navigate to main repo
35
- # Normalize path for cross-platform compatibility (WSL ↔ Windows)
34
+ # Worktree detection: repair cross-platform paths first (WSL Windows)
35
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
36
+ detect_platform
37
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
38
+
36
39
  WORKTREE_PATH=$(git worktree list --porcelain | grep -B2 "branch refs/heads/$BRANCH" | grep "^worktree " | sed 's/^worktree //')
37
40
  WORKTREE_PATH=$(normalize_path_for_platform "$WORKTREE_PATH")
38
41
  ```
@@ -96,7 +96,7 @@ if [ ! -d "$PROJECT_BASE/develop" ]; then
96
96
  fi
97
97
  ```
98
98
 
99
- ### 5b. Fix Cross-Platform Worktree Paths
99
+ ### 5b. Convert Worktree Paths to Relative (Cross-Platform)
100
100
 
101
101
  ```bash
102
102
  PROJECT_BASE="{PROJECT_BASE}"
@@ -104,8 +104,8 @@ PROJECT_BASE="{PROJECT_BASE}"
104
104
  # Detect current platform (needed for path normalization)
105
105
  detect_platform
106
106
 
107
- # Repair any cross-platform paths written by git worktree add
108
- # (e.g., WSL paths /mnt/d/... when running on Windows, or vice versa)
107
+ # Convert absolute paths written by git worktree add to relative paths
108
+ # Relative paths work on both Windows and WSL without needing repair when switching
109
109
  repair_worktree_paths "$PROJECT_BASE/.bare"
110
110
  ```
111
111
 
@@ -136,7 +136,8 @@ done
136
136
 
137
137
  ### 2b. Worktree Path Integrity (Cross-Platform)
138
138
 
139
- Repair worktree metadata files that contain paths from a different platform (e.g., WSL paths `/mnt/d/...` on Windows or Windows paths `D:/...` on WSL).
139
+ Convert worktree metadata paths to relative format for cross-platform compatibility.
140
+ Relative paths work on both Windows (VS Code) and WSL without needing repair when switching.
140
141
 
141
142
  ```bash
142
143
  PROJECT_BASE="{PROJECT_BASE}"
@@ -144,7 +145,7 @@ PROJECT_BASE="{PROJECT_BASE}"
144
145
  # Source platform detection and path functions from _shared.md
145
146
  detect_platform
146
147
 
147
- # Repair cross-platform paths in .bare/worktrees/*/gitdir and worktree/.git files
148
+ # Convert absolute paths to relative in .bare/worktrees/*/gitdir and worktree/.git files
148
149
  repair_worktree_paths "$PROJECT_BASE/.bare"
149
150
  ```
150
151
 
@@ -20,6 +20,11 @@ CONFIG_FILE=""
20
20
  if [ -f ".claude/gitflow/config.json" ]; then
21
21
  CONFIG_FILE=".claude/gitflow/config.json"
22
22
  else
23
+ # Repair cross-platform worktree paths before listing (WSL ↔ Windows)
24
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
25
+ detect_platform
26
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
27
+
23
28
  # Try develop worktree
24
29
  DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
25
30
  if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
@@ -22,6 +22,11 @@ CONFIG_FILE=""
22
22
  if [ -f ".claude/gitflow/config.json" ]; then
23
23
  CONFIG_FILE=".claude/gitflow/config.json"
24
24
  else
25
+ # Repair cross-platform worktree paths before listing (WSL ↔ Windows)
26
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
27
+ detect_platform
28
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
29
+
25
30
  # Try develop worktree
26
31
  DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
27
32
  if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
@@ -66,7 +66,11 @@ esac
66
66
  mkdir -p "$(dirname "$WORKTREE_PATH")"
67
67
  git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
68
68
 
69
- # 4. POST-CREATION VALIDATION (BLOCKING)
69
+ # 4. POST-CREATION: Repair worktree paths FIRST, then validate
70
+ # Uses repair_worktree_paths from _shared.md REPAIR_WORKTREE_PATHS section
71
+ BARE_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
72
+ [ -n "$BARE_DIR" ] && repair_worktree_paths "$BARE_DIR"
73
+
70
74
  CREATED_PATH=$(git worktree list | grep "$FULL_BRANCH" | awk '{print $1}')
71
75
  BASENAME=$(basename "$CREATED_PATH")
72
76
  if [[ "$BASENAME" =~ ^[0-9]{2}- ]] && [[ "$BASENAME" != "01-Main" ]] && [[ "$BASENAME" != "02-Develop" ]]; then
@@ -76,6 +80,9 @@ if [[ "$BASENAME" =~ ^[0-9]{2}- ]] && [[ "$BASENAME" != "01-Main" ]] && [[ "$BAS
76
80
  git branch -D "$FULL_BRANCH" 2>/dev/null
77
81
  echo "Removed invalid worktree. Recreating at correct path..."
78
82
  git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
83
+ # Repair again after recreation
84
+ BARE_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
85
+ [ -n "$BARE_DIR" ] && repair_worktree_paths "$BARE_DIR"
79
86
  fi
80
87
  ```
81
88
 
@@ -29,6 +29,17 @@
29
29
  ]
30
30
  }
31
31
  ],
32
+ "PostToolUse": [
33
+ {
34
+ "matcher": "Bash",
35
+ "hooks": [
36
+ {
37
+ "type": "command",
38
+ "command": "${CLAUDE_HOOKS_DIR}/wsl-dotnet-cleanup.sh"
39
+ }
40
+ ]
41
+ }
42
+ ],
32
43
  "Stop": [
33
44
  {
34
45
  "hooks": [
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ # WSL Dotnet Cleanup - PostToolUse Hook
4
+ # Removes literal "bin\Debug" folders created by Roslyn BuildHost on WSL
5
+ # Roslyn uses Windows path separators, creating "bin\Debug" as a single folder name
6
+ # instead of the proper bin/Debug/ directory structure.
7
+
8
+ set -euo pipefail
9
+
10
+ HOOK_INPUT=$(cat)
11
+
12
+ # Quick exit: only care about Bash tool calls containing "dotnet" (~1ms)
13
+ case "$HOOK_INPUT" in
14
+ *dotnet*) ;; # proceed to cleanup
15
+ *) exit 0 ;; # fast exit
16
+ esac
17
+
18
+ # Find and remove corrupted bin\Debug folders (literal backslash in name)
19
+ # bin?Debug matches "bin\Debug" where ? is the literal backslash character
20
+ for d in src/*/bin?Debug bin?Debug; do
21
+ [ -d "$d" ] && rm -rf "$d"
22
+ done
23
+
24
+ exit 0
@@ -200,7 +200,6 @@ public static class NavigationApplicationSeedData
200
200
  public class NavigationApplicationSeedEntry
201
201
  {
202
202
  public Guid Id { get; init; }
203
- public Guid ContextId { get; init; }
204
203
  public string Code { get; init; } = null!;
205
204
  public string Label { get; init; } = null!;
206
205
  public string? Description { get; init; }
@@ -8,14 +8,9 @@
8
8
  ## Build Verification
9
9
 
10
10
  ```bash
11
- # Cleanup corrupted EF Core design-time artifacts (Roslyn BuildHost bug on Windows/WSL)
12
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && echo "Removing corrupted artifact: $d" && rm -rf "$d"; done
13
-
14
11
  # Backend
15
12
  dotnet clean && dotnet restore && dotnet build
16
-
17
- # Post-build cleanup (WSL Roslyn recreates literal bin\Debug folders after each build)
18
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
13
+ # Note: WSL bin\Debug cleanup handled by PostToolUse hook (wsl-dotnet-cleanup.sh)
19
14
 
20
15
  # Frontend (if applicable)
21
16
  npm run typecheck
@@ -44,7 +44,7 @@ element: (
44
44
  - **NEVER** static-import page components in route files
45
45
  - **ALWAYS** use `<Suspense fallback={<PageLoader />}>` around lazy components
46
46
  - **ALWAYS** use the `.then(m => ({ default: m.ComponentName }))` pattern for named exports
47
- - Layout components (AdminLayout, BusinessLayout, UserLayout) are ALSO lazy-loaded
47
+ - The unified AppLayout component is ALSO lazy-loaded
48
48
 
49
49
  **FORBIDDEN:**
50
50
  ```tsx
@@ -77,12 +77,9 @@ For each entity:
77
77
  2. Verify ALL EF configurations are registered (ApplyConfigurationsFromAssembly or individual)
78
78
  3. MCP suggest_migration → get standardized name
79
79
  4. dotnet ef migrations add {Name} --project src/{Infra}.csproj --startup-project src/{Api}.csproj -o Persistence/Migrations
80
- 5. Cleanup corrupted EF Core artifacts (WSL Roslyn bug — creates literal `bin\Debug` folder):
81
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
82
- 6. dotnet ef database update (if local DB)
83
- 7. dotnet build → MUST PASS
84
- 8. Verify: dotnet ef migrations has-pending-model-changes → MUST report "No pending model changes"
85
- 9. Post-build cleanup (WSL recreates artifacts): for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
80
+ 5. dotnet ef database update (if local DB)
81
+ 6. dotnet build MUST PASS
82
+ 7. Verify: dotnet ef migrations has-pending-model-changes MUST report "No pending model changes"
86
83
  ```
87
84
 
88
85
  **BLOCKING:** If build fails after migration, fix EF configs before proceeding.
@@ -92,8 +89,7 @@ For each entity:
92
89
 
93
90
  ```bash
94
91
  dotnet build
95
- # Cleanup WSL Roslyn artifacts (literal bin\Debug folders)
96
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
92
+ # Note: WSL bin\Debug cleanup handled by PostToolUse hook (wsl-dotnet-cleanup.sh)
97
93
  ```
98
94
 
99
95
  **MUST PASS before Layer 1. If NuGet error, run `dotnet restore` first. If file lock (MSB3021), use `--output /tmp/{project}_build`.**
@@ -264,7 +260,6 @@ After Layer 1 completes:
264
260
 
265
261
  2. Build gate:
266
262
  dotnet build → MUST PASS
267
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
268
263
  npm run typecheck → MUST PASS (if frontend)
269
264
  ```
270
265
 
@@ -17,8 +17,7 @@ next_step: COMPLETE
17
17
 
18
18
  ```bash
19
19
  dotnet build --no-restore
20
- # Cleanup WSL Roslyn artifacts (literal bin\Debug folders)
21
- for d in src/*/bin?Debug bin?Debug; do [ -d "$d" ] && rm -rf "$d"; done
20
+ # Note: WSL bin\Debug cleanup handled by PostToolUse hook (wsl-dotnet-cleanup.sh)
22
21
  ```
23
22
 
24
23
  **MUST PASS before running tests.**