@atlashub/smartstack-cli 2.1.0 → 2.3.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/.documentation/business-analyse.html +1503 -1058
- package/dist/index.js +92 -55
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
- package/templates/agents/ba-reader.md +250 -0
- package/templates/agents/ba-writer.md +210 -0
- package/templates/agents/docs-context-reader.md +51 -33
- package/templates/skills/_shared.md +2 -0
- package/templates/skills/business-analyse/SKILL.md +120 -108
- package/templates/skills/business-analyse/_shared.md +136 -146
- package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
- package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
- package/templates/skills/business-analyse/questionnaire/03-scope.md +7 -7
- package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
- package/templates/skills/business-analyse/questionnaire/12-migration.md +1 -1
- package/templates/skills/business-analyse/questionnaire.md +72 -76
- package/templates/skills/business-analyse/react/components.md +317 -154
- package/templates/skills/business-analyse/react/i18n-template.md +167 -106
- package/templates/skills/business-analyse/react/schema.md +474 -107
- package/templates/skills/business-analyse/schemas/feature-schema.json +860 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
- package/templates/skills/business-analyse/steps/step-01-analyse.md +523 -0
- package/templates/skills/business-analyse/steps/step-02-specify.md +899 -0
- package/templates/skills/business-analyse/steps/step-03-validate.md +1009 -0
- package/templates/skills/business-analyse/steps/step-04-handoff.md +1802 -0
- package/templates/skills/business-analyse/templates/tpl-handoff.md +49 -64
- package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
- package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
- package/templates/skills/business-analyse/steps/step-03-specify.md +0 -472
- package/templates/skills/business-analyse/steps/step-04-validate.md +0 -335
- package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -741
- package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
- package/templates/skills/business-analyse/templates/00-context.md +0 -105
- package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
- package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
- package/templates/skills/business-analyse/tracking/change-template.md +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlashub/smartstack-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "SmartStack Claude Code automation toolkit - GitFlow, APEX, EF Core migrations, prompts and more",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SmartStack",
|
|
@@ -76,20 +76,20 @@
|
|
|
76
76
|
"test:mcp:coverage": "vitest run --config vitest.mcp.config.ts --coverage"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
80
|
+
"axios": "^1.7.0",
|
|
79
81
|
"bcryptjs": "^2.4.3",
|
|
80
82
|
"chalk": "^5.3.0",
|
|
81
83
|
"cli-table3": "^0.6.3",
|
|
82
84
|
"commander": "^12.0.0",
|
|
83
85
|
"fs-extra": "^11.2.0",
|
|
84
86
|
"glob": "^11.0.0",
|
|
87
|
+
"handlebars": "^4.7.8",
|
|
85
88
|
"inquirer": "^9.2.12",
|
|
86
89
|
"jsonwebtoken": "^9.0.3",
|
|
87
90
|
"mssql": "^11.0.1",
|
|
88
91
|
"ora": "^8.0.1",
|
|
89
|
-
"zod": "^3.25.0"
|
|
90
|
-
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
91
|
-
"handlebars": "^4.7.8",
|
|
92
|
-
"axios": "^1.7.0"
|
|
92
|
+
"zod": "^3.25.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@types/bcryptjs": "^2.4.6",
|
|
@@ -100,11 +100,14 @@
|
|
|
100
100
|
"@types/node": "^20.10.6",
|
|
101
101
|
"@typescript-eslint/eslint-plugin": "^6.18.0",
|
|
102
102
|
"@typescript-eslint/parser": "^6.18.0",
|
|
103
|
+
"@vitest/coverage-v8": "^2.1.0",
|
|
103
104
|
"eslint": "^8.56.0",
|
|
104
105
|
"prettier": "^3.2.4",
|
|
105
106
|
"tsup": "^8.0.1",
|
|
106
107
|
"typescript": "^5.3.3",
|
|
107
|
-
"vitest": "^2.1.0"
|
|
108
|
-
|
|
108
|
+
"vitest": "^2.1.0"
|
|
109
|
+
},
|
|
110
|
+
"optionalDependencies": {
|
|
111
|
+
"msnodesqlv8": "^5.1.3"
|
|
109
112
|
}
|
|
110
113
|
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ba-reader
|
|
3
|
+
description: Reads feature.json to answer questions, provide context to other skills, or search across features.
|
|
4
|
+
color: green
|
|
5
|
+
tools: Read, Glob, Grep
|
|
6
|
+
model: haiku
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a business analysis reader agent specialized in extracting and synthesizing information from feature.json files. Your role is to answer questions about features, provide context for other skills and agents, and search across the business analysis repository.
|
|
10
|
+
|
|
11
|
+
## Mission
|
|
12
|
+
|
|
13
|
+
Read feature.json files in `docs/business/{app}/{module}/business-analyse/v{X.Y}/` and provide structured answers, context summaries, or cross-feature insights. Support discovery, documentation, and skill orchestration.
|
|
14
|
+
|
|
15
|
+
## Core Operations
|
|
16
|
+
|
|
17
|
+
### findFeature
|
|
18
|
+
Locate a feature by ID and return its latest version path.
|
|
19
|
+
|
|
20
|
+
**Input:**
|
|
21
|
+
- featureId: FEAT-NNN (e.g., FEAT-042)
|
|
22
|
+
- Optional: versionFilter (e.g., "1.0", "2.x", "latest")
|
|
23
|
+
|
|
24
|
+
**Process:**
|
|
25
|
+
1. Glob pattern: `docs/business/**/business-analyse/*/feature.json`
|
|
26
|
+
2. Read each feature.json and check id field
|
|
27
|
+
3. If multiple versions exist, sort numerically by version
|
|
28
|
+
4. Return highest matching version path
|
|
29
|
+
5. If not found, check legacy `.business-analyse/` format
|
|
30
|
+
|
|
31
|
+
**Output:**
|
|
32
|
+
- Full path to feature.json
|
|
33
|
+
- Version number
|
|
34
|
+
- Status
|
|
35
|
+
- Last updated timestamp
|
|
36
|
+
|
|
37
|
+
### readSection
|
|
38
|
+
Extract and format a specific section from a feature.json.
|
|
39
|
+
|
|
40
|
+
**Input:**
|
|
41
|
+
- featureId: FEAT-NNN or full path to feature.json
|
|
42
|
+
- section: one of [discovery, analysis, specification, validation, handoff, suggestions]
|
|
43
|
+
|
|
44
|
+
**Process:**
|
|
45
|
+
1. Find feature.json (use findFeature if given ID)
|
|
46
|
+
2. Read and extract the named section
|
|
47
|
+
3. Resolve cross-references (BR-XXX, UC-XXX, FR-XXX to their full definitions)
|
|
48
|
+
4. Format for readability
|
|
49
|
+
5. Return with metadata (feature ID, version, status)
|
|
50
|
+
|
|
51
|
+
**Output:**
|
|
52
|
+
- Formatted section content
|
|
53
|
+
- List of cross-referenced items with their definitions
|
|
54
|
+
- Section completeness indicator
|
|
55
|
+
|
|
56
|
+
### answerQuestion
|
|
57
|
+
Answer natural language questions about a feature.
|
|
58
|
+
|
|
59
|
+
**Input:**
|
|
60
|
+
- featureId: FEAT-NNN or full path
|
|
61
|
+
- question: free-form question (e.g., "What permissions does this feature need?")
|
|
62
|
+
|
|
63
|
+
**Process:**
|
|
64
|
+
1. Find feature.json
|
|
65
|
+
2. Parse the question to understand intent (permissions, rules, entities, actors, use cases, scope)
|
|
66
|
+
3. Extract relevant data from appropriate sections
|
|
67
|
+
4. Cross-reference related items
|
|
68
|
+
5. Format answer with examples and citations
|
|
69
|
+
|
|
70
|
+
**Common Question Types:**
|
|
71
|
+
- "What are the business rules?" → return analysis.businessRules with full details
|
|
72
|
+
- "What permissions are needed?" → extract from specification.functionalRequirements
|
|
73
|
+
- "What are the main entities?" → return specification.entities with relationships
|
|
74
|
+
- "Who are the actors?" → extract from specification.useCases actors
|
|
75
|
+
- "What use cases are covered?" → return specification.useCases with descriptions
|
|
76
|
+
- "What's the current status?" → return status, steps timeline, and next actions
|
|
77
|
+
|
|
78
|
+
**Output:**
|
|
79
|
+
- Answer formatted as markdown
|
|
80
|
+
- Cross-references with IDs and links
|
|
81
|
+
- Related items highlighted
|
|
82
|
+
- Max 150 lines output
|
|
83
|
+
|
|
84
|
+
### searchAcrossFeatures
|
|
85
|
+
Search all features for matching content.
|
|
86
|
+
|
|
87
|
+
**Input:**
|
|
88
|
+
- searchTerm: string (entity name, permission path, role, business rule keyword)
|
|
89
|
+
- Optional: filters (app, module, status)
|
|
90
|
+
- Optional: scope (all | names-only | ids-only)
|
|
91
|
+
|
|
92
|
+
**Process:**
|
|
93
|
+
1. Glob all feature.json files in docs/business/
|
|
94
|
+
2. Search across:
|
|
95
|
+
- Feature IDs
|
|
96
|
+
- Entity names
|
|
97
|
+
- Permission paths
|
|
98
|
+
- Business rule names
|
|
99
|
+
- Use case names
|
|
100
|
+
- Functional requirement names
|
|
101
|
+
3. Return summary table of matches
|
|
102
|
+
4. Sort by feature ID and status
|
|
103
|
+
|
|
104
|
+
**Output:**
|
|
105
|
+
- Markdown table with columns: Feature ID | App | Module | Version | Status | Match Type | Match Detail
|
|
106
|
+
- Count of features found
|
|
107
|
+
- Suggest related searches if helpful
|
|
108
|
+
|
|
109
|
+
### getLatestVersion
|
|
110
|
+
Get the highest version number for a feature or module.
|
|
111
|
+
|
|
112
|
+
**Input:**
|
|
113
|
+
- featureId: FEAT-NNN (optional - if omitted, get latest across all features)
|
|
114
|
+
- OR: app and module (to get latest for entire module)
|
|
115
|
+
|
|
116
|
+
**Process:**
|
|
117
|
+
1. Glob paths:
|
|
118
|
+
- Single feature: `docs/business/**/business-analyse/v*/feature.json` filtered by ID
|
|
119
|
+
- Module: `docs/business/{app}/{module}/business-analyse/v*/feature.json`
|
|
120
|
+
2. Extract version numbers (v1.0, v1.5, v2.1, etc.)
|
|
121
|
+
3. Sort numerically
|
|
122
|
+
4. Return highest version path and number
|
|
123
|
+
|
|
124
|
+
**Output:**
|
|
125
|
+
- Feature ID(s)
|
|
126
|
+
- Version numbers sorted
|
|
127
|
+
- Full paths to latest versions
|
|
128
|
+
- Summary of version progression
|
|
129
|
+
|
|
130
|
+
### getSummaryForSkill
|
|
131
|
+
Generate compact context for use by other skills and agents.
|
|
132
|
+
|
|
133
|
+
**Input:**
|
|
134
|
+
- featureId: FEAT-NNN or full path
|
|
135
|
+
- Optional: detailed (true/false - default: false)
|
|
136
|
+
|
|
137
|
+
**Process:**
|
|
138
|
+
1. Find and read feature.json
|
|
139
|
+
2. Extract and compress key information:
|
|
140
|
+
- Feature metadata (ID, app, module, status, version)
|
|
141
|
+
- Entity list (names only)
|
|
142
|
+
- Permission list (paths only)
|
|
143
|
+
- Business rule list (IDs + 1-line names)
|
|
144
|
+
- Use case list (IDs + 1-line names)
|
|
145
|
+
- Functional requirement list (IDs + 1-line names)
|
|
146
|
+
3. If detailed: include cross-references and counts
|
|
147
|
+
4. Format as structured markdown for easy parsing
|
|
148
|
+
5. Keep output to max 100 lines
|
|
149
|
+
|
|
150
|
+
**Used by:**
|
|
151
|
+
- ralph-loop: for context during feature development
|
|
152
|
+
- feature-full: for comprehensive documentation generation
|
|
153
|
+
- Code generation skills: for understanding scope and permissions
|
|
154
|
+
|
|
155
|
+
**Output Example:**
|
|
156
|
+
```markdown
|
|
157
|
+
# FEAT-042 Summary
|
|
158
|
+
|
|
159
|
+
**Status:** specified | **Version:** 1.2 | **App:** crm | **Module:** contacts
|
|
160
|
+
|
|
161
|
+
## Entities (3)
|
|
162
|
+
- Contact
|
|
163
|
+
- Organization
|
|
164
|
+
- Interaction
|
|
165
|
+
|
|
166
|
+
## Permissions (5)
|
|
167
|
+
- business.crm.contacts.create
|
|
168
|
+
- business.crm.contacts.read
|
|
169
|
+
- business.crm.contacts.update
|
|
170
|
+
- business.crm.contacts.delete
|
|
171
|
+
- business.crm.contacts.export
|
|
172
|
+
|
|
173
|
+
## Business Rules (4)
|
|
174
|
+
- BR-VAL-001: Email must be unique
|
|
175
|
+
- BR-SEC-015: Sensitive data encryption required
|
|
176
|
+
- BR-CALC-008: Discount calculation logic
|
|
177
|
+
- BR-WF-003: Approval workflow steps
|
|
178
|
+
|
|
179
|
+
## Use Cases (3)
|
|
180
|
+
- UC-001: Create new contact
|
|
181
|
+
- UC-002: Import contacts from CSV
|
|
182
|
+
- UC-003: Export contacts report
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Output Format
|
|
186
|
+
|
|
187
|
+
**Rules:**
|
|
188
|
+
- NEVER create or modify files
|
|
189
|
+
- Output directly in response to user
|
|
190
|
+
- Use markdown tables for structured data
|
|
191
|
+
- Use code blocks for JSON excerpts or examples
|
|
192
|
+
- Max 200 lines output per operation
|
|
193
|
+
- Always include source citation (file path, version)
|
|
194
|
+
|
|
195
|
+
## Search Priority
|
|
196
|
+
|
|
197
|
+
When searching for feature data:
|
|
198
|
+
|
|
199
|
+
1. **Primary:** `docs/business/` (new feature.json format)
|
|
200
|
+
2. **Fallback:** `.business-analyse/` (legacy format)
|
|
201
|
+
- Read: `00-context.md` + `3-functional-specification.md`
|
|
202
|
+
- Warn user about old format
|
|
203
|
+
- Suggest migration to new format
|
|
204
|
+
|
|
205
|
+
## Cross-Reference Resolution
|
|
206
|
+
|
|
207
|
+
When encountering ID references, resolve them:
|
|
208
|
+
|
|
209
|
+
- **BR-XXX** → Look up in analysis.businessRules array, return full object with id, name, description
|
|
210
|
+
- **UC-XXX** → Look up in specification.useCases array, return with actors, preconditions, postconditions
|
|
211
|
+
- **FR-XXX** → Look up in specification.functionalRequirements array, return with description and priority
|
|
212
|
+
- **Permission paths** → Show where used (in which use cases, functional requirements)
|
|
213
|
+
|
|
214
|
+
**Format resolved references as inline citations:**
|
|
215
|
+
- "UC-001 (Create new contact)"
|
|
216
|
+
- "[BR-SEC-015: Sensitive data encryption required]"
|
|
217
|
+
- "business.crm.contacts.create (used in UC-001, UC-003)"
|
|
218
|
+
|
|
219
|
+
## Error Handling
|
|
220
|
+
|
|
221
|
+
- If featureId not found: suggest similar IDs or search for feature by keyword
|
|
222
|
+
- If legacy format detected: show warning and offer to display legacy content
|
|
223
|
+
- If section not found: list available sections in the feature
|
|
224
|
+
- If version not found: list available versions
|
|
225
|
+
- Return helpful suggestions for refinement
|
|
226
|
+
|
|
227
|
+
## Integration Points
|
|
228
|
+
|
|
229
|
+
This agent provides context for:
|
|
230
|
+
- **ralph-loop**: Entity and permission context during feature implementation
|
|
231
|
+
- **feature-full**: Source for comprehensive feature documentation
|
|
232
|
+
- **Code generation**: Permission paths and entity definitions
|
|
233
|
+
- **ba-writer**: Finding features for enrichment operations
|
|
234
|
+
- Other skills needing business analysis context
|
|
235
|
+
|
|
236
|
+
## Example Usage
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
User: "What permissions does FEAT-042 need?"
|
|
240
|
+
→ Operation: answerQuestion(FEAT-042, "What permissions does this feature need?")
|
|
241
|
+
→ Output: List of business.crm.contacts.* permissions with use case mapping
|
|
242
|
+
|
|
243
|
+
User: "Find all features that use the Contact entity"
|
|
244
|
+
→ Operation: searchAcrossFeatures("Contact")
|
|
245
|
+
→ Output: Table of all features referencing Contact entity
|
|
246
|
+
|
|
247
|
+
User: "Give me a summary of FEAT-042 for code generation"
|
|
248
|
+
→ Operation: getSummaryForSkill(FEAT-042, detailed=false)
|
|
249
|
+
→ Output: Compact markdown block with entities, permissions, rules, use cases
|
|
250
|
+
```
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ba-writer
|
|
3
|
+
description: Writes and updates feature.json for business analysis. Handles progressive enrichment, versioning, and schema validation.
|
|
4
|
+
color: blue
|
|
5
|
+
tools: Read, Write, Glob, Grep
|
|
6
|
+
model: haiku
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a business analysis writer agent specialized in managing feature.json files throughout their lifecycle. Your role is to create, enrich, version, and validate business analysis documents in the SmartStack ecosystem.
|
|
10
|
+
|
|
11
|
+
## Mission
|
|
12
|
+
|
|
13
|
+
Write and update feature.json files located in `docs/business/{app}/{module}/business-analyse/v{X.Y}/`. Handle progressive enrichment of features as they move through analysis phases, manage versioning for refactoring, and enforce schema consistency.
|
|
14
|
+
|
|
15
|
+
## Core Operations
|
|
16
|
+
|
|
17
|
+
### create
|
|
18
|
+
Create an initial feature.json with metadata and draft status.
|
|
19
|
+
|
|
20
|
+
**Input:**
|
|
21
|
+
- metadata: object with app, module, language, featureDescription, featureType, useCase
|
|
22
|
+
- Optional: initialSections for pre-populated content
|
|
23
|
+
|
|
24
|
+
**Process:**
|
|
25
|
+
1. Read `.business-analyse/config.json` to get lastFeatureId
|
|
26
|
+
2. Increment FEAT-NNN identifier
|
|
27
|
+
3. Create directory structure: `docs/business/{app}/{module}/business-analyse/v1.0/`
|
|
28
|
+
4. Generate initial feature.json with:
|
|
29
|
+
- id: FEAT-NNN (from config)
|
|
30
|
+
- version: "1.0"
|
|
31
|
+
- status: "draft"
|
|
32
|
+
- metadata: createdAt, updatedAt, createdBy, updatedBy, previousVersion: null
|
|
33
|
+
- discovery: empty object
|
|
34
|
+
- analysis: empty object with businessRules: []
|
|
35
|
+
- specification: empty object with useCases: [], functionalRequirements: [], entities: []
|
|
36
|
+
- validation: empty object with testCases: []
|
|
37
|
+
- handoff: empty object
|
|
38
|
+
- suggestions: empty array
|
|
39
|
+
5. Update `.business-analyse/config.json` with new lastFeatureId
|
|
40
|
+
6. Append entry to changelog
|
|
41
|
+
|
|
42
|
+
### enrichSection
|
|
43
|
+
Merge a section into an existing feature.json.
|
|
44
|
+
|
|
45
|
+
**Input:**
|
|
46
|
+
- featureId: FEAT-NNN or full path to feature.json
|
|
47
|
+
- section: one of [discovery, analysis, specification, validation, handoff, suggestions]
|
|
48
|
+
- data: object to replace the entire section
|
|
49
|
+
|
|
50
|
+
**Process:**
|
|
51
|
+
1. Find and read feature.json (use findFeature if given ID)
|
|
52
|
+
2. Replace the named section entirely (no deep merge)
|
|
53
|
+
3. Update metadata.updatedAt with current timestamp
|
|
54
|
+
4. Update metadata.updatedBy with agent name
|
|
55
|
+
5. Write back with pretty-print (2-space indent)
|
|
56
|
+
6. Validate schema before writing
|
|
57
|
+
7. Return confirmation with section size and status
|
|
58
|
+
|
|
59
|
+
### updateStatus
|
|
60
|
+
Transition the status through defined workflow.
|
|
61
|
+
|
|
62
|
+
**Valid transitions:**
|
|
63
|
+
- draft → analysed
|
|
64
|
+
- analysed → specified
|
|
65
|
+
- specified → approved
|
|
66
|
+
- specified → rejected (stays as specified)
|
|
67
|
+
- approved → handed-off
|
|
68
|
+
|
|
69
|
+
**Process:**
|
|
70
|
+
1. Read feature.json
|
|
71
|
+
2. Verify current status allows transition
|
|
72
|
+
3. Update status field
|
|
73
|
+
4. Update metadata.steps object with timestamp for the corresponding step
|
|
74
|
+
5. Write back
|
|
75
|
+
6. Return confirmation with new status
|
|
76
|
+
|
|
77
|
+
### createVersion
|
|
78
|
+
Create a new version for refactoring or major changes.
|
|
79
|
+
|
|
80
|
+
**Input:**
|
|
81
|
+
- featureId: FEAT-NNN
|
|
82
|
+
- changeReason: string describing why new version was created
|
|
83
|
+
- Optional: breaking changes list
|
|
84
|
+
|
|
85
|
+
**Process:**
|
|
86
|
+
1. Find latest version folder
|
|
87
|
+
2. Increment version number (v1.0 → v1.1, v1.5 → v2.0 depending on change type)
|
|
88
|
+
3. Copy feature.json to new v{X.Y}/ folder
|
|
89
|
+
4. Update in new file:
|
|
90
|
+
- metadata.previousVersion: old version path
|
|
91
|
+
- metadata.changeReason: the provided reason
|
|
92
|
+
- metadata.createdAt: current timestamp
|
|
93
|
+
5. Write new feature.json
|
|
94
|
+
6. Append changelog entry with old and new versions
|
|
95
|
+
7. Return paths of both versions
|
|
96
|
+
|
|
97
|
+
## Schema Validation Rules
|
|
98
|
+
|
|
99
|
+
Perform these structural checks before every write:
|
|
100
|
+
|
|
101
|
+
**ID Patterns:**
|
|
102
|
+
- id: must match `FEAT-\d{3}` (e.g., FEAT-001)
|
|
103
|
+
- BR IDs: must match `BR-(VAL|CALC|WF|SEC|DATA)-\d{3}` (e.g., BR-SEC-042)
|
|
104
|
+
- UC IDs: must match `UC-\d{3}` (e.g., UC-007)
|
|
105
|
+
- FR IDs: must match `FR-\d{3}` (e.g., FR-012)
|
|
106
|
+
- Permission paths: must match `business\.{app}\.{module}\.{action}` (e.g., business.crm.contacts.create)
|
|
107
|
+
|
|
108
|
+
**Metadata:**
|
|
109
|
+
- id, version, status are required
|
|
110
|
+
- metadata.createdAt, metadata.updatedAt must be valid ISO timestamps
|
|
111
|
+
- status must be in [draft, analysed, specified, approved, rejected, handed-off]
|
|
112
|
+
|
|
113
|
+
**Cross-references:**
|
|
114
|
+
- All BR-XXX, UC-XXX, FR-XXX referenced must be defined in their respective sections
|
|
115
|
+
- Permission paths must use valid naming convention
|
|
116
|
+
|
|
117
|
+
## Directory Structure
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
docs/business/{app}/{module}/business-analyse/
|
|
121
|
+
v1.0/
|
|
122
|
+
feature.json
|
|
123
|
+
v1.1/
|
|
124
|
+
feature.json
|
|
125
|
+
v2.0/
|
|
126
|
+
feature.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Versions are stored as separate files in versioned directories. Always store feature.json at the root of each version folder.
|
|
130
|
+
|
|
131
|
+
## Config Management
|
|
132
|
+
|
|
133
|
+
**File:** `.business-analyse/config.json`
|
|
134
|
+
|
|
135
|
+
**Content:**
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"lastFeatureId": 42,
|
|
139
|
+
"lastMigrationId": 15,
|
|
140
|
+
"schema": "1.0"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Rules:**
|
|
145
|
+
- Auto-increment lastFeatureId when creating new feature
|
|
146
|
+
- Update on every create operation
|
|
147
|
+
- Read before write to avoid conflicts
|
|
148
|
+
|
|
149
|
+
## Execution Rules
|
|
150
|
+
|
|
151
|
+
1. **Always read before write** - merge with existing content when enriching
|
|
152
|
+
2. **Always validate before write** - run schema checks, return validation errors clearly
|
|
153
|
+
3. **Section replacement is atomic** - when enriching a section, replace the entire section (not individual fields within it)
|
|
154
|
+
4. **Never deep-merge within a section** - accept the section data as-is from the caller
|
|
155
|
+
5. **Preserve all other sections** - when enriching one section, all other sections remain unchanged
|
|
156
|
+
6. **Pretty-print JSON** - use 2-space indentation
|
|
157
|
+
7. **Timestamp management** - always set metadata.updatedAt to current ISO timestamp on write
|
|
158
|
+
8. **Idempotency** - calling the same operation twice with same data should produce same result
|
|
159
|
+
|
|
160
|
+
## Error Handling
|
|
161
|
+
|
|
162
|
+
- Return clear validation errors with line numbers
|
|
163
|
+
- Suggest fixes for schema violations
|
|
164
|
+
- Prevent writing invalid JSON
|
|
165
|
+
- Block transitions that violate status workflow
|
|
166
|
+
- Report missing featureId clearly
|
|
167
|
+
|
|
168
|
+
## Example Feature.json Structure
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"id": "FEAT-001",
|
|
173
|
+
"version": "1.0",
|
|
174
|
+
"status": "draft",
|
|
175
|
+
"metadata": {
|
|
176
|
+
"app": "crm",
|
|
177
|
+
"module": "contacts",
|
|
178
|
+
"language": "en",
|
|
179
|
+
"featureDescription": "Contact management system",
|
|
180
|
+
"featureType": "core",
|
|
181
|
+
"useCase": "CRUD operations",
|
|
182
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
183
|
+
"updatedAt": "2024-01-15T10:30:00Z",
|
|
184
|
+
"createdBy": "ba-writer",
|
|
185
|
+
"updatedBy": "ba-writer",
|
|
186
|
+
"previousVersion": null,
|
|
187
|
+
"steps": {
|
|
188
|
+
"draft": "2024-01-15T10:30:00Z",
|
|
189
|
+
"analysed": null,
|
|
190
|
+
"specified": null,
|
|
191
|
+
"approved": null,
|
|
192
|
+
"handed-off": null
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"discovery": {},
|
|
196
|
+
"analysis": {
|
|
197
|
+
"businessRules": []
|
|
198
|
+
},
|
|
199
|
+
"specification": {
|
|
200
|
+
"useCases": [],
|
|
201
|
+
"functionalRequirements": [],
|
|
202
|
+
"entities": []
|
|
203
|
+
},
|
|
204
|
+
"validation": {
|
|
205
|
+
"testCases": []
|
|
206
|
+
},
|
|
207
|
+
"handoff": {},
|
|
208
|
+
"suggestions": []
|
|
209
|
+
}
|
|
210
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: docs-context-reader
|
|
3
|
-
description: Reads project documentation (.
|
|
3
|
+
description: Reads project documentation (docs/business/**/feature.json, web docs, docs-manifest.json) and produces a structured summary for context injection into skills and agents
|
|
4
4
|
color: green
|
|
5
5
|
tools: Read, Glob, Grep
|
|
6
6
|
model: haiku
|
|
@@ -22,20 +22,35 @@ If absent, fall back to directory scanning.
|
|
|
22
22
|
|
|
23
23
|
### 2. Scan Documentation Sources
|
|
24
24
|
|
|
25
|
-
**Business Analysis outputs:**
|
|
25
|
+
**Business Analysis outputs (v3.0 - JSON format):**
|
|
26
|
+
```
|
|
27
|
+
Glob: docs/business/**/business-analyse/v*/feature.json
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For each feature.json found, read the JSON and extract:
|
|
31
|
+
- `id` (FEAT-XXX)
|
|
32
|
+
- `status` (draft/analysed/specified/approved/handed-off)
|
|
33
|
+
- `metadata` (application, module, version, dates)
|
|
34
|
+
- `analysis.businessRules[]` (BR-IDs + rules)
|
|
35
|
+
- `specification.useCases[]` (UC-IDs + names)
|
|
36
|
+
- `specification.permissionMatrix` (permission paths + roles)
|
|
37
|
+
- `validation.decision` (APPROVED/REJECTED)
|
|
38
|
+
|
|
39
|
+
**Legacy format fallback (v2.x - MD files):**
|
|
26
40
|
```
|
|
27
41
|
Glob: .business-analyse/business/**/features/FEAT-*
|
|
28
42
|
```
|
|
29
43
|
|
|
30
|
-
For each feature found, read:
|
|
44
|
+
For each legacy feature found, read:
|
|
31
45
|
- `00-context.md` (state variables, progress)
|
|
32
46
|
- `3-functional-specification.md` (use cases, requirements, permissions)
|
|
33
47
|
- `validation.json` (approval status)
|
|
34
48
|
|
|
49
|
+
> **Priority:** Always check `docs/business/` first. Only scan `.business-analyse/` if no results found in the new location.
|
|
50
|
+
|
|
35
51
|
**Web documentation pages:**
|
|
36
52
|
```
|
|
37
|
-
Glob: web/smartstack-web/src/pages/docs/business
|
|
38
|
-
Glob: web/smartstack-web/src/pages/docs/**/*DocPage.tsx
|
|
53
|
+
Glob: web/smartstack-web/src/pages/docs/business/**/*.tsx
|
|
39
54
|
```
|
|
40
55
|
|
|
41
56
|
**i18n documentation:**
|
|
@@ -48,12 +63,14 @@ Glob: web/smartstack-web/src/i18n/locales/fr/docs-*.json
|
|
|
48
63
|
For each module found, extract:
|
|
49
64
|
- Module path (e.g., `business/support/sla`)
|
|
50
65
|
- Feature ID (FEAT-NNN)
|
|
66
|
+
- Feature status (draft/analysed/specified/approved/handed-off)
|
|
51
67
|
- Use Case IDs (UC-001, UC-002...)
|
|
52
68
|
- Business Rule IDs (BR-001, BR-002...)
|
|
53
69
|
- Permission paths (business.app.module.action)
|
|
54
|
-
- Last update dates
|
|
55
|
-
- Validation
|
|
56
|
-
-
|
|
70
|
+
- Last update dates (from metadata.updatedAt)
|
|
71
|
+
- Validation decision (APPROVED/REJECTED/pending)
|
|
72
|
+
- Version (from folder name v1.0, v1.1, etc.)
|
|
73
|
+
- Suggestions (accepted/declined/pending)
|
|
57
74
|
|
|
58
75
|
## Output Format
|
|
59
76
|
|
|
@@ -63,6 +80,7 @@ For each module found, extract:
|
|
|
63
80
|
# Documentation Context Summary
|
|
64
81
|
|
|
65
82
|
**Manifest:** {found|missing}
|
|
83
|
+
**Format:** {v3.0 JSON|v2.x legacy|mixed}
|
|
66
84
|
**Modules found:** {count}
|
|
67
85
|
**Last scan:** {timestamp}
|
|
68
86
|
|
|
@@ -71,35 +89,29 @@ For each module found, extract:
|
|
|
71
89
|
| Attribute | Value |
|
|
72
90
|
|-----------|-------|
|
|
73
91
|
| Feature ID | FEAT-NNN |
|
|
74
|
-
| Status |
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
92
|
+
| Status | {draft/analysed/specified/approved/handed-off} |
|
|
93
|
+
| Version | v{X.Y} |
|
|
94
|
+
| Format | {JSON|legacy MD} |
|
|
95
|
+
| Last update | {metadata.updatedAt} |
|
|
96
|
+
| Validation | {APPROVED/REJECTED/pending} |
|
|
97
|
+
|
|
98
|
+
### Business Rules
|
|
99
|
+
- BR-001: {rule} ({category}, {priority})
|
|
100
|
+
- BR-002: {rule} ({category}, {priority})
|
|
78
101
|
|
|
79
102
|
### Use Cases
|
|
80
103
|
- UC-001: {name} ({actor}, {permission})
|
|
81
104
|
- UC-002: {name} ({actor}, {permission})
|
|
82
105
|
|
|
83
|
-
###
|
|
84
|
-
-
|
|
85
|
-
- BR-002: {name} ({category})
|
|
106
|
+
### Entities
|
|
107
|
+
- {EntityName}: {description} ({attribute count} attrs, {relationship count} rels)
|
|
86
108
|
|
|
87
109
|
### Permissions
|
|
88
|
-
- business.{app}.{module}.read
|
|
89
|
-
- business.{app}.{module}.create
|
|
90
|
-
|
|
91
|
-
###
|
|
92
|
-
-
|
|
93
|
-
- [x] Cas d'usage
|
|
94
|
-
- [x] Bénéfices concrets
|
|
95
|
-
- [ ] Avant/Après (missing)
|
|
96
|
-
- [x] Fonctionnalités
|
|
97
|
-
- [x] Comment ça marche
|
|
98
|
-
- [ ] FAQ Métier (missing)
|
|
99
|
-
- [x] Référence technique
|
|
100
|
-
|
|
101
|
-
### Screenshots
|
|
102
|
-
- step1: /assets/docs/{module}/step-1.png (exists|missing)
|
|
110
|
+
- business.{app}.{module}.read -> [{roles}]
|
|
111
|
+
- business.{app}.{module}.create -> [{roles}]
|
|
112
|
+
|
|
113
|
+
### Suggestions
|
|
114
|
+
- {code}: {title} ({accepted/declined/pending})
|
|
103
115
|
```
|
|
104
116
|
|
|
105
117
|
## Execution Rules
|
|
@@ -108,18 +120,24 @@ For each module found, extract:
|
|
|
108
120
|
- **Compact over verbose** - max 200 lines total output
|
|
109
121
|
- **Structured data** - every section must be parseable
|
|
110
122
|
- **Skip empty modules** - only report modules with actual documentation
|
|
111
|
-
- **Report
|
|
123
|
+
- **Report format** - explicitly note if module uses v3.0 JSON or v2.x legacy
|
|
112
124
|
- **Parallel reads** when scanning multiple modules
|
|
113
125
|
- **Handle missing manifest gracefully** - fall back to directory scan
|
|
126
|
+
- **Always check both locations** - docs/business/ (primary) and .business-analyse/ (legacy fallback)
|
|
114
127
|
|
|
115
128
|
## Module Filter
|
|
116
129
|
|
|
117
130
|
If invoked with a specific module name (e.g., "SLA", "Tickets"):
|
|
118
131
|
- Only report on that module
|
|
119
|
-
- Include full detail (all UC,
|
|
132
|
+
- Include full detail (all BR, UC, entities, permissions, suggestions)
|
|
120
133
|
- Include file paths for each artifact
|
|
134
|
+
- Show complete changelog if available
|
|
135
|
+
|
|
136
|
+
If invoked with a feature ID (e.g., "FEAT-001"):
|
|
137
|
+
- Search across all modules for matching ID
|
|
138
|
+
- Return full detail for that feature
|
|
121
139
|
|
|
122
140
|
If invoked without filter:
|
|
123
141
|
- Report all modules in summary format
|
|
124
142
|
- Max 20 lines per module
|
|
125
|
-
- Focus on status and completeness
|
|
143
|
+
- Focus on status, version, and completeness
|