SLOPSHOPPER

basalt

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…

panebandguardcommandtoastprocess
v0.3.4MITupdated 2026-10-17cofoundy/basalt-plugin/plugins/basalt
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · basalt
│ ┃ Basalt · session docs ✕ › fix the failing auth test and add an audit log call │ ┃ No Basalt docs in this session yet. │ ⏺ Read(src/auth.ts) │ ⎿ Read 6 lines │ ⏺ Update(src/auth.ts) │ ⎿ Added 2 lines, removed 1 line │ ⏺ Bash(bun test) │ ⎿ 3 pass, 1 fail │ │ ● Done. refresh now rejects expired claims and logs an audit event. │ │ ✻ Worked for 42s · done 4:20 PM │ │ › /basalt-links │ ⎿ basalt: Basalt docs of this session opened in the pane. │ │ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Pane · Basalt · session docs
No Basalt docs in this session yet.
README

<img alt="Basalt" src="./assets/logo.png" width="420">

<h1 align="center">Basalt — publish from your AI agent</h1>

<a href="./LICENSE"><img src="https://badgen.net/badge/license/MIT/blue" alt="license MIT"></a> <a href="https://skills.sh"><img src="https://badgen.net/badge/agents/70+/black" alt="agents 70+"></a> <a href="https://github.com/cofoundy/basalt-plugin"><img src="https://badgen.net/badge/npx%20skills%20add/cofoundy%2Fbasalt-plugin/green" alt="npx skills add cofoundy/basalt-plugin"></a>

<!-- skills.sh badge stays out until the repo is indexed (post-install telemetry) — a 404 badge reads as broken: skills.sh -->

Your AI wrote something good. Now it lives at a URL your colleague can actually open. Tell your agent to publish or share a doc and it converges on Basalt — the trust layer for AI-generated work. Markdown in → a branded, permissioned, versioned page by URL. No copy-pasting into a gist, no "let me send you the file," no work that evaporates in a chat log.

Before: your agent's best writing dies in the terminal, or lands in a throwaway gist with no permissions, no history, no review. After: one sentence — "publish this" — and you get back a live link to send. The page is governed, versioned, and your colleague can comment on it. Companies remember.

<img src="./assets/readme/workflow.svg" width="100%" alt="Four steps: you ask your agent to publish; it reads your workspace conventions; publish_doc compiles, versions and applies permissions; you get a live URL to send.">

