@atlashub/smartstack-cli 3.37.0 → 3.39.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 (228) hide show
  1. package/dist/index.js +16 -24
  2. package/dist/index.js.map +1 -1
  3. package/dist/mcp-entry.mjs +235 -265
  4. package/dist/mcp-entry.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/scripts/extract-api-endpoints.ts +5 -5
  7. package/scripts/generate-doc-with-mock-ui.ts +10 -17
  8. package/templates/agents/ba-reader.md +9 -9
  9. package/templates/agents/ba-writer.md +12 -15
  10. package/templates/agents/code-reviewer.md +1 -1
  11. package/templates/agents/docs-context-reader.md +1 -1
  12. package/templates/agents/efcore/scan.md +3 -1
  13. package/templates/agents/gitflow/commit.md +74 -0
  14. package/templates/agents/gitflow/finish.md +5 -2
  15. package/templates/agents/gitflow/init-clone.md +3 -3
  16. package/templates/agents/gitflow/init-validate.md +3 -2
  17. package/templates/agents/gitflow/merge.md +5 -4
  18. package/templates/agents/gitflow/pr.md +5 -4
  19. package/templates/agents/gitflow/start.md +37 -5
  20. package/templates/hooks/hooks.json +11 -0
  21. package/templates/hooks/wsl-dotnet-cleanup.sh +24 -0
  22. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +20 -20
  23. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +16 -24
  24. package/templates/mcp-scaffolding/migrations/seed-roles.cs.hbs +2 -2
  25. package/templates/skills/_resources/mcp-validate-documentation-spec.md +3 -3
  26. package/templates/skills/_shared.md +15 -17
  27. package/templates/skills/ai-prompt/SKILL.md +1 -1
  28. package/templates/skills/ai-prompt/steps/step-00-init.md +47 -0
  29. package/templates/skills/apex/SKILL.md +3 -4
  30. package/templates/skills/apex/_shared.md +10 -20
  31. package/templates/skills/apex/references/analysis-methods.md +141 -0
  32. package/templates/skills/apex/references/challenge-questions.md +1 -21
  33. package/templates/skills/apex/references/core-seed-data.md +35 -58
  34. package/templates/skills/apex/references/examine-build-validation.md +82 -0
  35. package/templates/skills/apex/references/execution-frontend-gates.md +177 -0
  36. package/templates/skills/apex/references/execution-frontend-patterns.md +105 -0
  37. package/templates/skills/apex/references/execution-layer1-rules.md +96 -0
  38. package/templates/skills/apex/references/initialization-challenge-flow.md +110 -0
  39. package/templates/skills/apex/references/planning-layer-mapping.md +151 -0
  40. package/templates/skills/apex/references/post-checks.md +145 -40
  41. package/templates/skills/apex/references/smartstack-api.md +35 -51
  42. package/templates/skills/apex/references/smartstack-frontend.md +18 -18
  43. package/templates/skills/apex/references/smartstack-layers.md +38 -62
  44. package/templates/skills/apex/steps/step-00-init.md +14 -26
  45. package/templates/skills/apex/steps/step-01-analyze.md +10 -143
  46. package/templates/skills/apex/steps/step-02-plan.md +10 -92
  47. package/templates/skills/apex/steps/step-03-execute.md +45 -252
  48. package/templates/skills/apex/steps/step-04-examine.md +14 -78
  49. package/templates/skills/apex/steps/step-05-deep-review.md +2 -2
  50. package/templates/skills/apex/steps/step-08-run-tests.md +1 -0
  51. package/templates/skills/application/SKILL.md +241 -242
  52. package/templates/skills/application/references/backend-controller-hierarchy.md +16 -16
  53. package/templates/skills/application/references/backend-seeding-and-dto-output.md +83 -0
  54. package/templates/skills/application/references/backend-table-prefix-mapping.md +79 -0
  55. package/templates/skills/application/references/backend-verification.md +1 -1
  56. package/templates/skills/application/references/frontend-i18n-and-output.md +67 -0
  57. package/templates/skills/application/references/frontend-route-naming.md +117 -0
  58. package/templates/skills/application/references/frontend-route-wiring-app-tsx.md +107 -0
  59. package/templates/skills/application/references/frontend-verification.md +12 -12
  60. package/templates/skills/application/references/init-parameter-detection.md +121 -0
  61. package/templates/skills/application/references/migration-checklist-troubleshooting.md +100 -0
  62. package/templates/skills/application/references/nav-fallback-procedure.md +199 -200
  63. package/templates/skills/application/references/provider-template.md +2 -6
  64. package/templates/skills/application/references/roles-client-project-handling.md +55 -0
  65. package/templates/skills/application/references/roles-fallback-procedure.md +149 -0
  66. package/templates/skills/application/references/test-coverage-requirements.md +213 -0
  67. package/templates/skills/application/references/test-frontend.md +3 -3
  68. package/templates/skills/application/steps/step-00-init.md +130 -260
  69. package/templates/skills/application/steps/step-01-navigation.md +170 -170
  70. package/templates/skills/application/steps/step-02-permissions.md +196 -196
  71. package/templates/skills/application/steps/step-03-roles.md +182 -339
  72. package/templates/skills/application/steps/step-03b-provider.md +133 -134
  73. package/templates/skills/application/steps/step-04-backend.md +174 -265
  74. package/templates/skills/application/steps/step-05-frontend.md +18 -144
  75. package/templates/skills/application/steps/step-06-migration.md +12 -60
  76. package/templates/skills/application/steps/step-07-tests.md +9 -76
  77. package/templates/skills/application/templates-backend.md +29 -27
  78. package/templates/skills/application/templates-frontend.md +49 -49
  79. package/templates/skills/application/templates-seed.md +57 -131
  80. package/templates/skills/business-analyse/SKILL.md +27 -30
  81. package/templates/skills/business-analyse/_architecture.md +6 -6
  82. package/templates/skills/business-analyse/_shared.md +60 -88
  83. package/templates/skills/business-analyse/questionnaire/04-data.md +3 -3
  84. package/templates/skills/business-analyse/questionnaire/06-security.md +1 -1
  85. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +1 -1
  86. package/templates/skills/business-analyse/react/application-viewer.md +12 -12
  87. package/templates/skills/business-analyse/react/components.md +8 -12
  88. package/templates/skills/business-analyse/react/schema.md +836 -836
  89. package/templates/skills/business-analyse/references/agent-module-prompt.md +2 -3
  90. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +190 -0
  91. package/templates/skills/business-analyse/references/cache-warming-strategy.md +2 -2
  92. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +41 -0
  93. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +74 -0
  94. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +69 -0
  95. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +1 -1
  96. package/templates/skills/business-analyse/references/compilation-structure-cards.md +297 -0
  97. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +2 -2
  98. package/templates/skills/business-analyse/references/deploy-modes.md +5 -5
  99. package/templates/skills/business-analyse/references/detection-strategies.md +7 -7
  100. package/templates/skills/business-analyse/references/handoff-file-templates.md +14 -22
  101. package/templates/skills/business-analyse/references/handoff-mappings.md +4 -4
  102. package/templates/skills/business-analyse/references/handoff-seeddata-generation.md +312 -0
  103. package/templates/skills/business-analyse/references/init-schema-deployment.md +3 -3
  104. package/templates/skills/business-analyse/references/naming-conventions.md +22 -24
  105. package/templates/skills/business-analyse/references/prd-generation.md +2 -2
  106. package/templates/skills/business-analyse/references/review-data-mapping.md +2 -2
  107. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  108. package/templates/skills/business-analyse/references/spec-auto-inference.md +3 -3
  109. package/templates/skills/business-analyse/references/team-orchestration.md +49 -6
  110. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  111. package/templates/skills/business-analyse/references/ui-resource-cards.md +18 -18
  112. package/templates/skills/business-analyse/references/validate-incremental-html.md +2 -2
  113. package/templates/skills/business-analyse/references/validation-checklist.md +2 -2
  114. package/templates/skills/business-analyse/schemas/application-schema.json +4 -5
  115. package/templates/skills/business-analyse/schemas/project-schema.json +1 -6
  116. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +2 -3
  117. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +4 -4
  118. package/templates/skills/business-analyse/steps/step-00-init.md +8 -17
  119. package/templates/skills/business-analyse/steps/step-01-cadrage.md +35 -198
  120. package/templates/skills/business-analyse/steps/step-01b-applications.md +16 -20
  121. package/templates/skills/business-analyse/steps/step-02-decomposition.md +1 -1
  122. package/templates/skills/business-analyse/steps/step-03a1-setup.md +4 -4
  123. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +1 -1
  124. package/templates/skills/business-analyse/steps/step-03b-ui.md +4 -4
  125. package/templates/skills/business-analyse/steps/step-03c-compile.md +66 -140
  126. package/templates/skills/business-analyse/steps/step-03d-validate.md +2 -2
  127. package/templates/skills/business-analyse/steps/step-04a-collect.md +2 -2
  128. package/templates/skills/business-analyse/steps/step-04b-analyze.md +42 -160
  129. package/templates/skills/business-analyse/steps/step-04c-decide.md +1 -1
  130. package/templates/skills/business-analyse/steps/step-05a-handoff.md +74 -104
  131. package/templates/skills/business-analyse/steps/step-05b-deploy.md +13 -11
  132. package/templates/skills/business-analyse/steps/step-06-review.md +3 -3
  133. package/templates/skills/business-analyse/templates/tpl-frd.md +13 -13
  134. package/templates/skills/business-analyse/templates/tpl-handoff.md +12 -12
  135. package/templates/skills/business-analyse/templates/tpl-progress.md +1 -1
  136. package/templates/skills/business-analyse/templates-frd.md +25 -25
  137. package/templates/skills/business-analyse/templates-react.md +15 -21
  138. package/templates/skills/controller/SKILL.md +1 -1
  139. package/templates/skills/controller/postman-templates.md +1 -1
  140. package/templates/skills/controller/references/controller-code-templates.md +2 -2
  141. package/templates/skills/controller/references/mcp-scaffold-workflow.md +209 -0
  142. package/templates/skills/controller/references/permission-sync-templates.md +13 -16
  143. package/templates/skills/controller/steps/step-00-init.md +11 -11
  144. package/templates/skills/controller/steps/step-03-generate.md +64 -103
  145. package/templates/skills/controller/templates.md +67 -71
  146. package/templates/skills/debug/SKILL.md +13 -218
  147. package/templates/skills/debug/steps/step-00-init.md +57 -0
  148. package/templates/skills/debug/steps/step-01-analyze.md +219 -0
  149. package/templates/skills/debug/steps/step-02-resolve.md +85 -0
  150. package/templates/skills/documentation/SKILL.md +49 -345
  151. package/templates/skills/documentation/data-schema.md +11 -8
  152. package/templates/skills/documentation/steps/step-00-init.md +70 -0
  153. package/templates/skills/documentation/steps/step-01-scan.md +113 -0
  154. package/templates/skills/documentation/steps/step-02-generate.md +231 -0
  155. package/templates/skills/documentation/steps/step-03-validate.md +238 -0
  156. package/templates/skills/documentation/templates.md +480 -322
  157. package/templates/skills/efcore/SKILL.md +1 -1
  158. package/templates/skills/efcore/references/both-contexts.md +32 -0
  159. package/templates/skills/efcore/references/database-operations.md +67 -0
  160. package/templates/skills/efcore/references/destructive-operations.md +38 -0
  161. package/templates/skills/efcore/references/reset-operations.md +81 -0
  162. package/templates/skills/efcore/references/seed-methods.md +86 -0
  163. package/templates/skills/efcore/references/shared-init-functions.md +250 -0
  164. package/templates/skills/efcore/references/sql-objects-injection.md +61 -0
  165. package/templates/skills/efcore/references/troubleshooting.md +81 -0
  166. package/templates/skills/efcore/steps/db/step-deploy.md +1 -32
  167. package/templates/skills/efcore/steps/db/step-reset.md +7 -103
  168. package/templates/skills/efcore/steps/db/step-seed.md +10 -132
  169. package/templates/skills/efcore/steps/db/step-status.md +5 -44
  170. package/templates/skills/efcore/steps/migration/step-02-create.md +1 -14
  171. package/templates/skills/efcore/steps/migration/step-03-validate.md +8 -62
  172. package/templates/skills/efcore/steps/rebase-snapshot/step-03-create.md +1 -57
  173. package/templates/skills/efcore/steps/shared/step-00-init.md +11 -254
  174. package/templates/skills/efcore/steps/squash/step-03-create.md +1 -58
  175. package/templates/skills/feature-full/SKILL.md +1 -1
  176. package/templates/skills/feature-full/steps/step-00-init.md +57 -0
  177. package/templates/skills/feature-full/steps/step-01-implementation.md +1 -1
  178. package/templates/skills/gitflow/SKILL.md +28 -5
  179. package/templates/skills/gitflow/_shared.md +109 -12
  180. package/templates/skills/gitflow/phases/abort.md +4 -0
  181. package/templates/skills/gitflow/phases/cleanup.md +4 -0
  182. package/templates/skills/gitflow/references/commit-message-generation.md +58 -0
  183. package/templates/skills/gitflow/references/commit-migration-validation.md +49 -0
  184. package/templates/skills/gitflow/references/finish-cleanup.md +55 -0
  185. package/templates/skills/gitflow/references/finish-version-bumping.md +45 -0
  186. package/templates/skills/gitflow/references/init-environment-detection.md +41 -0
  187. package/templates/skills/gitflow/references/init-questions.md +185 -0
  188. package/templates/skills/gitflow/references/init-structure-creation.md +75 -0
  189. package/templates/skills/gitflow/references/init-version-detection.md +21 -0
  190. package/templates/skills/gitflow/references/init-workspace-detection.md +43 -0
  191. package/templates/skills/gitflow/references/merge-ci-status.md +36 -0
  192. package/templates/skills/gitflow/references/merge-execution.md +62 -0
  193. package/templates/skills/gitflow/references/merge-pr-context.md +76 -0
  194. package/templates/skills/gitflow/references/pr-build-checks.md +60 -0
  195. package/templates/skills/gitflow/references/pr-generation.md +58 -0
  196. package/templates/skills/gitflow/references/start-branch-normalization.md +28 -0
  197. package/templates/skills/gitflow/references/start-worktree-creation.md +50 -0
  198. package/templates/skills/gitflow/references/sync-push-verify.md +44 -0
  199. package/templates/skills/gitflow/references/sync-rebase-conflicts.md +38 -0
  200. package/templates/skills/gitflow/steps/step-commit.md +12 -91
  201. package/templates/skills/gitflow/steps/step-finish.md +15 -159
  202. package/templates/skills/gitflow/steps/step-init.md +24 -326
  203. package/templates/skills/gitflow/steps/step-merge.md +17 -176
  204. package/templates/skills/gitflow/steps/step-pr.md +10 -116
  205. package/templates/skills/gitflow/steps/step-start.md +16 -109
  206. package/templates/skills/gitflow/steps/step-sync.md +6 -69
  207. package/templates/skills/ralph-loop/SKILL.md +6 -0
  208. package/templates/skills/ralph-loop/references/category-completeness.md +185 -0
  209. package/templates/skills/ralph-loop/references/compact-loop.md +1 -1
  210. package/templates/skills/ralph-loop/references/init-resume-recovery.md +127 -0
  211. package/templates/skills/ralph-loop/references/module-transition.md +151 -0
  212. package/templates/skills/ralph-loop/references/multi-module-queue.md +171 -0
  213. package/templates/skills/ralph-loop/references/parallel-execution.md +246 -0
  214. package/templates/skills/ralph-loop/references/task-transform-legacy.md +6 -9
  215. package/templates/skills/ralph-loop/references/team-orchestration.md +45 -3
  216. package/templates/skills/ralph-loop/steps/step-00-init.md +36 -109
  217. package/templates/skills/ralph-loop/steps/step-01-task.md +15 -163
  218. package/templates/skills/ralph-loop/steps/step-02-execute.md +8 -154
  219. package/templates/skills/ralph-loop/steps/step-04-check.md +20 -73
  220. package/templates/skills/review-code/references/owasp-api-top10.md +5 -5
  221. package/templates/skills/review-code/references/smartstack-conventions.md +568 -568
  222. package/templates/skills/validate-feature/references/api-smoke-tests.md +140 -0
  223. package/templates/skills/validate-feature/references/db-validation-checks.md +180 -0
  224. package/templates/skills/validate-feature/steps/step-01-compile.md +1 -3
  225. package/templates/skills/validate-feature/steps/step-04-api-smoke.md +34 -145
  226. package/templates/skills/validate-feature/steps/step-05-db-validation.md +74 -260
  227. package/templates/skills/workflow/SKILL.md +1 -1
  228. package/templates/skills/workflow/steps/step-00-init.md +57 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "3.37.0",
