@scarn/sdk 0.8.17 → 0.8.19

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 (62) hide show
  1. package/dist/{chunk-g2mzg278.js → chunk-0c60x3v8.js} +51 -59
  2. package/dist/{chunk-dhqeg0wf.js → chunk-2tmrw253.js} +1 -1
  3. package/dist/{chunk-r03knh9j.js → chunk-3zp2qtf8.js} +80 -1
  4. package/dist/{chunk-ar6hcj1r.js → chunk-6tra3gw8.js} +7 -1
  5. package/dist/{chunk-a04phj60.js → chunk-833ef6dg.js} +121 -260
  6. package/dist/{chunk-2ekz6tr5.js → chunk-aemxz9r7.js} +18 -2
  7. package/dist/chunk-e0pt5x0e.js +167 -0
  8. package/dist/chunk-mmy80pec.js +64 -0
  9. package/dist/chunk-mzj1j0p5.js +116 -0
  10. package/dist/{chunk-cdj0yqgs.js → chunk-pqtd0hr7.js} +12 -2
  11. package/dist/chunk-qgkx89eg.js +210 -0
  12. package/dist/chunk-rphfy0fj.js +167 -0
  13. package/dist/chunk-t1dq2c2s.js +224 -0
  14. package/dist/{chunk-qs7p11rp.js → chunk-tvjcfh6s.js} +5 -1
  15. package/dist/{chunk-1wnv6rb2.js → chunk-ymywp5ht.js} +1 -1
  16. package/dist/client.js +8 -2
  17. package/dist/connectors/catalog.d.ts +49 -0
  18. package/dist/connectors/index.d.ts +45 -0
  19. package/dist/connectors/index.js +41 -0
  20. package/dist/defaults/index.js +2 -2
  21. package/dist/definitions/automations/index.js +2 -2
  22. package/dist/definitions/environments/define-environment.d.ts +39 -0
  23. package/dist/definitions/environments/environments-client.d.ts +50 -0
  24. package/dist/definitions/environments/index.d.ts +6 -0
  25. package/dist/definitions/environments/index.js +97 -0
  26. package/dist/definitions/pipelines/index.js +2 -2
  27. package/dist/definitions/steps/compile-mcps.d.ts +8 -12
  28. package/dist/definitions/steps/define-code-step.d.ts +18 -11
  29. package/dist/definitions/steps/define-step.d.ts +14 -25
  30. package/dist/definitions/steps/env.d.ts +30 -8
  31. package/dist/definitions/steps/index.js +30 -13
  32. package/dist/definitions/steps/mcp-server-config.d.ts +19 -9
  33. package/dist/definitions/steps/repo.d.ts +56 -28
  34. package/dist/definitions/steps/runtime.d.ts +54 -39
  35. package/dist/definitions/steps/step-definitions-client.d.ts +222 -63
  36. package/dist/definitions/steps/step-handle.d.ts +8 -1
  37. package/dist/definitions/validation/index.js +6 -3
  38. package/dist/definitions/validation/validate-repo.d.ts +3 -7
  39. package/dist/definitions/validation/validate-runtime.d.ts +2 -7
  40. package/dist/env-vars.d.ts +57 -1
  41. package/dist/env-vars.js +7 -1
  42. package/dist/environment.d.ts +564 -0
  43. package/dist/environment.js +46 -0
  44. package/dist/generated/index.d.ts +2 -2
  45. package/dist/generated/sdk.gen.d.ts +27 -2
  46. package/dist/generated/types.gen.d.ts +2141 -187
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.js +94 -28
  49. package/dist/opencode-mcp.d.ts +75 -4
  50. package/dist/opencode-mcp.js +2 -1
  51. package/dist/push/code-step-lookup.d.ts +6 -0
  52. package/dist/push/code-step-lookup.js +3 -1
  53. package/dist/push/collect-definitions.d.ts +13 -0
  54. package/dist/push/index.js +127 -15
  55. package/dist/push/push-from-directory.d.ts +11 -2
  56. package/dist/repo-config.d.ts +88 -30
  57. package/dist/repo-config.js +21 -5
  58. package/dist/resolve-environment.d.ts +19 -0
  59. package/dist/resolve-environment.js +19 -0
  60. package/dist/task-plane-client.d.ts +132 -22
  61. package/package.json +17 -1
  62. package/dist/chunk-2sk92cnd.js +0 -103
