spiderly 19.8.3 → 19.8.5

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 (35) hide show
  1. package/agent/docs/angular-customization/SKILL.md +389 -0
  2. package/agent/docs/angular-customization/references/controls.generated.md +23 -0
  3. package/agent/docs/angular-customization/references/helper-functions.generated.md +39 -0
  4. package/agent/docs/angular-customization/references/ui-control-types.generated.md +24 -0
  5. package/agent/docs/angular-customization/references/validators.generated.md +13 -0
  6. package/agent/docs/authorization/SKILL.md +385 -0
  7. package/agent/docs/authorization/references/api-error-codes.generated.md +17 -0
  8. package/agent/docs/authorization/references/security-endpoints.generated.md +24 -0
  9. package/agent/docs/backend-hooks/SKILL.md +231 -0
  10. package/agent/docs/backend-localization/SKILL.md +170 -0
  11. package/agent/docs/backend-testing/SKILL.md +65 -0
  12. package/agent/docs/custom-endpoints/SKILL.md +409 -0
  13. package/agent/docs/e2e-testing/SKILL.md +139 -0
  14. package/agent/docs/entity-design/SKILL.md +346 -0
  15. package/agent/docs/entity-design/references/attributes.generated.md +53 -0
  16. package/agent/docs/file-storage/SKILL.md +262 -0
  17. package/agent/docs/filtering-patterns/SKILL.md +127 -0
  18. package/agent/docs/filtering-patterns/references/match-mode-codes.generated.md +15 -0
  19. package/agent/docs/frontend-localization/SKILL.md +120 -0
  20. package/agent/docs/mapper-customization/SKILL.md +105 -0
  21. package/agent/manifest.json +34 -0
  22. package/agent/skills/add-entity/SKILL.md +158 -0
  23. package/agent/skills/deployment/SKILL.md +551 -0
  24. package/agent/skills/ef-migrations/SKILL.md +49 -0
  25. package/agent/skills/report-gap/SKILL.md +110 -0
  26. package/agent/skills/report-gap/scripts/build-issue-url.mjs +82 -0
  27. package/agent/skills/spiderly-upgrade/SKILL.md +165 -0
  28. package/agent/skills/verify-ui/SKILL.md +148 -0
  29. package/agent/skills/verify-ui/scripts/get-admin-token.mjs +134 -0
  30. package/fesm2022/spiderly.mjs +14 -8
  31. package/fesm2022/spiderly.mjs.map +1 -1
  32. package/lib/components/auth/login/login.component.d.ts +1 -1
  33. package/lib/components/spiderly-data-table/spiderly-data-table.component.d.ts +29 -3
  34. package/lib/errors/api-error-codes.d.ts +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: add-entity
