productivity
Drone CI Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Drone CI KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.drone_ci.*.
Use lua_read_doc("integrations.drone-ci") 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
Drone CI workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.drone_ci.get_current_user({}))' --json kosmo integrations:lua --eval 'print(docs.read("drone-ci"))' --json
kosmo integrations:lua --eval 'print(docs.read("drone-ci.get_current_user"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local drone_ci = app.integrations.drone_ci
local result = drone_ci.get_current_user({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.drone_ci, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.drone_ci.default.* or app.integrations.drone_ci.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Drone CI, 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.
Drone CI
Namespace: drone-ci
Use the Drone CI integration to inspect and manage a Drone server through its remote API. The integration requires a Drone server URL and a user access token, then sends requests with Authorization: Bearer <token>.
Common Workflows
- Use
drone_ci_get_current_userto verify which account the token belongs to. - Use
drone_ci_list_current_user_reposanddrone_ci_sync_current_userwhen repository discovery looks stale. - Use
drone_ci_get_repo,drone_ci_enable_repo,drone_ci_update_repo,drone_ci_disable_repo,drone_ci_repair_repo, anddrone_ci_chown_repofor repository administration. - Use
drone_ci_list_builds,drone_ci_get_build,drone_ci_create_build,drone_ci_restart_build,drone_ci_stop_build,drone_ci_approve_build,drone_ci_decline_build,drone_ci_promote_build, anddrone_ci_get_build_logsfor build operations. - Use
drone_ci_list_cron,drone_ci_create_cron,drone_ci_get_cron,drone_ci_update_cron,drone_ci_delete_cron, anddrone_ci_trigger_cronfor repository cron jobs. - Use
drone_ci_list_secrets,drone_ci_create_secret,drone_ci_get_secret,drone_ci_update_secret, anddrone_ci_delete_secretfor repository secrets. Drone commonly returns secret metadata rather than secret values. - Use
drone_ci_list_usersanddrone_ci_get_useronly with tokens that have enough server privileges. - Use
drone_ci_api_get,drone_ci_api_post,drone_ci_api_patch, anddrone_ci_api_deletefor safe relative API paths not covered by first-class tools. Full URLs are rejected.
Argument Notes
Repository tools use owner and repo as separate arguments. Build tools use build for the build number. Cron and secret tools use name for the cron or secret name.
Write tools accept a payload object when the Drone API expects a JSON body. Build creation and promotion accept query-style values through either first-class keys such as branch, commit, and target, or a query object.
Examples
local user = tools.drone_ci_get_current_user({})
local builds = tools.drone_ci_list_builds({
owner = "acme",
repo = "web",
query = { branch = "main" }
})
local promoted = tools.drone_ci_promote_build({
owner = "acme",
repo = "web",
build = 42,
query = { target = "production" }
})
local secret = tools.drone_ci_create_secret({
owner = "acme",
repo = "web",
payload = {
name = "DEPLOY_TOKEN",
data = "dummy-token",
pull_request = false
}
})
Return Shapes
The integration returns decoded Drone JSON responses directly. Empty successful responses are normalized to:
{"success": true}
Text responses, such as some log responses on older deployments, are normalized to:
{"value": "raw response text"}
Self-hosted Drone deployments can differ by version and enabled features. If a route is unavailable, Drone’s HTTP error is returned as a tool error rather than silently pretending the capability exists.
Raw agent markdown
# Drone CI
Namespace: `drone-ci`
Use the Drone CI integration to inspect and manage a Drone server through its remote API. The integration requires a Drone server URL and a user access token, then sends requests with `Authorization: Bearer <token>`.
## Common Workflows
- Use `drone_ci_get_current_user` to verify which account the token belongs to.
- Use `drone_ci_list_current_user_repos` and `drone_ci_sync_current_user` when repository discovery looks stale.
- Use `drone_ci_get_repo`, `drone_ci_enable_repo`, `drone_ci_update_repo`, `drone_ci_disable_repo`, `drone_ci_repair_repo`, and `drone_ci_chown_repo` for repository administration.
- Use `drone_ci_list_builds`, `drone_ci_get_build`, `drone_ci_create_build`, `drone_ci_restart_build`, `drone_ci_stop_build`, `drone_ci_approve_build`, `drone_ci_decline_build`, `drone_ci_promote_build`, and `drone_ci_get_build_logs` for build operations.
- Use `drone_ci_list_cron`, `drone_ci_create_cron`, `drone_ci_get_cron`, `drone_ci_update_cron`, `drone_ci_delete_cron`, and `drone_ci_trigger_cron` for repository cron jobs.
- Use `drone_ci_list_secrets`, `drone_ci_create_secret`, `drone_ci_get_secret`, `drone_ci_update_secret`, and `drone_ci_delete_secret` for repository secrets. Drone commonly returns secret metadata rather than secret values.
- Use `drone_ci_list_users` and `drone_ci_get_user` only with tokens that have enough server privileges.
- Use `drone_ci_api_get`, `drone_ci_api_post`, `drone_ci_api_patch`, and `drone_ci_api_delete` for safe relative API paths not covered by first-class tools. Full URLs are rejected.
## Argument Notes
Repository tools use `owner` and `repo` as separate arguments. Build tools use `build` for the build number. Cron and secret tools use `name` for the cron or secret name.
Write tools accept a `payload` object when the Drone API expects a JSON body. Build creation and promotion accept query-style values through either first-class keys such as `branch`, `commit`, and `target`, or a `query` object.
## Examples
```lua
local user = tools.drone_ci_get_current_user({})
local builds = tools.drone_ci_list_builds({
owner = "acme",
repo = "web",
query = { branch = "main" }
})
local promoted = tools.drone_ci_promote_build({
owner = "acme",
repo = "web",
build = 42,
query = { target = "production" }
})
local secret = tools.drone_ci_create_secret({
owner = "acme",
repo = "web",
payload = {
name = "DEPLOY_TOKEN",
data = "dummy-token",
pull_request = false
}
})
```
## Return Shapes
The integration returns decoded Drone JSON responses directly. Empty successful responses are normalized to:
```json
{"success": true}
```
Text responses, such as some log responses on older deployments, are normalized to:
```json
{"value": "raw response text"}
```
Self-hosted Drone deployments can differ by version and enabled features. If a route is unavailable, Drone's HTTP error is returned as a tool error rather than silently pretending the capability exists. local result = app.integrations.drone_ci.get_current_user({})
print(result) Functions
get_current_user Read
Get authenticated Drone user.
- Lua path
app.integrations.drone_ci.get_current_user- Full name
drone-ci.drone_ci_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user_feed Read
Get current user activity feed.
- Lua path
app.integrations.drone_ci.get_current_user_feed- Full name
drone-ci.drone_ci_get_current_user_feed
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_current_user_repos Read
List repositories registered to the user.
- Lua path
app.integrations.drone_ci.list_current_user_repos- Full name
drone-ci.drone_ci_list_current_user_repos
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
sync_current_user Write
Sync user repositories from source control.
- Lua path
app.integrations.drone_ci.sync_current_user- Full name
drone-ci.drone_ci_sync_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_repo Read
Get repository details.
- Lua path
app.integrations.drone_ci.get_repo- Full name
drone-ci.drone_ci_get_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
enable_repo Write
Enable a repository in Drone.
- Lua path
app.integrations.drone_ci.enable_repo- Full name
drone-ci.drone_ci_enable_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_repo Write
Update repository settings.
- Lua path
app.integrations.drone_ci.update_repo- Full name
drone-ci.drone_ci_update_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
disable_repo Write
Disable a repository in Drone.
- Lua path
app.integrations.drone_ci.disable_repo- Full name
drone-ci.drone_ci_disable_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
repair_repo Write
Repair repository webhooks.
- Lua path
app.integrations.drone_ci.repair_repo- Full name
drone-ci.drone_ci_repair_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
chown_repo Write
Change repository ownership.
- Lua path
app.integrations.drone_ci.chown_repo- Full name
drone-ci.drone_ci_chown_repo
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_builds Read
List repository builds.
- Lua path
app.integrations.drone_ci.list_builds- Full name
drone-ci.drone_ci_list_builds
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_build Write
Create a custom build.
- Lua path
app.integrations.drone_ci.create_build- Full name
drone-ci.drone_ci_create_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_build Read
Get one build.
- Lua path
app.integrations.drone_ci.get_build- Full name
drone-ci.drone_ci_get_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
restart_build Write
Restart a build.
- Lua path
app.integrations.drone_ci.restart_build- Full name
drone-ci.drone_ci_restart_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
stop_build Write
Stop a build.
- Lua path
app.integrations.drone_ci.stop_build- Full name
drone-ci.drone_ci_stop_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
approve_build Write
Approve a blocked build.
- Lua path
app.integrations.drone_ci.approve_build- Full name
drone-ci.drone_ci_approve_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
decline_build Write
Decline a blocked build.
- Lua path
app.integrations.drone_ci.decline_build- Full name
drone-ci.drone_ci_decline_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
promote_build Write
Promote a build.
- Lua path
app.integrations.drone_ci.promote_build- Full name
drone-ci.drone_ci_promote_build
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_build_logs Read
Get build logs for a stage and step.
- Lua path
app.integrations.drone_ci.get_build_logs- Full name
drone-ci.drone_ci_get_build_logs
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_cron Read
List repository cron jobs.
- Lua path
app.integrations.drone_ci.list_cron- Full name
drone-ci.drone_ci_list_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_cron Write
Create a repository cron job.
- Lua path
app.integrations.drone_ci.create_cron- Full name
drone-ci.drone_ci_create_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_cron Read
Get one cron job.
- Lua path
app.integrations.drone_ci.get_cron- Full name
drone-ci.drone_ci_get_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_cron Write
Update one cron job.
- Lua path
app.integrations.drone_ci.update_cron- Full name
drone-ci.drone_ci_update_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_cron Write
Delete one cron job.
- Lua path
app.integrations.drone_ci.delete_cron- Full name
drone-ci.drone_ci_delete_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
trigger_cron Write
Trigger one cron job.
- Lua path
app.integrations.drone_ci.trigger_cron- Full name
drone-ci.drone_ci_trigger_cron
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_secrets Read
List repository secrets.
- Lua path
app.integrations.drone_ci.list_secrets- Full name
drone-ci.drone_ci_list_secrets
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
create_secret Write
Create repository secret.
- Lua path
app.integrations.drone_ci.create_secret- Full name
drone-ci.drone_ci_create_secret
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_secret Read
Get repository secret metadata.
- Lua path
app.integrations.drone_ci.get_secret- Full name
drone-ci.drone_ci_get_secret
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
update_secret Write
Update repository secret.
- Lua path
app.integrations.drone_ci.update_secret- Full name
drone-ci.drone_ci_update_secret
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
delete_secret Write
Delete repository secret.
- Lua path
app.integrations.drone_ci.delete_secret- Full name
drone-ci.drone_ci_delete_secret
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_users Read
List Drone users.
- Lua path
app.integrations.drone_ci.list_users- Full name
drone-ci.drone_ci_list_users
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_user Read
Get one Drone user.
- Lua path
app.integrations.drone_ci.get_user- Full name
drone-ci.drone_ci_get_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_get Read
Call a safe relative Drone GET path.
- Lua path
app.integrations.drone_ci.api_get- Full name
drone-ci.drone_ci_api_get
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_post Write
Call a safe relative Drone POST path.
- Lua path
app.integrations.drone_ci.api_post- Full name
drone-ci.drone_ci_api_post
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_patch Write
Call a safe relative Drone PATCH path.
- Lua path
app.integrations.drone_ci.api_patch- Full name
drone-ci.drone_ci_api_patch
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
api_delete Write
Call a safe relative Drone DELETE path.
- Lua path
app.integrations.drone_ci.api_delete- Full name
drone-ci.drone_ci_api_delete
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||