@c0x12c/spartan-ai-toolkit 1.7.0 → 1.7.2

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.
@@ -10,7 +10,7 @@
10
10
  "name": "spartan-ai-toolkit",
11
11
  "description": "5 workflows, 56 commands, 12 rules, 22 skills, 7 agents — organized in 11 packs with dependencies",
12
12
  "source": "./toolkit",
13
- "version": "1.7.0"
13
+ "version": "1.7.2"
14
14
  }
15
15
  ]
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spartan-ai-toolkit",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Engineering discipline layer for Claude Code — 5 workflows, 56 commands, 12 rules, 22 skills, 7 agents organized in 11 packs",
5
5
  "author": {
6
6
  "name": "Khoa Tran",
package/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.7.2
@@ -31,6 +31,19 @@ EPIC (multi-feature — auto-detected):
31
31
  **Full path:** For bigger work, you call `/spartan:spec`, `/spartan:design`, `/spartan:plan` as sub-steps.
32
32
  **Epic path:** If the feature name matches an epic with 2+ specs ready, build all features together — one branch, one PR.
33
33
 
34
+ ### Stages That MUST NOT Be Skipped
35
+
36
+ | Stage | When it runs | Can skip? |
37
+ |-------|-------------|-----------|
38
+ | Stage 1 (Spec) | Always | NO — every feature needs a scope |
39
+ | Stage 2 (Design) | Frontend/UI work | NO — must ask user (skip only if pure data change) |
40
+ | Stage 3 (Plan) | Always | NO — every feature needs a plan |
41
+ | Stage 4 (Implement) | Always | NO |
42
+ | Stage 5 (Review) | Always | **NEVER** — this is the most commonly skipped stage. You MUST spawn the review agent. |
43
+ | Stage 6 (Ship) | Always | NO |
44
+
45
+ **If you finish Stage 4 and are about to commit/PR without running Stage 5 — STOP. You are skipping review. Go back and run it.**
46
+
34
47
  ---
35
48
 
36
49
  ## Step 0: Detect Mode & Stack (silent — no questions)
@@ -195,7 +208,7 @@ If user picks B → continue to Plan.
195
208
 
196
209
  If user picks C → read the Figma reference and use it as the design source.
197
210
 
198
- **Auto mode on?** → Still ask this question. Design skipping is the user's call, not yours. The only exception: if the ONLY UI change is a single field addition to an existing component (e.g., adding a column to a table), skip silently.
211
+ **Auto mode on?** → Still ask this question. Design skipping is the user's call, not yours. The only exception: if the change is purely data (adding a column to an existing table, no new screens or layouts), skip silently. If there's ANY new component, screen, modal, or layout change — you MUST ask.
199
212
 
200
213
  ---
201
214
 
@@ -329,6 +342,8 @@ Do NOT invent your own layout or design. The design was already reviewed and app
329
342
 
330
343
  6. `TeamDelete` to clean up.
331
344
 
345
+ 7. **MANDATORY: Continue to Stage 5 (Review) NOW.** Do NOT stop here. Do NOT ask "Want me to commit?" or "Should I create a PR?" — implementation is done but review hasn't happened yet. Go straight to Gate 3 → Stage 5.
346
+
332
347
  **If Agent Teams is NOT enabled** (env var not set), continue with sequential execution below.
333
348
 
334
349
  ### Sequential execution (default)
@@ -392,14 +407,22 @@ npm test && npm run build
392
407
  ./gradlew test && npm test && npm run build
393
408
  ```
394
409
 
395
- **GATE 3 — Implementation complete.**
410
+ **GATE 3 — Implementation complete. Review is NEXT.**
396
411
  > "All [N] tasks done. [X] tests passing. Starting review."
397
412
  >
398
413
  > **Auto mode on?** → Go straight to review.
414
+ >
415
+ > **CRITICAL: You MUST run Stage 5 (Review) after this gate. No exceptions. Do NOT commit, do NOT create a PR, do NOT ask the user what to do next. The next step is ALWAYS the review agent.**
399
416
 
400
417
  ---
401
418
 
402
- ## Stage 5: Review (agent-based — mandatory)
419
+ ## Stage 5: Review (agent-based — MANDATORY, NEVER SKIP)
420
+
421
+ > **CRITICAL: This stage MUST run for every build. No exceptions.**
422
+ > - Not optional. Not skippable. Not deferrable.
423
+ > - Do NOT ask the user "Want me to skip review?" or "Should I review?"
424
+ > - Do NOT commit or create a PR before this stage completes.
425
+ > - If you catch yourself about to skip this stage, STOP and run it.
403
426
 
404
427
  **This is NOT a self-review.** Spawn a separate review agent to get a fresh perspective. The reviewer finds issues, you fix them, repeat until clean.
405
428
 
@@ -408,11 +431,8 @@ npm test && npm run build
408
431
  The review uses **configurable rules**. Load them in this order:
409
432
 
410
433
  ```bash
411
- # 1. Check for project config (source of truth)
412
- cat .spartan/config.yaml 2>/dev/null
413
-
414
- # 2. If no config, scan for installed rules
415
- ls rules/ .claude/rules/ ~/.claude/rules/ 2>/dev/null
434
+ # 1. Check for project config
435
+ cat .spartan/config.yaml 2>/dev/null || cat ~/.spartan/config.yaml 2>/dev/null
416
436
  ```
417
437
 
418
438
  **If `.spartan/config.yaml` exists:**
@@ -422,7 +442,30 @@ ls rules/ .claude/rules/ ~/.claude/rules/ 2>/dev/null
422
442
  - If `extends` is set, load the base profile first, then apply overrides (`rules-add`, `rules-remove`, `rules-override`)
423
443
  - If `conditional-rules` is set, match rules to changed files by glob pattern
424
444
 
425
- **If no config exists (fallback):**
445
+ **If no config exists — auto-generate from installed packs:**
446
+
447
+ ```bash
448
+ # Check what packs are installed
449
+ cat .claude/.spartan-packs 2>/dev/null || cat ~/.claude/.spartan-packs 2>/dev/null
450
+ ```
451
+
452
+ If a packs file exists, generate config from the matching profile:
453
+ - Has `backend-micronaut` → use `kotlin-micronaut` profile
454
+ - Has `frontend-react` → use `react-nextjs` profile
455
+ - Has `backend-nodejs` → use `typescript-node` profile
456
+ - Has `backend-python` → use `python-fastapi` profile
457
+ - None of the above → use `custom` profile
458
+
459
+ Look for the profile in the toolkit source:
460
+ ```bash
461
+ REPO_PATH=$(cat ~/.claude/.spartan-repo 2>/dev/null || echo "")
462
+ ls "$REPO_PATH/toolkit/profiles/" 2>/dev/null
463
+ ```
464
+
465
+ Copy the matching profile to `.spartan/config.yaml`. Tell the user:
466
+ > "No config found. Generated `.spartan/config.yaml` from {profile} profile. Edit it to customize."
467
+
468
+ **If no packs file either (bare fallback):**
426
469
  - Scan `rules/` directory for all `.md` files
427
470
  - Group by subdirectory: `rules/backend-micronaut/` → backend, `rules/frontend-react/` → frontend, `rules/database/` → backend, `rules/core/` → shared
428
471
  - If no `rules/` dir, check `.claude/rules/` then `~/.claude/rules/`
@@ -733,7 +776,8 @@ If a previous session was interrupted (context overflow, user stopped, etc.), th
733
776
  - **Gates are mandatory.** Even small features go through all stages. The stages are fast for small work — that's fine.
734
777
  - **TDD by default.** Write the test first. Override only when test-first doesn't make sense for that specific task.
735
778
  - **One commit per task.** Don't batch. Each task = one commit with a clear message.
736
- - **Review is always an agent.** Never self-review. Always spawn a separate review agent for a fresh perspective. Fix issues until the reviewer says PASS.
779
+ - **Review is ALWAYS an agent. NEVER skip.** This is the #1 rule. After implementation finishes — whether via Agent Teams or sequential — you MUST spawn the review agent (Stage 5). Never self-review. Never skip review. Never ask the user if they want to skip. Never commit or create a PR without review. Fix issues until the reviewer says PASS.
780
+ - **Design gate runs for frontend work.** If the feature has UI work (new components, screens, modals, layouts), you MUST trigger the design question in Stage 2. Only skip for pure data changes (adding a field to an existing table/component).
737
781
  - **Security check always runs.** Whether backend or frontend, security patterns get checked during review.
738
782
  - **Frontend checks for backend needs.** If a new page needs data that doesn't exist yet, say so at Stage 3 and add backend tasks first.
739
783
  - **Don't over-plan.** If the whole thing is 1-2 files and 30 minutes of work, don't force it into this workflow. Just do it. This workflow is for features that need structure — at least 2-3 tasks.
@@ -27,16 +27,18 @@ If uncommitted changes exist → commit or stash before continuing.
27
27
  ## Step 2: Rebase onto Main
28
28
 
29
29
  ```bash
30
- # Fetch latest
30
+ # Fetch latest and detect default branch
31
31
  git fetch origin
32
+ DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
33
+ [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=$(git rev-parse --verify origin/master >/dev/null 2>&1 && echo master || echo main)
32
34
 
33
- # See what's new on main
34
- git log HEAD..origin/main --oneline
35
+ # See what's new on the default branch
36
+ git log HEAD..origin/$DEFAULT_BRANCH --oneline
35
37
  ```
36
38
 
37
- If main has new commits:
39
+ If the default branch has new commits:
38
40
  ```bash
39
- git rebase origin/main
41
+ git rebase origin/$DEFAULT_BRANCH
40
42
  ```
41
43
 
42
44
  **Conflict resolution:**
@@ -14,12 +14,9 @@ Perform a thorough review of the current changes. Use `git diff` to inspect all
14
14
 
15
15
  ```bash
16
16
  # 1. Check for project config
17
- cat .spartan/config.yaml 2>/dev/null
17
+ cat .spartan/config.yaml 2>/dev/null || cat ~/.spartan/config.yaml 2>/dev/null
18
18
 
19
- # 2. If no config, scan for installed rules
20
- ls rules/ .claude/rules/ ~/.claude/rules/ 2>/dev/null
21
-
22
- # 3. Classify changed files
19
+ # 2. Classify changed files
23
20
  git diff main...HEAD --name-only
24
21
  ```
25
22
 
@@ -30,7 +27,15 @@ git diff main...HEAD --name-only
30
27
  - If `extends` is set, load the base profile, then apply `rules-add`/`rules-remove`/`rules-override`
31
28
  - If `conditional-rules` is set, match rules to changed files by glob pattern
32
29
 
33
- **If no config (fallback):**
30
+ **If no config — auto-generate from installed packs:**
31
+
32
+ ```bash
33
+ cat .claude/.spartan-packs 2>/dev/null || cat ~/.claude/.spartan-packs 2>/dev/null
34
+ ```
35
+
36
+ If packs file exists, generate config from the matching profile (same logic as `/spartan:build` Step 1). Copy the profile to `.spartan/config.yaml` and tell the user it was generated.
37
+
38
+ **If no packs file either (bare fallback):**
34
39
  - Scan `rules/` for all `.md` files, group by subdirectory
35
40
  - If no `rules/`, check `.claude/rules/` then `~/.claude/rules/`
36
41
  - Use all stages below
@@ -18,16 +18,34 @@ echo "Current version: $LOCAL_VER"
18
18
  echo "Repo path: $REPO_PATH"
19
19
  ```
20
20
 
21
- If `REPO_PATH` is empty or the directory doesn't exist, ask the user where they cloned `spartan-ai-toolkit`:
22
- "I don't know where the Spartan repo is. Where did you clone it? (e.g., `~/spartan-ai-toolkit`)"
21
+ If `REPO_PATH` is empty or the directory doesn't exist, try to find it:
22
+
23
+ ```bash
24
+ # Common locations
25
+ for dir in ~/spartan-ai-toolkit ~/Documents/Code/Spartan/spartan-ai-toolkit ~/Code/spartan-ai-toolkit; do
26
+ [ -d "$dir/toolkit" ] && echo "Found: $dir" && break
27
+ done
28
+ ```
29
+
30
+ If still not found, ask the user: "Where did you clone spartan-ai-toolkit?"
23
31
 
24
32
  ---
25
33
 
26
- ## Step 2: Check for updates
34
+ ## Step 2: Detect default branch and check for updates
27
35
 
28
36
  ```bash
29
- cd "$REPO_PATH" && git fetch origin main --quiet 2>/dev/null
30
- REMOTE_VER=$(git show origin/main:toolkit/VERSION 2>/dev/null || echo "unknown")
37
+ cd "$REPO_PATH"
38
+
39
+ # Detect the default branch (master or main)
40
+ DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
41
+ if [ -z "$DEFAULT_BRANCH" ]; then
42
+ # Fallback: check which branch exists
43
+ git rev-parse --verify origin/master >/dev/null 2>&1 && DEFAULT_BRANCH="master" || DEFAULT_BRANCH="main"
44
+ fi
45
+ echo "Default branch: $DEFAULT_BRANCH"
46
+
47
+ git fetch origin "$DEFAULT_BRANCH" --quiet 2>/dev/null
48
+ REMOTE_VER=$(git show "origin/$DEFAULT_BRANCH:toolkit/VERSION" 2>/dev/null || echo "unknown")
31
49
  echo "Local: $LOCAL_VER"
32
50
  echo "Remote: $REMOTE_VER"
33
51
  ```
@@ -56,7 +74,7 @@ Show the user their current packs and ask:
56
74
  ## Step 4: Pull and reinstall
57
75
 
58
76
  ```bash
59
- cd "$REPO_PATH" && git pull origin main
77
+ cd "$REPO_PATH" && git pull origin "$DEFAULT_BRANCH"
60
78
  ```
61
79
 
62
80
  Then run the setup script with saved packs:
@@ -73,6 +91,41 @@ cd "$REPO_PATH/toolkit" && ./scripts/setup.sh --global
73
91
 
74
92
  ---
75
93
 
94
+ ## Step 4.5: Generate config if missing
95
+
96
+ After the install finishes, check if `.spartan/config.yaml` exists:
97
+
98
+ ```bash
99
+ ls .spartan/config.yaml 2>/dev/null || ls ~/.spartan/config.yaml 2>/dev/null
100
+ ```
101
+
102
+ **If no config exists**, generate one from the installed packs:
103
+
104
+ 1. Read the saved packs file:
105
+ ```bash
106
+ cat ~/.claude/.spartan-packs 2>/dev/null || cat .claude/.spartan-packs 2>/dev/null
107
+ ```
108
+
109
+ 2. Pick the matching profile:
110
+ - Has `backend-micronaut` → copy `toolkit/profiles/kotlin-micronaut.yaml`
111
+ - Has `frontend-react` → copy `toolkit/profiles/react-nextjs.yaml`
112
+ - Has `backend-nodejs` → copy `toolkit/profiles/typescript-node.yaml`
113
+ - Has `backend-python` → copy `toolkit/profiles/python-fastapi.yaml`
114
+ - None of the above → copy `toolkit/profiles/custom.yaml`
115
+
116
+ 3. Copy the profile:
117
+ ```bash
118
+ mkdir -p .spartan 2>/dev/null || mkdir -p ~/.spartan
119
+ cp "$REPO_PATH/toolkit/profiles/{profile}.yaml" .spartan/config.yaml 2>/dev/null || \
120
+ cp "$REPO_PATH/toolkit/profiles/{profile}.yaml" ~/.spartan/config.yaml
121
+ ```
122
+
123
+ Tell the user: "Generated `.spartan/config.yaml` from {profile} profile. Edit it to customize rules and review stages."
124
+
125
+ **If config already exists**, skip this step.
126
+
127
+ ---
128
+
76
129
  ## Step 5: Confirm
77
130
 
78
131
  After setup completes, tell the user:
@@ -63,7 +63,9 @@ ls .planning/PROJECT.md 2>/dev/null && echo "GSD_ACTIVE"
63
63
  LOCAL_VER=$(cat ~/.claude/.spartan-version 2>/dev/null || echo "")
64
64
  REPO_PATH=$(cat ~/.claude/.spartan-repo 2>/dev/null || echo "")
65
65
  if [ -n "$REPO_PATH" ] && [ -d "$REPO_PATH/.git" ]; then
66
- REMOTE_VER=$(cd "$REPO_PATH" && git fetch origin main --quiet 2>/dev/null && git show origin/main:toolkit/VERSION 2>/dev/null || echo "")
66
+ DEFAULT_BRANCH=$(cd "$REPO_PATH" && git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
67
+ [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=$(cd "$REPO_PATH" && git rev-parse --verify origin/master >/dev/null 2>&1 && echo master || echo main)
68
+ REMOTE_VER=$(cd "$REPO_PATH" && git fetch origin "$DEFAULT_BRANCH" --quiet 2>/dev/null && git show "origin/$DEFAULT_BRANCH:toolkit/VERSION" 2>/dev/null || echo "")
67
69
  if [ -n "$REMOTE_VER" ] && [ -n "$LOCAL_VER" ] && [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
68
70
  echo "SPARTAN_UPDATE_AVAILABLE=$REMOTE_VER"
69
71
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c0x12c/spartan-ai-toolkit",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Engineering discipline layer for AI coding agents — commands, rules, skills, agents, and packs for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {