From 0a6d02dfc567c0b4e6143aa04187ead55ae65764 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Fri, 17 Apr 2026 13:03:50 +0100 Subject: [PATCH] vault backup: 2026-04-17 13:03:50 --- .../Barclays Banner Builder.md | 5 + 99 Daily/2026-04-17.md | 6 + ...chestrate teams of Claude Code sessions.md | 0 wiki/_master-index.md | 2 +- wiki/dotfiles/wezterm-pane-to-lua.md | 140 ++++++++++++++++++ 5 files changed, 152 insertions(+), 1 deletion(-) rename raw/{ => _processed}/Orchestrate teams of Claude Code sessions.md (100%) create mode 100644 wiki/dotfiles/wezterm-pane-to-lua.md diff --git a/01 Projects/Barclays-banner-builder/Barclays Banner Builder.md b/01 Projects/Barclays-banner-builder/Barclays Banner Builder.md index f45ccfb..4159b6a 100644 --- a/01 Projects/Barclays-banner-builder/Barclays Banner Builder.md +++ b/01 Projects/Barclays-banner-builder/Barclays Banner Builder.md @@ -23,6 +23,10 @@ created: 2026-04-17 - **Local path:** `/Volumes/SSD/Projects/Oliver/Barclays-banner-builder` ## Sessions +### 2026-04-17 – Create an idempotent deployment script for +**Asked:** Create an idempotent deployment script for Docker containers on Ubuntu with Apache reverse proxy, database initialization, and migrations. +**Done:** Provided deployment script structure with git pull, Docker build caching, database initialization, and Alembic migrations for server deployment. + ### 2026-04-17 – Create a deployment script for Ubuntu **Asked:** Create a deployment script for Ubuntu server with Docker containers, database initialization, and migrations. **Done:** Analyzed application requirements and established deployment strategy with idempotent script for Docker builds, database setup, and frontend file management. @@ -163,6 +167,7 @@ created: 2026-04-17 ## Change Log | Date | Requested | Changed | Files | |------|-----------|---------|-------| +| 2026-04-17 | Deployment script | Docker build with caching, database init, Alembic migrations, frontend cleanup | deploy.sh, docker-compose.yml | | 2026-04-17 | Deployment script | Docker build with cache, DB initialization, Alembic migrations, frontend cleanup | deploy.sh, docker-compose.yml | | 2026-04-17 | Deployment automation | Docker build caching, database migrations, idempotent script logic | deploy.sh, docker-compose.yml | | 2026-04-17 | Deployment script | Docker build with cache refresh, database initialization and migrations, Apache Include configuration | deploy-ubuntu.sh, apache-barclays.conf, sites-enabled/optical-dev.oliver.solutions.conf | diff --git a/99 Daily/2026-04-17.md b/99 Daily/2026-04-17.md index 5650716..3770699 100644 --- a/99 Daily/2026-04-17.md +++ b/99 Daily/2026-04-17.md @@ -230,3 +230,9 @@ tags: [daily] - 13:01 | `memory-compiler` - **Asked:** Asked the developer to compile a raw article into the knowledge base as a structured wiki entry. - **Done:** Compiled and filed the article as `wiki/agent-sdk/observability-opentelemetry.md` with index updates. +- 13:03 (1min) | `memory-compiler` + - **Asked:** Compile a new article about agent teams into the wiki knowledge base with structured formatting. + - **Done:** Created `wiki/claude-code/agent-teams.md` with architecture tables, comparison matrices, control patterns, and quality gate hooks. +- 13:03 | `Barclays-banner-builder` + - **Asked:** Create an idempotent deployment script for Docker containers on Ubuntu with Apache reverse proxy, database initialization, and migrations. + - **Done:** Provided deployment script structure with git pull, Docker build caching, database initialization, and Alembic migrations for server deployment. diff --git a/raw/Orchestrate teams of Claude Code sessions.md b/raw/_processed/Orchestrate teams of Claude Code sessions.md similarity index 100% rename from raw/Orchestrate teams of Claude Code sessions.md rename to raw/_processed/Orchestrate teams of Claude Code sessions.md diff --git a/wiki/_master-index.md b/wiki/_master-index.md index 2bf6198..78e7bd1 100644 --- a/wiki/_master-index.md +++ b/wiki/_master-index.md @@ -32,7 +32,7 @@ This 3-hop pattern works for hundreds of articles without vector search. | [[wiki/agent-sdk/_index\|agent-sdk/]] | Claude Agent SDK (formerly Claude Code SDK) — build autonomous AI agents in Python and TypeScript | 17 | | [[wiki/llm-models/_index\|llm-models/]] | OpenAI model catalog — GPT-5.x, o-series reasoning, audio/realtime, embeddings, moderation | 1 | -| [[wiki/claude-code/_index\|claude-code/]] | Claude Code product docs — install, capabilities, surfaces, MCP, hooks, scheduling, multi-agent, plugins, skills, error recovery | 7 | +| [[wiki/claude-code/_index\|claude-code/]] | Claude Code product docs — install, capabilities, surfaces, MCP, hooks, scheduling, multi-agent, plugins, skills, error recovery | 8 | diff --git a/wiki/dotfiles/wezterm-pane-to-lua.md b/wiki/dotfiles/wezterm-pane-to-lua.md new file mode 100644 index 0000000..644a8d5 --- /dev/null +++ b/wiki/dotfiles/wezterm-pane-to-lua.md @@ -0,0 +1,140 @@ +--- +title: "WezTerm: Passing Data from a Pane to Lua" +aliases: [wezterm-user-vars, wezterm-osc, wezterm-pane-data] +tags: [wezterm, lua, terminal, osc, pane, shell-integration] +sources: [raw/Passing Data from a pane to Lua - Wez's Terminal Emulator.md] +created: 2026-04-17 +updated: 2026-04-17 +--- + +## Overview + +WezTerm cannot directly inspect what's running inside a pane (especially remote/SSH panes). The PTY interface only provides input/output streams and screen size. Instead, you signal data *into* WezTerm via escape sequences or OS APIs. + +## Methods + +### 1. User Vars (OSC 1337) — Most Powerful + +Key/value pairs scoped to a terminal pane. Written by the shell, read-only from within the pane, readable by Lua. + +**Set a user var from shell:** +```bash +printf "\033]1337;SetUserVar=%s=%s\007" foo `echo -n bar | base64` +``` +Value must be **base64 encoded**. + +**Read in Lua:** +```lua +pane:get_user_vars() -- returns all vars as a table +tab.active_pane.user_vars.FOO -- direct field access in event handlers +``` + +**Events triggered on var change:** +- `user-var-changed` — act immediately on a set/change +- `update-status` — refresh left/right status bar items +- Tab bar / title events fire as well + +Propagates across multiplexer clients. Works through **tmux** if you use tmux passthrough: +```bash +printf "\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\" "$1" `echo -n "$2" | base64` +``` +(Also requires `set -g allow-passthrough on` in `tmux.conf`.) + +**Shell alias pattern — set PROG on command run:** +```bash +__wezterm_set_user_var() { + if hash base64 2>/dev/null; then + if [[ -z "${TMUX}" ]]; then + printf "\033]1337;SetUserVar=%s=%s\007" "$1" `echo -n "$2" | base64` + else + printf "\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\" "$1" `echo -n "$2" | base64` + fi + fi +} + +function _run_prog() { + __wezterm_set_user_var "PROG" "$1" + trap '__wezterm_set_user_var PROG ""' EXIT + command "$@" +} + +alias vim="_run_prog vim" +alias nvim="_run_prog nvim" +alias tmux="_run_prog tmux" +``` + +**Use PROG in tab title:** +```lua +local wezterm = require 'wezterm' + +wezterm.on('format-tab-title', function(tab) + local prog = tab.active_pane.user_vars.PROG + return tab.active_pane.title .. ' [' .. (prog or '') .. ']' +end) + +return {} +``` + +### 2. OSC 0 / 1 / 2 — Window & Tab Title + +| OSC | Effect | Example | +|-----|--------|---------| +| `0` | Clears Icon Name, sets Window Title | `\x1b]0;title\x1b\\` | +| `1` | Sets Icon Name (used as Tab title if non-empty) | `\x1b]1;tab-title\x1b\\` | +| `2` | Sets Window Title | `\x1b]2;window-title\x1b\\` | + +Read back via `pane:get_title()` or `PaneInformation.title`. + +Many distro shells emit OSC 2 before each command. WezTerm will substitute the foreground process title if no OSC title is set (local panes only). + +### 3. OSC 7 — Current Working Directory + +```bash +printf "\033]7;file://HOSTNAME/CURRENT/DIR\033\\" +# or: +wezterm set-working-directory +``` + +Read back via `pane:get_current_working_dir()` or `PaneInformation.current_working_dir`. + +Wezterm shell integration auto-sets OSC 7 for bash/zsh. + +### 4. Local Process State + +Works **only for local panes** (no SSH/multiplexer): + +- `pane:get_foreground_process_info()` — process hierarchy info +- `wezterm.procinfo.get_info_for_pid(pid)` — info for a given PID + +Convenient since no shell config changes required, but: +- Fails for remote panes +- Less reliable on Windows for determining foreground process + +## Comparison + +| Method | Remote/SSH | Requires shell config | Use case | +|--------|------------|----------------------|----------| +| User Vars (OSC 1337) | ✅ | Yes (aliases/integration) | Arbitrary key/value signaling | +| OSC 0/1/2 | ✅ | Often automatic | Tab/window titles | +| OSC 7 | ✅ | Shell integration | CWD tracking | +| Local process info | ❌ | No | Quick local introspection | + +## Key Takeaways + +- **User Vars** are the most flexible mechanism — arbitrary key/value, works over SSH and tmux +- Values must be **base64 encoded** when sending via OSC 1337 +- The `user-var-changed` event fires immediately; use it to react dynamically in Lua +- **OSC 7** is the standard way to track CWD; shell integration handles it automatically +- **Local process APIs** are zero-config but only work locally +- Install [wezterm shell integration](https://wezterm.org/shell-integration.html) to get User Vars, OSC 7, and more out of the box + +## Related + +- [[wiki/dotfiles/wezterm-config|WezTerm Config]] — Lua config structure and live reload +- [[wiki/dotfiles/wezterm-key-tables|WezTerm Key Tables]] — modal keybinding layers +- [[wiki/dotfiles/wezterm-launching-programs|WezTerm Launching Programs]] — shell resolution and env vars +- [[wiki/dotfiles/wezterm-cli-reference|WezTerm CLI Reference]] — CLI subcommands and scripting + +## Sources + +- [wezterm.org/recipes/passing-data.html](https://wezterm.org/recipes/passing-data.html)