@atlashub/smartstack-cli 1.34.0 → 1.36.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.
Files changed (75) hide show
  1. package/.documentation/installation.html +56 -31
  2. package/dist/index.js +1098 -582
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/templates/agents/docs-context-reader.md +125 -0
  6. package/templates/agents/docs-sync-checker.md +122 -0
  7. package/templates/hooks/docs-drift-check.md +97 -0
  8. package/templates/skills/_resources/context-digest-template.md +53 -0
  9. package/templates/skills/_resources/doc-context-cache.md +62 -0
  10. package/templates/skills/_resources/docs-manifest-schema.md +157 -0
  11. package/templates/skills/_resources/mcp-validate-documentation-spec.md +183 -0
  12. package/templates/skills/_shared.md +15 -7
  13. package/templates/skills/apex/SKILL.md +6 -0
  14. package/templates/skills/apex/steps/step-00-init.md +9 -0
  15. package/templates/skills/apex/steps/step-01-analyze.md +36 -0
  16. package/templates/skills/apex/steps/step-02-plan.md +38 -0
  17. package/templates/skills/apex/steps/step-03-execute.md +39 -0
  18. package/templates/skills/apex/steps/step-04-validate.md +31 -1
  19. package/templates/skills/apex/steps/step-04b-doc-sync.md +162 -0
  20. package/templates/skills/apex/steps/step-05-examine.md +7 -0
  21. package/templates/skills/apex/templates/04b-doc-sync.md +31 -0
  22. package/templates/skills/apex/templates/context-digest.md +35 -0
  23. package/templates/skills/application/steps/step-04-backend.md +17 -17
  24. package/templates/skills/application/steps/step-05-frontend.md +4 -1
  25. package/templates/skills/application/templates-backend.md +8 -8
  26. package/templates/skills/application/templates-frontend.md +8 -8
  27. package/templates/skills/business-analyse/SKILL.md +18 -5
  28. package/templates/skills/business-analyse/_shared.md +306 -4
  29. package/templates/skills/business-analyse/questionnaire/01-context.md +21 -6
  30. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +34 -0
  31. package/templates/skills/business-analyse/questionnaire/03-scope.md +23 -0
  32. package/templates/skills/business-analyse/questionnaire/04-data.md +44 -0
  33. package/templates/skills/business-analyse/questionnaire/05-integrations.md +29 -7
  34. package/templates/skills/business-analyse/questionnaire/06-security.md +28 -0
  35. package/templates/skills/business-analyse/questionnaire/07-ui.md +32 -7
  36. package/templates/skills/business-analyse/questionnaire/08-performance.md +21 -0
  37. package/templates/skills/business-analyse/questionnaire/09-constraints.md +29 -6
  38. package/templates/skills/business-analyse/questionnaire/10-documentation.md +27 -6
  39. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +59 -0
  40. package/templates/skills/business-analyse/questionnaire/12-migration.md +58 -0
  41. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +69 -0
  42. package/templates/skills/business-analyse/steps/step-00-init.md +110 -16
  43. package/templates/skills/business-analyse/steps/step-01-discover.md +530 -85
  44. package/templates/skills/business-analyse/steps/step-02-analyse.md +81 -25
  45. package/templates/skills/business-analyse/steps/step-03-specify.md +116 -24
  46. package/templates/skills/business-analyse/steps/step-04-validate.md +107 -33
  47. package/templates/skills/business-analyse/steps/step-05-handoff.md +256 -33
  48. package/templates/skills/business-analyse/steps/step-06-doc-html.md +84 -25
  49. package/templates/skills/business-analyse/templates/{frd-handoff.md → tpl-handoff.md} +18 -4
  50. package/templates/skills/business-analyse/templates-frd.md +19 -5
  51. package/templates/skills/business-analyse/tracking/change-template.md +30 -0
  52. package/templates/skills/documentation/SKILL.md +68 -31
  53. package/templates/skills/documentation/data-schema.md +198 -0
  54. package/templates/skills/documentation/templates.md +30 -1
  55. package/templates/skills/gitflow/_shared.md +188 -53
  56. package/templates/skills/gitflow/phases/abort.md +28 -16
  57. package/templates/skills/gitflow/phases/cleanup.md +13 -9
  58. package/templates/skills/gitflow/phases/status.md +16 -17
  59. package/templates/skills/gitflow/steps/step-commit.md +11 -5
  60. package/templates/skills/gitflow/steps/step-finish.md +43 -33
  61. package/templates/skills/gitflow/steps/step-init.md +134 -2
  62. package/templates/skills/gitflow/steps/step-merge.md +24 -10
  63. package/templates/skills/gitflow/steps/step-pr.md +42 -28
  64. package/templates/skills/gitflow/steps/step-start.md +19 -13
  65. package/templates/skills/gitflow/templates/config.json +14 -4
  66. package/templates/skills/ralph-loop/SKILL.md +58 -9
  67. package/templates/skills/ralph-loop/steps/step-00-init.md +170 -30
  68. package/templates/skills/ralph-loop/steps/step-01-task.md +243 -40
  69. package/templates/skills/ralph-loop/steps/step-02-execute.md +142 -24
  70. package/templates/skills/ralph-loop/steps/step-03-commit.md +140 -36
  71. package/templates/skills/ralph-loop/steps/step-04-check.md +128 -44
  72. package/templates/skills/ralph-loop/steps/step-05-report.md +175 -88
  73. /package/templates/skills/business-analyse/templates/{frd-brd.md → tpl-brd.md} +0 -0
  74. /package/templates/skills/business-analyse/templates/{frd-discovery.md → tpl-discovery.md} +0 -0
  75. /package/templates/skills/business-analyse/templates/{frd-spec.md → tpl-frd.md} +0 -0
