@l4yercak3/cli 1.3.2 → 2.0.0-alpha.1
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 +10 -220
- package/dist/api/client.d.ts +12 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +37 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/platform.d.ts +161 -0
- package/dist/api/platform.d.ts.map +1 -0
- package/dist/api/platform.js +70 -0
- package/dist/api/platform.js.map +1 -0
- package/dist/bin/sevenlayers.d.ts +3 -0
- package/dist/bin/sevenlayers.d.ts.map +1 -0
- package/dist/bin/sevenlayers.js +198 -0
- package/dist/bin/sevenlayers.js.map +1 -0
- package/dist/commands/agent/catalog.d.ts +5 -0
- package/dist/commands/agent/catalog.d.ts.map +1 -0
- package/dist/commands/agent/catalog.js +142 -0
- package/dist/commands/agent/catalog.js.map +1 -0
- package/dist/commands/agent/drift.d.ts +5 -0
- package/dist/commands/agent/drift.d.ts.map +1 -0
- package/dist/commands/agent/drift.js +113 -0
- package/dist/commands/agent/drift.js.map +1 -0
- package/dist/commands/agent/init.d.ts +5 -0
- package/dist/commands/agent/init.d.ts.map +1 -0
- package/dist/commands/agent/init.js +75 -0
- package/dist/commands/agent/init.js.map +1 -0
- package/dist/commands/agent/permissions.d.ts +5 -0
- package/dist/commands/agent/permissions.d.ts.map +1 -0
- package/dist/commands/agent/permissions.js +88 -0
- package/dist/commands/agent/permissions.js.map +1 -0
- package/dist/commands/agent/runner.d.ts +14 -0
- package/dist/commands/agent/runner.d.ts.map +1 -0
- package/dist/commands/agent/runner.js +59 -0
- package/dist/commands/agent/runner.js.map +1 -0
- package/dist/commands/agent/shared.d.ts +13 -0
- package/dist/commands/agent/shared.d.ts.map +1 -0
- package/dist/commands/agent/shared.js +31 -0
- package/dist/commands/agent/shared.js.map +1 -0
- package/dist/commands/agent/template.d.ts +5 -0
- package/dist/commands/agent/template.d.ts.map +1 -0
- package/dist/commands/agent/template.js +104 -0
- package/dist/commands/agent/template.js.map +1 -0
- package/dist/commands/app/connect.d.ts +7 -0
- package/dist/commands/app/connect.d.ts.map +1 -0
- package/dist/commands/app/connect.js +12 -0
- package/dist/commands/app/connect.js.map +1 -0
- package/dist/commands/app/init.d.ts +7 -0
- package/dist/commands/app/init.d.ts.map +1 -0
- package/dist/commands/app/init.js +12 -0
- package/dist/commands/app/init.js.map +1 -0
- package/dist/commands/app/link.d.ts +3 -0
- package/dist/commands/app/link.d.ts.map +1 -0
- package/dist/commands/app/link.js +92 -0
- package/dist/commands/app/link.js.map +1 -0
- package/dist/commands/app/pages.d.ts +15 -0
- package/dist/commands/app/pages.d.ts.map +1 -0
- package/dist/commands/app/pages.js +180 -0
- package/dist/commands/app/pages.js.map +1 -0
- package/dist/commands/app/register.d.ts +3 -0
- package/dist/commands/app/register.d.ts.map +1 -0
- package/dist/commands/app/register.js +120 -0
- package/dist/commands/app/register.js.map +1 -0
- package/dist/commands/app/remote.d.ts +14 -0
- package/dist/commands/app/remote.d.ts.map +1 -0
- package/dist/commands/app/remote.js +44 -0
- package/dist/commands/app/remote.js.map +1 -0
- package/dist/commands/app/setup.d.ts +3 -0
- package/dist/commands/app/setup.d.ts.map +1 -0
- package/dist/commands/app/setup.js +299 -0
- package/dist/commands/app/setup.js.map +1 -0
- package/dist/commands/app/shared.d.ts +9 -0
- package/dist/commands/app/shared.d.ts.map +1 -0
- package/dist/commands/app/shared.js +122 -0
- package/dist/commands/app/shared.js.map +1 -0
- package/dist/commands/app/sync.d.ts +7 -0
- package/dist/commands/app/sync.d.ts.map +1 -0
- package/dist/commands/app/sync.js +107 -0
- package/dist/commands/app/sync.js.map +1 -0
- package/dist/commands/booking/check.d.ts +3 -0
- package/dist/commands/booking/check.d.ts.map +1 -0
- package/dist/commands/booking/check.js +68 -0
- package/dist/commands/booking/check.js.map +1 -0
- package/dist/commands/booking/setup.d.ts +3 -0
- package/dist/commands/booking/setup.d.ts.map +1 -0
- package/dist/commands/booking/setup.js +95 -0
- package/dist/commands/booking/setup.js.map +1 -0
- package/dist/commands/booking/shared.d.ts +31 -0
- package/dist/commands/booking/shared.d.ts.map +1 -0
- package/dist/commands/booking/shared.js +112 -0
- package/dist/commands/booking/shared.js.map +1 -0
- package/dist/commands/booking/smoke.d.ts +3 -0
- package/dist/commands/booking/smoke.d.ts.map +1 -0
- package/dist/commands/booking/smoke.js +101 -0
- package/dist/commands/booking/smoke.js.map +1 -0
- package/dist/commands/cms/bind.d.ts +3 -0
- package/dist/commands/cms/bind.d.ts.map +1 -0
- package/dist/commands/cms/bind.js +212 -0
- package/dist/commands/cms/bind.js.map +1 -0
- package/dist/commands/cms/content.d.ts +40 -0
- package/dist/commands/cms/content.d.ts.map +1 -0
- package/dist/commands/cms/content.js +169 -0
- package/dist/commands/cms/content.js.map +1 -0
- package/dist/commands/cms/doctor.d.ts +3 -0
- package/dist/commands/cms/doctor.d.ts.map +1 -0
- package/dist/commands/cms/doctor.js +69 -0
- package/dist/commands/cms/doctor.js.map +1 -0
- package/dist/commands/cms/migrate.d.ts +3 -0
- package/dist/commands/cms/migrate.d.ts.map +1 -0
- package/dist/commands/cms/migrate.js +78 -0
- package/dist/commands/cms/migrate.js.map +1 -0
- package/dist/commands/cms/registry.d.ts +3 -0
- package/dist/commands/cms/registry.d.ts.map +1 -0
- package/dist/commands/cms/registry.js +161 -0
- package/dist/commands/cms/registry.js.map +1 -0
- package/dist/commands/cms/seed.d.ts +3 -0
- package/dist/commands/cms/seed.d.ts.map +1 -0
- package/dist/commands/cms/seed.js +102 -0
- package/dist/commands/cms/seed.js.map +1 -0
- package/dist/commands/cms/shared.d.ts +22 -0
- package/dist/commands/cms/shared.d.ts.map +1 -0
- package/dist/commands/cms/shared.js +82 -0
- package/dist/commands/cms/shared.js.map +1 -0
- package/dist/commands/doctor/target.d.ts +3 -0
- package/dist/commands/doctor/target.d.ts.map +1 -0
- package/dist/commands/doctor/target.js +46 -0
- package/dist/commands/doctor/target.js.map +1 -0
- package/dist/commands/env/list.d.ts +3 -0
- package/dist/commands/env/list.d.ts.map +1 -0
- package/dist/commands/env/list.js +28 -0
- package/dist/commands/env/list.js.map +1 -0
- package/dist/commands/env/set.d.ts +3 -0
- package/dist/commands/env/set.d.ts.map +1 -0
- package/dist/commands/env/set.js +36 -0
- package/dist/commands/env/set.js.map +1 -0
- package/dist/commands/env/use.d.ts +3 -0
- package/dist/commands/env/use.d.ts.map +1 -0
- package/dist/commands/env/use.js +15 -0
- package/dist/commands/env/use.js.map +1 -0
- package/dist/commands/legacy/connect.d.ts +3 -0
- package/dist/commands/legacy/connect.d.ts.map +1 -0
- package/dist/commands/legacy/connect.js +8 -0
- package/dist/commands/legacy/connect.js.map +1 -0
- package/dist/commands/legacy/pages.d.ts +3 -0
- package/dist/commands/legacy/pages.d.ts.map +1 -0
- package/dist/commands/legacy/pages.js +16 -0
- package/dist/commands/legacy/pages.js.map +1 -0
- package/dist/commands/legacy/spread.d.ts +3 -0
- package/dist/commands/legacy/spread.d.ts.map +1 -0
- package/dist/commands/legacy/spread.js +8 -0
- package/dist/commands/legacy/spread.js.map +1 -0
- package/dist/commands/legacy/sync.d.ts +3 -0
- package/dist/commands/legacy/sync.d.ts.map +1 -0
- package/dist/commands/legacy/sync.js +8 -0
- package/dist/commands/legacy/sync.js.map +1 -0
- package/dist/config/env-diff.d.ts +10 -0
- package/dist/config/env-diff.d.ts.map +1 -0
- package/dist/config/env-diff.js +24 -0
- package/dist/config/env-diff.js.map +1 -0
- package/dist/config/env-parser.d.ts +20 -0
- package/dist/config/env-parser.d.ts.map +1 -0
- package/dist/config/env-parser.js +70 -0
- package/dist/config/env-parser.js.map +1 -0
- package/dist/config/env-writer.d.ts +22 -0
- package/dist/config/env-writer.d.ts.map +1 -0
- package/dist/config/env-writer.js +172 -0
- package/dist/config/env-writer.js.map +1 -0
- package/dist/config/profile-store.d.ts +29 -0
- package/dist/config/profile-store.d.ts.map +1 -0
- package/dist/config/profile-store.js +257 -0
- package/dist/config/profile-store.js.map +1 -0
- package/dist/core/args.d.ts +11 -0
- package/dist/core/args.d.ts.map +1 -0
- package/dist/core/args.js +106 -0
- package/dist/core/args.js.map +1 -0
- package/dist/core/colors.d.ts +6 -0
- package/dist/core/colors.d.ts.map +1 -0
- package/dist/core/colors.js +29 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/safety/target-guard.d.ts +16 -0
- package/dist/safety/target-guard.d.ts.map +1 -0
- package/dist/safety/target-guard.js +55 -0
- package/dist/safety/target-guard.js.map +1 -0
- package/dist/testing/booking-smoke.d.ts +17 -0
- package/dist/testing/booking-smoke.d.ts.map +1 -0
- package/dist/testing/booking-smoke.js +43 -0
- package/dist/testing/booking-smoke.js.map +1 -0
- package/dist/tests/agent-commands.test.d.ts +2 -0
- package/dist/tests/agent-commands.test.d.ts.map +1 -0
- package/dist/tests/agent-commands.test.js +180 -0
- package/dist/tests/agent-commands.test.js.map +1 -0
- package/dist/tests/agent-governance.test.d.ts +2 -0
- package/dist/tests/agent-governance.test.d.ts.map +1 -0
- package/dist/tests/agent-governance.test.js +233 -0
- package/dist/tests/agent-governance.test.js.map +1 -0
- package/dist/tests/app-commands.test.d.ts +2 -0
- package/dist/tests/app-commands.test.d.ts.map +1 -0
- package/dist/tests/app-commands.test.js +462 -0
- package/dist/tests/app-commands.test.js.map +1 -0
- package/dist/tests/booking-commands.test.d.ts +2 -0
- package/dist/tests/booking-commands.test.d.ts.map +1 -0
- package/dist/tests/booking-commands.test.js +204 -0
- package/dist/tests/booking-commands.test.js.map +1 -0
- package/dist/tests/booking-smoke.test.d.ts +2 -0
- package/dist/tests/booking-smoke.test.d.ts.map +1 -0
- package/dist/tests/booking-smoke.test.js +183 -0
- package/dist/tests/booking-smoke.test.js.map +1 -0
- package/dist/tests/cms-commands.test.d.ts +2 -0
- package/dist/tests/cms-commands.test.d.ts.map +1 -0
- package/dist/tests/cms-commands.test.js +254 -0
- package/dist/tests/cms-commands.test.js.map +1 -0
- package/dist/tests/cms-ops.test.d.ts +2 -0
- package/dist/tests/cms-ops.test.d.ts.map +1 -0
- package/dist/tests/cms-ops.test.js +125 -0
- package/dist/tests/cms-ops.test.js.map +1 -0
- package/dist/tests/env-writer.test.d.ts +2 -0
- package/dist/tests/env-writer.test.d.ts.map +1 -0
- package/dist/tests/env-writer.test.js +90 -0
- package/dist/tests/env-writer.test.js.map +1 -0
- package/dist/tests/profile-store.test.d.ts +2 -0
- package/dist/tests/profile-store.test.d.ts.map +1 -0
- package/dist/tests/profile-store.test.js +88 -0
- package/dist/tests/profile-store.test.js.map +1 -0
- package/dist/tests/target-guard.test.d.ts +2 -0
- package/dist/tests/target-guard.test.d.ts.map +1 -0
- package/dist/tests/target-guard.test.js +132 -0
- package/dist/tests/target-guard.test.js.map +1 -0
- package/dist/ui/logo.d.ts +2 -0
- package/dist/ui/logo.d.ts.map +1 -0
- package/dist/ui/logo.js +22 -0
- package/dist/ui/logo.js.map +1 -0
- package/package.json +17 -53
- package/.claude/settings.local.json +0 -36
- package/.cursor/rules.md +0 -203
- package/.eslintrc.js +0 -31
- package/CLAUDE.md +0 -100
- package/bin/cli.js +0 -116
- package/docs/ADDING_FRAMEWORK_DETECTORS.md +0 -391
- package/docs/ADDING_NEW_PROJECT_TYPE.md +0 -156
- package/docs/ARCHITECTURE_RELATIONSHIPS.md +0 -411
- package/docs/CLI_AUTHENTICATION.md +0 -214
- package/docs/CLI_PAGE_DETECTION_REQUIREMENTS.md +0 -519
- package/docs/CRM-PIPELINES-SEQUENCES-SPEC.md +0 -429
- package/docs/DETECTOR_ARCHITECTURE.md +0 -326
- package/docs/DEVELOPMENT.md +0 -194
- package/docs/IMPLEMENTATION_PHASES.md +0 -468
- package/docs/INTEGRATION_PATHS_ARCHITECTURE.md +0 -1543
- package/docs/OAUTH_CLARIFICATION.md +0 -258
- package/docs/OAUTH_SETUP_GUIDE_TEMPLATE.md +0 -211
- package/docs/PHASE_0_PROGRESS.md +0 -120
- package/docs/PHASE_1_COMPLETE.md +0 -366
- package/docs/PHASE_SUMMARY.md +0 -149
- package/docs/PLAN.md +0 -511
- package/docs/README.md +0 -56
- package/docs/STRIPE_INTEGRATION.md +0 -447
- package/docs/SUMMARY.md +0 -230
- package/docs/UPDATED_PLAN.md +0 -447
- package/docs/mcp_server/MCP_EXTENSION_GUIDE.md +0 -1313
- package/docs/mcp_server/MCP_SERVER_ARCHITECTURE.md +0 -1481
- package/docs/mcp_server/applicationOntology.ts +0 -817
- package/docs/mcp_server/cliApplications.ts +0 -639
- package/docs/mcp_server/crmOntology.ts +0 -1063
- package/docs/mcp_server/eventOntology.ts +0 -1183
- package/docs/mcp_server/formsOntology.ts +0 -1401
- package/docs/mcp_server/ontologySchemas.ts +0 -185
- package/docs/mcp_server/schema.ts +0 -250
- package/docs/microsass_production_machine/CLI_API_REFERENCE.md +0 -1197
- package/docs/microsass_production_machine/CLI_PRODUCT_VISION.md +0 -676
- package/docs/microsass_production_machine/CLI_REQUIREMENTS.md +0 -606
- package/docs/microsass_production_machine/CONNECTED_APPLICATIONS_SPEC.md +0 -390
- package/docs/microsass_production_machine/IMPLEMENTATION_ROADMAP.md +0 -725
- package/docs/microsass_production_machine/OBJECT_MAPPINGS.md +0 -808
- package/docs/microsass_production_machine/REFERENCE_IMPLEMENTATION.md +0 -532
- package/src/api/backend-client.js +0 -449
- package/src/commands/api-keys.js +0 -119
- package/src/commands/connect.js +0 -253
- package/src/commands/login.js +0 -332
- package/src/commands/logout.js +0 -30
- package/src/commands/mcp-server.js +0 -85
- package/src/commands/mcp-setup.js +0 -686
- package/src/commands/pages.js +0 -317
- package/src/commands/scaffold.js +0 -409
- package/src/commands/spread.js +0 -861
- package/src/commands/status.js +0 -62
- package/src/commands/sync.js +0 -169
- package/src/commands/upgrade.js +0 -48
- package/src/config/config-manager.js +0 -206
- package/src/detectors/api-client-detector.js +0 -85
- package/src/detectors/base-detector.js +0 -77
- package/src/detectors/database-detector.js +0 -245
- package/src/detectors/expo-detector.js +0 -166
- package/src/detectors/github-detector.js +0 -74
- package/src/detectors/index.js +0 -106
- package/src/detectors/mapping-suggestor.js +0 -119
- package/src/detectors/model-detector.js +0 -318
- package/src/detectors/nextjs-detector.js +0 -139
- package/src/detectors/oauth-detector.js +0 -122
- package/src/detectors/page-detector.js +0 -480
- package/src/detectors/registry.js +0 -121
- package/src/generators/api-client-generator.js +0 -223
- package/src/generators/api-only/client.js +0 -683
- package/src/generators/api-only/index.js +0 -96
- package/src/generators/api-only/types.js +0 -618
- package/src/generators/api-only/webhooks.js +0 -377
- package/src/generators/env-generator.js +0 -191
- package/src/generators/expo-auth-generator.js +0 -1009
- package/src/generators/gitignore-generator.js +0 -92
- package/src/generators/index.js +0 -166
- package/src/generators/manifest-generator.js +0 -154
- package/src/generators/mcp-guide-generator.js +0 -256
- package/src/generators/nextauth-generator.js +0 -247
- package/src/generators/oauth-guide-generator.js +0 -277
- package/src/generators/quickstart/components/index.js +0 -1699
- package/src/generators/quickstart/components-mobile/index.js +0 -1440
- package/src/generators/quickstart/database/convex.js +0 -1257
- package/src/generators/quickstart/database/index.js +0 -34
- package/src/generators/quickstart/database/supabase.js +0 -1132
- package/src/generators/quickstart/hooks/index.js +0 -1065
- package/src/generators/quickstart/index.js +0 -191
- package/src/generators/quickstart/pages/index.js +0 -1466
- package/src/generators/quickstart/screens/index.js +0 -1498
- package/src/logo.js +0 -116
- package/src/mcp/auth.js +0 -127
- package/src/mcp/registry/domains/applications.js +0 -516
- package/src/mcp/registry/domains/benefits.js +0 -798
- package/src/mcp/registry/domains/codegen.js +0 -894
- package/src/mcp/registry/domains/core.js +0 -324
- package/src/mcp/registry/domains/crm.js +0 -591
- package/src/mcp/registry/domains/events.js +0 -649
- package/src/mcp/registry/domains/forms.js +0 -696
- package/src/mcp/registry/index.js +0 -164
- package/src/mcp/server.js +0 -116
- package/src/utils/file-utils.js +0 -117
- package/src/utils/init-helpers.js +0 -243
- package/src/utils/prompt-utils.js +0 -195
- package/templates/CLAUDE.md +0 -86
- package/tests/api-client-detector.test.js +0 -214
- package/tests/api-client-generator.test.js +0 -176
- package/tests/backend-client.test.js +0 -640
- package/tests/base-detector.test.js +0 -101
- package/tests/commands/login.test.js +0 -143
- package/tests/commands/logout.test.js +0 -84
- package/tests/commands/status.test.js +0 -167
- package/tests/config-manager.test.js +0 -321
- package/tests/database-detector.test.js +0 -221
- package/tests/detector-index.test.js +0 -209
- package/tests/detector-registry.test.js +0 -93
- package/tests/env-generator.test.js +0 -278
- package/tests/expo-detector.test.js +0 -263
- package/tests/file-utils.test.js +0 -194
- package/tests/generators-index.test.js +0 -454
- package/tests/github-detector.test.js +0 -145
- package/tests/gitignore-generator.test.js +0 -109
- package/tests/logo.test.js +0 -96
- package/tests/nextauth-generator.test.js +0 -255
- package/tests/nextjs-detector.test.js +0 -235
- package/tests/oauth-detector.test.js +0 -264
- package/tests/oauth-guide-generator.test.js +0 -273
- package/tests/page-detector.test.js +0 -371
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database Detector
|
|
3
|
-
* Detects existing database configurations in a project
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Check if a file exists
|
|
11
|
-
* @param {string} filePath - Path to check
|
|
12
|
-
* @returns {boolean}
|
|
13
|
-
*/
|
|
14
|
-
function fileExists(filePath) {
|
|
15
|
-
try {
|
|
16
|
-
return fs.existsSync(filePath);
|
|
17
|
-
} catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Read and parse package.json
|
|
24
|
-
* @param {string} projectPath - Project root path
|
|
25
|
-
* @returns {object|null}
|
|
26
|
-
*/
|
|
27
|
-
function readPackageJson(projectPath) {
|
|
28
|
-
try {
|
|
29
|
-
const packagePath = path.join(projectPath, 'package.json');
|
|
30
|
-
if (fileExists(packagePath)) {
|
|
31
|
-
const content = fs.readFileSync(packagePath, 'utf8');
|
|
32
|
-
return JSON.parse(content);
|
|
33
|
-
}
|
|
34
|
-
} catch {
|
|
35
|
-
// Ignore parse errors
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Detect database configuration in a project
|
|
42
|
-
* @param {string} projectPath - Project root path
|
|
43
|
-
* @returns {object} Detection result
|
|
44
|
-
*/
|
|
45
|
-
function detectDatabase(projectPath = process.cwd()) {
|
|
46
|
-
const detections = [];
|
|
47
|
-
|
|
48
|
-
// Check for Convex
|
|
49
|
-
const convexDir = path.join(projectPath, 'convex');
|
|
50
|
-
if (fileExists(convexDir)) {
|
|
51
|
-
const hasSchema = fileExists(path.join(convexDir, 'schema.ts')) ||
|
|
52
|
-
fileExists(path.join(convexDir, 'schema.js'));
|
|
53
|
-
detections.push({
|
|
54
|
-
type: 'convex',
|
|
55
|
-
confidence: 'high',
|
|
56
|
-
configPath: 'convex/',
|
|
57
|
-
hasSchema,
|
|
58
|
-
details: {
|
|
59
|
-
schemaFile: hasSchema ? 'convex/schema.ts' : null,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Check for Supabase
|
|
65
|
-
const supabaseDir = path.join(projectPath, 'supabase');
|
|
66
|
-
if (fileExists(supabaseDir)) {
|
|
67
|
-
const hasMigrations = fileExists(path.join(supabaseDir, 'migrations'));
|
|
68
|
-
detections.push({
|
|
69
|
-
type: 'supabase',
|
|
70
|
-
confidence: 'high',
|
|
71
|
-
configPath: 'supabase/',
|
|
72
|
-
hasMigrations,
|
|
73
|
-
details: {
|
|
74
|
-
migrationsDir: hasMigrations ? 'supabase/migrations/' : null,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Check for Prisma
|
|
80
|
-
const prismaDir = path.join(projectPath, 'prisma');
|
|
81
|
-
if (fileExists(prismaDir)) {
|
|
82
|
-
const hasSchema = fileExists(path.join(prismaDir, 'schema.prisma'));
|
|
83
|
-
detections.push({
|
|
84
|
-
type: 'prisma',
|
|
85
|
-
confidence: 'high',
|
|
86
|
-
configPath: 'prisma/',
|
|
87
|
-
hasSchema,
|
|
88
|
-
details: {
|
|
89
|
-
schemaFile: hasSchema ? 'prisma/schema.prisma' : null,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Check for Drizzle config
|
|
95
|
-
const drizzleConfig = [
|
|
96
|
-
'drizzle.config.ts',
|
|
97
|
-
'drizzle.config.js',
|
|
98
|
-
'drizzle.config.mjs',
|
|
99
|
-
].find(f => fileExists(path.join(projectPath, f)));
|
|
100
|
-
if (drizzleConfig) {
|
|
101
|
-
detections.push({
|
|
102
|
-
type: 'drizzle',
|
|
103
|
-
confidence: 'high',
|
|
104
|
-
configPath: drizzleConfig,
|
|
105
|
-
details: {
|
|
106
|
-
configFile: drizzleConfig,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Check package.json for database dependencies
|
|
112
|
-
const packageJson = readPackageJson(projectPath);
|
|
113
|
-
if (packageJson) {
|
|
114
|
-
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
115
|
-
|
|
116
|
-
// Convex from package.json
|
|
117
|
-
if (deps['convex'] && !detections.find(d => d.type === 'convex')) {
|
|
118
|
-
detections.push({
|
|
119
|
-
type: 'convex',
|
|
120
|
-
confidence: 'medium',
|
|
121
|
-
source: 'package.json',
|
|
122
|
-
details: {
|
|
123
|
-
version: deps['convex'],
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Supabase from package.json
|
|
129
|
-
if (deps['@supabase/supabase-js'] && !detections.find(d => d.type === 'supabase')) {
|
|
130
|
-
detections.push({
|
|
131
|
-
type: 'supabase',
|
|
132
|
-
confidence: 'medium',
|
|
133
|
-
source: 'package.json',
|
|
134
|
-
details: {
|
|
135
|
-
version: deps['@supabase/supabase-js'],
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Prisma from package.json
|
|
141
|
-
if ((deps['prisma'] || deps['@prisma/client']) && !detections.find(d => d.type === 'prisma')) {
|
|
142
|
-
detections.push({
|
|
143
|
-
type: 'prisma',
|
|
144
|
-
confidence: 'medium',
|
|
145
|
-
source: 'package.json',
|
|
146
|
-
details: {
|
|
147
|
-
version: deps['prisma'] || deps['@prisma/client'],
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Drizzle from package.json
|
|
153
|
-
if (deps['drizzle-orm'] && !detections.find(d => d.type === 'drizzle')) {
|
|
154
|
-
detections.push({
|
|
155
|
-
type: 'drizzle',
|
|
156
|
-
confidence: 'medium',
|
|
157
|
-
source: 'package.json',
|
|
158
|
-
details: {
|
|
159
|
-
version: deps['drizzle-orm'],
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// MongoDB/Mongoose
|
|
165
|
-
if (deps['mongoose']) {
|
|
166
|
-
detections.push({
|
|
167
|
-
type: 'mongodb',
|
|
168
|
-
confidence: 'medium',
|
|
169
|
-
source: 'package.json',
|
|
170
|
-
details: {
|
|
171
|
-
client: 'mongoose',
|
|
172
|
-
version: deps['mongoose'],
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (deps['mongodb'] && !detections.find(d => d.type === 'mongodb')) {
|
|
178
|
-
detections.push({
|
|
179
|
-
type: 'mongodb',
|
|
180
|
-
confidence: 'medium',
|
|
181
|
-
source: 'package.json',
|
|
182
|
-
details: {
|
|
183
|
-
client: 'mongodb',
|
|
184
|
-
version: deps['mongodb'],
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Firebase/Firestore
|
|
190
|
-
if (deps['firebase'] || deps['firebase-admin']) {
|
|
191
|
-
detections.push({
|
|
192
|
-
type: 'firebase',
|
|
193
|
-
confidence: 'medium',
|
|
194
|
-
source: 'package.json',
|
|
195
|
-
details: {
|
|
196
|
-
client: deps['firebase'] ? 'firebase' : 'firebase-admin',
|
|
197
|
-
version: deps['firebase'] || deps['firebase-admin'],
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// PostgreSQL (pg)
|
|
203
|
-
if (deps['pg'] && !detections.find(d => ['prisma', 'drizzle', 'supabase'].includes(d.type))) {
|
|
204
|
-
detections.push({
|
|
205
|
-
type: 'postgresql',
|
|
206
|
-
confidence: 'low',
|
|
207
|
-
source: 'package.json',
|
|
208
|
-
details: {
|
|
209
|
-
client: 'pg',
|
|
210
|
-
version: deps['pg'],
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// MySQL
|
|
216
|
-
if (deps['mysql2'] || deps['mysql']) {
|
|
217
|
-
detections.push({
|
|
218
|
-
type: 'mysql',
|
|
219
|
-
confidence: 'low',
|
|
220
|
-
source: 'package.json',
|
|
221
|
-
details: {
|
|
222
|
-
client: deps['mysql2'] ? 'mysql2' : 'mysql',
|
|
223
|
-
version: deps['mysql2'] || deps['mysql'],
|
|
224
|
-
},
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Sort by confidence (high first)
|
|
230
|
-
const sortedDetections = detections.sort((a, b) => {
|
|
231
|
-
const confidenceOrder = { high: 2, medium: 1, low: 0 };
|
|
232
|
-
return (confidenceOrder[b.confidence] || 0) - (confidenceOrder[a.confidence] || 0);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
hasDatabase: sortedDetections.length > 0,
|
|
237
|
-
detections: sortedDetections,
|
|
238
|
-
primary: sortedDetections[0] || null,
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
module.exports = {
|
|
243
|
-
detect: detectDatabase,
|
|
244
|
-
detectDatabase,
|
|
245
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expo/React Native Project Detector
|
|
3
|
-
* Detects Expo and React Native projects and their configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const BaseDetector = require('./base-detector');
|
|
9
|
-
|
|
10
|
-
class ExpoDetector extends BaseDetector {
|
|
11
|
-
get name() {
|
|
12
|
-
return 'expo';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get priority() {
|
|
16
|
-
return 95; // Slightly lower than Next.js (100), but high enough for framework detection
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Detect if current directory is an Expo or React Native project
|
|
21
|
-
*/
|
|
22
|
-
detect(projectPath = process.cwd()) {
|
|
23
|
-
const results = {
|
|
24
|
-
isExpo: false,
|
|
25
|
-
isReactNative: false,
|
|
26
|
-
expoVersion: null,
|
|
27
|
-
reactNativeVersion: null,
|
|
28
|
-
hasTypeScript: false,
|
|
29
|
-
routerType: null, // 'expo-router' or 'react-navigation' or null
|
|
30
|
-
sdkVersion: null,
|
|
31
|
-
config: null,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Check for package.json
|
|
35
|
-
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
36
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
37
|
-
return {
|
|
38
|
-
detected: false,
|
|
39
|
-
confidence: 0,
|
|
40
|
-
metadata: {},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
46
|
-
const dependencies = {
|
|
47
|
-
...packageJson.dependencies,
|
|
48
|
-
...packageJson.devDependencies,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Check for Expo
|
|
52
|
-
if (dependencies.expo) {
|
|
53
|
-
results.isExpo = true;
|
|
54
|
-
results.expoVersion = dependencies.expo;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Check for React Native (with or without Expo)
|
|
58
|
-
if (dependencies['react-native']) {
|
|
59
|
-
results.isReactNative = true;
|
|
60
|
-
results.reactNativeVersion = dependencies['react-native'];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// If neither, not a React Native project
|
|
64
|
-
if (!results.isExpo && !results.isReactNative) {
|
|
65
|
-
return {
|
|
66
|
-
detected: false,
|
|
67
|
-
confidence: 0,
|
|
68
|
-
metadata: {},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Check for TypeScript
|
|
73
|
-
if (dependencies.typescript || fs.existsSync(path.join(projectPath, 'tsconfig.json'))) {
|
|
74
|
-
results.hasTypeScript = true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Detect router type
|
|
78
|
-
// Default to 'native' (no file-based router) if no router package is found
|
|
79
|
-
if (dependencies['expo-router']) {
|
|
80
|
-
results.routerType = 'expo-router';
|
|
81
|
-
} else if (dependencies['@react-navigation/native']) {
|
|
82
|
-
results.routerType = 'react-navigation';
|
|
83
|
-
} else {
|
|
84
|
-
results.routerType = 'native'; // Basic React Native navigation
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Check for app.json or app.config.js (Expo config)
|
|
88
|
-
const appJsonPath = path.join(projectPath, 'app.json');
|
|
89
|
-
const appConfigJsPath = path.join(projectPath, 'app.config.js');
|
|
90
|
-
const appConfigTsPath = path.join(projectPath, 'app.config.ts');
|
|
91
|
-
|
|
92
|
-
if (fs.existsSync(appJsonPath)) {
|
|
93
|
-
try {
|
|
94
|
-
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'));
|
|
95
|
-
results.config = 'app.json';
|
|
96
|
-
if (appJson.expo?.sdkVersion) {
|
|
97
|
-
results.sdkVersion = appJson.expo.sdkVersion;
|
|
98
|
-
}
|
|
99
|
-
} catch (error) {
|
|
100
|
-
// Could not parse app.json
|
|
101
|
-
}
|
|
102
|
-
} else if (fs.existsSync(appConfigJsPath)) {
|
|
103
|
-
results.config = 'app.config.js';
|
|
104
|
-
} else if (fs.existsSync(appConfigTsPath)) {
|
|
105
|
-
results.config = 'app.config.ts';
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Determine confidence based on what we found
|
|
109
|
-
let confidence = 0.85; // Base confidence for React Native
|
|
110
|
-
if (results.isExpo) {
|
|
111
|
-
confidence = 0.9; // Higher confidence for Expo projects
|
|
112
|
-
if (results.config) {
|
|
113
|
-
confidence = 0.95; // Even higher with config file (app.json)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
detected: true,
|
|
119
|
-
confidence,
|
|
120
|
-
metadata: {
|
|
121
|
-
isExpo: results.isExpo,
|
|
122
|
-
expoVersion: results.expoVersion,
|
|
123
|
-
reactNativeVersion: results.reactNativeVersion,
|
|
124
|
-
hasTypeScript: results.hasTypeScript,
|
|
125
|
-
routerType: results.routerType,
|
|
126
|
-
sdkVersion: results.sdkVersion,
|
|
127
|
-
config: results.config,
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
} catch (error) {
|
|
131
|
-
// Error reading package.json
|
|
132
|
-
return {
|
|
133
|
-
detected: false,
|
|
134
|
-
confidence: 0,
|
|
135
|
-
metadata: {},
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get supported features for Expo/React Native
|
|
142
|
-
*/
|
|
143
|
-
getSupportedFeatures() {
|
|
144
|
-
return {
|
|
145
|
-
oauth: true, // OAuth via expo-auth-session or similar
|
|
146
|
-
stripe: true, // Stripe via @stripe/stripe-react-native
|
|
147
|
-
crm: true, // CRM API access
|
|
148
|
-
projects: true, // Projects API access
|
|
149
|
-
invoices: true, // Invoices API access
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get available generators for Expo/React Native
|
|
155
|
-
*/
|
|
156
|
-
getAvailableGenerators() {
|
|
157
|
-
return [
|
|
158
|
-
'api-client', // TypeScript API client
|
|
159
|
-
'env', // Environment variables
|
|
160
|
-
'oauth-guide', // OAuth setup guide for mobile
|
|
161
|
-
// Future: 'expo-auth', 'stripe-mobile'
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
module.exports = new ExpoDetector();
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub Repository Detector
|
|
3
|
-
* Detects GitHub repository information from git remotes
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { execSync } = require('child_process');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
class GitHubDetector {
|
|
10
|
-
/**
|
|
11
|
-
* Detect GitHub repository information
|
|
12
|
-
*/
|
|
13
|
-
detect(projectPath = process.cwd()) {
|
|
14
|
-
const results = {
|
|
15
|
-
hasGit: false,
|
|
16
|
-
isGitHub: false,
|
|
17
|
-
owner: null,
|
|
18
|
-
repo: null,
|
|
19
|
-
url: null,
|
|
20
|
-
branch: null,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// Check if .git directory exists
|
|
24
|
-
const gitDir = path.join(projectPath, '.git');
|
|
25
|
-
if (!require('fs').existsSync(gitDir)) {
|
|
26
|
-
return results;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
results.hasGit = true;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
// Get git remote URL
|
|
33
|
-
const remoteUrl = execSync('git config --get remote.origin.url', {
|
|
34
|
-
cwd: projectPath,
|
|
35
|
-
encoding: 'utf8',
|
|
36
|
-
stdio: ['pipe', 'pipe', 'ignore'],
|
|
37
|
-
}).trim();
|
|
38
|
-
|
|
39
|
-
if (!remoteUrl) {
|
|
40
|
-
return results;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Parse GitHub URL (supports both HTTPS and SSH formats)
|
|
44
|
-
// https://github.com/owner/repo.git
|
|
45
|
-
// git@github.com:owner/repo.git
|
|
46
|
-
const githubMatch = remoteUrl.match(/github\.com[/:]([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
47
|
-
|
|
48
|
-
if (githubMatch) {
|
|
49
|
-
results.isGitHub = true;
|
|
50
|
-
results.owner = githubMatch[1];
|
|
51
|
-
results.repo = githubMatch[2].replace(/\.git$/, '');
|
|
52
|
-
results.url = `https://github.com/${results.owner}/${results.repo}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Get current branch
|
|
56
|
-
try {
|
|
57
|
-
const branch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
58
|
-
cwd: projectPath,
|
|
59
|
-
encoding: 'utf8',
|
|
60
|
-
stdio: ['pipe', 'pipe', 'ignore'],
|
|
61
|
-
}).trim();
|
|
62
|
-
results.branch = branch;
|
|
63
|
-
} catch (error) {
|
|
64
|
-
// Couldn't get branch
|
|
65
|
-
}
|
|
66
|
-
} catch (error) {
|
|
67
|
-
// Error reading git config
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return results;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = new GitHubDetector();
|
package/src/detectors/index.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Detectors
|
|
3
|
-
* Main entry point for all project detection
|
|
4
|
-
*
|
|
5
|
-
* This module orchestrates both framework detection (Next.js, React, etc.)
|
|
6
|
-
* and project metadata detection (GitHub, API clients, etc.)
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const registry = require('./registry');
|
|
10
|
-
const githubDetector = require('./github-detector');
|
|
11
|
-
const apiClientDetector = require('./api-client-detector');
|
|
12
|
-
const oauthDetector = require('./oauth-detector');
|
|
13
|
-
const databaseDetector = require('./database-detector');
|
|
14
|
-
const modelDetector = require('./model-detector');
|
|
15
|
-
|
|
16
|
-
class ProjectDetector {
|
|
17
|
-
/**
|
|
18
|
-
* Run all detectors and return combined results
|
|
19
|
-
*
|
|
20
|
-
* @param {string} projectPath - Path to project directory
|
|
21
|
-
* @returns {object} Combined detection results
|
|
22
|
-
*/
|
|
23
|
-
detect(projectPath = process.cwd()) {
|
|
24
|
-
// Detect framework/project type
|
|
25
|
-
const frameworkDetection = registry.detectProjectType(projectPath);
|
|
26
|
-
|
|
27
|
-
// Detect project metadata (framework-agnostic)
|
|
28
|
-
const githubInfo = githubDetector.detect(projectPath);
|
|
29
|
-
const apiClientInfo = apiClientDetector.detect(projectPath);
|
|
30
|
-
const oauthInfo = oauthDetector.detect(projectPath);
|
|
31
|
-
const databaseInfo = databaseDetector.detect(projectPath);
|
|
32
|
-
const modelInfo = modelDetector.detect(projectPath);
|
|
33
|
-
|
|
34
|
-
// Get detector instance if we have a match
|
|
35
|
-
const detector = frameworkDetection.detected
|
|
36
|
-
? registry.getDetector(frameworkDetection.detected)
|
|
37
|
-
: null;
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
// Framework detection
|
|
41
|
-
framework: {
|
|
42
|
-
type: frameworkDetection.detected,
|
|
43
|
-
confidence: frameworkDetection.confidence,
|
|
44
|
-
metadata: frameworkDetection.metadata,
|
|
45
|
-
supportedFeatures: detector?.getSupportedFeatures() || {},
|
|
46
|
-
availableGenerators: detector?.getAvailableGenerators() || [],
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
// Project metadata (framework-agnostic)
|
|
50
|
-
github: githubInfo,
|
|
51
|
-
apiClient: apiClientInfo,
|
|
52
|
-
oauth: oauthInfo,
|
|
53
|
-
database: databaseInfo,
|
|
54
|
-
models: modelInfo,
|
|
55
|
-
|
|
56
|
-
// Raw detection results (for debugging)
|
|
57
|
-
_raw: {
|
|
58
|
-
frameworkResults: frameworkDetection.allResults,
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// Project path
|
|
62
|
-
projectPath,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Detect models/types in a project
|
|
68
|
-
*
|
|
69
|
-
* @param {string} projectPath - Path to project directory
|
|
70
|
-
* @returns {object} Model detection results
|
|
71
|
-
*/
|
|
72
|
-
detectModels(projectPath = process.cwd()) {
|
|
73
|
-
return modelDetector.detect(projectPath);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Detect database configuration in a project
|
|
78
|
-
*
|
|
79
|
-
* @param {string} projectPath - Path to project directory
|
|
80
|
-
* @returns {object} Database detection results
|
|
81
|
-
*/
|
|
82
|
-
detectDatabase(projectPath = process.cwd()) {
|
|
83
|
-
return databaseDetector.detect(projectPath);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get detector for a specific project type
|
|
88
|
-
*
|
|
89
|
-
* @param {string} type - Project type name (e.g., 'nextjs')
|
|
90
|
-
* @returns {object|null} Detector instance or null
|
|
91
|
-
*/
|
|
92
|
-
getDetector(type) {
|
|
93
|
-
return registry.getDetector(type);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Get all available project types
|
|
98
|
-
*
|
|
99
|
-
* @returns {array} Array of detector names
|
|
100
|
-
*/
|
|
101
|
-
getAvailableTypes() {
|
|
102
|
-
return registry.getAllDetectors().map(d => d.name);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
module.exports = new ProjectDetector();
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mapping Suggestor
|
|
3
|
-
* Suggests mappings between local data models and L4YERCAK3 platform types
|
|
4
|
-
* Pure logic module — no I/O
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Platform types supported by L4YERCAK3
|
|
9
|
-
*/
|
|
10
|
-
const PLATFORM_TYPES = [
|
|
11
|
-
'contact',
|
|
12
|
-
'booking',
|
|
13
|
-
'event',
|
|
14
|
-
'product',
|
|
15
|
-
'invoice',
|
|
16
|
-
'project',
|
|
17
|
-
'form',
|
|
18
|
-
'certificate',
|
|
19
|
-
'benefit',
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Mapping rules: keyword patterns → platform type + base confidence
|
|
24
|
-
* Patterns are matched against lowercase model names
|
|
25
|
-
*/
|
|
26
|
-
const MAPPING_RULES = [
|
|
27
|
-
{
|
|
28
|
-
patterns: ['user', 'customer', 'client', 'member', 'contact', 'person', 'lead', 'subscriber', 'account', 'profile'],
|
|
29
|
-
type: 'contact',
|
|
30
|
-
confidence: 90,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
patterns: ['appointment', 'booking', 'reservation', 'schedule', 'slot'],
|
|
34
|
-
type: 'booking',
|
|
35
|
-
confidence: 85,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
patterns: ['event', 'meeting', 'conference', 'webinar', 'session', 'workshop'],
|
|
39
|
-
type: 'event',
|
|
40
|
-
confidence: 85,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
patterns: ['product', 'item', 'sku', 'merchandise', 'listing', 'catalog'],
|
|
44
|
-
type: 'product',
|
|
45
|
-
confidence: 85,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
patterns: ['invoice', 'bill', 'receipt', 'charge', 'payment', 'order', 'transaction'],
|
|
49
|
-
type: 'invoice',
|
|
50
|
-
confidence: 80,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
patterns: ['project', 'task', 'ticket', 'issue', 'sprint', 'milestone'],
|
|
54
|
-
type: 'project',
|
|
55
|
-
confidence: 80,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
patterns: ['form', 'survey', 'questionnaire', 'submission', 'response'],
|
|
59
|
-
type: 'form',
|
|
60
|
-
confidence: 80,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
patterns: ['certificate', 'credential', 'badge', 'diploma', 'cme', 'license'],
|
|
64
|
-
type: 'certificate',
|
|
65
|
-
confidence: 75,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
patterns: ['benefit', 'claim', 'commission', 'payout', 'reward', 'bonus'],
|
|
69
|
-
type: 'benefit',
|
|
70
|
-
confidence: 75,
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Suggest platform type mappings for detected models
|
|
76
|
-
* @param {Array<{name: string, source: string, fields: string[]}>} models
|
|
77
|
-
* @returns {Array<{localModel: string, platformType: string, confidence: number}>}
|
|
78
|
-
*/
|
|
79
|
-
function suggestMappings(models) {
|
|
80
|
-
if (!models || models.length === 0) return [];
|
|
81
|
-
|
|
82
|
-
const mappings = [];
|
|
83
|
-
|
|
84
|
-
for (const model of models) {
|
|
85
|
-
const lowerName = model.name.toLowerCase();
|
|
86
|
-
let bestMatch = null;
|
|
87
|
-
|
|
88
|
-
for (const rule of MAPPING_RULES) {
|
|
89
|
-
for (const pattern of rule.patterns) {
|
|
90
|
-
if (lowerName.includes(pattern)) {
|
|
91
|
-
// Exact match gets higher confidence
|
|
92
|
-
const isExact = lowerName === pattern;
|
|
93
|
-
const confidence = isExact ? Math.min(rule.confidence + 5, 99) : rule.confidence;
|
|
94
|
-
|
|
95
|
-
if (!bestMatch || confidence > bestMatch.confidence) {
|
|
96
|
-
bestMatch = {
|
|
97
|
-
localModel: model.name,
|
|
98
|
-
platformType: rule.type,
|
|
99
|
-
confidence,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
break; // Only need first pattern match per rule
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (bestMatch) {
|
|
108
|
-
mappings.push(bestMatch);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return mappings;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
module.exports = {
|
|
116
|
-
suggestMappings,
|
|
117
|
-
PLATFORM_TYPES,
|
|
118
|
-
MAPPING_RULES,
|
|
119
|
-
};
|