@sparkwing/sdk 0.0.0-stage → 0.68.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +187 -2
  2. package/dist/command.js +272 -0
  3. package/dist/command.js.map +1 -0
  4. package/dist/context.js +69 -0
  5. package/dist/context.js.map +1 -0
  6. package/dist/describe.js +70 -0
  7. package/dist/describe.js.map +1 -0
  8. package/dist/errors.js +88 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/helpers/docker.js +267 -0
  11. package/dist/helpers/docker.js.map +1 -0
  12. package/dist/helpers/files.js +141 -0
  13. package/dist/helpers/files.js.map +1 -0
  14. package/dist/helpers/git.js +263 -0
  15. package/dist/helpers/git.js.map +1 -0
  16. package/dist/helpers/memo.js +29 -0
  17. package/dist/helpers/memo.js.map +1 -0
  18. package/dist/helpers/services.js +160 -0
  19. package/dist/helpers/services.js.map +1 -0
  20. package/dist/index.js +10 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/json.js +27 -0
  23. package/dist/json.js.map +1 -0
  24. package/dist/log.js +42 -0
  25. package/dist/log.js.map +1 -0
  26. package/dist/main.js +69 -0
  27. package/dist/main.js.map +1 -0
  28. package/dist/plan-wire.js +2 -0
  29. package/dist/plan-wire.js.map +1 -0
  30. package/dist/plan.js +812 -0
  31. package/dist/plan.js.map +1 -0
  32. package/dist/protocol.js +209 -0
  33. package/dist/protocol.js.map +1 -0
  34. package/dist/routes.js +187 -0
  35. package/dist/routes.js.map +1 -0
  36. package/dist/runner.js +380 -0
  37. package/dist/runner.js.map +1 -0
  38. package/dist/scope.js +27 -0
  39. package/dist/scope.js.map +1 -0
  40. package/dist/step-state.js +53 -0
  41. package/dist/step-state.js.map +1 -0
  42. package/dist/transport.js +50 -0
  43. package/dist/transport.js.map +1 -0
  44. package/index.d.ts +390 -0
  45. package/native/win32-arm64/protocol.node +0 -0
  46. package/native/win32-arm64/verification.json +1 -0
  47. package/native/win32-x64/protocol.node +0 -0
  48. package/native/win32-x64/verification.json +1 -0
  49. package/package.json +47 -4
