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
22 lines · 508 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 set: string[] = []
12
13 on('session.start', ($, e) => ({ cwd: e.cwd }))
14
15 on('env.set', ($, e, next) => {
16 set.push(`${next.origin.plugin} ${e.name}=${String(e.value)}`)
17
18 return { value: undefined }
19 })
20
21 return set
22}