lua-cli 3.5.0-alpha.3 → 3.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -689
- package/dist/api/agent.api.service.d.ts +1 -8
- package/dist/api/agent.api.service.js +1 -11
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/auth.api.service.d.ts +1 -1
- package/dist/api/auth.api.service.js +1 -1
- package/dist/api/auth.api.service.js.map +1 -1
- package/dist/api/backup.api.service.d.ts +80 -0
- package/dist/api/backup.api.service.js +101 -0
- package/dist/api/backup.api.service.js.map +1 -0
- package/dist/api/basket.api.service.d.ts +4 -5
- package/dist/api/basket.api.service.js +13 -18
- package/dist/api/basket.api.service.js.map +1 -1
- package/dist/api/cdn.api.service.d.ts +2 -0
- package/dist/api/cdn.api.service.js +2 -0
- package/dist/api/cdn.api.service.js.map +1 -1
- package/dist/api/chat.api.service.d.ts +10 -2
- package/dist/api/chat.api.service.js +21 -2
- package/dist/api/chat.api.service.js.map +1 -1
- package/dist/api/credentials.js +5 -8
- package/dist/api/credentials.js.map +1 -1
- package/dist/api/custom.data.api.service.d.ts +3 -3
- package/dist/api/custom.data.api.service.js +9 -10
- package/dist/api/custom.data.api.service.js.map +1 -1
- package/dist/api/developer.api.service.d.ts +1 -1
- package/dist/api/developer.api.service.js +1 -1
- package/dist/api/developer.api.service.js.map +1 -1
- package/dist/api/http.client.js.map +1 -0
- package/dist/api/job.api.service.d.ts +2 -2
- package/dist/api/job.api.service.js +2 -2
- package/dist/api/job.api.service.js.map +1 -1
- package/dist/api/logs.api.service.d.ts +1 -1
- package/dist/api/logs.api.service.js +1 -1
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/api/marketplace.api.service.d.ts +6 -6
- package/dist/api/marketplace.api.service.js.map +1 -1
- package/dist/api/order.api.service.d.ts +3 -4
- package/dist/api/order.api.service.js +8 -10
- package/dist/api/order.api.service.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +1 -1
- package/dist/api/persona.api.service.js +1 -1
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +1 -1
- package/dist/api/postprocessor.api.service.js +1 -1
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +1 -1
- package/dist/api/preprocessor.api.service.js +1 -1
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api/products.api.service.d.ts +4 -4
- package/dist/api/products.api.service.js +6 -6
- package/dist/api/products.api.service.js.map +1 -1
- package/dist/api/resource.api.service.d.ts +76 -0
- package/dist/api/resource.api.service.js +74 -0
- package/dist/api/resource.api.service.js.map +1 -0
- package/dist/api/skills.api.service.d.ts +7 -15
- package/dist/api/skills.api.service.js +1 -1
- package/dist/api/skills.api.service.js.map +1 -1
- package/dist/api/tool.api.service.d.ts +1 -1
- package/dist/api/tool.api.service.js +1 -1
- package/dist/api/tool.api.service.js.map +1 -1
- package/dist/api/unifiedto.api.service.d.ts +1 -1
- package/dist/api/unifiedto.api.service.js +1 -1
- package/dist/api/unifiedto.api.service.js.map +1 -1
- package/dist/api/user.data.api.service.d.ts +7 -8
- package/dist/api/user.data.api.service.js +2 -3
- package/dist/api/user.data.api.service.js.map +1 -1
- package/dist/api/webhook.api.service.d.ts +1 -1
- package/dist/api/webhook.api.service.js +1 -1
- package/dist/api/webhook.api.service.js.map +1 -1
- package/dist/api/whatsapp-templates.api.service.d.ts +1 -1
- package/dist/api/whatsapp-templates.api.service.js +1 -1
- package/dist/api/whatsapp-templates.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +14 -12
- package/dist/api-exports.js +8 -8
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.js +32 -17
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/admin.js +3 -24
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/agents.d.ts +8 -7
- package/dist/commands/agents.js +63 -21
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channels.js +11 -23
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.js +33 -47
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/chatClear.js +11 -41
- package/dist/commands/chatClear.js.map +1 -1
- package/dist/commands/compile.d.ts +26 -23
- package/dist/commands/compile.js +98 -403
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.js +1 -1
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deploy.js +55 -25
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +29 -45
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/env.js +12 -25
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/evals.js +3 -20
- package/dist/commands/evals.js.map +1 -1
- package/dist/commands/features.js +10 -23
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +135 -19
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.js +26 -37
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.js +32 -56
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/logs.js +9 -20
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.js +34 -52
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.js +10 -23
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/persona.js +43 -74
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.js +15 -28
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.js +15 -28
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.js +30 -63
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.js +294 -1241
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts +22 -0
- package/dist/commands/pushBackup.js +133 -0
- package/dist/commands/pushBackup.js.map +1 -0
- package/dist/commands/resources.js +29 -72
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.js +58 -70
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts +1 -3
- package/dist/commands/sync.js +12 -24
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.js +135 -104
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.js +15 -28
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +104 -0
- package/dist/compiler/agent-traverser.js +311 -0
- package/dist/compiler/agent-traverser.js.map +1 -0
- package/dist/compiler/bundler.d.ts +42 -0
- package/dist/compiler/bundler.js +187 -0
- package/dist/compiler/bundler.js.map +1 -0
- package/dist/compiler/compiler.d.ts +177 -0
- package/dist/compiler/compiler.js +580 -0
- package/dist/compiler/compiler.js.map +1 -0
- package/dist/compiler/index.d.ts +36 -0
- package/dist/compiler/index.js +42 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/plugins/base.d.ts +264 -0
- package/dist/compiler/plugins/base.js +307 -0
- package/dist/compiler/plugins/base.js.map +1 -0
- package/dist/compiler/plugins/job.plugin.d.ts +33 -0
- package/dist/compiler/plugins/job.plugin.js +143 -0
- package/dist/compiler/plugins/job.plugin.js.map +1 -0
- package/dist/compiler/plugins/mcp-server.plugin.d.ts +50 -0
- package/dist/compiler/plugins/mcp-server.plugin.js +186 -0
- package/dist/compiler/plugins/mcp-server.plugin.js.map +1 -0
- package/dist/compiler/plugins/postprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/postprocessor.plugin.js +39 -0
- package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/preprocessor.plugin.d.ts +20 -0
- package/dist/compiler/plugins/preprocessor.plugin.js +48 -0
- package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -0
- package/dist/compiler/plugins/processor-base.d.ts +16 -0
- package/dist/compiler/plugins/processor-base.js +34 -0
- package/dist/compiler/plugins/processor-base.js.map +1 -0
- package/dist/compiler/plugins/registry.d.ts +61 -0
- package/dist/compiler/plugins/registry.js +107 -0
- package/dist/compiler/plugins/registry.js.map +1 -0
- package/dist/compiler/plugins/skill.plugin.d.ts +71 -0
- package/dist/compiler/plugins/skill.plugin.js +243 -0
- package/dist/compiler/plugins/skill.plugin.js.map +1 -0
- package/dist/compiler/plugins/tool.plugin.d.ts +67 -0
- package/dist/compiler/plugins/tool.plugin.js +279 -0
- package/dist/compiler/plugins/tool.plugin.js.map +1 -0
- package/dist/compiler/plugins/webhook.plugin.d.ts +37 -0
- package/dist/compiler/plugins/webhook.plugin.js +127 -0
- package/dist/compiler/plugins/webhook.plugin.js.map +1 -0
- package/dist/compiler/source-writer.d.ts +98 -0
- package/dist/compiler/source-writer.js +223 -0
- package/dist/compiler/source-writer.js.map +1 -0
- package/dist/compiler/types.d.ts +289 -0
- package/dist/compiler/types.js +20 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/compiler/utils/ast-helpers.d.ts +57 -0
- package/dist/compiler/utils/ast-helpers.js +164 -0
- package/dist/compiler/utils/ast-helpers.js.map +1 -0
- package/dist/compiler/utils/common.d.ts +23 -0
- package/dist/compiler/utils/common.js +66 -0
- package/dist/compiler/utils/common.js.map +1 -0
- package/dist/compiler/utils/file-discovery.d.ts +34 -0
- package/dist/compiler/utils/file-discovery.js +68 -0
- package/dist/compiler/utils/file-discovery.js.map +1 -0
- package/dist/compiler/utils/path-resolver.d.ts +25 -0
- package/dist/compiler/utils/path-resolver.js +66 -0
- package/dist/compiler/utils/path-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +26 -0
- package/dist/compiler/utils/schema-converter.js +94 -0
- package/dist/compiler/utils/schema-converter.js.map +1 -0
- package/dist/config/compile.constants.d.ts +2 -22
- package/dist/config/compile.constants.js +2 -49
- package/dist/config/compile.constants.js.map +1 -1
- package/dist/config/constants.d.ts +18 -2
- package/dist/config/constants.js +28 -8
- package/dist/config/constants.js.map +1 -1
- package/dist/config/dev.constants.d.ts +0 -10
- package/dist/config/dev.constants.js +0 -10
- package/dist/config/dev.constants.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/instances/basket.instance.js.map +1 -0
- package/dist/instances/data.entry.instance.js.map +1 -0
- package/dist/instances/job.instance.js.map +1 -0
- package/dist/instances/order.instance.js.map +1 -0
- package/dist/instances/product.instance.js.map +1 -0
- package/dist/instances/product.pagination.instance.js.map +1 -0
- package/dist/instances/product.search.instance.js.map +1 -0
- package/dist/instances/user.instance.js.map +1 -0
- package/dist/interfaces/admin.d.ts +0 -38
- package/dist/interfaces/backup.d.ts +125 -0
- package/dist/interfaces/backup.js +8 -0
- package/dist/interfaces/backup.js.map +1 -0
- package/dist/interfaces/baskets.d.ts +0 -56
- package/dist/interfaces/common.d.ts +1 -0
- package/dist/interfaces/deploy.d.ts +0 -15
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/marketplace.d.ts +51 -0
- package/dist/interfaces/marketplace.js +1 -1
- package/dist/interfaces/marketplace.js.map +1 -1
- package/dist/interfaces/message.d.ts +0 -3
- package/dist/interfaces/orders.d.ts +0 -24
- package/dist/interfaces/postprocessors.d.ts +0 -18
- package/dist/interfaces/preprocessors.d.ts +0 -18
- package/dist/interfaces/skills.d.ts +61 -0
- package/dist/interfaces/user.d.ts +25 -0
- package/dist/interfaces/webhooks.d.ts +0 -9
- package/dist/primitives/base.handler.d.ts +106 -0
- package/dist/primitives/base.handler.js +370 -0
- package/dist/primitives/base.handler.js.map +1 -0
- package/dist/primitives/index.d.ts +47 -0
- package/dist/primitives/index.js +78 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/job.handler.d.ts +52 -0
- package/dist/primitives/job.handler.js +118 -0
- package/dist/primitives/job.handler.js.map +1 -0
- package/dist/primitives/mcp-server.handler.d.ts +54 -0
- package/dist/primitives/mcp-server.handler.js +91 -0
- package/dist/primitives/mcp-server.handler.js.map +1 -0
- package/dist/primitives/postprocessor.handler.d.ts +49 -0
- package/dist/primitives/postprocessor.handler.js +81 -0
- package/dist/primitives/postprocessor.handler.js.map +1 -0
- package/dist/primitives/preprocessor.handler.d.ts +54 -0
- package/dist/primitives/preprocessor.handler.js +95 -0
- package/dist/primitives/preprocessor.handler.js.map +1 -0
- package/dist/primitives/skill.handler.d.ts +44 -0
- package/dist/primitives/skill.handler.js +192 -0
- package/dist/primitives/skill.handler.js.map +1 -0
- package/dist/primitives/types.d.ts +72 -0
- package/dist/primitives/types.js +17 -0
- package/dist/primitives/types.js.map +1 -0
- package/dist/primitives/webhook.handler.d.ts +50 -0
- package/dist/primitives/webhook.handler.js +96 -0
- package/dist/primitives/webhook.handler.js.map +1 -0
- package/dist/services/auth.js +1 -2
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts +103 -0
- package/dist/services/sandbox.service.js +479 -0
- package/dist/services/sandbox.service.js.map +1 -0
- package/dist/types/api-contracts.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/skill.d.ts +8 -2
- package/dist/types/skill.js +8 -0
- package/dist/types/skill.js.map +1 -1
- package/dist/types/yaml.types.d.ts +69 -0
- package/dist/types/yaml.types.js +6 -0
- package/dist/types/yaml.types.js.map +1 -0
- package/dist/utils/artifact-loader.d.ts +108 -0
- package/dist/utils/artifact-loader.js +188 -0
- package/dist/utils/artifact-loader.js.map +1 -0
- package/dist/utils/backup-helpers.d.ts +122 -0
- package/dist/utils/backup-helpers.js +274 -0
- package/dist/utils/backup-helpers.js.map +1 -0
- package/dist/utils/cli.d.ts +8 -0
- package/dist/utils/cli.js +19 -2
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/command-utils.d.ts +42 -0
- package/dist/utils/command-utils.js +83 -0
- package/dist/utils/command-utils.js.map +1 -0
- package/dist/utils/deploy-helpers.d.ts +0 -29
- package/dist/utils/deploy-helpers.js +0 -70
- package/dist/utils/deploy-helpers.js.map +1 -1
- package/dist/utils/dev-api.d.ts +3 -99
- package/dist/utils/dev-api.js +3 -430
- package/dist/utils/dev-api.js.map +1 -1
- package/dist/utils/dev-server.d.ts +3 -1
- package/dist/utils/dev-server.js +69 -145
- package/dist/utils/dev-server.js.map +1 -1
- package/dist/utils/dev-watcher.d.ts +0 -1
- package/dist/utils/dev-watcher.js +23 -8
- package/dist/utils/dev-watcher.js.map +1 -1
- package/dist/utils/env-loader.utils.d.ts +10 -1
- package/dist/utils/env-loader.utils.js +39 -31
- package/dist/utils/env-loader.utils.js.map +1 -1
- package/dist/utils/files.d.ts +47 -3
- package/dist/utils/files.js +98 -40
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/init-agent.js +1 -2
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts +2 -10
- package/dist/utils/init-helpers.js +9 -17
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +0 -8
- package/dist/utils/init-prompts.js +0 -22
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/prompt-handler.d.ts +3 -0
- package/dist/utils/prompt-handler.js +13 -0
- package/dist/utils/prompt-handler.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts +6 -5
- package/dist/utils/sandbox-storage.js +12 -12
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts +7 -30
- package/dist/utils/sandbox.js +247 -223
- package/dist/utils/sandbox.js.map +1 -1
- package/dist/utils/semver.d.ts +12 -0
- package/dist/utils/semver.js +23 -0
- package/dist/utils/semver.js.map +1 -1
- package/dist/utils/sync-display.d.ts +9 -0
- package/dist/utils/sync-display.js +67 -0
- package/dist/utils/sync-display.js.map +1 -0
- package/dist/utils/sync-fetch.d.ts +23 -0
- package/dist/utils/sync-fetch.js +64 -0
- package/dist/utils/sync-fetch.js.map +1 -0
- package/dist/utils/sync-helpers.d.ts +4 -59
- package/dist/utils/sync-helpers.js +4 -206
- package/dist/utils/sync-helpers.js.map +1 -1
- package/dist/web/app.css +912 -186
- package/dist/web/app.js +46 -46
- package/docs/API_INDEX.md +100 -0
- package/docs/API_REFERENCE.md +773 -0
- package/docs/CLI_REFERENCE.md +924 -0
- package/docs/GETTING_STARTED.md +862 -0
- package/docs/README.md +270 -0
- package/docs/api/AI.md +882 -0
- package/docs/api/Baskets.md +511 -0
- package/docs/api/CDN.md +524 -0
- package/docs/api/Data.md +446 -0
- package/docs/api/Jobs.md +524 -0
- package/docs/api/LuaAgent.md +454 -0
- package/docs/api/LuaJob.md +604 -0
- package/docs/api/LuaSkill.md +396 -0
- package/docs/api/LuaTool.md +521 -0
- package/docs/api/LuaWebhook.md +601 -0
- package/docs/api/Orders.md +514 -0
- package/docs/api/PostProcessor.md +565 -0
- package/docs/api/PreProcessor.md +630 -0
- package/docs/api/Products.md +507 -0
- package/docs/api/Templates.md +662 -0
- package/docs/api/User.md +567 -0
- package/docs/archive/DEVELOPMENT_GUIDE_V1.md +1294 -0
- package/docs/compiler-v2/ASSESSMENT.md +205 -0
- package/docs/compiler-v2/TEST_PLAN.md +306 -0
- package/package.json +3 -7
- package/template/tsconfig.json +1 -1
- package/dist/common/basket.instance.js.map +0 -1
- package/dist/common/data.entry.instance.js.map +0 -1
- package/dist/common/http.client.js.map +0 -1
- package/dist/common/job.instance.js.map +0 -1
- package/dist/common/order.instance.js.map +0 -1
- package/dist/common/product.instance.js.map +0 -1
- package/dist/common/product.pagination.instance.js.map +0 -1
- package/dist/common/product.search.instance.js.map +0 -1
- package/dist/common/user.instance.js.map +0 -1
- package/dist/config/auth.constants.d.ts +0 -11
- package/dist/config/auth.constants.js +0 -12
- package/dist/config/auth.constants.js.map +0 -1
- package/dist/config/init.constants.d.ts +0 -15
- package/dist/config/init.constants.js +0 -20
- package/dist/config/init.constants.js.map +0 -1
- package/dist/interfaces/compile.d.ts +0 -12
- package/dist/interfaces/compile.js +0 -5
- package/dist/interfaces/compile.js.map +0 -1
- package/dist/types/compile.types.d.ts +0 -131
- package/dist/types/compile.types.js +0 -6
- package/dist/types/compile.types.js.map +0 -1
- package/dist/utils/agent-code-utils.d.ts +0 -25
- package/dist/utils/agent-code-utils.js +0 -107
- package/dist/utils/agent-code-utils.js.map +0 -1
- package/dist/utils/bundling.d.ts +0 -89
- package/dist/utils/bundling.js +0 -1068
- package/dist/utils/bundling.js.map +0 -1
- package/dist/utils/compile.d.ts +0 -116
- package/dist/utils/compile.js +0 -1062
- package/dist/utils/compile.js.map +0 -1
- package/dist/utils/deploy-api.d.ts +0 -26
- package/dist/utils/deploy-api.js +0 -54
- package/dist/utils/deploy-api.js.map +0 -1
- package/dist/utils/deployment.d.ts +0 -26
- package/dist/utils/deployment.js +0 -218
- package/dist/utils/deployment.js.map +0 -1
- package/dist/utils/dev-helpers.d.ts +0 -47
- package/dist/utils/dev-helpers.js +0 -82
- package/dist/utils/dev-helpers.js.map +0 -1
- package/dist/utils/job-management.d.ts +0 -27
- package/dist/utils/job-management.js +0 -248
- package/dist/utils/job-management.js.map +0 -1
- package/dist/utils/mcp-server-management.d.ts +0 -26
- package/dist/utils/mcp-server-management.js +0 -197
- package/dist/utils/mcp-server-management.js.map +0 -1
- package/dist/utils/postprocessor-management.d.ts +0 -9
- package/dist/utils/postprocessor-management.js +0 -117
- package/dist/utils/postprocessor-management.js.map +0 -1
- package/dist/utils/pre-bundle-jobs.d.ts +0 -27
- package/dist/utils/pre-bundle-jobs.js +0 -189
- package/dist/utils/pre-bundle-jobs.js.map +0 -1
- package/dist/utils/preprocessor-management.d.ts +0 -9
- package/dist/utils/preprocessor-management.js +0 -117
- package/dist/utils/preprocessor-management.js.map +0 -1
- package/dist/utils/push-api.d.ts +0 -15
- package/dist/utils/push-api.js +0 -49
- package/dist/utils/push-api.js.map +0 -1
- package/dist/utils/push-helpers.d.ts +0 -82
- package/dist/utils/push-helpers.js +0 -246
- package/dist/utils/push-helpers.js.map +0 -1
- package/dist/utils/skill-management.d.ts +0 -39
- package/dist/utils/skill-management.js +0 -299
- package/dist/utils/skill-management.js.map +0 -1
- package/dist/utils/test-helpers.d.ts +0 -33
- package/dist/utils/test-helpers.js +0 -84
- package/dist/utils/test-helpers.js.map +0 -1
- package/dist/utils/test-prompts.d.ts +0 -23
- package/dist/utils/test-prompts.js +0 -187
- package/dist/utils/test-prompts.js.map +0 -1
- package/dist/utils/tool-detection.d.ts +0 -19
- package/dist/utils/tool-detection.js +0 -125
- package/dist/utils/tool-detection.js.map +0 -1
- package/dist/utils/webhook-management.d.ts +0 -27
- package/dist/utils/webhook-management.js +0 -241
- package/dist/utils/webhook-management.js.map +0 -1
- /package/dist/{common → api}/http.client.d.ts +0 -0
- /package/dist/{common → api}/http.client.js +0 -0
- /package/dist/{common → instances}/basket.instance.d.ts +0 -0
- /package/dist/{common → instances}/basket.instance.js +0 -0
- /package/dist/{common → instances}/data.entry.instance.d.ts +0 -0
- /package/dist/{common → instances}/data.entry.instance.js +0 -0
- /package/dist/{common → instances}/job.instance.d.ts +0 -0
- /package/dist/{common → instances}/job.instance.js +0 -0
- /package/dist/{common → instances}/order.instance.d.ts +0 -0
- /package/dist/{common → instances}/order.instance.js +0 -0
- /package/dist/{common → instances}/product.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.instance.js +0 -0
- /package/dist/{common → instances}/product.pagination.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.pagination.instance.js +0 -0
- /package/dist/{common → instances}/product.search.instance.d.ts +0 -0
- /package/dist/{common → instances}/product.search.instance.js +0 -0
- /package/dist/{common → instances}/user.instance.d.ts +0 -0
- /package/dist/{common → instances}/user.instance.js +0 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backup Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Utilities for project backup operations using S3 blob storage.
|
|
5
|
+
* Content is stored in S3, keyed by content hash for deduplication.
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import crypto from 'crypto';
|
|
10
|
+
import { COMPILE_DIRS } from '../config/compile.constants.js';
|
|
11
|
+
import { loadManifest, hasCompilationOutput } from './artifact-loader.js';
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// HASH CALCULATION
|
|
14
|
+
// =============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Calculate a hash for a string content.
|
|
17
|
+
*
|
|
18
|
+
* @param content - The content to hash
|
|
19
|
+
* @returns SHA-256 hash as hex string
|
|
20
|
+
*/
|
|
21
|
+
export function hashContent(content) {
|
|
22
|
+
return crypto.createHash('sha256').update(content, 'utf-8').digest('hex');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Calculate combined project hash from all project files.
|
|
26
|
+
* This hash is used to detect if the project has changed since last backup.
|
|
27
|
+
*
|
|
28
|
+
* @param projectFiles - Array of project files from the manifest
|
|
29
|
+
* @returns Combined hash of all file hashes (sorted for determinism)
|
|
30
|
+
*/
|
|
31
|
+
export function calculateProjectHash(projectFiles) {
|
|
32
|
+
// Sort by relative path for deterministic ordering
|
|
33
|
+
const sortedFiles = [...projectFiles].sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
34
|
+
// Combine all individual file hashes
|
|
35
|
+
const combinedHashes = sortedFiles.map(f => f.hash).join('|');
|
|
36
|
+
return hashContent(combinedHashes);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get the current project hash from the compilation manifest.
|
|
40
|
+
* Returns null if no manifest exists.
|
|
41
|
+
*
|
|
42
|
+
* @param projectPath - Path to the project root
|
|
43
|
+
* @returns The project hash or null
|
|
44
|
+
*/
|
|
45
|
+
export function getCurrentProjectHash(projectPath = process.cwd()) {
|
|
46
|
+
if (!hasCompilationOutput(projectPath))
|
|
47
|
+
return null;
|
|
48
|
+
const manifest = loadManifest(projectPath);
|
|
49
|
+
return calculateProjectHash(manifest.projectFiles);
|
|
50
|
+
}
|
|
51
|
+
// =============================================================================
|
|
52
|
+
// SOURCE LOADING
|
|
53
|
+
// =============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Load all project source files from dist-v2/sources/ directory.
|
|
56
|
+
*
|
|
57
|
+
* @param manifest - The compilation manifest
|
|
58
|
+
* @param projectPath - Path to the project root
|
|
59
|
+
* @returns Map of relative path -> file content
|
|
60
|
+
*/
|
|
61
|
+
export function loadProjectSources(manifest, projectPath = process.cwd()) {
|
|
62
|
+
const sourcesDir = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'sources');
|
|
63
|
+
const sources = new Map();
|
|
64
|
+
for (const file of manifest.projectFiles) {
|
|
65
|
+
const ext = path.extname(file.relativePath) || '.txt';
|
|
66
|
+
const sourcePath = path.join(sourcesDir, `${file.hash}${ext}`);
|
|
67
|
+
if (fs.existsSync(sourcePath)) {
|
|
68
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
69
|
+
sources.set(file.relativePath, content);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return sources;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Load source content by hash from dist-v2/sources/ directory.
|
|
76
|
+
*
|
|
77
|
+
* @param hash - The content hash
|
|
78
|
+
* @param relativePath - Original relative path (for extension)
|
|
79
|
+
* @param projectPath - Path to the project root
|
|
80
|
+
* @returns The file content or null if not found
|
|
81
|
+
*/
|
|
82
|
+
export function loadSourceByHash(hash, relativePath, projectPath = process.cwd()) {
|
|
83
|
+
const sourcesDir = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'sources');
|
|
84
|
+
const ext = path.extname(relativePath) || '.txt';
|
|
85
|
+
const sourcePath = path.join(sourcesDir, `${hash}${ext}`);
|
|
86
|
+
if (fs.existsSync(sourcePath)) {
|
|
87
|
+
return fs.readFileSync(sourcePath, 'utf-8');
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
// =============================================================================
|
|
92
|
+
// BLOB PREPARATION
|
|
93
|
+
// =============================================================================
|
|
94
|
+
/**
|
|
95
|
+
* Prepare file references (manifest entries) from the compilation output.
|
|
96
|
+
* No content included - just metadata for the manifest.
|
|
97
|
+
*
|
|
98
|
+
* @param projectPath - Path to the project root
|
|
99
|
+
* @returns Array of file references ready for manifest
|
|
100
|
+
*/
|
|
101
|
+
export function prepareFileRefs(projectPath = process.cwd()) {
|
|
102
|
+
const manifest = loadManifest(projectPath);
|
|
103
|
+
return manifest.projectFiles.map(file => ({
|
|
104
|
+
relativePath: file.relativePath,
|
|
105
|
+
hash: file.hash,
|
|
106
|
+
size: file.size,
|
|
107
|
+
type: file.type,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Prepare blobs for upload from the compilation output.
|
|
112
|
+
* Only prepares blobs for the specified hashes (missing ones).
|
|
113
|
+
*
|
|
114
|
+
* @param hashes - Array of hashes to prepare (typically the missing ones)
|
|
115
|
+
* @param manifest - The compilation manifest
|
|
116
|
+
* @param projectPath - Path to the project root
|
|
117
|
+
* @returns Array of blobs ready for upload (hash + base64 content)
|
|
118
|
+
*/
|
|
119
|
+
export function prepareBlobsForUpload(hashes, manifest, projectPath = process.cwd()) {
|
|
120
|
+
const hashSet = new Set(hashes);
|
|
121
|
+
const blobs = [];
|
|
122
|
+
for (const file of manifest.projectFiles) {
|
|
123
|
+
if (!hashSet.has(file.hash))
|
|
124
|
+
continue;
|
|
125
|
+
const content = loadSourceByHash(file.hash, file.relativePath, projectPath);
|
|
126
|
+
if (!content) {
|
|
127
|
+
throw new Error(`Source file not found for hash: ${file.hash} (${file.relativePath})`);
|
|
128
|
+
}
|
|
129
|
+
// Base64 encode the content for upload
|
|
130
|
+
const base64Content = Buffer.from(content, 'utf-8').toString('base64');
|
|
131
|
+
blobs.push({
|
|
132
|
+
hash: file.hash,
|
|
133
|
+
content: base64Content,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return blobs;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get all unique hashes from the manifest.
|
|
140
|
+
*
|
|
141
|
+
* @param projectPath - Path to the project root
|
|
142
|
+
* @returns Array of unique content hashes
|
|
143
|
+
*/
|
|
144
|
+
export function getAllFileHashes(projectPath = process.cwd()) {
|
|
145
|
+
const manifest = loadManifest(projectPath);
|
|
146
|
+
// Use Set to deduplicate (same content may appear multiple times)
|
|
147
|
+
return [...new Set(manifest.projectFiles.map(f => f.hash))];
|
|
148
|
+
}
|
|
149
|
+
// =============================================================================
|
|
150
|
+
// BLOB DOWNLOAD
|
|
151
|
+
// =============================================================================
|
|
152
|
+
/**
|
|
153
|
+
* Download a blob from a presigned URL.
|
|
154
|
+
*
|
|
155
|
+
* @param url - The presigned S3 URL
|
|
156
|
+
* @returns The blob content as a string
|
|
157
|
+
*/
|
|
158
|
+
async function downloadBlobFromUrl(url) {
|
|
159
|
+
const response = await fetch(url);
|
|
160
|
+
if (!response.ok) {
|
|
161
|
+
throw new Error(`Failed to download blob: ${response.status} ${response.statusText}`);
|
|
162
|
+
}
|
|
163
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
164
|
+
return Buffer.from(arrayBuffer);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Download multiple blobs in parallel from presigned URLs.
|
|
168
|
+
*
|
|
169
|
+
* @param urls - Map of hash -> presigned URL
|
|
170
|
+
* @param concurrency - Maximum number of parallel downloads (default: 10)
|
|
171
|
+
* @returns Map of hash -> content buffer
|
|
172
|
+
*/
|
|
173
|
+
export async function downloadBlobsParallel(urls, concurrency = 10) {
|
|
174
|
+
const results = new Map();
|
|
175
|
+
const entries = Object.entries(urls);
|
|
176
|
+
// Download in batches
|
|
177
|
+
for (let i = 0; i < entries.length; i += concurrency) {
|
|
178
|
+
const batch = entries.slice(i, i + concurrency);
|
|
179
|
+
const batchResults = await Promise.all(batch.map(async ([hash, url]) => {
|
|
180
|
+
const content = await downloadBlobFromUrl(url);
|
|
181
|
+
return { hash, content };
|
|
182
|
+
}));
|
|
183
|
+
for (const { hash, content } of batchResults) {
|
|
184
|
+
results.set(hash, content);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return results;
|
|
188
|
+
}
|
|
189
|
+
// =============================================================================
|
|
190
|
+
// PROJECT RESTORATION
|
|
191
|
+
// =============================================================================
|
|
192
|
+
/**
|
|
193
|
+
* Restore project files from a backup manifest and downloaded blobs.
|
|
194
|
+
* Creates all directories and files in the target directory.
|
|
195
|
+
*
|
|
196
|
+
* @param manifest - The backup manifest (file references)
|
|
197
|
+
* @param blobs - Map of hash -> content buffer (downloaded blobs)
|
|
198
|
+
* @param targetDir - Target directory to restore to
|
|
199
|
+
* @param options - Optional settings
|
|
200
|
+
*/
|
|
201
|
+
export function restoreProjectFromBackup(manifest, blobs, targetDir, options = {}) {
|
|
202
|
+
const { overwrite = false } = options;
|
|
203
|
+
for (const file of manifest.files) {
|
|
204
|
+
const filePath = path.join(targetDir, file.relativePath);
|
|
205
|
+
const fileDir = path.dirname(filePath);
|
|
206
|
+
// Skip if file exists and overwrite is false
|
|
207
|
+
if (fs.existsSync(filePath) && !overwrite) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
// Get blob content
|
|
211
|
+
const content = blobs.get(file.hash);
|
|
212
|
+
if (!content) {
|
|
213
|
+
throw new Error(`Blob not found for hash: ${file.hash} (${file.relativePath})`);
|
|
214
|
+
}
|
|
215
|
+
// Create directory structure
|
|
216
|
+
fs.mkdirSync(fileDir, { recursive: true });
|
|
217
|
+
// Write file
|
|
218
|
+
fs.writeFileSync(filePath, content);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Check which files would be created/overwritten by restore.
|
|
223
|
+
* Useful for showing user what will happen before restore.
|
|
224
|
+
*
|
|
225
|
+
* @param manifest - The backup manifest
|
|
226
|
+
* @param targetDir - Target directory to check against
|
|
227
|
+
* @returns Object with new files, existing files, and total count
|
|
228
|
+
*/
|
|
229
|
+
export function checkRestoreConflicts(manifest, targetDir) {
|
|
230
|
+
const newFiles = [];
|
|
231
|
+
const existingFiles = [];
|
|
232
|
+
for (const file of manifest.files) {
|
|
233
|
+
const filePath = path.join(targetDir, file.relativePath);
|
|
234
|
+
if (fs.existsSync(filePath)) {
|
|
235
|
+
existingFiles.push(file.relativePath);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
newFiles.push(file.relativePath);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
newFiles,
|
|
243
|
+
existingFiles,
|
|
244
|
+
totalFiles: manifest.files.length,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// =============================================================================
|
|
248
|
+
// BACKUP TRACKING
|
|
249
|
+
// =============================================================================
|
|
250
|
+
/**
|
|
251
|
+
* Check if project backup is out of sync (local changes not pushed).
|
|
252
|
+
*
|
|
253
|
+
* @param currentHash - Current project hash from manifest
|
|
254
|
+
* @param tracking - Backup tracking from YAML
|
|
255
|
+
* @returns true if backup is out of sync
|
|
256
|
+
*/
|
|
257
|
+
export function isBackupOutOfSync(currentHash, tracking) {
|
|
258
|
+
if (!tracking?.lastHash)
|
|
259
|
+
return true;
|
|
260
|
+
return tracking.lastHash !== currentHash;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Create backup tracking object after successful push.
|
|
264
|
+
*
|
|
265
|
+
* @param projectHash - The hash of the pushed backup
|
|
266
|
+
* @returns YamlConfigBackup object for storing in YAML
|
|
267
|
+
*/
|
|
268
|
+
export function createBackupTracking(projectHash) {
|
|
269
|
+
return {
|
|
270
|
+
lastHash: projectHash,
|
|
271
|
+
lastPushedAt: new Date().toISOString(),
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=backup-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backup-helpers.js","sourceRoot":"","sources":["../../src/utils/backup-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE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;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,OAAO;QACL,QAAQ,EAAE,WAAW;QACrB,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACvC,CAAC;AACJ,CAAC"}
|
package/dist/utils/cli.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Centralized CLI utilities for consistent error handling and output management
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Set CI mode flag
|
|
6
|
+
*/
|
|
7
|
+
export declare function setCiMode(enabled: boolean): void;
|
|
8
|
+
/**
|
|
9
|
+
* Check if CI mode is enabled
|
|
10
|
+
*/
|
|
11
|
+
export declare function isCiModeEnabled(): boolean;
|
|
4
12
|
/**
|
|
5
13
|
* Wraps a command function with standardized error handling
|
|
6
14
|
* Handles SIGINT (Ctrl+C) gracefully and provides consistent error messages
|
package/dist/utils/cli.js
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
* Centralized CLI utilities for consistent error handling and output management
|
|
3
3
|
*/
|
|
4
4
|
import { AuthenticationError } from "../errors/auth.error.js";
|
|
5
|
+
/**
|
|
6
|
+
* Global state for CI mode
|
|
7
|
+
* When true, interactive prompts will throw errors instead of silently returning null
|
|
8
|
+
*/
|
|
9
|
+
let isCiMode = false;
|
|
10
|
+
/**
|
|
11
|
+
* Set CI mode flag
|
|
12
|
+
*/
|
|
13
|
+
export function setCiMode(enabled) {
|
|
14
|
+
isCiMode = enabled;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if CI mode is enabled
|
|
18
|
+
*/
|
|
19
|
+
export function isCiModeEnabled() {
|
|
20
|
+
return isCiMode;
|
|
21
|
+
}
|
|
5
22
|
/**
|
|
6
23
|
* Wraps a command function with standardized error handling
|
|
7
24
|
* Handles SIGINT (Ctrl+C) gracefully and provides consistent error messages
|
|
@@ -18,10 +35,10 @@ export async function withErrorHandling(commandFn, commandName) {
|
|
|
18
35
|
if (AuthenticationError.isAuthenticationError(error)) {
|
|
19
36
|
console.error(`❌ Authentication failed: ${error.message}`);
|
|
20
37
|
console.error("💡 Run 'lua auth configure' to update your API key.");
|
|
21
|
-
|
|
38
|
+
throw new Error("Authentication failed: ${error.message}");
|
|
22
39
|
}
|
|
23
40
|
console.error(`❌ Error during ${commandName}:`, error.message);
|
|
24
|
-
|
|
41
|
+
throw new Error("Error during ${commandName}:");
|
|
25
42
|
}
|
|
26
43
|
}
|
|
27
44
|
/**
|
package/dist/utils/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAA2B,EAC3B,WAAmB;IAEnB,IAAI,CAAC;QACH,OAAO,MAAM,SAAS,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrC,2CAA2C;YAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,KAAK,CAAC,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACrE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB;;GA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AC,UAAU,GAAG,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,gEAAgE;IAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,8DAA8D;IAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,gEAAgE;IAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Utilities
|
|
3
|
+
* Shared utilities for command initialization and common operations
|
|
4
|
+
*/
|
|
5
|
+
import { YamlConfig } from '../types/yaml.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Context returned by initializeCommand for use in command handlers
|
|
8
|
+
*/
|
|
9
|
+
export interface CommandContext {
|
|
10
|
+
config: YamlConfig;
|
|
11
|
+
agentId: string;
|
|
12
|
+
orgId: string;
|
|
13
|
+
apiKey: string;
|
|
14
|
+
userData?: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Validates API key exists and is valid.
|
|
18
|
+
* Use this when you only need authentication without full command initialization.
|
|
19
|
+
*
|
|
20
|
+
* @returns The validated API key
|
|
21
|
+
* @throws Error if no API key found or validation fails
|
|
22
|
+
*/
|
|
23
|
+
export declare function requireAuth(): Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Validates API key and returns it, or exits the process with an error message.
|
|
26
|
+
* Use this in commands that should exit on auth failure rather than throw.
|
|
27
|
+
*
|
|
28
|
+
|
|
29
|
+
* @returns The validated API key
|
|
30
|
+
*/
|
|
31
|
+
export declare function requireAuthOrExit(showProgress?: boolean): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Full command initialization - validates config, auth, and returns context.
|
|
34
|
+
* Use this at the start of commands that need config + auth.
|
|
35
|
+
*
|
|
36
|
+
* @param options - Optional configuration
|
|
37
|
+
* @param options.showProgress - Whether to show progress messages (default: true)
|
|
38
|
+
* @returns Command context with config, agentId, apiKey, and optionally userData
|
|
39
|
+
*/
|
|
40
|
+
export declare function initializeCommand(options?: {
|
|
41
|
+
showProgress?: boolean;
|
|
42
|
+
}): Promise<CommandContext>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Utilities
|
|
3
|
+
* Shared utilities for command initialization and common operations
|
|
4
|
+
*/
|
|
5
|
+
import { loadApiKey, checkApiKey } from '../services/auth.js';
|
|
6
|
+
import { readYamlConfig } from './files.js';
|
|
7
|
+
import { writeProgress } from './cli.js';
|
|
8
|
+
/**
|
|
9
|
+
* Validates API key exists and is valid.
|
|
10
|
+
* Use this when you only need authentication without full command initialization.
|
|
11
|
+
*
|
|
12
|
+
* @returns The validated API key
|
|
13
|
+
* @throws Error if no API key found or validation fails
|
|
14
|
+
*/
|
|
15
|
+
export async function requireAuth() {
|
|
16
|
+
const apiKey = await loadApiKey();
|
|
17
|
+
if (!apiKey) {
|
|
18
|
+
throw new Error("No API key found. Please run 'lua auth configure' to set up your API key.");
|
|
19
|
+
}
|
|
20
|
+
await checkApiKey(apiKey);
|
|
21
|
+
return apiKey;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Validates API key and returns it, or exits the process with an error message.
|
|
25
|
+
* Use this in commands that should exit on auth failure rather than throw.
|
|
26
|
+
*
|
|
27
|
+
|
|
28
|
+
* @returns The validated API key
|
|
29
|
+
*/
|
|
30
|
+
export async function requireAuthOrExit(showProgress = true) {
|
|
31
|
+
const apiKey = await loadApiKey();
|
|
32
|
+
if (!apiKey) {
|
|
33
|
+
console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
|
|
34
|
+
throw new Error("No API key found. Please run");
|
|
35
|
+
}
|
|
36
|
+
await checkApiKey(apiKey);
|
|
37
|
+
if (showProgress) {
|
|
38
|
+
writeProgress("✅ Authenticated");
|
|
39
|
+
}
|
|
40
|
+
return apiKey;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Full command initialization - validates config, auth, and returns context.
|
|
44
|
+
* Use this at the start of commands that need config + auth.
|
|
45
|
+
*
|
|
46
|
+
* @param options - Optional configuration
|
|
47
|
+
* @param options.showProgress - Whether to show progress messages (default: true)
|
|
48
|
+
* @returns Command context with config, agentId, apiKey, and optionally userData
|
|
49
|
+
*/
|
|
50
|
+
export async function initializeCommand(options = {}) {
|
|
51
|
+
const { showProgress = true } = options;
|
|
52
|
+
// Validate config exists
|
|
53
|
+
const config = readYamlConfig();
|
|
54
|
+
if (!config) {
|
|
55
|
+
throw new Error("No lua.skill.yaml found. Please run this command from a skill directory.");
|
|
56
|
+
}
|
|
57
|
+
// Validate agent config
|
|
58
|
+
if (!config.agent?.agentId) {
|
|
59
|
+
throw new Error("Missing agentId in skill configuration. Please run 'lua init' first.");
|
|
60
|
+
}
|
|
61
|
+
// Validate org config
|
|
62
|
+
if (!config.agent?.orgId) {
|
|
63
|
+
throw new Error("Missing orgId in skill configuration. Please run 'lua init' first.");
|
|
64
|
+
}
|
|
65
|
+
// Validate authentication
|
|
66
|
+
const apiKey = await loadApiKey();
|
|
67
|
+
if (!apiKey) {
|
|
68
|
+
console.error("❌ No API key found. Please run 'lua auth configure' to set up your API key.");
|
|
69
|
+
throw new Error("No API key found. Please run");
|
|
70
|
+
}
|
|
71
|
+
const userData = await checkApiKey(apiKey);
|
|
72
|
+
if (showProgress) {
|
|
73
|
+
writeProgress("✅ Authenticated");
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
config,
|
|
77
|
+
agentId: config.agent.agentId,
|
|
78
|
+
orgId: config.agent.orgId,
|
|
79
|
+
apiKey,
|
|
80
|
+
userData
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=command-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-utils.js","sourceRoot":"","sources":["../../src/utils/command-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAczC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,2EAA2E,CAAC,CAAC;IAC/F,CAAC;IACD,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,eAAwB,IAAI;IAClE,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QAC7F,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,IAAI,YAAY,EAAE,CAAC;QACjB,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAEpC,EAAE;IACJ,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAExC,yBAAyB;IACzB,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;IAC1F,CAAC;IAED,sBAAsB;IACtB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxF,CAAC;IAED,0BAA0B;IAC1B,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QAC7F,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,YAAY,EAAE,CAAC;QACjB,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACL,MAAM;QACN,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;QACzB,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
* Helper functions for deployment operations
|
|
4
4
|
*/
|
|
5
5
|
import { VersionInfo } from '../interfaces/deploy.js';
|
|
6
|
-
/**
|
|
7
|
-
* Selected skill for deployment.
|
|
8
|
-
*/
|
|
9
|
-
export interface SelectedSkillForDeploy {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
skillId: string;
|
|
13
|
-
}
|
|
14
6
|
/**
|
|
15
7
|
* Formats a version for display in the selection list.
|
|
16
8
|
*
|
|
@@ -38,27 +30,6 @@ export declare function promptVersionSelection(versions: VersionInfo[]): Promise
|
|
|
38
30
|
* @returns True if confirmed, false otherwise
|
|
39
31
|
*/
|
|
40
32
|
export declare function confirmDeployment(): Promise<boolean>;
|
|
41
|
-
/**
|
|
42
|
-
* Prompts user to select a skill from available skills.
|
|
43
|
-
*
|
|
44
|
-
* @param skills - Array of available skills
|
|
45
|
-
* @returns Selected skill
|
|
46
|
-
*/
|
|
47
|
-
export declare function promptSkillSelection(skills: SelectedSkillForDeploy[]): Promise<SelectedSkillForDeploy>;
|
|
48
|
-
/**
|
|
49
|
-
* Validates that configuration has required fields for deployment.
|
|
50
|
-
*
|
|
51
|
-
* @param config - Skill configuration
|
|
52
|
-
* @throws Error if configuration is invalid
|
|
53
|
-
*/
|
|
54
|
-
export declare function validateDeployConfig(config: any): void;
|
|
55
|
-
/**
|
|
56
|
-
* Gets available skills from configuration.
|
|
57
|
-
*
|
|
58
|
-
* @param config - Skill configuration
|
|
59
|
-
* @returns Array of available skills
|
|
60
|
-
*/
|
|
61
|
-
export declare function getAvailableSkills(config: any): SelectedSkillForDeploy[];
|
|
62
33
|
/**
|
|
63
34
|
* Validates that versions are available for deployment.
|
|
64
35
|
*
|
|
@@ -62,76 +62,6 @@ export async function confirmDeployment() {
|
|
|
62
62
|
clearPromptLines(2);
|
|
63
63
|
return confirmed;
|
|
64
64
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Prompts user to select a skill from available skills.
|
|
67
|
-
*
|
|
68
|
-
* @param skills - Array of available skills
|
|
69
|
-
* @returns Selected skill
|
|
70
|
-
*/
|
|
71
|
-
export async function promptSkillSelection(skills) {
|
|
72
|
-
const skillChoices = skills.map((skill) => ({
|
|
73
|
-
name: `${skill.name} (v${skill.version})`,
|
|
74
|
-
value: skill
|
|
75
|
-
}));
|
|
76
|
-
const { selectedSkill } = await inquirer.prompt([
|
|
77
|
-
{
|
|
78
|
-
type: "list",
|
|
79
|
-
name: "selectedSkill",
|
|
80
|
-
message: "Select a skill to deploy:",
|
|
81
|
-
choices: skillChoices
|
|
82
|
-
}
|
|
83
|
-
]);
|
|
84
|
-
clearPromptLines(2);
|
|
85
|
-
return selectedSkill;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Validates that configuration has required fields for deployment.
|
|
89
|
-
*
|
|
90
|
-
* @param config - Skill configuration
|
|
91
|
-
* @throws Error if configuration is invalid
|
|
92
|
-
*/
|
|
93
|
-
export function validateDeployConfig(config) {
|
|
94
|
-
if (!config) {
|
|
95
|
-
throw new Error("No lua.skill.yaml found. Please run this command from a skill directory.");
|
|
96
|
-
}
|
|
97
|
-
if (!config.agent?.agentId) {
|
|
98
|
-
throw new Error("Missing agentId in skill configuration");
|
|
99
|
-
}
|
|
100
|
-
// Check for new multi-skill format
|
|
101
|
-
if (config.skills && Array.isArray(config.skills) && config.skills.length > 0) {
|
|
102
|
-
return; // Valid multi-skill config
|
|
103
|
-
}
|
|
104
|
-
// Check for legacy single-skill format
|
|
105
|
-
if (config.skill?.skillId) {
|
|
106
|
-
return; // Valid legacy config
|
|
107
|
-
}
|
|
108
|
-
throw new Error("No skills found in configuration. Please compile your skill first.");
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Gets available skills from configuration.
|
|
112
|
-
*
|
|
113
|
-
* @param config - Skill configuration
|
|
114
|
-
* @returns Array of available skills
|
|
115
|
-
*/
|
|
116
|
-
export function getAvailableSkills(config) {
|
|
117
|
-
// Check for new multi-skill format
|
|
118
|
-
if (config.skills && Array.isArray(config.skills) && config.skills.length > 0) {
|
|
119
|
-
return config.skills.map((skill) => ({
|
|
120
|
-
name: skill.name,
|
|
121
|
-
version: skill.version,
|
|
122
|
-
skillId: skill.skillId
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
// Fallback to legacy single-skill format
|
|
126
|
-
if (config.skill) {
|
|
127
|
-
return [{
|
|
128
|
-
name: config.skill.name || 'unnamed-skill',
|
|
129
|
-
version: config.skill.version,
|
|
130
|
-
skillId: config.skill.skillId
|
|
131
|
-
}];
|
|
132
|
-
}
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
135
65
|
/**
|
|
136
66
|
* Validates that versions are available for deployment.
|
|
137
67
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-helpers.js","sourceRoot":"","sources":["../../src/utils/deploy-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy-helpers.js","sourceRoot":"","sources":["../../src/utils/deploy-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAoB;IACtD,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAChE,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,gBAAgB,eAAe,IAAI,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;AACjG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAuB;IACxD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC5B,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,OA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