@azure-net/cli 5.0.0-1 → 5.0.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 (71) hide show
  1. package/bin/azure-net.js +12 -45
  2. package/bin/azure-net.ts +13 -5
  3. package/package.json +1 -1
  4. package/src/checks/checkDomain.js +8 -38
  5. package/src/checks/checkFoldersStructure.js +0 -14
  6. package/src/checks/checkHooks.js +0 -5
  7. package/src/checks/checkImports.js +0 -1
  8. package/src/checks/checkInternal.js +2 -1
  9. package/src/checks/checkInternal.ts +2 -0
  10. package/src/checks/checkLayerBoundaries.js +50 -54
  11. package/src/checks/checkLayerBoundaries.ts +55 -58
  12. package/src/checks/checkLayerImports.js +136 -0
  13. package/src/checks/checkLayerImports.ts +185 -0
  14. package/src/checks/checkPresenterNames.js +1 -37
  15. package/src/checks/checkPresenterNames.ts +1 -6
  16. package/src/checks/checkProject.js +0 -6
  17. package/src/checks/checkProviderGraph.js +1 -38
  18. package/src/checks/checkProviderNames.js +0 -28
  19. package/src/checks/index.js +1 -1
  20. package/src/checks/index.ts +1 -0
  21. package/src/generate/layers/generateRepository.js +4 -19
  22. package/src/generate/layers/generateRepositoryMethod.js +0 -12
  23. package/src/generate/layers/generateUseCases.js +0 -6
  24. package/src/generate/layers/repositoryShared.js +41 -104
  25. package/src/generate/layers/repositoryShared.ts +17 -12
  26. package/src/generate/module/generateDomain.js +0 -25
  27. package/src/generate/module/generateModule.js +0 -10
  28. package/src/generate/module/generateModulePreset.js +10 -51
  29. package/src/generate/module/generateModulePreset.ts +9 -8
  30. package/src/generate/module/generatePresenter.js +29 -76
  31. package/src/generate/module/generatePresenter.ts +15 -10
  32. package/src/generate/module/generateRepository.js +0 -17
  33. package/src/generate/module/generateSchemaFromType.js +9 -58
  34. package/src/generate/module/generateSchemaFromType.ts +1 -2
  35. package/src/generate/module/generateTypesJson.js +4 -45
  36. package/src/generate/module/generateUseCases.js +0 -9
  37. package/src/generate/module/repositoryModuleShared.js +21 -98
  38. package/src/generate/module/repositoryModuleShared.ts +14 -10
  39. package/src/generate/ui/generateComponent.js +0 -16
  40. package/src/generate/ui/generateDesignComponent.js +0 -12
  41. package/src/generate/ui/generateWidget.js +0 -12
  42. package/src/init/initAliases.js +42 -64
  43. package/src/init/initAliases.ts +47 -42
  44. package/src/init/initEdges.js +0 -15
  45. package/src/init/initStructure.js +48 -21
  46. package/src/init/initStructure.ts +51 -3
  47. package/src/install/installFresh.js +0 -16
  48. package/src/plugins/addLint.js +11 -46
  49. package/src/scaffolds/createCoreSchema.js +6 -40
  50. package/src/scaffolds/createCoreSchema.ts +6 -18
  51. package/src/scaffolds/createDatasource.js +26 -61
  52. package/src/scaffolds/createDatasource.ts +26 -40
  53. package/src/scaffolds/createDatasourceProvider.js +19 -56
  54. package/src/scaffolds/createDatasourceProvider.ts +20 -34
  55. package/src/scaffolds/createPresenterFactory.js +5 -34
  56. package/src/scaffolds/createPresenterFactory.ts +5 -17
  57. package/src/scaffolds/createProgram.js +1 -5
  58. package/src/scaffolds/createResponse.js +3 -11
  59. package/src/scaffolds/createResponse.ts +3 -1
  60. package/src/scaffolds/createSchemaRule.js +3 -8
  61. package/src/scaffolds/createSchemaRule.ts +3 -1
  62. package/src/scaffolds/createTranslationManager.js +3 -14
  63. package/src/scaffolds/createTranslationManager.ts +3 -1
  64. package/src/utils/contextUtils.js +5 -20
  65. package/src/utils/contextUtils.ts +2 -3
  66. package/src/utils/fileUtils.js +3 -38
  67. package/src/utils/fileUtils.ts +0 -26
  68. package/src/utils/loadConfig.js +1 -14
  69. package/src/utils/loadConfig.ts +1 -3
  70. package/src/utils/sharedFoundation.js +48 -0
  71. package/src/utils/sharedFoundation.ts +70 -0