3
+ "version": "3.39.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -21,7 +21,7 @@ interface DocApiEndpoint {
21
21
 
22
22
  interface PermissionConstant {
23
23
  constantPath: string; // e.g., "Permissions.Admin.Users.View"
24
- value: string; // e.g., "platform.administration.users.read"
24
+ value: string; // e.g., "administration.users.read"
25
25
  }
26
26
 
27
27
  /**
@@ -61,7 +61,7 @@ async function findControllerFile(appPath: string, module: string): Promise<stri
61
61
 
62
62
  /**
63
63
  * Extract NavRoute attribute value
64
- * Example: [NavRoute("platform.administration.users")] → "platform.administration.users"
64
+ * Example: [NavRoute("administration.users")] → "administration.users"
65
65
  */
66
66
  function extractNavRoute(content: string): string | null {
67
67
  const navRouteRegex = /\[NavRoute\("([^"]+)"\)\]/;
@@ -146,7 +146,7 @@ async function loadPermissionConstants(appPath: string): Promise<Map<string, str
146
146
  const map = new Map<string, string>();
147
147
 
148
148
  // Parse permission constant definitions
149
- // Example: public const string View = "platform.administration.users.read";
149
+ // Example: public const string View = "administration.users.read";
150
150
  const lines = content.split('\n');
151
151
  let currentNamespace = '';
152
152
 
@@ -194,7 +194,7 @@ function resolvePermission(
194
194
  }
195
195
 
196
196
  // Fallback: infer from constant name
197
- // Permissions.Admin.Users.View → platform.administration.users.read
197
+ // Permissions.Admin.Users.View → administration.users.read
198
198
  const parts = constantPath.split('.');
199
199
  if (parts.length >= 3) {
200
200
  const action = parts[parts.length - 1].toLowerCase();
@@ -236,7 +236,7 @@ async function extractEndpoints(
236
236
  }
237
237
 
238
238
  // Build base API path from navRoute
239
- // "platform.administration.users" → "/api/platform/administration/users"
239
+ // "administration.users" → "/api/administration/users"
240
240
  const basePath = `/api/${navRoute.replace(/\./g, '/')}`;
241
241
 
242
242
  // Parse line by line to find endpoint methods
@@ -8,7 +8,6 @@
8
8
  * Usage:
9
9
  * node generate-doc-with-mock-ui.ts \
10
10
  * --module users \
11
- * --context platform \
12
11
  * --application administration \
13
12
  * --app-path "D:/01 - projets/SmartStack.app/02-Develop"
14
13
  *
@@ -22,7 +21,6 @@ import { execSync } from 'child_process';
22
21
 
23
22
  interface ModuleInfo {
24
23
  module: string; // e.g., "users"
25
- context: string; // e.g., "platform"
26
24
  application: string; // e.g., "administration"
27
25
  appPath: string;
28
26
  }
@@ -59,16 +57,15 @@ function parseArgs(): ModuleInfo {
59
57
  };
60
58
 
61
59
  const module = getArg('--module');
62
- const context = getArg('--context');
63
60
  const application = getArg('--application');
64
61
  const appPath = getArg('--app-path');
65
62
 
66
- if (!module || !context || !application || !appPath) {
67
- console.error('Usage: node generate-doc-with-mock-ui.ts --module <name> --context <ctx> --application <app> --app-path <path>');
63
+ if (!module || !application || !appPath) {
64
+ console.error('Usage: node generate-doc-with-mock-ui.ts --module <name> --application <app> --app-path <path>');
68
65
  process.exit(1);
69
66
  }
70
67
 
71
- return { module, context, application, appPath };
68
+ return { module, application, appPath };
72
69
  }
73
70
 
74
71
  /**
@@ -102,8 +99,8 @@ async function findEntityFile(appPath: string, module: string): Promise<string |
102
99
  /**
103
100
  * Find React page file
104
101
  */
105
- async function findPageFile(appPath: string, module: string, context: string, application: string): Promise<string | null> {
106
- const pagesPath = path.join(appPath, `web/smartstack-web/src/pages/${context}/${application}/${module}`);
102
+ async function findPageFile(appPath: string, module: string, application: string): Promise<string | null> {
103
+ const pagesPath = path.join(appPath, `web/smartstack-web/src/pages/${application}/${module}`);
107
104
  const pattern = `${capitalize(module)}Page.tsx`;
108
105
 
109
106
  const fullPath = path.join(pagesPath, pattern);
@@ -523,7 +520,7 @@ function generateDocumentationTSX(
523
520
  businessRules: any[],
524
521
  pageStructure: PageStructure
525
522
  ): string {
526
- const { module, context, application } = moduleInfo;
523
+ const { module, application } = moduleInfo;
527
524
  const ModuleName = capitalize(module);
528
525
 
529
526
  // Generate mock data
@@ -575,8 +572,6 @@ export function ${ModuleName}DocPage() {
575
572
  <span>/</span>
576
573
  <Link to="/system/docs/user" className="hover:text-[var(--color-primary-600)]">User</Link>
577
574
  <span>/</span>
578
- <Link to="/system/docs/user/${context}" className="hover:text-[var(--color-primary-600)]">${capitalize(context)}</Link>
579
- <span>/</span>
580
575
  <span>${ModuleName}</span>
581
576
  </div>
582
577
 
@@ -612,8 +607,6 @@ export function ${ModuleName}DocPage() {
612
607
  <div className="mb-4">
613
608
  <div className="text-sm font-medium mb-2">Navigation</div>
614
609
  <div className="flex items-center gap-2 text-sm bg-[var(--bg-secondary)] p-3 rounded-lg">
615
- <span className="px-2 py-1 bg-[var(--bg-primary)] rounded">${capitalize(context)}</span>
616
- <ArrowRight className="w-4 h-4 text-[var(--text-tertiary)]" />
617
610
  <span className="px-2 py-1 bg-[var(--bg-primary)] rounded">${capitalize(application)}</span>
618
611
  <ArrowRight className="w-4 h-4 text-[var(--text-tertiary)]" />
619
612
  <span className="px-2 py-1 bg-[var(--color-primary-600)] text-white rounded">${ModuleName}</span>
@@ -623,7 +616,7 @@ export function ${ModuleName}DocPage() {
623
616
  <div className="mb-4">
624
617
  <div className="text-sm font-medium mb-2">URL</div>
625
618
  <code className="block p-3 bg-[var(--bg-secondary)] rounded-lg text-sm font-mono">
626
- /${context}/${application}/${module}
619
+ /${application}/${module}
627
620
  </code>
628
621
  </div>
629
622
  </section>
@@ -732,9 +725,9 @@ function singularize(str: string): string {
732
725
  */
733
726
  async function main() {
734
727
  const moduleInfo = parseArgs();
735
- const { module, context, application, appPath } = moduleInfo;
728
+ const { module, application, appPath } = moduleInfo;
736
729
 
737
- console.error(`\n🚀 Generating documentation for: ${context}/${application}/${module}\n`);
730
+ console.error(`\n🚀 Generating documentation for: ${application}/${module}\n`);
738
731
 
739
732
  // 1. Find entity file
740
733
  console.error('📁 Finding entity file...');
@@ -752,7 +745,7 @@ async function main() {
752
745
 
753
746
  // 3. Find page file
754
747
  console.error('\n📄 Finding React page...');
755
- const pagePath = await findPageFile(appPath, module, context, application);
748
+ const pagePath = await findPageFile(appPath, module, application);
756
749
  if (pagePath) {
757
750
  console.error(`✅ Found: ${pagePath}`);
758
751
  } else {
@@ -123,13 +123,13 @@ Get a compact summary of all completed (specified) modules, for use as context w
123
123
  ### Customers (FEAT-011)
124
124
  Entities: Customer, Address, Contact
125
125
  BRs: BR-VAL-001 (email unique), BR-WF-001 (activation flow)
126
- Permissions: business.sales.customers.{read|create|update|delete}
126
+ Permissions: sales.customers.{read|create|update|delete}
127
127
  FKs exposed: Customer.Id, Address.Id
128
128
 
129
129
  ### Products (FEAT-012)
130
130
  Entities: Product, Category, PriceHistory
131
131
  BRs: BR-VAL-002 (SKU format), BR-CALC-001 (price calculation)
132
- Permissions: business.sales.products.{read|create|update}
132
+ Permissions: sales.products.{read|create|update}
133
133
  FKs exposed: Product.Id, Category.Id
134
134
  ```
135
135
 
@@ -289,11 +289,11 @@ Generate compact context for use by other skills and agents.
289
289
  - Interaction
290
290
 
291
291
  ## Permissions (5)
292
- - business.crm.contacts.create
293
- - business.crm.contacts.read
294
- - business.crm.contacts.update
295
- - business.crm.contacts.delete
296
- - business.crm.contacts.export
292
+ - crm.contacts.create
293
+ - crm.contacts.read
294
+ - crm.contacts.update
295
+ - crm.contacts.delete
296
+ - crm.contacts.export
297
297
 
298
298
  ## Business Rules (4)
299
299
  - BR-VAL-001: Email must be unique
@@ -340,7 +340,7 @@ When encountering ID references, resolve them:
340
340
  **Format resolved references as inline citations:**
341
341
  - "UC-001 (Create new contact)"
342
342
  - "[BR-SEC-015: Sensitive data encryption required]"
343
- - "business.crm.contacts.create (used in UC-001, UC-003)"
343
+ - "crm.contacts.create (used in UC-001, UC-003)"
344
344
 
345
345
  ## Error Handling
346
346
 
@@ -366,7 +366,7 @@ This agent provides context for:
366
366
  ```
367
367
  User: "What permissions does FEAT-042 need?"
368
368
  → Operation: answerQuestion(FEAT-042, "What permissions does this feature need?")
369
- → Output: List of business.crm.contacts.* permissions with use case mapping
369
+ → Output: List of crm.contacts.* permissions with use case mapping
370
370
 
371
371
  User: "Find all features that use the Contact entity"
372
372
  → Operation: searchAcrossFeatures("Contact")
@@ -14,8 +14,8 @@ Write and update feature.json files for project-level (multi-app), application-l
14
14
 
15
15
  **Directory structure (3-tier hierarchy):**
16
16
  - Project-level (multi-app only): `docs/business-analyse/v{X.Y}/feature.json`
17
- - Application-level: `docs/{context}/{app}/business-analyse/v{X.Y}/feature.json`
18
- - Module-level: `docs/{context}/{app}/{module}/business-analyse/v{X.Y}/feature.json`
17
+ - Application-level: `docs/{app}/business-analyse/v{X.Y}/feature.json`
18
+ - Module-level: `docs/{app}/{module}/business-analyse/v{X.Y}/feature.json`
19
19
 
20
20
  > **Backward compatibility:** If only 1 application, the project level is NOT created. The application-level feature.json remains the master.
21
21
 
@@ -29,7 +29,6 @@ Create an initial feature.json with metadata and draft status.
29
29
  - scope: "project", "application", or "module" (default: "module")
30
30
  - Optional: applicationRef (FEAT-NNN of master, required when scope = "module" in app mode)
31
31
  - Optional: projectRef (PROJ-NNN of project master, required when scope = "application" in project mode)
32
- - Optional: context (default: "business", allows "platform" or "personal" in project mode)
33
32
  - Optional: initialSections for pre-populated content
34
33
 
35
34
  **Process:**
@@ -37,8 +36,8 @@ Create an initial feature.json with metadata and draft status.
37
36
  2. Increment FEAT-NNN (or PROJ-NNN) identifier
38
37
  3. Create directory structure based on scope:
39
38
  - If scope = "project": `docs/business-analyse/v1.0/`
40
- - If scope = "application": `docs/{context}/{app}/business-analyse/v1.0/`
41
- - If scope = "module": `docs/{context}/{app}/{module}/business-analyse/v1.0/`
39
+ - If scope = "application": `docs/{app}/business-analyse/v1.0/`
40
+ - If scope = "module": `docs/{app}/{module}/business-analyse/v1.0/`
42
41
  4. Generate initial feature.json with:
43
42
  - **`$schema`**: relative path to the deployed schema file (MANDATORY — see $schema rules below)
44
43
  - id: FEAT-NNN (from config)
@@ -104,7 +103,7 @@ Update the applications array and dependency graph in a project-level feature.js
104
103
 
105
104
  **Input:**
106
105
  - projectId: PROJ-NNN of the project feature.json
107
- - applications: array of application objects (code, name, context, tablePrefix, icon, description, applicationRoles[], scope, dependencies[], estimatedComplexity)
106
+ - applications: array of application objects (code, name, tablePrefix, icon, description, applicationRoles[], scope, dependencies[], estimatedComplexity)
108
107
  - applicationDependencyGraph: object with edges[], topologicalOrder[], layers[]
109
108
 
110
109
  **Process:**
@@ -432,7 +431,7 @@ Perform these structural checks before every write:
432
431
  - BR IDs: must match `BR-(VAL|CALC|WF|SEC|DATA)-[A-Z]{2,4}-\d{3}` (e.g., BR-SEC-RM-042) — module prefix MANDATORY in multi-module mode
433
432
  - UC IDs: must match `UC-[A-Z]{2,4}-\d{3}` (e.g., UC-RM-007) — module prefix MANDATORY in multi-module mode
434
433
  - FR IDs: must match `FR-[A-Z]{2,4}-\d{3}` (e.g., FR-RM-012) — module prefix MANDATORY in multi-module mode
435
- - Permission paths: must match `business\.{app}\.{module}\.{resource}\.{action}` (e.g., business.crm.contacts.read)
434
+ - Permission paths: must match `{app}\.{module}\.{resource}\.{action}` (e.g., crm.contacts.read)
436
435
 
437
436
  **Metadata:**
438
437
  - id, version, status, scope are required
@@ -442,7 +441,7 @@ Perform these structural checks before every write:
442
441
 
443
442
  **Cross-references:**
444
443
  - All BR-XXX, UC-XXX, FR-XXX referenced must be defined in their respective sections
445
- - Permission paths must use full format with 5 segments: `business.{app}.{module}.{resource}.{action}`
444
+ - Permission paths must use full format with 4 segments: `{app}.{module}.{resource}.{action}`
446
445
 
447
446
  **Application-scope specific:**
448
447
  - `modules[]` must exist and be non-empty after decomposition
@@ -593,19 +592,17 @@ docs/business-analyse/
593
592
  v1.0/
594
593
  feature.json ← PROJECT (multi-app master, only if 2+ apps)
595
594
 
596
- docs/{context}/{app}/business-analyse/
595
+ docs/{app}/business-analyse/
597
596
  v1.0/
598
597
  feature.json ← APPLICATION (master)
599
598
 
600
- docs/{context}/{app}/{module}/business-analyse/
599
+ docs/{app}/{module}/business-analyse/
601
600
  v1.0/
602
601
  feature.json ← MODULE (detailed)
603
602
  v1.1/
604
603
  feature.json
605
604
  ```
606
605
 
607
- > **{context}** = "business" (default) | "platform" | "personal" — determined per application in project mode.
608
-
609
606
  Versions are stored as separate files in versioned directories. Always store feature.json at the root of each version folder.
610
607
 
611
608
  ## Config Management
@@ -762,15 +759,15 @@ If a module feature.json exceeds 500KB despite incremental operations:
762
759
  ## $schema Reference Rules (MANDATORY)
763
760
 
764
761
  > **Every feature.json MUST include a `$schema` field** pointing to the deployed schema file via relative path.
765
- > Schemas are deployed by step-00-init to: `docs/business/{app}/business-analyse/schemas/`
762
+ > Schemas are deployed by step-00-init to: `docs/{app}/business-analyse/schemas/`
766
763
 
767
764
  **$schema paths by scope:**
768
765
 
769
766
  | Scope | Feature.json location | $schema value |
770
767
  |-------|----------------------|---------------|
771
768
  | project | `docs/business-analyse/v1.0/feature.json` | `"../schemas/project-schema.json"` |
772
- | application | `docs/{context}/{app}/business-analyse/v1.0/feature.json` | `"../schemas/application-schema.json"` |
773
- | module | `docs/{context}/{app}/{module}/business-analyse/v1.0/feature.json` | `"../../../business-analyse/schemas/feature-schema.json"` |
769
+ | application | `docs/{app}/business-analyse/v1.0/feature.json` | `"../schemas/application-schema.json"` |
770
+ | module | `docs/{app}/{module}/business-analyse/v1.0/feature.json` | `"../../../business-analyse/schemas/feature-schema.json"` |
774
771
 
775
772
  **Rules:**
776
773
  - `$schema` is ALWAYS the FIRST field in feature.json (before `id`)
@@ -2,7 +2,7 @@
2
2
  name: code-reviewer
3
3
  description: Expert code reviewer for PR analysis. Use when reviewing code changes for security, logic, clean code, or feature-specific behavior. Accepts focus area and file list. Returns structured findings table.
4
4
  tools: Read, Grep, Glob, Skill
5
- model: haiku
5
+ model: sonnet
6
6
  ---
7
7
 
8
8
  <role>
@@ -66,7 +66,7 @@ For each module found, extract:
66
66
  - Feature status (draft/analysed/specified/approved/handed-off)
67
67
  - Use Case IDs (UC-001, UC-002...)
68
68
  - Business Rule IDs (BR-001, BR-002...)
69
- - Permission paths (business.app.module.action)
69
+ - Permission paths (app.module.action)
70
70
  - Last update dates (from metadata.updatedAt)
71
71
  - Validation decision (APPROVED/REJECTED/pending)
72
72
  - Version (from folder name v1.0, v1.1, etc.)
@@ -45,7 +45,9 @@ FOR each branch in active_worktrees:
45
45
  ## Fallback Commands (if MCP unavailable)
46
46
 
47
47
  ```bash
48
- # List worktrees
48
+ # List worktrees (run preflight_git_check first for cross-platform compatibility)
49
+ detect_platform
50
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
49
51
  git worktree list
50
52
 
51
53
  # ModelSnapshot hash
@@ -14,6 +14,80 @@ Commit with EF Core migration validation. Executes directly, displays only the r
14
14
 
15
15
  ## EXECUTION SEQUENCE
16
16
 
17
+ ### 0. Pre-flight: Worktree Accessibility
18
+
19
+ ```bash
20
+ # Quick check: can git resolve the repo?
21
+ git rev-parse --git-dir >/dev/null 2>&1
22
+ if [ $? -ne 0 ]; then
23
+ # Worktree .git file likely has cross-platform absolute path
24
+ # Find .bare directory by walking up
25
+ BARE_DIR=""
26
+ DIR="$(pwd)"
27
+ while [ "$DIR" != "/" ]; do
28
+ [ -d "$DIR/.bare" ] && { BARE_DIR="$DIR/.bare"; break; }
29
+ DIR=$(dirname "$DIR")
30
+ done
31
+
32
+ if [ -n "$BARE_DIR" ] && [ -f .git ]; then
33
+ echo "Repairing worktree paths (cross-platform fix)..."
34
+
35
+ # Detect platform
36
+ GF_PLATFORM="linux"
37
+ [ -f /proc/version ] && grep -qi "microsoft\|wsl" /proc/version 2>/dev/null && GF_PLATFORM="wsl"
38
+
39
+ # Repair all worktrees: convert absolute paths to relative paths
40
+ WORKTREES_DIR="$BARE_DIR/worktrees"
41
+ for wt_dir in "$WORKTREES_DIR"/*/; do
42
+ [ ! -d "$wt_dir" ] && continue
43
+ wt_name=$(basename "$wt_dir")
44
+ gitdir_file="$wt_dir/gitdir"
45
+ [ ! -f "$gitdir_file" ] && continue
46
+
47
+ stored_path=$(cat "$gitdir_file" | tr -d '\n\r')
48
+
49
+ # Determine if path is absolute and resolve to current platform
50
+ resolved_path="$stored_path"
51
+ is_abs=false
52
+ if [[ "$stored_path" =~ ^[A-Za-z]:[\\/] ]]; then
53
+ is_abs=true
54
+ if [ "$GF_PLATFORM" = "wsl" ]; then
55
+ drive=$(echo "${stored_path:0:1}" | tr '[:upper:]' '[:lower:]')
56
+ rest="${stored_path:2}"; rest="${rest//\\//}"
57
+ resolved_path="/mnt/$drive$rest"
58
+ fi
59
+ elif [[ "$stored_path" =~ ^/ ]]; then
60
+ is_abs=true
61
+ fi
62
+ [ "$is_abs" = "false" ] && continue # Already relative, skip
63
+
64
+ wt_real_dir=$(dirname "$resolved_path")
65
+ [ ! -d "$wt_real_dir" ] && continue
66
+
67
+ bare_wt_abs=$(realpath -m "$wt_dir")
68
+ wt_abs=$(realpath -m "$wt_real_dir")
69
+
70
+ # Fix gitdir backlink to relative
71
+ rel_gitdir=$(realpath -m --relative-to="$bare_wt_abs" "$wt_abs/.git")
72
+ [ "$stored_path" != "$rel_gitdir" ] && printf '%s\n' "$rel_gitdir" > "$gitdir_file"
73
+
74
+ # Fix worktree .git pseudo-file to relative
75
+ if [ -f "$wt_real_dir/.git" ]; then
76
+ git_content=$(cat "$wt_real_dir/.git" | tr -d '\n\r')
77
+ git_path="${git_content#gitdir: }"
78
+ rel_bare=$(realpath -m --relative-to="$wt_abs" "$bare_wt_abs")
79
+ [ "$git_path" != "$rel_bare" ] && printf 'gitdir: %s\n' "$rel_bare" > "$wt_real_dir/.git"
80
+ fi
81
+ done
82
+
83
+ # Verify repair
84
+ git rev-parse --git-dir >/dev/null 2>&1 && echo "Worktree paths repaired successfully" || { echo "BLOCKED: worktree repair failed"; exit 1; }
85
+ else
86
+ echo "BLOCKED: not a git repository and no .bare found"; exit 1
87
+ fi
88
+ fi
89
+ ```
90
+
17
91
  ### 1. Guards
18
92
 
19
93
  ```bash
@@ -31,8 +31,11 @@ fi
31
31
  BRANCH=${1:-$(git rev-parse --abbrev-ref HEAD)}
32
32
  BRANCH_TYPE=$(echo $BRANCH | cut -d'/' -f1)
33
33
 
34
- # Worktree detection: if in a worktree, navigate to main repo
35
- # Normalize path for cross-platform compatibility (WSL ↔ Windows)
34
+ # Worktree detection: repair cross-platform paths first (WSL Windows)
35
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
36
+ detect_platform
37
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
38
+
36
39
  WORKTREE_PATH=$(git worktree list --porcelain | grep -B2 "branch refs/heads/$BRANCH" | grep "^worktree " | sed 's/^worktree //')
37
40
  WORKTREE_PATH=$(normalize_path_for_platform "$WORKTREE_PATH")
38
41
  ```
@@ -96,7 +96,7 @@ if [ ! -d "$PROJECT_BASE/develop" ]; then
96
96
  fi
97
97
  ```
98
98
 
99
- ### 5b. Fix Cross-Platform Worktree Paths
99
+ ### 5b. Convert Worktree Paths to Relative (Cross-Platform)
100
100
 
101
101
  ```bash
102
102
  PROJECT_BASE="{PROJECT_BASE}"
@@ -104,8 +104,8 @@ PROJECT_BASE="{PROJECT_BASE}"
104
104
  # Detect current platform (needed for path normalization)
105
105
  detect_platform
106
106
 
107
- # Repair any cross-platform paths written by git worktree add
108
- # (e.g., WSL paths /mnt/d/... when running on Windows, or vice versa)
107
+ # Convert absolute paths written by git worktree add to relative paths
108
+ # Relative paths work on both Windows and WSL without needing repair when switching
109
109
  repair_worktree_paths "$PROJECT_BASE/.bare"
110
110
  ```
111
111
 
@@ -136,7 +136,8 @@ done
136
136
 
137
137
  ### 2b. Worktree Path Integrity (Cross-Platform)
138
138
 
139
- Repair worktree metadata files that contain paths from a different platform (e.g., WSL paths `/mnt/d/...` on Windows or Windows paths `D:/...` on WSL).
139
+ Convert worktree metadata paths to relative format for cross-platform compatibility.
140
+ Relative paths work on both Windows (VS Code) and WSL without needing repair when switching.
140
141
 
141
142
  ```bash
142
143
  PROJECT_BASE="{PROJECT_BASE}"
@@ -144,7 +145,7 @@ PROJECT_BASE="{PROJECT_BASE}"
144
145
  # Source platform detection and path functions from _shared.md
145
146
  detect_platform
146
147
 
147
- # Repair cross-platform paths in .bare/worktrees/*/gitdir and worktree/.git files
148
+ # Convert absolute paths to relative in .bare/worktrees/*/gitdir and worktree/.git files
148
149
  repair_worktree_paths "$PROJECT_BASE/.bare"
149
150
  ```
150
151
 
@@ -19,15 +19,16 @@ Safe PR merge with review checklist. Supports GitHub and Azure DevOps.
19
19
  CONFIG_FILE=""
20
20
  if [ -f ".claude/gitflow/config.json" ]; then
21
21
  CONFIG_FILE=".claude/gitflow/config.json"
22
- elif [ -f ".gitflow/config.json" ]; then
23
- CONFIG_FILE=".gitflow/config.json"
24
22
  else
23
+ # Repair cross-platform worktree paths before listing (WSL ↔ Windows)
24
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
25
+ detect_platform
26
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
27
+
25
28
  # Try develop worktree
26
29
  DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
27
30
  if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
28
31
  CONFIG_FILE="$DEVELOP_PATH/.claude/gitflow/config.json"
29
- elif [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.gitflow/config.json" ]; then
30
- CONFIG_FILE="$DEVELOP_PATH/.gitflow/config.json"
31
32
  fi
32
33
  fi
33
34
 
@@ -21,15 +21,16 @@ Create PR with auto-generated description, Azure DevOps and GitHub support.
21
21
  CONFIG_FILE=""
22
22
  if [ -f ".claude/gitflow/config.json" ]; then
23
23
  CONFIG_FILE=".claude/gitflow/config.json"
24
- elif [ -f ".gitflow/config.json" ]; then
25
- CONFIG_FILE=".gitflow/config.json"
26
24
  else
25
+ # Repair cross-platform worktree paths before listing (WSL ↔ Windows)
26
+ # Source: _shared.md DETECT_PLATFORM + REPAIR_WORKTREE_PATHS
27
+ detect_platform
28
+ repair_worktree_paths "$(git rev-parse --git-common-dir 2>/dev/null || echo '.bare')"
29
+
27
30
  # Try develop worktree
28
31
  DEVELOP_PATH=$(git worktree list --porcelain 2>/dev/null | grep -A1 "branch refs/heads/develop" | grep "^worktree " | sed 's/^worktree //')
29
32
  if [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.claude/gitflow/config.json" ]; then
30
33
  CONFIG_FILE="$DEVELOP_PATH/.claude/gitflow/config.json"
31
- elif [ -n "$DEVELOP_PATH" ] && [ -f "$DEVELOP_PATH/.gitflow/config.json" ]; then
32
- CONFIG_FILE="$DEVELOP_PATH/.gitflow/config.json"
33
34
  fi
34
35
  fi
35
36
 
@@ -45,13 +45,45 @@ FULL_BRANCH="${type}/${BRANCH_NAME}"
45
45
 
46
46
  ### 4. Create Branch + Worktree
47
47
 
48
- ```bash
49
- # Worktree paths from config or convention:
50
- # feature ../features/{name}
51
- # release ../releases/v{version}
52
- # hotfix ../hotfixes/{name}
48
+ > **FORBIDDEN — Numbered directories:**
49
+ > - `03-Release`, `04-Feature`, `05-Hotfix` NEVER create these
50
+ > - Only `01-Main` and `02-Develop` are numbered (permanent worktrees created at init)
51
+ > - Features go in `{root}/features/{name}`, releases in `{root}/releases/v{version}`, hotfixes in `{root}/hotfixes/{name}`
52
+ > - The path MUST come from `config.json worktrees.structure.{features|releases|hotfixes}`
53
53
 
54
+ ```bash
55
+ # 1. Read config (MANDATORY — paths come from here, NEVER improvised)
56
+ read_gitflow_config || { echo "ERROR: No config. Run /gitflow init"; exit 1; }
57
+
58
+ # 2. Resolve path from CONFIG (NEVER improvise numbered directories)
59
+ case "$branch_type" in
60
+ feature) WORKTREE_PATH="$GF_FEATURES_PATH/$BRANCH_NAME" ;;
61
+ release) WORKTREE_PATH="$GF_RELEASES_PATH/v$VERSION" ;;
62
+ hotfix) WORKTREE_PATH="$GF_HOTFIXES_PATH/$BRANCH_NAME" ;;
63
+ esac
64
+
65
+ # 3. Create worktree
66
+ mkdir -p "$(dirname "$WORKTREE_PATH")"
54
67
  git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
68
+
69
+ # 4. POST-CREATION: Repair worktree paths FIRST, then validate
70
+ # Uses repair_worktree_paths from _shared.md REPAIR_WORKTREE_PATHS section
71
+ BARE_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
72
+ [ -n "$BARE_DIR" ] && repair_worktree_paths "$BARE_DIR"
73
+
74
+ CREATED_PATH=$(git worktree list | grep "$FULL_BRANCH" | awk '{print $1}')
75
+ BASENAME=$(basename "$CREATED_PATH")
76
+ if [[ "$BASENAME" =~ ^[0-9]{2}- ]] && [[ "$BASENAME" != "01-Main" ]] && [[ "$BASENAME" != "02-Develop" ]]; then
77
+ echo "BLOCKING ERROR: Worktree created with numbered prefix: $CREATED_PATH"
78
+ echo "Expected path: $WORKTREE_PATH"
79
+ git worktree remove "$CREATED_PATH" --force
80
+ git branch -D "$FULL_BRANCH" 2>/dev/null
81
+ echo "Removed invalid worktree. Recreating at correct path..."
82
+ git worktree add -b "$FULL_BRANCH" "$WORKTREE_PATH" "origin/$BASE_BRANCH"
83
+ # Repair again after recreation
84
+ BARE_DIR=$(git rev-parse --git-common-dir 2>/dev/null)
85
+ [ -n "$BARE_DIR" ] && repair_worktree_paths "$BARE_DIR"
86
+ fi
55
87
  ```
56
88
 
57
89
  ### 5. Push Branch to Remote (AUTOMATIC)
@@ -29,6 +29,17 @@
29
29
  ]
30
30
  }
31
31
  ],
32
+ "PostToolUse": [
33
+ {
34
+ "matcher": "Bash",
35
+ "hooks": [
36
+ {
37
+ "type": "command",
38
+ "command": "${CLAUDE_HOOKS_DIR}/wsl-dotnet-cleanup.sh"
39
+ }
40
+ ]
41
+ }
42
+ ],
32
43
  "Stop": [
33
44
  {
34
45
  "hooks": [
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ # WSL Dotnet Cleanup - PostToolUse Hook
4
+ # Removes literal "bin\Debug" folders created by Roslyn BuildHost on WSL
5
+ # Roslyn uses Windows path separators, creating "bin\Debug" as a single folder name
6
+ # instead of the proper bin/Debug/ directory structure.
7
+
8
+ set -euo pipefail
9
+
10
+ HOOK_INPUT=$(cat)
11
+
12
+ # Quick exit: only care about Bash tool calls containing "dotnet" (~1ms)
13
+ case "$HOOK_INPUT" in
14
+ *dotnet*) ;; # proceed to cleanup
15
+ *) exit 0 ;; # fast exit
16
+ esac
17
+
18
+ # Find and remove corrupted bin\Debug folders (literal backslash in name)
19
+ # bin?Debug matches "bin\Debug" where ? is the literal backslash character
20
+ for d in src/*/bin?Debug bin?Debug; do
21
+ [ -d "$d" ] && rm -rf "$d"
22
+ done
23
+
24
+ exit 0