alepha 0.15.0 → 0.15.2
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 +43 -98
- package/dist/api/audits/index.d.ts +630 -653
- package/dist/api/audits/index.d.ts.map +1 -1
- package/dist/api/audits/index.js +12 -35
- package/dist/api/audits/index.js.map +1 -1
- package/dist/api/files/index.d.ts +365 -358
- package/dist/api/files/index.d.ts.map +1 -1
- package/dist/api/files/index.js +12 -5
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.d.ts +255 -248
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +10 -3
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/keys/index.d.ts +413 -0
- package/dist/api/keys/index.d.ts.map +1 -0
- package/dist/api/keys/index.js +476 -0
- package/dist/api/keys/index.js.map +1 -0
- package/dist/api/notifications/index.browser.js +4 -4
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +84 -78
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +14 -8
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.d.ts +528 -535
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +30 -37
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/api/users/index.d.ts +1221 -910
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +2556 -248
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +142 -136
- package/dist/api/verifications/index.d.ts.map +1 -1
- package/dist/api/verifications/index.js +12 -4
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/batch/index.d.ts +142 -162
- package/dist/batch/index.d.ts.map +1 -1
- package/dist/batch/index.js +31 -44
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +595 -171
- package/dist/bucket/index.d.ts.map +1 -1
- package/dist/bucket/index.js +1856 -12
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/core/index.d.ts +225 -53
- package/dist/cache/core/index.d.ts.map +1 -1
- package/dist/cache/core/index.js +213 -7
- package/dist/cache/core/index.js.map +1 -1
- package/dist/cache/redis/index.d.ts +1 -0
- package/dist/cache/redis/index.d.ts.map +1 -1
- package/dist/cache/redis/index.js +6 -2
- package/dist/cache/redis/index.js.map +1 -1
- package/dist/cli/index.d.ts +834 -226
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2872 -417
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +458 -310
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +2011 -76
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +309 -97
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +796 -701
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +329 -97
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +309 -97
- package/dist/core/index.native.js.map +1 -1
- package/dist/datetime/index.d.ts +59 -44
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +15 -0
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +314 -19
- package/dist/email/index.d.ts.map +1 -1
- package/dist/email/index.js +1852 -7
- package/dist/email/index.js.map +1 -1
- package/dist/fake/index.d.ts +5500 -5418
- package/dist/fake/index.d.ts.map +1 -1
- package/dist/fake/index.js +113 -42
- package/dist/fake/index.js.map +1 -1
- package/dist/lock/core/index.d.ts +219 -212
- package/dist/lock/core/index.d.ts.map +1 -1
- package/dist/lock/core/index.js +11 -4
- package/dist/lock/core/index.js.map +1 -1
- package/dist/lock/redis/index.d.ts.map +1 -1
- package/dist/logger/index.d.ts +41 -90
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +15 -68
- package/dist/logger/index.js.map +1 -1
- package/dist/mcp/index.d.ts +228 -230
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +32 -31
- package/dist/mcp/index.js.map +1 -1
- package/dist/orm/index.browser.js +12 -12
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.bun.js +90 -80
- package/dist/orm/index.bun.js.map +1 -1
- package/dist/orm/index.d.ts +1434 -1459
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +112 -130
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/core/index.d.ts +262 -254
- package/dist/queue/core/index.d.ts.map +1 -1
- package/dist/queue/core/index.js +14 -6
- package/dist/queue/core/index.js.map +1 -1
- package/dist/queue/redis/index.d.ts.map +1 -1
- package/dist/react/auth/index.browser.js +108 -0
- package/dist/react/auth/index.browser.js.map +1 -0
- package/dist/react/auth/index.d.ts +100 -0
- package/dist/react/auth/index.d.ts.map +1 -0
- package/dist/react/auth/index.js +145 -0
- package/dist/react/auth/index.js.map +1 -0
- package/dist/react/core/index.d.ts +469 -0
- package/dist/react/core/index.d.ts.map +1 -0
- package/dist/react/core/index.js +464 -0
- package/dist/react/core/index.js.map +1 -0
- package/dist/react/form/index.d.ts +232 -0
- package/dist/react/form/index.d.ts.map +1 -0
- package/dist/react/form/index.js +432 -0
- package/dist/react/form/index.js.map +1 -0
- package/dist/react/head/index.browser.js +423 -0
- package/dist/react/head/index.browser.js.map +1 -0
- package/dist/react/head/index.d.ts +288 -0
- package/dist/react/head/index.d.ts.map +1 -0
- package/dist/react/head/index.js +465 -0
- package/dist/react/head/index.js.map +1 -0
- package/dist/react/i18n/index.d.ts +175 -0
- package/dist/react/i18n/index.d.ts.map +1 -0
- package/dist/react/i18n/index.js +224 -0
- package/dist/react/i18n/index.js.map +1 -0
- package/dist/react/router/index.browser.js +1980 -0
- package/dist/react/router/index.browser.js.map +1 -0
- package/dist/react/router/index.d.ts +2068 -0
- package/dist/react/router/index.d.ts.map +1 -0
- package/dist/react/router/index.js +4932 -0
- package/dist/react/router/index.js.map +1 -0
- package/dist/react/websocket/index.d.ts +117 -0
- package/dist/react/websocket/index.d.ts.map +1 -0
- package/dist/react/websocket/index.js +107 -0
- package/dist/react/websocket/index.js.map +1 -0
- package/dist/redis/index.bun.js +4 -0
- package/dist/redis/index.bun.js.map +1 -1
- package/dist/redis/index.d.ts +127 -130
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +16 -25
- package/dist/redis/index.js.map +1 -1
- package/dist/retry/index.d.ts +80 -71
- package/dist/retry/index.d.ts.map +1 -1
- package/dist/retry/index.js +11 -2
- package/dist/retry/index.js.map +1 -1
- package/dist/router/index.d.ts +6 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/scheduler/index.d.ts +119 -28
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +404 -3
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +642 -228
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1579 -37
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +1141 -111
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +1261 -25
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cache/index.d.ts +63 -78
- package/dist/server/cache/index.d.ts.map +1 -1
- package/dist/server/cache/index.js +7 -22
- package/dist/server/cache/index.js.map +1 -1
- package/dist/server/compress/index.d.ts +13 -5
- package/dist/server/compress/index.d.ts.map +1 -1
- package/dist/server/compress/index.js +10 -2
- package/dist/server/compress/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts +46 -22
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js +7 -5
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/server/core/index.d.ts +307 -196
- package/dist/server/core/index.d.ts.map +1 -1
- package/dist/server/core/index.js +271 -38
- package/dist/server/core/index.js.map +1 -1
- package/dist/server/cors/index.d.ts +24 -34
- package/dist/server/cors/index.d.ts.map +1 -1
- package/dist/server/cors/index.js +7 -21
- package/dist/server/cors/index.js.map +1 -1
- package/dist/server/health/index.d.ts +25 -19
- package/dist/server/health/index.d.ts.map +1 -1
- package/dist/server/health/index.js +8 -2
- package/dist/server/health/index.js.map +1 -1
- package/dist/server/helmet/index.d.ts +13 -5
- package/dist/server/helmet/index.d.ts.map +1 -1
- package/dist/server/helmet/index.js +11 -3
- package/dist/server/helmet/index.js.map +1 -1
- package/dist/server/links/index.browser.js +9 -1
- package/dist/server/links/index.browser.js.map +1 -1
- package/dist/server/links/index.d.ts +133 -128
- package/dist/server/links/index.d.ts.map +1 -1
- package/dist/server/links/index.js +24 -11
- package/dist/server/links/index.js.map +1 -1
- package/dist/server/metrics/index.d.ts +524 -4
- package/dist/server/metrics/index.d.ts.map +1 -1
- package/dist/server/metrics/index.js +4472 -7
- package/dist/server/metrics/index.js.map +1 -1
- package/dist/server/multipart/index.d.ts +15 -9
- package/dist/server/multipart/index.d.ts.map +1 -1
- package/dist/server/multipart/index.js +9 -3
- package/dist/server/multipart/index.js.map +1 -1
- package/dist/server/proxy/index.d.ts +110 -104
- package/dist/server/proxy/index.d.ts.map +1 -1
- package/dist/server/proxy/index.js +8 -2
- package/dist/server/proxy/index.js.map +1 -1
- package/dist/server/rate-limit/index.d.ts +46 -51
- package/dist/server/rate-limit/index.d.ts.map +1 -1
- package/dist/server/rate-limit/index.js +18 -55
- package/dist/server/rate-limit/index.js.map +1 -1
- package/dist/server/static/index.d.ts +181 -48
- package/dist/server/static/index.d.ts.map +1 -1
- package/dist/server/static/index.js +1848 -5
- package/dist/server/static/index.js.map +1 -1
- package/dist/server/swagger/index.d.ts +348 -53
- package/dist/server/swagger/index.d.ts.map +1 -1
- package/dist/server/swagger/index.js +1849 -6
- package/dist/server/swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +312 -18
- package/dist/sms/index.d.ts.map +1 -1
- package/dist/sms/index.js +1854 -10
- package/dist/sms/index.js.map +1 -1
- package/dist/system/index.browser.js +496 -0
- package/dist/system/index.browser.js.map +1 -0
- package/dist/system/index.d.ts +1158 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/{file → system}/index.js +412 -20
- package/dist/system/index.js.map +1 -0
- package/dist/thread/index.d.ts +82 -73
- package/dist/thread/index.d.ts.map +1 -1
- package/dist/thread/index.js +13 -4
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/core/index.d.ts +330 -323
- package/dist/topic/core/index.d.ts.map +1 -1
- package/dist/topic/core/index.js +12 -5
- package/dist/topic/core/index.js.map +1 -1
- package/dist/topic/redis/index.d.ts +6 -6
- package/dist/topic/redis/index.d.ts.map +1 -1
- package/dist/vite/index.d.ts +163 -5825
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +130 -477
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +3 -3
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +287 -283
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js +15 -11
- package/dist/websocket/index.js.map +1 -1
- package/package.json +86 -17
- package/src/api/audits/index.ts +10 -33
- package/src/api/files/__tests__/$bucket.spec.ts +1 -1
- package/src/api/files/controllers/AdminFileStatsController.spec.ts +1 -1
- package/src/api/files/controllers/FileController.spec.ts +1 -1
- package/src/api/files/index.ts +10 -3
- package/src/api/files/jobs/FileJobs.spec.ts +1 -1
- package/src/api/files/services/FileService.spec.ts +1 -1
- package/src/api/jobs/index.ts +10 -3
- package/src/api/keys/controllers/AdminApiKeyController.ts +75 -0
- package/src/api/keys/controllers/ApiKeyController.ts +103 -0
- package/src/api/keys/entities/apiKeyEntity.ts +41 -0
- package/src/api/keys/index.ts +49 -0
- package/src/api/keys/schemas/adminApiKeyQuerySchema.ts +7 -0
- package/src/api/keys/schemas/adminApiKeyResourceSchema.ts +17 -0
- package/src/api/keys/schemas/createApiKeyBodySchema.ts +7 -0
- package/src/api/keys/schemas/createApiKeyResponseSchema.ts +11 -0
- package/src/api/keys/schemas/listApiKeyResponseSchema.ts +15 -0
- package/src/api/keys/schemas/revokeApiKeyParamsSchema.ts +5 -0
- package/src/api/keys/schemas/revokeApiKeyResponseSchema.ts +5 -0
- package/src/api/keys/services/ApiKeyService.spec.ts +553 -0
- package/src/api/keys/services/ApiKeyService.ts +306 -0
- package/src/api/logs/TODO.md +52 -0
- package/src/api/notifications/index.ts +10 -4
- package/src/api/parameters/index.ts +9 -30
- package/src/api/parameters/primitives/$config.ts +12 -4
- package/src/api/parameters/services/ConfigStore.ts +9 -3
- package/src/api/users/__tests__/ApiKeys-integration.spec.ts +1035 -0
- package/src/api/users/__tests__/ApiKeys.spec.ts +401 -0
- package/src/api/users/index.ts +14 -3
- package/src/api/users/primitives/$realm.ts +33 -5
- package/src/api/users/providers/RealmProvider.ts +1 -12
- package/src/api/users/services/SessionService.ts +1 -11
- package/src/api/verifications/controllers/VerificationController.ts +2 -0
- package/src/api/verifications/index.ts +10 -4
- package/src/batch/index.ts +9 -36
- package/src/batch/primitives/$batch.ts +0 -8
- package/src/batch/providers/BatchProvider.ts +29 -2
- package/src/bucket/__tests__/shared.ts +1 -1
- package/src/bucket/index.ts +13 -6
- package/src/bucket/primitives/$bucket.ts +1 -1
- package/src/bucket/providers/LocalFileStorageProvider.ts +1 -1
- package/src/bucket/providers/MemoryFileStorageProvider.ts +1 -1
- package/src/cache/core/__tests__/shared.ts +30 -0
- package/src/cache/core/index.ts +11 -6
- package/src/cache/core/primitives/$cache.spec.ts +5 -0
- package/src/cache/core/providers/CacheProvider.ts +17 -0
- package/src/cache/core/providers/MemoryCacheProvider.ts +300 -1
- package/src/cache/redis/__tests__/cache-redis.spec.ts +5 -0
- package/src/cache/redis/providers/RedisCacheProvider.ts +9 -0
- package/src/cli/apps/AlephaCli.ts +3 -16
- package/src/cli/apps/AlephaPackageBuilderCli.ts +10 -2
- package/src/cli/atoms/appEntryOptions.ts +13 -0
- package/src/cli/atoms/buildOptions.ts +1 -1
- package/src/cli/atoms/changelogOptions.ts +1 -1
- package/src/cli/commands/build.ts +64 -52
- package/src/cli/commands/db.ts +17 -11
- package/src/cli/commands/deploy.ts +1 -1
- package/src/cli/commands/dev.ts +13 -49
- package/src/cli/commands/gen/env.ts +6 -3
- package/src/cli/commands/gen/openapi.ts +5 -2
- package/src/cli/commands/init.spec.ts +544 -0
- package/src/cli/commands/init.ts +101 -58
- package/src/cli/commands/lint.ts +8 -2
- package/src/cli/commands/typecheck.ts +11 -0
- package/src/cli/defineConfig.ts +9 -0
- package/src/cli/index.ts +2 -1
- package/src/cli/providers/AppEntryProvider.ts +131 -0
- package/src/cli/providers/ViteBuildProvider.ts +40 -0
- package/src/cli/providers/ViteDevServerProvider.ts +378 -0
- package/src/cli/services/AlephaCliUtils.ts +39 -93
- package/src/cli/services/PackageManagerUtils.ts +140 -17
- package/src/cli/services/ProjectScaffolder.ts +169 -101
- package/src/cli/services/ViteUtils.ts +82 -0
- package/src/cli/{assets/claudeMd.ts → templates/agentMd.ts} +41 -28
- package/src/cli/{assets → templates}/apiHelloControllerTs.ts +2 -1
- package/src/cli/{assets → templates}/biomeJson.ts +2 -1
- package/src/cli/{assets → templates}/dummySpecTs.ts +2 -1
- package/src/cli/{assets → templates}/editorconfig.ts +2 -1
- package/src/cli/templates/gitignore.ts +39 -0
- package/src/cli/{assets → templates}/mainBrowserTs.ts +2 -1
- package/src/cli/templates/mainCss.ts +33 -0
- package/src/cli/templates/mainServerTs.ts +33 -0
- package/src/cli/{assets → templates}/tsconfigJson.ts +2 -1
- package/src/cli/templates/webAppRouterTs.ts +50 -0
- package/src/cli/templates/webHelloComponentTsx.ts +20 -0
- package/src/command/helpers/Runner.spec.ts +4 -0
- package/src/command/helpers/Runner.ts +3 -21
- package/src/command/index.ts +12 -4
- package/src/command/providers/CliProvider.spec.ts +1067 -0
- package/src/command/providers/CliProvider.ts +203 -40
- package/src/core/Alepha.ts +3 -9
- package/src/core/__tests__/Alepha-start.spec.ts +4 -4
- package/src/core/helpers/jsonSchemaToTypeBox.spec.ts +771 -0
- package/src/core/helpers/jsonSchemaToTypeBox.ts +62 -10
- package/src/core/index.shared.ts +1 -0
- package/src/core/index.ts +20 -0
- package/src/core/primitives/$module.ts +12 -0
- package/src/core/providers/EventManager.spec.ts +0 -71
- package/src/core/providers/EventManager.ts +3 -15
- package/src/core/providers/Json.ts +2 -14
- package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +257 -0
- package/src/core/providers/KeylessJsonSchemaCodec.ts +396 -14
- package/src/core/providers/SchemaValidator.spec.ts +236 -0
- package/src/datetime/index.ts +15 -0
- package/src/email/index.ts +10 -5
- package/src/email/providers/LocalEmailProvider.spec.ts +1 -1
- package/src/email/providers/LocalEmailProvider.ts +1 -1
- package/src/fake/__tests__/keyName.example.ts +1 -1
- package/src/fake/__tests__/keyName.spec.ts +5 -5
- package/src/fake/index.ts +9 -6
- package/src/fake/providers/FakeProvider.spec.ts +258 -40
- package/src/fake/providers/FakeProvider.ts +133 -19
- package/src/lock/core/index.ts +11 -4
- package/src/logger/index.ts +17 -66
- package/src/logger/providers/PrettyFormatterProvider.ts +0 -9
- package/src/mcp/errors/McpError.ts +30 -0
- package/src/mcp/index.ts +13 -27
- package/src/mcp/transports/SseMcpTransport.ts +6 -7
- package/src/orm/__tests__/PostgresProvider.spec.ts +2 -2
- package/src/orm/index.browser.ts +2 -2
- package/src/orm/index.bun.ts +4 -2
- package/src/orm/index.ts +21 -47
- package/src/orm/providers/DrizzleKitProvider.ts +3 -5
- package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -0
- package/src/orm/services/Repository.ts +18 -3
- package/src/queue/core/index.ts +14 -6
- package/src/react/auth/__tests__/$auth.spec.ts +202 -0
- package/src/react/auth/hooks/useAuth.ts +32 -0
- package/src/react/auth/index.browser.ts +13 -0
- package/src/react/auth/index.shared.ts +2 -0
- package/src/react/auth/index.ts +48 -0
- package/src/react/auth/providers/ReactAuthProvider.ts +16 -0
- package/src/react/auth/services/ReactAuth.ts +135 -0
- package/src/react/core/__tests__/Router.spec.tsx +169 -0
- package/src/react/core/components/ClientOnly.tsx +49 -0
- package/src/react/core/components/ErrorBoundary.tsx +73 -0
- package/src/react/core/contexts/AlephaContext.ts +7 -0
- package/src/react/core/contexts/AlephaProvider.tsx +42 -0
- package/src/react/core/hooks/useAction.browser.spec.tsx +569 -0
- package/src/react/core/hooks/useAction.ts +480 -0
- package/src/react/core/hooks/useAlepha.ts +26 -0
- package/src/react/core/hooks/useClient.ts +17 -0
- package/src/react/core/hooks/useEvents.ts +51 -0
- package/src/react/core/hooks/useInject.ts +12 -0
- package/src/react/core/hooks/useStore.ts +52 -0
- package/src/react/core/index.ts +90 -0
- package/src/react/form/components/FormState.tsx +17 -0
- package/src/react/form/errors/FormValidationError.ts +18 -0
- package/src/react/form/hooks/useForm.browser.spec.tsx +366 -0
- package/src/react/form/hooks/useForm.ts +47 -0
- package/src/react/form/hooks/useFormState.ts +130 -0
- package/src/react/form/index.ts +44 -0
- package/src/react/form/services/FormModel.ts +614 -0
- package/src/react/head/helpers/SeoExpander.spec.ts +203 -0
- package/src/react/head/helpers/SeoExpander.ts +142 -0
- package/src/react/head/hooks/useHead.spec.tsx +288 -0
- package/src/react/head/hooks/useHead.ts +62 -0
- package/src/react/head/index.browser.ts +26 -0
- package/src/react/head/index.ts +44 -0
- package/src/react/head/interfaces/Head.ts +105 -0
- package/src/react/head/primitives/$head.ts +25 -0
- package/src/react/head/providers/BrowserHeadProvider.browser.spec.ts +196 -0
- package/src/react/head/providers/BrowserHeadProvider.ts +212 -0
- package/src/react/head/providers/HeadProvider.ts +168 -0
- package/src/react/head/providers/ServerHeadProvider.ts +31 -0
- package/src/react/i18n/__tests__/integration.spec.tsx +239 -0
- package/src/react/i18n/components/Localize.spec.tsx +357 -0
- package/src/react/i18n/components/Localize.tsx +35 -0
- package/src/react/i18n/hooks/useI18n.browser.spec.tsx +438 -0
- package/src/react/i18n/hooks/useI18n.ts +18 -0
- package/src/react/i18n/index.ts +41 -0
- package/src/react/i18n/primitives/$dictionary.ts +69 -0
- package/src/react/i18n/providers/I18nProvider.spec.ts +389 -0
- package/src/react/i18n/providers/I18nProvider.ts +278 -0
- package/src/react/router/__tests__/page-head-browser.browser.spec.ts +95 -0
- package/src/react/router/__tests__/page-head.spec.ts +48 -0
- package/src/react/router/__tests__/seo-head.spec.ts +125 -0
- package/src/react/router/atoms/ssrManifestAtom.ts +58 -0
- package/src/react/router/components/ErrorViewer.tsx +872 -0
- package/src/react/router/components/Link.tsx +23 -0
- package/src/react/router/components/NestedView.tsx +223 -0
- package/src/react/router/components/NotFound.tsx +30 -0
- package/src/react/router/constants/PAGE_PRELOAD_KEY.ts +6 -0
- package/src/react/router/contexts/RouterLayerContext.ts +12 -0
- package/src/react/router/errors/Redirection.ts +28 -0
- package/src/react/router/hooks/useActive.ts +52 -0
- package/src/react/router/hooks/useQueryParams.ts +63 -0
- package/src/react/router/hooks/useRouter.ts +20 -0
- package/src/react/router/hooks/useRouterState.ts +11 -0
- package/src/react/router/index.browser.ts +45 -0
- package/src/react/router/index.shared.ts +19 -0
- package/src/react/router/index.ts +142 -0
- package/src/react/router/primitives/$page.browser.spec.tsx +851 -0
- package/src/react/router/primitives/$page.spec.tsx +708 -0
- package/src/react/router/primitives/$page.ts +497 -0
- package/src/react/router/providers/ReactBrowserProvider.ts +309 -0
- package/src/react/router/providers/ReactBrowserRendererProvider.ts +25 -0
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +168 -0
- package/src/react/router/providers/ReactPageProvider.ts +726 -0
- package/src/react/router/providers/ReactServerProvider.spec.tsx +316 -0
- package/src/react/router/providers/ReactServerProvider.ts +558 -0
- package/src/react/router/providers/ReactServerTemplateProvider.ts +979 -0
- package/src/react/router/providers/SSRManifestProvider.ts +334 -0
- package/src/react/router/services/ReactPageServerService.ts +48 -0
- package/src/react/router/services/ReactPageService.ts +27 -0
- package/src/react/router/services/ReactRouter.ts +262 -0
- package/src/react/websocket/hooks/useRoom.tsx +242 -0
- package/src/react/websocket/index.ts +7 -0
- package/src/redis/__tests__/redis.spec.ts +13 -0
- package/src/redis/index.ts +9 -25
- package/src/redis/providers/BunRedisProvider.ts +9 -0
- package/src/redis/providers/NodeRedisProvider.ts +8 -0
- package/src/redis/providers/RedisProvider.ts +16 -0
- package/src/retry/index.ts +11 -2
- package/src/router/index.ts +15 -0
- package/src/scheduler/index.ts +11 -2
- package/src/security/__tests__/BasicAuth.spec.ts +2 -0
- package/src/security/__tests__/ServerSecurityProvider.spec.ts +13 -5
- package/src/security/index.ts +15 -10
- package/src/security/interfaces/IssuerResolver.ts +27 -0
- package/src/security/primitives/$issuer.ts +55 -0
- package/src/security/providers/SecurityProvider.ts +179 -0
- package/src/security/providers/ServerBasicAuthProvider.ts +6 -2
- package/src/security/providers/ServerSecurityProvider.ts +36 -22
- package/src/server/auth/index.ts +12 -7
- package/src/server/cache/index.ts +7 -22
- package/src/server/compress/index.ts +10 -2
- package/src/server/cookies/index.ts +7 -5
- package/src/server/cookies/primitives/$cookie.ts +33 -11
- package/src/server/core/index.ts +17 -7
- package/src/server/core/interfaces/ServerRequest.ts +83 -1
- package/src/server/core/primitives/$action.spec.ts +1 -1
- package/src/server/core/primitives/$action.ts +8 -3
- package/src/server/core/providers/BunHttpServerProvider.ts +1 -1
- package/src/server/core/providers/NodeHttpServerProvider.spec.ts +125 -0
- package/src/server/core/providers/NodeHttpServerProvider.ts +77 -22
- package/src/server/core/providers/ServerLoggerProvider.ts +2 -2
- package/src/server/core/providers/ServerProvider.ts +9 -12
- package/src/server/core/services/ServerRequestParser.spec.ts +520 -0
- package/src/server/core/services/ServerRequestParser.ts +306 -13
- package/src/server/cors/index.ts +7 -21
- package/src/server/cors/primitives/$cors.ts +6 -2
- package/src/server/health/index.ts +8 -2
- package/src/server/helmet/index.ts +11 -3
- package/src/server/links/atoms/apiLinksAtom.ts +7 -0
- package/src/server/links/index.browser.ts +2 -0
- package/src/server/links/index.ts +13 -6
- package/src/server/metrics/index.ts +10 -3
- package/src/server/multipart/index.ts +9 -3
- package/src/server/proxy/index.ts +8 -2
- package/src/server/rate-limit/index.ts +21 -25
- package/src/server/rate-limit/primitives/$rateLimit.ts +6 -2
- package/src/server/rate-limit/providers/ServerRateLimitProvider.spec.ts +38 -14
- package/src/server/rate-limit/providers/ServerRateLimitProvider.ts +22 -56
- package/src/server/static/index.ts +8 -2
- package/src/server/static/providers/ServerStaticProvider.ts +1 -1
- package/src/server/swagger/index.ts +9 -4
- package/src/server/swagger/providers/ServerSwaggerProvider.ts +1 -1
- package/src/sms/index.ts +9 -5
- package/src/sms/providers/LocalSmsProvider.spec.ts +1 -1
- package/src/sms/providers/LocalSmsProvider.ts +1 -1
- package/src/system/index.browser.ts +11 -0
- package/src/system/index.ts +62 -0
- package/src/{file → system}/providers/FileSystemProvider.ts +16 -0
- package/src/{file → system}/providers/MemoryFileSystemProvider.ts +116 -3
- package/src/system/providers/MemoryShellProvider.ts +164 -0
- package/src/{file → system}/providers/NodeFileSystemProvider.spec.ts +2 -2
- package/src/{file → system}/providers/NodeFileSystemProvider.ts +36 -0
- package/src/system/providers/NodeShellProvider.ts +184 -0
- package/src/system/providers/ShellProvider.ts +74 -0
- package/src/{file → system}/services/FileDetector.spec.ts +2 -2
- package/src/thread/index.ts +11 -2
- package/src/topic/core/index.ts +12 -5
- package/src/vite/index.ts +3 -2
- package/src/vite/tasks/buildClient.ts +2 -8
- package/src/vite/tasks/buildServer.ts +84 -21
- package/src/vite/tasks/copyAssets.ts +5 -4
- package/src/vite/tasks/generateSitemap.ts +64 -23
- package/src/vite/tasks/index.ts +0 -2
- package/src/vite/tasks/prerenderPages.ts +49 -24
- package/src/websocket/index.ts +12 -8
- package/dist/file/index.d.ts +0 -839
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js.map +0 -1
- package/src/cli/assets/indexHtml.ts +0 -15
- package/src/cli/assets/mainServerTs.ts +0 -24
- package/src/cli/assets/webAppRouterTs.ts +0 -15
- package/src/cli/assets/webHelloComponentTsx.ts +0 -16
- package/src/cli/commands/format.ts +0 -23
- package/src/file/index.ts +0 -43
- package/src/vite/helpers/boot.ts +0 -117
- package/src/vite/plugins/viteAlephaDev.ts +0 -177
- package/src/vite/tasks/devServer.ts +0 -71
- package/src/vite/tasks/runAlepha.ts +0 -270
- /package/dist/orm/{chunk-DtkW-qnP.js → chunk-DH6iiROE.js} +0 -0
- /package/src/cli/{assets → templates}/apiIndexTs.ts +0 -0
- /package/src/cli/{assets → templates}/webIndexTs.ts +0 -0
- /package/src/{file → system}/errors/FileError.ts +0 -0
- /package/src/{file → system}/services/FileDetector.ts +0 -0
package/dist/command/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as alepha1 from "alepha";
|
|
2
|
-
import { Alepha, AlephaError, Async, KIND, Primitive, Static, TObject, TSchema, TString } from "alepha";
|
|
2
|
+
import { Alepha, AlephaError, Async, Json, KIND, Primitive, Static, TObject, TSchema, TString } from "alepha";
|
|
3
3
|
import * as node_readline_promises0 from "node:readline/promises";
|
|
4
4
|
import * as alepha_logger0 from "alepha/logger";
|
|
5
5
|
import * as fs from "node:fs/promises";
|
|
6
6
|
import { glob } from "node:fs/promises";
|
|
7
7
|
import { DateTimeProvider, Interval } from "alepha/datetime";
|
|
8
|
+
import { Readable } from "node:stream";
|
|
8
9
|
|
|
9
10
|
//#region ../../src/command/errors/CommandError.d.ts
|
|
10
11
|
declare class CommandError extends AlephaError {
|
|
@@ -14,28 +15,28 @@ declare class CommandError extends AlephaError {
|
|
|
14
15
|
//#region ../../src/command/helpers/Asker.d.ts
|
|
15
16
|
interface AskOptions<T extends TSchema = TString> {
|
|
16
17
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
* Response schema expected.
|
|
19
|
+
*
|
|
20
|
+
* Recommended schemas:
|
|
21
|
+
* - t.text() - for free text input
|
|
22
|
+
* - t.number() - for numeric input
|
|
23
|
+
* - t.boolean() - for yes/no input (accepts "true", "false", "1", "0")
|
|
24
|
+
* - t.enum(["option1", "option2"]) - for predefined options
|
|
25
|
+
*
|
|
26
|
+
* You can use schema.default to provide a default value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* ask("What is your name?", { schema: t.text({ default: "John Doe" }) })
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @default TString
|
|
34
|
+
*/
|
|
34
35
|
schema?: T;
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* Custom validation function.
|
|
38
|
+
* Throws an AlephaError in case of validation failure.
|
|
39
|
+
*/
|
|
39
40
|
validate?: (value: Static<T>) => void;
|
|
40
41
|
}
|
|
41
42
|
interface AskMethod {
|
|
@@ -56,10 +57,10 @@ declare class Asker {
|
|
|
56
57
|
declare class EnvUtils {
|
|
57
58
|
protected readonly log: alepha_logger0.Logger;
|
|
58
59
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* Load environment variables from .env files into process.env.
|
|
61
|
+
* By default, it loads from ".env" and ".env.local".
|
|
62
|
+
* You can specify additional files to load, e.g. [".env", ".env.production"].
|
|
63
|
+
*/
|
|
63
64
|
loadEnv(root: string, files?: string[]): Promise<void>;
|
|
64
65
|
}
|
|
65
66
|
//#endregion
|
|
@@ -85,43 +86,110 @@ declare class PrettyPrint {
|
|
|
85
86
|
dim: string;
|
|
86
87
|
};
|
|
87
88
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
* Start a new command session with header
|
|
90
|
+
*/
|
|
90
91
|
startCommand(cliName: string, commandName: string): void;
|
|
91
92
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
* End the command session with footer
|
|
94
|
+
*/
|
|
94
95
|
endCommand(): void;
|
|
95
96
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
* Start an animated spinner with a task name
|
|
98
|
+
*/
|
|
98
99
|
startSpinner(id: string, taskName: string): void;
|
|
99
100
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
* Stop the spinner and show success with a tick
|
|
102
|
+
*/
|
|
102
103
|
success(id: string, taskName?: string, duration?: string): void;
|
|
103
104
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
* Stop the spinner and show error with a cross
|
|
106
|
+
*/
|
|
106
107
|
error(id: string, taskName?: string): void;
|
|
107
108
|
/**
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
* Update the display for all tasks
|
|
110
|
+
*/
|
|
110
111
|
protected updateDisplay(): void;
|
|
111
112
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
* Check if all tasks are done and stop the interval
|
|
114
|
+
*/
|
|
114
115
|
protected checkIfAllDone(): void;
|
|
115
116
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
* Stop the spinner without showing any symbol
|
|
118
|
+
*/
|
|
118
119
|
stopSpinner(): void;
|
|
119
120
|
/**
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
* Clear all tasks
|
|
122
|
+
*/
|
|
122
123
|
clear(): void;
|
|
123
124
|
}
|
|
124
125
|
//#endregion
|
|
126
|
+
//#region ../../src/system/providers/ShellProvider.d.ts
|
|
127
|
+
interface ShellRunOptions {
|
|
128
|
+
/**
|
|
129
|
+
* Working directory for the command.
|
|
130
|
+
*/
|
|
131
|
+
root?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Additional environment variables.
|
|
134
|
+
*/
|
|
135
|
+
env?: Record<string, string>;
|
|
136
|
+
/**
|
|
137
|
+
* Resolve the executable from node_modules/.bin.
|
|
138
|
+
* Supports local project, pnpm nested, and monorepo structures.
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
resolve?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Capture stdout instead of inheriting stdio.
|
|
144
|
+
* When true, returns stdout as string.
|
|
145
|
+
* When false, streams output to terminal.
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
capture?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Abstract provider for executing shell commands and binaries.
|
|
152
|
+
*
|
|
153
|
+
* Implementations:
|
|
154
|
+
* - `NodeShellProvider` - Real shell execution using Node.js child_process
|
|
155
|
+
* - `MemoryShellProvider` - In-memory mock for testing
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* class MyService {
|
|
160
|
+
* protected readonly shell = $inject(ShellProvider);
|
|
161
|
+
*
|
|
162
|
+
* async build() {
|
|
163
|
+
* // Run shell command directly
|
|
164
|
+
* await this.shell.run("yarn install");
|
|
165
|
+
*
|
|
166
|
+
* // Run local binary with resolution
|
|
167
|
+
* await this.shell.run("vite build", { resolve: true });
|
|
168
|
+
*
|
|
169
|
+
* // Capture output
|
|
170
|
+
* const output = await this.shell.run("echo hello", { capture: true });
|
|
171
|
+
* }
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare abstract class ShellProvider {
|
|
176
|
+
/**
|
|
177
|
+
* Run a shell command or binary.
|
|
178
|
+
*
|
|
179
|
+
* @param command - The command to run
|
|
180
|
+
* @param options - Execution options
|
|
181
|
+
* @returns stdout if capture is true, empty string otherwise
|
|
182
|
+
*/
|
|
183
|
+
abstract run(command: string, options?: ShellRunOptions): Promise<string>;
|
|
184
|
+
/**
|
|
185
|
+
* Check if a command is installed and available in the system PATH.
|
|
186
|
+
*
|
|
187
|
+
* @param command - The command name to check
|
|
188
|
+
* @returns true if the command is available
|
|
189
|
+
*/
|
|
190
|
+
abstract isInstalled(command: string): Promise<boolean>;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
125
193
|
//#region ../../src/command/helpers/Runner.d.ts
|
|
126
194
|
type Task = {
|
|
127
195
|
name: string;
|
|
@@ -133,12 +201,12 @@ interface Timer {
|
|
|
133
201
|
}
|
|
134
202
|
interface RunOptions {
|
|
135
203
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
204
|
+
* Rename the command for logging purposes.
|
|
205
|
+
*/
|
|
138
206
|
alias?: string;
|
|
139
207
|
/**
|
|
140
|
-
|
|
141
|
-
|
|
208
|
+
* Root directory to execute the command in.
|
|
209
|
+
*/
|
|
142
210
|
root?: string;
|
|
143
211
|
}
|
|
144
212
|
interface RunnerMethod {
|
|
@@ -152,6 +220,7 @@ declare class Runner {
|
|
|
152
220
|
protected readonly startTime: number;
|
|
153
221
|
protected readonly prettyPrint: PrettyPrint;
|
|
154
222
|
protected readonly alepha: Alepha;
|
|
223
|
+
protected readonly shell: ShellProvider;
|
|
155
224
|
readonly run: RunnerMethod;
|
|
156
225
|
protected cliName: string;
|
|
157
226
|
protected commandName: string;
|
|
@@ -159,22 +228,22 @@ declare class Runner {
|
|
|
159
228
|
constructor();
|
|
160
229
|
protected get useDynamicLogger(): boolean;
|
|
161
230
|
/**
|
|
162
|
-
|
|
163
|
-
|
|
231
|
+
* Start a new command session with header (for pretty print mode)
|
|
232
|
+
*/
|
|
164
233
|
startCommand(cliName: string, commandName: string): void;
|
|
165
234
|
protected createRunMethod(): RunnerMethod;
|
|
166
235
|
protected exec(cmd: string, opts?: {
|
|
167
236
|
root?: string;
|
|
168
237
|
}): Promise<string>;
|
|
169
238
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
239
|
+
* Executes one or more tasks.
|
|
240
|
+
*
|
|
241
|
+
* @param task - A single task or an array of tasks to run in parallel.
|
|
242
|
+
*/
|
|
174
243
|
protected execute(task: Task | Task[]): Promise<string>;
|
|
175
244
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
245
|
+
* Prints a summary of all executed tasks and their durations.
|
|
246
|
+
*/
|
|
178
247
|
end(): void;
|
|
179
248
|
protected executeTask(task: Task): Promise<string>;
|
|
180
249
|
protected renderTable(data: string[][]): void;
|
|
@@ -193,203 +262,203 @@ declare const $command: {
|
|
|
193
262
|
};
|
|
194
263
|
interface CommandPrimitiveOptions<T extends TObject, A extends TSchema, E extends TObject = TObject> {
|
|
195
264
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
265
|
+
* The handler function to execute when the command is matched.
|
|
266
|
+
*
|
|
267
|
+
* For parent commands with children, the handler is called when:
|
|
268
|
+
* - The parent command is invoked without a subcommand
|
|
269
|
+
* - The parent command is invoked with --help (to show available subcommands)
|
|
270
|
+
*/
|
|
202
271
|
handler: (args: CommandHandlerArgs<T, A, E>) => Async<void>;
|
|
203
272
|
/**
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
273
|
+
* The name of the command. If omitted, the property key is used.
|
|
274
|
+
*
|
|
275
|
+
* An empty string "" denotes the root command.
|
|
276
|
+
*/
|
|
208
277
|
name?: string;
|
|
209
278
|
/**
|
|
210
|
-
|
|
211
|
-
|
|
279
|
+
* A short description of the command, shown in the help message.
|
|
280
|
+
*/
|
|
212
281
|
description?: string;
|
|
213
282
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
283
|
+
* An array of alternative names for the command.
|
|
284
|
+
*/
|
|
216
285
|
aliases?: string[];
|
|
217
286
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
287
|
+
* A TypeBox object schema defining the flags for the command.
|
|
288
|
+
*/
|
|
220
289
|
flags?: T;
|
|
221
290
|
/**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
291
|
+
* A TypeBox object schema defining required environment variables.
|
|
292
|
+
*
|
|
293
|
+
* Environment variables are validated before the handler runs (fail fast).
|
|
294
|
+
* They are displayed in the help output under "Env:" section.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* $command({
|
|
299
|
+
* env: t.object({
|
|
300
|
+
* VERCEL_TOKEN: t.text({ description: "Vercel API token" }),
|
|
301
|
+
* VERCEL_ORG_ID: t.optional(t.text({ description: "Organization ID" })),
|
|
302
|
+
* }),
|
|
303
|
+
* handler: async ({ env }) => {
|
|
304
|
+
* // env.VERCEL_TOKEN is typed & guaranteed to exist
|
|
305
|
+
* console.log(env.VERCEL_TOKEN);
|
|
306
|
+
* }
|
|
307
|
+
* })
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
241
310
|
env?: E;
|
|
242
311
|
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
312
|
+
* An optional TypeBox schema defining the arguments for the command.
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* args: t.text()
|
|
316
|
+
* my-cli command <arg1: string>
|
|
317
|
+
*
|
|
318
|
+
* args: t.optional(t.text())
|
|
319
|
+
* my-cli command [arg1: string]
|
|
320
|
+
*
|
|
321
|
+
* args: t.tuple([t.text(), t.number()])
|
|
322
|
+
* my-cli command <arg1: string> <arg2: number>
|
|
323
|
+
*
|
|
324
|
+
* args: t.tuple([t.text(), t.optional(t.number())])
|
|
325
|
+
* my-cli command <arg1: string> [arg2: number]
|
|
326
|
+
*/
|
|
258
327
|
args?: A;
|
|
259
328
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
329
|
+
* Marks this command as the root command.
|
|
330
|
+
* Equivalent to setting name to an empty string "".
|
|
331
|
+
*/
|
|
263
332
|
root?: boolean;
|
|
264
333
|
/**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
334
|
+
* Run this command's handler BEFORE the specified target command.
|
|
335
|
+
*
|
|
336
|
+
* Pre-hooks are not listed in help and cannot be called directly.
|
|
337
|
+
* They receive the same parsed flags and args as the target command.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```ts
|
|
341
|
+
* class BuildCommands {
|
|
342
|
+
* prebuild = $command({
|
|
343
|
+
* pre: "build",
|
|
344
|
+
* handler: async ({ run }) => {
|
|
345
|
+
* await run("cleaning dist folder...", () => fs.rm("dist"));
|
|
346
|
+
* }
|
|
347
|
+
* });
|
|
348
|
+
*
|
|
349
|
+
* build = $command({
|
|
350
|
+
* name: "build",
|
|
351
|
+
* handler: async () => { ... }
|
|
352
|
+
* });
|
|
353
|
+
* }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
287
356
|
pre?: string;
|
|
288
357
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
358
|
+
* Run this command's handler AFTER the specified target command.
|
|
359
|
+
*
|
|
360
|
+
* Post-hooks are not listed in help and cannot be called directly.
|
|
361
|
+
* They receive the same parsed flags and args as the target command.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```ts
|
|
365
|
+
* class BuildCommands {
|
|
366
|
+
* build = $command({
|
|
367
|
+
* name: "build",
|
|
368
|
+
* handler: async () => { ... }
|
|
369
|
+
* });
|
|
370
|
+
*
|
|
371
|
+
* postbuild = $command({
|
|
372
|
+
* post: "build",
|
|
373
|
+
* handler: async ({ run }) => {
|
|
374
|
+
* await run("generating checksums...", generateChecksums);
|
|
375
|
+
* }
|
|
376
|
+
* });
|
|
377
|
+
* }
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
311
380
|
post?: string;
|
|
312
381
|
/**
|
|
313
|
-
|
|
314
|
-
|
|
382
|
+
* If true, this command will be hidden from the help output.
|
|
383
|
+
*/
|
|
315
384
|
hide?: boolean;
|
|
316
385
|
/**
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
386
|
+
* Adds a `--mode, -m` flag to load environment files.
|
|
387
|
+
*
|
|
388
|
+
* When enabled:
|
|
389
|
+
* - Loads `.env` and `.env.local` by default
|
|
390
|
+
* - With `--mode production`, also loads `.env.production` and `.env.production.local`
|
|
391
|
+
* - The mode value is exposed in the handler as `mode: string | undefined`
|
|
392
|
+
*
|
|
393
|
+
* Set to `true` to enable with no default, or a string to set a default mode.
|
|
394
|
+
*
|
|
395
|
+
* This follows Vite's environment loading convention.
|
|
396
|
+
* @see https://vite.dev/guide/env-and-mode
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```ts
|
|
400
|
+
* // No default mode
|
|
401
|
+
* build = $command({
|
|
402
|
+
* mode: true,
|
|
403
|
+
* handler: async ({ mode }) => {
|
|
404
|
+
* console.log(`Building for ${mode ?? 'development'}...`);
|
|
405
|
+
* }
|
|
406
|
+
* });
|
|
407
|
+
*
|
|
408
|
+
* // Default mode "production"
|
|
409
|
+
* deploy = $command({
|
|
410
|
+
* mode: "production",
|
|
411
|
+
* handler: async ({ mode }) => {
|
|
412
|
+
* console.log(`Deploying for ${mode}...`); // always defined
|
|
413
|
+
* }
|
|
414
|
+
* });
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* Usage:
|
|
418
|
+
* - `cli build` - loads .env (mode = undefined)
|
|
419
|
+
* - `cli build --mode production` - loads .env and .env.production
|
|
420
|
+
* - `cli deploy` - loads .env and .env.production (default mode)
|
|
421
|
+
* - `cli deploy --mode staging` - loads .env and .env.staging
|
|
422
|
+
*/
|
|
354
423
|
mode?: boolean | string;
|
|
355
424
|
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
425
|
+
* Child commands (subcommands) for this command.
|
|
426
|
+
*
|
|
427
|
+
* When children are defined, the command becomes a parent command that
|
|
428
|
+
* can be invoked with space-separated subcommands:
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```ts
|
|
432
|
+
* class DeployCommands {
|
|
433
|
+
* // Subcommands
|
|
434
|
+
* vercel = $command({
|
|
435
|
+
* description: "Deploy to Vercel",
|
|
436
|
+
* handler: async () => { ... }
|
|
437
|
+
* });
|
|
438
|
+
*
|
|
439
|
+
* cloudflare = $command({
|
|
440
|
+
* description: "Deploy to Cloudflare",
|
|
441
|
+
* handler: async () => { ... }
|
|
442
|
+
* });
|
|
443
|
+
*
|
|
444
|
+
* // Parent command with children
|
|
445
|
+
* deploy = $command({
|
|
446
|
+
* description: "Deploy the application",
|
|
447
|
+
* children: [this.vercel, this.cloudflare],
|
|
448
|
+
* handler: async () => {
|
|
449
|
+
* // Called when "deploy" is invoked without subcommand
|
|
450
|
+
* console.log("Available: deploy vercel, deploy cloudflare");
|
|
451
|
+
* }
|
|
452
|
+
* });
|
|
453
|
+
* }
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* This allows CLI usage like:
|
|
457
|
+
* - `cli deploy vercel` - runs the vercel subcommand
|
|
458
|
+
* - `cli deploy cloudflare` - runs the cloudflare subcommand
|
|
459
|
+
* - `cli deploy` - runs the parent handler (shows available subcommands)
|
|
460
|
+
* - `cli deploy --help` - shows help with all available subcommands
|
|
461
|
+
*/
|
|
393
462
|
children?: CommandPrimitive<any, any>[];
|
|
394
463
|
}
|
|
395
464
|
declare class CommandPrimitive<T extends TObject = TObject, A extends TSchema = TSchema, E extends TObject = TObject> extends Primitive<CommandPrimitiveOptions<T, A, E>> {
|
|
@@ -399,16 +468,16 @@ declare class CommandPrimitive<T extends TObject = TObject, A extends TSchema =
|
|
|
399
468
|
protected onInit(): void;
|
|
400
469
|
get name(): string;
|
|
401
470
|
/**
|
|
402
|
-
|
|
403
|
-
|
|
471
|
+
* Get the child commands (subcommands) for this command.
|
|
472
|
+
*/
|
|
404
473
|
get children(): CommandPrimitive<any, any>[];
|
|
405
474
|
/**
|
|
406
|
-
|
|
407
|
-
|
|
475
|
+
* Check if this command has child commands (is a parent command).
|
|
476
|
+
*/
|
|
408
477
|
get hasChildren(): boolean;
|
|
409
478
|
/**
|
|
410
|
-
|
|
411
|
-
|
|
479
|
+
* Find a child command by name or alias.
|
|
480
|
+
*/
|
|
412
481
|
findChild(name: string): CommandPrimitive<any, any> | undefined;
|
|
413
482
|
}
|
|
414
483
|
interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema, E extends TObject = TObject> {
|
|
@@ -420,31 +489,31 @@ interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema, E e
|
|
|
420
489
|
glob: typeof glob;
|
|
421
490
|
fs: typeof fs;
|
|
422
491
|
/**
|
|
423
|
-
|
|
424
|
-
|
|
492
|
+
* The root directory where the command is executed.
|
|
493
|
+
*/
|
|
425
494
|
root: string;
|
|
426
495
|
/**
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
496
|
+
* Display help for the current command.
|
|
497
|
+
*
|
|
498
|
+
* Useful for parent commands with children to show available subcommands
|
|
499
|
+
* when invoked without a specific subcommand.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* deploy = $command({
|
|
504
|
+
* children: [this.vercel, this.cloudflare],
|
|
505
|
+
* handler: async ({ help }) => {
|
|
506
|
+
* help(); // Shows available subcommands
|
|
507
|
+
* }
|
|
508
|
+
* });
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
442
511
|
help: () => void;
|
|
443
512
|
/**
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
513
|
+
* The current execution mode (e.g., "development", "production", "staging").
|
|
514
|
+
*
|
|
515
|
+
* Use --mode flag to set this value when running the command.
|
|
516
|
+
*/
|
|
448
517
|
mode?: string;
|
|
449
518
|
}
|
|
450
519
|
//#endregion
|
|
@@ -505,6 +574,32 @@ declare module "alepha" {
|
|
|
505
574
|
[cliOptions.key]: CliProviderOptions;
|
|
506
575
|
}
|
|
507
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* CLI provider for parsing and executing commands.
|
|
579
|
+
*
|
|
580
|
+
* Handles:
|
|
581
|
+
* - Command resolution (simple, nested, colon-notation)
|
|
582
|
+
* - Flag and argument parsing
|
|
583
|
+
* - Environment variable validation
|
|
584
|
+
* - Help generation
|
|
585
|
+
* - Pre/post command hooks
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* // Define a command
|
|
590
|
+
* class MyCommands {
|
|
591
|
+
* build = $command({
|
|
592
|
+
* name: "build",
|
|
593
|
+
* description: "Build the project",
|
|
594
|
+
* flags: t.object({ watch: t.optional(t.boolean()) }),
|
|
595
|
+
* handler: async ({ flags }) => { ... }
|
|
596
|
+
* });
|
|
597
|
+
* }
|
|
598
|
+
*
|
|
599
|
+
* // CLI automatically discovers and executes commands
|
|
600
|
+
* const alepha = Alepha.create().with(MyCommands);
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
508
603
|
declare class CliProvider {
|
|
509
604
|
protected readonly env: {
|
|
510
605
|
CLI_NAME: string;
|
|
@@ -524,6 +619,9 @@ declare class CliProvider {
|
|
|
524
619
|
protected get name(): string;
|
|
525
620
|
protected get description(): string;
|
|
526
621
|
protected get argv(): string[];
|
|
622
|
+
/**
|
|
623
|
+
* Global flags available to all commands.
|
|
624
|
+
*/
|
|
527
625
|
protected readonly globalFlags: {
|
|
528
626
|
help: {
|
|
529
627
|
aliases: string[];
|
|
@@ -531,115 +629,165 @@ declare class CliProvider {
|
|
|
531
629
|
schema: alepha1.TBoolean;
|
|
532
630
|
};
|
|
533
631
|
};
|
|
632
|
+
/**
|
|
633
|
+
* Main entry point - resolves and executes the command from process.argv.
|
|
634
|
+
* This is the production execution path with full lifecycle support.
|
|
635
|
+
*/
|
|
534
636
|
protected readonly onReady: alepha1.HookPrimitive<"ready">;
|
|
535
637
|
/**
|
|
536
|
-
|
|
537
|
-
|
|
638
|
+
* Execute a command with full lifecycle support.
|
|
639
|
+
*
|
|
640
|
+
* This is the production execution path that includes:
|
|
641
|
+
* - Mode-based .env file loading
|
|
642
|
+
* - Pre/post command hooks
|
|
643
|
+
* - Runner session for pretty CLI output
|
|
644
|
+
* - Alepha context wrapper for proper scoping
|
|
645
|
+
*
|
|
646
|
+
* @see run() for a lightweight test-only alternative
|
|
647
|
+
*/
|
|
538
648
|
protected executeCommand(command: CommandPrimitive<TObject>, argv: string[], isRootCommand: boolean): Promise<void>;
|
|
539
649
|
/**
|
|
540
|
-
|
|
541
|
-
|
|
650
|
+
* Remove consumed command path arguments from argv (keeps flags and remaining args).
|
|
651
|
+
*/
|
|
542
652
|
protected removeConsumedArgs(argv: string[], consumedArgs: string[]): string[];
|
|
543
653
|
/**
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
654
|
+
* Resolve a command from positional arguments.
|
|
655
|
+
*
|
|
656
|
+
* Supports:
|
|
657
|
+
* 1. Space-separated subcommands: `deploy vercel` -> finds deploy command, then vercel child
|
|
658
|
+
* 2. Colon notation (backwards compat): `deploy:vercel` -> finds command with name "deploy:vercel"
|
|
659
|
+
* 3. Simple commands: `build` -> finds command with name "build"
|
|
660
|
+
*/
|
|
551
661
|
protected resolveCommand(positionalArgs: string[]): {
|
|
552
662
|
command: CommandPrimitive<TObject> | undefined;
|
|
553
663
|
consumedArgs: string[];
|
|
554
664
|
};
|
|
665
|
+
/**
|
|
666
|
+
* Get all registered commands in the application.
|
|
667
|
+
*/
|
|
555
668
|
get commands(): CommandPrimitive<any>[];
|
|
556
|
-
protected findCommand(name: string): CommandPrimitive<TObject> | undefined;
|
|
557
669
|
/**
|
|
558
|
-
|
|
559
|
-
|
|
670
|
+
* Execute a command handler with given arguments.
|
|
671
|
+
*
|
|
672
|
+
* This is a **lightweight test helper** that directly invokes the command handler
|
|
673
|
+
* without the full production lifecycle. It intentionally skips:
|
|
674
|
+
* - Pre/post command hooks
|
|
675
|
+
* - Runner session (pretty CLI output)
|
|
676
|
+
* - Alepha context wrapper
|
|
677
|
+
* - .env.{mode} file loading
|
|
678
|
+
*
|
|
679
|
+
* For production execution, the `onReady` hook uses `executeCommand()` which
|
|
680
|
+
* provides the full lifecycle. Merging them would either make this method too
|
|
681
|
+
* heavy for simple testing or require many optional parameters to toggle behaviors.
|
|
682
|
+
*
|
|
683
|
+
* @example
|
|
684
|
+
* ```typescript
|
|
685
|
+
* // In tests
|
|
686
|
+
* const cli = alepha.inject(CliProvider);
|
|
687
|
+
* const cmd = alepha.inject(InitCommand);
|
|
688
|
+
*
|
|
689
|
+
* await cli.run(cmd.init, "--agent --pm=yarn");
|
|
690
|
+
* await cli.run(cmd.init, { argv: "--agent", root: "/project" });
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
run<T extends TObject, A extends TSchema>(command: CommandPrimitive<T, A>, options?: string | string[] | {
|
|
694
|
+
argv?: string | string[];
|
|
695
|
+
root?: string;
|
|
696
|
+
}): Promise<void>;
|
|
697
|
+
/** Find a command by name or alias */
|
|
698
|
+
protected findCommand(name: string): CommandPrimitive<TObject> | undefined;
|
|
699
|
+
/** Find all pre-hooks for a command (commands named `pre{commandName}`) */
|
|
560
700
|
protected findPreHooks(commandName: string): CommandPrimitive<TObject>[];
|
|
561
|
-
/**
|
|
562
|
-
* Find all post-hooks for a command.
|
|
563
|
-
*/
|
|
701
|
+
/** Find all post-hooks for a command (commands named `post{commandName}`) */
|
|
564
702
|
protected findPostHooks(commandName: string): CommandPrimitive<TObject>[];
|
|
565
|
-
/**
|
|
566
|
-
* Get global flags (help only, root command flags are NOT global).
|
|
567
|
-
*/
|
|
703
|
+
/** Get global flags (help only, root command flags are NOT global) */
|
|
568
704
|
protected getAllGlobalFlags(): Record<string, {
|
|
569
705
|
aliases: string[];
|
|
570
706
|
description?: string;
|
|
571
707
|
schema: TSchema;
|
|
572
708
|
}>;
|
|
573
|
-
|
|
709
|
+
/** Parse command flags from argv using the command's flag schema */
|
|
710
|
+
protected parseCommandFlags(argv: string[], schema: TObject, options?: {
|
|
711
|
+
modeEnabled?: boolean;
|
|
712
|
+
}): Record<string, any>;
|
|
713
|
+
/** Parse and validate environment variables using the command's env schema */
|
|
574
714
|
protected parseCommandEnv(schema: TObject, commandName: string): Record<string, any>;
|
|
575
|
-
/**
|
|
576
|
-
* Parse --mode or -m flag from argv.
|
|
577
|
-
*/
|
|
715
|
+
/** Parse --mode or -m flag from argv for environment file loading */
|
|
578
716
|
protected parseModeFlag(argv: string[]): string | undefined;
|
|
579
|
-
/**
|
|
580
|
-
* Load environment files based on mode.
|
|
581
|
-
*/
|
|
717
|
+
/** Load .env and .env.{mode} files into process.env */
|
|
582
718
|
protected loadModeEnv(root: string, mode: string | undefined): Promise<void>;
|
|
719
|
+
/** Low-level flag parser - extracts flag values from argv based on definitions */
|
|
583
720
|
protected parseFlags(argv: string[], flagDefs: {
|
|
584
721
|
key: string;
|
|
585
722
|
aliases: string[];
|
|
586
723
|
schema: TSchema;
|
|
587
|
-
}[]
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
724
|
+
}[], options?: {
|
|
725
|
+
strict?: boolean;
|
|
726
|
+
}): Record<string, any>;
|
|
727
|
+
/** Get indices of argv elements consumed by flags (for separating args from flags) */
|
|
591
728
|
protected getFlagConsumedIndices(argv: string[], flagDefs: {
|
|
592
729
|
key: string;
|
|
593
730
|
aliases: string[];
|
|
594
731
|
schema: TSchema;
|
|
595
732
|
}[]): Set<number>;
|
|
596
733
|
protected parseCommandArgs(argv: string[], schema?: TSchema, isRootCommand?: boolean, flagSchema?: TObject): any;
|
|
734
|
+
/** Convert a string argument value to the appropriate type based on schema */
|
|
597
735
|
protected parseArgumentValue(value: string, schema: TSchema): any;
|
|
736
|
+
/** Generate usage string for command arguments (e.g., "<path>" or "[path]") */
|
|
598
737
|
protected generateArgsUsage(schema?: TSchema): string;
|
|
738
|
+
/** Get display type name for a schema (e.g., ": number", ": boolean") */
|
|
599
739
|
protected getTypeName(schema: TSchema): string;
|
|
600
|
-
printHelp(command?: CommandPrimitive<any>): void;
|
|
601
740
|
/**
|
|
602
|
-
|
|
603
|
-
|
|
741
|
+
* Print help for a specific command or general CLI help.
|
|
742
|
+
*
|
|
743
|
+
* @param command - If provided, shows help for this specific command.
|
|
744
|
+
* If omitted, shows general CLI help with all commands.
|
|
745
|
+
*/
|
|
746
|
+
printHelp(command?: CommandPrimitive<any>): void;
|
|
747
|
+
/** Generate colored usage string for command arguments (for help display) */
|
|
604
748
|
protected generateColoredArgsUsage(schema?: TSchema): string;
|
|
605
|
-
/**
|
|
606
|
-
* Get the full command path (e.g., "deploy vercel" for a child command).
|
|
607
|
-
*/
|
|
749
|
+
/** Get the full command path (e.g., "deploy vercel" for a nested command) */
|
|
608
750
|
protected getCommandPath(command: CommandPrimitive<any>): string;
|
|
609
|
-
/**
|
|
610
|
-
* Find the parent command of a given command.
|
|
611
|
-
*/
|
|
751
|
+
/** Find the parent command of a nested command */
|
|
612
752
|
protected findParentCommand(command: CommandPrimitive<any>): CommandPrimitive<any> | undefined;
|
|
613
|
-
/**
|
|
614
|
-
* Get top-level commands (commands that are not children of other commands).
|
|
615
|
-
*/
|
|
753
|
+
/** Get top-level commands (commands that are not children of other commands) */
|
|
616
754
|
protected getTopLevelCommands(): CommandPrimitive<any>[];
|
|
617
|
-
/**
|
|
618
|
-
* Get max length for child command display.
|
|
619
|
-
*/
|
|
755
|
+
/** Calculate max display length for child commands (for help alignment) */
|
|
620
756
|
protected getMaxChildCmdLength(children: CommandPrimitive<any>[]): number;
|
|
757
|
+
/** Calculate max display length for commands (for help alignment) */
|
|
621
758
|
protected getMaxCmdLength(commands: CommandPrimitive[]): number;
|
|
622
|
-
|
|
759
|
+
/** Calculate max display length for flags (for help alignment) */
|
|
760
|
+
protected getMaxFlagLength(flags: {
|
|
761
|
+
aliases: string[];
|
|
762
|
+
}[]): number;
|
|
623
763
|
}
|
|
624
764
|
//#endregion
|
|
625
765
|
//#region ../../src/command/index.d.ts
|
|
626
766
|
/**
|
|
627
|
-
*
|
|
628
|
-
*
|
|
767
|
+
* | type | quality | stability |
|
|
768
|
+
* |------|---------|-----------|
|
|
769
|
+
* | tooling | rare | stable |
|
|
770
|
+
*
|
|
771
|
+
* Declarative CLI command framework.
|
|
629
772
|
*
|
|
630
|
-
*
|
|
773
|
+
* **Features:**
|
|
774
|
+
* - CLI command definitions
|
|
775
|
+
* - Interactive CLI prompts
|
|
776
|
+
* - Command execution
|
|
777
|
+
* - Formatted colored output
|
|
778
|
+
* - Environment variable utilities
|
|
779
|
+
* - Schema validation for CLI arguments
|
|
631
780
|
*
|
|
632
|
-
* @see {@link $command}
|
|
633
781
|
* @module alepha.command
|
|
634
782
|
*/
|
|
635
783
|
declare const AlephaCommand: alepha1.Service<alepha1.Module>;
|
|
636
784
|
declare module "typebox" {
|
|
637
785
|
interface StringOptions {
|
|
638
786
|
/**
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
787
|
+
* Additional aliases for the flags.
|
|
788
|
+
*
|
|
789
|
+
* @module alepha.command
|
|
790
|
+
*/
|
|
643
791
|
aliases?: string[];
|
|
644
792
|
}
|
|
645
793
|
} //# sourceMappingURL=index.d.ts.map
|