productivity
Codemagic Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Codemagic KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.codemagic.*.
Use lua_read_doc("integrations.codemagic") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Codemagic workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.codemagic.list_apps({}))' --json kosmo integrations:lua --eval 'print(docs.read("codemagic"))' --json
kosmo integrations:lua --eval 'print(docs.read("codemagic.list_apps"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local codemagic = app.integrations.codemagic
local result = codemagic.list_apps({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.codemagic, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.codemagic.default.* or app.integrations.codemagic.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Codemagic, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Codemagic
Namespace: codemagic
Use the Codemagic integration to manage mobile CI/CD applications through the Codemagic REST API. Authentication uses a Codemagic API token in the x-auth-token header.
Common Workflows
- Use
codemagic_list_apps,codemagic_get_app,codemagic_create_app, andcodemagic_create_private_appfor application discovery and repository onboarding. - Use
codemagic_start_buildandcodemagic_cancel_buildto run or cancel builds. - Use
codemagic_get_artifactandcodemagic_create_artifact_public_urlfor build artifact download links. - Use
codemagic_list_caches,codemagic_delete_caches, andcodemagic_delete_cachefor app cache inspection and cleanup. - Use
codemagic_api_get,codemagic_api_post,codemagic_api_patch, andcodemagic_api_deletefor safe relative API paths not covered by first-class tools. Full URLs are rejected.
Argument Notes
Application tools use app_id. Build cancellation uses build_id. Artifact tools use secure_filename, which may include nested path segments copied from a Codemagic artifact URL. Cache deletion uses cache_id.
Write tools accept Codemagic JSON request bodies through payload. Read/raw tools accept optional query parameters through query.
Examples
local apps = tools.codemagic_list_apps({})
local build = tools.codemagic_start_build({
payload = {
appId = "app-id",
workflowId = "release",
branch = "main",
labels = { "nightly" }
}
})
local public_artifact = tools.codemagic_create_artifact_public_url({
secure_filename = "secure/build/path/app.ipa",
payload = {
expiresAt = 1767225600
}
})
Return Shapes
The integration returns decoded Codemagic JSON responses directly. Empty successful responses are normalized to:
{"success": true}
Text responses are normalized to:
{"value": "raw response text"}
Codemagic marks these REST APIs as preview in parts of the official docs. If a route changes or is unavailable for an account, the tool returns Codemagic’s HTTP error rather than inventing a successful response.
Raw agent markdown
# Codemagic
Namespace: `codemagic`
Use the Codemagic integration to manage mobile CI/CD applications through the Codemagic REST API. Authentication uses a Codemagic API token in the `x-auth-token` header.
## Common Workflows
- Use `codemagic_list_apps`, `codemagic_get_app`, `codemagic_create_app`, and `codemagic_create_private_app` for application discovery and repository onboarding.
- Use `codemagic_start_build` and `codemagic_cancel_build` to run or cancel builds.
- Use `codemagic_get_artifact` and `codemagic_create_artifact_public_url` for build artifact download links.
- Use `codemagic_list_caches`, `codemagic_delete_caches`, and `codemagic_delete_cache` for app cache inspection and cleanup.
- Use `codemagic_api_get`, `codemagic_api_post`, `codemagic_api_patch`, and `codemagic_api_delete` for safe relative API paths not covered by first-class tools. Full URLs are rejected.
## Argument Notes
Application tools use `app_id`. Build cancellation uses `build_id`. Artifact tools use `secure_filename`, which may include nested path segments copied from a Codemagic artifact URL. Cache deletion uses `cache_id`.
Write tools accept Codemagic JSON request bodies through `payload`. Read/raw tools accept optional query parameters through `query`.
## Examples
```lua
local apps = tools.codemagic_list_apps({})
local build = tools.codemagic_start_build({
payload = {
appId = "app-id",
workflowId = "release",
branch = "main",
labels = { "nightly" }
}
})
local public_artifact = tools.codemagic_create_artifact_public_url({
secure_filename = "secure/build/path/app.ipa",
payload = {
expiresAt = 1767225600
}
})
```
## Return Shapes
The integration returns decoded Codemagic JSON responses directly. Empty successful responses are normalized to:
```json
{"success": true}
```
Text responses are normalized to:
```json
{"value": "raw response text"}
```
Codemagic marks these REST APIs as preview in parts of the official docs. If a route changes or is unavailable for an account, the tool returns Codemagic's HTTP error rather than inventing a successful response. local result = app.integrations.codemagic.list_apps({})
print(result) Functions
list_apps Read
List Codemagic applications.
- Lua path
app.integrations.codemagic.list_apps- Full name
codemagic.codemagic_list_apps
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_app Read
Get one Codemagic application.
- Lua path
app.integrations.codemagic.get_app- Full name
codemagic.codemagic_get_app
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_app Write
Add a repository to Codemagic.
- Lua path
app.integrations.codemagic.create_app- Full name
codemagic.codemagic_create_app
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_private_app Write
Add a private repository with SSH key details.
- Lua path
app.integrations.codemagic.create_private_app- Full name
codemagic.codemagic_create_private_app
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
start_build Write
Start a Codemagic build.
- Lua path
app.integrations.codemagic.start_build- Full name
codemagic.codemagic_start_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
cancel_build Write
Cancel a Codemagic build.
- Lua path
app.integrations.codemagic.cancel_build- Full name
codemagic.codemagic_cancel_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_artifact Read
Get an authenticated artifact URL.
- Lua path
app.integrations.codemagic.get_artifact- Full name
codemagic.codemagic_get_artifact
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_artifact_public_url Write
Create a public artifact download URL.
- Lua path
app.integrations.codemagic.create_artifact_public_url- Full name
codemagic.codemagic_create_artifact_public_url
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_caches Read
List app caches.
- Lua path
app.integrations.codemagic.list_caches- Full name
codemagic.codemagic_list_caches
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_caches Write
Delete all app caches.
- Lua path
app.integrations.codemagic.delete_caches- Full name
codemagic.codemagic_delete_caches
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_cache Write
Delete one app cache.
- Lua path
app.integrations.codemagic.delete_cache- Full name
codemagic.codemagic_delete_cache
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_get Read
Call a safe relative Codemagic GET path.
- Lua path
app.integrations.codemagic.api_get- Full name
codemagic.codemagic_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_post Write
Call a safe relative Codemagic POST path.
- Lua path
app.integrations.codemagic.api_post- Full name
codemagic.codemagic_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_patch Write
Call a safe relative Codemagic PATCH path.
- Lua path
app.integrations.codemagic.api_patch- Full name
codemagic.codemagic_api_patch
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_delete Write
Call a safe relative Codemagic DELETE path.
- Lua path
app.integrations.codemagic.api_delete- Full name
codemagic.codemagic_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||