@boboddy/sdk 0.1.13-alpha → 0.1.15-alpha

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 (34) hide show
  1. package/dist/boboddy-config-parser.js +4 -325
  2. package/dist/client.js +7 -6
  3. package/dist/defaults/auth-file.d.ts +14 -0
  4. package/dist/defaults/base-url.d.ts +1 -0
  5. package/dist/defaults/index.d.ts +7 -0
  6. package/dist/defaults/index.js +312 -0
  7. package/dist/defaults/load-push-defaults.d.ts +21 -0
  8. package/dist/defaults/project-config.d.ts +5 -0
  9. package/dist/definitions/advancement-policies/define-advancement-policy.d.ts +4 -0
  10. package/dist/definitions/advancement-policies/fluent-rules.d.ts +82 -0
  11. package/dist/definitions/advancement-policies/index.d.ts +1 -0
  12. package/dist/definitions/advancement-policies/index.js +87 -0
  13. package/dist/definitions/pipelines/builder.d.ts +85 -0
  14. package/dist/definitions/pipelines/define-pipeline.d.ts +16 -52
  15. package/dist/definitions/pipelines/index.d.ts +2 -0
  16. package/dist/definitions/pipelines/index.js +16069 -202
  17. package/dist/definitions/pipelines/input-accessor.d.ts +25 -0
  18. package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +231 -44
  19. package/dist/definitions/steps/define-step.d.ts +17 -4
  20. package/dist/definitions/steps/index.d.ts +1 -0
  21. package/dist/definitions/steps/index.js +1616 -1586
  22. package/dist/definitions/steps/prompt-template.d.ts +16 -0
  23. package/dist/definitions/steps/step-definitions-client.d.ts +9 -3
  24. package/dist/definitions/steps/step-features.d.ts +1 -1
  25. package/dist/generated/index.d.ts +1 -1
  26. package/dist/generated/sdk.gen.d.ts +2 -2
  27. package/dist/generated/types.gen.d.ts +154 -174
  28. package/dist/index.js +1979 -1989
  29. package/dist/jsonc.js +1 -0
  30. package/dist/opencode-mcp.js +1573 -1572
  31. package/dist/push/index.d.ts +2 -0
  32. package/dist/push/index.js +16423 -0
  33. package/dist/push/push-from-directory.d.ts +21 -0
  34. package/package.json +9 -1
@@ -0,0 +1,25 @@
1
+ import type { ZodType } from "zod";
2
+ import type { PipelineInputBinding } from "./define-pipeline";
3
+ type DeepAccessor<T> = T extends ReadonlyArray<infer U> ? {
4
+ readonly [index: number]: InputAccessor<U>;
5
+ } : T extends object ? {
6
+ readonly [K in keyof T]: InputAccessor<T[K]>;
7
+ } : object;
8
+ /**
9
+ * Type-level shape of the input accessor. Claims to be a `PipelineInputBinding`
10
+ * so it slots into binding positions for type-checking; the actual binding
11
+ * object is produced at builder time via `materializeAccessor`.
12
+ */
13
+ export type InputAccessor<T> = PipelineInputBinding & DeepAccessor<T>;
14
+ /**
15
+ * Creates a recursive proxy bound to the pipeline's input schema. Each property
16
+ * access returns a new accessor whose `materializeAccessor()` yields a
17
+ * `PipelineInputBinding` with the accumulated dot-path.
18
+ *
19
+ * The schema argument is used only for type inference — no runtime validation
20
+ * is performed against it.
21
+ */
22
+ export declare function createInputAccessor<T extends ZodType>(_schema: T): InputAccessor<T["_output"]>;
23
+ export declare function isInputAccessor(value: unknown): value is InputAccessor<unknown>;
24
+ export declare function materializeAccessor(accessor: InputAccessor<unknown>): PipelineInputBinding;
25
+ export {};
@@ -1,56 +1,243 @@
1
- import type { SerializedAdvancementPolicy } from "../advancement-policies/define-advancement-policy";
1
+ import { PipelineDefinitions } from "../../generated/sdk.gen";
2
+ import type { PutApiLinearPipelineDefinitionsData } from "../../generated/types.gen";
3
+ import type { PipelineDefinitionSpec } from "./define-pipeline";
2
4
  type RequestOptions = {
3
- headers?: Record<string, unknown>;
5
+ headers?: Record<string, unknown> | undefined;
4
6
  };
