spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / sec-default / tests / fixtures / variables-set.ts
GitHub Actions (publish-mods)chore: Update mods/ 3deb873 · 12 days ago History
22 lines · 511 BRaw
1import type { On } from 'claude-code'
2
3/**
4 * A session starting, where each variable a plugin sets reaches the engine
5 * and is kept as `<plugin> <name>=<value>`.
6 *
7 * @param on the test's `on`
8 * @returns what was set, in order
9 */
10export function variablesSet(on: On) {
11 const kept: string[] = []
12
13 on('session.start', ($, e) => ({ cwd: e.cwd }))
14
15 on('env.set', ($, e, next) => {
16 kept.push(`${next.origin.plugin} ${e.name}=${String(e.value)}`)
17
18 return { value: undefined }
19 })
20
21 return kept
22}