package/bin/azure-net.js CHANGED
@@ -1,65 +1,54 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import { Command } from 'commander';
4
3
  import { addLint } from '../src/plugins/index.js';
5
-
6
4
  const program = new Command();
7
-
8
5
  program.name('azure-net').description('Azure-Net CLI generator').version('4.1.0');
9
-
10
6
  const addCommand = program.command('add').description('Add project integrations and plugins');
11
7
  const createCommand = program.command('create').description('Create project boilerplate artifacts');
12
8
  const initCommand = program.command('init').description('Initialize project scaffolding');
13
9
  const installCommand = program.command('install').description('Install project presets and flows');
14
10
  const generateCommand = program.command('generate').description('Generate UI artifacts');
15
11
  const checkCommand = program.command('check').description('Run project checks');
16
-
17
12
  addCommand
18
13
  .command('commit-tools')
19
14
  .description('Setup linting and commit tools')
20
15
  .option('-m, --manager <manager>', 'Package manager: bun | pnpm | npm | yarn')
21
16
  .action(addLint);
22
-
23
17
  createCommand
24
18
  .command('schema-factory')
25
- .description('Create base schema in src/core/schema')
19
+ .description('Create base schema in shared essentials foundation constructs')
26
20
  .action(async () => {
27
21
  const handler = (await import('../src/scaffolds/createCoreSchema.js')).default;
28
22
  await handler();
29
23
  });
30
-
31
24
  createCommand
32
25
  .command('translation-manager')
33
- .description('Create translation manager in src/core/translation')
26
+ .description('Create translation manager in shared essentials localization')
34
27
  .action(async () => {
35
28
  const handler = (await import('../src/scaffolds/createTranslationManager.js')).default;
36
29
  await handler();
37
30
  });
38
-
39
31
  createCommand
40
32
  .command('presenter-factory')
41
- .description('Create presenter factory in src/core/presenter')
33
+ .description('Create presenter factory in shared essentials foundation constructs')
42
34
  .action(async () => {
43
35
  const handler = (await import('../src/scaffolds/createPresenterFactory.js')).default;
44
36
  await handler();
45
37
  });
46
-
47
38
  createCommand
48
39
  .command('schema-rule')
49
- .description('Create schema rule in src/core/schema/custom-rules')
40
+ .description('Create schema rule in shared essentials foundation constructs')
50
41
  .action(async () => {
51
42
  const handler = (await import('../src/scaffolds/createSchemaRule.js')).default;
52
43
  await handler();
53
44
  });
54
-
55
45
  createCommand
56
46
  .command('response')
57
- .description('Create response in src/core/response')
47
+ .description('Create response in shared essentials foundation constructs')
58
48
  .action(async () => {
59
49
  const handler = (await import('../src/scaffolds/createResponse.js')).default;
60
50
  await handler();
61
51
  });
62
-
63
52
  createCommand
64
53
  .command('datasource')
65
54
  .description('Create datasource in core or context infrastructure')
@@ -67,7 +56,6 @@ createCommand
67
56
  const handler = (await import('../src/scaffolds/createDatasource.js')).default;
68
57
  await handler();
69
58
  });
70
-
71
59
  createCommand
72
60
  .command('datasource-provider')
73
61
  .description('Create datasource provider in core or context infrastructure')
@@ -75,7 +63,6 @@ createCommand
75
63
  const handler = (await import('../src/scaffolds/createDatasourceProvider.js')).default;
76
64
  await handler();
77
65
  });
78
-
79
66
  initCommand
80
67
  .command('edges')
81
68
  .description('Initialize edges plugin in vite config')
@@ -83,7 +70,6 @@ initCommand
83
70
  const handler = (await import('../src/init/initEdges.js')).default;
84
71
  await handler();
85
72
  });
86
-
87
73
  initCommand
88
74
  .command('folders-structure')
89
75
  .description('Generate base folders structure')
@@ -91,12 +77,10 @@ initCommand
91
77
  const handler = (await import('../src/init/initStructure.js')).default;
92
78
  await handler();
93
79
  });