package/dist/index.d.ts CHANGED
@@ -10,3 +10,5 @@ export type { PipelineDefinition } from "./pipelines";
10
10
  export * from "./opencode-mcp";
11
11
  export * from "./jsonc";
12
12
  export * from "./scarn-config-parser";
13
+ export * from "./environment";
14
+ export * from "./resolve-environment";
package/dist/index.js CHANGED
@@ -1,15 +1,25 @@
1
1
  // @bun
2
+ import {
3
+ readEnvironmentDefinition,
4
+ resolveEnvironment,
5
+ resolveEnvironmentDefinition
6
+ } from "./chunk-mzj1j0p5.js";
2
7
  import {
3
8
  SCARN_CONFIG_RELATIVE_PATH,
4
9
  parseScarnConfig
5
10
  } from "./chunk-0y2fy5en.js";
11
+ import {
12
+ parseJsonc,
13
+ stripJsoncComments,
14
+ stripTrailingCommas
15
+ } from "./chunk-rt9tq4j6.js";
6
16
  import {
7
17
  PipelineDefinitionsApiError,
8
18
  WORK_ITEM_FIELDS_PATH_PREFIX,
9
19
  WORK_ITEM_TOP_LEVEL_FIELDS,
10
20
  createPipelineDefinitionsClient,
11
21
  resolveWorkItemFieldPath
12
- } from "./chunk-1wnv6rb2.js";
22
+ } from "./chunk-ymywp5ht.js";
13
23
  import {
14
24
  after,
15
25
  all,
@@ -54,37 +64,29 @@ import {
54
64
  } from "./chunk-9we3vqsv.js";
55
65
  import"./chunk-x0hjhqrf.js";
56
66
  import"./chunk-p1fs73bd.js";
57
- import {
58
- parseJsonc,
59
- stripJsoncComments,
60
- stripTrailingCommas
61
- } from "./chunk-rt9tq4j6.js";
62
67
  import {
63
68
  createScarnClient,
64
69
  createTaskPlaneClient
65
- } from "./chunk-qs7p11rp.js";
70
+ } from "./chunk-tvjcfh6s.js";
66
71
  import"./chunk-61jf8b6s.js";
67
72
  import"./chunk-evb3hw48.js";
