From 2ce1a2ccd01d0013f89db29c7b653e50888cdc44 Mon Sep 17 00:00:00 2001 From: A-PachecoT Date: Sat, 3 Oct 2026 23:02:06 -0500 Subject: [PATCH] feat(hooks): links band speaks English, Spanish when the locale is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The band shipped with Spanish labels only. A public plugin defaults to English: Open / Copy / All, "Basalt · session docs", "Link copied". When the locale is Spanish (POSIX precedence LC_ALL > LC_MESSAGES > LANG, starting with "es"), the labels switch to Abrir / Copiar / Todos. Rows now store who published as "session" | "subagent" and the pane localizes it at draw time (rows stored as "sesión"/"subagente" by 0.3.0 still read right). Code comments translated to English. README image and copy follow the English labels. Bumps the plugin to 0.3.1. Verified: claude plugin validate plugins/basalt (pass), claude plugin test plugins/basalt (5/5, new tests/language.test.ts), tsc against Claude Code 2.1.288 types, scripts/validate-skills.sh (pass). --- .claude-plugin/marketplace.json | 4 +- README.md | 5 +- assets/readme/links-band.svg | 28 +++++----- plugins/basalt/.claude-plugin/plugin.json | 2 +- plugins/basalt/hooks/register.tsx | 62 +++++++++++++++++------ plugins/basalt/tests/language.test.ts | 13 +++++ 6 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 plugins/basalt/tests/language.test.ts diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 490c5de..354a94e 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -6,14 +6,14 @@ }, "metadata": { "description": "Basalt — the trust layer for AI-generated work. Connect your AI to publish, update and share governed docs by URL.", - "version": "0.3.0" + "version": "0.3.1" }, "plugins": [ { "name": "basalt", "source": "./plugins/basalt", "description": "Connect your AI to Basalt — publish, update and share governed docs by URL. Bundles the Basalt MCP server (OAuth) + a skill that converges on it when you ask to publish or share written work.", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "Cofoundy SAC" }, diff --git a/README.md b/README.md index 70484b8..473917e 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ above the prompt keeps them: every `app.basalt.cofoundy.ai` link that enters the session — from the CLI, the MCP, the model's own text or a subagent — lands there.

- A Claude Code session where the agent published three docs. Above the prompt, the Basalt band shows the mark, 3 docs and the latest one, architecture-v2, with the buttons Abrir, Copiar and Todos; a side pane lists every doc of the session with its space, folder and link. + A Claude Code session where the agent published three docs. Above the prompt, the Basalt band shows the mark, 3 docs and the latest one, architecture-v2, with the buttons Open, Copy and All; a side pane lists every doc of the session with its space, folder and link.

`o` opens the latest doc in your browser, `c` copies its URL, `l` (or `/basalt-links`) @@ -142,6 +142,9 @@ The mark is the real logo where the surface can draw it: the SVG on the desktop a PNG on kitty or Ghostty run directly, and `⬣` in Molten elsewhere (inside tmux, screen, zellij or herdr Claude Code draws no pictures). +Labels are in English, and in Spanish when your locale is (`LC_ALL`, `LC_MESSAGES` or +`LANG` starting with `es`). + It is a Claude Code function-hooks module (early access); clients without function hooks keep the three shell hooks above, unchanged. Already installed? Update the plugin (`/plugin` → basalt → update) and run `/reload-plugins`. diff --git a/assets/readme/links-band.svg b/assets/readme/links-band.svg index d37b899..f2d8cea 100644 --- a/assets/readme/links-band.svg +++ b/assets/readme/links-band.svg @@ -1,6 +1,6 @@ The Basalt links band in Claude Code -A Claude Code session where the agent published three docs. Above the prompt, the Basalt band shows the Basalt mark, 3 docs and the latest doc, architecture-v2, with the buttons Abrir, Copiar and Todos. A side pane lists every doc of the session with its space, folder and link. +A Claude Code session where the agent published three docs. Above the prompt, the Basalt band shows the Basalt mark, 3 docs and the latest doc, architecture-v2, with the buttons Open, Copy and All. A side pane lists every doc of the session with its space, folder and link. @@ -49,33 +49,33 @@ docs handbook › … › architecture-v2 -[ Abrir ] -[ Copiar ] -[ Todos ] +[ Open ] +[ Copy ] +[ All ] ❯ -Basalt · docs de la sesión +Basalt · session docs architecture-v2 handbook › architecture https://app.basalt.co…ture/architecture-v2 -[ Abrir ] -[ Copiar ] - · sesión +[ Open ] +[ Copy ] + · session deploy-runbook handbook › runbooks https://app.basalt.co…ooks/deploy-runbook -[ Abrir ] -[ Copiar ] - · sesión +[ Open ] +[ Copy ] + · session q3-incident-review handbook › postmortems https://app.basalt.co…/q3-incident-review -[ Abrir ] -[ Copiar ] - · subagente +[ Open ] +[ Copy ] + · subagent o open the latest doc diff --git a/plugins/basalt/.claude-plugin/plugin.json b/plugins/basalt/.claude-plugin/plugin.json index 26cae5f..e50ac1c 100644 --- a/plugins/basalt/.claude-plugin/plugin.json +++ b/plugins/basalt/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "basalt", "description": "Connect your AI to Basalt — publish, update and share governed docs by URL. Bundles the Basalt MCP server (OAuth), a skill that converges on it when you ask to publish or share written work, and quiet session hooks (auth probe · edit tracking · publish nudge).", - "version": "0.3.0", + "version": "0.3.1", "author": { "name": "Cofoundy SAC", "url": "https://cofoundy.dev" diff --git a/plugins/basalt/hooks/register.tsx b/plugins/basalt/hooks/register.tsx index b5cd1de..6d849ea 100644 --- a/plugins/basalt/hooks/register.tsx +++ b/plugins/basalt/hooks/register.tsx @@ -20,7 +20,7 @@ const URL_RE = /https:\/\/app\.basalt\.cofoundy\.ai\/[^\s)\]"'<>`\\]+/g const BAND_CHROME = 24 + 44 const links = atom({ plugin: 'basalt', key: 'links' } as const, []) -// Junta todos los strings de un content (texto del modelo, tool results, anidados). +// Every string in a row's content (model text, tool results, nested blocks). const strings = (value: unknown, out: string[] = []): string[] => { if (typeof value === 'string') out.push(value) else if (Array.isArray(value)) value.forEach(v => strings(v, out)) @@ -39,7 +39,7 @@ export const toLink = (url: string, by: string, at: number): BasaltLink => { return { url, title, trail: trail.slice(0, -1), by, at } } -// Rows stored by an earlier version of this mod carry no trail. +// Rows stored by an earlier version carry no trail. const fresh = (link: BasaltLink) => (Array.isArray(link.trail) ? link : toLink(link.url, link.by, link.at)) const cut = (text: string, room: number) => { @@ -84,15 +84,45 @@ async function openUrl($: EngineInterface, url: string) { if (mac.exitCode !== 0) await $.process.run(['xdg-open', url]).catch(() => undefined) } +// English by default; Spanish when the locale says so (POSIX precedence: +// LC_ALL, then LC_MESSAGES, then LANG). +const STRINGS = { + en: { + open: 'Open', copy: 'Copy', all: 'All', copied: 'Link copied', + pane: 'Basalt · session docs', empty: 'No Basalt docs in this session yet.', + command: 'List the Basalt docs of this session', opened: 'Basalt docs of this session opened in the pane.', + session: 'session', subagent: 'subagent', + }, + es: { + open: 'Abrir', copy: 'Copiar', all: 'Todos', copied: 'Link copiado', + pane: 'Basalt · docs de la sesión', empty: 'Ningún doc de Basalt en esta sesión todavía.', + command: 'Lista los docs de Basalt de esta sesión', opened: 'Docs de Basalt de esta sesión abiertos en el panel.', + session: 'sesión', subagent: 'subagente', + }, +} as const +type Strings = (typeof STRINGS)[keyof typeof STRINGS] + +export const pickLanguage = (lcAll?: string, lcMessages?: string, lang?: string): keyof typeof STRINGS => { + const locale = lcAll || lcMessages || lang || '' + + return locale.toLowerCase().startsWith('es') ? 'es' : 'en' +} + +async function labels($: EngineInterface): Promise { + const language = pickLanguage(await $.env.get('LC_ALL'), await $.env.get('LC_MESSAGES'), await $.env.get('LANG')) + + return STRINGS[language] +} + // The pane stays open across reloads and sessions until the person closes it. async function openPane($: EngineInterface, focus?: true) { await $.store.set('isPinned', true) - await $.ui.open({ id: PANE, title: 'Basalt · docs de la sesión', ...(focus ? { focus } : {}) }) + await $.ui.open({ id: PANE, title: (await labels($)).pane, ...(focus ? { focus } : {}) }) } async function copyUrl($: EngineInterface, url: string, surface: Parameters[0]['surface']) { await $.ui.copy({ text: url, surface }) - $.ui.toast('Link copiado') + $.ui.toast((await labels($)).copied) } // Whether this terminal shows kitty graphics: kitty or Ghostty, run directly. @@ -131,7 +161,7 @@ async function mark($: EngineInterface, e: Parameters { on('session.start', async ($, e, next) => { - await $.command.register({ name: 'basalt-links', description: 'Lista los docs de Basalt de esta sesión' }) + await $.command.register({ name: 'basalt-links', description: (await labels($)).command }) if ((await $.store.get('isPinned')) === true) void openPane($) return next(e) @@ -140,16 +170,16 @@ export const register: Register = on => { on('command.run', { command: 'basalt-links' }, async $ => { await openPane($) - return { text: 'Docs de Basalt de esta sesión abiertos en el panel.' } + return { text: (await labels($)).opened } }) - // Cada fila que entra a la conversación (tuya, del modelo, de un tool, de un subagente) se escanea. + // Every row the conversation keeps (the person's, the model's, a tool's, a subagent's) is scanned. on('session.append', async ($, e, next) => { const stored = await next(e) const found = strings(e.message.content).flatMap(text => text.match(URL_RE) ?? []) if (found.length > 0) { const now = await $.clock.now() - const by = e.agentId ? 'subagente' : 'sesión' + const by = e.agentId ? 'subagent' : 'session' await update($, links, list => { const known = new Set(list.map(link => link.url)) const fresh = [...new Set(found.map(url => url.replace(/[.,;:!?]+$/, '')))] @@ -169,6 +199,7 @@ export const register: Register = on => { if (e.props.hasSurvey || !last) return next(e) const { Box, Button, Text } = $.ui.resolve(e) + const t = await labels($) const { path, title } = crumb(last, e.props.bodyColumns - BAND_CHROME) const below = await next(e) @@ -183,11 +214,11 @@ export const register: Register = on => { doc{list.length === 1 ? '' : 's'} {path} {title} -