KosmoKrator

productivity

Bitrise Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Bitrise KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.bitrise.*. Use lua_read_doc("integrations.bitrise") 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 Bitrise workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.bitrise.list_apps({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("bitrise"))' --json
kosmo integrations:lua --eval 'print(docs.read("bitrise.list_apps"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local bitrise = app.integrations.bitrise
local result = bitrise.list_apps({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.bitrise, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.bitrise.default.* or app.integrations.bitrise.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Bitrise, use the narrower mcp:lua command.

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.

Bitrise

Namespace: bitrise

Use the Bitrise integration to manage Bitrise CI/CD apps through API v0.1. Authentication uses a personal access token or Workspace API token passed in the Authorization header.

Common Workflows

  • Use bitrise_list_apps, bitrise_get_app, bitrise_update_app, and bitrise_delete_app to inspect and administer apps.
  • Use bitrise_register_app, bitrise_register_ssh_key, and bitrise_finish_app for the multi-step app registration flow.
  • Use bitrise_get_bitrise_yml, bitrise_upload_bitrise_yml, bitrise_get_bitrise_yml_config, and bitrise_update_bitrise_yml_config to inspect or update configuration YAML.
  • Use bitrise_trigger_build, bitrise_abort_build, bitrise_list_app_builds, bitrise_get_build, bitrise_get_build_log, and bitrise_list_archived_builds for build operations.
  • Use bitrise_register_webhook, bitrise_list_outgoing_webhooks, bitrise_create_outgoing_webhook, bitrise_update_outgoing_webhook, and bitrise_delete_outgoing_webhook for incoming and outgoing webhooks.
  • Use bitrise_list_artifacts, bitrise_get_artifact, bitrise_update_artifact, and bitrise_delete_artifact for build artifacts.
  • Use bitrise_list_secrets, bitrise_get_secret_value, bitrise_put_secret, and bitrise_delete_secret for app secrets. Bitrise only returns a secret value when it is unprotected.
  • Use bitrise_list_android_keystore_files, bitrise_create_android_keystore_file, and bitrise_delete_android_keystore_file for Android signing files.
  • Use bitrise_api_get, bitrise_api_post, bitrise_api_put, bitrise_api_patch, and bitrise_api_delete for safe relative paths not covered by first-class tools. Full URLs are rejected.

Argument Notes

Most app-scoped tools require app_slug. Build-scoped tools require app_slug and build_slug. Artifact tools also require artifact_slug; outgoing webhook tools use webhook_slug; Android keystore deletion uses file_slug; secret tools use secret_name.

Read tools accept optional filters and pagination via query. Write tools accept the Bitrise JSON body through payload.

Examples

local apps = tools.bitrise_list_apps({
  query = { limit = 20 }
})

local build = tools.bitrise_trigger_build({
  app_slug = "app-slug",
  payload = {
    hook_info = { type = "bitrise" },
    build_params = {
      branch = "main",
      workflow_id = "primary"
    }
  }
})

local log = tools.bitrise_get_build_log({
  app_slug = "app-slug",
  build_slug = "build-slug"
})

local secret = tools.bitrise_put_secret({
  app_slug = "app-slug",
  secret_name = "DEPLOY_TOKEN",
  payload = {
    value = "dummy-token",
    is_protected = true,
    expand_in_step_inputs = true
  }
})

Return Shapes

The integration returns decoded Bitrise JSON responses directly. Empty successful responses are normalized to:

{"success": true}

Text responses are normalized to:

{"value": "raw response text"}

Some Bitrise endpoints require owner/admin roles on the app team, and older archived build data has separate endpoints. When Bitrise returns an HTTP error, the tool returns that as an error instead of fabricating a successful response.

Raw agent markdown
# Bitrise

Namespace: `bitrise`

Use the Bitrise integration to manage Bitrise CI/CD apps through API v0.1. Authentication uses a personal access token or Workspace API token passed in the `Authorization` header.

## Common Workflows

- Use `bitrise_list_apps`, `bitrise_get_app`, `bitrise_update_app`, and `bitrise_delete_app` to inspect and administer apps.
- Use `bitrise_register_app`, `bitrise_register_ssh_key`, and `bitrise_finish_app` for the multi-step app registration flow.
- Use `bitrise_get_bitrise_yml`, `bitrise_upload_bitrise_yml`, `bitrise_get_bitrise_yml_config`, and `bitrise_update_bitrise_yml_config` to inspect or update configuration YAML.
- Use `bitrise_trigger_build`, `bitrise_abort_build`, `bitrise_list_app_builds`, `bitrise_get_build`, `bitrise_get_build_log`, and `bitrise_list_archived_builds` for build operations.
- Use `bitrise_register_webhook`, `bitrise_list_outgoing_webhooks`, `bitrise_create_outgoing_webhook`, `bitrise_update_outgoing_webhook`, and `bitrise_delete_outgoing_webhook` for incoming and outgoing webhooks.
- Use `bitrise_list_artifacts`, `bitrise_get_artifact`, `bitrise_update_artifact`, and `bitrise_delete_artifact` for build artifacts.
- Use `bitrise_list_secrets`, `bitrise_get_secret_value`, `bitrise_put_secret`, and `bitrise_delete_secret` for app secrets. Bitrise only returns a secret value when it is unprotected.
- Use `bitrise_list_android_keystore_files`, `bitrise_create_android_keystore_file`, and `bitrise_delete_android_keystore_file` for Android signing files.
- Use `bitrise_api_get`, `bitrise_api_post`, `bitrise_api_put`, `bitrise_api_patch`, and `bitrise_api_delete` for safe relative paths not covered by first-class tools. Full URLs are rejected.

## Argument Notes

Most app-scoped tools require `app_slug`. Build-scoped tools require `app_slug` and `build_slug`. Artifact tools also require `artifact_slug`; outgoing webhook tools use `webhook_slug`; Android keystore deletion uses `file_slug`; secret tools use `secret_name`.

Read tools accept optional filters and pagination via `query`. Write tools accept the Bitrise JSON body through `payload`.

## Examples

```lua
local apps = tools.bitrise_list_apps({
  query = { limit = 20 }
})

local build = tools.bitrise_trigger_build({
  app_slug = "app-slug",
  payload = {
    hook_info = { type = "bitrise" },
    build_params = {
      branch = "main",
      workflow_id = "primary"
    }
  }
})

local log = tools.bitrise_get_build_log({
  app_slug = "app-slug",
  build_slug = "build-slug"
})

local secret = tools.bitrise_put_secret({
  app_slug = "app-slug",
  secret_name = "DEPLOY_TOKEN",
  payload = {
    value = "dummy-token",
    is_protected = true,
    expand_in_step_inputs = true
  }
})
```

## Return Shapes

The integration returns decoded Bitrise JSON responses directly. Empty successful responses are normalized to:

```json
{"success": true}
```

Text responses are normalized to:

```json
{"value": "raw response text"}
```

Some Bitrise endpoints require owner/admin roles on the app team, and older archived build data has separate endpoints. When Bitrise returns an HTTP error, the tool returns that as an error instead of fabricating a successful response.
Metadata-derived Lua example
local result = app.integrations.bitrise.list_apps({})
print(result)

Functions

list_apps Read

List accessible Bitrise apps.

Lua path
app.integrations.bitrise.list_apps
Full name
bitrise.bitrise_list_apps
ParameterTypeRequiredDescription
No parameters.
register_app Write

Register a new Bitrise app.

Lua path
app.integrations.bitrise.register_app
Full name
bitrise.bitrise_register_app
ParameterTypeRequiredDescription
No parameters.
get_app Read

Get one Bitrise app.

Lua path
app.integrations.bitrise.get_app
Full name
bitrise.bitrise_get_app
ParameterTypeRequiredDescription
No parameters.
update_app Write

Update app settings.

Lua path
app.integrations.bitrise.update_app
Full name
bitrise.bitrise_update_app
ParameterTypeRequiredDescription
No parameters.
delete_app Write

Delete one Bitrise app.

Lua path
app.integrations.bitrise.delete_app
Full name
bitrise.bitrise_delete_app
ParameterTypeRequiredDescription
No parameters.
get_yml Read

Get app configuration YAML.

Lua path
app.integrations.bitrise.get_yml
Full name
bitrise.bitrise_get_bitrise_yml
ParameterTypeRequiredDescription
No parameters.
upload_yml Write

Upload app configuration YAML.

Lua path
app.integrations.bitrise.upload_yml
Full name
bitrise.bitrise_upload_bitrise_yml
ParameterTypeRequiredDescription
No parameters.
get_yaml_config Read

Get bitrise.yml storage configuration.

Lua path
app.integrations.bitrise.get_yaml_config
Full name
bitrise.bitrise_get_bitrise_yml_config
ParameterTypeRequiredDescription
No parameters.
update_yaml_config Write

Update bitrise.yml storage configuration.

Lua path
app.integrations.bitrise.update_yaml_config
Full name
bitrise.bitrise_update_bitrise_yml_config
ParameterTypeRequiredDescription
No parameters.
list_branches Read

List repository branches for an app.

Lua path
app.integrations.bitrise.list_branches
Full name
bitrise.bitrise_list_branches
ParameterTypeRequiredDescription
No parameters.
register_ssh_key Write

Register app SSH key data.

Lua path
app.integrations.bitrise.register_ssh_key
Full name
bitrise.bitrise_register_ssh_key
ParameterTypeRequiredDescription
No parameters.
finish_app Write

Finish app registration.

Lua path
app.integrations.bitrise.finish_app
Full name
bitrise.bitrise_finish_app
ParameterTypeRequiredDescription
No parameters.
list_workspace_apps Read

List apps for a Workspace.

Lua path
app.integrations.bitrise.list_workspace_apps
Full name
bitrise.bitrise_list_organization_apps
ParameterTypeRequiredDescription
No parameters.
list_user_apps Read

List apps for a user.

Lua path
app.integrations.bitrise.list_user_apps
Full name
bitrise.bitrise_list_user_apps
ParameterTypeRequiredDescription
No parameters.
get_role_groups Read

List groups assigned to an app role.

Lua path
app.integrations.bitrise.get_role_groups
Full name
bitrise.bitrise_get_role_groups
ParameterTypeRequiredDescription
No parameters.
set_role_groups Write

Replace groups assigned to an app role.

Lua path
app.integrations.bitrise.set_role_groups
Full name
bitrise.bitrise_set_role_groups
ParameterTypeRequiredDescription
No parameters.
update_email_notifications Write

Update app email notification settings.

Lua path
app.integrations.bitrise.update_email_notifications
Full name
bitrise.bitrise_update_email_notifications
ParameterTypeRequiredDescription
No parameters.
migrate_user_app_machines Write

Migrate user-owned app machine types.

Lua path
app.integrations.bitrise.migrate_user_app_machines
Full name
bitrise.bitrise_migrate_user_app_machine_types
ParameterTypeRequiredDescription
No parameters.
migrate_workspace_app_machines Write

Migrate Workspace-owned app machine types.

Lua path
app.integrations.bitrise.migrate_workspace_app_machines
Full name
bitrise.bitrise_migrate_organization_app_machine_types
ParameterTypeRequiredDescription
No parameters.
trigger_build Write

Trigger a new app build.

Lua path
app.integrations.bitrise.trigger_build
Full name
bitrise.bitrise_trigger_build
ParameterTypeRequiredDescription
No parameters.
abort_build Write

Abort a running app build.

Lua path
app.integrations.bitrise.abort_build
Full name
bitrise.bitrise_abort_build
ParameterTypeRequiredDescription
No parameters.
list_app_builds Read

List recent app builds.

Lua path
app.integrations.bitrise.list_app_builds
Full name
bitrise.bitrise_list_app_builds
ParameterTypeRequiredDescription
No parameters.
list_archived_builds Read

List archived app builds.

Lua path
app.integrations.bitrise.list_archived_builds
Full name
bitrise.bitrise_list_archived_builds
ParameterTypeRequiredDescription
No parameters.
list_build_workflows Read

List workflows triggered for an app.

Lua path
app.integrations.bitrise.list_build_workflows
Full name
bitrise.bitrise_list_build_workflows
ParameterTypeRequiredDescription
No parameters.
get_build Read

Get one app build.

Lua path
app.integrations.bitrise.get_build
Full name
bitrise.bitrise_get_build
ParameterTypeRequiredDescription
No parameters.
get_build_yaml Read

Get bitrise.yml used by one build.

Lua path
app.integrations.bitrise.get_build_yaml
Full name
bitrise.bitrise_get_build_bitrise_yml
ParameterTypeRequiredDescription
No parameters.
get_build_log Read

Get one build log.

Lua path
app.integrations.bitrise.get_build_log
Full name
bitrise.bitrise_get_build_log
ParameterTypeRequiredDescription
No parameters.
list_builds Read

List builds accessible to the account.

Lua path
app.integrations.bitrise.list_builds
Full name
bitrise.bitrise_list_builds
ParameterTypeRequiredDescription
No parameters.
register_webhook Write

Register an incoming app webhook.

Lua path
app.integrations.bitrise.register_webhook
Full name
bitrise.bitrise_register_webhook
ParameterTypeRequiredDescription
No parameters.
list_outgoing_webhooks Read

List outgoing app webhooks.

Lua path
app.integrations.bitrise.list_outgoing_webhooks
Full name
bitrise.bitrise_list_outgoing_webhooks
ParameterTypeRequiredDescription
No parameters.
create_outgoing_webhook Write

Create an outgoing app webhook.

Lua path
app.integrations.bitrise.create_outgoing_webhook
Full name
bitrise.bitrise_create_outgoing_webhook
ParameterTypeRequiredDescription
No parameters.
update_outgoing_webhook Write

Update an outgoing app webhook.

Lua path
app.integrations.bitrise.update_outgoing_webhook
Full name
bitrise.bitrise_update_outgoing_webhook
ParameterTypeRequiredDescription
No parameters.
delete_outgoing_webhook Write

Delete an outgoing app webhook.

Lua path
app.integrations.bitrise.delete_outgoing_webhook
Full name
bitrise.bitrise_delete_outgoing_webhook
ParameterTypeRequiredDescription
No parameters.
list_artifacts Read

List build artifacts.

Lua path
app.integrations.bitrise.list_artifacts
Full name
bitrise.bitrise_list_artifacts
ParameterTypeRequiredDescription
No parameters.
get_artifact Read

Get one build artifact.

Lua path
app.integrations.bitrise.get_artifact
Full name
bitrise.bitrise_get_artifact
ParameterTypeRequiredDescription
No parameters.
update_artifact Write

Update one build artifact.

Lua path
app.integrations.bitrise.update_artifact
Full name
bitrise.bitrise_update_artifact
ParameterTypeRequiredDescription
No parameters.
delete_artifact Write

Delete one build artifact.

Lua path
app.integrations.bitrise.delete_artifact
Full name
bitrise.bitrise_delete_artifact
ParameterTypeRequiredDescription
No parameters.
list_secrets Read

List app secrets.

Lua path
app.integrations.bitrise.list_secrets
Full name
bitrise.bitrise_list_secrets
ParameterTypeRequiredDescription
No parameters.
get_secret_value Read

Get an unprotected secret value.

Lua path
app.integrations.bitrise.get_secret_value
Full name
bitrise.bitrise_get_secret_value
ParameterTypeRequiredDescription
No parameters.
put_secret Write

Create or update an app secret.

Lua path
app.integrations.bitrise.put_secret
Full name
bitrise.bitrise_put_secret
ParameterTypeRequiredDescription
No parameters.
delete_secret Write

Delete an app secret.

Lua path
app.integrations.bitrise.delete_secret
Full name
bitrise.bitrise_delete_secret
ParameterTypeRequiredDescription
No parameters.
list_android_keystores Read

List Android keystore files.

Lua path
app.integrations.bitrise.list_android_keystores
Full name
bitrise.bitrise_list_android_keystore_files
ParameterTypeRequiredDescription
No parameters.
create_android_keystore Write

Create an Android keystore upload record.

Lua path
app.integrations.bitrise.create_android_keystore
Full name
bitrise.bitrise_create_android_keystore_file
ParameterTypeRequiredDescription
No parameters.
delete_android_keystore Write

Delete an Android keystore file.

Lua path
app.integrations.bitrise.delete_android_keystore
Full name
bitrise.bitrise_delete_android_keystore_file
ParameterTypeRequiredDescription
No parameters.
api_get Read

Call a safe relative Bitrise GET path.

Lua path
app.integrations.bitrise.api_get
Full name
bitrise.bitrise_api_get
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call a safe relative Bitrise POST path.

Lua path
app.integrations.bitrise.api_post
Full name
bitrise.bitrise_api_post
ParameterTypeRequiredDescription
No parameters.
api_put Write

Call a safe relative Bitrise PUT path.

Lua path
app.integrations.bitrise.api_put
Full name
bitrise.bitrise_api_put
ParameterTypeRequiredDescription
No parameters.
api_patch Write

Call a safe relative Bitrise PATCH path.

Lua path
app.integrations.bitrise.api_patch
Full name
bitrise.bitrise_api_patch
ParameterTypeRequiredDescription
No parameters.
api_delete Write

Call a safe relative Bitrise DELETE path.

Lua path
app.integrations.bitrise.api_delete
Full name
bitrise.bitrise_api_delete
ParameterTypeRequiredDescription
No parameters.