@domain-first/project-structure 8.11.0 → 8.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/287.js +36 -967
- package/dist/364.js +3 -3
- package/dist/38.js +4 -3
- package/dist/561.js +76 -67
- package/dist/783.js +1147 -0
- package/dist/{201.js → 878.js} +455 -1
- package/dist/agent-cli.d.ts +5 -5
- package/dist/agent-requests.d.ts +9 -9
- package/dist/frontend-modules.d.ts +6 -1
- package/dist/graph.cjs +115 -4
- package/dist/graph.js +1 -1
- package/dist/index.cjs +129 -71
- package/dist/index.js +1 -1
- package/dist/init.cjs +49 -6
- package/dist/init.js +1 -1
- package/dist/integration.cjs +129 -71
- package/dist/integration.js +1 -1
- package/dist/integrations/openapi.d.ts +13 -3
- package/dist/lint.cjs +121 -9
- package/dist/lint.js +1 -1
- package/dist/react-module-move.d.ts +20 -2
- package/dist/react.cjs +185 -123
- package/dist/svelte.cjs +185 -123
- package/dist/upgrade-svelte.d.ts +15 -0
- package/dist/upgrade-svelte.spec.d.ts +1 -0
- package/dist/upgrade.cjs +296 -41
- package/dist/upgrade.js +132 -13
- package/dist/use-cases/scaffold-svelte-modules.d.ts +7 -2
- package/package.json +1 -1
- package/skills/df-ps-scaffold/SKILL.md +2 -2
- package/skills/df-ps-scaffold/references/agent-operations.md +2 -2
- package/skills/df-ps-svelte/SKILL.md +14 -9
- package/skills/df-ps-svelte/references/generators.md +5 -5
- package/dist/115.js +0 -616
package/dist/364.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { select as prompts_select } from "@inquirer/prompts";
|
|
3
3
|
import { frontendOperations, frontendMenu, runCLI } from "./561.js";
|
|
4
|
-
import { outdatedConfigMessage, ProjectRoot, ConfigFile, Folder } from "./
|
|
4
|
+
import { outdatedConfigMessage, ProjectRoot, ConfigFile, Folder } from "./878.js";
|
|
5
5
|
import { savePendingChanges } from "./287.js";
|
|
6
6
|
const texts = {
|
|
7
7
|
react: {
|
|
@@ -18,7 +18,7 @@ Needs frontend.react in domain-first.project-structure.config.json.`,
|
|
|
18
18
|
help: `Usage: df-svelte
|
|
19
19
|
|
|
20
20
|
Scaffolds Svelte 5 modules of a Domain-First project: pages, widgets, UI-kit
|
|
21
|
-
components and shared
|
|
21
|
+
components and shared models (create… in .svelte.ts), and moves, renames or deletes
|
|
22
22
|
them. With SvelteKit, pages get their routes in src/routes.
|
|
23
23
|
Needs frontend.svelte in domain-first.project-structure.config.json.`,
|
|
24
24
|
notConfigured: 'Svelte is not configured: run df-init --section frontend.'
|
|
@@ -64,7 +64,7 @@ Options:
|
|
|
64
64
|
]);
|
|
65
65
|
const operation = await prompts_select({
|
|
66
66
|
message: 'Module: ',
|
|
67
|
-
choices: frontendMenu.map(([name, value])=>({
|
|
67
|
+
choices: frontendMenu(framework).map(([name, value])=>({
|
|
68
68
|
name,
|
|
69
69
|
value
|
|
70
70
|
}))
|
package/dist/38.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import node_fs from "node:fs";
|
|
2
2
|
import node_path from "node:path";
|
|
3
|
-
import { defaultDependencyRules, fileModuleKind,
|
|
3
|
+
import { defaultDependencyRules, fileModuleKind, canDependOn, findWiredModules, splitContextSegments, frontendLogicNaming, readWiredModule, wiredDependencyNames, boundedContextNames, namedImportFiles, moduleKindOf, isCrossContextImplementation, boundedContextPath, crossContextImportAllowed, compilerOption } from "./878.js";
|
|
4
4
|
const readAliases = (projectRoot)=>{
|
|
5
5
|
const tsconfig = node_path.join(projectRoot, 'tsconfig.json');
|
|
6
6
|
const paths = compilerOption(tsconfig, 'paths');
|
|
@@ -108,7 +108,8 @@ const importViolations = (projectRoot, rootFolder, rules)=>{
|
|
|
108
108
|
folder,
|
|
109
109
|
uiKit: node_path.join(folder, 'ui-kit'),
|
|
110
110
|
widgets: node_path.join(folder, 'widgets'),
|
|
111
|
-
hooks: node_path.join(folder,
|
|
111
|
+
hooks: node_path.join(folder, ...frontendLogicNaming[framework].shared),
|
|
112
|
+
hooksLabel: 'svelte' === framework ? "[presentation/svelte/shared/model] a shared model imports a bounded context, UI-kit, widget or page:" : "[presentation/react/hooks] a shared hook imports a bounded context, UI-kit, widget or page:",
|
|
112
113
|
widgetFile: 'svelte' === framework ? '-widget.svelte' : '-widget.tsx'
|
|
113
114
|
};
|
|
114
115
|
});
|
|
@@ -198,7 +199,7 @@ const importViolations = (projectRoot, rootFolder, rules)=>{
|
|
|
198
199
|
'widgets',
|
|
199
200
|
'pages'
|
|
200
201
|
];
|
|
201
|
-
if (targetContext || forbidden.includes(area)) report(frontend.check, inUiKit ? `[${frontend.label}/ui-kit] imports a bounded context, widget or page:` :
|
|
202
|
+
if (targetContext || forbidden.includes(area)) report(frontend.check, inUiKit ? `[${frontend.label}/ui-kit] imports a bounded context, widget or page:` : frontend.hooksLabel, imported);
|
|
202
203
|
} else if (frontend && targetContext && !(imported.typeOnly && to?.segments[0] === 'presentation' && 'rest' === to.segments[1])) report(frontend.check, `[${frontend.label}] imports a context other than \`import type\` from presentation/rest:`, imported);
|
|
203
204
|
const ownWidget = widgetOf(file);
|
|
204
205
|
const targetWidget = widgetOf(target);
|
package/dist/561.js
CHANGED
|
@@ -2,9 +2,9 @@ import node_fs from "node:fs";
|
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import { parseArgs } from "node:util";
|
|
4
4
|
import zod from "zod";
|
|
5
|
-
import { implementationLabelSchema, availableDependencies, discardPendingChanges,
|
|
6
|
-
import { scaffoldNewHandlersRestEndpoint, addIntegration, findContracts, helperImplementationTypes, scaffoldReactUIKitComponent, scaffoldNewAggregateUseCase,
|
|
7
|
-
import { restControllers } from "./
|
|
5
|
+
import { implementationLabelSchema, availableDependencies, discardPendingChanges, frontendKindTitles, filesToOverwrite, ConfigFile, Folder, findWiredModules, implementationKinds, ProjectRoot, pendingChanges, findReactModules, hasNeighboringBoundedContext, boundedContextNames } from "./878.js";
|
|
6
|
+
import { scaffoldNewHandlersRestEndpoint, addIntegration, findContracts, helperImplementationTypes, scaffoldReactUIKitComponent, scaffoldNewAggregateUseCase, scaffoldNewInfrastructureService, scaffoldNewCommand, scaffoldNewQuery, moveBackendUnitUseCase, scaffoldReactSharedHook, moveReactModuleUseCase, deleteBackendUnitUseCase, integrationIds, scaffoldNewApplicationService, frameworkTitles, savedImplementations, deleteReactModuleUseCase, scaffoldNewImplementation, rootControllerChoice, moduleId, scaffoldNewDomainService, scaffoldReactWidget, scaffoldNewErrorUseCase, findRestEndpointGenerator, savePendingChanges, unitId, systemImplementationChoices, scaffoldNewPresentationService, scaffoldNewInfrastructureHelper, integrationSpecsAvailable, integrationSpecFile, findBackendUnits, scaffoldNewUseCase, integrationDescriptions, wireDependency, scaffoldNewDomainObject, scaffoldNewBoundedContextUseCase, scaffoldNewApplicationPort } from "./287.js";
|
|
7
|
+
import { scaffoldSvelteUIKitComponent, scaffoldSveltePage, runWithAnswers, restControllers, RequestError, scaffoldSvelteWidget, scaffoldReactPage, assertAnswersConsumed, scaffoldSvelteSharedModel } from "./783.js";
|
|
8
8
|
const agent_requests_name = implementationLabelSchema;
|
|
9
9
|
const nestedName = zod.string().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:\/[a-z][a-z0-9]*(?:-[a-z0-9]+)*)*$/);
|
|
10
10
|
const id = zod.string().min(1);
|
|
@@ -144,7 +144,7 @@ const scaffoldRequestSchema = zod.discriminatedUnion('operation', [
|
|
|
144
144
|
aggregate: agent_requests_name.optional()
|
|
145
145
|
})
|
|
146
146
|
]);
|
|
147
|
-
const frontendRequestSchema = (router)=>zod.discriminatedUnion('operation', [
|
|
147
|
+
const frontendRequestSchema = (router, shared)=>zod.discriminatedUnion('operation', [
|
|
148
148
|
agent_requests_operation('page', {
|
|
149
149
|
...common,
|
|
150
150
|
name: nestedName
|
|
@@ -162,7 +162,7 @@ const frontendRequestSchema = (router)=>zod.discriminatedUnion('operation', [
|
|
|
162
162
|
...common,
|
|
163
163
|
name: agent_requests_name
|
|
164
164
|
}),
|
|
165
|
-
agent_requests_operation(
|
|
165
|
+
agent_requests_operation(shared, {
|
|
166
166
|
...common,
|
|
167
167
|
name: agent_requests_name
|
|
168
168
|
}),
|
|
@@ -186,7 +186,7 @@ const frontendRequestSchema = (router)=>zod.discriminatedUnion('operation', [
|
|
|
186
186
|
module: agent_requests_name,
|
|
187
187
|
name: agent_requests_name
|
|
188
188
|
}),
|
|
189
|
-
agent_requests_operation(
|
|
189
|
+
agent_requests_operation(`move-${shared}`, {
|
|
190
190
|
...common,
|
|
191
191
|
module: agent_requests_name,
|
|
192
192
|
name: agent_requests_name
|
|
@@ -195,7 +195,7 @@ const frontendRequestSchema = (router)=>zod.discriminatedUnion('operation', [
|
|
|
195
195
|
...common,
|
|
196
196
|
module: agent_requests_name
|
|
197
197
|
}),
|
|
198
|
-
agent_requests_operation(
|
|
198
|
+
agent_requests_operation(`delete-${shared}`, {
|
|
199
199
|
...common,
|
|
200
200
|
module: agent_requests_name
|
|
201
201
|
}),
|
|
@@ -205,8 +205,8 @@ const frontendRequestSchema = (router)=>zod.discriminatedUnion('operation', [
|
|
|
205
205
|
name: nestedName
|
|
206
206
|
})
|
|
207
207
|
]);
|
|
208
|
-
const reactRequestSchema = frontendRequestSchema('Next.js');
|
|
209
|
-
const svelteRequestSchema = frontendRequestSchema('SvelteKit');
|
|
208
|
+
const reactRequestSchema = frontendRequestSchema('Next.js', 'shared-hook');
|
|
209
|
+
const svelteRequestSchema = frontendRequestSchema('SvelteKit', 'shared-model');
|
|
210
210
|
const relativePath = zod.string().regex(/^[a-zA-Z0-9_.-]+(?:\/[a-zA-Z0-9_.-]+)*$/).refine((value)=>!value.split('/').some((part)=>'.' === part || '..' === part), 'Use a project-relative path without . or .. segments.');
|
|
211
211
|
const integrationRequestSchema = agent_requests_operation('add', {
|
|
212
212
|
...common,
|
|
@@ -238,17 +238,22 @@ const requestSchemaFor = (command)=>({
|
|
|
238
238
|
'df-svelte': svelteRequestSchema,
|
|
239
239
|
'df-integration': integrationRequestSchema
|
|
240
240
|
})[command];
|
|
241
|
+
const sharedLogicOperation = {
|
|
242
|
+
react: 'shared-hook',
|
|
243
|
+
svelte: 'shared-model'
|
|
244
|
+
};
|
|
241
245
|
const frontendOperations = (folder, framework)=>{
|
|
246
|
+
const shared = sharedLogicOperation[framework];
|
|
242
247
|
const scaffold = 'svelte' === framework ? {
|
|
243
248
|
page: scaffoldSveltePage,
|
|
244
249
|
widget: scaffoldSvelteWidget,
|
|
245
250
|
'ui-kit-component': scaffoldSvelteUIKitComponent,
|
|
246
|
-
|
|
251
|
+
shared: scaffoldSvelteSharedModel
|
|
247
252
|
} : {
|
|
248
253
|
page: scaffoldReactPage,
|
|
249
254
|
widget: scaffoldReactWidget,
|
|
250
255
|
'ui-kit-component': scaffoldReactUIKitComponent,
|
|
251
|
-
|
|
256
|
+
shared: scaffoldReactSharedHook
|
|
252
257
|
};
|
|
253
258
|
const move = (kind)=>()=>moveReactModuleUseCase(folder, kind, framework);
|
|
254
259
|
const remove = (kind)=>()=>deleteReactModuleUseCase(folder, kind, framework);
|
|
@@ -256,67 +261,71 @@ const frontendOperations = (folder, framework)=>{
|
|
|
256
261
|
page: ()=>scaffold.page(folder),
|
|
257
262
|
widget: ()=>scaffold.widget(folder),
|
|
258
263
|
'ui-kit-component': ()=>scaffold['ui-kit-component'](folder),
|
|
259
|
-
|
|
264
|
+
[shared]: ()=>scaffold.shared(folder),
|
|
260
265
|
'move-page': move('page'),
|
|
261
266
|
'move-widget': move('widget'),
|
|
262
267
|
'move-ui-kit-component': move('ui-kit'),
|
|
263
|
-
|
|
268
|
+
[`move-${shared}`]: move('hook'),
|
|
264
269
|
'delete-page': remove('page'),
|
|
265
270
|
'delete-widget': remove('widget'),
|
|
266
271
|
'delete-ui-kit-component': remove('ui-kit'),
|
|
267
|
-
|
|
272
|
+
[`delete-${shared}`]: remove('hook')
|
|
268
273
|
};
|
|
269
274
|
};
|
|
270
|
-
const frontendMenu =
|
|
271
|
-
[
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
275
|
+
const frontendMenu = (framework)=>{
|
|
276
|
+
const shared = sharedLogicOperation[framework];
|
|
277
|
+
const title = 'svelte' === framework ? 'shared model' : 'shared hook';
|
|
278
|
+
return [
|
|
279
|
+
[
|
|
280
|
+
'New widget',
|
|
281
|
+
'widget'
|
|
282
|
+
],
|
|
283
|
+
[
|
|
284
|
+
'New page',
|
|
285
|
+
'page'
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
'New UI-kit component',
|
|
289
|
+
'ui-kit-component'
|
|
290
|
+
],
|
|
291
|
+
[
|
|
292
|
+
`New ${title}`,
|
|
293
|
+
shared
|
|
294
|
+
],
|
|
295
|
+
[
|
|
296
|
+
'Move or rename widget',
|
|
297
|
+
'move-widget'
|
|
298
|
+
],
|
|
299
|
+
[
|
|
300
|
+
'Move or rename page',
|
|
301
|
+
'move-page'
|
|
302
|
+
],
|
|
303
|
+
[
|
|
304
|
+
'Move or rename UI-kit component',
|
|
305
|
+
'move-ui-kit-component'
|
|
306
|
+
],
|
|
307
|
+
[
|
|
308
|
+
`Move or rename ${title}`,
|
|
309
|
+
`move-${shared}`
|
|
310
|
+
],
|
|
311
|
+
[
|
|
312
|
+
'Delete widget',
|
|
313
|
+
'delete-widget'
|
|
314
|
+
],
|
|
315
|
+
[
|
|
316
|
+
'Delete page',
|
|
317
|
+
'delete-page'
|
|
318
|
+
],
|
|
319
|
+
[
|
|
320
|
+
'Delete UI-kit component',
|
|
321
|
+
'delete-ui-kit-component'
|
|
322
|
+
],
|
|
323
|
+
[
|
|
324
|
+
`Delete ${title}`,
|
|
325
|
+
`delete-${shared}`
|
|
326
|
+
]
|
|
327
|
+
];
|
|
328
|
+
};
|
|
320
329
|
const requireProject = ()=>{
|
|
321
330
|
try {
|
|
322
331
|
return new ProjectRoot().path;
|
|
@@ -360,7 +369,7 @@ const frontendModules = (root, rootFolder, framework)=>[
|
|
|
360
369
|
'ui-kit',
|
|
361
370
|
'hook'
|
|
362
371
|
].flatMap((kind)=>findReactModules(node_path.join(root, rootFolder, 'presentation', framework), kind, framework).map((module)=>({
|
|
363
|
-
kind,
|
|
372
|
+
kind: 'svelte' === framework && 'hook' === kind ? 'model' : kind,
|
|
364
373
|
name: module.name,
|
|
365
374
|
file: node_path.relative(root, module.path).split(node_path.sep).join('/')
|
|
366
375
|
})));
|
|
@@ -548,9 +557,9 @@ const executeFrontend = async (request, framework)=>{
|
|
|
548
557
|
'presentation',
|
|
549
558
|
framework
|
|
550
559
|
]);
|
|
551
|
-
const kindOf = (operation)=>operation.endsWith('-page') ? 'page' : operation.endsWith('-widget') ? 'widget' : operation.endsWith('-ui-kit-component') ? 'ui-kit' :
|
|
560
|
+
const kindOf = (operation)=>operation.endsWith('-page') ? 'page' : operation.endsWith('-widget') ? 'widget' : operation.endsWith('-ui-kit-component') ? 'ui-kit' : /-shared-(hook|model)$/.test(operation) ? 'hook' : void 0;
|
|
552
561
|
const kind = /^(move|delete)-/.test(request.operation) ? kindOf(request.operation) : void 0;
|
|
553
|
-
if (kind && !findReactModules(folder.path, kind, framework).length) throw new RequestError('TARGET_NOT_FOUND', `No ${frameworkTitles[framework].title} ${
|
|
562
|
+
if (kind && !findReactModules(folder.path, kind, framework).length) throw new RequestError('TARGET_NOT_FOUND', `No ${frameworkTitles[framework].title} ${frontendKindTitles(framework)[kind][1]} here.`);
|
|
554
563
|
return frontendOperations(folder, framework)[request.operation]();
|
|
555
564
|
};
|
|
556
565
|
const executeAgentRequest = async (command, value)=>{
|