What you get

  • A shareable link, not a file. publish_doc returns a live URL — that's the deliverable. Send it; your colleague reads and reviews in place.
  • **It writes as you.** The agent inherits your Basalt permissions over MCP — it sees and changes exactly what you can, never more.
  • Zero typing. The bundled skill auto-fires on "publish this / share this doc / documéntalo" — no command to memorize. (There's a /basalt command too, if you want it.)
  • Every link, one key away. In Claude Code, a band above the prompt collects every Basalt doc the session publishes — o opens the latest, c copies it. No scrolling up the chat to find the URL. (details)
  • Governed by default. Versioned, access-controlled, reviewable — because AI-authored work should become durable org truth, not chat scrollback.

Install

As a Claude Code plugin (MCP server + skill + /basalt command, one install):

/plugin marketplace add cofoundy/basalt-plugin
/plugin install basalt@basalt

Or just the skill, in any of 70+ agents (Claude Code, Codex, Cursor, OpenCode…) via the open agent-skills ecosystem:

npx skills add cofoundy/basalt-plugin

The first time your agent calls a Basalt tool, a browser login (OAuth) opens — approve once and you're connected to your workspace. That's the only setup.

Use it

Just ask, in plain language:

"Write up how our auth service works and publish it so the team can review."

The agent looks at your workspace conventions, writes the doc, calls publish_doc, and hands you back a live URL. Send that link — done.

What it can do

Once connected, your agent can (within your permissions):

  • Read any doc you have access to — list_docs, search_docs, read_doc.
  • Publish & update docs by URL, versioned — publish_doc, update_doc.
  • Share a doc with a colleague or client — set_access.
  • Read review comments, propose a diff, and republish — the full review loop.

What's inside

An MCP-bearing Claude Code plugin (the same shape as the official Figma plugin):

plugins/basalt/
├── .claude-plugin/plugin.json   # plugin manifest
├── .mcp.json                    # the Basalt MCP server (HTTP + per-user OAuth)
├── commands/basalt.md           # the /basalt command
├── skills/basalt/SKILL.md       # the auto-invoking skill (its description is the magic)
├── hooks/                       # three session-boundary hooks (silence by default)
│   └── register.tsx             #   + the links band (a Claude Code function-hooks module)
├── types/index.d.ts             # the band's state contract
└── tests/                       # `claude plugin test plugins/basalt`

The plugin holds no secrets — it points at the public MCP endpoint and auth is per-user OAuth. It's a thin, honest on-ramp; the product lives in Basalt.

Session hooks (quiet unless there's something to do)

Three hooks fire only at session boundaries, and stay silent by default — a hook that talks when it doesn't need to is just noise:

  • On session start — if you're not signed in, the agent gets one line so it can offer basalt login before your first publish fails. Signed in? Nothing.
  • While you work — edits to a file under a vault.yaml are quietly tracked (no network, no output).
  • At the end of a turn — if you edited vault docs but didn't publish, one line asks whether to publish. Set publish: auto in that vault.yaml and it publishes the changed files for you (diff-aware, once per turn — never on every keystroke).

Per-vault policy lives in vault.yaml: publish: prompt (default) · auto · manual. When one doc needs a different answer than its vault — the server refuses it, say — an optional publish_overrides: block gives that exact path its own policy, so you don't have to silence the whole vault to quiet one file. Every hook ships with tests that run against real captured Claude Code payloads (hooks/tests/run.sh) — a silent hook is worthless if it's silently dead.

The links band (every doc of the session, one key away)

Agents publish docs mid-conversation, and the URL scrolls away with the chat. The band above the prompt keeps the docs the session (or one of its subagents) published, and only those: the link a basalt publish/basalt move or an MCP publish_doc/update_doc returns, and the docs a git push to main hands to a vault's publish Action (each .md/.mdx the push changed under a vault.yaml, in a repo whose workflows run basalt publish). A link the session merely read — in code, a log, an old transcript — never lands there. A pushed doc gets its /{space}/{slug} URL, which the app redirects to the canonical one; when the band already holds a doc of that space, it uses that workspace directly.

<img src="./assets/readme/links-band.svg" width="100%" alt="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) opens a side pane with every doc of the session. The pane stays pinned across reloads and sessions until you close it. Long nested names keep the title (cut in the middle, so its version suffix survives), then the space, then the nearest folders.

The mark is the real logo where the surface can draw it: the SVG on the desktop app, 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.

Already have docs in git?

Use the basalt CLI instead — it syncs a git repo diff-aware and keeps git the source of truth. This plugin (MCP) is for content born in a conversation; the CLI is for content that already lives in a repo.

MCP endpoint

https://app.basalt.cofoundy.ai/api/mcp

No token to paste — the first call runs OAuth in your browser. Headless/CI callers can use a static bearer (see the Basalt docs).

Contributing

See CONTRIBUTING.md. Run bash scripts/validate-skills.sh before a PR.

License

MIT — see LICENSE. Dogfooded and maintained by Cofoundy.


_Basalt is a Cofoundy product. Agents create. Basalt governs. Humans decide. Companies remember._

<sub>publish docs from an AI agent · Claude Code MCP plugin · agent skill to publish & share markdown by URL · governed, permissioned, versioned AI documentation · Claude, Codex, Cursor, OpenCode</sub>

Source 3 files
hooks/register.tsx 395 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register } from 'claude-code'
3
4import { MARK_PNG, MARK_SVG } from './mark'
5
6import type { BasaltLink } from '../types'
7
8// Basalt brand tokens (products/basalt/tokens/colors.css). Dark-first:
9// Molten is the one ember (the mark, nothing else), Signal Teal is links.
10const MOLTEN = '#E2603B'
11const ASH = '#F4F5F3'
12const MUTED = '#7C828B' // stone-400: metadata on dark
13const TEAL = '#3FB6A8'
14const COLUMN = '#3A3F47' // column grey: the chip behind the wordmark
15const STONE = '#B8BDC4' // stone-300: secondary text on dark
16
17const PANE = 'basalt-links'
18const URL_RE = /https:\/\/app\.basalt\.cofoundy\.ai\/[^\s)\]"'<>`\\]+/g
19// What the band's fixed parts take: "⬣ basalt · 12 docs · " + the four buttons.
20const BAND_CHROME = 24 + 44
21const links = atom({ plugin: 'basalt', key: 'links' } as const, [])
22
23// Every string in a row's content (model text, tool results, nested blocks).
24const strings = (value: unknown, out: string[] = []): string[] => {
25  if (typeof value === 'string') out.push(value)
26  else if (Array.isArray(value)) value.forEach(v => strings(v, out))
27  else if (value && typeof value === 'object') Object.values(value).forEach(v => strings(v, out))
28
29  return out
30}
31
32// The command as the shell runs it: heredoc bodies and quoted strings are text the
33// command carries (an issue body, a commit message), not commands it runs.
34export const commandText = (command: string): string =>
35  command
36    .replace(/<<-?\s*(['"]?)([A-Za-z_][\w-]*)\1[^\n]*\n[\s\S]*?(?:\n[ \t]*\2[ \t]*(?=\n|$)|$)/g, ' ')
37    .replace(/'[^']*'|"(?:[^"\\]|\\.)*"/g, "''")
38
39// `basalt …` at the head of a shell segment, after any `VAR=value` and an npx/pnpm/bunx runner.
40const AT_HEAD = String.raw`(?:^|[;&|(\n])\s*(?:\w+=\S*\s+)*(?:(?:npx|bunx|pnpm\s+(?:exec\s+|dlx\s+)?)\s*)?`
41const BASALT_PUBLISH = new RegExp(AT_HEAD + String.raw`basalt(?:-cli)?\s+(?:publish|move)\b`)
42const GIT_PUSH = new RegExp(AT_HEAD + String.raw`git(?:\s+-C\s+\S+)?\s+push\b`)
43
44// The calls that publish: `basalt publish|move` from a shell, `publish_doc|update_doc` over MCP.
45export const isPublish = (tool: string, command: unknown): boolean =>
46  tool === 'Bash'
47    ? typeof command === 'string' && BASALT_PUBLISH.test(commandText(command))
48    : /basalt/i.test(tool) && /__(publish_doc|update_doc)$/.test(tool)
49
50export const isGitPush = (command: unknown): boolean =>
51  typeof command === 'string' && GIT_PUSH.test(commandText(command))
52
53// The ranges a `git push` moved onto a default branch ("  1a2b3c4..5d6e7f8  main -> main").
54// A new branch, a delete or a push to any other branch publishes nothing: the vault's
55// Action publishes on a push to main.
56export const pushedRanges = (output: string): { from: string; to: string }[] =>
57  [...output.matchAll(/^\s*\+?\s*([0-9a-f]{7,40})\.\.\.?([0-9a-f]{7,40})\s+\S+\s+->\s+(\S+)/gm)]
58    .filter(m => m[3] === 'main' || m[3] === 'master')
59    .map(m => ({ from: m[1] ?? '', to: m[2] ?? '' }))
60
61// The directory the push ran in: `git -C <dir> push`, else the last `cd <dir>` before it,
62// else the session's own (relative paths against it).
63export const pushDir = (command: string, cwd: string, home = ''): string => {
64  const text = commandText(command)
65  const push = text.match(GIT_PUSH)
66  const head = push?.index === undefined ? text : text.slice(0, push.index + push[0].length)
67  const dashC = head.match(/git\s+-C\s+(\S+)\s+push\s*$/)
68  const cds = [...head.matchAll(/(?:^|[;&|(\n])\s*cd\s+([^\s;&|)]+)/g)]
69  const dir = dashC?.[1] ?? cds[cds.length - 1]?.[1]
70  if (!dir) return cwd
71  const expanded = dir.replace(/^~(?=\/|$)/, home)
72
73  return expanded.startsWith('/') ? expanded : `${cwd.replace(/\/$/, '')}/${expanded}`
74}
75
76// Byte-identical to the CLI's `normalizeSlug` (cli/src/local-docs.ts): the slug IS the
77// path relative to the vault root, each segment normalized, the .md/.mdx suffix gone.
78const segment = (seg: string) =>
79  seg.normalize('NFD').replace(/\p{M}+/gu, '').toLowerCase()
80    .replace(/[^a-z0-9_-]+/g, '-').replace(/-+/g, '-').replace(/^-+|-+$/g, '')
81
82export const normalizeSlug = (relPath: string): string =>
83  relPath.replace(/\.(md|mdx)$/i, '').split(/[\\/]/).map(segment).filter(Boolean).join('/')
84
85export const vaultName = (yaml: string): string | undefined =>
86  yaml.match(/^name:[ \t]*(.+?)[ \t]*$/m)?.[1]?.replace(/^["']|["']$/g, '').trim() || undefined
87
88const BASE = 'https://app.basalt.cofoundy.ai'
89
90// What reading a push needs from outside: git in a directory, a file's text.
91export type PushIo = {
92  git: (dir: string, args: string[]) => Promise<{ exitCode: number; stdout: string }>
93  read: (path: string) => Promise<string | undefined>
94}
95
96// The docs a push to main hands to the vault's publish Action: each .md/.mdx it added or
97// changed under a vault.yaml, in a repo whose workflows run `basalt publish`. The URL is
98// the flat /{space}/{slug} one: the app sends whoever may read it to the canonical URL,
99// and the workspace is not knowable from the repo.
100export async function pushedDocs(io: PushIo, dir: string, output: string): Promise<{ url: string; trail: string[]; title: string }[]> {
101  const ranges = pushedRanges(output)
102  if (ranges.length === 0) return []
103  const top = await io.git(dir, ['rev-parse', '--show-toplevel'])
104  if (top.exitCode !== 0) return []
105  const root = top.stdout.trim()
106  const docs: { url: string; trail: string[]; title: string }[] = []
107  for (const { from, to } of ranges) {
108    const action = await io.git(root, ['grep', '-l', '-e', 'basalt publish', to, '--', '.github/workflows'])
109    if (action.exitCode !== 0) continue
110    const changed = await io.git(root, ['diff', '--name-only', '--diff-filter=AMR', `${from}..${to}`, '--', '*.md', '*.mdx'])
111    for (const file of changed.stdout.split('\n').filter(Boolean)) {
112      const parts = file.split('/')
113      for (let depth = parts.length - 1; depth >= 0; depth--) {
114        const yaml = await io.read([root, ...parts.slice(0, depth), 'vault.yaml'].join('/'))
115        if (yaml === undefined) continue
116        const space = vaultName(yaml) ?? segment(parts[depth - 1] ?? root.split('/').pop() ?? '')
117        const slug = normalizeSlug(parts.slice(depth).join('/'))
118        if (space && slug) {
119          const path = slug.split('/')
120          docs.push({ url: `${BASE}/${space}/${slug}`, trail: [space, ...path.slice(0, -1)], title: path[path.length - 1] ?? slug })
121        }
122        break
123      }
124    }
125  }
126
127  return docs
128}
129
130const pushIo = ($: EngineInterface): PushIo => ({
131  git: (dir, args) => $.process.run(['git', '-C', dir, ...args]).catch(() => ({ exitCode: 1, stdout: '' })),
132  read: path => $.fs.read(path).then(text => (typeof text === 'string' ? text : undefined), () => undefined),
133})
134
135// Canonical URLs are /{workspace}/{space}/{doc…}; the workspace is always the
136// same for one person, so the trail starts at the space.
137export const toLink = (url: string, by: string, at: number): BasaltLink => {
138  const segments = new URL(url).pathname.split('/').filter(Boolean).map(decodeURIComponent)
139  const trail = segments.length >= 3 ? segments.slice(1) : segments
140  const title = trail[trail.length - 1] ?? url
141
142  return { url, title, trail: trail.slice(0, -1), by, at }
143}
144
145// A flat /{space}/{slug} URL turns canonical when the band already holds a doc of that
146// space under its workspace (the redirect costs a hop, and a copied link should not).
147export const withWorkspace = (link: BasaltLink, list: BasaltLink[]): BasaltLink => {
148  const flat = new URL(link.url).pathname.split('/').filter(Boolean)
149  if (flat[0] !== link.trail[0] || flat.length !== link.trail.length + 1) return link
150  for (const other of list) {
151    const parts = new URL(other.url).pathname.split('/').filter(Boolean)
152    if (parts.length >= 3 && parts[1] === flat[0]) return { ...link, url: `${BASE}/${parts[0]}/${flat.join('/')}` }
153  }
154
155  return link
156}
157
158// Rows stored by an earlier version carry no trail.
159const fresh = (link: BasaltLink) => (Array.isArray(link.trail) ? link : toLink(link.url, link.by, link.at))
160
161const cut = (text: string, room: number) => {
162  if (text.length <= room) return text
163  const keep = Math.max(1, room - 1)
164  const head = Math.ceil(keep / 2)
165
166  return text.slice(0, head) + '…' + text.slice(text.length - (keep - head))
167}
168
169// Fits "space › folder › title" into `room` cells: the title always survives
170// (cut in the middle, so its start and its version suffix stay), then the
171// nearest folders, and whatever does not fit collapses to "…".
172// Fits "space › folder › title" into `room` cells. Priority: the title (cut in
173// the middle, so its start and its version suffix stay), then the space, then
174// the nearest folders; the folders that do not fit collapse to "…".
175export const crumb = (link: BasaltLink, room: number) => {
176  const trail = link.trail
177  const space = trail[0]
178  // The space keeps its place beside the title unless the room is too small for both.
179  const reserve = space === undefined ? 0 : trail.length > 1 ? space.length + 7 : space.length + 3
180  const title = cut(link.title, Math.max(16, room - reserve))
181  let left = room - title.length
182  const whole = trail.reduce((sum, part) => sum + part.length + 3, 0)
183  if (whole <= left) return { path: trail.map(part => part + ' › ').join(''), title }
184  left -= 4 // "… › "
185  const folders = trail.slice(1)
186  const head = space !== undefined && space.length + 3 <= left ? [space] : []
187  left -= head.reduce((sum, part) => sum + part.length + 3, 0)
188  const near: string[] = []
189  for (const part of [...folders].reverse()) {
190    if (part.length + 3 > left) break
191    near.unshift(part)
192    left -= part.length + 3
193  }
194
195  return { path: [...head, '…', ...near].map(part => part + ' › ').join(''), title }
196}
197
198async function openUrl($: EngineInterface, url: string) {
199  const mac = await $.process.run(['open', url]).catch(() => ({ exitCode: 1 }))
200  if (mac.exitCode !== 0) await $.process.run(['xdg-open', url]).catch(() => undefined)
201}
202
203// English by default; Spanish when the locale says so (POSIX precedence:
204// LC_ALL, then LC_MESSAGES, then LANG).
205const STRINGS = {
206  en: {
207    open: 'Open', copy: 'Copy', all: 'All', copied: 'Link copied',
208    pane: 'Basalt · session docs', empty: 'No Basalt docs in this session yet.',
209    command: 'List the Basalt docs of this session', opened: 'Basalt docs of this session opened in the pane.',
210    session: 'session', subagent: 'subagent',
211  },
212  es: {
213    open: 'Abrir', copy: 'Copiar', all: 'Todos', copied: 'Link copiado',
214    pane: 'Basalt · docs de la sesión', empty: 'Ningún doc de Basalt en esta sesión todavía.',
215    command: 'Lista los docs de Basalt de esta sesión', opened: 'Docs de Basalt de esta sesión abiertos en el panel.',
216    session: 'sesión', subagent: 'subagente',
217  },
218} as const
219type Strings = (typeof STRINGS)[keyof typeof STRINGS]
220
221export const pickLanguage = (lcAll?: string, lcMessages?: string, lang?: string): keyof typeof STRINGS => {
222  const locale = lcAll || lcMessages || lang || ''
223
224  return locale.toLowerCase().startsWith('es') ? 'es' : 'en'
225}
226
227async function labels($: EngineInterface): Promise<Strings> {
228  const language = pickLanguage(await $.env.get('LC_ALL'), await $.env.get('LC_MESSAGES'), await $.env.get('LANG'))
229
230  return STRINGS[language]
231}
232
233// The pane stays open across reloads and sessions until the person closes it.
234async function openPane($: EngineInterface, focus?: true) {
235  await $.store.set('isPinned', true)
236  await $.ui.open({ id: PANE, title: (await labels($)).pane, ...(focus ? { focus } : {}) })
237}
238
239async function copyUrl($: EngineInterface, url: string, surface: Parameters<EngineInterface['ui']['copy']>[0]['surface']) {
240  await $.ui.copy({ text: url, surface })
241  $.ui.toast((await labels($)).copied)
242}
243
244// Whether this terminal shows kitty graphics: kitty or Ghostty, run directly.
245// A multiplexer (tmux, screen, herdr) passes none through, and there `Image`
246// would draw its alt dim, so the glyph in Molten is the better fallback.
247async function hasGraphics($: EngineInterface) {
248  const multiplexed = [
249    await $.env.get('TMUX'),
250    await $.env.get('STY'),
251    await $.env.get('HERDR_ENV'),
252    await $.env.get('ZELLIJ'),
253  ].some(Boolean)
254  if (multiplexed) return false
255  const program = await $.env.get('TERM_PROGRAM')
256
257  return program === 'ghostty' || Boolean(await $.env.get('KITTY_WINDOW_ID'))
258}
259
260// The mark, best the surface can draw: the SVG on desktop, the PNG on a
261// terminal with kitty graphics, and the hexagon glyph in Molten elsewhere.
262async function mark($: EngineInterface, e: Parameters<EngineInterface['ui']['resolve']>[0]) {
263  if (e.surface === 'terminal' && (await hasGraphics($))) {
264    const { Image } = $.ui.resolve(e)
265
266    return <Image source={{ png: MARK_PNG }} columns={2} rows={1} alt="⬣" />
267  }
268  if (e.surface === 'desktop') {
269    const { Svg } = $.ui.resolve(e)
270
271    return <Svg source={MARK_SVG} alt="Basalt" width={16} height={16} />
272  }
273  const { Text } = $.ui.resolve(e)
274
275  return <Text color={MOLTEN}>⬣</Text>
276}
277
278export const register: Register = on => {
279  on('session.start', async ($, e, next) => {
280    await $.command.register({ name: 'basalt-links', description: (await labels($)).command })
281    if ((await $.store.get('isPinned')) === true) void openPane($)
282
283    return next(e)
284  })
285
286  on('command.run', { command: 'basalt-links' }, async $ => {
287    await openPane($)
288
289    return { text: (await labels($)).opened }
290  })
291
292  // Only what this session published: the result of a publish, never a link it merely read
293  // (a subagent grepping old transcripts filled the band with docs nobody made), and the
294  // docs a push to main hands to the vault's publish Action (no URL ever reaches the session).
295  on('tool.call', async ($, e, next) => {
296    const out = await next(e)
297    if (out.deny !== undefined || out.isError) return out
298    const command = (e as { command?: unknown }).command
299    const publish = isPublish(e.tool, command)
300    const push = e.tool === 'Bash' && !publish && isGitPush(command)
301    if (!publish && !push) return out
302    const text = strings([out.text, out.result]).join('\n')
303    const found: BasaltLink[] = []
304    const by = e.agentId ? 'subagent' : 'session'
305    const now = await $.clock.now()
306    if (publish) {
307      for (const url of new Set((text.match(URL_RE) ?? []).map(url => url.replace(/[.,;:!?]+$/, ''))))
308        found.push(toLink(url, by, now))
309    } else {
310      const dir = pushDir(command as string, await $.session.cwd(), (await $.env.get('HOME')) ?? '')
311      for (const doc of await pushedDocs(pushIo($), dir, text).catch(() => [])) found.push({ ...doc, by, at: now })
312    }
313    if (found.length > 0) {
314      // One doc, one row: a flat /{space}/{slug} and its canonical /{ws}/{space}/{slug} are the same doc.
315      const key = (link: BasaltLink) => [...link.trail, link.title].join('/')
316      await update($, links, list => {
317        const known = new Set(list.map(fresh).map(key))
318        const added = found.filter(link => !known.has(key(link)) && known.add(key(link))).map(link => withWorkspace(link, list))
319
320        return [...list, ...added]
321      })
322    }
323
324    return out
325  })
326
327  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
328    const list = (await read($, links)).map(fresh)
329    const last = list[list.length - 1]
330    if (e.props.hasSurvey || !last) return next(e)
331
332    const { Box, Button, Text } = $.ui.resolve(e)
333    const t = await labels($)
334    const { path, title } = crumb(last, e.props.bodyColumns - BAND_CHROME)
335    const below = await next(e)
336
337    return (
338      <Box flexDirection="column">
339        <Box>
340          {await mark($, e)}
341          <Text> </Text>
342          <Text color={ASH} backgroundColor={COLUMN} bold> basalt </Text>
343          <Text> </Text>
344          <Text color={TEAL} bold>{list.length}</Text>
345          <Text color={MUTED}> doc{list.length === 1 ? '' : 's'}  </Text>
346          <Text key="path" color={STONE}>{path}</Text>
347          <Text key="title" color={ASH} bold>{title} </Text>
348          <Button key="abrir" hotkey="o" variant="primary" label={t.open} onPress={() => openUrl($, last.url)} />
349          <Text> </Text>
350          <Button key="copiar" hotkey="c" label={t.copy} onPress={() => copyUrl($, last.url, e.surface)} />
351          <Text> </Text>
352          <Button key="todos" hotkey="l" label={t.all} onPress={() => openPane($, true)} />
353        </Box>
354        {below}
355      </Box>
356    )
357  })
358
359  on('ui.close', { id: PANE }, async ($, e, next) => {
360    if (e.origin.kind === 'person') await $.store.set('isPinned', false)
361
362    return next(e)
363  })
364
365  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
366    const { Box, Button, Text } = $.ui.resolve(e)
367    const t = await labels($)
368    const list = (await read($, links)).map(fresh)
369    const room = Math.max(16, e.props.bodyColumns - 2)
370
371    return (
372      <Box flexDirection="column">
373        {list.length === 0 && <Text color={MUTED}>{t.empty}</Text>}
374        {[...list].reverse().map(link => {
375          const { path } = crumb({ ...link, title: '' }, room)
376
377          return (
378            <Box flexDirection="column" marginBottom={1}>
379              <Text color={ASH} bold wrap="truncate-middle">{link.title}</Text>
380              {link.trail.length > 0 && <Text color={MUTED} wrap="truncate-start">{path.replace(/ › $/, '')}</Text>}
381              <Text color={TEAL} wrap="truncate-middle">{link.url}</Text>
382              <Box>
383                <Button key={`o-${link.url}`} variant="primary" label={t.open} onPress={() => openUrl($, link.url)} />
384                <Text> </Text>
385                <Button key={`c-${link.url}`} label={t.copy} onPress={() => copyUrl($, link.url, e.surface)} />
386                <Text color={MUTED}> · {link.by === 'subagent' || link.by === 'subagente' ? t.subagent : t.session}</Text>
387              </Box>
388            </Box>
389          )
390        })}
391      </Box>
392    )
393  })
394}
395
hooks/mark.ts 8 lines
1// Basalt mark, from products/basalt/brand/assets: the SVG for surfaces that draw it,
2// a 64 px PNG of it (basalt-mark-512.png) for terminals with the kitty graphics protocol.
3export const MARK_SVG =
4  '<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">  <g transform="translate(256.00,395.05) scale(0.9521)">    <path d="M 100.00,-292.10 L 50.00,-205.50 L 50.00,-0.00 L 100.00,-86.60 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 50.00,-205.50 L -50.00,-205.50 L -50.00,0.00 L 50.00,-0.00 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M -50.00,-205.50 L -100.00,-292.10 L -100.00,-86.60 L -50.00,0.00 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 100.00,-292.10 L 50.00,-205.50 L -50.00,-205.50 L -100.00,-292.10 L -50.00,-378.71 L 50.00,-378.71 Z" fill="#E2603B" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M -42.00,-140.40 L -92.00,-53.80 L -92.00,86.60 L -42.00,0.00 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M -92.00,-53.80 L -192.00,-53.80 L -192.00,86.60 L -92.00,86.60 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M -192.00,-53.80 L -242.00,-140.40 L -242.00,0.00 L -192.00,86.60 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M -42.00,-140.40 L -92.00,-53.80 L -192.00,-53.80 L -242.00,-140.40 L -192.00,-227.00 L -92.00,-227.00 Z" fill="#F4F5F3" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 242.00,-140.40 L 192.00,-53.80 L 192.00,86.60 L 242.00,0.00 Z" fill="#4A5059" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 192.00,-53.80 L 92.00,-53.80 L 92.00,86.60 L 192.00,86.60 Z" fill="#3A3F47" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 92.00,-53.80 L 42.00,-140.40 L 42.00,0.00 L 92.00,86.60 Z" fill="#2A2E34" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>    <path d="M 242.00,-140.40 L 192.00,-53.80 L 92.00,-53.80 L 42.00,-140.40 L 92.00,-227.00 L 192.00,-227.00 Z" fill="#F4F5F3" stroke="#1A1C20" stroke-width="5.50" stroke-linejoin="miter"/>  </g></svg>'
5
6export const MARK_PNG =
7  'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABGUUKwAAAMrklEQVR4Ae0beZBT5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GMEiZRYjcWbsjAW+Chb4L4a2YLN94TiHAAAAAElFTkSuQmCC'
8
types/index.d.ts 8 lines
1export type BasaltLink = { url: string; title: string; trail: string[]; by: string; at: number }
2
3declare module 'claude-code' {
4  interface PluginState {
5    basalt: { links: BasaltLink[] }
6  }
7}
8