@atlashub/smartstack-cli 1.3.0 → 1.4.1
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/agents.html +916 -912
- package/.documentation/apex.html +1018 -1014
- package/.documentation/business-analyse.html +1501 -1074
- package/.documentation/commands.html +680 -676
- package/.documentation/css/styles.css +2168 -2030
- package/.documentation/efcore.html +2505 -2501
- package/.documentation/gitflow.html +2618 -2053
- package/.documentation/hooks.html +413 -409
- package/.documentation/index.html +323 -319
- package/.documentation/installation.html +462 -458
- package/.documentation/js/app.js +794 -794
- package/.documentation/ralph-loop.html +530 -0
- package/.documentation/test-web.html +513 -509
- package/README.md +52 -10
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/commands/business-analyse/0-orchestrate.md +640 -0
- package/templates/commands/business-analyse.md +84 -3
- package/templates/commands/create/agent.md +138 -0
- package/templates/commands/create/command.md +166 -0
- package/templates/commands/create/hook.md +234 -0
- package/templates/commands/create/plugin.md +329 -0
- package/templates/commands/create/project.md +507 -0
- package/templates/commands/create/skill.md +199 -0
- package/templates/commands/create.md +220 -0
|
@@ -1,11 +1,46 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Business Analysis - Complete business analysis workflow (BABOK/IEEE 830)
|
|
3
|
+
argument-hint: "<description du besoin>"
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
# Business Analysis - Expert Workflow
|
|
6
7
|
|
|
7
8
|
Senior Business Analyst expert. Complete business analysis without writing code.
|
|
8
9
|
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## MODE AUTOMATIQUE (RECOMMANDE)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
+==============================================================================+
|
|
16
|
+
| /business-analyse "<description du besoin>" |
|
|
17
|
+
| |
|
|
18
|
+
| ORCHESTRE AUTOMATIQUEMENT TOUT LE WORKFLOW: |
|
|
19
|
+
| ├── 1. Verification MCP SmartStack (alerte si absent) |
|
|
20
|
+
| ├── 2. Analyse du contexte (Application/Module/Granularite) |
|
|
21
|
+
| ├── 3. Definition des integrations (Workflows/Notifs/IA) |
|
|
22
|
+
| ├── 4. Creation prd.json + progress.txt (Ralph Loop ready) |
|
|
23
|
+
| ├── 5. Execution phases 1-7 avec Ralph Loop |
|
|
24
|
+
| ├── 6. Validation utilisateur (gate obligatoire) |
|
|
25
|
+
| ├── 7. Implementation avec Ralph Loop |
|
|
26
|
+
| └── 8. Documentation HTML auto-generee |
|
|
27
|
+
| |
|
|
28
|
+
| RESULTAT: Feature complete en ~30 minutes avec validation |
|
|
29
|
+
+==============================================================================+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Usage:**
|
|
33
|
+
```bash
|
|
34
|
+
# Mode automatique complet (RECOMMANDE)
|
|
35
|
+
/business-analyse "Je veux gerer les contacts clients avec import/export"
|
|
36
|
+
|
|
37
|
+
# Mode manuel (phases individuelles)
|
|
38
|
+
/business-analyse:1-init
|
|
39
|
+
/business-analyse:2-discover ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
9
44
|
## Philosophy
|
|
10
45
|
|
|
11
46
|
```
|
|
@@ -91,7 +126,9 @@ Examples:
|
|
|
91
126
|
|
|
92
127
|
| Phase | Command | Model | Description | Output |
|
|
93
128
|
|-------|----------|-------|-------------|--------|
|
|
94
|
-
|
|
|
129
|
+
| **AUTO** | **`/business-analyse`** | **opus** | **Orchestration complete automatique** | **Feature complete** |
|
|
130
|
+
| 0 | `/business-analyse:0-orchestrate` | opus | Orchestration manuelle avec questions | context.json, prd.json |
|
|
131
|
+
| 0.5 | *Validation* | - | Context business check (automatic) | Block if not business |
|
|
95
132
|
| 1 | `/business-analyse:1-init` | haiku | Initialize project structure + code scan | `config.json`, structure |
|
|
96
133
|
| 2 | `/business-analyse:2-discover` | **opus** | Requirements elicitation (ultrathink) | `1-discovery.md` |
|
|
97
134
|
| 3 | `/business-analyse:3-analyse` | sonnet | Business analysis BRD + doc scan (ultrathink) | `2-business-requirements.md` |
|
|
@@ -552,8 +589,52 @@ The skill is triggered automatically when user asks about:
|
|
|
552
589
|
|
|
553
590
|
## Next
|
|
554
591
|
|
|
555
|
-
|
|
556
|
-
|
|
592
|
+
**Mode automatique (RECOMMANDE):**
|
|
593
|
+
```bash
|
|
594
|
+
/business-analyse "Description de votre besoin"
|
|
557
595
|
```
|
|
596
|
+
|
|
597
|
+
**Mode manuel:**
|
|
598
|
+
```bash
|
|
558
599
|
/business-analyse:1-init
|
|
559
600
|
```
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
## EXECUTION AUTOMATIQUE
|
|
605
|
+
|
|
606
|
+
Si cette commande est appelee avec un argument (description du besoin):
|
|
607
|
+
|
|
608
|
+
```
|
|
609
|
+
ARGUMENTS = "$ARGUMENTS"
|
|
610
|
+
|
|
611
|
+
SI ARGUMENTS non vide:
|
|
612
|
+
→ Executer /business-analyse:0-orchestrate $ARGUMENTS
|
|
613
|
+
→ Le workflow complet est lance automatiquement
|
|
614
|
+
|
|
615
|
+
SINON:
|
|
616
|
+
→ Afficher ce fichier d'aide
|
|
617
|
+
→ Proposer les options
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
**Lancer le mode automatique maintenant:**
|
|
621
|
+
|
|
622
|
+
```javascript
|
|
623
|
+
if (ARGUMENTS && ARGUMENTS.trim().length > 0) {
|
|
624
|
+
// Mode automatique - lancer l'orchestration
|
|
625
|
+
execute("/business-analyse:0-orchestrate " + ARGUMENTS);
|
|
626
|
+
} else {
|
|
627
|
+
// Mode manuel - afficher l'aide et proposer les options
|
|
628
|
+
AskUserQuestion({
|
|
629
|
+
questions: [{
|
|
630
|
+
question: "Comment souhaitez-vous proceder?",
|
|
631
|
+
header: "Mode",
|
|
632
|
+
options: [
|
|
633
|
+
{ label: "Mode automatique (Recommande)", description: "Orchestration complete avec Ralph Loop" },
|
|
634
|
+
{ label: "Mode manuel", description: "Executer les phases une par une" }
|
|
635
|
+
],
|
|
636
|
+
multiSelect: false
|
|
637
|
+
}]
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
```
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a SmartStack agent extension project
|
|
3
|
+
argument-hint: <name> [description]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Agent Extension
|
|
7
|
+
|
|
8
|
+
Scaffold a complete SmartStack **agent** extension project.
|
|
9
|
+
|
|
10
|
+
## What is an Agent?
|
|
11
|
+
|
|
12
|
+
An agent is a specialized execution unit:
|
|
13
|
+
- Launched by commands for parallel execution
|
|
14
|
+
- Focused on specific tasks (search, analysis, etc.)
|
|
15
|
+
- Defined in markdown with YAML frontmatter
|
|
16
|
+
- Optimized with model selection (haiku/sonnet/opus)
|
|
17
|
+
|
|
18
|
+
## Arguments
|
|
19
|
+
|
|
20
|
+
Parse from `$ARGUMENTS`:
|
|
21
|
+
- **name** (required): Agent name in kebab-case
|
|
22
|
+
- **description** (optional): What the agent does
|
|
23
|
+
|
|
24
|
+
## Project Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
smartstack-{name}/
|
|
28
|
+
├── package.json
|
|
29
|
+
├── tsconfig.json
|
|
30
|
+
├── tsup.config.ts
|
|
31
|
+
├── README.md
|
|
32
|
+
├── .gitignore
|
|
33
|
+
├── src/
|
|
34
|
+
│ └── index.ts
|
|
35
|
+
└── templates/
|
|
36
|
+
└── agents/
|
|
37
|
+
└── {name}.md # Agent template
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Generated Agent Template
|
|
41
|
+
|
|
42
|
+
Create `templates/agents/{name}.md`:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
---
|
|
46
|
+
name: {name}
|
|
47
|
+
description: {description}
|
|
48
|
+
color: yellow
|
|
49
|
+
model: haiku
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
# {PascalCaseName} Agent
|
|
53
|
+
|
|
54
|
+
{description}
|
|
55
|
+
|
|
56
|
+
## Purpose
|
|
57
|
+
|
|
58
|
+
This agent specializes in:
|
|
59
|
+
- [Primary capability 1]
|
|
60
|
+
- [Primary capability 2]
|
|
61
|
+
- [Primary capability 3]
|
|
62
|
+
|
|
63
|
+
## Search Strategy
|
|
64
|
+
|
|
65
|
+
### 1. Initial Discovery
|
|
66
|
+
- Use `Glob` to find files matching patterns
|
|
67
|
+
- Focus on: `**/*.{relevant-extensions}`
|
|
68
|
+
|
|
69
|
+
### 2. Deep Analysis
|
|
70
|
+
- Use `Grep` for specific code patterns
|
|
71
|
+
- Look for: `pattern1`, `pattern2`
|
|
72
|
+
|
|
73
|
+
### 3. Context Building
|
|
74
|
+
- Use `Read` to examine key files
|
|
75
|
+
- Extract: imports, exports, dependencies
|
|
76
|
+
|
|
77
|
+
### 4. Synthesis
|
|
78
|
+
- Compile findings
|
|
79
|
+
- Identify patterns
|
|
80
|
+
- Generate recommendations
|
|
81
|
+
|
|
82
|
+
## Output Format
|
|
83
|
+
|
|
84
|
+
**CRITICAL**: Output findings directly in response. NEVER create files.
|
|
85
|
+
|
|
86
|
+
### Findings Report
|
|
87
|
+
|
|
88
|
+
#### Relevant Files
|
|
89
|
+
| File | Purpose | Key Patterns |
|
|
90
|
+
|------|---------|--------------|
|
|
91
|
+
| path/to/file | description | patterns found |
|
|
92
|
+
|
|
93
|
+
#### Analysis
|
|
94
|
+
[Detailed analysis of findings]
|
|
95
|
+
|
|
96
|
+
#### Recommendations
|
|
97
|
+
1. [First recommendation]
|
|
98
|
+
2. [Second recommendation]
|
|
99
|
+
3. [Third recommendation]
|
|
100
|
+
|
|
101
|
+
## Tool Usage
|
|
102
|
+
|
|
103
|
+
Preferred tools for this agent:
|
|
104
|
+
- `Glob` - File discovery
|
|
105
|
+
- `Grep` - Pattern search
|
|
106
|
+
- `Read` - File content
|
|
107
|
+
|
|
108
|
+
## Anti-Patterns
|
|
109
|
+
|
|
110
|
+
- **NEVER** create markdown files
|
|
111
|
+
- **NEVER** guess without evidence
|
|
112
|
+
- **NEVER** skip verification
|
|
113
|
+
- **ALWAYS** cite specific file paths
|
|
114
|
+
|
|
115
|
+
## Priority
|
|
116
|
+
|
|
117
|
+
Accuracy > Completeness > Speed
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Model Selection Guide
|
|
121
|
+
|
|
122
|
+
| Use Case | Model | Reason |
|
|
123
|
+
|----------|-------|--------|
|
|
124
|
+
| Simple search | haiku | Fast, cheap |
|
|
125
|
+
| Analysis | sonnet | Good balance |
|
|
126
|
+
| Complex reasoning | opus | Best quality |
|
|
127
|
+
|
|
128
|
+
## Workflow
|
|
129
|
+
|
|
130
|
+
1. Parse name and description from `$ARGUMENTS`
|
|
131
|
+
2. Validate name is kebab-case
|
|
132
|
+
3. Create project directory
|
|
133
|
+
4. Generate all files using Write tool
|
|
134
|
+
5. Display success message
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
User: $ARGUMENTS
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a SmartStack command extension project
|
|
3
|
+
argument-hint: <name> [description]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Command Extension
|
|
7
|
+
|
|
8
|
+
Scaffold a complete SmartStack **command** extension project.
|
|
9
|
+
|
|
10
|
+
## What is a Command?
|
|
11
|
+
|
|
12
|
+
A command is a slash command that users invoke in Claude Code:
|
|
13
|
+
- `/my-command <args>` - Executes the command with arguments
|
|
14
|
+
- Defined in markdown with YAML frontmatter
|
|
15
|
+
- Contains workflow, rules, and execution logic
|
|
16
|
+
|
|
17
|
+
## Arguments
|
|
18
|
+
|
|
19
|
+
Parse from `$ARGUMENTS`:
|
|
20
|
+
- **name** (required): Command name in kebab-case
|
|
21
|
+
- **description** (optional): What the command does
|
|
22
|
+
|
|
23
|
+
## Project Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
smartstack-{name}/
|
|
27
|
+
├── package.json
|
|
28
|
+
├── tsconfig.json
|
|
29
|
+
├── tsup.config.ts
|
|
30
|
+
├── README.md
|
|
31
|
+
├── .gitignore
|
|
32
|
+
├── src/
|
|
33
|
+
│ └── index.ts
|
|
34
|
+
└── templates/
|
|
35
|
+
└── commands/
|
|
36
|
+
└── {name}.md # Main command template
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Generated Command Template
|
|
40
|
+
|
|
41
|
+
Create `templates/commands/{name}.md`:
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
---
|
|
45
|
+
description: {description}
|
|
46
|
+
argument-hint: <task-description>
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
# {PascalCaseName}
|
|
50
|
+
|
|
51
|
+
{description}
|
|
52
|
+
|
|
53
|
+
## Workflow
|
|
54
|
+
|
|
55
|
+
### 1. UNDERSTAND
|
|
56
|
+
- Parse user arguments: `$ARGUMENTS`
|
|
57
|
+
- Identify the task scope
|
|
58
|
+
- Gather necessary context
|
|
59
|
+
|
|
60
|
+
### 2. ANALYZE
|
|
61
|
+
- Explore relevant codebase areas
|
|
62
|
+
- Identify patterns and constraints
|
|
63
|
+
- Document findings
|
|
64
|
+
|
|
65
|
+
### 3. PLAN
|
|
66
|
+
- Design the approach
|
|
67
|
+
- Consider edge cases
|
|
68
|
+
- Validate against requirements
|
|
69
|
+
|
|
70
|
+
### 4. EXECUTE
|
|
71
|
+
- Implement step by step
|
|
72
|
+
- Follow existing patterns
|
|
73
|
+
- Write clean code
|
|
74
|
+
|
|
75
|
+
### 5. VERIFY
|
|
76
|
+
- Test the implementation
|
|
77
|
+
- Ensure no regressions
|
|
78
|
+
- Validate completeness
|
|
79
|
+
|
|
80
|
+
## Execution Rules
|
|
81
|
+
|
|
82
|
+
1. **ULTRA THINK** before each phase
|
|
83
|
+
2. Use parallel agents when beneficial
|
|
84
|
+
3. Document all decisions
|
|
85
|
+
4. **MINIMAL CHANGES**: Only what's needed
|
|
86
|
+
5. Test before declaring complete
|
|
87
|
+
|
|
88
|
+
## Agent Usage
|
|
89
|
+
|
|
90
|
+
For exploration, launch agents:
|
|
91
|
+
- `explore-codebase` - Find relevant files
|
|
92
|
+
- `websearch` - Research solutions
|
|
93
|
+
|
|
94
|
+
## Priority
|
|
95
|
+
|
|
96
|
+
Understanding > Correctness > Speed
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
User: $ARGUMENTS
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Generated Files
|
|
104
|
+
|
|
105
|
+
### package.json
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"name": "@smartstack/{name}",
|
|
110
|
+
"version": "1.0.0",
|
|
111
|
+
"description": "{description}",
|
|
112
|
+
"private": false,
|
|
113
|
+
"type": "module",
|
|
114
|
+
"main": "./dist/index.js",
|
|
115
|
+
"files": ["dist", "templates"],
|
|
116
|
+
"scripts": {
|
|
117
|
+
"build": "tsup",
|
|
118
|
+
"dev": "tsup --watch"
|
|
119
|
+
},
|
|
120
|
+
"peerDependencies": {
|
|
121
|
+
"@atlashub/smartstack-cli": ">=1.0.0"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### src/index.ts
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import * as path from 'path';
|
|
130
|
+
import * as fs from 'fs';
|
|
131
|
+
|
|
132
|
+
export function getTemplatesPath(): string {
|
|
133
|
+
return path.join(__dirname, '..', 'templates');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export async function install(targetDir: string): Promise<void> {
|
|
137
|
+
const src = path.join(getTemplatesPath(), 'commands');
|
|
138
|
+
const dest = path.join(targetDir, 'commands');
|
|
139
|
+
// Copy command templates
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export const metadata = {
|
|
143
|
+
name: '{name}',
|
|
144
|
+
version: '1.0.0',
|
|
145
|
+
description: '{description}',
|
|
146
|
+
type: 'command'
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Workflow
|
|
151
|
+
|
|
152
|
+
1. Parse name and description from `$ARGUMENTS`
|
|
153
|
+
2. Validate name is kebab-case
|
|
154
|
+
3. Create project directory
|
|
155
|
+
4. Generate all files using Write tool
|
|
156
|
+
5. Display success message with next steps
|
|
157
|
+
|
|
158
|
+
## Validation
|
|
159
|
+
|
|
160
|
+
- Name must match: `^[a-z][a-z0-9-]*$`
|
|
161
|
+
- Directory must not exist
|
|
162
|
+
- Description should be meaningful
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
User: $ARGUMENTS
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create a SmartStack hook extension project
|
|
3
|
+
argument-hint: <name> [trigger] [description]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create Hook Extension
|
|
7
|
+
|
|
8
|
+
Scaffold a complete SmartStack **hook** extension project.
|
|
9
|
+
|
|
10
|
+
## What is a Hook?
|
|
11
|
+
|
|
12
|
+
A hook is a validation/action trigger:
|
|
13
|
+
- Runs automatically at specific points (pre-commit, pre-merge, etc.)
|
|
14
|
+
- Can block operations if issues detected
|
|
15
|
+
- Defined in markdown with detection patterns
|
|
16
|
+
- Integrates with GitFlow workflow
|
|
17
|
+
|
|
18
|
+
## Arguments
|
|
19
|
+
|
|
20
|
+
Parse from `$ARGUMENTS`:
|
|
21
|
+
- **name** (required): Hook name in kebab-case
|
|
22
|
+
- **trigger** (optional): pre-commit | pre-merge | pre-push | post-commit
|
|
23
|
+
- **description** (optional): What the hook validates
|
|
24
|
+
|
|
25
|
+
## Project Structure
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
smartstack-{name}/
|
|
29
|
+
├── package.json
|
|
30
|
+
├── tsconfig.json
|
|
31
|
+
├── tsup.config.ts
|
|
32
|
+
├── README.md
|
|
33
|
+
├── .gitignore
|
|
34
|
+
├── src/
|
|
35
|
+
│ └── index.ts
|
|
36
|
+
└── templates/
|
|
37
|
+
└── hooks/
|
|
38
|
+
└── {name}.md # Hook template
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Generated Hook Template
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
---
|
|
45
|
+
description: {description}
|
|
46
|
+
trigger: {trigger}
|
|
47
|
+
blocking: true
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
# {PascalCaseName} Hook
|
|
51
|
+
|
|
52
|
+
{description}
|
|
53
|
+
|
|
54
|
+
## Purpose
|
|
55
|
+
|
|
56
|
+
This hook validates [what it validates] before allowing [the action].
|
|
57
|
+
|
|
58
|
+
## Trigger Points
|
|
59
|
+
|
|
60
|
+
| Trigger | When | Blocking |
|
|
61
|
+
|---------|------|----------|
|
|
62
|
+
| pre-commit | Before git commit | Yes |
|
|
63
|
+
| pre-merge | Before branch merge | Yes |
|
|
64
|
+
| pre-push | Before git push | Yes |
|
|
65
|
+
| post-commit | After git commit | No |
|
|
66
|
+
|
|
67
|
+
Current trigger: **{trigger}**
|
|
68
|
+
|
|
69
|
+
## Detection Patterns
|
|
70
|
+
|
|
71
|
+
### BLOCKING Patterns
|
|
72
|
+
|
|
73
|
+
These patterns will **prevent** the operation:
|
|
74
|
+
|
|
75
|
+
| Pattern | File Types | Risk Level | Reason |
|
|
76
|
+
|---------|-----------|------------|--------|
|
|
77
|
+
| `PATTERN_ONE` | *.ts, *.js | Critical | Description |
|
|
78
|
+
| `PATTERN_TWO` | *.sql | High | Description |
|
|
79
|
+
| `PATTERN_THREE` | * | Medium | Description |
|
|
80
|
+
|
|
81
|
+
### WARNING Patterns
|
|
82
|
+
|
|
83
|
+
These patterns will **warn** but allow:
|
|
84
|
+
|
|
85
|
+
| Pattern | File Types | Reason |
|
|
86
|
+
|---------|-----------|--------|
|
|
87
|
+
| `WARN_PATTERN` | *.ts | Description |
|
|
88
|
+
|
|
89
|
+
## Detection Script
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
#!/bin/bash
|
|
93
|
+
# {PascalCaseName} Hook
|
|
94
|
+
# {description}
|
|
95
|
+
|
|
96
|
+
set -e
|
|
97
|
+
|
|
98
|
+
echo "🔍 Running {name} check..."
|
|
99
|
+
|
|
100
|
+
# Configuration
|
|
101
|
+
BLOCKING_PATTERNS=(
|
|
102
|
+
"PATTERN_ONE"
|
|
103
|
+
"PATTERN_TWO"
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
WARNING_PATTERNS=(
|
|
107
|
+
"WARN_PATTERN"
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
FILE_TYPES="*.ts *.js *.tsx *.jsx"
|
|
111
|
+
|
|
112
|
+
FOUND_BLOCKING=0
|
|
113
|
+
FOUND_WARNING=0
|
|
114
|
+
|
|
115
|
+
# Check blocking patterns
|
|
116
|
+
for pattern in "${BLOCKING_PATTERNS[@]}"; do
|
|
117
|
+
if grep -rn "$pattern" --include="$FILE_TYPES" . 2>/dev/null; then
|
|
118
|
+
echo "❌ BLOCKING: Found '$pattern'"
|
|
119
|
+
FOUND_BLOCKING=$((FOUND_BLOCKING + 1))
|
|
120
|
+
fi
|
|
121
|
+
done
|
|
122
|
+
|
|
123
|
+
# Check warning patterns
|
|
124
|
+
for pattern in "${WARNING_PATTERNS[@]}"; do
|
|
125
|
+
if grep -rn "$pattern" --include="$FILE_TYPES" . 2>/dev/null; then
|
|
126
|
+
echo "⚠️ WARNING: Found '$pattern'"
|
|
127
|
+
FOUND_WARNING=$((FOUND_WARNING + 1))
|
|
128
|
+
fi
|
|
129
|
+
done
|
|
130
|
+
|
|
131
|
+
# Results
|
|
132
|
+
if [ $FOUND_BLOCKING -gt 0 ]; then
|
|
133
|
+
echo ""
|
|
134
|
+
echo "╔═══════════════════════════════════════════╗"
|
|
135
|
+
echo "║ ❌ HOOK BLOCKED: $FOUND_BLOCKING issues found ║"
|
|
136
|
+
echo "╚═══════════════════════════════════════════╝"
|
|
137
|
+
echo ""
|
|
138
|
+
echo "Fix the issues above or bypass with:"
|
|
139
|
+
echo " SKIP_{NAME_UPPER}_HOOK=1 git commit -m 'message'"
|
|
140
|
+
exit 1
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
if [ $FOUND_WARNING -gt 0 ]; then
|
|
144
|
+
echo ""
|
|
145
|
+
echo "⚠️ $FOUND_WARNING warnings found (non-blocking)"
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
echo "✅ Hook PASSED"
|
|
149
|
+
exit 0
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Integration
|
|
153
|
+
|
|
154
|
+
### With GitFlow
|
|
155
|
+
|
|
156
|
+
In `/gitflow:3-commit`, this hook runs automatically:
|
|
157
|
+
|
|
158
|
+
1. User initiates commit
|
|
159
|
+
2. Hook executes detection script
|
|
160
|
+
3. If blocking patterns found → commit rejected
|
|
161
|
+
4. User must fix or explicitly bypass
|
|
162
|
+
|
|
163
|
+
### Manual Execution
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Run hook manually
|
|
167
|
+
./.claude/hooks/{name}.sh
|
|
168
|
+
|
|
169
|
+
# Check specific files
|
|
170
|
+
./.claude/hooks/{name}.sh src/specific-file.ts
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Bypass (Emergency Only)
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Use with extreme caution!
|
|
177
|
+
SKIP_{NAME_UPPER}_HOOK=1 git commit -m "message"
|
|
178
|
+
|
|
179
|
+
# Or in environment
|
|
180
|
+
export SKIP_{NAME_UPPER}_HOOK=1
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**WARNING**: Bypassing should be documented and justified.
|
|
184
|
+
|
|
185
|
+
## Logging
|
|
186
|
+
|
|
187
|
+
All detections logged to:
|
|
188
|
+
`~/.claude/gitflow/logs/{name}.json`
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"timestamp": "2024-01-15T10:30:00Z",
|
|
193
|
+
"hook": "{name}",
|
|
194
|
+
"trigger": "{trigger}",
|
|
195
|
+
"result": "blocked|passed|warning",
|
|
196
|
+
"blocking_issues": [],
|
|
197
|
+
"warnings": [],
|
|
198
|
+
"branch": "feature/xxx",
|
|
199
|
+
"user": "username"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Customization
|
|
204
|
+
|
|
205
|
+
Edit patterns in the hook file:
|
|
206
|
+
- Add new blocking patterns
|
|
207
|
+
- Adjust file type filters
|
|
208
|
+
- Customize error messages
|
|
209
|
+
|
|
210
|
+
## Priority
|
|
211
|
+
|
|
212
|
+
Security > Correctness > Speed
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Trigger Options
|
|
216
|
+
|
|
217
|
+
| Trigger | Use Case |
|
|
218
|
+
|---------|----------|
|
|
219
|
+
| `pre-commit` | Validate before local commit |
|
|
220
|
+
| `pre-merge` | Validate before branch merge |
|
|
221
|
+
| `pre-push` | Validate before pushing to remote |
|
|
222
|
+
| `post-commit` | Log/notify after commit |
|
|
223
|
+
|
|
224
|
+
## Workflow
|
|
225
|
+
|
|
226
|
+
1. Parse arguments (name, trigger, description)
|
|
227
|
+
2. Validate name format
|
|
228
|
+
3. Create project directory
|
|
229
|
+
4. Generate hook template with proper trigger
|
|
230
|
+
5. Display success message
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
User: $ARGUMENTS
|