@@ -8,14 +8,17 @@ description: |
8
8
  - User wants to document a module, table, tool, or test
9
9
  - After implementing a feature to generate its documentation
10
10
  Types: user module, developer tools, database ERD, testing tools
11
+ argument-hint: "<module-name> [--type user|developer|database|testing|update]"
11
12
  ---
12
13
 
13
- # Skill Documentation SmartStack
14
-
15
- > **Note:** This skill works in synergy with the `/documentation:module` command.
14
+ <objective>
15
+ Generate and maintain technical documentation integrated into SmartStack web app.
16
+ Works in synergy with the `/documentation:module` command.
16
17
 
17
18
  **Reference:** [_shared.md](../_shared.md) for architecture, i18n
19
+ </objective>
18
20
 
21
+ <quick_start>
19
22
  ## WHEN THIS SKILL ACTIVATES
20
23
 
21
24
  Claude automatically invokes this skill when it detects:
@@ -27,9 +30,33 @@ Claude automatically invokes this skill when it detects:
27
30
  | After implementation | "The feature is done, generate the doc" |
28
31
  | Structure question | "How is the documentation organized?" |
29
32
  | Keywords | "ERD", "schema", "diagram", "document" |
33
+ | **Update request** | "Update the doc", "refresh documentation", "doc is outdated" |
34
+ | **Drift detected** | "The SLA documentation is stale" |
35
+ </quick_start>
30
36
 
31
- ---
37
+ <parameters>
38
+ ## DOCUMENTATION TYPES
39
+
40
+ | Type | Description | Output |
41
+ |------|-------------|--------|
42
+ | `user` | User module (data-driven) | `docs/business/{app}/{module}/frd-data.ts` + `index.tsx` |
43
+ | `developer` | Development tool guide | `docs/developer/tools/{Tool}Page.tsx` |
44
+ | `database` | Schema with ERD diagram | `docs/developer/database/{Schema}SchemaPage.tsx` |
45
+ | `testing` | Testing tool | `docs/developer/testing/{Tool}TestingPage.tsx` |
46
+ | `update` | Update existing documentation | Updates `frd-data.ts` + i18n FR |
47
+
48
+ ### Available Developer tools
49
+
50
+ | Category | Tools |
51
+ |----------|-------|
52
+ | Local Environment | Docker Compose, MailDev, VS Code, Environment variables |
53
+ | API Testing | Postman, REST Client, Swagger/OpenAPI |
54
+ | E2E Testing | Microsoft Playwright, Inspector, Trace Viewer |
55
+ | Load Testing | NBomber (.NET), k6, Azure Load Testing |
56
+ | Security Testing | OWASP ZAP, Security Code Scan, Snyk, OWASP ASVS |
57
+ </parameters>
32
58
 
59
+ <workflow>
33
60
  ## AUTOMATIC WORKFLOW
34
61
 
35
62
  ### STEP 1: TYPE DETECTION
@@ -53,40 +80,35 @@ Identify the specific name:
53
80
 
54
81
  ### STEP 3: EXECUTION
55
82
 
56
- Follow the workflow of the `/documentation:module` command:
83
+ **For NEW documentation (type = user|developer|database|testing):**
57
84
 
