### Get Full Schema for a Tilt API Resource Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use `tilt explain ` to get the full schema and description for any API resource kind. You can also use `tilt explain .` to get details about specific fields. ```bash tilt explain cmd # KIND: Cmd # VERSION: tilt.dev/v1alpha1 # DESCRIPTION: # Cmd represents a process on the host machine. tilt explain cmd.spec.args ``` -------------------------------- ### Apply Kubernetes Configuration with Custom Command Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use a custom deploy command, such as Helm, to apply Kubernetes resources. This example shows how to configure Helm upgrade/install. ```bash cat <` to get a human-readable description of a specific `Cmd` resource, including its current status and running details. ```bash # Describe a specific Cmd in human-readable form tilt describe cmd server:run # Status: # Ready: true # Running: # Pid: 42301 # Started At: 2024-01-15T10:00:05.123456Z ``` -------------------------------- ### Get Cmd Resource as JSON Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use `tilt get cmd -o json` to retrieve the machine-readable JSON representation of a `Cmd` resource. This is useful for automation and scripting. ```bash # Get machine-readable JSON for automation tilt get cmd server:run -o json # { # "apiVersion": "tilt.dev/v1alpha1", # "kind": "Cmd", # "metadata": { "name": "server:run" }, # "spec": { # "args": ["go", "run", "./cmd/server"], # "dir": "/home/user/myproject", # "env": ["PORT=8080", "DEBUG=true"], # "readinessProbe": { # "httpGet": { "host": "localhost", "port": 8080, "path": "/healthz" }, # "periodSeconds": 5 # }, # "restartOn": { # "fileWatches": ["src:watch"], # "uiButtons": ["server:restart-btn"] # } # }, # "status": { # "ready": true, # "running": { "pid": 42301, "startedAt": "2024-01-15T10:00:05.123456Z" } # } # } ``` -------------------------------- ### List All Cmd Objects with Tilt Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use `tilt get cmd` to list all `Cmd` objects in the current Tilt environment. This command displays the name and creation timestamp for each command. ```bash # List all Cmd objects in the current environment tilt get cmd # NAME CREATED AT # server:run 2024-01-15T10:00:00Z # migrate:db 2024-01-15T10:00:01Z ``` -------------------------------- ### Get Session Resource as JSON Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use `tilt get session -o json` to retrieve the JSON representation of the current `Session`. This provides a top-level view of the Tilt process, including its PID, start time, and exit condition. ```bash # Get the current session (there is always exactly one) tilt get session -o json # { # "apiVersion": "tilt.dev/v1alpha1", # "kind": "Session", # "metadata": { "name": "Tiltfile" }, # "spec": { # "tiltfilePath": "/home/user/myproject/Tiltfile", # "exitCondition": "manual" # }, # "status": { # "pid": 12345, # "startTime": "2024-01-15T09:59:50.000000Z", # "done": false, # } # } ``` -------------------------------- ### Tilt Get with Format Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/index.md Retrieves specific information about an object instance in a machine-readable format, such as JSONPath. ```APIDOC ## tilt get [NAME] -o [FORMAT] ### Description Provides machine-readable information about an object instance. ### Usage ```bash tilt get cmd gendocs:update -o jsonpath --template "{.metadata.name} {.status.ready} " ``` ### Output Example ``` gendocs:update true ``` ``` -------------------------------- ### Get Cmd objects Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Retrieves Cmd objects, which represent local host processes managed by Tilt. ```APIDOC ## Get Cmd Objects ### Description Retrieves Cmd objects, representing local host processes managed by Tilt. You can list all Cmds or a specific one by name. ### Method CLI Command ### Endpoint `tilt get cmd [name]` ### Parameters #### Path Parameters - **name** (string) - Optional - The name of the specific Cmd object to retrieve (e.g., `server:run`). If omitted, lists all Cmd objects. #### Query Parameters - **-o json** (string) - Optional - Output the result in JSON format. - **-o jsonpath** (string) - Optional - Output specific fields using JSONPath. ### Request Example ```bash # List all Cmd objects tilt get cmd # Describe a specific Cmd tilt describe cmd server:run # Get Cmd in JSON format tilt get cmd server:run -o json # Get specific fields using jsonpath tilt get cmd server:run -o jsonpath --template "{.status.ready}{\'\n\'}" ``` ### Response Example (JSON) ```json { "apiVersion": "tilt.dev/v1alpha1", "kind": "Cmd", "metadata": { "name": "server:run" }, "spec": { "args": ["go", "run", "./cmd/server"], "dir": "/home/user/myproject", "env": ["PORT=8080", "DEBUG=true"], "readinessProbe": { "httpGet": { "host": "localhost", "port": 8080, "path": "/healthz" }, "periodSeconds": 5 }, "restartOn": { "fileWatches": ["src:watch"], "uiButtons": ["server:restart-btn"] } }, "status": { "ready": true, "running": { "pid": 42301, "startedAt": "2024-01-15T10:00:05.123456Z" } } } ``` ``` -------------------------------- ### Cmd Resource Definition Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/core/cmd-v1alpha1.md Defines a Cmd resource, specifying how to run a local command on the host machine. This includes command arguments, working directory, environment variables, and conditions for starting or restarting the process. ```APIDOC ## Cmd Resource ### Description Cmd represents a process on the host machine. When the process exits, Tilt will attempt to kill any spawned descendant processes. ### Fields - **apiVersion** (string): tilt.dev/v1alpha1 - **kind** (string): Cmd - **metadata** (ObjectMeta): Standard Kubernetes object metadata. - **spec** (CmdSpec): Specification for running the command. - **status** (CmdStatus): Current status of the command process. ``` ```APIDOC ## CmdSpec ### Description CmdSpec defines how to run a local command. ### Fields - **args** ([]string): Command-line arguments. Must have length at least 1. - **dir** (string): Process working directory. Defaults to the Tilt working directory if not specified. - **disableSource** (DisableSource): Specifies how to disable this command. - **env** ([]string): Additional environment variables for the process. Expressed as a C-style array of strings (e.g., ["KEY1=VALUE1", "KEY2=VALUE2"]). These are layered on top of Tilt's environment variables. - **readinessProbe** (Probe): Periodic probe of service readiness. - **restartOn** (RestartOnSpec): Indicates objects that can trigger a restart of this command. Tilt will attempt a graceful shutdown before restarting. - **startOn** (StartOnSpec): Indicates objects that can trigger a start or restart of this command. The command will not run until its StartOn conditions are met. ``` ```APIDOC ## DisableSource Types ### Description Specifies how a resource can be disabled. #### ConfigMapDisableSource - **key** (string), required: The key in the ConfigMap where the enable/disable state is stored. - **name** (string), required: The name of the ConfigMap. #### DisableSource - **configMap** (ConfigMapDisableSource): Disabled by a single ConfigMap value. - **everyConfigMap** ([]ConfigMapDisableSource): Disabled if all specified ConfigMap values indicate disabled. ``` ```APIDOC ## RestartOnSpec ### Description RestartOnSpec indicates the set of objects that can trigger a restart of this object. ### Fields - **fileWatches** ([]string): FileWatches that can trigger a restart. - **uiButtons** ([]string): UIButtons that can trigger a restart. ``` ```APIDOC ## StartOnSpec ### Description StartOnSpec indicates the set of objects that can trigger a start/restart of this object. ### Fields - **uiButtons** ([]string), required: UIButtons that can trigger a start/restart. - **startAfter** (Time): StartAfter indicates that events before this time should be ignored. ``` -------------------------------- ### Get Current Tilt Version Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Retrieve the currently running version of Tilt. This information is part of the global Tilt session status and is useful for diagnostics and compatibility checks. ```bash tilt get uisession -o jsonpath --template "{.status.runningTiltBuild.version}{\'\n'}" ``` ```bash # 0.33.5 ``` -------------------------------- ### Inspect a FileWatch Resource Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt This command retrieves detailed information about a FileWatch resource, including its configuration, monitor start time, last event time, and a list of file events. This is useful for understanding what files are being monitored and when changes occurred. ```bash tilt get filewatch src:watch -o json ``` -------------------------------- ### Use ConfigMap to Disable a Cmd Resource Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt This example shows how to use a ConfigMap key to conditionally disable a Cmd resource. The Cmd will only be active if the specified ConfigMap key has a truthy value. ```bash cat < -o jsonpath --template` to extract specific fields from a `Cmd` resource for scripting. This allows precise data retrieval for automation. ```bash # Use jsonpath to extract specific fields for scripting tilt get cmd server:run -o jsonpath --template "{.status.ready}{\'\n'}" # true tilt get cmd server:run -o jsonpath --template "{.status.running.pid}{\'\n'}" # 42301 ``` -------------------------------- ### List Available API Resources Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/index.md Prints all objects supported by the current Tilt environment. Useful for understanding the API surface. ```bash tilt api-resources ``` -------------------------------- ### TargetStateWaiting Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/core/session-v1alpha1.md TargetStateWaiting indicates that a target has been enqueued for execution but has not yet started. ```APIDOC ## TargetStateWaiting TargetStateWaiting is a target that has been enqueued for execution but has not yet started. - **waitReason** (string), required WaitReason is a description for why the target is waiting and not yet active. This is NOT the "cause" or "trigger" for the target being invoked. ``` -------------------------------- ### Apply Cmd manifest Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Applies a Cmd manifest directly to the Tilt environment. ```APIDOC ## Apply Cmd Manifest ### Description Applies a Cmd manifest directly to the Tilt environment. This is an advanced usage for creating or updating Cmd resources. ### Method CLI Command ### Endpoint `tilt apply -f -` ### Request Body ```yaml apiVersion: tilt.dev/v1alpha1 kind: Cmd metadata: name: [cmd_name] spec: args: [string] dir: [string] env: [string] # ... other spec fields ``` ### Request Example ```bash cat < *ExecAction describes a "run in container" action.* - **exec.command** ([]string) Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. - **failureThreshold** (int32) Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. - **httpGet** (HTTPGetAction) HTTPGet specifies the http request to perform. *HTTPGetAction describes an action based on HTTP Get requests.* - **httpGet.port** (int32), required Name or number of the port to access on the container. Number must be in the range 1 to 65535. - **httpGet.host** (string) Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. - **httpGet.httpHeaders** ([]HTTPHeader) Custom headers to set in the request. HTTP allows repeated headers. *HTTPHeader describes a custom header to be used in HTTP probes* - **httpGet.httpHeaders.name** (string), required The header field name - **httpGet.httpHeaders.value** (string), required The header field value - **httpGet.path** (string) Path to access on the HTTP server. - **httpGet.scheme** (string) Scheme to use for connecting to the host. Defaults to HTTP. - **initialDelaySeconds** (int32) Number of seconds after the container has started before liveness probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes - **periodSeconds** (int32) How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. - **successThreshold** (int32) Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. - **tcpSocket** (TCPSocketAction) TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported *TCPSocketAction describes an action based on opening a socket* - **tcpSocket.port** (int32), required Number or name of the port to access on the container. Number must be in the range 1 to 65535. - **tcpSocket.host** (string) Optional: Host name to connect to, defaults to the pod IP. - **timeoutSeconds** (int32) Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes ``` -------------------------------- ### Explain API Object Schema Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/index.md Retrieves documentation for a specific API object kind. Use this to understand the structure and purpose of objects like `Cmd`. ```bash tilt explain cmd ``` -------------------------------- ### Get UIButton Last Clicked Timestamp Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Retrieve the timestamp indicating when a specific UIButton was last clicked. This is useful for triggering subsequent actions based on user interaction. ```bash tilt get uibutton backend:seed-db-btn -o jsonpath --template "{.status.lastClickedAt}{\'\n'}" ``` ```bash # 2024-01-15T10:12:34.567890Z ``` -------------------------------- ### Extension Resource Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/core/extension-v1alpha1.md Defines an extension that's evaluated on Tilt startup. It includes fields for apiVersion, kind, metadata, spec, and status. ```APIDOC ## Extension v1alpha1 ### Description Extension defines an extension that's evaluated on Tilt startup. ### Fields - **apiVersion**: tilt.dev/v1alpha1 - **kind**: Extension - **metadata**: ([ObjectMeta](../meta/object-meta#ObjectMeta)) - **spec**: ([ExtensionSpec](../core/extension-v1alpha1#ExtensionSpec)) - **status**: ([ExtensionStatus](../core/extension-v1alpha1#ExtensionStatus)) ``` -------------------------------- ### Inspect KubernetesApply Object Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Examine the details of a KubernetesApply object, including the YAML to be applied and image map references. ```bash tilt get kubernetesapply backend:apply -o json ``` -------------------------------- ### Initialize Pagefind UI for Search Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/search.html This script initializes the Pagefind UI for search functionality. It pre-populates the search box with any existing query parameters and triggers an initial search. JavaScript must be enabled for this to work. ```javascript window.addEventListener('DOMContentLoaded', (event) => { const searchEl = document.getElementById('q'); let searchVal = ''; if (searchEl) { try { const urlParams = new URLSearchParams(window.location.search); searchVal = urlParams.get('q'); searchEl.value = urlParams.get('q'); } catch { // just ignore, search box won't be pre-populated but it's ok } } let ui = new PagefindUI({ element: "#pagefind-search", showSubResults: false, showImages: false, }); ui.triggerSearch(searchVal); }); ``` -------------------------------- ### KubernetesApplyList Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/kubernetes/kubernetes-apply-v1alpha1.md Represents a list of KubernetesApply resources. ```APIDOC ## KubernetesApplyList KubernetesApplyList ### Fields - **apiVersion** (string) tilt.dev/v1alpha1 - **kind** (string) KubernetesApplyList - **metadata** ([ListMeta](../meta/list-meta#ListMeta)) - **items** ([][KubernetesApply](../kubernetes/kubernetes-apply-v1alpha1#KubernetesApply)), required ``` -------------------------------- ### Get Local Port from Port Forward Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Retrieve the specific local port assigned to a port forward. This is particularly useful when `localPort` is set to 0, and a random port is dynamically allocated. ```bash tilt get portforward backend:portforward -o jsonpath --template "{.status.forwardStatuses[0].localPort}{\'\n'}" ``` ```bash # 8080 ``` -------------------------------- ### Get Last Event Time from FileWatch Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt This command extracts the timestamp of the last file event recorded by a FileWatch resource. This can be used as a watermark for external systems that need to poll for changes. ```bash tilt get filewatch src:watch -o jsonpath \ --template "{.status.lastEventTime}{\'\n\'}" ``` -------------------------------- ### Run Tilt Locally Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/README.md To run the Tilt API locally, execute this command in your terminal. Tilt will manage the API within a container. ```bash tilt up ``` -------------------------------- ### Explain a resource kind Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Retrieves the full schema and description for a specific resource kind. ```APIDOC ## Explain Resource Kind ### Description Gets the full schema and description for a given resource kind. ### Method CLI Command ### Endpoint `tilt explain [resource_kind]` ### Parameters #### Path Parameters - **resource_kind** (string) - Required - The name of the resource kind to explain (e.g., `cmd`, `session`). ### Request Example ```bash tilt explain cmd ``` ### Response Example ``` KIND: Cmd VERSION: tilt.dev/v1alpha1 DESCRIPTION: Cmd represents a process on the host machine. ``` ``` -------------------------------- ### pretty Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/common-parameters/common-parameters.md If 'true', then the output is pretty printed. ```APIDOC ## pretty ### Description If 'true', then the output is pretty printed. ### Parameter Type Query Parameter ``` -------------------------------- ### Get Full UISession Status Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Fetch the complete status object for the current Tilt session, which includes details about the running Tilt version, TiltCloud connection, feature flags, and any fatal errors. ```bash tilt get uisession -o json ``` ```json { "status": { ``` -------------------------------- ### DockerImage Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/container-images/docker-image-v1alpha1.md Represents a Docker image build configuration. This resource defines how to build an image using Docker, including the image reference, build context, Dockerfile content, and various build options. ```APIDOC ## DockerImage DockerImage describes an image to build with Docker. ### Fields - **apiVersion** (string): tilt.dev/v1alpha1 - **kind** (string): DockerImage - **metadata** (ObjectMeta): Standard Kubernetes metadata. - **spec** (DockerImageSpec): The specification for building the Docker image. - **status** (DockerImageStatus): The current status of the Docker image build. ``` -------------------------------- ### TiltfileList Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/core/tiltfile-v1alpha1.md Represents a list of Tiltfile resources. ```APIDOC ## TiltfileList API ### Description TiltfileList represents a list of Tiltfile resources. ### Resource Definition - **apiVersion**: tilt.dev/v1alpha1 - **kind**: TiltfileList - **metadata**: ([ListMeta](../meta/list-meta#ListMeta)) - **items** ([][Tiltfile](../core/tiltfile-v1alpha1#Tiltfile)) - Required ``` -------------------------------- ### List available API resources Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Lists all object kinds registered in the running API server, showing short names, API version, and whether the resource is namespaced. ```APIDOC ## List API Resources ### Description Lists all resource types available in the Tilt API server. ### Method CLI Command ### Endpoint `tilt api-resources` ### Request Example ```bash tilt api-resources ``` ### Response Example ``` NAME SHORTNAMES APIVERSION NAMESPACED KIND cmds tilt.dev/v1alpha1 false Cmd configmaps cm tilt.dev/v1alpha1 false ConfigMap dockerimages tilt.dev/v1alpha1 false DockerImage kubernetesapplys tilt.dev/v1alpha1 false KubernetesApply sessions tilt.dev/v1alpha1 false Session ``` ``` -------------------------------- ### FileWatch Resource Source: https://github.com/tilt-dev/api.tilt.dev/blob/main/docs/core/file-watch-v1alpha1.md Represents a file watch configuration in Tilt. ```APIDOC ## FileWatch FileWatch defines the desired state of FileWatch. ### API Version `tilt.dev/v1alpha1` ### Kind `FileWatch` ### Metadata ([ObjectMeta](../meta/object-meta#ObjectMeta)) ### Spec ([FileWatchSpec](../core/file-watch-v1alpha1#FileWatchSpec)) ### Status ([FileWatchStatus](../core/file-watch-v1alpha1#FileWatchStatus)) ``` -------------------------------- ### Common Query Parameters Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt All list endpoints support standard Kubernetes-style query parameters for filtering, pagination, and change-watching. These parameters function identically whether accessed via the CLI or the HTTP API. ```APIDOC ## Common Query Parameters All list endpoints support standard Kubernetes-style query parameters for filtering, pagination, and change-watching. These work identically whether you use the CLI or the HTTP API directly. ### Filter by label selector ```bash tilt get cmd -l app=backend ``` ### Limit list results and paginate with continue token ```bash curl "http://localhost:10350/apis/tilt.dev/v1alpha1/cmds?limit=5" | \ python3 -m json.tool # { "metadata": { "continue": "" }, "items": [...] } curl "http://localhost:10350/apis/tilt.dev/v1alpha1/cmds?limit=5&continue=" ``` ### Watch for changes in real time (long-poll stream) ```bash curl "http://localhost:10350/apis/tilt.dev/v1alpha1/sessions?watch=true" # {"type":"ADDED","object":{...}} # {"type":"MODIFIED","object":{...}} ``` ### Dry-run an apply without persisting ```bash curl -X POST http://localhost:10350/apis/tilt.dev/v1alpha1/configmaps \ -H 'Content-Type: application/json' \ -d '{"apiVersion":"tilt.dev/v1alpha1","kind":"ConfigMap","metadata":{"name":"test"},"data":{"key":"val"}}' \ '?dryRun=All' ``` ### Pin a list to a specific resource version for consistency ```bash curl "http://localhost:10350/apis/tilt.dev/v1alpha1/cmds?resourceVersion=12345&resourceVersionMatch=Exact" ``` ``` -------------------------------- ### Pin Tilt API List to Specific Resource Version Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Ensure consistency by pinning a list operation to a specific resource version using 'resourceVersion' and 'resourceVersionMatch'. ```bash # Pin a list to a specific resource version for consistency curl "http://localhost:10350/apis/tilt.dev/v1alpha1/cmds?resourceVersion=12345&resourceVersionMatch=Exact" ``` -------------------------------- ### Create or Update a ConfigMap Source: https://context7.com/tilt-dev/api.tilt.dev/llms.txt Use this command to create a new ConfigMap or update an existing one. ConfigMaps are used to share arbitrary key/value string data between controllers and can gate the activation of other resources. ```bash cat <