68
73
  import {
69
74
  ARTIFACT_BRAND,
70
75
  Artifact,
71
76
  ArtifactTypes,
72
- Env,
73
77
  Features,
74
78
  Notify,
75
79
  Repo,
76
- Runtime,
80
+ WorkBranch,
77
81
  artifact,
82
+ assertBaseBranchFitsEnvironment,
78
83
  codeStep,
79
- compileEnvironment,
80
84
  compileMcps,
81
85
  compileRepo,
82
86
  compileStepConcurrency,
83
87
  compileStepErrors,
84
88
  compileStepMaxTurns,
85
89
  compileStepRetry,
86
- createPromptInputProxy,
87
- createPromptTemplateContext,
88
90
  createStepDefinitionsClient,
89
91
  defineMcp,
90
92
  defineStep,
@@ -92,14 +94,55 @@ import {
92
94
  grantActionValues,
93
95
  grantScopeValues,
94
96
  isMcpHandle,
95
- isSecretLookingEnvName,
96
97
  normalizeArtifactAccept,
97
- normalizeEnv,
98
- renderPromptTemplate,
99
98
  resolveMcpChecks,
99
+ stepEnvironmentHandle,
100
100
  toStepHandle,
101
101
  toStepSpec
102
- } from "./chunk-a04phj60.js";
102
+ } from "./chunk-833ef6dg.js";
103
+ import"./chunk-y34zsgsw.js";
104
+ import {
105
+ Env,
106
+ Runtime,
107
+ assertNoSetupVarsOnHost,
108
+ compileConnectors,
109
+ compileEnvironment,
110
+ createPromptInputProxy,
111
+ createPromptTemplateContext,
112
+ isSecretLookingEnvName,
113
+ knownEnvironmentVars,
114
+ normalizeEnv,
115
+ renderPromptTemplate
116
+ } from "./chunk-t1dq2c2s.js";
117
+ import"./chunk-6tra3gw8.js";
118
+ import"./chunk-jj9pezwb.js";
119
+ import {
120
+ PipelineBuildError,
121
+ formatIssue
122
+ } from "./chunk-y11p1q7r.js";
123
+ import"./chunk-rphfy0fj.js";
124
+ import {
125
+ BrokenDevcontainerReference,
126
+ EnvironmentInvalid,
127
+ EnvironmentNotFound,
128
+ environmentContentSchema,
129
+ environmentFieldsSchema,
130
+ environmentNameSchema,
131
+ environmentRefReadSchema,
132
+ environmentRefSchema,
133
+ environmentRuntimeSchema,
134
+ findHostSetupVar,
135
+ hostSetupVarMessage,
136
+ inlineEnvironmentReadSchema,
137
+ rejectEnvironmentBranch,
138
+ resolvedEnvironmentRefSchema,
139
+ storedEnvironmentContentSchema,
140
+ storedEnvironmentFieldsSchema,
141
+ storedEnvironmentRuntimeSchema
142
+ } from "./chunk-e0pt5x0e.js";
143
+ import"./chunk-098740f7.js";
144
+ import"./chunk-46wmsgv7.js";
145
+ import"./chunk-qgkx89eg.js";
103
146
  import {
104
147
  collectEnvPlaceholderNames,
105
148
  isEnvPlaceholderValue,
@@ -113,22 +156,15 @@ import {
113
156
  openCodeMcpTimeoutSchema,
114
157
  openCodeResolvedMcpServerConfigSchema,
115
158
  openCodeResolvedMcpServersSchema
116
- } from "./chunk-cdj0yqgs.js";
117
- import"./chunk-y34zsgsw.js";
118
- import"./chunk-jj9pezwb.js";
119
- import {
120
- PipelineBuildError,
121
- formatIssue
122
- } from "./chunk-y11p1q7r.js";
123
- import"./chunk-2ekz6tr5.js";
124
- import"./chunk-098740f7.js";
125
- import"./chunk-46wmsgv7.js";
126
- import"./chunk-2sk92cnd.js";
159
+ } from "./chunk-pqtd0hr7.js";
160
+ import"./chunk-aemxz9r7.js";
127
161
  import {
128
162
  Api,
129
163
  Automations,
130
164
  Billing,
165
+ Connectors,
131
166
  Conversations,
167
+ Environments,
132
168
  GitHubIntegrations,
133
169
  Inbox,
134
170
  NotificationRules,
@@ -137,6 +173,7 @@ import {
137
173
  ProjectArtifacts,
138
174
  ProjectIntegrations,
139
175
  ProjectInvites,
176
+ ProjectSecrets,
140
177
  Projects,
141
178
  ScarnClient,
142
179
  Secrets,
@@ -149,7 +186,7 @@ import {
149
186
  WorkItemCommentDrafts,
150
187
  WorkItemComments,
151
188
  WorkItems
152
- } from "./chunk-r03knh9j.js";
189
+ } from "./chunk-3zp2qtf8.js";
153
190
  import {
154
191
  ARTIFACT_MARKER_SCHEME,
155
192
  buildArtifactMarker,
@@ -181,9 +218,14 @@ export {
181
218
  ArtifactTypes,
182
219
  Automations,
183
220
  Billing,
221
+ BrokenDevcontainerReference,
222
+ Connectors,
184
223
  Conversations,
185
224
  EMBEDDABLE_ARTIFACT_EXTENSIONS,
186
225
  Env,
226
+ EnvironmentInvalid,
227
+ EnvironmentNotFound,
228
+ Environments,
187
229
  Features,
188
230
  GitHubIntegrations,
189
231
  Inbox,
@@ -196,6 +238,7 @@ export {
196
238
  ProjectArtifacts,
197
239
  ProjectIntegrations,
198
240
  ProjectInvites,
241
+ ProjectSecrets,
199
242
  Projects,
200
243
  Repo,
201
244
  Runtime,
@@ -209,6 +252,7 @@ export {
209
252
  Username,
210
253
  WORK_ITEM_FIELDS_PATH_PREFIX,
211
254
  WORK_ITEM_TOP_LEVEL_FIELDS,
255
+ WorkBranch,
212
256
  WorkItemBlocks,
213
257
  WorkItemCommentDrafts,
214
258
  WorkItemComments,
@@ -221,12 +265,15 @@ export {
221
265
  artifactFileExtension,
222
266
  artifactKindSchema,
223
267
  artifactPlatforms,
268
+ assertBaseBranchFitsEnvironment,
269
+ assertNoSetupVarsOnHost,
224
270
  attach,
225
271
  avg,
226
272
  before,
227
273
  buildArtifactMarker,
228
274
  codeStep,
229
275
  collectEnvPlaceholderNames,
276
+ compileConnectors,
230
277
  compileEnvironment,
231
278
  compileMcps,
232
279
  compileRepo,
@@ -249,23 +296,33 @@ export {
249
296
  defineStep,
250
297
  each,
251
298
  endsWith,
299
+ environmentContentSchema,
300
+ environmentFieldsSchema,
301
+ environmentNameSchema,
302
+ environmentRefReadSchema,
303
+ environmentRefSchema,
304
+ environmentRuntimeSchema,
252
305
  equal,
253
306
  every,
254
307
  exists,
255
308
  fail,
256
309
  findArtifactFields,
257
310
  findArtifactMarkers,
311
+ findHostSetupVar,
258
312
  formatArtifactMarkerRef,
259
313
  formatIssue,
260
314
  grantActionValues,
261
315
  grantScopeValues,
262
316
  greaterThan,
263
317
  greaterThanInclusive,
318
+ hostSetupVarMessage,
319
+ inlineEnvironmentReadSchema,
264
320
  isEmbeddableArtifactExtension,
265
321
  isEmpty,
266
322
  isEnvPlaceholderValue,
267
323
  isMcpHandle,
268
324
  isSecretLookingEnvName,
325
+ knownEnvironmentVars,
269
326
  lessThan,
270
327
  lessThanInclusive,
271
328
  matchArtifactNode,
@@ -292,14 +349,23 @@ export {
292
349
  parseJsonc,
293
350
  parseScarnConfig,
294
351
  readArtifactKeyword,
352
+ readEnvironmentDefinition,
353
+ rejectEnvironmentBranch,
295
354
  renderPromptTemplate,
296
355
  reply,
356
+ resolveEnvironment,
357
+ resolveEnvironmentDefinition,
297
358
  resolveMcpChecks,
298
359
  resolveWorkItemFieldPath,
360
+ resolvedEnvironmentRefSchema,
299
361
  skip,
300
362
  some,
301
363
  startsWith,
364
+ stepEnvironmentHandle,
302
365
  stepRef,
366
+ storedEnvironmentContentSchema,
367
+ storedEnvironmentFieldsSchema,
368
+ storedEnvironmentRuntimeSchema,
303
369
  stripJsoncComments,
304
370
  stripTrailingCommas,
305
371
  succeed,
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Step-declared MCP servers, in OpenCode v2's native `mcp.servers.<name>` entry
3
3
  * shape, plus a Scarn-only `ref` entry. The worker resolves refs before
4
- * passing the resulting `local`/`remote` entries to the runtime overlay, so
5
- * the `local`/`remote` schemas mirror the v2 config schema.
4
+ * passing the resulting `local`/`remote` entries to the runtime overlay.
5
+ * Authored entries carry optional Scarn-only `workerVars`; resolved entries
6
+ * never do. The native `local`/`remote` schemas mirror the v2 config schema.
6
7
  * `test/opencode-config-shapes.test.ts` fails typecheck if they drift from
7
8
  * `@opencode/client`'s generated `ConfigEntry` type.
8
9
  */
@@ -75,8 +76,8 @@ export declare const openCodeMcpRemoteConfigSchema: z.ZodObject<{
75
76
  * files (`.opencode/opencode.json`, `.mcp.json`, `.codex/config.toml`, …).
76
77
  * `name` defaults to the step's server key. The worker resolves refs into
77
78
  * `local`/`remote` entries before launch, applying the shared fields on top;
78
- * `name` is Scarn-only and dropped during resolution, so a ref never reaches
79
- * OpenCode.
79
+ * `name` and `workerVars` are Scarn-only and dropped during resolution, so a
80
+ * ref never reaches OpenCode.
80
81
  */
81
82
  export declare const openCodeMcpRefConfigSchema: z.ZodObject<{
82
83
  disabled: z.ZodOptional<z.ZodBoolean>;
@@ -93,6 +94,16 @@ export declare const openCodeMcpRefConfigSchema: z.ZodObject<{
93
94
  }>>;
94
95
  type: z.ZodLiteral<"ref">;
95
96
  name: z.ZodOptional<z.ZodString>;
97
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ name: z.ZodString;
99
+ source: z.ZodLiteral<"inherit">;
100
+ from: z.ZodString;
101
+ secret: z.ZodBoolean;
102
+ optional: z.ZodBoolean;
103
+ default: z.ZodOptional<z.ZodString>;
104
+ mcp: z.ZodOptional<z.ZodString>;
105
+ applies: z.ZodLiteral<"agent">;
106
+ }, z.core.$strict>>>;
96
107
  }, z.core.$strict>;
97
108
  export declare const openCodeResolvedMcpServerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
98
109
  disabled: z.ZodOptional<z.ZodBoolean>;
@@ -196,6 +207,16 @@ export declare const openCodeMcpServerConfigSchema: z.ZodDiscriminatedUnion<[z.Z
196
207
  command: z.ZodArray<z.ZodString>;
197
208
  cwd: z.ZodOptional<z.ZodString>;
198
209
  environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
210
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
211
+ name: z.ZodString;
212
+ source: z.ZodLiteral<"inherit">;
213
+ from: z.ZodString;
214
+ secret: z.ZodBoolean;
215
+ optional: z.ZodBoolean;
216
+ default: z.ZodOptional<z.ZodString>;
217
+ mcp: z.ZodOptional<z.ZodString>;
218
+ applies: z.ZodLiteral<"agent">;
219
+ }, z.core.$strict>>>;
199
220
  }, z.core.$strict>, z.ZodObject<{
200
221
  disabled: z.ZodOptional<z.ZodBoolean>;
201
222
  codemode: z.ZodOptional<z.ZodBoolean>;
@@ -220,6 +241,16 @@ export declare const openCodeMcpServerConfigSchema: z.ZodDiscriminatedUnion<[z.Z
220
241
  redirect_uri: z.ZodOptional<z.ZodString>;
221
242
  auth_server_metadata_url: z.ZodOptional<z.ZodString>;
222
243
  }, z.core.$strict>, z.ZodLiteral<false>]>>;
244
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
245
+ name: z.ZodString;
246
+ source: z.ZodLiteral<"inherit">;
247
+ from: z.ZodString;
248
+ secret: z.ZodBoolean;
249
+ optional: z.ZodBoolean;
250
+ default: z.ZodOptional<z.ZodString>;
251
+ mcp: z.ZodOptional<z.ZodString>;
252
+ applies: z.ZodLiteral<"agent">;
253
+ }, z.core.$strict>>>;
223
254
  }, z.core.$strict>, z.ZodObject<{
224
255
  disabled: z.ZodOptional<z.ZodBoolean>;
225
256
  codemode: z.ZodOptional<z.ZodBoolean>;
@@ -235,6 +266,16 @@ export declare const openCodeMcpServerConfigSchema: z.ZodDiscriminatedUnion<[z.Z
235
266
  }>>;
236
267
  type: z.ZodLiteral<"ref">;
237
268
  name: z.ZodOptional<z.ZodString>;
269
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
270
+ name: z.ZodString;
271
+ source: z.ZodLiteral<"inherit">;
272
+ from: z.ZodString;
273
+ secret: z.ZodBoolean;
274
+ optional: z.ZodBoolean;
275
+ default: z.ZodOptional<z.ZodString>;
276
+ mcp: z.ZodOptional<z.ZodString>;
277
+ applies: z.ZodLiteral<"agent">;
278
+ }, z.core.$strict>>>;
238
279
  }, z.core.$strict>], "type">;
239
280
  export declare const openCodeMcpServersSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
240
281
  disabled: z.ZodOptional<z.ZodBoolean>;
@@ -253,6 +294,16 @@ export declare const openCodeMcpServersSchema: z.ZodRecord<z.ZodString, z.ZodDis
253
294
  command: z.ZodArray<z.ZodString>;
254
295
  cwd: z.ZodOptional<z.ZodString>;
255
296
  environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
297
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
298
+ name: z.ZodString;
299
+ source: z.ZodLiteral<"inherit">;
300
+ from: z.ZodString;
301
+ secret: z.ZodBoolean;
302
+ optional: z.ZodBoolean;
303
+ default: z.ZodOptional<z.ZodString>;
304
+ mcp: z.ZodOptional<z.ZodString>;
305
+ applies: z.ZodLiteral<"agent">;
306
+ }, z.core.$strict>>>;
256
307
  }, z.core.$strict>, z.ZodObject<{
257
308
  disabled: z.ZodOptional<z.ZodBoolean>;
258
309
  codemode: z.ZodOptional<z.ZodBoolean>;
@@ -277,6 +328,16 @@ export declare const openCodeMcpServersSchema: z.ZodRecord<z.ZodString, z.ZodDis
277
328
  redirect_uri: z.ZodOptional<z.ZodString>;
278
329
  auth_server_metadata_url: z.ZodOptional<z.ZodString>;
279
330
  }, z.core.$strict>, z.ZodLiteral<false>]>>;