3
+ description: Scaffold a new Spiderly entity end-to-end (entity class, Angular pages, routes, menu, migration)
4
+ ---
5
+
6
+ # Add Entity Workflow
7
+
8
+ Follow these steps in order. Do not skip ahead.
9
+
10
+ ## Step 1 — Gather Requirements
11
+
12
+ Ask the user:
13
+
14
+ 1. **Entity name** (PascalCase, singular — e.g., `Product`, `BlogPost`)
15
+ 2. **Properties** — for each: name, C# type, required?, string max length, any special attributes
16
+ 3. **Relationships** — many-to-one (required/optional?), many-to-many, ordered one-to-many
17
+ 4. **Base class** — `BusinessObject<long>` (CRUD, default) or `ReadonlyObject<long>` (lookup table)
18
+ 5. **File uploads?** — which properties, storage type (S3 public, Cloudinary, or default file manager)
19
+ 6. **List page format** — data table (default) or data view (card grid)?
20
+
21
+ Do NOT proceed until the user confirms the entity design.
22
+
23
+ ## Step 2 — Run the CLI scaffold
24
+
25
+ **Note:** This command prompts interactively for the entity name. Tell the user to run it themselves in a terminal, then continue with Step 3 once it completes.
26
+
27
+ ```bash
28
+ spiderly add-new-entity
29
+ ```
30
+
31
+ If the user chose data view format:
32
+
33
+ ```bash
34
+ spiderly add-new-entity --data-view
35
+ ```
36
+
37
+ This creates:
38
+
39
+ - `Backend/{App}.Business/Entities/{Entity}.cs` (empty entity with `[DoNotAuthorize]`)
40
+ - `Frontend/src/app/pages/{kebab-name}/{kebab-name}-list.component.ts` + `.html`
41
+ - `Frontend/src/app/pages/{kebab-name}/{kebab-name}-details.component.ts` + `.html`
42
+ - Inserts routes into `Frontend/src/app/app.routes.ts`
43
+ - Inserts menu item into `Frontend/src/app/business/layout/layout.component.ts`
44
+
45
+ ## Step 3 — Write the entity class
46
+
47
+ Use the `entity-design` skill to write the entity with correct attributes. Replace the CLI-generated empty entity.
48
+
49
+ Checklist:
50
+
51
+ - [ ] `[DisplayName]` on the name/title property
52
+ - [ ] `[Required]` on mandatory fields
53
+ - [ ] `[StringLength(max, MinimumLength = min)]` on ALL strings (never omit — avoids NVARCHAR(MAX))
54
+ - [ ] `virtual` on navigation properties
55
+ - [ ] `List<T>` with `{ get; } = new()` on collections
56
+ - [ ] `[WithMany]` on M2O child side, `[CascadeDelete]` or `[SetNull]` for delete behavior
57
+ - [ ] `[UIOrderedOneToMany]` on parent collection + `OrderNumber` on child (if ordered)
58
+ - [ ] `[M2M]` on junction entities with exactly 2 `[M2MWithMany]` properties
59
+ - [ ] File properties: a `StorageAttribute` subclass (`[DiskStorage]` / `[S3PublicStorage]` / `[S3PrivateStorage]` / custom) + `[AcceptedFileTypes]` + `[MaxFileSize]` + `[StringLength]`
60
+ - [ ] Remove `[DoNotAuthorize]` if the entity needs authorization
61
+
62
+ Also add the collection property to related parent entities (e.g., `public virtual List<Product> Products { get; } = new();` on `Category`).
63
+
64
+ ## Step 4 — Build the backend
65
+
66
+ ```bash
67
+ dotnet build
68
+ ```
69
+
70
+ Run from the `Backend/` directory. This triggers Spiderly source generators which produce:
71
+
72
+ - DTOs, services, controllers, validators, mappers, TypeScript classes
73
+
74
+ Fix any build errors before continuing.
75
+
76
+ ## Step 5 — Create and apply the migration
77
+
78
+ ```bash
79
+ spiderly add-migration Add{EntityName}Table
80
+ spiderly update-database
81
+ ```
82
+
83
+ Use PascalCase for migration names. If the migration looks wrong, `spiderly remove-migration` and fix the entity first.
84
+
85
+ ## Step 6 — Customize Angular components
86
+
87
+ ### List component (`{kebab-name}-list.component.ts`)
88
+
89
+ Update the `cols` array in `ngOnInit()` with actual entity columns:
90
+
91
+ ```typescript
92
+ this.cols = [
93
+ {
94
+ name: this.translocoService.translate("Name"),
95
+ filterType: "text",
96
+ field: "name",
97
+ },
98
+ {
99
+ name: this.translocoService.translate("Price"),
100
+ filterType: "numeric",
101
+ field: "price",
102
+ },
103
+ {
104
+ actions: [
105
+ { name: this.translocoService.translate("Details"), field: "Details" },
106
+ { name: this.translocoService.translate("Delete"), field: "Delete" },
107
+ ],
108
+ },
109
+ ];
110
+ ```
111
+
112
+ ### Translation keys
113
+
114
+ Add keys to `Frontend/src/assets/i18n/en.json` (and to any other language files your app uses):
115
+
116
+ ```json
117
+ {
118
+ "{EntityName}": "...",
119
+ "{EntityName}List": "..."
120
+ // property name keys as needed
121
+ }
122
+ ```
123
+
124
+ ### Menu icon (optional)
125
+
126
+ In `layout.component.ts`, change `'pi pi-fw pi-list'` to an appropriate PrimeNG icon.
127
+
128
+ ## Step 7 — Build frontend
129
+
130
+ ```bash
131
+ ng build
132
+ ```
133
+
134
+ From `Frontend/`. Fix any build errors.
135
+
136
+ ## Step 8 — Add backend hooks (if needed)
137
+
138
+ If the entity requires custom business logic (validation, computed fields, side effects), override hooks in `{Entity}Service` (which extends `{Entity}ServiceGenerated`):
139
+
140
+ ```csharp
141
+ protected override async Task OnBeforeSave{Entity}AndReturnMainUIFormDTO(
142
+ {Entity}SaveBodyDTO saveBodyDTO) { }
143
+
144
+ protected override async Task OnAfterSave{Entity}AndReturnMainUIFormDTO(
145
+ {Entity}SaveBodyDTO saveBodyDTO,
146
+ {Entity}MainUIFormDTO mainUIFormDTO) { }
147
+ ```
148
+
149
+ See the `backend-hooks` skill for the full hook reference.
150
+
151
+ ## Step 9 — Verify
152
+
153
+ 1. Start the app (F5 or `dotnet run`)
154
+ 2. Navigate to the new entity's list page
155
+ 3. Create a record, verify all fields save correctly
156
+ 4. Edit the record, verify update works
157
+ 5. Delete the record, verify cascade/set-null behavior
158
+ 6. Check file uploads if applicable