@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
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Base Detector
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const BaseDetector = require('../src/detectors/base-detector');
|
|
6
|
-
|
|
7
|
-
describe('BaseDetector', () => {
|
|
8
|
-
let detector;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
detector = new BaseDetector();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe('name getter', () => {
|
|
15
|
-
it('throws error when not overridden', () => {
|
|
16
|
-
expect(() => detector.name).toThrow('Detector must implement name getter');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('priority getter', () => {
|
|
21
|
-
it('returns default priority of 50', () => {
|
|
22
|
-
expect(detector.priority).toBe(50);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('detect', () => {
|
|
27
|
-
it('throws error when not overridden', () => {
|
|
28
|
-
expect(() => detector.detect()).toThrow('Detector must implement detect() method');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('throws error with custom path', () => {
|
|
32
|
-
expect(() => detector.detect('/custom/path')).toThrow('Detector must implement detect() method');
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('getSupportedFeatures', () => {
|
|
37
|
-
it('returns default features (all false)', () => {
|
|
38
|
-
const features = detector.getSupportedFeatures();
|
|
39
|
-
|
|
40
|
-
expect(features).toEqual({
|
|
41
|
-
oauth: false,
|
|
42
|
-
stripe: false,
|
|
43
|
-
crm: false,
|
|
44
|
-
projects: false,
|
|
45
|
-
invoices: false,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('getAvailableGenerators', () => {
|
|
51
|
-
it('returns default generators', () => {
|
|
52
|
-
const generators = detector.getAvailableGenerators();
|
|
53
|
-
|
|
54
|
-
expect(generators).toEqual(['api-client', 'env']);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
describe('inheritance', () => {
|
|
59
|
-
it('can be extended with custom implementation', () => {
|
|
60
|
-
class CustomDetector extends BaseDetector {
|
|
61
|
-
get name() {
|
|
62
|
-
return 'custom';
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get priority() {
|
|
66
|
-
return 75;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
detect(projectPath) {
|
|
70
|
-
return {
|
|
71
|
-
detected: true,
|
|
72
|
-
confidence: 0.9,
|
|
73
|
-
metadata: { path: projectPath },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
getSupportedFeatures() {
|
|
78
|
-
return {
|
|
79
|
-
oauth: true,
|
|
80
|
-
stripe: true,
|
|
81
|
-
crm: false,
|
|
82
|
-
projects: false,
|
|
83
|
-
invoices: false,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
getAvailableGenerators() {
|
|
88
|
-
return ['api-client', 'env', 'custom-generator'];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const customDetector = new CustomDetector();
|
|
93
|
-
|
|
94
|
-
expect(customDetector.name).toBe('custom');
|
|
95
|
-
expect(customDetector.priority).toBe(75);
|
|
96
|
-
expect(customDetector.detect('/test').detected).toBe(true);
|
|
97
|
-
expect(customDetector.getSupportedFeatures().oauth).toBe(true);
|
|
98
|
-
expect(customDetector.getAvailableGenerators()).toContain('custom-generator');
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Login Command
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
jest.mock('open', () => ({
|
|
6
|
-
default: jest.fn().mockResolvedValue(undefined),
|
|
7
|
-
}));
|
|
8
|
-
jest.mock('../../src/config/config-manager');
|
|
9
|
-
jest.mock('../../src/api/backend-client');
|
|
10
|
-
jest.mock('inquirer', () => ({
|
|
11
|
-
prompt: jest.fn().mockResolvedValue({ runWizard: false }),
|
|
12
|
-
}));
|
|
13
|
-
jest.mock('../../src/detectors', () => ({
|
|
14
|
-
detect: jest.fn().mockReturnValue({
|
|
15
|
-
framework: { type: null },
|
|
16
|
-
projectPath: '/test/path',
|
|
17
|
-
}),
|
|
18
|
-
}));
|
|
19
|
-
jest.mock('../../src/logo', () => ({
|
|
20
|
-
showLogo: jest.fn(),
|
|
21
|
-
}));
|
|
22
|
-
jest.mock('chalk', () => ({
|
|
23
|
-
cyan: (str) => str,
|
|
24
|
-
yellow: (str) => str,
|
|
25
|
-
green: (str) => str,
|
|
26
|
-
gray: (str) => str,
|
|
27
|
-
red: (str) => str,
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
const configManager = require('../../src/config/config-manager');
|
|
31
|
-
const backendClient = require('../../src/api/backend-client');
|
|
32
|
-
const { default: open } = require('open');
|
|
33
|
-
const inquirer = require('inquirer');
|
|
34
|
-
const projectDetector = require('../../src/detectors');
|
|
35
|
-
|
|
36
|
-
// Can't easily test the full flow with HTTP server, so test module exports
|
|
37
|
-
const loginCommand = require('../../src/commands/login');
|
|
38
|
-
|
|
39
|
-
describe('Login Command', () => {
|
|
40
|
-
let consoleOutput = [];
|
|
41
|
-
let consoleErrors = [];
|
|
42
|
-
const originalConsoleLog = console.log;
|
|
43
|
-
const originalConsoleError = console.error;
|
|
44
|
-
const originalProcessExit = process.exit;
|
|
45
|
-
|
|
46
|
-
beforeEach(() => {
|
|
47
|
-
jest.clearAllMocks();
|
|
48
|
-
consoleOutput = [];
|
|
49
|
-
consoleErrors = [];
|
|
50
|
-
console.log = jest.fn((...args) => {
|
|
51
|
-
consoleOutput.push(args.join(' '));
|
|
52
|
-
});
|
|
53
|
-
console.error = jest.fn((...args) => {
|
|
54
|
-
consoleErrors.push(args.join(' '));
|
|
55
|
-
});
|
|
56
|
-
process.exit = jest.fn();
|
|
57
|
-
|
|
58
|
-
configManager.getSession.mockReturnValue(null);
|
|
59
|
-
backendClient.getLoginUrl.mockReturnValue('https://backend.test.com/auth/cli-login');
|
|
60
|
-
// Mock validateSession to return valid result by default
|
|
61
|
-
backendClient.validateSession.mockResolvedValue({ valid: true, userId: 'user-123' });
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
afterEach(() => {
|
|
65
|
-
console.log = originalConsoleLog;
|
|
66
|
-
console.error = originalConsoleError;
|
|
67
|
-
process.exit = originalProcessExit;
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('module exports', () => {
|
|
71
|
-
it('exports command name', () => {
|
|
72
|
-
expect(loginCommand.command).toBe('login');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('exports description', () => {
|
|
76
|
-
expect(loginCommand.description).toBe('Authenticate with L4YERCAK3 platform');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('exports handler function', () => {
|
|
80
|
-
expect(typeof loginCommand.handler).toBe('function');
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('handler - already logged in', () => {
|
|
85
|
-
it('shows success message when already logged in', async () => {
|
|
86
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
87
|
-
configManager.getSession.mockReturnValue({
|
|
88
|
-
email: 'user@example.com',
|
|
89
|
-
expiresAt: Date.now() + 3600000,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
await loginCommand.handler();
|
|
93
|
-
|
|
94
|
-
expect(consoleOutput.some((line) => line.includes('already logged in'))).toBe(true);
|
|
95
|
-
expect(consoleOutput.some((line) => line.includes('user@example.com'))).toBe(true);
|
|
96
|
-
expect(open).not.toHaveBeenCalled();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('shows session info and offers setup wizard when already logged in', async () => {
|
|
100
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
101
|
-
configManager.getSession.mockReturnValue({
|
|
102
|
-
email: 'user@example.com',
|
|
103
|
-
expiresAt: Date.now() + 3600000,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
await loginCommand.handler();
|
|
107
|
-
|
|
108
|
-
// Should show "What's Next" since we're not in a project (mocked)
|
|
109
|
-
expect(consoleOutput.some((line) => line.includes("What's Next"))).toBe(true);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Note: Full login flow testing is complex due to HTTP server
|
|
114
|
-
// These tests verify the basic structure and early-exit paths
|
|
115
|
-
|
|
116
|
-
describe('post-login wizard prompt', () => {
|
|
117
|
-
it('shows "What\'s Next" when not in a project directory', async () => {
|
|
118
|
-
projectDetector.detect.mockReturnValue({
|
|
119
|
-
framework: { type: null },
|
|
120
|
-
projectPath: '/test/path',
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
124
|
-
configManager.getSession.mockReturnValue({
|
|
125
|
-
email: 'user@example.com',
|
|
126
|
-
expiresAt: Date.now() + 3600000,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
await loginCommand.handler();
|
|
130
|
-
|
|
131
|
-
// When already logged in, we don't get to the post-login wizard
|
|
132
|
-
// This is expected behavior - the test verifies the already-logged-in path
|
|
133
|
-
expect(consoleOutput.some((line) => line.includes('already logged in'))).toBe(true);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('detects Next.js project and prompts for setup', async () => {
|
|
137
|
-
// Mock not logged in initially (for login flow to proceed)
|
|
138
|
-
// Note: Full flow testing would require mocking HTTP server
|
|
139
|
-
// This test verifies the detection logic is wired correctly
|
|
140
|
-
expect(projectDetector.detect).toBeDefined();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Logout Command
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
jest.mock('../../src/config/config-manager');
|
|
6
|
-
jest.mock('../../src/api/backend-client');
|
|
7
|
-
jest.mock('chalk', () => ({
|
|
8
|
-
yellow: (str) => str,
|
|
9
|
-
green: (str) => str,
|
|
10
|
-
gray: (str) => str,
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
const configManager = require('../../src/config/config-manager');
|
|
14
|
-
const backendClient = require('../../src/api/backend-client');
|
|
15
|
-
const logoutCommand = require('../../src/commands/logout');
|
|
16
|
-
|
|
17
|
-
describe('Logout Command', () => {
|
|
18
|
-
let consoleOutput = [];
|
|
19
|
-
const originalConsoleLog = console.log;
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
jest.clearAllMocks();
|
|
23
|
-
consoleOutput = [];
|
|
24
|
-
console.log = jest.fn((...args) => {
|
|
25
|
-
consoleOutput.push(args.join(' '));
|
|
26
|
-
});
|
|
27
|
-
// Mock revokeSession to return success
|
|
28
|
-
backendClient.revokeSession.mockResolvedValue({ success: true });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
afterEach(() => {
|
|
32
|
-
console.log = originalConsoleLog;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe('module exports', () => {
|
|
36
|
-
it('exports command name', () => {
|
|
37
|
-
expect(logoutCommand.command).toBe('logout');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('exports description', () => {
|
|
41
|
-
expect(logoutCommand.description).toBe('Log out from L4YERCAK3 platform');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('exports handler function', () => {
|
|
45
|
-
expect(typeof logoutCommand.handler).toBe('function');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('handler', () => {
|
|
50
|
-
it('shows warning when not logged in', async () => {
|
|
51
|
-
configManager.isLoggedIn.mockReturnValue(false);
|
|
52
|
-
|
|
53
|
-
await logoutCommand.handler();
|
|
54
|
-
|
|
55
|
-
expect(consoleOutput.some((line) => line.includes('not logged in'))).toBe(true);
|
|
56
|
-
expect(configManager.clearSession).not.toHaveBeenCalled();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('clears session when logged in', async () => {
|
|
60
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
61
|
-
|
|
62
|
-
await logoutCommand.handler();
|
|
63
|
-
|
|
64
|
-
expect(configManager.clearSession).toHaveBeenCalled();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('revokes session on backend before clearing locally', async () => {
|
|
68
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
69
|
-
|
|
70
|
-
await logoutCommand.handler();
|
|
71
|
-
|
|
72
|
-
expect(backendClient.revokeSession).toHaveBeenCalled();
|
|
73
|
-
expect(configManager.clearSession).toHaveBeenCalled();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('shows success message after logout', async () => {
|
|
77
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
78
|
-
|
|
79
|
-
await logoutCommand.handler();
|
|
80
|
-
|
|
81
|
-
expect(consoleOutput.some((line) => line.includes('Successfully logged out'))).toBe(true);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Status Command
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
jest.mock('../../src/config/config-manager');
|
|
6
|
-
jest.mock('../../src/api/backend-client');
|
|
7
|
-
jest.mock('chalk', () => ({
|
|
8
|
-
bold: (str) => str,
|
|
9
|
-
red: (str) => str,
|
|
10
|
-
green: (str) => str,
|
|
11
|
-
yellow: (str) => str,
|
|
12
|
-
gray: (str) => str,
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
const configManager = require('../../src/config/config-manager');
|
|
16
|
-
const backendClient = require('../../src/api/backend-client');
|
|
17
|
-
const statusCommand = require('../../src/commands/status');
|
|
18
|
-
|
|
19
|
-
describe('Status Command', () => {
|
|
20
|
-
let consoleOutput = [];
|
|
21
|
-
const originalConsoleLog = console.log;
|
|
22
|
-
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
jest.clearAllMocks();
|
|
25
|
-
consoleOutput = [];
|
|
26
|
-
console.log = jest.fn((...args) => {
|
|
27
|
-
consoleOutput.push(args.join(' '));
|
|
28
|
-
});
|
|
29
|
-
configManager.getBackendUrl.mockReturnValue('https://backend.test.com');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
afterEach(() => {
|
|
33
|
-
console.log = originalConsoleLog;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('module exports', () => {
|
|
37
|
-
it('exports command name', () => {
|
|
38
|
-
expect(statusCommand.command).toBe('status');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('exports description', () => {
|
|
42
|
-
expect(statusCommand.description).toBe('Show authentication status');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('exports handler function', () => {
|
|
46
|
-
expect(typeof statusCommand.handler).toBe('function');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('handler - not logged in', () => {
|
|
51
|
-
beforeEach(() => {
|
|
52
|
-
configManager.isLoggedIn.mockReturnValue(false);
|
|
53
|
-
configManager.getSession.mockReturnValue(null);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('shows not logged in message', async () => {
|
|
57
|
-
await statusCommand.handler();
|
|
58
|
-
|
|
59
|
-
expect(consoleOutput.some((line) => line.includes('Not logged in'))).toBe(true);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('shows login hint', async () => {
|
|
63
|
-
await statusCommand.handler();
|
|
64
|
-
|
|
65
|
-
expect(consoleOutput.some((line) => line.includes('l4yercak3 login'))).toBe(true);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('does not validate session with backend', async () => {
|
|
69
|
-
await statusCommand.handler();
|
|
70
|
-
|
|
71
|
-
expect(backendClient.validateSession).not.toHaveBeenCalled();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('handler - logged in', () => {
|
|
76
|
-
beforeEach(() => {
|
|
77
|
-
configManager.isLoggedIn.mockReturnValue(true);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('shows logged in status', async () => {
|
|
81
|
-
configManager.getSession.mockReturnValue({ token: 'test-token' });
|
|
82
|
-
backendClient.validateSession.mockResolvedValue(null);
|
|
83
|
-
|
|
84
|
-
await statusCommand.handler();
|
|
85
|
-
|
|
86
|
-
expect(consoleOutput.some((line) => line.includes('Logged in'))).toBe(true);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('displays email when available', async () => {
|
|
90
|
-
configManager.getSession.mockReturnValue({
|
|
91
|
-
token: 'test-token',
|
|
92
|
-
email: 'user@example.com',
|
|
93
|
-
});
|
|
94
|
-
backendClient.validateSession.mockResolvedValue(null);
|
|
95
|
-
|
|
96
|
-
await statusCommand.handler();
|
|
97
|
-
|
|
98
|
-
expect(consoleOutput.some((line) => line.includes('user@example.com'))).toBe(true);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('displays expiration with days remaining', async () => {
|
|
102
|
-
const futureDate = Date.now() + 5 * 24 * 60 * 60 * 1000; // 5 days
|
|
103
|
-
configManager.getSession.mockReturnValue({
|
|
104
|
-
token: 'test-token',
|
|
105
|
-
expiresAt: futureDate,
|
|
106
|
-
});
|
|
107
|
-
backendClient.validateSession.mockResolvedValue(null);
|
|
108
|
-
|
|
109
|
-
await statusCommand.handler();
|
|
110
|
-
|
|
111
|
-
// Check that session expiration info is shown (days may vary based on timing)
|
|
112
|
-
expect(consoleOutput.some((line) => line.includes('Session expires'))).toBe(true);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('shows expired warning when session expired', async () => {
|
|
116
|
-
const pastDate = Date.now() - 24 * 60 * 60 * 1000; // Yesterday
|
|
117
|
-
configManager.getSession.mockReturnValue({
|
|
118
|
-
token: 'test-token',
|
|
119
|
-
expiresAt: pastDate,
|
|
120
|
-
});
|
|
121
|
-
backendClient.validateSession.mockResolvedValue(null);
|
|
122
|
-
|
|
123
|
-
await statusCommand.handler();
|
|
124
|
-
|
|
125
|
-
expect(consoleOutput.some((line) => line.includes('expired'))).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('validates session with backend', async () => {
|
|
129
|
-
configManager.getSession.mockReturnValue({ token: 'test-token' });
|
|
130
|
-
backendClient.validateSession.mockResolvedValue({ userId: '123' });
|
|
131
|
-
|
|
132
|
-
await statusCommand.handler();
|
|
133
|
-
|
|
134
|
-
expect(backendClient.validateSession).toHaveBeenCalled();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('displays backend URL on successful validation', async () => {
|
|
138
|
-
configManager.getSession.mockReturnValue({ token: 'test-token' });
|
|
139
|
-
backendClient.validateSession.mockResolvedValue({ userId: '123' });
|
|
140
|
-
|
|
141
|
-
await statusCommand.handler();
|
|
142
|
-
|
|
143
|
-
expect(consoleOutput.some((line) => line.includes('Backend URL'))).toBe(true);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('displays organization count when available', async () => {
|
|
147
|
-
configManager.getSession.mockReturnValue({ token: 'test-token' });
|
|
148
|
-
backendClient.validateSession.mockResolvedValue({
|
|
149
|
-
userId: '123',
|
|
150
|
-
organizations: [{ id: '1' }, { id: '2' }],
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
await statusCommand.handler();
|
|
154
|
-
|
|
155
|
-
expect(consoleOutput.some((line) => line.includes('Organizations: 2'))).toBe(true);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('handles backend validation error gracefully', async () => {
|
|
159
|
-
configManager.getSession.mockReturnValue({ token: 'test-token' });
|
|
160
|
-
backendClient.validateSession.mockRejectedValue(new Error('Network error'));
|
|
161
|
-
|
|
162
|
-
await statusCommand.handler();
|
|
163
|
-
|
|
164
|
-
expect(consoleOutput.some((line) => line.includes('Could not validate session'))).toBe(true);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
});
|