331
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
332
+ name: z.ZodString;
333
+ source: z.ZodLiteral<"inherit">;
334
+ from: z.ZodString;
335
+ secret: z.ZodBoolean;
336
+ optional: z.ZodBoolean;
337
+ default: z.ZodOptional<z.ZodString>;
338
+ mcp: z.ZodOptional<z.ZodString>;
339
+ applies: z.ZodLiteral<"agent">;
340
+ }, z.core.$strict>>>;
280
341
  }, z.core.$strict>, z.ZodObject<{
281
342
  disabled: z.ZodOptional<z.ZodBoolean>;
282
343
  codemode: z.ZodOptional<z.ZodBoolean>;
@@ -292,6 +353,16 @@ export declare const openCodeMcpServersSchema: z.ZodRecord<z.ZodString, z.ZodDis
292
353
  }>>;
293
354
  type: z.ZodLiteral<"ref">;
294
355
  name: z.ZodOptional<z.ZodString>;
356
+ workerVars: z.ZodOptional<z.ZodArray<z.ZodObject<{
357
+ name: z.ZodString;
358
+ source: z.ZodLiteral<"inherit">;
359
+ from: z.ZodString;
360
+ secret: z.ZodBoolean;
361
+ optional: z.ZodBoolean;
362
+ default: z.ZodOptional<z.ZodString>;
363
+ mcp: z.ZodOptional<z.ZodString>;
364
+ applies: z.ZodLiteral<"agent">;
365
+ }, z.core.$strict>>>;
295
366
  }, z.core.$strict>], "type">>;
