Debian Codegraph @

wasi/p3/wit/deps/wasi-cli-0.3.0-rc-2026-01-06/package.wit

raw
1 package wasi:[email protected];
2
3 @since(version = 0.3.0-rc-2026-01-06)
4 interface environment {
5 /// Get the POSIX-style environment variables.
6 ///
7 /// Each environment variable is provided as a pair of string variable names
8 /// and string value.
9 ///
10 /// Morally, these are a value import, but until value imports are available
11 /// in the component model, this import function should return the same
12 /// values each time it is called.
13 @since(version = 0.3.0-rc-2026-01-06)
14 get-environment: func() -> list<tuple<string, string>>;
15
16 /// Get the POSIX-style arguments to the program.
17 @since(version = 0.3.0-rc-2026-01-06)
18 get-arguments: func() -> list<string>;
19
20 /// Return a path that programs should use as their initial current working
21 /// directory, interpreting `.` as shorthand for this.
22 @since(version = 0.3.0-rc-2026-01-06)
23 get-initial-cwd: func() -> option<string>;
24 }
25
26 @since(version = 0.3.0-rc-2026-01-06)
27 interface exit {
28 /// Exit the current instance and any linked instances.
29 @since(version = 0.3.0-rc-2026-01-06)
30 exit: func(status: result);
31
32 /// Exit the current instance and any linked instances, reporting the
33 /// specified status code to the host.
34 ///
35 /// The meaning of the code depends on the context, with 0 usually meaning
36 /// "success", and other values indicating various types of failure.
37 ///
38 /// This function does not return; the effect is analogous to a trap, but
39 /// without the connotation that something bad has happened.
40 @unstable(feature = cli-exit-with-code)
41 exit-with-code: func(status-code: u8);
42 }
43
44 @since(version = 0.3.0-rc-2026-01-06)
45 interface run {
46 /// Run the program.
47 @since(version = 0.3.0-rc-2026-01-06)
48 run: async func() -> result;
49 }
50
51 @since(version = 0.3.0-rc-2026-01-06)
52 interface types {
53 @since(version = 0.3.0-rc-2026-01-06)
54 enum error-code {
55 /// Input/output error
56 io,
57 /// Invalid or incomplete multibyte or wide character
58 illegal-byte-sequence,
59 /// Broken pipe
60 pipe,
61 }
62 }
63
64 @since(version = 0.3.0-rc-2026-01-06)
65 interface stdin {
66 use types.{error-code};
67
68 /// Return a stream for reading from stdin.
69 ///
70 /// This function returns a stream which provides data read from stdin,
71 /// and a future to signal read results.
72 ///
73 /// If the stream's readable end is dropped the future will resolve to success.
74 ///
75 /// If the stream's writable end is dropped the future will either resolve to
76 /// success if stdin was closed by the writer or to an error-code if reading
77 /// failed for some other reason.
78 ///
79 /// Multiple streams may be active at the same time. The behavior of concurrent
80 /// reads is implementation-specific.
81 @since(version = 0.3.0-rc-2026-01-06)
82 read-via-stream: func() -> tuple<stream<u8>, future<result<_, error-code>>>;
83 }
84
85 @since(version = 0.3.0-rc-2026-01-06)
86 interface stdout {
87 use types.{error-code};
88
89 /// Write the given stream to stdout.
90 ///
91 /// If the stream's writable end is dropped this function will either return
92 /// success once the entire contents of the stream have been written or an
93 /// error-code representing a failure.
94 ///
95 /// Otherwise if there is an error the readable end of the stream will be
96 /// dropped and this function will return an error-code.
97 @since(version = 0.3.0-rc-2026-01-06)
98 write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
99 }
100
101 @since(version = 0.3.0-rc-2026-01-06)
102 interface stderr {
103 use types.{error-code};
104
105 /// Write the given stream to stderr.
106 ///
107 /// If the stream's writable end is dropped this function will either return
108 /// success once the entire contents of the stream have been written or an
109 /// error-code representing a failure.
110 ///
111 /// Otherwise if there is an error the readable end of the stream will be
112 /// dropped and this function will return an error-code.
113 @since(version = 0.3.0-rc-2026-01-06)
114 write-via-stream: async func(data: stream<u8>) -> result<_, error-code>;
115 }
116
117 /// Terminal input.
118 ///
119 /// In the future, this may include functions for disabling echoing,
120 /// disabling input buffering so that keyboard events are sent through
121 /// immediately, querying supported features, and so on.
122 @since(version = 0.3.0-rc-2026-01-06)
123 interface terminal-input {
124 /// The input side of a terminal.
125 @since(version = 0.3.0-rc-2026-01-06)
126 resource terminal-input;
127 }
128
129 /// Terminal output.
130 ///
131 /// In the future, this may include functions for querying the terminal
132 /// size, being notified of terminal size changes, querying supported
133 /// features, and so on.
134 @since(version = 0.3.0-rc-2026-01-06)
135 interface terminal-output {
136 /// The output side of a terminal.
137 @since(version = 0.3.0-rc-2026-01-06)
138 resource terminal-output;
139 }
140
141 /// An interface providing an optional `terminal-input` for stdin as a
142 /// link-time authority.
143 @since(version = 0.3.0-rc-2026-01-06)
144 interface terminal-stdin {
145 @since(version = 0.3.0-rc-2026-01-06)
146 use terminal-input.{terminal-input};
147
148 /// If stdin is connected to a terminal, return a `terminal-input` handle
149 /// allowing further interaction with it.
150 @since(version = 0.3.0-rc-2026-01-06)
151 get-terminal-stdin: func() -> option<terminal-input>;
152 }
153
154 /// An interface providing an optional `terminal-output` for stdout as a
155 /// link-time authority.
156 @since(version = 0.3.0-rc-2026-01-06)
157 interface terminal-stdout {
158 @since(version = 0.3.0-rc-2026-01-06)
159 use terminal-output.{terminal-output};
160
161 /// If stdout is connected to a terminal, return a `terminal-output` handle
162 /// allowing further interaction with it.
163 @since(version = 0.3.0-rc-2026-01-06)
164 get-terminal-stdout: func() -> option<terminal-output>;
165 }
166
167 /// An interface providing an optional `terminal-output` for stderr as a
168 /// link-time authority.
169 @since(version = 0.3.0-rc-2026-01-06)
170 interface terminal-stderr {
171 @since(version = 0.3.0-rc-2026-01-06)
172 use terminal-output.{terminal-output};
173
174 /// If stderr is connected to a terminal, return a `terminal-output` handle
175 /// allowing further interaction with it.
176 @since(version = 0.3.0-rc-2026-01-06)
177 get-terminal-stderr: func() -> option<terminal-output>;
178 }
179
180 @since(version = 0.3.0-rc-2026-01-06)
181 world imports {
182 @since(version = 0.3.0-rc-2026-01-06)
183 import environment;
184 @since(version = 0.3.0-rc-2026-01-06)
185 import exit;
186 @since(version = 0.3.0-rc-2026-01-06)
187 import types;
188 @since(version = 0.3.0-rc-2026-01-06)
189 import stdin;
190 @since(version = 0.3.0-rc-2026-01-06)
191 import stdout;
192 @since(version = 0.3.0-rc-2026-01-06)
193 import stderr;
194 @since(version = 0.3.0-rc-2026-01-06)
195 import terminal-input;
196 @since(version = 0.3.0-rc-2026-01-06)
197 import terminal-output;
198 @since(version = 0.3.0-rc-2026-01-06)
199 import terminal-stdin;
200 @since(version = 0.3.0-rc-2026-01-06)
201 import terminal-stdout;
202 @since(version = 0.3.0-rc-2026-01-06)
203 import terminal-stderr;
204 import wasi:clocks/[email protected];
205 import wasi:clocks/[email protected];
206 import wasi:clocks/[email protected];
207 @unstable(feature = clocks-timezone)
208 import wasi:clocks/[email protected];
209 import wasi:filesystem/[email protected];
210 import wasi:filesystem/[email protected];
211 import wasi:sockets/[email protected];
212 import wasi:sockets/[email protected];
213 import wasi:random/[email protected];
214 import wasi:random/[email protected];
215 import wasi:random/[email protected];
216 }
217 @since(version = 0.3.0-rc-2026-01-06)
218 world command {
219 @since(version = 0.3.0-rc-2026-01-06)
220 import environment;
221 @since(version = 0.3.0-rc-2026-01-06)
222 import exit;
223 @since(version = 0.3.0-rc-2026-01-06)
224 import types;
225 @since(version = 0.3.0-rc-2026-01-06)
226 import stdin;
227 @since(version = 0.3.0-rc-2026-01-06)
228 import stdout;
229 @since(version = 0.3.0-rc-2026-01-06)
230 import stderr;
231 @since(version = 0.3.0-rc-2026-01-06)
232 import terminal-input;
233 @since(version = 0.3.0-rc-2026-01-06)
234 import terminal-output;
235 @since(version = 0.3.0-rc-2026-01-06)
236 import terminal-stdin;
237 @since(version = 0.3.0-rc-2026-01-06)
238 import terminal-stdout;
239 @since(version = 0.3.0-rc-2026-01-06)
240 import terminal-stderr;
241 import wasi:clocks/[email protected];
242 import wasi:clocks/[email protected];
243 import wasi:clocks/[email protected];
244 @unstable(feature = clocks-timezone)
245 import wasi:clocks/[email protected];
246 import wasi:filesystem/[email protected];
247 import wasi:filesystem/[email protected];
248 import wasi:sockets/[email protected];
249 import wasi:sockets/[email protected];
250 import wasi:random/[email protected];
251 import wasi:random/[email protected];
252 import wasi:random/[email protected];
253
254 @since(version = 0.3.0-rc-2026-01-06)
255 export run;
256 }