94
-
95
80
  initCommand.action(async () => {
96
81
  const initStructure = (await import('../src/init/initStructure.js')).default;
97
82
  await initStructure();
98
83
  });
99
-
100
84
  installCommand
101
85
  .command('fresh')
102
86
  .description('Run full fresh install flow (structure + optional generators)')
@@ -104,7 +88,6 @@ installCommand
104
88
  const handler = (await import('../src/install/installFresh.js')).default;
105
89
  await handler();
106
90
  });
107
-
108
91
  generateCommand
109
92
  .command('component')
110
93
  .description('Generate UI component')
@@ -112,7 +95,6 @@ generateCommand
112
95
  const handler = (await import('../src/generate/ui/generateComponent.js')).default;
113
96
  await handler();
114
97
  });
115
-
116
98
  generateCommand
117
99
  .command('widget')
118
100
  .description('Generate UI widget')
@@ -120,7 +102,6 @@ generateCommand
120
102
  const handler = (await import('../src/generate/ui/generateWidget.js')).default;
121
103
  await handler();
122
104
  });
123
-
124
105
  generateCommand
125
106
  .command('design-component')
126
107
  .description('Generate UI design component')
@@ -128,7 +109,6 @@ generateCommand
128
109
  const handler = (await import('../src/generate/ui/generateDesignComponent.js')).default;
129
110
  await handler();
130
111
  });
131
-
132
112
  generateCommand
133
113
  .command('repository')
134
114
  .description('Generate infrastructure repository')
@@ -136,7 +116,6 @@ generateCommand
136
116
  const handler = (await import('../src/generate/layers/generateRepository.js')).default;
137
117
  await handler();
138
118
  });
139
-
140
119
  generateCommand
141
120
  .command('repo')
142
121
  .description('Generate infrastructure repository (module flow)')
@@ -144,7 +123,6 @@ generateCommand
144
123
  const handler = (await import('../src/generate/module/generateRepository.js')).default;
145
124
  await handler();
146
125
  });
147
-
148
126
  generateCommand
149
127
  .command('repository-method')
150
128
  .description('Generate method for an existing repository')
@@ -152,7 +130,6 @@ generateCommand
152
130
  const handler = (await import('../src/generate/layers/generateRepositoryMethod.js')).default;
153
131
  await handler();
154
132
  });
155
-
156
133
  generateCommand
157
134
  .command('use-cases')
158
135
  .description('Generate use-cases for an existing repository')
@@ -160,7 +137,6 @@ generateCommand
160
137
  const handler = (await import('../src/generate/module/generateUseCases.js')).default;
161
138
  await handler();
162
139
  });
163
-
164
140
  generateCommand
165
141
  .command('domain')
166
142
  .description('Generate domain module (model/ports)')
@@ -168,7 +144,6 @@ generateCommand
168
144
  const handler = (await import('../src/generate/module/generateDomain.js')).default;
169
145
  await handler();
170
146
  });
171
-
172
147
  generateCommand
173
148
  .command('presenter')
174
149
  .description('Generate presentation layer presenter from UseCases')
@@ -176,7 +151,6 @@ generateCommand
176
151
  const handler = (await import('../src/generate/module/generatePresenter.js')).default;
177
152
  await handler();
178
153
  });
179
-
180
154
  generateCommand
181
155
  .command('types-json')
182
156
  .description('Fill model interface keys from JSON')
@@ -184,7 +158,6 @@ generateCommand
184
158
  const handler = (await import('../src/generate/module/generateTypesJson.js')).default;
185
159
  await handler();
186
160
  });
187
-
188
161
  generateCommand
189
162
  .command('schema-from-type')
190
163
  .description('Fill schema rules keys from schema generic type')
@@ -192,7 +165,6 @@ generateCommand
192
165
  const handler = (await import('../src/generate/module/generateSchemaFromType.js')).default;
193
166
  await handler();
194
167
  });
195
-
196
168
  generateCommand
197
169
  .command('module')
198
170
  .description('Generate domain + repository + presenter flow')
@@ -200,7 +172,6 @@ generateCommand
200
172
  const handler = (await import('../src/generate/module/generateModule.js')).default;
201
173
  await handler();
202
174
  });
203
-
204
175
  generateCommand
205
176
  .command('module-preset')
206
177
  .description('Generate preset CRUD-like module flow')