58
- ```
59
- TYPE = detected type (user|developer|database|testing)
60
- TARGET = extracted target
85
+ Follow the data-driven workflow from [templates.md](templates.md):
61
86
 
62
- → Execute the complete /documentation:module workflow
87
+ ```
88
+ 1. Read source data (FRD, BRD, code patterns)
89
+ 2. Generate frd-data.ts (data file, ~50 lines)
90
+ 3. Generate index.tsx (page wrapper, ~10 lines)
91
+ 4. Generate i18n FR file (source language only)
92
+ 5. Update docs-manifest.json
93
+ 6. Update App.tsx routing and parent indexes
63
94
  ```
64
95
 
65
- ---
66
-
67
- ## QUICK REFERENCE
68
-
69
- ### Documentation types
70
-
71
- | Type | Description | Output |
72
- |------|-------------|--------|
73
- | `user` | User module with UI mockups | `docs/user/{context}/{Module}DocPage.tsx` |
74
- | `developer` | Development tool guide | `docs/developer/tools/{Tool}Page.tsx` |
75
- | `database` | Schema with ERD diagram | `docs/developer/database/{Schema}SchemaPage.tsx` |
76
- | `testing` | Testing tool | `docs/developer/testing/{Tool}TestingPage.tsx` |
77
-
78
- ### Available Developer tools
96
+ **For UPDATE documentation (type = update):**
79
97
 
80
- | Category | Tools |
81
- |----------|-------|
82
- | Local Environment | Docker Compose, MailDev, VS Code, Environment variables |
83
- | API Testing | Postman, REST Client, Swagger/OpenAPI |
84
- | E2E Testing | Microsoft Playwright, Inspector, Trace Viewer |
85
- | Load Testing | NBomber (.NET), k6, Azure Load Testing |
86
- | Security Testing | OWASP ZAP, Security Code Scan, Snyk, OWASP ASVS |
98
+ ```
99
+ 1. Read docs-manifest.json → find target module
100
+ 2. Invoke docs-context-reader agent get current doc state
101
+ 3. Identify code changes since last doc update (git diff)
102
+ 4. Map changes to documentation sections (see data-schema.md)
103
+ 5. Update frd-data.ts with new/modified data
104
+ 6. Update i18n FR file if labels changed
105
+ 7. Update docs-manifest.json timestamps
106
+ ```
87
107
 
88
- ---
108
+ > **i18n simplifié:** Seul FR (source) est généré. EN/IT/DE sont déférés à un pipeline de traduction séparé.
109
+ </workflow>
89
110
 
111
+ <execution_rules>
90
112
  ## ABSOLUTE RULES
91
113
 
92
114
  1. **NEVER** hardcoded text → `useTranslation('docs')`
@@ -95,6 +117,17 @@ TARGET = extracted target
95
117
  4. **ALWAYS** confirm before creating
96
118
  5. **ALWAYS** update App.tsx and parent indexes
97
119
  6. **ALWAYS** add module in `UserIndexPage.tsx` (IF type == `user`)
120
+ </execution_rules>
121
+
122
+ ---
123
+
124
+ <success_criteria>
125
+ - Documentation page renders correctly in React app
126
+ - i18n files created for all 4 languages (FR, EN, IT, DE)
127
+ - Route registered in App.tsx
128
+ - docs-manifest.json updated
129
+ - Module appears in UserIndexPage (if type = user)
130
+ </success_criteria>
98
131
 
99
132
  ---
100
133
 
@@ -131,4 +164,8 @@ TARGET = extracted target
131
164
  ## ASSOCIATED FILES
132
165
 
133
166
  - **React Templates:** [templates.md](templates.md)
167
+ - **Data Schema:** [data-schema.md](data-schema.md)
168
+ - **FrdDocRenderer:** `web/smartstack-web/src/components/docs/FrdDocRenderer.tsx`
169
+ - **Types:** `web/smartstack-web/src/components/docs/types.ts`
170
+ - **Manifest Schema:** `_resources/docs-manifest-schema.md`
134
171
  - **Complete Command:** `.claude/commands/documentation-module.md`
@@ -0,0 +1,198 @@
1
+ # Documentation Data Schema
2
+
3
+ ## Purpose
4
+
5
+ This file describes how to generate `frd-data.ts` files for the `FrdDocRenderer` shared component.
6
+ Instead of generating full TSX components (~250 lines) per module, generate only the data (~50 lines).
7
+
8
+ ## FrdData Interface Reference
9
+
10
+ The full TypeScript interface is in `web/smartstack-web/src/components/docs/types.ts`.
11
+
12
+ ## Data Extraction Mapping
13
+
14
+ ### From FRD (3-functional-specification.md)
15
+
16
+ | FRD Section | FrdData Field | Extraction |
17
+ |-------------|---------------|------------|
18
+ | Section 1: Overview | `overview.objective` | Functional objective text |
19
+ | Section 1: Overview | `overview.problem` | Problem statement |
20
+ | Section 1: Overview | `overview.solution` | Solution statement |
21
+ | Section 2: Use Cases | `useCases[]` | UC-XXX entries (id, name, actor, description, permission, priority) |
22
+ | Section 3: Functional Requirements | `features[]` | FR-XXX entries grouped as features |
23
+ | Section 5: Permission Matrix | `permissions[]` | Role-permission entries |
24
+ | Section 6: Gherkin Scenarios | (used for test data, not doc) | - |
25
+ | Section 7: Validations | `businessRules[]` | BR-XXX from BRD cross-referenced |
26
+
27
+ ### From BRD (2-business-requirements.md)
28
+
29
+ | BRD Section | FrdData Field | Extraction |
30
+ |-------------|---------------|------------|
31
+ | Section 2: Business Objectives | `overview.stats` | Count objectives |
32
+ | Section 3: Business Rules | `businessRules[]` | BR-XXX entries (id, name, category, statement) |
33
+ | Section 6: Integrations | `technicalRef` | Integration notes |
34
+
35
+ ### From Handoff (4-development-handoff.md)
36
+
37
+ | Handoff Section | FrdData Field | Extraction |
38
+ |-----------------|---------------|------------|
39
+ | Section 3: Files to Create | `technicalRef.entityNames` | Entity names |
40
+ | Section 6: API Endpoints | `apiEndpoints[]` | Endpoint entries |
41
+ | Section 1: Quick Context | `technicalRef.permissionBase` | Permission base path |
42
+ | Section 1: Quick Context | `technicalRef.controllerRoute` | Controller route |
43
+
44
+ ### Generated/Inferred Fields
45
+
46
+ | Field | Source |
47
+ |-------|--------|
48
+ | `featureId` | From 00-context.md state |
49
+ | `moduleName` | From 00-context.md state |
50
+ | `applicationName` | From 00-context.md state |
51
+ | `version` | "1.0" (initial) |
52
+ | `benefits[]` | Inferred from BRD objectives or i18n |
53
+ | `beforeAfter` | Inferred from discovery problem/solution |
54
+ | `steps[]` | Inferred from use cases main scenario |
55
+ | `faq[]` | Inferred from discovery open questions |
56
+ | `screenshots` | Convention: `/assets/docs/{module}/step-{N}.png` |
57
+
58
+ ## Generated File Structure
59
+
60
+ ### frd-data.ts (per module, ~50-80 lines)
61
+
62
+ ```typescript
63
+ // web/smartstack-web/src/pages/docs/business/{app}/{module}/frd-data.ts
64
+ import type { FrdData } from '@/components/docs';
65
+
66
+ export const frdData: FrdData = {
67
+ featureId: 'FEAT-001',
68
+ moduleName: 'Sla',
69
+ applicationName: 'Support',
70
+ version: '1.0',
71
+
72
+ overview: {
73
+ objective: 'docs.support.sla.overview.objective',
74
+ problem: 'docs.support.sla.overview.problem',
75
+ solution: 'docs.support.sla.overview.solution',
76
+ stats: { useCases: 4, businessRules: 6, permissions: 5, endpoints: 5 },
77
+ },
78
+
79
+ useCases: [
80
+ { id: 'UC-001', name: 'Create SLA', actor: 'Admin', description: '...', permission: 'business.support.sla.create', priority: 'Must' },
81
+ // ...
82
+ ],
83
+
84
+ benefits: [
85
+ { icon: 'time', titleKey: 'docs.support.sla.benefits.time.title', value: '-70%', descriptionKey: 'docs.support.sla.benefits.time.description' },
86
+ { icon: 'quality', titleKey: 'docs.support.sla.benefits.quality.title', value: '+95%', descriptionKey: 'docs.support.sla.benefits.quality.description' },
87
+ { icon: 'roi', titleKey: 'docs.support.sla.benefits.roi.title', value: '3x', descriptionKey: 'docs.support.sla.benefits.roi.description' },
88
+ ],
89
+
90
+ beforeAfter: {
91
+ beforeItems: ['Manual SLA tracking', 'No escalation alerts', 'No compliance visibility', 'Scattered data'],
92
+ afterItems: ['Automated SLA monitoring', 'Real-time escalation', 'Compliance dashboard', 'Centralized metrics'],
93
+ },
94
+
95
+ features: [
96
+ { id: 'F-001', title: 'SLA Configuration', description: '...', example: '...' },
97
+ // ...
98
+ ],
99
+
100
+ steps: [
101
+ { number: 1, title: 'Navigate to SLA module', description: '...', screenshotKey: 'step1' },
102
+ { number: 2, title: 'Create SLA policy', description: '...', screenshotKey: 'step2' },
103
+ // ...
104
+ ],
105
+
106
+ faq: [
107
+ { questionKey: 'docs.support.sla.faq.1.question', answerKey: 'docs.support.sla.faq.1.answer' },
108
+ // ...
109
+ ],
110
+
111
+ businessRules: [
112
+ { id: 'BR-001', name: 'SLA Time Calculation', category: 'Calculation', statement: '...' },
113
+ // ...
114
+ ],
115
+
116
+ permissions: [
117
+ { path: 'business.support.sla.read', description: 'View SLA policies', roles: ['Admin', 'Manager', 'User', 'ReadOnly'] },
118
+ { path: 'business.support.sla.create', description: 'Create SLA policies', roles: ['Admin', 'Manager'] },
119
+ // ...
120
+ ],
121
+
122
+ apiEndpoints: [
123
+ { method: 'GET', path: '/api/business/sla', handler: 'GetAllSlaQuery', permission: '.read' },
124
+ { method: 'POST', path: '/api/business/sla', handler: 'CreateSlaCommand', permission: '.create' },
125
+ // ...
126
+ ],
127
+
128
+ screenshots: {
129
+ step1: '/assets/docs/sla/step-1.png',
130
+ step2: '/assets/docs/sla/step-2.png',
131
+ },
132
+
133
+ technicalRef: {
134
+ permissionBase: 'business.support.sla',
135
+ controllerRoute: 'business.support.sla',
136
+ entityNames: ['Sla', 'SlaPolicy', 'SlaEscalation'],
137
+ },
138
+ };
139
+ ```
140
+
141
+ ### Page wrapper (per module, ~10 lines)
142
+
143
+ ```typescript
144
+ // web/smartstack-web/src/pages/docs/business/{app}/{module}/index.tsx
145
+ import { FrdDocRenderer } from '@/components/docs';
146
+ import { frdData } from './frd-data';
147
+
148
+ export default function {Module}DocPage() {
149
+ return (
150
+ <FrdDocRenderer
151
+ data={frdData}
152
+ backPath="/docs/business/{app}"
153
+ backLabel="nav.backToApp"
154
+ />
155
+ );
156
+ }
157
+ ```
158
+
159
+ ### i18n file (FR source, ~30 lines)
160
+
161
+ ```json
162
+ // web/smartstack-web/src/i18n/locales/fr/docs-{app}-{module}.json
163
+ {
164
+ "support": {
165
+ "sla": {
166
+ "overview": {
167
+ "objective": "Gestion des niveaux de service (SLA)",
168
+ "problem": "Les engagements de service ne sont pas suivis, les escalades sont manuelles",
169
+ "solution": "Monitoring automatique des SLA avec alertes et escalades configurables"
170
+ },
171
+ "benefits": {
172
+ "time": { "title": "Temps économisé", "description": "Réduction de 70% du temps de suivi manuel" },
173
+ "quality": { "title": "Fiabilité", "description": "95% des SLA respectés grâce au monitoring" },
174
+ "roi": { "title": "ROI", "description": "Retour sur investissement en 3 mois" }
175
+ },
176
+ "faq": {
177
+ "1": {
178
+ "question": "Dois-je configurer chaque SLA manuellement ?",
179
+ "answer": "Non, des templates prédéfinis sont disponibles pour les cas courants."
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ > **Note:** Seul FR est généré. EN/IT/DE sont marqués comme "deferred" et générés par un pipeline de traduction séparé.
188
+
189
+ ## Screenshot Convention
190
+
191
+ | Key | Path | Description |
192
+ |-----|------|-------------|
193
+ | `step{N}` | `/assets/docs/{module}/step-{N}.png` | Step-by-step guide screenshots |
194
+ | `overview` | `/assets/docs/{module}/overview.png` | Module overview screenshot |
195
+ | `dashboard` | `/assets/docs/{module}/dashboard.png` | Dashboard view |
196
+
197
+ Screenshots are added manually or via Playwright E2E tests.
198
+ The `FrdDocRenderer` shows a "Screenshot à venir" placeholder when the image file is not found.
@@ -22,7 +22,36 @@ Chaque documentation de module DOIT inclure ces sections dans cet ordre:
22
22
 
23
23
  ---
24
24
 
25
- ## Template User Module (Business-First)
25
+ ## Data-Driven Approach (Recommended)
26
+
27
+ > **Principe:** Au lieu de générer un composant TSX complet (~250 lignes) par module,
28
+ > générer uniquement un fichier de DONNÉES (`frd-data.ts`, ~50 lignes) + un wrapper minimal.
29
+ > Le rendu est assuré par le composant partagé `FrdDocRenderer` dans `web/.../components/docs/`.
30
+
31
+ ### Fichiers à générer par module
32
+
33
+ **1. Data file** (`frd-data.ts`) : Voir [data-schema.md](data-schema.md) pour le mapping complet.
34
+
35
+ **2. Page wrapper** (`index.tsx`, ~10 lignes) :
36
+ ```tsx
37
+ import { FrdDocRenderer } from '@/components/docs';
38
+ import { frdData } from './frd-data';
39
+
40
+ export default function {ModuleName}DocPage() {
41
+ return <FrdDocRenderer data={frdData} backPath="/docs/business/{app}" />;
42
+ }
43
+ ```
44
+
45
+ **3. i18n FR uniquement** : Générer la langue source (FR). EN/IT/DE sont déférés.
46
+
47
+ > **Screenshots:** Chemins conventionnels `/assets/docs/{module}/step-{N}.png`.
48
+ > Le renderer affiche un placeholder "Screenshot à venir" si l'image n'existe pas.
49
+
50
+ ---
51
+
52
+ ## Legacy: Template TSX Complet (référence)
53
+
54
+ > **Déprécié:** Conservé pour référence. Utilisez l'approche data-driven ci-dessus.
26
55
 
27
56
  ```tsx
28
57
  // web/smartstack-web/src/pages/docs/user/{ModuleName}DocPage.tsx
@@ -45,12 +45,113 @@ normalize_branch_name() {
45
45
 
46
46
  ---
47
47
 
48
+ ## RESOLVE_CONFIG_PATH
49
+
50
+ Resolves the config.json path regardless of current working directory.
51
+ Searches in: pwd, develop worktree, then git root.
52
+
53
+ ```bash
54
+ resolve_gitflow_config_path() {
55
+ # 1. Try current directory
56
+ [ -f ".claude/gitflow/config.json" ] && { echo ".claude/gitflow/config.json"; return 0; }
57
+
58
+ # 2. Try to find develop worktree from git worktree list
59
+ local DEVELOP_PATH
60
+ DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
61
+ [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ] && {
62
+ echo "$DEVELOP_PATH/.claude/gitflow/config.json"
63
+ return 0
64
+ }
65
+
66
+ # 3. Try git toplevel
67
+ local GIT_ROOT
68
+ GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
69
+ [ -n "$GIT_ROOT" ] && [ -f "$GIT_ROOT/.claude/gitflow/config.json" ] && {
70
+ echo "$GIT_ROOT/.claude/gitflow/config.json"
71
+ return 0
72
+ }
73
+
74
+ return 1
75
+ }
76
+ ```
77
+
78
+ ---
79
+
80
+ ## READ_GITFLOW_CONFIG
81
+
82
+ Reads GitFlow configuration from config.json. Exposes all variables needed by steps and phases.
83
+
84
+ ```bash
85
+ read_gitflow_config() {
86
+ local CONFIG_FILE
87
+ CONFIG_FILE=$(resolve_gitflow_config_path) || {
88
+ echo "❌ GitFlow config not found. Run /gitflow init first."
89
+ return 1
90
+ }
91
+
92
+ # Repository
93
+ GF_PROJECT_NAME=$(grep -oP '"name":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
94
+ GF_ROOT_FOLDER=$(grep -oP '"rootFolder":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
95
+ GF_REMOTE_URL=$(grep -oP '"remoteUrl":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
96
+
97
+ # Git provider and branches
98
+ GF_PROVIDER=$(grep -oP '"provider":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
99
+ GF_MAIN_BRANCH=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
100
+ GF_DEVELOP_BRANCH=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
101
+
102
+ # Prefixes
103
+ GF_FEATURE_PREFIX=$(grep -oP '"feature":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
104
+ GF_RELEASE_PREFIX=$(grep -oP '"release":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
105
+ GF_HOTFIX_PREFIX=$(grep -oP '"hotfix":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
106
+
107
+ # Worktrees
108
+ GF_WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
109
+ GF_MAIN_PATH=$(grep -A1 '"structure"' "$CONFIG_FILE" | grep -oP '"main":\s*"\K[^"]+' | head -1)
110
+ GF_DEVELOP_PATH=$(grep -A2 '"structure"' "$CONFIG_FILE" | grep -oP '"develop":\s*"\K[^"]+' | head -1)
111
+ GF_FEATURES_PATH=$(grep -oP '"features":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
112
+ GF_RELEASES_PATH=$(grep -oP '"releases":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
113
+ GF_HOTFIXES_PATH=$(grep -oP '"hotfixes":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
114
+
115
+ # Language
116
+ GF_LANG=$(grep -oP '"code":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
117
+
118
+ # Versioning
119
+ GF_VERSION=$(grep -oP '"current":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
120
+ GF_TAG_PREFIX=$(grep -oP '"tagPrefix":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
121
+
122
+ # Defaults for missing values
123
+ GF_LANG=${GF_LANG:-en}
124
+ GF_WORKTREE_MODE=${GF_WORKTREE_MODE:-organized}
125
+ GF_MAIN_BRANCH=${GF_MAIN_BRANCH:-main}
126
+ GF_DEVELOP_BRANCH=${GF_DEVELOP_BRANCH:-develop}
127
+ GF_FEATURE_PREFIX=${GF_FEATURE_PREFIX:-feature/}
128
+ GF_RELEASE_PREFIX=${GF_RELEASE_PREFIX:-release/}
129
+ GF_HOTFIX_PREFIX=${GF_HOTFIX_PREFIX:-hotfix/}
130
+ GF_TAG_PREFIX=${GF_TAG_PREFIX:-v}
131
+ GF_VERSION=${GF_VERSION:-0.1.0}
132
+
133
+ # Export config file path for steps that need to update it
134
+ GF_CONFIG_FILE="$CONFIG_FILE"
135
+ }
136
+ ```
137
+
138
+ ---
139
+
48
140
  ## DETECT_WORKTREE_MODE
49
141
 
50
- Detects worktree mode (organized, adjacent, none).
142
+ Detects worktree mode. Reads config first, falls back to filesystem detection.
51
143
 
52
144
  ```bash
53
145
  detect_worktree_mode() {
146
+ # 1. Try config first (authoritative)
147
+ local CONFIG_FILE
148
+ CONFIG_FILE=$(resolve_gitflow_config_path 2>/dev/null)
149
+ if [ -n "$CONFIG_FILE" ] && [ -f "$CONFIG_FILE" ]; then
150
+ WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
151
+ [ -n "$WORKTREE_MODE" ] && return 0
152
+ fi
153
+
154
+ # 2. Fallback: filesystem detection
54
155
  if [ -d "../features" ] && [ -d "../releases" ] && [ -d "../hotfixes" ]; then
55
156
  WORKTREE_MODE="organized"
56
157
  elif [ -d "../01-Main" ] && [ -d "../02-Develop" ]; then
@@ -58,9 +159,7 @@ detect_worktree_mode() {
58
159
  elif [ -d "../worktrees" ]; then
59
160
  WORKTREE_MODE="adjacent"
60
161
  else
61
- CONFIG_FILE=".claude/gitflow/config.json"
62
- [ -f "$CONFIG_FILE" ] && WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
63
- WORKTREE_MODE=${WORKTREE_MODE:-adjacent}
162
+ WORKTREE_MODE="organized"
64
163
  fi
65
164
  }
66
165
  ```
@@ -69,26 +168,30 @@ detect_worktree_mode() {
69
168
 
70
169
  ## CLEANUP_WORKTREE
71
170
 
72
- Cleans up a worktree for a given branch.
171
+ Cleans up a worktree for a given branch. Uses config paths when available.
73
172
 
74
173
  ```bash
75
174
  cleanup_worktree_for_branch() {
76
- local BRANCH=$1 WORKTREE_BASE="../worktrees" WORKTREE_PATH=""
77
-
78
- case "$BRANCH" in
79
- feature/*) WORKTREE_PATH="$WORKTREE_BASE/features/${BRANCH#feature/}" ;;
80
- release/*) WORKTREE_PATH="$WORKTREE_BASE/releases/${BRANCH#release/}" ;;
81
- hotfix/*) WORKTREE_PATH="$WORKTREE_BASE/hotfixes/${BRANCH#hotfix/}" ;;
82
- esac
83
-
84
- # Organized mode
85
- [ -d "../features" ] && case "$BRANCH" in
86
- feature/*) WORKTREE_PATH="../features/${BRANCH#feature/}" ;;
87
- release/*) WORKTREE_PATH="../releases/${BRANCH#release/}" ;;
88
- hotfix/*) WORKTREE_PATH="../hotfixes/${BRANCH#hotfix/}" ;;
89
- esac
90
-
91
- [ -d "$WORKTREE_PATH" ] && {
175
+ local BRANCH=$1 WORKTREE_PATH=""
176
+
177
+ # Try config-based paths first (absolute, reliable)
178
+ read_gitflow_config 2>/dev/null
179
+ if [ -n "$GF_FEATURES_PATH" ]; then
180
+ case "$BRANCH" in
181
+ feature/*) WORKTREE_PATH="$GF_FEATURES_PATH/${BRANCH#feature/}" ;;
182
+ release/*) WORKTREE_PATH="$GF_RELEASES_PATH/${BRANCH#release/}" ;;
183
+ hotfix/*) WORKTREE_PATH="$GF_HOTFIXES_PATH/${BRANCH#hotfix/}" ;;
184
+ esac
185
+ else
186
+ # Fallback: relative paths
187
+ case "$BRANCH" in
188
+ feature/*) WORKTREE_PATH="../features/${BRANCH#feature/}" ;;
189
+ release/*) WORKTREE_PATH="../releases/${BRANCH#release/}" ;;
190
+ hotfix/*) WORKTREE_PATH="../hotfixes/${BRANCH#hotfix/}" ;;
191
+ esac
192
+ fi
193
+
194
+ [ -n "$WORKTREE_PATH" ] && [ -d "$WORKTREE_PATH" ] && {
92
195
  git worktree remove "$WORKTREE_PATH" --force 2>/dev/null || rm -rf "$WORKTREE_PATH"
93
196
  git worktree prune
94
197
  echo "✓ Worktree cleaned: $WORKTREE_PATH"
@@ -116,47 +219,79 @@ sync_with_remote() {
116
219
 
117
220
  ---
118
221
 
119
- ## READ_GITFLOW_CONFIG
120
-
121
- Reads GitFlow configuration.
122
-
123
- ```bash
124
- read_gitflow_config() {
125
- local CONFIG_FILE=".claude/gitflow/config.json"
126
- [ ! -f "$CONFIG_FILE" ] && return 1
127
-
128
- # Exported variables
129
- GF_LANG=$(grep -oP '"code":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
130
- GF_WORKTREE_MODE=$(grep -oP '"mode":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
131
- GF_MAIN_BRANCH=$(grep -oP '"main":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
132
- GF_DEVELOP_BRANCH=$(grep -oP '"develop":\s*"\K[^"]+' "$CONFIG_FILE" | head -1)
133
-
134
- GF_LANG=${GF_LANG:-en}
135
- GF_WORKTREE_MODE=${GF_WORKTREE_MODE:-adjacent}
136
- GF_MAIN_BRANCH=${GF_MAIN_BRANCH:-main}
137
- GF_DEVELOP_BRANCH=${GF_DEVELOP_BRANCH:-develop}
138
- }
139
- ```
140
-
141
- ---
142
-
143
222
  ## CONFIG_TEMPLATE
144
223
 
145
- GitFlow configuration JSON template (minimal version).
224
+ GitFlow configuration JSON template v2.0.0 (aligned with `templates/config.json`).
146
225
 
147
226
  ```json
148
227
  {
149
- "version": "1.3.0",
150
- "branches": { "main": "main", "develop": "develop" },
151
- "prefixes": { "feature": "feature/", "release": "release/", "hotfix": "hotfix/" },
152
- "worktrees": { "mode": "organized" },
153
- "language": { "code": "en" }
228
+ "version": "2.0.0",
229
+ "repository": {
230
+ "name": "",
231
+ "rootFolder": "",
232
+ "nameVariants": {
233
+ "pascalCaseDot": "",
234
+ "pascalCase": "",
235
+ "kebabCase": "",
236
+ "snakeCase": "",
237
+ "displayName": ""
238
+ },
239
+ "defaultBranch": "main",
240
+ "remoteUrl": ""
241
+ },
242
+ "git": {
243
+ "provider": "",
244
+ "branches": {
245
+ "main": "main",
246
+ "develop": "develop"
247
+ },
248
+ "prefixes": {
249
+ "feature": "feature/",
250
+ "release": "release/",
251
+ "hotfix": "hotfix/"
252
+ }
253
+ },
254
+ "worktrees": {
255
+ "enabled": true,
256
+ "mode": "organized",
257
+ "structure": {
258
+ "main": "",
259
+ "develop": "",
260
+ "features": "",
261
+ "releases": "",
262
+ "hotfixes": ""
263
+ }
264
+ },
265
+ "versioning": {
266
+ "strategy": "semver",
267
+ "current": "0.1.0",
268
+ "tagPrefix": "v",
269
+ "sources": ["csproj", "package.json", "VERSION"]
270
+ },
271
+ "efcore": {
272
+ "enabled": true,
273
+ "validateOnCommit": true,
274
+ "blockDestructive": true,
275
+ "migrationNaming": "{context}_v{version}_{sequence}_{Description}"
276
+ },
277
+ "workflow": {
278
+ "push": {
279
+ "afterCommit": "worktree"
280
+ },
281
+ "pr": {
282
+ "autoLabels": true,
283
+ "requireReview": true
284
+ }
285
+ },
286
+ "language": {
287
+ "code": "en"
288
+ }
154
289
  }
155
290
  ```
156
291
 
157
292
  **worktrees.mode options:**
158
- - `organized`: `../features/`, `../releases/`, `../hotfixes/`
159
- - `adjacent`: `../worktrees/{type}/`
293
+ - `organized`: Uses absolute paths from config (`structure.features`, etc.)
294
+ - `adjacent`: `{rootFolder}/worktrees/{type}/`
160
295
  - `disabled`: No worktrees
161
296
 
162
297
  ---