@atlashub/smartstack-cli 3.8.0 → 3.10.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/index.js +365 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/templates/agents/action.md +1 -0
- package/templates/agents/ba-writer.md +211 -0
- package/templates/agents/explore-codebase.md +1 -0
- package/templates/agents/explore-docs.md +1 -0
- package/templates/agents/fix-grammar.md +1 -0
- package/templates/agents/snipper.md +1 -0
- package/templates/skills/admin/SKILL.md +6 -0
- package/templates/skills/ai-prompt/SKILL.md +32 -136
- package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
- package/templates/skills/apex/SKILL.md +120 -0
- package/templates/skills/apex/_shared.md +86 -0
- package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
- package/templates/skills/apex/references/smartstack-layers.md +173 -0
- package/templates/skills/apex/steps/step-00-init.md +156 -0
- package/templates/skills/apex/steps/step-01-analyze.md +169 -0
- package/templates/skills/apex/steps/step-02-plan.md +160 -0
- package/templates/skills/apex/steps/step-03-execute.md +166 -0
- package/templates/skills/apex/steps/step-04-validate.md +138 -0
- package/templates/skills/apex/steps/step-05-examine.md +124 -0
- package/templates/skills/apex/steps/step-06-resolve.md +105 -0
- package/templates/skills/apex/steps/step-07-tests.md +130 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
- package/templates/skills/application/SKILL.md +10 -0
- package/templates/skills/application/references/application-roles-template.md +227 -0
- package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
- package/templates/skills/application/references/backend-entity-seeding.md +72 -0
- package/templates/skills/application/references/backend-verification.md +88 -0
- package/templates/skills/application/references/frontend-verification.md +111 -0
- package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
- package/templates/skills/application/references/provider-template.md +158 -0
- package/templates/skills/application/references/test-frontend.md +73 -0
- package/templates/skills/application/references/test-prerequisites.md +72 -0
- package/templates/skills/application/steps/step-01-navigation.md +7 -198
- package/templates/skills/application/steps/step-03-roles.md +45 -7
- package/templates/skills/application/steps/step-03b-provider.md +15 -132
- package/templates/skills/application/steps/step-04-backend.md +20 -350
- package/templates/skills/application/steps/step-05-frontend.md +12 -101
- package/templates/skills/application/steps/step-07-tests.md +12 -132
- package/templates/skills/business-analyse/SKILL.md +67 -6
- package/templates/skills/business-analyse/html/ba-interactive.html +176 -14
- package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +1 -0
- package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +16 -4
- package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +7 -2
- package/templates/skills/business-analyse/html/src/scripts/09-export.js +103 -0
- package/templates/skills/business-analyse/html/src/scripts/10-comments.js +12 -6
- package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +24 -2
- package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +12 -0
- package/templates/skills/business-analyse/html/src/template.html +1 -0
- package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +477 -0
- package/templates/skills/business-analyse/references/cache-warming-strategy.md +578 -0
- package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
- package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
- package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
- package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
- package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
- package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
- package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
- package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
- package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
- package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
- package/templates/skills/business-analyse/references/robustness-checks.md +538 -0
- package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
- package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
- package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
- package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
- package/templates/skills/business-analyse/schemas/sections/specification-schema.json +33 -1
- package/templates/skills/business-analyse/steps/step-00-init.md +186 -53
- package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
- package/templates/skills/business-analyse/steps/step-03a-data.md +42 -49
- package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
- package/templates/skills/business-analyse/steps/step-03c-compile.md +71 -2
- package/templates/skills/business-analyse/steps/step-03d-validate.md +277 -48
- package/templates/skills/business-analyse/steps/step-04-consolidation.md +175 -104
- package/templates/skills/business-analyse/steps/step-05a-handoff.md +66 -438
- package/templates/skills/business-analyse/steps/step-05b-deploy.md +35 -184
- package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +526 -0
- package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
- package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
- package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
- package/templates/skills/check-version/SKILL.md +7 -0
- package/templates/skills/controller/references/controller-code-templates.md +159 -0
- package/templates/skills/controller/references/permission-sync-templates.md +152 -0
- package/templates/skills/controller/steps/step-03-generate.md +166 -158
- package/templates/skills/controller/steps/step-04-perms.md +5 -144
- package/templates/skills/controller/templates.md +11 -2
- package/templates/skills/debug/SKILL.md +7 -0
- package/templates/skills/explore/SKILL.md +6 -0
- package/templates/skills/feature-full/SKILL.md +39 -142
- package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
- package/templates/skills/gitflow/references/init-config-template.md +135 -0
- package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
- package/templates/skills/gitflow/references/plan-template.md +69 -0
- package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
- package/templates/skills/gitflow/references/start-local-config.md +110 -0
- package/templates/skills/gitflow/steps/step-init.md +18 -289
- package/templates/skills/gitflow/steps/step-plan.md +6 -63
- package/templates/skills/gitflow/steps/step-start.md +16 -126
- package/templates/skills/mcp/SKILL.md +9 -213
- package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
- package/templates/skills/mcp/steps/step-02-tools.md +73 -0
- package/templates/skills/notification/SKILL.md +7 -0
- package/templates/skills/quick-search/SKILL.md +5 -0
- package/templates/skills/ralph-loop/SKILL.md +99 -381
- package/templates/skills/ralph-loop/references/category-rules.md +259 -0
- package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
- package/templates/skills/ralph-loop/references/core-seed-data.md +173 -21
- package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
- package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
- package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
- package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
- package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
- package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
- package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
- package/templates/skills/refactor/SKILL.md +12 -176
- package/templates/skills/refactor/steps/step-01-discover.md +60 -0
- package/templates/skills/refactor/steps/step-02-execute.md +67 -0
- package/templates/skills/review-code/SKILL.md +19 -257
- package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
- package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
- package/templates/skills/review-code/steps/step-03-react.md +44 -0
- package/templates/skills/ui-components/SKILL.md +7 -0
- package/templates/skills/utils/SKILL.md +6 -0
- package/templates/skills/validate/SKILL.md +6 -0
- package/templates/skills/validate-feature/SKILL.md +8 -0
- package/templates/skills/workflow/SKILL.md +40 -118
- package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlashub/smartstack-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SmartStack",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"test:all": "npm run test:mcp && npm run test:ba"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
+
"@atlashub/smartstack-cli": "file:../02-Develop",
|
|
83
84
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
84
85
|
"axios": "^1.7.0",
|
|
85
86
|
"bcryptjs": "^2.4.3",
|
|
@@ -3,6 +3,7 @@ name: action
|
|
|
3
3
|
description: Conditional action executor - performs actions only when specific conditions are met
|
|
4
4
|
color: purple
|
|
5
5
|
model: haiku
|
|
6
|
+
tools: Read, Glob, Grep, Bash
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
Batch conditional executor. Handle ≤5 tasks. VERIFY INDEPENDENTLY before each action.
|
|
@@ -88,6 +88,102 @@ Merge a section into an existing feature.json.
|
|
|
88
88
|
9. **Cross-Reference Validation (for specification and handoff sections):** See CROSS-REFERENCE VALIDATION section below
|
|
89
89
|
10. Return confirmation with section size and status
|
|
90
90
|
|
|
91
|
+
### enrichSectionIncremental
|
|
92
|
+
Incrementally update a section in feature.json using PATCH-style operations instead of full section replacement. Optimized for large files and preventing file size issues.
|
|
93
|
+
|
|
94
|
+
**Input:**
|
|
95
|
+
- featureId: FEAT-NNN or full path to feature.json
|
|
96
|
+
- section: one of [discovery, analysis, specification, validation, handoff, suggestions, cadrage, consolidation, modules, dependencyGraph, metadata.workflow]
|
|
97
|
+
- operation: "merge" | "append" | "update" | "delete"
|
|
98
|
+
- path: JSON path within the section (e.g., "entities[2]", "useCases", "modules[0].status")
|
|
99
|
+
- data: the data to merge/append/update
|
|
100
|
+
|
|
101
|
+
**Operations:**
|
|
102
|
+
|
|
103
|
+
1. **merge** - Deep merge data into existing section
|
|
104
|
+
```javascript
|
|
105
|
+
// Example: Add new entities to analysis.entities without rewriting entire analysis
|
|
106
|
+
enrichSectionIncremental({
|
|
107
|
+
featureId: "FEAT-001",
|
|
108
|
+
section: "analysis",
|
|
109
|
+
operation: "merge",
|
|
110
|
+
path: "entities",
|
|
111
|
+
data: [
|
|
112
|
+
{ name: "NewEntity", description: "...", attributes: [...] }
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
// Result: analysis.entities now has existing entities + NewEntity
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
2. **append** - Append item to an array
|
|
119
|
+
```javascript
|
|
120
|
+
// Example: Add a single business rule without rewriting all rules
|
|
121
|
+
enrichSectionIncremental({
|
|
122
|
+
featureId: "FEAT-001",
|
|
123
|
+
section: "analysis",
|
|
124
|
+
operation: "append",
|
|
125
|
+
path: "businessRules",
|
|
126
|
+
data: { id: "BR-VAL-ABC-042", name: "...", statement: "..." }
|
|
127
|
+
})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
3. **update** - Update specific field in section
|
|
131
|
+
```javascript
|
|
132
|
+
// Example: Update module status without rewriting entire modules array
|
|
133
|
+
enrichSectionIncremental({
|
|
134
|
+
featureId: "FEAT-001",
|
|
135
|
+
section: "modules",
|
|
136
|
+
operation: "update",
|
|
137
|
+
path: "[0].status", // Path to first module's status field
|
|
138
|
+
data: "handed-off"
|
|
139
|
+
})
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
4. **delete** - Remove item from section
|
|
143
|
+
```javascript
|
|
144
|
+
// Example: Remove a specific entity
|
|
145
|
+
enrichSectionIncremental({
|
|
146
|
+
featureId: "FEAT-001",
|
|
147
|
+
section: "analysis",
|
|
148
|
+
operation: "delete",
|
|
149
|
+
path: "entities[2]" // Delete third entity
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Process:**
|
|
154
|
+
1. Find and read feature.json (use findFeature if given ID)
|
|
155
|
+
2. Navigate to the specified section
|
|
156
|
+
3. Apply the incremental operation:
|
|
157
|
+
- **merge**: Deep merge arrays (append unique items), shallow merge objects
|
|
158
|
+
- **append**: Push item to array at path
|
|
159
|
+
- **update**: Set value at path
|
|
160
|
+
- **delete**: Remove item at path
|
|
161
|
+
4. Update metadata.updatedAt with current timestamp
|
|
162
|
+
5. Update metadata.updatedBy with agent name
|
|
163
|
+
6. Write back with pretty-print (2-space indent)
|
|
164
|
+
7. **File Size Check:** If resulting file > 100KB, display WARNING
|
|
165
|
+
8. Validate schema before writing
|
|
166
|
+
9. **Cross-Reference Validation:** Same rules as enrichSection
|
|
167
|
+
10. Return confirmation with operation summary and file size
|
|
168
|
+
|
|
169
|
+
**File Size Management:**
|
|
170
|
+
- Before write: Check if file would exceed 100KB
|
|
171
|
+
- If > 100KB: Display WARNING with recommendation to split into smaller operations
|
|
172
|
+
- If > 500KB: BLOCKING ERROR - file too large, must use smaller chunks
|
|
173
|
+
- Track cumulative file size growth across operations
|
|
174
|
+
|
|
175
|
+
**Advantages over enrichSection:**
|
|
176
|
+
- 50-70% reduction in tokens for large sections
|
|
177
|
+
- Avoids "file too large" errors by updating incrementally
|
|
178
|
+
- Allows progressive enrichment without reading/writing entire sections
|
|
179
|
+
- Better performance for repeated updates (e.g., module loop)
|
|
180
|
+
|
|
181
|
+
**Use Cases:**
|
|
182
|
+
- Adding entities one-by-one during module specification
|
|
183
|
+
- Updating module status in master without rewriting all modules
|
|
184
|
+
- Appending business rules progressively
|
|
185
|
+
- Updating handoff sections module-by-module
|
|
186
|
+
|
|
91
187
|
### enrichModuleHandoff
|
|
92
188
|
Write the handoff section into a module feature.json. Specialized operation for step-05 module loop.
|
|
93
189
|
|
|
@@ -203,6 +299,39 @@ Create a new version for refactoring or major changes.
|
|
|
203
299
|
6. Append changelog entry with old and new versions
|
|
204
300
|
7. Return paths of both versions
|
|
205
301
|
|
|
302
|
+
### applyReview
|
|
303
|
+
Apply corrections from a ba-review.json export to create a new version of the analysis.
|
|
304
|
+
|
|
305
|
+
**Input:**
|
|
306
|
+
- featureId: FEAT-NNN of the existing application
|
|
307
|
+
- reviewData: parsed content of ba-review.json (with `_reviewMeta` envelope)
|
|
308
|
+
|
|
309
|
+
**Process:**
|
|
310
|
+
1. Validate `reviewData._reviewMeta` has `sourceVersion` and `sourceApplicationId`
|
|
311
|
+
2. Determine version bump:
|
|
312
|
+
- If `_reviewMeta.changeSummary.modulesAdded.length > 0` OR `modulesRemoved.length > 0`: major bump (v1.0 → v2.0)
|
|
313
|
+
- Otherwise: minor bump (v1.0 → v1.1)
|
|
314
|
+
3. Call `createVersion(featureId, "Review corrections applied")`
|
|
315
|
+
4. Read the new version's master feature.json
|
|
316
|
+
5. Apply reverse mapping from review data to feature.json (see `references/review-data-mapping.md`):
|
|
317
|
+
- `reviewData.cadrage.scope.vital[]` → `cadrage.globalScope.mustHave[]`
|
|
318
|
+
- `reviewData.cadrage.scope.important[]` → `cadrage.globalScope.shouldHave[]`
|
|
319
|
+
- `reviewData.cadrage.scope.optional[]` → `cadrage.globalScope.couldHave[]`
|
|
320
|
+
- `reviewData.cadrage.scope.excluded[]` → `cadrage.globalScope.outOfScope[]`
|
|
321
|
+
- `reviewData.cadrage.stakeholders[]` → reverse-map access/frequency back to involvement/frequency
|
|
322
|
+
- `reviewData.cadrage.risks[]` → `cadrage.risks[]`
|
|
323
|
+
- `reviewData.modules[]` → update `modules[]` (add/remove/modify)
|
|
324
|
+
6. For each module in `reviewData.moduleSpecifications`:
|
|
325
|
+
- Reverse-map useCases, businessRules, entities, permissions back to module feature.json
|
|
326
|
+
7. Preserve review comments in a new `review` section of the master feature.json:
|
|
327
|
+
- `review.comments`: all inline comments from `reviewData.comments`
|
|
328
|
+
- `review.specComments`: text comments from `reviewData.specComments`
|
|
329
|
+
- `review.wireframeComments`: wireframe feedback from `reviewData.wireframeComments`
|
|
330
|
+
- `review.appliedAt`: ISO timestamp
|
|
331
|
+
8. Update metadata.updatedAt
|
|
332
|
+
9. Write the updated feature.json
|
|
333
|
+
10. Return confirmation with: new version path, changes applied count, comments preserved count
|
|
334
|
+
|
|
206
335
|
## Schema Validation Rules
|
|
207
336
|
|
|
208
337
|
Perform these structural checks before every write:
|
|
@@ -441,6 +570,88 @@ Before EVERY enrichSection() call for specification or handoff sections, validat
|
|
|
441
570
|
6. **Pretty-print JSON** - use 2-space indentation
|
|
442
571
|
7. **Timestamp management** - always set metadata.updatedAt to current ISO timestamp on write
|
|
443
572
|
8. **Idempotency** - calling the same operation twice with same data should produce same result
|
|
573
|
+
9. **File size management** - check file size before write, use incremental operations for large files
|
|
574
|
+
|
|
575
|
+
## File Size Management (CRITICAL)
|
|
576
|
+
|
|
577
|
+
**Problem:** Large feature.json files (>100KB) can cause write failures and token exhaustion.
|
|
578
|
+
|
|
579
|
+
**Solution:** Progressive monitoring and incremental operations.
|
|
580
|
+
|
|
581
|
+
### Size Thresholds
|
|
582
|
+
|
|
583
|
+
| File Size | Status | Action |
|
|
584
|
+
|-----------|--------|--------|
|
|
585
|
+
| < 50KB | ✓ Safe | Use enrichSection normally |
|
|
586
|
+
| 50-100KB | ⚠ Warning | Display warning, recommend enrichSectionIncremental for next operations |
|
|
587
|
+
| 100-500KB | ⚠ High | STRONGLY recommend enrichSectionIncremental, limit enrichSection use |
|
|
588
|
+
| > 500KB | ✗ Critical | BLOCK enrichSection, REQUIRE enrichSectionIncremental or split file |
|
|
589
|
+
|
|
590
|
+
### Pre-Write File Size Check
|
|
591
|
+
|
|
592
|
+
Before EVERY write operation:
|
|
593
|
+
|
|
594
|
+
```javascript
|
|
595
|
+
const currentFileSize = getFileSize(featurePath);
|
|
596
|
+
const estimatedNewSize = currentFileSize + newDataSize;
|
|
597
|
+
|
|
598
|
+
if (estimatedNewSize > 100 * 1024) { // 100KB
|
|
599
|
+
WARNING(`Feature.json will be ${formatBytes(estimatedNewSize)} after write`);
|
|
600
|
+
WARNING(`Recommend using enrichSectionIncremental for future operations`);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (estimatedNewSize > 500 * 1024) { // 500KB
|
|
604
|
+
BLOCKING_ERROR(`Feature.json would exceed 500KB (${formatBytes(estimatedNewSize)})`);
|
|
605
|
+
BLOCKING_ERROR(`Use enrichSectionIncremental instead of enrichSection`);
|
|
606
|
+
STOP;
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Operation Selection Guide
|
|
611
|
+
|
|
612
|
+
| Scenario | Recommended Operation | Reason |
|
|
613
|
+
|----------|----------------------|--------|
|
|
614
|
+
| First-time section write | `enrichSection` | No existing data, full write needed |
|
|
615
|
+
| Module loop (3+ iterations) | `enrichSectionIncremental` | Avoids rewriting same data multiple times |
|
|
616
|
+
| Large sections (>20KB) | `enrichSectionIncremental` | Reduces token usage by 50-70% |
|
|
617
|
+
| File size > 100KB | `enrichSectionIncremental` (REQUIRED) | Prevents file size bloat |
|
|
618
|
+
| Single field update | `enrichSectionIncremental` with `update` | Most efficient for targeted changes |
|
|
619
|
+
|
|
620
|
+
### Monitoring & Reporting
|
|
621
|
+
|
|
622
|
+
After EVERY write, report file size status:
|
|
623
|
+
|
|
624
|
+
```
|
|
625
|
+
✓ feature.json written successfully
|
|
626
|
+
Path: docs/business/HumanResources/Projects/business-analyse/v1.0/feature.json
|
|
627
|
+
Size: 87.3 KB (↑ 12.1 KB from previous)
|
|
628
|
+
Status: ⚠ Approaching 100KB threshold
|
|
629
|
+
Recommendation: Use enrichSectionIncremental for remaining modules
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### Splitting Large Files (Advanced)
|
|
633
|
+
|
|
634
|
+
If a module feature.json exceeds 500KB despite incremental operations:
|
|
635
|
+
|
|
636
|
+
1. **Split specification section** into separate files:
|
|
637
|
+
- `specification-entities.json` (entities, relationships)
|
|
638
|
+
- `specification-rules.json` (business rules, validations)
|
|
639
|
+
- `specification-ui.json` (wireframes, sections, navigation)
|
|
640
|
+
|
|
641
|
+
2. **Update feature.json** with file references:
|
|
642
|
+
```json
|
|
643
|
+
{
|
|
644
|
+
"specification": {
|
|
645
|
+
"$ref": "./specification-entities.json",
|
|
646
|
+
"$ref2": "./specification-rules.json",
|
|
647
|
+
"$ref3": "./specification-ui.json"
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
3. **ba-reader** auto-resolves references when reading
|
|
653
|
+
|
|
654
|
+
**Note:** File splitting is a LAST RESORT. Prefer enrichSectionIncremental first.
|
|
444
655
|
|
|
445
656
|
## Error Handling
|
|
446
657
|
|
|
@@ -3,6 +3,7 @@ name: explore-codebase
|
|
|
3
3
|
description: Use this agent whenever you need to explore the codebase to implement a feature.
|
|
4
4
|
color: yellow
|
|
5
5
|
model: haiku
|
|
6
|
+
tools: Read, Glob, Grep, Bash
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
You are a codebase exploration specialist. Your only job is to find and present ALL relevant code and logic for the requested feature.
|
|
@@ -3,6 +3,7 @@ name: explore-docs
|
|
|
3
3
|
description: Use this agent IMMEDIATELY when the user asks about library features, implementation methods, "how to do X with Y library", documentation searches, or ANY question about using/implementing specific libraries or frameworks (in any language) - launches Context7 and WebFetch for precise technical information with code examples
|
|
4
4
|
color: yellow
|
|
5
5
|
model: haiku
|
|
6
|
+
tools: Read, Glob, Grep, WebSearch, WebFetch, ToolSearch
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
You are a documentation exploration specialist. Your mission is to retrieve precise, actionable documentation with code examples while eliminating superficial content.
|
|
@@ -3,6 +3,7 @@ name: fix-grammar
|
|
|
3
3
|
description: Use this agent to fix grammar and spelling errors in a single file while preserving formatting
|
|
4
4
|
color: blue
|
|
5
5
|
model: haiku
|
|
6
|
+
tools: Read, Edit, Write, Glob, Grep
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
You are DevProfCorrectorGPT, a professional text corrector. Fix grammar and spelling errors in the specified file while preserving all formatting and meaning.
|
|
@@ -3,6 +3,7 @@ name: Snipper
|
|
|
3
3
|
description: Use this agent when you need to modify code. This agent is specialized to be fast. The output is small and optimized to code as fast as agent can.
|
|
4
4
|
color: blue
|
|
5
5
|
model: haiku
|
|
6
|
+
tools: Read, Edit, Write, Glob, Grep
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
You are a rapid code modification specialist. No explanations, just execute.
|
|
@@ -40,3 +40,9 @@ Manage SmartStack admin accounts. Wraps the `smartstack admin` CLI command with
|
|
|
40
40
|
4. **Report result** - Show new credentials or error message
|
|
41
41
|
|
|
42
42
|
</workflow>
|
|
43
|
+
|
|
44
|
+
<success_criteria>
|
|
45
|
+
- Admin command executed successfully or clear error displayed
|
|
46
|
+
- New credentials shown to user (for reset)
|
|
47
|
+
- SmartStack.app project correctly detected
|
|
48
|
+
</success_criteria>
|
|
@@ -13,12 +13,12 @@ description: |
|
|
|
13
13
|
|
|
14
14
|
# Skill AI Prompt SmartStack
|
|
15
15
|
|
|
16
|
-
> **Architecture:** Prompt + Blocks
|
|
16
|
+
> **Architecture:** Prompt + Blocks -> Provider + Model -> Completion -> Schema Validation
|
|
17
17
|
> Multi-provider: OpenAI, Anthropic (Claude), Azure OpenAI, Google Gemini
|
|
18
18
|
|
|
19
19
|
**Reference:** [_shared.md](../_shared.md) for common patterns
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## When This Skill Activates
|
|
22
22
|
|
|
23
23
|
| Trigger | Example |
|
|
24
24
|
|---------|---------|
|
|
@@ -28,17 +28,17 @@ description: |
|
|
|
28
28
|
| Text analysis | "Analyze the sentiment of comments" |
|
|
29
29
|
| Keywords | "prompt", "GPT", "Claude", "IA", "completion", "LLM" |
|
|
30
30
|
|
|
31
|
-
## AI
|
|
31
|
+
## AI Flow
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
Feature
|
|
35
|
-
|
|
36
|
-
Prompt + Blocks
|
|
37
|
-
|
|
38
|
-
AI Response
|
|
34
|
+
Feature -> IAiCompletionService.ExecutePromptAsync()
|
|
35
|
+
|
|
|
36
|
+
Prompt + Blocks -> Provider Instance -> External API (OpenAI/Claude/Azure/Gemini)
|
|
37
|
+
|
|
|
38
|
+
AI Response -> OutputSchema Validation -> Typed Result<T>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## Main Entities
|
|
42
42
|
|
|
43
43
|
### AiProvider & AiModel
|
|
44
44
|
- **Providers:** OpenAI, Anthropic, Azure OpenAI, Google
|
|
@@ -58,138 +58,27 @@ Configured instance: Code, Name, SystemContext, DefaultModel, MonthlyBudgetLimit
|
|
|
58
58
|
### OutputSchema
|
|
59
59
|
JSON Schema for validation: Code, Name, JsonSchema, DotNetType
|
|
60
60
|
|
|
61
|
-
##
|
|
61
|
+
## Implementation
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| Multi-language? | Language variables |
|
|
69
|
-
| Budget limited? | ProviderInstance |
|
|
70
|
-
| Real-time? | Streaming |
|
|
63
|
+
See [steps/step-01-implementation.md](steps/step-01-implementation.md) for:
|
|
64
|
+
- Workflow steps (define use case, create prompt, define schema, execute)
|
|
65
|
+
- AI service interfaces (IAiCompletionService, IPromptService)
|
|
66
|
+
- Frontend integration (API, hooks, components)
|
|
67
|
+
- Advanced patterns (streaming, fallback provider)
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
```csharp
|
|
74
|
-
var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
|
|
75
|
-
{
|
|
76
|
-
Code = "ticket-analyzer",
|
|
77
|
-
Name = "Ticket Analyzer",
|
|
78
|
-
Blocks = new[] {
|
|
79
|
-
new CreateBlockRequest {
|
|
80
|
-
BlockType = PromptBlockType.System,
|
|
81
|
-
Content = "Instructions...",
|
|
82
|
-
IsRequired = true
|
|
83
|
-
},
|
|
84
|
-
new CreateBlockRequest {
|
|
85
|
-
BlockType = PromptBlockType.User,
|
|
86
|
-
Content = "Ticket: {{ticketTitle}}\nDescription: {{ticketDescription}}",
|
|
87
|
-
IsRequired = true
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### 3. Define OutputSchema (if structured response)
|
|
94
|
-
```csharp
|
|
95
|
-
var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
|
|
96
|
-
{
|
|
97
|
-
Code = "ticket-analysis-result",
|
|
98
|
-
JsonSchema = @"{ ""type"": ""object"", ""required"": [""category"", ""priority""], ... }",
|
|
99
|
-
DotNetType = "SmartStack.Application.AI.TicketAnalysisResult"
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### 4. Execute the Prompt
|
|
104
|
-
```csharp
|
|
105
|
-
// Simple execution
|
|
106
|
-
var result = await _aiService.ExecutePromptAsync(promptId, new Dictionary<string, object>
|
|
107
|
-
{
|
|
108
|
-
["ticketTitle"] = ticket.Title,
|
|
109
|
-
["ticketDescription"] = ticket.Description
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// With typed validation
|
|
113
|
-
var typedResult = await _aiService.ExecutePromptWithValidationAsync<TicketAnalysisResult>(
|
|
114
|
-
promptId, variables);
|
|
115
|
-
if (typedResult.Success && typedResult.IsValid) { /* use typedResult.Data */ }
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## AI SERVICES
|
|
119
|
-
|
|
120
|
-
### IAiCompletionService
|
|
121
|
-
```csharp
|
|
122
|
-
Task<AiCompletionResult> CompleteAsync(AiCompletionRequest request, CancellationToken ct);
|
|
123
|
-
Task<AiCompletionResult> ExecutePromptAsync(Guid promptId, Dictionary<string, object>? variables, ...);
|
|
124
|
-
Task<AiValidatedCompletionResult<T>> ExecutePromptWithValidationAsync<T>(Guid promptId, ...);
|
|
125
|
-
Task<AiValidatedCompletionResult<T>> ExecutePromptByCodeWithValidationAsync<T>(string promptCode, ...);
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### IPromptService
|
|
129
|
-
```csharp
|
|
130
|
-
Task<PromptDto> GetPromptByCodeAsync(string code, string? version = null);
|
|
131
|
-
Task<string> RenderPromptAsync(string code, Dictionary<string, object>? variables);
|
|
132
|
-
Task<Guid> CreatePromptAsync(CreatePromptRequest request);
|
|
133
|
-
Task ActivatePromptAsync(Guid promptId);
|
|
134
|
-
// Block management: AddBlockToPromptAsync, UpdateBlockAsync, ReorderBlocksAsync
|
|
135
|
-
```
|
|
69
|
+
## Checklist
|
|
136
70
|
|
|
137
|
-
## FRONTEND INTEGRATION
|
|
138
|
-
|
|
139
|
-
### API
|
|
140
|
-
```typescript
|
|
141
|
-
aiApi.getPrompts(status?, isTemplate?)
|
|
142
|
-
aiApi.executePrompt(promptId, variables)
|
|
143
|
-
aiApi.previewPrompt(promptId, variables)
|
|
144
|
-
aiApi.getProviders() / aiApi.getModels(providerId?)
|
|
145
|
-
aiApi.getSchemas() / aiApi.createSchema(data)
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### Hook useAiCompletion
|
|
149
|
-
```typescript
|
|
150
|
-
const { execute, loading, error, result } = useAiCompletion<T>(promptCode);
|
|
151
|
-
const data = await execute(variables);
|
|
152
71
|
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
label="Analyze with AI"
|
|
161
|
-
/>
|
|
72
|
+
- Prompt created (unique Code, Blocks, Variables, Version)
|
|
73
|
+
- OutputSchema if structured response
|
|
74
|
+
- Service with IAiCompletionService injected
|
|
75
|
+
- Error handling + Logging (tokens, time)
|
|
76
|
+
- Frontend: Hook/component, Loading, Error handling
|
|
77
|
+
- ProviderInstance with budget limit
|
|
78
|
+
- Tests: execution, variables, schema validation
|
|
162
79
|
```
|
|
163
80
|
|
|
164
|
-
##
|
|
165
|
-
|
|
166
|
-
### Streaming Response
|
|
167
|
-
```typescript
|
|
168
|
-
const reader = response.body?.getReader();
|
|
169
|
-
while (true) { const { done, value } = await reader.read(); if (done) break; /* append chunk */ }
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Fallback Provider
|
|
173
|
-
```csharp
|
|
174
|
-
foreach (var provider in providers.OrderBy(p => p.Priority)) {
|
|
175
|
-
var result = await _aiService.ExecutePromptAsync(promptId, variables, providerId: provider.Id);
|
|
176
|
-
if (result.Success) return result;
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## CHECKLIST
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
□ Prompt created (unique Code, Blocks, Variables, Version)
|
|
184
|
-
□ OutputSchema if structured response
|
|
185
|
-
□ Service with IAiCompletionService injected
|
|
186
|
-
□ Error handling + Logging (tokens, time)
|
|
187
|
-
□ Frontend: Hook/component, Loading, Error handling
|
|
188
|
-
□ ProviderInstance with budget limit
|
|
189
|
-
□ Tests: execution, variables, schema validation
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## ABSOLUTE RULES
|
|
81
|
+
## Absolute Rules
|
|
193
82
|
|
|
194
83
|
| DO | DON'T |
|
|
195
84
|
|----|-------|
|
|
@@ -199,7 +88,7 @@ foreach (var provider in providers.OrderBy(p => p.Priority)) {
|
|
|
199
88
|
| Log executions (tokens, duration) | Hardcode API keys |
|
|
200
89
|
| Variables for dynamic content | Expose system prompts to frontend |
|
|
201
90
|
|
|
202
|
-
##
|
|
91
|
+
## Key Files
|
|
203
92
|
|
|
204
93
|
| File | Role |
|
|
205
94
|
|------|------|
|
|
@@ -209,3 +98,10 @@ foreach (var provider in providers.OrderBy(p => p.Priority)) {
|
|
|
209
98
|
| `Application/Common/Interfaces/IAiCompletionService.cs` | Service interface |
|
|
210
99
|
| `Infrastructure/Services/AI/AiCompletionService.cs` | Implementation |
|
|
211
100
|
| `web/src/services/api/aiApi.ts` | Frontend API |
|
|
101
|
+
|
|
102
|
+
<success_criteria>
|
|
103
|
+
- Prompt entity created with OutputSchema validation
|
|
104
|
+
- IAiCompletionService integration wired correctly
|
|
105
|
+
- Error handling for API failures and quota limits implemented
|
|
106
|
+
- Token usage logged per execution
|
|
107
|
+
</success_criteria>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# AI Prompt - Implementation Workflow
|
|
2
|
+
|
|
3
|
+
## 1. Define the Use Case
|
|
4
|
+
|
|
5
|
+
| Question | Impact |
|
|
6
|
+
|----------|--------|
|
|
7
|
+
| Content type? | Model choice |
|
|
8
|
+
| Structured response? | OutputSchema |
|
|
9
|
+
| Multi-language? | Language variables |
|
|
10
|
+
| Budget limited? | ProviderInstance |
|
|
11
|
+
| Real-time? | Streaming |
|
|
12
|
+
|
|
13
|
+
## 2. Create the Prompt
|
|
14
|
+
|
|
15
|
+
```csharp
|
|
16
|
+
var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
|
|
17
|
+
{
|
|
18
|
+
Code = "ticket-analyzer",
|
|
19
|
+
Name = "Ticket Analyzer",
|
|
20
|
+
Blocks = new[] {
|
|
21
|
+
new CreateBlockRequest {
|
|
22
|
+
BlockType = PromptBlockType.System,
|
|
23
|
+
Content = "Instructions...",
|
|
24
|
+
IsRequired = true
|
|
25
|
+
},
|
|
26
|
+
new CreateBlockRequest {
|
|
27
|
+
BlockType = PromptBlockType.User,
|
|
28
|
+
Content = "Ticket: {{ticketTitle}}\nDescription: {{ticketDescription}}",
|
|
29
|
+
IsRequired = true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 3. Define OutputSchema (if structured response)
|
|
36
|
+
|
|
37
|
+
```csharp
|
|
38
|
+
var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
|
|
39
|
+
{
|
|
40
|
+
Code = "ticket-analysis-result",
|
|
41
|
+
JsonSchema = @"{ ""type"": ""object"", ""required"": [""category"", ""priority""], ... }",
|
|
42
|
+
DotNetType = "SmartStack.Application.AI.TicketAnalysisResult"
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 4. Execute the Prompt
|
|
47
|
+
|
|
48
|
+
```csharp
|
|
49
|
+
// Simple execution
|
|
50
|
+
var result = await _aiService.ExecutePromptAsync(promptId, new Dictionary<string, object>
|
|
51
|
+
{
|
|
52
|
+
["ticketTitle"] = ticket.Title,
|
|
53
|
+
["ticketDescription"] = ticket.Description
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// With typed validation
|
|
57
|
+
var typedResult = await _aiService.ExecutePromptWithValidationAsync<TicketAnalysisResult>(
|
|
58
|
+
promptId, variables);
|
|
59
|
+
if (typedResult.Success && typedResult.IsValid) { /* use typedResult.Data */ }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## AI Services
|
|
63
|
+
|
|
64
|
+
### IAiCompletionService
|
|
65
|
+
```csharp
|
|
66
|
+
Task<AiCompletionResult> CompleteAsync(AiCompletionRequest request, CancellationToken ct);
|
|
67
|
+
Task<AiCompletionResult> ExecutePromptAsync(Guid promptId, Dictionary<string, object>? variables, ...);
|
|
68
|
+
Task<AiValidatedCompletionResult<T>> ExecutePromptWithValidationAsync<T>(Guid promptId, ...);
|
|
69
|
+
Task<AiValidatedCompletionResult<T>> ExecutePromptByCodeWithValidationAsync<T>(string promptCode, ...);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### IPromptService
|
|
73
|
+
```csharp
|
|
74
|
+
Task<PromptDto> GetPromptByCodeAsync(string code, string? version = null);
|
|
75
|
+
Task<string> RenderPromptAsync(string code, Dictionary<string, object>? variables);
|
|
76
|
+
Task<Guid> CreatePromptAsync(CreatePromptRequest request);
|
|
77
|
+
Task ActivatePromptAsync(Guid promptId);
|
|
78
|
+
// Block management: AddBlockToPromptAsync, UpdateBlockAsync, ReorderBlocksAsync
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Frontend Integration
|
|
82
|
+
|
|
83
|
+
### API
|
|
84
|
+
```typescript
|
|
85
|
+
aiApi.getPrompts(status?, isTemplate?)
|
|
86
|
+
aiApi.executePrompt(promptId, variables)
|
|
87
|
+
aiApi.previewPrompt(promptId, variables)
|
|
88
|
+
aiApi.getProviders() / aiApi.getModels(providerId?)
|
|
89
|
+
aiApi.getSchemas() / aiApi.createSchema(data)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Hook useAiCompletion
|
|
93
|
+
```typescript
|
|
94
|
+
const { execute, loading, error, result } = useAiCompletion<T>(promptCode);
|
|
95
|
+
const data = await execute(variables);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Component AiAssistantButton
|
|
99
|
+
```tsx
|
|
100
|
+
<AiAssistantButton
|
|
101
|
+
promptCode="ticket-analyzer"
|
|
102
|
+
variables={{ ticketTitle, ticketDescription }}
|
|
103
|
+
onResult={(result) => handleAnalysis(result)}
|
|
104
|
+
label="Analyze with AI"
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Advanced Patterns
|
|
109
|
+
|
|
110
|
+
### Streaming Response
|
|
111
|
+
```typescript
|
|
112
|
+
const reader = response.body?.getReader();
|
|
113
|
+
while (true) { const { done, value } = await reader.read(); if (done) break; /* append chunk */ }
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Fallback Provider
|
|
117
|
+
```csharp
|
|
118
|
+
foreach (var provider in providers.OrderBy(p => p.Priority)) {
|
|
119
|
+
var result = await _aiService.ExecutePromptAsync(promptId, variables, providerId: provider.Id);
|
|
120
|
+
if (result.Success) return result;
|
|
121
|
+
}
|
|
122
|
+
```
|