@@ -208,7 +179,6 @@ generateCommand
208
179
  const handler = (await import('../src/generate/module/generateModulePreset.js')).default;
209
180
  await handler();
210
181
  });
211
-
212
182
  checkCommand
213
183
  .command('presenter-names')
214
184
  .description('Check duplicate presenter names in src')
@@ -216,7 +186,6 @@ checkCommand
216
186
  const handler = (await import('../src/checks/checkPresenterNames.js')).default;
217
187
  await handler();
218
188
  });
219
-
220
189
  checkCommand
221
190
  .command('provider-names')
222
191
  .description('Check duplicate provider names in src')
@@ -224,7 +193,6 @@ checkCommand
224
193
  const handler = (await import('../src/checks/checkProviderNames.js')).default;
225
194
  await handler();
226
195
  });
227
-
228
196
  checkCommand
229
197
  .command('provider-graph')
230
198
  .description('Check provider dependency graph for cycles')
@@ -232,7 +200,6 @@ checkCommand
232
200
  const handler = (await import('../src/checks/checkProviderGraph.js')).default;
233
201
  await handler();
234
202
  });
235
-
236
203
  checkCommand
237
204
  .command('domain')
238
205
  .description('Check domain naming and structure rules in all contexts')
@@ -240,7 +207,6 @@ checkCommand
240
207
  const handler = (await import('../src/checks/checkDomain.js')).default;
241
208
  await handler();
242
209
  });
243
-
244
210
  checkCommand
245
211
  .command('imports')
246
212
  .description('Check import extensions and import group order in src')
@@ -248,7 +214,6 @@ checkCommand
248
214
  const handler = (await import('../src/checks/checkImports.js')).default;
249
215
  await handler();
250
216
  });
251
-
252
217
  checkCommand
253
218
  .command('hooks')
254
219
  .description('Check that manual SvelteKit hooks are not present')
@@ -256,7 +221,13 @@ checkCommand
256
221
  const handler = (await import('../src/checks/checkHooks.js')).default;
257
222
  await handler();
258
223
  });
259
-
224
+ checkCommand
225
+ .command('layer-imports')
226
+ .description('Check forbidden imports between layers inside each context')
227
+ .action(async () => {
228
+ const handler = (await import('../src/checks/checkLayerImports.js')).default;
229
+ await handler();
230
+ });
260
231
  checkCommand
261
232
  .command('layer-boundaries')
262
233
  .description('Check layer boundaries between contexts by aliases')
@@ -264,7 +235,6 @@ checkCommand
264
235
  const handler = (await import('../src/checks/checkLayerBoundaries.js')).default;
265
236
  await handler();
266
237
  });
267
-
268
238
  checkCommand
269
239
  .command('folders-structure')
270
240
  .description('Check allowed folders structure in context layers/ui/components')
@@ -272,7 +242,6 @@ checkCommand
272
242
  const handler = (await import('../src/checks/checkFoldersStructure.js')).default;
273
243
  await handler();
274
244
  });
275
-
276
245
  checkCommand
277
246
  .command('internal')
278
247
  .description('Run all internal azure-net checks')
@@ -280,7 +249,6 @@ checkCommand
280
249
  const handler = (await import('../src/checks/checkInternal.js')).default;
281
250
  await handler();
282
251
  });
283
-
284
252
  checkCommand
285
253
  .command('project')
286
254
  .description('Run full project checks: format, internal, lint, typecheck')
@@ -288,5 +256,4 @@ checkCommand
288
256
  const handler = (await import('../src/checks/checkProject.js')).default;
289
257
  await handler();
290
258
  });
291
-
292
259
  program.parse();
package/bin/azure-net.ts CHANGED
@@ -22,7 +22,7 @@ addCommand
22
22
 
23
23
  createCommand
24
24
  .command('schema-factory')