package/README.md CHANGED
@@ -1,3 +1,188 @@
1
- # Temporary Holding Version
1
+ # @sparkwing/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Declare Sparkwing pipelines in TypeScript. The host schedules jobs and owns
4
+ placement, retries, risk authorization, storage and credentials. SDK processes
5
+ build declarations and execute the bodies and closures the host requests.
6
+
7
+ ```ts
8
+ import { definePipeline, main } from "@sparkwing/sdk";
9
+
10
+ definePipeline({
11
+ name: "check",
12
+ args: [{ name: "target", type: "string", default: "all" }],
13
+ secrets: [{ name: "DEPLOY_TOKEN", optional: true }],
14
+ plan(plan, run) {
15
+ const build = plan
16
+ .job("build", async (ctx) => {
17
+ await ctx.exec(["npm", "run", "build"]).run();
18
+ return { target: run.args.target };
19
+ })
20
+ .artifacts("dist/**");
21
+ plan
22
+ .job("report", async (ctx) => {
23
+ const output = await ctx.output(build);
24
+ await ctx.summary(`Built ${output?.target}`);
25
+ })
26
+ .needs(build)
27
+ .consumes(build, { into: "build-output" });
28
+ },
29
+ });
30
+
31
+ await main();
32
+ ```
33
+
34
+ `name` is the registration key. The `entrypoint` of a `sparkwing.yaml`
35
+ pipeline names it, and the run context's `pipeline` carries the invoked name.
36
+
37
+ Declare allowed child runs with `job.startsChildren("deploy")` for the parent
38
+ repository or `job.startsChildrenIn("gh:123", "publish")` for an explicit canonical
39
+ repository key. Calls append targets and can be chained.
40
+
41
+ Use an exact package version in `.sparkwing/package.json`. Its version selects
42
+ the matching engine. The package requires Node.js 22.18 or later. The public
43
+ API is [index.d.ts](index.d.ts).
44
+
45
+ Numeric duration options use milliseconds. Memory uses bytes. Omitted options
46
+ remain unset. Explicit zero remains zero, including an
47
+ indefinite approval timeout. Argument values stay strings, including `int64`.
48
+ The host validates arguments after describe and before planning. Empty defaults
49
+ mean no default. Required arguments with non-empty defaults are refused. NaN and
50
+ infinity are refused. Help and describe inspect declarations without requiring
51
+ invocation values. Errors come from host preparation as `invalid_args`.
52
+ Duration arguments use Go syntax such as `1h30m`, including `0`, `+0` and `-0`.
53
+ String-array arguments use comma splitting, trimming and empty-item removal in
54
+ both the raw argument map and typed values. The host trims enum choices and checks
55
+ each list item. Scalar string values keep their whitespace.
56
+ SDK declarations and direct `toDoc()` calls rely on host validation of argument
57
+ schemas, plan graphs and secret declarations. Generated jobs carry argument
58
+ declarations in their job specification. The host validates and prepares values
59
+ from the accepted run snapshot after generation, then sends them with execution
60
+ requests. Enable `extra` for supplied flags that only a generator declares. Annotation locations are validated
61
+ by the host service; TypeScript retains transport type checks.
62
+ Initial jobs may only use argument declarations discovered by zero-input describe,
63
+ with job IDs allowed to change. The gated expansion path registers secrets for new
64
+ generated declarations before execution.
65
+
66
+ `Context` provides lazy secrets and plain variables, typed outputs, references,
67
+ annotations, summaries, acknowledged masking, OIDC, child runs and cleanup.
68
+ Command, Git, Docker, service and filesystem helpers use the same context
69
+ and cancellation signal. Memo helpers declare input recipes for host evaluation. Plan callbacks declare work; helpers that perform I/O
70
+ refuse calls during planning. Generated jobs reconstruct from recorded source
71
+ output. The host validates the reconstructed declarations against accepted state.
72
+
73
+ Step output reads stay within the current attempt. Before a step condition or
74
+ body runs, the host supplies the terminal predecessor state. A skipped predecessor
75
+ has no local output. A terminal step cannot run again in the same attempt.
76
+ Run facts stay read-only across planning and retries, including trigger details
77
+ and nested pull-request facts.
78
+ Cancellation reaches bodies and every closure kind. A callback that finishes
79
+ after cancellation still reports a failed invocation. The SDK acknowledges
80
+ cancellation after the selected operations finish and receive their own replies.
81
+ Closure evaluations run in request order. Canceling a queued evaluation returns
82
+ without calling its author code or waiting for the running closure. Overlapping
83
+ generator replays return the recorded declaration after the first evaluation.
84
+ Service scopes also reject after cancellation when their callback returns normally.
85
+ They remove their containers before rejecting. If removal fails, host cleanup
86
+ stays registered and the cancellation error is preserved.
87
+
88
+ Git fileset hashes omit files beneath literal directory paths in `.dockerignore`,
89
+ including paths written without a trailing slash. Included file edits still
90
+ change the hash.
91
+
92
+ The host starts `node <entry> --sw-node-protocol`. Protocol 2 begins with hello,
93
+ which supplies granted runner identity and an optional in-memory service binding.
94
+ Requests and frames use private pipes. Standard output and error remain author
95
+ output. No preload or environment bearer is used. The SDK does not filter debug
96
+ logs or assign job identity to log frames.
97
+
98
+ Package imports use Node's native CommonJS and ESM loading, including symlinked
99
+ dependencies installed by pnpm. Default and named exports follow Node's interop
100
+ rules for both entry imports and imports inside job callbacks.
101
+
102
+ Every encoded frame must fit the 17 MiB wire limit. Oversized logs fail before
103
+ writing. Typed job and step outputs also have a separate 16 MiB limit.
104
+ Generated declarations use the frame budget. The Sparkwing host masks output and
105
+ protocol payloads after receiving them from the SDK. Pipeline code run without a
106
+ Sparkwing host has unmasked logs and errors.
107
+
108
+ Memo helpers declare recipes in the plan. The executing host evaluates them
109
+ against its checkout and effective job environment, under the job admission
110
+ permit. Tracked inputs encode paths, entry types and file bytes or symlink target
111
+ text. Tree inputs include regular files and skip symlinks. Custom callbacks return
112
+ JSON values for host hashing. `memoKey` collects parts and performs no hashing.
113
+
114
+ On Windows, the host supplies decimal handles through
115
+ `--sw-protocol-handles <request>,<frame>`. A packaged native bridge converts them
116
+ to Node descriptors and clears inheritance before SDK tools spawn. Independently
117
+ imported modules may execute before SDK initialization.
118
+
119
+ Build and verify each bridge in its matching native Windows MSVC environment,
120
+ with Node and Go running on that architecture:
121
+
122
+ ```sh
123
+ npm run release:native -- --version <engine-version> --headers <node-headers/include/node> --node-lib <node.lib> --arch x64
124
+ ```
125
+
126
+ Repeat with `--arch arm64` on native Windows arm64. The command stamps both npm
127
+ manifests, builds the bridge and runs `TestNativeProtocol` and
128
+ `TestNativeConformance`. Missing, skipped or failed native tests stop the build.
129
+ Each output directory contains `protocol.node` and a `verification.json` record
130
+ bound to the engine version, bridge bytes and SDK sources.
131
+
132
+ Build both architectures from the same source and version. Transfer their output
133
+ directories to the package checkout, then assemble the package:
134
+
135
+ ```sh
136
+ npm run release:pack -- --version <engine-version> --destination <output-directory>
137
+ ```
138
+
139
+ The release package must contain `native/win32-x64/protocol.node` and
140
+ `native/win32-arm64/protocol.node`. `npm pack` refuses the development version
141
+ and inconsistent lockfile versions. It also checks both bridge files and their
142
+ architecture and DLL headers. Both matching native verification records are
143
+ required because header checks cannot prove that Node can load and use a bridge.
144
+ The bridge source is in [native/protocol.c](native/protocol.c). End users need
145
+ no compiler.
146
+
147
+ ## Local dogfooding
148
+
149
+ On Linux or macOS, build a local package without Windows bridges:
150
+
151
+ ```sh
152
+ npm ci
153
+ npm run pack:local -- --version <engine-version> --destination <output-directory>
154
+ ```
155
+
156
+ This command builds the SDK and stamps a temporary package with the exact engine
157
+ release version. It leaves the source manifests unchanged. The tarball carries
158
+ `private: true`, so npm refuses publication even with `--ignore-scripts`.
159
+ Use `release:pack` with verified Windows bridges for published packages.
160
+ Local packages support Linux and macOS. They cannot run on Windows.
161
+
162
+ In the pipeline's package manifest, pin the tarball with
163
+ `"@sparkwing/sdk": "file:vendor/sparkwing-sdk-<engine-version>.tgz"` and run
164
+ `npm install` to record it in the lockfile. The tarball's package version selects
165
+ the exact engine, including any prerelease suffix. Commit the tarball inside the
166
+ repository if fetched checkouts need it. An editable SDK directory can use
167
+ `file:../sdk` after building and stamping that directory's package version.
168
+
169
+ For development, run `npm ci`, `npm run typecheck`, `npm test` and `npm run build`.
170
+ The build emits ESM into `dist/`; package exports expose only the public root.
171
+ The release process stamps `package.json` and its lockfile with the engine
172
+ release version. Hello reads that package version.
173
+
174
+ Run `npm run test:native` from this directory with the repository's Go toolchain
175
+ installed and `GOWORK=off` when a parent workspace points at another checkout.
176
+ The tests build the SDK and launch public-package fixtures with inherited
177
+ Unix descriptors or Windows argv handles. It exchanges requests and replies
178
+ using the Go contract types and check that a child tool cannot access the
179
+ protocol pipes. A second fixture runs the same v2 corpus as the Go SDK, including
180
+ strict plan validation, generated hashes, replay and canonical error envelopes. Use Node and Go for the same CPU architecture. On Windows,
181
+ build the matching native bridge first. Missing Node, TypeScript dependencies
182
+ or bridge binaries fail the test.
183
+
184
+ The Go acceptance suite also runs SDK boundary tests for the protocol scenarios.
185
+ These tests use native pipes, fake bound services and a temporary Git file remote.
186
+ Run the native pipe test on Windows to verify raw handles there. Controller
187
+ authorization, store transitions, artifact/memo persistence, real DinD and the
188
+ six placement paths require their corresponding integration hosts.
@@ -0,0 +1,272 @@
1
+ import { spawn } from "node:child_process";
2
+ import { randomUUID } from "node:crypto";
3
+ import { isAbsolute, resolve } from "node:path";
4
+ import { assertExecution, projectRoot } from "./scope.js";
5
+ export const exitNotStarted = -1;
6
+ const bindings = new WeakMap();
7
+ export class ExecError extends Error {
8
+ command;
9
+ stdout;
10
+ stderr;
11
+ exitCode;
12
+ terminated;
13
+ constructor(result, terminated = "", cause) {
14
+ let message = terminated
15
+ ? `command terminated by ${terminated}: ${result.command}`
16
+ : result.exitCode === exitNotStarted
17
+ ? `command failed to start: ${result.command}`
18
+ : `command failed (exit ${result.exitCode}): ${result.command}`;
19
+ const output = result.stderr.trim() || result.stdout.trim();
20
+ if (cause instanceof Error && (terminated || result.exitCode === exitNotStarted))
21
+ message += `: ${cause.message}`;
22
+ else if (output)
23
+ message += `\n${output}`;
24
+ super(message, cause === undefined ? undefined : { cause });
25
+ this.name = "ExecError";
26
+ this.command = result.command;
27
+ this.stdout = result.stdout;
28
+ this.stderr = result.stderr;
29
+ this.exitCode = result.exitCode;
30
+ this.terminated = terminated;
31
+ }
32
+ }
33
+ export function registerCommandContext(ctx, emit, env = {}) {
34
+ bindings.set(ctx, { emit, env: { ...env } });
35
+ }
36
+ function binding(ctx) {
37
+ return bindings.get(ctx) ?? { emit: (event, attrs) => ctx.log.info(event, attrs), env: {} };
38
+ }
39
+ function deriveContext(ctx, signal, env) {
40
+ const derived = Object.create(ctx);
41
+ const registered = bindings.has(ctx);
42
+ Object.defineProperties(derived, {
43
+ signal: { value: signal, enumerable: true },
44
+ exec: {
45
+ value: (argv, options) => registered ? createCommand(derived, argv, options) : ctx.exec.call(derived, argv, { ...options, env: { ...env, ...options?.env } }),
46
+ },
47
+ bash: {
48
+ value: (script, options) => registered
49
+ ? createCommand(derived, ["bash", "-c", script], options)
50
+ : ctx.bash.call(derived, script, { ...options, env: { ...env, ...options?.env } }),
51
+ },
52
+ });
53
+ if (registered)
54
+ registerCommandContext(derived, binding(ctx).emit, env);
55
+ return derived;
56
+ }
57
+ export function withCommandEnv(ctx, env) {
58
+ return deriveContext(ctx, ctx.signal, { ...binding(ctx).env, ...env });
59
+ }
60
+ export function withSignal(ctx, signal) {
61
+ return deriveContext(ctx, signal, binding(ctx).env);
62
+ }
63
+ export function cleanupContext(ctx) {
64
+ return withSignal(ctx, new AbortController().signal);
65
+ }
66
+ export function createCommand(ctx, argv, options = {}) {
67
+ let cwd = options.cwd;
68
+ const env = Object.assign(Object.create(null), options.env);
69
+ const args = [argv[0], ...argv.slice(1)];
70
+ const execute = (capture) => runCommand(ctx, args, { ...(cwd === undefined ? {} : { cwd }), env, capture });
71
+ return {
72
+ dir(value) {
73
+ cwd = value;
74
+ return this;
75
+ },
76
+ env(name, value) {
77
+ env[name] = value;
78
+ return this;
79
+ },
80
+ envMap(values) {
81
+ Object.assign(env, values);
82
+ return this;
83
+ },
84
+ run() {
85
+ return execute(false);
86
+ },
87
+ capture() {
88
+ return execute(true);
89
+ },
90
+ async string() {
91
+ return (await execute(true)).stdout.trim();
92
+ },
93
+ async lines() {
94
+ return (await execute(true)).stdout
95
+ .split("\n")
96
+ .map((line) => line.trim())
97
+ .filter(Boolean);
98
+ },
99
+ async json() {
100
+ const result = await execute(true);
101
+ try {
102
+ return JSON.parse(result.stdout);
103
+ }
104
+ catch (cause) {
105
+ throw new Error(`parse JSON from ${result.command}`, { cause });
106
+ }
107
+ },
108
+ async mustBeEmpty(reason) {
109
+ const output = (await execute(true)).stdout.trim();
110
+ if (output)
111
+ throw new Error(`${reason}:\n${output}`);
112
+ },
113
+ };
114
+ }
115
+ const protocolEnv = new Set([
116
+ "SPARKWING_NODE_TOKEN",
117
+ "SPARKWING_AGENT_TOKEN",
118
+ "SPARKWING_CACHE_GRANT",
119
+ "SPARKWING_SOURCE_TOKEN",
120
+ "SPARKWING_API_TOKEN",
121
+ "SPARKWING_LEASE_TOKEN",
122
+ "SPARKWING_SECRETS_KEY",
123
+ "SPARKWING_SECRETS_PREVIOUS_KEY",
124
+ "SPARKWING_RELEASE_SIGNING_KEY",
125
+ "SPARKWING_NODE_URL",
126
+ "SPARKWING_PROTOCOL_HANDLES",
127
+ "SPARKWING_CONTROLLER_URL",
128
+ ]);
129
+ function commandEnv(ctx, options) {
130
+ const env = Object.create(null);
131
+ for (const layer of [process.env, binding(ctx).env, options.env ?? {}]) {
132
+ for (const [name, value] of Object.entries(layer)) {
133
+ const key = process.platform === "win32" ? name.toUpperCase() : name;
134
+ if (!protocolEnv.has(key) && !key.startsWith("SPARKWING_NODE_CLAIM_"))
135
+ env[key] = value;
136
+ }
137
+ }
138
+ return env;
139
+ }
140
+ export function runInput(ctx, argv, input, options = {}) {
141
+ return runCommand(ctx, argv, { ...options, input, capture: true });
142
+ }
143
+ export async function runCommand(ctx, argv, options = {}) {
144
+ assertExecution();
145
+ const command = argv[0] === "bash" && argv[1] === "-c" && argv.length === 3 ? argv[2] : argv.join(" ");
146
+ const emit = binding(ctx).emit;
147
+ const started = performance.now();
148
+ let result = { command, stdout: "", stderr: "", exitCode: exitNotStarted };
149
+ let terminated = "";
150
+ emit("exec_start", { command });
151
+ try {
152
+ if (ctx.signal.aborted)
153
+ throw new ExecError(result, "cancellation", ctx.signal.reason);
154
+ const cwd = options.cwd !== undefined && isAbsolute(options.cwd) ? options.cwd : resolve(projectRoot(), options.cwd ?? "");
155
+ const child = spawn(argv[0], argv.slice(1), {
156
+ cwd,
157
+ env: commandEnv(ctx, options),
158
+ detached: process.platform !== "win32",
159
+ // safety: Only these three handles are inherited; protocol handles never enter a tool.
160
+ stdio: [options.input === undefined ? "ignore" : "pipe", "pipe", "pipe"],
161
+ windowsHide: true,
162
+ });
163
+ const completion = await collectCommand(ctx, child, options, emit);
164
+ result = { command, stdout: completion.stdout, stderr: completion.stderr, exitCode: completion.exitCode };
165
+ terminated = completion.terminated;
166
+ if (completion.cause !== undefined || result.exitCode !== 0 || terminated)
167
+ throw new ExecError(result, terminated, completion.cause);
168
+ return result;
169
+ }
170
+ catch (cause) {
171
+ const error = cause instanceof ExecError ? cause : new ExecError(result, terminated, cause);
172
+ terminated = error.terminated;
173
+ throw error;
174
+ }
175
+ finally {
176
+ emit("exec_end", { command, exit_code: result.exitCode, duration_ms: performance.now() - started, terminated });
177
+ }
178
+ }
179
+ function collectCommand(ctx, child, options, emit) {
180
+ return new Promise((resolveDone) => {
181
+ let cause;
182
+ let cancelled = false;
183
+ const kill = () => {
184
+ try {
185
+ terminate(child, commandEnv(ctx, {}));
186
+ }
187
+ catch (error) {
188
+ cause ??= error;
189
+ }
190
+ };
191
+ const abort = () => {
192
+ cancelled = true;
193
+ kill();
194
+ };
195
+ const onError = (error) => {
196
+ cause ??= error;
197
+ kill();
198
+ };
199
+ const commandID = randomUUID();
200
+ const stdout = collectStream(child.stdout, "stdout", `${commandID}:stdout`, options.stdout, options.capture === true, emit, onError);
201
+ const stderr = collectStream(child.stderr, "stderr", `${commandID}:stderr`, options.stderr, options.capture === true, emit, onError);
202
+ child.on("error", (error) => {
203
+ cause ??= error;
204
+ });
205
+ ctx.signal.addEventListener("abort", abort, { once: true });
206
+ if (ctx.signal.aborted)
207
+ abort();
208
+ child.once("close", (code, signal) => {
209
+ ctx.signal.removeEventListener("abort", abort);
210
+ resolveDone({
211
+ stdout: stdout(),
212
+ stderr: stderr(),
213
+ exitCode: cancelled || code === null || code < 0 ? exitNotStarted : code,
214
+ terminated: cancelled ? "cancellation" : signal ? "signal" : "",
215
+ cause: cancelled ? ctx.signal.reason : (cause ?? (signal ? new Error(`process received ${signal}`) : undefined)),
216
+ });
217
+ });
218
+ if (child.stdin) {
219
+ child.stdin.on("error", onError);
220
+ child.stdin.end(options.input);
221
+ }
222
+ });
223
+ }
224
+ function collectStream(stream, name, streamID, callback, silent, emit, onError) {
225
+ const chunks = [];
226
+ stream?.on("data", (chunk) => {
227
+ chunks.push(Buffer.from(chunk));
228
+ try {
229
+ callback?.(chunk);
230
+ if (!silent)
231
+ emit("exec_chunk", { stream: streamID, source: name, data: chunk.toString("base64") });
232
+ }
233
+ catch (error) {
234
+ onError(error);
235
+ }
236
+ });
237
+ stream?.on("error", onError);
238
+ stream?.once("end", () => {
239
+ if (silent)
240
+ return;
241
+ try {
242
+ emit("exec_chunk", { stream: streamID, source: name, end: true });
243
+ }
244
+ catch (error) {
245
+ onError(error);
246
+ }
247
+ });
248
+ return () => Buffer.concat(chunks).toString("utf8");
249
+ }
250
+ function terminate(child, env) {
251
+ if (child.pid === undefined)
252
+ return;
253
+ if (process.platform === "win32") {
254
+ const killer = spawn("taskkill", ["/pid", String(child.pid), "/T", "/F"], { env, stdio: "ignore", windowsHide: true });
255
+ killer.once("error", () => {
256
+ child.kill("SIGKILL");
257
+ });
258
+ killer.once("exit", (code) => {
259
+ if (code !== 0)
260
+ child.kill("SIGKILL");
261
+ });
262
+ return;
263
+ }
264
+ try {
265
+ process.kill(-child.pid, "SIGKILL");
266
+ }
267
+ catch (error) {
268
+ if (!(error instanceof Error && "code" in error && error.code === "ESRCH"))
269
+ throw error;
270
+ }
271
+ }
272
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,CAAC,MA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
+ import { SDKError, failure } from "./errors.js";
3
+ import { LogWriter } from "./log.js";
4
+ export function makeContext(options) {
5
+ const { run, signal, jobId } = options;
6
+ const log = new LogWriter(options.frames, options.stepId);
7
+ const services = () => {
8
+ signal.throwIfAborted();
9
+ if (!options.services)
10
+ throw failure("unavailable", "this process has no bound host services");
11
+ return options.services;
12
+ };
13
+ const read = async (name, variable) => {
14
+ const declaration = options.definition.secrets?.find((s) => s.name === name && Boolean(s.variable) === variable);
15
+ if (!declaration)
16
+ throw failure("forbidden", "value was not declared by this pipeline", { reason: "secret_undeclared" });
17
+ try {
18
+ return await services().secret(name, signal);
19
+ }
20
+ catch (error) {
21
+ if (declaration.optional && error instanceof SDKError && error.code === "not_found")
22
+ return undefined;
23
+ throw error;
24
+ }
25
+ };
26
+ const ctx = {
27
+ run,
28
+ jobId,
29
+ args: options.args,
30
+ dryRun: run.dryRun,
31
+ runner: run.runner,
32
+ signal,
33
+ log,
34
+ ...(options.stepId === undefined ? {} : { stepId: options.stepId }),
35
+ ...(options.failure === undefined ? {} : { failure: options.failure }),
36
+ secret: (name) => read(name, false),
37
+ variable: (name) => read(name, true),
38
+ output: (job) => services().output(typeof job === "string" ? job : job.id, signal),
39
+ stepOutput: (step) => options.outputs.get(typeof step === "string" ? step : step.id),
40
+ annotate: async (annotation) => {
41
+ checkAnnotation(annotation);
42
+ await services().annotate(annotation, signal, options.stepId);
43
+ },
44
+ summary: async (markdown) => {
45
+ if (typeof markdown !== "string")
46
+ throw failure("bad_request", "summary markdown must be a string");
47
+ await services().summary(markdown, signal, options.stepId);
48
+ },
49
+ mask: (value) => services().mask(value, signal),
50
+ oidcToken: (audience) => services().oidcToken(audience, signal),
51
+ runPipeline: (pipeline, job, child = {}) => services().runPipeline(pipeline, job, child, signal),
52
+ latest: (ref) => services().latest(ref, signal),
53
+ cleanup: (spec) => services().cleanup(spec, signal),
54
+ exec: (argv, opts) => createCommand(ctx, argv, opts),
55
+ bash: (script, opts) => createCommand(ctx, ["bash", "-c", script], opts),
56
+ };
57
+ registerCommandContext(ctx, (event, attrs) => log.event(event, attrs), options.bodyEnv);
58
+ return ctx;
59
+ }
60
+ function checkAnnotation(annotation) {
61
+ if (typeof annotation.message !== "string")
62
+ throw failure("bad_request", "annotation message must be a string");
63
+ if (annotation.level !== undefined && typeof annotation.level !== "string")
64
+ throw failure("bad_request", "annotation level must be a string");
65
+ for (const value of [annotation.line, annotation.endLine, annotation.column])
66
+ if (value !== undefined && !Number.isSafeInteger(value))
67
+ throw failure("bad_request", "annotation location must be an integer");
68
+ }
69
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAC;AAgBpD,MAAM,UAAU,WAAW,CAAC,OAAuB;IACjD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IACvC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,GAAiB,EAAE;QAClC,MAAM,CAAC,cAAc,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,QAAQ;YAAE,MAAM,OAAO,CAAC,aAAa,EAAE,yCAAyC,CAAC,CAAC;QAC/F,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC1B,CAAC,CAAC;IACF,MAAM,IAAI,GAAG,KAAK,EAAE,IAAY,EAAE,QAAiB,EAA+B,EAAE;QAClF,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,C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I,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;QACnD,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;QACpD,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC;KACzE,CAAC;IACF,sBAAsB,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxF,OAAO,GAAG,CAAC;AACb,CAAC;AACD,SAAS,eAAe,CAAC,UAAsB;IAC7C,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ;QAAE,MAAM,OAAO,CAAC,aAAa,EAAE,qCAAqC,CAAC,CAAC;IAChH,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ;QAAE,MAAM,OAAO,CAAC,aAAa,EAAE,mCAAmC,CAAC,CAAC;IAC9I,KAAK,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC;QAC1E,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;YACrD,MAAM,OAAO,CAAC,aAAa,EAAE,wCAAwC,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,70 @@
1
+ import { Plan, pipelines } from "./plan.js";
2
+ import { SDKError, errorFields } from "./errors.js";
3
+ export function argument(spec, jobID) {
4
+ const arg = { name: spec.name, type: spec.type, required: spec.required ?? false };
5
+ if (spec.short !== undefined)
6
+ arg.short = spec.short;
7
+ if (spec.description !== undefined)
8
+ arg.desc = spec.description;
9
+ if (spec.default !== undefined && spec.default !== "")
10
+ arg.default = spec.default;
11
+ if (spec.enum !== undefined)
12
+ arg.enum = [...spec.enum];
13
+ if (spec.secret !== undefined)
14
+ arg.secret = spec.secret;
15
+ if (jobID !== undefined)
16
+ arg.job_id = jobID;
17
+ return arg;
18
+ }
19
+ export async function describe(run) {
20
+ const descriptions = [];
21
+ const definitions = pipelines();
22
+ for (const definition of definitions) {
23
+ const plan = new Plan();
24
+ try {
25
+ const entry = { name: definition.name, args: (definition.args ?? []).map((spec) => argument(spec)) };
26
+ if (definition.short !== undefined)
27
+ entry.short = definition.short;
28
+ const help = definition.help ?? definition.description;
29
+ if (help !== undefined)
30
+ entry.help = help;
31
+ if (definition.extra !== undefined)
32
+ entry.extra = definition.extra;
33
+ if (definition.examples)
34
+ entry.examples = definition.examples.map((example) => ({ command: example.command, comment: example.comment ?? "" }));
35
+ if (definition.envVars)
36
+ entry.env_vars = definition.envVars.map((env) => ({ ...env }));
37
+ if (definition.secrets)
38
+ entry.secrets = definition.secrets.map((secret) => ({
39
+ name: secret.name,
40
+ ...(secret.optional === undefined ? {} : { optional: secret.optional }),
41
+ }));
42
+ const args = {};
43
+ await definition.plan(plan, { ...run, pipeline: definition.name, args });
44
+ const risks = new Set();
45
+ const byStep = [];
46
+ for (const job of plan.jobs()) {
47
+ entry.args.push(...job.argSpecs().map((spec) => argument(spec, job.id)));
48
+ for (const step of job.steps()) {
49
+ const labels = step.toSpec().risks ?? [];
50
+ if (labels.length)
51
+ byStep.push({ job_id: job.id, step_id: step.id, labels });
52
+ for (const label of labels)
53
+ risks.add(label);
54
+ }
55
+ }
56
+ if (risks.size)
57
+ entry.risks = [...risks].sort();
58
+ if (byStep.length)
59
+ entry.risks_by_step = byStep;
60
+ plan.seal();
61
+ descriptions.push(entry);
62
+ }
63
+ catch (error) {
64
+ const message = error instanceof Error ? error.message : String(error);
65
+ descriptions.push({ name: definition.name, args: [], error: errorFields(new SDKError(`describe pipeline ${JSON.stringify(definition.name)}: ${message}`, { code: "plan_failed" })) });
66
+ }
67
+ }
68
+ return { pipelines: descriptions };
69
+ }
70
+ //# sourceMappingURL=describe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe.js","sourceRoot":"","sources":["../src/describe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAoB,MAAM,aAAa,CAAC;AA8BtE,MAAM,UAAU,QAAQ,CAAC,IAAa,EAAE,KAAc;IACpD,MAAM,GAAG,GAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC;IAChG,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACrD,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAChE,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,KAAK,EAAE;QAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAClF,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACxD,IAAI,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC;IAC5C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC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