296
367
  /**
297
368
  * Whether `value` carries nothing but `{env:VAR}` placeholders, optionally
@@ -12,7 +12,8 @@ import {
12
12
  openCodeMcpTimeoutSchema,
13
13
  openCodeResolvedMcpServerConfigSchema,
14
14
  openCodeResolvedMcpServersSchema
15
- } from "./chunk-cdj0yqgs.js";
15
+ } from "./chunk-pqtd0hr7.js";
16
+ import"./chunk-aemxz9r7.js";
16
17
  import"./chunk-yf15kdte.js";
17
18
  import"./chunk-y64skrwp.js";
18
19
  export {
@@ -10,6 +10,7 @@
10
10
  * Takes type-only imports so it carries no runtime dependency on the rest of
11
11
  * the SDK and can be imported on its own (`@scarn/sdk/code-step-lookup`).
12
12
  */
13
+ import type { EnvironmentHandle } from "../definitions/environments/define-environment";
13
14
  import type { StepDefinitionSpec } from "../definitions/steps";
14
15
  type CodeStepFn = NonNullable<StepDefinitionSpec["entrypoint"]>["fn"];
15
16
  /**
@@ -17,6 +18,11 @@ type CodeStepFn = NonNullable<StepDefinitionSpec["entrypoint"]>["fn"];
17
18
  * carrying the spec's fields.
18
19
  */
