@l4yercak3/cli 1.3.1 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 -243
- 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
package/src/commands/connect.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Connect Command
|
|
3
|
-
* Connects the project to the L4YERCAK3 platform by:
|
|
4
|
-
* 1. Loading the .l4yercak3.json manifest
|
|
5
|
-
* 2. Registering the app (if not already registered)
|
|
6
|
-
* 3. Connecting the GitHub repository for platform-side analysis
|
|
7
|
-
* 4. Writing env vars for platform integration
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const path = require('path');
|
|
12
|
-
const configManager = require('../config/config-manager');
|
|
13
|
-
const backendClient = require('../api/backend-client');
|
|
14
|
-
const manifestGenerator = require('../generators/manifest-generator');
|
|
15
|
-
const githubDetector = require('../detectors/github-detector');
|
|
16
|
-
const { generateProjectPathHash } = require('../utils/file-utils');
|
|
17
|
-
const {
|
|
18
|
-
requireAuth,
|
|
19
|
-
selectOrganization,
|
|
20
|
-
generateNewApiKey,
|
|
21
|
-
} = require('../utils/init-helpers');
|
|
22
|
-
const inquirer = require('inquirer');
|
|
23
|
-
const chalk = require('chalk');
|
|
24
|
-
const pkg = require('../../package.json');
|
|
25
|
-
|
|
26
|
-
async function handleConnect() {
|
|
27
|
-
requireAuth(configManager);
|
|
28
|
-
|
|
29
|
-
console.log(chalk.cyan(' 🔗 Connecting project to L4YERCAK3...\n'));
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const projectPath = process.cwd();
|
|
33
|
-
|
|
34
|
-
// Step 1: Load manifest
|
|
35
|
-
const manifest = manifestGenerator.loadManifest(projectPath);
|
|
36
|
-
if (!manifest) {
|
|
37
|
-
console.log(chalk.yellow(' ⚠️ No .l4yercak3.json manifest found.'));
|
|
38
|
-
console.log(chalk.gray(' Run "l4yercak3 init" first to scan your project.\n'));
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
console.log(chalk.green(` ✅ Loaded manifest (${manifest.framework}, ${manifest.detectedModels?.length || 0} models, ${manifest.detectedRoutes?.length || 0} routes)`));
|
|
43
|
-
|
|
44
|
-
// Step 2: Organization selection
|
|
45
|
-
console.log(chalk.cyan('\n 📦 Organization Setup\n'));
|
|
46
|
-
const existingConfig = configManager.getProjectConfig(projectPath);
|
|
47
|
-
let organizationId, organizationName;
|
|
48
|
-
|
|
49
|
-
if (existingConfig && existingConfig.organizationId) {
|
|
50
|
-
console.log(chalk.green(` ✅ Using organization: ${existingConfig.organizationName || existingConfig.organizationId}`));
|
|
51
|
-
organizationId = existingConfig.organizationId;
|
|
52
|
-
organizationName = existingConfig.organizationName;
|
|
53
|
-
} else {
|
|
54
|
-
const defaultName = manifest.framework || 'My Organization';
|
|
55
|
-
const result = await selectOrganization(defaultName);
|
|
56
|
-
organizationId = result.organizationId;
|
|
57
|
-
organizationName = result.organizationName;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Step 3: Register application if not already registered
|
|
61
|
-
let applicationId = existingConfig?.applicationId || null;
|
|
62
|
-
|
|
63
|
-
if (!applicationId) {
|
|
64
|
-
console.log(chalk.cyan('\n 📱 Registering application...\n'));
|
|
65
|
-
const projectPathHash = generateProjectPathHash(projectPath);
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
const existingApp = await backendClient.checkExistingApplication(organizationId, projectPathHash);
|
|
69
|
-
|
|
70
|
-
if (existingApp.found && existingApp.application) {
|
|
71
|
-
applicationId = existingApp.application.id;
|
|
72
|
-
console.log(chalk.green(` ✅ Found existing registration: ${existingApp.application.name}\n`));
|
|
73
|
-
} else {
|
|
74
|
-
const folderName = path.basename(projectPath);
|
|
75
|
-
const registrationData = {
|
|
76
|
-
organizationId,
|
|
77
|
-
name: folderName,
|
|
78
|
-
description: `Connected via CLI from ${manifest.framework} project`,
|
|
79
|
-
source: {
|
|
80
|
-
type: 'cli',
|
|
81
|
-
projectPathHash,
|
|
82
|
-
cliVersion: pkg.version,
|
|
83
|
-
framework: manifest.framework,
|
|
84
|
-
routerType: manifest.routerType,
|
|
85
|
-
hasTypeScript: manifest.typescript || false,
|
|
86
|
-
},
|
|
87
|
-
connection: {
|
|
88
|
-
features: [],
|
|
89
|
-
},
|
|
90
|
-
deployment: {},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const result = await backendClient.registerApplication(registrationData);
|
|
94
|
-
applicationId = result.applicationId;
|
|
95
|
-
console.log(chalk.green(` ✅ Application registered with L4YERCAK3\n`));
|
|
96
|
-
}
|
|
97
|
-
} catch (regError) {
|
|
98
|
-
console.log(chalk.yellow(` ⚠️ Could not register application: ${regError.message}`));
|
|
99
|
-
console.log(chalk.gray(' Continuing with GitHub connection...\n'));
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
console.log(chalk.green(` ✅ Application already registered (${applicationId})`));
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Step 4: API key setup
|
|
106
|
-
let apiKey = null;
|
|
107
|
-
const envPath = path.join(projectPath, '.env.local');
|
|
108
|
-
|
|
109
|
-
if (fs.existsSync(envPath)) {
|
|
110
|
-
try {
|
|
111
|
-
const envContent = fs.readFileSync(envPath, 'utf8');
|
|
112
|
-
const match = envContent.match(/^L4YERCAK3_API_KEY=(.+)$/m);
|
|
113
|
-
if (match && match[1] && match[1].startsWith('sk_')) {
|
|
114
|
-
console.log(chalk.green(` ✅ API key found in .env.local`));
|
|
115
|
-
} else {
|
|
116
|
-
apiKey = await generateNewApiKey(organizationId);
|
|
117
|
-
}
|
|
118
|
-
} catch {
|
|
119
|
-
apiKey = await generateNewApiKey(organizationId);
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
apiKey = await generateNewApiKey(organizationId);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Step 5: Detect and connect GitHub repository
|
|
126
|
-
console.log(chalk.cyan('\n 🐙 GitHub Repository Connection\n'));
|
|
127
|
-
const githubInfo = githubDetector.detect(projectPath);
|
|
128
|
-
|
|
129
|
-
if (githubInfo.isGitHub) {
|
|
130
|
-
console.log(chalk.green(` ✅ Detected: ${githubInfo.owner}/${githubInfo.repo}`));
|
|
131
|
-
console.log(chalk.gray(` Branch: ${githubInfo.branch || 'main'}`));
|
|
132
|
-
console.log(chalk.gray(` URL: ${githubInfo.url}\n`));
|
|
133
|
-
|
|
134
|
-
const { connectRepo } = await inquirer.prompt([
|
|
135
|
-
{
|
|
136
|
-
type: 'confirm',
|
|
137
|
-
name: 'connectRepo',
|
|
138
|
-
message: 'Connect this repository to L4YERCAK3 for platform analysis?',
|
|
139
|
-
default: true,
|
|
140
|
-
},
|
|
141
|
-
]);
|
|
142
|
-
|
|
143
|
-
if (connectRepo && applicationId) {
|
|
144
|
-
try {
|
|
145
|
-
await backendClient.connectRepo(applicationId, {
|
|
146
|
-
repoUrl: githubInfo.url,
|
|
147
|
-
branch: githubInfo.branch || 'main',
|
|
148
|
-
});
|
|
149
|
-
console.log(chalk.green('\n ✅ Repository connected! The platform will analyze your codebase.'));
|
|
150
|
-
console.log(chalk.gray(' Your app will appear in the builder once analysis completes.\n'));
|
|
151
|
-
} catch (repoError) {
|
|
152
|
-
console.log(chalk.yellow(`\n ⚠️ Could not connect repository: ${repoError.message}`));
|
|
153
|
-
console.log(chalk.gray(' This feature may not be available yet on the platform.\n'));
|
|
154
|
-
}
|
|
155
|
-
} else if (connectRepo && !applicationId) {
|
|
156
|
-
console.log(chalk.yellow('\n ⚠️ Cannot connect repo without a registered application.'));
|
|
157
|
-
console.log(chalk.gray(' Try running "l4yercak3 connect" again after resolving registration.\n'));
|
|
158
|
-
}
|
|
159
|
-
} else if (githubInfo.hasGit) {
|
|
160
|
-
console.log(chalk.yellow(' ⚠️ Git repository detected but not hosted on GitHub.'));
|
|
161
|
-
console.log(chalk.gray(' GitHub connection is required for platform analysis.\n'));
|
|
162
|
-
} else {
|
|
163
|
-
console.log(chalk.yellow(' ⚠️ No git repository detected.'));
|
|
164
|
-
console.log(chalk.gray(' Initialize a git repo and push to GitHub for platform analysis.\n'));
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Step 6: Sync manifest to platform
|
|
168
|
-
if (applicationId) {
|
|
169
|
-
try {
|
|
170
|
-
await backendClient.syncManifest(applicationId, manifest);
|
|
171
|
-
console.log(chalk.green(' ✅ Manifest synced to platform'));
|
|
172
|
-
} catch (syncError) {
|
|
173
|
-
console.log(chalk.yellow(` ⚠️ Could not sync manifest: ${syncError.message}`));
|
|
174
|
-
console.log(chalk.gray(' This feature may not be available yet.\n'));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Step 7: Update .env.local
|
|
179
|
-
if (apiKey || applicationId || organizationId) {
|
|
180
|
-
const envVars = {};
|
|
181
|
-
if (apiKey) envVars.L4YERCAK3_API_KEY = apiKey;
|
|
182
|
-
if (organizationId) envVars.L4YERCAK3_ORG_ID = organizationId;
|
|
183
|
-
if (applicationId) envVars.L4YERCAK3_APP_ID = applicationId;
|
|
184
|
-
|
|
185
|
-
updateEnvFile(envPath, envVars);
|
|
186
|
-
console.log(chalk.green(' ✅ Environment variables written to .env.local\n'));
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Step 8: Save project config
|
|
190
|
-
const projectConfig = {
|
|
191
|
-
...(existingConfig || {}),
|
|
192
|
-
organizationId,
|
|
193
|
-
organizationName,
|
|
194
|
-
applicationId,
|
|
195
|
-
projectPathHash: generateProjectPathHash(projectPath),
|
|
196
|
-
connectedAt: Date.now(),
|
|
197
|
-
githubRepo: githubInfo.isGitHub ? `${githubInfo.owner}/${githubInfo.repo}` : undefined,
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
configManager.saveProjectConfig(projectPath, projectConfig);
|
|
201
|
-
|
|
202
|
-
console.log(chalk.cyan(' 🎉 Connection complete!\n'));
|
|
203
|
-
console.log(chalk.gray(' Next steps:'));
|
|
204
|
-
console.log(chalk.gray(' • Run "l4yercak3 scaffold" to generate integration files'));
|
|
205
|
-
console.log(chalk.gray(' • Run "l4yercak3 sync" after changing your project structure\n'));
|
|
206
|
-
|
|
207
|
-
} catch (error) {
|
|
208
|
-
console.error(chalk.red(`\n ❌ Error: ${error.message}\n`));
|
|
209
|
-
if (process.env.L4YERCAK3_DEBUG && error.stack) {
|
|
210
|
-
console.error(chalk.gray(error.stack));
|
|
211
|
-
}
|
|
212
|
-
process.exit(1);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Update .env.local file, merging new vars with existing content
|
|
218
|
-
* @param {string} envPath - Path to .env.local
|
|
219
|
-
* @param {Object<string, string>} vars - Key-value pairs to set
|
|
220
|
-
*/
|
|
221
|
-
function updateEnvFile(envPath, vars) {
|
|
222
|
-
let content = '';
|
|
223
|
-
if (fs.existsSync(envPath)) {
|
|
224
|
-
content = fs.readFileSync(envPath, 'utf8');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
for (const [key, value] of Object.entries(vars)) {
|
|
228
|
-
const regex = new RegExp(`^${key}=.*$`, 'm');
|
|
229
|
-
if (regex.test(content)) {
|
|
230
|
-
content = content.replace(regex, `${key}=${value}`);
|
|
231
|
-
} else {
|
|
232
|
-
content = `${content.trimEnd()}${content ? '\n' : ''}${key}=${value}\n`;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
fs.writeFileSync(envPath, content, 'utf8');
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
module.exports = {
|
|
240
|
-
command: 'connect',
|
|
241
|
-
description: 'Connect your project to the L4YERCAK3 platform',
|
|
242
|
-
handler: handleConnect,
|
|
243
|
-
};
|
package/src/commands/login.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Login Command
|
|
3
|
-
* Handles CLI authentication via browser OAuth flow
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { default: open } = require('open');
|
|
7
|
-
const configManager = require('../config/config-manager');
|
|
8
|
-
const backendClient = require('../api/backend-client');
|
|
9
|
-
const chalk = require('chalk');
|
|
10
|
-
const inquirer = require('inquirer');
|
|
11
|
-
const projectDetector = require('../detectors');
|
|
12
|
-
const { showLogo } = require('../logo');
|
|
13
|
-
const { showPostLoginMenu, executeMenuAction } = require('../utils/prompt-utils');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generate retro Windows 95 style HTML page
|
|
17
|
-
*/
|
|
18
|
-
function generateRetroPage({ title, icon, heading, headingColor, message, submessage }) {
|
|
19
|
-
return `<!DOCTYPE html>
|
|
20
|
-
<html>
|
|
21
|
-
<head>
|
|
22
|
-
<meta charset="UTF-8">
|
|
23
|
-
<title>${title}</title>
|
|
24
|
-
<link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
|
|
25
|
-
</head>
|
|
26
|
-
<body style="margin: 0; background: #008080; min-height: 100vh; display: flex; align-items: center; justify-content: center;">
|
|
27
|
-
<div style="background: #c0c0c0; border: 2px outset #dfdfdf; width: 400px; box-shadow: 2px 2px 0 #000;">
|
|
28
|
-
<div style="background: linear-gradient(90deg, #000080, #1084d0); padding: 4px 8px; display: flex; justify-content: space-between; align-items: center;">
|
|
29
|
-
<span style="color: white; font-size: 12px; font-family: system-ui;">${icon} ${title}</span>
|
|
30
|
-
<span style="color: white;">×</span>
|
|
31
|
-
</div>
|
|
32
|
-
<div style="padding: 30px; text-align: center;">
|
|
33
|
-
<div style="font-size: 48px; margin-bottom: 16px;">${icon}</div>
|
|
34
|
-
<h1 style="font-family: 'Press Start 2P', monospace; font-size: 14px; color: ${headingColor}; margin-bottom: 16px;">${heading}</h1>
|
|
35
|
-
<p style="font-family: system-ui; color: #000; font-size: 14px;">${message}</p>
|
|
36
|
-
<p style="font-family: system-ui; color: #666; font-size: 12px; margin-top: 16px;">${submessage}</p>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</body>
|
|
40
|
-
</html>`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// CLI callback port - different from Next.js dev server (3000)
|
|
44
|
-
const CLI_CALLBACK_PORT = 3333;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Start local server to receive OAuth callback
|
|
48
|
-
* @param {string} expectedState - The state token to verify against
|
|
49
|
-
*/
|
|
50
|
-
function startCallbackServer(expectedState) {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
const http = require('http');
|
|
53
|
-
|
|
54
|
-
const server = http.createServer((req, res) => {
|
|
55
|
-
const url = new URL(req.url, `http://localhost:${CLI_CALLBACK_PORT}`);
|
|
56
|
-
|
|
57
|
-
if (url.pathname === '/callback') {
|
|
58
|
-
const token = url.searchParams.get('token');
|
|
59
|
-
const returnedState = url.searchParams.get('state');
|
|
60
|
-
|
|
61
|
-
// Verify state to prevent CSRF attacks
|
|
62
|
-
if (returnedState !== expectedState) {
|
|
63
|
-
res.writeHead(400, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
64
|
-
res.end(generateRetroPage({
|
|
65
|
-
title: 'CLI Login Error',
|
|
66
|
-
icon: '⚠️',
|
|
67
|
-
heading: 'Security Error',
|
|
68
|
-
headingColor: '#c00000',
|
|
69
|
-
message: 'State mismatch - possible CSRF attack.',
|
|
70
|
-
submessage: 'Close this window and run <code style="background: #fff; padding: 2px 6px; border: 1px inset #999;">l4yercak3 login</code> again.',
|
|
71
|
-
}));
|
|
72
|
-
|
|
73
|
-
server.close();
|
|
74
|
-
reject(new Error('State mismatch - security validation failed'));
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (token) {
|
|
79
|
-
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
80
|
-
res.end(generateRetroPage({
|
|
81
|
-
title: 'CLI Login',
|
|
82
|
-
icon: '🍰',
|
|
83
|
-
heading: 'Success!',
|
|
84
|
-
headingColor: '#008000',
|
|
85
|
-
message: 'You are now logged in.',
|
|
86
|
-
submessage: 'You can close this window and return to your terminal.',
|
|
87
|
-
}));
|
|
88
|
-
|
|
89
|
-
server.close();
|
|
90
|
-
resolve(token);
|
|
91
|
-
} else {
|
|
92
|
-
res.writeHead(400, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
93
|
-
res.end(generateRetroPage({
|
|
94
|
-
title: 'CLI Login Error',
|
|
95
|
-
icon: '⚠️',
|
|
96
|
-
heading: 'Login Failed',
|
|
97
|
-
headingColor: '#c00000',
|
|
98
|
-
message: 'No token received. Please try again.',
|
|
99
|
-
submessage: 'Close this window and run <code style="background: #fff; padding: 2px 6px; border: 1px inset #999;">l4yercak3 login</code> again.',
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
server.close();
|
|
103
|
-
reject(new Error('No token received'));
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
res.writeHead(404);
|
|
107
|
-
res.end('Not found');
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// Handle server errors (e.g., port already in use)
|
|
112
|
-
server.on('error', (err) => {
|
|
113
|
-
if (err.code === 'EADDRINUSE') {
|
|
114
|
-
reject(new Error(`Port ${CLI_CALLBACK_PORT} is already in use. Please close any other l4yercak3 processes and try again.`));
|
|
115
|
-
} else {
|
|
116
|
-
reject(err);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
server.listen(CLI_CALLBACK_PORT, 'localhost', () => {
|
|
121
|
-
console.log(chalk.gray(' Waiting for authentication...'));
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// Timeout after 5 minutes
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
server.close();
|
|
127
|
-
reject(new Error('Login timeout - please try again'));
|
|
128
|
-
}, 5 * 60 * 1000);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Login command handler
|
|
134
|
-
*/
|
|
135
|
-
async function handleLogin() {
|
|
136
|
-
try {
|
|
137
|
-
// Check if already logged in (local check)
|
|
138
|
-
if (configManager.isLoggedIn()) {
|
|
139
|
-
const session = configManager.getSession();
|
|
140
|
-
|
|
141
|
-
// Show logo
|
|
142
|
-
console.log('');
|
|
143
|
-
showLogo(false);
|
|
144
|
-
|
|
145
|
-
// Validate session with backend to ensure it's actually valid
|
|
146
|
-
console.log(chalk.gray(' Validating session with backend...'));
|
|
147
|
-
const validationResult = await backendClient.validateSession();
|
|
148
|
-
|
|
149
|
-
if (validationResult) {
|
|
150
|
-
console.log(chalk.green(' ✅ You are already logged in'));
|
|
151
|
-
if (session.email) {
|
|
152
|
-
console.log(chalk.gray(` Email: ${session.email}`));
|
|
153
|
-
}
|
|
154
|
-
console.log(chalk.gray(` Session expires: ${new Date(session.expiresAt).toLocaleString()}\n`));
|
|
155
|
-
|
|
156
|
-
// Still offer the setup wizard
|
|
157
|
-
await promptSetupWizard();
|
|
158
|
-
return;
|
|
159
|
-
} else {
|
|
160
|
-
// Session is invalid on backend - revoke it and proceed to login
|
|
161
|
-
console.log(chalk.yellow(' ⚠️ Your session has expired or is invalid'));
|
|
162
|
-
console.log(chalk.gray(' Revoking old session and starting fresh login...\n'));
|
|
163
|
-
|
|
164
|
-
// Try to revoke the old session on backend (cleanup)
|
|
165
|
-
await backendClient.revokeSession();
|
|
166
|
-
configManager.clearSession();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
console.log(chalk.cyan(' 🔐 Opening browser for authentication...\n'));
|
|
171
|
-
|
|
172
|
-
// Generate state for CSRF protection
|
|
173
|
-
const state = backendClient.generateState();
|
|
174
|
-
|
|
175
|
-
// Start callback server with expected state
|
|
176
|
-
const callbackPromise = startCallbackServer(state);
|
|
177
|
-
|
|
178
|
-
// Open browser with state parameter
|
|
179
|
-
const loginUrl = backendClient.getLoginUrl(state);
|
|
180
|
-
console.log(chalk.gray(` Login URL: ${loginUrl}\n`));
|
|
181
|
-
|
|
182
|
-
await open(loginUrl);
|
|
183
|
-
|
|
184
|
-
// Wait for callback
|
|
185
|
-
const token = await callbackPromise;
|
|
186
|
-
|
|
187
|
-
// Validate token and get user info
|
|
188
|
-
console.log(chalk.gray(' Validating session...'));
|
|
189
|
-
|
|
190
|
-
// Save session
|
|
191
|
-
// Note: In real implementation, backend would return full session data
|
|
192
|
-
const session = {
|
|
193
|
-
token,
|
|
194
|
-
expiresAt: Date.now() + (30 * 24 * 60 * 60 * 1000), // 30 days
|
|
195
|
-
// Backend should return: userId, email, etc.
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
configManager.saveSession(session);
|
|
199
|
-
|
|
200
|
-
// Validate session with backend
|
|
201
|
-
try {
|
|
202
|
-
const userInfo = await backendClient.validateSession();
|
|
203
|
-
if (userInfo) {
|
|
204
|
-
configManager.saveSession({
|
|
205
|
-
...session,
|
|
206
|
-
userId: userInfo.userId,
|
|
207
|
-
email: userInfo.email,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
} catch (error) {
|
|
211
|
-
console.log(chalk.yellow(` ⚠️ Warning: Could not validate session: ${error.message}`));
|
|
212
|
-
console.log(chalk.gray(' Session saved, but validation failed. You may need to log in again.'));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// Show logo after successful login
|
|
216
|
-
console.log('');
|
|
217
|
-
showLogo(false);
|
|
218
|
-
|
|
219
|
-
console.log(chalk.green(' ✅ Successfully logged in!\n'));
|
|
220
|
-
|
|
221
|
-
const finalSession = configManager.getSession();
|
|
222
|
-
if (finalSession && finalSession.email) {
|
|
223
|
-
console.log(chalk.gray(` Logged in as: ${finalSession.email}`));
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Post-login: Prompt to run setup wizard
|
|
227
|
-
await promptSetupWizard();
|
|
228
|
-
|
|
229
|
-
} catch (error) {
|
|
230
|
-
console.error(chalk.red(`\n ❌ Login failed: ${error.message}\n`));
|
|
231
|
-
process.exit(1);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Get friendly framework name for display
|
|
237
|
-
*/
|
|
238
|
-
function getFrameworkDisplayName(frameworkType) {
|
|
239
|
-
const names = {
|
|
240
|
-
'nextjs': 'Next.js',
|
|
241
|
-
'expo': 'Expo',
|
|
242
|
-
'react-native': 'React Native',
|
|
243
|
-
};
|
|
244
|
-
return names[frameworkType] || frameworkType;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Prompt user to run the setup wizard after login
|
|
249
|
-
*/
|
|
250
|
-
async function promptSetupWizard() {
|
|
251
|
-
console.log('');
|
|
252
|
-
|
|
253
|
-
// Detect if we're in a project directory
|
|
254
|
-
const detection = projectDetector.detect();
|
|
255
|
-
const isInProject = detection.framework.type !== null;
|
|
256
|
-
|
|
257
|
-
if (isInProject) {
|
|
258
|
-
const frameworkName = getFrameworkDisplayName(detection.framework.type);
|
|
259
|
-
console.log(chalk.cyan(` 🔍 Detected ${frameworkName} project in current directory\n`));
|
|
260
|
-
|
|
261
|
-
// Check if project is already configured
|
|
262
|
-
const existingConfig = configManager.getProjectConfig(detection.projectPath);
|
|
263
|
-
if (existingConfig) {
|
|
264
|
-
console.log(chalk.yellow(' ⚠️ This project is already configured with L4YERCAK3'));
|
|
265
|
-
console.log(chalk.gray(` Organization: ${existingConfig.organizationName || 'Unknown'}`));
|
|
266
|
-
console.log(chalk.gray(` Features: ${existingConfig.features?.join(', ') || 'None'}\n`));
|
|
267
|
-
|
|
268
|
-
const { reconfigure } = await inquirer.prompt([
|
|
269
|
-
{
|
|
270
|
-
type: 'confirm',
|
|
271
|
-
name: 'reconfigure',
|
|
272
|
-
message: 'Would you like to reconfigure this project?',
|
|
273
|
-
default: false,
|
|
274
|
-
},
|
|
275
|
-
]);
|
|
276
|
-
|
|
277
|
-
if (!reconfigure) {
|
|
278
|
-
console.log('');
|
|
279
|
-
const action = await showPostLoginMenu({ isInProject: true, hasExistingConfig: true });
|
|
280
|
-
await executeMenuAction(action);
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
} else {
|
|
284
|
-
const { runWizard } = await inquirer.prompt([
|
|
285
|
-
{
|
|
286
|
-
type: 'confirm',
|
|
287
|
-
name: 'runWizard',
|
|
288
|
-
message: 'Would you like to set up L4YERCAK3 integration for this project now?',
|
|
289
|
-
default: true,
|
|
290
|
-
},
|
|
291
|
-
]);
|
|
292
|
-
|
|
293
|
-
if (!runWizard) {
|
|
294
|
-
console.log('');
|
|
295
|
-
console.log(chalk.yellow(` ℹ️ To generate ${frameworkName}-specific code later, run:\n`));
|
|
296
|
-
console.log(chalk.cyan(' l4yercak3 spread\n'));
|
|
297
|
-
console.log(chalk.gray(' This will create components, hooks, and screens'));
|
|
298
|
-
console.log(chalk.gray(` optimized for ${frameworkName}.\n`));
|
|
299
|
-
const action = await showPostLoginMenu({ isInProject: true, hasExistingConfig: false });
|
|
300
|
-
await executeMenuAction(action);
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Run the setup wizard
|
|
306
|
-
console.log('');
|
|
307
|
-
const { handler: spreadHandler } = require('./spread');
|
|
308
|
-
await spreadHandler();
|
|
309
|
-
|
|
310
|
-
} else {
|
|
311
|
-
// Not in a project directory
|
|
312
|
-
console.log(chalk.cyan(' 📋 What\'s Next?\n'));
|
|
313
|
-
console.log(chalk.gray(' To integrate L4YERCAK3 with your project:\n'));
|
|
314
|
-
console.log(chalk.gray(' 1. Navigate to your project directory'));
|
|
315
|
-
console.log(chalk.gray(' 2. Run: l4yercak3 spread\n'));
|
|
316
|
-
console.log(chalk.gray(' Supported frameworks:'));
|
|
317
|
-
console.log(chalk.gray(' • Next.js (App Router & Pages Router)'));
|
|
318
|
-
console.log(chalk.gray(' • Expo / React Native\n'));
|
|
319
|
-
console.log(chalk.gray(' The spread command will:'));
|
|
320
|
-
console.log(chalk.gray(' • Detect your framework automatically'));
|
|
321
|
-
console.log(chalk.gray(' • Generate platform-specific components'));
|
|
322
|
-
console.log(chalk.gray(' • Set up API client & environment variables'));
|
|
323
|
-
console.log(chalk.gray(' • Configure OAuth authentication (optional)\n'));
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
module.exports = {
|
|
328
|
-
command: 'login',
|
|
329
|
-
description: 'Authenticate with L4YERCAK3 platform',
|
|
330
|
-
handler: handleLogin,
|
|
331
|
-
};
|
|
332
|
-
|
package/src/commands/logout.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Logout Command
|
|
3
|
-
* Clears CLI session both locally and on the backend
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const configManager = require('../config/config-manager');
|
|
7
|
-
const backendClient = require('../api/backend-client');
|
|
8
|
-
const chalk = require('chalk');
|
|
9
|
-
|
|
10
|
-
async function handleLogout() {
|
|
11
|
-
if (!configManager.isLoggedIn()) {
|
|
12
|
-
console.log(chalk.yellow(' ⚠️ You are not logged in\n'));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Revoke session on backend first (cleans up database)
|
|
17
|
-
console.log(chalk.gray(' Revoking session...'));
|
|
18
|
-
await backendClient.revokeSession();
|
|
19
|
-
|
|
20
|
-
// Clear local session
|
|
21
|
-
configManager.clearSession();
|
|
22
|
-
console.log(chalk.green(' ✅ Successfully logged out\n'));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = {
|
|
26
|
-
command: 'logout',
|
|
27
|
-
description: 'Log out from L4YERCAK3 platform',
|
|
28
|
-
handler: handleLogout,
|
|
29
|
-
};
|
|
30
|
-
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Server Command
|
|
3
|
-
*
|
|
4
|
-
* Starts the L4YERCAK3 MCP server for Claude Code integration.
|
|
5
|
-
* The server exposes L4YERCAK3 capabilities as MCP tools.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* l4yercak3 mcp-server
|
|
9
|
-
*
|
|
10
|
-
* To add to Claude Code:
|
|
11
|
-
* claude mcp add l4yercak3 -- npx l4yercak3 mcp-server
|
|
12
|
-
*
|
|
13
|
-
* @module commands/mcp-server
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const { startServer } = require('../mcp/server');
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Check if running in interactive terminal (manual invocation)
|
|
20
|
-
* vs being called by an MCP client (piped stdin/stdout)
|
|
21
|
-
*/
|
|
22
|
-
function isInteractiveTerminal() {
|
|
23
|
-
return process.stdin.isTTY && process.stdout.isTTY;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Show setup instructions when run manually
|
|
28
|
-
*/
|
|
29
|
-
function showManualInvocationHelp() {
|
|
30
|
-
// Use stderr since stdout is reserved for MCP protocol
|
|
31
|
-
console.error('');
|
|
32
|
-
console.error('╔══════════════════════════════════════════════════════════════╗');
|
|
33
|
-
console.error('║ L4YERCAK3 MCP Server - Setup Guide ║');
|
|
34
|
-
console.error('╚══════════════════════════════════════════════════════════════╝');
|
|
35
|
-
console.error('');
|
|
36
|
-
console.error('This command starts the MCP server for AI assistant integration.');
|
|
37
|
-
console.error('It\'s typically called by your MCP client, not run directly.');
|
|
38
|
-
console.error('');
|
|
39
|
-
console.error('📦 Claude Code (CLI):');
|
|
40
|
-
console.error(' l4yercak3 mcp-setup');
|
|
41
|
-
console.error(' # or manually:');
|
|
42
|
-
console.error(' claude mcp add l4yercak3 -- npx @l4yercak3/cli mcp-server');
|
|
43
|
-
console.error('');
|
|
44
|
-
console.error('🖥️ Claude Desktop:');
|
|
45
|
-
console.error(' Add to ~/Library/Application Support/Claude/claude_desktop_config.json:');
|
|
46
|
-
console.error(' {');
|
|
47
|
-
console.error(' "mcpServers": {');
|
|
48
|
-
console.error(' "l4yercak3": {');
|
|
49
|
-
console.error(' "command": "npx",');
|
|
50
|
-
console.error(' "args": ["@l4yercak3/cli", "mcp-server"]');
|
|
51
|
-
console.error(' }');
|
|
52
|
-
console.error(' }');
|
|
53
|
-
console.error(' }');
|
|
54
|
-
console.error('');
|
|
55
|
-
console.error('🔌 Other MCP Clients (Cursor, Cody, Continue, etc.):');
|
|
56
|
-
console.error(' Command: npx @l4yercak3/cli mcp-server');
|
|
57
|
-
console.error(' Transport: stdio');
|
|
58
|
-
console.error('');
|
|
59
|
-
console.error('💡 Requirements:');
|
|
60
|
-
console.error(' • Logged in to L4YERCAK3 (l4yercak3 login)');
|
|
61
|
-
console.error('');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
module.exports = {
|
|
65
|
-
command: 'mcp-server',
|
|
66
|
-
description: 'Start the MCP server for AI assistant integration',
|
|
67
|
-
handler: async () => {
|
|
68
|
-
// Note: All output goes to stderr because stdout is used for MCP protocol
|
|
69
|
-
// console.error is used intentionally here
|
|
70
|
-
|
|
71
|
-
// If running in an interactive terminal (not piped), show help
|
|
72
|
-
if (isInteractiveTerminal()) {
|
|
73
|
-
showManualInvocationHelp();
|
|
74
|
-
console.error('Starting server anyway (press Ctrl+C to exit)...');
|
|
75
|
-
console.error('');
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
await startServer();
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error(`[L4YERCAK3 MCP] Failed to start server: ${error.message}`);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
};
|