Skip to content

Instantly share code, notes, and snippets.

@gabrielfeo
gabrielfeo / .tag-ai-agent-gradle-builds.md
Last active September 9, 2025 16:26
tag-ai-agent-gradle-builds

The simplest way to distinguish AI agent builds is to simply ask. Observability and rich performance insights for both agent and human builds is possible with [Develocity][0] Build Scans®.

Why?

Tracking them is the first step to managing their impact on performance, cost, and quality. They still represent infrastructure usage and developer wait time. Read the whitepaper: [GenAI Won't Replace Your Continuous Delivery Pipeline — It Will Stress It][1].

How?

Ask agents via an instructions file to export or prefix their commands with a variable, then tag build scans accordingly. This approach works universally, even if some tools may offer other options (e.g. VS Code's [agent terminal profile settings][3]).

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gabrielfeo
gabrielfeo / acc-duration-by-task-path.main.kts
Last active August 28, 2025 17:40
Get the accumulated duration of specific tasks from a Develocity Build Scan, using its REST API
#!/usr/bin/env kotlin
@file:DependsOn("com.gabrielfeo:develocity-api-kotlin:2024.3.0")
import com.gabrielfeo.develocity.api.*
import kotlinx.coroutines.runBlocking
val buildScanId = requireNotNull(args.getOrNull(0)) { "Expected arg 0: build scan ID" }
val taskPaths = System.`in`.bufferedReader().lineSequence()
@gabrielfeo
gabrielfeo / CopyWithNotes.gs
Created August 18, 2025 19:23
Google Apps Script for copying content and note of multiple cells in Google Sheets. AI-generated.
/**
* @fileoverview A robust, self-contained Google Apps Script for copying
* the content and comments of multiple selected cells to the clipboard
* in a TSV (Tab-Separated Value) format. This version is built as an
* add-on and includes a custom HTML escape function for resilience.
*/
/**
* Creates a custom add-on menu in the spreadsheet UI when the sheet is opened.
* Using createAddonMenu() places the menu in the "Extensions > Add-ons" section,
@gabrielfeo
gabrielfeo / all-cache-artifacts-sorted.main.kts
Last active July 9, 2025 15:49
Get build cache artifacts of a given build scan from a Develocity instance. One script will get only build cache artifacts of Task executions, while the other will get all cache artifacts including of 'artifact transform' operations.
#!/usr/bin/env kotlin
/*
This script demonstrates how to retrieve the cache artifacts that were created for Task and
artifact transform outputs as part of a given build, sorted by size (bytes) descending, using the
Develocity REST API to fetch build information.
(https://docs.gradle.com/develocity/api-manual/)
DISCLAIMER: develocity-api-kotlin is a third-party library, not an official Gradle product.
(https://github.com/gabrielfeo/develocity-api-kotlin)
@gabrielfeo
gabrielfeo / last-publish-by-user-specific-users.main.kts
Last active July 9, 2025 14:19
Get time of last published build scan by user from a Develocity instance. Prefer the "*-specific-users.main.kts" variant if your usernames are known beforehand or are predictable (e.g. derived from the user's work email address), as it'll be much faster.
#!/usr/bin/env kotlin
/*
This script demonstrates how to retrieve the last published build time for each user
provided via stdin, using the Develocity REST API to fetch build information.
(https://docs.gradle.com/develocity/api-manual/)
DISCLAIMER: develocity-api-kotlin is a third-party library, not an official Gradle product.
(https://github.com/gabrielfeo/develocity-api-kotlin)
@gabrielfeo
gabrielfeo / settings.gradle.kts
Created March 21, 2025 18:01
Capture free disk space to a custom value
import java.nio.file.FileSystems
develocity {
buildScan {
background {
FileSystems.getDefault().getFileStores().forEach {
value("Free space: ${it.name()}", "${it.usableSpace}/${it.totalSpace}")
}
}
}
@gabrielfeo
gabrielfeo / captureFingerprints.gradle
Last active March 13, 2025 18:52 — forked from ghale/captureFingerprints.gradle
Capture task classpath fingerprints in a configuration cache–compatible way
def fingerprinter = services.get(org.gradle.internal.fingerprint.classpath.ClasspathFingerprinter)
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { task ->
def objectFactory = task.project.objects
def buildScan = rootProject.buildScan
doFirst {
ClassLoader classLoader = task.getClass().classLoader
while (classLoader instanceof URLClassLoader) {
def fingerprints = [] as Set
def allFiles = [] as Set
classLoader.getURLs().each {
@gabrielfeo
gabrielfeo / pinentry-op.bash
Last active February 20, 2025 17:06
Have gpg fetch key password using 1Password CLI
#!/usr/bin/env bash
# Have gpg fetch key password using 1Password CLI.
#
# 1. Add to ~/.gnupg/gpg-agent.conf:
#
# pinentry-program <path to this file>
#
# 2. Export OP_GPG_PASSWORD_ENTRY_<key-id>=<key-password-reference> variables :
#