5
- export type PipelineStepCreateInput = {
6
- stepDefinitionId: string;
7
- stepDefinitionVersion: number;
8
- key: string;
9
- name: string;
10
- description: string | null;
11
- position: number;
12
- inputBindingsJson: Record<string, unknown>;
13
- timeoutSeconds: number | null;
14
- retryPolicyJson: null;
15
- advancementPolicyDefinition: SerializedAdvancementPolicy;
16
- };
17
- export type CreatePipelineInput = {
18
- projectId: string;
19
- key: string;
20
- name: string;
21
- description: string | null;
22
- version: number;
23
- status: "draft" | "active" | "archived";
24
- stepDefinitions: PipelineStepCreateInput[];
25
- };
26
- export type UpdatePipelineInput = {
27
- projectId: string;
28
- key: string;
29
- name: string;
30
- description: string | null;
31
- version: number;
32
- status: "draft" | "active" | "archived";
33
- };
34
- export type ExistingPipelineStep = {
35
- id: string;
36
- key: string;
37
- };
38
- export type ExistingPipeline = {
7
+ export type UpsertPipelineDefinitionInput = PutApiLinearPipelineDefinitionsData["body"];
8
+ export type StepDefinitionRef = {
39
9
  id: string;
40
10
  key: string;
41
11
  version: number;
42
- status: string;
43
- steps: ExistingPipelineStep[];
44
12
  };
45
13
  export declare function createPipelineDefinitionsClient(baseUrl: string): ReturnType<typeof buildPipelineDefinitionsClient>;
46
- declare const buildPipelineDefinitionsClient: (_base: string, doFetch: (path: string, method: string, headers: Record<string, string>, body?: unknown) => Promise<unknown>) => {
47
- listByProjectId: (projectId: string, options?: RequestOptions) => Promise<ExistingPipeline[]>;
48
- create: (body: CreatePipelineInput, options?: RequestOptions) => Promise<{
14
+ declare const buildPipelineDefinitionsClient: (pipelineDefinitions: PipelineDefinitions) => {
15
+ listByProjectId: (projectId: string, options?: RequestOptions) => Promise<{
16
+ id: string;
17
+ projectId: string;
18
+ key: string;
19
+ name: string;
20
+ description: string | unknown;
21
+ status: "draft" | "active" | "archived";
22
+ archivedAt: string | unknown;
23
+ inputSchemaJson: unknown;
24
+ stepDefinitions: Array<{
25
+ id: string;
26
+ linearPipelineDefinitionId: string;
27
+ stepDefinitionId: string;
28
+ stepDefinitionVersion: number;
29
+ key: string;
30
+ name: string;
31
+ description: string | unknown;
32
+ position: number;
33
+ inputBindingsJson: {
34
+ [key: string]: {
35
+ source: string;
36
+ path: string | unknown;
37
+ } | {
38
+ source: string;
39
+ field: "title" | "description";
40
+ } | {
41
+ source: string;
42
+ stepKey: string;
43
+ path: string | unknown;
44
+ } | {
45
+ source: string;
46
+ stepKey: string;
47
+ signalKey: string;
48
+ } | {
49
+ source: string;
50
+ value: unknown;
51
+ };
52
+ } | unknown;
53
+ timeoutSeconds: number | unknown;
54
+ retryPolicyJson: unknown;
55
+ advancementPolicyDefinition: {
56
+ id: string;
57
+ linearPipelineStepDefinitionId: string;
58
+ rulesJson: {
59
+ rules: Array<{
60
+ conditions: {
61
+ [key: string]: unknown;
62
+ };
63
+ event: {
64
+ type: string;
65
+ params?: {
66
+ [key: string]: unknown;
67
+ };
68
+ };
69
+ name?: string;
70
+ priority?: number;
71
+ [key: string]: unknown | {
72
+ [key: string]: unknown;
73
+ } | {
74
+ type: string;
75
+ params?: {
76
+ [key: string]: unknown;
77
+ };
78
+ } | string | number | undefined;
79
+ }>;
80
+ [key: string]: unknown | Array<{
81
+ conditions: {
82
+ [key: string]: unknown;
83
+ };
84
+ event: {
85
+ type: string;
86
+ params?: {
87
+ [key: string]: unknown;
88
+ };
89
+ };
90
+ name?: string;
91
+ priority?: number;
92
+ [key: string]: unknown | {
93
+ [key: string]: unknown;
94
+ } | {
95
+ type: string;
96
+ params?: {
97
+ [key: string]: unknown;
98
+ };
99
+ } | string | number | undefined;
100
+ }>;
101
+ };
102
+ defaultEventType: "continue" | "block" | "complete" | "route";
103
+ defaultEventParamsJson: unknown;
104
+ allowedEventTypes: Array<"continue" | "block" | "complete" | "route">;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ };
108
+ computedSignalDefinitions: Array<{
109
+ id: string;
110
+ key: string;
111
+ type: "average" | "weighted_average" | "sum" | "min" | "max" | "count" | "boolean_any" | "boolean_all";
112
+ inputSignalKeys: Array<string>;
113
+ configJson: unknown;
114
+ availableWhenResultStatusIn: Array<string> | unknown;
115
+ createdAt: string;
116
+ updatedAt: string;
117
+ }>;
118
+ createdAt: string;
119
+ updatedAt: string;
120
+ }>;
121
+ createdAt: string;
122
+ updatedAt: string;
123
+ }[]>;
124
+ /**
125
+ * Upserts a pipeline definition keyed by (projectId, key). Accepts the
126
+ * `PipelineDefinitionSpec` produced by `pipeline().build()`, along with the
127
+ * list of pushed step definitions (used to resolve `stepDefinitionId` for
128
+ * each pipeline step).
129
+ *
130
+ * Throws if any pipeline step references a step key/version that isn't
131
+ * present in `stepDefs`.
132
+ */
133
+ upsertFromSpec: (projectId: string, spec: PipelineDefinitionSpec, stepDefs: ReadonlyArray<StepDefinitionRef>, options?: RequestOptions) => Promise<{
49
134
  id: string;
135
+ projectId: string;
50
136
  key: string;
137
+ name: string;
138
+ description: string | unknown;
139
+ status: "draft" | "active" | "archived";
140
+ archivedAt: string | unknown;
141
+ inputSchemaJson: unknown;
142
+ stepDefinitions: Array<{
143
+ id: string;
144
+ linearPipelineDefinitionId: string;
145
+ stepDefinitionId: string;
146
+ stepDefinitionVersion: number;
147
+ key: string;
148
+ name: string;
149
+ description: string | unknown;
150
+ position: number;
151
+ inputBindingsJson: {
152
+ [key: string]: {
153
+ source: string;
154
+ path: string | unknown;
155
+ } | {
156
+ source: string;
157
+ field: "title" | "description";
158
+ } | {
159
+ source: string;
160
+ stepKey: string;
161
+ path: string | unknown;
162
+ } | {
163
+ source: string;
164
+ stepKey: string;
165
+ signalKey: string;
166
+ } | {
167
+ source: string;
168
+ value: unknown;
169
+ };
170
+ } | unknown;
171
+ timeoutSeconds: number | unknown;
172
+ retryPolicyJson: unknown;
173
+ advancementPolicyDefinition: {
174
+ id: string;
175
+ linearPipelineStepDefinitionId: string;
176
+ rulesJson: {
177
+ rules: Array<{
178
+ conditions: {
179
+ [key: string]: unknown;
180
+ };
181
+ event: {
182
+ type: string;
183
+ params?: {
184
+ [key: string]: unknown;
185
+ };
186
+ };
187
+ name?: string;
188
+ priority?: number;
189
+ [key: string]: unknown | {
190
+ [key: string]: unknown;
191
+ } | {
192
+ type: string;
193
+ params?: {
194
+ [key: string]: unknown;
195
+ };
196
+ } | string | number | undefined;
197
+ }>;
198
+ [key: string]: unknown | Array<{
199
+ conditions: {
200
+ [key: string]: unknown;
201
+ };
202
+ event: {
203
+ type: string;
204
+ params?: {
205
+ [key: string]: unknown;
206
+ };
207
+ };
208
+ name?: string;
209
+ priority?: number;
210
+ [key: string]: unknown | {
211
+ [key: string]: unknown;
212
+ } | {
213
+ type: string;
214
+ params?: {
215
+ [key: string]: unknown;
216
+ };
217
+ } | string | number | undefined;
218
+ }>;
219
+ };
220
+ defaultEventType: "continue" | "block" | "complete" | "route";
221
+ defaultEventParamsJson: unknown;
222
+ allowedEventTypes: Array<"continue" | "block" | "complete" | "route">;
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ };
226
+ computedSignalDefinitions: Array<{
227
+ id: string;
228
+ key: string;
229
+ type: "average" | "weighted_average" | "sum" | "min" | "max" | "count" | "boolean_any" | "boolean_all";
230
+ inputSignalKeys: Array<string>;
231
+ configJson: unknown;
232
+ availableWhenResultStatusIn: Array<string> | unknown;
233
+ createdAt: string;
234
+ updatedAt: string;
235
+ }>;
236
+ createdAt: string;
237
+ updatedAt: string;
238
+ }>;
239
+ createdAt: string;
240
+ updatedAt: string;
51
241
  }>;
52
- update: (pipelineId: string, body: UpdatePipelineInput, options?: RequestOptions) => Promise<void>;
53
- addStep: (pipelineId: string, body: PipelineStepCreateInput, options?: RequestOptions) => Promise<void>;
54
- removeStep: (pipelineId: string, stepId: string, options?: RequestOptions) => Promise<void>;
55
242
  };
56
243
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { ZodType } from "zod";
2
2
  import type { AnyStepFeature, FeatureResultExtensions, FeatureSignalKeys } from "./step-features";
3
+ import { type PromptInputProxy } from "./prompt-template";
3
4
  type OpenCodeMcpServers = Record<string, {
4
5
  type: "local";
5
6
  command: string[];
@@ -48,7 +49,7 @@ export type DefineStepInput<TInput extends ZodType = ZodType, TResult extends Zo
48
49
  name: string;
49
50
  description?: string | null;
50
51
  version?: number;
51
- prompt?: string | null;
52
+ prompt?: string | null | ((input: PromptInputProxy<TInput["_output"]>) => string);
52
53
  input?: TInput;
53
54
  result?: TResult;
54
55
  signals?: SignalSpecInput<TResult["_output"]>[];
@@ -75,10 +76,19 @@ export type StepDefinitionSpec = {
75
76
  }>;
76
77
  opencodeMcpJson: OpenCodeMcpServers | null;
77
78
  };
78
- export type TypedStepDefinitionSpec<TInput = unknown, TResult = unknown, TSignalKeys extends string = string> = StepDefinitionSpec & {
79
+ export type SignalTypeStrToTs<T extends SignalTypeStr> = T extends "string" ? string : T extends "number" ? number : T extends "boolean" ? boolean : T extends "array" ? unknown[] : T extends "object" ? object : unknown;
80
+ export type SignalTypeMapOf<TSignals extends readonly unknown[], TResult> = {
81
+ [S in TSignals[number] as ExtractSignalKey<S>]: S extends {
82
+ type: infer T extends SignalTypeStr;
83
+ } ? SignalTypeStrToTs<T> : S extends {
84
+ sourcePath: infer P extends string;
85
+ } ? TypeAtPath<TResult, P> : unknown;
86
+ };
87
+ export type TypedStepDefinitionSpec<TInput = unknown, TResult = unknown, TSignalKeys extends string = string, TSignalTypeMap extends Partial<Record<string, unknown>> = Record<string, unknown>> = StepDefinitionSpec & {
79
88
  readonly __inputType: TInput;
80
89
  readonly __resultType: TResult;
81
90
  readonly __signalKeys: TSignalKeys;
91
+ readonly __signalTypeMap: TSignalTypeMap;
82
92
  };
83
93
  type ExtractSignalKey<T> = T extends {
84
94
  key: infer K extends string;
@@ -86,8 +96,11 @@ type ExtractSignalKey<T> = T extends {
86
96
  sourcePath: infer S extends string;
87
97
  } ? S : string;
88
98
  export type SignalKeysOf<TSignals extends readonly unknown[]> = TSignals extends readonly (infer S)[] ? ExtractSignalKey<S> : string;
89
- export declare function defineStep<TInput extends ZodType = ZodType, TResult extends ZodType = ZodType, const TSignals extends ReadonlyArray<SignalSpecInput<TResult["_output"]>> = never[], const TFeatures extends ReadonlyArray<AnyStepFeature> = never[]>(config: Omit<DefineStepInput<TInput, TResult>, "signals" | "features"> & {
99
+ export declare function defineStep<TInput extends ZodType = ZodType, TResult extends ZodType = ZodType, const TSignals extends ReadonlyArray<{
100
+ sourcePath: string;
101
+ key?: string;
102
+ }> = never[], const TFeatures extends ReadonlyArray<AnyStepFeature> = never[]>(config: Omit<DefineStepInput<TInput, TResult>, "signals" | "features"> & {
90
103
  signals?: TSignals;
91
104
  features?: TFeatures;
92
- }): TypedStepDefinitionSpec<TInput["_output"], TResult["_output"] & FeatureResultExtensions<TFeatures>, SignalKeysOf<TSignals> | FeatureSignalKeys<TFeatures>>;
105
+ }): TypedStepDefinitionSpec<TInput["_output"], TResult["_output"] & FeatureResultExtensions<TFeatures>, SignalKeysOf<TSignals> | FeatureSignalKeys<TFeatures>, SignalTypeMapOf<TSignals, TResult["_output"]>>;
93
106
  export {};
@@ -1,3 +1,4 @@
1
1
  export * from "./define-step";
2
+ export * from "./prompt-template";
2
3
  export * from "./step-definitions-client";
3
4
  export * from "./step-features";