19
20
  export declare function isStepDefinitionSpec(value: unknown): value is StepDefinitionSpec;
21
+ /**
22
+ * An environment handle from `defineEnvironment`. Checks the shape only, like
23
+ * `isStepDefinitionSpec`, so a handle from another copy of the SDK counts.
24
+ */
25
+ export declare function isEnvironmentHandle(value: unknown): value is EnvironmentHandle;
20
26
  /**
21
27
  * Every step spec a module defines: its named exports that are step specs.
22
28
  * Deduped by reference, so a step exported under two names appears once.
@@ -1,12 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  findCodeStepInModule,
4
+ isEnvironmentHandle,
4
5
  isStepDefinitionSpec,
5
6
  stepsInModule
6
- } from "../chunk-ar6hcj1r.js";
7
+ } from "../chunk-6tra3gw8.js";
7
8
  import"../chunk-y64skrwp.js";
8
9
  export {
9
10
  findCodeStepInModule,
11
+ isEnvironmentHandle,
10
12
  isStepDefinitionSpec,
11
13
  stepsInModule
12
14
  };
@@ -1,3 +1,4 @@
1
+ import type { EnvironmentContent } from "../definitions/environments/define-environment";
1
2
  import type { StepDefinitionSpec } from "../definitions/steps";
2
3
  /**
3
4
  * The fixed, repo-root-relative directory `scarn pipelines init` scaffolds
@@ -11,9 +12,21 @@ import type { StepDefinitionSpec } from "../definitions/steps";
11
12
  * imports this one, so there's a single source of truth.
12
13
  */
13
14
  export declare const PIPELINE_BUILDER_DIR = ".scarn/pipeline-builder";
15
+ /** A named environment found while collecting, and the file it came from. */
16
+ export type CollectedEnvironment = {
17
+ readonly name: string;
18
+ readonly content: EnvironmentContent;
19
+ /** The builder file's basename, e.g. `environments.ts`. */
20
+ readonly sourceFile: string;
21
+ };
14
22
  export type CollectedDefinitions = {
15
23
  /** Deduped by `key@vN`. */
16
24
  readonly steps: readonly StepDefinitionSpec[];
25
+ /**
26
+ * Exported `defineEnvironment` handles plus any handle a collected step
27
+ * uses, deduped by name.
28
+ */
29
+ readonly environments: readonly CollectedEnvironment[];
17
30
  };
18
31
  /**
19
32
  * One source file that failed to import —