GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — re-export shell $ for plugin · 16892434/opencode@b824809

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bun.lock
  • packages/plugin/src
    • index.ts
    • shell.ts
  • script
    • publish.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bun.lock‎

Copy file name to clipboardExpand all lines: bun.lock
+5-5Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎packages/plugin/src/index.ts‎

Copy file name to clipboardExpand all lines: packages/plugin/src/index.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Event, createOpencodeClient, App, Model, Provider, Permission, UserMessage, Part } from "@opencode-ai/sdk"
2-
import { $ } from "bun"
2+
import type { BunShell } from "./shell"
33

44
export type PluginInput = {
55
client: ReturnType<typeof createOpencodeClient>
66
app: App
7-
$: $
7+
$: BunShell
88
}
99
export type Plugin = (input: PluginInput) => Promise<Hooks>
1010

Collapse file

‎packages/plugin/src/shell.ts‎

Copy file name to clipboard
+136Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
export type ShellFunction = (input: Uint8Array) => Uint8Array
2+
3+
export type ShellExpression =
4+
| { toString(): string }
5+
| Array<ShellExpression>
6+
| string
7+
| { raw: string }
8+
| ReadableStream
9+
10+
export interface BunShell {
11+
(strings: TemplateStringsArray, ...expressions: ShellExpression[]): BunShellPromise
12+
13+
/**
14+
* Perform bash-like brace expansion on the given pattern.
15+
* @param pattern - Brace pattern to expand
16+
*/
17+
braces(pattern: string): string[]
18+
19+
/**
20+
* Escape strings for input into shell commands.
21+
*/
22+
escape(input: string): string
23+
24+
/**
25+
* Change the default environment variables for shells created by this instance.
26+
*/
27+
env(newEnv?: Record<string, string | undefined>): BunShell
28+
29+
/**
30+
* Default working directory to use for shells created by this instance.
31+
*/
32+
cwd(newCwd?: string): BunShell
33+
34+
/**
35+
* Configure the shell to not throw an exception on non-zero exit codes.
36+
*/
37+
nothrow(): BunShell
38+
39+
/**
40+
* Configure whether or not the shell should throw an exception on non-zero exit codes.
41+
*/
42+
throws(shouldThrow: boolean): BunShell
43+
}
44+
45+
export interface BunShellPromise extends Promise<BunShellOutput> {
46+
readonly stdin: WritableStream
47+
48+
/**
49+
* Change the current working directory of the shell.
50+
*/
51+
cwd(newCwd: string): this
52+
53+
/**
54+
* Set environment variables for the shell.
55+
*/
56+
env(newEnv: Record<string, string> | undefined): this
57+
58+
/**
59+
* By default, the shell will write to the current process's stdout and stderr, as well as buffering that output.
60+
* This configures the shell to only buffer the output.
61+
*/
62+
quiet(): this
63+
64+
/**
65+
* Read from stdout as a string, line by line
66+
* Automatically calls quiet() to disable echoing to stdout.
67+
*/
68+
lines(): AsyncIterable<string>
69+
70+
/**
71+
* Read from stdout as a string.
72+
* Automatically calls quiet() to disable echoing to stdout.
73+
*/
74+
text(encoding?: BufferEncoding): Promise<string>
75+
76+
/**
77+
* Read from stdout as a JSON object
78+
* Automatically calls quiet()
79+
*/
80+
json(): Promise<any>
81+
82+
/**
83+
* Read from stdout as an ArrayBuffer
84+
* Automatically calls quiet()
85+
*/
86+
arrayBuffer(): Promise<ArrayBuffer>
87+
88+
/**
89+
* Read from stdout as a Blob
90+
* Automatically calls quiet()
91+
*/
92+
blob(): Promise<Blob>
93+
94+
/**
95+
* Configure the shell to not throw an exception on non-zero exit codes.
96+
*/
97+
nothrow(): this
98+
99+
/**
100+
* Configure whether or not the shell should throw an exception on non-zero exit codes.
101+
*/
102+
throws(shouldThrow: boolean): this
103+
}
104+
105+
export interface BunShellOutput {
106+
readonly stdout: Buffer
107+
readonly stderr: Buffer
108+
readonly exitCode: number
109+
110+
/**
111+
* Read from stdout as a string
112+
*/
113+
text(encoding?: BufferEncoding): string
114+
115+
/**
116+
* Read from stdout as a JSON object
117+
*/
118+
json(): any
119+
120+
/**
121+
* Read from stdout as an ArrayBuffer
122+
*/
123+
arrayBuffer(): ArrayBuffer
124+
125+
/**
126+
* Read from stdout as an Uint8Array
127+
*/
128+
bytes(): Uint8Array
129+
130+
/**
131+
* Read from stdout as a Blob
132+
*/
133+
blob(): Blob
134+
}
135+
136+
export type BunShellError = Error & BunShellOutput
Collapse file

‎script/publish.ts‎

Copy file name to clipboardExpand all lines: script/publish.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ for (const file of pkgjsons) {
2727
console.log("updated:", file)
2828
await Bun.file(file).write(pkg)
2929
}
30+
await $`bun install`
3031

3132
console.log("\n=== opencode ===\n")
3233
await import(`../packages/opencode/script/publish.ts`)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.