25
- .description('Create base schema in src/core/schema')
25
+ .description('Create base schema in shared essentials foundation constructs')
26
26
  .action(async () => {
27
27
  const handler = (await import('../src/scaffolds/createCoreSchema.js')).default;
28
28
  await handler();
@@ -30,7 +30,7 @@ createCommand
30
30
 
31
31
  createCommand
32
32
  .command('translation-manager')
33
- .description('Create translation manager in src/core/translation')
33
+ .description('Create translation manager in shared essentials localization')
34
34
  .action(async () => {
35
35
  const handler = (await import('../src/scaffolds/createTranslationManager.js')).default;
36
36
  await handler();
@@ -38,7 +38,7 @@ createCommand
38
38
 
39
39
  createCommand
40
40
  .command('presenter-factory')
41
- .description('Create presenter factory in src/core/presenter')
41
+ .description('Create presenter factory in shared essentials foundation constructs')
42
42
  .action(async () => {
43
43
  const handler = (await import('../src/scaffolds/createPresenterFactory.js')).default;
44
44
  await handler();
@@ -46,7 +46,7 @@ createCommand
46
46
 
47
47
  createCommand
48
48
  .command('schema-rule')
49
- .description('Create schema rule in src/core/schema/custom-rules')
49
+ .description('Create schema rule in shared essentials foundation constructs')
50
50
  .action(async () => {
51
51
  const handler = (await import('../src/scaffolds/createSchemaRule.js')).default;
52
52
  await handler();
@@ -54,7 +54,7 @@ createCommand
54
54
 
55
55
  createCommand
56
56
  .command('response')
57
- .description('Create response in src/core/response')
57
+ .description('Create response in shared essentials foundation constructs')
58
58
  .action(async () => {
59
59
  const handler = (await import('../src/scaffolds/createResponse.js')).default;
60
60
  await handler();
@@ -257,6 +257,14 @@ checkCommand
257
257
  await handler();
258
258
  });
259
259
 
260
+ checkCommand
261
+ .command('layer-imports')
262
+ .description('Check forbidden imports between layers inside each context')
263
+ .action(async () => {
264
+ const handler = (await import('../src/checks/checkLayerImports.js')).default;
265
+ await handler();
266
+ });
267
+
260
268
  checkCommand
261
269
  .command('layer-boundaries')
262
270
  .description('Check layer boundaries between contexts by aliases')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-net/cli",
3
- "version": "5.0.0-1",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "azure-net": "bin/azure-net.js"
@@ -2,24 +2,17 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { loadUserConfig } from '../utils/loadConfig.js';
4
4
  import { normalizeContexts } from '../init/initAliases.js';
5
-
6
5
  const DOMAIN_FILE_EXTENSIONS = new Set(['.ts']);
7
6
  const IGNORED_DIRS = new Set(['node_modules', 'dist', '.svelte-kit', '.git']);
8
-
9
7
  const INTERFACE_DECLARATION_PATTERN = /(?:^|\n)\s*(?:export\s+)?interface\s+([A-Za-z_$][A-Za-z0-9_$]*)\b/g;
10
8
  const TYPE_DECLARATION_PATTERN = /(?:^|\n)\s*(?:export\s+)?type\s+([A-Za-z_$][A-Za-z0-9_$]*)\s*=/g;
11
-
12
9
  const EXPORT_STAR_PATTERN = /export\s+\*\s+from\s*['"][^'"]+['"]\s*;?/g;
13
10
  const EXPORT_FROM_PATTERN = /export\s+(?:type\s+)?\{[\s\S]*?\}\s+from\s*['"][^'"]+['"]\s*;?/g;
14
11
  const EXPORT_LOCAL_PATTERN = /export\s+(?:type\s+)?\{[\s\S]*?\}\s*;?/g;
15
-
16
12
  const toPosixPath = (value) => value.split(path.sep).join('/');
17
-
18
13
  const stripComments = (content) => content.replace(/\/\*[\s\S]*?\*\//g, '').replace(/(^|[^\\])\/\/.*$/gm, '$1');
19
-
20
14
  const stripExportStatements = (content) =>
21
15
  content.replace(EXPORT_STAR_PATTERN, '').replace(EXPORT_FROM_PATTERN, '').replace(EXPORT_LOCAL_PATTERN, '');
22
-
23
16
  const findLineByIndex = (content, index) => {
24
17
  let line = 1;
25
18
  for (let i = 0; i < index; i += 1) {
@@ -27,36 +20,29 @@ const findLineByIndex = (content, index) => {
27
20
  }
28
21
  return line;
29
22
  };
30
-
31
23
  const getRelativeFilePath = (filePath) => toPosixPath(path.relative(process.cwd(), filePath));
32
-
33
24
  const isEnumsPath = (filePath) => {
34
25
  const normalized = toPosixPath(filePath);
35
26
  return normalized.includes('/enums/');
36
27
  };
37
-
38
28
  const isIndexFile = (filePath) => path.basename(filePath) === 'index.ts';
39
-
29
+ const startsWithInterfacePrefix = (filePath) => /^I[A-Z]/.test(path.basename(filePath, '.ts'));
40
30
  const isExportOnlyIndex = (content) => {
41
31
  const withoutComments = stripComments(content);
42
32
  const withoutExports = stripExportStatements(withoutComments);
43
33
  return withoutExports.trim().length === 0;
44
34
  };
45
-
46
35
  const validateName = (declaration) => {
47
36
  if (declaration.kind === 'interface') {
48
37
  return /^I[A-Z]/.test(declaration.name) ? null : `Interface "${declaration.name}" must start with "I" and have uppercase second letter`;
49
38
  }
50
-
51
39
  return /^[IT][A-Z]/.test(declaration.name)
52
40
  ? null
53
41
  : `Type "${declaration.name}" must start with "I" or "T" and have uppercase second letter`;
54
42
  };
55
-
56
43
  const extractDeclarations = (content) => {
57
44
  const cleaned = stripComments(content);
58
45
  const declarations = [];
59
-
60
46
  const interfaceRegex = new RegExp(INTERFACE_DECLARATION_PATTERN.source, 'g');
61
47
  let interfaceMatch;
62
48
  while ((interfaceMatch = interfaceRegex.exec(cleaned)) !== null) {
@@ -68,7 +54,6 @@ const extractDeclarations = (content) => {
68
54
  line: findLineByIndex(cleaned, interfaceMatch.index)
69
55
  });
70
56
  }
71
-
72
57
  const typeRegex = new RegExp(TYPE_DECLARATION_PATTERN.source, 'g');
73
58
  let typeMatch;
74
59
  while ((typeMatch = typeRegex.exec(cleaned)) !== null) {
@@ -80,25 +65,20 @@ const extractDeclarations = (content) => {
80
65
  line: findLineByIndex(cleaned, typeMatch.index)
81
66
  });
82
67
  }
83
-
84
68
  return declarations.sort((a, b) => a.line - b.line);
85
69
  };
86
-
87
70
  const listDomainFiles = async (domainRoot) => {
88
71
  const files = [];
89
72
  const stack = [domainRoot];
90
-
91
73
  while (stack.length) {
92
74
  const current = stack.pop();
93
75
  if (!current) continue;
94
-
95
76
  let entries = [];
96
77
  try {
97
78
  entries = await fs.readdir(current, { withFileTypes: true });
98
79
  } catch {
99
80
  continue;
100
81
  }
101
-
102
82
  for (const entry of entries) {
103
83
  if (entry.isDirectory()) {
104
84
  if (!IGNORED_DIRS.has(entry.name)) {
@@ -106,20 +86,16 @@ const listDomainFiles = async (domainRoot) => {
106
86
  }
107
87
  continue;
108
88
  }
109
-
110
89
  if (!entry.isFile()) continue;
111
90
  const filePath = path.join(current, entry.name);
112
91
  if (!DOMAIN_FILE_EXTENSIONS.has(path.extname(filePath))) continue;
113
92
  files.push(filePath);
114
93
  }
115
94
  }
116
-
117
95
  return files;
118
96
  };
119
-
120
97
  const collectIssuesForFile = (filePath, content) => {
121
98
  const issues = [];
122
-
123
99
  if (isIndexFile(filePath) && !isExportOnlyIndex(content)) {
124
100
  issues.push({
125
101
  file: filePath,
@@ -127,11 +103,16 @@ const collectIssuesForFile = (filePath, content) => {
127
103
  message: 'index.ts must contain only exports. Move declarations to separate files'
128
104
  });
129
105
  }
130
-
131
106
  if (isEnumsPath(filePath)) {
132
107
  return issues;
133
108
  }
134
-
109
+ if (!isIndexFile(filePath) && startsWithInterfacePrefix(filePath)) {
110
+ issues.push({
111
+ file: filePath,
112
+ line: 1,
113
+ message: 'Domain file names must not start with "I". Keep "I" only in interface/type names'
114
+ });
115
+ }
135
116
  const declarations = extractDeclarations(content);
136
117
  if (declarations.length > 5) {
137
118
  issues.push({
@@ -140,7 +121,6 @@ const collectIssuesForFile = (filePath, content) => {
140
121
  message: `Too many declarations in one file (${declarations.length}). Maximum is 5`
141
122
  });
142
123
  }
143
-
144
124
  for (const declaration of declarations) {
145
125
  const validationError = validateName(declaration);
146
126
  if (!validationError) continue;
@@ -150,25 +130,19 @@ const collectIssuesForFile = (filePath, content) => {
150
130
  message: validationError
151
131
  });
152
132
  }
153
-
154
133
  return issues;
155
134
  };
156
-
157
135
  export default async function checkDomain() {
158
136
  const config = await loadUserConfig();
159
137
  const contexts = normalizeContexts(config.contexts);
160
-
161
138
  if (!contexts.length) {
162
139
  console.error('❌ No contexts found in azure-net.config.ts/js. Fill `contexts` first.');
163
140
  process.exitCode = 1;
164
141
  return;
165
142
  }
166
-
167
143
  const issues = [];
168
-
169
144
  for (const context of contexts) {
170
145
  const domainRoot = path.join(process.cwd(), 'src', 'app', context.name, 'layers', 'domain');
171
-
172
146
  try {
173
147
  await fs.access(domainRoot);
174
148
  } catch {
@@ -179,23 +153,19 @@ export default async function checkDomain() {
179
153
  });
180
154
  continue;
181
155
  }
182
-
183
156
  const files = await listDomainFiles(domainRoot);
184
157
  for (const filePath of files) {
185
158
  const content = await fs.readFile(filePath, 'utf-8');
186
159
  issues.push(...collectIssuesForFile(filePath, content));
187
160
  }
188
161
  }
189
-
190
162
  if (!issues.length) {
191
163
  console.log('✅ Domain check passed: naming, per-file limits and index exports are valid.');
192
164
  return;
193
165
  }
194
-
195
166
  console.error('❌ Domain check failed:');
196
167
  for (const issue of issues) {
197
168
  console.error(`• ${getRelativeFilePath(issue.file)}:${issue.line} — ${issue.message}`);
198
169
  }
199
-
200
170
  process.exitCode = 1;
201
171
  }
@@ -2,15 +2,11 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { loadUserConfig } from '../utils/loadConfig.js';
4
4
  import { normalizeContexts } from '../init/initAliases.js';
5
-
6
5
  const ALLOWED_LAYERS_FOLDERS = new Set(['domain', 'presentation', 'infrastructure', 'application']);
7
6
  const ALLOWED_UI_FOLDERS = new Set(['components', 'widgets', 'design', 'style']);
8
7
  const ALLOWED_COMPONENTS_FOLDERS = new Set(['page', 'layout', 'shared']);
9
-
10
8
  const toPosixPath = (value) => value.split(path.sep).join('/');
11
-
12
9
  const getRelativePath = (filePath) => toPosixPath(path.relative(process.cwd(), filePath));
13
-
14
10
  const getDirectories = async (dirPath) => {
15
11
  try {
16
12
  const entries = await fs.readdir(dirPath, { withFileTypes: true });
@@ -19,11 +15,9 @@ const getDirectories = async (dirPath) => {
19
15
  return null;
20
16
  }
21
17
  };
22
-
23
18
  const checkOnlyAllowedFolders = async (basePath, allowed, scopeLabel, issues) => {
24
19
  const directories = await getDirectories(basePath);
25
20
  if (!directories) return;
26
-
27
21
  for (const dir of directories) {
28
22
  if (allowed.has(dir)) continue;
29
23
  issues.push({
@@ -32,39 +26,31 @@ const checkOnlyAllowedFolders = async (basePath, allowed, scopeLabel, issues) =>
32
26
  });
33
27
  }
34
28
  };
35
-
36
29
  export default async function checkFoldersStructure() {
37
30
  const config = await loadUserConfig();
38
31
  const contexts = normalizeContexts(config.contexts);
39
-
40
32
  if (!contexts.length) {
41
33
  console.error('❌ No contexts found in azure-net.config.ts/js. Fill `contexts` first.');
42
34
  process.exitCode = 1;
43
35
  return;
44
36
  }
45
-
46
37
  const issues = [];
47
-
48
38
  for (const context of contexts) {
49
39
  const contextRoot = path.join(process.cwd(), 'src', 'app', context.name);
50
40
  const layersPath = path.join(contextRoot, 'layers');
51
41
  const uiPath = path.join(contextRoot, 'ui');
52
42
  const componentsPath = path.join(uiPath, 'components');
53
-
54
43
  await checkOnlyAllowedFolders(layersPath, ALLOWED_LAYERS_FOLDERS, `layers (${context.name})`, issues);
55
44
  await checkOnlyAllowedFolders(uiPath, ALLOWED_UI_FOLDERS, `ui (${context.name})`, issues);
56
45
  await checkOnlyAllowedFolders(componentsPath, ALLOWED_COMPONENTS_FOLDERS, `ui/components (${context.name})`, issues);
57
46
  }
58
-
59
47
  if (!issues.length) {
60
48
  console.log('✅ Folders structure check passed.');
61
49
  return;
62
50
  }
63
-
64
51
  console.error('❌ Folders structure check failed:');
65
52
  for (const issue of issues) {
66
53
  console.error(`• ${getRelativePath(issue.file)} — ${issue.message}`);
67
54
  }
68
-
69
55
  process.exitCode = 1;
70
56
  }
@@ -1,22 +1,17 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
-
4
3
  const forbiddenHooks = ['hooks.server.ts', 'hooks.server.js', 'hooks.client.ts', 'hooks.client.js'];
5
-
6
4
  export default async function checkHooks() {
7
5
  const srcPath = path.join(process.cwd(), 'src');
8
6
  const found = forbiddenHooks.map((filename) => path.join(srcPath, filename)).filter((filepath) => fs.existsSync(filepath));
9
-
10
7
  if (!found.length) {
11
8
  console.log('✅ No manual SvelteKit hooks found.');
12
9
  return;
13
10
  }
14
-
15
11
  console.error('❌ Manual SvelteKit hooks are not allowed with @azure-net/kit AzureNetPlugin.');
16
12
  console.error('Move lifecycle code to src/program.ts through createApp(). Found:');
17
13
  for (const filepath of found) {
18
14
  console.error(` - ${path.relative(process.cwd(), filepath)}`);
19
15
  }
20
-
21
16
  process.exitCode = 1;
22
17
  }
@@ -144,4 +144,3 @@ export default async function checkImports() {
144
144
  }
145
145
  process.exitCode = 1;
146
146
  }
147
- //# sourceMappingURL=checkImports.js.map
@@ -6,6 +6,7 @@ import checkLayerBoundaries from './checkLayerBoundaries.js';
6
6
  import checkFoldersStructure from './checkFoldersStructure.js';
7
7
  import checkImports from './checkImports.js';
8
8
  import checkHooks from './checkHooks.js';
9
+ import checkLayerImports from './checkLayerImports.js';
9
10
  const tasks = [
10
11
  { name: 'presenter-names', run: checkPresenterNames },
11
12
  { name: 'provider-names', run: checkProviderNames },
@@ -13,6 +14,7 @@ const tasks = [
13
14
  { name: 'domain', run: checkDomain },
14
15
  { name: 'imports', run: checkImports },
15
16
  { name: 'hooks', run: checkHooks },
17
+ { name: 'layer-imports', run: checkLayerImports },
16
18
  { name: 'layer-boundaries', run: checkLayerBoundaries },
17
19
  { name: 'folders-structure', run: checkFoldersStructure }
18
20
  ];
@@ -35,4 +37,3 @@ export default async function checkInternal() {
35
37
  process.exitCode = 1;
36
38
  }
37
39
  }
38
- //# sourceMappingURL=checkInternal.js.map
@@ -6,6 +6,7 @@ import checkLayerBoundaries from './checkLayerBoundaries.js';
6
6
  import checkFoldersStructure from './checkFoldersStructure.js';
7
7
  import checkImports from './checkImports.js';
8
8
  import checkHooks from './checkHooks.js';
9
+ import checkLayerImports from './checkLayerImports.js';
9
10
 
10
11
  type CheckTask = {
11
12
  name: string;
@@ -19,6 +20,7 @@ const tasks: CheckTask[] = [
19
20
  { name: 'domain', run: checkDomain },
20
21
  { name: 'imports', run: checkImports },
21
22
  { name: 'hooks', run: checkHooks },
23
+ { name: 'layer-imports', run: checkLayerImports },
22
24
  { name: 'layer-boundaries', run: checkLayerBoundaries },
23
25
  { name: 'folders-structure', run: checkFoldersStructure }
24
26
  ];