@team-codeme/crud-forge 0.0.0-stage → 1.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.
- package/.cursor/agents/generator-engineer.md +31 -0
- package/.cursor/agents/keycloak-engineer.md +33 -0
- package/.cursor/agents/qa-engineer.md +32 -0
- package/.cursor/agents/security-reviewer.md +30 -0
- package/.cursor/mcp.json +13 -0
- package/.cursor/rules/crudforge-precautions.mdc +16 -0
- package/.cursor/rules/playwright-browser.mdc +30 -0
- package/.cursor/rules/readme-todo-sync.mdc +13 -0
- package/.env.qa.example +19 -0
- package/.github/workflows/qa-live.yml +32 -0
- package/.github/workflows/qa.yml +27 -0
- package/.vscode/settings.json +32 -0
- package/QA/IAM-PLAN.md +25 -0
- package/QA/IAM-RESULTS.md +39 -0
- package/QA/IAM-TESTCASES.md +36 -0
- package/QA/IAM-TODO.md +7 -0
- package/QA/KEYCLOAK-BOOTSTRAP.md +105 -0
- package/QA/PLAN.md +43 -0
- package/QA/RESULTS.md +59 -0
- package/QA/TESTCASES.md +65 -0
- package/QA/TODO.md +14 -0
- package/QA/pmb-dev/README.md +49 -0
- package/QA/pmb-dev/config/config.yml +152 -0
- package/QA/pmb-dev/gdl/i.gdl +17 -0
- package/README.md +851 -2
- package/Todo.md +207 -0
- package/assets/branding/crudforge-logo.png +0 -0
- package/assets/branding/crudforge-mark.png +0 -0
- package/branding/poster-crudforge.jpg +0 -0
- package/chat/last-chat/Investigating Mock Data Configuration.md +428 -0
- package/cli.js +167 -0
- package/config/default-config.yml +245 -0
- package/docs/performance/README.md +217 -0
- package/docs/performance/after.json +111 -0
- package/docs/performance/before.json +111 -0
- package/docs/quality/README.md +276 -0
- package/e2e/crudforge.e2e.yml +47 -0
- package/e2e/crudforge.field-profile.yml +33 -0
- package/e2e/crudforge.iam-live.yml +124 -0
- package/e2e/crudforge.iam.yml +62 -0
- package/e2e/tests/field-profile.spec.js +152 -0
- package/e2e/tests/generated-crud.spec.js +251 -0
- package/e2e/tests/iam-live.spec.js +149 -0
- package/e2e/tests/iam-pack.spec.js +151 -0
- package/e2e/tests/list-state.spec.js +73 -0
- package/features.csv +27 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-mark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-mark.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.jpg +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark-source.png +0 -0
- package/fuse-starter-pack/branding/crudforge-wordmark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/Dockerfile +14 -0
- package/fuse-starter-pack/fuse-v21.1/LICENSE.md +6 -0
- package/fuse-starter-pack/fuse-v21.1/README.md +59 -0
- package/fuse-starter-pack/fuse-v21.1/angular.json +113 -0
- package/fuse-starter-pack/fuse-v21.1/eslint.config.ts +150 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.conf +23 -0
- package/fuse-starter-pack/fuse-v21.1/nginx.dev.conf +18 -0
- package/fuse-starter-pack/fuse-v21.1/package-lock.json +11513 -0
- package/fuse-starter-pack/fuse-v21.1/package.json +69 -0
- package/fuse-starter-pack/fuse-v21.1/postcss.config.json +5 -0
- package/fuse-starter-pack/fuse-v21.1/prettier.config.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/proxy.dev.conf.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/favicon.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/Geist.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono-Italic.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/fonts/geist/GeistMono.woff2 +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/en.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/i18n/es.json +8 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/ES.svg +79 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/US.svg +14 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/flags/where-to-find-other-flags.txt +5 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo-mark.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/public/images/logo/logo.png +0 -0
- package/fuse-starter-pack/fuse-v21.1/push.sh +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.server.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.config.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.server.ts +8 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.routes.ts +39 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/app.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/index.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/lucide.ts +1 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/icons/provider.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/local-storage.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/local-storage/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/index.ts +2 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/media.ts +64 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/media/provider.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/index.ts +3 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/models/theming.ts +13 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/palette.ts +209 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/provider.ts +24 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/theming/theming.ts +129 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/core/transloco/transloco-http-loader.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/data/navigation.ts +176 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/layout.ts +77 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/language-switcher.ts +91 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/navigation.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/notifications.ts +252 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/scheme-switcher.ts +58 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/sidebar.ts +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/layout/ui/user.ts +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/academy.ts +753 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/data/model.ts +27 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/course.ts +318 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/features/courses.ts +228 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/academy/routes.ts +14 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/contacts.ts +4372 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/data/model.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contact.ts +239 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/features/contacts.ts +185 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/contacts/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/file-manager.ts +261 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/data/model.ts +12 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/features/file-manager.ts +131 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/routes.ts +15 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/file-manager/ui/list.ts +164 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/faq.ts +288 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/guide.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/home.ts +219 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/features/support.ts +161 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/help-center/routes.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/model.ts +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/data/notes.ts +324 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/note.ts +152 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/features/notes.ts +118 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/notes/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/model.ts +17 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/data/tasks.ts +562 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/task.ts +195 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/features/tasks.ts +271 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/apps/tasks/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/analytics.ts +1620 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/finance.ts +1065 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/data/project.ts +376 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/analytics/analytics.ts +1096 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/finance/finance.ts +658 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/budget-table.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/features/project/project.ts +565 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/dashboards/routes.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/changelog/changelog.ts +932 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/building.ts +33 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/development.ts +42 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/features/getting-started/installation.ts +47 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/documentation/routes.ts +45 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/features/error-page.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/error/routes.ts +21 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/features/notifications.ts +262 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/notifications/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/account.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/notifications.ts +134 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/plan-and-billing.ts +238 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/security.ts +211 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/features/team.ts +188 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/layout.ts +109 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/settings/routes.ts +37 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/modules/extras/welcome/welcome.component.ts +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/admin/routes.ts +95 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.html +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/forgot-password/forgot-password.ts +51 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.html +82 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/reset-password/reset-password.ts +69 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.html +132 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-in/sign-in.ts +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.html +183 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/features/sign-up/sign-up.ts +56 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/auth/routes.ts +34 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/features/coming-soon.ts +156 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/coming-soon/routes.ts +16 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/layout/layout.ts +9 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/features/home.ts +23 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/modules/home/routes.ts +10 -0
- package/fuse-starter-pack/fuse-v21.1/src/app/domains/website/routes.ts +30 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.mock.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.prod.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/environments/environment.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/index.html +66 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.server.ts +11 -0
- package/fuse-starter-pack/fuse-v21.1/src/main.ts +5 -0
- package/fuse-starter-pack/fuse-v21.1/src/server.ts +70 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/base.css +63 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/base/typography.css +54 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/a.css +18 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/input.css +22 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/kbd.css +55 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/components/material.css +1149 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/styles.css +31 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/theme.css +147 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/utilities.css +563 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/tailwind/variants.css +4 -0
- package/fuse-starter-pack/fuse-v21.1/src/styles/third-party/lucide-icons.css +12 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.app.json +16 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.json +37 -0
- package/fuse-starter-pack/fuse-v21.1/tsconfig.spec.json +10 -0
- package/generator/README.md +12 -0
- package/generator/issues/.gitkeep +0 -0
- package/package.json +56 -4
- package/playwright.config.js +29 -0
- package/playwright.field-profile.config.js +6 -0
- package/playwright.iam-live.config.js +31 -0
- package/playwright.iam.config.js +29 -0
- package/playwright.list-state.config.js +6 -0
- package/playwright.performance.config.js +1 -0
- package/run-config-tests.sh +5 -0
- package/scripts/e2e-paths.js +89 -0
- package/scripts/e2e-prepare-field-profile.js +17 -0
- package/scripts/e2e-prepare-iam-live.js +135 -0
- package/scripts/e2e-prepare-iam.js +65 -0
- package/scripts/e2e-prepare.js +72 -0
- package/scripts/e2e-serve-iam-live.js +28 -0
- package/scripts/e2e-serve-iam.js +28 -0
- package/scripts/e2e-serve.js +28 -0
- package/scripts/performance/generate.js +17 -0
- package/scripts/performance/measure.js +55 -0
- package/scripts/postinstall.js +9 -0
- package/scripts/prepare-quality-apps.js +34 -0
- package/scripts/run-config-tests.js +63 -0
- package/src/assets/logo-with-lable.jpeg +0 -0
- package/src/assets/logo.jpeg +0 -0
- package/src/commands/bootstrap.js +92 -0
- package/src/commands/doctor.js +403 -0
- package/src/commands/generate.js +301 -0
- package/src/commands/init-config.js +310 -0
- package/src/commands/keycloak-options.js +182 -0
- package/src/commands/validate.js +52 -0
- package/src/config/auth-config.js +183 -0
- package/src/config/default-values.js +235 -0
- package/src/config/env-refs.js +71 -0
- package/src/config/field-preferences.js +99 -0
- package/src/config/input-sources.js +104 -0
- package/src/config/load-config.js +166 -0
- package/src/config/proxy-routes.js +44 -0
- package/src/generator/access-control-tools.js +334 -0
- package/src/generator/ai-docs.js +691 -0
- package/src/generator/application-tests.js +252 -0
- package/src/generator/auth-pack.js +965 -0
- package/src/generator/embed-config.js +431 -0
- package/src/generator/entity-layout.js +30 -0
- package/src/generator/fuse-build.js +57 -0
- package/src/generator/fuse-runtime.js +344 -0
- package/src/generator/generated-banner.js +137 -0
- package/src/generator/index.js +874 -0
- package/src/generator/project-output.js +126 -0
- package/src/generator/team-pack.js +220 -0
- package/src/index.js +68 -0
- package/src/parser/gdl-parser.js +169 -0
- package/src/parser/jdl-parser.js +171 -0
- package/src/presets/pmb-test.js +139 -0
- package/src/presets/static-source.js +73 -0
- package/src/presets/store.js +96 -0
- package/src/provision/admin-service.js +148 -0
- package/src/provision/bootstrap.js +147 -0
- package/src/provision/http.js +123 -0
- package/src/provision/keycloak-admin-rest.js +335 -0
- package/src/provision/state.js +51 -0
- package/src/provision/token.js +52 -0
- package/src/templates/angular/auth/access-control.service.ts.ejs +179 -0
- package/src/templates/angular/auth/access-ctrl.pipe.ts.ejs +20 -0
- package/src/templates/angular/auth/auth.guard.ts.ejs +27 -0
- package/src/templates/angular/auth/auth.interceptor.ts.ejs +53 -0
- package/src/templates/angular/auth/auth.service.ts.ejs +594 -0
- package/src/templates/angular/auth/auth.utils.ts.ejs +28 -0
- package/src/templates/angular/auth/current-user.ts.ejs +24 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.css.ejs +95 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.html.ejs +33 -0
- package/src/templates/angular/auth/disabled-account-overlay.component.ts.ejs +23 -0
- package/src/templates/angular/auth/fuse-account.ts.ejs +234 -0
- package/src/templates/angular/auth/fuse-user.ts.ejs +264 -0
- package/src/templates/angular/auth/has-permission.directive.ts.ejs +51 -0
- package/src/templates/angular/auth/index.ts.ejs +24 -0
- package/src/templates/angular/auth/keycloak-admin.service.ts.ejs +670 -0
- package/src/templates/angular/auth/landing.guard.ts.ejs +61 -0
- package/src/templates/angular/auth/no-auth.guard.ts.ejs +19 -0
- package/src/templates/angular/auth/permission-attribute.util.ts.ejs +182 -0
- package/src/templates/angular/auth/sign-in.ts.ejs +60 -0
- package/src/templates/angular/entity/_entity_.model.ts.ejs +64 -0
- package/src/templates/angular/entity/_entity_.routes.ts.ejs +9 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.html.ejs +168 -0
- package/src/templates/angular/entity/components/forms/form/_entity_-form.component.ts.ejs +175 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.html.ejs +10 -0
- package/src/templates/angular/entity/components/forms/form-page/_entity_-form-page.component.ts.ejs +86 -0
- package/src/templates/angular/entity/components/forms/update/_entity_-form.service.ts.ejs +136 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.html.ejs +68 -0
- package/src/templates/angular/entity/components/interaction/actions/_entity_-actions.component.ts.ejs +69 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.html.ejs +111 -0
- package/src/templates/angular/entity/components/interaction/filter/_entity_-filter.component.ts.ejs +102 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.css.ejs +33 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.html.ejs +29 -0
- package/src/templates/angular/entity/components/presentation/card/_entity_-card.component.ts.ejs +93 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.css.ejs +54 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.html.ejs +58 -0
- package/src/templates/angular/entity/components/presentation/detail/_entity_-detail.component.ts.ejs +47 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.html.ejs +419 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.scss.ejs +48 -0
- package/src/templates/angular/entity/components/presentation/list/_entity_-list.component.ts.ejs +592 -0
- package/src/templates/angular/entity/service/_entity_.service.ts.ejs +153 -0
- package/src/templates/angular/entity/settings/_entity_.settings.ts.ejs +49 -0
- package/src/templates/angular/enums/_enum_.model.ts.ejs +11 -0
- package/src/templates/angular/iam/change-password.component.html.ejs +39 -0
- package/src/templates/angular/iam/change-password.component.ts.ejs +44 -0
- package/src/templates/angular/iam/no-access.component.ts.ejs +17 -0
- package/src/templates/angular/iam/role-list.component.html.ejs +331 -0
- package/src/templates/angular/iam/role-list.component.scss.ejs +107 -0
- package/src/templates/angular/iam/role-list.component.ts.ejs +597 -0
- package/src/templates/angular/iam/role-management/role-header.component.html.ejs +51 -0
- package/src/templates/angular/iam/role-management/role-header.component.ts.ejs +45 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.html.ejs +15 -0
- package/src/templates/angular/iam/role-management/role-inheritance.component.ts.ejs +19 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.css.ejs +24 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.html.ejs +108 -0
- package/src/templates/angular/iam/role-management/role-permissions-panel.component.ts.ejs +122 -0
- package/src/templates/angular/iam/role-management/role-users.component.html.ejs +104 -0
- package/src/templates/angular/iam/role-management/role-users.component.ts.ejs +53 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.html.ejs +113 -0
- package/src/templates/angular/iam/role-management/user-select-dialog.component.ts.ejs +157 -0
- package/src/templates/angular/iam/role-permission-matrix.component.html.ejs +355 -0
- package/src/templates/angular/iam/role-permission-matrix.component.scss.ejs +217 -0
- package/src/templates/angular/iam/role-permission-matrix.component.ts.ejs +800 -0
- package/src/templates/angular/iam/screen-catalog.ts.ejs +147 -0
- package/src/templates/angular/iam/shared/confirm-dialog.component.ts.ejs +83 -0
- package/src/templates/angular/iam/shared/matrix-hierarchy.util.ts.ejs +196 -0
- package/src/templates/angular/iam/shared/permission-matrix-sound.ts.ejs +59 -0
- package/src/templates/angular/iam/shared/role-display.util.ts.ejs +43 -0
- package/src/templates/angular/iam/shared/role-permission-skeleton.component.ts.ejs +54 -0
- package/src/templates/angular/iam/shared/screen-matrix.util.ts.ejs +554 -0
- package/src/templates/angular/iam/shared/screen-navigation-map.ts.ejs +187 -0
- package/src/templates/angular/iam/shared/screen-navigation.registry.ts.ejs +64 -0
- package/src/templates/angular/iam/shared/text-highlight.pipe.ts.ejs +39 -0
- package/src/templates/angular/iam/user-access-matrix.component.html.ejs +212 -0
- package/src/templates/angular/iam/user-access-matrix.component.scss.ejs +34 -0
- package/src/templates/angular/iam/user-access-matrix.component.ts.ejs +239 -0
- package/src/templates/angular/iam/user-detail.component.html.ejs +143 -0
- package/src/templates/angular/iam/user-detail.component.ts.ejs +108 -0
- package/src/templates/angular/iam/user-form.component.html.ejs +63 -0
- package/src/templates/angular/iam/user-form.component.ts.ejs +100 -0
- package/src/templates/angular/iam/user-list.component.html.ejs +369 -0
- package/src/templates/angular/iam/user-list.component.scss.ejs +242 -0
- package/src/templates/angular/iam/user-list.component.ts.ejs +446 -0
- package/src/templates/angular/iam/user-management.routes.ts.ejs +47 -0
- package/src/templates/angular/iam/user-permission-matrix.component.html.ejs +231 -0
- package/src/templates/angular/iam/user-permission-matrix.component.scss.ejs +216 -0
- package/src/templates/angular/iam/user-permission-matrix.component.ts.ejs +516 -0
- package/src/templates/angular/shared/base/audit-user-name.pipe.ts.ejs +69 -0
- package/src/templates/angular/shared/base/base-filter.component.ts.ejs +245 -0
- package/src/templates/angular/shared/base/base-form.component.ts.ejs +109 -0
- package/src/templates/angular/shared/base/base-list.component.ts.ejs +507 -0
- package/src/templates/angular/shared/base/filter-types.ts.ejs +55 -0
- package/src/templates/angular/shared/base/input-format.directive.ts.ejs +47 -0
- package/src/templates/angular/shared/base/input-format.ts.ejs +15 -0
- package/src/templates/angular/shared/confirm-with-input-dialog.component.ts.ejs +91 -0
- package/src/templates/angular/shared/confirmation-dialog.component.ts.ejs +80 -0
- package/src/templates/angular/shared/list-styles.css.ejs +103 -0
- package/src/templates/angular/shared/loading-overlay.component.ts.ejs +24 -0
- package/src/templates/angular/shared/resizable.directive.ts.ejs +115 -0
- package/src/templates/angular/shared/snackbar-styles.css.ejs +11 -0
- package/src/templates/fuse-packs/access-control-tools/access-control-sync.js +819 -0
- package/src/templates/fuse-packs/access-control-tools/build-rename-map.js +67 -0
- package/src/templates/fuse-packs/access-control-tools/inject-qa-ids.js +14 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.js +628 -0
- package/src/templates/fuse-packs/access-control-tools/lib/hierarchy-scanner.test.js +323 -0
- package/src/templates/fuse-packs/access-control-tools/lib/html-scanner.js +362 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.duplicate.test.js +136 -0
- package/src/templates/fuse-packs/access-control-tools/lib/id-rules.js +1095 -0
- package/src/templates/fuse-packs/access-control-tools/lib/ts-component-index.js +482 -0
- package/src/templates/fuse-packs/access-control-tools/output/.gitkeep +0 -0
- package/src/templates/fuse-packs/access-control-tools/run.sh +223 -0
- package/src/templates/fuse-packs/access-control-tools/scan-access-control.js +14 -0
- package/src/templates/fuse-packs/iam-assets/sound/apple-play.mp3 +0 -0
- package/src/templates/fuse-packs/iam-assets/sound/remove.mp3 +0 -0
- package/src/templates/generator/README.md +12 -0
- package/src/templates/testing/ci.cjs +45 -0
- package/src/templates/testing/mock.cjs +149 -0
- package/src/templates/testing/playwright.config.cjs +25 -0
- package/src/templates/testing/serve.cjs +22 -0
- package/src/templates/testing/smoke.spec.cjs +180 -0
- package/src/utils/branding.js +39 -0
- package/src/utils/colors.js +18 -0
- package/src/utils/diff.js +109 -0
- package/src/utils/merger.js +115 -0
- package/src/validator/backend-diagnostics.js +30 -0
- package/src/validator/blueprint-validator.js +276 -0
- package/src/validator/diagnostics.js +608 -0
- package/src/validator/pattern.js +28 -0
- package/test/auth-interceptor.js +84 -0
- package/test/auth-provision-checks.js +297 -0
- package/test/field-preferences.js +145 -0
- package/test/fixtures/field-profile.gdl +7 -0
- package/test/fixtures/mock.jdl +17 -0
- package/test/fixtures/mock.png +0 -0
- package/test/fixtures/performance/config.yml +33 -0
- package/test/fixtures/performance/large.gdl +199 -0
- package/test/fixtures/performance/small.gdl +7 -0
- package/test/fixtures/quality/custom.yml +22 -0
- package/test/fixtures/quality/go-duck.yml +22 -0
- package/test/fixtures/quality/jhipster.yml +30 -0
- package/test/fixtures/quality/representative.gdl +14 -0
- package/test/list-state.js +138 -0
- package/test/micro-functions-layout.js +95 -0
- package/test/performance-generation.js +32 -0
- package/test/pmb-preset.js +127 -0
- package/test/project-workflow.js +111 -0
- package/test/quality-features.js +250 -0
- package/test/verify-commands.js +83 -0
- package/test/verify.js +959 -0
- package/test-files/GDL/example.gdl +15 -0
- package/test-files/JDL/example.jdl +15 -0
- package/test-files/config/crudforge.config.yml +127 -0
- package/test-run.sh +272 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const os = require('os');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const inquirer = require('inquirer');
|
|
5
|
+
const { generate } = require('./index');
|
|
6
|
+
const { mergeContent } = require('../utils/merger');
|
|
7
|
+
|
|
8
|
+
function inside(root, file) {
|
|
9
|
+
const relative = path.relative(root, file);
|
|
10
|
+
return relative === '' || (!relative.startsWith('..' + path.sep) && relative !== '..' && !path.isAbsolute(relative));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function filesIn(directory) {
|
|
14
|
+
return fs.readdirSync(directory, { withFileTypes: true }).flatMap(entry => {
|
|
15
|
+
const file = path.join(directory, entry.name);
|
|
16
|
+
if (entry.isSymbolicLink()) throw new Error(`Cannot publish a generated symlink: ${file}`);
|
|
17
|
+
return entry.isDirectory() ? filesIn(file) : [file];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function checkDestination(root, file) {
|
|
22
|
+
let current = file;
|
|
23
|
+
while (inside(root, current)) {
|
|
24
|
+
if (fs.existsSync(current) || fs.lstatSync(current, { throwIfNoEntry: false })) {
|
|
25
|
+
const stat = fs.lstatSync(current);
|
|
26
|
+
if (stat.isSymbolicLink()) throw new Error(`Refusing to write through symlink "${current}".`);
|
|
27
|
+
if (current !== file && !stat.isDirectory()) throw new Error(`Expected a directory at "${current}".`);
|
|
28
|
+
if (current === file && !stat.isFile()) throw new Error(`Expected a file at "${current}".`);
|
|
29
|
+
}
|
|
30
|
+
if (current === root) break;
|
|
31
|
+
current = path.dirname(current);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The old engine performs multi-pass transformations of the starter. Complete those
|
|
36
|
+
// privately, then apply policy once to each final file (including binary assets).
|
|
37
|
+
async function generateProject(parsed, config, { configPath, inputPath, options = {} } = {}) {
|
|
38
|
+
require('../config/field-preferences').validateFieldPreferences(config, parsed.entities, configPath || config._configPath || 'fields configuration');
|
|
39
|
+
const output = path.resolve(config.output.directory);
|
|
40
|
+
const policy = config.output.overwritePolicy || 'fail';
|
|
41
|
+
for (const key of ['routesFile', 'navigationFile']) {
|
|
42
|
+
if (config.fuse?.[key] && !inside(output, path.resolve(output, config.fuse[key]))) {
|
|
43
|
+
throw new Error(`fuse.${key} must be inside the output project: ${config.fuse[key]}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const stage = await fs.mkdtemp(path.join(os.tmpdir(), 'crudforge-generate-'));
|
|
47
|
+
try {
|
|
48
|
+
const staged = JSON.parse(JSON.stringify(config));
|
|
49
|
+
staged.output.directory = stage;
|
|
50
|
+
staged.output.overwritePolicy = 'overwrite';
|
|
51
|
+
// The source config is developer-owned, not a generated snapshot.
|
|
52
|
+
if (configPath && inside(output, configPath)) staged.output.embedConfig = false;
|
|
53
|
+
staged.git = { ...staged.git, enabled: false };
|
|
54
|
+
staged.dryRun = false;
|
|
55
|
+
const stats = await generate(parsed, staged);
|
|
56
|
+
// Snapshots describe the real project, never the temporary staging directory.
|
|
57
|
+
const { formatEmbeddableYaml } = require('./embed-config');
|
|
58
|
+
for (const relative of ['config/crudforge.config.yml', '.crudforge/config.yaml']) {
|
|
59
|
+
const snapshot = path.join(stage, relative);
|
|
60
|
+
if (fs.existsSync(snapshot)) await fs.writeFile(snapshot, formatEmbeddableYaml({
|
|
61
|
+
...config, output: { ...config.output, overwritePolicy: policy },
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// Preserve legacy credential flags, but prepare their files only after schema validation.
|
|
65
|
+
if (!config.dryRun && (options.kcUsername || options.kcPassword)) {
|
|
66
|
+
const { applyDeveloperKeycloakOptions } = require('../commands/keycloak-options');
|
|
67
|
+
await applyDeveloperKeycloakOptions(staged, options, { outputDir: stage, cwd: stage });
|
|
68
|
+
}
|
|
69
|
+
const changes = [];
|
|
70
|
+
for (const source of filesIn(stage)) {
|
|
71
|
+
const relative = path.relative(stage, source);
|
|
72
|
+
const target = path.join(output, relative);
|
|
73
|
+
if ([configPath, inputPath].filter(Boolean).some(file => path.resolve(file) === target)) continue;
|
|
74
|
+
// Never generate over other editable project input files either.
|
|
75
|
+
if (/^(config|gdl)[/\\]/.test(relative) && fs.existsSync(target)) continue;
|
|
76
|
+
checkDestination(output, target);
|
|
77
|
+
const content = fs.readFileSync(source);
|
|
78
|
+
const exists = fs.existsSync(target);
|
|
79
|
+
const old = exists ? fs.readFileSync(target) : null;
|
|
80
|
+
if (old?.equals(content)) continue;
|
|
81
|
+
changes.push({ source, target, relative, content, old });
|
|
82
|
+
}
|
|
83
|
+
const conflicts = changes.filter(change => change.old !== null);
|
|
84
|
+
if (!config.dryRun && conflicts.length && (policy === 'fail' || (policy === 'ask' && !process.stdout.isTTY))) {
|
|
85
|
+
throw new Error(`Existing application files differ:\n${conflicts.map(c => ' ' + c.target).join('\n')}\nNo project files were changed. Choose --overwrite-policy ask, skip, merge, or overwrite explicitly.`);
|
|
86
|
+
}
|
|
87
|
+
const dryRunReport = { newFiles: [], modifiedFiles: [] };
|
|
88
|
+
for (const change of changes) {
|
|
89
|
+
const binary = !Buffer.from(change.content.toString('utf8')).equals(change.content) || change.content.includes(0);
|
|
90
|
+
if (config.dryRun) {
|
|
91
|
+
dryRunReport[change.old ? 'modifiedFiles' : 'newFiles'].push({
|
|
92
|
+
path: change.relative,
|
|
93
|
+
content: binary ? '[binary asset]' : change.content.toString('utf8'),
|
|
94
|
+
oldContent: change.old ? (binary ? '[binary asset]' : change.old.toString('utf8')) : undefined,
|
|
95
|
+
});
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let action = change.old ? policy : 'overwrite';
|
|
99
|
+
if (action === 'ask') {
|
|
100
|
+
const answer = await inquirer.prompt([{
|
|
101
|
+
type: 'list', name: 'action', message: `Existing file: ${change.target}`,
|
|
102
|
+
choices: binary ? ['skip', 'overwrite'] : ['skip', 'merge', 'overwrite'],
|
|
103
|
+
}]);
|
|
104
|
+
action = answer.action;
|
|
105
|
+
}
|
|
106
|
+
if (action === 'skip') { change.skip = true; continue; }
|
|
107
|
+
// Merge cannot patch binaries (logos, sounds, fonts) — keep the existing file.
|
|
108
|
+
if (action === 'merge' && binary) { change.skip = true; continue; }
|
|
109
|
+
if (action === 'merge') change.content = Buffer.from(mergeContent(change.old.toString('utf8'), change.content.toString('utf8')));
|
|
110
|
+
}
|
|
111
|
+
if (!config.dryRun) {
|
|
112
|
+
for (const change of changes.filter(change => !change.skip)) {
|
|
113
|
+
await fs.ensureDir(path.dirname(change.target));
|
|
114
|
+
await fs.writeFile(change.target, change.content);
|
|
115
|
+
await fs.chmod(change.target, fs.statSync(change.source).mode & 0o777);
|
|
116
|
+
}
|
|
117
|
+
if (config.fuse?.enabled) require('./team-pack').initGitRepository(output, config);
|
|
118
|
+
}
|
|
119
|
+
return { ...stats, fileCount: changes.filter(change => !change.skip).length,
|
|
120
|
+
dryRun: !!config.dryRun, dryRunReport: config.dryRun ? dryRunReport : null, conflicts: [] };
|
|
121
|
+
} finally {
|
|
122
|
+
await fs.remove(stage);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
module.exports = { generateProject };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Seed Cursor / Codex / Antigravity / VS Code team folders into the generated Fuse root.
|
|
7
|
+
* Enabled by default via output.teamPack.enabled.
|
|
8
|
+
*/
|
|
9
|
+
function applyTeamPack(outputDir, config, writeOrPreview) {
|
|
10
|
+
const pack = config.output?.teamPack || {};
|
|
11
|
+
if (pack.enabled === false) {
|
|
12
|
+
return { applied: false, reason: 'output.teamPack.enabled=false' };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const cliRoot = path.resolve(__dirname, '../..');
|
|
16
|
+
const written = [];
|
|
17
|
+
const cursorSrc = path.join(cliRoot, '.cursor', 'agents');
|
|
18
|
+
|
|
19
|
+
if (pack.cursorAgents !== false) {
|
|
20
|
+
written.push(...copyAgentDir(
|
|
21
|
+
cursorSrc,
|
|
22
|
+
path.join(outputDir, '.cursor', 'agents'),
|
|
23
|
+
writeOrPreview
|
|
24
|
+
));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (pack.codexAgents !== false) {
|
|
28
|
+
const codexSrc = path.join(cliRoot, '.codex', 'agents');
|
|
29
|
+
const source = fs.existsSync(codexSrc) ? codexSrc : cursorSrc;
|
|
30
|
+
written.push(...copyAgentDir(source, path.join(outputDir, '.codex', 'agents'), writeOrPreview));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (pack.antigravityAgents !== false) {
|
|
34
|
+
const antigravitySrc = path.join(cliRoot, '.agents', 'agents');
|
|
35
|
+
const source = fs.existsSync(antigravitySrc) ? antigravitySrc : cursorSrc;
|
|
36
|
+
written.push(...copyAgentDir(
|
|
37
|
+
source,
|
|
38
|
+
path.join(outputDir, '.agents', 'agents'),
|
|
39
|
+
writeOrPreview
|
|
40
|
+
));
|
|
41
|
+
written.push(...writeAntigravityRules(source, outputDir, writeOrPreview));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (pack.vscodeExtensions !== false) {
|
|
45
|
+
written.push(...writeVscodeTeamFiles(outputDir, writeOrPreview));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { applied: true, files: written };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function copyAgentDir(srcDir, destDir, writeOrPreview) {
|
|
52
|
+
const written = [];
|
|
53
|
+
if (!fs.existsSync(srcDir)) {
|
|
54
|
+
return written;
|
|
55
|
+
}
|
|
56
|
+
const entries = fs.readdirSync(srcDir).filter((name) => name.endsWith('.md'));
|
|
57
|
+
for (const name of entries) {
|
|
58
|
+
const content = fs.readFileSync(path.join(srcDir, name), 'utf8');
|
|
59
|
+
const target = path.join(destDir, name);
|
|
60
|
+
writeOrPreview(target, content);
|
|
61
|
+
written.push(target);
|
|
62
|
+
}
|
|
63
|
+
return written;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Antigravity discovers workspace specialists under `.agents/rules/*.md`
|
|
68
|
+
* (model_decision). Agent personas also land in `.agents/agents/` via copyAgentDir.
|
|
69
|
+
*/
|
|
70
|
+
function writeAntigravityRules(srcDir, outputDir, writeOrPreview) {
|
|
71
|
+
const written = [];
|
|
72
|
+
if (!fs.existsSync(srcDir)) {
|
|
73
|
+
return written;
|
|
74
|
+
}
|
|
75
|
+
const entries = fs.readdirSync(srcDir).filter((name) => name.endsWith('.md'));
|
|
76
|
+
for (const name of entries) {
|
|
77
|
+
const raw = fs.readFileSync(path.join(srcDir, name), 'utf8');
|
|
78
|
+
const { description, body } = parseAgentMarkdown(raw);
|
|
79
|
+
const content = [
|
|
80
|
+
'---',
|
|
81
|
+
'trigger: model_decision',
|
|
82
|
+
`description: ${yamlDoubleQuoted(description || name.replace(/\.md$/, ''))}`,
|
|
83
|
+
'---',
|
|
84
|
+
'',
|
|
85
|
+
body.trimStart(),
|
|
86
|
+
].join('\n');
|
|
87
|
+
const target = path.join(outputDir, '.agents', 'rules', name);
|
|
88
|
+
writeOrPreview(target, content.endsWith('\n') ? content : `${content}\n`);
|
|
89
|
+
written.push(target);
|
|
90
|
+
}
|
|
91
|
+
return written;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function parseAgentMarkdown(raw) {
|
|
95
|
+
const match = String(raw || '').match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
96
|
+
if (!match) {
|
|
97
|
+
return { description: '', body: String(raw || '') };
|
|
98
|
+
}
|
|
99
|
+
const front = match[1];
|
|
100
|
+
const body = match[2] || '';
|
|
101
|
+
const descLine = front.split(/\r?\n/).find((line) => /^\s*description\s*:/.test(line));
|
|
102
|
+
let description = '';
|
|
103
|
+
if (descLine) {
|
|
104
|
+
description = descLine.replace(/^\s*description\s*:\s*/, '').trim();
|
|
105
|
+
if (
|
|
106
|
+
(description.startsWith('"') && description.endsWith('"')) ||
|
|
107
|
+
(description.startsWith("'") && description.endsWith("'"))
|
|
108
|
+
) {
|
|
109
|
+
description = description.slice(1, -1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return { description, body };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function yamlDoubleQuoted(value) {
|
|
116
|
+
return `"${String(value || '').replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function writeVscodeTeamFiles(outputDir, writeOrPreview) {
|
|
120
|
+
const written = [];
|
|
121
|
+
const extensionsDir = path.join(outputDir, '.vscode', 'extensions');
|
|
122
|
+
const readme = `# Keep-team VS Code / Cursor extensions
|
|
123
|
+
|
|
124
|
+
Recommended extensions are listed in \`../extensions.json\`.
|
|
125
|
+
Install them via the Extensions view ("Show Recommended Extensions").
|
|
126
|
+
|
|
127
|
+
This folder is reserved for team extension notes and local extension packs.
|
|
128
|
+
Do not commit proprietary VSIX binaries unless your team policy requires it.
|
|
129
|
+
`;
|
|
130
|
+
writeOrPreview(path.join(extensionsDir, 'README.md'), readme);
|
|
131
|
+
written.push(path.join(extensionsDir, 'README.md'));
|
|
132
|
+
|
|
133
|
+
const extensionsJson = {
|
|
134
|
+
recommendations: [
|
|
135
|
+
'angular.ng-template',
|
|
136
|
+
'dbaeumer.vscode-eslint',
|
|
137
|
+
'esbenp.prettier-vscode',
|
|
138
|
+
'ms-playwright.playwright',
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
writeOrPreview(
|
|
142
|
+
path.join(outputDir, '.vscode', 'extensions.json'),
|
|
143
|
+
`${JSON.stringify(extensionsJson, null, 2)}\n`
|
|
144
|
+
);
|
|
145
|
+
written.push(path.join(outputDir, '.vscode', 'extensions.json'));
|
|
146
|
+
|
|
147
|
+
const settings = {
|
|
148
|
+
'editor.formatOnSave': true,
|
|
149
|
+
'editor.defaultFormatter': 'esbenp.prettier-vscode',
|
|
150
|
+
'files.exclude': {
|
|
151
|
+
'**/.angular': true,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
writeOrPreview(
|
|
155
|
+
path.join(outputDir, '.vscode', 'settings.json'),
|
|
156
|
+
`${JSON.stringify(settings, null, 2)}\n`
|
|
157
|
+
);
|
|
158
|
+
written.push(path.join(outputDir, '.vscode', 'settings.json'));
|
|
159
|
+
|
|
160
|
+
return written;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Initialize git and set origin when project.repositoryUrl is set.
|
|
165
|
+
* Does not push. Does not force-change an existing remote.
|
|
166
|
+
*/
|
|
167
|
+
function initGitRepository(outputDir, config) {
|
|
168
|
+
const url = String(config.project?.repositoryUrl || config.git?.repositoryUrl || '').trim();
|
|
169
|
+
if (!url) {
|
|
170
|
+
return { initialized: false, reason: 'no project.repositoryUrl' };
|
|
171
|
+
}
|
|
172
|
+
if (config.git?.enabled === false) {
|
|
173
|
+
return { initialized: false, reason: 'git.enabled=false' };
|
|
174
|
+
}
|
|
175
|
+
if (config.dryRun) {
|
|
176
|
+
return { initialized: false, dryRun: true, wouldUse: url };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const gitDir = path.join(outputDir, '.git');
|
|
180
|
+
if (!fs.existsSync(gitDir)) {
|
|
181
|
+
const init = spawnSync('git', ['init'], { cwd: outputDir, encoding: 'utf8' });
|
|
182
|
+
if (init.status !== 0) {
|
|
183
|
+
throw new Error(`git init failed in ${outputDir}: ${init.stderr || init.stdout}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const remotes = spawnSync('git', ['remote'], { cwd: outputDir, encoding: 'utf8' });
|
|
188
|
+
const remoteList = (remotes.stdout || '').split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
|
|
189
|
+
if (!remoteList.includes('origin')) {
|
|
190
|
+
const add = spawnSync('git', ['remote', 'add', 'origin', url], {
|
|
191
|
+
cwd: outputDir,
|
|
192
|
+
encoding: 'utf8',
|
|
193
|
+
});
|
|
194
|
+
if (add.status !== 0) {
|
|
195
|
+
throw new Error(`git remote add origin failed: ${add.stderr || add.stdout}`);
|
|
196
|
+
}
|
|
197
|
+
return { initialized: true, remote: 'origin', url, createdRemote: true };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const existing = spawnSync('git', ['remote', 'get-url', 'origin'], {
|
|
201
|
+
cwd: outputDir,
|
|
202
|
+
encoding: 'utf8',
|
|
203
|
+
});
|
|
204
|
+
const current = (existing.stdout || '').trim();
|
|
205
|
+
if (current && current !== url) {
|
|
206
|
+
return {
|
|
207
|
+
initialized: true,
|
|
208
|
+
remote: 'origin',
|
|
209
|
+
url: current,
|
|
210
|
+
createdRemote: false,
|
|
211
|
+
warning: `origin already points to ${current}; left unchanged (config wanted ${url})`,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return { initialized: true, remote: 'origin', url: current || url, createdRemote: false };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
module.exports = {
|
|
218
|
+
applyTeamPack,
|
|
219
|
+
initGitRepository,
|
|
220
|
+
};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const { loadConfig } = require('./config/load-config');
|
|
3
|
+
const { parseJdl } = require('./parser/jdl-parser');
|
|
4
|
+
const { parseGdl } = require('./parser/gdl-parser');
|
|
5
|
+
const { generate } = require('./generator');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Main programmatic entry point for generating code.
|
|
9
|
+
* @param {string} fileContent - Raw content of the JDL/GDL file.
|
|
10
|
+
* @param {object} options - Custom options to override config.
|
|
11
|
+
*/
|
|
12
|
+
async function generateFromSource(fileContent, options = {}) {
|
|
13
|
+
const { config } = await loadConfig(process.cwd(), options.configPath);
|
|
14
|
+
|
|
15
|
+
// Merge options parameter overrides
|
|
16
|
+
if (options.microservice) config.api.microservice = options.microservice;
|
|
17
|
+
if (options.outputDirectory) config.output.directory = options.outputDirectory;
|
|
18
|
+
if (options.validation !== undefined) config.validation = options.validation;
|
|
19
|
+
if (options.dryRun !== undefined) config.dryRun = options.dryRun;
|
|
20
|
+
if (options.generate !== undefined) {
|
|
21
|
+
config.generate = { ...config.generate, ...options.generate };
|
|
22
|
+
}
|
|
23
|
+
if (options.fuse !== undefined) {
|
|
24
|
+
config.fuse = _.defaultsDeep({}, options.fuse, config.fuse);
|
|
25
|
+
}
|
|
26
|
+
if (options.mock !== undefined) {
|
|
27
|
+
config.mock = _.defaultsDeep({}, options.mock, config.mock);
|
|
28
|
+
}
|
|
29
|
+
if (options.ui !== undefined) {
|
|
30
|
+
config.ui = _.defaultsDeep({}, options.ui, config.ui);
|
|
31
|
+
}
|
|
32
|
+
if (options.auth !== undefined) {
|
|
33
|
+
config.auth = _.defaultsDeep({}, options.auth, config.auth);
|
|
34
|
+
}
|
|
35
|
+
if (config.auth) {
|
|
36
|
+
const { stripSecretsForGenerate, deriveAuthUrls } = require('./config/auth-config');
|
|
37
|
+
deriveAuthUrls(config.auth);
|
|
38
|
+
config.auth = stripSecretsForGenerate(config.auth);
|
|
39
|
+
}
|
|
40
|
+
if (options.iam !== undefined) {
|
|
41
|
+
config.iam = _.defaultsDeep({}, options.iam, config.iam);
|
|
42
|
+
}
|
|
43
|
+
if (options.proxy !== undefined) {
|
|
44
|
+
config.proxy = _.defaultsDeep({}, options.proxy, config.proxy || {});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const isGdl = options.fileType === 'gdl' || (options.filePath && options.filePath.endsWith('.gdl'));
|
|
48
|
+
|
|
49
|
+
const { requireValidSchema, formatDiagnostics } = require('./validator/diagnostics');
|
|
50
|
+
const checked = requireValidSchema(fileContent, {file: options.filePath || '<schema>', isGdl, config});
|
|
51
|
+
if (checked.diagnostics.length) console.warn(formatDiagnostics(checked.diagnostics));
|
|
52
|
+
const parsed = checked.parsed;
|
|
53
|
+
|
|
54
|
+
const stats = await generate(parsed, config);
|
|
55
|
+
return {
|
|
56
|
+
config,
|
|
57
|
+
parsed,
|
|
58
|
+
stats
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
loadConfig,
|
|
64
|
+
parseJdl,
|
|
65
|
+
parseGdl,
|
|
66
|
+
generate,
|
|
67
|
+
generateFromSource
|
|
68
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
const _ = require('lodash');
|
|
2
|
+
const {
|
|
3
|
+
DEFAULT_AUDIT_FIELDS,
|
|
4
|
+
ACTIVE_STATUS_FIELD,
|
|
5
|
+
parseEntityAnnotations
|
|
6
|
+
} = require('./jdl-parser');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes GDL field types to JDL equivalents.
|
|
10
|
+
*/
|
|
11
|
+
function normalizeGdlType(gdlType) {
|
|
12
|
+
const typeMappings = {
|
|
13
|
+
string: 'String',
|
|
14
|
+
bool: 'Boolean',
|
|
15
|
+
int: 'Integer',
|
|
16
|
+
long: 'Long',
|
|
17
|
+
double: 'Double',
|
|
18
|
+
bigDecimal: 'BigDecimal',
|
|
19
|
+
date: 'LocalDate',
|
|
20
|
+
datetime: 'Instant'
|
|
21
|
+
};
|
|
22
|
+
return typeMappings[gdlType] || gdlType;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parses GDL file contents.
|
|
27
|
+
* @param {string} gdlContent - Raw GDL content string.
|
|
28
|
+
* @param {object} preferences - Developer preferences configuration.
|
|
29
|
+
* @returns {{entities: Array, enums: Array, relationships: Array}}
|
|
30
|
+
*/
|
|
31
|
+
function parseGdl(gdlContent, preferences = {}) {
|
|
32
|
+
const entities = {};
|
|
33
|
+
const enums = {};
|
|
34
|
+
const relationships = [];
|
|
35
|
+
|
|
36
|
+
const cleanContent = gdlContent.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
37
|
+
|
|
38
|
+
function isCommented(content, index) {
|
|
39
|
+
const lastNewline = content.lastIndexOf('\n', index);
|
|
40
|
+
const lineStart = lastNewline === -1 ? 0 : lastNewline + 1;
|
|
41
|
+
const line = content.substring(lineStart, index);
|
|
42
|
+
return line.trim().startsWith('//');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 1. Parse Enums (Syntactically identical to JDL)
|
|
46
|
+
const enumRegex = /enum\s+(\w+)\s*\{([^}]+)\}/g;
|
|
47
|
+
let enumMatch;
|
|
48
|
+
while ((enumMatch = enumRegex.exec(cleanContent)) !== null) {
|
|
49
|
+
if (isCommented(cleanContent, enumMatch.index)) continue;
|
|
50
|
+
const enumName = enumMatch[1];
|
|
51
|
+
const values = enumMatch[2]
|
|
52
|
+
.trim()
|
|
53
|
+
.split(',')
|
|
54
|
+
.map(v => v.trim().split('(')[0].trim())
|
|
55
|
+
.filter(Boolean);
|
|
56
|
+
enums[enumName] = { name: enumName, values: values.map(v => ({ name: v })) };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Determine audit fields based on config preferences
|
|
60
|
+
let auditFieldsToUse = DEFAULT_AUDIT_FIELDS;
|
|
61
|
+
if (preferences.fields && preferences.fields.audit && Array.isArray(preferences.fields.audit.names)) {
|
|
62
|
+
auditFieldsToUse = preferences.fields.audit.names.map(name => {
|
|
63
|
+
const type = (name.toLowerCase().endsWith('date') || /(?:At|_at)$/.test(name)) ? 'Instant' : 'String';
|
|
64
|
+
return { fieldName: name, fieldType: type, fieldTypeIsEnum: false, fieldValidateRules: [], comment: null };
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 2. Parse Entities and Fields
|
|
69
|
+
const entityRegex = /((?:@\w+\s+)*)entity\s+(\w+)\s*\{([^}]+)\}/g;
|
|
70
|
+
let entityMatch;
|
|
71
|
+
while ((entityMatch = entityRegex.exec(cleanContent)) !== null) {
|
|
72
|
+
if (isCommented(cleanContent, entityMatch.index)) continue;
|
|
73
|
+
|
|
74
|
+
const annotations = parseEntityAnnotations(entityMatch[1] || '');
|
|
75
|
+
const flags = new Set(annotations);
|
|
76
|
+
const hasAuditAnnotation = flags.has('Audited');
|
|
77
|
+
const hasActiveStatus = flags.has('ActiveStatus');
|
|
78
|
+
const hasSearchable = flags.has('Searchable');
|
|
79
|
+
const entityName = entityMatch[2];
|
|
80
|
+
const fieldsContent = entityMatch[3];
|
|
81
|
+
|
|
82
|
+
const fields = [];
|
|
83
|
+
const fieldLines = fieldsContent
|
|
84
|
+
.split('\n')
|
|
85
|
+
.map(l => l.trim())
|
|
86
|
+
.filter(line => line && !line.startsWith('//'));
|
|
87
|
+
|
|
88
|
+
fieldLines.forEach(line => {
|
|
89
|
+
// GDL field syntax: <fieldType> <fieldName> [validations] [comment]
|
|
90
|
+
const fieldMatch = line.match(/^([\w<>]+)\s+(\w+)(.*)/);
|
|
91
|
+
if (fieldMatch) {
|
|
92
|
+
const rawFieldType = fieldMatch[1];
|
|
93
|
+
const fieldName = fieldMatch[2];
|
|
94
|
+
const restOfLine = fieldMatch[3] || '';
|
|
95
|
+
|
|
96
|
+
let validations = restOfLine;
|
|
97
|
+
let comment = null;
|
|
98
|
+
|
|
99
|
+
const commentIndex = restOfLine.indexOf('//');
|
|
100
|
+
if (commentIndex !== -1) {
|
|
101
|
+
validations = restOfLine.substring(0, commentIndex).trim();
|
|
102
|
+
comment = restOfLine.substring(commentIndex + 2).trim();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const fieldType = normalizeGdlType(rawFieldType);
|
|
106
|
+
|
|
107
|
+
fields.push({
|
|
108
|
+
fieldName,
|
|
109
|
+
fieldType,
|
|
110
|
+
fieldTypeIsEnum: !!enums[fieldType],
|
|
111
|
+
fieldValidateRules: validations.split(/\s+/).filter(Boolean),
|
|
112
|
+
comment
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
if (hasActiveStatus && !fields.some((f) => f.fieldName === 'isActive')) {
|
|
118
|
+
fields.push({ ...ACTIVE_STATUS_FIELD });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (hasAuditAnnotation && preferences.fields?.audit?.enabled !== false) {
|
|
122
|
+
fields.push(...auditFieldsToUse);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
entities[entityName] = {
|
|
126
|
+
name: entityName,
|
|
127
|
+
fields,
|
|
128
|
+
annotations,
|
|
129
|
+
searchable: hasSearchable,
|
|
130
|
+
activeStatus: hasActiveStatus,
|
|
131
|
+
audited: hasAuditAnnotation
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 3. Parse Relationships
|
|
136
|
+
const relBlockRegex = /relationship\s+(OneToOne|ManyToOne|OneToMany|ManyToMany)\s*\{([\s\S]*?)\n\}/g;
|
|
137
|
+
let blockMatch;
|
|
138
|
+
while ((blockMatch = relBlockRegex.exec(cleanContent)) !== null) {
|
|
139
|
+
if (isCommented(cleanContent, blockMatch.index)) continue;
|
|
140
|
+
const relType = blockMatch[1];
|
|
141
|
+
const blockContent = blockMatch[2];
|
|
142
|
+
const lines = blockContent
|
|
143
|
+
.split('\n')
|
|
144
|
+
.map(l => l.trim())
|
|
145
|
+
.filter(line => line && !line.startsWith('//'));
|
|
146
|
+
|
|
147
|
+
lines.forEach(line => {
|
|
148
|
+
const relLineRegex = /^(\w+)(?:\{([\w()]+)\})?\s+to\s+(\w+)(?:\{([\w()]+)\})?/;
|
|
149
|
+
const lineMatch = line.match(relLineRegex);
|
|
150
|
+
if (lineMatch) {
|
|
151
|
+
relationships.push({
|
|
152
|
+
type: relType,
|
|
153
|
+
from: { name: lineMatch[1], fieldName: lineMatch[2] },
|
|
154
|
+
to: { name: lineMatch[3], fieldName: lineMatch[4] }
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
entities: Object.values(entities),
|
|
162
|
+
enums: Object.values(enums),
|
|
163
|
+
relationships
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
module.exports = {
|
|
168
|
+
parseGdl
|
|
169
|
+
};
|