@atlashub/smartstack-cli 3.46.0 → 3.48.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/dist/mcp-entry.mjs +297 -85
- package/dist/mcp-entry.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/skills/apex/SKILL.md +1 -0
- package/templates/skills/apex/references/analysis-methods.md +27 -16
- package/templates/skills/apex/references/challenge-questions.md +143 -0
- package/templates/skills/apex/references/person-extension-pattern.md +596 -0
- package/templates/skills/apex/references/post-checks.md +78 -0
- package/templates/skills/apex/references/smartstack-api.md +69 -0
- package/templates/skills/apex/references/smartstack-layers.md +13 -0
- package/templates/skills/apex/steps/step-00-init.md +27 -5
- package/templates/skills/apex/steps/step-03-execute.md +13 -0
- package/templates/skills/business-analyse/_architecture.md +1 -0
- package/templates/skills/business-analyse/references/entity-architecture-decision.md +22 -0
- package/templates/skills/business-analyse/references/handoff-mappings.md +14 -0
- package/templates/skills/business-analyse/references/spec-auto-inference.md +1 -0
- package/templates/skills/business-analyse/steps/step-03a2-analysis.md +49 -0
- package/templates/skills/gitflow/_shared.md +2 -2
- package/templates/skills/gitflow/references/init-version-detection.md +1 -1
- package/templates/skills/gitflow/steps/step-init.md +44 -15
- package/templates/skills/gitflow/templates/config.json +1 -1
- package/templates/skills/ralph-loop/references/category-rules.md +13 -0
package/package.json
CHANGED
|
@@ -64,6 +64,7 @@ Execute incremental SmartStack development using the APEX methodology. This skil
|
|
|
64
64
|
| `{module_complexity}` | string | "simple-crud", "crud-rules", "crud-workflow", "complex" |
|
|
65
65
|
| `{has_dependencies}` | string | "none", "references", "unknown" |
|
|
66
66
|
| `{key_properties}` | string[] | Key business properties mentioned by user |
|
|
67
|
+
| `{code_patterns}` | object[] | Per-entity code generation config [{entity, strategy, prefix, digits, includeTenantSlug, separator}] |
|
|
67
68
|
| `{prd_path}` | string? | `.ralph/prd-{module}.json` if exists |
|
|
68
69
|
| `{feature_path}` | string? | `docs/business/.../feature.json` if exists |
|
|
69
70
|
| `{needs_seed_data}` | boolean | Seed data creation required |
|
|
@@ -38,26 +38,37 @@ For each entity found (or to be created), determine the `tenantMode`:
|
|
|
38
38
|
|
|
39
39
|
## Code Pattern Detection
|
|
40
40
|
|
|
41
|
-
For each entity found (or to be created), identify code generation needs
|
|
41
|
+
For each entity found (or to be created), identify code generation needs using the following **priority order**:
|
|
42
42
|
|
|
43
43
|
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
PRIORITY 1 — User choice from challenge questions (step-00):
|
|
45
|
+
IF {code_patterns} is set (from step-00 section 5c):
|
|
46
|
+
→ Use {code_patterns} for each entity
|
|
47
|
+
→ This is the user's explicit choice — always takes precedence
|
|
48
|
+
|
|
49
|
+
PRIORITY 2 — feature.json (from /business-analyse):
|
|
50
|
+
IF feature.json exists AND entity has codePattern:
|
|
51
|
+
→ Use codePattern config from feature.json (strategy, prefix, digits, etc.)
|
|
52
|
+
→ Record in analysis: entity has auto-generated code
|
|
53
|
+
|
|
54
|
+
PRIORITY 3 — Heuristic fallback (delegate mode ONLY):
|
|
55
|
+
IF delegate_mode AND no code pattern from Priority 1 or 2:
|
|
56
|
+
→ Apply heuristic default based on entity name:
|
|
57
|
+
Invoice/Order/Receipt/PurchaseOrder → timestamp-daily
|
|
58
|
+
Ticket/Incident/SupportRequest → timestamp-minute
|
|
59
|
+
Contract/Policy/Agreement → year-sequential
|
|
60
|
+
Category/Status/Type (reference data) → uuid-short
|
|
61
|
+
Employee/Customer/Project → sequential
|
|
62
|
+
→ WARNING: heuristic applied — PRD was incomplete
|
|
63
|
+
|
|
64
|
+
FALLBACK — Manual (safest default):
|
|
65
|
+
IF none of the above apply:
|
|
66
|
+
→ strategy: "manual" (Code field in CreateDto, user-provided)
|
|
67
|
+
→ No auto-generation, no ICodeGenerator injection
|
|
59
68
|
```
|
|
60
69
|
|
|
70
|
+
**IMPORTANT:** In interactive mode (no `-d` flag), heuristics are NEVER applied silently. The user is always asked via challenge questions (step-00 section 5c). Heuristics only serve as fallback in delegate mode when the PRD is incomplete.
|
|
71
|
+
|
|
61
72
|
**Why:** Code generation strategy drives CreateDto structure, service injection (ICodeGenerator<T>), and DI registration.
|
|
62
73
|
|
|
63
74
|
**Reference:** See `references/code-generation.md` for strategy table, volume-to-digits calculation, and backend patterns.
|
|
@@ -158,6 +158,149 @@ questions:
|
|
|
158
158
|
|
|
159
159
|
---
|
|
160
160
|
|
|
161
|
+
## 5c. Code Generation Strategy
|
|
162
|
+
|
|
163
|
+
> **Purpose:** When `/apex` is used directly (without `/business-analyse`), the user is never asked about entity code generation strategy. This section fills that gap with a rapid, consolidated question.
|
|
164
|
+
|
|
165
|
+
### Skip Conditions
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
IF delegate_mode (-d flag):
|
|
169
|
+
→ SKIP (ralph-loop / PRD already defines code patterns)
|
|
170
|
+
|
|
171
|
+
IF feature.json exists AND ALL entities have codePattern defined:
|
|
172
|
+
→ SKIP (BA already collected code patterns)
|
|
173
|
+
→ Extract {code_patterns} from feature.json for each entity
|
|
174
|
+
|
|
175
|
+
IF foundation_mode (--foundation):
|
|
176
|
+
→ SKIP (foundation generates entities but code strategy comes from PRD)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Code Pattern Heuristic — `suggestCodePattern(entityName)`
|
|
180
|
+
|
|
181
|
+
Suggests a recommended strategy + prefix based on entity name:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
FUNCTION suggestCodePattern(entityName):
|
|
185
|
+
prefix = KNOWN_PREFIXES[entityName] ?? entityName[0:3].toLowerCase()
|
|
186
|
+
strategy = KNOWN_STRATEGIES[entityName] ?? "sequential"
|
|
187
|
+
digits = 5 # default (covers 99,999 records per tenant)
|
|
188
|
+
RETURN { strategy, prefix, digits, includeTenantSlug: true, separator: "-" }
|
|
189
|
+
|
|
190
|
+
KNOWN_PREFIXES:
|
|
191
|
+
Employee → "emp", Invoice → "inv", Contract → "ctr",
|
|
192
|
+
Order → "ord", Ticket → "tkt", Project → "prj",
|
|
193
|
+
Customer → "cus", Product → "prd", Expense → "exp",
|
|
194
|
+
Leave → "lev", Department → "dep", Document → "doc"
|
|
195
|
+
|
|
196
|
+
KNOWN_STRATEGIES:
|
|
197
|
+
Invoice, Order, Receipt, PurchaseOrder → "timestamp-daily"
|
|
198
|
+
Ticket, Incident, SupportRequest → "timestamp-minute"
|
|
199
|
+
Contract, Policy, Agreement → "year-sequential"
|
|
200
|
+
Category, Status, Type (reference data) → "uuid-short"
|
|
201
|
+
DEFAULT → "sequential"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Question — Single Entity (1 entity)
|
|
205
|
+
|
|
206
|
+
When `{entities}.length == 1`:
|
|
207
|
+
|
|
208
|
+
```yaml
|
|
209
|
+
# Compute suggestion first
|
|
210
|
+
suggestion = suggestCodePattern({entities}[0])
|
|
211
|
+
example = "{suggestion.prefix}-{tenantSlug}-00001" # or appropriate format per strategy
|
|
212
|
+
|
|
213
|
+
questions:
|
|
214
|
+
- header: "Code"
|
|
215
|
+
question: "How should the code for '{entities[0]}' be generated?"
|
|
216
|
+
options:
|
|
217
|
+
- label: "Auto-generate: {suggestion.strategy} with prefix '{suggestion.prefix}' (Recommended)"
|
|
218
|
+
description: "Example: {example} — auto-generated, excluded from CreateDto"
|
|
219
|
+
- label: "Auto-generate with custom settings"
|
|
220
|
+
description: "Choose strategy, prefix, and separator yourself"
|
|
221
|
+
- label: "Manual (user-provided)"
|
|
222
|
+
description: "Code field included in CreateDto — user enters the code manually"
|
|
223
|
+
multiSelect: false
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Follow-up if "custom settings":**
|
|
227
|
+
```yaml
|
|
228
|
+
questions:
|
|
229
|
+
- header: "Strategy"
|
|
230
|
+
question: "Which code generation strategy for '{entities[0]}'?"
|
|
231
|
+
options:
|
|
232
|
+
- label: "sequential"
|
|
233
|
+
description: "Simple incrementing counter: {prefix}-{tenant}-00001, 00002, ..."
|
|
234
|
+
- label: "timestamp-daily"
|
|
235
|
+
description: "Date-based: {prefix}-{tenant}-20260222-001"
|
|
236
|
+
- label: "year-sequential"
|
|
237
|
+
description: "Year prefix: {prefix}-{tenant}-2026-00001"
|
|
238
|
+
- label: "uuid-short"
|
|
239
|
+
description: "Short unique ID: {prefix}-{tenant}-a1b2c3"
|
|
240
|
+
multiSelect: false
|
|
241
|
+
- header: "Prefix"
|
|
242
|
+
question: "What prefix for the code? (2-6 lowercase letters)"
|
|
243
|
+
options:
|
|
244
|
+
- label: "{suggestion.prefix} (Recommended)"
|
|
245
|
+
description: "Auto-suggested from entity name"
|
|
246
|
+
- label: "Custom"
|
|
247
|
+
description: "Enter your own prefix in 'Other'"
|
|
248
|
+
multiSelect: false
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Question — Multiple Entities (2+ entities)
|
|
252
|
+
|
|
253
|
+
When `{entities}.length >= 2`:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
Compute suggestions for ALL entities:
|
|
257
|
+
recommendations = {entities}.map(e => { entity: e, ...suggestCodePattern(e) })
|
|
258
|
+
|
|
259
|
+
Display table:
|
|
260
|
+
| Entity | Strategy | Prefix | Example |
|
|
261
|
+
|--------|----------|--------|---------|
|
|
262
|
+
| Employee | sequential | emp | emp-{tenant}-00001 |
|
|
263
|
+
| Contract | year-sequential | ctr | ctr-{tenant}-2026-00001 |
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
```yaml
|
|
267
|
+
questions:
|
|
268
|
+
- header: "Code"
|
|
269
|
+
question: "How should entity codes be generated? (see recommendations above)"
|
|
270
|
+
options:
|
|
271
|
+
- label: "Accept all recommendations (Recommended)"
|
|
272
|
+
description: "Use the suggested strategy and prefix for each entity"
|
|
273
|
+
- label: "All manual (user-provided)"
|
|
274
|
+
description: "No auto-generation — Code field in CreateDto for all entities"
|
|
275
|
+
- label: "Customize per entity"
|
|
276
|
+
description: "Choose strategy individually for each entity"
|
|
277
|
+
multiSelect: false
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**If "Customize per entity":**
|
|
281
|
+
→ Loop through each entity and ask the single-entity question (section above).
|
|
282
|
+
|
|
283
|
+
### Storage Format
|
|
284
|
+
|
|
285
|
+
```yaml
|
|
286
|
+
{code_patterns}:
|
|
287
|
+
- entity: "Employee"
|
|
288
|
+
strategy: "sequential"
|
|
289
|
+
prefix: "emp"
|
|
290
|
+
digits: 5
|
|
291
|
+
includeTenantSlug: true
|
|
292
|
+
separator: "-"
|
|
293
|
+
- entity: "Contract"
|
|
294
|
+
strategy: "year-sequential"
|
|
295
|
+
prefix: "ctr"
|
|
296
|
+
digits: 5
|
|
297
|
+
includeTenantSlug: true
|
|
298
|
+
separator: "-"
|
|
299
|
+
# strategy: "manual" → no auto-generation for this entity
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
161
304
|
## Delegate Mode Skip (if -d flag)
|
|
162
305
|
|
|
163
306
|
When `/ralph-loop` invokes `/apex -d {prd_path}`, ALL hierarchy is extracted from the PRD file:
|