@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,519 +0,0 @@
|
|
|
1
|
-
# CLI Page Auto-Detection Requirements
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The CLI needs to auto-detect pages/screens in connected applications and sync them to the L4YERCAK3 backend. This enables the Activity Protocol to track data flow per-page and allows users to configure object bindings for each page.
|
|
6
|
-
|
|
7
|
-
## Backend API Endpoints (HTTP)
|
|
8
|
-
|
|
9
|
-
**Base URL**: `https://your-deployment.convex.site/api/v1/activity`
|
|
10
|
-
|
|
11
|
-
**Authentication**: All endpoints require authentication via one of:
|
|
12
|
-
- CLI session token: `Authorization: Bearer <cli_session_token>`
|
|
13
|
-
- API key: `X-API-Key: <api_key>`
|
|
14
|
-
- OAuth token: `Authorization: Bearer <oauth_token>`
|
|
15
|
-
|
|
16
|
-
**Required Scopes**:
|
|
17
|
-
- Read operations: `activity:read` or `applications:read`
|
|
18
|
-
- Write operations: `activity:write` or `applications:write`
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
### 1. Bulk Register Pages (Recommended for Auto-Detection)
|
|
23
|
-
|
|
24
|
-
**POST** `/api/v1/activity/pages/bulk`
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
curl -X POST "https://your-deployment.convex.site/api/v1/activity/pages/bulk" \
|
|
28
|
-
-H "Authorization: Bearer <cli_session_token>" \
|
|
29
|
-
-H "Content-Type: application/json" \
|
|
30
|
-
-d '{
|
|
31
|
-
"applicationId": "k1234567890abcdef",
|
|
32
|
-
"pages": [
|
|
33
|
-
{ "path": "/", "name": "Home", "pageType": "static" },
|
|
34
|
-
{ "path": "/dashboard", "name": "Dashboard", "pageType": "static" },
|
|
35
|
-
{ "path": "/dashboard/[id]", "name": "Dashboard Detail", "pageType": "dynamic" },
|
|
36
|
-
{ "path": "/api/users", "name": "API: Users", "pageType": "api_route" }
|
|
37
|
-
]
|
|
38
|
-
}'
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Request Body**:
|
|
42
|
-
```typescript
|
|
43
|
-
{
|
|
44
|
-
applicationId: string, // The connected_application object ID
|
|
45
|
-
pages: Array<{
|
|
46
|
-
path: string, // Route path, e.g., "/dashboard", "/checkout/[id]"
|
|
47
|
-
name: string, // Display name, e.g., "Dashboard", "Checkout Page"
|
|
48
|
-
pageType?: string, // "static", "dynamic", "api_route"
|
|
49
|
-
}>
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
**Response** (200 OK):
|
|
54
|
-
```typescript
|
|
55
|
-
{
|
|
56
|
-
success: true,
|
|
57
|
-
results: Array<{
|
|
58
|
-
path: string,
|
|
59
|
-
pageId: string, // Object ID for the page
|
|
60
|
-
created: boolean // true if new, false if updated
|
|
61
|
-
}>,
|
|
62
|
-
total: number,
|
|
63
|
-
created: number, // Count of newly created pages
|
|
64
|
-
updated: number // Count of updated pages
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
### 2. Register Single Page
|
|
71
|
-
|
|
72
|
-
**POST** `/api/v1/activity/pages`
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
curl -X POST "https://your-deployment.convex.site/api/v1/activity/pages" \
|
|
76
|
-
-H "Authorization: Bearer <cli_session_token>" \
|
|
77
|
-
-H "Content-Type: application/json" \
|
|
78
|
-
-d '{
|
|
79
|
-
"applicationId": "k1234567890abcdef",
|
|
80
|
-
"path": "/checkout/[productId]",
|
|
81
|
-
"name": "Checkout",
|
|
82
|
-
"detectionMethod": "cli_auto",
|
|
83
|
-
"pageType": "dynamic",
|
|
84
|
-
"objectBindings": [
|
|
85
|
-
{
|
|
86
|
-
"objectType": "product",
|
|
87
|
-
"accessMode": "read",
|
|
88
|
-
"syncEnabled": true,
|
|
89
|
-
"syncDirection": "pull"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}'
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Request Body**:
|
|
96
|
-
```typescript
|
|
97
|
-
{
|
|
98
|
-
applicationId: string,
|
|
99
|
-
path: string,
|
|
100
|
-
name: string,
|
|
101
|
-
detectionMethod: "cli_auto" | "manual" | "runtime",
|
|
102
|
-
pageType?: string,
|
|
103
|
-
objectBindings?: Array<{
|
|
104
|
-
objectType: string,
|
|
105
|
-
accessMode: "read" | "write" | "read_write",
|
|
106
|
-
boundObjectIds?: string[],
|
|
107
|
-
syncEnabled: boolean,
|
|
108
|
-
syncDirection?: "push" | "pull" | "bidirectional"
|
|
109
|
-
}>
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Response** (201 Created / 200 Updated):
|
|
114
|
-
```typescript
|
|
115
|
-
{
|
|
116
|
-
success: true,
|
|
117
|
-
pageId: string,
|
|
118
|
-
created: boolean
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
### 3. Get Application Pages
|
|
125
|
-
|
|
126
|
-
**GET** `/api/v1/activity/pages?applicationId=<id>`
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
curl -X GET "https://your-deployment.convex.site/api/v1/activity/pages?applicationId=k1234567890abcdef" \
|
|
130
|
-
-H "Authorization: Bearer <cli_session_token>"
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**Query Parameters**:
|
|
134
|
-
- `applicationId` (required): The connected application ID
|
|
135
|
-
- `status` (optional): Filter by status (e.g., "active", "archived")
|
|
136
|
-
|
|
137
|
-
**Response** (200 OK):
|
|
138
|
-
```typescript
|
|
139
|
-
{
|
|
140
|
-
success: true,
|
|
141
|
-
pages: Array<{
|
|
142
|
-
id: string,
|
|
143
|
-
name: string,
|
|
144
|
-
path: string,
|
|
145
|
-
detectionMethod: string,
|
|
146
|
-
pageType: string,
|
|
147
|
-
objectBindings: Array<{...}>,
|
|
148
|
-
status: string,
|
|
149
|
-
createdAt: number,
|
|
150
|
-
updatedAt: number
|
|
151
|
-
}>,
|
|
152
|
-
total: number
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
### 4. Log Activity Events
|
|
159
|
-
|
|
160
|
-
**POST** `/api/v1/activity/events`
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
curl -X POST "https://your-deployment.convex.site/api/v1/activity/events" \
|
|
164
|
-
-H "Authorization: Bearer <cli_session_token>" \
|
|
165
|
-
-H "Content-Type: application/json" \
|
|
166
|
-
-d '{
|
|
167
|
-
"applicationId": "k1234567890abcdef",
|
|
168
|
-
"eventType": "object_created",
|
|
169
|
-
"severity": "info",
|
|
170
|
-
"category": "object",
|
|
171
|
-
"summary": "Contact '\''John Smith'\'' created",
|
|
172
|
-
"details": {
|
|
173
|
-
"objectType": "contact",
|
|
174
|
-
"objectName": "John Smith",
|
|
175
|
-
"durationMs": 125,
|
|
176
|
-
"correlationId": "req_abc123"
|
|
177
|
-
}
|
|
178
|
-
}'
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
**Request Body**:
|
|
182
|
-
```typescript
|
|
183
|
-
{
|
|
184
|
-
applicationId: string,
|
|
185
|
-
eventType: string, // "api_request", "object_created", "sync_started", etc.
|
|
186
|
-
severity: "debug" | "info" | "warning" | "error",
|
|
187
|
-
category: string, // "api", "sync", "object", "webhook", "transform"
|
|
188
|
-
summary: string, // Human-readable: "Contact 'John Smith' created"
|
|
189
|
-
pageId?: string, // Optional: link event to a specific page
|
|
190
|
-
details?: {
|
|
191
|
-
requestId?: string,
|
|
192
|
-
method?: string, // HTTP method
|
|
193
|
-
endpoint?: string, // API endpoint
|
|
194
|
-
statusCode?: number,
|
|
195
|
-
objectType?: string,
|
|
196
|
-
objectId?: string,
|
|
197
|
-
objectName?: string,
|
|
198
|
-
inputSummary?: string,
|
|
199
|
-
outputSummary?: string,
|
|
200
|
-
syncDirection?: string,
|
|
201
|
-
recordsAffected?: number,
|
|
202
|
-
durationMs?: number,
|
|
203
|
-
errorCode?: string,
|
|
204
|
-
errorMessage?: string,
|
|
205
|
-
stackTrace?: string,
|
|
206
|
-
sourceFile?: string,
|
|
207
|
-
sourceLine?: number,
|
|
208
|
-
correlationId?: string, // Group related events
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Response** (201 Created):
|
|
214
|
-
```typescript
|
|
215
|
-
{
|
|
216
|
-
success: true,
|
|
217
|
-
eventId: string,
|
|
218
|
-
timestamp: number
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
### 5. Get Activity Events
|
|
225
|
-
|
|
226
|
-
**GET** `/api/v1/activity/events?applicationId=<id>`
|
|
227
|
-
|
|
228
|
-
```bash
|
|
229
|
-
curl -X GET "https://your-deployment.convex.site/api/v1/activity/events?applicationId=k1234567890abcdef&severity=error&limit=50" \
|
|
230
|
-
-H "Authorization: Bearer <cli_session_token>"
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
**Query Parameters**:
|
|
234
|
-
- `applicationId` (required): The connected application ID
|
|
235
|
-
- `severity` (optional): Filter by severity (debug, info, warning, error)
|
|
236
|
-
- `category` (optional): Filter by category (api, sync, object, webhook, transform)
|
|
237
|
-
- `debugMode` (optional): Include debug-level events (true/false)
|
|
238
|
-
- `limit` (optional): Max results, default 50, max 200
|
|
239
|
-
|
|
240
|
-
**Response** (200 OK):
|
|
241
|
-
```typescript
|
|
242
|
-
{
|
|
243
|
-
success: true,
|
|
244
|
-
events: Array<{
|
|
245
|
-
_id: string,
|
|
246
|
-
eventType: string,
|
|
247
|
-
severity: string,
|
|
248
|
-
category: string,
|
|
249
|
-
summary: string,
|
|
250
|
-
timestamp: number,
|
|
251
|
-
details?: {...}
|
|
252
|
-
}>,
|
|
253
|
-
hasMore: boolean,
|
|
254
|
-
nextCursor: string | null
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
### 6. Get Activity Statistics
|
|
261
|
-
|
|
262
|
-
**GET** `/api/v1/activity/stats?applicationId=<id>`
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
curl -X GET "https://your-deployment.convex.site/api/v1/activity/stats?applicationId=k1234567890abcdef&timeRange=24h" \
|
|
266
|
-
-H "Authorization: Bearer <cli_session_token>"
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**Query Parameters**:
|
|
270
|
-
- `applicationId` (required): The connected application ID
|
|
271
|
-
- `timeRange` (optional): "1h", "24h", or "7d" (default: "24h")
|
|
272
|
-
|
|
273
|
-
**Response** (200 OK):
|
|
274
|
-
```typescript
|
|
275
|
-
{
|
|
276
|
-
success: true,
|
|
277
|
-
stats: {
|
|
278
|
-
total: number,
|
|
279
|
-
bySeverity: { debug: number, info: number, warning: number, error: number },
|
|
280
|
-
byCategory: { [category: string]: number },
|
|
281
|
-
recentErrors: Array<{ summary: string, timestamp: number, errorMessage?: string }>
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
### 7. Activity Settings
|
|
289
|
-
|
|
290
|
-
**GET** `/api/v1/activity/settings?applicationId=<id>`
|
|
291
|
-
|
|
292
|
-
**PATCH** `/api/v1/activity/settings`
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
# Update settings
|
|
296
|
-
curl -X PATCH "https://your-deployment.convex.site/api/v1/activity/settings" \
|
|
297
|
-
-H "Authorization: Bearer <cli_session_token>" \
|
|
298
|
-
-H "Content-Type: application/json" \
|
|
299
|
-
-d '{
|
|
300
|
-
"applicationId": "k1234567890abcdef",
|
|
301
|
-
"enabled": true,
|
|
302
|
-
"debugModeDefault": false,
|
|
303
|
-
"retentionDays": 7,
|
|
304
|
-
"alertsEnabled": true
|
|
305
|
-
}'
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
---
|
|
309
|
-
|
|
310
|
-
## CLI Implementation Requirements
|
|
311
|
-
|
|
312
|
-
### Phase 1: Page Detection
|
|
313
|
-
|
|
314
|
-
The CLI should scan the connected application and detect pages based on framework:
|
|
315
|
-
|
|
316
|
-
#### Next.js (App Router)
|
|
317
|
-
```
|
|
318
|
-
app/
|
|
319
|
-
├── page.tsx → "/"
|
|
320
|
-
├── about/
|
|
321
|
-
│ └── page.tsx → "/about"
|
|
322
|
-
├── dashboard/
|
|
323
|
-
│ ├── page.tsx → "/dashboard"
|
|
324
|
-
│ └── [id]/
|
|
325
|
-
│ └── page.tsx → "/dashboard/[id]"
|
|
326
|
-
└── api/
|
|
327
|
-
└── users/
|
|
328
|
-
└── route.ts → "/api/users" (api_route)
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
#### Next.js (Pages Router)
|
|
332
|
-
```
|
|
333
|
-
pages/
|
|
334
|
-
├── index.tsx → "/"
|
|
335
|
-
├── about.tsx → "/about"
|
|
336
|
-
├── dashboard/
|
|
337
|
-
│ ├── index.tsx → "/dashboard"
|
|
338
|
-
│ └── [id].tsx → "/dashboard/[id]"
|
|
339
|
-
└── api/
|
|
340
|
-
└── users.ts → "/api/users" (api_route)
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
#### Remix
|
|
344
|
-
```
|
|
345
|
-
app/routes/
|
|
346
|
-
├── _index.tsx → "/"
|
|
347
|
-
├── about.tsx → "/about"
|
|
348
|
-
├── dashboard._index.tsx → "/dashboard"
|
|
349
|
-
└── dashboard.$id.tsx → "/dashboard/$id"
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
#### Astro
|
|
353
|
-
```
|
|
354
|
-
src/pages/
|
|
355
|
-
├── index.astro → "/"
|
|
356
|
-
├── about.astro → "/about"
|
|
357
|
-
└── blog/
|
|
358
|
-
└── [slug].astro → "/blog/[slug]"
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
### Phase 2: Page Name Generation
|
|
362
|
-
|
|
363
|
-
Convert paths to human-readable names:
|
|
364
|
-
- `/` → "Home"
|
|
365
|
-
- `/about` → "About"
|
|
366
|
-
- `/dashboard` → "Dashboard"
|
|
367
|
-
- `/dashboard/[id]` → "Dashboard Detail"
|
|
368
|
-
- `/api/users` → "API: Users"
|
|
369
|
-
- `/checkout/[productId]` → "Checkout"
|
|
370
|
-
|
|
371
|
-
### Phase 3: Page Type Detection
|
|
372
|
-
|
|
373
|
-
- `page.tsx`, `index.tsx`, `.astro` → "static" or "dynamic"
|
|
374
|
-
- `route.ts`, `api/*.ts` → "api_route"
|
|
375
|
-
- Files with `[param]` → "dynamic"
|
|
376
|
-
|
|
377
|
-
### Phase 4: Sync Command
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# Detect and sync pages
|
|
381
|
-
l4yercak3 pages sync
|
|
382
|
-
|
|
383
|
-
# Output:
|
|
384
|
-
# Scanning for pages...
|
|
385
|
-
# Found 12 pages in Next.js App Router
|
|
386
|
-
#
|
|
387
|
-
# Syncing to L4YERCAK3...
|
|
388
|
-
# ✓ / (Home) - created
|
|
389
|
-
# ✓ /about (About) - created
|
|
390
|
-
# ✓ /dashboard (Dashboard) - created
|
|
391
|
-
# ✓ /dashboard/[id] (Dashboard Detail) - created
|
|
392
|
-
# ✓ /api/users (API: Users) - created
|
|
393
|
-
# ...
|
|
394
|
-
#
|
|
395
|
-
# Done! 12 pages synced.
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Phase 5: Activity Logging (Optional Enhancement)
|
|
399
|
-
|
|
400
|
-
The CLI could generate code to automatically log activity events:
|
|
401
|
-
|
|
402
|
-
```typescript
|
|
403
|
-
// Generated: lib/l4yercak3-activity.ts
|
|
404
|
-
const L4YERCAK3_API_URL = process.env.L4YERCAK3_API_URL;
|
|
405
|
-
const L4YERCAK3_API_KEY = process.env.L4YERCAK3_API_KEY;
|
|
406
|
-
const L4YERCAK3_APP_ID = process.env.L4YERCAK3_APPLICATION_ID;
|
|
407
|
-
|
|
408
|
-
export async function logActivity(context: {
|
|
409
|
-
eventType: string;
|
|
410
|
-
category: string;
|
|
411
|
-
summary: string;
|
|
412
|
-
severity?: 'debug' | 'info' | 'warning' | 'error';
|
|
413
|
-
details?: Record<string, unknown>;
|
|
414
|
-
}) {
|
|
415
|
-
try {
|
|
416
|
-
await fetch(`${L4YERCAK3_API_URL}/api/v1/activity/events`, {
|
|
417
|
-
method: 'POST',
|
|
418
|
-
headers: {
|
|
419
|
-
'Content-Type': 'application/json',
|
|
420
|
-
'X-API-Key': L4YERCAK3_API_KEY!,
|
|
421
|
-
},
|
|
422
|
-
body: JSON.stringify({
|
|
423
|
-
applicationId: L4YERCAK3_APP_ID,
|
|
424
|
-
eventType: context.eventType,
|
|
425
|
-
severity: context.severity || 'info',
|
|
426
|
-
category: context.category,
|
|
427
|
-
summary: context.summary,
|
|
428
|
-
details: context.details,
|
|
429
|
-
}),
|
|
430
|
-
});
|
|
431
|
-
} catch (error) {
|
|
432
|
-
// Fire-and-forget logging, don't block the application
|
|
433
|
-
console.error('[L4YERCAK3] Failed to log activity:', error);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
export async function withActivityLogging<T>(
|
|
438
|
-
operation: () => Promise<T>,
|
|
439
|
-
context: {
|
|
440
|
-
eventType: string;
|
|
441
|
-
category: string;
|
|
442
|
-
summary: string;
|
|
443
|
-
objectType?: string;
|
|
444
|
-
}
|
|
445
|
-
): Promise<T> {
|
|
446
|
-
const correlationId = crypto.randomUUID();
|
|
447
|
-
const startTime = Date.now();
|
|
448
|
-
|
|
449
|
-
try {
|
|
450
|
-
const result = await operation();
|
|
451
|
-
logActivity({
|
|
452
|
-
...context,
|
|
453
|
-
severity: 'info',
|
|
454
|
-
details: {
|
|
455
|
-
correlationId,
|
|
456
|
-
durationMs: Date.now() - startTime,
|
|
457
|
-
objectType: context.objectType,
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
return result;
|
|
461
|
-
} catch (error: unknown) {
|
|
462
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
463
|
-
logActivity({
|
|
464
|
-
...context,
|
|
465
|
-
severity: 'error',
|
|
466
|
-
details: {
|
|
467
|
-
correlationId,
|
|
468
|
-
durationMs: Date.now() - startTime,
|
|
469
|
-
errorMessage,
|
|
470
|
-
objectType: context.objectType,
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
throw error;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
## Data Flow
|
|
479
|
-
|
|
480
|
-
```
|
|
481
|
-
┌─────────────────┐ ┌──────────────────────────────┐ ┌─────────────────┐
|
|
482
|
-
│ CLI Tool │────▶│ HTTP API Endpoints │────▶│ Objects DB │
|
|
483
|
-
│ │ │ │ │ │
|
|
484
|
-
│ • Scan pages │ │ POST /api/v1/activity/pages/bulk │ type= │
|
|
485
|
-
│ • Detect types │ │ POST /api/v1/activity/pages │ │ application_page│
|
|
486
|
-
│ • Generate names│ │ POST /api/v1/activity/events │ │ │
|
|
487
|
-
└─────────────────┘ └──────────────────────────────┘ └─────────────────┘
|
|
488
|
-
│
|
|
489
|
-
▼
|
|
490
|
-
┌──────────────────┐
|
|
491
|
-
│ Activity Events │
|
|
492
|
-
│ (Rolling Window)│
|
|
493
|
-
│ 7-day default │
|
|
494
|
-
└──────────────────┘
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
## Testing
|
|
498
|
-
|
|
499
|
-
1. Create a test Next.js app with various page structures
|
|
500
|
-
2. Run `l4yercak3 pages sync`
|
|
501
|
-
3. Verify pages appear in L4YERCAK3 Web Publishing → Applications → [App] → Pages & Bindings
|
|
502
|
-
4. Test that updates (re-running sync) update existing pages rather than creating duplicates
|
|
503
|
-
|
|
504
|
-
## Open Questions for CLI Team
|
|
505
|
-
|
|
506
|
-
1. **Incremental vs Full Sync**: Should we detect deleted pages and mark them as archived?
|
|
507
|
-
2. **Watch Mode**: Should we support `l4yercak3 pages watch` for real-time detection?
|
|
508
|
-
3. **Config File**: Should page detection be configurable via `.l4yercak3/pages.json`?
|
|
509
|
-
4. **Exclusions**: How do we handle pages that shouldn't be tracked (e.g., internal admin routes)?
|
|
510
|
-
|
|
511
|
-
## Error Codes
|
|
512
|
-
|
|
513
|
-
| Code | Description |
|
|
514
|
-
|------|-------------|
|
|
515
|
-
| `INVALID_SESSION` | Authentication failed - token expired or invalid |
|
|
516
|
-
| `INSUFFICIENT_PERMISSIONS` | Missing required scope |
|
|
517
|
-
| `VALIDATION_ERROR` | Missing or invalid request parameters |
|
|
518
|
-
| `NOT_FOUND` | Resource not found |
|
|
519
|
-
| `INTERNAL_ERROR` | Server error |
|