diff --git a/.github/workflows/port-docs.yml b/.github/workflows/port-docs.yml index 88b9edabc..34d3c62a5 100644 --- a/.github/workflows/port-docs.yml +++ b/.github/workflows/port-docs.yml @@ -380,13 +380,13 @@ jobs: if: matrix.port == 'ts' working-directory: port run: bun install --frozen-lockfile - - if: matrix.port == 'java' || matrix.port == 'kotlin' || matrix.port == 'scala' + - if: matrix.port == 'java' || matrix.port == 'kotlin' || matrix.port == 'scala' || matrix.port == 'clojure' uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6 with: distribution: temurin # The repository's Gradle conventions compile and run on JDK 25. java-version: '25' - - if: matrix.port == 'java' || matrix.port == 'kotlin' || matrix.port == 'scala' + - if: matrix.port == 'java' || matrix.port == 'kotlin' || matrix.port == 'scala' || matrix.port == 'clojure' uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 with: validate-wrappers: true diff --git a/.github/workflows/reusable-deploy.yml b/.github/workflows/reusable-deploy.yml index 2c32efe52..5e7e64ba5 100644 --- a/.github/workflows/reusable-deploy.yml +++ b/.github/workflows/reusable-deploy.yml @@ -144,7 +144,7 @@ jobs: echo "::error::path-prefix '$p' must be an unrooted path using letters, digits, '.', '_', '-' and '/', without '..'" >&2 exit 1 fi - reserved=(py ruby lua powershell julia elixir ts rs go java kotlin scala csharp fsharp cxx swift manifest _shell) + reserved=(py ruby lua powershell julia elixir ts rs go java clojure kotlin scala csharp fsharp cxx swift manifest _shell) for r in "${reserved[@]}"; do if [[ "$p" == "$r" ]]; then echo "::error::path-prefix '$p' is a bare reserved top-level name — qualify it, e.g. '$r/latest'" >&2 @@ -153,7 +153,7 @@ jobs: done if [[ -n "${PORT_IN:-}" ]]; then case "$PORT_IN" in - py|ruby|lua|powershell|julia|elixir|ts|rs|go|java|kotlin|scala|csharp|fsharp|cxx|swift) ;; + py|ruby|lua|powershell|julia|elixir|ts|rs|go|java|clojure|kotlin|scala|csharp|fsharp|cxx|swift) ;; *) echo "::error::unknown port '$PORT_IN'" >&2; exit 1 ;; esac if [[ ! "$VERSION_IN" =~ ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ || "$VERSION_IN" == *..* ]]; then diff --git a/notes/adding-a-port.md b/notes/adding-a-port.md index 62720f9a9..59583ff1e 100644 --- a/notes/adding-a-port.md +++ b/notes/adding-a-port.md @@ -84,9 +84,9 @@ and records what it found: $ node scripts/verify-destinations.mjs ``` -The verifier refuses to run, with or without `--check`, if a port in `ports.ts` -has no inventory entry with a published library: the header builds its links -from that entry, so a port without one would offer nothing. A host the +The verifier requires a published library, or a configured but unpublished +library with a public source repository and source installation instructions. +The latter names no registry or API host until those pages exist. A host the inventory has not named before needs an identity rule in `scripts/lib/destination-verification.mjs` and its cases in `scripts/verify-destinations.negative.mjs`; without a rule its destinations are diff --git a/packages/api-model/scripts/export-clojure.clj b/packages/api-model/scripts/export-clojure.clj new file mode 100644 index 000000000..8b4ab463c --- /dev/null +++ b/packages/api-model/scripts/export-clojure.clj @@ -0,0 +1,145 @@ +(ns libtmux.docs.export-clojure + "Build-only export of compiled public namespace and var metadata." + (:require [clojure.java.io :as io] + [clojure.string :as str]) + (:import [com.fasterxml.jackson.databind ObjectMapper] + [java.nio.charset StandardCharsets] + [java.nio.file Files] + [java.security MessageDigest] + [java.util HexFormat List] + [java.util.regex Pattern])) + +(set! *warn-on-reflection* true) + +(def ^:private repo "libtmux/libtmux-java") +(def ^:private exporter-script *file*) + +(defn- sha256 [^bytes bytes] + (.formatHex (HexFormat/of) (.digest (MessageDigest/getInstance "SHA-256") bytes))) + +(defn- bytes-at [file] + (Files/readAllBytes (.toPath (io/file file)))) + +(defn- prose [text] + (when (str/blank? text) (throw (ex-info "Public Clojure declaration has no docstring" {}))) + (str/replace (str/trim text) #"\n " "\n")) + +(defn- tag-text [namespace metadata] + (when-let [tag (:tag metadata)] + (let [resolved (if (class? tag) tag + (when (symbol? tag) (ns-resolve namespace tag)))] + (if (class? resolved) (.getName ^Class resolved) (str tag))))) + +(defn- parameters [namespace arguments] + (loop [remaining (seq arguments) variadic? false result []] + (if-let [argument (first remaining)] + (if (= '& argument) + (recur (next remaining) true result) + (recur (next remaining) false + (conj result (cond-> {"name" (if (symbol? argument) (str argument) (pr-str argument))} + variadic? (assoc "variadic" "positional") + (tag-text namespace (meta argument)) (assoc "type" (tag-text namespace (meta argument))))))) + result))) + +(defn- signatures [namespace name metadata] + (when-not (seq (:arglists metadata)) + (throw (ex-info "Public Clojure var has no callable arities" {:var name}))) + (mapv (fn [arguments] + (cond-> {"raw" (pr-str (cons (symbol name) arguments)) + "params" (parameters namespace arguments)} + (tag-text namespace metadata) (assoc "returns" (tag-text namespace metadata)))) + (:arglists metadata))) + +(defn- public-functions [namespace] + (->> (ns-publics namespace) + (keep (fn [[name value]] + (let [metadata (meta value)] + (when (and (:file metadata) (not (:no-doc metadata))) + [(str name) metadata])))) + (sort-by first))) + +(defn- source-record [module file revision line] + {"file" (str (get module "path") "/src/main/clojure/" file) + "line" line "repo" repo "revision" revision}) + +(defn- namespace-line [source namespace] + (let [pattern (re-pattern (str "(?m)^\\(ns\\s+" (Pattern/quote (str namespace)) "(?:\\s|$)")) + matcher (re-matcher pattern source)] + (when-not (.find matcher) + (throw (ex-info "Cannot locate the compiled namespace in source" {:namespace namespace}))) + (inc (count (filter #{\newline} (subs source 0 (.start matcher))))))) + +(defn- namespace-symbols [root module namespace revision] + (let [file (str (-> (str namespace) (str/replace "." "/") (str/replace "-" "_")) ".clj") + path (str (get module "path") "/src/main/clojure/" file) + ^bytes source-bytes (bytes-at (io/file root path)) + resource (or (io/resource file) (throw (ex-info "Compiled Clojure source is absent" {:file file}))) + loaded-bytes (with-open [stream (io/input-stream resource)] (.readAllBytes stream)) + _ (when-not (= (sha256 source-bytes) (sha256 loaded-bytes)) + (throw (ex-info "Loaded Clojure resource differs from selected source" {:file path}))) + functions (public-functions namespace) + common {"package" (get module "package") "product" "core" "apiScope" "exported" + "namespace" (str namespace) "publicOwner" (str namespace)}] + (when-not (seq functions) (throw (ex-info "Public Clojure namespace has no functions" {:namespace namespace}))) + {:input {"path" path "sha256" (sha256 source-bytes)} + :symbols + (into [(merge common {"id" (str namespace) "publicId" (str namespace) + "qualifiedName" (str namespace) "name" (str namespace) + "kind" "module" "modifiers" [] + "signatures" [{"raw" (str "(ns " namespace ")") "params" []}] + "docstring" (prose (:doc (meta (the-ns namespace)))) + "source" (source-record module file revision + (namespace-line (String. source-bytes StandardCharsets/UTF_8) namespace))})] + (for [[name metadata] functions] + (do + (when-not (and (= file (:file metadata)) (pos-int? (:line metadata))) + (throw (ex-info "Public var source is outside its namespace" {:namespace namespace :var name}))) + (merge common {"id" (str namespace "/" name) "publicId" (str namespace "/" name) + "qualifiedName" (str namespace "/" name) "name" name "kind" "function" + "parent" (str namespace) + "modifiers" (cond-> [] (> (count (:arglists metadata)) 1) (conj "overload") + (:macro metadata) (conj "macro") + (:deprecated metadata) (conj "deprecated")) + "signatures" (signatures namespace name metadata) + "docstring" (prose (:doc metadata)) + "source" (source-record module file revision (:line metadata))}))))})) + +(defn- exporter-provenance [] + (let [directory (.getParentFile (io/file exporter-script)) + files (mapv (fn [name] + {"path" (str "packages/api-model/scripts/" name) + "sha256" (sha256 (bytes-at (io/file directory name)))}) + ["export-clojure.clj" "export-clojure.gradle"]) + digest (sha256 (.getBytes (str/join "\n" (map #(str (get % "path") ":" (get % "sha256")) files)) + StandardCharsets/UTF_8))] + {"name" "clojure-public-var-metadata" "revision" (str "sha256:" digest) + "files" files})) + +(defn- -main [root destination revision] + (when-not (re-matches #"[a-f0-9]{40}" revision) + (throw (ex-info "A selected source revision is required" {}))) + (let [mapper (ObjectMapper.) + ^List modules (.readValue mapper (System/getProperty "libtmux.docs.clojure.modules") List) + namespaces (vec (for [module modules namespace (get module "namespaces")] + [module (symbol namespace)]))] + (when (or (empty? namespaces) (not= (count namespaces) (count (set (map second namespaces))))) + (throw (ex-info "Published Clojure namespaces are absent or duplicated" {}))) + (doseq [[_ namespace] namespaces] (require namespace)) + (let [exports (mapv (fn [[module namespace]] (namespace-symbols root module namespace revision)) namespaces) + symbols (into [] (mapcat :symbols) exports) + artifact {"schema" "libtmux.clojure-api/1" "port" "clojure" "repo" repo "revision" revision + "compiler" (clojure-version) "extractor" "clojure-public-var-metadata/1" + "sources" (mapv (fn [module] + {"product" "core" "package" (get module "package") "repo" repo + "revision" revision "extractedRevision" revision "version" (get module "version")}) modules) + "nativeProvenance" {"files" (mapv :input exports) "exporter" (exporter-provenance)} + "symbols" symbols} + output (.getAbsoluteFile (io/file destination))] + (when-not (= (count symbols) (count (set (map #(get % "id") symbols)))) + (throw (ex-info "Duplicate native Clojure public identity" {}))) + (.mkdirs (.getParentFile output)) + (spit output (str (.writeValueAsString (.writerWithDefaultPrettyPrinter mapper) artifact) "\n") :encoding "UTF-8") + (binding [*out* *err*] + (println "Clojure" (clojure-version) ": exported" (count symbols) "public declarations"))))) + +(apply -main *command-line-args*) diff --git a/packages/api-model/scripts/export-clojure.gradle b/packages/api-model/scripts/export-clojure.gradle new file mode 100644 index 000000000..9bf2d7c2a --- /dev/null +++ b/packages/api-model/scripts/export-clojure.gradle @@ -0,0 +1,57 @@ +import groovy.json.JsonOutput +import org.gradle.api.tasks.JavaExec + +gradle.projectsEvaluated { + def root = gradle.rootProject + def modules = root.allprojects.findAll { it.plugins.hasPlugin('libtmux.clojure-library') } + .sort { it.path } + if (!modules) return + def scriptPath = root.findProperty('libtmuxClojureExporter') + if (!scriptPath) throw new GradleException('Set libtmuxClojureExporter to export-clojure.clj') + def manifest = modules.collect { module -> + def declared = module.tasks.named('clojureNamespaceLoad', JavaExec).get() + .systemProperties['libtmux.clojure.main-namespaces'] + if (!declared) throw new GradleException("Missing public namespaces for ${module.path}") + [path: root.relativePath(module.projectDir), artifact: module.name, + package: "${module.group}:${module.name}", version: module.version.toString(), + namespaces: declared.toString().split(',').toList()] + } + def launcher = modules.first().tasks.named('clojureNamespaceLoad', JavaExec).get().javaLauncher.get() + root.tasks.register('exportClojureApi', JavaExec) { + group = 'documentation' + description = 'Exports public Clojure metadata for the shared documentation model.' + dependsOn(modules.collect { it.tasks.named('classes') }) + javaLauncher.set(launcher) + mainClass.set('clojure.main') + classpath = root.files(modules.collect { it.sourceSets.main.runtimeClasspath }, + root.project(':libtmux-jackson').configurations.runtimeClasspath) + workingDir(root.projectDir) + def destination = root.file(root.findProperty('libtmuxClojureApiOutput') ?: 'build/docs/clojure-api.json') + def revision = root.findProperty('libtmuxDocsSourceRevision') + if (!(revision ==~ /[a-f0-9]{40}/)) throw new GradleException('Set libtmuxDocsSourceRevision to the selected Git revision') + systemProperty('libtmux.docs.clojure.modules', JsonOutput.toJson(manifest)) + jvmArgs('-Xmx384m', '-XX:ActiveProcessorCount=2', '-Dclojure.main.report=stderr') + args(scriptPath, root.projectDir.path, destination.path, revision) + inputs.files(new File(scriptPath), new File(new File(scriptPath).parentFile, 'export-clojure.gradle')) + inputs.property('sourceRevision', revision) + inputs.property('publicModules', JsonOutput.toJson(manifest)) + modules.each { inputs.dir(it.file('src/main/clojure')) } + outputs.file(destination) + def errors = new ByteArrayOutputStream() + errorOutput = errors + ignoreExitValue = true + doLast { + def diagnostic = errors.toString('UTF-8') + System.err.print(diagnostic) + def result = executionResult.get() + if (result.exitValue != 0) { + destination.delete() + result.assertNormalExitValue() + } + if (diagnostic =~ /(?m)^(Reflection warning|Performance warning|Boxed math warning)/) { + destination.delete() + throw new GradleException('Clojure API export emitted compiler warnings') + } + } + } +} diff --git a/packages/api-model/src/builtins.ts b/packages/api-model/src/builtins.ts index 246d01d17..38c3bc724 100644 --- a/packages/api-model/src/builtins.ts +++ b/packages/api-model/src/builtins.ts @@ -487,6 +487,11 @@ export const BUILTINS: Record> = { byte: 'https://docs.oracle.com/javase/specs/jls/se21/html/jls-4.html#jls-4.2.1', void: 'https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-8.4.5', }, + clojure: { + // The runtime declaration identifies the Java class; core.async names the library. + ExceptionInfo: 'https://github.com/clojure/clojure/blob/clojure-1.12.6/src/jvm/clojure/lang/ExceptionInfo.java', + 'core.async': 'https://github.com/clojure/core.async', + }, // Lua's eight value types share one section of the manual; `integer` is // the subtype 5.3 added and LuaLS spells separately. `any` is a LuaLS // annotation type, with no counterpart in the language. LuaLS's `unknown` @@ -518,7 +523,7 @@ export const CURATED_BEFORE_INVENTORY: ReadonlySet = new Set(['kotlin', * "the Java ones" is about the project's wrappers of the Java API and not a switch to Java: its `Vector` is Scala's. * A sentence that names a language the port does not reach (a Python page on Rust's `Vec`) still decides the name. */ -export const PLATFORM_REACH: Readonly> = { kotlin: ['java'], scala: ['java'] } +export const PLATFORM_REACH: Readonly> = { kotlin: ['java'], scala: ['java'], clojure: ['java'] } /** * Names the JDK's inventory holds that Kotlin and Scala prose means another library's by. A Scala sentence's "an Ox diff --git a/packages/api-model/src/concepts.ts b/packages/api-model/src/concepts.ts index f5b23c9ac..63d2c170e 100644 --- a/packages/api-model/src/concepts.ts +++ b/packages/api-model/src/concepts.ts @@ -3824,6 +3824,31 @@ for (const [id, binding] of Object.entries(ELIXIR_CONCEPTS)) { if (binding.note) (concept.notes ??= {}).elixir = binding.note } CONCEPTS['list-session-panes']!.absent!.julia = 'Traverse `windows(session)` and `panes(window)` in the captured snapshot. `panes(snapshot)` has server-wide scope.' +const CLOJURE_CONCEPTS: Record = { + server: { symbol: 'libtmux.core/open!', note: 'Opens a closeable Java server client for an explicit endpoint. Acquisitions return persistent maps with explicit Java references for effects.' }, + session: { symbol: 'libtmux.core/sessions!', note: 'Acquires a vector of captured session maps. The session value is a map, not a wrapper class.' }, + window: { symbol: 'libtmux.data/windows', note: 'Traverses captured window-placement maps without I/O; the window value is a map with an explicit Java reference for effects.' }, + pane: { symbol: 'libtmux.data/panes', note: 'Traverses captured pane maps without I/O. Use keyword lookup for scalar observations and the preserved :tmux/ref for effects.' }, + 'capture-pane': { symbol: 'libtmux.core/capture!' }, + 'send-keys': { symbol: 'libtmux.core/send-keys!' }, + 'split-pane': { symbol: 'libtmux.core/split-pane!' }, + 'new-session': { symbol: 'libtmux.core/new-session!' }, + 'new-window': { symbol: 'libtmux.core/new-window!' }, + 'kill-server': { symbol: 'libtmux.core/kill-server!' }, + 'list-sessions': { symbol: 'libtmux.core/sessions!', note: 'Acquires a new captured graph and returns its session maps; acquisition failure throws.' }, + 'list-windows': { symbol: 'libtmux.data/windows', note: 'Traverses one capture locally. It does not issue a list-windows command.' }, + 'list-panes': { symbol: 'libtmux.data/panes', note: 'Traverses one capture locally. It does not issue a list-panes command.' }, + 'list-server-windows': { symbol: 'libtmux.core/windows!', note: 'Acquires a new graph and returns its window placements without deduplicating linked windows.' }, + 'list-server-panes': { symbol: 'libtmux.core/panes!', note: 'Acquires a new graph and returns its pane occurrences.' }, + 'list-clients': { symbol: 'libtmux.core/clients!' }, + snapshot: { symbol: 'libtmux.core/snapshot!', note: 'Acquires a captured graph of persistent values. Retained values do not refresh after mutation or close.' }, +} +for (const [id, binding] of Object.entries(CLOJURE_CONCEPTS)) { + const concept = CONCEPTS[id] + if (!concept) throw new Error(`concepts: Clojure maps unknown concept ${id}`) + concept.symbols.clojure = binding.symbol + if (binding.note) (concept.notes ??= {}).clojure = binding.note +} for (const concept of Object.values(CONCEPTS)) { concept.absent ??= {} if (!concept.symbols.powershell) concept.absent.powershell ??= 'No source-verified PowerShell equivalent is recorded for this operation.' @@ -3834,6 +3859,7 @@ for (const concept of Object.values(CONCEPTS)) { if (!concept.symbols.kotlin) concept.absent.kotlin = 'No source-verified Kotlin equivalent is recorded for this operation.' if (!concept.symbols.scala) concept.absent.scala = 'No source-verified Scala equivalent is recorded for this operation.' if (!concept.symbols.fsharp) concept.absent.fsharp = 'No source-verified F# equivalent is recorded for this operation.' + if (!concept.symbols.clojure) concept.absent.clojure = 'No source-verified Clojure equivalent is recorded for this operation.' } /** Every concept naming this symbol, including concepts sharing an overload group. */ diff --git a/packages/api-model/src/doc/roles.ts b/packages/api-model/src/doc/roles.ts index 791867b29..975a2c649 100644 --- a/packages/api-model/src/doc/roles.ts +++ b/packages/api-model/src/doc/roles.ts @@ -48,6 +48,8 @@ export type DocSpan = target: string /** What to show. `~` means "last segment only"; explicit titles win. */ label: string + /** An authored symbol link, rather than inline code offered for resolution. */ + explicit?: boolean } /** @@ -292,6 +294,7 @@ const SYNTAX: Record> = { cxx: new Set([]), kotlin: new Set(['kdoc', 'jsdoc']), scala: new Set(['scaladoc', 'jsdoc']), + clojure: new Set(['cljdoc', 'markdown-link']), julia: new Set(['markdown-link', 'documenter']), // ExDoc links a Markdown destination written as code: [the server](`LibTmux.Server`). elixir: new Set(['markdown-link', 'exdoc']), @@ -395,22 +398,24 @@ function tokenizeRun(text: string, lang?: string): DocSpan[] { hits.push({ start: match.index, end: match.index + match[0].length, span: { kind: 'kbd', text: match[1] } }) } - if (syntax.has('kdoc') || syntax.has('scaladoc')) { + if (syntax.has('kdoc') || syntax.has('scaladoc') || syntax.has('cljdoc')) { const prose = text.split('') for (const pattern of [LITERAL_RE, BACKTICK_RE]) { for (const match of text.matchAll(pattern)) { for (let i = match.index; i < match.index + match[0].length; i++) prose[i] = ' ' } } - const links = syntax.has('scaladoc') + const wiki = syntax.has('scaladoc') || syntax.has('cljdoc') + const links = wiki ? /\[\[([^\]\s]+)(?:\s+([^\]]+))?\]\]/g : /(?=&$%/-]+$/ : /^[\w.#]+$/).test(target)) continue hits.push({ start: match.index, end: match.index + match[0].length, - span: { kind: 'ref', role: 'any', target, label } }) + span: { kind: 'ref', role: 'any', target, label, + ...(syntax.has('cljdoc') ? { explicit: true } : {}) } }) } } diff --git a/packages/api-model/src/inventory.ts b/packages/api-model/src/inventory.ts index 7c6867981..81370b34c 100644 --- a/packages/api-model/src/inventory.ts +++ b/packages/api-model/src/inventory.ts @@ -43,6 +43,7 @@ const DOMAIN: Record = { rs: 'std', go: 'std', java: 'std', + clojure: 'std', kotlin: 'std', scala: 'std', fsharp: 'std', diff --git a/packages/api-model/src/languages/clojure-examples.ts b/packages/api-model/src/languages/clojure-examples.ts new file mode 100644 index 000000000..0ab7c4973 --- /dev/null +++ b/packages/api-model/src/languages/clojure-examples.ts @@ -0,0 +1,100 @@ +import type { ApiSymbol, DocBlock } from '../model.ts' + +interface ExampleFile { sourceFile: string; path: string; language?: string } +interface Program extends ExampleFile { + id: string + variant: string + language: string + description: string + mainNamespace: string + targets: string[] + expectedOutput: string + cliAliases?: string[] + requiresControl?: boolean + unsupportedOutput?: string +} + +/** Attach the native Clojure catalog without changing the JVM example schema. */ +export function attachCompleteClojureExamples( + symbols: ApiSymbol[], + read: (path: string) => string | undefined, + source: { repo: string; revision: string }, +): void { + const raw = read('examples/api/clojure/manifest.json') + if (!raw || source.repo !== 'libtmux/libtmux-java' || !/^[a-f0-9]{40}$/.test(source.revision)) { + throw new Error('Clojure examples require their native catalog and source revision') + } + const manifest = JSON.parse(raw) as { + schemaVersion: number; examples: Program[]; variants: { clojure: { files: ExampleFile[] } } + } + const files = manifest.variants?.clojure?.files + if (manifest.schemaVersion !== 1 || !Array.isArray(manifest.examples) || !manifest.examples.length || + !Array.isArray(files) || ![1, 2].includes(files.length) || + new Set(files.map((file) => file.path)).size !== files.length || + !files.some((file) => file.path === 'deps.edn') || + !files.every((file) => ['deps.edn', 'run.sh'].includes(file.path))) { + throw new Error('Invalid Clojure example catalog or setup') + } + const usesLauncher = files.some((file) => file.path === 'run.sh') + const codeFor = (path: string): string => { + if (!/^examples\/(?:[\w-]+\/)*[\w.-]+$/.test(path) || path.split('/').includes('..')) { + throw new Error(`Invalid Clojure example source path: ${path}`) + } + const code = read(path) + if (!code?.trim()) throw new Error(`Missing complete Clojure example file: ${path}`) + return code + } + const urlFor = (path: string) => `https://github.com/${source.repo}/blob/${source.revision}/${path}` + const ids = new Set() + for (const program of manifest.examples) { + const namespace = /^libtmux\.examples\.api\.[a-z][a-z-]*$/.test(program.mainNamespace ?? '') + if (!program.id || ids.has(program.id) || program.variant !== 'clojure' || program.language !== 'clojure' || + !namespace || program.path !== `src/main/clojure/${program.mainNamespace.replaceAll('.', '/').replaceAll('-', '_')}.clj` || + program.sourceFile !== `examples/${program.path}` || !program.description?.trim() || + !program.expectedOutput?.trim() || !program.expectedOutput.endsWith('\n') || + !Array.isArray(program.targets) || !program.targets.length || + new Set(program.targets).size !== program.targets.length || + program.cliAliases && (program.cliAliases.length !== 1 || program.cliAliases[0] !== 'core-async') || + program.requiresControl && (!program.unsupportedOutput?.trim() || !program.unsupportedOutput.endsWith('\n'))) { + throw new Error(`Invalid Clojure example metadata: ${program.id}`) + } + ids.add(program.id) + const adapter = program.cliAliases?.includes('core-async') + const publish = [':libtmux:publishToMavenLocal', ':libtmux-clojure:publishToMavenLocal', + ...(adapter ? [':libtmux-clojure-core-async:publishToMavenLocal'] : [])] + const blocks: NonNullable = [{ + lang: 'console', + intro: `${program.description} Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:`, + code: `$ git clone https://github.com/${source.repo} libtmux-source && \\\n git -C libtmux-source checkout --detach ${source.revision} && \\\n (cd libtmux-source && ./gradlew \\\n ${publish.join(' \\\n ')} \\\n --console=plain \\\n "-Dmaven.repo.local=$PWD/../m2")\n`, + }, ...files.map((file) => ({ + lang: file.path === 'run.sh' ? 'sh' : 'clojure', + intro: `Save this file as \`${file.path}\`. ${file.path === 'run.sh' + ? 'The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.' + : 'Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.'}`, + code: codeFor(file.sourceFile), sourceUrl: urlFor(file.sourceFile), + })), { + lang: 'clojure', intro: `Save the complete program as \`${program.path}\`, creating its parent directories. ${usesLauncher + ? "Closing its client leaves the launcher's server running." + : 'The program starts its own private tmux server and stops it on exit.'}`, + code: codeFor(program.sourceFile), sourceUrl: urlFor(program.sourceFile), + }, { + lang: 'console', intro: usesLauncher + ? 'Run it with the private fixture. Set TMUX_BIN to select another tmux binary:' + : 'Run the program directly:', + code: `$ ${usesLauncher ? 'sh run.sh ' : ''}clojure \\\n -J-Dclojure.main.report=stderr \\\n -M${adapter ? ':core-async' : ''} \\\n -m ${program.mainNamespace}\n`, + }, { + lang: 'text', intro: program.requiresControl ? 'Expected output on tmux 3.7 or newer:' : 'Expected output:', + code: program.expectedOutput, + }] + if (program.requiresControl) blocks.push({ + lang: 'text', intro: 'On an older supported tmux, the program reports the control capability refusal:', + code: program.unsupportedOutput!, + }) + for (const target of program.targets) { + const matches = symbols.filter((symbol) => symbol.id === target) + if (matches.length !== 1) throw new Error(`Clojure example target must resolve once: ${target}`) + const symbol = matches[0]! + symbol.doc = { summary: '', ...symbol.doc, examples: [...(symbol.doc?.examples ?? []), ...blocks] } + } + } +} diff --git a/packages/api-model/src/languages/clojure.ts b/packages/api-model/src/languages/clojure.ts new file mode 100644 index 000000000..b7efbec3e --- /dev/null +++ b/packages/api-model/src/languages/clojure.ts @@ -0,0 +1,91 @@ +import { parseMarkdownDocFull } from '../doc/markdown.ts' +import { tokenizeDoc } from '../doc/roles.ts' +import type { ApiModel, ApiSource, ApiSymbol } from '../model.ts' + +interface ClojureArtifact { + schema: string + port: string + repo: string + revision: string + compiler: string + extractor: string + sources: ApiSource[] + nativeProvenance: NonNullable + symbols: (ApiSymbol & { docstring: string })[] +} + +/** Preserve compiled public Clojure vars, native arities, hints and authored links. */ +export function extractClojure(input: unknown, expectedRevision?: string): ApiModel { + const artifact = input as ClojureArtifact + if (artifact?.schema !== 'libtmux.clojure-api/1' || artifact.port !== 'clojure' || + !/^[a-f0-9]{40}$/.test(artifact.revision ?? '') || + expectedRevision !== undefined && expectedRevision !== artifact.revision) { + throw new Error('Clojure artifact schema or selected source revision mismatch') + } + const sourceFiles = artifact.nativeProvenance?.files + const exporter = artifact.nativeProvenance?.exporter + if (!/^[0-9]+\.[0-9]+\.[0-9]+(?:[.-][\w.-]+)?$/.test(artifact.compiler ?? '') || + artifact.repo !== 'libtmux/libtmux-java' || !artifact.extractor || + !Array.isArray(sourceFiles) || !sourceFiles.length || + sourceFiles.some((file) => !file.path || !/^[a-f0-9]{64}$/.test(file.sha256)) || + new Set(sourceFiles.map((file) => file.path)).size !== sourceFiles.length || + exporter?.name !== 'clojure-public-var-metadata' || + typeof exporter.revision !== 'string' || !/^sha256:[a-f0-9]{64}$/.test(exporter.revision) || + !Array.isArray(exporter.files) || !exporter.files.length || + exporter.files.some((file) => !file?.path || !/^[a-f0-9]{64}$/.test(file.sha256))) { + throw new Error('Clojure artifact requires compiler, source and exporter provenance') + } + const packages = new Map() + for (const source of artifact.sources ?? []) { + const module = /^io\.github\.libtmux:(libtmux-clojure(?:-core-async)?)$/.exec(source.package)?.[1] + if (!module || source.repo !== artifact.repo || source.revision !== artifact.revision || + !source.version || source.product !== 'core' || packages.has(source.package)) { + throw new Error('Clojure package source identity is invalid') + } + packages.set(source.package, module) + } + if (!packages.size || !Array.isArray(artifact.symbols) || !artifact.symbols.length) { + throw new Error('Clojure artifact documents no public packages or declarations') + } + const ids = new Set(artifact.symbols.map((symbol) => symbol.id)) + const namespaces = new Set(artifact.symbols.filter((symbol) => symbol.kind === 'module').map((symbol) => symbol.id)) + if (ids.size !== artifact.symbols.length) throw new Error('Clojure public identity is duplicated') + for (const symbol of artifact.symbols) { + const namespace = symbol.namespace + const module = packages.get(symbol.package ?? '') + if (!namespace || !/^libtmux\.[\w.-]+$/.test(namespace) || !module || + !['module', 'function'].includes(symbol.kind) || symbol.apiScope !== 'exported' || + symbol.modifiers.includes('private') || symbol.publicOwner !== namespace || + symbol.publicId !== symbol.id || symbol.qualifiedName !== symbol.id || + symbol.id !== (symbol.kind === 'module' ? namespace : `${namespace}/${symbol.name}`) || + symbol.kind === 'function' && (symbol.parent !== namespace || !namespaces.has(namespace))) { + throw new Error(`Clojure public declaration is invalid: ${symbol.id}`) + } + const file = `${module}/src/main/clojure/${namespace.replaceAll('.', '/').replaceAll('-', '_')}.clj` + if (symbol.source?.file !== file || !sourceFiles.some((entry) => entry.path === file) || + !Number.isSafeInteger(symbol.source.line) || (symbol.source.line ?? 0) < 1 || + symbol.source.repo !== artifact.repo || symbol.source.revision !== artifact.revision) { + throw new Error(`Clojure source identity is invalid: ${symbol.id}`) + } + if (!symbol.docstring?.trim() || !Array.isArray(symbol.signatures) || !symbol.signatures.length || + symbol.signatures.some((signature) => !signature.raw?.endsWith(')') || + !(signature.raw.startsWith(`(${symbol.kind === 'module' ? 'ns' : symbol.name} `) || signature.raw === `(${symbol.name})`) || + !Array.isArray(signature.params) || signature.params.some((parameter) => !parameter.name))) { + throw new Error(`Clojure native signature or docstring is absent: ${symbol.id}`) + } + for (const reference of tokenizeDoc(symbol.docstring, 'clojure')) { + if (reference.kind !== 'ref' || !reference.explicit) continue + if (!ids.has(reference.target) && !ids.has(`${namespace}/${reference.target}`)) { + throw new Error(`Clojure docstring has an unresolved public reference: ${reference.target}`) + } + } + } + return { + port: 'clojure', repo: artifact.repo, revision: artifact.revision, + extractor: artifact.extractor, sources: artifact.sources, nativeProvenance: artifact.nativeProvenance, + symbols: artifact.symbols.map(({ docstring, ...symbol }) => { + const [summary, ...body] = docstring.split('\n') + return { ...symbol, doc: parseMarkdownDocFull([summary, '', ...body].join('\n'), 'clojure').doc } + }), + } +} diff --git a/packages/api-model/src/link.ts b/packages/api-model/src/link.ts index e8e8553be..550d877da 100644 --- a/packages/api-model/src/link.ts +++ b/packages/api-model/src/link.ts @@ -1360,6 +1360,7 @@ export class SymbolIndex { ? String.raw`[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*!?` // A number is matched whole, so `1_000` is not a literal followed by a name. : this.lang === 'elixir' ? String.raw`\d[\d_]*(?:\.\d+)?(?:[eE][+-]?\d+)?|[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*[!?]?` + : this.lang === 'clojure' ? String.raw`::?[^\s,()[\]{}"';]+|[A-Za-z_][A-Za-z0-9_.]*(?:::[A-Za-z_][A-Za-z0-9_.]*)*` : this.lang === 'powershell' ? String.raw`(?:[A-Za-z_][A-Za-z0-9_.]*\\)?[A-Za-z_][A-Za-z0-9_.-]*` : this.lang === 'ts' ? String.raw`[A-Za-z_$][A-Za-z0-9_$.]*` : this.lang === 'rs' ? String.raw`(?:r#)?[A-Za-z_][A-Za-z0-9_.]*(?:::(?:r#)?[A-Za-z_][A-Za-z0-9_.]*)*` @@ -1367,8 +1368,8 @@ export class SymbolIndex { // C++ prefixes, escaped quotes, raw delimiters and suffixes belong to the // literal token. Its contents cannot introduce an attribute or type link. const cppLiteral = String.raw`(?:(?:u8|u|U|L)?R"(?[^ ()\\\t\v\f\r\n]{0,16})\([\s\S]*?\)\k"|(?:u8|u|U|L)?(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'))(?:[A-Za-z_]\w*)?` - const initial = this.lang === 'ts' ? 'A-Za-z_$' : this.lang === 'elixir' ? 'A-Za-z_0-9' : 'A-Za-z_' - const pattern = String.raw`(?\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|${identifier})|(?[^${initial}"'/]+|["'/])` + const initial = this.lang === 'ts' ? 'A-Za-z_$' : this.lang === 'elixir' ? 'A-Za-z_0-9' : this.lang === 'clojure' ? 'A-Za-z_:' : 'A-Za-z_' + const pattern = String.raw`(?\/\*[\s\S]*?\*\/|\/\/[^\n]*|"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|${identifier})|(?[^${initial}"'/]+|["'/${this.lang === 'clojure' ? ':' : ''}])` // F# type variables start with an apostrophe but do not close like strings. const re = new RegExp(this.lang === 'cxx' ? String.raw`(?${cppLiteral}|\d(?:[eEpP][+-]|[\w.'])*)|(?\/\*[\s\S]*?\*\/|\/\/[^\n]*|${identifier})|(?[^A-Za-z_0-9"'/]+|["'/])` @@ -1387,6 +1388,11 @@ export class SymbolIndex { out.push({ text: whole }) continue } + // Keywords are values, including a namespaced key inside a map. + if (this.lang === 'clojure' && ident.startsWith(':')) { + out.push({ text: ident, nonReference: true }) + continue + } if (/^(?:["']|\/[/*])/.test(ident)) { out.push({ text: ident }) continue diff --git a/packages/api-model/src/member-order.ts b/packages/api-model/src/member-order.ts index 4b37a0513..024d8e818 100644 --- a/packages/api-model/src/member-order.ts +++ b/packages/api-model/src/member-order.ts @@ -182,6 +182,7 @@ const bareName = (s: ApiSymbol) => .replace(/\(.*$/, '') .replace(/\/\d+$/, '') .replace(/Async$/, '') + .replace(/[!?]$/, '') .toLowerCase() export function memberTier(s: ApiSymbol, signals: MemberSignals): MemberTier { diff --git a/packages/api-model/src/model.ts b/packages/api-model/src/model.ts index 7ebbdd9c4..7364ba013 100644 --- a/packages/api-model/src/model.ts +++ b/packages/api-model/src/model.ts @@ -14,7 +14,7 @@ */ /** Language libraries, by the slug the site uses. */ -export type PortSlug = 'py' | 'ruby' | 'lua' | 'ts' | 'rs' | 'go' | 'java' | 'csharp' | 'cxx' | 'swift' | 'kotlin' | 'scala' | 'fsharp' | 'powershell' | 'julia' | 'elixir' +export type PortSlug = 'py' | 'ruby' | 'lua' | 'ts' | 'rs' | 'go' | 'java' | 'csharp' | 'cxx' | 'swift' | 'kotlin' | 'scala' | 'fsharp' | 'powershell' | 'julia' | 'elixir' | 'clojure' export type ApiProduct = 'core' | 'workspace' | 'mcp' diff --git a/packages/api-model/src/nav-config.ts b/packages/api-model/src/nav-config.ts index 5ed414cd3..64798ce3f 100644 --- a/packages/api-model/src/nav-config.ts +++ b/packages/api-model/src/nav-config.ts @@ -778,6 +778,11 @@ const LANGUAGE_PLACEMENTS: Record> = { commands: ['MessageLog', 'PrintedText', 'Prompt', 'Shell'].map((name) => `io.github.libtmux.${name}.${name}`), server: ['io.github.libtmux.IncarnationFence.IncarnationFence'], }, + clojure: { + server: ['libtmux.core'], + snapshots: ['libtmux.data'], + async: ['libtmux.async', 'libtmux.core-async'], + }, kotlin: { commands: ['Batch', 'ExecutionPolicy', 'MessageLog', 'Prompt', 'Shell', 'retryIfSafe'].map((name) => `io.github.libtmux.kotlin.${name}`), server: ['io.github.libtmux.kotlin.LibTmuxDsl'], @@ -854,7 +859,7 @@ function languageBucket(bucket: Bucket, port: string, root = bucket.id): Bucket } export const NAV: Record = Object.fromEntries( - ['powershell', 'julia', 'elixir', 'py', 'ruby', 'lua', 'ts', 'rs', 'go', 'java', 'kotlin', 'scala', 'fsharp', 'csharp', 'cxx', 'swift'].map((port) => [ + ['powershell', 'julia', 'elixir', 'py', 'ruby', 'lua', 'ts', 'rs', 'go', 'java', 'clojure', 'kotlin', 'scala', 'fsharp', 'csharp', 'cxx', 'swift'].map((port) => [ port, { port, diff --git a/packages/api-model/src/prose.ts b/packages/api-model/src/prose.ts index f7486aab9..ac3ac4402 100644 --- a/packages/api-model/src/prose.ts +++ b/packages/api-model/src/prose.ts @@ -21,6 +21,7 @@ export const PORT_NAME: Record = { rs: 'Rust', go: 'Go', java: 'Java', + clojure: 'Clojure', csharp: 'C#', cxx: 'C++', swift: 'Swift', @@ -305,6 +306,10 @@ export function decideMention( if (!looksLikeApiMention(text)) return { kind: 'skip', why: 'not a mention' } const never = neverLinks(text) if (never) return { kind: 'skip', why: never } + // Tools.deps names a package with a slash; only registered coordinates are packages, not vars. + if (ctx.pagePort === 'clojure' && models.clojure?.sources?.some((source) => source.package.replace(':', '/') === text)) { + return { kind: 'skip', why: 'a dependency coordinate' } + } const link = (port: string, res: ReturnType): MentionDecision | undefined => { if (res.how === 'federated') { diff --git a/packages/api-model/src/resolver.ts b/packages/api-model/src/resolver.ts index 676e2b52d..635146da5 100644 --- a/packages/api-model/src/resolver.ts +++ b/packages/api-model/src/resolver.ts @@ -98,6 +98,7 @@ export const DEFAULT_TEMPLATES: UrlTemplate[] = [ * makes a resolver look worse than it is and hides the failures that matter. */ export function notASymbol(text: string): string | undefined { + if (/^libtmux\.docs\.(?:socket|binary)$/.test(text)) return 'an example fixture system property' if (/^[a-z][a-z0-9+.-]*:\/\//i.test(text)) return 'a protocol URI' if (/^(?:net|v)?\d+\.\d+(?:\.\d+)?(?:[a-z]|[-+][\w.-]+)?$/.test(text)) return 'a version' if (/^(?:net|v)?\d+(?:\.\d+)*\.[xXnN]$/.test(text)) return 'a version line' diff --git a/packages/api-model/test/clojure.test.ts b/packages/api-model/test/clojure.test.ts new file mode 100644 index 000000000..5e06fb27b --- /dev/null +++ b/packages/api-model/test/clojure.test.ts @@ -0,0 +1,118 @@ +import { describe, expect, it } from 'vitest' +import { extractClojure } from '../src/languages/clojure.ts' +import { attachCompleteClojureExamples } from '../src/languages/clojure-examples.ts' +import { SymbolIndex } from '../src/link.ts' + +const revision = '1'.repeat(40) +const repo = 'libtmux/libtmux-java' +const coordinate = 'io.github.libtmux:libtmux-clojure' +const location = (namespace: string) => ({ + file: `libtmux-clojure/src/main/clojure/${namespace.replaceAll('.', '/')}.clj`, + line: 1, revision, repo, +}) +const namespace = (name: string) => ({ + id: name, publicId: name, qualifiedName: name, name, namespace: name, publicOwner: name, + kind: 'module', modifiers: [], signatures: [{ raw: `(ns ${name})`, params: [] }], + package: coordinate, product: 'core', apiScope: 'exported', docstring: 'Captured operations.', source: location(name), +}) +const callable = (owner: string, name: string, arities: string[][], docstring = 'Owns a resource.') => ({ + ...namespace(owner), id: `${owner}/${name}`, publicId: `${owner}/${name}`, qualifiedName: `${owner}/${name}`, + parent: owner, name, kind: 'function', docstring, + modifiers: arities.length > 1 ? ['overload'] : [], + signatures: arities.map((params) => ({ raw: `(${name} ${params.join(' ')})`, params: params.map((name) => ({ name })) })), +}) +function artifact() { + return { + schema: 'libtmux.clojure-api/1', port: 'clojure', repo, revision, compiler: '1.12.6', + extractor: 'clojure-public-var-metadata/1', + sources: [{ product: 'core', package: coordinate, repo, revision, extractedRevision: revision, version: '0.1.2-SNAPSHOT' }], + nativeProvenance: { + files: ['core', 'control', 'data'].map((name) => ({ path: location(`libtmux.${name}`).file, sha256: 'a'.repeat(64) })), + exporter: { name: 'clojure-public-var-metadata', revision: `sha256:${'b'.repeat(64)}`, + files: [{ path: 'packages/api-model/scripts/export-clojure.clj', sha256: 'c'.repeat(64) }] }, + }, + symbols: [ + namespace('libtmux.core'), namespace('libtmux.control'), namespace('libtmux.data'), + callable('libtmux.core', 'close!', [['server']]), + callable('libtmux.control', 'close!', [['resource']], 'Closes the subscription.\nSee [[close!]] and [[libtmux.core/close!]]. `:signalled` is a value.'), + callable('libtmux.data', 'matching', [['expression'], ['expression', 'entries']]), + ], + } +} + +describe('compiled Clojure artifact', () => { + it('keeps keywords literal when their names match callable declarations', () => { + const input = artifact() + input.symbols.push(callable('libtmux.core', 'timeout', [['value']])) + const model = extractClojure(input, revision) + const index = new SymbolIndex(model.symbols, (symbol) => `/${symbol.id}/`, 'clojure') + for (const text of [':timeout', '::timeout', ':libtmux.core/timeout', '{:timeout 100 :request/timeout 200}']) { + for (const parts of [index.linkType(text), index.linkLiteral(text)]) { + expect(parts.map((part) => part.text).join('')).toBe(text) + expect(parts.some((part) => part.link), text).toBe(false) + } + const spans = index.docSpans(`Use \`${text}\`.`) + expect(spans.some((span) => span.link || span.parts?.some((part) => part.link)), text).toBe(false) + } + expect(index.resolve('timeout')?.symbol?.id).toBe('libtmux.core/timeout') + expect(index.docSpans('See [[libtmux.core/close!]].')[1]?.link?.symbol?.id).toBe('libtmux.core/close!') + }) + + it('keeps every arity, native call spelling, package, source and docstring link', () => { + const model = extractClojure(artifact(), revision) + expect(model.symbols.find((symbol) => symbol.name === 'matching')?.signatures.map((signature) => signature.raw)) + .toEqual(['(matching expression)', '(matching expression entries)']) + const close = model.symbols.find((symbol) => symbol.id === 'libtmux.control/close!')! + expect(close.package).toBe(coordinate) + expect(close.source.revision).toBe(revision) + expect(close.doc?.body).toContain('[[libtmux.core/close!]]') + expect(close).not.toHaveProperty('docstring') + const index = new SymbolIndex(model.symbols, (symbol) => `/${symbol.id}/`, 'clojure') + const references = index.docSpans(close.doc!.body!, close) + .filter((span) => span.kind === 'ref' && span.explicit) + expect(references.map((span) => span.kind === 'ref' ? span.link?.symbol?.id : undefined)) + .toEqual(['libtmux.control/close!', 'libtmux.core/close!']) + }) + + it.each(['private', 'source', 'reference', 'provenance'] as const)('rejects a broken %s boundary', (boundary) => { + const input = artifact() + if (boundary === 'private') input.symbols[3]!.modifiers.push('private') + if (boundary === 'source') input.symbols[3]!.source.file = '../private.clj' + if (boundary === 'reference') input.symbols[4]!.docstring = 'See [[missing-var]].' + if (boundary === 'provenance') input.nativeProvenance.files[0]!.sha256 = 'stale' + expect(() => extractClojure(input, revision)).toThrow(/Clojure/) + }) +}) + +describe('Clojure example ownership', () => { + it.each([false, true])('preserves the selected source with launcher=%s', (launcher) => { + const symbol = extractClojure(artifact(), revision).symbols.find((entry) => entry.id === 'libtmux.core/close!')! + const program = '(ns libtmux.examples.api.connect)\n' + const setup = [ + { sourceFile: 'examples/api/clojure/deps.edn', path: 'deps.edn' }, + ...(launcher ? [{ sourceFile: 'examples/api/run.sh', path: 'run.sh' }] : []), + ] + const files: Record = { + 'examples/api/clojure/manifest.json': JSON.stringify({ + schemaVersion: 1, variants: { clojure: { files: setup } }, + examples: [{ id: 'connect', variant: 'clojure', language: 'clojure', description: 'Connect.', + mainNamespace: 'libtmux.examples.api.connect', path: 'src/main/clojure/libtmux/examples/api/connect.clj', + sourceFile: 'examples/src/main/clojure/libtmux/examples/api/connect.clj', + targets: [symbol.id], expectedOutput: 'connected=true\n' }], + }), + 'examples/api/clojure/deps.edn': '{:paths ["src/main/clojure"]}\n', + 'examples/src/main/clojure/libtmux/examples/api/connect.clj': program, + ...(launcher ? { 'examples/api/run.sh': '#!/bin/sh\nexec "$@"\n' } : {}), + } + attachCompleteClojureExamples([symbol], (path) => files[path], { repo, revision }) + const blocks = symbol.doc!.examples! + expect(blocks.find((block) => block.code === program)?.sourceUrl) + .toBe(`https://github.com/${repo}/blob/${revision}/examples/src/main/clojure/libtmux/examples/api/connect.clj`) + const run = blocks.filter((block) => block.lang === 'console').at(-1)! + expect(run.code).toBe(`$ ${launcher ? 'sh run.sh ' : ''}clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.connect\n`) + expect(blocks.some((block) => block.sourceUrl?.endsWith('/examples/api/run.sh'))).toBe(launcher) + const ownership = blocks.find((block) => block.code === program)!.intro! + expect(ownership.includes('own private tmux server')).toBe(!launcher) + expect(ownership.includes("launcher's server")).toBe(launcher) + }) +}) diff --git a/packages/api-model/test/member-order.test.ts b/packages/api-model/test/member-order.test.ts index c122fe44e..49b7a0b97 100644 --- a/packages/api-model/test/member-order.test.ts +++ b/packages/api-model/test/member-order.test.ts @@ -89,6 +89,9 @@ d('member order', () => { .map((owner) => ({ id: owner.id, members: symbols.filter((symbol) => symbol.parent === owner.id) })) // Cmdlets belong to their module; Julia's operations are free functions. if (port === 'powershell') groups.push({ id: 'LibTmux', members: symbols.filter((symbol) => symbol.parent === 'LibTmux') }) + if (port === 'clojure') for (const id of ['libtmux.core', 'libtmux.data']) { + groups.push({ id, members: symbols.filter((symbol) => symbol.parent === id) }) + } if (port === 'julia') groups.push({ id: 'LibTmux free functions', members: symbols.filter((symbol) => !symbol.parent && symbol.kind === 'function' && symbol.id.startsWith('LibTmux.')), @@ -98,10 +101,10 @@ d('member order', () => { const ordered = members.toSorted(compareMembers(signals)) const routine = members.filter((symbol) => ['New-TmuxSession', 'New-TmuxWindow', 'Remove-TmuxServer', 'Disconnect-TmuxControl', 'Base.close'].includes(symbol.name) || /^(new_?session|new_?window|create_?session|create_?window|close|dispose|asjava|tostring|__enter__|kill_?server)$/.test( - symbol.name.replace(/\(.*$/, '').replace(/Async$/, '').toLowerCase())) + symbol.name.replace(/\(.*$/, '').replace(/Async$/, '').replace(/[-!?]/g, '').toLowerCase())) const priority = members.filter((symbol) => symbol.doc?.deprecated === undefined && !symbol.modifiers?.includes('deprecated') && ( listingIds.has(symbol.publicId ?? symbol.id) || - /^(?:list_?|get)?(?:sessions|windows|panes|clients|buffers)$/.test(symbol.name.replace(/\(.*$/, '').replace(/Async$/, '').toLowerCase()) || + /^(?:list_?|get)?(?:sessions|windows|panes|clients|buffers)$/.test(symbol.name.replace(/\(.*$/, '').replace(/Async$/, '').replace(/[!?]$/, '').toLowerCase()) || /^(search-|snapshot$)/.test(signals.conceptIds.get(symbol.publicId ?? symbol.id) ?? ''))) for (const listing of priority) for (const helper of routine) { expect(ordered.indexOf(listing), `${id}: ${listing.name} before ${helper.name}`).toBeLessThan(ordered.indexOf(helper)) @@ -164,7 +167,7 @@ d('member order', () => { const parents = symbols.filter((symbol) => memberTier(symbol, signals) === 'parent') // F#/PowerShell use .NET handles; Julia's and Elixir's relationships are // read from a captured snapshot, not through accessors on an entity. - expect(parents.length > 0).toBe(!['fsharp', 'powershell', 'julia', 'elixir'].includes(port)) + expect(parents.length > 0).toBe(!['fsharp', 'powershell', 'julia', 'elixir', 'clojure'].includes(port)) for (const parent of parents) { const siblings = symbols.filter((symbol) => symbol.parent === parent.parent).toSorted(compareMembers(signals)) for (const sibling of siblings.filter((symbol) => memberTier(symbol, signals) !== 'parent')) { diff --git a/packages/api-model/test/prose-audit.test.ts b/packages/api-model/test/prose-audit.test.ts index 91647e4ac..26667bc32 100644 --- a/packages/api-model/test/prose-audit.test.ts +++ b/packages/api-model/test/prose-audit.test.ts @@ -120,6 +120,7 @@ describe('product context in prose', () => { expect(portFromSentence('Python\'s checked wait is ')).toBe('py') expect(portFromSentence('In C++20 and ')).toBe('cxx') expect(portFromSentence('Go has ')).toBe('go') + expect(portFromSentence('In Clojure, ')).toBe('clojure') // JavaScript is not Java, an algorithm is not Go, and a trust is not Rust. expect(portFromSentence('JavaScript has a ')).toBeUndefined() expect(portFromSentence('An algorithm going to Google uses a trust of ')).toBeUndefined() @@ -220,22 +221,23 @@ describe('product context in prose', () => { }) }) -describe('a Java-only libtmux symbol on a Kotlin or Scala page', () => { +describe('a Java-only libtmux symbol on a JVM facade page', () => { const symbol = (id: string, name: string) => ({ id, name, kind: 'class', signatures: [], source: { file: `${name}.java` } }) const kotlin = { port: 'kotlin', version: '0', symbols: [symbol('io.example.Snapshot', 'Snapshot')] } as unknown as ApiModel const scala = { port: 'scala', version: '0', symbols: [symbol('io.example.Snapshot', 'Snapshot')] } as unknown as ApiModel + const clojure = { port: 'clojure', version: '0', symbols: [symbol('io.example.Snapshot', 'Snapshot')] } as unknown as ApiModel const java = { port: 'java', version: '0', symbols: [symbol('io.example.PaneState', 'PaneState'), symbol('io.example.Snapshot', 'Snapshot')], } as unknown as ApiModel - const models = { kotlin, scala, java } + const models = { kotlin, scala, clojure, java } const jdk = ['Phaser', 'Flow', 'Vector'].map((name) => ({ name, uri: `java.base/java/util/concurrent/${name}.html`, type: 'std:label', priority: 1, dispname: '-' })) - /** The inventories a Kotlin or Scala build holds: the parent library the port wraps, and the JDK's. The site and the generators name the first differently. */ + /** The parent library and JDK inventories, under the names the site and generators use. */ const resolverNamed = (parent: string) => { - const resolver = new Resolver([kotlin, scala, java]) - resolver.addInventory(parent, '', parentInventory(java, (entry) => `/reference/java/${entry.name}/`), ['kotlin', 'scala']) - resolver.addInventory('Java SE', 'https://docs.oracle.com/en/java/javase/21/docs/api/', jdk, ['java', 'kotlin', 'scala']) + const resolver = new Resolver([kotlin, scala, clojure, java]) + resolver.addInventory(parent, '', parentInventory(java, (entry) => `/reference/java/${entry.name}/`), ['kotlin', 'scala', 'clojure']) + resolver.addInventory('Java SE', 'https://docs.oracle.com/en/java/javase/21/docs/api/', jdk, ['java', 'kotlin', 'scala', 'clojure']) return resolver } const builds = ['Library API', 'libtmux Java'] @@ -243,14 +245,14 @@ describe('a Java-only libtmux symbol on a Kotlin or Scala page', () => { describe.each(builds)('where the parent library\'s inventory is named %s', (parent) => { const resolver = resolverNamed(parent) - it.each(['kotlin', 'scala'])('credits the symbol to Java when the %s sentence says Java: the page\'s port holds only an inventory entry for it', (pagePort) => { + it.each(['kotlin', 'scala', 'clojure'])('credits the symbol to Java when the %s sentence says Java: the page\'s port holds only an inventory entry for it', (pagePort) => { for (const before of ['returning the real Java ', 'Wraps Java\'s ']) { expect(decideMention('PaneState', { pagePort, before }, resolver, models), before) .toMatchObject({ kind: 'link', port: 'java', external: false }) } }) - it.each(['kotlin', 'scala'])('records the Java symbol as the %s page\'s backlink, and records nothing for a name Java lacks', (authoredPort) => { + it.each(['kotlin', 'scala', 'clojure'])('records the Java symbol as the %s page\'s backlink, and records nothing for a name Java lacks', (authoredPort) => { const mentioned = (body: string) => pageMentions({ body, portByLabel: {}, page: `/${authoredPort}/latest/guides/state/`, authoredPort, nativeTmux: false, resolver, models, authoredTarget: () => undefined, }).targets @@ -258,10 +260,11 @@ describe('a Java-only libtmux symbol on a Kotlin or Scala page', () => { expect(mentioned('Each call returns the real Java `Missing` for the pane.\n')).toEqual([]) }) - it.each(['kotlin', 'scala'])('leaves the %s page its own symbols and curated names, and sends the JDK\'s names to Java', (pagePort) => { + it.each(['kotlin', 'scala', 'clojure'])('leaves the %s page its own symbols and curated names, and sends the JDK\'s names to Java', (pagePort) => { const said = { pagePort, before: 'the real Java ' } expect(decideMention('Snapshot', said, resolver, models)).toMatchObject({ kind: 'link', port: pagePort }) expect(decideMention('Phaser', said, resolver, models)).toMatchObject({ kind: 'link', port: 'java' }) + if (pagePort === 'clojure') return // A curated name written as a call is still the port's, where the JDK's inventory holds the same word. const curated = pagePort === 'kotlin' ? 'Flow' : 'Vector' expect(decideMention(`${curated}()`, said, resolver, models)).toMatchObject({ kind: 'link', port: pagePort, href: builtinHref(pagePort, curated) }) diff --git a/scripts/build-site.sh b/scripts/build-site.sh index b970b1aec..246049881 100755 --- a/scripts/build-site.sh +++ b/scripts/build-site.sh @@ -322,6 +322,9 @@ elif [ -n "${LIBTMUX_DOCS_SOURCE_SHA:-}" ]; then fi node "$script_dir/stage-port-docs.mjs" --wrappers if [ -n "${LIBTMUX_DOCS_SOURCE_SHA:-}" ]; then + if [ "$LIBTMUX_DOCS_PORT" = clojure ]; then + node "$script_dir/gen-tmux-usage.mjs" --ports clojure + fi # The selected API and wire contracts must come from the same product source. # Python's MCP product has its own checkout and revision. node "$script_dir/gen-mcp-protocol.mjs" --port "$LIBTMUX_DOCS_PORT" --source-bound diff --git a/scripts/gen-api-model.mjs b/scripts/gen-api-model.mjs index 804f74e23..d7a9c0751 100644 --- a/scripts/gen-api-model.mjs +++ b/scripts/gen-api-model.mjs @@ -19,6 +19,8 @@ import { extractRuby } from '../packages/api-model/src/languages/ruby.ts' import { extractPowerShell } from '../packages/api-model/src/languages/powershell.ts' import { extractJulia } from '../packages/api-model/src/languages/julia.ts' import { extractElixir } from '../packages/api-model/src/languages/elixir.ts' +import { extractClojure } from '../packages/api-model/src/languages/clojure.ts' +import { attachCompleteClojureExamples } from '../packages/api-model/src/languages/clojure-examples.ts' import { attachCompleteGoExamples, readCompleteGoExamples } from '../packages/api-model/src/languages/go-examples.ts' import { attachCompleteCSharpExamples } from '../packages/api-model/src/languages/csharp-examples.ts' import { attachCompleteFSharpExamples } from '../packages/api-model/src/languages/fsharp-examples.ts' @@ -97,7 +99,7 @@ function packageVersion(checkout, port, product) { return /^version\s*=\s*"([^"]+)"/m.exec(read(`crates/${crate}/Cargo.toml`))?.[1] ?? /^version\s*=\s*"([^"]+)"/m.exec(read('Cargo.toml'))?.[1] } - if (['java', 'kotlin', 'scala'].includes(port)) return /^libtmuxVersion=(.+)$/m.exec(read('gradle.properties'))?.[1] + if (['java', 'kotlin', 'scala', 'clojure'].includes(port)) return /^libtmuxVersion=(.+)$/m.exec(read('gradle.properties'))?.[1] if (['csharp', 'fsharp'].includes(port)) { const props = read('Directory.Build.props') const prefix = /([^<]+) git(checkout, 'rev-parse', '--verify', '--quiet', r), @@ -304,6 +309,20 @@ const PORTS = { 'docs/guide/scala/', 'examples/src/main/scala/'], repo: 'libtmux/libtmux-java', options: {}, }, + clojure: { + checkout: '~/work/libtmux/libtmux-java-clojure', + root: '.', nativeArtifact: 'build/docs/clojure-api.json', + publicRef: 'refs/remotes/origin/master', + pathRoots: ['libtmux-clojure/', 'libtmux-clojure-core-async/', 'docs/guide/clojure', 'examples/src/main/clojure/'], + generate: ({ head }) => [ + '--init-script', join(repoRoot, 'packages/api-model/scripts/export-clojure.gradle'), + 'exportClojureApi', + `-PlibtmuxClojureExporter=${join(repoRoot, 'packages/api-model/scripts/export-clojure.clj')}`, + `-PlibtmuxDocsSourceRevision=${head}`, + '--max-workers=1', + ], + repo: 'libtmux/libtmux-java', options: {}, + }, fsharp: { checkout: '~/work/libtmux/libtmux-dotnet', root: 'src/LibTmux.FSharp', @@ -587,12 +606,13 @@ for (const [port, cfg] of Object.entries(PORTS)) { } // The commit a reader can actually open, which is not always the one the // model is generated from. See `publicRevision`. - const revision = selectedSource ?? publicRevision(checkout, head, port, cfg.repo) + const revision = selectedSource ?? publicRevision(checkout, head, port, cfg.repo, cfg.publicRef) if (cfg.generate && (!cfg.generateWhen || existsSync(join(checkout, cfg.generateWhen)))) { // Gradle owns dependency tracking; stale generated methods must never be // accepted simply because their output directory already exists. - execFileSync(join(checkout, 'gradlew'), [...cfg.generate, '--console=plain'], { + const generation = typeof cfg.generate === 'function' ? cfg.generate({ head }) : cfg.generate + execFileSync(join(checkout, 'gradlew'), [...generation, '--console=plain'], { cwd: checkout, stdio: 'inherit', }) } @@ -639,8 +659,22 @@ for (const [port, cfg] of Object.entries(PORTS)) { process.exit(1) } const artifact = JSON.parse(readFileSync(artifactPath, 'utf8')) - const nativeExtractors = { ruby: extractRuby, lua: extractLua, powershell: extractPowerShell, julia: extractJulia, elixir: extractElixir } + const nativeExtractors = { ruby: extractRuby, lua: extractLua, powershell: extractPowerShell, julia: extractJulia, elixir: extractElixir, clojure: extractClojure } model = nativeExtractors[port](artifact, head) + if (model.nativeProvenance) { + for (const input of model.nativeProvenance.files) { + const bytes = execFileSync('git', ['-C', checkout, 'show', `${head}:${input.path}`], { maxBuffer: 1 << 26 }) + if (createHash('sha256').update(bytes).digest('hex') !== input.sha256) { + throw new Error(`gen-api-model: ${port} native artifact source differs from ${head}: ${input.path}`) + } + } + for (const input of model.nativeProvenance.exporter.files ?? []) { + const bytes = readFileSync(join(repoRoot, input.path)) + if (createHash('sha256').update(bytes).digest('hex') !== input.sha256) { + throw new Error(`gen-api-model: ${port} native artifact exporter is stale: ${input.path}`) + } + } + } } else { model = await extractProject({ port, @@ -669,6 +703,18 @@ for (const [port, cfg] of Object.entries(PORTS)) { }) } + if (port === 'clojure') { + attachCompleteClojureExamples(model.symbols, (file) => { + try { + return execFileSync('git', ['-C', checkout, 'show', `${revision}:${file}`], { + encoding: 'utf8', maxBuffer: 1 << 26, stdio: ['ignore', 'pipe', 'ignore'], + }) + } catch { + return undefined + } + }, { repo: cfg.repo, revision }) + } + if (['java', 'kotlin', 'scala'].includes(port)) { attachCompleteJvmExamples(model.symbols, port, (file) => { try { diff --git a/scripts/gen-manifest-packages.mjs b/scripts/gen-manifest-packages.mjs index 183ba0afd..dd4bd8cd5 100644 --- a/scripts/gen-manifest-packages.mjs +++ b/scripts/gen-manifest-packages.mjs @@ -12,7 +12,7 @@ * working tree do not matter. * * Usage: - * node scripts/gen-manifest-packages.mjs [--out ] [--check] + * node scripts/gen-manifest-packages.mjs [--out ] [--port ] [--check] * * --out Write there (default: site/src/data/manifest-packages.json). * --check Write nothing; exit 1 if the file is out of date. A port whose @@ -35,16 +35,18 @@ const root = resolve(dirname(fileURLToPath(import.meta.url)), '..') const DEFAULT_OUT = join(root, 'site', 'src', 'data', 'manifest-packages.json') const expand = (path) => (path.startsWith('~/') ? join(homedir(), path.slice(2)) : path) -const opts = { out: DEFAULT_OUT, check: false } +const opts = { out: DEFAULT_OUT, check: false, port: undefined } const argv = process.argv.slice(2) for (let i = 0; i < argv.length; i += 1) { if (argv[i] === '--out') opts.out = argv[++i] + else if (argv[i] === '--port') opts.port = argv[++i] else if (argv[i] === '--check') opts.check = true else if (argv[i] === '-h' || argv[i] === '--help') { console.log(readFileSync(fileURLToPath(import.meta.url), 'utf8').split('*/')[0]) process.exit(0) } else throw new Error(`unrecognised argument: ${argv[i]}`) } +if (opts.port && !PORTS.some((port) => port.slug === opts.port)) throw new Error(`unknown port: ${opts.port}`) /** The Python companions are pinned beside the library, in the API model's sources. */ const COMPANIONS = [ @@ -56,6 +58,7 @@ const COMPANIONS = [ const skipped = [] const ports = {} for (const port of PORTS) { + if (opts.port && port.slug !== opts.port) continue const model = JSON.parse(readFileSync(join(root, 'site', 'src', 'data', 'api', `${port.slug}.json`), 'utf8')) const checkout = expand(process.env[`LIBTMUX_DOCS_CHECKOUT_${port.slug.toUpperCase()}`] ?? port.checkout) const open = (path, revision) => { @@ -96,6 +99,7 @@ if (opts.check) { const committed = JSON.parse(readFileSync(opts.out, 'utf8')) const drift = [] for (const slug of PORTS.map((port) => port.slug)) { + if (opts.port && slug !== opts.port) continue if (!committed.ports?.[slug]) drift.push(`${slug}: missing from the file`) else if (ports[slug] && JSON.stringify(ports[slug]) !== JSON.stringify(committed.ports[slug])) drift.push(`${slug}: differs from its manifests`) } @@ -109,6 +113,9 @@ if (opts.check) { console.log(`${opts.out} is current for ${checked} of ${PORTS.length} ports${skipped.length > 0 ? `; not checked: ${[...new Set(skipped.map(({ slug }) => slug))].join(', ')}` : ''}`) } else { if (skipped.length > 0) throw new Error('refusing to write a partial file; provide the missing checkouts') - writeFileSync(opts.out, text) + if (opts.port) { + const previous = JSON.parse(readFileSync(opts.out, 'utf8')) + writeFileSync(opts.out, `${JSON.stringify({ ...previous, ports: { ...previous.ports, ...ports } }, null, 2)}\n`) + } else writeFileSync(opts.out, text) console.log(`wrote ${opts.out}`) } diff --git a/scripts/gen-mentions.mjs b/scripts/gen-mentions.mjs index 2279091b5..02dbf8506 100755 --- a/scripts/gen-mentions.mjs +++ b/scripts/gen-mentions.mjs @@ -39,7 +39,7 @@ for (const port of PORT_DEFS) { // Match the renderer's external names before considering a cross-port fallback. for (const [file, project, baseUrl, langs] of [ ['python', 'Python', 'https://docs.python.org/3/', ['py']], - ['jdk', 'Java SE', 'https://docs.oracle.com/en/java/javase/21/docs/api/', ['java', 'kotlin', 'scala']], + ['jdk', 'Java SE', 'https://docs.oracle.com/en/java/javase/21/docs/api/', ['java', 'kotlin', 'scala', 'clojure']], ['dom', 'MDN', 'https://developer.mozilla.org/', ['ts']], ['julia', 'Julia', 'https://docs.julialang.org/en/v1/', ['julia']], ]) { diff --git a/scripts/gen-registry.mjs b/scripts/gen-registry.mjs index 4eb7c70cf..cdc73d226 100644 --- a/scripts/gen-registry.mjs +++ b/scripts/gen-registry.mjs @@ -298,6 +298,7 @@ const PROBES = { return [...body.matchAll(/([^<]+)<\/version>/g)].map((m) => m[1]) }, async kotlin(port) { return PROBES.java(port) }, + async clojure(port) { return PROBES.java(port) }, async scala(port) { return PROBES.java(port) }, async fsharp(port) { return PROBES.csharp(port) }, async csharp(port) { diff --git a/scripts/gen-tmux-usage.mjs b/scripts/gen-tmux-usage.mjs index c48e680a1..013991e21 100644 --- a/scripts/gen-tmux-usage.mjs +++ b/scripts/gen-tmux-usage.mjs @@ -257,7 +257,10 @@ function derivePort({ port, scanned, commands, scopes, claims, report, sends }) * Where a core library keeps the source its public symbols come from, for reading it at another revision than its model. * Only a core that a wrapper shares a repository with, and is pinned apart from, needs this. */ -const CORE_EXTRACTION = { csharp: { roots: ['src/LibTmux'], options: { inheritedMembers: true } } } +const CORE_EXTRACTION = { + csharp: { roots: ['src/LibTmux'], options: { inheritedMembers: true } }, + java: { roots: ['libtmux/src/main/java'] }, +} /** The public symbols of a core library as they were at a revision, extracted from that revision's own files. */ async function modelAtRevision({ port, checkout, revision }) { diff --git a/scripts/lib/api-destinations.mjs b/scripts/lib/api-destinations.mjs index 6957c0dad..26e84ebcb 100644 --- a/scripts/lib/api-destinations.mjs +++ b/scripts/lib/api-destinations.mjs @@ -47,7 +47,7 @@ const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..') */ export const EXTERNAL_INVENTORIES = [ { file: 'python', project: 'Python', baseUrl: 'https://docs.python.org/3/', langs: ['py'] }, - { file: 'jdk', project: 'Java SE', baseUrl: 'https://docs.oracle.com/en/java/javase/21/docs/api/', langs: ['java', 'kotlin', 'scala'] }, + { file: 'jdk', project: 'Java SE', baseUrl: 'https://docs.oracle.com/en/java/javase/21/docs/api/', langs: ['java', 'kotlin', 'scala', 'clojure'] }, { file: 'dom', project: 'MDN Web Docs', baseUrl: 'https://developer.mozilla.org/', langs: ['ts'] }, { file: 'julia', project: 'Julia', baseUrl: 'https://docs.julialang.org/en/v1/', langs: ['julia'] }, ] @@ -62,6 +62,7 @@ export const API_HOSTS = new Set([ 'docs.oracle.com', 'docs.junit.org', 'kotlinlang.org', 'www.scala-lang.org', 'docs.scala-lang.org', 'typelevel.org', 'javadoc.io', 'learn.microsoft.com', 'fsharp.github.io', 'en.cppreference.com', 'eel.is', 'developer.apple.com', 'docs.swift.org', 'docs.ruby-lang.org', 'ruby-doc.org', 'www.lua.org', 'luals.github.io', 'docs.julialang.org', 'hexdocs.pm', 'www.erlang.org', + 'clojure.org', 'clojure.github.io', 'gofastmcp.com', 'csharp.sdk.modelcontextprotocol.io', 'ts.sdk.modelcontextprotocol.io', 'modelcontextprotocol.io', 'cmake.org', ]) diff --git a/scripts/lib/api-links.mjs b/scripts/lib/api-links.mjs index b2fcfae9c..30cfd0530 100644 --- a/scripts/lib/api-links.mjs +++ b/scripts/lib/api-links.mjs @@ -88,6 +88,7 @@ export function languageOfUrl(url) { 'developer.mozilla.org': 'typescript', 'www.typescriptlang.org': 'typescript', 'docs.junit.org': 'java', 'javadoc.io': 'java', 'kotlinlang.org': 'kotlin', + 'clojure.org': 'clojure', 'clojure.github.io': 'clojure', 'www.scala-lang.org': 'scala', 'docs.scala-lang.org': 'scala', 'typelevel.org': 'scala', 'fsharp.github.io': 'fsharp', 'csharp.sdk.modelcontextprotocol.io': 'csharp', 'ts.sdk.modelcontextprotocol.io': 'typescript', 'en.cppreference.com': 'cpp', 'eel.is': 'cpp', 'cmake.org': 'cpp', @@ -108,7 +109,7 @@ export function languageOfUrl(url) { /** The languages each port's documentation legitimately reaches: its own, and what its platform shares. */ export const PORT_LANGUAGES = { py: ['python'], rs: ['rust'], go: ['go'], ts: ['typescript'], java: ['java'], - kotlin: ['kotlin', 'java'], scala: ['scala', 'java'], + kotlin: ['kotlin', 'java'], scala: ['scala', 'java'], clojure: ['clojure', 'java'], csharp: ['csharp', 'dotnet'], fsharp: ['fsharp', 'dotnet'], powershell: ['powershell', 'dotnet'], cxx: ['cpp'], swift: ['swift'], julia: ['julia'], lua: ['lua'], elixir: ['elixir', 'erlang'], ruby: ['ruby'], } diff --git a/scripts/lib/api-sources.mjs b/scripts/lib/api-sources.mjs index 4d42bbbaa..88731a990 100644 --- a/scripts/lib/api-sources.mjs +++ b/scripts/lib/api-sources.mjs @@ -89,6 +89,7 @@ export const ARITIES = { /** Owners a port's names have without an import: what the language provides, as page owners written with dots. */ export const DEFAULT_SCOPES = { java: ['java.lang'], + clojure: ['java.lang'], kotlin: ['kotlin', 'kotlin.collections', 'kotlin.text', 'kotlin.io', 'kotlin.ranges', 'kotlin.sequences', 'kotlin.annotation', 'kotlin.comparisons', 'kotlin.jvm', 'java.lang'], // `scala`, `scala.Predef` and `java.lang` are imported as a whole. What the package object and Predef bind to a collection is per name (`DEFAULT_NAMES`). scala: ['scala', 'scala.Predef', 'java.lang'], @@ -133,7 +134,7 @@ export const BARE_OWNERS = Object.fromEntries(Object.entries({ java: { 'java.util': ['List', 'Set', 'Map', 'Optional', 'OptionalInt', 'OptionalLong', 'Collection', 'Iterator'], 'java.util.function': ['Function', 'Supplier', 'Consumer', 'Predicate', 'LongSupplier'], - 'java.util.concurrent': ['Executor', 'TimeUnit'], + 'java.util.concurrent': ['Executor', 'TimeUnit', 'CompletionStage'], 'io.modelcontextprotocol.server': ['McpSyncServer'], 'io.modelcontextprotocol.spec': ['McpServerTransportProvider'], 'java.util.regex': ['Pattern'], 'java.nio.file': ['Path'], 'java.nio': ['ByteBuffer'], 'java.time': ['Duration', 'Instant'], @@ -147,6 +148,10 @@ export const BARE_OWNERS = Object.fromEntries(Object.entries({ 'kotlinx.coroutines.flow': ['Flow', 'FlowCollector', 'StateFlow', 'MutableStateFlow', 'collect'], 'java.nio.file': ['Path'], }, + clojure: { + 'java.time': ['Instant'], + 'java.util.concurrent': ['CompletionStage'], + }, scala: { 'cats.effect.kernel': ['Async', 'Deferred', 'Outcome', 'Resource', 'Fiber', 'Ref'], 'fs2.concurrent': ['Signal', 'SignallingRef'], 'scala.concurrent': ['ExecutionContext'], 'scala.util': ['Using'], 'cats.effect': ['IO'], diff --git a/scripts/lib/destination-verification.mjs b/scripts/lib/destination-verification.mjs index 70af3910b..b193c276c 100644 --- a/scripts/lib/destination-verification.mjs +++ b/scripts/lib/destination-verification.mjs @@ -16,7 +16,7 @@ * says it could not. */ -import { entryCandidates, entryDestinations } from '../../site/src/lib/port-inventory.ts' +import { documentedLibrary, entryCandidates, entryDestinations } from '../../site/src/lib/port-inventory.ts' export const USER_AGENT = 'libtmux-docs destination check (+https://libtmux.org)' @@ -577,15 +577,17 @@ export function staleWarnings(stale, maxAgeDays = EVIDENCE_MAX_AGE_DAYS) { * * A registered port the inventory omits gets no header links and no * verification, and nothing else notices: the header just offers nothing. So - * each registered port must have an entry whose library is published, which is - * what the header builds its links from, and each entry must belong to a - * registered port. + * Each port needs a published library or an unpublished library with a public + * source installation. An unknown port cannot acquire inventory entries. */ export function inventoryCoverage(inventory, registered) { const missing = registered.filter((slug) => !inventory[slug]?.length) .map((slug) => `${slug} is registered in ports.ts but has no inventory entry, so its header offers nothing`) - const unlinked = registered.filter((slug) => inventory[slug]?.length && !inventory[slug].some((entry) => entry.kind === 'library' && entry.status === 'published')) - .map((slug) => `${slug} has no published library entry, so its header offers nothing`) + const unlinked = registered.filter((slug) => { + const entries = inventory[slug] + if (!entries?.length) return false + return !documentedLibrary(entries) + }).map((slug) => `${slug} has no published library entry or documented public source installation`) const orphaned = Object.keys(inventory).filter((slug) => !registered.includes(slug)) .map((slug) => `${slug} has inventory entries but is not registered in ports.ts`) return [...missing, ...unlinked, ...orphaned] diff --git a/scripts/lib/manifest-packages.mjs b/scripts/lib/manifest-packages.mjs index 78937bc5f..0c394e839 100644 --- a/scripts/lib/manifest-packages.mjs +++ b/scripts/lib/manifest-packages.mjs @@ -167,7 +167,7 @@ const READERS = { if (!repo.has(manifest)) return [] const build = repo.read(manifest) const scala = build.includes('libtmux.published-scala-library') - if (!scala && !/libtmux\.(?:published-library|publication)\b/.test(build)) return [] + if (!scala && !/libtmux\.(?:published-library|publication|clojure-library)\b/.test(build)) return [] return [{ name: `io.github.libtmux:${directory}${scala ? '_3' : ''}`, version, manifest }] }) return { distributions, units: [] } @@ -224,7 +224,7 @@ const READERS = { /** Which reader a port uses: a wrapper port reads its parent's repository. */ const READER_FOR = { py: 'py', ruby: 'ruby', lua: 'lua', powershell: 'powershell', julia: 'julia', ts: 'ts', rs: 'rs', go: 'go', - java: 'java', kotlin: 'java', scala: 'java', csharp: 'dotnet', fsharp: 'dotnet', cxx: 'cxx', swift: 'swift', elixir: 'elixir', + java: 'java', clojure: 'java', kotlin: 'java', scala: 'java', csharp: 'dotnet', fsharp: 'dotnet', cxx: 'cxx', swift: 'swift', elixir: 'elixir', } /** diff --git a/scripts/lib/tmux-usage-clojure.mjs b/scripts/lib/tmux-usage-clojure.mjs new file mode 100644 index 000000000..98136e70c --- /dev/null +++ b/scripts/lib/tmux-usage-clojure.mjs @@ -0,0 +1,95 @@ +/** Read Clojure definitions and Java interop calls without evaluating forms. */ +function forms(text) { + let at = 0 + let line = 1 + const step = () => { if (text[at++] === '\n') line++ } + const skip = () => { + while (at < text.length) { + if (/[\s,]/.test(text[at])) step() + else if (text[at] === ';') { while (at < text.length && text[at] !== '\n') step() } + else break + } + } + const read = () => { + skip() + const start = line + if (at >= text.length) throw new Error(`Incomplete Clojure form at line ${line}`) + if (text.startsWith('#_', at)) { step(); step(); read(); return { kind: 'ignored', start, end: line } } + if (text[at] === '^') { step(); read(); return read() } + if (text[at] === "'" || text[at] === '`' || text.startsWith("#'", at)) { + if (text[at] === '#') step() + step(); read(); return { kind: 'ignored', start, end: line } + } + let prefix = '' + if (text[at] === '#' && '({"'.includes(text[at + 1] ?? ' ')) { prefix = '#'; step() } + const open = text[at] + if ('([{'.includes(open)) { + const close = { '(': ')', '[': ']', '{': '}' }[open] + const children = [] + step(); skip() + while (at < text.length && text[at] !== close) { children.push(read()); skip() } + if (text[at] !== close) throw new Error(`Unclosed Clojure form at line ${start}`) + step() + return { kind: open === '(' ? 'list' : 'data', children, start, end: line, prefix } + } + if (open === '"') { + let value = '' + step() + while (at < text.length && text[at] !== '"') { + if (text[at] === '\\') { step(); value += text[at] ?? ''; step() } + else { value += text[at]; step() } + } + if (text[at] !== '"') throw new Error(`Unclosed Clojure string at line ${start}`) + step() + return { kind: prefix ? 'ignored' : 'string', value, start, end: line } + } + const begin = at + if (text[at] === '\\') { step(); if (at < text.length) step() } + while (at < text.length && !/[\s,()[\]{}";]/.test(text[at])) step() + if (at === begin) throw new Error(`Unexpected Clojure delimiter at line ${line}`) + return { kind: 'symbol', value: text.slice(begin, at), start, end: line } + } + const result = [] + skip() + while (at < text.length) { result.push(read()); skip() } + return result +} + +/** Source spans, calls and literal sends; dynamic argv stays unclassified. */ +export function scanClojure(text, { commands, dispatch = new Set() }) { + const functions = [] + const strings = (node) => node.kind === 'string' ? [node] : node.kind === 'data' ? node.children.flatMap(strings) : [] + const walk = (node, fn) => { + if (node.kind === 'ignored' || node.children?.[0]?.value === 'comment') return + if (node.kind === 'list') { + const head = node.children[0] + if (head?.kind === 'symbol') { + let name = head.value + let receiver + if (name.startsWith('.')) { name = name.slice(1); receiver = node.children[1]?.value } + else if (name.includes('/')) { [receiver, name] = name.split('/') } + if (!fn.calls.has(name)) fn.calls.set(name, head.start) + if (receiver) fn.receivers.set(name, new Set([...(fn.receivers.get(name) ?? []), receiver.toLowerCase()])) + if (dispatch.has(name)) { + const literals = node.children.slice(1).flatMap(strings) + const command = literals[0] + if (commands.has(command?.value)) fn.sites.push({ + command: command.value, line: command.start, + flags: [...new Set(literals.slice(1).flatMap((token) => /^-[A-Za-z]+$/.test(token.value) ? Array.from(token.value.slice(1)) : []))].sort().join(''), + dispatch: { name, line: head.start }, + }) + } + } + } + for (const child of node.children ?? []) walk(child, fn) + } + for (const form of forms(text)) { + const [head, name, ...body] = form.children ?? [] + if (form.kind !== 'list' || !['defn', 'defn-'].includes(head?.value) || name?.kind !== 'symbol') continue + const fn = { name: name.value, start: form.start, nameLine: name.start, end: form.end, + kind: 'function', sites: [], calls: new Map(), receivers: new Map() } + for (const child of body) if (child.kind !== 'string') walk(child, fn) + functions.push(fn) + } + return { functions, types: [], orphans: [] } +} diff --git a/scripts/lib/tmux-usage-scan.mjs b/scripts/lib/tmux-usage-scan.mjs index 6288c77b3..b4fe83e84 100644 --- a/scripts/lib/tmux-usage-scan.mjs +++ b/scripts/lib/tmux-usage-scan.mjs @@ -8,16 +8,17 @@ */ import { parserFor } from '../../packages/api-model/src/parser.ts' import { receiverOf, scanElixir, scanFSharp, scanJulia } from './tmux-usage-lexical.mjs' +import { scanClojure } from './tmux-usage-clojure.mjs' /** Port to the grammar that reads its source. PowerShell cmdlets are C#; Julia, F# and Elixir are read by their text. */ export const GRAMMARS = { - py: 'python', ts: 'typescript', rs: 'rust', go: 'go', java: 'java', kotlin: 'kotlin', scala: 'scala', + py: 'python', ts: 'typescript', rs: 'rust', go: 'go', java: 'java', clojure: 'clojure', kotlin: 'kotlin', scala: 'scala', csharp: 'csharp', powershell: 'csharp', cxx: 'cpp', swift: 'swift', ruby: 'ruby', lua: 'lua', julia: 'julia', fsharp: 'fsharp', elixir: 'elixir', } /** Source extensions per grammar, minus declaration-only files. */ export const EXTENSIONS = { - python: /\.py$/, typescript: /(? [sourcePath, [guide.route]])) const nativeReferenceFiles = new Set() for (const redirect of sourceGuideRedirectsFor(port)) linkRoutes[redirect.sourcePath] = [redirect.target] + if (identity.sourceReferenceFiles) { + const { symbols } = JSON.parse(readFileSync(join(root, `site/src/data/api/${port}.json`), 'utf8')) + for (const { file, package: coordinate } of identity.sourceReferenceFiles) { + nativeReferenceFiles.add(file) + for (const symbol of symbols.filter((entry) => entry.package === coordinate)) { + const fragment = (symbol.publicId ?? symbol.id).toLowerCase().replace(/[^\w-]/g, '') + linkRoutes[`${file}#${fragment}`] = [`reference/${symbol.slug}`] + } + } + } if (port === 'powershell') { const model = JSON.parse(readFileSync(join(root, 'site/src/data/api/powershell.json'), 'utf8')) const files = new Set(model.nativeProvenance.files.map((file) => file.path)) diff --git a/scripts/tmux-usage/claims.json b/scripts/tmux-usage/claims.json index e22e5ab83..cc5abb325 100644 --- a/scripts/tmux-usage/claims.json +++ b/scripts/tmux-usage/claims.json @@ -15193,6 +15193,456 @@ "in": "server.Server.kill" } ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "command": "list-sessions", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:161", + "has": [ + "\"list-sessions\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "has": [ + "snapshot()" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:151", + "has": [ + "(.captureServer server)" + ], + "in": "libtmux.core/snapshot!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "command": "list-windows", + "scope": "server", + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:162", + "has": [ + "\"list-windows\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "has": [ + "snapshot()" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:151", + "has": [ + "(.captureServer server)" + ], + "in": "libtmux.core/snapshot!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "command": "list-panes", + "scope": "server", + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:163", + "has": [ + "\"list-panes\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "has": [ + "snapshot()" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:151", + "has": [ + "(.captureServer server)" + ], + "in": "libtmux.core/snapshot!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "command": "list-clients", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:164", + "has": [ + "\"list-clients\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "has": [ + "snapshot()" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:151", + "has": [ + "(.captureServer server)" + ], + "in": "libtmux.core/snapshot!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/new-session!", + "command": "new-session", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SessionSpec.java:119", + "has": [ + "argv.add(\"new-session\")" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:255", + "has": [ + "run(spec.argv(" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:252", + "has": [ + "(.newSession server spec)" + ], + "in": "libtmux.core/new-session!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/new-window!", + "command": "new-window", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/WindowSpec.java:117", + "has": [ + "argv.add(\"new-window\")" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Session.java:260", + "has": [ + "server.run(snapshot, spec.argv(" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:263", + "has": [ + "(.newWindow session spec)" + ], + "in": "libtmux.core/new-window!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/find-session!", + "command": "list-sessions", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:161", + "has": [ + "listings.add(listing(SESSIONS, \"list-sessions\"))" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:165", + "has": [ + "listings.run()" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "has": [ + "new CapturedServer(this, snapshot())" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:169", + "has": [ + "(sessions! server)" + ], + "in": "libtmux.core/find-session!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/append-hook!", + "command": "set-hook", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Hooks.java:97", + "has": [ + "run(argv(\"set-hook\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Hooks.java:84", + "has": [ + "append(event, words(command))" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:473", + "has": [ + "(.append (hooks-reference reference)" + ], + "in": "libtmux.core/append-hook!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/set-hook!", + "command": "set-hook", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Hooks.java:66", + "has": [ + "run(argv(\"set-hook\"" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Hooks.java:78", + "has": [ + "set(event, words(command))" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:468", + "has": [ + "(.set (hooks-reference reference)" + ], + "in": "libtmux.core/set-hook!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/unset-hook!", + "command": "set-hook", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Hooks.java:103", + "has": [ + "run(argv(\"set-hook\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:478", + "has": [ + "(.unset (hooks-reference reference)" + ], + "in": "libtmux.core/unset-hook!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/delete-buffer!", + "command": "delete-buffer", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Buffers.java:96", + "has": [ + "server.cmd(List.of(\"delete-buffer\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:494", + "has": [ + "(.delete (.buffers server)" + ], + "in": "libtmux.core/delete-buffer!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/show-buffer!", + "command": "show-buffer", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Buffers.java:76", + "has": [ + "server.cmd(List.of(\"show-buffer\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:489", + "has": [ + "(.show (.buffers server)" + ], + "in": "libtmux.core/show-buffer!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/set-buffer!", + "command": "set-buffer", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Buffers.java:60", + "has": [ + "server.run(List.of(\"set-buffer\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:484", + "has": [ + "(.set (.buffers server)" + ], + "in": "libtmux.core/set-buffer!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/set-option!", + "command": "set-option", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Options.java:325", + "has": [ + "run(argv(\"set-option\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:425", + "has": [ + "(.set (options-reference reference)" + ], + "in": "libtmux.core/set-option!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/unset-option!", + "command": "set-option", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Options.java:370", + "has": [ + "run(argv(\"set-option\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:430", + "has": [ + "(.unset (options-reference reference)" + ], + "in": "libtmux.core/unset-option!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/set-environment!", + "command": "set-environment", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Environment.java:353", + "has": [ + "command(\"set-environment\", tail)" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Environment.java:156", + "has": [ + "run(argv(List.of(" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:447", + "has": [ + "(.set (environment-reference reference)" + ], + "in": "libtmux.core/set-environment!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/unset-environment!", + "command": "set-environment", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Environment.java:353", + "has": [ + "command(\"set-environment\", tail)" + ] + }, + { + "at": "libtmux/src/main/java/io/github/libtmux/Environment.java:168", + "has": [ + "run(argv(List.of(" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:452", + "has": [ + "(.unset (environment-reference reference)" + ], + "in": "libtmux.core/unset-environment!" + } + ] + }, + { + "port": "clojure", + "symbol": "libtmux.core/run-shell!", + "command": "run-shell", + "scope": null, + "evidence": [ + { + "at": "libtmux/src/main/java/io/github/libtmux/Shell.java:29", + "has": [ + "server.run(List.of(\"run-shell\"" + ] + }, + { + "at": "libtmux-clojure/src/main/clojure/libtmux/core.clj:382", + "has": [ + "(.run (.shell server)" + ], + "in": "libtmux.core/run-shell!" + } + ] } ] } diff --git a/scripts/tmux-usage/forwarders.json b/scripts/tmux-usage/forwarders.json index 742756247..fd6beac08 100644 --- a/scripts/tmux-usage/forwarders.json +++ b/scripts/tmux-usage/forwarders.json @@ -1,6 +1,7 @@ { "schemaVersion": 1, "forwarders": { + "clojure": { "parent": "java" }, "kotlin": { "parent": "java", "generated": { diff --git a/scripts/type-links-ceiling.json b/scripts/type-links-ceiling.json index 27e19d6e2..efb1d98d1 100644 --- a/scripts/type-links-ceiling.json +++ b/scripts/type-links-ceiling.json @@ -9,6 +9,7 @@ "rs": 421, "go": 2, "java": 51, + "clojure": 258, "csharp": 18, "cxx": 46, "swift": 1680, diff --git a/scripts/xref-floor.json b/scripts/xref-floor.json index 35dfb66f3..c3e758c67 100644 --- a/scripts/xref-floor.json +++ b/scripts/xref-floor.json @@ -9,6 +9,7 @@ "rs": 4330, "go": 13216, "java": 1672, + "clojure": 673, "csharp": 3182, "cxx": 1982, "swift": 3739, diff --git a/site/public/_shell/brand.css b/site/public/_shell/brand.css index cfdcb30bd..139bc527f 100644 --- a/site/public/_shell/brand.css +++ b/site/public/_shell/brand.css @@ -1999,3 +1999,128 @@ html[data-brand="elixir"][data-theme-mode="dark"], html[data-brand="elixir"][dat --lt-color-code-bg: #1c2229; } } +html[data-brand="clojure"] { + color-scheme: light; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #632826; + --theme-secondary: #53606d; + --theme-accent: #632826; + --theme-background: #fafbfc; + --theme-text: #202830; + --background-color: #fafbfc; + --text-color: #202830; + --topnav-background: #fafbfc; + --topnav-text-color: #202830; + --topnav-link-color: #53606d; + --topnav-link-hover-color: #202830; + --color-background-primary: #fafbfc; + --color-background-secondary: #f3f5f7; + --color-background-border: #d6dce3; + --color-api-background-hover: #e9edf1; + --color-foreground-primary: #202830; + --color-foreground-secondary: #53606d; + --color-foreground-muted: #53606d; + --color-link: #632826; + --color-brand-primary: #632826; + --color-brand-content: #632826; + --color-inline-code-background: #f3f5f7; + --lt-color-bg: #fafbfc; + --lt-color-bg-secondary: #f3f5f7; + --lt-color-bg-hover: #e9edf1; + --lt-color-fg: #202830; + --lt-color-fg-secondary: #53606d; + --lt-color-fg-muted: #53606d; + --lt-color-border: #d6dce3; + --lt-color-accent: #632826; + --lt-color-link: #632826; + --lt-color-link-visited: #632826; + --lt-color-code-bg: #f3f5f7; +} +html[data-brand="clojure"][data-theme-mode="dark"], html[data-brand="clojure"][data-theme="dark"] { + color-scheme: dark; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #f4cdcc; + --theme-secondary: #b7c1cd; + --theme-accent: #f4cdcc; + --theme-background: #15191d; + --theme-text: #e7edf3; + --background-color: #15191d; + --text-color: #e7edf3; + --topnav-background: #15191d; + --topnav-text-color: #e7edf3; + --topnav-link-color: #b7c1cd; + --topnav-link-hover-color: #e7edf3; + --color-background-primary: #15191d; + --color-background-secondary: #1c2229; + --color-background-border: #3e4a57; + --color-api-background-hover: #29323d; + --color-foreground-primary: #e7edf3; + --color-foreground-secondary: #b7c1cd; + --color-foreground-muted: #b7c1cd; + --color-link: #f4cdcc; + --color-brand-primary: #f4cdcc; + --color-brand-content: #f4cdcc; + --color-inline-code-background: #1c2229; + --lt-color-bg: #15191d; + --lt-color-bg-secondary: #1c2229; + --lt-color-bg-hover: #29323d; + --lt-color-fg: #e7edf3; + --lt-color-fg-secondary: #b7c1cd; + --lt-color-fg-muted: #b7c1cd; + --lt-color-border: #3e4a57; + --lt-color-accent: #f4cdcc; + --lt-color-link: #f4cdcc; + --lt-color-link-visited: #f4cdcc; + --lt-color-code-bg: #1c2229; +} +@media (prefers-color-scheme: dark) { + html[data-brand="clojure"]:not([data-theme-mode]):not([data-theme="light"]) { + color-scheme: dark; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #f4cdcc; + --theme-secondary: #b7c1cd; + --theme-accent: #f4cdcc; + --theme-background: #15191d; + --theme-text: #e7edf3; + --background-color: #15191d; + --text-color: #e7edf3; + --topnav-background: #15191d; + --topnav-text-color: #e7edf3; + --topnav-link-color: #b7c1cd; + --topnav-link-hover-color: #e7edf3; + --color-background-primary: #15191d; + --color-background-secondary: #1c2229; + --color-background-border: #3e4a57; + --color-api-background-hover: #29323d; + --color-foreground-primary: #e7edf3; + --color-foreground-secondary: #b7c1cd; + --color-foreground-muted: #b7c1cd; + --color-link: #f4cdcc; + --color-brand-primary: #f4cdcc; + --color-brand-content: #f4cdcc; + --color-inline-code-background: #1c2229; + --lt-color-bg: #15191d; + --lt-color-bg-secondary: #1c2229; + --lt-color-bg-hover: #29323d; + --lt-color-fg: #e7edf3; + --lt-color-fg-secondary: #b7c1cd; + --lt-color-fg-muted: #b7c1cd; + --lt-color-border: #3e4a57; + --lt-color-accent: #f4cdcc; + --lt-color-link: #f4cdcc; + --lt-color-link-visited: #f4cdcc; + --lt-color-code-bg: #1c2229; + } +} diff --git a/site/public/_shell/shell.js b/site/public/_shell/shell.js index c9779493e..1a9f60cf3 100644 --- a/site/public/_shell/shell.js +++ b/site/public/_shell/shell.js @@ -14,6 +14,7 @@ {"slug":"rs","name":"Rust","shortName":"Rs","logoLanguage":"rust","versionedDocs":true,"mcp":true}, {"slug":"go","name":"Go","shortName":"Go","logoLanguage":"go","versionedDocs":true,"mcp":true}, {"slug":"java","name":"Java","shortName":"Java","logoLanguage":"java","versionedDocs":true,"mcp":true}, + {"slug":"clojure","name":"Clojure","shortName":"Clj","logoLanguage":"clojure","versionedDocs":true,"mcp":false}, {"slug":"kotlin","name":"Kotlin","shortName":"Kt","logoLanguage":"kotlin","versionedDocs":true,"mcp":false}, {"slug":"scala","name":"Scala","shortName":"Sc","logoLanguage":"scala","versionedDocs":true,"mcp":false}, {"slug":"csharp","name":"C#","shortName":"C#","logoLanguage":"csharp","versionedDocs":true,"mcp":true}, diff --git a/site/public/brand/catalog.json b/site/public/brand/catalog.json index fc11e07b2..44429fec3 100644 --- a/site/public/brand/catalog.json +++ b/site/public/brand/catalog.json @@ -99,6 +99,11 @@ "id": "elixir", "label": "Elixir", "githubColor": "#8847B9" + }, + { + "id": "clojure", + "label": "Clojure", + "githubColor": "#DB5855" } ], "variants": [ @@ -523,7 +528,7 @@ "label": "Python", "variant": "workspace", "githubColor": "#3572A5", - "alt": "libtmux for Python — workspace CLI", + "alt": "libtmux for Python \u2014 workspace CLI", "files": [ { "file": "python/workspace/logo.svg", @@ -934,7 +939,7 @@ "label": "Python", "variant": "mcp", "githubColor": "#3572A5", - "alt": "libtmux for Python — MCP", + "alt": "libtmux for Python \u2014 MCP", "files": [ { "file": "python/mcp/logo.svg", @@ -1756,7 +1761,7 @@ "label": "TypeScript", "variant": "workspace", "githubColor": "#3178C6", - "alt": "libtmux for TypeScript — workspace CLI", + "alt": "libtmux for TypeScript \u2014 workspace CLI", "files": [ { "file": "typescript/workspace/logo.svg", @@ -2167,7 +2172,7 @@ "label": "TypeScript", "variant": "mcp", "githubColor": "#3178C6", - "alt": "libtmux for TypeScript — MCP", + "alt": "libtmux for TypeScript \u2014 MCP", "files": [ { "file": "typescript/mcp/logo.svg", @@ -2989,7 +2994,7 @@ "label": "Rust", "variant": "workspace", "githubColor": "#DEA584", - "alt": "libtmux for Rust — workspace CLI", + "alt": "libtmux for Rust \u2014 workspace CLI", "files": [ { "file": "rust/workspace/logo.svg", @@ -3400,7 +3405,7 @@ "label": "Rust", "variant": "mcp", "githubColor": "#DEA584", - "alt": "libtmux for Rust — MCP", + "alt": "libtmux for Rust \u2014 MCP", "files": [ { "file": "rust/mcp/logo.svg", @@ -4222,7 +4227,7 @@ "label": "Go", "variant": "workspace", "githubColor": "#00ADD8", - "alt": "libtmux for Go — workspace CLI", + "alt": "libtmux for Go \u2014 workspace CLI", "files": [ { "file": "go/workspace/logo.svg", @@ -4633,7 +4638,7 @@ "label": "Go", "variant": "mcp", "githubColor": "#00ADD8", - "alt": "libtmux for Go — MCP", + "alt": "libtmux for Go \u2014 MCP", "files": [ { "file": "go/mcp/logo.svg", @@ -5455,7 +5460,7 @@ "label": "Java", "variant": "workspace", "githubColor": "#B07219", - "alt": "libtmux for Java — workspace CLI", + "alt": "libtmux for Java \u2014 workspace CLI", "files": [ { "file": "java/workspace/logo.svg", @@ -5866,7 +5871,7 @@ "label": "Java", "variant": "mcp", "githubColor": "#B07219", - "alt": "libtmux for Java — MCP", + "alt": "libtmux for Java \u2014 MCP", "files": [ { "file": "java/mcp/logo.svg", @@ -6688,7 +6693,7 @@ "label": "C# / .NET", "variant": "workspace", "githubColor": "#7355DD", - "alt": "libtmux for C# / .NET — workspace CLI", + "alt": "libtmux for C# / .NET \u2014 workspace CLI", "files": [ { "file": "csharp/workspace/logo.svg", @@ -7099,7 +7104,7 @@ "label": "C# / .NET", "variant": "mcp", "githubColor": "#7355DD", - "alt": "libtmux for C# / .NET — MCP", + "alt": "libtmux for C# / .NET \u2014 MCP", "files": [ { "file": "csharp/mcp/logo.svg", @@ -7921,7 +7926,7 @@ "label": "C++", "variant": "workspace", "githubColor": "#F34B7D", - "alt": "libtmux for C++ — workspace CLI", + "alt": "libtmux for C++ \u2014 workspace CLI", "files": [ { "file": "cpp/workspace/logo.svg", @@ -8332,7 +8337,7 @@ "label": "C++", "variant": "mcp", "githubColor": "#F34B7D", - "alt": "libtmux for C++ — MCP", + "alt": "libtmux for C++ \u2014 MCP", "files": [ { "file": "cpp/mcp/logo.svg", @@ -9154,7 +9159,7 @@ "label": "Swift", "variant": "workspace", "githubColor": "#F05138", - "alt": "libtmux for Swift — workspace CLI", + "alt": "libtmux for Swift \u2014 workspace CLI", "files": [ { "file": "swift/workspace/logo.svg", @@ -9565,7 +9570,7 @@ "label": "Swift", "variant": "mcp", "githubColor": "#F05138", - "alt": "libtmux for Swift — MCP", + "alt": "libtmux for Swift \u2014 MCP", "files": [ { "file": "swift/mcp/logo.svg", @@ -10387,7 +10392,7 @@ "label": "Julia", "variant": "workspace", "githubColor": "#A270BA", - "alt": "libtmux for Julia — workspace CLI", + "alt": "libtmux for Julia \u2014 workspace CLI", "files": [ { "file": "julia/workspace/logo.svg", @@ -10798,7 +10803,7 @@ "label": "Julia", "variant": "mcp", "githubColor": "#A270BA", - "alt": "libtmux for Julia — MCP", + "alt": "libtmux for Julia \u2014 MCP", "files": [ { "file": "julia/mcp/logo.svg", @@ -11620,7 +11625,7 @@ "label": "Ruby", "variant": "workspace", "githubColor": "#701516", - "alt": "libtmux for Ruby — workspace CLI", + "alt": "libtmux for Ruby \u2014 workspace CLI", "files": [ { "file": "ruby/workspace/logo.svg", @@ -12031,7 +12036,7 @@ "label": "Ruby", "variant": "mcp", "githubColor": "#701516", - "alt": "libtmux for Ruby — MCP", + "alt": "libtmux for Ruby \u2014 MCP", "files": [ { "file": "ruby/mcp/logo.svg", @@ -12853,7 +12858,7 @@ "label": "Lua", "variant": "workspace", "githubColor": "#000080", - "alt": "libtmux for Lua — workspace CLI", + "alt": "libtmux for Lua \u2014 workspace CLI", "files": [ { "file": "lua/workspace/logo.svg", @@ -13264,7 +13269,7 @@ "label": "Lua", "variant": "mcp", "githubColor": "#000080", - "alt": "libtmux for Lua — MCP", + "alt": "libtmux for Lua \u2014 MCP", "files": [ { "file": "lua/mcp/logo.svg", @@ -14086,7 +14091,7 @@ "label": "PowerShell", "variant": "workspace", "githubColor": "#012456", - "alt": "libtmux for PowerShell — workspace CLI", + "alt": "libtmux for PowerShell \u2014 workspace CLI", "files": [ { "file": "powershell/workspace/logo.svg", @@ -14497,7 +14502,7 @@ "label": "PowerShell", "variant": "mcp", "githubColor": "#012456", - "alt": "libtmux for PowerShell — MCP", + "alt": "libtmux for PowerShell \u2014 MCP", "files": [ { "file": "powershell/mcp/logo.svg", @@ -15319,7 +15324,7 @@ "label": "F#", "variant": "workspace", "githubColor": "#B845FC", - "alt": "libtmux for F# — workspace CLI", + "alt": "libtmux for F# \u2014 workspace CLI", "files": [ { "file": "fsharp/workspace/logo.svg", @@ -15730,7 +15735,7 @@ "label": "F#", "variant": "mcp", "githubColor": "#B845FC", - "alt": "libtmux for F# — MCP", + "alt": "libtmux for F# \u2014 MCP", "files": [ { "file": "fsharp/mcp/logo.svg", @@ -16552,7 +16557,7 @@ "label": "Scala", "variant": "workspace", "githubColor": "#C22D40", - "alt": "libtmux for Scala — workspace CLI", + "alt": "libtmux for Scala \u2014 workspace CLI", "files": [ { "file": "scala/workspace/logo.svg", @@ -16963,7 +16968,7 @@ "label": "Scala", "variant": "mcp", "githubColor": "#C22D40", - "alt": "libtmux for Scala — MCP", + "alt": "libtmux for Scala \u2014 MCP", "files": [ { "file": "scala/mcp/logo.svg", @@ -17785,7 +17790,7 @@ "label": "Kotlin", "variant": "workspace", "githubColor": "#A97BFF", - "alt": "libtmux for Kotlin — workspace CLI", + "alt": "libtmux for Kotlin \u2014 workspace CLI", "files": [ { "file": "kotlin/workspace/logo.svg", @@ -18196,7 +18201,7 @@ "label": "Kotlin", "variant": "mcp", "githubColor": "#A97BFF", - "alt": "libtmux for Kotlin — MCP", + "alt": "libtmux for Kotlin \u2014 MCP", "files": [ { "file": "kotlin/mcp/logo.svg", @@ -19018,7 +19023,7 @@ "label": "Elixir", "variant": "workspace", "githubColor": "#8847B9", - "alt": "libtmux for Elixir — workspace CLI", + "alt": "libtmux for Elixir \u2014 workspace CLI", "files": [ { "file": "elixir/workspace/logo.svg", @@ -19429,7 +19434,7 @@ "label": "Elixir", "variant": "mcp", "githubColor": "#8847B9", - "alt": "libtmux for Elixir — MCP", + "alt": "libtmux for Elixir \u2014 MCP", "files": [ { "file": "elixir/mcp/logo.svg", @@ -19834,7 +19839,1240 @@ "format": "xml" } ] + }, + { + "language": "clojure", + "label": "Clojure", + "variant": "library", + "githubColor": "#DB5855", + "alt": "libtmux for Clojure", + "files": [ + { + "file": "clojure/library/logo.svg", + "bytes": 5888, + "sha256": "11ddff56de0ab2be46c0bee1c9ebbc00aa8fd39ec08e6d0af5d3f107a801ab98", + "format": "svg", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/library/logo-16.png", + "bytes": 588, + "sha256": "7b7cbff1c385c6e43b5cbff58c4d1561826351321d81a2672427d7a3e61d2380", + "format": "png", + "width": 16, + "height": 16, + "transparent": true + }, + { + "file": "clojure/library/logo-24.png", + "bytes": 769, + "sha256": "7335abb1b8c2fdf79ba036bf51eb076f9163304ff92e54459f6f1beb71922fca", + "format": "png", + "width": 24, + "height": 24, + "transparent": true + }, + { + "file": "clojure/library/logo-32.png", + "bytes": 1028, + "sha256": "b294b00519d570926b418122b0635047cfd23e9f2ab0cf85ef5b1d0d4d602bf4", + "format": "png", + "width": 32, + "height": 32, + "transparent": true + }, + { + "file": "clojure/library/logo-48.png", + "bytes": 1477, + "sha256": "7d7290ed720e7fe521c0345626d53eee8877923042b752e52a5a3bb300e69eed", + "format": "png", + "width": 48, + "height": 48, + "transparent": true + }, + { + "file": "clojure/library/logo-64.png", + "bytes": 1928, + "sha256": "7203fbbf8d23a83c278711e436e08b737f3859ace13886cd48b9c285c117f2e6", + "format": "png", + "width": 64, + "height": 64, + "transparent": true + }, + { + "file": "clojure/library/logo-96.png", + "bytes": 2754, + "sha256": "fe0cd6052e60fa1081fcf8152ac3b3914103bc7dc3f70c85add66faabae311b0", + "format": "png", + "width": 96, + "height": 96, + "transparent": true + }, + { + "file": "clojure/library/logo-128.png", + "bytes": 3693, + "sha256": "fe3591357d89c3c098577b7364e769532408685b689821a293401ce803a51815", + "format": "png", + "width": 128, + "height": 128, + "transparent": true + }, + { + "file": "clojure/library/logo-144.png", + "bytes": 4136, + "sha256": "63d371e53d6aa737035d39ca612a7a157da4fc7fd64081a10533043ae0f52f43", + "format": "png", + "width": 144, + "height": 144, + "transparent": true + }, + { + "file": "clojure/library/logo-152.png", + "bytes": 4301, + "sha256": "fbbbf71a7062351239c89487ca83c0a9a7390e407de89fd32f782fe1f1c21dc0", + "format": "png", + "width": 152, + "height": 152, + "transparent": true + }, + { + "file": "clojure/library/logo-167.png", + "bytes": 4793, + "sha256": "c5462a37f76d3d87d6ce0687fc4c9bf9d24231732e558abc1eb67c5937826048", + "format": "png", + "width": 167, + "height": 167, + "transparent": true + }, + { + "file": "clojure/library/logo-180.png", + "bytes": 5246, + "sha256": "b0ad5ee2fb9807fe3280463e5e69d87a4cc1205ff0df4ac983093f7c8f360a45", + "format": "png", + "width": 180, + "height": 180, + "transparent": true + }, + { + "file": "clojure/library/logo-192.png", + "bytes": 5610, + "sha256": "801f0d4f91b4b4ad52eead95e90df0a876ecd26e88c2edda17e4d27a3616c74b", + "format": "png", + "width": 192, + "height": 192, + "transparent": true + }, + { + "file": "clojure/library/logo-256.png", + "bytes": 7517, + "sha256": "3120f5811ec98f14de73439f3749fd9dda98ec15ad3631af8bd787536216ff3a", + "format": "png", + "width": 256, + "height": 256, + "transparent": true + }, + { + "file": "clojure/library/logo-384.png", + "bytes": 11696, + "sha256": "cb1ac0d5841e7e9cf7cb8d22105d22a57028bb653d9ee85e6bfdffe7e716faff", + "format": "png", + "width": 384, + "height": 384, + "transparent": true + }, + { + "file": "clojure/library/logo-512.png", + "bytes": 16186, + "sha256": "f2c984aeed0f03d6d12aa356acd014b8bd4b9127380b70a8e1eac39ed4662d9c", + "format": "png", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/library/logo-1024.png", + "bytes": 36708, + "sha256": "525f9b3baa6ee4e5d18b988ee5070f5b71c30481b87e1d17033d33e8d461c2f3", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": true + }, + { + "file": "clojure/library/favicon.ico", + "bytes": 22619, + "sha256": "18479bcf4f3a5d5aec5bd037005650ef9944c74f59562f4a7545ca34ab000a15", + "format": "ico", + "sizes": [ + 16, + 32, + 48, + 256 + ] + }, + { + "file": "clojure/library/safari-pinned-tab.svg", + "bytes": 5888, + "sha256": "fb537422ad831c9d255f6fdf5c760d05046c6144a9fcbf3371599085bd9d7d50", + "format": "svg", + "width": 512, + "height": 512, + "monochrome": true + }, + { + "file": "clojure/library/apple-touch-icon-light.png", + "bytes": 3802, + "sha256": "a866bb5c6485791024172d81659cc8822a5fb4921ca5cae3650f869b688bb08a", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/library/app-icon-1024-light.png", + "bytes": 28151, + "sha256": "800e40778d99463f83090fefc5d95ea993c927185dd02d9ff76430ffb7295d53", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/library/maskable-192-light.png", + "bytes": 3035, + "sha256": "e404353466d10535e4186edfd7960c3b46eb08e31382143aaea5b24f512b2e4a", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/library/maskable-512-light.png", + "bytes": 9212, + "sha256": "4f91380c34c746f2e68b952fb2b0696b61672c09860b2496e4d5598314a3da40", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/library/mstile-150-light.png", + "bytes": 2979, + "sha256": "369e95638cdb4d6722767899703a96ac82d3e832e6836606578d8a0f51d7d173", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/library/mstile-310-light.png", + "bytes": 6443, + "sha256": "b38cb0c9e84b5427a57cdd18f0f3eecba4794b926e53ca3b9f5f9f4526478bf4", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/library/opengraph-light.png", + "bytes": 63858, + "sha256": "093f7d845335fea028d137a2553f62574670c820b298d4430eb49e4bf07cb582", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/library/opengraph-light.jpg", + "bytes": 102897, + "sha256": "3c1b5f56a84d94611567e7cfc0309c17ed81adf3994657d9e3083e349202d794", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/library/twitter-light.png", + "bytes": 63645, + "sha256": "32cc84dd08cf4e467fad34578eec0e4f10b51b156c9c72d6485a54d003aa129b", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/library/social-square-light.png", + "bytes": 73455, + "sha256": "66214e1a5b0d05b29a158a562a3aed82e07a966939fce63c47c908026e6ea61a", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/library/site.webmanifest", + "bytes": 732, + "sha256": "fa25fd4e16960f624cf2c02f34c4a62c091d094fd029bb7850ac07fa73421425", + "format": "webmanifest" + }, + { + "file": "clojure/library/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686", + "format": "xml" + }, + { + "file": "clojure/library/apple-touch-icon-dark.png", + "bytes": 3831, + "sha256": "c70953b0e51cce90c114975805c9e8ed147187b1f803c5360bd1cd5ad746e6d5", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/library/app-icon-1024-dark.png", + "bytes": 28478, + "sha256": "6fda6a4526c615c8a9bcd8c696ec3a7b2a56dfa9ddf97c4d70253ed9bedc2a78", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/library/maskable-192-dark.png", + "bytes": 3071, + "sha256": "2244557a8b2c8a59b5c611b1b0071e6189f3eca8b6495ef4f4518195c7592295", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/library/maskable-512-dark.png", + "bytes": 9279, + "sha256": "6512cc411316dd0fcdd735ba426db4aeb32d784c0592c7e5ae26af793ab5d389", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/library/mstile-150-dark.png", + "bytes": 3010, + "sha256": "e82d97bf797f1088b163cfc218b57a7d8968a2539d883ce4b6b6b35e787a3d11", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/library/mstile-310-dark.png", + "bytes": 6503, + "sha256": "e83c75f99c3bce1648216485b1ae9931d553800629dfd8861549321ccdb84862", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/library/opengraph-dark.png", + "bytes": 64048, + "sha256": "88feb58fec772c1a934c0063a5878c30f61becd30edff2aa6fff31b6f9965653", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/library/opengraph-dark.jpg", + "bytes": 94698, + "sha256": "6f696ca1ef6f0757a84941e26e94e820a4adad942926fa8e11d7ccb79dda751f", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/library/twitter-dark.png", + "bytes": 63841, + "sha256": "7d03257e4f3917175ffb740352df92df6cbe360da2a18a5eaeb367baa62e8aea", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/library/social-square-dark.png", + "bytes": 73511, + "sha256": "21b8d41bf8459e99b673160c579b71cf389b93838b9b9c0070d342537b8f9da1", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/library/site-dark.webmanifest", + "bytes": 730, + "sha256": "9d464a1f18b8ff2c1bfab9f85d958c9cac04ad1ab96405b2b673ca4fc3f4541f", + "format": "webmanifest" + }, + { + "file": "clojure/library/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4", + "format": "xml" + } + ] + }, + { + "language": "clojure", + "label": "Clojure", + "variant": "workspace", + "githubColor": "#DB5855", + "alt": "libtmux for Clojure \u2014 workspace CLI", + "files": [ + { + "file": "clojure/workspace/logo.svg", + "bytes": 2411, + "sha256": "bbd031aa2439c816bf249704f71fd20e7304316a8303d600945f504c2c5ffb08", + "format": "svg", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/workspace/logo-16.png", + "bytes": 294, + "sha256": "157cf1a35e547801ce09a83fb2a42abac605e4899164afe199a7062af87028cb", + "format": "png", + "width": 16, + "height": 16, + "transparent": true + }, + { + "file": "clojure/workspace/logo-24.png", + "bytes": 324, + "sha256": "5b4b03740f3a2955e0748150159f2bcd3818b10f65098a8ea2772fd18382de8d", + "format": "png", + "width": 24, + "height": 24, + "transparent": true + }, + { + "file": "clojure/workspace/logo-32.png", + "bytes": 412, + "sha256": "ca1357046c440e68c0bf27ebc3b28833472aefc017c9c0706f7e0bdff526d4ae", + "format": "png", + "width": 32, + "height": 32, + "transparent": true + }, + { + "file": "clojure/workspace/logo-48.png", + "bytes": 546, + "sha256": "28859fea9a04e16a1882648e8bd817bd921b30140f5cda74ad3dcc4f4c76cea4", + "format": "png", + "width": 48, + "height": 48, + "transparent": true + }, + { + "file": "clojure/workspace/logo-64.png", + "bytes": 637, + "sha256": "747317e2de6a283193937dff4aef8af69dedc85c999bb03a0341a2085c717518", + "format": "png", + "width": 64, + "height": 64, + "transparent": true + }, + { + "file": "clojure/workspace/logo-96.png", + "bytes": 865, + "sha256": "91a3aee17ed086333a8d8d08d8948d70ad7f18c0980ab1215b742bb3a28c5a7c", + "format": "png", + "width": 96, + "height": 96, + "transparent": true + }, + { + "file": "clojure/workspace/logo-128.png", + "bytes": 1141, + "sha256": "b2c67851465a796370bf639305e945e9b2e05657edf52058d4f21410178adc2e", + "format": "png", + "width": 128, + "height": 128, + "transparent": true + }, + { + "file": "clojure/workspace/logo-144.png", + "bytes": 1301, + "sha256": "9eb26bc0132dc45615705aab73dc627ce9e84d70bda344d34951fa8fd6a54f06", + "format": "png", + "width": 144, + "height": 144, + "transparent": true + }, + { + "file": "clojure/workspace/logo-152.png", + "bytes": 1339, + "sha256": "27c825539818688e216f37f14aa0c37b5505564f2c01201ef0a77d08736e3e5c", + "format": "png", + "width": 152, + "height": 152, + "transparent": true + }, + { + "file": "clojure/workspace/logo-167.png", + "bytes": 1511, + "sha256": "53a5fe5ef0ccde7dbcb670585df19d2c86eefa89029ce0c400dd23ba6a18db33", + "format": "png", + "width": 167, + "height": 167, + "transparent": true + }, + { + "file": "clojure/workspace/logo-180.png", + "bytes": 1636, + "sha256": "b803aba00cd36ecd4313d4e42eb90d4a319ab47e7977a3e5968f0cbc85cd691e", + "format": "png", + "width": 180, + "height": 180, + "transparent": true + }, + { + "file": "clojure/workspace/logo-192.png", + "bytes": 1759, + "sha256": "36129e93c60eaf993fa1844555f945fc7807bf0a19fb3223081a41a96ce27b27", + "format": "png", + "width": 192, + "height": 192, + "transparent": true + }, + { + "file": "clojure/workspace/logo-256.png", + "bytes": 2456, + "sha256": "4482a1114dd8ae762afc49d56fcc03f9c0e3b17bfc5a637914b479e589e88342", + "format": "png", + "width": 256, + "height": 256, + "transparent": true + }, + { + "file": "clojure/workspace/logo-384.png", + "bytes": 3766, + "sha256": "c79766a94fb17c9420b87ca0b070b5d0f5731200251256650f10bf5ce6fd1bd5", + "format": "png", + "width": 384, + "height": 384, + "transparent": true + }, + { + "file": "clojure/workspace/logo-512.png", + "bytes": 5360, + "sha256": "c04c6511461ed66fba98ae89da21989448f60f81d19d85689b7d25056cc39db3", + "format": "png", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/workspace/logo-1024.png", + "bytes": 13806, + "sha256": "7af2f76e27a543ecabe3e4fac45ad00a4d78daad1fd10f68aa06c3778a7ce51e", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": true + }, + { + "file": "clojure/workspace/favicon.ico", + "bytes": 17558, + "sha256": "7cd86c60a7bcdbb4a0d0052383aaa29d621b27b00fa4330143a288319870823d", + "format": "ico", + "sizes": [ + 16, + 32, + 48, + 256 + ] + }, + { + "file": "clojure/workspace/safari-pinned-tab.svg", + "bytes": 2411, + "sha256": "fbf48c69e16b641e2451224e98e9a0499c9f87e898d14023e3b685bc08c70713", + "format": "svg", + "width": 512, + "height": 512, + "monochrome": true + }, + { + "file": "clojure/workspace/apple-touch-icon-light.png", + "bytes": 1314, + "sha256": "3a46f8d1be11c1580024cf10fa0e67193599e7681edba5d26b25685d0812cfdf", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/workspace/app-icon-1024-light.png", + "bytes": 11470, + "sha256": "4adac0f00053f2ceb3793955320c9863030c521368fcb976d200967667ce4382", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/workspace/maskable-192-light.png", + "bytes": 1120, + "sha256": "d1a732da708bd84752786e2b45d71b12f495c59c0e3ad3e93bdad90e806a0c3f", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/workspace/maskable-512-light.png", + "bytes": 3821, + "sha256": "e5d363c2ccc3830807a4f69d31294c45c4549566c9b431d33cde34bb78b8eb91", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/workspace/mstile-150-light.png", + "bytes": 987, + "sha256": "e7130fb318d753b775334cb11ba006096231cdc7589759a6bc461d517ee3157d", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/workspace/mstile-310-light.png", + "bytes": 2222, + "sha256": "a8c0481d31c4b1f7eba1d8702fabb168ea9015365230959154188e12f8898e8d", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/workspace/opengraph-light.png", + "bytes": 23382, + "sha256": "6639bd5a388f161defe0b39aee3ba35c6de58e9ebd164c1a8c9901840c170d58", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/workspace/opengraph-light.jpg", + "bytes": 44332, + "sha256": "a7e1b491a0baaa419d3efaf0edfaf2f4278e268cf09d8677dd9e4718600f820d", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/workspace/twitter-light.png", + "bytes": 23236, + "sha256": "58b93094f81a6b640a3fdef78046e911db5b190e6bddc4a73a4b6f38e4f7f677", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/workspace/social-square-light.png", + "bytes": 26323, + "sha256": "4c4afe2bbaa11cf91dfbd6ecfa97e400d821b42a8797322a164351c39735bdb6", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/workspace/site.webmanifest", + "bytes": 753, + "sha256": "6c2d3bce4bb94b4d0ff87848d26b329dcd1be307545c5b45cdade171fbe20c5a", + "format": "webmanifest" + }, + { + "file": "clojure/workspace/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686", + "format": "xml" + }, + { + "file": "clojure/workspace/apple-touch-icon-dark.png", + "bytes": 1268, + "sha256": "4cbca68246803e36c912f973364ad2086cd4f0161c47c68fcbb32e7993c0a512", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/workspace/app-icon-1024-dark.png", + "bytes": 11284, + "sha256": "0cb97c12266e57c6f5b2976203113f38ce3bb688ec86f22923a22fafa5afbb7c", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/workspace/maskable-192-dark.png", + "bytes": 1102, + "sha256": "49a1fd1f6197a580d85a44dacafbdd548983e75f8bc2d1749db572be2c9c8914", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/workspace/maskable-512-dark.png", + "bytes": 3761, + "sha256": "4b511b1a56f704bc3986295173b4a673846f926c1ae1ab917c1cfc716925fbd6", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/workspace/mstile-150-dark.png", + "bytes": 970, + "sha256": "9556a242b3eeed6aae08791bb3142f82127e4d129874b6e41493793a71972c42", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/workspace/mstile-310-dark.png", + "bytes": 2165, + "sha256": "1e7a68885277da264cb7cce87ea44a49c302f5bd661f77101c71a5f23d7ad874", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/workspace/opengraph-dark.png", + "bytes": 23454, + "sha256": "446a8aa3033990e9b7a6d4c4ede9639ac72be58f7c0b63c2b2895ce11d6a3f2e", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/workspace/opengraph-dark.jpg", + "bytes": 42307, + "sha256": "f684cb6e53402e4d89344e5941436361e65efdc356ac8897d9094f88da88376c", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/workspace/twitter-dark.png", + "bytes": 23308, + "sha256": "caaac813a9e9f49f7a645dd1aef23465bf05a85274c9fba032a220a939d968ef", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/workspace/social-square-dark.png", + "bytes": 26355, + "sha256": "a6eff66fe52f7b5499ce920b85ed8de45e41d388d6a8f596c1bc2f5c1a32247f", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/workspace/site-dark.webmanifest", + "bytes": 751, + "sha256": "b6b4974191b3742ad5a505531bc1253b0dedc34ad8baacb285fda5d23e2fb5f1", + "format": "webmanifest" + }, + { + "file": "clojure/workspace/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4", + "format": "xml" + } + ] + }, + { + "language": "clojure", + "label": "Clojure", + "variant": "mcp", + "githubColor": "#DB5855", + "alt": "libtmux for Clojure \u2014 MCP", + "files": [ + { + "file": "clojure/mcp/logo.svg", + "bytes": 4059, + "sha256": "7ea043036c960d044b0b2e3d1c1afcaba91f719fd76e855767095e8e17d3a37e", + "format": "svg", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/mcp/logo-16.png", + "bytes": 600, + "sha256": "59a19419974d1eafa632d69bf629d02960df8a8c72ace3698c0e458ceffd8dba", + "format": "png", + "width": 16, + "height": 16, + "transparent": true + }, + { + "file": "clojure/mcp/logo-24.png", + "bytes": 874, + "sha256": "f331ec120475f3678fc14a86ee5ce4913ee7c5c035f4cfde7fd8a0011fe9139d", + "format": "png", + "width": 24, + "height": 24, + "transparent": true + }, + { + "file": "clojure/mcp/logo-32.png", + "bytes": 1183, + "sha256": "c06964a8a73e20ca83bceb30d44376c0091f677ea5bec03c46c8a8273670b6ee", + "format": "png", + "width": 32, + "height": 32, + "transparent": true + }, + { + "file": "clojure/mcp/logo-48.png", + "bytes": 1747, + "sha256": "8c686f930a2a3f274b968da473e1c15a264a31513ab08ea59d2007685104d54f", + "format": "png", + "width": 48, + "height": 48, + "transparent": true + }, + { + "file": "clojure/mcp/logo-64.png", + "bytes": 2190, + "sha256": "edf6fec509f0b94f9ce8b4c7699e5a25046d05058054d133402a65b79d2ac7cd", + "format": "png", + "width": 64, + "height": 64, + "transparent": true + }, + { + "file": "clojure/mcp/logo-96.png", + "bytes": 3198, + "sha256": "f1cccd8d638b495f5a4bc386df0cf5c31b65ced0ea2a715f72a523da8054b5b6", + "format": "png", + "width": 96, + "height": 96, + "transparent": true + }, + { + "file": "clojure/mcp/logo-128.png", + "bytes": 4143, + "sha256": "6553d7154ea0aecc7707aca5e4ac66e66c7af8f70f7240beba9bdd3f77809e79", + "format": "png", + "width": 128, + "height": 128, + "transparent": true + }, + { + "file": "clojure/mcp/logo-144.png", + "bytes": 4575, + "sha256": "d3a515589d9457744f0b9e8be08d7ab0d16fe32649facb569757fc4482fc59cb", + "format": "png", + "width": 144, + "height": 144, + "transparent": true + }, + { + "file": "clojure/mcp/logo-152.png", + "bytes": 4780, + "sha256": "9ba71a549283863c0c904293c2c74529a4f6456410c69fd5ddce80dc9a2486c2", + "format": "png", + "width": 152, + "height": 152, + "transparent": true + }, + { + "file": "clojure/mcp/logo-167.png", + "bytes": 5085, + "sha256": "14372ff20c34009502d462d5247881fd4c3ebc1fa71e5fcc8cf92c27e160e143", + "format": "png", + "width": 167, + "height": 167, + "transparent": true + }, + { + "file": "clojure/mcp/logo-180.png", + "bytes": 5541, + "sha256": "264ff71383f39623f12f93cdaa79a7b47e9e703d2ad69d6c941165ff423a82ff", + "format": "png", + "width": 180, + "height": 180, + "transparent": true + }, + { + "file": "clojure/mcp/logo-192.png", + "bytes": 5967, + "sha256": "0b4877fd0f4852953da1b6ff3cf6e2411577af61bba377be759c4df64a5f7caa", + "format": "png", + "width": 192, + "height": 192, + "transparent": true + }, + { + "file": "clojure/mcp/logo-256.png", + "bytes": 8042, + "sha256": "933a4f322392c98f50246c0eb5791096199983a3095ae218b8d0bb2805725c45", + "format": "png", + "width": 256, + "height": 256, + "transparent": true + }, + { + "file": "clojure/mcp/logo-384.png", + "bytes": 12316, + "sha256": "2c941d7bf1f5e0b7e3c9ebfed98eb1dcbb15aacc3822fc3d2f38da5c59b2bc1a", + "format": "png", + "width": 384, + "height": 384, + "transparent": true + }, + { + "file": "clojure/mcp/logo-512.png", + "bytes": 16891, + "sha256": "503a3a6b242bfd63daf375205256f3974ed0e312a794e9a3d421e4e14eb9254b", + "format": "png", + "width": 512, + "height": 512, + "transparent": true + }, + { + "file": "clojure/mcp/logo-1024.png", + "bytes": 38232, + "sha256": "071c1cc286d72e57dcf07371b5045bdd682cd62a984d1006af3fe21771e2f065", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": true + }, + { + "file": "clojure/mcp/favicon.ico", + "bytes": 23144, + "sha256": "14a0d1899f966656938b47f17cd2918e73827f66a6aff96616163af8db60d79a", + "format": "ico", + "sizes": [ + 16, + 32, + 48, + 256 + ] + }, + { + "file": "clojure/mcp/safari-pinned-tab.svg", + "bytes": 4059, + "sha256": "c016620dcb1a7f4233536157027a90544639e8ec5024c1154e007b5c603969a8", + "format": "svg", + "width": 512, + "height": 512, + "monochrome": true + }, + { + "file": "clojure/mcp/apple-touch-icon-light.png", + "bytes": 4246, + "sha256": "a5026fafe190c4ff475642f1eb9cf19c7c07bab272481bf58de82d5ab97e8e86", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/mcp/app-icon-1024-light.png", + "bytes": 28162, + "sha256": "27b27c116c2c6b3f43b737bd8a923f0eac3ffd50838f336e51867bac62556446", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/mcp/maskable-192-light.png", + "bytes": 3227, + "sha256": "31ea0e334f6ffde8be329d97717dae51f5dc67b7ece5a6399cef4e928b318b6c", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/mcp/maskable-512-light.png", + "bytes": 9616, + "sha256": "44286f7f2afa1e23148223e10b7d8224fa77a86e279453ab86db8ba9e1779109", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/mcp/mstile-150-light.png", + "bytes": 3286, + "sha256": "21f62eb486cfbb0d9aee36d273d99acbf1245fce6b6410c50d70596096813ed4", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/mcp/mstile-310-light.png", + "bytes": 6785, + "sha256": "cc34dbcf1d6f52e9ececf2d75620df7bcc9c9925639cea290abe62d14b9905b1", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/mcp/opengraph-light.png", + "bytes": 26969, + "sha256": "c7d34113394d53f1243b0feb53e35d10d762862b4b5475fabe917a6fb699bec2", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/mcp/opengraph-light.jpg", + "bytes": 52184, + "sha256": "784d70dd49ecd13edafc337f73b36caffc6902e62308a354c0d1282cc7351f6f", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/mcp/twitter-light.png", + "bytes": 26782, + "sha256": "8cbcc1c543ce74380297a115b9c9a2433d29aeebdc25a39ea6f890cea0cca74b", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/mcp/social-square-light.png", + "bytes": 31021, + "sha256": "159b2a1b75d4c5c0bad46a25e95df8bc18bf6c2a52e18b533286cf41ccaa2e58", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/mcp/site.webmanifest", + "bytes": 743, + "sha256": "9cccd4687a01d8b817115a5bdb83c0c0e610833348c074fbab3d5bacd9282ef8", + "format": "webmanifest" + }, + { + "file": "clojure/mcp/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686", + "format": "xml" + }, + { + "file": "clojure/mcp/apple-touch-icon-dark.png", + "bytes": 4277, + "sha256": "a6a17fe58a42621e9e0e48ba97a2eea95fb8f4c200fd05a4898881ec6f48e97d", + "format": "png", + "width": 180, + "height": 180, + "transparent": false, + "purpose": "apple-touch" + }, + { + "file": "clojure/mcp/app-icon-1024-dark.png", + "bytes": 28437, + "sha256": "a48a4e59547319ec6f7923a575f88019891b019fb0ad2911fd07119297e0169e", + "format": "png", + "width": 1024, + "height": 1024, + "transparent": false, + "purpose": "app-icon" + }, + { + "file": "clojure/mcp/maskable-192-dark.png", + "bytes": 3296, + "sha256": "d70012213fc01f5140f489d8255d0267bad58083e63f870362241d07cff4f31c", + "format": "png", + "width": 192, + "height": 192, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/mcp/maskable-512-dark.png", + "bytes": 9696, + "sha256": "fe79abbed378ad1f5522f9fad3f39dfcbdf60e54d5a7fd209b5295b33d8b9a08", + "format": "png", + "width": 512, + "height": 512, + "transparent": false, + "purpose": "maskable", + "contentFraction": 0.52 + }, + { + "file": "clojure/mcp/mstile-150-dark.png", + "bytes": 3345, + "sha256": "7ac41c9c947064c31a3cdc7e87e1512e82e6af938c15f7803f442ba038449a00", + "format": "png", + "width": 150, + "height": 150, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/mcp/mstile-310-dark.png", + "bytes": 6839, + "sha256": "8508dcb124763891458c5c821efae1748d547863ca139fae9d838192fb20f063", + "format": "png", + "width": 310, + "height": 310, + "transparent": false, + "purpose": "windows-tile" + }, + { + "file": "clojure/mcp/opengraph-dark.png", + "bytes": 27177, + "sha256": "0a3a8267fdd450053b90fb334870b555728dfeab91444da733bae8291db09344", + "format": "png", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph" + }, + { + "file": "clojure/mcp/opengraph-dark.jpg", + "bytes": 50859, + "sha256": "ea408f1790a88c18d498a68634aa0a4ed941d77c03cbab10d7a1c880b07b5bdc", + "format": "jpeg", + "width": 1200, + "height": 630, + "transparent": false, + "purpose": "opengraph-fallback" + }, + { + "file": "clojure/mcp/twitter-dark.png", + "bytes": 27005, + "sha256": "cd3b89cb8bc62d76b026f03ec77c26f5684216a63d2344798bd139175bc78772", + "format": "png", + "width": 1200, + "height": 600, + "transparent": false, + "purpose": "twitter" + }, + { + "file": "clojure/mcp/social-square-dark.png", + "bytes": 31301, + "sha256": "069df1973006ccfc335c1eeaa522d9b61a7e349fc2e9e31d9539533f9d26fb26", + "format": "png", + "width": 1080, + "height": 1080, + "transparent": false, + "purpose": "social-square" + }, + { + "file": "clojure/mcp/site-dark.webmanifest", + "bytes": 741, + "sha256": "7ef228a6c696360ab1e9d6ddf81c539f4ff3629c1ff157ce2b4a44cbf1b81290", + "format": "webmanifest" + }, + { + "file": "clojure/mcp/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4", + "format": "xml" + } + ] } ], - "fileCount": 2064 + "fileCount": 2193 } diff --git a/site/public/brand/clojure/library/app-icon-1024-dark.png b/site/public/brand/clojure/library/app-icon-1024-dark.png new file mode 100644 index 000000000..9877013a0 Binary files /dev/null and b/site/public/brand/clojure/library/app-icon-1024-dark.png differ diff --git a/site/public/brand/clojure/library/app-icon-1024-light.png b/site/public/brand/clojure/library/app-icon-1024-light.png new file mode 100644 index 000000000..c967d966f Binary files /dev/null and b/site/public/brand/clojure/library/app-icon-1024-light.png differ diff --git a/site/public/brand/clojure/library/apple-touch-icon-dark.png b/site/public/brand/clojure/library/apple-touch-icon-dark.png new file mode 100644 index 000000000..e12a058b2 Binary files /dev/null and b/site/public/brand/clojure/library/apple-touch-icon-dark.png differ diff --git a/site/public/brand/clojure/library/apple-touch-icon-light.png b/site/public/brand/clojure/library/apple-touch-icon-light.png new file mode 100644 index 000000000..a44762930 Binary files /dev/null and b/site/public/brand/clojure/library/apple-touch-icon-light.png differ diff --git a/site/public/brand/clojure/library/browserconfig-dark.xml b/site/public/brand/clojure/library/browserconfig-dark.xml new file mode 100644 index 000000000..31075520c --- /dev/null +++ b/site/public/brand/clojure/library/browserconfig-dark.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/library/browserconfig.xml b/site/public/brand/clojure/library/browserconfig.xml new file mode 100644 index 000000000..71a55e1d8 --- /dev/null +++ b/site/public/brand/clojure/library/browserconfig.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/library/favicon.ico b/site/public/brand/clojure/library/favicon.ico new file mode 100644 index 000000000..d3b41428c Binary files /dev/null and b/site/public/brand/clojure/library/favicon.ico differ diff --git a/site/public/brand/clojure/library/logo-1024.png b/site/public/brand/clojure/library/logo-1024.png new file mode 100644 index 000000000..8699643a0 Binary files /dev/null and b/site/public/brand/clojure/library/logo-1024.png differ diff --git a/site/public/brand/clojure/library/logo-128.png b/site/public/brand/clojure/library/logo-128.png new file mode 100644 index 000000000..147c48d77 Binary files /dev/null and b/site/public/brand/clojure/library/logo-128.png differ diff --git a/site/public/brand/clojure/library/logo-144.png b/site/public/brand/clojure/library/logo-144.png new file mode 100644 index 000000000..516fb32be Binary files /dev/null and b/site/public/brand/clojure/library/logo-144.png differ diff --git a/site/public/brand/clojure/library/logo-152.png b/site/public/brand/clojure/library/logo-152.png new file mode 100644 index 000000000..71573116c Binary files /dev/null and b/site/public/brand/clojure/library/logo-152.png differ diff --git a/site/public/brand/clojure/library/logo-16.png b/site/public/brand/clojure/library/logo-16.png new file mode 100644 index 000000000..48a594342 Binary files /dev/null and b/site/public/brand/clojure/library/logo-16.png differ diff --git a/site/public/brand/clojure/library/logo-167.png b/site/public/brand/clojure/library/logo-167.png new file mode 100644 index 000000000..7d1394939 Binary files /dev/null and b/site/public/brand/clojure/library/logo-167.png differ diff --git a/site/public/brand/clojure/library/logo-180.png b/site/public/brand/clojure/library/logo-180.png new file mode 100644 index 000000000..5976f306f Binary files /dev/null and b/site/public/brand/clojure/library/logo-180.png differ diff --git a/site/public/brand/clojure/library/logo-192.png b/site/public/brand/clojure/library/logo-192.png new file mode 100644 index 000000000..0557b1bd7 Binary files /dev/null and b/site/public/brand/clojure/library/logo-192.png differ diff --git a/site/public/brand/clojure/library/logo-24.png b/site/public/brand/clojure/library/logo-24.png new file mode 100644 index 000000000..44a9d931b Binary files /dev/null and b/site/public/brand/clojure/library/logo-24.png differ diff --git a/site/public/brand/clojure/library/logo-256.png b/site/public/brand/clojure/library/logo-256.png new file mode 100644 index 000000000..6db70039e Binary files /dev/null and b/site/public/brand/clojure/library/logo-256.png differ diff --git a/site/public/brand/clojure/library/logo-32.png b/site/public/brand/clojure/library/logo-32.png new file mode 100644 index 000000000..8bbb40d20 Binary files /dev/null and b/site/public/brand/clojure/library/logo-32.png differ diff --git a/site/public/brand/clojure/library/logo-384.png b/site/public/brand/clojure/library/logo-384.png new file mode 100644 index 000000000..22311458d Binary files /dev/null and b/site/public/brand/clojure/library/logo-384.png differ diff --git a/site/public/brand/clojure/library/logo-48.png b/site/public/brand/clojure/library/logo-48.png new file mode 100644 index 000000000..6ff013a06 Binary files /dev/null and b/site/public/brand/clojure/library/logo-48.png differ diff --git a/site/public/brand/clojure/library/logo-512.png b/site/public/brand/clojure/library/logo-512.png new file mode 100644 index 000000000..f1af92766 Binary files /dev/null and b/site/public/brand/clojure/library/logo-512.png differ diff --git a/site/public/brand/clojure/library/logo-64.png b/site/public/brand/clojure/library/logo-64.png new file mode 100644 index 000000000..7f0e44712 Binary files /dev/null and b/site/public/brand/clojure/library/logo-64.png differ diff --git a/site/public/brand/clojure/library/logo-96.png b/site/public/brand/clojure/library/logo-96.png new file mode 100644 index 000000000..368a5cabf Binary files /dev/null and b/site/public/brand/clojure/library/logo-96.png differ diff --git a/site/public/brand/clojure/library/logo.svg b/site/public/brand/clojure/library/logo.svg new file mode 100644 index 000000000..826654e08 --- /dev/null +++ b/site/public/brand/clojure/library/logo.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/library/maskable-192-dark.png b/site/public/brand/clojure/library/maskable-192-dark.png new file mode 100644 index 000000000..4754818f6 Binary files /dev/null and b/site/public/brand/clojure/library/maskable-192-dark.png differ diff --git a/site/public/brand/clojure/library/maskable-192-light.png b/site/public/brand/clojure/library/maskable-192-light.png new file mode 100644 index 000000000..6832baab1 Binary files /dev/null and b/site/public/brand/clojure/library/maskable-192-light.png differ diff --git a/site/public/brand/clojure/library/maskable-512-dark.png b/site/public/brand/clojure/library/maskable-512-dark.png new file mode 100644 index 000000000..982a9a52c Binary files /dev/null and b/site/public/brand/clojure/library/maskable-512-dark.png differ diff --git a/site/public/brand/clojure/library/maskable-512-light.png b/site/public/brand/clojure/library/maskable-512-light.png new file mode 100644 index 000000000..35b3f0c2b Binary files /dev/null and b/site/public/brand/clojure/library/maskable-512-light.png differ diff --git a/site/public/brand/clojure/library/mstile-150-dark.png b/site/public/brand/clojure/library/mstile-150-dark.png new file mode 100644 index 000000000..d17a596d2 Binary files /dev/null and b/site/public/brand/clojure/library/mstile-150-dark.png differ diff --git a/site/public/brand/clojure/library/mstile-150-light.png b/site/public/brand/clojure/library/mstile-150-light.png new file mode 100644 index 000000000..3fb651c46 Binary files /dev/null and b/site/public/brand/clojure/library/mstile-150-light.png differ diff --git a/site/public/brand/clojure/library/mstile-310-dark.png b/site/public/brand/clojure/library/mstile-310-dark.png new file mode 100644 index 000000000..438cd4e3b Binary files /dev/null and b/site/public/brand/clojure/library/mstile-310-dark.png differ diff --git a/site/public/brand/clojure/library/mstile-310-light.png b/site/public/brand/clojure/library/mstile-310-light.png new file mode 100644 index 000000000..ee4561dbd Binary files /dev/null and b/site/public/brand/clojure/library/mstile-310-light.png differ diff --git a/site/public/brand/clojure/library/opengraph-dark.jpg b/site/public/brand/clojure/library/opengraph-dark.jpg new file mode 100644 index 000000000..bd9552bfb Binary files /dev/null and b/site/public/brand/clojure/library/opengraph-dark.jpg differ diff --git a/site/public/brand/clojure/library/opengraph-dark.png b/site/public/brand/clojure/library/opengraph-dark.png new file mode 100644 index 000000000..451c51c9a Binary files /dev/null and b/site/public/brand/clojure/library/opengraph-dark.png differ diff --git a/site/public/brand/clojure/library/opengraph-light.jpg b/site/public/brand/clojure/library/opengraph-light.jpg new file mode 100644 index 000000000..a7ab87cfb Binary files /dev/null and b/site/public/brand/clojure/library/opengraph-light.jpg differ diff --git a/site/public/brand/clojure/library/opengraph-light.png b/site/public/brand/clojure/library/opengraph-light.png new file mode 100644 index 000000000..629ca0df4 Binary files /dev/null and b/site/public/brand/clojure/library/opengraph-light.png differ diff --git a/site/public/brand/clojure/library/safari-pinned-tab.svg b/site/public/brand/clojure/library/safari-pinned-tab.svg new file mode 100644 index 000000000..6e909faf4 --- /dev/null +++ b/site/public/brand/clojure/library/safari-pinned-tab.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/library/site-dark.webmanifest b/site/public/brand/clojure/library/site-dark.webmanifest new file mode 100644 index 000000000..7147d4851 --- /dev/null +++ b/site/public/brand/clojure/library/site-dark.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#12161D", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-dark.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-dark.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/library/site.webmanifest b/site/public/brand/clojure/library/site.webmanifest new file mode 100644 index 000000000..21ef790c1 --- /dev/null +++ b/site/public/brand/clojure/library/site.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#F4F4F1", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-light.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-light.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/library/social-square-dark.png b/site/public/brand/clojure/library/social-square-dark.png new file mode 100644 index 000000000..31d133141 Binary files /dev/null and b/site/public/brand/clojure/library/social-square-dark.png differ diff --git a/site/public/brand/clojure/library/social-square-light.png b/site/public/brand/clojure/library/social-square-light.png new file mode 100644 index 000000000..9f77665b9 Binary files /dev/null and b/site/public/brand/clojure/library/social-square-light.png differ diff --git a/site/public/brand/clojure/library/twitter-dark.png b/site/public/brand/clojure/library/twitter-dark.png new file mode 100644 index 000000000..1ca5b4341 Binary files /dev/null and b/site/public/brand/clojure/library/twitter-dark.png differ diff --git a/site/public/brand/clojure/library/twitter-light.png b/site/public/brand/clojure/library/twitter-light.png new file mode 100644 index 000000000..58790ccaf Binary files /dev/null and b/site/public/brand/clojure/library/twitter-light.png differ diff --git a/site/public/brand/clojure/mcp/app-icon-1024-dark.png b/site/public/brand/clojure/mcp/app-icon-1024-dark.png new file mode 100644 index 000000000..e513b0992 Binary files /dev/null and b/site/public/brand/clojure/mcp/app-icon-1024-dark.png differ diff --git a/site/public/brand/clojure/mcp/app-icon-1024-light.png b/site/public/brand/clojure/mcp/app-icon-1024-light.png new file mode 100644 index 000000000..3e768a848 Binary files /dev/null and b/site/public/brand/clojure/mcp/app-icon-1024-light.png differ diff --git a/site/public/brand/clojure/mcp/apple-touch-icon-dark.png b/site/public/brand/clojure/mcp/apple-touch-icon-dark.png new file mode 100644 index 000000000..1910c50e2 Binary files /dev/null and b/site/public/brand/clojure/mcp/apple-touch-icon-dark.png differ diff --git a/site/public/brand/clojure/mcp/apple-touch-icon-light.png b/site/public/brand/clojure/mcp/apple-touch-icon-light.png new file mode 100644 index 000000000..8940a2dfe Binary files /dev/null and b/site/public/brand/clojure/mcp/apple-touch-icon-light.png differ diff --git a/site/public/brand/clojure/mcp/browserconfig-dark.xml b/site/public/brand/clojure/mcp/browserconfig-dark.xml new file mode 100644 index 000000000..31075520c --- /dev/null +++ b/site/public/brand/clojure/mcp/browserconfig-dark.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/mcp/browserconfig.xml b/site/public/brand/clojure/mcp/browserconfig.xml new file mode 100644 index 000000000..71a55e1d8 --- /dev/null +++ b/site/public/brand/clojure/mcp/browserconfig.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/mcp/favicon.ico b/site/public/brand/clojure/mcp/favicon.ico new file mode 100644 index 000000000..cd6db2f40 Binary files /dev/null and b/site/public/brand/clojure/mcp/favicon.ico differ diff --git a/site/public/brand/clojure/mcp/logo-1024.png b/site/public/brand/clojure/mcp/logo-1024.png new file mode 100644 index 000000000..468a1e34a Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-1024.png differ diff --git a/site/public/brand/clojure/mcp/logo-128.png b/site/public/brand/clojure/mcp/logo-128.png new file mode 100644 index 000000000..24a8c25af Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-128.png differ diff --git a/site/public/brand/clojure/mcp/logo-144.png b/site/public/brand/clojure/mcp/logo-144.png new file mode 100644 index 000000000..b06089751 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-144.png differ diff --git a/site/public/brand/clojure/mcp/logo-152.png b/site/public/brand/clojure/mcp/logo-152.png new file mode 100644 index 000000000..7f9898f87 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-152.png differ diff --git a/site/public/brand/clojure/mcp/logo-16.png b/site/public/brand/clojure/mcp/logo-16.png new file mode 100644 index 000000000..863190163 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-16.png differ diff --git a/site/public/brand/clojure/mcp/logo-167.png b/site/public/brand/clojure/mcp/logo-167.png new file mode 100644 index 000000000..b26d3e9cb Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-167.png differ diff --git a/site/public/brand/clojure/mcp/logo-180.png b/site/public/brand/clojure/mcp/logo-180.png new file mode 100644 index 000000000..9d879a7ae Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-180.png differ diff --git a/site/public/brand/clojure/mcp/logo-192.png b/site/public/brand/clojure/mcp/logo-192.png new file mode 100644 index 000000000..fde56c9f5 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-192.png differ diff --git a/site/public/brand/clojure/mcp/logo-24.png b/site/public/brand/clojure/mcp/logo-24.png new file mode 100644 index 000000000..c0ad23a83 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-24.png differ diff --git a/site/public/brand/clojure/mcp/logo-256.png b/site/public/brand/clojure/mcp/logo-256.png new file mode 100644 index 000000000..aaff05071 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-256.png differ diff --git a/site/public/brand/clojure/mcp/logo-32.png b/site/public/brand/clojure/mcp/logo-32.png new file mode 100644 index 000000000..bd705ebbf Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-32.png differ diff --git a/site/public/brand/clojure/mcp/logo-384.png b/site/public/brand/clojure/mcp/logo-384.png new file mode 100644 index 000000000..39f9365cb Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-384.png differ diff --git a/site/public/brand/clojure/mcp/logo-48.png b/site/public/brand/clojure/mcp/logo-48.png new file mode 100644 index 000000000..85f7937d3 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-48.png differ diff --git a/site/public/brand/clojure/mcp/logo-512.png b/site/public/brand/clojure/mcp/logo-512.png new file mode 100644 index 000000000..237b8483f Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-512.png differ diff --git a/site/public/brand/clojure/mcp/logo-64.png b/site/public/brand/clojure/mcp/logo-64.png new file mode 100644 index 000000000..868f1c672 Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-64.png differ diff --git a/site/public/brand/clojure/mcp/logo-96.png b/site/public/brand/clojure/mcp/logo-96.png new file mode 100644 index 000000000..521b1050d Binary files /dev/null and b/site/public/brand/clojure/mcp/logo-96.png differ diff --git a/site/public/brand/clojure/mcp/logo.svg b/site/public/brand/clojure/mcp/logo.svg new file mode 100644 index 000000000..42460beac --- /dev/null +++ b/site/public/brand/clojure/mcp/logo.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/mcp/maskable-192-dark.png b/site/public/brand/clojure/mcp/maskable-192-dark.png new file mode 100644 index 000000000..ce042e4d0 Binary files /dev/null and b/site/public/brand/clojure/mcp/maskable-192-dark.png differ diff --git a/site/public/brand/clojure/mcp/maskable-192-light.png b/site/public/brand/clojure/mcp/maskable-192-light.png new file mode 100644 index 000000000..e156d7e98 Binary files /dev/null and b/site/public/brand/clojure/mcp/maskable-192-light.png differ diff --git a/site/public/brand/clojure/mcp/maskable-512-dark.png b/site/public/brand/clojure/mcp/maskable-512-dark.png new file mode 100644 index 000000000..e52b1443f Binary files /dev/null and b/site/public/brand/clojure/mcp/maskable-512-dark.png differ diff --git a/site/public/brand/clojure/mcp/maskable-512-light.png b/site/public/brand/clojure/mcp/maskable-512-light.png new file mode 100644 index 000000000..58784f532 Binary files /dev/null and b/site/public/brand/clojure/mcp/maskable-512-light.png differ diff --git a/site/public/brand/clojure/mcp/mstile-150-dark.png b/site/public/brand/clojure/mcp/mstile-150-dark.png new file mode 100644 index 000000000..cf8566d36 Binary files /dev/null and b/site/public/brand/clojure/mcp/mstile-150-dark.png differ diff --git a/site/public/brand/clojure/mcp/mstile-150-light.png b/site/public/brand/clojure/mcp/mstile-150-light.png new file mode 100644 index 000000000..c14d28891 Binary files /dev/null and b/site/public/brand/clojure/mcp/mstile-150-light.png differ diff --git a/site/public/brand/clojure/mcp/mstile-310-dark.png b/site/public/brand/clojure/mcp/mstile-310-dark.png new file mode 100644 index 000000000..86b51efbd Binary files /dev/null and b/site/public/brand/clojure/mcp/mstile-310-dark.png differ diff --git a/site/public/brand/clojure/mcp/mstile-310-light.png b/site/public/brand/clojure/mcp/mstile-310-light.png new file mode 100644 index 000000000..89793a098 Binary files /dev/null and b/site/public/brand/clojure/mcp/mstile-310-light.png differ diff --git a/site/public/brand/clojure/mcp/opengraph-dark.jpg b/site/public/brand/clojure/mcp/opengraph-dark.jpg new file mode 100644 index 000000000..ab2e297f5 Binary files /dev/null and b/site/public/brand/clojure/mcp/opengraph-dark.jpg differ diff --git a/site/public/brand/clojure/mcp/opengraph-dark.png b/site/public/brand/clojure/mcp/opengraph-dark.png new file mode 100644 index 000000000..823651eb6 Binary files /dev/null and b/site/public/brand/clojure/mcp/opengraph-dark.png differ diff --git a/site/public/brand/clojure/mcp/opengraph-light.jpg b/site/public/brand/clojure/mcp/opengraph-light.jpg new file mode 100644 index 000000000..d7d957683 Binary files /dev/null and b/site/public/brand/clojure/mcp/opengraph-light.jpg differ diff --git a/site/public/brand/clojure/mcp/opengraph-light.png b/site/public/brand/clojure/mcp/opengraph-light.png new file mode 100644 index 000000000..f074e68a0 Binary files /dev/null and b/site/public/brand/clojure/mcp/opengraph-light.png differ diff --git a/site/public/brand/clojure/mcp/safari-pinned-tab.svg b/site/public/brand/clojure/mcp/safari-pinned-tab.svg new file mode 100644 index 000000000..66ee95e3b --- /dev/null +++ b/site/public/brand/clojure/mcp/safari-pinned-tab.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/mcp/site-dark.webmanifest b/site/public/brand/clojure/mcp/site-dark.webmanifest new file mode 100644 index 000000000..9fcff3a4d --- /dev/null +++ b/site/public/brand/clojure/mcp/site-dark.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure \u2014 MCP", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#12161D", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-dark.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-dark.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/mcp/site.webmanifest b/site/public/brand/clojure/mcp/site.webmanifest new file mode 100644 index 000000000..cff450657 --- /dev/null +++ b/site/public/brand/clojure/mcp/site.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure \u2014 MCP", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#F4F4F1", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-light.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-light.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/mcp/social-square-dark.png b/site/public/brand/clojure/mcp/social-square-dark.png new file mode 100644 index 000000000..2c8cd9015 Binary files /dev/null and b/site/public/brand/clojure/mcp/social-square-dark.png differ diff --git a/site/public/brand/clojure/mcp/social-square-light.png b/site/public/brand/clojure/mcp/social-square-light.png new file mode 100644 index 000000000..84819a592 Binary files /dev/null and b/site/public/brand/clojure/mcp/social-square-light.png differ diff --git a/site/public/brand/clojure/mcp/twitter-dark.png b/site/public/brand/clojure/mcp/twitter-dark.png new file mode 100644 index 000000000..b833558cd Binary files /dev/null and b/site/public/brand/clojure/mcp/twitter-dark.png differ diff --git a/site/public/brand/clojure/mcp/twitter-light.png b/site/public/brand/clojure/mcp/twitter-light.png new file mode 100644 index 000000000..42c39ff1c Binary files /dev/null and b/site/public/brand/clojure/mcp/twitter-light.png differ diff --git a/site/public/brand/clojure/source.json b/site/public/brand/clojure/source.json new file mode 100644 index 000000000..0131fb99a --- /dev/null +++ b/site/public/brand/clojure/source.json @@ -0,0 +1,672 @@ +{ + "schemaVersion": 1, + "repository": "https://github.com/libtmux/assets", + "revision": "ef6c550b8d1120fe6873e610ddbe550f95016a46", + "language": "clojure", + "primary": "#DB5855", + "githubLanguageColors": "https://github.com/github-linguist/linguist/blob/538da05f034fa5c83bd81df128d144e208898da3/lib/linguist/languages.yml", + "mcpArtwork": "https://github.com/modelcontextprotocol/modelcontextprotocol/blob/088176704a4e8f20e7f1d237de1de8484aa412fd/docs/logo/light.svg", + "sourceDirectory": "assets/clojure", + "variants": [ + "library", + "workspace", + "mcp" + ], + "sourceFiles": [ + { + "file": "library/logo.svg", + "bytes": 5888, + "sha256": "11ddff56de0ab2be46c0bee1c9ebbc00aa8fd39ec08e6d0af5d3f107a801ab98" + }, + { + "file": "library/logo-16.png", + "bytes": 588, + "sha256": "7b7cbff1c385c6e43b5cbff58c4d1561826351321d81a2672427d7a3e61d2380" + }, + { + "file": "library/logo-24.png", + "bytes": 769, + "sha256": "7335abb1b8c2fdf79ba036bf51eb076f9163304ff92e54459f6f1beb71922fca" + }, + { + "file": "library/logo-32.png", + "bytes": 1028, + "sha256": "b294b00519d570926b418122b0635047cfd23e9f2ab0cf85ef5b1d0d4d602bf4" + }, + { + "file": "library/logo-48.png", + "bytes": 1477, + "sha256": "7d7290ed720e7fe521c0345626d53eee8877923042b752e52a5a3bb300e69eed" + }, + { + "file": "library/logo-64.png", + "bytes": 1928, + "sha256": "7203fbbf8d23a83c278711e436e08b737f3859ace13886cd48b9c285c117f2e6" + }, + { + "file": "library/logo-96.png", + "bytes": 2754, + "sha256": "fe0cd6052e60fa1081fcf8152ac3b3914103bc7dc3f70c85add66faabae311b0" + }, + { + "file": "library/logo-128.png", + "bytes": 3693, + "sha256": "fe3591357d89c3c098577b7364e769532408685b689821a293401ce803a51815" + }, + { + "file": "library/logo-144.png", + "bytes": 4136, + "sha256": "63d371e53d6aa737035d39ca612a7a157da4fc7fd64081a10533043ae0f52f43" + }, + { + "file": "library/logo-152.png", + "bytes": 4301, + "sha256": "fbbbf71a7062351239c89487ca83c0a9a7390e407de89fd32f782fe1f1c21dc0" + }, + { + "file": "library/logo-167.png", + "bytes": 4793, + "sha256": "c5462a37f76d3d87d6ce0687fc4c9bf9d24231732e558abc1eb67c5937826048" + }, + { + "file": "library/logo-180.png", + "bytes": 5246, + "sha256": "b0ad5ee2fb9807fe3280463e5e69d87a4cc1205ff0df4ac983093f7c8f360a45" + }, + { + "file": "library/logo-192.png", + "bytes": 5610, + "sha256": "801f0d4f91b4b4ad52eead95e90df0a876ecd26e88c2edda17e4d27a3616c74b" + }, + { + "file": "library/logo-256.png", + "bytes": 7517, + "sha256": "3120f5811ec98f14de73439f3749fd9dda98ec15ad3631af8bd787536216ff3a" + }, + { + "file": "library/logo-384.png", + "bytes": 11696, + "sha256": "cb1ac0d5841e7e9cf7cb8d22105d22a57028bb653d9ee85e6bfdffe7e716faff" + }, + { + "file": "library/logo-512.png", + "bytes": 16186, + "sha256": "f2c984aeed0f03d6d12aa356acd014b8bd4b9127380b70a8e1eac39ed4662d9c" + }, + { + "file": "library/logo-1024.png", + "bytes": 36708, + "sha256": "525f9b3baa6ee4e5d18b988ee5070f5b71c30481b87e1d17033d33e8d461c2f3" + }, + { + "file": "library/favicon.ico", + "bytes": 22619, + "sha256": "18479bcf4f3a5d5aec5bd037005650ef9944c74f59562f4a7545ca34ab000a15" + }, + { + "file": "library/safari-pinned-tab.svg", + "bytes": 5888, + "sha256": "fb537422ad831c9d255f6fdf5c760d05046c6144a9fcbf3371599085bd9d7d50" + }, + { + "file": "library/apple-touch-icon-light.png", + "bytes": 3802, + "sha256": "a866bb5c6485791024172d81659cc8822a5fb4921ca5cae3650f869b688bb08a" + }, + { + "file": "library/app-icon-1024-light.png", + "bytes": 28151, + "sha256": "800e40778d99463f83090fefc5d95ea993c927185dd02d9ff76430ffb7295d53" + }, + { + "file": "library/maskable-192-light.png", + "bytes": 3035, + "sha256": "e404353466d10535e4186edfd7960c3b46eb08e31382143aaea5b24f512b2e4a" + }, + { + "file": "library/maskable-512-light.png", + "bytes": 9212, + "sha256": "4f91380c34c746f2e68b952fb2b0696b61672c09860b2496e4d5598314a3da40" + }, + { + "file": "library/mstile-150-light.png", + "bytes": 2979, + "sha256": "369e95638cdb4d6722767899703a96ac82d3e832e6836606578d8a0f51d7d173" + }, + { + "file": "library/mstile-310-light.png", + "bytes": 6443, + "sha256": "b38cb0c9e84b5427a57cdd18f0f3eecba4794b926e53ca3b9f5f9f4526478bf4" + }, + { + "file": "library/opengraph-light.png", + "bytes": 63858, + "sha256": "093f7d845335fea028d137a2553f62574670c820b298d4430eb49e4bf07cb582" + }, + { + "file": "library/opengraph-light.jpg", + "bytes": 102897, + "sha256": "3c1b5f56a84d94611567e7cfc0309c17ed81adf3994657d9e3083e349202d794" + }, + { + "file": "library/twitter-light.png", + "bytes": 63645, + "sha256": "32cc84dd08cf4e467fad34578eec0e4f10b51b156c9c72d6485a54d003aa129b" + }, + { + "file": "library/social-square-light.png", + "bytes": 73455, + "sha256": "66214e1a5b0d05b29a158a562a3aed82e07a966939fce63c47c908026e6ea61a" + }, + { + "file": "library/site.webmanifest", + "bytes": 719, + "sha256": "fe100bef17453a22c688cd2e05d31e7c01e1756f76c263a62fa6fe149087a0c8" + }, + { + "file": "library/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686" + }, + { + "file": "library/apple-touch-icon-dark.png", + "bytes": 3831, + "sha256": "c70953b0e51cce90c114975805c9e8ed147187b1f803c5360bd1cd5ad746e6d5" + }, + { + "file": "library/app-icon-1024-dark.png", + "bytes": 28478, + "sha256": "6fda6a4526c615c8a9bcd8c696ec3a7b2a56dfa9ddf97c4d70253ed9bedc2a78" + }, + { + "file": "library/maskable-192-dark.png", + "bytes": 3071, + "sha256": "2244557a8b2c8a59b5c611b1b0071e6189f3eca8b6495ef4f4518195c7592295" + }, + { + "file": "library/maskable-512-dark.png", + "bytes": 9279, + "sha256": "6512cc411316dd0fcdd735ba426db4aeb32d784c0592c7e5ae26af793ab5d389" + }, + { + "file": "library/mstile-150-dark.png", + "bytes": 3010, + "sha256": "e82d97bf797f1088b163cfc218b57a7d8968a2539d883ce4b6b6b35e787a3d11" + }, + { + "file": "library/mstile-310-dark.png", + "bytes": 6503, + "sha256": "e83c75f99c3bce1648216485b1ae9931d553800629dfd8861549321ccdb84862" + }, + { + "file": "library/opengraph-dark.png", + "bytes": 64048, + "sha256": "88feb58fec772c1a934c0063a5878c30f61becd30edff2aa6fff31b6f9965653" + }, + { + "file": "library/opengraph-dark.jpg", + "bytes": 94698, + "sha256": "6f696ca1ef6f0757a84941e26e94e820a4adad942926fa8e11d7ccb79dda751f" + }, + { + "file": "library/twitter-dark.png", + "bytes": 63841, + "sha256": "7d03257e4f3917175ffb740352df92df6cbe360da2a18a5eaeb367baa62e8aea" + }, + { + "file": "library/social-square-dark.png", + "bytes": 73511, + "sha256": "21b8d41bf8459e99b673160c579b71cf389b93838b9b9c0070d342537b8f9da1" + }, + { + "file": "library/site-dark.webmanifest", + "bytes": 717, + "sha256": "b4e6de6d6a159e39e24c0145134df50a55d5bd05cb1636185cac97c83ff665aa" + }, + { + "file": "library/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4" + }, + { + "file": "workspace/logo.svg", + "bytes": 2411, + "sha256": "bbd031aa2439c816bf249704f71fd20e7304316a8303d600945f504c2c5ffb08" + }, + { + "file": "workspace/logo-16.png", + "bytes": 294, + "sha256": "157cf1a35e547801ce09a83fb2a42abac605e4899164afe199a7062af87028cb" + }, + { + "file": "workspace/logo-24.png", + "bytes": 324, + "sha256": "5b4b03740f3a2955e0748150159f2bcd3818b10f65098a8ea2772fd18382de8d" + }, + { + "file": "workspace/logo-32.png", + "bytes": 412, + "sha256": "ca1357046c440e68c0bf27ebc3b28833472aefc017c9c0706f7e0bdff526d4ae" + }, + { + "file": "workspace/logo-48.png", + "bytes": 546, + "sha256": "28859fea9a04e16a1882648e8bd817bd921b30140f5cda74ad3dcc4f4c76cea4" + }, + { + "file": "workspace/logo-64.png", + "bytes": 637, + "sha256": "747317e2de6a283193937dff4aef8af69dedc85c999bb03a0341a2085c717518" + }, + { + "file": "workspace/logo-96.png", + "bytes": 865, + "sha256": "91a3aee17ed086333a8d8d08d8948d70ad7f18c0980ab1215b742bb3a28c5a7c" + }, + { + "file": "workspace/logo-128.png", + "bytes": 1141, + "sha256": "b2c67851465a796370bf639305e945e9b2e05657edf52058d4f21410178adc2e" + }, + { + "file": "workspace/logo-144.png", + "bytes": 1301, + "sha256": "9eb26bc0132dc45615705aab73dc627ce9e84d70bda344d34951fa8fd6a54f06" + }, + { + "file": "workspace/logo-152.png", + "bytes": 1339, + "sha256": "27c825539818688e216f37f14aa0c37b5505564f2c01201ef0a77d08736e3e5c" + }, + { + "file": "workspace/logo-167.png", + "bytes": 1511, + "sha256": "53a5fe5ef0ccde7dbcb670585df19d2c86eefa89029ce0c400dd23ba6a18db33" + }, + { + "file": "workspace/logo-180.png", + "bytes": 1636, + "sha256": "b803aba00cd36ecd4313d4e42eb90d4a319ab47e7977a3e5968f0cbc85cd691e" + }, + { + "file": "workspace/logo-192.png", + "bytes": 1759, + "sha256": "36129e93c60eaf993fa1844555f945fc7807bf0a19fb3223081a41a96ce27b27" + }, + { + "file": "workspace/logo-256.png", + "bytes": 2456, + "sha256": "4482a1114dd8ae762afc49d56fcc03f9c0e3b17bfc5a637914b479e589e88342" + }, + { + "file": "workspace/logo-384.png", + "bytes": 3766, + "sha256": "c79766a94fb17c9420b87ca0b070b5d0f5731200251256650f10bf5ce6fd1bd5" + }, + { + "file": "workspace/logo-512.png", + "bytes": 5360, + "sha256": "c04c6511461ed66fba98ae89da21989448f60f81d19d85689b7d25056cc39db3" + }, + { + "file": "workspace/logo-1024.png", + "bytes": 13806, + "sha256": "7af2f76e27a543ecabe3e4fac45ad00a4d78daad1fd10f68aa06c3778a7ce51e" + }, + { + "file": "workspace/favicon.ico", + "bytes": 17558, + "sha256": "7cd86c60a7bcdbb4a0d0052383aaa29d621b27b00fa4330143a288319870823d" + }, + { + "file": "workspace/safari-pinned-tab.svg", + "bytes": 2411, + "sha256": "fbf48c69e16b641e2451224e98e9a0499c9f87e898d14023e3b685bc08c70713" + }, + { + "file": "workspace/apple-touch-icon-light.png", + "bytes": 1314, + "sha256": "3a46f8d1be11c1580024cf10fa0e67193599e7681edba5d26b25685d0812cfdf" + }, + { + "file": "workspace/app-icon-1024-light.png", + "bytes": 11470, + "sha256": "4adac0f00053f2ceb3793955320c9863030c521368fcb976d200967667ce4382" + }, + { + "file": "workspace/maskable-192-light.png", + "bytes": 1120, + "sha256": "d1a732da708bd84752786e2b45d71b12f495c59c0e3ad3e93bdad90e806a0c3f" + }, + { + "file": "workspace/maskable-512-light.png", + "bytes": 3821, + "sha256": "e5d363c2ccc3830807a4f69d31294c45c4549566c9b431d33cde34bb78b8eb91" + }, + { + "file": "workspace/mstile-150-light.png", + "bytes": 987, + "sha256": "e7130fb318d753b775334cb11ba006096231cdc7589759a6bc461d517ee3157d" + }, + { + "file": "workspace/mstile-310-light.png", + "bytes": 2222, + "sha256": "a8c0481d31c4b1f7eba1d8702fabb168ea9015365230959154188e12f8898e8d" + }, + { + "file": "workspace/opengraph-light.png", + "bytes": 23382, + "sha256": "6639bd5a388f161defe0b39aee3ba35c6de58e9ebd164c1a8c9901840c170d58" + }, + { + "file": "workspace/opengraph-light.jpg", + "bytes": 44332, + "sha256": "a7e1b491a0baaa419d3efaf0edfaf2f4278e268cf09d8677dd9e4718600f820d" + }, + { + "file": "workspace/twitter-light.png", + "bytes": 23236, + "sha256": "58b93094f81a6b640a3fdef78046e911db5b190e6bddc4a73a4b6f38e4f7f677" + }, + { + "file": "workspace/social-square-light.png", + "bytes": 26323, + "sha256": "4c4afe2bbaa11cf91dfbd6ecfa97e400d821b42a8797322a164351c39735bdb6" + }, + { + "file": "workspace/site.webmanifest", + "bytes": 737, + "sha256": "54536dc687dba5eff5ff45c5f2728d3d6b1cbbe28407104e34537547edd5a87f" + }, + { + "file": "workspace/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686" + }, + { + "file": "workspace/apple-touch-icon-dark.png", + "bytes": 1268, + "sha256": "4cbca68246803e36c912f973364ad2086cd4f0161c47c68fcbb32e7993c0a512" + }, + { + "file": "workspace/app-icon-1024-dark.png", + "bytes": 11284, + "sha256": "0cb97c12266e57c6f5b2976203113f38ce3bb688ec86f22923a22fafa5afbb7c" + }, + { + "file": "workspace/maskable-192-dark.png", + "bytes": 1102, + "sha256": "49a1fd1f6197a580d85a44dacafbdd548983e75f8bc2d1749db572be2c9c8914" + }, + { + "file": "workspace/maskable-512-dark.png", + "bytes": 3761, + "sha256": "4b511b1a56f704bc3986295173b4a673846f926c1ae1ab917c1cfc716925fbd6" + }, + { + "file": "workspace/mstile-150-dark.png", + "bytes": 970, + "sha256": "9556a242b3eeed6aae08791bb3142f82127e4d129874b6e41493793a71972c42" + }, + { + "file": "workspace/mstile-310-dark.png", + "bytes": 2165, + "sha256": "1e7a68885277da264cb7cce87ea44a49c302f5bd661f77101c71a5f23d7ad874" + }, + { + "file": "workspace/opengraph-dark.png", + "bytes": 23454, + "sha256": "446a8aa3033990e9b7a6d4c4ede9639ac72be58f7c0b63c2b2895ce11d6a3f2e" + }, + { + "file": "workspace/opengraph-dark.jpg", + "bytes": 42307, + "sha256": "f684cb6e53402e4d89344e5941436361e65efdc356ac8897d9094f88da88376c" + }, + { + "file": "workspace/twitter-dark.png", + "bytes": 23308, + "sha256": "caaac813a9e9f49f7a645dd1aef23465bf05a85274c9fba032a220a939d968ef" + }, + { + "file": "workspace/social-square-dark.png", + "bytes": 26355, + "sha256": "a6eff66fe52f7b5499ce920b85ed8de45e41d388d6a8f596c1bc2f5c1a32247f" + }, + { + "file": "workspace/site-dark.webmanifest", + "bytes": 735, + "sha256": "c411e08070194b2fda0ca5470b61aedbd40965f32207744cb4ff3a8301d469b7" + }, + { + "file": "workspace/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4" + }, + { + "file": "mcp/logo.svg", + "bytes": 4059, + "sha256": "7ea043036c960d044b0b2e3d1c1afcaba91f719fd76e855767095e8e17d3a37e" + }, + { + "file": "mcp/logo-16.png", + "bytes": 600, + "sha256": "59a19419974d1eafa632d69bf629d02960df8a8c72ace3698c0e458ceffd8dba" + }, + { + "file": "mcp/logo-24.png", + "bytes": 874, + "sha256": "f331ec120475f3678fc14a86ee5ce4913ee7c5c035f4cfde7fd8a0011fe9139d" + }, + { + "file": "mcp/logo-32.png", + "bytes": 1183, + "sha256": "c06964a8a73e20ca83bceb30d44376c0091f677ea5bec03c46c8a8273670b6ee" + }, + { + "file": "mcp/logo-48.png", + "bytes": 1747, + "sha256": "8c686f930a2a3f274b968da473e1c15a264a31513ab08ea59d2007685104d54f" + }, + { + "file": "mcp/logo-64.png", + "bytes": 2190, + "sha256": "edf6fec509f0b94f9ce8b4c7699e5a25046d05058054d133402a65b79d2ac7cd" + }, + { + "file": "mcp/logo-96.png", + "bytes": 3198, + "sha256": "f1cccd8d638b495f5a4bc386df0cf5c31b65ced0ea2a715f72a523da8054b5b6" + }, + { + "file": "mcp/logo-128.png", + "bytes": 4143, + "sha256": "6553d7154ea0aecc7707aca5e4ac66e66c7af8f70f7240beba9bdd3f77809e79" + }, + { + "file": "mcp/logo-144.png", + "bytes": 4575, + "sha256": "d3a515589d9457744f0b9e8be08d7ab0d16fe32649facb569757fc4482fc59cb" + }, + { + "file": "mcp/logo-152.png", + "bytes": 4780, + "sha256": "9ba71a549283863c0c904293c2c74529a4f6456410c69fd5ddce80dc9a2486c2" + }, + { + "file": "mcp/logo-167.png", + "bytes": 5085, + "sha256": "14372ff20c34009502d462d5247881fd4c3ebc1fa71e5fcc8cf92c27e160e143" + }, + { + "file": "mcp/logo-180.png", + "bytes": 5541, + "sha256": "264ff71383f39623f12f93cdaa79a7b47e9e703d2ad69d6c941165ff423a82ff" + }, + { + "file": "mcp/logo-192.png", + "bytes": 5967, + "sha256": "0b4877fd0f4852953da1b6ff3cf6e2411577af61bba377be759c4df64a5f7caa" + }, + { + "file": "mcp/logo-256.png", + "bytes": 8042, + "sha256": "933a4f322392c98f50246c0eb5791096199983a3095ae218b8d0bb2805725c45" + }, + { + "file": "mcp/logo-384.png", + "bytes": 12316, + "sha256": "2c941d7bf1f5e0b7e3c9ebfed98eb1dcbb15aacc3822fc3d2f38da5c59b2bc1a" + }, + { + "file": "mcp/logo-512.png", + "bytes": 16891, + "sha256": "503a3a6b242bfd63daf375205256f3974ed0e312a794e9a3d421e4e14eb9254b" + }, + { + "file": "mcp/logo-1024.png", + "bytes": 38232, + "sha256": "071c1cc286d72e57dcf07371b5045bdd682cd62a984d1006af3fe21771e2f065" + }, + { + "file": "mcp/favicon.ico", + "bytes": 23144, + "sha256": "14a0d1899f966656938b47f17cd2918e73827f66a6aff96616163af8db60d79a" + }, + { + "file": "mcp/safari-pinned-tab.svg", + "bytes": 4059, + "sha256": "c016620dcb1a7f4233536157027a90544639e8ec5024c1154e007b5c603969a8" + }, + { + "file": "mcp/apple-touch-icon-light.png", + "bytes": 4246, + "sha256": "a5026fafe190c4ff475642f1eb9cf19c7c07bab272481bf58de82d5ab97e8e86" + }, + { + "file": "mcp/app-icon-1024-light.png", + "bytes": 28162, + "sha256": "27b27c116c2c6b3f43b737bd8a923f0eac3ffd50838f336e51867bac62556446" + }, + { + "file": "mcp/maskable-192-light.png", + "bytes": 3227, + "sha256": "31ea0e334f6ffde8be329d97717dae51f5dc67b7ece5a6399cef4e928b318b6c" + }, + { + "file": "mcp/maskable-512-light.png", + "bytes": 9616, + "sha256": "44286f7f2afa1e23148223e10b7d8224fa77a86e279453ab86db8ba9e1779109" + }, + { + "file": "mcp/mstile-150-light.png", + "bytes": 3286, + "sha256": "21f62eb486cfbb0d9aee36d273d99acbf1245fce6b6410c50d70596096813ed4" + }, + { + "file": "mcp/mstile-310-light.png", + "bytes": 6785, + "sha256": "cc34dbcf1d6f52e9ececf2d75620df7bcc9c9925639cea290abe62d14b9905b1" + }, + { + "file": "mcp/opengraph-light.png", + "bytes": 26969, + "sha256": "c7d34113394d53f1243b0feb53e35d10d762862b4b5475fabe917a6fb699bec2" + }, + { + "file": "mcp/opengraph-light.jpg", + "bytes": 52184, + "sha256": "784d70dd49ecd13edafc337f73b36caffc6902e62308a354c0d1282cc7351f6f" + }, + { + "file": "mcp/twitter-light.png", + "bytes": 26782, + "sha256": "8cbcc1c543ce74380297a115b9c9a2433d29aeebdc25a39ea6f890cea0cca74b" + }, + { + "file": "mcp/social-square-light.png", + "bytes": 31021, + "sha256": "159b2a1b75d4c5c0bad46a25e95df8bc18bf6c2a52e18b533286cf41ccaa2e58" + }, + { + "file": "mcp/site.webmanifest", + "bytes": 727, + "sha256": "8612e74740d0d52a62149f00747fdae640f821f4b41ae931158e3b1a3b0aa4a8" + }, + { + "file": "mcp/browserconfig.xml", + "bytes": 238, + "sha256": "5a118e4503c0007181230f5f81ab07486a3dff66d0d3d99d2cfa5e10857c0686" + }, + { + "file": "mcp/apple-touch-icon-dark.png", + "bytes": 4277, + "sha256": "a6a17fe58a42621e9e0e48ba97a2eea95fb8f4c200fd05a4898881ec6f48e97d" + }, + { + "file": "mcp/app-icon-1024-dark.png", + "bytes": 28437, + "sha256": "a48a4e59547319ec6f7923a575f88019891b019fb0ad2911fd07119297e0169e" + }, + { + "file": "mcp/maskable-192-dark.png", + "bytes": 3296, + "sha256": "d70012213fc01f5140f489d8255d0267bad58083e63f870362241d07cff4f31c" + }, + { + "file": "mcp/maskable-512-dark.png", + "bytes": 9696, + "sha256": "fe79abbed378ad1f5522f9fad3f39dfcbdf60e54d5a7fd209b5295b33d8b9a08" + }, + { + "file": "mcp/mstile-150-dark.png", + "bytes": 3345, + "sha256": "7ac41c9c947064c31a3cdc7e87e1512e82e6af938c15f7803f442ba038449a00" + }, + { + "file": "mcp/mstile-310-dark.png", + "bytes": 6839, + "sha256": "8508dcb124763891458c5c821efae1748d547863ca139fae9d838192fb20f063" + }, + { + "file": "mcp/opengraph-dark.png", + "bytes": 27177, + "sha256": "0a3a8267fdd450053b90fb334870b555728dfeab91444da733bae8291db09344" + }, + { + "file": "mcp/opengraph-dark.jpg", + "bytes": 50859, + "sha256": "ea408f1790a88c18d498a68634aa0a4ed941d77c03cbab10d7a1c880b07b5bdc" + }, + { + "file": "mcp/twitter-dark.png", + "bytes": 27005, + "sha256": "cd3b89cb8bc62d76b026f03ec77c26f5684216a63d2344798bd139175bc78772" + }, + { + "file": "mcp/social-square-dark.png", + "bytes": 31301, + "sha256": "069df1973006ccfc335c1eeaa522d9b61a7e349fc2e9e31d9539533f9d26fb26" + }, + { + "file": "mcp/site-dark.webmanifest", + "bytes": 725, + "sha256": "5bf433a6cdf8b23ce9ff9904febffdfdc1f06e0b4b6f12d03ee23f355d03d390" + }, + { + "file": "mcp/browserconfig-dark.xml", + "bytes": 236, + "sha256": "b2d0e922aedf0404812e84a2d735cbff30f6564cde4fe3122e6e76d827bee7c4" + } + ], + "manifestOverrides": { + "files": [ + "site.webmanifest", + "site-dark.webmanifest" + ], + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser" + } +} diff --git a/site/public/brand/clojure/workspace/app-icon-1024-dark.png b/site/public/brand/clojure/workspace/app-icon-1024-dark.png new file mode 100644 index 000000000..c99c1c5ff Binary files /dev/null and b/site/public/brand/clojure/workspace/app-icon-1024-dark.png differ diff --git a/site/public/brand/clojure/workspace/app-icon-1024-light.png b/site/public/brand/clojure/workspace/app-icon-1024-light.png new file mode 100644 index 000000000..4c6b53f11 Binary files /dev/null and b/site/public/brand/clojure/workspace/app-icon-1024-light.png differ diff --git a/site/public/brand/clojure/workspace/apple-touch-icon-dark.png b/site/public/brand/clojure/workspace/apple-touch-icon-dark.png new file mode 100644 index 000000000..7e5fc655c Binary files /dev/null and b/site/public/brand/clojure/workspace/apple-touch-icon-dark.png differ diff --git a/site/public/brand/clojure/workspace/apple-touch-icon-light.png b/site/public/brand/clojure/workspace/apple-touch-icon-light.png new file mode 100644 index 000000000..9a8d6d766 Binary files /dev/null and b/site/public/brand/clojure/workspace/apple-touch-icon-light.png differ diff --git a/site/public/brand/clojure/workspace/browserconfig-dark.xml b/site/public/brand/clojure/workspace/browserconfig-dark.xml new file mode 100644 index 000000000..31075520c --- /dev/null +++ b/site/public/brand/clojure/workspace/browserconfig-dark.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/workspace/browserconfig.xml b/site/public/brand/clojure/workspace/browserconfig.xml new file mode 100644 index 000000000..71a55e1d8 --- /dev/null +++ b/site/public/brand/clojure/workspace/browserconfig.xml @@ -0,0 +1 @@ +#DB5855 diff --git a/site/public/brand/clojure/workspace/favicon.ico b/site/public/brand/clojure/workspace/favicon.ico new file mode 100644 index 000000000..92465db54 Binary files /dev/null and b/site/public/brand/clojure/workspace/favicon.ico differ diff --git a/site/public/brand/clojure/workspace/logo-1024.png b/site/public/brand/clojure/workspace/logo-1024.png new file mode 100644 index 000000000..e6b885d65 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-1024.png differ diff --git a/site/public/brand/clojure/workspace/logo-128.png b/site/public/brand/clojure/workspace/logo-128.png new file mode 100644 index 000000000..17f796bfd Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-128.png differ diff --git a/site/public/brand/clojure/workspace/logo-144.png b/site/public/brand/clojure/workspace/logo-144.png new file mode 100644 index 000000000..be819a67e Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-144.png differ diff --git a/site/public/brand/clojure/workspace/logo-152.png b/site/public/brand/clojure/workspace/logo-152.png new file mode 100644 index 000000000..f00d172a5 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-152.png differ diff --git a/site/public/brand/clojure/workspace/logo-16.png b/site/public/brand/clojure/workspace/logo-16.png new file mode 100644 index 000000000..927d2ee72 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-16.png differ diff --git a/site/public/brand/clojure/workspace/logo-167.png b/site/public/brand/clojure/workspace/logo-167.png new file mode 100644 index 000000000..a6d68dc9d Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-167.png differ diff --git a/site/public/brand/clojure/workspace/logo-180.png b/site/public/brand/clojure/workspace/logo-180.png new file mode 100644 index 000000000..dd69ad212 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-180.png differ diff --git a/site/public/brand/clojure/workspace/logo-192.png b/site/public/brand/clojure/workspace/logo-192.png new file mode 100644 index 000000000..c4016d076 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-192.png differ diff --git a/site/public/brand/clojure/workspace/logo-24.png b/site/public/brand/clojure/workspace/logo-24.png new file mode 100644 index 000000000..0b1b8e756 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-24.png differ diff --git a/site/public/brand/clojure/workspace/logo-256.png b/site/public/brand/clojure/workspace/logo-256.png new file mode 100644 index 000000000..2dc20b36b Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-256.png differ diff --git a/site/public/brand/clojure/workspace/logo-32.png b/site/public/brand/clojure/workspace/logo-32.png new file mode 100644 index 000000000..0609b7c93 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-32.png differ diff --git a/site/public/brand/clojure/workspace/logo-384.png b/site/public/brand/clojure/workspace/logo-384.png new file mode 100644 index 000000000..d306be219 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-384.png differ diff --git a/site/public/brand/clojure/workspace/logo-48.png b/site/public/brand/clojure/workspace/logo-48.png new file mode 100644 index 000000000..e7c275165 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-48.png differ diff --git a/site/public/brand/clojure/workspace/logo-512.png b/site/public/brand/clojure/workspace/logo-512.png new file mode 100644 index 000000000..b5b8d4e1a Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-512.png differ diff --git a/site/public/brand/clojure/workspace/logo-64.png b/site/public/brand/clojure/workspace/logo-64.png new file mode 100644 index 000000000..56f3f9bd0 Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-64.png differ diff --git a/site/public/brand/clojure/workspace/logo-96.png b/site/public/brand/clojure/workspace/logo-96.png new file mode 100644 index 000000000..eae1ee8fc Binary files /dev/null and b/site/public/brand/clojure/workspace/logo-96.png differ diff --git a/site/public/brand/clojure/workspace/logo.svg b/site/public/brand/clojure/workspace/logo.svg new file mode 100644 index 000000000..a3e5f6a12 --- /dev/null +++ b/site/public/brand/clojure/workspace/logo.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/workspace/maskable-192-dark.png b/site/public/brand/clojure/workspace/maskable-192-dark.png new file mode 100644 index 000000000..c1bc06fc2 Binary files /dev/null and b/site/public/brand/clojure/workspace/maskable-192-dark.png differ diff --git a/site/public/brand/clojure/workspace/maskable-192-light.png b/site/public/brand/clojure/workspace/maskable-192-light.png new file mode 100644 index 000000000..c70678fd7 Binary files /dev/null and b/site/public/brand/clojure/workspace/maskable-192-light.png differ diff --git a/site/public/brand/clojure/workspace/maskable-512-dark.png b/site/public/brand/clojure/workspace/maskable-512-dark.png new file mode 100644 index 000000000..04cef306d Binary files /dev/null and b/site/public/brand/clojure/workspace/maskable-512-dark.png differ diff --git a/site/public/brand/clojure/workspace/maskable-512-light.png b/site/public/brand/clojure/workspace/maskable-512-light.png new file mode 100644 index 000000000..a82f31470 Binary files /dev/null and b/site/public/brand/clojure/workspace/maskable-512-light.png differ diff --git a/site/public/brand/clojure/workspace/mstile-150-dark.png b/site/public/brand/clojure/workspace/mstile-150-dark.png new file mode 100644 index 000000000..d7649acc3 Binary files /dev/null and b/site/public/brand/clojure/workspace/mstile-150-dark.png differ diff --git a/site/public/brand/clojure/workspace/mstile-150-light.png b/site/public/brand/clojure/workspace/mstile-150-light.png new file mode 100644 index 000000000..eac016655 Binary files /dev/null and b/site/public/brand/clojure/workspace/mstile-150-light.png differ diff --git a/site/public/brand/clojure/workspace/mstile-310-dark.png b/site/public/brand/clojure/workspace/mstile-310-dark.png new file mode 100644 index 000000000..ae02ecb57 Binary files /dev/null and b/site/public/brand/clojure/workspace/mstile-310-dark.png differ diff --git a/site/public/brand/clojure/workspace/mstile-310-light.png b/site/public/brand/clojure/workspace/mstile-310-light.png new file mode 100644 index 000000000..72dfb6283 Binary files /dev/null and b/site/public/brand/clojure/workspace/mstile-310-light.png differ diff --git a/site/public/brand/clojure/workspace/opengraph-dark.jpg b/site/public/brand/clojure/workspace/opengraph-dark.jpg new file mode 100644 index 000000000..21ef09e99 Binary files /dev/null and b/site/public/brand/clojure/workspace/opengraph-dark.jpg differ diff --git a/site/public/brand/clojure/workspace/opengraph-dark.png b/site/public/brand/clojure/workspace/opengraph-dark.png new file mode 100644 index 000000000..12fc8bcf7 Binary files /dev/null and b/site/public/brand/clojure/workspace/opengraph-dark.png differ diff --git a/site/public/brand/clojure/workspace/opengraph-light.jpg b/site/public/brand/clojure/workspace/opengraph-light.jpg new file mode 100644 index 000000000..903ea8df2 Binary files /dev/null and b/site/public/brand/clojure/workspace/opengraph-light.jpg differ diff --git a/site/public/brand/clojure/workspace/opengraph-light.png b/site/public/brand/clojure/workspace/opengraph-light.png new file mode 100644 index 000000000..64b3e637f Binary files /dev/null and b/site/public/brand/clojure/workspace/opengraph-light.png differ diff --git a/site/public/brand/clojure/workspace/safari-pinned-tab.svg b/site/public/brand/clojure/workspace/safari-pinned-tab.svg new file mode 100644 index 000000000..2aff6cd24 --- /dev/null +++ b/site/public/brand/clojure/workspace/safari-pinned-tab.svg @@ -0,0 +1,2 @@ + + diff --git a/site/public/brand/clojure/workspace/site-dark.webmanifest b/site/public/brand/clojure/workspace/site-dark.webmanifest new file mode 100644 index 000000000..2f43cb880 --- /dev/null +++ b/site/public/brand/clojure/workspace/site-dark.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure \u2014 workspace CLI", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#12161D", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-dark.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-dark.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/workspace/site.webmanifest b/site/public/brand/clojure/workspace/site.webmanifest new file mode 100644 index 000000000..30de27a7c --- /dev/null +++ b/site/public/brand/clojure/workspace/site.webmanifest @@ -0,0 +1,36 @@ +{ + "name": "libtmux for Clojure \u2014 workspace CLI", + "short_name": "libtmux", + "id": "/", + "start_url": "../../../", + "scope": "../../../", + "display": "browser", + "background_color": "#F4F4F1", + "theme_color": "#DB5855", + "icons": [ + { + "src": "logo-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-192-light.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "logo-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any" + }, + { + "src": "maskable-512-light.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +} diff --git a/site/public/brand/clojure/workspace/social-square-dark.png b/site/public/brand/clojure/workspace/social-square-dark.png new file mode 100644 index 000000000..bd480ace4 Binary files /dev/null and b/site/public/brand/clojure/workspace/social-square-dark.png differ diff --git a/site/public/brand/clojure/workspace/social-square-light.png b/site/public/brand/clojure/workspace/social-square-light.png new file mode 100644 index 000000000..510cb14bd Binary files /dev/null and b/site/public/brand/clojure/workspace/social-square-light.png differ diff --git a/site/public/brand/clojure/workspace/twitter-dark.png b/site/public/brand/clojure/workspace/twitter-dark.png new file mode 100644 index 000000000..93e44a938 Binary files /dev/null and b/site/public/brand/clojure/workspace/twitter-dark.png differ diff --git a/site/public/brand/clojure/workspace/twitter-light.png b/site/public/brand/clojure/workspace/twitter-light.png new file mode 100644 index 000000000..c6e170b99 Binary files /dev/null and b/site/public/brand/clojure/workspace/twitter-light.png differ diff --git a/site/public/brand/languages/clojure/LICENSE.txt b/site/public/brand/languages/clojure/LICENSE.txt new file mode 100644 index 000000000..fcc9b6677 --- /dev/null +++ b/site/public/brand/languages/clojure/LICENSE.txt @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 konpa + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/site/public/brand/languages/clojure/icon.svg b/site/public/brand/languages/clojure/icon.svg new file mode 100644 index 000000000..63abd2e6c --- /dev/null +++ b/site/public/brand/languages/clojure/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/site/public/brand/languages/clojure/provenance.json b/site/public/brand/languages/clojure/provenance.json new file mode 100644 index 000000000..21b95312f --- /dev/null +++ b/site/public/brand/languages/clojure/provenance.json @@ -0,0 +1,25 @@ +{ + "name": "Clojure", + "asset": "icon.svg", + "sourceUrl": "https://raw.githubusercontent.com/devicons/devicon/7330accdbc47e2dc0c19789a48533c4a3c50fe58/icons/clojure/clojure-original.svg", + "resolvedUrl": "https://raw.githubusercontent.com/devicons/devicon/7330accdbc47e2dc0c19789a48533c4a3c50fe58/icons/clojure/clojure-original.svg", + "sourcePage": "https://github.com/devicons/devicon/tree/7330accdbc47e2dc0c19789a48533c4a3c50fe58/icons/clojure", + "retrievedAt": "2026-11-07T21:11:11.119143+00:00", + "sha256": "405b1b05bbbdd7ddfdbe331fec17360de2b6b482b7f67aa66540fa12e6e73e25", + "copyright": "Devicon collection: Copyright (c) 2015 konpa. The language marks belong to their respective projects.", + "license": { + "name": "MIT (Devicon collection)", + "urls": [ + "https://raw.githubusercontent.com/devicons/devicon/7330accdbc47e2dc0c19789a48533c4a3c50fe58/LICENSE" + ], + "notes": "Used to identify the language and its package destination. No endorsement is implied.", + "localCopy": { + "file": "LICENSE.txt", + "sourceUrl": "https://raw.githubusercontent.com/devicons/devicon/7330accdbc47e2dc0c19789a48533c4a3c50fe58/LICENSE", + "retrievedAt": "2026-10-10T18:04:46.645136+00:00", + "sha256": "121194741d4a915b9f5890fdd6dd95121f9b1f816517c792358d72d7c838d664" + } + }, + "modifications": "None. The downloaded SVG bytes are preserved.", + "upstreamRevision": "7330accdbc47e2dc0c19789a48533c4a3c50fe58" +} diff --git a/site/public/versions.json b/site/public/versions.json index 92c408cda..6ca295861 100644 --- a/site/public/versions.json +++ b/site/public/versions.json @@ -25,7 +25,7 @@ "supported": true } ], - "ts": [ + "powershell": [ { "slug": "latest", "label": "latest", @@ -33,7 +33,7 @@ "supported": true } ], - "rs": [ + "julia": [ { "slug": "latest", "label": "latest", @@ -41,7 +41,7 @@ "supported": true } ], - "go": [ + "elixir": [ { "slug": "latest", "label": "latest", @@ -49,7 +49,7 @@ "supported": true } ], - "java": [ + "ts": [ { "slug": "latest", "label": "latest", @@ -57,7 +57,7 @@ "supported": true } ], - "kotlin": [ + "rs": [ { "slug": "latest", "label": "latest", @@ -65,7 +65,7 @@ "supported": true } ], - "scala": [ + "go": [ { "slug": "latest", "label": "latest", @@ -73,7 +73,7 @@ "supported": true } ], - "csharp": [ + "java": [ { "slug": "latest", "label": "latest", @@ -81,7 +81,7 @@ "supported": true } ], - "fsharp": [ + "clojure": [ { "slug": "latest", "label": "latest", @@ -89,7 +89,7 @@ "supported": true } ], - "cxx": [ + "kotlin": [ { "slug": "latest", "label": "latest", @@ -97,7 +97,7 @@ "supported": true } ], - "swift": [ + "scala": [ { "slug": "latest", "label": "latest", @@ -105,7 +105,7 @@ "supported": true } ], - "powershell": [ + "csharp": [ { "slug": "latest", "label": "latest", @@ -113,7 +113,7 @@ "supported": true } ], - "julia": [ + "fsharp": [ { "slug": "latest", "label": "latest", @@ -121,7 +121,15 @@ "supported": true } ], - "elixir": [ + "cxx": [ + { + "slug": "latest", + "label": "latest", + "kind": "trunk", + "supported": true + } + ], + "swift": [ { "slug": "latest", "label": "latest", @@ -134,18 +142,19 @@ "py": "latest", "ruby": "latest", "lua": "latest", + "powershell": "latest", + "julia": "latest", + "elixir": "latest", "ts": "latest", "rs": "latest", "go": "latest", "java": "latest", + "clojure": "latest", "kotlin": "latest", "scala": "latest", "csharp": "latest", "fsharp": "latest", "cxx": "latest", - "swift": "latest", - "powershell": "latest", - "julia": "latest", - "elixir": "latest" + "swift": "latest" } } diff --git a/site/scripts/.probe-core-tabs.mjs b/site/scripts/.probe-core-tabs.mjs index 2b2757999..f90783402 100644 --- a/site/scripts/.probe-core-tabs.mjs +++ b/site/scripts/.probe-core-tabs.mjs @@ -1,8 +1,9 @@ +import { newCheckPage } from './browser-context.mjs' import { chromium } from 'playwright' const url = process.argv[2] ?? 'http://127.0.0.1:53972/' const browser = await chromium.launch() -const page = await browser.newPage({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }) +const page = await newCheckPage(browser, url, { viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }) await page.addInitScript(() => { window.__shifts = [] window.__phase = 'load' diff --git a/site/scripts/browser-context.mjs b/site/scripts/browser-context.mjs new file mode 100644 index 000000000..bf555a8a8 --- /dev/null +++ b/site/scripts/browser-context.mjs @@ -0,0 +1,113 @@ +/** Own a forwarding proxy per check context; redirects and route.fetch share its origin boundary. */ +import { once } from 'node:events' +import { Agent, createServer, request as httpRequest } from 'node:http' +import { connect } from 'node:net' +import { pipeline } from 'node:stream' + +async function proxyFor(base) { + const own = new URL(base) + const allowed = own.origin + const agent = new Agent({ keepAlive: true, maxSockets: 32 }) + const sockets = new Set() + const track = (socket) => { + if (sockets.has(socket)) return socket + sockets.add(socket) + socket.once('close', () => sockets.delete(socket)) + return socket + } + const targetFor = (raw, tunnel = false) => { + const target = new URL(tunnel ? `${own.protocol}//${raw}` : raw) + const origin = target.origin.replace(/^ws:/, 'http:').replace(/^wss:/, 'https:') + return origin === allowed ? target : undefined + } + const server = createServer((incoming, outgoing) => { + let target + try { target = targetFor(incoming.url) } catch {} + if (!target || target.protocol !== 'http:') { incoming.socket.destroy(); return } + const headers = { ...incoming.headers, host: target.host } + delete headers['proxy-connection'] + delete headers['proxy-authorization'] + const upstream = httpRequest(target, { method: incoming.method, headers, agent }, (response) => { + outgoing.writeHead(response.statusCode, response.headers) + pipeline(response, outgoing, (error) => { if (error) upstream.destroy() }) + }) + upstream.on('socket', track) + upstream.on('error', () => outgoing.destroy()) + incoming.on('error', () => upstream.destroy()) + incoming.on('aborted', () => upstream.destroy()) + outgoing.on('close', () => { if (!outgoing.writableFinished) upstream.destroy() }) + incoming.pipe(upstream) + }) + server.on('connection', track) + server.on('connect', (request, client, head) => { + let target + try { target = targetFor(request.url, true) } catch {} + if (!target) { client.destroy(); return } + const upstream = track(connect(Number(target.port || (own.protocol === 'https:' ? 443 : 80)), target.hostname)) + upstream.once('connect', () => { + client.write('HTTP/1.1 200 Connection Established\r\n\r\n') + if (head.length) upstream.write(head) + client.pipe(upstream).pipe(client) + }) + client.on('error', () => upstream.destroy()) + upstream.on('error', () => client.destroy()) + client.on('close', () => upstream.destroy()) + upstream.on('close', () => client.destroy()) + }) + server.on('upgrade', (request, client, head) => { + let target + try { target = targetFor(request.url) } catch {} + if (!target || !['http:', 'ws:'].includes(target.protocol)) { client.destroy(); return } + const upstream = track(connect(Number(target.port || 80), target.hostname)) + upstream.once('connect', () => { + const headers = Object.entries(request.headers).filter(([key]) => key !== 'proxy-connection') + .map(([key, value]) => `${key}: ${value}`).join('\r\n') + upstream.write(`${request.method} ${target.pathname}${target.search} HTTP/${request.httpVersion}\r\n${headers}\r\n\r\n`) + if (head.length) upstream.write(head) + client.pipe(upstream).pipe(client) + }) + client.on('error', () => upstream.destroy()) + upstream.on('error', () => client.destroy()) + client.on('close', () => upstream.destroy()) + upstream.on('close', () => client.destroy()) + }) + server.listen(0, '127.0.0.1') + await once(server, 'listening') + return { + server: `http://127.0.0.1:${server.address().port}`, + close() { + server.close() + agent.destroy() + for (const socket of sockets) socket.destroy() + }, + } +} + +async function mockForeignImages(context, base) { + const origin = new URL(base).origin + await context.route((url) => url.origin !== origin, (route) => route.request().resourceType() === 'image' + ? route.fulfill({ contentType: 'image/svg+xml', body: '' }) + : route.abort()) +} + +export async function newCheckContext(browser, base, options = {}) { + const proxy = await proxyFor(base) + let context + try { + context = await browser.newContext({ ...options, serviceWorkers: 'block', proxy: { server: proxy.server, bypass: '<-loopback>' } }) + context.once('close', () => proxy.close()) + await mockForeignImages(context, base) + return context + } catch (error) { proxy.close(); await context?.close().catch(() => {}); throw error } +} + +export async function newCheckPage(browser, base, options = {}) { + const proxy = await proxyFor(base) + let page + try { + page = await browser.newPage({ ...options, serviceWorkers: 'block', proxy: { server: proxy.server, bypass: '<-loopback>' } }) + page.context().once('close', () => proxy.close()) + await mockForeignImages(page.context(), base) + return page + } catch (error) { proxy.close(); await page?.close().catch(() => {}); throw error } +} diff --git a/site/scripts/check-badge-centring.mjs b/site/scripts/check-badge-centring.mjs index c566cf8ec..f7b52191f 100644 --- a/site/scripts/check-badge-centring.mjs +++ b/site/scripts/check-badge-centring.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { PNG } from 'pngjs' import { chromium } from 'playwright' @@ -590,7 +591,7 @@ export async function checkBadgeCentring(browser, base, { sample: bounded = fals const hi = await chromium.launch({ args: ['--force-device-scale-factor=2', '--window-size=1440,1000'] }) try { for (const [engine, factor] of [[browser, 1], [hi, 2]]) { - const context = await engine.newContext(factor === 1 ? { viewport: { width: 1440, height: 1000 }, reducedMotion: 'reduce' } : { viewport: null, reducedMotion: 'reduce' }) + const context = await newCheckContext(engine, base, factor === 1 ? { viewport: { width: 1440, height: 1000 }, reducedMotion: 'reduce' } : { viewport: null, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) // The first request for a reference page compiles it in the dev server, and the index and tool pages are large. @@ -616,7 +617,7 @@ export async function checkBadgeCentring(browser, base, { sample: bounded = fals * carries the mark and a later one is a plain link that keeps its kind. */ export async function checkMentionDensity(browser, base) { - const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } }) + const context = await newCheckContext(browser, base, { viewport: { width: 1440, height: 1000 } }) const page = await context.newPage() page.setDefaultNavigationTimeout(60000) try { @@ -666,7 +667,7 @@ const CHIP_PAGES = ['server', 'session', 'window', 'pane', 'client'].map((name) */ export async function checkChipGrowth(browser, base) { // The contents column, and the Related APIs in it, show from 85rem. - const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultNavigationTimeout(60000) const open = async (path) => { @@ -712,7 +713,7 @@ const USAGE = { list: '.tmux-usage', where: 'usage table', ink: true } * a chip squeezed by its qualifier and one chip moved onto another. */ export async function checkUsageChips(browser, base) { - const context = await browser.newContext({ viewport: { width: 1134, height: 900 } }) + const context = await newCheckContext(browser, base, { viewport: { width: 1134, height: 900 } }) const page = await context.newPage() page.setDefaultNavigationTimeout(60000) const ready = () => page.waitForFunction(() => document.documentElement.dataset.pageReadiness === 'ready', null, { timeout: 30000 }).catch(() => {}) diff --git a/site/scripts/check-browser-network.mjs b/site/scripts/check-browser-network.mjs new file mode 100644 index 000000000..f89b4d85c --- /dev/null +++ b/site/scripts/check-browser-network.mjs @@ -0,0 +1,193 @@ +import assert from 'node:assert/strict' +import { createHash } from 'node:crypto' +import { once } from 'node:events' +import { createServer } from 'node:http' +import { pathToFileURL } from 'node:url' +import { chromium } from 'playwright' +import { newCheckContext, newCheckPage } from './browser-context.mjs' + +/** A held image on another origin must never reach its server or delay load. */ +export async function checkBrowserNetwork(browser) { + let result = Promise.withResolvers() + let escaped = 0 + const foreign = createServer(() => { + // Deliberately leave this image response pending until fixture teardown. + }) + foreign.on('connection', () => { + escaped += 1 + result.resolve('escaped') + }) + foreign.listen(0, '127.0.0.1') + await once(foreign, 'listening') + const remote = `http://127.0.0.1:${foreign.address().port}` + let truncated + let pendingClosed = Promise.withResolvers() + const local = createServer((request, response) => { + if (['/truncated', '/pending'].includes(request.url)) { + response.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Content-Length': '65536', 'X-Content-Type-Options': 'nosniff' }) + response.write('x'.repeat(16384)) + if (request.url === '/truncated') truncated = response + else response.once('close', () => { pendingClosed.resolve(); local.emit('pending-closed') }) + } else if (request.url === '/release-truncated') { + response.end('released') + truncated.destroy() + } else if (request.url === '/pending-state') { + void pendingClosed.promise.then(() => { if (!response.destroyed) response.end('closed') }) + } else if (request.url === '/local.js') { + response.writeHead(200, { 'Content-Type': 'application/javascript' }) + response.end('window.localScript = true') + } else if (request.url === '/local.css') { + response.writeHead(200, { 'Content-Type': 'text/css' }) + response.end('h1 { color: rgb(1, 2, 3) }') + } else if (request.url === '/redirected.svg') { + response.writeHead(302, { Location: `${remote}/held.svg` }) + response.end() + } else { + response.writeHead(200, { 'Content-Type': 'text/html' }) + const image = request.url === '/redirect-case' ? '/redirected.svg' : `${remote}/held.svg` + response.end(`Local fixture

Local fixture

`) + } + }) + const localSockets = new Set() + local.on('connection', (socket) => { + localSockets.add(socket) + socket.once('close', () => localSockets.delete(socket)) + socket.on('error', () => socket.destroy()) + }) + local.on('upgrade', (request, socket) => { + const accept = createHash('sha1').update(request.headers['sec-websocket-key'] + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11').digest('base64') + socket.write(`HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ${accept}\r\n\r\n`) + socket.once('data', () => socket.end()) + }) + try { + local.listen(0, '127.0.0.1') + await once(local, 'listening') + const base = `http://127.0.0.1:${local.address().port}` + for (const factory of ['page', 'context', 'redirect', 'continued']) { + const page = factory === 'page' + ? await newCheckPage(browser, base, { viewport: { width: 640, height: 480 } }) + : await (await newCheckContext(browser, base, { viewport: { width: 640, height: 480 } })).newPage() + const context = page.context() + context.setDefaultNavigationTimeout(5000) + context.on('requestfailed', (request) => { + if (new URL(request.url()).origin === remote) result.resolve('blocked') + }) + context.on('response', (response) => { + if (new URL(response.url()).origin === remote) result.resolve('blocked') + }) + try { + if (factory === 'continued') await page.route('**/*', (route) => route.continue()) + result = Promise.withResolvers() + let loaded = false + const navigation = page.goto(base + (factory === 'redirect' ? '/redirect-case' : '/'), { waitUntil: 'load' }).then(() => { loaded = true }, (error) => { result.reject(error) }) + const outcome = await result.promise + if (outcome === 'escaped') assert.equal(loaded, false, 'The held image delays document load') + assert.equal(outcome, 'blocked', `${factory}: held image reached the foreign server`) + await navigation + assert.equal(await page.title(), 'Local fixture') + assert.deepEqual(await page.evaluate(() => [window.localScript, getComputedStyle(document.querySelector('h1')).color]), [true, 'rgb(1, 2, 3)']) + assert.equal(page.viewportSize().width, 640, 'Browser options survive the request policy') + if (['page', 'context'].includes(factory)) { + assert.equal(await page.evaluate(async () => { + await Promise.all(Array.from(document.images, (image) => image.decode())) + return document.images[0].naturalWidth + }), 1, 'Off-origin image fixtures decode without contacting their server') + } + if (factory === 'context') { + assert.equal(await page.evaluate((url) => new Promise((resolve, reject) => { + const socket = new WebSocket(url) + socket.onopen = () => { socket.close(); resolve('open') } + socket.onerror = () => reject(new Error('The owned server WebSocket did not open')) + }), base.replace('http:', 'ws:') + '/socket'), 'open') + result = Promise.withResolvers() + const incoming = page.waitForEvent('popup') + await page.evaluate(() => window.open('/popup')) + const popup = await incoming + assert.equal(await result.promise, 'blocked', 'Popup requests inherit the context policy') + await popup.waitForLoadState('load') + assert.equal(await popup.title(), 'Local fixture') + assert.equal(await popup.evaluate(async () => { await document.images[0].decode(); return document.images[0].naturalWidth }), 1) + await popup.close() + result = Promise.withResolvers() + const fetched = context.request.get(`${remote}/api`, { timeout: 1000 }) + .then(() => 'responded', () => 'blocked') + assert.equal(await Promise.race([result.promise, fetched]), 'blocked', 'Context request/fetch cannot escape through a decorator') + } + assert.equal(escaped, 0, 'No off-origin request reached the held-image server') + } finally { + if (factory === 'page') await page.close() + else await context.close() + } + } + const page = await newCheckPage(browser, base) + try { + await page.goto(base) + const truncation = await page.evaluate(async () => { + const controller = new AbortController() + const limit = setTimeout(() => controller.abort(), 1000) + try { + const response = await fetch('/truncated', { signal: controller.signal }) + const reader = response.body.getReader() + await reader.read() + await fetch('/release-truncated') + try { + let chunk = await reader.read() + while (!chunk.done) chunk = await reader.read() + return { failed: false } + } + catch { return { failed: true, deadline: controller.signal.aborted } } + } finally { clearTimeout(limit) } + }) + assert.deepEqual(truncation, { failed: true, deadline: false }, 'Truncated upstream fails before the fixture deadline') + pendingClosed = Promise.withResolvers() + assert.equal(await page.evaluate(async () => { + const controller = new AbortController() + const response = await fetch('/pending', { signal: controller.signal }) + await response.body.getReader().read() + controller.abort() + return (await fetch('/pending-state', { signal: AbortSignal.timeout(1000) })).text() + }), 'closed', 'Cancelling a client closes its owned upstream request') + } finally { await page.close() } + const context = await newCheckContext(browser, base) + try { + const page = await context.newPage() + await page.goto(base) + await page.evaluate(async () => { await (await fetch('/pending')).body.getReader().read() }) + await Promise.all([once(local, 'pending-closed', { signal: AbortSignal.timeout(1000) }), context.close()]) + } finally { await context.close() } + const before = browser.contexts().length + const failure = new Error('Image policy registration failed') + const broken = { + async newContext(options) { + const context = await browser.newContext(options) + context.route = async () => { throw failure } + return context + }, + async newPage(options) { + const page = await browser.newPage(options) + page.context().route = async () => { throw failure } + return page + }, + } + await assert.rejects(newCheckContext(broken, base), (error) => error === failure) + assert.equal(browser.contexts().length, before, 'Failed context policy registration closes its context') + await assert.rejects(newCheckPage(broken, base), (error) => error === failure) + assert.equal(browser.contexts().length, before, 'Failed page policy registration closes its context') + const driver = browser.browserType() + const closed = await driver.launch(driver.name() === 'chromium' ? { channel: process.env.LIBTMUX_DOCS_BROWSER_CHANNEL } : {}) + await closed.close() + await assert.rejects(newCheckContext(closed, base)) + await assert.rejects(newCheckPage(closed, base)) + console.log('Browser network: local assets load; off-origin images, redirects, decorators and popup requests cannot escape') + } finally { + local.closeAllConnections() + foreign.closeAllConnections() + for (const socket of localSockets) socket.destroy() + await Promise.all([new Promise((resolve) => local.close(resolve)), new Promise((resolve) => foreign.close(resolve))]) + } +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + const browser = await chromium.launch() + try { await checkBrowserNetwork(browser) } finally { await browser.close() } +} diff --git a/site/scripts/check-clipboard.mjs b/site/scripts/check-clipboard.mjs index caecd5fbf..da8a2cec6 100644 --- a/site/scripts/check-clipboard.mjs +++ b/site/scripts/check-clipboard.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' import { createHash } from 'node:crypto' import { readFileSync } from 'node:fs' @@ -36,7 +37,7 @@ export function assertCompleteApiExample(rendered, example) { /** Inspect rendered API examples against their native execution receipts. */ export async function checkCompleteApiExamples(browser, base) { const examples = JSON.parse(readFileSync(new URL('../test/fixtures/api-examples.json', import.meta.url), 'utf8')).examples - const page = await browser.newPage() + const page = await newCheckPage(browser, base) try { for (const example of examples) { const path = example.page.replace(`ports/${example.port}/`, `${example.port}/latest/`) @@ -217,7 +218,7 @@ export async function checkClipboard(page, base) { if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { const browser = await chromium.launch() try { - const page = await browser.newPage() + const page = await newCheckPage(browser, base) page.setDefaultTimeout(1000) await checkClipboard(page, (process.argv[2] ?? 'http://localhost:8080/en').replace(/\/$/, '')) } finally { diff --git a/site/scripts/check-color-scheme.mjs b/site/scripts/check-color-scheme.mjs index 78288b657..9a700fa22 100644 --- a/site/scripts/check-color-scheme.mjs +++ b/site/scripts/check-color-scheme.mjs @@ -1,12 +1,13 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** Compact cycling and wide radios share the same saved preference. */ export async function checkColorScheme(browser, base) { for (const blocked of [false, true]) { - const context = await browser.newContext({ viewport: { width: 596, height: 777 }, colorScheme: 'light', reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 596, height: 777 }, colorScheme: 'light', reducedMotion: 'reduce' }) try { if (blocked) { - await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) + await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => new URL(route.request().url()).origin !== new URL(base).origin ? route.fallback() : route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) await context.addInitScript(() => Object.defineProperty(window, 'localStorage', { get() { throw new DOMException('Storage blocked', 'SecurityError') }, })) @@ -58,7 +59,7 @@ export async function checkColorScheme(browser, base) { await context.close() } } - const reader = await browser.newContext({ viewport: { width: 1062, height: 789 }, colorScheme: 'light', reducedMotion: 'reduce' }) + const reader = await newCheckContext(browser, base, { viewport: { width: 1062, height: 789 }, colorScheme: 'light', reducedMotion: 'reduce' }) try { const page = await reader.newPage() await page.goto(`${base}/code-tabs-probe/`) @@ -99,7 +100,7 @@ export async function checkColorScheme(browser, base) { } finally { await reader.close() } - const context = await browser.newContext({ javaScriptEnabled: false, viewport: { width: 596, height: 777 } }) + const context = await newCheckContext(browser, base, { javaScriptEnabled: false, viewport: { width: 596, height: 777 } }) try { const page = await context.newPage() await page.goto(`${base}/`) diff --git a/site/scripts/check-dev-sample.mjs b/site/scripts/check-dev-sample.mjs index f46b57c78..561c2733e 100644 --- a/site/scripts/check-dev-sample.mjs +++ b/site/scripts/check-dev-sample.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { checkHomeResponsiveLayout } from './check-home-launcher.mjs' import { checkPickerFilters } from './check-picker-filters.mjs' @@ -96,7 +97,7 @@ function revealedContrast(id) { export async function checkRowPermalinks(browser, base, pages = ROW_PERMALINK_PAGES) { let rows = 0 for (const colorScheme of ['light', 'dark']) { - const context = await browser.newContext({ colorScheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { colorScheme, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { @@ -174,7 +175,7 @@ export async function checkDevSample(browser, base) { await checkKindBadgeLinks(browser, base, { sample: true }) await checkBlockLinksUndecorated(browser, base, { sample: true }) await checkTmuxKeys(browser, base) - const context = await browser.newContext({ reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce' }) const page = await context.newPage() const errors = [] page.on('pageerror', (error) => errors.push(error.message)) diff --git a/site/scripts/check-dev.mjs b/site/scripts/check-dev.mjs index e07ac0cf3..4b5dbea2d 100644 --- a/site/scripts/check-dev.mjs +++ b/site/scripts/check-dev.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckContext, newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs' import { join } from 'node:path' @@ -24,6 +25,7 @@ import { checkBlockLinksUndecorated, checkKindBadgeLinks, checkKindBadgeLinksFai import { checkTypeParameters } from './check-type-parameters.mjs' import { checkTmuxKeys, TMUX_KEY_PAGES } from './check-tmux-keys.mjs' import { checkSidebarDemo } from './check-sidebar-demo.mjs' +import { checkGuideRedirect } from './check-navigation.mjs' const apiNavigationOnly = process.argv.includes('--api-navigation') const apiAnchorsOnly = process.argv.includes('--api-anchors') @@ -53,6 +55,7 @@ assert(requestedBrowserPort === undefined || /^\d+$/.test(requestedBrowserPort) && Number(requestedBrowserPort) >= 1 && Number(requestedBrowserPort) <= 65535, 'LIBTMUX_DOCS_BROWSER_PORT must be an integer from 1 to 65535') const documentationNavigationOnly = process.argv.includes('--documentation-navigation') +const guideRedirectOnly = process.argv.includes('--guide-redirect') const workspacePortCount = PORTS.filter((port) => productAvailable(port, 'workspace')).length Object.assign(process.env, { @@ -307,7 +310,7 @@ async function retryReload(check, page) { } async function checkSignatureLayouts(browser, base) { - const page = await browser.newPage({ javaScriptEnabled: false }) + const page = await newCheckPage(browser, base, { javaScriptEnabled: false }) try { await page.goto(`${base}/api-signature-probe/`, { waitUntil: 'load' }) const entries = page.locator('[data-signature-port]') @@ -448,7 +451,7 @@ async function checkSignatureLayouts(browser, base) { async function checkKeywordHelp(browser, base) { const fullMatrix = apiSignaturesOnly || keywordHelpOnly for (const javaScriptEnabled of [false, true]) { - const page = await browser.newPage({ javaScriptEnabled }) + const page = await newCheckPage(browser, base, { javaScriptEnabled }) const errors = [] page.on('pageerror', (error) => errors.push(error.message)) page.setDefaultTimeout(5000) @@ -540,7 +543,7 @@ async function checkMemberBodies(browser, base) { } async function checkReferenceAndHeroes(browser, base) { - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { await page.goto(`${base}/api-body-probe/`) @@ -785,6 +788,7 @@ try { // Compile the initial pages during setup; navigation assertions measure // the running app. The outer loop still budgets this initial compilation. const firstPage = homeLauncherOnly || homeControlsOnly ? '/' + : guideRedirectOnly ? '/ruby/latest/guides/overview/' : keywordHelpOnly ? '/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/' : apiStickyOnly || permalinkRevealOnly ? '/swift/latest/reference/server/' : badgeCentringOnly ? '/py/v0.46.2/guides/attaching-to-tmux/' @@ -793,7 +797,7 @@ try { : apiNavigationOnly ? '/lua/latest/reference/libtmux-server/' : typeParametersOnly ? '/ts/latest/reference/selection-selection-where/' : '/tmux/concepts/server-session-window-pane/' const fullRun = ![homeLauncherOnly, homeControlsOnly, keywordHelpOnly, apiSignaturesOnly, referenceLayoutOnly, globalHeaderOnly, headerMenuSectionsOnly, statusBadgesOnly, badgeCentringOnly, referencePreviewsOnly, - referencePreferencesOnly, documentationNavigationOnly, apiNavigationOnly, apiAnchorsOnly, typeParametersOnly, permalinkRevealOnly, requiredAppearanceOnly].some(Boolean) + referencePreferencesOnly, documentationNavigationOnly, guideRedirectOnly, apiNavigationOnly, apiAnchorsOnly, typeParametersOnly, permalinkRevealOnly, requiredAppearanceOnly].some(Boolean) const setupPages = sampleOnly ? [firstPage, '/demo/widgets/pickers/', ...TMUX_KEY_PAGES] : [firstPage, ...(fullRun ? TMUX_KEY_PAGES : [])] const ready = Promise.all(setupPages.map(async (path) => { @@ -863,10 +867,12 @@ try { } else if (referencePreferencesOnly) { await retryReload(() => checkReferencePreferences(browser, base)) await retryReload(() => checkGlobalHeader(browser, base)) + } else if (guideRedirectOnly) { + await checkGuideRedirect(browser, base) } else if (documentationNavigationOnly) { await retryReload(() => checkDocumentationNavigation(browser, base, true)) } else if (apiNavigationOnly) { - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) await retryReload(() => checkApiNavigation(page, base)) await checkApiNavigationFail(browser, base) @@ -912,15 +918,15 @@ try { // Cold API indexes occupy the same development server as the page walk. // Finish that initial compilation before starting timed browser navigation. await apiExamples - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const manifest = await page.request.get(`${base}/page-links.json`) assert(manifest.ok(), `Native navigation manifest: HTTP ${manifest.status()}`) assert.equal((await manifest.json()).schema, 1) - const clipboardPage = await browser.newPage() + const clipboardPage = await newCheckPage(browser, base) clipboardPage.setDefaultTimeout(process.env.CI ? 20000 : 10000) const clipboard = schedule(() => checkClipboard(clipboardPage, base).finally(() => clipboardPage.close())) - const navigationPage = await browser.newPage({ reducedMotion: 'reduce' }) + const navigationPage = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) navigationPage.setDefaultTimeout(process.env.CI ? 20000 : 10000) const navigation = schedule(() => retryReload(() => checkNavigation(navigationPage, base)).finally(() => navigationPage.close()) .then(() => retryReload(() => checkMcpInstallRevisit(browser, base)))) @@ -938,7 +944,7 @@ try { .then(() => checkStatusBadgesFail(browser, base))) const homeLauncher = schedule(() => checkHomeLauncher(browser, base)) const documentationNavigation = schedule(() => retryReload(() => checkDocumentationNavigation(browser, base))) - const apiNavigationPage = await browser.newPage({ reducedMotion: 'reduce' }) + const apiNavigationPage = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) apiNavigationPage.setDefaultTimeout(process.env.CI ? 20000 : 10000) const apiNavigation = schedule(() => retryReload(() => checkApiNavigation(apiNavigationPage, base)).then(() => checkApiNavigationFail(browser, base)).finally(() => apiNavigationPage.close())) const apiAnchors = schedule(() => retryReload(() => checkApiAnchorArrival(browser, base))) @@ -1196,7 +1202,7 @@ try { }) assert.equal(toolbar.background, toolbar.page, `${colorScheme}: toolbar uses the page surface before theme initialization`) assert.equal(toolbar.icon, toolbar.text, `${colorScheme}: toolbar icons use the page text color`) - const context = await browser.newContext({ javaScriptEnabled: false, colorScheme, viewport: { width: 390, height: 844 } }) + const context = await newCheckContext(browser, base, { javaScriptEnabled: false, colorScheme, viewport: { width: 390, height: 844 } }) const noScript = await context.newPage() await noScript.goto(`${base}/tmux/concepts/server-session-window-pane/`, { waitUntil: 'load' }) const checkContrast = async (scheme, selectors = ['h1', '.prose h2', '.prose p']) => { diff --git a/site/scripts/check-fonts.mjs b/site/scripts/check-fonts.mjs index da8033c40..770b3351b 100755 --- a/site/scripts/check-fonts.mjs +++ b/site/scripts/check-fonts.mjs @@ -22,6 +22,7 @@ * * Usage: node scripts/check-fonts.mjs [--site DIR] [--url BASE] [--json] */ +import { newCheckPage } from './browser-context.mjs' import { existsSync, readFileSync } from 'node:fs' import { globSync } from 'node:fs' import { dirname, join, resolve } from 'node:path' @@ -169,7 +170,7 @@ try { const browser = await chromium.launch() usage = [] for (const [name, path, ours] of ARCHETYPES) { - const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }) + const page = await newCheckPage(browser, BASE, { viewport: { width: 1440, height: 900 } }) const response = await page.goto(BASE + path, { waitUntil: 'networkidle' }).catch(() => null) if (!response?.ok()) { failures.push(`${name}: ${path} returned ${response?.status() ?? 'no response'}`) diff --git a/site/scripts/check-header-menu-sections.mjs b/site/scripts/check-header-menu-sections.mjs index 2a384e772..dbbb6d2a6 100644 --- a/site/scripts/check-header-menu-sections.mjs +++ b/site/scripts/check-header-menu-sections.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** @@ -252,7 +253,7 @@ export async function checkHeaderMenuSections(browser, base, options = {}) { kinds = KINDS, behavior = true, sabotage } = options let menus = 0 for (const scheme of schemes) { - const context = await browser.newContext({ colorScheme: scheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { colorScheme: scheme, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) // The first load of each port compiles its page in the development server. diff --git a/site/scripts/check-home-example-options.mjs b/site/scripts/check-home-example-options.mjs index 7622c8e2e..e83bef817 100644 --- a/site/scripts/check-home-example-options.mjs +++ b/site/scripts/check-home-example-options.mjs @@ -1,13 +1,14 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { PORTS } from '../src/lib/ports.ts' import { chooseHomeTask } from './check-home-task-reset.mjs' export async function checkHomeExampleOptions(browser, base) { for (const blocked of [false, true]) { - const context = await browser.newContext({ viewport: { width: 944, height: 777 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 944, height: 777 }, reducedMotion: 'reduce' }) try { if (blocked) { - await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) + await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => new URL(route.request().url()).origin !== new URL(base).origin ? route.fallback() : route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) await context.addInitScript(() => Object.defineProperty(window, 'localStorage', { get() { throw new DOMException('Storage blocked', 'SecurityError') }, })) diff --git a/site/scripts/check-home-hover.mjs b/site/scripts/check-home-hover.mjs index c89b4b734..3b42e7e47 100644 --- a/site/scripts/check-home-hover.mjs +++ b/site/scripts/check-home-hover.mjs @@ -1,9 +1,10 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { PORTS } from '../src/lib/ports.ts' /** Real pointer events, with the clock advanced instead of sleeping per option. */ export async function checkHomeHover(browser, base) { - const context = await browser.newContext({ viewport: { width: 914, height: 777 }, colorScheme: 'light', reducedMotion: 'no-preference' }) + const context = await newCheckContext(browser, base, { viewport: { width: 914, height: 777 }, colorScheme: 'light', reducedMotion: 'no-preference' }) const page = await context.newPage() const errors = [] page.on('pageerror', (error) => errors.push(error.message)) diff --git a/site/scripts/check-home-launcher.mjs b/site/scripts/check-home-launcher.mjs index 0f14ca68c..b23844476 100644 --- a/site/scripts/check-home-launcher.mjs +++ b/site/scripts/check-home-launcher.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { PORTS } from '../src/lib/ports.ts' import HOME_PROOF from '../test/fixtures/home-examples.json' with { type: 'json' } @@ -119,7 +120,7 @@ async function checkSolutionHome(page, solution, port) { /** Exercise the real homepage, including the prompt controlled by its picker. */ export async function checkHomeLauncher(browser, base) { - const context = await browser.newContext({ reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const errors = [] @@ -375,10 +376,10 @@ export async function checkHomeLauncher(browser, base) { } finally { await context.close() } - const blockedStorage = await browser.newContext() + const blockedStorage = await newCheckContext(browser, base) try { // Astro's development toolbar reads storage unguarded; it is absent from published pages. - await blockedStorage.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) + await blockedStorage.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => new URL(route.request().url()).origin !== new URL(base).origin ? route.fallback() : route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) await blockedStorage.addInitScript(() => Object.defineProperty(window, 'localStorage', { get() { throw new DOMException('Storage blocked', 'SecurityError') }, })) @@ -399,7 +400,7 @@ export async function checkHomeLauncher(browser, base) { } finally { await blockedStorage.close() } - const noScript = await browser.newContext({ javaScriptEnabled: false, viewport: { width: 390, height: 777 } }) + const noScript = await newCheckContext(browser, base, { javaScriptEnabled: false, viewport: { width: 390, height: 777 } }) try { const page = await noScript.newPage() await page.goto(`${base}/`) diff --git a/site/scripts/check-home-task-reset.mjs b/site/scripts/check-home-task-reset.mjs index 76cb8ba2a..a946b9374 100644 --- a/site/scripts/check-home-task-reset.mjs +++ b/site/scripts/check-home-task-reset.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' async function checkTaskFirstPaint(browser, base) { @@ -7,16 +8,19 @@ async function checkTaskFirstPaint(browser, base) { { slug: 'v0.1.0-alpha.12', label: 'v0.1.0-alpha.12', kind: 'prerelease', supported: true }, ] } } for (const width of [853, 390, 280]) { - const context = await browser.newContext({ viewport: { width, height: 789 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width, height: 789 }, reducedMotion: 'reduce' }) let releaseWidget const widgetReady = new Promise((resolve) => { releaseWidget = resolve }) try { - await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) + await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => new URL(route.request().url()).origin === new URL(base).origin + ? route.fulfill({ contentType: 'application/javascript', body: 'export {}' }) : route.fallback()) await context.route('**/*AgentPrompt*', async (route) => { + if (new URL(route.request().url()).origin !== new URL(base).origin) return route.fallback() if (route.request().resourceType() === 'script') await widgetReady - await route.continue() + await route.fallback() }) - await context.route('**/versions.json', (route) => route.fulfill({ json: versions })) + await context.route('**/versions.json', (route) => new URL(route.request().url()).origin === new URL(base).origin + ? route.fulfill({ json: versions }) : route.fallback()) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const response = await page.goto(`${base}/?port=ts&errors=1&cleanup=1`, { waitUntil: 'commit' }) @@ -72,10 +76,11 @@ export async function chooseHomeTask(page, topic) { export async function checkHomeTaskReset(browser, base) { await checkTaskFirstPaint(browser, base) for (const blocked of [false, true]) { - const context = await browser.newContext({ viewport: { width: 914, height: 777 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 914, height: 777 }, reducedMotion: 'reduce' }) try { if (blocked) { - await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => route.fulfill({ contentType: 'application/javascript', body: 'export {}' })) + await context.route('**/astro/runtime/client/dev-toolbar/entrypoint.js', (route) => new URL(route.request().url()).origin === new URL(base).origin + ? route.fulfill({ contentType: 'application/javascript', body: 'export {}' }) : route.fallback()) await context.addInitScript(() => Object.defineProperty(window, 'localStorage', { get() { throw new DOMException('Storage blocked', 'SecurityError') }, })) diff --git a/site/scripts/check-language-icon-scheme.mjs b/site/scripts/check-language-icon-scheme.mjs index afff84c3f..7971c04ad 100644 --- a/site/scripts/check-language-icon-scheme.mjs +++ b/site/scripts/check-language-icon-scheme.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { PNG } from 'pngjs' @@ -56,7 +57,7 @@ export function readPlate(buffer) { async function readIcon(browser, url, icon, { device, site, css, replacement, forced = false, read = readMark }) { // A null site is a visit without JavaScript: no saved choice, so the page follows the device. - const context = await browser.newContext({ colorScheme: device, forcedColors: forced ? 'active' : 'none', reducedMotion: 'reduce', javaScriptEnabled: site !== null, viewport: { width: 1280, height: 777 } }) + const context = await newCheckContext(browser, url, { colorScheme: device, forcedColors: forced ? 'active' : 'none', reducedMotion: 'reduce', javaScriptEnabled: site !== null, viewport: { width: 1280, height: 777 } }) try { if (site !== null) await context.addInitScript((choice) => localStorage.setItem('color-scheme', choice), site) // Added before the page parses, so an image is first drawn with it. @@ -66,7 +67,7 @@ async function readIcon(browser, url, icon, { device, site, css, replacement, fo else new MutationObserver((_, observer) => { if (document.documentElement) { observer.disconnect(); add() } }).observe(document, { childList: true }) }, css) const page = await context.newPage() - if (replacement) await page.route('**/brand/languages/rs/icon.svg', (route) => route.fulfill({ contentType: 'image/svg+xml', body: replacement })) + if (replacement) await page.route('**/brand/languages/rs/icon.svg', (route) => new URL(route.request().url()).origin !== new URL(url).origin ? route.fallback() : route.fulfill({ contentType: 'image/svg+xml', body: replacement })) await page.goto(url) const image = page.locator(icon) await image.waitFor({ state: 'visible' }) diff --git a/site/scripts/check-mobile-nav.mjs b/site/scripts/check-mobile-nav.mjs index 8a1679183..840d45e8a 100755 --- a/site/scripts/check-mobile-nav.mjs +++ b/site/scripts/check-mobile-nav.mjs @@ -21,6 +21,7 @@ * * Usage: node scripts/check-mobile-nav.mjs [base-url] */ +import { newCheckContext } from './browser-context.mjs' import { chromium } from 'playwright' import { checkApiNavigation } from './check-navigation.mjs' const BASE = (process.argv[2] ?? 'http://localhost:8080').replace(/\/$/, '') @@ -28,7 +29,7 @@ const b = await chromium.launch() const fails = [], ok = [] const note = (pass, msg) => (pass ? ok : fails).push(msg) const WITH_TOC = '/tmux/topics/traversal/', NO_TOC = '/tmux/concepts/' -const ctx = await b.newContext() +const ctx = await newCheckContext(b, BASE) const apiPage = await ctx.newPage() try { await checkApiNavigation(apiPage, BASE) diff --git a/site/scripts/check-native-layout.mjs b/site/scripts/check-native-layout.mjs index 76f476f0e..2aeb6f02c 100644 --- a/site/scripts/check-native-layout.mjs +++ b/site/scripts/check-native-layout.mjs @@ -1,3 +1,4 @@ +import { newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' /** Controls beside a signature may sit this far from the centre of its first line. */ @@ -198,7 +199,7 @@ const DECLARATION_SAMPLES = [ * names, or the check would pass without measuring anything. */ export async function checkDeclarationControlAlignment(browser, base, widths = [1440, 768, 500, 390]) { - const page = await browser.newPage({ javaScriptEnabled: false }) + const page = await newCheckPage(browser, base, { javaScriptEnabled: false }) const beside = new Map(widths.map((width) => [width, 0])) const measured = [] try { @@ -363,7 +364,8 @@ export async function checkNativeFirstPaint(page, url) { const delayedScript = new Promise((resolve) => { release = resolve }) const pendingRoutes = [] const routeScript = (route) => { - const pending = delayedScript.then(() => route.continue()) + if (new URL(route.request().url()).origin !== new URL(url).origin) return route.fallback() + const pending = delayedScript.then(() => route.fallback()) pendingRoutes.push(pending) return pending } @@ -480,7 +482,7 @@ const MEMBER_BODY_PAGES = [ /** A body's padding alone sets its inset: top and bottom match each other and the padding. */ export async function checkMemberBodyInsets(browser, base) { const tolerance = 1 - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const failures = [] let measured = 0 diff --git a/site/scripts/check-native-navigation.mjs b/site/scripts/check-native-navigation.mjs index 8d1f2f6ba..937b5cbee 100644 --- a/site/scripts/check-native-navigation.mjs +++ b/site/scripts/check-native-navigation.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { chromium } from 'playwright' @@ -103,7 +104,7 @@ async function checkMetadata(page) { try { for (const [width, colorScheme, reducedMotion] of [[1027, 'light', 'no-preference'], [390, 'dark', 'reduce']]) { - const context = await browser.newContext({ viewport: { width, height: 900 }, colorScheme, reducedMotion, permissions: ['clipboard-read', 'clipboard-write'] }) + const context = await newCheckContext(browser, base, { viewport: { width, height: 900 }, colorScheme, reducedMotion, permissions: ['clipboard-read', 'clipboard-write'] }) try { const page = await context.newPage() const errors = [], documents = [] @@ -159,7 +160,7 @@ try { } finally { await context.close() } } for (const width of [1027, 390]) { - const context = await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width, height: 900 }, reducedMotion: 'reduce' }) try { const page = await context.newPage() const current = 'internals/api/libtmux._internal.query_list/' @@ -172,7 +173,7 @@ try { } finally { await context.close() } } for (const javaScriptEnabled of [false, true]) { - const context = await browser.newContext({ javaScriptEnabled, viewport: { width: 1027, height: 1450 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { javaScriptEnabled, viewport: { width: 1027, height: 1450 }, reducedMotion: 'reduce' }) try { const page = await context.newPage() await page.goto(root) diff --git a/site/scripts/check-native-shell.mjs b/site/scripts/check-native-shell.mjs index a961d2f01..c975032cc 100644 --- a/site/scripts/check-native-shell.mjs +++ b/site/scripts/check-native-shell.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckContext, newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' import { chromium } from 'playwright' import { checkNativeFirstPaint, checkNativeHeader } from './check-native-layout.mjs' @@ -8,7 +9,7 @@ const version = process.argv.find((arg) => arg.startsWith('--version='))?.slice( const browser = await chromium.launch({ channel: process.env.LIBTMUX_DOCS_BROWSER_CHANNEL }) try { for (const javaScriptEnabled of [true, false]) { - const context = await browser.newContext({ javaScriptEnabled, reducedMotion: 'reduce', viewport: { width: 390, height: 900 } }) + const context = await newCheckContext(browser, base, { javaScriptEnabled, reducedMotion: 'reduce', viewport: { width: 390, height: 900 } }) try { const page = await context.newPage() const id = 'libtmux._internal.query_list.QueryList' @@ -24,7 +25,7 @@ try { await context.close() } } - const page = await browser.newPage() + const page = await newCheckPage(browser, base) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const loaded = new Set() page.on('response', (response) => { diff --git a/site/scripts/check-navigation.mjs b/site/scripts/check-navigation.mjs index be7df6b38..9254c7e59 100644 --- a/site/scripts/check-navigation.mjs +++ b/site/scripts/check-navigation.mjs @@ -1,3 +1,5 @@ +import { newCheckContext, newCheckPage } from './browser-context.mjs' +import { checkBrowserNetwork } from './check-browser-network.mjs' import assert from 'node:assert/strict' import { PORTS, productAvailable, productStatus } from '../src/lib/ports.ts' import registry from '../src/data/registry.json' with { type: 'json' } @@ -7,9 +9,28 @@ import { checkPickerFilters } from './check-picker-filters.mjs' /** The version the dev build mounts a port's prose pages at: its default, as check-dev sets it. */ const defaultVersion = (port) => JSON.parse(process.env.LIBTMUX_DOCS_PORT_DEFAULTS || '{}')[port] ?? 'latest' +/** A legacy guide loads with third-party requests blocked by its context. */ +export async function checkGuideRedirect(browser, base) { + await checkBrowserNetwork(browser) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) + page.setDefaultTimeout(process.env.CI ? 20000 : 10000) + try { + await page.goto(`${base}/ruby/latest/guides/overview/`, { waitUntil: 'load' }) + await page.waitForURL(`${base}/ruby/latest/guides/getting-started/`, { waitUntil: 'load' }) + await page.locator('html[data-page-readiness="ready"]').waitFor({ state: 'attached' }) + assert.equal((await page.locator('main h1').textContent()).trim(), 'Getting started') + assert(await page.locator('main h1').isVisible(), 'The loaded guide is readable') + assert.equal(await page.title(), 'Getting started | libtmux-ruby') + assert.equal(await page.evaluate(() => document.readyState), 'complete') + console.log('Guide redirect: the legacy Ruby URL loads its article without third-party requests') + } finally { + await page.close() + } +} + /** Optional scripts injected at the end of the body cannot gate navigation. */ export async function checkNavigationBeforeAnalytics(browser, base) { - const page = await browser.newPage({ viewport: { width: 390, height: 900 }, reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { viewport: { width: 390, height: 900 }, reducedMotion: 'reduce' }) page.setDefaultTimeout(5000) await page.clock.install({ time: 0 }) await page.clock.pauseAt(1000) @@ -178,7 +199,7 @@ export async function checkDocumentationNavigation(browser, base, complete = fal await checkPickerFilters(browser, base, complete) await checkNavigationBeforeAnalytics(browser, base) const ports = complete ? PORTS : PORTS.filter((port) => ['fsharp', 'ruby'].includes(port.slug)) - const page = await browser.newPage({ viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { viewport: { width: 1440, height: 900 }, reducedMotion: 'reduce' }) page.setDefaultTimeout(process.env.CI ? 20000 : 10000) await observeInitialPageLoad(page) const desktopPicker = (reader) => reader.locator('[data-documentation-context] [data-surface-picker]') @@ -297,8 +318,7 @@ export async function checkDocumentationNavigation(browser, base, complete = fal await page.waitForURL(`${base}/fsharp/latest/reference/?from=bookmark`) assert.equal((await page.locator('main h1').textContent()).trim(), 'API reference') assert.equal(await page.title(), 'F# API reference | libtmux-fsharp') - await page.goto(`${base}/ruby/latest/guides/overview/`, { waitUntil: 'load' }) - await page.waitForURL(`${base}/ruby/latest/guides/getting-started/`) + await checkGuideRedirect(browser, base) console.log(`Documentation surfaces: ${ports.length} ports retain real section links; Ruby/F# setup, cards and legacy links pass`) } finally { await page.close() @@ -307,7 +327,7 @@ export async function checkDocumentationNavigation(browser, base, complete = fal if (!complete) return for (const javaScriptEnabled of [true, false]) { for (const colorScheme of ['light', 'dark']) { - const context = await browser.newContext({ javaScriptEnabled, colorScheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { javaScriptEnabled, colorScheme, reducedMotion: 'reduce' }) const reader = await context.newPage() reader.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { @@ -540,7 +560,7 @@ export async function checkApiNavigation(page, base, { sabotage } = {}) { const nav = document.querySelector('.api-nav') sessionStorage.removeItem(`libtmux:api-tree:${nav.dataset.base}`) }) - await page.route('**/tree.json', (route) => route.fulfill({ status: 503, body: 'Unavailable' })) + await page.route('**/tree.json', (route) => new URL(route.request().url()).origin !== new URL(base).origin ? route.fallback() : route.fulfill({ status: 503, body: 'Unavailable' })) await page.reload({ waitUntil: 'commit' }) await page.waitForFunction(() => window.__docsPageLoaded) await page.locator('[data-api-nav-toggle]').click() @@ -604,7 +624,7 @@ export async function checkApiNavigation(page, base, { sabotage } = {}) { await page.keyboard.press('Escape') assert.equal(await page.locator('.api-nav').evaluate((nav) => nav.inert), true, 'The CLI drawer dismisses with Escape') await page.setViewportSize({ width: 1440, height: 900 }) - await page.route('**/tree.json', (route) => route.fulfill({ status: 503, body: 'Unavailable' })) + await page.route('**/tree.json', (route) => new URL(route.request().url()).origin !== new URL(base).origin ? route.fallback() : route.fulfill({ status: 503, body: 'Unavailable' })) await page.goto(`${base}/lua/latest/reference/`, { waitUntil: 'commit' }) await page.waitForFunction(() => window.__docsPageLoaded) assert.equal(await page.locator('.api-nav__tree [role="treeitem"][tabindex="0"]').count(), 1, 'The server-rendered index remains keyboard reachable when its inventory cannot load') @@ -615,7 +635,7 @@ export async function checkApiNavigation(page, base, { sabotage } = {}) { /** Public symbol fragments and earlier declaration links reach the same bar. */ export async function checkApiAnchorArrival(browser, base) { const paths = new Set([`${base}/py/latest/reference/libtmux-_internal-query_list-querylist/`]) - const catalog = await browser.newPage() + const catalog = await newCheckPage(browser, base) try { for (const port of PORTS) { await catalog.goto(`${base}/${port.slug}/latest/reference/`, { waitUntil: 'load' }) @@ -630,7 +650,7 @@ export async function checkApiAnchorArrival(browser, base) { [390, 'light', true], [1280, 'dark', true], [390, 'dark', false], [1280, 'light', false], ]) { - const context = await browser.newContext({ viewport: { width, height: 1000 }, colorScheme, + const context = await newCheckContext(browser, base, { viewport: { width, height: 1000 }, colorScheme, javaScriptEnabled, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) @@ -688,7 +708,7 @@ export async function checkPermalinkReveal(browser, base, { only, sabotage } = { ['a parameter line', 'ul.api-parameters > li[id] > p > a.api-heading-link']]], ] const open = async (options) => { - const context = await browser.newContext({ reducedMotion: 'reduce', ...options }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', ...options }) if (sabotage?.css) await context.addInitScript((css) => document.addEventListener('DOMContentLoaded', () => { document.head.append(Object.assign(document.createElement('style'), { textContent: css })) }), sabotage.css) @@ -921,7 +941,7 @@ export async function checkPermalinkRevealFail(browser, base) { /** The control for `checkApiNavigation`: a drawer whose close button does nothing must fail it. */ export async function checkApiNavigationFail(browser, base) { - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) try { await assert.rejects(() => checkApiNavigation(page, base, { sabotage: () => { document.addEventListener('click', (event) => { @@ -937,7 +957,7 @@ export async function checkApiNavigationFail(browser, base) { * style to the page, for the control below. */ export async function checkReferenceSidebarBounds(browser, base, { sabotage } = {}) { - const page = await browser.newPage({ viewport: { width: 1233, height: 1220 }, reducedMotion: 'reduce', colorScheme: 'dark' }) + const page = await newCheckPage(browser, base, { viewport: { width: 1233, height: 1220 }, reducedMotion: 'reduce', colorScheme: 'dark' }) try { await page.goto(`${base}/tmux/latest/manual/#options`) await page.locator('html[data-page-readiness="ready"]').waitFor() @@ -998,7 +1018,7 @@ export async function checkApiStickyHeadings(browser, base, { only, sabotage } = const timeout = process.env.CI ? 20000 : 10000 const wants = (scenario) => !only || only.includes(scenario) const open = async (viewport) => { - const context = await browser.newContext({ viewport }) + const context = await newCheckContext(browser, base, { viewport }) if (sabotage?.script) await context.addInitScript(sabotage.script) const page = await context.newPage() page.setDefaultTimeout(timeout) @@ -1354,7 +1374,7 @@ export async function checkNavigation(page, base) { await page.goto(`${legacy}?from=legacy#where-this-comes-from`, { waitUntil: 'load' }) await page.waitForURL(`${current}?from=legacy#where-this-comes-from`) assert.equal(await page.locator('#where-this-comes-from').count(), 1, 'Legacy section still exists') - const fallback = await page.context().browser().newContext({ javaScriptEnabled: false }) + const fallback = await newCheckContext(page.context().browser(), base, { javaScriptEnabled: false }) try { const reader = await fallback.newPage() await reader.goto(legacy, { waitUntil: 'load' }) @@ -1386,7 +1406,7 @@ export async function checkApiExampleOwnership(page, base, path = 'ts/latest/ref * attributes that snippet set on , so the widget has to restore them. */ export async function checkMcpInstallRevisit(browser, base) { - const page = await browser.newPage({ reducedMotion: 'reduce' }) + const page = await newCheckPage(browser, base, { reducedMotion: 'reduce' }) try { const shown = () => page.evaluate(() => [...document.querySelectorAll('.lm-mcp-install__panel')] .filter((panel) => panel.checkVisibility()).length) diff --git a/site/scripts/check-page-readiness.mjs b/site/scripts/check-page-readiness.mjs index 81a6ef95e..d49f7ba71 100644 --- a/site/scripts/check-page-readiness.mjs +++ b/site/scripts/check-page-readiness.mjs @@ -1,3 +1,4 @@ +import { newCheckContext, newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' import pixelmatch from 'pixelmatch' import { PNG } from 'pngjs' @@ -56,7 +57,7 @@ async function observeAppearance(context) { /** Optional policy and beacon requests cannot hold browser lifecycle events. */ export async function checkWebAnalytics(browser, base) { for (const kind of ['beacon', 'policy', 'excluded']) { - const context = await browser.newContext({ viewport: { width: 390, height: 900 } }) + const context = await newCheckContext(browser, base, { viewport: { width: 390, height: 900 } }) await observeAppearance(context) const page = await context.newPage() const errors = [] @@ -65,6 +66,7 @@ export async function checkWebAnalytics(browser, base) { const held = new Promise((resolve) => { release = resolve }) try { await page.route('**/_shell/web-analytics.json', async (route) => { + if (new URL(route.request().url()).origin !== new URL(base).origin) return route.fallback() if (kind === 'policy') { requested = true await held @@ -123,13 +125,14 @@ export async function checkWebAnalytics(browser, base) { /** Reproduce a late beacon arriving between an Astro swap and script execution. */ export async function checkWebAnalyticsTransitions(browser, base) { for (const markHandled of [true, false]) { - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 390, height: 900 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 390, height: 900 } }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) let release, requested = false const held = new Promise((resolve) => { release = resolve }) try { await page.route('**/_shell/web-analytics.json', async (route) => { + if (new URL(route.request().url()).origin !== new URL(base).origin) return route.fallback() const response = await route.fetch() await route.fulfill({ response, headers: { ...response.headers(), 'x-libtmux-analytics': 'allow' } }) }) @@ -186,7 +189,7 @@ export async function checkRequiredAppearance(browser, base) { ['module', '/java/latest/reference/io-github-libtmux-buffers-buffers-delete/', 1280], ['effect', '/prompts/?port=ts', 390], ]) { - const context = await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width, height: 900 }, reducedMotion: 'reduce' }) await observeAppearance(context) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) @@ -214,6 +217,7 @@ export async function checkRequiredAppearance(browser, base) { : request.url() === module const incoming = page.waitForRequest(required) await page.route('**/*', async (route) => { + if (new URL(route.request().url()).origin !== new URL(base).origin) return route.fallback() if (required(route.request())) { requested = true; await hold } if (kind === 'effect' && required(route.request())) { // Exercise insertion even when a new preview's actual manifest has @@ -225,7 +229,7 @@ export async function checkRequiredAppearance(browser, base) { await route.fulfill({ json: { schema: 1, ports: { py: entries, ts: entries } } }) return } - await route.continue() + await route.fallback() }) await page.goto(`${base}${path}`, { waitUntil: 'commit' }) await incoming @@ -273,11 +277,11 @@ export async function checkRequiredAppearance(browser, base) { } finally { release(); await context.close() } } - const context = await browser.newContext({ reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { - await page.route('**/*', (route) => route.request().resourceType() === 'font' ? route.abort() : route.continue()) + await page.route('**/*', (route) => route.request().resourceType() === 'font' ? route.abort() : route.fallback()) await page.goto(`${base}/`, { waitUntil: 'commit' }) await page.getByRole('alert').waitFor({ state: 'visible' }) assert.equal(await page.locator('html').getAttribute('data-page-readiness'), 'failed') @@ -288,7 +292,7 @@ export async function checkRequiredAppearance(browser, base) { await page.locator('html[data-page-readiness="ready"]').waitFor({ state: 'attached' }) assert(await page.locator('main h1').isVisible(), 'Reload recovers after the required resource becomes available') } finally { await context.close() } - const legacy = await browser.newPage() + const legacy = await newCheckPage(browser, base) try { const probe = `${base}/legacy-shell-probe/` await legacy.route(probe, (route) => route.fulfill({ contentType: 'text/html', body: @@ -461,7 +465,7 @@ async function addBadgeLinkFixtures(page) { * name's text, and leads it by about a quarter em. */ export async function checkKindBadgeLinks(browser, base, { sample = false, entries = BADGE_LINKS } = {}) { - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 1600, height: 1000 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 1600, height: 1000 } }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const failures = [] @@ -564,7 +568,7 @@ function dottedDecorations() { * line; only inline text runs carry the dotted underline. */ export async function checkBlockLinksUndecorated(browser, base, { sample = false } = {}) { - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const failures = [] @@ -676,7 +680,7 @@ async function functionLinkMarked(page) { * taken away, and a page that never had the section. */ export async function checkTmuxReferencePreviewsFail(browser, base) { - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { @@ -700,7 +704,7 @@ const TMUX_FUNCTION_LINK = 'section.api-tmux-section:has(> #api-tmux-command) .t const TMUX_METHOD_PAGE = '/cxx/latest/reference/libtmux-server-panes/' export async function checkTmuxReferencePreviews(browser, base, { served: build } = {}) { - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 1440, height: 1000 } }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const opened = () => page.evaluate(() => document.getElementById('reference-link-preview')?.matches(':popover-open') ?? false) diff --git a/site/scripts/check-picker-filters.mjs b/site/scripts/check-picker-filters.mjs index 3aa0c47bb..45eda7db9 100644 --- a/site/scripts/check-picker-filters.mjs +++ b/site/scripts/check-picker-filters.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' async function bounds(page, panel) { @@ -61,7 +62,7 @@ async function exercise(page, selector, query, count) { export async function checkPickerFilters(browser, base, complete = false) { const sizes = complete ? [{ width: 853, height: 789 }, { width: 320, height: 360 }, { width: 280, height: 320 }] : [{ width: 320, height: 360 }] for (const colorScheme of complete ? ['light', 'dark'] : ['light']) { - const context = await browser.newContext({ colorScheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { colorScheme, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(5000) try { @@ -77,10 +78,11 @@ export async function checkPickerFilters(browser, base, complete = false) { } if (!complete) return - const context = await browser.newContext({ viewport: { width: 853, height: 789 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 853, height: 789 }, reducedMotion: 'reduce' }) let release const pending = new Promise((resolve) => { release = resolve }) await context.route('**/versions.json', async (route) => { + if (new URL(route.request().url()).origin !== new URL(base).origin) return route.fallback() await pending await route.fulfill({ contentType: 'application/json', body: JSON.stringify({ schema: 1, ports: { kotlin: [ { slug: 'latest', label: 'latest', kind: 'trunk', supported: true }, @@ -120,7 +122,7 @@ export async function checkPickerFilters(browser, base, complete = false) { assert.equal(new URL(page.url()).hash, '#demo-versions', 'Sample versions use their own destination after choosing a sample language') } finally { release(); await context.unrouteAll({ behavior: 'wait' }); await context.close() } - const noScript = await browser.newContext({ javaScriptEnabled: false, viewport: { width: 853, height: 789 } }) + const noScript = await newCheckContext(browser, base, { javaScriptEnabled: false, viewport: { width: 853, height: 789 } }) try { const page = await noScript.newPage() await page.goto(`${base}/demo/widgets/pickers/`) diff --git a/site/scripts/check-reference-preferences.mjs b/site/scripts/check-reference-preferences.mjs index b1da486c5..6d9e37c71 100644 --- a/site/scripts/check-reference-preferences.mjs +++ b/site/scripts/check-reference-preferences.mjs @@ -1,10 +1,11 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** Exercise native disclosures and fragment navigation on a short API page. */ export async function checkReferencePreferences(browser, base) { const path = '/java/latest/reference/io-github-libtmux-buffers-buffers-delete/' const key = 'libtmux-docs.api-source-details' - const context = await browser.newContext({ reducedMotion: 'reduce', viewport: { width: 784, height: 760 } }) + const context = await newCheckContext(browser, base, { reducedMotion: 'reduce', viewport: { width: 784, height: 760 } }) await context.addInitScript(() => { window.__sourceFrames = [] const seen = new WeakSet() @@ -82,7 +83,7 @@ export async function checkReferencePreferences(browser, base) { } for (const javaScriptEnabled of [false, true]) { - const fallback = await browser.newContext({ javaScriptEnabled, reducedMotion: 'reduce' }) + const fallback = await newCheckContext(browser, base, { javaScriptEnabled, reducedMotion: 'reduce' }) if (javaScriptEnabled) await fallback.addInitScript(() => { Object.defineProperty(window, 'localStorage', { get() { throw new Error('Storage blocked') } }) }) @@ -208,7 +209,7 @@ export async function checkHeaderLinks(page, path, width, scripted) { */ export async function checkHeaderLinksFail(browser, base) { const run = async ({ path = '/rs/latest/', width = 1440, css, script }) => { - const context = await browser.newContext({ javaScriptEnabled: true, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { javaScriptEnabled: true, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { @@ -277,7 +278,7 @@ export async function checkHeaderLinksRender(browser, base, { path = '/rs/latest if ((script || css) && javaScript.includes(false)) throw new Error('checkHeaderLinksRender: script and css apply only where JavaScript is on') for (const colorScheme of schemes) for (const width of widths) for (const javaScriptEnabled of javaScript) { const where = `${path} at ${width}px, ${colorScheme}, ${javaScriptEnabled ? 'with' : 'without'} JavaScript` - const context = await browser.newContext({ viewport: { width, height: 900 }, colorScheme, javaScriptEnabled, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width, height: 900 }, colorScheme, javaScriptEnabled, reducedMotion: 'reduce' }) if (javaScriptEnabled) { await context.addInitScript(() => { window.__headerShift = 0 @@ -405,7 +406,7 @@ export async function checkHeaderLinksRenderFail(browser, base) { /** The global header has no repeated destination strip, including without JS. */ export async function checkGlobalHeader(browser, base) { for (const javaScriptEnabled of [false, true]) { - const context = await browser.newContext({ javaScriptEnabled, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { javaScriptEnabled, reducedMotion: 'reduce' }) const page = await context.newPage() const headerFrames = new Map() try { @@ -464,7 +465,7 @@ export async function checkScrollbarStability(browser, base) { }) try { for (const width of [280, 628, 1280]) for (const colorScheme of ['light', 'dark']) for (const javaScriptEnabled of [true, false]) { - const context = await classic.newContext({ viewport: { width, height: 900 }, colorScheme, javaScriptEnabled, reducedMotion: 'reduce' }) + const context = await newCheckContext(classic, base, { viewport: { width, height: 900 }, colorScheme, javaScriptEnabled, reducedMotion: 'reduce' }) const page = await context.newPage() const frame = () => page.evaluate(() => { const rect = (selector) => { diff --git a/site/scripts/check-ruby-lua.mjs b/site/scripts/check-ruby-lua.mjs index 558a7b533..7b9bf8fba 100644 --- a/site/scripts/check-ruby-lua.mjs +++ b/site/scripts/check-ruby-lua.mjs @@ -1,5 +1,6 @@ #!/usr/bin/env node /** Browser coverage for the Ruby and Lua documentation surfaces. */ +import { newCheckContext } from './browser-context.mjs' import { chromium } from 'playwright' const BASE = (process.argv[2] ?? 'http://localhost:8080/en').replace(/\/$/, '') @@ -33,7 +34,7 @@ const check = (condition, message) => { for (const scheme of ['light', 'dark']) { for (const [viewport, width, height] of VIEWPORTS) { - const context = await browser.newContext({ + const context = await newCheckContext(browser, base, { viewport: { width, height }, colorScheme: scheme, }) diff --git a/site/scripts/check-sidebar-demo.mjs b/site/scripts/check-sidebar-demo.mjs index 3ceb43692..4ac27f13d 100644 --- a/site/scripts/check-sidebar-demo.mjs +++ b/site/scripts/check-sidebar-demo.mjs @@ -1,5 +1,6 @@ #!/usr/bin/env node // Outer loop: real browser interactions across sidebar modes, themes, and viewports. +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { mkdir } from 'node:fs/promises' import { resolve } from 'node:path' @@ -10,7 +11,7 @@ import { chromium } from 'playwright' export async function checkSidebarDemo(browser, url, options = {}) { const values = { url, screenshots: options.screenshots, 'negative-control': options.negativeControl } const started = performance.now() - const context = await browser.newContext({ viewport: { width: 1600, height: 1150 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 1600, height: 1150 }, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(1000) const navigationTimeout = process.env.CI ? 20000 : 10000 diff --git a/site/scripts/check-status-badges.mjs b/site/scripts/check-status-badges.mjs index 8b920199a..899986589 100644 --- a/site/scripts/check-status-badges.mjs +++ b/site/scripts/check-status-badges.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' import { CONCEPT_DESCRIPTION, PICKER_GROUP_SUMMARY, PORT_BY_SLUG, PRODUCT_STATUS_GUIDE, PRODUCT_STATUS_LINK, productStatusLine, productAvailable, productStatus } from '../src/lib/ports.ts' import registry from '../src/data/registry.json' with { type: 'json' } @@ -222,7 +223,7 @@ export async function checkStatusBadges(browser, base, options = {}) { touch = true, timeout, sabotage } = options let rows = 0 for (const scheme of schemes) { - const context = await browser.newContext({ colorScheme: scheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { colorScheme: scheme, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(timeout ?? (process.env.CI ? 20000 : 10000)) page.setDefaultNavigationTimeout(60000) @@ -269,7 +270,7 @@ export async function checkStatusBadges(browser, base, options = {}) { } } if (touch && !sabotage) { - const context = await browser.newContext({ viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 390, height: 844 }, hasTouch: true, isMobile: true, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) page.setDefaultNavigationTimeout(60000) diff --git a/site/scripts/check-style-parity.mjs b/site/scripts/check-style-parity.mjs index ead796b35..09c48e390 100755 --- a/site/scripts/check-style-parity.mjs +++ b/site/scripts/check-style-parity.mjs @@ -17,6 +17,7 @@ * * Usage: node scripts/check-style-parity.mjs [base-url] */ +import { newCheckPage } from './browser-context.mjs' import { chromium } from 'playwright' const base = process.argv[2] ?? 'http://localhost:8080' @@ -163,7 +164,7 @@ async function styles(page, url, cases, side) { } const browser = await chromium.launch() -const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }) +const page = await newCheckPage(browser, base, { viewport: { width: 1440, height: 900 } }) const sphinx = await styles(page, SPHINX, CASES, 'sphinx') /* * Two visits, one array. diff --git a/site/scripts/check-tables.mjs b/site/scripts/check-tables.mjs index 254eea1f6..f5b5bb2c7 100644 --- a/site/scripts/check-tables.mjs +++ b/site/scripts/check-tables.mjs @@ -1,4 +1,5 @@ #!/usr/bin/env node +import { newCheckPage } from './browser-context.mjs' import assert from 'node:assert/strict' import { globSync, readFileSync } from 'node:fs' import { join } from 'node:path' @@ -31,7 +32,7 @@ const browser = await chromium.launch({ channel: process.env.LIBTMUX_DOCS_BROWSE let checked = 0 try { for (const width of [1440, 768, 390]) { - const page = await browser.newPage({ viewport: { width, height: 1000 } }) + const page = await newCheckPage(browser, base, { viewport: { width, height: 1000 } }) for (const path of paths) { const response = await page.goto(base + path) assert(response?.ok(), `${path}: HTTP ${response?.status()}`) diff --git a/site/scripts/check-tmux-keys.mjs b/site/scripts/check-tmux-keys.mjs index 20d3d05f0..fadc9d09c 100644 --- a/site/scripts/check-tmux-keys.mjs +++ b/site/scripts/check-tmux-keys.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** Contrast of a rendered element's text against what is painted behind it. */ @@ -53,7 +54,7 @@ export const TMUX_KEY_PAGES = [ */ export async function checkTmuxKeys(browser, base) { for (const colorScheme of ['light', 'dark']) { - const context = await browser.newContext({ colorScheme, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { colorScheme, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) const errors = [] diff --git a/site/scripts/check-type-parameters.mjs b/site/scripts/check-type-parameters.mjs index a7ffe4637..d7bbbf330 100644 --- a/site/scripts/check-type-parameters.mjs +++ b/site/scripts/check-type-parameters.mjs @@ -1,3 +1,4 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** @@ -18,7 +19,7 @@ export const TYPE_PARAMETER_PAGES = [ * declaration exists on the owner's page, and the Markdown twin says the same. */ export async function checkTypeParameters(browser, base, pages = TYPE_PARAMETER_PAGES) { - const context = await browser.newContext({ viewport: { width: 1280, height: 1000 }, reducedMotion: 'reduce' }) + const context = await newCheckContext(browser, base, { viewport: { width: 1280, height: 1000 }, reducedMotion: 'reduce' }) const page = await context.newPage() page.setDefaultTimeout(process.env.CI ? 20000 : 10000) try { diff --git a/site/scripts/check-visual.mjs b/site/scripts/check-visual.mjs index 10e9e16da..9caa7b658 100755 --- a/site/scripts/check-visual.mjs +++ b/site/scripts/check-visual.mjs @@ -17,6 +17,7 @@ * * Usage: node scripts/check-visual.mjs [--update] [base-url] */ +import { newCheckPage } from './browser-context.mjs' import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { dirname, join, resolve } from 'node:path' import { fileURLToPath } from 'node:url' @@ -60,7 +61,7 @@ let written = 0 for (const [scheme] of [['light'], ['dark']]) { for (const [vname, width, height] of VIEWPORTS) { - const page = await browser.newPage({ viewport: { width, height }, colorScheme: scheme }) + const page = await newCheckPage(browser, base, { viewport: { width, height }, colorScheme: scheme }) for (const [pname, path] of PAGES) { const name = `${pname}-${vname}-${scheme}.png` const file = join(dir, name) diff --git a/site/scripts/check-workspace-hover.mjs b/site/scripts/check-workspace-hover.mjs index 5bdcf5c6d..8ed8274fe 100644 --- a/site/scripts/check-workspace-hover.mjs +++ b/site/scripts/check-workspace-hover.mjs @@ -1,8 +1,9 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** Real pointer events on the preset picker, with the clock advanced instead of sleeping. */ export async function checkWorkspaceHover(browser, base) { - const context = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'light' }) + const context = await newCheckContext(browser, base, { viewport: { width: 1280, height: 900 }, colorScheme: 'light' }) const page = await context.newPage() const errors = [] page.on('pageerror', (error) => errors.push(error.message)) diff --git a/site/scripts/check-workspace-shift.mjs b/site/scripts/check-workspace-shift.mjs index 3575d55f9..db8d68211 100644 --- a/site/scripts/check-workspace-shift.mjs +++ b/site/scripts/check-workspace-shift.mjs @@ -1,8 +1,9 @@ +import { newCheckContext } from './browser-context.mjs' import assert from 'node:assert/strict' /** A cold deep link into the preset picker lands in one scroll and shifts nothing. */ export async function checkWorkspaceShift(browser, base) { - const context = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'light' }) + const context = await newCheckContext(browser, base, { viewport: { width: 1280, height: 900 }, colorScheme: 'light' }) const page = await context.newPage() const errors = [] page.on('pageerror', (error) => errors.push(error.message)) diff --git a/site/src/components/CoreHome.astro b/site/src/components/CoreHome.astro index c6edd4423..9b2007c4e 100644 --- a/site/src/components/CoreHome.astro +++ b/site/src/components/CoreHome.astro @@ -68,7 +68,7 @@ const rest = (group: keyof typeof CAPABILITY_GROUPS) => home.capabilities[group]

Server → Session → Window → Pane. Each level of the tmux hierarchy has its own entry in the {info.name} API, with the tmux object it wraps.

- + {home.objects.map((object) => diff --git a/site/src/components/api/ApiEntry.astro b/site/src/components/api/ApiEntry.astro index 9ca0a8037..0f2838131 100644 --- a/site/src/components/api/ApiEntry.astro +++ b/site/src/components/api/ApiEntry.astro @@ -211,11 +211,12 @@ const mentionSections = [...new Set(mentions.map((m) => m.section ?? 'docs'))].s const badges = [ { label: symbol.command?.kind ?? kind, variant: 'kind' as const, value: kind }, ...(symbol.package ? [{ label: symbol.package, variant: 'mod' as const, value: 'package' }] : []), - ...symbol.modifiers.map((m) => ({ label: m, variant: 'mod' as const, value: m })), + ...symbol.modifiers.filter((m) => port !== 'clojure' || m !== 'overload') + .map((m) => ({ label: m, variant: 'mod' as const, value: m })), ...(symbol.signatures.length > 1 && symbol.modifiers.includes('overload') ? [ { - label: `${symbol.signatures.length} overloads`, + label: `${symbol.signatures.length} ${port === 'clojure' ? 'arities' : 'overloads'}`, variant: 'mod' as const, value: 'overload', }, @@ -341,7 +342,7 @@ const hasBody = {...signatureTargets[i]} tabindex={signatureLayouts.has(sig) ? '0' : undefined} role={signatureLayouts.has(sig) ? 'region' : undefined} - aria-label={signatureLayouts.has(sig) ? `Signature for ${symbol.name}${symbol.signatures.length > 1 ? `, overload ${symbol.signatures.indexOf(sig) + 1} of ${symbol.signatures.length}` : ''}` : undefined} + aria-label={signatureLayouts.has(sig) ? `Signature for ${symbol.name}${symbol.signatures.length > 1 ? `, ${port === 'clojure' ? 'arity' : 'overload'} ${symbol.signatures.indexOf(sig) + 1} of ${symbol.signatures.length}` : ''}` : undefined} data-code-columns={signatureLayouts.get(sig)?.limit} data-code-width-status={signatureLayouts.has(sig) ? (signatureLayouts.get(sig)!.failures.length ? 'unresolved' : 'fits') : undefined} data-code-width-failures={signatureLayouts.get(sig)?.failures.length ? JSON.stringify(signatureLayouts.get(sig)!.failures) : undefined}>{sig.label && sig.label !== '__AllParameterSets' && {sig.label}{sig.isDefault ? ' (default)' : ''}: } )) : {anonymousDeclarationLabel(symbol)}) : <> {keyword && {keyword} } diff --git a/site/src/components/api/ApiReference.astro b/site/src/components/api/ApiReference.astro index 434c53e35..c70363172 100644 --- a/site/src/components/api/ApiReference.astro +++ b/site/src/components/api/ApiReference.astro @@ -400,7 +400,8 @@ const title = glossary ? API_GLOSSARY_TITLE : owner ? source?.title ?? `${label} API reference` : 'API reference' const pageTitle = glossary ? API_GLOSSARY_TITLE : owner ? title : source?.title ?? 'API reference' -const displayName = owner ? (declaringType ? `${declaringType.name}.${owner.name}` : owner.name) : pageTitle +const displayName = owner ? (port === 'clojure' ? nativeQualifiedName(model, owner) + : declaringType ? `${declaringType.name}.${owner.name}` : owner.name) : pageTitle const breadcrumbs = source?.breadcrumbs ?? await pageBreadcrumbs(displayName, glossary ? 'reference/glossary' : slug ? `reference/${slug}` : 'reference', version, port) const pagePath = glossary ? 'reference/glossary' : source?.pagePath ?? (slug ? `reference/${slug}` : 'reference') const description = glossary ? glossaryContext.description : source?.description ?? `Types, methods, and functions in libtmux for ${label}.` diff --git a/site/src/content/docs/ports/clojure/concepts/index.md b/site/src/content/docs/ports/clojure/concepts/index.md new file mode 100644 index 000000000..6a4433512 --- /dev/null +++ b/site/src/content/docs/ports/clojure/concepts/index.md @@ -0,0 +1,23 @@ +--- +port: clojure +route: concepts +title: Concepts +description: Understand Clojure captures, explicit references and resource ownership. +sidebar: + group: Concepts + label: Overview + order: 1 +cards: + - label: Server, session, window, pane + href: ./server-session-window-pane/ + body: Traverse captured maps and choose the reference used by an effect. + - label: Captures, effects and streams + href: ../guides/captures-and-effects/ + body: Own clients, workers and subscriptions; inspect failures before retrying. + - label: Captured values + href: ../guides/captured-values/ + body: Look up namespaced fields and distinguish unavailable from absent data. +--- + +Start with the [object graph](./server-session-window-pane/), then use the +[task examples](../examples/) to apply these contracts. diff --git a/site/src/content/docs/ports/clojure/concepts/server-session-window-pane.md b/site/src/content/docs/ports/clojure/concepts/server-session-window-pane.md new file mode 100644 index 000000000..5c7507f5f --- /dev/null +++ b/site/src/content/docs/ports/clojure/concepts/server-session-window-pane.md @@ -0,0 +1,47 @@ +--- +port: clojure +route: concepts/server-session-window-pane +title: Server, session, window, pane +description: Traverse one captured graph and keep effects explicit through Java references. +sidebar: + group: Concepts + order: 2 +--- + +[`open!`][open] returns a closeable Java server client for an explicit socket. +[`snapshot!`][snapshot] acquires a graph of persistent maps. A snapshot contains +sessions; sessions contain window placements; windows contain panes. +[`data/windows`][windows] and [`data/panes`][panes] traverse that capture +without another tmux command. Ordinary keyword lookup reads its scalar fields. + +Maps retain an opaque Java handle at `:tmux/ref`. Pass that reference to an +effect such as [`rename!`][rename]. Editing an ID in a map changes the map; +it does not change the target authenticated by its reference. The old map +keeps its earlier name after a rename. [`refresh!`][refresh] acquires a new +observation. + +A linked window can occur in several sessions. [`same-entity?`][entity] +compares physical identity; [`same-link?`][link] also compares its placement. +Keep input order and repeated placements when processing the graph. + +Use native collection functions to filter captured values. When a Java +`FilterExpr` already exists, [`matching`][matching] adapts it to a Clojure +transducer or lazy sequence. [`exactly-one`][one] checks cardinality before an +effect. [`data`][data] removes operational references for detached EDN export. + +The [quickstart](../../) demonstrates these operations. The +[captured-value reference](../../guides/captured-values/) lists the keys; +[captures and effects](../../guides/captures-and-effects/) explains ownership, +lazy processing and recovery. + +[open]: ../../reference/libtmux-core-open/ +[snapshot]: ../../reference/libtmux-core-snapshot/ +[windows]: ../../reference/libtmux-data-windows/ +[panes]: ../../reference/libtmux-data-panes/ +[rename]: ../../reference/libtmux-core-rename/ +[refresh]: ../../reference/libtmux-core-refresh/ +[entity]: ../../reference/libtmux-data-same-entity/ +[link]: ../../reference/libtmux-data-same-link/ +[matching]: ../../reference/libtmux-data-matching/ +[one]: ../../reference/libtmux-data-exactly-one/ +[data]: ../../reference/libtmux-data-data/ diff --git a/site/src/content/docs/ports/clojure/core/index.md b/site/src/content/docs/ports/clojure/core/index.md new file mode 100644 index 000000000..915a69c00 --- /dev/null +++ b/site/src/content/docs/ports/clojure/core/index.md @@ -0,0 +1,19 @@ +--- +port: clojure +route: core +title: "tmux client library for Clojure" +description: "tmux client library for Clojure. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents" +cards: + - label: Guides + href: ../guides/ + body: Install from source and work with captures, effects and streams. + - label: API reference + href: ../reference/ + body: Public namespaces, function arities and ownership contracts. + - label: core.async adapter + href: ../guides/core-async/ + body: Optional event channels with explicit cancellation and closure. +--- + +The Clojure packages have not been published. Follow the source installation +steps in [Getting started](../guides/getting-started/). diff --git a/site/src/content/docs/ports/clojure/examples.md b/site/src/content/docs/ports/clojure/examples.md new file mode 100644 index 000000000..bacfe4c76 --- /dev/null +++ b/site/src/content/docs/ports/clojure/examples.md @@ -0,0 +1,31 @@ +--- +port: clojure +route: examples +title: Examples +description: Run complete Clojure programs against private tmux servers. +sidebar: + group: Examples + order: 1 +--- + +The [quickstart](../) creates a session, renames and splits its window, sends a +shell command, and prints the captured graph and output. Its setup installs +the documented source into an isolated Maven repository. Every view closes +its client and stops the server it created. + +The API reference includes complete programs with imports, Tools.deps setup, +an owned-server launcher and expected output: + +- [Capture output](../reference/libtmux-core-capture/): send literal input, + wait for an application output marker, and read the screen. +- [Build a layout](../reference/libtmux-core-split-pane/): split panes, rename a + window, move its placement and compare physical identity with link identity. +- [Capture concurrently](../reference/libtmux-async-submit/): submit bounded + work and cancel a wait while checking cleanup. +- [Observe UTF-8 output](../reference/libtmux-control-subscribe/): consume a + bounded stream and inspect its terminal state. +- [Use core.async](../reference/libtmux-core-async-observe/): stop the adapter + and continue using its borrowed control connection. + +The stream examples require tmux 3.7 or newer. On an older supported tmux, +they print the capability refusal shown beside the expected output. diff --git a/site/src/data/api-destination-evidence.json b/site/src/data/api-destination-evidence.json index 72ed2ad5a..509c27cfa 100644 --- a/site/src/data/api-destination-evidence.json +++ b/site/src/data/api-destination-evidence.json @@ -1,6 +1,6 @@ { "schema": 2, - "checkedAt": "2026-10-31", + "checkedAt": "2026-11-07", "inventories": [ {"name":"python","source":"https://docs.python.org/3/objects.inv","kind":"objects.inv","entries":16493,"digest":"9b186d22c55bd3056145d7009198a34a0274d7e4","ok":true,"missing":0,"checkedAt":"2026-10-25"}, {"name":"julia","source":"https://docs.julialang.org/en/v1/objects.inv","kind":"objects.inv","entries":2545,"digest":"94ff52276c38e7feea3d68234092a72496935b01","ok":true,"missing":0,"checkedAt":"2026-10-25"}, @@ -8,6 +8,10 @@ {"name":"dom","source":"https://developer.mozilla.org/sitemaps/en-us/sitemap.xml.gz","kind":"sitemap","entries":794,"digest":"f2a6d375a617d3df05ae4a61b4ce9130a39c7a5d","ok":true,"missing":0,"checkedAt":"2026-10-25"} ], "destinations": [ + {"url":"https://clojure.github.io/core.async/clojure.core.async.html","host":"clojure.github.io","status":200,"via":"html","title":"clojure.core.async documentation","heading":"clojure.core.async","ok":true,"terminal":[{"key":"authored:core.async","symbol":"core.async","at":"review"}],"checkedAt":"2026-11-07","names":["site/src/content/docs/_staged/clojure/guides/core-async/index.md","site/src/data/port-guides/clojure.json"],"sources":["authored"]}, + {"url":"https://clojure.org/reference/namespaces","host":"clojure.org","status":200,"via":"html","title":"Clojure - Namespaces","heading":"Namespaces","ok":true,"terminal":[{"key":"authored:Clojure namespaces","symbol":"Clojure namespaces","at":"review"}],"checkedAt":"2026-11-07","names":["glossary clojure module","glossary clojure package"],"sources":["authored"]}, + {"url":"https://clojure.org/reference/special_forms#fn","host":"clojure.org","status":200,"via":"html","title":"Clojure - Special Forms","heading":"( fn name ? [ params * ] expr *)","ok":true,"fragment":"found","terminal":[{"key":"authored:Clojure function arities","symbol":"Clojure function arities","at":"review"}],"checkedAt":"2026-11-07","names":["glossary clojure overload"],"sources":["authored"]}, + {"url":"https://clojure.org/reference/vars","host":"clojure.org","status":200,"via":"html","title":"Clojure - Vars and the Global Environment","heading":"Vars and the Global Environment","ok":true,"terminal":[{"key":"authored:Clojure vars","symbol":"Clojure vars","at":"review"}],"checkedAt":"2026-11-07","names":["glossary clojure function"],"sources":["authored"]}, {"url":"https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html","host":"cmake.org","status":200,"via":"html","title":"cmake-packages(7) - CMake 4.5.0-rc1 Documentation","heading":"cmake-packages(7)","ok":true,"terminal":[{"key":"authored:CMake packages","symbol":"CMake packages","at":"review"}],"checkedAt":"2026-10-25","names":["glossary cxx package"],"sources":["authored"]}, {"url":"https://csharp.sdk.modelcontextprotocol.io/v2/api/Microsoft.Extensions.DependencyInjection.IMcpServerBuilder.html","host":"csharp.sdk.modelcontextprotocol.io","status":200,"via":"html","title":"Interface IMcpServerBuilder | MCP C# SDK","identity":{"via":"docfx","declared":"interface","kind":"type","path":["Microsoft","Extensions","DependencyInjection","IMcpServerBuilder"],"arity":0},"ok":true,"terminal":[{"key":"csharp:IMcpServerBuilder","symbol":"IMcpServerBuilder","at":"identity"}],"checkedAt":"2026-10-25","names":["csharp:IMcpServerBuilder"],"sources":["type"]}, {"url":"https://csharp.sdk.modelcontextprotocol.io/v2/api/ModelContextProtocol.McpException.html","host":"csharp.sdk.modelcontextprotocol.io","status":200,"via":"html","title":"Class McpException | MCP C# SDK","identity":{"via":"docfx","declared":"class","kind":"type","path":["ModelContextProtocol","McpException"],"arity":0},"ok":true,"terminal":[{"key":"csharp:McpException","symbol":"McpException","at":"identity"}],"checkedAt":"2026-10-25","names":["csharp:McpException"],"sources":["type"]}, @@ -193,7 +197,7 @@ {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/BufferedWriter.html","host":"docs.oracle.com","status":200,"via":"html","title":"BufferedWriter (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","BufferedWriter"],"arity":0},"ok":true,"terminal":[{"key":"java:BufferedWriter","symbol":"BufferedWriter","at":"identity"}],"checkedAt":"2026-10-25","names":["java:BufferedWriter"],"sources":["type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/InputStream.html","host":"docs.oracle.com","status":200,"via":"html","title":"InputStream (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","InputStream"],"arity":0},"ok":true,"terminal":[{"key":"java:InputStream","symbol":"InputStream","at":"identity"}],"checkedAt":"2026-10-25","names":["java:InputStream"],"sources":["type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/IOException.html","host":"docs.oracle.com","status":200,"via":"html","title":"IOException (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","IOException"],"arity":0},"ok":true,"terminal":[{"key":"java:IOException","symbol":"IOException","at":"identity"}],"checkedAt":"2026-10-25","names":["java:IOException"],"sources":["type"]}, - {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/OutputStream.html","host":"docs.oracle.com","status":200,"via":"html","title":"OutputStream (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","OutputStream"],"arity":0},"ok":true,"terminal":[{"key":"java:OutputStream","symbol":"OutputStream","at":"identity"}],"checkedAt":"2026-10-25","names":["java:OutputStream"],"sources":["type"]}, + {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/OutputStream.html","host":"docs.oracle.com","status":200,"via":"html","title":"OutputStream (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","OutputStream"],"arity":0},"ok":true,"terminal":[{"key":"java:OutputStream","symbol":"OutputStream","at":"identity"}],"checkedAt":"2026-11-07","names":["java:OutputStream"],"sources":["type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/io/UncheckedIOException.html","host":"docs.oracle.com","status":200,"via":"html","title":"UncheckedIOException (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","io","UncheckedIOException"],"arity":0},"ok":true,"terminal":[{"key":"java:UncheckedIOException","symbol":"UncheckedIOException","at":"identity"}],"checkedAt":"2026-10-25","names":["java:UncheckedIOException"],"sources":["prose"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/annotation/Documented.html","host":"docs.oracle.com","status":200,"via":"html","title":"Documented (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"annotation interface","kind":"type","path":["java","lang","annotation","Documented"],"arity":0},"ok":true,"terminal":[{"key":"java:Documented","symbol":"Documented","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Documented"],"sources":["type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/annotation/Retention.html","host":"docs.oracle.com","status":200,"via":"html","title":"Retention (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"annotation interface","kind":"type","path":["java","lang","annotation","Retention"],"arity":0},"ok":true,"terminal":[{"key":"java:Retention","symbol":"Retention","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Retention"],"sources":["type"]}, @@ -220,8 +224,9 @@ {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/Path.html","host":"docs.oracle.com","status":200,"via":"html","title":"Path (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"interface","kind":"type","path":["java","nio","file","Path"],"arity":0},"ok":true,"terminal":[{"key":"java:java.nio.file.Path","symbol":"Path","at":"identity"},{"key":"java:Path","symbol":"Path","at":"identity"},{"key":"kotlin:java.nio.file.Path","symbol":"Path","at":"identity"},{"key":"kotlin:Path","symbol":"Path","at":"identity"},{"key":"scala:java.nio.file.Path","symbol":"Path","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Path","java:java.nio.file.Path","kotlin:Path","kotlin:java.nio.file.Path","scala:java.nio.file.Path"],"sources":["doc","type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Duration.html","host":"docs.oracle.com","status":200,"via":"html","title":"Duration (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","time","Duration"],"arity":0},"ok":true,"terminal":[{"key":"java:Duration","symbol":"Duration","at":"identity"},{"key":"java:java.time.Duration","symbol":"Duration","at":"identity"},{"key":"scala:java.time.Duration","symbol":"Duration","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Duration","java:java.time.Duration","scala:java.time.Duration"],"sources":["doc","prose","type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Duration.html#ofSeconds(long,long)","host":"docs.oracle.com","status":200,"via":"html","title":"Duration (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"method","kind":"member","path":["java","time","Duration","ofSeconds"],"arity":0,"params":["long","long"]},"fragment":"found","ok":true,"terminal":[{"key":"scala:java.time.Duration.ofSeconds","symbol":"ofSeconds","at":"identity"}],"checkedAt":"2026-10-25","names":["scala:java.time.Duration.ofSeconds"],"sources":["type"]}, - {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Instant.html","host":"docs.oracle.com","status":200,"via":"html","title":"Instant (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","time","Instant"],"arity":0},"ok":true,"terminal":[{"key":"java:Instant","symbol":"Instant","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Instant"],"sources":["type"]}, + {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/time/Instant.html","host":"docs.oracle.com","status":200,"via":"html","title":"Instant (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"class","kind":"type","path":["java","time","Instant"],"arity":0},"ok":true,"terminal":[{"key":"clojure:Instant","symbol":"Instant","at":"identity"},{"key":"java:Instant","symbol":"Instant","at":"identity"}],"checkedAt":"2026-11-07","names":["clojure:Instant","java:Instant"],"sources":["prose","type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Collection.html","host":"docs.oracle.com","status":200,"via":"html","title":"Collection (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"interface","kind":"type","path":["java","util","Collection"],"arity":1},"ok":true,"terminal":[{"key":"java:Collection","symbol":"Collection","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Collection"],"sources":["type"]}, + {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/CompletionStage.html","host":"docs.oracle.com","status":200,"via":"html","title":"CompletionStage (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"interface","kind":"type","path":["java","util","concurrent","CompletionStage"],"arity":1},"ok":true,"terminal":[{"key":"clojure:CompletionStage","symbol":"CompletionStage","at":"identity"},{"key":"java:CompletionStage","symbol":"CompletionStage","at":"identity"}],"checkedAt":"2026-11-07","names":["clojure:CompletionStage","java:CompletionStage"],"sources":["prose"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Executor.html","host":"docs.oracle.com","status":200,"via":"html","title":"Executor (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"interface","kind":"type","path":["java","util","concurrent","Executor"],"arity":0},"ok":true,"terminal":[{"key":"java:Executor","symbol":"Executor","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Executor"],"sources":["doc","type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Flow.Publisher.html","host":"docs.oracle.com","status":200,"via":"html","title":"Flow.Publisher (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"interface","kind":"type","path":["java","util","concurrent","Flow","Publisher"],"arity":1},"ok":true,"terminal":[{"key":"java:Flow.Publisher","symbol":"Publisher","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Flow.Publisher"],"sources":["doc","type"]}, {"url":"https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Flow.Subscription.html#request(long)","host":"docs.oracle.com","status":200,"via":"html","title":"Flow.Subscription (Java SE 21 & JDK 21)","identity":{"via":"javadoc","declared":"method","kind":"member","path":["java","util","concurrent","Flow","Subscription","request"],"arity":0,"params":["long"]},"fragment":"found","ok":true,"terminal":[{"key":"java:Flow.Subscription.request","symbol":"request","at":"identity"}],"checkedAt":"2026-10-25","names":["java:Flow.Subscription.request"],"sources":["doc"]}, diff --git a/site/src/data/api-link-review.json b/site/src/data/api-link-review.json index 4ad470b0a..5abdfb7ed 100644 --- a/site/src/data/api-link-review.json +++ b/site/src/data/api-link-review.json @@ -1,5 +1,9 @@ { "links": [ + {"label":"core.async","url":"https://clojure.github.io/core.async/clojure.core.async.html","heading":"clojure.core.async"}, + {"label":"Clojure namespaces","url":"https://clojure.org/reference/namespaces","heading":"Namespaces"}, + {"label":"Clojure function arities","url":"https://clojure.org/reference/special_forms#fn","heading":"( fn name ? [ params * ] expr *)"}, + {"label":"Clojure vars","url":"https://clojure.org/reference/vars","heading":"Vars and the Global Environment"}, {"label":"CMake packages","url":"https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html","heading":"cmake-packages(7)"}, {"label":"Cargo packages and targets","url":"https://doc.rust-lang.org/cargo/reference/cargo-targets.html","heading":"Cargo Targets"}, {"label":"orphan rules","url":"https://doc.rust-lang.org/error_codes/E0117.html","heading":"Error code E0117"}, diff --git a/site/src/data/api/clojure.json b/site/src/data/api/clojure.json new file mode 100644 index 000000000..32de31d81 --- /dev/null +++ b/site/src/data/api/clojure.json @@ -0,0 +1 @@ +{"port":"clojure","repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractor":"clojure-public-var-metadata/1","sources":[{"product":"core","package":"io.github.libtmux:libtmux-clojure","repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124","version":"0.1.2-SNAPSHOT"},{"product":"core","package":"io.github.libtmux:libtmux-clojure-core-async","repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124","version":"0.1.2-SNAPSHOT"}],"nativeProvenance":{"files":[{"path":"libtmux-clojure/src/main/clojure/libtmux/core.clj","sha256":"0c2aebc52a46de2e7a47495fbc7dbc985bfb4a2909984973541e06ed1fed8961"},{"path":"libtmux-clojure/src/main/clojure/libtmux/data.clj","sha256":"1d72bafad9f49a1835306c79a42b66389bbb6bed93c07554bc43a5f9210f871f"},{"path":"libtmux-clojure/src/main/clojure/libtmux/async.clj","sha256":"169e1297ccb1a69824d470c1d867fc3a41aea9fb6c31a2a59fff7685f3382dd9"},{"path":"libtmux-clojure/src/main/clojure/libtmux/control.clj","sha256":"fdb877999557421f54685eb26fafd8b7910b6a620689d59bc59aaff127b6febd"},{"path":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","sha256":"19f66c0f60fbec76e03773ebb698db623d7a6a819e2c56a1031cebf2474e7f95"}],"exporter":{"name":"clojure-public-var-metadata","revision":"sha256:d3536bfe39546854b590f5c58c17d79bdc98310820bcf9dd8cf9bc1e30deb1a1","files":[{"path":"packages/api-model/scripts/export-clojure.clj","sha256":"e65ac79e0839024508ff2082ead51d78e92b590111c304235e0a62f48862b260"},{"path":"packages/api-model/scripts/export-clojure.gradle","sha256":"1d541b7179b69e3e28b0a10302cd10b859394c0e5df4b1d4f29a3a15828a7d12"}]}},"symbols":[{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(ns libtmux.core)","params":[]}],"publicOwner":"libtmux.core","publicId":"libtmux.core","id":"libtmux.core","apiScope":"exported","product":"core","qualifiedName":"libtmux.core","name":"libtmux.core","modifiers":[],"kind":"module","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":1,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Explicit tmux effects through [[open!]] and [[snapshot!]].","body":"Captured maps retain opaque Java references; [[libtmux.data]] traverses them locally."},"slug":"libtmux-core"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(append-hook! value event argv)","params":[{"name":"value"},{"name":"event"},{"name":"argv"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/append-hook!","id":"libtmux.core/append-hook!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/append-hook!","name":"append-hook!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":469,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Appends one explicit tmux argv command to a hook.","body":"[[hooks!]] returns the ordered command vectors."},"slug":"libtmux-core-append-hook"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(apply-layout! window layout)","params":[{"name":"window"},{"name":"layout"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/apply-layout!","id":"libtmux.core/apply-layout!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/apply-layout!","name":"apply-layout!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":333,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Applies an explicit tmux layout string.","body":"[[resize!]] sets explicit cell dimensions.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-core-apply-layout"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(await-channel! server name timeout)","params":[{"name":"server"},{"name":"name"},{"name":"timeout"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/await-channel!","id":"libtmux.core/await-channel!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/await-channel!","name":"await-channel!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":511,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Waits on an explicit tmux channel while reserving capacity for its release.","body":"Returns `:signalled`, `:timed-out`, or `:server-gone`; interruption propagates.\n[[signal-channel!]] releases this wait; declare [[libtmux.async/submit!]] work as `:wait`.","examples":[{"lang":"console","intro":"Capture with bounded workers and cancel an owned wait after cleanup. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture_concurrently.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture-concurrently\n \"Capture on bounded workers and cancel an explicitly classified wait.\"\n (:require [libtmux.async :as async]\n [libtmux.core :as tm])\n (:import [java.lang AutoCloseable]\n [java.time Duration]\n [java.util.concurrent CountDownLatch TimeUnit]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})\n ^AutoCloseable runtime (async/runtime! {:max-running 4 :queue-limit 4})]\n (let [panes (take 3 (tm/panes! server))\n tasks (mapv #(async/submit! runtime (fn [] (tm/capture! (:tmux/ref %)))) panes)\n captures (mapv deref tasks)\n started (CountDownLatch. 1)\n cleaned (promise)\n waiting (async/submit! runtime {:kind :wait}\n #(try\n (.countDown started)\n (tm/await-channel! server \"example-cancel\" (Duration/ofMillis 900))\n (finally (deliver cleaned true))))]\n (assert (= 3 (count captures)))\n (assert (every? vector? captures))\n (assert (.await started 900 TimeUnit/MILLISECONDS))\n (async/cancel! waiting)\n (let [failure (try @waiting nil (catch clojure.lang.ExceptionInfo error error))]\n (assert (= :cancelled (:tmux/error (ex-data failure))))\n (assert (realized? cleaned)))\n (println (str \"captured=\" (count captures)))\n (println \"cancelled=true cleaned=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture-concurrently\n"},{"lang":"text","intro":"Expected output:","code":"captured=3\ncancelled=true cleaned=true\n"}]},"slug":"libtmux-core-await-channel"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(await-text! pane text timeout)","params":[{"name":"pane"},{"name":"text"},{"name":"timeout"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/await-text!","id":"libtmux.core/await-text!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/await-text!","name":"await-text!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":384,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Waits within a positive Duration; returns a keyword describing the outcome.","body":"Use [[capture!]] to read lines after the wait; [[send-keys!]] alone proves no completion.","examples":[{"lang":"console","intro":"Send literal shell input and wait for actual output before capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture\n \"Send literal shell input, wait for its output, and verify captured lines.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [session (tm/new-session! server {:name \"api-capture\" :command [\"/bin/sh\"]})\n pane (:tmux/ref (data/exactly-one (data/panes session)))]\n (doseq [word [\"keys\" \"line\"]]\n (tm/send-literal! pane (str \"printf 'api-%s\\\\n' \" word))\n (tm/send-keys! pane [\"Enter\"])\n (when-not (#{:appeared :present-at-entry}\n (tm/await-text! pane (str \"api-\" word) (Duration/ofMillis 900)))\n (throw (IllegalStateException. \"shell output did not arrive\"))))\n (let [lines (set (map str/trim (tm/capture! pane)))]\n (doseq [expected [\"api-keys\" \"api-line\"]]\n (assert (contains? lines expected) (str \"capture is missing \" expected))\n (println expected)))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture\n"},{"lang":"text","intro":"Expected output:","code":"api-keys\napi-line\n"}]},"slug":"libtmux-core-await-text"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(batch! server operations)","params":[{"name":"server"},{"name":"operations"}]},{"raw":"(batch! server operations options)","params":[{"name":"server"},{"name":"operations"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/batch!","id":"libtmux.core/batch!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/batch!","name":"batch!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":580,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Runs independent argv commands using a fresh Java Batch and returns positions.","body":"Supply explicit targets. Failed/skipped outcomes are data; transport failure\nthrows with `:tmux/results.` Use `{:kind :wait}` for groups needing a release,\nincluding blocking shell commands. No rollback or retry safety is promised.\n[[chain!]] carries an implicit target between dependent commands."},"slug":"libtmux-core-batch"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(buffers! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/buffers!","id":"libtmux.core/buffers!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/buffers!","name":"buffers!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":502,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Lists captured buffer names and byte sizes.","body":"[[show-buffer!]] reads an individual buffer."},"slug":"libtmux-core-buffers"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(capture! pane)","params":[{"name":"pane"}]},{"raw":"(capture! pane options)","params":[{"name":"pane"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/capture!","id":"libtmux.core/capture!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/capture!","name":"capture!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":350,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Captures pane lines; `:from` `:history` includes scrollback.","body":"[[await-text!]] waits for text; [[libtmux.control/subscribe!]] observes new output.","examples":[{"lang":"console","intro":"Send literal shell input and wait for actual output before capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture\n \"Send literal shell input, wait for its output, and verify captured lines.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [session (tm/new-session! server {:name \"api-capture\" :command [\"/bin/sh\"]})\n pane (:tmux/ref (data/exactly-one (data/panes session)))]\n (doseq [word [\"keys\" \"line\"]]\n (tm/send-literal! pane (str \"printf 'api-%s\\\\n' \" word))\n (tm/send-keys! pane [\"Enter\"])\n (when-not (#{:appeared :present-at-entry}\n (tm/await-text! pane (str \"api-\" word) (Duration/ofMillis 900)))\n (throw (IllegalStateException. \"shell output did not arrive\"))))\n (let [lines (set (map str/trim (tm/capture! pane)))]\n (doseq [expected [\"api-keys\" \"api-line\"]]\n (assert (contains? lines expected) (str \"capture is missing \" expected))\n (println expected)))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture\n"},{"lang":"text","intro":"Expected output:","code":"api-keys\napi-line\n"},{"lang":"console","intro":"Capture with bounded workers and cancel an owned wait after cleanup. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture_concurrently.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture-concurrently\n \"Capture on bounded workers and cancel an explicitly classified wait.\"\n (:require [libtmux.async :as async]\n [libtmux.core :as tm])\n (:import [java.lang AutoCloseable]\n [java.time Duration]\n [java.util.concurrent CountDownLatch TimeUnit]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})\n ^AutoCloseable runtime (async/runtime! {:max-running 4 :queue-limit 4})]\n (let [panes (take 3 (tm/panes! server))\n tasks (mapv #(async/submit! runtime (fn [] (tm/capture! (:tmux/ref %)))) panes)\n captures (mapv deref tasks)\n started (CountDownLatch. 1)\n cleaned (promise)\n waiting (async/submit! runtime {:kind :wait}\n #(try\n (.countDown started)\n (tm/await-channel! server \"example-cancel\" (Duration/ofMillis 900))\n (finally (deliver cleaned true))))]\n (assert (= 3 (count captures)))\n (assert (every? vector? captures))\n (assert (.await started 900 TimeUnit/MILLISECONDS))\n (async/cancel! waiting)\n (let [failure (try @waiting nil (catch clojure.lang.ExceptionInfo error error))]\n (assert (= :cancelled (:tmux/error (ex-data failure))))\n (assert (realized? cleaned)))\n (println (str \"captured=\" (count captures)))\n (println \"cancelled=true cleaned=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture-concurrently\n"},{"lang":"text","intro":"Expected output:","code":"captured=3\ncancelled=true cleaned=true\n"}]},"slug":"libtmux-core-capture"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(chain! server operations)","params":[{"name":"server"},{"name":"operations"}]},{"raw":"(chain! server operations options)","params":[{"name":"server"},{"name":"operations"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/chain!","id":"libtmux.core/chain!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/chain!","name":"chain!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":589,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Runs dependent argv commands with tmux's implicit target between positions.","body":"Uses a fresh Java CommandChain. Failed/skipped outcomes are data; transport\nfailure throws with `:tmux/results.` Use `{:kind :wait}` for groups needing a\nrelease, including blocking shell commands. No rollback or retry safety is\npromised.\n[[batch!]] runs commands with explicit independent targets."},"slug":"libtmux-core-chain"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(clients! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/clients!","id":"libtmux.core/clients!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/clients!","name":"clients!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":162,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Acquires captured clients.","body":"[[detach-client!]] acts on a selected client reference."},"slug":"libtmux-core-clients"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(close! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/close!","id":"libtmux.core/close!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/close!","name":"close!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":301,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Releases the supplied Server's local resources without killing tmux.","body":"Local closure remains available after [[libtmux.async/cancel!]].\n[[open!]] creates another client."},"slug":"libtmux-core-close"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(delete-buffer! server name)","params":[{"name":"server"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/delete-buffer!","id":"libtmux.core/delete-buffer!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/delete-buffer!","name":"delete-buffer!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":490,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Deletes an explicit buffer.","body":"[[buffers!]] lists the remaining buffers."},"slug":"libtmux-core-delete-buffer"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(detach-client! client)","params":[{"name":"client"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/detach-client!","id":"libtmux.core/detach-client!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/detach-client!","name":"detach-client!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":395,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Detaches the explicit client.","body":"[[clients!]] acquires available clients; [[switch-client!]] changes their session."},"slug":"libtmux-core-detach-client"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(environment! value)","params":[{"name":"value"}]},{"raw":"(environment! value scope)","params":[{"name":"value"},{"name":"scope"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/environment!","id":"libtmux.core/environment!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/environment!","name":"environment!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":432,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Returns values and explicitly removed names, preserving removal versus absence.","body":"[[unset-environment!]] allows inheritance; [[remove-environment!]] masks a name."},"slug":"libtmux-core-environment"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(error-summary failure)","params":[{"name":"failure"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/error-summary","id":"libtmux.core/error-summary","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/error-summary","name":"error-summary","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":106,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Returns fixed error metadata without arguments or cause messages.","body":"Printing the original exception and its cause chain is not sanitized.\nUse this summary when handling failures from [[new-session!]] or [[batch!]]."},"slug":"libtmux-core-error-summary"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(expand! value format)","params":[{"name":"value"},{"name":"format"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/expand!","id":"libtmux.core/expand!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/expand!","name":"expand!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":365,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Evaluates an explicit tmux format at the supplied scope.","body":"[[capture!]] reads terminal lines rather than evaluating a tmux format."},"slug":"libtmux-core-expand"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(find-session! server name)","params":[{"name":"server"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/find-session!","id":"libtmux.core/find-session!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/find-session!","name":"find-session!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":166,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Finds a session by exact name; absence returns `nil`.","body":"Use [[sessions!]] when the selection needs ordinary Clojure predicates."},"slug":"libtmux-core-find-session"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(hooks! value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/hooks!","id":"libtmux.core/hooks!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/hooks!","name":"hooks!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":459,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Returns hook names and their ordered command vectors.","body":"[[set-hook!]] replaces commands; [[append-hook!]] preserves their order."},"slug":"libtmux-core-hooks"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(join-pane! pane window)","params":[{"name":"pane"},{"name":"window"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/join-pane!","id":"libtmux.core/join-pane!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/join-pane!","name":"join-pane!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":324,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Joins a pane to a window.","body":"[[split-pane!]] creates a new pane instead of relocating an existing one."},"slug":"libtmux-core-join-pane"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(kill! value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/kill!","id":"libtmux.core/kill!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/kill!","name":"kill!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":292,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Kills the explicitly supplied session, window, or pane.","body":"[[close!]] releases a client; [[kill-server!]] ends its entire tmux daemon."},"slug":"libtmux-core-kill"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(kill-server! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/kill-server!","id":"libtmux.core/kill-server!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/kill-server!","name":"kill-server!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":297,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Kills the explicit tmux server; [[close!]] only releases local resources."},"slug":"libtmux-core-kill-server"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(link-window! window session)","params":[{"name":"window"},{"name":"session"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/link-window!","id":"libtmux.core/link-window!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/link-window!","name":"link-window!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":309,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Links a window into a session.","body":"[[unlink-window!]] removes a placement; [[move-window!]] relocates one."},"slug":"libtmux-core-link-window"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(move-window! window session index)","params":[{"name":"window"},{"name":"session"},{"name":"index"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/move-window!","id":"libtmux.core/move-window!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/move-window!","name":"move-window!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":318,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Moves a window to a session and explicit index.","body":"Use [[snapshot!]] to find the new placement after moving.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-core-move-window"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(new-session! server options)","params":[{"name":"server"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/new-session!","id":"libtmux.core/new-session!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/new-session!","name":"new-session!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":242,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Creates a detached session and returns a fresh captured session map.","body":"Options are `:name`, `:window-name`, `:command` (nonempty argv vector), `:directory`\n(path), and `:environment` (string keys and values). Unknown keys are rejected.\nA recapture failure can occur after creation; inspect [[error-summary]] before\nretrying a mutation.","examples":[{"lang":"console","intro":"Create a session running cat. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/new_session.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.new-session\n \"Create a session running cat and inspect the replacement observation.\"\n (:require [libtmux.core :as tm]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [session (tm/new-session! server {:name \"api-session\" :command [\"/bin/cat\"]})]\n (assert (= \"api-session\" (:session/name session)))\n (println (str \"created=\" (:session/name session)))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/new_session.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.new-session\n"},{"lang":"text","intro":"Expected output:","code":"created=api-session\n"},{"lang":"console","intro":"Use a preserved Java Pane ref to read a command exit status and output. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/run_a_command.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.run-a-command\n \"Use the preserved Java Pane ref to observe a command's real exit status.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [io.github.libtmux Pane PaneRun PaneRun$Outcome]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"command-example\" :command [\"/bin/sh\"]})\n ^Pane pane (:tmux/ref (data/exactly-one (data/panes session)))\n ^PaneRun result (.run pane \"printf 'built\\\\n'; exit 3\" (Duration/ofMillis 900))]\n (assert (= PaneRun$Outcome/FINISHED (.outcome result)))\n (assert (= 3 (.orElseThrow (.exitStatus result))))\n (assert (= [\"built\"] (vec (.output result))))\n (println (str \"exit=\" (.orElseThrow (.exitStatus result))\n \" output=\" (str/join \" / \" (.output result))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/run_a_command.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.run-a-command\n"},{"lang":"text","intro":"Expected output:","code":"exit=3 output=built\n"}]},"slug":"libtmux-core-new-session"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(new-window! session options)","params":[{"name":"session"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/new-window!","id":"libtmux.core/new-window!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/new-window!","name":"new-window!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":254,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Creates a window and returns a fresh captured window occurrence.","body":"Takes a Session ref and `:name`, `:command` (argv), `:directory`, `:environment`,\n`:index` (nonnegative integer), and `:detached?` options.\nUse [[split-pane!]] to add panes within the new window.","examples":[{"lang":"console","intro":"Create a detached window and refresh its parent. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/new_window.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.new-window\n \"Create a detached window, then refresh its parent session.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [before (data/exactly-one\n (filter #(= \"work-one\" (:session/name %)) (tm/sessions! server)))\n window (tm/new-window! (:tmux/ref before)\n {:name \"api-window\" :command [\"/bin/cat\"]\n :detached? true})\n after (tm/refresh! (:tmux/ref before))]\n (assert (= 2 (count (data/windows before))))\n (assert (= 3 (count (data/windows after))))\n (println (str \"created=\" (:window/name window)))\n (println (str \"windows=\"\n (str/join \",\" (sort (map :window/name (data/windows after))))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/new_window.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.new-window\n"},{"lang":"text","intro":"Expected output:","code":"created=api-window\nwindows=api-window,editor,logs\n"}]},"slug":"libtmux-core-new-window"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(open! options)","params":[{"name":"options"}],"returns":"io.github.libtmux.Server"}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/open!","id":"libtmux.core/open!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/open!","name":"open!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":123,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Opens local resources for an explicit `:socket-path` or `:socket-name` endpoint.","body":"Supply exactly one endpoint. Paths accept String or java.nio.file.Path.\nOptional `:binary` is a command name or path; `:config-file` is a path;\n`:timeout` is a positive java.time.Duration. Unknown keys are rejected.\nReturns a Server for with-open; closing it does not kill tmux.\nUse [[snapshot!]] to acquire state and [[close!]] to release this client.","examples":[{"lang":"console","intro":"Connect to a private tmux server. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/connect.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.connect\n \"Connect to the private server supplied by run.sh.\"\n (:require [libtmux.core :as tm]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)]\n (assert (seq (:tmux/sessions snapshot)))\n (println \"connected=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/connect.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.connect\n"},{"lang":"text","intro":"Expected output:","code":"connected=true\n"}]},"slug":"libtmux-core-open"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(options! value)","params":[{"name":"value"}]},{"raw":"(options! value scope)","params":[{"name":"value"},{"name":"scope"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/options!","id":"libtmux.core/options!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/options!","name":"options!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":411,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Reads `:local` options by default, or `:effective` inherited options.","body":"[[set-option!]] sets an override; [[unset-option!]] restores inheritance."},"slug":"libtmux-core-options"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(panes! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/panes!","id":"libtmux.core/panes!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/panes!","name":"panes!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":159,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Acquires captured pane occurrences.","body":"Use [[capture!]] for terminal contents or [[libtmux.data/data]] for detached EDN."},"slug":"libtmux-core-panes"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(paste-buffer! pane name)","params":[{"name":"pane"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/paste-buffer!","id":"libtmux.core/paste-buffer!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/paste-buffer!","name":"paste-buffer!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":495,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Pastes an explicit buffer into a pane.","body":"[[set-buffer!]] supplies contents; [[await-text!]] observes pane output."},"slug":"libtmux-core-paste-buffer"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(raw! server argv)","params":[{"name":"server"},{"name":"argv"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/raw!","id":"libtmux.core/raw!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/raw!","name":"raw!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":371,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Runs explicit tmux argv and returns exit status and streams; no shell.","body":"Use [[batch!]] for independent commands or [[chain!]] for dependent targets."},"slug":"libtmux-core-raw"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(refresh! entry)","params":[{"name":"entry"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/refresh!","id":"libtmux.core/refresh!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/refresh!","name":"refresh!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":187,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Reacquires an explicit reference, retaining window and pane placement.","body":"Returns `nil` if that occurrence disappeared; server failure throws.\nCompare identity with [[libtmux.data/same-entity?]]; map equality compares observations.","examples":[{"lang":"console","intro":"Create a detached window and refresh its parent. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/new_window.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.new-window\n \"Create a detached window, then refresh its parent session.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [before (data/exactly-one\n (filter #(= \"work-one\" (:session/name %)) (tm/sessions! server)))\n window (tm/new-window! (:tmux/ref before)\n {:name \"api-window\" :command [\"/bin/cat\"]\n :detached? true})\n after (tm/refresh! (:tmux/ref before))]\n (assert (= 2 (count (data/windows before))))\n (assert (= 3 (count (data/windows after))))\n (println (str \"created=\" (:window/name window)))\n (println (str \"windows=\"\n (str/join \",\" (sort (map :window/name (data/windows after))))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/new_window.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.new-window\n"},{"lang":"text","intro":"Expected output:","code":"created=api-window\nwindows=api-window,editor,logs\n"}]},"slug":"libtmux-core-refresh"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(remove-environment! value name)","params":[{"name":"value"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/remove-environment!","id":"libtmux.core/remove-environment!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/remove-environment!","name":"remove-environment!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":453,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Marks an environment name removed for new child processes.","body":"[[unset-environment!]] removes that local marker and allows inheritance."},"slug":"libtmux-core-remove-environment"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(rename! value name)","params":[{"name":"value"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/rename!","id":"libtmux.core/rename!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/rename!","name":"rename!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":282,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Renames a session or window and captures its current data.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-core-rename"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(resize! value width height)","params":[{"name":"value"},{"name":"width"},{"name":"height"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/resize!","id":"libtmux.core/resize!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/resize!","name":"resize!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":328,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Resizes a window or pane to positive cell dimensions.","body":"[[apply-layout!]] arranges all panes in a window."},"slug":"libtmux-core-resize"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(run-shell! server command)","params":[{"name":"server"},{"name":"command"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/run-shell!","id":"libtmux.core/run-shell!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/run-shell!","name":"run-shell!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":378,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Runs an explicitly requested shell command on the server.","body":"[[raw!]] accepts tmux argv; [[await-channel!]] can gate an explicit completion signal."},"slug":"libtmux-core-run-shell"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(select! value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/select!","id":"libtmux.core/select!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/select!","name":"select!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":287,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Selects the preserved window or pane occurrence.","body":"[[refresh!]] acquires the resulting selection state."},"slug":"libtmux-core-select"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(send-keys! pane keys)","params":[{"name":"pane"},{"name":"keys"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/send-keys!","id":"libtmux.core/send-keys!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/send-keys!","name":"send-keys!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":344,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Sends an explicit vector of tmux key names.","body":"Use [[send-literal!]] for text and [[await-text!]] for observed output.","examples":[{"lang":"console","intro":"Send literal shell input and wait for actual output before capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture\n \"Send literal shell input, wait for its output, and verify captured lines.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [session (tm/new-session! server {:name \"api-capture\" :command [\"/bin/sh\"]})\n pane (:tmux/ref (data/exactly-one (data/panes session)))]\n (doseq [word [\"keys\" \"line\"]]\n (tm/send-literal! pane (str \"printf 'api-%s\\\\n' \" word))\n (tm/send-keys! pane [\"Enter\"])\n (when-not (#{:appeared :present-at-entry}\n (tm/await-text! pane (str \"api-\" word) (Duration/ofMillis 900)))\n (throw (IllegalStateException. \"shell output did not arrive\"))))\n (let [lines (set (map str/trim (tm/capture! pane)))]\n (doseq [expected [\"api-keys\" \"api-line\"]]\n (assert (contains? lines expected) (str \"capture is missing \" expected))\n (println expected)))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture\n"},{"lang":"text","intro":"Expected output:","code":"api-keys\napi-line\n"}]},"slug":"libtmux-core-send-keys"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(send-literal! pane text)","params":[{"name":"pane"},{"name":"text"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/send-literal!","id":"libtmux.core/send-literal!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/send-literal!","name":"send-literal!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":339,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Sends literal text; completion does not mean application readiness.","body":"[[send-keys!]] sends key names; [[await-text!]] checks observed output.","examples":[{"lang":"console","intro":"Send literal shell input and wait for actual output before capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture\n \"Send literal shell input, wait for its output, and verify captured lines.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [session (tm/new-session! server {:name \"api-capture\" :command [\"/bin/sh\"]})\n pane (:tmux/ref (data/exactly-one (data/panes session)))]\n (doseq [word [\"keys\" \"line\"]]\n (tm/send-literal! pane (str \"printf 'api-%s\\\\n' \" word))\n (tm/send-keys! pane [\"Enter\"])\n (when-not (#{:appeared :present-at-entry}\n (tm/await-text! pane (str \"api-\" word) (Duration/ofMillis 900)))\n (throw (IllegalStateException. \"shell output did not arrive\"))))\n (let [lines (set (map str/trim (tm/capture! pane)))]\n (doseq [expected [\"api-keys\" \"api-line\"]]\n (assert (contains? lines expected) (str \"capture is missing \" expected))\n (println expected)))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture\n"},{"lang":"text","intro":"Expected output:","code":"api-keys\napi-line\n"}]},"slug":"libtmux-core-send-literal"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(sessions! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/sessions!","id":"libtmux.core/sessions!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/sessions!","name":"sessions!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":153,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Acquires captured sessions; acquisition failure throws.","body":"[[libtmux.data/windows]] traverses each session without another acquisition.","examples":[{"lang":"console","intro":"List sessions from one capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/list_sessions.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.list-sessions\n \"List the sessions returned by one server capture.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (println (str \"sessions=\"\n (str/join \",\" (sort (map :session/name (tm/sessions! server)))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/list_sessions.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.list-sessions\n"},{"lang":"text","intro":"Expected output:","code":"sessions=work-one,work-two\n"}]},"slug":"libtmux-core-sessions"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(set-buffer! server name text)","params":[{"name":"server"},{"name":"name"},{"name":"text"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/set-buffer!","id":"libtmux.core/set-buffer!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/set-buffer!","name":"set-buffer!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":480,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Stores literal buffer contents.","body":"[[show-buffer!]] reads the text; [[paste-buffer!]] sends it to a pane."},"slug":"libtmux-core-set-buffer"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(set-environment! value name text)","params":[{"name":"value"},{"name":"name"},{"name":"text"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/set-environment!","id":"libtmux.core/set-environment!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/set-environment!","name":"set-environment!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":443,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Sets a literal environment value.","body":"[[environment!]] reads values and explicitly removed names."},"slug":"libtmux-core-set-environment"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(set-hook! value event argv)","params":[{"name":"value"},{"name":"event"},{"name":"argv"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/set-hook!","id":"libtmux.core/set-hook!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/set-hook!","name":"set-hook!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":464,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Replaces a hook with one explicit tmux argv command.","body":"[[append-hook!]] adds a command; [[unset-hook!]] removes the hook."},"slug":"libtmux-core-set-hook"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(set-option! value name text)","params":[{"name":"value"},{"name":"name"},{"name":"text"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/set-option!","id":"libtmux.core/set-option!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/set-option!","name":"set-option!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":421,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Sets a literal option value at the explicit scope.","body":"Read it with [[options!]]; remove the override with [[unset-option!]]."},"slug":"libtmux-core-set-option"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(show-buffer! server name)","params":[{"name":"server"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/show-buffer!","id":"libtmux.core/show-buffer!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/show-buffer!","name":"show-buffer!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":485,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Reads literal buffer contents.","body":"[[buffers!]] lists names and sizes without reading their contents."},"slug":"libtmux-core-show-buffer"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(signal-channel! server name)","params":[{"name":"server"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/signal-channel!","id":"libtmux.core/signal-channel!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/signal-channel!","name":"signal-channel!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":524,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Signals an explicit tmux channel.","body":"Releases a corresponding [[await-channel!]] wait."},"slug":"libtmux-core-signal-channel"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(snapshot! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/snapshot!","id":"libtmux.core/snapshot!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/snapshot!","name":"snapshot!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":147,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Acquires an eager captured graph from an explicit server.","body":"Traverse one observation with [[libtmux.data/windows]] and [[libtmux.data/panes]].","examples":[{"lang":"console","intro":"Connect to a private tmux server. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/connect.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.connect\n \"Connect to the private server supplied by run.sh.\"\n (:require [libtmux.core :as tm]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)]\n (assert (seq (:tmux/sessions snapshot)))\n (println \"connected=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/connect.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.connect\n"},{"lang":"text","intro":"Expected output:","code":"connected=true\n"},{"lang":"console","intro":"Traverse root and session windows in one captured graph. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/list_windows.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.list-windows\n \"Traverse root and session windows from the same captured graph.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)\n session (data/exactly-one\n (filter #(= \"work-one\" (:session/name %))\n (:tmux/sessions snapshot)))]\n (println (str \"windows=\"\n (str/join \",\" (sort (map :window/name (data/windows snapshot))))))\n (println (str \"session-windows=\"\n (str/join \",\" (sort (map :window/name (data/windows session))))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/list_windows.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.list-windows\n"},{"lang":"text","intro":"Expected output:","code":"windows=editor,editor,logs\nsession-windows=editor,logs\n"},{"lang":"console","intro":"Traverse root, session, window and pane observations. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/list_panes.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.list-panes\n \"Traverse session, window and pane observations without another acquisition.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)\n session (data/exactly-one\n (filter #(= \"work-one\" (:session/name %))\n (:tmux/sessions snapshot)))\n window (data/exactly-one\n (filter #(= \"editor\" (:window/name %)) (data/windows session)))]\n (println (str \"panes=\" (count (data/panes snapshot))))\n (println (str \"window-panes=\" (count (data/panes window))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/list_panes.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.list-panes\n"},{"lang":"text","intro":"Expected output:","code":"panes=4\nwindow-panes=2\n"}]},"slug":"libtmux-core-snapshot"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(split-pane! pane options)","params":[{"name":"pane"},{"name":"options"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/split-pane!","id":"libtmux.core/split-pane!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/split-pane!","name":"split-pane!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":265,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Splits a Pane ref and returns a fresh captured pane occurrence.","body":"Options are `:command` (argv), `:directory`, `:environment`, `:direction`\n(`:below`, `:above`, `:right`, `:left`), `:cells` or `:percent` (mutually exclusive),\n`:detached?`, `:empty?`, `:full-window?`, and `:zoomed?.` `:empty?` excludes `:command.`\nA single argv element is executed literally, without shell interpolation.\nUse [[apply-layout!]] to arrange the resulting window.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-core-split-pane"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(switch-client! client session)","params":[{"name":"client"},{"name":"session"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/switch-client!","id":"libtmux.core/switch-client!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/switch-client!","name":"switch-client!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":399,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Switches an explicit client to a session.","body":"[[detach-client!]] disconnects a client instead of switching its session."},"slug":"libtmux-core-switch-client"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(unlink-window! window)","params":[{"name":"window"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/unlink-window!","id":"libtmux.core/unlink-window!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/unlink-window!","name":"unlink-window!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":314,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Unlinks the preserved window occurrence.","body":"[[libtmux.data/same-link?]] distinguishes contextual placements."},"slug":"libtmux-core-unlink-window"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(unset-environment! value name)","params":[{"name":"value"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/unset-environment!","id":"libtmux.core/unset-environment!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/unset-environment!","name":"unset-environment!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":448,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Removes the local environment entry, allowing inheritance.","body":"[[remove-environment!]] masks a name instead of allowing inheritance."},"slug":"libtmux-core-unset-environment"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(unset-hook! value event)","params":[{"name":"value"},{"name":"event"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/unset-hook!","id":"libtmux.core/unset-hook!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/unset-hook!","name":"unset-hook!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":474,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Removes an explicit hook.","body":"[[hooks!]] reads the remaining hooks."},"slug":"libtmux-core-unset-hook"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(unset-option! value name)","params":[{"name":"value"},{"name":"name"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/unset-option!","id":"libtmux.core/unset-option!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/unset-option!","name":"unset-option!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":426,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Removes a local option override.","body":"[[options!]] can read the resulting effective value."},"slug":"libtmux-core-unset-option"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(windows! server)","params":[{"name":"server"}]}],"publicOwner":"libtmux.core","parent":"libtmux.core","publicId":"libtmux.core/windows!","id":"libtmux.core/windows!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core/windows!","name":"windows!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/core.clj","line":156,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core","doc":{"summary":"Acquires captured window occurrences.","body":"[[libtmux.data/panes]] traverses these occurrences without another acquisition."},"slug":"libtmux-core-windows"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(ns libtmux.data)","params":[]}],"publicOwner":"libtmux.data","publicId":"libtmux.data","id":"libtmux.data","apiScope":"exported","product":"core","qualifiedName":"libtmux.data","name":"libtmux.data","modifiers":[],"kind":"module","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":1,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Pure captured values from [[libtmux.core/snapshot!]].","body":"Traverse with [[windows]] and [[panes]], select with [[matching]], or detach with [[data]]."},"slug":"libtmux-data"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(active-pane value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/active-pane","id":"libtmux.data/active-pane","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/active-pane","name":"active-pane","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":149,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the captured active pane of a window or session, or `nil`.","body":"[[panes]] returns all captured occurrences; [[libtmux.core/select!]] changes selection."},"slug":"libtmux-data-active-pane"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(active-window session)","params":[{"name":"session"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/active-window","id":"libtmux.data/active-window","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/active-window","name":"active-window","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":143,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the captured active window of a session, or `nil`.","body":"[[windows]] returns all captured occurrences; [[active-pane]] follows the active one."},"slug":"libtmux-data-active-window"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(data value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/data","id":"libtmux.data/data","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/data","name":"data","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":44,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Projects captured data to EDN, removing `:tmux/ref` at every map level.","body":"Instants become ISO-8601 strings; sequences and Java lists become vectors.\nUnsupported JVM objects throw rather than producing unreadable EDN.\nDetached results cannot be used by [[predicate]]; [[entity-key]] remains explicit data."},"slug":"libtmux-data-data"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(entity-key entry)","params":[{"name":"entry"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/entity-key","id":"libtmux.data/entity-key","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/entity-key","name":"entity-key","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":64,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns a captured physical identity, qualified by endpoint and server PID.","body":"PID reuse is not a stronger daemon-incarnation guarantee.\n[[link-key]] also includes placement; [[same-entity?]] compares physical identities."},"slug":"libtmux-data-entity-key"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(exactly-one values)","params":[{"name":"values"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/exactly-one","id":"libtmux.data/exactly-one","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/exactly-one","name":"exactly-one","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":31,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the only value or throws `ex-info` for zero or multiple values.","body":"Stops requesting matches once ambiguity is known. Finding zero or one may\nscan all input; chunked producers may realize more. `nil` and `false` are values.\n[[one-or-none]] accepts an empty selection; establish cardinality before effects.","examples":[{"lang":"console","intro":"Evaluate native and Java predicates over the same capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/query.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.query\n \"Compare a native predicate and Java expression on the same captured values.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [io.github.libtmux Session_]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [sessions (tm/sessions! server)\n native (filterv #(= \"work-one\" (:session/name %)) sessions)\n expression (.is (Session_/name) \"work-one\")\n canonical (into [] (data/matching expression) sessions)]\n (assert (= native canonical))\n (assert (= \"work-one\" (:session/name (data/exactly-one canonical))))\n (println (str \"matches=\" (str/join \",\" (map :session/name native))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/query.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.query\n"},{"lang":"text","intro":"Expected output:","code":"matches=work-one\n"}]},"slug":"libtmux-data-exactly-one"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(from-capture capture)","params":[{"name":"capture","type":"io.github.libtmux.CapturedServer"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/from-capture","id":"libtmux.data/from-capture","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/from-capture","name":"from-capture","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":222,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Converts an authenticated Java CapturedServer to eager persistent values.","body":"Reads no live getters and issues no commands. Relations share these values;\nwindow links and pane occurrences retain their captured order and placement.\n[[libtmux.core/snapshot!]] acquires this Java capture and projects it for callers."},"slug":"libtmux-data-from-capture"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(link-key entry)","params":[{"name":"entry"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/link-key","id":"libtmux.data/link-key","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/link-key","name":"link-key","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":76,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the physical identity and contextual window placement.","body":"Only window and pane occurrences carry a link; missing context throws.\n[[entity-key]] omits placement; [[same-link?]] compares contextual occurrences."},"slug":"libtmux-data-link-key"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(matching expression)","params":[{"name":"expression"}]},{"raw":"(matching expression entries)","params":[{"name":"expression"},{"name":"entries"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/matching","id":"libtmux.data/matching","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/matching","name":"matching","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":119,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Filters captured entries using a Java FilterExpr over their preserved refs.","body":"One argument returns a transducer; two return a lazy sequence. Both are local\nand preserve order and multiplicity. Detached maps have no query reference.\nDelegates to [[predicate]]; [[exactly-one]] checks the resulting cardinality.","examples":[{"lang":"console","intro":"Evaluate native and Java predicates over the same capture. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/query.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.query\n \"Compare a native predicate and Java expression on the same captured values.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [io.github.libtmux Session_]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [sessions (tm/sessions! server)\n native (filterv #(= \"work-one\" (:session/name %)) sessions)\n expression (.is (Session_/name) \"work-one\")\n canonical (into [] (data/matching expression) sessions)]\n (assert (= native canonical))\n (assert (= \"work-one\" (:session/name (data/exactly-one canonical))))\n (println (str \"matches=\" (str/join \",\" (map :session/name native))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/query.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.query\n"},{"lang":"text","intro":"Expected output:","code":"matches=work-one\n"}]},"slug":"libtmux-data-matching"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(one-or-none values)","params":[{"name":"values"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/one-or-none","id":"libtmux.data/one-or-none","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/one-or-none","name":"one-or-none","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":20,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the only value, `nil` for none, or throws for multiple values.","body":"Stops requesting matches once ambiguity is known. Finding zero or one may\nscan all input; chunked producers may realize more. `nil` and `false` are values.\nUse [[exactly-one]] when zero matches must also fail."},"slug":"libtmux-data-one-or-none"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(panes value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/panes","id":"libtmux.data/panes","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/panes","name":"panes","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":134,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns captured pane occurrences in a snapshot, session, or window.","body":"Use [[libtmux.core/panes!]] for a new acquisition; [[active-pane]] selects locally.","examples":[{"lang":"console","intro":"Traverse root, session, window and pane observations. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/list_panes.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.list-panes\n \"Traverse session, window and pane observations without another acquisition.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)\n session (data/exactly-one\n (filter #(= \"work-one\" (:session/name %))\n (:tmux/sessions snapshot)))\n window (data/exactly-one\n (filter #(= \"editor\" (:window/name %)) (data/windows session)))]\n (println (str \"panes=\" (count (data/panes snapshot))))\n (println (str \"window-panes=\" (count (data/panes window))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/list_panes.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.list-panes\n"},{"lang":"text","intro":"Expected output:","code":"panes=4\nwindow-panes=2\n"},{"lang":"console","intro":"Use a preserved Java Pane ref to read a command exit status and output. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/run_a_command.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.run-a-command\n \"Use the preserved Java Pane ref to observe a command's real exit status.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [io.github.libtmux Pane PaneRun PaneRun$Outcome]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"command-example\" :command [\"/bin/sh\"]})\n ^Pane pane (:tmux/ref (data/exactly-one (data/panes session)))\n ^PaneRun result (.run pane \"printf 'built\\\\n'; exit 3\" (Duration/ofMillis 900))]\n (assert (= PaneRun$Outcome/FINISHED (.outcome result)))\n (assert (= 3 (.orElseThrow (.exitStatus result))))\n (assert (= [\"built\"] (vec (.output result))))\n (println (str \"exit=\" (.orElseThrow (.exitStatus result))\n \" output=\" (str/join \" / \" (.output result))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/run_a_command.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.run-a-command\n"},{"lang":"text","intro":"Expected output:","code":"exit=3 output=built\n"}]},"slug":"libtmux-data-panes"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(predicate expression)","params":[{"name":"expression","type":"io.github.libtmux.query.FilterExpr"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/predicate","id":"libtmux.data/predicate","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/predicate","name":"predicate","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":102,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Adapts a Java FilterExpr to a predicate over captured entries.","body":"Evaluates the preserved `:tmux/ref`, including Java relation semantics;\nediting fields in an entry does not change the reference being queried.\n[[matching]] provides transducer and sequence arities; [[data]] removes refs."},"slug":"libtmux-data-predicate"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(same-entity? left right)","params":[{"name":"left"},{"name":"right"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/same-entity?","id":"libtmux.data/same-entity?","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/same-entity?","name":"same-entity?","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":90,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Compares physical entity identities without acquiring current state.","body":"Uses [[entity-key]]; [[same-link?]] also checks placement.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-data-same-entity"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(same-link? left right)","params":[{"name":"left"},{"name":"right"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/same-link?","id":"libtmux.data/same-link?","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/same-link?","name":"same-link?","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":96,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Compares occurrences, including the session, window ID, and index.","body":"Uses [[link-key]]; [[same-entity?]] ignores placement.","examples":[{"lang":"console","intro":"Build a split layout, rename a window and follow its moved placement. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/workspace.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.workspace\n \"Build a layout, rename a window, and follow its new placement after a move.\"\n (:require [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [source (tm/new-session! server {:name \"workspace\" :window-name \"editor\"\n :command [\"/bin/cat\"]})\n editor (data/exactly-one (data/windows source))\n pane (data/exactly-one (data/panes editor))\n destination (tm/new-session! server {:name \"destination\" :command [\"/bin/cat\"]})]\n (tm/new-window! (:tmux/ref source) {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/split-pane! (:tmux/ref pane) {:direction :right :percent 40 :command [\"/bin/cat\"]})\n (let [layout (:window/layout (tm/refresh! (:tmux/ref editor)))]\n (tm/apply-layout! (:tmux/ref editor) layout))\n (let [renamed (tm/rename! (:tmux/ref editor) \"code\")]\n (assert (= \"editor\" (:window/name editor)))\n (assert (= \"code\" (:window/name renamed)))\n (tm/move-window! (:tmux/ref renamed) (:tmux/ref destination) 5))\n (let [moved (data/exactly-one\n (filter #(= (:window/id editor) (:window/id %)) (tm/windows! server)))]\n (assert (data/same-entity? editor moved))\n (assert (not (data/same-link? editor moved)))\n (assert (= (:session/id destination) (get-in moved [:tmux/link :session/id])))\n (assert (= 5 (:window/index moved)))\n (assert (= 2 (count (data/panes moved))))\n (println (str \"window=\" (:window/name moved) \" panes=\" (count (data/panes moved))))\n (println \"same-entity=true same-placement=false\"))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/workspace.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.workspace\n"},{"lang":"text","intro":"Expected output:","code":"window=code panes=2\nsame-entity=true same-placement=false\n"}]},"slug":"libtmux-data-same-link"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(windows value)","params":[{"name":"value"}]}],"publicOwner":"libtmux.data","parent":"libtmux.data","publicId":"libtmux.data/windows","id":"libtmux.data/windows","apiScope":"exported","product":"core","qualifiedName":"libtmux.data/windows","name":"windows","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/data.clj","line":127,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.data","doc":{"summary":"Returns the captured window occurrences in a snapshot or session.","body":"Use [[libtmux.core/windows!]] for a new acquisition; [[panes]] stays local.","examples":[{"lang":"console","intro":"Traverse root and session windows in one captured graph. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/list_windows.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.list-windows\n \"Traverse root and session windows from the same captured graph.\"\n (:require [clojure.string :as str]\n [libtmux.core :as tm]\n [libtmux.data :as data]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket\n :config-file config})]\n (let [snapshot (tm/snapshot! server)\n session (data/exactly-one\n (filter #(= \"work-one\" (:session/name %))\n (:tmux/sessions snapshot)))]\n (println (str \"windows=\"\n (str/join \",\" (sort (map :window/name (data/windows snapshot))))))\n (println (str \"session-windows=\"\n (str/join \",\" (sort (map :window/name (data/windows session))))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/list_windows.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.list-windows\n"},{"lang":"text","intro":"Expected output:","code":"windows=editor,editor,logs\nsession-windows=editor,logs\n"}]},"slug":"libtmux-data-windows"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(ns libtmux.async)","params":[]}],"publicOwner":"libtmux.async","publicId":"libtmux.async","id":"libtmux.async","apiScope":"exported","product":"core","qualifiedName":"libtmux.async","name":"libtmux.async","modifiers":[],"kind":"module","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":1,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Bounded owned workers from [[runtime!]] and cancellable [[submit!]] tasks.","body":"[[completion-stage]] and [[then!]] expose Java interop with explicit scheduling."},"slug":"libtmux-async"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(cancel! task)","params":[{"name":"task"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/cancel!","id":"libtmux.async/cancel!","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/cancel!","name":"cancel!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":182,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Requests cancellation. The first accepted cancellation reason wins.","body":"[[task-state]] distinguishes cancelling from terminal; dereference only settles after cleanup.","examples":[{"lang":"console","intro":"Capture with bounded workers and cancel an owned wait after cleanup. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture_concurrently.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture-concurrently\n \"Capture on bounded workers and cancel an explicitly classified wait.\"\n (:require [libtmux.async :as async]\n [libtmux.core :as tm])\n (:import [java.lang AutoCloseable]\n [java.time Duration]\n [java.util.concurrent CountDownLatch TimeUnit]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})\n ^AutoCloseable runtime (async/runtime! {:max-running 4 :queue-limit 4})]\n (let [panes (take 3 (tm/panes! server))\n tasks (mapv #(async/submit! runtime (fn [] (tm/capture! (:tmux/ref %)))) panes)\n captures (mapv deref tasks)\n started (CountDownLatch. 1)\n cleaned (promise)\n waiting (async/submit! runtime {:kind :wait}\n #(try\n (.countDown started)\n (tm/await-channel! server \"example-cancel\" (Duration/ofMillis 900))\n (finally (deliver cleaned true))))]\n (assert (= 3 (count captures)))\n (assert (every? vector? captures))\n (assert (.await started 900 TimeUnit/MILLISECONDS))\n (async/cancel! waiting)\n (let [failure (try @waiting nil (catch clojure.lang.ExceptionInfo error error))]\n (assert (= :cancelled (:tmux/error (ex-data failure))))\n (assert (realized? cleaned)))\n (println (str \"captured=\" (count captures)))\n (println \"cancelled=true cleaned=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture-concurrently\n"},{"lang":"text","intro":"Expected output:","code":"captured=3\ncancelled=true cleaned=true\n"}]},"slug":"libtmux-async-cancel"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(close-runtime! runtime)","params":[{"name":"runtime","type":"libtmux.async.AsyncRuntime"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/close-runtime!","id":"libtmux.async/close-runtime!","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/close-runtime!","name":"close-runtime!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":332,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Cancels owned tasks and callbacks and shuts down the runtime's executors.","body":"Waits within `:close-timeout-ms.` Interruption-resistant work can outlive that\nbudget; it cannot be forcibly stopped. Pending cleanup throws `ex-info` with\n`:tmux/error` `:cleanup-pending.` Safe to call again; returns `nil` after cleanup.\n[[task-state]] keeps incomplete cleanup observable; [[cancel!]] targets one task."},"slug":"libtmux-async-close-runtime"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(completion-stage task)","params":[{"name":"task","type":"libtmux.async.Task"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/completion-stage","id":"libtmux.async/completion-stage","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/completion-stage","name":"completion-stage","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":101,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Returns a read-only CompletionStage completed after worker cleanup.","body":"Completing or cancelling a derived CompletableFuture does not control the\ntask; use [[cancel!]]. Caller-attached callbacks follow Java stage scheduling.\n[[then!]] schedules bounded continuations; [[task-state]] exposes pending cleanup."},"slug":"libtmux-async-completion-stage"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(runtime!)","params":[]},{"raw":"(runtime! options)","params":[{"name":"options"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/runtime!","id":"libtmux.async/runtime!","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/runtime!","name":"runtime!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":59,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Creates a closeable runtime owning bounded work, wait and callback lanes.","body":"Options are `:max-running` (default 4, minimum 2), `:queue-limit` (default 64,\npositive), and `:close-timeout-ms` (default 900, positive). One running slot is\nreserved for waits so ordinary work can release them. Closing cancels owned\nwork and waits within the close budget; it never closes borrowed servers.\nSubmit with [[submit!]]; [[close-runtime!]] documents incomplete cleanup.","examples":[{"lang":"console","intro":"Capture with bounded workers and cancel an owned wait after cleanup. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture_concurrently.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture-concurrently\n \"Capture on bounded workers and cancel an explicitly classified wait.\"\n (:require [libtmux.async :as async]\n [libtmux.core :as tm])\n (:import [java.lang AutoCloseable]\n [java.time Duration]\n [java.util.concurrent CountDownLatch TimeUnit]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})\n ^AutoCloseable runtime (async/runtime! {:max-running 4 :queue-limit 4})]\n (let [panes (take 3 (tm/panes! server))\n tasks (mapv #(async/submit! runtime (fn [] (tm/capture! (:tmux/ref %)))) panes)\n captures (mapv deref tasks)\n started (CountDownLatch. 1)\n cleaned (promise)\n waiting (async/submit! runtime {:kind :wait}\n #(try\n (.countDown started)\n (tm/await-channel! server \"example-cancel\" (Duration/ofMillis 900))\n (finally (deliver cleaned true))))]\n (assert (= 3 (count captures)))\n (assert (every? vector? captures))\n (assert (.await started 900 TimeUnit/MILLISECONDS))\n (async/cancel! waiting)\n (let [failure (try @waiting nil (catch clojure.lang.ExceptionInfo error error))]\n (assert (= :cancelled (:tmux/error (ex-data failure))))\n (assert (realized? cleaned)))\n (println (str \"captured=\" (count captures)))\n (println \"cancelled=true cleaned=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture-concurrently\n"},{"lang":"text","intro":"Expected output:","code":"captured=3\ncancelled=true cleaned=true\n"}]},"slug":"libtmux-async-runtime"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(submit! runtime thunk)","params":[{"name":"runtime"},{"name":"thunk"}]},{"raw":"(submit! runtime options thunk)","params":[{"name":"runtime","type":"libtmux.async.AsyncRuntime"},{"name":"options"},{"name":"thunk"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/submit!","id":"libtmux.async/submit!","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/submit!","name":"submit!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":190,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Submits a zero-argument function with the caller's dynamic bindings.","body":"Options are `:kind` (`:ordinary` by default, or `:wait`) and a positive\n`:timeout-ms` deadline including queue time. Returns a dereferenceable Task\nor `{:status :busy :kind kind}` when admission is full. Timed deref does not\ncancel a task; [[cancel!]] or its deadline interrupts owned work. Effects that\nwait require `:wait.` Exceptions retain dispatch certainty and partial results.","examples":[{"lang":"console","intro":"Capture with bounded workers and cancel an owned wait after cleanup. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/capture_concurrently.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.capture-concurrently\n \"Capture on bounded workers and cancel an explicitly classified wait.\"\n (:require [libtmux.async :as async]\n [libtmux.core :as tm])\n (:import [java.lang AutoCloseable]\n [java.time Duration]\n [java.util.concurrent CountDownLatch TimeUnit]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})\n ^AutoCloseable runtime (async/runtime! {:max-running 4 :queue-limit 4})]\n (let [panes (take 3 (tm/panes! server))\n tasks (mapv #(async/submit! runtime (fn [] (tm/capture! (:tmux/ref %)))) panes)\n captures (mapv deref tasks)\n started (CountDownLatch. 1)\n cleaned (promise)\n waiting (async/submit! runtime {:kind :wait}\n #(try\n (.countDown started)\n (tm/await-channel! server \"example-cancel\" (Duration/ofMillis 900))\n (finally (deliver cleaned true))))]\n (assert (= 3 (count captures)))\n (assert (every? vector? captures))\n (assert (.await started 900 TimeUnit/MILLISECONDS))\n (async/cancel! waiting)\n (let [failure (try @waiting nil (catch clojure.lang.ExceptionInfo error error))]\n (assert (= :cancelled (:tmux/error (ex-data failure))))\n (assert (realized? cleaned)))\n (println (str \"captured=\" (count captures)))\n (println \"cancelled=true cleaned=true\")))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.capture-concurrently\n"},{"lang":"text","intro":"Expected output:","code":"captured=3\ncancelled=true cleaned=true\n"},{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-async-submit"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(task-kind task)","params":[{"name":"task","type":"libtmux.async.Task"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/task-kind","id":"libtmux.async/task-kind","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/task-kind","name":"task-kind","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":92,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Returns the declared `:ordinary` or `:wait` lane without waiting for the task.","body":"Declared by [[submit!]]; [[task-state]] reports execution and cleanup progress."},"slug":"libtmux-async-task-kind"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(task-state task)","params":[{"name":"task","type":"libtmux.async.Task"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/task-state","id":"libtmux.async/task-state","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/task-state","name":"task-state","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":96,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Reads task progress: `:queued`, `:running`, `:cancelling`, `:cleanup-pending`,","body":"or `:terminal.` A cancellation request is not proof cleanup has finished.\n[[cancel!]] requests interruption; [[completion-stage]] settles after cleanup."},"slug":"libtmux-async-task-state"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(then! runtime task f)","params":[{"name":"runtime","type":"libtmux.async.AsyncRuntime"},{"name":"task","type":"libtmux.async.Task"},{"name":"f"}]}],"publicOwner":"libtmux.async","parent":"libtmux.async","publicId":"libtmux.async/then!","id":"libtmux.async/then!","apiScope":"exported","product":"core","qualifiedName":"libtmux.async/then!","name":"then!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/async.clj","line":285,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.async","doc":{"summary":"Returns a read-only CompletionStage applying `f` after successful task cleanup.","body":"Runs on the runtime's bounded callback lane with the caller's dynamic\nbindings. Full callback admission throws `ex-info` with `:tmux/error` `:busy.`\nClosing the runtime cancels queued callbacks and interrupts active ones.\nAfter [[close-runtime!]], callbacks cannot issue later tmux calls.\n[[completion-stage]] exposes ordinary Java stage scheduling instead."},"slug":"libtmux-async-then"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(ns libtmux.control)","params":[]}],"publicOwner":"libtmux.control","publicId":"libtmux.control","id":"libtmux.control","apiScope":"exported","product":"core","qualifiedName":"libtmux.control","name":"libtmux.control","modifiers":[],"kind":"module","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":1,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Explicit control replies through [[attach!]] and [[send!]].","body":"[[subscribe!]], [[next!]], and [[terminal]] expose owned bounded output streams.\nControl needs tmux 3.7 or newer; an older daemon is refused before\nany client is attached, with `:tmux/error` `:tmux/unsupported-feature`."},"slug":"libtmux-control"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(attach! session)","params":[{"name":"session"}]},{"raw":"(attach! session timeout)","params":[{"name":"session"},{"name":"timeout"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/attach!","id":"libtmux.control/attach!","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/attach!","name":"attach!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":60,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Attaches an owned control client to an explicit captured Session reference.","body":"Close releases this client, never its server. Use a dedicated connection\nwhen cancellation must not affect other requests and subscriptions.\n[[send!]] sends protocol argv; [[subscribe!]] observes output on this connection.","examples":[{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-attach"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(close! resource)","params":[{"name":"resource"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/close!","id":"libtmux.control/close!","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/close!","name":"close!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":252,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Closes a connection or subscription. Closing a subscription leaves its","body":"borrowed connection open; closing a connection affects all its subscribers.\nLocal closure remains available after [[libtmux.async/cancel!]].\n[[terminal]] inspects a drained subscription; [[attach!]] opens another connection.","examples":[{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-close"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(next! stream)","params":[{"name":"stream"}]},{"raw":"(next! stream timeout)","params":[{"name":"stream"},{"name":"timeout"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/next!","id":"libtmux.control/next!","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/next!","name":"next!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":210,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Reads one event, gap, timeout, or terminal map; never uses `nil` for termination.","body":"A `:gap` names the events dropped since the previous read and precedes the\nevents that remain. The optional nonnegative Duration includes waiting for\nanother reader. Sequence numbers order the events of this stream. Close wakes\na reader. Termination drains queued deliveries before the final outcome;\nintentionally closing this subscription discards its pending deliveries.\n[[subscribe!]] sets bounds; [[close!]] wakes a blocked reader.","examples":[{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-next"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(send! connection argv)","params":[{"name":"connection"},{"name":"argv"}]},{"raw":"(send! connection argv timeout)","params":[{"name":"connection"},{"name":"argv"},{"name":"timeout"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/send!","id":"libtmux.control/send!","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/send!","name":"send!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":88,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Sends argv and returns protocol status, lines, and unverified completion.","body":"A complete reply does not prove deferred work finished. Cancelling an active\nsend can end this connection and its other requests and subscriptions.\n[[libtmux.core/raw!]] uses process execution; [[subscribe!]] observes unsolicited output.","examples":[{"lang":"console","intro":"Read bounded core.async events and stop without closing the borrowed connection. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n :libtmux-clojure-core-async:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/observe_with_async.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.observe-with-async\n \"Read bounded core.async events and close the consumer before draining.\"\n (:require [clojure.core.async :as channel]\n [clojure.string :as str]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.core-async :as adapter]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"async-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"channel-ready\"]\n (try\n (with-open [^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))]\n ;; Retain the default upstream bound for fragmented terminal output.\n (with-open [^AutoCloseable owner (adapter/observe! connection\n {:event-capacity 1 :encoding :utf-8})]\n (let [deadline (channel/timeout 900)]\n (tm/send-literal! (:tmux/ref pane) \"printf 'channel-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (loop [suffix \"\"]\n (let [[step port] (channel/alts!! [(adapter/events owner) deadline] :priority true)]\n (when (or (identical? port deadline) (not= :event (:stream/status step)))\n (throw (ex-info \"Channel observation timed out, lost output or ended\" {:step step})))\n (let [text (if (= (:pane/id pane) (:pane/id step))\n (str suffix (:output/text step)) suffix)]\n (when-not (str/includes? text marker)\n (recur (subs text (max 0 (- (count text) (dec (count marker)))))))))))\n (channel/close! (adapter/events owner))\n (let [terminal-channel (adapter/terminal owner)\n [outcome port] (channel/alts!! [terminal-channel (channel/timeout 900)] :priority true)]\n (assert (identical? terminal-channel port))\n (assert (= :adapter-stopped (:reason outcome)))))\n (assert (= :complete (:reply/status\n (control/send! connection [\"display-message\" \"-p\" \"#{session_name}\"]))))\n (println (str \"observed=\" marker))\n (println \"adapter-stopped=true borrowed-open=true\"))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/observe_with_async.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M:core-async \\\n -m libtmux.examples.api.observe-with-async\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=channel-ready\nadapter-stopped=true borrowed-open=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-send"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(subscribe! connection)","params":[{"name":"connection"}]},{"raw":"(subscribe! connection options)","params":[{"name":"connection"},{"name":"options"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/subscribe!","id":"libtmux.control/subscribe!","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/subscribe!","name":"subscribe!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":110,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Creates a closeable output subscription borrowing its connection.","body":"`:encoding` is `:bytes` (caller-owned byte arrays) or `:utf-8` (incremental text\nper pane, reset after this subscription's gaps; malformed bytes use \\xHH).\n`:decoder-capacity` bounds partial-pane state (default 1024); an eviction is\nreported with `:decoder/reset` `:capacity` and a cumulative `:decoder/resets.`\n`:capacity` bounds queued events; `:max-bytes` bounds their unescaped payload\n(default 16 MiB).\nOldest events are dropped until both bounds fit; an oversized event drops\nthe queued prefix and itself. The next read is a `:gap` with byte/event loss.\nReaders compete; create separate subscriptions for independent fan-out.\n[[next!]] reads deliveries; [[terminal]] reports the drained end; [[close!]] stops locally.","examples":[{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-subscribe"},{"package":"io.github.libtmux:libtmux-clojure","signatures":[{"raw":"(terminal stream)","params":[{"name":"stream","type":"libtmux.control.OutputStream"}]}],"publicOwner":"libtmux.control","parent":"libtmux.control","publicId":"libtmux.control/terminal","id":"libtmux.control/terminal","apiScope":"exported","product":"core","qualifiedName":"libtmux.control/terminal","name":"terminal","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure/src/main/clojure/libtmux/control.clj","line":146,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.control","doc":{"summary":"Returns the single recorded stream outcome, or `nil` until a reader drains it.","body":"`:reason` is `:closed`, `:completed`, `:control-exit`, `:transport-failure`,\n`:protocol-failure`, or `:unknown.` A control exit does not prove daemon death;\n`:cause` preserves the original exception and may contain sensitive content.\nText streams include `:trailing-text` keyed by pane ID for\nincomplete final bytes rendered as \\xHH.\n[[next!]] records this outcome after buffered deliveries have drained.","examples":[{"lang":"console","intro":"Read bounded UTF-8 output on an owned wait worker and inspect local termination. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/watch_pane_output.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.watch-pane-output\n \"Observe bounded UTF-8 output on an owned virtual worker, then close locally.\"\n (:require [clojure.string :as str]\n [libtmux.async :as async]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"stream-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"stream-ready\"]\n (try\n (with-open [^AutoCloseable runtime (async/runtime! {:max-running 2 :queue-limit 2})\n ^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))\n ;; One terminal line can arrive as many separate output events.\n ^AutoCloseable stream (control/subscribe! connection\n {:encoding :utf-8 :max-bytes 8192})]\n (let [observed\n (async/submit! runtime {:kind :wait :timeout-ms 900}\n #(loop [suffix \"\"]\n (let [step (control/next! stream)]\n (when-not (= :event (:stream/status step))\n (throw (ex-info \"Observation lost output or ended\" step)))\n (if (= (:pane/id pane) (:pane/id step))\n (let [text (str suffix (:output/text step))]\n (if (str/includes? text marker)\n marker\n (recur (subs text (max 0 (- (count text) (dec (count marker))))))))\n (recur suffix)))))]\n (tm/send-literal! (:tmux/ref pane) \"printf 'stream-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (= marker @observed))\n (control/close! stream)\n (let [ended (control/next! stream Duration/ZERO)]\n (assert (= :terminal (:stream/status ended)))\n (assert (= :closed (:reason (control/terminal stream)))))\n (println (str \"observed=\" marker))\n (println \"closed=true\")))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M \\\n -m libtmux.examples.api.watch-pane-output\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=stream-ready\nclosed=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-control-terminal"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(ns libtmux.core-async)","params":[]}],"publicOwner":"libtmux.core-async","publicId":"libtmux.core-async","id":"libtmux.core-async","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async","name":"libtmux.core-async","modifiers":[],"kind":"module","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":1,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Closeable core.async observation through [[observe!]].","body":"[[events]] carries deliveries; [[terminal]] reports local subscription cleanup.\nBorrow an explicit connection from [[libtmux.control/attach!]]."},"slug":"libtmux-core-async"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(events adapter)","params":[{"name":"adapter","type":"libtmux.core_async.Adapter"}]}],"publicOwner":"libtmux.core-async","parent":"libtmux.core-async","publicId":"libtmux.core-async/events","id":"libtmux.core-async/events","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async/events","name":"events","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":33,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Returns the read-only events channel. Closing it stops the adapter.","body":"Created by [[observe!]]; [[terminal]] delivers the final cleanup outcome.","examples":[{"lang":"console","intro":"Read bounded core.async events and stop without closing the borrowed connection. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n :libtmux-clojure-core-async:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/observe_with_async.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.observe-with-async\n \"Read bounded core.async events and close the consumer before draining.\"\n (:require [clojure.core.async :as channel]\n [clojure.string :as str]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.core-async :as adapter]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"async-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"channel-ready\"]\n (try\n (with-open [^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))]\n ;; Retain the default upstream bound for fragmented terminal output.\n (with-open [^AutoCloseable owner (adapter/observe! connection\n {:event-capacity 1 :encoding :utf-8})]\n (let [deadline (channel/timeout 900)]\n (tm/send-literal! (:tmux/ref pane) \"printf 'channel-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (loop [suffix \"\"]\n (let [[step port] (channel/alts!! [(adapter/events owner) deadline] :priority true)]\n (when (or (identical? port deadline) (not= :event (:stream/status step)))\n (throw (ex-info \"Channel observation timed out, lost output or ended\" {:step step})))\n (let [text (if (= (:pane/id pane) (:pane/id step))\n (str suffix (:output/text step)) suffix)]\n (when-not (str/includes? text marker)\n (recur (subs text (max 0 (- (count text) (dec (count marker)))))))))))\n (channel/close! (adapter/events owner))\n (let [terminal-channel (adapter/terminal owner)\n [outcome port] (channel/alts!! [terminal-channel (channel/timeout 900)] :priority true)]\n (assert (identical? terminal-channel port))\n (assert (= :adapter-stopped (:reason outcome)))))\n (assert (= :complete (:reply/status\n (control/send! connection [\"display-message\" \"-p\" \"#{session_name}\"]))))\n (println (str \"observed=\" marker))\n (println \"adapter-stopped=true borrowed-open=true\"))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/observe_with_async.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M:core-async \\\n -m libtmux.examples.api.observe-with-async\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=channel-ready\nadapter-stopped=true borrowed-open=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-core-async-events"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(limits adapter)","params":[{"name":"adapter","type":"libtmux.core_async.Adapter"}]}],"publicOwner":"libtmux.core-async","parent":"libtmux.core-async","publicId":"libtmux.core-async/limits","id":"libtmux.core-async/limits","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async/limits","name":"limits","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":45,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Returns the adapter's exact retained-event bound.","body":"[[observe!]] defines upstream and adapter capacity separately."},"slug":"libtmux-core-async-limits"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(observe! connection)","params":[{"name":"connection"}]},{"raw":"(observe! connection options)","params":[{"name":"connection"},{"name":"options"}]}],"publicOwner":"libtmux.core-async","parent":"libtmux.core-async","publicId":"libtmux.core-async/observe!","id":"libtmux.core-async/observe!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async/observe!","name":"observe!","modifiers":["overload"],"kind":"function","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":82,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Starts an owned virtual worker over a borrowed control connection.","body":"`:event-capacity` defaults to zero. The worker can retain one pending event;\na fixed buffer retains that many more. `:upstream-capacity` bounds the Java\nsubscription, which reports overflow as a `:gap` value ahead of the events that\nremain; `:encoding` is `:bytes` or `:utf-8.` Closing the events channel or\nadapter stops blocked reads and puts. A stopped outcome retains the final\n`:upstream/terminal`, including loss, cause and trailing text. Adapter loss\nstays separate under `:adapter/events.` The borrowed connection remains open.\nBorrow a connection from [[libtmux.control/attach!]]; read [[events]] and [[terminal]].","examples":[{"lang":"console","intro":"Read bounded core.async events and stop without closing the borrowed connection. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n :libtmux-clojure-core-async:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/observe_with_async.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.observe-with-async\n \"Read bounded core.async events and close the consumer before draining.\"\n (:require [clojure.core.async :as channel]\n [clojure.string :as str]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.core-async :as adapter]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"async-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"channel-ready\"]\n (try\n (with-open [^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))]\n ;; Retain the default upstream bound for fragmented terminal output.\n (with-open [^AutoCloseable owner (adapter/observe! connection\n {:event-capacity 1 :encoding :utf-8})]\n (let [deadline (channel/timeout 900)]\n (tm/send-literal! (:tmux/ref pane) \"printf 'channel-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (loop [suffix \"\"]\n (let [[step port] (channel/alts!! [(adapter/events owner) deadline] :priority true)]\n (when (or (identical? port deadline) (not= :event (:stream/status step)))\n (throw (ex-info \"Channel observation timed out, lost output or ended\" {:step step})))\n (let [text (if (= (:pane/id pane) (:pane/id step))\n (str suffix (:output/text step)) suffix)]\n (when-not (str/includes? text marker)\n (recur (subs text (max 0 (- (count text) (dec (count marker)))))))))))\n (channel/close! (adapter/events owner))\n (let [terminal-channel (adapter/terminal owner)\n [outcome port] (channel/alts!! [terminal-channel (channel/timeout 900)] :priority true)]\n (assert (identical? terminal-channel port))\n (assert (= :adapter-stopped (:reason outcome)))))\n (assert (= :complete (:reply/status\n (control/send! connection [\"display-message\" \"-p\" \"#{session_name}\"]))))\n (println (str \"observed=\" marker))\n (println \"adapter-stopped=true borrowed-open=true\"))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/observe_with_async.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M:core-async \\\n -m libtmux.examples.api.observe-with-async\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=channel-ready\nadapter-stopped=true borrowed-open=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-core-async-observe"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(stop! adapter)","params":[{"name":"adapter"}]}],"publicOwner":"libtmux.core-async","parent":"libtmux.core-async","publicId":"libtmux.core-async/stop!","id":"libtmux.core-async/stop!","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async/stop!","name":"stop!","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":51,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Stops observation and closes only the owned subscription and worker.","body":"[[terminal]] reports completion; the connection supplied to [[observe!]] stays open."},"slug":"libtmux-core-async-stop"},{"package":"io.github.libtmux:libtmux-clojure-core-async","signatures":[{"raw":"(terminal adapter)","params":[{"name":"adapter","type":"libtmux.core_async.Adapter"}]}],"publicOwner":"libtmux.core-async","parent":"libtmux.core-async","publicId":"libtmux.core-async/terminal","id":"libtmux.core-async/terminal","apiScope":"exported","product":"core","qualifiedName":"libtmux.core-async/terminal","name":"terminal","modifiers":[],"kind":"function","source":{"file":"libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","line":39,"repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","extractedRevision":"941f2162062b6d118c68b7d1c23417e0d2cea124"},"namespace":"libtmux.core-async","doc":{"summary":"Returns a buffered channel that delivers one outcome after cleanup.","body":"[[events]] carries deliveries; [[stop!]] requests local shutdown.","examples":[{"lang":"console","intro":"Read bounded core.async events and stop without closing the borrowed connection. Use JDK 25 or newer, the Clojure CLI, Git and tmux on Linux or macOS, with /bin/cat and /bin/sh available. These packages are unpublished. In an empty directory, install this exact source into the consumer's isolated Maven repository:","code":"$ git clone https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n :libtmux-clojure-core-async:publishToMavenLocal \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")\n"},{"lang":"clojure","intro":"Save this file as `deps.edn`. Dependencies resolve from the isolated m2 directory; the core.async dependency is only enabled by its alias.","code":"{:paths [\"src/main/clojure\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}\n :aliases\n {:core-async\n {:extra-deps\n {io.github.libtmux/libtmux-clojure-core-async {:mvn/version \"0.1.2-SNAPSHOT\"}}}}}\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/clojure/deps.edn"},{"lang":"sh","intro":"Save this file as `run.sh`. The launcher creates and stops a private server, including after program failure, and reports leaked servers as errors.","code":"#!/bin/sh\nset -eu\n\nif [ \"$#\" -eq 0 ]; then\n printf 'Usage: sh run.sh program [arguments...]\\n' >&2\n exit 2\nfi\nbinary=$(command -v \"${TMUX_BIN:-tmux}\")\nroot=${API_RUN_ROOT:-/tmp/libtmux-java-dev}\n\n# A client that names no socket follows TMUX or LIBTMUX_SOCKET*, and otherwise lands on the default\n# socket under TMUX_TMPDIR. The program gets none of them, and a TMUX_TMPDIR of its own below.\nunset TMUX TMUX_PANE\nfor name in $(env | sed -n 's/^\\(LIBTMUX_SOCKET[A-Za-z0-9_]*\\)=.*/\\1/p'); do\n unset \"$name\"\ndone\n\nmkdir -p \"$root\"\ndirectory=$(mktemp -d \"$root/api.XXXXXX\")\ntmpdir=$(mktemp -d \"$root/tmpdir.XXXXXX\")\nsocket=\"$directory/tmux.sock\"\nconfig=\"$directory/tmux.conf\"\n\nserves() {\n \"$binary\" -S \"$1\" display-message -p '#{pid}' >/dev/null 2>&1\n}\n\n# Stops the server on the socket, then waits for it to stop answering.\nstop() {\n \"$binary\" -S \"$1\" kill-server || return 1\n attempts=0\n while serves \"$1\" && [ \"$attempts\" -lt 60 ]; do\n sleep 0.05\n attempts=$((attempts + 1))\n done\n ! serves \"$1\"\n}\n\ncleanup() {\n status=$?\n trap - 0 HUP INT TERM PIPE\n # A closed output must not end the cleanup, whose messages are the only thing left to write.\n trap '' PIPE\n set +e\n stuck=\n left=\n if [ -S \"$socket\" ] && serves \"$socket\" && ! stop \"$socket\"; then\n stuck=\"$stuck tmux.sock\"\n fi\n # Every socket anywhere under either directory, without following links. Only one a server answers\n # on is a leak; the runner's own is expected to be there.\n old_ifs=$IFS\n IFS='\n'\n set -f\n for candidate in $(find \"$tmpdir\" \"$directory\" -type s 2>/dev/null); do\n [ \"$candidate\" = \"$socket\" ] && continue\n serves \"$candidate\" || continue\n case \"$candidate\" in\n \"$tmpdir\"/*) name=${candidate#\"$tmpdir\"/} ;;\n *) name=${candidate#\"$directory\"/} ;;\n esac\n left=\"$left $name\"\n stop \"$candidate\" || stuck=\"$stuck $name\"\n done\n set +f\n IFS=$old_ifs\n if [ -n \"$stuck\" ]; then\n printf 'tmux still answers on%s after kill-server; kept %s and %s under the runner root\\n' \\\n \"$stuck\" \"${directory##*/}\" \"${tmpdir##*/}\" >&2\n exit 1\n fi\n rm -rf \"$directory\" \"$tmpdir\" || exit 1\n if [ -n \"$left\" ]; then\n printf 'The program left a tmux server running:%s\\n' \"$left\" >&2\n exit 1\n fi\n exit \"$status\"\n}\ntrap cleanup 0\ntrap 'exit 1' HUP INT TERM PIPE\n\n# A default socket path longer than this does not fit in sun_path.\ndefault_socket=\"$tmpdir/tmux-$(id -u)/default\"\nif [ \"$(printf '%s' \"$default_socket\" | wc -c)\" -gt 100 ]; then\n printf 'API_RUN_ROOT is too long for a tmux socket\\n' >&2\n exit 1\nfi\nTMUX_TMPDIR=$tmpdir\nexport TMUX_TMPDIR\n\nprintf 'set-option -g default-shell /bin/sh\\n' > \"$config\"\n\"$binary\" -S \"$socket\" -f \"$config\" new-session -d -s work-one -n editor /bin/cat\n\"$binary\" -S \"$socket\" split-window -h -t '=work-one:editor' /bin/cat\n\"$binary\" -S \"$socket\" new-window -d -t '=work-one' -n logs /bin/cat\n\"$binary\" -S \"$socket\" new-session -d -s work-two -n editor /bin/cat\n\"$@\" \"$binary\" \"$socket\" \"$config\"\n\"$binary\" -S \"$socket\" has-session -t '=work-one'\n\"$binary\" -S \"$socket\" has-session -t '=work-two'\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/api/run.sh"},{"lang":"clojure","intro":"Save the complete program as `src/main/clojure/libtmux/examples/api/observe_with_async.clj`, creating its parent directories. Closing its client leaves the launcher's server running.","code":"(ns libtmux.examples.api.observe-with-async\n \"Read bounded core.async events and close the consumer before draining.\"\n (:require [clojure.core.async :as channel]\n [clojure.string :as str]\n [libtmux.control :as control]\n [libtmux.core :as tm]\n [libtmux.core-async :as adapter]\n [libtmux.data :as data])\n (:import [java.lang AutoCloseable]\n [java.time Duration]))\n\n(defn -main [& args]\n (when-not (= 3 (count args))\n (throw (IllegalArgumentException. \"expected: tmux-binary socket-path config-file\")))\n (let [[binary socket config] args]\n (with-open [server (tm/open! {:binary binary :socket-path socket :config-file config})]\n (let [session (tm/new-session! server {:name \"async-example\" :command [\"/bin/sh\"]})\n pane (data/exactly-one (data/panes session))\n marker \"channel-ready\"]\n (try\n (with-open [^AutoCloseable connection (control/attach! (:tmux/ref session) (Duration/ofMillis 900))]\n ;; Retain the default upstream bound for fragmented terminal output.\n (with-open [^AutoCloseable owner (adapter/observe! connection\n {:event-capacity 1 :encoding :utf-8})]\n (let [deadline (channel/timeout 900)]\n (tm/send-literal! (:tmux/ref pane) \"printf 'channel-%s\\\\n' ready\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (loop [suffix \"\"]\n (let [[step port] (channel/alts!! [(adapter/events owner) deadline] :priority true)]\n (when (or (identical? port deadline) (not= :event (:stream/status step)))\n (throw (ex-info \"Channel observation timed out, lost output or ended\" {:step step})))\n (let [text (if (= (:pane/id pane) (:pane/id step))\n (str suffix (:output/text step)) suffix)]\n (when-not (str/includes? text marker)\n (recur (subs text (max 0 (- (count text) (dec (count marker)))))))))))\n (channel/close! (adapter/events owner))\n (let [terminal-channel (adapter/terminal owner)\n [outcome port] (channel/alts!! [terminal-channel (channel/timeout 900)] :priority true)]\n (assert (identical? terminal-channel port))\n (assert (= :adapter-stopped (:reason outcome)))))\n (assert (= :complete (:reply/status\n (control/send! connection [\"display-message\" \"-p\" \"#{session_name}\"]))))\n (println (str \"observed=\" marker))\n (println \"adapter-stopped=true borrowed-open=true\"))\n (catch clojure.lang.ExceptionInfo failure\n (if (= :tmux/unsupported-feature (:tmux/error (ex-data failure)))\n (do\n (assert (= :not-dispatched (:tmux/dispatch (ex-data failure))))\n (assert (empty? (tm/clients! server)))\n (println \"requires tmux 3.7+\"))\n (throw failure))))))))\n","sourceUrl":"https://github.com/libtmux/libtmux-java/blob/941f2162062b6d118c68b7d1c23417e0d2cea124/examples/src/main/clojure/libtmux/examples/api/observe_with_async.clj"},{"lang":"console","intro":"Run it with the private fixture. Set TMUX_BIN to select another tmux binary:","code":"$ sh run.sh clojure \\\n -J-Dclojure.main.report=stderr \\\n -M:core-async \\\n -m libtmux.examples.api.observe-with-async\n"},{"lang":"text","intro":"Expected output on tmux 3.7 or newer:","code":"observed=channel-ready\nadapter-stopped=true borrowed-open=true\n"},{"lang":"text","intro":"On an older supported tmux, the program reports the control capability refusal:","code":"requires tmux 3.7+\n"}]},"slug":"libtmux-core-async-terminal"}]} diff --git a/site/src/data/api/clojure.nav.json b/site/src/data/api/clojure.nav.json new file mode 100644 index 000000000..b50b4ce7c --- /dev/null +++ b/site/src/data/api/clojure.nav.json @@ -0,0 +1 @@ +{"port":"clojure","buckets":[{"id":"server","label":"Server","collapsed":false},{"id":"session","label":"Session","collapsed":false},{"id":"window","label":"Window","collapsed":false},{"id":"pane","label":"Pane","collapsed":false},{"id":"client","label":"Client","collapsed":false},{"id":"hooks","label":"Hooks","collapsed":false},{"id":"options","label":"Options","collapsed":false,"children":[{"id":"options-functions","label":"Functions","collapsed":false},{"id":"options-constants","label":"Constants and variables","collapsed":false}]},{"id":"keys","label":"Keys and bindings","collapsed":false},{"id":"buffers","label":"Buffers","collapsed":false},{"id":"layout","label":"Layout and geometry","collapsed":false},{"id":"environment","label":"Environment","collapsed":false},{"id":"capabilities","label":"Terminal capabilities","collapsed":false},{"id":"version","label":"Versions","collapsed":false},{"id":"commands","label":"Commands","collapsed":false},{"id":"control","label":"Control mode","collapsed":false},{"id":"formats","label":"Formats","collapsed":false},{"id":"queries","label":"Queries","collapsed":false,"children":[{"id":"queries-fields","label":"Fields","collapsed":false},{"id":"queries-operators","label":"Operators","collapsed":false},{"id":"queries-expressions","label":"Expressions","collapsed":false}]},{"id":"snapshots","label":"Snapshots","collapsed":false},{"id":"workspace","label":"Workspaces","collapsed":false,"children":[{"id":"workspace-plan","label":"Plans","collapsed":false},{"id":"workspace-steps","label":"Steps","collapsed":false},{"id":"workspace-targets","label":"Targets and slots","collapsed":false},{"id":"workspace-session","label":"Session","collapsed":false},{"id":"workspace-window","label":"Window","collapsed":false},{"id":"workspace-pane","label":"Pane","collapsed":false},{"id":"workspace-functions","label":"Functions","collapsed":false},{"id":"workspace-constants","label":"Constants and variables","collapsed":false}]},{"id":"requests","label":"Requests","collapsed":true,"children":[{"id":"requests-server","label":"Server","collapsed":false},{"id":"requests-session","label":"Session","collapsed":false},{"id":"requests-window","label":"Window","collapsed":false},{"id":"requests-pane","label":"Pane","collapsed":false},{"id":"requests-client","label":"Client","collapsed":false}]},{"id":"errors","label":"Errors","collapsed":true,"children":[{"id":"errors-server","label":"Server","collapsed":false},{"id":"errors-session","label":"Session","collapsed":false},{"id":"errors-window","label":"Window","collapsed":false},{"id":"errors-pane","label":"Pane","collapsed":false}]},{"id":"constants","label":"Constants and enums","collapsed":true,"children":[{"id":"constants-server","label":"Server","collapsed":false},{"id":"constants-session","label":"Session","collapsed":false},{"id":"constants-window","label":"Window","collapsed":false},{"id":"constants-pane","label":"Pane","collapsed":false},{"id":"constants-client","label":"Client","collapsed":false}]},{"id":"runtime","label":"Runtime adapters","collapsed":false},{"id":"async","label":"Async","collapsed":false},{"id":"mcp","label":"MCP","collapsed":true,"children":[{"id":"mcp-functions","label":"Functions","collapsed":false},{"id":"mcp-constants","label":"Constants and variables","collapsed":false}]},{"id":"testing","label":"Testing utilities","collapsed":true},{"id":"internal","label":"Internal","collapsed":true,"children":[{"id":"internal-commands","label":"Commands","collapsed":false},{"id":"internal-options","label":"Options","collapsed":false}]}],"assignments":{"server":[{"id":"libtmux.core","name":"libtmux.core","slug":"libtmux-core","kind":"module"}],"session":[],"window":[],"pane":[],"client":[],"hooks":[],"options":[],"options-functions":[],"options-constants":[],"keys":[],"buffers":[],"layout":[],"environment":[],"capabilities":[],"version":[],"commands":[],"control":[{"id":"libtmux.control","name":"libtmux.control","slug":"libtmux-control","kind":"module"}],"formats":[],"queries":[],"queries-fields":[],"queries-operators":[],"queries-expressions":[],"snapshots":[{"id":"libtmux.data","name":"libtmux.data","slug":"libtmux-data","kind":"module"}],"workspace":[],"workspace-plan":[],"workspace-steps":[],"workspace-targets":[],"workspace-session":[],"workspace-window":[],"workspace-pane":[],"workspace-functions":[],"workspace-constants":[],"requests":[],"requests-server":[],"requests-session":[],"requests-window":[],"requests-pane":[],"requests-client":[],"errors":[],"errors-server":[],"errors-session":[],"errors-window":[],"errors-pane":[],"constants":[],"constants-server":[],"constants-session":[],"constants-window":[],"constants-pane":[],"constants-client":[],"runtime":[],"async":[{"id":"libtmux.async","name":"libtmux.async","slug":"libtmux-async","kind":"module"},{"id":"libtmux.core-async","name":"libtmux.core-async","slug":"libtmux-core-async","kind":"module"}],"mcp":[],"mcp-functions":[],"mcp-constants":[],"testing":[],"internal":[],"internal-commands":[],"internal-options":[]},"placement":{"libtmux.core":"server","libtmux.control":"control","libtmux.data":"snapshots","libtmux.async":"async","libtmux.core-async":"async"},"unplaced":[],"diagnostics":{"unmatched":[],"deadBuckets":["session","window","pane","client","hooks","options","options-functions","options-constants","keys","buffers","layout","environment","capabilities","version","commands","formats","queries","queries-fields","queries-operators","queries-expressions","workspace","workspace-plan","workspace-steps","workspace-targets","workspace-session","workspace-window","workspace-pane","workspace-functions","workspace-constants","requests","requests-server","requests-session","requests-window","requests-pane","requests-client","errors","errors-server","errors-session","errors-window","errors-pane","constants","constants-server","constants-session","constants-window","constants-pane","constants-client","runtime","mcp","mcp-functions","mcp-constants","testing","internal","internal-commands","internal-options"],"ambiguous":[],"staleUnsettled":[]}} diff --git a/site/src/data/api/clojure.paths.json b/site/src/data/api/clojure.paths.json new file mode 100644 index 000000000..afb60963e --- /dev/null +++ b/site/src/data/api/clojure.paths.json @@ -0,0 +1 @@ +{"port":"clojure","repo":"libtmux/libtmux-java","revision":"941f2162062b6d118c68b7d1c23417e0d2cea124","paths":[".editorconfig",".gitattributes",".gitignore",".scalafmt.conf","AGENTS.md","CHANGELOG.md","CITATION.cff","CLAUDE.md","LICENSE","MIGRATION.md","README.md","RELEASING.md","SECURITY.md","build.gradle.kts","capabilities.json","deps.edn","docs/guide/clojure-api.md","docs/guide/clojure-core-async-api.md","docs/guide/clojure-reference.md","docs/guide/clojure.md","examples/src/main/clojure/libtmux/examples/api/capture.clj","examples/src/main/clojure/libtmux/examples/api/capture_concurrently.clj","examples/src/main/clojure/libtmux/examples/api/connect.clj","examples/src/main/clojure/libtmux/examples/api/list_panes.clj","examples/src/main/clojure/libtmux/examples/api/list_sessions.clj","examples/src/main/clojure/libtmux/examples/api/list_windows.clj","examples/src/main/clojure/libtmux/examples/api/new_session.clj","examples/src/main/clojure/libtmux/examples/api/new_window.clj","examples/src/main/clojure/libtmux/examples/api/observe_with_async.clj","examples/src/main/clojure/libtmux/examples/api/query.clj","examples/src/main/clojure/libtmux/examples/api/run_a_command.clj","examples/src/main/clojure/libtmux/examples/api/watch_pane_output.clj","examples/src/main/clojure/libtmux/examples/api/workspace.clj","gradle.properties","gradlew","gradlew.bat","libtmux-clojure-core-async/CHANGELOG.md","libtmux-clojure-core-async/README.md","libtmux-clojure-core-async/assets/logo.png","libtmux-clojure-core-async/assets/logo.svg","libtmux-clojure-core-async/build.gradle.kts","libtmux-clojure-core-async/src/main/clojure/libtmux/core_async.clj","libtmux-clojure-core-async/src/test/clojure/libtmux/core_async_test.clj","libtmux-clojure-core-async/src/test/clojure/libtmux/internal/core_async_package_test.clj","libtmux-clojure/CHANGELOG.md","libtmux-clojure/README.md","libtmux-clojure/assets/logo.png","libtmux-clojure/assets/logo.svg","libtmux-clojure/build.gradle.kts","libtmux-clojure/src/main/clojure/libtmux/async.clj","libtmux-clojure/src/main/clojure/libtmux/control.clj","libtmux-clojure/src/main/clojure/libtmux/core.clj","libtmux-clojure/src/main/clojure/libtmux/data.clj","libtmux-clojure/src/test/clojure/libtmux/async_test.clj","libtmux-clojure/src/test/clojure/libtmux/control_test.clj","libtmux-clojure/src/test/clojure/libtmux/core_test.clj","libtmux-clojure/src/test/clojure/libtmux/data_test.clj","libtmux-clojure/src/test/clojure/libtmux/internal/package_test.clj","settings.gradle.kts"]} diff --git a/site/src/data/core-home.json b/site/src/data/core-home.json index 65d8dde3f..3cc75c368 100644 --- a/site/src/data/core-home.json +++ b/site/src/data/core-home.json @@ -322,5 +322,23 @@ "control-mode": "ControlSession", "capture": "Server.capture(_:includingHistory:)" } + }, + "clojure": { + "objects": { + "server": "libtmux.core/open!", + "session": "libtmux.core/sessions!", + "window": "libtmux.data/windows", + "pane": "libtmux.data/panes" + }, + "capabilities": { + "objects": "libtmux.data", + "errors": "libtmux.core/error-summary", + "traversal": "libtmux.data/panes", + "servers": "libtmux.core/open!", + "send-keys": "libtmux.core/send-keys!", + "control-mode": "libtmux.control/subscribe!", + "capture": "libtmux.core/capture!", + "async": "libtmux.async" + } } } diff --git a/site/src/data/destination-evidence.json b/site/src/data/destination-evidence.json index bcf528df9..e7b87eb5b 100644 --- a/site/src/data/destination-evidence.json +++ b/site/src/data/destination-evidence.json @@ -1,6 +1,6 @@ { "schema": 1, - "checkedAt": "2026-11-03", + "checkedAt": "2026-11-08", "destinations": [ { "url": "https://central.sonatype.com/artifact/io.github.libtmux/libtmux", @@ -1096,8 +1096,9 @@ "note": "a branch link names no release" } ], - "checkedAt": "2026-11-03", + "checkedAt": "2026-11-08", "entries": [ + "clojure:repository", "java:repository", "kotlin:repository", "scala:repository" @@ -1147,6 +1148,48 @@ "java:libtmux-bom" ] }, + { + "url": "https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure", + "kinds": [ + "source" + ], + "host": "github", + "ok": true, + "status": 200, + "requested": "https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure", + "identity": "libtmux/libtmux-java/libtmux-clojure", + "versionChecks": [ + { + "check": "unsupported", + "note": "a branch link names no release" + } + ], + "checkedAt": "2026-11-08", + "entries": [ + "clojure:core-source" + ] + }, + { + "url": "https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure-core-async", + "kinds": [ + "source" + ], + "host": "github", + "ok": true, + "status": 200, + "requested": "https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure-core-async", + "identity": "libtmux/libtmux-java/libtmux-clojure-core-async", + "versionChecks": [ + { + "check": "unsupported", + "note": "a branch link names no release" + } + ], + "checkedAt": "2026-11-08", + "entries": [ + "clojure:adapter-source" + ] + }, { "url": "https://github.com/libtmux/libtmux-java/tree/master/libtmux-jackson", "kinds": [ diff --git a/site/src/data/home-examples.json b/site/src/data/home-examples.json index dd6366fc8..4744b8e31 100644 --- a/site/src/data/home-examples.json +++ b/site/src/data/home-examples.json @@ -599,5 +599,42 @@ "errors": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\n# libtmux works on a running server, so tmux itself starts the private one.\ncreate = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n{_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\nserver = Server.new(executable: tmux, socket: socket)\n\n# Lay out the session: name its window, split it, add a second window.\nsnapshot = Server.snapshot!(server)\nsession = snapshot |> Snapshot.sessions() |> Selection.one!()\neditor = Session.active_window(snapshot, session)\n{:ok, session_ref} = Ref.from_observation(session)\n{:ok, editor_ref} = Ref.from_observation(editor)\nWindow.rename!(server, editor_ref, \"editor\")\nleft =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n{:ok, left_ref} = Ref.from_observation(left)\n%{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n%{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n{:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n# Type a command into the new pane and wait for what it prints.\nPane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\nPane.send_keys!(server, right, [\"Enter\"])\n\nshown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\nshown || raise \"the pane did not print hello from tmux\"\n\n# Move the focus an attached client sees: the pane, then the window.\nselect_pane = Command.new(\"select-pane\", [\"-t\", right_id])\nselect_window = Command.new(\"select-window\", [\"-t\", logs_id])\n{:ok, _} = Server.run(server, select_pane)\n{:ok, _} = Server.run(server, select_window)\n\n# Walk the objects: down from the server, then up from one pane.\nsnapshot = Server.snapshot!(server)\nsessions = Snapshot.sessions(snapshot)\n\nfor each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\nend\n\npane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\nwindow = Snapshot.related(snapshot, :pane, pane.id, :window)\n[owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\nIO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\n", "cleanup": "Mix.install([{:libtmux, \"0.1.1\"}])\n\nalias LibTmux.{Command, Pane, Ref, Selection, Server, Session, Snapshot, Window}\n\ntmux = System.find_executable(\"tmux\") || raise \"tmux is not on PATH\"\nid = Base.encode16(:crypto.strong_rand_bytes(8), case: :lower)\ndir = Path.join(System.tmp_dir!(), \"libtmux-\" <> id)\nsocket = Path.join(dir, \"tmux.sock\")\nFile.mkdir!(dir)\nFile.chmod!(dir, 0o700)\n\ntry do\n # libtmux works on a running server, so tmux itself starts the private one.\n create = [\"new-session\", \"-d\", \"-s\", \"demo\"]\n {_, 0} = System.cmd(tmux, [\"-S\", socket, \"-f\", \"/dev/null\" | create])\n server = Server.new(executable: tmux, socket: socket)\n\n # Lay out the session: name its window, split it, add a second window.\n snapshot = Server.snapshot!(server)\n session = snapshot |> Snapshot.sessions() |> Selection.one!()\n editor = Session.active_window(snapshot, session)\n {:ok, session_ref} = Ref.from_observation(session)\n {:ok, editor_ref} = Ref.from_observation(editor)\n Window.rename!(server, editor_ref, \"editor\")\n left =\n snapshot\n |> Snapshot.panes()\n |> Selection.one!(window_id: editor.id, active: true)\n {:ok, left_ref} = Ref.from_observation(left)\n %{id: right_id} = Pane.split!(server, left_ref, axis: :horizontal)\n %{id: logs_id} = Session.new_window!(server, session_ref, \"logs\")\n {:ok, right} = Ref.new(:pane, right_id, session.server_instance)\n\n # Type a command into the new pane and wait for what it prints.\n Pane.send_text!(server, right, \"printf 'hello from %s\\\\n' tmux\")\n Pane.send_keys!(server, right, [\"Enter\"])\n\n shown =\n Enum.find_value(1..250, fn _ ->\n screen = Pane.capture!(server, right)\n screen =~ \"hello from tmux\" || (Process.sleep(20) && nil)\n end)\n\n shown || raise \"the pane did not print hello from tmux\"\n\n # Move the focus an attached client sees: the pane, then the window.\n select_pane = Command.new(\"select-pane\", [\"-t\", right_id])\n select_window = Command.new(\"select-window\", [\"-t\", logs_id])\n {:ok, _} = Server.run(server, select_pane)\n {:ok, _} = Server.run(server, select_window)\n\n # Walk the objects: down from the server, then up from one pane.\n snapshot = Server.snapshot!(server)\n sessions = Snapshot.sessions(snapshot)\n\n for each <- sessions do\n IO.puts(\"session #{each.name}\")\n links = Snapshot.related(snapshot, :session, each.id, :window_links)\n\n for link <- Enum.sort_by(links, & &1.index) do\n {:ok, window} = Snapshot.fetch(snapshot, :window, link.window_id)\n panes = Window.panes(snapshot, window)\n ids = Enum.map_join(panes, \" \", & &1.id)\n IO.puts(\" window #{link.index}:#{window.name}: #{ids}\")\n end\n end\n\n pane = snapshot |> Snapshot.panes() |> Selection.one!(id: right_id)\n window = Snapshot.related(snapshot, :pane, pane.id, :window)\n [owner] = Snapshot.related(snapshot, :window, window.id, :sessions)\n IO.puts(\"#{pane.id} is in window #{window.name} of session #{owner.name}\")\nafter\n System.cmd(tmux, [\"-S\", socket, \"kill-server\"], stderr_to_stdout: true)\n File.rm_rf(dir)\nend\n" } + }, + "clojure": { + "lang": "clojure", + "sourceRepository": "libtmux/libtmux-java", + "sourceRevision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "sourceTree": "7d2f3dc40377daae080643b19333d173036331fb", + "program": "quickstart.clj", + "excerpt": { + "startLine": 1, + "endLine": 65, + "dedent": 0, + "importsEndLine": 7 + }, + "files": [ + { + "name": "quickstart.clj", + "lang": "clojure", + "code": "(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n(import '[java.lang ProcessHandle]\n '[java.nio.file Files Path]\n '[java.nio.file.attribute FileAttribute]\n '[java.time Duration]\n [java.util.concurrent TimeUnit])\n\n(let [attrs (make-array FileAttribute 0)\n root (Path/of \"/tmp/libtmux-java-dev\" (make-array String 0))\n _ (Files/createDirectories root attrs)\n directory (Files/createTempDirectory root \"clojure-home-\" attrs)\n socket (.resolve directory \"tmux.sock\")\n daemon (atom nil)]\n (try\n (with-open [server (tm/open! {:socket-path socket\n :binary (or (System/getenv \"TMUX_BIN\") \"tmux\")\n :config-file \"/dev/null\"})]\n (try\n (let [session (tm/new-session! server {:name \"demo\"\n :window-name \"work\"\n :command [\"/bin/sh\"]})\n window (data/exactly-one (data/windows session))\n pane (data/exactly-one (data/panes window))\n _ (reset! daemon\n (.get (ProcessHandle/of\n (get-in session [:tmux/identity :tmux/pid]))))]\n (tm/rename! (:tmux/ref window) \"editor\")\n (assert (= \"work\" (:window/name window)))\n (tm/split-pane! (:tmux/ref pane)\n {:direction :right :command [\"/bin/cat\"]})\n (tm/new-window! (:tmux/ref session)\n {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/send-literal! (:tmux/ref pane)\n \"printf 'hello from %s\\\\n' Clojure\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (#{:appeared :present-at-entry}\n (tm/await-text! (:tmux/ref pane) \"hello from Clojure\"\n (Duration/ofSeconds 2))))\n (let [snapshot (tm/snapshot! server)\n observed (data/exactly-one (:tmux/sessions snapshot))]\n (assert (= \"demo\" (:session/name observed)))\n (println \"session\" (:session/name observed))\n (doseq [entry (data/windows observed)]\n (println (str \" window \" (:window/name entry) \": \"\n (count (data/panes entry)) \" panes\")))\n (assert (some #{\"hello from Clojure\"}\n (tm/capture! (:tmux/ref pane))))\n (println \"output=hello from Clojure\")))\n (catch Exception failure\n (throw (ex-info \"Clojure tmux quickstart failed\"\n {:tmux/failure (tm/error-summary failure)} failure)))\n (finally\n (tm/kill-server! server)\n (when-let [^ProcessHandle process @daemon]\n (.get (.onExit process) 1 TimeUnit/SECONDS)))))\n (finally\n (if-let [^ProcessHandle process @daemon]\n (when-not (.isAlive process)\n (Files/deleteIfExists socket)\n (Files/deleteIfExists directory))\n (when-not (Files/exists socket (make-array java.nio.file.LinkOption 0))\n (Files/deleteIfExists directory)))))\n (assert (not (Files/exists directory\n (make-array java.nio.file.LinkOption 0)))))\n" + }, + { + "name": "deps.edn", + "lang": "clojure", + "code": "{:paths [\".\"]\n :mvn/local-repo \"m2\"\n :deps {org.clojure/clojure {:mvn/version \"1.12.6\"}\n io.github.libtmux/libtmux-clojure {:mvn/version \"0.1.2-SNAPSHOT\"}}}\n" + } + ], + "prerequisites": "JDK 25 or newer, Clojure CLI 1.12, Git, tmux 3.3a or newer, /bin/sh and /bin/cat on Linux or macOS. The Clojure artifacts are unpublished; install the pinned source into the isolated Maven repository first.", + "commands": [ + "git clone \\\n --branch master \\\n --single-branch \\\n https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --max-workers=1 \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")", + "clojure -J-Dclojure.main.report=stderr -M quickstart.clj" + ], + "expectedOutput": "session demo\n window editor: 2 panes\n window logs: 1 panes\noutput=hello from Clojure\n", + "variants": { + "concise": "(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n(import '[java.lang ProcessHandle]\n '[java.nio.file Files Path]\n '[java.nio.file.attribute FileAttribute]\n '[java.time Duration]\n [java.util.concurrent TimeUnit])\n\n(let [attrs (make-array FileAttribute 0)\n root (Path/of \"/tmp/libtmux-java-dev\" (make-array String 0))\n _ (Files/createDirectories root attrs)\n directory (Files/createTempDirectory root \"clojure-home-\" attrs)\n socket (.resolve directory \"tmux.sock\")\n daemon (atom nil)]\n (try\n (with-open [server (tm/open! {:socket-path socket\n :binary (or (System/getenv \"TMUX_BIN\") \"tmux\")\n :config-file \"/dev/null\"})]\n (try\n (let [session (tm/new-session! server {:name \"demo\"\n :window-name \"work\"\n :command [\"/bin/sh\"]})\n window (data/exactly-one (data/windows session))\n pane (data/exactly-one (data/panes window))\n _ (reset! daemon\n (.get (ProcessHandle/of\n (get-in session [:tmux/identity :tmux/pid]))))]\n (tm/rename! (:tmux/ref window) \"editor\")\n (assert (= \"work\" (:window/name window)))\n (tm/split-pane! (:tmux/ref pane)\n {:direction :right :command [\"/bin/cat\"]})\n (tm/new-window! (:tmux/ref session)\n {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/send-literal! (:tmux/ref pane)\n \"printf 'hello from %s\\\\n' Clojure\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (#{:appeared :present-at-entry}\n (tm/await-text! (:tmux/ref pane) \"hello from Clojure\"\n (Duration/ofSeconds 2))))\n (let [snapshot (tm/snapshot! server)\n observed (data/exactly-one (:tmux/sessions snapshot))]\n (assert (= \"demo\" (:session/name observed)))\n (println \"session\" (:session/name observed))\n (doseq [entry (data/windows observed)]\n (println (str \" window \" (:window/name entry) \": \"\n (count (data/panes entry)) \" panes\")))\n (assert (some #{\"hello from Clojure\"}\n (tm/capture! (:tmux/ref pane))))\n (println \"output=hello from Clojure\")))\n (finally\n (tm/kill-server! server)\n (when-let [^ProcessHandle process @daemon]\n (.get (.onExit process) 1 TimeUnit/SECONDS)))))\n (finally\n (if-let [^ProcessHandle process @daemon]\n (when-not (.isAlive process)\n (Files/deleteIfExists socket)\n (Files/deleteIfExists directory))\n (when-not (Files/exists socket (make-array java.nio.file.LinkOption 0))\n (Files/deleteIfExists directory))))))\n", + "errors": "(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n(import '[java.lang ProcessHandle]\n '[java.nio.file Files Path]\n '[java.nio.file.attribute FileAttribute]\n '[java.time Duration]\n [java.util.concurrent TimeUnit])\n\n(let [attrs (make-array FileAttribute 0)\n root (Path/of \"/tmp/libtmux-java-dev\" (make-array String 0))\n _ (Files/createDirectories root attrs)\n directory (Files/createTempDirectory root \"clojure-home-\" attrs)\n socket (.resolve directory \"tmux.sock\")\n daemon (atom nil)]\n (try\n (with-open [server (tm/open! {:socket-path socket\n :binary (or (System/getenv \"TMUX_BIN\") \"tmux\")\n :config-file \"/dev/null\"})]\n (try\n (let [session (tm/new-session! server {:name \"demo\"\n :window-name \"work\"\n :command [\"/bin/sh\"]})\n window (data/exactly-one (data/windows session))\n pane (data/exactly-one (data/panes window))\n _ (reset! daemon\n (.get (ProcessHandle/of\n (get-in session [:tmux/identity :tmux/pid]))))]\n (tm/rename! (:tmux/ref window) \"editor\")\n (assert (= \"work\" (:window/name window)))\n (tm/split-pane! (:tmux/ref pane)\n {:direction :right :command [\"/bin/cat\"]})\n (tm/new-window! (:tmux/ref session)\n {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/send-literal! (:tmux/ref pane)\n \"printf 'hello from %s\\\\n' Clojure\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (#{:appeared :present-at-entry}\n (tm/await-text! (:tmux/ref pane) \"hello from Clojure\"\n (Duration/ofSeconds 2))))\n (let [snapshot (tm/snapshot! server)\n observed (data/exactly-one (:tmux/sessions snapshot))]\n (assert (= \"demo\" (:session/name observed)))\n (println \"session\" (:session/name observed))\n (doseq [entry (data/windows observed)]\n (println (str \" window \" (:window/name entry) \": \"\n (count (data/panes entry)) \" panes\")))\n (assert (some #{\"hello from Clojure\"}\n (tm/capture! (:tmux/ref pane))))\n (println \"output=hello from Clojure\")))\n (catch Exception failure\n (throw (ex-info \"Clojure tmux quickstart failed\"\n {:tmux/failure (tm/error-summary failure)} failure)))\n (finally\n (tm/kill-server! server)\n (when-let [^ProcessHandle process @daemon]\n (.get (.onExit process) 1 TimeUnit/SECONDS)))))\n (finally\n (if-let [^ProcessHandle process @daemon]\n (when-not (.isAlive process)\n (Files/deleteIfExists socket)\n (Files/deleteIfExists directory))\n (when-not (Files/exists socket (make-array java.nio.file.LinkOption 0))\n (Files/deleteIfExists directory))))))\n", + "cleanup": "(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n(import '[java.lang ProcessHandle]\n '[java.nio.file Files Path]\n '[java.nio.file.attribute FileAttribute]\n '[java.time Duration]\n [java.util.concurrent TimeUnit])\n\n(let [attrs (make-array FileAttribute 0)\n root (Path/of \"/tmp/libtmux-java-dev\" (make-array String 0))\n _ (Files/createDirectories root attrs)\n directory (Files/createTempDirectory root \"clojure-home-\" attrs)\n socket (.resolve directory \"tmux.sock\")\n daemon (atom nil)]\n (try\n (with-open [server (tm/open! {:socket-path socket\n :binary (or (System/getenv \"TMUX_BIN\") \"tmux\")\n :config-file \"/dev/null\"})]\n (try\n (let [session (tm/new-session! server {:name \"demo\"\n :window-name \"work\"\n :command [\"/bin/sh\"]})\n window (data/exactly-one (data/windows session))\n pane (data/exactly-one (data/panes window))\n _ (reset! daemon\n (.get (ProcessHandle/of\n (get-in session [:tmux/identity :tmux/pid]))))]\n (tm/rename! (:tmux/ref window) \"editor\")\n (assert (= \"work\" (:window/name window)))\n (tm/split-pane! (:tmux/ref pane)\n {:direction :right :command [\"/bin/cat\"]})\n (tm/new-window! (:tmux/ref session)\n {:name \"logs\" :detached? true :command [\"/bin/cat\"]})\n (tm/send-literal! (:tmux/ref pane)\n \"printf 'hello from %s\\\\n' Clojure\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (assert (#{:appeared :present-at-entry}\n (tm/await-text! (:tmux/ref pane) \"hello from Clojure\"\n (Duration/ofSeconds 2))))\n (let [snapshot (tm/snapshot! server)\n observed (data/exactly-one (:tmux/sessions snapshot))]\n (assert (= \"demo\" (:session/name observed)))\n (println \"session\" (:session/name observed))\n (doseq [entry (data/windows observed)]\n (println (str \" window \" (:window/name entry) \": \"\n (count (data/panes entry)) \" panes\")))\n (assert (some #{\"hello from Clojure\"}\n (tm/capture! (:tmux/ref pane))))\n (println \"output=hello from Clojure\")))\n (finally\n (tm/kill-server! server)\n (when-let [^ProcessHandle process @daemon]\n (.get (.onExit process) 1 TimeUnit/SECONDS)))))\n (finally\n (if-let [^ProcessHandle process @daemon]\n (when-not (.isAlive process)\n (Files/deleteIfExists socket)\n (Files/deleteIfExists directory))\n (when-not (Files/exists socket (make-array java.nio.file.LinkOption 0))\n (Files/deleteIfExists directory)))))\n (assert (not (Files/exists directory\n (make-array java.nio.file.LinkOption 0)))))\n" + }, + "automaticCleanup": "Every view closes its client and stops its private server. If shutdown fails, its socket directory stays available for recovery. Cleanup also checks directory removal." } } diff --git a/site/src/data/manifest-packages.json b/site/src/data/manifest-packages.json index 1ed815c1e..bef554b69 100644 --- a/site/src/data/manifest-packages.json +++ b/site/src/data/manifest-packages.json @@ -735,6 +735,105 @@ "name": "TmuxWorkspace" } ] + }, + "clojure": { + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7", + "wrapper": "java", + "distributions": [ + { + "name": "io.github.libtmux:libtmux", + "version": "0.1.2", + "manifest": "libtmux/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-bom", + "version": "0.1.2", + "manifest": "libtmux-bom/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-clojure", + "version": "0.1.2", + "manifest": "libtmux-clojure/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-clojure-core-async", + "version": "0.1.2", + "manifest": "libtmux-clojure-core-async/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-jackson", + "version": "0.1.2", + "manifest": "libtmux-jackson/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-junit5", + "version": "0.1.2", + "manifest": "libtmux-junit5/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-kotlin", + "version": "0.1.2", + "manifest": "libtmux-kotlin/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-mcp", + "version": "0.1.2", + "manifest": "libtmux-mcp/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-scala_3", + "version": "0.1.2", + "manifest": "libtmux-scala/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-scala-cats_3", + "version": "0.1.2", + "manifest": "libtmux-scala-cats/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-scala-ox_3", + "version": "0.1.2", + "manifest": "libtmux-scala-ox/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-workspace", + "version": "0.1.2", + "manifest": "libtmux-workspace/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + }, + { + "name": "io.github.libtmux:libtmux-workspace-cli", + "version": "0.1.2", + "manifest": "libtmux-workspace-cli/build.gradle.kts", + "repo": "libtmux/libtmux-java", + "revision": "ccbcabf22e2605ba24d4fde33860423eceed32c7" + } + ], + "units": [] } } } diff --git a/site/src/data/mentions.json b/site/src/data/mentions.json index 086eaf2b6..7226e4c08 100644 --- a/site/src/data/mentions.json +++ b/site/src/data/mentions.json @@ -1,5 +1,250 @@ { "mentions": [ + { + "port": "clojure", + "symbol": "libtmux.async", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.async/cancel!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.async/runtime!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.async/then!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.control", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.control/attach!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core-async", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core-async/observe!", + "page": "/clojure/latest/guides/core-async/", + "title": "core.async adapter", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/batch!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/capture!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/chain!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/clients!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/open!", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.core/open!", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/panes!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/refresh!", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.core/refresh!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/rename!", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.core/rename!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/sessions!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "page": "/clojure/latest/guides/captured-values/", + "title": "Captured values", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/snapshot!", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.core/windows!", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.data", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.data/data", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/exactly-one", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/from-capture", + "page": "/clojure/latest/guides/captured-values/", + "title": "Captured values", + "section": "guides" + }, + { + "port": "clojure", + "symbol": "libtmux.data/matching", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/panes", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/same-entity?", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/same-link?", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "clojure", + "symbol": "libtmux.data/windows", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, { "port": "csharp", "symbol": "LibTmux.CapturedRelation.IsCaptured", @@ -5397,6 +5642,13 @@ "title": "Architecture", "section": "topics" }, + { + "port": "java", + "symbol": "io.github.libtmux.Pane_.Pane_", + "page": "/clojure/latest/guides/captured-values/", + "title": "Captured values", + "section": "guides" + }, { "port": "java", "symbol": "io.github.libtmux.Pane_.Pane_", @@ -5523,6 +5775,34 @@ "title": "Filtering and queries", "section": "concepts" }, + { + "port": "java", + "symbol": "io.github.libtmux.query.FilterExpr.FilterExpr", + "page": "/clojure/latest/concepts/server-session-window-pane/", + "title": "Server, session, window, pane", + "section": "concepts" + }, + { + "port": "java", + "symbol": "io.github.libtmux.query.FilterExpr.FilterExpr", + "page": "/clojure/latest/guides/captured-values/", + "title": "Captured values", + "section": "guides" + }, + { + "port": "java", + "symbol": "io.github.libtmux.query.FilterExpr.FilterExpr", + "page": "/clojure/latest/guides/captures-and-effects/", + "title": "Captures, effects and streams", + "section": "guides" + }, + { + "port": "java", + "symbol": "io.github.libtmux.query.FilterExpr.FilterExpr", + "page": "/clojure/latest/guides/getting-started/", + "title": "Getting started", + "section": "guides" + }, { "port": "java", "symbol": "io.github.libtmux.query.FilterExpr.FilterExpr", diff --git a/site/src/data/port-guides/clojure.json b/site/src/data/port-guides/clojure.json new file mode 100644 index 000000000..01a9ce2fe --- /dev/null +++ b/site/src/data/port-guides/clojure.json @@ -0,0 +1,24 @@ +{ + "source": { + "repository": "libtmux/libtmux-java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124" + }, + "guides": [ + { + "path": "libtmux-clojure/README.md", + "content": "\n
\n \n \n \"libtmux\n \n
\n\n\n
\n\n# libtmux-clojure\n\n**libtmux for Clojure:** a data-first façade over\n[libtmux-java][java-core]. It acquires tmux state as persistent maps and\nvectors, retains a Java handle at `:tmux/ref` for an explicit operation, and\nleaves ordinary Clojure collection processing local and unconstrained.\n\n
\n\n## Install\n\nThe Clojure façade has not shipped. Its Maven coordinate is\n`io.github.libtmux:libtmux-clojure`; there is no public release to install yet.\nBuild and verify it from this checkout:\n\n```console\n$ ./gradlew :libtmux-clojure:check :integration-tests:clojureIntegrationTest\n```\n\nThe façade requires JDK 25 or newer. The project tests tmux 3.3a through\n3.7c; [control streaming][guide-streaming] requires tmux 3.7 or newer.\n\n## Quick start\n\n`open!` connects to an explicit socket and owns only the local client.\n`snapshot!` acquires one captured graph. The `data/windows` and `data/panes`\nwalks below read that graph; they do not issue another tmux command.\n\nThe example runner supplies `libtmux.docs.socket` for its private server. In a\nREPL, replace that property lookup with the path to your server's socket.\nThe [complete programs][programs] include a launcher that sets up and removes\nan isolated server for you.\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (tm/new-session! server {:name \"docs-quick-start\"})\n (let [snapshot (tm/snapshot! server)\n session (first (filter #(= \"docs-quick-start\" (:session/name %))\n (:tmux/sessions snapshot)))]\n [(:session/name session)\n (count (data/windows session))\n (count (data/panes session))])))\n;; => [\"docs-quick-start\" 1 1]\n```\n\nUse `with-open` for every client, runtime, control connection, and\nsubscription that this program owns. Closing a `Server` releases client\nresources; it does not kill the tmux server.\n\n## Namespaces\n\n- [`libtmux.core`][core-api] — acquisition, effects, options, and command\n groups.\n- [`libtmux.data`][data-api] — captured traversal, projections, identity,\n cardinality, and Java predicate adapters.\n- [`libtmux.async`][async-api] — bounded tasks, deadlines, cancellation, and\n CompletionStage interop.\n- [`libtmux.control`][control-api] — explicit control replies and owned\n output subscriptions.\n\n## Run complete programs\n\nThe [Clojure API programs][programs] include their imports, entry points,\nconsumer dependencies, and private-server launcher. Start with captured\nsession/window/pane traversal, then compare native and Java predicates, create\na detached window, or send literal input and verify its captured output.\nThe capability programs add layout/movement, bounded capture and cancellation,\ncontrol output, and Java command exit results. CI executes every program and\nchecks its displayed result.\n\n## What it leaves out\n\n- **No hidden refreshes.** Acquisition and mutation end in `!`; captured\n traversal and native `filter`, `map`, `into`, and transducers stay local.\n- **No second query engine.** Use Clojure predicates for local logic, or adapt\n a canonical Java `FilterExpr` when its model and serialization semantics\n matter. The façade does not yet accept an EDN query language.\n- **No editable remote maps.** `assoc` changes ordinary data, not tmux. Keep\n `:tmux/ref` for an explicit effect, or use `data/data` for a detached EDN\n projection.\n- **No implicit asynchronous runtime.** `libtmux.async` is bounded and\n closeable. The `core.async` bridge is a separate optional artifact.\n- **No Clojure MCP server.** Model-facing tools belong to\n [libtmux-mcp][mcp-guide]; this façade remains a JVM library.\n- **No ClojureScript, Babashka, or native-image target.** The operational API\n depends on Java handles and the Java transport.\n\n## Support and status\n\nReleases are numbered `0.1.N`, and each release increments `N`. The API is\nnot settled: any release may change or remove exported identifiers, and the\nchangelog marks each break. Pin an exact version to avoid one.\n\nOnly the newest release is supported, with no backports. The Clojure façade\nis currently pre-release; CI tests Clojure 1.12.6 on JDK 25 and 27 against\nthe supported tmux endpoints, 3.3a and 3.7c. [Report a defect][contributing]\nwith the tmux version, endpoint choice, and the smallest reproducer.\n\n## Documentation\n\n- [Clojure guide][guide] — captures, links, filtering, effects, control\n streams, `core.async`, cancellation, and Java interop.\n- [Captured-data reference][reference] — every map key, relation, identity\n rule, and Java filter boundary.\n- [Native API reference][api] — public namespaces, arities, and docstrings,\n generated from the Clojure source and linked to it.\n- [Optional `core.async` adapter][core-async] — ownership, capacity, loss, and\n terminal outcomes.\n- [MCP guide][mcp-guide] — the model-facing server and its explicit boundary\n from this JVM façade.\n- [Benchmarking guide][benchmarks] — how the Java operation measurements are\n run. It does not yet claim a façade-specific benchmark.\n- [Changelog](CHANGELOG.md) — module-visible changes once this façade ships.\n\nEvery Clojure snippet in this README and the guide runs against an isolated\ntmux server in `:integration-tests:clojureIntegrationTest`; no snippet is\nillustrative pseudocode.\n\nThe module's `javadoc` classifier contains native Clojure reference HTML and\nan offline source browser. Build it with `:libtmux-clojure:clojureApiJar`;\nthe generated site starts at `build/docs/clojure/index.html` in this module.\n\n[benchmarks]: ../benchmarks/README.md\n[api]: ../docs/guide/clojure-api.md\n[async-api]: ../docs/guide/clojure-api.md#libtmuxasync\n[contributing]: ../.github/CONTRIBUTING.md\n[control-api]: ../docs/guide/clojure-api.md#libtmuxcontrol\n[core-api]: ../docs/guide/clojure-api.md#libtmuxcore\n[core-async]: ../libtmux-clojure-core-async/README.md\n[data-api]: ../docs/guide/clojure-api.md#libtmuxdata\n[guide]: ../docs/guide/clojure.md\n[guide-streaming]: ../docs/guide/clojure.md\n[java-core]: ../libtmux/README.md\n[mcp-guide]: ../docs/guide/mcp.md\n[programs]: ../examples/api/README.md#clojure-programs\n[reference]: ../docs/guide/clojure-reference.md\n" + }, + { + "path": "docs/guide/clojure.md", + "content": "# Clojure\n\n`libtmux-clojure` is a JVM façade over the Java library. It keeps tmux command\nencoding, transport, server identity and compatibility in Java, while exposing\ncaptured persistent Clojure values and ordinary collection operations.\n\nStart with the package [README](../../libtmux-clojure/README.md) for the\ninstall boundary and one capture. This guide explains the choices that matter\nafter the first program: what is captured, what can perform I/O, who owns\nworkers and streams, and where model-facing MCP tooling begins.\n\nThe native API references list every documented public var in\n[the core façade](clojure-api.md) and\n[the optional adapter](clojure-core-async-api.md).\nThey derive arities and docstrings from source; module checks reject stale\noutput. [Captured values](clojure-reference.md) documents the maps separately.\n\nFor complete files with their own entry points and a private-server launcher,\nuse the [Clojure API programs](../../examples/api/README.md#clojure-programs).\n\nEvery Clojure fence in reader-facing documentation is discovered and run against\nan owned tmux server. A fence must open and close its own client with\n`with-open` and end with one `;; =>` EDN result. The test fixture supplies\n`libtmux.docs.socket` and `libtmux.docs.binary`; applications supply their\nsocket path and use their selected binary or the default `tmux` command.\n\n## Values, links and projection\n\n`sessions!`, `windows!`, `panes!` and `clients!` acquire a graph. `data/windows`\nand `data/panes` traverse that graph without I/O. A window occurrence has a\ncontextual `:tmux/link`; `data/same-link?` includes the session, window and\nindex, while `data/same-entity?` compares only the physical identity.\n\n`nil` means an optional relationship or lookup was absent in a successful\ncapture. Failed acquisition throws an `ExceptionInfo`; it is never represented\nas an empty collection. `data/data` returns a detached EDN projection without\nthe Java refs required for effects or Java filter evaluation.\n\n## Resource scopes and laziness\n\nAcquisition returns eager captured values. A lazy `filter` or `map` over those\nvalues reads only Clojure data, so it can escape the `with-open` scope. An I/O\noperation such as `capture!` is different: realize it inside the scope that\nowns its server. Do not return `(map #(tm/capture! (:tmux/ref %)) panes)` from\n`with-open`; use `mapv`, `into`, or another eager reduction before closing.\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))\n {:keys [lazy-names captures]}\n (with-open [server (tm/open! {:socket-path socket-path})]\n (let [session (tm/new-session! server {:name \"docs-lazy\"})\n pane (first (data/panes (first (data/windows session))))]\n {:lazy-names (->> (tm/sessions! server)\n (filter #(= \"docs-lazy\" (:session/name %)))\n (map :session/name))\n :captures (mapv #(tm/capture! (:tmux/ref %) {:from :history})\n [pane])}))]\n [(vec lazy-names) (count captures)])\n;; => [[\"docs-lazy\"] 1]\n```\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (let [session (tm/new-session! server {:name \"docs-projection\"})]\n (data/data (select-keys session [:tmux/ref :session/name])))))\n;; => {:session/name \"docs-projection\"}\n```\n\n## Native filtering and Java expressions\n\nUse `filter`, `map`, `into` and transducers for unrestricted local Clojure\nlogic. Java `FilterExpr` remains available when an expression must use its\ncanonical Java fields and relationship semantics. `data/predicate` returns an\nIFn. `data/matching` returns a transducer with one argument and a lazy sequence\nwith an expression and collection. Both evaluate preserved `:tmux/ref` values,\nnot fields edited in a Clojure map.\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n(import '[io.github.libtmux Session_])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (tm/new-session! server {:name \"docs-query\"})\n (->> (tm/sessions! server)\n (data/matching (.is (Session_/name) \"docs-query\"))\n (mapv :session/name))))\n;; => [\"docs-query\"]\n```\n\nUse `data/exactly-one` when zero or many candidates is an error, and\n`data/one-or-none` when absence is allowed. Establish cardinality before any\neffect.\n\n## Effects, errors and execution modes\n\nEvery effect in `libtmux.core` takes a Java ref from `:tmux/ref`; a captured map\nis not an editable remote object. `new-session!`, `rename!`, `split-pane!` and\n`refresh!` return new captured values when they can recapture the result. Void\noperations return `nil`.\n\nValidation errors include `:tmux/phase :validation` and\n`:tmux/dispatch :not-dispatched`. Transport and mutation failures retain the\noperation, dispatch certainty and whether effects are possible. Inspect the\nstable subset with `core/error-summary`; do not parse exception messages.\n\n`batch!` and `chain!` use fresh Java groups. Their per-position results can be\n`:complete`, `:failed`, `:skipped` or `:unknown`; neither operation promises a\ntransaction or rollback. A group that can wait needs `{:kind :wait}` so its\nrelease can reserve capacity.\n\n### Bounded capture work and cancellation\n\n`libtmux.async/runtime!` bounds asynchronous work. Submit each capture as a\ntask, then dereference its result after the runtime has admitted it. Task\nsubmission does not add another tmux transport or alter the captured values.\n\n\n```clojure\n(require '[libtmux.async :as async]\n '[libtmux.core :as tm])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})\n runtime (async/runtime! {:max-running 3})]\n (tm/new-session! server {:name \"docs-parallel\"})\n (let [tasks (mapv (fn [_] (async/submit! runtime #(tm/snapshot! server)))\n (range 2))]\n (mapv #(boolean (some (fn [session]\n (= \"docs-parallel\" (:session/name session)))\n (:tmux/sessions @%)))\n tasks))))\n;; => [true true]\n```\n\n`cancel!` is explicit. A cancellation accepted after a task starts reports\nunknown dispatch certainty, because the enclosing tmux operation might have\nstarted. Use a separate `:wait` task for operations that wait for a release.\n\n\n```clojure\n(require '[libtmux.async :as async]\n '[libtmux.core :as tm])\n(import '[java.time Duration])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})\n runtime (async/runtime! {})]\n (let [started (promise)\n task (async/submit! runtime {:kind :wait}\n #(do (deliver started true)\n (tm/await-channel! server \"docs-cancel\"\n (Duration/ofSeconds 20))))]\n @started\n (async/cancel! task)\n (try\n @task\n (catch clojure.lang.ExceptionInfo failure\n [(:tmux/error (ex-data failure))\n (:tmux/dispatch (ex-data failure))])))))\n;; => [:cancelled :unknown]\n```\n\n### Layouts and literal input\n\nCreation and layout functions modify tmux and return fresh observations when\nthey create a target. `apply-layout!` accepts tmux's explicit layout text.\n`send-literal!` writes characters without treating them as tmux key names;\n`send-keys!` takes an explicit key vector. Their complete return does not mean\nthe program in the pane has finished processing input.\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (let [session (tm/new-session! server {:name \"docs-layout\"})\n window (tm/new-window! (:tmux/ref session)\n {:name \"docs-layout-window\" :detached? true})\n pane (first (data/panes window))\n _ (tm/apply-layout! (:tmux/ref window) (:window/layout window))\n split (tm/split-pane! (:tmux/ref pane)\n {:direction :right :percent 30})]\n [(:window/name window) (= (:tmux/link pane) (:tmux/link split))])))\n;; => [\"docs-layout-window\" true]\n```\n\n\n```clojure\n(require '[clojure.string :as str]\n '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (let [session (tm/new-session! server {:name \"docs-literal\"})\n pane (first (data/panes (first (data/windows session))))]\n (tm/send-literal! (:tmux/ref pane) \"printf docs-literal\")\n (tm/send-keys! (:tmux/ref pane) [\"Enter\"])\n (boolean (some #(str/includes? % \"docs-literal\")\n (tm/capture! (:tmux/ref pane) {:from :history}))))))\n;; => true\n```\n\n### Contextual targeting\n\nA linked window keeps the same physical window identity but has another\noccurrence context. Effects use its preserved ref, so an unlinked occurrence\ndoes not silently target a remaining link in another session.\n\n\n```clojure\n(require '[libtmux.core :as tm]\n '[libtmux.data :as data])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})]\n (let [first-session (tm/new-session! server {:name \"docs-link-first\"})\n second-session (tm/new-session! server {:name \"docs-link-second\"})\n window (first (data/windows first-session))]\n (tm/link-window! (:tmux/ref window) (:tmux/ref second-session))\n (let [linked (first (filter #(= (:window/id window) (:window/id %))\n (data/windows\n (tm/refresh! (:tmux/ref second-session)))))]\n [(data/same-entity? window linked) (data/same-link? window linked)]))))\n;; => [true false]\n```\n\n## Lifecycle, streaming and optional adapters\n\n`libtmux.async/runtime!` owns bounded JVM workers. Close it, or use `with-open`;\nclosing a borrowed server or executor is never an adapter side effect. Tasks\nhave explicit admission, cancellation and deadline results, and expose a Java\n`CompletionStage` for Manifold or other JVM integration.\n\nControl needs tmux 3.7 or newer. On an older daemon `attach!` is\nrefused before any client exists, with `:tmux/error` `:tmux/unsupported-feature`\nand `:tmux/dispatch` `:not-dispatched`; the rest of the façade keeps the 3.3a\nminimum. Control observations have an explicit owner and terminal result. A\nbounded consumer can lose events: the next read is a `:gap` naming how many were\ndropped, ahead of the events that remain, and an adapter loss stays distinct\nfrom it. `:capacity` bounds queued events; `:max-bytes` bounds their unescaped\npayload, defaulting to 16 MiB. An oversized event drops the buffered prefix\nand itself. `:loss` reports cumulative upstream event and byte counts.\n\nText subscriptions decode preserved bytes independently per pane and reset\nafter their own gaps. Malformed bytes become `\\\\xHH`; partial characters at\ntermination appear in `:trailing-text`, keyed by pane ID. `:decoder-capacity`\nbounds panes with partial characters, defaulting to 1024. A reset reports\n`:decoder/reset` as `:gap` or `:capacity` and increments `:decoder/resets`.\n\nThe terminal `:reason` distinguishes `:closed`, `:completed`, `:control-exit`,\n`:transport-failure`, `:protocol-failure`, and `:unknown`. A `%exit`\nnotification ends the client; it does not prove daemon death. An unexplained\nEOF stays unknown. `:cause` retains the original exception, including any\nsensitive text.\n\nDo not model a subscription as an unbounded lazy sequence, and do not perform\nblocking observation work in a core.async `go` block. Add the optional\n`io.github.libtmux/libtmux-clojure-core-async` dependency only for\n`libtmux.core-async`.\n\nStopping the channel adapter preserves the owned subscription's final outcome\nunder `:upstream/terminal`, including loss, cause, and trailing partial text.\nIts `:adapter/events` loss counter stays separate from upstream counters.\n\nAn empty slow stream reports a timeout without becoming terminal. A later event\nremains readable from the same owned stream.\n\n\n```clojure\n(require '[libtmux.control :as control]\n '[libtmux.core :as tm])\n(import '[java.lang AutoCloseable]\n '[java.time Duration])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path\n :binary (System/getProperty\n \"libtmux.docs.binary\")})\n connection (control/attach!\n (:tmux/ref (first (tm/sessions! server)))\n (Duration/ofSeconds 2))\n stream (control/subscribe! connection {:capacity 64\n :max-bytes 65536})]\n (let [initial (control/next! stream (Duration/ofMillis 25))\n pane (first (:reply/lines\n (control/send! connection\n [\"new-window\" \"-P\" \"-F\" \"#{pane_id}\"\n (str \"stty -echo; printf docs-slow;\"\n \" read stop\")])))\n event (control/next! stream (Duration/ofMillis 900))]\n [(= :timeout (:stream/status initial))\n (= pane (:pane/id event))])))\n;; => [true true]\n```\n\n\n```clojure\n(require '[clojure.core.async :as async]\n '[libtmux.control :as control]\n '[libtmux.core :as tm]\n '[libtmux.core-async :as adapter])\n(import '[java.time Duration])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path\n :binary (System/getProperty\n \"libtmux.docs.binary\")})\n connection (control/attach!\n (:tmux/ref (first (tm/sessions! server)))\n (Duration/ofSeconds 2))]\n (let [owner (adapter/observe! connection)\n pane (first (:reply/lines\n (control/send! connection\n [\"new-window\" \"-P\" \"-F\" \"#{pane_id}\"\n (str \"stty -echo; printf docs-async;\"\n \" read stop\")])))\n timeout (async/timeout 900)\n [event port] (async/alts!! [(adapter/events owner) timeout]\n :priority true)]\n (async/close! (adapter/events owner))\n [(and (identical? port (adapter/events owner)) (= pane (:pane/id event)))\n (:reason (async/ [true :adapter-stopped]\n```\n\n### Manifold CompletionStage recipe\n\nManifold remains a consumer dependency. Add\n`manifold/manifold {:mvn/version \"0.5.0\"}` to the application, then adapt the\npublic `CompletionStage`; it does not become a `libtmux` dependency. `then!`\nuses the runtime's bounded callback executor. A Manifold deferred observes the\nstage; cancelling that deferred does not cancel the task, so call `cancel!`\nexplicitly when ownership requires it.\n\n\n```clojure\n(require '[libtmux.async :as async]\n '[libtmux.core :as tm]\n '[manifold.deferred :as deferred])\n(import '[java.util.concurrent CompletionStage])\n\n(let [socket-path (java.nio.file.Path/of\n (System/getProperty \"libtmux.docs.socket\")\n (make-array String 0))]\n (with-open [server (tm/open! {:socket-path socket-path})\n runtime (async/runtime! {})]\n (tm/new-session! server {:name \"docs-manifold\"})\n (let [task (async/submit! runtime #(tm/snapshot! server))\n stage (async/then! runtime task\n #(boolean (some (fn [session]\n (= \"docs-manifold\"\n (:session/name session)))\n (:tmux/sessions %))))\n observed (deferred/->deferred stage)]\n [(instance? CompletionStage stage) @observed])))\n;; => [true true]\n```\n\n## Compatibility and Java interop\n\nThe façade supports JDK 25 or newer, the floor of the Java core it wraps, and\nthe repository's tmux 3.3a through 3.7c matrix; control needs tmux 3.7 or\nnewer. It is JVM-only: it does not run in ClojureScript, Babashka, or a native\nimage. Existing Java handles, `FilterExpr`, the optional Jackson codec, and\nJava async types remain directly usable when the Clojure functions do not cover\nan operation.\n\n[`clojure-reference.md`](clojure-reference.md) lists every captured key and\nrelation, its availability, identity meaning and Java filter support.\n\n## MCP boundary and measurement\n\nThis façade is for a Clojure process that owns its own tmux decisions. It does\nnot turn arbitrary persistent maps, predicates, or Clojure functions into MCP\ntools. For an MCP client such as Codex or Claude Code, use\n[libtmux-mcp](mcp.md): it has named tools, endpoint selection, toolsets, and\nbounded reads. A Clojure application can use both libraries, but their\ncontracts remain separate.\n\nThe [operation benchmark](../benchmarks/operation-costs.md) measures Java\noperations under documented conditions. It is useful when a Clojure program\nchanges its acquisition pattern, but it is not a Clojure façade benchmark.\nThere is no published façade throughput or allocation claim. Measure the\napplication's capture count, filtering/projection allocation, and any owned\nruntime queue under its real tmux workload before setting a capacity.\n" + }, + { + "path": "docs/guide/clojure-reference.md", + "content": "# Clojure captured-value reference\n\n`libtmux.data/from-capture` creates every value in this reference. `snapshot!`\nand the `*!` listing functions acquire one captured graph; `data/windows`,\n`data/panes`, `data/active-window` and `data/active-pane` traverse it without\nI/O. Scalar access is ordinary Clojure keyword lookup and is also local.\n\nEvery owning map has its documented key, even when the value is `nil` because\ntmux did not report an optional value. A missing relationship means the parent\nor target was absent from an otherwise successful capture. Failed acquisition\nthrows; it is never an empty graph.\n\n`data/data` removes every `:tmux/ref`. The ref is the only effect authority;\nediting `:session/id`, `:window/id` or `:pane/id` changes a map, not tmux.\n`data/same-entity?` compares `:tmux/identity`. `data/same-link?` also compares\nthe window placement in `:tmux/link`; it does not establish a daemon generation\nor detect an unseen identical unlink-and-relink replacement.\n\n\n\n## Shared keys\n\n- `:tmux/ref` is the Java handle. `data/data` removes it; effects and\n `FilterExpr` need it, while identity does not.\n- `:tmux/identity` is always-present endpoint, server-PID, kind and physical-ID\n data. `same-entity?` compares it.\n- `:tmux/link` exists only on windows and panes. It holds session, window and\n index occurrence context; `same-link?` compares it.\n- `:tmux/realm` and `:tmux/server` are always-present identity text. Neither\n has a Java filter field.\n- `:tmux/pid` is an integer or `nil`; the key stays present when tmux does not\n report a daemon or pane PID. It has no Java filter field.\n- `:tmux/kind` is always-present `:server`, `:session`, `:window`, `:pane` or\n `:client` identity data. It has no Java filter field.\n- `:tmux/id` is always-present physical identity text. Editing it cannot\n retarget an effect, and it has no Java filter field.\n- `:tmux/captured-at` is a root-only `Instant`; `data/data` writes ISO-8601\n text. `:tmux/version` is root-only text or `nil` when unavailable. Neither\n has a Java filter field.\n\n## Root and sessions\n\n- `:tmux/sessions`, `:tmux/windows`, `:tmux/panes` and `:tmux/clients` are\n root-only captured vectors. They have no root Java relation.\n- `:session/id` and `:session/name` are always-present text. `Session_/id` and\n `Session_/name` support Java filtering.\n- `:session/attached?` is an always-present Boolean. `Session_/attached`\n supports Java filtering.\n- `:session/windows` is an always-present local vector relation. `data/windows`\n traverses it and `Session_/windows` is the canonical Java relation.\n\n## Windows and panes\n\n- `:window/id` is always-present underlying-window text across links.\n `Window_/id` supports Java filtering.\n- `:window/index` is the always-present index within `:tmux/link`.\n `Window_/index` supports Java filtering.\n- `:window/name` is always-present text. `Window_/name` supports Java\n filtering.\n- `:window/active?` is an always-present Boolean for this link's session.\n `Window_/active` supports Java filtering.\n- `:window/linked?` is an always-present Boolean stating that the underlying\n window has another link. `Window_/linked` supports Java filtering.\n- `:window/width` and `:window/height` are always-present captured cell sizes;\n `:window/layout` is always-present layout text. They have no Java fields.\n- `:window/panes` is an always-present local vector relation. `data/panes`\n traverses it and `Window_/panes` is the canonical Java relation.\n- `:pane/id` is always-present physical-pane text; `Pane_/id` supports Java\n filtering. `:pane/index` is an always-present window index; `Pane_/index`\n supports Java filtering.\n- `:pane/active?` is an always-present Boolean for the captured window.\n `Pane_/active` supports Java filtering.\n- `:pane/current-command` and `:pane/current-path` are always-present tmux\n text. `Pane_/command` and `Pane_/path` support Java filtering.\n- `:pane/floating?` is Boolean or `nil` when tmux does not report it. The key\n stays present and it has no Java field.\n- `:pane/width` and `:pane/height` are always-present cell sizes; `Pane_/width`\n and `Pane_/height` support Java filtering.\n- `:pane/left` and `:pane/top` are always-present captured positions;\n `Pane_/left` and `Pane_/top` support Java filtering.\n- `:pane/title` is always-present text; `Pane_/title` supports Java filtering.\n- `:pane/pid` is an integer or `nil` when tmux does not report it. The key stays\n present and it has no Java field.\n- `:pane/edges` is an always-present map with unqualified Boolean edge keys.\n It has no Java field.\n\n## Clients\n\n- `:client/name` is always-present tmux client text; `Client_/name` supports\n Java filtering.\n- `:client/session` is a session map or `nil` when no session is attached. The\n key stays present and `Client_/session` is the canonical Java relation.\n- `:client/active-window` and `:client/active-pane` are a captured map or\n `nil` when no attached session supplies them. Their keys stay present and\n they have no Java fields.\n\nJava expressions always evaluate the preserved Java ref through\n`data/predicate` or `data/matching`; they never evaluate edited or detached\nmaps. `Pane_` has no registered pane-to-window relation, so use captured\ntraversal for that direction instead of inventing a canonical Java relation.\n" + }, + { + "path": "libtmux-clojure-core-async/README.md", + "content": "\n
\n \n \n \"libtmux\n \n
\n\n\n
\n\n# libtmux-clojure-core-async\n\nOptional [core.async][core-async] integration for\n[libtmux-clojure](../libtmux-clojure/README.md). The base façade has no\ncore.async dependency.\n\n
\n\n## Install\n\nThis adapter has not shipped. Its Maven coordinate is\n`io.github.libtmux:libtmux-clojure-core-async`; there is no public release to\ninstall yet. Build and verify it from this checkout:\n\n```console\n$ ./gradlew :libtmux-clojure-core-async:check\n```\n\n## Ownership and backpressure\n\n`observe!` borrows a control connection and owns its subscription, virtual\nworker, events channel, and terminal channel. Closing the adapter or its\nevents channel stops that owned work; it never closes the borrowed connection.\n\nThe adapter defaults to an unbuffered events channel. Choose\n`:event-capacity` deliberately, account for its one pending event, and inspect\n`:gap` values from the upstream subscription separately from adapter loss.\nDo not run blocking control I/O in a `go` block.\n\nThe [Clojure guide][guide] contains executable control and core.async examples,\nincluding terminal outcomes and shutdown. See this module's\n[native API reference][api] for function arities and ownership contracts,\nand its [changelog](CHANGELOG.md) for release history.\n\nThe [complete core.async program][program] includes imports, a CLI entry point,\nthe optional dependency alias, private-server setup and cleanup. It closes its\nevents consumer, reads the terminal outcome, and reuses the borrowed connection.\n\nThe `javadoc` classifier contains native reference HTML and an offline source\nbrowser, generated from this module's var metadata.\n\n[api]: ../docs/guide/clojure-core-async-api.md\n[core-async]: https://clojure.github.io/core.async/clojure.core.async.html\n[guide]: ../docs/guide/clojure.md\n[program]: ../examples/api/README.md#clojure-programs\n" + } + ] +} diff --git a/site/src/data/registry.json b/site/src/data/registry.json index 86e3a7125..3c5d5a128 100644 --- a/site/src/data/registry.json +++ b/site/src/data/registry.json @@ -122,6 +122,13 @@ "release": "0.1.0", "tag": "v0.1.0" }, + "clojure": { + "status": "unpublished", + "version": null, + "release": null, + "tag": null, + "maturity": "unreleased" + }, "kotlin": { "status": "release", "version": "0.1.0", diff --git a/site/src/data/tmux-usage/clojure.json b/site/src/data/tmux-usage/clojure.json new file mode 100644 index 000000000..4503b63bc --- /dev/null +++ b/site/src/data/tmux-usage/clojure.json @@ -0,0 +1,581 @@ +{ + "commands": [ + "attach-session", + "bind-key", + "break-pane", + "capture-pane", + "choose-buffer", + "choose-client", + "choose-tree", + "clear-history", + "clear-prompt-history", + "clock-mode", + "command-prompt", + "confirm-before", + "copy-mode", + "customize-mode", + "delete-buffer", + "detach-client", + "display-menu", + "display-message", + "display-panes", + "display-popup", + "find-window", + "has-session", + "if-shell", + "join-pane", + "kill-pane", + "kill-server", + "kill-session", + "kill-window", + "last-pane", + "last-window", + "link-window", + "list-buffers", + "list-clients", + "list-commands", + "list-keys", + "list-panes", + "list-sessions", + "list-windows", + "load-buffer", + "lock-client", + "lock-server", + "lock-session", + "move-pane", + "move-window", + "new-pane", + "new-session", + "new-window", + "next-layout", + "next-window", + "paste-buffer", + "pipe-pane", + "previous-layout", + "previous-window", + "refresh-client", + "rename-session", + "rename-window", + "resize-pane", + "resize-window", + "respawn-pane", + "respawn-window", + "rotate-window", + "run-shell", + "save-buffer", + "select-layout", + "select-pane", + "select-window", + "send-keys", + "send-prefix", + "server-access", + "set-buffer", + "set-environment", + "set-hook", + "set-option", + "set-window-option", + "show-buffer", + "show-environment", + "show-hooks", + "show-messages", + "show-options", + "show-prompt-history", + "show-window-options", + "source-file", + "split-window", + "start-server", + "suspend-client", + "swap-pane", + "swap-window", + "switch-client", + "unbind-key", + "unlink-window", + "wait-for" + ], + "port": "clojure", + "repo": "libtmux/libtmux-java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "schemaVersion": 1, + "symbols": { + "libtmux.core/append-hook!": [ + { + "command": "set-hook", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Hooks.java:97", + "libtmux/src/main/java/io/github/libtmux/Hooks.java:84", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:473" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/apply-layout!": [ + { + "command": "select-layout", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:337" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Window.java:374" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Window.Window.applyLayout" + } + } + ], + "libtmux.core/delete-buffer!": [ + { + "command": "delete-buffer", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Buffers.java:96", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:494" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/detach-client!": [ + { + "command": "detach-client", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:398" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Client.java:48" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Client.Client.detach" + } + } + ], + "libtmux.core/environment!": [ + { + "command": "show-environment", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:441" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Environment.java:205", + "libtmux/src/main/java/io/github/libtmux/Environment.java:205", + "libtmux/src/main/java/io/github/libtmux/Environment.java:357", + "libtmux/src/main/java/io/github/libtmux/Environment.java:104" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Environment.Environment.all" + } + } + ], + "libtmux.core/find-session!": [ + { + "command": "list-sessions", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:161", + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:165", + "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:169" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/join-pane!": [ + { + "command": "join-pane", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:327" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:1093" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.joinTo" + } + } + ], + "libtmux.core/kill-server!": [ + { + "command": "display-message", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:299" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Server.java:418" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Server.Server.killServer" + } + }, + { + "command": "kill-server", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:299" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Server.java:418" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Server.Server.killServer" + } + } + ], + "libtmux.core/link-window!": [ + { + "command": "link-window", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:313" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Window.java:234" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Window.Window.linkTo" + } + } + ], + "libtmux.core/move-window!": [ + { + "command": "move-window", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:323" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Window.java:254" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Window.Window.moveTo" + } + } + ], + "libtmux.core/new-session!": [ + { + "command": "new-session", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SessionSpec.java:119", + "libtmux/src/main/java/io/github/libtmux/Server.java:255", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:252" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/new-window!": [ + { + "command": "new-window", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/WindowSpec.java:117", + "libtmux/src/main/java/io/github/libtmux/Session.java:260", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:263" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/options!": [ + { + "command": "show-options", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:420" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Options.java:153", + "libtmux/src/main/java/io/github/libtmux/Options.java:140" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Options.Options.all" + } + } + ], + "libtmux.core/paste-buffer!": [ + { + "command": "paste-buffer", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:499" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:956" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.pasteBuffer" + } + } + ], + "libtmux.core/run-shell!": [ + { + "command": "run-shell", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Shell.java:29", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:382" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/send-keys!": [ + { + "command": "list-panes", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:348" + ], + "scope": "window", + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:693", + "libtmux/src/main/java/io/github/libtmux/Pane.java:603" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.sendKeys" + } + }, + { + "command": "send-keys", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:348" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:609", + "libtmux/src/main/java/io/github/libtmux/Pane.java:602", + "libtmux/src/main/java/io/github/libtmux/Pane.java:665" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.sendKeys" + } + } + ], + "libtmux.core/send-literal!": [ + { + "command": "list-panes", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:343" + ], + "scope": "window", + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:693", + "libtmux/src/main/java/io/github/libtmux/Pane.java:645" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.sendLiteral" + } + }, + { + "command": "send-keys", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:343" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Pane.java:651", + "libtmux/src/main/java/io/github/libtmux/Pane.java:643", + "libtmux/src/main/java/io/github/libtmux/Pane.java:665" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Pane.Pane.sendLiteral" + } + } + ], + "libtmux.core/set-buffer!": [ + { + "command": "set-buffer", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Buffers.java:60", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:484" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/set-environment!": [ + { + "command": "set-environment", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Environment.java:353", + "libtmux/src/main/java/io/github/libtmux/Environment.java:156", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:447" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/set-hook!": [ + { + "command": "set-hook", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Hooks.java:66", + "libtmux/src/main/java/io/github/libtmux/Hooks.java:78", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:468" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/set-option!": [ + { + "command": "set-option", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Options.java:325", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:425" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/show-buffer!": [ + { + "command": "show-buffer", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Buffers.java:76", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:489" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/snapshot!": [ + { + "command": "list-clients", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:164", + "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:151" + ], + "reviewed": true, + "scope": null + }, + { + "command": "list-panes", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:163", + "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:151" + ], + "reviewed": true, + "scope": "server" + }, + { + "command": "list-sessions", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:161", + "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:151" + ], + "reviewed": true, + "scope": null + }, + { + "command": "list-windows", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/SnapshotCapture.java:162", + "libtmux/src/main/java/io/github/libtmux/Server.java:1087", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:151" + ], + "reviewed": true, + "scope": "server" + } + ], + "libtmux.core/switch-client!": [ + { + "command": "switch-client", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:402" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Client.java:67" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Client.Client.switchTo" + } + } + ], + "libtmux.core/unlink-window!": [ + { + "command": "unlink-window", + "evidence": [ + "libtmux-clojure/src/main/clojure/libtmux/core.clj:317" + ], + "scope": null, + "via": { + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Window.java:246" + ], + "port": "java", + "revision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "symbol": "io.github.libtmux.Window.Window.unlink" + } + } + ], + "libtmux.core/unset-environment!": [ + { + "command": "set-environment", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Environment.java:353", + "libtmux/src/main/java/io/github/libtmux/Environment.java:168", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:452" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/unset-hook!": [ + { + "command": "set-hook", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Hooks.java:103", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:478" + ], + "reviewed": true, + "scope": null + } + ], + "libtmux.core/unset-option!": [ + { + "command": "set-option", + "evidence": [ + "libtmux/src/main/java/io/github/libtmux/Options.java:370", + "libtmux-clojure/src/main/clojure/libtmux/core.clj:430" + ], + "reviewed": true, + "scope": null + } + ] + } +} diff --git a/site/src/lib/api-glossary-native.ts b/site/src/lib/api-glossary-native.ts index 76e1d3218..ebc23c3bf 100644 --- a/site/src/lib/api-glossary-native.ts +++ b/site/src/lib/api-glossary-native.ts @@ -24,6 +24,12 @@ const elixirDocs = (page: string) => `https://elixir.hexdocs.pm/${page}` const swiftBook = (page: string) => `https://docs.swift.org/latest/documentation/the-swift-programming-language/${page}/` export const NATIVE_API_GLOSSARIES: Record> = { + clojure: { + module: term('A Clojure namespace containing public vars.', 'Clojure namespaces', 'https://clojure.org/reference/namespaces', 'Require the namespace with an alias, then call a var as alias/name. A namespace and an installable artifact are different boundaries.'), + function: term('A function stored in a public Clojure var.', 'Clojure vars', 'https://clojure.org/reference/vars', 'The signature lists argument vectors. A trailing ! marks external I/O in this library; captured data operations remain local.'), + overload: term('Alternative argument counts accepted by one Clojure function.', 'Clojure function arities', 'https://clojure.org/reference/special_forms#fn', 'Each argument vector is an arity. Selection uses the number of arguments; it does not dispatch on Java parameter types.'), + package: term('The Maven artifact supplying this namespace.', 'Clojure namespaces', 'https://clojure.org/reference/namespaces', 'Use the installation instructions for artifact coordinates. The optional core.async adapter is a separate artifact.'), + }, scala: { module: term('A singleton object that groups Scala declarations.', 'Scala singleton objects', scalaTour('singleton-objects'), 'The module badge represents object declarations here. Its members belong to that object; the label does not identify a separately installed artifact.'), class: term('A Scala class that defines instances, constructors and members.', 'Scala classes', scalaTour('classes'), 'Traits and case classes have their own declaration syntax; read the displayed signature for those distinctions.'), diff --git a/site/src/lib/api-labels.ts b/site/src/lib/api-labels.ts index 538bac0ce..b40195bbd 100644 --- a/site/src/lib/api-labels.ts +++ b/site/src/lib/api-labels.ts @@ -42,11 +42,12 @@ export function abbreviateNamespace(namespace: string): string { /** * A qualified name as its path and the declaration's own name: `libtmux::pane::Pane::send_keys` is - * `libtmux::pane::Pane::` and `send_keys`. The separators are the ports': `::`, `.`, `#`, `:` and `\`. + * `libtmux::pane::Pane::` and `send_keys`. Clojure separates a namespace and var with `/`; + * Elixir's trailing `/arity` belongs to the declaration's own name. * A Swift name ends in argument labels, `send(keys:)`, which belong to the name, so the search stops at the first `(`. */ export function splitQualifiedName(name: string): [path: string, leaf: string] { - const last = [...name.split('(')[0]!.matchAll(/::|[.#:\\]/g)].at(-1) + const last = [...name.split('(')[0]!.matchAll(/::|[.#:\\]|\/(?!\d+$)/g)].at(-1) const cut = last ? last.index + last[0].length : 0 return cut < name.length ? [name.slice(0, cut), name.slice(cut)] : ['', name] } diff --git a/site/src/lib/api-models.ts b/site/src/lib/api-models.ts index 5bf18a561..fff626a1f 100644 --- a/site/src/lib/api-models.ts +++ b/site/src/lib/api-models.ts @@ -41,6 +41,8 @@ import fsharpModel from '../data/api/fsharp.json' import kotlinNav from '../data/api/kotlin.nav.json' import scalaNav from '../data/api/scala.nav.json' import fsharpNav from '../data/api/fsharp.nav.json' +import clojureModel from '../data/api/clojure.json' +import clojureNav from '../data/api/clojure.nav.json' /** * The extracted models, in one module rather than in the route. @@ -68,6 +70,7 @@ export const API_MODELS: Record = { kotlin: kotlinModel as unknown as ApiModel, scala: scalaModel as unknown as ApiModel, fsharp: fsharpModel as unknown as ApiModel, + clojure: clojureModel as unknown as ApiModel, } /** One entry in a curated sidebar bucket, carrying just enough to link it. */ @@ -131,6 +134,7 @@ export const API_NAV: Record = { kotlin: kotlinNav as unknown as PortNavData, scala: scalaNav as unknown as PortNavData, fsharp: fsharpNav as unknown as PortNavData, + clojure: clojureNav as unknown as PortNavData, } export { isMemberOwner, OWNER_KINDS } from '@libtmux/api-model' @@ -152,6 +156,7 @@ export const PORT_NAME: Record = { kotlin: 'Kotlin', scala: 'Scala', fsharp: 'F#', + clojure: 'Clojure', } /** @@ -237,7 +242,7 @@ const INVENTORIES: { { data: jdkInv, baseUrl: 'https://docs.oracle.com/en/java/javase/21/docs/api/', - langs: ['java', 'kotlin', 'scala'], + langs: ['java', 'kotlin', 'scala', 'clojure'], project: 'Java SE', }, { diff --git a/site/src/lib/api-sections.ts b/site/src/lib/api-sections.ts index 982fd64ee..ce7d6bcf2 100644 --- a/site/src/lib/api-sections.ts +++ b/site/src/lib/api-sections.ts @@ -228,7 +228,7 @@ export function aliasDeclaration(symbol: ApiSymbol, language?: string): { name: /** Keep native declaration syntax consistent in HTML and copied Markdown. */ export function usesNativeSignatures(symbol: ApiSymbol, port?: string): boolean { - return (port === 'rs' && Boolean(symbol.variant)) || supportsRustSignatures(symbol, port) || supportsTypeScriptSignatures(symbol, port) || supportsGoSignatures(symbol, port) || supportsJavaSignatures(symbol, port) || supportsCSharpSignatures(symbol, port) || supportsRubySignatures(symbol, port) || supportsLuaSignatures(symbol, port) || supportsElixirSignatures(symbol, port) || ['kotlin', 'scala', 'fsharp', 'c', 'powershell', 'julia'].includes(port ?? '') || + return (port === 'rs' && Boolean(symbol.variant)) || supportsRustSignatures(symbol, port) || supportsTypeScriptSignatures(symbol, port) || supportsGoSignatures(symbol, port) || supportsJavaSignatures(symbol, port) || supportsCSharpSignatures(symbol, port) || supportsRubySignatures(symbol, port) || supportsLuaSignatures(symbol, port) || supportsElixirSignatures(symbol, port) || ['kotlin', 'scala', 'fsharp', 'c', 'powershell', 'julia', 'clojure'].includes(port ?? '') || (port === 'cxx' && symbol.signatures.length > 0 && symbol.signatures.every((signature) => Boolean(signature.raw))) } diff --git a/site/src/lib/brand-palettes.json b/site/src/lib/brand-palettes.json index 786aa18b1..d0f6ab6fa 100644 --- a/site/src/lib/brand-palettes.json +++ b/site/src/lib/brand-palettes.json @@ -414,5 +414,31 @@ "solid": "#54167b", "onSolid": "#ffffff" } + }, + "clojure": { + "name": "Clojure", + "color": "#DB5855", + "light": { + "background": "#fafbfc", + "surface": "#f3f5f7", + "hover": "#e9edf1", + "border": "#d6dce3", + "text": "#202830", + "muted": "#53606d", + "link": "#632826", + "solid": "#632826", + "onSolid": "#ffffff" + }, + "dark": { + "background": "#15191d", + "surface": "#1c2229", + "hover": "#29323d", + "border": "#3e4a57", + "text": "#e7edf3", + "muted": "#b7c1cd", + "link": "#f4cdcc", + "solid": "#632826", + "onSolid": "#ffffff" + } } } diff --git a/site/src/lib/core-home.ts b/site/src/lib/core-home.ts index 7afb58085..5a22ce493 100644 --- a/site/src/lib/core-home.ts +++ b/site/src/lib/core-home.ts @@ -88,6 +88,7 @@ export interface CoreSymbolLink { export interface CoreHome { summary: string + objectLabel: 'Type' | 'Function' objects: (CoreSymbolLink & { role: CoreRole; wraps: string; tmuxId: string })[] capabilities: Record } @@ -124,7 +125,9 @@ export function resolveCoreHome(port: string, version: string, entry: CoreHomeEn } for (const group of Object.values(capabilities)) group.sort((a, b) => Object.keys(CAPABILITIES).indexOf(a.key) - Object.keys(CAPABILITIES).indexOf(b.key)) - return { summary: coreDescription(port, entry), objects, capabilities } + const objectLabel = objects.every((object) => API_MODELS[port]!.symbols + .find((symbol) => (symbol.publicId ?? symbol.id) === object.id)?.kind === 'function') ? 'Function' : 'Type' + return { summary: coreDescription(port, entry), objectLabel, objects, capabilities } } /** The page's facts as Markdown, for the `.md` twin and llms-full.txt. */ @@ -134,7 +137,7 @@ export function coreHomeMarkdown(port: string, version: string, origin: string): return [ coreLead(port), '## At a glance', - '| Type | Wraps |\n| ---- | ----- |\n' + home.objects.map((object) => + `| ${home.objectLabel} | Wraps |\n| ---- | ----- |\n` + home.objects.map((object) => `| [\`${object.name}\`](${at(object.href)}) | ${object.wraps}${object.tmuxId ? `, ID \`${object.tmuxId}n\`` : ''} |`).join('\n'), ...Object.entries(CAPABILITY_GROUPS).flatMap(([group, title]) => { const rows = home.capabilities[group as keyof typeof CAPABILITY_GROUPS] diff --git a/site/src/lib/docs-paths.ts b/site/src/lib/docs-paths.ts index 38654e0a3..9ff04c5cd 100644 --- a/site/src/lib/docs-paths.ts +++ b/site/src/lib/docs-paths.ts @@ -57,7 +57,7 @@ export function docsPath(entry: DocsPage): string { /** Infer library references only outside the native tmux prose routes. */ export function isTmuxProse(entry: DocsPage, buildPort?: string): boolean { - if (entry.data.port || buildPort) return false + if (entry.data.port || (buildPort && !PORT_BY_SLUG[buildPort]?.parentLibrary)) return false const locale = entry.id.split('/')[0]! const id = isLocale(locale) && locale !== DEFAULT_LOCALE ? entry.id.slice(locale.length + 1) : entry.id const path = docsPath({ ...entry, id }) diff --git a/site/src/lib/header-links.ts b/site/src/lib/header-links.ts index 3abf04113..0e819e1ce 100644 --- a/site/src/lib/header-links.ts +++ b/site/src/lib/header-links.ts @@ -8,7 +8,7 @@ * where an unpublished entry yields nothing. */ import { - API_HOSTS, INVENTORY, INVENTORY_KIND_LABEL, KIND_TERMS, PACKAGE_HOSTS, entryDestinations, + API_HOSTS, INVENTORY, INVENTORY_KIND_LABEL, KIND_TERMS, PACKAGE_HOSTS, documentedLibrary, entryDestinations, type DestinationKind, type HostIcon, type InventoryEntry, type InventoryProduct, } from './port-inventory' import { PICKER_GROUP_LABEL, portDestinations, type Port } from './ports' @@ -127,8 +127,9 @@ function indexRows(entries: readonly InventoryEntry[], home: string): HeaderRow[ } export function portHeaderLinks(port: Port, inventory: Readonly> = INVENTORY): PortHeaderLinks { - const entries = (inventory[port.slug] ?? []).filter((entry) => entry.status === 'published') - const library = entries.find((entry) => entry.kind === 'library') + const all = inventory[port.slug] ?? [] + const entries = all.filter((entry) => entry.status === 'published') + const library = documentedLibrary(all) if (!library) return { actions: [], rows: [], indexed: false } const { source } = portDestinations({ port }) const actions: HeaderAction[] = [{ diff --git a/site/src/lib/highlight.ts b/site/src/lib/highlight.ts index 790f56782..7c2a1ac85 100644 --- a/site/src/lib/highlight.ts +++ b/site/src/lib/highlight.ts @@ -121,7 +121,7 @@ const EC_LANGS = new Set([ 'python', 'ruby', 'lua', 'rust', 'ts', 'tsx', 'js', 'jsx', 'java', 'kotlin', 'scala', 'fsharp', 'swift', 'csharp', 'cpp', 'c', 'go', 'bash', 'shell', 'console', 'json', 'yaml', 'toml', 'xml', 'diff', 'text', 'tmux-usage', 'tmux-shell', 'tmux-config', 'powershell', 'julia', 'elixir', 'properties', 'ini', - 'cmake', + 'cmake', 'clojure', ]) const EC_ALIASES: Record = { diff --git a/site/src/lib/native-name.ts b/site/src/lib/native-name.ts index 0550d62be..c8783bfa8 100644 --- a/site/src/lib/native-name.ts +++ b/site/src/lib/native-name.ts @@ -17,8 +17,8 @@ import { qualifiedNameOf, type ApiSymbol } from '@libtmux/api-model' * * `nativeShortName` is the short form a hover card uses for its header: the owner and the member in the language's * separator (`ControlSender::unmute_pane`, `Server#new_session`, `Buffer:reference`, `Capture.fetch/2`), and the bare name - * for a declaration with no owner. The full name is the page's Qualified name row. The page heading still joins the owner - * and the member with a dot in every port, so for Rust, C++, Ruby, Lua and PowerShell it differs from the card's header. + * for a declaration with no owner. The full name is the page's Qualified name row. Clojure headings keep the full + * namespace/var spelling; other ports join the owner and member with a dot in the page heading. * * This is for display. The public id, the anchors and the URLs stay as the model has them. */ diff --git a/site/src/lib/port-documentation.ts b/site/src/lib/port-documentation.ts index f290e8adc..cd0eac866 100644 --- a/site/src/lib/port-documentation.ts +++ b/site/src/lib/port-documentation.ts @@ -103,6 +103,32 @@ const PORT_DOCUMENTATION: Readonly> = { ], redirects: [{ sourcePath: 'docs/src/api.md', path: 'guides/api-overview', target: 'reference' }], }, + clojure: { + domains: [ + libraryDomain('Captured persistent values, explicit effects and bounded JVM tasks over libtmux-java.'), + { id: 'async', label: 'core.async adapter', kind: 'companion-package', navGroup: 'Library', + route: 'guides/core-async', package: 'async', + description: 'Use the optional, separately installable adapter for bounded event channels and explicit shutdown.' }, + ], + sourceGuides: [ + guide('libtmux-clojure/README.md', 'guides/getting-started', 'core', { + title: 'Getting started', sidebar: { group: 'Guides', order: 2 }, + }), + guide('docs/guide/clojure.md', 'guides/captures-and-effects', 'core', { + title: 'Captures, effects and streams', sidebar: { group: 'Guides', order: 3 }, + }), + guide('docs/guide/clojure-reference.md', 'guides/captured-values', 'core', { + title: 'Captured values', sidebar: { group: 'Guides', order: 4 }, + }), + guide('libtmux-clojure-core-async/README.md', 'guides/core-async', 'async', { + title: 'core.async adapter', sidebar: { group: 'Guides', order: 5 }, + }), + ], + redirects: [ + { sourcePath: 'docs/guide/clojure-api.md', path: 'guides/native-api', target: 'reference' }, + { sourcePath: 'docs/guide/clojure-core-async-api.md', path: 'guides/adapter-api', target: 'reference/libtmux-core-async' }, + ], + }, kotlin: { domains: [libraryDomain('Kotlin coroutine handles, builders and flows over the Java/JVM library.')], sourceGuides: [ diff --git a/site/src/lib/port-families.ts b/site/src/lib/port-families.ts index 7ebee4884..e547bbbb9 100644 --- a/site/src/lib/port-families.ts +++ b/site/src/lib/port-families.ts @@ -12,7 +12,7 @@ export interface PortFamily { export const PORT_FAMILIES: readonly PortFamily[] = [ { label: 'Scripting & web', ports: ['py', 'ruby', 'lua', 'julia', 'ts'] }, { label: 'Compiled & native', ports: ['rs', 'go', 'cxx', 'swift'] }, - { label: 'JVM', ports: ['java', 'kotlin', 'scala'] }, + { label: 'JVM', ports: ['java', 'kotlin', 'scala', 'clojure'] }, { label: '.NET', ports: ['csharp', 'fsharp', 'powershell'] }, { label: 'BEAM', ports: ['elixir'] }, ] diff --git a/site/src/lib/port-inventory.ts b/site/src/lib/port-inventory.ts index 261c0664b..3c3a3b082 100644 --- a/site/src/lib/port-inventory.ts +++ b/site/src/lib/port-inventory.ts @@ -278,6 +278,13 @@ export function entryDestinations(entry: InventoryEntry): Destination[] { ] } +/** A released package, or an unpublished package available from public source. */ +export function documentedLibrary(entries: readonly InventoryEntry[]): InventoryEntry | undefined { + return entries.find((entry) => entry.kind === 'library' && (entry.status === 'published' || + entry.status === 'configured-unpublished' && !entry.package && !entry.api && + entries.some((source) => source.kind === 'source' && source.status === 'published' && source.repo === entry.repo))) +} + const GO = 'github.com/libtmux/libtmux-go' /** @@ -433,6 +440,21 @@ export const INVENTORY: Readonly> = { unavailable: [{ kind: 'api', host: 'javadoc-io', url: 'https://javadoc.io/doc/io.github.libtmux/libtmux-workspace-cli', reason: 'javadoc.io lists versions and has no documentation for this artifact' }] }), ], + clojure: [ + jvm({ id: 'libtmux-clojure', kind: 'library', product: 'core', label: 'libtmux-clojure', + coordinate: 'io.github.libtmux:libtmux-clojure', path: 'libtmux-clojure', ref: 'master', + status: 'configured-unpublished', note: 'No registry release; install the source checkout with Gradle.', + aliases: ['libtmux.core', 'libtmux.data', 'libtmux.async', 'libtmux.control'] }), + jvm({ id: 'libtmux-clojure-core-async', kind: 'companion', product: 'core', label: 'libtmux-clojure-core-async', + coordinate: 'io.github.libtmux:libtmux-clojure-core-async', path: 'libtmux-clojure-core-async', ref: 'master', + status: 'configured-unpublished', note: 'No registry release; install this optional adapter from the source checkout.', + aliases: ['libtmux.core-async'] }), + jvm({ id: 'repository', kind: 'source', product: 'core', label: 'libtmux-java', coordinate: 'libtmux/libtmux-java' }), + jvm({ id: 'core-source', kind: 'source', product: 'core', label: 'libtmux-clojure', path: 'libtmux-clojure', ref: 'master', + aliases: ['libtmux.core', 'libtmux.data', 'libtmux.async', 'libtmux.control'] }), + jvm({ id: 'adapter-source', kind: 'source', product: 'core', label: 'libtmux-clojure-core-async', + path: 'libtmux-clojure-core-async', ref: 'master', aliases: ['libtmux.core-async'] }), + ], kotlin: [ jvm({ id: 'libtmux-kotlin', kind: 'library', product: 'core', label: 'libtmux-kotlin', ...central('libtmux-kotlin'), ...javadoc('libtmux-kotlin', 'Dokka'), path: 'libtmux-kotlin', aliases: ['io.github.libtmux.kotlin'] }), diff --git a/site/src/lib/ports.ts b/site/src/lib/ports.ts index 2bdc4156d..6bf53a5f4 100644 --- a/site/src/lib/ports.ts +++ b/site/src/lib/ports.ts @@ -286,6 +286,8 @@ export interface Port { referenceKind?: 'model' | 'guide' /** Generated Markdown reference with type pages and named member anchors. */ sourceReferenceDirectory?: string + /** Native single-file references, grouped by their owning package. */ + sourceReferenceFiles?: readonly { file: string; package: string }[] renderer: Renderer /** * Whether this port's own documentation pipeline publishes @@ -1260,9 +1262,34 @@ target_link_libraries(your_target PRIVATE libtmux::libtmux)`, type WrapperLibrary = Omit & { parentLibrary: { slug: string; runtime: string } + worktree?: string } const WRAPPER_LIBRARIES: readonly WrapperLibrary[] = [ + { + slug: 'clojure', logoLanguage: 'clojure', shortName: 'Clj', name: 'Clojure', language: 'Clojure', + projectName: 'libtmux-clojure', + parentLibrary: { slug: 'java', runtime: 'JVM' }, + source: { path: 'libtmux-clojure', ref: 'master' }, + sourceReferenceFiles: [ + { file: 'docs/guide/clojure-api.md', package: 'io.github.libtmux:libtmux-clojure' }, + { file: 'docs/guide/clojure-core-async-api.md', package: 'io.github.libtmux:libtmux-clojure-core-async' }, + ], + worktree: '~/work/libtmux/libtmux-java-clojure', + packageName: 'io.github.libtmux:libtmux-clojure', + packages: [{ id: 'async', name: 'libtmux-clojure-core-async', + coordinate: 'io.github.libtmux:libtmux-clojure-core-async', + source: { path: 'libtmux-clojure-core-async', ref: 'master' }, require: 'libtmux.core-async' }], + installs: [{ label: 'Tools.deps', lang: 'clojure', filename: 'deps.edn', + code: '{:deps {io.github.libtmux/libtmux-clojure {:mvn/version "{version}"}}}', + note: 'Build and install the source checkout first; this module has no published registry release.' }], + initProject: { code: 'mkdir clojure-tmux && cd clojure-tmux', lang: 'console' }, + installForms: { + release: { code: '{:deps {io.github.libtmux/libtmux-clojure {:mvn/version "{version}"}}}', lang: 'clojure' }, + prerelease: { code: '{:deps {io.github.libtmux/libtmux-clojure {:mvn/version "{version}"}}}', lang: 'clojure' }, + git: { code: 'git clone --branch master https://github.com/libtmux/libtmux-java && (cd libtmux-java && ./gradlew :libtmux:publishToMavenLocal :libtmux-clojure:publishToMavenLocal)', lang: 'console' }, + }, + }, { slug: 'kotlin', logoLanguage: 'kotlin', shortName: 'Kt', name: 'Kotlin', language: 'Kotlin', projectName: 'libtmux-kotlin', diff --git a/site/src/lib/prose-resolver.ts b/site/src/lib/prose-resolver.ts index cdaa33e19..4602cbd64 100644 --- a/site/src/lib/prose-resolver.ts +++ b/site/src/lib/prose-resolver.ts @@ -137,7 +137,7 @@ const INVENTORIES: { data: jdkInv, project: 'Java SE', baseUrl: 'https://docs.oracle.com/en/java/javase/21/docs/api/', - langs: ['java', 'kotlin', 'scala'], + langs: ['java', 'kotlin', 'scala', 'clojure'], }, { data: domInv, project: 'MDN', baseUrl: 'https://developer.mozilla.org/', langs: ['ts'] }, { data: juliaInv, project: 'Julia', baseUrl: 'https://docs.julialang.org/en/v1/', langs: ['julia'] }, diff --git a/site/src/lib/symbol-form.ts b/site/src/lib/symbol-form.ts index b8264415a..1d061e853 100644 --- a/site/src/lib/symbol-form.ts +++ b/site/src/lib/symbol-form.ts @@ -53,6 +53,7 @@ export const FORMS: Record = { ruby: { qualifier: '::', call: false }, lua: { qualifier: '.', call: true }, elixir: 'as-written', + clojure: 'as-written', powershell: 'as-written', } diff --git a/site/src/lib/tmux-library-usage.ts b/site/src/lib/tmux-library-usage.ts index 66402f8be..f1953bedf 100644 --- a/site/src/lib/tmux-library-usage.ts +++ b/site/src/lib/tmux-library-usage.ts @@ -11,6 +11,7 @@ import { API_MODELS, PORT_NAME, referenceHref } from './api-models' import { PORTS } from './ports' import scopeTable from '../data/tmux-usage/scopes.json' import csharp from '../data/tmux-usage/csharp.json' +import clojure from '../data/tmux-usage/clojure.json' import cxx from '../data/tmux-usage/cxx.json' import elixir from '../data/tmux-usage/elixir.json' import fsharp from '../data/tmux-usage/fsharp.json' @@ -67,7 +68,7 @@ export interface TmuxScope { } export const TMUX_USAGE: Record = { - csharp, cxx, elixir, fsharp, go, java, julia, kotlin, lua, powershell, py, rs, ruby, scala, swift, ts, + csharp, clojure, cxx, elixir, fsharp, go, java, julia, kotlin, lua, powershell, py, rs, ruby, scala, swift, ts, } as unknown as Record const SCOPES = scopeTable.commands as Record @@ -117,7 +118,7 @@ export function namesCommand(command: string, member: string): boolean { } /** The member a symbol id ends with, without the owners before it or the argument labels after it: `Server.capture(_:includingHistory:)` gives `capture`. */ -const memberName = (id: string): string => id.replace(/\(.*$/s, '').split(/[.#:\\]+/).at(-1) ?? id +const memberName = (id: string): string => id.replace(/\(.*$/s, '').split(/[.#:\\/]+/).at(-1) ?? id /** * Whether a use belongs on the command's own pages, and not only on the method's. diff --git a/site/src/plugins/rehype-api-links.ts b/site/src/plugins/rehype-api-links.ts index 26331c410..f06b03b99 100644 --- a/site/src/plugins/rehype-api-links.ts +++ b/site/src/plugins/rehype-api-links.ts @@ -225,15 +225,16 @@ function addKindBadge(anchor: El, port?: string, route?: string, first: First = export function rehypeApiLinks() { return (tree: unknown, file?: { path?: string; data?: { astro?: { frontmatter?: { port?: string; product?: ApiProduct; route?: string; symbols?: boolean; sidebar?: { group?: string } } } } }) => { const frontmatter = file?.data?.astro?.frontmatter - const buildPort = frontmatter?.port ?? (process.env.LIBTMUX_DOCS_PORT || undefined) + const selectedPort = process.env.LIBTMUX_DOCS_PORT || undefined // A page shared by every port is rendered once for each: the port of the build is where it is read, not what it is about. const ownPort = frontmatter?.port ?? file?.path?.replaceAll('\\', '/').match(/\/content\/docs\/(?:ja\/)?ports\/([^/]+)\//)?.[1] + const buildPort = ownPort ?? (selectedPort && !PORT_BY_SLUG[selectedPort]?.parentLibrary ? selectedPort : undefined) const source = file?.path?.replaceAll('\\', '/').match(/\/content\/(docs|_workspace-shared)\/(.+)\.mdx?$/) const id = source ? `${source[1] === '_workspace-shared' ? `ports/${buildPort}/` : ''}${source[2]}`.replace(/(?:^|\/)index$/, '') : undefined const route = frontmatter?.route ?? (id !== undefined ? docsPath({ id, data: { ...frontmatter, port: buildPort } }) : undefined) // Native tmux prose and wrapper references own their names; a library's // similarly named symbol is not evidence for a link from those pages. - const nativeTmux = isTmuxProse({ id: id ?? '', data: { ...frontmatter, port: buildPort } }) + const nativeTmux = isTmuxProse({ id: id ?? '', data: { ...frontmatter, port: ownPort } }, buildPort) // `symbols: false` is for generated text whose names are arguments, not library symbols. const resolveMentions = !nativeTmux && frontmatter?.symbols !== false && (!buildPort || PORT_BY_SLUG[buildPort]?.referenceKind !== 'guide') begin() @@ -394,6 +395,7 @@ const LANG_TO_PORT: Record = { python: 'py', py: 'py', typescript: 'ts', ts: 'ts', javascript: 'ts', js: 'ts', rust: 'rs', rs: 'rs', go: 'go', java: 'java', csharp: 'csharp', cs: 'csharp', cpp: 'cxx', 'c++': 'cxx', swift: 'swift', + clojure: 'clojure', clj: 'clojure', powershell: 'powershell', pwsh: 'powershell', ps1: 'powershell', julia: 'julia', elixir: 'elixir', ex: 'elixir', exs: 'elixir', } diff --git a/site/src/plugins/remark-port-code.mjs b/site/src/plugins/remark-port-code.mjs index 6c2925dae..7fc57fa95 100644 --- a/site/src/plugins/remark-port-code.mjs +++ b/site/src/plugins/remark-port-code.mjs @@ -36,6 +36,7 @@ export const LANG_TO_PORT = { golang: 'go', java: 'java', kotlin: 'kotlin', + clojure: 'clojure', scala: 'scala', fsharp: 'fsharp', fs: 'fsharp', diff --git a/site/src/styles/api.css b/site/src/styles/api.css index 7c6473dd9..61ee45d63 100644 --- a/site/src/styles/api.css +++ b/site/src/styles/api.css @@ -413,6 +413,7 @@ dl.gp-sphinx-api-container > dt.gp-sphinx-api-header:only-child { min-width: 0; overflow-wrap: anywhere; } +.api-definition dd code { font-size: inherit; } .api-command-facts { row-gap: 0.55rem; margin-bottom: 1rem; } .api-command-facts dt { font-weight: 600; opacity: 1; } .api-command-related { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin-block: .75rem; } diff --git a/site/src/styles/brand.css b/site/src/styles/brand.css index cfdcb30bd..139bc527f 100644 --- a/site/src/styles/brand.css +++ b/site/src/styles/brand.css @@ -1999,3 +1999,128 @@ html[data-brand="elixir"][data-theme-mode="dark"], html[data-brand="elixir"][dat --lt-color-code-bg: #1c2229; } } +html[data-brand="clojure"] { + color-scheme: light; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #632826; + --theme-secondary: #53606d; + --theme-accent: #632826; + --theme-background: #fafbfc; + --theme-text: #202830; + --background-color: #fafbfc; + --text-color: #202830; + --topnav-background: #fafbfc; + --topnav-text-color: #202830; + --topnav-link-color: #53606d; + --topnav-link-hover-color: #202830; + --color-background-primary: #fafbfc; + --color-background-secondary: #f3f5f7; + --color-background-border: #d6dce3; + --color-api-background-hover: #e9edf1; + --color-foreground-primary: #202830; + --color-foreground-secondary: #53606d; + --color-foreground-muted: #53606d; + --color-link: #632826; + --color-brand-primary: #632826; + --color-brand-content: #632826; + --color-inline-code-background: #f3f5f7; + --lt-color-bg: #fafbfc; + --lt-color-bg-secondary: #f3f5f7; + --lt-color-bg-hover: #e9edf1; + --lt-color-fg: #202830; + --lt-color-fg-secondary: #53606d; + --lt-color-fg-muted: #53606d; + --lt-color-border: #d6dce3; + --lt-color-accent: #632826; + --lt-color-link: #632826; + --lt-color-link-visited: #632826; + --lt-color-code-bg: #f3f5f7; +} +html[data-brand="clojure"][data-theme-mode="dark"], html[data-brand="clojure"][data-theme="dark"] { + color-scheme: dark; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #f4cdcc; + --theme-secondary: #b7c1cd; + --theme-accent: #f4cdcc; + --theme-background: #15191d; + --theme-text: #e7edf3; + --background-color: #15191d; + --text-color: #e7edf3; + --topnav-background: #15191d; + --topnav-text-color: #e7edf3; + --topnav-link-color: #b7c1cd; + --topnav-link-hover-color: #e7edf3; + --color-background-primary: #15191d; + --color-background-secondary: #1c2229; + --color-background-border: #3e4a57; + --color-api-background-hover: #29323d; + --color-foreground-primary: #e7edf3; + --color-foreground-secondary: #b7c1cd; + --color-foreground-muted: #b7c1cd; + --color-link: #f4cdcc; + --color-brand-primary: #f4cdcc; + --color-brand-content: #f4cdcc; + --color-inline-code-background: #1c2229; + --lt-color-bg: #15191d; + --lt-color-bg-secondary: #1c2229; + --lt-color-bg-hover: #29323d; + --lt-color-fg: #e7edf3; + --lt-color-fg-secondary: #b7c1cd; + --lt-color-fg-muted: #b7c1cd; + --lt-color-border: #3e4a57; + --lt-color-accent: #f4cdcc; + --lt-color-link: #f4cdcc; + --lt-color-link-visited: #f4cdcc; + --lt-color-code-bg: #1c2229; +} +@media (prefers-color-scheme: dark) { + html[data-brand="clojure"]:not([data-theme-mode]):not([data-theme="light"]) { + color-scheme: dark; + --brand-color: #DB5855; + --brand-solid: #632826; + --brand-on-solid: #ffffff; + --button-bg-primary: #632826; + --button-text-primary: #ffffff; + --theme-primary: #f4cdcc; + --theme-secondary: #b7c1cd; + --theme-accent: #f4cdcc; + --theme-background: #15191d; + --theme-text: #e7edf3; + --background-color: #15191d; + --text-color: #e7edf3; + --topnav-background: #15191d; + --topnav-text-color: #e7edf3; + --topnav-link-color: #b7c1cd; + --topnav-link-hover-color: #e7edf3; + --color-background-primary: #15191d; + --color-background-secondary: #1c2229; + --color-background-border: #3e4a57; + --color-api-background-hover: #29323d; + --color-foreground-primary: #e7edf3; + --color-foreground-secondary: #b7c1cd; + --color-foreground-muted: #b7c1cd; + --color-link: #f4cdcc; + --color-brand-primary: #f4cdcc; + --color-brand-content: #f4cdcc; + --color-inline-code-background: #1c2229; + --lt-color-bg: #15191d; + --lt-color-bg-secondary: #1c2229; + --lt-color-bg-hover: #29323d; + --lt-color-fg: #e7edf3; + --lt-color-fg-secondary: #b7c1cd; + --lt-color-fg-muted: #b7c1cd; + --lt-color-border: #3e4a57; + --lt-color-accent: #f4cdcc; + --lt-color-link: #f4cdcc; + --lt-color-link-visited: #f4cdcc; + --lt-color-code-bg: #1c2229; + } +} diff --git a/site/test/api-doc-mentions.test.ts b/site/test/api-doc-mentions.test.ts index cae5425be..65fee03b2 100644 --- a/site/test/api-doc-mentions.test.ts +++ b/site/test/api-doc-mentions.test.ts @@ -59,6 +59,18 @@ function problems(root: Pick): string[] { } describe('a doc comment cross-reference', () => { + it('keeps Clojure keyword values out of Java dependency links', async () => { + const model = API_MODELS.clojure + const clojure = indexFor(model, (symbol) => `/en/clojure/latest/reference/${symbol.slug}/`) + const root = await render('Use `:timeout`, `::timeout`, `:request/timeout` or `{:timeout 100}`. See [[libtmux.core/open!]] and `CompletionStage`.', undefined, clojure) + expect([...root.querySelectorAll('code.api-literal')].slice(0, 4).map((code) => [code.textContent, code.querySelectorAll('a').length])) + .toEqual([[':timeout', 0], ['::timeout', 0], [':request/timeout', 0], ['{:timeout 100}', 0]]) + expect([...root.querySelectorAll('a')].map((link) => link.getAttribute('href'))).toEqual([ + '/en/clojure/latest/reference/libtmux-core-open/', + 'https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/CompletionStage.html', + ]) + }) + it('names its kind in the title, the data attribute and the accessible name, and draws no badge', async () => { const root = await render('`Pane` sits in a `Window`. Send keys to a `Pane` again.') const links = [...root.querySelectorAll('a.api-xref')] diff --git a/site/test/api-glossary.test.ts b/site/test/api-glossary.test.ts index 24d06ec41..769eb406f 100644 --- a/site/test/api-glossary.test.ts +++ b/site/test/api-glossary.test.ts @@ -18,6 +18,7 @@ const modelSource = ts.createSourceFile(modelPath.pathname, readFileSync(modelPa const astroRequire = createRequire(realpathSync(new URL('../node_modules/astro/package.json', import.meta.url))) const windows: Window[] = [] const nativeAuthorities: Record = { + clojure: /^https:\/\/clojure\.org\//, scala: /^https:\/\/docs\.scala-lang\.org\//, java: /^https:\/\/docs\.oracle\.com\//, kotlin: /^https:\/\/kotlinlang\.org\//, julia: /^https:\/\/docs\.julialang\.org\//, py: /^https:\/\/(?:docs\.python\.org|peps\.python\.org|packaging\.python\.org)\//, diff --git a/site/test/api-qualified-name.test.ts b/site/test/api-qualified-name.test.ts index 59c8dbf4a..834890086 100644 --- a/site/test/api-qualified-name.test.ts +++ b/site/test/api-qualified-name.test.ts @@ -133,6 +133,8 @@ describe('a qualified name as a path to one declaration', () => { ['Lua method', 'libtmux.Buffer:reference', 'libtmux.Buffer:', 'reference'], ['PowerShell cmdlet', 'LibTmux.Workspace\\ConvertTo-TmuxWorkspace', 'LibTmux.Workspace\\', 'ConvertTo-TmuxWorkspace'], ['Elixir function', 'LibTmux.Capture.fetch/2', 'LibTmux.Capture.', 'fetch/2'], + ['Clojure var', 'libtmux.data/matching', 'libtmux.data/', 'matching'], + ['Clojure effect', 'libtmux.core/open!', 'libtmux.core/', 'open!'], // A Swift name ends in its argument labels, which are part of the name: their colons are not a separator. ['Swift method', 'Window.filterFieldType(_:)', 'Window.', 'filterFieldType(_:)'], ['Swift operator', 'Client.!=(_:_:)', 'Client.', '!=(_:_:)'], diff --git a/site/test/api-search.test.ts b/site/test/api-search.test.ts index 84e1ce522..0a1dfeaf9 100644 --- a/site/test/api-search.test.ts +++ b/site/test/api-search.test.ts @@ -64,8 +64,9 @@ describe('reference symbol search', () => { } expect(searchApi(inventory, '', 'types').every((entry) => entry.category === 'types')).toBe(true) expect(searchApi(inventory, '', 'members').every((entry) => entry.category === 'members')).toBe(true) - const server = searchApi(inventory, 'Server')[0] - expect(server.category, `${port}: Server type precedes properties with the same name`).toBe('types') - expect(symbols.get(server.id)?.name).toBe('Server') + const owner = port === 'clojure' ? 'libtmux.core' : 'Server' + const server = searchApi(inventory, owner)[0] + expect(server.category, `${port}: primary owner precedes its members`).toBe('types') + expect(symbols.get(server.id)?.name).toBe(owner) }) }) diff --git a/site/test/api-tree.test.ts b/site/test/api-tree.test.ts index b3c5b79df..4ebfef48f 100644 --- a/site/test/api-tree.test.ts +++ b/site/test/api-tree.test.ts @@ -89,7 +89,7 @@ describe('shared reference index sections', () => { expect(sections[0].id).toBe('server') if (port === 'powershell') expect(sections[0].free.map((symbol) => symbol.name)) .toEqual(expect.arrayContaining(['Connect-TmuxServer', 'Get-TmuxServer', 'New-TmuxServer'])) - else expect(sections[0].types[0].name).toBe('Server') + else expect(sections[0].types[0].name).toBe(port === 'clojure' ? 'libtmux.core' : 'Server') const ids = sections.flatMap((section) => [...section.types, ...section.free]).map((symbol) => symbol.id) expect(new Set(ids).size).toBe(ids.length) const available = new Set(sections.map((section) => section.id)) @@ -245,10 +245,12 @@ describe('major tmux object domains', () => { const model = API_MODELS[port]! const branches = membersByType(port) const compare = compareMembers(memberSignals(port, mentions.mentions)) - const owners = model.symbols.filter((symbol) => port === 'powershell' + const owners = model.symbols.filter((symbol) => ['powershell', 'clojure'].includes(port) ? symbol.kind === 'module' : OWNER_KINDS.has(symbol.kind) && ['Server', 'Session', 'Window', 'Pane', 'Client', 'Snapshot'].includes(symbol.name)) if (port === 'powershell') expect(owners.map((owner) => owner.name).sort()).toEqual(['LibTmux', 'LibTmux.Workspace']) + else if (port === 'clojure') expect(owners.map((owner) => owner.name).sort()) + .toEqual(['libtmux.async', 'libtmux.control', 'libtmux.core', 'libtmux.core-async', 'libtmux.data']) else expect(owners.some((owner) => owner.name === 'Server'), port).toBe(true) for (const owner of owners) { const displayed = membersOf(model, owner, memberSignals(port, mentions.mentions)).sort(compare) diff --git a/site/test/branding.test.ts b/site/test/branding.test.ts index 483dec058..f46e962e9 100644 --- a/site/test/branding.test.ts +++ b/site/test/branding.test.ts @@ -21,6 +21,7 @@ describe('route branding', () => { it('titles each port home page by repository and language', () => { expect(Object.fromEntries(PORTS.map((port) => [port.slug, portHomeTitle(port)]))).toEqual({ py: 'libtmux: Python-based tmux client', ruby: 'libtmux-ruby: Ruby-based tmux client', + clojure: 'libtmux-clojure: Clojure-based tmux client', lua: 'libtmux-lua: Lua-based tmux client', ts: 'libtmux-ts: TypeScript-based tmux client', powershell: 'libtmux-powershell: PowerShell-based tmux client', julia: 'libtmux-julia: Julia-based tmux client', elixir: 'libtmux-elixir: Elixir-based tmux client', rs: 'libtmux-rs: Rust-based tmux client', @@ -45,7 +46,7 @@ describe('route branding', () => { powershell: 'libtmux-powershell', julia: 'LibTmux.jl', elixir: 'libtmux-elixir', rs: 'libtmux-rs', go: 'libtmux-go', java: 'libtmux-java', kotlin: 'libtmux-kotlin', scala: 'libtmux-scala', csharp: 'libtmux-dotnet', fsharp: 'libtmux-fsharp', - cxx: 'libtmux-cxx', swift: 'libtmux-swift', + cxx: 'libtmux-cxx', swift: 'libtmux-swift', clojure: 'libtmux-clojure', } expect(Object.fromEntries(PORTS.map((port) => [port.slug, branding(port.slug).projectName]))).toEqual(names) expect(branding('java', 'reference/libtmux-scala-cats').projectName).toBe('libtmux-scala') diff --git a/site/test/clojure.test.ts b/site/test/clojure.test.ts new file mode 100644 index 000000000..991b072b9 --- /dev/null +++ b/site/test/clojure.test.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from 'vitest' +import { PORT_BY_SLUG } from '../src/lib/ports' +import { API_MODELS, API_NAV, ownersOf } from '../src/lib/api-models' +import { sourceGuidesFor } from '../src/lib/port-documentation' +import { INVENTORY } from '../src/lib/port-inventory' + +describe('Clojure JVM facade', () => { + it('registers its public source without inventing registry availability', () => { + const port = PORT_BY_SLUG.clojure + expect(port).toBeDefined() + if (!port) return + expect(port.language).toBe('Clojure') + expect(port.parentLibrary).toEqual({ slug: 'java', runtime: 'JVM' }) + expect(port.docsDispatch).toEqual({ ...PORT_BY_SLUG.java.docsDispatch, language: 'clojure' }) + expect(port.source).toEqual({ path: 'libtmux-clojure', ref: 'master' }) + expect(port.packageName).toBe('io.github.libtmux:libtmux-clojure') + expect(port.registry).toBeUndefined() + expect(port.ecosystemHost).toBeUndefined() + }) + + it('delivers public namespaces, navigation, guides and honest package inventory', () => { + const model = API_MODELS.clojure + expect(model).toBeDefined() + expect(ownersOf(model!)).toHaveLength(5) + expect(API_NAV.clojure?.unplaced).toEqual([]) + expect(sourceGuidesFor('clojure').map((guide) => guide.sourcePath)).toContain('docs/guide/clojure.md') + const packages = INVENTORY.clojure?.filter((entry) => entry.kind === 'library' || entry.kind === 'companion') + expect(packages?.map((entry) => [entry.coordinate, entry.status])).toEqual([ + ['io.github.libtmux:libtmux-clojure', 'configured-unpublished'], + ['io.github.libtmux:libtmux-clojure-core-async', 'configured-unpublished'], + ]) + expect(packages?.every((entry) => !entry.package && !entry.api)).toBe(true) + const examples = model!.symbols.find((symbol) => symbol.id === 'libtmux.core/open!')?.doc?.examples + expect(examples?.some((example) => example.code.includes('connected=true'))).toBe(true) + expect(examples?.some((example) => example.code.includes(':mvn/local-repo "m2"'))).toBe(true) + }) +}) diff --git a/site/test/concept-coverage.test.ts b/site/test/concept-coverage.test.ts index 892b04011..9c63e6277 100644 --- a/site/test/concept-coverage.test.ts +++ b/site/test/concept-coverage.test.ts @@ -27,7 +27,7 @@ function coverage(concept: string) { describe('the ports that have a page for an operation', () => { it('lists every port for a server snapshot except those with no whole-server snapshot', () => { const { pages, reasons } = coverage('snapshot') - expect(pages.toSorted()).toEqual(['csharp', 'elixir', 'fsharp', 'go', 'java', 'julia', 'kotlin', 'lua', 'powershell', 'rs', 'ruby', 'scala', 'swift', 'ts']) + expect(pages.toSorted()).toEqual(['clojure', 'csharp', 'elixir', 'fsharp', 'go', 'java', 'julia', 'kotlin', 'lua', 'powershell', 'rs', 'ruby', 'scala', 'swift', 'ts']) // Python's core and C++ have no snapshot of a whole server, and each says so. expect(reasons.toSorted()).toEqual(['cxx', 'py']) for (const port of ['py', 'cxx']) expect(CONCEPTS.snapshot!.absent![port], port).toMatch(/^no equivalent on `Server`/) diff --git a/site/test/dangling-report.test.ts b/site/test/dangling-report.test.ts index 8a8166fb1..39947f735 100644 --- a/site/test/dangling-report.test.ts +++ b/site/test/dangling-report.test.ts @@ -61,6 +61,45 @@ describe('the build\'s dangling report', () => { expect(state(build)).toEqual(before) }) + it('resolves Clojure dependencies and leaves fixture settings literal without concealing a missing var', async () => { + const own = join(directory, 'clojure.jsonl') + vi.stubEnv('LIBTMUX_DOCS_DANGLING_REPORT', own) + vi.stubEnv('LIBTMUX_DOCS_PORT', 'clojure') + const text = 'The fixture supplies `libtmux.docs.socket` and `libtmux.docs.binary`. Failures throw `ExceptionInfo`. Add `io.github.libtmux/libtmux-clojure-core-async` for `core.async`; use `libtmux.core/snapshot!`.' + const rendered = await (await processor).render(text, { frontmatter: { port: 'clojure' } }) + expect(names(own)).toEqual([]) + expect(rendered.code).toContain('https://github.com/clojure/clojure/blob/clojure-1.12.6/src/jvm/clojure/lang/ExceptionInfo.java') + expect(rendered.code).toContain('https://github.com/clojure/core.async') + expect(rendered.code).toContain('/clojure/latest/reference/libtmux-core-snapshot/') + await (await processor).render('Use `libtmux.core/missing!`, `io.github.libtmux/missing-package` and `libtmux.docs.unknown`.', { frontmatter: { port: 'clojure' } }) + expect(names(own)).toEqual(['libtmux.core/missing!', 'io.github.libtmux/missing-package', 'libtmux.docs.unknown']) + }) + + it('keeps shared tmux prose out of a selected Clojure build report', async () => { + const own = join(directory, 'clojure-native.jsonl') + vi.stubEnv('LIBTMUX_DOCS_DANGLING_REPORT', own) + vi.stubEnv('LIBTMUX_DOCS_PORT', 'clojure') + const rendered = await (await processor).render('Write `tmux.conf`; capture `=work:editor`.', { + fileURL: new URL('../src/content/docs/topics/interaction.md', import.meta.url), frontmatter: {}, + }) + expect(names(own)).toEqual([]) + expect(rendered.code).not.toContain('api-mention') + await (await processor).render('Use `libtmux.core/missing!`.', { frontmatter: { port: 'clojure' } }) + expect(names(own)).toEqual(['libtmux.core/missing!']) + }) + + it('requires a language claim before assigning shared site prose to a facade', async () => { + const own = join(directory, 'clojure-shared.jsonl') + vi.stubEnv('LIBTMUX_DOCS_DANGLING_REPORT', own) + vi.stubEnv('LIBTMUX_DOCS_PORT', 'clojure') + await (await processor).render('Read `llms.txt` and `sphinx.ext.intersphinx`.', { + fileURL: new URL('../src/content/docs/meta/exports.md', import.meta.url), frontmatter: {}, + }) + expect(names(own)).toEqual([]) + await (await processor).render('```clojure\n(require libtmux.core)\n```\n\nUse `libtmux.core/missing!`.', { frontmatter: {} }) + expect(names(own)).toEqual(['libtmux.core/missing!']) + }) + it('is caught when a render adds to the file the check watches, so the check above can fail', async () => { const watched = join(directory, 'watched.jsonl') vi.stubEnv('LIBTMUX_DOCS_DANGLING_REPORT', watched) diff --git a/site/test/destination-evidence.test.ts b/site/test/destination-evidence.test.ts index de64e2eef..2255b646e 100644 --- a/site/test/destination-evidence.test.ts +++ b/site/test/destination-evidence.test.ts @@ -182,6 +182,7 @@ describe('destination evidence', () => { describe('age', () => { const checked = new Date(`${evidence.checkedAt}T12:00:00Z`) + const sameDay = withEvidence(evidence.destinations.map((record) => ({ ...record, checkedAt: evidence.checkedAt }))) const later = (days: number) => new Date(checked.getTime() + days * DAY) it('is measured, never judged, by the agreement check, so a change that touches none of this cannot fail for the passage of time', () => { @@ -192,8 +193,8 @@ describe('destination evidence', () => { }) it('reports a record as stale only after the bound, oldest first, with its date', () => { - expect(staleRecords(evidence, { today: later(EVIDENCE_MAX_AGE_DAYS) })).toEqual([]) - const stale = staleRecords(evidence, { today: later(EVIDENCE_MAX_AGE_DAYS + 2) }) + expect(staleRecords(sameDay, { today: later(EVIDENCE_MAX_AGE_DAYS) })).toEqual([]) + const stale = staleRecords(sameDay, { today: later(EVIDENCE_MAX_AGE_DAYS + 2) }) expect(stale).toHaveLength(evidence.destinations.length) expect(stale[0]).toMatchObject({ checkedAt: evidence.checkedAt, days: EVIDENCE_MAX_AGE_DAYS + 2 }) const old = new Date(checked.getTime() - (EVIDENCE_MAX_AGE_DAYS + 5) * DAY).toISOString().slice(0, 10) @@ -203,7 +204,7 @@ describe('destination evidence', () => { }) it('words a warning with the date and the command that clears it', () => { - const stale = staleRecords(evidence, { today: later(EVIDENCE_MAX_AGE_DAYS + 2) }) + const stale = staleRecords(sameDay, { today: later(EVIDENCE_MAX_AGE_DAYS + 2) }) expect(staleWarnings(stale)).toEqual([`${evidence.destinations.length} destination records were last checked ${evidence.checkedAt}, more than ${EVIDENCE_MAX_AGE_DAYS} days ago: run node scripts/verify-destinations.mjs`]) expect(staleWarnings(stale.slice(0, 1))[0]).toMatch(/^1 destination record was last checked/) }) @@ -244,12 +245,12 @@ describe('destination evidence', () => { }) it('names every record dated beyond a day ahead of today, and fails the agreement check on it', () => { - expect(futureRecords(evidence, { today: new Date(checked.getTime() - DAY) })).toEqual([]) - const early = futureRecords(evidence, { today: new Date(checked.getTime() - 3 * DAY) }) + expect(futureRecords(sameDay, { today: new Date(checked.getTime() - DAY) })).toEqual([]) + const early = futureRecords(sameDay, { today: new Date(checked.getTime() - 3 * DAY) }) expect(early).toHaveLength(evidence.destinations.length) expect(early[0]).toMatchObject({ checkedAt: evidence.checkedAt }) - expect(checkEvidence(INVENTORY, evidence, { manifests, today: checked })).toEqual([]) - expect(checkEvidence(INVENTORY, evidence, { manifests, today: new Date(checked.getTime() - 3 * DAY) })) + expect(checkEvidence(INVENTORY, sameDay, { manifests, today: checked })).toEqual([]) + expect(checkEvidence(INVENTORY, sameDay, { manifests, today: new Date(checked.getTime() - 3 * DAY) })) .toContain(`${evidence.destinations[0]!.url} was checked ${evidence.checkedAt}, which is in the future`) }) diff --git a/site/test/docs-paths.test.ts b/site/test/docs-paths.test.ts index 34bbd0b04..2b893533b 100644 --- a/site/test/docs-paths.test.ts +++ b/site/test/docs-paths.test.ts @@ -75,9 +75,11 @@ describe('product document URLs', () => { expect(docsRoutePath({ id: 'meta/third-party-notices', data: {} })).toBe('meta/third-party-notices') }) - it('retires duplicate Julia and F# API overviews in root and selected-version builds', () => { + it('retires duplicate native API overviews in root and selected-version builds', () => { expect(sourceGuideRedirects(undefined, { fsharp: 'v0.46.2' })).toEqual([ { path: 'julia/latest/guides/api-overview', target: 'julia/latest/reference' }, + { path: 'clojure/latest/guides/native-api', target: 'clojure/latest/reference' }, + { path: 'clojure/latest/guides/adapter-api', target: 'clojure/latest/reference/libtmux-core-async' }, { path: 'fsharp/v0.46.2/guides/api-overview', target: 'fsharp/v0.46.2/reference' }, ]) expect(sourceGuideRedirects('julia')).toEqual([ diff --git a/site/test/exports.test.ts b/site/test/exports.test.ts index c568ae533..80dfd5659 100644 --- a/site/test/exports.test.ts +++ b/site/test/exports.test.ts @@ -3,6 +3,7 @@ import { join } from 'node:path' import { describe, expect, it } from 'vitest' import { Window } from 'happy-dom' import { API_MODEL_PORTS, PORTS } from '../src/lib/ports' +import { referenceIndexSections } from '../src/lib/api-tree' import { SITE_BUILT, SITE_PREFIX, PREVIEW_PREFIX, productionPath, publishedHas, publishedPath, sitePath } from './site-root' /** @@ -127,6 +128,9 @@ describeIfAssembled('published exports', () => { expect(reference).toBeDefined() expect(reference.title).toBe('API reference') const root = new URL(reference.url).pathname.replace(/^\//, '') + const sections = referenceIndexSections(port.slug) + expect(sections.length, `${port.slug} model reference sections`).toBeGreaterThan(0) + const declarations = sections.flatMap((section) => [...section.types, ...section.free]) const window = new Window() try { // Keep scripts and preload links inert while inspecting the rendered anchors. @@ -134,10 +138,9 @@ describeIfAssembled('published exports', () => { template.innerHTML = readPublished(join(root, 'index.html')) const actual = [...template.content.querySelectorAll('.api-index-summary[id]')].map((node) => node.id) expect(reference.headings.map((heading: { id: string }) => heading.id)).toEqual(actual) - expect(actual[0]).toBe('section-server') - if (port.slug === 'powershell') expect(reference.symbols.slice(0, 3).map((symbol: { name: string }) => symbol.name)) - .toEqual(['New-TmuxServer', 'Get-TmuxServer', 'Connect-TmuxServer']) - else expect(reference.symbols[0].name).toBe('Server') + expect(actual).toEqual(sections.map((section) => `section-${section.id}`)) + expect(reference.symbols.map(({ id, name, kind }: { id: string; name: string; kind: string }) => ({ id, name, kind }))) + .toEqual(declarations.map((symbol) => ({ id: symbol.publicId ?? symbol.id, name: symbol.name, kind: symbol.kind }))) for (const symbol of reference.symbols) { const target = new URL(symbol.url).pathname.replace(/^\//, '') expect(has(join(target, 'index.html')), symbol.url).toBe(true) diff --git a/site/test/fixtures/header-links.ts b/site/test/fixtures/header-links.ts index fbc6d6c9f..4481ab379 100644 --- a/site/test/fixtures/header-links.ts +++ b/site/test/fixtures/header-links.ts @@ -25,6 +25,15 @@ export interface ExpectedLinks { } export const LINKS: Record = { + clojure: { + actions: [['source', 'GitHub', 'GitHub: libtmux/libtmux-java/libtmux-clojure', 'https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure']], + indexed: true, + rows: [ + ['source', 'libtmux-java', 'libtmux/libtmux-java', 'https://github.com/libtmux/libtmux-java', ['repository']], + ['source', 'libtmux-clojure', 'libtmux-clojure', 'https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure', ['core-source']], + ['source', 'libtmux-clojure-core-async', 'libtmux-clojure-core-async', 'https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure-core-async', ['adapter-source']], + ], + }, py: { actions: [['source', 'GitHub', 'GitHub: tmux-python/libtmux', 'https://github.com/tmux-python/libtmux'], ['package', 'PyPI', 'PyPI: libtmux package', 'https://pypi.org/project/libtmux/']], diff --git a/site/test/fixtures/home-examples.json b/site/test/fixtures/home-examples.json index e431ba348..0da84e64f 100644 --- a/site/test/fixtures/home-examples.json +++ b/site/test/fixtures/home-examples.json @@ -1465,6 +1465,90 @@ "excerptSha256": "315b120fc40982d69ab2945b84a0b2c6df5faf8d63d75bf940739cd6e23b68af" } } + }, + { + "sourceRepository": "libtmux/libtmux-java", + "sourceRevision": "941f2162062b6d118c68b7d1c23417e0d2cea124", + "sourceTree": "7d2f3dc40377daae080643b19333d173036331fb", + "port": "clojure", + "page": "home", + "files": [ + { + "name": "quickstart.clj", + "sha256": "e6c1299de8b54f2189e481a975a9467a1506a4bffe4e0c6155c097e4d2ad739b", + "clipboardSha256": "30ab6a33a95e189e069d17be4ce49a0ca49f453469c751b0a11cf1815fd3744b" + }, + { + "name": "deps.edn", + "sha256": "8b9c0e2fa9afa6ba871f05a16550ddfe6c5dbc7c7bb5febedf4308761011c622", + "clipboardSha256": "f0a15a944d1e676c6b9a2bab935942d075c465cdedbbc3e3b9a61a106bfcf7e2" + } + ], + "shellRecipe": [ + "git clone \\\n --branch master \\\n --single-branch \\\n https://github.com/libtmux/libtmux-java libtmux-source && \\\n git -C libtmux-source checkout --detach 941f2162062b6d118c68b7d1c23417e0d2cea124 && \\\n (cd libtmux-source && ./gradlew \\\n :libtmux:publishToMavenLocal \\\n :libtmux-clojure:publishToMavenLocal \\\n --max-workers=1 \\\n --console=plain \\\n \"-Dmaven.repo.local=$PWD/../m2\")", + "clojure -J-Dclojure.main.report=stderr -M quickstart.clj" + ], + "expectedOutputs": [ + [], + [ + "session demo", + " window editor: 2 panes", + " window logs: 1 panes", + "output=hello from Clojure" + ] + ], + "excerptSha256": "30ab6a33a95e189e069d17be4ce49a0ca49f453469c751b0a11cf1815fd3744b", + "tmuxVersions": [ + "3.3a", + "3.7c" + ], + "variants": { + "concise": { + "files": [ + { + "name": "quickstart.clj", + "sha256": "85502d7ea6d866726129b372b862910f26822af326a2482feb6204dc4dbe150f", + "clipboardSha256": "0158405c9367161b84375ff3c6ea609b9805e3fef72122aaaeb30d8590b93011" + }, + { + "name": "deps.edn", + "sha256": "8b9c0e2fa9afa6ba871f05a16550ddfe6c5dbc7c7bb5febedf4308761011c622", + "clipboardSha256": "f0a15a944d1e676c6b9a2bab935942d075c465cdedbbc3e3b9a61a106bfcf7e2" + } + ], + "excerptSha256": "0158405c9367161b84375ff3c6ea609b9805e3fef72122aaaeb30d8590b93011" + }, + "errors": { + "files": [ + { + "name": "quickstart.clj", + "sha256": "3a3f02af406240e0f1b62c933996e8b11d27fbad0545744735bc8a350fe2cd42", + "clipboardSha256": "f3aaa228820edbe7bccde05f3d77a2cf3d654925db58ec9b08fcce6dbf98273a" + }, + { + "name": "deps.edn", + "sha256": "8b9c0e2fa9afa6ba871f05a16550ddfe6c5dbc7c7bb5febedf4308761011c622", + "clipboardSha256": "f0a15a944d1e676c6b9a2bab935942d075c465cdedbbc3e3b9a61a106bfcf7e2" + } + ], + "excerptSha256": "f3aaa228820edbe7bccde05f3d77a2cf3d654925db58ec9b08fcce6dbf98273a" + }, + "cleanup": { + "files": [ + { + "name": "quickstart.clj", + "sha256": "743d862a878f64fd99c109bd840a7950dcafae538686d2c997a86923de631349", + "clipboardSha256": "f87dd0796a9958b621780e439f8d4f75348c9672c7c7ce38a70ecd35fce373e2" + }, + { + "name": "deps.edn", + "sha256": "8b9c0e2fa9afa6ba871f05a16550ddfe6c5dbc7c7bb5febedf4308761011c622", + "clipboardSha256": "f0a15a944d1e676c6b9a2bab935942d075c465cdedbbc3e3b9a61a106bfcf7e2" + } + ], + "excerptSha256": "f87dd0796a9958b621780e439f8d4f75348c9672c7c7ce38a70ecd35fce373e2" + } + } } ] } diff --git a/site/test/fixtures/port-destinations.ts b/site/test/fixtures/port-destinations.ts index e420562eb..094caf5a3 100644 --- a/site/test/fixtures/port-destinations.ts +++ b/site/test/fixtures/port-destinations.ts @@ -20,6 +20,9 @@ export interface ExpectedDestinations { const github = (url: string, name: string): ExpectedLink => ({ url, label: `${name} on GitHub` }) export const DESTINATIONS: Record = { + clojure: { + source: github('https://github.com/libtmux/libtmux-java/tree/master/libtmux-clojure', 'libtmux-java/libtmux-clojure'), + }, py: { source: github('https://github.com/tmux-python/libtmux', 'libtmux'), registry: { name: 'PyPI', url: 'https://pypi.org/project/libtmux/', icon: 'pypi', label: 'libtmux on PyPI' }, diff --git a/site/test/fixtures/port-links.json b/site/test/fixtures/port-links.json index 96e38b455..8ba30d657 100644 --- a/site/test/fixtures/port-links.json +++ b/site/test/fixtures/port-links.json @@ -19,6 +19,8 @@ "go v1.2.3 @revision": "", "java": "", "java v1.2.3 @revision": "", + "clojure": "", + "clojure v1.2.3 @revision": "", "kotlin": "", "kotlin v1.2.3 @revision": "", "scala": "", diff --git a/site/test/native-name.test.ts b/site/test/native-name.test.ts index de5e9b2cd..f9a138204 100644 --- a/site/test/native-name.test.ts +++ b/site/test/native-name.test.ts @@ -9,7 +9,7 @@ import { productApiHref } from '../src/lib/product-api' * The page's Qualified name row says a declaration the way the language writes it, in full: Rust spells a path with `::` * from its crate and TypeScript names a member by its owner, and every other port already keeps its own spelling in the * public id, which must stay as it was. A card's header says it in short: the owner and the member in the language's - * separator. The page heading still joins them with a dot in every port. + * separator. Clojure headings keep the namespace/var spelling. */ const symbolNamed = (port: string, id: string) => { const symbol = API_MODELS[port].symbols.find((entry) => (entry.publicId ?? entry.id) === id) @@ -183,6 +183,7 @@ describe('short names', () => { ['py', 'libtmux.Server.new_session', 'Server.new_session'], ['py', 'libtmux._internal.env.resolve_env', 'resolve_env'], ['java', 'io.github.libtmux.Server.Server.newSession', 'Server.newSession'], + ['clojure', 'libtmux.core/open!', 'libtmux.core/open!'], ['kotlin', 'io.github.libtmux.kotlin.Server.newSession', 'Server.newSession'], ['csharp', 'LibTmux.TmuxBuffers.SetAsync', 'TmuxBuffers.SetAsync'], ['julia', 'LibTmux.BatchResult.operations', 'BatchResult.operations'], @@ -197,7 +198,7 @@ describe('short names', () => { }) it('are the owner, a separator that the language writes, and the member, for every symbol of every port', { timeout: 30_000 }, () => { - const separators: Record = { rs: ['::'], cxx: ['::'], ruby: ['::', '.', '#'], lua: ['.', ':'], powershell: ['\\'] } + const separators: Record = { rs: ['::'], cxx: ['::'], ruby: ['::', '.', '#'], lua: ['.', ':'], powershell: ['\\'], clojure: ['/'] } for (const [port, model] of Object.entries(API_MODELS)) { const owners = new Map(model.symbols.map((symbol) => [symbol.id, symbol])) for (const symbol of model.symbols) { diff --git a/site/test/native-signature.test.ts b/site/test/native-signature.test.ts index cc6cdc15a..6a07729aa 100644 --- a/site/test/native-signature.test.ts +++ b/site/test/native-signature.test.ts @@ -625,7 +625,7 @@ describe('native signature emission', () => { const before = JSON.stringify(models.julia) const { entries } = await signatureProbe(models) expect([...new Set(entries.map(({ port }) => port))]).toEqual(API_MODEL_PORTS.map(({ slug }) => slug)) - expect(new Set(entries.map(({ port }) => port)).size).toBe(16) + expect(new Set(entries.map(({ port }) => port)).size).toBe(17) for (const [port, model] of Object.entries(models)) { const callables = model.symbols.filter((symbol) => symbol.signatures.some((signature) => signature.params.length > 0 && signature.returns)) const selected = callables.find((symbol) => /capture/i.test(symbol.name)) ?? callables[0] diff --git a/site/test/port-docs-identity.test.ts b/site/test/port-docs-identity.test.ts index fc9c4f221..57fb44dbf 100644 --- a/site/test/port-docs-identity.test.ts +++ b/site/test/port-docs-identity.test.ts @@ -159,8 +159,8 @@ describe('port docs workflow', () => { const entries = tag('v0.0.1-alpha.17').entries const matrix = publicationMatrix({ include: entries }, 'java', 'libtmux/libtmux-java', true) expect(matrix.include.map(({ port, version }) => `${port}/${version}`)).toEqual([ - 'java/v0.0.1-alpha.17', 'kotlin/v0.0.1-alpha.17', 'scala/v0.0.1-alpha.17', - 'java/next', 'kotlin/next', 'scala/next', + 'java/v0.0.1-alpha.17', 'clojure/v0.0.1-alpha.17', 'kotlin/v0.0.1-alpha.17', 'scala/v0.0.1-alpha.17', + 'java/next', 'clojure/next', 'kotlin/next', 'scala/next', ]) expect(publicationMatrix({ include: entries }, 'java', 'libtmux/libtmux-java').include).toHaveLength(2) expect(publicationMatrix({ include: entries }, 'fsharp', 'libtmux/libtmux-dotnet').include.every((entry) => entry.port === 'fsharp')).toBe(true) diff --git a/site/test/port-docs-runtime.test.ts b/site/test/port-docs-runtime.test.ts index 9dcee55c7..70e3fa6d7 100644 --- a/site/test/port-docs-runtime.test.ts +++ b/site/test/port-docs-runtime.test.ts @@ -71,6 +71,18 @@ const support = (reference: unknown) => JSON.stringify({ schema_version: 1, refe const tracking = 'erlang 29\nelixir 1.20\n' describe('native documentation producers', () => { + it('prepares the JVM toolchain for every member of the Java library family', () => { + const family = Object.values(PORT_BY_SLUG) + .filter((port) => port.slug === 'java' || port.parentLibrary?.slug === 'java') + .map((port) => port.slug).sort() + for (const action of ['actions/setup-java', 'gradle/actions/setup-gradle']) { + const condition = workflow.match(new RegExp(` - if: ([^\\n]+)\\n uses: ${action}@`))?.[1] + expect(condition, action).toBeDefined() + const selected = Array.from(condition!.matchAll(/matrix\.port == '([^']+)'/g), (match) => match[1]).sort() + expect(selected, action).toEqual(family) + } + }) + it.each([0, 23])('uses Julia tooling to build its tmux floor and stops on build failure %s', (exitCode) => { const directory = mkdtempSync(join(tmpdir(), 'libtmux-julia-tmux-')) const tooling = join(directory, 'export tooling') diff --git a/site/test/port-families.test.ts b/site/test/port-families.test.ts index b9c74ad11..91ca802ad 100644 --- a/site/test/port-families.test.ts +++ b/site/test/port-families.test.ts @@ -30,6 +30,7 @@ describe('port picker families', () => { const labels = PORT_FAMILIES.map((family) => family.label) expect(labels.slice(0, 2)).toEqual(['Scripting & web', 'Compiled & native']) expect(labels.slice(2)).toEqual(['JVM', '.NET', 'BEAM']) + expect(PORT_FAMILIES.find((family) => family.label === 'JVM')?.ports).toEqual(['java', 'kotlin', 'scala', 'clojure']) }) it('leaves the catch-all family empty for the registered ports, and last', () => { diff --git a/site/test/port-inventory.test.ts b/site/test/port-inventory.test.ts index 0e204c4e2..7008cedb4 100644 --- a/site/test/port-inventory.test.ts +++ b/site/test/port-inventory.test.ts @@ -21,7 +21,7 @@ const manifests = manifestPackages.ports as Record -const distributions = (slug: string) => published(slug).filter((entry) => !entry.within && entry.kind !== 'source') +const distributions = (slug: string) => entries(slug).filter((entry) => entry.status !== 'planned' && !entry.within && entry.kind !== 'source') const declared = (slug: string) => manifests[slug]!.distributions.map((entry) => entry.name) const GO = 'github.com/libtmux/libtmux-go' @@ -35,7 +35,7 @@ describe('port inventory', () => { expect(new Set(ids).size, 'ids are unique').toBe(ids.length) expect(entries(slug).filter((entry) => entry.kind === 'library'), 'exactly one library').toHaveLength(1) expect(entries(slug)[0]!.kind).toBe('library') - expect(entries(slug)[0]!.status).toBe('published') + expect(['published', 'configured-unpublished']).toContain(entries(slug)[0]!.status) for (const entry of entries(slug)) { expect(entry.label.trim(), entry.id).not.toBe('') expect(entry.coordinate.trim(), entry.id).not.toBe('') @@ -200,7 +200,7 @@ describe('port inventory', () => { it('agrees with every field of the port metadata the hero already shows', () => { for (const port of PORTS) { const [library] = entries(port.slug) - const list = published(port.slug) + const list = entries(port.slug).filter((entry) => entry.status !== 'planned') expect(library!.repo, `${port.slug} repo`).toBe(port.repo) // The vcpkg port is `libtmux`; the metadata's package name is the repository's. expect(library!.coordinate, `${port.slug} packageName`).toBe(port.slug === 'cxx' ? 'libtmux' : port.packageName) diff --git a/site/test/port-landing.test.ts b/site/test/port-landing.test.ts index b30d233db..e9ef3eac3 100644 --- a/site/test/port-landing.test.ts +++ b/site/test/port-landing.test.ts @@ -34,6 +34,7 @@ const PRODUCTS: Record = { cxx: ['core', 'mcp', 'workspace'], swift: ['core', 'mcp', 'workspace'], kotlin: ['core'], + clojure: ['core'], scala: ['core'], fsharp: ['core'], } diff --git a/site/test/product-docs.test.ts b/site/test/product-docs.test.ts index 357d233d7..60530ae22 100644 --- a/site/test/product-docs.test.ts +++ b/site/test/product-docs.test.ts @@ -4,13 +4,16 @@ import { createHash } from 'node:crypto' import { Window, type Element as DomElement } from 'happy-dom' import { describe, expect, it } from 'vitest' import { CONCEPT_DESCRIPTION, PORTS, productAvailable, productDescription, productIsConcept, productInDevelopment, productStatus, workspaceOverviewNotice, type Port } from '../src/lib/ports' +import { headingTitle } from '../src/lib/branding' +import { docsPath, type DocsPage } from '../src/lib/docs-paths' +import { docsEntriesAvailable } from '../src/lib/page-port-links' +import { proseSources } from '../../scripts/lib/api-destinations.mjs' import { REGISTRY } from '../src/lib/registry' import { LANG_TO_PORT } from '../src/plugins/remark-port-code.mjs' -import { SITE_BUILT, SITE_PREFIX, PREVIEW_PREFIX, productionPath, publishedPath, sitePath } from './site-root' +import { SITE_BUILT, SITE_PREFIX, PREVIEW_PREFIX, REPO_ROOT, productionPath, publishedPath, sitePath } from './site-root' import { MCP_REFERENCE, MCP_SECTIONS, mcpObjects } from '../src/lib/mcp-catalog' import { mcpObjectGroup } from '../src/lib/mcp-reference' import { mentionBadge, mentionBadgeHtml } from '../src/lib/mention-badge' -import { mcpTitle, workspaceSubtitle, workspaceTitle } from '../src/lib/product-copy' import type { ApiTreeJson } from '../src/lib/api-search' import { PRODUCT_SECTIONS } from '../src/lib/product-api-sections' import { loadAstroTemplate, renderAstroTemplate } from './astro-templates' @@ -45,6 +48,15 @@ interface DocsManifest { const products = ['mcp', 'workspace'] as const const primaryPorts = PORTS.filter((port) => !port.parentLibrary) +// Read authored and staged routes only when the assembled-output checks run. +let sourcePages: Map | undefined +function portPages(port: string): DocsPage[] { + if (!sourcePages) { + const entries = proseSources({ root: REPO_ROOT }) + sourcePages = new Map(PORTS.map((owner) => [owner.slug, docsEntriesAvailable(entries, owner.slug)])) + } + return sourcePages.get(port)! +} /** A regular-expression alternation over the registered ports, so a new port is covered without editing a list. */ const portSlugs = (ports: readonly Port[] = PORTS) => ports.map((port) => port.slug).join('|') const read = (path: string) => readFileSync(sitePath(path), 'utf8') @@ -110,18 +122,13 @@ it('advertises local native loaders while retaining their development status', ( }) function sectionsFor(port: string, product: ProductPage['product']): string[] { - if (port === 'powershell' && product === 'mcp') return [] - if (nativeProductDocs(port)) return ['', 'source-guide', 'reference'] - // A product with no published implementation has only the overview that says so. - if (!productAvailable(PORTS.find((entry) => entry.slug === port)!, product)) return [''] - if (port === 'ruby') return ['', 'topics', 'guides', 'examples', 'reference'] - // `reference` is a section of the product now, not a page inside Internals: - // the Workspace Manager and the MCP server are packages with APIs of their - // own, and Internals keeps the notes about building one. - if (product === 'mcp') return ['', 'topics', 'guides', 'examples', 'reference'] - return port === 'py' - ? ['', 'topics', 'guides', 'examples', 'reference', 'internals', 'internals/topics', 'internals/examples'] - : ['', 'guides', 'examples', 'reference', 'internals', 'internals/topics', 'internals/guides', 'internals/examples'] + const owner = PORTS.find((entry) => entry.slug === port)! + if (owner.parentLibrary) return [] + const sections = productAvailable(owner, product) + ? ['', 'source-guide', 'topics', 'guides', 'examples', 'reference', 'internals', 'internals/topics', 'internals/guides', 'internals/examples'] + : owner.productAvailability?.[product] === 'unpublished' ? [''] : [] + const routes = new Set(portPages(port).map(docsPath)) + return sections.filter((section) => routes.has(`${product}${section ? `/${section}` : ''}`)) } function pages(): ProductPage[] { @@ -378,8 +385,9 @@ describe.skipIf(!SITE_BUILT)('assembled MCP and Workspace Manager docs', () => { }) }) - it.each(PORTS.filter((port) => !port.parentLibrary).map((port) => port.slug))('%s exposes supported products from latest homes and core navigation', async (port) => { - for (const section of ['', 'guides/', 'topics/']) { + it.each(PORTS.map((port) => port.slug))('%s exposes supported products from latest homes and core navigation', async (port) => { + const routes = new Set(portPages(port).filter((entry) => !entry.data.product).map(docsPath)) + for (const section of ['', ...['guides/', 'topics/'].filter((section) => routes.has(section.slice(0, -1)))]) { const path = `${port}/latest/${section}` await inspect(path, (document) => { const navigation = document.querySelectorAll(section ? '[data-surface-picker]' : 'main') @@ -456,18 +464,9 @@ describe.skipIf(!SITE_BUILT)('assembled MCP and Workspace Manager docs', () => { expect(article, page.path).toBeDefined() const headings1 = [...article!.matchAll(/]*>([\s\S]*?)<\/h1>/gi)].map((match) => match[1]!) expect(headings1, page.path).toHaveLength(1) - const sharedBrowse = page.product === 'workspace' && !['py', 'ruby'].includes(page.port) - && ['guides', 'examples'].includes(page.section) - if (nativeProductDocs(page.port)) { - const nativeTitles = page.product === 'workspace' - ? { '': `${workspaceTitle(page.port)} ${workspaceSubtitle(page.port)}`, 'source-guide': 'Workspace guide', reference: `${page.port === 'julia' ? 'LibTmuxWorkspace' : 'LibTmux.Workspace'} API reference` } - : { '': mcpTitle(page.port), 'source-guide': 'MCP server guide', reference: 'LibTmuxMCP API reference' } - expect(text(headings1[0]!), page.path).toBe(nativeTitles[page.section as keyof typeof nativeTitles]) - } else if (sharedBrowse) { - expect(text(headings1[0]!), page.path).toBe(page.section === 'guides' ? 'Guides' : 'Examples') - } else { - expect(text(headings1[0]!), page.path).toContain(page.name) - } + const entry = portPages(page.port).find((entry) => docsPath(entry) + === `${page.product}${page.section ? `/${page.section}` : ''}`)! + expect(text(headings1[0]!), page.path).toBe(headingTitle(entry.data as { title: string; subtitle?: string })) const context = html.match(/]*class="surface-picker-footer"[^>]*>([\s\S]*?)<\/div>/i)?.[1] expect(context, `${page.path} language and version context`).toBeDefined() expect(text(context!), page.path).toBe(`${page.name} · ${page.version} · en`) @@ -519,18 +518,23 @@ describe.skipIf(!SITE_BUILT)('assembled MCP and Workspace Manager docs', () => { }) it.each(PORTS.filter((port) => !port.parentLibrary && products.some((product) => !productAvailable(port, product)))) - ('$name builds, lists and links only the overview of a product it has not published', (port) => { + ('$name builds and lists only permitted unavailable-product pages', (port) => { const version = manifest().defaultVersion[port.slug]! const docs = JSON.parse(read(`${port.slug}/${version}/docs.json`)) as DocsManifest for (const product of products.filter((entry) => !productAvailable(port, entry))) { // Whatever the product's other pages would be called, none is built or listed. const directory = sitePath(`${port.slug}/${version}/${product}`) const built = existsSync(directory) ? readdirSync(directory, { recursive: true }).map(String) : [] - expect(built.filter((file) => file.endsWith('.html') && file !== 'index.html'), `${port.slug} ${product} pages built beyond the overview`).toEqual([]) + const availability = port.productAvailability?.[product] ?? 'available' + const overview = availability === 'unpublished' + expect(built.filter((file) => file.endsWith('.html') && (!overview || file !== 'index.html')), + `${port.slug} ${product} pages built outside its availability`).toEqual([]) + if (!overview) expect(docs.pages.some((entry) => new URL(entry.url).pathname + === urlFor(`${port.slug}/${version}/${product}/`).pathname), `${port.slug} ${product} excluded overview`).toBe(false) expect(pagesBeyondOverview(docs.pages, urlFor(`${port.slug}/${version}/${product}/`).pathname), `${port.slug} ${product} pages listed beyond the overview`).toEqual([]) const advertised = docs.ports.find((entry) => entry.slug === port.slug)!.products.find((entry) => entry.slug === product)! - expect(advertised.availability, `${port.slug} ${product}`).toBe('unpublished') + expect(advertised.availability, `${port.slug} ${product}`).toBe(availability) expect(advertised.reference, `${port.slug} ${product} reference`).toBeNull() } }) @@ -609,7 +613,8 @@ describe.skipIf(!SITE_BUILT)('assembled MCP and Workspace Manager docs', () => { expect(picker?.querySelector('.surface-current small')?.textContent, `${page.path} current section`).toBe(sectionLabel) const current = picker?.querySelectorAll('[aria-current="location"]') expect(current, `${page.path} one current section`).toHaveLength(1) - const sectionPath = `${page.port}/${page.version}/${page.product}/${page.section === 'source-guide' ? 'source-guide/' : section === 'home' ? '' : `${section}/`}` + const sourceGuideSection = page.section === 'source-guide' && !sectionsFor(page.port, page.product).includes('guides') + const sectionPath = `${page.port}/${page.version}/${page.product}/${sourceGuideSection ? 'source-guide/' : section === 'home' ? '' : `${section}/`}` expect(current![0].getAttribute('href'), `${page.path} current destination`).toBe(urlFor(sectionPath).pathname) expect(resolves(current![0].getAttribute('href')!), `${page.path} current destination exists`).toBe(true) // The API reference is the reference sidebar, one navigation for every viewport; the other sections share the section sidebar. @@ -956,7 +961,7 @@ describe.skipIf(!SITE_BUILT)('assembled MCP and Workspace Manager docs', () => { } for (const product of products) { const metadata = advertised.products.find((entry) => entry.slug === product)! - expect(metadata.availability, `${root}${port.slug} ${product} availability`).toBe(productAvailable(port, product) ? 'available' : 'unpublished') + expect(metadata.availability, `${root}${port.slug} ${product} availability`).toBe(port.productAvailability?.[product] ?? 'available') expect(metadata.inDevelopment, `${root}${port.slug} ${product} development status`).toBe(productInDevelopment(port, product)) if (productIsConcept(port, product)) { expect(metadata.support).toBe('concept') diff --git a/site/test/prose-markdown.test.ts b/site/test/prose-markdown.test.ts index 8b7a92b53..c265248f7 100644 --- a/site/test/prose-markdown.test.ts +++ b/site/test/prose-markdown.test.ts @@ -362,7 +362,7 @@ describe('prose Markdown links', () => { it.each(Object.keys(PORT_BY_SLUG))('links a real %s declaration in its selected version', (port) => { const model = API_MODELS[port] - const name = port === 'powershell' ? 'New-TmuxServer' : 'Server' + const name = port === 'powershell' ? 'New-TmuxServer' : port === 'clojure' ? 'libtmux.core' : 'Server' const symbol = model.symbols.find((entry) => entry.name === name && (port === 'powershell' ? entry.command : !entry.parent))! expect(symbol, `${port} ${name} declaration`).toBeDefined() vi.stubEnv('LIBTMUX_DOCS_PORT', port) diff --git a/site/test/publish-plan.test.ts b/site/test/publish-plan.test.ts index ef4c0b290..ce5fc14bd 100644 --- a/site/test/publish-plan.test.ts +++ b/site/test/publish-plan.test.ts @@ -138,6 +138,7 @@ describe('publish plan', () => { it('selects each parent and wrapper once through its owning repository', () => { const family = [ { slug: 'java', repo: 'libtmux/libtmux-java', tagGrammar: 'semver', docsDispatch: { workflow: 'docs.yml', language: 'java' } }, + { slug: 'clojure', repo: 'libtmux/libtmux-java', tagGrammar: 'semver', parentLibrary: { slug: 'java' }, docsDispatch: { workflow: 'docs.yml', language: 'clojure' } }, { slug: 'kotlin', repo: 'libtmux/libtmux-java', tagGrammar: 'semver', parentLibrary: { slug: 'java' }, docsDispatch: { workflow: 'docs.yml', language: 'kotlin' } }, { slug: 'scala', repo: 'libtmux/libtmux-java', tagGrammar: 'semver', parentLibrary: { slug: 'java' }, docsDispatch: { workflow: 'docs.yml', language: 'scala' } }, { slug: 'csharp', repo: 'libtmux/libtmux-dotnet', tagGrammar: 'semver', docsDispatch: { workflow: 'docs.yml', language: 'csharp' } }, @@ -152,7 +153,7 @@ describe('publish plan', () => { expect(new Set(lookups).size).toBe(6) expect(entries.map((entry) => [entry.port, entry.language])).toEqual([ ['py', ''], ['rs', ''], ['go', ''], ['swift', ''], - ['java', 'java'], ['kotlin', 'kotlin'], ['scala', 'scala'], ['csharp', 'csharp'], ['fsharp', 'fsharp'], + ['java', 'java'], ['clojure', 'clojure'], ['kotlin', 'kotlin'], ['scala', 'scala'], ['csharp', 'csharp'], ['fsharp', 'fsharp'], ]) expect(plan({ ports: 'kotlin,fsharp', ref: 'latest' }, family, lookup, versions)).toMatchObject([ { port: 'kotlin', repo: 'libtmux/libtmux-java', language: 'kotlin' }, diff --git a/site/test/stage-port-docs.outer.test.ts b/site/test/stage-port-docs.outer.test.ts index 7c7ab8f4f..4a1ccf362 100644 --- a/site/test/stage-port-docs.outer.test.ts +++ b/site/test/stage-port-docs.outer.test.ts @@ -11,7 +11,7 @@ const cachedRevision = 'a'.repeat(40) const files = ['scripts/stage-port-docs.mjs', 'site/src/lib/ports.ts', 'site/src/lib/site-root.ts', 'site/src/lib/cooldown.ts', 'site/src/lib/port-documentation.ts', 'site/src/lib/versions.ts'] -const stagedPorts = ['ruby', 'lua', 'powershell', 'julia', 'elixir', 'kotlin', 'scala', 'fsharp'] +const stagedPorts = ['ruby', 'lua', 'powershell', 'julia', 'elixir', 'clojure', 'kotlin', 'scala', 'fsharp'] function fixture(slug: 'ruby' | 'lua' | 'kotlin', run: (fixture: { directory: string; checkout: string; revision: string; diff --git a/site/test/stage-port-docs.test.ts b/site/test/stage-port-docs.test.ts index 6cab3c66d..59ea57378 100644 --- a/site/test/stage-port-docs.test.ts +++ b/site/test/stage-port-docs.test.ts @@ -11,10 +11,19 @@ import fsharpGuides from '../src/data/port-guides/fsharp.json' import csharpModel from '../src/data/api/csharp.json' import powershellGuides from '../src/data/port-guides/powershell.json' import juliaGuides from '../src/data/port-guides/julia.json' +import clojureGuides from '../src/data/port-guides/clojure.json' afterEach(() => vi.unstubAllEnvs()) describe('integrated guide inputs', () => { + it('routes native Clojure namespace anchors to their actual API pages', () => { + const staged = stagedPortGuides('clojure', clojureGuides) + const readme = staged.get('clojure/guides/getting-started/index.md')! + expect(readme).toContain('../../reference/libtmux-core/') + expect(readme).toContain('../../reference/libtmux-data/') + expect(readme).not.toContain('reference/#libtmux') + }) + const port = PORTS.find((entry) => entry.slug === 'lua')! it('reads the integrated commit regardless of newer HEAD or dirty files', () => { @@ -128,7 +137,7 @@ describe('staged port guide links', () => { expect(index).toContain('"label":"Overview","order":1') const cards = JSON.parse(/^cards: (.+)$/m.exec(index)![1]) expect(cards[0].label).toBe('Getting started') - expect(cards[1].label).toBe('Attaching to tmux') + expect(cards[1].label).toBe(port === 'clojure' ? 'Captures, effects and streams' : 'Attaching to tmux') for (const section of ['examples', 'topics']) { const page = files.get(`${port}/${section}/index.md`) if (!page) continue diff --git a/site/test/symbol-form.test.ts b/site/test/symbol-form.test.ts index 4fbd3b1e9..2a98f19fa 100644 --- a/site/test/symbol-form.test.ts +++ b/site/test/symbol-form.test.ts @@ -18,6 +18,7 @@ interface Row { } const ROWS: Record = { + clojure: { type: ['libtmux.core', 'libtmux.core'], method: ['libtmux.core/open!', 'libtmux.core/open!', 'libtmux.core/open!'], function: ['active?', 'active?', 'libtmux.core/active?'], property: [':pane/id', ':pane/id', 'pane/id'], member: ['Direction', ':right', ':right', ':right', ':right'] }, py: { type: ['libtmux::Server', 'libtmux.Server'], method: ['Server.list_sessions', 'Server.list_sessions()', 'libtmux.Server.list_sessions'], function: ['get_version', 'get_version()', 'libtmux.get_version'], property: ['Server.socket_name', 'Server.socket_name', 'libtmux.Server.socket_name'], member: ['Direction', 'UP', 'libtmux.Direction.UP', 'Direction.UP', 'Direction.UP'] }, ts: { type: ['server.Server', 'server.Server'], method: ['Server.listSessions', 'Server.listSessions()', 'server.Server.listSessions'], function: ['parseWorkspace', 'parseWorkspace()', 'config.parseWorkspace'], property: ['Pane.id', 'Pane.id', 'pane.Pane.id'], member: ['Direction', 'Up', 'constants.Direction.Up', 'Direction.Up', 'Direction.Up'] }, rs: { type: ['crate.Server', 'crate::Server'], method: ['Server.list_sessions', 'Server::list_sessions()', 'server.Server.list_sessions'], function: ['retry_until', 'retry_until()', 'test.retry_until'], property: ['Pane::id', 'Pane::id', 'pane.Pane.id'], member: ['Direction', 'Up', 'pane.Direction.Up', 'Direction::Up', 'Direction::Up'] }, diff --git a/site/test/tmux-minimum.test.ts b/site/test/tmux-minimum.test.ts index 62afda9d1..98eb7a428 100644 --- a/site/test/tmux-minimum.test.ts +++ b/site/test/tmux-minimum.test.ts @@ -45,6 +45,18 @@ export const PORT_FLOORS = [ * covers. */ export const OTHER_FLOORS = [ + { + path: 'site/src/content/docs/ports/clojure/examples.md', + version: '3.7', + near: /stream examples/, + why: 'the control stream examples use the Java engine\'s tmux 3.7 capability gate; core acquisition supports 3.3a', + }, + { + path: 'packages/api-model/src/languages/clojure-examples.ts', + version: '3.7', + near: /requiresControl/, + why: 'the expected output conditional applies only to control programs; older supported tmux prints the documented refusal', + }, { path: 'site/src/content/_workspace-shared/workspace/guides/installation.md', version: '3.2a', diff --git a/site/test/tmux-usage-derive.test.ts b/site/test/tmux-usage-derive.test.ts index 70e3cdb6c..8337ad3cd 100644 --- a/site/test/tmux-usage-derive.test.ts +++ b/site/test/tmux-usage-derive.test.ts @@ -18,6 +18,28 @@ const scopes = readFileSync(new URL('../src/data/tmux-usage/scopes.json', import const spec = { scopes: libraryScopes(JSON.parse(scopes).commands['list-panes']) } describe('scanning a send site', () => { + it('reads Clojure interop calls without treating docstrings or discarded forms as sends', async () => { + const text = [ + '(ns libtmux.core)', + '; (.ignored server)', + '(defn ^Server acquire!', + ' "Captures a server; (.ignored server)."', + ' [server]', + ' #_(.ignored server)', + ' (comment (.ignored server))', + ' (let [snapshot (.captureServer server)]', + ' (.newSession server spec)))', + '(defn send! [server] (run server ["list-panes" "-s" "-t" "%0"]))', + ].join('\n') + const { functions } = await scanSource({ grammar: 'clojure', text, + commands: new Set(['list-panes']), known, dispatch: new Set(['run']) }) + expect(functions.map((fn) => [fn.name, fn.start, fn.end])).toEqual([['acquire!', 3, 9], ['send!', 10, 10]]) + expect([...functions[0]!.calls.keys()]).toEqual(['let', 'captureServer', 'newSession']) + expect([...functions[0]!.receivers.get('newSession')!]).toEqual(['server']) + expect(functions[0]!.sites).toEqual([]) + expect(functions[1]!.sites).toEqual([{ command: 'list-panes', line: 10, flags: 'st', dispatch: { name: 'run', line: 10 } }]) + }) + it('reads the flags written beside the command and ignores a docstring and a default value', async () => { const { functions } = await scan('python', [ 'class Session:', diff --git a/site/test/wrapper-libraries.test.ts b/site/test/wrapper-libraries.test.ts index fb2b58271..dfcc41062 100644 --- a/site/test/wrapper-libraries.test.ts +++ b/site/test/wrapper-libraries.test.ts @@ -24,7 +24,7 @@ describe('wrapper library identities', () => { it('keeps wrappers beside their parent with distinct packages and artwork', () => { const slugs = PORTS.map((port) => port.slug) - expect(slugs.slice(slugs.indexOf('java'), slugs.indexOf('java') + 3)).toEqual(['java', 'kotlin', 'scala']) + expect(slugs.slice(slugs.indexOf('java'), slugs.indexOf('java') + 4)).toEqual(['java', 'clojure', 'kotlin', 'scala']) expect(slugs.slice(slugs.indexOf('csharp'), slugs.indexOf('csharp') + 2)).toEqual(['csharp', 'fsharp']) for (const { slug, parent, runtime, packageName } of wrappers) { const port = PORT_BY_SLUG[slug]
TypeWraps
{home.objectLabel}Wraps
{object.name} {object.wraps}{object.tmuxId && <>, ID {object.tmuxId}n}