@lovrabet/lovrabet-cli 2.1.18-beta.1 → 2.1.18-beta.3
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/lib/cli.d.ts +21 -0
- package/lib/cli.js +1 -1
- package/lib/commands/api-doc/index.d.ts +38 -0
- package/lib/commands/api-doc/index.js +1 -1
- package/lib/commands/app/cache.d.ts +61 -0
- package/lib/commands/app/cache.js +1 -1
- package/lib/commands/app/definitions.d.ts +26 -0
- package/lib/commands/app/definitions.js +1 -1
- package/lib/commands/app/eligibility.d.ts +16 -0
- package/lib/commands/app/eligibility.js +1 -1
- package/lib/commands/app/mock-loader.d.ts +41 -0
- package/lib/commands/app/mock-loader.js +1 -1
- package/lib/commands/app/remote-source.d.ts +66 -0
- package/lib/commands/app/remote-source.js +1 -1
- package/lib/commands/app/shared.d.ts +38 -0
- package/lib/commands/app/shared.js +1 -1
- package/lib/commands/app-config/get.d.ts +2 -0
- package/lib/commands/app-config/get.js +1 -1
- package/lib/commands/app-config/index.d.ts +2 -0
- package/lib/commands/app-config/index.js +1 -1
- package/lib/commands/artifact/index.d.ts +9 -0
- package/lib/commands/artifact/index.js +1 -1
- package/lib/commands/auth/device.d.ts +31 -0
- package/lib/commands/auth/device.js +1 -1
- package/lib/commands/auth/index.d.ts +23 -0
- package/lib/commands/auth/index.js +1 -1
- package/lib/commands/auth/prompt.d.ts +33 -0
- package/lib/commands/auth/prompt.js +1 -1
- package/lib/commands/bff/detail.d.ts +8 -0
- package/lib/commands/bff/detail.js +1 -1
- package/lib/commands/bff/exec.d.ts +19 -0
- package/lib/commands/bff/exec.js +1 -1
- package/lib/commands/bff/index.d.ts +15 -0
- package/lib/commands/bff/index.js +1 -1
- package/lib/commands/cli-skill/index.d.ts +9 -0
- package/lib/commands/cli-skill/index.js +1 -1
- package/lib/commands/common/config-policy.d.ts +80 -0
- package/lib/commands/common/config-policy.js +1 -1
- package/lib/commands/common/constraints.d.ts +67 -0
- package/lib/commands/common/constraints.js +1 -1
- package/lib/commands/common/flags.d.ts +41 -0
- package/lib/commands/common/flags.js +1 -1
- package/lib/commands/common/local-file.d.ts +6 -0
- package/lib/commands/common/local-file.js +1 -1
- package/lib/commands/config/definitions.d.ts +21 -0
- package/lib/commands/config/definitions.js +1 -1
- package/lib/commands/config/shared.d.ts +17 -0
- package/lib/commands/config/shared.js +1 -1
- package/lib/commands/data/index.d.ts +27 -0
- package/lib/commands/data/index.js +1 -1
- package/lib/commands/dataset/detail.d.ts +26 -0
- package/lib/commands/dataset/detail.js +1 -1
- package/lib/commands/dataset/index.d.ts +10 -0
- package/lib/commands/dataset/index.js +1 -1
- package/lib/commands/dataset/list.d.ts +18 -0
- package/lib/commands/dataset/list.js +1 -1
- package/lib/commands/dataset/sdk-doc.d.ts +6 -0
- package/lib/commands/dataset/sdk-doc.js +1 -1
- package/lib/commands/doctor.d.ts +23 -0
- package/lib/commands/doctor.js +1 -1
- package/lib/commands/file/index.d.ts +2 -0
- package/lib/commands/file/index.js +1 -1
- package/lib/commands/init.d.ts +32 -0
- package/lib/commands/init.js +1 -1
- package/lib/commands/kb/index.d.ts +8 -0
- package/lib/commands/kb/index.js +1 -1
- package/lib/commands/logs/index.d.ts +20 -0
- package/lib/commands/logs/index.js +1 -1
- package/lib/commands/ocr/index.d.ts +2 -0
- package/lib/commands/ocr/index.js +1 -1
- package/lib/commands/personal-bff/index.d.ts +5 -0
- package/lib/commands/personal-bff/index.js +1 -1
- package/lib/commands/registry.d.ts +56 -0
- package/lib/commands/registry.js +1 -1
- package/lib/commands/schedule/index.d.ts +2 -0
- package/lib/commands/schedule/index.js +1 -1
- package/lib/commands/schema.d.ts +18 -0
- package/lib/commands/schema.js +1 -1
- package/lib/commands/service/dynamic.d.ts +18 -0
- package/lib/commands/service/dynamic.js +1 -1
- package/lib/commands/service/function-name-adapter.d.ts +13 -0
- package/lib/commands/service/function-name-adapter.js +1 -1
- package/lib/commands/service/index.d.ts +2 -0
- package/lib/commands/service/index.js +1 -1
- package/lib/commands/service/registry.d.ts +102 -0
- package/lib/commands/service/registry.js +1 -1
- package/lib/commands/skill/commands/create.d.ts +2 -0
- package/lib/commands/skill/commands/create.js +1 -1
- package/lib/commands/skill/commands/install.d.ts +2 -0
- package/lib/commands/skill/commands/install.js +1 -1
- package/lib/commands/skill/commands/list.d.ts +2 -0
- package/lib/commands/skill/commands/list.js +1 -1
- package/lib/commands/skill/commands/push.d.ts +2 -0
- package/lib/commands/skill/commands/push.js +1 -1
- package/lib/commands/skill/commands/validate.d.ts +2 -0
- package/lib/commands/skill/commands/validate.js +1 -1
- package/lib/commands/skill/flags.d.ts +13 -0
- package/lib/commands/skill/flags.js +1 -1
- package/lib/commands/skill/index.d.ts +9 -0
- package/lib/commands/skill/index.js +1 -1
- package/lib/commands/skill/manifest-helpers.d.ts +5 -0
- package/lib/commands/skill/manifest-helpers.js +1 -1
- package/lib/commands/skill/push-execute.d.ts +49 -0
- package/lib/commands/skill/push-execute.js +1 -1
- package/lib/commands/skill/push-flow-helpers.d.ts +80 -0
- package/lib/commands/skill/push-flow-helpers.js +1 -1
- package/lib/commands/skill/push-retarget.d.ts +9 -0
- package/lib/commands/skill/push-retarget.js +1 -1
- package/lib/commands/skill/scopes.d.ts +13 -0
- package/lib/commands/skill/scopes.js +1 -1
- package/lib/commands/skill/summary.d.ts +6 -0
- package/lib/commands/skill/summary.js +1 -1
- package/lib/commands/skill/templates.d.ts +23 -0
- package/lib/commands/skill/templates.js +1 -1
- package/lib/commands/skill/validate.d.ts +20 -0
- package/lib/commands/skill/validate.js +1 -1
- package/lib/commands/sql/detail.d.ts +13 -0
- package/lib/commands/sql/detail.js +1 -1
- package/lib/commands/sql/exec.d.ts +21 -0
- package/lib/commands/sql/exec.js +1 -1
- package/lib/commands/sql/index.d.ts +9 -0
- package/lib/commands/sql/index.js +1 -1
- package/lib/commands/update.d.ts +10 -0
- package/lib/commands/update.js +1 -1
- package/lib/commands/workspace/index.d.ts +10 -0
- package/lib/commands/workspace/index.js +1 -1
- package/lib/config/schema.d.ts +108 -0
- package/lib/config/schema.js +1 -1
- package/lib/constant/app.d.ts +13 -0
- package/lib/constant/app.js +1 -1
- package/lib/constant/auth-mode.d.ts +28 -0
- package/lib/constant/auth-mode.js +1 -1
- package/lib/constant/cli.d.ts +86 -0
- package/lib/constant/cli.js +1 -1
- package/lib/constant/defaults.d.ts +45 -0
- package/lib/constant/defaults.js +1 -1
- package/lib/constant/distribution.d.ts +12 -0
- package/lib/constant/distribution.js +1 -1
- package/lib/constant/domain.d.ts +57 -0
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.d.ts +56 -0
- package/lib/constant/env.js +1 -1
- package/lib/constant/output.d.ts +13 -0
- package/lib/constant/output.js +1 -1
- package/lib/constant/product.d.ts +79 -0
- package/lib/constant/product.js +1 -1
- package/lib/constant/risk.d.ts +14 -0
- package/lib/constant/risk.js +1 -1
- package/lib/constant/url.d.ts +14 -0
- package/lib/constant/url.js +1 -1
- package/lib/context.d.ts +287 -0
- package/lib/context.js +1 -1
- package/lib/core/api-client.d.ts +451 -0
- package/lib/core/api-client.js +1 -1
- package/lib/core/db-resolver.d.ts +39 -0
- package/lib/core/db-resolver.js +1 -1
- package/lib/core/sdk-client.d.ts +62 -0
- package/lib/core/sdk-client.js +1 -1
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +1 -1
- package/lib/framework/build-all-flags.d.ts +24 -0
- package/lib/framework/build-all-flags.js +1 -1
- package/lib/framework/dryrun.d.ts +64 -0
- package/lib/framework/dryrun.js +1 -1
- package/lib/framework/flags.d.ts +19 -0
- package/lib/framework/flags.js +1 -1
- package/lib/framework/help.d.ts +21 -0
- package/lib/framework/help.js +1 -1
- package/lib/framework/index.d.ts +10 -0
- package/lib/framework/index.js +1 -1
- package/lib/framework/output.d.ts +10 -0
- package/lib/framework/output.js +1 -1
- package/lib/framework/preparse.d.ts +64 -0
- package/lib/framework/preparse.js +1 -1
- package/lib/framework/rate-limit.d.ts +10 -0
- package/lib/framework/rate-limit.js +1 -1
- package/lib/framework/response.d.ts +10 -0
- package/lib/framework/response.js +1 -1
- package/lib/framework/runner-confirmation.d.ts +46 -0
- package/lib/framework/runner-confirmation.js +1 -1
- package/lib/framework/runner-error.d.ts +28 -0
- package/lib/framework/runner-error.js +1 -1
- package/lib/framework/runner.d.ts +102 -0
- package/lib/framework/runner.js +1 -1
- package/lib/framework/schema-export.d.ts +29 -0
- package/lib/framework/schema-export.js +1 -1
- package/lib/framework/service-order.d.ts +4 -0
- package/lib/framework/service-order.js +1 -1
- package/lib/framework/types.d.ts +108 -0
- package/lib/framework/types.js +1 -1
- package/lib/generated/build-info.d.ts +4 -0
- package/lib/generated/build-info.js +1 -1
- package/lib/help.d.ts +25 -0
- package/lib/help.js +1 -1
- package/lib/runtime/event.d.ts +16 -0
- package/lib/runtime/event.js +1 -0
- package/lib/runtime/index.d.ts +13 -0
- package/lib/runtime/index.js +1 -0
- package/lib/runtime/queue.d.ts +6 -0
- package/lib/runtime/queue.js +1 -0
- package/lib/runtime/resolve.d.ts +14 -0
- package/lib/runtime/resolve.js +1 -0
- package/lib/runtime/types.d.ts +59 -0
- package/lib/runtime/types.js +1 -0
- package/lib/skills/npx-skills-add.d.ts +42 -0
- package/lib/skills/npx-skills-add.js +1 -1
- package/lib/skills/runtime-skill-sync/constants.d.ts +4 -0
- package/lib/skills/runtime-skill-sync/constants.js +1 -1
- package/lib/skills/runtime-skill-sync/fs-utils.d.ts +21 -0
- package/lib/skills/runtime-skill-sync/fs-utils.js +1 -1
- package/lib/skills/runtime-skill-sync/hashing.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/hashing.js +1 -1
- package/lib/skills/runtime-skill-sync/links.d.ts +18 -0
- package/lib/skills/runtime-skill-sync/links.js +1 -1
- package/lib/skills/runtime-skill-sync/list-local.d.ts +3 -0
- package/lib/skills/runtime-skill-sync/list-local.js +1 -1
- package/lib/skills/runtime-skill-sync/local-files.d.ts +25 -0
- package/lib/skills/runtime-skill-sync/local-files.js +1 -1
- package/lib/skills/runtime-skill-sync/materialize.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/materialize.js +1 -1
- package/lib/skills/runtime-skill-sync/metadata.d.ts +7 -0
- package/lib/skills/runtime-skill-sync/metadata.js +1 -1
- package/lib/skills/runtime-skill-sync/paths.d.ts +11 -0
- package/lib/skills/runtime-skill-sync/paths.js +1 -1
- package/lib/skills/runtime-skill-sync/push.d.ts +33 -0
- package/lib/skills/runtime-skill-sync/push.js +1 -1
- package/lib/skills/runtime-skill-sync/scopes.d.ts +5 -0
- package/lib/skills/runtime-skill-sync/scopes.js +1 -1
- package/lib/skills/runtime-skill-sync/types.d.ts +105 -0
- package/lib/skills/runtime-skill-sync/zip-codec.d.ts +9 -0
- package/lib/skills/runtime-skill-sync/zip-codec.js +1 -1
- package/lib/skills/runtime-skill-sync/zip-package.d.ts +15 -0
- package/lib/skills/runtime-skill-sync/zip-package.js +1 -1
- package/lib/skills/runtime-skill-sync.d.ts +15 -0
- package/lib/skills/runtime-skill-sync.js +1 -1
- package/lib/utils/apply-jq-filter.d.ts +25 -0
- package/lib/utils/apply-jq-filter.js +1 -1
- package/lib/utils/logger.d.ts +73 -0
- package/lib/utils/logger.js +1 -1
- package/lib/utils/lossless-json.d.ts +14 -0
- package/lib/utils/lossless-json.js +1 -1
- package/lib/utils/params.d.ts +65 -0
- package/lib/utils/params.js +1 -1
- package/lib/utils/platform.d.ts +17 -0
- package/lib/utils/platform.js +1 -1
- package/lib/utils/update-notice.d.ts +10 -0
- package/lib/utils/update-notice.js +1 -1
- package/lib/utils/version.d.ts +18 -0
- package/lib/utils/version.js +1 -1
- package/lib/utils/write-cli-side-channel.d.ts +6 -0
- package/lib/utils/write-cli-side-channel.js +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `app` subcommand shared utilities — re-exports and helpers.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists: several `app/` commands need the same helpers
|
|
5
|
+
* (`readConfig`, `writeConfig`, `scopeLabel`, `enrichAppListItemsWithMergedSelection`).
|
|
6
|
+
* Rather than each command importing from `context.ts` directly (which creates
|
|
7
|
+
* coupling to the global env module), this module provides a stable re-export surface.
|
|
8
|
+
*
|
|
9
|
+
* Design decision: `enrichAppListItemsWithMergedSelection` is placed here rather
|
|
10
|
+
* than in `cache.ts` because it operates on the merged CLI snapshot from the
|
|
11
|
+
* pipeline, not on the raw cache. This keeps cache.ts focused on cache I/O only.
|
|
12
|
+
*/
|
|
13
|
+
import { CLI_BIN_NAME } from "../../constant/cli.js";
|
|
14
|
+
import type { MergedCliSnapshot } from "../../framework/types.js";
|
|
15
|
+
export { CLI_BIN_NAME };
|
|
16
|
+
/**
|
|
17
|
+
* Marks which app in the list is "current" based on the merged CLI snapshot.
|
|
18
|
+
*
|
|
19
|
+
* Why this is a mutation: the list items are objects passed by reference from
|
|
20
|
+
* the caller (`app list`). Mutating them in-place is simpler and faster than
|
|
21
|
+
* reconstructing a new array. The caller has no use for the unmarked list anyway.
|
|
22
|
+
*
|
|
23
|
+
* Current is determined by:
|
|
24
|
+
* - If a named app is selected (`currentApp` or `defaultApp`), the matching named item wins
|
|
25
|
+
* - If only `appCode` is set (no named selection), the item with the matching code wins
|
|
26
|
+
*
|
|
27
|
+
* @param items - List items from the remote API response
|
|
28
|
+
* @param merged - Merged CLI snapshot from the pipeline context
|
|
29
|
+
*/
|
|
30
|
+
export declare function enrichAppListItemsWithMergedSelection(items: Record<string, unknown>[], merged: MergedCliSnapshot | undefined): void;
|
|
31
|
+
export { readScopedConfig as readConfig, writeScopedConfig as writeConfig, isInProject } from "../../context.js";
|
|
32
|
+
/**
|
|
33
|
+
* Formats a human-readable scope label for console output.
|
|
34
|
+
*
|
|
35
|
+
* @param flags - Must contain a `global` boolean key
|
|
36
|
+
* @returns Human label like " [global]" or "" (empty for project)
|
|
37
|
+
*/
|
|
38
|
+
export declare function scopeLabel(flags: Record<string, any>): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3bbb70,_0x4e2edd){const _0x177102=a7_0x3231,_0x3790e3=_0x3bbb70();while(!![]){try{const _0x205354=parseInt(_0x177102(0xaa))/0x1*(parseInt(_0x177102(0xa5))/0x2)+-parseInt(_0x177102(0xaf))/0x3+-parseInt(_0x177102(0xb7))/0x4+parseInt(_0x177102(0xae))/0x5*(-parseInt(_0x177102(0xb1))/0x6)+parseInt(_0x177102(0xb9))/0x7*(parseInt(_0x177102(0xad))/0x8)+-parseInt(_0x177102(0xb8))/0x9+parseInt(_0x177102(0xb4))/0xa*(parseInt(_0x177102(0xb3))/0xb);if(_0x205354===_0x4e2edd)break;else _0x3790e3['push'](_0x3790e3['shift']());}catch(_0xda281d){_0x3790e3['push'](_0x3790e3['shift']());}}}(a7_0x3384,0x7576e));import{CLI_BIN_NAME}from'../../constant/cli.js';import{formatScopeLabel}from'../../commands/common/config-policy.js';export{CLI_BIN_NAME};export function enrichAppListItemsWithMergedSelection(_0x27e77a,_0x377454){const _0x5b114b=a7_0x3231;if(!_0x377454)return;const _0x2eba05=!!(_0x377454[_0x5b114b(0xb2)]??_0x377454['defaultApp']);for(const _0x310a4b of _0x27e77a){_0x310a4b[_0x5b114b(0xa3)]=![];}const _0x21bdc3=_0x377454[_0x5b114b(0xa4)]!=null?String(_0x377454[_0x5b114b(0xa4)])[_0x5b114b(0xb5)]():'';if(_0x2eba05){const _0x1d2ff4=_0x377454[_0x5b114b(0xb2)]??_0x377454[_0x5b114b(0xab)];if(_0x1d2ff4){const _0x13f2dc=_0x27e77a[_0x5b114b(0xa6)](_0x44bf67=>_0x44bf67[_0x5b114b(0xa7)]===!![]&&_0x44bf67[_0x5b114b(0xb6)]===_0x1d2ff4&&_0x44bf67[_0x5b114b(0xba)]===_0x5b114b(0xac)),_0x17fe0d=_0x13f2dc??_0x27e77a[_0x5b114b(0xa6)](_0x4525d8=>_0x4525d8[_0x5b114b(0xa7)]===!![]&&_0x4525d8[_0x5b114b(0xb6)]===_0x1d2ff4);if(_0x17fe0d){const _0x5c1435=String(_0x17fe0d['appcode']??'')[_0x5b114b(0xb5)]();if(!_0x21bdc3||_0x5c1435===_0x21bdc3){_0x17fe0d[_0x5b114b(0xa3)]=!![];return;}}}if(_0x21bdc3){const _0x25f15a=_0x27e77a[_0x5b114b(0xa6)](_0xf667da=>String(_0xf667da[_0x5b114b(0xa9)]??'')[_0x5b114b(0xb5)]()===_0x21bdc3);_0x25f15a&&(_0x25f15a[_0x5b114b(0xa3)]=!![]);}return;}if(!_0x21bdc3)return;for(const _0xdcef8d of _0x27e77a){String(_0xdcef8d[_0x5b114b(0xa9)]??'')[_0x5b114b(0xb5)]()===_0x21bdc3&&(_0xdcef8d[_0x5b114b(0xa3)]=!![]);}}export{readScopedConfig as readConfig,writeScopedConfig as writeConfig,isInProject}from'../../context.js';function a7_0x3384(){const _0x583558=['global','178428mqWhIF','currentApp','10769pspZfe','19620lkIjlO','trim','name','3552396QMXnfx','7958079qErbRq','1400231TpgZrR','definedIn','isCurrent','appCode','1200894XslWBU','find','named','project','appcode','1XApcZS','defaultApp','local','16mPNrUh','80nVmjmU','576117IusgRh'];a7_0x3384=function(){return _0x583558;};return a7_0x3384();}function a7_0x3231(_0x32cc01,_0x4a08f6){_0x32cc01=_0x32cc01-0xa3;const _0x338440=a7_0x3384();let _0x3231fe=_0x338440[_0x32cc01];return _0x3231fe;}export function scopeLabel(_0x560c10){const _0x3fd9d7=a7_0x3231;return formatScopeLabel(_0x560c10['global']?_0x3fd9d7(0xb0):_0x3fd9d7(0xa8));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a8_0x5d4f(){const _0x32927a=['key','10eoGphf','40789JxbAPZ','6982HLZSZc','args','Unable\x20to\x20get\x20app-config\x20value:\x20key=','validation','443021NvDRnd','2326012BoJhIH','1239smAypU','apiError','read','6174235gCpIxH',',\x20appCode=','Get\x20one\x20runtime\x20app-config\x20value\x20by\x20key','1026OKpNFP','app-config','27432GTfRzS','appCode','5186929GAvvPM','804KnfCAG','App\x20config\x20key'];a8_0x5d4f=function(){return _0x32927a;};return a8_0x5d4f();}function a8_0x4dbc(_0x575f38,_0x284fa6){_0x575f38=_0x575f38-0x1f0;const _0x5d4fe2=a8_0x5d4f();let _0x4dbce0=_0x5d4fe2[_0x575f38];return _0x4dbce0;}const a8_0x2c3863=a8_0x4dbc;(function(_0x1aa6d3,_0x9303d5){const _0x5c468e=a8_0x4dbc,_0x5b6a76=_0x1aa6d3();while(!![]){try{const _0x1e8c0f=-parseInt(_0x5c468e(0x1f5))/0x1+parseInt(_0x5c468e(0x1f1))/0x2*(parseInt(_0x5c468e(0x1f7))/0x3)+-parseInt(_0x5c468e(0x1f6))/0x4+-parseInt(_0x5c468e(0x1fa))/0x5+-parseInt(_0x5c468e(0x202))/0x6*(-parseInt(_0x5c468e(0x1f0))/0x7)+parseInt(_0x5c468e(0x1ff))/0x8*(parseInt(_0x5c468e(0x1fd))/0x9)+parseInt(_0x5c468e(0x205))/0xa*(parseInt(_0x5c468e(0x201))/0xb);if(_0x1e8c0f===_0x9303d5)break;else _0x5b6a76['push'](_0x5b6a76['shift']());}catch(_0x2c420d){_0x5b6a76['push'](_0x5b6a76['shift']());}}}(a8_0x5d4f,0xc994b));import{getRuntimeAppConfigByKey}from'../../core/api-client.js';import{CliErrors}from'../../errors.js';import{CLI_BIN_NAME}from'../../constant/cli.js';export const appConfigGet={'service':a8_0x2c3863(0x1fe),'command':'get','description':a8_0x2c3863(0x1fc),'risk':a8_0x2c3863(0x1f9),'args':[{'name':a8_0x2c3863(0x204),'description':a8_0x2c3863(0x203),'required':!![]}],'flags':[],async 'execute'(_0x5d86dc){const _0x592389=a8_0x2c3863,_0x522f66=_0x5d86dc[_0x592389(0x1f2)][0x0]?.['trim']();if(!_0x522f66)throw CliErrors[_0x592389(0x1f4)]('Missing\x20app-config\x20key.','Usage:\x20'+CLI_BIN_NAME+'\x20app-config\x20get\x20<key>');try{const _0x91f07c=await getRuntimeAppConfigByKey(_0x5d86dc['appCode'],_0x522f66);return{'ok':!![],'data':_0x91f07c};}catch{throw CliErrors[_0x592389(0x1f8)](_0x592389(0x1f3)+_0x522f66+_0x592389(0x1fb)+_0x5d86dc[_0x592389(0x200)],'Check\x20that\x20the\x20key\x20exists,\x20the\x20current\x20AccessKey\x20has\x20permission,\x20and\x20the\x20runtime\x20app-config\x20endpoint\x20is\x20available.');}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x226fd6,_0x18ac0f){const _0x222981=a9_0x2242,_0x3223c2=_0x226fd6();while(!![]){try{const _0x29c921=-parseInt(_0x222981(0x152))/0x1*(-parseInt(_0x222981(0x154))/0x2)+parseInt(_0x222981(0x14c))/0x3*(-parseInt(_0x222981(0x14b))/0x4)+-parseInt(_0x222981(0x150))/0x5+-parseInt(_0x222981(0x14f))/0x6*(parseInt(_0x222981(0x14e))/0x7)+-parseInt(_0x222981(0x151))/0x8+parseInt(_0x222981(0x153))/0x9*(-parseInt(_0x222981(0x14d))/0xa)+parseInt(_0x222981(0x14a))/0xb;if(_0x29c921===_0x18ac0f)break;else _0x3223c2['push'](_0x3223c2['shift']());}catch(_0x185ff3){_0x3223c2['push'](_0x3223c2['shift']());}}}(a9_0x9eb2,0x53a6c));import{appConfigGet}from'../../commands/app-config/get.js';function a9_0x2242(_0x2e091c,_0x152337){_0x2e091c=_0x2e091c-0x14a;const _0x9eb27b=a9_0x9eb2();let _0x2242c0=_0x9eb27b[_0x2e091c];return _0x2242c0;}function a9_0x9eb2(){const _0x2fd2b8=['17469815cbfffv','88WPYfPy','40965YeNkOH','10taonGB','637wkafpa','4938iIuSvj','2472215VjPBqP','3562752LpbYIc','8152zjNmjf','1648359yBVPec','62daCBEr'];a9_0x9eb2=function(){return _0x2fd2b8;};return a9_0x9eb2();}export const appConfigDefinitions=[appConfigGet];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 本文件定义当前应用下 react_module Artifact 的查询、创建和更新命令。
|
|
3
|
+
* 写入命令从本地文件读取源码,使生成内容可在 sandbox 中审阅,并避免通过命令参数泄露长文本。
|
|
4
|
+
*/
|
|
5
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
6
|
+
export declare const ALLOWED_REACT_MODULE_IMPORTS_TEXT: string;
|
|
7
|
+
/** 校验源码是非空、可嵌入且只使用允许依赖的 React 模块。 */
|
|
8
|
+
export declare function validateReactModuleSource(content: string): void;
|
|
9
|
+
export declare const artifactDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a10_0x5ed6d5=a10_0x25f0;(function(_0x2a1ec8,_0x5f47ff){const _0x946e91=a10_0x25f0,_0x5414d0=_0x2a1ec8();while(!![]){try{const _0x1b8d04=parseInt(_0x946e91(0x1fa))/0x1+-parseInt(_0x946e91(0x235))/0x2+-parseInt(_0x946e91(0x22e))/0x3+-parseInt(_0x946e91(0x223))/0x4*(parseInt(_0x946e91(0x21c))/0x5)+parseInt(_0x946e91(0x234))/0x6+-parseInt(_0x946e91(0x208))/0x7+parseInt(_0x946e91(0x219))/0x8;if(_0x1b8d04===_0x5f47ff)break;else _0x5414d0['push'](_0x5414d0['shift']());}catch(_0x388a9c){_0x5414d0['push'](_0x5414d0['shift']());}}}(a10_0x41c5,0x844ee));import{existsSync,readFileSync,statSync}from'node:fs';import{createRuntimeArtifact,getRuntimeArtifact,listRuntimeArtifacts,updateRuntimeArtifact}from'../../core/api-client.js';import{ID_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';import{dryRun}from'../../framework/dryrun.js';const ARTIFACT_TYPE_REACT_MODULE='react_module',ARTIFACT_SOURCE_AGENT=a10_0x5ed6d5(0x20f),ALLOWED_REACT_MODULE_IMPORTS=['react',a10_0x5ed6d5(0x201),a10_0x5ed6d5(0x221),'dayjs',a10_0x5ed6d5(0x227),a10_0x5ed6d5(0x218)];export const ALLOWED_REACT_MODULE_IMPORTS_TEXT=ALLOWED_REACT_MODULE_IMPORTS[a10_0x5ed6d5(0x22f)](',\x20');const IMPORT_SOURCE_PATTERNS=[/\bimport\s+(?:type\s+)?(?:[^'";]*?\s+from\s+)?["']([^"']+)["']/g,/\bexport\s+(?:type\s+)?[^'";]*?\s+from\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g],PAGE_LEVEL_PATTERNS=[/<!doctype\s+html/i,/<\s*html\b/i,/\bcreateRoot\s*\(/,/\bReactDOM\s*\.\s*render\s*\(/,/\bReactDOM\s*\.\s*createRoot\s*\(/],FILE_FLAG={'name':a10_0x5ed6d5(0x200),'type':a10_0x5ed6d5(0x217),'required':!![],'description':'Path\x20to\x20a\x20local\x20UTF-8\x20React\x20module\x20source\x20file'},ARTIFACT_NAME_FLAG={'name':a10_0x5ed6d5(0x1f5),'type':a10_0x5ed6d5(0x217),'description':'Artifact\x20display\x20name'},METADATA_FLAG={'name':a10_0x5ed6d5(0x229),'type':a10_0x5ed6d5(0x217),'description':a10_0x5ed6d5(0x205)};function isPlainObject(_0x4d8efc){const _0x2ab1d5=a10_0x5ed6d5;return typeof _0x4d8efc===_0x2ab1d5(0x207)&&_0x4d8efc!==null&&!Array[_0x2ab1d5(0x222)](_0x4d8efc);}function a10_0x41c5(){const _0x3ca246=['2796717bsrNBd','description','list','create','List\x20current-app\x20react_module\x20Artifacts','read','source','AGENT','update','map','exec','validation','flag','Optional\x20source\x20filter,\x20for\x20example\x20AGENT','Artifact\x20ID','string','@ant-design/icons','17743136grHPEv','.\x20Unsupported:\x20','parse','60WdjHOp','split','length','content','build','lodash','isArray','274132HKgQPc','/client/artifact/create','Show\x20one\x20Artifact\x20by\x20id','deleted','antd','createTime','metadata','isFile','body','startsWith','Update\x20a\x20react_module\x20Artifact\x20from\x20a\x20local\x20source\x20file','2663364yEfRJT','join','react_module\x20imports\x20are\x20limited\x20to:\x20','Created\x20Artifact\x20','appCode','includes','268014jWBLwB','271772AwnRLL','bool','filter','write','artifact','updateTime','num','detail','name','Create\x20a\x20react_module\x20Artifact\x20from\x20a\x20local\x20source\x20file','str','/update','Updated\x20Artifact\x20','524974iKyNlt','POST','test','utf8','artifactType','verbose','file','react-dom','trim','File\x20path\x20is\x20required.','boolean','Artifact\x20metadata\x20as\x20JSON\x20object;\x20compiledContent\x20is\x20stripped','favorite','object'];a10_0x41c5=function(){return _0x3ca246;};return a10_0x41c5();}function readSourceFile(_0x5e78e1){const _0x2bc8e5=a10_0x5ed6d5;if(!_0x5e78e1)throw CliErrors[_0x2bc8e5(0x213)](_0x2bc8e5(0x203));if(!existsSync(_0x5e78e1))throw CliErrors['validation']('File\x20not\x20found:\x20'+_0x5e78e1);if(!statSync(_0x5e78e1)[_0x2bc8e5(0x22a)]())throw CliErrors[_0x2bc8e5(0x213)]('File\x20is\x20not\x20a\x20regular\x20file:\x20'+_0x5e78e1);const _0x13dacc=readFileSync(_0x5e78e1,_0x2bc8e5(0x1fd));return validateReactModuleSource(_0x13dacc),_0x13dacc;}function a10_0x25f0(_0x5ed8e5,_0x3788d1){_0x5ed8e5=_0x5ed8e5-0x1f0;const _0x41c57f=a10_0x41c5();let _0x25f056=_0x41c57f[_0x5ed8e5];return _0x25f056;}function parseMetadata(_0x29d136){const _0x508bfa=a10_0x5ed6d5;if(!_0x29d136)return undefined;let _0x1c238b;try{_0x1c238b=JSON[_0x508bfa(0x21b)](_0x29d136);}catch{throw CliErrors[_0x508bfa(0x213)]('Invalid\x20JSON\x20for\x20--metadata:\x20'+_0x29d136);}if(!isPlainObject(_0x1c238b))throw CliErrors[_0x508bfa(0x213)]('--metadata\x20must\x20be\x20a\x20JSON\x20object.');const _0xf44ac0={..._0x1c238b};return delete _0xf44ac0['compiledContent'],_0xf44ac0;}function getPackageName(_0x36644a){const _0x4fe451=a10_0x5ed6d5;if(_0x36644a[_0x4fe451(0x22c)]('@')){const [_0x290fc5,_0x1ab531]=_0x36644a[_0x4fe451(0x21d)]('/');return _0x290fc5&&_0x1ab531?_0x290fc5+'/'+_0x1ab531:_0x36644a;}return _0x36644a[_0x4fe451(0x21d)]('/')[0x0]||_0x36644a;}function validateAllowedImports(_0x71e079){const _0x26860f=a10_0x5ed6d5,_0x5037a5=new Set();for(const _0x16cd6a of IMPORT_SOURCE_PATTERNS){_0x16cd6a['lastIndex']=0x0;let _0x136c4c;while((_0x136c4c=_0x16cd6a[_0x26860f(0x212)](_0x71e079))!==null){const _0x1f8c17=_0x136c4c[0x1]?.[_0x26860f(0x202)]();_0x1f8c17&&_0x5037a5['add'](_0x1f8c17);}}const _0x58bd92=[..._0x5037a5][_0x26860f(0x211)](getPackageName)[_0x26860f(0x237)](_0x33ed61=>!ALLOWED_REACT_MODULE_IMPORTS[_0x26860f(0x233)](_0x33ed61));if(_0x58bd92[_0x26860f(0x21e)]>0x0)throw CliErrors['validation'](_0x26860f(0x230)+ALLOWED_REACT_MODULE_IMPORTS_TEXT+_0x26860f(0x21a)+[...new Set(_0x58bd92)][_0x26860f(0x22f)](',\x20'));}export function validateReactModuleSource(_0x4590ae){const _0x1aa2d6=a10_0x5ed6d5;if(!_0x4590ae[_0x1aa2d6(0x202)]())throw CliErrors['validation']('Artifact\x20source\x20file\x20is\x20blank.');if(PAGE_LEVEL_PATTERNS['some'](_0x35c6a1=>_0x35c6a1[_0x1aa2d6(0x1fc)](_0x4590ae)))throw CliErrors[_0x1aa2d6(0x213)]('react_module\x20must\x20be\x20an\x20embeddable\x20React\x20module,\x20not\x20full\x20HTML\x20or\x20a\x20ReactDOM/createRoot\x20mount\x20entry.');validateAllowedImports(_0x4590ae);}function buildArtifactInput(_0x7bc14a){const _0x23b2c4=a10_0x5ed6d5,_0x321c44=readSourceFile(_0x7bc14a['str'](_0x23b2c4(0x200))),_0x14ee8a=_0x7bc14a[_0x23b2c4(0x1f7)](_0x23b2c4(0x1f5))[_0x23b2c4(0x202)](),_0x2f550d=parseMetadata(_0x7bc14a[_0x23b2c4(0x1f7)]('metadata'));return{'artifactType':ARTIFACT_TYPE_REACT_MODULE,..._0x14ee8a?{'name':_0x14ee8a}:{},'content':_0x321c44,..._0x2f550d?{'metadata':_0x2f550d}:{},'source':ARTIFACT_SOURCE_AGENT};}function summarizeArtifact(_0x92137f){const _0xcc890a=a10_0x5ed6d5;return{'id':_0x92137f['id'],'name':_0x92137f[_0xcc890a(0x1f5)],'artifactType':_0x92137f['artifactType'],'source':_0x92137f['source'],'favorite':_0x92137f[_0xcc890a(0x206)],'deleted':_0x92137f[_0xcc890a(0x226)],'createTime':_0x92137f['createTime'],'updateTime':_0x92137f[_0xcc890a(0x1f2)]};}function detailArtifact(_0x477260){const _0x3b72a9=a10_0x5ed6d5;return{'id':_0x477260['id'],'appCode':_0x477260['appCode'],'name':_0x477260[_0x3b72a9(0x1f5)],'artifactType':_0x477260[_0x3b72a9(0x1fe)],'source':_0x477260[_0x3b72a9(0x20e)],'favorite':_0x477260['favorite'],'deleted':_0x477260[_0x3b72a9(0x226)],'content':_0x477260[_0x3b72a9(0x21f)]??'','compiledContent':_0x477260['compiledContent'],'metadata':_0x477260['metadata']??{},'createTime':_0x477260[_0x3b72a9(0x228)],'updateTime':_0x477260['updateTime']};}function readFavoriteFlag(_0x4cf535){const _0x3eb54a=a10_0x5ed6d5,_0x3acf6d=_0x4cf535[_0x3eb54a(0x214)](_0x3eb54a(0x206));return _0x3acf6d===undefined||_0x3acf6d===null||_0x3acf6d===''?undefined:_0x4cf535[_0x3eb54a(0x236)](_0x3eb54a(0x206));}const artifactList={'service':a10_0x5ed6d5(0x1f1),'command':a10_0x5ed6d5(0x20a),'description':a10_0x5ed6d5(0x20c),'risk':a10_0x5ed6d5(0x20d),'flags':[{'name':a10_0x5ed6d5(0x20e),'type':a10_0x5ed6d5(0x217),'description':a10_0x5ed6d5(0x215)},{'name':a10_0x5ed6d5(0x206),'type':a10_0x5ed6d5(0x204),'description':'Optional\x20favorite-state\x20filter'},VERBOSE_FLAG],async 'execute'(_0x3f2d2f){const _0xb7fd44=a10_0x5ed6d5,_0x1abf1c=await listRuntimeArtifacts(_0x3f2d2f[_0xb7fd44(0x232)],{'artifactType':ARTIFACT_TYPE_REACT_MODULE,..._0x3f2d2f[_0xb7fd44(0x1f7)]('source')?{'source':_0x3f2d2f['str'](_0xb7fd44(0x20e))}:{},...readFavoriteFlag(_0x3f2d2f)!==undefined?{'favorite':readFavoriteFlag(_0x3f2d2f)}:{}});return{'ok':!![],'data':{'total':_0x1abf1c[_0xb7fd44(0x21e)],'items':_0x3f2d2f['bool'](_0xb7fd44(0x1ff))?_0x1abf1c:_0x1abf1c[_0xb7fd44(0x211)](summarizeArtifact)}};}},artifactDetail={'service':'artifact','command':a10_0x5ed6d5(0x1f4),'description':a10_0x5ed6d5(0x225),'risk':a10_0x5ed6d5(0x20d),'flags':[{...ID_FLAG,'description':a10_0x5ed6d5(0x216)}],async 'execute'(_0x5368a9){const _0x186bbf=a10_0x5ed6d5,_0x23a3d2=await getRuntimeArtifact(_0x5368a9['num']('id'),_0x5368a9[_0x186bbf(0x232)]);return{'ok':!![],'data':detailArtifact(_0x23a3d2)};}},artifactCreate={'service':a10_0x5ed6d5(0x1f1),'command':a10_0x5ed6d5(0x20b),'description':a10_0x5ed6d5(0x1f6),'risk':a10_0x5ed6d5(0x1f0),'flags':[FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x54db5f){const _0x13583f=a10_0x5ed6d5,_0x1f630c=buildArtifactInput(_0x54db5f),_0x515578=await createRuntimeArtifact(_0x54db5f[_0x13583f(0x232)],_0x1f630c);return{'ok':!![],'data':detailArtifact(_0x515578),'message':_0x13583f(0x231)+_0x515578['id']+(_0x515578[_0x13583f(0x1f5)]?'\x20('+_0x515578[_0x13583f(0x1f5)]+')':'')};},async 'dryRun'(_0x45f27f){const _0x3ec245=a10_0x5ed6d5,_0x53cd42=buildArtifactInput(_0x45f27f);return dryRun(_0x3ec245(0x1fb),_0x3ec245(0x224))[_0x3ec245(0x22b)]({'appCode':_0x45f27f[_0x3ec245(0x232)],..._0x53cd42})[_0x3ec245(0x209)]('Preview:\x20create\x20react_module\x20Artifact')[_0x3ec245(0x220)]();}},artifactUpdate={'service':a10_0x5ed6d5(0x1f1),'command':a10_0x5ed6d5(0x210),'description':a10_0x5ed6d5(0x22d),'risk':a10_0x5ed6d5(0x1f0),'flags':[{...ID_FLAG,'description':a10_0x5ed6d5(0x216)},FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x4a1027){const _0x53d22f=a10_0x5ed6d5,_0x2703b7=_0x4a1027['num']('id'),_0x1f6d13=buildArtifactInput(_0x4a1027),_0x434464=await updateRuntimeArtifact(_0x2703b7,_0x4a1027[_0x53d22f(0x232)],_0x1f6d13);return{'ok':!![],'data':detailArtifact(_0x434464),'message':_0x53d22f(0x1f9)+_0x434464['id']+(_0x434464[_0x53d22f(0x1f5)]?'\x20('+_0x434464[_0x53d22f(0x1f5)]+')':'')};},async 'dryRun'(_0x4aed12){const _0x2470b0=a10_0x5ed6d5,_0xb8e90b=_0x4aed12[_0x2470b0(0x1f3)]('id'),_0x7b5394=buildArtifactInput(_0x4aed12);return dryRun(_0x2470b0(0x1fb),'/client/artifact/'+_0xb8e90b+_0x2470b0(0x1f8))['body']({'appCode':_0x4aed12[_0x2470b0(0x232)],..._0x7b5394})['description']('Preview:\x20update\x20react_module\x20Artifact\x20'+_0xb8e90b)[_0x2470b0(0x220)]();}};export const artifactDefinitions=[artifactList,artifactDetail,artifactCreate,artifactUpdate];
|
|
1
|
+
const a10_0x513db9=a10_0x1681;(function(_0x37fa8d,_0x5e8997){const _0x1f1d05=a10_0x1681,_0x54c1c8=_0x37fa8d();while(!![]){try{const _0x4afc78=parseInt(_0x1f1d05(0x145))/0x1*(parseInt(_0x1f1d05(0x149))/0x2)+-parseInt(_0x1f1d05(0x13f))/0x3+parseInt(_0x1f1d05(0x15e))/0x4+parseInt(_0x1f1d05(0x15a))/0x5*(parseInt(_0x1f1d05(0x144))/0x6)+-parseInt(_0x1f1d05(0x152))/0x7+-parseInt(_0x1f1d05(0x16c))/0x8+parseInt(_0x1f1d05(0x168))/0x9;if(_0x4afc78===_0x5e8997)break;else _0x54c1c8['push'](_0x54c1c8['shift']());}catch(_0x50e83a){_0x54c1c8['push'](_0x54c1c8['shift']());}}}(a10_0x2798,0x64c9e));import{existsSync,readFileSync,statSync}from'node:fs';import{createRuntimeArtifact,getRuntimeArtifact,listRuntimeArtifacts,updateRuntimeArtifact}from'../../core/api-client.js';import{ID_FLAG,VERBOSE_FLAG}from'../../commands/common/flags.js';import{CliErrors}from'../../errors.js';import{dryRun}from'../../framework/dryrun.js';const ARTIFACT_TYPE_REACT_MODULE='react_module',ARTIFACT_SOURCE_AGENT=a10_0x513db9(0x17f),ALLOWED_REACT_MODULE_IMPORTS=[a10_0x513db9(0x14a),a10_0x513db9(0x153),'lodash',a10_0x513db9(0x182),'antd',a10_0x513db9(0x174)];function a10_0x1681(_0x1414d3,_0x1a08d4){_0x1414d3=_0x1414d3-0x130;const _0x279858=a10_0x2798();let _0x16816f=_0x279858[_0x1414d3];return _0x16816f;}export const ALLOWED_REACT_MODULE_IMPORTS_TEXT=ALLOWED_REACT_MODULE_IMPORTS[a10_0x513db9(0x151)](',\x20');const IMPORT_SOURCE_PATTERNS=[/\bimport\s+(?:type\s+)?(?:[^'";]*?\s+from\s+)?["']([^"']+)["']/g,/\bexport\s+(?:type\s+)?[^'";]*?\s+from\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g],PAGE_LEVEL_PATTERNS=[/<!doctype\s+html/i,/<\s*html\b/i,/\bcreateRoot\s*\(/,/\bReactDOM\s*\.\s*render\s*\(/,/\bReactDOM\s*\.\s*createRoot\s*\(/],FILE_FLAG={'name':a10_0x513db9(0x16d),'type':'string','required':!![],'description':'Path\x20to\x20a\x20local\x20UTF-8\x20React\x20module\x20source\x20file'},ARTIFACT_NAME_FLAG={'name':'name','type':a10_0x513db9(0x135),'description':a10_0x513db9(0x130)},METADATA_FLAG={'name':'metadata','type':a10_0x513db9(0x135),'description':a10_0x513db9(0x134)};function isPlainObject(_0xa395ae){const _0x2f44b7=a10_0x513db9;return typeof _0xa395ae===_0x2f44b7(0x167)&&_0xa395ae!==null&&!Array[_0x2f44b7(0x17e)](_0xa395ae);}function readSourceFile(_0x4bf008){const _0x4d084d=a10_0x513db9;if(!_0x4bf008)throw CliErrors[_0x4d084d(0x150)]('File\x20path\x20is\x20required.');if(!existsSync(_0x4bf008))throw CliErrors['validation'](_0x4d084d(0x165)+_0x4bf008);if(!statSync(_0x4bf008)[_0x4d084d(0x179)]())throw CliErrors['validation'](_0x4d084d(0x156)+_0x4bf008);const _0x585898=readFileSync(_0x4bf008,_0x4d084d(0x16a));return validateReactModuleSource(_0x585898),_0x585898;}function parseMetadata(_0x476b03){const _0x38c03b=a10_0x513db9;if(!_0x476b03)return undefined;let _0x2d3a00;try{_0x2d3a00=JSON[_0x38c03b(0x164)](_0x476b03);}catch{throw CliErrors[_0x38c03b(0x150)](_0x38c03b(0x16f)+_0x476b03);}if(!isPlainObject(_0x2d3a00))throw CliErrors['validation'](_0x38c03b(0x15d));const _0x1ed83f={..._0x2d3a00};return delete _0x1ed83f[_0x38c03b(0x14c)],_0x1ed83f;}function a10_0x2798(){const _0x381df9=['favorite','Artifact\x20ID','validation','join','3527601Kuvpir','react-dom','test','/client/artifact/create','File\x20is\x20not\x20a\x20regular\x20file:\x20','map','Update\x20a\x20react_module\x20Artifact\x20from\x20a\x20local\x20source\x20file','trim','169825MkxPbE','List\x20current-app\x20react_module\x20Artifacts','name','--metadata\x20must\x20be\x20a\x20JSON\x20object.','426212STSPPG','startsWith','update','data','content','number','parse','File\x20not\x20found:\x20','artifact','object','6934734DrHSqT','bool','utf8','react_module\x20must\x20be\x20an\x20embeddable\x20React\x20module,\x20not\x20full\x20HTML\x20or\x20a\x20ReactDOM/createRoot\x20mount\x20entry.','1459704DGtZuU','file','Created\x20Artifact\x20','Invalid\x20JSON\x20for\x20--metadata:\x20','Optional\x20favorite-state\x20filter','some','list','includes','@ant-design/icons','verbose','artifactType','split','Optional\x20source\x20filter,\x20for\x20example\x20AGENT','isFile','/update','read','appCode','description','isArray','AGENT','write','deleted','dayjs','num','add','Artifact\x20display\x20name','str','.\x20Unsupported:\x20','create','Artifact\x20metadata\x20as\x20JSON\x20object;\x20compiledContent\x20is\x20stripped','string','boolean','createTime','source','body','react_module\x20imports\x20are\x20limited\x20to:\x20','filter','build','detail','Create\x20a\x20react_module\x20Artifact\x20from\x20a\x20local\x20source\x20file','1015770WllMXr','flag','Updated\x20Artifact\x20','Preview:\x20create\x20react_module\x20Artifact','lastIndex','78tYYxyY','39734oMLTtC','metadata','POST','Artifact\x20source\x20file\x20is\x20blank.','6uUcMUG','react','updateTime','compiledContent','length'];a10_0x2798=function(){return _0x381df9;};return a10_0x2798();}function getPackageName(_0x14500d){const _0x105a36=a10_0x513db9;if(_0x14500d[_0x105a36(0x15f)]('@')){const [_0x1aadf0,_0x2741a8]=_0x14500d[_0x105a36(0x177)]('/');return _0x1aadf0&&_0x2741a8?_0x1aadf0+'/'+_0x2741a8:_0x14500d;}return _0x14500d['split']('/')[0x0]||_0x14500d;}function validateAllowedImports(_0x57ccb1){const _0x47de46=a10_0x513db9,_0x421250=new Set();for(const _0x1d044a of IMPORT_SOURCE_PATTERNS){_0x1d044a[_0x47de46(0x143)]=0x0;let _0x2cdff4;while((_0x2cdff4=_0x1d044a['exec'](_0x57ccb1))!==null){const _0x29f908=_0x2cdff4[0x1]?.[_0x47de46(0x159)]();_0x29f908&&_0x421250[_0x47de46(0x184)](_0x29f908);}}const _0x423c59=[..._0x421250]['map'](getPackageName)[_0x47de46(0x13b)](_0x12a4ea=>!ALLOWED_REACT_MODULE_IMPORTS[_0x47de46(0x173)](_0x12a4ea));if(_0x423c59[_0x47de46(0x14d)]>0x0)throw CliErrors[_0x47de46(0x150)](_0x47de46(0x13a)+ALLOWED_REACT_MODULE_IMPORTS_TEXT+_0x47de46(0x132)+[...new Set(_0x423c59)][_0x47de46(0x151)](',\x20'));}export function validateReactModuleSource(_0x528f79){const _0x35a59b=a10_0x513db9;if(!_0x528f79['trim']())throw CliErrors['validation'](_0x35a59b(0x148));if(PAGE_LEVEL_PATTERNS[_0x35a59b(0x171)](_0x17f092=>_0x17f092[_0x35a59b(0x154)](_0x528f79)))throw CliErrors[_0x35a59b(0x150)](_0x35a59b(0x16b));validateAllowedImports(_0x528f79);}function buildArtifactInput(_0x595010){const _0x3f682f=a10_0x513db9,_0x7511c7=readSourceFile(_0x595010[_0x3f682f(0x131)]('file')),_0x54c782=_0x595010[_0x3f682f(0x131)](_0x3f682f(0x15c))[_0x3f682f(0x159)](),_0x3abb5f=parseMetadata(_0x595010[_0x3f682f(0x131)](_0x3f682f(0x146)));return{'artifactType':ARTIFACT_TYPE_REACT_MODULE,..._0x54c782?{'name':_0x54c782}:{},'content':_0x7511c7,..._0x3abb5f?{'metadata':_0x3abb5f}:{},'source':ARTIFACT_SOURCE_AGENT};}function summarizeArtifact(_0x3a9942){const _0x394581=a10_0x513db9;return{'id':_0x3a9942['id'],'name':_0x3a9942[_0x394581(0x15c)],'artifactType':_0x3a9942[_0x394581(0x176)],'source':_0x3a9942['source'],'favorite':_0x3a9942[_0x394581(0x14e)],'deleted':_0x3a9942[_0x394581(0x181)],'createTime':_0x3a9942[_0x394581(0x137)],'updateTime':_0x3a9942[_0x394581(0x14b)]};}function detailArtifact(_0x4408ed){const _0x5d7d9a=a10_0x513db9;return{'id':_0x4408ed['id'],'appCode':_0x4408ed['appCode'],'name':_0x4408ed[_0x5d7d9a(0x15c)],'artifactType':_0x4408ed['artifactType'],'source':_0x4408ed['source'],'favorite':_0x4408ed[_0x5d7d9a(0x14e)],'deleted':_0x4408ed[_0x5d7d9a(0x181)],'content':_0x4408ed[_0x5d7d9a(0x162)]??'','compiledContent':_0x4408ed['compiledContent'],'metadata':_0x4408ed[_0x5d7d9a(0x146)]??{},'createTime':_0x4408ed['createTime'],'updateTime':_0x4408ed[_0x5d7d9a(0x14b)]};}function readFavoriteFlag(_0x356e18){const _0x4f1a1d=a10_0x513db9,_0x5babc1=_0x356e18[_0x4f1a1d(0x140)](_0x4f1a1d(0x14e));return _0x5babc1===undefined||_0x5babc1===null||_0x5babc1===''?undefined:_0x356e18[_0x4f1a1d(0x169)](_0x4f1a1d(0x14e));}const artifactList={'service':a10_0x513db9(0x166),'command':a10_0x513db9(0x172),'description':a10_0x513db9(0x15b),'risk':a10_0x513db9(0x17b),'flags':[{'name':a10_0x513db9(0x138),'type':'string','description':a10_0x513db9(0x178)},{'name':'favorite','type':a10_0x513db9(0x136),'description':a10_0x513db9(0x170)},VERBOSE_FLAG],async 'execute'(_0x4c2ecf){const _0x3e2233=a10_0x513db9,_0x32716e=await listRuntimeArtifacts(_0x4c2ecf[_0x3e2233(0x17c)],{'artifactType':ARTIFACT_TYPE_REACT_MODULE,..._0x4c2ecf[_0x3e2233(0x131)](_0x3e2233(0x138))?{'source':_0x4c2ecf[_0x3e2233(0x131)](_0x3e2233(0x138))}:{},...readFavoriteFlag(_0x4c2ecf)!==undefined?{'favorite':readFavoriteFlag(_0x4c2ecf)}:{}});return{'ok':!![],'data':{'total':_0x32716e[_0x3e2233(0x14d)],'items':_0x4c2ecf[_0x3e2233(0x169)](_0x3e2233(0x175))?_0x32716e:_0x32716e[_0x3e2233(0x157)](summarizeArtifact)}};}},artifactDetail={'service':a10_0x513db9(0x166),'command':a10_0x513db9(0x13d),'description':'Show\x20one\x20Artifact\x20by\x20id','risk':a10_0x513db9(0x17b),'flags':[{...ID_FLAG,'description':a10_0x513db9(0x14f)}],async 'execute'(_0x33cb72){const _0xd313f6=a10_0x513db9,_0xf0df6c=await getRuntimeArtifact(_0x33cb72['num']('id'),_0x33cb72[_0xd313f6(0x17c)]);return{'ok':!![],'data':detailArtifact(_0xf0df6c)};}},artifactCreate={'service':'artifact','command':a10_0x513db9(0x133),'description':a10_0x513db9(0x13e),'risk':a10_0x513db9(0x180),'flags':[FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x5e4bdd){const _0x1298dd=a10_0x513db9,_0x518827=buildArtifactInput(_0x5e4bdd),_0x34cf13=await createRuntimeArtifact(_0x5e4bdd['appCode'],_0x518827);return{'ok':!![],'data':detailArtifact(_0x34cf13),'message':_0x1298dd(0x16e)+_0x34cf13['id']+(_0x34cf13[_0x1298dd(0x15c)]?'\x20('+_0x34cf13[_0x1298dd(0x15c)]+')':'')};},async 'dryRun'(_0x3eeecf){const _0x130485=a10_0x513db9,_0x505648=buildArtifactInput(_0x3eeecf);return dryRun('POST',_0x130485(0x155))[_0x130485(0x139)]({'appCode':_0x3eeecf['appCode'],..._0x505648})[_0x130485(0x17d)](_0x130485(0x142))[_0x130485(0x13c)]();},'writeEventSubject'(_0x37789b){const _0x456096=a10_0x513db9,_0x112c24=_0x37789b[_0x456096(0x161)]?.['id'];if(typeof _0x112c24!==_0x456096(0x135)&&typeof _0x112c24!=='number')return undefined;return{'kind':_0x456096(0x166),'id':String(_0x112c24),'action':_0x456096(0x133)};}},artifactUpdate={'service':a10_0x513db9(0x166),'command':a10_0x513db9(0x160),'description':a10_0x513db9(0x158),'risk':a10_0x513db9(0x180),'flags':[{...ID_FLAG,'description':a10_0x513db9(0x14f)},FILE_FLAG,ARTIFACT_NAME_FLAG,METADATA_FLAG],async 'execute'(_0x41fb6d){const _0x429243=a10_0x513db9,_0xdd3fd1=_0x41fb6d[_0x429243(0x183)]('id'),_0x384295=buildArtifactInput(_0x41fb6d),_0xc1b676=await updateRuntimeArtifact(_0xdd3fd1,_0x41fb6d[_0x429243(0x17c)],_0x384295);return{'ok':!![],'data':detailArtifact(_0xc1b676),'message':_0x429243(0x141)+_0xc1b676['id']+(_0xc1b676[_0x429243(0x15c)]?'\x20('+_0xc1b676[_0x429243(0x15c)]+')':'')};},async 'dryRun'(_0x29a9ff){const _0x12e76b=a10_0x513db9,_0x1ac7b1=_0x29a9ff[_0x12e76b(0x183)]('id'),_0x314b75=buildArtifactInput(_0x29a9ff);return dryRun(_0x12e76b(0x147),'/client/artifact/'+_0x1ac7b1+_0x12e76b(0x17a))[_0x12e76b(0x139)]({'appCode':_0x29a9ff[_0x12e76b(0x17c)],..._0x314b75})['description']('Preview:\x20update\x20react_module\x20Artifact\x20'+_0x1ac7b1)[_0x12e76b(0x13c)]();},'writeEventSubject'(_0x5ec99e){const _0x21d766=a10_0x513db9,_0x399b8f=_0x5ec99e[_0x21d766(0x161)]?.['id'];if(typeof _0x399b8f!==_0x21d766(0x135)&&typeof _0x399b8f!==_0x21d766(0x163))return undefined;return{'kind':'artifact','id':String(_0x399b8f),'action':_0x21d766(0x160)};}};export const artifactDefinitions=[artifactList,artifactDetail,artifactCreate,artifactUpdate];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Device code authorization flow.
|
|
3
|
+
*
|
|
4
|
+
* Two modes:
|
|
5
|
+
* - Default (V1): interactive polling with spinner, saves AK directly.
|
|
6
|
+
* - --url-only (V2): prints URL to stdout and exits; WorkBuddy polls via `auth status --check`.
|
|
7
|
+
*
|
|
8
|
+
* The temp file `~/.lovrabet/.device-auth` bridges the two commands:
|
|
9
|
+
* `auth device` writes it, `auth status --check` reads it to resolve pending auth.
|
|
10
|
+
*/
|
|
11
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
12
|
+
interface DeviceAuthTokenResponse {
|
|
13
|
+
status: "authorization_pending" | "success" | "expired";
|
|
14
|
+
access_key?: string;
|
|
15
|
+
}
|
|
16
|
+
interface StoredDeviceCode {
|
|
17
|
+
code: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
scope: "global" | "project";
|
|
20
|
+
}
|
|
21
|
+
export declare function generateDeviceCode(): string;
|
|
22
|
+
export declare function buildDeviceAuthUrl(userDomain: string, code: string, source?: string): string;
|
|
23
|
+
export declare function getDeviceCodePath(): string;
|
|
24
|
+
export declare function readStoredDeviceCode(): StoredDeviceCode | null;
|
|
25
|
+
export declare function writeStoredDeviceCode(code: string, scope: "global" | "project"): void;
|
|
26
|
+
export declare function deleteStoredDeviceCode(): void;
|
|
27
|
+
export declare function isStoredDeviceCodeExpired(stored: StoredDeviceCode): boolean;
|
|
28
|
+
export declare function fetchDeviceToken(userDomain: string, code: string): Promise<DeviceAuthTokenResponse>;
|
|
29
|
+
export declare function pollDeviceToken(userDomain: string, code: string, signal: AbortSignal): Promise<string>;
|
|
30
|
+
export declare const authDeviceDefinition: CommandDefinition;
|
|
31
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a11_0x4dea68=a11_0x49c5;(function(_0x526b50,_0x219690){const _0x1c0e4b=a11_0x49c5,_0x431a62=_0x526b50();while(!![]){try{const _0x578b16=-parseInt(_0x1c0e4b(0x1db))/0x1*(-parseInt(_0x1c0e4b(0x1d8))/0x2)+parseInt(_0x1c0e4b(0x1fc))/0x3*(parseInt(_0x1c0e4b(0x1eb))/0x4)+-parseInt(_0x1c0e4b(0x1af))/0x5*(-parseInt(_0x1c0e4b(0x1fb))/0x6)+parseInt(_0x1c0e4b(0x1e6))/0x7*(parseInt(_0x1c0e4b(0x1da))/0x8)+parseInt(_0x1c0e4b(0x1bf))/0x9*(-parseInt(_0x1c0e4b(0x1ca))/0xa)+parseInt(_0x1c0e4b(0x1cb))/0xb+-parseInt(_0x1c0e4b(0x1f3))/0xc;if(_0x578b16===_0x219690)break;else _0x431a62['push'](_0x431a62['shift']());}catch(_0x111e6e){_0x431a62['push'](_0x431a62['shift']());}}}(a11_0x1a34,0xd814c));import{existsSync,mkdirSync,readFileSync,unlinkSync,writeFileSync}from'node:fs';import{dirname}from'node:path';import{homedir}from'node:os';import{readScopedConfig,writeScopedConfig}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{PRODUCT_CONFIG}from'../../constant/product.js';function a11_0x1a34(){const _0x123563=['aborted','\x20auth\x20device','status','project','\x20config.','expired','Waiting\x20for\x20authorization\x20(timeout:\x2010\x20minutes,\x20Ctrl+C\x20to\x20cancel)...','name','7432341ScURpX','global-default','auth','json','code','6544bUesrI','\x0dWaiting\x20for\x20authorization...\x20','),\x20retrying...','&source=','string','AccessKey\x20saved\x20to\x20','Write\x20to\x20project\x20config','cancelled','14369244RHqzBV','application/json','Device\x20auth\x20API\x20unreachable\x20after\x20multiple\x20retries.','The\x20device\x20code\x20is\x20valid\x20for\x2010\x20minutes.','Device\x20authorization\x20cancelled.','homeDirName','str','padStart','7170hakQVW','1356WEyUkB','networkError','getTime','log','After\x20authorizing,\x20re-run:\x20','Already\x20authorized.\x20Use\x20`lovrabet\x20auth\x20status`\x20to\x20verify.','access_key','50RxcUlx','scope','write','Open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20authorize:','Device\x20authorization\x20successful.','SIGINT','/.device-auth','Device\x20auth\x20API\x20returned\x20HTTP\x20','stderr','test','/api/device-auth/token','Authorize\x20via\x20device\x20code\x20flow\x20(open\x20browser,\x20no\x20copy-paste)','lovrabet-cli','removeListener','Invalid\x20device\x20auth\x20response','global','909JTybeH','url-only','Device\x20auth\x20API\x20error\x20(','accessKey','floor','utf8','Invalid\x20access_key\x20returned\x20by\x20server.','stringify','validation','abort','POST','154040GZoPxl','5554483QxwJJo','source','object','createdAt','Device\x20authorization\x20URL\x20printed.\x20Complete\x20authorization\x20in\x20browser,\x20then\x20re-run.','signal','success','bool','boolean','apiError','Device\x20code\x20expired.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.','toISOString','AbortError','26142QoneSa','data','8oNQfSa','101KONxBP','App\x20name\x20shown\x20on\x20authorization\x20page\x20(default:\x20lovrabet)','once'];a11_0x1a34=function(){return _0x123563;};return a11_0x1a34();}import{getUserDomain}from'../../constant/domain.js';import{CliErrors}from'../../errors.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';function resolveAuthScopeFlags(_0x3d17be){const _0x153443=a11_0x49c5;return toScopeFlags(resolveConfigScope({'explicitGlobal':_0x3d17be[_0x153443(0x1d2)]('global'),'explicitProject':_0x3d17be[_0x153443(0x1d2)]('project'),'policy':_0x153443(0x1e7)}));}const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/,DEVICE_CODE_TTL_MS=0x927c0,POLL_INTERVAL_MS=0xbb8,MAX_POLLS=0xc8,MAX_CONSECUTIVE_NETWORK_ERRORS=0x5;export function generateDeviceCode(){return crypto['randomUUID']();}export function buildDeviceAuthUrl(_0x50406b,_0x85892f,_0x3dd58d=a11_0x4dea68(0x1bb)){const _0x59171c=a11_0x4dea68;return _0x50406b+'/device-auth?code='+encodeURIComponent(_0x85892f)+_0x59171c(0x1ee)+encodeURIComponent(_0x3dd58d);}export function getDeviceCodePath(){const _0x5ab852=a11_0x4dea68;return homedir()+'/'+PRODUCT_CONFIG[_0x5ab852(0x1f8)]+_0x5ab852(0x1b5);}export function readStoredDeviceCode(){const _0xf44f5b=a11_0x4dea68,_0x1f321c=getDeviceCodePath();if(!existsSync(_0x1f321c))return null;try{const _0x1a5683=readFileSync(_0x1f321c,{'encoding':_0xf44f5b(0x1c4)}),_0x201c15=JSON['parse'](_0x1a5683);if(_0x201c15&&typeof _0x201c15[_0xf44f5b(0x1ea)]===_0xf44f5b(0x1ef)&&typeof _0x201c15[_0xf44f5b(0x1ce)]===_0xf44f5b(0x1ef)&&(_0x201c15[_0xf44f5b(0x1b0)]==='global'||_0x201c15[_0xf44f5b(0x1b0)]==='project'))return _0x201c15;}catch{}return null;}function a11_0x49c5(_0x108e3b,_0xa94e01){_0x108e3b=_0x108e3b-0x1ad;const _0x1a34fd=a11_0x1a34();let _0x49c59=_0x1a34fd[_0x108e3b];return _0x49c59;}export function writeStoredDeviceCode(_0x430dc1,_0x13c84e){const _0x442817=a11_0x4dea68,_0x47bdec=getDeviceCodePath(),_0x5d2c0b=dirname(_0x47bdec);!existsSync(_0x5d2c0b)&&mkdirSync(_0x5d2c0b,{'recursive':!![]});const _0x5ce2a6={'code':_0x430dc1,'createdAt':new Date()[_0x442817(0x1d6)](),'scope':_0x13c84e};writeFileSync(_0x47bdec,JSON['stringify'](_0x5ce2a6),{'encoding':_0x442817(0x1c4),'mode':0x180});}export function deleteStoredDeviceCode(){const _0x41fb04=getDeviceCodePath();try{unlinkSync(_0x41fb04);}catch{}}export function isStoredDeviceCodeExpired(_0x378793){const _0x14ae17=a11_0x4dea68;return Date['now']()-new Date(_0x378793[_0x14ae17(0x1ce)])[_0x14ae17(0x1fe)]()>DEVICE_CODE_TTL_MS;}export async function fetchDeviceToken(_0xd71526,_0x10dad5){const _0x942892=a11_0x4dea68,_0x28cc4e=_0xd71526+_0x942892(0x1b9),_0x11998b=new AbortController(),_0x3d4454=setTimeout(()=>_0x11998b[_0x942892(0x1c8)](),0x2710),_0x23ad35=await fetch(_0x28cc4e,{'method':_0x942892(0x1c9),'headers':{'Content-Type':_0x942892(0x1f4)},'body':JSON[_0x942892(0x1c6)]({'code':_0x10dad5}),'signal':_0x11998b[_0x942892(0x1d0)]});clearTimeout(_0x3d4454);if(!_0x23ad35['ok'])throw CliErrors[_0x942892(0x1fd)](_0x942892(0x1b6)+_0x23ad35[_0x942892(0x1e0)]);const _0x2dcd92=await _0x23ad35[_0x942892(0x1e9)](),_0x4da4ed=_0x2dcd92[_0x942892(0x1d9)]&&typeof _0x2dcd92['data']===_0x942892(0x1cd)?_0x2dcd92[_0x942892(0x1d9)]:_0x2dcd92;if(!_0x4da4ed||typeof _0x4da4ed['status']!==_0x942892(0x1ef))throw CliErrors['apiError'](_0x942892(0x1bd));return{'status':_0x4da4ed[_0x942892(0x1e0)],'access_key':typeof _0x4da4ed[_0x942892(0x1ae)]===_0x942892(0x1ef)?_0x4da4ed['access_key']:undefined};}export async function pollDeviceToken(_0x5d6c55,_0x164f74,_0x29ec65){const _0x17db3b=a11_0x4dea68;let _0x39b82a=0x0;for(let _0x2bd422=0x0;_0x2bd422<MAX_POLLS;_0x2bd422++){if(_0x29ec65[_0x17db3b(0x1de)])throw CliErrors[_0x17db3b(0x1f2)](_0x17db3b(0x1f7));let _0x100611;try{_0x100611=await fetchDeviceToken(_0x5d6c55,_0x164f74);}catch(_0x4fa960){if(_0x4fa960 instanceof Error&&_0x4fa960[_0x17db3b(0x1e5)]===_0x17db3b(0x1d7))throw CliErrors[_0x17db3b(0x1f2)](_0x17db3b(0x1f7));_0x39b82a++;if(_0x39b82a>=MAX_CONSECUTIVE_NETWORK_ERRORS)throw CliErrors[_0x17db3b(0x1fd)](_0x17db3b(0x1f5));writeCliSideChannelLine(_0x17db3b(0x1c1)+_0x39b82a+'/'+MAX_CONSECUTIVE_NETWORK_ERRORS+_0x17db3b(0x1ed)),await sleep(POLL_INTERVAL_MS);continue;}_0x39b82a=0x0;if(_0x100611[_0x17db3b(0x1e0)]===_0x17db3b(0x1d1)){if(!_0x100611[_0x17db3b(0x1ae)])throw CliErrors[_0x17db3b(0x1d4)](_0x17db3b(0x1c5));return _0x100611['access_key'];}if(_0x100611[_0x17db3b(0x1e0)]===_0x17db3b(0x1e3)){deleteStoredDeviceCode();throw CliErrors['validation'](_0x17db3b(0x1d5));}const _0x2c8238=(_0x2bd422+0x1)*POLL_INTERVAL_MS,_0x5723f7=DEVICE_CODE_TTL_MS-_0x2c8238,_0x292cad=Math[_0x17db3b(0x1c3)](_0x5723f7/0xea60),_0x33d145=Math['floor'](_0x5723f7%0xea60/0x3e8);process[_0x17db3b(0x1b7)]['write'](_0x17db3b(0x1ec)+_0x292cad+':'+String(_0x33d145)[_0x17db3b(0x1fa)](0x2,'0')+'\x20remaining'),await sleep(POLL_INTERVAL_MS);}deleteStoredDeviceCode();throw CliErrors[_0x17db3b(0x1c7)]('Device\x20authorization\x20timed\x20out\x20after\x2010\x20minutes.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.');}function sleep(_0x7b6861){return new Promise(_0x3503dc=>setTimeout(_0x3503dc,_0x7b6861));}export const authDeviceDefinition={'service':a11_0x4dea68(0x1e8),'command':'device','description':a11_0x4dea68(0x1ba),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a11_0x4dea68(0x1be),'type':a11_0x4dea68(0x1d3),'description':'Write\x20to\x20global\x20config\x20(default)','default':!![]},{'name':a11_0x4dea68(0x1e1),'type':a11_0x4dea68(0x1d3),'description':a11_0x4dea68(0x1f1),'default':![]},{'name':'source','type':'string','description':a11_0x4dea68(0x1dc),'default':a11_0x4dea68(0x1bb)},{'name':a11_0x4dea68(0x1c0),'type':a11_0x4dea68(0x1d3),'description':'Print\x20URL\x20to\x20stdout\x20and\x20exit\x20(for\x20WorkBuddy\x20integration)','default':![]}],async 'execute'(_0x1ce3dd){const _0xf30fd6=a11_0x4dea68,_0x1f8c5a=resolveAuthScopeFlags(_0x1ce3dd),_0x170e61=_0x1f8c5a[_0xf30fd6(0x1be)]?_0xf30fd6(0x1be):_0xf30fd6(0x1e1),_0x3ee4bd=readScopedConfig(_0x1f8c5a);if(_0x3ee4bd[_0xf30fd6(0x1c2)])return{'ok':!![],'message':_0xf30fd6(0x1ad)};const _0x5d2e1d=(_0x1ce3dd[_0xf30fd6(0x1f9)](_0xf30fd6(0x1cc))||'lovrabet-cli')['trim'](),_0x316b98=getUserDomain(),_0x535d9e=readStoredDeviceCode(),_0x3a70b9=_0x535d9e&&!isStoredDeviceCodeExpired(_0x535d9e)?_0x535d9e[_0xf30fd6(0x1ea)]:((()=>{const _0x4af520=generateDeviceCode();return writeStoredDeviceCode(_0x4af520,_0x170e61),_0x4af520;})()),_0x2060f3=buildDeviceAuthUrl(_0x316b98,_0x3a70b9,_0x5d2e1d);if(_0x1ce3dd[_0xf30fd6(0x1d2)](_0xf30fd6(0x1c0)))return console[_0xf30fd6(0x1ff)](_0x2060f3),{'ok':!![]};writeCliSideChannelLine(_0xf30fd6(0x1b2)),writeCliSideChannelLine(''),writeCliSideChannelLine(_0x2060f3),writeCliSideChannelLine(''),writeCliSideChannelLine(_0xf30fd6(0x1f6));if(_0x1ce3dd['nonInteractive'])return writeCliSideChannelLine(_0xf30fd6(0x200)+CLI_BIN_NAME+_0xf30fd6(0x1df)),{'ok':!![],'message':_0xf30fd6(0x1cf)};writeCliSideChannelLine(_0xf30fd6(0x1e4));const _0x40bc6d=new AbortController(),_0x2a33ec=()=>{const _0x597c49=_0xf30fd6;_0x40bc6d[_0x597c49(0x1c8)](),process['removeListener'](_0x597c49(0x1b4),_0x2a33ec);};process[_0xf30fd6(0x1dd)](_0xf30fd6(0x1b4),_0x2a33ec);let _0x5ce8bc;try{_0x5ce8bc=await pollDeviceToken(_0x316b98,_0x3a70b9,_0x40bc6d[_0xf30fd6(0x1d0)]);}finally{process[_0xf30fd6(0x1bc)]('SIGINT',_0x2a33ec);}if(!ACCESS_KEY_PATTERN[_0xf30fd6(0x1b8)](_0x5ce8bc))throw CliErrors[_0xf30fd6(0x1d4)](_0xf30fd6(0x1c5));const _0x398c17=readScopedConfig(_0x1f8c5a);return _0x398c17['accessKey']=_0x5ce8bc,writeScopedConfig(_0x398c17,_0x1f8c5a),deleteStoredDeviceCode(),process[_0xf30fd6(0x1b7)][_0xf30fd6(0x1b1)]('\x0a'),writeCliSideChannelLine(_0xf30fd6(0x1f0)+_0x170e61+_0xf30fd6(0x1e2)),writeCliSideChannelLine('Verify:\x20'+CLI_BIN_NAME+'\x20auth\x20status'),{'ok':!![],'message':_0xf30fd6(0x1b3)};}};
|
|
1
|
+
const a11_0x5d43c8=a11_0x21a3;(function(_0x4fa719,_0x38985d){const _0x2b7413=a11_0x21a3,_0x35db0a=_0x4fa719();while(!![]){try{const _0x1cf2f0=-parseInt(_0x2b7413(0x200))/0x1*(parseInt(_0x2b7413(0x1fb))/0x2)+parseInt(_0x2b7413(0x1f0))/0x3*(-parseInt(_0x2b7413(0x1e9))/0x4)+-parseInt(_0x2b7413(0x1d0))/0x5*(-parseInt(_0x2b7413(0x1fa))/0x6)+-parseInt(_0x2b7413(0x20c))/0x7+parseInt(_0x2b7413(0x1ca))/0x8*(-parseInt(_0x2b7413(0x1f5))/0x9)+parseInt(_0x2b7413(0x20b))/0xa*(-parseInt(_0x2b7413(0x201))/0xb)+parseInt(_0x2b7413(0x1fd))/0xc;if(_0x1cf2f0===_0x38985d)break;else _0x35db0a['push'](_0x35db0a['shift']());}catch(_0x59ebdc){_0x35db0a['push'](_0x35db0a['shift']());}}}(a11_0x5521,0x1f3c8));import{existsSync,mkdirSync,readFileSync,unlinkSync,writeFileSync}from'node:fs';import{dirname}from'node:path';function a11_0x5521(){const _0x3743d1=['string','stderr','status','abort','aborted','log','global-default','Invalid\x20device\x20auth\x20response','project','After\x20authorizing,\x20re-run:\x20','removeListener','utf8','App\x20name\x20shown\x20on\x20authorization\x20page\x20(default:\x20lovrabet)','Write\x20to\x20global\x20config\x20(default)','toISOString','bool','3160EAefLP','global','validation','\x20config.','data','Already\x20authorized.\x20Use\x20`lovrabet\x20auth\x20status`\x20to\x20verify.','Open\x20this\x20URL\x20in\x20your\x20browser\x20to\x20authorize:','111SKYxpy','apiError','Device\x20authorization\x20cancelled.','str','/api/device-auth/token','37017FjcvBQ','parse','/device-auth?code=','networkError','now','1428846dlpavx','429878vsRtSc','),\x20retrying...','6462516LYUFth','url-only','Device\x20authorization\x20URL\x20printed.\x20Complete\x20authorization\x20in\x20browser,\x20then\x20re-run.','1pDcLpO','11bjtCDF','scope','test','SIGINT','nonInteractive','device','stringify','code','boolean','Device\x20authorization\x20timed\x20out\x20after\x2010\x20minutes.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.','1606190idqtJO','1621291CRxqeq','The\x20device\x20code\x20is\x20valid\x20for\x2010\x20minutes.','success','signal','source','lovrabet-cli','padStart','\x20remaining','&source=','write','/.device-auth','\x0dWaiting\x20for\x20authorization...\x20','24TNvKHt','json','expired','Authorize\x20via\x20device\x20code\x20flow\x20(open\x20browser,\x20no\x20copy-paste)','Device\x20auth\x20API\x20unreachable\x20after\x20multiple\x20retries.','Write\x20to\x20project\x20config','5CEMlnE','Device\x20auth\x20API\x20error\x20(','cancelled','AbortError','application/json','access_key','Verify:\x20','createdAt','once'];a11_0x5521=function(){return _0x3743d1;};return a11_0x5521();}function a11_0x21a3(_0x205862,_0x57c08f){_0x205862=_0x205862-0x1c7;const _0x5521ca=a11_0x5521();let _0x21a3be=_0x5521ca[_0x205862];return _0x21a3be;}import{homedir}from'node:os';import{readScopedConfig,writeScopedConfig}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{PRODUCT_CONFIG}from'../../constant/product.js';import{getUserDomain}from'../../constant/domain.js';import{CliErrors}from'../../errors.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';function resolveAuthScopeFlags(_0x11b686){const _0xfc515b=a11_0x21a3;return toScopeFlags(resolveConfigScope({'explicitGlobal':_0x11b686[_0xfc515b(0x1e8)](_0xfc515b(0x1ea)),'explicitProject':_0x11b686[_0xfc515b(0x1e8)](_0xfc515b(0x1e1)),'policy':_0xfc515b(0x1df)}));}const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/,DEVICE_CODE_TTL_MS=0x927c0,POLL_INTERVAL_MS=0xbb8,MAX_POLLS=0xc8,MAX_CONSECUTIVE_NETWORK_ERRORS=0x5;export function generateDeviceCode(){return crypto['randomUUID']();}export function buildDeviceAuthUrl(_0x104d6f,_0x15b929,_0x35dc81=a11_0x5d43c8(0x211)){const _0x333acc=a11_0x5d43c8;return _0x104d6f+_0x333acc(0x1f7)+encodeURIComponent(_0x15b929)+_0x333acc(0x214)+encodeURIComponent(_0x35dc81);}export function getDeviceCodePath(){const _0x3763eb=a11_0x5d43c8;return homedir()+'/'+PRODUCT_CONFIG['homeDirName']+_0x3763eb(0x1c8);}export function readStoredDeviceCode(){const _0x2ea240=a11_0x5d43c8,_0x2db3dc=getDeviceCodePath();if(!existsSync(_0x2db3dc))return null;try{const _0x15c376=readFileSync(_0x2db3dc,{'encoding':'utf8'}),_0x3b20d7=JSON[_0x2ea240(0x1f6)](_0x15c376);if(_0x3b20d7&&typeof _0x3b20d7[_0x2ea240(0x208)]==='string'&&typeof _0x3b20d7[_0x2ea240(0x1d7)]===_0x2ea240(0x1d9)&&(_0x3b20d7['scope']===_0x2ea240(0x1ea)||_0x3b20d7[_0x2ea240(0x202)]===_0x2ea240(0x1e1)))return _0x3b20d7;}catch{}return null;}export function writeStoredDeviceCode(_0x561050,_0x1eecf4){const _0x148ed3=a11_0x5d43c8,_0x166547=getDeviceCodePath(),_0x347fd5=dirname(_0x166547);!existsSync(_0x347fd5)&&mkdirSync(_0x347fd5,{'recursive':!![]});const _0xc102c5={'code':_0x561050,'createdAt':new Date()[_0x148ed3(0x1e7)](),'scope':_0x1eecf4};writeFileSync(_0x166547,JSON[_0x148ed3(0x207)](_0xc102c5),{'encoding':_0x148ed3(0x1e4),'mode':0x180});}export function deleteStoredDeviceCode(){const _0x4d4697=getDeviceCodePath();try{unlinkSync(_0x4d4697);}catch{}}export function isStoredDeviceCodeExpired(_0x54345e){const _0x1bb635=a11_0x5d43c8;return Date[_0x1bb635(0x1f9)]()-new Date(_0x54345e[_0x1bb635(0x1d7)])['getTime']()>DEVICE_CODE_TTL_MS;}export async function fetchDeviceToken(_0x43ad30,_0x42be9a){const _0xf3aaad=a11_0x5d43c8,_0x4f8c1e=_0x43ad30+_0xf3aaad(0x1f4),_0x920493=new AbortController(),_0x4df4c6=setTimeout(()=>_0x920493['abort'](),0x2710),_0x541c9d=await fetch(_0x4f8c1e,{'method':'POST','headers':{'Content-Type':_0xf3aaad(0x1d4)},'body':JSON['stringify']({'code':_0x42be9a}),'signal':_0x920493['signal']});clearTimeout(_0x4df4c6);if(!_0x541c9d['ok'])throw CliErrors[_0xf3aaad(0x1f8)]('Device\x20auth\x20API\x20returned\x20HTTP\x20'+_0x541c9d['status']);const _0x3f7937=await _0x541c9d[_0xf3aaad(0x1cb)](),_0xbfeef2=_0x3f7937[_0xf3aaad(0x1ed)]&&typeof _0x3f7937[_0xf3aaad(0x1ed)]==='object'?_0x3f7937[_0xf3aaad(0x1ed)]:_0x3f7937;if(!_0xbfeef2||typeof _0xbfeef2['status']!=='string')throw CliErrors[_0xf3aaad(0x1f1)](_0xf3aaad(0x1e0));return{'status':_0xbfeef2[_0xf3aaad(0x1db)],'access_key':typeof _0xbfeef2[_0xf3aaad(0x1d5)]===_0xf3aaad(0x1d9)?_0xbfeef2[_0xf3aaad(0x1d5)]:undefined};}export async function pollDeviceToken(_0x16e775,_0x42a4e4,_0x37cc04){const _0x1f8165=a11_0x5d43c8;let _0x3c09b1=0x0;for(let _0x1265e7=0x0;_0x1265e7<MAX_POLLS;_0x1265e7++){if(_0x37cc04[_0x1f8165(0x1dd)])throw CliErrors[_0x1f8165(0x1d2)](_0x1f8165(0x1f2));let _0x403178;try{_0x403178=await fetchDeviceToken(_0x16e775,_0x42a4e4);}catch(_0x2edd9f){if(_0x2edd9f instanceof Error&&_0x2edd9f['name']===_0x1f8165(0x1d3))throw CliErrors[_0x1f8165(0x1d2)](_0x1f8165(0x1f2));_0x3c09b1++;if(_0x3c09b1>=MAX_CONSECUTIVE_NETWORK_ERRORS)throw CliErrors[_0x1f8165(0x1f8)](_0x1f8165(0x1ce));writeCliSideChannelLine(_0x1f8165(0x1d1)+_0x3c09b1+'/'+MAX_CONSECUTIVE_NETWORK_ERRORS+_0x1f8165(0x1fc)),await sleep(POLL_INTERVAL_MS);continue;}_0x3c09b1=0x0;if(_0x403178[_0x1f8165(0x1db)]===_0x1f8165(0x20e)){if(!_0x403178[_0x1f8165(0x1d5)])throw CliErrors[_0x1f8165(0x1f1)]('Invalid\x20access_key\x20returned\x20by\x20server.');return _0x403178[_0x1f8165(0x1d5)];}if(_0x403178[_0x1f8165(0x1db)]===_0x1f8165(0x1cc)){deleteStoredDeviceCode();throw CliErrors[_0x1f8165(0x1eb)]('Device\x20code\x20expired.\x20Run\x20`lovrabet\x20auth\x20device`\x20to\x20get\x20a\x20new\x20code.');}const _0x3a6563=(_0x1265e7+0x1)*POLL_INTERVAL_MS,_0x3a7500=DEVICE_CODE_TTL_MS-_0x3a6563,_0x302694=Math['floor'](_0x3a7500/0xea60),_0x58c0e1=Math['floor'](_0x3a7500%0xea60/0x3e8);process['stderr'][_0x1f8165(0x1c7)](_0x1f8165(0x1c9)+_0x302694+':'+String(_0x58c0e1)[_0x1f8165(0x212)](0x2,'0')+_0x1f8165(0x213)),await sleep(POLL_INTERVAL_MS);}deleteStoredDeviceCode();throw CliErrors[_0x1f8165(0x1eb)](_0x1f8165(0x20a));}function sleep(_0x2f32d9){return new Promise(_0x5a114b=>setTimeout(_0x5a114b,_0x2f32d9));}export const authDeviceDefinition={'service':'auth','command':a11_0x5d43c8(0x206),'description':a11_0x5d43c8(0x1cd),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a11_0x5d43c8(0x1ea),'type':a11_0x5d43c8(0x209),'description':a11_0x5d43c8(0x1e6),'default':!![]},{'name':'project','type':a11_0x5d43c8(0x209),'description':a11_0x5d43c8(0x1cf),'default':![]},{'name':a11_0x5d43c8(0x210),'type':a11_0x5d43c8(0x1d9),'description':a11_0x5d43c8(0x1e5),'default':a11_0x5d43c8(0x211)},{'name':a11_0x5d43c8(0x1fe),'type':a11_0x5d43c8(0x209),'description':'Print\x20URL\x20to\x20stdout\x20and\x20exit\x20(for\x20WorkBuddy\x20integration)','default':![]}],async 'execute'(_0x411f1f){const _0x89a888=a11_0x5d43c8,_0x562175=resolveAuthScopeFlags(_0x411f1f),_0x98dfa5=_0x562175['global']?_0x89a888(0x1ea):_0x89a888(0x1e1),_0x463499=readScopedConfig(_0x562175);if(_0x463499['accessKey'])return{'ok':!![],'message':_0x89a888(0x1ee)};const _0x25bac8=(_0x411f1f[_0x89a888(0x1f3)](_0x89a888(0x210))||_0x89a888(0x211))['trim'](),_0x55f291=getUserDomain(),_0x1f7426=readStoredDeviceCode(),_0x40734f=_0x1f7426&&!isStoredDeviceCodeExpired(_0x1f7426)?_0x1f7426[_0x89a888(0x208)]:((()=>{const _0x166b01=generateDeviceCode();return writeStoredDeviceCode(_0x166b01,_0x98dfa5),_0x166b01;})()),_0x3b9bc3=buildDeviceAuthUrl(_0x55f291,_0x40734f,_0x25bac8);if(_0x411f1f[_0x89a888(0x1e8)]('url-only'))return console[_0x89a888(0x1de)](_0x3b9bc3),{'ok':!![]};writeCliSideChannelLine(_0x89a888(0x1ef)),writeCliSideChannelLine(''),writeCliSideChannelLine(_0x3b9bc3),writeCliSideChannelLine(''),writeCliSideChannelLine(_0x89a888(0x20d));if(_0x411f1f[_0x89a888(0x205)])return writeCliSideChannelLine(_0x89a888(0x1e2)+CLI_BIN_NAME+'\x20auth\x20device'),{'ok':!![],'message':_0x89a888(0x1ff)};writeCliSideChannelLine('Waiting\x20for\x20authorization\x20(timeout:\x2010\x20minutes,\x20Ctrl+C\x20to\x20cancel)...');const _0x426342=new AbortController(),_0x227671=()=>{const _0x5ae9cd=_0x89a888;_0x426342[_0x5ae9cd(0x1dc)](),process[_0x5ae9cd(0x1e3)]('SIGINT',_0x227671);};process[_0x89a888(0x1d8)](_0x89a888(0x204),_0x227671);let _0x3c1bff;try{_0x3c1bff=await pollDeviceToken(_0x55f291,_0x40734f,_0x426342[_0x89a888(0x20f)]);}finally{process[_0x89a888(0x1e3)](_0x89a888(0x204),_0x227671);}if(!ACCESS_KEY_PATTERN[_0x89a888(0x203)](_0x3c1bff))throw CliErrors[_0x89a888(0x1f1)]('Invalid\x20access_key\x20returned\x20by\x20server.');const _0x5c8319=readScopedConfig(_0x562175);return _0x5c8319['accessKey']=_0x3c1bff,writeScopedConfig(_0x5c8319,_0x562175),deleteStoredDeviceCode(),process[_0x89a888(0x1da)][_0x89a888(0x1c7)]('\x0a'),writeCliSideChannelLine('AccessKey\x20saved\x20to\x20'+_0x98dfa5+_0x89a888(0x1ec)),writeCliSideChannelLine(_0x89a888(0x1d6)+CLI_BIN_NAME+'\x20auth\x20status'),{'ok':!![],'message':'Device\x20authorization\x20successful.'};}};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `auth` subcommand definitions — login, init, logout, status.
|
|
3
|
+
*
|
|
4
|
+
* Why all three commands use `ClientAk` mode: Lovrabet Runtime CLI is a
|
|
5
|
+
* developer-facing tool that operates in the runtime environment (production /
|
|
6
|
+
* development / daily). It uses AccessKey authentication exclusively, not
|
|
7
|
+
* the session cookie flow used by the web-oriented `rabetbase` CLI.
|
|
8
|
+
*
|
|
9
|
+
* Why `--project` is a flag rather than the default for login/logout:
|
|
10
|
+
* Auth credentials are typically shared across projects (one developer works
|
|
11
|
+
* on multiple projects). Writing to global by default means one `auth login`
|
|
12
|
+
* suffices for all projects. `--project` is opt-in for project-isolated creds.
|
|
13
|
+
*
|
|
14
|
+
* Why `resolveAuthScopeFlags` uses `policy: "global-default"`: unlike `app use`
|
|
15
|
+
* (which prefers the project layer), auth credentials should default to global.
|
|
16
|
+
* Project-specific auth is an edge case handled by `--project`.
|
|
17
|
+
*
|
|
18
|
+
* Design decision: `auth status` reads the product-scoped access key env var
|
|
19
|
+
* (not through the config layer) to make the priority order explicit in the
|
|
20
|
+
* output: env var > config file. This helps users debug credential issues.
|
|
21
|
+
*/
|
|
22
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
23
|
+
export declare const authDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a12_0x442dcb=a12_0x5a10;(function(_0xb553b6,_0x49c7eb){const _0x5bb079=a12_0x5a10,_0xc40c63=_0xb553b6();while(!![]){try{const _0x1d2d20=parseInt(_0x5bb079(0xd6))/0x1*(-parseInt(_0x5bb079(0xb2))/0x2)+-parseInt(_0x5bb079(0xd1))/0x3+-parseInt(_0x5bb079(0xb8))/0x4+-parseInt(_0x5bb079(0xca))/0x5+parseInt(_0x5bb079(0x9b))/0x6+-parseInt(_0x5bb079(0xc3))/0x7+-parseInt(_0x5bb079(0x99))/0x8*(-parseInt(_0x5bb079(0x87))/0x9);if(_0x1d2d20===_0x49c7eb)break;else _0xc40c63['push'](_0xc40c63['shift']());}catch(_0x240655){_0xc40c63['push'](_0xc40c63['shift']());}}}(a12_0x589c,0x3f8f9));import{readScopedConfig,writeScopedConfig}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{PRODUCT_CONFIG,productEnv,productEnvName}from'../../constant/product.js';import{AUTH_MODE}from'../../constant/auth-mode.js';import{normalizeEnv,isDaily,isDev}from'../../constant/env.js';import{USER_ACCESS_KEY_CREATE_URL}from'../../constant/url.js';import{CliErrors}from'../../errors.js';function a12_0x589c(){const _0x3716a7=['string','\x20auth\x20login\x20--access-key\x20<ak_xxx>\x20[--global]','daily','\x20auth\x20login\x20[--global]\x20[--access-key\x20ak_xxx]','Auth\x20mode:\x20','Clear\x20all\x20config\x20in\x20scope\x20and\x20initialize\x20auth\x20from\x20scratch','validation','Device\x20authorization\x20pending.\x20Complete\x20authorization\x20in\x20browser,\x20then\x20try\x20again.','envName','check','\x20Current\x20env:\x20','AccessKey:\x20','Show\x20current\x20authentication\x20status','\x20scope.','\x20config','Give\x20the\x20AccessKey\x20to\x20your\x20AI\x20Agent,\x20then\x20run:\x20','Tip:\x20you\x20can\x20also\x20run:','Write\x20to\x20global\x20config\x20(default)','106RJrHzx','auth','AccessKey\x20required\x20for\x20login.\x20Create\x20one\x20in\x20','Save\x20accessKey\x20to\x20config\x20(global\x20by\x20default;\x20use\x20--project\x20for\x20project\x20config)','success','test','1924432tatNBw','If\x20command\x20execution\x20still\x20fails,\x20run:\x20','cancelled','push','trim','login','global-default','AccessKey\x20(ak_xxx...)','write','Then\x20verify\x20with:\x20','\x20Verify:\x20','1246441clpXJt','AccessKey\x20saved\x20to\x20','newConfigFileName','\x20auth\x20login\x20--non-interactive`\x20to\x20avoid\x20prompts,\x20or\x20`','slice','Target\x20environment\x20to\x20persist\x20with\x20the\x20new\x20auth\x20config','Clear\x20from\x20project\x20config\x20instead\x20of\x20global\x20config','978865cVLrwQ','ACCESS_KEY','Auth\x20config\x20reinitialized\x20in\x20','=ak_xxx','access_key','boolean','{\x20\x22accessKey\x22:\x20\x22ak_xxx\x22\x20}','1549383jmZqch','Clear\x20accessKey\x20from\x20config','str','expired','\x20config.','8209vBtBEe','\x20\x20export\x20','Use\x20`','stdin','isTTY','Invalid\x20accessKey\x20format:\x20\x22','\x20auth\x20login\x20--access-key\x20<ak_xxx>`\x20to\x20save\x20credentials.','bool','No\x20credentials\x20found.\x20Configure\x20one\x20of\x20the\x20options\x20below:','join','project\x20config','Shorthand\x20for\x20--access-key','Write\x20to\x20project\x20config\x20instead\x20of\x20global\x20config','Status:\x20valid','stdout','\x20auth\x20login\x20--access-key\x20<ak_xxx>','AccessKey\x20cleared\x20from\x20','504eWkApy','scope','repeat','env','read','Clear\x20from\x20global\x20config\x20(default)','yes','status','development','userCenterDisplayName','access-key','project','Exit\x20non-zero\x20when\x20no\x20AccessKey\x20is\x20configured','authRequired','\x20(via\x20','`auth\x20login`\x20does\x20not\x20support\x20--yes.','Option\x20C:\x20environment\x20variable','info','288944DijpOC','accessKey','265314PZqnVO','production','global','length','\x20auth\x20status'];a12_0x589c=function(){return _0x3716a7;};return a12_0x589c();}import{promptAccessKey,isAbortPrompt}from'../../commands/auth/prompt.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';function a12_0x5a10(_0x1ef96a,_0x587055){_0x1ef96a=_0x1ef96a-0x7b;const _0x589c0b=a12_0x589c();let _0x5a100c=_0x589c0b[_0x1ef96a];return _0x5a100c;}import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';import{getLoginUserInfo}from'../../core/api-client.js';import{getUserDomain}from'../../constant/domain.js';import{authDeviceDefinition,readStoredDeviceCode,deleteStoredDeviceCode,fetchDeviceToken,isStoredDeviceCodeExpired}from'../../commands/auth/device.js';const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/;function showAccessKeyCreateHint(){const _0x3863fb=a12_0x5a10;writeCliSideChannelLine('AccessKey\x20required\x20for\x20login.\x20Create\x20one\x20in\x20'+PRODUCT_CONFIG[_0x3863fb(0x90)]+':'),writeCliSideChannelLine('\x0a'+USER_ACCESS_KEY_CREATE_URL+'\x0a'),writeCliSideChannelLine(_0x3863fb(0xb0)),writeCliSideChannelLine('\x20\x20'+CLI_BIN_NAME+_0x3863fb(0x85));}function buildAccessKeySetupGuide(){const _0x5a39ff=a12_0x5a10;return[_0x5a39ff(0xb4)+PRODUCT_CONFIG[_0x5a39ff(0x90)]+':',USER_ACCESS_KEY_CREATE_URL,_0x5a39ff(0xaf)+CLI_BIN_NAME+_0x5a39ff(0xa1)][_0x5a39ff(0x7f)]('\x0a');}function canPromptForAccessKey(_0x413a67){const _0x103da2=a12_0x5a10;return!_0x413a67['nonInteractive']&&process[_0x103da2(0xd9)][_0x103da2(0xda)]!==![]&&process[_0x103da2(0x84)][_0x103da2(0xda)]!==![];}function resolveAuthScopeFlags(_0x1525a5){const _0x5e2d56=a12_0x5a10;return toScopeFlags(resolveConfigScope({'explicitGlobal':_0x1525a5['bool'](_0x5e2d56(0x9d)),'explicitProject':_0x1525a5['bool'](_0x5e2d56(0x92)),'policy':_0x5e2d56(0xbe)}));}async function resolveAuthWriteInput(_0x30b640){const _0x163944=a12_0x5a10;let _0x1fc627=(_0x30b640[_0x163944(0xd3)](_0x163944(0x91))||_0x30b640[_0x163944(0xd3)]('ak')||'')['trim']();const _0x434082=(_0x30b640[_0x163944(0xd3)](_0x163944(0x8a))||'')[_0x163944(0xbc)]();if(!_0x1fc627&&canPromptForAccessKey(_0x30b640))try{showAccessKeyCreateHint(),_0x1fc627=await promptAccessKey('');}catch(_0x286516){if(isAbortPrompt(_0x286516))throw CliErrors[_0x163944(0xba)]();throw _0x286516;}if(!_0x1fc627)throw CliErrors[_0x163944(0xa6)]('Missing\x20accessKey.',buildAccessKeySetupGuide());if(!ACCESS_KEY_PATTERN[_0x163944(0xb7)](_0x1fc627))throw CliErrors[_0x163944(0xa6)](_0x163944(0x7b)+_0x1fc627+'\x22','Expected:\x20ak_\x20followed\x20by\x2016+\x20alphanumeric\x20chars');if(!_0x434082)return{'accessKey':_0x1fc627};const _0x12d2f6=normalizeEnv(_0x434082);return{'accessKey':_0x1fc627,'env':isDaily(_0x12d2f6)?_0x163944(0xa2):isDev(_0x12d2f6)?_0x163944(0x8f):_0x163944(0x9c)};}export const authDefinitions=[{'service':'auth','command':a12_0x442dcb(0xbd),'description':a12_0x442dcb(0xb5),'risk':a12_0x442dcb(0xc0),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x442dcb(0x91),'type':a12_0x442dcb(0xa0),'description':a12_0x442dcb(0xbf)},{'name':'ak','type':'string','description':'Shorthand\x20for\x20--access-key'},{'name':'global','type':'boolean','description':a12_0x442dcb(0xb1),'default':!![]},{'name':'project','type':a12_0x442dcb(0xcf),'description':a12_0x442dcb(0x82),'default':![]}],async 'execute'(_0x5376e5){const _0x2a4da9=a12_0x442dcb;if(_0x5376e5[_0x2a4da9(0x7d)](_0x2a4da9(0x8d)))throw CliErrors[_0x2a4da9(0xa6)](_0x2a4da9(0x96),_0x2a4da9(0xd8)+CLI_BIN_NAME+_0x2a4da9(0xc6)+CLI_BIN_NAME+_0x2a4da9(0x7c));const _0xe28970=(_0x5376e5[_0x2a4da9(0xd3)](_0x2a4da9(0x91))||_0x5376e5['str']('ak')||'')[_0x2a4da9(0xbc)]();if(!_0xe28970&&_0x5376e5['nonInteractive'])return{'ok':!![],'message':buildAccessKeySetupGuide()};const _0x5cfa5b=await resolveAuthWriteInput(_0x5376e5),_0x298e98=resolveAuthScopeFlags(_0x5376e5),_0x22ee36=readScopedConfig(_0x298e98);_0x22ee36[_0x2a4da9(0x9a)]=_0x5cfa5b[_0x2a4da9(0x9a)];_0x5cfa5b[_0x2a4da9(0x8a)]&&(_0x22ee36[_0x2a4da9(0x8a)]=_0x5cfa5b['env']);writeScopedConfig(_0x22ee36,_0x298e98);const _0x2cfc3f=_0x298e98[_0x2a4da9(0x9d)]?_0x2a4da9(0x9d):_0x2a4da9(0x92),_0x254c42=_0x22ee36['env']?_0x2a4da9(0xaa)+_0x22ee36[_0x2a4da9(0x8a)]+'.':'';return{'ok':!![],'message':_0x2a4da9(0xc4)+_0x2cfc3f+_0x2a4da9(0xd5)+_0x254c42+_0x2a4da9(0xc2)+CLI_BIN_NAME+_0x2a4da9(0x9f)};}},{'service':a12_0x442dcb(0xb3),'command':'init','description':a12_0x442dcb(0xa5),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x442dcb(0x91),'type':'string','description':a12_0x442dcb(0xbf)},{'name':'ak','type':a12_0x442dcb(0xa0),'description':a12_0x442dcb(0x81)},{'name':'env','type':'string','description':a12_0x442dcb(0xc8)},{'name':a12_0x442dcb(0x9d),'type':'boolean','description':a12_0x442dcb(0xb1),'default':!![]},{'name':a12_0x442dcb(0x92),'type':'boolean','description':a12_0x442dcb(0x82),'default':![]}],async 'execute'(_0x4c41f7){const _0x5a6ed1=a12_0x442dcb,_0x2376ea=await resolveAuthWriteInput(_0x4c41f7),_0x5d93d4=resolveAuthScopeFlags(_0x4c41f7),_0x4b4666={'accessKey':_0x2376ea['accessKey']};_0x2376ea[_0x5a6ed1(0x8a)]&&(_0x4b4666[_0x5a6ed1(0x8a)]=_0x2376ea[_0x5a6ed1(0x8a)]);writeScopedConfig(_0x4b4666,_0x5d93d4);const _0x4bfb4e=_0x5d93d4[_0x5a6ed1(0x9d)]?_0x5a6ed1(0x9d):_0x5a6ed1(0x92),_0x402ebf=_0x4b4666[_0x5a6ed1(0x8a)]?_0x5a6ed1(0xaa)+_0x4b4666[_0x5a6ed1(0x8a)]+'.':'';return{'ok':!![],'message':_0x5a6ed1(0xcc)+_0x4bfb4e+_0x5a6ed1(0xad)+_0x402ebf+'\x20Verify:\x20'+CLI_BIN_NAME+_0x5a6ed1(0x9f)};}},{'service':a12_0x442dcb(0xb3),'command':'logout','description':a12_0x442dcb(0xd2),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x442dcb(0x9d),'type':a12_0x442dcb(0xcf),'description':a12_0x442dcb(0x8c),'default':!![]},{'name':a12_0x442dcb(0x92),'type':a12_0x442dcb(0xcf),'description':a12_0x442dcb(0xc9),'default':![]}],async 'execute'(_0x380a7f){const _0x113d9b=a12_0x442dcb,_0x196bec=resolveAuthScopeFlags(_0x380a7f),_0x3fb2de=readScopedConfig(_0x196bec),_0x25167c=!!_0x3fb2de['accessKey'];delete _0x3fb2de[_0x113d9b(0x9a)],writeScopedConfig(_0x3fb2de,_0x196bec);const _0x9d80e2=_0x196bec['global']?'global':_0x113d9b(0x92);if(_0x25167c)return{'ok':!![],'message':_0x113d9b(0x86)+_0x9d80e2+'\x20config.'};return{'ok':!![],'message':'No\x20AccessKey\x20found\x20in\x20'+_0x9d80e2+'\x20config.\x20Nothing\x20to\x20clear.'};}},{'service':a12_0x442dcb(0xb3),'command':a12_0x442dcb(0x8e),'description':a12_0x442dcb(0xac),'risk':a12_0x442dcb(0x8b),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x442dcb(0x9d),'type':a12_0x442dcb(0xcf),'description':'Read\x20from\x20global\x20config\x20(default)','default':!![]},{'name':a12_0x442dcb(0x92),'type':'boolean','description':'Read\x20from\x20project\x20config\x20instead\x20of\x20global\x20config','default':![]},{'name':a12_0x442dcb(0xa9),'type':a12_0x442dcb(0xcf),'description':a12_0x442dcb(0x93),'default':![]}],async 'execute'(_0x55a631){const _0x18cb5d=a12_0x442dcb,_0x373bd5=resolveAuthScopeFlags(_0x55a631),_0x55214a=readScopedConfig(_0x373bd5),_0x210d36=productEnvName(_0x18cb5d(0xcb)),_0x48e2bd=productEnv(_0x18cb5d(0xcb))||undefined,_0x3346db=_0x55214a[_0x18cb5d(0x9a)]||undefined,_0x48c6a0=_0x48e2bd||_0x3346db,_0x19eabe=_0x48e2bd?_0x210d36+'\x20env\x20var':_0x3346db?(_0x373bd5[_0x18cb5d(0x9d)]?_0x18cb5d(0x9d):_0x18cb5d(0x92))+_0x18cb5d(0xae):null,_0x2401e0=[_0x18cb5d(0xa4)+AUTH_MODE['ClientAk']];if(_0x48c6a0){const _0x4a53e4=_0x48c6a0[_0x18cb5d(0x9e)]>0x8?''+_0x48c6a0[_0x18cb5d(0xc7)](0x0,0x8)+'*'[_0x18cb5d(0x89)](_0x48c6a0['length']-0x8):_0x48c6a0;_0x2401e0[_0x18cb5d(0xbb)](_0x18cb5d(0xab)+_0x4a53e4+(_0x19eabe?_0x18cb5d(0x95)+_0x19eabe+')':'')),_0x2401e0['push']('Status:\x20valid');}if(!_0x48c6a0){_0x2401e0[_0x18cb5d(0xbb)](''),_0x2401e0['push'](_0x18cb5d(0x7e)),_0x2401e0[_0x18cb5d(0xbb)](''),_0x2401e0[_0x18cb5d(0xbb)]('Option\x20A:\x20'+CLI_BIN_NAME+_0x18cb5d(0xa3)),_0x2401e0['push'](''),_0x2401e0[_0x18cb5d(0xbb)]('Option\x20B:\x20apps\x20config\x20('+PRODUCT_CONFIG[_0x18cb5d(0xc5)]+')'),_0x2401e0[_0x18cb5d(0xbb)](_0x18cb5d(0xd0)),_0x2401e0['push'](''),_0x2401e0[_0x18cb5d(0xbb)](_0x18cb5d(0x97)),_0x2401e0['push'](_0x18cb5d(0xd7)+_0x210d36+_0x18cb5d(0xcd)),_0x2401e0[_0x18cb5d(0xbb)](''),_0x2401e0[_0x18cb5d(0xbb)](_0x18cb5d(0xc1)+CLI_BIN_NAME+_0x18cb5d(0x9f)),_0x2401e0['push'](_0x18cb5d(0xb9)+CLI_BIN_NAME+'\x20doctor');if(_0x55a631[_0x18cb5d(0x7d)](_0x18cb5d(0xa9))){const _0x426f99=readStoredDeviceCode();if(_0x426f99&&!isStoredDeviceCodeExpired(_0x426f99)){const _0x4cfe8a=getUserDomain(),_0xaeedb5=await fetchDeviceToken(_0x4cfe8a,_0x426f99['code']);if(_0xaeedb5[_0x18cb5d(0x8e)]===_0x18cb5d(0xb6)&&_0xaeedb5[_0x18cb5d(0xce)]){const _0x3c6cf9={'global':_0x426f99[_0x18cb5d(0x88)]===_0x18cb5d(0x9d)},_0x8da8c1=readScopedConfig(_0x3c6cf9);_0x8da8c1['accessKey']=_0xaeedb5['access_key'],writeScopedConfig(_0x8da8c1,_0x3c6cf9),deleteStoredDeviceCode();const _0x52345d=_0xaeedb5[_0x18cb5d(0xce)],_0x3b7d5d=_0x52345d[_0x18cb5d(0x9e)]>0x8?''+_0x52345d['slice'](0x0,0x8)+'*'[_0x18cb5d(0x89)](_0x52345d[_0x18cb5d(0x9e)]-0x8):_0x52345d,_0x4b7baa=_0x426f99[_0x18cb5d(0x88)]===_0x18cb5d(0x9d)?'global\x20config':_0x18cb5d(0x80);return{'ok':!![],'message':['Auth\x20mode:\x20'+AUTH_MODE['ClientAk'],'AccessKey:\x20'+_0x3b7d5d+_0x18cb5d(0x95)+_0x4b7baa+')',_0x18cb5d(0x83)]['join']('\x0a')};}_0xaeedb5['status']===_0x18cb5d(0xd4)&&deleteStoredDeviceCode();throw CliErrors[_0x18cb5d(0x94)](_0x18cb5d(0xa7));}throw CliErrors[_0x18cb5d(0x94)](_0x2401e0[_0x18cb5d(0x7f)]('\x0a'));}}return{'ok':!![],'message':_0x2401e0[_0x18cb5d(0x7f)]('\x0a')};}},{'service':'auth','command':a12_0x442dcb(0x98),'description':'Fetch\x20current\x20login\x20user\x20info\x20for\x20the\x20active\x20access\x20key','risk':a12_0x442dcb(0x8b),'requiresAuth':!![],'requiresAppCode':![],'hasFormat':!![],'flags':[],async 'execute'(_0x336a8b){const _0x4f70f2=a12_0x442dcb,_0x2c0e2c=await getLoginUserInfo();return{'ok':!![],'data':{'user':_0x2c0e2c,'meta':{'env':_0x336a8b[_0x4f70f2(0xa8)]??'production'}}};}},authDeviceDefinition];
|
|
1
|
+
const a12_0x337401=a12_0x6950;(function(_0x55a511,_0x2b73cc){const _0xe7d4e2=a12_0x6950,_0x4fb1aa=_0x55a511();while(!![]){try{const _0x4b55ff=parseInt(_0xe7d4e2(0x17a))/0x1*(-parseInt(_0xe7d4e2(0x142))/0x2)+-parseInt(_0xe7d4e2(0x129))/0x3*(-parseInt(_0xe7d4e2(0x162))/0x4)+-parseInt(_0xe7d4e2(0x180))/0x5+parseInt(_0xe7d4e2(0x16b))/0x6*(parseInt(_0xe7d4e2(0x156))/0x7)+parseInt(_0xe7d4e2(0x187))/0x8*(-parseInt(_0xe7d4e2(0x173))/0x9)+parseInt(_0xe7d4e2(0x141))/0xa*(parseInt(_0xe7d4e2(0x122))/0xb)+parseInt(_0xe7d4e2(0x152))/0xc*(parseInt(_0xe7d4e2(0x130))/0xd);if(_0x4b55ff===_0x2b73cc)break;else _0x4fb1aa['push'](_0x4fb1aa['shift']());}catch(_0x5059fc){_0x4fb1aa['push'](_0x4fb1aa['shift']());}}}(a12_0x1538,0xf24d8));import{readScopedConfig,writeScopedConfig}from'../../context.js';import{CLI_BIN_NAME}from'../../constant/cli.js';import{PRODUCT_CONFIG,productEnv,productEnvName}from'../../constant/product.js';import{AUTH_MODE}from'../../constant/auth-mode.js';import{normalizeEnv,isDaily,isDev}from'../../constant/env.js';function a12_0x1538(){const _0x40f432=['\x20scope.','8474460lbtoEe','Status:\x20valid','{\x20\x22accessKey\x22:\x20\x22ak_xxx\x22\x20}','login','6123593SHlNSb','validation','userCenterDisplayName','`auth\x20login`\x20does\x20not\x20support\x20--yes.','Clear\x20from\x20global\x20config\x20(default)','daily','Device\x20authorization\x20pending.\x20Complete\x20authorization\x20in\x20browser,\x20then\x20try\x20again.','write','join','Auth\x20mode:\x20','No\x20credentials\x20found.\x20Configure\x20one\x20of\x20the\x20options\x20below:','If\x20command\x20execution\x20still\x20fails,\x20run:\x20','12bErVfs','\x20Current\x20env:\x20','Give\x20the\x20AccessKey\x20to\x20your\x20AI\x20Agent,\x20then\x20run:\x20','AccessKey\x20(ak_xxx...)','No\x20AccessKey\x20found\x20in\x20','check','scope','AccessKey\x20saved\x20to\x20','AccessKey\x20required\x20for\x20login.\x20Create\x20one\x20in\x20','12rAzKnS','Write\x20to\x20project\x20config\x20instead\x20of\x20global\x20config','push','Option\x20A:\x20','Shorthand\x20for\x20--access-key','length','\x20config','=ak_xxx','9AwJxFv','boolean','envName','Option\x20C:\x20environment\x20variable','\x20(via\x20','ACCESS_KEY','Clear\x20accessKey\x20from\x20config','1421969jQfetK','Expected:\x20ak_\x20followed\x20by\x2016+\x20alphanumeric\x20chars','test','project\x20config','trim','\x20config.\x20Nothing\x20to\x20clear.','2206235zBIsmb','Write\x20to\x20global\x20config\x20(default)','\x20auth\x20status','Auth\x20config\x20reinitialized\x20in\x20','\x20auth\x20login\x20--access-key\x20<ak_xxx>\x20[--global]','Option\x20B:\x20apps\x20config\x20(','repeat','3538840PfCGRp','Invalid\x20accessKey\x20format:\x20\x22','string','\x20env\x20var','Fetch\x20current\x20login\x20user\x20info\x20for\x20the\x20active\x20access\x20key','\x20auth\x20login\x20--access-key\x20<ak_xxx>','360173qWacPr','Missing\x20accessKey.','yes','access_key','env','expired','Clear\x20from\x20project\x20config\x20instead\x20of\x20global\x20config','776754XBGAAd','info','production','Tip:\x20you\x20can\x20also\x20run:','logout','AccessKey:\x20','Exit\x20non-zero\x20when\x20no\x20AccessKey\x20is\x20configured','13XTjvEF','\x20Verify:\x20','Read\x20from\x20global\x20config\x20(default)','auth','development','bool','project','status','cancelled','slice','access-key','isTTY','Clear\x20all\x20config\x20in\x20scope\x20and\x20initialize\x20auth\x20from\x20scratch','Read\x20from\x20project\x20config\x20instead\x20of\x20global\x20config','init','nonInteractive','\x20auth\x20login\x20--access-key\x20<ak_xxx>`\x20to\x20save\x20credentials.','20faSLfI','2MNMKQN','accessKey','success','global','str','stdin','global\x20config','read','code','ClientAk','Show\x20current\x20authentication\x20status','stdout','\x20auth\x20login\x20[--global]\x20[--access-key\x20ak_xxx]','newConfigFileName','Then\x20verify\x20with:\x20'];a12_0x1538=function(){return _0x40f432;};return a12_0x1538();}import{USER_ACCESS_KEY_CREATE_URL}from'../../constant/url.js';import{CliErrors}from'../../errors.js';import{promptAccessKey,isAbortPrompt}from'../../commands/auth/prompt.js';import{resolveConfigScope,toScopeFlags}from'../../commands/common/config-policy.js';import{writeCliSideChannelLine}from'../../utils/write-cli-side-channel.js';import{getLoginUserInfo}from'../../core/api-client.js';function a12_0x6950(_0x1934b9,_0x13ac3d){_0x1934b9=_0x1934b9-0x121;const _0x15388b=a12_0x1538();let _0x6950ea=_0x15388b[_0x1934b9];return _0x6950ea;}import{getUserDomain}from'../../constant/domain.js';import{authDeviceDefinition,readStoredDeviceCode,deleteStoredDeviceCode,fetchDeviceToken,isStoredDeviceCodeExpired}from'../../commands/auth/device.js';const ACCESS_KEY_PATTERN=/^ak_[A-Za-z0-9]{16,}$/;function showAccessKeyCreateHint(){const _0x11f966=a12_0x6950;writeCliSideChannelLine(_0x11f966(0x16a)+PRODUCT_CONFIG['userCenterDisplayName']+':'),writeCliSideChannelLine('\x0a'+USER_ACCESS_KEY_CREATE_URL+'\x0a'),writeCliSideChannelLine(_0x11f966(0x12c)),writeCliSideChannelLine('\x20\x20'+CLI_BIN_NAME+_0x11f966(0x121));}function buildAccessKeySetupGuide(){const _0x5bc437=a12_0x6950;return['AccessKey\x20required\x20for\x20login.\x20Create\x20one\x20in\x20'+PRODUCT_CONFIG[_0x5bc437(0x158)]+':',USER_ACCESS_KEY_CREATE_URL,_0x5bc437(0x164)+CLI_BIN_NAME+_0x5bc437(0x184)][_0x5bc437(0x15e)]('\x0a');}function canPromptForAccessKey(_0x4a1fa6){const _0x2b4a13=a12_0x6950;return!_0x4a1fa6[_0x2b4a13(0x13f)]&&process[_0x2b4a13(0x147)][_0x2b4a13(0x13b)]!==![]&&process[_0x2b4a13(0x14d)][_0x2b4a13(0x13b)]!==![];}function resolveAuthScopeFlags(_0x333e90){const _0x4e94f9=a12_0x6950;return toScopeFlags(resolveConfigScope({'explicitGlobal':_0x333e90['bool'](_0x4e94f9(0x145)),'explicitProject':_0x333e90[_0x4e94f9(0x135)](_0x4e94f9(0x136)),'policy':'global-default'}));}async function resolveAuthWriteInput(_0x58498e){const _0x1b1ba5=a12_0x6950;let _0x36382c=(_0x58498e[_0x1b1ba5(0x146)]('access-key')||_0x58498e['str']('ak')||'')[_0x1b1ba5(0x17e)]();const _0x5ce02d=(_0x58498e[_0x1b1ba5(0x146)]('env')||'')[_0x1b1ba5(0x17e)]();if(!_0x36382c&&canPromptForAccessKey(_0x58498e))try{showAccessKeyCreateHint(),_0x36382c=await promptAccessKey('');}catch(_0x37b3ee){if(isAbortPrompt(_0x37b3ee))throw CliErrors[_0x1b1ba5(0x138)]();throw _0x37b3ee;}if(!_0x36382c)throw CliErrors[_0x1b1ba5(0x157)](_0x1b1ba5(0x123),buildAccessKeySetupGuide());if(!ACCESS_KEY_PATTERN[_0x1b1ba5(0x17c)](_0x36382c))throw CliErrors[_0x1b1ba5(0x157)](_0x1b1ba5(0x188)+_0x36382c+'\x22',_0x1b1ba5(0x17b));if(!_0x5ce02d)return{'accessKey':_0x36382c};const _0x1ae10d=normalizeEnv(_0x5ce02d);return{'accessKey':_0x36382c,'env':isDaily(_0x1ae10d)?_0x1b1ba5(0x15b):isDev(_0x1ae10d)?_0x1b1ba5(0x134):_0x1b1ba5(0x12b)};}export const authDefinitions=[{'service':a12_0x337401(0x133),'command':a12_0x337401(0x155),'description':'Save\x20accessKey\x20to\x20config\x20(global\x20by\x20default;\x20use\x20--project\x20for\x20project\x20config)','risk':a12_0x337401(0x15d),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':'access-key','type':'string','description':a12_0x337401(0x165)},{'name':'ak','type':a12_0x337401(0x189),'description':a12_0x337401(0x16f)},{'name':a12_0x337401(0x145),'type':a12_0x337401(0x174),'description':a12_0x337401(0x181),'default':!![]},{'name':a12_0x337401(0x136),'type':a12_0x337401(0x174),'description':'Write\x20to\x20project\x20config\x20instead\x20of\x20global\x20config','default':![]}],async 'execute'(_0x3ad73f){const _0x538fd1=a12_0x337401;if(_0x3ad73f[_0x538fd1(0x135)](_0x538fd1(0x124)))throw CliErrors[_0x538fd1(0x157)](_0x538fd1(0x159),'Use\x20`'+CLI_BIN_NAME+'\x20auth\x20login\x20--non-interactive`\x20to\x20avoid\x20prompts,\x20or\x20`'+CLI_BIN_NAME+_0x538fd1(0x140));const _0x2bafa4=(_0x3ad73f[_0x538fd1(0x146)](_0x538fd1(0x13a))||_0x3ad73f[_0x538fd1(0x146)]('ak')||'')['trim']();if(!_0x2bafa4&&_0x3ad73f['nonInteractive'])return{'ok':!![],'message':buildAccessKeySetupGuide()};const _0x42fbfa=await resolveAuthWriteInput(_0x3ad73f),_0x434913=resolveAuthScopeFlags(_0x3ad73f),_0x212d99=readScopedConfig(_0x434913);_0x212d99[_0x538fd1(0x143)]=_0x42fbfa['accessKey'];_0x42fbfa[_0x538fd1(0x126)]&&(_0x212d99[_0x538fd1(0x126)]=_0x42fbfa[_0x538fd1(0x126)]);writeScopedConfig(_0x212d99,_0x434913);const _0x53e020=_0x434913[_0x538fd1(0x145)]?_0x538fd1(0x145):_0x538fd1(0x136),_0x2860ba=_0x212d99[_0x538fd1(0x126)]?_0x538fd1(0x163)+_0x212d99[_0x538fd1(0x126)]+'.':'';return{'ok':!![],'message':_0x538fd1(0x169)+_0x53e020+'\x20config.'+_0x2860ba+_0x538fd1(0x131)+CLI_BIN_NAME+_0x538fd1(0x182)};}},{'service':a12_0x337401(0x133),'command':a12_0x337401(0x13e),'description':a12_0x337401(0x13c),'risk':'write','requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x337401(0x13a),'type':a12_0x337401(0x189),'description':a12_0x337401(0x165)},{'name':'ak','type':a12_0x337401(0x189),'description':a12_0x337401(0x16f)},{'name':'env','type':a12_0x337401(0x189),'description':'Target\x20environment\x20to\x20persist\x20with\x20the\x20new\x20auth\x20config'},{'name':'global','type':a12_0x337401(0x174),'description':'Write\x20to\x20global\x20config\x20(default)','default':!![]},{'name':a12_0x337401(0x136),'type':'boolean','description':a12_0x337401(0x16c),'default':![]}],async 'execute'(_0x121ee3){const _0x45b8ac=a12_0x337401,_0x2f4d60=await resolveAuthWriteInput(_0x121ee3),_0x2b454c=resolveAuthScopeFlags(_0x121ee3),_0x1c883b={'accessKey':_0x2f4d60[_0x45b8ac(0x143)]};_0x2f4d60[_0x45b8ac(0x126)]&&(_0x1c883b[_0x45b8ac(0x126)]=_0x2f4d60[_0x45b8ac(0x126)]);writeScopedConfig(_0x1c883b,_0x2b454c);const _0x493a3a=_0x2b454c[_0x45b8ac(0x145)]?_0x45b8ac(0x145):_0x45b8ac(0x136),_0x39ff05=_0x1c883b['env']?_0x45b8ac(0x163)+_0x1c883b[_0x45b8ac(0x126)]+'.':'';return{'ok':!![],'message':_0x45b8ac(0x183)+_0x493a3a+_0x45b8ac(0x151)+_0x39ff05+_0x45b8ac(0x131)+CLI_BIN_NAME+'\x20auth\x20status'};}},{'service':a12_0x337401(0x133),'command':a12_0x337401(0x12d),'description':a12_0x337401(0x179),'risk':a12_0x337401(0x15d),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x337401(0x145),'type':a12_0x337401(0x174),'description':a12_0x337401(0x15a),'default':!![]},{'name':a12_0x337401(0x136),'type':a12_0x337401(0x174),'description':a12_0x337401(0x128),'default':![]}],async 'execute'(_0x29fdd3){const _0x30517b=a12_0x337401,_0x38d7fe=resolveAuthScopeFlags(_0x29fdd3),_0x2d3f4b=readScopedConfig(_0x38d7fe),_0x1cacb8=!!_0x2d3f4b[_0x30517b(0x143)];delete _0x2d3f4b[_0x30517b(0x143)],writeScopedConfig(_0x2d3f4b,_0x38d7fe);const _0x2d5152=_0x38d7fe[_0x30517b(0x145)]?_0x30517b(0x145):'project';if(_0x1cacb8)return{'ok':!![],'message':'AccessKey\x20cleared\x20from\x20'+_0x2d5152+'\x20config.'};return{'ok':!![],'message':_0x30517b(0x166)+_0x2d5152+_0x30517b(0x17f)};}},{'service':a12_0x337401(0x133),'command':a12_0x337401(0x137),'description':a12_0x337401(0x14c),'risk':a12_0x337401(0x149),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[{'name':a12_0x337401(0x145),'type':a12_0x337401(0x174),'description':a12_0x337401(0x132),'default':!![]},{'name':a12_0x337401(0x136),'type':'boolean','description':a12_0x337401(0x13d),'default':![]},{'name':a12_0x337401(0x167),'type':a12_0x337401(0x174),'description':a12_0x337401(0x12f),'default':![]}],async 'execute'(_0x341ffa){const _0x35e710=a12_0x337401,_0x7079cb=resolveAuthScopeFlags(_0x341ffa),_0x255b03=readScopedConfig(_0x7079cb),_0x41c1c6=productEnvName(_0x35e710(0x178)),_0x40429d=productEnv(_0x35e710(0x178))||undefined,_0x2da227=_0x255b03[_0x35e710(0x143)]||undefined,_0x3d4a4d=_0x40429d||_0x2da227,_0x4cface=_0x40429d?_0x41c1c6+_0x35e710(0x18a):_0x2da227?(_0x7079cb['global']?_0x35e710(0x145):_0x35e710(0x136))+_0x35e710(0x171):null,_0x57ff60=['Auth\x20mode:\x20'+AUTH_MODE[_0x35e710(0x14b)]];if(_0x3d4a4d){const _0x494998=_0x3d4a4d[_0x35e710(0x170)]>0x8?''+_0x3d4a4d[_0x35e710(0x139)](0x0,0x8)+'*'['repeat'](_0x3d4a4d['length']-0x8):_0x3d4a4d;_0x57ff60[_0x35e710(0x16d)](_0x35e710(0x12e)+_0x494998+(_0x4cface?_0x35e710(0x177)+_0x4cface+')':'')),_0x57ff60[_0x35e710(0x16d)]('Status:\x20valid');}if(!_0x3d4a4d){_0x57ff60[_0x35e710(0x16d)](''),_0x57ff60['push'](_0x35e710(0x160)),_0x57ff60[_0x35e710(0x16d)](''),_0x57ff60['push'](_0x35e710(0x16e)+CLI_BIN_NAME+_0x35e710(0x14e)),_0x57ff60[_0x35e710(0x16d)](''),_0x57ff60[_0x35e710(0x16d)](_0x35e710(0x185)+PRODUCT_CONFIG[_0x35e710(0x14f)]+')'),_0x57ff60[_0x35e710(0x16d)](_0x35e710(0x154)),_0x57ff60[_0x35e710(0x16d)](''),_0x57ff60[_0x35e710(0x16d)](_0x35e710(0x176)),_0x57ff60[_0x35e710(0x16d)]('\x20\x20export\x20'+_0x41c1c6+_0x35e710(0x172)),_0x57ff60[_0x35e710(0x16d)](''),_0x57ff60['push'](_0x35e710(0x150)+CLI_BIN_NAME+_0x35e710(0x182)),_0x57ff60[_0x35e710(0x16d)](_0x35e710(0x161)+CLI_BIN_NAME+'\x20doctor');if(_0x341ffa['bool'](_0x35e710(0x167))){const _0x33c637=readStoredDeviceCode();if(_0x33c637&&!isStoredDeviceCodeExpired(_0x33c637)){const _0x543193=getUserDomain(),_0x557473=await fetchDeviceToken(_0x543193,_0x33c637[_0x35e710(0x14a)]);if(_0x557473[_0x35e710(0x137)]===_0x35e710(0x144)&&_0x557473[_0x35e710(0x125)]){const _0x207f12={'global':_0x33c637['scope']==='global'},_0x1e13e3=readScopedConfig(_0x207f12);_0x1e13e3[_0x35e710(0x143)]=_0x557473['access_key'],writeScopedConfig(_0x1e13e3,_0x207f12),deleteStoredDeviceCode();const _0xeedf79=_0x557473['access_key'],_0x320959=_0xeedf79[_0x35e710(0x170)]>0x8?''+_0xeedf79[_0x35e710(0x139)](0x0,0x8)+'*'[_0x35e710(0x186)](_0xeedf79[_0x35e710(0x170)]-0x8):_0xeedf79,_0x69122f=_0x33c637[_0x35e710(0x168)]===_0x35e710(0x145)?_0x35e710(0x148):_0x35e710(0x17d);return{'ok':!![],'message':[_0x35e710(0x15f)+AUTH_MODE['ClientAk'],_0x35e710(0x12e)+_0x320959+_0x35e710(0x177)+_0x69122f+')',_0x35e710(0x153)][_0x35e710(0x15e)]('\x0a')};}_0x557473['status']===_0x35e710(0x127)&&deleteStoredDeviceCode();throw CliErrors['authRequired'](_0x35e710(0x15c));}throw CliErrors['authRequired'](_0x57ff60[_0x35e710(0x15e)]('\x0a'));}}return{'ok':!![],'message':_0x57ff60['join']('\x0a')};}},{'service':'auth','command':a12_0x337401(0x12a),'description':a12_0x337401(0x18b),'risk':'read','requiresAuth':!![],'requiresAppCode':![],'hasFormat':!![],'flags':[],async 'execute'(_0xb1effd){const _0xbc21e5=a12_0x337401,_0x2d0235=await getLoginUserInfo();return{'ok':!![],'data':{'user':_0x2d0235,'meta':{'env':_0xb1effd[_0xbc21e5(0x175)]??_0xbc21e5(0x12b)}}};}},authDeviceDefinition];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Interactive prompt helpers for `auth` commands.
|
|
3
|
+
*
|
|
4
|
+
* Why a dedicated module: `auth/login` prompts for an AccessKey when not
|
|
5
|
+
* provided via flag, and both Ctrl+C and empty-input need careful handling.
|
|
6
|
+
* Sharing the prompt infrastructure here avoids duplicating the safe rl
|
|
7
|
+
* boilerplate across auth commands.
|
|
8
|
+
*
|
|
9
|
+
* Why `AbortPrompt` as a named class (not just a `throw "cancelled"` string):
|
|
10
|
+
* `isAbortPrompt()` can distinguish a user-initiated cancel from other errors
|
|
11
|
+
* by checking `err.name === "AbortPrompt"`, rather than string matching on
|
|
12
|
+
* the error message. This is more robust against future message changes.
|
|
13
|
+
*
|
|
14
|
+
* Why `Promise.race()` with `abortPromise` in every prompt: this ensures
|
|
15
|
+
* Ctrl+C is always detected regardless of whether the user types input.
|
|
16
|
+
* Without the race, the readline interface would swallow the SIGINT and the
|
|
17
|
+
* process would hang.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Prompts the user for an AccessKey using stdin.
|
|
21
|
+
*
|
|
22
|
+
* @param defaultVal - Pre-filled value shown in the prompt (returned if input is empty)
|
|
23
|
+
* @returns The user's input, trimmed; or `defaultVal` if the user pressed Enter without typing
|
|
24
|
+
* @throws `AbortPrompt` (via `Promise.race`) if the user presses Ctrl+C
|
|
25
|
+
*/
|
|
26
|
+
export declare function promptAccessKey(defaultVal?: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Checks whether an error originated from a user-initiated prompt cancellation.
|
|
29
|
+
*
|
|
30
|
+
* @param err - Any thrown value
|
|
31
|
+
* @returns `true` if `err` is an `AbortPrompt` thrown by `promptAccessKey`
|
|
32
|
+
*/
|
|
33
|
+
export declare function isAbortPrompt(err: unknown): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a13_0x384f(){const _0x5990ca=['995207pJrWkX','close','stdin','AccessKey\x20(paste\x20ak_...):\x20','SIGINT','removeListener','stdout','question','User\x20aborted\x20prompt','AbortPrompt','147964dsQbQD','2512314CIjzDw','race','3504690PQGBjH','168396GuOWBK','24HGjkTj','930fvyMBV','45mSZkKa','10573570zRTgRK','16295CmurXk','AccessKey\x20(','once','11mOkTZu'];a13_0x384f=function(){return _0x5990ca;};return a13_0x384f();}(function(_0xe61812,_0x335ad2){const _0x8725f=a13_0x205c,_0x498fa3=_0xe61812();while(!![]){try{const _0x6e54ee=parseInt(_0x8725f(0x1cc))/0x1+parseInt(_0x8725f(0x1c3))/0x2+-parseInt(_0x8725f(0x1c6))/0x3*(parseInt(_0x8725f(0x1bf))/0x4)+parseInt(_0x8725f(0x1c8))/0x5*(parseInt(_0x8725f(0x1c5))/0x6)+-parseInt(_0x8725f(0x1c2))/0x7+-parseInt(_0x8725f(0x1c4))/0x8*(parseInt(_0x8725f(0x1c0))/0x9)+-parseInt(_0x8725f(0x1c7))/0xa*(-parseInt(_0x8725f(0x1cb))/0xb);if(_0x6e54ee===_0x335ad2)break;else _0x498fa3['push'](_0x498fa3['shift']());}catch(_0x5e7f6f){_0x498fa3['push'](_0x498fa3['shift']());}}}(a13_0x384f,0xb6d86));import{createInterface}from'node:readline';function a13_0x205c(_0x84b5b0,_0x1c7112){_0x84b5b0=_0x84b5b0-0x1b7;const _0x384f5d=a13_0x384f();let _0x205cee=_0x384f5d[_0x84b5b0];return _0x205cee;}class AbortPrompt extends Error{constructor(){const _0x146092=a13_0x205c;super(_0x146092(0x1bd)),this['name']='AbortPrompt';}}function createSafeRl(){const _0x179f2d=a13_0x205c,_0x484549=createInterface({'input':process[_0x179f2d(0x1b7)],'output':process[_0x179f2d(0x1bb)]});let _0x153577;const _0x4e9c83=new Promise((_0x11aff9,_0x48f6f1)=>{const _0x2d282c=_0x179f2d;_0x153577=()=>{_0x153577&&(_0x484549['removeListener']('SIGINT',_0x153577),_0x153577=undefined);try{_0x484549['close']();}catch{}_0x48f6f1(new AbortPrompt());},_0x484549[_0x2d282c(0x1ca)](_0x2d282c(0x1b9),_0x153577);}),_0x499fa7=()=>{const _0x8742e6=_0x179f2d;_0x153577&&(_0x484549[_0x8742e6(0x1ba)](_0x8742e6(0x1b9),_0x153577),_0x153577=undefined);try{_0x484549[_0x8742e6(0x1cd)]();}catch{}};return{'rl':_0x484549,'abortPromise':_0x4e9c83,'disposeSuccess':_0x499fa7};}export async function promptAccessKey(_0x445df2=''){const _0x114096=a13_0x205c,{rl:_0x7a1c8d,abortPromise:_0x28ac5a,disposeSuccess:_0x34ebae}=createSafeRl(),_0x187d82=new Promise(_0x3be206=>{const _0x32ced5=a13_0x205c,_0x4a1ec4=_0x445df2?_0x32ced5(0x1c9)+_0x445df2+'):\x20':_0x32ced5(0x1b8);_0x7a1c8d[_0x32ced5(0x1bc)](_0x4a1ec4,_0x3925e4=>{_0x34ebae(),_0x3be206(_0x3925e4['trim']()||_0x445df2);});});return Promise[_0x114096(0x1c1)]([_0x187d82,_0x28ac5a]);}export function isAbortPrompt(_0x53ffbb){const _0x2f2495=a13_0x205c;return _0x53ffbb instanceof Error&&_0x53ffbb['name']===_0x2f2495(0x1be);}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `bff detail` command — inspects one known endpoint by function name.
|
|
3
|
+
*
|
|
4
|
+
* Runtime callers identify BFFs by appCode + functionName. Platform IDs and raw
|
|
5
|
+
* source metadata are intentionally not accepted or returned by this command.
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
8
|
+
export declare const bffDetail: CommandDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a14_0x3132(_0xa39690,_0x3aadc4){_0xa39690=_0xa39690-0xbf;const _0x3bf33b=a14_0x3bf3();let _0x31328e=_0x3bf33b[_0xa39690];return _0x31328e;}const a14_0x5eb271=a14_0x3132;(function(_0x42325b,_0x231be1){const _0x196ba1=a14_0x3132,_0x2a4753=_0x42325b();while(!![]){try{const _0x1cdcfc=parseInt(_0x196ba1(0xce))/0x1*(-parseInt(_0x196ba1(0xc9))/0x2)+-parseInt(_0x196ba1(0xc2))/0x3+parseInt(_0x196ba1(0xc3))/0x4*(-parseInt(_0x196ba1(0xd3))/0x5)+parseInt(_0x196ba1(0xcc))/0x6*(-parseInt(_0x196ba1(0xc7))/0x7)+-parseInt(_0x196ba1(0xbf))/0x8*(parseInt(_0x196ba1(0xc5))/0x9)+-parseInt(_0x196ba1(0xc1))/0xa+parseInt(_0x196ba1(0xcf))/0xb;if(_0x1cdcfc===_0x231be1)break;else _0x2a4753['push'](_0x2a4753['shift']());}catch(_0x50e8f1){_0x2a4753['push'](_0x2a4753['shift']());}}}(a14_0x3bf3,0xe14dd));import{getBffEndpointContract}from'../../core/api-client.js';import{NAME_FLAG}from'../../commands/common/flags.js';function a14_0x3bf3(){const _0xe23508=['description','1026auROmM','(none)','35VuYpgP','77502194KsTjbO','bff','version','functionName','202780NfWVPZ','name','458536ShDAnt','BFF\x20function\x20name','6977620tLXdQc','216954LPIrAv','140uCSyUT','gmtModified','279CPqImP','read','66479nRzKBW','appCode','30426jFlBfE','Get\x20a\x20BFF\x20endpoint\x20contract\x20by\x20function\x20name'];a14_0x3bf3=function(){return _0xe23508;};return a14_0x3bf3();}export const bffDetail={'service':a14_0x5eb271(0xd0),'command':'detail','description':a14_0x5eb271(0xca),'risk':a14_0x5eb271(0xc6),'flags':[{...NAME_FLAG,'required':!![],'description':a14_0x5eb271(0xc0)}],async 'execute'(_0x200a8c){const _0xcd036d=a14_0x5eb271,_0x2d05fb=await getBffEndpointContract(_0x200a8c[_0xcd036d(0xc8)],_0x200a8c['str'](_0xcd036d(0xd4)));return{'ok':!![],'data':{'appCode':_0x2d05fb[_0xcd036d(0xc8)],'functionName':_0x2d05fb[_0xcd036d(0xd2)],'description':_0x2d05fb[_0xcd036d(0xcb)]||_0xcd036d(0xcd),'version':_0x2d05fb[_0xcd036d(0xd1)],'gmtModified':_0x2d05fb[_0xcd036d(0xc4)]}};}};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `bff exec` command — executes a BFF script by function name.
|
|
3
|
+
*
|
|
4
|
+
* Why `risk: "read"`: BFF script execution is a runtime query. Whether the
|
|
5
|
+
* script reads or writes data is determined by the script itself; the CLI
|
|
6
|
+
* cannot know ahead of time. Using `"read"` avoids prompting for `--yes`
|
|
7
|
+
* on every invocation. If the script performs writes, its Studio definition
|
|
8
|
+
* governs those actions.
|
|
9
|
+
*
|
|
10
|
+
* Why `risk: "read"` rather than `"write"`: scripts that only read are the
|
|
11
|
+
* common case. Requiring `--yes` for all executions would be too intrusive.
|
|
12
|
+
* Scripts that perform high-risk operations are controlled at the Studio
|
|
13
|
+
* permission level, not at the CLI invocation level.
|
|
14
|
+
*
|
|
15
|
+
* Design decision: timing is reported back to the user (`elapsed` in ms).
|
|
16
|
+
* This helps developers tune performance without requiring verbose flags.
|
|
17
|
+
*/
|
|
18
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
19
|
+
export declare const bffExec: CommandDefinition;
|
package/lib/commands/bff/exec.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a15_0x294f(){const _0x355c01=['95155cBWcYb','exec','90xpPBBT','4175048NzwkNN','11jXYryk','28kNCoUA','bff','Execute\x20a\x20BFF\x20script\x20by\x20function\x20name','18ZEYhHv','11516664fBUJzb','BFF\x20function\x20name\x20to\x20execute','13wCZWXE','read','11081gXmngV','str','3018IOZXhX','27312KOmIMe','161705ghDuYE','now','11274210TGBRJV'];a15_0x294f=function(){return _0x355c01;};return a15_0x294f();}const a15_0x46e87c=a15_0x8b6e;function a15_0x8b6e(_0x47dd52,_0x599dcf){_0x47dd52=_0x47dd52-0xca;const _0x294f50=a15_0x294f();let _0x8b6e08=_0x294f50[_0x47dd52];return _0x8b6e08;}(function(_0x224228,_0x3f198f){const _0x19524f=a15_0x8b6e,_0x27a93a=_0x224228();while(!![]){try{const _0x4475f=-parseInt(_0x19524f(0xda))/0x1+parseInt(_0x19524f(0xcb))/0x2*(parseInt(_0x19524f(0xd9))/0x3)+parseInt(_0x19524f(0xce))/0x4*(parseInt(_0x19524f(0xdd))/0x5)+-parseInt(_0x19524f(0xd8))/0x6*(parseInt(_0x19524f(0xd6))/0x7)+-parseInt(_0x19524f(0xcc))/0x8*(parseInt(_0x19524f(0xd1))/0x9)+parseInt(_0x19524f(0xdc))/0xa*(parseInt(_0x19524f(0xcd))/0xb)+parseInt(_0x19524f(0xd2))/0xc*(parseInt(_0x19524f(0xd4))/0xd);if(_0x4475f===_0x3f198f)break;else _0x27a93a['push'](_0x27a93a['shift']());}catch(_0x189692){_0x27a93a['push'](_0x27a93a['shift']());}}}(a15_0x294f,0x99664));import{executeSdkBff}from'../../core/sdk-client.js';import{parseJsonParams}from'../../utils/params.js';import{NAME_FLAG,PARAMS_FLAG}from'../../commands/common/flags.js';export const bffExec={'service':a15_0x46e87c(0xcf),'command':a15_0x46e87c(0xca),'description':a15_0x46e87c(0xd0),'risk':a15_0x46e87c(0xd5),'flags':[{...NAME_FLAG,'required':!![],'description':a15_0x46e87c(0xd3)},PARAMS_FLAG],async 'execute'(_0xcb90d6){const _0x212b4f=a15_0x46e87c,_0x3061cd=parseJsonParams(_0xcb90d6[_0x212b4f(0xd7)]('params')),_0x31c32f=Date[_0x212b4f(0xdb)](),_0x2a38b6=await executeSdkBff(_0xcb90d6['str']('name'),_0x3061cd),_0x2f684b=Date[_0x212b4f(0xdb)]()-_0x31c32f;return{'ok':!![],'data':{'result':_0x2a38b6,'elapsed':_0x2f684b},'message':'BFF\x20executed\x20in\x20'+_0x2f684b+'ms'};}};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `bff` command group — exports the declarative definition list.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists: the framework registry (`registry.ts`) imports
|
|
5
|
+
* `bffDefinitions` directly. The actual command definitions are split into
|
|
6
|
+
* `exec.ts` (run) and `detail.ts` (inspect) to keep each file focused.
|
|
7
|
+
* This index re-exports them as a single array for registration.
|
|
8
|
+
*
|
|
9
|
+
* Why only exec + detail (no list/save): Lovrabet Runtime CLI targets
|
|
10
|
+
* the runtime environment where scripts are managed in the Studio UI.
|
|
11
|
+
* The CLI provides execution and inspection, not script lifecycle management.
|
|
12
|
+
* List/save belong to the development CLI (`rabetbase`).
|
|
13
|
+
*/
|
|
14
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
15
|
+
export declare const bffDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xe64938,_0x3163ad){const _0x16c8f4=a16_0xcfcc,_0x305f9a=_0xe64938();while(!![]){try{const _0x13ecf0=parseInt(_0x16c8f4(0x19d))/0x1*(-parseInt(_0x16c8f4(0x19c))/0x2)+-parseInt(_0x16c8f4(0x196))/0x3+parseInt(_0x16c8f4(0x19b))/0x4+parseInt(_0x16c8f4(0x199))/0x5+parseInt(_0x16c8f4(0x198))/0x6+-parseInt(_0x16c8f4(0x19a))/0x7+parseInt(_0x16c8f4(0x197))/0x8;if(_0x13ecf0===_0x3163ad)break;else _0x305f9a['push'](_0x305f9a['shift']());}catch(_0x2a3ddf){_0x305f9a['push'](_0x305f9a['shift']());}}}(a16_0x1895,0x9afbb));function a16_0xcfcc(_0x88ec15,_0x4bf575){_0x88ec15=_0x88ec15-0x196;const _0x189556=a16_0x1895();let _0xcfccad=_0x189556[_0x88ec15];return _0xcfccad;}import{bffDetail}from'../../commands/bff/detail.js';import{bffExec}from'../../commands/bff/exec.js';function a16_0x1895(){const _0x7d910b=['595750XAWCHz','3732827ZakoxL','2353844DrSHYi','209176TrpOMC','11YuSdbo','1518090ZcupyZ','15072312JsRSBu','1397520ezyIgi'];a16_0x1895=function(){return _0x7d910b;};return a16_0x1895();}export const bffDefinitions=[bffDetail,bffExec];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `cli-skill` command definitions.
|
|
3
|
+
*
|
|
4
|
+
* CLI Built-in Skill is the Skill package required by the Lovrabet CLI runtime
|
|
5
|
+
* itself. It is separate from business Skills managed by `lovrabet skill`.
|
|
6
|
+
*/
|
|
7
|
+
import type { CommandDefinition } from "../../framework/types.js";
|
|
8
|
+
/** Declarative definitions for the `cli-skill` service. */
|
|
9
|
+
export declare const cliSkillDefinitions: CommandDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a17_0x58f123=a17_0x5f56;(function(_0x213cc3,_0x28bebb){const _0x61f474=a17_0x5f56,_0x47434d=_0x213cc3();while(!![]){try{const _0x5a932c=-parseInt(_0x61f474(0x1da))/0x1+parseInt(_0x61f474(0x1d6))/0x2+parseInt(_0x61f474(0x1e0))/0x3*(-parseInt(_0x61f474(0x1c9))/0x4)+-parseInt(_0x61f474(0x1de))/0x5*(-parseInt(_0x61f474(0x1c5))/0x6)+parseInt(_0x61f474(0x1cc))/0x7+parseInt(_0x61f474(0x1d1))/0x8+parseInt(_0x61f474(0x1e3))/0x9*(-parseInt(_0x61f474(0x1e1))/0xa);if(_0x5a932c===_0x28bebb)break;else _0x47434d['push'](_0x47434d['shift']());}catch(_0x613ae8){_0x47434d['push'](_0x47434d['shift']());}}}(a17_0x1c30,0x453bb));function a17_0x1c30(){const _0x2f8079=['../../skills/npx-skills-add.js','cli-skill-install','Installing\x20CLI\x20Built-in\x20Skill\x20via\x20npx\x20(npx\x20skills\x20add\x20','505336nQaCvF','Install\x20the\x20CLI\x20Built-in\x20Skill\x20required\x20by\x20Lovrabet\x20runtime','=1);\x20assuming\x20CLI\x20Built-in\x20Skill\x20is\x20already\x20present.','log','CLI\x20Built-in\x20Skill\x20installed','1008078HCAQxJ','install','Installing\x20CLI\x20Built-in\x20Skill\x20via\x20npx.','\x20-g\x20-y)...','174928UKDFxh','error','info','npx\x20skills\x20add\x20failed:\x20','55915OxTBmk','Skipped\x20npx\x20(','595677gTxNPe','10bHlYxI','Check\x20network\x20connectivity\x20and\x20try\x20again,\x20or\x20run:\x20npx\x20skills\x20add\x20','93033gMxGxp','cwd','cli-skill','12VIibPg','apiError','unknown','write','4kbTAOy','setLogPath','nonInteractive','544817fubDwz','skipped'];a17_0x1c30=function(){return _0x2f8079;};return a17_0x1c30();}function a17_0x5f56(_0xfb0588,_0x39f2ef){_0xfb0588=_0xfb0588-0x1c4;const _0x1c309c=a17_0x1c30();let _0x5f560d=_0x1c309c[_0xfb0588];return _0x5f560d;}import{CliErrors}from'../../errors.js';import{logger}from'../../utils/logger.js';export const cliSkillDefinitions=[{'service':a17_0x58f123(0x1c4),'command':a17_0x58f123(0x1d7),'description':a17_0x58f123(0x1d2),'risk':a17_0x58f123(0x1c8),'requiresAuth':![],'requiresAppCode':![],'hasFormat':![],'flags':[],async 'execute'(_0x211f09){const _0x34583d=a17_0x58f123;logger[_0x34583d(0x1ca)](process[_0x34583d(0x1e4)]()),logger[_0x34583d(0x1dc)](_0x34583d(0x1cf),_0x34583d(0x1d8));const {LOVRABET_SKILL_SOURCE:_0x5d4948,LOVRABET_SKIP_NPX_SKILLS_ENV:_0x385a19,runNpxSkillsAddGlobal:_0x4ee177}=await import(_0x34583d(0x1ce)),_0x190cee=_0x211f09[_0x34583d(0x1cb)]?'pipe':'inherit';console[_0x34583d(0x1d4)](_0x34583d(0x1d0)+_0x5d4948+_0x34583d(0x1d9));const _0x273d74=_0x4ee177(process[_0x34583d(0x1e4)](),_0x5d4948,{'stdio':_0x190cee});if(_0x273d74[_0x34583d(0x1cd)])console[_0x34583d(0x1d4)](_0x34583d(0x1df)+_0x385a19+_0x34583d(0x1d3));else{if(_0x273d74['ok'])console['log'](_0x34583d(0x1d5));else throw CliErrors[_0x34583d(0x1c6)](_0x34583d(0x1dd)+(_0x273d74[_0x34583d(0x1db)]||_0x34583d(0x1c7)),_0x34583d(0x1e2)+_0x5d4948+'\x20-g\x20-y');}return{'ok':!![]};}}];
|