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,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundler — esbuild bundling for primitives.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from Compiler to separate bundling concerns:
|
|
5
|
+
* - Virtual source plugin (handles non-exported primitives)
|
|
6
|
+
* - Lua-CLI shim plugin (strips lua-cli imports for VM sandbox)
|
|
7
|
+
* - esbuild bundling with source maps
|
|
8
|
+
*/
|
|
9
|
+
import { Project } from 'ts-morph';
|
|
10
|
+
import type { PrimitiveMetadata, BundledArtifact } from './types.js';
|
|
11
|
+
export interface BundlerOptions {
|
|
12
|
+
outDir: string;
|
|
13
|
+
minify: boolean;
|
|
14
|
+
sourceMaps: boolean;
|
|
15
|
+
debug: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class Bundler {
|
|
18
|
+
private options;
|
|
19
|
+
private project;
|
|
20
|
+
private verbose;
|
|
21
|
+
constructor(options: BundlerOptions, project: Project, verbose: (msg: string) => void);
|
|
22
|
+
/**
|
|
23
|
+
* Strip lua-cli and api-exports import statements from source code using TypeScript AST.
|
|
24
|
+
* This is more robust than regex and handles all edge cases (multiline, comments, etc.).
|
|
25
|
+
*/
|
|
26
|
+
private stripLuaCliImportsAST;
|
|
27
|
+
/**
|
|
28
|
+
* Bundle a primitive's entry point using esbuild.
|
|
29
|
+
*/
|
|
30
|
+
bundle(metadata: PrimitiveMetadata, entryPointCode: string): Promise<BundledArtifact>;
|
|
31
|
+
/**
|
|
32
|
+
* Create esbuild plugin that serves the source file as a virtual module
|
|
33
|
+
* with an appended named export for the primitive.
|
|
34
|
+
*/
|
|
35
|
+
private createVirtualSourcePlugin;
|
|
36
|
+
/**
|
|
37
|
+
* Create esbuild plugin that strips lua-cli and api-exports imports using TypeScript AST.
|
|
38
|
+
* Uses ts-morph to properly parse and remove import declarations, handling all edge cases
|
|
39
|
+
* including multiline imports, comments, and complex syntax that regex can't handle.
|
|
40
|
+
*/
|
|
41
|
+
private createLuaCliShimPlugin;
|
|
42
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundler — esbuild bundling for primitives.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from Compiler to separate bundling concerns:
|
|
5
|
+
* - Virtual source plugin (handles non-exported primitives)
|
|
6
|
+
* - Lua-CLI shim plugin (strips lua-cli imports for VM sandbox)
|
|
7
|
+
* - esbuild bundling with source maps
|
|
8
|
+
*/
|
|
9
|
+
import fs from 'fs/promises';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import crypto from 'crypto';
|
|
12
|
+
import { build } from 'esbuild';
|
|
13
|
+
export class Bundler {
|
|
14
|
+
constructor(options, project, verbose) {
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.project = project;
|
|
17
|
+
this.verbose = verbose;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Strip lua-cli and api-exports import statements from source code using TypeScript AST.
|
|
21
|
+
* This is more robust than regex and handles all edge cases (multiline, comments, etc.).
|
|
22
|
+
*/
|
|
23
|
+
stripLuaCliImportsAST(code, filename = 'temp.ts') {
|
|
24
|
+
try {
|
|
25
|
+
// Create temporary source file for parsing
|
|
26
|
+
const tempFile = this.project.createSourceFile(`__strip_${filename}`, code, {
|
|
27
|
+
overwrite: true,
|
|
28
|
+
});
|
|
29
|
+
// Find and remove lua-cli and api-exports imports
|
|
30
|
+
const imports = tempFile.getImportDeclarations();
|
|
31
|
+
imports.forEach((imp) => {
|
|
32
|
+
const moduleSpecifier = imp.getModuleSpecifierValue();
|
|
33
|
+
if (moduleSpecifier === 'lua-cli' ||
|
|
34
|
+
moduleSpecifier === 'lua-cli/skill' ||
|
|
35
|
+
moduleSpecifier.includes('api-exports')) {
|
|
36
|
+
imp.remove();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const result = tempFile.getText();
|
|
40
|
+
this.project.removeSourceFile(tempFile);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
// Fallback to original code if parsing fails
|
|
45
|
+
return code;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Bundle a primitive's entry point using esbuild.
|
|
50
|
+
*/
|
|
51
|
+
async bundle(metadata, entryPointCode) {
|
|
52
|
+
const tempDir = path.join(this.options.outDir, '.temp');
|
|
53
|
+
const outfile = path.join(tempDir, `${metadata.kind}-${metadata.name}.bundle.js`);
|
|
54
|
+
const sourceDir = path.dirname(metadata.sourcePath);
|
|
55
|
+
if (this.options.debug) {
|
|
56
|
+
this.verbose(` Source: ${metadata.sourcePath}`);
|
|
57
|
+
this.verbose(` Output: ${outfile}`);
|
|
58
|
+
}
|
|
59
|
+
const virtualSourcePlugin = this.createVirtualSourcePlugin(metadata);
|
|
60
|
+
const luaCliShimPlugin = this.createLuaCliShimPlugin();
|
|
61
|
+
await build({
|
|
62
|
+
stdin: {
|
|
63
|
+
contents: entryPointCode,
|
|
64
|
+
resolveDir: sourceDir,
|
|
65
|
+
loader: 'ts',
|
|
66
|
+
sourcefile: `${metadata.kind}-${metadata.name}-entry.ts`,
|
|
67
|
+
},
|
|
68
|
+
bundle: true,
|
|
69
|
+
format: 'cjs',
|
|
70
|
+
platform: 'node',
|
|
71
|
+
target: 'node18',
|
|
72
|
+
minify: this.options.minify,
|
|
73
|
+
sourcemap: this.options.sourceMaps ? 'external' : false,
|
|
74
|
+
outfile,
|
|
75
|
+
external: ['zod'],
|
|
76
|
+
plugins: [luaCliShimPlugin, virtualSourcePlugin],
|
|
77
|
+
logLevel: this.options.debug ? 'debug' : 'silent',
|
|
78
|
+
});
|
|
79
|
+
const code = await fs.readFile(outfile, 'utf-8');
|
|
80
|
+
let sourceMap = '';
|
|
81
|
+
try {
|
|
82
|
+
sourceMap = await fs.readFile(outfile + '.map', 'utf-8');
|
|
83
|
+
}
|
|
84
|
+
catch { /* no source map */ }
|
|
85
|
+
const originalSource = await fs.readFile(metadata.sourcePath, 'utf-8');
|
|
86
|
+
const hash = crypto.createHash('sha256').update(code).digest('hex').slice(0, 16);
|
|
87
|
+
const stats = await fs.stat(outfile);
|
|
88
|
+
return { code, sourceMap, originalSource, size: stats.size, hash };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create esbuild plugin that serves the source file as a virtual module
|
|
92
|
+
* with an appended named export for the primitive.
|
|
93
|
+
*/
|
|
94
|
+
createVirtualSourcePlugin(metadata) {
|
|
95
|
+
const bundler = this;
|
|
96
|
+
const sourcePath = metadata.sourcePath;
|
|
97
|
+
const exportName = metadata.exportName;
|
|
98
|
+
const sourceDir = path.dirname(sourcePath);
|
|
99
|
+
return {
|
|
100
|
+
name: 'lua-virtual-source',
|
|
101
|
+
setup(build) {
|
|
102
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
103
|
+
const resolved = args.path.startsWith('.')
|
|
104
|
+
? path.resolve(args.resolveDir, args.path)
|
|
105
|
+
: args.path;
|
|
106
|
+
const normalizedResolved = resolved.replace(/\.(ts|tsx|js|jsx)$/, '');
|
|
107
|
+
const normalizedSource = sourcePath.replace(/\.(ts|tsx|js|jsx)$/, '');
|
|
108
|
+
if (normalizedResolved === normalizedSource) {
|
|
109
|
+
return { path: sourcePath, namespace: 'lua-virtual-source' };
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
});
|
|
113
|
+
build.onLoad({ filter: /.*/, namespace: 'lua-virtual-source' }, async () => {
|
|
114
|
+
const sourceFile = bundler.project.getSourceFile(sourcePath);
|
|
115
|
+
let content = sourceFile?.getText() ?? await fs.readFile(sourcePath, 'utf-8');
|
|
116
|
+
content = bundler.stripLuaCliImportsAST(content, path.basename(sourcePath));
|
|
117
|
+
const virtualContent = metadata.isDefaultExport
|
|
118
|
+
? content
|
|
119
|
+
: `${content}\nexport { ${exportName} as __lua_target__ };\n`;
|
|
120
|
+
return { contents: virtualContent, loader: 'ts', resolveDir: sourceDir };
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create esbuild plugin that strips lua-cli and api-exports imports using TypeScript AST.
|
|
127
|
+
* Uses ts-morph to properly parse and remove import declarations, handling all edge cases
|
|
128
|
+
* including multiline imports, comments, and complex syntax that regex can't handle.
|
|
129
|
+
*/
|
|
130
|
+
createLuaCliShimPlugin() {
|
|
131
|
+
const stripImports = this.stripLuaCliImportsAST.bind(this);
|
|
132
|
+
const debug = this.options.debug;
|
|
133
|
+
const verbose = this.verbose.bind(this);
|
|
134
|
+
return {
|
|
135
|
+
name: 'lua-cli-import-stripper',
|
|
136
|
+
setup(build) {
|
|
137
|
+
// Strip lua-cli imports from all source files using AST parsing
|
|
138
|
+
build.onLoad({ filter: /\.([jt]sx?)$/, namespace: 'file' }, async (args) => {
|
|
139
|
+
// Skip node_modules
|
|
140
|
+
if (args.path.includes('node_modules'))
|
|
141
|
+
return null;
|
|
142
|
+
// Quick check: does file contain lua-cli or api-exports imports?
|
|
143
|
+
const contents = await fs.readFile(args.path, 'utf-8');
|
|
144
|
+
if (!contents.includes('lua-cli') && !contents.includes('api-exports')) {
|
|
145
|
+
return null; // No lua-cli imports, let esbuild handle normally
|
|
146
|
+
}
|
|
147
|
+
// Use ts-morph to parse and remove imports
|
|
148
|
+
try {
|
|
149
|
+
const modifiedContents = stripImports(contents, path.basename(args.path));
|
|
150
|
+
// Only return modified contents if something changed
|
|
151
|
+
if (modifiedContents !== contents) {
|
|
152
|
+
return {
|
|
153
|
+
contents: modifiedContents,
|
|
154
|
+
loader: args.path.endsWith('.ts') || args.path.endsWith('.tsx') ? 'ts' : 'js',
|
|
155
|
+
resolveDir: path.dirname(args.path),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
// If AST parsing fails, fall back to original content
|
|
162
|
+
// The safety-net onResolve below will catch any remaining imports
|
|
163
|
+
if (debug) {
|
|
164
|
+
verbose(` Warning: Failed to parse ${args.path} with ts-morph, using fallback`);
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
// Safety net: catch any lua-cli imports that somehow weren't stripped
|
|
170
|
+
// This handles edge cases where AST parsing might fail or imports are dynamically generated
|
|
171
|
+
build.onResolve({ filter: /^lua-cli(\/skill)?$/ }, () => ({
|
|
172
|
+
path: 'lua-cli-empty',
|
|
173
|
+
namespace: 'lua-cli-empty',
|
|
174
|
+
}));
|
|
175
|
+
build.onResolve({ filter: /api-exports(\.(js|ts))?$/ }, () => ({
|
|
176
|
+
path: 'lua-cli-empty',
|
|
177
|
+
namespace: 'lua-cli-empty',
|
|
178
|
+
}));
|
|
179
|
+
build.onLoad({ filter: /.*/, namespace: 'lua-cli-empty' }, () => ({
|
|
180
|
+
contents: '/* lua-cli stripped - APIs provided by VM sandbox */',
|
|
181
|
+
loader: 'js',
|
|
182
|
+
}));
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=bundler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundler.js","sourceRoot":"","sources":["../../src/compiler/bundler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAUhC,MAAM,OAAO,OAAO;IAClB,YACU,OAAuB,EACvB,OAAgB,EAChB,OAA8B;QAF9B,YAAO,GAAP,OAAO,CAAgB;QACvB,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAuB;IACrC,CAAC;IAEJ;;;OAGG;IACK,qBAAqB,CAAC,IAAY,EAAE,WAAmB,SAAS;QACtE,IAAI,CAAC;YACH,2CAA2C;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,WAAW,QAAQ,EAAE,EAAE,IAAI,EAAE;gBAC1E,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,kDAAkD;YAClD,MAAM,OAAO,GAAG,QAAQ,CAAC,qBAAqB,EAAE,CAAC;YACjD,OAAO,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,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;oBAC7D,IAAI,EAAE,eAAe;oBACrB,SAAS,EAAE,eAAe;iBAC3B,CAAC,CAAC,CAAC;gBAEJ,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;oBAChE,QAAQ,EAAE,sDAAsD;oBAChE,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Lua Compiler
|
|
3
|
+
*
|
|
4
|
+
* This is the entry point for compilation. It orchestrates:
|
|
5
|
+
* 1. Scanning source files for primitives
|
|
6
|
+
* 2. Validating all primitives
|
|
7
|
+
* 3. Bundling each primitive with esbuild
|
|
8
|
+
* 4. Writing artifacts to disk
|
|
9
|
+
*/
|
|
10
|
+
import { CompilerOptions, CompilationResult } from './types.js';
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
export declare class Compiler {
|
|
13
|
+
private project;
|
|
14
|
+
private options;
|
|
15
|
+
private bundler;
|
|
16
|
+
/** Cached agent info from traversal (avoids re-traversing for manifest) */
|
|
17
|
+
private cachedAgentInfo;
|
|
18
|
+
constructor(options: CompilerOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Run the compilation.
|
|
21
|
+
*/
|
|
22
|
+
compile(): Promise<CompilationResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Scan for primitives using agent traversal (preferred) or fallback to full scan.
|
|
25
|
+
*
|
|
26
|
+
* Agent traversal only compiles primitives that are actually registered with
|
|
27
|
+
* a LuaAgent, matching the old compiler's behavior.
|
|
28
|
+
*
|
|
29
|
+
* Also caches the agent info for manifest creation (avoids re-traversing).
|
|
30
|
+
*/
|
|
31
|
+
private scanForPrimitives;
|
|
32
|
+
/**
|
|
33
|
+
* Fallback discovery: scan all source files for primitives when no LuaAgent is found.
|
|
34
|
+
*
|
|
35
|
+
* Unlike agent traversal (which only compiles registered primitives), this method
|
|
36
|
+
* runs every plugin on every source file to discover ALL primitive-like code:
|
|
37
|
+
* - ToolPlugin: defineTool() OR classes extending/implementing LuaTool
|
|
38
|
+
* - JobPlugin: defineJob() OR new LuaJob({...})
|
|
39
|
+
* - WebhookPlugin: defineWebhook() OR new LuaWebhook({...})
|
|
40
|
+
* - PreProcessorPlugin: definePreProcessor() OR new PreProcessor({...})
|
|
41
|
+
* - PostProcessorPlugin: definePostProcessor() OR new PostProcessor({...})
|
|
42
|
+
* - McpServerPlugin: defineMCPServer() OR new LuaMCPServer({...})
|
|
43
|
+
*
|
|
44
|
+
* This is less precise and may include unused primitives, but necessary for
|
|
45
|
+
* projects that don't use the LuaAgent pattern.
|
|
46
|
+
*
|
|
47
|
+
* @returns All detected primitive metadata from the entire codebase
|
|
48
|
+
*/
|
|
49
|
+
private scanAllFiles;
|
|
50
|
+
/**
|
|
51
|
+
* Compile primitives in parallel with a concurrency limit.
|
|
52
|
+
* Returns results in the same order as input, with either compiled primitive or error.
|
|
53
|
+
*/
|
|
54
|
+
private compileInParallel;
|
|
55
|
+
/**
|
|
56
|
+
* Compile a single primitive through the full pipeline.
|
|
57
|
+
*
|
|
58
|
+
* The compilation pipeline for each primitive:
|
|
59
|
+
* 1. Generate entry point code via the plugin
|
|
60
|
+
* 2. Bundle with esbuild using stdin (no temp entry file) + virtual module plugin
|
|
61
|
+
* 3. Run plugin's post-processing hook (if any)
|
|
62
|
+
* 4. Extract schemas via plugin (e.g., Zod → JSON Schema for tools)
|
|
63
|
+
*
|
|
64
|
+
* Uses esbuild's stdin option for the entry point and a virtual module plugin
|
|
65
|
+
* that appends `export { X as __lua_target__ }` to the source file. This
|
|
66
|
+
* eliminates all temp files while handling non-exported primitives correctly.
|
|
67
|
+
*
|
|
68
|
+
* @param metadata - Primitive metadata from detection phase
|
|
69
|
+
* @returns Compiled primitive with bundled code, schemas, and metadata, or null if plugin not found
|
|
70
|
+
*/
|
|
71
|
+
private compilePrimitive;
|
|
72
|
+
/**
|
|
73
|
+
* Write all compilation artifacts to disk with full project preservation.
|
|
74
|
+
*
|
|
75
|
+
* Output structure:
|
|
76
|
+
* ```
|
|
77
|
+
* dist-v2/
|
|
78
|
+
* ├── artifacts/
|
|
79
|
+
* │ ├── tool/
|
|
80
|
+
* │ │ ├── {name}.js # Bundled code
|
|
81
|
+
* │ │ ├── {name}.js.map # Source map
|
|
82
|
+
* │ │ └── {name}.json # Metadata (schemas, description, etc.)
|
|
83
|
+
* │ ├── job/
|
|
84
|
+
* │ ├── webhook/
|
|
85
|
+
* │ └── ...
|
|
86
|
+
* ├── sources/
|
|
87
|
+
* │ └── {hash}.ts # Deduplicated source files (by content hash)
|
|
88
|
+
* └── manifest.json # Full compilation manifest
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @param primitives - All compiled primitives to write
|
|
92
|
+
*/
|
|
93
|
+
private writeArtifacts;
|
|
94
|
+
/**
|
|
95
|
+
* Write primitive artifacts: bundles, source maps, and metadata JSON files.
|
|
96
|
+
*/
|
|
97
|
+
private writePrimitiveArtifacts;
|
|
98
|
+
/**
|
|
99
|
+
* Store all project files for full reconstruction (enables `lua init --from-server`).
|
|
100
|
+
* Returns the list of project files with their hashes.
|
|
101
|
+
*/
|
|
102
|
+
private storeProjectFiles;
|
|
103
|
+
/**
|
|
104
|
+
* Create the compilation manifest with all metadata.
|
|
105
|
+
*
|
|
106
|
+
* Uses cached agent info from scanForPrimitives() to avoid re-traversing.
|
|
107
|
+
* Delegates to each plugin's toManifestEntry() for type-specific fields.
|
|
108
|
+
*/
|
|
109
|
+
private createManifest;
|
|
110
|
+
/**
|
|
111
|
+
* Map compiled primitives to manifest entries using plugins.
|
|
112
|
+
* Single source of truth for primitive → manifest conversion.
|
|
113
|
+
*/
|
|
114
|
+
private mapPrimitivesToManifest;
|
|
115
|
+
/**
|
|
116
|
+
* Recursively collect all project files for full reconstruction.
|
|
117
|
+
*
|
|
118
|
+
* This enables `lua init --from-server` to recreate the exact project structure.
|
|
119
|
+
*
|
|
120
|
+
* File categorization:
|
|
121
|
+
* - 'source': .ts, .tsx, .js files
|
|
122
|
+
* - 'config': package.json, tsconfig.json, lua.skill.yaml, *.yaml, *.yml, *.json
|
|
123
|
+
* - 'other': README.md, .env.example, etc.
|
|
124
|
+
*
|
|
125
|
+
* Excludes (via shouldSkipDirectory/shouldSkipFile):
|
|
126
|
+
* - node_modules, dist, .git, coverage, etc.
|
|
127
|
+
* - test files, declaration files, lock files
|
|
128
|
+
*
|
|
129
|
+
* @returns Array of file info with relative paths and categorized types
|
|
130
|
+
*/
|
|
131
|
+
private collectProjectFiles;
|
|
132
|
+
/**
|
|
133
|
+
* Log the output directory tree.
|
|
134
|
+
*/
|
|
135
|
+
private logTree;
|
|
136
|
+
/**
|
|
137
|
+
* Create the compilation result with stats.
|
|
138
|
+
* Note: The full manifest (with projectFiles) is written by writeArtifacts.
|
|
139
|
+
* This returns a minimal manifest for the result object.
|
|
140
|
+
*/
|
|
141
|
+
private createResult;
|
|
142
|
+
/**
|
|
143
|
+
* Calculate compilation statistics.
|
|
144
|
+
*/
|
|
145
|
+
private calculateStats;
|
|
146
|
+
/**
|
|
147
|
+
* Create a minimal manifest for the result object.
|
|
148
|
+
* The full manifest (with projectFiles) is written to disk by writeArtifacts.
|
|
149
|
+
*/
|
|
150
|
+
private createMinimalManifest;
|
|
151
|
+
/**
|
|
152
|
+
* Log a message (always shown).
|
|
153
|
+
*/
|
|
154
|
+
private log;
|
|
155
|
+
/**
|
|
156
|
+
* Log a verbose message (only shown in verbose or debug mode).
|
|
157
|
+
*/
|
|
158
|
+
private verbose;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Compile a Lua project.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* const result = await compile({
|
|
166
|
+
* rootDir: process.cwd(),
|
|
167
|
+
* outDir: 'dist',
|
|
168
|
+
* });
|
|
169
|
+
*
|
|
170
|
+
* if (!result.success) {
|
|
171
|
+
* console.error('Compilation failed:');
|
|
172
|
+
* result.errors.forEach(e => console.error(` ${e.message}`));
|
|
173
|
+
* process.exit(1);
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
export declare function compile(options: CompilerOptions): Promise<CompilationResult>;
|